From xen-changelog-bounces@lists.xensource.com Wed Feb 01 11:22:16 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Feb 2012 11:22:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RsYGR-0006Vm-Nd; Wed, 01 Feb 2012 11:22:11 +0000
Received: from mail6.bemta3.messagelabs.com ([195.245.230.39])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RsYGQ-0006VW-JF
	for xen-changelog@lists.xensource.com; Wed, 01 Feb 2012 11:22:10 +0000
Received: from [85.158.138.51:16744] by server-8.bemta-3.messagelabs.com id
	2C/21-31878-160292F4; Wed, 01 Feb 2012 11:22:09 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1328095328!11551930!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15198 invoked from network); 1 Feb 2012 11:22:09 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Feb 2012 11:22:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RsYGN-0005qe-Ox
	for xen-changelog@lists.xensource.com; Wed, 01 Feb 2012 11:22:07 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RsYGN-0007Xp-Ng
	for xen-changelog@lists.xensource.com; Wed, 01 Feb 2012 11:22:07 +0000
Message-Id: <E1RsYGN-0007Xp-Ng@xenbits.xen.org>
Date: Wed, 01 Feb 2012 11:22:07 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] vesa: flush lfb after zeroing
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328010570 0
# Node ID 1b7e074ee1d6e263f16cded236f3819b1b9ada6d
# Parent  0ea6664f8eee651ea60016a12e340d45036c00d3
vesa: flush lfb after zeroing

If Xen is going to relinquish the VGA console, flush the linear frame
buffer after zeroing it in vesa_endboot().

Failing to do so in some circumstances leads to the actual linear
framebuffer on the graphics card still containing the output of the
Xen boot console can lead to ugly graphics output when dom0 is setting
up the graphics card for its own use.

While the patch is quite large, it is mostly just code motion to
prevent having to forward declare lfb_flush().  The only functional
change to vesa_endboot() is to insert a call to lbf_flush().

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   24615:ac9f32525376
xen-unstable date:        Sat Jan 28 13:42:25 2012 +0000
---


diff -r 0ea6664f8eee -r 1b7e074ee1d6 xen/drivers/video/vesa.c
--- a/xen/drivers/video/vesa.c	Tue Jan 31 11:49:15 2012 +0000
+++ b/xen/drivers/video/vesa.c	Tue Jan 31 11:49:30 2012 +0000
@@ -153,24 +153,6 @@
     xfree(line_len);
 }
 
-void __init vesa_endboot(bool_t keep)
-{
-    if ( keep )
-    {
-        xpos = 0;
-        vga_puts = vesa_scroll_puts;
-    }
-    else
-    {
-        unsigned int i, bpp = (vlfb_info.bits_per_pixel + 7) >> 3;
-        for ( i = 0; i < vlfb_info.height; i++ )
-            memset(lfb + i * vlfb_info.bytes_per_line, 0,
-                   vlfb_info.width * bpp);
-    }
-
-    xfree(line_len);
-}
-
 #if defined(CONFIG_X86)
 
 #include <asm/mtrr.h>
@@ -217,6 +199,25 @@
 
 #endif
 
+void __init vesa_endboot(bool_t keep)
+{
+    if ( keep )
+    {
+        xpos = 0;
+        vga_puts = vesa_scroll_puts;
+    }
+    else
+    {
+        unsigned int i, bpp = (vlfb_info.bits_per_pixel + 7) >> 3;
+        for ( i = 0; i < vlfb_info.height; i++ )
+            memset(lfb + i * vlfb_info.bytes_per_line, 0,
+                   vlfb_info.width * bpp);
+        lfb_flush();
+    }
+
+    xfree(line_len);
+}
+
 /* Render one line of text to given linear framebuffer line. */
 static void vesa_show_line(
     const unsigned char *text_line,

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 01 11:22:16 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Feb 2012 11:22:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RsYGR-0006Vm-Nd; Wed, 01 Feb 2012 11:22:11 +0000
Received: from mail6.bemta3.messagelabs.com ([195.245.230.39])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RsYGQ-0006VW-JF
	for xen-changelog@lists.xensource.com; Wed, 01 Feb 2012 11:22:10 +0000
Received: from [85.158.138.51:16744] by server-8.bemta-3.messagelabs.com id
	2C/21-31878-160292F4; Wed, 01 Feb 2012 11:22:09 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1328095328!11551930!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15198 invoked from network); 1 Feb 2012 11:22:09 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Feb 2012 11:22:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RsYGN-0005qe-Ox
	for xen-changelog@lists.xensource.com; Wed, 01 Feb 2012 11:22:07 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RsYGN-0007Xp-Ng
	for xen-changelog@lists.xensource.com; Wed, 01 Feb 2012 11:22:07 +0000
Message-Id: <E1RsYGN-0007Xp-Ng@xenbits.xen.org>
Date: Wed, 01 Feb 2012 11:22:07 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] vesa: flush lfb after zeroing
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328010570 0
# Node ID 1b7e074ee1d6e263f16cded236f3819b1b9ada6d
# Parent  0ea6664f8eee651ea60016a12e340d45036c00d3
vesa: flush lfb after zeroing

If Xen is going to relinquish the VGA console, flush the linear frame
buffer after zeroing it in vesa_endboot().

Failing to do so in some circumstances leads to the actual linear
framebuffer on the graphics card still containing the output of the
Xen boot console can lead to ugly graphics output when dom0 is setting
up the graphics card for its own use.

While the patch is quite large, it is mostly just code motion to
prevent having to forward declare lfb_flush().  The only functional
change to vesa_endboot() is to insert a call to lbf_flush().

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   24615:ac9f32525376
xen-unstable date:        Sat Jan 28 13:42:25 2012 +0000
---


diff -r 0ea6664f8eee -r 1b7e074ee1d6 xen/drivers/video/vesa.c
--- a/xen/drivers/video/vesa.c	Tue Jan 31 11:49:15 2012 +0000
+++ b/xen/drivers/video/vesa.c	Tue Jan 31 11:49:30 2012 +0000
@@ -153,24 +153,6 @@
     xfree(line_len);
 }
 
-void __init vesa_endboot(bool_t keep)
-{
-    if ( keep )
-    {
-        xpos = 0;
-        vga_puts = vesa_scroll_puts;
-    }
-    else
-    {
-        unsigned int i, bpp = (vlfb_info.bits_per_pixel + 7) >> 3;
-        for ( i = 0; i < vlfb_info.height; i++ )
-            memset(lfb + i * vlfb_info.bytes_per_line, 0,
-                   vlfb_info.width * bpp);
-    }
-
-    xfree(line_len);
-}
-
 #if defined(CONFIG_X86)
 
 #include <asm/mtrr.h>
@@ -217,6 +199,25 @@
 
 #endif
 
+void __init vesa_endboot(bool_t keep)
+{
+    if ( keep )
+    {
+        xpos = 0;
+        vga_puts = vesa_scroll_puts;
+    }
+    else
+    {
+        unsigned int i, bpp = (vlfb_info.bits_per_pixel + 7) >> 3;
+        for ( i = 0; i < vlfb_info.height; i++ )
+            memset(lfb + i * vlfb_info.bytes_per_line, 0,
+                   vlfb_info.width * bpp);
+        lfb_flush();
+    }
+
+    xfree(line_len);
+}
+
 /* Render one line of text to given linear framebuffer line. */
 static void vesa_show_line(
     const unsigned char *text_line,

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 01 11:22:17 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Feb 2012 11:22:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RsYGR-0006Vg-L1; Wed, 01 Feb 2012 11:22:11 +0000
Received: from mail6.bemta3.messagelabs.com ([195.245.230.39])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RsYGQ-0006VU-J8
	for xen-changelog@lists.xensource.com; Wed, 01 Feb 2012 11:22:10 +0000
Received: from [85.158.138.51:45313] by server-3.bemta-3.messagelabs.com id
	A2/5C-26314-160292F4; Wed, 01 Feb 2012 11:22:09 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1328095327!9688750!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16053 invoked from network); 1 Feb 2012 11:22:08 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Feb 2012 11:22:08 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RsYGN-0005qb-GZ
	for xen-changelog@lists.xensource.com; Wed, 01 Feb 2012 11:22:07 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RsYGN-0007XO-70
	for xen-changelog@lists.xensource.com; Wed, 01 Feb 2012 11:22:07 +0000
Message-Id: <E1RsYGN-0007XO-70@xenbits.xen.org>
Date: Wed, 01 Feb 2012 11:22:06 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] Console: introduce console=none
	command line parameter
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328010555 0
# Node ID 0ea6664f8eee651ea60016a12e340d45036c00d3
# Parent  271e30252c16d7e07f8e82301c4a776e35712a6c
Console: introduce console=none command line parameter

Currenty, not specifying 'console=<foo>' on the command line causes
Xen to default to 'vga'.  Alternativly, the user can explicitly
specifiy 'console=vga|com1|com2'.

However, there is no way to specify that neither vga nor serial should
be used.  Specifying 'console=' does have the effect that neither vga
nor serial is set up, but at the cost of an "Bad console= option ''"
warning.

Therefore, expliticly support a 'console=none' option which does not
set up vga and does not set up serial, but does not trigger the bad
console warning.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   24614:f8c2cf24a26c
xen-unstable date:        Sat Jan 28 13:41:42 2012 +0000
---


diff -r 271e30252c16 -r 0ea6664f8eee xen/drivers/char/console.c
--- a/xen/drivers/char/console.c	Tue Jan 17 11:35:30 2012 +0000
+++ b/xen/drivers/char/console.c	Tue Jan 31 11:49:15 2012 +0000
@@ -557,6 +557,8 @@
             p++;
         if ( !strncmp(p, "vga", 3) )
             vga_init();
+        else if ( !strncmp(p, "none", 4) )
+            continue;
         else if ( strncmp(p, "com", 3) ||
                   (sercon_handle = serial_parse_handle(p)) == -1 )
         {

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 01 11:22:17 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Feb 2012 11:22:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RsYGR-0006Vg-L1; Wed, 01 Feb 2012 11:22:11 +0000
Received: from mail6.bemta3.messagelabs.com ([195.245.230.39])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RsYGQ-0006VU-J8
	for xen-changelog@lists.xensource.com; Wed, 01 Feb 2012 11:22:10 +0000
Received: from [85.158.138.51:45313] by server-3.bemta-3.messagelabs.com id
	A2/5C-26314-160292F4; Wed, 01 Feb 2012 11:22:09 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1328095327!9688750!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16053 invoked from network); 1 Feb 2012 11:22:08 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Feb 2012 11:22:08 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RsYGN-0005qb-GZ
	for xen-changelog@lists.xensource.com; Wed, 01 Feb 2012 11:22:07 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RsYGN-0007XO-70
	for xen-changelog@lists.xensource.com; Wed, 01 Feb 2012 11:22:07 +0000
Message-Id: <E1RsYGN-0007XO-70@xenbits.xen.org>
Date: Wed, 01 Feb 2012 11:22:06 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] Console: introduce console=none
	command line parameter
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328010555 0
# Node ID 0ea6664f8eee651ea60016a12e340d45036c00d3
# Parent  271e30252c16d7e07f8e82301c4a776e35712a6c
Console: introduce console=none command line parameter

Currenty, not specifying 'console=<foo>' on the command line causes
Xen to default to 'vga'.  Alternativly, the user can explicitly
specifiy 'console=vga|com1|com2'.

However, there is no way to specify that neither vga nor serial should
be used.  Specifying 'console=' does have the effect that neither vga
nor serial is set up, but at the cost of an "Bad console= option ''"
warning.

Therefore, expliticly support a 'console=none' option which does not
set up vga and does not set up serial, but does not trigger the bad
console warning.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   24614:f8c2cf24a26c
xen-unstable date:        Sat Jan 28 13:41:42 2012 +0000
---


diff -r 271e30252c16 -r 0ea6664f8eee xen/drivers/char/console.c
--- a/xen/drivers/char/console.c	Tue Jan 17 11:35:30 2012 +0000
+++ b/xen/drivers/char/console.c	Tue Jan 31 11:49:15 2012 +0000
@@ -557,6 +557,8 @@
             p++;
         if ( !strncmp(p, "vga", 3) )
             vga_init();
+        else if ( !strncmp(p, "none", 4) )
+            continue;
         else if ( strncmp(p, "com", 3) ||
                   (sercon_handle = serial_parse_handle(p)) == -1 )
         {

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 01 13:11:14 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Feb 2012 13:11:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RsZxs-0001FV-ML; Wed, 01 Feb 2012 13:11:08 +0000
Received: from mail6.bemta3.messagelabs.com ([195.245.230.39])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RsZxr-0001FQ-8F
	for xen-changelog@lists.xensource.com; Wed, 01 Feb 2012 13:11:07 +0000
Received: from [85.158.138.51:24977] by server-3.bemta-3.messagelabs.com id
	01/33-26314-AE9392F4; Wed, 01 Feb 2012 13:11:06 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1328101864!11495025!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1166 invoked from network); 1 Feb 2012 13:11:05 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Feb 2012 13:11:05 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RsZxo-00075I-Ev
	for xen-changelog@lists.xensource.com; Wed, 01 Feb 2012 13:11:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RsZxn-0001zW-Uk
	for xen-changelog@lists.xensource.com; Wed, 01 Feb 2012 13:11:03 +0000
Message-Id: <E1RsZxn-0001zW-Uk@xenbits.xen.org>
Date: Wed, 01 Feb 2012 13:11:03 +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] netfront: correct MAX_TX_TARGET
	calculation
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Wei Liu <wei.liu2@citrix.com>
# Date 1328101144 -3600
# Node ID ddb83aec5afc6f7980aaae2497a5b171c1549eff
# Parent  5aa9c1c436f6e4a478edca4d28677f4f8db03b71
netfront: correct MAX_TX_TARGET calculation

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 5aa9c1c436f6 -r ddb83aec5afc drivers/xen/netfront/netfront.h
--- a/drivers/xen/netfront/netfront.h	Wed Jan 25 12:33:11 2012 +0100
+++ b/drivers/xen/netfront/netfront.h	Wed Feb 01 13:59:04 2012 +0100
@@ -177,7 +177,7 @@
 	struct sk_buff *tx_skbs[NET_TX_RING_SIZE+1];
 	struct sk_buff *rx_skbs[NET_RX_RING_SIZE];
 
-#define TX_MAX_TARGET min_t(int, NET_RX_RING_SIZE, 256)
+#define TX_MAX_TARGET min_t(int, NET_TX_RING_SIZE, 256)
 	grant_ref_t gref_tx_head;
 	grant_ref_t grant_tx_ref[NET_TX_RING_SIZE + 1];
 	grant_ref_t gref_rx_head;

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 01 13:11:14 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Feb 2012 13:11:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RsZxs-0001FV-ML; Wed, 01 Feb 2012 13:11:08 +0000
Received: from mail6.bemta3.messagelabs.com ([195.245.230.39])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RsZxr-0001FQ-8F
	for xen-changelog@lists.xensource.com; Wed, 01 Feb 2012 13:11:07 +0000
Received: from [85.158.138.51:24977] by server-3.bemta-3.messagelabs.com id
	01/33-26314-AE9392F4; Wed, 01 Feb 2012 13:11:06 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1328101864!11495025!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1166 invoked from network); 1 Feb 2012 13:11:05 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Feb 2012 13:11:05 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RsZxo-00075I-Ev
	for xen-changelog@lists.xensource.com; Wed, 01 Feb 2012 13:11:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RsZxn-0001zW-Uk
	for xen-changelog@lists.xensource.com; Wed, 01 Feb 2012 13:11:03 +0000
Message-Id: <E1RsZxn-0001zW-Uk@xenbits.xen.org>
Date: Wed, 01 Feb 2012 13:11:03 +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] netfront: correct MAX_TX_TARGET
	calculation
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Wei Liu <wei.liu2@citrix.com>
# Date 1328101144 -3600
# Node ID ddb83aec5afc6f7980aaae2497a5b171c1549eff
# Parent  5aa9c1c436f6e4a478edca4d28677f4f8db03b71
netfront: correct MAX_TX_TARGET calculation

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 5aa9c1c436f6 -r ddb83aec5afc drivers/xen/netfront/netfront.h
--- a/drivers/xen/netfront/netfront.h	Wed Jan 25 12:33:11 2012 +0100
+++ b/drivers/xen/netfront/netfront.h	Wed Feb 01 13:59:04 2012 +0100
@@ -177,7 +177,7 @@
 	struct sk_buff *tx_skbs[NET_TX_RING_SIZE+1];
 	struct sk_buff *rx_skbs[NET_RX_RING_SIZE];
 
-#define TX_MAX_TARGET min_t(int, NET_RX_RING_SIZE, 256)
+#define TX_MAX_TARGET min_t(int, NET_TX_RING_SIZE, 256)
 	grant_ref_t gref_tx_head;
 	grant_ref_t grant_tx_ref[NET_TX_RING_SIZE + 1];
 	grant_ref_t gref_rx_head;

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 02 13:55:26 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 02 Feb 2012 13:55:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rsx8D-00014K-Sn; Thu, 02 Feb 2012 13:55:21 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Rsx8C-00014F-9n
	for xen-changelog@lists.xensource.com; Thu, 02 Feb 2012 13:55:20 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-14.tower-21.messagelabs.com!1328190912!13281777!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10352 invoked from network); 2 Feb 2012 13:55:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Feb 2012 13:55:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Rsx84-0002ic-6L
	for xen-changelog@lists.xensource.com; Thu, 02 Feb 2012 13:55:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Rsx83-0007r0-MP
	for xen-changelog@lists.xensource.com; Thu, 02 Feb 2012 13:55:11 +0000
Date: Thu, 02 Feb 2012 13:55:11 +0000
Message-Id: <E1Rsx83-0007r0-MP@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-4.1-testing] e1000: bounds packet size
	against buffer size
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 3cf61880403b4e484539596a95937cc066243388
Author: Ian Campbell <Ian.Campbell@citrix.com>
Date:   Thu Feb 2 13:47:06 2012 +0000

    e1000: bounds packet size against buffer size
    
    Otherwise we can write beyond the buffer and corrupt memory.  This is tracked
    as CVE-2012-0029.
    
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    (Backported from qemu upstream 65f82df0d7a71ce1b10cd4c5ab08888d176ac840
     by Ian Campbell.)
    
    Signed-off-by: Ian Campbell <Ian.Campbell@citrix.com>
    (cherry picked from commit ebe37b2a3f844bad02dcc30d081f39eda06118f8)
---
 hw/e1000.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/e1000.c b/hw/e1000.c
index bb3689e..97104ed 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -444,6 +444,8 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
             bytes = split_size;
             if (tp->size + bytes > msh)
                 bytes = msh - tp->size;
+
+            bytes = MIN(sizeof(tp->data) - tp->size, bytes);
             cpu_physical_memory_read(addr, tp->data + tp->size, bytes);
             if ((sz = tp->size + bytes) >= hdr && tp->size < hdr)
                 memmove(tp->header, tp->data, hdr);
@@ -459,6 +461,7 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
         // context descriptor TSE is not set, while data descriptor TSE is set
         DBGOUT(TXERR, "TCP segmentaion Error\n");
     } else {
+        split_size = MIN(sizeof(tp->data) - tp->size, split_size);
         cpu_physical_memory_read(addr, tp->data + tp->size, split_size);
         tp->size += split_size;
     }
--
generated by git-patchbot for /home/xen/git/qemu-xen-4.1-testing.git

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 02 13:55:26 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 02 Feb 2012 13:55:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rsx8D-00014K-Sn; Thu, 02 Feb 2012 13:55:21 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Rsx8C-00014F-9n
	for xen-changelog@lists.xensource.com; Thu, 02 Feb 2012 13:55:20 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-14.tower-21.messagelabs.com!1328190912!13281777!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10352 invoked from network); 2 Feb 2012 13:55:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Feb 2012 13:55:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Rsx84-0002ic-6L
	for xen-changelog@lists.xensource.com; Thu, 02 Feb 2012 13:55:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Rsx83-0007r0-MP
	for xen-changelog@lists.xensource.com; Thu, 02 Feb 2012 13:55:11 +0000
Date: Thu, 02 Feb 2012 13:55:11 +0000
Message-Id: <E1Rsx83-0007r0-MP@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-4.1-testing] e1000: bounds packet size
	against buffer size
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 3cf61880403b4e484539596a95937cc066243388
Author: Ian Campbell <Ian.Campbell@citrix.com>
Date:   Thu Feb 2 13:47:06 2012 +0000

    e1000: bounds packet size against buffer size
    
    Otherwise we can write beyond the buffer and corrupt memory.  This is tracked
    as CVE-2012-0029.
    
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    (Backported from qemu upstream 65f82df0d7a71ce1b10cd4c5ab08888d176ac840
     by Ian Campbell.)
    
    Signed-off-by: Ian Campbell <Ian.Campbell@citrix.com>
    (cherry picked from commit ebe37b2a3f844bad02dcc30d081f39eda06118f8)
---
 hw/e1000.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/e1000.c b/hw/e1000.c
index bb3689e..97104ed 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -444,6 +444,8 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
             bytes = split_size;
             if (tp->size + bytes > msh)
                 bytes = msh - tp->size;
+
+            bytes = MIN(sizeof(tp->data) - tp->size, bytes);
             cpu_physical_memory_read(addr, tp->data + tp->size, bytes);
             if ((sz = tp->size + bytes) >= hdr && tp->size < hdr)
                 memmove(tp->header, tp->data, hdr);
@@ -459,6 +461,7 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
         // context descriptor TSE is not set, while data descriptor TSE is set
         DBGOUT(TXERR, "TCP segmentaion Error\n");
     } else {
+        split_size = MIN(sizeof(tp->data) - tp->size, split_size);
         cpu_physical_memory_read(addr, tp->data + tp->size, split_size);
         tp->size += split_size;
     }
--
generated by git-patchbot for /home/xen/git/qemu-xen-4.1-testing.git

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 02 14:00:21 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 02 Feb 2012 14:00:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RsxD0-0001B5-Cb; Thu, 02 Feb 2012 14:00:18 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RsxCy-0001Ax-N8
	for xen-changelog@lists.xensource.com; Thu, 02 Feb 2012 14:00:16 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-7.tower-216.messagelabs.com!1328191209!9814504!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19783 invoked from network); 2 Feb 2012 14:00:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Feb 2012 14:00:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RsxCq-0002rg-MG
	for xen-changelog@lists.xensource.com; Thu, 02 Feb 2012 14:00:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RsxCo-0001BW-Fr
	for xen-changelog@lists.xensource.com; Thu, 02 Feb 2012 14:00:08 +0000
Date: Thu, 02 Feb 2012 14:00:06 +0000
Message-Id: <E1RsxCo-0001BW-Fr@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-4.0-testing] e1000: bounds packet size
	against buffer size
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 36984c285a765541b04f378bfa84d2c850c167d3
Author: Ian Campbell <Ian.Campbell@citrix.com>
Date:   Thu Feb 2 13:47:06 2012 +0000

    e1000: bounds packet size against buffer size
    
    Otherwise we can write beyond the buffer and corrupt memory.  This is tracked
    as CVE-2012-0029.
    
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    (Backported from qemu upstream 65f82df0d7a71ce1b10cd4c5ab08888d176ac840
     by Ian Campbell.)
    
    Signed-off-by: Ian Campbell <Ian.Campbell@citrix.com>
    (cherry picked from commit ebe37b2a3f844bad02dcc30d081f39eda06118f8)
---
 hw/e1000.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/e1000.c b/hw/e1000.c
index 1644201..e77c81e 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -432,6 +432,8 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
             bytes = split_size;
             if (tp->size + bytes > msh)
                 bytes = msh - tp->size;
+
+            bytes = MIN(sizeof(tp->data) - tp->size, bytes);
             cpu_physical_memory_read(addr, tp->data + tp->size, bytes);
             if ((sz = tp->size + bytes) >= hdr && tp->size < hdr)
                 memmove(tp->header, tp->data, hdr);
@@ -447,6 +449,7 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
         // context descriptor TSE is not set, while data descriptor TSE is set
         DBGOUT(TXERR, "TCP segmentaion Error\n");
     } else {
+        split_size = MIN(sizeof(tp->data) - tp->size, split_size);
         cpu_physical_memory_read(addr, tp->data + tp->size, split_size);
         tp->size += split_size;
     }
--
generated by git-patchbot for /home/xen/git/qemu-xen-4.0-testing.git

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 02 14:00:21 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 02 Feb 2012 14:00:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RsxD0-0001B5-Cb; Thu, 02 Feb 2012 14:00:18 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RsxCy-0001Ax-N8
	for xen-changelog@lists.xensource.com; Thu, 02 Feb 2012 14:00:16 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-7.tower-216.messagelabs.com!1328191209!9814504!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19783 invoked from network); 2 Feb 2012 14:00:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Feb 2012 14:00:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RsxCq-0002rg-MG
	for xen-changelog@lists.xensource.com; Thu, 02 Feb 2012 14:00:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RsxCo-0001BW-Fr
	for xen-changelog@lists.xensource.com; Thu, 02 Feb 2012 14:00:08 +0000
Date: Thu, 02 Feb 2012 14:00:06 +0000
Message-Id: <E1RsxCo-0001BW-Fr@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-4.0-testing] e1000: bounds packet size
	against buffer size
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 36984c285a765541b04f378bfa84d2c850c167d3
Author: Ian Campbell <Ian.Campbell@citrix.com>
Date:   Thu Feb 2 13:47:06 2012 +0000

    e1000: bounds packet size against buffer size
    
    Otherwise we can write beyond the buffer and corrupt memory.  This is tracked
    as CVE-2012-0029.
    
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    (Backported from qemu upstream 65f82df0d7a71ce1b10cd4c5ab08888d176ac840
     by Ian Campbell.)
    
    Signed-off-by: Ian Campbell <Ian.Campbell@citrix.com>
    (cherry picked from commit ebe37b2a3f844bad02dcc30d081f39eda06118f8)
---
 hw/e1000.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/e1000.c b/hw/e1000.c
index 1644201..e77c81e 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -432,6 +432,8 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
             bytes = split_size;
             if (tp->size + bytes > msh)
                 bytes = msh - tp->size;
+
+            bytes = MIN(sizeof(tp->data) - tp->size, bytes);
             cpu_physical_memory_read(addr, tp->data + tp->size, bytes);
             if ((sz = tp->size + bytes) >= hdr && tp->size < hdr)
                 memmove(tp->header, tp->data, hdr);
@@ -447,6 +449,7 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
         // context descriptor TSE is not set, while data descriptor TSE is set
         DBGOUT(TXERR, "TCP segmentaion Error\n");
     } else {
+        split_size = MIN(sizeof(tp->data) - tp->size, split_size);
         cpu_physical_memory_read(addr, tp->data + tp->size, split_size);
         tp->size += split_size;
     }
--
generated by git-patchbot for /home/xen/git/qemu-xen-4.0-testing.git

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 02 14:11:15 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 02 Feb 2012 14:11:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RsxNY-0001iX-Cp; Thu, 02 Feb 2012 14:11:12 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RsxNX-0001iP-0b
	for xen-changelog@lists.xensource.com; Thu, 02 Feb 2012 14:11:11 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-16.tower-182.messagelabs.com!1328191863!6114563!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6903 invoked from network); 2 Feb 2012 14:11:04 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Feb 2012 14:11:04 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RsxNP-0002zY-Hy
	for xen-changelog@lists.xensource.com; Thu, 02 Feb 2012 14:11:03 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RsxNP-0004mw-4W
	for xen-changelog@lists.xensource.com; Thu, 02 Feb 2012 14:11:03 +0000
Date: Thu, 02 Feb 2012 14:11:03 +0000
Message-Id: <E1RsxNP-0004mw-4W@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-unstable] e1000: bounds packet size
	against buffer size
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit ebe37b2a3f844bad02dcc30d081f39eda06118f8
Author: Ian Campbell <Ian.Campbell@citrix.com>
Date:   Thu Feb 2 13:47:06 2012 +0000

    e1000: bounds packet size against buffer size
    
    Otherwise we can write beyond the buffer and corrupt memory.  This is tracked
    as CVE-2012-0029.
    
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    (Backported from qemu upstream 65f82df0d7a71ce1b10cd4c5ab08888d176ac840
     by Ian Campbell.)
    
    Signed-off-by: Ian Campbell <Ian.Campbell@citrix.com>
---
 hw/e1000.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/e1000.c b/hw/e1000.c
index bb3689e..97104ed 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -444,6 +444,8 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
             bytes = split_size;
             if (tp->size + bytes > msh)
                 bytes = msh - tp->size;
+
+            bytes = MIN(sizeof(tp->data) - tp->size, bytes);
             cpu_physical_memory_read(addr, tp->data + tp->size, bytes);
             if ((sz = tp->size + bytes) >= hdr && tp->size < hdr)
                 memmove(tp->header, tp->data, hdr);
@@ -459,6 +461,7 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
         // context descriptor TSE is not set, while data descriptor TSE is set
         DBGOUT(TXERR, "TCP segmentaion Error\n");
     } else {
+        split_size = MIN(sizeof(tp->data) - tp->size, split_size);
         cpu_physical_memory_read(addr, tp->data + tp->size, split_size);
         tp->size += split_size;
     }
--
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 Thu Feb 02 14:11:15 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 02 Feb 2012 14:11:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RsxNY-0001iX-Cp; Thu, 02 Feb 2012 14:11:12 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RsxNX-0001iP-0b
	for xen-changelog@lists.xensource.com; Thu, 02 Feb 2012 14:11:11 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-16.tower-182.messagelabs.com!1328191863!6114563!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6903 invoked from network); 2 Feb 2012 14:11:04 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Feb 2012 14:11:04 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RsxNP-0002zY-Hy
	for xen-changelog@lists.xensource.com; Thu, 02 Feb 2012 14:11:03 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RsxNP-0004mw-4W
	for xen-changelog@lists.xensource.com; Thu, 02 Feb 2012 14:11:03 +0000
Date: Thu, 02 Feb 2012 14:11:03 +0000
Message-Id: <E1RsxNP-0004mw-4W@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-unstable] e1000: bounds packet size
	against buffer size
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit ebe37b2a3f844bad02dcc30d081f39eda06118f8
Author: Ian Campbell <Ian.Campbell@citrix.com>
Date:   Thu Feb 2 13:47:06 2012 +0000

    e1000: bounds packet size against buffer size
    
    Otherwise we can write beyond the buffer and corrupt memory.  This is tracked
    as CVE-2012-0029.
    
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    
    (Backported from qemu upstream 65f82df0d7a71ce1b10cd4c5ab08888d176ac840
     by Ian Campbell.)
    
    Signed-off-by: Ian Campbell <Ian.Campbell@citrix.com>
---
 hw/e1000.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/e1000.c b/hw/e1000.c
index bb3689e..97104ed 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -444,6 +444,8 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
             bytes = split_size;
             if (tp->size + bytes > msh)
                 bytes = msh - tp->size;
+
+            bytes = MIN(sizeof(tp->data) - tp->size, bytes);
             cpu_physical_memory_read(addr, tp->data + tp->size, bytes);
             if ((sz = tp->size + bytes) >= hdr && tp->size < hdr)
                 memmove(tp->header, tp->data, hdr);
@@ -459,6 +461,7 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
         // context descriptor TSE is not set, while data descriptor TSE is set
         DBGOUT(TXERR, "TCP segmentaion Error\n");
     } else {
+        split_size = MIN(sizeof(tp->data) - tp->size, split_size);
         cpu_physical_memory_read(addr, tp->data + tp->size, split_size);
         tp->size += split_size;
     }
--
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 Fri Feb 03 05:22:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 05:22:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtBbG-0006Ye-HY; Fri, 03 Feb 2012 05:22:18 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtBbE-0006YP-TZ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 05:22:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1328246529!13766794!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7521 invoked from network); 3 Feb 2012 05:22:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 05:22:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtBb7-0006Pg-4F
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 05:22:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtBb6-0003JA-0U
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 05:22:08 +0000
Message-Id: <E1RtBb6-0003JA-0U@xenbits.xen.org>
Date: Fri, 03 Feb 2012 05:22:07 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] Update QEMU_TAG, for CVE-2012-0029
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328190973 0
# Node ID cccd6c68e1b9527f556deef760713380801db9b5
# Parent  00c4b19f264811d14c83b4d0fa7eac80fd55d26e
Update QEMU_TAG, for CVE-2012-0029
---


diff -r 00c4b19f2648 -r cccd6c68e1b9 Config.mk
--- a/Config.mk	Tue Jan 31 11:47:29 2012 +0000
+++ b/Config.mk	Thu Feb 02 13:56:13 2012 +0000
@@ -179,9 +179,9 @@
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= 3981d218912e186cb4205ee6732f446c177a36a2
-# Tue Nov 22 18:49:15 2011 +0000
-# qemu-xen: Don't redefine libpci (3.1.7) defines.
+QEMU_TAG ?= 3cf61880403b4e484539596a95937cc066243388
+# Thu Feb 2 13:47:06 2012 +0000
+# e1000: bounds packet size against buffer size
 
 # Optional components
 XENSTAT_XENTOP     ?= y

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 05:22:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 05:22:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtBbG-0006Ye-HY; Fri, 03 Feb 2012 05:22:18 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtBbE-0006YP-TZ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 05:22:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1328246529!13766794!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7521 invoked from network); 3 Feb 2012 05:22:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 05:22:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtBb7-0006Pg-4F
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 05:22:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtBb6-0003JA-0U
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 05:22:08 +0000
Message-Id: <E1RtBb6-0003JA-0U@xenbits.xen.org>
Date: Fri, 03 Feb 2012 05:22:07 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] Update QEMU_TAG, for CVE-2012-0029
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328190973 0
# Node ID cccd6c68e1b9527f556deef760713380801db9b5
# Parent  00c4b19f264811d14c83b4d0fa7eac80fd55d26e
Update QEMU_TAG, for CVE-2012-0029
---


diff -r 00c4b19f2648 -r cccd6c68e1b9 Config.mk
--- a/Config.mk	Tue Jan 31 11:47:29 2012 +0000
+++ b/Config.mk	Thu Feb 02 13:56:13 2012 +0000
@@ -179,9 +179,9 @@
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= 3981d218912e186cb4205ee6732f446c177a36a2
-# Tue Nov 22 18:49:15 2011 +0000
-# qemu-xen: Don't redefine libpci (3.1.7) defines.
+QEMU_TAG ?= 3cf61880403b4e484539596a95937cc066243388
+# Thu Feb 2 13:47:06 2012 +0000
+# e1000: bounds packet size against buffer size
 
 # Optional components
 XENSTAT_XENTOP     ?= y

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 11:44:18 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 11:44:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtHYq-00067R-MZ; Fri, 03 Feb 2012 11:44:12 +0000
Received: from mail6.bemta14.messagelabs.com ([193.109.254.103])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtHYp-00067J-Iw
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 11:44:11 +0000
Received: from [193.109.254.147:30547] by server-8.bemta-14.messagelabs.com id
	AC/62-04706-A88CB2F4; Fri, 03 Feb 2012 11:44:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1328269387!59618616!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16125 invoked from network); 3 Feb 2012 11:43:08 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 11:43:08 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtHYm-0002cP-Pl
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 11:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtHYm-0001sS-IB
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 11:44:08 +0000
Message-Id: <E1RtHYm-0001sS-IB@xenbits.xen.org>
Date: Fri, 03 Feb 2012 11:44:08 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] Update QEMU_TAG, for CVE-2012-0029
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328191232 0
# Node ID 3feb83eed6bdd515b90aca528c1ebd83dfb7a378
# Parent  1b7e074ee1d6e263f16cded236f3819b1b9ada6d
Update QEMU_TAG, for CVE-2012-0029
---


diff -r 1b7e074ee1d6 -r 3feb83eed6bd Config.mk
--- a/Config.mk	Tue Jan 31 11:49:30 2012 +0000
+++ b/Config.mk	Thu Feb 02 14:00:32 2012 +0000
@@ -178,10 +178,9 @@
 # CONFIG_QEMU ?= ../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG := xen-4.0.3
-#QEMU_TAG ?= 6d5b7ee3acfe8cc10681d2583a38398f7470ec2a
-# Wed Jan 5 23:42:03 2011 +0000
-# Change tap device mac address to prevent change of bridge's mac
+QEMU_TAG := 36984c285a765541b04f378bfa84d2c850c167d3
+# Thu Feb 2 13:47:06 2012 +0000
+# e1000: bounds packet size against buffer size
 
 OCAML_XENSTORED_REPO=http://xenbits.xensource.com/ext/xen-ocaml-tools.hg
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 11:44:18 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 11:44:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtHYq-00067R-MZ; Fri, 03 Feb 2012 11:44:12 +0000
Received: from mail6.bemta14.messagelabs.com ([193.109.254.103])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtHYp-00067J-Iw
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 11:44:11 +0000
Received: from [193.109.254.147:30547] by server-8.bemta-14.messagelabs.com id
	AC/62-04706-A88CB2F4; Fri, 03 Feb 2012 11:44:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1328269387!59618616!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16125 invoked from network); 3 Feb 2012 11:43:08 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 11:43:08 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtHYm-0002cP-Pl
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 11:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtHYm-0001sS-IB
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 11:44:08 +0000
Message-Id: <E1RtHYm-0001sS-IB@xenbits.xen.org>
Date: Fri, 03 Feb 2012 11:44:08 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] Update QEMU_TAG, for CVE-2012-0029
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328191232 0
# Node ID 3feb83eed6bdd515b90aca528c1ebd83dfb7a378
# Parent  1b7e074ee1d6e263f16cded236f3819b1b9ada6d
Update QEMU_TAG, for CVE-2012-0029
---


diff -r 1b7e074ee1d6 -r 3feb83eed6bd Config.mk
--- a/Config.mk	Tue Jan 31 11:49:30 2012 +0000
+++ b/Config.mk	Thu Feb 02 14:00:32 2012 +0000
@@ -178,10 +178,9 @@
 # CONFIG_QEMU ?= ../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG := xen-4.0.3
-#QEMU_TAG ?= 6d5b7ee3acfe8cc10681d2583a38398f7470ec2a
-# Wed Jan 5 23:42:03 2011 +0000
-# Change tap device mac address to prevent change of bridge's mac
+QEMU_TAG := 36984c285a765541b04f378bfa84d2c850c167d3
+# Thu Feb 2 13:47:06 2012 +0000
+# e1000: bounds packet size against buffer size
 
 OCAML_XENSTORED_REPO=http://xenbits.xensource.com/ext/xen-ocaml-tools.hg
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:55:39 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:55:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6T-0006Du-Rv; Fri, 03 Feb 2012 21:55:33 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6S-0006Dp-06
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:32 +0000
Received: from [85.158.143.35:33296] by server-2.bemta-4.messagelabs.com id
	92/2C-28657-3D75C2F4; Fri, 03 Feb 2012 21:55:31 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1328306129!1917543!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17897 invoked from network); 3 Feb 2012 21:55:30 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:30 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6P-0001hf-Cs
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:29 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6M-0002B8-AZ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:28 +0000
Message-Id: <E1RtR6M-0002B8-AZ@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:24 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: fix a couple of memory leaks
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327683679 0
# Node ID f204ead7d9e4904beb7a848860b23780b480ed6c
# Parent  097f5d9c32f975464462a11644177ce8b6b6e9e7
xl: fix a couple of memory leaks

* dolog leaked the log message (!)

* main() leaked the config_data (perhaps a false positive from valgrind,
  but it's nicer to tidy it up).

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


diff -r 097f5d9c32f9 -r f204ead7d9e4 tools/libxl/xl.c
--- a/tools/libxl/xl.c	Fri Jan 27 17:01:18 2012 +0000
+++ b/tools/libxl/xl.c	Fri Jan 27 17:01:19 2012 +0000
@@ -135,6 +135,7 @@
                 config_file, strerror(errno));
     parse_global_config(config_file, config_data, config_len);
     free(config_file);
+    free(config_data);
 
     /* Reset options for per-command use of getopt. */
     argv += optind;
diff -r 097f5d9c32f9 -r f204ead7d9e4 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Fri Jan 27 17:01:18 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Fri Jan 27 17:01:19 2012 +0000
@@ -278,7 +278,7 @@
 static void dolog(const char *file, int line, const char *func, char *fmt, ...)
 {
     va_list ap;
-    char *s;
+    char *s = NULL;
     int rc;
 
     va_start(ap, fmt);
@@ -286,6 +286,7 @@
     va_end(ap);
     if (rc >= 0)
         libxl_write_exactly(NULL, logfile, s, rc, NULL, NULL);
+    free(s);
 }
 
 static void printf_info(int domid,

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:55:39 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:55:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6T-0006Du-Rv; Fri, 03 Feb 2012 21:55:33 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6S-0006Dp-06
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:32 +0000
Received: from [85.158.143.35:33296] by server-2.bemta-4.messagelabs.com id
	92/2C-28657-3D75C2F4; Fri, 03 Feb 2012 21:55:31 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1328306129!1917543!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17897 invoked from network); 3 Feb 2012 21:55:30 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:30 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6P-0001hf-Cs
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:29 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6M-0002B8-AZ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:28 +0000
Message-Id: <E1RtR6M-0002B8-AZ@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:24 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: fix a couple of memory leaks
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327683679 0
# Node ID f204ead7d9e4904beb7a848860b23780b480ed6c
# Parent  097f5d9c32f975464462a11644177ce8b6b6e9e7
xl: fix a couple of memory leaks

* dolog leaked the log message (!)

* main() leaked the config_data (perhaps a false positive from valgrind,
  but it's nicer to tidy it up).

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


diff -r 097f5d9c32f9 -r f204ead7d9e4 tools/libxl/xl.c
--- a/tools/libxl/xl.c	Fri Jan 27 17:01:18 2012 +0000
+++ b/tools/libxl/xl.c	Fri Jan 27 17:01:19 2012 +0000
@@ -135,6 +135,7 @@
                 config_file, strerror(errno));
     parse_global_config(config_file, config_data, config_len);
     free(config_file);
+    free(config_data);
 
     /* Reset options for per-command use of getopt. */
     argv += optind;
diff -r 097f5d9c32f9 -r f204ead7d9e4 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Fri Jan 27 17:01:18 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Fri Jan 27 17:01:19 2012 +0000
@@ -278,7 +278,7 @@
 static void dolog(const char *file, int line, const char *func, char *fmt, ...)
 {
     va_list ap;
-    char *s;
+    char *s = NULL;
     int rc;
 
     va_start(ap, fmt);
@@ -286,6 +286,7 @@
     va_end(ap);
     if (rc >= 0)
         libxl_write_exactly(NULL, logfile, s, rc, NULL, NULL);
+    free(s);
 }
 
 static void printf_info(int domid,

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:55:40 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:55:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6V-0006E6-Ug; Fri, 03 Feb 2012 21:55:35 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6U-0006Do-11
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:34 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-216.messagelabs.com!1328306126!13419241!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22547 invoked from network); 3 Feb 2012 21:55:27 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:27 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6M-0001hZ-C0
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:26 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6E-000299-IW
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:20 +0000
Message-Id: <E1RtR6E-000299-IW@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] .gitignore/.hgignore: New names for
	ioemu dirs, seabios
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327683678 0
# Node ID 097f5d9c32f975464462a11644177ce8b6b6e9e7
# Parent  e2722b24dc0962de37215320b05d1bb7c4c42864
.gitignore/.hgignore: New names for ioemu dirs, seabios

* Add new seabios clone directories to .gitignore.
* Add new qemu clone directories to .gitignore.
* Remove old tools/ioemu (long-obsolete) from .gitignore and .hgignore.

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


diff -r e2722b24dc09 -r 097f5d9c32f9 .gitignore
--- a/.gitignore	Thu Jan 26 17:43:31 2012 +0000
+++ b/.gitignore	Fri Jan 27 17:01:18 2012 +0000
@@ -15,8 +15,6 @@
 .config
 
 dist
-tools/ioemu-dir
-tools/ioemu-remote
 stubdom/*.tar.gz
 
 build-*
@@ -162,20 +160,6 @@
 tools/include/xen/*
 tools/include/xen-foreign/*.(c|h|size)
 tools/include/xen-foreign/checker
-tools/ioemu/.pc/*
-tools/ioemu/config-host.h
-tools/ioemu/config-host.mak
-tools/ioemu/i386-dm/Makefile
-tools/ioemu/i386-dm/config.h
-tools/ioemu/i386-dm/config.mak
-tools/ioemu/i386-dm/qemu-dm
-tools/ioemu/qemu-doc.html
-tools/ioemu/qemu-img.1
-tools/ioemu/qemu-img.pod
-tools/ioemu/qemu-tech.html
-tools/ioemu/qemu.1
-tools/ioemu/qemu.pod
-tools/ioemu/tapdisk-ioemu
 tools/libxc/ia64/asm/*.h
 tools/libxc/ia64/acpi/*.h
 tools/libxc/ia64/acpi/platform/*.h
@@ -285,8 +269,6 @@
 tools/xm-test/lib/XmTestLib/config.py
 tools/xm-test/lib/XmTestReport/xmtest.py
 tools/xm-test/tests/*.test
-tools/ioemu-remote
-tools/ioemu-dir
 tools/ocaml-xenstored*
 xen/.banner*
 xen/BLOG
@@ -325,6 +307,15 @@
 unmodified_drivers/linux-2.6/*.mod.c
 LibVNCServer*
 
+tools/qemu-xen-dir-remote
+tools/qemu-xen-dir
+
+tools/qemu-xen-traditional-dir-remote
+tools/qemu-xen-traditional-dir
+
+tools/firmware/seabios-dir-remote
+tools/firmware/seabios-dir
+
 tools/firmware/rombios/_rombios_.c
 tools/firmware/rombios/rombios.s
 tools/firmware/rombios/rombios.sym
diff -r e2722b24dc09 -r 097f5d9c32f9 .hgignore
--- a/.hgignore	Thu Jan 26 17:43:31 2012 +0000
+++ b/.hgignore	Fri Jan 27 17:01:18 2012 +0000
@@ -163,20 +163,6 @@
 ^tools/include/xen/.*$
 ^tools/include/xen-foreign/.*\.(c|h|size)$
 ^tools/include/xen-foreign/checker$
-^tools/ioemu/\.pc/.*$
-^tools/ioemu/config-host\.h$
-^tools/ioemu/config-host\.mak$
-^tools/ioemu/i386-dm/Makefile$
-^tools/ioemu/i386-dm/config\.h$
-^tools/ioemu/i386-dm/config\.mak$
-^tools/ioemu/i386-dm/qemu-dm$
-^tools/ioemu/qemu-doc\.html$
-^tools/ioemu/qemu-img\.1$
-^tools/ioemu/qemu-img\.pod$
-^tools/ioemu/qemu-tech\.html$
-^tools/ioemu/qemu\.1$
-^tools/ioemu/qemu\.pod$
-^tools/ioemu/tapdisk-ioemu$
 ^tools/libxc/ia64/asm/.*\.h$
 ^tools/libxc/ia64/acpi/.*\.h$
 ^tools/libxc/ia64/acpi/platform/.*\.h$

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:55:40 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:55:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6V-0006E6-Ug; Fri, 03 Feb 2012 21:55:35 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6U-0006Do-11
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:34 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-216.messagelabs.com!1328306126!13419241!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22547 invoked from network); 3 Feb 2012 21:55:27 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:27 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6M-0001hZ-C0
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:26 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6E-000299-IW
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:20 +0000
Message-Id: <E1RtR6E-000299-IW@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] .gitignore/.hgignore: New names for
	ioemu dirs, seabios
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327683678 0
# Node ID 097f5d9c32f975464462a11644177ce8b6b6e9e7
# Parent  e2722b24dc0962de37215320b05d1bb7c4c42864
.gitignore/.hgignore: New names for ioemu dirs, seabios

* Add new seabios clone directories to .gitignore.
* Add new qemu clone directories to .gitignore.
* Remove old tools/ioemu (long-obsolete) from .gitignore and .hgignore.

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


diff -r e2722b24dc09 -r 097f5d9c32f9 .gitignore
--- a/.gitignore	Thu Jan 26 17:43:31 2012 +0000
+++ b/.gitignore	Fri Jan 27 17:01:18 2012 +0000
@@ -15,8 +15,6 @@
 .config
 
 dist
-tools/ioemu-dir
-tools/ioemu-remote
 stubdom/*.tar.gz
 
 build-*
@@ -162,20 +160,6 @@
 tools/include/xen/*
 tools/include/xen-foreign/*.(c|h|size)
 tools/include/xen-foreign/checker
-tools/ioemu/.pc/*
-tools/ioemu/config-host.h
-tools/ioemu/config-host.mak
-tools/ioemu/i386-dm/Makefile
-tools/ioemu/i386-dm/config.h
-tools/ioemu/i386-dm/config.mak
-tools/ioemu/i386-dm/qemu-dm
-tools/ioemu/qemu-doc.html
-tools/ioemu/qemu-img.1
-tools/ioemu/qemu-img.pod
-tools/ioemu/qemu-tech.html
-tools/ioemu/qemu.1
-tools/ioemu/qemu.pod
-tools/ioemu/tapdisk-ioemu
 tools/libxc/ia64/asm/*.h
 tools/libxc/ia64/acpi/*.h
 tools/libxc/ia64/acpi/platform/*.h
@@ -285,8 +269,6 @@
 tools/xm-test/lib/XmTestLib/config.py
 tools/xm-test/lib/XmTestReport/xmtest.py
 tools/xm-test/tests/*.test
-tools/ioemu-remote
-tools/ioemu-dir
 tools/ocaml-xenstored*
 xen/.banner*
 xen/BLOG
@@ -325,6 +307,15 @@
 unmodified_drivers/linux-2.6/*.mod.c
 LibVNCServer*
 
+tools/qemu-xen-dir-remote
+tools/qemu-xen-dir
+
+tools/qemu-xen-traditional-dir-remote
+tools/qemu-xen-traditional-dir
+
+tools/firmware/seabios-dir-remote
+tools/firmware/seabios-dir
+
 tools/firmware/rombios/_rombios_.c
 tools/firmware/rombios/rombios.s
 tools/firmware/rombios/rombios.sym
diff -r e2722b24dc09 -r 097f5d9c32f9 .hgignore
--- a/.hgignore	Thu Jan 26 17:43:31 2012 +0000
+++ b/.hgignore	Fri Jan 27 17:01:18 2012 +0000
@@ -163,20 +163,6 @@
 ^tools/include/xen/.*$
 ^tools/include/xen-foreign/.*\.(c|h|size)$
 ^tools/include/xen-foreign/checker$
-^tools/ioemu/\.pc/.*$
-^tools/ioemu/config-host\.h$
-^tools/ioemu/config-host\.mak$
-^tools/ioemu/i386-dm/Makefile$
-^tools/ioemu/i386-dm/config\.h$
-^tools/ioemu/i386-dm/config\.mak$
-^tools/ioemu/i386-dm/qemu-dm$
-^tools/ioemu/qemu-doc\.html$
-^tools/ioemu/qemu-img\.1$
-^tools/ioemu/qemu-img\.pod$
-^tools/ioemu/qemu-tech\.html$
-^tools/ioemu/qemu\.1$
-^tools/ioemu/qemu\.pod$
-^tools/ioemu/tapdisk-ioemu$
 ^tools/libxc/ia64/asm/.*\.h$
 ^tools/libxc/ia64/acpi/.*\.h$
 ^tools/libxc/ia64/acpi/platform/.*\.h$

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:55:45 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:55:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6d-0006FC-1g; Fri, 03 Feb 2012 21:55:43 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6b-0006Ed-3g
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:41 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-27.messagelabs.com!1328306018!62474666!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1759 invoked from network); 3 Feb 2012 21:53:39 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:53:39 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6W-0001ho-GK
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:36 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6V-0002Do-7O
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:35 +0000
Message-Id: <E1RtR6V-0002Do-7O@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:34 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: New event generation API
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327683682 0
# Node ID 4f3822ee1f437792ff89b53cc5e2c59d98dbf337
# Parent  db9cac5b24897a5a936a516660457ace6043fc22
libxl: New event generation API

Replace the existing API for retrieving high-level events (events
about domains, etc.) from libxl with a new one.

This changes the definition and semantics of the `libxl_event'
structure, and replaces the calls for obtaining information about
domain death and disk eject events.

This is an incompatible change, sorry.  The alternative was to try to
provide both the previous horrid API and the new one, and would also
involve never using the name `libxl_event' for the new interface.

The new "libxl_event" structure is blacklisted in the ocaml bindings
for two reasons:
  - It has a field name "type" (which is a keyword in ocaml);
    the ocaml idl generator should massage this field name on
    output, to "type_" perhaps.
  - The ocaml idl generator does not support KeyedUnion.

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


diff -r db9cac5b2489 -r 4f3822ee1f43 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Jan 27 17:01:21 2012 +0000
+++ b/tools/libxl/libxl.c	Fri Jan 27 17:01:22 2012 +0000
@@ -45,8 +45,11 @@
      * only as an initialiser, not as an expression. */
     memcpy(&ctx->lock, &mutex_value, sizeof(ctx->lock));
 
+    LIBXL_TAILQ_INIT(&ctx->occurred);
+
     ctx->osevent_hooks = 0;
 
+    ctx->fd_polls = 0;
     ctx->fd_rindex = 0;
     LIBXL_LIST_INIT(&ctx->efds);
     LIBXL_TAILQ_INIT(&ctx->etimes);
@@ -55,6 +58,9 @@
     LIBXL_SLIST_INIT(&ctx->watch_freeslots);
     libxl__ev_fd_init(&ctx->watch_efd);
 
+    LIBXL_TAILQ_INIT(&ctx->death_list);
+    libxl__ev_xswatch_init(&ctx->death_watch);
+
     if ( stat(XENSTORE_PID_FILE, &stat_buf) != 0 ) {
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Is xenstore daemon running?\n"
                      "failed to stat %s", XENSTORE_PID_FILE);
@@ -86,6 +92,20 @@
     return rc;
 }
 
+static void free_disable_deaths(libxl__gc *gc,
+                                struct libxl__evgen_domain_death_list *l) {
+    libxl_evgen_domain_death *death;
+    while ((death = LIBXL_TAILQ_FIRST(l)))
+        libxl__evdisable_domain_death(gc, death);
+}
+
+static void discard_events(struct libxl__event_list *l) {
+    /* doesn't bother unlinking from the list, so l is corrupt on return */
+    libxl_event *ev;
+    LIBXL_TAILQ_FOREACH(ev, l, link)
+        libxl_event_free(0, ev);
+}
+
 int libxl_ctx_free(libxl_ctx *ctx)
 {
     if (!ctx) return 0;
@@ -95,6 +115,13 @@
 
     /* Deregister all libxl__ev_KINDs: */
 
+    free_disable_deaths(gc, &CTX->death_list);
+    free_disable_deaths(gc, &CTX->death_reported);
+
+    libxl_evgen_disk_eject *eject;
+    while ((eject = LIBXL_LIST_FIRST(&CTX->disk_eject_evgens)))
+        libxl__evdisable_disk_eject(gc, eject);
+
     for (i = 0; i < ctx->watch_nslots; i++)
         assert(!libxl__watch_slot_contents(gc, i));
     libxl__ev_fd_deregister(gc, &ctx->watch_efd);
@@ -108,9 +135,12 @@
     libxl_version_info_dispose(&ctx->version_info);
     if (ctx->xsh) xs_daemon_close(ctx->xsh);
 
+    free(ctx->fd_polls);
     free(ctx->fd_rindex);
     free(ctx->watch_slots);
 
+    discard_events(&ctx->occurred);
+
     GC_FREE;
     free(ctx);
     return 0;
@@ -646,117 +676,177 @@
     return ret;
 }
 
-int libxl_get_wait_fd(libxl_ctx *ctx, int *fd)
-{
-    *fd = xs_fileno(ctx->xsh);
-    return 0;
+static void domain_death_xswatch_callback(libxl__egc *egc, libxl__ev_xswatch *w,
+                                        const char *wpath, const char *epath) {
+    EGC_GC;
+    libxl_evgen_domain_death *evg;
+    uint32_t domid;
+    int rc;
+
+    CTX_LOCK;
+
+    evg = LIBXL_TAILQ_FIRST(&CTX->death_list);
+    if (!evg) goto out;
+
+    domid = evg->domid;
+
+    for (;;) {
+        int nentries = LIBXL_TAILQ_NEXT(evg, entry) ? 200 : 1;
+        xc_domaininfo_t domaininfos[nentries];
+        const xc_domaininfo_t *got = domaininfos, *gotend;
+
+        rc = xc_domain_getinfolist(CTX->xch, domid, nentries, domaininfos);
+        if (rc == -1) {
+            LIBXL__EVENT_DISASTER(egc, "xc_domain_getinfolist failed while"
+                                  " processing @releaseDomain watch event",
+                                  errno, 0);
+            goto out;
+        }
+        gotend = &domaininfos[rc];
+
+        for (;;) {
+            if (!evg)
+                goto all_reported;
+
+            if (!rc || got->domain > evg->domid) {
+                /* ie, the list doesn't contain evg->domid any more so
+                 * the domain has been destroyed */
+                libxl_evgen_domain_death *evg_next;
+
+                libxl_event *ev = NEW_EVENT(egc, DOMAIN_DESTROY, evg->domid);
+                if (!ev) goto out;
+
+                libxl__event_occurred(egc, ev);
+
+                evg->death_reported = 1;
+                evg_next = LIBXL_TAILQ_NEXT(evg, entry);
+                LIBXL_TAILQ_REMOVE(&CTX->death_list, evg, entry);
+                LIBXL_TAILQ_INSERT_HEAD(&CTX->death_reported, evg, entry);
+                evg = evg_next;
+
+                continue;
+            }
+            
+            if (got == gotend)
+                break;
+
+            if (got->domain < evg->domid) {
+                got++;
+                continue;
+            }
+
+            assert(evg->domid == got->domain);
+
+            if (!evg->shutdown_reported &&
+                (got->flags & XEN_DOMINF_shutdown)) {
+                libxl_event *ev = NEW_EVENT(egc, DOMAIN_SHUTDOWN, got->domain);
+                if (!ev) goto out;
+                
+                ev->u.domain_shutdown.shutdown_reason =
+                    (got->flags >> XEN_DOMINF_shutdownshift) &
+                    XEN_DOMINF_shutdownmask;
+                libxl__event_occurred(egc, ev);
+
+                evg->shutdown_reported = 1;
+            }
+            evg = LIBXL_TAILQ_NEXT(evg, entry);
+        }
+
+        assert(rc); /* rc==0 results in us eating all evgs and quitting */
+        domid = gotend[-1].domain;
+    }
+ all_reported:
+ out:
+
+    CTX_UNLOCK;
 }
 
-int libxl_wait_for_domain_death(libxl_ctx *ctx, uint32_t domid, libxl_waiter *waiter)
-{
-    waiter->path = strdup("@releaseDomain");
-    if (asprintf(&(waiter->token), "%d", LIBXL_EVENT_TYPE_DOMAIN_DEATH) < 0)
-        return -1;
-    if (!xs_watch(ctx->xsh, waiter->path, waiter->token))
-        return -1;
-    return 0;
-}
-
-int libxl_wait_for_disk_ejects(libxl_ctx *ctx, uint32_t guest_domid, libxl_device_disk *disks, int num_disks, libxl_waiter *waiter)
-{
+int libxl_evenable_domain_death(libxl_ctx *ctx, uint32_t domid,
+                libxl_ev_user user, libxl_evgen_domain_death **evgen_out) {
     GC_INIT(ctx);
-    int i, rc = -1;
-    uint32_t domid = libxl_get_stubdom_id(ctx, guest_domid);
-
-    if (!domid)
-        domid = guest_domid;
-
-    for (i = 0; i < num_disks; i++) {
-        if (asprintf(&(waiter[i].path), "%s/device/vbd/%d/eject",
-                     libxl__xs_get_dompath(gc, domid),
-                     libxl__device_disk_dev_number(disks[i].vdev,
-                                                   NULL, NULL)) < 0)
-            goto out;
-        if (asprintf(&(waiter[i].token), "%d", LIBXL_EVENT_TYPE_DISK_EJECT) < 0)
-            goto out;
-        xs_watch(ctx->xsh, waiter[i].path, waiter[i].token);
+    libxl_evgen_domain_death *evg, *evg_search;
+    int rc;
+    
+    CTX_LOCK;
+
+    evg = malloc(sizeof(*evg));  if (!evg) { rc = ERROR_NOMEM; goto out; }
+    memset(evg, 0, sizeof(*evg));
+    evg->domid = domid;
+    evg->user = user;
+
+    LIBXL_TAILQ_INSERT_SORTED(&ctx->death_list, entry, evg, evg_search, ,
+                              evg->domid > evg_search->domid);
+
+    if (!libxl__ev_xswatch_isregistered(&ctx->death_watch)) {
+        rc = libxl__ev_xswatch_register(gc, &ctx->death_watch,
+                        domain_death_xswatch_callback, "@releaseDomain");
+        if (rc) { libxl__evdisable_domain_death(gc, evg); goto out; }
     }
+
+    *evgen_out = evg;
     rc = 0;
-out:
+
+ out:
+    CTX_UNLOCK;
     GC_FREE;
     return rc;
+};
+
+void libxl__evdisable_domain_death(libxl__gc *gc,
+                                   libxl_evgen_domain_death *evg) {
+    CTX_LOCK;
+
+    if (!evg->death_reported)
+        LIBXL_TAILQ_REMOVE(&CTX->death_list, evg, entry);
+    else
+        LIBXL_TAILQ_REMOVE(&CTX->death_reported, evg, entry);
+
+    free(evg);
+
+    if (!LIBXL_TAILQ_FIRST(&CTX->death_list) &&
+        libxl__ev_xswatch_isregistered(&CTX->death_watch))
+        libxl__ev_xswatch_deregister(gc, &CTX->death_watch);
+
+    CTX_UNLOCK;
 }
 
-int libxl_get_event(libxl_ctx *ctx, libxl_event *event)
-{
-    unsigned int num;
-    char **events = xs_read_watch(ctx->xsh, &num);
-    if (num != 2) {
-        free(events);
-        return ERROR_FAIL;
-    }
-    event->path = strdup(events[XS_WATCH_PATH]);
-    event->token = strdup(events[XS_WATCH_TOKEN]);
-    event->type = atoi(event->token);
-    free(events);
-    return 0;
+void libxl_evdisable_domain_death(libxl_ctx *ctx,
+                                  libxl_evgen_domain_death *evg) {
+    GC_INIT(ctx);
+    libxl__evdisable_domain_death(gc, evg);
+    GC_FREE;
 }
 
-int libxl_stop_waiting(libxl_ctx *ctx, libxl_waiter *waiter)
-{
-    if (!xs_unwatch(ctx->xsh, waiter->path, waiter->token))
-        return ERROR_FAIL;
-    else
-        return 0;
-}
-
-int libxl_free_event(libxl_event *event)
-{
-    free(event->path);
-    free(event->token);
-    return 0;
-}
-
-int libxl_free_waiter(libxl_waiter *waiter)
-{
-    free(waiter->path);
-    free(waiter->token);
-    return 0;
-}
-
-int libxl_event_get_domain_death_info(libxl_ctx *ctx, uint32_t domid, libxl_event *event, libxl_dominfo *info)
-{
-    if (libxl_domain_info(ctx, info, domid) < 0)
-        return 0;
-
-    if (info->running || (!info->shutdown && !info->dying))
-        return ERROR_INVAL;
-
-    return 1;
-}
-
-int libxl_event_get_disk_eject_info(libxl_ctx *ctx, uint32_t domid, libxl_event *event, libxl_device_disk *disk)
-{
-    GC_INIT(ctx);
-    char *path;
+static void disk_eject_xswatch_callback(libxl__egc *egc, libxl__ev_xswatch *w,
+                                        const char *wpath, const char *epath) {
+    EGC_GC;
+    libxl_evgen_disk_eject *evg = (void*)w;
     char *backend;
     char *value;
     char backend_type[BACKEND_STRING_SIZE+1];
 
-    value = libxl__xs_read(gc, XBT_NULL, event->path);
-
-    if (!value || strcmp(value,  "eject")) {
-        GC_FREE;
-        return 0;
+    value = libxl__xs_read(gc, XBT_NULL, wpath);
+
+    if (!value || strcmp(value,  "eject"))
+        return;
+
+    if (libxl__xs_write(gc, XBT_NULL, wpath, "")) {
+        LIBXL__EVENT_DISASTER(egc, "xs_write failed acknowledging eject",
+                              errno, LIBXL_EVENT_TYPE_DISK_EJECT);
+        return;
     }
 
-    path = strdup(event->path);
-    path[strlen(path) - 6] = '\0';
-    backend = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/backend", path));
+    libxl_event *ev = NEW_EVENT(egc, DISK_EJECT, evg->domid);
+    libxl_device_disk *disk = &ev->u.disk_eject.disk;
+    
+    backend = libxl__xs_read(gc, XBT_NULL,
+                             libxl__sprintf(gc, "%.*s/backend",
+                                            (int)strlen(wpath)-6, wpath));
 
     sscanf(backend,
-            "/local/domain/%d/backend/%" TOSTRING(BACKEND_STRING_SIZE) "[a-z]/%*d/%*d",
-            &disk->backend_domid, backend_type);
+            "/local/domain/%d/backend/%" TOSTRING(BACKEND_STRING_SIZE)
+           "[a-z]/%*d/%*d",
+           &disk->backend_domid, backend_type);
     if (!strcmp(backend_type, "tap") || !strcmp(backend_type, "vbd")) {
         disk->backend = LIBXL_DISK_BACKEND_TAP;
     } else if (!strcmp(backend_type, "qdisk")) {
@@ -765,19 +855,83 @@
         disk->backend = LIBXL_DISK_BACKEND_UNKNOWN;
     }
 
-    disk->pdev_path = strdup("");
+    disk->pdev_path = strdup(""); /* xxx fixme malloc failure */
     disk->format = LIBXL_DISK_FORMAT_EMPTY;
     /* this value is returned to the user: do not free right away */
-    disk->vdev = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(gc, "%s/dev", backend), NULL);
+    disk->vdev = xs_read(CTX->xsh, XBT_NULL,
+                         libxl__sprintf(gc, "%s/dev", backend), NULL);
     disk->removable = 1;
     disk->readwrite = 0;
     disk->is_cdrom = 1;
 
-    free(path);
+    libxl__event_occurred(egc, ev);
+}
+
+int libxl_evenable_disk_eject(libxl_ctx *ctx, uint32_t guest_domid,
+                              const char *vdev, libxl_ev_user user,
+                              libxl_evgen_disk_eject **evgen_out) {
+    GC_INIT(ctx);
+    CTX_LOCK;
+    int rc;
+    char *path;
+    libxl_evgen_disk_eject *evg = NULL;
+
+    evg = malloc(sizeof(*evg));  if (!evg) { rc = ERROR_NOMEM; goto out; }
+    memset(evg, 0, sizeof(*evg));
+    evg->user = user;
+    evg->domid = guest_domid;
+    LIBXL_LIST_INSERT_HEAD(&CTX->disk_eject_evgens, evg, entry);
+
+    evg->vdev = strdup(vdev);
+    if (!evg->vdev) { rc = ERROR_NOMEM; goto out; }
+
+    uint32_t domid = libxl_get_stubdom_id(ctx, guest_domid);
+
+    if (!domid)
+        domid = guest_domid;
+
+    path = libxl__sprintf(gc, "%s/device/vbd/%d/eject",
+                 libxl__xs_get_dompath(gc, domid),
+                 libxl__device_disk_dev_number(vdev, NULL, NULL));
+    if (!path) { rc = ERROR_NOMEM; goto out; }
+
+    rc = libxl__ev_xswatch_register(gc, &evg->watch,
+                                    disk_eject_xswatch_callback, path);
+    if (rc) goto out;
+
+    *evgen_out = evg;
+    CTX_UNLOCK;
     GC_FREE;
-    return 1;
+    return 0;
+
+ out:
+    if (evg)
+        libxl__evdisable_disk_eject(gc, evg);
+    CTX_UNLOCK;
+    GC_FREE;
+    return rc;
 }
 
+void libxl__evdisable_disk_eject(libxl__gc *gc, libxl_evgen_disk_eject *evg) {
+    CTX_LOCK;
+
+    LIBXL_LIST_REMOVE(evg, entry);
+
+    if (libxl__ev_xswatch_isregistered(&evg->watch))
+        libxl__ev_xswatch_deregister(gc, &evg->watch);
+
+    free(evg->vdev);
+    free(evg);
+
+    CTX_UNLOCK;
+}
+
+void libxl_evdisable_disk_eject(libxl_ctx *ctx, libxl_evgen_disk_eject *evg) {
+    GC_INIT(ctx);
+    libxl__evdisable_disk_eject(gc, evg);
+    GC_FREE;
+}    
+
 int libxl_domain_destroy(libxl_ctx *ctx, uint32_t domid)
 {
     GC_INIT(ctx);
diff -r db9cac5b2489 -r 4f3822ee1f43 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Fri Jan 27 17:01:21 2012 +0000
+++ b/tools/libxl/libxl.h	Fri Jan 27 17:01:22 2012 +0000
@@ -53,7 +53,10 @@
  *    A public function may be called from within libxl; the call
  *    context initialisation macros will make sure that the internal
  *    caller's context is reused (eg, so that the same xenstore
- *    transaction is used).
+ *    transaction is used).  But in-libxl callers of libxl public
+ *    functions should note that any libxl public function may cause
+ *    recursively reentry into libxl via the application's event
+ *    callback hook.
  *
  *    Public functions have names like libxl_foobar.
  *
@@ -152,6 +155,8 @@
 
 typedef uint32_t libxl_hwcap[8];
 
+typedef uint64_t libxl_ev_user;
+
 typedef struct {
     uint32_t size;          /* number of bytes in map */
     uint8_t *map;
@@ -200,6 +205,9 @@
     int v;
 } libxl_enum_string_table;
 
+struct libxl_event;
+typedef LIBXL_TAILQ_ENTRY(struct libxl_event) libxl_ev_link;
+
 typedef struct libxl__ctx libxl_ctx;
 
 #include "_libxl_types.h"
@@ -300,51 +308,6 @@
 
   /* 0 means ERROR_ENOMEM, which we have logged */
 
-/* events handling */
-
-typedef struct {
-    /* event type */
-    libxl_event_type type;
-    /* data for internal use of the library */
-    char *path;
-    char *token;
-} libxl_event;
-
-typedef struct {
-    char *path;
-    char *token;
-} libxl_waiter;
-
-
-int libxl_get_wait_fd(libxl_ctx *ctx, int *fd);
-/* waiter is allocated by the caller */
-int libxl_wait_for_domain_death(libxl_ctx *ctx, uint32_t domid, libxl_waiter *waiter);
-/* waiter is a preallocated array of num_disks libxl_waiter elements */
-int libxl_wait_for_disk_ejects(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disks, int num_disks, libxl_waiter *waiter);
-int libxl_get_event(libxl_ctx *ctx, libxl_event *event);
-int libxl_stop_waiting(libxl_ctx *ctx, libxl_waiter *waiter);
-int libxl_free_event(libxl_event *event);
-int libxl_free_waiter(libxl_waiter *waiter);
-
-/*
- * Returns:
- *  - 0 if the domain is dead but there is no cleanup to be done. e.g
- *    because someone else has already done it.
- *  - 1 if the domain is dead and there is cleanup to be done.
- *
- * Can return error if the domain exists and is still running.
- *
- * *info will contain valid domain state iff 1 is returned. In
- * particular if 1 is returned then info->shutdown_reason is
- * guaranteed to be valid since by definition the domain is
- * (shutdown||dying))
- */
-int libxl_event_get_domain_death_info(libxl_ctx *ctx, uint32_t domid, libxl_event *event, libxl_dominfo *info);
-
-/*
- * Returns true and fills *disk if the caller should eject the disk
- */
-int libxl_event_get_disk_eject_info(libxl_ctx *ctx, uint32_t domid, libxl_event *event, libxl_device_disk *disk);
 
 int libxl_domain_rename(libxl_ctx *ctx, uint32_t domid,
                         const char *old_name, const char *new_name);
diff -r db9cac5b2489 -r 4f3822ee1f43 tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c	Fri Jan 27 17:01:21 2012 +0000
+++ b/tools/libxl/libxl_event.c	Fri Jan 27 17:01:22 2012 +0000
@@ -510,9 +510,9 @@
  * osevent poll
  */
 
-int libxl_osevent_beforepoll(libxl_ctx *ctx, int *nfds_io,
-                             struct pollfd *fds, int *timeout_upd,
-                             struct timeval now)
+static int beforepoll_internal(libxl__gc *gc, int *nfds_io,
+                               struct pollfd *fds, int *timeout_upd,
+                               struct timeval now)
 {
     libxl__ev_fd *efd;
     int rc;
@@ -524,9 +524,6 @@
      * the fds array corresponds to a slot in fd_beforepolled.
      */
 
-    GC_INIT(ctx);
-    CTX_LOCK;
-
     if (*nfds_io) {
         /*
          * As an optimisation, we don't touch fd_rindex
@@ -593,8 +590,18 @@
     }
 
  out:
+    return rc;
+}
+
+int libxl_osevent_beforepoll(libxl_ctx *ctx, int *nfds_io,
+                             struct pollfd *fds, int *timeout_upd,
+                             struct timeval now)
+{
+    EGC_INIT(ctx);
+    CTX_LOCK;
+    int rc = beforepoll_internal(gc, nfds_io, fds, timeout_upd, now);
     CTX_UNLOCK;
-    GC_FREE;
+    EGC_FREE;
     return rc;
 }
 
@@ -623,11 +630,11 @@
     return revents;
 }
 
-void libxl_osevent_afterpoll(libxl_ctx *ctx, int nfds, const struct pollfd *fds,
-                             struct timeval now)
+static void afterpoll_internal(libxl__egc *egc,
+                               int nfds, const struct pollfd *fds,
+                               struct timeval now)
 {
-    EGC_INIT(ctx);
-    CTX_LOCK;
+    EGC_GC;
     libxl__ev_fd *efd;
 
     LIBXL_LIST_FOREACH(efd, &CTX->efds, entry) {
@@ -653,12 +660,18 @@
 
         etime->func(egc, etime, &etime->abs);
     }
+}
 
+void libxl_osevent_afterpoll(libxl_ctx *ctx, int nfds, const struct pollfd *fds,
+                             struct timeval now)
+{
+    EGC_INIT(ctx);
+    CTX_LOCK;
+    afterpoll_internal(egc, nfds, fds, now);
     CTX_UNLOCK;
     EGC_FREE;
 }
 
-
 /*
  * osevent hook and callback machinery
  */
@@ -723,11 +736,10 @@
                type ? libxl_event_type_to_string(type) : "",
                type ? ")" : "");
 
-    /*
-     * FIXME: This should call the "disaster" hook supplied to
-     * libxl_event_register_callbacks, which will be introduced in the
-     * next patch.
-     */
+    if (CTX->event_hooks && CTX->event_hooks->disaster) {
+        CTX->event_hooks->disaster(CTX->event_hooks_user, type, msg, errnoval);
+        return;
+    }
 
     const char verybad[] =
         "DISASTER in event loop not handled by libxl application";
@@ -736,9 +748,197 @@
     exit(-1);
 }
 
+static void egc_run_callbacks(libxl__egc *egc)
+{
+    EGC_GC;
+    libxl_event *ev, *ev_tmp;
+    LIBXL_TAILQ_FOREACH_SAFE(ev, &egc->occurred_for_callback, link, ev_tmp) {
+        LIBXL_TAILQ_REMOVE(&egc->occurred_for_callback, ev, link);
+        CTX->event_hooks->event_occurs(CTX->event_hooks_user, ev);
+    }
+}
+
 void libxl__egc_cleanup(libxl__egc *egc)
 {
-    libxl__free_all(&egc->gc);
+    EGC_GC;
+    libxl__free_all(gc);
+
+    egc_run_callbacks(egc);
+}
+
+/*
+ * Event retrieval etc.
+ */
+
+void libxl_event_register_callbacks(libxl_ctx *ctx,
+                  const libxl_event_hooks *hooks, void *user)
+{
+    ctx->event_hooks = hooks;
+    ctx->event_hooks_user = user;
+}
+
+void libxl__event_occurred(libxl__egc *egc, libxl_event *event)
+{
+    EGC_GC;
+
+    if (CTX->event_hooks &&
+        (CTX->event_hooks->event_occurs_mask & (1UL << event->type))) {
+        /* libxl__egc_cleanup will call the callback, just before exit
+         * from libxl.  This helps avoid reentrancy bugs: parts of
+         * libxl that call libxl__event_occurred do not have to worry
+         * that libxl might be reentered at that point. */
+        LIBXL_TAILQ_INSERT_TAIL(&egc->occurred_for_callback, event, link);
+        return;
+    } else {
+        LIBXL_TAILQ_INSERT_TAIL(&CTX->occurred, event, link);
+    }
+}
+
+void libxl_event_free(libxl_ctx *ctx, libxl_event *event)
+{
+    /* Exceptionally, this function may be called from libxl, with ctx==0 */
+    libxl_event_dispose(event);
+    free(event);
+}
+
+libxl_event *libxl__event_new(libxl__egc *egc,
+                              libxl_event_type type, uint32_t domid)
+{
+    libxl_event *ev;
+
+    ev = malloc(sizeof(*ev));
+    if (!ev) {
+        LIBXL__EVENT_DISASTER(egc, "allocate new event", errno, type);
+        return NULL;
+    }
+
+    memset(ev, 0, sizeof(*ev));
+    ev->type = type;
+    ev->domid = domid;
+
+    return ev;
+}
+
+static int event_check_internal(libxl__egc *egc, libxl_event **event_r,
+                                unsigned long typemask,
+                                libxl_event_predicate *pred, void *pred_user)
+{
+    EGC_GC;
+    libxl_event *ev;
+    int rc;
+
+    LIBXL_TAILQ_FOREACH(ev, &CTX->occurred, link) {
+        if (!(typemask & ((uint64_t)1 << ev->type)))
+            continue;
+
+        if (pred && !pred(ev, pred_user))
+            continue;
+
+        /* got one! */
+        LIBXL_TAILQ_REMOVE(&CTX->occurred, ev, link);
+        *event_r = ev;
+        rc = 0;
+        goto out;
+    }
+    rc = ERROR_NOT_READY;
+
+ out:
+    return rc;
+}
+
+int libxl_event_check(libxl_ctx *ctx, libxl_event **event_r,
+                      uint64_t typemask,
+                      libxl_event_predicate *pred, void *pred_user)
+{
+    EGC_INIT(ctx);
+    CTX_LOCK;
+    int rc = event_check_internal(egc, event_r, typemask, pred, pred_user);
+    CTX_UNLOCK;
+    EGC_FREE;
+    return rc;
+}
+
+static int eventloop_iteration(libxl__egc *egc) {
+    EGC_GC;
+    int rc;
+    struct timeval now;
+    
+    CTX_LOCK;
+
+    rc = libxl__gettimeofday(gc, &now);
+    if (rc) goto out;
+
+    int timeout;
+
+    for (;;) {
+        int nfds = CTX->fd_polls_allocd;
+        timeout = -1;
+        rc = beforepoll_internal(gc, &nfds, CTX->fd_polls, &timeout, now);
+        if (!rc) break;
+        if (rc != ERROR_BUFFERFULL) goto out;
+
+        struct pollfd *newarray =
+            (nfds > INT_MAX / sizeof(struct pollfd) / 2) ? 0 :
+            realloc(CTX->fd_polls, sizeof(*newarray) * nfds);
+
+        if (!newarray) { rc = ERROR_NOMEM; goto out; }
+
+        CTX->fd_polls = newarray;
+        CTX->fd_polls_allocd = nfds;
+    }
+
+    rc = poll(CTX->fd_polls, CTX->fd_polls_allocd, timeout);
+    if (rc < 0) {
+        if (errno == EINTR)
+            return 0; /* will go round again if caller requires */
+
+        LIBXL__LOG_ERRNOVAL(CTX, LIBXL__LOG_ERROR, errno, "poll failed");
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
+    rc = libxl__gettimeofday(gc, &now);
+    if (rc) goto out;
+
+    afterpoll_internal(egc, CTX->fd_polls_allocd, CTX->fd_polls, now);
+
+    CTX_UNLOCK;
+
+    rc = 0;
+ out:
+    return rc;
+}
+
+int libxl_event_wait(libxl_ctx *ctx, libxl_event **event_r,
+                     uint64_t typemask,
+                     libxl_event_predicate *pred, void *pred_user)
+{
+    int rc;
+
+    EGC_INIT(ctx);
+    CTX_LOCK;
+
+    for (;;) {
+        rc = event_check_internal(egc, event_r, typemask, pred, pred_user);
+        if (rc != ERROR_NOT_READY) goto out;
+
+        rc = eventloop_iteration(egc);
+        if (rc) goto out;
+
+        /* we unlock and cleanup the egc each time we go through this loop,
+         * so that (a) we don't accumulate garbage and (b) any events
+         * which are to be dispatched by callback are actually delivered
+         * in a timely fashion.
+         */
+        CTX_UNLOCK;
+        libxl__egc_cleanup(egc);
+        CTX_LOCK;
+    }
+
+ out:
+    CTX_UNLOCK;
+    EGC_FREE;
+    return rc;
 }
 
 /*
diff -r db9cac5b2489 -r 4f3822ee1f43 tools/libxl/libxl_event.h
--- a/tools/libxl/libxl_event.h	Fri Jan 27 17:01:21 2012 +0000
+++ b/tools/libxl/libxl_event.h	Fri Jan 27 17:01:22 2012 +0000
@@ -18,6 +18,181 @@
 
 #include <libxl.h>
 
+/*======================================================================*/
+
+/*
+ * Domain event handling - getting Xen events from libxl
+ *
+ * (Callers inside libxl may not call libxl_event_check or _wait.)
+ */
+
+#define LIBXL_EVENTMASK_ALL (~(unsigned long)0)
+
+typedef int libxl_event_predicate(const libxl_event*, void *user);
+  /* Return value is 0 if the event is unwanted or non-0 if it is.
+   * Predicates are not allowed to fail.
+   */
+
+int libxl_event_check(libxl_ctx *ctx, libxl_event **event_r,
+                      uint64_t typemask,
+                      libxl_event_predicate *predicate, void *predicate_user);
+  /* Searches for an event, already-happened, which matches typemask
+   * and predicate.  predicate==0 matches any event.
+   * libxl_event_check returns the event, which must then later be
+   * freed by the caller using libxl_event_free.
+   *
+   * Returns ERROR_NOT_READY if no such event has happened.
+   */
+
+int libxl_event_wait(libxl_ctx *ctx, libxl_event **event_r,
+                     uint64_t typemask,
+                     libxl_event_predicate *predicate, void *predicate_user);
+  /* Like libxl_event_check but blocks if no suitable events are
+   * available, until some are.  Uses libxl_osevent_beforepoll/
+   * _afterpoll so may be inefficient if very many domains are being
+   * handled by a single program.
+   */
+
+void libxl_event_free(libxl_ctx *ctx, libxl_event *event);
+
+
+/* Alternatively or additionally, the application may also use this: */
+
+typedef struct libxl_event_hooks {
+    uint64_t event_occurs_mask;
+    void (*event_occurs)(void *user, const libxl_event *event);
+    void (*disaster)(void *user, libxl_event_type type,
+                     const char *msg, int errnoval);
+} libxl_event_hooks;
+
+void libxl_event_register_callbacks(libxl_ctx *ctx,
+                                    const libxl_event_hooks *hooks, void *user);
+  /*
+   * Arranges that libxl will henceforth call event_occurs for any
+   * events whose type is set in event_occurs_mask, rather than
+   * queueing the event for retrieval by libxl_event_check/wait.
+   * Events whose bit is clear in mask are not affected.
+   *
+   * event becomes owned by the application and must be freed, either
+   * by event_occurs or later.
+   *
+   * event_occurs may be NULL if mask is 0.
+   *
+   * libxl_event_register_callback also provides a way for libxl to
+   * report to the application that there was a problem reporting
+   * events; this can occur due to lack of host memory during event
+   * handling, or other wholly unrecoverable errors from system calls
+   * made by libxl.  This will not happen for frivolous reasons - only
+   * if the system, or the Xen components of it, are badly broken.
+   *
+   * msg and errnoval will describe the action that libxl was trying
+   * to do, and type specifies the type of libxl events which may be
+   * missing.  type may be 0 in which case events of all types may be
+   * missing.
+   *
+   * disaster may be NULL.  If it is, or if _register_callbacks has
+   * not been called, errors of this kind are fatal to the entire
+   * application: libxl will print messages to its logs and to stderr
+   * and call exit(-1).
+   *
+   * If disaster returns, it may be the case that some or all future
+   * libxl calls will return errors; likewise it may be the case that
+   * no more events (of the specified type, if applicable) can be
+   * produced.  An application which supplies a disaster function
+   * should normally react either by exiting, or by (when it has
+   * returned to its main event loop) shutting down libxl with
+   * libxl_ctx_free and perhaps trying to restart it with
+   * libxl_ctx_init.
+   *
+   * In any case before calling disaster, libxl will have logged a
+   * message with level XTL_CRITICAL.
+   *
+   * Reentrancy: it IS permitted to call libxl from within
+   * event_occurs.  It is NOT permitted to call libxl from within
+   * disaster.  The event_occurs and disaster callbacks may occur on
+   * any thread in which the application calls libxl.
+   *
+   * libxl_event_register_callbacks may be called as many times, with
+   * different parameters, as the application likes; the most recent
+   * call determines the libxl behaviour.  However it is NOT safe to
+   * call _register_callbacks concurrently with, or reentrantly from,
+   * any other libxl function.
+   *
+   * Calls to _register_callbacks do not affect events which have
+   * already occurred.
+   */
+
+
+/*
+ * Events are only generated if they have been requested.
+ * The following functions request the generation of specific events.
+ *
+ * Each set of functions for controlling event generation has this form:
+ *
+ *   typedef struct libxl__evgen_FOO libxl__evgen_FOO;
+ *   int libxl_evenable_FOO(libxl_ctx *ctx, FURTHER PARAMETERS,
+ *                          libxl_ev_user user, libxl__evgen_FOO **evgen_out);
+ *   void libxl_evdisable_FOO(libxl_ctx *ctx, libxl__evgen_FOO *evgen);
+ *
+ * The evenable function arranges that the events (as described in the
+ * doc comment for the individual function) will start to be generated
+ * by libxl.  On success, *evgen_out is set to a non-null pointer to
+ * an opaque struct.
+ *
+ * The user value is returned in the generated events and may be
+ * used by the caller for whatever it likes.  The type ev_user is
+ * guaranteed to be an unsigned integer type which is at least
+ * as big as uint64_t and is also guaranteed to be big enough to
+ * contain any intptr_t value.
+ *
+ * If it becomes desirable to stop generation of the relevant events,
+ * or to reclaim the resources in libxl associated with the evgen
+ * structure, the same evgen value should be passed to the evdisable
+ * function.  However, note that events which occurred prior to the
+ * evdisable call may still be returned.
+ *
+ * The caller may enable identical events more than once.  If they do
+ * so, each actual occurrence will generate several events to be
+ * returned by libxl_event_check, with the appropriate user value(s).
+ * Aside from this, each occurrence of each event is returned by
+ * libxl_event_check exactly once.
+ *
+ * An evgen is associated with the libxl_ctx used for its creation.
+ * After libxl_ctx_free, all corresponding evgen handles become
+ * invalid and must no longer be passed to evdisable.
+ *
+ * Events enabled with evenable prior to a fork and libxl_ctx_postfork
+ * are no longer generated after the fork/postfork; however the evgen
+ * structures are still valid and must be passed to evdisable if the
+ * memory they use should not be leaked.
+ *
+ * Applications should ensure that they eventually retrieve every
+ * event using libxl_event_check or libxl_event_wait, since events
+ * which occur but are not retreived by the application will be queued
+ * inside libxl indefinitely.  libxl_event_check/_wait may be O(n)
+ * where n is the number of queued events which do not match the
+ * criteria specified in the arguments to check/wait.
+ */
+
+typedef struct libxl__evgen_domain_death libxl_evgen_domain_death;
+int libxl_evenable_domain_death(libxl_ctx *ctx, uint32_t domid,
+                         libxl_ev_user, libxl_evgen_domain_death **evgen_out);
+void libxl_evdisable_domain_death(libxl_ctx *ctx, libxl_evgen_domain_death*);
+  /* Arranges for the generation of DOMAIN_SHUTDOWN and DOMAIN_DESTROY
+   * events.  A domain which is destroyed before it shuts down
+   * may generate only a DESTROY event.
+   */
+
+typedef struct libxl__evgen_disk_eject libxl_evgen_disk_eject;
+int libxl_evenable_disk_eject(libxl_ctx *ctx, uint32_t domid, const char *vdev,
+                        libxl_ev_user, libxl_evgen_disk_eject **evgen_out);
+void libxl_evdisable_disk_eject(libxl_ctx *ctx, libxl_evgen_disk_eject*);
+  /* Arranges for the generation of DISK_EJECT events.  A copy of the
+   * string *vdev will be made for libxl's internal use, and a pointer
+   * to this (or some other) copy will be returned as the vdev
+   * member of event.u.
+   */
+
 
 /*======================================================================*/
 
@@ -36,10 +211,10 @@
  *      poll();
  *      libxl_osevent_afterpoll(...);
  *      for (;;) {
- *        r=libxl_event_check(...);
- *        if (r==LIBXL_NOT_READY) break;
- *        if (r) handle failure;
- *        do something with the event;
+ *          r = libxl_event_check(...);
+ *          if (r==LIBXL_NOT_READY) break;
+ *          if (r) goto error_out;
+ *          do something with the event;
  *      }
  *   }
  *
diff -r db9cac5b2489 -r 4f3822ee1f43 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:21 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:22 2012 +0000
@@ -177,11 +177,45 @@
     
 libxl__ev_xswatch *libxl__watch_slot_contents(libxl__gc *gc, int slotnum);
 
+
+/*
+ * evgen structures, which are the state we use for generating
+ * events for the caller.
+ *
+ * In general in each case there's an internal and an external
+ * version of the _evdisable_FOO function; the internal one is
+ * used during cleanup.
+ */
+
+struct libxl__evgen_domain_death {
+    uint32_t domid;
+    unsigned shutdown_reported:1, death_reported:1;
+    LIBXL_TAILQ_ENTRY(libxl_evgen_domain_death) entry;
+        /* on list .death_reported ? CTX->death_list : CTX->death_reported */
+    libxl_ev_user user;
+};
+_hidden void
+libxl__evdisable_domain_death(libxl__gc*, libxl_evgen_domain_death*);
+
+struct libxl__evgen_disk_eject {
+    libxl__ev_xswatch watch;
+    uint32_t domid;
+    LIBXL_LIST_ENTRY(libxl_evgen_disk_eject) entry;
+    libxl_ev_user user;
+    char *vdev;
+};
+_hidden void
+libxl__evdisable_disk_eject(libxl__gc*, libxl_evgen_disk_eject*);
+
+
 struct libxl__ctx {
     xentoollog_logger *lg;
     xc_interface *xch;
     struct xs_handle *xsh;
 
+    const libxl_event_hooks *event_hooks;
+    void *event_hooks_user;
+
     pthread_mutex_t lock; /* protects data structures hanging off the ctx */
       /* Always use libxl__ctx_lock and _unlock (or the convenience
        * macors CTX_LOCK and CTX_UNLOCK) to manipulate this.
@@ -195,12 +229,16 @@
        * documented in the libxl public interface.
        */
 
+    LIBXL_TAILQ_HEAD(libxl__event_list, libxl_event) occurred;
+
     int osevent_in_hook;
     const libxl_osevent_hooks *osevent_hooks;
     void *osevent_user;
       /* See the comment for OSEVENT_HOOK_INTERN in libxl_event.c
        * for restrictions on the use of the osevent fields. */
 
+    struct pollfd *fd_polls;
+    int fd_polls_allocd;
     int fd_rindex_allocd;
     int *fd_rindex; /* see libxl_osevent_beforepoll */
     LIBXL_LIST_HEAD(, libxl__ev_fd) efds;
@@ -212,6 +250,13 @@
     uint32_t watch_counter; /* helps disambiguate slot reuse */
     libxl__ev_fd watch_efd;
 
+    LIBXL_TAILQ_HEAD(libxl__evgen_domain_death_list, libxl_evgen_domain_death)
+        death_list /* sorted by domid */,
+        death_reported;
+    libxl__ev_xswatch death_watch;
+    
+    LIBXL_LIST_HEAD(, libxl_evgen_disk_eject) disk_eject_evgens;
+
     /* for callers who reap children willy-nilly; caller must only
      * set this after libxl_init and before any other call - or
      * may leave them untouched */
@@ -252,6 +297,7 @@
 struct libxl__egc {
     /* for event-generating functions only */
     struct libxl__gc gc;
+    struct libxl__event_list occurred_for_callback;
 };
 
 #define LIBXL_INIT_GC(gc,ctx) do{               \
@@ -396,6 +442,9 @@
  *
  * Callers of libxl__ev_KIND_register must ensure that the
  * registration is undone, with _deregister, in libxl_ctx_free.
+ * This means that normally each kind of libxl__evgen (ie each
+ * application-requested event source) needs to be on a list so that
+ * it can be automatically deregistered as promised in libxl_event.h.
  */
 
 
@@ -439,6 +488,25 @@
 
 
 /*
+ * Other event-handling support provided by the libxl event core to
+ * the rest of libxl.
+ */
+
+_hidden void libxl__event_occurred(libxl__egc*, libxl_event *event);
+  /* Arranges to notify the application that the event has occurred.
+   * event should be suitable for passing to libxl_event_free. */
+
+_hidden libxl_event *libxl__event_new(libxl__egc*, libxl_event_type,
+                                      uint32_t domid);
+  /* Convenience function.
+   * Allocates a new libxl_event, fills in domid and type.
+   * If allocation fails, calls _disaster, and returns NULL. */
+
+#define NEW_EVENT(egc, type, domid)                              \
+    libxl__event_new((egc), LIBXL_EVENT_TYPE_##type, (domid));
+    /* Convenience macro. */
+
+/*
  * In general, call this via the macro LIBXL__EVENT_DISASTER.
  *
  * Event-generating functions may call this if they might have wanted
@@ -995,12 +1063,15 @@
 
 /* egc initialisation and destruction: */
 
-#define LIBXL_INIT_EGC(egc,ctx) do{             \
-        LIBXL_INIT_GC((egc).gc,ctx);            \
-        /* list of occurred events tbd */       \
+#define LIBXL_INIT_EGC(egc,ctx) do{                     \
+        LIBXL_INIT_GC((egc).gc,ctx);                    \
+        LIBXL_TAILQ_INIT(&(egc).occurred_for_callback); \
     } while(0)
 
 _hidden void libxl__egc_cleanup(libxl__egc *egc);
+  /* Frees memory allocated within this egc's gc, and and report all
+   * occurred events via callback, if applicable.  May reenter the
+   * application; see restrictions above. */
 
 /* convenience macros: */
 
diff -r db9cac5b2489 -r 4f3822ee1f43 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Fri Jan 27 17:01:21 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Fri Jan 27 17:01:22 2012 +0000
@@ -75,11 +75,6 @@
     (6, "COREDUMP_RESTART"),
     ])
 
-libxl_event_type = Enumeration("event_type", [
-    (1, "DOMAIN_DEATH"),
-    (2, "DISK_EJECT"),
-    ])
-
 libxl_button = Enumeration("button", [
     (1, "POWER"),
     (2, "SLEEP"),
@@ -397,3 +392,32 @@
     ("extratime", integer),
     ("weight", integer),
     ], dispose_fn=None)
+
+libxl_event_type = Enumeration("event_type", [
+    (1, "DOMAIN_SHUTDOWN"),
+    (2, "DOMAIN_DESTROY"),
+    (3, "DISK_EJECT"),
+    ])
+
+libxl_ev_user = UInt(64)
+
+libxl_ev_link = Builtin("ev_link", passby=PASS_BY_REFERENCE, private=True)
+
+libxl_event = Struct("event",[
+    ("link",     libxl_ev_link),
+     # for use by libxl; caller may use this once the event has been
+     #   returned by libxl_event_{check,wait}
+    ("domid",    libxl_domid),
+    ("domuuid",  libxl_uuid),
+    ("for_user", libxl_ev_user),
+    ("type",     libxl_event_type),
+    ("u", KeyedUnion(None, libxl_event_type, "type",
+          [("domain_shutdown", Struct(None, [
+                                             ("shutdown_reason", uint8),
+                                      ])),
+           ("domain_destroy", Struct(None, [])),
+           ("disk_eject", Struct(None, [
+                                        ("vdev", string),
+                                        ("disk", libxl_device_disk),
+                                 ])),
+           ]))])
diff -r db9cac5b2489 -r 4f3822ee1f43 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Fri Jan 27 17:01:21 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Fri Jan 27 17:01:22 2012 +0000
@@ -1226,14 +1226,16 @@
     xlu_cfg_destroy(config);
 }
 
-/* Returns 1 if domain should be restarted, 2 if domain should be renamed then restarted  */
-static int handle_domain_death(libxl_ctx *ctx, uint32_t domid, libxl_event *event,
-                               libxl_domain_config *d_config, libxl_dominfo *info)
+/* Returns 1 if domain should be restarted,
+ * 2 if domain should be renamed then restarted, or 0 */
+static int handle_domain_death(libxl_ctx *ctx, uint32_t domid,
+                               libxl_event *event,
+                               libxl_domain_config *d_config)
 {
     int restart = 0;
     libxl_action_on_shutdown action;
 
-    switch (info->shutdown_reason) {
+    switch (event->u.domain_shutdown.shutdown_reason) {
     case SHUTDOWN_poweroff:
         action = d_config->on_poweroff;
         break;
@@ -1250,11 +1252,14 @@
         action = d_config->on_watchdog;
         break;
     default:
-        LOG("Unknown shutdown reason code %d. Destroying domain.", info->shutdown_reason);
+        LOG("Unknown shutdown reason code %d. Destroying domain.",
+            event->u.domain_shutdown.shutdown_reason);
         action = LIBXL_ACTION_ON_SHUTDOWN_DESTROY;
     }
 
-    LOG("Action for shutdown reason code %d is %s", info->shutdown_reason, action_on_shutdown_names[action]);
+    LOG("Action for shutdown reason code %d is %s",
+        event->u.domain_shutdown.shutdown_reason,
+        action_on_shutdown_names[action]);
 
     if (action == LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_DESTROY || action == LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_RESTART) {
         char *corefile;
@@ -1319,7 +1324,7 @@
 
 
 static int preserve_domain(libxl_ctx *ctx, uint32_t domid, libxl_event *event,
-                           libxl_domain_config *d_config, libxl_dominfo *info)
+                           libxl_domain_config *d_config)
 {
     time_t now;
     struct tm tm;
@@ -1432,6 +1437,40 @@
     _exit(1);
 }
 
+static int domain_wait_event(libxl_event **event_r)
+{
+    int ret;
+    for (;;) {
+        ret = libxl_event_wait(ctx, event_r, LIBXL_EVENTMASK_ALL, 0,0);
+        if (ret) {
+            LOG("Domain %d, failed to get event, quitting (rc=%d)", domid, ret);
+            return ret;
+        }
+        if ((*event_r)->domid != domid) {
+            char *evstr = libxl_event_to_json(ctx, *event_r);
+            LOG("INTERNAL PROBLEM - ignoring unexpected event for"
+                " domain %d (expected %d): event=%s",
+                (*event_r)->domid, domid, evstr);
+            free(evstr);
+            libxl_event_free(ctx, *event_r);
+            continue;
+        }
+        return ret;
+    }
+}
+
+static void evdisable_disk_ejects(libxl_evgen_disk_eject **diskws,
+                                 int num_disks)
+{
+    int i;
+
+    for (i = 0; i < num_disks; i++) {
+        if (diskws[i])
+            libxl_evdisable_disk_eject(ctx, diskws[i]);
+        diskws[i] = NULL;
+    }
+}
+
 static int create_domain(struct domain_create *dom_info)
 {
     libxl_domain_config d_config;
@@ -1445,10 +1484,11 @@
     const char *restore_file = dom_info->restore_file;
     int migrate_fd = dom_info->migrate_fd;
 
-    int fd, i;
+    int i;
     int need_daemon = daemonize;
     int ret, rc;
-    libxl_waiter *w1 = NULL, *w2 = NULL;
+    libxl_evgen_domain_death *deathw = NULL;
+    libxl_evgen_disk_eject **diskws = NULL; /* one per disk */
     void *config_data = 0;
     int config_len = 0;
     int restore_fd = -1;
@@ -1661,14 +1701,14 @@
                 if (errno != EINTR) {
                     perror("failed to wait for daemonizing child");
                     ret = ERROR_FAIL;
-                    goto error_out;
+                    goto out;
                 }
             }
             if (status) {
                 libxl_report_child_exitstatus(ctx, XTL_ERROR,
                            "daemonizing child", child1, status);
                 ret = ERROR_FAIL;
-                goto error_out;
+                goto out;
             }
             ret = domid;
             goto out;
@@ -1705,92 +1745,105 @@
     }
     LOG("Waiting for domain %s (domid %d) to die [pid %ld]",
         d_config.c_info.name, domid, (long)getpid());
-    w1 = (libxl_waiter*) xmalloc(sizeof(libxl_waiter) * d_config.num_disks);
-    w2 = (libxl_waiter*) xmalloc(sizeof(libxl_waiter));
-    libxl_wait_for_disk_ejects(ctx, domid, d_config.disks, d_config.num_disks, w1);
-    libxl_wait_for_domain_death(ctx, domid, w2);
-    libxl_get_wait_fd(ctx, &fd);
+
+    ret = libxl_evenable_domain_death(ctx, domid, 0, &deathw);
+    if (ret) goto out;
+
+    if (!diskws) {
+        diskws = xmalloc(sizeof(*diskws) * d_config.num_disks);
+        for (i = 0; i < d_config.num_disks; i++)
+            diskws[i] = NULL;
+    }
+    for (i = 0; i < d_config.num_disks; i++) {
+        if (d_config.disks[i].removable) {
+            ret = libxl_evenable_disk_eject(ctx, domid, d_config.disks[i].vdev,
+                                            0, &diskws[i]);
+            if (ret) goto out;
+        }
+    }
     while (1) {
-        int ret;
-        fd_set rfds;
-        libxl_dominfo info;
-        libxl_event event;
-        libxl_device_disk disk;
-
-        FD_ZERO(&rfds);
-        FD_SET(fd, &rfds);
-
-        ret = select(fd + 1, &rfds, NULL, NULL, NULL);
-        if (!ret)
-            continue;
-        libxl_get_event(ctx, &event);
-        switch (event.type) {
-            case LIBXL_EVENT_TYPE_DOMAIN_DEATH:
-                ret = libxl_event_get_domain_death_info(ctx, domid, &event, &info);
-
-                if (ret < 0) {
-                    libxl_free_event(&event);
-                    continue;
-                }
-
-                LOG("Domain %d is dead", domid);
-
-                if (ret) {
-                    switch (handle_domain_death(ctx, domid, &event, &d_config, &info)) {
-                    case 2:
-                        if (!preserve_domain(ctx, domid, &event, &d_config, &info)) {
-                            /* If we fail then exit leaving the old domain in place. */
-                            ret = -1;
-                            goto out;
-                        }
-
-                        /* Otherwise fall through and restart. */
-                    case 1:
-
-                        for (i = 0; i < d_config.num_disks; i++)
-                            libxl_free_waiter(&w1[i]);
-                        libxl_free_waiter(w2);
-                        free(w1);
-                        free(w2);
-
-                        /*
-                         * Do not attempt to reconnect if we come round again due to a
-                         * guest reboot -- the stdin/out will be disconnected by then.
-                         */
-                        dom_info->console_autoconnect = 0;
-
-                        /* Some settings only make sense on first boot. */
-                        paused = 0;
-                        if (common_domname
-                            && strcmp(d_config.c_info.name, common_domname)) {
-                            d_config.c_info.name = strdup(common_domname);
-                        }
-
-                        /*
-                         * XXX FIXME: If this sleep is not there then domain
-                         * re-creation fails sometimes.
-                         */
-                        LOG("Done. Rebooting now");
-                        sleep(2);
-                        goto start;
-                    case 0:
-                        LOG("Done. Exiting now");
-                        ret = 0;
-                        goto out;
-                    }
-                } else {
-                    LOG("Unable to get domain death info, quitting");
+        libxl_event *event;
+        ret = domain_wait_event(&event);
+        if (ret) goto out;
+
+        switch (event->type) {
+
+        case LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN:
+            LOG("Domain %d has shut down, reason code %d 0x%x", domid,
+                event->u.domain_shutdown.shutdown_reason,
+                event->u.domain_shutdown.shutdown_reason);
+            switch (handle_domain_death(ctx, domid, event, &d_config)) {
+            case 2:
+                if (!preserve_domain(ctx, domid, event, &d_config)) {
+                    /* If we fail then exit leaving the old domain in place. */
+                    ret = -1;
                     goto out;
                 }
-                break;
-            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_dispose(&disk);
+
+                /* Otherwise fall through and restart. */
+            case 1:
+                libxl_event_free(ctx, event);
+                libxl_evdisable_domain_death(ctx, deathw);
+                deathw = NULL;
+                evdisable_disk_ejects(diskws, d_config.num_disks);
+                /* discard any other events which may have been generated */
+                while (!(ret = libxl_event_check(ctx, &event,
+                                                 LIBXL_EVENTMASK_ALL, 0,0))) {
+                    libxl_event_free(ctx, event);
                 }
-                break;
+                if (ret != ERROR_NOT_READY) {
+                    LOG("warning, libxl_event_check (cleanup) failed (rc=%d)",
+                        ret);
+                }
+
+                /*
+                 * Do not attempt to reconnect if we come round again due to a
+                 * guest reboot -- the stdin/out will be disconnected by then.
+                 */
+                dom_info->console_autoconnect = 0;
+
+                /* Some settings only make sense on first boot. */
+                paused = 0;
+                if (common_domname
+                    && strcmp(d_config.c_info.name, common_domname)) {
+                    d_config.c_info.name = strdup(common_domname);
+                }
+
+                /*
+                 * XXX FIXME: If this sleep is not there then domain
+                 * re-creation fails sometimes.
+                 */
+                LOG("Done. Rebooting now");
+                sleep(2);
+                goto start;
+
+            case 0:
+                LOG("Done. Exiting now");
+                ret = 0;
+                goto out;
+
+            default:
+                abort();
+            }
+
+        case LIBXL_EVENT_TYPE_DOMAIN_DESTROY:
+            LOG("Domain %d has been destroyed.", domid);
+            ret = 0;
+            goto out;
+
+        case LIBXL_EVENT_TYPE_DISK_EJECT:
+            /* XXX what is this for? */
+            libxl_cdrom_insert(ctx, domid, &event->u.disk_eject.disk);
+            break;
+
+        default:;
+            char *evstr = libxl_event_to_json(ctx, event);
+            LOG("warning, got unexpected event type %d, event=%s",
+                event->type, evstr);
+            free(evstr);
         }
-        libxl_free_event(&event);
+
+        libxl_event_free(ctx, event);
     }
 
 error_out:
@@ -1811,6 +1864,13 @@
             waitpid(child_console_pid, &status, 0) < 0 && errno == EINTR)
         goto waitpid_out;
 
+    if (deathw)
+        libxl_evdisable_domain_death(ctx, deathw);
+    if (diskws) {
+        evdisable_disk_ejects(diskws, d_config.num_disks);
+        free(diskws);
+    }
+
     /*
      * If we have daemonized then do not return to the caller -- this has
      * already happened in the parent.
@@ -2273,6 +2333,7 @@
 static void shutdown_domain(const char *p, int wait)
 {
     int rc;
+    libxl_event *event;
 
     find_domain(p);
     rc=libxl_domain_shutdown(ctx, domid);
@@ -2287,37 +2348,39 @@
     }
 
     if (wait) {
-        libxl_waiter waiter;
-        int fd;
-
-        libxl_wait_for_domain_death(ctx, domid, &waiter);
-
-        libxl_get_wait_fd(ctx, &fd);
-
-        while (wait) {
-            fd_set rfds;
-            libxl_event event;
-            libxl_dominfo info;
-
-            FD_ZERO(&rfds);
-            FD_SET(fd, &rfds);
-
-            if (!select(fd + 1, &rfds, NULL, NULL, NULL))
-                continue;
-
-            libxl_get_event(ctx, &event);
-
-            if (event.type == LIBXL_EVENT_TYPE_DOMAIN_DEATH) {
-                if (libxl_event_get_domain_death_info(ctx, domid, &event, &info) < 0)
-                    continue;
-
-                LOG("Domain %d is dead", domid);
-                wait = 0;
+        libxl_evgen_domain_death *deathw;
+
+        rc = libxl_evenable_domain_death(ctx, domid, 0, &deathw);
+        if (rc) {
+            fprintf(stderr,"wait for death failed (evgen, rc=%d)\n",rc);
+            exit(-1);
+        }
+
+        for (;;) {
+            rc = domain_wait_event(&event);
+            if (rc) exit(-1);
+
+            switch (event->type) {
+
+            case LIBXL_EVENT_TYPE_DOMAIN_DESTROY:
+                LOG("Domain %d has been destroyed", domid);
+                goto done;
+
+            case LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN:
+                LOG("Domain %d has been shut down, reason code %d %x", domid,
+                    event->u.domain_shutdown.shutdown_reason,
+                    event->u.domain_shutdown.shutdown_reason);
+                goto done;
+
+            default:
+                LOG("Unexpected event type %d", event->type);
+                break;
             }
-
-            libxl_free_event(&event);
+            libxl_event_free(ctx, event);
         }
-        libxl_free_waiter(&waiter);
+    done:
+        libxl_event_free(ctx, event);
+        libxl_evdisable_domain_death(ctx, deathw);
     }
 }
 
diff -r db9cac5b2489 -r 4f3822ee1f43 tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py	Fri Jan 27 17:01:21 2012 +0000
+++ b/tools/ocaml/libs/xl/genwrap.py	Fri Jan 27 17:01:22 2012 +0000
@@ -275,6 +275,7 @@
         "device_model_info",
         "vcpuinfo",
         "topologyinfo",
+        "event",
         ]
 
     for t in blacklist:

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:55:45 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:55:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6d-0006FC-1g; Fri, 03 Feb 2012 21:55:43 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6b-0006Ed-3g
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:41 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-27.messagelabs.com!1328306018!62474666!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1759 invoked from network); 3 Feb 2012 21:53:39 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:53:39 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6W-0001ho-GK
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:36 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6V-0002Do-7O
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:35 +0000
Message-Id: <E1RtR6V-0002Do-7O@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:34 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: New event generation API
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327683682 0
# Node ID 4f3822ee1f437792ff89b53cc5e2c59d98dbf337
# Parent  db9cac5b24897a5a936a516660457ace6043fc22
libxl: New event generation API

Replace the existing API for retrieving high-level events (events
about domains, etc.) from libxl with a new one.

This changes the definition and semantics of the `libxl_event'
structure, and replaces the calls for obtaining information about
domain death and disk eject events.

This is an incompatible change, sorry.  The alternative was to try to
provide both the previous horrid API and the new one, and would also
involve never using the name `libxl_event' for the new interface.

The new "libxl_event" structure is blacklisted in the ocaml bindings
for two reasons:
  - It has a field name "type" (which is a keyword in ocaml);
    the ocaml idl generator should massage this field name on
    output, to "type_" perhaps.
  - The ocaml idl generator does not support KeyedUnion.

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


diff -r db9cac5b2489 -r 4f3822ee1f43 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Jan 27 17:01:21 2012 +0000
+++ b/tools/libxl/libxl.c	Fri Jan 27 17:01:22 2012 +0000
@@ -45,8 +45,11 @@
      * only as an initialiser, not as an expression. */
     memcpy(&ctx->lock, &mutex_value, sizeof(ctx->lock));
 
+    LIBXL_TAILQ_INIT(&ctx->occurred);
+
     ctx->osevent_hooks = 0;
 
+    ctx->fd_polls = 0;
     ctx->fd_rindex = 0;
     LIBXL_LIST_INIT(&ctx->efds);
     LIBXL_TAILQ_INIT(&ctx->etimes);
@@ -55,6 +58,9 @@
     LIBXL_SLIST_INIT(&ctx->watch_freeslots);
     libxl__ev_fd_init(&ctx->watch_efd);
 
+    LIBXL_TAILQ_INIT(&ctx->death_list);
+    libxl__ev_xswatch_init(&ctx->death_watch);
+
     if ( stat(XENSTORE_PID_FILE, &stat_buf) != 0 ) {
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Is xenstore daemon running?\n"
                      "failed to stat %s", XENSTORE_PID_FILE);
@@ -86,6 +92,20 @@
     return rc;
 }
 
+static void free_disable_deaths(libxl__gc *gc,
+                                struct libxl__evgen_domain_death_list *l) {
+    libxl_evgen_domain_death *death;
+    while ((death = LIBXL_TAILQ_FIRST(l)))
+        libxl__evdisable_domain_death(gc, death);
+}
+
+static void discard_events(struct libxl__event_list *l) {
+    /* doesn't bother unlinking from the list, so l is corrupt on return */
+    libxl_event *ev;
+    LIBXL_TAILQ_FOREACH(ev, l, link)
+        libxl_event_free(0, ev);
+}
+
 int libxl_ctx_free(libxl_ctx *ctx)
 {
     if (!ctx) return 0;
@@ -95,6 +115,13 @@
 
     /* Deregister all libxl__ev_KINDs: */
 
+    free_disable_deaths(gc, &CTX->death_list);
+    free_disable_deaths(gc, &CTX->death_reported);
+
+    libxl_evgen_disk_eject *eject;
+    while ((eject = LIBXL_LIST_FIRST(&CTX->disk_eject_evgens)))
+        libxl__evdisable_disk_eject(gc, eject);
+
     for (i = 0; i < ctx->watch_nslots; i++)
         assert(!libxl__watch_slot_contents(gc, i));
     libxl__ev_fd_deregister(gc, &ctx->watch_efd);
@@ -108,9 +135,12 @@
     libxl_version_info_dispose(&ctx->version_info);
     if (ctx->xsh) xs_daemon_close(ctx->xsh);
 
+    free(ctx->fd_polls);
     free(ctx->fd_rindex);
     free(ctx->watch_slots);
 
+    discard_events(&ctx->occurred);
+
     GC_FREE;
     free(ctx);
     return 0;
@@ -646,117 +676,177 @@
     return ret;
 }
 
-int libxl_get_wait_fd(libxl_ctx *ctx, int *fd)
-{
-    *fd = xs_fileno(ctx->xsh);
-    return 0;
+static void domain_death_xswatch_callback(libxl__egc *egc, libxl__ev_xswatch *w,
+                                        const char *wpath, const char *epath) {
+    EGC_GC;
+    libxl_evgen_domain_death *evg;
+    uint32_t domid;
+    int rc;
+
+    CTX_LOCK;
+
+    evg = LIBXL_TAILQ_FIRST(&CTX->death_list);
+    if (!evg) goto out;
+
+    domid = evg->domid;
+
+    for (;;) {
+        int nentries = LIBXL_TAILQ_NEXT(evg, entry) ? 200 : 1;
+        xc_domaininfo_t domaininfos[nentries];
+        const xc_domaininfo_t *got = domaininfos, *gotend;
+
+        rc = xc_domain_getinfolist(CTX->xch, domid, nentries, domaininfos);
+        if (rc == -1) {
+            LIBXL__EVENT_DISASTER(egc, "xc_domain_getinfolist failed while"
+                                  " processing @releaseDomain watch event",
+                                  errno, 0);
+            goto out;
+        }
+        gotend = &domaininfos[rc];
+
+        for (;;) {
+            if (!evg)
+                goto all_reported;
+
+            if (!rc || got->domain > evg->domid) {
+                /* ie, the list doesn't contain evg->domid any more so
+                 * the domain has been destroyed */
+                libxl_evgen_domain_death *evg_next;
+
+                libxl_event *ev = NEW_EVENT(egc, DOMAIN_DESTROY, evg->domid);
+                if (!ev) goto out;
+
+                libxl__event_occurred(egc, ev);
+
+                evg->death_reported = 1;
+                evg_next = LIBXL_TAILQ_NEXT(evg, entry);
+                LIBXL_TAILQ_REMOVE(&CTX->death_list, evg, entry);
+                LIBXL_TAILQ_INSERT_HEAD(&CTX->death_reported, evg, entry);
+                evg = evg_next;
+
+                continue;
+            }
+            
+            if (got == gotend)
+                break;
+
+            if (got->domain < evg->domid) {
+                got++;
+                continue;
+            }
+
+            assert(evg->domid == got->domain);
+
+            if (!evg->shutdown_reported &&
+                (got->flags & XEN_DOMINF_shutdown)) {
+                libxl_event *ev = NEW_EVENT(egc, DOMAIN_SHUTDOWN, got->domain);
+                if (!ev) goto out;
+                
+                ev->u.domain_shutdown.shutdown_reason =
+                    (got->flags >> XEN_DOMINF_shutdownshift) &
+                    XEN_DOMINF_shutdownmask;
+                libxl__event_occurred(egc, ev);
+
+                evg->shutdown_reported = 1;
+            }
+            evg = LIBXL_TAILQ_NEXT(evg, entry);
+        }
+
+        assert(rc); /* rc==0 results in us eating all evgs and quitting */
+        domid = gotend[-1].domain;
+    }
+ all_reported:
+ out:
+
+    CTX_UNLOCK;
 }
 
-int libxl_wait_for_domain_death(libxl_ctx *ctx, uint32_t domid, libxl_waiter *waiter)
-{
-    waiter->path = strdup("@releaseDomain");
-    if (asprintf(&(waiter->token), "%d", LIBXL_EVENT_TYPE_DOMAIN_DEATH) < 0)
-        return -1;
-    if (!xs_watch(ctx->xsh, waiter->path, waiter->token))
-        return -1;
-    return 0;
-}
-
-int libxl_wait_for_disk_ejects(libxl_ctx *ctx, uint32_t guest_domid, libxl_device_disk *disks, int num_disks, libxl_waiter *waiter)
-{
+int libxl_evenable_domain_death(libxl_ctx *ctx, uint32_t domid,
+                libxl_ev_user user, libxl_evgen_domain_death **evgen_out) {
     GC_INIT(ctx);
-    int i, rc = -1;
-    uint32_t domid = libxl_get_stubdom_id(ctx, guest_domid);
-
-    if (!domid)
-        domid = guest_domid;
-
-    for (i = 0; i < num_disks; i++) {
-        if (asprintf(&(waiter[i].path), "%s/device/vbd/%d/eject",
-                     libxl__xs_get_dompath(gc, domid),
-                     libxl__device_disk_dev_number(disks[i].vdev,
-                                                   NULL, NULL)) < 0)
-            goto out;
-        if (asprintf(&(waiter[i].token), "%d", LIBXL_EVENT_TYPE_DISK_EJECT) < 0)
-            goto out;
-        xs_watch(ctx->xsh, waiter[i].path, waiter[i].token);
+    libxl_evgen_domain_death *evg, *evg_search;
+    int rc;
+    
+    CTX_LOCK;
+
+    evg = malloc(sizeof(*evg));  if (!evg) { rc = ERROR_NOMEM; goto out; }
+    memset(evg, 0, sizeof(*evg));
+    evg->domid = domid;
+    evg->user = user;
+
+    LIBXL_TAILQ_INSERT_SORTED(&ctx->death_list, entry, evg, evg_search, ,
+                              evg->domid > evg_search->domid);
+
+    if (!libxl__ev_xswatch_isregistered(&ctx->death_watch)) {
+        rc = libxl__ev_xswatch_register(gc, &ctx->death_watch,
+                        domain_death_xswatch_callback, "@releaseDomain");
+        if (rc) { libxl__evdisable_domain_death(gc, evg); goto out; }
     }
+
+    *evgen_out = evg;
     rc = 0;
-out:
+
+ out:
+    CTX_UNLOCK;
     GC_FREE;
     return rc;
+};
+
+void libxl__evdisable_domain_death(libxl__gc *gc,
+                                   libxl_evgen_domain_death *evg) {
+    CTX_LOCK;
+
+    if (!evg->death_reported)
+        LIBXL_TAILQ_REMOVE(&CTX->death_list, evg, entry);
+    else
+        LIBXL_TAILQ_REMOVE(&CTX->death_reported, evg, entry);
+
+    free(evg);
+
+    if (!LIBXL_TAILQ_FIRST(&CTX->death_list) &&
+        libxl__ev_xswatch_isregistered(&CTX->death_watch))
+        libxl__ev_xswatch_deregister(gc, &CTX->death_watch);
+
+    CTX_UNLOCK;
 }
 
-int libxl_get_event(libxl_ctx *ctx, libxl_event *event)
-{
-    unsigned int num;
-    char **events = xs_read_watch(ctx->xsh, &num);
-    if (num != 2) {
-        free(events);
-        return ERROR_FAIL;
-    }
-    event->path = strdup(events[XS_WATCH_PATH]);
-    event->token = strdup(events[XS_WATCH_TOKEN]);
-    event->type = atoi(event->token);
-    free(events);
-    return 0;
+void libxl_evdisable_domain_death(libxl_ctx *ctx,
+                                  libxl_evgen_domain_death *evg) {
+    GC_INIT(ctx);
+    libxl__evdisable_domain_death(gc, evg);
+    GC_FREE;
 }
 
-int libxl_stop_waiting(libxl_ctx *ctx, libxl_waiter *waiter)
-{
-    if (!xs_unwatch(ctx->xsh, waiter->path, waiter->token))
-        return ERROR_FAIL;
-    else
-        return 0;
-}
-
-int libxl_free_event(libxl_event *event)
-{
-    free(event->path);
-    free(event->token);
-    return 0;
-}
-
-int libxl_free_waiter(libxl_waiter *waiter)
-{
-    free(waiter->path);
-    free(waiter->token);
-    return 0;
-}
-
-int libxl_event_get_domain_death_info(libxl_ctx *ctx, uint32_t domid, libxl_event *event, libxl_dominfo *info)
-{
-    if (libxl_domain_info(ctx, info, domid) < 0)
-        return 0;
-
-    if (info->running || (!info->shutdown && !info->dying))
-        return ERROR_INVAL;
-
-    return 1;
-}
-
-int libxl_event_get_disk_eject_info(libxl_ctx *ctx, uint32_t domid, libxl_event *event, libxl_device_disk *disk)
-{
-    GC_INIT(ctx);
-    char *path;
+static void disk_eject_xswatch_callback(libxl__egc *egc, libxl__ev_xswatch *w,
+                                        const char *wpath, const char *epath) {
+    EGC_GC;
+    libxl_evgen_disk_eject *evg = (void*)w;
     char *backend;
     char *value;
     char backend_type[BACKEND_STRING_SIZE+1];
 
-    value = libxl__xs_read(gc, XBT_NULL, event->path);
-
-    if (!value || strcmp(value,  "eject")) {
-        GC_FREE;
-        return 0;
+    value = libxl__xs_read(gc, XBT_NULL, wpath);
+
+    if (!value || strcmp(value,  "eject"))
+        return;
+
+    if (libxl__xs_write(gc, XBT_NULL, wpath, "")) {
+        LIBXL__EVENT_DISASTER(egc, "xs_write failed acknowledging eject",
+                              errno, LIBXL_EVENT_TYPE_DISK_EJECT);
+        return;
     }
 
-    path = strdup(event->path);
-    path[strlen(path) - 6] = '\0';
-    backend = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/backend", path));
+    libxl_event *ev = NEW_EVENT(egc, DISK_EJECT, evg->domid);
+    libxl_device_disk *disk = &ev->u.disk_eject.disk;
+    
+    backend = libxl__xs_read(gc, XBT_NULL,
+                             libxl__sprintf(gc, "%.*s/backend",
+                                            (int)strlen(wpath)-6, wpath));
 
     sscanf(backend,
-            "/local/domain/%d/backend/%" TOSTRING(BACKEND_STRING_SIZE) "[a-z]/%*d/%*d",
-            &disk->backend_domid, backend_type);
+            "/local/domain/%d/backend/%" TOSTRING(BACKEND_STRING_SIZE)
+           "[a-z]/%*d/%*d",
+           &disk->backend_domid, backend_type);
     if (!strcmp(backend_type, "tap") || !strcmp(backend_type, "vbd")) {
         disk->backend = LIBXL_DISK_BACKEND_TAP;
     } else if (!strcmp(backend_type, "qdisk")) {
@@ -765,19 +855,83 @@
         disk->backend = LIBXL_DISK_BACKEND_UNKNOWN;
     }
 
-    disk->pdev_path = strdup("");
+    disk->pdev_path = strdup(""); /* xxx fixme malloc failure */
     disk->format = LIBXL_DISK_FORMAT_EMPTY;
     /* this value is returned to the user: do not free right away */
-    disk->vdev = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(gc, "%s/dev", backend), NULL);
+    disk->vdev = xs_read(CTX->xsh, XBT_NULL,
+                         libxl__sprintf(gc, "%s/dev", backend), NULL);
     disk->removable = 1;
     disk->readwrite = 0;
     disk->is_cdrom = 1;
 
-    free(path);
+    libxl__event_occurred(egc, ev);
+}
+
+int libxl_evenable_disk_eject(libxl_ctx *ctx, uint32_t guest_domid,
+                              const char *vdev, libxl_ev_user user,
+                              libxl_evgen_disk_eject **evgen_out) {
+    GC_INIT(ctx);
+    CTX_LOCK;
+    int rc;
+    char *path;
+    libxl_evgen_disk_eject *evg = NULL;
+
+    evg = malloc(sizeof(*evg));  if (!evg) { rc = ERROR_NOMEM; goto out; }
+    memset(evg, 0, sizeof(*evg));
+    evg->user = user;
+    evg->domid = guest_domid;
+    LIBXL_LIST_INSERT_HEAD(&CTX->disk_eject_evgens, evg, entry);
+
+    evg->vdev = strdup(vdev);
+    if (!evg->vdev) { rc = ERROR_NOMEM; goto out; }
+
+    uint32_t domid = libxl_get_stubdom_id(ctx, guest_domid);
+
+    if (!domid)
+        domid = guest_domid;
+
+    path = libxl__sprintf(gc, "%s/device/vbd/%d/eject",
+                 libxl__xs_get_dompath(gc, domid),
+                 libxl__device_disk_dev_number(vdev, NULL, NULL));
+    if (!path) { rc = ERROR_NOMEM; goto out; }
+
+    rc = libxl__ev_xswatch_register(gc, &evg->watch,
+                                    disk_eject_xswatch_callback, path);
+    if (rc) goto out;
+
+    *evgen_out = evg;
+    CTX_UNLOCK;
     GC_FREE;
-    return 1;
+    return 0;
+
+ out:
+    if (evg)
+        libxl__evdisable_disk_eject(gc, evg);
+    CTX_UNLOCK;
+    GC_FREE;
+    return rc;
 }
 
+void libxl__evdisable_disk_eject(libxl__gc *gc, libxl_evgen_disk_eject *evg) {
+    CTX_LOCK;
+
+    LIBXL_LIST_REMOVE(evg, entry);
+
+    if (libxl__ev_xswatch_isregistered(&evg->watch))
+        libxl__ev_xswatch_deregister(gc, &evg->watch);
+
+    free(evg->vdev);
+    free(evg);
+
+    CTX_UNLOCK;
+}
+
+void libxl_evdisable_disk_eject(libxl_ctx *ctx, libxl_evgen_disk_eject *evg) {
+    GC_INIT(ctx);
+    libxl__evdisable_disk_eject(gc, evg);
+    GC_FREE;
+}    
+
 int libxl_domain_destroy(libxl_ctx *ctx, uint32_t domid)
 {
     GC_INIT(ctx);
diff -r db9cac5b2489 -r 4f3822ee1f43 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Fri Jan 27 17:01:21 2012 +0000
+++ b/tools/libxl/libxl.h	Fri Jan 27 17:01:22 2012 +0000
@@ -53,7 +53,10 @@
  *    A public function may be called from within libxl; the call
  *    context initialisation macros will make sure that the internal
  *    caller's context is reused (eg, so that the same xenstore
- *    transaction is used).
+ *    transaction is used).  But in-libxl callers of libxl public
+ *    functions should note that any libxl public function may cause
+ *    recursively reentry into libxl via the application's event
+ *    callback hook.
  *
  *    Public functions have names like libxl_foobar.
  *
@@ -152,6 +155,8 @@
 
 typedef uint32_t libxl_hwcap[8];
 
+typedef uint64_t libxl_ev_user;
+
 typedef struct {
     uint32_t size;          /* number of bytes in map */
     uint8_t *map;
@@ -200,6 +205,9 @@
     int v;
 } libxl_enum_string_table;
 
+struct libxl_event;
+typedef LIBXL_TAILQ_ENTRY(struct libxl_event) libxl_ev_link;
+
 typedef struct libxl__ctx libxl_ctx;
 
 #include "_libxl_types.h"
@@ -300,51 +308,6 @@
 
   /* 0 means ERROR_ENOMEM, which we have logged */
 
-/* events handling */
-
-typedef struct {
-    /* event type */
-    libxl_event_type type;
-    /* data for internal use of the library */
-    char *path;
-    char *token;
-} libxl_event;
-
-typedef struct {
-    char *path;
-    char *token;
-} libxl_waiter;
-
-
-int libxl_get_wait_fd(libxl_ctx *ctx, int *fd);
-/* waiter is allocated by the caller */
-int libxl_wait_for_domain_death(libxl_ctx *ctx, uint32_t domid, libxl_waiter *waiter);
-/* waiter is a preallocated array of num_disks libxl_waiter elements */
-int libxl_wait_for_disk_ejects(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disks, int num_disks, libxl_waiter *waiter);
-int libxl_get_event(libxl_ctx *ctx, libxl_event *event);
-int libxl_stop_waiting(libxl_ctx *ctx, libxl_waiter *waiter);
-int libxl_free_event(libxl_event *event);
-int libxl_free_waiter(libxl_waiter *waiter);
-
-/*
- * Returns:
- *  - 0 if the domain is dead but there is no cleanup to be done. e.g
- *    because someone else has already done it.
- *  - 1 if the domain is dead and there is cleanup to be done.
- *
- * Can return error if the domain exists and is still running.
- *
- * *info will contain valid domain state iff 1 is returned. In
- * particular if 1 is returned then info->shutdown_reason is
- * guaranteed to be valid since by definition the domain is
- * (shutdown||dying))
- */
-int libxl_event_get_domain_death_info(libxl_ctx *ctx, uint32_t domid, libxl_event *event, libxl_dominfo *info);
-
-/*
- * Returns true and fills *disk if the caller should eject the disk
- */
-int libxl_event_get_disk_eject_info(libxl_ctx *ctx, uint32_t domid, libxl_event *event, libxl_device_disk *disk);
 
 int libxl_domain_rename(libxl_ctx *ctx, uint32_t domid,
                         const char *old_name, const char *new_name);
diff -r db9cac5b2489 -r 4f3822ee1f43 tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c	Fri Jan 27 17:01:21 2012 +0000
+++ b/tools/libxl/libxl_event.c	Fri Jan 27 17:01:22 2012 +0000
@@ -510,9 +510,9 @@
  * osevent poll
  */
 
-int libxl_osevent_beforepoll(libxl_ctx *ctx, int *nfds_io,
-                             struct pollfd *fds, int *timeout_upd,
-                             struct timeval now)
+static int beforepoll_internal(libxl__gc *gc, int *nfds_io,
+                               struct pollfd *fds, int *timeout_upd,
+                               struct timeval now)
 {
     libxl__ev_fd *efd;
     int rc;
@@ -524,9 +524,6 @@
      * the fds array corresponds to a slot in fd_beforepolled.
      */
 
-    GC_INIT(ctx);
-    CTX_LOCK;
-
     if (*nfds_io) {
         /*
          * As an optimisation, we don't touch fd_rindex
@@ -593,8 +590,18 @@
     }
 
  out:
+    return rc;
+}
+
+int libxl_osevent_beforepoll(libxl_ctx *ctx, int *nfds_io,
+                             struct pollfd *fds, int *timeout_upd,
+                             struct timeval now)
+{
+    EGC_INIT(ctx);
+    CTX_LOCK;
+    int rc = beforepoll_internal(gc, nfds_io, fds, timeout_upd, now);
     CTX_UNLOCK;
-    GC_FREE;
+    EGC_FREE;
     return rc;
 }
 
@@ -623,11 +630,11 @@
     return revents;
 }
 
-void libxl_osevent_afterpoll(libxl_ctx *ctx, int nfds, const struct pollfd *fds,
-                             struct timeval now)
+static void afterpoll_internal(libxl__egc *egc,
+                               int nfds, const struct pollfd *fds,
+                               struct timeval now)
 {
-    EGC_INIT(ctx);
-    CTX_LOCK;
+    EGC_GC;
     libxl__ev_fd *efd;
 
     LIBXL_LIST_FOREACH(efd, &CTX->efds, entry) {
@@ -653,12 +660,18 @@
 
         etime->func(egc, etime, &etime->abs);
     }
+}
 
+void libxl_osevent_afterpoll(libxl_ctx *ctx, int nfds, const struct pollfd *fds,
+                             struct timeval now)
+{
+    EGC_INIT(ctx);
+    CTX_LOCK;
+    afterpoll_internal(egc, nfds, fds, now);
     CTX_UNLOCK;
     EGC_FREE;
 }
 
-
 /*
  * osevent hook and callback machinery
  */
@@ -723,11 +736,10 @@
                type ? libxl_event_type_to_string(type) : "",
                type ? ")" : "");
 
-    /*
-     * FIXME: This should call the "disaster" hook supplied to
-     * libxl_event_register_callbacks, which will be introduced in the
-     * next patch.
-     */
+    if (CTX->event_hooks && CTX->event_hooks->disaster) {
+        CTX->event_hooks->disaster(CTX->event_hooks_user, type, msg, errnoval);
+        return;
+    }
 
     const char verybad[] =
         "DISASTER in event loop not handled by libxl application";
@@ -736,9 +748,197 @@
     exit(-1);
 }
 
+static void egc_run_callbacks(libxl__egc *egc)
+{
+    EGC_GC;
+    libxl_event *ev, *ev_tmp;
+    LIBXL_TAILQ_FOREACH_SAFE(ev, &egc->occurred_for_callback, link, ev_tmp) {
+        LIBXL_TAILQ_REMOVE(&egc->occurred_for_callback, ev, link);
+        CTX->event_hooks->event_occurs(CTX->event_hooks_user, ev);
+    }
+}
+
 void libxl__egc_cleanup(libxl__egc *egc)
 {
-    libxl__free_all(&egc->gc);
+    EGC_GC;
+    libxl__free_all(gc);
+
+    egc_run_callbacks(egc);
+}
+
+/*
+ * Event retrieval etc.
+ */
+
+void libxl_event_register_callbacks(libxl_ctx *ctx,
+                  const libxl_event_hooks *hooks, void *user)
+{
+    ctx->event_hooks = hooks;
+    ctx->event_hooks_user = user;
+}
+
+void libxl__event_occurred(libxl__egc *egc, libxl_event *event)
+{
+    EGC_GC;
+
+    if (CTX->event_hooks &&
+        (CTX->event_hooks->event_occurs_mask & (1UL << event->type))) {
+        /* libxl__egc_cleanup will call the callback, just before exit
+         * from libxl.  This helps avoid reentrancy bugs: parts of
+         * libxl that call libxl__event_occurred do not have to worry
+         * that libxl might be reentered at that point. */
+        LIBXL_TAILQ_INSERT_TAIL(&egc->occurred_for_callback, event, link);
+        return;
+    } else {
+        LIBXL_TAILQ_INSERT_TAIL(&CTX->occurred, event, link);
+    }
+}
+
+void libxl_event_free(libxl_ctx *ctx, libxl_event *event)
+{
+    /* Exceptionally, this function may be called from libxl, with ctx==0 */
+    libxl_event_dispose(event);
+    free(event);
+}
+
+libxl_event *libxl__event_new(libxl__egc *egc,
+                              libxl_event_type type, uint32_t domid)
+{
+    libxl_event *ev;
+
+    ev = malloc(sizeof(*ev));
+    if (!ev) {
+        LIBXL__EVENT_DISASTER(egc, "allocate new event", errno, type);
+        return NULL;
+    }
+
+    memset(ev, 0, sizeof(*ev));
+    ev->type = type;
+    ev->domid = domid;
+
+    return ev;
+}
+
+static int event_check_internal(libxl__egc *egc, libxl_event **event_r,
+                                unsigned long typemask,
+                                libxl_event_predicate *pred, void *pred_user)
+{
+    EGC_GC;
+    libxl_event *ev;
+    int rc;
+
+    LIBXL_TAILQ_FOREACH(ev, &CTX->occurred, link) {
+        if (!(typemask & ((uint64_t)1 << ev->type)))
+            continue;
+
+        if (pred && !pred(ev, pred_user))
+            continue;
+
+        /* got one! */
+        LIBXL_TAILQ_REMOVE(&CTX->occurred, ev, link);
+        *event_r = ev;
+        rc = 0;
+        goto out;
+    }
+    rc = ERROR_NOT_READY;
+
+ out:
+    return rc;
+}
+
+int libxl_event_check(libxl_ctx *ctx, libxl_event **event_r,
+                      uint64_t typemask,
+                      libxl_event_predicate *pred, void *pred_user)
+{
+    EGC_INIT(ctx);
+    CTX_LOCK;
+    int rc = event_check_internal(egc, event_r, typemask, pred, pred_user);
+    CTX_UNLOCK;
+    EGC_FREE;
+    return rc;
+}
+
+static int eventloop_iteration(libxl__egc *egc) {
+    EGC_GC;
+    int rc;
+    struct timeval now;
+    
+    CTX_LOCK;
+
+    rc = libxl__gettimeofday(gc, &now);
+    if (rc) goto out;
+
+    int timeout;
+
+    for (;;) {
+        int nfds = CTX->fd_polls_allocd;
+        timeout = -1;
+        rc = beforepoll_internal(gc, &nfds, CTX->fd_polls, &timeout, now);
+        if (!rc) break;
+        if (rc != ERROR_BUFFERFULL) goto out;
+
+        struct pollfd *newarray =
+            (nfds > INT_MAX / sizeof(struct pollfd) / 2) ? 0 :
+            realloc(CTX->fd_polls, sizeof(*newarray) * nfds);
+
+        if (!newarray) { rc = ERROR_NOMEM; goto out; }
+
+        CTX->fd_polls = newarray;
+        CTX->fd_polls_allocd = nfds;
+    }
+
+    rc = poll(CTX->fd_polls, CTX->fd_polls_allocd, timeout);
+    if (rc < 0) {
+        if (errno == EINTR)
+            return 0; /* will go round again if caller requires */
+
+        LIBXL__LOG_ERRNOVAL(CTX, LIBXL__LOG_ERROR, errno, "poll failed");
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
+    rc = libxl__gettimeofday(gc, &now);
+    if (rc) goto out;
+
+    afterpoll_internal(egc, CTX->fd_polls_allocd, CTX->fd_polls, now);
+
+    CTX_UNLOCK;
+
+    rc = 0;
+ out:
+    return rc;
+}
+
+int libxl_event_wait(libxl_ctx *ctx, libxl_event **event_r,
+                     uint64_t typemask,
+                     libxl_event_predicate *pred, void *pred_user)
+{
+    int rc;
+
+    EGC_INIT(ctx);
+    CTX_LOCK;
+
+    for (;;) {
+        rc = event_check_internal(egc, event_r, typemask, pred, pred_user);
+        if (rc != ERROR_NOT_READY) goto out;
+
+        rc = eventloop_iteration(egc);
+        if (rc) goto out;
+
+        /* we unlock and cleanup the egc each time we go through this loop,
+         * so that (a) we don't accumulate garbage and (b) any events
+         * which are to be dispatched by callback are actually delivered
+         * in a timely fashion.
+         */
+        CTX_UNLOCK;
+        libxl__egc_cleanup(egc);
+        CTX_LOCK;
+    }
+
+ out:
+    CTX_UNLOCK;
+    EGC_FREE;
+    return rc;
 }
 
 /*
diff -r db9cac5b2489 -r 4f3822ee1f43 tools/libxl/libxl_event.h
--- a/tools/libxl/libxl_event.h	Fri Jan 27 17:01:21 2012 +0000
+++ b/tools/libxl/libxl_event.h	Fri Jan 27 17:01:22 2012 +0000
@@ -18,6 +18,181 @@
 
 #include <libxl.h>
 
+/*======================================================================*/
+
+/*
+ * Domain event handling - getting Xen events from libxl
+ *
+ * (Callers inside libxl may not call libxl_event_check or _wait.)
+ */
+
+#define LIBXL_EVENTMASK_ALL (~(unsigned long)0)
+
+typedef int libxl_event_predicate(const libxl_event*, void *user);
+  /* Return value is 0 if the event is unwanted or non-0 if it is.
+   * Predicates are not allowed to fail.
+   */
+
+int libxl_event_check(libxl_ctx *ctx, libxl_event **event_r,
+                      uint64_t typemask,
+                      libxl_event_predicate *predicate, void *predicate_user);
+  /* Searches for an event, already-happened, which matches typemask
+   * and predicate.  predicate==0 matches any event.
+   * libxl_event_check returns the event, which must then later be
+   * freed by the caller using libxl_event_free.
+   *
+   * Returns ERROR_NOT_READY if no such event has happened.
+   */
+
+int libxl_event_wait(libxl_ctx *ctx, libxl_event **event_r,
+                     uint64_t typemask,
+                     libxl_event_predicate *predicate, void *predicate_user);
+  /* Like libxl_event_check but blocks if no suitable events are
+   * available, until some are.  Uses libxl_osevent_beforepoll/
+   * _afterpoll so may be inefficient if very many domains are being
+   * handled by a single program.
+   */
+
+void libxl_event_free(libxl_ctx *ctx, libxl_event *event);
+
+
+/* Alternatively or additionally, the application may also use this: */
+
+typedef struct libxl_event_hooks {
+    uint64_t event_occurs_mask;
+    void (*event_occurs)(void *user, const libxl_event *event);
+    void (*disaster)(void *user, libxl_event_type type,
+                     const char *msg, int errnoval);
+} libxl_event_hooks;
+
+void libxl_event_register_callbacks(libxl_ctx *ctx,
+                                    const libxl_event_hooks *hooks, void *user);
+  /*
+   * Arranges that libxl will henceforth call event_occurs for any
+   * events whose type is set in event_occurs_mask, rather than
+   * queueing the event for retrieval by libxl_event_check/wait.
+   * Events whose bit is clear in mask are not affected.
+   *
+   * event becomes owned by the application and must be freed, either
+   * by event_occurs or later.
+   *
+   * event_occurs may be NULL if mask is 0.
+   *
+   * libxl_event_register_callback also provides a way for libxl to
+   * report to the application that there was a problem reporting
+   * events; this can occur due to lack of host memory during event
+   * handling, or other wholly unrecoverable errors from system calls
+   * made by libxl.  This will not happen for frivolous reasons - only
+   * if the system, or the Xen components of it, are badly broken.
+   *
+   * msg and errnoval will describe the action that libxl was trying
+   * to do, and type specifies the type of libxl events which may be
+   * missing.  type may be 0 in which case events of all types may be
+   * missing.
+   *
+   * disaster may be NULL.  If it is, or if _register_callbacks has
+   * not been called, errors of this kind are fatal to the entire
+   * application: libxl will print messages to its logs and to stderr
+   * and call exit(-1).
+   *
+   * If disaster returns, it may be the case that some or all future
+   * libxl calls will return errors; likewise it may be the case that
+   * no more events (of the specified type, if applicable) can be
+   * produced.  An application which supplies a disaster function
+   * should normally react either by exiting, or by (when it has
+   * returned to its main event loop) shutting down libxl with
+   * libxl_ctx_free and perhaps trying to restart it with
+   * libxl_ctx_init.
+   *
+   * In any case before calling disaster, libxl will have logged a
+   * message with level XTL_CRITICAL.
+   *
+   * Reentrancy: it IS permitted to call libxl from within
+   * event_occurs.  It is NOT permitted to call libxl from within
+   * disaster.  The event_occurs and disaster callbacks may occur on
+   * any thread in which the application calls libxl.
+   *
+   * libxl_event_register_callbacks may be called as many times, with
+   * different parameters, as the application likes; the most recent
+   * call determines the libxl behaviour.  However it is NOT safe to
+   * call _register_callbacks concurrently with, or reentrantly from,
+   * any other libxl function.
+   *
+   * Calls to _register_callbacks do not affect events which have
+   * already occurred.
+   */
+
+
+/*
+ * Events are only generated if they have been requested.
+ * The following functions request the generation of specific events.
+ *
+ * Each set of functions for controlling event generation has this form:
+ *
+ *   typedef struct libxl__evgen_FOO libxl__evgen_FOO;
+ *   int libxl_evenable_FOO(libxl_ctx *ctx, FURTHER PARAMETERS,
+ *                          libxl_ev_user user, libxl__evgen_FOO **evgen_out);
+ *   void libxl_evdisable_FOO(libxl_ctx *ctx, libxl__evgen_FOO *evgen);
+ *
+ * The evenable function arranges that the events (as described in the
+ * doc comment for the individual function) will start to be generated
+ * by libxl.  On success, *evgen_out is set to a non-null pointer to
+ * an opaque struct.
+ *
+ * The user value is returned in the generated events and may be
+ * used by the caller for whatever it likes.  The type ev_user is
+ * guaranteed to be an unsigned integer type which is at least
+ * as big as uint64_t and is also guaranteed to be big enough to
+ * contain any intptr_t value.
+ *
+ * If it becomes desirable to stop generation of the relevant events,
+ * or to reclaim the resources in libxl associated with the evgen
+ * structure, the same evgen value should be passed to the evdisable
+ * function.  However, note that events which occurred prior to the
+ * evdisable call may still be returned.
+ *
+ * The caller may enable identical events more than once.  If they do
+ * so, each actual occurrence will generate several events to be
+ * returned by libxl_event_check, with the appropriate user value(s).
+ * Aside from this, each occurrence of each event is returned by
+ * libxl_event_check exactly once.
+ *
+ * An evgen is associated with the libxl_ctx used for its creation.
+ * After libxl_ctx_free, all corresponding evgen handles become
+ * invalid and must no longer be passed to evdisable.
+ *
+ * Events enabled with evenable prior to a fork and libxl_ctx_postfork
+ * are no longer generated after the fork/postfork; however the evgen
+ * structures are still valid and must be passed to evdisable if the
+ * memory they use should not be leaked.
+ *
+ * Applications should ensure that they eventually retrieve every
+ * event using libxl_event_check or libxl_event_wait, since events
+ * which occur but are not retreived by the application will be queued
+ * inside libxl indefinitely.  libxl_event_check/_wait may be O(n)
+ * where n is the number of queued events which do not match the
+ * criteria specified in the arguments to check/wait.
+ */
+
+typedef struct libxl__evgen_domain_death libxl_evgen_domain_death;
+int libxl_evenable_domain_death(libxl_ctx *ctx, uint32_t domid,
+                         libxl_ev_user, libxl_evgen_domain_death **evgen_out);
+void libxl_evdisable_domain_death(libxl_ctx *ctx, libxl_evgen_domain_death*);
+  /* Arranges for the generation of DOMAIN_SHUTDOWN and DOMAIN_DESTROY
+   * events.  A domain which is destroyed before it shuts down
+   * may generate only a DESTROY event.
+   */
+
+typedef struct libxl__evgen_disk_eject libxl_evgen_disk_eject;
+int libxl_evenable_disk_eject(libxl_ctx *ctx, uint32_t domid, const char *vdev,
+                        libxl_ev_user, libxl_evgen_disk_eject **evgen_out);
+void libxl_evdisable_disk_eject(libxl_ctx *ctx, libxl_evgen_disk_eject*);
+  /* Arranges for the generation of DISK_EJECT events.  A copy of the
+   * string *vdev will be made for libxl's internal use, and a pointer
+   * to this (or some other) copy will be returned as the vdev
+   * member of event.u.
+   */
+
 
 /*======================================================================*/
 
@@ -36,10 +211,10 @@
  *      poll();
  *      libxl_osevent_afterpoll(...);
  *      for (;;) {
- *        r=libxl_event_check(...);
- *        if (r==LIBXL_NOT_READY) break;
- *        if (r) handle failure;
- *        do something with the event;
+ *          r = libxl_event_check(...);
+ *          if (r==LIBXL_NOT_READY) break;
+ *          if (r) goto error_out;
+ *          do something with the event;
  *      }
  *   }
  *
diff -r db9cac5b2489 -r 4f3822ee1f43 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:21 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:22 2012 +0000
@@ -177,11 +177,45 @@
     
 libxl__ev_xswatch *libxl__watch_slot_contents(libxl__gc *gc, int slotnum);
 
+
+/*
+ * evgen structures, which are the state we use for generating
+ * events for the caller.
+ *
+ * In general in each case there's an internal and an external
+ * version of the _evdisable_FOO function; the internal one is
+ * used during cleanup.
+ */
+
+struct libxl__evgen_domain_death {
+    uint32_t domid;
+    unsigned shutdown_reported:1, death_reported:1;
+    LIBXL_TAILQ_ENTRY(libxl_evgen_domain_death) entry;
+        /* on list .death_reported ? CTX->death_list : CTX->death_reported */
+    libxl_ev_user user;
+};
+_hidden void
+libxl__evdisable_domain_death(libxl__gc*, libxl_evgen_domain_death*);
+
+struct libxl__evgen_disk_eject {
+    libxl__ev_xswatch watch;
+    uint32_t domid;
+    LIBXL_LIST_ENTRY(libxl_evgen_disk_eject) entry;
+    libxl_ev_user user;
+    char *vdev;
+};
+_hidden void
+libxl__evdisable_disk_eject(libxl__gc*, libxl_evgen_disk_eject*);
+
+
 struct libxl__ctx {
     xentoollog_logger *lg;
     xc_interface *xch;
     struct xs_handle *xsh;
 
+    const libxl_event_hooks *event_hooks;
+    void *event_hooks_user;
+
     pthread_mutex_t lock; /* protects data structures hanging off the ctx */
       /* Always use libxl__ctx_lock and _unlock (or the convenience
        * macors CTX_LOCK and CTX_UNLOCK) to manipulate this.
@@ -195,12 +229,16 @@
        * documented in the libxl public interface.
        */
 
+    LIBXL_TAILQ_HEAD(libxl__event_list, libxl_event) occurred;
+
     int osevent_in_hook;
     const libxl_osevent_hooks *osevent_hooks;
     void *osevent_user;
       /* See the comment for OSEVENT_HOOK_INTERN in libxl_event.c
        * for restrictions on the use of the osevent fields. */
 
+    struct pollfd *fd_polls;
+    int fd_polls_allocd;
     int fd_rindex_allocd;
     int *fd_rindex; /* see libxl_osevent_beforepoll */
     LIBXL_LIST_HEAD(, libxl__ev_fd) efds;
@@ -212,6 +250,13 @@
     uint32_t watch_counter; /* helps disambiguate slot reuse */
     libxl__ev_fd watch_efd;
 
+    LIBXL_TAILQ_HEAD(libxl__evgen_domain_death_list, libxl_evgen_domain_death)
+        death_list /* sorted by domid */,
+        death_reported;
+    libxl__ev_xswatch death_watch;
+    
+    LIBXL_LIST_HEAD(, libxl_evgen_disk_eject) disk_eject_evgens;
+
     /* for callers who reap children willy-nilly; caller must only
      * set this after libxl_init and before any other call - or
      * may leave them untouched */
@@ -252,6 +297,7 @@
 struct libxl__egc {
     /* for event-generating functions only */
     struct libxl__gc gc;
+    struct libxl__event_list occurred_for_callback;
 };
 
 #define LIBXL_INIT_GC(gc,ctx) do{               \
@@ -396,6 +442,9 @@
  *
  * Callers of libxl__ev_KIND_register must ensure that the
  * registration is undone, with _deregister, in libxl_ctx_free.
+ * This means that normally each kind of libxl__evgen (ie each
+ * application-requested event source) needs to be on a list so that
+ * it can be automatically deregistered as promised in libxl_event.h.
  */
 
 
@@ -439,6 +488,25 @@
 
 
 /*
+ * Other event-handling support provided by the libxl event core to
+ * the rest of libxl.
+ */
+
+_hidden void libxl__event_occurred(libxl__egc*, libxl_event *event);
+  /* Arranges to notify the application that the event has occurred.
+   * event should be suitable for passing to libxl_event_free. */
+
+_hidden libxl_event *libxl__event_new(libxl__egc*, libxl_event_type,
+                                      uint32_t domid);
+  /* Convenience function.
+   * Allocates a new libxl_event, fills in domid and type.
+   * If allocation fails, calls _disaster, and returns NULL. */
+
+#define NEW_EVENT(egc, type, domid)                              \
+    libxl__event_new((egc), LIBXL_EVENT_TYPE_##type, (domid));
+    /* Convenience macro. */
+
+/*
  * In general, call this via the macro LIBXL__EVENT_DISASTER.
  *
  * Event-generating functions may call this if they might have wanted
@@ -995,12 +1063,15 @@
 
 /* egc initialisation and destruction: */
 
-#define LIBXL_INIT_EGC(egc,ctx) do{             \
-        LIBXL_INIT_GC((egc).gc,ctx);            \
-        /* list of occurred events tbd */       \
+#define LIBXL_INIT_EGC(egc,ctx) do{                     \
+        LIBXL_INIT_GC((egc).gc,ctx);                    \
+        LIBXL_TAILQ_INIT(&(egc).occurred_for_callback); \
     } while(0)
 
 _hidden void libxl__egc_cleanup(libxl__egc *egc);
+  /* Frees memory allocated within this egc's gc, and and report all
+   * occurred events via callback, if applicable.  May reenter the
+   * application; see restrictions above. */
 
 /* convenience macros: */
 
diff -r db9cac5b2489 -r 4f3822ee1f43 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Fri Jan 27 17:01:21 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Fri Jan 27 17:01:22 2012 +0000
@@ -75,11 +75,6 @@
     (6, "COREDUMP_RESTART"),
     ])
 
-libxl_event_type = Enumeration("event_type", [
-    (1, "DOMAIN_DEATH"),
-    (2, "DISK_EJECT"),
-    ])
-
 libxl_button = Enumeration("button", [
     (1, "POWER"),
     (2, "SLEEP"),
@@ -397,3 +392,32 @@
     ("extratime", integer),
     ("weight", integer),
     ], dispose_fn=None)
+
+libxl_event_type = Enumeration("event_type", [
+    (1, "DOMAIN_SHUTDOWN"),
+    (2, "DOMAIN_DESTROY"),
+    (3, "DISK_EJECT"),
+    ])
+
+libxl_ev_user = UInt(64)
+
+libxl_ev_link = Builtin("ev_link", passby=PASS_BY_REFERENCE, private=True)
+
+libxl_event = Struct("event",[
+    ("link",     libxl_ev_link),
+     # for use by libxl; caller may use this once the event has been
+     #   returned by libxl_event_{check,wait}
+    ("domid",    libxl_domid),
+    ("domuuid",  libxl_uuid),
+    ("for_user", libxl_ev_user),
+    ("type",     libxl_event_type),
+    ("u", KeyedUnion(None, libxl_event_type, "type",
+          [("domain_shutdown", Struct(None, [
+                                             ("shutdown_reason", uint8),
+                                      ])),
+           ("domain_destroy", Struct(None, [])),
+           ("disk_eject", Struct(None, [
+                                        ("vdev", string),
+                                        ("disk", libxl_device_disk),
+                                 ])),
+           ]))])
diff -r db9cac5b2489 -r 4f3822ee1f43 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Fri Jan 27 17:01:21 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Fri Jan 27 17:01:22 2012 +0000
@@ -1226,14 +1226,16 @@
     xlu_cfg_destroy(config);
 }
 
-/* Returns 1 if domain should be restarted, 2 if domain should be renamed then restarted  */
-static int handle_domain_death(libxl_ctx *ctx, uint32_t domid, libxl_event *event,
-                               libxl_domain_config *d_config, libxl_dominfo *info)
+/* Returns 1 if domain should be restarted,
+ * 2 if domain should be renamed then restarted, or 0 */
+static int handle_domain_death(libxl_ctx *ctx, uint32_t domid,
+                               libxl_event *event,
+                               libxl_domain_config *d_config)
 {
     int restart = 0;
     libxl_action_on_shutdown action;
 
-    switch (info->shutdown_reason) {
+    switch (event->u.domain_shutdown.shutdown_reason) {
     case SHUTDOWN_poweroff:
         action = d_config->on_poweroff;
         break;
@@ -1250,11 +1252,14 @@
         action = d_config->on_watchdog;
         break;
     default:
-        LOG("Unknown shutdown reason code %d. Destroying domain.", info->shutdown_reason);
+        LOG("Unknown shutdown reason code %d. Destroying domain.",
+            event->u.domain_shutdown.shutdown_reason);
         action = LIBXL_ACTION_ON_SHUTDOWN_DESTROY;
     }
 
-    LOG("Action for shutdown reason code %d is %s", info->shutdown_reason, action_on_shutdown_names[action]);
+    LOG("Action for shutdown reason code %d is %s",
+        event->u.domain_shutdown.shutdown_reason,
+        action_on_shutdown_names[action]);
 
     if (action == LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_DESTROY || action == LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_RESTART) {
         char *corefile;
@@ -1319,7 +1324,7 @@
 
 
 static int preserve_domain(libxl_ctx *ctx, uint32_t domid, libxl_event *event,
-                           libxl_domain_config *d_config, libxl_dominfo *info)
+                           libxl_domain_config *d_config)
 {
     time_t now;
     struct tm tm;
@@ -1432,6 +1437,40 @@
     _exit(1);
 }
 
+static int domain_wait_event(libxl_event **event_r)
+{
+    int ret;
+    for (;;) {
+        ret = libxl_event_wait(ctx, event_r, LIBXL_EVENTMASK_ALL, 0,0);
+        if (ret) {
+            LOG("Domain %d, failed to get event, quitting (rc=%d)", domid, ret);
+            return ret;
+        }
+        if ((*event_r)->domid != domid) {
+            char *evstr = libxl_event_to_json(ctx, *event_r);
+            LOG("INTERNAL PROBLEM - ignoring unexpected event for"
+                " domain %d (expected %d): event=%s",
+                (*event_r)->domid, domid, evstr);
+            free(evstr);
+            libxl_event_free(ctx, *event_r);
+            continue;
+        }
+        return ret;
+    }
+}
+
+static void evdisable_disk_ejects(libxl_evgen_disk_eject **diskws,
+                                 int num_disks)
+{
+    int i;
+
+    for (i = 0; i < num_disks; i++) {
+        if (diskws[i])
+            libxl_evdisable_disk_eject(ctx, diskws[i]);
+        diskws[i] = NULL;
+    }
+}
+
 static int create_domain(struct domain_create *dom_info)
 {
     libxl_domain_config d_config;
@@ -1445,10 +1484,11 @@
     const char *restore_file = dom_info->restore_file;
     int migrate_fd = dom_info->migrate_fd;
 
-    int fd, i;
+    int i;
     int need_daemon = daemonize;
     int ret, rc;
-    libxl_waiter *w1 = NULL, *w2 = NULL;
+    libxl_evgen_domain_death *deathw = NULL;
+    libxl_evgen_disk_eject **diskws = NULL; /* one per disk */
     void *config_data = 0;
     int config_len = 0;
     int restore_fd = -1;
@@ -1661,14 +1701,14 @@
                 if (errno != EINTR) {
                     perror("failed to wait for daemonizing child");
                     ret = ERROR_FAIL;
-                    goto error_out;
+                    goto out;
                 }
             }
             if (status) {
                 libxl_report_child_exitstatus(ctx, XTL_ERROR,
                            "daemonizing child", child1, status);
                 ret = ERROR_FAIL;
-                goto error_out;
+                goto out;
             }
             ret = domid;
             goto out;
@@ -1705,92 +1745,105 @@
     }
     LOG("Waiting for domain %s (domid %d) to die [pid %ld]",
         d_config.c_info.name, domid, (long)getpid());
-    w1 = (libxl_waiter*) xmalloc(sizeof(libxl_waiter) * d_config.num_disks);
-    w2 = (libxl_waiter*) xmalloc(sizeof(libxl_waiter));
-    libxl_wait_for_disk_ejects(ctx, domid, d_config.disks, d_config.num_disks, w1);
-    libxl_wait_for_domain_death(ctx, domid, w2);
-    libxl_get_wait_fd(ctx, &fd);
+
+    ret = libxl_evenable_domain_death(ctx, domid, 0, &deathw);
+    if (ret) goto out;
+
+    if (!diskws) {
+        diskws = xmalloc(sizeof(*diskws) * d_config.num_disks);
+        for (i = 0; i < d_config.num_disks; i++)
+            diskws[i] = NULL;
+    }
+    for (i = 0; i < d_config.num_disks; i++) {
+        if (d_config.disks[i].removable) {
+            ret = libxl_evenable_disk_eject(ctx, domid, d_config.disks[i].vdev,
+                                            0, &diskws[i]);
+            if (ret) goto out;
+        }
+    }
     while (1) {
-        int ret;
-        fd_set rfds;
-        libxl_dominfo info;
-        libxl_event event;
-        libxl_device_disk disk;
-
-        FD_ZERO(&rfds);
-        FD_SET(fd, &rfds);
-
-        ret = select(fd + 1, &rfds, NULL, NULL, NULL);
-        if (!ret)
-            continue;
-        libxl_get_event(ctx, &event);
-        switch (event.type) {
-            case LIBXL_EVENT_TYPE_DOMAIN_DEATH:
-                ret = libxl_event_get_domain_death_info(ctx, domid, &event, &info);
-
-                if (ret < 0) {
-                    libxl_free_event(&event);
-                    continue;
-                }
-
-                LOG("Domain %d is dead", domid);
-
-                if (ret) {
-                    switch (handle_domain_death(ctx, domid, &event, &d_config, &info)) {
-                    case 2:
-                        if (!preserve_domain(ctx, domid, &event, &d_config, &info)) {
-                            /* If we fail then exit leaving the old domain in place. */
-                            ret = -1;
-                            goto out;
-                        }
-
-                        /* Otherwise fall through and restart. */
-                    case 1:
-
-                        for (i = 0; i < d_config.num_disks; i++)
-                            libxl_free_waiter(&w1[i]);
-                        libxl_free_waiter(w2);
-                        free(w1);
-                        free(w2);
-
-                        /*
-                         * Do not attempt to reconnect if we come round again due to a
-                         * guest reboot -- the stdin/out will be disconnected by then.
-                         */
-                        dom_info->console_autoconnect = 0;
-
-                        /* Some settings only make sense on first boot. */
-                        paused = 0;
-                        if (common_domname
-                            && strcmp(d_config.c_info.name, common_domname)) {
-                            d_config.c_info.name = strdup(common_domname);
-                        }
-
-                        /*
-                         * XXX FIXME: If this sleep is not there then domain
-                         * re-creation fails sometimes.
-                         */
-                        LOG("Done. Rebooting now");
-                        sleep(2);
-                        goto start;
-                    case 0:
-                        LOG("Done. Exiting now");
-                        ret = 0;
-                        goto out;
-                    }
-                } else {
-                    LOG("Unable to get domain death info, quitting");
+        libxl_event *event;
+        ret = domain_wait_event(&event);
+        if (ret) goto out;
+
+        switch (event->type) {
+
+        case LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN:
+            LOG("Domain %d has shut down, reason code %d 0x%x", domid,
+                event->u.domain_shutdown.shutdown_reason,
+                event->u.domain_shutdown.shutdown_reason);
+            switch (handle_domain_death(ctx, domid, event, &d_config)) {
+            case 2:
+                if (!preserve_domain(ctx, domid, event, &d_config)) {
+                    /* If we fail then exit leaving the old domain in place. */
+                    ret = -1;
                     goto out;
                 }
-                break;
-            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_dispose(&disk);
+
+                /* Otherwise fall through and restart. */
+            case 1:
+                libxl_event_free(ctx, event);
+                libxl_evdisable_domain_death(ctx, deathw);
+                deathw = NULL;
+                evdisable_disk_ejects(diskws, d_config.num_disks);
+                /* discard any other events which may have been generated */
+                while (!(ret = libxl_event_check(ctx, &event,
+                                                 LIBXL_EVENTMASK_ALL, 0,0))) {
+                    libxl_event_free(ctx, event);
                 }
-                break;
+                if (ret != ERROR_NOT_READY) {
+                    LOG("warning, libxl_event_check (cleanup) failed (rc=%d)",
+                        ret);
+                }
+
+                /*
+                 * Do not attempt to reconnect if we come round again due to a
+                 * guest reboot -- the stdin/out will be disconnected by then.
+                 */
+                dom_info->console_autoconnect = 0;
+
+                /* Some settings only make sense on first boot. */
+                paused = 0;
+                if (common_domname
+                    && strcmp(d_config.c_info.name, common_domname)) {
+                    d_config.c_info.name = strdup(common_domname);
+                }
+
+                /*
+                 * XXX FIXME: If this sleep is not there then domain
+                 * re-creation fails sometimes.
+                 */
+                LOG("Done. Rebooting now");
+                sleep(2);
+                goto start;
+
+            case 0:
+                LOG("Done. Exiting now");
+                ret = 0;
+                goto out;
+
+            default:
+                abort();
+            }
+
+        case LIBXL_EVENT_TYPE_DOMAIN_DESTROY:
+            LOG("Domain %d has been destroyed.", domid);
+            ret = 0;
+            goto out;
+
+        case LIBXL_EVENT_TYPE_DISK_EJECT:
+            /* XXX what is this for? */
+            libxl_cdrom_insert(ctx, domid, &event->u.disk_eject.disk);
+            break;
+
+        default:;
+            char *evstr = libxl_event_to_json(ctx, event);
+            LOG("warning, got unexpected event type %d, event=%s",
+                event->type, evstr);
+            free(evstr);
         }
-        libxl_free_event(&event);
+
+        libxl_event_free(ctx, event);
     }
 
 error_out:
@@ -1811,6 +1864,13 @@
             waitpid(child_console_pid, &status, 0) < 0 && errno == EINTR)
         goto waitpid_out;
 
+    if (deathw)
+        libxl_evdisable_domain_death(ctx, deathw);
+    if (diskws) {
+        evdisable_disk_ejects(diskws, d_config.num_disks);
+        free(diskws);
+    }
+
     /*
      * If we have daemonized then do not return to the caller -- this has
      * already happened in the parent.
@@ -2273,6 +2333,7 @@
 static void shutdown_domain(const char *p, int wait)
 {
     int rc;
+    libxl_event *event;
 
     find_domain(p);
     rc=libxl_domain_shutdown(ctx, domid);
@@ -2287,37 +2348,39 @@
     }
 
     if (wait) {
-        libxl_waiter waiter;
-        int fd;
-
-        libxl_wait_for_domain_death(ctx, domid, &waiter);
-
-        libxl_get_wait_fd(ctx, &fd);
-
-        while (wait) {
-            fd_set rfds;
-            libxl_event event;
-            libxl_dominfo info;
-
-            FD_ZERO(&rfds);
-            FD_SET(fd, &rfds);
-
-            if (!select(fd + 1, &rfds, NULL, NULL, NULL))
-                continue;
-
-            libxl_get_event(ctx, &event);
-
-            if (event.type == LIBXL_EVENT_TYPE_DOMAIN_DEATH) {
-                if (libxl_event_get_domain_death_info(ctx, domid, &event, &info) < 0)
-                    continue;
-
-                LOG("Domain %d is dead", domid);
-                wait = 0;
+        libxl_evgen_domain_death *deathw;
+
+        rc = libxl_evenable_domain_death(ctx, domid, 0, &deathw);
+        if (rc) {
+            fprintf(stderr,"wait for death failed (evgen, rc=%d)\n",rc);
+            exit(-1);
+        }
+
+        for (;;) {
+            rc = domain_wait_event(&event);
+            if (rc) exit(-1);
+
+            switch (event->type) {
+
+            case LIBXL_EVENT_TYPE_DOMAIN_DESTROY:
+                LOG("Domain %d has been destroyed", domid);
+                goto done;
+
+            case LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN:
+                LOG("Domain %d has been shut down, reason code %d %x", domid,
+                    event->u.domain_shutdown.shutdown_reason,
+                    event->u.domain_shutdown.shutdown_reason);
+                goto done;
+
+            default:
+                LOG("Unexpected event type %d", event->type);
+                break;
             }
-
-            libxl_free_event(&event);
+            libxl_event_free(ctx, event);
         }
-        libxl_free_waiter(&waiter);
+    done:
+        libxl_event_free(ctx, event);
+        libxl_evdisable_domain_death(ctx, deathw);
     }
 }
 
diff -r db9cac5b2489 -r 4f3822ee1f43 tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py	Fri Jan 27 17:01:21 2012 +0000
+++ b/tools/ocaml/libs/xl/genwrap.py	Fri Jan 27 17:01:22 2012 +0000
@@ -275,6 +275,7 @@
         "device_model_info",
         "vcpuinfo",
         "topologyinfo",
+        "event",
         ]
 
     for t in blacklist:

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:55:45 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:55:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6d-0006FQ-7o; Fri, 03 Feb 2012 21:55:43 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6c-0006Ey-BI
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:42 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-27.messagelabs.com!1328306097!58731721!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32098 invoked from network); 3 Feb 2012 21:54:58 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:54:58 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6Z-0001hr-FX
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:39 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6X-0002ER-Fs
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:38 +0000
Message-Id: <E1RtR6X-0002ER-Fs@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:36 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: introduce
	libxl_fd_set_nonblock, rationalise _cloexec
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327683683 0
# Node ID d503bdfaba2326b6cc11b45feb660954cc8d9b88
# Parent  4f3822ee1f437792ff89b53cc5e2c59d98dbf337
libxl: introduce libxl_fd_set_nonblock, rationalise _cloexec

We want a function for setting fds to nonblocking, so introduce one.

This is a very similar requirement to that for libxl_fd_set_cloexec,
so make it common with that.

While we're at it, fix a few deficiences that make this latter
function less desirable than it could be:
 * Change the return from 0/-1 (like a syscall) to a libxl error code
 * Take a boolean parameter for turning the flag on and off
 * Log on error (and so, take a ctx for this purpose)

Change callers of libxl_fd_set_cloexec to notice errors.  (Although,
such errors are highly unlikely.)

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


diff -r 4f3822ee1f43 -r d503bdfaba23 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Jan 27 17:01:22 2012 +0000
+++ b/tools/libxl/libxl.c	Fri Jan 27 17:01:23 2012 +0000
@@ -3658,19 +3658,38 @@
     return 0;
 }
 
-int libxl_fd_set_cloexec(int fd)
+static int fd_set_flags(libxl_ctx *ctx, int fd,
+                        int fcntlgetop, int fcntlsetop, const char *fl,
+                        int flagmask, int set_p)
 {
-    int flags = 0;
-
-    if ((flags = fcntl(fd, F_GETFD)) == -1) {
-        flags = 0;
+    int flags, r;
+
+    flags = fcntl(fd, fcntlgetop);
+    if (flags == -1) {
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "fcntl(,F_GET%s) failed",fl);
+        return ERROR_FAIL;
     }
-    if ((flags & FD_CLOEXEC)) {
-        return 0;
+
+    if (set_p)
+        flags |= flagmask;
+    else
+        flags &= ~flagmask;
+
+    r = fcntl(fd, fcntlsetop, flags);
+    if (r == -1) {
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "fcntl(,F_SET%s) failed",fl);
+        return ERROR_FAIL;
     }
-    return fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
+
+    return 0;
 }
 
+int libxl_fd_set_cloexec(libxl_ctx *ctx, int fd, int cloexec)
+  { return fd_set_flags(ctx,fd, F_GETFD,F_SETFD,"FD", FD_CLOEXEC, cloexec); }
+
+int libxl_fd_set_nonblock(libxl_ctx *ctx, int fd, int nonblock)
+  { return fd_set_flags(ctx,fd, F_GETFL,F_SETFL,"FL", O_NONBLOCK, nonblock); }
+
 /*
  * Local variables:
  * mode: C
diff -r 4f3822ee1f43 -r d503bdfaba23 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Fri Jan 27 17:01:22 2012 +0000
+++ b/tools/libxl/libxl.h	Fri Jan 27 17:01:23 2012 +0000
@@ -613,7 +613,12 @@
 const char *libxl_xenpaging_dir_path(void);
 
 /* misc */
-int libxl_fd_set_cloexec(int fd);
+
+/* Each of these sets or clears the flag according to whether the
+ * 2nd parameter is nonzero.  On failure, they log, and
+ * return ERROR_FAIL, but also leave errno valid. */
+int libxl_fd_set_cloexec(libxl_ctx *ctx, int fd, int cloexec);
+int libxl_fd_set_nonblock(libxl_ctx *ctx, int fd, int nonblock);
 
 #include <libxl_event.h>
 
diff -r 4f3822ee1f43 -r d503bdfaba23 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Fri Jan 27 17:01:22 2012 +0000
+++ b/tools/libxl/libxl_qmp.c	Fri Jan 27 17:01:23 2012 +0000
@@ -325,7 +325,8 @@
     if (fcntl(qmp->qmp_fd, F_SETFL, flags | O_NONBLOCK) == -1) {
         return -1;
     }
-    libxl_fd_set_cloexec(qmp->qmp_fd);
+    ret = libxl_fd_set_cloexec(qmp->ctx, qmp->qmp_fd, 1);
+    if (ret) return -1;
 
     memset(&qmp->addr, 0, sizeof (&qmp->addr));
     qmp->addr.sun_family = AF_UNIX;
diff -r 4f3822ee1f43 -r d503bdfaba23 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Fri Jan 27 17:01:22 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Fri Jan 27 17:01:23 2012 +0000
@@ -1509,7 +1509,8 @@
             restore_fd = migrate_fd;
         } else {
             restore_fd = open(restore_file, O_RDONLY);
-            libxl_fd_set_cloexec(restore_fd);
+            rc = libxl_fd_set_cloexec(ctx, restore_fd, 1);
+            if (rc) return rc;
         }
 
         CHK_ERRNO( libxl_read_exactly(ctx, restore_fd, &hdr,

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:55:45 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:55:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6d-0006FQ-7o; Fri, 03 Feb 2012 21:55:43 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6c-0006Ey-BI
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:42 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-27.messagelabs.com!1328306097!58731721!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32098 invoked from network); 3 Feb 2012 21:54:58 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:54:58 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6Z-0001hr-FX
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:39 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6X-0002ER-Fs
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:38 +0000
Message-Id: <E1RtR6X-0002ER-Fs@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:36 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: introduce
	libxl_fd_set_nonblock, rationalise _cloexec
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327683683 0
# Node ID d503bdfaba2326b6cc11b45feb660954cc8d9b88
# Parent  4f3822ee1f437792ff89b53cc5e2c59d98dbf337
libxl: introduce libxl_fd_set_nonblock, rationalise _cloexec

We want a function for setting fds to nonblocking, so introduce one.

This is a very similar requirement to that for libxl_fd_set_cloexec,
so make it common with that.

While we're at it, fix a few deficiences that make this latter
function less desirable than it could be:
 * Change the return from 0/-1 (like a syscall) to a libxl error code
 * Take a boolean parameter for turning the flag on and off
 * Log on error (and so, take a ctx for this purpose)

Change callers of libxl_fd_set_cloexec to notice errors.  (Although,
such errors are highly unlikely.)

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


diff -r 4f3822ee1f43 -r d503bdfaba23 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Jan 27 17:01:22 2012 +0000
+++ b/tools/libxl/libxl.c	Fri Jan 27 17:01:23 2012 +0000
@@ -3658,19 +3658,38 @@
     return 0;
 }
 
-int libxl_fd_set_cloexec(int fd)
+static int fd_set_flags(libxl_ctx *ctx, int fd,
+                        int fcntlgetop, int fcntlsetop, const char *fl,
+                        int flagmask, int set_p)
 {
-    int flags = 0;
-
-    if ((flags = fcntl(fd, F_GETFD)) == -1) {
-        flags = 0;
+    int flags, r;
+
+    flags = fcntl(fd, fcntlgetop);
+    if (flags == -1) {
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "fcntl(,F_GET%s) failed",fl);
+        return ERROR_FAIL;
     }
-    if ((flags & FD_CLOEXEC)) {
-        return 0;
+
+    if (set_p)
+        flags |= flagmask;
+    else
+        flags &= ~flagmask;
+
+    r = fcntl(fd, fcntlsetop, flags);
+    if (r == -1) {
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "fcntl(,F_SET%s) failed",fl);
+        return ERROR_FAIL;
     }
-    return fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
+
+    return 0;
 }
 
+int libxl_fd_set_cloexec(libxl_ctx *ctx, int fd, int cloexec)
+  { return fd_set_flags(ctx,fd, F_GETFD,F_SETFD,"FD", FD_CLOEXEC, cloexec); }
+
+int libxl_fd_set_nonblock(libxl_ctx *ctx, int fd, int nonblock)
+  { return fd_set_flags(ctx,fd, F_GETFL,F_SETFL,"FL", O_NONBLOCK, nonblock); }
+
 /*
  * Local variables:
  * mode: C
diff -r 4f3822ee1f43 -r d503bdfaba23 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Fri Jan 27 17:01:22 2012 +0000
+++ b/tools/libxl/libxl.h	Fri Jan 27 17:01:23 2012 +0000
@@ -613,7 +613,12 @@
 const char *libxl_xenpaging_dir_path(void);
 
 /* misc */
-int libxl_fd_set_cloexec(int fd);
+
+/* Each of these sets or clears the flag according to whether the
+ * 2nd parameter is nonzero.  On failure, they log, and
+ * return ERROR_FAIL, but also leave errno valid. */
+int libxl_fd_set_cloexec(libxl_ctx *ctx, int fd, int cloexec);
+int libxl_fd_set_nonblock(libxl_ctx *ctx, int fd, int nonblock);
 
 #include <libxl_event.h>
 
diff -r 4f3822ee1f43 -r d503bdfaba23 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Fri Jan 27 17:01:22 2012 +0000
+++ b/tools/libxl/libxl_qmp.c	Fri Jan 27 17:01:23 2012 +0000
@@ -325,7 +325,8 @@
     if (fcntl(qmp->qmp_fd, F_SETFL, flags | O_NONBLOCK) == -1) {
         return -1;
     }
-    libxl_fd_set_cloexec(qmp->qmp_fd);
+    ret = libxl_fd_set_cloexec(qmp->ctx, qmp->qmp_fd, 1);
+    if (ret) return -1;
 
     memset(&qmp->addr, 0, sizeof (&qmp->addr));
     qmp->addr.sun_family = AF_UNIX;
diff -r 4f3822ee1f43 -r d503bdfaba23 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Fri Jan 27 17:01:22 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Fri Jan 27 17:01:23 2012 +0000
@@ -1509,7 +1509,8 @@
             restore_fd = migrate_fd;
         } else {
             restore_fd = open(restore_file, O_RDONLY);
-            libxl_fd_set_cloexec(restore_fd);
+            rc = libxl_fd_set_cloexec(ctx, restore_fd, 1);
+            if (rc) return rc;
         }
 
         CHK_ERRNO( libxl_read_exactly(ctx, restore_fd, &hdr,

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:55:46 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:55:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6e-0006Fm-D5; Fri, 03 Feb 2012 21:55:44 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6c-0006EF-GK
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:43 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-182.messagelabs.com!1328306132!12800361!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22721 invoked from network); 3 Feb 2012 21:55:34 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:34 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6S-0001hi-7m
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:32 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6P-0002CD-MO
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:31 +0000
Message-Id: <E1RtR6P-0002CD-MO@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:29 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: New API for providing OS
	events to libxl
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327683680 0
# Node ID b3387ae40371d8d075218502b456c250d0cb60b1
# Parent  f204ead7d9e4904beb7a848860b23780b480ed6c
libxl: New API for providing OS events to libxl

We provide a new set of functions and related structures
  libxl_osevent_*
which are to be used by event-driven applications to receive
information from libxl about which fds libxl is interested in, and
what timeouts libxl is waiting for, and to pass back to libxl
information about which fds are readable/writeable etc., and which
timeouts have occurred.  Ie, low-level events.

In this patch, this new machinery is still all unused.  Callers will
appear in the next patch in the series, which introduces a new API for
applications to receive high-level events about actual domains etc.

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


diff -r f204ead7d9e4 -r b3387ae40371 tools/libxl/Makefile
--- a/tools/libxl/Makefile	Fri Jan 27 17:01:19 2012 +0000
+++ b/tools/libxl/Makefile	Fri Jan 27 17:01:20 2012 +0000
@@ -49,7 +49,7 @@
 LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
 			libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o \
 			libxl_internal.o libxl_utils.o libxl_uuid.o libxl_json.o \
-			libxl_qmp.o $(LIBXL_OBJS-y)
+			libxl_qmp.o libxl_event.o $(LIBXL_OBJS-y)
 LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
 
 $(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl)
diff -r f204ead7d9e4 -r b3387ae40371 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Jan 27 17:01:19 2012 +0000
+++ b/tools/libxl/libxl.c	Fri Jan 27 17:01:20 2012 +0000
@@ -45,6 +45,16 @@
      * only as an initialiser, not as an expression. */
     memcpy(&ctx->lock, &mutex_value, sizeof(ctx->lock));
 
+    ctx->osevent_hooks = 0;
+
+    ctx->fd_rindex = 0;
+    LIBXL_LIST_INIT(&ctx->efds);
+    LIBXL_TAILQ_INIT(&ctx->etimes);
+
+    ctx->watch_slots = 0;
+    LIBXL_SLIST_INIT(&ctx->watch_freeslots);
+    libxl__ev_fd_init(&ctx->watch_efd);
+
     if ( stat(XENSTORE_PID_FILE, &stat_buf) != 0 ) {
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Is xenstore daemon running?\n"
                      "failed to stat %s", XENSTORE_PID_FILE);
@@ -79,9 +89,29 @@
 int libxl_ctx_free(libxl_ctx *ctx)
 {
     if (!ctx) return 0;
+
+    int i;
+    GC_INIT(ctx);
+
+    /* Deregister all libxl__ev_KINDs: */
+
+    for (i = 0; i < ctx->watch_nslots; i++)
+        assert(!libxl__watch_slot_contents(gc, i));
+    libxl__ev_fd_deregister(gc, &ctx->watch_efd);
+
+    /* Now there should be no more events requested from the application: */
+
+    assert(LIBXL_LIST_EMPTY(&ctx->efds));
+    assert(LIBXL_TAILQ_EMPTY(&ctx->etimes));
+
     if (ctx->xch) xc_interface_close(ctx->xch);
     libxl_version_info_dispose(&ctx->version_info);
     if (ctx->xsh) xs_daemon_close(ctx->xsh);
+
+    free(ctx->fd_rindex);
+    free(ctx->watch_slots);
+
+    GC_FREE;
     free(ctx);
     return 0;
 }
diff -r f204ead7d9e4 -r b3387ae40371 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Fri Jan 27 17:01:19 2012 +0000
+++ b/tools/libxl/libxl.h	Fri Jan 27 17:01:20 2012 +0000
@@ -137,6 +137,7 @@
 #include <xen/sysctl.h>
 
 #include <libxl_uuid.h>
+#include <_libxl_list.h>
 
 typedef uint8_t libxl_mac[6];
 #define LIBXL_MAC_FMT "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx"
@@ -223,6 +224,9 @@
     ERROR_GUEST_TIMEDOUT = -8,
     ERROR_TIMEDOUT = -9,
     ERROR_NOPARAVIRT = -10,
+    ERROR_NOT_READY = -11,
+    ERROR_OSEVENT_REG_FAIL = -12,
+    ERROR_BUFFERFULL = -13,
 };
 
 #define LIBXL_VERSION 0
@@ -648,6 +652,8 @@
 /* misc */
 int libxl_fd_set_cloexec(int fd);
 
+#include <libxl_event.h>
+
 #endif /* LIBXL_H */
 
 /*
diff -r f204ead7d9e4 -r b3387ae40371 tools/libxl/libxl_event.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxl/libxl_event.c	Fri Jan 27 17:01:20 2012 +0000
@@ -0,0 +1,750 @@
+/*
+ * Copyright (C) 2011      Citrix Ltd.
+ *
+ * This program 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; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program 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.
+ */
+/*
+ * Internal event machinery for use by other parts of libxl
+ */
+
+#include <poll.h>
+
+#include "libxl_internal.h"
+
+/*
+ * The counter osevent_in_hook is used to ensure that the application
+ * honours the reentrancy restriction documented in libxl_event.h.
+ *
+ * The application's registration hooks should be called ONLY via
+ * these macros, with the ctx locked.  Likewise all the "occurred"
+ * entrypoints from the application should assert(!in_hook);
+ */
+#define OSEVENT_HOOK_INTERN(defval, hookname, ...)                      \
+    (CTX->osevent_hooks                                                 \
+     ? (CTX->osevent_in_hook++,                                         \
+        CTX->osevent_hooks->hookname(CTX->osevent_user, __VA_ARGS__),   \
+        CTX->osevent_in_hook--)                                         \
+     : defval)
+
+#define OSEVENT_HOOK(hookname,...)                      \
+    OSEVENT_HOOK_INTERN(0, hookname, __VA_ARGS__)
+
+#define OSEVENT_HOOK_VOID(hookname,...)                 \
+    OSEVENT_HOOK_INTERN((void)0, hookname, __VA_ARGS__)
+
+/*
+ * fd events
+ */
+
+int libxl__ev_fd_register(libxl__gc *gc, libxl__ev_fd *ev,
+                          libxl__ev_fd_callback *func,
+                          int fd, short events)
+{
+    int rc;
+
+    assert(fd >= 0);
+
+    CTX_LOCK;
+
+    rc = OSEVENT_HOOK(fd_register, fd, &ev->for_app_reg, events, ev);
+    if (rc) goto out;
+
+    ev->fd = fd;
+    ev->events = events;
+    ev->func = func;
+
+    LIBXL_LIST_INSERT_HEAD(&CTX->efds, ev, entry);
+
+    rc = 0;
+
+ out:
+    CTX_UNLOCK;
+    return rc;
+}
+
+int libxl__ev_fd_modify(libxl__gc *gc, libxl__ev_fd *ev, short events)
+{
+    int rc;
+
+    CTX_LOCK;
+    assert(libxl__ev_fd_isregistered(ev));
+
+    rc = OSEVENT_HOOK(fd_modify, ev->fd, &ev->for_app_reg, events);
+    if (rc) goto out;
+
+    ev->events = events;
+
+    rc = 0;
+ out:
+    CTX_UNLOCK;
+    return rc;
+}
+
+void libxl__ev_fd_deregister(libxl__gc *gc, libxl__ev_fd *ev)
+{
+    CTX_LOCK;
+
+    if (!libxl__ev_fd_isregistered(ev))
+        goto out;
+
+    OSEVENT_HOOK_VOID(fd_deregister, ev->fd, ev->for_app_reg);
+    LIBXL_LIST_REMOVE(ev, entry);
+    ev->fd = -1;
+
+ out:
+    CTX_UNLOCK;
+}
+
+/*
+ * timeouts
+ */
+
+
+int libxl__gettimeofday(libxl__gc *gc, struct timeval *now_r)
+{
+    int rc = gettimeofday(now_r, 0);
+    if (rc) {
+        LIBXL__LOG_ERRNO(CTX, LIBXL__LOG_ERROR, "gettimeofday failed");
+        return ERROR_FAIL;
+    }
+    return 0;
+}
+
+static int time_rel_to_abs(libxl__gc *gc, int ms, struct timeval *abs_out)
+{
+    int rc;
+    struct timeval additional = {
+        .tv_sec = ms / 1000,
+        .tv_usec = (ms % 1000) * 1000
+    };
+    struct timeval now;
+
+    rc = libxl__gettimeofday(gc, &now);
+    if (rc) return rc;
+
+    timeradd(&now, &additional, abs_out);
+    return 0;
+}
+
+static void time_insert_finite(libxl__gc *gc, libxl__ev_time *ev)
+{
+    libxl__ev_time *evsearch;
+    LIBXL_TAILQ_INSERT_SORTED(&CTX->etimes, entry, ev, evsearch, /*empty*/,
+                              timercmp(&ev->abs, &evsearch->abs, >));
+    ev->infinite = 0;
+}
+
+static int time_register_finite(libxl__gc *gc, libxl__ev_time *ev,
+                                struct timeval abs)
+{
+    int rc;
+
+    rc = OSEVENT_HOOK(timeout_register, &ev->for_app_reg, abs, ev);
+    if (rc) return rc;
+
+    ev->infinite = 0;
+    ev->abs = abs;
+    time_insert_finite(gc, ev);
+
+    return 0;
+}
+
+static void time_deregister(libxl__gc *gc, libxl__ev_time *ev)
+{
+    if (!ev->infinite) {
+        OSEVENT_HOOK_VOID(timeout_deregister, &ev->for_app_reg);
+        LIBXL_TAILQ_REMOVE(&CTX->etimes, ev, entry);
+    }
+}
+
+
+int libxl__ev_time_register_abs(libxl__gc *gc, libxl__ev_time *ev,
+                                libxl__ev_time_callback *func,
+                                struct timeval abs)
+{
+    int rc;
+
+    CTX_LOCK;
+
+    rc = time_register_finite(gc, ev, abs);
+    if (rc) goto out;
+
+    ev->func = func;
+
+    rc = 0;
+ out:
+    CTX_UNLOCK;
+    return rc;
+}
+
+
+int libxl__ev_time_register_rel(libxl__gc *gc, libxl__ev_time *ev,
+                                libxl__ev_time_callback *func,
+                                int milliseconds /* as for poll(2) */)
+{
+    struct timeval abs;
+    int rc;
+
+    CTX_LOCK;
+
+    if (milliseconds < 0) {
+        ev->infinite = 1;
+    } else {
+        rc = time_rel_to_abs(gc, milliseconds, &abs);
+        if (rc) goto out;
+
+        rc = time_register_finite(gc, ev, abs);
+        if (rc) goto out;
+    }
+
+    ev->func = func;
+    rc = 0;
+
+ out:
+    CTX_UNLOCK;
+    return rc;
+}
+
+int libxl__ev_time_modify_abs(libxl__gc *gc, libxl__ev_time *ev,
+                              struct timeval abs)
+{
+    int rc;
+
+    CTX_LOCK;
+
+    assert(libxl__ev_time_isregistered(ev));
+
+    if (ev->infinite) {
+        rc = time_register_finite(gc, ev, abs);
+        if (rc) goto out;
+    } else {
+        rc = OSEVENT_HOOK(timeout_modify, &ev->for_app_reg, abs);
+        if (rc) goto out;
+
+        LIBXL_TAILQ_REMOVE(&CTX->etimes, ev, entry);
+        ev->abs = abs;
+        time_insert_finite(gc, ev);
+    }
+
+    rc = 0;
+ out:
+    CTX_UNLOCK;
+    return rc;
+}
+
+int libxl__ev_time_modify_rel(libxl__gc *gc, libxl__ev_time *ev,
+                              int milliseconds)
+{
+    struct timeval abs;
+    int rc;
+
+    CTX_LOCK;
+
+    assert(libxl__ev_time_isregistered(ev));
+
+    if (milliseconds < 0) {
+        time_deregister(gc, ev);
+        ev->infinite = 1;
+        rc = 0;
+        goto out;
+    }
+
+    rc = time_rel_to_abs(gc, milliseconds, &abs);
+    if (rc) goto out;
+
+    rc = libxl__ev_time_modify_abs(gc, ev, abs);
+    if (rc) goto out;
+
+    rc = 0;
+ out:
+    CTX_UNLOCK;
+    return rc;
+}
+
+void libxl__ev_time_deregister(libxl__gc *gc, libxl__ev_time *ev)
+{
+    CTX_LOCK;
+
+    if (!libxl__ev_time_isregistered(ev))
+        goto out;
+
+    time_deregister(gc, ev);
+    ev->func = 0;
+
+ out:
+    CTX_UNLOCK;
+    return;
+}
+
+
+/*
+ * xenstore watches
+ */
+
+libxl__ev_xswatch *libxl__watch_slot_contents(libxl__gc *gc, int slotnum)
+{
+    libxl__ev_watch_slot *slot = &CTX->watch_slots[slotnum];
+    libxl__ev_watch_slot *slotcontents = LIBXL_SLIST_NEXT(slot, empty);
+
+    if (slotcontents == NULL ||
+        ((uintptr_t)slotcontents >= (uintptr_t)CTX->watch_slots &&
+         (uintptr_t)slotcontents < (uintptr_t)(CTX->watch_slots +
+                                               CTX->watch_nslots)))
+        /* An empty slot has either a NULL pointer (end of the
+         * free list), or a pointer to another entry in the array.
+         * So we can do a bounds check to distinguish empty from
+         * full slots.
+         */
+        /* We need to do the comparisons as uintptr_t because
+         * comparing pointers which are not in the same object is
+         * undefined behaviour; if the compiler managed to figure
+         * out that watch_slots[0..watch_nslots-1] is all of the
+         * whole array object it could prove that the above bounds
+         * check was always true if it was legal, and remove it!
+         *
+         * uintptr_t because even on a machine with signed
+         * pointers, objects do not cross zero; whereas on
+         * machines with unsigned pointers, they may cross
+         * 0x8bazillion.
+         */
+        return NULL;
+
+        /* see comment near libxl__ev_watch_slot definition */
+    return (void*)slotcontents;
+}
+
+static void libxl__set_watch_slot_contents(libxl__ev_watch_slot *slot,
+                                           libxl__ev_xswatch *w)
+{
+    /* we look a bit behind the curtain of LIBXL_SLIST, to explicitly
+     * assign to the pointer that's the next link.  See the comment
+     * by the definition of libxl__ev_watch_slot */
+    slot->empty.sle_next = (void*)w;
+}
+
+static void watchfd_callback(libxl__egc *egc, libxl__ev_fd *ev,
+                             int fd, short events, short revents)
+{
+    EGC_GC;
+
+    for (;;) {
+        char **event = xs_check_watch(CTX->xsh);
+        if (!event) {
+            if (errno == EAGAIN) break;
+            if (errno == EINTR) continue;
+            LIBXL__EVENT_DISASTER(egc, "cannot check/read watches", errno, 0);
+            return;
+        }
+
+        const char *epath = event[0];
+        const char *token = event[1];
+        int slotnum;
+        uint32_t counterval;
+        int rc = sscanf(token, "%d/%"SCNx32, &slotnum, &counterval);
+        if (rc != 2) {
+            LIBXL__LOG(CTX, LIBXL__LOG_ERROR,
+                       "watch epath=%s token=%s: failed to parse token",
+                       epath, token);
+            /* oh well */
+            goto ignore;
+        }
+        if (slotnum < 0 || slotnum >= CTX->watch_nslots) {
+            /* perhaps in the future we will make the watchslots array shrink */
+            LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, "watch epath=%s token=%s:"
+                       " slotnum %d out of range [0,%d>",
+                       epath, token, slotnum, CTX->watch_nslots);
+            goto ignore;
+        }
+
+        libxl__ev_xswatch *w = libxl__watch_slot_contents(gc, slotnum);
+
+        if (!w) {
+            LIBXL__LOG(CTX, LIBXL__LOG_DEBUG,
+                       "watch epath=%s token=%s: empty slot",
+                       epath, token);
+            goto ignore;
+        }
+
+        if (w->counterval != counterval) {
+            LIBXL__LOG(CTX, LIBXL__LOG_DEBUG,
+                       "watch epath=%s token=%s: counter != %"PRIx32,
+                       epath, token, w->counterval);
+            goto ignore;
+        }
+
+        /* Now it's possible, though unlikely, that this was an event
+         * from a previous use of the same slot with the same counterval.
+         *
+         * In that case either:
+         *  - the event path is a child of the watch path, in
+         *    which case this watch would really have generated this
+         *    event if it had been registered soon enough and we are
+         *    OK to give this possibly-spurious event to the caller; or
+         * - it is not, in which case we must suppress it as the
+         *   caller should not see events for unrelated paths.
+         *
+         * See also docs/misc/xenstore.txt.
+         */
+        if (!xs_path_is_subpath(w->path, epath)) {
+            LIBXL__LOG(CTX, LIBXL__LOG_DEBUG,
+                       "watch epath=%s token=%s: not child of wpath=%s",
+                       epath, token, w->path);
+            goto ignore;
+        }
+
+        /* At last, we have checked everything! */
+        LIBXL__LOG(CTX, LIBXL__LOG_DEBUG,
+                   "watch event: epath=%s token=%s wpath=%s w=%p",
+                   epath, token, w->path, w);
+        w->callback(egc, w, w->path, epath);
+
+    ignore:
+        free(event);
+    }
+}
+
+static char *watch_token(libxl__gc *gc, int slotnum, uint32_t counterval)
+{
+    return libxl__sprintf(gc, "%d/%"PRIx32, slotnum, counterval);
+}
+
+int libxl__ev_xswatch_register(libxl__gc *gc, libxl__ev_xswatch *w,
+                               libxl__ev_xswatch_callback *func,
+                               const char *path /* copied */)
+{
+    libxl__ev_watch_slot *use = NULL;
+    char *path_copy = NULL;
+    int rc;
+
+    CTX_LOCK;
+
+    if (!libxl__ev_fd_isregistered(&CTX->watch_efd)) {
+        rc = libxl__ev_fd_register(gc, &CTX->watch_efd, watchfd_callback,
+                                   xs_fileno(CTX->xsh), POLLIN);
+        if (rc) goto out_rc;
+    }
+
+    if (LIBXL_SLIST_EMPTY(&CTX->watch_freeslots)) {
+        /* Free list is empty so there is not in fact a linked
+         * free list in the array and we can safely realloc it */
+        int newarraysize = (CTX->watch_nslots + 1) << 2;
+        int i;
+        libxl__ev_watch_slot *newarray =
+            realloc(CTX->watch_slots, sizeof(*newarray) * newarraysize);
+        if (!newarray) goto out_nomem;
+        for (i = CTX->watch_nslots; i < newarraysize; i++)
+            LIBXL_SLIST_INSERT_HEAD(&CTX->watch_freeslots,
+                                    &newarray[i], empty);
+        CTX->watch_slots = newarray;
+        CTX->watch_nslots = newarraysize;
+    }
+    use = LIBXL_SLIST_FIRST(&CTX->watch_freeslots);
+    assert(use);
+    LIBXL_SLIST_REMOVE_HEAD(&CTX->watch_freeslots, empty);
+
+    path_copy = strdup(path);
+    if (!path_copy) goto out_nomem;
+
+    int slotnum = use - CTX->watch_slots;
+    w->counterval = CTX->watch_counter++;
+
+    if (!xs_watch(CTX->xsh, path, watch_token(gc, slotnum, w->counterval))) {
+        LIBXL__LOG_ERRNOVAL(CTX, LIBXL__LOG_ERROR, errno,
+                            "create watch for path %s", path);
+        rc = ERROR_FAIL;
+        goto out_rc;
+    }
+
+    w->slotnum = slotnum;
+    w->path = path_copy;
+    w->callback = func;
+    libxl__set_watch_slot_contents(use, w);
+
+    CTX_UNLOCK;
+    return 0;
+
+ out_nomem:
+    rc = ERROR_NOMEM;
+ out_rc:
+    if (use)
+        LIBXL_SLIST_INSERT_HEAD(&CTX->watch_freeslots, use, empty);
+    if (path_copy)
+        free(path_copy);
+    CTX_UNLOCK;
+    return rc;
+}
+
+void libxl__ev_xswatch_deregister(libxl__gc *gc, libxl__ev_xswatch *w)
+{
+    /* it is legal to deregister from within _callback */
+    CTX_LOCK;
+
+    if (w->slotnum >= 0) {
+        char *token = watch_token(gc, w->slotnum, w->counterval);
+        if (!xs_unwatch(CTX->xsh, w->path, token))
+            /* Oh well, we will just get watch events forever more
+             * and ignore them.  But we should complain to the log. */
+            LIBXL__LOG_ERRNOVAL(CTX, LIBXL__LOG_ERROR, errno,
+                                "remove watch for path %s", w->path);
+
+        libxl__ev_watch_slot *slot = &CTX->watch_slots[w->slotnum];
+        LIBXL_SLIST_INSERT_HEAD(&CTX->watch_freeslots, slot, empty);
+        w->slotnum = -1;
+    }
+
+    free(w->path);
+    w->path = NULL;
+
+    CTX_UNLOCK;
+}
+
+/*
+ * osevent poll
+ */
+
+int libxl_osevent_beforepoll(libxl_ctx *ctx, int *nfds_io,
+                             struct pollfd *fds, int *timeout_upd,
+                             struct timeval now)
+{
+    libxl__ev_fd *efd;
+    int rc;
+
+    /*
+     * In order to be able to efficiently find the libxl__ev_fd
+     * for a struct poll during _afterpoll, we maintain a shadow
+     * data structure in CTX->fd_beforepolled: each slot in
+     * the fds array corresponds to a slot in fd_beforepolled.
+     */
+
+    GC_INIT(ctx);
+    CTX_LOCK;
+
+    if (*nfds_io) {
+        /*
+         * As an optimisation, we don't touch fd_rindex
+         * if *nfds_io is zero on entry, since in that case the
+         * caller just wanted to know how big an array to give us.
+         *
+         * If !*nfds_io, the unconditional parts below are guaranteed
+         * not to mess with fd_rindex.
+         */
+
+        int maxfd = 0;
+        LIBXL_LIST_FOREACH(efd, &CTX->efds, entry) {
+            if (!efd->events)
+                continue;
+            if (efd->fd >= maxfd)
+                maxfd = efd->fd + 1;
+        }
+        /* make sure our array is as big as *nfds_io */
+        if (CTX->fd_rindex_allocd < maxfd) {
+            assert(maxfd < INT_MAX / sizeof(int) / 2);
+            int *newarray = realloc(CTX->fd_rindex, sizeof(int) * maxfd);
+            if (!newarray) { rc = ERROR_NOMEM; goto out; }
+            memset(newarray + CTX->fd_rindex_allocd, 0,
+                   sizeof(int) * (maxfd - CTX->fd_rindex_allocd));
+            CTX->fd_rindex = newarray;
+            CTX->fd_rindex_allocd = maxfd;
+        }
+    }
+
+    int used = 0;
+    LIBXL_LIST_FOREACH(efd, &CTX->efds, entry) {
+        if (!efd->events)
+            continue;
+        if (used < *nfds_io) {
+            fds[used].fd = efd->fd;
+            fds[used].events = efd->events;
+            fds[used].revents = 0;
+            assert(efd->fd < CTX->fd_rindex_allocd);
+            CTX->fd_rindex[efd->fd] = used;
+        }
+        used++;
+    }
+    rc = used <= *nfds_io ? 0 : ERROR_BUFFERFULL;
+
+    *nfds_io = used;
+
+    libxl__ev_time *etime = LIBXL_TAILQ_FIRST(&CTX->etimes);
+    if (etime) {
+        int our_timeout;
+        struct timeval rel;
+        static struct timeval zero;
+
+        timersub(&etime->abs, &now, &rel);
+
+        if (timercmp(&rel, &zero, <)) {
+            our_timeout = 0;
+        } else if (rel.tv_sec >= 2000000) {
+            our_timeout = 2000000000;
+        } else {
+            our_timeout = rel.tv_sec * 1000 + (rel.tv_usec + 999) / 1000;
+        }
+        if (*timeout_upd < 0 || our_timeout < *timeout_upd)
+            *timeout_upd = our_timeout;
+    }
+
+ out:
+    CTX_UNLOCK;
+    GC_FREE;
+    return rc;
+}
+
+static int afterpoll_check_fd(libxl_ctx *ctx,
+                              const struct pollfd *fds, int nfds,
+                              int fd, int events)
+    /* returns mask of events which were requested and occurred */
+{
+    if (fd >= ctx->fd_rindex_allocd)
+        /* added after we went into poll, have to try again */
+        return 0;
+
+    int slot = ctx->fd_rindex[fd];
+
+    if (slot >= nfds)
+        /* stale slot entry; again, added afterwards */
+        return 0;
+
+    if (fds[slot].fd != fd)
+        /* again, stale slot entry */
+        return 0;
+
+    int revents = fds[slot].revents & events;
+    /* we mask in case requested events have changed */
+
+    return revents;
+}
+
+void libxl_osevent_afterpoll(libxl_ctx *ctx, int nfds, const struct pollfd *fds,
+                             struct timeval now)
+{
+    EGC_INIT(ctx);
+    CTX_LOCK;
+    libxl__ev_fd *efd;
+
+    LIBXL_LIST_FOREACH(efd, &CTX->efds, entry) {
+        if (!efd->events)
+            continue;
+
+        int revents = afterpoll_check_fd(CTX,fds,nfds, efd->fd,efd->events);
+        if (revents)
+            efd->func(egc, efd, efd->fd, efd->events, revents);
+    }
+
+    for (;;) {
+        libxl__ev_time *etime = LIBXL_TAILQ_FIRST(&CTX->etimes);
+        if (!etime)
+            break;
+
+        assert(!etime->infinite);
+
+        if (timercmp(&etime->abs, &now, >))
+            break;
+
+        time_deregister(gc, etime);
+
+        etime->func(egc, etime, &etime->abs);
+    }
+
+    CTX_UNLOCK;
+    EGC_FREE;
+}
+
+
+/*
+ * osevent hook and callback machinery
+ */
+
+void libxl_osevent_register_hooks(libxl_ctx *ctx,
+                                  const libxl_osevent_hooks *hooks,
+                                  void *user)
+{
+    GC_INIT(ctx);
+    CTX_LOCK;
+    ctx->osevent_hooks = hooks;
+    ctx->osevent_user = user;
+    CTX_UNLOCK;
+    GC_FREE;
+}
+
+
+void libxl_osevent_occurred_fd(libxl_ctx *ctx, void *for_libxl,
+                               int fd, short events, short revents)
+{
+    libxl__ev_fd *ev = for_libxl;
+
+    EGC_INIT(ctx);
+    CTX_LOCK;
+    assert(!CTX->osevent_in_hook);
+
+    assert(fd == ev->fd);
+    revents &= ev->events;
+    if (revents)
+        ev->func(egc, ev, fd, ev->events, revents);
+
+    CTX_UNLOCK;
+    EGC_FREE;
+}
+
+void libxl_osevent_occurred_timeout(libxl_ctx *ctx, void *for_libxl)
+{
+    libxl__ev_time *ev = for_libxl;
+
+    EGC_INIT(ctx);
+    CTX_LOCK;
+    assert(!CTX->osevent_in_hook);
+
+    assert(!ev->infinite);
+    LIBXL_TAILQ_REMOVE(&CTX->etimes, ev, entry);
+    ev->func(egc, ev, &ev->abs);
+
+    CTX_UNLOCK;
+    EGC_FREE;
+}
+
+void libxl__event_disaster(libxl__egc *egc, const char *msg, int errnoval,
+                           libxl_event_type type /* may be 0 */,
+                           const char *file, int line, const char *func)
+{
+    EGC_GC;
+
+    libxl__log(CTX, XTL_CRITICAL, errnoval, file, line, func,
+               "DISASTER in event loop: %s%s%s%s",
+               msg,
+               type ? " (relates to event type " : "",
+               type ? libxl_event_type_to_string(type) : "",
+               type ? ")" : "");
+
+    /*
+     * FIXME: This should call the "disaster" hook supplied to
+     * libxl_event_register_callbacks, which will be introduced in the
+     * next patch.
+     */
+
+    const char verybad[] =
+        "DISASTER in event loop not handled by libxl application";
+    LIBXL__LOG(CTX, XTL_CRITICAL, verybad);
+    fprintf(stderr, "libxl: fatal error, exiting program: %s\n", verybad);
+    exit(-1);
+}
+
+void libxl__egc_cleanup(libxl__egc *egc)
+{
+    libxl__free_all(&egc->gc);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r f204ead7d9e4 -r b3387ae40371 tools/libxl/libxl_event.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxl/libxl_event.h	Fri Jan 27 17:01:20 2012 +0000
@@ -0,0 +1,205 @@
+/*
+ * Copyright (C) 2011      Citrix Ltd.
+ * Author Ian Jackson <ian.jackson@eu.citrix.com>
+ *
+ * This program 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; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program 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.
+ */
+
+#ifndef LIBXL_EVENT_H
+#define LIBXL_EVENT_H
+
+#include <libxl.h>
+
+
+/*======================================================================*/
+
+/*
+ * OS event handling - passing low-level OS events to libxl
+ *
+ * Event-driven programs must use these facilities to allow libxl
+ * to become aware of readability/writeability of file descriptors
+ * and the occurrence of timeouts.
+ *
+ * There are two approaches available.  The first is appropriate for
+ * simple programs handling reasonably small numbers of domains:
+ *
+ *   for (;;) {
+ *      libxl_osevent_beforepoll(...)
+ *      poll();
+ *      libxl_osevent_afterpoll(...);
+ *      for (;;) {
+ *        r=libxl_event_check(...);
+ *        if (r==LIBXL_NOT_READY) break;
+ *        if (r) handle failure;
+ *        do something with the event;
+ *      }
+ *   }
+ *
+ * The second approach uses libxl_osevent_register_hooks and is
+ * suitable for programs which are already using a callback-based
+ * event library.
+ *
+ * An application may freely mix the two styles of interaction.
+ *
+ * (Callers inside libxl may not call libxl_osevent_... functions.)
+ */
+
+struct pollfd;
+
+/* The caller should provide beforepoll with some space for libxl's
+ * fds, and tell libxl how much space is available by setting *nfds_io.
+ * fds points to the start of this space (and fds may be a pointer into
+ * a larger array, for example, if the application has some fds of
+ * its own that it is interested in).
+ *
+ * On return *nfds_io will in any case have been updated by libxl
+ * according to how many fds libxl wants to poll on.
+ *
+ * If the space was sufficient, libxl fills in fds[0..<new
+ * *nfds_io>] suitably for poll(2), updates *timeout_upd if needed,
+ * and returns ok.
+ *
+ * If space was insufficient, fds[0..<old *nfds_io>] is undefined on
+ * return; *nfds_io on return will be greater than the value on
+ * entry; *timeout_upd may or may not have been updated; and
+ * libxl_osevent_beforepoll returns ERROR_BUFERFULL.  In this case
+ * the application needs to make more space (enough space for
+ * *nfds_io struct pollfd) and then call beforepoll again, before
+ * entering poll(2).  Typically this will involve calling realloc.
+ *
+ * The application may call beforepoll with fds==NULL and
+ * *nfds_io==0 in order to find out how much space is needed.
+ *
+ * *timeout_upd is as for poll(2): it's in milliseconds, and
+ * negative values mean no timeout (infinity).
+ * libxl_osevent_beforepoll will only reduce the timeout, naturally.
+ */
+int libxl_osevent_beforepoll(libxl_ctx *ctx, int *nfds_io,
+                             struct pollfd *fds, int *timeout_upd,
+                             struct timeval now);
+
+/* nfds and fds[0..nfds] must be from the most recent call to
+ * _beforepoll, as modified by poll.  (It is therefore not possible
+ * to have multiple threads simultaneously polling using this
+ * interface.)
+ *
+ * This function actually performs all of the IO and other actions,
+ * and generates events (libxl_event), which are implied by either
+ * (a) the time of day or (b) both (i) the returned information from
+ * _beforepoll, and (ii) the results from poll specified in
+ * fds[0..nfds-1].  Generated events can then be retrieved by
+ * libxl_event_check.
+ */
+void libxl_osevent_afterpoll(libxl_ctx *ctx, int nfds, const struct pollfd *fds,
+                             struct timeval now);
+
+
+typedef struct libxl_osevent_hooks {
+  int (*fd_register)(void *user, int fd, void **for_app_registration_out,
+                     short events, void *for_libxl);
+  int (*fd_modify)(void *user, int fd, void **for_app_registration_update,
+                   short events);
+  void (*fd_deregister)(void *user, int fd, void *for_app_registration);
+  int (*timeout_register)(void *user, void **for_app_registration_out,
+                          struct timeval abs, void *for_libxl);
+  int (*timeout_modify)(void *user, void **for_app_registration_update,
+                         struct timeval abs);
+  void (*timeout_deregister)(void *user, void *for_app_registration);
+} libxl_osevent_hooks;
+
+/* The application which calls register_fd_hooks promises to
+ * maintain a register of fds and timeouts that libxl is interested
+ * in, and make calls into libxl (libxl_osevent_occurred_*)
+ * when those fd events and timeouts occur.  This is more efficient
+ * than _beforepoll/_afterpoll if there are many fds (which can
+ * happen if the same libxl application is managing many domains).
+ *
+ * For an fd event, events is as for poll().  register or modify may
+ * be called with events==0, in which case it must still work
+ * normally, just not generate any events.
+ *
+ * For a timeout event, milliseconds is as for poll().
+ * Specifically, negative values of milliseconds mean NO TIMEOUT.
+ * This is used by libxl to temporarily disable a timeout.
+ *
+ * If the register or modify hook succeeds it may update
+ * *for_app_registration_out/_update and must then return 0.
+ * On entry to register, *for_app_registration_out is always NULL.
+ *
+ * A registration or modification hook may fail, in which case it
+ * must leave the registration state of the fd or timeout unchanged.
+ * It may then either return ERROR_OSEVENT_REG_FAIL or any positive
+ * int.  The value returned will be passed up through libxl and
+ * eventually returned back to the application.  When register
+ * fails, any value stored into *for_registration_out is ignored by
+ * libxl; when modify fails, any changed value stored into
+ * *for_registration_update is honoured by libxl and will be passed
+ * to future modify or deregister calls.
+ *
+ * libxl will only attempt to register one callback for any one fd.
+ * libxl will remember the value stored in *for_app_registration_out
+ * (or *for_app_registration_update) by a successful call to
+ * register (or modify), and pass it to subsequent calls to modify
+ * or deregister.
+ *
+ * register_fd_hooks may be called only once for each libxl_ctx.
+ * libxl may make calls to register/modify/deregister from within
+ * any libxl function (indeed, it will usually call register from
+ * register_event_hooks).  Conversely, the application MUST NOT make
+ * the event occurrence calls (libxl_osevent_occurred_*) into libxl
+ * reentrantly from within libxl (for example, from within the
+ * register/modify functions).
+ *
+ * Lock hierarchy: the register/modify/deregister functions may be
+ * called with locks held.  These locks (the "libxl internal locks")
+ * are inside the libxl_ctx.  Therefore, if those register functions
+ * acquire any locks of their own ("caller register locks") outside
+ * libxl, to avoid deadlock one of the following must hold for each
+ * such caller register lock:
+ *  (a) "acquire libxl internal locks before caller register lock":
+ *      No libxl function may be called with the caller register
+ *      lock held.
+ *  (b) "acquire caller register lock before libxl internal locks":
+ *      No libxl function may be called _without_ the caller
+ *      register lock held.
+ * Of these we would normally recommend (a).
+ *
+ * The value *hooks is not copied and must outlast the libxl_ctx.
+ */
+void libxl_osevent_register_hooks(libxl_ctx *ctx,
+                                  const libxl_osevent_hooks *hooks,
+                                  void *user);
+
+/* It is NOT legal to call _occurred_ reentrantly within any libxl
+ * function.  Specifically it is NOT legal to call it from within
+ * a register callback.  Conversely, libxl MAY call register/deregister
+ * from within libxl_event_registered_call_*.
+ */
+
+void libxl_osevent_occurred_fd(libxl_ctx *ctx, void *for_libxl,
+                               int fd, short events, short revents);
+
+/* Implicitly, on entry to this function the timeout has been
+ * deregistered.  If _occurred_timeout is called, libxl will not
+ * call timeout_deregister; if it wants to requeue the timeout it
+ * will call timeout_register again.
+ */
+void libxl_osevent_occurred_timeout(libxl_ctx *ctx, void *for_libxl);
+
+#endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r f204ead7d9e4 -r b3387ae40371 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:19 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:20 2012 +0000
@@ -35,6 +35,7 @@
 #include <unistd.h>
 
 #include <sys/mman.h>
+#include <sys/poll.h>
 #include <sys/select.h>
 #include <sys/stat.h>
 #include <sys/time.h>
@@ -111,6 +112,71 @@
 
      /* these functions preserve errno (saving and restoring) */
 
+typedef struct libxl__gc libxl__gc;
+typedef struct libxl__egc libxl__egc;
+
+typedef struct libxl__ev_fd libxl__ev_fd;
+typedef void libxl__ev_fd_callback(libxl__egc *egc, libxl__ev_fd *ev,
+                                   int fd, short events, short revents);
+struct libxl__ev_fd {
+    /* caller should include this in their own struct */
+    /* read-only for caller, who may read only when registered: */
+    int fd;
+    short events;
+    libxl__ev_fd_callback *func;
+    /* remainder is private for libxl__ev_fd... */
+    LIBXL_LIST_ENTRY(libxl__ev_fd) entry;
+    void *for_app_reg;
+};
+
+
+typedef struct libxl__ev_time libxl__ev_time;
+typedef void libxl__ev_time_callback(libxl__egc *egc, libxl__ev_time *ev,
+                                     const struct timeval *requested_abs);
+struct libxl__ev_time {
+    /* caller should include this in their own struct */
+    /* read-only for caller, who may read only when registered: */
+    libxl__ev_time_callback *func;
+    /* remainder is private for libxl__ev_time... */
+    int infinite; /* not registered in list or with app if infinite */
+    LIBXL_TAILQ_ENTRY(libxl__ev_time) entry;
+    struct timeval abs;
+    void *for_app_reg;
+};
+
+typedef struct libxl__ev_xswatch libxl__ev_xswatch;
+typedef void libxl__ev_xswatch_callback(libxl__egc *egc, libxl__ev_xswatch*,
+                            const char *watch_path, const char *event_path);
+struct libxl__ev_xswatch {
+    /* caller should include this in their own struct */
+    /* read-only for caller, who may read only when registered: */
+    char *path;
+    libxl__ev_xswatch_callback *callback;
+    /* remainder is private for libxl__ev_xswatch... */
+    int slotnum; /* registered iff slotnum >= 0 */
+    uint32_t counterval;
+};
+
+/*
+ * An entry in the watch_slots table is either:
+ *  1. an entry in the free list, ie NULL or pointer to next free list entry
+ *  2. an pointer to a libxl__ev_xswatch
+ *
+ * But we don't want to use unions or type-punning because the
+ * compiler might "prove" that our code is wrong and misoptimise it.
+ *
+ * The rules say that all struct pointers have identical
+ * representation and alignment requirements (C99+TC1+TC2 6.2.5p26) so
+ * what we do is simply declare our array as containing only the free
+ * list pointers, and explicitly convert from and to our actual
+ * xswatch pointers when we store and retrieve them.
+ */
+typedef struct libxl__ev_watch_slot {
+    LIBXL_SLIST_ENTRY(struct libxl__ev_watch_slot) empty;
+} libxl__ev_watch_slot;
+    
+libxl__ev_xswatch *libxl__watch_slot_contents(libxl__gc *gc, int slotnum);
+
 struct libxl__ctx {
     xentoollog_logger *lg;
     xc_interface *xch;
@@ -129,6 +195,23 @@
        * documented in the libxl public interface.
        */
 
+    int osevent_in_hook;
+    const libxl_osevent_hooks *osevent_hooks;
+    void *osevent_user;
+      /* See the comment for OSEVENT_HOOK_INTERN in libxl_event.c
+       * for restrictions on the use of the osevent fields. */
+
+    int fd_rindex_allocd;
+    int *fd_rindex; /* see libxl_osevent_beforepoll */
+    LIBXL_LIST_HEAD(, libxl__ev_fd) efds;
+    LIBXL_TAILQ_HEAD(, libxl__ev_time) etimes;
+
+    libxl__ev_watch_slot *watch_slots;
+    int watch_nslots;
+    LIBXL_SLIST_HEAD(, libxl__ev_watch_slot) watch_freeslots;
+    uint32_t watch_counter; /* helps disambiguate slot reuse */
+    libxl__ev_fd watch_efd;
+
     /* for callers who reap children willy-nilly; caller must only
      * set this after libxl_init and before any other call - or
      * may leave them untouched */
@@ -159,12 +242,17 @@
 
 #define PRINTF_ATTRIBUTE(x, y) __attribute__((format(printf, x, y)))
 
-typedef struct {
+struct libxl__gc {
     /* mini-GC */
     int alloc_maxsize;
     void **alloc_ptrs;
     libxl_ctx *owner;
-} libxl__gc;
+};
+
+struct libxl__egc {
+    /* for event-generating functions only */
+    struct libxl__gc gc;
+};
 
 #define LIBXL_INIT_GC(gc,ctx) do{               \
         (gc).alloc_maxsize = 0;                 \
@@ -236,6 +324,140 @@
 
 _hidden char *libxl__xs_libxl_path(libxl__gc *gc, uint32_t domid);
 
+
+/*
+ * Event generation functions provided by the libxl event core to the
+ * rest of libxl.  Implemented in terms of _beforepoll/_afterpoll
+ * and/or the fd registration machinery, as provided by the
+ * application.
+ *
+ * Semantics are similar to those of the fd and timeout registration
+ * functions provided to libxl_osevent_register_hooks.
+ *
+ * Non-0 returns from libxl__ev_{modify,deregister} have already been
+ * logged by the core and should be returned unmodified to libxl's
+ * caller; NB that they may be valid libxl error codes but they may
+ * also be positive numbers supplied by the caller.
+ *
+ * In each case, there is a libxl__ev_FOO structure which can be in
+ * one of three states:
+ *
+ *   Undefined   - Might contain anything.  All-bits-zero is
+ *                 an undefined state.
+ *
+ *   Idle        - Struct contents are defined enough to pass to any
+ *                 libxl__ev_FOO function but not registered and
+ *                 callback will not be called.  The struct does not
+ *                 contain references to any allocated resources so
+ *                 can be thrown away.
+ *
+ *   Active      - Request for events has been registered and events
+ *                 may be generated.  _deregister must be called to
+ *                 reclaim resources.
+ *
+ * These functions are provided for each kind of event KIND:
+ *
+ *   int libxl__ev_KIND_register(libxl__gc *gc, libxl__ev_KIND *GEN,
+ *                              libxl__ev_KIND_callback *FUNC,
+ *                              DETAILS);
+ *      On entry *GEN must be in state Undefined or Idle.
+ *      Returns a libxl error code; on error return *GEN is Idle.
+ *      On successful return *GEN is Active and FUNC wil be
+ *      called by the event machinery in future.  FUNC will
+ *      not be called from within the call to _register.
+ *      FUNC will be called with the context locked (with CTX_LOCK).
+ *
+ *  void libxl__ev_KIND_deregister(libxl__gc *gc, libxl__ev_KIND *GEN_upd);
+ *      On entry *GEN must be in state Active or Idle.
+ *      On return it is Idle.  (Idempotent.)
+ *
+ *  void libxl__ev_KIND_init(libxl__ev_KIND *GEN);
+ *      Provided for initialising an Undefined KIND.
+ *      On entry *GEN must be in state Idle or Undefined.
+ *      On return it is Idle.  (Idempotent.)
+ *
+ *  int libxl__ev_KIND_isregistered(const libxl__ev_KIND *GEN);
+ *      On entry *GEN must be Idle or Active.
+ *      Returns nonzero if it is Active, zero otherwise.
+ *      Cannot fail.
+ *
+ *  int libxl__ev_KIND_modify(libxl__gc*, libxl__ev_KIND *GEN,
+ *                            DETAILS);
+ *      Only provided for some kinds of generator.
+ *      On entry *GEN must be Active and on return, whether successful
+ *      or not, it will be Active.
+ *      Returns a libxl error code; on error the modification
+ *      is not effective.
+ *
+ * All of these functions are fully threadsafe and may be called by
+ * general code in libxl even from within event callback FUNCs.
+ * The ctx will be locked on entry to each FUNC and FUNC should not
+ * unlock it.
+ *
+ * Callers of libxl__ev_KIND_register must ensure that the
+ * registration is undone, with _deregister, in libxl_ctx_free.
+ */
+
+
+_hidden int libxl__ev_fd_register(libxl__gc*, libxl__ev_fd *ev_out,
+                                  libxl__ev_fd_callback*,
+                                  int fd, short events /* as for poll(2) */);
+_hidden int libxl__ev_fd_modify(libxl__gc*, libxl__ev_fd *ev,
+                                short events);
+_hidden void libxl__ev_fd_deregister(libxl__gc*, libxl__ev_fd *ev);
+static inline void libxl__ev_fd_init(libxl__ev_fd *efd)
+                    { efd->fd = -1; }
+static inline int libxl__ev_fd_isregistered(libxl__ev_fd *efd)
+                    { return efd->fd >= 0; }
+
+_hidden int libxl__ev_time_register_rel(libxl__gc*, libxl__ev_time *ev_out,
+                                        libxl__ev_time_callback*,
+                                        int milliseconds /* as for poll(2) */);
+_hidden int libxl__ev_time_register_abs(libxl__gc*, libxl__ev_time *ev_out,
+                                        libxl__ev_time_callback*,
+                                        struct timeval);
+_hidden int libxl__ev_time_modify_rel(libxl__gc*, libxl__ev_time *ev,
+                                      int milliseconds /* as for poll(2) */);
+_hidden int libxl__ev_time_modify_abs(libxl__gc*, libxl__ev_time *ev,
+                                      struct timeval);
+_hidden void libxl__ev_time_deregister(libxl__gc*, libxl__ev_time *ev);
+static inline void libxl__ev_time_init(libxl__ev_time *ev)
+                { ev->func = 0; }
+static inline int libxl__ev_time_isregistered(libxl__ev_time *ev)
+                { return !!ev->func; }
+
+
+_hidden int libxl__ev_xswatch_register(libxl__gc*, libxl__ev_xswatch *xsw_out,
+                                       libxl__ev_xswatch_callback*,
+                                       const char *path /* copied */);
+_hidden void libxl__ev_xswatch_deregister(libxl__gc *gc, libxl__ev_xswatch*);
+
+static inline void libxl__ev_xswatch_init(libxl__ev_xswatch *xswatch_out)
+                { xswatch_out->slotnum = -1; }
+static inline int libxl__ev_xswatch_isregistered(const libxl__ev_xswatch *xw)
+                { return xw->slotnum >= 0; }
+
+
+/*
+ * In general, call this via the macro LIBXL__EVENT_DISASTER.
+ *
+ * Event-generating functions may call this if they might have wanted
+ * to generate an event (either an internal one ie a
+ * libxl__ev_FOO_callback or an application event), but are prevented
+ * from doing so due to eg lack of memory.
+ *
+ * NB that this function may return and the caller isn't supposed to
+ * then crash, although it may fail (and henceforth leave things in a
+ * state where many or all calls fail).
+ */
+_hidden void libxl__event_disaster(libxl__egc*, const char *msg, int errnoval,
+                                   libxl_event_type type /* may be 0 */,
+                                   const char *file, int line,
+                                   const char *func);
+#define LIBXL__EVENT_DISASTER(egc, msg, errnoval, type) \
+    libxl__event_disaster(egc, msg, errnoval, type, __FILE__,__LINE__,__func__)
+
+
 /* 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);
@@ -602,6 +824,8 @@
 /* compare mac address @a and @b. 0 if the same, -ve if a<b and +ve if a>b */
 _hidden int libxl__compare_macs(libxl_mac *a, libxl_mac *b);
 
+_hidden int libxl__gettimeofday(libxl__gc *gc, struct timeval *now_r);
+
 #define STRINGIFY(x) #x
 #define TOSTRING(x) STRINGIFY(x)
 
@@ -739,6 +963,55 @@
 
 
 /*
+ * Calling context and GC for event-generating functions:
+ *
+ * These are for use by parts of libxl which directly or indirectly
+ * call libxl__event_occurred.  These contain a gc but also a list of
+ * deferred events.
+ *
+ * You should never need to initialise an egc unless you are part of
+ * the event machinery itself.  Otherwise you will always be given an
+ * egc if you need one.  Even functions which generate specific kinds
+ * of events don't need to - rather, they will be passed an egc into
+ * their own callback function and should just use the one they're
+ * given.
+ *
+ * Functions using LIBXL__INIT_EGC may *not* generally be called from
+ * within libxl, because libxl__egc_cleanup may call back into the
+ * application.  This should be documented near the function
+ * prototype(s) for callers of LIBXL__INIT_EGC and EGC_INIT.  You
+ * should in any case not find it necessary to call egc-creators from
+ * within libxl.
+ *
+ * For the same reason libxl__egc_cleanup (or EGC_FREE) must be called
+ * with the ctx *unlocked*.  So the right pattern has the EGC_...
+ * macro calls on the outside of the CTX_... ones.
+ */
+
+/* useful for all functions which take an egc: */
+
+#define EGC_GC                                  \
+    libxl__gc *const gc = &egc->gc
+
+/* egc initialisation and destruction: */
+
+#define LIBXL_INIT_EGC(egc,ctx) do{             \
+        LIBXL_INIT_GC((egc).gc,ctx);            \
+        /* list of occurred events tbd */       \
+    } while(0)
+
+_hidden void libxl__egc_cleanup(libxl__egc *egc);
+
+/* convenience macros: */
+
+#define EGC_INIT(ctx)                       \
+    libxl__egc egc[1]; LIBXL_INIT_EGC(egc[0],ctx);      \
+    EGC_GC
+
+#define EGC_FREE           libxl__egc_cleanup(egc)
+
+
+/*
  * Convenience macros.
  */
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:55:46 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:55:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6e-0006Fm-D5; Fri, 03 Feb 2012 21:55:44 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6c-0006EF-GK
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:43 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-182.messagelabs.com!1328306132!12800361!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22721 invoked from network); 3 Feb 2012 21:55:34 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:34 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6S-0001hi-7m
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:32 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6P-0002CD-MO
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:31 +0000
Message-Id: <E1RtR6P-0002CD-MO@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:29 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: New API for providing OS
	events to libxl
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327683680 0
# Node ID b3387ae40371d8d075218502b456c250d0cb60b1
# Parent  f204ead7d9e4904beb7a848860b23780b480ed6c
libxl: New API for providing OS events to libxl

We provide a new set of functions and related structures
  libxl_osevent_*
which are to be used by event-driven applications to receive
information from libxl about which fds libxl is interested in, and
what timeouts libxl is waiting for, and to pass back to libxl
information about which fds are readable/writeable etc., and which
timeouts have occurred.  Ie, low-level events.

In this patch, this new machinery is still all unused.  Callers will
appear in the next patch in the series, which introduces a new API for
applications to receive high-level events about actual domains etc.

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


diff -r f204ead7d9e4 -r b3387ae40371 tools/libxl/Makefile
--- a/tools/libxl/Makefile	Fri Jan 27 17:01:19 2012 +0000
+++ b/tools/libxl/Makefile	Fri Jan 27 17:01:20 2012 +0000
@@ -49,7 +49,7 @@
 LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
 			libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o \
 			libxl_internal.o libxl_utils.o libxl_uuid.o libxl_json.o \
-			libxl_qmp.o $(LIBXL_OBJS-y)
+			libxl_qmp.o libxl_event.o $(LIBXL_OBJS-y)
 LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
 
 $(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl)
diff -r f204ead7d9e4 -r b3387ae40371 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Jan 27 17:01:19 2012 +0000
+++ b/tools/libxl/libxl.c	Fri Jan 27 17:01:20 2012 +0000
@@ -45,6 +45,16 @@
      * only as an initialiser, not as an expression. */
     memcpy(&ctx->lock, &mutex_value, sizeof(ctx->lock));
 
+    ctx->osevent_hooks = 0;
+
+    ctx->fd_rindex = 0;
+    LIBXL_LIST_INIT(&ctx->efds);
+    LIBXL_TAILQ_INIT(&ctx->etimes);
+
+    ctx->watch_slots = 0;
+    LIBXL_SLIST_INIT(&ctx->watch_freeslots);
+    libxl__ev_fd_init(&ctx->watch_efd);
+
     if ( stat(XENSTORE_PID_FILE, &stat_buf) != 0 ) {
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Is xenstore daemon running?\n"
                      "failed to stat %s", XENSTORE_PID_FILE);
@@ -79,9 +89,29 @@
 int libxl_ctx_free(libxl_ctx *ctx)
 {
     if (!ctx) return 0;
+
+    int i;
+    GC_INIT(ctx);
+
+    /* Deregister all libxl__ev_KINDs: */
+
+    for (i = 0; i < ctx->watch_nslots; i++)
+        assert(!libxl__watch_slot_contents(gc, i));
+    libxl__ev_fd_deregister(gc, &ctx->watch_efd);
+
+    /* Now there should be no more events requested from the application: */
+
+    assert(LIBXL_LIST_EMPTY(&ctx->efds));
+    assert(LIBXL_TAILQ_EMPTY(&ctx->etimes));
+
     if (ctx->xch) xc_interface_close(ctx->xch);
     libxl_version_info_dispose(&ctx->version_info);
     if (ctx->xsh) xs_daemon_close(ctx->xsh);
+
+    free(ctx->fd_rindex);
+    free(ctx->watch_slots);
+
+    GC_FREE;
     free(ctx);
     return 0;
 }
diff -r f204ead7d9e4 -r b3387ae40371 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Fri Jan 27 17:01:19 2012 +0000
+++ b/tools/libxl/libxl.h	Fri Jan 27 17:01:20 2012 +0000
@@ -137,6 +137,7 @@
 #include <xen/sysctl.h>
 
 #include <libxl_uuid.h>
+#include <_libxl_list.h>
 
 typedef uint8_t libxl_mac[6];
 #define LIBXL_MAC_FMT "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx"
@@ -223,6 +224,9 @@
     ERROR_GUEST_TIMEDOUT = -8,
     ERROR_TIMEDOUT = -9,
     ERROR_NOPARAVIRT = -10,
+    ERROR_NOT_READY = -11,
+    ERROR_OSEVENT_REG_FAIL = -12,
+    ERROR_BUFFERFULL = -13,
 };
 
 #define LIBXL_VERSION 0
@@ -648,6 +652,8 @@
 /* misc */
 int libxl_fd_set_cloexec(int fd);
 
+#include <libxl_event.h>
+
 #endif /* LIBXL_H */
 
 /*
diff -r f204ead7d9e4 -r b3387ae40371 tools/libxl/libxl_event.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxl/libxl_event.c	Fri Jan 27 17:01:20 2012 +0000
@@ -0,0 +1,750 @@
+/*
+ * Copyright (C) 2011      Citrix Ltd.
+ *
+ * This program 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; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program 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.
+ */
+/*
+ * Internal event machinery for use by other parts of libxl
+ */
+
+#include <poll.h>
+
+#include "libxl_internal.h"
+
+/*
+ * The counter osevent_in_hook is used to ensure that the application
+ * honours the reentrancy restriction documented in libxl_event.h.
+ *
+ * The application's registration hooks should be called ONLY via
+ * these macros, with the ctx locked.  Likewise all the "occurred"
+ * entrypoints from the application should assert(!in_hook);
+ */
+#define OSEVENT_HOOK_INTERN(defval, hookname, ...)                      \
+    (CTX->osevent_hooks                                                 \
+     ? (CTX->osevent_in_hook++,                                         \
+        CTX->osevent_hooks->hookname(CTX->osevent_user, __VA_ARGS__),   \
+        CTX->osevent_in_hook--)                                         \
+     : defval)
+
+#define OSEVENT_HOOK(hookname,...)                      \
+    OSEVENT_HOOK_INTERN(0, hookname, __VA_ARGS__)
+
+#define OSEVENT_HOOK_VOID(hookname,...)                 \
+    OSEVENT_HOOK_INTERN((void)0, hookname, __VA_ARGS__)
+
+/*
+ * fd events
+ */
+
+int libxl__ev_fd_register(libxl__gc *gc, libxl__ev_fd *ev,
+                          libxl__ev_fd_callback *func,
+                          int fd, short events)
+{
+    int rc;
+
+    assert(fd >= 0);
+
+    CTX_LOCK;
+
+    rc = OSEVENT_HOOK(fd_register, fd, &ev->for_app_reg, events, ev);
+    if (rc) goto out;
+
+    ev->fd = fd;
+    ev->events = events;
+    ev->func = func;
+
+    LIBXL_LIST_INSERT_HEAD(&CTX->efds, ev, entry);
+
+    rc = 0;
+
+ out:
+    CTX_UNLOCK;
+    return rc;
+}
+
+int libxl__ev_fd_modify(libxl__gc *gc, libxl__ev_fd *ev, short events)
+{
+    int rc;
+
+    CTX_LOCK;
+    assert(libxl__ev_fd_isregistered(ev));
+
+    rc = OSEVENT_HOOK(fd_modify, ev->fd, &ev->for_app_reg, events);
+    if (rc) goto out;
+
+    ev->events = events;
+
+    rc = 0;
+ out:
+    CTX_UNLOCK;
+    return rc;
+}
+
+void libxl__ev_fd_deregister(libxl__gc *gc, libxl__ev_fd *ev)
+{
+    CTX_LOCK;
+
+    if (!libxl__ev_fd_isregistered(ev))
+        goto out;
+
+    OSEVENT_HOOK_VOID(fd_deregister, ev->fd, ev->for_app_reg);
+    LIBXL_LIST_REMOVE(ev, entry);
+    ev->fd = -1;
+
+ out:
+    CTX_UNLOCK;
+}
+
+/*
+ * timeouts
+ */
+
+
+int libxl__gettimeofday(libxl__gc *gc, struct timeval *now_r)
+{
+    int rc = gettimeofday(now_r, 0);
+    if (rc) {
+        LIBXL__LOG_ERRNO(CTX, LIBXL__LOG_ERROR, "gettimeofday failed");
+        return ERROR_FAIL;
+    }
+    return 0;
+}
+
+static int time_rel_to_abs(libxl__gc *gc, int ms, struct timeval *abs_out)
+{
+    int rc;
+    struct timeval additional = {
+        .tv_sec = ms / 1000,
+        .tv_usec = (ms % 1000) * 1000
+    };
+    struct timeval now;
+
+    rc = libxl__gettimeofday(gc, &now);
+    if (rc) return rc;
+
+    timeradd(&now, &additional, abs_out);
+    return 0;
+}
+
+static void time_insert_finite(libxl__gc *gc, libxl__ev_time *ev)
+{
+    libxl__ev_time *evsearch;
+    LIBXL_TAILQ_INSERT_SORTED(&CTX->etimes, entry, ev, evsearch, /*empty*/,
+                              timercmp(&ev->abs, &evsearch->abs, >));
+    ev->infinite = 0;
+}
+
+static int time_register_finite(libxl__gc *gc, libxl__ev_time *ev,
+                                struct timeval abs)
+{
+    int rc;
+
+    rc = OSEVENT_HOOK(timeout_register, &ev->for_app_reg, abs, ev);
+    if (rc) return rc;
+
+    ev->infinite = 0;
+    ev->abs = abs;
+    time_insert_finite(gc, ev);
+
+    return 0;
+}
+
+static void time_deregister(libxl__gc *gc, libxl__ev_time *ev)
+{
+    if (!ev->infinite) {
+        OSEVENT_HOOK_VOID(timeout_deregister, &ev->for_app_reg);
+        LIBXL_TAILQ_REMOVE(&CTX->etimes, ev, entry);
+    }
+}
+
+
+int libxl__ev_time_register_abs(libxl__gc *gc, libxl__ev_time *ev,
+                                libxl__ev_time_callback *func,
+                                struct timeval abs)
+{
+    int rc;
+
+    CTX_LOCK;
+
+    rc = time_register_finite(gc, ev, abs);
+    if (rc) goto out;
+
+    ev->func = func;
+
+    rc = 0;
+ out:
+    CTX_UNLOCK;
+    return rc;
+}
+
+
+int libxl__ev_time_register_rel(libxl__gc *gc, libxl__ev_time *ev,
+                                libxl__ev_time_callback *func,
+                                int milliseconds /* as for poll(2) */)
+{
+    struct timeval abs;
+    int rc;
+
+    CTX_LOCK;
+
+    if (milliseconds < 0) {
+        ev->infinite = 1;
+    } else {
+        rc = time_rel_to_abs(gc, milliseconds, &abs);
+        if (rc) goto out;
+
+        rc = time_register_finite(gc, ev, abs);
+        if (rc) goto out;
+    }
+
+    ev->func = func;
+    rc = 0;
+
+ out:
+    CTX_UNLOCK;
+    return rc;
+}
+
+int libxl__ev_time_modify_abs(libxl__gc *gc, libxl__ev_time *ev,
+                              struct timeval abs)
+{
+    int rc;
+
+    CTX_LOCK;
+
+    assert(libxl__ev_time_isregistered(ev));
+
+    if (ev->infinite) {
+        rc = time_register_finite(gc, ev, abs);
+        if (rc) goto out;
+    } else {
+        rc = OSEVENT_HOOK(timeout_modify, &ev->for_app_reg, abs);
+        if (rc) goto out;
+
+        LIBXL_TAILQ_REMOVE(&CTX->etimes, ev, entry);
+        ev->abs = abs;
+        time_insert_finite(gc, ev);
+    }
+
+    rc = 0;
+ out:
+    CTX_UNLOCK;
+    return rc;
+}
+
+int libxl__ev_time_modify_rel(libxl__gc *gc, libxl__ev_time *ev,
+                              int milliseconds)
+{
+    struct timeval abs;
+    int rc;
+
+    CTX_LOCK;
+
+    assert(libxl__ev_time_isregistered(ev));
+
+    if (milliseconds < 0) {
+        time_deregister(gc, ev);
+        ev->infinite = 1;
+        rc = 0;
+        goto out;
+    }
+
+    rc = time_rel_to_abs(gc, milliseconds, &abs);
+    if (rc) goto out;
+
+    rc = libxl__ev_time_modify_abs(gc, ev, abs);
+    if (rc) goto out;
+
+    rc = 0;
+ out:
+    CTX_UNLOCK;
+    return rc;
+}
+
+void libxl__ev_time_deregister(libxl__gc *gc, libxl__ev_time *ev)
+{
+    CTX_LOCK;
+
+    if (!libxl__ev_time_isregistered(ev))
+        goto out;
+
+    time_deregister(gc, ev);
+    ev->func = 0;
+
+ out:
+    CTX_UNLOCK;
+    return;
+}
+
+
+/*
+ * xenstore watches
+ */
+
+libxl__ev_xswatch *libxl__watch_slot_contents(libxl__gc *gc, int slotnum)
+{
+    libxl__ev_watch_slot *slot = &CTX->watch_slots[slotnum];
+    libxl__ev_watch_slot *slotcontents = LIBXL_SLIST_NEXT(slot, empty);
+
+    if (slotcontents == NULL ||
+        ((uintptr_t)slotcontents >= (uintptr_t)CTX->watch_slots &&
+         (uintptr_t)slotcontents < (uintptr_t)(CTX->watch_slots +
+                                               CTX->watch_nslots)))
+        /* An empty slot has either a NULL pointer (end of the
+         * free list), or a pointer to another entry in the array.
+         * So we can do a bounds check to distinguish empty from
+         * full slots.
+         */
+        /* We need to do the comparisons as uintptr_t because
+         * comparing pointers which are not in the same object is
+         * undefined behaviour; if the compiler managed to figure
+         * out that watch_slots[0..watch_nslots-1] is all of the
+         * whole array object it could prove that the above bounds
+         * check was always true if it was legal, and remove it!
+         *
+         * uintptr_t because even on a machine with signed
+         * pointers, objects do not cross zero; whereas on
+         * machines with unsigned pointers, they may cross
+         * 0x8bazillion.
+         */
+        return NULL;
+
+        /* see comment near libxl__ev_watch_slot definition */
+    return (void*)slotcontents;
+}
+
+static void libxl__set_watch_slot_contents(libxl__ev_watch_slot *slot,
+                                           libxl__ev_xswatch *w)
+{
+    /* we look a bit behind the curtain of LIBXL_SLIST, to explicitly
+     * assign to the pointer that's the next link.  See the comment
+     * by the definition of libxl__ev_watch_slot */
+    slot->empty.sle_next = (void*)w;
+}
+
+static void watchfd_callback(libxl__egc *egc, libxl__ev_fd *ev,
+                             int fd, short events, short revents)
+{
+    EGC_GC;
+
+    for (;;) {
+        char **event = xs_check_watch(CTX->xsh);
+        if (!event) {
+            if (errno == EAGAIN) break;
+            if (errno == EINTR) continue;
+            LIBXL__EVENT_DISASTER(egc, "cannot check/read watches", errno, 0);
+            return;
+        }
+
+        const char *epath = event[0];
+        const char *token = event[1];
+        int slotnum;
+        uint32_t counterval;
+        int rc = sscanf(token, "%d/%"SCNx32, &slotnum, &counterval);
+        if (rc != 2) {
+            LIBXL__LOG(CTX, LIBXL__LOG_ERROR,
+                       "watch epath=%s token=%s: failed to parse token",
+                       epath, token);
+            /* oh well */
+            goto ignore;
+        }
+        if (slotnum < 0 || slotnum >= CTX->watch_nslots) {
+            /* perhaps in the future we will make the watchslots array shrink */
+            LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, "watch epath=%s token=%s:"
+                       " slotnum %d out of range [0,%d>",
+                       epath, token, slotnum, CTX->watch_nslots);
+            goto ignore;
+        }
+
+        libxl__ev_xswatch *w = libxl__watch_slot_contents(gc, slotnum);
+
+        if (!w) {
+            LIBXL__LOG(CTX, LIBXL__LOG_DEBUG,
+                       "watch epath=%s token=%s: empty slot",
+                       epath, token);
+            goto ignore;
+        }
+
+        if (w->counterval != counterval) {
+            LIBXL__LOG(CTX, LIBXL__LOG_DEBUG,
+                       "watch epath=%s token=%s: counter != %"PRIx32,
+                       epath, token, w->counterval);
+            goto ignore;
+        }
+
+        /* Now it's possible, though unlikely, that this was an event
+         * from a previous use of the same slot with the same counterval.
+         *
+         * In that case either:
+         *  - the event path is a child of the watch path, in
+         *    which case this watch would really have generated this
+         *    event if it had been registered soon enough and we are
+         *    OK to give this possibly-spurious event to the caller; or
+         * - it is not, in which case we must suppress it as the
+         *   caller should not see events for unrelated paths.
+         *
+         * See also docs/misc/xenstore.txt.
+         */
+        if (!xs_path_is_subpath(w->path, epath)) {
+            LIBXL__LOG(CTX, LIBXL__LOG_DEBUG,
+                       "watch epath=%s token=%s: not child of wpath=%s",
+                       epath, token, w->path);
+            goto ignore;
+        }
+
+        /* At last, we have checked everything! */
+        LIBXL__LOG(CTX, LIBXL__LOG_DEBUG,
+                   "watch event: epath=%s token=%s wpath=%s w=%p",
+                   epath, token, w->path, w);
+        w->callback(egc, w, w->path, epath);
+
+    ignore:
+        free(event);
+    }
+}
+
+static char *watch_token(libxl__gc *gc, int slotnum, uint32_t counterval)
+{
+    return libxl__sprintf(gc, "%d/%"PRIx32, slotnum, counterval);
+}
+
+int libxl__ev_xswatch_register(libxl__gc *gc, libxl__ev_xswatch *w,
+                               libxl__ev_xswatch_callback *func,
+                               const char *path /* copied */)
+{
+    libxl__ev_watch_slot *use = NULL;
+    char *path_copy = NULL;
+    int rc;
+
+    CTX_LOCK;
+
+    if (!libxl__ev_fd_isregistered(&CTX->watch_efd)) {
+        rc = libxl__ev_fd_register(gc, &CTX->watch_efd, watchfd_callback,
+                                   xs_fileno(CTX->xsh), POLLIN);
+        if (rc) goto out_rc;
+    }
+
+    if (LIBXL_SLIST_EMPTY(&CTX->watch_freeslots)) {
+        /* Free list is empty so there is not in fact a linked
+         * free list in the array and we can safely realloc it */
+        int newarraysize = (CTX->watch_nslots + 1) << 2;
+        int i;
+        libxl__ev_watch_slot *newarray =
+            realloc(CTX->watch_slots, sizeof(*newarray) * newarraysize);
+        if (!newarray) goto out_nomem;
+        for (i = CTX->watch_nslots; i < newarraysize; i++)
+            LIBXL_SLIST_INSERT_HEAD(&CTX->watch_freeslots,
+                                    &newarray[i], empty);
+        CTX->watch_slots = newarray;
+        CTX->watch_nslots = newarraysize;
+    }
+    use = LIBXL_SLIST_FIRST(&CTX->watch_freeslots);
+    assert(use);
+    LIBXL_SLIST_REMOVE_HEAD(&CTX->watch_freeslots, empty);
+
+    path_copy = strdup(path);
+    if (!path_copy) goto out_nomem;
+
+    int slotnum = use - CTX->watch_slots;
+    w->counterval = CTX->watch_counter++;
+
+    if (!xs_watch(CTX->xsh, path, watch_token(gc, slotnum, w->counterval))) {
+        LIBXL__LOG_ERRNOVAL(CTX, LIBXL__LOG_ERROR, errno,
+                            "create watch for path %s", path);
+        rc = ERROR_FAIL;
+        goto out_rc;
+    }
+
+    w->slotnum = slotnum;
+    w->path = path_copy;
+    w->callback = func;
+    libxl__set_watch_slot_contents(use, w);
+
+    CTX_UNLOCK;
+    return 0;
+
+ out_nomem:
+    rc = ERROR_NOMEM;
+ out_rc:
+    if (use)
+        LIBXL_SLIST_INSERT_HEAD(&CTX->watch_freeslots, use, empty);
+    if (path_copy)
+        free(path_copy);
+    CTX_UNLOCK;
+    return rc;
+}
+
+void libxl__ev_xswatch_deregister(libxl__gc *gc, libxl__ev_xswatch *w)
+{
+    /* it is legal to deregister from within _callback */
+    CTX_LOCK;
+
+    if (w->slotnum >= 0) {
+        char *token = watch_token(gc, w->slotnum, w->counterval);
+        if (!xs_unwatch(CTX->xsh, w->path, token))
+            /* Oh well, we will just get watch events forever more
+             * and ignore them.  But we should complain to the log. */
+            LIBXL__LOG_ERRNOVAL(CTX, LIBXL__LOG_ERROR, errno,
+                                "remove watch for path %s", w->path);
+
+        libxl__ev_watch_slot *slot = &CTX->watch_slots[w->slotnum];
+        LIBXL_SLIST_INSERT_HEAD(&CTX->watch_freeslots, slot, empty);
+        w->slotnum = -1;
+    }
+
+    free(w->path);
+    w->path = NULL;
+
+    CTX_UNLOCK;
+}
+
+/*
+ * osevent poll
+ */
+
+int libxl_osevent_beforepoll(libxl_ctx *ctx, int *nfds_io,
+                             struct pollfd *fds, int *timeout_upd,
+                             struct timeval now)
+{
+    libxl__ev_fd *efd;
+    int rc;
+
+    /*
+     * In order to be able to efficiently find the libxl__ev_fd
+     * for a struct poll during _afterpoll, we maintain a shadow
+     * data structure in CTX->fd_beforepolled: each slot in
+     * the fds array corresponds to a slot in fd_beforepolled.
+     */
+
+    GC_INIT(ctx);
+    CTX_LOCK;
+
+    if (*nfds_io) {
+        /*
+         * As an optimisation, we don't touch fd_rindex
+         * if *nfds_io is zero on entry, since in that case the
+         * caller just wanted to know how big an array to give us.
+         *
+         * If !*nfds_io, the unconditional parts below are guaranteed
+         * not to mess with fd_rindex.
+         */
+
+        int maxfd = 0;
+        LIBXL_LIST_FOREACH(efd, &CTX->efds, entry) {
+            if (!efd->events)
+                continue;
+            if (efd->fd >= maxfd)
+                maxfd = efd->fd + 1;
+        }
+        /* make sure our array is as big as *nfds_io */
+        if (CTX->fd_rindex_allocd < maxfd) {
+            assert(maxfd < INT_MAX / sizeof(int) / 2);
+            int *newarray = realloc(CTX->fd_rindex, sizeof(int) * maxfd);
+            if (!newarray) { rc = ERROR_NOMEM; goto out; }
+            memset(newarray + CTX->fd_rindex_allocd, 0,
+                   sizeof(int) * (maxfd - CTX->fd_rindex_allocd));
+            CTX->fd_rindex = newarray;
+            CTX->fd_rindex_allocd = maxfd;
+        }
+    }
+
+    int used = 0;
+    LIBXL_LIST_FOREACH(efd, &CTX->efds, entry) {
+        if (!efd->events)
+            continue;
+        if (used < *nfds_io) {
+            fds[used].fd = efd->fd;
+            fds[used].events = efd->events;
+            fds[used].revents = 0;
+            assert(efd->fd < CTX->fd_rindex_allocd);
+            CTX->fd_rindex[efd->fd] = used;
+        }
+        used++;
+    }
+    rc = used <= *nfds_io ? 0 : ERROR_BUFFERFULL;
+
+    *nfds_io = used;
+
+    libxl__ev_time *etime = LIBXL_TAILQ_FIRST(&CTX->etimes);
+    if (etime) {
+        int our_timeout;
+        struct timeval rel;
+        static struct timeval zero;
+
+        timersub(&etime->abs, &now, &rel);
+
+        if (timercmp(&rel, &zero, <)) {
+            our_timeout = 0;
+        } else if (rel.tv_sec >= 2000000) {
+            our_timeout = 2000000000;
+        } else {
+            our_timeout = rel.tv_sec * 1000 + (rel.tv_usec + 999) / 1000;
+        }
+        if (*timeout_upd < 0 || our_timeout < *timeout_upd)
+            *timeout_upd = our_timeout;
+    }
+
+ out:
+    CTX_UNLOCK;
+    GC_FREE;
+    return rc;
+}
+
+static int afterpoll_check_fd(libxl_ctx *ctx,
+                              const struct pollfd *fds, int nfds,
+                              int fd, int events)
+    /* returns mask of events which were requested and occurred */
+{
+    if (fd >= ctx->fd_rindex_allocd)
+        /* added after we went into poll, have to try again */
+        return 0;
+
+    int slot = ctx->fd_rindex[fd];
+
+    if (slot >= nfds)
+        /* stale slot entry; again, added afterwards */
+        return 0;
+
+    if (fds[slot].fd != fd)
+        /* again, stale slot entry */
+        return 0;
+
+    int revents = fds[slot].revents & events;
+    /* we mask in case requested events have changed */
+
+    return revents;
+}
+
+void libxl_osevent_afterpoll(libxl_ctx *ctx, int nfds, const struct pollfd *fds,
+                             struct timeval now)
+{
+    EGC_INIT(ctx);
+    CTX_LOCK;
+    libxl__ev_fd *efd;
+
+    LIBXL_LIST_FOREACH(efd, &CTX->efds, entry) {
+        if (!efd->events)
+            continue;
+
+        int revents = afterpoll_check_fd(CTX,fds,nfds, efd->fd,efd->events);
+        if (revents)
+            efd->func(egc, efd, efd->fd, efd->events, revents);
+    }
+
+    for (;;) {
+        libxl__ev_time *etime = LIBXL_TAILQ_FIRST(&CTX->etimes);
+        if (!etime)
+            break;
+
+        assert(!etime->infinite);
+
+        if (timercmp(&etime->abs, &now, >))
+            break;
+
+        time_deregister(gc, etime);
+
+        etime->func(egc, etime, &etime->abs);
+    }
+
+    CTX_UNLOCK;
+    EGC_FREE;
+}
+
+
+/*
+ * osevent hook and callback machinery
+ */
+
+void libxl_osevent_register_hooks(libxl_ctx *ctx,
+                                  const libxl_osevent_hooks *hooks,
+                                  void *user)
+{
+    GC_INIT(ctx);
+    CTX_LOCK;
+    ctx->osevent_hooks = hooks;
+    ctx->osevent_user = user;
+    CTX_UNLOCK;
+    GC_FREE;
+}
+
+
+void libxl_osevent_occurred_fd(libxl_ctx *ctx, void *for_libxl,
+                               int fd, short events, short revents)
+{
+    libxl__ev_fd *ev = for_libxl;
+
+    EGC_INIT(ctx);
+    CTX_LOCK;
+    assert(!CTX->osevent_in_hook);
+
+    assert(fd == ev->fd);
+    revents &= ev->events;
+    if (revents)
+        ev->func(egc, ev, fd, ev->events, revents);
+
+    CTX_UNLOCK;
+    EGC_FREE;
+}
+
+void libxl_osevent_occurred_timeout(libxl_ctx *ctx, void *for_libxl)
+{
+    libxl__ev_time *ev = for_libxl;
+
+    EGC_INIT(ctx);
+    CTX_LOCK;
+    assert(!CTX->osevent_in_hook);
+
+    assert(!ev->infinite);
+    LIBXL_TAILQ_REMOVE(&CTX->etimes, ev, entry);
+    ev->func(egc, ev, &ev->abs);
+
+    CTX_UNLOCK;
+    EGC_FREE;
+}
+
+void libxl__event_disaster(libxl__egc *egc, const char *msg, int errnoval,
+                           libxl_event_type type /* may be 0 */,
+                           const char *file, int line, const char *func)
+{
+    EGC_GC;
+
+    libxl__log(CTX, XTL_CRITICAL, errnoval, file, line, func,
+               "DISASTER in event loop: %s%s%s%s",
+               msg,
+               type ? " (relates to event type " : "",
+               type ? libxl_event_type_to_string(type) : "",
+               type ? ")" : "");
+
+    /*
+     * FIXME: This should call the "disaster" hook supplied to
+     * libxl_event_register_callbacks, which will be introduced in the
+     * next patch.
+     */
+
+    const char verybad[] =
+        "DISASTER in event loop not handled by libxl application";
+    LIBXL__LOG(CTX, XTL_CRITICAL, verybad);
+    fprintf(stderr, "libxl: fatal error, exiting program: %s\n", verybad);
+    exit(-1);
+}
+
+void libxl__egc_cleanup(libxl__egc *egc)
+{
+    libxl__free_all(&egc->gc);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r f204ead7d9e4 -r b3387ae40371 tools/libxl/libxl_event.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxl/libxl_event.h	Fri Jan 27 17:01:20 2012 +0000
@@ -0,0 +1,205 @@
+/*
+ * Copyright (C) 2011      Citrix Ltd.
+ * Author Ian Jackson <ian.jackson@eu.citrix.com>
+ *
+ * This program 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; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program 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.
+ */
+
+#ifndef LIBXL_EVENT_H
+#define LIBXL_EVENT_H
+
+#include <libxl.h>
+
+
+/*======================================================================*/
+
+/*
+ * OS event handling - passing low-level OS events to libxl
+ *
+ * Event-driven programs must use these facilities to allow libxl
+ * to become aware of readability/writeability of file descriptors
+ * and the occurrence of timeouts.
+ *
+ * There are two approaches available.  The first is appropriate for
+ * simple programs handling reasonably small numbers of domains:
+ *
+ *   for (;;) {
+ *      libxl_osevent_beforepoll(...)
+ *      poll();
+ *      libxl_osevent_afterpoll(...);
+ *      for (;;) {
+ *        r=libxl_event_check(...);
+ *        if (r==LIBXL_NOT_READY) break;
+ *        if (r) handle failure;
+ *        do something with the event;
+ *      }
+ *   }
+ *
+ * The second approach uses libxl_osevent_register_hooks and is
+ * suitable for programs which are already using a callback-based
+ * event library.
+ *
+ * An application may freely mix the two styles of interaction.
+ *
+ * (Callers inside libxl may not call libxl_osevent_... functions.)
+ */
+
+struct pollfd;
+
+/* The caller should provide beforepoll with some space for libxl's
+ * fds, and tell libxl how much space is available by setting *nfds_io.
+ * fds points to the start of this space (and fds may be a pointer into
+ * a larger array, for example, if the application has some fds of
+ * its own that it is interested in).
+ *
+ * On return *nfds_io will in any case have been updated by libxl
+ * according to how many fds libxl wants to poll on.
+ *
+ * If the space was sufficient, libxl fills in fds[0..<new
+ * *nfds_io>] suitably for poll(2), updates *timeout_upd if needed,
+ * and returns ok.
+ *
+ * If space was insufficient, fds[0..<old *nfds_io>] is undefined on
+ * return; *nfds_io on return will be greater than the value on
+ * entry; *timeout_upd may or may not have been updated; and
+ * libxl_osevent_beforepoll returns ERROR_BUFERFULL.  In this case
+ * the application needs to make more space (enough space for
+ * *nfds_io struct pollfd) and then call beforepoll again, before
+ * entering poll(2).  Typically this will involve calling realloc.
+ *
+ * The application may call beforepoll with fds==NULL and
+ * *nfds_io==0 in order to find out how much space is needed.
+ *
+ * *timeout_upd is as for poll(2): it's in milliseconds, and
+ * negative values mean no timeout (infinity).
+ * libxl_osevent_beforepoll will only reduce the timeout, naturally.
+ */
+int libxl_osevent_beforepoll(libxl_ctx *ctx, int *nfds_io,
+                             struct pollfd *fds, int *timeout_upd,
+                             struct timeval now);
+
+/* nfds and fds[0..nfds] must be from the most recent call to
+ * _beforepoll, as modified by poll.  (It is therefore not possible
+ * to have multiple threads simultaneously polling using this
+ * interface.)
+ *
+ * This function actually performs all of the IO and other actions,
+ * and generates events (libxl_event), which are implied by either
+ * (a) the time of day or (b) both (i) the returned information from
+ * _beforepoll, and (ii) the results from poll specified in
+ * fds[0..nfds-1].  Generated events can then be retrieved by
+ * libxl_event_check.
+ */
+void libxl_osevent_afterpoll(libxl_ctx *ctx, int nfds, const struct pollfd *fds,
+                             struct timeval now);
+
+
+typedef struct libxl_osevent_hooks {
+  int (*fd_register)(void *user, int fd, void **for_app_registration_out,
+                     short events, void *for_libxl);
+  int (*fd_modify)(void *user, int fd, void **for_app_registration_update,
+                   short events);
+  void (*fd_deregister)(void *user, int fd, void *for_app_registration);
+  int (*timeout_register)(void *user, void **for_app_registration_out,
+                          struct timeval abs, void *for_libxl);
+  int (*timeout_modify)(void *user, void **for_app_registration_update,
+                         struct timeval abs);
+  void (*timeout_deregister)(void *user, void *for_app_registration);
+} libxl_osevent_hooks;
+
+/* The application which calls register_fd_hooks promises to
+ * maintain a register of fds and timeouts that libxl is interested
+ * in, and make calls into libxl (libxl_osevent_occurred_*)
+ * when those fd events and timeouts occur.  This is more efficient
+ * than _beforepoll/_afterpoll if there are many fds (which can
+ * happen if the same libxl application is managing many domains).
+ *
+ * For an fd event, events is as for poll().  register or modify may
+ * be called with events==0, in which case it must still work
+ * normally, just not generate any events.
+ *
+ * For a timeout event, milliseconds is as for poll().
+ * Specifically, negative values of milliseconds mean NO TIMEOUT.
+ * This is used by libxl to temporarily disable a timeout.
+ *
+ * If the register or modify hook succeeds it may update
+ * *for_app_registration_out/_update and must then return 0.
+ * On entry to register, *for_app_registration_out is always NULL.
+ *
+ * A registration or modification hook may fail, in which case it
+ * must leave the registration state of the fd or timeout unchanged.
+ * It may then either return ERROR_OSEVENT_REG_FAIL or any positive
+ * int.  The value returned will be passed up through libxl and
+ * eventually returned back to the application.  When register
+ * fails, any value stored into *for_registration_out is ignored by
+ * libxl; when modify fails, any changed value stored into
+ * *for_registration_update is honoured by libxl and will be passed
+ * to future modify or deregister calls.
+ *
+ * libxl will only attempt to register one callback for any one fd.
+ * libxl will remember the value stored in *for_app_registration_out
+ * (or *for_app_registration_update) by a successful call to
+ * register (or modify), and pass it to subsequent calls to modify
+ * or deregister.
+ *
+ * register_fd_hooks may be called only once for each libxl_ctx.
+ * libxl may make calls to register/modify/deregister from within
+ * any libxl function (indeed, it will usually call register from
+ * register_event_hooks).  Conversely, the application MUST NOT make
+ * the event occurrence calls (libxl_osevent_occurred_*) into libxl
+ * reentrantly from within libxl (for example, from within the
+ * register/modify functions).
+ *
+ * Lock hierarchy: the register/modify/deregister functions may be
+ * called with locks held.  These locks (the "libxl internal locks")
+ * are inside the libxl_ctx.  Therefore, if those register functions
+ * acquire any locks of their own ("caller register locks") outside
+ * libxl, to avoid deadlock one of the following must hold for each
+ * such caller register lock:
+ *  (a) "acquire libxl internal locks before caller register lock":
+ *      No libxl function may be called with the caller register
+ *      lock held.
+ *  (b) "acquire caller register lock before libxl internal locks":
+ *      No libxl function may be called _without_ the caller
+ *      register lock held.
+ * Of these we would normally recommend (a).
+ *
+ * The value *hooks is not copied and must outlast the libxl_ctx.
+ */
+void libxl_osevent_register_hooks(libxl_ctx *ctx,
+                                  const libxl_osevent_hooks *hooks,
+                                  void *user);
+
+/* It is NOT legal to call _occurred_ reentrantly within any libxl
+ * function.  Specifically it is NOT legal to call it from within
+ * a register callback.  Conversely, libxl MAY call register/deregister
+ * from within libxl_event_registered_call_*.
+ */
+
+void libxl_osevent_occurred_fd(libxl_ctx *ctx, void *for_libxl,
+                               int fd, short events, short revents);
+
+/* Implicitly, on entry to this function the timeout has been
+ * deregistered.  If _occurred_timeout is called, libxl will not
+ * call timeout_deregister; if it wants to requeue the timeout it
+ * will call timeout_register again.
+ */
+void libxl_osevent_occurred_timeout(libxl_ctx *ctx, void *for_libxl);
+
+#endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r f204ead7d9e4 -r b3387ae40371 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:19 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:20 2012 +0000
@@ -35,6 +35,7 @@
 #include <unistd.h>
 
 #include <sys/mman.h>
+#include <sys/poll.h>
 #include <sys/select.h>
 #include <sys/stat.h>
 #include <sys/time.h>
@@ -111,6 +112,71 @@
 
      /* these functions preserve errno (saving and restoring) */
 
+typedef struct libxl__gc libxl__gc;
+typedef struct libxl__egc libxl__egc;
+
+typedef struct libxl__ev_fd libxl__ev_fd;
+typedef void libxl__ev_fd_callback(libxl__egc *egc, libxl__ev_fd *ev,
+                                   int fd, short events, short revents);
+struct libxl__ev_fd {
+    /* caller should include this in their own struct */
+    /* read-only for caller, who may read only when registered: */
+    int fd;
+    short events;
+    libxl__ev_fd_callback *func;
+    /* remainder is private for libxl__ev_fd... */
+    LIBXL_LIST_ENTRY(libxl__ev_fd) entry;
+    void *for_app_reg;
+};
+
+
+typedef struct libxl__ev_time libxl__ev_time;
+typedef void libxl__ev_time_callback(libxl__egc *egc, libxl__ev_time *ev,
+                                     const struct timeval *requested_abs);
+struct libxl__ev_time {
+    /* caller should include this in their own struct */
+    /* read-only for caller, who may read only when registered: */
+    libxl__ev_time_callback *func;
+    /* remainder is private for libxl__ev_time... */
+    int infinite; /* not registered in list or with app if infinite */
+    LIBXL_TAILQ_ENTRY(libxl__ev_time) entry;
+    struct timeval abs;
+    void *for_app_reg;
+};
+
+typedef struct libxl__ev_xswatch libxl__ev_xswatch;
+typedef void libxl__ev_xswatch_callback(libxl__egc *egc, libxl__ev_xswatch*,
+                            const char *watch_path, const char *event_path);
+struct libxl__ev_xswatch {
+    /* caller should include this in their own struct */
+    /* read-only for caller, who may read only when registered: */
+    char *path;
+    libxl__ev_xswatch_callback *callback;
+    /* remainder is private for libxl__ev_xswatch... */
+    int slotnum; /* registered iff slotnum >= 0 */
+    uint32_t counterval;
+};
+
+/*
+ * An entry in the watch_slots table is either:
+ *  1. an entry in the free list, ie NULL or pointer to next free list entry
+ *  2. an pointer to a libxl__ev_xswatch
+ *
+ * But we don't want to use unions or type-punning because the
+ * compiler might "prove" that our code is wrong and misoptimise it.
+ *
+ * The rules say that all struct pointers have identical
+ * representation and alignment requirements (C99+TC1+TC2 6.2.5p26) so
+ * what we do is simply declare our array as containing only the free
+ * list pointers, and explicitly convert from and to our actual
+ * xswatch pointers when we store and retrieve them.
+ */
+typedef struct libxl__ev_watch_slot {
+    LIBXL_SLIST_ENTRY(struct libxl__ev_watch_slot) empty;
+} libxl__ev_watch_slot;
+    
+libxl__ev_xswatch *libxl__watch_slot_contents(libxl__gc *gc, int slotnum);
+
 struct libxl__ctx {
     xentoollog_logger *lg;
     xc_interface *xch;
@@ -129,6 +195,23 @@
        * documented in the libxl public interface.
        */
 
+    int osevent_in_hook;
+    const libxl_osevent_hooks *osevent_hooks;
+    void *osevent_user;
+      /* See the comment for OSEVENT_HOOK_INTERN in libxl_event.c
+       * for restrictions on the use of the osevent fields. */
+
+    int fd_rindex_allocd;
+    int *fd_rindex; /* see libxl_osevent_beforepoll */
+    LIBXL_LIST_HEAD(, libxl__ev_fd) efds;
+    LIBXL_TAILQ_HEAD(, libxl__ev_time) etimes;
+
+    libxl__ev_watch_slot *watch_slots;
+    int watch_nslots;
+    LIBXL_SLIST_HEAD(, libxl__ev_watch_slot) watch_freeslots;
+    uint32_t watch_counter; /* helps disambiguate slot reuse */
+    libxl__ev_fd watch_efd;
+
     /* for callers who reap children willy-nilly; caller must only
      * set this after libxl_init and before any other call - or
      * may leave them untouched */
@@ -159,12 +242,17 @@
 
 #define PRINTF_ATTRIBUTE(x, y) __attribute__((format(printf, x, y)))
 
-typedef struct {
+struct libxl__gc {
     /* mini-GC */
     int alloc_maxsize;
     void **alloc_ptrs;
     libxl_ctx *owner;
-} libxl__gc;
+};
+
+struct libxl__egc {
+    /* for event-generating functions only */
+    struct libxl__gc gc;
+};
 
 #define LIBXL_INIT_GC(gc,ctx) do{               \
         (gc).alloc_maxsize = 0;                 \
@@ -236,6 +324,140 @@
 
 _hidden char *libxl__xs_libxl_path(libxl__gc *gc, uint32_t domid);
 
+
+/*
+ * Event generation functions provided by the libxl event core to the
+ * rest of libxl.  Implemented in terms of _beforepoll/_afterpoll
+ * and/or the fd registration machinery, as provided by the
+ * application.
+ *
+ * Semantics are similar to those of the fd and timeout registration
+ * functions provided to libxl_osevent_register_hooks.
+ *
+ * Non-0 returns from libxl__ev_{modify,deregister} have already been
+ * logged by the core and should be returned unmodified to libxl's
+ * caller; NB that they may be valid libxl error codes but they may
+ * also be positive numbers supplied by the caller.
+ *
+ * In each case, there is a libxl__ev_FOO structure which can be in
+ * one of three states:
+ *
+ *   Undefined   - Might contain anything.  All-bits-zero is
+ *                 an undefined state.
+ *
+ *   Idle        - Struct contents are defined enough to pass to any
+ *                 libxl__ev_FOO function but not registered and
+ *                 callback will not be called.  The struct does not
+ *                 contain references to any allocated resources so
+ *                 can be thrown away.
+ *
+ *   Active      - Request for events has been registered and events
+ *                 may be generated.  _deregister must be called to
+ *                 reclaim resources.
+ *
+ * These functions are provided for each kind of event KIND:
+ *
+ *   int libxl__ev_KIND_register(libxl__gc *gc, libxl__ev_KIND *GEN,
+ *                              libxl__ev_KIND_callback *FUNC,
+ *                              DETAILS);
+ *      On entry *GEN must be in state Undefined or Idle.
+ *      Returns a libxl error code; on error return *GEN is Idle.
+ *      On successful return *GEN is Active and FUNC wil be
+ *      called by the event machinery in future.  FUNC will
+ *      not be called from within the call to _register.
+ *      FUNC will be called with the context locked (with CTX_LOCK).
+ *
+ *  void libxl__ev_KIND_deregister(libxl__gc *gc, libxl__ev_KIND *GEN_upd);
+ *      On entry *GEN must be in state Active or Idle.
+ *      On return it is Idle.  (Idempotent.)
+ *
+ *  void libxl__ev_KIND_init(libxl__ev_KIND *GEN);
+ *      Provided for initialising an Undefined KIND.
+ *      On entry *GEN must be in state Idle or Undefined.
+ *      On return it is Idle.  (Idempotent.)
+ *
+ *  int libxl__ev_KIND_isregistered(const libxl__ev_KIND *GEN);
+ *      On entry *GEN must be Idle or Active.
+ *      Returns nonzero if it is Active, zero otherwise.
+ *      Cannot fail.
+ *
+ *  int libxl__ev_KIND_modify(libxl__gc*, libxl__ev_KIND *GEN,
+ *                            DETAILS);
+ *      Only provided for some kinds of generator.
+ *      On entry *GEN must be Active and on return, whether successful
+ *      or not, it will be Active.
+ *      Returns a libxl error code; on error the modification
+ *      is not effective.
+ *
+ * All of these functions are fully threadsafe and may be called by
+ * general code in libxl even from within event callback FUNCs.
+ * The ctx will be locked on entry to each FUNC and FUNC should not
+ * unlock it.
+ *
+ * Callers of libxl__ev_KIND_register must ensure that the
+ * registration is undone, with _deregister, in libxl_ctx_free.
+ */
+
+
+_hidden int libxl__ev_fd_register(libxl__gc*, libxl__ev_fd *ev_out,
+                                  libxl__ev_fd_callback*,
+                                  int fd, short events /* as for poll(2) */);
+_hidden int libxl__ev_fd_modify(libxl__gc*, libxl__ev_fd *ev,
+                                short events);
+_hidden void libxl__ev_fd_deregister(libxl__gc*, libxl__ev_fd *ev);
+static inline void libxl__ev_fd_init(libxl__ev_fd *efd)
+                    { efd->fd = -1; }
+static inline int libxl__ev_fd_isregistered(libxl__ev_fd *efd)
+                    { return efd->fd >= 0; }
+
+_hidden int libxl__ev_time_register_rel(libxl__gc*, libxl__ev_time *ev_out,
+                                        libxl__ev_time_callback*,
+                                        int milliseconds /* as for poll(2) */);
+_hidden int libxl__ev_time_register_abs(libxl__gc*, libxl__ev_time *ev_out,
+                                        libxl__ev_time_callback*,
+                                        struct timeval);
+_hidden int libxl__ev_time_modify_rel(libxl__gc*, libxl__ev_time *ev,
+                                      int milliseconds /* as for poll(2) */);
+_hidden int libxl__ev_time_modify_abs(libxl__gc*, libxl__ev_time *ev,
+                                      struct timeval);
+_hidden void libxl__ev_time_deregister(libxl__gc*, libxl__ev_time *ev);
+static inline void libxl__ev_time_init(libxl__ev_time *ev)
+                { ev->func = 0; }
+static inline int libxl__ev_time_isregistered(libxl__ev_time *ev)
+                { return !!ev->func; }
+
+
+_hidden int libxl__ev_xswatch_register(libxl__gc*, libxl__ev_xswatch *xsw_out,
+                                       libxl__ev_xswatch_callback*,
+                                       const char *path /* copied */);
+_hidden void libxl__ev_xswatch_deregister(libxl__gc *gc, libxl__ev_xswatch*);
+
+static inline void libxl__ev_xswatch_init(libxl__ev_xswatch *xswatch_out)
+                { xswatch_out->slotnum = -1; }
+static inline int libxl__ev_xswatch_isregistered(const libxl__ev_xswatch *xw)
+                { return xw->slotnum >= 0; }
+
+
+/*
+ * In general, call this via the macro LIBXL__EVENT_DISASTER.
+ *
+ * Event-generating functions may call this if they might have wanted
+ * to generate an event (either an internal one ie a
+ * libxl__ev_FOO_callback or an application event), but are prevented
+ * from doing so due to eg lack of memory.
+ *
+ * NB that this function may return and the caller isn't supposed to
+ * then crash, although it may fail (and henceforth leave things in a
+ * state where many or all calls fail).
+ */
+_hidden void libxl__event_disaster(libxl__egc*, const char *msg, int errnoval,
+                                   libxl_event_type type /* may be 0 */,
+                                   const char *file, int line,
+                                   const char *func);
+#define LIBXL__EVENT_DISASTER(egc, msg, errnoval, type) \
+    libxl__event_disaster(egc, msg, errnoval, type, __FILE__,__LINE__,__func__)
+
+
 /* 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);
@@ -602,6 +824,8 @@
 /* compare mac address @a and @b. 0 if the same, -ve if a<b and +ve if a>b */
 _hidden int libxl__compare_macs(libxl_mac *a, libxl_mac *b);
 
+_hidden int libxl__gettimeofday(libxl__gc *gc, struct timeval *now_r);
+
 #define STRINGIFY(x) #x
 #define TOSTRING(x) STRINGIFY(x)
 
@@ -739,6 +963,55 @@
 
 
 /*
+ * Calling context and GC for event-generating functions:
+ *
+ * These are for use by parts of libxl which directly or indirectly
+ * call libxl__event_occurred.  These contain a gc but also a list of
+ * deferred events.
+ *
+ * You should never need to initialise an egc unless you are part of
+ * the event machinery itself.  Otherwise you will always be given an
+ * egc if you need one.  Even functions which generate specific kinds
+ * of events don't need to - rather, they will be passed an egc into
+ * their own callback function and should just use the one they're
+ * given.
+ *
+ * Functions using LIBXL__INIT_EGC may *not* generally be called from
+ * within libxl, because libxl__egc_cleanup may call back into the
+ * application.  This should be documented near the function
+ * prototype(s) for callers of LIBXL__INIT_EGC and EGC_INIT.  You
+ * should in any case not find it necessary to call egc-creators from
+ * within libxl.
+ *
+ * For the same reason libxl__egc_cleanup (or EGC_FREE) must be called
+ * with the ctx *unlocked*.  So the right pattern has the EGC_...
+ * macro calls on the outside of the CTX_... ones.
+ */
+
+/* useful for all functions which take an egc: */
+
+#define EGC_GC                                  \
+    libxl__gc *const gc = &egc->gc
+
+/* egc initialisation and destruction: */
+
+#define LIBXL_INIT_EGC(egc,ctx) do{             \
+        LIBXL_INIT_GC((egc).gc,ctx);            \
+        /* list of occurred events tbd */       \
+    } while(0)
+
+_hidden void libxl__egc_cleanup(libxl__egc *egc);
+
+/* convenience macros: */
+
+#define EGC_INIT(ctx)                       \
+    libxl__egc egc[1]; LIBXL_INIT_EGC(egc[0],ctx);      \
+    EGC_GC
+
+#define EGC_FREE           libxl__egc_cleanup(egc)
+
+
+/*
  * Convenience macros.
  */
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:55:46 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:55:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6d-0006FX-AR; Fri, 03 Feb 2012 21:55:43 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6c-0006EE-DA
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:42 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1328306135!13337355!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2732 invoked from network); 3 Feb 2012 21:55:36 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:36 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6U-0001hl-WA
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:34 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6T-0002D5-2P
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:33 +0000
Message-Id: <E1RtR6T-0002D5-2P@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:31 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] ocaml,
	libxl: support "private" fields
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327683681 0
# Node ID db9cac5b24897a5a936a516660457ace6043fc22
# Parent  b3387ae40371d8d075218502b456c250d0cb60b1
ocaml, libxl: support "private" fields

The changeset
  24378:b4365e2c2595  libxl: idl: support new "private" type attribute
is not complete.  Actually using this feature does not work because
the ocaml idl generator does not know about it.

So add that support.

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


diff -r b3387ae40371 -r db9cac5b2489 tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py	Fri Jan 27 17:01:20 2012 +0000
+++ b/tools/ocaml/libs/xl/genwrap.py	Fri Jan 27 17:01:21 2012 +0000
@@ -93,6 +93,8 @@
             s += "\t{\n"
             
         for f in ty.fields:
+            if f.type.private:
+                continue
             x = ocaml_instance_of(f.type, f.name)
             x = x.replace("\n", "\n\t\t")
             s += "\t\t" + x + ";\n"
@@ -148,6 +150,8 @@
     elif isinstance(ty, libxltypes.Aggregate) and (parent is None):
         n = 0
         for f in ty.fields:
+            if f.type.private:
+                continue
             s += "%s\n" % c_val(f.type, "%s->%s" % (c, f.name), "Field(%s, %d)" % (o,n), parent="%s->" % (c))
             n = n + 1
     else:
@@ -212,6 +216,8 @@
         
         n = 0
         for f in ty.fields:
+            if f.type.private:
+                continue
             s += "\n"
             s += "\t%s\n" % ocaml_Val(f.type, "%s_field" % ty.rawname, "%s->%s" % (c,f.name), parent="%s->" % c)
             s += "\tStore_field(%s, %d, %s);\n" % (o, n, "%s_field" % ty.rawname)
@@ -290,6 +296,8 @@
     cinc.write(autogen_header("/*", "*/"))
 
     for ty in types:
+        if ty.private:
+            continue
         #sys.stdout.write(" TYPE    %-20s " % ty.rawname)
         ml.write(gen_ocaml_ml(ty, False))
         ml.write("\n")

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:55:46 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:55:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6d-0006FX-AR; Fri, 03 Feb 2012 21:55:43 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6c-0006EE-DA
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:42 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1328306135!13337355!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2732 invoked from network); 3 Feb 2012 21:55:36 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:36 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6U-0001hl-WA
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:34 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6T-0002D5-2P
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:33 +0000
Message-Id: <E1RtR6T-0002D5-2P@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:31 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] ocaml,
	libxl: support "private" fields
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327683681 0
# Node ID db9cac5b24897a5a936a516660457ace6043fc22
# Parent  b3387ae40371d8d075218502b456c250d0cb60b1
ocaml, libxl: support "private" fields

The changeset
  24378:b4365e2c2595  libxl: idl: support new "private" type attribute
is not complete.  Actually using this feature does not work because
the ocaml idl generator does not know about it.

So add that support.

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


diff -r b3387ae40371 -r db9cac5b2489 tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py	Fri Jan 27 17:01:20 2012 +0000
+++ b/tools/ocaml/libs/xl/genwrap.py	Fri Jan 27 17:01:21 2012 +0000
@@ -93,6 +93,8 @@
             s += "\t{\n"
             
         for f in ty.fields:
+            if f.type.private:
+                continue
             x = ocaml_instance_of(f.type, f.name)
             x = x.replace("\n", "\n\t\t")
             s += "\t\t" + x + ";\n"
@@ -148,6 +150,8 @@
     elif isinstance(ty, libxltypes.Aggregate) and (parent is None):
         n = 0
         for f in ty.fields:
+            if f.type.private:
+                continue
             s += "%s\n" % c_val(f.type, "%s->%s" % (c, f.name), "Field(%s, %d)" % (o,n), parent="%s->" % (c))
             n = n + 1
     else:
@@ -212,6 +216,8 @@
         
         n = 0
         for f in ty.fields:
+            if f.type.private:
+                continue
             s += "\n"
             s += "\t%s\n" % ocaml_Val(f.type, "%s_field" % ty.rawname, "%s->%s" % (c,f.name), parent="%s->" % c)
             s += "\tStore_field(%s, %d, %s);\n" % (o, n, "%s_field" % ty.rawname)
@@ -290,6 +296,8 @@
     cinc.write(autogen_header("/*", "*/"))
 
     for ty in types:
+        if ty.private:
+            continue
         #sys.stdout.write(" TYPE    %-20s " % ty.rawname)
         ml.write(gen_ocaml_ml(ty, False))
         ml.write("\n")

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:55:55 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:55:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6m-0006It-Iu; Fri, 03 Feb 2012 21:55:52 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6k-0006G1-Lx
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:51 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1328306142!10016656!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16462 invoked from network); 3 Feb 2012 21:55:43 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:43 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6c-0001hv-Ht
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:42 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6a-0002FQ-Ek
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:41 +0000
Message-Id: <E1RtR6a-0002FQ-Ek@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:39 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Permit multithreaded event
	waiting
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327683683 0
# Node ID cd4bff9d40507cfea619a679f524fafac79a8226
# Parent  d503bdfaba2326b6cc11b45feb660954cc8d9b88
libxl: Permit multithreaded event waiting

Previously, the context would be locked whenever we were waiting in
libxl's own call to poll (waiting for operating system events).

This would mean that multiple simultaneous calls to libxl_event_wait
in different threads with different parameters would not work
properly.

If we simply unlock the context, it would be possible for another
thread to discover the occurrence of the event we were waiting for,
without us even waking up, and we would remain in poll.  So we need a
way to wake up other threads: a pipe, one for each thread in poll.

We also need to move some variables from globals in the ctx to be
per-polling-thread.

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


diff -r d503bdfaba23 -r cd4bff9d4050 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Jan 27 17:01:23 2012 +0000
+++ b/tools/libxl/libxl.c	Fri Jan 27 17:01:23 2012 +0000
@@ -49,8 +49,9 @@
 
     ctx->osevent_hooks = 0;
 
-    ctx->fd_polls = 0;
-    ctx->fd_rindex = 0;
+    LIBXL_LIST_INIT(&ctx->pollers_event);
+    LIBXL_LIST_INIT(&ctx->pollers_idle);
+
     LIBXL_LIST_INIT(&ctx->efds);
     LIBXL_TAILQ_INIT(&ctx->etimes);
 
@@ -61,6 +62,9 @@
     LIBXL_TAILQ_INIT(&ctx->death_list);
     libxl__ev_xswatch_init(&ctx->death_watch);
 
+    rc = libxl__poller_init(ctx, &ctx->poller_app);
+    if (rc) goto out;
+
     if ( stat(XENSTORE_PID_FILE, &stat_buf) != 0 ) {
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Is xenstore daemon running?\n"
                      "failed to stat %s", XENSTORE_PID_FILE);
@@ -135,8 +139,14 @@
     libxl_version_info_dispose(&ctx->version_info);
     if (ctx->xsh) xs_daemon_close(ctx->xsh);
 
-    free(ctx->fd_polls);
-    free(ctx->fd_rindex);
+    libxl__poller_dispose(&ctx->poller_app);
+    assert(LIBXL_LIST_EMPTY(&ctx->pollers_event));
+    libxl__poller *poller, *poller_tmp;
+    LIBXL_LIST_FOREACH_SAFE(poller, &ctx->pollers_idle, entry, poller_tmp) {
+        libxl__poller_dispose(poller);
+        free(poller);
+    }
+
     free(ctx->watch_slots);
 
     discard_events(&ctx->occurred);
diff -r d503bdfaba23 -r cd4bff9d4050 tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c	Fri Jan 27 17:01:23 2012 +0000
+++ b/tools/libxl/libxl_event.c	Fri Jan 27 17:01:23 2012 +0000
@@ -510,9 +510,9 @@
  * osevent poll
  */
 
-static int beforepoll_internal(libxl__gc *gc, int *nfds_io,
-                               struct pollfd *fds, int *timeout_upd,
-                               struct timeval now)
+static int beforepoll_internal(libxl__gc *gc, libxl__poller *poller,
+                               int *nfds_io, struct pollfd *fds,
+                               int *timeout_upd, struct timeval now)
 {
     libxl__ev_fd *efd;
     int rc;
@@ -534,7 +534,7 @@
          * not to mess with fd_rindex.
          */
 
-        int maxfd = 0;
+        int maxfd = poller->wakeup_pipe[0] + 1;
         LIBXL_LIST_FOREACH(efd, &CTX->efds, entry) {
             if (!efd->events)
                 continue;
@@ -542,30 +542,39 @@
                 maxfd = efd->fd + 1;
         }
         /* make sure our array is as big as *nfds_io */
-        if (CTX->fd_rindex_allocd < maxfd) {
+        if (poller->fd_rindex_allocd < maxfd) {
             assert(maxfd < INT_MAX / sizeof(int) / 2);
-            int *newarray = realloc(CTX->fd_rindex, sizeof(int) * maxfd);
+            int *newarray = realloc(poller->fd_rindex, sizeof(int) * maxfd);
             if (!newarray) { rc = ERROR_NOMEM; goto out; }
-            memset(newarray + CTX->fd_rindex_allocd, 0,
-                   sizeof(int) * (maxfd - CTX->fd_rindex_allocd));
-            CTX->fd_rindex = newarray;
-            CTX->fd_rindex_allocd = maxfd;
+            memset(newarray + poller->fd_rindex_allocd, 0,
+                   sizeof(int) * (maxfd - poller->fd_rindex_allocd));
+            poller->fd_rindex = newarray;
+            poller->fd_rindex_allocd = maxfd;
         }
     }
 
     int used = 0;
-    LIBXL_LIST_FOREACH(efd, &CTX->efds, entry) {
-        if (!efd->events)
-            continue;
-        if (used < *nfds_io) {
-            fds[used].fd = efd->fd;
-            fds[used].events = efd->events;
-            fds[used].revents = 0;
-            assert(efd->fd < CTX->fd_rindex_allocd);
-            CTX->fd_rindex[efd->fd] = used;
-        }
-        used++;
-    }
+
+#define REQUIRE_FD(req_fd, req_events, efd) do{                 \
+        if ((req_events)) {                                     \
+            if (used < *nfds_io) {                              \
+                fds[used].fd = (req_fd);                        \
+                fds[used].events = (req_events);                \
+                fds[used].revents = 0;                          \
+                assert((req_fd) < poller->fd_rindex_allocd);    \
+                poller->fd_rindex[(req_fd)] = used;             \
+            }                                                   \
+            used++;                                             \
+        }                                                       \
+    }while(0)
+
+    LIBXL_LIST_FOREACH(efd, &CTX->efds, entry)
+        REQUIRE_FD(efd->fd, efd->events, efd);
+
+    REQUIRE_FD(poller->wakeup_pipe[0], POLLIN, 0);
+
+#undef REQUIRE_FD
+
     rc = used <= *nfds_io ? 0 : ERROR_BUFFERFULL;
 
     *nfds_io = used;
@@ -599,22 +608,23 @@
 {
     EGC_INIT(ctx);
     CTX_LOCK;
-    int rc = beforepoll_internal(gc, nfds_io, fds, timeout_upd, now);
+    int rc = beforepoll_internal(gc, &ctx->poller_app,
+                                 nfds_io, fds, timeout_upd, now);
     CTX_UNLOCK;
     EGC_FREE;
     return rc;
 }
 
-static int afterpoll_check_fd(libxl_ctx *ctx,
+static int afterpoll_check_fd(libxl__poller *poller,
                               const struct pollfd *fds, int nfds,
                               int fd, int events)
     /* returns mask of events which were requested and occurred */
 {
-    if (fd >= ctx->fd_rindex_allocd)
+    if (fd >= poller->fd_rindex_allocd)
         /* added after we went into poll, have to try again */
         return 0;
 
-    int slot = ctx->fd_rindex[fd];
+    int slot = poller->fd_rindex[fd];
 
     if (slot >= nfds)
         /* stale slot entry; again, added afterwards */
@@ -630,22 +640,31 @@
     return revents;
 }
 
-static void afterpoll_internal(libxl__egc *egc,
+static void afterpoll_internal(libxl__egc *egc, libxl__poller *poller,
                                int nfds, const struct pollfd *fds,
                                struct timeval now)
 {
     EGC_GC;
     libxl__ev_fd *efd;
 
+
     LIBXL_LIST_FOREACH(efd, &CTX->efds, entry) {
         if (!efd->events)
             continue;
 
-        int revents = afterpoll_check_fd(CTX,fds,nfds, efd->fd,efd->events);
+        int revents = afterpoll_check_fd(poller,fds,nfds, efd->fd,efd->events);
         if (revents)
             efd->func(egc, efd, efd->fd, efd->events, revents);
     }
 
+    if (afterpoll_check_fd(poller,fds,nfds, poller->wakeup_pipe[0],POLLIN)) {
+        char buf[256];
+        int r = read(poller->wakeup_pipe[0], buf, sizeof(buf));
+        if (r < 0)
+            if (errno != EINTR && errno != EWOULDBLOCK)
+                LIBXL__EVENT_DISASTER(egc, "read wakeup", errno, 0);
+    }
+
     for (;;) {
         libxl__ev_time *etime = LIBXL_TAILQ_FIRST(&CTX->etimes);
         if (!etime)
@@ -667,7 +686,7 @@
 {
     EGC_INIT(ctx);
     CTX_LOCK;
-    afterpoll_internal(egc, nfds, fds, now);
+    afterpoll_internal(egc, &ctx->poller_app, nfds, fds, now);
     CTX_UNLOCK;
     EGC_FREE;
 }
@@ -790,7 +809,10 @@
         LIBXL_TAILQ_INSERT_TAIL(&egc->occurred_for_callback, event, link);
         return;
     } else {
+        libxl__poller *poller;
         LIBXL_TAILQ_INSERT_TAIL(&CTX->occurred, event, link);
+        LIBXL_LIST_FOREACH(poller, &CTX->pollers_event, entry)
+            libxl__poller_wakeup(egc, poller);
     }
 }
 
@@ -858,7 +880,94 @@
     return rc;
 }
 
-static int eventloop_iteration(libxl__egc *egc) {
+/*
+ * Manipulation of pollers
+ */
+
+int libxl__poller_init(libxl_ctx *ctx, libxl__poller *p)
+{
+    int r, rc;
+    p->fd_polls = 0;
+    p->fd_rindex = 0;
+
+    r = pipe(p->wakeup_pipe);
+    if (r) {
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "cannot create poller pipe");
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
+    rc = libxl_fd_set_nonblock(ctx, p->wakeup_pipe[0], 1);
+    if (rc) goto out;
+
+    rc = libxl_fd_set_nonblock(ctx, p->wakeup_pipe[1], 1);
+    if (rc) goto out;
+
+    return 0;
+
+ out:
+    libxl__poller_dispose(p);
+    return rc;
+}
+
+void libxl__poller_dispose(libxl__poller *p)
+{
+    if (p->wakeup_pipe[1] > 0) close(p->wakeup_pipe[1]);
+    if (p->wakeup_pipe[0] > 0) close(p->wakeup_pipe[0]);
+    free(p->fd_polls);
+    free(p->fd_rindex);
+}
+
+libxl__poller *libxl__poller_get(libxl_ctx *ctx)
+{
+    /* must be called with ctx locked */
+    int rc;
+
+    libxl__poller *p = LIBXL_LIST_FIRST(&ctx->pollers_idle);
+    if (p)
+        return p;
+
+    p = malloc(sizeof(*p));
+    if (!p) {
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "cannot allocate poller");
+        return 0;
+    }
+    memset(p, 0, sizeof(*p));
+
+    rc = libxl__poller_init(ctx, p);
+    if (rc) return NULL;
+
+    return p;
+}
+
+void libxl__poller_put(libxl_ctx *ctx, libxl__poller *p)
+{
+    LIBXL_LIST_INSERT_HEAD(&ctx->pollers_idle, p, entry);
+}
+
+void libxl__poller_wakeup(libxl__egc *egc, libxl__poller *p)
+{
+    static const char buf[1] = "";
+
+    for (;;) {
+        int r = write(p->wakeup_pipe[1], buf, 1);
+        if (r==1) return;
+        assert(r==-1);
+        if (errno == EINTR) continue;
+        if (errno == EWOULDBLOCK) return;
+        LIBXL__EVENT_DISASTER(egc, "cannot poke watch pipe", errno, 0);
+        return;
+    }
+}
+
+/*
+ * Main event loop iteration
+ */
+
+static int eventloop_iteration(libxl__egc *egc, libxl__poller *poller) {
+    /* The CTX must be locked EXACTLY ONCE so that this function
+     * can unlock it when it polls.
+     */
     EGC_GC;
     int rc;
     struct timeval now;
@@ -871,23 +980,27 @@
     int timeout;
 
     for (;;) {
-        int nfds = CTX->fd_polls_allocd;
+        int nfds = poller->fd_polls_allocd;
         timeout = -1;
-        rc = beforepoll_internal(gc, &nfds, CTX->fd_polls, &timeout, now);
+        rc = beforepoll_internal(gc, poller, &nfds, poller->fd_polls,
+                                 &timeout, now);
         if (!rc) break;
         if (rc != ERROR_BUFFERFULL) goto out;
 
         struct pollfd *newarray =
             (nfds > INT_MAX / sizeof(struct pollfd) / 2) ? 0 :
-            realloc(CTX->fd_polls, sizeof(*newarray) * nfds);
+            realloc(poller->fd_polls, sizeof(*newarray) * nfds);
 
         if (!newarray) { rc = ERROR_NOMEM; goto out; }
 
-        CTX->fd_polls = newarray;
-        CTX->fd_polls_allocd = nfds;
+        poller->fd_polls = newarray;
+        poller->fd_polls_allocd = nfds;
     }
 
-    rc = poll(CTX->fd_polls, CTX->fd_polls_allocd, timeout);
+    CTX_UNLOCK;
+    rc = poll(poller->fd_polls, poller->fd_polls_allocd, timeout);
+    CTX_LOCK;
+
     if (rc < 0) {
         if (errno == EINTR)
             return 0; /* will go round again if caller requires */
@@ -900,7 +1013,8 @@
     rc = libxl__gettimeofday(gc, &now);
     if (rc) goto out;
 
-    afterpoll_internal(egc, CTX->fd_polls_allocd, CTX->fd_polls, now);
+    afterpoll_internal(egc, poller,
+                       poller->fd_polls_allocd, poller->fd_polls, now);
 
     CTX_UNLOCK;
 
@@ -914,15 +1028,19 @@
                      libxl_event_predicate *pred, void *pred_user)
 {
     int rc;
+    libxl__poller *poller = NULL;
 
     EGC_INIT(ctx);
     CTX_LOCK;
 
+    poller = libxl__poller_get(ctx);
+    if (!poller) { rc = ERROR_FAIL; goto out; }
+
     for (;;) {
         rc = event_check_internal(egc, event_r, typemask, pred, pred_user);
         if (rc != ERROR_NOT_READY) goto out;
 
-        rc = eventloop_iteration(egc);
+        rc = eventloop_iteration(egc, poller);
         if (rc) goto out;
 
         /* we unlock and cleanup the egc each time we go through this loop,
@@ -936,6 +1054,8 @@
     }
 
  out:
+    libxl__poller_put(ctx, poller);
+
     CTX_UNLOCK;
     EGC_FREE;
     return rc;
diff -r d503bdfaba23 -r cd4bff9d4050 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:23 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:23 2012 +0000
@@ -207,6 +207,33 @@
 _hidden void
 libxl__evdisable_disk_eject(libxl__gc*, libxl_evgen_disk_eject*);
 
+typedef struct libxl__poller libxl__poller;
+struct libxl__poller {
+    /*
+     * These are used to allow other threads to wake up a thread which
+     * may be stuck in poll, because whatever it was waiting for
+     * hadn't happened yet.  Threads which generate events will write
+     * a byte to each pipe.  A thread which is waiting will empty its
+     * own pipe, and put its poller on the pollers_event list, before
+     * releasing the ctx lock and going into poll; when it comes out
+     * of poll it will take the poller off the pollers_event list.
+     *
+     * When a thread is done with a poller it should put it onto
+     * pollers_idle, where it can be reused later.
+     *
+     * The "poller_app" is never idle, but is sometimes on
+     * pollers_event.
+     */
+    LIBXL_LIST_ENTRY(libxl__poller) entry;
+
+    struct pollfd *fd_polls;
+    int fd_polls_allocd;
+
+    int fd_rindex_allocd;
+    int *fd_rindex; /* see libxl_osevent_beforepoll */
+
+    int wakeup_pipe[2]; /* 0 means no fd allocated */
+};
 
 struct libxl__ctx {
     xentoollog_logger *lg;
@@ -237,10 +264,9 @@
       /* See the comment for OSEVENT_HOOK_INTERN in libxl_event.c
        * for restrictions on the use of the osevent fields. */
 
-    struct pollfd *fd_polls;
-    int fd_polls_allocd;
-    int fd_rindex_allocd;
-    int *fd_rindex; /* see libxl_osevent_beforepoll */
+    libxl__poller poller_app; /* libxl_osevent_beforepoll and _afterpoll */
+    LIBXL_LIST_HEAD(, libxl__poller) pollers_event, pollers_idle;
+
     LIBXL_LIST_HEAD(, libxl__ev_fd) efds;
     LIBXL_TAILQ_HEAD(, libxl__ev_time) etimes;
 
@@ -526,6 +552,22 @@
     libxl__event_disaster(egc, msg, errnoval, type, __FILE__,__LINE__,__func__)
 
 
+/* Fills in, or disposes of, the resources held by, a poller whose
+ * space the caller has allocated.  ctx must be locked. */
+int libxl__poller_init(libxl_ctx *ctx, libxl__poller *p);
+void libxl__poller_dispose(libxl__poller *p);
+
+/* Obtain a fresh poller from malloc or the idle list, and put it
+ * away again afterwards.  _get can fail, returning NULL.
+ * ctx must be locked. */
+libxl__poller *libxl__poller_get(libxl_ctx *ctx);
+void libxl__poller_put(libxl_ctx *ctx, libxl__poller *p);
+
+/* Notifies whoever is polling using p that they should wake up.
+ * ctx must be locked. */
+void libxl__poller_wakeup(libxl__egc *egc, libxl__poller *p);
+
+
 /* 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);

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:55:55 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:55:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6m-0006It-Iu; Fri, 03 Feb 2012 21:55:52 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6k-0006G1-Lx
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:51 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1328306142!10016656!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16462 invoked from network); 3 Feb 2012 21:55:43 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:43 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6c-0001hv-Ht
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:42 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6a-0002FQ-Ek
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:41 +0000
Message-Id: <E1RtR6a-0002FQ-Ek@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:39 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Permit multithreaded event
	waiting
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327683683 0
# Node ID cd4bff9d40507cfea619a679f524fafac79a8226
# Parent  d503bdfaba2326b6cc11b45feb660954cc8d9b88
libxl: Permit multithreaded event waiting

Previously, the context would be locked whenever we were waiting in
libxl's own call to poll (waiting for operating system events).

This would mean that multiple simultaneous calls to libxl_event_wait
in different threads with different parameters would not work
properly.

If we simply unlock the context, it would be possible for another
thread to discover the occurrence of the event we were waiting for,
without us even waking up, and we would remain in poll.  So we need a
way to wake up other threads: a pipe, one for each thread in poll.

We also need to move some variables from globals in the ctx to be
per-polling-thread.

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


diff -r d503bdfaba23 -r cd4bff9d4050 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Jan 27 17:01:23 2012 +0000
+++ b/tools/libxl/libxl.c	Fri Jan 27 17:01:23 2012 +0000
@@ -49,8 +49,9 @@
 
     ctx->osevent_hooks = 0;
 
-    ctx->fd_polls = 0;
-    ctx->fd_rindex = 0;
+    LIBXL_LIST_INIT(&ctx->pollers_event);
+    LIBXL_LIST_INIT(&ctx->pollers_idle);
+
     LIBXL_LIST_INIT(&ctx->efds);
     LIBXL_TAILQ_INIT(&ctx->etimes);
 
@@ -61,6 +62,9 @@
     LIBXL_TAILQ_INIT(&ctx->death_list);
     libxl__ev_xswatch_init(&ctx->death_watch);
 
+    rc = libxl__poller_init(ctx, &ctx->poller_app);
+    if (rc) goto out;
+
     if ( stat(XENSTORE_PID_FILE, &stat_buf) != 0 ) {
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Is xenstore daemon running?\n"
                      "failed to stat %s", XENSTORE_PID_FILE);
@@ -135,8 +139,14 @@
     libxl_version_info_dispose(&ctx->version_info);
     if (ctx->xsh) xs_daemon_close(ctx->xsh);
 
-    free(ctx->fd_polls);
-    free(ctx->fd_rindex);
+    libxl__poller_dispose(&ctx->poller_app);
+    assert(LIBXL_LIST_EMPTY(&ctx->pollers_event));
+    libxl__poller *poller, *poller_tmp;
+    LIBXL_LIST_FOREACH_SAFE(poller, &ctx->pollers_idle, entry, poller_tmp) {
+        libxl__poller_dispose(poller);
+        free(poller);
+    }
+
     free(ctx->watch_slots);
 
     discard_events(&ctx->occurred);
diff -r d503bdfaba23 -r cd4bff9d4050 tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c	Fri Jan 27 17:01:23 2012 +0000
+++ b/tools/libxl/libxl_event.c	Fri Jan 27 17:01:23 2012 +0000
@@ -510,9 +510,9 @@
  * osevent poll
  */
 
-static int beforepoll_internal(libxl__gc *gc, int *nfds_io,
-                               struct pollfd *fds, int *timeout_upd,
-                               struct timeval now)
+static int beforepoll_internal(libxl__gc *gc, libxl__poller *poller,
+                               int *nfds_io, struct pollfd *fds,
+                               int *timeout_upd, struct timeval now)
 {
     libxl__ev_fd *efd;
     int rc;
@@ -534,7 +534,7 @@
          * not to mess with fd_rindex.
          */
 
-        int maxfd = 0;
+        int maxfd = poller->wakeup_pipe[0] + 1;
         LIBXL_LIST_FOREACH(efd, &CTX->efds, entry) {
             if (!efd->events)
                 continue;
@@ -542,30 +542,39 @@
                 maxfd = efd->fd + 1;
         }
         /* make sure our array is as big as *nfds_io */
-        if (CTX->fd_rindex_allocd < maxfd) {
+        if (poller->fd_rindex_allocd < maxfd) {
             assert(maxfd < INT_MAX / sizeof(int) / 2);
-            int *newarray = realloc(CTX->fd_rindex, sizeof(int) * maxfd);
+            int *newarray = realloc(poller->fd_rindex, sizeof(int) * maxfd);
             if (!newarray) { rc = ERROR_NOMEM; goto out; }
-            memset(newarray + CTX->fd_rindex_allocd, 0,
-                   sizeof(int) * (maxfd - CTX->fd_rindex_allocd));
-            CTX->fd_rindex = newarray;
-            CTX->fd_rindex_allocd = maxfd;
+            memset(newarray + poller->fd_rindex_allocd, 0,
+                   sizeof(int) * (maxfd - poller->fd_rindex_allocd));
+            poller->fd_rindex = newarray;
+            poller->fd_rindex_allocd = maxfd;
         }
     }
 
     int used = 0;
-    LIBXL_LIST_FOREACH(efd, &CTX->efds, entry) {
-        if (!efd->events)
-            continue;
-        if (used < *nfds_io) {
-            fds[used].fd = efd->fd;
-            fds[used].events = efd->events;
-            fds[used].revents = 0;
-            assert(efd->fd < CTX->fd_rindex_allocd);
-            CTX->fd_rindex[efd->fd] = used;
-        }
-        used++;
-    }
+
+#define REQUIRE_FD(req_fd, req_events, efd) do{                 \
+        if ((req_events)) {                                     \
+            if (used < *nfds_io) {                              \
+                fds[used].fd = (req_fd);                        \
+                fds[used].events = (req_events);                \
+                fds[used].revents = 0;                          \
+                assert((req_fd) < poller->fd_rindex_allocd);    \
+                poller->fd_rindex[(req_fd)] = used;             \
+            }                                                   \
+            used++;                                             \
+        }                                                       \
+    }while(0)
+
+    LIBXL_LIST_FOREACH(efd, &CTX->efds, entry)
+        REQUIRE_FD(efd->fd, efd->events, efd);
+
+    REQUIRE_FD(poller->wakeup_pipe[0], POLLIN, 0);
+
+#undef REQUIRE_FD
+
     rc = used <= *nfds_io ? 0 : ERROR_BUFFERFULL;
 
     *nfds_io = used;
@@ -599,22 +608,23 @@
 {
     EGC_INIT(ctx);
     CTX_LOCK;
-    int rc = beforepoll_internal(gc, nfds_io, fds, timeout_upd, now);
+    int rc = beforepoll_internal(gc, &ctx->poller_app,
+                                 nfds_io, fds, timeout_upd, now);
     CTX_UNLOCK;
     EGC_FREE;
     return rc;
 }
 
-static int afterpoll_check_fd(libxl_ctx *ctx,
+static int afterpoll_check_fd(libxl__poller *poller,
                               const struct pollfd *fds, int nfds,
                               int fd, int events)
     /* returns mask of events which were requested and occurred */
 {
-    if (fd >= ctx->fd_rindex_allocd)
+    if (fd >= poller->fd_rindex_allocd)
         /* added after we went into poll, have to try again */
         return 0;
 
-    int slot = ctx->fd_rindex[fd];
+    int slot = poller->fd_rindex[fd];
 
     if (slot >= nfds)
         /* stale slot entry; again, added afterwards */
@@ -630,22 +640,31 @@
     return revents;
 }
 
-static void afterpoll_internal(libxl__egc *egc,
+static void afterpoll_internal(libxl__egc *egc, libxl__poller *poller,
                                int nfds, const struct pollfd *fds,
                                struct timeval now)
 {
     EGC_GC;
     libxl__ev_fd *efd;
 
+
     LIBXL_LIST_FOREACH(efd, &CTX->efds, entry) {
         if (!efd->events)
             continue;
 
-        int revents = afterpoll_check_fd(CTX,fds,nfds, efd->fd,efd->events);
+        int revents = afterpoll_check_fd(poller,fds,nfds, efd->fd,efd->events);
         if (revents)
             efd->func(egc, efd, efd->fd, efd->events, revents);
     }
 
+    if (afterpoll_check_fd(poller,fds,nfds, poller->wakeup_pipe[0],POLLIN)) {
+        char buf[256];
+        int r = read(poller->wakeup_pipe[0], buf, sizeof(buf));
+        if (r < 0)
+            if (errno != EINTR && errno != EWOULDBLOCK)
+                LIBXL__EVENT_DISASTER(egc, "read wakeup", errno, 0);
+    }
+
     for (;;) {
         libxl__ev_time *etime = LIBXL_TAILQ_FIRST(&CTX->etimes);
         if (!etime)
@@ -667,7 +686,7 @@
 {
     EGC_INIT(ctx);
     CTX_LOCK;
-    afterpoll_internal(egc, nfds, fds, now);
+    afterpoll_internal(egc, &ctx->poller_app, nfds, fds, now);
     CTX_UNLOCK;
     EGC_FREE;
 }
@@ -790,7 +809,10 @@
         LIBXL_TAILQ_INSERT_TAIL(&egc->occurred_for_callback, event, link);
         return;
     } else {
+        libxl__poller *poller;
         LIBXL_TAILQ_INSERT_TAIL(&CTX->occurred, event, link);
+        LIBXL_LIST_FOREACH(poller, &CTX->pollers_event, entry)
+            libxl__poller_wakeup(egc, poller);
     }
 }
 
@@ -858,7 +880,94 @@
     return rc;
 }
 
-static int eventloop_iteration(libxl__egc *egc) {
+/*
+ * Manipulation of pollers
+ */
+
+int libxl__poller_init(libxl_ctx *ctx, libxl__poller *p)
+{
+    int r, rc;
+    p->fd_polls = 0;
+    p->fd_rindex = 0;
+
+    r = pipe(p->wakeup_pipe);
+    if (r) {
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "cannot create poller pipe");
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
+    rc = libxl_fd_set_nonblock(ctx, p->wakeup_pipe[0], 1);
+    if (rc) goto out;
+
+    rc = libxl_fd_set_nonblock(ctx, p->wakeup_pipe[1], 1);
+    if (rc) goto out;
+
+    return 0;
+
+ out:
+    libxl__poller_dispose(p);
+    return rc;
+}
+
+void libxl__poller_dispose(libxl__poller *p)
+{
+    if (p->wakeup_pipe[1] > 0) close(p->wakeup_pipe[1]);
+    if (p->wakeup_pipe[0] > 0) close(p->wakeup_pipe[0]);
+    free(p->fd_polls);
+    free(p->fd_rindex);
+}
+
+libxl__poller *libxl__poller_get(libxl_ctx *ctx)
+{
+    /* must be called with ctx locked */
+    int rc;
+
+    libxl__poller *p = LIBXL_LIST_FIRST(&ctx->pollers_idle);
+    if (p)
+        return p;
+
+    p = malloc(sizeof(*p));
+    if (!p) {
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "cannot allocate poller");
+        return 0;
+    }
+    memset(p, 0, sizeof(*p));
+
+    rc = libxl__poller_init(ctx, p);
+    if (rc) return NULL;
+
+    return p;
+}
+
+void libxl__poller_put(libxl_ctx *ctx, libxl__poller *p)
+{
+    LIBXL_LIST_INSERT_HEAD(&ctx->pollers_idle, p, entry);
+}
+
+void libxl__poller_wakeup(libxl__egc *egc, libxl__poller *p)
+{
+    static const char buf[1] = "";
+
+    for (;;) {
+        int r = write(p->wakeup_pipe[1], buf, 1);
+        if (r==1) return;
+        assert(r==-1);
+        if (errno == EINTR) continue;
+        if (errno == EWOULDBLOCK) return;
+        LIBXL__EVENT_DISASTER(egc, "cannot poke watch pipe", errno, 0);
+        return;
+    }
+}
+
+/*
+ * Main event loop iteration
+ */
+
+static int eventloop_iteration(libxl__egc *egc, libxl__poller *poller) {
+    /* The CTX must be locked EXACTLY ONCE so that this function
+     * can unlock it when it polls.
+     */
     EGC_GC;
     int rc;
     struct timeval now;
@@ -871,23 +980,27 @@
     int timeout;
 
     for (;;) {
-        int nfds = CTX->fd_polls_allocd;
+        int nfds = poller->fd_polls_allocd;
         timeout = -1;
-        rc = beforepoll_internal(gc, &nfds, CTX->fd_polls, &timeout, now);
+        rc = beforepoll_internal(gc, poller, &nfds, poller->fd_polls,
+                                 &timeout, now);
         if (!rc) break;
         if (rc != ERROR_BUFFERFULL) goto out;
 
         struct pollfd *newarray =
             (nfds > INT_MAX / sizeof(struct pollfd) / 2) ? 0 :
-            realloc(CTX->fd_polls, sizeof(*newarray) * nfds);
+            realloc(poller->fd_polls, sizeof(*newarray) * nfds);
 
         if (!newarray) { rc = ERROR_NOMEM; goto out; }
 
-        CTX->fd_polls = newarray;
-        CTX->fd_polls_allocd = nfds;
+        poller->fd_polls = newarray;
+        poller->fd_polls_allocd = nfds;
     }
 
-    rc = poll(CTX->fd_polls, CTX->fd_polls_allocd, timeout);
+    CTX_UNLOCK;
+    rc = poll(poller->fd_polls, poller->fd_polls_allocd, timeout);
+    CTX_LOCK;
+
     if (rc < 0) {
         if (errno == EINTR)
             return 0; /* will go round again if caller requires */
@@ -900,7 +1013,8 @@
     rc = libxl__gettimeofday(gc, &now);
     if (rc) goto out;
 
-    afterpoll_internal(egc, CTX->fd_polls_allocd, CTX->fd_polls, now);
+    afterpoll_internal(egc, poller,
+                       poller->fd_polls_allocd, poller->fd_polls, now);
 
     CTX_UNLOCK;
 
@@ -914,15 +1028,19 @@
                      libxl_event_predicate *pred, void *pred_user)
 {
     int rc;
+    libxl__poller *poller = NULL;
 
     EGC_INIT(ctx);
     CTX_LOCK;
 
+    poller = libxl__poller_get(ctx);
+    if (!poller) { rc = ERROR_FAIL; goto out; }
+
     for (;;) {
         rc = event_check_internal(egc, event_r, typemask, pred, pred_user);
         if (rc != ERROR_NOT_READY) goto out;
 
-        rc = eventloop_iteration(egc);
+        rc = eventloop_iteration(egc, poller);
         if (rc) goto out;
 
         /* we unlock and cleanup the egc each time we go through this loop,
@@ -936,6 +1054,8 @@
     }
 
  out:
+    libxl__poller_put(ctx, poller);
+
     CTX_UNLOCK;
     EGC_FREE;
     return rc;
diff -r d503bdfaba23 -r cd4bff9d4050 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:23 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:23 2012 +0000
@@ -207,6 +207,33 @@
 _hidden void
 libxl__evdisable_disk_eject(libxl__gc*, libxl_evgen_disk_eject*);
 
+typedef struct libxl__poller libxl__poller;
+struct libxl__poller {
+    /*
+     * These are used to allow other threads to wake up a thread which
+     * may be stuck in poll, because whatever it was waiting for
+     * hadn't happened yet.  Threads which generate events will write
+     * a byte to each pipe.  A thread which is waiting will empty its
+     * own pipe, and put its poller on the pollers_event list, before
+     * releasing the ctx lock and going into poll; when it comes out
+     * of poll it will take the poller off the pollers_event list.
+     *
+     * When a thread is done with a poller it should put it onto
+     * pollers_idle, where it can be reused later.
+     *
+     * The "poller_app" is never idle, but is sometimes on
+     * pollers_event.
+     */
+    LIBXL_LIST_ENTRY(libxl__poller) entry;
+
+    struct pollfd *fd_polls;
+    int fd_polls_allocd;
+
+    int fd_rindex_allocd;
+    int *fd_rindex; /* see libxl_osevent_beforepoll */
+
+    int wakeup_pipe[2]; /* 0 means no fd allocated */
+};
 
 struct libxl__ctx {
     xentoollog_logger *lg;
@@ -237,10 +264,9 @@
       /* See the comment for OSEVENT_HOOK_INTERN in libxl_event.c
        * for restrictions on the use of the osevent fields. */
 
-    struct pollfd *fd_polls;
-    int fd_polls_allocd;
-    int fd_rindex_allocd;
-    int *fd_rindex; /* see libxl_osevent_beforepoll */
+    libxl__poller poller_app; /* libxl_osevent_beforepoll and _afterpoll */
+    LIBXL_LIST_HEAD(, libxl__poller) pollers_event, pollers_idle;
+
     LIBXL_LIST_HEAD(, libxl__ev_fd) efds;
     LIBXL_TAILQ_HEAD(, libxl__ev_time) etimes;
 
@@ -526,6 +552,22 @@
     libxl__event_disaster(egc, msg, errnoval, type, __FILE__,__LINE__,__func__)
 
 
+/* Fills in, or disposes of, the resources held by, a poller whose
+ * space the caller has allocated.  ctx must be locked. */
+int libxl__poller_init(libxl_ctx *ctx, libxl__poller *p);
+void libxl__poller_dispose(libxl__poller *p);
+
+/* Obtain a fresh poller from malloc or the idle list, and put it
+ * away again afterwards.  _get can fail, returning NULL.
+ * ctx must be locked. */
+libxl__poller *libxl__poller_get(libxl_ctx *ctx);
+void libxl__poller_put(libxl_ctx *ctx, libxl__poller *p);
+
+/* Notifies whoever is polling using p that they should wake up.
+ * ctx must be locked. */
+void libxl__poller_wakeup(libxl__egc *egc, libxl__poller *p);
+
+
 /* 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);

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:55:58 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:55:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6p-0006KE-M0; Fri, 03 Feb 2012 21:55:55 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6o-0006Ht-7y
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:54 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-174.messagelabs.com!1328306145!11764436!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20288 invoked from network); 3 Feb 2012 21:55:47 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:47 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6f-0001hz-Pn
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:45 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6d-0002GW-Fp
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:45 +0000
Message-Id: <E1RtR6d-0002GW-Fp@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:42 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Asynchronous/long-running
	operation infrastructure
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327683684 0
# Node ID 03152893aba021053da70573a58449bcfcca4b88
# Parent  cd4bff9d40507cfea619a679f524fafac79a8226
libxl: Asynchronous/long-running operation infrastructure

Provide a new set of machinery for writing public libxl functions
which may take a long time.  The application gets to decide whether
they want the function to be synchronous, or whether they'd prefer to
get a callback, or an event, when the operation is complete.

User(s) of this machinery will be introduced in later patch(es).

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


diff -r cd4bff9d4050 -r 03152893aba0 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Fri Jan 27 17:01:23 2012 +0000
+++ b/tools/libxl/libxl.h	Fri Jan 27 17:01:24 2012 +0000
@@ -237,6 +237,59 @@
     ERROR_BUFFERFULL = -13,
 };
 
+
+/*
+ * Some libxl operations can take a long time.  These functions take a
+ * parameter to control their concurrency:
+ *     libxl_asyncop_how *ao_how
+ *
+ * If ao_how==NULL, the function will be synchronous.
+ *
+ * If ao_how!=NULL, the function will set the operation going, and if
+ * this is successful will return 0.  In this case the zero error
+ * response does NOT mean that the operation was successful; it just
+ * means that it has been successfully started.  It will finish later,
+ * perhaps with an error.
+ *
+ * If ao_how->callback!=NULL, the callback will be called when the
+ * operation completes.  The same rules as for libxl_event_hooks
+ * apply, including the reentrancy rules and the possibility of
+ * "disaster", except that libxl calls ao_how->callback instead of
+ * libxl_event_hooks.event_occurs.  (See libxl_event.h.)
+ *
+ * If ao_how->callback==NULL, a libxl_event will be generated which
+ * can be obtained from libxl_event_wait or libxl_event_check.  The
+ * event will have type OPERATION_COMPLETE (which is not used
+ * elsewhere).
+ *
+ * Note that it is possible for an asynchronous operation which is to
+ * result in a callback to complete during its initiating function
+ * call.  In this case the initiating function will return 0
+ * indicating the at the operation is "in progress", even though by
+ * the time it returns the operation is complete and the callback has
+ * already happened.
+ *
+ * The application must set and use ao_how->for_event (which will be
+ * copied into libxl_event.for_user) or ao_how->for_callback (passed
+ * to the callback) to determine which operation finished, and it must
+ * of course check the rc value for errors.
+ *
+ * *ao_how does not need to remain valid after the initiating function
+ * returns.
+ *
+ * Callbacks may occur on any thread in which the application calls
+ * libxl.
+ */
+
+typedef struct {
+    void (*callback)(libxl_ctx *ctx, int rc, void *for_callback);
+    union {
+        libxl_ev_user for_event; /* used if callback==NULL */
+        void *for_callback; /* passed to callback */
+    } u;
+} libxl_asyncop_how;
+
+
 #define LIBXL_VERSION 0
 
 typedef struct {
diff -r cd4bff9d4050 -r 03152893aba0 tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c	Fri Jan 27 17:01:23 2012 +0000
+++ b/tools/libxl/libxl_event.c	Fri Jan 27 17:01:24 2012 +0000
@@ -771,10 +771,21 @@
 {
     EGC_GC;
     libxl_event *ev, *ev_tmp;
+
     LIBXL_TAILQ_FOREACH_SAFE(ev, &egc->occurred_for_callback, link, ev_tmp) {
         LIBXL_TAILQ_REMOVE(&egc->occurred_for_callback, ev, link);
         CTX->event_hooks->event_occurs(CTX->event_hooks_user, ev);
     }
+
+    libxl__ao *ao, *ao_tmp;
+    LIBXL_TAILQ_FOREACH_SAFE(ao, &egc->aos_for_callback,
+                             entry_for_callback, ao_tmp) {
+        LIBXL_TAILQ_REMOVE(&egc->aos_for_callback, ao, entry_for_callback);
+        ao->how.callback(CTX, ao->rc, ao->how.u.for_callback);
+        ao->notified = 1;
+        if (!ao->in_initiator)
+            libxl__ao__destroy(CTX, ao);
+    }
 }
 
 void libxl__egc_cleanup(libxl__egc *egc)
@@ -1061,6 +1072,183 @@
     return rc;
 }
 
+
+
+/*
+ * The two possible state flow of an ao:
+ *
+ * Completion before initiator return:
+ *
+ *     Initiator thread                       Possible other threads
+ *
+ *   * ao_create allocates memory and
+ *     initialises the struct
+ *
+ *   * the initiator function does its
+ *     work, setting up various internal
+ *     asynchronous operations -----------> * asynchronous operations
+ *                                            start to take place and
+ *                                            might cause ao completion
+ *                                                |
+ *   * initiator calls ao_inprogress              |
+ *     - if synchronous, run event loop           |
+ *       until the ao completes                   |
+ *                              - ao completes on some thread
+ *                              - completing thread releases the lock
+ *                     <--------------'
+ *     - ao_inprogress takes the lock
+ *     - destroy the ao
+ *
+ *
+ * Completion after initiator return (asynch. only):
+ *
+ *
+ *     Initiator thread                       Possible other threads
+ *
+ *   * ao_create allocates memory and
+ *     initialises the struct
+ *
+ *   * the initiator function does its
+ *     work, setting up various internal
+ *     asynchronous operations -----------> * asynchronous operations
+ *                                            start to take place and
+ *                                            might cause ao completion
+ *                                                |
+ *   * initiator calls ao_inprogress              |
+ *     - observes event not yet done,             |
+ *     - returns to caller                        |
+ *                                                |
+ *                              - ao completes on some thread
+ *                              - generate the event or call the callback
+ *                              - destroy the ao
+ */
+
+void libxl__ao__destroy(libxl_ctx *ctx, libxl__ao *ao)
+{
+    if (!ao) return;
+    if (ao->poller) libxl__poller_put(ctx, ao->poller);
+    ao->magic = LIBXL__AO_MAGIC_DESTROYED;
+    libxl__free_all(&ao->gc);
+    free(ao);
+}
+
+void libxl__ao_abort(libxl__ao *ao)
+{
+    AO_GC;
+    assert(ao->magic == LIBXL__AO_MAGIC);
+    assert(ao->in_initiator);
+    assert(!ao->complete);
+    libxl__ao__destroy(CTX, ao);
+}
+
+void libxl__ao_complete(libxl__egc *egc, libxl__ao *ao, int rc)
+{
+    assert(ao->magic == LIBXL__AO_MAGIC);
+    assert(!ao->complete);
+    ao->complete = 1;
+    ao->rc = rc;
+
+    if (ao->poller) {
+        assert(ao->in_initiator);
+        libxl__poller_wakeup(egc, ao->poller);
+    } else if (ao->how.callback) {
+        LIBXL_TAILQ_INSERT_TAIL(&egc->aos_for_callback, ao, entry_for_callback);
+    } else {
+        libxl_event *ev;
+        ev = NEW_EVENT(egc, OPERATION_COMPLETE, ao->domid);
+        if (ev) {
+            ev->for_user = ao->how.u.for_event;
+            ev->u.operation_complete.rc = ao->rc;
+            libxl__event_occurred(egc, ev);
+        }
+        ao->notified = 1;
+    }
+    if (!ao->in_initiator && ao->notified)
+        libxl__ao__destroy(libxl__gc_owner(&egc->gc), ao);
+}
+
+libxl__ao *libxl__ao_create(libxl_ctx *ctx, uint32_t domid,
+                            const libxl_asyncop_how *how)
+{
+    libxl__ao *ao;
+
+    ao = calloc(1, sizeof(*ao));
+    if (!ao) goto out;
+
+    ao->magic = LIBXL__AO_MAGIC;
+    ao->in_initiator = 1;
+    ao->poller = 0;
+    ao->domid = domid;
+    LIBXL_INIT_GC(ao->gc, ctx);
+
+    if (how) {
+        ao->how = *how;
+    } else {
+        ao->poller = libxl__poller_get(ctx);
+        if (!ao->poller) goto out;
+    }
+    return ao;
+
+ out:
+    if (ao) libxl__ao__destroy(ctx, ao);
+    return NULL;
+}
+
+int libxl__ao_inprogress(libxl__ao *ao)
+{
+    AO_GC;
+    int rc;
+
+    assert(ao->magic == LIBXL__AO_MAGIC);
+    assert(ao->in_initiator);
+
+    if (ao->poller) {
+        /* Caller wants it done synchronously. */
+        /* We use a fresh gc, so that we can free things
+         * each time round the loop. */
+        libxl__egc egc;
+        LIBXL_INIT_EGC(egc,CTX);
+
+        for (;;) {
+            assert(ao->magic == LIBXL__AO_MAGIC);
+
+            if (ao->complete) {
+                rc = ao->rc;
+                ao->notified = 1;
+                break;
+            }
+
+            rc = eventloop_iteration(&egc,ao->poller);
+            if (rc) {
+                /* Oh dear, this is quite unfortunate. */
+                LIBXL__LOG(CTX, LIBXL__LOG_ERROR, "Error waiting for"
+                           " event during long-running operation (rc=%d)", rc);
+                sleep(1);
+                /* It's either this or return ERROR_I_DONT_KNOW_WHETHER
+                 * _THE_THING_YOU_ASKED_FOR_WILL_BE_DONE_LATER_WHEN
+                 * _YOU_DIDNT_EXPECT_IT, since we don't have any kind of
+                 * cancellation ability. */
+            }
+
+            CTX_UNLOCK;
+            libxl__egc_cleanup(&egc);
+            CTX_LOCK;
+        }
+    } else {
+        rc = 0;
+    }
+
+    ao->in_initiator = 0;
+
+    if (ao->notified) {
+        assert(ao->complete);
+        libxl__ao__destroy(CTX,ao);
+    }
+
+    return rc;
+}
+
+
 /*
  * Local variables:
  * mode: C
diff -r cd4bff9d4050 -r 03152893aba0 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:23 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:24 2012 +0000
@@ -114,6 +114,7 @@
 
 typedef struct libxl__gc libxl__gc;
 typedef struct libxl__egc libxl__egc;
+typedef struct libxl__ao libxl__ao;
 
 typedef struct libxl__ev_fd libxl__ev_fd;
 typedef void libxl__ev_fd_callback(libxl__egc *egc, libxl__ev_fd *ev,
@@ -218,6 +219,10 @@
      * releasing the ctx lock and going into poll; when it comes out
      * of poll it will take the poller off the pollers_event list.
      *
+     * A thread which is waiting for completion of a synchronous ao
+     * will allocate a poller and record it in the ao, so that other
+     * threads can wake it up.
+     *
      * When a thread is done with a poller it should put it onto
      * pollers_idle, where it can be reused later.
      *
@@ -324,6 +329,21 @@
     /* for event-generating functions only */
     struct libxl__gc gc;
     struct libxl__event_list occurred_for_callback;
+    LIBXL_TAILQ_HEAD(, libxl__ao) aos_for_callback;
+};
+
+#define LIBXL__AO_MAGIC              0xA0FACE00ul
+#define LIBXL__AO_MAGIC_DESTROYED    0xA0DEAD00ul
+
+struct libxl__ao {
+    uint32_t magic;
+    unsigned in_initiator:1, complete:1, notified:1;
+    int rc;
+    libxl__gc gc;
+    libxl_asyncop_how how;
+    libxl__poller *poller;
+    uint32_t domid;
+    LIBXL_TAILQ_ENTRY(libxl__ao) entry_for_callback;
 };
 
 #define LIBXL_INIT_GC(gc,ctx) do{               \
@@ -1108,6 +1128,7 @@
 #define LIBXL_INIT_EGC(egc,ctx) do{                     \
         LIBXL_INIT_GC((egc).gc,ctx);                    \
         LIBXL_TAILQ_INIT(&(egc).occurred_for_callback); \
+        LIBXL_TAILQ_INIT(&(egc).aos_for_callback);      \
     } while(0)
 
 _hidden void libxl__egc_cleanup(libxl__egc *egc);
@@ -1125,6 +1146,92 @@
 
 
 /*
+ * Machinery for asynchronous operations ("ao")
+ *
+ * All "slow" functions (includes anything that might block on a
+ * guest or an external script) need to use the asynchronous
+ * operation ("ao") machinery.  The function should take a parameter
+ * const libxl_asyncop_how *ao_how and must start with a call to
+ * AO_INITIATOR_ENTRY.  These functions MAY NOT be called from
+ * outside libxl, because they can cause reentrancy callbacks.
+ *
+ * Lifecycle of an ao:
+ *
+ * - Created by libxl__ao_create (or the AO_CREATE convenience macro).
+ *
+ * - After creation, can be used by code which implements
+ *   the operation as follows:
+ *      - the ao's gc, for allocating memory for the lifetime
+ *        of the operation (possibly with the help of the AO_GC
+ *        macro to introduce the gc into scope)
+ *      - the ao itself may be passed about to sub-functions
+ *        so that they can stash it away etc.
+ *      - in particular, the ao pointer must be stashed in some
+ *        per-operation structure which is also passed as a user
+ *        pointer to the internal event generation request routines
+ *        libxl__evgen_FOO, so that at some point a CALLBACK will be
+ *        made when the operation is complete.
+ *
+ * - If initiation is successful, the initiating function needs
+ *   to run libxl__ao_inprogress right before unlocking and
+ *   returning, and return whatever it returns (AO_INPROGRESS macro).
+ *
+ * - If the initiation is unsuccessful, the initiating function must
+ *   call libxl__ao_abort before unlocking and returning whatever
+ *   error code is appropriate (AO_ABORT macro).
+ *
+ * - Later, some callback function, whose callback has been requested
+ *   directly or indirectly, should call libxl__ao_complete (with the
+ *   ctx locked, as it will generally already be in any event callback
+ *   function).  This must happen exactly once for each ao (and not if
+ *   the ao has been destroyed, obviously), and it may not happen
+ *   until libxl__ao_inprogress has been called on the ao.
+ *
+ * - Note that during callback functions, two gcs are available:
+ *    - The one in egc, whose lifetime is only this callback
+ *    - The one in ao, whose lifetime is the asynchronous operation
+ *   Usually callback function should use CONTAINER_OF
+ *   to obtain its own structure, containing a pointer to the ao,
+ *   and then use the gc from that ao.
+ */
+
+#define AO_CREATE(ctx, domid, ao_how)                           \
+    libxl__ctx_lock(ctx);                                       \
+    libxl__ao *ao = libxl__ao_create(ctx, domid, ao_how);       \
+    if (!ao) { libxl__ctx_unlock(ctx); return ERROR_NOMEM; }    \
+    AO_GC;
+
+#define AO_INPROGRESS ({                                        \
+        libxl_ctx *ao__ctx = libxl__gc_owner(&ao->gc);          \
+        int ao__rc = libxl__ao_inprogress(ao);                  \
+        libxl__ctx_unlock(ao__ctx); /* gc is now invalid */     \
+        (ao__rc);                                               \
+   })
+
+#define AO_ABORT(rc) ({                                         \
+        libxl_ctx *ao__ctx = libxl__gc_owner(&ao->gc);          \
+        assert(rc);                                             \
+        libxl__ao_abort(ao);                                    \
+        libxl__ctx_unlock(ao__ctx); /* gc is now invalid */     \
+        (rc);                                                   \
+    })
+
+#define AO_GC                                   \
+    libxl__gc *const gc = &ao->gc
+
+
+/* All of these MUST be called with the ctx locked.
+ * libxl__ao_inprogress MUST be called with the ctx locked exactly once. */
+_hidden libxl__ao *libxl__ao_create(libxl_ctx*, uint32_t domid,
+                                    const libxl_asyncop_how*);
+_hidden int libxl__ao_inprogress(libxl__ao *ao);
+_hidden void libxl__ao_abort(libxl__ao *ao);
+_hidden void libxl__ao_complete(libxl__egc *egc, libxl__ao *ao, int rc);
+
+/* For use by ao machinery ONLY */
+_hidden void libxl__ao__destroy(libxl_ctx*, libxl__ao *ao);
+
+/*
  * Convenience macros.
  */
 
diff -r cd4bff9d4050 -r 03152893aba0 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Fri Jan 27 17:01:23 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Fri Jan 27 17:01:24 2012 +0000
@@ -397,6 +397,7 @@
     (1, "DOMAIN_SHUTDOWN"),
     (2, "DOMAIN_DESTROY"),
     (3, "DISK_EJECT"),
+    (4, "OPERATION_COMPLETE"),
     ])
 
 libxl_ev_user = UInt(64)
@@ -420,4 +421,7 @@
                                         ("vdev", string),
                                         ("disk", libxl_device_disk),
                                  ])),
+           ("operation_complete", Struct(None, [
+                                        ("rc", integer),
+                                 ])),
            ]))])

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:55:58 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:55:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6p-0006KE-M0; Fri, 03 Feb 2012 21:55:55 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6o-0006Ht-7y
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:54 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-174.messagelabs.com!1328306145!11764436!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20288 invoked from network); 3 Feb 2012 21:55:47 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:47 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6f-0001hz-Pn
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:45 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6d-0002GW-Fp
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:45 +0000
Message-Id: <E1RtR6d-0002GW-Fp@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:42 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Asynchronous/long-running
	operation infrastructure
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327683684 0
# Node ID 03152893aba021053da70573a58449bcfcca4b88
# Parent  cd4bff9d40507cfea619a679f524fafac79a8226
libxl: Asynchronous/long-running operation infrastructure

Provide a new set of machinery for writing public libxl functions
which may take a long time.  The application gets to decide whether
they want the function to be synchronous, or whether they'd prefer to
get a callback, or an event, when the operation is complete.

User(s) of this machinery will be introduced in later patch(es).

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


diff -r cd4bff9d4050 -r 03152893aba0 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Fri Jan 27 17:01:23 2012 +0000
+++ b/tools/libxl/libxl.h	Fri Jan 27 17:01:24 2012 +0000
@@ -237,6 +237,59 @@
     ERROR_BUFFERFULL = -13,
 };
 
+
+/*
+ * Some libxl operations can take a long time.  These functions take a
+ * parameter to control their concurrency:
+ *     libxl_asyncop_how *ao_how
+ *
+ * If ao_how==NULL, the function will be synchronous.
+ *
+ * If ao_how!=NULL, the function will set the operation going, and if
+ * this is successful will return 0.  In this case the zero error
+ * response does NOT mean that the operation was successful; it just
+ * means that it has been successfully started.  It will finish later,
+ * perhaps with an error.
+ *
+ * If ao_how->callback!=NULL, the callback will be called when the
+ * operation completes.  The same rules as for libxl_event_hooks
+ * apply, including the reentrancy rules and the possibility of
+ * "disaster", except that libxl calls ao_how->callback instead of
+ * libxl_event_hooks.event_occurs.  (See libxl_event.h.)
+ *
+ * If ao_how->callback==NULL, a libxl_event will be generated which
+ * can be obtained from libxl_event_wait or libxl_event_check.  The
+ * event will have type OPERATION_COMPLETE (which is not used
+ * elsewhere).
+ *
+ * Note that it is possible for an asynchronous operation which is to
+ * result in a callback to complete during its initiating function
+ * call.  In this case the initiating function will return 0
+ * indicating the at the operation is "in progress", even though by
+ * the time it returns the operation is complete and the callback has
+ * already happened.
+ *
+ * The application must set and use ao_how->for_event (which will be
+ * copied into libxl_event.for_user) or ao_how->for_callback (passed
+ * to the callback) to determine which operation finished, and it must
+ * of course check the rc value for errors.
+ *
+ * *ao_how does not need to remain valid after the initiating function
+ * returns.
+ *
+ * Callbacks may occur on any thread in which the application calls
+ * libxl.
+ */
+
+typedef struct {
+    void (*callback)(libxl_ctx *ctx, int rc, void *for_callback);
+    union {
+        libxl_ev_user for_event; /* used if callback==NULL */
+        void *for_callback; /* passed to callback */
+    } u;
+} libxl_asyncop_how;
+
+
 #define LIBXL_VERSION 0
 
 typedef struct {
diff -r cd4bff9d4050 -r 03152893aba0 tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c	Fri Jan 27 17:01:23 2012 +0000
+++ b/tools/libxl/libxl_event.c	Fri Jan 27 17:01:24 2012 +0000
@@ -771,10 +771,21 @@
 {
     EGC_GC;
     libxl_event *ev, *ev_tmp;
+
     LIBXL_TAILQ_FOREACH_SAFE(ev, &egc->occurred_for_callback, link, ev_tmp) {
         LIBXL_TAILQ_REMOVE(&egc->occurred_for_callback, ev, link);
         CTX->event_hooks->event_occurs(CTX->event_hooks_user, ev);
     }
+
+    libxl__ao *ao, *ao_tmp;
+    LIBXL_TAILQ_FOREACH_SAFE(ao, &egc->aos_for_callback,
+                             entry_for_callback, ao_tmp) {
+        LIBXL_TAILQ_REMOVE(&egc->aos_for_callback, ao, entry_for_callback);
+        ao->how.callback(CTX, ao->rc, ao->how.u.for_callback);
+        ao->notified = 1;
+        if (!ao->in_initiator)
+            libxl__ao__destroy(CTX, ao);
+    }
 }
 
 void libxl__egc_cleanup(libxl__egc *egc)
@@ -1061,6 +1072,183 @@
     return rc;
 }
 
+
+
+/*
+ * The two possible state flow of an ao:
+ *
+ * Completion before initiator return:
+ *
+ *     Initiator thread                       Possible other threads
+ *
+ *   * ao_create allocates memory and
+ *     initialises the struct
+ *
+ *   * the initiator function does its
+ *     work, setting up various internal
+ *     asynchronous operations -----------> * asynchronous operations
+ *                                            start to take place and
+ *                                            might cause ao completion
+ *                                                |
+ *   * initiator calls ao_inprogress              |
+ *     - if synchronous, run event loop           |
+ *       until the ao completes                   |
+ *                              - ao completes on some thread
+ *                              - completing thread releases the lock
+ *                     <--------------'
+ *     - ao_inprogress takes the lock
+ *     - destroy the ao
+ *
+ *
+ * Completion after initiator return (asynch. only):
+ *
+ *
+ *     Initiator thread                       Possible other threads
+ *
+ *   * ao_create allocates memory and
+ *     initialises the struct
+ *
+ *   * the initiator function does its
+ *     work, setting up various internal
+ *     asynchronous operations -----------> * asynchronous operations
+ *                                            start to take place and
+ *                                            might cause ao completion
+ *                                                |
+ *   * initiator calls ao_inprogress              |
+ *     - observes event not yet done,             |
+ *     - returns to caller                        |
+ *                                                |
+ *                              - ao completes on some thread
+ *                              - generate the event or call the callback
+ *                              - destroy the ao
+ */
+
+void libxl__ao__destroy(libxl_ctx *ctx, libxl__ao *ao)
+{
+    if (!ao) return;
+    if (ao->poller) libxl__poller_put(ctx, ao->poller);
+    ao->magic = LIBXL__AO_MAGIC_DESTROYED;
+    libxl__free_all(&ao->gc);
+    free(ao);
+}
+
+void libxl__ao_abort(libxl__ao *ao)
+{
+    AO_GC;
+    assert(ao->magic == LIBXL__AO_MAGIC);
+    assert(ao->in_initiator);
+    assert(!ao->complete);
+    libxl__ao__destroy(CTX, ao);
+}
+
+void libxl__ao_complete(libxl__egc *egc, libxl__ao *ao, int rc)
+{
+    assert(ao->magic == LIBXL__AO_MAGIC);
+    assert(!ao->complete);
+    ao->complete = 1;
+    ao->rc = rc;
+
+    if (ao->poller) {
+        assert(ao->in_initiator);
+        libxl__poller_wakeup(egc, ao->poller);
+    } else if (ao->how.callback) {
+        LIBXL_TAILQ_INSERT_TAIL(&egc->aos_for_callback, ao, entry_for_callback);
+    } else {
+        libxl_event *ev;
+        ev = NEW_EVENT(egc, OPERATION_COMPLETE, ao->domid);
+        if (ev) {
+            ev->for_user = ao->how.u.for_event;
+            ev->u.operation_complete.rc = ao->rc;
+            libxl__event_occurred(egc, ev);
+        }
+        ao->notified = 1;
+    }
+    if (!ao->in_initiator && ao->notified)
+        libxl__ao__destroy(libxl__gc_owner(&egc->gc), ao);
+}
+
+libxl__ao *libxl__ao_create(libxl_ctx *ctx, uint32_t domid,
+                            const libxl_asyncop_how *how)
+{
+    libxl__ao *ao;
+
+    ao = calloc(1, sizeof(*ao));
+    if (!ao) goto out;
+
+    ao->magic = LIBXL__AO_MAGIC;
+    ao->in_initiator = 1;
+    ao->poller = 0;
+    ao->domid = domid;
+    LIBXL_INIT_GC(ao->gc, ctx);
+
+    if (how) {
+        ao->how = *how;
+    } else {
+        ao->poller = libxl__poller_get(ctx);
+        if (!ao->poller) goto out;
+    }
+    return ao;
+
+ out:
+    if (ao) libxl__ao__destroy(ctx, ao);
+    return NULL;
+}
+
+int libxl__ao_inprogress(libxl__ao *ao)
+{
+    AO_GC;
+    int rc;
+
+    assert(ao->magic == LIBXL__AO_MAGIC);
+    assert(ao->in_initiator);
+
+    if (ao->poller) {
+        /* Caller wants it done synchronously. */
+        /* We use a fresh gc, so that we can free things
+         * each time round the loop. */
+        libxl__egc egc;
+        LIBXL_INIT_EGC(egc,CTX);
+
+        for (;;) {
+            assert(ao->magic == LIBXL__AO_MAGIC);
+
+            if (ao->complete) {
+                rc = ao->rc;
+                ao->notified = 1;
+                break;
+            }
+
+            rc = eventloop_iteration(&egc,ao->poller);
+            if (rc) {
+                /* Oh dear, this is quite unfortunate. */
+                LIBXL__LOG(CTX, LIBXL__LOG_ERROR, "Error waiting for"
+                           " event during long-running operation (rc=%d)", rc);
+                sleep(1);
+                /* It's either this or return ERROR_I_DONT_KNOW_WHETHER
+                 * _THE_THING_YOU_ASKED_FOR_WILL_BE_DONE_LATER_WHEN
+                 * _YOU_DIDNT_EXPECT_IT, since we don't have any kind of
+                 * cancellation ability. */
+            }
+
+            CTX_UNLOCK;
+            libxl__egc_cleanup(&egc);
+            CTX_LOCK;
+        }
+    } else {
+        rc = 0;
+    }
+
+    ao->in_initiator = 0;
+
+    if (ao->notified) {
+        assert(ao->complete);
+        libxl__ao__destroy(CTX,ao);
+    }
+
+    return rc;
+}
+
+
 /*
  * Local variables:
  * mode: C
diff -r cd4bff9d4050 -r 03152893aba0 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:23 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:24 2012 +0000
@@ -114,6 +114,7 @@
 
 typedef struct libxl__gc libxl__gc;
 typedef struct libxl__egc libxl__egc;
+typedef struct libxl__ao libxl__ao;
 
 typedef struct libxl__ev_fd libxl__ev_fd;
 typedef void libxl__ev_fd_callback(libxl__egc *egc, libxl__ev_fd *ev,
@@ -218,6 +219,10 @@
      * releasing the ctx lock and going into poll; when it comes out
      * of poll it will take the poller off the pollers_event list.
      *
+     * A thread which is waiting for completion of a synchronous ao
+     * will allocate a poller and record it in the ao, so that other
+     * threads can wake it up.
+     *
      * When a thread is done with a poller it should put it onto
      * pollers_idle, where it can be reused later.
      *
@@ -324,6 +329,21 @@
     /* for event-generating functions only */
     struct libxl__gc gc;
     struct libxl__event_list occurred_for_callback;
+    LIBXL_TAILQ_HEAD(, libxl__ao) aos_for_callback;
+};
+
+#define LIBXL__AO_MAGIC              0xA0FACE00ul
+#define LIBXL__AO_MAGIC_DESTROYED    0xA0DEAD00ul
+
+struct libxl__ao {
+    uint32_t magic;
+    unsigned in_initiator:1, complete:1, notified:1;
+    int rc;
+    libxl__gc gc;
+    libxl_asyncop_how how;
+    libxl__poller *poller;
+    uint32_t domid;
+    LIBXL_TAILQ_ENTRY(libxl__ao) entry_for_callback;
 };
 
 #define LIBXL_INIT_GC(gc,ctx) do{               \
@@ -1108,6 +1128,7 @@
 #define LIBXL_INIT_EGC(egc,ctx) do{                     \
         LIBXL_INIT_GC((egc).gc,ctx);                    \
         LIBXL_TAILQ_INIT(&(egc).occurred_for_callback); \
+        LIBXL_TAILQ_INIT(&(egc).aos_for_callback);      \
     } while(0)
 
 _hidden void libxl__egc_cleanup(libxl__egc *egc);
@@ -1125,6 +1146,92 @@
 
 
 /*
+ * Machinery for asynchronous operations ("ao")
+ *
+ * All "slow" functions (includes anything that might block on a
+ * guest or an external script) need to use the asynchronous
+ * operation ("ao") machinery.  The function should take a parameter
+ * const libxl_asyncop_how *ao_how and must start with a call to
+ * AO_INITIATOR_ENTRY.  These functions MAY NOT be called from
+ * outside libxl, because they can cause reentrancy callbacks.
+ *
+ * Lifecycle of an ao:
+ *
+ * - Created by libxl__ao_create (or the AO_CREATE convenience macro).
+ *
+ * - After creation, can be used by code which implements
+ *   the operation as follows:
+ *      - the ao's gc, for allocating memory for the lifetime
+ *        of the operation (possibly with the help of the AO_GC
+ *        macro to introduce the gc into scope)
+ *      - the ao itself may be passed about to sub-functions
+ *        so that they can stash it away etc.
+ *      - in particular, the ao pointer must be stashed in some
+ *        per-operation structure which is also passed as a user
+ *        pointer to the internal event generation request routines
+ *        libxl__evgen_FOO, so that at some point a CALLBACK will be
+ *        made when the operation is complete.
+ *
+ * - If initiation is successful, the initiating function needs
+ *   to run libxl__ao_inprogress right before unlocking and
+ *   returning, and return whatever it returns (AO_INPROGRESS macro).
+ *
+ * - If the initiation is unsuccessful, the initiating function must
+ *   call libxl__ao_abort before unlocking and returning whatever
+ *   error code is appropriate (AO_ABORT macro).
+ *
+ * - Later, some callback function, whose callback has been requested
+ *   directly or indirectly, should call libxl__ao_complete (with the
+ *   ctx locked, as it will generally already be in any event callback
+ *   function).  This must happen exactly once for each ao (and not if
+ *   the ao has been destroyed, obviously), and it may not happen
+ *   until libxl__ao_inprogress has been called on the ao.
+ *
+ * - Note that during callback functions, two gcs are available:
+ *    - The one in egc, whose lifetime is only this callback
+ *    - The one in ao, whose lifetime is the asynchronous operation
+ *   Usually callback function should use CONTAINER_OF
+ *   to obtain its own structure, containing a pointer to the ao,
+ *   and then use the gc from that ao.
+ */
+
+#define AO_CREATE(ctx, domid, ao_how)                           \
+    libxl__ctx_lock(ctx);                                       \
+    libxl__ao *ao = libxl__ao_create(ctx, domid, ao_how);       \
+    if (!ao) { libxl__ctx_unlock(ctx); return ERROR_NOMEM; }    \
+    AO_GC;
+
+#define AO_INPROGRESS ({                                        \
+        libxl_ctx *ao__ctx = libxl__gc_owner(&ao->gc);          \
+        int ao__rc = libxl__ao_inprogress(ao);                  \
+        libxl__ctx_unlock(ao__ctx); /* gc is now invalid */     \
+        (ao__rc);                                               \
+   })
+
+#define AO_ABORT(rc) ({                                         \
+        libxl_ctx *ao__ctx = libxl__gc_owner(&ao->gc);          \
+        assert(rc);                                             \
+        libxl__ao_abort(ao);                                    \
+        libxl__ctx_unlock(ao__ctx); /* gc is now invalid */     \
+        (rc);                                                   \
+    })
+
+#define AO_GC                                   \
+    libxl__gc *const gc = &ao->gc
+
+
+/* All of these MUST be called with the ctx locked.
+ * libxl__ao_inprogress MUST be called with the ctx locked exactly once. */
+_hidden libxl__ao *libxl__ao_create(libxl_ctx*, uint32_t domid,
+                                    const libxl_asyncop_how*);
+_hidden int libxl__ao_inprogress(libxl__ao *ao);
+_hidden void libxl__ao_abort(libxl__ao *ao);
+_hidden void libxl__ao_complete(libxl__egc *egc, libxl__ao *ao, int rc);
+
+/* For use by ao machinery ONLY */
+_hidden void libxl__ao__destroy(libxl_ctx*, libxl__ao *ao);
+
+/*
  * Convenience macros.
  */
 
diff -r cd4bff9d4050 -r 03152893aba0 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Fri Jan 27 17:01:23 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Fri Jan 27 17:01:24 2012 +0000
@@ -397,6 +397,7 @@
     (1, "DOMAIN_SHUTDOWN"),
     (2, "DOMAIN_DESTROY"),
     (3, "DISK_EJECT"),
+    (4, "OPERATION_COMPLETE"),
     ])
 
 libxl_ev_user = UInt(64)
@@ -420,4 +421,7 @@
                                         ("vdev", string),
                                         ("disk", libxl_device_disk),
                                  ])),
+           ("operation_complete", Struct(None, [
+                                        ("rc", integer),
+                                 ])),
            ]))])

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:55:58 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:55:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6r-0006Kv-Qt; Fri, 03 Feb 2012 21:55:57 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6q-0006IT-Jg
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:56 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1328306148!11729415!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29944 invoked from network); 3 Feb 2012 21:55:49 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:49 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6h-0001i4-UL
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:47 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6g-0002HO-Cg
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:47 +0000
Message-Id: <E1RtR6g-0002HO-Cg@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:45 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: New convenience macro
	CONTAINER_OF
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327683684 0
# Node ID ccc3656225ef5062ee3efbf21be31e69feffc632
# Parent  03152893aba021053da70573a58449bcfcca4b88
libxl: New convenience macro CONTAINER_OF

Provide a convenient and type-safe wrapper which does the correct
dance to subtract offsetof.  This is very similar to the
"container_of" macro in the Linux kernel, but it has an additional
feature that instead of the type argument you may also pass an
expression of that type; this makes initialising a variable with
CONTAINER_OF easier.

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


diff -r 03152893aba0 -r ccc3656225ef tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:24 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:24 2012 +0000
@@ -1235,6 +1235,35 @@
  * Convenience macros.
  */
 
+/*
+ * CONTAINER_OF work like this.  Given:
+ *    typedef struct {
+ *      ...
+ *      member_type member_name;
+ *      ...
+ *    } outer_type;
+ *    outer_type outer, *outer_var;
+ *    member_type *inner_ptr = &outer->member_name;
+ *
+ * Then, effectively:
+ *    outer_type *CONTAINER_OF(member_type *inner_ptr,
+ *                             *outer_var, // or type name for outer_type
+ *                             member_name);
+ *
+ * So that:
+ *    CONTAINER_OF(inner_ptr, *outer_var, member_name) == &outer
+ *    CONTAINER_OF(inner_ptr, outer_type, member_name) == &outer
+ */
+#define CONTAINER_OF(inner_ptr, outer, member_name)                     \
+    ({                                                                  \
+        typeof(outer) *container_of_;                                   \
+        container_of_ = (void*)((char*)(inner_ptr) -                    \
+                                offsetof(typeof(outer), member_name));  \
+        (void)(&container_of_->member_name ==                           \
+               (typeof(inner_ptr))0) /* type check */;                  \
+        container_of_;                                                  \
+    })
+
 
 /*
  * All of these assume (or define)

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:55:58 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:55:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6r-0006Kv-Qt; Fri, 03 Feb 2012 21:55:57 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6q-0006IT-Jg
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:56 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1328306148!11729415!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29944 invoked from network); 3 Feb 2012 21:55:49 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:49 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6h-0001i4-UL
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:47 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6g-0002HO-Cg
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:47 +0000
Message-Id: <E1RtR6g-0002HO-Cg@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:45 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: New convenience macro
	CONTAINER_OF
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327683684 0
# Node ID ccc3656225ef5062ee3efbf21be31e69feffc632
# Parent  03152893aba021053da70573a58449bcfcca4b88
libxl: New convenience macro CONTAINER_OF

Provide a convenient and type-safe wrapper which does the correct
dance to subtract offsetof.  This is very similar to the
"container_of" macro in the Linux kernel, but it has an additional
feature that instead of the type argument you may also pass an
expression of that type; this makes initialising a variable with
CONTAINER_OF easier.

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


diff -r 03152893aba0 -r ccc3656225ef tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:24 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:24 2012 +0000
@@ -1235,6 +1235,35 @@
  * Convenience macros.
  */
 
+/*
+ * CONTAINER_OF work like this.  Given:
+ *    typedef struct {
+ *      ...
+ *      member_type member_name;
+ *      ...
+ *    } outer_type;
+ *    outer_type outer, *outer_var;
+ *    member_type *inner_ptr = &outer->member_name;
+ *
+ * Then, effectively:
+ *    outer_type *CONTAINER_OF(member_type *inner_ptr,
+ *                             *outer_var, // or type name for outer_type
+ *                             member_name);
+ *
+ * So that:
+ *    CONTAINER_OF(inner_ptr, *outer_var, member_name) == &outer
+ *    CONTAINER_OF(inner_ptr, outer_type, member_name) == &outer
+ */
+#define CONTAINER_OF(inner_ptr, outer, member_name)                     \
+    ({                                                                  \
+        typeof(outer) *container_of_;                                   \
+        container_of_ = (void*)((char*)(inner_ptr) -                    \
+                                offsetof(typeof(outer), member_name));  \
+        (void)(&container_of_->member_name ==                           \
+               (typeof(inner_ptr))0) /* type check */;                  \
+        container_of_;                                                  \
+    })
+
 
 /*
  * All of these assume (or define)

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:01 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6t-0006Lw-Tc; Fri, 03 Feb 2012 21:55:59 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6s-0006J9-Ak
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:58 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-216.messagelabs.com!1328306151!12855212!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8240 invoked from network); 3 Feb 2012 21:55:52 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:52 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6k-0001iF-Vr
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:50 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6j-0002I7-BV
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:49 +0000
Message-Id: <E1RtR6j-0002I7-BV@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:47 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Introduce libxl__ev_devstate
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327683685 0
# Node ID 0fc9948457962514ab9a9a4bb9ed0bf3695dee1b
# Parent  ccc3656225ef5062ee3efbf21be31e69feffc632
libxl: Introduce libxl__ev_devstate

Provide a new-style asynchronous facility for waiting for device
states on xenbus.  This will replace libxl__wait_for_device_state,
after the callers have been updated in later patches.

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


diff -r ccc3656225ef -r 0fc994845796 tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c	Fri Jan 27 17:01:24 2012 +0000
+++ b/tools/libxl/libxl_event.c	Fri Jan 27 17:01:25 2012 +0000
@@ -507,6 +507,81 @@
 }
 
 /*
+ * waiting for device state
+ */
+
+static void devstate_watch_callback(libxl__egc *egc, libxl__ev_xswatch *watch,
+                                const char *watch_path, const char *event_path)
+{
+    EGC_GC;
+    libxl__ev_devstate *ds = CONTAINER_OF(watch, *ds, watch);
+    int rc;
+
+    char *sstate = libxl__xs_read(gc, XBT_NULL, watch_path);
+    if (!sstate) {
+        if (errno == ENOENT) {
+            LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, "backend %s wanted state %d"
+                       " but it was removed", watch_path, ds->wanted);
+            rc = ERROR_INVAL;
+        } else {
+            LIBXL__LOG_ERRNO(CTX, LIBXL__LOG_ERROR, "backend %s wanted state"
+                             " %d but read failed", watch_path, ds->wanted);
+            rc = ERROR_FAIL;
+        }
+    } else {
+        int got = atoi(sstate);
+        if (got == ds->wanted) {
+            LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, "backend %s wanted state %d ok",
+                       watch_path, ds->wanted);
+            rc = 0;
+        } else {
+            LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, "backend %s wanted state %d"
+                       " still waiting state %d", watch_path, ds->wanted, got);
+            return;
+        }
+    }
+    libxl__ev_devstate_cancel(gc, ds);
+    ds->callback(egc, ds, rc);
+}
+
+static void devstate_timeout(libxl__egc *egc, libxl__ev_time *ev,
+                             const struct timeval *requested_abs)
+{
+    EGC_GC;
+    libxl__ev_devstate *ds = CONTAINER_OF(ev, *ds, timeout);
+    LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, "backend %s wanted state %d "
+               " timed out", ds->watch.path, ds->wanted);
+    libxl__ev_devstate_cancel(gc, ds);
+    ds->callback(egc, ds, ERROR_TIMEDOUT);
+}
+
+int libxl__ev_devstate_wait(libxl__gc *gc, libxl__ev_devstate *ds,
+                            libxl__ev_devstate_callback cb,
+                            const char *state_path, int state, int milliseconds)
+{
+    int rc;
+
+    libxl__ev_time_init(&ds->timeout);
+    libxl__ev_xswatch_init(&ds->watch);
+    ds->wanted = state;
+    ds->callback = cb;
+
+    rc = libxl__ev_time_register_rel(gc, &ds->timeout, devstate_timeout,
+                                     milliseconds);
+    if (rc) goto out;
+
+    rc = libxl__ev_xswatch_register(gc, &ds->watch, devstate_watch_callback,
+                                    state_path);
+    if (rc) goto out;
+
+    return 0;
+
+ out:
+    libxl__ev_devstate_cancel(gc, ds);
+    return rc;
+}
+
+/*
  * osevent poll
  */
 
diff -r ccc3656225ef -r 0fc994845796 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:24 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:25 2012 +0000
@@ -686,6 +686,47 @@
                                          libxl__device_state_handler handler);
 
 /*
+ * libxl__ev_devstate - waits a given time for a device to
+ * reach a given state.  Follows the libxl_ev_* conventions.
+ * Will generate only one event, and after that is automatically
+ * cancelled.
+ */
+typedef struct libxl__ev_devstate libxl__ev_devstate;
+typedef void libxl__ev_devstate_callback(libxl__egc *egc, libxl__ev_devstate*,
+                                         int rc);
+  /* rc will be 0, ERROR_TIMEDOUT, ERROR_INVAL (meaning path was removed),
+   * or ERROR_FAIL if other stuff went wrong (in which latter case, logged) */
+
+struct libxl__ev_devstate {
+    /* read-only for caller, who may read only when waiting: */
+    int wanted;
+    libxl__ev_devstate_callback *callback;
+    /* as for the remainder, read-only public parts may also be
+     * read by the caller (notably, watch.path), but only when waiting: */
+    libxl__ev_xswatch watch;
+    libxl__ev_time timeout;
+};
+
+static inline void libxl__ev_devstate_init(libxl__ev_devstate *ds)
+{
+    libxl__ev_time_init(&ds->timeout);
+    libxl__ev_xswatch_init(&ds->watch);
+}
+
+static inline void libxl__ev_devstate_cancel(libxl__gc *gc,
+                                             libxl__ev_devstate *ds)
+{
+    libxl__ev_time_deregister(gc,&ds->timeout);
+    libxl__ev_xswatch_deregister(gc,&ds->watch);
+}
+
+_hidden int libxl__ev_devstate_wait(libxl__gc *gc, libxl__ev_devstate *ds,
+                                    libxl__ev_devstate_callback cb,
+                                    const char *state_path,
+                                    int state, int milliseconds);
+
+
+/*
  * libxl__try_phy_backend - Check if there's support for the passed
  * type of file using the PHY backend
  * st_mode: mode_t of the file, as returned by stat function

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:01 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6t-0006Lw-Tc; Fri, 03 Feb 2012 21:55:59 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6s-0006J9-Ak
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:58 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-216.messagelabs.com!1328306151!12855212!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8240 invoked from network); 3 Feb 2012 21:55:52 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:52 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6k-0001iF-Vr
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:50 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6j-0002I7-BV
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:49 +0000
Message-Id: <E1RtR6j-0002I7-BV@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:47 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Introduce libxl__ev_devstate
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327683685 0
# Node ID 0fc9948457962514ab9a9a4bb9ed0bf3695dee1b
# Parent  ccc3656225ef5062ee3efbf21be31e69feffc632
libxl: Introduce libxl__ev_devstate

Provide a new-style asynchronous facility for waiting for device
states on xenbus.  This will replace libxl__wait_for_device_state,
after the callers have been updated in later patches.

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


diff -r ccc3656225ef -r 0fc994845796 tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c	Fri Jan 27 17:01:24 2012 +0000
+++ b/tools/libxl/libxl_event.c	Fri Jan 27 17:01:25 2012 +0000
@@ -507,6 +507,81 @@
 }
 
 /*
+ * waiting for device state
+ */
+
+static void devstate_watch_callback(libxl__egc *egc, libxl__ev_xswatch *watch,
+                                const char *watch_path, const char *event_path)
+{
+    EGC_GC;
+    libxl__ev_devstate *ds = CONTAINER_OF(watch, *ds, watch);
+    int rc;
+
+    char *sstate = libxl__xs_read(gc, XBT_NULL, watch_path);
+    if (!sstate) {
+        if (errno == ENOENT) {
+            LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, "backend %s wanted state %d"
+                       " but it was removed", watch_path, ds->wanted);
+            rc = ERROR_INVAL;
+        } else {
+            LIBXL__LOG_ERRNO(CTX, LIBXL__LOG_ERROR, "backend %s wanted state"
+                             " %d but read failed", watch_path, ds->wanted);
+            rc = ERROR_FAIL;
+        }
+    } else {
+        int got = atoi(sstate);
+        if (got == ds->wanted) {
+            LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, "backend %s wanted state %d ok",
+                       watch_path, ds->wanted);
+            rc = 0;
+        } else {
+            LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, "backend %s wanted state %d"
+                       " still waiting state %d", watch_path, ds->wanted, got);
+            return;
+        }
+    }
+    libxl__ev_devstate_cancel(gc, ds);
+    ds->callback(egc, ds, rc);
+}
+
+static void devstate_timeout(libxl__egc *egc, libxl__ev_time *ev,
+                             const struct timeval *requested_abs)
+{
+    EGC_GC;
+    libxl__ev_devstate *ds = CONTAINER_OF(ev, *ds, timeout);
+    LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, "backend %s wanted state %d "
+               " timed out", ds->watch.path, ds->wanted);
+    libxl__ev_devstate_cancel(gc, ds);
+    ds->callback(egc, ds, ERROR_TIMEDOUT);
+}
+
+int libxl__ev_devstate_wait(libxl__gc *gc, libxl__ev_devstate *ds,
+                            libxl__ev_devstate_callback cb,
+                            const char *state_path, int state, int milliseconds)
+{
+    int rc;
+
+    libxl__ev_time_init(&ds->timeout);
+    libxl__ev_xswatch_init(&ds->watch);
+    ds->wanted = state;
+    ds->callback = cb;
+
+    rc = libxl__ev_time_register_rel(gc, &ds->timeout, devstate_timeout,
+                                     milliseconds);
+    if (rc) goto out;
+
+    rc = libxl__ev_xswatch_register(gc, &ds->watch, devstate_watch_callback,
+                                    state_path);
+    if (rc) goto out;
+
+    return 0;
+
+ out:
+    libxl__ev_devstate_cancel(gc, ds);
+    return rc;
+}
+
+/*
  * osevent poll
  */
 
diff -r ccc3656225ef -r 0fc994845796 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:24 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:25 2012 +0000
@@ -686,6 +686,47 @@
                                          libxl__device_state_handler handler);
 
 /*
+ * libxl__ev_devstate - waits a given time for a device to
+ * reach a given state.  Follows the libxl_ev_* conventions.
+ * Will generate only one event, and after that is automatically
+ * cancelled.
+ */
+typedef struct libxl__ev_devstate libxl__ev_devstate;
+typedef void libxl__ev_devstate_callback(libxl__egc *egc, libxl__ev_devstate*,
+                                         int rc);
+  /* rc will be 0, ERROR_TIMEDOUT, ERROR_INVAL (meaning path was removed),
+   * or ERROR_FAIL if other stuff went wrong (in which latter case, logged) */
+
+struct libxl__ev_devstate {
+    /* read-only for caller, who may read only when waiting: */
+    int wanted;
+    libxl__ev_devstate_callback *callback;
+    /* as for the remainder, read-only public parts may also be
+     * read by the caller (notably, watch.path), but only when waiting: */
+    libxl__ev_xswatch watch;
+    libxl__ev_time timeout;
+};
+
+static inline void libxl__ev_devstate_init(libxl__ev_devstate *ds)
+{
+    libxl__ev_time_init(&ds->timeout);
+    libxl__ev_xswatch_init(&ds->watch);
+}
+
+static inline void libxl__ev_devstate_cancel(libxl__gc *gc,
+                                             libxl__ev_devstate *ds)
+{
+    libxl__ev_time_deregister(gc,&ds->timeout);
+    libxl__ev_xswatch_deregister(gc,&ds->watch);
+}
+
+_hidden int libxl__ev_devstate_wait(libxl__gc *gc, libxl__ev_devstate *ds,
+                                    libxl__ev_devstate_callback cb,
+                                    const char *state_path,
+                                    int state, int milliseconds);
+
+
+/*
  * libxl__try_phy_backend - Check if there's support for the passed
  * type of file using the PHY backend
  * st_mode: mode_t of the file, as returned by stat function

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:03 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6w-0006NC-0a; Fri, 03 Feb 2012 21:56:02 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6u-0006JY-4S
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:00 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1328306152!11910338!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1458 invoked from network); 3 Feb 2012 21:55:53 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:53 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6l-0001iI-Uz
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:51 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6l-0002Iv-Dp
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:51 +0000
Message-Id: <E1RtR6l-0002Iv-Dp@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:50 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Convert to asynchronous:
	device removal
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327683686 0
# Node ID 47ea714a4e27ffe0dbcbfc8ace7bb4e189390206
# Parent  0fc9948457962514ab9a9a4bb9ed0bf3695dee1b
libxl: Convert to asynchronous: device removal

Convert libxl_FOO_device_remove, and the function which does the bulk
of the work, libxl__device_remove, to the new async ops scheme.

Adjust all callers.

Also remove libxl__wait_for_device_state which is now obsolete.

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


diff -r 0fc994845796 -r 47ea714a4e27 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Jan 27 17:01:25 2012 +0000
+++ b/tools/libxl/libxl.c	Fri Jan 27 17:01:26 2012 +0000
@@ -1311,19 +1311,23 @@
 }
 
 int libxl_device_disk_remove(libxl_ctx *ctx, uint32_t domid,
-                             libxl_device_disk *disk)
+                             libxl_device_disk *disk,
+                             const libxl_asyncop_how *ao_how)
 {
-    GC_INIT(ctx);
+    AO_CREATE(ctx, domid, ao_how);
     libxl__device device;
     int rc;
 
     rc = libxl__device_from_disk(gc, domid, disk, &device);
     if (rc != 0) goto out;
 
-    rc = libxl__device_remove(gc, &device, 1);
+    rc = libxl__initiate_device_remove(ao, &device);
+    if (rc) goto out;
+
+    return AO_INPROGRESS;
+
 out:
-    GC_FREE;
-    return rc;
+    return AO_ABORT(rc);
 }
 
 int libxl_device_disk_destroy(libxl_ctx *ctx, uint32_t domid,
@@ -1537,11 +1541,11 @@
 
     ret = 0;
 
-    libxl_device_disk_remove(ctx, domid, disks + i);
+    libxl_device_disk_remove(ctx, domid, disks + i, 0);
     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_remove(ctx, stubdomid, disks + i, 0);
         libxl_device_disk_add(ctx, stubdomid, disk);
     }
 out:
@@ -1760,19 +1764,23 @@
 }
 
 int libxl_device_nic_remove(libxl_ctx *ctx, uint32_t domid,
-                            libxl_device_nic *nic)
+                            libxl_device_nic *nic,
+                            const libxl_asyncop_how *ao_how)
 {
-    GC_INIT(ctx);
+    AO_CREATE(ctx, domid, ao_how);
     libxl__device device;
     int rc;
 
     rc = libxl__device_from_nic(gc, domid, nic, &device);
     if (rc != 0) goto out;
 
-    rc = libxl__device_remove(gc, &device, 1);
+    rc = libxl__initiate_device_remove(ao, &device);
+    if (rc) goto out;
+
+    return AO_INPROGRESS;
+
 out:
-    GC_FREE;
-    return rc;
+    return AO_ABORT(rc);
 }
 
 int libxl_device_nic_destroy(libxl_ctx *ctx, uint32_t domid,
@@ -2100,19 +2108,23 @@
 }
 
 int libxl_device_vkb_remove(libxl_ctx *ctx, uint32_t domid,
-                            libxl_device_vkb *vkb)
+                            libxl_device_vkb *vkb,
+                            const libxl_asyncop_how *ao_how)
 {
-    GC_INIT(ctx);
+    AO_CREATE(ctx, domid, ao_how);
     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);
+    rc = libxl__initiate_device_remove(ao, &device);
+    if (rc) goto out;
+
+    return AO_INPROGRESS;
+
 out:
-    GC_FREE;
-    return rc;
+    return AO_ABORT(rc);
 }
 
 int libxl_device_vkb_destroy(libxl_ctx *ctx, uint32_t domid,
@@ -2217,19 +2229,23 @@
 }
 
 int libxl_device_vfb_remove(libxl_ctx *ctx, uint32_t domid,
-                            libxl_device_vfb *vfb)
+                            libxl_device_vfb *vfb,
+                            const libxl_asyncop_how *ao_how)
 {
-    GC_INIT(ctx);
+    AO_CREATE(ctx, domid, ao_how);
     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);
+    rc = libxl__initiate_device_remove(ao, &device);
+    if (rc) goto out;
+
+    return AO_INPROGRESS;
+
 out:
-    GC_FREE;
-    return rc;
+    return AO_ABORT(rc);
 }
 
 int libxl_device_vfb_destroy(libxl_ctx *ctx, uint32_t domid,
diff -r 0fc994845796 -r 47ea714a4e27 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Fri Jan 27 17:01:25 2012 +0000
+++ b/tools/libxl/libxl.h	Fri Jan 27 17:01:26 2012 +0000
@@ -467,7 +467,9 @@
 /* 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_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk);
+int libxl_device_disk_remove(libxl_ctx *ctx, uint32_t domid,
+                             libxl_device_disk *disk,
+                             const libxl_asyncop_how *ao_how);
 int libxl_device_disk_destroy(libxl_ctx *ctx, uint32_t domid,
                               libxl_device_disk *disk);
 
@@ -491,7 +493,9 @@
 /* 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_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic);
+int libxl_device_nic_remove(libxl_ctx *ctx, uint32_t domid,
+                            libxl_device_nic *nic,
+                            const libxl_asyncop_how *ao_how);
 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);
@@ -501,13 +505,17 @@
 /* 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_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb);
+int libxl_device_vkb_remove(libxl_ctx *ctx, uint32_t domid,
+                            libxl_device_vkb *vkb,
+                            const libxl_asyncop_how *ao_how);
 int libxl_device_vkb_destroy(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb);
 
 /* 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_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb);
+int libxl_device_vfb_remove(libxl_ctx *ctx, uint32_t domid,
+                            libxl_device_vfb *vfb,
+                            const libxl_asyncop_how *ao_how);
 int libxl_device_vfb_destroy(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb);
 
 /* PCI Passthrough */
diff -r 0fc994845796 -r 47ea714a4e27 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Fri Jan 27 17:01:25 2012 +0000
+++ b/tools/libxl/libxl_device.c	Fri Jan 27 17:01:26 2012 +0000
@@ -356,85 +356,36 @@
     return -1;
 }
 
-/*
- * Returns 0 if a device is removed, ERROR_* if an error
- * or timeout occurred.
- */
-int libxl__wait_for_device_state(libxl__gc *gc, struct timeval *tv,
-                                 XenbusState state,
-                                 libxl__device_state_handler handler)
-{
-    libxl_ctx *ctx = libxl__gc_owner(gc);
-    int nfds, rc;
-    unsigned int n;
-    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);
-    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 *sstate = libxl__xs_read(gc, XBT_NULL,
-                                             l1[XS_WATCH_PATH]);
-                if (!sstate || atoi(sstate) == state) {
-                    /* Call handler function if present */
-                    if (handler)
-                        rc = handler(gc, l1, sstate);
-                } else {
-                    /* State is different than expected, continue waiting... */
-                    goto start;
-                }
-                free(l1);
-            } else {
-                rc = ERROR_FAIL;
-            }
-            break;
-    }
-    return rc;
+typedef struct {
+    libxl__ao *ao;
+    libxl__ev_devstate ds;
+} libxl__ao_device_remove;
+
+static void device_remove_cleanup(libxl__gc *gc,
+                                  libxl__ao_device_remove *aorm) {
+    if (!aorm) return;
+    libxl__ev_devstate_cancel(gc, &aorm->ds);
 }
 
-/*
- * Handler function for device destruction to be passed to
- * libxl__wait_for_device_state
- */
-static int destroy_device(libxl__gc *gc, char **l1, char *state)
-{
-    libxl_ctx *ctx = libxl__gc_owner(gc);
-
-    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]);
-
-    return 0;
+static void device_remove_callback(libxl__egc *egc, libxl__ev_devstate *ds,
+                                   int rc) {
+    libxl__ao_device_remove *aorm = CONTAINER_OF(ds, *aorm, ds);
+    libxl__gc *gc = &aorm->ao->gc;
+    libxl__ao_complete(egc, aorm->ao, rc);
+    device_remove_cleanup(gc, aorm);
 }
 
-/*
- * 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)
+int libxl__initiate_device_remove(libxl__ao *ao, libxl__device *dev)
 {
+    AO_GC;
     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;
+    libxl__ao_device_remove *aorm = 0;
 
     if (!state)
         goto out;
@@ -457,23 +408,21 @@
         }
     }
 
-    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;
-        rc = libxl__wait_for_device_state(gc, &tv, XenbusStateClosed,
-                                          destroy_device);
-        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 */
-    }
+    aorm = libxl__zalloc(gc, sizeof(*aorm));
+    aorm->ao = ao;
+    libxl__ev_devstate_init(&aorm->ds);
 
-out:
+    rc = libxl__ev_devstate_wait(gc, &aorm->ds, device_remove_callback,
+                                 state_path, XenbusStateClosed,
+                                 LIBXL_DESTROY_TIMEOUT * 1000);
+    if (rc) goto out;
+
+    return 0;
+
+ out:
+    device_remove_cleanup(gc, aorm);
     return rc;
 }
 
diff -r 0fc994845796 -r 47ea714a4e27 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:25 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:26 2012 +0000
@@ -655,35 +655,15 @@
 _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_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);
 _hidden int libxl__wait_for_backend(libxl__gc *gc, char *be_path, char *state);
 
-/* Handler for the libxl__wait_for_device_state callback */
-/*
- * libxl__device_state_handler - Handler for the libxl__wait_for_device_state
- * gc: allocation pool
- * l1: array containing the path and token
- * state: string that contains the state of the device
- *
- * Returns 0 on success, and < 0 on error.
- */
-typedef int libxl__device_state_handler(libxl__gc *gc, char **l1, char *state);
-
-/*
- * libxl__wait_for_device_state - waits a given time for a device to
- * reach a given state
- * gc: allocation pool
- * tv: timeval struct containing the maximum time to wait
- * state: state to wait for (check xen/io/xenbus.h)
- * handler: callback function to execute when state is reached
- *
- * Returns 0 on success, and < 0 on error.
- */
-_hidden int libxl__wait_for_device_state(libxl__gc *gc, struct timeval *tv,
-                                         XenbusState state,
-                                         libxl__device_state_handler handler);
+/* Arranges that dev will be removed from its guest.  When
+ * this is done, the ao will be completed.  An error
+ * return from libxl__initiate_device_remove means that the ao
+ * will _not_ be completed and the caller must do so. */
+_hidden int libxl__initiate_device_remove(libxl__ao*, libxl__device *dev);
 
 /*
  * libxl__ev_devstate - waits a given time for a device to
diff -r 0fc994845796 -r 47ea714a4e27 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Fri Jan 27 17:01:25 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Fri Jan 27 17:01:26 2012 +0000
@@ -4712,7 +4712,7 @@
             return 1;
         }
     }
-    if (libxl_device_nic_remove(ctx, domid, &nic)) {
+    if (libxl_device_nic_remove(ctx, domid, &nic, 0)) {
         fprintf(stderr, "libxl_device_nic_del failed.\n");
         return 1;
     }
@@ -4807,7 +4807,7 @@
         fprintf(stderr, "Error: Device %s not connected.\n", argv[optind+1]);
         return 1;
     }
-    if (libxl_device_disk_remove(ctx, domid, &disk)) {
+    if (libxl_device_disk_remove(ctx, domid, &disk, 0)) {
         fprintf(stderr, "libxl_device_disk_remove failed.\n");
     }
     return 0;
diff -r 0fc994845796 -r 47ea714a4e27 tools/ocaml/libs/xl/xenlight_stubs.c
--- a/tools/ocaml/libs/xl/xenlight_stubs.c	Fri Jan 27 17:01:25 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c	Fri Jan 27 17:01:26 2012 +0000
@@ -247,7 +247,7 @@
 	device_disk_val(&gc, &lg, &c_info, info);
 
 	INIT_CTX();
-	ret = libxl_device_disk_remove(ctx, Int_val(domid), &c_info);
+	ret = libxl_device_disk_remove(ctx, Int_val(domid), &c_info, 0);
 	if (ret != 0)
 		failwith_xl("disk_del", &lg);
 	FREE_CTX();
@@ -281,7 +281,7 @@
 	device_nic_val(&gc, &lg, &c_info, info);
 
 	INIT_CTX();
-	ret = libxl_device_nic_remove(ctx, Int_val(domid), &c_info);
+	ret = libxl_device_nic_remove(ctx, Int_val(domid), &c_info, 0);
 	if (ret != 0)
 		failwith_xl("nic_del", &lg);
 	FREE_CTX();
@@ -316,7 +316,7 @@
 	device_vkb_val(&gc, &lg, &c_info, info);
 
 	INIT_CTX();
-	ret = libxl_device_vkb_remove(ctx, Int_val(domid), &c_info);
+	ret = libxl_device_vkb_remove(ctx, Int_val(domid), &c_info, 0);
 	if (ret != 0)
 		failwith_xl("vkb_clean_shutdown", &lg);
 	FREE_CTX();
@@ -370,7 +370,7 @@
 	device_vfb_val(&gc, &lg, &c_info, info);
 
 	INIT_CTX();
-	ret = libxl_device_vfb_remove(ctx, Int_val(domid), &c_info);
+	ret = libxl_device_vfb_remove(ctx, Int_val(domid), &c_info, 0);
 	if (ret != 0)
 		failwith_xl("vfb_clean_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 Fri Feb 03 21:56:03 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6w-0006NC-0a; Fri, 03 Feb 2012 21:56:02 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6u-0006JY-4S
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:00 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1328306152!11910338!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1458 invoked from network); 3 Feb 2012 21:55:53 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:53 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6l-0001iI-Uz
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:51 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6l-0002Iv-Dp
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:51 +0000
Message-Id: <E1RtR6l-0002Iv-Dp@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:50 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Convert to asynchronous:
	device removal
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327683686 0
# Node ID 47ea714a4e27ffe0dbcbfc8ace7bb4e189390206
# Parent  0fc9948457962514ab9a9a4bb9ed0bf3695dee1b
libxl: Convert to asynchronous: device removal

Convert libxl_FOO_device_remove, and the function which does the bulk
of the work, libxl__device_remove, to the new async ops scheme.

Adjust all callers.

Also remove libxl__wait_for_device_state which is now obsolete.

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


diff -r 0fc994845796 -r 47ea714a4e27 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Jan 27 17:01:25 2012 +0000
+++ b/tools/libxl/libxl.c	Fri Jan 27 17:01:26 2012 +0000
@@ -1311,19 +1311,23 @@
 }
 
 int libxl_device_disk_remove(libxl_ctx *ctx, uint32_t domid,
-                             libxl_device_disk *disk)
+                             libxl_device_disk *disk,
+                             const libxl_asyncop_how *ao_how)
 {
-    GC_INIT(ctx);
+    AO_CREATE(ctx, domid, ao_how);
     libxl__device device;
     int rc;
 
     rc = libxl__device_from_disk(gc, domid, disk, &device);
     if (rc != 0) goto out;
 
-    rc = libxl__device_remove(gc, &device, 1);
+    rc = libxl__initiate_device_remove(ao, &device);
+    if (rc) goto out;
+
+    return AO_INPROGRESS;
+
 out:
-    GC_FREE;
-    return rc;
+    return AO_ABORT(rc);
 }
 
 int libxl_device_disk_destroy(libxl_ctx *ctx, uint32_t domid,
@@ -1537,11 +1541,11 @@
 
     ret = 0;
 
-    libxl_device_disk_remove(ctx, domid, disks + i);
+    libxl_device_disk_remove(ctx, domid, disks + i, 0);
     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_remove(ctx, stubdomid, disks + i, 0);
         libxl_device_disk_add(ctx, stubdomid, disk);
     }
 out:
@@ -1760,19 +1764,23 @@
 }
 
 int libxl_device_nic_remove(libxl_ctx *ctx, uint32_t domid,
-                            libxl_device_nic *nic)
+                            libxl_device_nic *nic,
+                            const libxl_asyncop_how *ao_how)
 {
-    GC_INIT(ctx);
+    AO_CREATE(ctx, domid, ao_how);
     libxl__device device;
     int rc;
 
     rc = libxl__device_from_nic(gc, domid, nic, &device);
     if (rc != 0) goto out;
 
-    rc = libxl__device_remove(gc, &device, 1);
+    rc = libxl__initiate_device_remove(ao, &device);
+    if (rc) goto out;
+
+    return AO_INPROGRESS;
+
 out:
-    GC_FREE;
-    return rc;
+    return AO_ABORT(rc);
 }
 
 int libxl_device_nic_destroy(libxl_ctx *ctx, uint32_t domid,
@@ -2100,19 +2108,23 @@
 }
 
 int libxl_device_vkb_remove(libxl_ctx *ctx, uint32_t domid,
-                            libxl_device_vkb *vkb)
+                            libxl_device_vkb *vkb,
+                            const libxl_asyncop_how *ao_how)
 {
-    GC_INIT(ctx);
+    AO_CREATE(ctx, domid, ao_how);
     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);
+    rc = libxl__initiate_device_remove(ao, &device);
+    if (rc) goto out;
+
+    return AO_INPROGRESS;
+
 out:
-    GC_FREE;
-    return rc;
+    return AO_ABORT(rc);
 }
 
 int libxl_device_vkb_destroy(libxl_ctx *ctx, uint32_t domid,
@@ -2217,19 +2229,23 @@
 }
 
 int libxl_device_vfb_remove(libxl_ctx *ctx, uint32_t domid,
-                            libxl_device_vfb *vfb)
+                            libxl_device_vfb *vfb,
+                            const libxl_asyncop_how *ao_how)
 {
-    GC_INIT(ctx);
+    AO_CREATE(ctx, domid, ao_how);
     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);
+    rc = libxl__initiate_device_remove(ao, &device);
+    if (rc) goto out;
+
+    return AO_INPROGRESS;
+
 out:
-    GC_FREE;
-    return rc;
+    return AO_ABORT(rc);
 }
 
 int libxl_device_vfb_destroy(libxl_ctx *ctx, uint32_t domid,
diff -r 0fc994845796 -r 47ea714a4e27 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Fri Jan 27 17:01:25 2012 +0000
+++ b/tools/libxl/libxl.h	Fri Jan 27 17:01:26 2012 +0000
@@ -467,7 +467,9 @@
 /* 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_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk);
+int libxl_device_disk_remove(libxl_ctx *ctx, uint32_t domid,
+                             libxl_device_disk *disk,
+                             const libxl_asyncop_how *ao_how);
 int libxl_device_disk_destroy(libxl_ctx *ctx, uint32_t domid,
                               libxl_device_disk *disk);
 
@@ -491,7 +493,9 @@
 /* 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_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic);
+int libxl_device_nic_remove(libxl_ctx *ctx, uint32_t domid,
+                            libxl_device_nic *nic,
+                            const libxl_asyncop_how *ao_how);
 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);
@@ -501,13 +505,17 @@
 /* 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_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb);
+int libxl_device_vkb_remove(libxl_ctx *ctx, uint32_t domid,
+                            libxl_device_vkb *vkb,
+                            const libxl_asyncop_how *ao_how);
 int libxl_device_vkb_destroy(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb);
 
 /* 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_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb);
+int libxl_device_vfb_remove(libxl_ctx *ctx, uint32_t domid,
+                            libxl_device_vfb *vfb,
+                            const libxl_asyncop_how *ao_how);
 int libxl_device_vfb_destroy(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb);
 
 /* PCI Passthrough */
diff -r 0fc994845796 -r 47ea714a4e27 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Fri Jan 27 17:01:25 2012 +0000
+++ b/tools/libxl/libxl_device.c	Fri Jan 27 17:01:26 2012 +0000
@@ -356,85 +356,36 @@
     return -1;
 }
 
-/*
- * Returns 0 if a device is removed, ERROR_* if an error
- * or timeout occurred.
- */
-int libxl__wait_for_device_state(libxl__gc *gc, struct timeval *tv,
-                                 XenbusState state,
-                                 libxl__device_state_handler handler)
-{
-    libxl_ctx *ctx = libxl__gc_owner(gc);
-    int nfds, rc;
-    unsigned int n;
-    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);
-    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 *sstate = libxl__xs_read(gc, XBT_NULL,
-                                             l1[XS_WATCH_PATH]);
-                if (!sstate || atoi(sstate) == state) {
-                    /* Call handler function if present */
-                    if (handler)
-                        rc = handler(gc, l1, sstate);
-                } else {
-                    /* State is different than expected, continue waiting... */
-                    goto start;
-                }
-                free(l1);
-            } else {
-                rc = ERROR_FAIL;
-            }
-            break;
-    }
-    return rc;
+typedef struct {
+    libxl__ao *ao;
+    libxl__ev_devstate ds;
+} libxl__ao_device_remove;
+
+static void device_remove_cleanup(libxl__gc *gc,
+                                  libxl__ao_device_remove *aorm) {
+    if (!aorm) return;
+    libxl__ev_devstate_cancel(gc, &aorm->ds);
 }
 
-/*
- * Handler function for device destruction to be passed to
- * libxl__wait_for_device_state
- */
-static int destroy_device(libxl__gc *gc, char **l1, char *state)
-{
-    libxl_ctx *ctx = libxl__gc_owner(gc);
-
-    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]);
-
-    return 0;
+static void device_remove_callback(libxl__egc *egc, libxl__ev_devstate *ds,
+                                   int rc) {
+    libxl__ao_device_remove *aorm = CONTAINER_OF(ds, *aorm, ds);
+    libxl__gc *gc = &aorm->ao->gc;
+    libxl__ao_complete(egc, aorm->ao, rc);
+    device_remove_cleanup(gc, aorm);
 }
 
-/*
- * 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)
+int libxl__initiate_device_remove(libxl__ao *ao, libxl__device *dev)
 {
+    AO_GC;
     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;
+    libxl__ao_device_remove *aorm = 0;
 
     if (!state)
         goto out;
@@ -457,23 +408,21 @@
         }
     }
 
-    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;
-        rc = libxl__wait_for_device_state(gc, &tv, XenbusStateClosed,
-                                          destroy_device);
-        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 */
-    }
+    aorm = libxl__zalloc(gc, sizeof(*aorm));
+    aorm->ao = ao;
+    libxl__ev_devstate_init(&aorm->ds);
 
-out:
+    rc = libxl__ev_devstate_wait(gc, &aorm->ds, device_remove_callback,
+                                 state_path, XenbusStateClosed,
+                                 LIBXL_DESTROY_TIMEOUT * 1000);
+    if (rc) goto out;
+
+    return 0;
+
+ out:
+    device_remove_cleanup(gc, aorm);
     return rc;
 }
 
diff -r 0fc994845796 -r 47ea714a4e27 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:25 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Fri Jan 27 17:01:26 2012 +0000
@@ -655,35 +655,15 @@
 _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_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);
 _hidden int libxl__wait_for_backend(libxl__gc *gc, char *be_path, char *state);
 
-/* Handler for the libxl__wait_for_device_state callback */
-/*
- * libxl__device_state_handler - Handler for the libxl__wait_for_device_state
- * gc: allocation pool
- * l1: array containing the path and token
- * state: string that contains the state of the device
- *
- * Returns 0 on success, and < 0 on error.
- */
-typedef int libxl__device_state_handler(libxl__gc *gc, char **l1, char *state);
-
-/*
- * libxl__wait_for_device_state - waits a given time for a device to
- * reach a given state
- * gc: allocation pool
- * tv: timeval struct containing the maximum time to wait
- * state: state to wait for (check xen/io/xenbus.h)
- * handler: callback function to execute when state is reached
- *
- * Returns 0 on success, and < 0 on error.
- */
-_hidden int libxl__wait_for_device_state(libxl__gc *gc, struct timeval *tv,
-                                         XenbusState state,
-                                         libxl__device_state_handler handler);
+/* Arranges that dev will be removed from its guest.  When
+ * this is done, the ao will be completed.  An error
+ * return from libxl__initiate_device_remove means that the ao
+ * will _not_ be completed and the caller must do so. */
+_hidden int libxl__initiate_device_remove(libxl__ao*, libxl__device *dev);
 
 /*
  * libxl__ev_devstate - waits a given time for a device to
diff -r 0fc994845796 -r 47ea714a4e27 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Fri Jan 27 17:01:25 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Fri Jan 27 17:01:26 2012 +0000
@@ -4712,7 +4712,7 @@
             return 1;
         }
     }
-    if (libxl_device_nic_remove(ctx, domid, &nic)) {
+    if (libxl_device_nic_remove(ctx, domid, &nic, 0)) {
         fprintf(stderr, "libxl_device_nic_del failed.\n");
         return 1;
     }
@@ -4807,7 +4807,7 @@
         fprintf(stderr, "Error: Device %s not connected.\n", argv[optind+1]);
         return 1;
     }
-    if (libxl_device_disk_remove(ctx, domid, &disk)) {
+    if (libxl_device_disk_remove(ctx, domid, &disk, 0)) {
         fprintf(stderr, "libxl_device_disk_remove failed.\n");
     }
     return 0;
diff -r 0fc994845796 -r 47ea714a4e27 tools/ocaml/libs/xl/xenlight_stubs.c
--- a/tools/ocaml/libs/xl/xenlight_stubs.c	Fri Jan 27 17:01:25 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c	Fri Jan 27 17:01:26 2012 +0000
@@ -247,7 +247,7 @@
 	device_disk_val(&gc, &lg, &c_info, info);
 
 	INIT_CTX();
-	ret = libxl_device_disk_remove(ctx, Int_val(domid), &c_info);
+	ret = libxl_device_disk_remove(ctx, Int_val(domid), &c_info, 0);
 	if (ret != 0)
 		failwith_xl("disk_del", &lg);
 	FREE_CTX();
@@ -281,7 +281,7 @@
 	device_nic_val(&gc, &lg, &c_info, info);
 
 	INIT_CTX();
-	ret = libxl_device_nic_remove(ctx, Int_val(domid), &c_info);
+	ret = libxl_device_nic_remove(ctx, Int_val(domid), &c_info, 0);
 	if (ret != 0)
 		failwith_xl("nic_del", &lg);
 	FREE_CTX();
@@ -316,7 +316,7 @@
 	device_vkb_val(&gc, &lg, &c_info, info);
 
 	INIT_CTX();
-	ret = libxl_device_vkb_remove(ctx, Int_val(domid), &c_info);
+	ret = libxl_device_vkb_remove(ctx, Int_val(domid), &c_info, 0);
 	if (ret != 0)
 		failwith_xl("vkb_clean_shutdown", &lg);
 	FREE_CTX();
@@ -370,7 +370,7 @@
 	device_vfb_val(&gc, &lg, &c_info, info);
 
 	INIT_CTX();
-	ret = libxl_device_vfb_remove(ctx, Int_val(domid), &c_info);
+	ret = libxl_device_vfb_remove(ctx, Int_val(domid), &c_info, 0);
 	if (ret != 0)
 		failwith_xl("vfb_clean_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 Fri Feb 03 21:56:03 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6x-0006Ns-6S; Fri, 03 Feb 2012 21:56:03 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6w-0006KU-6k
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:02 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1328306154!6783297!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12295 invoked from network); 3 Feb 2012 21:55:56 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:56 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6o-0001iT-NE
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:54 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6o-0002KA-2e
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:54 +0000
Message-Id: <E1RtR6o-0002KA-2e@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:53 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: fix mutex initialization
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327686494 0
# Node ID 235ac9bf133826e8089949dc7a764ca70474ae91
# Parent  8a7e07afe3ed96585ccec65c37acc581c0522a48
libxl: fix mutex initialization

The macro PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP is not defined on
NetBSD, so define mutex attributes manually.

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 8a7e07afe3ed -r 235ac9bf1338 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Jan 27 17:09:04 2012 +0000
+++ b/tools/libxl/libxl.c	Fri Jan 27 17:48:14 2012 +0000
@@ -26,7 +26,6 @@
 {
     libxl_ctx *ctx = NULL;
     struct stat stat_buf;
-    const pthread_mutex_t mutex_value = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
     int rc;
 
     if (version != LIBXL_VERSION) { rc = ERROR_VERSION; goto out; }
@@ -40,10 +39,10 @@
     memset(ctx, 0, sizeof(libxl_ctx));
     ctx->lg = lg;
 
-    /* This somewhat convoluted approach is needed because
-     * PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP is defined to be valid
-     * only as an initialiser, not as an expression. */
-    memcpy(&ctx->lock, &mutex_value, sizeof(ctx->lock));
+    if (libxl__init_recursive_mutex(ctx, &ctx->lock) < 0) {
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Failed to initialize mutex");
+        return ERROR_FAIL;
+    }
 
     LIBXL_TAILQ_INIT(&ctx->occurred);
 
diff -r 8a7e07afe3ed -r 235ac9bf1338 tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c	Fri Jan 27 17:09:04 2012 +0000
+++ b/tools/libxl/libxl_internal.c	Fri Jan 27 17:48:14 2012 +0000
@@ -296,6 +296,33 @@
     return 0;
 }
 
+_hidden int libxl__init_recursive_mutex(libxl_ctx *ctx, pthread_mutex_t *lock)
+{
+    pthread_mutexattr_t attr;
+    int rc = 0;
+
+    if (pthread_mutexattr_init(&attr) != 0) {
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, 
+                         "Failed to init mutex attributes\n");
+        return ERROR_FAIL;
+    }
+    if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0) {
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, 
+                         "Failed to set mutex attributes\n");
+        rc = ERROR_FAIL;
+        goto out;
+    }
+    if (pthread_mutex_init(lock, &attr) != 0) {
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, 
+                         "Failed to init mutex\n");
+        rc = ERROR_FAIL;
+        goto out;
+    }
+out:
+    pthread_mutexattr_destroy(&attr);
+    return rc;
+}
+
 libxl_device_model_version libxl__device_model_version_running(libxl__gc *gc,
                                                                uint32_t domid)
 {
diff -r 8a7e07afe3ed -r 235ac9bf1338 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Jan 27 17:09:04 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Fri Jan 27 17:48:14 2012 +0000
@@ -974,6 +974,8 @@
 _hidden int libxl__parse_mac(const char *s, libxl_mac mac);
 /* compare mac address @a and @b. 0 if the same, -ve if a<b and +ve if a>b */
 _hidden int libxl__compare_macs(libxl_mac *a, libxl_mac *b);
+/* init a recursive mutex */
+_hidden int libxl__init_recursive_mutex(libxl_ctx *ctx, pthread_mutex_t *lock);
 
 _hidden int libxl__gettimeofday(libxl__gc *gc, struct timeval *now_r);
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:03 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6x-0006Ns-6S; Fri, 03 Feb 2012 21:56:03 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6w-0006KU-6k
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:02 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1328306154!6783297!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12295 invoked from network); 3 Feb 2012 21:55:56 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:56 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6o-0001iT-NE
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:54 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6o-0002KA-2e
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:54 +0000
Message-Id: <E1RtR6o-0002KA-2e@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:53 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: fix mutex initialization
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327686494 0
# Node ID 235ac9bf133826e8089949dc7a764ca70474ae91
# Parent  8a7e07afe3ed96585ccec65c37acc581c0522a48
libxl: fix mutex initialization

The macro PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP is not defined on
NetBSD, so define mutex attributes manually.

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 8a7e07afe3ed -r 235ac9bf1338 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Jan 27 17:09:04 2012 +0000
+++ b/tools/libxl/libxl.c	Fri Jan 27 17:48:14 2012 +0000
@@ -26,7 +26,6 @@
 {
     libxl_ctx *ctx = NULL;
     struct stat stat_buf;
-    const pthread_mutex_t mutex_value = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
     int rc;
 
     if (version != LIBXL_VERSION) { rc = ERROR_VERSION; goto out; }
@@ -40,10 +39,10 @@
     memset(ctx, 0, sizeof(libxl_ctx));
     ctx->lg = lg;
 
-    /* This somewhat convoluted approach is needed because
-     * PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP is defined to be valid
-     * only as an initialiser, not as an expression. */
-    memcpy(&ctx->lock, &mutex_value, sizeof(ctx->lock));
+    if (libxl__init_recursive_mutex(ctx, &ctx->lock) < 0) {
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Failed to initialize mutex");
+        return ERROR_FAIL;
+    }
 
     LIBXL_TAILQ_INIT(&ctx->occurred);
 
diff -r 8a7e07afe3ed -r 235ac9bf1338 tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c	Fri Jan 27 17:09:04 2012 +0000
+++ b/tools/libxl/libxl_internal.c	Fri Jan 27 17:48:14 2012 +0000
@@ -296,6 +296,33 @@
     return 0;
 }
 
+_hidden int libxl__init_recursive_mutex(libxl_ctx *ctx, pthread_mutex_t *lock)
+{
+    pthread_mutexattr_t attr;
+    int rc = 0;
+
+    if (pthread_mutexattr_init(&attr) != 0) {
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, 
+                         "Failed to init mutex attributes\n");
+        return ERROR_FAIL;
+    }
+    if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0) {
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, 
+                         "Failed to set mutex attributes\n");
+        rc = ERROR_FAIL;
+        goto out;
+    }
+    if (pthread_mutex_init(lock, &attr) != 0) {
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, 
+                         "Failed to init mutex\n");
+        rc = ERROR_FAIL;
+        goto out;
+    }
+out:
+    pthread_mutexattr_destroy(&attr);
+    return rc;
+}
+
 libxl_device_model_version libxl__device_model_version_running(libxl__gc *gc,
                                                                uint32_t domid)
 {
diff -r 8a7e07afe3ed -r 235ac9bf1338 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Jan 27 17:09:04 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Fri Jan 27 17:48:14 2012 +0000
@@ -974,6 +974,8 @@
 _hidden int libxl__parse_mac(const char *s, libxl_mac mac);
 /* compare mac address @a and @b. 0 if the same, -ve if a<b and +ve if a>b */
 _hidden int libxl__compare_macs(libxl_mac *a, libxl_mac *b);
+/* init a recursive mutex */
+_hidden int libxl__init_recursive_mutex(libxl_ctx *ctx, pthread_mutex_t *lock);
 
 _hidden int libxl__gettimeofday(libxl__gc *gc, struct timeval *now_r);
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:05 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6x-0006Nl-3d; Fri, 03 Feb 2012 21:56:03 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6v-0006KC-3B
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:01 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1328306153!6783294!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12275 invoked from network); 3 Feb 2012 21:55:54 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:54 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6n-0001iL-Kk
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:53 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6m-0002JR-AM
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:53 +0000
Message-Id: <E1RtR6m-0002JR-AM@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:51 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: fix upstream qemu binary name
	to what we actually install
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327684144 0
# Node ID 8a7e07afe3ed96585ccec65c37acc581c0522a48
# Parent  47ea714a4e27ffe0dbcbfc8ace7bb4e189390206
libxl: fix upstream qemu binary name to what we actually install

Binary is always qemu-system-i386 even for a 64 bit build.

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


diff -r 47ea714a4e27 -r 8a7e07afe3ed tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Fri Jan 27 17:01:26 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Fri Jan 27 17:09:04 2012 +0000
@@ -50,7 +50,7 @@
             dm = libxl__abs_path(gc, "qemu-dm", libxl_libexec_path());
             break;
         case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
-            dm = libxl__abs_path(gc, "qemu", libxl_libexec_path());
+            dm = libxl__abs_path(gc, "qemu-system-i386", libxl_libexec_path());
             break;
         default:
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR,

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:05 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR6x-0006Nl-3d; Fri, 03 Feb 2012 21:56:03 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6v-0006KC-3B
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:01 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1328306153!6783294!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12275 invoked from network); 3 Feb 2012 21:55:54 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:54 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6n-0001iL-Kk
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:53 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6m-0002JR-AM
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:53 +0000
Message-Id: <E1RtR6m-0002JR-AM@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:51 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: fix upstream qemu binary name
	to what we actually install
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327684144 0
# Node ID 8a7e07afe3ed96585ccec65c37acc581c0522a48
# Parent  47ea714a4e27ffe0dbcbfc8ace7bb4e189390206
libxl: fix upstream qemu binary name to what we actually install

Binary is always qemu-system-i386 even for a 64 bit build.

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


diff -r 47ea714a4e27 -r 8a7e07afe3ed tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Fri Jan 27 17:01:26 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Fri Jan 27 17:09:04 2012 +0000
@@ -50,7 +50,7 @@
             dm = libxl__abs_path(gc, "qemu-dm", libxl_libexec_path());
             break;
         case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
-            dm = libxl__abs_path(gc, "qemu", libxl_libexec_path());
+            dm = libxl__abs_path(gc, "qemu-system-i386", libxl_libexec_path());
             break;
         default:
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR,

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:09 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR71-0006Qi-B8; Fri, 03 Feb 2012 21:56:07 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6z-0006MB-UO
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:06 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-182.messagelabs.com!1328306158!13017829!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=2.0 required=7.0 tests=SUBJECT_RANDOMQ
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7876 invoked from network); 3 Feb 2012 21:55:59 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:59 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6r-0001ib-U0
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:57 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6p-0002Kj-J0
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:57 +0000
Message-Id: <E1RtR6p-0002Kj-J0@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:54 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl_qmp: fix qmp_next to cope with
	multiple lines read in a single buffer
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327687100 0
# Node ID 502e0214bdb29ab5c6c8f2764e06604cc18e2635
# Parent  235ac9bf133826e8089949dc7a764ca70474ae91
libxl_qmp: fix qmp_next to cope with multiple lines read in a single buffer

qmp_next doesn't handle multiple lines read together in a single
buffer correctly at the moment.  This patch fixes it.

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


diff -r 235ac9bf1338 -r 502e0214bdb2 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Fri Jan 27 17:48:14 2012 +0000
+++ b/tools/libxl/libxl_qmp.c	Fri Jan 27 17:58:20 2012 +0000
@@ -408,17 +408,18 @@
             char *end = NULL;
             if (incomplete) {
                 size_t current_pos = s - incomplete;
+                incomplete = libxl__realloc(gc, incomplete,
+                                            incomplete_size + rd);
+                strncat(incomplete + incomplete_size, qmp->buffer, rd);
+                s = incomplete + current_pos;
                 incomplete_size += rd;
-                incomplete = libxl__realloc(gc, incomplete,
-                                            incomplete_size + 1);
-                incomplete = strncat(incomplete, qmp->buffer, rd);
-                s = incomplete + current_pos;
                 s_end = incomplete + incomplete_size;
             } else {
                 incomplete = libxl__strndup(gc, qmp->buffer, rd);
                 incomplete_size = rd;
                 s = incomplete;
                 s_end = s + rd;
+                rd = 0;
             }
 
             end = strstr(s, "\r\n");

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:09 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR71-0006Qi-B8; Fri, 03 Feb 2012 21:56:07 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6z-0006MB-UO
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:06 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-182.messagelabs.com!1328306158!13017829!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=2.0 required=7.0 tests=SUBJECT_RANDOMQ
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7876 invoked from network); 3 Feb 2012 21:55:59 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:59 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6r-0001ib-U0
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:57 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6p-0002Kj-J0
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:55:57 +0000
Message-Id: <E1RtR6p-0002Kj-J0@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:54 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl_qmp: fix qmp_next to cope with
	multiple lines read in a single buffer
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327687100 0
# Node ID 502e0214bdb29ab5c6c8f2764e06604cc18e2635
# Parent  235ac9bf133826e8089949dc7a764ca70474ae91
libxl_qmp: fix qmp_next to cope with multiple lines read in a single buffer

qmp_next doesn't handle multiple lines read together in a single
buffer correctly at the moment.  This patch fixes it.

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


diff -r 235ac9bf1338 -r 502e0214bdb2 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Fri Jan 27 17:48:14 2012 +0000
+++ b/tools/libxl/libxl_qmp.c	Fri Jan 27 17:58:20 2012 +0000
@@ -408,17 +408,18 @@
             char *end = NULL;
             if (incomplete) {
                 size_t current_pos = s - incomplete;
+                incomplete = libxl__realloc(gc, incomplete,
+                                            incomplete_size + rd);
+                strncat(incomplete + incomplete_size, qmp->buffer, rd);
+                s = incomplete + current_pos;
                 incomplete_size += rd;
-                incomplete = libxl__realloc(gc, incomplete,
-                                            incomplete_size + 1);
-                incomplete = strncat(incomplete, qmp->buffer, rd);
-                s = incomplete + current_pos;
                 s_end = incomplete + incomplete_size;
             } else {
                 incomplete = libxl__strndup(gc, qmp->buffer, rd);
                 incomplete_size = rd;
                 s = incomplete;
                 s_end = s + rd;
+                rd = 0;
             }
 
             end = strstr(s, "\r\n");

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:12 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR75-0006T8-EI; Fri, 03 Feb 2012 21:56:11 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR73-0006P7-L3
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:09 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1328306162!6783309!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12455 invoked from network); 3 Feb 2012 21:56:03 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:03 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6v-0001j9-Sr
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:01 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6v-0002Lp-Ii
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:01 +0000
Message-Id: <E1RtR6v-0002Lp-Ii@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:57 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: memshrtool: tool to test and
	exercise the sharing subsystem
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327688622 0
# Node ID 8c0ef22c10096bc2afe50a2487e17242bfd21fb4
# Parent  502e0214bdb29ab5c6c8f2764e06604cc18e2635
tools: memshrtool: tool to test and exercise the sharing subsystem

This is demo code meant to showcase how to perform sharing
operations. It is useful for testing.

[ Added appropriate lines to .hgignore and .gitignore -iwj ]

Signed-off-by: Adin Scannell <adin@scannell.ca>
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 502e0214bdb2 -r 8c0ef22c1009 .gitignore
--- a/.gitignore	Fri Jan 27 17:58:20 2012 +0000
+++ b/.gitignore	Fri Jan 27 18:23:42 2012 +0000
@@ -210,6 +210,7 @@
 tools/tests/regression/installed/*
 tools/tests/regression/build/*
 tools/tests/regression/downloads/*
+tools/tests/mem-sharing/memshrtool
 tools/vnet/Make.local
 tools/vnet/build/*
 tools/vnet/gc
diff -r 502e0214bdb2 -r 8c0ef22c1009 .hgignore
--- a/.hgignore	Fri Jan 27 17:58:20 2012 +0000
+++ b/.hgignore	Fri Jan 27 18:23:42 2012 +0000
@@ -221,6 +221,7 @@
 ^tools/tests/regression/build/.*$
 ^tools/tests/regression/downloads/.*$
 ^tools/tests/xen-access/xen-access$
+^tools/tests/mem-sharing/memshrtool$
 ^tools/vnet/Make.local$
 ^tools/vnet/build/.*$
 ^tools/vnet/gc$
diff -r 502e0214bdb2 -r 8c0ef22c1009 tools/tests/mem-sharing/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/tests/mem-sharing/Makefile	Fri Jan 27 18:23:42 2012 +0000
@@ -0,0 +1,26 @@
+XEN_ROOT=$(CURDIR)/../../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+CFLAGS += -Werror
+
+CFLAGS += $(CFLAGS_libxenctrl)
+CFLAGS += $(CFLAGS_xeninclude)
+
+TARGETS-y := 
+TARGETS-$(CONFIG_X86) += memshrtool
+TARGETS := $(TARGETS-y)
+
+.PHONY: all
+all: build
+
+.PHONY: build
+build: $(TARGETS)
+
+.PHONY: clean
+clean:
+	$(RM) *.o $(TARGETS) *~ $(DEPS)
+
+memshrtool: memshrtool.o
+	$(CC) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenctrl)
+
+-include $(DEPS)
diff -r 502e0214bdb2 -r 8c0ef22c1009 tools/tests/mem-sharing/memshrtool.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/tests/mem-sharing/memshrtool.c	Fri Jan 27 18:23:42 2012 +0000
@@ -0,0 +1,165 @@
+/*
+ * memshrtool.c
+ *
+ * Copyright 2011 GridCentric Inc. (Adin Scannell, Andres Lagar-Cavilla)
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/mman.h>
+
+#include "xenctrl.h"
+
+static int usage(const char* prog)
+{
+    printf("usage: %s <command> [args...]\n", prog);
+    printf("where <command> may be:\n");
+    printf("  info                    - Display total sharing info.\n");
+    printf("  enable                  - Enable sharing on a domain.\n");
+    printf("  disable                 - Disable sharing on a domain.\n");
+    printf("  nominate <domid> <gfn>  - Nominate a page for sharing.\n");
+    printf("  share <domid> <gfn> <handle> <source> <source-gfn> <source-handle>\n");
+    printf("                          - Share two pages.\n");
+    printf("  unshare <domid> <gfn>   - Unshare a page by grabbing a writable map.\n");
+    printf("  add-to-physmap <domid> <gfn> <source> <source-gfn> <source-handle>\n");
+    printf("                          - Populate a page in a domain with a shared page.\n");
+    printf("  debug-gfn <domid> <gfn> - Debug a particular domain and gfn.\n");
+    return 1;
+}
+
+#define R(f) do { \
+    int rc = f; \
+    if ( rc < 0 ) { \
+        printf("error executing %s: %s\n", #f, \
+                ((errno * -1) == XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID) ? \
+                "problem with client handle" :\
+                ((errno * -1) == XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID) ? \
+                "problem with source handle" : strerror(errno)); \
+        return rc; \
+    } \
+} while(0)
+
+int main(int argc, const char** argv)
+{
+    const char* cmd = NULL;
+    xc_interface *xch = xc_interface_open(0, 0, 0);
+
+    if( argc < 2 )
+        return usage(argv[0]);
+
+    cmd = argv[1];
+
+    if( !strcasecmp(cmd, "info") )
+    {
+        if( argc != 2 )
+            return usage(argv[0]);
+
+        printf("used = %ld\n", xc_sharing_used_frames(xch));
+        printf("freed = %ld\n", xc_sharing_freed_pages(xch));
+    }
+    else if( !strcasecmp(cmd, "enable") )
+    {
+        domid_t domid;
+
+        if( argc != 3 )
+            return usage(argv[0]);
+
+        domid = strtol(argv[2], NULL, 0);
+        R(xc_memshr_control(xch, domid, 1));
+    }
+    else if( !strcasecmp(cmd, "disable") )
+    {
+        domid_t domid;
+
+        if( argc != 3 )
+            return usage(argv[0]);
+
+        domid = strtol(argv[2], NULL, 0);
+        R(xc_memshr_control(xch, domid, 0));
+    }
+    else if( !strcasecmp(cmd, "nominate") )
+    {
+        domid_t domid;
+        unsigned long gfn;
+        uint64_t handle;
+
+        if( argc != 4 )
+            return usage(argv[0]);
+
+        domid = strtol(argv[2], NULL, 0);
+        gfn = strtol(argv[3], NULL, 0);
+        R(xc_memshr_nominate_gfn(xch, domid, gfn, &handle));
+        printf("handle = 0x%08llx\n", (unsigned long long) handle);
+    }
+    else if( !strcasecmp(cmd, "share") )
+    {
+        domid_t domid;
+        unsigned long gfn;
+        uint64_t handle;
+        domid_t source_domid;
+        unsigned long source_gfn;
+        uint64_t source_handle;
+
+        if( argc != 8 )
+            return usage(argv[0]);
+
+        domid = strtol(argv[2], NULL, 0);
+        gfn = strtol(argv[3], NULL, 0);
+        handle = strtol(argv[4], NULL, 0);
+        source_domid = strtol(argv[5], NULL, 0);
+        source_gfn = strtol(argv[6], NULL, 0);
+        source_handle = strtol(argv[7], NULL, 0);
+        R(xc_memshr_share_gfns(xch, source_domid, source_gfn, source_handle, domid, gfn, handle));
+    }
+    else if( !strcasecmp(cmd, "unshare") )
+    {
+        domid_t domid;
+        unsigned long gfn;
+        void *map;
+
+        if( argc != 4 )
+            return usage(argv[0]);
+
+        domid = strtol(argv[2], NULL, 0);
+        gfn = strtol(argv[3], NULL, 0);
+        map = xc_map_foreign_range(xch, domid, 4096, PROT_WRITE, gfn);
+        if( map )
+            munmap(map, 4096);
+        R((int)!map);
+    }
+    else if( !strcasecmp(cmd, "add-to-physmap") )
+    {
+        domid_t domid;
+        unsigned long gfn;
+        domid_t source_domid;
+        unsigned long source_gfn;
+        uint64_t source_handle;
+
+        if( argc != 7 )
+            return usage(argv[0]);
+
+        domid = strtol(argv[2], NULL, 0);
+        gfn = strtol(argv[3], NULL, 0);
+        source_domid = strtol(argv[4], NULL, 0);
+        source_gfn = strtol(argv[5], NULL, 0);
+        source_handle = strtol(argv[6], NULL, 0);
+        R(xc_memshr_add_to_physmap(xch, source_domid, source_gfn, source_handle, domid, gfn));
+    }
+    else if( !strcasecmp(cmd, "debug-gfn") )
+    {
+        domid_t domid;
+        unsigned long gfn;
+
+        if( argc != 4 )
+            return usage(argv[0]);
+
+        domid = strtol(argv[2], NULL, 0);
+        gfn = strtol(argv[3], NULL, 0);
+        R(xc_memshr_debug_gfn(xch, domid, gfn));
+    }
+
+    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 Feb 03 21:56:12 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR75-0006T8-EI; Fri, 03 Feb 2012 21:56:11 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR73-0006P7-L3
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:09 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1328306162!6783309!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12455 invoked from network); 3 Feb 2012 21:56:03 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:03 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6v-0001j9-Sr
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:01 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6v-0002Lp-Ii
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:01 +0000
Message-Id: <E1RtR6v-0002Lp-Ii@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:55:57 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: memshrtool: tool to test and
	exercise the sharing subsystem
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327688622 0
# Node ID 8c0ef22c10096bc2afe50a2487e17242bfd21fb4
# Parent  502e0214bdb29ab5c6c8f2764e06604cc18e2635
tools: memshrtool: tool to test and exercise the sharing subsystem

This is demo code meant to showcase how to perform sharing
operations. It is useful for testing.

[ Added appropriate lines to .hgignore and .gitignore -iwj ]

Signed-off-by: Adin Scannell <adin@scannell.ca>
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 502e0214bdb2 -r 8c0ef22c1009 .gitignore
--- a/.gitignore	Fri Jan 27 17:58:20 2012 +0000
+++ b/.gitignore	Fri Jan 27 18:23:42 2012 +0000
@@ -210,6 +210,7 @@
 tools/tests/regression/installed/*
 tools/tests/regression/build/*
 tools/tests/regression/downloads/*
+tools/tests/mem-sharing/memshrtool
 tools/vnet/Make.local
 tools/vnet/build/*
 tools/vnet/gc
diff -r 502e0214bdb2 -r 8c0ef22c1009 .hgignore
--- a/.hgignore	Fri Jan 27 17:58:20 2012 +0000
+++ b/.hgignore	Fri Jan 27 18:23:42 2012 +0000
@@ -221,6 +221,7 @@
 ^tools/tests/regression/build/.*$
 ^tools/tests/regression/downloads/.*$
 ^tools/tests/xen-access/xen-access$
+^tools/tests/mem-sharing/memshrtool$
 ^tools/vnet/Make.local$
 ^tools/vnet/build/.*$
 ^tools/vnet/gc$
diff -r 502e0214bdb2 -r 8c0ef22c1009 tools/tests/mem-sharing/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/tests/mem-sharing/Makefile	Fri Jan 27 18:23:42 2012 +0000
@@ -0,0 +1,26 @@
+XEN_ROOT=$(CURDIR)/../../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+CFLAGS += -Werror
+
+CFLAGS += $(CFLAGS_libxenctrl)
+CFLAGS += $(CFLAGS_xeninclude)
+
+TARGETS-y := 
+TARGETS-$(CONFIG_X86) += memshrtool
+TARGETS := $(TARGETS-y)
+
+.PHONY: all
+all: build
+
+.PHONY: build
+build: $(TARGETS)
+
+.PHONY: clean
+clean:
+	$(RM) *.o $(TARGETS) *~ $(DEPS)
+
+memshrtool: memshrtool.o
+	$(CC) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenctrl)
+
+-include $(DEPS)
diff -r 502e0214bdb2 -r 8c0ef22c1009 tools/tests/mem-sharing/memshrtool.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/tests/mem-sharing/memshrtool.c	Fri Jan 27 18:23:42 2012 +0000
@@ -0,0 +1,165 @@
+/*
+ * memshrtool.c
+ *
+ * Copyright 2011 GridCentric Inc. (Adin Scannell, Andres Lagar-Cavilla)
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/mman.h>
+
+#include "xenctrl.h"
+
+static int usage(const char* prog)
+{
+    printf("usage: %s <command> [args...]\n", prog);
+    printf("where <command> may be:\n");
+    printf("  info                    - Display total sharing info.\n");
+    printf("  enable                  - Enable sharing on a domain.\n");
+    printf("  disable                 - Disable sharing on a domain.\n");
+    printf("  nominate <domid> <gfn>  - Nominate a page for sharing.\n");
+    printf("  share <domid> <gfn> <handle> <source> <source-gfn> <source-handle>\n");
+    printf("                          - Share two pages.\n");
+    printf("  unshare <domid> <gfn>   - Unshare a page by grabbing a writable map.\n");
+    printf("  add-to-physmap <domid> <gfn> <source> <source-gfn> <source-handle>\n");
+    printf("                          - Populate a page in a domain with a shared page.\n");
+    printf("  debug-gfn <domid> <gfn> - Debug a particular domain and gfn.\n");
+    return 1;
+}
+
+#define R(f) do { \
+    int rc = f; \
+    if ( rc < 0 ) { \
+        printf("error executing %s: %s\n", #f, \
+                ((errno * -1) == XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID) ? \
+                "problem with client handle" :\
+                ((errno * -1) == XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID) ? \
+                "problem with source handle" : strerror(errno)); \
+        return rc; \
+    } \
+} while(0)
+
+int main(int argc, const char** argv)
+{
+    const char* cmd = NULL;
+    xc_interface *xch = xc_interface_open(0, 0, 0);
+
+    if( argc < 2 )
+        return usage(argv[0]);
+
+    cmd = argv[1];
+
+    if( !strcasecmp(cmd, "info") )
+    {
+        if( argc != 2 )
+            return usage(argv[0]);
+
+        printf("used = %ld\n", xc_sharing_used_frames(xch));
+        printf("freed = %ld\n", xc_sharing_freed_pages(xch));
+    }
+    else if( !strcasecmp(cmd, "enable") )
+    {
+        domid_t domid;
+
+        if( argc != 3 )
+            return usage(argv[0]);
+
+        domid = strtol(argv[2], NULL, 0);
+        R(xc_memshr_control(xch, domid, 1));
+    }
+    else if( !strcasecmp(cmd, "disable") )
+    {
+        domid_t domid;
+
+        if( argc != 3 )
+            return usage(argv[0]);
+
+        domid = strtol(argv[2], NULL, 0);
+        R(xc_memshr_control(xch, domid, 0));
+    }
+    else if( !strcasecmp(cmd, "nominate") )
+    {
+        domid_t domid;
+        unsigned long gfn;
+        uint64_t handle;
+
+        if( argc != 4 )
+            return usage(argv[0]);
+
+        domid = strtol(argv[2], NULL, 0);
+        gfn = strtol(argv[3], NULL, 0);
+        R(xc_memshr_nominate_gfn(xch, domid, gfn, &handle));
+        printf("handle = 0x%08llx\n", (unsigned long long) handle);
+    }
+    else if( !strcasecmp(cmd, "share") )
+    {
+        domid_t domid;
+        unsigned long gfn;
+        uint64_t handle;
+        domid_t source_domid;
+        unsigned long source_gfn;
+        uint64_t source_handle;
+
+        if( argc != 8 )
+            return usage(argv[0]);
+
+        domid = strtol(argv[2], NULL, 0);
+        gfn = strtol(argv[3], NULL, 0);
+        handle = strtol(argv[4], NULL, 0);
+        source_domid = strtol(argv[5], NULL, 0);
+        source_gfn = strtol(argv[6], NULL, 0);
+        source_handle = strtol(argv[7], NULL, 0);
+        R(xc_memshr_share_gfns(xch, source_domid, source_gfn, source_handle, domid, gfn, handle));
+    }
+    else if( !strcasecmp(cmd, "unshare") )
+    {
+        domid_t domid;
+        unsigned long gfn;
+        void *map;
+
+        if( argc != 4 )
+            return usage(argv[0]);
+
+        domid = strtol(argv[2], NULL, 0);
+        gfn = strtol(argv[3], NULL, 0);
+        map = xc_map_foreign_range(xch, domid, 4096, PROT_WRITE, gfn);
+        if( map )
+            munmap(map, 4096);
+        R((int)!map);
+    }
+    else if( !strcasecmp(cmd, "add-to-physmap") )
+    {
+        domid_t domid;
+        unsigned long gfn;
+        domid_t source_domid;
+        unsigned long source_gfn;
+        uint64_t source_handle;
+
+        if( argc != 7 )
+            return usage(argv[0]);
+
+        domid = strtol(argv[2], NULL, 0);
+        gfn = strtol(argv[3], NULL, 0);
+        source_domid = strtol(argv[4], NULL, 0);
+        source_gfn = strtol(argv[5], NULL, 0);
+        source_handle = strtol(argv[6], NULL, 0);
+        R(xc_memshr_add_to_physmap(xch, source_domid, source_gfn, source_handle, domid, gfn));
+    }
+    else if( !strcasecmp(cmd, "debug-gfn") )
+    {
+        domid_t domid;
+        unsigned long gfn;
+
+        if( argc != 4 )
+            return usage(argv[0]);
+
+        domid = strtol(argv[2], NULL, 0);
+        gfn = strtol(argv[3], NULL, 0);
+        R(xc_memshr_debug_gfn(xch, domid, gfn));
+    }
+
+    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 Feb 03 21:56:15 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR78-0006V7-HH; Fri, 03 Feb 2012 21:56:14 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR76-0006Qe-Ll
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-182.messagelabs.com!1328306164!13648623!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27546 invoked from network); 3 Feb 2012 21:56:06 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:06 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6y-0001jF-I6
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6w-0002MH-F7
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:03 +0000
Message-Id: <E1RtR6w-0002MH-F7@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:01 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/libxc: handle fallback in
	linux_privcmd_map_foreign_bulk properly
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327689175 0
# Node ID cdb1e4a3845024c474141e6962ca0a8ace062d55
# Parent  8c0ef22c10096bc2afe50a2487e17242bfd21fb4
tools/libxc: handle fallback in linux_privcmd_map_foreign_bulk properly

If the first ioctl fails with ENOENT it means the command is known. If a
second attempt to map each gfn happens to fail then there is no need to
run the fallback code. Some gfns are paged and the fallback code would
not fix the failure. Instead return the EINVAL to the caller.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 8c0ef22c1009 -r cdb1e4a38450 tools/libxc/xc_linux_osdep.c
--- a/tools/libxc/xc_linux_osdep.c	Fri Jan 27 18:23:42 2012 +0000
+++ b/tools/libxc/xc_linux_osdep.c	Fri Jan 27 18:32:55 2012 +0000
@@ -217,6 +217,7 @@
 
     rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH_V2, &ioctlx);
 
+    /* Command was recognized, some gfn in arr are in paging state */
     if ( rc < 0 && errno == ENOENT )
     {
         for ( i = rc = 0; rc == 0 && i < num; i++ )
@@ -235,8 +236,8 @@
             } while ( rc < 0 && errno == ENOENT && err[i] == -ENOENT );
         }
     }
-
-    if ( rc < 0 && errno == EINVAL && (int)num > 0 )
+    /* Command was not recognized, use fall back */
+    else if ( rc < 0 && errno == EINVAL && (int)num > 0 )
     {
         /*
          * IOCTL_PRIVCMD_MMAPBATCH_V2 is not supported - fall back to

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:15 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR78-0006V7-HH; Fri, 03 Feb 2012 21:56:14 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR76-0006Qe-Ll
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-182.messagelabs.com!1328306164!13648623!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27546 invoked from network); 3 Feb 2012 21:56:06 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:06 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6y-0001jF-I6
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6w-0002MH-F7
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:03 +0000
Message-Id: <E1RtR6w-0002MH-F7@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:01 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/libxc: handle fallback in
	linux_privcmd_map_foreign_bulk properly
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327689175 0
# Node ID cdb1e4a3845024c474141e6962ca0a8ace062d55
# Parent  8c0ef22c10096bc2afe50a2487e17242bfd21fb4
tools/libxc: handle fallback in linux_privcmd_map_foreign_bulk properly

If the first ioctl fails with ENOENT it means the command is known. If a
second attempt to map each gfn happens to fail then there is no need to
run the fallback code. Some gfns are paged and the fallback code would
not fix the failure. Instead return the EINVAL to the caller.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 8c0ef22c1009 -r cdb1e4a38450 tools/libxc/xc_linux_osdep.c
--- a/tools/libxc/xc_linux_osdep.c	Fri Jan 27 18:23:42 2012 +0000
+++ b/tools/libxc/xc_linux_osdep.c	Fri Jan 27 18:32:55 2012 +0000
@@ -217,6 +217,7 @@
 
     rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH_V2, &ioctlx);
 
+    /* Command was recognized, some gfn in arr are in paging state */
     if ( rc < 0 && errno == ENOENT )
     {
         for ( i = rc = 0; rc == 0 && i < num; i++ )
@@ -235,8 +236,8 @@
             } while ( rc < 0 && errno == ENOENT && err[i] == -ENOENT );
         }
     }
-
-    if ( rc < 0 && errno == EINVAL && (int)num > 0 )
+    /* Command was not recognized, use fall back */
+    else if ( rc < 0 && errno == EINVAL && (int)num > 0 )
     {
         /*
          * IOCTL_PRIVCMD_MMAPBATCH_V2 is not supported - fall back to

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:17 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7A-0006Wm-K7; Fri, 03 Feb 2012 21:56:16 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR78-0006Rw-M7
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1328306167!11933597!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4461 invoked from network); 3 Feb 2012 21:56:08 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:08 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR71-0001jO-4u
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:07 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6z-0002NF-1H
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:06 +0000
Message-Id: <E1RtR6z-0002NF-1H@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:04 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: make file_op largefile
	aware
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327691017 0
# Node ID 255ae011567db6b96b083347158c28e30b656970
# Parent  cdb1e4a3845024c474141e6962ca0a8ace062d55
xenpaging: make file_op largefile aware

lseek() takes an off_t, the used "int << shiftsize" does not automatically
convert the int into a larger type. This leads to write errors with pagefiles
larger than 2G. Fix this by shifting an off_t instead of an int.

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


diff -r cdb1e4a38450 -r 255ae011567d tools/xenpaging/file_ops.c
--- a/tools/xenpaging/file_ops.c	Fri Jan 27 18:32:55 2012 +0000
+++ b/tools/xenpaging/file_ops.c	Fri Jan 27 19:03:37 2012 +0000
@@ -26,12 +26,12 @@
 static int file_op(int fd, void *page, int i,
                    ssize_t (*fn)(int, void *, size_t))
 {
-    off_t seek_ret;
+    off_t offset = i;
     int total = 0;
     int bytes;
 
-    seek_ret = lseek(fd, i << PAGE_SHIFT, SEEK_SET);
-    if ( seek_ret == (off_t)-1 )
+    offset = lseek(fd, offset << PAGE_SHIFT, SEEK_SET);
+    if ( offset == (off_t)-1 )
         return -1;
 
     while ( total < PAGE_SIZE )

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:17 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7A-0006Wm-K7; Fri, 03 Feb 2012 21:56:16 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR78-0006Rw-M7
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1328306167!11933597!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4461 invoked from network); 3 Feb 2012 21:56:08 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:08 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR71-0001jO-4u
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:07 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR6z-0002NF-1H
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:06 +0000
Message-Id: <E1RtR6z-0002NF-1H@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:04 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: make file_op largefile
	aware
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327691017 0
# Node ID 255ae011567db6b96b083347158c28e30b656970
# Parent  cdb1e4a3845024c474141e6962ca0a8ace062d55
xenpaging: make file_op largefile aware

lseek() takes an off_t, the used "int << shiftsize" does not automatically
convert the int into a larger type. This leads to write errors with pagefiles
larger than 2G. Fix this by shifting an off_t instead of an int.

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


diff -r cdb1e4a38450 -r 255ae011567d tools/xenpaging/file_ops.c
--- a/tools/xenpaging/file_ops.c	Fri Jan 27 18:32:55 2012 +0000
+++ b/tools/xenpaging/file_ops.c	Fri Jan 27 19:03:37 2012 +0000
@@ -26,12 +26,12 @@
 static int file_op(int fd, void *page, int i,
                    ssize_t (*fn)(int, void *, size_t))
 {
-    off_t seek_ret;
+    off_t offset = i;
     int total = 0;
     int bytes;
 
-    seek_ret = lseek(fd, i << PAGE_SHIFT, SEEK_SET);
-    if ( seek_ret == (off_t)-1 )
+    offset = lseek(fd, offset << PAGE_SHIFT, SEEK_SET);
+    if ( offset == (off_t)-1 )
         return -1;
 
     while ( total < PAGE_SIZE )

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:18 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7B-0006Xq-Me; Fri, 03 Feb 2012 21:56:17 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7A-0006W6-6a
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1328306126!61471755!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23353 invoked from network); 3 Feb 2012 21:55:27 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:27 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR77-0001jh-MF
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR77-0002QA-Kg
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:13 +0000
Message-Id: <E1RtR77-0002QA-Kg@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] amd iommu: disable iommu emulation
	on non-iommu systems
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327758036 0
# Node ID 04623ceabb7296a4e3f51401397ecef4febdd659
# Parent  54000bca7a6ad096f5cdbc9318ba0d099d76e1a7
amd iommu: disable iommu emulation on non-iommu systems

Introduce a new flag to disable iommu emulation on old iommu systems.
This patch is taken from my v4 patch queue, which is till pending, to
make old or non-iommu system to run cleanly without interfered by
iommuv2 codes. This might be helpful to isolate iommuv2 code in
debugging unstable regressions. The reset part of v4 will be re-based.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 54000bca7a6a -r 04623ceabb72 xen/drivers/passthrough/amd/iommu_guest.c
--- a/xen/drivers/passthrough/amd/iommu_guest.c	Fri Jan 27 19:17:03 2012 +0000
+++ b/xen/drivers/passthrough/amd/iommu_guest.c	Sat Jan 28 13:40:36 2012 +0000
@@ -805,6 +805,9 @@
     p2m_type_t t;
     struct guest_iommu *iommu = domain_iommu(d);
 
+    if ( !is_hvm_domain(d) || !iommu_enabled || !iommuv2_enabled )
+        return 0;
+
     if ( !iommu )
         return -EACCES;
 
@@ -867,7 +870,7 @@
     struct guest_iommu *iommu;
     struct hvm_iommu *hd  = domain_hvm_iommu(d);
 
-    if ( !is_hvm_domain(d) )
+    if ( !is_hvm_domain(d) || !iommu_enabled || !iommuv2_enabled )
         return 0;
 
     iommu = xzalloc(struct guest_iommu);
@@ -893,7 +896,7 @@
 {
     struct guest_iommu *iommu;
 
-    if ( !is_hvm_domain(d) )
+    if ( !is_hvm_domain(d) || !iommu_enabled || !iommuv2_enabled )
         return;
 
     iommu = domain_iommu(d);
diff -r 54000bca7a6a -r 04623ceabb72 xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c	Fri Jan 27 19:17:03 2012 +0000
+++ b/xen/drivers/passthrough/amd/iommu_init.c	Sat Jan 28 13:40:36 2012 +0000
@@ -38,6 +38,7 @@
 static struct radix_tree_root ivrs_maps;
 struct list_head amd_iommu_head;
 struct table_struct device_table;
+bool_t iommuv2_enabled;
 
 static int iommu_has_ht_flag(struct amd_iommu *iommu, u8 mask)
 {
@@ -887,6 +888,9 @@
 
     get_iommu_features(iommu);
 
+    if ( iommu->features )
+        iommuv2_enabled = 1;
+
     if ( allocate_cmd_buffer(iommu) == NULL )
         goto error_out;
 
@@ -950,6 +954,7 @@
     iommu_enabled = 0;
     iommu_passthrough = 0;
     iommu_intremap = 0;
+    iommuv2_enabled = 0;
 }
 
 /*
diff -r 54000bca7a6a -r 04623ceabb72 xen/include/asm-x86/amd-iommu.h
--- a/xen/include/asm-x86/amd-iommu.h	Fri Jan 27 19:17:03 2012 +0000
+++ b/xen/include/asm-x86/amd-iommu.h	Sat Jan 28 13:40:36 2012 +0000
@@ -182,4 +182,6 @@
     struct guest_iommu_msi  msi;
 };
 
+extern bool_t iommuv2_enabled;
+
 #endif /* _ASM_X86_64_AMD_IOMMU_H */

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:18 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7B-0006Xq-Me; Fri, 03 Feb 2012 21:56:17 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7A-0006W6-6a
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1328306126!61471755!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23353 invoked from network); 3 Feb 2012 21:55:27 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:27 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR77-0001jh-MF
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR77-0002QA-Kg
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:13 +0000
Message-Id: <E1RtR77-0002QA-Kg@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] amd iommu: disable iommu emulation
	on non-iommu systems
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327758036 0
# Node ID 04623ceabb7296a4e3f51401397ecef4febdd659
# Parent  54000bca7a6ad096f5cdbc9318ba0d099d76e1a7
amd iommu: disable iommu emulation on non-iommu systems

Introduce a new flag to disable iommu emulation on old iommu systems.
This patch is taken from my v4 patch queue, which is till pending, to
make old or non-iommu system to run cleanly without interfered by
iommuv2 codes. This might be helpful to isolate iommuv2 code in
debugging unstable regressions. The reset part of v4 will be re-based.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 54000bca7a6a -r 04623ceabb72 xen/drivers/passthrough/amd/iommu_guest.c
--- a/xen/drivers/passthrough/amd/iommu_guest.c	Fri Jan 27 19:17:03 2012 +0000
+++ b/xen/drivers/passthrough/amd/iommu_guest.c	Sat Jan 28 13:40:36 2012 +0000
@@ -805,6 +805,9 @@
     p2m_type_t t;
     struct guest_iommu *iommu = domain_iommu(d);
 
+    if ( !is_hvm_domain(d) || !iommu_enabled || !iommuv2_enabled )
+        return 0;
+
     if ( !iommu )
         return -EACCES;
 
@@ -867,7 +870,7 @@
     struct guest_iommu *iommu;
     struct hvm_iommu *hd  = domain_hvm_iommu(d);
 
-    if ( !is_hvm_domain(d) )
+    if ( !is_hvm_domain(d) || !iommu_enabled || !iommuv2_enabled )
         return 0;
 
     iommu = xzalloc(struct guest_iommu);
@@ -893,7 +896,7 @@
 {
     struct guest_iommu *iommu;
 
-    if ( !is_hvm_domain(d) )
+    if ( !is_hvm_domain(d) || !iommu_enabled || !iommuv2_enabled )
         return;
 
     iommu = domain_iommu(d);
diff -r 54000bca7a6a -r 04623ceabb72 xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c	Fri Jan 27 19:17:03 2012 +0000
+++ b/xen/drivers/passthrough/amd/iommu_init.c	Sat Jan 28 13:40:36 2012 +0000
@@ -38,6 +38,7 @@
 static struct radix_tree_root ivrs_maps;
 struct list_head amd_iommu_head;
 struct table_struct device_table;
+bool_t iommuv2_enabled;
 
 static int iommu_has_ht_flag(struct amd_iommu *iommu, u8 mask)
 {
@@ -887,6 +888,9 @@
 
     get_iommu_features(iommu);
 
+    if ( iommu->features )
+        iommuv2_enabled = 1;
+
     if ( allocate_cmd_buffer(iommu) == NULL )
         goto error_out;
 
@@ -950,6 +954,7 @@
     iommu_enabled = 0;
     iommu_passthrough = 0;
     iommu_intremap = 0;
+    iommuv2_enabled = 0;
 }
 
 /*
diff -r 54000bca7a6a -r 04623ceabb72 xen/include/asm-x86/amd-iommu.h
--- a/xen/include/asm-x86/amd-iommu.h	Fri Jan 27 19:17:03 2012 +0000
+++ b/xen/include/asm-x86/amd-iommu.h	Sat Jan 28 13:40:36 2012 +0000
@@ -182,4 +182,6 @@
     struct guest_iommu_msi  msi;
 };
 
+extern bool_t iommuv2_enabled;
+
 #endif /* _ASM_X86_64_AMD_IOMMU_H */

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7F-0006ab-Q1; Fri, 03 Feb 2012 21:56:21 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7E-0006VK-6K
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1328306171!11729438!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30359 invoked from network); 3 Feb 2012 21:56:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR74-0001jT-8Z
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR71-0002OH-NF
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:08 +0000
Message-Id: <E1RtR71-0002OH-NF@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: extend pCPUs specification
	for vcpu-pin.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Dario Faggioli <dario.faggioli@citrix.com>
# Date 1327691640 0
# Node ID 83ed83ceddf5a086558ab87db489d2169acaa936
# Parent  255ae011567db6b96b083347158c28e30b656970
libxl: extend pCPUs specification for vcpu-pin.

Allow for "^<cpuid>" syntax while specifying the pCPUs list
during a vcpu-pin. This enables doing the following:

 xl vcpu-pin 1 1 0-4,^2

and achieving:

 xl vcpu-list
 Name                                ID  VCPU   CPU State   Time(s) CPU Affinity
 ...
 Squeeze_pv                           1     1    3   -b-       2.4  0-1,3-4
 ...

Negative ranges are also supported, such as "0-4,^1-2" to
mean "0,3-4"

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 255ae011567d -r 83ed83ceddf5 tools/libxl/libxl_utils.h
--- a/tools/libxl/libxl_utils.h	Fri Jan 27 19:03:37 2012 +0000
+++ b/tools/libxl/libxl_utils.h	Fri Jan 27 19:14:00 2012 +0000
@@ -71,6 +71,8 @@
 void libxl_cpumap_set(libxl_cpumap *cpumap, int cpu);
 void libxl_cpumap_reset(libxl_cpumap *cpumap, int cpu);
 #define libxl_for_each_cpu(var, map) for (var = 0; var < (map).size * 8; var++)
+#define libxl_for_each_set_cpu(v, m) for (v = 0; v < (m).size * 8; v++) \
+                                             if (libxl_cpumap_test(&(m), v))
 
 int libxl_cpuarray_alloc(libxl_ctx *ctx, libxl_cpuarray *cpuarray);
 
diff -r 255ae011567d -r 83ed83ceddf5 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Fri Jan 27 19:03:37 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Fri Jan 27 19:14:00 2012 +0000
@@ -3568,13 +3568,72 @@
     return 0;
 }
 
+static int vcpupin_parse(char *cpu, libxl_cpumap *cpumap)
+{
+    libxl_cpumap exclude_cpumap;
+    uint32_t cpuida, cpuidb;
+    char *endptr, *toka, *tokb, *saveptr = NULL;
+    int i, rc = 0, rmcpu;
+
+    if (!strcmp(cpu, "all")) {
+        memset(cpumap->map, -1, cpumap->size);
+        return 0;
+    }
+
+    if (libxl_cpumap_alloc(ctx, &exclude_cpumap)) {
+        fprintf(stderr, "Error: Failed to allocate cpumap.\n");
+        return ENOMEM;
+    }
+
+    for (toka = strtok_r(cpu, ",", &saveptr); toka;
+         toka = strtok_r(NULL, ",", &saveptr)) {
+        rmcpu = 0;
+        if (*toka == '^') {
+            /* This (These) Cpu(s) will be removed from the map */
+            toka++;
+            rmcpu = 1;
+        }
+        /* Extract a valid (range of) cpu(s) */
+        cpuida = cpuidb = strtoul(toka, &endptr, 10);
+        if (endptr == toka) {
+            fprintf(stderr, "Error: Invalid argument.\n");
+            rc = EINVAL;
+            goto vcpp_out;
+        }
+        if (*endptr == '-') {
+            tokb = endptr + 1;
+            cpuidb = strtoul(tokb, &endptr, 10);
+            if (endptr == tokb || cpuida > cpuidb) {
+                fprintf(stderr, "Error: Invalid argument.\n");
+                rc = EINVAL;
+                goto vcpp_out;
+            }
+        }
+        while (cpuida <= cpuidb) {
+            rmcpu == 0 ? libxl_cpumap_set(cpumap, cpuida) :
+                         libxl_cpumap_set(&exclude_cpumap, cpuida);
+            cpuida++;
+        }
+    }
+
+    /* Clear all the cpus from the removal list */
+    libxl_for_each_set_cpu(i, exclude_cpumap) {
+        libxl_cpumap_reset(cpumap, i);
+    }
+
+vcpp_out:
+    libxl_cpumap_dispose(&exclude_cpumap);
+
+    return rc;
+}
+
 static void vcpupin(const char *d, const char *vcpu, char *cpu)
 {
     libxl_vcpuinfo *vcpuinfo;
     libxl_cpumap cpumap;
 
-    uint32_t vcpuid, cpuida, cpuidb;
-    char *endptr, *toka, *tokb;
+    uint32_t vcpuid;
+    char *endptr;
     int i, nb_vcpu;
 
     vcpuid = strtoul(vcpu, &endptr, 10);
@@ -3591,32 +3650,9 @@
     if (libxl_cpumap_alloc(ctx, &cpumap)) {
         goto vcpupin_out;
     }
-    if (strcmp(cpu, "all")) {
-        for (toka = strtok(cpu, ","), i = 0; toka; toka = strtok(NULL, ","), ++i) {
-            cpuida = strtoul(toka, &endptr, 10);
-            if (toka == endptr) {
-                fprintf(stderr, "Error: Invalid argument.\n");
-                goto vcpupin_out1;
-            }
-            if (*endptr == '-') {
-                tokb = endptr + 1;
-                cpuidb = strtoul(tokb, &endptr, 10);
-                if ((tokb == endptr) || (cpuida > cpuidb)) {
-                    fprintf(stderr, "Error: Invalid argument.\n");
-                    goto vcpupin_out1;
-                }
-                while (cpuida <= cpuidb) {
-                    libxl_cpumap_set(&cpumap, cpuida);
-                    ++cpuida;
-                }
-            } else {
-                libxl_cpumap_set(&cpumap, cpuida);
-            }
-        }
-    }
-    else {
-        memset(cpumap.map, -1, cpumap.size);
-    }
+
+    if (vcpupin_parse(cpu, &cpumap))
+        goto vcpupin_out1;
 
     if (vcpuid != -1) {
         if (libxl_set_vcpuaffinity(ctx, domid, vcpuid, &cpumap) == -1) {

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7F-0006ab-Q1; Fri, 03 Feb 2012 21:56:21 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7E-0006VK-6K
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1328306171!11729438!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30359 invoked from network); 3 Feb 2012 21:56:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR74-0001jT-8Z
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR71-0002OH-NF
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:08 +0000
Message-Id: <E1RtR71-0002OH-NF@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: extend pCPUs specification
	for vcpu-pin.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Dario Faggioli <dario.faggioli@citrix.com>
# Date 1327691640 0
# Node ID 83ed83ceddf5a086558ab87db489d2169acaa936
# Parent  255ae011567db6b96b083347158c28e30b656970
libxl: extend pCPUs specification for vcpu-pin.

Allow for "^<cpuid>" syntax while specifying the pCPUs list
during a vcpu-pin. This enables doing the following:

 xl vcpu-pin 1 1 0-4,^2

and achieving:

 xl vcpu-list
 Name                                ID  VCPU   CPU State   Time(s) CPU Affinity
 ...
 Squeeze_pv                           1     1    3   -b-       2.4  0-1,3-4
 ...

Negative ranges are also supported, such as "0-4,^1-2" to
mean "0,3-4"

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 255ae011567d -r 83ed83ceddf5 tools/libxl/libxl_utils.h
--- a/tools/libxl/libxl_utils.h	Fri Jan 27 19:03:37 2012 +0000
+++ b/tools/libxl/libxl_utils.h	Fri Jan 27 19:14:00 2012 +0000
@@ -71,6 +71,8 @@
 void libxl_cpumap_set(libxl_cpumap *cpumap, int cpu);
 void libxl_cpumap_reset(libxl_cpumap *cpumap, int cpu);
 #define libxl_for_each_cpu(var, map) for (var = 0; var < (map).size * 8; var++)
+#define libxl_for_each_set_cpu(v, m) for (v = 0; v < (m).size * 8; v++) \
+                                             if (libxl_cpumap_test(&(m), v))
 
 int libxl_cpuarray_alloc(libxl_ctx *ctx, libxl_cpuarray *cpuarray);
 
diff -r 255ae011567d -r 83ed83ceddf5 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Fri Jan 27 19:03:37 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Fri Jan 27 19:14:00 2012 +0000
@@ -3568,13 +3568,72 @@
     return 0;
 }
 
+static int vcpupin_parse(char *cpu, libxl_cpumap *cpumap)
+{
+    libxl_cpumap exclude_cpumap;
+    uint32_t cpuida, cpuidb;
+    char *endptr, *toka, *tokb, *saveptr = NULL;
+    int i, rc = 0, rmcpu;
+
+    if (!strcmp(cpu, "all")) {
+        memset(cpumap->map, -1, cpumap->size);
+        return 0;
+    }
+
+    if (libxl_cpumap_alloc(ctx, &exclude_cpumap)) {
+        fprintf(stderr, "Error: Failed to allocate cpumap.\n");
+        return ENOMEM;
+    }
+
+    for (toka = strtok_r(cpu, ",", &saveptr); toka;
+         toka = strtok_r(NULL, ",", &saveptr)) {
+        rmcpu = 0;
+        if (*toka == '^') {
+            /* This (These) Cpu(s) will be removed from the map */
+            toka++;
+            rmcpu = 1;
+        }
+        /* Extract a valid (range of) cpu(s) */
+        cpuida = cpuidb = strtoul(toka, &endptr, 10);
+        if (endptr == toka) {
+            fprintf(stderr, "Error: Invalid argument.\n");
+            rc = EINVAL;
+            goto vcpp_out;
+        }
+        if (*endptr == '-') {
+            tokb = endptr + 1;
+            cpuidb = strtoul(tokb, &endptr, 10);
+            if (endptr == tokb || cpuida > cpuidb) {
+                fprintf(stderr, "Error: Invalid argument.\n");
+                rc = EINVAL;
+                goto vcpp_out;
+            }
+        }
+        while (cpuida <= cpuidb) {
+            rmcpu == 0 ? libxl_cpumap_set(cpumap, cpuida) :
+                         libxl_cpumap_set(&exclude_cpumap, cpuida);
+            cpuida++;
+        }
+    }
+
+    /* Clear all the cpus from the removal list */
+    libxl_for_each_set_cpu(i, exclude_cpumap) {
+        libxl_cpumap_reset(cpumap, i);
+    }
+
+vcpp_out:
+    libxl_cpumap_dispose(&exclude_cpumap);
+
+    return rc;
+}
+
 static void vcpupin(const char *d, const char *vcpu, char *cpu)
 {
     libxl_vcpuinfo *vcpuinfo;
     libxl_cpumap cpumap;
 
-    uint32_t vcpuid, cpuida, cpuidb;
-    char *endptr, *toka, *tokb;
+    uint32_t vcpuid;
+    char *endptr;
     int i, nb_vcpu;
 
     vcpuid = strtoul(vcpu, &endptr, 10);
@@ -3591,32 +3650,9 @@
     if (libxl_cpumap_alloc(ctx, &cpumap)) {
         goto vcpupin_out;
     }
-    if (strcmp(cpu, "all")) {
-        for (toka = strtok(cpu, ","), i = 0; toka; toka = strtok(NULL, ","), ++i) {
-            cpuida = strtoul(toka, &endptr, 10);
-            if (toka == endptr) {
-                fprintf(stderr, "Error: Invalid argument.\n");
-                goto vcpupin_out1;
-            }
-            if (*endptr == '-') {
-                tokb = endptr + 1;
-                cpuidb = strtoul(tokb, &endptr, 10);
-                if ((tokb == endptr) || (cpuida > cpuidb)) {
-                    fprintf(stderr, "Error: Invalid argument.\n");
-                    goto vcpupin_out1;
-                }
-                while (cpuida <= cpuidb) {
-                    libxl_cpumap_set(&cpumap, cpuida);
-                    ++cpuida;
-                }
-            } else {
-                libxl_cpumap_set(&cpumap, cpuida);
-            }
-        }
-    }
-    else {
-        memset(cpumap.map, -1, cpumap.size);
-    }
+
+    if (vcpupin_parse(cpu, &cpumap))
+        goto vcpupin_out1;
 
     if (vcpuid != -1) {
         if (libxl_set_vcpuaffinity(ctx, domid, vcpuid, &cpumap) == -1) {

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7G-0006bW-Vk; Fri, 03 Feb 2012 21:56:22 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7E-0006Xf-TP
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-27.messagelabs.com!1328306126!51346303!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8892 invoked from network); 3 Feb 2012 21:55:27 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:27 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR79-0001jl-J4
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR78-0002RC-5g
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:15 +0000
Message-Id: <E1RtR78-0002RC-5g@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Console: introduce console=none
	command line parameter
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327758102 0
# Node ID f8c2cf24a26cc6cdaaad9140e4b1dfc54f07bab3
# Parent  04623ceabb7296a4e3f51401397ecef4febdd659
Console: introduce console=none command line parameter

Currenty, not specifying 'console=<foo>' on the command line causes
Xen to default to 'vga'.  Alternativly, the user can explicitly
specifiy 'console=vga|com1|com2'.

However, there is no way to specify that neither vga nor serial should
be used.  Specifying 'console=' does have the effect that neither vga
nor serial is set up, but at the cost of an "Bad console= option ''"
warning.

Therefore, expliticly support a 'console=none' option which does not
set up vga and does not set up serial, but does not trigger the bad
console warning.

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


diff -r 04623ceabb72 -r f8c2cf24a26c xen/drivers/char/console.c
--- a/xen/drivers/char/console.c	Sat Jan 28 13:40:36 2012 +0000
+++ b/xen/drivers/char/console.c	Sat Jan 28 13:41:42 2012 +0000
@@ -549,6 +549,8 @@
             p++;
         if ( !strncmp(p, "vga", 3) )
             vga_init();
+        else if ( !strncmp(p, "none", 4) )
+            continue;
         else if ( strncmp(p, "com", 3) ||
                   (sercon_handle = serial_parse_handle(p)) == -1 )
         {

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7G-0006bW-Vk; Fri, 03 Feb 2012 21:56:22 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7E-0006Xf-TP
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-27.messagelabs.com!1328306126!51346303!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8892 invoked from network); 3 Feb 2012 21:55:27 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:27 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR79-0001jl-J4
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR78-0002RC-5g
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:15 +0000
Message-Id: <E1RtR78-0002RC-5g@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Console: introduce console=none
	command line parameter
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327758102 0
# Node ID f8c2cf24a26cc6cdaaad9140e4b1dfc54f07bab3
# Parent  04623ceabb7296a4e3f51401397ecef4febdd659
Console: introduce console=none command line parameter

Currenty, not specifying 'console=<foo>' on the command line causes
Xen to default to 'vga'.  Alternativly, the user can explicitly
specifiy 'console=vga|com1|com2'.

However, there is no way to specify that neither vga nor serial should
be used.  Specifying 'console=' does have the effect that neither vga
nor serial is set up, but at the cost of an "Bad console= option ''"
warning.

Therefore, expliticly support a 'console=none' option which does not
set up vga and does not set up serial, but does not trigger the bad
console warning.

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


diff -r 04623ceabb72 -r f8c2cf24a26c xen/drivers/char/console.c
--- a/xen/drivers/char/console.c	Sat Jan 28 13:40:36 2012 +0000
+++ b/xen/drivers/char/console.c	Sat Jan 28 13:41:42 2012 +0000
@@ -549,6 +549,8 @@
             p++;
         if ( !strncmp(p, "vga", 3) )
             vga_init();
+        else if ( !strncmp(p, "none", 4) )
+            continue;
         else if ( strncmp(p, "com", 3) ||
                   (sercon_handle = serial_parse_handle(p)) == -1 )
         {

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7H-0006bh-1t; Fri, 03 Feb 2012 21:56:23 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7F-0006WB-7n
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1328306172!11729440!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30376 invoked from network); 3 Feb 2012 21:56:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR76-0001jc-4D
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR74-0002P2-0b
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:10 +0000
Message-Id: <E1RtR74-0002P2-0b@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: allow for specifying the CPU
	affinity in the config file.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Dario Faggioli <dario.faggioli@citrix.com>
# Date 1327691823 0
# Node ID 54000bca7a6ad096f5cdbc9318ba0d099d76e1a7
# Parent  83ed83ceddf5a086558ab87db489d2169acaa936
libxl: allow for specifying the CPU affinity in the config file.

Enable CPU affinity specification in a VM's config file with the
exact syntax `xl vcpu-pin' provides.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 83ed83ceddf5 -r 54000bca7a6a tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Jan 27 19:14:00 2012 +0000
+++ b/tools/libxl/libxl.c	Fri Jan 27 19:17:03 2012 +0000
@@ -2874,6 +2874,21 @@
     return 0;
 }
 
+int libxl_set_vcpuaffinity_all(libxl_ctx *ctx, uint32_t domid,
+                               unsigned int max_vcpus, libxl_cpumap *cpumap)
+{
+    int i, rc = 0;
+
+    for (i = 0; i < max_vcpus; i++) {
+        if (libxl_set_vcpuaffinity(ctx, domid, i, cpumap)) {
+            LIBXL__LOG(ctx, LIBXL__LOG_WARNING,
+                       "failed to set affinity for %d", i);
+            rc = ERROR_FAIL;
+        }
+    }
+    return rc;
+}
+
 int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, libxl_cpumap *cpumap)
 {
     GC_INIT(ctx);
diff -r 83ed83ceddf5 -r 54000bca7a6a tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Fri Jan 27 19:14:00 2012 +0000
+++ b/tools/libxl/libxl.h	Fri Jan 27 19:17:03 2012 +0000
@@ -588,6 +588,8 @@
                                        int *nb_vcpu, int *nrcpus);
 int libxl_set_vcpuaffinity(libxl_ctx *ctx, uint32_t domid, uint32_t vcpuid,
                            libxl_cpumap *cpumap);
+int libxl_set_vcpuaffinity_all(libxl_ctx *ctx, uint32_t domid,
+                               unsigned int max_vcpus, libxl_cpumap *cpumap);
 int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, libxl_cpumap *cpumap);
 
 int libxl_get_sched_id(libxl_ctx *ctx);
diff -r 83ed83ceddf5 -r 54000bca7a6a tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Fri Jan 27 19:14:00 2012 +0000
+++ b/tools/libxl/libxl_create.c	Fri Jan 27 19:17:03 2012 +0000
@@ -71,6 +71,9 @@
     memset(b_info, '\0', sizeof(*b_info));
     b_info->max_vcpus = 1;
     b_info->cur_vcpus = 1;
+    if (libxl_cpumap_alloc(ctx, &b_info->cpumap))
+        return ERROR_NOMEM;
+    libxl_cpumap_set_any(&b_info->cpumap);
     b_info->max_memkb = 32 * 1024;
     b_info->target_memkb = b_info->max_memkb;
     b_info->disable_migrate = 0;
diff -r 83ed83ceddf5 -r 54000bca7a6a tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c	Fri Jan 27 19:14:00 2012 +0000
+++ b/tools/libxl/libxl_dom.c	Fri Jan 27 19:17:03 2012 +0000
@@ -65,6 +65,7 @@
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int tsc_mode;
     xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus);
+    libxl_set_vcpuaffinity_all(ctx, domid, info->max_vcpus, &info->cpumap);
     xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb + LIBXL_MAXMEM_CONSTANT);
     if (info->type == LIBXL_DOMAIN_TYPE_PV)
         xc_domain_set_memmap_limit(ctx->xch, domid,
diff -r 83ed83ceddf5 -r 54000bca7a6a tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Fri Jan 27 19:14:00 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Fri Jan 27 19:17:03 2012 +0000
@@ -157,6 +157,7 @@
 libxl_domain_build_info = Struct("domain_build_info",[
     ("max_vcpus",       integer),
     ("cur_vcpus",       integer),
+    ("cpumap",          libxl_cpumap),
     ("tsc_mode",        libxl_tsc_mode),
     ("max_memkb",       uint32),
     ("target_memkb",    uint32),
diff -r 83ed83ceddf5 -r 54000bca7a6a tools/libxl/libxl_utils.h
--- a/tools/libxl/libxl_utils.h	Fri Jan 27 19:14:00 2012 +0000
+++ b/tools/libxl/libxl_utils.h	Fri Jan 27 19:17:03 2012 +0000
@@ -70,6 +70,18 @@
 int libxl_cpumap_test(libxl_cpumap *cpumap, int cpu);
 void libxl_cpumap_set(libxl_cpumap *cpumap, int cpu);
 void libxl_cpumap_reset(libxl_cpumap *cpumap, int cpu);
+static inline void libxl_cpumap_set_any(libxl_cpumap *cpumap)
+{
+    memset(cpumap->map, -1, cpumap->size);
+}
+static inline void libxl_cpumap_set_none(libxl_cpumap *cpumap)
+{
+    memset(cpumap->map, 0, cpumap->size);
+}
+static inline int libxl_cpumap_cpu_valid(libxl_cpumap *cpumap, int cpu)
+{
+    return cpu >= 0 && cpu < (cpumap->size * 8);
+}
 #define libxl_for_each_cpu(var, map) for (var = 0; var < (map).size * 8; var++)
 #define libxl_for_each_set_cpu(v, m) for (v = 0; v < (m).size * 8; v++) \
                                              if (libxl_cpumap_test(&(m), v))
diff -r 83ed83ceddf5 -r 54000bca7a6a tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Fri Jan 27 19:14:00 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Fri Jan 27 19:17:03 2012 +0000
@@ -570,6 +570,65 @@
     free(s);
 }
 
+static int vcpupin_parse(char *cpu, libxl_cpumap *cpumap)
+{
+    libxl_cpumap exclude_cpumap;
+    uint32_t cpuida, cpuidb;
+    char *endptr, *toka, *tokb, *saveptr = NULL;
+    int i, rc = 0, rmcpu;
+
+    if (!strcmp(cpu, "all")) {
+        libxl_cpumap_set_any(cpumap);
+        return 0;
+    }
+
+    if (libxl_cpumap_alloc(ctx, &exclude_cpumap)) {
+        fprintf(stderr, "Error: Failed to allocate cpumap.\n");
+        return ENOMEM;
+    }
+
+    for (toka = strtok_r(cpu, ",", &saveptr); toka;
+         toka = strtok_r(NULL, ",", &saveptr)) {
+        rmcpu = 0;
+        if (*toka == '^') {
+            /* This (These) Cpu(s) will be removed from the map */
+            toka++;
+            rmcpu = 1;
+        }
+        /* Extract a valid (range of) cpu(s) */
+        cpuida = cpuidb = strtoul(toka, &endptr, 10);
+        if (endptr == toka) {
+            fprintf(stderr, "Error: Invalid argument.\n");
+            rc = EINVAL;
+            goto vcpp_out;
+        }
+        if (*endptr == '-') {
+            tokb = endptr + 1;
+            cpuidb = strtoul(tokb, &endptr, 10);
+            if (endptr == tokb || cpuida > cpuidb) {
+                fprintf(stderr, "Error: Invalid argument.\n");
+                rc = EINVAL;
+                goto vcpp_out;
+            }
+        }
+        while (cpuida <= cpuidb) {
+            rmcpu == 0 ? libxl_cpumap_set(cpumap, cpuida) :
+                         libxl_cpumap_set(&exclude_cpumap, cpuida);
+            cpuida++;
+        }
+    }
+
+    /* Clear all the cpus from the removal list */
+    libxl_for_each_set_cpu(i, exclude_cpumap) {
+        libxl_cpumap_reset(cpumap, i);
+    }
+
+vcpp_out:
+    libxl_cpumap_dispose(&exclude_cpumap);
+
+    return rc;
+}
+
 static void parse_config_data(const char *configfile_filename_report,
                               const char *configfile_data,
                               int configfile_len,
@@ -579,7 +638,7 @@
     const char *buf;
     long l;
     XLU_Config *config;
-    XLU_ConfigList *vbds, *nics, *pcis, *cvfbs, *cpuids;
+    XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids;
     int pci_power_mgmt = 0;
     int pci_msitranslate = 1;
     int e;
@@ -662,6 +721,29 @@
     if (!xlu_cfg_get_long (config, "maxvcpus", &l, 0))
         b_info->max_vcpus = l;
 
+    if (!xlu_cfg_get_list (config, "cpus", &cpus, 0, 1)) {
+        int i, n_cpus = 0;
+
+        libxl_cpumap_set_none(&b_info->cpumap);
+        while ((buf = xlu_cfg_get_listitem(cpus, n_cpus)) != NULL) {
+            i = atoi(buf);
+            if (!libxl_cpumap_cpu_valid(&b_info->cpumap, i)) {
+                fprintf(stderr, "cpu %d illegal\n", i);
+                exit(1);
+            }
+            libxl_cpumap_set(&b_info->cpumap, i);
+            n_cpus++;
+        }
+    }
+    else if (!xlu_cfg_get_string (config, "cpus", &buf, 0)) {
+        char *buf2 = strdup(buf);
+
+        libxl_cpumap_set_none(&b_info->cpumap);
+        if (vcpupin_parse(buf2, &b_info->cpumap))
+            exit(1);
+        free(buf2);
+    }
+
     if (!xlu_cfg_get_long (config, "memory", &l, 0)) {
         b_info->max_memkb = l * 1024;
         b_info->target_memkb = b_info->max_memkb;
@@ -3568,65 +3650,6 @@
     return 0;
 }
 
-static int vcpupin_parse(char *cpu, libxl_cpumap *cpumap)
-{
-    libxl_cpumap exclude_cpumap;
-    uint32_t cpuida, cpuidb;
-    char *endptr, *toka, *tokb, *saveptr = NULL;
-    int i, rc = 0, rmcpu;
-
-    if (!strcmp(cpu, "all")) {
-        memset(cpumap->map, -1, cpumap->size);
-        return 0;
-    }
-
-    if (libxl_cpumap_alloc(ctx, &exclude_cpumap)) {
-        fprintf(stderr, "Error: Failed to allocate cpumap.\n");
-        return ENOMEM;
-    }
-
-    for (toka = strtok_r(cpu, ",", &saveptr); toka;
-         toka = strtok_r(NULL, ",", &saveptr)) {
-        rmcpu = 0;
-        if (*toka == '^') {
-            /* This (These) Cpu(s) will be removed from the map */
-            toka++;
-            rmcpu = 1;
-        }
-        /* Extract a valid (range of) cpu(s) */
-        cpuida = cpuidb = strtoul(toka, &endptr, 10);
-        if (endptr == toka) {
-            fprintf(stderr, "Error: Invalid argument.\n");
-            rc = EINVAL;
-            goto vcpp_out;
-        }
-        if (*endptr == '-') {
-            tokb = endptr + 1;
-            cpuidb = strtoul(tokb, &endptr, 10);
-            if (endptr == tokb || cpuida > cpuidb) {
-                fprintf(stderr, "Error: Invalid argument.\n");
-                rc = EINVAL;
-                goto vcpp_out;
-            }
-        }
-        while (cpuida <= cpuidb) {
-            rmcpu == 0 ? libxl_cpumap_set(cpumap, cpuida) :
-                         libxl_cpumap_set(&exclude_cpumap, cpuida);
-            cpuida++;
-        }
-    }
-
-    /* Clear all the cpus from the removal list */
-    libxl_for_each_set_cpu(i, exclude_cpumap) {
-        libxl_cpumap_reset(cpumap, i);
-    }
-
-vcpp_out:
-    libxl_cpumap_dispose(&exclude_cpumap);
-
-    return rc;
-}
-
 static void vcpupin(const char *d, const char *vcpu, char *cpu)
 {
     libxl_vcpuinfo *vcpuinfo;

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7H-0006bh-1t; Fri, 03 Feb 2012 21:56:23 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7F-0006WB-7n
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1328306172!11729440!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30376 invoked from network); 3 Feb 2012 21:56:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR76-0001jc-4D
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR74-0002P2-0b
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:10 +0000
Message-Id: <E1RtR74-0002P2-0b@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: allow for specifying the CPU
	affinity in the config file.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Dario Faggioli <dario.faggioli@citrix.com>
# Date 1327691823 0
# Node ID 54000bca7a6ad096f5cdbc9318ba0d099d76e1a7
# Parent  83ed83ceddf5a086558ab87db489d2169acaa936
libxl: allow for specifying the CPU affinity in the config file.

Enable CPU affinity specification in a VM's config file with the
exact syntax `xl vcpu-pin' provides.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 83ed83ceddf5 -r 54000bca7a6a tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Jan 27 19:14:00 2012 +0000
+++ b/tools/libxl/libxl.c	Fri Jan 27 19:17:03 2012 +0000
@@ -2874,6 +2874,21 @@
     return 0;
 }
 
+int libxl_set_vcpuaffinity_all(libxl_ctx *ctx, uint32_t domid,
+                               unsigned int max_vcpus, libxl_cpumap *cpumap)
+{
+    int i, rc = 0;
+
+    for (i = 0; i < max_vcpus; i++) {
+        if (libxl_set_vcpuaffinity(ctx, domid, i, cpumap)) {
+            LIBXL__LOG(ctx, LIBXL__LOG_WARNING,
+                       "failed to set affinity for %d", i);
+            rc = ERROR_FAIL;
+        }
+    }
+    return rc;
+}
+
 int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, libxl_cpumap *cpumap)
 {
     GC_INIT(ctx);
diff -r 83ed83ceddf5 -r 54000bca7a6a tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Fri Jan 27 19:14:00 2012 +0000
+++ b/tools/libxl/libxl.h	Fri Jan 27 19:17:03 2012 +0000
@@ -588,6 +588,8 @@
                                        int *nb_vcpu, int *nrcpus);
 int libxl_set_vcpuaffinity(libxl_ctx *ctx, uint32_t domid, uint32_t vcpuid,
                            libxl_cpumap *cpumap);
+int libxl_set_vcpuaffinity_all(libxl_ctx *ctx, uint32_t domid,
+                               unsigned int max_vcpus, libxl_cpumap *cpumap);
 int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, libxl_cpumap *cpumap);
 
 int libxl_get_sched_id(libxl_ctx *ctx);
diff -r 83ed83ceddf5 -r 54000bca7a6a tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Fri Jan 27 19:14:00 2012 +0000
+++ b/tools/libxl/libxl_create.c	Fri Jan 27 19:17:03 2012 +0000
@@ -71,6 +71,9 @@
     memset(b_info, '\0', sizeof(*b_info));
     b_info->max_vcpus = 1;
     b_info->cur_vcpus = 1;
+    if (libxl_cpumap_alloc(ctx, &b_info->cpumap))
+        return ERROR_NOMEM;
+    libxl_cpumap_set_any(&b_info->cpumap);
     b_info->max_memkb = 32 * 1024;
     b_info->target_memkb = b_info->max_memkb;
     b_info->disable_migrate = 0;
diff -r 83ed83ceddf5 -r 54000bca7a6a tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c	Fri Jan 27 19:14:00 2012 +0000
+++ b/tools/libxl/libxl_dom.c	Fri Jan 27 19:17:03 2012 +0000
@@ -65,6 +65,7 @@
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int tsc_mode;
     xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus);
+    libxl_set_vcpuaffinity_all(ctx, domid, info->max_vcpus, &info->cpumap);
     xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb + LIBXL_MAXMEM_CONSTANT);
     if (info->type == LIBXL_DOMAIN_TYPE_PV)
         xc_domain_set_memmap_limit(ctx->xch, domid,
diff -r 83ed83ceddf5 -r 54000bca7a6a tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Fri Jan 27 19:14:00 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Fri Jan 27 19:17:03 2012 +0000
@@ -157,6 +157,7 @@
 libxl_domain_build_info = Struct("domain_build_info",[
     ("max_vcpus",       integer),
     ("cur_vcpus",       integer),
+    ("cpumap",          libxl_cpumap),
     ("tsc_mode",        libxl_tsc_mode),
     ("max_memkb",       uint32),
     ("target_memkb",    uint32),
diff -r 83ed83ceddf5 -r 54000bca7a6a tools/libxl/libxl_utils.h
--- a/tools/libxl/libxl_utils.h	Fri Jan 27 19:14:00 2012 +0000
+++ b/tools/libxl/libxl_utils.h	Fri Jan 27 19:17:03 2012 +0000
@@ -70,6 +70,18 @@
 int libxl_cpumap_test(libxl_cpumap *cpumap, int cpu);
 void libxl_cpumap_set(libxl_cpumap *cpumap, int cpu);
 void libxl_cpumap_reset(libxl_cpumap *cpumap, int cpu);
+static inline void libxl_cpumap_set_any(libxl_cpumap *cpumap)
+{
+    memset(cpumap->map, -1, cpumap->size);
+}
+static inline void libxl_cpumap_set_none(libxl_cpumap *cpumap)
+{
+    memset(cpumap->map, 0, cpumap->size);
+}
+static inline int libxl_cpumap_cpu_valid(libxl_cpumap *cpumap, int cpu)
+{
+    return cpu >= 0 && cpu < (cpumap->size * 8);
+}
 #define libxl_for_each_cpu(var, map) for (var = 0; var < (map).size * 8; var++)
 #define libxl_for_each_set_cpu(v, m) for (v = 0; v < (m).size * 8; v++) \
                                              if (libxl_cpumap_test(&(m), v))
diff -r 83ed83ceddf5 -r 54000bca7a6a tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Fri Jan 27 19:14:00 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Fri Jan 27 19:17:03 2012 +0000
@@ -570,6 +570,65 @@
     free(s);
 }
 
+static int vcpupin_parse(char *cpu, libxl_cpumap *cpumap)
+{
+    libxl_cpumap exclude_cpumap;
+    uint32_t cpuida, cpuidb;
+    char *endptr, *toka, *tokb, *saveptr = NULL;
+    int i, rc = 0, rmcpu;
+
+    if (!strcmp(cpu, "all")) {
+        libxl_cpumap_set_any(cpumap);
+        return 0;
+    }
+
+    if (libxl_cpumap_alloc(ctx, &exclude_cpumap)) {
+        fprintf(stderr, "Error: Failed to allocate cpumap.\n");
+        return ENOMEM;
+    }
+
+    for (toka = strtok_r(cpu, ",", &saveptr); toka;
+         toka = strtok_r(NULL, ",", &saveptr)) {
+        rmcpu = 0;
+        if (*toka == '^') {
+            /* This (These) Cpu(s) will be removed from the map */
+            toka++;
+            rmcpu = 1;
+        }
+        /* Extract a valid (range of) cpu(s) */
+        cpuida = cpuidb = strtoul(toka, &endptr, 10);
+        if (endptr == toka) {
+            fprintf(stderr, "Error: Invalid argument.\n");
+            rc = EINVAL;
+            goto vcpp_out;
+        }
+        if (*endptr == '-') {
+            tokb = endptr + 1;
+            cpuidb = strtoul(tokb, &endptr, 10);
+            if (endptr == tokb || cpuida > cpuidb) {
+                fprintf(stderr, "Error: Invalid argument.\n");
+                rc = EINVAL;
+                goto vcpp_out;
+            }
+        }
+        while (cpuida <= cpuidb) {
+            rmcpu == 0 ? libxl_cpumap_set(cpumap, cpuida) :
+                         libxl_cpumap_set(&exclude_cpumap, cpuida);
+            cpuida++;
+        }
+    }
+
+    /* Clear all the cpus from the removal list */
+    libxl_for_each_set_cpu(i, exclude_cpumap) {
+        libxl_cpumap_reset(cpumap, i);
+    }
+
+vcpp_out:
+    libxl_cpumap_dispose(&exclude_cpumap);
+
+    return rc;
+}
+
 static void parse_config_data(const char *configfile_filename_report,
                               const char *configfile_data,
                               int configfile_len,
@@ -579,7 +638,7 @@
     const char *buf;
     long l;
     XLU_Config *config;
-    XLU_ConfigList *vbds, *nics, *pcis, *cvfbs, *cpuids;
+    XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids;
     int pci_power_mgmt = 0;
     int pci_msitranslate = 1;
     int e;
@@ -662,6 +721,29 @@
     if (!xlu_cfg_get_long (config, "maxvcpus", &l, 0))
         b_info->max_vcpus = l;
 
+    if (!xlu_cfg_get_list (config, "cpus", &cpus, 0, 1)) {
+        int i, n_cpus = 0;
+
+        libxl_cpumap_set_none(&b_info->cpumap);
+        while ((buf = xlu_cfg_get_listitem(cpus, n_cpus)) != NULL) {
+            i = atoi(buf);
+            if (!libxl_cpumap_cpu_valid(&b_info->cpumap, i)) {
+                fprintf(stderr, "cpu %d illegal\n", i);
+                exit(1);
+            }
+            libxl_cpumap_set(&b_info->cpumap, i);
+            n_cpus++;
+        }
+    }
+    else if (!xlu_cfg_get_string (config, "cpus", &buf, 0)) {
+        char *buf2 = strdup(buf);
+
+        libxl_cpumap_set_none(&b_info->cpumap);
+        if (vcpupin_parse(buf2, &b_info->cpumap))
+            exit(1);
+        free(buf2);
+    }
+
     if (!xlu_cfg_get_long (config, "memory", &l, 0)) {
         b_info->max_memkb = l * 1024;
         b_info->target_memkb = b_info->max_memkb;
@@ -3568,65 +3650,6 @@
     return 0;
 }
 
-static int vcpupin_parse(char *cpu, libxl_cpumap *cpumap)
-{
-    libxl_cpumap exclude_cpumap;
-    uint32_t cpuida, cpuidb;
-    char *endptr, *toka, *tokb, *saveptr = NULL;
-    int i, rc = 0, rmcpu;
-
-    if (!strcmp(cpu, "all")) {
-        memset(cpumap->map, -1, cpumap->size);
-        return 0;
-    }
-
-    if (libxl_cpumap_alloc(ctx, &exclude_cpumap)) {
-        fprintf(stderr, "Error: Failed to allocate cpumap.\n");
-        return ENOMEM;
-    }
-
-    for (toka = strtok_r(cpu, ",", &saveptr); toka;
-         toka = strtok_r(NULL, ",", &saveptr)) {
-        rmcpu = 0;
-        if (*toka == '^') {
-            /* This (These) Cpu(s) will be removed from the map */
-            toka++;
-            rmcpu = 1;
-        }
-        /* Extract a valid (range of) cpu(s) */
-        cpuida = cpuidb = strtoul(toka, &endptr, 10);
-        if (endptr == toka) {
-            fprintf(stderr, "Error: Invalid argument.\n");
-            rc = EINVAL;
-            goto vcpp_out;
-        }
-        if (*endptr == '-') {
-            tokb = endptr + 1;
-            cpuidb = strtoul(tokb, &endptr, 10);
-            if (endptr == tokb || cpuida > cpuidb) {
-                fprintf(stderr, "Error: Invalid argument.\n");
-                rc = EINVAL;
-                goto vcpp_out;
-            }
-        }
-        while (cpuida <= cpuidb) {
-            rmcpu == 0 ? libxl_cpumap_set(cpumap, cpuida) :
-                         libxl_cpumap_set(&exclude_cpumap, cpuida);
-            cpuida++;
-        }
-    }
-
-    /* Clear all the cpus from the removal list */
-    libxl_for_each_set_cpu(i, exclude_cpumap) {
-        libxl_cpumap_reset(cpumap, i);
-    }
-
-vcpp_out:
-    libxl_cpumap_dispose(&exclude_cpumap);
-
-    return rc;
-}
-
 static void vcpupin(const char *d, const char *vcpu, char *cpu)
 {
     libxl_vcpuinfo *vcpuinfo;

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:27 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7K-0006eU-MX; Fri, 03 Feb 2012 21:56:26 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7I-0006Yk-9X
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:24 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-216.messagelabs.com!1328306177!13423825!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22479 invoked from network); 3 Feb 2012 21:56:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7A-0001jo-VG
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR79-0002Rt-Uy
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:16 +0000
Message-Id: <E1RtR79-0002Rt-Uy@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] vesa: flush lfb after zeroing
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327758145 0
# Node ID ac9f32525376922fdf5b9efac7a1fe0ff866cc76
# Parent  f8c2cf24a26cc6cdaaad9140e4b1dfc54f07bab3
vesa: flush lfb after zeroing

If Xen is going to relinquish the VGA console, flush the linear frame
buffer after zeroing it in vesa_endboot().

Failing to do so in some circumstances leads to the actual linear
framebuffer on the graphics card still containing the output of the
Xen boot console can lead to ugly graphics output when dom0 is setting
up the graphics card for its own use.

While the patch is quite large, it is mostly just code motion to
prevent having to forward declare lfb_flush().  The only functional
change to vesa_endboot() is to insert a call to lbf_flush().

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


diff -r f8c2cf24a26c -r ac9f32525376 xen/drivers/video/vesa.c
--- a/xen/drivers/video/vesa.c	Sat Jan 28 13:41:42 2012 +0000
+++ b/xen/drivers/video/vesa.c	Sat Jan 28 13:42:25 2012 +0000
@@ -151,24 +151,6 @@
     xfree(line_len);
 }
 
-void __init vesa_endboot(bool_t keep)
-{
-    if ( keep )
-    {
-        xpos = 0;
-        vga_puts = vesa_scroll_puts;
-    }
-    else
-    {
-        unsigned int i, bpp = (vlfb_info.bits_per_pixel + 7) >> 3;
-        for ( i = 0; i < vlfb_info.height; i++ )
-            memset(lfb + i * vlfb_info.bytes_per_line, 0,
-                   vlfb_info.width * bpp);
-    }
-
-    xfree(line_len);
-}
-
 #if defined(CONFIG_X86)
 
 #include <asm/mtrr.h>
@@ -215,6 +197,25 @@
 
 #endif
 
+void __init vesa_endboot(bool_t keep)
+{
+    if ( keep )
+    {
+        xpos = 0;
+        vga_puts = vesa_scroll_puts;
+    }
+    else
+    {
+        unsigned int i, bpp = (vlfb_info.bits_per_pixel + 7) >> 3;
+        for ( i = 0; i < vlfb_info.height; i++ )
+            memset(lfb + i * vlfb_info.bytes_per_line, 0,
+                   vlfb_info.width * bpp);
+        lfb_flush();
+    }
+
+    xfree(line_len);
+}
+
 /* Render one line of text to given linear framebuffer line. */
 static void vesa_show_line(
     const unsigned char *text_line,

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:27 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7K-0006eU-MX; Fri, 03 Feb 2012 21:56:26 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7I-0006Yk-9X
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:24 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-216.messagelabs.com!1328306177!13423825!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22479 invoked from network); 3 Feb 2012 21:56:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7A-0001jo-VG
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR79-0002Rt-Uy
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:16 +0000
Message-Id: <E1RtR79-0002Rt-Uy@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] vesa: flush lfb after zeroing
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327758145 0
# Node ID ac9f32525376922fdf5b9efac7a1fe0ff866cc76
# Parent  f8c2cf24a26cc6cdaaad9140e4b1dfc54f07bab3
vesa: flush lfb after zeroing

If Xen is going to relinquish the VGA console, flush the linear frame
buffer after zeroing it in vesa_endboot().

Failing to do so in some circumstances leads to the actual linear
framebuffer on the graphics card still containing the output of the
Xen boot console can lead to ugly graphics output when dom0 is setting
up the graphics card for its own use.

While the patch is quite large, it is mostly just code motion to
prevent having to forward declare lfb_flush().  The only functional
change to vesa_endboot() is to insert a call to lbf_flush().

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


diff -r f8c2cf24a26c -r ac9f32525376 xen/drivers/video/vesa.c
--- a/xen/drivers/video/vesa.c	Sat Jan 28 13:41:42 2012 +0000
+++ b/xen/drivers/video/vesa.c	Sat Jan 28 13:42:25 2012 +0000
@@ -151,24 +151,6 @@
     xfree(line_len);
 }
 
-void __init vesa_endboot(bool_t keep)
-{
-    if ( keep )
-    {
-        xpos = 0;
-        vga_puts = vesa_scroll_puts;
-    }
-    else
-    {
-        unsigned int i, bpp = (vlfb_info.bits_per_pixel + 7) >> 3;
-        for ( i = 0; i < vlfb_info.height; i++ )
-            memset(lfb + i * vlfb_info.bytes_per_line, 0,
-                   vlfb_info.width * bpp);
-    }
-
-    xfree(line_len);
-}
-
 #if defined(CONFIG_X86)
 
 #include <asm/mtrr.h>
@@ -215,6 +197,25 @@
 
 #endif
 
+void __init vesa_endboot(bool_t keep)
+{
+    if ( keep )
+    {
+        xpos = 0;
+        vga_puts = vesa_scroll_puts;
+    }
+    else
+    {
+        unsigned int i, bpp = (vlfb_info.bits_per_pixel + 7) >> 3;
+        for ( i = 0; i < vlfb_info.height; i++ )
+            memset(lfb + i * vlfb_info.bytes_per_line, 0,
+                   vlfb_info.width * bpp);
+        lfb_flush();
+    }
+
+    xfree(line_len);
+}
+
 /* Render one line of text to given linear framebuffer line. */
 static void vesa_show_line(
     const unsigned char *text_line,

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:30 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7N-0006hg-PP; Fri, 03 Feb 2012 21:56:29 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7M-0006bl-I6
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:28 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-182.messagelabs.com!1328306180!13640284!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30319 invoked from network); 3 Feb 2012 21:56:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7E-0001jx-6I
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7C-0002So-Ii
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:19 +0000
Message-Id: <E1RtR7C-0002So-Ii@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: introduce
	PHYSDEVOP_pirq_eoi_gmfn_v2
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327758313 0
# Node ID 3bd3949854efa13ef1a9874711b558169408f61d
# Parent  ac9f32525376922fdf5b9efac7a1fe0ff866cc76
xen: introduce PHYSDEVOP_pirq_eoi_gmfn_v2

PHYSDEVOP_pirq_eoi_gmfn changes the semantics of PHYSDEVOP_eoi.
In order to improve the interface this patch:

- renames PHYSDEVOP_pirq_eoi_gmfn to PHYSDEVOP_pirq_eoi_gmfn_v1;

- introduces PHYSDEVOP_pirq_eoi_gmfn_v2, that is like
  PHYSDEVOP_pirq_eoi_gmfn_v1 but it doesn't modify the behaviour of
  another hypercall;

- bump __XEN_LATEST_INTERFACE_VERSION__;

- #define PHYSDEVOP_pirq_eoi_gmfn to PHYSDEVOP_pirq_eoi_gmfn_v1 or
  PHYSDEVOP_pirq_eoi_gmfn_v2 depending on the __XEN_INTERFACE_VERSION.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r ac9f32525376 -r 3bd3949854ef xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c	Sat Jan 28 13:42:25 2012 +0000
+++ b/xen/arch/ia64/xen/domain.c	Sat Jan 28 13:45:13 2012 +0000
@@ -1731,6 +1731,7 @@
 		if (d->arch.pirq_eoi_map != NULL) {
 			put_page(virt_to_page(d->arch.pirq_eoi_map));
 			d->arch.pirq_eoi_map = NULL;
+			d->arch.auto_unmask = 0;
 		}
 
 		/* Tear down shadow mode stuff. */
diff -r ac9f32525376 -r 3bd3949854ef xen/arch/ia64/xen/hypercall.c
--- a/xen/arch/ia64/xen/hypercall.c	Sat Jan 28 13:42:25 2012 +0000
+++ b/xen/arch/ia64/xen/hypercall.c	Sat Jan 28 13:45:13 2012 +0000
@@ -65,7 +65,7 @@
 {
 	if ( pirq < 0 || pirq >= NR_IRQS )
 		return -EINVAL;
-	if ( d->arch.pirq_eoi_map ) {
+	if ( d->arch.auto_unmask ) {
 		spin_lock(&d->event_lock);
 		evtchn_unmask(pirq_to_evtchn(d, pirq));
 		spin_unlock(&d->event_lock);
@@ -508,7 +508,8 @@
         break;
     }
 
-    case PHYSDEVOP_pirq_eoi_gmfn: {
+    case PHYSDEVOP_pirq_eoi_gmfn_v1:
+    case PHYSDEVOP_pirq_eoi_gmfn_v2: {
         struct physdev_pirq_eoi_gmfn info;
         unsigned long mfn;
 
@@ -531,6 +532,8 @@
         }
 
         current->domain->arch.pirq_eoi_map = mfn_to_virt(mfn);
+        if ( cmd == PHYSDEVOP_pirq_eoi_gmfn_v1 )
+            current->domain->arch.auto_unmask = 1;
         ret = 0;
         break;
     }
diff -r ac9f32525376 -r 3bd3949854ef xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c	Sat Jan 28 13:42:25 2012 +0000
+++ b/xen/arch/x86/domain.c	Sat Jan 28 13:45:13 2012 +0000
@@ -2125,6 +2125,7 @@
                 put_page_and_type(
                     mfn_to_page(d->arch.pv_domain.pirq_eoi_map_mfn));
                 d->arch.pv_domain.pirq_eoi_map = NULL;
+                d->arch.pv_domain.auto_unmask = 0;
             }
         }
 
diff -r ac9f32525376 -r 3bd3949854ef xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c	Sat Jan 28 13:42:25 2012 +0000
+++ b/xen/arch/x86/physdev.c	Sat Jan 28 13:45:13 2012 +0000
@@ -271,7 +271,7 @@
             break;
         }
         if ( !is_hvm_domain(v->domain) &&
-             v->domain->arch.pv_domain.pirq_eoi_map )
+             v->domain->arch.pv_domain.auto_unmask )
             evtchn_unmask(pirq->evtchn);
         if ( !is_hvm_domain(v->domain) ||
              domain_pirq_to_irq(v->domain, eoi.irq) > 0 )
@@ -293,7 +293,8 @@
         break;
     }
 
-    case PHYSDEVOP_pirq_eoi_gmfn: {
+    case PHYSDEVOP_pirq_eoi_gmfn_v2:
+    case PHYSDEVOP_pirq_eoi_gmfn_v1: {
         struct physdev_pirq_eoi_gmfn info;
         unsigned long mfn;
 
@@ -329,6 +330,8 @@
             ret = -ENOSPC;
             break;
         }
+        if ( cmd == PHYSDEVOP_pirq_eoi_gmfn_v1 )
+            v->domain->arch.pv_domain.auto_unmask = 1;
 
         put_gfn(current->domain, info.gmfn);
         ret = 0;
diff -r ac9f32525376 -r 3bd3949854ef xen/include/asm-ia64/domain.h
--- a/xen/include/asm-ia64/domain.h	Sat Jan 28 13:42:25 2012 +0000
+++ b/xen/include/asm-ia64/domain.h	Sat Jan 28 13:45:13 2012 +0000
@@ -186,6 +186,9 @@
     /* Shared page for notifying that explicit PIRQ EOI is required. */
     unsigned long *pirq_eoi_map;
     unsigned long pirq_eoi_map_mfn;
+    /* set auto_unmask to 1 if you want PHYSDEVOP_eoi to automatically
+     * unmask the event channel */
+    bool_t auto_unmask;
 
     /* Address of efi_runtime_services_t (placed in domain memory)  */
     void *efi_runtime;
diff -r ac9f32525376 -r 3bd3949854ef xen/include/asm-x86/domain.h
--- a/xen/include/asm-x86/domain.h	Sat Jan 28 13:42:25 2012 +0000
+++ b/xen/include/asm-x86/domain.h	Sat Jan 28 13:45:13 2012 +0000
@@ -231,6 +231,9 @@
     /* Shared page for notifying that explicit PIRQ EOI is required. */
     unsigned long *pirq_eoi_map;
     unsigned long pirq_eoi_map_mfn;
+    /* set auto_unmask to 1 if you want PHYSDEVOP_eoi to automatically
+     * unmask the event channel */
+    bool_t auto_unmask;
 
     /* Pseudophysical e820 map (XENMEM_memory_map).  */
     spinlock_t e820_lock;
diff -r ac9f32525376 -r 3bd3949854ef xen/include/public/physdev.h
--- a/xen/include/public/physdev.h	Sat Jan 28 13:42:25 2012 +0000
+++ b/xen/include/public/physdev.h	Sat Jan 28 13:45:13 2012 +0000
@@ -49,7 +49,15 @@
  * will automatically get unmasked. The page registered is used as a bit
  * array indexed by Xen's PIRQ value.
  */
-#define PHYSDEVOP_pirq_eoi_gmfn         17
+#define PHYSDEVOP_pirq_eoi_gmfn_v1       17
+/*
+ * Register a shared page for the hypervisor to indicate whether the
+ * guest must issue PHYSDEVOP_eoi. This hypercall is very similar to
+ * PHYSDEVOP_pirq_eoi_gmfn_v1 but it doesn't change the semantics of
+ * PHYSDEVOP_eoi. The page registered is used as a bit array indexed by
+ * Xen's PIRQ value.
+ */
+#define PHYSDEVOP_pirq_eoi_gmfn_v2       28
 struct physdev_pirq_eoi_gmfn {
     /* IN */
     xen_pfn_t gmfn;
@@ -325,6 +333,12 @@
 #define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY XENIRQSTAT_needs_eoi
 #define PHYSDEVOP_IRQ_SHARED             XENIRQSTAT_shared
 
+#if __XEN_INTERFACE_VERSION < 0x00040200
+#define PHYSDEVOP_pirq_eoi_gmfn PHYSDEVOP_pirq_eoi_gmfn_v1
+#else
+#define PHYSDEVOP_pirq_eoi_gmfn PHYSDEVOP_pirq_eoi_gmfn_v2
+#endif
+
 #endif /* __XEN_PUBLIC_PHYSDEV_H__ */
 
 /*
diff -r ac9f32525376 -r 3bd3949854ef xen/include/public/xen-compat.h
--- a/xen/include/public/xen-compat.h	Sat Jan 28 13:42:25 2012 +0000
+++ b/xen/include/public/xen-compat.h	Sat Jan 28 13:45:13 2012 +0000
@@ -27,7 +27,7 @@
 #ifndef __XEN_PUBLIC_XEN_COMPAT_H__
 #define __XEN_PUBLIC_XEN_COMPAT_H__
 
-#define __XEN_LATEST_INTERFACE_VERSION__ 0x0003020a
+#define __XEN_LATEST_INTERFACE_VERSION__ 0x00040200
 
 #if defined(__XEN__) || defined(__XEN_TOOLS__)
 /* Xen is built with matching headers and implements the latest interface. */

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:30 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7N-0006hg-PP; Fri, 03 Feb 2012 21:56:29 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7M-0006bl-I6
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:28 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-182.messagelabs.com!1328306180!13640284!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30319 invoked from network); 3 Feb 2012 21:56:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7E-0001jx-6I
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7C-0002So-Ii
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:19 +0000
Message-Id: <E1RtR7C-0002So-Ii@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: introduce
	PHYSDEVOP_pirq_eoi_gmfn_v2
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327758313 0
# Node ID 3bd3949854efa13ef1a9874711b558169408f61d
# Parent  ac9f32525376922fdf5b9efac7a1fe0ff866cc76
xen: introduce PHYSDEVOP_pirq_eoi_gmfn_v2

PHYSDEVOP_pirq_eoi_gmfn changes the semantics of PHYSDEVOP_eoi.
In order to improve the interface this patch:

- renames PHYSDEVOP_pirq_eoi_gmfn to PHYSDEVOP_pirq_eoi_gmfn_v1;

- introduces PHYSDEVOP_pirq_eoi_gmfn_v2, that is like
  PHYSDEVOP_pirq_eoi_gmfn_v1 but it doesn't modify the behaviour of
  another hypercall;

- bump __XEN_LATEST_INTERFACE_VERSION__;

- #define PHYSDEVOP_pirq_eoi_gmfn to PHYSDEVOP_pirq_eoi_gmfn_v1 or
  PHYSDEVOP_pirq_eoi_gmfn_v2 depending on the __XEN_INTERFACE_VERSION.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r ac9f32525376 -r 3bd3949854ef xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c	Sat Jan 28 13:42:25 2012 +0000
+++ b/xen/arch/ia64/xen/domain.c	Sat Jan 28 13:45:13 2012 +0000
@@ -1731,6 +1731,7 @@
 		if (d->arch.pirq_eoi_map != NULL) {
 			put_page(virt_to_page(d->arch.pirq_eoi_map));
 			d->arch.pirq_eoi_map = NULL;
+			d->arch.auto_unmask = 0;
 		}
 
 		/* Tear down shadow mode stuff. */
diff -r ac9f32525376 -r 3bd3949854ef xen/arch/ia64/xen/hypercall.c
--- a/xen/arch/ia64/xen/hypercall.c	Sat Jan 28 13:42:25 2012 +0000
+++ b/xen/arch/ia64/xen/hypercall.c	Sat Jan 28 13:45:13 2012 +0000
@@ -65,7 +65,7 @@
 {
 	if ( pirq < 0 || pirq >= NR_IRQS )
 		return -EINVAL;
-	if ( d->arch.pirq_eoi_map ) {
+	if ( d->arch.auto_unmask ) {
 		spin_lock(&d->event_lock);
 		evtchn_unmask(pirq_to_evtchn(d, pirq));
 		spin_unlock(&d->event_lock);
@@ -508,7 +508,8 @@
         break;
     }
 
-    case PHYSDEVOP_pirq_eoi_gmfn: {
+    case PHYSDEVOP_pirq_eoi_gmfn_v1:
+    case PHYSDEVOP_pirq_eoi_gmfn_v2: {
         struct physdev_pirq_eoi_gmfn info;
         unsigned long mfn;
 
@@ -531,6 +532,8 @@
         }
 
         current->domain->arch.pirq_eoi_map = mfn_to_virt(mfn);
+        if ( cmd == PHYSDEVOP_pirq_eoi_gmfn_v1 )
+            current->domain->arch.auto_unmask = 1;
         ret = 0;
         break;
     }
diff -r ac9f32525376 -r 3bd3949854ef xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c	Sat Jan 28 13:42:25 2012 +0000
+++ b/xen/arch/x86/domain.c	Sat Jan 28 13:45:13 2012 +0000
@@ -2125,6 +2125,7 @@
                 put_page_and_type(
                     mfn_to_page(d->arch.pv_domain.pirq_eoi_map_mfn));
                 d->arch.pv_domain.pirq_eoi_map = NULL;
+                d->arch.pv_domain.auto_unmask = 0;
             }
         }
 
diff -r ac9f32525376 -r 3bd3949854ef xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c	Sat Jan 28 13:42:25 2012 +0000
+++ b/xen/arch/x86/physdev.c	Sat Jan 28 13:45:13 2012 +0000
@@ -271,7 +271,7 @@
             break;
         }
         if ( !is_hvm_domain(v->domain) &&
-             v->domain->arch.pv_domain.pirq_eoi_map )
+             v->domain->arch.pv_domain.auto_unmask )
             evtchn_unmask(pirq->evtchn);
         if ( !is_hvm_domain(v->domain) ||
              domain_pirq_to_irq(v->domain, eoi.irq) > 0 )
@@ -293,7 +293,8 @@
         break;
     }
 
-    case PHYSDEVOP_pirq_eoi_gmfn: {
+    case PHYSDEVOP_pirq_eoi_gmfn_v2:
+    case PHYSDEVOP_pirq_eoi_gmfn_v1: {
         struct physdev_pirq_eoi_gmfn info;
         unsigned long mfn;
 
@@ -329,6 +330,8 @@
             ret = -ENOSPC;
             break;
         }
+        if ( cmd == PHYSDEVOP_pirq_eoi_gmfn_v1 )
+            v->domain->arch.pv_domain.auto_unmask = 1;
 
         put_gfn(current->domain, info.gmfn);
         ret = 0;
diff -r ac9f32525376 -r 3bd3949854ef xen/include/asm-ia64/domain.h
--- a/xen/include/asm-ia64/domain.h	Sat Jan 28 13:42:25 2012 +0000
+++ b/xen/include/asm-ia64/domain.h	Sat Jan 28 13:45:13 2012 +0000
@@ -186,6 +186,9 @@
     /* Shared page for notifying that explicit PIRQ EOI is required. */
     unsigned long *pirq_eoi_map;
     unsigned long pirq_eoi_map_mfn;
+    /* set auto_unmask to 1 if you want PHYSDEVOP_eoi to automatically
+     * unmask the event channel */
+    bool_t auto_unmask;
 
     /* Address of efi_runtime_services_t (placed in domain memory)  */
     void *efi_runtime;
diff -r ac9f32525376 -r 3bd3949854ef xen/include/asm-x86/domain.h
--- a/xen/include/asm-x86/domain.h	Sat Jan 28 13:42:25 2012 +0000
+++ b/xen/include/asm-x86/domain.h	Sat Jan 28 13:45:13 2012 +0000
@@ -231,6 +231,9 @@
     /* Shared page for notifying that explicit PIRQ EOI is required. */
     unsigned long *pirq_eoi_map;
     unsigned long pirq_eoi_map_mfn;
+    /* set auto_unmask to 1 if you want PHYSDEVOP_eoi to automatically
+     * unmask the event channel */
+    bool_t auto_unmask;
 
     /* Pseudophysical e820 map (XENMEM_memory_map).  */
     spinlock_t e820_lock;
diff -r ac9f32525376 -r 3bd3949854ef xen/include/public/physdev.h
--- a/xen/include/public/physdev.h	Sat Jan 28 13:42:25 2012 +0000
+++ b/xen/include/public/physdev.h	Sat Jan 28 13:45:13 2012 +0000
@@ -49,7 +49,15 @@
  * will automatically get unmasked. The page registered is used as a bit
  * array indexed by Xen's PIRQ value.
  */
-#define PHYSDEVOP_pirq_eoi_gmfn         17
+#define PHYSDEVOP_pirq_eoi_gmfn_v1       17
+/*
+ * Register a shared page for the hypervisor to indicate whether the
+ * guest must issue PHYSDEVOP_eoi. This hypercall is very similar to
+ * PHYSDEVOP_pirq_eoi_gmfn_v1 but it doesn't change the semantics of
+ * PHYSDEVOP_eoi. The page registered is used as a bit array indexed by
+ * Xen's PIRQ value.
+ */
+#define PHYSDEVOP_pirq_eoi_gmfn_v2       28
 struct physdev_pirq_eoi_gmfn {
     /* IN */
     xen_pfn_t gmfn;
@@ -325,6 +333,12 @@
 #define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY XENIRQSTAT_needs_eoi
 #define PHYSDEVOP_IRQ_SHARED             XENIRQSTAT_shared
 
+#if __XEN_INTERFACE_VERSION < 0x00040200
+#define PHYSDEVOP_pirq_eoi_gmfn PHYSDEVOP_pirq_eoi_gmfn_v1
+#else
+#define PHYSDEVOP_pirq_eoi_gmfn PHYSDEVOP_pirq_eoi_gmfn_v2
+#endif
+
 #endif /* __XEN_PUBLIC_PHYSDEV_H__ */
 
 /*
diff -r ac9f32525376 -r 3bd3949854ef xen/include/public/xen-compat.h
--- a/xen/include/public/xen-compat.h	Sat Jan 28 13:42:25 2012 +0000
+++ b/xen/include/public/xen-compat.h	Sat Jan 28 13:45:13 2012 +0000
@@ -27,7 +27,7 @@
 #ifndef __XEN_PUBLIC_XEN_COMPAT_H__
 #define __XEN_PUBLIC_XEN_COMPAT_H__
 
-#define __XEN_LATEST_INTERFACE_VERSION__ 0x0003020a
+#define __XEN_LATEST_INTERFACE_VERSION__ 0x00040200
 
 #if defined(__XEN__) || defined(__XEN_TOOLS__)
 /* Xen is built with matching headers and implements the latest interface. */

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:34 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7R-0006lW-SR; Fri, 03 Feb 2012 21:56:33 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7Q-0006fA-Hg
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:32 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-182.messagelabs.com!1328306184!13639511!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10201 invoked from network); 3 Feb 2012 21:56:25 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:25 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7I-0001k3-1D
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:24 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7F-0002Tk-Hl
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:23 +0000
Message-Id: <E1RtR7F-0002Tk-Hl@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: reinstate previously unused
	XENMEM_remove_from_physmap hypercall
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327758444 0
# Node ID 34c96082d69389e5891bbc1c424d0199355632df
# Parent  3bd3949854efa13ef1a9874711b558169408f61d
xen: reinstate previously unused XENMEM_remove_from_physmap hypercall

This patch reinstates the XENMEM_remove_from_physmap hypercall
which was removed in 19041:ee62aaafff46 because it was not used.

However, is now needed in order to support xenstored stub domains.
The xenstored stub domain is not priviliged like dom0 and so cannot
unilaterally map the xenbus page of other guests into it's address
space.  Therefore, before creating a domU the domain builder needs to
seed its grant table with a grant ref allowing the xenstored stub
domain to access the new domU's xenbus page.

At present domU's do not start with their grant table mapped.
Instead it gets mapped when the guest requests a grant table from
the hypervisor.

In order to seed the grant table, the domain builder first needs to
map it into dom0 address space.  But the hypercall to do this
requires a gpfn (guest pfn), which is an mfn for PV guest, but a pfn
for HVM guests.  Therfore, in order to seed the grant table of an
HVM guest, dom0 needs to *temporarily* map it into the guest's
"physical" address space.

Hence the need to reinstate the XENMEM_remove_from_physmap hypercall.

Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 3bd3949854ef -r 34c96082d693 xen/common/compat/memory.c
--- a/xen/common/compat/memory.c	Sat Jan 28 13:45:13 2012 +0000
+++ b/xen/common/compat/memory.c	Sat Jan 28 13:47:24 2012 +0000
@@ -25,6 +25,7 @@
             XEN_GUEST_HANDLE(void) hnd;
             struct xen_memory_reservation *rsrv;
             struct xen_memory_exchange *xchg;
+            struct xen_remove_from_physmap *xrfp;
         } nat;
         union {
             struct compat_memory_reservation rsrv;
@@ -179,6 +180,18 @@
             nat.hnd = compat;
             break;
 
+        case XENMEM_remove_from_physmap:
+        {
+            struct compat_remove_from_physmap cmp;
+
+            if ( copy_from_guest(&cmp, compat, 1) )
+                return -EFAULT;
+
+            XLAT_remove_from_physmap(nat.xrfp, &cmp);
+
+            break;
+        }
+
         default:
             return compat_arch_memory_op(cmd, compat);
         }
@@ -284,6 +297,7 @@
         case XENMEM_current_reservation:
         case XENMEM_maximum_reservation:
         case XENMEM_maximum_gpfn:
+        case XENMEM_remove_from_physmap:
             break;
 
         default:
diff -r 3bd3949854ef -r 34c96082d693 xen/common/memory.c
--- a/xen/common/memory.c	Sat Jan 28 13:45:13 2012 +0000
+++ b/xen/common/memory.c	Sat Jan 28 13:47:24 2012 +0000
@@ -659,6 +659,43 @@
 
         break;
 
+    case XENMEM_remove_from_physmap:
+    {
+        struct xen_remove_from_physmap xrfp;
+        unsigned long mfn;
+        struct domain *d;
+
+        if ( copy_from_guest(&xrfp, arg, 1) )
+            return -EFAULT;
+
+        rc = rcu_lock_target_domain_by_id(xrfp.domid, &d);
+        if ( rc != 0 )
+            return rc;
+
+        if ( xsm_remove_from_physmap(current->domain, d) )
+        {
+            rcu_unlock_domain(d);
+            return -EPERM;
+        }
+
+        domain_lock(d);
+
+        mfn = get_gfn_untyped(d, xrfp.gpfn);
+
+        if ( mfn_valid(mfn) )
+            guest_physmap_remove_page(d, xrfp.gpfn, mfn, PAGE_ORDER_4K);
+        else
+            rc = -ENOENT;
+
+        put_gfn(d, xrfp.gpfn);
+
+        domain_unlock(d);
+
+        rcu_unlock_domain(d);
+
+        break;
+    }
+
     default:
         rc = arch_memory_op(op, arg);
         break;
diff -r 3bd3949854ef -r 34c96082d693 xen/include/asm-ia64/mm.h
--- a/xen/include/asm-ia64/mm.h	Sat Jan 28 13:45:13 2012 +0000
+++ b/xen/include/asm-ia64/mm.h	Sat Jan 28 13:47:24 2012 +0000
@@ -550,6 +550,7 @@
 #define gmfn_to_mfn(_d, gpfn)			\
     gmfn_to_mfn_foreign((_d), (gpfn))
 
+#define get_gfn_untyped(d, gpfn) gmfn_to_mfn(d, gpfn)
 #define put_gfn(d, g)   ((void)0)
 
 #define __gpfn_invalid(_d, gpfn)			\
diff -r 3bd3949854ef -r 34c96082d693 xen/include/public/memory.h
--- a/xen/include/public/memory.h	Sat Jan 28 13:45:13 2012 +0000
+++ b/xen/include/public/memory.h	Sat Jan 28 13:47:24 2012 +0000
@@ -229,6 +229,22 @@
 typedef struct xen_add_to_physmap xen_add_to_physmap_t;
 DEFINE_XEN_GUEST_HANDLE(xen_add_to_physmap_t);
 
+/*
+ * Unmaps the page appearing at a particular GPFN from the specified guest's
+ * pseudophysical address space.
+ * arg == addr of xen_remove_from_physmap_t.
+ */
+#define XENMEM_remove_from_physmap      15
+struct xen_remove_from_physmap {
+    /* Which domain to change the mapping for. */
+    domid_t domid;
+
+    /* GPFN of the current mapping of the page. */
+    xen_pfn_t     gpfn;
+};
+typedef struct xen_remove_from_physmap xen_remove_from_physmap_t;
+DEFINE_XEN_GUEST_HANDLE(xen_remove_from_physmap_t);
+
 /*** REMOVED ***/
 /*#define XENMEM_translate_gpfn_list  8*/
 
diff -r 3bd3949854ef -r 34c96082d693 xen/include/xlat.lst
--- a/xen/include/xlat.lst	Sat Jan 28 13:45:13 2012 +0000
+++ b/xen/include/xlat.lst	Sat Jan 28 13:47:24 2012 +0000
@@ -60,6 +60,7 @@
 !	memory_map			memory.h
 !	memory_reservation		memory.h
 !	pod_target			memory.h
+!	remove_from_physmap		memory.h
 ?	physdev_eoi			physdev.h
 ?	physdev_get_free_pirq		physdev.h
 ?	physdev_irq			physdev.h
diff -r 3bd3949854ef -r 34c96082d693 xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h	Sat Jan 28 13:45:13 2012 +0000
+++ b/xen/include/xsm/xsm.h	Sat Jan 28 13:47:24 2012 +0000
@@ -169,6 +169,7 @@
     int (*update_va_mapping) (struct domain *d, struct domain *f, 
                                                             l1_pgentry_t pte);
     int (*add_to_physmap) (struct domain *d1, struct domain *d2);
+    int (*remove_from_physmap) (struct domain *d1, struct domain *d2);
     int (*sendtrigger) (struct domain *d);
     int (*bind_pt_irq) (struct domain *d, struct xen_domctl_bind_pt_irq *bind);
     int (*unbind_pt_irq) (struct domain *d);
@@ -738,6 +739,11 @@
     return xsm_call(add_to_physmap(d1, d2));
 }
 
+static inline int xsm_remove_from_physmap(struct domain *d1, struct domain *d2)
+{
+    return xsm_call(remove_from_physmap(d1, d2));
+}
+
 static inline int xsm_sendtrigger(struct domain *d)
 {
     return xsm_call(sendtrigger(d));
diff -r 3bd3949854ef -r 34c96082d693 xen/xsm/dummy.c
--- a/xen/xsm/dummy.c	Sat Jan 28 13:45:13 2012 +0000
+++ b/xen/xsm/dummy.c	Sat Jan 28 13:47:24 2012 +0000
@@ -529,6 +529,11 @@
     return 0;
 }
 
+static int dummy_remove_from_physmap (struct domain *d1, struct domain *d2)
+{
+    return 0;
+}
+
 static int dummy_sendtrigger (struct domain *d)
 {
     return 0;
@@ -690,6 +695,7 @@
     set_to_dummy_if_null(ops, mmu_machphys_update);
     set_to_dummy_if_null(ops, update_va_mapping);
     set_to_dummy_if_null(ops, add_to_physmap);
+    set_to_dummy_if_null(ops, remove_from_physmap);
     set_to_dummy_if_null(ops, sendtrigger);
     set_to_dummy_if_null(ops, bind_pt_irq);
     set_to_dummy_if_null(ops, pin_mem_cacheattr);
diff -r 3bd3949854ef -r 34c96082d693 xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c	Sat Jan 28 13:45:13 2012 +0000
+++ b/xen/xsm/flask/hooks.c	Sat Jan 28 13:47:24 2012 +0000
@@ -1283,6 +1283,11 @@
     return domain_has_perm(d1, d2, SECCLASS_MMU, MMU__PHYSMAP);
 }
 
+static int flask_remove_from_physmap(struct domain *d1, struct domain *d2)
+{
+    return domain_has_perm(d1, d2, SECCLASS_MMU, MMU__PHYSMAP);
+}
+
 static int flask_sendtrigger(struct domain *d)
 {
     return domain_has_perm(current->domain, d, SECCLASS_DOMAIN, DOMAIN__TRIGGER);
@@ -1550,6 +1555,7 @@
     .mmu_machphys_update = flask_mmu_machphys_update,
     .update_va_mapping = flask_update_va_mapping,
     .add_to_physmap = flask_add_to_physmap,
+    .remove_from_physmap = flask_remove_from_physmap,
     .sendtrigger = flask_sendtrigger,
     .get_device_group = flask_get_device_group,
     .test_assign_device = flask_test_assign_device,

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:34 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7R-0006lW-SR; Fri, 03 Feb 2012 21:56:33 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7Q-0006fA-Hg
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:32 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-182.messagelabs.com!1328306184!13639511!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10201 invoked from network); 3 Feb 2012 21:56:25 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:25 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7I-0001k3-1D
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:24 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7F-0002Tk-Hl
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:23 +0000
Message-Id: <E1RtR7F-0002Tk-Hl@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: reinstate previously unused
	XENMEM_remove_from_physmap hypercall
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327758444 0
# Node ID 34c96082d69389e5891bbc1c424d0199355632df
# Parent  3bd3949854efa13ef1a9874711b558169408f61d
xen: reinstate previously unused XENMEM_remove_from_physmap hypercall

This patch reinstates the XENMEM_remove_from_physmap hypercall
which was removed in 19041:ee62aaafff46 because it was not used.

However, is now needed in order to support xenstored stub domains.
The xenstored stub domain is not priviliged like dom0 and so cannot
unilaterally map the xenbus page of other guests into it's address
space.  Therefore, before creating a domU the domain builder needs to
seed its grant table with a grant ref allowing the xenstored stub
domain to access the new domU's xenbus page.

At present domU's do not start with their grant table mapped.
Instead it gets mapped when the guest requests a grant table from
the hypervisor.

In order to seed the grant table, the domain builder first needs to
map it into dom0 address space.  But the hypercall to do this
requires a gpfn (guest pfn), which is an mfn for PV guest, but a pfn
for HVM guests.  Therfore, in order to seed the grant table of an
HVM guest, dom0 needs to *temporarily* map it into the guest's
"physical" address space.

Hence the need to reinstate the XENMEM_remove_from_physmap hypercall.

Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 3bd3949854ef -r 34c96082d693 xen/common/compat/memory.c
--- a/xen/common/compat/memory.c	Sat Jan 28 13:45:13 2012 +0000
+++ b/xen/common/compat/memory.c	Sat Jan 28 13:47:24 2012 +0000
@@ -25,6 +25,7 @@
             XEN_GUEST_HANDLE(void) hnd;
             struct xen_memory_reservation *rsrv;
             struct xen_memory_exchange *xchg;
+            struct xen_remove_from_physmap *xrfp;
         } nat;
         union {
             struct compat_memory_reservation rsrv;
@@ -179,6 +180,18 @@
             nat.hnd = compat;
             break;
 
+        case XENMEM_remove_from_physmap:
+        {
+            struct compat_remove_from_physmap cmp;
+
+            if ( copy_from_guest(&cmp, compat, 1) )
+                return -EFAULT;
+
+            XLAT_remove_from_physmap(nat.xrfp, &cmp);
+
+            break;
+        }
+
         default:
             return compat_arch_memory_op(cmd, compat);
         }
@@ -284,6 +297,7 @@
         case XENMEM_current_reservation:
         case XENMEM_maximum_reservation:
         case XENMEM_maximum_gpfn:
+        case XENMEM_remove_from_physmap:
             break;
 
         default:
diff -r 3bd3949854ef -r 34c96082d693 xen/common/memory.c
--- a/xen/common/memory.c	Sat Jan 28 13:45:13 2012 +0000
+++ b/xen/common/memory.c	Sat Jan 28 13:47:24 2012 +0000
@@ -659,6 +659,43 @@
 
         break;
 
+    case XENMEM_remove_from_physmap:
+    {
+        struct xen_remove_from_physmap xrfp;
+        unsigned long mfn;
+        struct domain *d;
+
+        if ( copy_from_guest(&xrfp, arg, 1) )
+            return -EFAULT;
+
+        rc = rcu_lock_target_domain_by_id(xrfp.domid, &d);
+        if ( rc != 0 )
+            return rc;
+
+        if ( xsm_remove_from_physmap(current->domain, d) )
+        {
+            rcu_unlock_domain(d);
+            return -EPERM;
+        }
+
+        domain_lock(d);
+
+        mfn = get_gfn_untyped(d, xrfp.gpfn);
+
+        if ( mfn_valid(mfn) )
+            guest_physmap_remove_page(d, xrfp.gpfn, mfn, PAGE_ORDER_4K);
+        else
+            rc = -ENOENT;
+
+        put_gfn(d, xrfp.gpfn);
+
+        domain_unlock(d);
+
+        rcu_unlock_domain(d);
+
+        break;
+    }
+
     default:
         rc = arch_memory_op(op, arg);
         break;
diff -r 3bd3949854ef -r 34c96082d693 xen/include/asm-ia64/mm.h
--- a/xen/include/asm-ia64/mm.h	Sat Jan 28 13:45:13 2012 +0000
+++ b/xen/include/asm-ia64/mm.h	Sat Jan 28 13:47:24 2012 +0000
@@ -550,6 +550,7 @@
 #define gmfn_to_mfn(_d, gpfn)			\
     gmfn_to_mfn_foreign((_d), (gpfn))
 
+#define get_gfn_untyped(d, gpfn) gmfn_to_mfn(d, gpfn)
 #define put_gfn(d, g)   ((void)0)
 
 #define __gpfn_invalid(_d, gpfn)			\
diff -r 3bd3949854ef -r 34c96082d693 xen/include/public/memory.h
--- a/xen/include/public/memory.h	Sat Jan 28 13:45:13 2012 +0000
+++ b/xen/include/public/memory.h	Sat Jan 28 13:47:24 2012 +0000
@@ -229,6 +229,22 @@
 typedef struct xen_add_to_physmap xen_add_to_physmap_t;
 DEFINE_XEN_GUEST_HANDLE(xen_add_to_physmap_t);
 
+/*
+ * Unmaps the page appearing at a particular GPFN from the specified guest's
+ * pseudophysical address space.
+ * arg == addr of xen_remove_from_physmap_t.
+ */
+#define XENMEM_remove_from_physmap      15
+struct xen_remove_from_physmap {
+    /* Which domain to change the mapping for. */
+    domid_t domid;
+
+    /* GPFN of the current mapping of the page. */
+    xen_pfn_t     gpfn;
+};
+typedef struct xen_remove_from_physmap xen_remove_from_physmap_t;
+DEFINE_XEN_GUEST_HANDLE(xen_remove_from_physmap_t);
+
 /*** REMOVED ***/
 /*#define XENMEM_translate_gpfn_list  8*/
 
diff -r 3bd3949854ef -r 34c96082d693 xen/include/xlat.lst
--- a/xen/include/xlat.lst	Sat Jan 28 13:45:13 2012 +0000
+++ b/xen/include/xlat.lst	Sat Jan 28 13:47:24 2012 +0000
@@ -60,6 +60,7 @@
 !	memory_map			memory.h
 !	memory_reservation		memory.h
 !	pod_target			memory.h
+!	remove_from_physmap		memory.h
 ?	physdev_eoi			physdev.h
 ?	physdev_get_free_pirq		physdev.h
 ?	physdev_irq			physdev.h
diff -r 3bd3949854ef -r 34c96082d693 xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h	Sat Jan 28 13:45:13 2012 +0000
+++ b/xen/include/xsm/xsm.h	Sat Jan 28 13:47:24 2012 +0000
@@ -169,6 +169,7 @@
     int (*update_va_mapping) (struct domain *d, struct domain *f, 
                                                             l1_pgentry_t pte);
     int (*add_to_physmap) (struct domain *d1, struct domain *d2);
+    int (*remove_from_physmap) (struct domain *d1, struct domain *d2);
     int (*sendtrigger) (struct domain *d);
     int (*bind_pt_irq) (struct domain *d, struct xen_domctl_bind_pt_irq *bind);
     int (*unbind_pt_irq) (struct domain *d);
@@ -738,6 +739,11 @@
     return xsm_call(add_to_physmap(d1, d2));
 }
 
+static inline int xsm_remove_from_physmap(struct domain *d1, struct domain *d2)
+{
+    return xsm_call(remove_from_physmap(d1, d2));
+}
+
 static inline int xsm_sendtrigger(struct domain *d)
 {
     return xsm_call(sendtrigger(d));
diff -r 3bd3949854ef -r 34c96082d693 xen/xsm/dummy.c
--- a/xen/xsm/dummy.c	Sat Jan 28 13:45:13 2012 +0000
+++ b/xen/xsm/dummy.c	Sat Jan 28 13:47:24 2012 +0000
@@ -529,6 +529,11 @@
     return 0;
 }
 
+static int dummy_remove_from_physmap (struct domain *d1, struct domain *d2)
+{
+    return 0;
+}
+
 static int dummy_sendtrigger (struct domain *d)
 {
     return 0;
@@ -690,6 +695,7 @@
     set_to_dummy_if_null(ops, mmu_machphys_update);
     set_to_dummy_if_null(ops, update_va_mapping);
     set_to_dummy_if_null(ops, add_to_physmap);
+    set_to_dummy_if_null(ops, remove_from_physmap);
     set_to_dummy_if_null(ops, sendtrigger);
     set_to_dummy_if_null(ops, bind_pt_irq);
     set_to_dummy_if_null(ops, pin_mem_cacheattr);
diff -r 3bd3949854ef -r 34c96082d693 xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c	Sat Jan 28 13:45:13 2012 +0000
+++ b/xen/xsm/flask/hooks.c	Sat Jan 28 13:47:24 2012 +0000
@@ -1283,6 +1283,11 @@
     return domain_has_perm(d1, d2, SECCLASS_MMU, MMU__PHYSMAP);
 }
 
+static int flask_remove_from_physmap(struct domain *d1, struct domain *d2)
+{
+    return domain_has_perm(d1, d2, SECCLASS_MMU, MMU__PHYSMAP);
+}
+
 static int flask_sendtrigger(struct domain *d)
 {
     return domain_has_perm(current->domain, d, SECCLASS_DOMAIN, DOMAIN__TRIGGER);
@@ -1550,6 +1555,7 @@
     .mmu_machphys_update = flask_mmu_machphys_update,
     .update_va_mapping = flask_update_va_mapping,
     .add_to_physmap = flask_add_to_physmap,
+    .remove_from_physmap = flask_remove_from_physmap,
     .sendtrigger = flask_sendtrigger,
     .get_device_group = flask_get_device_group,
     .test_assign_device = flask_test_assign_device,

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:37 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7V-0006nY-0w; Fri, 03 Feb 2012 21:56:37 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7T-0006hw-IE
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:36 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1328306186!13046406!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4606 invoked from network); 3 Feb 2012 21:56:28 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:28 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7K-0001kD-Fq
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:26 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7I-0002Uq-Vh
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:25 +0000
Message-Id: <E1RtR7I-0002Uq-Vh@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:24 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: allow global VIRQ handlers to
	be delegated to other domains
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327758483 0
# Node ID 1e155189c9a4f6e9d78cf3ea955c9c0fad07d7f7
# Parent  34c96082d69389e5891bbc1c424d0199355632df
xen: allow global VIRQ handlers to be delegated to other domains

This patch sends global VIRQs to a domain designated as the VIRQ
handler
instead of sending all global VIRQ events to dom0. This is required in
order to run xenstored in a stubdom, because VIRQ_DOM_EXC must be sent
to xenstored for domain destruction to work properly.

This patch was inspired by the xenstored stubdomain patch series sent
to xen-devel by Alex Zeffertt in 2009.

Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com>
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 34c96082d693 -r 1e155189c9a4 tools/flask/policy/policy/flask/access_vectors
--- a/tools/flask/policy/policy/flask/access_vectors	Sat Jan 28 13:47:24 2012 +0000
+++ b/tools/flask/policy/policy/flask/access_vectors	Sat Jan 28 13:48:03 2012 +0000
@@ -85,6 +85,7 @@
 	getpodtarget
 	setpodtarget
 	set_misc_info
+	set_virq_handler
 }
 
 class hvm
diff -r 34c96082d693 -r 1e155189c9a4 tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/tools/libxc/xc_domain.c	Sat Jan 28 13:48:03 2012 +0000
@@ -1504,6 +1504,16 @@
     return do_domctl(xch, &domctl);
 }
 
+int xc_domain_set_virq_handler(xc_interface *xch, uint32_t domid, int virq)
+{
+    DECLARE_DOMCTL;
+
+    domctl.cmd = XEN_DOMCTL_set_virq_handler;
+    domctl.domain = domid;
+    domctl.u.set_virq_handler.virq = virq;
+    return do_domctl(xch, &domctl);
+}
+
 /*
  * Local variables:
  * mode: C
diff -r 34c96082d693 -r 1e155189c9a4 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h	Sat Jan 28 13:47:24 2012 +0000
+++ b/tools/libxc/xenctrl.h	Sat Jan 28 13:48:03 2012 +0000
@@ -749,6 +749,15 @@
 int xc_domain_set_access_required(xc_interface *xch,
 				  uint32_t domid,
 				  unsigned int required);
+/**
+ * This function sets the handler of global VIRQs sent by the hypervisor
+ *
+ * @parm xch a handle to an open hypervisor interface
+ * @parm domid the domain id which will handle the VIRQ
+ * @parm virq the virq number (VIRQ_*)
+ * return 0 on success, -1 on failure
+ */
+int xc_domain_set_virq_handler(xc_interface *xch, uint32_t domid, int virq);
 
 /*
  * CPUPOOL MANAGEMENT FUNCTIONS
diff -r 34c96082d693 -r 1e155189c9a4 xen/arch/x86/cpu/mcheck/amd_nonfatal.c
--- a/xen/arch/x86/cpu/mcheck/amd_nonfatal.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/arch/x86/cpu/mcheck/amd_nonfatal.c	Sat Jan 28 13:48:03 2012 +0000
@@ -100,7 +100,7 @@
 
 		if (dom0_vmce_enabled()) {
 			mctelem_commit(mctc);
-			send_guest_global_virq(dom0, VIRQ_MCA);
+			send_global_virq(VIRQ_MCA);
 		} else if (++dumpcount >= 10) {
 			x86_mcinfo_dump((struct mc_info *)mctelem_dataptr(mctc));
 			mctelem_dismiss(mctc);
diff -r 34c96082d693 -r 1e155189c9a4 xen/arch/x86/cpu/mcheck/mce.c
--- a/xen/arch/x86/cpu/mcheck/mce.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/arch/x86/cpu/mcheck/mce.c	Sat Jan 28 13:48:03 2012 +0000
@@ -594,7 +594,7 @@
         if (dom0_vmce_enabled()) {
             if (mctc != NULL)
                 mctelem_commit(mctc);
-            send_guest_global_virq(dom0, VIRQ_MCA);
+            send_global_virq(VIRQ_MCA);
         } else {
             x86_mcinfo_dump(mci);
             if (mctc != NULL)
diff -r 34c96082d693 -r 1e155189c9a4 xen/arch/x86/cpu/mcheck/mce_intel.c
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c	Sat Jan 28 13:48:03 2012 +0000
@@ -354,7 +354,7 @@
         /* Step2: Send Log to DOM0 through vIRQ */
         if (dom0_vmce_enabled()) {
             mce_printk(MCE_VERBOSE, "MCE: send MCE# to DOM0 through virq\n");
-            send_guest_global_virq(dom0, VIRQ_MCA);
+            send_global_virq(VIRQ_MCA);
         }
     }
 
@@ -1085,7 +1085,7 @@
     if (bs.errcnt && mctc != NULL) {
         if (dom0_vmce_enabled()) {
             mctelem_commit(mctc);
-            send_guest_global_virq(dom0, VIRQ_MCA);
+            send_global_virq(VIRQ_MCA);
         } else {
             x86_mcinfo_dump(mctelem_dataptr(mctc));
             mctelem_dismiss(mctc);
@@ -1205,7 +1205,7 @@
         if (dom0_vmce_enabled()) {
             mctelem_commit(mctc);
             mce_printk(MCE_VERBOSE, "CMCI: send CMCI to DOM0 through virq\n");
-            send_guest_global_virq(dom0, VIRQ_MCA);
+            send_global_virq(VIRQ_MCA);
         } else {
             x86_mcinfo_dump(mctelem_dataptr(mctc));
             mctelem_dismiss(mctc);
diff -r 34c96082d693 -r 1e155189c9a4 xen/arch/x86/cpu/mcheck/non-fatal.c
--- a/xen/arch/x86/cpu/mcheck/non-fatal.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/arch/x86/cpu/mcheck/non-fatal.c	Sat Jan 28 13:48:03 2012 +0000
@@ -55,7 +55,7 @@
 
 		if (dom0_vmce_enabled()) {
 			mctelem_commit(mctc);
-			send_guest_global_virq(dom0, VIRQ_MCA);
+			send_global_virq(VIRQ_MCA);
 		} else if (++dumpcount >= 10) {
 			x86_mcinfo_dump((struct mc_info *)mctelem_dataptr(mctc));
 			mctelem_dismiss(mctc);
diff -r 34c96082d693 -r 1e155189c9a4 xen/common/cpu.c
--- a/xen/common/cpu.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/common/cpu.c	Sat Jan 28 13:48:03 2012 +0000
@@ -108,7 +108,7 @@
     notifier_rc = notifier_call_chain(&cpu_chain, CPU_DEAD, hcpu, NULL);
     BUG_ON(notifier_rc != NOTIFY_DONE);
 
-    send_guest_global_virq(dom0, VIRQ_PCPU_STATE);
+    send_global_virq(VIRQ_PCPU_STATE);
     cpu_hotplug_done();
     return 0;
 
@@ -148,7 +148,7 @@
     notifier_rc = notifier_call_chain(&cpu_chain, CPU_ONLINE, hcpu, NULL);
     BUG_ON(notifier_rc != NOTIFY_DONE);
 
-    send_guest_global_virq(dom0, VIRQ_PCPU_STATE);
+    send_global_virq(VIRQ_PCPU_STATE);
 
     cpu_hotplug_done();
     return 0;
diff -r 34c96082d693 -r 1e155189c9a4 xen/common/domain.c
--- a/xen/common/domain.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/common/domain.c	Sat Jan 28 13:48:03 2012 +0000
@@ -86,7 +86,7 @@
     if ( (d->shutdown_code == SHUTDOWN_suspend) && d->suspend_evtchn )
         evtchn_send(d, d->suspend_evtchn);
     else
-        send_guest_global_virq(dom0, VIRQ_DOM_EXC);
+        send_global_virq(VIRQ_DOM_EXC);
 }
 
 static void vcpu_check_shutdown(struct vcpu *v)
@@ -480,7 +480,7 @@
         }
         d->is_dying = DOMDYING_dead;
         put_domain(d);
-        send_guest_global_virq(dom0, VIRQ_DOM_EXC);
+        send_global_virq(VIRQ_DOM_EXC);
         /* fallthrough */
     case DOMDYING_dead:
         break;
@@ -621,7 +621,7 @@
     for_each_vcpu ( d, v )
         vcpu_sleep_nosync(v);
 
-    send_guest_global_virq(dom0, VIRQ_DEBUGGER);
+    send_global_virq(VIRQ_DEBUGGER);
 }
 
 /* Complete domain destroy after RCU readers are not holding old references. */
@@ -680,7 +680,7 @@
     free_cpumask_var(d->domain_dirty_cpumask);
     free_domain_struct(d);
 
-    send_guest_global_virq(dom0, VIRQ_DOM_EXC);
+    send_global_virq(VIRQ_DOM_EXC);
 }
 
 /* Release resources belonging to task @p. */
diff -r 34c96082d693 -r 1e155189c9a4 xen/common/domctl.c
--- a/xen/common/domctl.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/common/domctl.c	Sat Jan 28 13:48:03 2012 +0000
@@ -995,6 +995,23 @@
     }
     break;
 
+    case XEN_DOMCTL_set_virq_handler:
+    {
+        struct domain *d;
+        uint32_t virq = op->u.set_virq_handler.virq;
+
+        ret = -ESRCH;
+        d = rcu_lock_domain_by_id(op->domain);
+        if ( d != NULL )
+        {
+            ret = xsm_set_virq_handler(d, virq);
+            if ( !ret )
+                ret = set_global_virq_handler(d, virq);
+            rcu_unlock_domain(d);
+        }
+    }
+    break;
+
     default:
         ret = arch_do_domctl(op, u_domctl);
         break;
diff -r 34c96082d693 -r 1e155189c9a4 xen/common/event_channel.c
--- a/xen/common/event_channel.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/common/event_channel.c	Sat Jan 28 13:48:03 2012 +0000
@@ -689,7 +689,7 @@
     spin_unlock_irqrestore(&v->virq_lock, flags);
 }
 
-void send_guest_global_virq(struct domain *d, int virq)
+static void send_guest_global_virq(struct domain *d, int virq)
 {
     unsigned long flags;
     int port;
@@ -739,6 +739,68 @@
     return evtchn_set_pending(d->vcpu[chn->notify_vcpu_id], port);
 }
 
+static struct domain *global_virq_handlers[NR_VIRQS] __read_mostly;
+
+static DEFINE_SPINLOCK(global_virq_handlers_lock);
+
+void send_global_virq(uint32_t virq)
+{
+    ASSERT(virq < NR_VIRQS);
+    ASSERT(virq_is_global(virq));
+
+    send_guest_global_virq(global_virq_handlers[virq] ?: dom0, virq);
+}
+
+int set_global_virq_handler(struct domain *d, uint32_t virq)
+{
+    struct domain *old;
+
+    if (virq >= NR_VIRQS)
+        return -EINVAL;
+    if (!virq_is_global(virq))
+        return -EINVAL;
+
+    if (global_virq_handlers[virq] == d)
+        return 0;
+
+    if (unlikely(!get_domain(d)))
+        return -EINVAL;
+
+    spin_lock(&global_virq_handlers_lock);
+    old = global_virq_handlers[virq];
+    global_virq_handlers[virq] = d;
+    spin_unlock(&global_virq_handlers_lock);
+
+    if (old != NULL)
+        put_domain(old);
+
+    return 0;
+}
+
+static void clear_global_virq_handlers(struct domain *d)
+{
+    uint32_t virq;
+    int put_count = 0;
+
+    spin_lock(&global_virq_handlers_lock);
+
+    for (virq = 0; virq < NR_VIRQS; virq++)
+    {
+        if (global_virq_handlers[virq] == d)
+        {
+            global_virq_handlers[virq] = NULL;
+            put_count++;
+        }
+    }
+
+    spin_unlock(&global_virq_handlers_lock);
+
+    while (put_count)
+    {
+        put_domain(d);
+        put_count--;
+    }
+}
 
 static long evtchn_status(evtchn_status_t *status)
 {
@@ -1160,6 +1222,8 @@
         d->evtchn[i] = NULL;
     }
     spin_unlock(&d->event_lock);
+
+    clear_global_virq_handlers(d);
 }
 
 
diff -r 34c96082d693 -r 1e155189c9a4 xen/common/trace.c
--- a/xen/common/trace.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/common/trace.c	Sat Jan 28 13:48:03 2012 +0000
@@ -661,7 +661,7 @@
  */
 static void trace_notify_dom0(unsigned long unused)
 {
-    send_guest_global_virq(dom0, VIRQ_TBUF);
+    send_global_virq(VIRQ_TBUF);
 }
 static DECLARE_SOFTIRQ_TASKLET(trace_notify_dom0_tasklet,
                                trace_notify_dom0, 0);
diff -r 34c96082d693 -r 1e155189c9a4 xen/drivers/char/console.c
--- a/xen/drivers/char/console.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/drivers/char/console.c	Sat Jan 28 13:48:03 2012 +0000
@@ -288,7 +288,7 @@
     if ( (serial_rx_prod-serial_rx_cons) != SERIAL_RX_SIZE )
         serial_rx_ring[SERIAL_RX_MASK(serial_rx_prod++)] = c;
     /* Always notify the guest: prevents receive path from getting stuck. */
-    send_guest_global_virq(dom0, VIRQ_CONSOLE);
+    send_global_virq(VIRQ_CONSOLE);
 }
 
 static void serial_rx(char c, struct cpu_user_regs *regs)
@@ -315,7 +315,7 @@
 
 static void notify_dom0_con_ring(unsigned long unused)
 {
-    send_guest_global_virq(dom0, VIRQ_CON_RING);
+    send_global_virq(VIRQ_CON_RING);
 }
 static DECLARE_SOFTIRQ_TASKLET(notify_dom0_con_ring_tasklet,
                                notify_dom0_con_ring, 0);
diff -r 34c96082d693 -r 1e155189c9a4 xen/include/public/domctl.h
--- a/xen/include/public/domctl.h	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/include/public/domctl.h	Sat Jan 28 13:48:03 2012 +0000
@@ -830,6 +830,12 @@
 typedef struct xen_domctl_audit_p2m xen_domctl_audit_p2m_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_audit_p2m_t);
 
+struct xen_domctl_set_virq_handler {
+    uint32_t virq; /* IN */
+};
+typedef struct xen_domctl_set_virq_handler xen_domctl_set_virq_handler_t;
+DEFINE_XEN_GUEST_HANDLE(xen_domctl_set_virq_handler_t);
+
 #if defined(__i386__) || defined(__x86_64__)
 /* XEN_DOMCTL_setvcpuextstate */
 /* XEN_DOMCTL_getvcpuextstate */
@@ -929,6 +935,7 @@
 #define XEN_DOMCTL_getvcpuextstate               63
 #define XEN_DOMCTL_set_access_required           64
 #define XEN_DOMCTL_audit_p2m                     65
+#define XEN_DOMCTL_set_virq_handler              66
 #define XEN_DOMCTL_gdbsx_guestmemio            1000
 #define XEN_DOMCTL_gdbsx_pausevcpu             1001
 #define XEN_DOMCTL_gdbsx_unpausevcpu           1002
@@ -983,6 +990,7 @@
 #endif
         struct xen_domctl_set_access_required access_required;
         struct xen_domctl_audit_p2m         audit_p2m;
+        struct xen_domctl_set_virq_handler  set_virq_handler;
         struct xen_domctl_gdbsx_memio       gdbsx_guest_memio;
         struct xen_domctl_gdbsx_pauseunp_vcpu gdbsx_pauseunp_vcpu;
         struct xen_domctl_gdbsx_domstatus   gdbsx_domstatus;
diff -r 34c96082d693 -r 1e155189c9a4 xen/include/xen/event.h
--- a/xen/include/xen/event.h	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/include/xen/event.h	Sat Jan 28 13:48:03 2012 +0000
@@ -23,11 +23,17 @@
 void send_guest_vcpu_virq(struct vcpu *v, int virq);
 
 /*
- * send_guest_global_virq: Notify guest via a global VIRQ.
- *  @d:        Domain to which virtual IRQ should be sent
+ * send_global_virq: Notify the domain handling a global VIRQ.
  *  @virq:     Virtual IRQ number (VIRQ_*)
  */
-void send_guest_global_virq(struct domain *d, int virq);
+void send_global_virq(uint32_t virq);
+
+/*
+ * sent_global_virq_handler: Set a global VIRQ handler.
+ *  @d:        New target domain for this VIRQ
+ *  @virq:     Virtual IRQ number (VIRQ_*), must be global
+ */
+int set_global_virq_handler(struct domain *d, uint32_t virq);
 
 /*
  * send_guest_pirq:
diff -r 34c96082d693 -r 1e155189c9a4 xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/include/xsm/xsm.h	Sat Jan 28 13:48:03 2012 +0000
@@ -64,6 +64,7 @@
     int (*domain_settime) (struct domain *d);
     int (*set_target) (struct domain *d, struct domain *e);
     int (*domctl) (struct domain *d, int cmd);
+    int (*set_virq_handler) (struct domain *d, uint32_t virq);
     int (*tbufcontrol) (void);
     int (*readconsole) (uint32_t clear);
     int (*sched_id) (void);
@@ -265,6 +266,11 @@
     return xsm_call(domctl(d, cmd));
 }
 
+static inline int xsm_set_virq_handler (struct domain *d, uint32_t virq)
+{
+    return xsm_call(set_virq_handler(d, virq));
+}
+
 static inline int xsm_tbufcontrol (void)
 {
     return xsm_call(tbufcontrol());
diff -r 34c96082d693 -r 1e155189c9a4 xen/xsm/dummy.c
--- a/xen/xsm/dummy.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/xsm/dummy.c	Sat Jan 28 13:48:03 2012 +0000
@@ -94,6 +94,11 @@
     return 0;
 }
 
+static int dummy_set_virq_handler(struct domain *d, uint32_t virq)
+{
+    return 0;
+}
+
 static int dummy_tbufcontrol (void)
 {
     return 0;
@@ -596,6 +601,7 @@
     set_to_dummy_if_null(ops, domain_settime);
     set_to_dummy_if_null(ops, set_target);
     set_to_dummy_if_null(ops, domctl);
+    set_to_dummy_if_null(ops, set_virq_handler);
     set_to_dummy_if_null(ops, tbufcontrol);
     set_to_dummy_if_null(ops, readconsole);
     set_to_dummy_if_null(ops, sched_id);
diff -r 34c96082d693 -r 1e155189c9a4 xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/xsm/flask/hooks.c	Sat Jan 28 13:48:03 2012 +0000
@@ -597,6 +597,11 @@
     return domain_has_perm(current->domain, d, SECCLASS_DOMAIN, DOMAIN__SET_MISC_INFO);
 }
 
+static int flask_set_virq_handler(struct domain *d, uint32_t virq)
+{
+    return domain_has_perm(current->domain, d, SECCLASS_DOMAIN, DOMAIN__SET_VIRQ_HANDLER);
+}
+
 static int flask_tbufcontrol(void)
 {
     return domain_has_xen(current->domain, XEN__TBUFCONTROL);
@@ -1460,6 +1465,7 @@
     .domain_settime = flask_domain_settime,
     .set_target = flask_set_target,
     .domctl = flask_domctl,
+    .set_virq_handler = flask_set_virq_handler,
     .tbufcontrol = flask_tbufcontrol,
     .readconsole = flask_readconsole,
     .sched_id = flask_sched_id,
diff -r 34c96082d693 -r 1e155189c9a4 xen/xsm/flask/include/av_perm_to_string.h
--- a/xen/xsm/flask/include/av_perm_to_string.h	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/xsm/flask/include/av_perm_to_string.h	Sat Jan 28 13:48:03 2012 +0000
@@ -60,6 +60,7 @@
    S_(SECCLASS_DOMAIN, DOMAIN__GETPODTARGET, "getpodtarget")
    S_(SECCLASS_DOMAIN, DOMAIN__SETPODTARGET, "setpodtarget")
    S_(SECCLASS_DOMAIN, DOMAIN__SET_MISC_INFO, "set_misc_info")
+   S_(SECCLASS_DOMAIN, DOMAIN__SET_VIRQ_HANDLER, "set_virq_handler")
    S_(SECCLASS_HVM, HVM__SETHVMC, "sethvmc")
    S_(SECCLASS_HVM, HVM__GETHVMC, "gethvmc")
    S_(SECCLASS_HVM, HVM__SETPARAM, "setparam")
diff -r 34c96082d693 -r 1e155189c9a4 xen/xsm/flask/include/av_permissions.h
--- a/xen/xsm/flask/include/av_permissions.h	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/xsm/flask/include/av_permissions.h	Sat Jan 28 13:48:03 2012 +0000
@@ -61,6 +61,7 @@
 #define DOMAIN__GETPODTARGET                      0x10000000UL
 #define DOMAIN__SETPODTARGET                      0x20000000UL
 #define DOMAIN__SET_MISC_INFO                     0x40000000UL
+#define DOMAIN__SET_VIRQ_HANDLER                  0x80000000UL
 
 #define HVM__SETHVMC                              0x00000001UL
 #define HVM__GETHVMC                              0x00000002UL

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:37 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7V-0006nY-0w; Fri, 03 Feb 2012 21:56:37 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7T-0006hw-IE
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:36 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1328306186!13046406!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4606 invoked from network); 3 Feb 2012 21:56:28 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:28 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7K-0001kD-Fq
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:26 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7I-0002Uq-Vh
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:25 +0000
Message-Id: <E1RtR7I-0002Uq-Vh@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:24 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: allow global VIRQ handlers to
	be delegated to other domains
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327758483 0
# Node ID 1e155189c9a4f6e9d78cf3ea955c9c0fad07d7f7
# Parent  34c96082d69389e5891bbc1c424d0199355632df
xen: allow global VIRQ handlers to be delegated to other domains

This patch sends global VIRQs to a domain designated as the VIRQ
handler
instead of sending all global VIRQ events to dom0. This is required in
order to run xenstored in a stubdom, because VIRQ_DOM_EXC must be sent
to xenstored for domain destruction to work properly.

This patch was inspired by the xenstored stubdomain patch series sent
to xen-devel by Alex Zeffertt in 2009.

Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com>
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 34c96082d693 -r 1e155189c9a4 tools/flask/policy/policy/flask/access_vectors
--- a/tools/flask/policy/policy/flask/access_vectors	Sat Jan 28 13:47:24 2012 +0000
+++ b/tools/flask/policy/policy/flask/access_vectors	Sat Jan 28 13:48:03 2012 +0000
@@ -85,6 +85,7 @@
 	getpodtarget
 	setpodtarget
 	set_misc_info
+	set_virq_handler
 }
 
 class hvm
diff -r 34c96082d693 -r 1e155189c9a4 tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/tools/libxc/xc_domain.c	Sat Jan 28 13:48:03 2012 +0000
@@ -1504,6 +1504,16 @@
     return do_domctl(xch, &domctl);
 }
 
+int xc_domain_set_virq_handler(xc_interface *xch, uint32_t domid, int virq)
+{
+    DECLARE_DOMCTL;
+
+    domctl.cmd = XEN_DOMCTL_set_virq_handler;
+    domctl.domain = domid;
+    domctl.u.set_virq_handler.virq = virq;
+    return do_domctl(xch, &domctl);
+}
+
 /*
  * Local variables:
  * mode: C
diff -r 34c96082d693 -r 1e155189c9a4 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h	Sat Jan 28 13:47:24 2012 +0000
+++ b/tools/libxc/xenctrl.h	Sat Jan 28 13:48:03 2012 +0000
@@ -749,6 +749,15 @@
 int xc_domain_set_access_required(xc_interface *xch,
 				  uint32_t domid,
 				  unsigned int required);
+/**
+ * This function sets the handler of global VIRQs sent by the hypervisor
+ *
+ * @parm xch a handle to an open hypervisor interface
+ * @parm domid the domain id which will handle the VIRQ
+ * @parm virq the virq number (VIRQ_*)
+ * return 0 on success, -1 on failure
+ */
+int xc_domain_set_virq_handler(xc_interface *xch, uint32_t domid, int virq);
 
 /*
  * CPUPOOL MANAGEMENT FUNCTIONS
diff -r 34c96082d693 -r 1e155189c9a4 xen/arch/x86/cpu/mcheck/amd_nonfatal.c
--- a/xen/arch/x86/cpu/mcheck/amd_nonfatal.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/arch/x86/cpu/mcheck/amd_nonfatal.c	Sat Jan 28 13:48:03 2012 +0000
@@ -100,7 +100,7 @@
 
 		if (dom0_vmce_enabled()) {
 			mctelem_commit(mctc);
-			send_guest_global_virq(dom0, VIRQ_MCA);
+			send_global_virq(VIRQ_MCA);
 		} else if (++dumpcount >= 10) {
 			x86_mcinfo_dump((struct mc_info *)mctelem_dataptr(mctc));
 			mctelem_dismiss(mctc);
diff -r 34c96082d693 -r 1e155189c9a4 xen/arch/x86/cpu/mcheck/mce.c
--- a/xen/arch/x86/cpu/mcheck/mce.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/arch/x86/cpu/mcheck/mce.c	Sat Jan 28 13:48:03 2012 +0000
@@ -594,7 +594,7 @@
         if (dom0_vmce_enabled()) {
             if (mctc != NULL)
                 mctelem_commit(mctc);
-            send_guest_global_virq(dom0, VIRQ_MCA);
+            send_global_virq(VIRQ_MCA);
         } else {
             x86_mcinfo_dump(mci);
             if (mctc != NULL)
diff -r 34c96082d693 -r 1e155189c9a4 xen/arch/x86/cpu/mcheck/mce_intel.c
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c	Sat Jan 28 13:48:03 2012 +0000
@@ -354,7 +354,7 @@
         /* Step2: Send Log to DOM0 through vIRQ */
         if (dom0_vmce_enabled()) {
             mce_printk(MCE_VERBOSE, "MCE: send MCE# to DOM0 through virq\n");
-            send_guest_global_virq(dom0, VIRQ_MCA);
+            send_global_virq(VIRQ_MCA);
         }
     }
 
@@ -1085,7 +1085,7 @@
     if (bs.errcnt && mctc != NULL) {
         if (dom0_vmce_enabled()) {
             mctelem_commit(mctc);
-            send_guest_global_virq(dom0, VIRQ_MCA);
+            send_global_virq(VIRQ_MCA);
         } else {
             x86_mcinfo_dump(mctelem_dataptr(mctc));
             mctelem_dismiss(mctc);
@@ -1205,7 +1205,7 @@
         if (dom0_vmce_enabled()) {
             mctelem_commit(mctc);
             mce_printk(MCE_VERBOSE, "CMCI: send CMCI to DOM0 through virq\n");
-            send_guest_global_virq(dom0, VIRQ_MCA);
+            send_global_virq(VIRQ_MCA);
         } else {
             x86_mcinfo_dump(mctelem_dataptr(mctc));
             mctelem_dismiss(mctc);
diff -r 34c96082d693 -r 1e155189c9a4 xen/arch/x86/cpu/mcheck/non-fatal.c
--- a/xen/arch/x86/cpu/mcheck/non-fatal.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/arch/x86/cpu/mcheck/non-fatal.c	Sat Jan 28 13:48:03 2012 +0000
@@ -55,7 +55,7 @@
 
 		if (dom0_vmce_enabled()) {
 			mctelem_commit(mctc);
-			send_guest_global_virq(dom0, VIRQ_MCA);
+			send_global_virq(VIRQ_MCA);
 		} else if (++dumpcount >= 10) {
 			x86_mcinfo_dump((struct mc_info *)mctelem_dataptr(mctc));
 			mctelem_dismiss(mctc);
diff -r 34c96082d693 -r 1e155189c9a4 xen/common/cpu.c
--- a/xen/common/cpu.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/common/cpu.c	Sat Jan 28 13:48:03 2012 +0000
@@ -108,7 +108,7 @@
     notifier_rc = notifier_call_chain(&cpu_chain, CPU_DEAD, hcpu, NULL);
     BUG_ON(notifier_rc != NOTIFY_DONE);
 
-    send_guest_global_virq(dom0, VIRQ_PCPU_STATE);
+    send_global_virq(VIRQ_PCPU_STATE);
     cpu_hotplug_done();
     return 0;
 
@@ -148,7 +148,7 @@
     notifier_rc = notifier_call_chain(&cpu_chain, CPU_ONLINE, hcpu, NULL);
     BUG_ON(notifier_rc != NOTIFY_DONE);
 
-    send_guest_global_virq(dom0, VIRQ_PCPU_STATE);
+    send_global_virq(VIRQ_PCPU_STATE);
 
     cpu_hotplug_done();
     return 0;
diff -r 34c96082d693 -r 1e155189c9a4 xen/common/domain.c
--- a/xen/common/domain.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/common/domain.c	Sat Jan 28 13:48:03 2012 +0000
@@ -86,7 +86,7 @@
     if ( (d->shutdown_code == SHUTDOWN_suspend) && d->suspend_evtchn )
         evtchn_send(d, d->suspend_evtchn);
     else
-        send_guest_global_virq(dom0, VIRQ_DOM_EXC);
+        send_global_virq(VIRQ_DOM_EXC);
 }
 
 static void vcpu_check_shutdown(struct vcpu *v)
@@ -480,7 +480,7 @@
         }
         d->is_dying = DOMDYING_dead;
         put_domain(d);
-        send_guest_global_virq(dom0, VIRQ_DOM_EXC);
+        send_global_virq(VIRQ_DOM_EXC);
         /* fallthrough */
     case DOMDYING_dead:
         break;
@@ -621,7 +621,7 @@
     for_each_vcpu ( d, v )
         vcpu_sleep_nosync(v);
 
-    send_guest_global_virq(dom0, VIRQ_DEBUGGER);
+    send_global_virq(VIRQ_DEBUGGER);
 }
 
 /* Complete domain destroy after RCU readers are not holding old references. */
@@ -680,7 +680,7 @@
     free_cpumask_var(d->domain_dirty_cpumask);
     free_domain_struct(d);
 
-    send_guest_global_virq(dom0, VIRQ_DOM_EXC);
+    send_global_virq(VIRQ_DOM_EXC);
 }
 
 /* Release resources belonging to task @p. */
diff -r 34c96082d693 -r 1e155189c9a4 xen/common/domctl.c
--- a/xen/common/domctl.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/common/domctl.c	Sat Jan 28 13:48:03 2012 +0000
@@ -995,6 +995,23 @@
     }
     break;
 
+    case XEN_DOMCTL_set_virq_handler:
+    {
+        struct domain *d;
+        uint32_t virq = op->u.set_virq_handler.virq;
+
+        ret = -ESRCH;
+        d = rcu_lock_domain_by_id(op->domain);
+        if ( d != NULL )
+        {
+            ret = xsm_set_virq_handler(d, virq);
+            if ( !ret )
+                ret = set_global_virq_handler(d, virq);
+            rcu_unlock_domain(d);
+        }
+    }
+    break;
+
     default:
         ret = arch_do_domctl(op, u_domctl);
         break;
diff -r 34c96082d693 -r 1e155189c9a4 xen/common/event_channel.c
--- a/xen/common/event_channel.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/common/event_channel.c	Sat Jan 28 13:48:03 2012 +0000
@@ -689,7 +689,7 @@
     spin_unlock_irqrestore(&v->virq_lock, flags);
 }
 
-void send_guest_global_virq(struct domain *d, int virq)
+static void send_guest_global_virq(struct domain *d, int virq)
 {
     unsigned long flags;
     int port;
@@ -739,6 +739,68 @@
     return evtchn_set_pending(d->vcpu[chn->notify_vcpu_id], port);
 }
 
+static struct domain *global_virq_handlers[NR_VIRQS] __read_mostly;
+
+static DEFINE_SPINLOCK(global_virq_handlers_lock);
+
+void send_global_virq(uint32_t virq)
+{
+    ASSERT(virq < NR_VIRQS);
+    ASSERT(virq_is_global(virq));
+
+    send_guest_global_virq(global_virq_handlers[virq] ?: dom0, virq);
+}
+
+int set_global_virq_handler(struct domain *d, uint32_t virq)
+{
+    struct domain *old;
+
+    if (virq >= NR_VIRQS)
+        return -EINVAL;
+    if (!virq_is_global(virq))
+        return -EINVAL;
+
+    if (global_virq_handlers[virq] == d)
+        return 0;
+
+    if (unlikely(!get_domain(d)))
+        return -EINVAL;
+
+    spin_lock(&global_virq_handlers_lock);
+    old = global_virq_handlers[virq];
+    global_virq_handlers[virq] = d;
+    spin_unlock(&global_virq_handlers_lock);
+
+    if (old != NULL)
+        put_domain(old);
+
+    return 0;
+}
+
+static void clear_global_virq_handlers(struct domain *d)
+{
+    uint32_t virq;
+    int put_count = 0;
+
+    spin_lock(&global_virq_handlers_lock);
+
+    for (virq = 0; virq < NR_VIRQS; virq++)
+    {
+        if (global_virq_handlers[virq] == d)
+        {
+            global_virq_handlers[virq] = NULL;
+            put_count++;
+        }
+    }
+
+    spin_unlock(&global_virq_handlers_lock);
+
+    while (put_count)
+    {
+        put_domain(d);
+        put_count--;
+    }
+}
 
 static long evtchn_status(evtchn_status_t *status)
 {
@@ -1160,6 +1222,8 @@
         d->evtchn[i] = NULL;
     }
     spin_unlock(&d->event_lock);
+
+    clear_global_virq_handlers(d);
 }
 
 
diff -r 34c96082d693 -r 1e155189c9a4 xen/common/trace.c
--- a/xen/common/trace.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/common/trace.c	Sat Jan 28 13:48:03 2012 +0000
@@ -661,7 +661,7 @@
  */
 static void trace_notify_dom0(unsigned long unused)
 {
-    send_guest_global_virq(dom0, VIRQ_TBUF);
+    send_global_virq(VIRQ_TBUF);
 }
 static DECLARE_SOFTIRQ_TASKLET(trace_notify_dom0_tasklet,
                                trace_notify_dom0, 0);
diff -r 34c96082d693 -r 1e155189c9a4 xen/drivers/char/console.c
--- a/xen/drivers/char/console.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/drivers/char/console.c	Sat Jan 28 13:48:03 2012 +0000
@@ -288,7 +288,7 @@
     if ( (serial_rx_prod-serial_rx_cons) != SERIAL_RX_SIZE )
         serial_rx_ring[SERIAL_RX_MASK(serial_rx_prod++)] = c;
     /* Always notify the guest: prevents receive path from getting stuck. */
-    send_guest_global_virq(dom0, VIRQ_CONSOLE);
+    send_global_virq(VIRQ_CONSOLE);
 }
 
 static void serial_rx(char c, struct cpu_user_regs *regs)
@@ -315,7 +315,7 @@
 
 static void notify_dom0_con_ring(unsigned long unused)
 {
-    send_guest_global_virq(dom0, VIRQ_CON_RING);
+    send_global_virq(VIRQ_CON_RING);
 }
 static DECLARE_SOFTIRQ_TASKLET(notify_dom0_con_ring_tasklet,
                                notify_dom0_con_ring, 0);
diff -r 34c96082d693 -r 1e155189c9a4 xen/include/public/domctl.h
--- a/xen/include/public/domctl.h	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/include/public/domctl.h	Sat Jan 28 13:48:03 2012 +0000
@@ -830,6 +830,12 @@
 typedef struct xen_domctl_audit_p2m xen_domctl_audit_p2m_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_audit_p2m_t);
 
+struct xen_domctl_set_virq_handler {
+    uint32_t virq; /* IN */
+};
+typedef struct xen_domctl_set_virq_handler xen_domctl_set_virq_handler_t;
+DEFINE_XEN_GUEST_HANDLE(xen_domctl_set_virq_handler_t);
+
 #if defined(__i386__) || defined(__x86_64__)
 /* XEN_DOMCTL_setvcpuextstate */
 /* XEN_DOMCTL_getvcpuextstate */
@@ -929,6 +935,7 @@
 #define XEN_DOMCTL_getvcpuextstate               63
 #define XEN_DOMCTL_set_access_required           64
 #define XEN_DOMCTL_audit_p2m                     65
+#define XEN_DOMCTL_set_virq_handler              66
 #define XEN_DOMCTL_gdbsx_guestmemio            1000
 #define XEN_DOMCTL_gdbsx_pausevcpu             1001
 #define XEN_DOMCTL_gdbsx_unpausevcpu           1002
@@ -983,6 +990,7 @@
 #endif
         struct xen_domctl_set_access_required access_required;
         struct xen_domctl_audit_p2m         audit_p2m;
+        struct xen_domctl_set_virq_handler  set_virq_handler;
         struct xen_domctl_gdbsx_memio       gdbsx_guest_memio;
         struct xen_domctl_gdbsx_pauseunp_vcpu gdbsx_pauseunp_vcpu;
         struct xen_domctl_gdbsx_domstatus   gdbsx_domstatus;
diff -r 34c96082d693 -r 1e155189c9a4 xen/include/xen/event.h
--- a/xen/include/xen/event.h	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/include/xen/event.h	Sat Jan 28 13:48:03 2012 +0000
@@ -23,11 +23,17 @@
 void send_guest_vcpu_virq(struct vcpu *v, int virq);
 
 /*
- * send_guest_global_virq: Notify guest via a global VIRQ.
- *  @d:        Domain to which virtual IRQ should be sent
+ * send_global_virq: Notify the domain handling a global VIRQ.
  *  @virq:     Virtual IRQ number (VIRQ_*)
  */
-void send_guest_global_virq(struct domain *d, int virq);
+void send_global_virq(uint32_t virq);
+
+/*
+ * sent_global_virq_handler: Set a global VIRQ handler.
+ *  @d:        New target domain for this VIRQ
+ *  @virq:     Virtual IRQ number (VIRQ_*), must be global
+ */
+int set_global_virq_handler(struct domain *d, uint32_t virq);
 
 /*
  * send_guest_pirq:
diff -r 34c96082d693 -r 1e155189c9a4 xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/include/xsm/xsm.h	Sat Jan 28 13:48:03 2012 +0000
@@ -64,6 +64,7 @@
     int (*domain_settime) (struct domain *d);
     int (*set_target) (struct domain *d, struct domain *e);
     int (*domctl) (struct domain *d, int cmd);
+    int (*set_virq_handler) (struct domain *d, uint32_t virq);
     int (*tbufcontrol) (void);
     int (*readconsole) (uint32_t clear);
     int (*sched_id) (void);
@@ -265,6 +266,11 @@
     return xsm_call(domctl(d, cmd));
 }
 
+static inline int xsm_set_virq_handler (struct domain *d, uint32_t virq)
+{
+    return xsm_call(set_virq_handler(d, virq));
+}
+
 static inline int xsm_tbufcontrol (void)
 {
     return xsm_call(tbufcontrol());
diff -r 34c96082d693 -r 1e155189c9a4 xen/xsm/dummy.c
--- a/xen/xsm/dummy.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/xsm/dummy.c	Sat Jan 28 13:48:03 2012 +0000
@@ -94,6 +94,11 @@
     return 0;
 }
 
+static int dummy_set_virq_handler(struct domain *d, uint32_t virq)
+{
+    return 0;
+}
+
 static int dummy_tbufcontrol (void)
 {
     return 0;
@@ -596,6 +601,7 @@
     set_to_dummy_if_null(ops, domain_settime);
     set_to_dummy_if_null(ops, set_target);
     set_to_dummy_if_null(ops, domctl);
+    set_to_dummy_if_null(ops, set_virq_handler);
     set_to_dummy_if_null(ops, tbufcontrol);
     set_to_dummy_if_null(ops, readconsole);
     set_to_dummy_if_null(ops, sched_id);
diff -r 34c96082d693 -r 1e155189c9a4 xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/xsm/flask/hooks.c	Sat Jan 28 13:48:03 2012 +0000
@@ -597,6 +597,11 @@
     return domain_has_perm(current->domain, d, SECCLASS_DOMAIN, DOMAIN__SET_MISC_INFO);
 }
 
+static int flask_set_virq_handler(struct domain *d, uint32_t virq)
+{
+    return domain_has_perm(current->domain, d, SECCLASS_DOMAIN, DOMAIN__SET_VIRQ_HANDLER);
+}
+
 static int flask_tbufcontrol(void)
 {
     return domain_has_xen(current->domain, XEN__TBUFCONTROL);
@@ -1460,6 +1465,7 @@
     .domain_settime = flask_domain_settime,
     .set_target = flask_set_target,
     .domctl = flask_domctl,
+    .set_virq_handler = flask_set_virq_handler,
     .tbufcontrol = flask_tbufcontrol,
     .readconsole = flask_readconsole,
     .sched_id = flask_sched_id,
diff -r 34c96082d693 -r 1e155189c9a4 xen/xsm/flask/include/av_perm_to_string.h
--- a/xen/xsm/flask/include/av_perm_to_string.h	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/xsm/flask/include/av_perm_to_string.h	Sat Jan 28 13:48:03 2012 +0000
@@ -60,6 +60,7 @@
    S_(SECCLASS_DOMAIN, DOMAIN__GETPODTARGET, "getpodtarget")
    S_(SECCLASS_DOMAIN, DOMAIN__SETPODTARGET, "setpodtarget")
    S_(SECCLASS_DOMAIN, DOMAIN__SET_MISC_INFO, "set_misc_info")
+   S_(SECCLASS_DOMAIN, DOMAIN__SET_VIRQ_HANDLER, "set_virq_handler")
    S_(SECCLASS_HVM, HVM__SETHVMC, "sethvmc")
    S_(SECCLASS_HVM, HVM__GETHVMC, "gethvmc")
    S_(SECCLASS_HVM, HVM__SETPARAM, "setparam")
diff -r 34c96082d693 -r 1e155189c9a4 xen/xsm/flask/include/av_permissions.h
--- a/xen/xsm/flask/include/av_permissions.h	Sat Jan 28 13:47:24 2012 +0000
+++ b/xen/xsm/flask/include/av_permissions.h	Sat Jan 28 13:48:03 2012 +0000
@@ -61,6 +61,7 @@
 #define DOMAIN__GETPODTARGET                      0x10000000UL
 #define DOMAIN__SETPODTARGET                      0x20000000UL
 #define DOMAIN__SET_MISC_INFO                     0x40000000UL
+#define DOMAIN__SET_VIRQ_HANDLER                  0x80000000UL
 
 #define HVM__SETHVMC                              0x00000001UL
 #define HVM__GETHVMC                              0x00000002UL

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:38 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7W-0006oj-3d; Fri, 03 Feb 2012 21:56:38 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7U-0006ir-Ui
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:37 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1328306189!13361752!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21419 invoked from network); 3 Feb 2012 21:56:30 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:30 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7N-0001kL-23
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:29 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7K-0002VY-V8
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:28 +0000
Message-Id: <E1RtR7K-0002VY-V8@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:26 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: change virq parameters from int
	to uint32_t
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327758514 0
# Node ID 1025acf332ded1a14ef44a813d13bc0595ac5386
# Parent  1e155189c9a4f6e9d78cf3ea955c9c0fad07d7f7
xen: change virq parameters from int to uint32_t

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 1e155189c9a4 -r 1025acf332de xen/common/event_channel.c
--- a/xen/common/event_channel.c	Sat Jan 28 13:48:03 2012 +0000
+++ b/xen/common/event_channel.c	Sat Jan 28 13:48:34 2012 +0000
@@ -104,11 +104,11 @@
 
 static int evtchn_set_pending(struct vcpu *v, int port);
 
-static int virq_is_global(int virq)
+static int virq_is_global(uint32_t virq)
 {
     int rc;
 
-    ASSERT((virq >= 0) && (virq < NR_VIRQS));
+    ASSERT(virq < NR_VIRQS);
 
     switch ( virq )
     {
@@ -665,12 +665,12 @@
     return 0;
 }
 
-int guest_enabled_event(struct vcpu *v, int virq)
+int guest_enabled_event(struct vcpu *v, uint32_t virq)
 {
     return ((v != NULL) && (v->virq_to_evtchn[virq] != 0));
 }
 
-void send_guest_vcpu_virq(struct vcpu *v, int virq)
+void send_guest_vcpu_virq(struct vcpu *v, uint32_t virq)
 {
     unsigned long flags;
     int port;
@@ -689,7 +689,7 @@
     spin_unlock_irqrestore(&v->virq_lock, flags);
 }
 
-static void send_guest_global_virq(struct domain *d, int virq)
+static void send_guest_global_virq(struct domain *d, uint32_t virq)
 {
     unsigned long flags;
     int port;
diff -r 1e155189c9a4 -r 1025acf332de xen/include/asm-ia64/event.h
--- a/xen/include/asm-ia64/event.h	Sat Jan 28 13:48:03 2012 +0000
+++ b/xen/include/asm-ia64/event.h	Sat Jan 28 13:48:34 2012 +0000
@@ -63,7 +63,7 @@
     current->vcpu_info->evtchn_upcall_mask = 0;
 }
 
-static inline int arch_virq_is_global(int virq)
+static inline int arch_virq_is_global(uint32_t virq)
 {
     int rc;
 
diff -r 1e155189c9a4 -r 1025acf332de xen/include/asm-x86/event.h
--- a/xen/include/asm-x86/event.h	Sat Jan 28 13:48:03 2012 +0000
+++ b/xen/include/asm-x86/event.h	Sat Jan 28 13:48:34 2012 +0000
@@ -39,7 +39,7 @@
 }
 
 /* No arch specific virq definition now. Default to global. */
-static inline int arch_virq_is_global(int virq)
+static inline int arch_virq_is_global(uint32_t virq)
 {
     return 1;
 }
diff -r 1e155189c9a4 -r 1025acf332de xen/include/xen/event.h
--- a/xen/include/xen/event.h	Sat Jan 28 13:48:03 2012 +0000
+++ b/xen/include/xen/event.h	Sat Jan 28 13:48:34 2012 +0000
@@ -20,7 +20,7 @@
  *  @v:        VCPU to which virtual IRQ should be sent
  *  @virq:     Virtual IRQ number (VIRQ_*)
  */
-void send_guest_vcpu_virq(struct vcpu *v, int virq);
+void send_guest_vcpu_virq(struct vcpu *v, uint32_t virq);
 
 /*
  * send_global_virq: Notify the domain handling a global VIRQ.
@@ -65,7 +65,7 @@
     struct vcpu *local_vcpu, int port);
 
 /* Query if event channel is in use by the guest */
-int guest_enabled_event(struct vcpu *v, int virq);
+int guest_enabled_event(struct vcpu *v, uint32_t virq);
 
 /* Notify remote end of a Xen-attached event channel.*/
 void notify_via_xen_event_channel(struct domain *ld, int lport);

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:38 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7W-0006oj-3d; Fri, 03 Feb 2012 21:56:38 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7U-0006ir-Ui
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:37 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1328306189!13361752!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21419 invoked from network); 3 Feb 2012 21:56:30 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:30 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7N-0001kL-23
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:29 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7K-0002VY-V8
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:28 +0000
Message-Id: <E1RtR7K-0002VY-V8@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:26 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: change virq parameters from int
	to uint32_t
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327758514 0
# Node ID 1025acf332ded1a14ef44a813d13bc0595ac5386
# Parent  1e155189c9a4f6e9d78cf3ea955c9c0fad07d7f7
xen: change virq parameters from int to uint32_t

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 1e155189c9a4 -r 1025acf332de xen/common/event_channel.c
--- a/xen/common/event_channel.c	Sat Jan 28 13:48:03 2012 +0000
+++ b/xen/common/event_channel.c	Sat Jan 28 13:48:34 2012 +0000
@@ -104,11 +104,11 @@
 
 static int evtchn_set_pending(struct vcpu *v, int port);
 
-static int virq_is_global(int virq)
+static int virq_is_global(uint32_t virq)
 {
     int rc;
 
-    ASSERT((virq >= 0) && (virq < NR_VIRQS));
+    ASSERT(virq < NR_VIRQS);
 
     switch ( virq )
     {
@@ -665,12 +665,12 @@
     return 0;
 }
 
-int guest_enabled_event(struct vcpu *v, int virq)
+int guest_enabled_event(struct vcpu *v, uint32_t virq)
 {
     return ((v != NULL) && (v->virq_to_evtchn[virq] != 0));
 }
 
-void send_guest_vcpu_virq(struct vcpu *v, int virq)
+void send_guest_vcpu_virq(struct vcpu *v, uint32_t virq)
 {
     unsigned long flags;
     int port;
@@ -689,7 +689,7 @@
     spin_unlock_irqrestore(&v->virq_lock, flags);
 }
 
-static void send_guest_global_virq(struct domain *d, int virq)
+static void send_guest_global_virq(struct domain *d, uint32_t virq)
 {
     unsigned long flags;
     int port;
diff -r 1e155189c9a4 -r 1025acf332de xen/include/asm-ia64/event.h
--- a/xen/include/asm-ia64/event.h	Sat Jan 28 13:48:03 2012 +0000
+++ b/xen/include/asm-ia64/event.h	Sat Jan 28 13:48:34 2012 +0000
@@ -63,7 +63,7 @@
     current->vcpu_info->evtchn_upcall_mask = 0;
 }
 
-static inline int arch_virq_is_global(int virq)
+static inline int arch_virq_is_global(uint32_t virq)
 {
     int rc;
 
diff -r 1e155189c9a4 -r 1025acf332de xen/include/asm-x86/event.h
--- a/xen/include/asm-x86/event.h	Sat Jan 28 13:48:03 2012 +0000
+++ b/xen/include/asm-x86/event.h	Sat Jan 28 13:48:34 2012 +0000
@@ -39,7 +39,7 @@
 }
 
 /* No arch specific virq definition now. Default to global. */
-static inline int arch_virq_is_global(int virq)
+static inline int arch_virq_is_global(uint32_t virq)
 {
     return 1;
 }
diff -r 1e155189c9a4 -r 1025acf332de xen/include/xen/event.h
--- a/xen/include/xen/event.h	Sat Jan 28 13:48:03 2012 +0000
+++ b/xen/include/xen/event.h	Sat Jan 28 13:48:34 2012 +0000
@@ -20,7 +20,7 @@
  *  @v:        VCPU to which virtual IRQ should be sent
  *  @virq:     Virtual IRQ number (VIRQ_*)
  */
-void send_guest_vcpu_virq(struct vcpu *v, int virq);
+void send_guest_vcpu_virq(struct vcpu *v, uint32_t virq);
 
 /*
  * send_global_virq: Notify the domain handling a global VIRQ.
@@ -65,7 +65,7 @@
     struct vcpu *local_vcpu, int port);
 
 /* Query if event channel is in use by the guest */
-int guest_enabled_event(struct vcpu *v, int virq);
+int guest_enabled_event(struct vcpu *v, uint32_t virq);
 
 /* Notify remote end of a Xen-attached event channel.*/
 void notify_via_xen_event_channel(struct domain *ld, int lport);

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:41 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7Y-0006rQ-6m; Fri, 03 Feb 2012 21:56:40 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7W-0006kT-Hy
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:38 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-27.messagelabs.com!1328306169!51504028!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27190 invoked from network); 3 Feb 2012 21:56:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7P-0001kR-7N
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:31 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7O-0002Wb-AL
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:31 +0000
Message-Id: <E1RtR7O-0002Wb-AL@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:29 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: use XSM instead of IS_PRIV for
	getdomaininfo
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327758545 0
# Node ID 926e0820d615d7224f22a44deb8bbf4ebf078cf0
# Parent  1025acf332ded1a14ef44a813d13bc0595ac5386
xen: use XSM instead of IS_PRIV for getdomaininfo

The XEN_DOMCTL_getdomaininfo domctl does not allow manipulation of
domains, only basic information such as size and state, so its use
does not fully justify making a domain privileged. XSM modules can
also provide fine-grained control over what domains are visible to
domains that call getdomaininfo.

If XSM is disabled (either at compile time or by using the dummy XSM
module) then there is no change in behavior: only IS_PRIV domains can
use this domctl. If enabled, the XSM module controls access.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 1025acf332de -r 926e0820d615 xen/common/domctl.c
--- a/xen/common/domctl.c	Sat Jan 28 13:48:34 2012 +0000
+++ b/xen/common/domctl.c	Sat Jan 28 13:49:05 2012 +0000
@@ -264,6 +264,10 @@
             return -EPERM;
         break;
     }
+#ifdef XSM_ENABLE
+    case XEN_DOMCTL_getdomaininfo:
+        break;
+#endif
     default:
         if ( !IS_PRIV(current->domain) )
             return -EPERM;
diff -r 1025acf332de -r 926e0820d615 xen/xsm/dummy.c
--- a/xen/xsm/dummy.c	Sat Jan 28 13:48:34 2012 +0000
+++ b/xen/xsm/dummy.c	Sat Jan 28 13:49:05 2012 +0000
@@ -66,6 +66,8 @@
 
 static int dummy_getdomaininfo (struct domain *d)
 {
+    if ( !IS_PRIV(current->domain) )
+        return -EPERM;
     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 Feb 03 21:56:41 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7Y-0006rQ-6m; Fri, 03 Feb 2012 21:56:40 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7W-0006kT-Hy
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:38 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-27.messagelabs.com!1328306169!51504028!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27190 invoked from network); 3 Feb 2012 21:56:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7P-0001kR-7N
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:31 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7O-0002Wb-AL
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:31 +0000
Message-Id: <E1RtR7O-0002Wb-AL@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:29 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: use XSM instead of IS_PRIV for
	getdomaininfo
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327758545 0
# Node ID 926e0820d615d7224f22a44deb8bbf4ebf078cf0
# Parent  1025acf332ded1a14ef44a813d13bc0595ac5386
xen: use XSM instead of IS_PRIV for getdomaininfo

The XEN_DOMCTL_getdomaininfo domctl does not allow manipulation of
domains, only basic information such as size and state, so its use
does not fully justify making a domain privileged. XSM modules can
also provide fine-grained control over what domains are visible to
domains that call getdomaininfo.

If XSM is disabled (either at compile time or by using the dummy XSM
module) then there is no change in behavior: only IS_PRIV domains can
use this domctl. If enabled, the XSM module controls access.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 1025acf332de -r 926e0820d615 xen/common/domctl.c
--- a/xen/common/domctl.c	Sat Jan 28 13:48:34 2012 +0000
+++ b/xen/common/domctl.c	Sat Jan 28 13:49:05 2012 +0000
@@ -264,6 +264,10 @@
             return -EPERM;
         break;
     }
+#ifdef XSM_ENABLE
+    case XEN_DOMCTL_getdomaininfo:
+        break;
+#endif
     default:
         if ( !IS_PRIV(current->domain) )
             return -EPERM;
diff -r 1025acf332de -r 926e0820d615 xen/xsm/dummy.c
--- a/xen/xsm/dummy.c	Sat Jan 28 13:48:34 2012 +0000
+++ b/xen/xsm/dummy.c	Sat Jan 28 13:49:05 2012 +0000
@@ -66,6 +66,8 @@
 
 static int dummy_getdomaininfo (struct domain *d)
 {
+    if ( !IS_PRIV(current->domain) )
+        return -EPERM;
     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 Feb 03 21:56:44 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7c-0006up-NV; Fri, 03 Feb 2012 21:56:44 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7c-0006pO-1T
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:44 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-182.messagelabs.com!1328306196!13640300!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31521 invoked from network); 3 Feb 2012 21:56:37 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:37 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7T-0001kZ-Ow
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:35 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7Q-0002XU-W8
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:34 +0000
Message-Id: <E1RtR7Q-0002XU-W8@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:31 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: Preserve reserved grant entries
	when switching versions
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327758581 0
# Node ID 39df93acd4089eaae138e1decf49aec39fb19417
# Parent  926e0820d615d7224f22a44deb8bbf4ebf078cf0
xen: Preserve reserved grant entries when switching versions

In order for the toolstack to use reserved grant table entries, the
grant table for a guest must be initialized prior to the guest's boot.
When the guest switches grant table versions (necessary if the guest
is using v2 grant tables, or on kexec if switching grant versions),
these initial grants will be cleared. Instead of clearing them,
preserve the grants across the type change.

Attempting to preserve v2-only features such as sub-page grants will
produce a warning and clear the resulting v1 grant entry.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 926e0820d615 -r 39df93acd408 xen/common/grant_table.c
--- a/xen/common/grant_table.c	Sat Jan 28 13:49:05 2012 +0000
+++ b/xen/common/grant_table.c	Sat Jan 28 13:49:41 2012 +0000
@@ -2111,6 +2111,7 @@
     struct domain *d = current->domain;
     struct grant_table *gt = d->grant_table;
     struct active_grant_entry *act;
+    grant_entry_v1_t reserved_entries[GNTTAB_NR_RESERVED_ENTRIES];
     long res;
     int i;
 
@@ -2127,11 +2128,12 @@
 
     spin_lock(&gt->lock);
     /* Make sure that the grant table isn't currently in use when we
-       change the version number. */
-    /* (You need to change the version number for e.g. kexec.) */
+       change the version number, except for the first 8 entries which
+       are allowed to be in use (xenstore/xenconsole keeps them mapped).
+       (You need to change the version number for e.g. kexec.) */
     if ( gt->gt_version != 0 )
     {
-        for ( i = 0; i < nr_grant_entries(gt); i++ )
+        for ( i = GNTTAB_NR_RESERVED_ENTRIES; i < nr_grant_entries(gt); i++ )
         {
             act = &active_entry(gt, i);
             if ( act->pin != 0 )
@@ -2156,15 +2158,55 @@
             goto out_unlock;
     }
 
+    /* Preserve the first 8 entries (toolstack reserved grants) */
+    if ( gt->gt_version == 1 )
+    {
+        memcpy(reserved_entries, &shared_entry_v1(gt, 0), sizeof(reserved_entries));
+    }
+    else if ( gt->gt_version == 2 )
+    {
+        for ( i = 0; i < GNTTAB_NR_RESERVED_ENTRIES && i < nr_grant_entries(gt); i++ )
+        {
+            int flags = status_entry(gt, i);
+            flags |= shared_entry_v2(gt, i).hdr.flags;
+            if ((flags & GTF_type_mask) == GTF_permit_access)
+            {
+                reserved_entries[i].flags = flags;
+                reserved_entries[i].domid = shared_entry_v2(gt, i).hdr.domid;
+                reserved_entries[i].frame = shared_entry_v2(gt, i).full_page.frame;
+            }
+            else
+            {
+                if ((flags & GTF_type_mask) != GTF_invalid)
+                    gdprintk(XENLOG_INFO, "d%d: bad flags %x in grant %d when switching grant version\n",
+                           d->domain_id, flags, i);
+                memset(&reserved_entries[i], 0, sizeof(reserved_entries[i]));
+            }
+        }
+    }
+
     if ( op.version < 2 && gt->gt_version == 2 )
         gnttab_unpopulate_status_frames(d, gt);
 
-    if ( op.version != gt->gt_version )
+    /* Make sure there's no crud left over in the table from the
+       old version. */
+    for ( i = 0; i < nr_grant_frames(gt); i++ )
+        memset(gt->shared_raw[i], 0, PAGE_SIZE);
+
+    /* Restore the first 8 entries (toolstack reserved grants) */
+    if ( gt->gt_version != 0 && op.version == 1 )
     {
-        /* Make sure there's no crud left over in the table from the
-           old version. */
-        for ( i = 0; i < nr_grant_frames(gt); i++ )
-            memset(gt->shared_raw[i], 0, PAGE_SIZE);
+        memcpy(&shared_entry_v1(gt, 0), reserved_entries, sizeof(reserved_entries));
+    }
+    else if ( gt->gt_version != 0 && op.version == 2 )
+    {
+        for ( i = 0; i < GNTTAB_NR_RESERVED_ENTRIES; i++ )
+        {
+            status_entry(gt, i) = reserved_entries[i].flags & (GTF_reading|GTF_writing);
+            shared_entry_v2(gt, i).hdr.flags = reserved_entries[i].flags & ~(GTF_reading|GTF_writing);
+            shared_entry_v2(gt, i).hdr.domid = reserved_entries[i].domid;
+            shared_entry_v2(gt, i).full_page.frame = reserved_entries[i].frame;
+        }
     }
 
     gt->gt_version = op.version;
diff -r 926e0820d615 -r 39df93acd408 xen/include/public/grant_table.h
--- a/xen/include/public/grant_table.h	Sat Jan 28 13:49:05 2012 +0000
+++ b/xen/include/public/grant_table.h	Sat Jan 28 13:49:41 2012 +0000
@@ -117,6 +117,13 @@
 };
 typedef struct grant_entry_v1 grant_entry_v1_t;
 
+/* The first few grant table entries will be preserved across grant table
+ * version changes and may be pre-populated at domain creation by tools.
+ */
+#define GNTTAB_NR_RESERVED_ENTRIES     8
+#define GNTTAB_RESERVED_CONSOLE        0
+#define GNTTAB_RESERVED_XENSTORE       1
+
 /*
  * Type of grant entry.
  *  GTF_invalid: This grant entry grants no privileges.

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:44 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7c-0006up-NV; Fri, 03 Feb 2012 21:56:44 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7c-0006pO-1T
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:44 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-182.messagelabs.com!1328306196!13640300!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31521 invoked from network); 3 Feb 2012 21:56:37 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:37 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7T-0001kZ-Ow
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:35 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7Q-0002XU-W8
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:34 +0000
Message-Id: <E1RtR7Q-0002XU-W8@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:31 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: Preserve reserved grant entries
	when switching versions
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327758581 0
# Node ID 39df93acd4089eaae138e1decf49aec39fb19417
# Parent  926e0820d615d7224f22a44deb8bbf4ebf078cf0
xen: Preserve reserved grant entries when switching versions

In order for the toolstack to use reserved grant table entries, the
grant table for a guest must be initialized prior to the guest's boot.
When the guest switches grant table versions (necessary if the guest
is using v2 grant tables, or on kexec if switching grant versions),
these initial grants will be cleared. Instead of clearing them,
preserve the grants across the type change.

Attempting to preserve v2-only features such as sub-page grants will
produce a warning and clear the resulting v1 grant entry.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 926e0820d615 -r 39df93acd408 xen/common/grant_table.c
--- a/xen/common/grant_table.c	Sat Jan 28 13:49:05 2012 +0000
+++ b/xen/common/grant_table.c	Sat Jan 28 13:49:41 2012 +0000
@@ -2111,6 +2111,7 @@
     struct domain *d = current->domain;
     struct grant_table *gt = d->grant_table;
     struct active_grant_entry *act;
+    grant_entry_v1_t reserved_entries[GNTTAB_NR_RESERVED_ENTRIES];
     long res;
     int i;
 
@@ -2127,11 +2128,12 @@
 
     spin_lock(&gt->lock);
     /* Make sure that the grant table isn't currently in use when we
-       change the version number. */
-    /* (You need to change the version number for e.g. kexec.) */
+       change the version number, except for the first 8 entries which
+       are allowed to be in use (xenstore/xenconsole keeps them mapped).
+       (You need to change the version number for e.g. kexec.) */
     if ( gt->gt_version != 0 )
     {
-        for ( i = 0; i < nr_grant_entries(gt); i++ )
+        for ( i = GNTTAB_NR_RESERVED_ENTRIES; i < nr_grant_entries(gt); i++ )
         {
             act = &active_entry(gt, i);
             if ( act->pin != 0 )
@@ -2156,15 +2158,55 @@
             goto out_unlock;
     }
 
+    /* Preserve the first 8 entries (toolstack reserved grants) */
+    if ( gt->gt_version == 1 )
+    {
+        memcpy(reserved_entries, &shared_entry_v1(gt, 0), sizeof(reserved_entries));
+    }
+    else if ( gt->gt_version == 2 )
+    {
+        for ( i = 0; i < GNTTAB_NR_RESERVED_ENTRIES && i < nr_grant_entries(gt); i++ )
+        {
+            int flags = status_entry(gt, i);
+            flags |= shared_entry_v2(gt, i).hdr.flags;
+            if ((flags & GTF_type_mask) == GTF_permit_access)
+            {
+                reserved_entries[i].flags = flags;
+                reserved_entries[i].domid = shared_entry_v2(gt, i).hdr.domid;
+                reserved_entries[i].frame = shared_entry_v2(gt, i).full_page.frame;
+            }
+            else
+            {
+                if ((flags & GTF_type_mask) != GTF_invalid)
+                    gdprintk(XENLOG_INFO, "d%d: bad flags %x in grant %d when switching grant version\n",
+                           d->domain_id, flags, i);
+                memset(&reserved_entries[i], 0, sizeof(reserved_entries[i]));
+            }
+        }
+    }
+
     if ( op.version < 2 && gt->gt_version == 2 )
         gnttab_unpopulate_status_frames(d, gt);
 
-    if ( op.version != gt->gt_version )
+    /* Make sure there's no crud left over in the table from the
+       old version. */
+    for ( i = 0; i < nr_grant_frames(gt); i++ )
+        memset(gt->shared_raw[i], 0, PAGE_SIZE);
+
+    /* Restore the first 8 entries (toolstack reserved grants) */
+    if ( gt->gt_version != 0 && op.version == 1 )
     {
-        /* Make sure there's no crud left over in the table from the
-           old version. */
-        for ( i = 0; i < nr_grant_frames(gt); i++ )
-            memset(gt->shared_raw[i], 0, PAGE_SIZE);
+        memcpy(&shared_entry_v1(gt, 0), reserved_entries, sizeof(reserved_entries));
+    }
+    else if ( gt->gt_version != 0 && op.version == 2 )
+    {
+        for ( i = 0; i < GNTTAB_NR_RESERVED_ENTRIES; i++ )
+        {
+            status_entry(gt, i) = reserved_entries[i].flags & (GTF_reading|GTF_writing);
+            shared_entry_v2(gt, i).hdr.flags = reserved_entries[i].flags & ~(GTF_reading|GTF_writing);
+            shared_entry_v2(gt, i).hdr.domid = reserved_entries[i].domid;
+            shared_entry_v2(gt, i).full_page.frame = reserved_entries[i].frame;
+        }
     }
 
     gt->gt_version = op.version;
diff -r 926e0820d615 -r 39df93acd408 xen/include/public/grant_table.h
--- a/xen/include/public/grant_table.h	Sat Jan 28 13:49:05 2012 +0000
+++ b/xen/include/public/grant_table.h	Sat Jan 28 13:49:41 2012 +0000
@@ -117,6 +117,13 @@
 };
 typedef struct grant_entry_v1 grant_entry_v1_t;
 
+/* The first few grant table entries will be preserved across grant table
+ * version changes and may be pre-populated at domain creation by tools.
+ */
+#define GNTTAB_NR_RESERVED_ENTRIES     8
+#define GNTTAB_RESERVED_CONSOLE        0
+#define GNTTAB_RESERVED_XENSTORE       1
+
 /*
  * Type of grant entry.
  *  GTF_invalid: This grant entry grants no privileges.

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:47 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7e-0006wn-So; Fri, 03 Feb 2012 21:56:46 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7d-0006rH-D7
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:45 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1328306198!13361762!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21536 invoked from network); 3 Feb 2012 21:56:39 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:39 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7W-0001kf-5k
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:38 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7V-0002Yl-04
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:37 +0000
Message-Id: <E1RtR7V-0002Yl-04@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:35 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl:
	domain_death_xswatch_callback: add some debug logging
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327937018 0
# Node ID fe766513739e4b7af461dc042ab90be222956282
# Parent  39df93acd4089eaae138e1decf49aec39fb19417
libxl: domain_death_xswatch_callback: add some debug logging

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


diff -r 39df93acd408 -r fe766513739e tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Sat Jan 28 13:49:41 2012 +0000
+++ b/tools/libxl/libxl.c	Mon Jan 30 15:23:38 2012 +0000
@@ -713,15 +713,28 @@
         }
         gotend = &domaininfos[rc];
 
+        LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, "[evg=%p:%"PRIu32"]"
+                   " from domid=%"PRIu32" nentries=%d rc=%d",
+                   evg, evg->domid, domid, nentries, rc);
+
         for (;;) {
-            if (!evg)
+            if (!evg) {
+                LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, "[evg=0] all reported");
                 goto all_reported;
+            }
+
+            LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, "[evg=%p:%"PRIu32"]"
+                       "   got=domaininfos[%d] got->domain=%ld",
+                       evg, evg->domid, (int)(got - domaininfos),
+                       got < gotend ? (long)got->domain : -1L);
 
             if (!rc || got->domain > evg->domid) {
                 /* ie, the list doesn't contain evg->domid any more so
                  * the domain has been destroyed */
                 libxl_evgen_domain_death *evg_next;
 
+                LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, " destroyed");
+
                 libxl_event *ev = NEW_EVENT(egc, DOMAIN_DESTROY, evg->domid);
                 if (!ev) goto out;
 
@@ -736,8 +749,10 @@
                 continue;
             }
             
-            if (got == gotend)
+            if (got == gotend) {
+                LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, " got==gotend");
                 break;
+            }
 
             if (got->domain < evg->domid) {
                 got++;
@@ -745,12 +760,17 @@
             }
 
             assert(evg->domid == got->domain);
+            LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, " exists shutdown_reported=%d"
+                       " dominf.flags=%x",
+                       evg->shutdown_reported, got->flags);
 
             if (!evg->shutdown_reported &&
                 (got->flags & XEN_DOMINF_shutdown)) {
                 libxl_event *ev = NEW_EVENT(egc, DOMAIN_SHUTDOWN, got->domain);
                 if (!ev) goto out;
                 
+                LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, " shutdown reporting");
+
                 ev->u.domain_shutdown.shutdown_reason =
                     (got->flags >> XEN_DOMINF_shutdownshift) &
                     XEN_DOMINF_shutdownmask;
@@ -767,6 +787,8 @@
  all_reported:
  out:
 
+    LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, "domain death search done");
+
     CTX_UNLOCK;
 }
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:47 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7e-0006wn-So; Fri, 03 Feb 2012 21:56:46 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7d-0006rH-D7
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:45 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1328306198!13361762!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21536 invoked from network); 3 Feb 2012 21:56:39 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:39 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7W-0001kf-5k
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:38 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7V-0002Yl-04
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:37 +0000
Message-Id: <E1RtR7V-0002Yl-04@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:35 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl:
	domain_death_xswatch_callback: add some debug logging
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327937018 0
# Node ID fe766513739e4b7af461dc042ab90be222956282
# Parent  39df93acd4089eaae138e1decf49aec39fb19417
libxl: domain_death_xswatch_callback: add some debug logging

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


diff -r 39df93acd408 -r fe766513739e tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Sat Jan 28 13:49:41 2012 +0000
+++ b/tools/libxl/libxl.c	Mon Jan 30 15:23:38 2012 +0000
@@ -713,15 +713,28 @@
         }
         gotend = &domaininfos[rc];
 
+        LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, "[evg=%p:%"PRIu32"]"
+                   " from domid=%"PRIu32" nentries=%d rc=%d",
+                   evg, evg->domid, domid, nentries, rc);
+
         for (;;) {
-            if (!evg)
+            if (!evg) {
+                LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, "[evg=0] all reported");
                 goto all_reported;
+            }
+
+            LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, "[evg=%p:%"PRIu32"]"
+                       "   got=domaininfos[%d] got->domain=%ld",
+                       evg, evg->domid, (int)(got - domaininfos),
+                       got < gotend ? (long)got->domain : -1L);
 
             if (!rc || got->domain > evg->domid) {
                 /* ie, the list doesn't contain evg->domid any more so
                  * the domain has been destroyed */
                 libxl_evgen_domain_death *evg_next;
 
+                LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, " destroyed");
+
                 libxl_event *ev = NEW_EVENT(egc, DOMAIN_DESTROY, evg->domid);
                 if (!ev) goto out;
 
@@ -736,8 +749,10 @@
                 continue;
             }
             
-            if (got == gotend)
+            if (got == gotend) {
+                LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, " got==gotend");
                 break;
+            }
 
             if (got->domain < evg->domid) {
                 got++;
@@ -745,12 +760,17 @@
             }
 
             assert(evg->domid == got->domain);
+            LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, " exists shutdown_reported=%d"
+                       " dominf.flags=%x",
+                       evg->shutdown_reported, got->flags);
 
             if (!evg->shutdown_reported &&
                 (got->flags & XEN_DOMINF_shutdown)) {
                 libxl_event *ev = NEW_EVENT(egc, DOMAIN_SHUTDOWN, got->domain);
                 if (!ev) goto out;
                 
+                LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, " shutdown reporting");
+
                 ev->u.domain_shutdown.shutdown_reason =
                     (got->flags >> XEN_DOMINF_shutdownshift) &
                     XEN_DOMINF_shutdownmask;
@@ -767,6 +787,8 @@
  all_reported:
  out:
 
+    LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, "domain death search done");
+
     CTX_UNLOCK;
 }
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:48 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7f-0006xs-VP; Fri, 03 Feb 2012 21:56:47 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7e-0006tl-GZ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:46 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-27.messagelabs.com!1328306131!62530101!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28328 invoked from network); 3 Feb 2012 21:55:32 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:32 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7Y-0001kj-Rf
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:40 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7W-0002ZW-MY
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:40 +0000
Message-Id: <E1RtR7W-0002ZW-MY@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:38 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: treat "dying" domains as
	destroyed
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327937019 0
# Node ID f31d8d1b534eab54178c2a73112562d46bbd6fcb
# Parent  fe766513739e4b7af461dc042ab90be222956282
libxl: treat "dying" domains as destroyed

Rename the DOMAIN_DESTROY event to DOMAIN_DEATH and have it trigger
when the domain goes into the state indicated by the domaininfo flag
"dying".

This fixes a race which could leak a daemonised xl process, which
would have ignored the domain becoming "dying" and would then wait
forever to be told the domain was destroyed.

After the domain becomes "dying" we can't generate an event when it is
actually destroyed because xenstored will eat the relevant
VIRT_DOM_EXC virq and not generate an @releaseDomain, since xenstored
discards its own record of the domain's existence as soon as it sees
the domain "dying" and will not trigger @releaseDomain watches for
domains it knows nothing about.  Arguably this is a bug in xenstored,
and the whole @releaseDomain machinery is rather poor, but let us not
fix that now.

Anyway, xl does not really want to know when the domain is ultimately
destroyed.  It is enough for xl to know that it is on the way out, in
the "dying" state (which leads later to destruction by Xen).

Also fix a bug where domain_death_xswatch_callback might read one
domain beyond the valid data in its domaininfos array, by correctly
ordering the checks for empty domain list, end of domain list, and our
domain being missing.

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


diff -r fe766513739e -r f31d8d1b534e tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Mon Jan 30 15:23:38 2012 +0000
+++ b/tools/libxl/libxl.c	Mon Jan 30 15:23:39 2012 +0000
@@ -685,6 +685,30 @@
     return ret;
 }
 
+static void domain_death_occurred(libxl__egc *egc,
+                                  libxl_evgen_domain_death **evg_upd,
+                                  const char *why) {
+    /* Removes **evg_upd from death_list and puts it on death_reported
+     * and advances *evg_upd to the next entry.
+     * Call sites in domain_death_xswatch_callback must use "continue". */
+    EGC_GC;
+    libxl_evgen_domain_death *const evg = *evg_upd;
+
+    LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, "%s", why);
+
+    libxl_evgen_domain_death *evg_next = LIBXL_TAILQ_NEXT(evg, entry);
+    *evg_upd = evg_next;
+
+    libxl_event *ev = NEW_EVENT(egc, DOMAIN_DEATH, evg->domid);
+    if (!ev) return;
+
+    libxl__event_occurred(egc, ev);
+
+    evg->death_reported = 1;
+    LIBXL_TAILQ_REMOVE(&CTX->death_list, evg, entry);
+    LIBXL_TAILQ_INSERT_HEAD(&CTX->death_reported, evg, entry);
+}
+
 static void domain_death_xswatch_callback(libxl__egc *egc, libxl__ev_xswatch *w,
                                         const char *wpath, const char *epath) {
     EGC_GC;
@@ -728,32 +752,23 @@
                        evg, evg->domid, (int)(got - domaininfos),
                        got < gotend ? (long)got->domain : -1L);
 
-            if (!rc || got->domain > evg->domid) {
-                /* ie, the list doesn't contain evg->domid any more so
-                 * the domain has been destroyed */
-                libxl_evgen_domain_death *evg_next;
-
-                LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, " destroyed");
-
-                libxl_event *ev = NEW_EVENT(egc, DOMAIN_DESTROY, evg->domid);
-                if (!ev) goto out;
-
-                libxl__event_occurred(egc, ev);
-
-                evg->death_reported = 1;
-                evg_next = LIBXL_TAILQ_NEXT(evg, entry);
-                LIBXL_TAILQ_REMOVE(&CTX->death_list, evg, entry);
-                LIBXL_TAILQ_INSERT_HEAD(&CTX->death_reported, evg, entry);
-                evg = evg_next;
-
+            if (!rc) {
+                domain_death_occurred(egc, &evg, "empty list");
                 continue;
             }
-            
+
             if (got == gotend) {
                 LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, " got==gotend");
                 break;
             }
 
+            if (got->domain > evg->domid) {
+                /* ie, the list doesn't contain evg->domid any more so
+                 * the domain has been destroyed */
+                domain_death_occurred(egc, &evg, "missing from list");
+                continue;
+            }
+
             if (got->domain < evg->domid) {
                 got++;
                 continue;
@@ -764,6 +779,11 @@
                        " dominf.flags=%x",
                        evg->shutdown_reported, got->flags);
 
+            if (got->flags & XEN_DOMINF_dying) {
+                domain_death_occurred(egc, &evg, "dying");
+                continue;
+            }
+
             if (!evg->shutdown_reported &&
                 (got->flags & XEN_DOMINF_shutdown)) {
                 libxl_event *ev = NEW_EVENT(egc, DOMAIN_SHUTDOWN, got->domain);
diff -r fe766513739e -r f31d8d1b534e tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Mon Jan 30 15:23:38 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Mon Jan 30 15:23:39 2012 +0000
@@ -396,7 +396,7 @@
 
 libxl_event_type = Enumeration("event_type", [
     (1, "DOMAIN_SHUTDOWN"),
-    (2, "DOMAIN_DESTROY"),
+    (2, "DOMAIN_DEATH"),
     (3, "DISK_EJECT"),
     (4, "OPERATION_COMPLETE"),
     ])
@@ -417,7 +417,7 @@
           [("domain_shutdown", Struct(None, [
                                              ("shutdown_reason", uint8),
                                       ])),
-           ("domain_destroy", Struct(None, [])),
+           ("domain_death", Struct(None, [])),
            ("disk_eject", Struct(None, [
                                         ("vdev", string),
                                         ("disk", libxl_device_disk),
diff -r fe766513739e -r f31d8d1b534e tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Mon Jan 30 15:23:38 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Mon Jan 30 15:23:39 2012 +0000
@@ -1909,7 +1909,7 @@
                 abort();
             }
 
-        case LIBXL_EVENT_TYPE_DOMAIN_DESTROY:
+        case LIBXL_EVENT_TYPE_DOMAIN_DEATH:
             LOG("Domain %d has been destroyed.", domid);
             ret = 0;
             goto out;
@@ -2445,7 +2445,7 @@
 
             switch (event->type) {
 
-            case LIBXL_EVENT_TYPE_DOMAIN_DESTROY:
+            case LIBXL_EVENT_TYPE_DOMAIN_DEATH:
                 LOG("Domain %d has been destroyed", domid);
                 goto done;
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:48 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7f-0006xs-VP; Fri, 03 Feb 2012 21:56:47 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7e-0006tl-GZ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:46 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-27.messagelabs.com!1328306131!62530101!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28328 invoked from network); 3 Feb 2012 21:55:32 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:32 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7Y-0001kj-Rf
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:40 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7W-0002ZW-MY
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:40 +0000
Message-Id: <E1RtR7W-0002ZW-MY@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:38 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: treat "dying" domains as
	destroyed
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327937019 0
# Node ID f31d8d1b534eab54178c2a73112562d46bbd6fcb
# Parent  fe766513739e4b7af461dc042ab90be222956282
libxl: treat "dying" domains as destroyed

Rename the DOMAIN_DESTROY event to DOMAIN_DEATH and have it trigger
when the domain goes into the state indicated by the domaininfo flag
"dying".

This fixes a race which could leak a daemonised xl process, which
would have ignored the domain becoming "dying" and would then wait
forever to be told the domain was destroyed.

After the domain becomes "dying" we can't generate an event when it is
actually destroyed because xenstored will eat the relevant
VIRT_DOM_EXC virq and not generate an @releaseDomain, since xenstored
discards its own record of the domain's existence as soon as it sees
the domain "dying" and will not trigger @releaseDomain watches for
domains it knows nothing about.  Arguably this is a bug in xenstored,
and the whole @releaseDomain machinery is rather poor, but let us not
fix that now.

Anyway, xl does not really want to know when the domain is ultimately
destroyed.  It is enough for xl to know that it is on the way out, in
the "dying" state (which leads later to destruction by Xen).

Also fix a bug where domain_death_xswatch_callback might read one
domain beyond the valid data in its domaininfos array, by correctly
ordering the checks for empty domain list, end of domain list, and our
domain being missing.

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


diff -r fe766513739e -r f31d8d1b534e tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Mon Jan 30 15:23:38 2012 +0000
+++ b/tools/libxl/libxl.c	Mon Jan 30 15:23:39 2012 +0000
@@ -685,6 +685,30 @@
     return ret;
 }
 
+static void domain_death_occurred(libxl__egc *egc,
+                                  libxl_evgen_domain_death **evg_upd,
+                                  const char *why) {
+    /* Removes **evg_upd from death_list and puts it on death_reported
+     * and advances *evg_upd to the next entry.
+     * Call sites in domain_death_xswatch_callback must use "continue". */
+    EGC_GC;
+    libxl_evgen_domain_death *const evg = *evg_upd;
+
+    LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, "%s", why);
+
+    libxl_evgen_domain_death *evg_next = LIBXL_TAILQ_NEXT(evg, entry);
+    *evg_upd = evg_next;
+
+    libxl_event *ev = NEW_EVENT(egc, DOMAIN_DEATH, evg->domid);
+    if (!ev) return;
+
+    libxl__event_occurred(egc, ev);
+
+    evg->death_reported = 1;
+    LIBXL_TAILQ_REMOVE(&CTX->death_list, evg, entry);
+    LIBXL_TAILQ_INSERT_HEAD(&CTX->death_reported, evg, entry);
+}
+
 static void domain_death_xswatch_callback(libxl__egc *egc, libxl__ev_xswatch *w,
                                         const char *wpath, const char *epath) {
     EGC_GC;
@@ -728,32 +752,23 @@
                        evg, evg->domid, (int)(got - domaininfos),
                        got < gotend ? (long)got->domain : -1L);
 
-            if (!rc || got->domain > evg->domid) {
-                /* ie, the list doesn't contain evg->domid any more so
-                 * the domain has been destroyed */
-                libxl_evgen_domain_death *evg_next;
-
-                LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, " destroyed");
-
-                libxl_event *ev = NEW_EVENT(egc, DOMAIN_DESTROY, evg->domid);
-                if (!ev) goto out;
-
-                libxl__event_occurred(egc, ev);
-
-                evg->death_reported = 1;
-                evg_next = LIBXL_TAILQ_NEXT(evg, entry);
-                LIBXL_TAILQ_REMOVE(&CTX->death_list, evg, entry);
-                LIBXL_TAILQ_INSERT_HEAD(&CTX->death_reported, evg, entry);
-                evg = evg_next;
-
+            if (!rc) {
+                domain_death_occurred(egc, &evg, "empty list");
                 continue;
             }
-            
+
             if (got == gotend) {
                 LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, " got==gotend");
                 break;
             }
 
+            if (got->domain > evg->domid) {
+                /* ie, the list doesn't contain evg->domid any more so
+                 * the domain has been destroyed */
+                domain_death_occurred(egc, &evg, "missing from list");
+                continue;
+            }
+
             if (got->domain < evg->domid) {
                 got++;
                 continue;
@@ -764,6 +779,11 @@
                        " dominf.flags=%x",
                        evg->shutdown_reported, got->flags);
 
+            if (got->flags & XEN_DOMINF_dying) {
+                domain_death_occurred(egc, &evg, "dying");
+                continue;
+            }
+
             if (!evg->shutdown_reported &&
                 (got->flags & XEN_DOMINF_shutdown)) {
                 libxl_event *ev = NEW_EVENT(egc, DOMAIN_SHUTDOWN, got->domain);
diff -r fe766513739e -r f31d8d1b534e tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Mon Jan 30 15:23:38 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Mon Jan 30 15:23:39 2012 +0000
@@ -396,7 +396,7 @@
 
 libxl_event_type = Enumeration("event_type", [
     (1, "DOMAIN_SHUTDOWN"),
-    (2, "DOMAIN_DESTROY"),
+    (2, "DOMAIN_DEATH"),
     (3, "DISK_EJECT"),
     (4, "OPERATION_COMPLETE"),
     ])
@@ -417,7 +417,7 @@
           [("domain_shutdown", Struct(None, [
                                              ("shutdown_reason", uint8),
                                       ])),
-           ("domain_destroy", Struct(None, [])),
+           ("domain_death", Struct(None, [])),
            ("disk_eject", Struct(None, [
                                         ("vdev", string),
                                         ("disk", libxl_device_disk),
diff -r fe766513739e -r f31d8d1b534e tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Mon Jan 30 15:23:38 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Mon Jan 30 15:23:39 2012 +0000
@@ -1909,7 +1909,7 @@
                 abort();
             }
 
-        case LIBXL_EVENT_TYPE_DOMAIN_DESTROY:
+        case LIBXL_EVENT_TYPE_DOMAIN_DEATH:
             LOG("Domain %d has been destroyed.", domid);
             ret = 0;
             goto out;
@@ -2445,7 +2445,7 @@
 
             switch (event->type) {
 
-            case LIBXL_EVENT_TYPE_DOMAIN_DESTROY:
+            case LIBXL_EVENT_TYPE_DOMAIN_DEATH:
                 LOG("Domain %d has been destroyed", domid);
                 goto done;
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:53 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7l-00071a-1t; Fri, 03 Feb 2012 21:56:53 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7k-0006wb-2P
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:52 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-27.messagelabs.com!1328306162!58731772!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 595 invoked from network); 3 Feb 2012 21:56:03 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:03 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7c-0001ks-LI
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:44 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7b-0002af-0c
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:44 +0000
Message-Id: <E1RtR7b-0002af-0c@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:40 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: unify return value in
	nominate and evict
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327925194 -3600
# Node ID 828639c20dcc9f48d155bd99ef6f963484ef7527
# Parent  f31d8d1b534eab54178c2a73112562d46bbd6fcb
xenpaging: unify return value in nominate and evict

Let p2m_mem_paging_nominate and p2m_mem_paging_evict return just one
error number. EINVAL is not very helpful in case of nominate, it can
happen if the pager tries to nominate a ballooned page. In this case the
gfn is not backed by a mfn, the pager can not know that.  Similar with
evict, anything can happen between nominate and evict.

This change helps the pager to decide if the returned error is from the
function itself, or if it happend earlier. In the latter case, it is
most likely fatal and should be handled as such.
nominate and evict return EBUSY, which is supposed to mean
"pager request reached target function, and failed."

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r f31d8d1b534e -r 828639c20dcc xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Mon Jan 30 15:23:39 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Mon Jan 30 13:06:34 2012 +0100
@@ -735,19 +735,17 @@
     p2m_type_t p2mt;
     p2m_access_t a;
     mfn_t mfn;
-    int ret;
+    int ret = -EBUSY;
 
     p2m_lock(p2m);
 
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
 
     /* Check if mfn is valid */
-    ret = -EINVAL;
     if ( !mfn_valid(mfn) )
         goto out;
 
     /* Check p2m type */
-    ret = -EAGAIN;
     if ( !p2m_is_pageable(p2mt) )
         goto out;
 
@@ -799,7 +797,7 @@
     p2m_access_t a;
     mfn_t mfn;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
-    int ret = -EINVAL;
+    int ret = -EBUSY;
 
     p2m_lock(p2m);
 
@@ -812,7 +810,6 @@
     if ( p2mt != p2m_ram_paging_out )
         goto out;
 
-    ret = -EBUSY;
     /* Get the page so it doesn't get modified under Xen's feet */
     page = mfn_to_page(mfn);
     if ( unlikely(!get_page(page, d)) )

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:53 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7l-00071a-1t; Fri, 03 Feb 2012 21:56:53 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7k-0006wb-2P
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:52 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-27.messagelabs.com!1328306162!58731772!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 595 invoked from network); 3 Feb 2012 21:56:03 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:03 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7c-0001ks-LI
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:44 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7b-0002af-0c
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:44 +0000
Message-Id: <E1RtR7b-0002af-0c@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:40 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: unify return value in
	nominate and evict
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1327925194 -3600
# Node ID 828639c20dcc9f48d155bd99ef6f963484ef7527
# Parent  f31d8d1b534eab54178c2a73112562d46bbd6fcb
xenpaging: unify return value in nominate and evict

Let p2m_mem_paging_nominate and p2m_mem_paging_evict return just one
error number. EINVAL is not very helpful in case of nominate, it can
happen if the pager tries to nominate a ballooned page. In this case the
gfn is not backed by a mfn, the pager can not know that.  Similar with
evict, anything can happen between nominate and evict.

This change helps the pager to decide if the returned error is from the
function itself, or if it happend earlier. In the latter case, it is
most likely fatal and should be handled as such.
nominate and evict return EBUSY, which is supposed to mean
"pager request reached target function, and failed."

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r f31d8d1b534e -r 828639c20dcc xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Mon Jan 30 15:23:39 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Mon Jan 30 13:06:34 2012 +0100
@@ -735,19 +735,17 @@
     p2m_type_t p2mt;
     p2m_access_t a;
     mfn_t mfn;
-    int ret;
+    int ret = -EBUSY;
 
     p2m_lock(p2m);
 
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
 
     /* Check if mfn is valid */
-    ret = -EINVAL;
     if ( !mfn_valid(mfn) )
         goto out;
 
     /* Check p2m type */
-    ret = -EAGAIN;
     if ( !p2m_is_pageable(p2mt) )
         goto out;
 
@@ -799,7 +797,7 @@
     p2m_access_t a;
     mfn_t mfn;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
-    int ret = -EINVAL;
+    int ret = -EBUSY;
 
     p2m_lock(p2m);
 
@@ -812,7 +810,6 @@
     if ( p2mt != p2m_ram_paging_out )
         goto out;
 
-    ret = -EBUSY;
     /* Get the page so it doesn't get modified under Xen's feet */
     page = mfn_to_page(mfn);
     if ( unlikely(!get_page(page, d)) )

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:55 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7n-00073P-4d; Fri, 03 Feb 2012 21:56:55 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7l-00071n-OQ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:53 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1328306150!59696067!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13197 invoked from network); 3 Feb 2012 21:55:51 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:51 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7j-0001l9-Hd
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:51 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7g-0002ch-Vv
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:50 +0000
Message-Id: <E1RtR7g-0002ch-Vv@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:47 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/libxc: fix bitmap_alloc usage
	in xc_ia64_send_vcpumap
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328009683 0
# Node ID eabfa0150f1cbc328741676e7e6d95a511585634
# Parent  03fdacb67f2cb76a24fd9517f1b0ea13e83973d2
tools/libxc: fix bitmap_alloc usage in xc_ia64_send_vcpumap

Changeset 23577:607474aeefe1 introduced an error in
xc_ia64_send_vcpumap(), bitmap_alloc() was not used correctly.

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


diff -r 03fdacb67f2c -r eabfa0150f1c tools/libxc/ia64/xc_ia64_linux_save.c
--- a/tools/libxc/ia64/xc_ia64_linux_save.c	Tue Jan 31 11:33:35 2012 +0000
+++ b/tools/libxc/ia64/xc_ia64_linux_save.c	Tue Jan 31 11:34:43 2012 +0000
@@ -195,8 +195,8 @@
     uint64_t *vcpumap = NULL;
 
     vcpumap_size = bitmap_size(max_virt_cpus);
-    rc = bitmap_alloc(&vcpumap, max_virt_cpus);
-    if (rc < 0) {
+    vcpumap = bitmap_alloc(max_virt_cpus);
+    if (!vcpumap) {
         ERROR("memory alloc for vcpumap");
         goto out;
     }

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:55 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7n-00073P-4d; Fri, 03 Feb 2012 21:56:55 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7l-00071n-OQ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:53 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1328306150!59696067!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13197 invoked from network); 3 Feb 2012 21:55:51 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:51 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7j-0001l9-Hd
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:51 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7g-0002ch-Vv
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:50 +0000
Message-Id: <E1RtR7g-0002ch-Vv@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:47 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/libxc: fix bitmap_alloc usage
	in xc_ia64_send_vcpumap
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328009683 0
# Node ID eabfa0150f1cbc328741676e7e6d95a511585634
# Parent  03fdacb67f2cb76a24fd9517f1b0ea13e83973d2
tools/libxc: fix bitmap_alloc usage in xc_ia64_send_vcpumap

Changeset 23577:607474aeefe1 introduced an error in
xc_ia64_send_vcpumap(), bitmap_alloc() was not used correctly.

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


diff -r 03fdacb67f2c -r eabfa0150f1c tools/libxc/ia64/xc_ia64_linux_save.c
--- a/tools/libxc/ia64/xc_ia64_linux_save.c	Tue Jan 31 11:33:35 2012 +0000
+++ b/tools/libxc/ia64/xc_ia64_linux_save.c	Tue Jan 31 11:34:43 2012 +0000
@@ -195,8 +195,8 @@
     uint64_t *vcpumap = NULL;
 
     vcpumap_size = bitmap_size(max_virt_cpus);
-    rc = bitmap_alloc(&vcpumap, max_virt_cpus);
-    if (rc < 0) {
+    vcpumap = bitmap_alloc(max_virt_cpus);
+    if (!vcpumap) {
         ERROR("memory alloc for vcpumap");
         goto out;
     }

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:57 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7p-000750-7l; Fri, 03 Feb 2012 21:56:57 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7n-0006zd-EI
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:55 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-182.messagelabs.com!1328306207!13667576!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16905 invoked from network); 3 Feb 2012 21:56:48 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:48 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7f-0001kz-AZ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:47 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7d-0002bW-8x
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:46 +0000
Message-Id: <E1RtR7d-0002bW-8x@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:44 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mini-os: convert mlock macros to C
	functions
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328009615 0
# Node ID 03fdacb67f2cb76a24fd9517f1b0ea13e83973d2
# Parent  828639c20dcc9f48d155bd99ef6f963484ef7527
mini-os: convert mlock macros to C functions

mlock and munlock are implemented as macros in mini-os. Their usage
requires casting in common code.  Convert them to C syntax and provide
an empty dummy function.  Remove the now unneeded (void) cast from two
munlock calls.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---


diff -r 828639c20dcc -r 03fdacb67f2c extras/mini-os/include/posix/sys/mman.h
--- a/extras/mini-os/include/posix/sys/mman.h	Mon Jan 30 13:06:34 2012 +0100
+++ b/extras/mini-os/include/posix/sys/mman.h	Tue Jan 31 11:33:35 2012 +0000
@@ -16,7 +16,7 @@
 
 void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) asm("mmap64");
 int munmap(void *start, size_t length);
-#define munlock(addr, len) ((void)(addr), (void)(len), 0)
-#define mlock(addr, len) ((void)(addr), (void)(len), 0)
+static inline mlock(const void *addr, size_t len) { return 0; }
+static inline munlock(const void *addr, size_t len) { return 0; }
 
 #endif /* _POSIX_SYS_MMAN_H */
diff -r 828639c20dcc -r 03fdacb67f2c tools/libxc/xc_linux_osdep.c
--- a/tools/libxc/xc_linux_osdep.c	Mon Jan 30 13:06:34 2012 +0100
+++ b/tools/libxc/xc_linux_osdep.c	Tue Jan 31 11:33:35 2012 +0000
@@ -106,7 +106,7 @@
 
 static void linux_privcmd_free_hypercall_buffer(xc_interface *xch, xc_osdep_handle h, void *ptr, int npages)
 {
-    (void) munlock(ptr, npages * XC_PAGE_SIZE);
+    munlock(ptr, npages * XC_PAGE_SIZE);
     free(ptr);
 }
 
diff -r 828639c20dcc -r 03fdacb67f2c tools/libxc/xc_mem_paging.c
--- a/tools/libxc/xc_mem_paging.c	Mon Jan 30 13:06:34 2012 +0100
+++ b/tools/libxc/xc_mem_paging.c	Tue Jan 31 11:33:35 2012 +0000
@@ -87,7 +87,7 @@
                                 buffer, NULL, gfn);
 
     old_errno = errno;
-    (void) munlock(buffer, XC_PAGE_SIZE);
+    munlock(buffer, XC_PAGE_SIZE);
     errno = old_errno;
 
     return rc;

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:56:57 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:56:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR7p-000750-7l; Fri, 03 Feb 2012 21:56:57 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7n-0006zd-EI
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:55 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-182.messagelabs.com!1328306207!13667576!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16905 invoked from network); 3 Feb 2012 21:56:48 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:48 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7f-0001kz-AZ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:47 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7d-0002bW-8x
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:46 +0000
Message-Id: <E1RtR7d-0002bW-8x@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:44 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mini-os: convert mlock macros to C
	functions
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328009615 0
# Node ID 03fdacb67f2cb76a24fd9517f1b0ea13e83973d2
# Parent  828639c20dcc9f48d155bd99ef6f963484ef7527
mini-os: convert mlock macros to C functions

mlock and munlock are implemented as macros in mini-os. Their usage
requires casting in common code.  Convert them to C syntax and provide
an empty dummy function.  Remove the now unneeded (void) cast from two
munlock calls.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---


diff -r 828639c20dcc -r 03fdacb67f2c extras/mini-os/include/posix/sys/mman.h
--- a/extras/mini-os/include/posix/sys/mman.h	Mon Jan 30 13:06:34 2012 +0100
+++ b/extras/mini-os/include/posix/sys/mman.h	Tue Jan 31 11:33:35 2012 +0000
@@ -16,7 +16,7 @@
 
 void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) asm("mmap64");
 int munmap(void *start, size_t length);
-#define munlock(addr, len) ((void)(addr), (void)(len), 0)
-#define mlock(addr, len) ((void)(addr), (void)(len), 0)
+static inline mlock(const void *addr, size_t len) { return 0; }
+static inline munlock(const void *addr, size_t len) { return 0; }
 
 #endif /* _POSIX_SYS_MMAN_H */
diff -r 828639c20dcc -r 03fdacb67f2c tools/libxc/xc_linux_osdep.c
--- a/tools/libxc/xc_linux_osdep.c	Mon Jan 30 13:06:34 2012 +0100
+++ b/tools/libxc/xc_linux_osdep.c	Tue Jan 31 11:33:35 2012 +0000
@@ -106,7 +106,7 @@
 
 static void linux_privcmd_free_hypercall_buffer(xc_interface *xch, xc_osdep_handle h, void *ptr, int npages)
 {
-    (void) munlock(ptr, npages * XC_PAGE_SIZE);
+    munlock(ptr, npages * XC_PAGE_SIZE);
     free(ptr);
 }
 
diff -r 828639c20dcc -r 03fdacb67f2c tools/libxc/xc_mem_paging.c
--- a/tools/libxc/xc_mem_paging.c	Mon Jan 30 13:06:34 2012 +0100
+++ b/tools/libxc/xc_mem_paging.c	Tue Jan 31 11:33:35 2012 +0000
@@ -87,7 +87,7 @@
                                 buffer, NULL, gfn);
 
     old_errno = errno;
-    (void) munlock(buffer, XC_PAGE_SIZE);
+    munlock(buffer, XC_PAGE_SIZE);
     errno = old_errno;
 
     return rc;

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:09 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR81-0007BU-Ay; Fri, 03 Feb 2012 21:57:09 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7z-00077x-Gh
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:07 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-182.messagelabs.com!1328306219!13586087!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11985 invoked from network); 3 Feb 2012 21:57:00 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:00 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7r-0001lN-3N
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:59 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7l-0002eR-Pd
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:56 +0000
Message-Id: <E1RtR7l-0002eR-Pd@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:51 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/libxc: remove volatile keyword
	for bitmap operations
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328009707 0
# Node ID a056dcc72ed840b576a6f94973c11261acd841e3
# Parent  eabfa0150f1cbc328741676e7e6d95a511585634
tools/libxc: remove volatile keyword for bitmap operations

All bitmaps maintained by xc_bitops.h are used in single threaded
applications. So nothing will change the bitmaps content, adding
volatile adds just unneeded memory reloads.

xenpaging uses bitmaps alot and using non-volatile versions will
slightly improve performance.

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


diff -r eabfa0150f1c -r a056dcc72ed8 tools/libxc/xc_bitops.h
--- a/tools/libxc/xc_bitops.h	Tue Jan 31 11:34:43 2012 +0000
+++ b/tools/libxc/xc_bitops.h	Tue Jan 31 11:35:07 2012 +0000
@@ -31,29 +31,29 @@
     memset(addr, 0, bitmap_size(nr_bits));
 }
 
-static inline int test_bit(int nr, volatile unsigned long *addr)
+static inline int test_bit(int nr, unsigned long *addr)
 {
     return (BITMAP_ENTRY(nr, addr) >> BITMAP_SHIFT(nr)) & 1;
 }
 
-static inline void clear_bit(int nr, volatile unsigned long *addr)
+static inline void clear_bit(int nr, unsigned long *addr)
 {
     BITMAP_ENTRY(nr, addr) &= ~(1UL << BITMAP_SHIFT(nr));
 }
 
-static inline void set_bit(int nr, volatile unsigned long *addr)
+static inline void set_bit(int nr, unsigned long *addr)
 {
     BITMAP_ENTRY(nr, addr) |= (1UL << BITMAP_SHIFT(nr));
 }
 
-static inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
+static inline int test_and_clear_bit(int nr, unsigned long *addr)
 {
     int oldbit = test_bit(nr, addr);
     clear_bit(nr, addr);
     return oldbit;
 }
 
-static inline int test_and_set_bit(int nr, volatile unsigned long *addr)
+static inline int test_and_set_bit(int nr, unsigned long *addr)
 {
     int oldbit = test_bit(nr, addr);
     set_bit(nr, addr);

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:09 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR81-0007BU-Ay; Fri, 03 Feb 2012 21:57:09 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7z-00077x-Gh
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:07 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-182.messagelabs.com!1328306219!13586087!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11985 invoked from network); 3 Feb 2012 21:57:00 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:00 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7r-0001lN-3N
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:59 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7l-0002eR-Pd
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:56:56 +0000
Message-Id: <E1RtR7l-0002eR-Pd@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:51 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/libxc: remove volatile keyword
	for bitmap operations
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328009707 0
# Node ID a056dcc72ed840b576a6f94973c11261acd841e3
# Parent  eabfa0150f1cbc328741676e7e6d95a511585634
tools/libxc: remove volatile keyword for bitmap operations

All bitmaps maintained by xc_bitops.h are used in single threaded
applications. So nothing will change the bitmaps content, adding
volatile adds just unneeded memory reloads.

xenpaging uses bitmaps alot and using non-volatile versions will
slightly improve performance.

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


diff -r eabfa0150f1c -r a056dcc72ed8 tools/libxc/xc_bitops.h
--- a/tools/libxc/xc_bitops.h	Tue Jan 31 11:34:43 2012 +0000
+++ b/tools/libxc/xc_bitops.h	Tue Jan 31 11:35:07 2012 +0000
@@ -31,29 +31,29 @@
     memset(addr, 0, bitmap_size(nr_bits));
 }
 
-static inline int test_bit(int nr, volatile unsigned long *addr)
+static inline int test_bit(int nr, unsigned long *addr)
 {
     return (BITMAP_ENTRY(nr, addr) >> BITMAP_SHIFT(nr)) & 1;
 }
 
-static inline void clear_bit(int nr, volatile unsigned long *addr)
+static inline void clear_bit(int nr, unsigned long *addr)
 {
     BITMAP_ENTRY(nr, addr) &= ~(1UL << BITMAP_SHIFT(nr));
 }
 
-static inline void set_bit(int nr, volatile unsigned long *addr)
+static inline void set_bit(int nr, unsigned long *addr)
 {
     BITMAP_ENTRY(nr, addr) |= (1UL << BITMAP_SHIFT(nr));
 }
 
-static inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
+static inline int test_and_clear_bit(int nr, unsigned long *addr)
 {
     int oldbit = test_bit(nr, addr);
     clear_bit(nr, addr);
     return oldbit;
 }
 
-static inline int test_and_set_bit(int nr, volatile unsigned long *addr)
+static inline int test_and_set_bit(int nr, unsigned long *addr)
 {
     int oldbit = test_bit(nr, addr);
     set_bit(nr, addr);

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:11 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:11 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR83-0007D7-Dd; Fri, 03 Feb 2012 21:57:11 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR81-00079O-LR
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:09 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1328306222!13897055!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 931 invoked from network); 3 Feb 2012 21:57:03 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:03 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7u-0001lx-G0
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:02 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7s-0002gP-DW
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:01 +0000
Message-Id: <E1RtR7s-0002gP-DW@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:59 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] public/physdev.h: Fix
	__XEN_INTERFACE_VERSION__ typo.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328009823 0
# Node ID 6ddc2937b0416596f85765e7d3c6a8db9bba6f76
# Parent  a056dcc72ed840b576a6f94973c11261acd841e3
public/physdev.h: Fix __XEN_INTERFACE_VERSION__ typo.

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


diff -r a056dcc72ed8 -r 6ddc2937b041 xen/include/public/physdev.h
--- a/xen/include/public/physdev.h	Tue Jan 31 11:35:07 2012 +0000
+++ b/xen/include/public/physdev.h	Tue Jan 31 11:37:03 2012 +0000
@@ -333,7 +333,7 @@
 #define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY XENIRQSTAT_needs_eoi
 #define PHYSDEVOP_IRQ_SHARED             XENIRQSTAT_shared
 
-#if __XEN_INTERFACE_VERSION < 0x00040200
+#if __XEN_INTERFACE_VERSION__ < 0x00040200
 #define PHYSDEVOP_pirq_eoi_gmfn PHYSDEVOP_pirq_eoi_gmfn_v1
 #else
 #define PHYSDEVOP_pirq_eoi_gmfn PHYSDEVOP_pirq_eoi_gmfn_v2

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:11 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:11 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR83-0007D7-Dd; Fri, 03 Feb 2012 21:57:11 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR81-00079O-LR
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:09 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1328306222!13897055!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 931 invoked from network); 3 Feb 2012 21:57:03 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:03 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7u-0001lx-G0
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:02 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7s-0002gP-DW
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:01 +0000
Message-Id: <E1RtR7s-0002gP-DW@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:56:59 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] public/physdev.h: Fix
	__XEN_INTERFACE_VERSION__ typo.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328009823 0
# Node ID 6ddc2937b0416596f85765e7d3c6a8db9bba6f76
# Parent  a056dcc72ed840b576a6f94973c11261acd841e3
public/physdev.h: Fix __XEN_INTERFACE_VERSION__ typo.

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


diff -r a056dcc72ed8 -r 6ddc2937b041 xen/include/public/physdev.h
--- a/xen/include/public/physdev.h	Tue Jan 31 11:35:07 2012 +0000
+++ b/xen/include/public/physdev.h	Tue Jan 31 11:37:03 2012 +0000
@@ -333,7 +333,7 @@
 #define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY XENIRQSTAT_needs_eoi
 #define PHYSDEVOP_IRQ_SHARED             XENIRQSTAT_shared
 
-#if __XEN_INTERFACE_VERSION < 0x00040200
+#if __XEN_INTERFACE_VERSION__ < 0x00040200
 #define PHYSDEVOP_pirq_eoi_gmfn PHYSDEVOP_pirq_eoi_gmfn_v1
 #else
 #define PHYSDEVOP_pirq_eoi_gmfn PHYSDEVOP_pirq_eoi_gmfn_v2

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:12 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR84-0007EL-If; Fri, 03 Feb 2012 21:57:12 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR82-00079r-Qi
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-174.messagelabs.com!1328306223!11764518!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=2.0 required=7.0 tests=SUBJECT_RANDOMQ
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25674 invoked from network); 3 Feb 2012 21:57:04 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:04 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7v-0001m0-Fr
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:03 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7v-0002hJ-37
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:03 +0000
Message-Id: <E1RtR7v-0002hJ-37@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:02 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: do not remap pirqs if
	!is_hvm_pv_evtchn_domain
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328009977 0
# Node ID 6c9a7381777031600ef3442a578d0fa3ce1491b2
# Parent  6ddc2937b0416596f85765e7d3c6a8db9bba6f76
xen: do not remap pirqs if !is_hvm_pv_evtchn_domain

If the guest is an HVM guest and it is not using the vector callback
mechanism, refuse to remap pirqs onto event channels.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Tested-by: Paulian Bogdan Marinca <paulian@marinca.net>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 6ddc2937b041 -r 6c9a73817770 xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c	Tue Jan 31 11:37:03 2012 +0000
+++ b/xen/arch/x86/physdev.c	Tue Jan 31 11:39:37 2012 +0000
@@ -93,6 +93,15 @@
 
     if ( domid == DOMID_SELF && is_hvm_domain(d) )
     {
+        /*
+         * Only makes sense for vector-based callback, else HVM-IRQ logic
+         * calls back into itself and deadlocks on hvm_domain.irq_lock.
+         */
+        if ( !is_hvm_pv_evtchn_domain(d) )
+        {
+            ret = -EINVAL;
+            goto free_domain;
+        }
         ret = physdev_hvm_map_pirq(d, type, index, pirq_p);
         goto free_domain;
     }

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:12 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR84-0007EL-If; Fri, 03 Feb 2012 21:57:12 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR82-00079r-Qi
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-174.messagelabs.com!1328306223!11764518!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=2.0 required=7.0 tests=SUBJECT_RANDOMQ
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25674 invoked from network); 3 Feb 2012 21:57:04 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:04 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7v-0001m0-Fr
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:03 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7v-0002hJ-37
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:03 +0000
Message-Id: <E1RtR7v-0002hJ-37@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:02 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: do not remap pirqs if
	!is_hvm_pv_evtchn_domain
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328009977 0
# Node ID 6c9a7381777031600ef3442a578d0fa3ce1491b2
# Parent  6ddc2937b0416596f85765e7d3c6a8db9bba6f76
xen: do not remap pirqs if !is_hvm_pv_evtchn_domain

If the guest is an HVM guest and it is not using the vector callback
mechanism, refuse to remap pirqs onto event channels.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Tested-by: Paulian Bogdan Marinca <paulian@marinca.net>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 6ddc2937b041 -r 6c9a73817770 xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c	Tue Jan 31 11:37:03 2012 +0000
+++ b/xen/arch/x86/physdev.c	Tue Jan 31 11:39:37 2012 +0000
@@ -93,6 +93,15 @@
 
     if ( domid == DOMID_SELF && is_hvm_domain(d) )
     {
+        /*
+         * Only makes sense for vector-based callback, else HVM-IRQ logic
+         * calls back into itself and deadlocks on hvm_domain.irq_lock.
+         */
+        if ( !is_hvm_pv_evtchn_domain(d) )
+        {
+            ret = -EINVAL;
+            goto free_domain;
+        }
         ret = physdev_hvm_map_pirq(d, type, index, pirq_p);
         goto free_domain;
     }

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8E-0007Ku-MO; Fri, 03 Feb 2012 21:57:22 +0000
Received: from mail6.bemta14.messagelabs.com ([193.109.254.103])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8C-0007Jn-GO
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:21 +0000
Received: from [193.109.254.147:46791] by server-4.bemta-14.messagelabs.com id
	E3/1D-04726-F385C2F4; Fri, 03 Feb 2012 21:57:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1328306183!51337678!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG, UPPERCASE_25_50
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16419 invoked from network); 3 Feb 2012 21:56:24 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR84-0001m8-DV
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7z-0002id-LS
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:11 +0000
Message-Id: <E1RtR7z-0002id-LS@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:03 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mini-os: use BSD sys/queue.h instead
	of Linux list.h
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328025974 0
# Node ID 934c14ab9f19330c91e2769beb96ac6896b2a1c8
# Parent  6c9a7381777031600ef3442a578d0fa3ce1491b2
mini-os: use BSD sys/queue.h instead of Linux list.h

The latter is GPL which makes the whole of mini-os GPL rather than BSD
as intended. In tree users are all GPL or GPL-compatible but we should
fix this so that mini-os is BSD. Do so by using the same BSD
sys/queue.h as we use in libxl.

Tested with the builtin mini-os test app and qemu stubdomain, both of which
appear to still function as expected.

Move tools/libxl/external and the associated sed script to
tools/include/xen-external to allow more sensible access from mini-os.

Also add s/NULL/0/ in the sed script due to NULL not always being
defined in stubdom code when mini-os/wait.h is included.

As well as the obvious ABI changes there are a few API updates
associated with the change:

  - struct rw_semaphore.wait_list is unused
  - remove_waiter needs to take the wait_queue_head

The latter requires a qemu update, so there is also a QEMU_TAG
update in this changeset.

I sprinkled some extra-emacs local variables around the files I edited
which didn't have them.

I think this should be backported to the stable branches since
external users of mini-os may have been mislead into thinking they
could safely link mini-os against GPL-incompatible code.

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


diff -r 6c9a73817770 -r 934c14ab9f19 .hgignore
--- a/.hgignore	Tue Jan 31 11:39:37 2012 +0000
+++ b/.hgignore	Tue Jan 31 16:06:14 2012 +0000
@@ -62,6 +62,7 @@
 ^docs/xen-api/xenapi-datamodel-graph.eps$
 ^docs/xen-api/xenapi.out$
 ^extras/mini-os/arch/ia64/gen_off.s$
+^extras/mini-os/include/list\.h$
 ^extras/mini-os/include/mini-os$
 ^extras/mini-os/include/ia64/mini-os$
 ^extras/mini-os/include/ia64/offsets.h$
diff -r 6c9a73817770 -r 934c14ab9f19 Config.mk
--- a/Config.mk	Tue Jan 31 11:39:37 2012 +0000
+++ b/Config.mk	Tue Jan 31 16:06:14 2012 +0000
@@ -222,9 +222,9 @@
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= bb36d632e4cabf47882adff07a45c6702c4a5b30
-# Thu Jan 5 17:16:46 2012 +0000
-# qemu-xen: adjust MSI-X related log messages
+QEMU_TAG ?= de05447400930da4be216e4fb0fe52b8be81490e
+# Tue Jan 31 15:42:38 2012 +0000
+# block-vbd: update to new mini-os wait queue API (new linked list API)
 
 # Short answer -- do not enable this unless you know what you are
 # doing and are prepared for some pain.
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/Makefile
--- a/extras/mini-os/Makefile	Tue Jan 31 11:39:37 2012 +0000
+++ b/extras/mini-os/Makefile	Tue Jan 31 16:06:14 2012 +0000
@@ -52,8 +52,12 @@
 	$(arch_links)
 endif
 
+include/list.h: $(XEN_ROOT)/tools/include/xen-external/bsd-sys-queue-h-seddery $(XEN_ROOT)/tools/include/xen-external/bsd-sys-queue.h
+	perl $^ --prefix=minios  >$@.new
+	$(call move-if-changed,$@.new,$@)
+
 .PHONY: links
-links:	$(ARCH_LINKS)
+links: include/list.h $(ARCH_LINKS)
 	[ -e include/xen ] || ln -sf ../../../xen/include/public include/xen
 	[ -e include/mini-os ] || ln -sf . include/mini-os
 	[ -e include/$(TARGET_ARCH_FAM)/mini-os ] || ln -sf . include/$(TARGET_ARCH_FAM)/mini-os
@@ -97,7 +101,7 @@
 APP_O=$(OBJ_DIR)/$(TARGET)_app.o 
 endif
 
-$(OBJ_DIR)/$(TARGET): links $(OBJS) $(APP_O) arch_lib
+$(OBJ_DIR)/$(TARGET): links include/list.h $(OBJS) $(APP_O) arch_lib
 	$(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(APP_O) $(OBJS) $(LDARCHLIB) $(LDLIBS) -o $@.o
 	$(OBJCOPY) -w -G $(GLOBAL_PREFIX)* -G _start $@.o $@.o
 	$(LD) $(LDFLAGS) $(LDFLAGS_FINAL) $@.o $(EXTRA_OBJS) -o $@
@@ -112,6 +116,7 @@
 	for dir in $(addprefix $(OBJ_DIR)/,$(SUBDIRS)); do \
 		rm -f $$dir/*.o; \
 	done
+	rm -f include/list.h
 	rm -f $(OBJ_DIR)/*.o *~ $(OBJ_DIR)/core $(OBJ_DIR)/$(TARGET).elf $(OBJ_DIR)/$(TARGET).raw $(OBJ_DIR)/$(TARGET) $(OBJ_DIR)/$(TARGET).gz
 	find . $(OBJ_DIR) -type l | xargs rm -f
 	$(RM) $(OBJ_DIR)/lwip.a $(LWO)
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c	Tue Jan 31 11:39:37 2012 +0000
+++ b/extras/mini-os/blkfront.c	Tue Jan 31 16:06:14 2012 +0000
@@ -323,7 +323,7 @@
 	    schedule();
 	    local_irq_save(flags);
 	}
-	remove_waiter(w);
+	remove_waiter(w, blkfront_queue);
 	local_irq_restore(flags);
     }
 }
@@ -414,7 +414,7 @@
 	schedule();
 	local_irq_save(flags);
     }
-    remove_waiter(w);
+    remove_waiter(w, blkfront_queue);
     local_irq_restore(flags);
 }
 
@@ -470,7 +470,7 @@
 	schedule();
 	local_irq_save(flags);
     }
-    remove_waiter(w);
+    remove_waiter(w, blkfront_queue);
     local_irq_restore(flags);
 }
 
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/fbfront.c
--- a/extras/mini-os/fbfront.c	Tue Jan 31 11:39:37 2012 +0000
+++ b/extras/mini-os/fbfront.c	Tue Jan 31 16:06:14 2012 +0000
@@ -569,7 +569,7 @@
     add_waiter(w, fbfront_queue);
     while (page->out_prod - page->out_cons == XENFB_OUT_RING_LEN)
         schedule();
-    remove_waiter(w);
+    remove_waiter(w, fbfront_queue);
 
     prod = page->out_prod;
     mb(); /* ensure ring space available */
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/include/list.h
--- a/extras/mini-os/include/list.h	Tue Jan 31 11:39:37 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,190 +0,0 @@
-#ifndef _LINUX_LIST_H
-#define _LINUX_LIST_H
-
-/*
- * Simple doubly linked list implementation.
- *
- * Some of the internal functions ("__xxx") are useful when
- * manipulating whole lists rather than single entries, as
- * sometimes we already know the next/prev entries and we can
- * generate better code by using them directly rather than
- * using the generic single-entry routines.
- */
-
-struct minios_list_head {
-	struct minios_list_head *next, *prev;
-};
-
-#define MINIOS_LIST_HEAD_INIT(name) { &(name), &(name) }
-
-#define MINIOS_LIST_HEAD(name) \
-	struct minios_list_head name = MINIOS_LIST_HEAD_INIT(name)
-
-#define MINIOS_INIT_LIST_HEAD(ptr) do { \
-	(ptr)->next = (ptr); (ptr)->prev = (ptr); \
-} while (0)
-
-#define minios_list_top(head, type, member)					  \
-({ 									  \
-	struct minios_list_head *_head = (head);				  \
-	minios_list_empty(_head) ? NULL : minios_list_entry(_head->next, type, member); \
-})
-
-/*
- * Insert a new entry between two known consecutive entries. 
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static __inline__ void __minios_list_add(struct minios_list_head * new,
-	struct minios_list_head * prev,
-	struct minios_list_head * next)
-{
-	next->prev = new;
-	new->next = next;
-	new->prev = prev;
-	prev->next = new;
-}
-
-/**
- * minios_list_add - add a new entry
- * @new: new entry to be added
- * @head: list head to add it after
- *
- * Insert a new entry after the specified head.
- * This is good for implementing stacks.
- */
-static __inline__ void minios_list_add(struct minios_list_head *new, struct minios_list_head *head)
-{
-	__minios_list_add(new, head, head->next);
-}
-
-/**
- * minios_list_add_tail - add a new entry
- * @new: new entry to be added
- * @head: list head to add it before
- *
- * Insert a new entry before the specified head.
- * This is useful for implementing queues.
- */
-static __inline__ void minios_list_add_tail(struct minios_list_head *new, struct minios_list_head *head)
-{
-	__minios_list_add(new, head->prev, head);
-}
-
-/*
- * Delete a list entry by making the prev/next entries
- * point to each other.
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static __inline__ void __minios_list_del(struct minios_list_head * prev,
-				  struct minios_list_head * next)
-{
-	next->prev = prev;
-	prev->next = next;
-}
-
-/**
- * minios_list_del - deletes entry from list.
- * @entry: the element to delete from the list.
- * Note: minios_list_empty on entry does not return true after this, the entry is in an undefined state.
- */
-static __inline__ void minios_list_del(struct minios_list_head *entry)
-{
-	__minios_list_del(entry->prev, entry->next);
-}
-
-/**
- * minios_list_del_init - deletes entry from list and reinitialize it.
- * @entry: the element to delete from the list.
- */
-static __inline__ void minios_list_del_init(struct minios_list_head *entry)
-{
-	__minios_list_del(entry->prev, entry->next);
-	MINIOS_INIT_LIST_HEAD(entry); 
-}
-
-/**
- * minios_list_empty - tests whether a list is empty
- * @head: the list to test.
- */
-static __inline__ int minios_list_empty(struct minios_list_head *head)
-{
-	return head->next == head;
-}
-
-/**
- * minios_list_splice - join two lists
- * @list: the new list to add.
- * @head: the place to add it in the first list.
- */
-static __inline__ void minios_list_splice(struct minios_list_head *list, struct minios_list_head *head)
-{
-	struct minios_list_head *first = list->next;
-
-	if (first != list) {
-		struct minios_list_head *last = list->prev;
-		struct minios_list_head *at = head->next;
-
-		first->prev = head;
-		head->next = first;
-
-		last->next = at;
-		at->prev = last;
-	}
-}
-
-/**
- * minios_list_entry - get the struct for this entry
- * @ptr:	the &struct minios_list_head pointer.
- * @type:	the type of the struct this is embedded in.
- * @member:	the name of the minios_list_struct within the struct.
- */
-#define minios_list_entry(ptr, type, member) \
-	((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
-
-/**
- * minios_list_for_each	-	iterate over a list
- * @pos:	the &struct minios_list_head to use as a loop counter.
- * @head:	the head for your list.
- */
-#define minios_list_for_each(pos, head) \
-	for (pos = (head)->next; pos != (head); pos = pos->next)
-        	
-/**
- * minios_list_for_each_safe	-	iterate over a list safe against removal of list entry
- * @pos:	the &struct minios_list_head to use as a loop counter.
- * @n:		another &struct minios_list_head to use as temporary storage
- * @head:	the head for your list.
- */
-#define minios_list_for_each_safe(pos, n, head) \
-	for (pos = (head)->next, n = pos->next; pos != (head); \
-		pos = n, n = pos->next)
-
-/**
- * minios_list_for_each_entry	-	iterate over list of given type
- * @pos:	the type * to use as a loop counter.
- * @head:	the head for your list.
- * @member:	the name of the minios_list_struct within the struct.
- */
-#define minios_list_for_each_entry(pos, head, member)				\
-	for (pos = minios_list_entry((head)->next, typeof(*pos), member);	\
-	     &pos->member != (head); 					\
-	     pos = minios_list_entry(pos->member.next, typeof(*pos), member))
-
-/**
- * minios_list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
- * @pos:	the type * to use as a loop counter.
- * @n:		another type * to use as temporary storage
- * @head:	the head for your list.
- * @member:	the name of the minios_list_struct within the struct.
- */
-#define minios_list_for_each_entry_safe(pos, n, head, member)			\
-	for (pos = minios_list_entry((head)->next, typeof(*pos), member),	\
-		n = minios_list_entry(pos->member.next, typeof(*pos), member);	\
-	     &pos->member != (head); 					\
-	     pos = n, n = minios_list_entry(n->member.next, typeof(*n), member))
-#endif /* _LINUX_LIST_H */
-
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/include/sched.h
--- a/extras/mini-os/include/sched.h	Tue Jan 31 11:39:37 2012 +0000
+++ b/extras/mini-os/include/sched.h	Tue Jan 31 16:06:14 2012 +0000
@@ -19,7 +19,7 @@
 #else /* !defined(__ia64__) */
     thread_regs_t regs;
 #endif /* !defined(__ia64__) */
-    struct minios_list_head thread_list;
+    MINIOS_TAILQ_ENTRY(struct thread) thread_list;
     uint32_t flags;
     s_time_t wakeup_time;
 #ifdef HAVE_LIBC
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/include/semaphore.h
--- a/extras/mini-os/include/semaphore.h	Tue Jan 31 11:39:37 2012 +0000
+++ b/extras/mini-os/include/semaphore.h	Tue Jan 31 16:06:14 2012 +0000
@@ -21,7 +21,6 @@
 struct rw_semaphore {
 	signed long		count;
 	spinlock_t		wait_lock;
-	struct minios_list_head	wait_list;
 	int			debug;
 };
 
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/include/wait.h
--- a/extras/mini-os/include/wait.h	Tue Jan 31 11:39:37 2012 +0000
+++ b/extras/mini-os/include/wait.h	Tue Jan 31 16:06:14 2012 +0000
@@ -5,47 +5,47 @@
 #include <mini-os/os.h>
 #include <mini-os/waittypes.h>
 
-#define DEFINE_WAIT(name)                               \
-struct wait_queue name = {                              \
-    .thread       = get_current(),                            \
-    .thread_list  = MINIOS_LIST_HEAD_INIT((name).thread_list), \
+#define DEFINE_WAIT(name)                          \
+struct wait_queue name = {                         \
+    .thread       = get_current(),                 \
+    .waiting      = 0,                             \
 }
 
 
 static inline void init_waitqueue_head(struct wait_queue_head *h)
 {
-  MINIOS_INIT_LIST_HEAD(&h->thread_list);
+    MINIOS_STAILQ_INIT(h);
 }
 
 static inline void init_waitqueue_entry(struct wait_queue *q, struct thread *thread)
 {
     q->thread = thread;
-    MINIOS_INIT_LIST_HEAD(&q->thread_list);
+    q->waiting = 0;
 }
 
-
 static inline void add_wait_queue(struct wait_queue_head *h, struct wait_queue *q)
 {
-    if (minios_list_empty(&q->thread_list))
-        minios_list_add(&q->thread_list, &h->thread_list);   
+    if (!q->waiting) {
+        MINIOS_STAILQ_INSERT_HEAD(h, q, thread_list);
+        q->waiting = 1;
+    }
 }
 
-static inline void remove_wait_queue(struct wait_queue *q)
+static inline void remove_wait_queue(struct wait_queue_head *h, struct wait_queue *q)
 {
-    minios_list_del(&q->thread_list);
+    if (q->waiting) {
+        MINIOS_STAILQ_REMOVE(h, q, struct wait_queue, thread_list);
+        q->waiting = 0;
+    }
 }
 
 static inline void wake_up(struct wait_queue_head *head)
 {
     unsigned long flags;
-    struct minios_list_head *tmp, *next;
+    struct wait_queue *curr, *tmp;
     local_irq_save(flags);
-    minios_list_for_each_safe(tmp, next, &head->thread_list)
-    {
-         struct wait_queue *curr;
-         curr = minios_list_entry(tmp, struct wait_queue, thread_list);
+    MINIOS_STAILQ_FOREACH_SAFE(curr, head, thread_list, tmp)
          wake(curr->thread);
-    }
     local_irq_restore(flags);
 }
 
@@ -57,11 +57,11 @@
     local_irq_restore(flags);   \
 } while (0)
 
-#define remove_waiter(w) do {   \
-    unsigned long flags;        \
-    local_irq_save(flags);      \
-    remove_wait_queue(&w);      \
-    local_irq_restore(flags);   \
+#define remove_waiter(w, wq) do {  \
+    unsigned long flags;           \
+    local_irq_save(flags);         \
+    remove_wait_queue(&wq, &w);    \
+    local_irq_restore(flags);      \
 } while (0)
 
 #define wait_event_deadline(wq, condition, deadline) do {       \
@@ -84,7 +84,7 @@
     local_irq_save(flags);                                      \
     /* need to wake up */                                       \
     wake(get_current());                                        \
-    remove_wait_queue(&__wait);                                 \
+    remove_wait_queue(&wq, &__wait);                            \
     local_irq_restore(flags);                                   \
 } while(0) 
 
@@ -93,3 +93,13 @@
 
 
 #endif /* __WAIT_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/include/waittypes.h
--- a/extras/mini-os/include/waittypes.h	Tue Jan 31 11:39:37 2012 +0000
+++ b/extras/mini-os/include/waittypes.h	Tue Jan 31 16:06:14 2012 +0000
@@ -6,21 +6,27 @@
 struct thread;
 struct wait_queue
 {
+    int waiting;
     struct thread *thread;
-    struct minios_list_head thread_list;
+    MINIOS_STAILQ_ENTRY(struct wait_queue) thread_list;
 };
 
-struct wait_queue_head
-{
-    /* TODO - lock required? */
-    struct minios_list_head thread_list;
-};
+/* TODO - lock required? */
+MINIOS_STAILQ_HEAD(wait_queue_head, struct wait_queue);
 
 #define DECLARE_WAIT_QUEUE_HEAD(name) \
-   struct wait_queue_head name =     \
-        { .thread_list = { &(name).thread_list, &(name).thread_list} }
+    struct wait_queue_head name = MINIOS_STAILQ_HEAD_INITIALIZER(name)
 
-#define __WAIT_QUEUE_HEAD_INITIALIZER(name) {                           \
-    .thread_list      = { &(name).thread_list, &(name).thread_list } }
+#define __WAIT_QUEUE_HEAD_INITIALIZER(name) MINIOS_STAILQ_HEAD_INITIALIZER(name)
 
 #endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/lib/sys.c
--- a/extras/mini-os/lib/sys.c	Tue Jan 31 11:39:37 2012 +0000
+++ b/extras/mini-os/lib/sys.c	Tue Jan 31 16:06:14 2012 +0000
@@ -234,7 +234,7 @@
                     break;
                 schedule();
             }
-            remove_waiter(w);
+            remove_waiter(w, console_queue);
             return ret;
         }
 #ifdef HAVE_LWIP
@@ -705,12 +705,12 @@
     fd_set myread, mywrite, myexcept;
     struct thread *thread = get_current();
     s_time_t start = NOW(), stop;
-    DEFINE_WAIT(w1);
-    DEFINE_WAIT(w2);
-    DEFINE_WAIT(w3);
-    DEFINE_WAIT(w4);
-    DEFINE_WAIT(w5);
-    DEFINE_WAIT(w6);
+    DEFINE_WAIT(netfront_w);
+    DEFINE_WAIT(event_w);
+    DEFINE_WAIT(blkfront_w);
+    DEFINE_WAIT(xenbus_watch_w);
+    DEFINE_WAIT(kbdfront_w);
+    DEFINE_WAIT(console_w);
 
     assert(thread == main_thread);
 
@@ -727,12 +727,12 @@
     /* Tell people we're going to sleep before looking at what they are
      * saying, hence letting them wake us if events happen between here and
      * schedule() */
-    add_waiter(w1, netfront_queue);
-    add_waiter(w2, event_queue);
-    add_waiter(w3, blkfront_queue);
-    add_waiter(w4, xenbus_watch_queue);
-    add_waiter(w5, kbdfront_queue);
-    add_waiter(w6, console_queue);
+    add_waiter(netfront_w, netfront_queue);
+    add_waiter(event_w, event_queue);
+    add_waiter(blkfront_w, blkfront_queue);
+    add_waiter(xenbus_watch_w, xenbus_watch_queue);
+    add_waiter(kbdfront_w, kbdfront_queue);
+    add_waiter(console_w, console_queue);
 
     if (readfds)
         myread = *readfds;
@@ -814,12 +814,12 @@
     ret = -1;
 
 out:
-    remove_waiter(w1);
-    remove_waiter(w2);
-    remove_waiter(w3);
-    remove_waiter(w4);
-    remove_waiter(w5);
-    remove_waiter(w6);
+    remove_waiter(netfront_w, netfront_queue);
+    remove_waiter(event_w, event_queue);
+    remove_waiter(blkfront_w, blkfront_queue);
+    remove_waiter(xenbus_watch_w, xenbus_watch_queue);
+    remove_waiter(kbdfront_w, kbdfront_queue);
+    remove_waiter(console_w, console_queue);
     return ret;
 }
 
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/lib/xmalloc.c
--- a/extras/mini-os/lib/xmalloc.c	Tue Jan 31 11:39:37 2012 +0000
+++ b/extras/mini-os/lib/xmalloc.c	Tue Jan 31 16:06:14 2012 +0000
@@ -44,16 +44,18 @@
 #include <mini-os/xmalloc.h>
 
 #ifndef HAVE_LIBC
-static MINIOS_LIST_HEAD(freelist);
 /* static spinlock_t freelist_lock = SPIN_LOCK_UNLOCKED; */
 
 struct xmalloc_hdr
 {
     /* Total including this hdr, unused padding and second hdr. */
     size_t size;
-    struct minios_list_head freelist;
+    MINIOS_TAILQ_ENTRY(struct xmalloc_hdr) freelist;
 } __cacheline_aligned;
 
+static MINIOS_TAILQ_HEAD(,struct xmalloc_hdr) freelist =
+	MINIOS_TAILQ_HEAD_INITIALIZER(freelist);
+
 /* Unused padding data between the two hdrs. */
 
 struct xmalloc_pad
@@ -82,7 +84,7 @@
         extra = (struct xmalloc_hdr *)((unsigned long)hdr + size);
         extra->size = leftover;
         /* spin_lock_irqsave(&freelist_lock, flags); */
-        minios_list_add(&extra->freelist, &freelist);
+        MINIOS_TAILQ_INSERT_HEAD(&freelist, extra, freelist);
         /* spin_unlock_irqrestore(&freelist_lock, flags); */
     }
     else
@@ -91,8 +93,6 @@
     }
 
     hdr->size = size;
-    /* Debugging aid. */
-    hdr->freelist.next = hdr->freelist.prev = NULL;
 }
 
 static struct xmalloc_hdr *xmalloc_new_page(size_t size)
@@ -128,8 +128,6 @@
         return NULL;
 
     hdr->size = (1UL << (pageorder + PAGE_SHIFT));
-    /* Debugging aid. */
-    hdr->freelist.next = hdr->freelist.prev = NULL;
 
     ret = (char*)hdr + hdr_size;
     pad = (struct xmalloc_pad *) ret - 1;
@@ -155,14 +153,14 @@
 
     /* Search free list. */
     /* spin_lock_irqsave(&freelist_lock, flags); */
-    minios_list_for_each_entry_safe( i, tmp, &freelist, freelist )
+    MINIOS_TAILQ_FOREACH_SAFE(i, &freelist, freelist, tmp)
     {
         data_begin = align_up((uintptr_t)i + hdr_size, align);
 
         if ( data_begin + size > (uintptr_t)i + i->size )
             continue;
 
-        minios_list_del(&i->freelist);
+        MINIOS_TAILQ_REMOVE(&freelist, i, freelist);
         /* spin_unlock_irqrestore(&freelist_lock, flags); */
 
         uintptr_t size_before = (data_begin - hdr_size) - (uintptr_t)i;
@@ -173,7 +171,7 @@
             new_i->size = i->size - size_before;
             i->size = size_before;
             /* spin_lock_irqsave(&freelist_lock, flags); */
-            minios_list_add(&i->freelist, &freelist);
+            MINIOS_TAILQ_INSERT_HEAD(&freelist, i, freelist);
             /* spin_unlock_irqrestore(&freelist_lock, flags); */
             i = new_i;
         }
@@ -224,16 +222,9 @@
         *(int*)0=0;
     }
 
-    /* Not previously freed. */
-    if(hdr->freelist.next || hdr->freelist.prev)
-    {
-        printk("Should not be previously freed\n");
-        *(int*)0=0;
-    }
-
     /* Merge with other free block, or put in list. */
     /* spin_lock_irqsave(&freelist_lock, flags); */
-    minios_list_for_each_entry_safe( i, tmp, &freelist, freelist )
+    MINIOS_TAILQ_FOREACH_SAFE(i, &freelist, freelist, tmp)
     {
         unsigned long _i   = (unsigned long)i;
         unsigned long _hdr = (unsigned long)hdr;
@@ -245,7 +236,7 @@
         /* We follow this block?  Swallow it. */
         if ( (_i + i->size) == _hdr )
         {
-            minios_list_del(&i->freelist);
+            MINIOS_TAILQ_REMOVE(&freelist, i, freelist);
             i->size += hdr->size;
             hdr = i;
         }
@@ -253,7 +244,7 @@
         /* We precede this block? Swallow it. */
         if ( (_hdr + hdr->size) == _i )
         {
-            minios_list_del(&i->freelist);
+            MINIOS_TAILQ_REMOVE(&freelist, i, freelist);
             hdr->size += i->size;
         }
     }
@@ -270,7 +261,7 @@
     }
     else
     {
-        minios_list_add(&hdr->freelist, &freelist);
+        MINIOS_TAILQ_INSERT_HEAD(&freelist, hdr, freelist);
     }
 
     /* spin_unlock_irqrestore(&freelist_lock, flags); */
@@ -306,3 +297,13 @@
     return new;
 }
 #endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/sched.c
--- a/extras/mini-os/sched.c	Tue Jan 31 11:39:37 2012 +0000
+++ b/extras/mini-os/sched.c	Tue Jan 31 16:06:14 2012 +0000
@@ -54,19 +54,20 @@
 #define DEBUG(_f, _a...)    ((void)0)
 #endif
 
+MINIOS_TAILQ_HEAD(thread_list, struct thread);
+
 struct thread *idle_thread = NULL;
-MINIOS_LIST_HEAD(exited_threads);
+static struct thread_list exited_threads = MINIOS_TAILQ_HEAD_INITIALIZER(exited_threads);
+static struct thread_list thread_list = MINIOS_TAILQ_HEAD_INITIALIZER(thread_list);
 static int threads_started;
 
 struct thread *main_thread;
 
 void inline print_runqueue(void)
 {
-    struct minios_list_head *it;
     struct thread *th;
-    minios_list_for_each(it, &idle_thread->thread_list)
+    MINIOS_TAILQ_FOREACH(th, &thread_list, thread_list)
     {
-        th = minios_list_entry(it, struct thread, thread_list);
         printk("   Thread \"%s\", runnable=%d\n", th->name, is_runnable(th));
     }
     printk("\n");
@@ -74,8 +75,7 @@
 
 void schedule(void)
 {
-    struct thread *prev, *next, *thread;
-    struct minios_list_head *iterator, *next_iterator;
+    struct thread *prev, *next, *thread, *tmp;
     unsigned long flags;
 
     prev = current;
@@ -96,10 +96,9 @@
            time when the next timeout expires, else use 10 seconds. */
         s_time_t now = NOW();
         s_time_t min_wakeup_time = now + SECONDS(10);
-        next = NULL;   
-        minios_list_for_each_safe(iterator, next_iterator, &idle_thread->thread_list)
+        next = NULL;
+        MINIOS_TAILQ_FOREACH_SAFE(thread, &thread_list, thread_list, tmp)
         {
-            thread = minios_list_entry(iterator, struct thread, thread_list);
             if (!is_runnable(thread) && thread->wakeup_time != 0LL)
             {
                 if (thread->wakeup_time <= now)
@@ -111,8 +110,8 @@
             {
                 next = thread;
                 /* Put this thread on the end of the list */
-                minios_list_del(&thread->thread_list);
-                minios_list_add_tail(&thread->thread_list, &idle_thread->thread_list);
+                MINIOS_TAILQ_REMOVE(&thread_list, thread, thread_list);
+                MINIOS_TAILQ_INSERT_TAIL(&thread_list, thread, thread_list);
                 break;
             }
         }
@@ -128,12 +127,11 @@
        inturrupted at the return instruction. And therefore at safe point. */
     if(prev != next) switch_threads(prev, next);
 
-    minios_list_for_each_safe(iterator, next_iterator, &exited_threads)
+    MINIOS_TAILQ_FOREACH_SAFE(thread, &exited_threads, thread_list, tmp)
     {
-        thread = minios_list_entry(iterator, struct thread, thread_list);
         if(thread != prev)
         {
-            minios_list_del(&thread->thread_list);
+            MINIOS_TAILQ_REMOVE(&exited_threads, thread, thread_list);
             free_pages(thread->stack, STACK_SIZE_PAGE_ORDER);
             xfree(thread);
         }
@@ -154,13 +152,7 @@
 #endif
     set_runnable(thread);
     local_irq_save(flags);
-    if(idle_thread != NULL) {
-        minios_list_add_tail(&thread->thread_list, &idle_thread->thread_list); 
-    } else if(function != idle_thread_fn)
-    {
-        printk("BUG: Not allowed to create thread before initialising scheduler.\n");
-        BUG();
-    }
+    MINIOS_TAILQ_INSERT_TAIL(&thread_list, thread, thread_list);
     local_irq_restore(flags);
     return thread;
 }
@@ -208,10 +200,10 @@
     printk("Thread \"%s\" exited.\n", thread->name);
     local_irq_save(flags);
     /* Remove from the thread list */
-    minios_list_del(&thread->thread_list);
+    MINIOS_TAILQ_REMOVE(&thread_list, thread, thread_list);
     clear_runnable(thread);
     /* Put onto exited list */
-    minios_list_add(&thread->thread_list, &exited_threads);
+    MINIOS_TAILQ_INSERT_HEAD(&exited_threads, thread, thread_list);
     local_irq_restore(flags);
     /* Schedule will free the resources */
     while(1)
@@ -296,6 +288,14 @@
     _REENT_INIT_PTR((&callback_reent))
 #endif
     idle_thread = create_thread("Idle", idle_thread_fn, NULL);
-    MINIOS_INIT_LIST_HEAD(&idle_thread->thread_list);
 }
 
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/xenbus/xenbus.c
--- a/extras/mini-os/xenbus/xenbus.c	Tue Jan 31 11:39:37 2012 +0000
+++ b/extras/mini-os/xenbus/xenbus.c	Tue Jan 31 16:06:14 2012 +0000
@@ -85,7 +85,7 @@
         add_waiter(w, xenbus_watch_queue);
         schedule();
     }
-    remove_waiter(w);
+    remove_waiter(w, xenbus_watch_queue);
     *queue = event->next;
     return &event->path;
 }
@@ -441,7 +441,7 @@
     xb_write(type, id, trans, io, nr_reqs);
 
     schedule();
-    remove_waiter(w);
+    remove_waiter(w, req_info[id].waitq);
     wake(current);
 
     rep = req_info[id].reply;
diff -r 6c9a73817770 -r 934c14ab9f19 tools/include/xen-external/README
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/include/xen-external/README	Tue Jan 31 16:06:14 2012 +0000
@@ -0,0 +1,24 @@
+WARNING - DO NOT EDIT THINGS IN THIS DIRECTORY
+----------------------------------------------
+
+These files were obtained elsewhere and should only be updated by
+copying new versions from the source location, as documented below:
+
+bsd-COPYRIGHT
+bsd-sys-queue.h
+bsd-queue.3
+
+  Obtained from the FreeBSD SVN using the following commands:
+    svn co -r 221843 svn://svn.freebsd.org/base/head/sys/sys/
+    svn co -r 221843 svn://svn.freebsd.org/base/head/share/man/man3
+    svn cat -r 221843 http://svn.freebsd.org/base/head/COPYRIGHT >tools/libxl/external/bsd-COPYRIGHT
+
+Exceptions:
+
+README
+
+  This file
+
+bsd-sys-queue-h-seddery
+
+  Script to transform the above into a new namespace.
diff -r 6c9a73817770 -r 934c14ab9f19 tools/include/xen-external/bsd-COPYRIGHT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/include/xen-external/bsd-COPYRIGHT	Tue Jan 31 16:06:14 2012 +0000
@@ -0,0 +1,126 @@
+# $FreeBSD$
+#	@(#)COPYRIGHT	8.2 (Berkeley) 3/21/94
+
+The compilation of software known as FreeBSD is distributed under the
+following terms:
+
+Copyright (c) 1992-2011 The FreeBSD Project. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+The 4.4BSD and 4.4BSD-Lite software is distributed under the following
+terms:
+
+All of the documentation and software included in the 4.4BSD and 4.4BSD-Lite
+Releases is copyrighted by The Regents of the University of California.
+
+Copyright 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
+	The Regents of the University of California.  All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. All advertising materials mentioning features or use of this software
+   must display the following acknowledgement:
+This product includes software developed by the University of
+California, Berkeley and its contributors.
+4. Neither the name of the University nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+The Institute of Electrical and Electronics Engineers and the American
+National Standards Committee X3, on Information Processing Systems have
+given us permission to reprint portions of their documentation.
+
+In the following statement, the phrase ``this text'' refers to portions
+of the system documentation.
+
+Portions of this text are reprinted and reproduced in electronic form in
+the second BSD Networking Software Release, from IEEE Std 1003.1-1988, IEEE
+Standard Portable Operating System Interface for Computer Environments
+(POSIX), copyright C 1988 by the Institute of Electrical and Electronics
+Engineers, Inc.  In the event of any discrepancy between these versions
+and the original IEEE Standard, the original IEEE Standard is the referee
+document.
+
+In the following statement, the phrase ``This material'' refers to portions
+of the system documentation.
+
+This material is reproduced with permission from American National
+Standards Committee X3, on Information Processing Systems.  Computer and
+Business Equipment Manufacturers Association (CBEMA), 311 First St., NW,
+Suite 500, Washington, DC 20001-2178.  The developmental work of
+Programming Language C was completed by the X3J11 Technical Committee.
+
+The views and conclusions contained in the software and documentation are
+those of the authors and should not be interpreted as representing official
+policies, either expressed or implied, of the Regents of the University
+of California.
+
+
+NOTE: The copyright of UC Berkeley's Berkeley Software Distribution ("BSD")
+source has been updated.  The copyright addendum may be found at
+ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change and is
+included below.
+
+July 22, 1999
+
+To All Licensees, Distributors of Any Version of BSD:
+
+As you know, certain of the Berkeley Software Distribution ("BSD") source
+code files require that further distributions of products containing all or
+portions of the software, acknowledge within their advertising materials
+that such products contain software developed by UC Berkeley and its
+contributors.
+
+Specifically, the provision reads:
+
+"     * 3. All advertising materials mentioning features or use of this software
+      *    must display the following acknowledgement:
+      *    This product includes software developed by the University of
+      *    California, Berkeley and its contributors."
+
+Effective immediately, licensees and distributors are no longer required to
+include the acknowledgement within advertising materials.  Accordingly, the
+foregoing paragraph of those BSD Unix files containing it is hereby deleted
+in its entirety.
+
+William Hoskins
+Director, Office of Technology Licensing
+University of California, Berkeley
diff -r 6c9a73817770 -r 934c14ab9f19 tools/include/xen-external/bsd-queue.3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/include/xen-external/bsd-queue.3	Tue Jan 31 16:06:14 2012 +0000
@@ -0,0 +1,1044 @@
+.\" Copyright (c) 1993
+.\"	The Regents of the University of California.  All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"	This product includes software developed by the University of
+.\"	California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\"	@(#)queue.3	8.2 (Berkeley) 1/24/94
+.\" $FreeBSD$
+.\"
+.Dd May 13, 2011
+.Dt QUEUE 3
+.Os
+.Sh NAME
+.Nm SLIST_EMPTY ,
+.Nm SLIST_ENTRY ,
+.Nm SLIST_FIRST ,
+.Nm SLIST_FOREACH ,
+.Nm SLIST_FOREACH_SAFE ,
+.Nm SLIST_HEAD ,
+.Nm SLIST_HEAD_INITIALIZER ,
+.Nm SLIST_INIT ,
+.Nm SLIST_INSERT_AFTER ,
+.Nm SLIST_INSERT_HEAD ,
+.Nm SLIST_NEXT ,
+.Nm SLIST_REMOVE_AFTER ,
+.Nm SLIST_REMOVE_HEAD ,
+.Nm SLIST_REMOVE ,
+.Nm SLIST_SWAP ,
+.Nm STAILQ_CONCAT ,
+.Nm STAILQ_EMPTY ,
+.Nm STAILQ_ENTRY ,
+.Nm STAILQ_FIRST ,
+.Nm STAILQ_FOREACH ,
+.Nm STAILQ_FOREACH_SAFE ,
+.Nm STAILQ_HEAD ,
+.Nm STAILQ_HEAD_INITIALIZER ,
+.Nm STAILQ_INIT ,
+.Nm STAILQ_INSERT_AFTER ,
+.Nm STAILQ_INSERT_HEAD ,
+.Nm STAILQ_INSERT_TAIL ,
+.Nm STAILQ_LAST ,
+.Nm STAILQ_NEXT ,
+.Nm STAILQ_REMOVE_AFTER ,
+.Nm STAILQ_REMOVE_HEAD ,
+.Nm STAILQ_REMOVE ,
+.Nm STAILQ_SWAP ,
+.Nm LIST_EMPTY ,
+.Nm LIST_ENTRY ,
+.Nm LIST_FIRST ,
+.Nm LIST_FOREACH ,
+.Nm LIST_FOREACH_SAFE ,
+.Nm LIST_HEAD ,
+.Nm LIST_HEAD_INITIALIZER ,
+.Nm LIST_INIT ,
+.Nm LIST_INSERT_AFTER ,
+.Nm LIST_INSERT_BEFORE ,
+.Nm LIST_INSERT_HEAD ,
+.Nm LIST_NEXT ,
+.Nm LIST_REMOVE ,
+.Nm LIST_SWAP ,
+.Nm TAILQ_CONCAT ,
+.Nm TAILQ_EMPTY ,
+.Nm TAILQ_ENTRY ,
+.Nm TAILQ_FIRST ,
+.Nm TAILQ_FOREACH ,
+.Nm TAILQ_FOREACH_SAFE ,
+.Nm TAILQ_FOREACH_REVERSE ,
+.Nm TAILQ_FOREACH_REVERSE_SAFE ,
+.Nm TAILQ_HEAD ,
+.Nm TAILQ_HEAD_INITIALIZER ,
+.Nm TAILQ_INIT ,
+.Nm TAILQ_INSERT_AFTER ,
+.Nm TAILQ_INSERT_BEFORE ,
+.Nm TAILQ_INSERT_HEAD ,
+.Nm TAILQ_INSERT_TAIL ,
+.Nm TAILQ_LAST ,
+.Nm TAILQ_NEXT ,
+.Nm TAILQ_PREV ,
+.Nm TAILQ_REMOVE ,
+.Nm TAILQ_SWAP
+.Nd implementations of singly-linked lists, singly-linked tail queues,
+lists and tail queues
+.Sh SYNOPSIS
+.In sys/queue.h
+.\"
+.Fn SLIST_EMPTY "SLIST_HEAD *head"
+.Fn SLIST_ENTRY "TYPE"
+.Fn SLIST_FIRST "SLIST_HEAD *head"
+.Fn SLIST_FOREACH "TYPE *var" "SLIST_HEAD *head" "SLIST_ENTRY NAME"
+.Fn SLIST_FOREACH_SAFE "TYPE *var" "SLIST_HEAD *head" "SLIST_ENTRY NAME" "TYPE *temp_var"
+.Fn SLIST_HEAD "HEADNAME" "TYPE"
+.Fn SLIST_HEAD_INITIALIZER "SLIST_HEAD head"
+.Fn SLIST_INIT "SLIST_HEAD *head"
+.Fn SLIST_INSERT_AFTER "TYPE *listelm" "TYPE *elm" "SLIST_ENTRY NAME"
+.Fn SLIST_INSERT_HEAD "SLIST_HEAD *head" "TYPE *elm" "SLIST_ENTRY NAME"
+.Fn SLIST_NEXT "TYPE *elm" "SLIST_ENTRY NAME"
+.Fn SLIST_REMOVE_AFTER "TYPE *elm" "SLIST_ENTRY NAME"
+.Fn SLIST_REMOVE_HEAD "SLIST_HEAD *head" "SLIST_ENTRY NAME"
+.Fn SLIST_REMOVE "SLIST_HEAD *head" "TYPE *elm" "TYPE" "SLIST_ENTRY NAME"
+.Fn SLIST_SWAP "SLIST_HEAD *head1" "SLIST_HEAD *head2" "SLIST_ENTRY NAME"
+.\"
+.Fn STAILQ_CONCAT "STAILQ_HEAD *head1" "STAILQ_HEAD *head2"
+.Fn STAILQ_EMPTY "STAILQ_HEAD *head"
+.Fn STAILQ_ENTRY "TYPE"
+.Fn STAILQ_FIRST "STAILQ_HEAD *head"
+.Fn STAILQ_FOREACH "TYPE *var" "STAILQ_HEAD *head" "STAILQ_ENTRY NAME"
+.Fn STAILQ_FOREACH_SAFE "TYPE *var" "STAILQ_HEAD *head" "STAILQ_ENTRY NAME" "TYPE *temp_var"
+.Fn STAILQ_HEAD "HEADNAME" "TYPE"
+.Fn STAILQ_HEAD_INITIALIZER "STAILQ_HEAD head"
+.Fn STAILQ_INIT "STAILQ_HEAD *head"
+.Fn STAILQ_INSERT_AFTER "STAILQ_HEAD *head" "TYPE *listelm" "TYPE *elm" "STAILQ_ENTRY NAME"
+.Fn STAILQ_INSERT_HEAD "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
+.Fn STAILQ_INSERT_TAIL "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
+.Fn STAILQ_LAST "STAILQ_HEAD *head" "TYPE" "STAILQ_ENTRY NAME"
+.Fn STAILQ_NEXT "TYPE *elm" "STAILQ_ENTRY NAME"
+.Fn STAILQ_REMOVE_AFTER "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
+.Fn STAILQ_REMOVE_HEAD "STAILQ_HEAD *head" "STAILQ_ENTRY NAME"
+.Fn STAILQ_REMOVE "STAILQ_HEAD *head" "TYPE *elm" "TYPE" "STAILQ_ENTRY NAME"
+.Fn STAILQ_SWAP "STAILQ_HEAD *head1" "STAILQ_HEAD *head2" "STAILQ_ENTRY NAME"
+.\"
+.Fn LIST_EMPTY "LIST_HEAD *head"
+.Fn LIST_ENTRY "TYPE"
+.Fn LIST_FIRST "LIST_HEAD *head"
+.Fn LIST_FOREACH "TYPE *var" "LIST_HEAD *head" "LIST_ENTRY NAME"
+.Fn LIST_FOREACH_SAFE "TYPE *var" "LIST_HEAD *head" "LIST_ENTRY NAME" "TYPE *temp_var"
+.Fn LIST_HEAD "HEADNAME" "TYPE"
+.Fn LIST_HEAD_INITIALIZER "LIST_HEAD head"
+.Fn LIST_INIT "LIST_HEAD *head"
+.Fn LIST_INSERT_AFTER "TYPE *listelm" "TYPE *elm" "LIST_ENTRY NAME"
+.Fn LIST_INSERT_BEFORE "TYPE *listelm" "TYPE *elm" "LIST_ENTRY NAME"
+.Fn LIST_INSERT_HEAD "LIST_HEAD *head" "TYPE *elm" "LIST_ENTRY NAME"
+.Fn LIST_NEXT "TYPE *elm" "LIST_ENTRY NAME"
+.Fn LIST_REMOVE "TYPE *elm" "LIST_ENTRY NAME"
+.Fn LIST_SWAP "LIST_HEAD *head1" "LIST_HEAD *head2" "TYPE" "LIST_ENTRY NAME"
+.\"
+.Fn TAILQ_CONCAT "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "TAILQ_ENTRY NAME"
+.Fn TAILQ_EMPTY "TAILQ_HEAD *head"
+.Fn TAILQ_ENTRY "TYPE"
+.Fn TAILQ_FIRST "TAILQ_HEAD *head"
+.Fn TAILQ_FOREACH "TYPE *var" "TAILQ_HEAD *head" "TAILQ_ENTRY NAME"
+.Fn TAILQ_FOREACH_SAFE "TYPE *var" "TAILQ_HEAD *head" "TAILQ_ENTRY NAME" "TYPE *temp_var"
+.Fn TAILQ_FOREACH_REVERSE "TYPE *var" "TAILQ_HEAD *head" "HEADNAME" "TAILQ_ENTRY NAME"
+.Fn TAILQ_FOREACH_REVERSE_SAFE "TYPE *var" "TAILQ_HEAD *head" "HEADNAME" "TAILQ_ENTRY NAME" "TYPE *temp_var"
+.Fn TAILQ_HEAD "HEADNAME" "TYPE"
+.Fn TAILQ_HEAD_INITIALIZER "TAILQ_HEAD head"
+.Fn TAILQ_INIT "TAILQ_HEAD *head"
+.Fn TAILQ_INSERT_AFTER "TAILQ_HEAD *head" "TYPE *listelm" "TYPE *elm" "TAILQ_ENTRY NAME"
+.Fn TAILQ_INSERT_BEFORE "TYPE *listelm" "TYPE *elm" "TAILQ_ENTRY NAME"
+.Fn TAILQ_INSERT_HEAD "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME"
+.Fn TAILQ_INSERT_TAIL "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME"
+.Fn TAILQ_LAST "TAILQ_HEAD *head" "HEADNAME"
+.Fn TAILQ_NEXT "TYPE *elm" "TAILQ_ENTRY NAME"
+.Fn TAILQ_PREV "TYPE *elm" "HEADNAME" "TAILQ_ENTRY NAME"
+.Fn TAILQ_REMOVE "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME"
+.Fn TAILQ_SWAP "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "TYPE" "TAILQ_ENTRY NAME"
+.\"
+.Sh DESCRIPTION
+These macros define and operate on four types of data structures:
+singly-linked lists, singly-linked tail queues, lists, and tail queues.
+All four structures support the following functionality:
+.Bl -enum -compact -offset indent
+.It
+Insertion of a new entry at the head of the list.
+.It
+Insertion of a new entry after any element in the list.
+.It
+O(1) removal of an entry from the head of the list.
+.It
+Forward traversal through the list.
+.It
+Swawpping the contents of two lists.
+.El
+.Pp
+Singly-linked lists are the simplest of the four data structures
+and support only the above functionality.
+Singly-linked lists are ideal for applications with large datasets
+and few or no removals,
+or for implementing a LIFO queue.
+Singly-linked lists add the following functionality:
+.Bl -enum -compact -offset indent
+.It
+O(n) removal of any entry in the list.
+.El
+.Pp
+Singly-linked tail queues add the following functionality:
+.Bl -enum -compact -offset indent
+.It
+Entries can be added at the end of a list.
+.It
+O(n) removal of any entry in the list.
+.It
+They may be concatenated.
+.El
+However:
+.Bl -enum -compact -offset indent
+.It
+All list insertions must specify the head of the list.
+.It
+Each head entry requires two pointers rather than one.
+.It
+Code size is about 15% greater and operations run about 20% slower
+than singly-linked lists.
+.El
+.Pp
+Singly-linked tailqs are ideal for applications with large datasets and
+few or no removals,
+or for implementing a FIFO queue.
+.Pp
+All doubly linked types of data structures (lists and tail queues)
+additionally allow:
+.Bl -enum -compact -offset indent
+.It
+Insertion of a new entry before any element in the list.
+.It
+O(1) removal of any entry in the list.
+.El
+However:
+.Bl -enum -compact -offset indent
+.It
+Each element requires two pointers rather than one.
+.It
+Code size and execution time of operations (except for removal) is about
+twice that of the singly-linked data-structures.
+.El
+.Pp
+Linked lists are the simplest of the doubly linked data structures and support
+only the above functionality over singly-linked lists.
+.Pp
+Tail queues add the following functionality:
+.Bl -enum -compact -offset indent
+.It
+Entries can be added at the end of a list.
+.It
+They may be traversed backwards, from tail to head.
+.It
+They may be concatenated.
+.El
+However:
+.Bl -enum -compact -offset indent
+.It
+All list insertions and removals must specify the head of the list.
+.It
+Each head entry requires two pointers rather than one.
+.It
+Code size is about 15% greater and operations run about 20% slower
+than singly-linked lists.
+.El
+.Pp
+In the macro definitions,
+.Fa TYPE
+is the name of a user defined structure,
+that must contain a field of type
+.Li SLIST_ENTRY ,
+.Li STAILQ_ENTRY ,
+.Li LIST_ENTRY ,
+or
+.Li TAILQ_ENTRY ,
+named
+.Fa NAME .
+The argument
+.Fa HEADNAME
+is the name of a user defined structure that must be declared
+using the macros
+.Li SLIST_HEAD ,
+.Li STAILQ_HEAD ,
+.Li LIST_HEAD ,
+or
+.Li TAILQ_HEAD .
+See the examples below for further explanation of how these
+macros are used.
+.Sh SINGLY-LINKED LISTS
+A singly-linked list is headed by a structure defined by the
+.Nm SLIST_HEAD
+macro.
+This structure contains a single pointer to the first element
+on the list.
+The elements are singly linked for minimum space and pointer manipulation
+overhead at the expense of O(n) removal for arbitrary elements.
+New elements can be added to the list after an existing element or
+at the head of the list.
+An
+.Fa SLIST_HEAD
+structure is declared as follows:
+.Bd -literal -offset indent
+SLIST_HEAD(HEADNAME, TYPE) head;
+.Ed
+.Pp
+where
+.Fa HEADNAME
+is the name of the structure to be defined, and
+.Fa TYPE
+is the type of the elements to be linked into the list.
+A pointer to the head of the list can later be declared as:
+.Bd -literal -offset indent
+struct HEADNAME *headp;
+.Ed
+.Pp
+(The names
+.Li head
+and
+.Li headp
+are user selectable.)
+.Pp
+The macro
+.Nm SLIST_HEAD_INITIALIZER
+evaluates to an initializer for the list
+.Fa head .
+.Pp
+The macro
+.Nm SLIST_EMPTY
+evaluates to true if there are no elements in the list.
+.Pp
+The macro
+.Nm SLIST_ENTRY
+declares a structure that connects the elements in
+the list.
+.Pp
+The macro
+.Nm SLIST_FIRST
+returns the first element in the list or NULL if the list is empty.
+.Pp
+The macro
+.Nm SLIST_FOREACH
+traverses the list referenced by
+.Fa head
+in the forward direction, assigning each element in
+turn to
+.Fa var .
+.Pp
+The macro
+.Nm SLIST_FOREACH_SAFE
+traverses the list referenced by
+.Fa head
+in the forward direction, assigning each element in
+turn to
+.Fa var .
+However, unlike
+.Fn SLIST_FOREACH
+here it is permitted to both remove
+.Fa var
+as well as free it from within the loop safely without interfering with the
+traversal.
+.Pp
+The macro
+.Nm SLIST_INIT
+initializes the list referenced by
+.Fa head .
+.Pp
+The macro
+.Nm SLIST_INSERT_HEAD
+inserts the new element
+.Fa elm
+at the head of the list.
+.Pp
+The macro
+.Nm SLIST_INSERT_AFTER
+inserts the new element
+.Fa elm
+after the element
+.Fa listelm .
+.Pp
+The macro
+.Nm SLIST_NEXT
+returns the next element in the list.
+.Pp
+The macro
+.Nm SLIST_REMOVE_AFTER
+removes the element after
+.Fa elm
+from the list. Unlike
+.Fa SLIST_REMOVE ,
+this macro does not traverse the entire list.
+.Pp
+The macro
+.Nm SLIST_REMOVE_HEAD
+removes the element
+.Fa elm
+from the head of the list.
+For optimum efficiency,
+elements being removed from the head of the list should explicitly use
+this macro instead of the generic
+.Fa SLIST_REMOVE
+macro.
+.Pp
+The macro
+.Nm SLIST_REMOVE
+removes the element
+.Fa elm
+from the list.
+.Pp
+The macro
+.Nm SLIST_SWAP
+swaps the contents of
+.Fa head1
+and
+.Fa head2 .
+.Sh SINGLY-LINKED LIST EXAMPLE
+.Bd -literal
+SLIST_HEAD(slisthead, entry) head =
+    SLIST_HEAD_INITIALIZER(head);
+struct slisthead *headp;		/* Singly-linked List head. */
+struct entry {
+	...
+	SLIST_ENTRY(entry) entries;	/* Singly-linked List. */
+	...
+} *n1, *n2, *n3, *np;
+
+SLIST_INIT(&head);			/* Initialize the list. */
+
+n1 = malloc(sizeof(struct entry));	/* Insert at the head. */
+SLIST_INSERT_HEAD(&head, n1, entries);
+
+n2 = malloc(sizeof(struct entry));	/* Insert after. */
+SLIST_INSERT_AFTER(n1, n2, entries);
+
+SLIST_REMOVE(&head, n2, entry, entries);/* Deletion. */
+free(n2);
+
+n3 = SLIST_FIRST(&head);
+SLIST_REMOVE_HEAD(&head, entries);	/* Deletion from the head. */
+free(n3);
+					/* Forward traversal. */
+SLIST_FOREACH(np, &head, entries)
+	np-> ...
+					/* Safe forward traversal. */
+SLIST_FOREACH_SAFE(np, &head, entries, np_temp) {
+	np->do_stuff();
+	...
+	SLIST_REMOVE(&head, np, entry, entries);
+	free(np);
+}
+
+while (!SLIST_EMPTY(&head)) {		/* List Deletion. */
+	n1 = SLIST_FIRST(&head);
+	SLIST_REMOVE_HEAD(&head, entries);
+	free(n1);
+}
+.Ed
+.Sh SINGLY-LINKED TAIL QUEUES
+A singly-linked tail queue is headed by a structure defined by the
+.Nm STAILQ_HEAD
+macro.
+This structure contains a pair of pointers,
+one to the first element in the tail queue and the other to
+the last element in the tail queue.
+The elements are singly linked for minimum space and pointer
+manipulation overhead at the expense of O(n) removal for arbitrary
+elements.
+New elements can be added to the tail queue after an existing element,
+at the head of the tail queue, or at the end of the tail queue.
+A
+.Fa STAILQ_HEAD
+structure is declared as follows:
+.Bd -literal -offset indent
+STAILQ_HEAD(HEADNAME, TYPE) head;
+.Ed
+.Pp
+where
+.Li HEADNAME
+is the name of the structure to be defined, and
+.Li TYPE
+is the type of the elements to be linked into the tail queue.
+A pointer to the head of the tail queue can later be declared as:
+.Bd -literal -offset indent
+struct HEADNAME *headp;
+.Ed
+.Pp
+(The names
+.Li head
+and
+.Li headp
+are user selectable.)
+.Pp
+The macro
+.Nm STAILQ_HEAD_INITIALIZER
+evaluates to an initializer for the tail queue
+.Fa head .
+.Pp
+The macro
+.Nm STAILQ_CONCAT
+concatenates the tail queue headed by
+.Fa head2
+onto the end of the one headed by
+.Fa head1
+removing all entries from the former.
+.Pp
+The macro
+.Nm STAILQ_EMPTY
+evaluates to true if there are no items on the tail queue.
+.Pp
+The macro
+.Nm STAILQ_ENTRY
+declares a structure that connects the elements in
+the tail queue.
+.Pp
+The macro
+.Nm STAILQ_FIRST
+returns the first item on the tail queue or NULL if the tail queue
+is empty.
+.Pp
+The macro
+.Nm STAILQ_FOREACH
+traverses the tail queue referenced by
+.Fa head
+in the forward direction, assigning each element
+in turn to
+.Fa var .
+.Pp
+The macro
+.Nm STAILQ_FOREACH_SAFE
+traverses the tail queue referenced by
+.Fa head
+in the forward direction, assigning each element
+in turn to
+.Fa var .
+However, unlike
+.Fn STAILQ_FOREACH
+here it is permitted to both remove
+.Fa var
+as well as free it from within the loop safely without interfering with the
+traversal.
+.Pp
+The macro
+.Nm STAILQ_INIT
+initializes the tail queue referenced by
+.Fa head .
+.Pp
+The macro
+.Nm STAILQ_INSERT_HEAD
+inserts the new element
+.Fa elm
+at the head of the tail queue.
+.Pp
+The macro
+.Nm STAILQ_INSERT_TAIL
+inserts the new element
+.Fa elm
+at the end of the tail queue.
+.Pp
+The macro
+.Nm STAILQ_INSERT_AFTER
+inserts the new element
+.Fa elm
+after the element
+.Fa listelm .
+.Pp
+The macro
+.Nm STAILQ_LAST
+returns the last item on the tail queue.
+If the tail queue is empty the return value is
+.Dv NULL .
+.Pp
+The macro
+.Nm STAILQ_NEXT
+returns the next item on the tail queue, or NULL this item is the last.
+.Pp
+The macro
+.Nm STAILQ_REMOVE_AFTER
+removes the element after
+.Fa elm
+from the tail queue. Unlike
+.Fa STAILQ_REMOVE ,
+this macro does not traverse the entire tail queue.
+.Pp
+The macro
+.Nm STAILQ_REMOVE_HEAD
+removes the element at the head of the tail queue.
+For optimum efficiency,
+elements being removed from the head of the tail queue should
+use this macro explicitly rather than the generic
+.Fa STAILQ_REMOVE
+macro.
+.Pp
+The macro
+.Nm STAILQ_REMOVE
+removes the element
+.Fa elm
+from the tail queue.
+.Pp
+The macro
+.Nm STAILQ_SWAP
+swaps the contents of
+.Fa head1
+and
+.Fa head2 .
+.Sh SINGLY-LINKED TAIL QUEUE EXAMPLE
+.Bd -literal
+STAILQ_HEAD(stailhead, entry) head =
+    STAILQ_HEAD_INITIALIZER(head);
+struct stailhead *headp;		/* Singly-linked tail queue head. */
+struct entry {
+	...
+	STAILQ_ENTRY(entry) entries;	/* Tail queue. */
+	...
+} *n1, *n2, *n3, *np;
+
+STAILQ_INIT(&head);			/* Initialize the queue. */
+
+n1 = malloc(sizeof(struct entry));	/* Insert at the head. */
+STAILQ_INSERT_HEAD(&head, n1, entries);
+
+n1 = malloc(sizeof(struct entry));	/* Insert at the tail. */
+STAILQ_INSERT_TAIL(&head, n1, entries);
+
+n2 = malloc(sizeof(struct entry));	/* Insert after. */
+STAILQ_INSERT_AFTER(&head, n1, n2, entries);
+					/* Deletion. */
+STAILQ_REMOVE(&head, n2, entry, entries);
+free(n2);
+					/* Deletion from the head. */
+n3 = STAILQ_FIRST(&head);
+STAILQ_REMOVE_HEAD(&head, entries);
+free(n3);
+					/* Forward traversal. */
+STAILQ_FOREACH(np, &head, entries)
+	np-> ...
+					/* Safe forward traversal. */
+STAILQ_FOREACH_SAFE(np, &head, entries, np_temp) {
+	np->do_stuff();
+	...
+	STAILQ_REMOVE(&head, np, entry, entries);
+	free(np);
+}
+					/* TailQ Deletion. */
+while (!STAILQ_EMPTY(&head)) {
+	n1 = STAILQ_FIRST(&head);
+	STAILQ_REMOVE_HEAD(&head, entries);
+	free(n1);
+}
+					/* Faster TailQ Deletion. */
+n1 = STAILQ_FIRST(&head);
+while (n1 != NULL) {
+	n2 = STAILQ_NEXT(n1, entries);
+	free(n1);
+	n1 = n2;
+}
+STAILQ_INIT(&head);
+.Ed
+.Sh LISTS
+A list is headed by a structure defined by the
+.Nm LIST_HEAD
+macro.
+This structure contains a single pointer to the first element
+on the list.
+The elements are doubly linked so that an arbitrary element can be
+removed without traversing the list.
+New elements can be added to the list after an existing element,
+before an existing element, or at the head of the list.
+A
+.Fa LIST_HEAD
+structure is declared as follows:
+.Bd -literal -offset indent
+LIST_HEAD(HEADNAME, TYPE) head;
+.Ed
+.Pp
+where
+.Fa HEADNAME
+is the name of the structure to be defined, and
+.Fa TYPE
+is the type of the elements to be linked into the list.
+A pointer to the head of the list can later be declared as:
+.Bd -literal -offset indent
+struct HEADNAME *headp;
+.Ed
+.Pp
+(The names
+.Li head
+and
+.Li headp
+are user selectable.)
+.Pp
+The macro
+.Nm LIST_HEAD_INITIALIZER
+evaluates to an initializer for the list
+.Fa head .
+.Pp
+The macro
+.Nm LIST_EMPTY
+evaluates to true if there are no elements in the list.
+.Pp
+The macro
+.Nm LIST_ENTRY
+declares a structure that connects the elements in
+the list.
+.Pp
+The macro
+.Nm LIST_FIRST
+returns the first element in the list or NULL if the list
+is empty.
+.Pp
+The macro
+.Nm LIST_FOREACH
+traverses the list referenced by
+.Fa head
+in the forward direction, assigning each element in turn to
+.Fa var .
+.Pp
+The macro
+.Nm LIST_FOREACH_SAFE
+traverses the list referenced by
+.Fa head
+in the forward direction, assigning each element in turn to
+.Fa var .
+However, unlike
+.Fn LIST_FOREACH
+here it is permitted to both remove
+.Fa var
+as well as free it from within the loop safely without interfering with the
+traversal.
+.Pp
+The macro
+.Nm LIST_INIT
+initializes the list referenced by
+.Fa head .
+.Pp
+The macro
+.Nm LIST_INSERT_HEAD
+inserts the new element
+.Fa elm
+at the head of the list.
+.Pp
+The macro
+.Nm LIST_INSERT_AFTER
+inserts the new element
+.Fa elm
+after the element
+.Fa listelm .
+.Pp
+The macro
+.Nm LIST_INSERT_BEFORE
+inserts the new element
+.Fa elm
+before the element
+.Fa listelm .
+.Pp
+The macro
+.Nm LIST_NEXT
+returns the next element in the list, or NULL if this is the last.
+.Pp
+The macro
+.Nm LIST_REMOVE
+removes the element
+.Fa elm
+from the list.
+.Pp
+The macro
+.Nm LIST_SWAP
+swaps the contents of
+.Fa head1
+and
+.Fa head2 .
+.Sh LIST EXAMPLE
+.Bd -literal
+LIST_HEAD(listhead, entry) head =
+    LIST_HEAD_INITIALIZER(head);
+struct listhead *headp;			/* List head. */
+struct entry {
+	...
+	LIST_ENTRY(entry) entries;	/* List. */
+	...
+} *n1, *n2, *n3, *np, *np_temp;
+
+LIST_INIT(&head);			/* Initialize the list. */
+
+n1 = malloc(sizeof(struct entry));	/* Insert at the head. */
+LIST_INSERT_HEAD(&head, n1, entries);
+
+n2 = malloc(sizeof(struct entry));	/* Insert after. */
+LIST_INSERT_AFTER(n1, n2, entries);
+
+n3 = malloc(sizeof(struct entry));	/* Insert before. */
+LIST_INSERT_BEFORE(n2, n3, entries);
+
+LIST_REMOVE(n2, entries);		/* Deletion. */
+free(n2);
+					/* Forward traversal. */
+LIST_FOREACH(np, &head, entries)
+	np-> ...
+
+					/* Safe forward traversal. */
+LIST_FOREACH_SAFE(np, &head, entries, np_temp) {
+	np->do_stuff();
+	...
+	LIST_REMOVE(np, entries);
+	free(np);
+}
+
+while (!LIST_EMPTY(&head)) {		/* List Deletion. */
+	n1 = LIST_FIRST(&head);
+	LIST_REMOVE(n1, entries);
+	free(n1);
+}
+
+n1 = LIST_FIRST(&head);			/* Faster List Deletion. */
+while (n1 != NULL) {
+	n2 = LIST_NEXT(n1, entries);
+	free(n1);
+	n1 = n2;
+}
+LIST_INIT(&head);
+.Ed
+.Sh TAIL QUEUES
+A tail queue is headed by a structure defined by the
+.Nm TAILQ_HEAD
+macro.
+This structure contains a pair of pointers,
+one to the first element in the tail queue and the other to
+the last element in the tail queue.
+The elements are doubly linked so that an arbitrary element can be
+removed without traversing the tail queue.
+New elements can be added to the tail queue after an existing element,
+before an existing element, at the head of the tail queue,
+or at the end of the tail queue.
+A
+.Fa TAILQ_HEAD
+structure is declared as follows:
+.Bd -literal -offset indent
+TAILQ_HEAD(HEADNAME, TYPE) head;
+.Ed
+.Pp
+where
+.Li HEADNAME
+is the name of the structure to be defined, and
+.Li TYPE
+is the type of the elements to be linked into the tail queue.
+A pointer to the head of the tail queue can later be declared as:
+.Bd -literal -offset indent
+struct HEADNAME *headp;
+.Ed
+.Pp
+(The names
+.Li head
+and
+.Li headp
+are user selectable.)
+.Pp
+The macro
+.Nm TAILQ_HEAD_INITIALIZER
+evaluates to an initializer for the tail queue
+.Fa head .
+.Pp
+The macro
+.Nm TAILQ_CONCAT
+concatenates the tail queue headed by
+.Fa head2
+onto the end of the one headed by
+.Fa head1
+removing all entries from the former.
+.Pp
+The macro
+.Nm TAILQ_EMPTY
+evaluates to true if there are no items on the tail queue.
+.Pp
+The macro
+.Nm TAILQ_ENTRY
+declares a structure that connects the elements in
+the tail queue.
+.Pp
+The macro
+.Nm TAILQ_FIRST
+returns the first item on the tail queue or NULL if the tail queue
+is empty.
+.Pp
+The macro
+.Nm TAILQ_FOREACH
+traverses the tail queue referenced by
+.Fa head
+in the forward direction, assigning each element in turn to
+.Fa var .
+.Fa var
+is set to
+.Dv NULL
+if the loop completes normally, or if there were no elements.
+.Pp
+The macro
+.Nm TAILQ_FOREACH_REVERSE
+traverses the tail queue referenced by
+.Fa head
+in the reverse direction, assigning each element in turn to
+.Fa var .
+.Pp
+The macros
+.Nm TAILQ_FOREACH_SAFE
+and
+.Nm TAILQ_FOREACH_REVERSE_SAFE
+traverse the list referenced by
+.Fa head
+in the forward or reverse direction respectively,
+assigning each element in turn to
+.Fa var .
+However, unlike their unsafe counterparts,
+.Nm TAILQ_FOREACH
+and
+.Nm TAILQ_FOREACH_REVERSE
+permit to both remove
+.Fa var
+as well as free it from within the loop safely without interfering with the
+traversal.
+.Pp
+The macro
+.Nm TAILQ_INIT
+initializes the tail queue referenced by
+.Fa head .
+.Pp
+The macro
+.Nm TAILQ_INSERT_HEAD
+inserts the new element
+.Fa elm
+at the head of the tail queue.
+.Pp
+The macro
+.Nm TAILQ_INSERT_TAIL
+inserts the new element
+.Fa elm
+at the end of the tail queue.
+.Pp
+The macro
+.Nm TAILQ_INSERT_AFTER
+inserts the new element
+.Fa elm
+after the element
+.Fa listelm .
+.Pp
+The macro
+.Nm TAILQ_INSERT_BEFORE
+inserts the new element
+.Fa elm
+before the element
+.Fa listelm .
+.Pp
+The macro
+.Nm TAILQ_LAST
+returns the last item on the tail queue.
+If the tail queue is empty the return value is
+.Dv NULL .
+.Pp
+The macro
+.Nm TAILQ_NEXT
+returns the next item on the tail queue, or NULL if this item is the last.
+.Pp
+The macro
+.Nm TAILQ_PREV
+returns the previous item on the tail queue, or NULL if this item
+is the first.
+.Pp
+The macro
+.Nm TAILQ_REMOVE
+removes the element
+.Fa elm
+from the tail queue.
+.Pp
+The macro
+.Nm TAILQ_SWAP
+swaps the contents of
+.Fa head1
+and
+.Fa head2 .
+.Sh TAIL QUEUE EXAMPLE
+.Bd -literal
+TAILQ_HEAD(tailhead, entry) head =
+    TAILQ_HEAD_INITIALIZER(head);
+struct tailhead *headp;			/* Tail queue head. */
+struct entry {
+	...
+	TAILQ_ENTRY(entry) entries;	/* Tail queue. */
+	...
+} *n1, *n2, *n3, *np;
+
+TAILQ_INIT(&head);			/* Initialize the queue. */
+
+n1 = malloc(sizeof(struct entry));	/* Insert at the head. */
+TAILQ_INSERT_HEAD(&head, n1, entries);
+
+n1 = malloc(sizeof(struct entry));	/* Insert at the tail. */
+TAILQ_INSERT_TAIL(&head, n1, entries);
+
+n2 = malloc(sizeof(struct entry));	/* Insert after. */
+TAILQ_INSERT_AFTER(&head, n1, n2, entries);
+
+n3 = malloc(sizeof(struct entry));	/* Insert before. */
+TAILQ_INSERT_BEFORE(n2, n3, entries);
+
+TAILQ_REMOVE(&head, n2, entries);	/* Deletion. */
+free(n2);
+					/* Forward traversal. */
+TAILQ_FOREACH(np, &head, entries)
+	np-> ...
+					/* Safe forward traversal. */
+TAILQ_FOREACH_SAFE(np, &head, entries, np_temp) {
+	np->do_stuff();
+	...
+	TAILQ_REMOVE(&head, np, entries);
+	free(np);
+}
+					/* Reverse traversal. */
+TAILQ_FOREACH_REVERSE(np, &head, tailhead, entries)
+	np-> ...
+					/* TailQ Deletion. */
+while (!TAILQ_EMPTY(&head)) {
+	n1 = TAILQ_FIRST(&head);
+	TAILQ_REMOVE(&head, n1, entries);
+	free(n1);
+}
+					/* Faster TailQ Deletion. */
+n1 = TAILQ_FIRST(&head);
+while (n1 != NULL) {
+	n2 = TAILQ_NEXT(n1, entries);
+	free(n1);
+	n1 = n2;
+}
+TAILQ_INIT(&head);
+.Ed
+.Sh SEE ALSO
+.Xr tree 3
+.Sh HISTORY
+The
+.Nm queue
+functions first appeared in
+.Bx 4.4 .
diff -r 6c9a73817770 -r 934c14ab9f19 tools/include/xen-external/bsd-sys-queue-h-seddery
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/include/xen-external/bsd-sys-queue-h-seddery	Tue Jan 31 16:06:14 2012 +0000
@@ -0,0 +1,72 @@
+#!/usr/bin/perl -p
+#
+# This script is part of the Xen build system.  It has a very
+# permissive licence to avoid complicating the licence of the
+# generated header file and to allow this seddery to be reused by
+# other projects.
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this individual file (the "Software"), to deal
+# in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute,
+# sublicense, and/or sell copies of the Software, and to permit
+# persons to whom the Software is furnished to do so, subject to the
+# following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#
+# Copyright (C) 2011 Citrix Ltd
+
+our $namespace, $ucnamespace;
+
+BEGIN {
+    die unless @ARGV;
+    $namespace = pop @ARGV;
+    $namespace =~ s/^--prefix=// or die;
+    $ucnamespace = uc $namespace;
+
+    print <<END or die $!;
+/*
+ * DO NOT EDIT THIS FILE
+ *
+ * Generated automatically by bsd-sys-queue-h-seddery to
+ *  - introduce ${ucnamespace}_ and ${namespace}_ namespace prefixes
+ *  - turn "struct type" into "type" so that type arguments
+ *     to the macros are type names not struct tags
+ *  - remove the reference to sys/cdefs.h, which is not needed
+ *
+ * The purpose of this seddery is to allow the resulting file to be
+ * freely included by software which might also want to include other
+ * list macros; to make it usable when struct tags are not being used
+ * or not known; to make it more portable.
+ */
+END
+}
+
+s/\b( _SYS_QUEUE |
+      SLIST | LIST | STAILQ | TAILQ | QUEUE
+      )/${ucnamespace}_$1/xg;
+
+s/\b( TRACEBUF | TRASHIT |
+      QMD_
+      )/${ucnamespace}__$1/xg;
+
+s/\b(
+      qm_
+      )/${namespace}__$1/xg;
+
+s/\b struct \s+ type \b/type/xg;
+
+s,^\#include.*sys/cdefs.*,/* $& */,xg;
+
+s/\b( NULL )/0/xg;
diff -r 6c9a73817770 -r 934c14ab9f19 tools/include/xen-external/bsd-sys-queue.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/include/xen-external/bsd-sys-queue.h	Tue Jan 31 16:06:14 2012 +0000
@@ -0,0 +1,637 @@
+/*-
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)queue.h	8.5 (Berkeley) 8/20/94
+ * $FreeBSD$
+ */
+
+#ifndef _SYS_QUEUE_H_
+#define	_SYS_QUEUE_H_
+
+#include <sys/cdefs.h>
+
+/*
+ * This file defines four types of data structures: singly-linked lists,
+ * singly-linked tail queues, lists and tail queues.
+ *
+ * A singly-linked list is headed by a single forward pointer. The elements
+ * are singly linked for minimum space and pointer manipulation overhead at
+ * the expense of O(n) removal for arbitrary elements. New elements can be
+ * added to the list after an existing element or at the head of the list.
+ * Elements being removed from the head of the list should use the explicit
+ * macro for this purpose for optimum efficiency. A singly-linked list may
+ * only be traversed in the forward direction.  Singly-linked lists are ideal
+ * for applications with large datasets and few or no removals or for
+ * implementing a LIFO queue.
+ *
+ * A singly-linked tail queue is headed by a pair of pointers, one to the
+ * head of the list and the other to the tail of the list. The elements are
+ * singly linked for minimum space and pointer manipulation overhead at the
+ * expense of O(n) removal for arbitrary elements. New elements can be added
+ * to the list after an existing element, at the head of the list, or at the
+ * end of the list. Elements being removed from the head of the tail queue
+ * should use the explicit macro for this purpose for optimum efficiency.
+ * A singly-linked tail queue may only be traversed in the forward direction.
+ * Singly-linked tail queues are ideal for applications with large datasets
+ * and few or no removals or for implementing a FIFO queue.
+ *
+ * A list is headed by a single forward pointer (or an array of forward
+ * pointers for a hash table header). The elements are doubly linked
+ * so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before
+ * or after an existing element or at the head of the list. A list
+ * may only be traversed in the forward direction.
+ *
+ * A tail queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or
+ * after an existing element, at the head of the list, or at the end of
+ * the list. A tail queue may be traversed in either direction.
+ *
+ * For details on the use of these macros, see the queue(3) manual page.
+ *
+ *
+ *				SLIST	LIST	STAILQ	TAILQ
+ * _HEAD			+	+	+	+
+ * _HEAD_INITIALIZER		+	+	+	+
+ * _ENTRY			+	+	+	+
+ * _INIT			+	+	+	+
+ * _EMPTY			+	+	+	+
+ * _FIRST			+	+	+	+
+ * _NEXT			+	+	+	+
+ * _PREV			-	-	-	+
+ * _LAST			-	-	+	+
+ * _FOREACH			+	+	+	+
+ * _FOREACH_SAFE		+	+	+	+
+ * _FOREACH_REVERSE		-	-	-	+
+ * _FOREACH_REVERSE_SAFE	-	-	-	+
+ * _INSERT_HEAD			+	+	+	+
+ * _INSERT_BEFORE		-	+	-	+
+ * _INSERT_AFTER		+	+	+	+
+ * _INSERT_TAIL			-	-	+	+
+ * _CONCAT			-	-	+	+
+ * _REMOVE_AFTER		+	-	+	-
+ * _REMOVE_HEAD			+	-	+	-
+ * _REMOVE			+	+	+	+
+ * _SWAP			+	+	+	+
+ *
+ */
+#ifdef QUEUE_MACRO_DEBUG
+/* Store the last 2 places the queue element or head was altered */
+struct qm_trace {
+	char * lastfile;
+	int lastline;
+	char * prevfile;
+	int prevline;
+};
+
+#define	TRACEBUF	struct qm_trace trace;
+#define	TRASHIT(x)	do {(x) = (void *)-1;} while (0)
+#define	QMD_SAVELINK(name, link)	void **name = (void *)&(link)
+
+#define	QMD_TRACE_HEAD(head) do {					\
+	(head)->trace.prevline = (head)->trace.lastline;		\
+	(head)->trace.prevfile = (head)->trace.lastfile;		\
+	(head)->trace.lastline = __LINE__;				\
+	(head)->trace.lastfile = __FILE__;				\
+} while (0)
+
+#define	QMD_TRACE_ELEM(elem) do {					\
+	(elem)->trace.prevline = (elem)->trace.lastline;		\
+	(elem)->trace.prevfile = (elem)->trace.lastfile;		\
+	(elem)->trace.lastline = __LINE__;				\
+	(elem)->trace.lastfile = __FILE__;				\
+} while (0)
+
+#else
+#define	QMD_TRACE_ELEM(elem)
+#define	QMD_TRACE_HEAD(head)
+#define	QMD_SAVELINK(name, link)
+#define	TRACEBUF
+#define	TRASHIT(x)
+#endif	/* QUEUE_MACRO_DEBUG */
+
+/*
+ * Singly-linked List declarations.
+ */
+#define	SLIST_HEAD(name, type)						\
+struct name {								\
+	struct type *slh_first;	/* first element */			\
+}
+
+#define	SLIST_HEAD_INITIALIZER(head)					\
+	{ NULL }
+
+#define	SLIST_ENTRY(type)						\
+struct {								\
+	struct type *sle_next;	/* next element */			\
+}
+
+/*
+ * Singly-linked List functions.
+ */
+#define	SLIST_EMPTY(head)	((head)->slh_first == NULL)
+
+#define	SLIST_FIRST(head)	((head)->slh_first)
+
+#define	SLIST_FOREACH(var, head, field)					\
+	for ((var) = SLIST_FIRST((head));				\
+	    (var);							\
+	    (var) = SLIST_NEXT((var), field))
+
+#define	SLIST_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = SLIST_FIRST((head));				\
+	    (var) && ((tvar) = SLIST_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	SLIST_FOREACH_PREVPTR(var, varp, head, field)			\
+	for ((varp) = &SLIST_FIRST((head));				\
+	    ((var) = *(varp)) != NULL;					\
+	    (varp) = &SLIST_NEXT((var), field))
+
+#define	SLIST_INIT(head) do {						\
+	SLIST_FIRST((head)) = NULL;					\
+} while (0)
+
+#define	SLIST_INSERT_AFTER(slistelm, elm, field) do {			\
+	SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field);	\
+	SLIST_NEXT((slistelm), field) = (elm);				\
+} while (0)
+
+#define	SLIST_INSERT_HEAD(head, elm, field) do {			\
+	SLIST_NEXT((elm), field) = SLIST_FIRST((head));			\
+	SLIST_FIRST((head)) = (elm);					\
+} while (0)
+
+#define	SLIST_NEXT(elm, field)	((elm)->field.sle_next)
+
+#define	SLIST_REMOVE(head, elm, type, field) do {			\
+	QMD_SAVELINK(oldnext, (elm)->field.sle_next);			\
+	if (SLIST_FIRST((head)) == (elm)) {				\
+		SLIST_REMOVE_HEAD((head), field);			\
+	}								\
+	else {								\
+		struct type *curelm = SLIST_FIRST((head));		\
+		while (SLIST_NEXT(curelm, field) != (elm))		\
+			curelm = SLIST_NEXT(curelm, field);		\
+		SLIST_REMOVE_AFTER(curelm, field);			\
+	}								\
+	TRASHIT(*oldnext);						\
+} while (0)
+
+#define SLIST_REMOVE_AFTER(elm, field) do {				\
+	SLIST_NEXT(elm, field) =					\
+	    SLIST_NEXT(SLIST_NEXT(elm, field), field);			\
+} while (0)
+
+#define	SLIST_REMOVE_HEAD(head, field) do {				\
+	SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field);	\
+} while (0)
+
+#define SLIST_SWAP(head1, head2, type) do {				\
+	struct type *swap_first = SLIST_FIRST(head1);			\
+	SLIST_FIRST(head1) = SLIST_FIRST(head2);			\
+	SLIST_FIRST(head2) = swap_first;				\
+} while (0)
+
+/*
+ * Singly-linked Tail queue declarations.
+ */
+#define	STAILQ_HEAD(name, type)						\
+struct name {								\
+	struct type *stqh_first;/* first element */			\
+	struct type **stqh_last;/* addr of last next element */		\
+}
+
+#define	STAILQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).stqh_first }
+
+#define	STAILQ_ENTRY(type)						\
+struct {								\
+	struct type *stqe_next;	/* next element */			\
+}
+
+/*
+ * Singly-linked Tail queue functions.
+ */
+#define	STAILQ_CONCAT(head1, head2) do {				\
+	if (!STAILQ_EMPTY((head2))) {					\
+		*(head1)->stqh_last = (head2)->stqh_first;		\
+		(head1)->stqh_last = (head2)->stqh_last;		\
+		STAILQ_INIT((head2));					\
+	}								\
+} while (0)
+
+#define	STAILQ_EMPTY(head)	((head)->stqh_first == NULL)
+
+#define	STAILQ_FIRST(head)	((head)->stqh_first)
+
+#define	STAILQ_FOREACH(var, head, field)				\
+	for((var) = STAILQ_FIRST((head));				\
+	   (var);							\
+	   (var) = STAILQ_NEXT((var), field))
+
+
+#define	STAILQ_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = STAILQ_FIRST((head));				\
+	    (var) && ((tvar) = STAILQ_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	STAILQ_INIT(head) do {						\
+	STAILQ_FIRST((head)) = NULL;					\
+	(head)->stqh_last = &STAILQ_FIRST((head));			\
+} while (0)
+
+#define	STAILQ_INSERT_AFTER(head, tqelm, elm, field) do {		\
+	if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\
+		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\
+	STAILQ_NEXT((tqelm), field) = (elm);				\
+} while (0)
+
+#define	STAILQ_INSERT_HEAD(head, elm, field) do {			\
+	if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL)	\
+		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\
+	STAILQ_FIRST((head)) = (elm);					\
+} while (0)
+
+#define	STAILQ_INSERT_TAIL(head, elm, field) do {			\
+	STAILQ_NEXT((elm), field) = NULL;				\
+	*(head)->stqh_last = (elm);					\
+	(head)->stqh_last = &STAILQ_NEXT((elm), field);			\
+} while (0)
+
+#define	STAILQ_LAST(head, type, field)					\
+	(STAILQ_EMPTY((head)) ?						\
+		NULL :							\
+	        ((struct type *)(void *)				\
+		((char *)((head)->stqh_last) - __offsetof(struct type, field))))
+
+#define	STAILQ_NEXT(elm, field)	((elm)->field.stqe_next)
+
+#define	STAILQ_REMOVE(head, elm, type, field) do {			\
+	QMD_SAVELINK(oldnext, (elm)->field.stqe_next);			\
+	if (STAILQ_FIRST((head)) == (elm)) {				\
+		STAILQ_REMOVE_HEAD((head), field);			\
+	}								\
+	else {								\
+		struct type *curelm = STAILQ_FIRST((head));		\
+		while (STAILQ_NEXT(curelm, field) != (elm))		\
+			curelm = STAILQ_NEXT(curelm, field);		\
+		STAILQ_REMOVE_AFTER(head, curelm, field);		\
+	}								\
+	TRASHIT(*oldnext);						\
+} while (0)
+
+#define STAILQ_REMOVE_AFTER(head, elm, field) do {			\
+	if ((STAILQ_NEXT(elm, field) =					\
+	     STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL)	\
+		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\
+} while (0)
+
+#define	STAILQ_REMOVE_HEAD(head, field) do {				\
+	if ((STAILQ_FIRST((head)) =					\
+	     STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL)		\
+		(head)->stqh_last = &STAILQ_FIRST((head));		\
+} while (0)
+
+#define STAILQ_SWAP(head1, head2, type) do {				\
+	struct type *swap_first = STAILQ_FIRST(head1);			\
+	struct type **swap_last = (head1)->stqh_last;			\
+	STAILQ_FIRST(head1) = STAILQ_FIRST(head2);			\
+	(head1)->stqh_last = (head2)->stqh_last;			\
+	STAILQ_FIRST(head2) = swap_first;				\
+	(head2)->stqh_last = swap_last;					\
+	if (STAILQ_EMPTY(head1))					\
+		(head1)->stqh_last = &STAILQ_FIRST(head1);		\
+	if (STAILQ_EMPTY(head2))					\
+		(head2)->stqh_last = &STAILQ_FIRST(head2);		\
+} while (0)
+
+
+/*
+ * List declarations.
+ */
+#define	LIST_HEAD(name, type)						\
+struct name {								\
+	struct type *lh_first;	/* first element */			\
+}
+
+#define	LIST_HEAD_INITIALIZER(head)					\
+	{ NULL }
+
+#define	LIST_ENTRY(type)						\
+struct {								\
+	struct type *le_next;	/* next element */			\
+	struct type **le_prev;	/* address of previous next element */	\
+}
+
+/*
+ * List functions.
+ */
+
+#if (defined(_KERNEL) && defined(INVARIANTS))
+#define	QMD_LIST_CHECK_HEAD(head, field) do {				\
+	if (LIST_FIRST((head)) != NULL &&				\
+	    LIST_FIRST((head))->field.le_prev !=			\
+	     &LIST_FIRST((head)))					\
+		panic("Bad list head %p first->prev != head", (head));	\
+} while (0)
+
+#define	QMD_LIST_CHECK_NEXT(elm, field) do {				\
+	if (LIST_NEXT((elm), field) != NULL &&				\
+	    LIST_NEXT((elm), field)->field.le_prev !=			\
+	     &((elm)->field.le_next))					\
+	     	panic("Bad link elm %p next->prev != elm", (elm));	\
+} while (0)
+
+#define	QMD_LIST_CHECK_PREV(elm, field) do {				\
+	if (*(elm)->field.le_prev != (elm))				\
+		panic("Bad link elm %p prev->next != elm", (elm));	\
+} while (0)
+#else
+#define	QMD_LIST_CHECK_HEAD(head, field)
+#define	QMD_LIST_CHECK_NEXT(elm, field)
+#define	QMD_LIST_CHECK_PREV(elm, field)
+#endif /* (_KERNEL && INVARIANTS) */
+
+#define	LIST_EMPTY(head)	((head)->lh_first == NULL)
+
+#define	LIST_FIRST(head)	((head)->lh_first)
+
+#define	LIST_FOREACH(var, head, field)					\
+	for ((var) = LIST_FIRST((head));				\
+	    (var);							\
+	    (var) = LIST_NEXT((var), field))
+
+#define	LIST_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = LIST_FIRST((head));				\
+	    (var) && ((tvar) = LIST_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	LIST_INIT(head) do {						\
+	LIST_FIRST((head)) = NULL;					\
+} while (0)
+
+#define	LIST_INSERT_AFTER(listelm, elm, field) do {			\
+	QMD_LIST_CHECK_NEXT(listelm, field);				\
+	if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\
+		LIST_NEXT((listelm), field)->field.le_prev =		\
+		    &LIST_NEXT((elm), field);				\
+	LIST_NEXT((listelm), field) = (elm);				\
+	(elm)->field.le_prev = &LIST_NEXT((listelm), field);		\
+} while (0)
+
+#define	LIST_INSERT_BEFORE(listelm, elm, field) do {			\
+	QMD_LIST_CHECK_PREV(listelm, field);				\
+	(elm)->field.le_prev = (listelm)->field.le_prev;		\
+	LIST_NEXT((elm), field) = (listelm);				\
+	*(listelm)->field.le_prev = (elm);				\
+	(listelm)->field.le_prev = &LIST_NEXT((elm), field);		\
+} while (0)
+
+#define	LIST_INSERT_HEAD(head, elm, field) do {				\
+	QMD_LIST_CHECK_HEAD((head), field);				\
+	if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL)	\
+		LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
+	LIST_FIRST((head)) = (elm);					\
+	(elm)->field.le_prev = &LIST_FIRST((head));			\
+} while (0)
+
+#define	LIST_NEXT(elm, field)	((elm)->field.le_next)
+
+#define	LIST_REMOVE(elm, field) do {					\
+	QMD_SAVELINK(oldnext, (elm)->field.le_next);			\
+	QMD_SAVELINK(oldprev, (elm)->field.le_prev);			\
+	QMD_LIST_CHECK_NEXT(elm, field);				\
+	QMD_LIST_CHECK_PREV(elm, field);				\
+	if (LIST_NEXT((elm), field) != NULL)				\
+		LIST_NEXT((elm), field)->field.le_prev = 		\
+		    (elm)->field.le_prev;				\
+	*(elm)->field.le_prev = LIST_NEXT((elm), field);		\
+	TRASHIT(*oldnext);						\
+	TRASHIT(*oldprev);						\
+} while (0)
+
+#define LIST_SWAP(head1, head2, type, field) do {			\
+	struct type *swap_tmp = LIST_FIRST((head1));			\
+	LIST_FIRST((head1)) = LIST_FIRST((head2));			\
+	LIST_FIRST((head2)) = swap_tmp;					\
+	if ((swap_tmp = LIST_FIRST((head1))) != NULL)			\
+		swap_tmp->field.le_prev = &LIST_FIRST((head1));		\
+	if ((swap_tmp = LIST_FIRST((head2))) != NULL)			\
+		swap_tmp->field.le_prev = &LIST_FIRST((head2));		\
+} while (0)
+
+/*
+ * Tail queue declarations.
+ */
+#define	TAILQ_HEAD(name, type)						\
+struct name {								\
+	struct type *tqh_first;	/* first element */			\
+	struct type **tqh_last;	/* addr of last next element */		\
+	TRACEBUF							\
+}
+
+#define	TAILQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).tqh_first }
+
+#define	TAILQ_ENTRY(type)						\
+struct {								\
+	struct type *tqe_next;	/* next element */			\
+	struct type **tqe_prev;	/* address of previous next element */	\
+	TRACEBUF							\
+}
+
+/*
+ * Tail queue functions.
+ */
+#if (defined(_KERNEL) && defined(INVARIANTS))
+#define	QMD_TAILQ_CHECK_HEAD(head, field) do {				\
+	if (!TAILQ_EMPTY(head) &&					\
+	    TAILQ_FIRST((head))->field.tqe_prev !=			\
+	     &TAILQ_FIRST((head)))					\
+		panic("Bad tailq head %p first->prev != head", (head));	\
+} while (0)
+
+#define	QMD_TAILQ_CHECK_TAIL(head, field) do {				\
+	if (*(head)->tqh_last != NULL)					\
+	    	panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head)); 	\
+} while (0)
+
+#define	QMD_TAILQ_CHECK_NEXT(elm, field) do {				\
+	if (TAILQ_NEXT((elm), field) != NULL &&				\
+	    TAILQ_NEXT((elm), field)->field.tqe_prev !=			\
+	     &((elm)->field.tqe_next))					\
+		panic("Bad link elm %p next->prev != elm", (elm));	\
+} while (0)
+
+#define	QMD_TAILQ_CHECK_PREV(elm, field) do {				\
+	if (*(elm)->field.tqe_prev != (elm))				\
+		panic("Bad link elm %p prev->next != elm", (elm));	\
+} while (0)
+#else
+#define	QMD_TAILQ_CHECK_HEAD(head, field)
+#define	QMD_TAILQ_CHECK_TAIL(head, headname)
+#define	QMD_TAILQ_CHECK_NEXT(elm, field)
+#define	QMD_TAILQ_CHECK_PREV(elm, field)
+#endif /* (_KERNEL && INVARIANTS) */
+
+#define	TAILQ_CONCAT(head1, head2, field) do {				\
+	if (!TAILQ_EMPTY(head2)) {					\
+		*(head1)->tqh_last = (head2)->tqh_first;		\
+		(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last;	\
+		(head1)->tqh_last = (head2)->tqh_last;			\
+		TAILQ_INIT((head2));					\
+		QMD_TRACE_HEAD(head1);					\
+		QMD_TRACE_HEAD(head2);					\
+	}								\
+} while (0)
+
+#define	TAILQ_EMPTY(head)	((head)->tqh_first == NULL)
+
+#define	TAILQ_FIRST(head)	((head)->tqh_first)
+
+#define	TAILQ_FOREACH(var, head, field)					\
+	for ((var) = TAILQ_FIRST((head));				\
+	    (var);							\
+	    (var) = TAILQ_NEXT((var), field))
+
+#define	TAILQ_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = TAILQ_FIRST((head));				\
+	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	TAILQ_FOREACH_REVERSE(var, head, headname, field)		\
+	for ((var) = TAILQ_LAST((head), headname);			\
+	    (var);							\
+	    (var) = TAILQ_PREV((var), headname, field))
+
+#define	TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar)	\
+	for ((var) = TAILQ_LAST((head), headname);			\
+	    (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\
+	    (var) = (tvar))
+
+#define	TAILQ_INIT(head) do {						\
+	TAILQ_FIRST((head)) = NULL;					\
+	(head)->tqh_last = &TAILQ_FIRST((head));			\
+	QMD_TRACE_HEAD(head);						\
+} while (0)
+
+#define	TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	QMD_TAILQ_CHECK_NEXT(listelm, field);				\
+	if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
+		TAILQ_NEXT((elm), field)->field.tqe_prev = 		\
+		    &TAILQ_NEXT((elm), field);				\
+	else {								\
+		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
+		QMD_TRACE_HEAD(head);					\
+	}								\
+	TAILQ_NEXT((listelm), field) = (elm);				\
+	(elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field);		\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+	QMD_TRACE_ELEM(&listelm->field);				\
+} while (0)
+
+#define	TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\
+	QMD_TAILQ_CHECK_PREV(listelm, field);				\
+	(elm)->field.tqe_prev = (listelm)->field.tqe_prev;		\
+	TAILQ_NEXT((elm), field) = (listelm);				\
+	*(listelm)->field.tqe_prev = (elm);				\
+	(listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field);		\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+	QMD_TRACE_ELEM(&listelm->field);				\
+} while (0)
+
+#define	TAILQ_INSERT_HEAD(head, elm, field) do {			\
+	QMD_TAILQ_CHECK_HEAD(head, field);				\
+	if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL)	\
+		TAILQ_FIRST((head))->field.tqe_prev =			\
+		    &TAILQ_NEXT((elm), field);				\
+	else								\
+		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
+	TAILQ_FIRST((head)) = (elm);					\
+	(elm)->field.tqe_prev = &TAILQ_FIRST((head));			\
+	QMD_TRACE_HEAD(head);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define	TAILQ_INSERT_TAIL(head, elm, field) do {			\
+	QMD_TAILQ_CHECK_TAIL(head, field);				\
+	TAILQ_NEXT((elm), field) = NULL;				\
+	(elm)->field.tqe_prev = (head)->tqh_last;			\
+	*(head)->tqh_last = (elm);					\
+	(head)->tqh_last = &TAILQ_NEXT((elm), field);			\
+	QMD_TRACE_HEAD(head);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define	TAILQ_LAST(head, headname)					\
+	(*(((struct headname *)((head)->tqh_last))->tqh_last))
+
+#define	TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
+
+#define	TAILQ_PREV(elm, headname, field)				\
+	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+
+#define	TAILQ_REMOVE(head, elm, field) do {				\
+	QMD_SAVELINK(oldnext, (elm)->field.tqe_next);			\
+	QMD_SAVELINK(oldprev, (elm)->field.tqe_prev);			\
+	QMD_TAILQ_CHECK_NEXT(elm, field);				\
+	QMD_TAILQ_CHECK_PREV(elm, field);				\
+	if ((TAILQ_NEXT((elm), field)) != NULL)				\
+		TAILQ_NEXT((elm), field)->field.tqe_prev = 		\
+		    (elm)->field.tqe_prev;				\
+	else {								\
+		(head)->tqh_last = (elm)->field.tqe_prev;		\
+		QMD_TRACE_HEAD(head);					\
+	}								\
+	*(elm)->field.tqe_prev = TAILQ_NEXT((elm), field);		\
+	TRASHIT(*oldnext);						\
+	TRASHIT(*oldprev);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define TAILQ_SWAP(head1, head2, type, field) do {			\
+	struct type *swap_first = (head1)->tqh_first;			\
+	struct type **swap_last = (head1)->tqh_last;			\
+	(head1)->tqh_first = (head2)->tqh_first;			\
+	(head1)->tqh_last = (head2)->tqh_last;				\
+	(head2)->tqh_first = swap_first;				\
+	(head2)->tqh_last = swap_last;					\
+	if ((swap_first = (head1)->tqh_first) != NULL)			\
+		swap_first->field.tqe_prev = &(head1)->tqh_first;	\
+	else								\
+		(head1)->tqh_last = &(head1)->tqh_first;		\
+	if ((swap_first = (head2)->tqh_first) != NULL)			\
+		swap_first->field.tqe_prev = &(head2)->tqh_first;	\
+	else								\
+		(head2)->tqh_last = &(head2)->tqh_first;		\
+} while (0)
+
+#endif /* !_SYS_QUEUE_H_ */
diff -r 6c9a73817770 -r 934c14ab9f19 tools/libxl/Makefile
--- a/tools/libxl/Makefile	Tue Jan 31 11:39:37 2012 +0000
+++ b/tools/libxl/Makefile	Tue Jan 31 16:06:14 2012 +0000
@@ -93,8 +93,8 @@
 	rm -f $@.tmp
 	$(call move-if-changed,$@.2.tmp,$@)
 
-_libxl_list.h: bsd-sys-queue-h-seddery external/bsd-sys-queue.h
-	perl ./$^ --prefix=libxl >$@.new
+_libxl_list.h: $(XEN_INCLUDE)/xen-external/bsd-sys-queue-h-seddery $(XEN_INCLUDE)/xen-external/bsd-sys-queue.h
+	perl $^ --prefix=libxl >$@.new
 	$(call move-if-changed,$@.new,$@)
 
 libxl_paths.c: _libxl_paths.h
diff -r 6c9a73817770 -r 934c14ab9f19 tools/libxl/bsd-sys-queue-h-seddery
--- a/tools/libxl/bsd-sys-queue-h-seddery	Tue Jan 31 11:39:37 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-#!/usr/bin/perl -p
-#
-# This script is part of the Xen build system.  It has a very
-# permissive licence to avoid complicating the licence of the
-# generated header file and to allow this seddery to be reused by
-# other projects.
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this individual file (the "Software"), to deal
-# in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute,
-# sublicense, and/or sell copies of the Software, and to permit
-# persons to whom the Software is furnished to do so, subject to the
-# following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-#
-# Copyright (C) 2011 Citrix Ltd
-
-our $namespace, $ucnamespace;
-
-BEGIN {
-    die unless @ARGV;
-    $namespace = pop @ARGV;
-    $namespace =~ s/^--prefix=// or die;
-    $ucnamespace = uc $namespace;
-
-    print <<END or die $!;
-/*
- * DO NOT EDIT THIS FILE
- *
- * Generated automatically by bsd-sys-queue-h-seddery to
- *  - introduce ${ucnamespace}_ and ${namespace}_ namespace prefixes
- *  - turn "struct type" into "type" so that type arguments
- *     to the macros are type names not struct tags
- *  - remove the reference to sys/cdefs.h, which is not needed
- *
- * The purpose of this seddery is to allow the resulting file to be
- * freely included by software which might also want to include other
- * list macros; to make it usable when struct tags are not being used
- * or not known; to make it more portable.
- */
-END
-}
-
-s/\b( _SYS_QUEUE |
-      SLIST | LIST | STAILQ | TAILQ | QUEUE
-      )/${ucnamespace}_$1/xg;
-
-s/\b( TRACEBUF | TRASHIT |
-      QMD_
-      )/${ucnamespace}__$1/xg;
-
-s/\b(
-      qm_
-      )/${namespace}__$1/xg;
-
-s/\b struct \s+ type \b/type/xg;
-
-s,^\#include.*sys/cdefs.*,/* $& */,xg;
diff -r 6c9a73817770 -r 934c14ab9f19 tools/libxl/external/README
--- a/tools/libxl/external/README	Tue Jan 31 11:39:37 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-WARNING - DO NOT EDIT THINGS IN THIS DIRECTORY (apart from this README)
------------------------------------------------------------------------
-
-These files were obtained elsewhere and should only be updated by
-copying new versions from the source location, as documented below:
-
-bsd-COPYRIGHT
-bsd-sys-queue.h
-bsd-queue.3
-
-  Obtained from the FreeBSD SVN using the following commands:
-    svn co -r 221843 svn://svn.freebsd.org/base/head/sys/sys/
-    svn co -r 221843 svn://svn.freebsd.org/base/head/share/man/man3
-    svn cat -r 221843 http://svn.freebsd.org/base/head/COPYRIGHT >tools/libxl/external/bsd-COPYRIGHT
diff -r 6c9a73817770 -r 934c14ab9f19 tools/libxl/external/bsd-COPYRIGHT
--- a/tools/libxl/external/bsd-COPYRIGHT	Tue Jan 31 11:39:37 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-# $FreeBSD$
-#	@(#)COPYRIGHT	8.2 (Berkeley) 3/21/94
-
-The compilation of software known as FreeBSD is distributed under the
-following terms:
-
-Copyright (c) 1992-2011 The FreeBSD Project. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
-The 4.4BSD and 4.4BSD-Lite software is distributed under the following
-terms:
-
-All of the documentation and software included in the 4.4BSD and 4.4BSD-Lite
-Releases is copyrighted by The Regents of the University of California.
-
-Copyright 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
-	The Regents of the University of California.  All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-3. All advertising materials mentioning features or use of this software
-   must display the following acknowledgement:
-This product includes software developed by the University of
-California, Berkeley and its contributors.
-4. Neither the name of the University nor the names of its contributors
-   may be used to endorse or promote products derived from this software
-   without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
-The Institute of Electrical and Electronics Engineers and the American
-National Standards Committee X3, on Information Processing Systems have
-given us permission to reprint portions of their documentation.
-
-In the following statement, the phrase ``this text'' refers to portions
-of the system documentation.
-
-Portions of this text are reprinted and reproduced in electronic form in
-the second BSD Networking Software Release, from IEEE Std 1003.1-1988, IEEE
-Standard Portable Operating System Interface for Computer Environments
-(POSIX), copyright C 1988 by the Institute of Electrical and Electronics
-Engineers, Inc.  In the event of any discrepancy between these versions
-and the original IEEE Standard, the original IEEE Standard is the referee
-document.
-
-In the following statement, the phrase ``This material'' refers to portions
-of the system documentation.
-
-This material is reproduced with permission from American National
-Standards Committee X3, on Information Processing Systems.  Computer and
-Business Equipment Manufacturers Association (CBEMA), 311 First St., NW,
-Suite 500, Washington, DC 20001-2178.  The developmental work of
-Programming Language C was completed by the X3J11 Technical Committee.
-
-The views and conclusions contained in the software and documentation are
-those of the authors and should not be interpreted as representing official
-policies, either expressed or implied, of the Regents of the University
-of California.
-
-
-NOTE: The copyright of UC Berkeley's Berkeley Software Distribution ("BSD")
-source has been updated.  The copyright addendum may be found at
-ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change and is
-included below.
-
-July 22, 1999
-
-To All Licensees, Distributors of Any Version of BSD:
-
-As you know, certain of the Berkeley Software Distribution ("BSD") source
-code files require that further distributions of products containing all or
-portions of the software, acknowledge within their advertising materials
-that such products contain software developed by UC Berkeley and its
-contributors.
-
-Specifically, the provision reads:
-
-"     * 3. All advertising materials mentioning features or use of this software
-      *    must display the following acknowledgement:
-      *    This product includes software developed by the University of
-      *    California, Berkeley and its contributors."
-
-Effective immediately, licensees and distributors are no longer required to
-include the acknowledgement within advertising materials.  Accordingly, the
-foregoing paragraph of those BSD Unix files containing it is hereby deleted
-in its entirety.
-
-William Hoskins
-Director, Office of Technology Licensing
-University of California, Berkeley
diff -r 6c9a73817770 -r 934c14ab9f19 tools/libxl/external/bsd-queue.3
--- a/tools/libxl/external/bsd-queue.3	Tue Jan 31 11:39:37 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1044 +0,0 @@
-.\" Copyright (c) 1993
-.\"	The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"	@(#)queue.3	8.2 (Berkeley) 1/24/94
-.\" $FreeBSD$
-.\"
-.Dd May 13, 2011
-.Dt QUEUE 3
-.Os
-.Sh NAME
-.Nm SLIST_EMPTY ,
-.Nm SLIST_ENTRY ,
-.Nm SLIST_FIRST ,
-.Nm SLIST_FOREACH ,
-.Nm SLIST_FOREACH_SAFE ,
-.Nm SLIST_HEAD ,
-.Nm SLIST_HEAD_INITIALIZER ,
-.Nm SLIST_INIT ,
-.Nm SLIST_INSERT_AFTER ,
-.Nm SLIST_INSERT_HEAD ,
-.Nm SLIST_NEXT ,
-.Nm SLIST_REMOVE_AFTER ,
-.Nm SLIST_REMOVE_HEAD ,
-.Nm SLIST_REMOVE ,
-.Nm SLIST_SWAP ,
-.Nm STAILQ_CONCAT ,
-.Nm STAILQ_EMPTY ,
-.Nm STAILQ_ENTRY ,
-.Nm STAILQ_FIRST ,
-.Nm STAILQ_FOREACH ,
-.Nm STAILQ_FOREACH_SAFE ,
-.Nm STAILQ_HEAD ,
-.Nm STAILQ_HEAD_INITIALIZER ,
-.Nm STAILQ_INIT ,
-.Nm STAILQ_INSERT_AFTER ,
-.Nm STAILQ_INSERT_HEAD ,
-.Nm STAILQ_INSERT_TAIL ,
-.Nm STAILQ_LAST ,
-.Nm STAILQ_NEXT ,
-.Nm STAILQ_REMOVE_AFTER ,
-.Nm STAILQ_REMOVE_HEAD ,
-.Nm STAILQ_REMOVE ,
-.Nm STAILQ_SWAP ,
-.Nm LIST_EMPTY ,
-.Nm LIST_ENTRY ,
-.Nm LIST_FIRST ,
-.Nm LIST_FOREACH ,
-.Nm LIST_FOREACH_SAFE ,
-.Nm LIST_HEAD ,
-.Nm LIST_HEAD_INITIALIZER ,
-.Nm LIST_INIT ,
-.Nm LIST_INSERT_AFTER ,
-.Nm LIST_INSERT_BEFORE ,
-.Nm LIST_INSERT_HEAD ,
-.Nm LIST_NEXT ,
-.Nm LIST_REMOVE ,
-.Nm LIST_SWAP ,
-.Nm TAILQ_CONCAT ,
-.Nm TAILQ_EMPTY ,
-.Nm TAILQ_ENTRY ,
-.Nm TAILQ_FIRST ,
-.Nm TAILQ_FOREACH ,
-.Nm TAILQ_FOREACH_SAFE ,
-.Nm TAILQ_FOREACH_REVERSE ,
-.Nm TAILQ_FOREACH_REVERSE_SAFE ,
-.Nm TAILQ_HEAD ,
-.Nm TAILQ_HEAD_INITIALIZER ,
-.Nm TAILQ_INIT ,
-.Nm TAILQ_INSERT_AFTER ,
-.Nm TAILQ_INSERT_BEFORE ,
-.Nm TAILQ_INSERT_HEAD ,
-.Nm TAILQ_INSERT_TAIL ,
-.Nm TAILQ_LAST ,
-.Nm TAILQ_NEXT ,
-.Nm TAILQ_PREV ,
-.Nm TAILQ_REMOVE ,
-.Nm TAILQ_SWAP
-.Nd implementations of singly-linked lists, singly-linked tail queues,
-lists and tail queues
-.Sh SYNOPSIS
-.In sys/queue.h
-.\"
-.Fn SLIST_EMPTY "SLIST_HEAD *head"
-.Fn SLIST_ENTRY "TYPE"
-.Fn SLIST_FIRST "SLIST_HEAD *head"
-.Fn SLIST_FOREACH "TYPE *var" "SLIST_HEAD *head" "SLIST_ENTRY NAME"
-.Fn SLIST_FOREACH_SAFE "TYPE *var" "SLIST_HEAD *head" "SLIST_ENTRY NAME" "TYPE *temp_var"
-.Fn SLIST_HEAD "HEADNAME" "TYPE"
-.Fn SLIST_HEAD_INITIALIZER "SLIST_HEAD head"
-.Fn SLIST_INIT "SLIST_HEAD *head"
-.Fn SLIST_INSERT_AFTER "TYPE *listelm" "TYPE *elm" "SLIST_ENTRY NAME"
-.Fn SLIST_INSERT_HEAD "SLIST_HEAD *head" "TYPE *elm" "SLIST_ENTRY NAME"
-.Fn SLIST_NEXT "TYPE *elm" "SLIST_ENTRY NAME"
-.Fn SLIST_REMOVE_AFTER "TYPE *elm" "SLIST_ENTRY NAME"
-.Fn SLIST_REMOVE_HEAD "SLIST_HEAD *head" "SLIST_ENTRY NAME"
-.Fn SLIST_REMOVE "SLIST_HEAD *head" "TYPE *elm" "TYPE" "SLIST_ENTRY NAME"
-.Fn SLIST_SWAP "SLIST_HEAD *head1" "SLIST_HEAD *head2" "SLIST_ENTRY NAME"
-.\"
-.Fn STAILQ_CONCAT "STAILQ_HEAD *head1" "STAILQ_HEAD *head2"
-.Fn STAILQ_EMPTY "STAILQ_HEAD *head"
-.Fn STAILQ_ENTRY "TYPE"
-.Fn STAILQ_FIRST "STAILQ_HEAD *head"
-.Fn STAILQ_FOREACH "TYPE *var" "STAILQ_HEAD *head" "STAILQ_ENTRY NAME"
-.Fn STAILQ_FOREACH_SAFE "TYPE *var" "STAILQ_HEAD *head" "STAILQ_ENTRY NAME" "TYPE *temp_var"
-.Fn STAILQ_HEAD "HEADNAME" "TYPE"
-.Fn STAILQ_HEAD_INITIALIZER "STAILQ_HEAD head"
-.Fn STAILQ_INIT "STAILQ_HEAD *head"
-.Fn STAILQ_INSERT_AFTER "STAILQ_HEAD *head" "TYPE *listelm" "TYPE *elm" "STAILQ_ENTRY NAME"
-.Fn STAILQ_INSERT_HEAD "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
-.Fn STAILQ_INSERT_TAIL "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
-.Fn STAILQ_LAST "STAILQ_HEAD *head" "TYPE" "STAILQ_ENTRY NAME"
-.Fn STAILQ_NEXT "TYPE *elm" "STAILQ_ENTRY NAME"
-.Fn STAILQ_REMOVE_AFTER "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
-.Fn STAILQ_REMOVE_HEAD "STAILQ_HEAD *head" "STAILQ_ENTRY NAME"
-.Fn STAILQ_REMOVE "STAILQ_HEAD *head" "TYPE *elm" "TYPE" "STAILQ_ENTRY NAME"
-.Fn STAILQ_SWAP "STAILQ_HEAD *head1" "STAILQ_HEAD *head2" "STAILQ_ENTRY NAME"
-.\"
-.Fn LIST_EMPTY "LIST_HEAD *head"
-.Fn LIST_ENTRY "TYPE"
-.Fn LIST_FIRST "LIST_HEAD *head"
-.Fn LIST_FOREACH "TYPE *var" "LIST_HEAD *head" "LIST_ENTRY NAME"
-.Fn LIST_FOREACH_SAFE "TYPE *var" "LIST_HEAD *head" "LIST_ENTRY NAME" "TYPE *temp_var"
-.Fn LIST_HEAD "HEADNAME" "TYPE"
-.Fn LIST_HEAD_INITIALIZER "LIST_HEAD head"
-.Fn LIST_INIT "LIST_HEAD *head"
-.Fn LIST_INSERT_AFTER "TYPE *listelm" "TYPE *elm" "LIST_ENTRY NAME"
-.Fn LIST_INSERT_BEFORE "TYPE *listelm" "TYPE *elm" "LIST_ENTRY NAME"
-.Fn LIST_INSERT_HEAD "LIST_HEAD *head" "TYPE *elm" "LIST_ENTRY NAME"
-.Fn LIST_NEXT "TYPE *elm" "LIST_ENTRY NAME"
-.Fn LIST_REMOVE "TYPE *elm" "LIST_ENTRY NAME"
-.Fn LIST_SWAP "LIST_HEAD *head1" "LIST_HEAD *head2" "TYPE" "LIST_ENTRY NAME"
-.\"
-.Fn TAILQ_CONCAT "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "TAILQ_ENTRY NAME"
-.Fn TAILQ_EMPTY "TAILQ_HEAD *head"
-.Fn TAILQ_ENTRY "TYPE"
-.Fn TAILQ_FIRST "TAILQ_HEAD *head"
-.Fn TAILQ_FOREACH "TYPE *var" "TAILQ_HEAD *head" "TAILQ_ENTRY NAME"
-.Fn TAILQ_FOREACH_SAFE "TYPE *var" "TAILQ_HEAD *head" "TAILQ_ENTRY NAME" "TYPE *temp_var"
-.Fn TAILQ_FOREACH_REVERSE "TYPE *var" "TAILQ_HEAD *head" "HEADNAME" "TAILQ_ENTRY NAME"
-.Fn TAILQ_FOREACH_REVERSE_SAFE "TYPE *var" "TAILQ_HEAD *head" "HEADNAME" "TAILQ_ENTRY NAME" "TYPE *temp_var"
-.Fn TAILQ_HEAD "HEADNAME" "TYPE"
-.Fn TAILQ_HEAD_INITIALIZER "TAILQ_HEAD head"
-.Fn TAILQ_INIT "TAILQ_HEAD *head"
-.Fn TAILQ_INSERT_AFTER "TAILQ_HEAD *head" "TYPE *listelm" "TYPE *elm" "TAILQ_ENTRY NAME"
-.Fn TAILQ_INSERT_BEFORE "TYPE *listelm" "TYPE *elm" "TAILQ_ENTRY NAME"
-.Fn TAILQ_INSERT_HEAD "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME"
-.Fn TAILQ_INSERT_TAIL "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME"
-.Fn TAILQ_LAST "TAILQ_HEAD *head" "HEADNAME"
-.Fn TAILQ_NEXT "TYPE *elm" "TAILQ_ENTRY NAME"
-.Fn TAILQ_PREV "TYPE *elm" "HEADNAME" "TAILQ_ENTRY NAME"
-.Fn TAILQ_REMOVE "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME"
-.Fn TAILQ_SWAP "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "TYPE" "TAILQ_ENTRY NAME"
-.\"
-.Sh DESCRIPTION
-These macros define and operate on four types of data structures:
-singly-linked lists, singly-linked tail queues, lists, and tail queues.
-All four structures support the following functionality:
-.Bl -enum -compact -offset indent
-.It
-Insertion of a new entry at the head of the list.
-.It
-Insertion of a new entry after any element in the list.
-.It
-O(1) removal of an entry from the head of the list.
-.It
-Forward traversal through the list.
-.It
-Swawpping the contents of two lists.
-.El
-.Pp
-Singly-linked lists are the simplest of the four data structures
-and support only the above functionality.
-Singly-linked lists are ideal for applications with large datasets
-and few or no removals,
-or for implementing a LIFO queue.
-Singly-linked lists add the following functionality:
-.Bl -enum -compact -offset indent
-.It
-O(n) removal of any entry in the list.
-.El
-.Pp
-Singly-linked tail queues add the following functionality:
-.Bl -enum -compact -offset indent
-.It
-Entries can be added at the end of a list.
-.It
-O(n) removal of any entry in the list.
-.It
-They may be concatenated.
-.El
-However:
-.Bl -enum -compact -offset indent
-.It
-All list insertions must specify the head of the list.
-.It
-Each head entry requires two pointers rather than one.
-.It
-Code size is about 15% greater and operations run about 20% slower
-than singly-linked lists.
-.El
-.Pp
-Singly-linked tailqs are ideal for applications with large datasets and
-few or no removals,
-or for implementing a FIFO queue.
-.Pp
-All doubly linked types of data structures (lists and tail queues)
-additionally allow:
-.Bl -enum -compact -offset indent
-.It
-Insertion of a new entry before any element in the list.
-.It
-O(1) removal of any entry in the list.
-.El
-However:
-.Bl -enum -compact -offset indent
-.It
-Each element requires two pointers rather than one.
-.It
-Code size and execution time of operations (except for removal) is about
-twice that of the singly-linked data-structures.
-.El
-.Pp
-Linked lists are the simplest of the doubly linked data structures and support
-only the above functionality over singly-linked lists.
-.Pp
-Tail queues add the following functionality:
-.Bl -enum -compact -offset indent
-.It
-Entries can be added at the end of a list.
-.It
-They may be traversed backwards, from tail to head.
-.It
-They may be concatenated.
-.El
-However:
-.Bl -enum -compact -offset indent
-.It
-All list insertions and removals must specify the head of the list.
-.It
-Each head entry requires two pointers rather than one.
-.It
-Code size is about 15% greater and operations run about 20% slower
-than singly-linked lists.
-.El
-.Pp
-In the macro definitions,
-.Fa TYPE
-is the name of a user defined structure,
-that must contain a field of type
-.Li SLIST_ENTRY ,
-.Li STAILQ_ENTRY ,
-.Li LIST_ENTRY ,
-or
-.Li TAILQ_ENTRY ,
-named
-.Fa NAME .
-The argument
-.Fa HEADNAME
-is the name of a user defined structure that must be declared
-using the macros
-.Li SLIST_HEAD ,
-.Li STAILQ_HEAD ,
-.Li LIST_HEAD ,
-or
-.Li TAILQ_HEAD .
-See the examples below for further explanation of how these
-macros are used.
-.Sh SINGLY-LINKED LISTS
-A singly-linked list is headed by a structure defined by the
-.Nm SLIST_HEAD
-macro.
-This structure contains a single pointer to the first element
-on the list.
-The elements are singly linked for minimum space and pointer manipulation
-overhead at the expense of O(n) removal for arbitrary elements.
-New elements can be added to the list after an existing element or
-at the head of the list.
-An
-.Fa SLIST_HEAD
-structure is declared as follows:
-.Bd -literal -offset indent
-SLIST_HEAD(HEADNAME, TYPE) head;
-.Ed
-.Pp
-where
-.Fa HEADNAME
-is the name of the structure to be defined, and
-.Fa TYPE
-is the type of the elements to be linked into the list.
-A pointer to the head of the list can later be declared as:
-.Bd -literal -offset indent
-struct HEADNAME *headp;
-.Ed
-.Pp
-(The names
-.Li head
-and
-.Li headp
-are user selectable.)
-.Pp
-The macro
-.Nm SLIST_HEAD_INITIALIZER
-evaluates to an initializer for the list
-.Fa head .
-.Pp
-The macro
-.Nm SLIST_EMPTY
-evaluates to true if there are no elements in the list.
-.Pp
-The macro
-.Nm SLIST_ENTRY
-declares a structure that connects the elements in
-the list.
-.Pp
-The macro
-.Nm SLIST_FIRST
-returns the first element in the list or NULL if the list is empty.
-.Pp
-The macro
-.Nm SLIST_FOREACH
-traverses the list referenced by
-.Fa head
-in the forward direction, assigning each element in
-turn to
-.Fa var .
-.Pp
-The macro
-.Nm SLIST_FOREACH_SAFE
-traverses the list referenced by
-.Fa head
-in the forward direction, assigning each element in
-turn to
-.Fa var .
-However, unlike
-.Fn SLIST_FOREACH
-here it is permitted to both remove
-.Fa var
-as well as free it from within the loop safely without interfering with the
-traversal.
-.Pp
-The macro
-.Nm SLIST_INIT
-initializes the list referenced by
-.Fa head .
-.Pp
-The macro
-.Nm SLIST_INSERT_HEAD
-inserts the new element
-.Fa elm
-at the head of the list.
-.Pp
-The macro
-.Nm SLIST_INSERT_AFTER
-inserts the new element
-.Fa elm
-after the element
-.Fa listelm .
-.Pp
-The macro
-.Nm SLIST_NEXT
-returns the next element in the list.
-.Pp
-The macro
-.Nm SLIST_REMOVE_AFTER
-removes the element after
-.Fa elm
-from the list. Unlike
-.Fa SLIST_REMOVE ,
-this macro does not traverse the entire list.
-.Pp
-The macro
-.Nm SLIST_REMOVE_HEAD
-removes the element
-.Fa elm
-from the head of the list.
-For optimum efficiency,
-elements being removed from the head of the list should explicitly use
-this macro instead of the generic
-.Fa SLIST_REMOVE
-macro.
-.Pp
-The macro
-.Nm SLIST_REMOVE
-removes the element
-.Fa elm
-from the list.
-.Pp
-The macro
-.Nm SLIST_SWAP
-swaps the contents of
-.Fa head1
-and
-.Fa head2 .
-.Sh SINGLY-LINKED LIST EXAMPLE
-.Bd -literal
-SLIST_HEAD(slisthead, entry) head =
-    SLIST_HEAD_INITIALIZER(head);
-struct slisthead *headp;		/* Singly-linked List head. */
-struct entry {
-	...
-	SLIST_ENTRY(entry) entries;	/* Singly-linked List. */
-	...
-} *n1, *n2, *n3, *np;
-
-SLIST_INIT(&head);			/* Initialize the list. */
-
-n1 = malloc(sizeof(struct entry));	/* Insert at the head. */
-SLIST_INSERT_HEAD(&head, n1, entries);
-
-n2 = malloc(sizeof(struct entry));	/* Insert after. */
-SLIST_INSERT_AFTER(n1, n2, entries);
-
-SLIST_REMOVE(&head, n2, entry, entries);/* Deletion. */
-free(n2);
-
-n3 = SLIST_FIRST(&head);
-SLIST_REMOVE_HEAD(&head, entries);	/* Deletion from the head. */
-free(n3);
-					/* Forward traversal. */
-SLIST_FOREACH(np, &head, entries)
-	np-> ...
-					/* Safe forward traversal. */
-SLIST_FOREACH_SAFE(np, &head, entries, np_temp) {
-	np->do_stuff();
-	...
-	SLIST_REMOVE(&head, np, entry, entries);
-	free(np);
-}
-
-while (!SLIST_EMPTY(&head)) {		/* List Deletion. */
-	n1 = SLIST_FIRST(&head);
-	SLIST_REMOVE_HEAD(&head, entries);
-	free(n1);
-}
-.Ed
-.Sh SINGLY-LINKED TAIL QUEUES
-A singly-linked tail queue is headed by a structure defined by the
-.Nm STAILQ_HEAD
-macro.
-This structure contains a pair of pointers,
-one to the first element in the tail queue and the other to
-the last element in the tail queue.
-The elements are singly linked for minimum space and pointer
-manipulation overhead at the expense of O(n) removal for arbitrary
-elements.
-New elements can be added to the tail queue after an existing element,
-at the head of the tail queue, or at the end of the tail queue.
-A
-.Fa STAILQ_HEAD
-structure is declared as follows:
-.Bd -literal -offset indent
-STAILQ_HEAD(HEADNAME, TYPE) head;
-.Ed
-.Pp
-where
-.Li HEADNAME
-is the name of the structure to be defined, and
-.Li TYPE
-is the type of the elements to be linked into the tail queue.
-A pointer to the head of the tail queue can later be declared as:
-.Bd -literal -offset indent
-struct HEADNAME *headp;
-.Ed
-.Pp
-(The names
-.Li head
-and
-.Li headp
-are user selectable.)
-.Pp
-The macro
-.Nm STAILQ_HEAD_INITIALIZER
-evaluates to an initializer for the tail queue
-.Fa head .
-.Pp
-The macro
-.Nm STAILQ_CONCAT
-concatenates the tail queue headed by
-.Fa head2
-onto the end of the one headed by
-.Fa head1
-removing all entries from the former.
-.Pp
-The macro
-.Nm STAILQ_EMPTY
-evaluates to true if there are no items on the tail queue.
-.Pp
-The macro
-.Nm STAILQ_ENTRY
-declares a structure that connects the elements in
-the tail queue.
-.Pp
-The macro
-.Nm STAILQ_FIRST
-returns the first item on the tail queue or NULL if the tail queue
-is empty.
-.Pp
-The macro
-.Nm STAILQ_FOREACH
-traverses the tail queue referenced by
-.Fa head
-in the forward direction, assigning each element
-in turn to
-.Fa var .
-.Pp
-The macro
-.Nm STAILQ_FOREACH_SAFE
-traverses the tail queue referenced by
-.Fa head
-in the forward direction, assigning each element
-in turn to
-.Fa var .
-However, unlike
-.Fn STAILQ_FOREACH
-here it is permitted to both remove
-.Fa var
-as well as free it from within the loop safely without interfering with the
-traversal.
-.Pp
-The macro
-.Nm STAILQ_INIT
-initializes the tail queue referenced by
-.Fa head .
-.Pp
-The macro
-.Nm STAILQ_INSERT_HEAD
-inserts the new element
-.Fa elm
-at the head of the tail queue.
-.Pp
-The macro
-.Nm STAILQ_INSERT_TAIL
-inserts the new element
-.Fa elm
-at the end of the tail queue.
-.Pp
-The macro
-.Nm STAILQ_INSERT_AFTER
-inserts the new element
-.Fa elm
-after the element
-.Fa listelm .
-.Pp
-The macro
-.Nm STAILQ_LAST
-returns the last item on the tail queue.
-If the tail queue is empty the return value is
-.Dv NULL .
-.Pp
-The macro
-.Nm STAILQ_NEXT
-returns the next item on the tail queue, or NULL this item is the last.
-.Pp
-The macro
-.Nm STAILQ_REMOVE_AFTER
-removes the element after
-.Fa elm
-from the tail queue. Unlike
-.Fa STAILQ_REMOVE ,
-this macro does not traverse the entire tail queue.
-.Pp
-The macro
-.Nm STAILQ_REMOVE_HEAD
-removes the element at the head of the tail queue.
-For optimum efficiency,
-elements being removed from the head of the tail queue should
-use this macro explicitly rather than the generic
-.Fa STAILQ_REMOVE
-macro.
-.Pp
-The macro
-.Nm STAILQ_REMOVE
-removes the element
-.Fa elm
-from the tail queue.
-.Pp
-The macro
-.Nm STAILQ_SWAP
-swaps the contents of
-.Fa head1
-and
-.Fa head2 .
-.Sh SINGLY-LINKED TAIL QUEUE EXAMPLE
-.Bd -literal
-STAILQ_HEAD(stailhead, entry) head =
-    STAILQ_HEAD_INITIALIZER(head);
-struct stailhead *headp;		/* Singly-linked tail queue head. */
-struct entry {
-	...
-	STAILQ_ENTRY(entry) entries;	/* Tail queue. */
-	...
-} *n1, *n2, *n3, *np;
-
-STAILQ_INIT(&head);			/* Initialize the queue. */
-
-n1 = malloc(sizeof(struct entry));	/* Insert at the head. */
-STAILQ_INSERT_HEAD(&head, n1, entries);
-
-n1 = malloc(sizeof(struct entry));	/* Insert at the tail. */
-STAILQ_INSERT_TAIL(&head, n1, entries);
-
-n2 = malloc(sizeof(struct entry));	/* Insert after. */
-STAILQ_INSERT_AFTER(&head, n1, n2, entries);
-					/* Deletion. */
-STAILQ_REMOVE(&head, n2, entry, entries);
-free(n2);
-					/* Deletion from the head. */
-n3 = STAILQ_FIRST(&head);
-STAILQ_REMOVE_HEAD(&head, entries);
-free(n3);
-					/* Forward traversal. */
-STAILQ_FOREACH(np, &head, entries)
-	np-> ...
-					/* Safe forward traversal. */
-STAILQ_FOREACH_SAFE(np, &head, entries, np_temp) {
-	np->do_stuff();
-	...
-	STAILQ_REMOVE(&head, np, entry, entries);
-	free(np);
-}
-					/* TailQ Deletion. */
-while (!STAILQ_EMPTY(&head)) {
-	n1 = STAILQ_FIRST(&head);
-	STAILQ_REMOVE_HEAD(&head, entries);
-	free(n1);
-}
-					/* Faster TailQ Deletion. */
-n1 = STAILQ_FIRST(&head);
-while (n1 != NULL) {
-	n2 = STAILQ_NEXT(n1, entries);
-	free(n1);
-	n1 = n2;
-}
-STAILQ_INIT(&head);
-.Ed
-.Sh LISTS
-A list is headed by a structure defined by the
-.Nm LIST_HEAD
-macro.
-This structure contains a single pointer to the first element
-on the list.
-The elements are doubly linked so that an arbitrary element can be
-removed without traversing the list.
-New elements can be added to the list after an existing element,
-before an existing element, or at the head of the list.
-A
-.Fa LIST_HEAD
-structure is declared as follows:
-.Bd -literal -offset indent
-LIST_HEAD(HEADNAME, TYPE) head;
-.Ed
-.Pp
-where
-.Fa HEADNAME
-is the name of the structure to be defined, and
-.Fa TYPE
-is the type of the elements to be linked into the list.
-A pointer to the head of the list can later be declared as:
-.Bd -literal -offset indent
-struct HEADNAME *headp;
-.Ed
-.Pp
-(The names
-.Li head
-and
-.Li headp
-are user selectable.)
-.Pp
-The macro
-.Nm LIST_HEAD_INITIALIZER
-evaluates to an initializer for the list
-.Fa head .
-.Pp
-The macro
-.Nm LIST_EMPTY
-evaluates to true if there are no elements in the list.
-.Pp
-The macro
-.Nm LIST_ENTRY
-declares a structure that connects the elements in
-the list.
-.Pp
-The macro
-.Nm LIST_FIRST
-returns the first element in the list or NULL if the list
-is empty.
-.Pp
-The macro
-.Nm LIST_FOREACH
-traverses the list referenced by
-.Fa head
-in the forward direction, assigning each element in turn to
-.Fa var .
-.Pp
-The macro
-.Nm LIST_FOREACH_SAFE
-traverses the list referenced by
-.Fa head
-in the forward direction, assigning each element in turn to
-.Fa var .
-However, unlike
-.Fn LIST_FOREACH
-here it is permitted to both remove
-.Fa var
-as well as free it from within the loop safely without interfering with the
-traversal.
-.Pp
-The macro
-.Nm LIST_INIT
-initializes the list referenced by
-.Fa head .
-.Pp
-The macro
-.Nm LIST_INSERT_HEAD
-inserts the new element
-.Fa elm
-at the head of the list.
-.Pp
-The macro
-.Nm LIST_INSERT_AFTER
-inserts the new element
-.Fa elm
-after the element
-.Fa listelm .
-.Pp
-The macro
-.Nm LIST_INSERT_BEFORE
-inserts the new element
-.Fa elm
-before the element
-.Fa listelm .
-.Pp
-The macro
-.Nm LIST_NEXT
-returns the next element in the list, or NULL if this is the last.
-.Pp
-The macro
-.Nm LIST_REMOVE
-removes the element
-.Fa elm
-from the list.
-.Pp
-The macro
-.Nm LIST_SWAP
-swaps the contents of
-.Fa head1
-and
-.Fa head2 .
-.Sh LIST EXAMPLE
-.Bd -literal
-LIST_HEAD(listhead, entry) head =
-    LIST_HEAD_INITIALIZER(head);
-struct listhead *headp;			/* List head. */
-struct entry {
-	...
-	LIST_ENTRY(entry) entries;	/* List. */
-	...
-} *n1, *n2, *n3, *np, *np_temp;
-
-LIST_INIT(&head);			/* Initialize the list. */
-
-n1 = malloc(sizeof(struct entry));	/* Insert at the head. */
-LIST_INSERT_HEAD(&head, n1, entries);
-
-n2 = malloc(sizeof(struct entry));	/* Insert after. */
-LIST_INSERT_AFTER(n1, n2, entries);
-
-n3 = malloc(sizeof(struct entry));	/* Insert before. */
-LIST_INSERT_BEFORE(n2, n3, entries);
-
-LIST_REMOVE(n2, entries);		/* Deletion. */
-free(n2);
-					/* Forward traversal. */
-LIST_FOREACH(np, &head, entries)
-	np-> ...
-
-					/* Safe forward traversal. */
-LIST_FOREACH_SAFE(np, &head, entries, np_temp) {
-	np->do_stuff();
-	...
-	LIST_REMOVE(np, entries);
-	free(np);
-}
-
-while (!LIST_EMPTY(&head)) {		/* List Deletion. */
-	n1 = LIST_FIRST(&head);
-	LIST_REMOVE(n1, entries);
-	free(n1);
-}
-
-n1 = LIST_FIRST(&head);			/* Faster List Deletion. */
-while (n1 != NULL) {
-	n2 = LIST_NEXT(n1, entries);
-	free(n1);
-	n1 = n2;
-}
-LIST_INIT(&head);
-.Ed
-.Sh TAIL QUEUES
-A tail queue is headed by a structure defined by the
-.Nm TAILQ_HEAD
-macro.
-This structure contains a pair of pointers,
-one to the first element in the tail queue and the other to
-the last element in the tail queue.
-The elements are doubly linked so that an arbitrary element can be
-removed without traversing the tail queue.
-New elements can be added to the tail queue after an existing element,
-before an existing element, at the head of the tail queue,
-or at the end of the tail queue.
-A
-.Fa TAILQ_HEAD
-structure is declared as follows:
-.Bd -literal -offset indent
-TAILQ_HEAD(HEADNAME, TYPE) head;
-.Ed
-.Pp
-where
-.Li HEADNAME
-is the name of the structure to be defined, and
-.Li TYPE
-is the type of the elements to be linked into the tail queue.
-A pointer to the head of the tail queue can later be declared as:
-.Bd -literal -offset indent
-struct HEADNAME *headp;
-.Ed
-.Pp
-(The names
-.Li head
-and
-.Li headp
-are user selectable.)
-.Pp
-The macro
-.Nm TAILQ_HEAD_INITIALIZER
-evaluates to an initializer for the tail queue
-.Fa head .
-.Pp
-The macro
-.Nm TAILQ_CONCAT
-concatenates the tail queue headed by
-.Fa head2
-onto the end of the one headed by
-.Fa head1
-removing all entries from the former.
-.Pp
-The macro
-.Nm TAILQ_EMPTY
-evaluates to true if there are no items on the tail queue.
-.Pp
-The macro
-.Nm TAILQ_ENTRY
-declares a structure that connects the elements in
-the tail queue.
-.Pp
-The macro
-.Nm TAILQ_FIRST
-returns the first item on the tail queue or NULL if the tail queue
-is empty.
-.Pp
-The macro
-.Nm TAILQ_FOREACH
-traverses the tail queue referenced by
-.Fa head
-in the forward direction, assigning each element in turn to
-.Fa var .
-.Fa var
-is set to
-.Dv NULL
-if the loop completes normally, or if there were no elements.
-.Pp
-The macro
-.Nm TAILQ_FOREACH_REVERSE
-traverses the tail queue referenced by
-.Fa head
-in the reverse direction, assigning each element in turn to
-.Fa var .
-.Pp
-The macros
-.Nm TAILQ_FOREACH_SAFE
-and
-.Nm TAILQ_FOREACH_REVERSE_SAFE
-traverse the list referenced by
-.Fa head
-in the forward or reverse direction respectively,
-assigning each element in turn to
-.Fa var .
-However, unlike their unsafe counterparts,
-.Nm TAILQ_FOREACH
-and
-.Nm TAILQ_FOREACH_REVERSE
-permit to both remove
-.Fa var
-as well as free it from within the loop safely without interfering with the
-traversal.
-.Pp
-The macro
-.Nm TAILQ_INIT
-initializes the tail queue referenced by
-.Fa head .
-.Pp
-The macro
-.Nm TAILQ_INSERT_HEAD
-inserts the new element
-.Fa elm
-at the head of the tail queue.
-.Pp
-The macro
-.Nm TAILQ_INSERT_TAIL
-inserts the new element
-.Fa elm
-at the end of the tail queue.
-.Pp
-The macro
-.Nm TAILQ_INSERT_AFTER
-inserts the new element
-.Fa elm
-after the element
-.Fa listelm .
-.Pp
-The macro
-.Nm TAILQ_INSERT_BEFORE
-inserts the new element
-.Fa elm
-before the element
-.Fa listelm .
-.Pp
-The macro
-.Nm TAILQ_LAST
-returns the last item on the tail queue.
-If the tail queue is empty the return value is
-.Dv NULL .
-.Pp
-The macro
-.Nm TAILQ_NEXT
-returns the next item on the tail queue, or NULL if this item is the last.
-.Pp
-The macro
-.Nm TAILQ_PREV
-returns the previous item on the tail queue, or NULL if this item
-is the first.
-.Pp
-The macro
-.Nm TAILQ_REMOVE
-removes the element
-.Fa elm
-from the tail queue.
-.Pp
-The macro
-.Nm TAILQ_SWAP
-swaps the contents of
-.Fa head1
-and
-.Fa head2 .
-.Sh TAIL QUEUE EXAMPLE
-.Bd -literal
-TAILQ_HEAD(tailhead, entry) head =
-    TAILQ_HEAD_INITIALIZER(head);
-struct tailhead *headp;			/* Tail queue head. */
-struct entry {
-	...
-	TAILQ_ENTRY(entry) entries;	/* Tail queue. */
-	...
-} *n1, *n2, *n3, *np;
-
-TAILQ_INIT(&head);			/* Initialize the queue. */
-
-n1 = malloc(sizeof(struct entry));	/* Insert at the head. */
-TAILQ_INSERT_HEAD(&head, n1, entries);
-
-n1 = malloc(sizeof(struct entry));	/* Insert at the tail. */
-TAILQ_INSERT_TAIL(&head, n1, entries);
-
-n2 = malloc(sizeof(struct entry));	/* Insert after. */
-TAILQ_INSERT_AFTER(&head, n1, n2, entries);
-
-n3 = malloc(sizeof(struct entry));	/* Insert before. */
-TAILQ_INSERT_BEFORE(n2, n3, entries);
-
-TAILQ_REMOVE(&head, n2, entries);	/* Deletion. */
-free(n2);
-					/* Forward traversal. */
-TAILQ_FOREACH(np, &head, entries)
-	np-> ...
-					/* Safe forward traversal. */
-TAILQ_FOREACH_SAFE(np, &head, entries, np_temp) {
-	np->do_stuff();
-	...
-	TAILQ_REMOVE(&head, np, entries);
-	free(np);
-}
-					/* Reverse traversal. */
-TAILQ_FOREACH_REVERSE(np, &head, tailhead, entries)
-	np-> ...
-					/* TailQ Deletion. */
-while (!TAILQ_EMPTY(&head)) {
-	n1 = TAILQ_FIRST(&head);
-	TAILQ_REMOVE(&head, n1, entries);
-	free(n1);
-}
-					/* Faster TailQ Deletion. */
-n1 = TAILQ_FIRST(&head);
-while (n1 != NULL) {
-	n2 = TAILQ_NEXT(n1, entries);
-	free(n1);
-	n1 = n2;
-}
-TAILQ_INIT(&head);
-.Ed
-.Sh SEE ALSO
-.Xr tree 3
-.Sh HISTORY
-The
-.Nm queue
-functions first appeared in
-.Bx 4.4 .
diff -r 6c9a73817770 -r 934c14ab9f19 tools/libxl/external/bsd-sys-queue.h
--- a/tools/libxl/external/bsd-sys-queue.h	Tue Jan 31 11:39:37 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,637 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	@(#)queue.h	8.5 (Berkeley) 8/20/94
- * $FreeBSD$
- */
-
-#ifndef _SYS_QUEUE_H_
-#define	_SYS_QUEUE_H_
-
-#include <sys/cdefs.h>
-
-/*
- * This file defines four types of data structures: singly-linked lists,
- * singly-linked tail queues, lists and tail queues.
- *
- * A singly-linked list is headed by a single forward pointer. The elements
- * are singly linked for minimum space and pointer manipulation overhead at
- * the expense of O(n) removal for arbitrary elements. New elements can be
- * added to the list after an existing element or at the head of the list.
- * Elements being removed from the head of the list should use the explicit
- * macro for this purpose for optimum efficiency. A singly-linked list may
- * only be traversed in the forward direction.  Singly-linked lists are ideal
- * for applications with large datasets and few or no removals or for
- * implementing a LIFO queue.
- *
- * A singly-linked tail queue is headed by a pair of pointers, one to the
- * head of the list and the other to the tail of the list. The elements are
- * singly linked for minimum space and pointer manipulation overhead at the
- * expense of O(n) removal for arbitrary elements. New elements can be added
- * to the list after an existing element, at the head of the list, or at the
- * end of the list. Elements being removed from the head of the tail queue
- * should use the explicit macro for this purpose for optimum efficiency.
- * A singly-linked tail queue may only be traversed in the forward direction.
- * Singly-linked tail queues are ideal for applications with large datasets
- * and few or no removals or for implementing a FIFO queue.
- *
- * A list is headed by a single forward pointer (or an array of forward
- * pointers for a hash table header). The elements are doubly linked
- * so that an arbitrary element can be removed without a need to
- * traverse the list. New elements can be added to the list before
- * or after an existing element or at the head of the list. A list
- * may only be traversed in the forward direction.
- *
- * A tail queue is headed by a pair of pointers, one to the head of the
- * list and the other to the tail of the list. The elements are doubly
- * linked so that an arbitrary element can be removed without a need to
- * traverse the list. New elements can be added to the list before or
- * after an existing element, at the head of the list, or at the end of
- * the list. A tail queue may be traversed in either direction.
- *
- * For details on the use of these macros, see the queue(3) manual page.
- *
- *
- *				SLIST	LIST	STAILQ	TAILQ
- * _HEAD			+	+	+	+
- * _HEAD_INITIALIZER		+	+	+	+
- * _ENTRY			+	+	+	+
- * _INIT			+	+	+	+
- * _EMPTY			+	+	+	+
- * _FIRST			+	+	+	+
- * _NEXT			+	+	+	+
- * _PREV			-	-	-	+
- * _LAST			-	-	+	+
- * _FOREACH			+	+	+	+
- * _FOREACH_SAFE		+	+	+	+
- * _FOREACH_REVERSE		-	-	-	+
- * _FOREACH_REVERSE_SAFE	-	-	-	+
- * _INSERT_HEAD			+	+	+	+
- * _INSERT_BEFORE		-	+	-	+
- * _INSERT_AFTER		+	+	+	+
- * _INSERT_TAIL			-	-	+	+
- * _CONCAT			-	-	+	+
- * _REMOVE_AFTER		+	-	+	-
- * _REMOVE_HEAD			+	-	+	-
- * _REMOVE			+	+	+	+
- * _SWAP			+	+	+	+
- *
- */
-#ifdef QUEUE_MACRO_DEBUG
-/* Store the last 2 places the queue element or head was altered */
-struct qm_trace {
-	char * lastfile;
-	int lastline;
-	char * prevfile;
-	int prevline;
-};
-
-#define	TRACEBUF	struct qm_trace trace;
-#define	TRASHIT(x)	do {(x) = (void *)-1;} while (0)
-#define	QMD_SAVELINK(name, link)	void **name = (void *)&(link)
-
-#define	QMD_TRACE_HEAD(head) do {					\
-	(head)->trace.prevline = (head)->trace.lastline;		\
-	(head)->trace.prevfile = (head)->trace.lastfile;		\
-	(head)->trace.lastline = __LINE__;				\
-	(head)->trace.lastfile = __FILE__;				\
-} while (0)
-
-#define	QMD_TRACE_ELEM(elem) do {					\
-	(elem)->trace.prevline = (elem)->trace.lastline;		\
-	(elem)->trace.prevfile = (elem)->trace.lastfile;		\
-	(elem)->trace.lastline = __LINE__;				\
-	(elem)->trace.lastfile = __FILE__;				\
-} while (0)
-
-#else
-#define	QMD_TRACE_ELEM(elem)
-#define	QMD_TRACE_HEAD(head)
-#define	QMD_SAVELINK(name, link)
-#define	TRACEBUF
-#define	TRASHIT(x)
-#endif	/* QUEUE_MACRO_DEBUG */
-
-/*
- * Singly-linked List declarations.
- */
-#define	SLIST_HEAD(name, type)						\
-struct name {								\
-	struct type *slh_first;	/* first element */			\
-}
-
-#define	SLIST_HEAD_INITIALIZER(head)					\
-	{ NULL }
-
-#define	SLIST_ENTRY(type)						\
-struct {								\
-	struct type *sle_next;	/* next element */			\
-}
-
-/*
- * Singly-linked List functions.
- */
-#define	SLIST_EMPTY(head)	((head)->slh_first == NULL)
-
-#define	SLIST_FIRST(head)	((head)->slh_first)
-
-#define	SLIST_FOREACH(var, head, field)					\
-	for ((var) = SLIST_FIRST((head));				\
-	    (var);							\
-	    (var) = SLIST_NEXT((var), field))
-
-#define	SLIST_FOREACH_SAFE(var, head, field, tvar)			\
-	for ((var) = SLIST_FIRST((head));				\
-	    (var) && ((tvar) = SLIST_NEXT((var), field), 1);		\
-	    (var) = (tvar))
-
-#define	SLIST_FOREACH_PREVPTR(var, varp, head, field)			\
-	for ((varp) = &SLIST_FIRST((head));				\
-	    ((var) = *(varp)) != NULL;					\
-	    (varp) = &SLIST_NEXT((var), field))
-
-#define	SLIST_INIT(head) do {						\
-	SLIST_FIRST((head)) = NULL;					\
-} while (0)
-
-#define	SLIST_INSERT_AFTER(slistelm, elm, field) do {			\
-	SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field);	\
-	SLIST_NEXT((slistelm), field) = (elm);				\
-} while (0)
-
-#define	SLIST_INSERT_HEAD(head, elm, field) do {			\
-	SLIST_NEXT((elm), field) = SLIST_FIRST((head));			\
-	SLIST_FIRST((head)) = (elm);					\
-} while (0)
-
-#define	SLIST_NEXT(elm, field)	((elm)->field.sle_next)
-
-#define	SLIST_REMOVE(head, elm, type, field) do {			\
-	QMD_SAVELINK(oldnext, (elm)->field.sle_next);			\
-	if (SLIST_FIRST((head)) == (elm)) {				\
-		SLIST_REMOVE_HEAD((head), field);			\
-	}								\
-	else {								\
-		struct type *curelm = SLIST_FIRST((head));		\
-		while (SLIST_NEXT(curelm, field) != (elm))		\
-			curelm = SLIST_NEXT(curelm, field);		\
-		SLIST_REMOVE_AFTER(curelm, field);			\
-	}								\
-	TRASHIT(*oldnext);						\
-} while (0)
-
-#define SLIST_REMOVE_AFTER(elm, field) do {				\
-	SLIST_NEXT(elm, field) =					\
-	    SLIST_NEXT(SLIST_NEXT(elm, field), field);			\
-} while (0)
-
-#define	SLIST_REMOVE_HEAD(head, field) do {				\
-	SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field);	\
-} while (0)
-
-#define SLIST_SWAP(head1, head2, type) do {				\
-	struct type *swap_first = SLIST_FIRST(head1);			\
-	SLIST_FIRST(head1) = SLIST_FIRST(head2);			\
-	SLIST_FIRST(head2) = swap_first;				\
-} while (0)
-
-/*
- * Singly-linked Tail queue declarations.
- */
-#define	STAILQ_HEAD(name, type)						\
-struct name {								\
-	struct type *stqh_first;/* first element */			\
-	struct type **stqh_last;/* addr of last next element */		\
-}
-
-#define	STAILQ_HEAD_INITIALIZER(head)					\
-	{ NULL, &(head).stqh_first }
-
-#define	STAILQ_ENTRY(type)						\
-struct {								\
-	struct type *stqe_next;	/* next element */			\
-}
-
-/*
- * Singly-linked Tail queue functions.
- */
-#define	STAILQ_CONCAT(head1, head2) do {				\
-	if (!STAILQ_EMPTY((head2))) {					\
-		*(head1)->stqh_last = (head2)->stqh_first;		\
-		(head1)->stqh_last = (head2)->stqh_last;		\
-		STAILQ_INIT((head2));					\
-	}								\
-} while (0)
-
-#define	STAILQ_EMPTY(head)	((head)->stqh_first == NULL)
-
-#define	STAILQ_FIRST(head)	((head)->stqh_first)
-
-#define	STAILQ_FOREACH(var, head, field)				\
-	for((var) = STAILQ_FIRST((head));				\
-	   (var);							\
-	   (var) = STAILQ_NEXT((var), field))
-
-
-#define	STAILQ_FOREACH_SAFE(var, head, field, tvar)			\
-	for ((var) = STAILQ_FIRST((head));				\
-	    (var) && ((tvar) = STAILQ_NEXT((var), field), 1);		\
-	    (var) = (tvar))
-
-#define	STAILQ_INIT(head) do {						\
-	STAILQ_FIRST((head)) = NULL;					\
-	(head)->stqh_last = &STAILQ_FIRST((head));			\
-} while (0)
-
-#define	STAILQ_INSERT_AFTER(head, tqelm, elm, field) do {		\
-	if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\
-		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\
-	STAILQ_NEXT((tqelm), field) = (elm);				\
-} while (0)
-
-#define	STAILQ_INSERT_HEAD(head, elm, field) do {			\
-	if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL)	\
-		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\
-	STAILQ_FIRST((head)) = (elm);					\
-} while (0)
-
-#define	STAILQ_INSERT_TAIL(head, elm, field) do {			\
-	STAILQ_NEXT((elm), field) = NULL;				\
-	*(head)->stqh_last = (elm);					\
-	(head)->stqh_last = &STAILQ_NEXT((elm), field);			\
-} while (0)
-
-#define	STAILQ_LAST(head, type, field)					\
-	(STAILQ_EMPTY((head)) ?						\
-		NULL :							\
-	        ((struct type *)(void *)				\
-		((char *)((head)->stqh_last) - __offsetof(struct type, field))))
-
-#define	STAILQ_NEXT(elm, field)	((elm)->field.stqe_next)
-
-#define	STAILQ_REMOVE(head, elm, type, field) do {			\
-	QMD_SAVELINK(oldnext, (elm)->field.stqe_next);			\
-	if (STAILQ_FIRST((head)) == (elm)) {				\
-		STAILQ_REMOVE_HEAD((head), field);			\
-	}								\
-	else {								\
-		struct type *curelm = STAILQ_FIRST((head));		\
-		while (STAILQ_NEXT(curelm, field) != (elm))		\
-			curelm = STAILQ_NEXT(curelm, field);		\
-		STAILQ_REMOVE_AFTER(head, curelm, field);		\
-	}								\
-	TRASHIT(*oldnext);						\
-} while (0)
-
-#define STAILQ_REMOVE_AFTER(head, elm, field) do {			\
-	if ((STAILQ_NEXT(elm, field) =					\
-	     STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL)	\
-		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\
-} while (0)
-
-#define	STAILQ_REMOVE_HEAD(head, field) do {				\
-	if ((STAILQ_FIRST((head)) =					\
-	     STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL)		\
-		(head)->stqh_last = &STAILQ_FIRST((head));		\
-} while (0)
-
-#define STAILQ_SWAP(head1, head2, type) do {				\
-	struct type *swap_first = STAILQ_FIRST(head1);			\
-	struct type **swap_last = (head1)->stqh_last;			\
-	STAILQ_FIRST(head1) = STAILQ_FIRST(head2);			\
-	(head1)->stqh_last = (head2)->stqh_last;			\
-	STAILQ_FIRST(head2) = swap_first;				\
-	(head2)->stqh_last = swap_last;					\
-	if (STAILQ_EMPTY(head1))					\
-		(head1)->stqh_last = &STAILQ_FIRST(head1);		\
-	if (STAILQ_EMPTY(head2))					\
-		(head2)->stqh_last = &STAILQ_FIRST(head2);		\
-} while (0)
-
-
-/*
- * List declarations.
- */
-#define	LIST_HEAD(name, type)						\
-struct name {								\
-	struct type *lh_first;	/* first element */			\
-}
-
-#define	LIST_HEAD_INITIALIZER(head)					\
-	{ NULL }
-
-#define	LIST_ENTRY(type)						\
-struct {								\
-	struct type *le_next;	/* next element */			\
-	struct type **le_prev;	/* address of previous next element */	\
-}
-
-/*
- * List functions.
- */
-
-#if (defined(_KERNEL) && defined(INVARIANTS))
-#define	QMD_LIST_CHECK_HEAD(head, field) do {				\
-	if (LIST_FIRST((head)) != NULL &&				\
-	    LIST_FIRST((head))->field.le_prev !=			\
-	     &LIST_FIRST((head)))					\
-		panic("Bad list head %p first->prev != head", (head));	\
-} while (0)
-
-#define	QMD_LIST_CHECK_NEXT(elm, field) do {				\
-	if (LIST_NEXT((elm), field) != NULL &&				\
-	    LIST_NEXT((elm), field)->field.le_prev !=			\
-	     &((elm)->field.le_next))					\
-	     	panic("Bad link elm %p next->prev != elm", (elm));	\
-} while (0)
-
-#define	QMD_LIST_CHECK_PREV(elm, field) do {				\
-	if (*(elm)->field.le_prev != (elm))				\
-		panic("Bad link elm %p prev->next != elm", (elm));	\
-} while (0)
-#else
-#define	QMD_LIST_CHECK_HEAD(head, field)
-#define	QMD_LIST_CHECK_NEXT(elm, field)
-#define	QMD_LIST_CHECK_PREV(elm, field)
-#endif /* (_KERNEL && INVARIANTS) */
-
-#define	LIST_EMPTY(head)	((head)->lh_first == NULL)
-
-#define	LIST_FIRST(head)	((head)->lh_first)
-
-#define	LIST_FOREACH(var, head, field)					\
-	for ((var) = LIST_FIRST((head));				\
-	    (var);							\
-	    (var) = LIST_NEXT((var), field))
-
-#define	LIST_FOREACH_SAFE(var, head, field, tvar)			\
-	for ((var) = LIST_FIRST((head));				\
-	    (var) && ((tvar) = LIST_NEXT((var), field), 1);		\
-	    (var) = (tvar))
-
-#define	LIST_INIT(head) do {						\
-	LIST_FIRST((head)) = NULL;					\
-} while (0)
-
-#define	LIST_INSERT_AFTER(listelm, elm, field) do {			\
-	QMD_LIST_CHECK_NEXT(listelm, field);				\
-	if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\
-		LIST_NEXT((listelm), field)->field.le_prev =		\
-		    &LIST_NEXT((elm), field);				\
-	LIST_NEXT((listelm), field) = (elm);				\
-	(elm)->field.le_prev = &LIST_NEXT((listelm), field);		\
-} while (0)
-
-#define	LIST_INSERT_BEFORE(listelm, elm, field) do {			\
-	QMD_LIST_CHECK_PREV(listelm, field);				\
-	(elm)->field.le_prev = (listelm)->field.le_prev;		\
-	LIST_NEXT((elm), field) = (listelm);				\
-	*(listelm)->field.le_prev = (elm);				\
-	(listelm)->field.le_prev = &LIST_NEXT((elm), field);		\
-} while (0)
-
-#define	LIST_INSERT_HEAD(head, elm, field) do {				\
-	QMD_LIST_CHECK_HEAD((head), field);				\
-	if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL)	\
-		LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
-	LIST_FIRST((head)) = (elm);					\
-	(elm)->field.le_prev = &LIST_FIRST((head));			\
-} while (0)
-
-#define	LIST_NEXT(elm, field)	((elm)->field.le_next)
-
-#define	LIST_REMOVE(elm, field) do {					\
-	QMD_SAVELINK(oldnext, (elm)->field.le_next);			\
-	QMD_SAVELINK(oldprev, (elm)->field.le_prev);			\
-	QMD_LIST_CHECK_NEXT(elm, field);				\
-	QMD_LIST_CHECK_PREV(elm, field);				\
-	if (LIST_NEXT((elm), field) != NULL)				\
-		LIST_NEXT((elm), field)->field.le_prev = 		\
-		    (elm)->field.le_prev;				\
-	*(elm)->field.le_prev = LIST_NEXT((elm), field);		\
-	TRASHIT(*oldnext);						\
-	TRASHIT(*oldprev);						\
-} while (0)
-
-#define LIST_SWAP(head1, head2, type, field) do {			\
-	struct type *swap_tmp = LIST_FIRST((head1));			\
-	LIST_FIRST((head1)) = LIST_FIRST((head2));			\
-	LIST_FIRST((head2)) = swap_tmp;					\
-	if ((swap_tmp = LIST_FIRST((head1))) != NULL)			\
-		swap_tmp->field.le_prev = &LIST_FIRST((head1));		\
-	if ((swap_tmp = LIST_FIRST((head2))) != NULL)			\
-		swap_tmp->field.le_prev = &LIST_FIRST((head2));		\
-} while (0)
-
-/*
- * Tail queue declarations.
- */
-#define	TAILQ_HEAD(name, type)						\
-struct name {								\
-	struct type *tqh_first;	/* first element */			\
-	struct type **tqh_last;	/* addr of last next element */		\
-	TRACEBUF							\
-}
-
-#define	TAILQ_HEAD_INITIALIZER(head)					\
-	{ NULL, &(head).tqh_first }
-
-#define	TAILQ_ENTRY(type)						\
-struct {								\
-	struct type *tqe_next;	/* next element */			\
-	struct type **tqe_prev;	/* address of previous next element */	\
-	TRACEBUF							\
-}
-
-/*
- * Tail queue functions.
- */
-#if (defined(_KERNEL) && defined(INVARIANTS))
-#define	QMD_TAILQ_CHECK_HEAD(head, field) do {				\
-	if (!TAILQ_EMPTY(head) &&					\
-	    TAILQ_FIRST((head))->field.tqe_prev !=			\
-	     &TAILQ_FIRST((head)))					\
-		panic("Bad tailq head %p first->prev != head", (head));	\
-} while (0)
-
-#define	QMD_TAILQ_CHECK_TAIL(head, field) do {				\
-	if (*(head)->tqh_last != NULL)					\
-	    	panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head)); 	\
-} while (0)
-
-#define	QMD_TAILQ_CHECK_NEXT(elm, field) do {				\
-	if (TAILQ_NEXT((elm), field) != NULL &&				\
-	    TAILQ_NEXT((elm), field)->field.tqe_prev !=			\
-	     &((elm)->field.tqe_next))					\
-		panic("Bad link elm %p next->prev != elm", (elm));	\
-} while (0)
-
-#define	QMD_TAILQ_CHECK_PREV(elm, field) do {				\
-	if (*(elm)->field.tqe_prev != (elm))				\
-		panic("Bad link elm %p prev->next != elm", (elm));	\
-} while (0)
-#else
-#define	QMD_TAILQ_CHECK_HEAD(head, field)
-#define	QMD_TAILQ_CHECK_TAIL(head, headname)
-#define	QMD_TAILQ_CHECK_NEXT(elm, field)
-#define	QMD_TAILQ_CHECK_PREV(elm, field)
-#endif /* (_KERNEL && INVARIANTS) */
-
-#define	TAILQ_CONCAT(head1, head2, field) do {				\
-	if (!TAILQ_EMPTY(head2)) {					\
-		*(head1)->tqh_last = (head2)->tqh_first;		\
-		(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last;	\
-		(head1)->tqh_last = (head2)->tqh_last;			\
-		TAILQ_INIT((head2));					\
-		QMD_TRACE_HEAD(head1);					\
-		QMD_TRACE_HEAD(head2);					\
-	}								\
-} while (0)
-
-#define	TAILQ_EMPTY(head)	((head)->tqh_first == NULL)
-
-#define	TAILQ_FIRST(head)	((head)->tqh_first)
-
-#define	TAILQ_FOREACH(var, head, field)					\
-	for ((var) = TAILQ_FIRST((head));				\
-	    (var);							\
-	    (var) = TAILQ_NEXT((var), field))
-
-#define	TAILQ_FOREACH_SAFE(var, head, field, tvar)			\
-	for ((var) = TAILQ_FIRST((head));				\
-	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\
-	    (var) = (tvar))
-
-#define	TAILQ_FOREACH_REVERSE(var, head, headname, field)		\
-	for ((var) = TAILQ_LAST((head), headname);			\
-	    (var);							\
-	    (var) = TAILQ_PREV((var), headname, field))
-
-#define	TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar)	\
-	for ((var) = TAILQ_LAST((head), headname);			\
-	    (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\
-	    (var) = (tvar))
-
-#define	TAILQ_INIT(head) do {						\
-	TAILQ_FIRST((head)) = NULL;					\
-	(head)->tqh_last = &TAILQ_FIRST((head));			\
-	QMD_TRACE_HEAD(head);						\
-} while (0)
-
-#define	TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
-	QMD_TAILQ_CHECK_NEXT(listelm, field);				\
-	if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
-		TAILQ_NEXT((elm), field)->field.tqe_prev = 		\
-		    &TAILQ_NEXT((elm), field);				\
-	else {								\
-		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
-		QMD_TRACE_HEAD(head);					\
-	}								\
-	TAILQ_NEXT((listelm), field) = (elm);				\
-	(elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field);		\
-	QMD_TRACE_ELEM(&(elm)->field);					\
-	QMD_TRACE_ELEM(&listelm->field);				\
-} while (0)
-
-#define	TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\
-	QMD_TAILQ_CHECK_PREV(listelm, field);				\
-	(elm)->field.tqe_prev = (listelm)->field.tqe_prev;		\
-	TAILQ_NEXT((elm), field) = (listelm);				\
-	*(listelm)->field.tqe_prev = (elm);				\
-	(listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field);		\
-	QMD_TRACE_ELEM(&(elm)->field);					\
-	QMD_TRACE_ELEM(&listelm->field);				\
-} while (0)
-
-#define	TAILQ_INSERT_HEAD(head, elm, field) do {			\
-	QMD_TAILQ_CHECK_HEAD(head, field);				\
-	if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL)	\
-		TAILQ_FIRST((head))->field.tqe_prev =			\
-		    &TAILQ_NEXT((elm), field);				\
-	else								\
-		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
-	TAILQ_FIRST((head)) = (elm);					\
-	(elm)->field.tqe_prev = &TAILQ_FIRST((head));			\
-	QMD_TRACE_HEAD(head);						\
-	QMD_TRACE_ELEM(&(elm)->field);					\
-} while (0)
-
-#define	TAILQ_INSERT_TAIL(head, elm, field) do {			\
-	QMD_TAILQ_CHECK_TAIL(head, field);				\
-	TAILQ_NEXT((elm), field) = NULL;				\
-	(elm)->field.tqe_prev = (head)->tqh_last;			\
-	*(head)->tqh_last = (elm);					\
-	(head)->tqh_last = &TAILQ_NEXT((elm), field);			\
-	QMD_TRACE_HEAD(head);						\
-	QMD_TRACE_ELEM(&(elm)->field);					\
-} while (0)
-
-#define	TAILQ_LAST(head, headname)					\
-	(*(((struct headname *)((head)->tqh_last))->tqh_last))
-
-#define	TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
-
-#define	TAILQ_PREV(elm, headname, field)				\
-	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
-
-#define	TAILQ_REMOVE(head, elm, field) do {				\
-	QMD_SAVELINK(oldnext, (elm)->field.tqe_next);			\
-	QMD_SAVELINK(oldprev, (elm)->field.tqe_prev);			\
-	QMD_TAILQ_CHECK_NEXT(elm, field);				\
-	QMD_TAILQ_CHECK_PREV(elm, field);				\
-	if ((TAILQ_NEXT((elm), field)) != NULL)				\
-		TAILQ_NEXT((elm), field)->field.tqe_prev = 		\
-		    (elm)->field.tqe_prev;				\
-	else {								\
-		(head)->tqh_last = (elm)->field.tqe_prev;		\
-		QMD_TRACE_HEAD(head);					\
-	}								\
-	*(elm)->field.tqe_prev = TAILQ_NEXT((elm), field);		\
-	TRASHIT(*oldnext);						\
-	TRASHIT(*oldprev);						\
-	QMD_TRACE_ELEM(&(elm)->field);					\
-} while (0)
-
-#define TAILQ_SWAP(head1, head2, type, field) do {			\
-	struct type *swap_first = (head1)->tqh_first;			\
-	struct type **swap_last = (head1)->tqh_last;			\
-	(head1)->tqh_first = (head2)->tqh_first;			\
-	(head1)->tqh_last = (head2)->tqh_last;				\
-	(head2)->tqh_first = swap_first;				\
-	(head2)->tqh_last = swap_last;					\
-	if ((swap_first = (head1)->tqh_first) != NULL)			\
-		swap_first->field.tqe_prev = &(head1)->tqh_first;	\
-	else								\
-		(head1)->tqh_last = &(head1)->tqh_first;		\
-	if ((swap_first = (head2)->tqh_first) != NULL)			\
-		swap_first->field.tqe_prev = &(head2)->tqh_first;	\
-	else								\
-		(head2)->tqh_last = &(head2)->tqh_first;		\
-} while (0)
-
-#endif /* !_SYS_QUEUE_H_ */

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8E-0007Ku-MO; Fri, 03 Feb 2012 21:57:22 +0000
Received: from mail6.bemta14.messagelabs.com ([193.109.254.103])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8C-0007Jn-GO
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:21 +0000
Received: from [193.109.254.147:46791] by server-4.bemta-14.messagelabs.com id
	E3/1D-04726-F385C2F4; Fri, 03 Feb 2012 21:57:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1328306183!51337678!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG, UPPERCASE_25_50
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16419 invoked from network); 3 Feb 2012 21:56:24 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR84-0001m8-DV
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR7z-0002id-LS
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:11 +0000
Message-Id: <E1RtR7z-0002id-LS@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:03 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mini-os: use BSD sys/queue.h instead
	of Linux list.h
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328025974 0
# Node ID 934c14ab9f19330c91e2769beb96ac6896b2a1c8
# Parent  6c9a7381777031600ef3442a578d0fa3ce1491b2
mini-os: use BSD sys/queue.h instead of Linux list.h

The latter is GPL which makes the whole of mini-os GPL rather than BSD
as intended. In tree users are all GPL or GPL-compatible but we should
fix this so that mini-os is BSD. Do so by using the same BSD
sys/queue.h as we use in libxl.

Tested with the builtin mini-os test app and qemu stubdomain, both of which
appear to still function as expected.

Move tools/libxl/external and the associated sed script to
tools/include/xen-external to allow more sensible access from mini-os.

Also add s/NULL/0/ in the sed script due to NULL not always being
defined in stubdom code when mini-os/wait.h is included.

As well as the obvious ABI changes there are a few API updates
associated with the change:

  - struct rw_semaphore.wait_list is unused
  - remove_waiter needs to take the wait_queue_head

The latter requires a qemu update, so there is also a QEMU_TAG
update in this changeset.

I sprinkled some extra-emacs local variables around the files I edited
which didn't have them.

I think this should be backported to the stable branches since
external users of mini-os may have been mislead into thinking they
could safely link mini-os against GPL-incompatible code.

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


diff -r 6c9a73817770 -r 934c14ab9f19 .hgignore
--- a/.hgignore	Tue Jan 31 11:39:37 2012 +0000
+++ b/.hgignore	Tue Jan 31 16:06:14 2012 +0000
@@ -62,6 +62,7 @@
 ^docs/xen-api/xenapi-datamodel-graph.eps$
 ^docs/xen-api/xenapi.out$
 ^extras/mini-os/arch/ia64/gen_off.s$
+^extras/mini-os/include/list\.h$
 ^extras/mini-os/include/mini-os$
 ^extras/mini-os/include/ia64/mini-os$
 ^extras/mini-os/include/ia64/offsets.h$
diff -r 6c9a73817770 -r 934c14ab9f19 Config.mk
--- a/Config.mk	Tue Jan 31 11:39:37 2012 +0000
+++ b/Config.mk	Tue Jan 31 16:06:14 2012 +0000
@@ -222,9 +222,9 @@
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= bb36d632e4cabf47882adff07a45c6702c4a5b30
-# Thu Jan 5 17:16:46 2012 +0000
-# qemu-xen: adjust MSI-X related log messages
+QEMU_TAG ?= de05447400930da4be216e4fb0fe52b8be81490e
+# Tue Jan 31 15:42:38 2012 +0000
+# block-vbd: update to new mini-os wait queue API (new linked list API)
 
 # Short answer -- do not enable this unless you know what you are
 # doing and are prepared for some pain.
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/Makefile
--- a/extras/mini-os/Makefile	Tue Jan 31 11:39:37 2012 +0000
+++ b/extras/mini-os/Makefile	Tue Jan 31 16:06:14 2012 +0000
@@ -52,8 +52,12 @@
 	$(arch_links)
 endif
 
+include/list.h: $(XEN_ROOT)/tools/include/xen-external/bsd-sys-queue-h-seddery $(XEN_ROOT)/tools/include/xen-external/bsd-sys-queue.h
+	perl $^ --prefix=minios  >$@.new
+	$(call move-if-changed,$@.new,$@)
+
 .PHONY: links
-links:	$(ARCH_LINKS)
+links: include/list.h $(ARCH_LINKS)
 	[ -e include/xen ] || ln -sf ../../../xen/include/public include/xen
 	[ -e include/mini-os ] || ln -sf . include/mini-os
 	[ -e include/$(TARGET_ARCH_FAM)/mini-os ] || ln -sf . include/$(TARGET_ARCH_FAM)/mini-os
@@ -97,7 +101,7 @@
 APP_O=$(OBJ_DIR)/$(TARGET)_app.o 
 endif
 
-$(OBJ_DIR)/$(TARGET): links $(OBJS) $(APP_O) arch_lib
+$(OBJ_DIR)/$(TARGET): links include/list.h $(OBJS) $(APP_O) arch_lib
 	$(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(APP_O) $(OBJS) $(LDARCHLIB) $(LDLIBS) -o $@.o
 	$(OBJCOPY) -w -G $(GLOBAL_PREFIX)* -G _start $@.o $@.o
 	$(LD) $(LDFLAGS) $(LDFLAGS_FINAL) $@.o $(EXTRA_OBJS) -o $@
@@ -112,6 +116,7 @@
 	for dir in $(addprefix $(OBJ_DIR)/,$(SUBDIRS)); do \
 		rm -f $$dir/*.o; \
 	done
+	rm -f include/list.h
 	rm -f $(OBJ_DIR)/*.o *~ $(OBJ_DIR)/core $(OBJ_DIR)/$(TARGET).elf $(OBJ_DIR)/$(TARGET).raw $(OBJ_DIR)/$(TARGET) $(OBJ_DIR)/$(TARGET).gz
 	find . $(OBJ_DIR) -type l | xargs rm -f
 	$(RM) $(OBJ_DIR)/lwip.a $(LWO)
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c	Tue Jan 31 11:39:37 2012 +0000
+++ b/extras/mini-os/blkfront.c	Tue Jan 31 16:06:14 2012 +0000
@@ -323,7 +323,7 @@
 	    schedule();
 	    local_irq_save(flags);
 	}
-	remove_waiter(w);
+	remove_waiter(w, blkfront_queue);
 	local_irq_restore(flags);
     }
 }
@@ -414,7 +414,7 @@
 	schedule();
 	local_irq_save(flags);
     }
-    remove_waiter(w);
+    remove_waiter(w, blkfront_queue);
     local_irq_restore(flags);
 }
 
@@ -470,7 +470,7 @@
 	schedule();
 	local_irq_save(flags);
     }
-    remove_waiter(w);
+    remove_waiter(w, blkfront_queue);
     local_irq_restore(flags);
 }
 
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/fbfront.c
--- a/extras/mini-os/fbfront.c	Tue Jan 31 11:39:37 2012 +0000
+++ b/extras/mini-os/fbfront.c	Tue Jan 31 16:06:14 2012 +0000
@@ -569,7 +569,7 @@
     add_waiter(w, fbfront_queue);
     while (page->out_prod - page->out_cons == XENFB_OUT_RING_LEN)
         schedule();
-    remove_waiter(w);
+    remove_waiter(w, fbfront_queue);
 
     prod = page->out_prod;
     mb(); /* ensure ring space available */
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/include/list.h
--- a/extras/mini-os/include/list.h	Tue Jan 31 11:39:37 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,190 +0,0 @@
-#ifndef _LINUX_LIST_H
-#define _LINUX_LIST_H
-
-/*
- * Simple doubly linked list implementation.
- *
- * Some of the internal functions ("__xxx") are useful when
- * manipulating whole lists rather than single entries, as
- * sometimes we already know the next/prev entries and we can
- * generate better code by using them directly rather than
- * using the generic single-entry routines.
- */
-
-struct minios_list_head {
-	struct minios_list_head *next, *prev;
-};
-
-#define MINIOS_LIST_HEAD_INIT(name) { &(name), &(name) }
-
-#define MINIOS_LIST_HEAD(name) \
-	struct minios_list_head name = MINIOS_LIST_HEAD_INIT(name)
-
-#define MINIOS_INIT_LIST_HEAD(ptr) do { \
-	(ptr)->next = (ptr); (ptr)->prev = (ptr); \
-} while (0)
-
-#define minios_list_top(head, type, member)					  \
-({ 									  \
-	struct minios_list_head *_head = (head);				  \
-	minios_list_empty(_head) ? NULL : minios_list_entry(_head->next, type, member); \
-})
-
-/*
- * Insert a new entry between two known consecutive entries. 
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static __inline__ void __minios_list_add(struct minios_list_head * new,
-	struct minios_list_head * prev,
-	struct minios_list_head * next)
-{
-	next->prev = new;
-	new->next = next;
-	new->prev = prev;
-	prev->next = new;
-}
-
-/**
- * minios_list_add - add a new entry
- * @new: new entry to be added
- * @head: list head to add it after
- *
- * Insert a new entry after the specified head.
- * This is good for implementing stacks.
- */
-static __inline__ void minios_list_add(struct minios_list_head *new, struct minios_list_head *head)
-{
-	__minios_list_add(new, head, head->next);
-}
-
-/**
- * minios_list_add_tail - add a new entry
- * @new: new entry to be added
- * @head: list head to add it before
- *
- * Insert a new entry before the specified head.
- * This is useful for implementing queues.
- */
-static __inline__ void minios_list_add_tail(struct minios_list_head *new, struct minios_list_head *head)
-{
-	__minios_list_add(new, head->prev, head);
-}
-
-/*
- * Delete a list entry by making the prev/next entries
- * point to each other.
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static __inline__ void __minios_list_del(struct minios_list_head * prev,
-				  struct minios_list_head * next)
-{
-	next->prev = prev;
-	prev->next = next;
-}
-
-/**
- * minios_list_del - deletes entry from list.
- * @entry: the element to delete from the list.
- * Note: minios_list_empty on entry does not return true after this, the entry is in an undefined state.
- */
-static __inline__ void minios_list_del(struct minios_list_head *entry)
-{
-	__minios_list_del(entry->prev, entry->next);
-}
-
-/**
- * minios_list_del_init - deletes entry from list and reinitialize it.
- * @entry: the element to delete from the list.
- */
-static __inline__ void minios_list_del_init(struct minios_list_head *entry)
-{
-	__minios_list_del(entry->prev, entry->next);
-	MINIOS_INIT_LIST_HEAD(entry); 
-}
-
-/**
- * minios_list_empty - tests whether a list is empty
- * @head: the list to test.
- */
-static __inline__ int minios_list_empty(struct minios_list_head *head)
-{
-	return head->next == head;
-}
-
-/**
- * minios_list_splice - join two lists
- * @list: the new list to add.
- * @head: the place to add it in the first list.
- */
-static __inline__ void minios_list_splice(struct minios_list_head *list, struct minios_list_head *head)
-{
-	struct minios_list_head *first = list->next;
-
-	if (first != list) {
-		struct minios_list_head *last = list->prev;
-		struct minios_list_head *at = head->next;
-
-		first->prev = head;
-		head->next = first;
-
-		last->next = at;
-		at->prev = last;
-	}
-}
-
-/**
- * minios_list_entry - get the struct for this entry
- * @ptr:	the &struct minios_list_head pointer.
- * @type:	the type of the struct this is embedded in.
- * @member:	the name of the minios_list_struct within the struct.
- */
-#define minios_list_entry(ptr, type, member) \
-	((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
-
-/**
- * minios_list_for_each	-	iterate over a list
- * @pos:	the &struct minios_list_head to use as a loop counter.
- * @head:	the head for your list.
- */
-#define minios_list_for_each(pos, head) \
-	for (pos = (head)->next; pos != (head); pos = pos->next)
-        	
-/**
- * minios_list_for_each_safe	-	iterate over a list safe against removal of list entry
- * @pos:	the &struct minios_list_head to use as a loop counter.
- * @n:		another &struct minios_list_head to use as temporary storage
- * @head:	the head for your list.
- */
-#define minios_list_for_each_safe(pos, n, head) \
-	for (pos = (head)->next, n = pos->next; pos != (head); \
-		pos = n, n = pos->next)
-
-/**
- * minios_list_for_each_entry	-	iterate over list of given type
- * @pos:	the type * to use as a loop counter.
- * @head:	the head for your list.
- * @member:	the name of the minios_list_struct within the struct.
- */
-#define minios_list_for_each_entry(pos, head, member)				\
-	for (pos = minios_list_entry((head)->next, typeof(*pos), member);	\
-	     &pos->member != (head); 					\
-	     pos = minios_list_entry(pos->member.next, typeof(*pos), member))
-
-/**
- * minios_list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
- * @pos:	the type * to use as a loop counter.
- * @n:		another type * to use as temporary storage
- * @head:	the head for your list.
- * @member:	the name of the minios_list_struct within the struct.
- */
-#define minios_list_for_each_entry_safe(pos, n, head, member)			\
-	for (pos = minios_list_entry((head)->next, typeof(*pos), member),	\
-		n = minios_list_entry(pos->member.next, typeof(*pos), member);	\
-	     &pos->member != (head); 					\
-	     pos = n, n = minios_list_entry(n->member.next, typeof(*n), member))
-#endif /* _LINUX_LIST_H */
-
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/include/sched.h
--- a/extras/mini-os/include/sched.h	Tue Jan 31 11:39:37 2012 +0000
+++ b/extras/mini-os/include/sched.h	Tue Jan 31 16:06:14 2012 +0000
@@ -19,7 +19,7 @@
 #else /* !defined(__ia64__) */
     thread_regs_t regs;
 #endif /* !defined(__ia64__) */
-    struct minios_list_head thread_list;
+    MINIOS_TAILQ_ENTRY(struct thread) thread_list;
     uint32_t flags;
     s_time_t wakeup_time;
 #ifdef HAVE_LIBC
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/include/semaphore.h
--- a/extras/mini-os/include/semaphore.h	Tue Jan 31 11:39:37 2012 +0000
+++ b/extras/mini-os/include/semaphore.h	Tue Jan 31 16:06:14 2012 +0000
@@ -21,7 +21,6 @@
 struct rw_semaphore {
 	signed long		count;
 	spinlock_t		wait_lock;
-	struct minios_list_head	wait_list;
 	int			debug;
 };
 
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/include/wait.h
--- a/extras/mini-os/include/wait.h	Tue Jan 31 11:39:37 2012 +0000
+++ b/extras/mini-os/include/wait.h	Tue Jan 31 16:06:14 2012 +0000
@@ -5,47 +5,47 @@
 #include <mini-os/os.h>
 #include <mini-os/waittypes.h>
 
-#define DEFINE_WAIT(name)                               \
-struct wait_queue name = {                              \
-    .thread       = get_current(),                            \
-    .thread_list  = MINIOS_LIST_HEAD_INIT((name).thread_list), \
+#define DEFINE_WAIT(name)                          \
+struct wait_queue name = {                         \
+    .thread       = get_current(),                 \
+    .waiting      = 0,                             \
 }
 
 
 static inline void init_waitqueue_head(struct wait_queue_head *h)
 {
-  MINIOS_INIT_LIST_HEAD(&h->thread_list);
+    MINIOS_STAILQ_INIT(h);
 }
 
 static inline void init_waitqueue_entry(struct wait_queue *q, struct thread *thread)
 {
     q->thread = thread;
-    MINIOS_INIT_LIST_HEAD(&q->thread_list);
+    q->waiting = 0;
 }
 
-
 static inline void add_wait_queue(struct wait_queue_head *h, struct wait_queue *q)
 {
-    if (minios_list_empty(&q->thread_list))
-        minios_list_add(&q->thread_list, &h->thread_list);   
+    if (!q->waiting) {
+        MINIOS_STAILQ_INSERT_HEAD(h, q, thread_list);
+        q->waiting = 1;
+    }
 }
 
-static inline void remove_wait_queue(struct wait_queue *q)
+static inline void remove_wait_queue(struct wait_queue_head *h, struct wait_queue *q)
 {
-    minios_list_del(&q->thread_list);
+    if (q->waiting) {
+        MINIOS_STAILQ_REMOVE(h, q, struct wait_queue, thread_list);
+        q->waiting = 0;
+    }
 }
 
 static inline void wake_up(struct wait_queue_head *head)
 {
     unsigned long flags;
-    struct minios_list_head *tmp, *next;
+    struct wait_queue *curr, *tmp;
     local_irq_save(flags);
-    minios_list_for_each_safe(tmp, next, &head->thread_list)
-    {
-         struct wait_queue *curr;
-         curr = minios_list_entry(tmp, struct wait_queue, thread_list);
+    MINIOS_STAILQ_FOREACH_SAFE(curr, head, thread_list, tmp)
          wake(curr->thread);
-    }
     local_irq_restore(flags);
 }
 
@@ -57,11 +57,11 @@
     local_irq_restore(flags);   \
 } while (0)
 
-#define remove_waiter(w) do {   \
-    unsigned long flags;        \
-    local_irq_save(flags);      \
-    remove_wait_queue(&w);      \
-    local_irq_restore(flags);   \
+#define remove_waiter(w, wq) do {  \
+    unsigned long flags;           \
+    local_irq_save(flags);         \
+    remove_wait_queue(&wq, &w);    \
+    local_irq_restore(flags);      \
 } while (0)
 
 #define wait_event_deadline(wq, condition, deadline) do {       \
@@ -84,7 +84,7 @@
     local_irq_save(flags);                                      \
     /* need to wake up */                                       \
     wake(get_current());                                        \
-    remove_wait_queue(&__wait);                                 \
+    remove_wait_queue(&wq, &__wait);                            \
     local_irq_restore(flags);                                   \
 } while(0) 
 
@@ -93,3 +93,13 @@
 
 
 #endif /* __WAIT_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/include/waittypes.h
--- a/extras/mini-os/include/waittypes.h	Tue Jan 31 11:39:37 2012 +0000
+++ b/extras/mini-os/include/waittypes.h	Tue Jan 31 16:06:14 2012 +0000
@@ -6,21 +6,27 @@
 struct thread;
 struct wait_queue
 {
+    int waiting;
     struct thread *thread;
-    struct minios_list_head thread_list;
+    MINIOS_STAILQ_ENTRY(struct wait_queue) thread_list;
 };
 
-struct wait_queue_head
-{
-    /* TODO - lock required? */
-    struct minios_list_head thread_list;
-};
+/* TODO - lock required? */
+MINIOS_STAILQ_HEAD(wait_queue_head, struct wait_queue);
 
 #define DECLARE_WAIT_QUEUE_HEAD(name) \
-   struct wait_queue_head name =     \
-        { .thread_list = { &(name).thread_list, &(name).thread_list} }
+    struct wait_queue_head name = MINIOS_STAILQ_HEAD_INITIALIZER(name)
 
-#define __WAIT_QUEUE_HEAD_INITIALIZER(name) {                           \
-    .thread_list      = { &(name).thread_list, &(name).thread_list } }
+#define __WAIT_QUEUE_HEAD_INITIALIZER(name) MINIOS_STAILQ_HEAD_INITIALIZER(name)
 
 #endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/lib/sys.c
--- a/extras/mini-os/lib/sys.c	Tue Jan 31 11:39:37 2012 +0000
+++ b/extras/mini-os/lib/sys.c	Tue Jan 31 16:06:14 2012 +0000
@@ -234,7 +234,7 @@
                     break;
                 schedule();
             }
-            remove_waiter(w);
+            remove_waiter(w, console_queue);
             return ret;
         }
 #ifdef HAVE_LWIP
@@ -705,12 +705,12 @@
     fd_set myread, mywrite, myexcept;
     struct thread *thread = get_current();
     s_time_t start = NOW(), stop;
-    DEFINE_WAIT(w1);
-    DEFINE_WAIT(w2);
-    DEFINE_WAIT(w3);
-    DEFINE_WAIT(w4);
-    DEFINE_WAIT(w5);
-    DEFINE_WAIT(w6);
+    DEFINE_WAIT(netfront_w);
+    DEFINE_WAIT(event_w);
+    DEFINE_WAIT(blkfront_w);
+    DEFINE_WAIT(xenbus_watch_w);
+    DEFINE_WAIT(kbdfront_w);
+    DEFINE_WAIT(console_w);
 
     assert(thread == main_thread);
 
@@ -727,12 +727,12 @@
     /* Tell people we're going to sleep before looking at what they are
      * saying, hence letting them wake us if events happen between here and
      * schedule() */
-    add_waiter(w1, netfront_queue);
-    add_waiter(w2, event_queue);
-    add_waiter(w3, blkfront_queue);
-    add_waiter(w4, xenbus_watch_queue);
-    add_waiter(w5, kbdfront_queue);
-    add_waiter(w6, console_queue);
+    add_waiter(netfront_w, netfront_queue);
+    add_waiter(event_w, event_queue);
+    add_waiter(blkfront_w, blkfront_queue);
+    add_waiter(xenbus_watch_w, xenbus_watch_queue);
+    add_waiter(kbdfront_w, kbdfront_queue);
+    add_waiter(console_w, console_queue);
 
     if (readfds)
         myread = *readfds;
@@ -814,12 +814,12 @@
     ret = -1;
 
 out:
-    remove_waiter(w1);
-    remove_waiter(w2);
-    remove_waiter(w3);
-    remove_waiter(w4);
-    remove_waiter(w5);
-    remove_waiter(w6);
+    remove_waiter(netfront_w, netfront_queue);
+    remove_waiter(event_w, event_queue);
+    remove_waiter(blkfront_w, blkfront_queue);
+    remove_waiter(xenbus_watch_w, xenbus_watch_queue);
+    remove_waiter(kbdfront_w, kbdfront_queue);
+    remove_waiter(console_w, console_queue);
     return ret;
 }
 
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/lib/xmalloc.c
--- a/extras/mini-os/lib/xmalloc.c	Tue Jan 31 11:39:37 2012 +0000
+++ b/extras/mini-os/lib/xmalloc.c	Tue Jan 31 16:06:14 2012 +0000
@@ -44,16 +44,18 @@
 #include <mini-os/xmalloc.h>
 
 #ifndef HAVE_LIBC
-static MINIOS_LIST_HEAD(freelist);
 /* static spinlock_t freelist_lock = SPIN_LOCK_UNLOCKED; */
 
 struct xmalloc_hdr
 {
     /* Total including this hdr, unused padding and second hdr. */
     size_t size;
-    struct minios_list_head freelist;
+    MINIOS_TAILQ_ENTRY(struct xmalloc_hdr) freelist;
 } __cacheline_aligned;
 
+static MINIOS_TAILQ_HEAD(,struct xmalloc_hdr) freelist =
+	MINIOS_TAILQ_HEAD_INITIALIZER(freelist);
+
 /* Unused padding data between the two hdrs. */
 
 struct xmalloc_pad
@@ -82,7 +84,7 @@
         extra = (struct xmalloc_hdr *)((unsigned long)hdr + size);
         extra->size = leftover;
         /* spin_lock_irqsave(&freelist_lock, flags); */
-        minios_list_add(&extra->freelist, &freelist);
+        MINIOS_TAILQ_INSERT_HEAD(&freelist, extra, freelist);
         /* spin_unlock_irqrestore(&freelist_lock, flags); */
     }
     else
@@ -91,8 +93,6 @@
     }
 
     hdr->size = size;
-    /* Debugging aid. */
-    hdr->freelist.next = hdr->freelist.prev = NULL;
 }
 
 static struct xmalloc_hdr *xmalloc_new_page(size_t size)
@@ -128,8 +128,6 @@
         return NULL;
 
     hdr->size = (1UL << (pageorder + PAGE_SHIFT));
-    /* Debugging aid. */
-    hdr->freelist.next = hdr->freelist.prev = NULL;
 
     ret = (char*)hdr + hdr_size;
     pad = (struct xmalloc_pad *) ret - 1;
@@ -155,14 +153,14 @@
 
     /* Search free list. */
     /* spin_lock_irqsave(&freelist_lock, flags); */
-    minios_list_for_each_entry_safe( i, tmp, &freelist, freelist )
+    MINIOS_TAILQ_FOREACH_SAFE(i, &freelist, freelist, tmp)
     {
         data_begin = align_up((uintptr_t)i + hdr_size, align);
 
         if ( data_begin + size > (uintptr_t)i + i->size )
             continue;
 
-        minios_list_del(&i->freelist);
+        MINIOS_TAILQ_REMOVE(&freelist, i, freelist);
         /* spin_unlock_irqrestore(&freelist_lock, flags); */
 
         uintptr_t size_before = (data_begin - hdr_size) - (uintptr_t)i;
@@ -173,7 +171,7 @@
             new_i->size = i->size - size_before;
             i->size = size_before;
             /* spin_lock_irqsave(&freelist_lock, flags); */
-            minios_list_add(&i->freelist, &freelist);
+            MINIOS_TAILQ_INSERT_HEAD(&freelist, i, freelist);
             /* spin_unlock_irqrestore(&freelist_lock, flags); */
             i = new_i;
         }
@@ -224,16 +222,9 @@
         *(int*)0=0;
     }
 
-    /* Not previously freed. */
-    if(hdr->freelist.next || hdr->freelist.prev)
-    {
-        printk("Should not be previously freed\n");
-        *(int*)0=0;
-    }
-
     /* Merge with other free block, or put in list. */
     /* spin_lock_irqsave(&freelist_lock, flags); */
-    minios_list_for_each_entry_safe( i, tmp, &freelist, freelist )
+    MINIOS_TAILQ_FOREACH_SAFE(i, &freelist, freelist, tmp)
     {
         unsigned long _i   = (unsigned long)i;
         unsigned long _hdr = (unsigned long)hdr;
@@ -245,7 +236,7 @@
         /* We follow this block?  Swallow it. */
         if ( (_i + i->size) == _hdr )
         {
-            minios_list_del(&i->freelist);
+            MINIOS_TAILQ_REMOVE(&freelist, i, freelist);
             i->size += hdr->size;
             hdr = i;
         }
@@ -253,7 +244,7 @@
         /* We precede this block? Swallow it. */
         if ( (_hdr + hdr->size) == _i )
         {
-            minios_list_del(&i->freelist);
+            MINIOS_TAILQ_REMOVE(&freelist, i, freelist);
             hdr->size += i->size;
         }
     }
@@ -270,7 +261,7 @@
     }
     else
     {
-        minios_list_add(&hdr->freelist, &freelist);
+        MINIOS_TAILQ_INSERT_HEAD(&freelist, hdr, freelist);
     }
 
     /* spin_unlock_irqrestore(&freelist_lock, flags); */
@@ -306,3 +297,13 @@
     return new;
 }
 #endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/sched.c
--- a/extras/mini-os/sched.c	Tue Jan 31 11:39:37 2012 +0000
+++ b/extras/mini-os/sched.c	Tue Jan 31 16:06:14 2012 +0000
@@ -54,19 +54,20 @@
 #define DEBUG(_f, _a...)    ((void)0)
 #endif
 
+MINIOS_TAILQ_HEAD(thread_list, struct thread);
+
 struct thread *idle_thread = NULL;
-MINIOS_LIST_HEAD(exited_threads);
+static struct thread_list exited_threads = MINIOS_TAILQ_HEAD_INITIALIZER(exited_threads);
+static struct thread_list thread_list = MINIOS_TAILQ_HEAD_INITIALIZER(thread_list);
 static int threads_started;
 
 struct thread *main_thread;
 
 void inline print_runqueue(void)
 {
-    struct minios_list_head *it;
     struct thread *th;
-    minios_list_for_each(it, &idle_thread->thread_list)
+    MINIOS_TAILQ_FOREACH(th, &thread_list, thread_list)
     {
-        th = minios_list_entry(it, struct thread, thread_list);
         printk("   Thread \"%s\", runnable=%d\n", th->name, is_runnable(th));
     }
     printk("\n");
@@ -74,8 +75,7 @@
 
 void schedule(void)
 {
-    struct thread *prev, *next, *thread;
-    struct minios_list_head *iterator, *next_iterator;
+    struct thread *prev, *next, *thread, *tmp;
     unsigned long flags;
 
     prev = current;
@@ -96,10 +96,9 @@
            time when the next timeout expires, else use 10 seconds. */
         s_time_t now = NOW();
         s_time_t min_wakeup_time = now + SECONDS(10);
-        next = NULL;   
-        minios_list_for_each_safe(iterator, next_iterator, &idle_thread->thread_list)
+        next = NULL;
+        MINIOS_TAILQ_FOREACH_SAFE(thread, &thread_list, thread_list, tmp)
         {
-            thread = minios_list_entry(iterator, struct thread, thread_list);
             if (!is_runnable(thread) && thread->wakeup_time != 0LL)
             {
                 if (thread->wakeup_time <= now)
@@ -111,8 +110,8 @@
             {
                 next = thread;
                 /* Put this thread on the end of the list */
-                minios_list_del(&thread->thread_list);
-                minios_list_add_tail(&thread->thread_list, &idle_thread->thread_list);
+                MINIOS_TAILQ_REMOVE(&thread_list, thread, thread_list);
+                MINIOS_TAILQ_INSERT_TAIL(&thread_list, thread, thread_list);
                 break;
             }
         }
@@ -128,12 +127,11 @@
        inturrupted at the return instruction. And therefore at safe point. */
     if(prev != next) switch_threads(prev, next);
 
-    minios_list_for_each_safe(iterator, next_iterator, &exited_threads)
+    MINIOS_TAILQ_FOREACH_SAFE(thread, &exited_threads, thread_list, tmp)
     {
-        thread = minios_list_entry(iterator, struct thread, thread_list);
         if(thread != prev)
         {
-            minios_list_del(&thread->thread_list);
+            MINIOS_TAILQ_REMOVE(&exited_threads, thread, thread_list);
             free_pages(thread->stack, STACK_SIZE_PAGE_ORDER);
             xfree(thread);
         }
@@ -154,13 +152,7 @@
 #endif
     set_runnable(thread);
     local_irq_save(flags);
-    if(idle_thread != NULL) {
-        minios_list_add_tail(&thread->thread_list, &idle_thread->thread_list); 
-    } else if(function != idle_thread_fn)
-    {
-        printk("BUG: Not allowed to create thread before initialising scheduler.\n");
-        BUG();
-    }
+    MINIOS_TAILQ_INSERT_TAIL(&thread_list, thread, thread_list);
     local_irq_restore(flags);
     return thread;
 }
@@ -208,10 +200,10 @@
     printk("Thread \"%s\" exited.\n", thread->name);
     local_irq_save(flags);
     /* Remove from the thread list */
-    minios_list_del(&thread->thread_list);
+    MINIOS_TAILQ_REMOVE(&thread_list, thread, thread_list);
     clear_runnable(thread);
     /* Put onto exited list */
-    minios_list_add(&thread->thread_list, &exited_threads);
+    MINIOS_TAILQ_INSERT_HEAD(&exited_threads, thread, thread_list);
     local_irq_restore(flags);
     /* Schedule will free the resources */
     while(1)
@@ -296,6 +288,14 @@
     _REENT_INIT_PTR((&callback_reent))
 #endif
     idle_thread = create_thread("Idle", idle_thread_fn, NULL);
-    MINIOS_INIT_LIST_HEAD(&idle_thread->thread_list);
 }
 
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 6c9a73817770 -r 934c14ab9f19 extras/mini-os/xenbus/xenbus.c
--- a/extras/mini-os/xenbus/xenbus.c	Tue Jan 31 11:39:37 2012 +0000
+++ b/extras/mini-os/xenbus/xenbus.c	Tue Jan 31 16:06:14 2012 +0000
@@ -85,7 +85,7 @@
         add_waiter(w, xenbus_watch_queue);
         schedule();
     }
-    remove_waiter(w);
+    remove_waiter(w, xenbus_watch_queue);
     *queue = event->next;
     return &event->path;
 }
@@ -441,7 +441,7 @@
     xb_write(type, id, trans, io, nr_reqs);
 
     schedule();
-    remove_waiter(w);
+    remove_waiter(w, req_info[id].waitq);
     wake(current);
 
     rep = req_info[id].reply;
diff -r 6c9a73817770 -r 934c14ab9f19 tools/include/xen-external/README
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/include/xen-external/README	Tue Jan 31 16:06:14 2012 +0000
@@ -0,0 +1,24 @@
+WARNING - DO NOT EDIT THINGS IN THIS DIRECTORY
+----------------------------------------------
+
+These files were obtained elsewhere and should only be updated by
+copying new versions from the source location, as documented below:
+
+bsd-COPYRIGHT
+bsd-sys-queue.h
+bsd-queue.3
+
+  Obtained from the FreeBSD SVN using the following commands:
+    svn co -r 221843 svn://svn.freebsd.org/base/head/sys/sys/
+    svn co -r 221843 svn://svn.freebsd.org/base/head/share/man/man3
+    svn cat -r 221843 http://svn.freebsd.org/base/head/COPYRIGHT >tools/libxl/external/bsd-COPYRIGHT
+
+Exceptions:
+
+README
+
+  This file
+
+bsd-sys-queue-h-seddery
+
+  Script to transform the above into a new namespace.
diff -r 6c9a73817770 -r 934c14ab9f19 tools/include/xen-external/bsd-COPYRIGHT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/include/xen-external/bsd-COPYRIGHT	Tue Jan 31 16:06:14 2012 +0000
@@ -0,0 +1,126 @@
+# $FreeBSD$
+#	@(#)COPYRIGHT	8.2 (Berkeley) 3/21/94
+
+The compilation of software known as FreeBSD is distributed under the
+following terms:
+
+Copyright (c) 1992-2011 The FreeBSD Project. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+The 4.4BSD and 4.4BSD-Lite software is distributed under the following
+terms:
+
+All of the documentation and software included in the 4.4BSD and 4.4BSD-Lite
+Releases is copyrighted by The Regents of the University of California.
+
+Copyright 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
+	The Regents of the University of California.  All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. All advertising materials mentioning features or use of this software
+   must display the following acknowledgement:
+This product includes software developed by the University of
+California, Berkeley and its contributors.
+4. Neither the name of the University nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+The Institute of Electrical and Electronics Engineers and the American
+National Standards Committee X3, on Information Processing Systems have
+given us permission to reprint portions of their documentation.
+
+In the following statement, the phrase ``this text'' refers to portions
+of the system documentation.
+
+Portions of this text are reprinted and reproduced in electronic form in
+the second BSD Networking Software Release, from IEEE Std 1003.1-1988, IEEE
+Standard Portable Operating System Interface for Computer Environments
+(POSIX), copyright C 1988 by the Institute of Electrical and Electronics
+Engineers, Inc.  In the event of any discrepancy between these versions
+and the original IEEE Standard, the original IEEE Standard is the referee
+document.
+
+In the following statement, the phrase ``This material'' refers to portions
+of the system documentation.
+
+This material is reproduced with permission from American National
+Standards Committee X3, on Information Processing Systems.  Computer and
+Business Equipment Manufacturers Association (CBEMA), 311 First St., NW,
+Suite 500, Washington, DC 20001-2178.  The developmental work of
+Programming Language C was completed by the X3J11 Technical Committee.
+
+The views and conclusions contained in the software and documentation are
+those of the authors and should not be interpreted as representing official
+policies, either expressed or implied, of the Regents of the University
+of California.
+
+
+NOTE: The copyright of UC Berkeley's Berkeley Software Distribution ("BSD")
+source has been updated.  The copyright addendum may be found at
+ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change and is
+included below.
+
+July 22, 1999
+
+To All Licensees, Distributors of Any Version of BSD:
+
+As you know, certain of the Berkeley Software Distribution ("BSD") source
+code files require that further distributions of products containing all or
+portions of the software, acknowledge within their advertising materials
+that such products contain software developed by UC Berkeley and its
+contributors.
+
+Specifically, the provision reads:
+
+"     * 3. All advertising materials mentioning features or use of this software
+      *    must display the following acknowledgement:
+      *    This product includes software developed by the University of
+      *    California, Berkeley and its contributors."
+
+Effective immediately, licensees and distributors are no longer required to
+include the acknowledgement within advertising materials.  Accordingly, the
+foregoing paragraph of those BSD Unix files containing it is hereby deleted
+in its entirety.
+
+William Hoskins
+Director, Office of Technology Licensing
+University of California, Berkeley
diff -r 6c9a73817770 -r 934c14ab9f19 tools/include/xen-external/bsd-queue.3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/include/xen-external/bsd-queue.3	Tue Jan 31 16:06:14 2012 +0000
@@ -0,0 +1,1044 @@
+.\" Copyright (c) 1993
+.\"	The Regents of the University of California.  All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"	This product includes software developed by the University of
+.\"	California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\"	@(#)queue.3	8.2 (Berkeley) 1/24/94
+.\" $FreeBSD$
+.\"
+.Dd May 13, 2011
+.Dt QUEUE 3
+.Os
+.Sh NAME
+.Nm SLIST_EMPTY ,
+.Nm SLIST_ENTRY ,
+.Nm SLIST_FIRST ,
+.Nm SLIST_FOREACH ,
+.Nm SLIST_FOREACH_SAFE ,
+.Nm SLIST_HEAD ,
+.Nm SLIST_HEAD_INITIALIZER ,
+.Nm SLIST_INIT ,
+.Nm SLIST_INSERT_AFTER ,
+.Nm SLIST_INSERT_HEAD ,
+.Nm SLIST_NEXT ,
+.Nm SLIST_REMOVE_AFTER ,
+.Nm SLIST_REMOVE_HEAD ,
+.Nm SLIST_REMOVE ,
+.Nm SLIST_SWAP ,
+.Nm STAILQ_CONCAT ,
+.Nm STAILQ_EMPTY ,
+.Nm STAILQ_ENTRY ,
+.Nm STAILQ_FIRST ,
+.Nm STAILQ_FOREACH ,
+.Nm STAILQ_FOREACH_SAFE ,
+.Nm STAILQ_HEAD ,
+.Nm STAILQ_HEAD_INITIALIZER ,
+.Nm STAILQ_INIT ,
+.Nm STAILQ_INSERT_AFTER ,
+.Nm STAILQ_INSERT_HEAD ,
+.Nm STAILQ_INSERT_TAIL ,
+.Nm STAILQ_LAST ,
+.Nm STAILQ_NEXT ,
+.Nm STAILQ_REMOVE_AFTER ,
+.Nm STAILQ_REMOVE_HEAD ,
+.Nm STAILQ_REMOVE ,
+.Nm STAILQ_SWAP ,
+.Nm LIST_EMPTY ,
+.Nm LIST_ENTRY ,
+.Nm LIST_FIRST ,
+.Nm LIST_FOREACH ,
+.Nm LIST_FOREACH_SAFE ,
+.Nm LIST_HEAD ,
+.Nm LIST_HEAD_INITIALIZER ,
+.Nm LIST_INIT ,
+.Nm LIST_INSERT_AFTER ,
+.Nm LIST_INSERT_BEFORE ,
+.Nm LIST_INSERT_HEAD ,
+.Nm LIST_NEXT ,
+.Nm LIST_REMOVE ,
+.Nm LIST_SWAP ,
+.Nm TAILQ_CONCAT ,
+.Nm TAILQ_EMPTY ,
+.Nm TAILQ_ENTRY ,
+.Nm TAILQ_FIRST ,
+.Nm TAILQ_FOREACH ,
+.Nm TAILQ_FOREACH_SAFE ,
+.Nm TAILQ_FOREACH_REVERSE ,
+.Nm TAILQ_FOREACH_REVERSE_SAFE ,
+.Nm TAILQ_HEAD ,
+.Nm TAILQ_HEAD_INITIALIZER ,
+.Nm TAILQ_INIT ,
+.Nm TAILQ_INSERT_AFTER ,
+.Nm TAILQ_INSERT_BEFORE ,
+.Nm TAILQ_INSERT_HEAD ,
+.Nm TAILQ_INSERT_TAIL ,
+.Nm TAILQ_LAST ,
+.Nm TAILQ_NEXT ,
+.Nm TAILQ_PREV ,
+.Nm TAILQ_REMOVE ,
+.Nm TAILQ_SWAP
+.Nd implementations of singly-linked lists, singly-linked tail queues,
+lists and tail queues
+.Sh SYNOPSIS
+.In sys/queue.h
+.\"
+.Fn SLIST_EMPTY "SLIST_HEAD *head"
+.Fn SLIST_ENTRY "TYPE"
+.Fn SLIST_FIRST "SLIST_HEAD *head"
+.Fn SLIST_FOREACH "TYPE *var" "SLIST_HEAD *head" "SLIST_ENTRY NAME"
+.Fn SLIST_FOREACH_SAFE "TYPE *var" "SLIST_HEAD *head" "SLIST_ENTRY NAME" "TYPE *temp_var"
+.Fn SLIST_HEAD "HEADNAME" "TYPE"
+.Fn SLIST_HEAD_INITIALIZER "SLIST_HEAD head"
+.Fn SLIST_INIT "SLIST_HEAD *head"
+.Fn SLIST_INSERT_AFTER "TYPE *listelm" "TYPE *elm" "SLIST_ENTRY NAME"
+.Fn SLIST_INSERT_HEAD "SLIST_HEAD *head" "TYPE *elm" "SLIST_ENTRY NAME"
+.Fn SLIST_NEXT "TYPE *elm" "SLIST_ENTRY NAME"
+.Fn SLIST_REMOVE_AFTER "TYPE *elm" "SLIST_ENTRY NAME"
+.Fn SLIST_REMOVE_HEAD "SLIST_HEAD *head" "SLIST_ENTRY NAME"
+.Fn SLIST_REMOVE "SLIST_HEAD *head" "TYPE *elm" "TYPE" "SLIST_ENTRY NAME"
+.Fn SLIST_SWAP "SLIST_HEAD *head1" "SLIST_HEAD *head2" "SLIST_ENTRY NAME"
+.\"
+.Fn STAILQ_CONCAT "STAILQ_HEAD *head1" "STAILQ_HEAD *head2"
+.Fn STAILQ_EMPTY "STAILQ_HEAD *head"
+.Fn STAILQ_ENTRY "TYPE"
+.Fn STAILQ_FIRST "STAILQ_HEAD *head"
+.Fn STAILQ_FOREACH "TYPE *var" "STAILQ_HEAD *head" "STAILQ_ENTRY NAME"
+.Fn STAILQ_FOREACH_SAFE "TYPE *var" "STAILQ_HEAD *head" "STAILQ_ENTRY NAME" "TYPE *temp_var"
+.Fn STAILQ_HEAD "HEADNAME" "TYPE"
+.Fn STAILQ_HEAD_INITIALIZER "STAILQ_HEAD head"
+.Fn STAILQ_INIT "STAILQ_HEAD *head"
+.Fn STAILQ_INSERT_AFTER "STAILQ_HEAD *head" "TYPE *listelm" "TYPE *elm" "STAILQ_ENTRY NAME"
+.Fn STAILQ_INSERT_HEAD "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
+.Fn STAILQ_INSERT_TAIL "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
+.Fn STAILQ_LAST "STAILQ_HEAD *head" "TYPE" "STAILQ_ENTRY NAME"
+.Fn STAILQ_NEXT "TYPE *elm" "STAILQ_ENTRY NAME"
+.Fn STAILQ_REMOVE_AFTER "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
+.Fn STAILQ_REMOVE_HEAD "STAILQ_HEAD *head" "STAILQ_ENTRY NAME"
+.Fn STAILQ_REMOVE "STAILQ_HEAD *head" "TYPE *elm" "TYPE" "STAILQ_ENTRY NAME"
+.Fn STAILQ_SWAP "STAILQ_HEAD *head1" "STAILQ_HEAD *head2" "STAILQ_ENTRY NAME"
+.\"
+.Fn LIST_EMPTY "LIST_HEAD *head"
+.Fn LIST_ENTRY "TYPE"
+.Fn LIST_FIRST "LIST_HEAD *head"
+.Fn LIST_FOREACH "TYPE *var" "LIST_HEAD *head" "LIST_ENTRY NAME"
+.Fn LIST_FOREACH_SAFE "TYPE *var" "LIST_HEAD *head" "LIST_ENTRY NAME" "TYPE *temp_var"
+.Fn LIST_HEAD "HEADNAME" "TYPE"
+.Fn LIST_HEAD_INITIALIZER "LIST_HEAD head"
+.Fn LIST_INIT "LIST_HEAD *head"
+.Fn LIST_INSERT_AFTER "TYPE *listelm" "TYPE *elm" "LIST_ENTRY NAME"
+.Fn LIST_INSERT_BEFORE "TYPE *listelm" "TYPE *elm" "LIST_ENTRY NAME"
+.Fn LIST_INSERT_HEAD "LIST_HEAD *head" "TYPE *elm" "LIST_ENTRY NAME"
+.Fn LIST_NEXT "TYPE *elm" "LIST_ENTRY NAME"
+.Fn LIST_REMOVE "TYPE *elm" "LIST_ENTRY NAME"
+.Fn LIST_SWAP "LIST_HEAD *head1" "LIST_HEAD *head2" "TYPE" "LIST_ENTRY NAME"
+.\"
+.Fn TAILQ_CONCAT "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "TAILQ_ENTRY NAME"
+.Fn TAILQ_EMPTY "TAILQ_HEAD *head"
+.Fn TAILQ_ENTRY "TYPE"
+.Fn TAILQ_FIRST "TAILQ_HEAD *head"
+.Fn TAILQ_FOREACH "TYPE *var" "TAILQ_HEAD *head" "TAILQ_ENTRY NAME"
+.Fn TAILQ_FOREACH_SAFE "TYPE *var" "TAILQ_HEAD *head" "TAILQ_ENTRY NAME" "TYPE *temp_var"
+.Fn TAILQ_FOREACH_REVERSE "TYPE *var" "TAILQ_HEAD *head" "HEADNAME" "TAILQ_ENTRY NAME"
+.Fn TAILQ_FOREACH_REVERSE_SAFE "TYPE *var" "TAILQ_HEAD *head" "HEADNAME" "TAILQ_ENTRY NAME" "TYPE *temp_var"
+.Fn TAILQ_HEAD "HEADNAME" "TYPE"
+.Fn TAILQ_HEAD_INITIALIZER "TAILQ_HEAD head"
+.Fn TAILQ_INIT "TAILQ_HEAD *head"
+.Fn TAILQ_INSERT_AFTER "TAILQ_HEAD *head" "TYPE *listelm" "TYPE *elm" "TAILQ_ENTRY NAME"
+.Fn TAILQ_INSERT_BEFORE "TYPE *listelm" "TYPE *elm" "TAILQ_ENTRY NAME"
+.Fn TAILQ_INSERT_HEAD "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME"
+.Fn TAILQ_INSERT_TAIL "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME"
+.Fn TAILQ_LAST "TAILQ_HEAD *head" "HEADNAME"
+.Fn TAILQ_NEXT "TYPE *elm" "TAILQ_ENTRY NAME"
+.Fn TAILQ_PREV "TYPE *elm" "HEADNAME" "TAILQ_ENTRY NAME"
+.Fn TAILQ_REMOVE "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME"
+.Fn TAILQ_SWAP "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "TYPE" "TAILQ_ENTRY NAME"
+.\"
+.Sh DESCRIPTION
+These macros define and operate on four types of data structures:
+singly-linked lists, singly-linked tail queues, lists, and tail queues.
+All four structures support the following functionality:
+.Bl -enum -compact -offset indent
+.It
+Insertion of a new entry at the head of the list.
+.It
+Insertion of a new entry after any element in the list.
+.It
+O(1) removal of an entry from the head of the list.
+.It
+Forward traversal through the list.
+.It
+Swawpping the contents of two lists.
+.El
+.Pp
+Singly-linked lists are the simplest of the four data structures
+and support only the above functionality.
+Singly-linked lists are ideal for applications with large datasets
+and few or no removals,
+or for implementing a LIFO queue.
+Singly-linked lists add the following functionality:
+.Bl -enum -compact -offset indent
+.It
+O(n) removal of any entry in the list.
+.El
+.Pp
+Singly-linked tail queues add the following functionality:
+.Bl -enum -compact -offset indent
+.It
+Entries can be added at the end of a list.
+.It
+O(n) removal of any entry in the list.
+.It
+They may be concatenated.
+.El
+However:
+.Bl -enum -compact -offset indent
+.It
+All list insertions must specify the head of the list.
+.It
+Each head entry requires two pointers rather than one.
+.It
+Code size is about 15% greater and operations run about 20% slower
+than singly-linked lists.
+.El
+.Pp
+Singly-linked tailqs are ideal for applications with large datasets and
+few or no removals,
+or for implementing a FIFO queue.
+.Pp
+All doubly linked types of data structures (lists and tail queues)
+additionally allow:
+.Bl -enum -compact -offset indent
+.It
+Insertion of a new entry before any element in the list.
+.It
+O(1) removal of any entry in the list.
+.El
+However:
+.Bl -enum -compact -offset indent
+.It
+Each element requires two pointers rather than one.
+.It
+Code size and execution time of operations (except for removal) is about
+twice that of the singly-linked data-structures.
+.El
+.Pp
+Linked lists are the simplest of the doubly linked data structures and support
+only the above functionality over singly-linked lists.
+.Pp
+Tail queues add the following functionality:
+.Bl -enum -compact -offset indent
+.It
+Entries can be added at the end of a list.
+.It
+They may be traversed backwards, from tail to head.
+.It
+They may be concatenated.
+.El
+However:
+.Bl -enum -compact -offset indent
+.It
+All list insertions and removals must specify the head of the list.
+.It
+Each head entry requires two pointers rather than one.
+.It
+Code size is about 15% greater and operations run about 20% slower
+than singly-linked lists.
+.El
+.Pp
+In the macro definitions,
+.Fa TYPE
+is the name of a user defined structure,
+that must contain a field of type
+.Li SLIST_ENTRY ,
+.Li STAILQ_ENTRY ,
+.Li LIST_ENTRY ,
+or
+.Li TAILQ_ENTRY ,
+named
+.Fa NAME .
+The argument
+.Fa HEADNAME
+is the name of a user defined structure that must be declared
+using the macros
+.Li SLIST_HEAD ,
+.Li STAILQ_HEAD ,
+.Li LIST_HEAD ,
+or
+.Li TAILQ_HEAD .
+See the examples below for further explanation of how these
+macros are used.
+.Sh SINGLY-LINKED LISTS
+A singly-linked list is headed by a structure defined by the
+.Nm SLIST_HEAD
+macro.
+This structure contains a single pointer to the first element
+on the list.
+The elements are singly linked for minimum space and pointer manipulation
+overhead at the expense of O(n) removal for arbitrary elements.
+New elements can be added to the list after an existing element or
+at the head of the list.
+An
+.Fa SLIST_HEAD
+structure is declared as follows:
+.Bd -literal -offset indent
+SLIST_HEAD(HEADNAME, TYPE) head;
+.Ed
+.Pp
+where
+.Fa HEADNAME
+is the name of the structure to be defined, and
+.Fa TYPE
+is the type of the elements to be linked into the list.
+A pointer to the head of the list can later be declared as:
+.Bd -literal -offset indent
+struct HEADNAME *headp;
+.Ed
+.Pp
+(The names
+.Li head
+and
+.Li headp
+are user selectable.)
+.Pp
+The macro
+.Nm SLIST_HEAD_INITIALIZER
+evaluates to an initializer for the list
+.Fa head .
+.Pp
+The macro
+.Nm SLIST_EMPTY
+evaluates to true if there are no elements in the list.
+.Pp
+The macro
+.Nm SLIST_ENTRY
+declares a structure that connects the elements in
+the list.
+.Pp
+The macro
+.Nm SLIST_FIRST
+returns the first element in the list or NULL if the list is empty.
+.Pp
+The macro
+.Nm SLIST_FOREACH
+traverses the list referenced by
+.Fa head
+in the forward direction, assigning each element in
+turn to
+.Fa var .
+.Pp
+The macro
+.Nm SLIST_FOREACH_SAFE
+traverses the list referenced by
+.Fa head
+in the forward direction, assigning each element in
+turn to
+.Fa var .
+However, unlike
+.Fn SLIST_FOREACH
+here it is permitted to both remove
+.Fa var
+as well as free it from within the loop safely without interfering with the
+traversal.
+.Pp
+The macro
+.Nm SLIST_INIT
+initializes the list referenced by
+.Fa head .
+.Pp
+The macro
+.Nm SLIST_INSERT_HEAD
+inserts the new element
+.Fa elm
+at the head of the list.
+.Pp
+The macro
+.Nm SLIST_INSERT_AFTER
+inserts the new element
+.Fa elm
+after the element
+.Fa listelm .
+.Pp
+The macro
+.Nm SLIST_NEXT
+returns the next element in the list.
+.Pp
+The macro
+.Nm SLIST_REMOVE_AFTER
+removes the element after
+.Fa elm
+from the list. Unlike
+.Fa SLIST_REMOVE ,
+this macro does not traverse the entire list.
+.Pp
+The macro
+.Nm SLIST_REMOVE_HEAD
+removes the element
+.Fa elm
+from the head of the list.
+For optimum efficiency,
+elements being removed from the head of the list should explicitly use
+this macro instead of the generic
+.Fa SLIST_REMOVE
+macro.
+.Pp
+The macro
+.Nm SLIST_REMOVE
+removes the element
+.Fa elm
+from the list.
+.Pp
+The macro
+.Nm SLIST_SWAP
+swaps the contents of
+.Fa head1
+and
+.Fa head2 .
+.Sh SINGLY-LINKED LIST EXAMPLE
+.Bd -literal
+SLIST_HEAD(slisthead, entry) head =
+    SLIST_HEAD_INITIALIZER(head);
+struct slisthead *headp;		/* Singly-linked List head. */
+struct entry {
+	...
+	SLIST_ENTRY(entry) entries;	/* Singly-linked List. */
+	...
+} *n1, *n2, *n3, *np;
+
+SLIST_INIT(&head);			/* Initialize the list. */
+
+n1 = malloc(sizeof(struct entry));	/* Insert at the head. */
+SLIST_INSERT_HEAD(&head, n1, entries);
+
+n2 = malloc(sizeof(struct entry));	/* Insert after. */
+SLIST_INSERT_AFTER(n1, n2, entries);
+
+SLIST_REMOVE(&head, n2, entry, entries);/* Deletion. */
+free(n2);
+
+n3 = SLIST_FIRST(&head);
+SLIST_REMOVE_HEAD(&head, entries);	/* Deletion from the head. */
+free(n3);
+					/* Forward traversal. */
+SLIST_FOREACH(np, &head, entries)
+	np-> ...
+					/* Safe forward traversal. */
+SLIST_FOREACH_SAFE(np, &head, entries, np_temp) {
+	np->do_stuff();
+	...
+	SLIST_REMOVE(&head, np, entry, entries);
+	free(np);
+}
+
+while (!SLIST_EMPTY(&head)) {		/* List Deletion. */
+	n1 = SLIST_FIRST(&head);
+	SLIST_REMOVE_HEAD(&head, entries);
+	free(n1);
+}
+.Ed
+.Sh SINGLY-LINKED TAIL QUEUES
+A singly-linked tail queue is headed by a structure defined by the
+.Nm STAILQ_HEAD
+macro.
+This structure contains a pair of pointers,
+one to the first element in the tail queue and the other to
+the last element in the tail queue.
+The elements are singly linked for minimum space and pointer
+manipulation overhead at the expense of O(n) removal for arbitrary
+elements.
+New elements can be added to the tail queue after an existing element,
+at the head of the tail queue, or at the end of the tail queue.
+A
+.Fa STAILQ_HEAD
+structure is declared as follows:
+.Bd -literal -offset indent
+STAILQ_HEAD(HEADNAME, TYPE) head;
+.Ed
+.Pp
+where
+.Li HEADNAME
+is the name of the structure to be defined, and
+.Li TYPE
+is the type of the elements to be linked into the tail queue.
+A pointer to the head of the tail queue can later be declared as:
+.Bd -literal -offset indent
+struct HEADNAME *headp;
+.Ed
+.Pp
+(The names
+.Li head
+and
+.Li headp
+are user selectable.)
+.Pp
+The macro
+.Nm STAILQ_HEAD_INITIALIZER
+evaluates to an initializer for the tail queue
+.Fa head .
+.Pp
+The macro
+.Nm STAILQ_CONCAT
+concatenates the tail queue headed by
+.Fa head2
+onto the end of the one headed by
+.Fa head1
+removing all entries from the former.
+.Pp
+The macro
+.Nm STAILQ_EMPTY
+evaluates to true if there are no items on the tail queue.
+.Pp
+The macro
+.Nm STAILQ_ENTRY
+declares a structure that connects the elements in
+the tail queue.
+.Pp
+The macro
+.Nm STAILQ_FIRST
+returns the first item on the tail queue or NULL if the tail queue
+is empty.
+.Pp
+The macro
+.Nm STAILQ_FOREACH
+traverses the tail queue referenced by
+.Fa head
+in the forward direction, assigning each element
+in turn to
+.Fa var .
+.Pp
+The macro
+.Nm STAILQ_FOREACH_SAFE
+traverses the tail queue referenced by
+.Fa head
+in the forward direction, assigning each element
+in turn to
+.Fa var .
+However, unlike
+.Fn STAILQ_FOREACH
+here it is permitted to both remove
+.Fa var
+as well as free it from within the loop safely without interfering with the
+traversal.
+.Pp
+The macro
+.Nm STAILQ_INIT
+initializes the tail queue referenced by
+.Fa head .
+.Pp
+The macro
+.Nm STAILQ_INSERT_HEAD
+inserts the new element
+.Fa elm
+at the head of the tail queue.
+.Pp
+The macro
+.Nm STAILQ_INSERT_TAIL
+inserts the new element
+.Fa elm
+at the end of the tail queue.
+.Pp
+The macro
+.Nm STAILQ_INSERT_AFTER
+inserts the new element
+.Fa elm
+after the element
+.Fa listelm .
+.Pp
+The macro
+.Nm STAILQ_LAST
+returns the last item on the tail queue.
+If the tail queue is empty the return value is
+.Dv NULL .
+.Pp
+The macro
+.Nm STAILQ_NEXT
+returns the next item on the tail queue, or NULL this item is the last.
+.Pp
+The macro
+.Nm STAILQ_REMOVE_AFTER
+removes the element after
+.Fa elm
+from the tail queue. Unlike
+.Fa STAILQ_REMOVE ,
+this macro does not traverse the entire tail queue.
+.Pp
+The macro
+.Nm STAILQ_REMOVE_HEAD
+removes the element at the head of the tail queue.
+For optimum efficiency,
+elements being removed from the head of the tail queue should
+use this macro explicitly rather than the generic
+.Fa STAILQ_REMOVE
+macro.
+.Pp
+The macro
+.Nm STAILQ_REMOVE
+removes the element
+.Fa elm
+from the tail queue.
+.Pp
+The macro
+.Nm STAILQ_SWAP
+swaps the contents of
+.Fa head1
+and
+.Fa head2 .
+.Sh SINGLY-LINKED TAIL QUEUE EXAMPLE
+.Bd -literal
+STAILQ_HEAD(stailhead, entry) head =
+    STAILQ_HEAD_INITIALIZER(head);
+struct stailhead *headp;		/* Singly-linked tail queue head. */
+struct entry {
+	...
+	STAILQ_ENTRY(entry) entries;	/* Tail queue. */
+	...
+} *n1, *n2, *n3, *np;
+
+STAILQ_INIT(&head);			/* Initialize the queue. */
+
+n1 = malloc(sizeof(struct entry));	/* Insert at the head. */
+STAILQ_INSERT_HEAD(&head, n1, entries);
+
+n1 = malloc(sizeof(struct entry));	/* Insert at the tail. */
+STAILQ_INSERT_TAIL(&head, n1, entries);
+
+n2 = malloc(sizeof(struct entry));	/* Insert after. */
+STAILQ_INSERT_AFTER(&head, n1, n2, entries);
+					/* Deletion. */
+STAILQ_REMOVE(&head, n2, entry, entries);
+free(n2);
+					/* Deletion from the head. */
+n3 = STAILQ_FIRST(&head);
+STAILQ_REMOVE_HEAD(&head, entries);
+free(n3);
+					/* Forward traversal. */
+STAILQ_FOREACH(np, &head, entries)
+	np-> ...
+					/* Safe forward traversal. */
+STAILQ_FOREACH_SAFE(np, &head, entries, np_temp) {
+	np->do_stuff();
+	...
+	STAILQ_REMOVE(&head, np, entry, entries);
+	free(np);
+}
+					/* TailQ Deletion. */
+while (!STAILQ_EMPTY(&head)) {
+	n1 = STAILQ_FIRST(&head);
+	STAILQ_REMOVE_HEAD(&head, entries);
+	free(n1);
+}
+					/* Faster TailQ Deletion. */
+n1 = STAILQ_FIRST(&head);
+while (n1 != NULL) {
+	n2 = STAILQ_NEXT(n1, entries);
+	free(n1);
+	n1 = n2;
+}
+STAILQ_INIT(&head);
+.Ed
+.Sh LISTS
+A list is headed by a structure defined by the
+.Nm LIST_HEAD
+macro.
+This structure contains a single pointer to the first element
+on the list.
+The elements are doubly linked so that an arbitrary element can be
+removed without traversing the list.
+New elements can be added to the list after an existing element,
+before an existing element, or at the head of the list.
+A
+.Fa LIST_HEAD
+structure is declared as follows:
+.Bd -literal -offset indent
+LIST_HEAD(HEADNAME, TYPE) head;
+.Ed
+.Pp
+where
+.Fa HEADNAME
+is the name of the structure to be defined, and
+.Fa TYPE
+is the type of the elements to be linked into the list.
+A pointer to the head of the list can later be declared as:
+.Bd -literal -offset indent
+struct HEADNAME *headp;
+.Ed
+.Pp
+(The names
+.Li head
+and
+.Li headp
+are user selectable.)
+.Pp
+The macro
+.Nm LIST_HEAD_INITIALIZER
+evaluates to an initializer for the list
+.Fa head .
+.Pp
+The macro
+.Nm LIST_EMPTY
+evaluates to true if there are no elements in the list.
+.Pp
+The macro
+.Nm LIST_ENTRY
+declares a structure that connects the elements in
+the list.
+.Pp
+The macro
+.Nm LIST_FIRST
+returns the first element in the list or NULL if the list
+is empty.
+.Pp
+The macro
+.Nm LIST_FOREACH
+traverses the list referenced by
+.Fa head
+in the forward direction, assigning each element in turn to
+.Fa var .
+.Pp
+The macro
+.Nm LIST_FOREACH_SAFE
+traverses the list referenced by
+.Fa head
+in the forward direction, assigning each element in turn to
+.Fa var .
+However, unlike
+.Fn LIST_FOREACH
+here it is permitted to both remove
+.Fa var
+as well as free it from within the loop safely without interfering with the
+traversal.
+.Pp
+The macro
+.Nm LIST_INIT
+initializes the list referenced by
+.Fa head .
+.Pp
+The macro
+.Nm LIST_INSERT_HEAD
+inserts the new element
+.Fa elm
+at the head of the list.
+.Pp
+The macro
+.Nm LIST_INSERT_AFTER
+inserts the new element
+.Fa elm
+after the element
+.Fa listelm .
+.Pp
+The macro
+.Nm LIST_INSERT_BEFORE
+inserts the new element
+.Fa elm
+before the element
+.Fa listelm .
+.Pp
+The macro
+.Nm LIST_NEXT
+returns the next element in the list, or NULL if this is the last.
+.Pp
+The macro
+.Nm LIST_REMOVE
+removes the element
+.Fa elm
+from the list.
+.Pp
+The macro
+.Nm LIST_SWAP
+swaps the contents of
+.Fa head1
+and
+.Fa head2 .
+.Sh LIST EXAMPLE
+.Bd -literal
+LIST_HEAD(listhead, entry) head =
+    LIST_HEAD_INITIALIZER(head);
+struct listhead *headp;			/* List head. */
+struct entry {
+	...
+	LIST_ENTRY(entry) entries;	/* List. */
+	...
+} *n1, *n2, *n3, *np, *np_temp;
+
+LIST_INIT(&head);			/* Initialize the list. */
+
+n1 = malloc(sizeof(struct entry));	/* Insert at the head. */
+LIST_INSERT_HEAD(&head, n1, entries);
+
+n2 = malloc(sizeof(struct entry));	/* Insert after. */
+LIST_INSERT_AFTER(n1, n2, entries);
+
+n3 = malloc(sizeof(struct entry));	/* Insert before. */
+LIST_INSERT_BEFORE(n2, n3, entries);
+
+LIST_REMOVE(n2, entries);		/* Deletion. */
+free(n2);
+					/* Forward traversal. */
+LIST_FOREACH(np, &head, entries)
+	np-> ...
+
+					/* Safe forward traversal. */
+LIST_FOREACH_SAFE(np, &head, entries, np_temp) {
+	np->do_stuff();
+	...
+	LIST_REMOVE(np, entries);
+	free(np);
+}
+
+while (!LIST_EMPTY(&head)) {		/* List Deletion. */
+	n1 = LIST_FIRST(&head);
+	LIST_REMOVE(n1, entries);
+	free(n1);
+}
+
+n1 = LIST_FIRST(&head);			/* Faster List Deletion. */
+while (n1 != NULL) {
+	n2 = LIST_NEXT(n1, entries);
+	free(n1);
+	n1 = n2;
+}
+LIST_INIT(&head);
+.Ed
+.Sh TAIL QUEUES
+A tail queue is headed by a structure defined by the
+.Nm TAILQ_HEAD
+macro.
+This structure contains a pair of pointers,
+one to the first element in the tail queue and the other to
+the last element in the tail queue.
+The elements are doubly linked so that an arbitrary element can be
+removed without traversing the tail queue.
+New elements can be added to the tail queue after an existing element,
+before an existing element, at the head of the tail queue,
+or at the end of the tail queue.
+A
+.Fa TAILQ_HEAD
+structure is declared as follows:
+.Bd -literal -offset indent
+TAILQ_HEAD(HEADNAME, TYPE) head;
+.Ed
+.Pp
+where
+.Li HEADNAME
+is the name of the structure to be defined, and
+.Li TYPE
+is the type of the elements to be linked into the tail queue.
+A pointer to the head of the tail queue can later be declared as:
+.Bd -literal -offset indent
+struct HEADNAME *headp;
+.Ed
+.Pp
+(The names
+.Li head
+and
+.Li headp
+are user selectable.)
+.Pp
+The macro
+.Nm TAILQ_HEAD_INITIALIZER
+evaluates to an initializer for the tail queue
+.Fa head .
+.Pp
+The macro
+.Nm TAILQ_CONCAT
+concatenates the tail queue headed by
+.Fa head2
+onto the end of the one headed by
+.Fa head1
+removing all entries from the former.
+.Pp
+The macro
+.Nm TAILQ_EMPTY
+evaluates to true if there are no items on the tail queue.
+.Pp
+The macro
+.Nm TAILQ_ENTRY
+declares a structure that connects the elements in
+the tail queue.
+.Pp
+The macro
+.Nm TAILQ_FIRST
+returns the first item on the tail queue or NULL if the tail queue
+is empty.
+.Pp
+The macro
+.Nm TAILQ_FOREACH
+traverses the tail queue referenced by
+.Fa head
+in the forward direction, assigning each element in turn to
+.Fa var .
+.Fa var
+is set to
+.Dv NULL
+if the loop completes normally, or if there were no elements.
+.Pp
+The macro
+.Nm TAILQ_FOREACH_REVERSE
+traverses the tail queue referenced by
+.Fa head
+in the reverse direction, assigning each element in turn to
+.Fa var .
+.Pp
+The macros
+.Nm TAILQ_FOREACH_SAFE
+and
+.Nm TAILQ_FOREACH_REVERSE_SAFE
+traverse the list referenced by
+.Fa head
+in the forward or reverse direction respectively,
+assigning each element in turn to
+.Fa var .
+However, unlike their unsafe counterparts,
+.Nm TAILQ_FOREACH
+and
+.Nm TAILQ_FOREACH_REVERSE
+permit to both remove
+.Fa var
+as well as free it from within the loop safely without interfering with the
+traversal.
+.Pp
+The macro
+.Nm TAILQ_INIT
+initializes the tail queue referenced by
+.Fa head .
+.Pp
+The macro
+.Nm TAILQ_INSERT_HEAD
+inserts the new element
+.Fa elm
+at the head of the tail queue.
+.Pp
+The macro
+.Nm TAILQ_INSERT_TAIL
+inserts the new element
+.Fa elm
+at the end of the tail queue.
+.Pp
+The macro
+.Nm TAILQ_INSERT_AFTER
+inserts the new element
+.Fa elm
+after the element
+.Fa listelm .
+.Pp
+The macro
+.Nm TAILQ_INSERT_BEFORE
+inserts the new element
+.Fa elm
+before the element
+.Fa listelm .
+.Pp
+The macro
+.Nm TAILQ_LAST
+returns the last item on the tail queue.
+If the tail queue is empty the return value is
+.Dv NULL .
+.Pp
+The macro
+.Nm TAILQ_NEXT
+returns the next item on the tail queue, or NULL if this item is the last.
+.Pp
+The macro
+.Nm TAILQ_PREV
+returns the previous item on the tail queue, or NULL if this item
+is the first.
+.Pp
+The macro
+.Nm TAILQ_REMOVE
+removes the element
+.Fa elm
+from the tail queue.
+.Pp
+The macro
+.Nm TAILQ_SWAP
+swaps the contents of
+.Fa head1
+and
+.Fa head2 .
+.Sh TAIL QUEUE EXAMPLE
+.Bd -literal
+TAILQ_HEAD(tailhead, entry) head =
+    TAILQ_HEAD_INITIALIZER(head);
+struct tailhead *headp;			/* Tail queue head. */
+struct entry {
+	...
+	TAILQ_ENTRY(entry) entries;	/* Tail queue. */
+	...
+} *n1, *n2, *n3, *np;
+
+TAILQ_INIT(&head);			/* Initialize the queue. */
+
+n1 = malloc(sizeof(struct entry));	/* Insert at the head. */
+TAILQ_INSERT_HEAD(&head, n1, entries);
+
+n1 = malloc(sizeof(struct entry));	/* Insert at the tail. */
+TAILQ_INSERT_TAIL(&head, n1, entries);
+
+n2 = malloc(sizeof(struct entry));	/* Insert after. */
+TAILQ_INSERT_AFTER(&head, n1, n2, entries);
+
+n3 = malloc(sizeof(struct entry));	/* Insert before. */
+TAILQ_INSERT_BEFORE(n2, n3, entries);
+
+TAILQ_REMOVE(&head, n2, entries);	/* Deletion. */
+free(n2);
+					/* Forward traversal. */
+TAILQ_FOREACH(np, &head, entries)
+	np-> ...
+					/* Safe forward traversal. */
+TAILQ_FOREACH_SAFE(np, &head, entries, np_temp) {
+	np->do_stuff();
+	...
+	TAILQ_REMOVE(&head, np, entries);
+	free(np);
+}
+					/* Reverse traversal. */
+TAILQ_FOREACH_REVERSE(np, &head, tailhead, entries)
+	np-> ...
+					/* TailQ Deletion. */
+while (!TAILQ_EMPTY(&head)) {
+	n1 = TAILQ_FIRST(&head);
+	TAILQ_REMOVE(&head, n1, entries);
+	free(n1);
+}
+					/* Faster TailQ Deletion. */
+n1 = TAILQ_FIRST(&head);
+while (n1 != NULL) {
+	n2 = TAILQ_NEXT(n1, entries);
+	free(n1);
+	n1 = n2;
+}
+TAILQ_INIT(&head);
+.Ed
+.Sh SEE ALSO
+.Xr tree 3
+.Sh HISTORY
+The
+.Nm queue
+functions first appeared in
+.Bx 4.4 .
diff -r 6c9a73817770 -r 934c14ab9f19 tools/include/xen-external/bsd-sys-queue-h-seddery
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/include/xen-external/bsd-sys-queue-h-seddery	Tue Jan 31 16:06:14 2012 +0000
@@ -0,0 +1,72 @@
+#!/usr/bin/perl -p
+#
+# This script is part of the Xen build system.  It has a very
+# permissive licence to avoid complicating the licence of the
+# generated header file and to allow this seddery to be reused by
+# other projects.
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this individual file (the "Software"), to deal
+# in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute,
+# sublicense, and/or sell copies of the Software, and to permit
+# persons to whom the Software is furnished to do so, subject to the
+# following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#
+# Copyright (C) 2011 Citrix Ltd
+
+our $namespace, $ucnamespace;
+
+BEGIN {
+    die unless @ARGV;
+    $namespace = pop @ARGV;
+    $namespace =~ s/^--prefix=// or die;
+    $ucnamespace = uc $namespace;
+
+    print <<END or die $!;
+/*
+ * DO NOT EDIT THIS FILE
+ *
+ * Generated automatically by bsd-sys-queue-h-seddery to
+ *  - introduce ${ucnamespace}_ and ${namespace}_ namespace prefixes
+ *  - turn "struct type" into "type" so that type arguments
+ *     to the macros are type names not struct tags
+ *  - remove the reference to sys/cdefs.h, which is not needed
+ *
+ * The purpose of this seddery is to allow the resulting file to be
+ * freely included by software which might also want to include other
+ * list macros; to make it usable when struct tags are not being used
+ * or not known; to make it more portable.
+ */
+END
+}
+
+s/\b( _SYS_QUEUE |
+      SLIST | LIST | STAILQ | TAILQ | QUEUE
+      )/${ucnamespace}_$1/xg;
+
+s/\b( TRACEBUF | TRASHIT |
+      QMD_
+      )/${ucnamespace}__$1/xg;
+
+s/\b(
+      qm_
+      )/${namespace}__$1/xg;
+
+s/\b struct \s+ type \b/type/xg;
+
+s,^\#include.*sys/cdefs.*,/* $& */,xg;
+
+s/\b( NULL )/0/xg;
diff -r 6c9a73817770 -r 934c14ab9f19 tools/include/xen-external/bsd-sys-queue.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/include/xen-external/bsd-sys-queue.h	Tue Jan 31 16:06:14 2012 +0000
@@ -0,0 +1,637 @@
+/*-
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)queue.h	8.5 (Berkeley) 8/20/94
+ * $FreeBSD$
+ */
+
+#ifndef _SYS_QUEUE_H_
+#define	_SYS_QUEUE_H_
+
+#include <sys/cdefs.h>
+
+/*
+ * This file defines four types of data structures: singly-linked lists,
+ * singly-linked tail queues, lists and tail queues.
+ *
+ * A singly-linked list is headed by a single forward pointer. The elements
+ * are singly linked for minimum space and pointer manipulation overhead at
+ * the expense of O(n) removal for arbitrary elements. New elements can be
+ * added to the list after an existing element or at the head of the list.
+ * Elements being removed from the head of the list should use the explicit
+ * macro for this purpose for optimum efficiency. A singly-linked list may
+ * only be traversed in the forward direction.  Singly-linked lists are ideal
+ * for applications with large datasets and few or no removals or for
+ * implementing a LIFO queue.
+ *
+ * A singly-linked tail queue is headed by a pair of pointers, one to the
+ * head of the list and the other to the tail of the list. The elements are
+ * singly linked for minimum space and pointer manipulation overhead at the
+ * expense of O(n) removal for arbitrary elements. New elements can be added
+ * to the list after an existing element, at the head of the list, or at the
+ * end of the list. Elements being removed from the head of the tail queue
+ * should use the explicit macro for this purpose for optimum efficiency.
+ * A singly-linked tail queue may only be traversed in the forward direction.
+ * Singly-linked tail queues are ideal for applications with large datasets
+ * and few or no removals or for implementing a FIFO queue.
+ *
+ * A list is headed by a single forward pointer (or an array of forward
+ * pointers for a hash table header). The elements are doubly linked
+ * so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before
+ * or after an existing element or at the head of the list. A list
+ * may only be traversed in the forward direction.
+ *
+ * A tail queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or
+ * after an existing element, at the head of the list, or at the end of
+ * the list. A tail queue may be traversed in either direction.
+ *
+ * For details on the use of these macros, see the queue(3) manual page.
+ *
+ *
+ *				SLIST	LIST	STAILQ	TAILQ
+ * _HEAD			+	+	+	+
+ * _HEAD_INITIALIZER		+	+	+	+
+ * _ENTRY			+	+	+	+
+ * _INIT			+	+	+	+
+ * _EMPTY			+	+	+	+
+ * _FIRST			+	+	+	+
+ * _NEXT			+	+	+	+
+ * _PREV			-	-	-	+
+ * _LAST			-	-	+	+
+ * _FOREACH			+	+	+	+
+ * _FOREACH_SAFE		+	+	+	+
+ * _FOREACH_REVERSE		-	-	-	+
+ * _FOREACH_REVERSE_SAFE	-	-	-	+
+ * _INSERT_HEAD			+	+	+	+
+ * _INSERT_BEFORE		-	+	-	+
+ * _INSERT_AFTER		+	+	+	+
+ * _INSERT_TAIL			-	-	+	+
+ * _CONCAT			-	-	+	+
+ * _REMOVE_AFTER		+	-	+	-
+ * _REMOVE_HEAD			+	-	+	-
+ * _REMOVE			+	+	+	+
+ * _SWAP			+	+	+	+
+ *
+ */
+#ifdef QUEUE_MACRO_DEBUG
+/* Store the last 2 places the queue element or head was altered */
+struct qm_trace {
+	char * lastfile;
+	int lastline;
+	char * prevfile;
+	int prevline;
+};
+
+#define	TRACEBUF	struct qm_trace trace;
+#define	TRASHIT(x)	do {(x) = (void *)-1;} while (0)
+#define	QMD_SAVELINK(name, link)	void **name = (void *)&(link)
+
+#define	QMD_TRACE_HEAD(head) do {					\
+	(head)->trace.prevline = (head)->trace.lastline;		\
+	(head)->trace.prevfile = (head)->trace.lastfile;		\
+	(head)->trace.lastline = __LINE__;				\
+	(head)->trace.lastfile = __FILE__;				\
+} while (0)
+
+#define	QMD_TRACE_ELEM(elem) do {					\
+	(elem)->trace.prevline = (elem)->trace.lastline;		\
+	(elem)->trace.prevfile = (elem)->trace.lastfile;		\
+	(elem)->trace.lastline = __LINE__;				\
+	(elem)->trace.lastfile = __FILE__;				\
+} while (0)
+
+#else
+#define	QMD_TRACE_ELEM(elem)
+#define	QMD_TRACE_HEAD(head)
+#define	QMD_SAVELINK(name, link)
+#define	TRACEBUF
+#define	TRASHIT(x)
+#endif	/* QUEUE_MACRO_DEBUG */
+
+/*
+ * Singly-linked List declarations.
+ */
+#define	SLIST_HEAD(name, type)						\
+struct name {								\
+	struct type *slh_first;	/* first element */			\
+}
+
+#define	SLIST_HEAD_INITIALIZER(head)					\
+	{ NULL }
+
+#define	SLIST_ENTRY(type)						\
+struct {								\
+	struct type *sle_next;	/* next element */			\
+}
+
+/*
+ * Singly-linked List functions.
+ */
+#define	SLIST_EMPTY(head)	((head)->slh_first == NULL)
+
+#define	SLIST_FIRST(head)	((head)->slh_first)
+
+#define	SLIST_FOREACH(var, head, field)					\
+	for ((var) = SLIST_FIRST((head));				\
+	    (var);							\
+	    (var) = SLIST_NEXT((var), field))
+
+#define	SLIST_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = SLIST_FIRST((head));				\
+	    (var) && ((tvar) = SLIST_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	SLIST_FOREACH_PREVPTR(var, varp, head, field)			\
+	for ((varp) = &SLIST_FIRST((head));				\
+	    ((var) = *(varp)) != NULL;					\
+	    (varp) = &SLIST_NEXT((var), field))
+
+#define	SLIST_INIT(head) do {						\
+	SLIST_FIRST((head)) = NULL;					\
+} while (0)
+
+#define	SLIST_INSERT_AFTER(slistelm, elm, field) do {			\
+	SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field);	\
+	SLIST_NEXT((slistelm), field) = (elm);				\
+} while (0)
+
+#define	SLIST_INSERT_HEAD(head, elm, field) do {			\
+	SLIST_NEXT((elm), field) = SLIST_FIRST((head));			\
+	SLIST_FIRST((head)) = (elm);					\
+} while (0)
+
+#define	SLIST_NEXT(elm, field)	((elm)->field.sle_next)
+
+#define	SLIST_REMOVE(head, elm, type, field) do {			\
+	QMD_SAVELINK(oldnext, (elm)->field.sle_next);			\
+	if (SLIST_FIRST((head)) == (elm)) {				\
+		SLIST_REMOVE_HEAD((head), field);			\
+	}								\
+	else {								\
+		struct type *curelm = SLIST_FIRST((head));		\
+		while (SLIST_NEXT(curelm, field) != (elm))		\
+			curelm = SLIST_NEXT(curelm, field);		\
+		SLIST_REMOVE_AFTER(curelm, field);			\
+	}								\
+	TRASHIT(*oldnext);						\
+} while (0)
+
+#define SLIST_REMOVE_AFTER(elm, field) do {				\
+	SLIST_NEXT(elm, field) =					\
+	    SLIST_NEXT(SLIST_NEXT(elm, field), field);			\
+} while (0)
+
+#define	SLIST_REMOVE_HEAD(head, field) do {				\
+	SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field);	\
+} while (0)
+
+#define SLIST_SWAP(head1, head2, type) do {				\
+	struct type *swap_first = SLIST_FIRST(head1);			\
+	SLIST_FIRST(head1) = SLIST_FIRST(head2);			\
+	SLIST_FIRST(head2) = swap_first;				\
+} while (0)
+
+/*
+ * Singly-linked Tail queue declarations.
+ */
+#define	STAILQ_HEAD(name, type)						\
+struct name {								\
+	struct type *stqh_first;/* first element */			\
+	struct type **stqh_last;/* addr of last next element */		\
+}
+
+#define	STAILQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).stqh_first }
+
+#define	STAILQ_ENTRY(type)						\
+struct {								\
+	struct type *stqe_next;	/* next element */			\
+}
+
+/*
+ * Singly-linked Tail queue functions.
+ */
+#define	STAILQ_CONCAT(head1, head2) do {				\
+	if (!STAILQ_EMPTY((head2))) {					\
+		*(head1)->stqh_last = (head2)->stqh_first;		\
+		(head1)->stqh_last = (head2)->stqh_last;		\
+		STAILQ_INIT((head2));					\
+	}								\
+} while (0)
+
+#define	STAILQ_EMPTY(head)	((head)->stqh_first == NULL)
+
+#define	STAILQ_FIRST(head)	((head)->stqh_first)
+
+#define	STAILQ_FOREACH(var, head, field)				\
+	for((var) = STAILQ_FIRST((head));				\
+	   (var);							\
+	   (var) = STAILQ_NEXT((var), field))
+
+
+#define	STAILQ_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = STAILQ_FIRST((head));				\
+	    (var) && ((tvar) = STAILQ_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	STAILQ_INIT(head) do {						\
+	STAILQ_FIRST((head)) = NULL;					\
+	(head)->stqh_last = &STAILQ_FIRST((head));			\
+} while (0)
+
+#define	STAILQ_INSERT_AFTER(head, tqelm, elm, field) do {		\
+	if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\
+		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\
+	STAILQ_NEXT((tqelm), field) = (elm);				\
+} while (0)
+
+#define	STAILQ_INSERT_HEAD(head, elm, field) do {			\
+	if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL)	\
+		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\
+	STAILQ_FIRST((head)) = (elm);					\
+} while (0)
+
+#define	STAILQ_INSERT_TAIL(head, elm, field) do {			\
+	STAILQ_NEXT((elm), field) = NULL;				\
+	*(head)->stqh_last = (elm);					\
+	(head)->stqh_last = &STAILQ_NEXT((elm), field);			\
+} while (0)
+
+#define	STAILQ_LAST(head, type, field)					\
+	(STAILQ_EMPTY((head)) ?						\
+		NULL :							\
+	        ((struct type *)(void *)				\
+		((char *)((head)->stqh_last) - __offsetof(struct type, field))))
+
+#define	STAILQ_NEXT(elm, field)	((elm)->field.stqe_next)
+
+#define	STAILQ_REMOVE(head, elm, type, field) do {			\
+	QMD_SAVELINK(oldnext, (elm)->field.stqe_next);			\
+	if (STAILQ_FIRST((head)) == (elm)) {				\
+		STAILQ_REMOVE_HEAD((head), field);			\
+	}								\
+	else {								\
+		struct type *curelm = STAILQ_FIRST((head));		\
+		while (STAILQ_NEXT(curelm, field) != (elm))		\
+			curelm = STAILQ_NEXT(curelm, field);		\
+		STAILQ_REMOVE_AFTER(head, curelm, field);		\
+	}								\
+	TRASHIT(*oldnext);						\
+} while (0)
+
+#define STAILQ_REMOVE_AFTER(head, elm, field) do {			\
+	if ((STAILQ_NEXT(elm, field) =					\
+	     STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL)	\
+		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\
+} while (0)
+
+#define	STAILQ_REMOVE_HEAD(head, field) do {				\
+	if ((STAILQ_FIRST((head)) =					\
+	     STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL)		\
+		(head)->stqh_last = &STAILQ_FIRST((head));		\
+} while (0)
+
+#define STAILQ_SWAP(head1, head2, type) do {				\
+	struct type *swap_first = STAILQ_FIRST(head1);			\
+	struct type **swap_last = (head1)->stqh_last;			\
+	STAILQ_FIRST(head1) = STAILQ_FIRST(head2);			\
+	(head1)->stqh_last = (head2)->stqh_last;			\
+	STAILQ_FIRST(head2) = swap_first;				\
+	(head2)->stqh_last = swap_last;					\
+	if (STAILQ_EMPTY(head1))					\
+		(head1)->stqh_last = &STAILQ_FIRST(head1);		\
+	if (STAILQ_EMPTY(head2))					\
+		(head2)->stqh_last = &STAILQ_FIRST(head2);		\
+} while (0)
+
+
+/*
+ * List declarations.
+ */
+#define	LIST_HEAD(name, type)						\
+struct name {								\
+	struct type *lh_first;	/* first element */			\
+}
+
+#define	LIST_HEAD_INITIALIZER(head)					\
+	{ NULL }
+
+#define	LIST_ENTRY(type)						\
+struct {								\
+	struct type *le_next;	/* next element */			\
+	struct type **le_prev;	/* address of previous next element */	\
+}
+
+/*
+ * List functions.
+ */
+
+#if (defined(_KERNEL) && defined(INVARIANTS))
+#define	QMD_LIST_CHECK_HEAD(head, field) do {				\
+	if (LIST_FIRST((head)) != NULL &&				\
+	    LIST_FIRST((head))->field.le_prev !=			\
+	     &LIST_FIRST((head)))					\
+		panic("Bad list head %p first->prev != head", (head));	\
+} while (0)
+
+#define	QMD_LIST_CHECK_NEXT(elm, field) do {				\
+	if (LIST_NEXT((elm), field) != NULL &&				\
+	    LIST_NEXT((elm), field)->field.le_prev !=			\
+	     &((elm)->field.le_next))					\
+	     	panic("Bad link elm %p next->prev != elm", (elm));	\
+} while (0)
+
+#define	QMD_LIST_CHECK_PREV(elm, field) do {				\
+	if (*(elm)->field.le_prev != (elm))				\
+		panic("Bad link elm %p prev->next != elm", (elm));	\
+} while (0)
+#else
+#define	QMD_LIST_CHECK_HEAD(head, field)
+#define	QMD_LIST_CHECK_NEXT(elm, field)
+#define	QMD_LIST_CHECK_PREV(elm, field)
+#endif /* (_KERNEL && INVARIANTS) */
+
+#define	LIST_EMPTY(head)	((head)->lh_first == NULL)
+
+#define	LIST_FIRST(head)	((head)->lh_first)
+
+#define	LIST_FOREACH(var, head, field)					\
+	for ((var) = LIST_FIRST((head));				\
+	    (var);							\
+	    (var) = LIST_NEXT((var), field))
+
+#define	LIST_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = LIST_FIRST((head));				\
+	    (var) && ((tvar) = LIST_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	LIST_INIT(head) do {						\
+	LIST_FIRST((head)) = NULL;					\
+} while (0)
+
+#define	LIST_INSERT_AFTER(listelm, elm, field) do {			\
+	QMD_LIST_CHECK_NEXT(listelm, field);				\
+	if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\
+		LIST_NEXT((listelm), field)->field.le_prev =		\
+		    &LIST_NEXT((elm), field);				\
+	LIST_NEXT((listelm), field) = (elm);				\
+	(elm)->field.le_prev = &LIST_NEXT((listelm), field);		\
+} while (0)
+
+#define	LIST_INSERT_BEFORE(listelm, elm, field) do {			\
+	QMD_LIST_CHECK_PREV(listelm, field);				\
+	(elm)->field.le_prev = (listelm)->field.le_prev;		\
+	LIST_NEXT((elm), field) = (listelm);				\
+	*(listelm)->field.le_prev = (elm);				\
+	(listelm)->field.le_prev = &LIST_NEXT((elm), field);		\
+} while (0)
+
+#define	LIST_INSERT_HEAD(head, elm, field) do {				\
+	QMD_LIST_CHECK_HEAD((head), field);				\
+	if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL)	\
+		LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
+	LIST_FIRST((head)) = (elm);					\
+	(elm)->field.le_prev = &LIST_FIRST((head));			\
+} while (0)
+
+#define	LIST_NEXT(elm, field)	((elm)->field.le_next)
+
+#define	LIST_REMOVE(elm, field) do {					\
+	QMD_SAVELINK(oldnext, (elm)->field.le_next);			\
+	QMD_SAVELINK(oldprev, (elm)->field.le_prev);			\
+	QMD_LIST_CHECK_NEXT(elm, field);				\
+	QMD_LIST_CHECK_PREV(elm, field);				\
+	if (LIST_NEXT((elm), field) != NULL)				\
+		LIST_NEXT((elm), field)->field.le_prev = 		\
+		    (elm)->field.le_prev;				\
+	*(elm)->field.le_prev = LIST_NEXT((elm), field);		\
+	TRASHIT(*oldnext);						\
+	TRASHIT(*oldprev);						\
+} while (0)
+
+#define LIST_SWAP(head1, head2, type, field) do {			\
+	struct type *swap_tmp = LIST_FIRST((head1));			\
+	LIST_FIRST((head1)) = LIST_FIRST((head2));			\
+	LIST_FIRST((head2)) = swap_tmp;					\
+	if ((swap_tmp = LIST_FIRST((head1))) != NULL)			\
+		swap_tmp->field.le_prev = &LIST_FIRST((head1));		\
+	if ((swap_tmp = LIST_FIRST((head2))) != NULL)			\
+		swap_tmp->field.le_prev = &LIST_FIRST((head2));		\
+} while (0)
+
+/*
+ * Tail queue declarations.
+ */
+#define	TAILQ_HEAD(name, type)						\
+struct name {								\
+	struct type *tqh_first;	/* first element */			\
+	struct type **tqh_last;	/* addr of last next element */		\
+	TRACEBUF							\
+}
+
+#define	TAILQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).tqh_first }
+
+#define	TAILQ_ENTRY(type)						\
+struct {								\
+	struct type *tqe_next;	/* next element */			\
+	struct type **tqe_prev;	/* address of previous next element */	\
+	TRACEBUF							\
+}
+
+/*
+ * Tail queue functions.
+ */
+#if (defined(_KERNEL) && defined(INVARIANTS))
+#define	QMD_TAILQ_CHECK_HEAD(head, field) do {				\
+	if (!TAILQ_EMPTY(head) &&					\
+	    TAILQ_FIRST((head))->field.tqe_prev !=			\
+	     &TAILQ_FIRST((head)))					\
+		panic("Bad tailq head %p first->prev != head", (head));	\
+} while (0)
+
+#define	QMD_TAILQ_CHECK_TAIL(head, field) do {				\
+	if (*(head)->tqh_last != NULL)					\
+	    	panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head)); 	\
+} while (0)
+
+#define	QMD_TAILQ_CHECK_NEXT(elm, field) do {				\
+	if (TAILQ_NEXT((elm), field) != NULL &&				\
+	    TAILQ_NEXT((elm), field)->field.tqe_prev !=			\
+	     &((elm)->field.tqe_next))					\
+		panic("Bad link elm %p next->prev != elm", (elm));	\
+} while (0)
+
+#define	QMD_TAILQ_CHECK_PREV(elm, field) do {				\
+	if (*(elm)->field.tqe_prev != (elm))				\
+		panic("Bad link elm %p prev->next != elm", (elm));	\
+} while (0)
+#else
+#define	QMD_TAILQ_CHECK_HEAD(head, field)
+#define	QMD_TAILQ_CHECK_TAIL(head, headname)
+#define	QMD_TAILQ_CHECK_NEXT(elm, field)
+#define	QMD_TAILQ_CHECK_PREV(elm, field)
+#endif /* (_KERNEL && INVARIANTS) */
+
+#define	TAILQ_CONCAT(head1, head2, field) do {				\
+	if (!TAILQ_EMPTY(head2)) {					\
+		*(head1)->tqh_last = (head2)->tqh_first;		\
+		(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last;	\
+		(head1)->tqh_last = (head2)->tqh_last;			\
+		TAILQ_INIT((head2));					\
+		QMD_TRACE_HEAD(head1);					\
+		QMD_TRACE_HEAD(head2);					\
+	}								\
+} while (0)
+
+#define	TAILQ_EMPTY(head)	((head)->tqh_first == NULL)
+
+#define	TAILQ_FIRST(head)	((head)->tqh_first)
+
+#define	TAILQ_FOREACH(var, head, field)					\
+	for ((var) = TAILQ_FIRST((head));				\
+	    (var);							\
+	    (var) = TAILQ_NEXT((var), field))
+
+#define	TAILQ_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = TAILQ_FIRST((head));				\
+	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	TAILQ_FOREACH_REVERSE(var, head, headname, field)		\
+	for ((var) = TAILQ_LAST((head), headname);			\
+	    (var);							\
+	    (var) = TAILQ_PREV((var), headname, field))
+
+#define	TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar)	\
+	for ((var) = TAILQ_LAST((head), headname);			\
+	    (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\
+	    (var) = (tvar))
+
+#define	TAILQ_INIT(head) do {						\
+	TAILQ_FIRST((head)) = NULL;					\
+	(head)->tqh_last = &TAILQ_FIRST((head));			\
+	QMD_TRACE_HEAD(head);						\
+} while (0)
+
+#define	TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	QMD_TAILQ_CHECK_NEXT(listelm, field);				\
+	if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
+		TAILQ_NEXT((elm), field)->field.tqe_prev = 		\
+		    &TAILQ_NEXT((elm), field);				\
+	else {								\
+		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
+		QMD_TRACE_HEAD(head);					\
+	}								\
+	TAILQ_NEXT((listelm), field) = (elm);				\
+	(elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field);		\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+	QMD_TRACE_ELEM(&listelm->field);				\
+} while (0)
+
+#define	TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\
+	QMD_TAILQ_CHECK_PREV(listelm, field);				\
+	(elm)->field.tqe_prev = (listelm)->field.tqe_prev;		\
+	TAILQ_NEXT((elm), field) = (listelm);				\
+	*(listelm)->field.tqe_prev = (elm);				\
+	(listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field);		\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+	QMD_TRACE_ELEM(&listelm->field);				\
+} while (0)
+
+#define	TAILQ_INSERT_HEAD(head, elm, field) do {			\
+	QMD_TAILQ_CHECK_HEAD(head, field);				\
+	if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL)	\
+		TAILQ_FIRST((head))->field.tqe_prev =			\
+		    &TAILQ_NEXT((elm), field);				\
+	else								\
+		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
+	TAILQ_FIRST((head)) = (elm);					\
+	(elm)->field.tqe_prev = &TAILQ_FIRST((head));			\
+	QMD_TRACE_HEAD(head);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define	TAILQ_INSERT_TAIL(head, elm, field) do {			\
+	QMD_TAILQ_CHECK_TAIL(head, field);				\
+	TAILQ_NEXT((elm), field) = NULL;				\
+	(elm)->field.tqe_prev = (head)->tqh_last;			\
+	*(head)->tqh_last = (elm);					\
+	(head)->tqh_last = &TAILQ_NEXT((elm), field);			\
+	QMD_TRACE_HEAD(head);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define	TAILQ_LAST(head, headname)					\
+	(*(((struct headname *)((head)->tqh_last))->tqh_last))
+
+#define	TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
+
+#define	TAILQ_PREV(elm, headname, field)				\
+	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+
+#define	TAILQ_REMOVE(head, elm, field) do {				\
+	QMD_SAVELINK(oldnext, (elm)->field.tqe_next);			\
+	QMD_SAVELINK(oldprev, (elm)->field.tqe_prev);			\
+	QMD_TAILQ_CHECK_NEXT(elm, field);				\
+	QMD_TAILQ_CHECK_PREV(elm, field);				\
+	if ((TAILQ_NEXT((elm), field)) != NULL)				\
+		TAILQ_NEXT((elm), field)->field.tqe_prev = 		\
+		    (elm)->field.tqe_prev;				\
+	else {								\
+		(head)->tqh_last = (elm)->field.tqe_prev;		\
+		QMD_TRACE_HEAD(head);					\
+	}								\
+	*(elm)->field.tqe_prev = TAILQ_NEXT((elm), field);		\
+	TRASHIT(*oldnext);						\
+	TRASHIT(*oldprev);						\
+	QMD_TRACE_ELEM(&(elm)->field);					\
+} while (0)
+
+#define TAILQ_SWAP(head1, head2, type, field) do {			\
+	struct type *swap_first = (head1)->tqh_first;			\
+	struct type **swap_last = (head1)->tqh_last;			\
+	(head1)->tqh_first = (head2)->tqh_first;			\
+	(head1)->tqh_last = (head2)->tqh_last;				\
+	(head2)->tqh_first = swap_first;				\
+	(head2)->tqh_last = swap_last;					\
+	if ((swap_first = (head1)->tqh_first) != NULL)			\
+		swap_first->field.tqe_prev = &(head1)->tqh_first;	\
+	else								\
+		(head1)->tqh_last = &(head1)->tqh_first;		\
+	if ((swap_first = (head2)->tqh_first) != NULL)			\
+		swap_first->field.tqe_prev = &(head2)->tqh_first;	\
+	else								\
+		(head2)->tqh_last = &(head2)->tqh_first;		\
+} while (0)
+
+#endif /* !_SYS_QUEUE_H_ */
diff -r 6c9a73817770 -r 934c14ab9f19 tools/libxl/Makefile
--- a/tools/libxl/Makefile	Tue Jan 31 11:39:37 2012 +0000
+++ b/tools/libxl/Makefile	Tue Jan 31 16:06:14 2012 +0000
@@ -93,8 +93,8 @@
 	rm -f $@.tmp
 	$(call move-if-changed,$@.2.tmp,$@)
 
-_libxl_list.h: bsd-sys-queue-h-seddery external/bsd-sys-queue.h
-	perl ./$^ --prefix=libxl >$@.new
+_libxl_list.h: $(XEN_INCLUDE)/xen-external/bsd-sys-queue-h-seddery $(XEN_INCLUDE)/xen-external/bsd-sys-queue.h
+	perl $^ --prefix=libxl >$@.new
 	$(call move-if-changed,$@.new,$@)
 
 libxl_paths.c: _libxl_paths.h
diff -r 6c9a73817770 -r 934c14ab9f19 tools/libxl/bsd-sys-queue-h-seddery
--- a/tools/libxl/bsd-sys-queue-h-seddery	Tue Jan 31 11:39:37 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-#!/usr/bin/perl -p
-#
-# This script is part of the Xen build system.  It has a very
-# permissive licence to avoid complicating the licence of the
-# generated header file and to allow this seddery to be reused by
-# other projects.
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this individual file (the "Software"), to deal
-# in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute,
-# sublicense, and/or sell copies of the Software, and to permit
-# persons to whom the Software is furnished to do so, subject to the
-# following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-#
-# Copyright (C) 2011 Citrix Ltd
-
-our $namespace, $ucnamespace;
-
-BEGIN {
-    die unless @ARGV;
-    $namespace = pop @ARGV;
-    $namespace =~ s/^--prefix=// or die;
-    $ucnamespace = uc $namespace;
-
-    print <<END or die $!;
-/*
- * DO NOT EDIT THIS FILE
- *
- * Generated automatically by bsd-sys-queue-h-seddery to
- *  - introduce ${ucnamespace}_ and ${namespace}_ namespace prefixes
- *  - turn "struct type" into "type" so that type arguments
- *     to the macros are type names not struct tags
- *  - remove the reference to sys/cdefs.h, which is not needed
- *
- * The purpose of this seddery is to allow the resulting file to be
- * freely included by software which might also want to include other
- * list macros; to make it usable when struct tags are not being used
- * or not known; to make it more portable.
- */
-END
-}
-
-s/\b( _SYS_QUEUE |
-      SLIST | LIST | STAILQ | TAILQ | QUEUE
-      )/${ucnamespace}_$1/xg;
-
-s/\b( TRACEBUF | TRASHIT |
-      QMD_
-      )/${ucnamespace}__$1/xg;
-
-s/\b(
-      qm_
-      )/${namespace}__$1/xg;
-
-s/\b struct \s+ type \b/type/xg;
-
-s,^\#include.*sys/cdefs.*,/* $& */,xg;
diff -r 6c9a73817770 -r 934c14ab9f19 tools/libxl/external/README
--- a/tools/libxl/external/README	Tue Jan 31 11:39:37 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-WARNING - DO NOT EDIT THINGS IN THIS DIRECTORY (apart from this README)
------------------------------------------------------------------------
-
-These files were obtained elsewhere and should only be updated by
-copying new versions from the source location, as documented below:
-
-bsd-COPYRIGHT
-bsd-sys-queue.h
-bsd-queue.3
-
-  Obtained from the FreeBSD SVN using the following commands:
-    svn co -r 221843 svn://svn.freebsd.org/base/head/sys/sys/
-    svn co -r 221843 svn://svn.freebsd.org/base/head/share/man/man3
-    svn cat -r 221843 http://svn.freebsd.org/base/head/COPYRIGHT >tools/libxl/external/bsd-COPYRIGHT
diff -r 6c9a73817770 -r 934c14ab9f19 tools/libxl/external/bsd-COPYRIGHT
--- a/tools/libxl/external/bsd-COPYRIGHT	Tue Jan 31 11:39:37 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-# $FreeBSD$
-#	@(#)COPYRIGHT	8.2 (Berkeley) 3/21/94
-
-The compilation of software known as FreeBSD is distributed under the
-following terms:
-
-Copyright (c) 1992-2011 The FreeBSD Project. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
-The 4.4BSD and 4.4BSD-Lite software is distributed under the following
-terms:
-
-All of the documentation and software included in the 4.4BSD and 4.4BSD-Lite
-Releases is copyrighted by The Regents of the University of California.
-
-Copyright 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
-	The Regents of the University of California.  All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-3. All advertising materials mentioning features or use of this software
-   must display the following acknowledgement:
-This product includes software developed by the University of
-California, Berkeley and its contributors.
-4. Neither the name of the University nor the names of its contributors
-   may be used to endorse or promote products derived from this software
-   without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
-The Institute of Electrical and Electronics Engineers and the American
-National Standards Committee X3, on Information Processing Systems have
-given us permission to reprint portions of their documentation.
-
-In the following statement, the phrase ``this text'' refers to portions
-of the system documentation.
-
-Portions of this text are reprinted and reproduced in electronic form in
-the second BSD Networking Software Release, from IEEE Std 1003.1-1988, IEEE
-Standard Portable Operating System Interface for Computer Environments
-(POSIX), copyright C 1988 by the Institute of Electrical and Electronics
-Engineers, Inc.  In the event of any discrepancy between these versions
-and the original IEEE Standard, the original IEEE Standard is the referee
-document.
-
-In the following statement, the phrase ``This material'' refers to portions
-of the system documentation.
-
-This material is reproduced with permission from American National
-Standards Committee X3, on Information Processing Systems.  Computer and
-Business Equipment Manufacturers Association (CBEMA), 311 First St., NW,
-Suite 500, Washington, DC 20001-2178.  The developmental work of
-Programming Language C was completed by the X3J11 Technical Committee.
-
-The views and conclusions contained in the software and documentation are
-those of the authors and should not be interpreted as representing official
-policies, either expressed or implied, of the Regents of the University
-of California.
-
-
-NOTE: The copyright of UC Berkeley's Berkeley Software Distribution ("BSD")
-source has been updated.  The copyright addendum may be found at
-ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change and is
-included below.
-
-July 22, 1999
-
-To All Licensees, Distributors of Any Version of BSD:
-
-As you know, certain of the Berkeley Software Distribution ("BSD") source
-code files require that further distributions of products containing all or
-portions of the software, acknowledge within their advertising materials
-that such products contain software developed by UC Berkeley and its
-contributors.
-
-Specifically, the provision reads:
-
-"     * 3. All advertising materials mentioning features or use of this software
-      *    must display the following acknowledgement:
-      *    This product includes software developed by the University of
-      *    California, Berkeley and its contributors."
-
-Effective immediately, licensees and distributors are no longer required to
-include the acknowledgement within advertising materials.  Accordingly, the
-foregoing paragraph of those BSD Unix files containing it is hereby deleted
-in its entirety.
-
-William Hoskins
-Director, Office of Technology Licensing
-University of California, Berkeley
diff -r 6c9a73817770 -r 934c14ab9f19 tools/libxl/external/bsd-queue.3
--- a/tools/libxl/external/bsd-queue.3	Tue Jan 31 11:39:37 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1044 +0,0 @@
-.\" Copyright (c) 1993
-.\"	The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"	@(#)queue.3	8.2 (Berkeley) 1/24/94
-.\" $FreeBSD$
-.\"
-.Dd May 13, 2011
-.Dt QUEUE 3
-.Os
-.Sh NAME
-.Nm SLIST_EMPTY ,
-.Nm SLIST_ENTRY ,
-.Nm SLIST_FIRST ,
-.Nm SLIST_FOREACH ,
-.Nm SLIST_FOREACH_SAFE ,
-.Nm SLIST_HEAD ,
-.Nm SLIST_HEAD_INITIALIZER ,
-.Nm SLIST_INIT ,
-.Nm SLIST_INSERT_AFTER ,
-.Nm SLIST_INSERT_HEAD ,
-.Nm SLIST_NEXT ,
-.Nm SLIST_REMOVE_AFTER ,
-.Nm SLIST_REMOVE_HEAD ,
-.Nm SLIST_REMOVE ,
-.Nm SLIST_SWAP ,
-.Nm STAILQ_CONCAT ,
-.Nm STAILQ_EMPTY ,
-.Nm STAILQ_ENTRY ,
-.Nm STAILQ_FIRST ,
-.Nm STAILQ_FOREACH ,
-.Nm STAILQ_FOREACH_SAFE ,
-.Nm STAILQ_HEAD ,
-.Nm STAILQ_HEAD_INITIALIZER ,
-.Nm STAILQ_INIT ,
-.Nm STAILQ_INSERT_AFTER ,
-.Nm STAILQ_INSERT_HEAD ,
-.Nm STAILQ_INSERT_TAIL ,
-.Nm STAILQ_LAST ,
-.Nm STAILQ_NEXT ,
-.Nm STAILQ_REMOVE_AFTER ,
-.Nm STAILQ_REMOVE_HEAD ,
-.Nm STAILQ_REMOVE ,
-.Nm STAILQ_SWAP ,
-.Nm LIST_EMPTY ,
-.Nm LIST_ENTRY ,
-.Nm LIST_FIRST ,
-.Nm LIST_FOREACH ,
-.Nm LIST_FOREACH_SAFE ,
-.Nm LIST_HEAD ,
-.Nm LIST_HEAD_INITIALIZER ,
-.Nm LIST_INIT ,
-.Nm LIST_INSERT_AFTER ,
-.Nm LIST_INSERT_BEFORE ,
-.Nm LIST_INSERT_HEAD ,
-.Nm LIST_NEXT ,
-.Nm LIST_REMOVE ,
-.Nm LIST_SWAP ,
-.Nm TAILQ_CONCAT ,
-.Nm TAILQ_EMPTY ,
-.Nm TAILQ_ENTRY ,
-.Nm TAILQ_FIRST ,
-.Nm TAILQ_FOREACH ,
-.Nm TAILQ_FOREACH_SAFE ,
-.Nm TAILQ_FOREACH_REVERSE ,
-.Nm TAILQ_FOREACH_REVERSE_SAFE ,
-.Nm TAILQ_HEAD ,
-.Nm TAILQ_HEAD_INITIALIZER ,
-.Nm TAILQ_INIT ,
-.Nm TAILQ_INSERT_AFTER ,
-.Nm TAILQ_INSERT_BEFORE ,
-.Nm TAILQ_INSERT_HEAD ,
-.Nm TAILQ_INSERT_TAIL ,
-.Nm TAILQ_LAST ,
-.Nm TAILQ_NEXT ,
-.Nm TAILQ_PREV ,
-.Nm TAILQ_REMOVE ,
-.Nm TAILQ_SWAP
-.Nd implementations of singly-linked lists, singly-linked tail queues,
-lists and tail queues
-.Sh SYNOPSIS
-.In sys/queue.h
-.\"
-.Fn SLIST_EMPTY "SLIST_HEAD *head"
-.Fn SLIST_ENTRY "TYPE"
-.Fn SLIST_FIRST "SLIST_HEAD *head"
-.Fn SLIST_FOREACH "TYPE *var" "SLIST_HEAD *head" "SLIST_ENTRY NAME"
-.Fn SLIST_FOREACH_SAFE "TYPE *var" "SLIST_HEAD *head" "SLIST_ENTRY NAME" "TYPE *temp_var"
-.Fn SLIST_HEAD "HEADNAME" "TYPE"
-.Fn SLIST_HEAD_INITIALIZER "SLIST_HEAD head"
-.Fn SLIST_INIT "SLIST_HEAD *head"
-.Fn SLIST_INSERT_AFTER "TYPE *listelm" "TYPE *elm" "SLIST_ENTRY NAME"
-.Fn SLIST_INSERT_HEAD "SLIST_HEAD *head" "TYPE *elm" "SLIST_ENTRY NAME"
-.Fn SLIST_NEXT "TYPE *elm" "SLIST_ENTRY NAME"
-.Fn SLIST_REMOVE_AFTER "TYPE *elm" "SLIST_ENTRY NAME"
-.Fn SLIST_REMOVE_HEAD "SLIST_HEAD *head" "SLIST_ENTRY NAME"
-.Fn SLIST_REMOVE "SLIST_HEAD *head" "TYPE *elm" "TYPE" "SLIST_ENTRY NAME"
-.Fn SLIST_SWAP "SLIST_HEAD *head1" "SLIST_HEAD *head2" "SLIST_ENTRY NAME"
-.\"
-.Fn STAILQ_CONCAT "STAILQ_HEAD *head1" "STAILQ_HEAD *head2"
-.Fn STAILQ_EMPTY "STAILQ_HEAD *head"
-.Fn STAILQ_ENTRY "TYPE"
-.Fn STAILQ_FIRST "STAILQ_HEAD *head"
-.Fn STAILQ_FOREACH "TYPE *var" "STAILQ_HEAD *head" "STAILQ_ENTRY NAME"
-.Fn STAILQ_FOREACH_SAFE "TYPE *var" "STAILQ_HEAD *head" "STAILQ_ENTRY NAME" "TYPE *temp_var"
-.Fn STAILQ_HEAD "HEADNAME" "TYPE"
-.Fn STAILQ_HEAD_INITIALIZER "STAILQ_HEAD head"
-.Fn STAILQ_INIT "STAILQ_HEAD *head"
-.Fn STAILQ_INSERT_AFTER "STAILQ_HEAD *head" "TYPE *listelm" "TYPE *elm" "STAILQ_ENTRY NAME"
-.Fn STAILQ_INSERT_HEAD "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
-.Fn STAILQ_INSERT_TAIL "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
-.Fn STAILQ_LAST "STAILQ_HEAD *head" "TYPE" "STAILQ_ENTRY NAME"
-.Fn STAILQ_NEXT "TYPE *elm" "STAILQ_ENTRY NAME"
-.Fn STAILQ_REMOVE_AFTER "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
-.Fn STAILQ_REMOVE_HEAD "STAILQ_HEAD *head" "STAILQ_ENTRY NAME"
-.Fn STAILQ_REMOVE "STAILQ_HEAD *head" "TYPE *elm" "TYPE" "STAILQ_ENTRY NAME"
-.Fn STAILQ_SWAP "STAILQ_HEAD *head1" "STAILQ_HEAD *head2" "STAILQ_ENTRY NAME"
-.\"
-.Fn LIST_EMPTY "LIST_HEAD *head"
-.Fn LIST_ENTRY "TYPE"
-.Fn LIST_FIRST "LIST_HEAD *head"
-.Fn LIST_FOREACH "TYPE *var" "LIST_HEAD *head" "LIST_ENTRY NAME"
-.Fn LIST_FOREACH_SAFE "TYPE *var" "LIST_HEAD *head" "LIST_ENTRY NAME" "TYPE *temp_var"
-.Fn LIST_HEAD "HEADNAME" "TYPE"
-.Fn LIST_HEAD_INITIALIZER "LIST_HEAD head"
-.Fn LIST_INIT "LIST_HEAD *head"
-.Fn LIST_INSERT_AFTER "TYPE *listelm" "TYPE *elm" "LIST_ENTRY NAME"
-.Fn LIST_INSERT_BEFORE "TYPE *listelm" "TYPE *elm" "LIST_ENTRY NAME"
-.Fn LIST_INSERT_HEAD "LIST_HEAD *head" "TYPE *elm" "LIST_ENTRY NAME"
-.Fn LIST_NEXT "TYPE *elm" "LIST_ENTRY NAME"
-.Fn LIST_REMOVE "TYPE *elm" "LIST_ENTRY NAME"
-.Fn LIST_SWAP "LIST_HEAD *head1" "LIST_HEAD *head2" "TYPE" "LIST_ENTRY NAME"
-.\"
-.Fn TAILQ_CONCAT "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "TAILQ_ENTRY NAME"
-.Fn TAILQ_EMPTY "TAILQ_HEAD *head"
-.Fn TAILQ_ENTRY "TYPE"
-.Fn TAILQ_FIRST "TAILQ_HEAD *head"
-.Fn TAILQ_FOREACH "TYPE *var" "TAILQ_HEAD *head" "TAILQ_ENTRY NAME"
-.Fn TAILQ_FOREACH_SAFE "TYPE *var" "TAILQ_HEAD *head" "TAILQ_ENTRY NAME" "TYPE *temp_var"
-.Fn TAILQ_FOREACH_REVERSE "TYPE *var" "TAILQ_HEAD *head" "HEADNAME" "TAILQ_ENTRY NAME"
-.Fn TAILQ_FOREACH_REVERSE_SAFE "TYPE *var" "TAILQ_HEAD *head" "HEADNAME" "TAILQ_ENTRY NAME" "TYPE *temp_var"
-.Fn TAILQ_HEAD "HEADNAME" "TYPE"
-.Fn TAILQ_HEAD_INITIALIZER "TAILQ_HEAD head"
-.Fn TAILQ_INIT "TAILQ_HEAD *head"
-.Fn TAILQ_INSERT_AFTER "TAILQ_HEAD *head" "TYPE *listelm" "TYPE *elm" "TAILQ_ENTRY NAME"
-.Fn TAILQ_INSERT_BEFORE "TYPE *listelm" "TYPE *elm" "TAILQ_ENTRY NAME"
-.Fn TAILQ_INSERT_HEAD "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME"
-.Fn TAILQ_INSERT_TAIL "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME"
-.Fn TAILQ_LAST "TAILQ_HEAD *head" "HEADNAME"
-.Fn TAILQ_NEXT "TYPE *elm" "TAILQ_ENTRY NAME"
-.Fn TAILQ_PREV "TYPE *elm" "HEADNAME" "TAILQ_ENTRY NAME"
-.Fn TAILQ_REMOVE "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME"
-.Fn TAILQ_SWAP "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "TYPE" "TAILQ_ENTRY NAME"
-.\"
-.Sh DESCRIPTION
-These macros define and operate on four types of data structures:
-singly-linked lists, singly-linked tail queues, lists, and tail queues.
-All four structures support the following functionality:
-.Bl -enum -compact -offset indent
-.It
-Insertion of a new entry at the head of the list.
-.It
-Insertion of a new entry after any element in the list.
-.It
-O(1) removal of an entry from the head of the list.
-.It
-Forward traversal through the list.
-.It
-Swawpping the contents of two lists.
-.El
-.Pp
-Singly-linked lists are the simplest of the four data structures
-and support only the above functionality.
-Singly-linked lists are ideal for applications with large datasets
-and few or no removals,
-or for implementing a LIFO queue.
-Singly-linked lists add the following functionality:
-.Bl -enum -compact -offset indent
-.It
-O(n) removal of any entry in the list.
-.El
-.Pp
-Singly-linked tail queues add the following functionality:
-.Bl -enum -compact -offset indent
-.It
-Entries can be added at the end of a list.
-.It
-O(n) removal of any entry in the list.
-.It
-They may be concatenated.
-.El
-However:
-.Bl -enum -compact -offset indent
-.It
-All list insertions must specify the head of the list.
-.It
-Each head entry requires two pointers rather than one.
-.It
-Code size is about 15% greater and operations run about 20% slower
-than singly-linked lists.
-.El
-.Pp
-Singly-linked tailqs are ideal for applications with large datasets and
-few or no removals,
-or for implementing a FIFO queue.
-.Pp
-All doubly linked types of data structures (lists and tail queues)
-additionally allow:
-.Bl -enum -compact -offset indent
-.It
-Insertion of a new entry before any element in the list.
-.It
-O(1) removal of any entry in the list.
-.El
-However:
-.Bl -enum -compact -offset indent
-.It
-Each element requires two pointers rather than one.
-.It
-Code size and execution time of operations (except for removal) is about
-twice that of the singly-linked data-structures.
-.El
-.Pp
-Linked lists are the simplest of the doubly linked data structures and support
-only the above functionality over singly-linked lists.
-.Pp
-Tail queues add the following functionality:
-.Bl -enum -compact -offset indent
-.It
-Entries can be added at the end of a list.
-.It
-They may be traversed backwards, from tail to head.
-.It
-They may be concatenated.
-.El
-However:
-.Bl -enum -compact -offset indent
-.It
-All list insertions and removals must specify the head of the list.
-.It
-Each head entry requires two pointers rather than one.
-.It
-Code size is about 15% greater and operations run about 20% slower
-than singly-linked lists.
-.El
-.Pp
-In the macro definitions,
-.Fa TYPE
-is the name of a user defined structure,
-that must contain a field of type
-.Li SLIST_ENTRY ,
-.Li STAILQ_ENTRY ,
-.Li LIST_ENTRY ,
-or
-.Li TAILQ_ENTRY ,
-named
-.Fa NAME .
-The argument
-.Fa HEADNAME
-is the name of a user defined structure that must be declared
-using the macros
-.Li SLIST_HEAD ,
-.Li STAILQ_HEAD ,
-.Li LIST_HEAD ,
-or
-.Li TAILQ_HEAD .
-See the examples below for further explanation of how these
-macros are used.
-.Sh SINGLY-LINKED LISTS
-A singly-linked list is headed by a structure defined by the
-.Nm SLIST_HEAD
-macro.
-This structure contains a single pointer to the first element
-on the list.
-The elements are singly linked for minimum space and pointer manipulation
-overhead at the expense of O(n) removal for arbitrary elements.
-New elements can be added to the list after an existing element or
-at the head of the list.
-An
-.Fa SLIST_HEAD
-structure is declared as follows:
-.Bd -literal -offset indent
-SLIST_HEAD(HEADNAME, TYPE) head;
-.Ed
-.Pp
-where
-.Fa HEADNAME
-is the name of the structure to be defined, and
-.Fa TYPE
-is the type of the elements to be linked into the list.
-A pointer to the head of the list can later be declared as:
-.Bd -literal -offset indent
-struct HEADNAME *headp;
-.Ed
-.Pp
-(The names
-.Li head
-and
-.Li headp
-are user selectable.)
-.Pp
-The macro
-.Nm SLIST_HEAD_INITIALIZER
-evaluates to an initializer for the list
-.Fa head .
-.Pp
-The macro
-.Nm SLIST_EMPTY
-evaluates to true if there are no elements in the list.
-.Pp
-The macro
-.Nm SLIST_ENTRY
-declares a structure that connects the elements in
-the list.
-.Pp
-The macro
-.Nm SLIST_FIRST
-returns the first element in the list or NULL if the list is empty.
-.Pp
-The macro
-.Nm SLIST_FOREACH
-traverses the list referenced by
-.Fa head
-in the forward direction, assigning each element in
-turn to
-.Fa var .
-.Pp
-The macro
-.Nm SLIST_FOREACH_SAFE
-traverses the list referenced by
-.Fa head
-in the forward direction, assigning each element in
-turn to
-.Fa var .
-However, unlike
-.Fn SLIST_FOREACH
-here it is permitted to both remove
-.Fa var
-as well as free it from within the loop safely without interfering with the
-traversal.
-.Pp
-The macro
-.Nm SLIST_INIT
-initializes the list referenced by
-.Fa head .
-.Pp
-The macro
-.Nm SLIST_INSERT_HEAD
-inserts the new element
-.Fa elm
-at the head of the list.
-.Pp
-The macro
-.Nm SLIST_INSERT_AFTER
-inserts the new element
-.Fa elm
-after the element
-.Fa listelm .
-.Pp
-The macro
-.Nm SLIST_NEXT
-returns the next element in the list.
-.Pp
-The macro
-.Nm SLIST_REMOVE_AFTER
-removes the element after
-.Fa elm
-from the list. Unlike
-.Fa SLIST_REMOVE ,
-this macro does not traverse the entire list.
-.Pp
-The macro
-.Nm SLIST_REMOVE_HEAD
-removes the element
-.Fa elm
-from the head of the list.
-For optimum efficiency,
-elements being removed from the head of the list should explicitly use
-this macro instead of the generic
-.Fa SLIST_REMOVE
-macro.
-.Pp
-The macro
-.Nm SLIST_REMOVE
-removes the element
-.Fa elm
-from the list.
-.Pp
-The macro
-.Nm SLIST_SWAP
-swaps the contents of
-.Fa head1
-and
-.Fa head2 .
-.Sh SINGLY-LINKED LIST EXAMPLE
-.Bd -literal
-SLIST_HEAD(slisthead, entry) head =
-    SLIST_HEAD_INITIALIZER(head);
-struct slisthead *headp;		/* Singly-linked List head. */
-struct entry {
-	...
-	SLIST_ENTRY(entry) entries;	/* Singly-linked List. */
-	...
-} *n1, *n2, *n3, *np;
-
-SLIST_INIT(&head);			/* Initialize the list. */
-
-n1 = malloc(sizeof(struct entry));	/* Insert at the head. */
-SLIST_INSERT_HEAD(&head, n1, entries);
-
-n2 = malloc(sizeof(struct entry));	/* Insert after. */
-SLIST_INSERT_AFTER(n1, n2, entries);
-
-SLIST_REMOVE(&head, n2, entry, entries);/* Deletion. */
-free(n2);
-
-n3 = SLIST_FIRST(&head);
-SLIST_REMOVE_HEAD(&head, entries);	/* Deletion from the head. */
-free(n3);
-					/* Forward traversal. */
-SLIST_FOREACH(np, &head, entries)
-	np-> ...
-					/* Safe forward traversal. */
-SLIST_FOREACH_SAFE(np, &head, entries, np_temp) {
-	np->do_stuff();
-	...
-	SLIST_REMOVE(&head, np, entry, entries);
-	free(np);
-}
-
-while (!SLIST_EMPTY(&head)) {		/* List Deletion. */
-	n1 = SLIST_FIRST(&head);
-	SLIST_REMOVE_HEAD(&head, entries);
-	free(n1);
-}
-.Ed
-.Sh SINGLY-LINKED TAIL QUEUES
-A singly-linked tail queue is headed by a structure defined by the
-.Nm STAILQ_HEAD
-macro.
-This structure contains a pair of pointers,
-one to the first element in the tail queue and the other to
-the last element in the tail queue.
-The elements are singly linked for minimum space and pointer
-manipulation overhead at the expense of O(n) removal for arbitrary
-elements.
-New elements can be added to the tail queue after an existing element,
-at the head of the tail queue, or at the end of the tail queue.
-A
-.Fa STAILQ_HEAD
-structure is declared as follows:
-.Bd -literal -offset indent
-STAILQ_HEAD(HEADNAME, TYPE) head;
-.Ed
-.Pp
-where
-.Li HEADNAME
-is the name of the structure to be defined, and
-.Li TYPE
-is the type of the elements to be linked into the tail queue.
-A pointer to the head of the tail queue can later be declared as:
-.Bd -literal -offset indent
-struct HEADNAME *headp;
-.Ed
-.Pp
-(The names
-.Li head
-and
-.Li headp
-are user selectable.)
-.Pp
-The macro
-.Nm STAILQ_HEAD_INITIALIZER
-evaluates to an initializer for the tail queue
-.Fa head .
-.Pp
-The macro
-.Nm STAILQ_CONCAT
-concatenates the tail queue headed by
-.Fa head2
-onto the end of the one headed by
-.Fa head1
-removing all entries from the former.
-.Pp
-The macro
-.Nm STAILQ_EMPTY
-evaluates to true if there are no items on the tail queue.
-.Pp
-The macro
-.Nm STAILQ_ENTRY
-declares a structure that connects the elements in
-the tail queue.
-.Pp
-The macro
-.Nm STAILQ_FIRST
-returns the first item on the tail queue or NULL if the tail queue
-is empty.
-.Pp
-The macro
-.Nm STAILQ_FOREACH
-traverses the tail queue referenced by
-.Fa head
-in the forward direction, assigning each element
-in turn to
-.Fa var .
-.Pp
-The macro
-.Nm STAILQ_FOREACH_SAFE
-traverses the tail queue referenced by
-.Fa head
-in the forward direction, assigning each element
-in turn to
-.Fa var .
-However, unlike
-.Fn STAILQ_FOREACH
-here it is permitted to both remove
-.Fa var
-as well as free it from within the loop safely without interfering with the
-traversal.
-.Pp
-The macro
-.Nm STAILQ_INIT
-initializes the tail queue referenced by
-.Fa head .
-.Pp
-The macro
-.Nm STAILQ_INSERT_HEAD
-inserts the new element
-.Fa elm
-at the head of the tail queue.
-.Pp
-The macro
-.Nm STAILQ_INSERT_TAIL
-inserts the new element
-.Fa elm
-at the end of the tail queue.
-.Pp
-The macro
-.Nm STAILQ_INSERT_AFTER
-inserts the new element
-.Fa elm
-after the element
-.Fa listelm .
-.Pp
-The macro
-.Nm STAILQ_LAST
-returns the last item on the tail queue.
-If the tail queue is empty the return value is
-.Dv NULL .
-.Pp
-The macro
-.Nm STAILQ_NEXT
-returns the next item on the tail queue, or NULL this item is the last.
-.Pp
-The macro
-.Nm STAILQ_REMOVE_AFTER
-removes the element after
-.Fa elm
-from the tail queue. Unlike
-.Fa STAILQ_REMOVE ,
-this macro does not traverse the entire tail queue.
-.Pp
-The macro
-.Nm STAILQ_REMOVE_HEAD
-removes the element at the head of the tail queue.
-For optimum efficiency,
-elements being removed from the head of the tail queue should
-use this macro explicitly rather than the generic
-.Fa STAILQ_REMOVE
-macro.
-.Pp
-The macro
-.Nm STAILQ_REMOVE
-removes the element
-.Fa elm
-from the tail queue.
-.Pp
-The macro
-.Nm STAILQ_SWAP
-swaps the contents of
-.Fa head1
-and
-.Fa head2 .
-.Sh SINGLY-LINKED TAIL QUEUE EXAMPLE
-.Bd -literal
-STAILQ_HEAD(stailhead, entry) head =
-    STAILQ_HEAD_INITIALIZER(head);
-struct stailhead *headp;		/* Singly-linked tail queue head. */
-struct entry {
-	...
-	STAILQ_ENTRY(entry) entries;	/* Tail queue. */
-	...
-} *n1, *n2, *n3, *np;
-
-STAILQ_INIT(&head);			/* Initialize the queue. */
-
-n1 = malloc(sizeof(struct entry));	/* Insert at the head. */
-STAILQ_INSERT_HEAD(&head, n1, entries);
-
-n1 = malloc(sizeof(struct entry));	/* Insert at the tail. */
-STAILQ_INSERT_TAIL(&head, n1, entries);
-
-n2 = malloc(sizeof(struct entry));	/* Insert after. */
-STAILQ_INSERT_AFTER(&head, n1, n2, entries);
-					/* Deletion. */
-STAILQ_REMOVE(&head, n2, entry, entries);
-free(n2);
-					/* Deletion from the head. */
-n3 = STAILQ_FIRST(&head);
-STAILQ_REMOVE_HEAD(&head, entries);
-free(n3);
-					/* Forward traversal. */
-STAILQ_FOREACH(np, &head, entries)
-	np-> ...
-					/* Safe forward traversal. */
-STAILQ_FOREACH_SAFE(np, &head, entries, np_temp) {
-	np->do_stuff();
-	...
-	STAILQ_REMOVE(&head, np, entry, entries);
-	free(np);
-}
-					/* TailQ Deletion. */
-while (!STAILQ_EMPTY(&head)) {
-	n1 = STAILQ_FIRST(&head);
-	STAILQ_REMOVE_HEAD(&head, entries);
-	free(n1);
-}
-					/* Faster TailQ Deletion. */
-n1 = STAILQ_FIRST(&head);
-while (n1 != NULL) {
-	n2 = STAILQ_NEXT(n1, entries);
-	free(n1);
-	n1 = n2;
-}
-STAILQ_INIT(&head);
-.Ed
-.Sh LISTS
-A list is headed by a structure defined by the
-.Nm LIST_HEAD
-macro.
-This structure contains a single pointer to the first element
-on the list.
-The elements are doubly linked so that an arbitrary element can be
-removed without traversing the list.
-New elements can be added to the list after an existing element,
-before an existing element, or at the head of the list.
-A
-.Fa LIST_HEAD
-structure is declared as follows:
-.Bd -literal -offset indent
-LIST_HEAD(HEADNAME, TYPE) head;
-.Ed
-.Pp
-where
-.Fa HEADNAME
-is the name of the structure to be defined, and
-.Fa TYPE
-is the type of the elements to be linked into the list.
-A pointer to the head of the list can later be declared as:
-.Bd -literal -offset indent
-struct HEADNAME *headp;
-.Ed
-.Pp
-(The names
-.Li head
-and
-.Li headp
-are user selectable.)
-.Pp
-The macro
-.Nm LIST_HEAD_INITIALIZER
-evaluates to an initializer for the list
-.Fa head .
-.Pp
-The macro
-.Nm LIST_EMPTY
-evaluates to true if there are no elements in the list.
-.Pp
-The macro
-.Nm LIST_ENTRY
-declares a structure that connects the elements in
-the list.
-.Pp
-The macro
-.Nm LIST_FIRST
-returns the first element in the list or NULL if the list
-is empty.
-.Pp
-The macro
-.Nm LIST_FOREACH
-traverses the list referenced by
-.Fa head
-in the forward direction, assigning each element in turn to
-.Fa var .
-.Pp
-The macro
-.Nm LIST_FOREACH_SAFE
-traverses the list referenced by
-.Fa head
-in the forward direction, assigning each element in turn to
-.Fa var .
-However, unlike
-.Fn LIST_FOREACH
-here it is permitted to both remove
-.Fa var
-as well as free it from within the loop safely without interfering with the
-traversal.
-.Pp
-The macro
-.Nm LIST_INIT
-initializes the list referenced by
-.Fa head .
-.Pp
-The macro
-.Nm LIST_INSERT_HEAD
-inserts the new element
-.Fa elm
-at the head of the list.
-.Pp
-The macro
-.Nm LIST_INSERT_AFTER
-inserts the new element
-.Fa elm
-after the element
-.Fa listelm .
-.Pp
-The macro
-.Nm LIST_INSERT_BEFORE
-inserts the new element
-.Fa elm
-before the element
-.Fa listelm .
-.Pp
-The macro
-.Nm LIST_NEXT
-returns the next element in the list, or NULL if this is the last.
-.Pp
-The macro
-.Nm LIST_REMOVE
-removes the element
-.Fa elm
-from the list.
-.Pp
-The macro
-.Nm LIST_SWAP
-swaps the contents of
-.Fa head1
-and
-.Fa head2 .
-.Sh LIST EXAMPLE
-.Bd -literal
-LIST_HEAD(listhead, entry) head =
-    LIST_HEAD_INITIALIZER(head);
-struct listhead *headp;			/* List head. */
-struct entry {
-	...
-	LIST_ENTRY(entry) entries;	/* List. */
-	...
-} *n1, *n2, *n3, *np, *np_temp;
-
-LIST_INIT(&head);			/* Initialize the list. */
-
-n1 = malloc(sizeof(struct entry));	/* Insert at the head. */
-LIST_INSERT_HEAD(&head, n1, entries);
-
-n2 = malloc(sizeof(struct entry));	/* Insert after. */
-LIST_INSERT_AFTER(n1, n2, entries);
-
-n3 = malloc(sizeof(struct entry));	/* Insert before. */
-LIST_INSERT_BEFORE(n2, n3, entries);
-
-LIST_REMOVE(n2, entries);		/* Deletion. */
-free(n2);
-					/* Forward traversal. */
-LIST_FOREACH(np, &head, entries)
-	np-> ...
-
-					/* Safe forward traversal. */
-LIST_FOREACH_SAFE(np, &head, entries, np_temp) {
-	np->do_stuff();
-	...
-	LIST_REMOVE(np, entries);
-	free(np);
-}
-
-while (!LIST_EMPTY(&head)) {		/* List Deletion. */
-	n1 = LIST_FIRST(&head);
-	LIST_REMOVE(n1, entries);
-	free(n1);
-}
-
-n1 = LIST_FIRST(&head);			/* Faster List Deletion. */
-while (n1 != NULL) {
-	n2 = LIST_NEXT(n1, entries);
-	free(n1);
-	n1 = n2;
-}
-LIST_INIT(&head);
-.Ed
-.Sh TAIL QUEUES
-A tail queue is headed by a structure defined by the
-.Nm TAILQ_HEAD
-macro.
-This structure contains a pair of pointers,
-one to the first element in the tail queue and the other to
-the last element in the tail queue.
-The elements are doubly linked so that an arbitrary element can be
-removed without traversing the tail queue.
-New elements can be added to the tail queue after an existing element,
-before an existing element, at the head of the tail queue,
-or at the end of the tail queue.
-A
-.Fa TAILQ_HEAD
-structure is declared as follows:
-.Bd -literal -offset indent
-TAILQ_HEAD(HEADNAME, TYPE) head;
-.Ed
-.Pp
-where
-.Li HEADNAME
-is the name of the structure to be defined, and
-.Li TYPE
-is the type of the elements to be linked into the tail queue.
-A pointer to the head of the tail queue can later be declared as:
-.Bd -literal -offset indent
-struct HEADNAME *headp;
-.Ed
-.Pp
-(The names
-.Li head
-and
-.Li headp
-are user selectable.)
-.Pp
-The macro
-.Nm TAILQ_HEAD_INITIALIZER
-evaluates to an initializer for the tail queue
-.Fa head .
-.Pp
-The macro
-.Nm TAILQ_CONCAT
-concatenates the tail queue headed by
-.Fa head2
-onto the end of the one headed by
-.Fa head1
-removing all entries from the former.
-.Pp
-The macro
-.Nm TAILQ_EMPTY
-evaluates to true if there are no items on the tail queue.
-.Pp
-The macro
-.Nm TAILQ_ENTRY
-declares a structure that connects the elements in
-the tail queue.
-.Pp
-The macro
-.Nm TAILQ_FIRST
-returns the first item on the tail queue or NULL if the tail queue
-is empty.
-.Pp
-The macro
-.Nm TAILQ_FOREACH
-traverses the tail queue referenced by
-.Fa head
-in the forward direction, assigning each element in turn to
-.Fa var .
-.Fa var
-is set to
-.Dv NULL
-if the loop completes normally, or if there were no elements.
-.Pp
-The macro
-.Nm TAILQ_FOREACH_REVERSE
-traverses the tail queue referenced by
-.Fa head
-in the reverse direction, assigning each element in turn to
-.Fa var .
-.Pp
-The macros
-.Nm TAILQ_FOREACH_SAFE
-and
-.Nm TAILQ_FOREACH_REVERSE_SAFE
-traverse the list referenced by
-.Fa head
-in the forward or reverse direction respectively,
-assigning each element in turn to
-.Fa var .
-However, unlike their unsafe counterparts,
-.Nm TAILQ_FOREACH
-and
-.Nm TAILQ_FOREACH_REVERSE
-permit to both remove
-.Fa var
-as well as free it from within the loop safely without interfering with the
-traversal.
-.Pp
-The macro
-.Nm TAILQ_INIT
-initializes the tail queue referenced by
-.Fa head .
-.Pp
-The macro
-.Nm TAILQ_INSERT_HEAD
-inserts the new element
-.Fa elm
-at the head of the tail queue.
-.Pp
-The macro
-.Nm TAILQ_INSERT_TAIL
-inserts the new element
-.Fa elm
-at the end of the tail queue.
-.Pp
-The macro
-.Nm TAILQ_INSERT_AFTER
-inserts the new element
-.Fa elm
-after the element
-.Fa listelm .
-.Pp
-The macro
-.Nm TAILQ_INSERT_BEFORE
-inserts the new element
-.Fa elm
-before the element
-.Fa listelm .
-.Pp
-The macro
-.Nm TAILQ_LAST
-returns the last item on the tail queue.
-If the tail queue is empty the return value is
-.Dv NULL .
-.Pp
-The macro
-.Nm TAILQ_NEXT
-returns the next item on the tail queue, or NULL if this item is the last.
-.Pp
-The macro
-.Nm TAILQ_PREV
-returns the previous item on the tail queue, or NULL if this item
-is the first.
-.Pp
-The macro
-.Nm TAILQ_REMOVE
-removes the element
-.Fa elm
-from the tail queue.
-.Pp
-The macro
-.Nm TAILQ_SWAP
-swaps the contents of
-.Fa head1
-and
-.Fa head2 .
-.Sh TAIL QUEUE EXAMPLE
-.Bd -literal
-TAILQ_HEAD(tailhead, entry) head =
-    TAILQ_HEAD_INITIALIZER(head);
-struct tailhead *headp;			/* Tail queue head. */
-struct entry {
-	...
-	TAILQ_ENTRY(entry) entries;	/* Tail queue. */
-	...
-} *n1, *n2, *n3, *np;
-
-TAILQ_INIT(&head);			/* Initialize the queue. */
-
-n1 = malloc(sizeof(struct entry));	/* Insert at the head. */
-TAILQ_INSERT_HEAD(&head, n1, entries);
-
-n1 = malloc(sizeof(struct entry));	/* Insert at the tail. */
-TAILQ_INSERT_TAIL(&head, n1, entries);
-
-n2 = malloc(sizeof(struct entry));	/* Insert after. */
-TAILQ_INSERT_AFTER(&head, n1, n2, entries);
-
-n3 = malloc(sizeof(struct entry));	/* Insert before. */
-TAILQ_INSERT_BEFORE(n2, n3, entries);
-
-TAILQ_REMOVE(&head, n2, entries);	/* Deletion. */
-free(n2);
-					/* Forward traversal. */
-TAILQ_FOREACH(np, &head, entries)
-	np-> ...
-					/* Safe forward traversal. */
-TAILQ_FOREACH_SAFE(np, &head, entries, np_temp) {
-	np->do_stuff();
-	...
-	TAILQ_REMOVE(&head, np, entries);
-	free(np);
-}
-					/* Reverse traversal. */
-TAILQ_FOREACH_REVERSE(np, &head, tailhead, entries)
-	np-> ...
-					/* TailQ Deletion. */
-while (!TAILQ_EMPTY(&head)) {
-	n1 = TAILQ_FIRST(&head);
-	TAILQ_REMOVE(&head, n1, entries);
-	free(n1);
-}
-					/* Faster TailQ Deletion. */
-n1 = TAILQ_FIRST(&head);
-while (n1 != NULL) {
-	n2 = TAILQ_NEXT(n1, entries);
-	free(n1);
-	n1 = n2;
-}
-TAILQ_INIT(&head);
-.Ed
-.Sh SEE ALSO
-.Xr tree 3
-.Sh HISTORY
-The
-.Nm queue
-functions first appeared in
-.Bx 4.4 .
diff -r 6c9a73817770 -r 934c14ab9f19 tools/libxl/external/bsd-sys-queue.h
--- a/tools/libxl/external/bsd-sys-queue.h	Tue Jan 31 11:39:37 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,637 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	@(#)queue.h	8.5 (Berkeley) 8/20/94
- * $FreeBSD$
- */
-
-#ifndef _SYS_QUEUE_H_
-#define	_SYS_QUEUE_H_
-
-#include <sys/cdefs.h>
-
-/*
- * This file defines four types of data structures: singly-linked lists,
- * singly-linked tail queues, lists and tail queues.
- *
- * A singly-linked list is headed by a single forward pointer. The elements
- * are singly linked for minimum space and pointer manipulation overhead at
- * the expense of O(n) removal for arbitrary elements. New elements can be
- * added to the list after an existing element or at the head of the list.
- * Elements being removed from the head of the list should use the explicit
- * macro for this purpose for optimum efficiency. A singly-linked list may
- * only be traversed in the forward direction.  Singly-linked lists are ideal
- * for applications with large datasets and few or no removals or for
- * implementing a LIFO queue.
- *
- * A singly-linked tail queue is headed by a pair of pointers, one to the
- * head of the list and the other to the tail of the list. The elements are
- * singly linked for minimum space and pointer manipulation overhead at the
- * expense of O(n) removal for arbitrary elements. New elements can be added
- * to the list after an existing element, at the head of the list, or at the
- * end of the list. Elements being removed from the head of the tail queue
- * should use the explicit macro for this purpose for optimum efficiency.
- * A singly-linked tail queue may only be traversed in the forward direction.
- * Singly-linked tail queues are ideal for applications with large datasets
- * and few or no removals or for implementing a FIFO queue.
- *
- * A list is headed by a single forward pointer (or an array of forward
- * pointers for a hash table header). The elements are doubly linked
- * so that an arbitrary element can be removed without a need to
- * traverse the list. New elements can be added to the list before
- * or after an existing element or at the head of the list. A list
- * may only be traversed in the forward direction.
- *
- * A tail queue is headed by a pair of pointers, one to the head of the
- * list and the other to the tail of the list. The elements are doubly
- * linked so that an arbitrary element can be removed without a need to
- * traverse the list. New elements can be added to the list before or
- * after an existing element, at the head of the list, or at the end of
- * the list. A tail queue may be traversed in either direction.
- *
- * For details on the use of these macros, see the queue(3) manual page.
- *
- *
- *				SLIST	LIST	STAILQ	TAILQ
- * _HEAD			+	+	+	+
- * _HEAD_INITIALIZER		+	+	+	+
- * _ENTRY			+	+	+	+
- * _INIT			+	+	+	+
- * _EMPTY			+	+	+	+
- * _FIRST			+	+	+	+
- * _NEXT			+	+	+	+
- * _PREV			-	-	-	+
- * _LAST			-	-	+	+
- * _FOREACH			+	+	+	+
- * _FOREACH_SAFE		+	+	+	+
- * _FOREACH_REVERSE		-	-	-	+
- * _FOREACH_REVERSE_SAFE	-	-	-	+
- * _INSERT_HEAD			+	+	+	+
- * _INSERT_BEFORE		-	+	-	+
- * _INSERT_AFTER		+	+	+	+
- * _INSERT_TAIL			-	-	+	+
- * _CONCAT			-	-	+	+
- * _REMOVE_AFTER		+	-	+	-
- * _REMOVE_HEAD			+	-	+	-
- * _REMOVE			+	+	+	+
- * _SWAP			+	+	+	+
- *
- */
-#ifdef QUEUE_MACRO_DEBUG
-/* Store the last 2 places the queue element or head was altered */
-struct qm_trace {
-	char * lastfile;
-	int lastline;
-	char * prevfile;
-	int prevline;
-};
-
-#define	TRACEBUF	struct qm_trace trace;
-#define	TRASHIT(x)	do {(x) = (void *)-1;} while (0)
-#define	QMD_SAVELINK(name, link)	void **name = (void *)&(link)
-
-#define	QMD_TRACE_HEAD(head) do {					\
-	(head)->trace.prevline = (head)->trace.lastline;		\
-	(head)->trace.prevfile = (head)->trace.lastfile;		\
-	(head)->trace.lastline = __LINE__;				\
-	(head)->trace.lastfile = __FILE__;				\
-} while (0)
-
-#define	QMD_TRACE_ELEM(elem) do {					\
-	(elem)->trace.prevline = (elem)->trace.lastline;		\
-	(elem)->trace.prevfile = (elem)->trace.lastfile;		\
-	(elem)->trace.lastline = __LINE__;				\
-	(elem)->trace.lastfile = __FILE__;				\
-} while (0)
-
-#else
-#define	QMD_TRACE_ELEM(elem)
-#define	QMD_TRACE_HEAD(head)
-#define	QMD_SAVELINK(name, link)
-#define	TRACEBUF
-#define	TRASHIT(x)
-#endif	/* QUEUE_MACRO_DEBUG */
-
-/*
- * Singly-linked List declarations.
- */
-#define	SLIST_HEAD(name, type)						\
-struct name {								\
-	struct type *slh_first;	/* first element */			\
-}
-
-#define	SLIST_HEAD_INITIALIZER(head)					\
-	{ NULL }
-
-#define	SLIST_ENTRY(type)						\
-struct {								\
-	struct type *sle_next;	/* next element */			\
-}
-
-/*
- * Singly-linked List functions.
- */
-#define	SLIST_EMPTY(head)	((head)->slh_first == NULL)
-
-#define	SLIST_FIRST(head)	((head)->slh_first)
-
-#define	SLIST_FOREACH(var, head, field)					\
-	for ((var) = SLIST_FIRST((head));				\
-	    (var);							\
-	    (var) = SLIST_NEXT((var), field))
-
-#define	SLIST_FOREACH_SAFE(var, head, field, tvar)			\
-	for ((var) = SLIST_FIRST((head));				\
-	    (var) && ((tvar) = SLIST_NEXT((var), field), 1);		\
-	    (var) = (tvar))
-
-#define	SLIST_FOREACH_PREVPTR(var, varp, head, field)			\
-	for ((varp) = &SLIST_FIRST((head));				\
-	    ((var) = *(varp)) != NULL;					\
-	    (varp) = &SLIST_NEXT((var), field))
-
-#define	SLIST_INIT(head) do {						\
-	SLIST_FIRST((head)) = NULL;					\
-} while (0)
-
-#define	SLIST_INSERT_AFTER(slistelm, elm, field) do {			\
-	SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field);	\
-	SLIST_NEXT((slistelm), field) = (elm);				\
-} while (0)
-
-#define	SLIST_INSERT_HEAD(head, elm, field) do {			\
-	SLIST_NEXT((elm), field) = SLIST_FIRST((head));			\
-	SLIST_FIRST((head)) = (elm);					\
-} while (0)
-
-#define	SLIST_NEXT(elm, field)	((elm)->field.sle_next)
-
-#define	SLIST_REMOVE(head, elm, type, field) do {			\
-	QMD_SAVELINK(oldnext, (elm)->field.sle_next);			\
-	if (SLIST_FIRST((head)) == (elm)) {				\
-		SLIST_REMOVE_HEAD((head), field);			\
-	}								\
-	else {								\
-		struct type *curelm = SLIST_FIRST((head));		\
-		while (SLIST_NEXT(curelm, field) != (elm))		\
-			curelm = SLIST_NEXT(curelm, field);		\
-		SLIST_REMOVE_AFTER(curelm, field);			\
-	}								\
-	TRASHIT(*oldnext);						\
-} while (0)
-
-#define SLIST_REMOVE_AFTER(elm, field) do {				\
-	SLIST_NEXT(elm, field) =					\
-	    SLIST_NEXT(SLIST_NEXT(elm, field), field);			\
-} while (0)
-
-#define	SLIST_REMOVE_HEAD(head, field) do {				\
-	SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field);	\
-} while (0)
-
-#define SLIST_SWAP(head1, head2, type) do {				\
-	struct type *swap_first = SLIST_FIRST(head1);			\
-	SLIST_FIRST(head1) = SLIST_FIRST(head2);			\
-	SLIST_FIRST(head2) = swap_first;				\
-} while (0)
-
-/*
- * Singly-linked Tail queue declarations.
- */
-#define	STAILQ_HEAD(name, type)						\
-struct name {								\
-	struct type *stqh_first;/* first element */			\
-	struct type **stqh_last;/* addr of last next element */		\
-}
-
-#define	STAILQ_HEAD_INITIALIZER(head)					\
-	{ NULL, &(head).stqh_first }
-
-#define	STAILQ_ENTRY(type)						\
-struct {								\
-	struct type *stqe_next;	/* next element */			\
-}
-
-/*
- * Singly-linked Tail queue functions.
- */
-#define	STAILQ_CONCAT(head1, head2) do {				\
-	if (!STAILQ_EMPTY((head2))) {					\
-		*(head1)->stqh_last = (head2)->stqh_first;		\
-		(head1)->stqh_last = (head2)->stqh_last;		\
-		STAILQ_INIT((head2));					\
-	}								\
-} while (0)
-
-#define	STAILQ_EMPTY(head)	((head)->stqh_first == NULL)
-
-#define	STAILQ_FIRST(head)	((head)->stqh_first)
-
-#define	STAILQ_FOREACH(var, head, field)				\
-	for((var) = STAILQ_FIRST((head));				\
-	   (var);							\
-	   (var) = STAILQ_NEXT((var), field))
-
-
-#define	STAILQ_FOREACH_SAFE(var, head, field, tvar)			\
-	for ((var) = STAILQ_FIRST((head));				\
-	    (var) && ((tvar) = STAILQ_NEXT((var), field), 1);		\
-	    (var) = (tvar))
-
-#define	STAILQ_INIT(head) do {						\
-	STAILQ_FIRST((head)) = NULL;					\
-	(head)->stqh_last = &STAILQ_FIRST((head));			\
-} while (0)
-
-#define	STAILQ_INSERT_AFTER(head, tqelm, elm, field) do {		\
-	if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\
-		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\
-	STAILQ_NEXT((tqelm), field) = (elm);				\
-} while (0)
-
-#define	STAILQ_INSERT_HEAD(head, elm, field) do {			\
-	if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL)	\
-		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\
-	STAILQ_FIRST((head)) = (elm);					\
-} while (0)
-
-#define	STAILQ_INSERT_TAIL(head, elm, field) do {			\
-	STAILQ_NEXT((elm), field) = NULL;				\
-	*(head)->stqh_last = (elm);					\
-	(head)->stqh_last = &STAILQ_NEXT((elm), field);			\
-} while (0)
-
-#define	STAILQ_LAST(head, type, field)					\
-	(STAILQ_EMPTY((head)) ?						\
-		NULL :							\
-	        ((struct type *)(void *)				\
-		((char *)((head)->stqh_last) - __offsetof(struct type, field))))
-
-#define	STAILQ_NEXT(elm, field)	((elm)->field.stqe_next)
-
-#define	STAILQ_REMOVE(head, elm, type, field) do {			\
-	QMD_SAVELINK(oldnext, (elm)->field.stqe_next);			\
-	if (STAILQ_FIRST((head)) == (elm)) {				\
-		STAILQ_REMOVE_HEAD((head), field);			\
-	}								\
-	else {								\
-		struct type *curelm = STAILQ_FIRST((head));		\
-		while (STAILQ_NEXT(curelm, field) != (elm))		\
-			curelm = STAILQ_NEXT(curelm, field);		\
-		STAILQ_REMOVE_AFTER(head, curelm, field);		\
-	}								\
-	TRASHIT(*oldnext);						\
-} while (0)
-
-#define STAILQ_REMOVE_AFTER(head, elm, field) do {			\
-	if ((STAILQ_NEXT(elm, field) =					\
-	     STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL)	\
-		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\
-} while (0)
-
-#define	STAILQ_REMOVE_HEAD(head, field) do {				\
-	if ((STAILQ_FIRST((head)) =					\
-	     STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL)		\
-		(head)->stqh_last = &STAILQ_FIRST((head));		\
-} while (0)
-
-#define STAILQ_SWAP(head1, head2, type) do {				\
-	struct type *swap_first = STAILQ_FIRST(head1);			\
-	struct type **swap_last = (head1)->stqh_last;			\
-	STAILQ_FIRST(head1) = STAILQ_FIRST(head2);			\
-	(head1)->stqh_last = (head2)->stqh_last;			\
-	STAILQ_FIRST(head2) = swap_first;				\
-	(head2)->stqh_last = swap_last;					\
-	if (STAILQ_EMPTY(head1))					\
-		(head1)->stqh_last = &STAILQ_FIRST(head1);		\
-	if (STAILQ_EMPTY(head2))					\
-		(head2)->stqh_last = &STAILQ_FIRST(head2);		\
-} while (0)
-
-
-/*
- * List declarations.
- */
-#define	LIST_HEAD(name, type)						\
-struct name {								\
-	struct type *lh_first;	/* first element */			\
-}
-
-#define	LIST_HEAD_INITIALIZER(head)					\
-	{ NULL }
-
-#define	LIST_ENTRY(type)						\
-struct {								\
-	struct type *le_next;	/* next element */			\
-	struct type **le_prev;	/* address of previous next element */	\
-}
-
-/*
- * List functions.
- */
-
-#if (defined(_KERNEL) && defined(INVARIANTS))
-#define	QMD_LIST_CHECK_HEAD(head, field) do {				\
-	if (LIST_FIRST((head)) != NULL &&				\
-	    LIST_FIRST((head))->field.le_prev !=			\
-	     &LIST_FIRST((head)))					\
-		panic("Bad list head %p first->prev != head", (head));	\
-} while (0)
-
-#define	QMD_LIST_CHECK_NEXT(elm, field) do {				\
-	if (LIST_NEXT((elm), field) != NULL &&				\
-	    LIST_NEXT((elm), field)->field.le_prev !=			\
-	     &((elm)->field.le_next))					\
-	     	panic("Bad link elm %p next->prev != elm", (elm));	\
-} while (0)
-
-#define	QMD_LIST_CHECK_PREV(elm, field) do {				\
-	if (*(elm)->field.le_prev != (elm))				\
-		panic("Bad link elm %p prev->next != elm", (elm));	\
-} while (0)
-#else
-#define	QMD_LIST_CHECK_HEAD(head, field)
-#define	QMD_LIST_CHECK_NEXT(elm, field)
-#define	QMD_LIST_CHECK_PREV(elm, field)
-#endif /* (_KERNEL && INVARIANTS) */
-
-#define	LIST_EMPTY(head)	((head)->lh_first == NULL)
-
-#define	LIST_FIRST(head)	((head)->lh_first)
-
-#define	LIST_FOREACH(var, head, field)					\
-	for ((var) = LIST_FIRST((head));				\
-	    (var);							\
-	    (var) = LIST_NEXT((var), field))
-
-#define	LIST_FOREACH_SAFE(var, head, field, tvar)			\
-	for ((var) = LIST_FIRST((head));				\
-	    (var) && ((tvar) = LIST_NEXT((var), field), 1);		\
-	    (var) = (tvar))
-
-#define	LIST_INIT(head) do {						\
-	LIST_FIRST((head)) = NULL;					\
-} while (0)
-
-#define	LIST_INSERT_AFTER(listelm, elm, field) do {			\
-	QMD_LIST_CHECK_NEXT(listelm, field);				\
-	if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\
-		LIST_NEXT((listelm), field)->field.le_prev =		\
-		    &LIST_NEXT((elm), field);				\
-	LIST_NEXT((listelm), field) = (elm);				\
-	(elm)->field.le_prev = &LIST_NEXT((listelm), field);		\
-} while (0)
-
-#define	LIST_INSERT_BEFORE(listelm, elm, field) do {			\
-	QMD_LIST_CHECK_PREV(listelm, field);				\
-	(elm)->field.le_prev = (listelm)->field.le_prev;		\
-	LIST_NEXT((elm), field) = (listelm);				\
-	*(listelm)->field.le_prev = (elm);				\
-	(listelm)->field.le_prev = &LIST_NEXT((elm), field);		\
-} while (0)
-
-#define	LIST_INSERT_HEAD(head, elm, field) do {				\
-	QMD_LIST_CHECK_HEAD((head), field);				\
-	if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL)	\
-		LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
-	LIST_FIRST((head)) = (elm);					\
-	(elm)->field.le_prev = &LIST_FIRST((head));			\
-} while (0)
-
-#define	LIST_NEXT(elm, field)	((elm)->field.le_next)
-
-#define	LIST_REMOVE(elm, field) do {					\
-	QMD_SAVELINK(oldnext, (elm)->field.le_next);			\
-	QMD_SAVELINK(oldprev, (elm)->field.le_prev);			\
-	QMD_LIST_CHECK_NEXT(elm, field);				\
-	QMD_LIST_CHECK_PREV(elm, field);				\
-	if (LIST_NEXT((elm), field) != NULL)				\
-		LIST_NEXT((elm), field)->field.le_prev = 		\
-		    (elm)->field.le_prev;				\
-	*(elm)->field.le_prev = LIST_NEXT((elm), field);		\
-	TRASHIT(*oldnext);						\
-	TRASHIT(*oldprev);						\
-} while (0)
-
-#define LIST_SWAP(head1, head2, type, field) do {			\
-	struct type *swap_tmp = LIST_FIRST((head1));			\
-	LIST_FIRST((head1)) = LIST_FIRST((head2));			\
-	LIST_FIRST((head2)) = swap_tmp;					\
-	if ((swap_tmp = LIST_FIRST((head1))) != NULL)			\
-		swap_tmp->field.le_prev = &LIST_FIRST((head1));		\
-	if ((swap_tmp = LIST_FIRST((head2))) != NULL)			\
-		swap_tmp->field.le_prev = &LIST_FIRST((head2));		\
-} while (0)
-
-/*
- * Tail queue declarations.
- */
-#define	TAILQ_HEAD(name, type)						\
-struct name {								\
-	struct type *tqh_first;	/* first element */			\
-	struct type **tqh_last;	/* addr of last next element */		\
-	TRACEBUF							\
-}
-
-#define	TAILQ_HEAD_INITIALIZER(head)					\
-	{ NULL, &(head).tqh_first }
-
-#define	TAILQ_ENTRY(type)						\
-struct {								\
-	struct type *tqe_next;	/* next element */			\
-	struct type **tqe_prev;	/* address of previous next element */	\
-	TRACEBUF							\
-}
-
-/*
- * Tail queue functions.
- */
-#if (defined(_KERNEL) && defined(INVARIANTS))
-#define	QMD_TAILQ_CHECK_HEAD(head, field) do {				\
-	if (!TAILQ_EMPTY(head) &&					\
-	    TAILQ_FIRST((head))->field.tqe_prev !=			\
-	     &TAILQ_FIRST((head)))					\
-		panic("Bad tailq head %p first->prev != head", (head));	\
-} while (0)
-
-#define	QMD_TAILQ_CHECK_TAIL(head, field) do {				\
-	if (*(head)->tqh_last != NULL)					\
-	    	panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head)); 	\
-} while (0)
-
-#define	QMD_TAILQ_CHECK_NEXT(elm, field) do {				\
-	if (TAILQ_NEXT((elm), field) != NULL &&				\
-	    TAILQ_NEXT((elm), field)->field.tqe_prev !=			\
-	     &((elm)->field.tqe_next))					\
-		panic("Bad link elm %p next->prev != elm", (elm));	\
-} while (0)
-
-#define	QMD_TAILQ_CHECK_PREV(elm, field) do {				\
-	if (*(elm)->field.tqe_prev != (elm))				\
-		panic("Bad link elm %p prev->next != elm", (elm));	\
-} while (0)
-#else
-#define	QMD_TAILQ_CHECK_HEAD(head, field)
-#define	QMD_TAILQ_CHECK_TAIL(head, headname)
-#define	QMD_TAILQ_CHECK_NEXT(elm, field)
-#define	QMD_TAILQ_CHECK_PREV(elm, field)
-#endif /* (_KERNEL && INVARIANTS) */
-
-#define	TAILQ_CONCAT(head1, head2, field) do {				\
-	if (!TAILQ_EMPTY(head2)) {					\
-		*(head1)->tqh_last = (head2)->tqh_first;		\
-		(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last;	\
-		(head1)->tqh_last = (head2)->tqh_last;			\
-		TAILQ_INIT((head2));					\
-		QMD_TRACE_HEAD(head1);					\
-		QMD_TRACE_HEAD(head2);					\
-	}								\
-} while (0)
-
-#define	TAILQ_EMPTY(head)	((head)->tqh_first == NULL)
-
-#define	TAILQ_FIRST(head)	((head)->tqh_first)
-
-#define	TAILQ_FOREACH(var, head, field)					\
-	for ((var) = TAILQ_FIRST((head));				\
-	    (var);							\
-	    (var) = TAILQ_NEXT((var), field))
-
-#define	TAILQ_FOREACH_SAFE(var, head, field, tvar)			\
-	for ((var) = TAILQ_FIRST((head));				\
-	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\
-	    (var) = (tvar))
-
-#define	TAILQ_FOREACH_REVERSE(var, head, headname, field)		\
-	for ((var) = TAILQ_LAST((head), headname);			\
-	    (var);							\
-	    (var) = TAILQ_PREV((var), headname, field))
-
-#define	TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar)	\
-	for ((var) = TAILQ_LAST((head), headname);			\
-	    (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\
-	    (var) = (tvar))
-
-#define	TAILQ_INIT(head) do {						\
-	TAILQ_FIRST((head)) = NULL;					\
-	(head)->tqh_last = &TAILQ_FIRST((head));			\
-	QMD_TRACE_HEAD(head);						\
-} while (0)
-
-#define	TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
-	QMD_TAILQ_CHECK_NEXT(listelm, field);				\
-	if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
-		TAILQ_NEXT((elm), field)->field.tqe_prev = 		\
-		    &TAILQ_NEXT((elm), field);				\
-	else {								\
-		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
-		QMD_TRACE_HEAD(head);					\
-	}								\
-	TAILQ_NEXT((listelm), field) = (elm);				\
-	(elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field);		\
-	QMD_TRACE_ELEM(&(elm)->field);					\
-	QMD_TRACE_ELEM(&listelm->field);				\
-} while (0)
-
-#define	TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\
-	QMD_TAILQ_CHECK_PREV(listelm, field);				\
-	(elm)->field.tqe_prev = (listelm)->field.tqe_prev;		\
-	TAILQ_NEXT((elm), field) = (listelm);				\
-	*(listelm)->field.tqe_prev = (elm);				\
-	(listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field);		\
-	QMD_TRACE_ELEM(&(elm)->field);					\
-	QMD_TRACE_ELEM(&listelm->field);				\
-} while (0)
-
-#define	TAILQ_INSERT_HEAD(head, elm, field) do {			\
-	QMD_TAILQ_CHECK_HEAD(head, field);				\
-	if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL)	\
-		TAILQ_FIRST((head))->field.tqe_prev =			\
-		    &TAILQ_NEXT((elm), field);				\
-	else								\
-		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\
-	TAILQ_FIRST((head)) = (elm);					\
-	(elm)->field.tqe_prev = &TAILQ_FIRST((head));			\
-	QMD_TRACE_HEAD(head);						\
-	QMD_TRACE_ELEM(&(elm)->field);					\
-} while (0)
-
-#define	TAILQ_INSERT_TAIL(head, elm, field) do {			\
-	QMD_TAILQ_CHECK_TAIL(head, field);				\
-	TAILQ_NEXT((elm), field) = NULL;				\
-	(elm)->field.tqe_prev = (head)->tqh_last;			\
-	*(head)->tqh_last = (elm);					\
-	(head)->tqh_last = &TAILQ_NEXT((elm), field);			\
-	QMD_TRACE_HEAD(head);						\
-	QMD_TRACE_ELEM(&(elm)->field);					\
-} while (0)
-
-#define	TAILQ_LAST(head, headname)					\
-	(*(((struct headname *)((head)->tqh_last))->tqh_last))
-
-#define	TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
-
-#define	TAILQ_PREV(elm, headname, field)				\
-	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
-
-#define	TAILQ_REMOVE(head, elm, field) do {				\
-	QMD_SAVELINK(oldnext, (elm)->field.tqe_next);			\
-	QMD_SAVELINK(oldprev, (elm)->field.tqe_prev);			\
-	QMD_TAILQ_CHECK_NEXT(elm, field);				\
-	QMD_TAILQ_CHECK_PREV(elm, field);				\
-	if ((TAILQ_NEXT((elm), field)) != NULL)				\
-		TAILQ_NEXT((elm), field)->field.tqe_prev = 		\
-		    (elm)->field.tqe_prev;				\
-	else {								\
-		(head)->tqh_last = (elm)->field.tqe_prev;		\
-		QMD_TRACE_HEAD(head);					\
-	}								\
-	*(elm)->field.tqe_prev = TAILQ_NEXT((elm), field);		\
-	TRASHIT(*oldnext);						\
-	TRASHIT(*oldprev);						\
-	QMD_TRACE_ELEM(&(elm)->field);					\
-} while (0)
-
-#define TAILQ_SWAP(head1, head2, type, field) do {			\
-	struct type *swap_first = (head1)->tqh_first;			\
-	struct type **swap_last = (head1)->tqh_last;			\
-	(head1)->tqh_first = (head2)->tqh_first;			\
-	(head1)->tqh_last = (head2)->tqh_last;				\
-	(head2)->tqh_first = swap_first;				\
-	(head2)->tqh_last = swap_last;					\
-	if ((swap_first = (head1)->tqh_first) != NULL)			\
-		swap_first->field.tqe_prev = &(head1)->tqh_first;	\
-	else								\
-		(head1)->tqh_last = &(head1)->tqh_first;		\
-	if ((swap_first = (head2)->tqh_first) != NULL)			\
-		swap_first->field.tqe_prev = &(head2)->tqh_first;	\
-	else								\
-		(head2)->tqh_last = &(head2)->tqh_first;		\
-} while (0)
-
-#endif /* !_SYS_QUEUE_H_ */

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8E-0007LJ-Vj; Fri, 03 Feb 2012 21:57:22 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8D-0007KQ-Tr
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1328306202!51036611!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20912 invoked from network); 3 Feb 2012 21:56:43 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:43 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8B-0001mK-Eq
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR89-0002m8-Ms
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:18 +0000
Message-Id: <E1RtR89-0002m8-Ms@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: Use defines for bits of
	MSR_IA32_DEBUGCTLMSR instead of numbers
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
# Date 1328111154 -3600
# Node ID 84b896135fd1b51cc4605129f1200786c795f453
# Parent  ab397bd22b565ed3dfa68e02c0b641a225b10762
x86: Use defines for bits of MSR_IA32_DEBUGCTLMSR instead of numbers

Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r ab397bd22b56 -r 84b896135fd1 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c	Tue Jan 31 16:48:06 2012 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c	Wed Feb 01 16:45:54 2012 +0100
@@ -1944,11 +1944,12 @@
         break;
     case MSR_IA32_DEBUGCTLMSR: {
         int i, rc = 0;
-
-        if ( !msr_content || (msr_content & ~3) )
+        uint64_t supported = IA32_DEBUGCTLMSR_LBR | IA32_DEBUGCTLMSR_BTF;
+
+        if ( !msr_content || (msr_content & ~supported) )
             break;
 
-        if ( msr_content & 1 )
+        if ( msr_content & IA32_DEBUGCTLMSR_LBR )
         {
             const struct lbr_info *lbr = last_branch_msr_get();
             if ( lbr == NULL )
diff -r ab397bd22b56 -r 84b896135fd1 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c	Tue Jan 31 16:48:06 2012 +0000
+++ b/xen/arch/x86/traps.c	Wed Feb 01 16:45:54 2012 +0100
@@ -3376,12 +3376,12 @@
 static void ler_enable(void)
 {
     u64 debugctl;
-    
+
     if ( !this_cpu(ler_msr) )
         return;
 
     rdmsrl(MSR_IA32_DEBUGCTLMSR, debugctl);
-    wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctl | 1);
+    wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctl | IA32_DEBUGCTLMSR_LBR);
 }
 
 void do_debug(struct cpu_user_regs *regs)
diff -r ab397bd22b56 -r 84b896135fd1 xen/include/asm-x86/msr-index.h
--- a/xen/include/asm-x86/msr-index.h	Tue Jan 31 16:48:06 2012 +0000
+++ b/xen/include/asm-x86/msr-index.h	Wed Feb 01 16:45:54 2012 +0100
@@ -65,11 +65,14 @@
 #define MSR_MTRRdefType			0x000002ff
 
 #define MSR_IA32_DEBUGCTLMSR		0x000001d9
+#define IA32_DEBUGCTLMSR_LBR		(1<<0) /* Last Branch Record */
+#define IA32_DEBUGCTLMSR_BTF		(1<<1) /* Single Step on Branches */
+
 #define MSR_IA32_LASTBRANCHFROMIP	0x000001db
 #define MSR_IA32_LASTBRANCHTOIP		0x000001dc
 #define MSR_IA32_LASTINTFROMIP		0x000001dd
 #define MSR_IA32_LASTINTTOIP		0x000001de
- 
+
 #define MSR_IA32_MTRR_PHYSBASE0     0x00000200
 #define MSR_IA32_MTRR_PHYSMASK0     0x00000201
 #define MSR_IA32_MTRR_PHYSBASE1     0x00000202

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8E-0007LJ-Vj; Fri, 03 Feb 2012 21:57:22 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8D-0007KQ-Tr
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1328306202!51036611!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20912 invoked from network); 3 Feb 2012 21:56:43 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:43 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8B-0001mK-Eq
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR89-0002m8-Ms
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:18 +0000
Message-Id: <E1RtR89-0002m8-Ms@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: Use defines for bits of
	MSR_IA32_DEBUGCTLMSR instead of numbers
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
# Date 1328111154 -3600
# Node ID 84b896135fd1b51cc4605129f1200786c795f453
# Parent  ab397bd22b565ed3dfa68e02c0b641a225b10762
x86: Use defines for bits of MSR_IA32_DEBUGCTLMSR instead of numbers

Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r ab397bd22b56 -r 84b896135fd1 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c	Tue Jan 31 16:48:06 2012 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c	Wed Feb 01 16:45:54 2012 +0100
@@ -1944,11 +1944,12 @@
         break;
     case MSR_IA32_DEBUGCTLMSR: {
         int i, rc = 0;
-
-        if ( !msr_content || (msr_content & ~3) )
+        uint64_t supported = IA32_DEBUGCTLMSR_LBR | IA32_DEBUGCTLMSR_BTF;
+
+        if ( !msr_content || (msr_content & ~supported) )
             break;
 
-        if ( msr_content & 1 )
+        if ( msr_content & IA32_DEBUGCTLMSR_LBR )
         {
             const struct lbr_info *lbr = last_branch_msr_get();
             if ( lbr == NULL )
diff -r ab397bd22b56 -r 84b896135fd1 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c	Tue Jan 31 16:48:06 2012 +0000
+++ b/xen/arch/x86/traps.c	Wed Feb 01 16:45:54 2012 +0100
@@ -3376,12 +3376,12 @@
 static void ler_enable(void)
 {
     u64 debugctl;
-    
+
     if ( !this_cpu(ler_msr) )
         return;
 
     rdmsrl(MSR_IA32_DEBUGCTLMSR, debugctl);
-    wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctl | 1);
+    wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctl | IA32_DEBUGCTLMSR_LBR);
 }
 
 void do_debug(struct cpu_user_regs *regs)
diff -r ab397bd22b56 -r 84b896135fd1 xen/include/asm-x86/msr-index.h
--- a/xen/include/asm-x86/msr-index.h	Tue Jan 31 16:48:06 2012 +0000
+++ b/xen/include/asm-x86/msr-index.h	Wed Feb 01 16:45:54 2012 +0100
@@ -65,11 +65,14 @@
 #define MSR_MTRRdefType			0x000002ff
 
 #define MSR_IA32_DEBUGCTLMSR		0x000001d9
+#define IA32_DEBUGCTLMSR_LBR		(1<<0) /* Last Branch Record */
+#define IA32_DEBUGCTLMSR_BTF		(1<<1) /* Single Step on Branches */
+
 #define MSR_IA32_LASTBRANCHFROMIP	0x000001db
 #define MSR_IA32_LASTBRANCHTOIP		0x000001dc
 #define MSR_IA32_LASTINTFROMIP		0x000001dd
 #define MSR_IA32_LASTINTTOIP		0x000001de
- 
+
 #define MSR_IA32_MTRR_PHYSBASE0     0x00000200
 #define MSR_IA32_MTRR_PHYSMASK0     0x00000201
 #define MSR_IA32_MTRR_PHYSBASE1     0x00000202

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8H-0007Me-2L; Fri, 03 Feb 2012 21:57:25 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8G-0007JI-3o
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:24 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-216.messagelabs.com!1328306236!12799688!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18843 invoked from network); 3 Feb 2012 21:57:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR88-0001mD-H8
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR85-0002kT-OR
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:15 +0000
Message-Id: <E1RtR85-0002kT-OR@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: add support for yajl 2.x
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328028486 0
# Node ID ab397bd22b565ed3dfa68e02c0b641a225b10762
# Parent  934c14ab9f19330c91e2769beb96ac6896b2a1c8
libxl: add support for yajl 2.x

This patch adds support for yajl versions 2.x, while retaining 1.x
compatibility. All the needed ifdefs can be found in libxl_json.h.

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 934c14ab9f19 -r ab397bd22b56 Config.mk
--- a/Config.mk	Tue Jan 31 16:06:14 2012 +0000
+++ b/Config.mk	Tue Jan 31 16:48:06 2012 +0000
@@ -186,6 +186,11 @@
                        . $(XEN_ROOT)/tools/check/funcs.sh; \
                        has_lib libiconv.so && echo 'y' || echo 'n')
 
+CONFIG_YAJL_VERSION := $(shell export OS="`uname -s`"; \
+                       export CHECK_INCLUDES="$(CHECK_INCLUDES)"; \
+                       . $(XEN_ROOT)/tools/check/funcs.sh; \
+                       has_header yajl/yajl_version.h && echo 'y' || echo 'n')
+
 # Enable XSM security module (by default, Flask).
 XSM_ENABLE ?= n
 FLASK_ENABLE ?= $(XSM_ENABLE)
diff -r 934c14ab9f19 -r ab397bd22b56 tools/check/check_yajl_lib
--- a/tools/check/check_yajl_lib	Tue Jan 31 16:06:14 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD CHECK-INSTALL
-
-. ./funcs.sh
-
-has_lib libyajl.so.1 || fail "can't find libyajl.so.1 version 1"
diff -r 934c14ab9f19 -r ab397bd22b56 tools/libxl/Makefile
--- a/tools/libxl/Makefile	Tue Jan 31 16:06:14 2012 +0000
+++ b/tools/libxl/Makefile	Tue Jan 31 16:48:06 2012 +0000
@@ -19,6 +19,10 @@
 LIBUUID_LIBS += -luuid
 endif
 
+ifeq ($(CONFIG_YAJL_VERSION),y)
+CFLAGS += -DHAVE_YAJL_VERSION
+endif
+
 LIBXL_LIBS =
 LIBXL_LIBS = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(LDLIBS_libblktapctl) $(UTIL_LIBS) $(LIBUUID_LIBS)
 
diff -r 934c14ab9f19 -r ab397bd22b56 tools/libxl/libxl_json.c
--- a/tools/libxl/libxl_json.c	Tue Jan 31 16:06:14 2012 +0000
+++ b/tools/libxl/libxl_json.c	Tue Jan 31 16:48:06 2012 +0000
@@ -517,7 +517,7 @@
     return false;
 }
 
-static int json_callback_number(void *opaque, const char *s, unsigned int len)
+static int json_callback_number(void *opaque, const char *s, libxl_yajl_length len)
 {
     libxl__yajl_ctx *ctx = opaque;
     libxl__json_object *obj = NULL;
@@ -574,7 +574,7 @@
 }
 
 static int json_callback_string(void *opaque, const unsigned char *str,
-                                unsigned int len)
+                                libxl_yajl_length len)
 {
     libxl__yajl_ctx *ctx = opaque;
     char *t = NULL;
@@ -607,7 +607,7 @@
 }
 
 static int json_callback_map_key(void *opaque, const unsigned char *str,
-                                 unsigned int len)
+                                 libxl_yajl_length len)
 {
     libxl__yajl_ctx *ctx = opaque;
     char *t = NULL;
@@ -770,17 +770,13 @@
     DEBUG_GEN_ALLOC(&yajl_ctx);
 
     if (yajl_ctx.hand == NULL) {
-        yajl_parser_config cfg = {
-            .allowComments = 1,
-            .checkUTF8 = 1,
-        };
-        yajl_ctx.hand = yajl_alloc(&callbacks, &cfg, NULL, &yajl_ctx);
+        yajl_ctx.hand = libxl__yajl_alloc(&callbacks, 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);
+    status = yajl_complete_parse(yajl_ctx.hand);
     if (status != yajl_status_ok)
         goto out;
 
@@ -832,14 +828,13 @@
 char *libxl__object_to_json(libxl_ctx *ctx, const char *type,
                             libxl__gen_json_callback gen, void *p)
 {
-    yajl_gen_config conf = { 1, "    " };
     const unsigned char *buf;
     char *ret = NULL;
-    unsigned int len = 0;
+    libxl_yajl_length len = 0;
     yajl_gen_status s;
     yajl_gen hand;
 
-    hand = yajl_gen_alloc(&conf, NULL);
+    hand = libxl__yajl_gen_alloc(NULL);
     if (!hand)
         return NULL;
 
diff -r 934c14ab9f19 -r ab397bd22b56 tools/libxl/libxl_json.h
--- a/tools/libxl/libxl_json.h	Tue Jan 31 16:06:14 2012 +0000
+++ b/tools/libxl/libxl_json.h	Tue Jan 31 16:48:06 2012 +0000
@@ -16,7 +16,58 @@
 #define LIBXL_JSON_H
 
 #include <yajl/yajl_gen.h>
+#include <yajl/yajl_parse.h>
+
+#ifdef HAVE_YAJL_VERSION
+#  include <yajl/yajl_version.h>
+#endif
 
 #include <_libxl_types_json.h>
 
+/* YAJL version check */
+#if defined(YAJL_MAJOR) && (YAJL_MAJOR > 1)
+#  define HAVE_YAJL_V2 1
+#endif
+
+#ifdef HAVE_YAJL_V2
+
+typedef size_t libxl_yajl_length;
+
+static inline yajl_handle libxl__yajl_alloc(const yajl_callbacks *callbacks,
+                                            yajl_alloc_funcs *allocFuncs,
+                                            void *ctx)
+{
+    return yajl_alloc(callbacks, allocFuncs, ctx);
+}
+
+static inline yajl_gen libxl__yajl_gen_alloc(const yajl_alloc_funcs *allocFuncs)
+{
+    return yajl_gen_alloc(allocFuncs);
+}
+
+#else /* !HAVE_YAJL_V2 */
+
+#define yajl_complete_parse yajl_parse_complete
+
+typedef unsigned int libxl_yajl_length;
+
+static inline yajl_handle libxl__yajl_alloc(const yajl_callbacks *callbacks,
+                                            const yajl_alloc_funcs *allocFuncs,
+                                            void *ctx)
+{
+    yajl_parser_config cfg = {
+        .allowComments = 1,
+        .checkUTF8 = 1,
+    };
+    return yajl_alloc(callbacks, &cfg, allocFuncs, ctx);
+}
+
+static inline yajl_gen libxl__yajl_gen_alloc(const yajl_alloc_funcs *allocFuncs)
+{
+    yajl_gen_config conf = { 1, "    " };
+    return yajl_gen_alloc(&conf, allocFuncs);
+}
+
+#endif /* !HAVE_YAJL_V2 */
+
 #endif /* LIBXL_JSON_H */
diff -r 934c14ab9f19 -r ab397bd22b56 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Tue Jan 31 16:06:14 2012 +0000
+++ b/tools/libxl/libxl_qmp.c	Tue Jan 31 16:48:06 2012 +0000
@@ -454,15 +454,15 @@
                               qmp_callback_t callback, void *opaque,
                               qmp_request_context *context)
 {
-    yajl_gen_config conf = { 0, NULL };
     const unsigned char *buf = NULL;
     char *ret = NULL;
-    unsigned int len = 0;
+    libxl_yajl_length len = 0;
     yajl_gen_status s;
     yajl_gen hand;
     callback_id_pair *elm = NULL;
 
-    hand = yajl_gen_alloc(&conf, NULL);
+    hand = libxl__yajl_gen_alloc(NULL);
+
     if (!hand) {
         return NULL;
     }

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8H-0007Me-2L; Fri, 03 Feb 2012 21:57:25 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8G-0007JI-3o
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:24 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-216.messagelabs.com!1328306236!12799688!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18843 invoked from network); 3 Feb 2012 21:57:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR88-0001mD-H8
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR85-0002kT-OR
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:15 +0000
Message-Id: <E1RtR85-0002kT-OR@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: add support for yajl 2.x
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328028486 0
# Node ID ab397bd22b565ed3dfa68e02c0b641a225b10762
# Parent  934c14ab9f19330c91e2769beb96ac6896b2a1c8
libxl: add support for yajl 2.x

This patch adds support for yajl versions 2.x, while retaining 1.x
compatibility. All the needed ifdefs can be found in libxl_json.h.

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 934c14ab9f19 -r ab397bd22b56 Config.mk
--- a/Config.mk	Tue Jan 31 16:06:14 2012 +0000
+++ b/Config.mk	Tue Jan 31 16:48:06 2012 +0000
@@ -186,6 +186,11 @@
                        . $(XEN_ROOT)/tools/check/funcs.sh; \
                        has_lib libiconv.so && echo 'y' || echo 'n')
 
+CONFIG_YAJL_VERSION := $(shell export OS="`uname -s`"; \
+                       export CHECK_INCLUDES="$(CHECK_INCLUDES)"; \
+                       . $(XEN_ROOT)/tools/check/funcs.sh; \
+                       has_header yajl/yajl_version.h && echo 'y' || echo 'n')
+
 # Enable XSM security module (by default, Flask).
 XSM_ENABLE ?= n
 FLASK_ENABLE ?= $(XSM_ENABLE)
diff -r 934c14ab9f19 -r ab397bd22b56 tools/check/check_yajl_lib
--- a/tools/check/check_yajl_lib	Tue Jan 31 16:06:14 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD CHECK-INSTALL
-
-. ./funcs.sh
-
-has_lib libyajl.so.1 || fail "can't find libyajl.so.1 version 1"
diff -r 934c14ab9f19 -r ab397bd22b56 tools/libxl/Makefile
--- a/tools/libxl/Makefile	Tue Jan 31 16:06:14 2012 +0000
+++ b/tools/libxl/Makefile	Tue Jan 31 16:48:06 2012 +0000
@@ -19,6 +19,10 @@
 LIBUUID_LIBS += -luuid
 endif
 
+ifeq ($(CONFIG_YAJL_VERSION),y)
+CFLAGS += -DHAVE_YAJL_VERSION
+endif
+
 LIBXL_LIBS =
 LIBXL_LIBS = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(LDLIBS_libblktapctl) $(UTIL_LIBS) $(LIBUUID_LIBS)
 
diff -r 934c14ab9f19 -r ab397bd22b56 tools/libxl/libxl_json.c
--- a/tools/libxl/libxl_json.c	Tue Jan 31 16:06:14 2012 +0000
+++ b/tools/libxl/libxl_json.c	Tue Jan 31 16:48:06 2012 +0000
@@ -517,7 +517,7 @@
     return false;
 }
 
-static int json_callback_number(void *opaque, const char *s, unsigned int len)
+static int json_callback_number(void *opaque, const char *s, libxl_yajl_length len)
 {
     libxl__yajl_ctx *ctx = opaque;
     libxl__json_object *obj = NULL;
@@ -574,7 +574,7 @@
 }
 
 static int json_callback_string(void *opaque, const unsigned char *str,
-                                unsigned int len)
+                                libxl_yajl_length len)
 {
     libxl__yajl_ctx *ctx = opaque;
     char *t = NULL;
@@ -607,7 +607,7 @@
 }
 
 static int json_callback_map_key(void *opaque, const unsigned char *str,
-                                 unsigned int len)
+                                 libxl_yajl_length len)
 {
     libxl__yajl_ctx *ctx = opaque;
     char *t = NULL;
@@ -770,17 +770,13 @@
     DEBUG_GEN_ALLOC(&yajl_ctx);
 
     if (yajl_ctx.hand == NULL) {
-        yajl_parser_config cfg = {
-            .allowComments = 1,
-            .checkUTF8 = 1,
-        };
-        yajl_ctx.hand = yajl_alloc(&callbacks, &cfg, NULL, &yajl_ctx);
+        yajl_ctx.hand = libxl__yajl_alloc(&callbacks, 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);
+    status = yajl_complete_parse(yajl_ctx.hand);
     if (status != yajl_status_ok)
         goto out;
 
@@ -832,14 +828,13 @@
 char *libxl__object_to_json(libxl_ctx *ctx, const char *type,
                             libxl__gen_json_callback gen, void *p)
 {
-    yajl_gen_config conf = { 1, "    " };
     const unsigned char *buf;
     char *ret = NULL;
-    unsigned int len = 0;
+    libxl_yajl_length len = 0;
     yajl_gen_status s;
     yajl_gen hand;
 
-    hand = yajl_gen_alloc(&conf, NULL);
+    hand = libxl__yajl_gen_alloc(NULL);
     if (!hand)
         return NULL;
 
diff -r 934c14ab9f19 -r ab397bd22b56 tools/libxl/libxl_json.h
--- a/tools/libxl/libxl_json.h	Tue Jan 31 16:06:14 2012 +0000
+++ b/tools/libxl/libxl_json.h	Tue Jan 31 16:48:06 2012 +0000
@@ -16,7 +16,58 @@
 #define LIBXL_JSON_H
 
 #include <yajl/yajl_gen.h>
+#include <yajl/yajl_parse.h>
+
+#ifdef HAVE_YAJL_VERSION
+#  include <yajl/yajl_version.h>
+#endif
 
 #include <_libxl_types_json.h>
 
+/* YAJL version check */
+#if defined(YAJL_MAJOR) && (YAJL_MAJOR > 1)
+#  define HAVE_YAJL_V2 1
+#endif
+
+#ifdef HAVE_YAJL_V2
+
+typedef size_t libxl_yajl_length;
+
+static inline yajl_handle libxl__yajl_alloc(const yajl_callbacks *callbacks,
+                                            yajl_alloc_funcs *allocFuncs,
+                                            void *ctx)
+{
+    return yajl_alloc(callbacks, allocFuncs, ctx);
+}
+
+static inline yajl_gen libxl__yajl_gen_alloc(const yajl_alloc_funcs *allocFuncs)
+{
+    return yajl_gen_alloc(allocFuncs);
+}
+
+#else /* !HAVE_YAJL_V2 */
+
+#define yajl_complete_parse yajl_parse_complete
+
+typedef unsigned int libxl_yajl_length;
+
+static inline yajl_handle libxl__yajl_alloc(const yajl_callbacks *callbacks,
+                                            const yajl_alloc_funcs *allocFuncs,
+                                            void *ctx)
+{
+    yajl_parser_config cfg = {
+        .allowComments = 1,
+        .checkUTF8 = 1,
+    };
+    return yajl_alloc(callbacks, &cfg, allocFuncs, ctx);
+}
+
+static inline yajl_gen libxl__yajl_gen_alloc(const yajl_alloc_funcs *allocFuncs)
+{
+    yajl_gen_config conf = { 1, "    " };
+    return yajl_gen_alloc(&conf, allocFuncs);
+}
+
+#endif /* !HAVE_YAJL_V2 */
+
 #endif /* LIBXL_JSON_H */
diff -r 934c14ab9f19 -r ab397bd22b56 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Tue Jan 31 16:06:14 2012 +0000
+++ b/tools/libxl/libxl_qmp.c	Tue Jan 31 16:48:06 2012 +0000
@@ -454,15 +454,15 @@
                               qmp_callback_t callback, void *opaque,
                               qmp_request_context *context)
 {
-    yajl_gen_config conf = { 0, NULL };
     const unsigned char *buf = NULL;
     char *ret = NULL;
-    unsigned int len = 0;
+    libxl_yajl_length len = 0;
     yajl_gen_status s;
     yajl_gen hand;
     callback_id_pair *elm = NULL;
 
-    hand = yajl_gen_alloc(&conf, NULL);
+    hand = libxl__yajl_gen_alloc(NULL);
+
     if (!hand) {
         return NULL;
     }

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:31 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8N-0007Pv-5a; Fri, 03 Feb 2012 21:57:31 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8M-0007MO-0Q
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:30 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-182.messagelabs.com!1328306242!13586107!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13648 invoked from network); 3 Feb 2012 21:57:23 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8D-0001mP-Ml
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8B-0002mv-Uq
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:20 +0000
Message-Id: <E1RtR8B-0002mv-Uq@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: remove
	libxl_domain_create_info.poolname
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328020797 0
# Node ID e712efb526da5fc5ebf83b859ce8cb3bf849490b
# Parent  84b896135fd1b51cc4605129f1200786c795f453
libxl: remove libxl_domain_create_info.poolname

It is redundant with poolid and allowing the user to specify both
opens up the possibility of a disconnect.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: juergen.gross@ts.fujitsu.com
[since v2 - correct default is 0 not -1]
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r 84b896135fd1 -r e712efb526da tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Wed Feb 01 16:45:54 2012 +0100
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 14:39:57 2012 +0000
@@ -441,8 +441,9 @@
 
     xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/uuid", vm_path), uuid_string, strlen(uuid_string));
     xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/name", vm_path), info->name, strlen(info->name));
-    if (info->poolname)
-        xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/pool_name", vm_path), info->poolname, strlen(info->poolname));
+    if (info->poolid != -1)
+        libxl__xs_write(gc, t, libxl__sprintf(gc, "%s/pool_name", vm_path),
+                        "%s", libxl__cpupoolid_to_name(gc, info->poolid));
 
     libxl__xs_writev(gc, t, dom_path, info->xsdata);
     libxl__xs_writev(gc, t, libxl__sprintf(gc, "%s/platform", dom_path), info->platformdata);
diff -r 84b896135fd1 -r e712efb526da tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Wed Feb 01 16:45:54 2012 +0100
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 14:39:57 2012 +0000
@@ -151,7 +151,6 @@
     ("xsdata",       libxl_key_value_list),
     ("platformdata", libxl_key_value_list),
     ("poolid",       uint32),
-    ("poolname",     string),
     ])
 
 libxl_domain_build_info = Struct("domain_build_info",[
diff -r 84b896135fd1 -r e712efb526da tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Wed Feb 01 16:45:54 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 14:39:57 2012 +0000
@@ -316,7 +316,7 @@
         printf("\t(uuid <unknown>)\n");
     }
 
-    printf("\t(cpupool %s)\n", c_info->poolname);
+    printf("\t(cpupool %s)\n", libxl_cpupoolid_to_name(ctx, c_info->poolid));
     if (c_info->xsdata)
         printf("\t(xsdata contains data)\n");
     else
@@ -703,8 +703,7 @@
         c_info->poolid = -1;
         cpupool_qualifier_to_cpupoolid(buf, &c_info->poolid, NULL);
     }
-    c_info->poolname = libxl_cpupoolid_to_name(ctx, c_info->poolid);
-    if (!c_info->poolname) {
+    if (!libxl_cpupoolid_to_name(ctx, c_info->poolid)) {
         fprintf(stderr, "Illegal pool specified\n");
         exit(1);
     }

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:31 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8N-0007Pv-5a; Fri, 03 Feb 2012 21:57:31 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8M-0007MO-0Q
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:30 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-182.messagelabs.com!1328306242!13586107!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13648 invoked from network); 3 Feb 2012 21:57:23 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8D-0001mP-Ml
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8B-0002mv-Uq
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:20 +0000
Message-Id: <E1RtR8B-0002mv-Uq@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: remove
	libxl_domain_create_info.poolname
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328020797 0
# Node ID e712efb526da5fc5ebf83b859ce8cb3bf849490b
# Parent  84b896135fd1b51cc4605129f1200786c795f453
libxl: remove libxl_domain_create_info.poolname

It is redundant with poolid and allowing the user to specify both
opens up the possibility of a disconnect.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: juergen.gross@ts.fujitsu.com
[since v2 - correct default is 0 not -1]
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r 84b896135fd1 -r e712efb526da tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Wed Feb 01 16:45:54 2012 +0100
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 14:39:57 2012 +0000
@@ -441,8 +441,9 @@
 
     xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/uuid", vm_path), uuid_string, strlen(uuid_string));
     xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/name", vm_path), info->name, strlen(info->name));
-    if (info->poolname)
-        xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/pool_name", vm_path), info->poolname, strlen(info->poolname));
+    if (info->poolid != -1)
+        libxl__xs_write(gc, t, libxl__sprintf(gc, "%s/pool_name", vm_path),
+                        "%s", libxl__cpupoolid_to_name(gc, info->poolid));
 
     libxl__xs_writev(gc, t, dom_path, info->xsdata);
     libxl__xs_writev(gc, t, libxl__sprintf(gc, "%s/platform", dom_path), info->platformdata);
diff -r 84b896135fd1 -r e712efb526da tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Wed Feb 01 16:45:54 2012 +0100
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 14:39:57 2012 +0000
@@ -151,7 +151,6 @@
     ("xsdata",       libxl_key_value_list),
     ("platformdata", libxl_key_value_list),
     ("poolid",       uint32),
-    ("poolname",     string),
     ])
 
 libxl_domain_build_info = Struct("domain_build_info",[
diff -r 84b896135fd1 -r e712efb526da tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Wed Feb 01 16:45:54 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 14:39:57 2012 +0000
@@ -316,7 +316,7 @@
         printf("\t(uuid <unknown>)\n");
     }
 
-    printf("\t(cpupool %s)\n", c_info->poolname);
+    printf("\t(cpupool %s)\n", libxl_cpupoolid_to_name(ctx, c_info->poolid));
     if (c_info->xsdata)
         printf("\t(xsdata contains data)\n");
     else
@@ -703,8 +703,7 @@
         c_info->poolid = -1;
         cpupool_qualifier_to_cpupoolid(buf, &c_info->poolid, NULL);
     }
-    c_info->poolname = libxl_cpupoolid_to_name(ctx, c_info->poolid);
-    if (!c_info->poolname) {
+    if (!libxl_cpupoolid_to_name(ctx, c_info->poolid)) {
         fprintf(stderr, "Illegal pool specified\n");
         exit(1);
     }

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:34 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8Q-0007Rk-8n; Fri, 03 Feb 2012 21:57:34 +0000
Received: from mail6.bemta14.messagelabs.com ([193.109.254.103])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8O-0007Qf-Qx
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:33 +0000
Received: from [193.109.254.147:47026] by server-8.bemta-14.messagelabs.com id
	A2/F1-04706-C485C2F4; Fri, 03 Feb 2012 21:57:32 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1328306200!51337698!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16776 invoked from network); 3 Feb 2012 21:56:41 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:41 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8M-0001md-4f
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:30 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8J-0002p2-6s
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:29 +0000
Message-Id: <E1RtR8J-0002p2-6s@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:26 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: do not write/maintain
	"pool_name" in XenStore
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328020797 0
# Node ID 58a608e1a100d243352459a6a1ce95236ef832ce
# Parent  66efe32847da7e266b537747ae7f7e6156b8dc3b
libxl: do not write/maintain "pool_name" in XenStore

Nothing that I can find ever reads this key.

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


diff -r 66efe32847da -r 58a608e1a100 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Jan 31 14:39:57 2012 +0000
@@ -3702,16 +3702,6 @@
 {
     GC_INIT(ctx);
     int rc;
-    char *dom_path;
-    char *vm_path;
-    char *poolname;
-    xs_transaction_t t;
-
-    dom_path = libxl__xs_get_dompath(gc, domid);
-    if (!dom_path) {
-        GC_FREE;
-        return ERROR_FAIL;
-    }
 
     rc = xc_cpupool_movedomain(ctx->xch, poolid, domid);
     if (rc) {
@@ -3721,21 +3711,6 @@
         return ERROR_FAIL;
     }
 
-    for (;;) {
-        t = xs_transaction_start(ctx->xsh);
-
-        poolname = libxl__cpupoolid_to_name(gc, poolid);
-        vm_path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/vm", dom_path));
-        if (!vm_path)
-            break;
-
-        libxl__xs_write(gc, t, libxl__sprintf(gc, "%s/pool_name", vm_path),
-                        "%s", poolname);
-
-        if (xs_transaction_end(ctx->xsh, t, 0) || (errno != EAGAIN))
-            break;
-    }
-
     GC_FREE;
     return 0;
 }
diff -r 66efe32847da -r 58a608e1a100 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 14:39:57 2012 +0000
@@ -441,9 +441,6 @@
 
     xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/uuid", vm_path), uuid_string, strlen(uuid_string));
     xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/name", vm_path), info->name, strlen(info->name));
-    if (info->poolid != -1)
-        libxl__xs_write(gc, t, libxl__sprintf(gc, "%s/pool_name", vm_path),
-                        "%s", libxl__cpupoolid_to_name(gc, info->poolid));
 
     libxl__xs_writev(gc, t, dom_path, info->xsdata);
     libxl__xs_writev(gc, t, libxl__sprintf(gc, "%s/platform", dom_path), info->platformdata);

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:34 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8Q-0007Rk-8n; Fri, 03 Feb 2012 21:57:34 +0000
Received: from mail6.bemta14.messagelabs.com ([193.109.254.103])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8O-0007Qf-Qx
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:33 +0000
Received: from [193.109.254.147:47026] by server-8.bemta-14.messagelabs.com id
	A2/F1-04706-C485C2F4; Fri, 03 Feb 2012 21:57:32 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1328306200!51337698!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16776 invoked from network); 3 Feb 2012 21:56:41 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:41 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8M-0001md-4f
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:30 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8J-0002p2-6s
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:29 +0000
Message-Id: <E1RtR8J-0002p2-6s@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:26 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: do not write/maintain
	"pool_name" in XenStore
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328020797 0
# Node ID 58a608e1a100d243352459a6a1ce95236ef832ce
# Parent  66efe32847da7e266b537747ae7f7e6156b8dc3b
libxl: do not write/maintain "pool_name" in XenStore

Nothing that I can find ever reads this key.

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


diff -r 66efe32847da -r 58a608e1a100 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Jan 31 14:39:57 2012 +0000
@@ -3702,16 +3702,6 @@
 {
     GC_INIT(ctx);
     int rc;
-    char *dom_path;
-    char *vm_path;
-    char *poolname;
-    xs_transaction_t t;
-
-    dom_path = libxl__xs_get_dompath(gc, domid);
-    if (!dom_path) {
-        GC_FREE;
-        return ERROR_FAIL;
-    }
 
     rc = xc_cpupool_movedomain(ctx->xch, poolid, domid);
     if (rc) {
@@ -3721,21 +3711,6 @@
         return ERROR_FAIL;
     }
 
-    for (;;) {
-        t = xs_transaction_start(ctx->xsh);
-
-        poolname = libxl__cpupoolid_to_name(gc, poolid);
-        vm_path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/vm", dom_path));
-        if (!vm_path)
-            break;
-
-        libxl__xs_write(gc, t, libxl__sprintf(gc, "%s/pool_name", vm_path),
-                        "%s", poolname);
-
-        if (xs_transaction_end(ctx->xsh, t, 0) || (errno != EAGAIN))
-            break;
-    }
-
     GC_FREE;
     return 0;
 }
diff -r 66efe32847da -r 58a608e1a100 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 14:39:57 2012 +0000
@@ -441,9 +441,6 @@
 
     xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/uuid", vm_path), uuid_string, strlen(uuid_string));
     xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/name", vm_path), info->name, strlen(info->name));
-    if (info->poolid != -1)
-        libxl__xs_write(gc, t, libxl__sprintf(gc, "%s/pool_name", vm_path),
-                        "%s", libxl__cpupoolid_to_name(gc, info->poolid));
 
     libxl__xs_writev(gc, t, dom_path, info->xsdata);
     libxl__xs_writev(gc, t, libxl__sprintf(gc, "%s/platform", dom_path), info->platformdata);

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:35 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8R-0007Sc-Bj; Fri, 03 Feb 2012 21:57:35 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8P-0007Ow-UK
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:34 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-216.messagelabs.com!1328306246!12799701!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19008 invoked from network); 3 Feb 2012 21:57:27 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:27 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8I-0001mT-HT
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:26 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8F-0002nq-80
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:25 +0000
Message-Id: <E1RtR8F-0002nq-80@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: name libxl_create_cpupool
	consistent with other functions.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328020797 0
# Node ID 66efe32847da7e266b537747ae7f7e6156b8dc3b
# Parent  e712efb526da5fc5ebf83b859ce8cb3bf849490b
libxl: name libxl_create_cpupool consistent with other functions.

The pattern for the other cpupool functions is libxl_cpupool_<ACTION>
and in general we use libxl_<THING>_<ACTION>

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


diff -r e712efb526da -r 66efe32847da tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Jan 31 14:39:57 2012 +0000
@@ -3440,7 +3440,7 @@
     return 0;
 }
 
-int libxl_create_cpupool(libxl_ctx *ctx, const char *name, int schedid,
+int libxl_cpupool_create(libxl_ctx *ctx, const char *name, int schedid,
                          libxl_cpumap cpumap, libxl_uuid *uuid,
                          uint32_t *poolid)
 {
diff -r e712efb526da -r 66efe32847da tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/libxl/libxl.h	Tue Jan 31 14:39:57 2012 +0000
@@ -635,7 +635,7 @@
 int libxl_tmem_freeable(libxl_ctx *ctx);
 
 int libxl_get_freecpus(libxl_ctx *ctx, libxl_cpumap *cpumap);
-int libxl_create_cpupool(libxl_ctx *ctx, const char *name, int schedid,
+int libxl_cpupool_create(libxl_ctx *ctx, const char *name, int schedid,
                          libxl_cpumap cpumap, libxl_uuid *uuid,
                          uint32_t *poolid);
 int libxl_cpupool_destroy(libxl_ctx *ctx, uint32_t poolid);
diff -r e712efb526da -r 66efe32847da tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 14:39:57 2012 +0000
@@ -5523,7 +5523,7 @@
         return 0;
 
     poolid = 0;
-    if (libxl_create_cpupool(ctx, name, schedid, cpumap, &uuid, &poolid)) {
+    if (libxl_cpupool_create(ctx, name, schedid, cpumap, &uuid, &poolid)) {
         fprintf(stderr, "error on creating cpupool\n");
         return -ERROR_FAIL;
     }
@@ -5897,7 +5897,7 @@
         snprintf(name, 15, "Pool-node%d", node);
         libxl_uuid_generate(&uuid);
         poolid = 0;
-        ret = -libxl_create_cpupool(ctx, name, schedid, cpumap, &uuid, &poolid);
+        ret = -libxl_cpupool_create(ctx, name, schedid, cpumap, &uuid, &poolid);
         if (ret) {
             fprintf(stderr, "error on creating cpupool\n");
             goto out;

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:35 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8R-0007Sc-Bj; Fri, 03 Feb 2012 21:57:35 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8P-0007Ow-UK
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:34 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-216.messagelabs.com!1328306246!12799701!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19008 invoked from network); 3 Feb 2012 21:57:27 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:27 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8I-0001mT-HT
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:26 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8F-0002nq-80
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:25 +0000
Message-Id: <E1RtR8F-0002nq-80@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: name libxl_create_cpupool
	consistent with other functions.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328020797 0
# Node ID 66efe32847da7e266b537747ae7f7e6156b8dc3b
# Parent  e712efb526da5fc5ebf83b859ce8cb3bf849490b
libxl: name libxl_create_cpupool consistent with other functions.

The pattern for the other cpupool functions is libxl_cpupool_<ACTION>
and in general we use libxl_<THING>_<ACTION>

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


diff -r e712efb526da -r 66efe32847da tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Jan 31 14:39:57 2012 +0000
@@ -3440,7 +3440,7 @@
     return 0;
 }
 
-int libxl_create_cpupool(libxl_ctx *ctx, const char *name, int schedid,
+int libxl_cpupool_create(libxl_ctx *ctx, const char *name, int schedid,
                          libxl_cpumap cpumap, libxl_uuid *uuid,
                          uint32_t *poolid)
 {
diff -r e712efb526da -r 66efe32847da tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/libxl/libxl.h	Tue Jan 31 14:39:57 2012 +0000
@@ -635,7 +635,7 @@
 int libxl_tmem_freeable(libxl_ctx *ctx);
 
 int libxl_get_freecpus(libxl_ctx *ctx, libxl_cpumap *cpumap);
-int libxl_create_cpupool(libxl_ctx *ctx, const char *name, int schedid,
+int libxl_cpupool_create(libxl_ctx *ctx, const char *name, int schedid,
                          libxl_cpumap cpumap, libxl_uuid *uuid,
                          uint32_t *poolid);
 int libxl_cpupool_destroy(libxl_ctx *ctx, uint32_t poolid);
diff -r e712efb526da -r 66efe32847da tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 14:39:57 2012 +0000
@@ -5523,7 +5523,7 @@
         return 0;
 
     poolid = 0;
-    if (libxl_create_cpupool(ctx, name, schedid, cpumap, &uuid, &poolid)) {
+    if (libxl_cpupool_create(ctx, name, schedid, cpumap, &uuid, &poolid)) {
         fprintf(stderr, "error on creating cpupool\n");
         return -ERROR_FAIL;
     }
@@ -5897,7 +5897,7 @@
         snprintf(name, 15, "Pool-node%d", node);
         libxl_uuid_generate(&uuid);
         poolid = 0;
-        ret = -libxl_create_cpupool(ctx, name, schedid, cpumap, &uuid, &poolid);
+        ret = -libxl_cpupool_create(ctx, name, schedid, cpumap, &uuid, &poolid);
         if (ret) {
             fprintf(stderr, "error on creating cpupool\n");
             goto out;

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:43 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8Z-0007Wp-FW; Fri, 03 Feb 2012 21:57:43 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8X-0007TE-FS
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:41 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-216.messagelabs.com!1328306253!13877599!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6060 invoked from network); 3 Feb 2012 21:57:34 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:34 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8P-0001mi-CD
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:33 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8M-0002q7-Ks
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:32 +0000
Message-Id: <E1RtR8M-0002q7-Ks@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:30 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: remove comment support from
	IDL
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328020797 0
# Node ID 996c95a3e7e01f85186e5ac02e3070bc442ff580
# Parent  58a608e1a100d243352459a6a1ce95236ef832ce
libxl: remove comment support from IDL

People typically don't look for comments in generated source and the syntax for
specifying them in the IDL makes things harder to follow.

Instead just use source code comments in the IDL itself.

I dropped a bunch of "foo bool # enable or disable foo" type comments. A lot of
the remainder still aren't terribly useful though.

No change to the generate code other than the comments being removed.

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


diff -r 58a608e1a100 -r 996c95a3e7e0 tools/libxl/gentypes.py
--- a/tools/libxl/gentypes.py	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/libxl/gentypes.py	Tue Jan 31 14:39:57 2012 +0000
@@ -5,19 +5,6 @@
 
 import libxltypes
 
-def format_comment(level, comment):
-    indent = reduce(lambda x,y: x + " ", range(level), "")
-    s  = "%s/*\n" % indent
-    s += "%s * " % indent
-    comment = comment.replace("\n", "\n%s * " % indent)
-    x = re.compile(r'^%s \* $' % indent, re.MULTILINE)
-    comment = x.sub("%s *" % indent, comment)
-    s += comment
-    s += "\n"
-    s += "%s */" % indent
-    s += "\n"
-    return s
-
 def libxl_C_instance_of(ty, instancename):
     if isinstance(ty, libxltypes.Aggregate) and ty.typename is None:
         if instancename is None:
@@ -30,17 +17,12 @@
 def libxl_C_type_define(ty, indent = ""):
     s = ""
     if isinstance(ty, libxltypes.Enumeration):
-        if ty.comment is not None:
-            s += format_comment(0, ty.comment)
-
         if ty.typename is None:
             s += "enum {\n"
         else:
             s += "typedef enum %s {\n" % ty.typename
 
         for v in ty.values:
-            if v.comment is not None:
-                s += format_comment(4, v.comment)
             x = "%s = %d" % (v.name, v.value)
             x = x.replace("\n", "\n    ")
             s += "    " + x + ",\n"
@@ -50,17 +32,12 @@
             s += "} %s" % ty.typename
 
     elif isinstance(ty, libxltypes.Aggregate):
-        if ty.comment is not None:
-            s += format_comment(0, ty.comment)
-
         if ty.typename is None:
             s += "%s {\n" % ty.kind
         else:
             s += "typedef %s %s {\n" % (ty.kind, ty.typename)
 
         for f in ty.fields:
-            if f.comment is not None:
-                s += format_comment(4, f.comment)
             x = libxl_C_instance_of(f.type, f.name)
             if f.const:
                 x = "const " + x
diff -r 58a608e1a100 -r 996c95a3e7e0 tools/libxl/idl.txt
--- a/tools/libxl/idl.txt	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/libxl/idl.txt	Tue Jan 31 14:39:57 2012 +0000
@@ -20,10 +20,6 @@
 apply to all types. The properties are set by passing a named
 parameter to the constructor.
 
-Type.comment:
-
-  A free text comment which describes the type.
-
 Type.namespace: (default: "libxl_")
 
  The namespace in which the type resides. Usually this is "libxl_" but
@@ -98,7 +94,6 @@
 				    name of the containing Enumeration
 				    and any namespace (e.g. "VALUE")
     EnumerationValue.value	The integer value associated with this name.
-    EnumerationValue.comment	A free text comment which describes the member.
 
 libxltype.Aggregate
 
@@ -115,7 +110,6 @@
   Field.name    The name of the member (can be None for anonymous
 		fields).
   Field.const	Boolean, true if the member is const.
-  Field.comment	A free text comment which describes the member.
 
 libxltype.Struct
 
diff -r 58a608e1a100 -r 996c95a3e7e0 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 14:39:57 2012 +0000
@@ -28,8 +28,8 @@
     ])
 
 libxl_device_model_version = Enumeration("device_model_version", [
-    (1, "QEMU_XEN_TRADITIONAL", "Historical qemu-xen device model (qemu-dm)"),
-    (2, "QEMU_XEN", "Upstream based qemu-xen device model"),
+    (1, "QEMU_XEN_TRADITIONAL"), # Historical qemu-xen device model (qemu-dm)
+    (2, "QEMU_XEN"),             # Upstream based qemu-xen device model
     ])
 
 libxl_console_type = Enumeration("console_type", [
@@ -93,18 +93,18 @@
 libxl_dominfo = Struct("dominfo",[
     ("uuid",        libxl_uuid),
     ("domid",       libxl_domid),
-    ("ssidref",      uint32),
+    ("ssidref",     uint32),
     ("running",     bool),
     ("blocked",     bool),
     ("paused",      bool),
     ("shutdown",    bool),
     ("dying",       bool),
 
-    ("shutdown_reason", uint8, False,
-"""Valid SHUTDOWN_* value from xen/sched.h iff (shutdown||dying).
-
-Otherwise set to a value guaranteed not to clash with any valid
-SHUTDOWN_* constant."""),
+    # Valid SHUTDOWN_* value from xen/sched.h iff (shutdown||dying).
+    #
+    # Otherwise set to a value guaranteed not to clash with any valid
+    # SHUTDOWN_* constant.
+    ("shutdown_reason", uint8),
     ("current_memkb",   uint64),
     ("shared_memkb", uint64),
     ("max_memkb",   uint64),
@@ -153,6 +153,11 @@
     ("poolid",       uint32),
     ])
 
+# Instances of libxl_file_reference contained in this struct which
+# have been mapped (with libxl_file_reference_map) will be unmapped
+# by libxl_domain_build/restore. If either of these are never called
+# then the user is responsible for calling
+# libxl_file_reference_unmap.
 libxl_domain_build_info = Struct("domain_build_info",[
     ("max_vcpus",       integer),
     ("cur_vcpus",       integer),
@@ -188,84 +193,87 @@
                                       ("cmdline", string),
                                       ("ramdisk", libxl_file_reference),
                                       ("features", string, True),
-                                      ("e820_host", bool, False, "Use host's E820 for PCI passthrough."),
+                                      # Use host's E820 for PCI passthrough.
+                                      ("e820_host", bool),
                                       ])),
                  ])),
     ],
-    comment =
-"""Instances of libxl_file_reference contained in this struct which
-have been mapped (with libxl_file_reference_map) will be unmapped
-by libxl_domain_build/restore. If either of these are never called
-then the user is responsible for calling
-libxl_file_reference_unmap.""")
+)
 
+# Device Model Information
 libxl_device_model_info = Struct("device_model_info",[
     ("domid",            libxl_domid),
-    ("uuid",             libxl_uuid,  False, "this is use only with stubdom, and must be different from the domain uuid"),
+    
+    # uuid is used only with stubdom, and must be different from the
+    # domain uuid
+    ("uuid",             libxl_uuid),
     ("dom_name",         string),
     ("device_model_version", libxl_device_model_version),
     ("device_model_stubdomain", bool),
-    ("device_model",     string, False, "if you set this you must set device_model_version too"),
+    # you set device_model you must set device_model_version too
+    ("device_model",     string),
     ("saved_state",      string),
     ("type",             libxl_domain_type),
     ("target_ram",       uint32),
-    ("videoram",         integer,           False, "size of the videoram in MB"),
-    ("stdvga",           bool,              False, "stdvga enabled or disabled"),
-    ("vnc",              bool,              False, "vnc enabled or disabled"),
-    ("vnclisten",        string,            False, "address:port that should be listened on for the VNC server if vnc is set"),
-    ("vncpasswd",        string,            False, "the VNC password"),
-    ("vncdisplay",       integer,           False, "set VNC display number"),
-    ("vncunused",        bool,              False, "try to find an unused port for the VNC server"),
-    ("keymap",           string,            False, "set keyboard layout, default is en-us keyboard"),
-    ("sdl",              bool,              False, "sdl enabled or disabled"),
-    ("opengl",           bool,              False, "opengl enabled or disabled (if enabled requires sdl enabled)"),
-    ("spice",            bool,              False,
-    "spice enabled or disabled"),
-    ("spiceport",        integer,           False,
-    "the port that should be listened on for the spice server"),
-    ("spicetls_port",    integer,           False, """the tls port
-that should be listened on for the spice server,
-at least one of the port or tls port must be given"""),
-    ("spicehost",        string,            False, """the interface
-that should be listened on if given otherwise any interface"""),
-    ("spicedisable_ticketing", bool,        False,
-    "enable client connection with no password"),
-    ("spicepasswd",      string,            False, """set ticket password
-witch must be used by a client for connection.
-The password never expires"""),
-    ("spiceagent_mouse", bool,              False,
-    "Whether spice agent is used for client mouse mode(default is on)"),
-    ("nographic",        bool,              False, "no graphics, use serial port"),
-    ("gfx_passthru",     bool,              False, "graphics passthrough enabled or disabled"),
-    ("serial",           string,            False, "serial port re-direct to pty deivce"),
-    ("boot",             string,            False, "boot order, for example dca"),
-    ("usb",              bool,              False, "usb support enabled or disabled"),
-    ("usbdevice",        string,            False, "enable usb mouse: tablet for absolute mouse, mouse for PS/2 protocol relative mouse"),
-    ("soundhw",          string,            False, "enable sound hardware"),
-    ("acpi",             bool,              False, "acpi enabled or disabled"),
-    ("vcpus",            integer,           False, "max number of vcpus"),
-    ("vcpu_avail",       integer,           False, "vcpus actually available"),
-    ("xen_platform_pci", bool,              False, "enable/disable the xen platform pci device"),
-    ("extra",            libxl_string_list, False, "extra parameters pass directly to qemu, NULL terminated"),
-    ("extra_pv",         libxl_string_list, False, "extra parameters pass directly to qemu for PV guest, NULL terminated"),
-    ("extra_hvm",        libxl_string_list, False, "extra parameters pass directly to qemu for HVM guest, NULL terminated"),
+    # size of the videoram in MB
+    ("videoram",         integer), 
+    ("stdvga",           bool),
+    ("vnc",              bool),
+    # "address:port" that should be listened on for the VNC server
+    ("vnclisten",        string),
+    ("vncpasswd",        string),
+    # VNC display number
+    ("vncdisplay",       integer),
+    # If set then try to find an unused port for the VNC server
+    ("vncunused",        bool),
+    # keyboard layout, default is en-us keyboard
+    ("keymap",           string),
+    ("sdl",              bool),
+    ("opengl",           bool), # (requires sdl enabled)
+    ("spice",            bool),
+    # At least one of spice port or spicetls_post must be given
+    ("spiceport",        integer),
+    ("spicetls_port",    integer),
+    # Interface to bind to
+    ("spicehost",        string),
+    # enable client connection with no password
+    ("spicedisable_ticketing", bool),
+    ("spicepasswd",      string),
+    ("spiceagent_mouse", bool),
+    ("nographic",        bool),
+    ("gfx_passthru",     bool),
+    ("serial",           string),
+    ("boot",             string),
+    ("usb",              bool),
+    # usbdevice: "tablet" for absolute mouse, "mouse" for PS/2 protocol relative mouse
+    ("usbdevice",        string),
+    ("soundhw",          string),
+    ("acpi",             bool),
+    ("vcpus",            integer), # max number of vcpus
+    ("vcpu_avail",       integer), # vcpus actually available
+    ("xen_platform_pci", bool),
+    # extra parameters pass directly to qemu, NULL terminated
+    ("extra",            libxl_string_list),
+    # extra parameters pass directly to qemu for PV guest, NULL terminated
+    ("extra_pv",         libxl_string_list),
+    # extra parameters pass directly to qemu for HVM guest, NULL terminated
+    ("extra_hvm",        libxl_string_list),
     ],
-    comment=
-"""Device Model information.
-
-Network is missing""")
+)
 
 libxl_device_vfb = Struct("device_vfb", [
     ("backend_domid", libxl_domid),
     ("devid",         integer),
-    ("vnc",           bool,     False, "vnc enabled or disabled"),
-    ("vnclisten",     string,   False, "address:port that should be listened on for the VNC server if vnc is set"),
-    ("vncpasswd",     string,   False, "the VNC password"),
-    ("vncdisplay",    integer,  False, "set VNC display number"),
-    ("vncunused",     bool,     False, "try to find an unused port for the VNC server"),
-    ("keymap",        string,   False, "set keyboard layout, default is en-us keyboard"),
-    ("sdl",           bool,     False, "sdl enabled or disabled"),
-    ("opengl",        bool,     False, "opengl enabled or disabled (if enabled requires sdl enabled)"),
+    ("vnc",           bool),
+    # address:port that should be listened on for the VNC server if vnc is set
+    ("vnclisten",     string),
+    ("vncpasswd",     string),
+    ("vncdisplay",    integer),
+    ("vncunused",     bool),
+    # set keyboard layout, default is en-us keyboard
+    ("keymap",        string),
+    ("sdl",           bool),
+    ("opengl",        bool), # (if enabled requires sdl enabled)
     ("display",       string),
     ("xauthority",    string),
     ])
@@ -342,13 +350,13 @@
     ])
 
 libxl_vcpuinfo = Struct("vcpuinfo", [
-    ("vcpuid", uint32,              False, "vcpu's id"),
-    ("cpu", uint32,                 False, "current mapping"),
-    ("online", bool,                False, "currently online (not hotplugged)?"),
-    ("blocked", bool,               False, "blocked waiting for an event?"),
-    ("running", bool,               False, "currently scheduled on its CPU?"),
-    ("vcpu_time", uint64,           False, "total vcpu time ran (ns)"),
-    ("cpumap", libxl_cpumap,        False, "current cpu's affinities"),
+    ("vcpuid", uint32),
+    ("cpu", uint32),
+    ("online", bool),
+    ("blocked", bool),
+    ("running", bool),
+    ("vcpu_time", uint64), # total vcpu time ran (ns)
+    ("cpumap", libxl_cpumap), # current cpu's affinities
     ])
 
 libxl_physinfo = Struct("physinfo", [
@@ -371,9 +379,9 @@
     ], dispose_fn=None, dir=DIR_OUT)
 
 libxl_topologyinfo = Struct("topologyinfo", [
-    ("coremap", libxl_cpuarray,   False, "cpu to core map"),
-    ("socketmap", libxl_cpuarray, False, "cpu to socket map"),
-    ("nodemap", libxl_cpuarray,   False, "cpu to node map"),
+    ("coremap", libxl_cpuarray),   # cpu to core map
+    ("socketmap", libxl_cpuarray), # cpu to socket map
+    ("nodemap", libxl_cpuarray),   # cpu to node map
     ])
 
 libxl_sched_credit = Struct("sched_credit", [
diff -r 58a608e1a100 -r 996c95a3e7e0 tools/libxl/libxltypes.py
--- a/tools/libxl/libxltypes.py	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/libxl/libxltypes.py	Tue Jan 31 14:39:57 2012 +0000
@@ -22,7 +22,6 @@
 
 class Type(object):
     def __init__(self, typename, **kwargs):
-        self.comment = kwargs.setdefault('comment', None)
         self.namespace = kwargs.setdefault('namespace',
                 _get_default_namespace())
         self.dir = kwargs.setdefault('dir', DIR_BOTH)
@@ -120,7 +119,6 @@
         self.rawname = str.upper(enum.rawname) + "_" + self.valuename
         self.name = str.upper(enum.namespace) + self.rawname
         self.value = value
-        self.comment = kwargs.setdefault("comment", None)
 
 class Enumeration(Type):
     def __init__(self, typename, values, **kwargs):
@@ -129,16 +127,9 @@
 
         self.values = []
         for v in values:
-            # (value, name[, comment=None])
-            if len(v) == 2:
-                (num,name) = v
-                comment = None
-            elif len(v) == 3:
-                num,name,comment = v
-            else:
-                raise ""
+            # (value, name)
+            (num,name) = v
             self.values.append(EnumerationValue(self, num, name,
-                                                comment=comment,
                                                 typename=self.rawname))
     def lookup(self, name):
         for v in self.values:
@@ -152,7 +143,6 @@
         self.type = type
         self.name = name
         self.const = kwargs.setdefault('const', False)
-        self.comment = kwargs.setdefault('comment', None)
         self.enumname = kwargs.setdefault('enumname', None)
 
 class Aggregate(Type):
@@ -164,19 +154,17 @@
 
         self.fields = []
         for f in fields:
-            # (name, type[, const=False[, comment=None]])
+            # (name, type[, const=False])
             if len(f) == 2:
                 n,t = f
                 const = False
-                comment = None
             elif len(f) == 3:
                 n,t,const = f
-                comment = None
             else:
-                n,t,const,comment = f
+                raise ValueError
             if n is None:
                 raise ValueError
-            self.fields.append(Field(t,n,const=const,comment=comment))
+            self.fields.append(Field(t,n,const=const))
 
     # Returns a tuple (stem, field-expr)
     #

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:43 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8Z-0007Wp-FW; Fri, 03 Feb 2012 21:57:43 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8X-0007TE-FS
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:41 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-216.messagelabs.com!1328306253!13877599!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6060 invoked from network); 3 Feb 2012 21:57:34 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:34 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8P-0001mi-CD
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:33 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8M-0002q7-Ks
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:32 +0000
Message-Id: <E1RtR8M-0002q7-Ks@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:30 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: remove comment support from
	IDL
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328020797 0
# Node ID 996c95a3e7e01f85186e5ac02e3070bc442ff580
# Parent  58a608e1a100d243352459a6a1ce95236ef832ce
libxl: remove comment support from IDL

People typically don't look for comments in generated source and the syntax for
specifying them in the IDL makes things harder to follow.

Instead just use source code comments in the IDL itself.

I dropped a bunch of "foo bool # enable or disable foo" type comments. A lot of
the remainder still aren't terribly useful though.

No change to the generate code other than the comments being removed.

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


diff -r 58a608e1a100 -r 996c95a3e7e0 tools/libxl/gentypes.py
--- a/tools/libxl/gentypes.py	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/libxl/gentypes.py	Tue Jan 31 14:39:57 2012 +0000
@@ -5,19 +5,6 @@
 
 import libxltypes
 
-def format_comment(level, comment):
-    indent = reduce(lambda x,y: x + " ", range(level), "")
-    s  = "%s/*\n" % indent
-    s += "%s * " % indent
-    comment = comment.replace("\n", "\n%s * " % indent)
-    x = re.compile(r'^%s \* $' % indent, re.MULTILINE)
-    comment = x.sub("%s *" % indent, comment)
-    s += comment
-    s += "\n"
-    s += "%s */" % indent
-    s += "\n"
-    return s
-
 def libxl_C_instance_of(ty, instancename):
     if isinstance(ty, libxltypes.Aggregate) and ty.typename is None:
         if instancename is None:
@@ -30,17 +17,12 @@
 def libxl_C_type_define(ty, indent = ""):
     s = ""
     if isinstance(ty, libxltypes.Enumeration):
-        if ty.comment is not None:
-            s += format_comment(0, ty.comment)
-
         if ty.typename is None:
             s += "enum {\n"
         else:
             s += "typedef enum %s {\n" % ty.typename
 
         for v in ty.values:
-            if v.comment is not None:
-                s += format_comment(4, v.comment)
             x = "%s = %d" % (v.name, v.value)
             x = x.replace("\n", "\n    ")
             s += "    " + x + ",\n"
@@ -50,17 +32,12 @@
             s += "} %s" % ty.typename
 
     elif isinstance(ty, libxltypes.Aggregate):
-        if ty.comment is not None:
-            s += format_comment(0, ty.comment)
-
         if ty.typename is None:
             s += "%s {\n" % ty.kind
         else:
             s += "typedef %s %s {\n" % (ty.kind, ty.typename)
 
         for f in ty.fields:
-            if f.comment is not None:
-                s += format_comment(4, f.comment)
             x = libxl_C_instance_of(f.type, f.name)
             if f.const:
                 x = "const " + x
diff -r 58a608e1a100 -r 996c95a3e7e0 tools/libxl/idl.txt
--- a/tools/libxl/idl.txt	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/libxl/idl.txt	Tue Jan 31 14:39:57 2012 +0000
@@ -20,10 +20,6 @@
 apply to all types. The properties are set by passing a named
 parameter to the constructor.
 
-Type.comment:
-
-  A free text comment which describes the type.
-
 Type.namespace: (default: "libxl_")
 
  The namespace in which the type resides. Usually this is "libxl_" but
@@ -98,7 +94,6 @@
 				    name of the containing Enumeration
 				    and any namespace (e.g. "VALUE")
     EnumerationValue.value	The integer value associated with this name.
-    EnumerationValue.comment	A free text comment which describes the member.
 
 libxltype.Aggregate
 
@@ -115,7 +110,6 @@
   Field.name    The name of the member (can be None for anonymous
 		fields).
   Field.const	Boolean, true if the member is const.
-  Field.comment	A free text comment which describes the member.
 
 libxltype.Struct
 
diff -r 58a608e1a100 -r 996c95a3e7e0 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 14:39:57 2012 +0000
@@ -28,8 +28,8 @@
     ])
 
 libxl_device_model_version = Enumeration("device_model_version", [
-    (1, "QEMU_XEN_TRADITIONAL", "Historical qemu-xen device model (qemu-dm)"),
-    (2, "QEMU_XEN", "Upstream based qemu-xen device model"),
+    (1, "QEMU_XEN_TRADITIONAL"), # Historical qemu-xen device model (qemu-dm)
+    (2, "QEMU_XEN"),             # Upstream based qemu-xen device model
     ])
 
 libxl_console_type = Enumeration("console_type", [
@@ -93,18 +93,18 @@
 libxl_dominfo = Struct("dominfo",[
     ("uuid",        libxl_uuid),
     ("domid",       libxl_domid),
-    ("ssidref",      uint32),
+    ("ssidref",     uint32),
     ("running",     bool),
     ("blocked",     bool),
     ("paused",      bool),
     ("shutdown",    bool),
     ("dying",       bool),
 
-    ("shutdown_reason", uint8, False,
-"""Valid SHUTDOWN_* value from xen/sched.h iff (shutdown||dying).
-
-Otherwise set to a value guaranteed not to clash with any valid
-SHUTDOWN_* constant."""),
+    # Valid SHUTDOWN_* value from xen/sched.h iff (shutdown||dying).
+    #
+    # Otherwise set to a value guaranteed not to clash with any valid
+    # SHUTDOWN_* constant.
+    ("shutdown_reason", uint8),
     ("current_memkb",   uint64),
     ("shared_memkb", uint64),
     ("max_memkb",   uint64),
@@ -153,6 +153,11 @@
     ("poolid",       uint32),
     ])
 
+# Instances of libxl_file_reference contained in this struct which
+# have been mapped (with libxl_file_reference_map) will be unmapped
+# by libxl_domain_build/restore. If either of these are never called
+# then the user is responsible for calling
+# libxl_file_reference_unmap.
 libxl_domain_build_info = Struct("domain_build_info",[
     ("max_vcpus",       integer),
     ("cur_vcpus",       integer),
@@ -188,84 +193,87 @@
                                       ("cmdline", string),
                                       ("ramdisk", libxl_file_reference),
                                       ("features", string, True),
-                                      ("e820_host", bool, False, "Use host's E820 for PCI passthrough."),
+                                      # Use host's E820 for PCI passthrough.
+                                      ("e820_host", bool),
                                       ])),
                  ])),
     ],
-    comment =
-"""Instances of libxl_file_reference contained in this struct which
-have been mapped (with libxl_file_reference_map) will be unmapped
-by libxl_domain_build/restore. If either of these are never called
-then the user is responsible for calling
-libxl_file_reference_unmap.""")
+)
 
+# Device Model Information
 libxl_device_model_info = Struct("device_model_info",[
     ("domid",            libxl_domid),
-    ("uuid",             libxl_uuid,  False, "this is use only with stubdom, and must be different from the domain uuid"),
+    
+    # uuid is used only with stubdom, and must be different from the
+    # domain uuid
+    ("uuid",             libxl_uuid),
     ("dom_name",         string),
     ("device_model_version", libxl_device_model_version),
     ("device_model_stubdomain", bool),
-    ("device_model",     string, False, "if you set this you must set device_model_version too"),
+    # you set device_model you must set device_model_version too
+    ("device_model",     string),
     ("saved_state",      string),
     ("type",             libxl_domain_type),
     ("target_ram",       uint32),
-    ("videoram",         integer,           False, "size of the videoram in MB"),
-    ("stdvga",           bool,              False, "stdvga enabled or disabled"),
-    ("vnc",              bool,              False, "vnc enabled or disabled"),
-    ("vnclisten",        string,            False, "address:port that should be listened on for the VNC server if vnc is set"),
-    ("vncpasswd",        string,            False, "the VNC password"),
-    ("vncdisplay",       integer,           False, "set VNC display number"),
-    ("vncunused",        bool,              False, "try to find an unused port for the VNC server"),
-    ("keymap",           string,            False, "set keyboard layout, default is en-us keyboard"),
-    ("sdl",              bool,              False, "sdl enabled or disabled"),
-    ("opengl",           bool,              False, "opengl enabled or disabled (if enabled requires sdl enabled)"),
-    ("spice",            bool,              False,
-    "spice enabled or disabled"),
-    ("spiceport",        integer,           False,
-    "the port that should be listened on for the spice server"),
-    ("spicetls_port",    integer,           False, """the tls port
-that should be listened on for the spice server,
-at least one of the port or tls port must be given"""),
-    ("spicehost",        string,            False, """the interface
-that should be listened on if given otherwise any interface"""),
-    ("spicedisable_ticketing", bool,        False,
-    "enable client connection with no password"),
-    ("spicepasswd",      string,            False, """set ticket password
-witch must be used by a client for connection.
-The password never expires"""),
-    ("spiceagent_mouse", bool,              False,
-    "Whether spice agent is used for client mouse mode(default is on)"),
-    ("nographic",        bool,              False, "no graphics, use serial port"),
-    ("gfx_passthru",     bool,              False, "graphics passthrough enabled or disabled"),
-    ("serial",           string,            False, "serial port re-direct to pty deivce"),
-    ("boot",             string,            False, "boot order, for example dca"),
-    ("usb",              bool,              False, "usb support enabled or disabled"),
-    ("usbdevice",        string,            False, "enable usb mouse: tablet for absolute mouse, mouse for PS/2 protocol relative mouse"),
-    ("soundhw",          string,            False, "enable sound hardware"),
-    ("acpi",             bool,              False, "acpi enabled or disabled"),
-    ("vcpus",            integer,           False, "max number of vcpus"),
-    ("vcpu_avail",       integer,           False, "vcpus actually available"),
-    ("xen_platform_pci", bool,              False, "enable/disable the xen platform pci device"),
-    ("extra",            libxl_string_list, False, "extra parameters pass directly to qemu, NULL terminated"),
-    ("extra_pv",         libxl_string_list, False, "extra parameters pass directly to qemu for PV guest, NULL terminated"),
-    ("extra_hvm",        libxl_string_list, False, "extra parameters pass directly to qemu for HVM guest, NULL terminated"),
+    # size of the videoram in MB
+    ("videoram",         integer), 
+    ("stdvga",           bool),
+    ("vnc",              bool),
+    # "address:port" that should be listened on for the VNC server
+    ("vnclisten",        string),
+    ("vncpasswd",        string),
+    # VNC display number
+    ("vncdisplay",       integer),
+    # If set then try to find an unused port for the VNC server
+    ("vncunused",        bool),
+    # keyboard layout, default is en-us keyboard
+    ("keymap",           string),
+    ("sdl",              bool),
+    ("opengl",           bool), # (requires sdl enabled)
+    ("spice",            bool),
+    # At least one of spice port or spicetls_post must be given
+    ("spiceport",        integer),
+    ("spicetls_port",    integer),
+    # Interface to bind to
+    ("spicehost",        string),
+    # enable client connection with no password
+    ("spicedisable_ticketing", bool),
+    ("spicepasswd",      string),
+    ("spiceagent_mouse", bool),
+    ("nographic",        bool),
+    ("gfx_passthru",     bool),
+    ("serial",           string),
+    ("boot",             string),
+    ("usb",              bool),
+    # usbdevice: "tablet" for absolute mouse, "mouse" for PS/2 protocol relative mouse
+    ("usbdevice",        string),
+    ("soundhw",          string),
+    ("acpi",             bool),
+    ("vcpus",            integer), # max number of vcpus
+    ("vcpu_avail",       integer), # vcpus actually available
+    ("xen_platform_pci", bool),
+    # extra parameters pass directly to qemu, NULL terminated
+    ("extra",            libxl_string_list),
+    # extra parameters pass directly to qemu for PV guest, NULL terminated
+    ("extra_pv",         libxl_string_list),
+    # extra parameters pass directly to qemu for HVM guest, NULL terminated
+    ("extra_hvm",        libxl_string_list),
     ],
-    comment=
-"""Device Model information.
-
-Network is missing""")
+)
 
 libxl_device_vfb = Struct("device_vfb", [
     ("backend_domid", libxl_domid),
     ("devid",         integer),
-    ("vnc",           bool,     False, "vnc enabled or disabled"),
-    ("vnclisten",     string,   False, "address:port that should be listened on for the VNC server if vnc is set"),
-    ("vncpasswd",     string,   False, "the VNC password"),
-    ("vncdisplay",    integer,  False, "set VNC display number"),
-    ("vncunused",     bool,     False, "try to find an unused port for the VNC server"),
-    ("keymap",        string,   False, "set keyboard layout, default is en-us keyboard"),
-    ("sdl",           bool,     False, "sdl enabled or disabled"),
-    ("opengl",        bool,     False, "opengl enabled or disabled (if enabled requires sdl enabled)"),
+    ("vnc",           bool),
+    # address:port that should be listened on for the VNC server if vnc is set
+    ("vnclisten",     string),
+    ("vncpasswd",     string),
+    ("vncdisplay",    integer),
+    ("vncunused",     bool),
+    # set keyboard layout, default is en-us keyboard
+    ("keymap",        string),
+    ("sdl",           bool),
+    ("opengl",        bool), # (if enabled requires sdl enabled)
     ("display",       string),
     ("xauthority",    string),
     ])
@@ -342,13 +350,13 @@
     ])
 
 libxl_vcpuinfo = Struct("vcpuinfo", [
-    ("vcpuid", uint32,              False, "vcpu's id"),
-    ("cpu", uint32,                 False, "current mapping"),
-    ("online", bool,                False, "currently online (not hotplugged)?"),
-    ("blocked", bool,               False, "blocked waiting for an event?"),
-    ("running", bool,               False, "currently scheduled on its CPU?"),
-    ("vcpu_time", uint64,           False, "total vcpu time ran (ns)"),
-    ("cpumap", libxl_cpumap,        False, "current cpu's affinities"),
+    ("vcpuid", uint32),
+    ("cpu", uint32),
+    ("online", bool),
+    ("blocked", bool),
+    ("running", bool),
+    ("vcpu_time", uint64), # total vcpu time ran (ns)
+    ("cpumap", libxl_cpumap), # current cpu's affinities
     ])
 
 libxl_physinfo = Struct("physinfo", [
@@ -371,9 +379,9 @@
     ], dispose_fn=None, dir=DIR_OUT)
 
 libxl_topologyinfo = Struct("topologyinfo", [
-    ("coremap", libxl_cpuarray,   False, "cpu to core map"),
-    ("socketmap", libxl_cpuarray, False, "cpu to socket map"),
-    ("nodemap", libxl_cpuarray,   False, "cpu to node map"),
+    ("coremap", libxl_cpuarray),   # cpu to core map
+    ("socketmap", libxl_cpuarray), # cpu to socket map
+    ("nodemap", libxl_cpuarray),   # cpu to node map
     ])
 
 libxl_sched_credit = Struct("sched_credit", [
diff -r 58a608e1a100 -r 996c95a3e7e0 tools/libxl/libxltypes.py
--- a/tools/libxl/libxltypes.py	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/libxl/libxltypes.py	Tue Jan 31 14:39:57 2012 +0000
@@ -22,7 +22,6 @@
 
 class Type(object):
     def __init__(self, typename, **kwargs):
-        self.comment = kwargs.setdefault('comment', None)
         self.namespace = kwargs.setdefault('namespace',
                 _get_default_namespace())
         self.dir = kwargs.setdefault('dir', DIR_BOTH)
@@ -120,7 +119,6 @@
         self.rawname = str.upper(enum.rawname) + "_" + self.valuename
         self.name = str.upper(enum.namespace) + self.rawname
         self.value = value
-        self.comment = kwargs.setdefault("comment", None)
 
 class Enumeration(Type):
     def __init__(self, typename, values, **kwargs):
@@ -129,16 +127,9 @@
 
         self.values = []
         for v in values:
-            # (value, name[, comment=None])
-            if len(v) == 2:
-                (num,name) = v
-                comment = None
-            elif len(v) == 3:
-                num,name,comment = v
-            else:
-                raise ""
+            # (value, name)
+            (num,name) = v
             self.values.append(EnumerationValue(self, num, name,
-                                                comment=comment,
                                                 typename=self.rawname))
     def lookup(self, name):
         for v in self.values:
@@ -152,7 +143,6 @@
         self.type = type
         self.name = name
         self.const = kwargs.setdefault('const', False)
-        self.comment = kwargs.setdefault('comment', None)
         self.enumname = kwargs.setdefault('enumname', None)
 
 class Aggregate(Type):
@@ -164,19 +154,17 @@
 
         self.fields = []
         for f in fields:
-            # (name, type[, const=False[, comment=None]])
+            # (name, type[, const=False])
             if len(f) == 2:
                 n,t = f
                 const = False
-                comment = None
             elif len(f) == 3:
                 n,t,const = f
-                comment = None
             else:
-                n,t,const,comment = f
+                raise ValueError
             if n is None:
                 raise ValueError
-            self.fields.append(Field(t,n,const=const,comment=comment))
+            self.fields.append(Field(t,n,const=const))
 
     # Returns a tuple (stem, field-expr)
     #

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:44 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8a-0007Xg-Kz; Fri, 03 Feb 2012 21:57:44 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8Y-0007UI-UG
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:43 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-216.messagelabs.com!1328306255!12855327!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10680 invoked from network); 3 Feb 2012 21:57:36 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:36 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8R-0001mo-Lq
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:35 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8Q-0002rK-NP
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:35 +0000
Message-Id: <E1RtR8Q-0002rK-NP@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:33 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: use keyword arguments for
	field definitions in aggregate types.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328020797 0
# Node ID 1a93393b700209a5863a49961eb802e6796dd661
# Parent  996c95a3e7e01f85186e5ac02e3070bc442ff580
libxl: use keyword arguments for field definitions in aggregate types.

The original code is not so bad now that the comments are gone but this is
still a bit cleaner.

No change in the generated code.

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


diff -r 996c95a3e7e0 -r 1a93393b7002 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 14:39:57 2012 +0000
@@ -192,7 +192,7 @@
                                       ("bootloader_args", libxl_string_list),
                                       ("cmdline", string),
                                       ("ramdisk", libxl_file_reference),
-                                      ("features", string, True),
+                                      ("features", string, {'const': True}),
                                       # Use host's E820 for PCI passthrough.
                                       ("e820_host", bool),
                                       ])),
diff -r 996c95a3e7e0 -r 1a93393b7002 tools/libxl/libxltypes.py
--- a/tools/libxl/libxltypes.py	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/libxl/libxltypes.py	Tue Jan 31 14:39:57 2012 +0000
@@ -154,17 +154,17 @@
 
         self.fields = []
         for f in fields:
-            # (name, type[, const=False])
+            # (name, type[, {kw args}])
             if len(f) == 2:
                 n,t = f
-                const = False
+                kw = {}
             elif len(f) == 3:
-                n,t,const = f
+                n,t,kw = f
             else:
                 raise ValueError
             if n is None:
                 raise ValueError
-            self.fields.append(Field(t,n,const=const))
+            self.fields.append(Field(t,n,**kw))
 
     # Returns a tuple (stem, field-expr)
     #

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:44 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8a-0007Xg-Kz; Fri, 03 Feb 2012 21:57:44 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8Y-0007UI-UG
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:43 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-216.messagelabs.com!1328306255!12855327!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10680 invoked from network); 3 Feb 2012 21:57:36 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:36 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8R-0001mo-Lq
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:35 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8Q-0002rK-NP
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:35 +0000
Message-Id: <E1RtR8Q-0002rK-NP@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:33 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: use keyword arguments for
	field definitions in aggregate types.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328020797 0
# Node ID 1a93393b700209a5863a49961eb802e6796dd661
# Parent  996c95a3e7e01f85186e5ac02e3070bc442ff580
libxl: use keyword arguments for field definitions in aggregate types.

The original code is not so bad now that the comments are gone but this is
still a bit cleaner.

No change in the generated code.

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


diff -r 996c95a3e7e0 -r 1a93393b7002 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 14:39:57 2012 +0000
@@ -192,7 +192,7 @@
                                       ("bootloader_args", libxl_string_list),
                                       ("cmdline", string),
                                       ("ramdisk", libxl_file_reference),
-                                      ("features", string, True),
+                                      ("features", string, {'const': True}),
                                       # Use host's E820 for PCI passthrough.
                                       ("e820_host", bool),
                                       ])),
diff -r 996c95a3e7e0 -r 1a93393b7002 tools/libxl/libxltypes.py
--- a/tools/libxl/libxltypes.py	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/libxl/libxltypes.py	Tue Jan 31 14:39:57 2012 +0000
@@ -154,17 +154,17 @@
 
         self.fields = []
         for f in fields:
-            # (name, type[, const=False])
+            # (name, type[, {kw args}])
             if len(f) == 2:
                 n,t = f
-                const = False
+                kw = {}
             elif len(f) == 3:
-                n,t,const = f
+                n,t,kw = f
             else:
                 raise ValueError
             if n is None:
                 raise ValueError
-            self.fields.append(Field(t,n,const=const))
+            self.fields.append(Field(t,n,**kw))
 
     # Returns a tuple (stem, field-expr)
     #

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:46 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8c-0007ZI-Nd; Fri, 03 Feb 2012 21:57:46 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8b-0007V0-2a
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:45 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-174.messagelabs.com!1328306257!11933586!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23381 invoked from network); 3 Feb 2012 21:57:38 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:38 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8T-0001ms-IC
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:37 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8S-0002sD-QL
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:37 +0000
Message-Id: <E1RtR8S-0002sD-QL@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:35 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] ocaml: use libxl IDL type helpers
	for C argument passing
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328020808 0
# Node ID 88b630f0406e026f8aa958f9f5130b4a07e0d134
# Parent  1a93393b700209a5863a49961eb802e6796dd661
ocaml: use libxl IDL type helpers for C argument passing

Makes handling of nested structs more correct.

Only change to the generated code right now is that the FOO_Val
(C->ocamlC) function for Enumeration types now takes the C argument by
value instead of reference.

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


diff -r 1a93393b7002 -r 88b630f0406e tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/ocaml/libs/xl/genwrap.py	Tue Jan 31 14:40:08 2012 +0000
@@ -114,11 +114,6 @@
     return s.replace("\n", "\n%s" % indent)
 
 def c_val(ty, c, o, indent="", parent = None):
-    if ty.passby == libxltypes.PASS_BY_REFERENCE:
-        makeref = ""
-    else:
-        makeref = "&"
-
     s = indent
     if isinstance(ty,libxltypes.UInt):
         if ty.width in [8, 16]:
@@ -152,17 +147,18 @@
         for f in ty.fields:
             if f.type.private:
                 continue
-            s += "%s\n" % c_val(f.type, "%s->%s" % (c, f.name), "Field(%s, %d)" % (o,n), parent="%s->" % (c))
+            (nparent,fexpr) = ty.member(c, f, parent is None)
+            s += "%s\n" % c_val(f.type, fexpr, "Field(%s, %d)" % (o,n), parent=nparent)
             n = n + 1
     else:
-        s += "%s_val(gc, lg, %s, %s);" % (ty.rawname, makeref + c, o)
+        s += "%s_val(gc, lg, %s, %s);" % (ty.rawname, ty.pass_arg(c, parent is None, passby=libxltypes.PASS_BY_REFERENCE), o)
     
     return s.replace("\n", "\n%s" % indent)
 
 def gen_c_val(ty, indent=""):
     s = "/* Convert caml value to %s */\n" % ty.rawname
     
-    s += "static int %s_val (caml_gc *gc, struct caml_logger *lg, %s *c_val, value v)\n" % (ty.rawname, ty.typename)
+    s += "static int %s_val (caml_gc *gc, struct caml_logger *lg, %s, value v)\n" % (ty.rawname, ty.make_arg("c_val", passby=libxltypes.PASS_BY_REFERENCE))
     s += "{\n"
     s += "\tCAMLparam1(v);\n"
     s += "\n"
@@ -175,11 +171,6 @@
     return s.replace("\n", "\n%s" % indent)
 
 def ocaml_Val(ty, o, c, indent="", parent = None):
-    if ty.passby == libxltypes.PASS_BY_REFERENCE:
-        makeref = ""
-    else:
-        makeref = "&"
-    
     s = indent
     if isinstance(ty,libxltypes.UInt):
         if ty.width in [8, 16]:
@@ -202,7 +193,7 @@
         s += "%s = %s;" % (o, fn % { "c": c })
     elif isinstance(ty,libxltypes.Enumeration) and (parent is None):
         n = 0
-        s += "switch(*%s) {\n" % c
+        s += "switch(%s) {\n" % c
         for e in ty.values:
             s += "    case %s: %s = Int_val(%d); break;\n" % (e.name, o, n)
             n += 1
@@ -218,20 +209,23 @@
         for f in ty.fields:
             if f.type.private:
                 continue
+
+            (nparent,fexpr) = ty.member(c, f, parent is None)
+
             s += "\n"
-            s += "\t%s\n" % ocaml_Val(f.type, "%s_field" % ty.rawname, "%s->%s" % (c,f.name), parent="%s->" % c)
+            s += "\t%s\n" % ocaml_Val(f.type, "%s_field" % ty.rawname, ty.pass_arg(fexpr, c), parent=nparent)
             s += "\tStore_field(%s, %d, %s);\n" % (o, n, "%s_field" % ty.rawname)
             n = n + 1
         s += "}"
     else:
-        s += "%s = Val_%s(gc, lg, %s);" % (o, ty.rawname, makeref + c)
+        s += "%s = Val_%s(gc, lg, %s);" % (o, ty.rawname, ty.pass_arg(c, parent is None))
     
     return s.replace("\n", "\n%s" % indent).rstrip(indent)
 
 def gen_Val_ocaml(ty, indent=""):
     s = "/* Convert %s to a caml value */\n" % ty.rawname
 
-    s += "static value Val_%s (caml_gc *gc, struct caml_logger *lg, %s *%s_c)\n" % (ty.rawname, ty.typename, ty.rawname)
+    s += "static value Val_%s (caml_gc *gc, struct caml_logger *lg, %s)\n" % (ty.rawname, ty.make_arg(ty.rawname+"_c"))
     s += "{\n"
     s += "\tCAMLparam0();\n"
     s += "\tCAMLlocal1(%s_ocaml);\n" % ty.rawname

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:46 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8c-0007ZI-Nd; Fri, 03 Feb 2012 21:57:46 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8b-0007V0-2a
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:45 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-174.messagelabs.com!1328306257!11933586!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23381 invoked from network); 3 Feb 2012 21:57:38 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:38 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8T-0001ms-IC
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:37 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8S-0002sD-QL
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:37 +0000
Message-Id: <E1RtR8S-0002sD-QL@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:35 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] ocaml: use libxl IDL type helpers
	for C argument passing
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328020808 0
# Node ID 88b630f0406e026f8aa958f9f5130b4a07e0d134
# Parent  1a93393b700209a5863a49961eb802e6796dd661
ocaml: use libxl IDL type helpers for C argument passing

Makes handling of nested structs more correct.

Only change to the generated code right now is that the FOO_Val
(C->ocamlC) function for Enumeration types now takes the C argument by
value instead of reference.

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


diff -r 1a93393b7002 -r 88b630f0406e tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py	Tue Jan 31 14:39:57 2012 +0000
+++ b/tools/ocaml/libs/xl/genwrap.py	Tue Jan 31 14:40:08 2012 +0000
@@ -114,11 +114,6 @@
     return s.replace("\n", "\n%s" % indent)
 
 def c_val(ty, c, o, indent="", parent = None):
-    if ty.passby == libxltypes.PASS_BY_REFERENCE:
-        makeref = ""
-    else:
-        makeref = "&"
-
     s = indent
     if isinstance(ty,libxltypes.UInt):
         if ty.width in [8, 16]:
@@ -152,17 +147,18 @@
         for f in ty.fields:
             if f.type.private:
                 continue
-            s += "%s\n" % c_val(f.type, "%s->%s" % (c, f.name), "Field(%s, %d)" % (o,n), parent="%s->" % (c))
+            (nparent,fexpr) = ty.member(c, f, parent is None)
+            s += "%s\n" % c_val(f.type, fexpr, "Field(%s, %d)" % (o,n), parent=nparent)
             n = n + 1
     else:
-        s += "%s_val(gc, lg, %s, %s);" % (ty.rawname, makeref + c, o)
+        s += "%s_val(gc, lg, %s, %s);" % (ty.rawname, ty.pass_arg(c, parent is None, passby=libxltypes.PASS_BY_REFERENCE), o)
     
     return s.replace("\n", "\n%s" % indent)
 
 def gen_c_val(ty, indent=""):
     s = "/* Convert caml value to %s */\n" % ty.rawname
     
-    s += "static int %s_val (caml_gc *gc, struct caml_logger *lg, %s *c_val, value v)\n" % (ty.rawname, ty.typename)
+    s += "static int %s_val (caml_gc *gc, struct caml_logger *lg, %s, value v)\n" % (ty.rawname, ty.make_arg("c_val", passby=libxltypes.PASS_BY_REFERENCE))
     s += "{\n"
     s += "\tCAMLparam1(v);\n"
     s += "\n"
@@ -175,11 +171,6 @@
     return s.replace("\n", "\n%s" % indent)
 
 def ocaml_Val(ty, o, c, indent="", parent = None):
-    if ty.passby == libxltypes.PASS_BY_REFERENCE:
-        makeref = ""
-    else:
-        makeref = "&"
-    
     s = indent
     if isinstance(ty,libxltypes.UInt):
         if ty.width in [8, 16]:
@@ -202,7 +193,7 @@
         s += "%s = %s;" % (o, fn % { "c": c })
     elif isinstance(ty,libxltypes.Enumeration) and (parent is None):
         n = 0
-        s += "switch(*%s) {\n" % c
+        s += "switch(%s) {\n" % c
         for e in ty.values:
             s += "    case %s: %s = Int_val(%d); break;\n" % (e.name, o, n)
             n += 1
@@ -218,20 +209,23 @@
         for f in ty.fields:
             if f.type.private:
                 continue
+
+            (nparent,fexpr) = ty.member(c, f, parent is None)
+
             s += "\n"
-            s += "\t%s\n" % ocaml_Val(f.type, "%s_field" % ty.rawname, "%s->%s" % (c,f.name), parent="%s->" % c)
+            s += "\t%s\n" % ocaml_Val(f.type, "%s_field" % ty.rawname, ty.pass_arg(fexpr, c), parent=nparent)
             s += "\tStore_field(%s, %d, %s);\n" % (o, n, "%s_field" % ty.rawname)
             n = n + 1
         s += "}"
     else:
-        s += "%s = Val_%s(gc, lg, %s);" % (o, ty.rawname, makeref + c)
+        s += "%s = Val_%s(gc, lg, %s);" % (o, ty.rawname, ty.pass_arg(c, parent is None))
     
     return s.replace("\n", "\n%s" % indent).rstrip(indent)
 
 def gen_Val_ocaml(ty, indent=""):
     s = "/* Convert %s to a caml value */\n" % ty.rawname
 
-    s += "static value Val_%s (caml_gc *gc, struct caml_logger *lg, %s *%s_c)\n" % (ty.rawname, ty.typename, ty.rawname)
+    s += "static value Val_%s (caml_gc *gc, struct caml_logger *lg, %s)\n" % (ty.rawname, ty.make_arg(ty.rawname+"_c"))
     s += "{\n"
     s += "\tCAMLparam0();\n"
     s += "\tCAMLlocal1(%s_ocaml);\n" % ty.rawname

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:47 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8c-0007ZU-Q1; Fri, 03 Feb 2012 21:57:46 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8b-0007Y3-By
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:45 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-27.messagelabs.com!1328306240!64435687!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31590 invoked from network); 3 Feb 2012 21:57:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8Y-0001my-59
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:42 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8V-0002t2-B3
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:41 +0000
Message-Id: <E1RtR8V-0002t2-B3@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:37 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: define libxl_vnc_info to hold
	all info about the vnc info
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328020859 0
# Node ID b1580167b3b255072395a75976d9da216e725ef6
# Parent  88b630f0406e026f8aa958f9f5130b4a07e0d134
libxl: define libxl_vnc_info to hold all info about the vnc info

Reduces duplication in libxl_vfb and libxl_device_model.

Updated bindings but the python ones in particular are unlikely to be useful
until a user presents itself and fixes them up.

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


diff -r 88b630f0406e -r b1580167b3b2 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Jan 31 14:40:08 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Jan 31 14:40:59 2012 +0000
@@ -2190,11 +2190,11 @@
     memset(vfb, 0x00, sizeof(libxl_device_vfb));
     vfb->display = NULL;
     vfb->xauthority = NULL;
-    vfb->vnc = 1;
-    vfb->vncpasswd = NULL;
-    vfb->vnclisten = strdup("127.0.0.1");
-    vfb->vncdisplay = 0;
-    vfb->vncunused = 1;
+    vfb->vnc.enable = 1;
+    vfb->vnc.passwd = NULL;
+    vfb->vnc.listen = strdup("127.0.0.1");
+    vfb->vnc.display = 0;
+    vfb->vnc.findunused = 1;
     vfb->keymap = NULL;
     vfb->sdl = 0;
     vfb->opengl = 0;
@@ -2240,11 +2240,14 @@
     flexarray_append_pair(back, "online", "1");
     flexarray_append_pair(back, "state", libxl__sprintf(gc, "%d", 1));
     flexarray_append_pair(back, "domain", libxl__domid_to_name(gc, domid));
-    flexarray_append_pair(back, "vnc", libxl__sprintf(gc, "%d", vfb->vnc));
-    flexarray_append_pair(back, "vnclisten", vfb->vnclisten);
-    flexarray_append_pair(back, "vncpasswd", vfb->vncpasswd);
-    flexarray_append_pair(back, "vncdisplay", libxl__sprintf(gc, "%d", vfb->vncdisplay));
-    flexarray_append_pair(back, "vncunused", libxl__sprintf(gc, "%d", vfb->vncunused));
+    flexarray_append_pair(back, "vnc",
+                          libxl__sprintf(gc, "%d", vfb->vnc.enable));
+    flexarray_append_pair(back, "vnclisten", vfb->vnc.listen);
+    flexarray_append_pair(back, "vncpasswd", vfb->vnc.passwd);
+    flexarray_append_pair(back, "vncdisplay",
+                          libxl__sprintf(gc, "%d", vfb->vnc.display));
+    flexarray_append_pair(back, "vncunused",
+                          libxl__sprintf(gc, "%d", vfb->vnc.findunused));
     flexarray_append_pair(back, "sdl", libxl__sprintf(gc, "%d", vfb->sdl));
     flexarray_append_pair(back, "opengl", libxl__sprintf(gc, "%d", vfb->opengl));
     if (vfb->xauthority) {
diff -r 88b630f0406e -r b1580167b3b2 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 14:40:08 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 14:40:59 2012 +0000
@@ -129,10 +129,10 @@
     dm_info->vcpu_avail = b_info->cur_vcpus;
 
     dm_info->stdvga = 0;
-    dm_info->vnc = 1;
-    dm_info->vnclisten = strdup("127.0.0.1");
-    dm_info->vncdisplay = 0;
-    dm_info->vncunused = 1;
+    dm_info->vnc.enable = 1;
+    dm_info->vnc.listen = strdup("127.0.0.1");
+    dm_info->vnc.display = 0;
+    dm_info->vnc.findunused = 1;
     dm_info->keymap = NULL;
     dm_info->sdl = 0;
     dm_info->opengl = 0;
diff -r 88b630f0406e -r b1580167b3b2 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 14:40:08 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 14:40:59 2012 +0000
@@ -92,31 +92,31 @@
     if (info->dom_name)
         flexarray_vappend(dm_args, "-domain-name", info->dom_name, NULL);
 
-    if (info->vnc) {
+    if (info->vnc.enable) {
         char *vncarg;
-        if (info->vncdisplay) {
-            if (info->vnclisten && strchr(info->vnclisten, ':') == NULL) {
+        if (info->vnc.display) {
+            if (info->vnc.listen && strchr(info->vnc.listen, ':') == NULL) {
                 vncarg = libxl__sprintf(gc, "%s:%d",
-                                  info->vnclisten,
-                                  info->vncdisplay);
+                                  info->vnc.listen,
+                                  info->vnc.display);
             } else {
-                vncarg = libxl__sprintf(gc, "127.0.0.1:%d", info->vncdisplay);
+                vncarg = libxl__sprintf(gc, "127.0.0.1:%d", info->vnc.display);
             }
-        } else if (info->vnclisten) {
-            if (strchr(info->vnclisten, ':') != NULL) {
-                vncarg = info->vnclisten;
+        } else if (info->vnc.listen) {
+            if (strchr(info->vnc.listen, ':') != NULL) {
+                vncarg = info->vnc.listen;
             } else {
-                vncarg = libxl__sprintf(gc, "%s:0", info->vnclisten);
+                vncarg = libxl__sprintf(gc, "%s:0", info->vnc.listen);
             }
         } else {
             vncarg = "127.0.0.1:0";
         }
-        if (info->vncpasswd && (info->vncpasswd[0] != '\0'))
+        if (info->vnc.passwd && (info->vnc.passwd[0] != '\0'))
             vncarg = libxl__sprintf(gc, "%s,password", vncarg);
         flexarray_append(dm_args, "-vnc");
         flexarray_append(dm_args, vncarg);
 
-        if (info->vncunused) {
+        if (info->vnc.findunused) {
             flexarray_append(dm_args, "-vncunused");
         }
     }
@@ -129,7 +129,7 @@
     if (info->keymap) {
         flexarray_vappend(dm_args, "-k", info->keymap, NULL);
     }
-    if (info->nographic && (!info->sdl && !info->vnc)) {
+    if (info->nographic && (!info->sdl && !info->vnc.enable)) {
         flexarray_append(dm_args, "-nographic");
     }
     if (info->serial) {
@@ -260,32 +260,32 @@
     if (info->dom_name) {
         flexarray_vappend(dm_args, "-name", info->dom_name, NULL);
     }
-    if (info->vnc) {
+    if (info->vnc.enable) {
         int display = 0;
         const char *listen = "127.0.0.1";
 
-        if (info->vncpasswd && info->vncpasswd[0]) {
+        if (info->vnc.passwd && info->vnc.passwd[0]) {
             assert(!"missing code for supplying vnc password to qemu");
         }
         flexarray_append(dm_args, "-vnc");
 
-        if (info->vncdisplay) {
-            display = info->vncdisplay;
-            if (info->vnclisten && strchr(info->vnclisten, ':') == NULL) {
-                listen = info->vnclisten;
+        if (info->vnc.display) {
+            display = info->vnc.display;
+            if (info->vnc.listen && strchr(info->vnc.listen, ':') == NULL) {
+                listen = info->vnc.listen;
             }
-        } else if (info->vnclisten) {
-            listen = info->vnclisten;
+        } else if (info->vnc.listen) {
+            listen = info->vnc.listen;
         }
 
         if (strchr(listen, ':') != NULL)
             flexarray_append(dm_args,
                     libxl__sprintf(gc, "%s%s", listen,
-                        info->vncunused ? ",to=99" : ""));
+                        info->vnc.findunused ? ",to=99" : ""));
         else
             flexarray_append(dm_args,
                     libxl__sprintf(gc, "%s:%d%s", listen, display,
-                        info->vncunused ? ",to=99" : ""));
+                        info->vnc.findunused ? ",to=99" : ""));
     }
     if (info->sdl) {
         flexarray_append(dm_args, "-sdl");
@@ -335,7 +335,7 @@
     if (info->keymap) {
         flexarray_vappend(dm_args, "-k", info->keymap, NULL);
     }
-    if (info->nographic && (!info->sdl && !info->vnc)) {
+    if (info->nographic && (!info->sdl && !info->vnc.enable)) {
         flexarray_append(dm_args, "-nographic");
     }
     if (info->serial) {
@@ -524,10 +524,6 @@
     vfb->backend_domid = 0;
     vfb->devid = 0;
     vfb->vnc = info->vnc;
-    vfb->vnclisten = info->vnclisten;
-    vfb->vncdisplay = info->vncdisplay;
-    vfb->vncunused = info->vncunused;
-    vfb->vncpasswd = info->vncpasswd;
     vfb->keymap = info->keymap;
     vfb->sdl = info->sdl;
     vfb->opengl = info->opengl;
@@ -851,7 +847,7 @@
         goto out_close;
     }
 
-    if (info->vncpasswd) {
+    if (info->vnc.passwd) {
 retry_transaction:
         /* Find uuid and the write the vnc password to xenstore for qemu. */
         t = xs_transaction_start(ctx->xsh);
@@ -860,7 +856,7 @@
             /* Now write the vncpassword into it. */
             pass_stuff = libxl__calloc(gc, 3, sizeof(char *));
             pass_stuff[0] = "vncpasswd";
-            pass_stuff[1] = info->vncpasswd;
+            pass_stuff[1] = info->vnc.passwd;
             libxl__xs_writev(gc,t,vm_path,pass_stuff);
             if (!xs_transaction_end(ctx->xsh, t, 0))
                 if (errno == EAGAIN)
@@ -975,13 +971,13 @@
     libxl_ctx *ctx = libxl__gc_owner(gc);
 
     if (vfb != NULL) {
-        info->vnc = vfb->vnc;
-        if (vfb->vnclisten)
-            info->vnclisten = libxl__strdup(gc, vfb->vnclisten);
-        info->vncdisplay = vfb->vncdisplay;
-        info->vncunused = vfb->vncunused;
-        if (vfb->vncpasswd)
-            info->vncpasswd = vfb->vncpasswd;
+        info->vnc.enable = vfb->vnc.enable;
+        if (vfb->vnc.listen)
+            info->vnc.listen = libxl__strdup(gc, vfb->vnc.listen);
+        info->vnc.display = vfb->vnc.display;
+        info->vnc.findunused = vfb->vnc.findunused;
+        if (vfb->vnc.passwd)
+            info->vnc.passwd = vfb->vnc.passwd;
         if (vfb->keymap)
             info->keymap = libxl__strdup(gc, vfb->keymap);
         info->sdl = vfb->sdl;
diff -r 88b630f0406e -r b1580167b3b2 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 14:40:08 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 14:40:59 2012 +0000
@@ -90,6 +90,16 @@
 #
 # Complex libxl types
 #
+libxl_vnc_info = Struct("vnc_info", [
+    ("enable",        bool),
+    # "address:port" that should be listened on
+    ("listen",        string),
+    ("passwd",        string),
+    ("display",       integer),
+    # If set then try to find an unused port
+    ("findunused",    bool),
+    ])
+
 libxl_dominfo = Struct("dominfo",[
     ("uuid",        libxl_uuid),
     ("domid",       libxl_domid),
@@ -218,14 +228,7 @@
     # size of the videoram in MB
     ("videoram",         integer), 
     ("stdvga",           bool),
-    ("vnc",              bool),
-    # "address:port" that should be listened on for the VNC server
-    ("vnclisten",        string),
-    ("vncpasswd",        string),
-    # VNC display number
-    ("vncdisplay",       integer),
-    # If set then try to find an unused port for the VNC server
-    ("vncunused",        bool),
+    ("vnc",              libxl_vnc_info),
     # keyboard layout, default is en-us keyboard
     ("keymap",           string),
     ("sdl",              bool),
@@ -264,12 +267,7 @@
 libxl_device_vfb = Struct("device_vfb", [
     ("backend_domid", libxl_domid),
     ("devid",         integer),
-    ("vnc",           bool),
-    # address:port that should be listened on for the VNC server if vnc is set
-    ("vnclisten",     string),
-    ("vncpasswd",     string),
-    ("vncdisplay",    integer),
-    ("vncunused",     bool),
+    ("vnc",           libxl_vnc_info),
     # set keyboard layout, default is en-us keyboard
     ("keymap",        string),
     ("sdl",           bool),
diff -r 88b630f0406e -r b1580167b3b2 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 14:40:08 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 14:40:59 2012 +0000
@@ -367,10 +367,10 @@
         printf("\t\t\t(device_model %s)\n", dm_info->device_model ? : "default");
         printf("\t\t\t(videoram %d)\n", dm_info->videoram);
         printf("\t\t\t(stdvga %d)\n", dm_info->stdvga);
-        printf("\t\t\t(vnc %d)\n", dm_info->vnc);
-        printf("\t\t\t(vnclisten %s)\n", dm_info->vnclisten);
-        printf("\t\t\t(vncdisplay %d)\n", dm_info->vncdisplay);
-        printf("\t\t\t(vncunused %d)\n", dm_info->vncunused);
+        printf("\t\t\t(vnc %d)\n", dm_info->vnc.enable);
+        printf("\t\t\t(vnclisten %s)\n", dm_info->vnc.listen);
+        printf("\t\t\t(vncdisplay %d)\n", dm_info->vnc.display);
+        printf("\t\t\t(vncunused %d)\n", dm_info->vnc.findunused);
         printf("\t\t\t(keymap %s)\n", dm_info->keymap);
         printf("\t\t\t(sdl %d)\n", dm_info->sdl);
         printf("\t\t\t(gfx_passthru %d)\n", dm_info->gfx_passthru);
@@ -457,10 +457,10 @@
         printf("\t\t\t(backend_domid %d)\n", d_config->vfbs[i].backend_domid);
         printf("\t\t\t(frontend_domid %d)\n", domid);
         printf("\t\t\t(devid %d)\n", d_config->vfbs[i].devid);
-        printf("\t\t\t(vnc %d)\n", d_config->vfbs[i].vnc);
-        printf("\t\t\t(vnclisten %s)\n", d_config->vfbs[i].vnclisten);
-        printf("\t\t\t(vncdisplay %d)\n", d_config->vfbs[i].vncdisplay);
-        printf("\t\t\t(vncunused %d)\n", d_config->vfbs[i].vncunused);
+        printf("\t\t\t(vnc %d)\n", d_config->vfbs[i].vnc.enable);
+        printf("\t\t\t(vnclisten %s)\n", d_config->vfbs[i].vnc.listen);
+        printf("\t\t\t(vncdisplay %d)\n", d_config->vfbs[i].vnc.display);
+        printf("\t\t\t(vncunused %d)\n", d_config->vfbs[i].vnc.findunused);
         printf("\t\t\t(keymap %s)\n", d_config->vfbs[i].keymap);
         printf("\t\t\t(sdl %d)\n", d_config->vfbs[i].sdl);
         printf("\t\t\t(opengl %d)\n", d_config->vfbs[i].opengl);
@@ -1045,17 +1045,17 @@
                     break;
                 *p2 = '\0';
                 if (!strcmp(p, "vnc")) {
-                    vfb->vnc = atoi(p2 + 1);
+                    vfb->vnc.enable = atoi(p2 + 1);
                 } else if (!strcmp(p, "vnclisten")) {
-                    free(vfb->vnclisten);
-                    vfb->vnclisten = strdup(p2 + 1);
+                    free(vfb->vnc.listen);
+                    vfb->vnc.listen = strdup(p2 + 1);
                 } else if (!strcmp(p, "vncpasswd")) {
-                    free(vfb->vncpasswd);
-                    vfb->vncpasswd = strdup(p2 + 1);
+                    free(vfb->vnc.passwd);
+                    vfb->vnc.passwd = strdup(p2 + 1);
                 } else if (!strcmp(p, "vncdisplay")) {
-                    vfb->vncdisplay = atoi(p2 + 1);
+                    vfb->vnc.display = atoi(p2 + 1);
                 } else if (!strcmp(p, "vncunused")) {
-                    vfb->vncunused = atoi(p2 + 1);
+                    vfb->vnc.findunused = atoi(p2 + 1);
                 } else if (!strcmp(p, "keymap")) {
                     free(vfb->keymap);
                     vfb->keymap = strdup(p2 + 1);
@@ -1262,13 +1262,13 @@
         if (!xlu_cfg_get_long (config, "stdvga", &l, 0))
             dm_info->stdvga = l;
         if (!xlu_cfg_get_long (config, "vnc", &l, 0))
-            dm_info->vnc = l;
-        xlu_cfg_replace_string (config, "vnclisten", &dm_info->vnclisten, 0);
-        xlu_cfg_replace_string (config, "vncpasswd", &dm_info->vncpasswd, 0);
+            dm_info->vnc.enable = l;
+        xlu_cfg_replace_string (config, "vnclisten", &dm_info->vnc.listen, 0);
+        xlu_cfg_replace_string (config, "vncpasswd", &dm_info->vnc.passwd, 0);
         if (!xlu_cfg_get_long (config, "vncdisplay", &l, 0))
-            dm_info->vncdisplay = l;
+            dm_info->vnc.display = l;
         if (!xlu_cfg_get_long (config, "vncunused", &l, 0))
-            dm_info->vncunused = l;
+            dm_info->vnc.findunused = l;
         xlu_cfg_replace_string (config, "keymap", &dm_info->keymap, 0);
         if (!xlu_cfg_get_long (config, "sdl", &l, 0))
             dm_info->sdl = l;
diff -r 88b630f0406e -r b1580167b3b2 tools/python/genwrap.py
--- a/tools/python/genwrap.py	Tue Jan 31 14:40:08 2012 +0000
+++ b/tools/python/genwrap.py	Tue Jan 31 14:40:59 2012 +0000
@@ -4,7 +4,7 @@
 
 import libxltypes
 
-(TYPE_BOOL, TYPE_INT, TYPE_UINT, TYPE_STRING) = range(4)
+(TYPE_BOOL, TYPE_INT, TYPE_UINT, TYPE_STRING, TYPE_AGGREGATE) = range(5)
 
 def py_type(ty):
     if ty == libxltypes.bool:
@@ -16,6 +16,8 @@
             return TYPE_INT
         else:
             return TYPE_UINT
+    if isinstance(ty, libxltypes.Aggregate):
+        return TYPE_AGGREGATE
     if ty == libxltypes.string:
         return TYPE_STRING
     return None
@@ -66,6 +68,9 @@
         l.append('    return genwrap__ull_get(self->obj.%s);'%f.name)
     elif t == TYPE_STRING:
         l.append('    return genwrap__string_get(&self->obj.%s);'%f.name)
+    elif t == TYPE_AGGREGATE:
+        l.append('    PyErr_SetString(PyExc_NotImplementedError, "Getting %s");'%ty.typename)
+        l.append('    return NULL;')
     else:
         tn = f.type.typename
         l.append('    return attrib__%s_get((%s *)&self->obj.%s);'%(fsanitize(tn), tn, f.name))
@@ -92,6 +97,9 @@
         l.append('    return ret;')
     elif t == TYPE_STRING:
         l.append('    return genwrap__string_set(v, &self->obj.%s);'%f.name)
+    elif t == TYPE_AGGREGATE:
+        l.append('    PyErr_SetString(PyExc_NotImplementedError, "Setting %s");'%ty.typename)
+        l.append('    return -1;')
     else:
         tn = f.type.typename
         l.append('    return attrib__%s_set(v, (%s *)&self->obj.%s);'%(fsanitize(tn), tn, f.name))

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:47 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8c-0007ZU-Q1; Fri, 03 Feb 2012 21:57:46 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8b-0007Y3-By
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:45 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-27.messagelabs.com!1328306240!64435687!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31590 invoked from network); 3 Feb 2012 21:57:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8Y-0001my-59
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:42 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8V-0002t2-B3
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:41 +0000
Message-Id: <E1RtR8V-0002t2-B3@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:37 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: define libxl_vnc_info to hold
	all info about the vnc info
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328020859 0
# Node ID b1580167b3b255072395a75976d9da216e725ef6
# Parent  88b630f0406e026f8aa958f9f5130b4a07e0d134
libxl: define libxl_vnc_info to hold all info about the vnc info

Reduces duplication in libxl_vfb and libxl_device_model.

Updated bindings but the python ones in particular are unlikely to be useful
until a user presents itself and fixes them up.

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


diff -r 88b630f0406e -r b1580167b3b2 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Jan 31 14:40:08 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Jan 31 14:40:59 2012 +0000
@@ -2190,11 +2190,11 @@
     memset(vfb, 0x00, sizeof(libxl_device_vfb));
     vfb->display = NULL;
     vfb->xauthority = NULL;
-    vfb->vnc = 1;
-    vfb->vncpasswd = NULL;
-    vfb->vnclisten = strdup("127.0.0.1");
-    vfb->vncdisplay = 0;
-    vfb->vncunused = 1;
+    vfb->vnc.enable = 1;
+    vfb->vnc.passwd = NULL;
+    vfb->vnc.listen = strdup("127.0.0.1");
+    vfb->vnc.display = 0;
+    vfb->vnc.findunused = 1;
     vfb->keymap = NULL;
     vfb->sdl = 0;
     vfb->opengl = 0;
@@ -2240,11 +2240,14 @@
     flexarray_append_pair(back, "online", "1");
     flexarray_append_pair(back, "state", libxl__sprintf(gc, "%d", 1));
     flexarray_append_pair(back, "domain", libxl__domid_to_name(gc, domid));
-    flexarray_append_pair(back, "vnc", libxl__sprintf(gc, "%d", vfb->vnc));
-    flexarray_append_pair(back, "vnclisten", vfb->vnclisten);
-    flexarray_append_pair(back, "vncpasswd", vfb->vncpasswd);
-    flexarray_append_pair(back, "vncdisplay", libxl__sprintf(gc, "%d", vfb->vncdisplay));
-    flexarray_append_pair(back, "vncunused", libxl__sprintf(gc, "%d", vfb->vncunused));
+    flexarray_append_pair(back, "vnc",
+                          libxl__sprintf(gc, "%d", vfb->vnc.enable));
+    flexarray_append_pair(back, "vnclisten", vfb->vnc.listen);
+    flexarray_append_pair(back, "vncpasswd", vfb->vnc.passwd);
+    flexarray_append_pair(back, "vncdisplay",
+                          libxl__sprintf(gc, "%d", vfb->vnc.display));
+    flexarray_append_pair(back, "vncunused",
+                          libxl__sprintf(gc, "%d", vfb->vnc.findunused));
     flexarray_append_pair(back, "sdl", libxl__sprintf(gc, "%d", vfb->sdl));
     flexarray_append_pair(back, "opengl", libxl__sprintf(gc, "%d", vfb->opengl));
     if (vfb->xauthority) {
diff -r 88b630f0406e -r b1580167b3b2 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 14:40:08 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 14:40:59 2012 +0000
@@ -129,10 +129,10 @@
     dm_info->vcpu_avail = b_info->cur_vcpus;
 
     dm_info->stdvga = 0;
-    dm_info->vnc = 1;
-    dm_info->vnclisten = strdup("127.0.0.1");
-    dm_info->vncdisplay = 0;
-    dm_info->vncunused = 1;
+    dm_info->vnc.enable = 1;
+    dm_info->vnc.listen = strdup("127.0.0.1");
+    dm_info->vnc.display = 0;
+    dm_info->vnc.findunused = 1;
     dm_info->keymap = NULL;
     dm_info->sdl = 0;
     dm_info->opengl = 0;
diff -r 88b630f0406e -r b1580167b3b2 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 14:40:08 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 14:40:59 2012 +0000
@@ -92,31 +92,31 @@
     if (info->dom_name)
         flexarray_vappend(dm_args, "-domain-name", info->dom_name, NULL);
 
-    if (info->vnc) {
+    if (info->vnc.enable) {
         char *vncarg;
-        if (info->vncdisplay) {
-            if (info->vnclisten && strchr(info->vnclisten, ':') == NULL) {
+        if (info->vnc.display) {
+            if (info->vnc.listen && strchr(info->vnc.listen, ':') == NULL) {
                 vncarg = libxl__sprintf(gc, "%s:%d",
-                                  info->vnclisten,
-                                  info->vncdisplay);
+                                  info->vnc.listen,
+                                  info->vnc.display);
             } else {
-                vncarg = libxl__sprintf(gc, "127.0.0.1:%d", info->vncdisplay);
+                vncarg = libxl__sprintf(gc, "127.0.0.1:%d", info->vnc.display);
             }
-        } else if (info->vnclisten) {
-            if (strchr(info->vnclisten, ':') != NULL) {
-                vncarg = info->vnclisten;
+        } else if (info->vnc.listen) {
+            if (strchr(info->vnc.listen, ':') != NULL) {
+                vncarg = info->vnc.listen;
             } else {
-                vncarg = libxl__sprintf(gc, "%s:0", info->vnclisten);
+                vncarg = libxl__sprintf(gc, "%s:0", info->vnc.listen);
             }
         } else {
             vncarg = "127.0.0.1:0";
         }
-        if (info->vncpasswd && (info->vncpasswd[0] != '\0'))
+        if (info->vnc.passwd && (info->vnc.passwd[0] != '\0'))
             vncarg = libxl__sprintf(gc, "%s,password", vncarg);
         flexarray_append(dm_args, "-vnc");
         flexarray_append(dm_args, vncarg);
 
-        if (info->vncunused) {
+        if (info->vnc.findunused) {
             flexarray_append(dm_args, "-vncunused");
         }
     }
@@ -129,7 +129,7 @@
     if (info->keymap) {
         flexarray_vappend(dm_args, "-k", info->keymap, NULL);
     }
-    if (info->nographic && (!info->sdl && !info->vnc)) {
+    if (info->nographic && (!info->sdl && !info->vnc.enable)) {
         flexarray_append(dm_args, "-nographic");
     }
     if (info->serial) {
@@ -260,32 +260,32 @@
     if (info->dom_name) {
         flexarray_vappend(dm_args, "-name", info->dom_name, NULL);
     }
-    if (info->vnc) {
+    if (info->vnc.enable) {
         int display = 0;
         const char *listen = "127.0.0.1";
 
-        if (info->vncpasswd && info->vncpasswd[0]) {
+        if (info->vnc.passwd && info->vnc.passwd[0]) {
             assert(!"missing code for supplying vnc password to qemu");
         }
         flexarray_append(dm_args, "-vnc");
 
-        if (info->vncdisplay) {
-            display = info->vncdisplay;
-            if (info->vnclisten && strchr(info->vnclisten, ':') == NULL) {
-                listen = info->vnclisten;
+        if (info->vnc.display) {
+            display = info->vnc.display;
+            if (info->vnc.listen && strchr(info->vnc.listen, ':') == NULL) {
+                listen = info->vnc.listen;
             }
-        } else if (info->vnclisten) {
-            listen = info->vnclisten;
+        } else if (info->vnc.listen) {
+            listen = info->vnc.listen;
         }
 
         if (strchr(listen, ':') != NULL)
             flexarray_append(dm_args,
                     libxl__sprintf(gc, "%s%s", listen,
-                        info->vncunused ? ",to=99" : ""));
+                        info->vnc.findunused ? ",to=99" : ""));
         else
             flexarray_append(dm_args,
                     libxl__sprintf(gc, "%s:%d%s", listen, display,
-                        info->vncunused ? ",to=99" : ""));
+                        info->vnc.findunused ? ",to=99" : ""));
     }
     if (info->sdl) {
         flexarray_append(dm_args, "-sdl");
@@ -335,7 +335,7 @@
     if (info->keymap) {
         flexarray_vappend(dm_args, "-k", info->keymap, NULL);
     }
-    if (info->nographic && (!info->sdl && !info->vnc)) {
+    if (info->nographic && (!info->sdl && !info->vnc.enable)) {
         flexarray_append(dm_args, "-nographic");
     }
     if (info->serial) {
@@ -524,10 +524,6 @@
     vfb->backend_domid = 0;
     vfb->devid = 0;
     vfb->vnc = info->vnc;
-    vfb->vnclisten = info->vnclisten;
-    vfb->vncdisplay = info->vncdisplay;
-    vfb->vncunused = info->vncunused;
-    vfb->vncpasswd = info->vncpasswd;
     vfb->keymap = info->keymap;
     vfb->sdl = info->sdl;
     vfb->opengl = info->opengl;
@@ -851,7 +847,7 @@
         goto out_close;
     }
 
-    if (info->vncpasswd) {
+    if (info->vnc.passwd) {
 retry_transaction:
         /* Find uuid and the write the vnc password to xenstore for qemu. */
         t = xs_transaction_start(ctx->xsh);
@@ -860,7 +856,7 @@
             /* Now write the vncpassword into it. */
             pass_stuff = libxl__calloc(gc, 3, sizeof(char *));
             pass_stuff[0] = "vncpasswd";
-            pass_stuff[1] = info->vncpasswd;
+            pass_stuff[1] = info->vnc.passwd;
             libxl__xs_writev(gc,t,vm_path,pass_stuff);
             if (!xs_transaction_end(ctx->xsh, t, 0))
                 if (errno == EAGAIN)
@@ -975,13 +971,13 @@
     libxl_ctx *ctx = libxl__gc_owner(gc);
 
     if (vfb != NULL) {
-        info->vnc = vfb->vnc;
-        if (vfb->vnclisten)
-            info->vnclisten = libxl__strdup(gc, vfb->vnclisten);
-        info->vncdisplay = vfb->vncdisplay;
-        info->vncunused = vfb->vncunused;
-        if (vfb->vncpasswd)
-            info->vncpasswd = vfb->vncpasswd;
+        info->vnc.enable = vfb->vnc.enable;
+        if (vfb->vnc.listen)
+            info->vnc.listen = libxl__strdup(gc, vfb->vnc.listen);
+        info->vnc.display = vfb->vnc.display;
+        info->vnc.findunused = vfb->vnc.findunused;
+        if (vfb->vnc.passwd)
+            info->vnc.passwd = vfb->vnc.passwd;
         if (vfb->keymap)
             info->keymap = libxl__strdup(gc, vfb->keymap);
         info->sdl = vfb->sdl;
diff -r 88b630f0406e -r b1580167b3b2 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 14:40:08 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 14:40:59 2012 +0000
@@ -90,6 +90,16 @@
 #
 # Complex libxl types
 #
+libxl_vnc_info = Struct("vnc_info", [
+    ("enable",        bool),
+    # "address:port" that should be listened on
+    ("listen",        string),
+    ("passwd",        string),
+    ("display",       integer),
+    # If set then try to find an unused port
+    ("findunused",    bool),
+    ])
+
 libxl_dominfo = Struct("dominfo",[
     ("uuid",        libxl_uuid),
     ("domid",       libxl_domid),
@@ -218,14 +228,7 @@
     # size of the videoram in MB
     ("videoram",         integer), 
     ("stdvga",           bool),
-    ("vnc",              bool),
-    # "address:port" that should be listened on for the VNC server
-    ("vnclisten",        string),
-    ("vncpasswd",        string),
-    # VNC display number
-    ("vncdisplay",       integer),
-    # If set then try to find an unused port for the VNC server
-    ("vncunused",        bool),
+    ("vnc",              libxl_vnc_info),
     # keyboard layout, default is en-us keyboard
     ("keymap",           string),
     ("sdl",              bool),
@@ -264,12 +267,7 @@
 libxl_device_vfb = Struct("device_vfb", [
     ("backend_domid", libxl_domid),
     ("devid",         integer),
-    ("vnc",           bool),
-    # address:port that should be listened on for the VNC server if vnc is set
-    ("vnclisten",     string),
-    ("vncpasswd",     string),
-    ("vncdisplay",    integer),
-    ("vncunused",     bool),
+    ("vnc",           libxl_vnc_info),
     # set keyboard layout, default is en-us keyboard
     ("keymap",        string),
     ("sdl",           bool),
diff -r 88b630f0406e -r b1580167b3b2 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 14:40:08 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 14:40:59 2012 +0000
@@ -367,10 +367,10 @@
         printf("\t\t\t(device_model %s)\n", dm_info->device_model ? : "default");
         printf("\t\t\t(videoram %d)\n", dm_info->videoram);
         printf("\t\t\t(stdvga %d)\n", dm_info->stdvga);
-        printf("\t\t\t(vnc %d)\n", dm_info->vnc);
-        printf("\t\t\t(vnclisten %s)\n", dm_info->vnclisten);
-        printf("\t\t\t(vncdisplay %d)\n", dm_info->vncdisplay);
-        printf("\t\t\t(vncunused %d)\n", dm_info->vncunused);
+        printf("\t\t\t(vnc %d)\n", dm_info->vnc.enable);
+        printf("\t\t\t(vnclisten %s)\n", dm_info->vnc.listen);
+        printf("\t\t\t(vncdisplay %d)\n", dm_info->vnc.display);
+        printf("\t\t\t(vncunused %d)\n", dm_info->vnc.findunused);
         printf("\t\t\t(keymap %s)\n", dm_info->keymap);
         printf("\t\t\t(sdl %d)\n", dm_info->sdl);
         printf("\t\t\t(gfx_passthru %d)\n", dm_info->gfx_passthru);
@@ -457,10 +457,10 @@
         printf("\t\t\t(backend_domid %d)\n", d_config->vfbs[i].backend_domid);
         printf("\t\t\t(frontend_domid %d)\n", domid);
         printf("\t\t\t(devid %d)\n", d_config->vfbs[i].devid);
-        printf("\t\t\t(vnc %d)\n", d_config->vfbs[i].vnc);
-        printf("\t\t\t(vnclisten %s)\n", d_config->vfbs[i].vnclisten);
-        printf("\t\t\t(vncdisplay %d)\n", d_config->vfbs[i].vncdisplay);
-        printf("\t\t\t(vncunused %d)\n", d_config->vfbs[i].vncunused);
+        printf("\t\t\t(vnc %d)\n", d_config->vfbs[i].vnc.enable);
+        printf("\t\t\t(vnclisten %s)\n", d_config->vfbs[i].vnc.listen);
+        printf("\t\t\t(vncdisplay %d)\n", d_config->vfbs[i].vnc.display);
+        printf("\t\t\t(vncunused %d)\n", d_config->vfbs[i].vnc.findunused);
         printf("\t\t\t(keymap %s)\n", d_config->vfbs[i].keymap);
         printf("\t\t\t(sdl %d)\n", d_config->vfbs[i].sdl);
         printf("\t\t\t(opengl %d)\n", d_config->vfbs[i].opengl);
@@ -1045,17 +1045,17 @@
                     break;
                 *p2 = '\0';
                 if (!strcmp(p, "vnc")) {
-                    vfb->vnc = atoi(p2 + 1);
+                    vfb->vnc.enable = atoi(p2 + 1);
                 } else if (!strcmp(p, "vnclisten")) {
-                    free(vfb->vnclisten);
-                    vfb->vnclisten = strdup(p2 + 1);
+                    free(vfb->vnc.listen);
+                    vfb->vnc.listen = strdup(p2 + 1);
                 } else if (!strcmp(p, "vncpasswd")) {
-                    free(vfb->vncpasswd);
-                    vfb->vncpasswd = strdup(p2 + 1);
+                    free(vfb->vnc.passwd);
+                    vfb->vnc.passwd = strdup(p2 + 1);
                 } else if (!strcmp(p, "vncdisplay")) {
-                    vfb->vncdisplay = atoi(p2 + 1);
+                    vfb->vnc.display = atoi(p2 + 1);
                 } else if (!strcmp(p, "vncunused")) {
-                    vfb->vncunused = atoi(p2 + 1);
+                    vfb->vnc.findunused = atoi(p2 + 1);
                 } else if (!strcmp(p, "keymap")) {
                     free(vfb->keymap);
                     vfb->keymap = strdup(p2 + 1);
@@ -1262,13 +1262,13 @@
         if (!xlu_cfg_get_long (config, "stdvga", &l, 0))
             dm_info->stdvga = l;
         if (!xlu_cfg_get_long (config, "vnc", &l, 0))
-            dm_info->vnc = l;
-        xlu_cfg_replace_string (config, "vnclisten", &dm_info->vnclisten, 0);
-        xlu_cfg_replace_string (config, "vncpasswd", &dm_info->vncpasswd, 0);
+            dm_info->vnc.enable = l;
+        xlu_cfg_replace_string (config, "vnclisten", &dm_info->vnc.listen, 0);
+        xlu_cfg_replace_string (config, "vncpasswd", &dm_info->vnc.passwd, 0);
         if (!xlu_cfg_get_long (config, "vncdisplay", &l, 0))
-            dm_info->vncdisplay = l;
+            dm_info->vnc.display = l;
         if (!xlu_cfg_get_long (config, "vncunused", &l, 0))
-            dm_info->vncunused = l;
+            dm_info->vnc.findunused = l;
         xlu_cfg_replace_string (config, "keymap", &dm_info->keymap, 0);
         if (!xlu_cfg_get_long (config, "sdl", &l, 0))
             dm_info->sdl = l;
diff -r 88b630f0406e -r b1580167b3b2 tools/python/genwrap.py
--- a/tools/python/genwrap.py	Tue Jan 31 14:40:08 2012 +0000
+++ b/tools/python/genwrap.py	Tue Jan 31 14:40:59 2012 +0000
@@ -4,7 +4,7 @@
 
 import libxltypes
 
-(TYPE_BOOL, TYPE_INT, TYPE_UINT, TYPE_STRING) = range(4)
+(TYPE_BOOL, TYPE_INT, TYPE_UINT, TYPE_STRING, TYPE_AGGREGATE) = range(5)
 
 def py_type(ty):
     if ty == libxltypes.bool:
@@ -16,6 +16,8 @@
             return TYPE_INT
         else:
             return TYPE_UINT
+    if isinstance(ty, libxltypes.Aggregate):
+        return TYPE_AGGREGATE
     if ty == libxltypes.string:
         return TYPE_STRING
     return None
@@ -66,6 +68,9 @@
         l.append('    return genwrap__ull_get(self->obj.%s);'%f.name)
     elif t == TYPE_STRING:
         l.append('    return genwrap__string_get(&self->obj.%s);'%f.name)
+    elif t == TYPE_AGGREGATE:
+        l.append('    PyErr_SetString(PyExc_NotImplementedError, "Getting %s");'%ty.typename)
+        l.append('    return NULL;')
     else:
         tn = f.type.typename
         l.append('    return attrib__%s_get((%s *)&self->obj.%s);'%(fsanitize(tn), tn, f.name))
@@ -92,6 +97,9 @@
         l.append('    return ret;')
     elif t == TYPE_STRING:
         l.append('    return genwrap__string_set(v, &self->obj.%s);'%f.name)
+    elif t == TYPE_AGGREGATE:
+        l.append('    PyErr_SetString(PyExc_NotImplementedError, "Setting %s");'%ty.typename)
+        l.append('    return -1;')
     else:
         tn = f.type.typename
         l.append('    return attrib__%s_set(v, (%s *)&self->obj.%s);'%(fsanitize(tn), tn, f.name))

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:57 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8m-0007eh-TE; Fri, 03 Feb 2012 21:57:56 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8l-0007bn-9g
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:55 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-182.messagelabs.com!1328306267!6221342!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4213 invoked from network); 3 Feb 2012 21:57:48 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:48 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8d-0001n7-05
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:47 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8a-0002uM-Ui
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:46 +0000
Message-Id: <E1RtR8a-0002uM-Ui@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:42 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: define libxl_spice_info to
	hold all info about the spice server
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328020860 0
# Node ID 5d9e86d7e448f365daa05f1f1b6d70948e927400
# Parent  b1580167b3b255072395a75976d9da216e725ef6
libxl: define libxl_spice_info to hold all info about the spice server

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


diff -r b1580167b3b2 -r 5d9e86d7e448 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 14:40:59 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 14:41:00 2012 +0000
@@ -290,39 +290,39 @@
     if (info->sdl) {
         flexarray_append(dm_args, "-sdl");
     }
-    if (info->spice) {
+    if (info->spice.enable) {
         char *spiceoptions = NULL;
-        if (!info->spiceport && !info->spicetls_port) {
+        if (!info->spice.port && !info->spice.tls_port) {
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
                 "at least one of the spiceport or tls_port must be provided");
             return NULL;
         }
 
-        if (!info->spicedisable_ticketing) {
-            if (!info->spicepasswd) {
+        if (!info->spice.disable_ticketing) {
+            if (!info->spice.passwd) {
                 LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
                     "spice ticketing is enabled but missing password");
                 return NULL;
             }
-            else if (!info->spicepasswd[0]) {
+            else if (!info->spice.passwd[0]) {
                 LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
                     "spice password can't be empty");
                 return NULL;
             }
         }
         spiceoptions = libxl__sprintf(gc, "port=%d,tls-port=%d",
-                       info->spiceport, info->spicetls_port);
-        if (info->spicehost)
+                                      info->spice.port, info->spice.tls_port);
+        if (info->spice.host)
             spiceoptions = libxl__sprintf(gc,
-                    "%s,addr=%s", spiceoptions, info->spicehost);
-        if (info->spicedisable_ticketing)
+                    "%s,addr=%s", spiceoptions, info->spice.host);
+        if (info->spice.disable_ticketing)
             spiceoptions = libxl__sprintf(gc, "%s,disable-ticketing",
                                                spiceoptions);
         else
             spiceoptions = libxl__sprintf(gc,
-                    "%s,password=%s", spiceoptions, info->spicepasswd);
+                    "%s,password=%s", spiceoptions, info->spice.passwd);
         spiceoptions = libxl__sprintf(gc, "%s,agent-mouse=%s", spiceoptions,
-                                      info->spiceagent_mouse ? "on" : "off");
+                                      info->spice.agent_mouse ? "on" : "off");
 
         flexarray_append(dm_args, "-spice");
         flexarray_append(dm_args, spiceoptions);
diff -r b1580167b3b2 -r 5d9e86d7e448 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 14:40:59 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 14:41:00 2012 +0000
@@ -100,6 +100,26 @@
     ("findunused",    bool),
     ])
 
+libxl_spice_info = Struct("spice_info", [
+    ("enable",            bool),
+    # At least one of spice port or spicetls_post must be given
+    ("port",        integer),
+    ("tls_port",    integer),
+    # Interface to bind to
+    ("host",        string),
+    # enable client connection with no password
+    ("disable_ticketing", bool),
+    ("passwd",      string),
+    ("agent_mouse", bool),
+    ])
+
+libxl_sdl_info = Struct("sdl_info", [
+    ("enable",        bool),
+    ("opengl",        bool),
+    ("display",       string),
+    ("xauthority",    string),
+    ])
+
 libxl_dominfo = Struct("dominfo",[
     ("uuid",        libxl_uuid),
     ("domid",       libxl_domid),
@@ -233,16 +253,7 @@
     ("keymap",           string),
     ("sdl",              bool),
     ("opengl",           bool), # (requires sdl enabled)
-    ("spice",            bool),
-    # At least one of spice port or spicetls_post must be given
-    ("spiceport",        integer),
-    ("spicetls_port",    integer),
-    # Interface to bind to
-    ("spicehost",        string),
-    # enable client connection with no password
-    ("spicedisable_ticketing", bool),
-    ("spicepasswd",      string),
-    ("spiceagent_mouse", bool),
+    ("spice",            libxl_spice_info),
     ("nographic",        bool),
     ("gfx_passthru",     bool),
     ("serial",           string),
diff -r b1580167b3b2 -r 5d9e86d7e448 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 14:40:59 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 14:41:00 2012 +0000
@@ -381,13 +381,13 @@
         printf("\t\t\t(usb %d)\n", dm_info->usb);
         printf("\t\t\t(usbdevice %s)\n", dm_info->usbdevice);
         printf("\t\t\t(acpi %d)\n", dm_info->acpi);
-        printf("\t\t\t(spice %d)\n", dm_info->spice);
-        printf("\t\t\t(spiceport %d)\n", dm_info->spiceport);
-        printf("\t\t\t(spicetls_port %d)\n", dm_info->spicetls_port);
-        printf("\t\t\t(spicehost %s)\n", dm_info->spicehost);
+        printf("\t\t\t(spice %d)\n", dm_info->spice.enable);
+        printf("\t\t\t(spiceport %d)\n", dm_info->spice.port);
+        printf("\t\t\t(spicetls_port %d)\n", dm_info->spice.tls_port);
+        printf("\t\t\t(spicehost %s)\n", dm_info->spice.host);
         printf("\t\t\t(spicedisable_ticketing %d)\n",
-                    dm_info->spicedisable_ticketing);
-        printf("\t\t\t(spiceagent_mouse %d)\n", dm_info->spiceagent_mouse);
+                    dm_info->spice.disable_ticketing);
+        printf("\t\t\t(spiceagent_mouse %d)\n", dm_info->spice.agent_mouse);
         printf("\t\t)\n");
         break;
     case LIBXL_DOMAIN_TYPE_PV:
@@ -1275,19 +1275,20 @@
         if (!xlu_cfg_get_long (config, "opengl", &l, 0))
             dm_info->opengl = l;
         if (!xlu_cfg_get_long (config, "spice", &l, 0))
-            dm_info->spice = l;
+            dm_info->spice.enable = l;
         if (!xlu_cfg_get_long (config, "spiceport", &l, 0))
-            dm_info->spiceport = l;
+            dm_info->spice.port = l;
         if (!xlu_cfg_get_long (config, "spicetls_port", &l, 0))
-            dm_info->spicetls_port = l;
-        xlu_cfg_replace_string (config, "spicehost", &dm_info->spicehost, 0);
+            dm_info->spice.tls_port = l;
+        xlu_cfg_replace_string (config, "spicehost", &dm_info->spice.host, 0);
         if (!xlu_cfg_get_long (config, "spicedisable_ticketing", &l, 0))
-            dm_info->spicedisable_ticketing = l;
-        xlu_cfg_replace_string (config, "spicepasswd", &dm_info->spicepasswd, 0);
+            dm_info->spice.disable_ticketing = l;
+        xlu_cfg_replace_string (config, "spicepasswd",
+                                &dm_info->spice.passwd, 0);
         if (!xlu_cfg_get_long (config, "spiceagent_mouse", &l, 0))
-            dm_info->spiceagent_mouse = l;
+            dm_info->spice.agent_mouse = l;
         else
-            dm_info->spiceagent_mouse = 1;
+            dm_info->spice.agent_mouse = 1;
         if (!xlu_cfg_get_long (config, "nographic", &l, 0))
             dm_info->nographic = l;
         if (!xlu_cfg_get_long (config, "gfx_passthru", &l, 0))

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:57:57 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:57:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8m-0007eh-TE; Fri, 03 Feb 2012 21:57:56 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8l-0007bn-9g
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:55 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-182.messagelabs.com!1328306267!6221342!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4213 invoked from network); 3 Feb 2012 21:57:48 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:48 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8d-0001n7-05
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:47 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8a-0002uM-Ui
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:46 +0000
Message-Id: <E1RtR8a-0002uM-Ui@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:42 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: define libxl_spice_info to
	hold all info about the spice server
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328020860 0
# Node ID 5d9e86d7e448f365daa05f1f1b6d70948e927400
# Parent  b1580167b3b255072395a75976d9da216e725ef6
libxl: define libxl_spice_info to hold all info about the spice server

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


diff -r b1580167b3b2 -r 5d9e86d7e448 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 14:40:59 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 14:41:00 2012 +0000
@@ -290,39 +290,39 @@
     if (info->sdl) {
         flexarray_append(dm_args, "-sdl");
     }
-    if (info->spice) {
+    if (info->spice.enable) {
         char *spiceoptions = NULL;
-        if (!info->spiceport && !info->spicetls_port) {
+        if (!info->spice.port && !info->spice.tls_port) {
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
                 "at least one of the spiceport or tls_port must be provided");
             return NULL;
         }
 
-        if (!info->spicedisable_ticketing) {
-            if (!info->spicepasswd) {
+        if (!info->spice.disable_ticketing) {
+            if (!info->spice.passwd) {
                 LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
                     "spice ticketing is enabled but missing password");
                 return NULL;
             }
-            else if (!info->spicepasswd[0]) {
+            else if (!info->spice.passwd[0]) {
                 LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
                     "spice password can't be empty");
                 return NULL;
             }
         }
         spiceoptions = libxl__sprintf(gc, "port=%d,tls-port=%d",
-                       info->spiceport, info->spicetls_port);
-        if (info->spicehost)
+                                      info->spice.port, info->spice.tls_port);
+        if (info->spice.host)
             spiceoptions = libxl__sprintf(gc,
-                    "%s,addr=%s", spiceoptions, info->spicehost);
-        if (info->spicedisable_ticketing)
+                    "%s,addr=%s", spiceoptions, info->spice.host);
+        if (info->spice.disable_ticketing)
             spiceoptions = libxl__sprintf(gc, "%s,disable-ticketing",
                                                spiceoptions);
         else
             spiceoptions = libxl__sprintf(gc,
-                    "%s,password=%s", spiceoptions, info->spicepasswd);
+                    "%s,password=%s", spiceoptions, info->spice.passwd);
         spiceoptions = libxl__sprintf(gc, "%s,agent-mouse=%s", spiceoptions,
-                                      info->spiceagent_mouse ? "on" : "off");
+                                      info->spice.agent_mouse ? "on" : "off");
 
         flexarray_append(dm_args, "-spice");
         flexarray_append(dm_args, spiceoptions);
diff -r b1580167b3b2 -r 5d9e86d7e448 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 14:40:59 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 14:41:00 2012 +0000
@@ -100,6 +100,26 @@
     ("findunused",    bool),
     ])
 
+libxl_spice_info = Struct("spice_info", [
+    ("enable",            bool),
+    # At least one of spice port or spicetls_post must be given
+    ("port",        integer),
+    ("tls_port",    integer),
+    # Interface to bind to
+    ("host",        string),
+    # enable client connection with no password
+    ("disable_ticketing", bool),
+    ("passwd",      string),
+    ("agent_mouse", bool),
+    ])
+
+libxl_sdl_info = Struct("sdl_info", [
+    ("enable",        bool),
+    ("opengl",        bool),
+    ("display",       string),
+    ("xauthority",    string),
+    ])
+
 libxl_dominfo = Struct("dominfo",[
     ("uuid",        libxl_uuid),
     ("domid",       libxl_domid),
@@ -233,16 +253,7 @@
     ("keymap",           string),
     ("sdl",              bool),
     ("opengl",           bool), # (requires sdl enabled)
-    ("spice",            bool),
-    # At least one of spice port or spicetls_post must be given
-    ("spiceport",        integer),
-    ("spicetls_port",    integer),
-    # Interface to bind to
-    ("spicehost",        string),
-    # enable client connection with no password
-    ("spicedisable_ticketing", bool),
-    ("spicepasswd",      string),
-    ("spiceagent_mouse", bool),
+    ("spice",            libxl_spice_info),
     ("nographic",        bool),
     ("gfx_passthru",     bool),
     ("serial",           string),
diff -r b1580167b3b2 -r 5d9e86d7e448 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 14:40:59 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 14:41:00 2012 +0000
@@ -381,13 +381,13 @@
         printf("\t\t\t(usb %d)\n", dm_info->usb);
         printf("\t\t\t(usbdevice %s)\n", dm_info->usbdevice);
         printf("\t\t\t(acpi %d)\n", dm_info->acpi);
-        printf("\t\t\t(spice %d)\n", dm_info->spice);
-        printf("\t\t\t(spiceport %d)\n", dm_info->spiceport);
-        printf("\t\t\t(spicetls_port %d)\n", dm_info->spicetls_port);
-        printf("\t\t\t(spicehost %s)\n", dm_info->spicehost);
+        printf("\t\t\t(spice %d)\n", dm_info->spice.enable);
+        printf("\t\t\t(spiceport %d)\n", dm_info->spice.port);
+        printf("\t\t\t(spicetls_port %d)\n", dm_info->spice.tls_port);
+        printf("\t\t\t(spicehost %s)\n", dm_info->spice.host);
         printf("\t\t\t(spicedisable_ticketing %d)\n",
-                    dm_info->spicedisable_ticketing);
-        printf("\t\t\t(spiceagent_mouse %d)\n", dm_info->spiceagent_mouse);
+                    dm_info->spice.disable_ticketing);
+        printf("\t\t\t(spiceagent_mouse %d)\n", dm_info->spice.agent_mouse);
         printf("\t\t)\n");
         break;
     case LIBXL_DOMAIN_TYPE_PV:
@@ -1275,19 +1275,20 @@
         if (!xlu_cfg_get_long (config, "opengl", &l, 0))
             dm_info->opengl = l;
         if (!xlu_cfg_get_long (config, "spice", &l, 0))
-            dm_info->spice = l;
+            dm_info->spice.enable = l;
         if (!xlu_cfg_get_long (config, "spiceport", &l, 0))
-            dm_info->spiceport = l;
+            dm_info->spice.port = l;
         if (!xlu_cfg_get_long (config, "spicetls_port", &l, 0))
-            dm_info->spicetls_port = l;
-        xlu_cfg_replace_string (config, "spicehost", &dm_info->spicehost, 0);
+            dm_info->spice.tls_port = l;
+        xlu_cfg_replace_string (config, "spicehost", &dm_info->spice.host, 0);
         if (!xlu_cfg_get_long (config, "spicedisable_ticketing", &l, 0))
-            dm_info->spicedisable_ticketing = l;
-        xlu_cfg_replace_string (config, "spicepasswd", &dm_info->spicepasswd, 0);
+            dm_info->spice.disable_ticketing = l;
+        xlu_cfg_replace_string (config, "spicepasswd",
+                                &dm_info->spice.passwd, 0);
         if (!xlu_cfg_get_long (config, "spiceagent_mouse", &l, 0))
-            dm_info->spiceagent_mouse = l;
+            dm_info->spice.agent_mouse = l;
         else
-            dm_info->spiceagent_mouse = 1;
+            dm_info->spice.agent_mouse = 1;
         if (!xlu_cfg_get_long (config, "nographic", &l, 0))
             dm_info->nographic = l;
         if (!xlu_cfg_get_long (config, "gfx_passthru", &l, 0))

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:00 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8q-0007gc-1f; Fri, 03 Feb 2012 21:58:00 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8o-0007fd-AA
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:58 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-27.messagelabs.com!1328306157!62474789!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10659 invoked from network); 3 Feb 2012 21:55:58 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:58 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8l-0001nO-A3
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:55 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8k-0002xC-8a
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:54 +0000
Message-Id: <E1RtR8k-0002xC-8a@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:53 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: plumb libxl_domain_config
	down into device model creation.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328020860 0
# Node ID 919ad96e3e2886bc5171bfed5205ad56a2390a5b
# Parent  9f0c4da3cbef636e730280f6755f5968873b2344
libxl: plumb libxl_domain_config down into device model creation.

Creating the device model derives lots of bits from the guest configuration.

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


diff -r 9f0c4da3cbef -r 919ad96e3e28 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 14:41:00 2012 +0000
@@ -571,7 +571,7 @@
         libxl_device_vkb_dispose(&vkb);
 
         dm_info->domid = domid;
-        ret = libxl__create_device_model(gc, dm_info,
+        ret = libxl__create_device_model(gc, d_config, dm_info,
                                         d_config->disks, d_config->num_disks,
                                         d_config->vifs, d_config->num_vifs,
                                         &dm_starting);
@@ -618,7 +618,8 @@
             xenpv_dm_info.extra_pv = d_config->dm_info.extra_pv;
             xenpv_dm_info.extra_hvm = d_config->dm_info.extra_hvm;
 
-            libxl__create_xenpv_qemu(gc, domid, &xenpv_dm_info,
+            libxl__create_xenpv_qemu(gc, domid,
+                                     d_config, &xenpv_dm_info,
                                      d_config->vfbs, &dm_starting);
         }
         break;
diff -r 9f0c4da3cbef -r 919ad96e3e28 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 14:41:00 2012 +0000
@@ -74,10 +74,11 @@
 }
 
 static char ** libxl__build_device_model_args_old(libxl__gc *gc,
-                                                  const char *dm,
-                                                  libxl_device_model_info *info,
-                                                  libxl_device_disk *disks, int num_disks,
-                                                  libxl_device_nic *vifs, int num_vifs)
+                                        const char *dm,
+                                        const libxl_domain_config *guest_config,
+                                        const libxl_device_model_info *info,
+                                        const libxl_device_disk *disks, int num_disks,
+                                        const libxl_device_nic *vifs, int num_vifs)
 {
     int i;
     flexarray_t *dm_args;
@@ -228,10 +229,11 @@
 }
 
 static char ** libxl__build_device_model_args_new(libxl__gc *gc,
-                                                  const char *dm,
-                                                  libxl_device_model_info *info,
-                                                  libxl_device_disk *disks, int num_disks,
-                                                  libxl_device_nic *vifs, int num_vifs)
+                                        const char *dm,
+                                        const libxl_domain_config *guest_config,
+                                        const libxl_device_model_info *info,
+                                        const libxl_device_disk *disks, int num_disks,
+                                        const libxl_device_nic *vifs, int num_vifs)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     flexarray_t *dm_args;
@@ -492,20 +494,21 @@
 }
 
 static char ** libxl__build_device_model_args(libxl__gc *gc,
-                                              const char *dm,
-                                              libxl_device_model_info *info,
-                                              libxl_device_disk *disks, int num_disks,
-                                              libxl_device_nic *vifs, int num_vifs)
+                                        const char *dm,
+                                        const libxl_domain_config *guest_config,
+                                        const libxl_device_model_info *info,
+                                        const libxl_device_disk *disks, int num_disks,
+                                        const libxl_device_nic *vifs, int num_vifs)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
 
     switch (info->device_model_version) {
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
-        return libxl__build_device_model_args_old(gc, dm, info,
+        return libxl__build_device_model_args_old(gc, dm, guest_config, info,
                                                   disks, num_disks,
                                                   vifs, num_vifs);
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
-        return libxl__build_device_model_args_new(gc, dm, info,
+        return libxl__build_device_model_args_new(gc, dm, guest_config, info,
                                                   disks, num_disks,
                                                   vifs, num_vifs);
     default:
@@ -516,9 +519,9 @@
 }
 
 static int libxl__vfb_and_vkb_from_device_model_info(libxl__gc *gc,
-                                                     libxl_device_model_info *info,
-                                                     libxl_device_vfb *vfb,
-                                                     libxl_device_vkb *vkb)
+                                        const libxl_device_model_info *info,
+                                        libxl_device_vfb *vfb,
+                                        libxl_device_vkb *vkb)
 {
     memset(vfb, 0x00, sizeof(libxl_device_vfb));
     memset(vkb, 0x00, sizeof(libxl_device_vkb));
@@ -583,6 +586,7 @@
 }
 
 static int libxl__create_stubdom(libxl__gc *gc,
+                                 libxl_domain_config *guest_config,
                                  libxl_device_model_info *info,
                                  libxl_device_disk *disks, int num_disks,
                                  libxl_device_nic *vifs, int num_vifs,
@@ -593,8 +597,7 @@
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int i, num_console = STUBDOM_SPECIAL_CONSOLES, ret;
     libxl_device_console *console;
-    libxl_domain_create_info c_info;
-    libxl_domain_build_info b_info;
+    libxl_domain_config dm_config;
     libxl__domain_build_state state;
     uint32_t domid;
     char **args;
@@ -608,7 +611,35 @@
         goto out;
     }
 
-    args = libxl__build_device_model_args(gc, "stubdom-dm", info,
+    memset(&dm_config.c_info, 0x00, sizeof(libxl_domain_create_info));
+    dm_config.c_info.type = LIBXL_DOMAIN_TYPE_PV;
+    dm_config.c_info.name = libxl__sprintf(gc, "%s-dm", libxl__domid_to_name(gc, info->domid));
+
+    libxl_uuid_copy(&dm_config.c_info.uuid, &info->uuid);
+
+    memset(&dm_config.b_info, 0x00, sizeof(libxl_domain_build_info));
+    dm_config.b_info.max_vcpus = 1;
+    dm_config.b_info.max_memkb = 32 * 1024;
+    dm_config.b_info.target_memkb = dm_config.b_info.max_memkb;
+
+    dm_config.b_info.type = LIBXL_DOMAIN_TYPE_PV;
+    dm_config.b_info.u.pv.kernel.path = libxl__abs_path(gc, "ioemu-stubdom.gz",
+                                              libxl_xenfirmwaredir_path());
+    dm_config.b_info.u.pv.cmdline = libxl__sprintf(gc, " -d %d", info->domid);
+    dm_config.b_info.u.pv.ramdisk.path = "";
+    dm_config.b_info.u.pv.features = "";
+
+    /* fixme: this function can leak the stubdom if it fails */
+    domid = 0;
+    ret = libxl__domain_make(gc, &dm_config.c_info, &domid);
+    if (ret)
+        goto out;
+    ret = libxl__domain_build(gc, &dm_config.b_info, info, domid, &state);
+    if (ret)
+        goto out;
+
+    args = libxl__build_device_model_args(gc, "stubdom-dm",
+                                          guest_config, info,
                                           disks, num_disks,
                                           vifs, num_vifs);
     if (!args) {
@@ -616,33 +647,6 @@
         goto out;
     }
 
-    memset(&c_info, 0x00, sizeof(libxl_domain_create_info));
-    c_info.type = LIBXL_DOMAIN_TYPE_PV;
-    c_info.name = libxl__sprintf(gc, "%s-dm", libxl__domid_to_name(gc, info->domid));
-
-    libxl_uuid_copy(&c_info.uuid, &info->uuid);
-
-    memset(&b_info, 0x00, sizeof(libxl_domain_build_info));
-    b_info.max_vcpus = 1;
-    b_info.max_memkb = 32 * 1024;
-    b_info.target_memkb = b_info.max_memkb;
-
-    b_info.type = LIBXL_DOMAIN_TYPE_PV;
-    b_info.u.pv.kernel.path = libxl__abs_path(gc, "ioemu-stubdom.gz",
-                                              libxl_xenfirmwaredir_path());
-    b_info.u.pv.cmdline = libxl__sprintf(gc, " -d %d", info->domid);
-    b_info.u.pv.ramdisk.path = "";
-    b_info.u.pv.features = "";
-
-    /* fixme: this function can leak the stubdom if it fails */
-    domid = 0;
-    ret = libxl__domain_make(gc, &c_info, &domid);
-    if (ret)
-        goto out_free;
-    ret = libxl__domain_build(gc, &b_info, info, domid, &state);
-    if (ret)
-        goto out_free;
-
     libxl__write_dmargs(gc, domid, info->domid, args);
     libxl__xs_write(gc, XBT_NULL,
                    libxl__sprintf(gc, "%s/image/device-model-domid", libxl__xs_get_dompath(gc, info->domid)),
@@ -739,6 +743,7 @@
     xenpv_dm_info.extra_hvm = info->extra_hvm;
 
     if (libxl__create_xenpv_qemu(gc, domid,
+                                 &dm_config,
                                  &xenpv_dm_info,
                                  vfb, &dm_starting) < 0) {
         ret = ERROR_FAIL;
@@ -768,6 +773,7 @@
 }
 
 int libxl__create_device_model(libxl__gc *gc,
+                              libxl_domain_config *guest_config,
                               libxl_device_model_info *info,
                               libxl_device_disk *disks, int num_disks,
                               libxl_device_nic *vifs, int num_vifs,
@@ -789,7 +795,7 @@
         libxl_device_vkb vkb;
 
         libxl__vfb_and_vkb_from_device_model_info(gc, info, &vfb, &vkb);
-        rc = libxl__create_stubdom(gc, info,
+        rc = libxl__create_stubdom(gc, guest_config, info,
                                    disks, num_disks,
                                    vifs, num_vifs,
                                    &vfb, &vkb, starting_r);
@@ -807,7 +813,8 @@
         rc = ERROR_FAIL;
         goto out;
     }
-    args = libxl__build_device_model_args(gc, dm, info, disks, num_disks,
+    args = libxl__build_device_model_args(gc, dm, guest_config, info,
+                                          disks, num_disks,
                                           vifs, num_vifs);
     if (!args) {
         rc = ERROR_FAIL;
@@ -1027,12 +1034,13 @@
 }
 
 int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
+                             libxl_domain_config *guest_config,
                              libxl_device_model_info *info,
                              libxl_device_vfb *vfb,
                              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);
+    libxl__create_device_model(gc, guest_config, info, NULL, 0, NULL, 0, starting_r);
     return 0;
 }
 
diff -r 9f0c4da3cbef -r 919ad96e3e28 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Tue Jan 31 14:41:00 2012 +0000
@@ -866,11 +866,13 @@
 _hidden const char *libxl__domain_device_model(libxl__gc *gc,
                                                libxl_device_model_info *info);
 _hidden int libxl__create_device_model(libxl__gc *gc,
+                              libxl_domain_config *guest_config,
                               libxl_device_model_info *info,
-                              libxl_device_disk *disk, int num_disks,
+                              libxl_device_disk *disks, int num_disks,
                               libxl_device_nic *vifs, int num_vifs,
                               libxl__spawner_starting **starting_r);
 _hidden int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
+                              libxl_domain_config *guest_config,
                               libxl_device_model_info *dm_info,
                               libxl_device_vfb *vfb,
                               libxl__spawner_starting **starting_r);
diff -r 9f0c4da3cbef -r 919ad96e3e28 tools/libxl/libxl_uuid.c
--- a/tools/libxl/libxl_uuid.c	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl_uuid.c	Tue Jan 31 14:41:00 2012 +0000
@@ -35,7 +35,7 @@
      return uuid_parse(in, uuid->uuid);
 }
 
-void libxl_uuid_copy(libxl_uuid *dst, libxl_uuid *src)
+void libxl_uuid_copy(libxl_uuid *dst, const libxl_uuid *src)
 {
      uuid_copy(dst->uuid, src->uuid);
 }
@@ -82,7 +82,7 @@
 }
 #undef LIBXL__UUID_PTRS
 
-void libxl_uuid_copy(libxl_uuid *dst, libxl_uuid *src)
+void libxl_uuid_copy(libxl_uuid *dst, const libxl_uuid *src)
 {
      memcpy(dst->uuid, src->uuid, sizeof(dst->uuid));
 }
diff -r 9f0c4da3cbef -r 919ad96e3e28 tools/libxl/libxl_uuid.h
--- a/tools/libxl/libxl_uuid.h	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl_uuid.h	Tue Jan 31 14:41:00 2012 +0000
@@ -56,7 +56,7 @@
 int libxl_uuid_is_nil(libxl_uuid *uuid);
 void libxl_uuid_generate(libxl_uuid *uuid);
 int libxl_uuid_from_string(libxl_uuid *uuid, const char *in);
-void libxl_uuid_copy(libxl_uuid *dst, libxl_uuid *src);
+void libxl_uuid_copy(libxl_uuid *dst, const libxl_uuid *src);
 void libxl_uuid_clear(libxl_uuid *uuid);
 int libxl_uuid_compare(libxl_uuid *uuid1, libxl_uuid *uuid2);
 uint8_t *libxl_uuid_bytearray(libxl_uuid *uuid);

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:00 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8q-0007gc-1f; Fri, 03 Feb 2012 21:58:00 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8o-0007fd-AA
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:58 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-27.messagelabs.com!1328306157!62474789!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10659 invoked from network); 3 Feb 2012 21:55:58 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:55:58 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8l-0001nO-A3
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:55 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8k-0002xC-8a
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:54 +0000
Message-Id: <E1RtR8k-0002xC-8a@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:53 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: plumb libxl_domain_config
	down into device model creation.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328020860 0
# Node ID 919ad96e3e2886bc5171bfed5205ad56a2390a5b
# Parent  9f0c4da3cbef636e730280f6755f5968873b2344
libxl: plumb libxl_domain_config down into device model creation.

Creating the device model derives lots of bits from the guest configuration.

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


diff -r 9f0c4da3cbef -r 919ad96e3e28 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 14:41:00 2012 +0000
@@ -571,7 +571,7 @@
         libxl_device_vkb_dispose(&vkb);
 
         dm_info->domid = domid;
-        ret = libxl__create_device_model(gc, dm_info,
+        ret = libxl__create_device_model(gc, d_config, dm_info,
                                         d_config->disks, d_config->num_disks,
                                         d_config->vifs, d_config->num_vifs,
                                         &dm_starting);
@@ -618,7 +618,8 @@
             xenpv_dm_info.extra_pv = d_config->dm_info.extra_pv;
             xenpv_dm_info.extra_hvm = d_config->dm_info.extra_hvm;
 
-            libxl__create_xenpv_qemu(gc, domid, &xenpv_dm_info,
+            libxl__create_xenpv_qemu(gc, domid,
+                                     d_config, &xenpv_dm_info,
                                      d_config->vfbs, &dm_starting);
         }
         break;
diff -r 9f0c4da3cbef -r 919ad96e3e28 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 14:41:00 2012 +0000
@@ -74,10 +74,11 @@
 }
 
 static char ** libxl__build_device_model_args_old(libxl__gc *gc,
-                                                  const char *dm,
-                                                  libxl_device_model_info *info,
-                                                  libxl_device_disk *disks, int num_disks,
-                                                  libxl_device_nic *vifs, int num_vifs)
+                                        const char *dm,
+                                        const libxl_domain_config *guest_config,
+                                        const libxl_device_model_info *info,
+                                        const libxl_device_disk *disks, int num_disks,
+                                        const libxl_device_nic *vifs, int num_vifs)
 {
     int i;
     flexarray_t *dm_args;
@@ -228,10 +229,11 @@
 }
 
 static char ** libxl__build_device_model_args_new(libxl__gc *gc,
-                                                  const char *dm,
-                                                  libxl_device_model_info *info,
-                                                  libxl_device_disk *disks, int num_disks,
-                                                  libxl_device_nic *vifs, int num_vifs)
+                                        const char *dm,
+                                        const libxl_domain_config *guest_config,
+                                        const libxl_device_model_info *info,
+                                        const libxl_device_disk *disks, int num_disks,
+                                        const libxl_device_nic *vifs, int num_vifs)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     flexarray_t *dm_args;
@@ -492,20 +494,21 @@
 }
 
 static char ** libxl__build_device_model_args(libxl__gc *gc,
-                                              const char *dm,
-                                              libxl_device_model_info *info,
-                                              libxl_device_disk *disks, int num_disks,
-                                              libxl_device_nic *vifs, int num_vifs)
+                                        const char *dm,
+                                        const libxl_domain_config *guest_config,
+                                        const libxl_device_model_info *info,
+                                        const libxl_device_disk *disks, int num_disks,
+                                        const libxl_device_nic *vifs, int num_vifs)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
 
     switch (info->device_model_version) {
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
-        return libxl__build_device_model_args_old(gc, dm, info,
+        return libxl__build_device_model_args_old(gc, dm, guest_config, info,
                                                   disks, num_disks,
                                                   vifs, num_vifs);
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
-        return libxl__build_device_model_args_new(gc, dm, info,
+        return libxl__build_device_model_args_new(gc, dm, guest_config, info,
                                                   disks, num_disks,
                                                   vifs, num_vifs);
     default:
@@ -516,9 +519,9 @@
 }
 
 static int libxl__vfb_and_vkb_from_device_model_info(libxl__gc *gc,
-                                                     libxl_device_model_info *info,
-                                                     libxl_device_vfb *vfb,
-                                                     libxl_device_vkb *vkb)
+                                        const libxl_device_model_info *info,
+                                        libxl_device_vfb *vfb,
+                                        libxl_device_vkb *vkb)
 {
     memset(vfb, 0x00, sizeof(libxl_device_vfb));
     memset(vkb, 0x00, sizeof(libxl_device_vkb));
@@ -583,6 +586,7 @@
 }
 
 static int libxl__create_stubdom(libxl__gc *gc,
+                                 libxl_domain_config *guest_config,
                                  libxl_device_model_info *info,
                                  libxl_device_disk *disks, int num_disks,
                                  libxl_device_nic *vifs, int num_vifs,
@@ -593,8 +597,7 @@
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int i, num_console = STUBDOM_SPECIAL_CONSOLES, ret;
     libxl_device_console *console;
-    libxl_domain_create_info c_info;
-    libxl_domain_build_info b_info;
+    libxl_domain_config dm_config;
     libxl__domain_build_state state;
     uint32_t domid;
     char **args;
@@ -608,7 +611,35 @@
         goto out;
     }
 
-    args = libxl__build_device_model_args(gc, "stubdom-dm", info,
+    memset(&dm_config.c_info, 0x00, sizeof(libxl_domain_create_info));
+    dm_config.c_info.type = LIBXL_DOMAIN_TYPE_PV;
+    dm_config.c_info.name = libxl__sprintf(gc, "%s-dm", libxl__domid_to_name(gc, info->domid));
+
+    libxl_uuid_copy(&dm_config.c_info.uuid, &info->uuid);
+
+    memset(&dm_config.b_info, 0x00, sizeof(libxl_domain_build_info));
+    dm_config.b_info.max_vcpus = 1;
+    dm_config.b_info.max_memkb = 32 * 1024;
+    dm_config.b_info.target_memkb = dm_config.b_info.max_memkb;
+
+    dm_config.b_info.type = LIBXL_DOMAIN_TYPE_PV;
+    dm_config.b_info.u.pv.kernel.path = libxl__abs_path(gc, "ioemu-stubdom.gz",
+                                              libxl_xenfirmwaredir_path());
+    dm_config.b_info.u.pv.cmdline = libxl__sprintf(gc, " -d %d", info->domid);
+    dm_config.b_info.u.pv.ramdisk.path = "";
+    dm_config.b_info.u.pv.features = "";
+
+    /* fixme: this function can leak the stubdom if it fails */
+    domid = 0;
+    ret = libxl__domain_make(gc, &dm_config.c_info, &domid);
+    if (ret)
+        goto out;
+    ret = libxl__domain_build(gc, &dm_config.b_info, info, domid, &state);
+    if (ret)
+        goto out;
+
+    args = libxl__build_device_model_args(gc, "stubdom-dm",
+                                          guest_config, info,
                                           disks, num_disks,
                                           vifs, num_vifs);
     if (!args) {
@@ -616,33 +647,6 @@
         goto out;
     }
 
-    memset(&c_info, 0x00, sizeof(libxl_domain_create_info));
-    c_info.type = LIBXL_DOMAIN_TYPE_PV;
-    c_info.name = libxl__sprintf(gc, "%s-dm", libxl__domid_to_name(gc, info->domid));
-
-    libxl_uuid_copy(&c_info.uuid, &info->uuid);
-
-    memset(&b_info, 0x00, sizeof(libxl_domain_build_info));
-    b_info.max_vcpus = 1;
-    b_info.max_memkb = 32 * 1024;
-    b_info.target_memkb = b_info.max_memkb;
-
-    b_info.type = LIBXL_DOMAIN_TYPE_PV;
-    b_info.u.pv.kernel.path = libxl__abs_path(gc, "ioemu-stubdom.gz",
-                                              libxl_xenfirmwaredir_path());
-    b_info.u.pv.cmdline = libxl__sprintf(gc, " -d %d", info->domid);
-    b_info.u.pv.ramdisk.path = "";
-    b_info.u.pv.features = "";
-
-    /* fixme: this function can leak the stubdom if it fails */
-    domid = 0;
-    ret = libxl__domain_make(gc, &c_info, &domid);
-    if (ret)
-        goto out_free;
-    ret = libxl__domain_build(gc, &b_info, info, domid, &state);
-    if (ret)
-        goto out_free;
-
     libxl__write_dmargs(gc, domid, info->domid, args);
     libxl__xs_write(gc, XBT_NULL,
                    libxl__sprintf(gc, "%s/image/device-model-domid", libxl__xs_get_dompath(gc, info->domid)),
@@ -739,6 +743,7 @@
     xenpv_dm_info.extra_hvm = info->extra_hvm;
 
     if (libxl__create_xenpv_qemu(gc, domid,
+                                 &dm_config,
                                  &xenpv_dm_info,
                                  vfb, &dm_starting) < 0) {
         ret = ERROR_FAIL;
@@ -768,6 +773,7 @@
 }
 
 int libxl__create_device_model(libxl__gc *gc,
+                              libxl_domain_config *guest_config,
                               libxl_device_model_info *info,
                               libxl_device_disk *disks, int num_disks,
                               libxl_device_nic *vifs, int num_vifs,
@@ -789,7 +795,7 @@
         libxl_device_vkb vkb;
 
         libxl__vfb_and_vkb_from_device_model_info(gc, info, &vfb, &vkb);
-        rc = libxl__create_stubdom(gc, info,
+        rc = libxl__create_stubdom(gc, guest_config, info,
                                    disks, num_disks,
                                    vifs, num_vifs,
                                    &vfb, &vkb, starting_r);
@@ -807,7 +813,8 @@
         rc = ERROR_FAIL;
         goto out;
     }
-    args = libxl__build_device_model_args(gc, dm, info, disks, num_disks,
+    args = libxl__build_device_model_args(gc, dm, guest_config, info,
+                                          disks, num_disks,
                                           vifs, num_vifs);
     if (!args) {
         rc = ERROR_FAIL;
@@ -1027,12 +1034,13 @@
 }
 
 int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
+                             libxl_domain_config *guest_config,
                              libxl_device_model_info *info,
                              libxl_device_vfb *vfb,
                              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);
+    libxl__create_device_model(gc, guest_config, info, NULL, 0, NULL, 0, starting_r);
     return 0;
 }
 
diff -r 9f0c4da3cbef -r 919ad96e3e28 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Tue Jan 31 14:41:00 2012 +0000
@@ -866,11 +866,13 @@
 _hidden const char *libxl__domain_device_model(libxl__gc *gc,
                                                libxl_device_model_info *info);
 _hidden int libxl__create_device_model(libxl__gc *gc,
+                              libxl_domain_config *guest_config,
                               libxl_device_model_info *info,
-                              libxl_device_disk *disk, int num_disks,
+                              libxl_device_disk *disks, int num_disks,
                               libxl_device_nic *vifs, int num_vifs,
                               libxl__spawner_starting **starting_r);
 _hidden int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
+                              libxl_domain_config *guest_config,
                               libxl_device_model_info *dm_info,
                               libxl_device_vfb *vfb,
                               libxl__spawner_starting **starting_r);
diff -r 9f0c4da3cbef -r 919ad96e3e28 tools/libxl/libxl_uuid.c
--- a/tools/libxl/libxl_uuid.c	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl_uuid.c	Tue Jan 31 14:41:00 2012 +0000
@@ -35,7 +35,7 @@
      return uuid_parse(in, uuid->uuid);
 }
 
-void libxl_uuid_copy(libxl_uuid *dst, libxl_uuid *src)
+void libxl_uuid_copy(libxl_uuid *dst, const libxl_uuid *src)
 {
      uuid_copy(dst->uuid, src->uuid);
 }
@@ -82,7 +82,7 @@
 }
 #undef LIBXL__UUID_PTRS
 
-void libxl_uuid_copy(libxl_uuid *dst, libxl_uuid *src)
+void libxl_uuid_copy(libxl_uuid *dst, const libxl_uuid *src)
 {
      memcpy(dst->uuid, src->uuid, sizeof(dst->uuid));
 }
diff -r 9f0c4da3cbef -r 919ad96e3e28 tools/libxl/libxl_uuid.h
--- a/tools/libxl/libxl_uuid.h	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl_uuid.h	Tue Jan 31 14:41:00 2012 +0000
@@ -56,7 +56,7 @@
 int libxl_uuid_is_nil(libxl_uuid *uuid);
 void libxl_uuid_generate(libxl_uuid *uuid);
 int libxl_uuid_from_string(libxl_uuid *uuid, const char *in);
-void libxl_uuid_copy(libxl_uuid *dst, libxl_uuid *src);
+void libxl_uuid_copy(libxl_uuid *dst, const libxl_uuid *src);
 void libxl_uuid_clear(libxl_uuid *uuid);
 int libxl_uuid_compare(libxl_uuid *uuid1, libxl_uuid *uuid2);
 uint8_t *libxl_uuid_bytearray(libxl_uuid *uuid);

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:02 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8s-0007i9-4g; Fri, 03 Feb 2012 21:58:02 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8q-0007gN-08
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:00 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-27.messagelabs.com!1328306222!55318792!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16992 invoked from network); 3 Feb 2012 21:57:03 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:03 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8n-0001nT-07
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:57 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8l-0002xt-PN
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:56 +0000
Message-Id: <E1RtR8l-0002xt-PN@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:55 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: now that dm creation takes
	domain_config stop passing down devices.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328023311 0
# Node ID 05435cdb21d323c2865cdd883fa0a7c2cdcdec0b
# Parent  919ad96e3e2886bc5171bfed5205ad56a2390a5b
libxl: now that dm creation takes domain_config stop passing down devices.

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


diff -r 919ad96e3e28 -r 05435cdb21d3 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 15:21:51 2012 +0000
@@ -572,8 +572,6 @@
 
         dm_info->domid = domid;
         ret = libxl__create_device_model(gc, d_config, dm_info,
-                                        d_config->disks, d_config->num_disks,
-                                        d_config->vifs, d_config->num_vifs,
                                         &dm_starting);
         if (ret < 0) {
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
@@ -619,8 +617,7 @@
             xenpv_dm_info.extra_hvm = d_config->dm_info.extra_hvm;
 
             libxl__create_xenpv_qemu(gc, domid,
-                                     d_config, &xenpv_dm_info,
-                                     d_config->vfbs, &dm_starting);
+                                     d_config, &xenpv_dm_info, &dm_starting);
         }
         break;
     }
diff -r 919ad96e3e28 -r 05435cdb21d3 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:51 2012 +0000
@@ -76,10 +76,10 @@
 static char ** libxl__build_device_model_args_old(libxl__gc *gc,
                                         const char *dm,
                                         const libxl_domain_config *guest_config,
-                                        const libxl_device_model_info *info,
-                                        const libxl_device_disk *disks, int num_disks,
-                                        const libxl_device_nic *vifs, int num_vifs)
+                                        const libxl_device_model_info *info)
 {
+    const libxl_device_nic *vifs = guest_config->vifs;
+    const int num_vifs = guest_config->num_vifs;
     int i;
     flexarray_t *dm_args;
     dm_args = flexarray_make(16, 1);
@@ -231,11 +231,13 @@
 static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                                         const char *dm,
                                         const libxl_domain_config *guest_config,
-                                        const libxl_device_model_info *info,
-                                        const libxl_device_disk *disks, int num_disks,
-                                        const libxl_device_nic *vifs, int num_vifs)
+                                        const libxl_device_model_info *info)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
+    const libxl_device_disk *disks = guest_config->disks;
+    const libxl_device_nic *vifs = guest_config->vifs;
+    const int num_disks = guest_config->num_disks;
+    const int num_vifs = guest_config->num_vifs;
     flexarray_t *dm_args;
     int i;
 
@@ -496,21 +498,15 @@
 static char ** libxl__build_device_model_args(libxl__gc *gc,
                                         const char *dm,
                                         const libxl_domain_config *guest_config,
-                                        const libxl_device_model_info *info,
-                                        const libxl_device_disk *disks, int num_disks,
-                                        const libxl_device_nic *vifs, int num_vifs)
+                                        const libxl_device_model_info *info)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
 
     switch (info->device_model_version) {
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
-        return libxl__build_device_model_args_old(gc, dm, guest_config, info,
-                                                  disks, num_disks,
-                                                  vifs, num_vifs);
+        return libxl__build_device_model_args_old(gc, dm, guest_config, info);
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
-        return libxl__build_device_model_args_new(gc, dm, guest_config, info,
-                                                  disks, num_disks,
-                                                  vifs, num_vifs);
+        return libxl__build_device_model_args_new(gc, dm, guest_config, info);
     default:
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unknown device model version %d",
                          info->device_model_version);
@@ -588,16 +584,14 @@
 static int libxl__create_stubdom(libxl__gc *gc,
                                  libxl_domain_config *guest_config,
                                  libxl_device_model_info *info,
-                                 libxl_device_disk *disks, int num_disks,
-                                 libxl_device_nic *vifs, int num_vifs,
-                                 libxl_device_vfb *vfb,
-                                 libxl_device_vkb *vkb,
                                  libxl__spawner_starting **starting_r)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int i, num_console = STUBDOM_SPECIAL_CONSOLES, ret;
     libxl_device_console *console;
     libxl_domain_config dm_config;
+    libxl_device_vfb vfb;
+    libxl_device_vkb vkb;
     libxl__domain_build_state state;
     uint32_t domid;
     char **args;
@@ -629,6 +623,19 @@
     dm_config.b_info.u.pv.ramdisk.path = "";
     dm_config.b_info.u.pv.features = "";
 
+    dm_config.disks = guest_config->disks;
+    dm_config.num_disks = guest_config->num_disks;
+
+    dm_config.vifs = guest_config->vifs;
+    dm_config.num_vifs = guest_config->num_vifs;
+
+    libxl__vfb_and_vkb_from_device_model_info(gc, info, &vfb, &vkb);
+
+    dm_config.vfbs = &vfb;
+    dm_config.num_vfbs = 1;
+    dm_config.vkbs = &vkb;
+    dm_config.num_vkbs = 1;
+
     /* fixme: this function can leak the stubdom if it fails */
     domid = 0;
     ret = libxl__domain_make(gc, &dm_config.c_info, &domid);
@@ -639,9 +646,7 @@
         goto out;
 
     args = libxl__build_device_model_args(gc, "stubdom-dm",
-                                          guest_config, info,
-                                          disks, num_disks,
-                                          vifs, num_vifs);
+                                          guest_config, info);
     if (!args) {
         ret = ERROR_FAIL;
         goto out;
@@ -674,20 +679,20 @@
         if (errno == EAGAIN)
             goto retry_transaction;
 
-    for (i = 0; i < num_disks; i++) {
-        ret = libxl_device_disk_add(ctx, domid, &disks[i]);
+    for (i = 0; i < dm_config.num_disks; i++) {
+        ret = libxl_device_disk_add(ctx, domid, &dm_config.disks[i]);
         if (ret)
             goto out_free;
     }
-    for (i = 0; i < num_vifs; i++) {
-        ret = libxl_device_nic_add(ctx, domid, &vifs[i]);
+    for (i = 0; i < dm_config.num_vifs; i++) {
+        ret = libxl_device_nic_add(ctx, domid, &dm_config.vifs[i]);
         if (ret)
             goto out_free;
     }
-    ret = libxl_device_vfb_add(ctx, domid, vfb);
+    ret = libxl_device_vfb_add(ctx, domid, &dm_config.vfbs[0]);
     if (ret)
         goto out_free;
-    ret = libxl_device_vkb_add(ctx, domid, vkb);
+    ret = libxl_device_vkb_add(ctx, domid, &dm_config.vkbs[0]);
     if (ret)
         goto out_free;
 
@@ -745,7 +750,7 @@
     if (libxl__create_xenpv_qemu(gc, domid,
                                  &dm_config,
                                  &xenpv_dm_info,
-                                 vfb, &dm_starting) < 0) {
+                                 &dm_starting) < 0) {
         ret = ERROR_FAIL;
         goto out_free;
     }
@@ -775,8 +780,6 @@
 int libxl__create_device_model(libxl__gc *gc,
                               libxl_domain_config *guest_config,
                               libxl_device_model_info *info,
-                              libxl_device_disk *disks, int num_disks,
-                              libxl_device_nic *vifs, int num_vifs,
                               libxl__spawner_starting **starting_r)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
@@ -791,14 +794,7 @@
     const char *dm;
 
     if (info->device_model_stubdomain) {
-        libxl_device_vfb vfb;
-        libxl_device_vkb vkb;
-
-        libxl__vfb_and_vkb_from_device_model_info(gc, info, &vfb, &vkb);
-        rc = libxl__create_stubdom(gc, guest_config, info,
-                                   disks, num_disks,
-                                   vifs, num_vifs,
-                                   &vfb, &vkb, starting_r);
+        rc = libxl__create_stubdom(gc, guest_config, info, starting_r);
         goto out;
     }
 
@@ -813,9 +809,7 @@
         rc = ERROR_FAIL;
         goto out;
     }
-    args = libxl__build_device_model_args(gc, dm, guest_config, info,
-                                          disks, num_disks,
-                                          vifs, num_vifs);
+    args = libxl__build_device_model_args(gc, dm, guest_config, info);
     if (!args) {
         rc = ERROR_FAIL;
         goto out;
@@ -1036,11 +1030,10 @@
 int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
                              libxl_domain_config *guest_config,
                              libxl_device_model_info *info,
-                             libxl_device_vfb *vfb,
                              libxl__spawner_starting **starting_r)
 {
-    libxl__build_xenpv_qemu_args(gc, domid, vfb, info);
-    libxl__create_device_model(gc, guest_config, info, NULL, 0, NULL, 0, starting_r);
+    libxl__build_xenpv_qemu_args(gc, domid, &guest_config->vfbs[0], info);
+    libxl__create_device_model(gc, guest_config, info, starting_r);
     return 0;
 }
 
diff -r 919ad96e3e28 -r 05435cdb21d3 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Tue Jan 31 15:21:51 2012 +0000
@@ -868,13 +868,10 @@
 _hidden int libxl__create_device_model(libxl__gc *gc,
                               libxl_domain_config *guest_config,
                               libxl_device_model_info *info,
-                              libxl_device_disk *disks, int num_disks,
-                              libxl_device_nic *vifs, int num_vifs,
                               libxl__spawner_starting **starting_r);
 _hidden int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
                               libxl_domain_config *guest_config,
                               libxl_device_model_info *dm_info,
-                              libxl_device_vfb *vfb,
                               libxl__spawner_starting **starting_r);
 _hidden int libxl__need_xenpv_qemu(libxl__gc *gc,
         int nr_consoles, libxl_device_console *consoles,

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:02 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8s-0007i9-4g; Fri, 03 Feb 2012 21:58:02 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8q-0007gN-08
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:00 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-27.messagelabs.com!1328306222!55318792!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16992 invoked from network); 3 Feb 2012 21:57:03 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:03 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8n-0001nT-07
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:57 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8l-0002xt-PN
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:56 +0000
Message-Id: <E1RtR8l-0002xt-PN@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:55 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: now that dm creation takes
	domain_config stop passing down devices.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328023311 0
# Node ID 05435cdb21d323c2865cdd883fa0a7c2cdcdec0b
# Parent  919ad96e3e2886bc5171bfed5205ad56a2390a5b
libxl: now that dm creation takes domain_config stop passing down devices.

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


diff -r 919ad96e3e28 -r 05435cdb21d3 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 15:21:51 2012 +0000
@@ -572,8 +572,6 @@
 
         dm_info->domid = domid;
         ret = libxl__create_device_model(gc, d_config, dm_info,
-                                        d_config->disks, d_config->num_disks,
-                                        d_config->vifs, d_config->num_vifs,
                                         &dm_starting);
         if (ret < 0) {
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
@@ -619,8 +617,7 @@
             xenpv_dm_info.extra_hvm = d_config->dm_info.extra_hvm;
 
             libxl__create_xenpv_qemu(gc, domid,
-                                     d_config, &xenpv_dm_info,
-                                     d_config->vfbs, &dm_starting);
+                                     d_config, &xenpv_dm_info, &dm_starting);
         }
         break;
     }
diff -r 919ad96e3e28 -r 05435cdb21d3 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:51 2012 +0000
@@ -76,10 +76,10 @@
 static char ** libxl__build_device_model_args_old(libxl__gc *gc,
                                         const char *dm,
                                         const libxl_domain_config *guest_config,
-                                        const libxl_device_model_info *info,
-                                        const libxl_device_disk *disks, int num_disks,
-                                        const libxl_device_nic *vifs, int num_vifs)
+                                        const libxl_device_model_info *info)
 {
+    const libxl_device_nic *vifs = guest_config->vifs;
+    const int num_vifs = guest_config->num_vifs;
     int i;
     flexarray_t *dm_args;
     dm_args = flexarray_make(16, 1);
@@ -231,11 +231,13 @@
 static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                                         const char *dm,
                                         const libxl_domain_config *guest_config,
-                                        const libxl_device_model_info *info,
-                                        const libxl_device_disk *disks, int num_disks,
-                                        const libxl_device_nic *vifs, int num_vifs)
+                                        const libxl_device_model_info *info)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
+    const libxl_device_disk *disks = guest_config->disks;
+    const libxl_device_nic *vifs = guest_config->vifs;
+    const int num_disks = guest_config->num_disks;
+    const int num_vifs = guest_config->num_vifs;
     flexarray_t *dm_args;
     int i;
 
@@ -496,21 +498,15 @@
 static char ** libxl__build_device_model_args(libxl__gc *gc,
                                         const char *dm,
                                         const libxl_domain_config *guest_config,
-                                        const libxl_device_model_info *info,
-                                        const libxl_device_disk *disks, int num_disks,
-                                        const libxl_device_nic *vifs, int num_vifs)
+                                        const libxl_device_model_info *info)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
 
     switch (info->device_model_version) {
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
-        return libxl__build_device_model_args_old(gc, dm, guest_config, info,
-                                                  disks, num_disks,
-                                                  vifs, num_vifs);
+        return libxl__build_device_model_args_old(gc, dm, guest_config, info);
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
-        return libxl__build_device_model_args_new(gc, dm, guest_config, info,
-                                                  disks, num_disks,
-                                                  vifs, num_vifs);
+        return libxl__build_device_model_args_new(gc, dm, guest_config, info);
     default:
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unknown device model version %d",
                          info->device_model_version);
@@ -588,16 +584,14 @@
 static int libxl__create_stubdom(libxl__gc *gc,
                                  libxl_domain_config *guest_config,
                                  libxl_device_model_info *info,
-                                 libxl_device_disk *disks, int num_disks,
-                                 libxl_device_nic *vifs, int num_vifs,
-                                 libxl_device_vfb *vfb,
-                                 libxl_device_vkb *vkb,
                                  libxl__spawner_starting **starting_r)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int i, num_console = STUBDOM_SPECIAL_CONSOLES, ret;
     libxl_device_console *console;
     libxl_domain_config dm_config;
+    libxl_device_vfb vfb;
+    libxl_device_vkb vkb;
     libxl__domain_build_state state;
     uint32_t domid;
     char **args;
@@ -629,6 +623,19 @@
     dm_config.b_info.u.pv.ramdisk.path = "";
     dm_config.b_info.u.pv.features = "";
 
+    dm_config.disks = guest_config->disks;
+    dm_config.num_disks = guest_config->num_disks;
+
+    dm_config.vifs = guest_config->vifs;
+    dm_config.num_vifs = guest_config->num_vifs;
+
+    libxl__vfb_and_vkb_from_device_model_info(gc, info, &vfb, &vkb);
+
+    dm_config.vfbs = &vfb;
+    dm_config.num_vfbs = 1;
+    dm_config.vkbs = &vkb;
+    dm_config.num_vkbs = 1;
+
     /* fixme: this function can leak the stubdom if it fails */
     domid = 0;
     ret = libxl__domain_make(gc, &dm_config.c_info, &domid);
@@ -639,9 +646,7 @@
         goto out;
 
     args = libxl__build_device_model_args(gc, "stubdom-dm",
-                                          guest_config, info,
-                                          disks, num_disks,
-                                          vifs, num_vifs);
+                                          guest_config, info);
     if (!args) {
         ret = ERROR_FAIL;
         goto out;
@@ -674,20 +679,20 @@
         if (errno == EAGAIN)
             goto retry_transaction;
 
-    for (i = 0; i < num_disks; i++) {
-        ret = libxl_device_disk_add(ctx, domid, &disks[i]);
+    for (i = 0; i < dm_config.num_disks; i++) {
+        ret = libxl_device_disk_add(ctx, domid, &dm_config.disks[i]);
         if (ret)
             goto out_free;
     }
-    for (i = 0; i < num_vifs; i++) {
-        ret = libxl_device_nic_add(ctx, domid, &vifs[i]);
+    for (i = 0; i < dm_config.num_vifs; i++) {
+        ret = libxl_device_nic_add(ctx, domid, &dm_config.vifs[i]);
         if (ret)
             goto out_free;
     }
-    ret = libxl_device_vfb_add(ctx, domid, vfb);
+    ret = libxl_device_vfb_add(ctx, domid, &dm_config.vfbs[0]);
     if (ret)
         goto out_free;
-    ret = libxl_device_vkb_add(ctx, domid, vkb);
+    ret = libxl_device_vkb_add(ctx, domid, &dm_config.vkbs[0]);
     if (ret)
         goto out_free;
 
@@ -745,7 +750,7 @@
     if (libxl__create_xenpv_qemu(gc, domid,
                                  &dm_config,
                                  &xenpv_dm_info,
-                                 vfb, &dm_starting) < 0) {
+                                 &dm_starting) < 0) {
         ret = ERROR_FAIL;
         goto out_free;
     }
@@ -775,8 +780,6 @@
 int libxl__create_device_model(libxl__gc *gc,
                               libxl_domain_config *guest_config,
                               libxl_device_model_info *info,
-                              libxl_device_disk *disks, int num_disks,
-                              libxl_device_nic *vifs, int num_vifs,
                               libxl__spawner_starting **starting_r)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
@@ -791,14 +794,7 @@
     const char *dm;
 
     if (info->device_model_stubdomain) {
-        libxl_device_vfb vfb;
-        libxl_device_vkb vkb;
-
-        libxl__vfb_and_vkb_from_device_model_info(gc, info, &vfb, &vkb);
-        rc = libxl__create_stubdom(gc, guest_config, info,
-                                   disks, num_disks,
-                                   vifs, num_vifs,
-                                   &vfb, &vkb, starting_r);
+        rc = libxl__create_stubdom(gc, guest_config, info, starting_r);
         goto out;
     }
 
@@ -813,9 +809,7 @@
         rc = ERROR_FAIL;
         goto out;
     }
-    args = libxl__build_device_model_args(gc, dm, guest_config, info,
-                                          disks, num_disks,
-                                          vifs, num_vifs);
+    args = libxl__build_device_model_args(gc, dm, guest_config, info);
     if (!args) {
         rc = ERROR_FAIL;
         goto out;
@@ -1036,11 +1030,10 @@
 int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
                              libxl_domain_config *guest_config,
                              libxl_device_model_info *info,
-                             libxl_device_vfb *vfb,
                              libxl__spawner_starting **starting_r)
 {
-    libxl__build_xenpv_qemu_args(gc, domid, vfb, info);
-    libxl__create_device_model(gc, guest_config, info, NULL, 0, NULL, 0, starting_r);
+    libxl__build_xenpv_qemu_args(gc, domid, &guest_config->vfbs[0], info);
+    libxl__create_device_model(gc, guest_config, info, starting_r);
     return 0;
 }
 
diff -r 919ad96e3e28 -r 05435cdb21d3 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Tue Jan 31 15:21:51 2012 +0000
@@ -868,13 +868,10 @@
 _hidden int libxl__create_device_model(libxl__gc *gc,
                               libxl_domain_config *guest_config,
                               libxl_device_model_info *info,
-                              libxl_device_disk *disks, int num_disks,
-                              libxl_device_nic *vifs, int num_vifs,
                               libxl__spawner_starting **starting_r);
 _hidden int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
                               libxl_domain_config *guest_config,
                               libxl_device_model_info *dm_info,
-                              libxl_device_vfb *vfb,
                               libxl__spawner_starting **starting_r);
 _hidden int libxl__need_xenpv_qemu(libxl__gc *gc,
         int nr_consoles, libxl_device_console *consoles,

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:03 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8t-0007jI-83; Fri, 03 Feb 2012 21:58:03 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8r-0007e8-1K
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:01 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-27.messagelabs.com!1328306218!55318787!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16937 invoked from network); 3 Feb 2012 21:56:59 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:59 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8j-0001nG-AC
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:53 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8e-0002vW-WC
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:50 +0000
Message-Id: <E1RtR8e-0002vW-WC@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:46 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: define libxl_sdl_info to hold
	all info about the SDL config
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328020860 0
# Node ID 9f0c4da3cbef636e730280f6755f5968873b2344
# Parent  5d9e86d7e448f365daa05f1f1b6d70948e927400
libxl: define libxl_sdl_info to hold all info about the SDL config

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


diff -r 5d9e86d7e448 -r 9f0c4da3cbef tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Jan 31 14:41:00 2012 +0000
@@ -2188,16 +2188,16 @@
 int libxl_device_vfb_init(libxl_ctx *ctx, libxl_device_vfb *vfb)
 {
     memset(vfb, 0x00, sizeof(libxl_device_vfb));
-    vfb->display = NULL;
-    vfb->xauthority = NULL;
     vfb->vnc.enable = 1;
     vfb->vnc.passwd = NULL;
     vfb->vnc.listen = strdup("127.0.0.1");
     vfb->vnc.display = 0;
     vfb->vnc.findunused = 1;
     vfb->keymap = NULL;
-    vfb->sdl = 0;
-    vfb->opengl = 0;
+    vfb->sdl.enable = 0;
+    vfb->sdl.opengl = 0;
+    vfb->sdl.display = NULL;
+    vfb->sdl.xauthority = NULL;
     return 0;
 }
 
@@ -2248,16 +2248,19 @@
                           libxl__sprintf(gc, "%d", vfb->vnc.display));
     flexarray_append_pair(back, "vncunused",
                           libxl__sprintf(gc, "%d", vfb->vnc.findunused));
-    flexarray_append_pair(back, "sdl", libxl__sprintf(gc, "%d", vfb->sdl));
-    flexarray_append_pair(back, "opengl", libxl__sprintf(gc, "%d", vfb->opengl));
-    if (vfb->xauthority) {
-        flexarray_append_pair(back, "xauthority", vfb->xauthority);
+    flexarray_append_pair(back, "sdl",
+                          libxl__sprintf(gc, "%d", vfb->sdl.enable));
+    flexarray_append_pair(back, "opengl",
+                          libxl__sprintf(gc, "%d", vfb->sdl.opengl));
+    if (vfb->sdl.xauthority) {
+        flexarray_append_pair(back, "xauthority", vfb->sdl.xauthority);
     }
-    if (vfb->display) {
-        flexarray_append_pair(back, "display", vfb->display);
+    if (vfb->sdl.display) {
+        flexarray_append_pair(back, "display", vfb->sdl.display);
     }
 
-    flexarray_append_pair(front, "backend-id", libxl__sprintf(gc, "%d", vfb->backend_domid));
+    flexarray_append_pair(front, "backend-id",
+                          libxl__sprintf(gc, "%d", vfb->backend_domid));
     flexarray_append_pair(front, "state", libxl__sprintf(gc, "%d", 1));
 
     libxl__device_generic_add(gc, &device,
diff -r 5d9e86d7e448 -r 9f0c4da3cbef tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 14:41:00 2012 +0000
@@ -134,8 +134,8 @@
     dm_info->vnc.display = 0;
     dm_info->vnc.findunused = 1;
     dm_info->keymap = NULL;
-    dm_info->sdl = 0;
-    dm_info->opengl = 0;
+    dm_info->sdl.enable = 0;
+    dm_info->sdl.opengl = 0;
     dm_info->nographic = 0;
     dm_info->serial = NULL;
     dm_info->boot = strdup("cda");
diff -r 5d9e86d7e448 -r 9f0c4da3cbef tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 14:41:00 2012 +0000
@@ -120,16 +120,17 @@
             flexarray_append(dm_args, "-vncunused");
         }
     }
-    if (info->sdl) {
+    if (info->sdl.enable) {
         flexarray_append(dm_args, "-sdl");
-        if (!info->opengl) {
+        if (!info->sdl.opengl) {
             flexarray_append(dm_args, "-disable-opengl");
         }
+        /* XXX info->sdl.{display,xauthority} into $DISPLAY/$XAUTHORITY */
     }
     if (info->keymap) {
         flexarray_vappend(dm_args, "-k", info->keymap, NULL);
     }
-    if (info->nographic && (!info->sdl && !info->vnc.enable)) {
+    if (info->nographic && (!info->sdl.enable && !info->vnc.enable)) {
         flexarray_append(dm_args, "-nographic");
     }
     if (info->serial) {
@@ -287,8 +288,9 @@
                     libxl__sprintf(gc, "%s:%d%s", listen, display,
                         info->vnc.findunused ? ",to=99" : ""));
     }
-    if (info->sdl) {
+    if (info->sdl.enable) {
         flexarray_append(dm_args, "-sdl");
+        /* XXX info->sdl.{display,xauthority} into $DISPLAY/$XAUTHORITY */
     }
     if (info->spice.enable) {
         char *spiceoptions = NULL;
@@ -335,7 +337,7 @@
     if (info->keymap) {
         flexarray_vappend(dm_args, "-k", info->keymap, NULL);
     }
-    if (info->nographic && (!info->sdl && !info->vnc.enable)) {
+    if (info->nographic && (!info->sdl.enable && !info->vnc.enable)) {
         flexarray_append(dm_args, "-nographic");
     }
     if (info->serial) {
@@ -526,7 +528,6 @@
     vfb->vnc = info->vnc;
     vfb->keymap = info->keymap;
     vfb->sdl = info->sdl;
-    vfb->opengl = info->opengl;
 
     vkb->backend_domid = 0;
     vkb->devid = 0;
@@ -981,7 +982,6 @@
         if (vfb->keymap)
             info->keymap = libxl__strdup(gc, vfb->keymap);
         info->sdl = vfb->sdl;
-        info->opengl = vfb->opengl;
     } else
         info->nographic = 1;
     info->domid = domid;
diff -r 5d9e86d7e448 -r 9f0c4da3cbef tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 14:41:00 2012 +0000
@@ -251,8 +251,7 @@
     ("vnc",              libxl_vnc_info),
     # keyboard layout, default is en-us keyboard
     ("keymap",           string),
-    ("sdl",              bool),
-    ("opengl",           bool), # (requires sdl enabled)
+    ("sdl",              libxl_sdl_info),
     ("spice",            libxl_spice_info),
     ("nographic",        bool),
     ("gfx_passthru",     bool),
@@ -279,12 +278,9 @@
     ("backend_domid", libxl_domid),
     ("devid",         integer),
     ("vnc",           libxl_vnc_info),
+    ("sdl",           libxl_sdl_info),
     # set keyboard layout, default is en-us keyboard
     ("keymap",        string),
-    ("sdl",           bool),
-    ("opengl",        bool), # (if enabled requires sdl enabled)
-    ("display",       string),
-    ("xauthority",    string),
     ])
 
 libxl_device_vkb = Struct("device_vkb", [
diff -r 5d9e86d7e448 -r 9f0c4da3cbef tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 14:41:00 2012 +0000
@@ -372,9 +372,9 @@
         printf("\t\t\t(vncdisplay %d)\n", dm_info->vnc.display);
         printf("\t\t\t(vncunused %d)\n", dm_info->vnc.findunused);
         printf("\t\t\t(keymap %s)\n", dm_info->keymap);
-        printf("\t\t\t(sdl %d)\n", dm_info->sdl);
+        printf("\t\t\t(sdl %d)\n", dm_info->sdl.enable);
         printf("\t\t\t(gfx_passthru %d)\n", dm_info->gfx_passthru);
-        printf("\t\t\t(opengl %d)\n", dm_info->opengl);
+        printf("\t\t\t(opengl %d)\n", dm_info->sdl.opengl);
         printf("\t\t\t(nographic %d)\n", dm_info->nographic);
         printf("\t\t\t(serial %s)\n", dm_info->serial);
         printf("\t\t\t(boot %s)\n", dm_info->boot);
@@ -462,10 +462,10 @@
         printf("\t\t\t(vncdisplay %d)\n", d_config->vfbs[i].vnc.display);
         printf("\t\t\t(vncunused %d)\n", d_config->vfbs[i].vnc.findunused);
         printf("\t\t\t(keymap %s)\n", d_config->vfbs[i].keymap);
-        printf("\t\t\t(sdl %d)\n", d_config->vfbs[i].sdl);
-        printf("\t\t\t(opengl %d)\n", d_config->vfbs[i].opengl);
-        printf("\t\t\t(display %s)\n", d_config->vfbs[i].display);
-        printf("\t\t\t(xauthority %s)\n", d_config->vfbs[i].xauthority);
+        printf("\t\t\t(sdl %d)\n", d_config->vfbs[i].sdl.enable);
+        printf("\t\t\t(opengl %d)\n", d_config->vfbs[i].sdl.opengl);
+        printf("\t\t\t(display %s)\n", d_config->vfbs[i].sdl.display);
+        printf("\t\t\t(xauthority %s)\n", d_config->vfbs[i].sdl.xauthority);
         printf("\t\t)\n");
         printf("\t)\n");
     }
@@ -1060,15 +1060,15 @@
                     free(vfb->keymap);
                     vfb->keymap = strdup(p2 + 1);
                 } else if (!strcmp(p, "sdl")) {
-                    vfb->sdl = atoi(p2 + 1);
+                    vfb->sdl.enable = atoi(p2 + 1);
                 } else if (!strcmp(p, "opengl")) {
-                    vfb->opengl = atoi(p2 + 1);
+                    vfb->sdl.opengl = atoi(p2 + 1);
                 } else if (!strcmp(p, "display")) {
-                    free(vfb->display);
-                    vfb->display = strdup(p2 + 1);
+                    free(vfb->sdl.display);
+                    vfb->sdl.display = strdup(p2 + 1);
                 } else if (!strcmp(p, "xauthority")) {
-                    free(vfb->xauthority);
-                    vfb->xauthority = strdup(p2 + 1);
+                    free(vfb->sdl.xauthority);
+                    vfb->sdl.xauthority = strdup(p2 + 1);
                 }
             } while ((p = strtok(NULL, ",")) != NULL);
 skip_vfb:
@@ -1271,9 +1271,9 @@
             dm_info->vnc.findunused = l;
         xlu_cfg_replace_string (config, "keymap", &dm_info->keymap, 0);
         if (!xlu_cfg_get_long (config, "sdl", &l, 0))
-            dm_info->sdl = l;
+            dm_info->sdl.enable = l;
         if (!xlu_cfg_get_long (config, "opengl", &l, 0))
-            dm_info->opengl = l;
+            dm_info->sdl.opengl = l;
         if (!xlu_cfg_get_long (config, "spice", &l, 0))
             dm_info->spice.enable = l;
         if (!xlu_cfg_get_long (config, "spiceport", &l, 0))

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:03 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8t-0007jI-83; Fri, 03 Feb 2012 21:58:03 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8r-0007e8-1K
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:01 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-27.messagelabs.com!1328306218!55318787!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16937 invoked from network); 3 Feb 2012 21:56:59 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:59 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8j-0001nG-AC
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:53 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8e-0002vW-WC
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:50 +0000
Message-Id: <E1RtR8e-0002vW-WC@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:46 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: define libxl_sdl_info to hold
	all info about the SDL config
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328020860 0
# Node ID 9f0c4da3cbef636e730280f6755f5968873b2344
# Parent  5d9e86d7e448f365daa05f1f1b6d70948e927400
libxl: define libxl_sdl_info to hold all info about the SDL config

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


diff -r 5d9e86d7e448 -r 9f0c4da3cbef tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Jan 31 14:41:00 2012 +0000
@@ -2188,16 +2188,16 @@
 int libxl_device_vfb_init(libxl_ctx *ctx, libxl_device_vfb *vfb)
 {
     memset(vfb, 0x00, sizeof(libxl_device_vfb));
-    vfb->display = NULL;
-    vfb->xauthority = NULL;
     vfb->vnc.enable = 1;
     vfb->vnc.passwd = NULL;
     vfb->vnc.listen = strdup("127.0.0.1");
     vfb->vnc.display = 0;
     vfb->vnc.findunused = 1;
     vfb->keymap = NULL;
-    vfb->sdl = 0;
-    vfb->opengl = 0;
+    vfb->sdl.enable = 0;
+    vfb->sdl.opengl = 0;
+    vfb->sdl.display = NULL;
+    vfb->sdl.xauthority = NULL;
     return 0;
 }
 
@@ -2248,16 +2248,19 @@
                           libxl__sprintf(gc, "%d", vfb->vnc.display));
     flexarray_append_pair(back, "vncunused",
                           libxl__sprintf(gc, "%d", vfb->vnc.findunused));
-    flexarray_append_pair(back, "sdl", libxl__sprintf(gc, "%d", vfb->sdl));
-    flexarray_append_pair(back, "opengl", libxl__sprintf(gc, "%d", vfb->opengl));
-    if (vfb->xauthority) {
-        flexarray_append_pair(back, "xauthority", vfb->xauthority);
+    flexarray_append_pair(back, "sdl",
+                          libxl__sprintf(gc, "%d", vfb->sdl.enable));
+    flexarray_append_pair(back, "opengl",
+                          libxl__sprintf(gc, "%d", vfb->sdl.opengl));
+    if (vfb->sdl.xauthority) {
+        flexarray_append_pair(back, "xauthority", vfb->sdl.xauthority);
     }
-    if (vfb->display) {
-        flexarray_append_pair(back, "display", vfb->display);
+    if (vfb->sdl.display) {
+        flexarray_append_pair(back, "display", vfb->sdl.display);
     }
 
-    flexarray_append_pair(front, "backend-id", libxl__sprintf(gc, "%d", vfb->backend_domid));
+    flexarray_append_pair(front, "backend-id",
+                          libxl__sprintf(gc, "%d", vfb->backend_domid));
     flexarray_append_pair(front, "state", libxl__sprintf(gc, "%d", 1));
 
     libxl__device_generic_add(gc, &device,
diff -r 5d9e86d7e448 -r 9f0c4da3cbef tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 14:41:00 2012 +0000
@@ -134,8 +134,8 @@
     dm_info->vnc.display = 0;
     dm_info->vnc.findunused = 1;
     dm_info->keymap = NULL;
-    dm_info->sdl = 0;
-    dm_info->opengl = 0;
+    dm_info->sdl.enable = 0;
+    dm_info->sdl.opengl = 0;
     dm_info->nographic = 0;
     dm_info->serial = NULL;
     dm_info->boot = strdup("cda");
diff -r 5d9e86d7e448 -r 9f0c4da3cbef tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 14:41:00 2012 +0000
@@ -120,16 +120,17 @@
             flexarray_append(dm_args, "-vncunused");
         }
     }
-    if (info->sdl) {
+    if (info->sdl.enable) {
         flexarray_append(dm_args, "-sdl");
-        if (!info->opengl) {
+        if (!info->sdl.opengl) {
             flexarray_append(dm_args, "-disable-opengl");
         }
+        /* XXX info->sdl.{display,xauthority} into $DISPLAY/$XAUTHORITY */
     }
     if (info->keymap) {
         flexarray_vappend(dm_args, "-k", info->keymap, NULL);
     }
-    if (info->nographic && (!info->sdl && !info->vnc.enable)) {
+    if (info->nographic && (!info->sdl.enable && !info->vnc.enable)) {
         flexarray_append(dm_args, "-nographic");
     }
     if (info->serial) {
@@ -287,8 +288,9 @@
                     libxl__sprintf(gc, "%s:%d%s", listen, display,
                         info->vnc.findunused ? ",to=99" : ""));
     }
-    if (info->sdl) {
+    if (info->sdl.enable) {
         flexarray_append(dm_args, "-sdl");
+        /* XXX info->sdl.{display,xauthority} into $DISPLAY/$XAUTHORITY */
     }
     if (info->spice.enable) {
         char *spiceoptions = NULL;
@@ -335,7 +337,7 @@
     if (info->keymap) {
         flexarray_vappend(dm_args, "-k", info->keymap, NULL);
     }
-    if (info->nographic && (!info->sdl && !info->vnc.enable)) {
+    if (info->nographic && (!info->sdl.enable && !info->vnc.enable)) {
         flexarray_append(dm_args, "-nographic");
     }
     if (info->serial) {
@@ -526,7 +528,6 @@
     vfb->vnc = info->vnc;
     vfb->keymap = info->keymap;
     vfb->sdl = info->sdl;
-    vfb->opengl = info->opengl;
 
     vkb->backend_domid = 0;
     vkb->devid = 0;
@@ -981,7 +982,6 @@
         if (vfb->keymap)
             info->keymap = libxl__strdup(gc, vfb->keymap);
         info->sdl = vfb->sdl;
-        info->opengl = vfb->opengl;
     } else
         info->nographic = 1;
     info->domid = domid;
diff -r 5d9e86d7e448 -r 9f0c4da3cbef tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 14:41:00 2012 +0000
@@ -251,8 +251,7 @@
     ("vnc",              libxl_vnc_info),
     # keyboard layout, default is en-us keyboard
     ("keymap",           string),
-    ("sdl",              bool),
-    ("opengl",           bool), # (requires sdl enabled)
+    ("sdl",              libxl_sdl_info),
     ("spice",            libxl_spice_info),
     ("nographic",        bool),
     ("gfx_passthru",     bool),
@@ -279,12 +278,9 @@
     ("backend_domid", libxl_domid),
     ("devid",         integer),
     ("vnc",           libxl_vnc_info),
+    ("sdl",           libxl_sdl_info),
     # set keyboard layout, default is en-us keyboard
     ("keymap",        string),
-    ("sdl",           bool),
-    ("opengl",        bool), # (if enabled requires sdl enabled)
-    ("display",       string),
-    ("xauthority",    string),
     ])
 
 libxl_device_vkb = Struct("device_vkb", [
diff -r 5d9e86d7e448 -r 9f0c4da3cbef tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 14:41:00 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 14:41:00 2012 +0000
@@ -372,9 +372,9 @@
         printf("\t\t\t(vncdisplay %d)\n", dm_info->vnc.display);
         printf("\t\t\t(vncunused %d)\n", dm_info->vnc.findunused);
         printf("\t\t\t(keymap %s)\n", dm_info->keymap);
-        printf("\t\t\t(sdl %d)\n", dm_info->sdl);
+        printf("\t\t\t(sdl %d)\n", dm_info->sdl.enable);
         printf("\t\t\t(gfx_passthru %d)\n", dm_info->gfx_passthru);
-        printf("\t\t\t(opengl %d)\n", dm_info->opengl);
+        printf("\t\t\t(opengl %d)\n", dm_info->sdl.opengl);
         printf("\t\t\t(nographic %d)\n", dm_info->nographic);
         printf("\t\t\t(serial %s)\n", dm_info->serial);
         printf("\t\t\t(boot %s)\n", dm_info->boot);
@@ -462,10 +462,10 @@
         printf("\t\t\t(vncdisplay %d)\n", d_config->vfbs[i].vnc.display);
         printf("\t\t\t(vncunused %d)\n", d_config->vfbs[i].vnc.findunused);
         printf("\t\t\t(keymap %s)\n", d_config->vfbs[i].keymap);
-        printf("\t\t\t(sdl %d)\n", d_config->vfbs[i].sdl);
-        printf("\t\t\t(opengl %d)\n", d_config->vfbs[i].opengl);
-        printf("\t\t\t(display %s)\n", d_config->vfbs[i].display);
-        printf("\t\t\t(xauthority %s)\n", d_config->vfbs[i].xauthority);
+        printf("\t\t\t(sdl %d)\n", d_config->vfbs[i].sdl.enable);
+        printf("\t\t\t(opengl %d)\n", d_config->vfbs[i].sdl.opengl);
+        printf("\t\t\t(display %s)\n", d_config->vfbs[i].sdl.display);
+        printf("\t\t\t(xauthority %s)\n", d_config->vfbs[i].sdl.xauthority);
         printf("\t\t)\n");
         printf("\t)\n");
     }
@@ -1060,15 +1060,15 @@
                     free(vfb->keymap);
                     vfb->keymap = strdup(p2 + 1);
                 } else if (!strcmp(p, "sdl")) {
-                    vfb->sdl = atoi(p2 + 1);
+                    vfb->sdl.enable = atoi(p2 + 1);
                 } else if (!strcmp(p, "opengl")) {
-                    vfb->opengl = atoi(p2 + 1);
+                    vfb->sdl.opengl = atoi(p2 + 1);
                 } else if (!strcmp(p, "display")) {
-                    free(vfb->display);
-                    vfb->display = strdup(p2 + 1);
+                    free(vfb->sdl.display);
+                    vfb->sdl.display = strdup(p2 + 1);
                 } else if (!strcmp(p, "xauthority")) {
-                    free(vfb->xauthority);
-                    vfb->xauthority = strdup(p2 + 1);
+                    free(vfb->sdl.xauthority);
+                    vfb->sdl.xauthority = strdup(p2 + 1);
                 }
             } while ((p = strtok(NULL, ",")) != NULL);
 skip_vfb:
@@ -1271,9 +1271,9 @@
             dm_info->vnc.findunused = l;
         xlu_cfg_replace_string (config, "keymap", &dm_info->keymap, 0);
         if (!xlu_cfg_get_long (config, "sdl", &l, 0))
-            dm_info->sdl = l;
+            dm_info->sdl.enable = l;
         if (!xlu_cfg_get_long (config, "opengl", &l, 0))
-            dm_info->opengl = l;
+            dm_info->sdl.opengl = l;
         if (!xlu_cfg_get_long (config, "spice", &l, 0))
             dm_info->spice.enable = l;
         if (!xlu_cfg_get_long (config, "spiceport", &l, 0))

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:03 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8t-0007jU-AP; Fri, 03 Feb 2012 21:58:03 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8r-0007hI-6a
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:01 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-27.messagelabs.com!1328306160!62474792!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10714 invoked from network); 3 Feb 2012 21:56:01 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:01 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8o-0001nW-Eq
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:58 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8n-0002yf-Gc
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:58 +0000
Message-Id: <E1RtR8n-0002yf-Gc@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:56 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: remove redundant info from dm
	info.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328023311 0
# Node ID 6cf421073cabaa219a70ae4f04b517e99a90f7d4
# Parent  05435cdb21d323c2865cdd883fa0a7c2cdcdec0b
libxl: remove redundant info from dm info.

Remove "target_ram", "acpi", "vcpus" and "vcpu_avail" from device model info
and use domain_build_info instead. These must all be consistently specified to
both the domain and the device model, there is no need (and a great deal of
danger) in exposing a way for a user of libxl to set them differently.

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


diff -r 05435cdb21d3 -r 6cf421073cab tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 15:21:51 2012 +0000
@@ -122,11 +122,7 @@
     dm_info->device_model_version = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
     dm_info->device_model_stubdomain = false;
     dm_info->device_model = NULL;
-    dm_info->target_ram = libxl__sizekb_to_mb(b_info->target_memkb);
     dm_info->videoram = libxl__sizekb_to_mb(b_info->video_memkb);
-    dm_info->acpi = b_info->u.hvm.acpi;
-    dm_info->vcpus = b_info->max_vcpus;
-    dm_info->vcpu_avail = b_info->cur_vcpus;
 
     dm_info->stdvga = 0;
     dm_info->vnc.enable = 1;
diff -r 05435cdb21d3 -r 6cf421073cab tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:51 2012 +0000
@@ -78,6 +78,7 @@
                                         const libxl_domain_config *guest_config,
                                         const libxl_device_model_info *info)
 {
+    const libxl_domain_build_info *b_info = &guest_config->b_info;
     const libxl_device_nic *vifs = guest_config->vifs;
     const int num_vifs = guest_config->num_vifs;
     int i;
@@ -159,14 +160,18 @@
         if (info->soundhw) {
             flexarray_vappend(dm_args, "-soundhw", info->soundhw, NULL);
         }
-        if (info->acpi) {
+        if (b_info->u.hvm.acpi) {
             flexarray_append(dm_args, "-acpi");
         }
-        if (info->vcpus > 1) {
-            flexarray_vappend(dm_args, "-vcpus", libxl__sprintf(gc, "%d", info->vcpus), NULL);
+        if (b_info->max_vcpus > 1) {
+            flexarray_vappend(dm_args, "-vcpus",
+                              libxl__sprintf(gc, "%d", b_info->max_vcpus),
+                              NULL);
         }
-        if (info->vcpu_avail) {
-            flexarray_vappend(dm_args, "-vcpu_avail", libxl__sprintf(gc, "0x%x", info->vcpu_avail), NULL);
+        if (b_info->cur_vcpus) {
+            flexarray_vappend(dm_args, "-vcpu_avail",
+                              libxl__sprintf(gc, "0x%x", b_info->cur_vcpus),
+                              NULL);
         }
         for (i = 0; i < num_vifs; i++) {
             if (vifs[i].nictype == LIBXL_NIC_TYPE_IOEMU) {
@@ -234,6 +239,7 @@
                                         const libxl_device_model_info *info)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
+    const libxl_domain_build_info *b_info = &guest_config->b_info;
     const libxl_device_disk *disks = guest_config->disks;
     const libxl_device_nic *vifs = guest_config->vifs;
     const int num_disks = guest_config->num_disks;
@@ -366,15 +372,18 @@
         if (info->soundhw) {
             flexarray_vappend(dm_args, "-soundhw", info->soundhw, NULL);
         }
-        if (!info->acpi) {
+        if (!b_info->u.hvm.acpi) {
             flexarray_append(dm_args, "-no-acpi");
         }
-        if (info->vcpus > 1) {
+        if (b_info->max_vcpus > 1) {
             flexarray_append(dm_args, "-smp");
-            if (info->vcpu_avail)
-                flexarray_append(dm_args, libxl__sprintf(gc, "%d,maxcpus=%d", info->vcpus, info->vcpu_avail));
+            if (b_info->cur_vcpus)
+                flexarray_append(dm_args, libxl__sprintf(gc, "%d,maxcpus=%d",
+                                                         b_info->max_vcpus,
+                                                         b_info->cur_vcpus));
             else
-                flexarray_append(dm_args, libxl__sprintf(gc, "%d", info->vcpus));
+                flexarray_append(dm_args, libxl__sprintf(gc, "%d",
+                                                         b_info->max_vcpus));
         }
         for (i = 0; i < num_vifs; i++) {
             if (vifs[i].nictype == LIBXL_NIC_TYPE_IOEMU) {
@@ -432,7 +441,9 @@
 
     /* RAM Size */
     flexarray_append(dm_args, "-m");
-    flexarray_append(dm_args, libxl__sprintf(gc, "%d", info->target_ram));
+    flexarray_append(dm_args,
+                     libxl__sprintf(gc, "%d",
+                                    libxl__sizekb_to_mb(b_info->target_memkb)));
 
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
         for (i = 0; i < num_disks; i++) {
diff -r 05435cdb21d3 -r 6cf421073cab tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:51 2012 +0000
@@ -244,7 +244,6 @@
     ("device_model",     string),
     ("saved_state",      string),
     ("type",             libxl_domain_type),
-    ("target_ram",       uint32),
     # size of the videoram in MB
     ("videoram",         integer), 
     ("stdvga",           bool),
@@ -261,9 +260,6 @@
     # usbdevice: "tablet" for absolute mouse, "mouse" for PS/2 protocol relative mouse
     ("usbdevice",        string),
     ("soundhw",          string),
-    ("acpi",             bool),
-    ("vcpus",            integer), # max number of vcpus
-    ("vcpu_avail",       integer), # vcpus actually available
     ("xen_platform_pci", bool),
     # extra parameters pass directly to qemu, NULL terminated
     ("extra",            libxl_string_list),
diff -r 05435cdb21d3 -r 6cf421073cab tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 15:21:51 2012 +0000
@@ -380,7 +380,6 @@
         printf("\t\t\t(boot %s)\n", dm_info->boot);
         printf("\t\t\t(usb %d)\n", dm_info->usb);
         printf("\t\t\t(usbdevice %s)\n", dm_info->usbdevice);
-        printf("\t\t\t(acpi %d)\n", dm_info->acpi);
         printf("\t\t\t(spice %d)\n", dm_info->spice.enable);
         printf("\t\t\t(spiceport %d)\n", dm_info->spice.port);
         printf("\t\t\t(spicetls_port %d)\n", dm_info->spice.tls_port);

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:03 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8t-0007jU-AP; Fri, 03 Feb 2012 21:58:03 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8r-0007hI-6a
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:01 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-27.messagelabs.com!1328306160!62474792!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10714 invoked from network); 3 Feb 2012 21:56:01 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:56:01 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8o-0001nW-Eq
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:58 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8n-0002yf-Gc
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:58 +0000
Message-Id: <E1RtR8n-0002yf-Gc@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:56 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: remove redundant info from dm
	info.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328023311 0
# Node ID 6cf421073cabaa219a70ae4f04b517e99a90f7d4
# Parent  05435cdb21d323c2865cdd883fa0a7c2cdcdec0b
libxl: remove redundant info from dm info.

Remove "target_ram", "acpi", "vcpus" and "vcpu_avail" from device model info
and use domain_build_info instead. These must all be consistently specified to
both the domain and the device model, there is no need (and a great deal of
danger) in exposing a way for a user of libxl to set them differently.

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


diff -r 05435cdb21d3 -r 6cf421073cab tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 15:21:51 2012 +0000
@@ -122,11 +122,7 @@
     dm_info->device_model_version = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
     dm_info->device_model_stubdomain = false;
     dm_info->device_model = NULL;
-    dm_info->target_ram = libxl__sizekb_to_mb(b_info->target_memkb);
     dm_info->videoram = libxl__sizekb_to_mb(b_info->video_memkb);
-    dm_info->acpi = b_info->u.hvm.acpi;
-    dm_info->vcpus = b_info->max_vcpus;
-    dm_info->vcpu_avail = b_info->cur_vcpus;
 
     dm_info->stdvga = 0;
     dm_info->vnc.enable = 1;
diff -r 05435cdb21d3 -r 6cf421073cab tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:51 2012 +0000
@@ -78,6 +78,7 @@
                                         const libxl_domain_config *guest_config,
                                         const libxl_device_model_info *info)
 {
+    const libxl_domain_build_info *b_info = &guest_config->b_info;
     const libxl_device_nic *vifs = guest_config->vifs;
     const int num_vifs = guest_config->num_vifs;
     int i;
@@ -159,14 +160,18 @@
         if (info->soundhw) {
             flexarray_vappend(dm_args, "-soundhw", info->soundhw, NULL);
         }
-        if (info->acpi) {
+        if (b_info->u.hvm.acpi) {
             flexarray_append(dm_args, "-acpi");
         }
-        if (info->vcpus > 1) {
-            flexarray_vappend(dm_args, "-vcpus", libxl__sprintf(gc, "%d", info->vcpus), NULL);
+        if (b_info->max_vcpus > 1) {
+            flexarray_vappend(dm_args, "-vcpus",
+                              libxl__sprintf(gc, "%d", b_info->max_vcpus),
+                              NULL);
         }
-        if (info->vcpu_avail) {
-            flexarray_vappend(dm_args, "-vcpu_avail", libxl__sprintf(gc, "0x%x", info->vcpu_avail), NULL);
+        if (b_info->cur_vcpus) {
+            flexarray_vappend(dm_args, "-vcpu_avail",
+                              libxl__sprintf(gc, "0x%x", b_info->cur_vcpus),
+                              NULL);
         }
         for (i = 0; i < num_vifs; i++) {
             if (vifs[i].nictype == LIBXL_NIC_TYPE_IOEMU) {
@@ -234,6 +239,7 @@
                                         const libxl_device_model_info *info)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
+    const libxl_domain_build_info *b_info = &guest_config->b_info;
     const libxl_device_disk *disks = guest_config->disks;
     const libxl_device_nic *vifs = guest_config->vifs;
     const int num_disks = guest_config->num_disks;
@@ -366,15 +372,18 @@
         if (info->soundhw) {
             flexarray_vappend(dm_args, "-soundhw", info->soundhw, NULL);
         }
-        if (!info->acpi) {
+        if (!b_info->u.hvm.acpi) {
             flexarray_append(dm_args, "-no-acpi");
         }
-        if (info->vcpus > 1) {
+        if (b_info->max_vcpus > 1) {
             flexarray_append(dm_args, "-smp");
-            if (info->vcpu_avail)
-                flexarray_append(dm_args, libxl__sprintf(gc, "%d,maxcpus=%d", info->vcpus, info->vcpu_avail));
+            if (b_info->cur_vcpus)
+                flexarray_append(dm_args, libxl__sprintf(gc, "%d,maxcpus=%d",
+                                                         b_info->max_vcpus,
+                                                         b_info->cur_vcpus));
             else
-                flexarray_append(dm_args, libxl__sprintf(gc, "%d", info->vcpus));
+                flexarray_append(dm_args, libxl__sprintf(gc, "%d",
+                                                         b_info->max_vcpus));
         }
         for (i = 0; i < num_vifs; i++) {
             if (vifs[i].nictype == LIBXL_NIC_TYPE_IOEMU) {
@@ -432,7 +441,9 @@
 
     /* RAM Size */
     flexarray_append(dm_args, "-m");
-    flexarray_append(dm_args, libxl__sprintf(gc, "%d", info->target_ram));
+    flexarray_append(dm_args,
+                     libxl__sprintf(gc, "%d",
+                                    libxl__sizekb_to_mb(b_info->target_memkb)));
 
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
         for (i = 0; i < num_disks; i++) {
diff -r 05435cdb21d3 -r 6cf421073cab tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:51 2012 +0000
@@ -244,7 +244,6 @@
     ("device_model",     string),
     ("saved_state",      string),
     ("type",             libxl_domain_type),
-    ("target_ram",       uint32),
     # size of the videoram in MB
     ("videoram",         integer), 
     ("stdvga",           bool),
@@ -261,9 +260,6 @@
     # usbdevice: "tablet" for absolute mouse, "mouse" for PS/2 protocol relative mouse
     ("usbdevice",        string),
     ("soundhw",          string),
-    ("acpi",             bool),
-    ("vcpus",            integer), # max number of vcpus
-    ("vcpu_avail",       integer), # vcpus actually available
     ("xen_platform_pci", bool),
     # extra parameters pass directly to qemu, NULL terminated
     ("extra",            libxl_string_list),
diff -r 05435cdb21d3 -r 6cf421073cab tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 15:21:51 2012 +0000
@@ -380,7 +380,6 @@
         printf("\t\t\t(boot %s)\n", dm_info->boot);
         printf("\t\t\t(usb %d)\n", dm_info->usb);
         printf("\t\t\t(usbdevice %s)\n", dm_info->usbdevice);
-        printf("\t\t\t(acpi %d)\n", dm_info->acpi);
         printf("\t\t\t(spice %d)\n", dm_info->spice.enable);
         printf("\t\t\t(spiceport %d)\n", dm_info->spice.port);
         printf("\t\t\t(spicetls_port %d)\n", dm_info->spice.tls_port);

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:03 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8t-0007ji-Es; Fri, 03 Feb 2012 21:58:03 +0000
Received: from mail6.bemta14.messagelabs.com ([193.109.254.103])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8s-0007i7-KV
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:02 +0000
Received: from [193.109.254.147:47382] by server-6.bemta-14.messagelabs.com id
	35/D1-05782-9685C2F4; Fri, 03 Feb 2012 21:58:01 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1328306230!51337710!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16939 invoked from network); 3 Feb 2012 21:57:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8p-0001na-R2
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:59 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8p-0002zO-9L
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:59 +0000
Message-Id: <E1RtR8p-0002zO-9L@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:58 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: drop dm_info.dom_name
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328023311 0
# Node ID 5ebec91f5f101b454ed781a19a8c4d41b0149bd9
# Parent  6cf421073cabaa219a70ae4f04b517e99a90f7d4
libxl: drop dm_info.dom_name

This is always the same as the c_info name which we now have available.

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


diff -r 6cf421073cab -r 5ebec91f5f10 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 15:21:51 2012 +0000
@@ -118,7 +118,6 @@
 
     libxl_uuid_generate(&dm_info->uuid);
 
-    dm_info->dom_name = strdup(c_info->name);
     dm_info->device_model_version = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
     dm_info->device_model_stubdomain = false;
     dm_info->device_model = NULL;
diff -r 6cf421073cab -r 5ebec91f5f10 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:51 2012 +0000
@@ -78,6 +78,7 @@
                                         const libxl_domain_config *guest_config,
                                         const libxl_device_model_info *info)
 {
+    const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
     const libxl_device_nic *vifs = guest_config->vifs;
     const int num_vifs = guest_config->num_vifs;
@@ -91,8 +92,8 @@
     flexarray_vappend(dm_args, dm,
                       "-d", libxl__sprintf(gc, "%d", info->domid), NULL);
 
-    if (info->dom_name)
-        flexarray_vappend(dm_args, "-domain-name", info->dom_name, NULL);
+    if (c_info->name)
+        flexarray_vappend(dm_args, "-domain-name", c_info->name, NULL);
 
     if (info->vnc.enable) {
         char *vncarg;
@@ -239,6 +240,7 @@
                                         const libxl_device_model_info *info)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
+    const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
     const libxl_device_disk *disks = guest_config->disks;
     const libxl_device_nic *vifs = guest_config->vifs;
@@ -268,8 +270,8 @@
         flexarray_append(dm_args, "-xen-attach");
     }
 
-    if (info->dom_name) {
-        flexarray_vappend(dm_args, "-name", info->dom_name, NULL);
+    if (c_info->name) {
+        flexarray_vappend(dm_args, "-name", c_info->name, NULL);
     }
     if (info->vnc.enable) {
         int display = 0;
@@ -793,6 +795,7 @@
                               libxl_device_model_info *info,
                               libxl__spawner_starting **starting_r)
 {
+    const libxl_domain_create_info *c_info = &guest_config->c_info;
     libxl_ctx *ctx = libxl__gc_owner(gc);
     char *path, *logfile;
     int logfile_w, null;
@@ -835,7 +838,9 @@
     xs_mkdir(ctx->xsh, XBT_NULL, path);
     libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/disable_pf", path), "%d", !info->xen_platform_pci);
 
-    libxl_create_logfile(ctx, libxl__sprintf(gc, "qemu-dm-%s", info->dom_name), &logfile);
+    libxl_create_logfile(ctx,
+                         libxl__sprintf(gc, "qemu-dm-%s", c_info->name),
+                         &logfile);
     logfile_w = open(logfile, O_WRONLY|O_CREAT|O_APPEND, 0644);
     free(logfile);
     null = open("/dev/null", O_RDONLY);
@@ -981,8 +986,6 @@
                                         libxl_device_vfb *vfb,
                                         libxl_device_model_info *info)
 {
-    libxl_ctx *ctx = libxl__gc_owner(gc);
-
     if (vfb != NULL) {
         info->vnc.enable = vfb->vnc.enable;
         if (vfb->vnc.listen)
@@ -997,7 +1000,6 @@
     } else
         info->nographic = 1;
     info->domid = domid;
-    info->dom_name = libxl_domid_to_name(ctx, domid);
     return 0;
 }
 
diff -r 6cf421073cab -r 5ebec91f5f10 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:51 2012 +0000
@@ -237,7 +237,6 @@
     # uuid is used only with stubdom, and must be different from the
     # domain uuid
     ("uuid",             libxl_uuid),
-    ("dom_name",         string),
     ("device_model_version", libxl_device_model_version),
     ("device_model_stubdomain", bool),
     # you set device_model you must set device_model_version too

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:03 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR8t-0007ji-Es; Fri, 03 Feb 2012 21:58:03 +0000
Received: from mail6.bemta14.messagelabs.com ([193.109.254.103])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8s-0007i7-KV
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:02 +0000
Received: from [193.109.254.147:47382] by server-6.bemta-14.messagelabs.com id
	35/D1-05782-9685C2F4; Fri, 03 Feb 2012 21:58:01 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1328306230!51337710!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16939 invoked from network); 3 Feb 2012 21:57:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8p-0001na-R2
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:59 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8p-0002zO-9L
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:57:59 +0000
Message-Id: <E1RtR8p-0002zO-9L@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:58 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: drop dm_info.dom_name
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328023311 0
# Node ID 5ebec91f5f101b454ed781a19a8c4d41b0149bd9
# Parent  6cf421073cabaa219a70ae4f04b517e99a90f7d4
libxl: drop dm_info.dom_name

This is always the same as the c_info name which we now have available.

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


diff -r 6cf421073cab -r 5ebec91f5f10 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 15:21:51 2012 +0000
@@ -118,7 +118,6 @@
 
     libxl_uuid_generate(&dm_info->uuid);
 
-    dm_info->dom_name = strdup(c_info->name);
     dm_info->device_model_version = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
     dm_info->device_model_stubdomain = false;
     dm_info->device_model = NULL;
diff -r 6cf421073cab -r 5ebec91f5f10 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:51 2012 +0000
@@ -78,6 +78,7 @@
                                         const libxl_domain_config *guest_config,
                                         const libxl_device_model_info *info)
 {
+    const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
     const libxl_device_nic *vifs = guest_config->vifs;
     const int num_vifs = guest_config->num_vifs;
@@ -91,8 +92,8 @@
     flexarray_vappend(dm_args, dm,
                       "-d", libxl__sprintf(gc, "%d", info->domid), NULL);
 
-    if (info->dom_name)
-        flexarray_vappend(dm_args, "-domain-name", info->dom_name, NULL);
+    if (c_info->name)
+        flexarray_vappend(dm_args, "-domain-name", c_info->name, NULL);
 
     if (info->vnc.enable) {
         char *vncarg;
@@ -239,6 +240,7 @@
                                         const libxl_device_model_info *info)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
+    const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
     const libxl_device_disk *disks = guest_config->disks;
     const libxl_device_nic *vifs = guest_config->vifs;
@@ -268,8 +270,8 @@
         flexarray_append(dm_args, "-xen-attach");
     }
 
-    if (info->dom_name) {
-        flexarray_vappend(dm_args, "-name", info->dom_name, NULL);
+    if (c_info->name) {
+        flexarray_vappend(dm_args, "-name", c_info->name, NULL);
     }
     if (info->vnc.enable) {
         int display = 0;
@@ -793,6 +795,7 @@
                               libxl_device_model_info *info,
                               libxl__spawner_starting **starting_r)
 {
+    const libxl_domain_create_info *c_info = &guest_config->c_info;
     libxl_ctx *ctx = libxl__gc_owner(gc);
     char *path, *logfile;
     int logfile_w, null;
@@ -835,7 +838,9 @@
     xs_mkdir(ctx->xsh, XBT_NULL, path);
     libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/disable_pf", path), "%d", !info->xen_platform_pci);
 
-    libxl_create_logfile(ctx, libxl__sprintf(gc, "qemu-dm-%s", info->dom_name), &logfile);
+    libxl_create_logfile(ctx,
+                         libxl__sprintf(gc, "qemu-dm-%s", c_info->name),
+                         &logfile);
     logfile_w = open(logfile, O_WRONLY|O_CREAT|O_APPEND, 0644);
     free(logfile);
     null = open("/dev/null", O_RDONLY);
@@ -981,8 +986,6 @@
                                         libxl_device_vfb *vfb,
                                         libxl_device_model_info *info)
 {
-    libxl_ctx *ctx = libxl__gc_owner(gc);
-
     if (vfb != NULL) {
         info->vnc.enable = vfb->vnc.enable;
         if (vfb->vnc.listen)
@@ -997,7 +1000,6 @@
     } else
         info->nographic = 1;
     info->domid = domid;
-    info->dom_name = libxl_domid_to_name(ctx, domid);
     return 0;
 }
 
diff -r 6cf421073cab -r 5ebec91f5f10 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:51 2012 +0000
@@ -237,7 +237,6 @@
     # uuid is used only with stubdom, and must be different from the
     # domain uuid
     ("uuid",             libxl_uuid),
-    ("dom_name",         string),
     ("device_model_version", libxl_device_model_version),
     ("device_model_stubdomain", bool),
     # you set device_model you must set device_model_version too

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:10 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR90-0007on-Hm; Fri, 03 Feb 2012 21:58:10 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8z-0007l8-Qt
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-182.messagelabs.com!1328306281!13617432!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13589 invoked from network); 3 Feb 2012 21:58:02 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:02 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8r-0001ng-CT
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:01 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8q-000301-Tg
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:00 +0000
Message-Id: <E1RtR8q-000301-Tg@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:59 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: use vfb[0] directly for xenpv
	device model
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328023311 0
# Node ID 211964199f93589ad26c23596ba685cfe3921188
# Parent  5ebec91f5f101b454ed781a19a8c4d41b0149bd9
libxl: use vfb[0] directly for xenpv device model

Rather than laundering it via dm info.

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


diff -r 5ebec91f5f10 -r 211964199f93 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:51 2012 +0000
@@ -73,6 +73,30 @@
     }
 }
 
+static const libxl_vnc_info *dm_vnc(const libxl_domain_config *guest_config,
+                                    const libxl_device_model_info *info)
+{
+    const libxl_vnc_info *vnc = NULL;
+    if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
+        vnc = &info->vnc;
+    } else if (guest_config->num_vfbs > 0) {
+        vnc = &guest_config->vfbs[0].vnc;
+    }
+    return vnc && vnc->enable ? vnc : NULL;
+}
+
+static const libxl_sdl_info *dm_sdl(const libxl_domain_config *guest_config,
+                                    const libxl_device_model_info *info)
+{
+    const libxl_sdl_info *sdl = NULL;
+    if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
+        sdl = &info->sdl;
+    } else if (guest_config->num_vfbs > 0) {
+        sdl = &guest_config->vfbs[0].sdl;
+    }
+    return sdl && sdl->enable ? sdl : NULL;
+}
+
 static char ** libxl__build_device_model_args_old(libxl__gc *gc,
                                         const char *dm,
                                         const libxl_domain_config *guest_config,
@@ -81,6 +105,8 @@
     const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
     const libxl_device_nic *vifs = guest_config->vifs;
+    const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
+    const libxl_sdl_info *sdl = dm_sdl(guest_config, info);
     const int num_vifs = guest_config->num_vifs;
     int i;
     flexarray_t *dm_args;
@@ -95,45 +121,45 @@
     if (c_info->name)
         flexarray_vappend(dm_args, "-domain-name", c_info->name, NULL);
 
-    if (info->vnc.enable) {
+    if (vnc) {
         char *vncarg;
-        if (info->vnc.display) {
-            if (info->vnc.listen && strchr(info->vnc.listen, ':') == NULL) {
+        if (vnc->display) {
+            if (vnc->listen && strchr(vnc->listen, ':') == NULL) {
                 vncarg = libxl__sprintf(gc, "%s:%d",
-                                  info->vnc.listen,
-                                  info->vnc.display);
+                                  vnc->listen,
+                                  vnc->display);
             } else {
-                vncarg = libxl__sprintf(gc, "127.0.0.1:%d", info->vnc.display);
+                vncarg = libxl__sprintf(gc, "127.0.0.1:%d", vnc->display);
             }
-        } else if (info->vnc.listen) {
-            if (strchr(info->vnc.listen, ':') != NULL) {
-                vncarg = info->vnc.listen;
+        } else if (vnc->listen) {
+            if (strchr(vnc->listen, ':') != NULL) {
+                vncarg = vnc->listen;
             } else {
-                vncarg = libxl__sprintf(gc, "%s:0", info->vnc.listen);
+                vncarg = libxl__sprintf(gc, "%s:0", vnc->listen);
             }
         } else {
             vncarg = "127.0.0.1:0";
         }
-        if (info->vnc.passwd && (info->vnc.passwd[0] != '\0'))
+        if (vnc->passwd && (vnc->passwd[0] != '\0'))
             vncarg = libxl__sprintf(gc, "%s,password", vncarg);
         flexarray_append(dm_args, "-vnc");
         flexarray_append(dm_args, vncarg);
 
-        if (info->vnc.findunused) {
+        if (vnc->findunused) {
             flexarray_append(dm_args, "-vncunused");
         }
     }
-    if (info->sdl.enable) {
+    if (sdl) {
         flexarray_append(dm_args, "-sdl");
-        if (!info->sdl.opengl) {
+        if (!sdl->opengl) {
             flexarray_append(dm_args, "-disable-opengl");
         }
-        /* XXX info->sdl.{display,xauthority} into $DISPLAY/$XAUTHORITY */
+        /* XXX sdl->{display,xauthority} into $DISPLAY/$XAUTHORITY */
     }
     if (info->keymap) {
         flexarray_vappend(dm_args, "-k", info->keymap, NULL);
     }
-    if (info->nographic && (!info->sdl.enable && !info->vnc.enable)) {
+    if (info->nographic && (!sdl && !vnc)) {
         flexarray_append(dm_args, "-nographic");
     }
     if (info->serial) {
@@ -246,6 +272,8 @@
     const libxl_device_nic *vifs = guest_config->vifs;
     const int num_disks = guest_config->num_disks;
     const int num_vifs = guest_config->num_vifs;
+    const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
+    const libxl_sdl_info *sdl = dm_sdl(guest_config, info);
     flexarray_t *dm_args;
     int i;
 
@@ -273,36 +301,36 @@
     if (c_info->name) {
         flexarray_vappend(dm_args, "-name", c_info->name, NULL);
     }
-    if (info->vnc.enable) {
+    if (vnc) {
         int display = 0;
         const char *listen = "127.0.0.1";
 
-        if (info->vnc.passwd && info->vnc.passwd[0]) {
+        if (vnc->passwd && vnc->passwd[0]) {
             assert(!"missing code for supplying vnc password to qemu");
         }
         flexarray_append(dm_args, "-vnc");
 
-        if (info->vnc.display) {
-            display = info->vnc.display;
-            if (info->vnc.listen && strchr(info->vnc.listen, ':') == NULL) {
-                listen = info->vnc.listen;
+        if (vnc->display) {
+            display = vnc->display;
+            if (vnc->listen && strchr(vnc->listen, ':') == NULL) {
+                listen = vnc->listen;
             }
-        } else if (info->vnc.listen) {
-            listen = info->vnc.listen;
+        } else if (vnc->listen) {
+            listen = vnc->listen;
         }
 
         if (strchr(listen, ':') != NULL)
             flexarray_append(dm_args,
                     libxl__sprintf(gc, "%s%s", listen,
-                        info->vnc.findunused ? ",to=99" : ""));
+                        vnc->findunused ? ",to=99" : ""));
         else
             flexarray_append(dm_args,
                     libxl__sprintf(gc, "%s:%d%s", listen, display,
-                        info->vnc.findunused ? ",to=99" : ""));
+                        vnc->findunused ? ",to=99" : ""));
     }
-    if (info->sdl.enable) {
+    if (sdl) {
         flexarray_append(dm_args, "-sdl");
-        /* XXX info->sdl.{display,xauthority} into $DISPLAY/$XAUTHORITY */
+        /* XXX sdl->{display,xauthority} into $DISPLAY/$XAUTHORITY */
     }
     if (info->spice.enable) {
         char *spiceoptions = NULL;
@@ -349,7 +377,7 @@
     if (info->keymap) {
         flexarray_vappend(dm_args, "-k", info->keymap, NULL);
     }
-    if (info->nographic && (!info->sdl.enable && !info->vnc.enable)) {
+    if (info->nographic && (!sdl && !vnc)) {
         flexarray_append(dm_args, "-nographic");
     }
     if (info->serial) {
@@ -795,8 +823,9 @@
                               libxl_device_model_info *info,
                               libxl__spawner_starting **starting_r)
 {
+    libxl_ctx *ctx = libxl__gc_owner(gc);
     const libxl_domain_create_info *c_info = &guest_config->c_info;
-    libxl_ctx *ctx = libxl__gc_owner(gc);
+    const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
     char *path, *logfile;
     int logfile_w, null;
     int rc;
@@ -865,7 +894,7 @@
         goto out_close;
     }
 
-    if (info->vnc.passwd) {
+    if (vnc && vnc->passwd) {
 retry_transaction:
         /* Find uuid and the write the vnc password to xenstore for qemu. */
         t = xs_transaction_start(ctx->xsh);
@@ -874,7 +903,7 @@
             /* Now write the vncpassword into it. */
             pass_stuff = libxl__calloc(gc, 3, sizeof(char *));
             pass_stuff[0] = "vncpasswd";
-            pass_stuff[1] = info->vnc.passwd;
+            pass_stuff[1] = vnc->passwd;
             libxl__xs_writev(gc,t,vm_path,pass_stuff);
             if (!xs_transaction_end(ctx->xsh, t, 0))
                 if (errno == EAGAIN)
@@ -983,22 +1012,8 @@
 
 static int libxl__build_xenpv_qemu_args(libxl__gc *gc,
                                         uint32_t domid,
-                                        libxl_device_vfb *vfb,
                                         libxl_device_model_info *info)
 {
-    if (vfb != NULL) {
-        info->vnc.enable = vfb->vnc.enable;
-        if (vfb->vnc.listen)
-            info->vnc.listen = libxl__strdup(gc, vfb->vnc.listen);
-        info->vnc.display = vfb->vnc.display;
-        info->vnc.findunused = vfb->vnc.findunused;
-        if (vfb->vnc.passwd)
-            info->vnc.passwd = vfb->vnc.passwd;
-        if (vfb->keymap)
-            info->keymap = libxl__strdup(gc, vfb->keymap);
-        info->sdl = vfb->sdl;
-    } else
-        info->nographic = 1;
     info->domid = domid;
     return 0;
 }
@@ -1045,7 +1060,7 @@
                              libxl_device_model_info *info,
                              libxl__spawner_starting **starting_r)
 {
-    libxl__build_xenpv_qemu_args(gc, domid, &guest_config->vfbs[0], info);
+    libxl__build_xenpv_qemu_args(gc, domid, info);
     libxl__create_device_model(gc, guest_config, info, starting_r);
     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 Feb 03 21:58:10 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR90-0007on-Hm; Fri, 03 Feb 2012 21:58:10 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8z-0007l8-Qt
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-182.messagelabs.com!1328306281!13617432!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13589 invoked from network); 3 Feb 2012 21:58:02 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:02 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8r-0001ng-CT
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:01 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8q-000301-Tg
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:00 +0000
Message-Id: <E1RtR8q-000301-Tg@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:57:59 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: use vfb[0] directly for xenpv
	device model
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328023311 0
# Node ID 211964199f93589ad26c23596ba685cfe3921188
# Parent  5ebec91f5f101b454ed781a19a8c4d41b0149bd9
libxl: use vfb[0] directly for xenpv device model

Rather than laundering it via dm info.

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


diff -r 5ebec91f5f10 -r 211964199f93 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:51 2012 +0000
@@ -73,6 +73,30 @@
     }
 }
 
+static const libxl_vnc_info *dm_vnc(const libxl_domain_config *guest_config,
+                                    const libxl_device_model_info *info)
+{
+    const libxl_vnc_info *vnc = NULL;
+    if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
+        vnc = &info->vnc;
+    } else if (guest_config->num_vfbs > 0) {
+        vnc = &guest_config->vfbs[0].vnc;
+    }
+    return vnc && vnc->enable ? vnc : NULL;
+}
+
+static const libxl_sdl_info *dm_sdl(const libxl_domain_config *guest_config,
+                                    const libxl_device_model_info *info)
+{
+    const libxl_sdl_info *sdl = NULL;
+    if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
+        sdl = &info->sdl;
+    } else if (guest_config->num_vfbs > 0) {
+        sdl = &guest_config->vfbs[0].sdl;
+    }
+    return sdl && sdl->enable ? sdl : NULL;
+}
+
 static char ** libxl__build_device_model_args_old(libxl__gc *gc,
                                         const char *dm,
                                         const libxl_domain_config *guest_config,
@@ -81,6 +105,8 @@
     const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
     const libxl_device_nic *vifs = guest_config->vifs;
+    const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
+    const libxl_sdl_info *sdl = dm_sdl(guest_config, info);
     const int num_vifs = guest_config->num_vifs;
     int i;
     flexarray_t *dm_args;
@@ -95,45 +121,45 @@
     if (c_info->name)
         flexarray_vappend(dm_args, "-domain-name", c_info->name, NULL);
 
-    if (info->vnc.enable) {
+    if (vnc) {
         char *vncarg;
-        if (info->vnc.display) {
-            if (info->vnc.listen && strchr(info->vnc.listen, ':') == NULL) {
+        if (vnc->display) {
+            if (vnc->listen && strchr(vnc->listen, ':') == NULL) {
                 vncarg = libxl__sprintf(gc, "%s:%d",
-                                  info->vnc.listen,
-                                  info->vnc.display);
+                                  vnc->listen,
+                                  vnc->display);
             } else {
-                vncarg = libxl__sprintf(gc, "127.0.0.1:%d", info->vnc.display);
+                vncarg = libxl__sprintf(gc, "127.0.0.1:%d", vnc->display);
             }
-        } else if (info->vnc.listen) {
-            if (strchr(info->vnc.listen, ':') != NULL) {
-                vncarg = info->vnc.listen;
+        } else if (vnc->listen) {
+            if (strchr(vnc->listen, ':') != NULL) {
+                vncarg = vnc->listen;
             } else {
-                vncarg = libxl__sprintf(gc, "%s:0", info->vnc.listen);
+                vncarg = libxl__sprintf(gc, "%s:0", vnc->listen);
             }
         } else {
             vncarg = "127.0.0.1:0";
         }
-        if (info->vnc.passwd && (info->vnc.passwd[0] != '\0'))
+        if (vnc->passwd && (vnc->passwd[0] != '\0'))
             vncarg = libxl__sprintf(gc, "%s,password", vncarg);
         flexarray_append(dm_args, "-vnc");
         flexarray_append(dm_args, vncarg);
 
-        if (info->vnc.findunused) {
+        if (vnc->findunused) {
             flexarray_append(dm_args, "-vncunused");
         }
     }
-    if (info->sdl.enable) {
+    if (sdl) {
         flexarray_append(dm_args, "-sdl");
-        if (!info->sdl.opengl) {
+        if (!sdl->opengl) {
             flexarray_append(dm_args, "-disable-opengl");
         }
-        /* XXX info->sdl.{display,xauthority} into $DISPLAY/$XAUTHORITY */
+        /* XXX sdl->{display,xauthority} into $DISPLAY/$XAUTHORITY */
     }
     if (info->keymap) {
         flexarray_vappend(dm_args, "-k", info->keymap, NULL);
     }
-    if (info->nographic && (!info->sdl.enable && !info->vnc.enable)) {
+    if (info->nographic && (!sdl && !vnc)) {
         flexarray_append(dm_args, "-nographic");
     }
     if (info->serial) {
@@ -246,6 +272,8 @@
     const libxl_device_nic *vifs = guest_config->vifs;
     const int num_disks = guest_config->num_disks;
     const int num_vifs = guest_config->num_vifs;
+    const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
+    const libxl_sdl_info *sdl = dm_sdl(guest_config, info);
     flexarray_t *dm_args;
     int i;
 
@@ -273,36 +301,36 @@
     if (c_info->name) {
         flexarray_vappend(dm_args, "-name", c_info->name, NULL);
     }
-    if (info->vnc.enable) {
+    if (vnc) {
         int display = 0;
         const char *listen = "127.0.0.1";
 
-        if (info->vnc.passwd && info->vnc.passwd[0]) {
+        if (vnc->passwd && vnc->passwd[0]) {
             assert(!"missing code for supplying vnc password to qemu");
         }
         flexarray_append(dm_args, "-vnc");
 
-        if (info->vnc.display) {
-            display = info->vnc.display;
-            if (info->vnc.listen && strchr(info->vnc.listen, ':') == NULL) {
-                listen = info->vnc.listen;
+        if (vnc->display) {
+            display = vnc->display;
+            if (vnc->listen && strchr(vnc->listen, ':') == NULL) {
+                listen = vnc->listen;
             }
-        } else if (info->vnc.listen) {
-            listen = info->vnc.listen;
+        } else if (vnc->listen) {
+            listen = vnc->listen;
         }
 
         if (strchr(listen, ':') != NULL)
             flexarray_append(dm_args,
                     libxl__sprintf(gc, "%s%s", listen,
-                        info->vnc.findunused ? ",to=99" : ""));
+                        vnc->findunused ? ",to=99" : ""));
         else
             flexarray_append(dm_args,
                     libxl__sprintf(gc, "%s:%d%s", listen, display,
-                        info->vnc.findunused ? ",to=99" : ""));
+                        vnc->findunused ? ",to=99" : ""));
     }
-    if (info->sdl.enable) {
+    if (sdl) {
         flexarray_append(dm_args, "-sdl");
-        /* XXX info->sdl.{display,xauthority} into $DISPLAY/$XAUTHORITY */
+        /* XXX sdl->{display,xauthority} into $DISPLAY/$XAUTHORITY */
     }
     if (info->spice.enable) {
         char *spiceoptions = NULL;
@@ -349,7 +377,7 @@
     if (info->keymap) {
         flexarray_vappend(dm_args, "-k", info->keymap, NULL);
     }
-    if (info->nographic && (!info->sdl.enable && !info->vnc.enable)) {
+    if (info->nographic && (!sdl && !vnc)) {
         flexarray_append(dm_args, "-nographic");
     }
     if (info->serial) {
@@ -795,8 +823,9 @@
                               libxl_device_model_info *info,
                               libxl__spawner_starting **starting_r)
 {
+    libxl_ctx *ctx = libxl__gc_owner(gc);
     const libxl_domain_create_info *c_info = &guest_config->c_info;
-    libxl_ctx *ctx = libxl__gc_owner(gc);
+    const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
     char *path, *logfile;
     int logfile_w, null;
     int rc;
@@ -865,7 +894,7 @@
         goto out_close;
     }
 
-    if (info->vnc.passwd) {
+    if (vnc && vnc->passwd) {
 retry_transaction:
         /* Find uuid and the write the vnc password to xenstore for qemu. */
         t = xs_transaction_start(ctx->xsh);
@@ -874,7 +903,7 @@
             /* Now write the vncpassword into it. */
             pass_stuff = libxl__calloc(gc, 3, sizeof(char *));
             pass_stuff[0] = "vncpasswd";
-            pass_stuff[1] = info->vnc.passwd;
+            pass_stuff[1] = vnc->passwd;
             libxl__xs_writev(gc,t,vm_path,pass_stuff);
             if (!xs_transaction_end(ctx->xsh, t, 0))
                 if (errno == EAGAIN)
@@ -983,22 +1012,8 @@
 
 static int libxl__build_xenpv_qemu_args(libxl__gc *gc,
                                         uint32_t domid,
-                                        libxl_device_vfb *vfb,
                                         libxl_device_model_info *info)
 {
-    if (vfb != NULL) {
-        info->vnc.enable = vfb->vnc.enable;
-        if (vfb->vnc.listen)
-            info->vnc.listen = libxl__strdup(gc, vfb->vnc.listen);
-        info->vnc.display = vfb->vnc.display;
-        info->vnc.findunused = vfb->vnc.findunused;
-        if (vfb->vnc.passwd)
-            info->vnc.passwd = vfb->vnc.passwd;
-        if (vfb->keymap)
-            info->keymap = libxl__strdup(gc, vfb->keymap);
-        info->sdl = vfb->sdl;
-    } else
-        info->nographic = 1;
     info->domid = domid;
     return 0;
 }
@@ -1045,7 +1060,7 @@
                              libxl_device_model_info *info,
                              libxl__spawner_starting **starting_r)
 {
-    libxl__build_xenpv_qemu_args(gc, domid, &guest_config->vfbs[0], info);
+    libxl__build_xenpv_qemu_args(gc, domid, info);
     libxl__create_device_model(gc, guest_config, info, starting_r);
     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 Feb 03 21:58:14 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR94-0007rJ-Ke; Fri, 03 Feb 2012 21:58:14 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR93-0007n5-Aa
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-174.messagelabs.com!1328306285!11933613!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23968 invoked from network); 3 Feb 2012 21:58:06 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:06 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8v-0001oD-3B
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:05 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8s-00030Z-Mu
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:04 +0000
Message-Id: <E1RtR8s-00030Z-Mu@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:01 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: move HVM emulated GFX support
	into b_info->u.hvm
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328023311 0
# Node ID 6ccdda2c9b42ceb01ea995685546ab12a54edffa
# Parent  211964199f93589ad26c23596ba685cfe3921188
libxl: move HVM emulated GFX support into b_info->u.hvm

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


diff -r 211964199f93 -r 6ccdda2c9b42 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 15:21:51 2012 +0000
@@ -96,6 +96,16 @@
         b_info->u.hvm.timer_mode = 1;
         b_info->u.hvm.nested_hvm = 0;
         b_info->u.hvm.no_incr_generationid = 0;
+
+        b_info->u.hvm.stdvga = 0;
+        b_info->u.hvm.vnc.enable = 1;
+        b_info->u.hvm.vnc.listen = strdup("127.0.0.1");
+        b_info->u.hvm.vnc.display = 0;
+        b_info->u.hvm.vnc.findunused = 1;
+        b_info->u.hvm.keymap = NULL;
+        b_info->u.hvm.sdl.enable = 0;
+        b_info->u.hvm.sdl.opengl = 0;
+        b_info->u.hvm.nographic = 0;
         break;
     case LIBXL_DOMAIN_TYPE_PV:
         b_info->u.pv.slack_memkb = 8 * 1024;
@@ -121,17 +131,7 @@
     dm_info->device_model_version = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
     dm_info->device_model_stubdomain = false;
     dm_info->device_model = NULL;
-    dm_info->videoram = libxl__sizekb_to_mb(b_info->video_memkb);
 
-    dm_info->stdvga = 0;
-    dm_info->vnc.enable = 1;
-    dm_info->vnc.listen = strdup("127.0.0.1");
-    dm_info->vnc.display = 0;
-    dm_info->vnc.findunused = 1;
-    dm_info->keymap = NULL;
-    dm_info->sdl.enable = 0;
-    dm_info->sdl.opengl = 0;
-    dm_info->nographic = 0;
     dm_info->serial = NULL;
     dm_info->boot = strdup("cda");
     dm_info->usb = 0;
diff -r 211964199f93 -r 6ccdda2c9b42 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:51 2012 +0000
@@ -78,7 +78,7 @@
 {
     const libxl_vnc_info *vnc = NULL;
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
-        vnc = &info->vnc;
+        vnc = &guest_config->b_info.u.hvm.vnc;
     } else if (guest_config->num_vfbs > 0) {
         vnc = &guest_config->vfbs[0].vnc;
     }
@@ -90,13 +90,24 @@
 {
     const libxl_sdl_info *sdl = NULL;
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
-        sdl = &info->sdl;
+        sdl = &guest_config->b_info.u.hvm.sdl;
     } else if (guest_config->num_vfbs > 0) {
         sdl = &guest_config->vfbs[0].sdl;
     }
     return sdl && sdl->enable ? sdl : NULL;
 }
 
+static const char *dm_keymap(const libxl_domain_config *guest_config,
+                             const libxl_device_model_info *info)
+{
+    if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
+        return guest_config->b_info.u.hvm.keymap;
+    } else if (guest_config->num_vfbs > 0) {
+        return guest_config->vfbs[0].keymap;
+    } else
+        return NULL;
+}
+
 static char ** libxl__build_device_model_args_old(libxl__gc *gc,
                                         const char *dm,
                                         const libxl_domain_config *guest_config,
@@ -108,6 +119,7 @@
     const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
     const libxl_sdl_info *sdl = dm_sdl(guest_config, info);
     const int num_vifs = guest_config->num_vifs;
+    const char *keymap = dm_keymap(guest_config, info);
     int i;
     flexarray_t *dm_args;
     dm_args = flexarray_make(16, 1);
@@ -156,11 +168,8 @@
         }
         /* XXX sdl->{display,xauthority} into $DISPLAY/$XAUTHORITY */
     }
-    if (info->keymap) {
-        flexarray_vappend(dm_args, "-k", info->keymap, NULL);
-    }
-    if (info->nographic && (!sdl && !vnc)) {
-        flexarray_append(dm_args, "-nographic");
+    if (keymap) {
+        flexarray_vappend(dm_args, "-k", keymap, NULL);
     }
     if (info->serial) {
         flexarray_vappend(dm_args, "-serial", info->serial, NULL);
@@ -168,10 +177,17 @@
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
         int ioemu_vifs = 0;
 
-        if (info->videoram) {
-            flexarray_vappend(dm_args, "-videoram", libxl__sprintf(gc, "%d", info->videoram), NULL);
+        if (b_info->u.hvm.nographic && (!sdl && !vnc)) {
+            flexarray_append(dm_args, "-nographic");
         }
-        if (info->stdvga) {
+
+        if (b_info->video_memkb) {
+            flexarray_vappend(dm_args, "-videoram",
+                    libxl__sprintf(gc, "%d",
+                                   libxl__sizekb_to_mb(b_info->video_memkb)),
+                    NULL);
+        }
+        if (b_info->u.hvm.stdvga) {
             flexarray_append(dm_args, "-std-vga");
         }
 
@@ -225,7 +241,11 @@
         if (info->gfx_passthru) {
             flexarray_append(dm_args, "-gfx_passthru");
         }
+    } else {
+        if (!sdl && !vnc)
+            flexarray_append(dm_args, "-nographic");
     }
+
     if (info->saved_state) {
         flexarray_vappend(dm_args, "-loadvm", info->saved_state, NULL);
     }
@@ -260,6 +280,42 @@
     }
 }
 
+static char *dm_spice_options(libxl__gc *gc,
+                                    const libxl_spice_info *spice)
+{
+    char *opt;
+
+    if (!spice->port && !spice->tls_port) {
+        LIBXL__LOG(CTX, LIBXL__LOG_ERROR,
+                   "at least one of the spiceport or tls_port must be provided");
+        return NULL;
+    }
+
+    if (!spice->disable_ticketing) {
+        if (!spice->passwd) {
+            LIBXL__LOG(CTX, LIBXL__LOG_ERROR,
+                       "spice ticketing is enabled but missing password");
+            return NULL;
+        }
+        else if (!spice->passwd[0]) {
+            LIBXL__LOG(CTX, LIBXL__LOG_ERROR,
+                               "spice password can't be empty");
+            return NULL;
+        }
+    }
+    opt = libxl__sprintf(gc, "port=%d,tls-port=%d",
+                         spice->port, spice->tls_port);
+    if (spice->host)
+        opt = libxl__sprintf(gc, "%s,addr=%s", opt, spice->host);
+    if (spice->disable_ticketing)
+        opt = libxl__sprintf(gc, "%s,disable-ticketing", opt);
+    else
+        opt = libxl__sprintf(gc, "%s,password=%s", opt, spice->passwd);
+    opt = libxl__sprintf(gc, "%s,agent-mouse=%s", opt,
+                         spice->agent_mouse ? "on" : "off");
+    return opt;
+}
+
 static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                                         const char *dm,
                                         const libxl_domain_config *guest_config,
@@ -274,6 +330,7 @@
     const int num_vifs = guest_config->num_vifs;
     const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
     const libxl_sdl_info *sdl = dm_sdl(guest_config, info);
+    const char *keymap = dm_keymap(guest_config, info);
     flexarray_t *dm_args;
     int i;
 
@@ -332,61 +389,36 @@
         flexarray_append(dm_args, "-sdl");
         /* XXX sdl->{display,xauthority} into $DISPLAY/$XAUTHORITY */
     }
-    if (info->spice.enable) {
-        char *spiceoptions = NULL;
-        if (!info->spice.port && !info->spice.tls_port) {
-            LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
-                "at least one of the spiceport or tls_port must be provided");
-            return NULL;
-        }
 
-        if (!info->spice.disable_ticketing) {
-            if (!info->spice.passwd) {
-                LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
-                    "spice ticketing is enabled but missing password");
-                return NULL;
-            }
-            else if (!info->spice.passwd[0]) {
-                LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
-                    "spice password can't be empty");
-                return NULL;
-            }
-        }
-        spiceoptions = libxl__sprintf(gc, "port=%d,tls-port=%d",
-                                      info->spice.port, info->spice.tls_port);
-        if (info->spice.host)
-            spiceoptions = libxl__sprintf(gc,
-                    "%s,addr=%s", spiceoptions, info->spice.host);
-        if (info->spice.disable_ticketing)
-            spiceoptions = libxl__sprintf(gc, "%s,disable-ticketing",
-                                               spiceoptions);
-        else
-            spiceoptions = libxl__sprintf(gc,
-                    "%s,password=%s", spiceoptions, info->spice.passwd);
-        spiceoptions = libxl__sprintf(gc, "%s,agent-mouse=%s", spiceoptions,
-                                      info->spice.agent_mouse ? "on" : "off");
+    /*if (info->type == LIBXL_DOMAIN_TYPE_PV && !b_info->nographic) {
+        flexarray_vappend(dm_args, "-vga", "xenfb", NULL);
+      } never was possible?*/
 
-        flexarray_append(dm_args, "-spice");
-        flexarray_append(dm_args, spiceoptions);
+    if (keymap) {
+        flexarray_vappend(dm_args, "-k", keymap, NULL);
     }
 
-    if (info->type == LIBXL_DOMAIN_TYPE_PV && !info->nographic) {
-        flexarray_vappend(dm_args, "-vga", "xenfb", NULL);
-    }
-
-    if (info->keymap) {
-        flexarray_vappend(dm_args, "-k", info->keymap, NULL);
-    }
-    if (info->nographic && (!sdl && !vnc)) {
-        flexarray_append(dm_args, "-nographic");
-    }
     if (info->serial) {
         flexarray_vappend(dm_args, "-serial", info->serial, NULL);
     }
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
         int ioemu_vifs = 0;
 
-        if (info->stdvga) {
+        if (b_info->u.hvm.nographic && (!sdl && !vnc)) {
+            flexarray_append(dm_args, "-nographic");
+        }
+
+        if (b_info->u.hvm.spice.enable) {
+            const libxl_spice_info *spice = &b_info->u.hvm.spice;
+            char *spiceoptions = dm_spice_options(gc, spice);
+            if (!spiceoptions)
+                return NULL;
+
+            flexarray_append(dm_args, "-spice");
+            flexarray_append(dm_args, spiceoptions);
+        }
+
+        if (b_info->u.hvm.stdvga) {
                 flexarray_vappend(dm_args, "-vga", "std", NULL);
         }
 
@@ -446,7 +478,12 @@
         if (info->gfx_passthru) {
             flexarray_append(dm_args, "-gfx_passthru");
         }
+    } else {
+        if (!sdl && !vnc) {
+            flexarray_append(dm_args, "-nographic");
+        }
     }
+
     if (info->saved_state) {
         /* This file descriptor is meant to be used by QEMU */
         int migration_fd = open(info->saved_state, O_RDONLY);
@@ -555,19 +592,24 @@
     }
 }
 
-static int libxl__vfb_and_vkb_from_device_model_info(libxl__gc *gc,
-                                        const libxl_device_model_info *info,
+static int libxl__vfb_and_vkb_from_hvm_guest_config(libxl__gc *gc,
+                                        const libxl_domain_config *guest_config,
                                         libxl_device_vfb *vfb,
                                         libxl_device_vkb *vkb)
 {
+    const libxl_domain_build_info *b_info = &guest_config->b_info;
+
+    if (b_info->type != LIBXL_DOMAIN_TYPE_HVM)
+        return ERROR_INVAL;
+
     memset(vfb, 0x00, sizeof(libxl_device_vfb));
     memset(vkb, 0x00, sizeof(libxl_device_vkb));
 
     vfb->backend_domid = 0;
     vfb->devid = 0;
-    vfb->vnc = info->vnc;
-    vfb->keymap = info->keymap;
-    vfb->sdl = info->sdl;
+    vfb->vnc = b_info->u.hvm.vnc;
+    vfb->keymap = b_info->u.hvm.keymap;
+    vfb->sdl = b_info->u.hvm.sdl;
 
     vkb->backend_domid = 0;
     vkb->devid = 0;
@@ -670,8 +712,7 @@
     dm_config.vifs = guest_config->vifs;
     dm_config.num_vifs = guest_config->num_vifs;
 
-    libxl__vfb_and_vkb_from_device_model_info(gc, info, &vfb, &vkb);
-
+    libxl__vfb_and_vkb_from_hvm_guest_config(gc, guest_config, &vfb, &vkb);
     dm_config.vfbs = &vfb;
     dm_config.num_vfbs = 1;
     dm_config.vkbs = &vkb;
diff -r 211964199f93 -r 6ccdda2c9b42 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:51 2012 +0000
@@ -215,6 +215,13 @@
                                        ("timer_mode", integer),
                                        ("nested_hvm", bool),
                                        ("no_incr_generationid", bool),
+                                       ("nographic",        bool),
+                                       ("stdvga",           bool),
+                                       ("vnc",              libxl_vnc_info),
+                                       # keyboard layout, default is en-us keyboard
+                                       ("keymap",           string),
+                                       ("sdl",              libxl_sdl_info),
+                                       ("spice",            libxl_spice_info),
                                        ])),
                  ("pv", Struct(None, [("kernel", libxl_file_reference),
                                       ("slack_memkb", uint32),
@@ -243,15 +250,6 @@
     ("device_model",     string),
     ("saved_state",      string),
     ("type",             libxl_domain_type),
-    # size of the videoram in MB
-    ("videoram",         integer), 
-    ("stdvga",           bool),
-    ("vnc",              libxl_vnc_info),
-    # keyboard layout, default is en-us keyboard
-    ("keymap",           string),
-    ("sdl",              libxl_sdl_info),
-    ("spice",            libxl_spice_info),
-    ("nographic",        bool),
     ("gfx_passthru",     bool),
     ("serial",           string),
     ("boot",             string),
diff -r 211964199f93 -r 6ccdda2c9b42 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 15:21:51 2012 +0000
@@ -364,29 +364,29 @@
         printf("\t\t\t(no_incr_generationid %d)\n",
                     b_info->u.hvm.no_incr_generationid);
 
+        printf("\t\t\t(stdvga %d)\n", b_info->u.hvm.stdvga);
+        printf("\t\t\t(vnc %d)\n", b_info->u.hvm.vnc.enable);
+        printf("\t\t\t(vnclisten %s)\n", b_info->u.hvm.vnc.listen);
+        printf("\t\t\t(vncdisplay %d)\n", b_info->u.hvm.vnc.display);
+        printf("\t\t\t(vncunused %d)\n", b_info->u.hvm.vnc.findunused);
+        printf("\t\t\t(keymap %s)\n", b_info->u.hvm.keymap);
+        printf("\t\t\t(sdl %d)\n", b_info->u.hvm.sdl.enable);
+        printf("\t\t\t(opengl %d)\n", b_info->u.hvm.sdl.opengl);
+        printf("\t\t\t(nographic %d)\n", b_info->u.hvm.nographic);
+        printf("\t\t\t(spice %d)\n", b_info->u.hvm.spice.enable);
+        printf("\t\t\t(spiceport %d)\n", b_info->u.hvm.spice.port);
+        printf("\t\t\t(spicetls_port %d)\n", b_info->u.hvm.spice.tls_port);
+        printf("\t\t\t(spicehost %s)\n", b_info->u.hvm.spice.host);
+        printf("\t\t\t(spicedisable_ticketing %d)\n",
+                    b_info->u.hvm.spice.disable_ticketing);
+        printf("\t\t\t(spiceagent_mouse %d)\n", b_info->u.hvm.spice.agent_mouse);
+
         printf("\t\t\t(device_model %s)\n", dm_info->device_model ? : "default");
-        printf("\t\t\t(videoram %d)\n", dm_info->videoram);
-        printf("\t\t\t(stdvga %d)\n", dm_info->stdvga);
-        printf("\t\t\t(vnc %d)\n", dm_info->vnc.enable);
-        printf("\t\t\t(vnclisten %s)\n", dm_info->vnc.listen);
-        printf("\t\t\t(vncdisplay %d)\n", dm_info->vnc.display);
-        printf("\t\t\t(vncunused %d)\n", dm_info->vnc.findunused);
-        printf("\t\t\t(keymap %s)\n", dm_info->keymap);
-        printf("\t\t\t(sdl %d)\n", dm_info->sdl.enable);
         printf("\t\t\t(gfx_passthru %d)\n", dm_info->gfx_passthru);
-        printf("\t\t\t(opengl %d)\n", dm_info->sdl.opengl);
-        printf("\t\t\t(nographic %d)\n", dm_info->nographic);
         printf("\t\t\t(serial %s)\n", dm_info->serial);
         printf("\t\t\t(boot %s)\n", dm_info->boot);
         printf("\t\t\t(usb %d)\n", dm_info->usb);
         printf("\t\t\t(usbdevice %s)\n", dm_info->usbdevice);
-        printf("\t\t\t(spice %d)\n", dm_info->spice.enable);
-        printf("\t\t\t(spiceport %d)\n", dm_info->spice.port);
-        printf("\t\t\t(spicetls_port %d)\n", dm_info->spice.tls_port);
-        printf("\t\t\t(spicehost %s)\n", dm_info->spice.host);
-        printf("\t\t\t(spicedisable_ticketing %d)\n",
-                    dm_info->spice.disable_ticketing);
-        printf("\t\t\t(spiceagent_mouse %d)\n", dm_info->spice.agent_mouse);
         printf("\t\t)\n");
         break;
     case LIBXL_DOMAIN_TYPE_PV:
@@ -1259,37 +1259,38 @@
 
     if (c_info->type == LIBXL_DOMAIN_TYPE_HVM) {
         if (!xlu_cfg_get_long (config, "stdvga", &l, 0))
-            dm_info->stdvga = l;
+            b_info->u.hvm.stdvga = l;
         if (!xlu_cfg_get_long (config, "vnc", &l, 0))
-            dm_info->vnc.enable = l;
-        xlu_cfg_replace_string (config, "vnclisten", &dm_info->vnc.listen, 0);
-        xlu_cfg_replace_string (config, "vncpasswd", &dm_info->vnc.passwd, 0);
+            b_info->u.hvm.vnc.enable = l;
+        xlu_cfg_replace_string (config, "vnclisten", &b_info->u.hvm.vnc.listen, 0);
+        xlu_cfg_replace_string (config, "vncpasswd", &b_info->u.hvm.vnc.passwd, 0);
         if (!xlu_cfg_get_long (config, "vncdisplay", &l, 0))
-            dm_info->vnc.display = l;
+            b_info->u.hvm.vnc.display = l;
         if (!xlu_cfg_get_long (config, "vncunused", &l, 0))
-            dm_info->vnc.findunused = l;
-        xlu_cfg_replace_string (config, "keymap", &dm_info->keymap, 0);
+            b_info->u.hvm.vnc.findunused = l;
+        xlu_cfg_replace_string (config, "keymap", &b_info->u.hvm.keymap, 0);
         if (!xlu_cfg_get_long (config, "sdl", &l, 0))
-            dm_info->sdl.enable = l;
+            b_info->u.hvm.sdl.enable = l;
         if (!xlu_cfg_get_long (config, "opengl", &l, 0))
-            dm_info->sdl.opengl = l;
+            b_info->u.hvm.sdl.opengl = l;
         if (!xlu_cfg_get_long (config, "spice", &l, 0))
-            dm_info->spice.enable = l;
+            b_info->u.hvm.spice.enable = l;
         if (!xlu_cfg_get_long (config, "spiceport", &l, 0))
-            dm_info->spice.port = l;
+            b_info->u.hvm.spice.port = l;
         if (!xlu_cfg_get_long (config, "spicetls_port", &l, 0))
-            dm_info->spice.tls_port = l;
-        xlu_cfg_replace_string (config, "spicehost", &dm_info->spice.host, 0);
+            b_info->u.hvm.spice.tls_port = l;
+        xlu_cfg_replace_string (config, "spicehost",
+                                &b_info->u.hvm.spice.host, 0);
         if (!xlu_cfg_get_long (config, "spicedisable_ticketing", &l, 0))
-            dm_info->spice.disable_ticketing = l;
+            b_info->u.hvm.spice.disable_ticketing = l;
         xlu_cfg_replace_string (config, "spicepasswd",
-                                &dm_info->spice.passwd, 0);
+                                &b_info->u.hvm.spice.passwd, 0);
         if (!xlu_cfg_get_long (config, "spiceagent_mouse", &l, 0))
-            dm_info->spice.agent_mouse = l;
+            b_info->u.hvm.spice.agent_mouse = l;
         else
-            dm_info->spice.agent_mouse = 1;
+            b_info->u.hvm.spice.agent_mouse = 1;
         if (!xlu_cfg_get_long (config, "nographic", &l, 0))
-            dm_info->nographic = l;
+            b_info->u.hvm.nographic = l;
         if (!xlu_cfg_get_long (config, "gfx_passthru", &l, 0))
             dm_info->gfx_passthru = l;
         xlu_cfg_replace_string (config, "serial", &dm_info->serial, 0);

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:14 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR94-0007rJ-Ke; Fri, 03 Feb 2012 21:58:14 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR93-0007n5-Aa
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-174.messagelabs.com!1328306285!11933613!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23968 invoked from network); 3 Feb 2012 21:58:06 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:06 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8v-0001oD-3B
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:05 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8s-00030Z-Mu
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:04 +0000
Message-Id: <E1RtR8s-00030Z-Mu@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:01 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: move HVM emulated GFX support
	into b_info->u.hvm
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328023311 0
# Node ID 6ccdda2c9b42ceb01ea995685546ab12a54edffa
# Parent  211964199f93589ad26c23596ba685cfe3921188
libxl: move HVM emulated GFX support into b_info->u.hvm

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


diff -r 211964199f93 -r 6ccdda2c9b42 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 15:21:51 2012 +0000
@@ -96,6 +96,16 @@
         b_info->u.hvm.timer_mode = 1;
         b_info->u.hvm.nested_hvm = 0;
         b_info->u.hvm.no_incr_generationid = 0;
+
+        b_info->u.hvm.stdvga = 0;
+        b_info->u.hvm.vnc.enable = 1;
+        b_info->u.hvm.vnc.listen = strdup("127.0.0.1");
+        b_info->u.hvm.vnc.display = 0;
+        b_info->u.hvm.vnc.findunused = 1;
+        b_info->u.hvm.keymap = NULL;
+        b_info->u.hvm.sdl.enable = 0;
+        b_info->u.hvm.sdl.opengl = 0;
+        b_info->u.hvm.nographic = 0;
         break;
     case LIBXL_DOMAIN_TYPE_PV:
         b_info->u.pv.slack_memkb = 8 * 1024;
@@ -121,17 +131,7 @@
     dm_info->device_model_version = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
     dm_info->device_model_stubdomain = false;
     dm_info->device_model = NULL;
-    dm_info->videoram = libxl__sizekb_to_mb(b_info->video_memkb);
 
-    dm_info->stdvga = 0;
-    dm_info->vnc.enable = 1;
-    dm_info->vnc.listen = strdup("127.0.0.1");
-    dm_info->vnc.display = 0;
-    dm_info->vnc.findunused = 1;
-    dm_info->keymap = NULL;
-    dm_info->sdl.enable = 0;
-    dm_info->sdl.opengl = 0;
-    dm_info->nographic = 0;
     dm_info->serial = NULL;
     dm_info->boot = strdup("cda");
     dm_info->usb = 0;
diff -r 211964199f93 -r 6ccdda2c9b42 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:51 2012 +0000
@@ -78,7 +78,7 @@
 {
     const libxl_vnc_info *vnc = NULL;
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
-        vnc = &info->vnc;
+        vnc = &guest_config->b_info.u.hvm.vnc;
     } else if (guest_config->num_vfbs > 0) {
         vnc = &guest_config->vfbs[0].vnc;
     }
@@ -90,13 +90,24 @@
 {
     const libxl_sdl_info *sdl = NULL;
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
-        sdl = &info->sdl;
+        sdl = &guest_config->b_info.u.hvm.sdl;
     } else if (guest_config->num_vfbs > 0) {
         sdl = &guest_config->vfbs[0].sdl;
     }
     return sdl && sdl->enable ? sdl : NULL;
 }
 
+static const char *dm_keymap(const libxl_domain_config *guest_config,
+                             const libxl_device_model_info *info)
+{
+    if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
+        return guest_config->b_info.u.hvm.keymap;
+    } else if (guest_config->num_vfbs > 0) {
+        return guest_config->vfbs[0].keymap;
+    } else
+        return NULL;
+}
+
 static char ** libxl__build_device_model_args_old(libxl__gc *gc,
                                         const char *dm,
                                         const libxl_domain_config *guest_config,
@@ -108,6 +119,7 @@
     const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
     const libxl_sdl_info *sdl = dm_sdl(guest_config, info);
     const int num_vifs = guest_config->num_vifs;
+    const char *keymap = dm_keymap(guest_config, info);
     int i;
     flexarray_t *dm_args;
     dm_args = flexarray_make(16, 1);
@@ -156,11 +168,8 @@
         }
         /* XXX sdl->{display,xauthority} into $DISPLAY/$XAUTHORITY */
     }
-    if (info->keymap) {
-        flexarray_vappend(dm_args, "-k", info->keymap, NULL);
-    }
-    if (info->nographic && (!sdl && !vnc)) {
-        flexarray_append(dm_args, "-nographic");
+    if (keymap) {
+        flexarray_vappend(dm_args, "-k", keymap, NULL);
     }
     if (info->serial) {
         flexarray_vappend(dm_args, "-serial", info->serial, NULL);
@@ -168,10 +177,17 @@
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
         int ioemu_vifs = 0;
 
-        if (info->videoram) {
-            flexarray_vappend(dm_args, "-videoram", libxl__sprintf(gc, "%d", info->videoram), NULL);
+        if (b_info->u.hvm.nographic && (!sdl && !vnc)) {
+            flexarray_append(dm_args, "-nographic");
         }
-        if (info->stdvga) {
+
+        if (b_info->video_memkb) {
+            flexarray_vappend(dm_args, "-videoram",
+                    libxl__sprintf(gc, "%d",
+                                   libxl__sizekb_to_mb(b_info->video_memkb)),
+                    NULL);
+        }
+        if (b_info->u.hvm.stdvga) {
             flexarray_append(dm_args, "-std-vga");
         }
 
@@ -225,7 +241,11 @@
         if (info->gfx_passthru) {
             flexarray_append(dm_args, "-gfx_passthru");
         }
+    } else {
+        if (!sdl && !vnc)
+            flexarray_append(dm_args, "-nographic");
     }
+
     if (info->saved_state) {
         flexarray_vappend(dm_args, "-loadvm", info->saved_state, NULL);
     }
@@ -260,6 +280,42 @@
     }
 }
 
+static char *dm_spice_options(libxl__gc *gc,
+                                    const libxl_spice_info *spice)
+{
+    char *opt;
+
+    if (!spice->port && !spice->tls_port) {
+        LIBXL__LOG(CTX, LIBXL__LOG_ERROR,
+                   "at least one of the spiceport or tls_port must be provided");
+        return NULL;
+    }
+
+    if (!spice->disable_ticketing) {
+        if (!spice->passwd) {
+            LIBXL__LOG(CTX, LIBXL__LOG_ERROR,
+                       "spice ticketing is enabled but missing password");
+            return NULL;
+        }
+        else if (!spice->passwd[0]) {
+            LIBXL__LOG(CTX, LIBXL__LOG_ERROR,
+                               "spice password can't be empty");
+            return NULL;
+        }
+    }
+    opt = libxl__sprintf(gc, "port=%d,tls-port=%d",
+                         spice->port, spice->tls_port);
+    if (spice->host)
+        opt = libxl__sprintf(gc, "%s,addr=%s", opt, spice->host);
+    if (spice->disable_ticketing)
+        opt = libxl__sprintf(gc, "%s,disable-ticketing", opt);
+    else
+        opt = libxl__sprintf(gc, "%s,password=%s", opt, spice->passwd);
+    opt = libxl__sprintf(gc, "%s,agent-mouse=%s", opt,
+                         spice->agent_mouse ? "on" : "off");
+    return opt;
+}
+
 static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                                         const char *dm,
                                         const libxl_domain_config *guest_config,
@@ -274,6 +330,7 @@
     const int num_vifs = guest_config->num_vifs;
     const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
     const libxl_sdl_info *sdl = dm_sdl(guest_config, info);
+    const char *keymap = dm_keymap(guest_config, info);
     flexarray_t *dm_args;
     int i;
 
@@ -332,61 +389,36 @@
         flexarray_append(dm_args, "-sdl");
         /* XXX sdl->{display,xauthority} into $DISPLAY/$XAUTHORITY */
     }
-    if (info->spice.enable) {
-        char *spiceoptions = NULL;
-        if (!info->spice.port && !info->spice.tls_port) {
-            LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
-                "at least one of the spiceport or tls_port must be provided");
-            return NULL;
-        }
 
-        if (!info->spice.disable_ticketing) {
-            if (!info->spice.passwd) {
-                LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
-                    "spice ticketing is enabled but missing password");
-                return NULL;
-            }
-            else if (!info->spice.passwd[0]) {
-                LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
-                    "spice password can't be empty");
-                return NULL;
-            }
-        }
-        spiceoptions = libxl__sprintf(gc, "port=%d,tls-port=%d",
-                                      info->spice.port, info->spice.tls_port);
-        if (info->spice.host)
-            spiceoptions = libxl__sprintf(gc,
-                    "%s,addr=%s", spiceoptions, info->spice.host);
-        if (info->spice.disable_ticketing)
-            spiceoptions = libxl__sprintf(gc, "%s,disable-ticketing",
-                                               spiceoptions);
-        else
-            spiceoptions = libxl__sprintf(gc,
-                    "%s,password=%s", spiceoptions, info->spice.passwd);
-        spiceoptions = libxl__sprintf(gc, "%s,agent-mouse=%s", spiceoptions,
-                                      info->spice.agent_mouse ? "on" : "off");
+    /*if (info->type == LIBXL_DOMAIN_TYPE_PV && !b_info->nographic) {
+        flexarray_vappend(dm_args, "-vga", "xenfb", NULL);
+      } never was possible?*/
 
-        flexarray_append(dm_args, "-spice");
-        flexarray_append(dm_args, spiceoptions);
+    if (keymap) {
+        flexarray_vappend(dm_args, "-k", keymap, NULL);
     }
 
-    if (info->type == LIBXL_DOMAIN_TYPE_PV && !info->nographic) {
-        flexarray_vappend(dm_args, "-vga", "xenfb", NULL);
-    }
-
-    if (info->keymap) {
-        flexarray_vappend(dm_args, "-k", info->keymap, NULL);
-    }
-    if (info->nographic && (!sdl && !vnc)) {
-        flexarray_append(dm_args, "-nographic");
-    }
     if (info->serial) {
         flexarray_vappend(dm_args, "-serial", info->serial, NULL);
     }
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
         int ioemu_vifs = 0;
 
-        if (info->stdvga) {
+        if (b_info->u.hvm.nographic && (!sdl && !vnc)) {
+            flexarray_append(dm_args, "-nographic");
+        }
+
+        if (b_info->u.hvm.spice.enable) {
+            const libxl_spice_info *spice = &b_info->u.hvm.spice;
+            char *spiceoptions = dm_spice_options(gc, spice);
+            if (!spiceoptions)
+                return NULL;
+
+            flexarray_append(dm_args, "-spice");
+            flexarray_append(dm_args, spiceoptions);
+        }
+
+        if (b_info->u.hvm.stdvga) {
                 flexarray_vappend(dm_args, "-vga", "std", NULL);
         }
 
@@ -446,7 +478,12 @@
         if (info->gfx_passthru) {
             flexarray_append(dm_args, "-gfx_passthru");
         }
+    } else {
+        if (!sdl && !vnc) {
+            flexarray_append(dm_args, "-nographic");
+        }
     }
+
     if (info->saved_state) {
         /* This file descriptor is meant to be used by QEMU */
         int migration_fd = open(info->saved_state, O_RDONLY);
@@ -555,19 +592,24 @@
     }
 }
 
-static int libxl__vfb_and_vkb_from_device_model_info(libxl__gc *gc,
-                                        const libxl_device_model_info *info,
+static int libxl__vfb_and_vkb_from_hvm_guest_config(libxl__gc *gc,
+                                        const libxl_domain_config *guest_config,
                                         libxl_device_vfb *vfb,
                                         libxl_device_vkb *vkb)
 {
+    const libxl_domain_build_info *b_info = &guest_config->b_info;
+
+    if (b_info->type != LIBXL_DOMAIN_TYPE_HVM)
+        return ERROR_INVAL;
+
     memset(vfb, 0x00, sizeof(libxl_device_vfb));
     memset(vkb, 0x00, sizeof(libxl_device_vkb));
 
     vfb->backend_domid = 0;
     vfb->devid = 0;
-    vfb->vnc = info->vnc;
-    vfb->keymap = info->keymap;
-    vfb->sdl = info->sdl;
+    vfb->vnc = b_info->u.hvm.vnc;
+    vfb->keymap = b_info->u.hvm.keymap;
+    vfb->sdl = b_info->u.hvm.sdl;
 
     vkb->backend_domid = 0;
     vkb->devid = 0;
@@ -670,8 +712,7 @@
     dm_config.vifs = guest_config->vifs;
     dm_config.num_vifs = guest_config->num_vifs;
 
-    libxl__vfb_and_vkb_from_device_model_info(gc, info, &vfb, &vkb);
-
+    libxl__vfb_and_vkb_from_hvm_guest_config(gc, guest_config, &vfb, &vkb);
     dm_config.vfbs = &vfb;
     dm_config.num_vfbs = 1;
     dm_config.vkbs = &vkb;
diff -r 211964199f93 -r 6ccdda2c9b42 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:51 2012 +0000
@@ -215,6 +215,13 @@
                                        ("timer_mode", integer),
                                        ("nested_hvm", bool),
                                        ("no_incr_generationid", bool),
+                                       ("nographic",        bool),
+                                       ("stdvga",           bool),
+                                       ("vnc",              libxl_vnc_info),
+                                       # keyboard layout, default is en-us keyboard
+                                       ("keymap",           string),
+                                       ("sdl",              libxl_sdl_info),
+                                       ("spice",            libxl_spice_info),
                                        ])),
                  ("pv", Struct(None, [("kernel", libxl_file_reference),
                                       ("slack_memkb", uint32),
@@ -243,15 +250,6 @@
     ("device_model",     string),
     ("saved_state",      string),
     ("type",             libxl_domain_type),
-    # size of the videoram in MB
-    ("videoram",         integer), 
-    ("stdvga",           bool),
-    ("vnc",              libxl_vnc_info),
-    # keyboard layout, default is en-us keyboard
-    ("keymap",           string),
-    ("sdl",              libxl_sdl_info),
-    ("spice",            libxl_spice_info),
-    ("nographic",        bool),
     ("gfx_passthru",     bool),
     ("serial",           string),
     ("boot",             string),
diff -r 211964199f93 -r 6ccdda2c9b42 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 15:21:51 2012 +0000
@@ -364,29 +364,29 @@
         printf("\t\t\t(no_incr_generationid %d)\n",
                     b_info->u.hvm.no_incr_generationid);
 
+        printf("\t\t\t(stdvga %d)\n", b_info->u.hvm.stdvga);
+        printf("\t\t\t(vnc %d)\n", b_info->u.hvm.vnc.enable);
+        printf("\t\t\t(vnclisten %s)\n", b_info->u.hvm.vnc.listen);
+        printf("\t\t\t(vncdisplay %d)\n", b_info->u.hvm.vnc.display);
+        printf("\t\t\t(vncunused %d)\n", b_info->u.hvm.vnc.findunused);
+        printf("\t\t\t(keymap %s)\n", b_info->u.hvm.keymap);
+        printf("\t\t\t(sdl %d)\n", b_info->u.hvm.sdl.enable);
+        printf("\t\t\t(opengl %d)\n", b_info->u.hvm.sdl.opengl);
+        printf("\t\t\t(nographic %d)\n", b_info->u.hvm.nographic);
+        printf("\t\t\t(spice %d)\n", b_info->u.hvm.spice.enable);
+        printf("\t\t\t(spiceport %d)\n", b_info->u.hvm.spice.port);
+        printf("\t\t\t(spicetls_port %d)\n", b_info->u.hvm.spice.tls_port);
+        printf("\t\t\t(spicehost %s)\n", b_info->u.hvm.spice.host);
+        printf("\t\t\t(spicedisable_ticketing %d)\n",
+                    b_info->u.hvm.spice.disable_ticketing);
+        printf("\t\t\t(spiceagent_mouse %d)\n", b_info->u.hvm.spice.agent_mouse);
+
         printf("\t\t\t(device_model %s)\n", dm_info->device_model ? : "default");
-        printf("\t\t\t(videoram %d)\n", dm_info->videoram);
-        printf("\t\t\t(stdvga %d)\n", dm_info->stdvga);
-        printf("\t\t\t(vnc %d)\n", dm_info->vnc.enable);
-        printf("\t\t\t(vnclisten %s)\n", dm_info->vnc.listen);
-        printf("\t\t\t(vncdisplay %d)\n", dm_info->vnc.display);
-        printf("\t\t\t(vncunused %d)\n", dm_info->vnc.findunused);
-        printf("\t\t\t(keymap %s)\n", dm_info->keymap);
-        printf("\t\t\t(sdl %d)\n", dm_info->sdl.enable);
         printf("\t\t\t(gfx_passthru %d)\n", dm_info->gfx_passthru);
-        printf("\t\t\t(opengl %d)\n", dm_info->sdl.opengl);
-        printf("\t\t\t(nographic %d)\n", dm_info->nographic);
         printf("\t\t\t(serial %s)\n", dm_info->serial);
         printf("\t\t\t(boot %s)\n", dm_info->boot);
         printf("\t\t\t(usb %d)\n", dm_info->usb);
         printf("\t\t\t(usbdevice %s)\n", dm_info->usbdevice);
-        printf("\t\t\t(spice %d)\n", dm_info->spice.enable);
-        printf("\t\t\t(spiceport %d)\n", dm_info->spice.port);
-        printf("\t\t\t(spicetls_port %d)\n", dm_info->spice.tls_port);
-        printf("\t\t\t(spicehost %s)\n", dm_info->spice.host);
-        printf("\t\t\t(spicedisable_ticketing %d)\n",
-                    dm_info->spice.disable_ticketing);
-        printf("\t\t\t(spiceagent_mouse %d)\n", dm_info->spice.agent_mouse);
         printf("\t\t)\n");
         break;
     case LIBXL_DOMAIN_TYPE_PV:
@@ -1259,37 +1259,38 @@
 
     if (c_info->type == LIBXL_DOMAIN_TYPE_HVM) {
         if (!xlu_cfg_get_long (config, "stdvga", &l, 0))
-            dm_info->stdvga = l;
+            b_info->u.hvm.stdvga = l;
         if (!xlu_cfg_get_long (config, "vnc", &l, 0))
-            dm_info->vnc.enable = l;
-        xlu_cfg_replace_string (config, "vnclisten", &dm_info->vnc.listen, 0);
-        xlu_cfg_replace_string (config, "vncpasswd", &dm_info->vnc.passwd, 0);
+            b_info->u.hvm.vnc.enable = l;
+        xlu_cfg_replace_string (config, "vnclisten", &b_info->u.hvm.vnc.listen, 0);
+        xlu_cfg_replace_string (config, "vncpasswd", &b_info->u.hvm.vnc.passwd, 0);
         if (!xlu_cfg_get_long (config, "vncdisplay", &l, 0))
-            dm_info->vnc.display = l;
+            b_info->u.hvm.vnc.display = l;
         if (!xlu_cfg_get_long (config, "vncunused", &l, 0))
-            dm_info->vnc.findunused = l;
-        xlu_cfg_replace_string (config, "keymap", &dm_info->keymap, 0);
+            b_info->u.hvm.vnc.findunused = l;
+        xlu_cfg_replace_string (config, "keymap", &b_info->u.hvm.keymap, 0);
         if (!xlu_cfg_get_long (config, "sdl", &l, 0))
-            dm_info->sdl.enable = l;
+            b_info->u.hvm.sdl.enable = l;
         if (!xlu_cfg_get_long (config, "opengl", &l, 0))
-            dm_info->sdl.opengl = l;
+            b_info->u.hvm.sdl.opengl = l;
         if (!xlu_cfg_get_long (config, "spice", &l, 0))
-            dm_info->spice.enable = l;
+            b_info->u.hvm.spice.enable = l;
         if (!xlu_cfg_get_long (config, "spiceport", &l, 0))
-            dm_info->spice.port = l;
+            b_info->u.hvm.spice.port = l;
         if (!xlu_cfg_get_long (config, "spicetls_port", &l, 0))
-            dm_info->spice.tls_port = l;
-        xlu_cfg_replace_string (config, "spicehost", &dm_info->spice.host, 0);
+            b_info->u.hvm.spice.tls_port = l;
+        xlu_cfg_replace_string (config, "spicehost",
+                                &b_info->u.hvm.spice.host, 0);
         if (!xlu_cfg_get_long (config, "spicedisable_ticketing", &l, 0))
-            dm_info->spice.disable_ticketing = l;
+            b_info->u.hvm.spice.disable_ticketing = l;
         xlu_cfg_replace_string (config, "spicepasswd",
-                                &dm_info->spice.passwd, 0);
+                                &b_info->u.hvm.spice.passwd, 0);
         if (!xlu_cfg_get_long (config, "spiceagent_mouse", &l, 0))
-            dm_info->spice.agent_mouse = l;
+            b_info->u.hvm.spice.agent_mouse = l;
         else
-            dm_info->spice.agent_mouse = 1;
+            b_info->u.hvm.spice.agent_mouse = 1;
         if (!xlu_cfg_get_long (config, "nographic", &l, 0))
-            dm_info->nographic = l;
+            b_info->u.hvm.nographic = l;
         if (!xlu_cfg_get_long (config, "gfx_passthru", &l, 0))
             dm_info->gfx_passthru = l;
         xlu_cfg_replace_string (config, "serial", &dm_info->serial, 0);

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:17 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR96-0007tK-Qe; Fri, 03 Feb 2012 21:58:16 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR95-0007oP-IE
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-182.messagelabs.com!1328306287!13617439!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14058 invoked from network); 3 Feb 2012 21:58:08 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:08 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8x-0001oJ-8Y
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:07 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8w-00031p-HB
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:06 +0000
Message-Id: <E1RtR8w-00031p-HB@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:05 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: HVM device configuration info
	build_info->u.hvm
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328023312 0
# Node ID 304726ed52e61bd6a064541b0e1dcfb7edb3f9ff
# Parent  6ccdda2c9b42ceb01ea995685546ab12a54edffa
libxl: HVM device configuration info build_info->u.hvm

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


diff -r 6ccdda2c9b42 -r 304726ed52e6 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 15:21:52 2012 +0000
@@ -106,6 +106,11 @@
         b_info->u.hvm.sdl.enable = 0;
         b_info->u.hvm.sdl.opengl = 0;
         b_info->u.hvm.nographic = 0;
+        b_info->u.hvm.serial = NULL;
+        b_info->u.hvm.boot = strdup("cda");
+        b_info->u.hvm.usb = 0;
+        b_info->u.hvm.usbdevice = NULL;
+        b_info->u.hvm.xen_platform_pci = 1;
         break;
     case LIBXL_DOMAIN_TYPE_PV:
         b_info->u.pv.slack_memkb = 8 * 1024;
@@ -132,11 +137,6 @@
     dm_info->device_model_stubdomain = false;
     dm_info->device_model = NULL;
 
-    dm_info->serial = NULL;
-    dm_info->boot = strdup("cda");
-    dm_info->usb = 0;
-    dm_info->usbdevice = NULL;
-    dm_info->xen_platform_pci = 1;
     return 0;
 }
 
diff -r 6ccdda2c9b42 -r 304726ed52e6 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:52 2012 +0000
@@ -171,12 +171,13 @@
     if (keymap) {
         flexarray_vappend(dm_args, "-k", keymap, NULL);
     }
-    if (info->serial) {
-        flexarray_vappend(dm_args, "-serial", info->serial, NULL);
-    }
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
         int ioemu_vifs = 0;
 
+        if (b_info->u.hvm.serial) {
+            flexarray_vappend(dm_args, "-serial", b_info->u.hvm.serial, NULL);
+        }
+
         if (b_info->u.hvm.nographic && (!sdl && !vnc)) {
             flexarray_append(dm_args, "-nographic");
         }
@@ -191,17 +192,18 @@
             flexarray_append(dm_args, "-std-vga");
         }
 
-        if (info->boot) {
-            flexarray_vappend(dm_args, "-boot", info->boot, NULL);
+        if (b_info->u.hvm.boot) {
+            flexarray_vappend(dm_args, "-boot", b_info->u.hvm.boot, NULL);
         }
-        if (info->usb || info->usbdevice) {
+        if (b_info->u.hvm.usb || b_info->u.hvm.usbdevice) {
             flexarray_append(dm_args, "-usb");
-            if (info->usbdevice) {
-                flexarray_vappend(dm_args, "-usbdevice", info->usbdevice, NULL);
+            if (b_info->u.hvm.usbdevice) {
+                flexarray_vappend(dm_args,
+                                  "-usbdevice", b_info->u.hvm.usbdevice, NULL);
             }
         }
-        if (info->soundhw) {
-            flexarray_vappend(dm_args, "-soundhw", info->soundhw, NULL);
+        if (b_info->u.hvm.soundhw) {
+            flexarray_vappend(dm_args, "-soundhw", b_info->u.hvm.soundhw, NULL);
         }
         if (b_info->u.hvm.acpi) {
             flexarray_append(dm_args, "-acpi");
@@ -398,12 +400,13 @@
         flexarray_vappend(dm_args, "-k", keymap, NULL);
     }
 
-    if (info->serial) {
-        flexarray_vappend(dm_args, "-serial", info->serial, NULL);
-    }
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
         int ioemu_vifs = 0;
 
+        if (b_info->u.hvm.serial) {
+            flexarray_vappend(dm_args, "-serial", b_info->u.hvm.serial, NULL);
+        }
+
         if (b_info->u.hvm.nographic && (!sdl && !vnc)) {
             flexarray_append(dm_args, "-nographic");
         }
@@ -422,17 +425,19 @@
                 flexarray_vappend(dm_args, "-vga", "std", NULL);
         }
 
-        if (info->boot) {
-            flexarray_vappend(dm_args, "-boot", libxl__sprintf(gc, "order=%s", info->boot), NULL);
+        if (b_info->u.hvm.boot) {
+            flexarray_vappend(dm_args, "-boot",
+                    libxl__sprintf(gc, "order=%s", b_info->u.hvm.boot), NULL);
         }
-        if (info->usb || info->usbdevice) {
+        if (b_info->u.hvm.usb || b_info->u.hvm.usbdevice) {
             flexarray_append(dm_args, "-usb");
-            if (info->usbdevice) {
-                flexarray_vappend(dm_args, "-usbdevice", info->usbdevice, NULL);
+            if (b_info->u.hvm.usbdevice) {
+                flexarray_vappend(dm_args,
+                                  "-usbdevice", b_info->u.hvm.usbdevice, NULL);
             }
         }
-        if (info->soundhw) {
-            flexarray_vappend(dm_args, "-soundhw", info->soundhw, NULL);
+        if (b_info->u.hvm.soundhw) {
+            flexarray_vappend(dm_args, "-soundhw", b_info->u.hvm.soundhw, NULL);
         }
         if (!b_info->u.hvm.acpi) {
             flexarray_append(dm_args, "-no-acpi");
@@ -778,7 +783,7 @@
     if (ret)
         goto out_free;
 
-    if (info->serial)
+    if (guest_config->b_info.u.hvm.serial)
         num_console++;
 
     console = libxl__calloc(gc, num_console, sizeof(libxl_device_console));
@@ -906,7 +911,8 @@
 
     path = libxl__sprintf(gc, "/local/domain/0/device-model/%d", info->domid);
     xs_mkdir(ctx->xsh, XBT_NULL, path);
-    libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/disable_pf", path), "%d", !info->xen_platform_pci);
+    libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/disable_pf", path),
+                    "%d", !guest_config->b_info.u.hvm.xen_platform_pci);
 
     libxl_create_logfile(ctx,
                          libxl__sprintf(gc, "qemu-dm-%s", c_info->name),
diff -r 6ccdda2c9b42 -r 304726ed52e6 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:52 2012 +0000
@@ -222,6 +222,16 @@
                                        ("keymap",           string),
                                        ("sdl",              libxl_sdl_info),
                                        ("spice",            libxl_spice_info),
+                                       
+                                       ("serial",           string),
+                                       ("boot",             string),
+                                       ("usb",              bool),
+                                       # usbdevice:
+                                       # - "tablet" for absolute mouse,
+                                       # - "mouse" for PS/2 protocol relative mouse
+                                       ("usbdevice",        string),
+                                       ("soundhw",          string),
+                                       ("xen_platform_pci", bool),
                                        ])),
                  ("pv", Struct(None, [("kernel", libxl_file_reference),
                                       ("slack_memkb", uint32),
@@ -251,13 +261,6 @@
     ("saved_state",      string),
     ("type",             libxl_domain_type),
     ("gfx_passthru",     bool),
-    ("serial",           string),
-    ("boot",             string),
-    ("usb",              bool),
-    # usbdevice: "tablet" for absolute mouse, "mouse" for PS/2 protocol relative mouse
-    ("usbdevice",        string),
-    ("soundhw",          string),
-    ("xen_platform_pci", bool),
     # extra parameters pass directly to qemu, NULL terminated
     ("extra",            libxl_string_list),
     # extra parameters pass directly to qemu for PV guest, NULL terminated
diff -r 6ccdda2c9b42 -r 304726ed52e6 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 15:21:52 2012 +0000
@@ -383,10 +383,10 @@
 
         printf("\t\t\t(device_model %s)\n", dm_info->device_model ? : "default");
         printf("\t\t\t(gfx_passthru %d)\n", dm_info->gfx_passthru);
-        printf("\t\t\t(serial %s)\n", dm_info->serial);
-        printf("\t\t\t(boot %s)\n", dm_info->boot);
-        printf("\t\t\t(usb %d)\n", dm_info->usb);
-        printf("\t\t\t(usbdevice %s)\n", dm_info->usbdevice);
+        printf("\t\t\t(serial %s)\n", b_info->u.hvm.serial);
+        printf("\t\t\t(boot %s)\n", b_info->u.hvm.boot);
+        printf("\t\t\t(usb %d)\n", b_info->u.hvm.usb);
+        printf("\t\t\t(usbdevice %s)\n", b_info->u.hvm.usbdevice);
         printf("\t\t)\n");
         break;
     case LIBXL_DOMAIN_TYPE_PV:
@@ -1293,14 +1293,14 @@
             b_info->u.hvm.nographic = l;
         if (!xlu_cfg_get_long (config, "gfx_passthru", &l, 0))
             dm_info->gfx_passthru = l;
-        xlu_cfg_replace_string (config, "serial", &dm_info->serial, 0);
-        xlu_cfg_replace_string (config, "boot", &dm_info->boot, 0);
+        xlu_cfg_replace_string (config, "serial", &b_info->u.hvm.serial, 0);
+        xlu_cfg_replace_string (config, "boot", &b_info->u.hvm.boot, 0);
         if (!xlu_cfg_get_long (config, "usb", &l, 0))
-            dm_info->usb = l;
-        xlu_cfg_replace_string (config, "usbdevice", &dm_info->usbdevice, 0);
-        xlu_cfg_replace_string (config, "soundhw", &dm_info->soundhw, 0);
+            b_info->u.hvm.usb = l;
+        xlu_cfg_replace_string (config, "usbdevice", &b_info->u.hvm.usbdevice, 0);
+        xlu_cfg_replace_string (config, "soundhw", &b_info->u.hvm.soundhw, 0);
         if (!xlu_cfg_get_long (config, "xen_platform_pci", &l, 0))
-            dm_info->xen_platform_pci = l;
+            b_info->u.hvm.xen_platform_pci = l;
     }
 
     dm_info->type = c_info->type;

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:17 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR96-0007tK-Qe; Fri, 03 Feb 2012 21:58:16 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR95-0007oP-IE
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-182.messagelabs.com!1328306287!13617439!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14058 invoked from network); 3 Feb 2012 21:58:08 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:08 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8x-0001oJ-8Y
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:07 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8w-00031p-HB
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:06 +0000
Message-Id: <E1RtR8w-00031p-HB@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:05 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: HVM device configuration info
	build_info->u.hvm
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328023312 0
# Node ID 304726ed52e61bd6a064541b0e1dcfb7edb3f9ff
# Parent  6ccdda2c9b42ceb01ea995685546ab12a54edffa
libxl: HVM device configuration info build_info->u.hvm

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


diff -r 6ccdda2c9b42 -r 304726ed52e6 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 15:21:52 2012 +0000
@@ -106,6 +106,11 @@
         b_info->u.hvm.sdl.enable = 0;
         b_info->u.hvm.sdl.opengl = 0;
         b_info->u.hvm.nographic = 0;
+        b_info->u.hvm.serial = NULL;
+        b_info->u.hvm.boot = strdup("cda");
+        b_info->u.hvm.usb = 0;
+        b_info->u.hvm.usbdevice = NULL;
+        b_info->u.hvm.xen_platform_pci = 1;
         break;
     case LIBXL_DOMAIN_TYPE_PV:
         b_info->u.pv.slack_memkb = 8 * 1024;
@@ -132,11 +137,6 @@
     dm_info->device_model_stubdomain = false;
     dm_info->device_model = NULL;
 
-    dm_info->serial = NULL;
-    dm_info->boot = strdup("cda");
-    dm_info->usb = 0;
-    dm_info->usbdevice = NULL;
-    dm_info->xen_platform_pci = 1;
     return 0;
 }
 
diff -r 6ccdda2c9b42 -r 304726ed52e6 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:52 2012 +0000
@@ -171,12 +171,13 @@
     if (keymap) {
         flexarray_vappend(dm_args, "-k", keymap, NULL);
     }
-    if (info->serial) {
-        flexarray_vappend(dm_args, "-serial", info->serial, NULL);
-    }
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
         int ioemu_vifs = 0;
 
+        if (b_info->u.hvm.serial) {
+            flexarray_vappend(dm_args, "-serial", b_info->u.hvm.serial, NULL);
+        }
+
         if (b_info->u.hvm.nographic && (!sdl && !vnc)) {
             flexarray_append(dm_args, "-nographic");
         }
@@ -191,17 +192,18 @@
             flexarray_append(dm_args, "-std-vga");
         }
 
-        if (info->boot) {
-            flexarray_vappend(dm_args, "-boot", info->boot, NULL);
+        if (b_info->u.hvm.boot) {
+            flexarray_vappend(dm_args, "-boot", b_info->u.hvm.boot, NULL);
         }
-        if (info->usb || info->usbdevice) {
+        if (b_info->u.hvm.usb || b_info->u.hvm.usbdevice) {
             flexarray_append(dm_args, "-usb");
-            if (info->usbdevice) {
-                flexarray_vappend(dm_args, "-usbdevice", info->usbdevice, NULL);
+            if (b_info->u.hvm.usbdevice) {
+                flexarray_vappend(dm_args,
+                                  "-usbdevice", b_info->u.hvm.usbdevice, NULL);
             }
         }
-        if (info->soundhw) {
-            flexarray_vappend(dm_args, "-soundhw", info->soundhw, NULL);
+        if (b_info->u.hvm.soundhw) {
+            flexarray_vappend(dm_args, "-soundhw", b_info->u.hvm.soundhw, NULL);
         }
         if (b_info->u.hvm.acpi) {
             flexarray_append(dm_args, "-acpi");
@@ -398,12 +400,13 @@
         flexarray_vappend(dm_args, "-k", keymap, NULL);
     }
 
-    if (info->serial) {
-        flexarray_vappend(dm_args, "-serial", info->serial, NULL);
-    }
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
         int ioemu_vifs = 0;
 
+        if (b_info->u.hvm.serial) {
+            flexarray_vappend(dm_args, "-serial", b_info->u.hvm.serial, NULL);
+        }
+
         if (b_info->u.hvm.nographic && (!sdl && !vnc)) {
             flexarray_append(dm_args, "-nographic");
         }
@@ -422,17 +425,19 @@
                 flexarray_vappend(dm_args, "-vga", "std", NULL);
         }
 
-        if (info->boot) {
-            flexarray_vappend(dm_args, "-boot", libxl__sprintf(gc, "order=%s", info->boot), NULL);
+        if (b_info->u.hvm.boot) {
+            flexarray_vappend(dm_args, "-boot",
+                    libxl__sprintf(gc, "order=%s", b_info->u.hvm.boot), NULL);
         }
-        if (info->usb || info->usbdevice) {
+        if (b_info->u.hvm.usb || b_info->u.hvm.usbdevice) {
             flexarray_append(dm_args, "-usb");
-            if (info->usbdevice) {
-                flexarray_vappend(dm_args, "-usbdevice", info->usbdevice, NULL);
+            if (b_info->u.hvm.usbdevice) {
+                flexarray_vappend(dm_args,
+                                  "-usbdevice", b_info->u.hvm.usbdevice, NULL);
             }
         }
-        if (info->soundhw) {
-            flexarray_vappend(dm_args, "-soundhw", info->soundhw, NULL);
+        if (b_info->u.hvm.soundhw) {
+            flexarray_vappend(dm_args, "-soundhw", b_info->u.hvm.soundhw, NULL);
         }
         if (!b_info->u.hvm.acpi) {
             flexarray_append(dm_args, "-no-acpi");
@@ -778,7 +783,7 @@
     if (ret)
         goto out_free;
 
-    if (info->serial)
+    if (guest_config->b_info.u.hvm.serial)
         num_console++;
 
     console = libxl__calloc(gc, num_console, sizeof(libxl_device_console));
@@ -906,7 +911,8 @@
 
     path = libxl__sprintf(gc, "/local/domain/0/device-model/%d", info->domid);
     xs_mkdir(ctx->xsh, XBT_NULL, path);
-    libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/disable_pf", path), "%d", !info->xen_platform_pci);
+    libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/disable_pf", path),
+                    "%d", !guest_config->b_info.u.hvm.xen_platform_pci);
 
     libxl_create_logfile(ctx,
                          libxl__sprintf(gc, "qemu-dm-%s", c_info->name),
diff -r 6ccdda2c9b42 -r 304726ed52e6 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:52 2012 +0000
@@ -222,6 +222,16 @@
                                        ("keymap",           string),
                                        ("sdl",              libxl_sdl_info),
                                        ("spice",            libxl_spice_info),
+                                       
+                                       ("serial",           string),
+                                       ("boot",             string),
+                                       ("usb",              bool),
+                                       # usbdevice:
+                                       # - "tablet" for absolute mouse,
+                                       # - "mouse" for PS/2 protocol relative mouse
+                                       ("usbdevice",        string),
+                                       ("soundhw",          string),
+                                       ("xen_platform_pci", bool),
                                        ])),
                  ("pv", Struct(None, [("kernel", libxl_file_reference),
                                       ("slack_memkb", uint32),
@@ -251,13 +261,6 @@
     ("saved_state",      string),
     ("type",             libxl_domain_type),
     ("gfx_passthru",     bool),
-    ("serial",           string),
-    ("boot",             string),
-    ("usb",              bool),
-    # usbdevice: "tablet" for absolute mouse, "mouse" for PS/2 protocol relative mouse
-    ("usbdevice",        string),
-    ("soundhw",          string),
-    ("xen_platform_pci", bool),
     # extra parameters pass directly to qemu, NULL terminated
     ("extra",            libxl_string_list),
     # extra parameters pass directly to qemu for PV guest, NULL terminated
diff -r 6ccdda2c9b42 -r 304726ed52e6 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 15:21:51 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 15:21:52 2012 +0000
@@ -383,10 +383,10 @@
 
         printf("\t\t\t(device_model %s)\n", dm_info->device_model ? : "default");
         printf("\t\t\t(gfx_passthru %d)\n", dm_info->gfx_passthru);
-        printf("\t\t\t(serial %s)\n", dm_info->serial);
-        printf("\t\t\t(boot %s)\n", dm_info->boot);
-        printf("\t\t\t(usb %d)\n", dm_info->usb);
-        printf("\t\t\t(usbdevice %s)\n", dm_info->usbdevice);
+        printf("\t\t\t(serial %s)\n", b_info->u.hvm.serial);
+        printf("\t\t\t(boot %s)\n", b_info->u.hvm.boot);
+        printf("\t\t\t(usb %d)\n", b_info->u.hvm.usb);
+        printf("\t\t\t(usbdevice %s)\n", b_info->u.hvm.usbdevice);
         printf("\t\t)\n");
         break;
     case LIBXL_DOMAIN_TYPE_PV:
@@ -1293,14 +1293,14 @@
             b_info->u.hvm.nographic = l;
         if (!xlu_cfg_get_long (config, "gfx_passthru", &l, 0))
             dm_info->gfx_passthru = l;
-        xlu_cfg_replace_string (config, "serial", &dm_info->serial, 0);
-        xlu_cfg_replace_string (config, "boot", &dm_info->boot, 0);
+        xlu_cfg_replace_string (config, "serial", &b_info->u.hvm.serial, 0);
+        xlu_cfg_replace_string (config, "boot", &b_info->u.hvm.boot, 0);
         if (!xlu_cfg_get_long (config, "usb", &l, 0))
-            dm_info->usb = l;
-        xlu_cfg_replace_string (config, "usbdevice", &dm_info->usbdevice, 0);
-        xlu_cfg_replace_string (config, "soundhw", &dm_info->soundhw, 0);
+            b_info->u.hvm.usb = l;
+        xlu_cfg_replace_string (config, "usbdevice", &b_info->u.hvm.usbdevice, 0);
+        xlu_cfg_replace_string (config, "soundhw", &b_info->u.hvm.soundhw, 0);
         if (!xlu_cfg_get_long (config, "xen_platform_pci", &l, 0))
-            dm_info->xen_platform_pci = l;
+            b_info->u.hvm.xen_platform_pci = l;
     }
 
     dm_info->type = c_info->type;

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:18 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR97-0007uL-TZ; Fri, 03 Feb 2012 21:58:17 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR96-0007si-Es
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-27.messagelabs.com!1328306251!58731857!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2003 invoked from network); 3 Feb 2012 21:57:32 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:32 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR94-0001of-4L
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR92-00034I-PT
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:13 +0000
Message-Id: <E1RtR92-00034I-PT@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: remove uuid from device model
	info.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328023312 0
# Node ID 0b4c3c9609dde29dd9d332fa315de499dfa0c3df
# Parent  a0a55668f3f593ff6d7d79c4270b33ee1ceb4797
libxl: remove uuid from device model info.

This should be managed by libxl and need not be exposed to the user.

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


diff -r a0a55668f3f5 -r 0b4c3c9609dd tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 15:21:52 2012 +0000
@@ -131,8 +131,6 @@
 {
     memset(dm_info, '\0', sizeof(*dm_info));
 
-    libxl_uuid_generate(&dm_info->uuid);
-
     dm_info->device_model_version = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
     dm_info->device_model_stubdomain = false;
     dm_info->device_model = NULL;
diff -r a0a55668f3f5 -r 0b4c3c9609dd tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:52 2012 +0000
@@ -697,7 +697,7 @@
     dm_config.c_info.type = LIBXL_DOMAIN_TYPE_PV;
     dm_config.c_info.name = libxl__sprintf(gc, "%s-dm", libxl__domid_to_name(gc, info->domid));
 
-    libxl_uuid_copy(&dm_config.c_info.uuid, &info->uuid);
+    libxl_uuid_generate(&dm_config.c_info.uuid);
 
     memset(&dm_config.b_info, 0x00, sizeof(libxl_domain_build_info));
     dm_config.b_info.type = dm_config.c_info.type;
diff -r a0a55668f3f5 -r 0b4c3c9609dd tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:52 2012 +0000
@@ -253,9 +253,6 @@
 libxl_device_model_info = Struct("device_model_info",[
     ("domid",            libxl_domid),
     
-    # uuid is used only with stubdom, and must be different from the
-    # domain uuid
-    ("uuid",             libxl_uuid),
     ("device_model_version", libxl_device_model_version),
     ("device_model_stubdomain", bool),
     # you set device_model you must set device_model_version too

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:18 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR97-0007uL-TZ; Fri, 03 Feb 2012 21:58:17 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR96-0007si-Es
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-27.messagelabs.com!1328306251!58731857!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2003 invoked from network); 3 Feb 2012 21:57:32 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:32 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR94-0001of-4L
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR92-00034I-PT
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:13 +0000
Message-Id: <E1RtR92-00034I-PT@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: remove uuid from device model
	info.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328023312 0
# Node ID 0b4c3c9609dde29dd9d332fa315de499dfa0c3df
# Parent  a0a55668f3f593ff6d7d79c4270b33ee1ceb4797
libxl: remove uuid from device model info.

This should be managed by libxl and need not be exposed to the user.

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


diff -r a0a55668f3f5 -r 0b4c3c9609dd tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 15:21:52 2012 +0000
@@ -131,8 +131,6 @@
 {
     memset(dm_info, '\0', sizeof(*dm_info));
 
-    libxl_uuid_generate(&dm_info->uuid);
-
     dm_info->device_model_version = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
     dm_info->device_model_stubdomain = false;
     dm_info->device_model = NULL;
diff -r a0a55668f3f5 -r 0b4c3c9609dd tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:52 2012 +0000
@@ -697,7 +697,7 @@
     dm_config.c_info.type = LIBXL_DOMAIN_TYPE_PV;
     dm_config.c_info.name = libxl__sprintf(gc, "%s-dm", libxl__domid_to_name(gc, info->domid));
 
-    libxl_uuid_copy(&dm_config.c_info.uuid, &info->uuid);
+    libxl_uuid_generate(&dm_config.c_info.uuid);
 
     memset(&dm_config.b_info, 0x00, sizeof(libxl_domain_build_info));
     dm_config.b_info.type = dm_config.c_info.type;
diff -r a0a55668f3f5 -r 0b4c3c9609dd tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:52 2012 +0000
@@ -253,9 +253,6 @@
 libxl_device_model_info = Struct("device_model_info",[
     ("domid",            libxl_domid),
     
-    # uuid is used only with stubdom, and must be different from the
-    # domain uuid
-    ("uuid",             libxl_uuid),
     ("device_model_version", libxl_device_model_version),
     ("device_model_stubdomain", bool),
     # you set device_model you must set device_model_version too

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9A-0007wC-0Q; Fri, 03 Feb 2012 21:58:20 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR98-0007qs-SJ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-182.messagelabs.com!1328306290!13568357!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29666 invoked from network); 3 Feb 2012 21:58:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR90-0001oO-2M
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8y-00032c-Lb
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:09 +0000
Message-Id: <E1RtR8y-00032c-Lb@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: move gfx_passthru setting to
	b_info->u.hvm
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328023312 0
# Node ID 2708eb2a3fc76915d6e7407caf3215b38a2dc819
# Parent  304726ed52e61bd6a064541b0e1dcfb7edb3f9ff
libxl: move gfx_passthru setting to b_info->u.hvm

Although xl parsed this value for both PV and HVM domains (and then a second
time for HVM domains) inside libxl it only impacts HVM guests so I think this
is the right place for it.

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


diff -r 304726ed52e6 -r 2708eb2a3fc7 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:52 2012 +0000
@@ -240,7 +240,7 @@
         if ( ioemu_vifs == 0 ) {
             flexarray_vappend(dm_args, "-net", "none", NULL);
         }
-        if (info->gfx_passthru) {
+        if (b_info->u.hvm.gfx_passthru) {
             flexarray_append(dm_args, "-gfx_passthru");
         }
     } else {
@@ -480,7 +480,7 @@
             flexarray_append(dm_args, "-net");
             flexarray_append(dm_args, "none");
         }
-        if (info->gfx_passthru) {
+        if (b_info->u.hvm.gfx_passthru) {
             flexarray_append(dm_args, "-gfx_passthru");
         }
     } else {
diff -r 304726ed52e6 -r 2708eb2a3fc7 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:52 2012 +0000
@@ -223,6 +223,8 @@
                                        ("sdl",              libxl_sdl_info),
                                        ("spice",            libxl_spice_info),
                                        
+                                       ("gfx_passthru",     bool),
+                                       
                                        ("serial",           string),
                                        ("boot",             string),
                                        ("usb",              bool),
@@ -260,7 +262,6 @@
     ("device_model",     string),
     ("saved_state",      string),
     ("type",             libxl_domain_type),
-    ("gfx_passthru",     bool),
     # extra parameters pass directly to qemu, NULL terminated
     ("extra",            libxl_string_list),
     # extra parameters pass directly to qemu for PV guest, NULL terminated
diff -r 304726ed52e6 -r 2708eb2a3fc7 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 15:21:52 2012 +0000
@@ -382,7 +382,7 @@
         printf("\t\t\t(spiceagent_mouse %d)\n", b_info->u.hvm.spice.agent_mouse);
 
         printf("\t\t\t(device_model %s)\n", dm_info->device_model ? : "default");
-        printf("\t\t\t(gfx_passthru %d)\n", dm_info->gfx_passthru);
+        printf("\t\t\t(gfx_passthru %d)\n", b_info->u.hvm.gfx_passthru);
         printf("\t\t\t(serial %s)\n", b_info->u.hvm.serial);
         printf("\t\t\t(boot %s)\n", b_info->u.hvm.boot);
         printf("\t\t\t(usb %d)\n", b_info->u.hvm.usb);
@@ -816,9 +816,6 @@
     if (!xlu_cfg_get_long (config, "videoram", &l, 0))
         b_info->video_memkb = l * 1024;
 
-    if (!xlu_cfg_get_long (config, "gfx_passthru", &l, 0))
-        dm_info->gfx_passthru = l;
-
     switch(c_info->type) {
     case LIBXL_DOMAIN_TYPE_HVM:
         if (!xlu_cfg_get_string (config, "kernel", &buf, 0))
@@ -1292,7 +1289,7 @@
         if (!xlu_cfg_get_long (config, "nographic", &l, 0))
             b_info->u.hvm.nographic = l;
         if (!xlu_cfg_get_long (config, "gfx_passthru", &l, 0))
-            dm_info->gfx_passthru = l;
+            b_info->u.hvm.gfx_passthru = l;
         xlu_cfg_replace_string (config, "serial", &b_info->u.hvm.serial, 0);
         xlu_cfg_replace_string (config, "boot", &b_info->u.hvm.boot, 0);
         if (!xlu_cfg_get_long (config, "usb", &l, 0))

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9A-0007wC-0Q; Fri, 03 Feb 2012 21:58:20 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR98-0007qs-SJ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-182.messagelabs.com!1328306290!13568357!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29666 invoked from network); 3 Feb 2012 21:58:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR90-0001oO-2M
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR8y-00032c-Lb
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:09 +0000
Message-Id: <E1RtR8y-00032c-Lb@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: move gfx_passthru setting to
	b_info->u.hvm
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328023312 0
# Node ID 2708eb2a3fc76915d6e7407caf3215b38a2dc819
# Parent  304726ed52e61bd6a064541b0e1dcfb7edb3f9ff
libxl: move gfx_passthru setting to b_info->u.hvm

Although xl parsed this value for both PV and HVM domains (and then a second
time for HVM domains) inside libxl it only impacts HVM guests so I think this
is the right place for it.

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


diff -r 304726ed52e6 -r 2708eb2a3fc7 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:52 2012 +0000
@@ -240,7 +240,7 @@
         if ( ioemu_vifs == 0 ) {
             flexarray_vappend(dm_args, "-net", "none", NULL);
         }
-        if (info->gfx_passthru) {
+        if (b_info->u.hvm.gfx_passthru) {
             flexarray_append(dm_args, "-gfx_passthru");
         }
     } else {
@@ -480,7 +480,7 @@
             flexarray_append(dm_args, "-net");
             flexarray_append(dm_args, "none");
         }
-        if (info->gfx_passthru) {
+        if (b_info->u.hvm.gfx_passthru) {
             flexarray_append(dm_args, "-gfx_passthru");
         }
     } else {
diff -r 304726ed52e6 -r 2708eb2a3fc7 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:52 2012 +0000
@@ -223,6 +223,8 @@
                                        ("sdl",              libxl_sdl_info),
                                        ("spice",            libxl_spice_info),
                                        
+                                       ("gfx_passthru",     bool),
+                                       
                                        ("serial",           string),
                                        ("boot",             string),
                                        ("usb",              bool),
@@ -260,7 +262,6 @@
     ("device_model",     string),
     ("saved_state",      string),
     ("type",             libxl_domain_type),
-    ("gfx_passthru",     bool),
     # extra parameters pass directly to qemu, NULL terminated
     ("extra",            libxl_string_list),
     # extra parameters pass directly to qemu for PV guest, NULL terminated
diff -r 304726ed52e6 -r 2708eb2a3fc7 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 15:21:52 2012 +0000
@@ -382,7 +382,7 @@
         printf("\t\t\t(spiceagent_mouse %d)\n", b_info->u.hvm.spice.agent_mouse);
 
         printf("\t\t\t(device_model %s)\n", dm_info->device_model ? : "default");
-        printf("\t\t\t(gfx_passthru %d)\n", dm_info->gfx_passthru);
+        printf("\t\t\t(gfx_passthru %d)\n", b_info->u.hvm.gfx_passthru);
         printf("\t\t\t(serial %s)\n", b_info->u.hvm.serial);
         printf("\t\t\t(boot %s)\n", b_info->u.hvm.boot);
         printf("\t\t\t(usb %d)\n", b_info->u.hvm.usb);
@@ -816,9 +816,6 @@
     if (!xlu_cfg_get_long (config, "videoram", &l, 0))
         b_info->video_memkb = l * 1024;
 
-    if (!xlu_cfg_get_long (config, "gfx_passthru", &l, 0))
-        dm_info->gfx_passthru = l;
-
     switch(c_info->type) {
     case LIBXL_DOMAIN_TYPE_HVM:
         if (!xlu_cfg_get_string (config, "kernel", &buf, 0))
@@ -1292,7 +1289,7 @@
         if (!xlu_cfg_get_long (config, "nographic", &l, 0))
             b_info->u.hvm.nographic = l;
         if (!xlu_cfg_get_long (config, "gfx_passthru", &l, 0))
-            dm_info->gfx_passthru = l;
+            b_info->u.hvm.gfx_passthru = l;
         xlu_cfg_replace_string (config, "serial", &b_info->u.hvm.serial, 0);
         xlu_cfg_replace_string (config, "boot", &b_info->u.hvm.boot, 0);
         if (!xlu_cfg_get_long (config, "usb", &l, 0))

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:21 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9B-0007xD-3b; Fri, 03 Feb 2012 21:58:21 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR99-0007r8-EB
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-174.messagelabs.com!1328306292!11878749!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16935 invoked from network); 3 Feb 2012 21:58:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR91-0001oZ-SC
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR90-00033O-Hc
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:11 +0000
Message-Id: <E1RtR90-00033O-Hc@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Remove
	libxl_device_model_info.type.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328023312 0
# Node ID a0a55668f3f593ff6d7d79c4270b33ee1ceb4797
# Parent  2708eb2a3fc76915d6e7407caf3215b38a2dc819
libxl: Remove libxl_device_model_info.type.

This is the type of the target guest which is part of the guest config.

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


diff -r 2708eb2a3fc7 -r a0a55668f3f5 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 15:21:52 2012 +0000
@@ -605,7 +605,6 @@
             memset((void*)&xenpv_dm_info, 0, sizeof(libxl_device_model_info));
             xenpv_dm_info.device_model_version =
                 d_config->dm_info.device_model_version;
-            xenpv_dm_info.type = d_config->dm_info.type;
             xenpv_dm_info.device_model = d_config->dm_info.device_model;
             xenpv_dm_info.extra = d_config->dm_info.extra;
             xenpv_dm_info.extra_pv = d_config->dm_info.extra_pv;
diff -r 2708eb2a3fc7 -r a0a55668f3f5 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:52 2012 +0000
@@ -77,7 +77,7 @@
                                     const libxl_device_model_info *info)
 {
     const libxl_vnc_info *vnc = NULL;
-    if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
+    if (guest_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) {
         vnc = &guest_config->b_info.u.hvm.vnc;
     } else if (guest_config->num_vfbs > 0) {
         vnc = &guest_config->vfbs[0].vnc;
@@ -89,7 +89,7 @@
                                     const libxl_device_model_info *info)
 {
     const libxl_sdl_info *sdl = NULL;
-    if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
+    if (guest_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) {
         sdl = &guest_config->b_info.u.hvm.sdl;
     } else if (guest_config->num_vfbs > 0) {
         sdl = &guest_config->vfbs[0].sdl;
@@ -100,7 +100,7 @@
 static const char *dm_keymap(const libxl_domain_config *guest_config,
                              const libxl_device_model_info *info)
 {
-    if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
+    if (guest_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) {
         return guest_config->b_info.u.hvm.keymap;
     } else if (guest_config->num_vfbs > 0) {
         return guest_config->vfbs[0].keymap;
@@ -171,7 +171,7 @@
     if (keymap) {
         flexarray_vappend(dm_args, "-k", keymap, NULL);
     }
-    if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
+    if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) {
         int ioemu_vifs = 0;
 
         if (b_info->u.hvm.serial) {
@@ -254,7 +254,7 @@
     for (i = 0; info->extra && info->extra[i] != NULL; i++)
         flexarray_append(dm_args, info->extra[i]);
     flexarray_append(dm_args, "-M");
-    switch (info->type) {
+    switch (b_info->type) {
     case LIBXL_DOMAIN_TYPE_PV:
         flexarray_append(dm_args, "xenpv");
         for (i = 0; info->extra_pv && info->extra_pv[i] != NULL; i++)
@@ -353,7 +353,7 @@
     flexarray_append(dm_args, "-mon");
     flexarray_append(dm_args, "chardev=libxl-cmd,mode=control");
 
-    if (info->type == LIBXL_DOMAIN_TYPE_PV) {
+    if (b_info->type == LIBXL_DOMAIN_TYPE_PV) {
         flexarray_append(dm_args, "-xen-attach");
     }
 
@@ -400,7 +400,7 @@
         flexarray_vappend(dm_args, "-k", keymap, NULL);
     }
 
-    if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
+    if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) {
         int ioemu_vifs = 0;
 
         if (b_info->u.hvm.serial) {
@@ -498,7 +498,7 @@
     for (i = 0; info->extra && info->extra[i] != NULL; i++)
         flexarray_append(dm_args, info->extra[i]);
     flexarray_append(dm_args, "-M");
-    switch (info->type) {
+    switch (b_info->type) {
     case LIBXL_DOMAIN_TYPE_PV:
         flexarray_append(dm_args, "xenpv");
         for (i = 0; info->extra_pv && info->extra_pv[i] != NULL; i++)
@@ -517,7 +517,7 @@
                      libxl__sprintf(gc, "%d",
                                     libxl__sizekb_to_mb(b_info->target_memkb)));
 
-    if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
+    if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) {
         for (i = 0; i < num_disks; i++) {
             int disk, part;
             int dev_number =
@@ -700,6 +700,7 @@
     libxl_uuid_copy(&dm_config.c_info.uuid, &info->uuid);
 
     memset(&dm_config.b_info, 0x00, sizeof(libxl_domain_build_info));
+    dm_config.b_info.type = dm_config.c_info.type;
     dm_config.b_info.max_vcpus = 1;
     dm_config.b_info.max_memkb = 32 * 1024;
     dm_config.b_info.target_memkb = dm_config.b_info.max_memkb;
@@ -828,7 +829,6 @@
 
     memset((void*)&xenpv_dm_info, 0, sizeof(libxl_device_model_info));
     xenpv_dm_info.device_model_version = info->device_model_version;
-    xenpv_dm_info.type = LIBXL_DOMAIN_TYPE_PV;
     xenpv_dm_info.device_model = info->device_model;
     xenpv_dm_info.extra = info->extra;
     xenpv_dm_info.extra_pv = info->extra_pv;
diff -r 2708eb2a3fc7 -r a0a55668f3f5 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:52 2012 +0000
@@ -261,7 +261,6 @@
     # you set device_model you must set device_model_version too
     ("device_model",     string),
     ("saved_state",      string),
-    ("type",             libxl_domain_type),
     # extra parameters pass directly to qemu, NULL terminated
     ("extra",            libxl_string_list),
     # extra parameters pass directly to qemu for PV guest, NULL terminated
diff -r 2708eb2a3fc7 -r a0a55668f3f5 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 15:21:52 2012 +0000
@@ -1300,8 +1300,6 @@
             b_info->u.hvm.xen_platform_pci = l;
     }
 
-    dm_info->type = c_info->type;
-
     xlu_cfg_destroy(config);
 }
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:21 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9B-0007xD-3b; Fri, 03 Feb 2012 21:58:21 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR99-0007r8-EB
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-174.messagelabs.com!1328306292!11878749!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16935 invoked from network); 3 Feb 2012 21:58:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR91-0001oZ-SC
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR90-00033O-Hc
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:11 +0000
Message-Id: <E1RtR90-00033O-Hc@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Remove
	libxl_device_model_info.type.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328023312 0
# Node ID a0a55668f3f593ff6d7d79c4270b33ee1ceb4797
# Parent  2708eb2a3fc76915d6e7407caf3215b38a2dc819
libxl: Remove libxl_device_model_info.type.

This is the type of the target guest which is part of the guest config.

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


diff -r 2708eb2a3fc7 -r a0a55668f3f5 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 15:21:52 2012 +0000
@@ -605,7 +605,6 @@
             memset((void*)&xenpv_dm_info, 0, sizeof(libxl_device_model_info));
             xenpv_dm_info.device_model_version =
                 d_config->dm_info.device_model_version;
-            xenpv_dm_info.type = d_config->dm_info.type;
             xenpv_dm_info.device_model = d_config->dm_info.device_model;
             xenpv_dm_info.extra = d_config->dm_info.extra;
             xenpv_dm_info.extra_pv = d_config->dm_info.extra_pv;
diff -r 2708eb2a3fc7 -r a0a55668f3f5 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:52 2012 +0000
@@ -77,7 +77,7 @@
                                     const libxl_device_model_info *info)
 {
     const libxl_vnc_info *vnc = NULL;
-    if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
+    if (guest_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) {
         vnc = &guest_config->b_info.u.hvm.vnc;
     } else if (guest_config->num_vfbs > 0) {
         vnc = &guest_config->vfbs[0].vnc;
@@ -89,7 +89,7 @@
                                     const libxl_device_model_info *info)
 {
     const libxl_sdl_info *sdl = NULL;
-    if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
+    if (guest_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) {
         sdl = &guest_config->b_info.u.hvm.sdl;
     } else if (guest_config->num_vfbs > 0) {
         sdl = &guest_config->vfbs[0].sdl;
@@ -100,7 +100,7 @@
 static const char *dm_keymap(const libxl_domain_config *guest_config,
                              const libxl_device_model_info *info)
 {
-    if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
+    if (guest_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) {
         return guest_config->b_info.u.hvm.keymap;
     } else if (guest_config->num_vfbs > 0) {
         return guest_config->vfbs[0].keymap;
@@ -171,7 +171,7 @@
     if (keymap) {
         flexarray_vappend(dm_args, "-k", keymap, NULL);
     }
-    if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
+    if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) {
         int ioemu_vifs = 0;
 
         if (b_info->u.hvm.serial) {
@@ -254,7 +254,7 @@
     for (i = 0; info->extra && info->extra[i] != NULL; i++)
         flexarray_append(dm_args, info->extra[i]);
     flexarray_append(dm_args, "-M");
-    switch (info->type) {
+    switch (b_info->type) {
     case LIBXL_DOMAIN_TYPE_PV:
         flexarray_append(dm_args, "xenpv");
         for (i = 0; info->extra_pv && info->extra_pv[i] != NULL; i++)
@@ -353,7 +353,7 @@
     flexarray_append(dm_args, "-mon");
     flexarray_append(dm_args, "chardev=libxl-cmd,mode=control");
 
-    if (info->type == LIBXL_DOMAIN_TYPE_PV) {
+    if (b_info->type == LIBXL_DOMAIN_TYPE_PV) {
         flexarray_append(dm_args, "-xen-attach");
     }
 
@@ -400,7 +400,7 @@
         flexarray_vappend(dm_args, "-k", keymap, NULL);
     }
 
-    if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
+    if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) {
         int ioemu_vifs = 0;
 
         if (b_info->u.hvm.serial) {
@@ -498,7 +498,7 @@
     for (i = 0; info->extra && info->extra[i] != NULL; i++)
         flexarray_append(dm_args, info->extra[i]);
     flexarray_append(dm_args, "-M");
-    switch (info->type) {
+    switch (b_info->type) {
     case LIBXL_DOMAIN_TYPE_PV:
         flexarray_append(dm_args, "xenpv");
         for (i = 0; info->extra_pv && info->extra_pv[i] != NULL; i++)
@@ -517,7 +517,7 @@
                      libxl__sprintf(gc, "%d",
                                     libxl__sizekb_to_mb(b_info->target_memkb)));
 
-    if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
+    if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) {
         for (i = 0; i < num_disks; i++) {
             int disk, part;
             int dev_number =
@@ -700,6 +700,7 @@
     libxl_uuid_copy(&dm_config.c_info.uuid, &info->uuid);
 
     memset(&dm_config.b_info, 0x00, sizeof(libxl_domain_build_info));
+    dm_config.b_info.type = dm_config.c_info.type;
     dm_config.b_info.max_vcpus = 1;
     dm_config.b_info.max_memkb = 32 * 1024;
     dm_config.b_info.target_memkb = dm_config.b_info.max_memkb;
@@ -828,7 +829,6 @@
 
     memset((void*)&xenpv_dm_info, 0, sizeof(libxl_device_model_info));
     xenpv_dm_info.device_model_version = info->device_model_version;
-    xenpv_dm_info.type = LIBXL_DOMAIN_TYPE_PV;
     xenpv_dm_info.device_model = info->device_model;
     xenpv_dm_info.extra = info->extra;
     xenpv_dm_info.extra_pv = info->extra_pv;
diff -r 2708eb2a3fc7 -r a0a55668f3f5 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:52 2012 +0000
@@ -261,7 +261,6 @@
     # you set device_model you must set device_model_version too
     ("device_model",     string),
     ("saved_state",      string),
-    ("type",             libxl_domain_type),
     # extra parameters pass directly to qemu, NULL terminated
     ("extra",            libxl_string_list),
     # extra parameters pass directly to qemu for PV guest, NULL terminated
diff -r 2708eb2a3fc7 -r a0a55668f3f5 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 15:21:52 2012 +0000
@@ -1300,8 +1300,6 @@
             b_info->u.hvm.xen_platform_pci = l;
     }
 
-    dm_info->type = c_info->type;
-
     xlu_cfg_destroy(config);
 }
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:27 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9H-00081S-6g; Fri, 03 Feb 2012 21:58:27 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9F-0007vl-25
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-174.messagelabs.com!1328306297!7715946!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26446 invoked from network); 3 Feb 2012 21:58:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR96-0001oi-Vf
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR95-000360-5q
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:16 +0000
Message-Id: <E1RtR95-000360-5q@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: move device model selection
	variables to b_info.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027672 0
# Node ID f7cc388711c8bebca5fc806b4365d25ef50e8540
# Parent  0b4c3c9609dde29dd9d332fa315de499dfa0c3df
libxl: move device model selection variables to b_info.

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


diff -r 0b4c3c9609dd -r f7cc388711c8 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Jan 31 16:34:32 2012 +0000
@@ -2629,7 +2629,7 @@
     switch (b_info->type) {
     case LIBXL_DOMAIN_TYPE_HVM:
         *need_memkb += b_info->shadow_memkb + LIBXL_HVM_EXTRA_MEMORY;
-        if (dm_info->device_model_stubdomain)
+        if (b_info->device_model_stubdomain)
             *need_memkb += 32 * 1024;
         break;
     case LIBXL_DOMAIN_TYPE_PV:
diff -r 0b4c3c9609dd -r f7cc388711c8 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 16:34:32 2012 +0000
@@ -80,6 +80,12 @@
     b_info->cpuid = NULL;
     b_info->shadow_memkb = 0;
     b_info->type = c_info->type;
+
+    b_info->device_model_version =
+        LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
+    b_info->device_model_stubdomain = false;
+    b_info->device_model = NULL;
+
     switch (b_info->type) {
     case LIBXL_DOMAIN_TYPE_HVM:
         b_info->video_memkb = 8 * 1024;
@@ -131,9 +137,6 @@
 {
     memset(dm_info, '\0', sizeof(*dm_info));
 
-    dm_info->device_model_version = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
-    dm_info->device_model_stubdomain = false;
-    dm_info->device_model = NULL;
 
     return 0;
 }
@@ -459,14 +462,14 @@
 }
 
 static int store_libxl_entry(libxl__gc *gc, uint32_t domid,
-                             libxl_device_model_info *dm_info)
+                             libxl_domain_build_info *b_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, "%s",
-        libxl_device_model_version_to_string(dm_info->device_model_version));
+        libxl_device_model_version_to_string(b_info->device_model_version));
 }
 
 static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
@@ -525,7 +528,7 @@
         goto error_out;
     }
 
-    store_libxl_entry(gc, domid, dm_info);
+    store_libxl_entry(gc, domid, &d_config->b_info);
 
     for (i = 0; i < d_config->num_disks; i++) {
         ret = libxl_device_disk_add(ctx, domid, &d_config->disks[i]);
@@ -601,12 +604,6 @@
         if (need_qemu) {
             /* only copy those useful configs */
             memset((void*)&xenpv_dm_info, 0, sizeof(libxl_device_model_info));
-            xenpv_dm_info.device_model_version =
-                d_config->dm_info.device_model_version;
-            xenpv_dm_info.device_model = d_config->dm_info.device_model;
-            xenpv_dm_info.extra = d_config->dm_info.extra;
-            xenpv_dm_info.extra_pv = d_config->dm_info.extra_pv;
-            xenpv_dm_info.extra_hvm = d_config->dm_info.extra_hvm;
 
             libxl__create_xenpv_qemu(gc, domid,
                                      d_config, &xenpv_dm_info, &dm_starting);
@@ -619,7 +616,7 @@
     }
 
     if (dm_starting) {
-        if (dm_info->device_model_version
+        if (d_config->b_info.device_model_version
             == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
             libxl__qmp_initializations(ctx, domid);
         }
diff -r 0b4c3c9609dd -r f7cc388711c8 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 16:34:32 2012 +0000
@@ -34,7 +34,7 @@
 }
 
 const char *libxl__domain_device_model(libxl__gc *gc,
-                                       libxl_device_model_info *info)
+                                       const libxl_domain_build_info *info)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     const char *dm;
@@ -64,7 +64,7 @@
 }
 
 static const char *libxl__domain_bios(libxl__gc *gc,
-                                libxl_device_model_info *info)
+                                const libxl_domain_build_info *info)
 {
     switch (info->device_model_version) {
     case 1: return "rombios";
@@ -251,19 +251,19 @@
     if (info->saved_state) {
         flexarray_vappend(dm_args, "-loadvm", info->saved_state, NULL);
     }
-    for (i = 0; info->extra && info->extra[i] != NULL; i++)
-        flexarray_append(dm_args, info->extra[i]);
+    for (i = 0; b_info->extra && b_info->extra[i] != NULL; i++)
+        flexarray_append(dm_args, b_info->extra[i]);
     flexarray_append(dm_args, "-M");
     switch (b_info->type) {
     case LIBXL_DOMAIN_TYPE_PV:
         flexarray_append(dm_args, "xenpv");
-        for (i = 0; info->extra_pv && info->extra_pv[i] != NULL; i++)
-            flexarray_append(dm_args, info->extra_pv[i]);
+        for (i = 0; b_info->extra_pv && b_info->extra_pv[i] != NULL; i++)
+            flexarray_append(dm_args, b_info->extra_pv[i]);
         break;
     case LIBXL_DOMAIN_TYPE_HVM:
         flexarray_append(dm_args, "xenfv");
-        for (i = 0; info->extra_hvm && info->extra_hvm[i] != NULL; i++)
-            flexarray_append(dm_args, info->extra_hvm[i]);
+        for (i = 0; b_info->extra_hvm && b_info->extra_hvm[i] != NULL; i++)
+            flexarray_append(dm_args, b_info->extra_hvm[i]);
         break;
     }
     flexarray_append(dm_args, NULL);
@@ -495,19 +495,19 @@
         flexarray_append(dm_args, "-incoming");
         flexarray_append(dm_args, libxl__sprintf(gc, "fd:%d", migration_fd));
     }
-    for (i = 0; info->extra && info->extra[i] != NULL; i++)
-        flexarray_append(dm_args, info->extra[i]);
+    for (i = 0; b_info->extra && b_info->extra[i] != NULL; i++)
+        flexarray_append(dm_args, b_info->extra[i]);
     flexarray_append(dm_args, "-M");
     switch (b_info->type) {
     case LIBXL_DOMAIN_TYPE_PV:
         flexarray_append(dm_args, "xenpv");
-        for (i = 0; info->extra_pv && info->extra_pv[i] != NULL; i++)
-            flexarray_append(dm_args, info->extra_pv[i]);
+        for (i = 0; b_info->extra_pv && b_info->extra_pv[i] != NULL; i++)
+            flexarray_append(dm_args, b_info->extra_pv[i]);
         break;
     case LIBXL_DOMAIN_TYPE_HVM:
         flexarray_append(dm_args, "xenfv");
-        for (i = 0; info->extra_hvm && info->extra_hvm[i] != NULL; i++)
-            flexarray_append(dm_args, info->extra_hvm[i]);
+        for (i = 0; b_info->extra_hvm && b_info->extra_hvm[i] != NULL; i++)
+            flexarray_append(dm_args, b_info->extra_hvm[i]);
         break;
     }
 
@@ -585,14 +585,14 @@
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
 
-    switch (info->device_model_version) {
+    switch (guest_config->b_info.device_model_version) {
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
         return libxl__build_device_model_args_old(gc, dm, guest_config, info);
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
         return libxl__build_device_model_args_new(gc, dm, guest_config, info);
     default:
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unknown device model version %d",
-                         info->device_model_version);
+                         guest_config->b_info.device_model_version);
         return NULL;
     }
 }
@@ -688,7 +688,8 @@
     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) {
+    if (guest_config->b_info.device_model_version !=
+        LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL) {
         ret = ERROR_INVAL;
         goto out;
     }
@@ -712,6 +713,14 @@
     dm_config.b_info.u.pv.ramdisk.path = "";
     dm_config.b_info.u.pv.features = "";
 
+    dm_config.b_info.device_model_version =
+        guest_config->b_info.device_model_version;
+    dm_config.b_info.device_model =
+        guest_config->b_info.device_model;
+    dm_config.b_info.extra = guest_config->b_info.extra;
+    dm_config.b_info.extra_pv = guest_config->b_info.extra_pv;
+    dm_config.b_info.extra_hvm = guest_config->b_info.extra_hvm;
+
     dm_config.disks = guest_config->disks;
     dm_config.num_disks = guest_config->num_disks;
 
@@ -828,11 +837,6 @@
     }
 
     memset((void*)&xenpv_dm_info, 0, sizeof(libxl_device_model_info));
-    xenpv_dm_info.device_model_version = info->device_model_version;
-    xenpv_dm_info.device_model = info->device_model;
-    xenpv_dm_info.extra = info->extra;
-    xenpv_dm_info.extra_pv = info->extra_pv;
-    xenpv_dm_info.extra_hvm = info->extra_hvm;
 
     if (libxl__create_xenpv_qemu(gc, domid,
                                  &dm_config,
@@ -871,6 +875,7 @@
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     const libxl_domain_create_info *c_info = &guest_config->c_info;
+    const libxl_domain_build_info *b_info = &guest_config->b_info;
     const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
     char *path, *logfile;
     int logfile_w, null;
@@ -882,12 +887,12 @@
     char **pass_stuff;
     const char *dm;
 
-    if (info->device_model_stubdomain) {
+    if (b_info->device_model_stubdomain) {
         rc = libxl__create_stubdom(gc, guest_config, info, starting_r);
         goto out;
     }
 
-    dm = libxl__domain_device_model(gc, info);
+    dm = libxl__domain_device_model(gc, b_info);
     if (!dm) {
         rc = ERROR_FAIL;
         goto out;
@@ -906,13 +911,13 @@
 
     path = xs_get_domain_path(ctx->xsh, info->domid);
     libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/hvmloader/bios", path),
-                    "%s", libxl__domain_bios(gc, info));
+                    "%s", libxl__domain_bios(gc, b_info));
     free(path);
 
     path = libxl__sprintf(gc, "/local/domain/0/device-model/%d", info->domid);
     xs_mkdir(ctx->xsh, XBT_NULL, path);
     libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/disable_pf", path),
-                    "%d", !guest_config->b_info.u.hvm.xen_platform_pci);
+                    "%d", !b_info->u.hvm.xen_platform_pci);
 
     libxl_create_logfile(ctx,
                          libxl__sprintf(gc, "qemu-dm-%s", c_info->name),
diff -r 0b4c3c9609dd -r f7cc388711c8 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_dom.c	Tue Jan 31 16:34:32 2012 +0000
@@ -300,7 +300,7 @@
     if (info->u.hvm.firmware)
         firmware = info->u.hvm.firmware;
     else {
-        switch (dm_info->device_model_version)
+        switch (info->device_model_version)
         {
         case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
             firmware = "hvmloader";
@@ -310,7 +310,7 @@
             break;
         default:
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "invalid device model version %d",
-                       dm_info->device_model_version);
+                       info->device_model_version);
             return NULL;
             break;
         }
diff -r 0b4c3c9609dd -r f7cc388711c8 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Tue Jan 31 16:34:32 2012 +0000
@@ -864,7 +864,7 @@
 
 /* for device model creation */
 _hidden const char *libxl__domain_device_model(libxl__gc *gc,
-                                               libxl_device_model_info *info);
+                                        const libxl_domain_build_info *info);
 _hidden int libxl__create_device_model(libxl__gc *gc,
                               libxl_domain_config *guest_config,
                               libxl_device_model_info *info,
diff -r 0b4c3c9609dd -r f7cc388711c8 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:32 2012 +0000
@@ -200,6 +200,19 @@
     ("disable_migrate", bool),
     ("cpuid",           libxl_cpuid_policy_list),
     ("type",            libxl_domain_type),
+    
+    ("device_model_version", libxl_device_model_version),
+    ("device_model_stubdomain", bool),
+    # you set device_model you must set device_model_version too
+    ("device_model",     string),
+
+    # extra parameters pass directly to qemu, NULL terminated
+    ("extra",            libxl_string_list),
+    # extra parameters pass directly to qemu for PV guest, NULL terminated
+    ("extra_pv",         libxl_string_list),
+    # extra parameters pass directly to qemu for HVM guest, NULL terminated
+    ("extra_hvm",        libxl_string_list),
+
     ("u", KeyedUnion(None, libxl_domain_type, "type",
                 [("hvm", Struct(None, [("firmware", string),
                                        ("pae", bool),
@@ -253,17 +266,7 @@
 libxl_device_model_info = Struct("device_model_info",[
     ("domid",            libxl_domid),
     
-    ("device_model_version", libxl_device_model_version),
-    ("device_model_stubdomain", bool),
-    # you set device_model you must set device_model_version too
-    ("device_model",     string),
     ("saved_state",      string),
-    # extra parameters pass directly to qemu, NULL terminated
-    ("extra",            libxl_string_list),
-    # extra parameters pass directly to qemu for PV guest, NULL terminated
-    ("extra_pv",         libxl_string_list),
-    # extra parameters pass directly to qemu for HVM guest, NULL terminated
-    ("extra_hvm",        libxl_string_list),
     ],
 )
 
diff -r 0b4c3c9609dd -r f7cc388711c8 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 16:34:32 2012 +0000
@@ -381,7 +381,7 @@
                     b_info->u.hvm.spice.disable_ticketing);
         printf("\t\t\t(spiceagent_mouse %d)\n", b_info->u.hvm.spice.agent_mouse);
 
-        printf("\t\t\t(device_model %s)\n", dm_info->device_model ? : "default");
+        printf("\t\t\t(device_model %s)\n", b_info->device_model ? : "default");
         printf("\t\t\t(gfx_passthru %d)\n", b_info->u.hvm.gfx_passthru);
         printf("\t\t\t(serial %s)\n", b_info->u.hvm.serial);
         printf("\t\t\t(boot %s)\n", b_info->u.hvm.boot);
@@ -1217,27 +1217,27 @@
 
 
     xlu_cfg_replace_string (config, "device_model_override",
-                            &dm_info->device_model, 0);
+                            &b_info->device_model, 0);
     if (!xlu_cfg_get_string (config, "device_model_version", &buf, 0)) {
         if (!strcmp(buf, "qemu-xen-traditional")) {
-            dm_info->device_model_version
+            b_info->device_model_version
                 = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
         } else if (!strcmp(buf, "qemu-xen")) {
-            dm_info->device_model_version
+            b_info->device_model_version
                 = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN;
         } else {
             fprintf(stderr,
                     "Unknown device_model_version \"%s\" specified\n", buf);
             exit(1);
         }
-    } else if (dm_info->device_model)
+    } else if (b_info->device_model)
         fprintf(stderr, "WARNING: device model override given without specific DM version\n");
     if (!xlu_cfg_get_long (config, "device_model_stubdomain_override", &l, 0))
-        dm_info->device_model_stubdomain = l;
+        b_info->device_model_stubdomain = l;
 
 #define parse_extra_args(type)                                            \
     e = xlu_cfg_get_list_as_string_list(config, "device_model_args"#type, \
-                                    &dm_info->extra##type, 0);            \
+                                    &b_info->extra##type, 0);            \
     if (e && e != ESRCH) {                                                \
         fprintf(stderr,"xl: Unable to parse device_model_args"#type".\n");\
         exit(-ERROR_FAIL);                                                \

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:27 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9H-00081S-6g; Fri, 03 Feb 2012 21:58:27 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9F-0007vl-25
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-174.messagelabs.com!1328306297!7715946!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26446 invoked from network); 3 Feb 2012 21:58:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR96-0001oi-Vf
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR95-000360-5q
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:16 +0000
Message-Id: <E1RtR95-000360-5q@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: move device model selection
	variables to b_info.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027672 0
# Node ID f7cc388711c8bebca5fc806b4365d25ef50e8540
# Parent  0b4c3c9609dde29dd9d332fa315de499dfa0c3df
libxl: move device model selection variables to b_info.

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


diff -r 0b4c3c9609dd -r f7cc388711c8 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Jan 31 16:34:32 2012 +0000
@@ -2629,7 +2629,7 @@
     switch (b_info->type) {
     case LIBXL_DOMAIN_TYPE_HVM:
         *need_memkb += b_info->shadow_memkb + LIBXL_HVM_EXTRA_MEMORY;
-        if (dm_info->device_model_stubdomain)
+        if (b_info->device_model_stubdomain)
             *need_memkb += 32 * 1024;
         break;
     case LIBXL_DOMAIN_TYPE_PV:
diff -r 0b4c3c9609dd -r f7cc388711c8 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 16:34:32 2012 +0000
@@ -80,6 +80,12 @@
     b_info->cpuid = NULL;
     b_info->shadow_memkb = 0;
     b_info->type = c_info->type;
+
+    b_info->device_model_version =
+        LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
+    b_info->device_model_stubdomain = false;
+    b_info->device_model = NULL;
+
     switch (b_info->type) {
     case LIBXL_DOMAIN_TYPE_HVM:
         b_info->video_memkb = 8 * 1024;
@@ -131,9 +137,6 @@
 {
     memset(dm_info, '\0', sizeof(*dm_info));
 
-    dm_info->device_model_version = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
-    dm_info->device_model_stubdomain = false;
-    dm_info->device_model = NULL;
 
     return 0;
 }
@@ -459,14 +462,14 @@
 }
 
 static int store_libxl_entry(libxl__gc *gc, uint32_t domid,
-                             libxl_device_model_info *dm_info)
+                             libxl_domain_build_info *b_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, "%s",
-        libxl_device_model_version_to_string(dm_info->device_model_version));
+        libxl_device_model_version_to_string(b_info->device_model_version));
 }
 
 static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
@@ -525,7 +528,7 @@
         goto error_out;
     }
 
-    store_libxl_entry(gc, domid, dm_info);
+    store_libxl_entry(gc, domid, &d_config->b_info);
 
     for (i = 0; i < d_config->num_disks; i++) {
         ret = libxl_device_disk_add(ctx, domid, &d_config->disks[i]);
@@ -601,12 +604,6 @@
         if (need_qemu) {
             /* only copy those useful configs */
             memset((void*)&xenpv_dm_info, 0, sizeof(libxl_device_model_info));
-            xenpv_dm_info.device_model_version =
-                d_config->dm_info.device_model_version;
-            xenpv_dm_info.device_model = d_config->dm_info.device_model;
-            xenpv_dm_info.extra = d_config->dm_info.extra;
-            xenpv_dm_info.extra_pv = d_config->dm_info.extra_pv;
-            xenpv_dm_info.extra_hvm = d_config->dm_info.extra_hvm;
 
             libxl__create_xenpv_qemu(gc, domid,
                                      d_config, &xenpv_dm_info, &dm_starting);
@@ -619,7 +616,7 @@
     }
 
     if (dm_starting) {
-        if (dm_info->device_model_version
+        if (d_config->b_info.device_model_version
             == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
             libxl__qmp_initializations(ctx, domid);
         }
diff -r 0b4c3c9609dd -r f7cc388711c8 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 16:34:32 2012 +0000
@@ -34,7 +34,7 @@
 }
 
 const char *libxl__domain_device_model(libxl__gc *gc,
-                                       libxl_device_model_info *info)
+                                       const libxl_domain_build_info *info)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     const char *dm;
@@ -64,7 +64,7 @@
 }
 
 static const char *libxl__domain_bios(libxl__gc *gc,
-                                libxl_device_model_info *info)
+                                const libxl_domain_build_info *info)
 {
     switch (info->device_model_version) {
     case 1: return "rombios";
@@ -251,19 +251,19 @@
     if (info->saved_state) {
         flexarray_vappend(dm_args, "-loadvm", info->saved_state, NULL);
     }
-    for (i = 0; info->extra && info->extra[i] != NULL; i++)
-        flexarray_append(dm_args, info->extra[i]);
+    for (i = 0; b_info->extra && b_info->extra[i] != NULL; i++)
+        flexarray_append(dm_args, b_info->extra[i]);
     flexarray_append(dm_args, "-M");
     switch (b_info->type) {
     case LIBXL_DOMAIN_TYPE_PV:
         flexarray_append(dm_args, "xenpv");
-        for (i = 0; info->extra_pv && info->extra_pv[i] != NULL; i++)
-            flexarray_append(dm_args, info->extra_pv[i]);
+        for (i = 0; b_info->extra_pv && b_info->extra_pv[i] != NULL; i++)
+            flexarray_append(dm_args, b_info->extra_pv[i]);
         break;
     case LIBXL_DOMAIN_TYPE_HVM:
         flexarray_append(dm_args, "xenfv");
-        for (i = 0; info->extra_hvm && info->extra_hvm[i] != NULL; i++)
-            flexarray_append(dm_args, info->extra_hvm[i]);
+        for (i = 0; b_info->extra_hvm && b_info->extra_hvm[i] != NULL; i++)
+            flexarray_append(dm_args, b_info->extra_hvm[i]);
         break;
     }
     flexarray_append(dm_args, NULL);
@@ -495,19 +495,19 @@
         flexarray_append(dm_args, "-incoming");
         flexarray_append(dm_args, libxl__sprintf(gc, "fd:%d", migration_fd));
     }
-    for (i = 0; info->extra && info->extra[i] != NULL; i++)
-        flexarray_append(dm_args, info->extra[i]);
+    for (i = 0; b_info->extra && b_info->extra[i] != NULL; i++)
+        flexarray_append(dm_args, b_info->extra[i]);
     flexarray_append(dm_args, "-M");
     switch (b_info->type) {
     case LIBXL_DOMAIN_TYPE_PV:
         flexarray_append(dm_args, "xenpv");
-        for (i = 0; info->extra_pv && info->extra_pv[i] != NULL; i++)
-            flexarray_append(dm_args, info->extra_pv[i]);
+        for (i = 0; b_info->extra_pv && b_info->extra_pv[i] != NULL; i++)
+            flexarray_append(dm_args, b_info->extra_pv[i]);
         break;
     case LIBXL_DOMAIN_TYPE_HVM:
         flexarray_append(dm_args, "xenfv");
-        for (i = 0; info->extra_hvm && info->extra_hvm[i] != NULL; i++)
-            flexarray_append(dm_args, info->extra_hvm[i]);
+        for (i = 0; b_info->extra_hvm && b_info->extra_hvm[i] != NULL; i++)
+            flexarray_append(dm_args, b_info->extra_hvm[i]);
         break;
     }
 
@@ -585,14 +585,14 @@
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
 
-    switch (info->device_model_version) {
+    switch (guest_config->b_info.device_model_version) {
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
         return libxl__build_device_model_args_old(gc, dm, guest_config, info);
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
         return libxl__build_device_model_args_new(gc, dm, guest_config, info);
     default:
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unknown device model version %d",
-                         info->device_model_version);
+                         guest_config->b_info.device_model_version);
         return NULL;
     }
 }
@@ -688,7 +688,8 @@
     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) {
+    if (guest_config->b_info.device_model_version !=
+        LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL) {
         ret = ERROR_INVAL;
         goto out;
     }
@@ -712,6 +713,14 @@
     dm_config.b_info.u.pv.ramdisk.path = "";
     dm_config.b_info.u.pv.features = "";
 
+    dm_config.b_info.device_model_version =
+        guest_config->b_info.device_model_version;
+    dm_config.b_info.device_model =
+        guest_config->b_info.device_model;
+    dm_config.b_info.extra = guest_config->b_info.extra;
+    dm_config.b_info.extra_pv = guest_config->b_info.extra_pv;
+    dm_config.b_info.extra_hvm = guest_config->b_info.extra_hvm;
+
     dm_config.disks = guest_config->disks;
     dm_config.num_disks = guest_config->num_disks;
 
@@ -828,11 +837,6 @@
     }
 
     memset((void*)&xenpv_dm_info, 0, sizeof(libxl_device_model_info));
-    xenpv_dm_info.device_model_version = info->device_model_version;
-    xenpv_dm_info.device_model = info->device_model;
-    xenpv_dm_info.extra = info->extra;
-    xenpv_dm_info.extra_pv = info->extra_pv;
-    xenpv_dm_info.extra_hvm = info->extra_hvm;
 
     if (libxl__create_xenpv_qemu(gc, domid,
                                  &dm_config,
@@ -871,6 +875,7 @@
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     const libxl_domain_create_info *c_info = &guest_config->c_info;
+    const libxl_domain_build_info *b_info = &guest_config->b_info;
     const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
     char *path, *logfile;
     int logfile_w, null;
@@ -882,12 +887,12 @@
     char **pass_stuff;
     const char *dm;
 
-    if (info->device_model_stubdomain) {
+    if (b_info->device_model_stubdomain) {
         rc = libxl__create_stubdom(gc, guest_config, info, starting_r);
         goto out;
     }
 
-    dm = libxl__domain_device_model(gc, info);
+    dm = libxl__domain_device_model(gc, b_info);
     if (!dm) {
         rc = ERROR_FAIL;
         goto out;
@@ -906,13 +911,13 @@
 
     path = xs_get_domain_path(ctx->xsh, info->domid);
     libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/hvmloader/bios", path),
-                    "%s", libxl__domain_bios(gc, info));
+                    "%s", libxl__domain_bios(gc, b_info));
     free(path);
 
     path = libxl__sprintf(gc, "/local/domain/0/device-model/%d", info->domid);
     xs_mkdir(ctx->xsh, XBT_NULL, path);
     libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/disable_pf", path),
-                    "%d", !guest_config->b_info.u.hvm.xen_platform_pci);
+                    "%d", !b_info->u.hvm.xen_platform_pci);
 
     libxl_create_logfile(ctx,
                          libxl__sprintf(gc, "qemu-dm-%s", c_info->name),
diff -r 0b4c3c9609dd -r f7cc388711c8 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_dom.c	Tue Jan 31 16:34:32 2012 +0000
@@ -300,7 +300,7 @@
     if (info->u.hvm.firmware)
         firmware = info->u.hvm.firmware;
     else {
-        switch (dm_info->device_model_version)
+        switch (info->device_model_version)
         {
         case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
             firmware = "hvmloader";
@@ -310,7 +310,7 @@
             break;
         default:
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "invalid device model version %d",
-                       dm_info->device_model_version);
+                       info->device_model_version);
             return NULL;
             break;
         }
diff -r 0b4c3c9609dd -r f7cc388711c8 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Tue Jan 31 16:34:32 2012 +0000
@@ -864,7 +864,7 @@
 
 /* for device model creation */
 _hidden const char *libxl__domain_device_model(libxl__gc *gc,
-                                               libxl_device_model_info *info);
+                                        const libxl_domain_build_info *info);
 _hidden int libxl__create_device_model(libxl__gc *gc,
                               libxl_domain_config *guest_config,
                               libxl_device_model_info *info,
diff -r 0b4c3c9609dd -r f7cc388711c8 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:32 2012 +0000
@@ -200,6 +200,19 @@
     ("disable_migrate", bool),
     ("cpuid",           libxl_cpuid_policy_list),
     ("type",            libxl_domain_type),
+    
+    ("device_model_version", libxl_device_model_version),
+    ("device_model_stubdomain", bool),
+    # you set device_model you must set device_model_version too
+    ("device_model",     string),
+
+    # extra parameters pass directly to qemu, NULL terminated
+    ("extra",            libxl_string_list),
+    # extra parameters pass directly to qemu for PV guest, NULL terminated
+    ("extra_pv",         libxl_string_list),
+    # extra parameters pass directly to qemu for HVM guest, NULL terminated
+    ("extra_hvm",        libxl_string_list),
+
     ("u", KeyedUnion(None, libxl_domain_type, "type",
                 [("hvm", Struct(None, [("firmware", string),
                                        ("pae", bool),
@@ -253,17 +266,7 @@
 libxl_device_model_info = Struct("device_model_info",[
     ("domid",            libxl_domid),
     
-    ("device_model_version", libxl_device_model_version),
-    ("device_model_stubdomain", bool),
-    # you set device_model you must set device_model_version too
-    ("device_model",     string),
     ("saved_state",      string),
-    # extra parameters pass directly to qemu, NULL terminated
-    ("extra",            libxl_string_list),
-    # extra parameters pass directly to qemu for PV guest, NULL terminated
-    ("extra_pv",         libxl_string_list),
-    # extra parameters pass directly to qemu for HVM guest, NULL terminated
-    ("extra_hvm",        libxl_string_list),
     ],
 )
 
diff -r 0b4c3c9609dd -r f7cc388711c8 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 15:21:52 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 16:34:32 2012 +0000
@@ -381,7 +381,7 @@
                     b_info->u.hvm.spice.disable_ticketing);
         printf("\t\t\t(spiceagent_mouse %d)\n", b_info->u.hvm.spice.agent_mouse);
 
-        printf("\t\t\t(device_model %s)\n", dm_info->device_model ? : "default");
+        printf("\t\t\t(device_model %s)\n", b_info->device_model ? : "default");
         printf("\t\t\t(gfx_passthru %d)\n", b_info->u.hvm.gfx_passthru);
         printf("\t\t\t(serial %s)\n", b_info->u.hvm.serial);
         printf("\t\t\t(boot %s)\n", b_info->u.hvm.boot);
@@ -1217,27 +1217,27 @@
 
 
     xlu_cfg_replace_string (config, "device_model_override",
-                            &dm_info->device_model, 0);
+                            &b_info->device_model, 0);
     if (!xlu_cfg_get_string (config, "device_model_version", &buf, 0)) {
         if (!strcmp(buf, "qemu-xen-traditional")) {
-            dm_info->device_model_version
+            b_info->device_model_version
                 = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
         } else if (!strcmp(buf, "qemu-xen")) {
-            dm_info->device_model_version
+            b_info->device_model_version
                 = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN;
         } else {
             fprintf(stderr,
                     "Unknown device_model_version \"%s\" specified\n", buf);
             exit(1);
         }
-    } else if (dm_info->device_model)
+    } else if (b_info->device_model)
         fprintf(stderr, "WARNING: device model override given without specific DM version\n");
     if (!xlu_cfg_get_long (config, "device_model_stubdomain_override", &l, 0))
-        dm_info->device_model_stubdomain = l;
+        b_info->device_model_stubdomain = l;
 
 #define parse_extra_args(type)                                            \
     e = xlu_cfg_get_list_as_string_list(config, "device_model_args"#type, \
-                                    &dm_info->extra##type, 0);            \
+                                    &b_info->extra##type, 0);            \
     if (e && e != ESRCH) {                                                \
         fprintf(stderr,"xl: Unable to parse device_model_args"#type".\n");\
         exit(-ERROR_FAIL);                                                \

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:30 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9K-00083Z-Bk; Fri, 03 Feb 2012 21:58:30 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9I-0007zK-To
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:29 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-174.messagelabs.com!1328306301!11933633!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24277 invoked from network); 3 Feb 2012 21:58:22 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:22 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9A-0001oo-W4
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR97-00036t-Sp
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:18 +0000
Message-Id: <E1RtR97-00036t-Sp@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: move "saved_state" to
	libxl__domain_build_state.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027678 0
# Node ID 9356938a851d93571fc16c5922f5db8242d7daf7
# Parent  f7cc388711c8bebca5fc806b4365d25ef50e8540
libxl: move "saved_state" to libxl__domain_build_state.

This is internal to the library and need not be exposed to the user.

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


diff -r f7cc388711c8 -r 9356938a851d tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 16:34:32 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 16:34:38 2012 +0000
@@ -278,9 +278,8 @@
     if (ret)
         goto out;
 
-    dm_info->saved_state = NULL;
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
-        ret = asprintf(&dm_info->saved_state,
+        ret = asprintf(&state->saved_state,
                        XC_DEVICE_MODEL_RESTORE_FILE".%d", domid);
         ret = (ret < 0) ? ERROR_FAIL : 0;
     }
@@ -512,13 +511,11 @@
         }
     }
 
+    memset(&state, 0, sizeof(state));
+
     if ( restore_fd >= 0 ) {
         ret = domain_restore(gc, &d_config->b_info, domid, restore_fd, &state, dm_info);
     } else {
-        if (dm_info->saved_state) {
-            free(dm_info->saved_state);
-            dm_info->saved_state = NULL;
-        }
         ret = libxl__domain_build(gc, &d_config->b_info, dm_info, domid, &state);
     }
 
@@ -568,7 +565,7 @@
 
         dm_info->domid = domid;
         ret = libxl__create_device_model(gc, d_config, dm_info,
-                                        &dm_starting);
+                                         &state, &dm_starting);
         if (ret < 0) {
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
                        "failed to create device model: %d", ret);
@@ -605,8 +602,8 @@
             /* only copy those useful configs */
             memset((void*)&xenpv_dm_info, 0, sizeof(libxl_device_model_info));
 
-            libxl__create_xenpv_qemu(gc, domid,
-                                     d_config, &xenpv_dm_info, &dm_starting);
+            libxl__create_xenpv_qemu(gc, domid, d_config,
+                                     &xenpv_dm_info, &state, &dm_starting);
         }
         break;
     }
@@ -620,7 +617,7 @@
             == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
             libxl__qmp_initializations(ctx, domid);
         }
-        ret = libxl__confirm_device_model_startup(gc, dm_info, dm_starting);
+        ret = libxl__confirm_device_model_startup(gc, &state, dm_starting);
         if (ret < 0) {
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
                        "device model did not start: %d", ret);
diff -r f7cc388711c8 -r 9356938a851d tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 16:34:32 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 16:34:38 2012 +0000
@@ -111,7 +111,8 @@
 static char ** libxl__build_device_model_args_old(libxl__gc *gc,
                                         const char *dm,
                                         const libxl_domain_config *guest_config,
-                                        const libxl_device_model_info *info)
+                                        const libxl_device_model_info *info,
+                                        const libxl__domain_build_state *state)
 {
     const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
@@ -248,8 +249,8 @@
             flexarray_append(dm_args, "-nographic");
     }
 
-    if (info->saved_state) {
-        flexarray_vappend(dm_args, "-loadvm", info->saved_state, NULL);
+    if (state->saved_state) {
+        flexarray_vappend(dm_args, "-loadvm", state->saved_state, NULL);
     }
     for (i = 0; b_info->extra && b_info->extra[i] != NULL; i++)
         flexarray_append(dm_args, b_info->extra[i]);
@@ -321,7 +322,8 @@
 static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                                         const char *dm,
                                         const libxl_domain_config *guest_config,
-                                        const libxl_device_model_info *info)
+                                        const libxl_device_model_info *info,
+                                        const libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     const libxl_domain_create_info *c_info = &guest_config->c_info;
@@ -489,9 +491,9 @@
         }
     }
 
-    if (info->saved_state) {
+    if (state->saved_state) {
         /* This file descriptor is meant to be used by QEMU */
-        int migration_fd = open(info->saved_state, O_RDONLY);
+        int migration_fd = open(state->saved_state, O_RDONLY);
         flexarray_append(dm_args, "-incoming");
         flexarray_append(dm_args, libxl__sprintf(gc, "fd:%d", migration_fd));
     }
@@ -581,15 +583,16 @@
 static char ** libxl__build_device_model_args(libxl__gc *gc,
                                         const char *dm,
                                         const libxl_domain_config *guest_config,
-                                        const libxl_device_model_info *info)
+                                        const libxl_device_model_info *info,
+                                        const libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
 
     switch (guest_config->b_info.device_model_version) {
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
-        return libxl__build_device_model_args_old(gc, dm, guest_config, info);
+        return libxl__build_device_model_args_old(gc, dm, guest_config, info, state);
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
-        return libxl__build_device_model_args_new(gc, dm, guest_config, info);
+        return libxl__build_device_model_args_new(gc, dm, guest_config, info, state);
     default:
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unknown device model version %d",
                          guest_config->b_info.device_model_version);
@@ -672,6 +675,7 @@
 static int libxl__create_stubdom(libxl__gc *gc,
                                  libxl_domain_config *guest_config,
                                  libxl_device_model_info *info,
+                                 libxl__domain_build_state *d_state,
                                  libxl__spawner_starting **starting_r)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
@@ -680,7 +684,7 @@
     libxl_domain_config dm_config;
     libxl_device_vfb vfb;
     libxl_device_vkb vkb;
-    libxl__domain_build_state state;
+    libxl__domain_build_state stubdom_state;
     uint32_t domid;
     char **args;
     struct xs_permissions perm[2];
@@ -738,12 +742,12 @@
     ret = libxl__domain_make(gc, &dm_config.c_info, &domid);
     if (ret)
         goto out;
-    ret = libxl__domain_build(gc, &dm_config.b_info, info, domid, &state);
+    ret = libxl__domain_build(gc, &dm_config.b_info, info, domid, &stubdom_state);
     if (ret)
         goto out;
 
     args = libxl__build_device_model_args(gc, "stubdom-dm",
-                                          guest_config, info);
+                                          guest_config, info, d_state);
     if (!args) {
         ret = ERROR_FAIL;
         goto out;
@@ -813,7 +817,8 @@
             char *filename;
             char *name;
             case STUBDOM_CONSOLE_LOGGING:
-                name = libxl__sprintf(gc, "qemu-dm-%s", libxl_domid_to_name(ctx, info->domid));
+                name = libxl__sprintf(gc, "qemu-dm-%s",
+                                      libxl_domid_to_name(ctx, info->domid));
                 libxl_create_logfile(ctx, name, &filename);
                 console[i].output = libxl__sprintf(gc, "file:%s", filename);
                 free(filename);
@@ -823,15 +828,16 @@
                                 libxl__device_model_savefile(gc, info->domid));
                 break;
             case STUBDOM_CONSOLE_RESTORE:
-                if (info->saved_state)
-                    console[i].output = libxl__sprintf(gc, "pipe:%s", info->saved_state);
+                if (d_state->saved_state)
+                    console[i].output =
+                        libxl__sprintf(gc, "pipe:%s", d_state->saved_state);
                 break;
             default:
                 console[i].output = "pty";
                 break;
         }
         ret = libxl__device_console_add(gc, domid, &console[i],
-                                    i == STUBDOM_CONSOLE_LOGGING ? &state : NULL);
+                        i == STUBDOM_CONSOLE_LOGGING ? &stubdom_state : NULL);
         if (ret)
             goto out_free;
     }
@@ -841,12 +847,12 @@
     if (libxl__create_xenpv_qemu(gc, domid,
                                  &dm_config,
                                  &xenpv_dm_info,
+                                 &stubdom_state,
                                  &dm_starting) < 0) {
         ret = ERROR_FAIL;
         goto out_free;
     }
-    if (libxl__confirm_device_model_startup(gc, &xenpv_dm_info,
-                                            dm_starting) < 0) {
+    if (libxl__confirm_device_model_startup(gc, d_state, dm_starting) < 0) {
         ret = ERROR_FAIL;
         goto out_free;
     }
@@ -871,6 +877,7 @@
 int libxl__create_device_model(libxl__gc *gc,
                               libxl_domain_config *guest_config,
                               libxl_device_model_info *info,
+                              libxl__domain_build_state *state,
                               libxl__spawner_starting **starting_r)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
@@ -888,7 +895,7 @@
     const char *dm;
 
     if (b_info->device_model_stubdomain) {
-        rc = libxl__create_stubdom(gc, guest_config, info, starting_r);
+        rc = libxl__create_stubdom(gc, guest_config, info, state, starting_r);
         goto out;
     }
 
@@ -903,7 +910,7 @@
         rc = ERROR_FAIL;
         goto out;
     }
-    args = libxl__build_device_model_args(gc, dm, guest_config, info);
+    args = libxl__build_device_model_args(gc, dm, guest_config, info, state);
     if (!args) {
         rc = ERROR_FAIL;
         goto out;
@@ -984,10 +991,9 @@
 
 
 int libxl__confirm_device_model_startup(libxl__gc *gc,
-                                libxl_device_model_info *dm_info,
+                                libxl__domain_build_state *state,
                                 libxl__spawner_starting *starting)
 {
-    libxl_ctx *ctx = libxl__gc_owner(gc);
     char *path;
     int domid = starting->domid;
     int ret, ret2;
@@ -995,11 +1001,11 @@
     ret = libxl__spawn_confirm_offspring_startup(gc,
                                      LIBXL_DEVICE_MODEL_START_TIMEOUT,
                                      "Device Model", path, "running", starting);
-    if (dm_info->saved_state) {
-        ret2 = unlink(dm_info->saved_state);
-        if (ret2) LIBXL__LOG_ERRNO(ctx, XTL_ERROR,
+    if (state->saved_state) {
+        ret2 = unlink(state->saved_state);
+        if (ret2) LIBXL__LOG_ERRNO(CTX, XTL_ERROR,
                                    "failed to remove device-model state %s\n",
-                                   dm_info->saved_state);
+                                   state->saved_state);
         /* Do not clobber spawn_confirm error code with unlink error code. */
         if (!ret) ret = ret2;
     }
@@ -1110,10 +1116,11 @@
 int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
                              libxl_domain_config *guest_config,
                              libxl_device_model_info *info,
+                             libxl__domain_build_state *state,
                              libxl__spawner_starting **starting_r)
 {
     libxl__build_xenpv_qemu_args(gc, domid, info);
-    libxl__create_device_model(gc, guest_config, info, starting_r);
+    libxl__create_device_model(gc, guest_config, info, state, starting_r);
     return 0;
 }
 
diff -r f7cc388711c8 -r 9356938a851d tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Tue Jan 31 16:34:32 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Tue Jan 31 16:34:38 2012 +0000
@@ -599,7 +599,10 @@
 
     uint32_t console_port;
     unsigned long console_mfn;
+
     unsigned long vm_generationid_addr;
+
+    char *saved_state;
 } libxl__domain_build_state;
 
 _hidden int libxl__build_pre(libxl__gc *gc, uint32_t domid,
@@ -868,10 +871,12 @@
 _hidden int libxl__create_device_model(libxl__gc *gc,
                               libxl_domain_config *guest_config,
                               libxl_device_model_info *info,
+                              libxl__domain_build_state *state,
                               libxl__spawner_starting **starting_r);
 _hidden int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
                               libxl_domain_config *guest_config,
                               libxl_device_model_info *dm_info,
+                              libxl__domain_build_state *state,
                               libxl__spawner_starting **starting_r);
 _hidden int libxl__need_xenpv_qemu(libxl__gc *gc,
         int nr_consoles, libxl_device_console *consoles,
@@ -881,7 +886,7 @@
    * return pass *starting_r (which will be non-0) to
    * libxl__confirm_device_model_startup or libxl__detach_device_model. */
 _hidden int libxl__confirm_device_model_startup(libxl__gc *gc,
-                              libxl_device_model_info *dm_info,
+                              libxl__domain_build_state *state,
                               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,
diff -r f7cc388711c8 -r 9356938a851d tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:32 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:38 2012 +0000
@@ -265,8 +265,6 @@
 # Device Model Information
 libxl_device_model_info = Struct("device_model_info",[
     ("domid",            libxl_domid),
-    
-    ("saved_state",      string),
     ],
 )
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:30 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9K-00083Z-Bk; Fri, 03 Feb 2012 21:58:30 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9I-0007zK-To
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:29 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-174.messagelabs.com!1328306301!11933633!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24277 invoked from network); 3 Feb 2012 21:58:22 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:22 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9A-0001oo-W4
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR97-00036t-Sp
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:18 +0000
Message-Id: <E1RtR97-00036t-Sp@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: move "saved_state" to
	libxl__domain_build_state.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027678 0
# Node ID 9356938a851d93571fc16c5922f5db8242d7daf7
# Parent  f7cc388711c8bebca5fc806b4365d25ef50e8540
libxl: move "saved_state" to libxl__domain_build_state.

This is internal to the library and need not be exposed to the user.

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


diff -r f7cc388711c8 -r 9356938a851d tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 16:34:32 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 16:34:38 2012 +0000
@@ -278,9 +278,8 @@
     if (ret)
         goto out;
 
-    dm_info->saved_state = NULL;
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
-        ret = asprintf(&dm_info->saved_state,
+        ret = asprintf(&state->saved_state,
                        XC_DEVICE_MODEL_RESTORE_FILE".%d", domid);
         ret = (ret < 0) ? ERROR_FAIL : 0;
     }
@@ -512,13 +511,11 @@
         }
     }
 
+    memset(&state, 0, sizeof(state));
+
     if ( restore_fd >= 0 ) {
         ret = domain_restore(gc, &d_config->b_info, domid, restore_fd, &state, dm_info);
     } else {
-        if (dm_info->saved_state) {
-            free(dm_info->saved_state);
-            dm_info->saved_state = NULL;
-        }
         ret = libxl__domain_build(gc, &d_config->b_info, dm_info, domid, &state);
     }
 
@@ -568,7 +565,7 @@
 
         dm_info->domid = domid;
         ret = libxl__create_device_model(gc, d_config, dm_info,
-                                        &dm_starting);
+                                         &state, &dm_starting);
         if (ret < 0) {
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
                        "failed to create device model: %d", ret);
@@ -605,8 +602,8 @@
             /* only copy those useful configs */
             memset((void*)&xenpv_dm_info, 0, sizeof(libxl_device_model_info));
 
-            libxl__create_xenpv_qemu(gc, domid,
-                                     d_config, &xenpv_dm_info, &dm_starting);
+            libxl__create_xenpv_qemu(gc, domid, d_config,
+                                     &xenpv_dm_info, &state, &dm_starting);
         }
         break;
     }
@@ -620,7 +617,7 @@
             == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
             libxl__qmp_initializations(ctx, domid);
         }
-        ret = libxl__confirm_device_model_startup(gc, dm_info, dm_starting);
+        ret = libxl__confirm_device_model_startup(gc, &state, dm_starting);
         if (ret < 0) {
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
                        "device model did not start: %d", ret);
diff -r f7cc388711c8 -r 9356938a851d tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 16:34:32 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 16:34:38 2012 +0000
@@ -111,7 +111,8 @@
 static char ** libxl__build_device_model_args_old(libxl__gc *gc,
                                         const char *dm,
                                         const libxl_domain_config *guest_config,
-                                        const libxl_device_model_info *info)
+                                        const libxl_device_model_info *info,
+                                        const libxl__domain_build_state *state)
 {
     const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
@@ -248,8 +249,8 @@
             flexarray_append(dm_args, "-nographic");
     }
 
-    if (info->saved_state) {
-        flexarray_vappend(dm_args, "-loadvm", info->saved_state, NULL);
+    if (state->saved_state) {
+        flexarray_vappend(dm_args, "-loadvm", state->saved_state, NULL);
     }
     for (i = 0; b_info->extra && b_info->extra[i] != NULL; i++)
         flexarray_append(dm_args, b_info->extra[i]);
@@ -321,7 +322,8 @@
 static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                                         const char *dm,
                                         const libxl_domain_config *guest_config,
-                                        const libxl_device_model_info *info)
+                                        const libxl_device_model_info *info,
+                                        const libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     const libxl_domain_create_info *c_info = &guest_config->c_info;
@@ -489,9 +491,9 @@
         }
     }
 
-    if (info->saved_state) {
+    if (state->saved_state) {
         /* This file descriptor is meant to be used by QEMU */
-        int migration_fd = open(info->saved_state, O_RDONLY);
+        int migration_fd = open(state->saved_state, O_RDONLY);
         flexarray_append(dm_args, "-incoming");
         flexarray_append(dm_args, libxl__sprintf(gc, "fd:%d", migration_fd));
     }
@@ -581,15 +583,16 @@
 static char ** libxl__build_device_model_args(libxl__gc *gc,
                                         const char *dm,
                                         const libxl_domain_config *guest_config,
-                                        const libxl_device_model_info *info)
+                                        const libxl_device_model_info *info,
+                                        const libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
 
     switch (guest_config->b_info.device_model_version) {
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
-        return libxl__build_device_model_args_old(gc, dm, guest_config, info);
+        return libxl__build_device_model_args_old(gc, dm, guest_config, info, state);
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
-        return libxl__build_device_model_args_new(gc, dm, guest_config, info);
+        return libxl__build_device_model_args_new(gc, dm, guest_config, info, state);
     default:
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unknown device model version %d",
                          guest_config->b_info.device_model_version);
@@ -672,6 +675,7 @@
 static int libxl__create_stubdom(libxl__gc *gc,
                                  libxl_domain_config *guest_config,
                                  libxl_device_model_info *info,
+                                 libxl__domain_build_state *d_state,
                                  libxl__spawner_starting **starting_r)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
@@ -680,7 +684,7 @@
     libxl_domain_config dm_config;
     libxl_device_vfb vfb;
     libxl_device_vkb vkb;
-    libxl__domain_build_state state;
+    libxl__domain_build_state stubdom_state;
     uint32_t domid;
     char **args;
     struct xs_permissions perm[2];
@@ -738,12 +742,12 @@
     ret = libxl__domain_make(gc, &dm_config.c_info, &domid);
     if (ret)
         goto out;
-    ret = libxl__domain_build(gc, &dm_config.b_info, info, domid, &state);
+    ret = libxl__domain_build(gc, &dm_config.b_info, info, domid, &stubdom_state);
     if (ret)
         goto out;
 
     args = libxl__build_device_model_args(gc, "stubdom-dm",
-                                          guest_config, info);
+                                          guest_config, info, d_state);
     if (!args) {
         ret = ERROR_FAIL;
         goto out;
@@ -813,7 +817,8 @@
             char *filename;
             char *name;
             case STUBDOM_CONSOLE_LOGGING:
-                name = libxl__sprintf(gc, "qemu-dm-%s", libxl_domid_to_name(ctx, info->domid));
+                name = libxl__sprintf(gc, "qemu-dm-%s",
+                                      libxl_domid_to_name(ctx, info->domid));
                 libxl_create_logfile(ctx, name, &filename);
                 console[i].output = libxl__sprintf(gc, "file:%s", filename);
                 free(filename);
@@ -823,15 +828,16 @@
                                 libxl__device_model_savefile(gc, info->domid));
                 break;
             case STUBDOM_CONSOLE_RESTORE:
-                if (info->saved_state)
-                    console[i].output = libxl__sprintf(gc, "pipe:%s", info->saved_state);
+                if (d_state->saved_state)
+                    console[i].output =
+                        libxl__sprintf(gc, "pipe:%s", d_state->saved_state);
                 break;
             default:
                 console[i].output = "pty";
                 break;
         }
         ret = libxl__device_console_add(gc, domid, &console[i],
-                                    i == STUBDOM_CONSOLE_LOGGING ? &state : NULL);
+                        i == STUBDOM_CONSOLE_LOGGING ? &stubdom_state : NULL);
         if (ret)
             goto out_free;
     }
@@ -841,12 +847,12 @@
     if (libxl__create_xenpv_qemu(gc, domid,
                                  &dm_config,
                                  &xenpv_dm_info,
+                                 &stubdom_state,
                                  &dm_starting) < 0) {
         ret = ERROR_FAIL;
         goto out_free;
     }
-    if (libxl__confirm_device_model_startup(gc, &xenpv_dm_info,
-                                            dm_starting) < 0) {
+    if (libxl__confirm_device_model_startup(gc, d_state, dm_starting) < 0) {
         ret = ERROR_FAIL;
         goto out_free;
     }
@@ -871,6 +877,7 @@
 int libxl__create_device_model(libxl__gc *gc,
                               libxl_domain_config *guest_config,
                               libxl_device_model_info *info,
+                              libxl__domain_build_state *state,
                               libxl__spawner_starting **starting_r)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
@@ -888,7 +895,7 @@
     const char *dm;
 
     if (b_info->device_model_stubdomain) {
-        rc = libxl__create_stubdom(gc, guest_config, info, starting_r);
+        rc = libxl__create_stubdom(gc, guest_config, info, state, starting_r);
         goto out;
     }
 
@@ -903,7 +910,7 @@
         rc = ERROR_FAIL;
         goto out;
     }
-    args = libxl__build_device_model_args(gc, dm, guest_config, info);
+    args = libxl__build_device_model_args(gc, dm, guest_config, info, state);
     if (!args) {
         rc = ERROR_FAIL;
         goto out;
@@ -984,10 +991,9 @@
 
 
 int libxl__confirm_device_model_startup(libxl__gc *gc,
-                                libxl_device_model_info *dm_info,
+                                libxl__domain_build_state *state,
                                 libxl__spawner_starting *starting)
 {
-    libxl_ctx *ctx = libxl__gc_owner(gc);
     char *path;
     int domid = starting->domid;
     int ret, ret2;
@@ -995,11 +1001,11 @@
     ret = libxl__spawn_confirm_offspring_startup(gc,
                                      LIBXL_DEVICE_MODEL_START_TIMEOUT,
                                      "Device Model", path, "running", starting);
-    if (dm_info->saved_state) {
-        ret2 = unlink(dm_info->saved_state);
-        if (ret2) LIBXL__LOG_ERRNO(ctx, XTL_ERROR,
+    if (state->saved_state) {
+        ret2 = unlink(state->saved_state);
+        if (ret2) LIBXL__LOG_ERRNO(CTX, XTL_ERROR,
                                    "failed to remove device-model state %s\n",
-                                   dm_info->saved_state);
+                                   state->saved_state);
         /* Do not clobber spawn_confirm error code with unlink error code. */
         if (!ret) ret = ret2;
     }
@@ -1110,10 +1116,11 @@
 int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
                              libxl_domain_config *guest_config,
                              libxl_device_model_info *info,
+                             libxl__domain_build_state *state,
                              libxl__spawner_starting **starting_r)
 {
     libxl__build_xenpv_qemu_args(gc, domid, info);
-    libxl__create_device_model(gc, guest_config, info, starting_r);
+    libxl__create_device_model(gc, guest_config, info, state, starting_r);
     return 0;
 }
 
diff -r f7cc388711c8 -r 9356938a851d tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Tue Jan 31 16:34:32 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Tue Jan 31 16:34:38 2012 +0000
@@ -599,7 +599,10 @@
 
     uint32_t console_port;
     unsigned long console_mfn;
+
     unsigned long vm_generationid_addr;
+
+    char *saved_state;
 } libxl__domain_build_state;
 
 _hidden int libxl__build_pre(libxl__gc *gc, uint32_t domid,
@@ -868,10 +871,12 @@
 _hidden int libxl__create_device_model(libxl__gc *gc,
                               libxl_domain_config *guest_config,
                               libxl_device_model_info *info,
+                              libxl__domain_build_state *state,
                               libxl__spawner_starting **starting_r);
 _hidden int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
                               libxl_domain_config *guest_config,
                               libxl_device_model_info *dm_info,
+                              libxl__domain_build_state *state,
                               libxl__spawner_starting **starting_r);
 _hidden int libxl__need_xenpv_qemu(libxl__gc *gc,
         int nr_consoles, libxl_device_console *consoles,
@@ -881,7 +886,7 @@
    * return pass *starting_r (which will be non-0) to
    * libxl__confirm_device_model_startup or libxl__detach_device_model. */
 _hidden int libxl__confirm_device_model_startup(libxl__gc *gc,
-                              libxl_device_model_info *dm_info,
+                              libxl__domain_build_state *state,
                               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,
diff -r f7cc388711c8 -r 9356938a851d tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:32 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:38 2012 +0000
@@ -265,8 +265,6 @@
 # Device Model Information
 libxl_device_model_info = Struct("device_model_info",[
     ("domid",            libxl_domid),
-    
-    ("saved_state",      string),
     ],
 )
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:33 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9N-00085v-Eu; Fri, 03 Feb 2012 21:58:33 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9L-000811-S0
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:32 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-182.messagelabs.com!1328306302!13568369!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30058 invoked from network); 3 Feb 2012 21:58:23 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9C-0001os-DC
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:22 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9B-000385-H9
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:22 +0000
Message-Id: <E1RtR9B-000385-H9@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: remove
	libxl_device_model_info.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027678 0
# Node ID 05310d1a73ed310e3c0c18f9829a4356a40f8cb6
# Parent  9356938a851d93571fc16c5922f5db8242d7daf7
libxl: remove libxl_device_model_info.

All that is left here is the target domain's domid which we can pass around as
a parameter.

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


diff -r 9356938a851d -r 05310d1a73ed tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Jan 31 16:34:38 2012 +0000
@@ -2621,7 +2621,7 @@
 }
 
 int libxl_domain_need_memory(libxl_ctx *ctx, libxl_domain_build_info *b_info,
-        libxl_device_model_info *dm_info, uint32_t *need_memkb)
+                             uint32_t *need_memkb)
 {
     GC_INIT(ctx);
     int rc = ERROR_INVAL;
diff -r 9356938a851d -r 05310d1a73ed tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl.h	Tue Jan 31 16:34:38 2012 +0000
@@ -295,7 +295,6 @@
 typedef struct {
     libxl_domain_create_info c_info;
     libxl_domain_build_info b_info;
-    libxl_device_model_info dm_info;
 
     int num_disks, num_vifs, num_pcidevs, num_vfbs, num_vkbs;
 
@@ -323,10 +322,6 @@
 int libxl_init_build_info(libxl_ctx *ctx,
                           libxl_domain_build_info *b_info,
                           libxl_domain_create_info *c_info);
-int libxl_init_dm_info(libxl_ctx *ctx,
-                       libxl_device_model_info *dm_info,
-                       libxl_domain_create_info *c_info,
-                       libxl_domain_build_info *b_info);
 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);
@@ -379,7 +374,7 @@
 int libxl_get_memory_target(libxl_ctx *ctx, uint32_t domid, uint32_t *out_target);
 /* how much free memory in the system a domain needs to be built */
 int libxl_domain_need_memory(libxl_ctx *ctx, libxl_domain_build_info *b_info,
-        libxl_device_model_info *dm_info, uint32_t *need_memkb);
+                             uint32_t *need_memkb);
 /* how much free memory is available in the system */
 int libxl_get_free_memory(libxl_ctx *ctx, uint32_t *memkb);
 /* wait for a given amount of memory to be free in the system */
diff -r 9356938a851d -r 05310d1a73ed tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 16:34:38 2012 +0000
@@ -48,7 +48,6 @@
 
     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)
@@ -130,17 +129,6 @@
     return 0;
 }
 
-int libxl_init_dm_info(libxl_ctx *ctx,
-                       libxl_device_model_info *dm_info,
-                       libxl_domain_create_info *c_info,
-                       libxl_domain_build_info *b_info)
-{
-    memset(dm_info, '\0', sizeof(*dm_info));
-
-
-    return 0;
-}
-
 static int init_console_info(libxl_device_console *console, int dev_num)
 {
     memset(console, 0x00, sizeof(libxl_device_console));
@@ -154,7 +142,6 @@
 
 int libxl__domain_build(libxl__gc *gc,
                         libxl_domain_build_info *info,
-                        libxl_device_model_info *dm_info,
                         uint32_t domid,
                         libxl__domain_build_state *state)
 {
@@ -170,7 +157,7 @@
 
     switch (info->type) {
     case LIBXL_DOMAIN_TYPE_HVM:
-        ret = libxl__build_hvm(gc, domid, info, dm_info, state);
+        ret = libxl__build_hvm(gc, domid, info, state);
         if (ret)
             goto out;
 
@@ -224,8 +211,7 @@
 
 static int domain_restore(libxl__gc *gc, libxl_domain_build_info *info,
                           uint32_t domid, int fd,
-                          libxl__domain_build_state *state,
-                          libxl_device_model_info *dm_info)
+                          libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     char **vments = NULL, **localents = NULL;
@@ -477,7 +463,6 @@
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     libxl__spawner_starting *dm_starting = 0;
-    libxl_device_model_info *dm_info = &d_config->dm_info;
     libxl__domain_build_state state;
     uint32_t domid;
     int i, ret;
@@ -514,9 +499,9 @@
     memset(&state, 0, sizeof(state));
 
     if ( restore_fd >= 0 ) {
-        ret = domain_restore(gc, &d_config->b_info, domid, restore_fd, &state, dm_info);
+        ret = domain_restore(gc, &d_config->b_info, domid, restore_fd, &state);
     } else {
-        ret = libxl__domain_build(gc, &d_config->b_info, dm_info, domid, &state);
+        ret = libxl__domain_build(gc, &d_config->b_info, domid, &state);
     }
 
     if (ret) {
@@ -563,8 +548,7 @@
         libxl_device_vkb_add(ctx, domid, &vkb);
         libxl_device_vkb_dispose(&vkb);
 
-        dm_info->domid = domid;
-        ret = libxl__create_device_model(gc, d_config, dm_info,
+        ret = libxl__create_device_model(gc, domid, d_config,
                                          &state, &dm_starting);
         if (ret < 0) {
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
@@ -577,7 +561,6 @@
     {
         int need_qemu = 0;
         libxl_device_console console;
-        libxl_device_model_info xenpv_dm_info;
 
         for (i = 0; i < d_config->num_vfbs; i++) {
             libxl_device_vfb_add(ctx, domid, &d_config->vfbs[i]);
@@ -599,11 +582,7 @@
         libxl_device_console_dispose(&console);
 
         if (need_qemu) {
-            /* only copy those useful configs */
-            memset((void*)&xenpv_dm_info, 0, sizeof(libxl_device_model_info));
-
-            libxl__create_xenpv_qemu(gc, domid, d_config,
-                                     &xenpv_dm_info, &state, &dm_starting);
+            libxl__create_xenpv_qemu(gc, domid, d_config, &state, &dm_starting);
         }
         break;
     }
diff -r 9356938a851d -r 05310d1a73ed tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 16:34:38 2012 +0000
@@ -73,8 +73,7 @@
     }
 }
 
-static const libxl_vnc_info *dm_vnc(const libxl_domain_config *guest_config,
-                                    const libxl_device_model_info *info)
+static const libxl_vnc_info *dm_vnc(const libxl_domain_config *guest_config)
 {
     const libxl_vnc_info *vnc = NULL;
     if (guest_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) {
@@ -85,8 +84,7 @@
     return vnc && vnc->enable ? vnc : NULL;
 }
 
-static const libxl_sdl_info *dm_sdl(const libxl_domain_config *guest_config,
-                                    const libxl_device_model_info *info)
+static const libxl_sdl_info *dm_sdl(const libxl_domain_config *guest_config)
 {
     const libxl_sdl_info *sdl = NULL;
     if (guest_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) {
@@ -97,8 +95,7 @@
     return sdl && sdl->enable ? sdl : NULL;
 }
 
-static const char *dm_keymap(const libxl_domain_config *guest_config,
-                             const libxl_device_model_info *info)
+static const char *dm_keymap(const libxl_domain_config *guest_config)
 {
     if (guest_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) {
         return guest_config->b_info.u.hvm.keymap;
@@ -109,18 +106,17 @@
 }
 
 static char ** libxl__build_device_model_args_old(libxl__gc *gc,
-                                        const char *dm,
+                                        const char *dm, int domid,
                                         const libxl_domain_config *guest_config,
-                                        const libxl_device_model_info *info,
                                         const libxl__domain_build_state *state)
 {
     const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
     const libxl_device_nic *vifs = guest_config->vifs;
-    const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
-    const libxl_sdl_info *sdl = dm_sdl(guest_config, info);
+    const libxl_vnc_info *vnc = dm_vnc(guest_config);
+    const libxl_sdl_info *sdl = dm_sdl(guest_config);
     const int num_vifs = guest_config->num_vifs;
-    const char *keymap = dm_keymap(guest_config, info);
+    const char *keymap = dm_keymap(guest_config);
     int i;
     flexarray_t *dm_args;
     dm_args = flexarray_make(16, 1);
@@ -129,7 +125,7 @@
         return NULL;
 
     flexarray_vappend(dm_args, dm,
-                      "-d", libxl__sprintf(gc, "%d", info->domid), NULL);
+                      "-d", libxl__sprintf(gc, "%d", domid), NULL);
 
     if (c_info->name)
         flexarray_vappend(dm_args, "-domain-name", c_info->name, NULL);
@@ -225,7 +221,8 @@
                                    LIBXL_MAC_FMT, LIBXL_MAC_BYTES(vifs[i].mac));
                 char *ifname;
                 if (!vifs[i].ifname)
-                    ifname = libxl__sprintf(gc, "tap%d.%d", info->domid, vifs[i].devid);
+                    ifname = libxl__sprintf(gc,
+                                            "tap%d.%d", domid, vifs[i].devid);
                 else
                     ifname = vifs[i].ifname;
                 flexarray_vappend(dm_args,
@@ -320,9 +317,8 @@
 }
 
 static char ** libxl__build_device_model_args_new(libxl__gc *gc,
-                                        const char *dm,
+                                        const char *dm, int guest_domid,
                                         const libxl_domain_config *guest_config,
-                                        const libxl_device_model_info *info,
                                         const libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
@@ -332,9 +328,9 @@
     const libxl_device_nic *vifs = guest_config->vifs;
     const int num_disks = guest_config->num_disks;
     const int num_vifs = guest_config->num_vifs;
-    const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
-    const libxl_sdl_info *sdl = dm_sdl(guest_config, info);
-    const char *keymap = dm_keymap(guest_config, info);
+    const libxl_vnc_info *vnc = dm_vnc(guest_config);
+    const libxl_sdl_info *sdl = dm_sdl(guest_config);
+    const char *keymap = dm_keymap(guest_config);
     flexarray_t *dm_args;
     int i;
 
@@ -343,14 +339,14 @@
         return NULL;
 
     flexarray_vappend(dm_args, dm,
-                      "-xen-domid", libxl__sprintf(gc, "%d", info->domid), NULL);
+                      "-xen-domid",
+                      libxl__sprintf(gc, "%d", guest_domid), NULL);
 
     flexarray_append(dm_args, "-chardev");
     flexarray_append(dm_args,
                      libxl__sprintf(gc, "socket,id=libxl-cmd,"
                                     "path=%s/qmp-libxl-%d,server,nowait",
-                                    libxl_run_dir_path(),
-                                    info->domid));
+                                    libxl_run_dir_path(), guest_domid));
 
     flexarray_append(dm_args, "-mon");
     flexarray_append(dm_args, "chardev=libxl-cmd,mode=control");
@@ -460,7 +456,8 @@
                                 LIBXL_MAC_FMT, LIBXL_MAC_BYTES(vifs[i].mac));
                 char *ifname;
                 if (!vifs[i].ifname) {
-                    ifname = libxl__sprintf(gc, "tap%d.%d", info->domid, vifs[i].devid);
+                    ifname = libxl__sprintf(gc, "tap%d.%d",
+                                            guest_domid, vifs[i].devid);
                 } else {
                     ifname = vifs[i].ifname;
                 }
@@ -581,18 +578,21 @@
 }
 
 static char ** libxl__build_device_model_args(libxl__gc *gc,
-                                        const char *dm,
+                                        const char *dm, int guest_domid,
                                         const libxl_domain_config *guest_config,
-                                        const libxl_device_model_info *info,
                                         const libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
 
     switch (guest_config->b_info.device_model_version) {
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
-        return libxl__build_device_model_args_old(gc, dm, guest_config, info, state);
+        return libxl__build_device_model_args_old(gc, dm,
+                                                  guest_domid, guest_config,
+                                                  state);
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
-        return libxl__build_device_model_args_new(gc, dm, guest_config, info, state);
+        return libxl__build_device_model_args_new(gc, dm,
+                                                  guest_domid, guest_config,
+                                                  state);
     default:
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unknown device model version %d",
                          guest_config->b_info.device_model_version);
@@ -624,7 +624,9 @@
     return 0;
 }
 
-static int libxl__write_dmargs(libxl__gc *gc, int domid, int guest_domid, char **args)
+static int libxl__write_stub_dmargs(libxl__gc *gc,
+                                    int dm_domid, int guest_domid,
+                                    char **args)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int i;
@@ -636,7 +638,7 @@
 
     roperm[0].id = 0;
     roperm[0].perms = XS_PERM_NONE;
-    roperm[1].id = domid;
+    roperm[1].id = dm_domid;
     roperm[1].perms = XS_PERM_READ;
 
     vm_path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "/local/domain/%d/vm", guest_domid));
@@ -673,8 +675,8 @@
 }
 
 static int libxl__create_stubdom(libxl__gc *gc,
+                                 int guest_domid,
                                  libxl_domain_config *guest_config,
-                                 libxl_device_model_info *info,
                                  libxl__domain_build_state *d_state,
                                  libxl__spawner_starting **starting_r)
 {
@@ -685,12 +687,11 @@
     libxl_device_vfb vfb;
     libxl_device_vkb vkb;
     libxl__domain_build_state stubdom_state;
-    uint32_t domid;
+    uint32_t dm_domid;
     char **args;
     struct xs_permissions perm[2];
     xs_transaction_t t;
     libxl__spawner_starting *dm_starting = 0;
-    libxl_device_model_info xenpv_dm_info;
 
     if (guest_config->b_info.device_model_version !=
         LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL) {
@@ -700,7 +701,8 @@
 
     memset(&dm_config.c_info, 0x00, sizeof(libxl_domain_create_info));
     dm_config.c_info.type = LIBXL_DOMAIN_TYPE_PV;
-    dm_config.c_info.name = libxl__sprintf(gc, "%s-dm", libxl__domid_to_name(gc, info->domid));
+    dm_config.c_info.name = libxl__sprintf(gc, "%s-dm",
+                                    libxl__domid_to_name(gc, guest_domid));
 
     libxl_uuid_generate(&dm_config.c_info.uuid);
 
@@ -713,7 +715,7 @@
     dm_config.b_info.type = LIBXL_DOMAIN_TYPE_PV;
     dm_config.b_info.u.pv.kernel.path = libxl__abs_path(gc, "ioemu-stubdom.gz",
                                               libxl_xenfirmwaredir_path());
-    dm_config.b_info.u.pv.cmdline = libxl__sprintf(gc, " -d %d", info->domid);
+    dm_config.b_info.u.pv.cmdline = libxl__sprintf(gc, " -d %d", guest_domid);
     dm_config.b_info.u.pv.ramdisk.path = "";
     dm_config.b_info.u.pv.features = "";
 
@@ -738,62 +740,69 @@
     dm_config.num_vkbs = 1;
 
     /* fixme: this function can leak the stubdom if it fails */
-    domid = 0;
-    ret = libxl__domain_make(gc, &dm_config.c_info, &domid);
+    dm_domid = 0;
+    ret = libxl__domain_make(gc, &dm_config.c_info, &dm_domid);
     if (ret)
         goto out;
-    ret = libxl__domain_build(gc, &dm_config.b_info, info, domid, &stubdom_state);
+    ret = libxl__domain_build(gc, &dm_config.b_info, dm_domid, &stubdom_state);
     if (ret)
         goto out;
 
-    args = libxl__build_device_model_args(gc, "stubdom-dm",
-                                          guest_config, info, d_state);
+    args = libxl__build_device_model_args(gc, "stubdom-dm", guest_domid,
+                                          guest_config, d_state);
     if (!args) {
         ret = ERROR_FAIL;
         goto out;
     }
 
-    libxl__write_dmargs(gc, domid, info->domid, args);
+    libxl__write_stub_dmargs(gc, dm_domid, guest_domid, args);
     libxl__xs_write(gc, XBT_NULL,
-                   libxl__sprintf(gc, "%s/image/device-model-domid", libxl__xs_get_dompath(gc, info->domid)),
-                   "%d", domid);
+                   libxl__sprintf(gc, "%s/image/device-model-domid",
+                                  libxl__xs_get_dompath(gc, guest_domid)),
+                   "%d", dm_domid);
     libxl__xs_write(gc, XBT_NULL,
-                   libxl__sprintf(gc, "%s/target", libxl__xs_get_dompath(gc, domid)),
-                   "%d", info->domid);
-    ret = xc_domain_set_target(ctx->xch, domid, info->domid);
+                   libxl__sprintf(gc, "%s/target",
+                                  libxl__xs_get_dompath(gc, dm_domid)),
+                   "%d", guest_domid);
+    ret = xc_domain_set_target(ctx->xch, dm_domid, guest_domid);
     if (ret<0) {
-        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "setting target domain %d -> %d", domid, info->domid);
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+                         "setting target domain %d -> %d",
+                         dm_domid, guest_domid);
         ret = ERROR_FAIL;
         goto out_free;
     }
-    xs_set_target(ctx->xsh, domid, info->domid);
+    xs_set_target(ctx->xsh, dm_domid, guest_domid);
 
-    perm[0].id = domid;
+    perm[0].id = dm_domid;
     perm[0].perms = XS_PERM_NONE;
-    perm[1].id = info->domid;
+    perm[1].id = guest_domid;
     perm[1].perms = XS_PERM_READ;
 retry_transaction:
     t = xs_transaction_start(ctx->xsh);
-    xs_mkdir(ctx->xsh, t, libxl__sprintf(gc, "/local/domain/0/device-model/%d", info->domid));
-    xs_set_permissions(ctx->xsh, t, libxl__sprintf(gc, "/local/domain/0/device-model/%d", info->domid), perm, ARRAY_SIZE(perm));
+    xs_mkdir(ctx->xsh, t,
+        libxl__sprintf(gc, "/local/domain/0/device-model/%d", guest_domid));
+    xs_set_permissions(ctx->xsh, t,
+        libxl__sprintf(gc, "/local/domain/0/device-model/%d", guest_domid),
+                       perm, ARRAY_SIZE(perm));
     if (!xs_transaction_end(ctx->xsh, t, 0))
         if (errno == EAGAIN)
             goto retry_transaction;
 
     for (i = 0; i < dm_config.num_disks; i++) {
-        ret = libxl_device_disk_add(ctx, domid, &dm_config.disks[i]);
+        ret = libxl_device_disk_add(ctx, dm_domid, &dm_config.disks[i]);
         if (ret)
             goto out_free;
     }
     for (i = 0; i < dm_config.num_vifs; i++) {
-        ret = libxl_device_nic_add(ctx, domid, &dm_config.vifs[i]);
+        ret = libxl_device_nic_add(ctx, dm_domid, &dm_config.vifs[i]);
         if (ret)
             goto out_free;
     }
-    ret = libxl_device_vfb_add(ctx, domid, &dm_config.vfbs[0]);
+    ret = libxl_device_vfb_add(ctx, dm_domid, &dm_config.vfbs[0]);
     if (ret)
         goto out_free;
-    ret = libxl_device_vkb_add(ctx, domid, &dm_config.vkbs[0]);
+    ret = libxl_device_vkb_add(ctx, dm_domid, &dm_config.vkbs[0]);
     if (ret)
         goto out_free;
 
@@ -818,14 +827,14 @@
             char *name;
             case STUBDOM_CONSOLE_LOGGING:
                 name = libxl__sprintf(gc, "qemu-dm-%s",
-                                      libxl_domid_to_name(ctx, info->domid));
+                                      libxl_domid_to_name(ctx, guest_domid));
                 libxl_create_logfile(ctx, name, &filename);
                 console[i].output = libxl__sprintf(gc, "file:%s", filename);
                 free(filename);
                 break;
             case STUBDOM_CONSOLE_SAVE:
                 console[i].output = libxl__sprintf(gc, "file:%s",
-                                libxl__device_model_savefile(gc, info->domid));
+                                libxl__device_model_savefile(gc, guest_domid));
                 break;
             case STUBDOM_CONSOLE_RESTORE:
                 if (d_state->saved_state)
@@ -836,17 +845,14 @@
                 console[i].output = "pty";
                 break;
         }
-        ret = libxl__device_console_add(gc, domid, &console[i],
+        ret = libxl__device_console_add(gc, dm_domid, &console[i],
                         i == STUBDOM_CONSOLE_LOGGING ? &stubdom_state : NULL);
         if (ret)
             goto out_free;
     }
 
-    memset((void*)&xenpv_dm_info, 0, sizeof(libxl_device_model_info));
-
-    if (libxl__create_xenpv_qemu(gc, domid,
+    if (libxl__create_xenpv_qemu(gc, dm_domid,
                                  &dm_config,
-                                 &xenpv_dm_info,
                                  &stubdom_state,
                                  &dm_starting) < 0) {
         ret = ERROR_FAIL;
@@ -857,12 +863,12 @@
         goto out_free;
     }
 
-    libxl_domain_unpause(ctx, domid);
+    libxl_domain_unpause(ctx, dm_domid);
 
     if (starting_r) {
         *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)->domid = guest_domid;
+        (*starting_r)->dom_path = libxl__xs_get_dompath(gc, guest_domid);
         (*starting_r)->for_spawn = NULL;
     }
 
@@ -875,15 +881,15 @@
 }
 
 int libxl__create_device_model(libxl__gc *gc,
+                              int domid,
                               libxl_domain_config *guest_config,
-                              libxl_device_model_info *info,
                               libxl__domain_build_state *state,
                               libxl__spawner_starting **starting_r)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
-    const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
+    const libxl_vnc_info *vnc = dm_vnc(guest_config);
     char *path, *logfile;
     int logfile_w, null;
     int rc;
@@ -895,7 +901,7 @@
     const char *dm;
 
     if (b_info->device_model_stubdomain) {
-        rc = libxl__create_stubdom(gc, guest_config, info, state, starting_r);
+        rc = libxl__create_stubdom(gc, domid, guest_config, state, starting_r);
         goto out;
     }
 
@@ -910,18 +916,18 @@
         rc = ERROR_FAIL;
         goto out;
     }
-    args = libxl__build_device_model_args(gc, dm, guest_config, info, state);
+    args = libxl__build_device_model_args(gc, dm, domid, guest_config, state);
     if (!args) {
         rc = ERROR_FAIL;
         goto out;
     }
 
-    path = xs_get_domain_path(ctx->xsh, info->domid);
+    path = xs_get_domain_path(ctx->xsh, domid);
     libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/hvmloader/bios", path),
                     "%s", libxl__domain_bios(gc, b_info));
     free(path);
 
-    path = libxl__sprintf(gc, "/local/domain/0/device-model/%d", info->domid);
+    path = libxl__sprintf(gc, "/local/domain/0/device-model/%d", domid);
     xs_mkdir(ctx->xsh, XBT_NULL, path);
     libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/disable_pf", path),
                     "%d", !b_info->u.hvm.xen_platform_pci);
@@ -945,8 +951,8 @@
         p->for_spawn = NULL;
     }
 
-    p->domid = info->domid;
-    p->dom_path = libxl__xs_get_dompath(gc, info->domid);
+    p->domid = domid;
+    p->dom_path = libxl__xs_get_dompath(gc, domid);
     p->pid_path = "image/device-model-pid";
     if (!p->dom_path) {
         rc = ERROR_FAIL;
@@ -1068,14 +1074,6 @@
     return ret;
 }
 
-static int libxl__build_xenpv_qemu_args(libxl__gc *gc,
-                                        uint32_t domid,
-                                        libxl_device_model_info *info)
-{
-    info->domid = domid;
-    return 0;
-}
-
 int libxl__need_xenpv_qemu(libxl__gc *gc,
         int nr_consoles, libxl_device_console *consoles,
         int nr_vfbs, libxl_device_vfb *vfbs,
@@ -1115,12 +1113,10 @@
 
 int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
                              libxl_domain_config *guest_config,
-                             libxl_device_model_info *info,
                              libxl__domain_build_state *state,
                              libxl__spawner_starting **starting_r)
 {
-    libxl__build_xenpv_qemu_args(gc, domid, info);
-    libxl__create_device_model(gc, guest_config, info, state, starting_r);
+    libxl__create_device_model(gc, domid, guest_config, state, starting_r);
     return 0;
 }
 
diff -r 9356938a851d -r 05310d1a73ed tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl_dom.c	Tue Jan 31 16:34:38 2012 +0000
@@ -291,8 +291,7 @@
 }
 
 static const char *libxl__domain_firmware(libxl__gc *gc,
-                                          libxl_domain_build_info *info,
-                                          libxl_device_model_info *dm_info)
+                                          libxl_domain_build_info *info)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     const char *firmware;
@@ -320,12 +319,11 @@
 
 int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
               libxl_domain_build_info *info,
-              libxl_device_model_info *dm_info,
               libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int ret, rc = ERROR_FAIL;
-    const char *firmware = libxl__domain_firmware(gc, info, dm_info);
+    const char *firmware = libxl__domain_firmware(gc, info);
 
     if (!firmware)
         goto out;
diff -r 9356938a851d -r 05310d1a73ed tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Tue Jan 31 16:34:38 2012 +0000
@@ -615,7 +615,6 @@
              libxl_domain_build_info *info, libxl__domain_build_state *state);
 _hidden int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
               libxl_domain_build_info *info,
-              libxl_device_model_info *dm_info,
               libxl__domain_build_state *state);
 
 _hidden int libxl__domain_rename(libxl__gc *gc, uint32_t domid,
@@ -858,10 +857,11 @@
                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_make(libxl__gc *gc,
+                               libxl_domain_create_info *info,
+                               uint32_t *domid);
 _hidden int libxl__domain_build(libxl__gc *gc,
                                 libxl_domain_build_info *info,
-                                libxl_device_model_info *dm_info,
                                 uint32_t domid,
                                 libxl__domain_build_state *state);
 
@@ -869,13 +869,12 @@
 _hidden const char *libxl__domain_device_model(libxl__gc *gc,
                                         const libxl_domain_build_info *info);
 _hidden int libxl__create_device_model(libxl__gc *gc,
+                              int domid,
                               libxl_domain_config *guest_config,
-                              libxl_device_model_info *info,
                               libxl__domain_build_state *state,
                               libxl__spawner_starting **starting_r);
 _hidden int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
                               libxl_domain_config *guest_config,
-                              libxl_device_model_info *dm_info,
                               libxl__domain_build_state *state,
                               libxl__spawner_starting **starting_r);
 _hidden int libxl__need_xenpv_qemu(libxl__gc *gc,
diff -r 9356938a851d -r 05310d1a73ed tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:38 2012 +0000
@@ -262,12 +262,6 @@
     ],
 )
 
-# Device Model Information
-libxl_device_model_info = Struct("device_model_info",[
-    ("domid",            libxl_domid),
-    ],
-)
-
 libxl_device_vfb = Struct("device_vfb", [
     ("backend_domid", libxl_domid),
     ("devid",         integer),
diff -r 9356938a851d -r 05310d1a73ed tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 16:34:38 2012 +0000
@@ -290,8 +290,7 @@
 }
 
 static void printf_info(int domid,
-                        libxl_domain_config *d_config,
-                        libxl_device_model_info *dm_info)
+                        libxl_domain_config *d_config)
 {
     int i;
     libxl_dominfo info;
@@ -631,8 +630,7 @@
 static void parse_config_data(const char *configfile_filename_report,
                               const char *configfile_data,
                               int configfile_len,
-                              libxl_domain_config *d_config,
-                              libxl_device_model_info *dm_info)
+                              libxl_domain_config *d_config)
 {
     const char *buf;
     long l;
@@ -1194,9 +1192,6 @@
         break;
     }
 
-    /* init dm from c and b */
-    if (libxl_init_dm_info(ctx, dm_info, c_info, b_info))
-        exit(1);
     /* parse device model arguments, this works for pv, hvm and stubdom */
     if (!xlu_cfg_get_string (config, "device_model", &buf, 0)) {
         fprintf(stderr,
@@ -1452,7 +1447,7 @@
     int no_incr_generationid;
 };
 
-static int freemem(libxl_domain_build_info *b_info, libxl_device_model_info *dm_info)
+static int freemem(libxl_domain_build_info *b_info)
 {
     int rc, retries = 3;
     uint32_t need_memkb, free_memkb;
@@ -1460,7 +1455,7 @@
     if (!autoballoon)
         return 0;
 
-    rc = libxl_domain_need_memory(ctx, b_info, dm_info, &need_memkb);
+    rc = libxl_domain_need_memory(ctx, b_info, &need_memkb);
     if (rc < 0)
         return rc;
 
@@ -1679,7 +1674,7 @@
     if (!dom_info->quiet)
         printf("Parsing config file %s\n", config_file);
 
-    parse_config_data(config_file, config_data, config_len, &d_config, &d_config.dm_info);
+    parse_config_data(config_file, config_data, config_len, &d_config);
 
     if (migrate_fd >= 0) {
         if (d_config.c_info.name) {
@@ -1704,7 +1699,7 @@
             dom_info->no_incr_generationid;
 
     if (debug || dom_info->dryrun)
-        printf_info(-1, &d_config, &d_config.dm_info);
+        printf_info(-1, &d_config);
 
     ret = 0;
     if (dom_info->dryrun)
@@ -1717,7 +1712,7 @@
     if (rc < 0)
         goto error_out;
 
-    ret = freemem(&d_config.b_info, &d_config.dm_info);
+    ret = freemem(&d_config.b_info);
     if (ret < 0) {
         fprintf(stderr, "failed to free memory for the domain\n");
         ret = ERROR_FAIL;
@@ -2484,7 +2479,6 @@
     char *config_file;
     uint8_t *data;
     int i, len, rc;
-    libxl_device_model_info dm_info;
 
     for (i = 0; i < nb_domain; i++) {
         /* no detailed info available on dom0 */
@@ -2495,8 +2489,8 @@
             continue;
         CHK_ERRNO(asprintf(&config_file, "<domid %d data>", info[i].domid));
         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);
+        parse_config_data(config_file, (char *)data, len, &d_config);
+        printf_info(info[i].domid, &d_config);
         libxl_domain_config_dispose(&d_config);
         free(data);
         free(config_file);
diff -r 9356938a851d -r 05310d1a73ed tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/ocaml/libs/xl/genwrap.py	Tue Jan 31 16:34:38 2012 +0000
@@ -266,7 +266,6 @@
         "cpupoolinfo",
         "domain_create_info",
         "domain_build_info",
-        "device_model_info",
         "vcpuinfo",
         "topologyinfo",
         "event",

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:33 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9N-00085v-Eu; Fri, 03 Feb 2012 21:58:33 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9L-000811-S0
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:32 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-182.messagelabs.com!1328306302!13568369!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30058 invoked from network); 3 Feb 2012 21:58:23 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9C-0001os-DC
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:22 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9B-000385-H9
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:22 +0000
Message-Id: <E1RtR9B-000385-H9@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: remove
	libxl_device_model_info.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027678 0
# Node ID 05310d1a73ed310e3c0c18f9829a4356a40f8cb6
# Parent  9356938a851d93571fc16c5922f5db8242d7daf7
libxl: remove libxl_device_model_info.

All that is left here is the target domain's domid which we can pass around as
a parameter.

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


diff -r 9356938a851d -r 05310d1a73ed tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Jan 31 16:34:38 2012 +0000
@@ -2621,7 +2621,7 @@
 }
 
 int libxl_domain_need_memory(libxl_ctx *ctx, libxl_domain_build_info *b_info,
-        libxl_device_model_info *dm_info, uint32_t *need_memkb)
+                             uint32_t *need_memkb)
 {
     GC_INIT(ctx);
     int rc = ERROR_INVAL;
diff -r 9356938a851d -r 05310d1a73ed tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl.h	Tue Jan 31 16:34:38 2012 +0000
@@ -295,7 +295,6 @@
 typedef struct {
     libxl_domain_create_info c_info;
     libxl_domain_build_info b_info;
-    libxl_device_model_info dm_info;
 
     int num_disks, num_vifs, num_pcidevs, num_vfbs, num_vkbs;
 
@@ -323,10 +322,6 @@
 int libxl_init_build_info(libxl_ctx *ctx,
                           libxl_domain_build_info *b_info,
                           libxl_domain_create_info *c_info);
-int libxl_init_dm_info(libxl_ctx *ctx,
-                       libxl_device_model_info *dm_info,
-                       libxl_domain_create_info *c_info,
-                       libxl_domain_build_info *b_info);
 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);
@@ -379,7 +374,7 @@
 int libxl_get_memory_target(libxl_ctx *ctx, uint32_t domid, uint32_t *out_target);
 /* how much free memory in the system a domain needs to be built */
 int libxl_domain_need_memory(libxl_ctx *ctx, libxl_domain_build_info *b_info,
-        libxl_device_model_info *dm_info, uint32_t *need_memkb);
+                             uint32_t *need_memkb);
 /* how much free memory is available in the system */
 int libxl_get_free_memory(libxl_ctx *ctx, uint32_t *memkb);
 /* wait for a given amount of memory to be free in the system */
diff -r 9356938a851d -r 05310d1a73ed tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Jan 31 16:34:38 2012 +0000
@@ -48,7 +48,6 @@
 
     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)
@@ -130,17 +129,6 @@
     return 0;
 }
 
-int libxl_init_dm_info(libxl_ctx *ctx,
-                       libxl_device_model_info *dm_info,
-                       libxl_domain_create_info *c_info,
-                       libxl_domain_build_info *b_info)
-{
-    memset(dm_info, '\0', sizeof(*dm_info));
-
-
-    return 0;
-}
-
 static int init_console_info(libxl_device_console *console, int dev_num)
 {
     memset(console, 0x00, sizeof(libxl_device_console));
@@ -154,7 +142,6 @@
 
 int libxl__domain_build(libxl__gc *gc,
                         libxl_domain_build_info *info,
-                        libxl_device_model_info *dm_info,
                         uint32_t domid,
                         libxl__domain_build_state *state)
 {
@@ -170,7 +157,7 @@
 
     switch (info->type) {
     case LIBXL_DOMAIN_TYPE_HVM:
-        ret = libxl__build_hvm(gc, domid, info, dm_info, state);
+        ret = libxl__build_hvm(gc, domid, info, state);
         if (ret)
             goto out;
 
@@ -224,8 +211,7 @@
 
 static int domain_restore(libxl__gc *gc, libxl_domain_build_info *info,
                           uint32_t domid, int fd,
-                          libxl__domain_build_state *state,
-                          libxl_device_model_info *dm_info)
+                          libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     char **vments = NULL, **localents = NULL;
@@ -477,7 +463,6 @@
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     libxl__spawner_starting *dm_starting = 0;
-    libxl_device_model_info *dm_info = &d_config->dm_info;
     libxl__domain_build_state state;
     uint32_t domid;
     int i, ret;
@@ -514,9 +499,9 @@
     memset(&state, 0, sizeof(state));
 
     if ( restore_fd >= 0 ) {
-        ret = domain_restore(gc, &d_config->b_info, domid, restore_fd, &state, dm_info);
+        ret = domain_restore(gc, &d_config->b_info, domid, restore_fd, &state);
     } else {
-        ret = libxl__domain_build(gc, &d_config->b_info, dm_info, domid, &state);
+        ret = libxl__domain_build(gc, &d_config->b_info, domid, &state);
     }
 
     if (ret) {
@@ -563,8 +548,7 @@
         libxl_device_vkb_add(ctx, domid, &vkb);
         libxl_device_vkb_dispose(&vkb);
 
-        dm_info->domid = domid;
-        ret = libxl__create_device_model(gc, d_config, dm_info,
+        ret = libxl__create_device_model(gc, domid, d_config,
                                          &state, &dm_starting);
         if (ret < 0) {
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
@@ -577,7 +561,6 @@
     {
         int need_qemu = 0;
         libxl_device_console console;
-        libxl_device_model_info xenpv_dm_info;
 
         for (i = 0; i < d_config->num_vfbs; i++) {
             libxl_device_vfb_add(ctx, domid, &d_config->vfbs[i]);
@@ -599,11 +582,7 @@
         libxl_device_console_dispose(&console);
 
         if (need_qemu) {
-            /* only copy those useful configs */
-            memset((void*)&xenpv_dm_info, 0, sizeof(libxl_device_model_info));
-
-            libxl__create_xenpv_qemu(gc, domid, d_config,
-                                     &xenpv_dm_info, &state, &dm_starting);
+            libxl__create_xenpv_qemu(gc, domid, d_config, &state, &dm_starting);
         }
         break;
     }
diff -r 9356938a851d -r 05310d1a73ed tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 16:34:38 2012 +0000
@@ -73,8 +73,7 @@
     }
 }
 
-static const libxl_vnc_info *dm_vnc(const libxl_domain_config *guest_config,
-                                    const libxl_device_model_info *info)
+static const libxl_vnc_info *dm_vnc(const libxl_domain_config *guest_config)
 {
     const libxl_vnc_info *vnc = NULL;
     if (guest_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) {
@@ -85,8 +84,7 @@
     return vnc && vnc->enable ? vnc : NULL;
 }
 
-static const libxl_sdl_info *dm_sdl(const libxl_domain_config *guest_config,
-                                    const libxl_device_model_info *info)
+static const libxl_sdl_info *dm_sdl(const libxl_domain_config *guest_config)
 {
     const libxl_sdl_info *sdl = NULL;
     if (guest_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) {
@@ -97,8 +95,7 @@
     return sdl && sdl->enable ? sdl : NULL;
 }
 
-static const char *dm_keymap(const libxl_domain_config *guest_config,
-                             const libxl_device_model_info *info)
+static const char *dm_keymap(const libxl_domain_config *guest_config)
 {
     if (guest_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) {
         return guest_config->b_info.u.hvm.keymap;
@@ -109,18 +106,17 @@
 }
 
 static char ** libxl__build_device_model_args_old(libxl__gc *gc,
-                                        const char *dm,
+                                        const char *dm, int domid,
                                         const libxl_domain_config *guest_config,
-                                        const libxl_device_model_info *info,
                                         const libxl__domain_build_state *state)
 {
     const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
     const libxl_device_nic *vifs = guest_config->vifs;
-    const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
-    const libxl_sdl_info *sdl = dm_sdl(guest_config, info);
+    const libxl_vnc_info *vnc = dm_vnc(guest_config);
+    const libxl_sdl_info *sdl = dm_sdl(guest_config);
     const int num_vifs = guest_config->num_vifs;
-    const char *keymap = dm_keymap(guest_config, info);
+    const char *keymap = dm_keymap(guest_config);
     int i;
     flexarray_t *dm_args;
     dm_args = flexarray_make(16, 1);
@@ -129,7 +125,7 @@
         return NULL;
 
     flexarray_vappend(dm_args, dm,
-                      "-d", libxl__sprintf(gc, "%d", info->domid), NULL);
+                      "-d", libxl__sprintf(gc, "%d", domid), NULL);
 
     if (c_info->name)
         flexarray_vappend(dm_args, "-domain-name", c_info->name, NULL);
@@ -225,7 +221,8 @@
                                    LIBXL_MAC_FMT, LIBXL_MAC_BYTES(vifs[i].mac));
                 char *ifname;
                 if (!vifs[i].ifname)
-                    ifname = libxl__sprintf(gc, "tap%d.%d", info->domid, vifs[i].devid);
+                    ifname = libxl__sprintf(gc,
+                                            "tap%d.%d", domid, vifs[i].devid);
                 else
                     ifname = vifs[i].ifname;
                 flexarray_vappend(dm_args,
@@ -320,9 +317,8 @@
 }
 
 static char ** libxl__build_device_model_args_new(libxl__gc *gc,
-                                        const char *dm,
+                                        const char *dm, int guest_domid,
                                         const libxl_domain_config *guest_config,
-                                        const libxl_device_model_info *info,
                                         const libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
@@ -332,9 +328,9 @@
     const libxl_device_nic *vifs = guest_config->vifs;
     const int num_disks = guest_config->num_disks;
     const int num_vifs = guest_config->num_vifs;
-    const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
-    const libxl_sdl_info *sdl = dm_sdl(guest_config, info);
-    const char *keymap = dm_keymap(guest_config, info);
+    const libxl_vnc_info *vnc = dm_vnc(guest_config);
+    const libxl_sdl_info *sdl = dm_sdl(guest_config);
+    const char *keymap = dm_keymap(guest_config);
     flexarray_t *dm_args;
     int i;
 
@@ -343,14 +339,14 @@
         return NULL;
 
     flexarray_vappend(dm_args, dm,
-                      "-xen-domid", libxl__sprintf(gc, "%d", info->domid), NULL);
+                      "-xen-domid",
+                      libxl__sprintf(gc, "%d", guest_domid), NULL);
 
     flexarray_append(dm_args, "-chardev");
     flexarray_append(dm_args,
                      libxl__sprintf(gc, "socket,id=libxl-cmd,"
                                     "path=%s/qmp-libxl-%d,server,nowait",
-                                    libxl_run_dir_path(),
-                                    info->domid));
+                                    libxl_run_dir_path(), guest_domid));
 
     flexarray_append(dm_args, "-mon");
     flexarray_append(dm_args, "chardev=libxl-cmd,mode=control");
@@ -460,7 +456,8 @@
                                 LIBXL_MAC_FMT, LIBXL_MAC_BYTES(vifs[i].mac));
                 char *ifname;
                 if (!vifs[i].ifname) {
-                    ifname = libxl__sprintf(gc, "tap%d.%d", info->domid, vifs[i].devid);
+                    ifname = libxl__sprintf(gc, "tap%d.%d",
+                                            guest_domid, vifs[i].devid);
                 } else {
                     ifname = vifs[i].ifname;
                 }
@@ -581,18 +578,21 @@
 }
 
 static char ** libxl__build_device_model_args(libxl__gc *gc,
-                                        const char *dm,
+                                        const char *dm, int guest_domid,
                                         const libxl_domain_config *guest_config,
-                                        const libxl_device_model_info *info,
                                         const libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
 
     switch (guest_config->b_info.device_model_version) {
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
-        return libxl__build_device_model_args_old(gc, dm, guest_config, info, state);
+        return libxl__build_device_model_args_old(gc, dm,
+                                                  guest_domid, guest_config,
+                                                  state);
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
-        return libxl__build_device_model_args_new(gc, dm, guest_config, info, state);
+        return libxl__build_device_model_args_new(gc, dm,
+                                                  guest_domid, guest_config,
+                                                  state);
     default:
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unknown device model version %d",
                          guest_config->b_info.device_model_version);
@@ -624,7 +624,9 @@
     return 0;
 }
 
-static int libxl__write_dmargs(libxl__gc *gc, int domid, int guest_domid, char **args)
+static int libxl__write_stub_dmargs(libxl__gc *gc,
+                                    int dm_domid, int guest_domid,
+                                    char **args)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int i;
@@ -636,7 +638,7 @@
 
     roperm[0].id = 0;
     roperm[0].perms = XS_PERM_NONE;
-    roperm[1].id = domid;
+    roperm[1].id = dm_domid;
     roperm[1].perms = XS_PERM_READ;
 
     vm_path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "/local/domain/%d/vm", guest_domid));
@@ -673,8 +675,8 @@
 }
 
 static int libxl__create_stubdom(libxl__gc *gc,
+                                 int guest_domid,
                                  libxl_domain_config *guest_config,
-                                 libxl_device_model_info *info,
                                  libxl__domain_build_state *d_state,
                                  libxl__spawner_starting **starting_r)
 {
@@ -685,12 +687,11 @@
     libxl_device_vfb vfb;
     libxl_device_vkb vkb;
     libxl__domain_build_state stubdom_state;
-    uint32_t domid;
+    uint32_t dm_domid;
     char **args;
     struct xs_permissions perm[2];
     xs_transaction_t t;
     libxl__spawner_starting *dm_starting = 0;
-    libxl_device_model_info xenpv_dm_info;
 
     if (guest_config->b_info.device_model_version !=
         LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL) {
@@ -700,7 +701,8 @@
 
     memset(&dm_config.c_info, 0x00, sizeof(libxl_domain_create_info));
     dm_config.c_info.type = LIBXL_DOMAIN_TYPE_PV;
-    dm_config.c_info.name = libxl__sprintf(gc, "%s-dm", libxl__domid_to_name(gc, info->domid));
+    dm_config.c_info.name = libxl__sprintf(gc, "%s-dm",
+                                    libxl__domid_to_name(gc, guest_domid));
 
     libxl_uuid_generate(&dm_config.c_info.uuid);
 
@@ -713,7 +715,7 @@
     dm_config.b_info.type = LIBXL_DOMAIN_TYPE_PV;
     dm_config.b_info.u.pv.kernel.path = libxl__abs_path(gc, "ioemu-stubdom.gz",
                                               libxl_xenfirmwaredir_path());
-    dm_config.b_info.u.pv.cmdline = libxl__sprintf(gc, " -d %d", info->domid);
+    dm_config.b_info.u.pv.cmdline = libxl__sprintf(gc, " -d %d", guest_domid);
     dm_config.b_info.u.pv.ramdisk.path = "";
     dm_config.b_info.u.pv.features = "";
 
@@ -738,62 +740,69 @@
     dm_config.num_vkbs = 1;
 
     /* fixme: this function can leak the stubdom if it fails */
-    domid = 0;
-    ret = libxl__domain_make(gc, &dm_config.c_info, &domid);
+    dm_domid = 0;
+    ret = libxl__domain_make(gc, &dm_config.c_info, &dm_domid);
     if (ret)
         goto out;
-    ret = libxl__domain_build(gc, &dm_config.b_info, info, domid, &stubdom_state);
+    ret = libxl__domain_build(gc, &dm_config.b_info, dm_domid, &stubdom_state);
     if (ret)
         goto out;
 
-    args = libxl__build_device_model_args(gc, "stubdom-dm",
-                                          guest_config, info, d_state);
+    args = libxl__build_device_model_args(gc, "stubdom-dm", guest_domid,
+                                          guest_config, d_state);
     if (!args) {
         ret = ERROR_FAIL;
         goto out;
     }
 
-    libxl__write_dmargs(gc, domid, info->domid, args);
+    libxl__write_stub_dmargs(gc, dm_domid, guest_domid, args);
     libxl__xs_write(gc, XBT_NULL,
-                   libxl__sprintf(gc, "%s/image/device-model-domid", libxl__xs_get_dompath(gc, info->domid)),
-                   "%d", domid);
+                   libxl__sprintf(gc, "%s/image/device-model-domid",
+                                  libxl__xs_get_dompath(gc, guest_domid)),
+                   "%d", dm_domid);
     libxl__xs_write(gc, XBT_NULL,
-                   libxl__sprintf(gc, "%s/target", libxl__xs_get_dompath(gc, domid)),
-                   "%d", info->domid);
-    ret = xc_domain_set_target(ctx->xch, domid, info->domid);
+                   libxl__sprintf(gc, "%s/target",
+                                  libxl__xs_get_dompath(gc, dm_domid)),
+                   "%d", guest_domid);
+    ret = xc_domain_set_target(ctx->xch, dm_domid, guest_domid);
     if (ret<0) {
-        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "setting target domain %d -> %d", domid, info->domid);
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+                         "setting target domain %d -> %d",
+                         dm_domid, guest_domid);
         ret = ERROR_FAIL;
         goto out_free;
     }
-    xs_set_target(ctx->xsh, domid, info->domid);
+    xs_set_target(ctx->xsh, dm_domid, guest_domid);
 
-    perm[0].id = domid;
+    perm[0].id = dm_domid;
     perm[0].perms = XS_PERM_NONE;
-    perm[1].id = info->domid;
+    perm[1].id = guest_domid;
     perm[1].perms = XS_PERM_READ;
 retry_transaction:
     t = xs_transaction_start(ctx->xsh);
-    xs_mkdir(ctx->xsh, t, libxl__sprintf(gc, "/local/domain/0/device-model/%d", info->domid));
-    xs_set_permissions(ctx->xsh, t, libxl__sprintf(gc, "/local/domain/0/device-model/%d", info->domid), perm, ARRAY_SIZE(perm));
+    xs_mkdir(ctx->xsh, t,
+        libxl__sprintf(gc, "/local/domain/0/device-model/%d", guest_domid));
+    xs_set_permissions(ctx->xsh, t,
+        libxl__sprintf(gc, "/local/domain/0/device-model/%d", guest_domid),
+                       perm, ARRAY_SIZE(perm));
     if (!xs_transaction_end(ctx->xsh, t, 0))
         if (errno == EAGAIN)
             goto retry_transaction;
 
     for (i = 0; i < dm_config.num_disks; i++) {
-        ret = libxl_device_disk_add(ctx, domid, &dm_config.disks[i]);
+        ret = libxl_device_disk_add(ctx, dm_domid, &dm_config.disks[i]);
         if (ret)
             goto out_free;
     }
     for (i = 0; i < dm_config.num_vifs; i++) {
-        ret = libxl_device_nic_add(ctx, domid, &dm_config.vifs[i]);
+        ret = libxl_device_nic_add(ctx, dm_domid, &dm_config.vifs[i]);
         if (ret)
             goto out_free;
     }
-    ret = libxl_device_vfb_add(ctx, domid, &dm_config.vfbs[0]);
+    ret = libxl_device_vfb_add(ctx, dm_domid, &dm_config.vfbs[0]);
     if (ret)
         goto out_free;
-    ret = libxl_device_vkb_add(ctx, domid, &dm_config.vkbs[0]);
+    ret = libxl_device_vkb_add(ctx, dm_domid, &dm_config.vkbs[0]);
     if (ret)
         goto out_free;
 
@@ -818,14 +827,14 @@
             char *name;
             case STUBDOM_CONSOLE_LOGGING:
                 name = libxl__sprintf(gc, "qemu-dm-%s",
-                                      libxl_domid_to_name(ctx, info->domid));
+                                      libxl_domid_to_name(ctx, guest_domid));
                 libxl_create_logfile(ctx, name, &filename);
                 console[i].output = libxl__sprintf(gc, "file:%s", filename);
                 free(filename);
                 break;
             case STUBDOM_CONSOLE_SAVE:
                 console[i].output = libxl__sprintf(gc, "file:%s",
-                                libxl__device_model_savefile(gc, info->domid));
+                                libxl__device_model_savefile(gc, guest_domid));
                 break;
             case STUBDOM_CONSOLE_RESTORE:
                 if (d_state->saved_state)
@@ -836,17 +845,14 @@
                 console[i].output = "pty";
                 break;
         }
-        ret = libxl__device_console_add(gc, domid, &console[i],
+        ret = libxl__device_console_add(gc, dm_domid, &console[i],
                         i == STUBDOM_CONSOLE_LOGGING ? &stubdom_state : NULL);
         if (ret)
             goto out_free;
     }
 
-    memset((void*)&xenpv_dm_info, 0, sizeof(libxl_device_model_info));
-
-    if (libxl__create_xenpv_qemu(gc, domid,
+    if (libxl__create_xenpv_qemu(gc, dm_domid,
                                  &dm_config,
-                                 &xenpv_dm_info,
                                  &stubdom_state,
                                  &dm_starting) < 0) {
         ret = ERROR_FAIL;
@@ -857,12 +863,12 @@
         goto out_free;
     }
 
-    libxl_domain_unpause(ctx, domid);
+    libxl_domain_unpause(ctx, dm_domid);
 
     if (starting_r) {
         *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)->domid = guest_domid;
+        (*starting_r)->dom_path = libxl__xs_get_dompath(gc, guest_domid);
         (*starting_r)->for_spawn = NULL;
     }
 
@@ -875,15 +881,15 @@
 }
 
 int libxl__create_device_model(libxl__gc *gc,
+                              int domid,
                               libxl_domain_config *guest_config,
-                              libxl_device_model_info *info,
                               libxl__domain_build_state *state,
                               libxl__spawner_starting **starting_r)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
-    const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
+    const libxl_vnc_info *vnc = dm_vnc(guest_config);
     char *path, *logfile;
     int logfile_w, null;
     int rc;
@@ -895,7 +901,7 @@
     const char *dm;
 
     if (b_info->device_model_stubdomain) {
-        rc = libxl__create_stubdom(gc, guest_config, info, state, starting_r);
+        rc = libxl__create_stubdom(gc, domid, guest_config, state, starting_r);
         goto out;
     }
 
@@ -910,18 +916,18 @@
         rc = ERROR_FAIL;
         goto out;
     }
-    args = libxl__build_device_model_args(gc, dm, guest_config, info, state);
+    args = libxl__build_device_model_args(gc, dm, domid, guest_config, state);
     if (!args) {
         rc = ERROR_FAIL;
         goto out;
     }
 
-    path = xs_get_domain_path(ctx->xsh, info->domid);
+    path = xs_get_domain_path(ctx->xsh, domid);
     libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/hvmloader/bios", path),
                     "%s", libxl__domain_bios(gc, b_info));
     free(path);
 
-    path = libxl__sprintf(gc, "/local/domain/0/device-model/%d", info->domid);
+    path = libxl__sprintf(gc, "/local/domain/0/device-model/%d", domid);
     xs_mkdir(ctx->xsh, XBT_NULL, path);
     libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/disable_pf", path),
                     "%d", !b_info->u.hvm.xen_platform_pci);
@@ -945,8 +951,8 @@
         p->for_spawn = NULL;
     }
 
-    p->domid = info->domid;
-    p->dom_path = libxl__xs_get_dompath(gc, info->domid);
+    p->domid = domid;
+    p->dom_path = libxl__xs_get_dompath(gc, domid);
     p->pid_path = "image/device-model-pid";
     if (!p->dom_path) {
         rc = ERROR_FAIL;
@@ -1068,14 +1074,6 @@
     return ret;
 }
 
-static int libxl__build_xenpv_qemu_args(libxl__gc *gc,
-                                        uint32_t domid,
-                                        libxl_device_model_info *info)
-{
-    info->domid = domid;
-    return 0;
-}
-
 int libxl__need_xenpv_qemu(libxl__gc *gc,
         int nr_consoles, libxl_device_console *consoles,
         int nr_vfbs, libxl_device_vfb *vfbs,
@@ -1115,12 +1113,10 @@
 
 int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
                              libxl_domain_config *guest_config,
-                             libxl_device_model_info *info,
                              libxl__domain_build_state *state,
                              libxl__spawner_starting **starting_r)
 {
-    libxl__build_xenpv_qemu_args(gc, domid, info);
-    libxl__create_device_model(gc, guest_config, info, state, starting_r);
+    libxl__create_device_model(gc, domid, guest_config, state, starting_r);
     return 0;
 }
 
diff -r 9356938a851d -r 05310d1a73ed tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl_dom.c	Tue Jan 31 16:34:38 2012 +0000
@@ -291,8 +291,7 @@
 }
 
 static const char *libxl__domain_firmware(libxl__gc *gc,
-                                          libxl_domain_build_info *info,
-                                          libxl_device_model_info *dm_info)
+                                          libxl_domain_build_info *info)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     const char *firmware;
@@ -320,12 +319,11 @@
 
 int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
               libxl_domain_build_info *info,
-              libxl_device_model_info *dm_info,
               libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int ret, rc = ERROR_FAIL;
-    const char *firmware = libxl__domain_firmware(gc, info, dm_info);
+    const char *firmware = libxl__domain_firmware(gc, info);
 
     if (!firmware)
         goto out;
diff -r 9356938a851d -r 05310d1a73ed tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Tue Jan 31 16:34:38 2012 +0000
@@ -615,7 +615,6 @@
              libxl_domain_build_info *info, libxl__domain_build_state *state);
 _hidden int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
               libxl_domain_build_info *info,
-              libxl_device_model_info *dm_info,
               libxl__domain_build_state *state);
 
 _hidden int libxl__domain_rename(libxl__gc *gc, uint32_t domid,
@@ -858,10 +857,11 @@
                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_make(libxl__gc *gc,
+                               libxl_domain_create_info *info,
+                               uint32_t *domid);
 _hidden int libxl__domain_build(libxl__gc *gc,
                                 libxl_domain_build_info *info,
-                                libxl_device_model_info *dm_info,
                                 uint32_t domid,
                                 libxl__domain_build_state *state);
 
@@ -869,13 +869,12 @@
 _hidden const char *libxl__domain_device_model(libxl__gc *gc,
                                         const libxl_domain_build_info *info);
 _hidden int libxl__create_device_model(libxl__gc *gc,
+                              int domid,
                               libxl_domain_config *guest_config,
-                              libxl_device_model_info *info,
                               libxl__domain_build_state *state,
                               libxl__spawner_starting **starting_r);
 _hidden int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
                               libxl_domain_config *guest_config,
-                              libxl_device_model_info *dm_info,
                               libxl__domain_build_state *state,
                               libxl__spawner_starting **starting_r);
 _hidden int libxl__need_xenpv_qemu(libxl__gc *gc,
diff -r 9356938a851d -r 05310d1a73ed tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:38 2012 +0000
@@ -262,12 +262,6 @@
     ],
 )
 
-# Device Model Information
-libxl_device_model_info = Struct("device_model_info",[
-    ("domid",            libxl_domid),
-    ],
-)
-
 libxl_device_vfb = Struct("device_vfb", [
     ("backend_domid", libxl_domid),
     ("devid",         integer),
diff -r 9356938a851d -r 05310d1a73ed tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 16:34:38 2012 +0000
@@ -290,8 +290,7 @@
 }
 
 static void printf_info(int domid,
-                        libxl_domain_config *d_config,
-                        libxl_device_model_info *dm_info)
+                        libxl_domain_config *d_config)
 {
     int i;
     libxl_dominfo info;
@@ -631,8 +630,7 @@
 static void parse_config_data(const char *configfile_filename_report,
                               const char *configfile_data,
                               int configfile_len,
-                              libxl_domain_config *d_config,
-                              libxl_device_model_info *dm_info)
+                              libxl_domain_config *d_config)
 {
     const char *buf;
     long l;
@@ -1194,9 +1192,6 @@
         break;
     }
 
-    /* init dm from c and b */
-    if (libxl_init_dm_info(ctx, dm_info, c_info, b_info))
-        exit(1);
     /* parse device model arguments, this works for pv, hvm and stubdom */
     if (!xlu_cfg_get_string (config, "device_model", &buf, 0)) {
         fprintf(stderr,
@@ -1452,7 +1447,7 @@
     int no_incr_generationid;
 };
 
-static int freemem(libxl_domain_build_info *b_info, libxl_device_model_info *dm_info)
+static int freemem(libxl_domain_build_info *b_info)
 {
     int rc, retries = 3;
     uint32_t need_memkb, free_memkb;
@@ -1460,7 +1455,7 @@
     if (!autoballoon)
         return 0;
 
-    rc = libxl_domain_need_memory(ctx, b_info, dm_info, &need_memkb);
+    rc = libxl_domain_need_memory(ctx, b_info, &need_memkb);
     if (rc < 0)
         return rc;
 
@@ -1679,7 +1674,7 @@
     if (!dom_info->quiet)
         printf("Parsing config file %s\n", config_file);
 
-    parse_config_data(config_file, config_data, config_len, &d_config, &d_config.dm_info);
+    parse_config_data(config_file, config_data, config_len, &d_config);
 
     if (migrate_fd >= 0) {
         if (d_config.c_info.name) {
@@ -1704,7 +1699,7 @@
             dom_info->no_incr_generationid;
 
     if (debug || dom_info->dryrun)
-        printf_info(-1, &d_config, &d_config.dm_info);
+        printf_info(-1, &d_config);
 
     ret = 0;
     if (dom_info->dryrun)
@@ -1717,7 +1712,7 @@
     if (rc < 0)
         goto error_out;
 
-    ret = freemem(&d_config.b_info, &d_config.dm_info);
+    ret = freemem(&d_config.b_info);
     if (ret < 0) {
         fprintf(stderr, "failed to free memory for the domain\n");
         ret = ERROR_FAIL;
@@ -2484,7 +2479,6 @@
     char *config_file;
     uint8_t *data;
     int i, len, rc;
-    libxl_device_model_info dm_info;
 
     for (i = 0; i < nb_domain; i++) {
         /* no detailed info available on dom0 */
@@ -2495,8 +2489,8 @@
             continue;
         CHK_ERRNO(asprintf(&config_file, "<domid %d data>", info[i].domid));
         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);
+        parse_config_data(config_file, (char *)data, len, &d_config);
+        printf_info(info[i].domid, &d_config);
         libxl_domain_config_dispose(&d_config);
         free(data);
         free(config_file);
diff -r 9356938a851d -r 05310d1a73ed tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/ocaml/libs/xl/genwrap.py	Tue Jan 31 16:34:38 2012 +0000
@@ -266,7 +266,6 @@
         "cpupoolinfo",
         "domain_create_info",
         "domain_build_info",
-        "device_model_info",
         "vcpuinfo",
         "topologyinfo",
         "event",

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:33 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9N-000864-Ha; Fri, 03 Feb 2012 21:58:33 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9M-00081I-9H
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:32 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-174.messagelabs.com!1328306304!7715953!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26555 invoked from network); 3 Feb 2012 21:58:25 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:25 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9E-0001oy-DV
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:24 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9D-00038u-RW
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:24 +0000
Message-Id: <E1RtR9D-00038u-RW@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:22 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: only write "disable_pf" key
	to xenstore when it makes sense
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027678 0
# Node ID 61ac1bf881ea15bdafe1b1b43911286cca5d48c8
# Parent  05310d1a73ed310e3c0c18f9829a4356a40f8cb6
libxl: only write "disable_pf" key to xenstore when it makes sense

This key is only used by the traditional qemu-dm when servicing an HVM domain.

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


diff -r 05310d1a73ed -r 61ac1bf881ea tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 16:34:38 2012 +0000
@@ -929,8 +929,12 @@
 
     path = libxl__sprintf(gc, "/local/domain/0/device-model/%d", domid);
     xs_mkdir(ctx->xsh, XBT_NULL, path);
-    libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/disable_pf", path),
-                    "%d", !b_info->u.hvm.xen_platform_pci);
+
+    if (b_info->type == LIBXL_DOMAIN_TYPE_HVM &&
+        b_info->device_model_version
+        == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL)
+        libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/disable_pf", path),
+                        "%d", !b_info->u.hvm.xen_platform_pci);
 
     libxl_create_logfile(ctx,
                          libxl__sprintf(gc, "qemu-dm-%s", c_info->name),

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:33 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9N-000864-Ha; Fri, 03 Feb 2012 21:58:33 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9M-00081I-9H
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:32 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-174.messagelabs.com!1328306304!7715953!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26555 invoked from network); 3 Feb 2012 21:58:25 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:25 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9E-0001oy-DV
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:24 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9D-00038u-RW
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:24 +0000
Message-Id: <E1RtR9D-00038u-RW@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:22 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: only write "disable_pf" key
	to xenstore when it makes sense
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027678 0
# Node ID 61ac1bf881ea15bdafe1b1b43911286cca5d48c8
# Parent  05310d1a73ed310e3c0c18f9829a4356a40f8cb6
libxl: only write "disable_pf" key to xenstore when it makes sense

This key is only used by the traditional qemu-dm when servicing an HVM domain.

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


diff -r 05310d1a73ed -r 61ac1bf881ea tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Tue Jan 31 16:34:38 2012 +0000
@@ -929,8 +929,12 @@
 
     path = libxl__sprintf(gc, "/local/domain/0/device-model/%d", domid);
     xs_mkdir(ctx->xsh, XBT_NULL, path);
-    libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/disable_pf", path),
-                    "%d", !b_info->u.hvm.xen_platform_pci);
+
+    if (b_info->type == LIBXL_DOMAIN_TYPE_HVM &&
+        b_info->device_model_version
+        == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL)
+        libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/disable_pf", path),
+                        "%d", !b_info->u.hvm.xen_platform_pci);
 
     libxl_create_logfile(ctx,
                          libxl__sprintf(gc, "qemu-dm-%s", c_info->name),

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:38 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9S-0008AJ-Np; Fri, 03 Feb 2012 21:58:38 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9Q-00084F-F8
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:36 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1328306309!11908956!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4361 invoked from network); 3 Feb 2012 21:58:30 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:30 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9I-0001pB-VN
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:28 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9H-0003AE-Eq
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:28 +0000
Message-Id: <E1RtR9H-0003AE-Eq@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:26 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: de-hard-tabbify idl.txt
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027679 0
# Node ID a322bdbd43deaa67fbe1c4072fee38a797f51923
# Parent  e61ac54bbf1c3ef7cb05965dc68dc66e8f372094
libxl: de-hard-tabbify idl.txt

Hard tabs were in the minority, nuke them.

Also we no longer supply the inaddr_ip builtin.

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


diff -r e61ac54bbf1c -r a322bdbd43de tools/libxl/idl.txt
--- a/tools/libxl/idl.txt	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/idl.txt	Tue Jan 31 16:34:39 2012 +0000
@@ -2,10 +2,9 @@
 ---------
 
 Each type in the libxl interface is represented by an object of type
-idl.Type (or a subclass thereof). Every local variable defined by
-the .idl file must be an instance of idl.Type (e.g. you may not
-define Python functions or any other construct other than defining
-variables)
+idl.Type (or a subclass thereof). Every local variable defined by the
+.idl file must be an instance of idl.Type (e.g. you may not define
+Python functions or any other construct other than defining variables)
 
 The name of the type must be passed as the first argument to the
 constructor when defining a new type. The name given should not
@@ -16,9 +15,9 @@
 namespace element while Type.rawname is always set to the 'base' name
 of the type.
 
-The idl.Type base class has several other properties which apply
-to all types. The properties are set by passing a named parameter to
-the constructor.
+The idl.Type base class has several other properties which apply to
+all types. The properties are set by passing a named parameter to the
+constructor.
 
 Type.namespace: (default: "libxl_")
 
@@ -81,7 +80,7 @@
 
   Each EnumerationValue has the following properties:
 
-    EnumerationValue.enum	Reference to containing Enumeration
+    EnumerationValue.enum       Reference to containing Enumeration
     EnumerationValue.name       The C name of this value, including
                                     the namespace and typename of the
                                     containing Enumeration (e.g.
@@ -90,10 +89,10 @@
                                     the namespace but including the
                                     typename of the containing
                                     Enumeration (e.g. "FOOENUM_VALUE")
-    EnumerationValue.valuename	The name of this value, excluding the
-				    name of the containing Enumeration
-				    and any namespace (e.g. "VALUE")
-    EnumerationValue.value	The integer value associated with this name.
+    EnumerationValue.valuename  The name of this value, excluding the
+                                    name of the containing Enumeration
+                                    and any namespace (e.g. "VALUE")
+    EnumerationValue.value      The integer value associated with this name.
 
 idl.Aggregate
 
@@ -106,10 +105,10 @@
 
  Each field has the following properties:
 
-  Field.type	The type of the member (a idl.Type).
+  Field.type    The type of the member (a idl.Type).
   Field.name    The name of the member (can be None for anonymous
-		fields).
-  Field.const	Boolean, true if the member is const.
+                fields).
+  Field.const   Boolean, true if the member is const.
 
 idl.Struct
 
@@ -139,15 +138,13 @@
 
 Several standard types a predefined. They are
 
-void			(void pointer type)
+void                    (void pointer type)
 bool
 size_t
-integer			24 bit signed integer.
+integer                 24 bit signed integer.
 
-uint{8,16,32,64}	uint{8,16,32,64}_t
+uint{8,16,32,64}        uint{8,16,32,64}_t
 
-domid			Domain ID
+domid                   Domain ID
 
-string			NULL terminated string
-
-inaddr_ip		struct in_addr
+string                  NULL terminated string

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:38 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9S-0008AJ-Np; Fri, 03 Feb 2012 21:58:38 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9Q-00084F-F8
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:36 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1328306309!11908956!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4361 invoked from network); 3 Feb 2012 21:58:30 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:30 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9I-0001pB-VN
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:28 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9H-0003AE-Eq
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:28 +0000
Message-Id: <E1RtR9H-0003AE-Eq@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:26 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: de-hard-tabbify idl.txt
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027679 0
# Node ID a322bdbd43deaa67fbe1c4072fee38a797f51923
# Parent  e61ac54bbf1c3ef7cb05965dc68dc66e8f372094
libxl: de-hard-tabbify idl.txt

Hard tabs were in the minority, nuke them.

Also we no longer supply the inaddr_ip builtin.

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


diff -r e61ac54bbf1c -r a322bdbd43de tools/libxl/idl.txt
--- a/tools/libxl/idl.txt	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/idl.txt	Tue Jan 31 16:34:39 2012 +0000
@@ -2,10 +2,9 @@
 ---------
 
 Each type in the libxl interface is represented by an object of type
-idl.Type (or a subclass thereof). Every local variable defined by
-the .idl file must be an instance of idl.Type (e.g. you may not
-define Python functions or any other construct other than defining
-variables)
+idl.Type (or a subclass thereof). Every local variable defined by the
+.idl file must be an instance of idl.Type (e.g. you may not define
+Python functions or any other construct other than defining variables)
 
 The name of the type must be passed as the first argument to the
 constructor when defining a new type. The name given should not
@@ -16,9 +15,9 @@
 namespace element while Type.rawname is always set to the 'base' name
 of the type.
 
-The idl.Type base class has several other properties which apply
-to all types. The properties are set by passing a named parameter to
-the constructor.
+The idl.Type base class has several other properties which apply to
+all types. The properties are set by passing a named parameter to the
+constructor.
 
 Type.namespace: (default: "libxl_")
 
@@ -81,7 +80,7 @@
 
   Each EnumerationValue has the following properties:
 
-    EnumerationValue.enum	Reference to containing Enumeration
+    EnumerationValue.enum       Reference to containing Enumeration
     EnumerationValue.name       The C name of this value, including
                                     the namespace and typename of the
                                     containing Enumeration (e.g.
@@ -90,10 +89,10 @@
                                     the namespace but including the
                                     typename of the containing
                                     Enumeration (e.g. "FOOENUM_VALUE")
-    EnumerationValue.valuename	The name of this value, excluding the
-				    name of the containing Enumeration
-				    and any namespace (e.g. "VALUE")
-    EnumerationValue.value	The integer value associated with this name.
+    EnumerationValue.valuename  The name of this value, excluding the
+                                    name of the containing Enumeration
+                                    and any namespace (e.g. "VALUE")
+    EnumerationValue.value      The integer value associated with this name.
 
 idl.Aggregate
 
@@ -106,10 +105,10 @@
 
  Each field has the following properties:
 
-  Field.type	The type of the member (a idl.Type).
+  Field.type    The type of the member (a idl.Type).
   Field.name    The name of the member (can be None for anonymous
-		fields).
-  Field.const	Boolean, true if the member is const.
+                fields).
+  Field.const   Boolean, true if the member is const.
 
 idl.Struct
 
@@ -139,15 +138,13 @@
 
 Several standard types a predefined. They are
 
-void			(void pointer type)
+void                    (void pointer type)
 bool
 size_t
-integer			24 bit signed integer.
+integer                 24 bit signed integer.
 
-uint{8,16,32,64}	uint{8,16,32,64}_t
+uint{8,16,32,64}        uint{8,16,32,64}_t
 
-domid			Domain ID
+domid                   Domain ID
 
-string			NULL terminated string
-
-inaddr_ip		struct in_addr
+string                  NULL terminated string

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:40 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9T-0008BM-Qk; Fri, 03 Feb 2012 21:58:39 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9R-00084g-AJ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:37 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1328306306!11933728!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12435 invoked from network); 3 Feb 2012 21:58:27 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:27 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9G-0001p5-Ox
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:26 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9E-00039L-SA
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:26 +0000
Message-Id: <E1RtR9E-00039L-SA@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:24 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Rename libxl IDL
	infrastructure.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027678 0
# Node ID e61ac54bbf1c3ef7cb05965dc68dc66e8f372094
# Parent  61ac1bf881ea15bdafe1b1b43911286cca5d48c8
libxl: Rename libxl IDL infrastructure.

Originally libxltypes.py provided the infrastructure and libxl.idl provided the
specific types.

In 23887:a543e10211f7 libxl.idl became libxl_types.idl (to allow for
libxl_types_internal.idl) which means we now have libxl_types.FOO and
libxltypes.FOO providing different things and annoying people in tab
completion.

Rename the infrastructure as idl.

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


diff -r 61ac1bf881ea -r e61ac54bbf1c tools/libxl/Makefile
--- a/tools/libxl/Makefile	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/Makefile	Tue Jan 31 16:34:38 2012 +0000
@@ -111,7 +111,7 @@
 $(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS): libxl.h
 $(LIBXL_OBJS): libxl_internal.h
 
-_libxl_type%.h _libxl_type%_json.h _libxl_type%.c: libxl_type%.idl gentypes.py libxltypes.py
+_libxl_type%.h _libxl_type%_json.h _libxl_type%.c: libxl_type%.idl gentypes.py idl.py
 	$(PYTHON) gentypes.py libxl_type$*.idl __libxl_type$*.h __libxl_type$*_json.h __libxl_type$*.c
 	$(call move-if-changed,__libxl_type$*.h,_libxl_type$*.h)
 	$(call move-if-changed,__libxl_type$*_json.h,_libxl_type$*_json.h)
diff -r 61ac1bf881ea -r e61ac54bbf1c tools/libxl/gentest.py
--- a/tools/libxl/gentest.py	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/gentest.py	Tue Jan 31 16:34:38 2012 +0000
@@ -4,7 +4,7 @@
 import re
 import random
 
-import libxltypes
+import idl
 
 def randomize_char(c):
     if random.random() < 0.5:
@@ -25,9 +25,9 @@
 
 def gen_rand_init(ty, v, indent = "    ", parent = None):
     s = ""
-    if isinstance(ty, libxltypes.Enumeration):
+    if isinstance(ty, idl.Enumeration):
         s += "%s = %s;\n" % (ty.pass_arg(v, parent is None), randomize_enum(ty))
-    elif isinstance(ty, libxltypes.KeyedUnion):
+    elif isinstance(ty, idl.KeyedUnion):
         if parent is None:
             raise Exception("KeyedUnion type must have a parent")
         s += "switch (%s) {\n" % (parent + ty.keyvar_name)
@@ -37,7 +37,7 @@
             s += gen_rand_init(f.type, fexpr, indent + "    ", nparent)
             s += "    break;\n"
         s += "}\n"
-    elif isinstance(ty, libxltypes.Struct) \
+    elif isinstance(ty, idl.Struct) \
      and (parent is None or ty.json_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)
@@ -45,10 +45,10 @@
     elif hasattr(ty, "rand_init") and ty.rand_init is not None:
         s += "%s(%s);\n" % (ty.rand_init,
                             ty.pass_arg(v, isref=parent is None,
-                                        passby=libxltypes.PASS_BY_REFERENCE))
+                                        passby=idl.PASS_BY_REFERENCE))
     elif ty.typename in ["libxl_uuid", "libxl_mac", "libxl_hwcap"]:
         s += "rand_bytes((uint8_t *)%s, sizeof(*%s));\n" % (v,v)
-    elif ty.typename in ["libxl_domid"] or isinstance(ty, libxltypes.Number):
+    elif ty.typename in ["libxl_domid"] or isinstance(ty, idl.Number):
         s += "%s = rand() %% (sizeof(%s)*8);\n" % \
              (ty.pass_arg(v, parent is None),
               ty.pass_arg(v, parent is None))
@@ -74,8 +74,7 @@
 
     random.seed()
 
-    idl = sys.argv[1]
-    (builtins,types) = libxltypes.parse(idl)
+    (builtins,types) = idl.parse(sys.argv[1])
 
     impl = sys.argv[2]
     f = open(impl, "w")
@@ -215,10 +214,10 @@
         if ty.typename not in handcoded:
             f.write("static void %s_rand_init(%s);\n" % \
                     (ty.typename,
-                     ty.make_arg("p", passby=libxltypes.PASS_BY_REFERENCE)))
+                     ty.make_arg("p", passby=idl.PASS_BY_REFERENCE)))
             f.write("static void %s_rand_init(%s)\n" % \
                     (ty.typename,
-                     ty.make_arg("p", passby=libxltypes.PASS_BY_REFERENCE)))
+                     ty.make_arg("p", passby=idl.PASS_BY_REFERENCE)))
             f.write("{\n")
             f.write(gen_rand_init(ty, "p"))
             f.write("}\n")
@@ -252,7 +251,7 @@
     for ty in [t for t in types if t.json_fn is not None]:
         arg = ty.typename + "_val"
         f.write("    %s_rand_init(%s);\n" % (ty.typename, \
-            ty.pass_arg(arg, isref=False, passby=libxltypes.PASS_BY_REFERENCE)))
+            ty.pass_arg(arg, isref=False, passby=idl.PASS_BY_REFERENCE)))
         f.write("    s = %s_to_json(ctx, %s);\n" % \
                 (ty.typename, ty.pass_arg(arg, isref=False)))
         f.write("    printf(\"%%s: %%s\\n\", \"%s\", s);\n" % ty.typename)
@@ -265,7 +264,7 @@
     f.write("    printf(\"Testing Enumerations\\n\");\n")
     f.write("    printf(\"--------------------\\n\");\n")
     f.write("    printf(\"\\n\");\n")
-    for ty in [t for t in types if isinstance(t,libxltypes.Enumeration)]:
+    for ty in [t for t in types if isinstance(t,idl.Enumeration)]:
         f.write("    printf(\"%s -- to string:\\n\");\n" % (ty.typename))
         for v in ty.values:
             f.write("    printf(\"\\t%s = %%d = \\\"%%s\\\"\\n\", " \
diff -r 61ac1bf881ea -r e61ac54bbf1c tools/libxl/gentypes.py
--- a/tools/libxl/gentypes.py	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/gentypes.py	Tue Jan 31 16:34:38 2012 +0000
@@ -3,10 +3,10 @@
 import sys
 import re
 
-import libxltypes
+import idl
 
 def libxl_C_instance_of(ty, instancename):
-    if isinstance(ty, libxltypes.Aggregate) and ty.typename is None:
+    if isinstance(ty, idl.Aggregate) and ty.typename is None:
         if instancename is None:
             return libxl_C_type_define(ty)
         else:
@@ -16,7 +16,7 @@
 
 def libxl_C_type_define(ty, indent = ""):
     s = ""
-    if isinstance(ty, libxltypes.Enumeration):
+    if isinstance(ty, idl.Enumeration):
         if ty.typename is None:
             s += "enum {\n"
         else:
@@ -31,7 +31,7 @@
         else:
             s += "} %s" % ty.typename
 
-    elif isinstance(ty, libxltypes.Aggregate):
+    elif isinstance(ty, idl.Aggregate):
         if ty.typename is None:
             s += "%s {\n" % ty.kind
         else:
@@ -53,7 +53,7 @@
 
 def libxl_C_type_dispose(ty, v, indent = "    ", parent = None):
     s = ""
-    if isinstance(ty, libxltypes.KeyedUnion):
+    if isinstance(ty, idl.KeyedUnion):
         if parent is None:
             raise Exception("KeyedUnion type must have a parent")
         s += "switch (%s) {\n" % (parent + ty.keyvar_name)
@@ -63,7 +63,7 @@
             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.dispose_fn is None):
+    elif isinstance(ty, idl.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_dispose(f.type, fexpr, "", nparent)
@@ -79,11 +79,11 @@
     s = ""
     if parent is None:
         s += "yajl_gen_status s;\n"
-    if isinstance(ty, libxltypes.Enumeration):
+    if isinstance(ty, idl.Enumeration):
         s += "s = libxl__yajl_gen_enum(hand, %s_to_string(%s));\n" % (ty.typename, ty.pass_arg(v, parent is None))
         s += "if (s != yajl_gen_status_ok)\n"
         s += "    goto out;\n"
-    elif isinstance(ty, libxltypes.KeyedUnion):
+    elif isinstance(ty, idl.KeyedUnion):
         if parent is None:
             raise Exception("KeyedUnion type must have a parent")
         s += "switch (%s) {\n" % (parent + ty.keyvar_name)
@@ -93,7 +93,7 @@
             s += libxl_C_type_gen_json(f.type, fexpr, indent + "    ", nparent)
             s += "    break;\n"
         s += "}\n"
-    elif isinstance(ty, libxltypes.Struct) and (parent is None or ty.json_fn is None):
+    elif isinstance(ty, idl.Struct) and (parent is None or ty.json_fn is None):
         s += "s = yajl_gen_map_open(hand);\n"
         s += "if (s != yajl_gen_status_ok)\n"
         s += "    goto out;\n"
@@ -123,7 +123,7 @@
 def libxl_C_type_to_json(ty, v, indent = "    "):
     s = ""
     gen = "(libxl__gen_json_callback)&%s_gen_json" % ty.typename
-    s += "return libxl__object_to_json(ctx, \"%s\", %s, (void *)%s);\n" % (ty.typename, gen, ty.pass_arg(v, passby=libxltypes.PASS_BY_REFERENCE))
+    s += "return libxl__object_to_json(ctx, \"%s\", %s, (void *)%s);\n" % (ty.typename, gen, ty.pass_arg(v, passby=idl.PASS_BY_REFERENCE))
 
     if s != "":
         s = indent + s
@@ -171,9 +171,9 @@
         print >>sys.stderr, "Usage: gentypes.py <idl> <header> <header-json> <implementation>"
         sys.exit(1)
 
-    (_, idl, header, header_json, impl) = sys.argv
+    (_, idlname, header, header_json, impl) = sys.argv
 
-    (builtins,types) = libxltypes.parse(idl)
+    (builtins,types) = idl.parse(idlname)
 
     print "outputting libxl type definitions to %s" % header
 
@@ -198,9 +198,9 @@
             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):
+        if isinstance(ty, idl.Enumeration):
             f.write("const char *%s_to_string(%s);\n" % (ty.typename, ty.make_arg("p")))
-            f.write("int %s_from_string(const char *s, %s);\n" % (ty.typename, ty.make_arg("e", passby=libxltypes.PASS_BY_REFERENCE)))
+            f.write("int %s_from_string(const char *s, %s);\n" % (ty.typename, ty.make_arg("e", passby=idl.PASS_BY_REFERENCE)))
             f.write("extern libxl_enum_string_table %s_string_table[];\n" % (ty.typename))
         f.write("\n")
 
@@ -225,7 +225,7 @@
 """ % (header_json_define, header_json_define, " ".join(sys.argv)))
 
     for ty in [ty for ty in types+builtins if ty.json_fn is not None]:
-        f.write("yajl_gen_status %s_gen_json(yajl_gen hand, %s);\n" % (ty.typename, ty.make_arg("p", passby=libxltypes.PASS_BY_REFERENCE)))
+        f.write("yajl_gen_status %s_gen_json(yajl_gen hand, %s);\n" % (ty.typename, ty.make_arg("p", passby=idl.PASS_BY_REFERENCE)))
 
     f.write("\n")
     f.write("""#endif /* %s */\n""" % header_json_define)
@@ -262,7 +262,7 @@
         f.write("}\n")
         f.write("\n")
 
-    for ty in [t for t in types if isinstance(t,libxltypes.Enumeration)]:
+    for ty in [t for t in types if isinstance(t,idl.Enumeration)]:
         f.write("const char *%s_to_string(%s e)\n" % (ty.typename, ty.typename))
         f.write("{\n")
         f.write(libxl_C_enum_to_string(ty, "e"))
@@ -278,7 +278,7 @@
         f.write("\n")
 
     for ty in [t for t in types if t.json_fn is not None]:
-        f.write("yajl_gen_status %s_gen_json(yajl_gen hand, %s)\n" % (ty.typename, ty.make_arg("p", passby=libxltypes.PASS_BY_REFERENCE)))
+        f.write("yajl_gen_status %s_gen_json(yajl_gen hand, %s)\n" % (ty.typename, ty.make_arg("p", passby=idl.PASS_BY_REFERENCE)))
         f.write("{\n")
         f.write(libxl_C_type_gen_json(ty, "p"))
         f.write("}\n")
diff -r 61ac1bf881ea -r e61ac54bbf1c tools/libxl/idl.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxl/idl.py	Tue Jan 31 16:34:38 2012 +0000
@@ -0,0 +1,294 @@
+import sys
+
+PASS_BY_VALUE = 1
+PASS_BY_REFERENCE = 2
+
+DIR_NONE = 0
+DIR_IN   = 1
+DIR_OUT  = 2
+DIR_BOTH = 3
+
+_default_namespace = ""
+def namespace(s):
+    if type(s) != str:
+        raise TypeError, "Require a string for the default namespace."
+    global _default_namespace
+    _default_namespace = s
+
+def _get_default_namespace():
+    global _default_namespace
+    return _default_namespace
+
+
+class Type(object):
+    def __init__(self, typename, **kwargs):
+        self.namespace = kwargs.setdefault('namespace',
+                _get_default_namespace())
+        self.dir = kwargs.setdefault('dir', DIR_BOTH)
+        if self.dir not in [DIR_NONE, DIR_IN, DIR_OUT, DIR_BOTH]:
+            raise ValueError
+
+        self.passby = kwargs.setdefault('passby', PASS_BY_VALUE)
+        if self.passby not in [PASS_BY_VALUE, PASS_BY_REFERENCE]:
+            raise ValueError
+
+        self.private = kwargs.setdefault('private', False)
+
+        if typename is None: # Anonymous type
+            self.typename = None
+            self.rawname = None
+        elif self.namespace is None: # e.g. system provided types
+            self.typename = typename
+            self.rawname = typename
+        else:
+            self.typename = self.namespace + typename
+            self.rawname = typename
+
+        if self.typename is not None:
+            self.dispose_fn = kwargs.setdefault('dispose_fn', self.typename + "_dispose")
+        else:
+            self.dispose_fn = kwargs.setdefault('dispose_fn', None)
+
+        self.autogenerate_dispose_fn = kwargs.setdefault('autogenerate_dispose_fn', True)
+
+        if self.typename is not None and not self.private:
+            self.json_fn = kwargs.setdefault('json_fn', self.typename + "_gen_json")
+        else:
+            self.json_fn = kwargs.setdefault('json_fn', None)
+
+        self.autogenerate_json = kwargs.setdefault('autogenerate_json', True)
+
+    def marshal_in(self):
+        return self.dir in [DIR_IN, DIR_BOTH]
+    def marshal_out(self):
+        return self.dir in [DIR_OUT, DIR_BOTH]
+
+    def make_arg(self, n, passby=None):
+        if passby is None: passby = self.passby
+
+        if passby == PASS_BY_REFERENCE:
+            return "%s *%s" % (self.typename, n)
+        else:
+            return "%s %s" % (self.typename, n)
+
+    def pass_arg(self, n, isref=None, passby=None):
+        if passby is None: passby = self.passby
+        if isref is None: isref = self.passby == PASS_BY_REFERENCE
+
+        if passby == PASS_BY_REFERENCE:
+            if isref:
+                return "%s" % (n)
+            else:
+                return "&%s" % (n)
+        else:
+            if isref:
+                return "*%s" % (n)
+            else:
+                return "%s" % (n)
+
+class Builtin(Type):
+    """Builtin type"""
+    def __init__(self, typename, **kwargs):
+        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('dispose_fn', None)
+        kwargs.setdefault('signed', False)
+        kwargs.setdefault('json_fn', "yajl_gen_integer")
+        self.signed = kwargs['signed']
+        Builtin.__init__(self, ctype, **kwargs)
+
+class UInt(Number):
+    def __init__(self, w, **kwargs):
+        kwargs.setdefault('namespace', None)
+        kwargs.setdefault('dispose_fn', None)
+        Number.__init__(self, "uint%d_t" % w, **kwargs)
+
+        self.width = w
+
+class EnumerationValue(object):
+    def __init__(self, enum, value, name, **kwargs):
+        self.enum = enum
+
+        self.valuename = str.upper(name)
+        self.rawname = str.upper(enum.rawname) + "_" + self.valuename
+        self.name = str.upper(enum.namespace) + self.rawname
+        self.value = value
+
+class Enumeration(Type):
+    def __init__(self, typename, values, **kwargs):
+        kwargs.setdefault('dispose_fn', None)
+        Type.__init__(self, typename, **kwargs)
+
+        self.values = []
+        for v in values:
+            # (value, name)
+            (num,name) = v
+            self.values.append(EnumerationValue(self, num, name,
+                                                typename=self.rawname))
+    def lookup(self, name):
+        for v in self.values:
+            if v.valuename == str.upper(name):
+                return v
+        return ValueError
+
+class Field(object):
+    """An element of an Aggregate type"""
+    def __init__(self, type, name, **kwargs):
+        self.type = type
+        self.name = name
+        self.const = kwargs.setdefault('const', False)
+        self.enumname = kwargs.setdefault('enumname', None)
+
+class Aggregate(Type):
+    """A type containing a collection of other types"""
+    def __init__(self, kind, typename, fields, **kwargs):
+        Type.__init__(self, typename, **kwargs)
+
+        self.kind = kind
+
+        self.fields = []
+        for f in fields:
+            # (name, type[, {kw args}])
+            if len(f) == 2:
+                n,t = f
+                kw = {}
+            elif len(f) == 3:
+                n,t,kw = f
+            else:
+                raise ValueError
+            if n is None:
+                raise ValueError
+            self.fields.append(Field(t,n,**kw))
+
+    # Returns a tuple (stem, field-expr)
+    #
+    # field-expr is a C expression for a field "f" within the struct
+    # "v".
+    #
+    # stem is the stem common to both "f" and any other sibbling field
+    # within the "v".
+    def member(self, v, f, isref):
+        if isref:
+            deref = v + "->"
+        else:
+            deref = v + "."
+
+        if f.name is None: # Anonymous
+            return (deref, deref)
+        else:
+            return (deref, deref + f.name)
+
+class Struct(Aggregate):
+    def __init__(self, name, fields, **kwargs):
+        kwargs.setdefault('passby', PASS_BY_REFERENCE)
+        Aggregate.__init__(self, "struct", name, fields, **kwargs)
+
+class Union(Aggregate):
+    def __init__(self, name, fields, **kwargs):
+        # Generally speaking some intelligence is required to free a
+        # union therefore any specific instance of this class will
+        # need to provide an explicit destructor function.
+        kwargs.setdefault('passby', PASS_BY_REFERENCE)
+        kwargs.setdefault('dispose_fn', None)
+        Aggregate.__init__(self, "union", name, fields, **kwargs)
+
+class KeyedUnion(Aggregate):
+    """A union which is keyed of another variable in the parent structure"""
+    def __init__(self, name, keyvar_type, keyvar_name, fields, **kwargs):
+        Aggregate.__init__(self, "union", name, [], **kwargs)
+
+        if not isinstance(keyvar_type, Enumeration):
+            raise ValueError
+
+        self.keyvar_name = keyvar_name
+        self.keyvar_type = keyvar_type
+
+        for f in fields:
+            # (name, enum, type)
+            e, ty = f
+            ev = keyvar_type.lookup(e)
+            en = ev.name
+            self.fields.append(Field(ty, e, enumname=en))
+
+#
+# Standard Types
+#
+
+void = Builtin("void *", namespace = None)
+bool = Builtin("bool", namespace = None,
+               json_fn = "yajl_gen_bool",
+               autogenerate_json = False)
+
+size_t = Number("size_t", namespace = None)
+
+integer = Number("int", namespace = None, signed = True)
+
+uint8 = UInt(8)
+uint16 = UInt(16)
+uint32 = UInt(32)
+uint64 = UInt(64)
+
+string = Builtin("char *", namespace = None, dispose_fn = "free",
+                 json_fn = "libxl__string_gen_json",
+                 autogenerate_json = False)
+
+class OrderedDict(dict):
+    """A dictionary which remembers insertion order.
+
+       push to back on duplicate insertion"""
+
+    def __init__(self):
+        dict.__init__(self)
+        self.__ordered = []
+
+    def __setitem__(self, key, value):
+        try:
+            self.__ordered.remove(key)
+        except ValueError:
+            pass
+
+        self.__ordered.append(key)
+        dict.__setitem__(self, key, value)
+
+    def ordered_keys(self):
+        return self.__ordered
+    def ordered_values(self):
+        return [self[x] for x in self.__ordered]
+    def ordered_items(self):
+        return [(x,self[x]) for x in self.__ordered]
+
+def parse(f):
+    print >>sys.stderr, "Parsing %s" % f
+
+    globs = {}
+    locs = OrderedDict()
+
+    for n,t in globals().items():
+        if isinstance(t, Type):
+            globs[n] = t
+        elif isinstance(t,type(object)) and issubclass(t, Type):
+            globs[n] = t
+        elif n in ['PASS_BY_REFERENCE', 'PASS_BY_VALUE',
+                   'DIR_NONE', 'DIR_IN', 'DIR_OUT', 'DIR_BOTH',
+                   'namespace']:
+            globs[n] = t
+
+    try:
+        execfile(f, globs, locs)
+    except SyntaxError,e:
+        raise SyntaxError, \
+              "Errors were found at line %d while processing %s:\n\t%s"\
+              %(e.lineno,f,e.text)
+
+    types = [t for t in locs.ordered_values() if isinstance(t,Type)]
+
+    builtins = [t for t in types if isinstance(t,Builtin)]
+    types = [t for t in types if not isinstance(t,Builtin)]
+
+    return (builtins,types)
diff -r 61ac1bf881ea -r e61ac54bbf1c tools/libxl/idl.txt
--- a/tools/libxl/idl.txt	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/idl.txt	Tue Jan 31 16:34:38 2012 +0000
@@ -1,10 +1,10 @@
-libxltypes IDL
---------------
+libxl IDL
+---------
 
 Each type in the libxl interface is represented by an object of type
-libxltypes.Type (or a subclass thereof). Every local variable defined
-by the .idl file must be an instance of libxltypes.Type (e.g. you may
-not define Python functions or any other construct other than defining
+idl.Type (or a subclass thereof). Every local variable defined by
+the .idl file must be an instance of idl.Type (e.g. you may not
+define Python functions or any other construct other than defining
 variables)
 
 The name of the type must be passed as the first argument to the
@@ -16,9 +16,9 @@
 namespace element while Type.rawname is always set to the 'base' name
 of the type.
 
-The libxltypes.Type base class has several other properties which
-apply to all types. The properties are set by passing a named
-parameter to the constructor.
+The idl.Type base class has several other properties which apply
+to all types. The properties are set by passing a named parameter to
+the constructor.
 
 Type.namespace: (default: "libxl_")
 
@@ -28,12 +28,12 @@
  If the typename is not None then the namespace is prepended to the
  type.
  
-Type.passby: (default: libxltypes.PASS_BY_VALUE)
+Type.passby: (default: idl.PASS_BY_VALUE)
 
  Defines the manner in which a type should be passed to C
  functions. Valid values for this fields are:
-   libxltypes.PASS_BY_VALUE
-   libxltypes.PASS_BY_REFERENCE
+   idl.PASS_BY_VALUE
+   idl.PASS_BY_REFERENCE
 
 Type.dispose_fn: (default: typename + "_dispose" or None if type == None)
 
@@ -57,12 +57,12 @@
 Other simple type-Classes
 -------------------------
 
-libxltype.Builtin
+idl.Builtin
 
  Instances of this class represent types which are predefined within
  the system.
 
-libxltype.UInt
+idl.UInt
 
  Instances of this class represent the standard uint<N>_t types.
 
@@ -72,12 +72,12 @@
 Complex type-Classes
 --------------------
 
-libxltype.Enumeration
+idl.Enumeration
 
   A class representing an enumeration (named integer values).
 
   The values are available in the list Enumeration.values. Each
-  element in the list is of type libxltype.EnumerationValue.
+  element in the list is of type idl.EnumerationValue.
 
   Each EnumerationValue has the following properties:
 
@@ -95,37 +95,37 @@
 				    and any namespace (e.g. "VALUE")
     EnumerationValue.value	The integer value associated with this name.
 
-libxltype.Aggregate
+idl.Aggregate
 
  Base class for type-Classes which contain a number of other types
  (e.g. structs and unions).
 
  The contained types are available in the list Aggregate.fields. Each
- element in the list is of type libxltype.Field representing a member
- of the aggregate.
+ element in the list is of type idl.Field representing a member of the
+ aggregate.
 
  Each field has the following properties:
 
-  Field.type	The type of the member (a libxltypes.Type).
+  Field.type	The type of the member (a idl.Type).
   Field.name    The name of the member (can be None for anonymous
 		fields).
   Field.const	Boolean, true if the member is const.
 
-libxltype.Struct
+idl.Struct
 
- A subclass of libxltype.Aggregate representing the C struct type.
+ A subclass of idl.Aggregate representing the C struct type.
 
  Struct.kind == "struct"
 
-libxltype.Union
+idl.Union
 
- A subclass of libxltype.Aggregate representing the C union type.
+ A subclass of idl.Aggregate representing the C union type.
 
  Union.kind == "union"
 
-libxltype.KeyedUnion
+idl.KeyedUnion
 
- A subclass of libxltype.Aggregate which represents the C union type
+ A subclass of idl.Aggregate which represents the C union type
  where the currently valid member of the union can be determined based
  upon another member in the containing type.
 
diff -r 61ac1bf881ea -r e61ac54bbf1c tools/libxl/libxltypes.py
--- a/tools/libxl/libxltypes.py	Tue Jan 31 16:34:38 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,294 +0,0 @@
-import sys
-
-PASS_BY_VALUE = 1
-PASS_BY_REFERENCE = 2
-
-DIR_NONE = 0
-DIR_IN   = 1
-DIR_OUT  = 2
-DIR_BOTH = 3
-
-_default_namespace = ""
-def namespace(s):
-    if type(s) != str:
-        raise TypeError, "Require a string for the default namespace."
-    global _default_namespace
-    _default_namespace = s
-
-def _get_default_namespace():
-    global _default_namespace
-    return _default_namespace
-
-
-class Type(object):
-    def __init__(self, typename, **kwargs):
-        self.namespace = kwargs.setdefault('namespace',
-                _get_default_namespace())
-        self.dir = kwargs.setdefault('dir', DIR_BOTH)
-        if self.dir not in [DIR_NONE, DIR_IN, DIR_OUT, DIR_BOTH]:
-            raise ValueError
-
-        self.passby = kwargs.setdefault('passby', PASS_BY_VALUE)
-        if self.passby not in [PASS_BY_VALUE, PASS_BY_REFERENCE]:
-            raise ValueError
-
-        self.private = kwargs.setdefault('private', False)
-
-        if typename is None: # Anonymous type
-            self.typename = None
-            self.rawname = None
-        elif self.namespace is None: # e.g. system provided types
-            self.typename = typename
-            self.rawname = typename
-        else:
-            self.typename = self.namespace + typename
-            self.rawname = typename
-
-        if self.typename is not None:
-            self.dispose_fn = kwargs.setdefault('dispose_fn', self.typename + "_dispose")
-        else:
-            self.dispose_fn = kwargs.setdefault('dispose_fn', None)
-
-        self.autogenerate_dispose_fn = kwargs.setdefault('autogenerate_dispose_fn', True)
-
-        if self.typename is not None and not self.private:
-            self.json_fn = kwargs.setdefault('json_fn', self.typename + "_gen_json")
-        else:
-            self.json_fn = kwargs.setdefault('json_fn', None)
-
-        self.autogenerate_json = kwargs.setdefault('autogenerate_json', True)
-
-    def marshal_in(self):
-        return self.dir in [DIR_IN, DIR_BOTH]
-    def marshal_out(self):
-        return self.dir in [DIR_OUT, DIR_BOTH]
-
-    def make_arg(self, n, passby=None):
-        if passby is None: passby = self.passby
-
-        if passby == PASS_BY_REFERENCE:
-            return "%s *%s" % (self.typename, n)
-        else:
-            return "%s %s" % (self.typename, n)
-
-    def pass_arg(self, n, isref=None, passby=None):
-        if passby is None: passby = self.passby
-        if isref is None: isref = self.passby == PASS_BY_REFERENCE
-
-        if passby == PASS_BY_REFERENCE:
-            if isref:
-                return "%s" % (n)
-            else:
-                return "&%s" % (n)
-        else:
-            if isref:
-                return "*%s" % (n)
-            else:
-                return "%s" % (n)
-
-class Builtin(Type):
-    """Builtin type"""
-    def __init__(self, typename, **kwargs):
-        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('dispose_fn', None)
-        kwargs.setdefault('signed', False)
-        kwargs.setdefault('json_fn', "yajl_gen_integer")
-        self.signed = kwargs['signed']
-        Builtin.__init__(self, ctype, **kwargs)
-
-class UInt(Number):
-    def __init__(self, w, **kwargs):
-        kwargs.setdefault('namespace', None)
-        kwargs.setdefault('dispose_fn', None)
-        Number.__init__(self, "uint%d_t" % w, **kwargs)
-
-        self.width = w
-
-class EnumerationValue(object):
-    def __init__(self, enum, value, name, **kwargs):
-        self.enum = enum
-
-        self.valuename = str.upper(name)
-        self.rawname = str.upper(enum.rawname) + "_" + self.valuename
-        self.name = str.upper(enum.namespace) + self.rawname
-        self.value = value
-
-class Enumeration(Type):
-    def __init__(self, typename, values, **kwargs):
-        kwargs.setdefault('dispose_fn', None)
-        Type.__init__(self, typename, **kwargs)
-
-        self.values = []
-        for v in values:
-            # (value, name)
-            (num,name) = v
-            self.values.append(EnumerationValue(self, num, name,
-                                                typename=self.rawname))
-    def lookup(self, name):
-        for v in self.values:
-            if v.valuename == str.upper(name):
-                return v
-        return ValueError
-
-class Field(object):
-    """An element of an Aggregate type"""
-    def __init__(self, type, name, **kwargs):
-        self.type = type
-        self.name = name
-        self.const = kwargs.setdefault('const', False)
-        self.enumname = kwargs.setdefault('enumname', None)
-
-class Aggregate(Type):
-    """A type containing a collection of other types"""
-    def __init__(self, kind, typename, fields, **kwargs):
-        Type.__init__(self, typename, **kwargs)
-
-        self.kind = kind
-
-        self.fields = []
-        for f in fields:
-            # (name, type[, {kw args}])
-            if len(f) == 2:
-                n,t = f
-                kw = {}
-            elif len(f) == 3:
-                n,t,kw = f
-            else:
-                raise ValueError
-            if n is None:
-                raise ValueError
-            self.fields.append(Field(t,n,**kw))
-
-    # Returns a tuple (stem, field-expr)
-    #
-    # field-expr is a C expression for a field "f" within the struct
-    # "v".
-    #
-    # stem is the stem common to both "f" and any other sibbling field
-    # within the "v".
-    def member(self, v, f, isref):
-        if isref:
-            deref = v + "->"
-        else:
-            deref = v + "."
-
-        if f.name is None: # Anonymous
-            return (deref, deref)
-        else:
-            return (deref, deref + f.name)
-
-class Struct(Aggregate):
-    def __init__(self, name, fields, **kwargs):
-        kwargs.setdefault('passby', PASS_BY_REFERENCE)
-        Aggregate.__init__(self, "struct", name, fields, **kwargs)
-
-class Union(Aggregate):
-    def __init__(self, name, fields, **kwargs):
-        # Generally speaking some intelligence is required to free a
-        # union therefore any specific instance of this class will
-        # need to provide an explicit destructor function.
-        kwargs.setdefault('passby', PASS_BY_REFERENCE)
-        kwargs.setdefault('dispose_fn', None)
-        Aggregate.__init__(self, "union", name, fields, **kwargs)
-
-class KeyedUnion(Aggregate):
-    """A union which is keyed of another variable in the parent structure"""
-    def __init__(self, name, keyvar_type, keyvar_name, fields, **kwargs):
-        Aggregate.__init__(self, "union", name, [], **kwargs)
-
-        if not isinstance(keyvar_type, Enumeration):
-            raise ValueError
-
-        self.keyvar_name = keyvar_name
-        self.keyvar_type = keyvar_type
-
-        for f in fields:
-            # (name, enum, type)
-            e, ty = f
-            ev = keyvar_type.lookup(e)
-            en = ev.name
-            self.fields.append(Field(ty, e, enumname=en))
-
-#
-# Standard Types
-#
-
-void = Builtin("void *", namespace = None)
-bool = Builtin("bool", namespace = None,
-               json_fn = "yajl_gen_bool",
-               autogenerate_json = False)
-
-size_t = Number("size_t", namespace = None)
-
-integer = Number("int", namespace = None, signed = True)
-
-uint8 = UInt(8)
-uint16 = UInt(16)
-uint32 = UInt(32)
-uint64 = UInt(64)
-
-string = Builtin("char *", namespace = None, dispose_fn = "free",
-                 json_fn = "libxl__string_gen_json",
-                 autogenerate_json = False)
-
-class OrderedDict(dict):
-    """A dictionary which remembers insertion order.
-
-       push to back on duplicate insertion"""
-
-    def __init__(self):
-        dict.__init__(self)
-        self.__ordered = []
-
-    def __setitem__(self, key, value):
-        try:
-            self.__ordered.remove(key)
-        except ValueError:
-            pass
-
-        self.__ordered.append(key)
-        dict.__setitem__(self, key, value)
-
-    def ordered_keys(self):
-        return self.__ordered
-    def ordered_values(self):
-        return [self[x] for x in self.__ordered]
-    def ordered_items(self):
-        return [(x,self[x]) for x in self.__ordered]
-
-def parse(f):
-    print >>sys.stderr, "Parsing %s" % f
-
-    globs = {}
-    locs = OrderedDict()
-
-    for n,t in globals().items():
-        if isinstance(t, Type):
-            globs[n] = t
-        elif isinstance(t,type(object)) and issubclass(t, Type):
-            globs[n] = t
-        elif n in ['PASS_BY_REFERENCE', 'PASS_BY_VALUE',
-                   'DIR_NONE', 'DIR_IN', 'DIR_OUT', 'DIR_BOTH',
-                   'namespace']:
-            globs[n] = t
-
-    try:
-        execfile(f, globs, locs)
-    except SyntaxError,e:
-        raise SyntaxError, \
-              "Errors were found at line %d while processing %s:\n\t%s"\
-              %(e.lineno,f,e.text)
-
-    types = [t for t in locs.ordered_values() if isinstance(t,Type)]
-
-    builtins = [t for t in types if isinstance(t,Builtin)]
-    types = [t for t in types if not isinstance(t,Builtin)]
-
-    return (builtins,types)
diff -r 61ac1bf881ea -r e61ac54bbf1c tools/ocaml/libs/xl/Makefile
--- a/tools/ocaml/libs/xl/Makefile	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/ocaml/libs/xl/Makefile	Tue Jan 31 16:34:38 2012 +0000
@@ -46,7 +46,7 @@
 	$(Q)mv xenlight.mli.tmp xenlight.mli
 
 _libxl_types.ml.in _libxl_types.mli.in _libxl_types.inc: genwrap.py $(XEN_ROOT)/tools/libxl/libxl_types.idl \
-                $(XEN_ROOT)/tools/libxl/libxltypes.py
+                $(XEN_ROOT)/tools/libxl/idl.py
 	PYTHONPATH=$(XEN_ROOT)/tools/libxl $(PYTHON) genwrap.py \
 		$(XEN_ROOT)/tools/libxl/libxl_types.idl \
 		_libxl_types.mli.in _libxl_types.ml.in _libxl_types.inc
diff -r 61ac1bf881ea -r e61ac54bbf1c tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/ocaml/libs/xl/genwrap.py	Tue Jan 31 16:34:38 2012 +0000
@@ -2,7 +2,7 @@
 
 import sys,os
 
-import libxltypes
+import idl
 
 # typename -> ( ocaml_type, c_from_ocaml, ocaml_from_c )
 builtins = {
@@ -39,7 +39,7 @@
 def ocaml_type_of(ty):
     if ty.rawname == "domid":
         return "domid"
-    elif isinstance(ty,libxltypes.UInt):
+    elif isinstance(ty,idl.UInt):
         if ty.width in [8, 16]:
             # handle as ints
             width = None
@@ -52,14 +52,14 @@
         else:
             return "int"
 
-    elif isinstance(ty,libxltypes.Builtin):
+    elif isinstance(ty,idl.Builtin):
         if not builtins.has_key(ty.typename):
             raise NotImplementedError("Unknown Builtin %s (%s)" % (ty.typename, type(ty)))
         typename,_,_ = builtins[ty.typename]
         if not typename:
             raise NotImplementedError("No typename for Builtin %s (%s)" % (ty.typename, type(ty)))
         return typename
-    elif isinstance(ty,libxltypes.Aggregate):
+    elif isinstance(ty,idl.Aggregate):
         return ty.rawname.capitalize() + ".t"
     else:
         return ty.rawname
@@ -73,11 +73,11 @@
         s = ("""(* %s interface *)\n""" % ty.typename)
     else:
         s = ("""(* %s implementation *)\n""" % ty.typename)
-    if isinstance(ty, libxltypes.Enumeration):
+    if isinstance(ty, idl.Enumeration):
         s = "type %s = \n" % ty.rawname
         for v in ty.values:
             s += "\t | %s\n" % v.rawname
-    elif isinstance(ty, libxltypes.Aggregate):
+    elif isinstance(ty, idl.Aggregate):
         s = ""
         if ty.typename is None:
             raise NotImplementedError("%s has no typename" % type(ty))
@@ -115,7 +115,7 @@
 
 def c_val(ty, c, o, indent="", parent = None):
     s = indent
-    if isinstance(ty,libxltypes.UInt):
+    if isinstance(ty,idl.UInt):
         if ty.width in [8, 16]:
             # handle as ints
             width = None
@@ -127,14 +127,14 @@
             s += "%s = Int%d_val(%s);" % (c, width, o)
         else:
             s += "%s = Int_val(%s);" % (c, o)
-    elif isinstance(ty,libxltypes.Builtin):
+    elif isinstance(ty,idl.Builtin):
         if not builtins.has_key(ty.typename):
             raise NotImplementedError("Unknown Builtin %s (%s)" % (ty.typename, type(ty)))
         _,fn,_ = builtins[ty.typename]
         if not fn:
             raise NotImplementedError("No c_val fn for Builtin %s (%s)" % (ty.typename, type(ty)))
         s += "%s;" % (fn % { "o": o, "c": c })
-    elif isinstance(ty,libxltypes.Enumeration) and (parent is None):
+    elif isinstance(ty,idl.Enumeration) and (parent is None):
         n = 0
         s += "switch(Int_val(%s)) {\n" % o
         for e in ty.values:
@@ -142,7 +142,7 @@
             n += 1
         s += "    default: failwith_xl(\"cannot convert value to %s\", lg); break;\n" % ty.typename
         s += "}"
-    elif isinstance(ty, libxltypes.Aggregate) and (parent is None):
+    elif isinstance(ty, idl.Aggregate) and (parent is None):
         n = 0
         for f in ty.fields:
             if f.type.private:
@@ -151,14 +151,14 @@
             s += "%s\n" % c_val(f.type, fexpr, "Field(%s, %d)" % (o,n), parent=nparent)
             n = n + 1
     else:
-        s += "%s_val(gc, lg, %s, %s);" % (ty.rawname, ty.pass_arg(c, parent is None, passby=libxltypes.PASS_BY_REFERENCE), o)
+        s += "%s_val(gc, lg, %s, %s);" % (ty.rawname, ty.pass_arg(c, parent is None, passby=idl.PASS_BY_REFERENCE), o)
     
     return s.replace("\n", "\n%s" % indent)
 
 def gen_c_val(ty, indent=""):
     s = "/* Convert caml value to %s */\n" % ty.rawname
     
-    s += "static int %s_val (caml_gc *gc, struct caml_logger *lg, %s, value v)\n" % (ty.rawname, ty.make_arg("c_val", passby=libxltypes.PASS_BY_REFERENCE))
+    s += "static int %s_val (caml_gc *gc, struct caml_logger *lg, %s, value v)\n" % (ty.rawname, ty.make_arg("c_val", passby=idl.PASS_BY_REFERENCE))
     s += "{\n"
     s += "\tCAMLparam1(v);\n"
     s += "\n"
@@ -172,7 +172,7 @@
 
 def ocaml_Val(ty, o, c, indent="", parent = None):
     s = indent
-    if isinstance(ty,libxltypes.UInt):
+    if isinstance(ty,idl.UInt):
         if ty.width in [8, 16]:
             # handle as ints
             width = None
@@ -184,14 +184,14 @@
             s += "%s = caml_copy_int%d(%s);" % (o, width, c)
         else:
             s += "%s = Val_int(%s);" % (o, c)
-    elif isinstance(ty,libxltypes.Builtin):
+    elif isinstance(ty,idl.Builtin):
         if not builtins.has_key(ty.typename):
             raise NotImplementedError("Unknown Builtin %s (%s)" % (ty.typename, type(ty)))
         _,_,fn = builtins[ty.typename]
         if not fn:
             raise NotImplementedError("No ocaml Val fn for Builtin %s (%s)" % (ty.typename, type(ty)))
         s += "%s = %s;" % (o, fn % { "c": c })
-    elif isinstance(ty,libxltypes.Enumeration) and (parent is None):
+    elif isinstance(ty,idl.Enumeration) and (parent is None):
         n = 0
         s += "switch(%s) {\n" % c
         for e in ty.values:
@@ -199,7 +199,7 @@
             n += 1
         s += "    default: failwith_xl(\"cannot convert value from %s\", lg); break;\n" % ty.typename
         s += "}"
-    elif isinstance(ty,libxltypes.Aggregate) and (parent is None):
+    elif isinstance(ty,idl.Aggregate) and (parent is None):
         s += "{\n"
         s += "\tvalue %s_field;\n" % ty.rawname
         s += "\n"
@@ -258,8 +258,7 @@
         print >>sys.stderr, "Usage: genwrap.py <idl> <mli> <ml> <c-inc>"
         sys.exit(1)
 
-    idl = sys.argv[1]
-    (_,types) = libxltypes.parse(idl)
+    (_,types) = idl.parse(sys.argv[1])
 
     # Do not generate these yet.
     blacklist = [
diff -r 61ac1bf881ea -r e61ac54bbf1c tools/python/Makefile
--- a/tools/python/Makefile	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/python/Makefile	Tue Jan 31 16:34:38 2012 +0000
@@ -11,7 +11,7 @@
 
 .PHONY: build
 build: genpath genwrap.py $(XEN_ROOT)/tools/libxl/libxl_types.idl \
-		$(XEN_ROOT)/tools/libxl/libxltypes.py
+		$(XEN_ROOT)/tools/libxl/idl.py
 	PYTHONPATH=$(XEN_ROOT)/tools/libxl $(PYTHON) genwrap.py \
 		$(XEN_ROOT)/tools/libxl/libxl_types.idl \
 		xen/lowlevel/xl/_pyxl_types.h \
diff -r 61ac1bf881ea -r e61ac54bbf1c tools/python/genwrap.py
--- a/tools/python/genwrap.py	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/python/genwrap.py	Tue Jan 31 16:34:38 2012 +0000
@@ -2,23 +2,23 @@
 
 import sys,os
 
-import libxltypes
+import idl
 
 (TYPE_BOOL, TYPE_INT, TYPE_UINT, TYPE_STRING, TYPE_AGGREGATE) = range(5)
 
 def py_type(ty):
-    if ty == libxltypes.bool:
+    if ty == idl.bool:
         return TYPE_BOOL
-    if isinstance(ty, libxltypes.Enumeration):
+    if isinstance(ty, idl.Enumeration):
         return TYPE_UINT
-    if isinstance(ty, libxltypes.Number):
+    if isinstance(ty, idl.Number):
         if ty.signed:
             return TYPE_INT
         else:
             return TYPE_UINT
-    if isinstance(ty, libxltypes.Aggregate):
+    if isinstance(ty, idl.Aggregate):
         return TYPE_AGGREGATE
-    if ty == libxltypes.string:
+    if ty == idl.string:
         return TYPE_STRING
     return None
 
@@ -38,7 +38,7 @@
 
 def py_decls(ty):
     l = []
-    if isinstance(ty, libxltypes.Aggregate):
+    if isinstance(ty, idl.Aggregate):
         l.append('_hidden Py_%s *Py%s_New(void);\n'%(ty.rawname, ty.rawname))
         l.append('_hidden int Py%s_Check(PyObject *self);\n'%ty.rawname)
         for f in ty.fields:
@@ -211,10 +211,10 @@
     l.append('void genwrap__init(PyObject *m)')
     l.append('{')
     for ty in types:
-        if isinstance(ty, libxltypes.Enumeration):
+        if isinstance(ty, idl.Enumeration):
             for v in ty.values:
                 l.append('    PyModule_AddIntConstant(m, "%s", %s);' % (v.rawname, v.name))
-        elif isinstance(ty, libxltypes.Aggregate):
+        elif isinstance(ty, idl.Aggregate):
             l.append('    if (PyType_Ready(&Py%s_Type) >= 0) {'%ty.rawname)
             l.append('        Py_INCREF(&Py%s_Type);'%ty.rawname)
             l.append('        PyModule_AddObject(m, "%s", (PyObject *)&Py%s_Type);'%(ty.rawname, ty.rawname))
@@ -227,7 +227,7 @@
 
 def tree_frob(types):
     ret = types[:]
-    for ty in [ty for ty in ret if isinstance(ty, libxltypes.Aggregate)]:
+    for ty in [ty for ty in ret if isinstance(ty, idl.Aggregate)]:
         ty.fields = filter(lambda f:f.name is not None and f.type.typename is not None, ty.fields)
     return ret
 
@@ -236,8 +236,7 @@
         print >>sys.stderr, "Usage: genwrap.py <idl> <decls> <defns>"
         sys.exit(1)
 
-    idl = sys.argv[1]
-    (_,types) = libxltypes.parse(idl)
+    (_,types) = idl.parse(sys.argv[1])
 
     types = tree_frob(types)
 
@@ -278,7 +277,7 @@
 _hidden int genwrap__ll_set(PyObject *v, long long *val, long long mask);
 
 """ % " ".join(sys.argv))
-    for ty in [ty for ty in types if isinstance(ty, libxltypes.Aggregate)]:
+    for ty in [ty for ty in types if isinstance(ty, idl.Aggregate)]:
         f.write('/* Internal API for %s wrapper */\n'%ty.typename)
         f.write(py_wrapstruct(ty))
         f.write(py_decls(ty))
@@ -307,7 +306,7 @@
     for ty in types:
         if ty.private:
             continue
-        if isinstance(ty, libxltypes.Aggregate):
+        if isinstance(ty, idl.Aggregate):
             f.write('/* Attribute get/set functions for %s */\n'%ty.typename)
             for a in ty.fields:
                 if a.type.private:

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:40 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9T-0008BM-Qk; Fri, 03 Feb 2012 21:58:39 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9R-00084g-AJ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:37 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1328306306!11933728!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12435 invoked from network); 3 Feb 2012 21:58:27 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:27 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9G-0001p5-Ox
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:26 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9E-00039L-SA
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:26 +0000
Message-Id: <E1RtR9E-00039L-SA@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:24 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Rename libxl IDL
	infrastructure.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027678 0
# Node ID e61ac54bbf1c3ef7cb05965dc68dc66e8f372094
# Parent  61ac1bf881ea15bdafe1b1b43911286cca5d48c8
libxl: Rename libxl IDL infrastructure.

Originally libxltypes.py provided the infrastructure and libxl.idl provided the
specific types.

In 23887:a543e10211f7 libxl.idl became libxl_types.idl (to allow for
libxl_types_internal.idl) which means we now have libxl_types.FOO and
libxltypes.FOO providing different things and annoying people in tab
completion.

Rename the infrastructure as idl.

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


diff -r 61ac1bf881ea -r e61ac54bbf1c tools/libxl/Makefile
--- a/tools/libxl/Makefile	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/Makefile	Tue Jan 31 16:34:38 2012 +0000
@@ -111,7 +111,7 @@
 $(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS): libxl.h
 $(LIBXL_OBJS): libxl_internal.h
 
-_libxl_type%.h _libxl_type%_json.h _libxl_type%.c: libxl_type%.idl gentypes.py libxltypes.py
+_libxl_type%.h _libxl_type%_json.h _libxl_type%.c: libxl_type%.idl gentypes.py idl.py
 	$(PYTHON) gentypes.py libxl_type$*.idl __libxl_type$*.h __libxl_type$*_json.h __libxl_type$*.c
 	$(call move-if-changed,__libxl_type$*.h,_libxl_type$*.h)
 	$(call move-if-changed,__libxl_type$*_json.h,_libxl_type$*_json.h)
diff -r 61ac1bf881ea -r e61ac54bbf1c tools/libxl/gentest.py
--- a/tools/libxl/gentest.py	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/gentest.py	Tue Jan 31 16:34:38 2012 +0000
@@ -4,7 +4,7 @@
 import re
 import random
 
-import libxltypes
+import idl
 
 def randomize_char(c):
     if random.random() < 0.5:
@@ -25,9 +25,9 @@
 
 def gen_rand_init(ty, v, indent = "    ", parent = None):
     s = ""
-    if isinstance(ty, libxltypes.Enumeration):
+    if isinstance(ty, idl.Enumeration):
         s += "%s = %s;\n" % (ty.pass_arg(v, parent is None), randomize_enum(ty))
-    elif isinstance(ty, libxltypes.KeyedUnion):
+    elif isinstance(ty, idl.KeyedUnion):
         if parent is None:
             raise Exception("KeyedUnion type must have a parent")
         s += "switch (%s) {\n" % (parent + ty.keyvar_name)
@@ -37,7 +37,7 @@
             s += gen_rand_init(f.type, fexpr, indent + "    ", nparent)
             s += "    break;\n"
         s += "}\n"
-    elif isinstance(ty, libxltypes.Struct) \
+    elif isinstance(ty, idl.Struct) \
      and (parent is None or ty.json_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)
@@ -45,10 +45,10 @@
     elif hasattr(ty, "rand_init") and ty.rand_init is not None:
         s += "%s(%s);\n" % (ty.rand_init,
                             ty.pass_arg(v, isref=parent is None,
-                                        passby=libxltypes.PASS_BY_REFERENCE))
+                                        passby=idl.PASS_BY_REFERENCE))
     elif ty.typename in ["libxl_uuid", "libxl_mac", "libxl_hwcap"]:
         s += "rand_bytes((uint8_t *)%s, sizeof(*%s));\n" % (v,v)
-    elif ty.typename in ["libxl_domid"] or isinstance(ty, libxltypes.Number):
+    elif ty.typename in ["libxl_domid"] or isinstance(ty, idl.Number):
         s += "%s = rand() %% (sizeof(%s)*8);\n" % \
              (ty.pass_arg(v, parent is None),
               ty.pass_arg(v, parent is None))
@@ -74,8 +74,7 @@
 
     random.seed()
 
-    idl = sys.argv[1]
-    (builtins,types) = libxltypes.parse(idl)
+    (builtins,types) = idl.parse(sys.argv[1])
 
     impl = sys.argv[2]
     f = open(impl, "w")
@@ -215,10 +214,10 @@
         if ty.typename not in handcoded:
             f.write("static void %s_rand_init(%s);\n" % \
                     (ty.typename,
-                     ty.make_arg("p", passby=libxltypes.PASS_BY_REFERENCE)))
+                     ty.make_arg("p", passby=idl.PASS_BY_REFERENCE)))
             f.write("static void %s_rand_init(%s)\n" % \
                     (ty.typename,
-                     ty.make_arg("p", passby=libxltypes.PASS_BY_REFERENCE)))
+                     ty.make_arg("p", passby=idl.PASS_BY_REFERENCE)))
             f.write("{\n")
             f.write(gen_rand_init(ty, "p"))
             f.write("}\n")
@@ -252,7 +251,7 @@
     for ty in [t for t in types if t.json_fn is not None]:
         arg = ty.typename + "_val"
         f.write("    %s_rand_init(%s);\n" % (ty.typename, \
-            ty.pass_arg(arg, isref=False, passby=libxltypes.PASS_BY_REFERENCE)))
+            ty.pass_arg(arg, isref=False, passby=idl.PASS_BY_REFERENCE)))
         f.write("    s = %s_to_json(ctx, %s);\n" % \
                 (ty.typename, ty.pass_arg(arg, isref=False)))
         f.write("    printf(\"%%s: %%s\\n\", \"%s\", s);\n" % ty.typename)
@@ -265,7 +264,7 @@
     f.write("    printf(\"Testing Enumerations\\n\");\n")
     f.write("    printf(\"--------------------\\n\");\n")
     f.write("    printf(\"\\n\");\n")
-    for ty in [t for t in types if isinstance(t,libxltypes.Enumeration)]:
+    for ty in [t for t in types if isinstance(t,idl.Enumeration)]:
         f.write("    printf(\"%s -- to string:\\n\");\n" % (ty.typename))
         for v in ty.values:
             f.write("    printf(\"\\t%s = %%d = \\\"%%s\\\"\\n\", " \
diff -r 61ac1bf881ea -r e61ac54bbf1c tools/libxl/gentypes.py
--- a/tools/libxl/gentypes.py	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/gentypes.py	Tue Jan 31 16:34:38 2012 +0000
@@ -3,10 +3,10 @@
 import sys
 import re
 
-import libxltypes
+import idl
 
 def libxl_C_instance_of(ty, instancename):
-    if isinstance(ty, libxltypes.Aggregate) and ty.typename is None:
+    if isinstance(ty, idl.Aggregate) and ty.typename is None:
         if instancename is None:
             return libxl_C_type_define(ty)
         else:
@@ -16,7 +16,7 @@
 
 def libxl_C_type_define(ty, indent = ""):
     s = ""
-    if isinstance(ty, libxltypes.Enumeration):
+    if isinstance(ty, idl.Enumeration):
         if ty.typename is None:
             s += "enum {\n"
         else:
@@ -31,7 +31,7 @@
         else:
             s += "} %s" % ty.typename
 
-    elif isinstance(ty, libxltypes.Aggregate):
+    elif isinstance(ty, idl.Aggregate):
         if ty.typename is None:
             s += "%s {\n" % ty.kind
         else:
@@ -53,7 +53,7 @@
 
 def libxl_C_type_dispose(ty, v, indent = "    ", parent = None):
     s = ""
-    if isinstance(ty, libxltypes.KeyedUnion):
+    if isinstance(ty, idl.KeyedUnion):
         if parent is None:
             raise Exception("KeyedUnion type must have a parent")
         s += "switch (%s) {\n" % (parent + ty.keyvar_name)
@@ -63,7 +63,7 @@
             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.dispose_fn is None):
+    elif isinstance(ty, idl.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_dispose(f.type, fexpr, "", nparent)
@@ -79,11 +79,11 @@
     s = ""
     if parent is None:
         s += "yajl_gen_status s;\n"
-    if isinstance(ty, libxltypes.Enumeration):
+    if isinstance(ty, idl.Enumeration):
         s += "s = libxl__yajl_gen_enum(hand, %s_to_string(%s));\n" % (ty.typename, ty.pass_arg(v, parent is None))
         s += "if (s != yajl_gen_status_ok)\n"
         s += "    goto out;\n"
-    elif isinstance(ty, libxltypes.KeyedUnion):
+    elif isinstance(ty, idl.KeyedUnion):
         if parent is None:
             raise Exception("KeyedUnion type must have a parent")
         s += "switch (%s) {\n" % (parent + ty.keyvar_name)
@@ -93,7 +93,7 @@
             s += libxl_C_type_gen_json(f.type, fexpr, indent + "    ", nparent)
             s += "    break;\n"
         s += "}\n"
-    elif isinstance(ty, libxltypes.Struct) and (parent is None or ty.json_fn is None):
+    elif isinstance(ty, idl.Struct) and (parent is None or ty.json_fn is None):
         s += "s = yajl_gen_map_open(hand);\n"
         s += "if (s != yajl_gen_status_ok)\n"
         s += "    goto out;\n"
@@ -123,7 +123,7 @@
 def libxl_C_type_to_json(ty, v, indent = "    "):
     s = ""
     gen = "(libxl__gen_json_callback)&%s_gen_json" % ty.typename
-    s += "return libxl__object_to_json(ctx, \"%s\", %s, (void *)%s);\n" % (ty.typename, gen, ty.pass_arg(v, passby=libxltypes.PASS_BY_REFERENCE))
+    s += "return libxl__object_to_json(ctx, \"%s\", %s, (void *)%s);\n" % (ty.typename, gen, ty.pass_arg(v, passby=idl.PASS_BY_REFERENCE))
 
     if s != "":
         s = indent + s
@@ -171,9 +171,9 @@
         print >>sys.stderr, "Usage: gentypes.py <idl> <header> <header-json> <implementation>"
         sys.exit(1)
 
-    (_, idl, header, header_json, impl) = sys.argv
+    (_, idlname, header, header_json, impl) = sys.argv
 
-    (builtins,types) = libxltypes.parse(idl)
+    (builtins,types) = idl.parse(idlname)
 
     print "outputting libxl type definitions to %s" % header
 
@@ -198,9 +198,9 @@
             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):
+        if isinstance(ty, idl.Enumeration):
             f.write("const char *%s_to_string(%s);\n" % (ty.typename, ty.make_arg("p")))
-            f.write("int %s_from_string(const char *s, %s);\n" % (ty.typename, ty.make_arg("e", passby=libxltypes.PASS_BY_REFERENCE)))
+            f.write("int %s_from_string(const char *s, %s);\n" % (ty.typename, ty.make_arg("e", passby=idl.PASS_BY_REFERENCE)))
             f.write("extern libxl_enum_string_table %s_string_table[];\n" % (ty.typename))
         f.write("\n")
 
@@ -225,7 +225,7 @@
 """ % (header_json_define, header_json_define, " ".join(sys.argv)))
 
     for ty in [ty for ty in types+builtins if ty.json_fn is not None]:
-        f.write("yajl_gen_status %s_gen_json(yajl_gen hand, %s);\n" % (ty.typename, ty.make_arg("p", passby=libxltypes.PASS_BY_REFERENCE)))
+        f.write("yajl_gen_status %s_gen_json(yajl_gen hand, %s);\n" % (ty.typename, ty.make_arg("p", passby=idl.PASS_BY_REFERENCE)))
 
     f.write("\n")
     f.write("""#endif /* %s */\n""" % header_json_define)
@@ -262,7 +262,7 @@
         f.write("}\n")
         f.write("\n")
 
-    for ty in [t for t in types if isinstance(t,libxltypes.Enumeration)]:
+    for ty in [t for t in types if isinstance(t,idl.Enumeration)]:
         f.write("const char *%s_to_string(%s e)\n" % (ty.typename, ty.typename))
         f.write("{\n")
         f.write(libxl_C_enum_to_string(ty, "e"))
@@ -278,7 +278,7 @@
         f.write("\n")
 
     for ty in [t for t in types if t.json_fn is not None]:
-        f.write("yajl_gen_status %s_gen_json(yajl_gen hand, %s)\n" % (ty.typename, ty.make_arg("p", passby=libxltypes.PASS_BY_REFERENCE)))
+        f.write("yajl_gen_status %s_gen_json(yajl_gen hand, %s)\n" % (ty.typename, ty.make_arg("p", passby=idl.PASS_BY_REFERENCE)))
         f.write("{\n")
         f.write(libxl_C_type_gen_json(ty, "p"))
         f.write("}\n")
diff -r 61ac1bf881ea -r e61ac54bbf1c tools/libxl/idl.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxl/idl.py	Tue Jan 31 16:34:38 2012 +0000
@@ -0,0 +1,294 @@
+import sys
+
+PASS_BY_VALUE = 1
+PASS_BY_REFERENCE = 2
+
+DIR_NONE = 0
+DIR_IN   = 1
+DIR_OUT  = 2
+DIR_BOTH = 3
+
+_default_namespace = ""
+def namespace(s):
+    if type(s) != str:
+        raise TypeError, "Require a string for the default namespace."
+    global _default_namespace
+    _default_namespace = s
+
+def _get_default_namespace():
+    global _default_namespace
+    return _default_namespace
+
+
+class Type(object):
+    def __init__(self, typename, **kwargs):
+        self.namespace = kwargs.setdefault('namespace',
+                _get_default_namespace())
+        self.dir = kwargs.setdefault('dir', DIR_BOTH)
+        if self.dir not in [DIR_NONE, DIR_IN, DIR_OUT, DIR_BOTH]:
+            raise ValueError
+
+        self.passby = kwargs.setdefault('passby', PASS_BY_VALUE)
+        if self.passby not in [PASS_BY_VALUE, PASS_BY_REFERENCE]:
+            raise ValueError
+
+        self.private = kwargs.setdefault('private', False)
+
+        if typename is None: # Anonymous type
+            self.typename = None
+            self.rawname = None
+        elif self.namespace is None: # e.g. system provided types
+            self.typename = typename
+            self.rawname = typename
+        else:
+            self.typename = self.namespace + typename
+            self.rawname = typename
+
+        if self.typename is not None:
+            self.dispose_fn = kwargs.setdefault('dispose_fn', self.typename + "_dispose")
+        else:
+            self.dispose_fn = kwargs.setdefault('dispose_fn', None)
+
+        self.autogenerate_dispose_fn = kwargs.setdefault('autogenerate_dispose_fn', True)
+
+        if self.typename is not None and not self.private:
+            self.json_fn = kwargs.setdefault('json_fn', self.typename + "_gen_json")
+        else:
+            self.json_fn = kwargs.setdefault('json_fn', None)
+
+        self.autogenerate_json = kwargs.setdefault('autogenerate_json', True)
+
+    def marshal_in(self):
+        return self.dir in [DIR_IN, DIR_BOTH]
+    def marshal_out(self):
+        return self.dir in [DIR_OUT, DIR_BOTH]
+
+    def make_arg(self, n, passby=None):
+        if passby is None: passby = self.passby
+
+        if passby == PASS_BY_REFERENCE:
+            return "%s *%s" % (self.typename, n)
+        else:
+            return "%s %s" % (self.typename, n)
+
+    def pass_arg(self, n, isref=None, passby=None):
+        if passby is None: passby = self.passby
+        if isref is None: isref = self.passby == PASS_BY_REFERENCE
+
+        if passby == PASS_BY_REFERENCE:
+            if isref:
+                return "%s" % (n)
+            else:
+                return "&%s" % (n)
+        else:
+            if isref:
+                return "*%s" % (n)
+            else:
+                return "%s" % (n)
+
+class Builtin(Type):
+    """Builtin type"""
+    def __init__(self, typename, **kwargs):
+        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('dispose_fn', None)
+        kwargs.setdefault('signed', False)
+        kwargs.setdefault('json_fn', "yajl_gen_integer")
+        self.signed = kwargs['signed']
+        Builtin.__init__(self, ctype, **kwargs)
+
+class UInt(Number):
+    def __init__(self, w, **kwargs):
+        kwargs.setdefault('namespace', None)
+        kwargs.setdefault('dispose_fn', None)
+        Number.__init__(self, "uint%d_t" % w, **kwargs)
+
+        self.width = w
+
+class EnumerationValue(object):
+    def __init__(self, enum, value, name, **kwargs):
+        self.enum = enum
+
+        self.valuename = str.upper(name)
+        self.rawname = str.upper(enum.rawname) + "_" + self.valuename
+        self.name = str.upper(enum.namespace) + self.rawname
+        self.value = value
+
+class Enumeration(Type):
+    def __init__(self, typename, values, **kwargs):
+        kwargs.setdefault('dispose_fn', None)
+        Type.__init__(self, typename, **kwargs)
+
+        self.values = []
+        for v in values:
+            # (value, name)
+            (num,name) = v
+            self.values.append(EnumerationValue(self, num, name,
+                                                typename=self.rawname))
+    def lookup(self, name):
+        for v in self.values:
+            if v.valuename == str.upper(name):
+                return v
+        return ValueError
+
+class Field(object):
+    """An element of an Aggregate type"""
+    def __init__(self, type, name, **kwargs):
+        self.type = type
+        self.name = name
+        self.const = kwargs.setdefault('const', False)
+        self.enumname = kwargs.setdefault('enumname', None)
+
+class Aggregate(Type):
+    """A type containing a collection of other types"""
+    def __init__(self, kind, typename, fields, **kwargs):
+        Type.__init__(self, typename, **kwargs)
+
+        self.kind = kind
+
+        self.fields = []
+        for f in fields:
+            # (name, type[, {kw args}])
+            if len(f) == 2:
+                n,t = f
+                kw = {}
+            elif len(f) == 3:
+                n,t,kw = f
+            else:
+                raise ValueError
+            if n is None:
+                raise ValueError
+            self.fields.append(Field(t,n,**kw))
+
+    # Returns a tuple (stem, field-expr)
+    #
+    # field-expr is a C expression for a field "f" within the struct
+    # "v".
+    #
+    # stem is the stem common to both "f" and any other sibbling field
+    # within the "v".
+    def member(self, v, f, isref):
+        if isref:
+            deref = v + "->"
+        else:
+            deref = v + "."
+
+        if f.name is None: # Anonymous
+            return (deref, deref)
+        else:
+            return (deref, deref + f.name)
+
+class Struct(Aggregate):
+    def __init__(self, name, fields, **kwargs):
+        kwargs.setdefault('passby', PASS_BY_REFERENCE)
+        Aggregate.__init__(self, "struct", name, fields, **kwargs)
+
+class Union(Aggregate):
+    def __init__(self, name, fields, **kwargs):
+        # Generally speaking some intelligence is required to free a
+        # union therefore any specific instance of this class will
+        # need to provide an explicit destructor function.
+        kwargs.setdefault('passby', PASS_BY_REFERENCE)
+        kwargs.setdefault('dispose_fn', None)
+        Aggregate.__init__(self, "union", name, fields, **kwargs)
+
+class KeyedUnion(Aggregate):
+    """A union which is keyed of another variable in the parent structure"""
+    def __init__(self, name, keyvar_type, keyvar_name, fields, **kwargs):
+        Aggregate.__init__(self, "union", name, [], **kwargs)
+
+        if not isinstance(keyvar_type, Enumeration):
+            raise ValueError
+
+        self.keyvar_name = keyvar_name
+        self.keyvar_type = keyvar_type
+
+        for f in fields:
+            # (name, enum, type)
+            e, ty = f
+            ev = keyvar_type.lookup(e)
+            en = ev.name
+            self.fields.append(Field(ty, e, enumname=en))
+
+#
+# Standard Types
+#
+
+void = Builtin("void *", namespace = None)
+bool = Builtin("bool", namespace = None,
+               json_fn = "yajl_gen_bool",
+               autogenerate_json = False)
+
+size_t = Number("size_t", namespace = None)
+
+integer = Number("int", namespace = None, signed = True)
+
+uint8 = UInt(8)
+uint16 = UInt(16)
+uint32 = UInt(32)
+uint64 = UInt(64)
+
+string = Builtin("char *", namespace = None, dispose_fn = "free",
+                 json_fn = "libxl__string_gen_json",
+                 autogenerate_json = False)
+
+class OrderedDict(dict):
+    """A dictionary which remembers insertion order.
+
+       push to back on duplicate insertion"""
+
+    def __init__(self):
+        dict.__init__(self)
+        self.__ordered = []
+
+    def __setitem__(self, key, value):
+        try:
+            self.__ordered.remove(key)
+        except ValueError:
+            pass
+
+        self.__ordered.append(key)
+        dict.__setitem__(self, key, value)
+
+    def ordered_keys(self):
+        return self.__ordered
+    def ordered_values(self):
+        return [self[x] for x in self.__ordered]
+    def ordered_items(self):
+        return [(x,self[x]) for x in self.__ordered]
+
+def parse(f):
+    print >>sys.stderr, "Parsing %s" % f
+
+    globs = {}
+    locs = OrderedDict()
+
+    for n,t in globals().items():
+        if isinstance(t, Type):
+            globs[n] = t
+        elif isinstance(t,type(object)) and issubclass(t, Type):
+            globs[n] = t
+        elif n in ['PASS_BY_REFERENCE', 'PASS_BY_VALUE',
+                   'DIR_NONE', 'DIR_IN', 'DIR_OUT', 'DIR_BOTH',
+                   'namespace']:
+            globs[n] = t
+
+    try:
+        execfile(f, globs, locs)
+    except SyntaxError,e:
+        raise SyntaxError, \
+              "Errors were found at line %d while processing %s:\n\t%s"\
+              %(e.lineno,f,e.text)
+
+    types = [t for t in locs.ordered_values() if isinstance(t,Type)]
+
+    builtins = [t for t in types if isinstance(t,Builtin)]
+    types = [t for t in types if not isinstance(t,Builtin)]
+
+    return (builtins,types)
diff -r 61ac1bf881ea -r e61ac54bbf1c tools/libxl/idl.txt
--- a/tools/libxl/idl.txt	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/idl.txt	Tue Jan 31 16:34:38 2012 +0000
@@ -1,10 +1,10 @@
-libxltypes IDL
---------------
+libxl IDL
+---------
 
 Each type in the libxl interface is represented by an object of type
-libxltypes.Type (or a subclass thereof). Every local variable defined
-by the .idl file must be an instance of libxltypes.Type (e.g. you may
-not define Python functions or any other construct other than defining
+idl.Type (or a subclass thereof). Every local variable defined by
+the .idl file must be an instance of idl.Type (e.g. you may not
+define Python functions or any other construct other than defining
 variables)
 
 The name of the type must be passed as the first argument to the
@@ -16,9 +16,9 @@
 namespace element while Type.rawname is always set to the 'base' name
 of the type.
 
-The libxltypes.Type base class has several other properties which
-apply to all types. The properties are set by passing a named
-parameter to the constructor.
+The idl.Type base class has several other properties which apply
+to all types. The properties are set by passing a named parameter to
+the constructor.
 
 Type.namespace: (default: "libxl_")
 
@@ -28,12 +28,12 @@
  If the typename is not None then the namespace is prepended to the
  type.
  
-Type.passby: (default: libxltypes.PASS_BY_VALUE)
+Type.passby: (default: idl.PASS_BY_VALUE)
 
  Defines the manner in which a type should be passed to C
  functions. Valid values for this fields are:
-   libxltypes.PASS_BY_VALUE
-   libxltypes.PASS_BY_REFERENCE
+   idl.PASS_BY_VALUE
+   idl.PASS_BY_REFERENCE
 
 Type.dispose_fn: (default: typename + "_dispose" or None if type == None)
 
@@ -57,12 +57,12 @@
 Other simple type-Classes
 -------------------------
 
-libxltype.Builtin
+idl.Builtin
 
  Instances of this class represent types which are predefined within
  the system.
 
-libxltype.UInt
+idl.UInt
 
  Instances of this class represent the standard uint<N>_t types.
 
@@ -72,12 +72,12 @@
 Complex type-Classes
 --------------------
 
-libxltype.Enumeration
+idl.Enumeration
 
   A class representing an enumeration (named integer values).
 
   The values are available in the list Enumeration.values. Each
-  element in the list is of type libxltype.EnumerationValue.
+  element in the list is of type idl.EnumerationValue.
 
   Each EnumerationValue has the following properties:
 
@@ -95,37 +95,37 @@
 				    and any namespace (e.g. "VALUE")
     EnumerationValue.value	The integer value associated with this name.
 
-libxltype.Aggregate
+idl.Aggregate
 
  Base class for type-Classes which contain a number of other types
  (e.g. structs and unions).
 
  The contained types are available in the list Aggregate.fields. Each
- element in the list is of type libxltype.Field representing a member
- of the aggregate.
+ element in the list is of type idl.Field representing a member of the
+ aggregate.
 
  Each field has the following properties:
 
-  Field.type	The type of the member (a libxltypes.Type).
+  Field.type	The type of the member (a idl.Type).
   Field.name    The name of the member (can be None for anonymous
 		fields).
   Field.const	Boolean, true if the member is const.
 
-libxltype.Struct
+idl.Struct
 
- A subclass of libxltype.Aggregate representing the C struct type.
+ A subclass of idl.Aggregate representing the C struct type.
 
  Struct.kind == "struct"
 
-libxltype.Union
+idl.Union
 
- A subclass of libxltype.Aggregate representing the C union type.
+ A subclass of idl.Aggregate representing the C union type.
 
  Union.kind == "union"
 
-libxltype.KeyedUnion
+idl.KeyedUnion
 
- A subclass of libxltype.Aggregate which represents the C union type
+ A subclass of idl.Aggregate which represents the C union type
  where the currently valid member of the union can be determined based
  upon another member in the containing type.
 
diff -r 61ac1bf881ea -r e61ac54bbf1c tools/libxl/libxltypes.py
--- a/tools/libxl/libxltypes.py	Tue Jan 31 16:34:38 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,294 +0,0 @@
-import sys
-
-PASS_BY_VALUE = 1
-PASS_BY_REFERENCE = 2
-
-DIR_NONE = 0
-DIR_IN   = 1
-DIR_OUT  = 2
-DIR_BOTH = 3
-
-_default_namespace = ""
-def namespace(s):
-    if type(s) != str:
-        raise TypeError, "Require a string for the default namespace."
-    global _default_namespace
-    _default_namespace = s
-
-def _get_default_namespace():
-    global _default_namespace
-    return _default_namespace
-
-
-class Type(object):
-    def __init__(self, typename, **kwargs):
-        self.namespace = kwargs.setdefault('namespace',
-                _get_default_namespace())
-        self.dir = kwargs.setdefault('dir', DIR_BOTH)
-        if self.dir not in [DIR_NONE, DIR_IN, DIR_OUT, DIR_BOTH]:
-            raise ValueError
-
-        self.passby = kwargs.setdefault('passby', PASS_BY_VALUE)
-        if self.passby not in [PASS_BY_VALUE, PASS_BY_REFERENCE]:
-            raise ValueError
-
-        self.private = kwargs.setdefault('private', False)
-
-        if typename is None: # Anonymous type
-            self.typename = None
-            self.rawname = None
-        elif self.namespace is None: # e.g. system provided types
-            self.typename = typename
-            self.rawname = typename
-        else:
-            self.typename = self.namespace + typename
-            self.rawname = typename
-
-        if self.typename is not None:
-            self.dispose_fn = kwargs.setdefault('dispose_fn', self.typename + "_dispose")
-        else:
-            self.dispose_fn = kwargs.setdefault('dispose_fn', None)
-
-        self.autogenerate_dispose_fn = kwargs.setdefault('autogenerate_dispose_fn', True)
-
-        if self.typename is not None and not self.private:
-            self.json_fn = kwargs.setdefault('json_fn', self.typename + "_gen_json")
-        else:
-            self.json_fn = kwargs.setdefault('json_fn', None)
-
-        self.autogenerate_json = kwargs.setdefault('autogenerate_json', True)
-
-    def marshal_in(self):
-        return self.dir in [DIR_IN, DIR_BOTH]
-    def marshal_out(self):
-        return self.dir in [DIR_OUT, DIR_BOTH]
-
-    def make_arg(self, n, passby=None):
-        if passby is None: passby = self.passby
-
-        if passby == PASS_BY_REFERENCE:
-            return "%s *%s" % (self.typename, n)
-        else:
-            return "%s %s" % (self.typename, n)
-
-    def pass_arg(self, n, isref=None, passby=None):
-        if passby is None: passby = self.passby
-        if isref is None: isref = self.passby == PASS_BY_REFERENCE
-
-        if passby == PASS_BY_REFERENCE:
-            if isref:
-                return "%s" % (n)
-            else:
-                return "&%s" % (n)
-        else:
-            if isref:
-                return "*%s" % (n)
-            else:
-                return "%s" % (n)
-
-class Builtin(Type):
-    """Builtin type"""
-    def __init__(self, typename, **kwargs):
-        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('dispose_fn', None)
-        kwargs.setdefault('signed', False)
-        kwargs.setdefault('json_fn', "yajl_gen_integer")
-        self.signed = kwargs['signed']
-        Builtin.__init__(self, ctype, **kwargs)
-
-class UInt(Number):
-    def __init__(self, w, **kwargs):
-        kwargs.setdefault('namespace', None)
-        kwargs.setdefault('dispose_fn', None)
-        Number.__init__(self, "uint%d_t" % w, **kwargs)
-
-        self.width = w
-
-class EnumerationValue(object):
-    def __init__(self, enum, value, name, **kwargs):
-        self.enum = enum
-
-        self.valuename = str.upper(name)
-        self.rawname = str.upper(enum.rawname) + "_" + self.valuename
-        self.name = str.upper(enum.namespace) + self.rawname
-        self.value = value
-
-class Enumeration(Type):
-    def __init__(self, typename, values, **kwargs):
-        kwargs.setdefault('dispose_fn', None)
-        Type.__init__(self, typename, **kwargs)
-
-        self.values = []
-        for v in values:
-            # (value, name)
-            (num,name) = v
-            self.values.append(EnumerationValue(self, num, name,
-                                                typename=self.rawname))
-    def lookup(self, name):
-        for v in self.values:
-            if v.valuename == str.upper(name):
-                return v
-        return ValueError
-
-class Field(object):
-    """An element of an Aggregate type"""
-    def __init__(self, type, name, **kwargs):
-        self.type = type
-        self.name = name
-        self.const = kwargs.setdefault('const', False)
-        self.enumname = kwargs.setdefault('enumname', None)
-
-class Aggregate(Type):
-    """A type containing a collection of other types"""
-    def __init__(self, kind, typename, fields, **kwargs):
-        Type.__init__(self, typename, **kwargs)
-
-        self.kind = kind
-
-        self.fields = []
-        for f in fields:
-            # (name, type[, {kw args}])
-            if len(f) == 2:
-                n,t = f
-                kw = {}
-            elif len(f) == 3:
-                n,t,kw = f
-            else:
-                raise ValueError
-            if n is None:
-                raise ValueError
-            self.fields.append(Field(t,n,**kw))
-
-    # Returns a tuple (stem, field-expr)
-    #
-    # field-expr is a C expression for a field "f" within the struct
-    # "v".
-    #
-    # stem is the stem common to both "f" and any other sibbling field
-    # within the "v".
-    def member(self, v, f, isref):
-        if isref:
-            deref = v + "->"
-        else:
-            deref = v + "."
-
-        if f.name is None: # Anonymous
-            return (deref, deref)
-        else:
-            return (deref, deref + f.name)
-
-class Struct(Aggregate):
-    def __init__(self, name, fields, **kwargs):
-        kwargs.setdefault('passby', PASS_BY_REFERENCE)
-        Aggregate.__init__(self, "struct", name, fields, **kwargs)
-
-class Union(Aggregate):
-    def __init__(self, name, fields, **kwargs):
-        # Generally speaking some intelligence is required to free a
-        # union therefore any specific instance of this class will
-        # need to provide an explicit destructor function.
-        kwargs.setdefault('passby', PASS_BY_REFERENCE)
-        kwargs.setdefault('dispose_fn', None)
-        Aggregate.__init__(self, "union", name, fields, **kwargs)
-
-class KeyedUnion(Aggregate):
-    """A union which is keyed of another variable in the parent structure"""
-    def __init__(self, name, keyvar_type, keyvar_name, fields, **kwargs):
-        Aggregate.__init__(self, "union", name, [], **kwargs)
-
-        if not isinstance(keyvar_type, Enumeration):
-            raise ValueError
-
-        self.keyvar_name = keyvar_name
-        self.keyvar_type = keyvar_type
-
-        for f in fields:
-            # (name, enum, type)
-            e, ty = f
-            ev = keyvar_type.lookup(e)
-            en = ev.name
-            self.fields.append(Field(ty, e, enumname=en))
-
-#
-# Standard Types
-#
-
-void = Builtin("void *", namespace = None)
-bool = Builtin("bool", namespace = None,
-               json_fn = "yajl_gen_bool",
-               autogenerate_json = False)
-
-size_t = Number("size_t", namespace = None)
-
-integer = Number("int", namespace = None, signed = True)
-
-uint8 = UInt(8)
-uint16 = UInt(16)
-uint32 = UInt(32)
-uint64 = UInt(64)
-
-string = Builtin("char *", namespace = None, dispose_fn = "free",
-                 json_fn = "libxl__string_gen_json",
-                 autogenerate_json = False)
-
-class OrderedDict(dict):
-    """A dictionary which remembers insertion order.
-
-       push to back on duplicate insertion"""
-
-    def __init__(self):
-        dict.__init__(self)
-        self.__ordered = []
-
-    def __setitem__(self, key, value):
-        try:
-            self.__ordered.remove(key)
-        except ValueError:
-            pass
-
-        self.__ordered.append(key)
-        dict.__setitem__(self, key, value)
-
-    def ordered_keys(self):
-        return self.__ordered
-    def ordered_values(self):
-        return [self[x] for x in self.__ordered]
-    def ordered_items(self):
-        return [(x,self[x]) for x in self.__ordered]
-
-def parse(f):
-    print >>sys.stderr, "Parsing %s" % f
-
-    globs = {}
-    locs = OrderedDict()
-
-    for n,t in globals().items():
-        if isinstance(t, Type):
-            globs[n] = t
-        elif isinstance(t,type(object)) and issubclass(t, Type):
-            globs[n] = t
-        elif n in ['PASS_BY_REFERENCE', 'PASS_BY_VALUE',
-                   'DIR_NONE', 'DIR_IN', 'DIR_OUT', 'DIR_BOTH',
-                   'namespace']:
-            globs[n] = t
-
-    try:
-        execfile(f, globs, locs)
-    except SyntaxError,e:
-        raise SyntaxError, \
-              "Errors were found at line %d while processing %s:\n\t%s"\
-              %(e.lineno,f,e.text)
-
-    types = [t for t in locs.ordered_values() if isinstance(t,Type)]
-
-    builtins = [t for t in types if isinstance(t,Builtin)]
-    types = [t for t in types if not isinstance(t,Builtin)]
-
-    return (builtins,types)
diff -r 61ac1bf881ea -r e61ac54bbf1c tools/ocaml/libs/xl/Makefile
--- a/tools/ocaml/libs/xl/Makefile	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/ocaml/libs/xl/Makefile	Tue Jan 31 16:34:38 2012 +0000
@@ -46,7 +46,7 @@
 	$(Q)mv xenlight.mli.tmp xenlight.mli
 
 _libxl_types.ml.in _libxl_types.mli.in _libxl_types.inc: genwrap.py $(XEN_ROOT)/tools/libxl/libxl_types.idl \
-                $(XEN_ROOT)/tools/libxl/libxltypes.py
+                $(XEN_ROOT)/tools/libxl/idl.py
 	PYTHONPATH=$(XEN_ROOT)/tools/libxl $(PYTHON) genwrap.py \
 		$(XEN_ROOT)/tools/libxl/libxl_types.idl \
 		_libxl_types.mli.in _libxl_types.ml.in _libxl_types.inc
diff -r 61ac1bf881ea -r e61ac54bbf1c tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/ocaml/libs/xl/genwrap.py	Tue Jan 31 16:34:38 2012 +0000
@@ -2,7 +2,7 @@
 
 import sys,os
 
-import libxltypes
+import idl
 
 # typename -> ( ocaml_type, c_from_ocaml, ocaml_from_c )
 builtins = {
@@ -39,7 +39,7 @@
 def ocaml_type_of(ty):
     if ty.rawname == "domid":
         return "domid"
-    elif isinstance(ty,libxltypes.UInt):
+    elif isinstance(ty,idl.UInt):
         if ty.width in [8, 16]:
             # handle as ints
             width = None
@@ -52,14 +52,14 @@
         else:
             return "int"
 
-    elif isinstance(ty,libxltypes.Builtin):
+    elif isinstance(ty,idl.Builtin):
         if not builtins.has_key(ty.typename):
             raise NotImplementedError("Unknown Builtin %s (%s)" % (ty.typename, type(ty)))
         typename,_,_ = builtins[ty.typename]
         if not typename:
             raise NotImplementedError("No typename for Builtin %s (%s)" % (ty.typename, type(ty)))
         return typename
-    elif isinstance(ty,libxltypes.Aggregate):
+    elif isinstance(ty,idl.Aggregate):
         return ty.rawname.capitalize() + ".t"
     else:
         return ty.rawname
@@ -73,11 +73,11 @@
         s = ("""(* %s interface *)\n""" % ty.typename)
     else:
         s = ("""(* %s implementation *)\n""" % ty.typename)
-    if isinstance(ty, libxltypes.Enumeration):
+    if isinstance(ty, idl.Enumeration):
         s = "type %s = \n" % ty.rawname
         for v in ty.values:
             s += "\t | %s\n" % v.rawname
-    elif isinstance(ty, libxltypes.Aggregate):
+    elif isinstance(ty, idl.Aggregate):
         s = ""
         if ty.typename is None:
             raise NotImplementedError("%s has no typename" % type(ty))
@@ -115,7 +115,7 @@
 
 def c_val(ty, c, o, indent="", parent = None):
     s = indent
-    if isinstance(ty,libxltypes.UInt):
+    if isinstance(ty,idl.UInt):
         if ty.width in [8, 16]:
             # handle as ints
             width = None
@@ -127,14 +127,14 @@
             s += "%s = Int%d_val(%s);" % (c, width, o)
         else:
             s += "%s = Int_val(%s);" % (c, o)
-    elif isinstance(ty,libxltypes.Builtin):
+    elif isinstance(ty,idl.Builtin):
         if not builtins.has_key(ty.typename):
             raise NotImplementedError("Unknown Builtin %s (%s)" % (ty.typename, type(ty)))
         _,fn,_ = builtins[ty.typename]
         if not fn:
             raise NotImplementedError("No c_val fn for Builtin %s (%s)" % (ty.typename, type(ty)))
         s += "%s;" % (fn % { "o": o, "c": c })
-    elif isinstance(ty,libxltypes.Enumeration) and (parent is None):
+    elif isinstance(ty,idl.Enumeration) and (parent is None):
         n = 0
         s += "switch(Int_val(%s)) {\n" % o
         for e in ty.values:
@@ -142,7 +142,7 @@
             n += 1
         s += "    default: failwith_xl(\"cannot convert value to %s\", lg); break;\n" % ty.typename
         s += "}"
-    elif isinstance(ty, libxltypes.Aggregate) and (parent is None):
+    elif isinstance(ty, idl.Aggregate) and (parent is None):
         n = 0
         for f in ty.fields:
             if f.type.private:
@@ -151,14 +151,14 @@
             s += "%s\n" % c_val(f.type, fexpr, "Field(%s, %d)" % (o,n), parent=nparent)
             n = n + 1
     else:
-        s += "%s_val(gc, lg, %s, %s);" % (ty.rawname, ty.pass_arg(c, parent is None, passby=libxltypes.PASS_BY_REFERENCE), o)
+        s += "%s_val(gc, lg, %s, %s);" % (ty.rawname, ty.pass_arg(c, parent is None, passby=idl.PASS_BY_REFERENCE), o)
     
     return s.replace("\n", "\n%s" % indent)
 
 def gen_c_val(ty, indent=""):
     s = "/* Convert caml value to %s */\n" % ty.rawname
     
-    s += "static int %s_val (caml_gc *gc, struct caml_logger *lg, %s, value v)\n" % (ty.rawname, ty.make_arg("c_val", passby=libxltypes.PASS_BY_REFERENCE))
+    s += "static int %s_val (caml_gc *gc, struct caml_logger *lg, %s, value v)\n" % (ty.rawname, ty.make_arg("c_val", passby=idl.PASS_BY_REFERENCE))
     s += "{\n"
     s += "\tCAMLparam1(v);\n"
     s += "\n"
@@ -172,7 +172,7 @@
 
 def ocaml_Val(ty, o, c, indent="", parent = None):
     s = indent
-    if isinstance(ty,libxltypes.UInt):
+    if isinstance(ty,idl.UInt):
         if ty.width in [8, 16]:
             # handle as ints
             width = None
@@ -184,14 +184,14 @@
             s += "%s = caml_copy_int%d(%s);" % (o, width, c)
         else:
             s += "%s = Val_int(%s);" % (o, c)
-    elif isinstance(ty,libxltypes.Builtin):
+    elif isinstance(ty,idl.Builtin):
         if not builtins.has_key(ty.typename):
             raise NotImplementedError("Unknown Builtin %s (%s)" % (ty.typename, type(ty)))
         _,_,fn = builtins[ty.typename]
         if not fn:
             raise NotImplementedError("No ocaml Val fn for Builtin %s (%s)" % (ty.typename, type(ty)))
         s += "%s = %s;" % (o, fn % { "c": c })
-    elif isinstance(ty,libxltypes.Enumeration) and (parent is None):
+    elif isinstance(ty,idl.Enumeration) and (parent is None):
         n = 0
         s += "switch(%s) {\n" % c
         for e in ty.values:
@@ -199,7 +199,7 @@
             n += 1
         s += "    default: failwith_xl(\"cannot convert value from %s\", lg); break;\n" % ty.typename
         s += "}"
-    elif isinstance(ty,libxltypes.Aggregate) and (parent is None):
+    elif isinstance(ty,idl.Aggregate) and (parent is None):
         s += "{\n"
         s += "\tvalue %s_field;\n" % ty.rawname
         s += "\n"
@@ -258,8 +258,7 @@
         print >>sys.stderr, "Usage: genwrap.py <idl> <mli> <ml> <c-inc>"
         sys.exit(1)
 
-    idl = sys.argv[1]
-    (_,types) = libxltypes.parse(idl)
+    (_,types) = idl.parse(sys.argv[1])
 
     # Do not generate these yet.
     blacklist = [
diff -r 61ac1bf881ea -r e61ac54bbf1c tools/python/Makefile
--- a/tools/python/Makefile	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/python/Makefile	Tue Jan 31 16:34:38 2012 +0000
@@ -11,7 +11,7 @@
 
 .PHONY: build
 build: genpath genwrap.py $(XEN_ROOT)/tools/libxl/libxl_types.idl \
-		$(XEN_ROOT)/tools/libxl/libxltypes.py
+		$(XEN_ROOT)/tools/libxl/idl.py
 	PYTHONPATH=$(XEN_ROOT)/tools/libxl $(PYTHON) genwrap.py \
 		$(XEN_ROOT)/tools/libxl/libxl_types.idl \
 		xen/lowlevel/xl/_pyxl_types.h \
diff -r 61ac1bf881ea -r e61ac54bbf1c tools/python/genwrap.py
--- a/tools/python/genwrap.py	Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/python/genwrap.py	Tue Jan 31 16:34:38 2012 +0000
@@ -2,23 +2,23 @@
 
 import sys,os
 
-import libxltypes
+import idl
 
 (TYPE_BOOL, TYPE_INT, TYPE_UINT, TYPE_STRING, TYPE_AGGREGATE) = range(5)
 
 def py_type(ty):
-    if ty == libxltypes.bool:
+    if ty == idl.bool:
         return TYPE_BOOL
-    if isinstance(ty, libxltypes.Enumeration):
+    if isinstance(ty, idl.Enumeration):
         return TYPE_UINT
-    if isinstance(ty, libxltypes.Number):
+    if isinstance(ty, idl.Number):
         if ty.signed:
             return TYPE_INT
         else:
             return TYPE_UINT
-    if isinstance(ty, libxltypes.Aggregate):
+    if isinstance(ty, idl.Aggregate):
         return TYPE_AGGREGATE
-    if ty == libxltypes.string:
+    if ty == idl.string:
         return TYPE_STRING
     return None
 
@@ -38,7 +38,7 @@
 
 def py_decls(ty):
     l = []
-    if isinstance(ty, libxltypes.Aggregate):
+    if isinstance(ty, idl.Aggregate):
         l.append('_hidden Py_%s *Py%s_New(void);\n'%(ty.rawname, ty.rawname))
         l.append('_hidden int Py%s_Check(PyObject *self);\n'%ty.rawname)
         for f in ty.fields:
@@ -211,10 +211,10 @@
     l.append('void genwrap__init(PyObject *m)')
     l.append('{')
     for ty in types:
-        if isinstance(ty, libxltypes.Enumeration):
+        if isinstance(ty, idl.Enumeration):
             for v in ty.values:
                 l.append('    PyModule_AddIntConstant(m, "%s", %s);' % (v.rawname, v.name))
-        elif isinstance(ty, libxltypes.Aggregate):
+        elif isinstance(ty, idl.Aggregate):
             l.append('    if (PyType_Ready(&Py%s_Type) >= 0) {'%ty.rawname)
             l.append('        Py_INCREF(&Py%s_Type);'%ty.rawname)
             l.append('        PyModule_AddObject(m, "%s", (PyObject *)&Py%s_Type);'%(ty.rawname, ty.rawname))
@@ -227,7 +227,7 @@
 
 def tree_frob(types):
     ret = types[:]
-    for ty in [ty for ty in ret if isinstance(ty, libxltypes.Aggregate)]:
+    for ty in [ty for ty in ret if isinstance(ty, idl.Aggregate)]:
         ty.fields = filter(lambda f:f.name is not None and f.type.typename is not None, ty.fields)
     return ret
 
@@ -236,8 +236,7 @@
         print >>sys.stderr, "Usage: genwrap.py <idl> <decls> <defns>"
         sys.exit(1)
 
-    idl = sys.argv[1]
-    (_,types) = libxltypes.parse(idl)
+    (_,types) = idl.parse(sys.argv[1])
 
     types = tree_frob(types)
 
@@ -278,7 +277,7 @@
 _hidden int genwrap__ll_set(PyObject *v, long long *val, long long mask);
 
 """ % " ".join(sys.argv))
-    for ty in [ty for ty in types if isinstance(ty, libxltypes.Aggregate)]:
+    for ty in [ty for ty in types if isinstance(ty, idl.Aggregate)]:
         f.write('/* Internal API for %s wrapper */\n'%ty.typename)
         f.write(py_wrapstruct(ty))
         f.write(py_decls(ty))
@@ -307,7 +306,7 @@
     for ty in types:
         if ty.private:
             continue
-        if isinstance(ty, libxltypes.Aggregate):
+        if isinstance(ty, idl.Aggregate):
             f.write('/* Attribute get/set functions for %s */\n'%ty.typename)
             for a in ty.fields:
                 if a.type.private:

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:42 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9V-0008D8-WC; Fri, 03 Feb 2012 21:58:42 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9V-000881-12
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:41 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1328306313!11933734!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12512 invoked from network); 3 Feb 2012 21:58:34 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:34 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9N-0001pM-1Z
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:33 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9K-0003B7-HV
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:32 +0000
Message-Id: <E1RtR9K-0003B7-HV@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:28 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: remove libxl_button_press in
	favour of libxl_send_trigger.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027679 0
# Node ID 44ee4d37384faf3c7129545a5c4e067f28ec04e5
# Parent  a322bdbd43deaa67fbe1c4072fee38a797f51923
libxl: remove libxl_button_press in favour of libxl_send_trigger.

send_trigger already included all the operations covered by button_press.

Rework send_trigger to take an enum instead of a string.

I stopped short at removing the xl "button-press" command but instead have
marked it as deprecated.

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


diff -r a322bdbd43de -r 44ee4d37384f docs/man/xl.pod.1
--- a/docs/man/xl.pod.1	Tue Jan 31 16:34:39 2012 +0000
+++ b/docs/man/xl.pod.1	Tue Jan 31 16:34:39 2012 +0000
@@ -86,6 +86,8 @@
 
 =item B<button-press> I<domain-id> I<button>
 
+I<This command is deprecated. Please use C<xl trigger> in preference>
+
 Indicate an ACPI button press to the domain. I<button> is may be 'power' or
 'sleep'. This command is only available for HVM domains.
 
@@ -461,7 +463,7 @@
 your Linux Kernel sources for more information.
 It requires PV drivers to be installed in your guest OS.
 
-=item B<trigger> I<domain-id> I<nmi|reset|init|power|sleep> [I<VCPU>]
+=item B<trigger> I<domain-id> I<nmi|reset|init|power|sleep|s3resume> [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.
diff -r a322bdbd43de -r 44ee4d37384f tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Jan 31 16:34:39 2012 +0000
@@ -2728,24 +2728,6 @@
     return 0;
 }
 
-int libxl_button_press(libxl_ctx *ctx, uint32_t domid, libxl_button button)
-{
-    int rc = -1;
-
-    switch (button) {
-    case LIBXL_BUTTON_POWER:
-        rc = xc_domain_send_trigger(ctx->xch, domid, XEN_DOMCTL_SENDTRIGGER_POWER, 0);
-        break;
-    case LIBXL_BUTTON_SLEEP:
-        rc = xc_domain_send_trigger(ctx->xch, domid, XEN_DOMCTL_SENDTRIGGER_SLEEP, 0);
-        break;
-    default:
-        break;
-    }
-
-    return rc;
-}
-
 int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo)
 {
     xc_physinfo_t xcphysinfo = { 0 };
@@ -3144,44 +3126,46 @@
     return 0;
 }
 
-static int trigger_type_from_string(char *trigger_name)
+int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid,
+                       libxl_trigger trigger, uint32_t vcpuid)
 {
-    if (!strcmp(trigger_name, "nmi"))
-        return XEN_DOMCTL_SENDTRIGGER_NMI;
-    else if (!strcmp(trigger_name, "reset"))
-        return XEN_DOMCTL_SENDTRIGGER_RESET;
-    else if (!strcmp(trigger_name, "init"))
-        return XEN_DOMCTL_SENDTRIGGER_INIT;
-    else if (!strcmp(trigger_name, "power"))
-        return XEN_DOMCTL_SENDTRIGGER_POWER;
-    else if (!strcmp(trigger_name, "sleep"))
-        return XEN_DOMCTL_SENDTRIGGER_SLEEP;
-    else
-        return -1;
-}
-
-int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid, char *trigger_name, uint32_t vcpuid)
-{
-    int rc = -1;
-    int trigger_type = -1;
-
-    if (!strcmp(trigger_name, "s3resume")) {
+    int rc;
+
+    switch (trigger) {
+    case LIBXL_TRIGGER_POWER:
+        rc = xc_domain_send_trigger(ctx->xch, domid,
+                                    XEN_DOMCTL_SENDTRIGGER_POWER, vcpuid);
+        break;
+    case LIBXL_TRIGGER_SLEEP:
+        rc = xc_domain_send_trigger(ctx->xch, domid,
+                                    XEN_DOMCTL_SENDTRIGGER_SLEEP, vcpuid);
+        break;
+    case LIBXL_TRIGGER_NMI:
+        rc = xc_domain_send_trigger(ctx->xch, domid,
+                                    XEN_DOMCTL_SENDTRIGGER_NMI, vcpuid);
+        break;
+    case LIBXL_TRIGGER_INIT:
+        rc = xc_domain_send_trigger(ctx->xch, domid,
+                                    XEN_DOMCTL_SENDTRIGGER_INIT, vcpuid);
+        break;
+    case LIBXL_TRIGGER_RESET:
+        rc = xc_domain_send_trigger(ctx->xch, domid,
+                                    XEN_DOMCTL_SENDTRIGGER_RESET, vcpuid);
+        break;
+    case LIBXL_TRIGGER_S3RESUME:
         xc_set_hvm_param(ctx->xch, domid, HVM_PARAM_ACPI_S_STATE, 0);
-        return 0;
+        rc = 0;
+        break;
+    default:
+        rc = EINVAL;
+        break;
     }
 
-    trigger_type = trigger_type_from_string(trigger_name);
-    if (trigger_type == -1) {
-        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, -1,
-            "Invalid trigger, valid triggers are <nmi|reset|init|power|sleep>");
-        return ERROR_INVAL;
-    }
-
-    rc = xc_domain_send_trigger(ctx->xch, domid, trigger_type, vcpuid);
     if (rc != 0) {
         LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
-            "Send trigger '%s' failed", trigger_name);
-        return ERROR_FAIL;
+                            "Send trigger '%s' failed",
+                            libxl_trigger_to_string(trigger));
+        rc = ERROR_FAIL;
     }
 
     return 0;
diff -r a322bdbd43de -r 44ee4d37384f tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl.h	Tue Jan 31 16:34:39 2012 +0000
@@ -575,8 +575,6 @@
    * On error return, *data_r and *datalen_r are undefined.
    */
 
-int libxl_button_press(libxl_ctx *ctx, uint32_t domid, libxl_button button);
-
 int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo);
 int libxl_get_topologyinfo(libxl_ctx *ctx, libxl_topologyinfo *info);
 libxl_vcpuinfo *libxl_list_vcpu(libxl_ctx *ctx, uint32_t domid,
@@ -603,7 +601,7 @@
 int libxl_sched_sedf_domain_set(libxl_ctx *ctx, uint32_t domid,
                                 libxl_sched_sedf *scinfo);
 int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid,
-                       char *trigger_name, uint32_t vcpuid);
+                       libxl_trigger trigger, uint32_t vcpuid);
 int libxl_send_sysrq(libxl_ctx *ctx, uint32_t domid, char sysrq);
 int libxl_send_debug_keys(libxl_ctx *ctx, char *keys);
 
diff -r a322bdbd43de -r 44ee4d37384f tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:39 2012 +0000
@@ -75,9 +75,14 @@
     (6, "COREDUMP_RESTART"),
     ])
 
-libxl_button = Enumeration("button", [
+libxl_trigger = Enumeration("trigger", [
+    (0, "UNKNOWN"),
     (1, "POWER"),
     (2, "SLEEP"),
+    (3, "NMI"),
+    (4, "INIT"),
+    (5, "RESET"),
+    (6, "S3RESUME"),
     ])
 
 libxl_tsc_mode = Enumeration("tsc_mode", [
diff -r a322bdbd43de -r 44ee4d37384f tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 16:34:39 2012 +0000
@@ -3465,26 +3465,29 @@
 
 static void button_press(const char *p, const char *b)
 {
-    libxl_button button;
+    libxl_trigger trigger;
 
     find_domain(p);
 
     if (!strcmp(b, "power")) {
-        button = LIBXL_BUTTON_POWER;
+        trigger = LIBXL_TRIGGER_POWER;
     } else if (!strcmp(b, "sleep")) {
-        button = LIBXL_BUTTON_SLEEP;
+        trigger = LIBXL_TRIGGER_SLEEP;
     } else {
         fprintf(stderr, "%s is an invalid button identifier\n", b);
         exit(2);
     }
 
-    libxl_button_press(ctx, domid, button);
+    libxl_send_trigger(ctx, domid, trigger, 0);
 }
 
 int main_button_press(int argc, char **argv)
 {
     int opt;
 
+    fprintf(stderr, "WARNING: \"button-press\" is deprecated. "
+            "Please use \"trigger\"\n");
+
     if ((opt = def_getopt(argc, argv, "", "button-press", 2)) != -1)
         return opt;
 
@@ -4512,10 +4515,11 @@
 int main_trigger(int argc, char **argv)
 {
     int opt;
-    char *trigger_name = NULL;
     char *endptr = NULL;
     const char *dom = NULL;
     int vcpuid = 0;
+    const char *trigger_name = NULL;
+    libxl_trigger trigger;
 
     if ((opt = def_getopt(argc, argv, "", "trigger", 2)) != -1)
         return opt;
@@ -4525,6 +4529,10 @@
     find_domain(dom);
 
     trigger_name = argv[optind++];
+    if (libxl_trigger_from_string(trigger_name, &trigger)) {
+        fprintf(stderr, "Invalid trigger \"%s\"\n", trigger_name);
+        return -1;
+    }
 
     if (argv[optind]) {
         vcpuid = strtol(argv[optind], &endptr, 10);
@@ -4533,7 +4541,7 @@
         }
     }
 
-    libxl_send_trigger(ctx, domid, trigger_name, vcpuid);
+    libxl_send_trigger(ctx, domid, trigger, vcpuid);
 
     return 0;
 }
diff -r a322bdbd43de -r 44ee4d37384f tools/ocaml/libs/xl/xenlight.ml.in
--- a/tools/ocaml/libs/xl/xenlight.ml.in	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight.ml.in	Tue Jan 31 16:34:39 2012 +0000
@@ -29,10 +29,8 @@
 	external get : unit -> t = "stub_xl_topologyinfo"
 end
 
-external button_press : domid -> button -> unit = "stub_xl_button_press"
 
-
-external send_trigger : domid -> string -> int -> unit = "stub_xl_send_trigger"
+external send_trigger : domid -> trigger -> int -> unit = "stub_xl_send_trigger"
 external send_sysrq : domid -> char -> unit = "stub_xl_send_sysrq"
 external send_debug_keys : domid -> string -> unit = "stub_xl_send_debug_keys"
 
diff -r a322bdbd43de -r 44ee4d37384f tools/ocaml/libs/xl/xenlight.mli.in
--- a/tools/ocaml/libs/xl/xenlight.mli.in	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight.mli.in	Tue Jan 31 16:34:39 2012 +0000
@@ -29,8 +29,6 @@
 	external get : unit -> t = "stub_xl_topologyinfo"
 end
 
-external button_press : domid -> button -> unit = "stub_xl_button_press"
-
-external send_trigger : domid -> string -> int -> unit = "stub_xl_send_trigger"
+external send_trigger : domid -> trigger -> int -> unit = "stub_xl_send_trigger"
 external send_sysrq : domid -> char -> unit = "stub_xl_send_sysrq"
 external send_debug_keys : domid -> string -> unit = "stub_xl_send_debug_keys"
diff -r a322bdbd43de -r 44ee4d37384f tools/ocaml/libs/xl/xenlight_stubs.c
--- a/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Jan 31 16:34:39 2012 +0000
@@ -432,21 +432,6 @@
 	CAMLreturn(Val_unit);
 }
 
-value stub_xl_button_press(value domid, value button)
-{
-	CAMLparam2(domid, button);
-	int ret;
-	INIT_STRUCT();
-
-	INIT_CTX();
-	ret = libxl_button_press(ctx, Int_val(domid), Int_val(button) + LIBXL_BUTTON_POWER);
-	if (ret != 0)
-		failwith_xl("button_press", &lg);
-	FREE_CTX();
-
-	CAMLreturn(Val_unit);
-}
-
 value stub_xl_physinfo_get(value unit)
 {
 	CAMLparam1(unit);
@@ -523,10 +508,10 @@
 {
 	CAMLparam3(domid, trigger, vcpuid);
 	int ret;
-	char *c_trigger;
+	libxl_trigger c_trigger = LIBXL_TRIGGER_UNKNOWN;
 	INIT_STRUCT();
 
-	c_trigger = dup_String_val(&gc, trigger);
+	trigger_val(&gc, &lg, &c_trigger, trigger);
 
 	INIT_CTX();
 	ret = libxl_send_trigger(ctx, Int_val(domid), c_trigger, Int_val(vcpuid));

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:42 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9V-0008D8-WC; Fri, 03 Feb 2012 21:58:42 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9V-000881-12
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:41 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1328306313!11933734!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12512 invoked from network); 3 Feb 2012 21:58:34 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:34 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9N-0001pM-1Z
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:33 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9K-0003B7-HV
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:32 +0000
Message-Id: <E1RtR9K-0003B7-HV@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:28 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: remove libxl_button_press in
	favour of libxl_send_trigger.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027679 0
# Node ID 44ee4d37384faf3c7129545a5c4e067f28ec04e5
# Parent  a322bdbd43deaa67fbe1c4072fee38a797f51923
libxl: remove libxl_button_press in favour of libxl_send_trigger.

send_trigger already included all the operations covered by button_press.

Rework send_trigger to take an enum instead of a string.

I stopped short at removing the xl "button-press" command but instead have
marked it as deprecated.

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


diff -r a322bdbd43de -r 44ee4d37384f docs/man/xl.pod.1
--- a/docs/man/xl.pod.1	Tue Jan 31 16:34:39 2012 +0000
+++ b/docs/man/xl.pod.1	Tue Jan 31 16:34:39 2012 +0000
@@ -86,6 +86,8 @@
 
 =item B<button-press> I<domain-id> I<button>
 
+I<This command is deprecated. Please use C<xl trigger> in preference>
+
 Indicate an ACPI button press to the domain. I<button> is may be 'power' or
 'sleep'. This command is only available for HVM domains.
 
@@ -461,7 +463,7 @@
 your Linux Kernel sources for more information.
 It requires PV drivers to be installed in your guest OS.
 
-=item B<trigger> I<domain-id> I<nmi|reset|init|power|sleep> [I<VCPU>]
+=item B<trigger> I<domain-id> I<nmi|reset|init|power|sleep|s3resume> [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.
diff -r a322bdbd43de -r 44ee4d37384f tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Jan 31 16:34:39 2012 +0000
@@ -2728,24 +2728,6 @@
     return 0;
 }
 
-int libxl_button_press(libxl_ctx *ctx, uint32_t domid, libxl_button button)
-{
-    int rc = -1;
-
-    switch (button) {
-    case LIBXL_BUTTON_POWER:
-        rc = xc_domain_send_trigger(ctx->xch, domid, XEN_DOMCTL_SENDTRIGGER_POWER, 0);
-        break;
-    case LIBXL_BUTTON_SLEEP:
-        rc = xc_domain_send_trigger(ctx->xch, domid, XEN_DOMCTL_SENDTRIGGER_SLEEP, 0);
-        break;
-    default:
-        break;
-    }
-
-    return rc;
-}
-
 int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo)
 {
     xc_physinfo_t xcphysinfo = { 0 };
@@ -3144,44 +3126,46 @@
     return 0;
 }
 
-static int trigger_type_from_string(char *trigger_name)
+int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid,
+                       libxl_trigger trigger, uint32_t vcpuid)
 {
-    if (!strcmp(trigger_name, "nmi"))
-        return XEN_DOMCTL_SENDTRIGGER_NMI;
-    else if (!strcmp(trigger_name, "reset"))
-        return XEN_DOMCTL_SENDTRIGGER_RESET;
-    else if (!strcmp(trigger_name, "init"))
-        return XEN_DOMCTL_SENDTRIGGER_INIT;
-    else if (!strcmp(trigger_name, "power"))
-        return XEN_DOMCTL_SENDTRIGGER_POWER;
-    else if (!strcmp(trigger_name, "sleep"))
-        return XEN_DOMCTL_SENDTRIGGER_SLEEP;
-    else
-        return -1;
-}
-
-int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid, char *trigger_name, uint32_t vcpuid)
-{
-    int rc = -1;
-    int trigger_type = -1;
-
-    if (!strcmp(trigger_name, "s3resume")) {
+    int rc;
+
+    switch (trigger) {
+    case LIBXL_TRIGGER_POWER:
+        rc = xc_domain_send_trigger(ctx->xch, domid,
+                                    XEN_DOMCTL_SENDTRIGGER_POWER, vcpuid);
+        break;
+    case LIBXL_TRIGGER_SLEEP:
+        rc = xc_domain_send_trigger(ctx->xch, domid,
+                                    XEN_DOMCTL_SENDTRIGGER_SLEEP, vcpuid);
+        break;
+    case LIBXL_TRIGGER_NMI:
+        rc = xc_domain_send_trigger(ctx->xch, domid,
+                                    XEN_DOMCTL_SENDTRIGGER_NMI, vcpuid);
+        break;
+    case LIBXL_TRIGGER_INIT:
+        rc = xc_domain_send_trigger(ctx->xch, domid,
+                                    XEN_DOMCTL_SENDTRIGGER_INIT, vcpuid);
+        break;
+    case LIBXL_TRIGGER_RESET:
+        rc = xc_domain_send_trigger(ctx->xch, domid,
+                                    XEN_DOMCTL_SENDTRIGGER_RESET, vcpuid);
+        break;
+    case LIBXL_TRIGGER_S3RESUME:
         xc_set_hvm_param(ctx->xch, domid, HVM_PARAM_ACPI_S_STATE, 0);
-        return 0;
+        rc = 0;
+        break;
+    default:
+        rc = EINVAL;
+        break;
     }
 
-    trigger_type = trigger_type_from_string(trigger_name);
-    if (trigger_type == -1) {
-        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, -1,
-            "Invalid trigger, valid triggers are <nmi|reset|init|power|sleep>");
-        return ERROR_INVAL;
-    }
-
-    rc = xc_domain_send_trigger(ctx->xch, domid, trigger_type, vcpuid);
     if (rc != 0) {
         LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
-            "Send trigger '%s' failed", trigger_name);
-        return ERROR_FAIL;
+                            "Send trigger '%s' failed",
+                            libxl_trigger_to_string(trigger));
+        rc = ERROR_FAIL;
     }
 
     return 0;
diff -r a322bdbd43de -r 44ee4d37384f tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl.h	Tue Jan 31 16:34:39 2012 +0000
@@ -575,8 +575,6 @@
    * On error return, *data_r and *datalen_r are undefined.
    */
 
-int libxl_button_press(libxl_ctx *ctx, uint32_t domid, libxl_button button);
-
 int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo);
 int libxl_get_topologyinfo(libxl_ctx *ctx, libxl_topologyinfo *info);
 libxl_vcpuinfo *libxl_list_vcpu(libxl_ctx *ctx, uint32_t domid,
@@ -603,7 +601,7 @@
 int libxl_sched_sedf_domain_set(libxl_ctx *ctx, uint32_t domid,
                                 libxl_sched_sedf *scinfo);
 int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid,
-                       char *trigger_name, uint32_t vcpuid);
+                       libxl_trigger trigger, uint32_t vcpuid);
 int libxl_send_sysrq(libxl_ctx *ctx, uint32_t domid, char sysrq);
 int libxl_send_debug_keys(libxl_ctx *ctx, char *keys);
 
diff -r a322bdbd43de -r 44ee4d37384f tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:39 2012 +0000
@@ -75,9 +75,14 @@
     (6, "COREDUMP_RESTART"),
     ])
 
-libxl_button = Enumeration("button", [
+libxl_trigger = Enumeration("trigger", [
+    (0, "UNKNOWN"),
     (1, "POWER"),
     (2, "SLEEP"),
+    (3, "NMI"),
+    (4, "INIT"),
+    (5, "RESET"),
+    (6, "S3RESUME"),
     ])
 
 libxl_tsc_mode = Enumeration("tsc_mode", [
diff -r a322bdbd43de -r 44ee4d37384f tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 16:34:39 2012 +0000
@@ -3465,26 +3465,29 @@
 
 static void button_press(const char *p, const char *b)
 {
-    libxl_button button;
+    libxl_trigger trigger;
 
     find_domain(p);
 
     if (!strcmp(b, "power")) {
-        button = LIBXL_BUTTON_POWER;
+        trigger = LIBXL_TRIGGER_POWER;
     } else if (!strcmp(b, "sleep")) {
-        button = LIBXL_BUTTON_SLEEP;
+        trigger = LIBXL_TRIGGER_SLEEP;
     } else {
         fprintf(stderr, "%s is an invalid button identifier\n", b);
         exit(2);
     }
 
-    libxl_button_press(ctx, domid, button);
+    libxl_send_trigger(ctx, domid, trigger, 0);
 }
 
 int main_button_press(int argc, char **argv)
 {
     int opt;
 
+    fprintf(stderr, "WARNING: \"button-press\" is deprecated. "
+            "Please use \"trigger\"\n");
+
     if ((opt = def_getopt(argc, argv, "", "button-press", 2)) != -1)
         return opt;
 
@@ -4512,10 +4515,11 @@
 int main_trigger(int argc, char **argv)
 {
     int opt;
-    char *trigger_name = NULL;
     char *endptr = NULL;
     const char *dom = NULL;
     int vcpuid = 0;
+    const char *trigger_name = NULL;
+    libxl_trigger trigger;
 
     if ((opt = def_getopt(argc, argv, "", "trigger", 2)) != -1)
         return opt;
@@ -4525,6 +4529,10 @@
     find_domain(dom);
 
     trigger_name = argv[optind++];
+    if (libxl_trigger_from_string(trigger_name, &trigger)) {
+        fprintf(stderr, "Invalid trigger \"%s\"\n", trigger_name);
+        return -1;
+    }
 
     if (argv[optind]) {
         vcpuid = strtol(argv[optind], &endptr, 10);
@@ -4533,7 +4541,7 @@
         }
     }
 
-    libxl_send_trigger(ctx, domid, trigger_name, vcpuid);
+    libxl_send_trigger(ctx, domid, trigger, vcpuid);
 
     return 0;
 }
diff -r a322bdbd43de -r 44ee4d37384f tools/ocaml/libs/xl/xenlight.ml.in
--- a/tools/ocaml/libs/xl/xenlight.ml.in	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight.ml.in	Tue Jan 31 16:34:39 2012 +0000
@@ -29,10 +29,8 @@
 	external get : unit -> t = "stub_xl_topologyinfo"
 end
 
-external button_press : domid -> button -> unit = "stub_xl_button_press"
 
-
-external send_trigger : domid -> string -> int -> unit = "stub_xl_send_trigger"
+external send_trigger : domid -> trigger -> int -> unit = "stub_xl_send_trigger"
 external send_sysrq : domid -> char -> unit = "stub_xl_send_sysrq"
 external send_debug_keys : domid -> string -> unit = "stub_xl_send_debug_keys"
 
diff -r a322bdbd43de -r 44ee4d37384f tools/ocaml/libs/xl/xenlight.mli.in
--- a/tools/ocaml/libs/xl/xenlight.mli.in	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight.mli.in	Tue Jan 31 16:34:39 2012 +0000
@@ -29,8 +29,6 @@
 	external get : unit -> t = "stub_xl_topologyinfo"
 end
 
-external button_press : domid -> button -> unit = "stub_xl_button_press"
-
-external send_trigger : domid -> string -> int -> unit = "stub_xl_send_trigger"
+external send_trigger : domid -> trigger -> int -> unit = "stub_xl_send_trigger"
 external send_sysrq : domid -> char -> unit = "stub_xl_send_sysrq"
 external send_debug_keys : domid -> string -> unit = "stub_xl_send_debug_keys"
diff -r a322bdbd43de -r 44ee4d37384f tools/ocaml/libs/xl/xenlight_stubs.c
--- a/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Jan 31 16:34:39 2012 +0000
@@ -432,21 +432,6 @@
 	CAMLreturn(Val_unit);
 }
 
-value stub_xl_button_press(value domid, value button)
-{
-	CAMLparam2(domid, button);
-	int ret;
-	INIT_STRUCT();
-
-	INIT_CTX();
-	ret = libxl_button_press(ctx, Int_val(domid), Int_val(button) + LIBXL_BUTTON_POWER);
-	if (ret != 0)
-		failwith_xl("button_press", &lg);
-	FREE_CTX();
-
-	CAMLreturn(Val_unit);
-}
-
 value stub_xl_physinfo_get(value unit)
 {
 	CAMLparam1(unit);
@@ -523,10 +508,10 @@
 {
 	CAMLparam3(domid, trigger, vcpuid);
 	int ret;
-	char *c_trigger;
+	libxl_trigger c_trigger = LIBXL_TRIGGER_UNKNOWN;
 	INIT_STRUCT();
 
-	c_trigger = dup_String_val(&gc, trigger);
+	trigger_val(&gc, &lg, &c_trigger, trigger);
 
 	INIT_CTX();
 	ret = libxl_send_trigger(ctx, Int_val(domid), c_trigger, Int_val(vcpuid));

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:43 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9X-0008E7-39; Fri, 03 Feb 2012 21:58:43 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9V-00088h-Nu
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:41 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-216.messagelabs.com!1328306314!13423968!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=ML_RADAR_SPEW_LINKS_18,
	spamassassin: 
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25490 invoked from network); 3 Feb 2012 21:58:35 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:35 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9O-0001pP-Hj
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:34 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9N-0003CH-Gq
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:34 +0000
Message-Id: <E1RtR9N-0003CH-Gq@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:33 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] ocaml: add helpers for Some/None
	option types.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027679 0
# Node ID f12ea2dbd328b1e8e57366a941bf33f0fb6a7fac
# Parent  44ee4d37384faf3c7129545a5c4e067f28ec04e5
ocaml: add helpers for Some/None option types.

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


diff -r 44ee4d37384f -r f12ea2dbd328 tools/ocaml/libs/xl/xenlight_stubs.c
--- a/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Jan 31 16:34:39 2012 +0000
@@ -130,6 +130,19 @@
 
 #endif
 
+/* Option type support as per http://www.linux-nantes.org/~fmonnier/ocaml/ocaml-wrapping-c.php */
+#define Val_none Val_int(0)
+#define Some_val(v) Field(v,0)
+
+static value Val_some(value v)
+{
+	CAMLparam1(v);
+	CAMLlocal1(some);
+	some = caml_alloc(1, 0);
+	Store_field(some, 0, v);
+	CAMLreturn(some);
+}
+
 static value Val_mac (libxl_mac *c_val)
 {
 	CAMLparam0();
@@ -205,14 +218,13 @@
 
 	topologyinfo = caml_alloc_tuple(c_val->coremap.entries);
 	for (i = 0; i < c_val->coremap.entries; i++) {
-		v = Val_int(0); /* None */
+		v = Val_none;
 		if (c_val->coremap.array[i] != LIBXL_CPUARRAY_INVALID_ENTRY) {
 			topology = caml_alloc_tuple(3);
 			Store_field(topology, 0, Val_int(c_val->coremap.array[i]));
 			Store_field(topology, 1, Val_int(c_val->socketmap.array[i]));
 			Store_field(topology, 2, Val_int(c_val->nodemap.array[i]));
-			v = caml_alloc(1, 0); /* Some */
-			Store_field(v, 0, topology);
+			v = Val_some(topology);
 		}
 		Store_field(topologyinfo, i, v);
 	}

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:43 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9X-0008E7-39; Fri, 03 Feb 2012 21:58:43 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9V-00088h-Nu
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:41 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-216.messagelabs.com!1328306314!13423968!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=ML_RADAR_SPEW_LINKS_18,
	spamassassin: 
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25490 invoked from network); 3 Feb 2012 21:58:35 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:35 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9O-0001pP-Hj
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:34 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9N-0003CH-Gq
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:34 +0000
Message-Id: <E1RtR9N-0003CH-Gq@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:33 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] ocaml: add helpers for Some/None
	option types.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027679 0
# Node ID f12ea2dbd328b1e8e57366a941bf33f0fb6a7fac
# Parent  44ee4d37384faf3c7129545a5c4e067f28ec04e5
ocaml: add helpers for Some/None option types.

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


diff -r 44ee4d37384f -r f12ea2dbd328 tools/ocaml/libs/xl/xenlight_stubs.c
--- a/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Jan 31 16:34:39 2012 +0000
@@ -130,6 +130,19 @@
 
 #endif
 
+/* Option type support as per http://www.linux-nantes.org/~fmonnier/ocaml/ocaml-wrapping-c.php */
+#define Val_none Val_int(0)
+#define Some_val(v) Field(v,0)
+
+static value Val_some(value v)
+{
+	CAMLparam1(v);
+	CAMLlocal1(some);
+	some = caml_alloc(1, 0);
+	Store_field(some, 0, v);
+	CAMLreturn(some);
+}
+
 static value Val_mac (libxl_mac *c_val)
 {
 	CAMLparam0();
@@ -205,14 +218,13 @@
 
 	topologyinfo = caml_alloc_tuple(c_val->coremap.entries);
 	for (i = 0; i < c_val->coremap.entries; i++) {
-		v = Val_int(0); /* None */
+		v = Val_none;
 		if (c_val->coremap.array[i] != LIBXL_CPUARRAY_INVALID_ENTRY) {
 			topology = caml_alloc_tuple(3);
 			Store_field(topology, 0, Val_int(c_val->coremap.array[i]));
 			Store_field(topology, 1, Val_int(c_val->socketmap.array[i]));
 			Store_field(topology, 2, Val_int(c_val->nodemap.array[i]));
-			v = caml_alloc(1, 0); /* Some */
-			Store_field(v, 0, topology);
+			v = Val_some(topology);
 		}
 		Store_field(topologyinfo, i, v);
 	}

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:44 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9Y-0008FB-67; Fri, 03 Feb 2012 21:58:44 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9X-00089d-2k
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:43 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-174.messagelabs.com!1328306315!11933645!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24724 invoked from network); 3 Feb 2012 21:58:36 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:36 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9P-0001pS-JH
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:35 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9P-0003Cs-4R
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:35 +0000
Message-Id: <E1RtR9P-0003Cs-4R@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:34 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] ocaml: Topology.get returns an array
	not a single element.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027679 0
# Node ID bff9e4b818b97d6282b8d427e43ffb194ac7f593
# Parent  f12ea2dbd328b1e8e57366a941bf33f0fb6a7fac
ocaml: Topology.get returns an array not a single element.

The stub implementation appears to already be correct.

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


diff -r f12ea2dbd328 -r bff9e4b818b9 tools/ocaml/libs/xl/xenlight.ml.in
--- a/tools/ocaml/libs/xl/xenlight.ml.in	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight.ml.in	Tue Jan 31 16:34:39 2012 +0000
@@ -26,7 +26,7 @@
 		socket : int;
 		node : int;
 	}
-	external get : unit -> t = "stub_xl_topologyinfo"
+	external get : unit -> t array = "stub_xl_topologyinfo"
 end
 
 
diff -r f12ea2dbd328 -r bff9e4b818b9 tools/ocaml/libs/xl/xenlight.mli.in
--- a/tools/ocaml/libs/xl/xenlight.mli.in	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight.mli.in	Tue Jan 31 16:34:39 2012 +0000
@@ -26,7 +26,7 @@
 		socket : int;
 		node : int;
 	}
-	external get : unit -> t = "stub_xl_topologyinfo"
+	external get : unit -> t array = "stub_xl_topologyinfo"
 end
 
 external send_trigger : domid -> trigger -> int -> unit = "stub_xl_send_trigger"

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:44 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9Y-0008FB-67; Fri, 03 Feb 2012 21:58:44 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9X-00089d-2k
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:43 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-174.messagelabs.com!1328306315!11933645!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24724 invoked from network); 3 Feb 2012 21:58:36 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:36 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9P-0001pS-JH
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:35 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9P-0003Cs-4R
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:35 +0000
Message-Id: <E1RtR9P-0003Cs-4R@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:34 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] ocaml: Topology.get returns an array
	not a single element.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027679 0
# Node ID bff9e4b818b97d6282b8d427e43ffb194ac7f593
# Parent  f12ea2dbd328b1e8e57366a941bf33f0fb6a7fac
ocaml: Topology.get returns an array not a single element.

The stub implementation appears to already be correct.

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


diff -r f12ea2dbd328 -r bff9e4b818b9 tools/ocaml/libs/xl/xenlight.ml.in
--- a/tools/ocaml/libs/xl/xenlight.ml.in	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight.ml.in	Tue Jan 31 16:34:39 2012 +0000
@@ -26,7 +26,7 @@
 		socket : int;
 		node : int;
 	}
-	external get : unit -> t = "stub_xl_topologyinfo"
+	external get : unit -> t array = "stub_xl_topologyinfo"
 end
 
 
diff -r f12ea2dbd328 -r bff9e4b818b9 tools/ocaml/libs/xl/xenlight.mli.in
--- a/tools/ocaml/libs/xl/xenlight.mli.in	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight.mli.in	Tue Jan 31 16:34:39 2012 +0000
@@ -26,7 +26,7 @@
 		socket : int;
 		node : int;
 	}
-	external get : unit -> t = "stub_xl_topologyinfo"
+	external get : unit -> t array = "stub_xl_topologyinfo"
 end
 
 external send_trigger : domid -> trigger -> int -> unit = "stub_xl_send_trigger"

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:48 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9c-0008IH-9R; Fri, 03 Feb 2012 21:58:48 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9a-0008Cq-U9
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:47 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-174.messagelabs.com!1328306318!7715964!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26649 invoked from network); 3 Feb 2012 21:58:39 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:39 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9S-0001pZ-G7
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:38 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9Q-0003DN-54
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:38 +0000
Message-Id: <E1RtR9Q-0003DN-54@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:35 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: expose cpu topology as a
	single list of cpu->{node, core, socket} maps.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027679 0
# Node ID 1d8f40029ddb87c511d0237ab7ae9d4d117ea6cf
# Parent  bff9e4b818b97d6282b8d427e43ffb194ac7f593
libxl: expose cpu topology as a single list of cpu->{node,core,socket} maps.

Rather than the previous tripple list which is more complicated to work with
and harder for language bindings.

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


diff -r bff9e4b818b9 -r 1d8f40029ddb tools/libxl/gentest.py
--- a/tools/libxl/gentest.py	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/gentest.py	Tue Jan 31 16:34:39 2012 +0000
@@ -195,6 +195,7 @@
     *p = l;
 }
 
+#if 0 /* To be remove in a subsequent patch */
 static void libxl_cpuarray_rand_init(libxl_cpuarray *p)
 {
     int i;
@@ -209,6 +210,7 @@
             p->array[i] = r;
     }
 }
+#endif
 """)
     for ty in builtins + types:
         if ty.typename not in handcoded:
diff -r bff9e4b818b9 -r 1d8f40029ddb tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Jan 31 16:34:39 2012 +0000
@@ -2755,57 +2755,68 @@
     return 0;
 }
 
-int libxl_get_topologyinfo(libxl_ctx *ctx, libxl_topologyinfo *info)
+libxl_cputopology *libxl_get_cpu_topology(libxl_ctx *ctx, int *nr)
 {
     xc_topologyinfo_t tinfo;
     DECLARE_HYPERCALL_BUFFER(xc_cpu_to_core_t, coremap);
     DECLARE_HYPERCALL_BUFFER(xc_cpu_to_socket_t, socketmap);
     DECLARE_HYPERCALL_BUFFER(xc_cpu_to_node_t, nodemap);
+    libxl_cputopology *ret = NULL;
     int i;
-    int rc = 0;
-
-    rc += libxl_cpuarray_alloc(ctx, &info->coremap);
-    rc += libxl_cpuarray_alloc(ctx, &info->socketmap);
-    rc += libxl_cpuarray_alloc(ctx, &info->nodemap);
-    if (rc)
+    int max_cpus;
+
+    max_cpus = libxl_get_max_cpus(ctx);
+    if (max_cpus == 0)
+    {
+        LIBXL__LOG(ctx, XTL_ERROR, "Unable to determine number of CPUS");
+        return NULL;
+    }
+
+    coremap = xc_hypercall_buffer_alloc
+        (ctx->xch, coremap, sizeof(*coremap) * max_cpus);
+    socketmap = xc_hypercall_buffer_alloc
+        (ctx->xch, socketmap, sizeof(*socketmap) * max_cpus);
+    nodemap = xc_hypercall_buffer_alloc
+        (ctx->xch, nodemap, sizeof(*nodemap) * max_cpus);
+    if ((coremap == NULL) || (socketmap == NULL) || (nodemap == NULL)) {
+        LIBXL__LOG_ERRNOVAL(ctx, XTL_ERROR, ENOMEM,
+                            "Unable to allocate hypercall arguments");
         goto fail;
-
-    coremap = xc_hypercall_buffer_alloc(ctx->xch, coremap, sizeof(*coremap) * info->coremap.entries);
-    socketmap = xc_hypercall_buffer_alloc(ctx->xch, socketmap, sizeof(*socketmap) * info->socketmap.entries);
-    nodemap = xc_hypercall_buffer_alloc(ctx->xch, nodemap, sizeof(*nodemap) * info->nodemap.entries);
-    if ((coremap == NULL) || (socketmap == NULL) || (nodemap == NULL))
-        goto fail;
+    }
 
     set_xen_guest_handle(tinfo.cpu_to_core, coremap);
     set_xen_guest_handle(tinfo.cpu_to_socket, socketmap);
     set_xen_guest_handle(tinfo.cpu_to_node, nodemap);
-    tinfo.max_cpu_index = info->coremap.entries - 1;
-    if (xc_topologyinfo(ctx->xch, &tinfo) != 0)
+    tinfo.max_cpu_index = max_cpus - 1;
+    if (xc_topologyinfo(ctx->xch, &tinfo) != 0) {
+        LIBXL__LOG_ERRNO(ctx, XTL_ERROR, "Topology info hypercall failed");
         goto fail;
-
-    for (i = 0; i <= tinfo.max_cpu_index; i++) {
-        if (i < info->coremap.entries)
-            info->coremap.array[i] = (coremap[i] == INVALID_TOPOLOGY_ID) ?
-                LIBXL_CPUARRAY_INVALID_ENTRY : coremap[i];
-        if (i < info->socketmap.entries)
-            info->socketmap.array[i] = (socketmap[i] == INVALID_TOPOLOGY_ID) ?
-                LIBXL_CPUARRAY_INVALID_ENTRY : socketmap[i];
-        if (i < info->nodemap.entries)
-            info->nodemap.array[i] = (nodemap[i] == INVALID_TOPOLOGY_ID) ?
-                LIBXL_CPUARRAY_INVALID_ENTRY : nodemap[i];
     }
 
-    xc_hypercall_buffer_free(ctx->xch, coremap);
-    xc_hypercall_buffer_free(ctx->xch, socketmap);
-    xc_hypercall_buffer_free(ctx->xch, nodemap);
-    return 0;
+    ret = malloc(sizeof(libxl_cputopology) * max_cpus);
+    if (ret == NULL) {
+        LIBXL__LOG_ERRNOVAL(ctx, XTL_ERROR, ENOMEM,
+                            "Unable to allocate return value");
+        goto fail;
+    }
+
+    for (i = 0; i <= max_cpus; i++) {
+#define V(map, i) (map[i] == INVALID_TOPOLOGY_ID) ? \
+    LIBXL_CPUTOPOLOGY_INVALID_ENTRY : map[i]
+        ret[i].core = V(coremap, i);
+        ret[i].socket = V(socketmap, i);
+        ret[i].node = V(nodemap, i);
+#undef V
+    }
 
 fail:
     xc_hypercall_buffer_free(ctx->xch, coremap);
     xc_hypercall_buffer_free(ctx->xch, socketmap);
     xc_hypercall_buffer_free(ctx->xch, nodemap);
-    libxl_topologyinfo_dispose(info);
-    return ERROR_FAIL;
+
+    if (ret)
+        *nr = max_cpus;
+    return ret;
 }
 
 const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
@@ -3604,30 +3615,30 @@
 int libxl_cpupool_cpuadd_node(libxl_ctx *ctx, uint32_t poolid, int node, int *cpus)
 {
     int rc = 0;
-    int cpu;
+    int cpu, nr;
     libxl_cpumap freemap;
-    libxl_topologyinfo topology;
+    libxl_cputopology *topology;
 
     if (libxl_get_freecpus(ctx, &freemap)) {
         return ERROR_FAIL;
     }
 
-    if (libxl_get_topologyinfo(ctx, &topology)) {
+    topology = libxl_get_cpu_topology(ctx, &nr);
+    if (!topology) {
         rc = ERROR_FAIL;
         goto out;
     }
 
     *cpus = 0;
-    for (cpu = 0; cpu < topology.nodemap.entries; cpu++) {
-        if (libxl_cpumap_test(&freemap, cpu) &&
-            (topology.nodemap.array[cpu] == node) &&
+    for (cpu = 0; cpu < nr; cpu++) {
+        if (libxl_cpumap_test(&freemap, cpu) && (topology[cpu].node == node) &&
             !libxl_cpupool_cpuadd(ctx, poolid, cpu)) {
                 (*cpus)++;
         }
+        libxl_cputopology_dispose(&topology[cpu]);
     }
 
-    libxl_topologyinfo_dispose(&topology);
-
+    free(topology);
 out:
     libxl_cpumap_dispose(&freemap);
     return rc;
@@ -3651,8 +3662,8 @@
     int ret = 0;
     int n_pools;
     int p;
-    int cpu;
-    libxl_topologyinfo topology;
+    int cpu, nr_cpus;
+    libxl_cputopology *topology;
     libxl_cpupoolinfo *poolinfo;
 
     poolinfo = libxl_list_cpupool(ctx, &n_pools);
@@ -3660,7 +3671,8 @@
         return ERROR_NOMEM;
     }
 
-    if (libxl_get_topologyinfo(ctx, &topology)) {
+    topology = libxl_get_cpu_topology(ctx, &nr_cpus);
+    if (!topology) {
         ret = ERROR_FAIL;
         goto out;
     }
@@ -3668,8 +3680,8 @@
     *cpus = 0;
     for (p = 0; p < n_pools; p++) {
         if (poolinfo[p].poolid == poolid) {
-            for (cpu = 0; cpu < topology.nodemap.entries; cpu++) {
-                if ((topology.nodemap.array[cpu] == node) &&
+            for (cpu = 0; cpu < nr_cpus; cpu++) {
+                if ((topology[cpu].node == node) &&
                     libxl_cpumap_test(&poolinfo[p].cpumap, cpu) &&
                     !libxl_cpupool_cpuremove(ctx, poolid, cpu)) {
                         (*cpus)++;
@@ -3678,7 +3690,9 @@
         }
     }
 
-    libxl_topologyinfo_dispose(&topology);
+    for (cpu = 0; cpu < nr_cpus; cpu++)
+        libxl_cputopology_dispose(&topology[cpu]);
+    free(topology);
 
 out:
     for (p = 0; p < n_pools; p++) {
diff -r bff9e4b818b9 -r 1d8f40029ddb tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl.h	Tue Jan 31 16:34:39 2012 +0000
@@ -576,7 +576,9 @@
    */
 
 int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo);
-int libxl_get_topologyinfo(libxl_ctx *ctx, libxl_topologyinfo *info);
+#define LIBXL_CPUTOPOLOGY_INVALID_ENTRY (~(uint32_t)0)
+libxl_cputopology *libxl_get_cpu_topology(libxl_ctx *ctx, int *nr);
+void libxl_cputopology_list_free(libxl_cputopology *, int nr);
 libxl_vcpuinfo *libxl_list_vcpu(libxl_ctx *ctx, uint32_t domid,
                                        int *nb_vcpu, int *nrcpus);
 int libxl_set_vcpuaffinity(libxl_ctx *ctx, uint32_t domid, uint32_t vcpuid,
diff -r bff9e4b818b9 -r 1d8f40029ddb tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:39 2012 +0000
@@ -376,10 +376,10 @@
     ("phys_cap", uint32),
     ], dispose_fn=None, dir=DIR_OUT)
 
-libxl_topologyinfo = Struct("topologyinfo", [
-    ("coremap", libxl_cpuarray),   # cpu to core map
-    ("socketmap", libxl_cpuarray), # cpu to socket map
-    ("nodemap", libxl_cpuarray),   # cpu to node map
+libxl_cputopology = Struct("cputopology", [
+    ("core", uint32),
+    ("socket", uint32),
+    ("node", uint32),
     ])
 
 libxl_sched_credit = Struct("sched_credit", [
diff -r bff9e4b818b9 -r 1d8f40029ddb tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl_utils.c	Tue Jan 31 16:34:39 2012 +0000
@@ -557,6 +557,14 @@
     return ERROR_FAIL;
 }
 
+void libxl_cputopology_list_free(libxl_cputopology *list, int nr)
+{
+    int i;
+    for (i = 0; i < nr; i++)
+        libxl_cputopology_dispose(&list[i]);
+    free(list);
+}
+
 /*
  * Local variables:
  * mode: C
diff -r bff9e4b818b9 -r 1d8f40029ddb tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 16:34:39 2012 +0000
@@ -3833,10 +3833,11 @@
 
 static void output_topologyinfo(void)
 {
-    libxl_topologyinfo info;
-    int i;
-
-    if (libxl_get_topologyinfo(ctx, &info)) {
+    libxl_cputopology *info;
+    int i, nr;
+
+    info = libxl_get_cpu_topology(ctx, &nr);
+    if (info == NULL) {
         fprintf(stderr, "libxl_get_topologyinfo failed.\n");
         return;
     }
@@ -3844,16 +3845,16 @@
     printf("cpu_topology           :\n");
     printf("cpu:    core    socket     node\n");
 
-    for (i = 0; i < info.coremap.entries; i++) {
-        if (info.coremap.array[i] != LIBXL_CPUARRAY_INVALID_ENTRY)
-            printf("%3d:    %4d     %4d     %4d\n", i, info.coremap.array[i],
-                info.socketmap.array[i], info.nodemap.array[i]);
-    }
+    for (i = 0; i < nr; i++) {
+        if (info[i].core != LIBXL_CPUTOPOLOGY_INVALID_ENTRY)
+            printf("%3d:    %4d     %4d     %4d\n", i,
+                   info[i].core, info[i].socket, info[i].node);
+    }
+
+    libxl_cputopology_list_free(info, nr);
 
     printf("numa_info              : none\n");
 
-    libxl_topologyinfo_dispose(&info);
-
     return;
 }
 
@@ -5350,7 +5351,7 @@
     libxl_cpumap freemap;
     libxl_cpumap cpumap;
     libxl_uuid uuid;
-    libxl_topologyinfo topology;
+    libxl_cputopology *topology;
 
     while (1) {
         opt = getopt_long(argc, argv, "hnf:", long_options, &option_index);
@@ -5459,16 +5460,18 @@
         return -ERROR_FAIL;
     }
     if (!xlu_cfg_get_list(config, "nodes", &nodes, 0, 0)) {
+        int nr;
         n_cpus = 0;
         n_nodes = 0;
-        if (libxl_get_topologyinfo(ctx, &topology)) {
+        topology = libxl_get_cpu_topology(ctx, &nr);
+        if (topology == NULL) {
             fprintf(stderr, "libxl_get_topologyinfo failed\n");
             return -ERROR_FAIL;
         }
         while ((buf = xlu_cfg_get_listitem(nodes, n_nodes)) != NULL) {
             n = atoi(buf);
-            for (i = 0; i < topology.nodemap.entries; i++) {
-                if ((topology.nodemap.array[i] == n) &&
+            for (i = 0; i < nr; i++) {
+                if ((topology[i].node == n) &&
                     libxl_cpumap_test(&freemap, i)) {
                     libxl_cpumap_set(&cpumap, i);
                     n_cpus++;
@@ -5477,7 +5480,7 @@
             n_nodes++;
         }
 
-        libxl_topologyinfo_dispose(&topology);
+        libxl_cputopology_list_free(topology, nr);
 
         if (n_cpus == 0) {
             fprintf(stderr, "no free cpu found\n");
@@ -5799,11 +5802,12 @@
     int schedid;
     int n_pools;
     int node;
+    int n_cpus;
     char name[16];
     libxl_uuid uuid;
     libxl_cpumap cpumap;
     libxl_cpupoolinfo *poolinfo;
-    libxl_topologyinfo topology;
+    libxl_cputopology *topology;
     libxl_dominfo info;
 
     if ((opt = def_getopt(argc, argv, "", "cpupool-numa-split", 0)) != -1)
@@ -5825,21 +5829,22 @@
         return -ERROR_FAIL;
     }
 
-    if (libxl_get_topologyinfo(ctx, &topology)) {
+    topology = libxl_get_cpu_topology(ctx, &n_cpus);
+    if (topology == NULL) {
         fprintf(stderr, "libxl_get_topologyinfo failed\n");
         return -ERROR_FAIL;
     }
 
     if (libxl_cpumap_alloc(ctx, &cpumap)) {
         fprintf(stderr, "Failed to allocate cpumap\n");
-        libxl_topologyinfo_dispose(&topology);
+        libxl_cputopology_list_free(topology, n_cpus);
         return -ERROR_FAIL;
     }
 
     /* Reset Pool-0 to 1st node: first add cpus, then remove cpus to avoid
        a cpupool without cpus in between */
 
-    node = topology.nodemap.array[0];
+    node = topology[0].node;
     if (libxl_cpupool_cpuadd_node(ctx, 0, node, &n)) {
         fprintf(stderr, "error on adding cpu to Pool 0\n");
         return -ERROR_FAIL;
@@ -5853,9 +5858,9 @@
     }
 
     n = 0;
-    for (c = 0; c < topology.nodemap.entries; c++) {
-        if (topology.nodemap.array[c] == node) {
-            topology.nodemap.array[c] = LIBXL_CPUARRAY_INVALID_ENTRY;
+    for (c = 0; c < n_cpus; c++) {
+        if (topology[c].node == node) {
+            topology[c].node = LIBXL_CPUTOPOLOGY_INVALID_ENTRY;
             libxl_cpumap_set(&cpumap, n);
             n++;
         }
@@ -5880,12 +5885,12 @@
     }
     memset(cpumap.map, 0, cpumap.size);
 
-    for (c = 0; c < topology.nodemap.entries; c++) {
-        if (topology.nodemap.array[c] == LIBXL_CPUARRAY_INVALID_ENTRY) {
+    for (c = 0; c < n_cpus; c++) {
+        if (topology[c].node == LIBXL_CPUTOPOLOGY_INVALID_ENTRY) {
             continue;
         }
 
-        node = topology.nodemap.array[c];
+        node = topology[c].node;
         ret = -libxl_cpupool_cpuremove_node(ctx, 0, node, &n);
         if (ret) {
             fprintf(stderr, "error on removing cpu from Pool 0\n");
@@ -5907,15 +5912,15 @@
             goto out;
         }
 
-        for (p = c; p < topology.nodemap.entries; p++) {
-            if (topology.nodemap.array[p] == node) {
-                topology.nodemap.array[p] = LIBXL_CPUARRAY_INVALID_ENTRY;
+        for (p = c; p < n_cpus; p++) {
+            if (topology[p].node == node) {
+                topology[p].node = LIBXL_CPUTOPOLOGY_INVALID_ENTRY;
             }
         }
     }
 
 out:
-    libxl_topologyinfo_dispose(&topology);
+    libxl_cputopology_list_free(topology, n_cpus);
     libxl_cpumap_dispose(&cpumap);
 
     return ret;
diff -r bff9e4b818b9 -r 1d8f40029ddb tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/ocaml/libs/xl/genwrap.py	Tue Jan 31 16:34:39 2012 +0000
@@ -29,6 +29,8 @@
     "device_pci":     DEVICE_FUNCTIONS,
     "physinfo":       [ ("get",            ["unit", "t"]),
                       ],
+    "cputopology":    [ ("get",            ["unit", "t array"]),
+                      ],
     "sched_credit":   [ ("domain_get",     ["domid", "t"]),
                         ("domain_set",     ["domid", "t", "unit"]),
                       ],
@@ -266,7 +268,6 @@
         "domain_create_info",
         "domain_build_info",
         "vcpuinfo",
-        "topologyinfo",
         "event",
         ]
 
diff -r bff9e4b818b9 -r 1d8f40029ddb tools/ocaml/libs/xl/xenlight.ml.in
--- a/tools/ocaml/libs/xl/xenlight.ml.in	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight.ml.in	Tue Jan 31 16:34:39 2012 +0000
@@ -19,17 +19,6 @@
 
 (* @@LIBXL_TYPES@@ *)
 
-module Topologyinfo = struct
-	type t =
-	{
-		core : int;
-		socket : int;
-		node : int;
-	}
-	external get : unit -> t array = "stub_xl_topologyinfo"
-end
-
-
 external send_trigger : domid -> trigger -> int -> unit = "stub_xl_send_trigger"
 external send_sysrq : domid -> char -> unit = "stub_xl_send_sysrq"
 external send_debug_keys : domid -> string -> unit = "stub_xl_send_debug_keys"
diff -r bff9e4b818b9 -r 1d8f40029ddb tools/ocaml/libs/xl/xenlight.mli.in
--- a/tools/ocaml/libs/xl/xenlight.mli.in	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight.mli.in	Tue Jan 31 16:34:39 2012 +0000
@@ -19,16 +19,6 @@
 
 (* @@LIBXL_TYPES@@ *)
 
-module Topologyinfo : sig
-	type t =
-	{
-		core : int;
-		socket : int;
-		node : int;
-	}
-	external get : unit -> t array = "stub_xl_topologyinfo"
-end
-
 external send_trigger : domid -> trigger -> int -> unit = "stub_xl_send_trigger"
 external send_sysrq : domid -> char -> unit = "stub_xl_send_sysrq"
 external send_debug_keys : domid -> string -> unit = "stub_xl_send_debug_keys"
diff -r bff9e4b818b9 -r 1d8f40029ddb tools/ocaml/libs/xl/xenlight_stubs.c
--- a/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Jan 31 16:34:39 2012 +0000
@@ -210,28 +210,6 @@
 
 #include "_libxl_types.inc"
 
-static value Val_topologyinfo(libxl_topologyinfo *c_val)
-{
-	CAMLparam0();
-	CAMLlocal3(v, topology, topologyinfo);
-	int i;
-
-	topologyinfo = caml_alloc_tuple(c_val->coremap.entries);
-	for (i = 0; i < c_val->coremap.entries; i++) {
-		v = Val_none;
-		if (c_val->coremap.array[i] != LIBXL_CPUARRAY_INVALID_ENTRY) {
-			topology = caml_alloc_tuple(3);
-			Store_field(topology, 0, Val_int(c_val->coremap.array[i]));
-			Store_field(topology, 1, Val_int(c_val->socketmap.array[i]));
-			Store_field(topology, 2, Val_int(c_val->nodemap.array[i]));
-			v = Val_some(topology);
-		}
-		Store_field(topologyinfo, i, v);
-	}
-
-	CAMLreturn(topologyinfo);
-}
-
 value stub_xl_device_disk_add(value info, value domid)
 {
 	CAMLparam2(info, domid);
@@ -462,22 +440,33 @@
 	CAMLreturn(physinfo);
 }
 
-value stub_xl_topologyinfo(value unit)
+value stub_xl_cputopology_get(value unit)
 {
 	CAMLparam1(unit);
-	CAMLlocal1(topologyinfo);
-	libxl_topologyinfo c_topologyinfo;
-	int ret;
+	CAMLlocal2(topology, v);
+	libxl_cputopology *c_topology;
+	int i, nr, ret;
 	INIT_STRUCT();
 
 	INIT_CTX();
-	ret = libxl_get_topologyinfo(ctx, &c_topologyinfo);
+
+	c_topology = libxl_get_cpu_topology(ctx, &nr);
 	if (ret != 0)
 		failwith_xl("topologyinfo", &lg);
+
+	topology = caml_alloc_tuple(nr);
+	for (i = 0; i < nr; i++) {
+		if (c_topology[i].core != LIBXL_CPUTOPOLOGY_INVALID_ENTRY)
+			v = Val_some(Val_cputopology(&gc, &lg, &c_topology[i]));
+		else
+			v = Val_none;
+		Store_field(topology, i, v);
+	}
+
+	libxl_cputopology_list_free(c_topology, nr);
+
 	FREE_CTX();
-
-	topologyinfo = Val_topologyinfo(&c_topologyinfo);
-	CAMLreturn(topologyinfo);
+	CAMLreturn(topology);
 }
 
 value stub_xl_sched_credit_domain_get(value domid)

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:48 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9c-0008IH-9R; Fri, 03 Feb 2012 21:58:48 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9a-0008Cq-U9
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:47 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-174.messagelabs.com!1328306318!7715964!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26649 invoked from network); 3 Feb 2012 21:58:39 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:39 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9S-0001pZ-G7
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:38 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9Q-0003DN-54
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:38 +0000
Message-Id: <E1RtR9Q-0003DN-54@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:35 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: expose cpu topology as a
	single list of cpu->{node, core, socket} maps.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027679 0
# Node ID 1d8f40029ddb87c511d0237ab7ae9d4d117ea6cf
# Parent  bff9e4b818b97d6282b8d427e43ffb194ac7f593
libxl: expose cpu topology as a single list of cpu->{node,core,socket} maps.

Rather than the previous tripple list which is more complicated to work with
and harder for language bindings.

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


diff -r bff9e4b818b9 -r 1d8f40029ddb tools/libxl/gentest.py
--- a/tools/libxl/gentest.py	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/gentest.py	Tue Jan 31 16:34:39 2012 +0000
@@ -195,6 +195,7 @@
     *p = l;
 }
 
+#if 0 /* To be remove in a subsequent patch */
 static void libxl_cpuarray_rand_init(libxl_cpuarray *p)
 {
     int i;
@@ -209,6 +210,7 @@
             p->array[i] = r;
     }
 }
+#endif
 """)
     for ty in builtins + types:
         if ty.typename not in handcoded:
diff -r bff9e4b818b9 -r 1d8f40029ddb tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Jan 31 16:34:39 2012 +0000
@@ -2755,57 +2755,68 @@
     return 0;
 }
 
-int libxl_get_topologyinfo(libxl_ctx *ctx, libxl_topologyinfo *info)
+libxl_cputopology *libxl_get_cpu_topology(libxl_ctx *ctx, int *nr)
 {
     xc_topologyinfo_t tinfo;
     DECLARE_HYPERCALL_BUFFER(xc_cpu_to_core_t, coremap);
     DECLARE_HYPERCALL_BUFFER(xc_cpu_to_socket_t, socketmap);
     DECLARE_HYPERCALL_BUFFER(xc_cpu_to_node_t, nodemap);
+    libxl_cputopology *ret = NULL;
     int i;
-    int rc = 0;
-
-    rc += libxl_cpuarray_alloc(ctx, &info->coremap);
-    rc += libxl_cpuarray_alloc(ctx, &info->socketmap);
-    rc += libxl_cpuarray_alloc(ctx, &info->nodemap);
-    if (rc)
+    int max_cpus;
+
+    max_cpus = libxl_get_max_cpus(ctx);
+    if (max_cpus == 0)
+    {
+        LIBXL__LOG(ctx, XTL_ERROR, "Unable to determine number of CPUS");
+        return NULL;
+    }
+
+    coremap = xc_hypercall_buffer_alloc
+        (ctx->xch, coremap, sizeof(*coremap) * max_cpus);
+    socketmap = xc_hypercall_buffer_alloc
+        (ctx->xch, socketmap, sizeof(*socketmap) * max_cpus);
+    nodemap = xc_hypercall_buffer_alloc
+        (ctx->xch, nodemap, sizeof(*nodemap) * max_cpus);
+    if ((coremap == NULL) || (socketmap == NULL) || (nodemap == NULL)) {
+        LIBXL__LOG_ERRNOVAL(ctx, XTL_ERROR, ENOMEM,
+                            "Unable to allocate hypercall arguments");
         goto fail;
-
-    coremap = xc_hypercall_buffer_alloc(ctx->xch, coremap, sizeof(*coremap) * info->coremap.entries);
-    socketmap = xc_hypercall_buffer_alloc(ctx->xch, socketmap, sizeof(*socketmap) * info->socketmap.entries);
-    nodemap = xc_hypercall_buffer_alloc(ctx->xch, nodemap, sizeof(*nodemap) * info->nodemap.entries);
-    if ((coremap == NULL) || (socketmap == NULL) || (nodemap == NULL))
-        goto fail;
+    }
 
     set_xen_guest_handle(tinfo.cpu_to_core, coremap);
     set_xen_guest_handle(tinfo.cpu_to_socket, socketmap);
     set_xen_guest_handle(tinfo.cpu_to_node, nodemap);
-    tinfo.max_cpu_index = info->coremap.entries - 1;
-    if (xc_topologyinfo(ctx->xch, &tinfo) != 0)
+    tinfo.max_cpu_index = max_cpus - 1;
+    if (xc_topologyinfo(ctx->xch, &tinfo) != 0) {
+        LIBXL__LOG_ERRNO(ctx, XTL_ERROR, "Topology info hypercall failed");
         goto fail;
-
-    for (i = 0; i <= tinfo.max_cpu_index; i++) {
-        if (i < info->coremap.entries)
-            info->coremap.array[i] = (coremap[i] == INVALID_TOPOLOGY_ID) ?
-                LIBXL_CPUARRAY_INVALID_ENTRY : coremap[i];
-        if (i < info->socketmap.entries)
-            info->socketmap.array[i] = (socketmap[i] == INVALID_TOPOLOGY_ID) ?
-                LIBXL_CPUARRAY_INVALID_ENTRY : socketmap[i];
-        if (i < info->nodemap.entries)
-            info->nodemap.array[i] = (nodemap[i] == INVALID_TOPOLOGY_ID) ?
-                LIBXL_CPUARRAY_INVALID_ENTRY : nodemap[i];
     }
 
-    xc_hypercall_buffer_free(ctx->xch, coremap);
-    xc_hypercall_buffer_free(ctx->xch, socketmap);
-    xc_hypercall_buffer_free(ctx->xch, nodemap);
-    return 0;
+    ret = malloc(sizeof(libxl_cputopology) * max_cpus);
+    if (ret == NULL) {
+        LIBXL__LOG_ERRNOVAL(ctx, XTL_ERROR, ENOMEM,
+                            "Unable to allocate return value");
+        goto fail;
+    }
+
+    for (i = 0; i <= max_cpus; i++) {
+#define V(map, i) (map[i] == INVALID_TOPOLOGY_ID) ? \
+    LIBXL_CPUTOPOLOGY_INVALID_ENTRY : map[i]
+        ret[i].core = V(coremap, i);
+        ret[i].socket = V(socketmap, i);
+        ret[i].node = V(nodemap, i);
+#undef V
+    }
 
 fail:
     xc_hypercall_buffer_free(ctx->xch, coremap);
     xc_hypercall_buffer_free(ctx->xch, socketmap);
     xc_hypercall_buffer_free(ctx->xch, nodemap);
-    libxl_topologyinfo_dispose(info);
-    return ERROR_FAIL;
+
+    if (ret)
+        *nr = max_cpus;
+    return ret;
 }
 
 const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
@@ -3604,30 +3615,30 @@
 int libxl_cpupool_cpuadd_node(libxl_ctx *ctx, uint32_t poolid, int node, int *cpus)
 {
     int rc = 0;
-    int cpu;
+    int cpu, nr;
     libxl_cpumap freemap;
-    libxl_topologyinfo topology;
+    libxl_cputopology *topology;
 
     if (libxl_get_freecpus(ctx, &freemap)) {
         return ERROR_FAIL;
     }
 
-    if (libxl_get_topologyinfo(ctx, &topology)) {
+    topology = libxl_get_cpu_topology(ctx, &nr);
+    if (!topology) {
         rc = ERROR_FAIL;
         goto out;
     }
 
     *cpus = 0;
-    for (cpu = 0; cpu < topology.nodemap.entries; cpu++) {
-        if (libxl_cpumap_test(&freemap, cpu) &&
-            (topology.nodemap.array[cpu] == node) &&
+    for (cpu = 0; cpu < nr; cpu++) {
+        if (libxl_cpumap_test(&freemap, cpu) && (topology[cpu].node == node) &&
             !libxl_cpupool_cpuadd(ctx, poolid, cpu)) {
                 (*cpus)++;
         }
+        libxl_cputopology_dispose(&topology[cpu]);
     }
 
-    libxl_topologyinfo_dispose(&topology);
-
+    free(topology);
 out:
     libxl_cpumap_dispose(&freemap);
     return rc;
@@ -3651,8 +3662,8 @@
     int ret = 0;
     int n_pools;
     int p;
-    int cpu;
-    libxl_topologyinfo topology;
+    int cpu, nr_cpus;
+    libxl_cputopology *topology;
     libxl_cpupoolinfo *poolinfo;
 
     poolinfo = libxl_list_cpupool(ctx, &n_pools);
@@ -3660,7 +3671,8 @@
         return ERROR_NOMEM;
     }
 
-    if (libxl_get_topologyinfo(ctx, &topology)) {
+    topology = libxl_get_cpu_topology(ctx, &nr_cpus);
+    if (!topology) {
         ret = ERROR_FAIL;
         goto out;
     }
@@ -3668,8 +3680,8 @@
     *cpus = 0;
     for (p = 0; p < n_pools; p++) {
         if (poolinfo[p].poolid == poolid) {
-            for (cpu = 0; cpu < topology.nodemap.entries; cpu++) {
-                if ((topology.nodemap.array[cpu] == node) &&
+            for (cpu = 0; cpu < nr_cpus; cpu++) {
+                if ((topology[cpu].node == node) &&
                     libxl_cpumap_test(&poolinfo[p].cpumap, cpu) &&
                     !libxl_cpupool_cpuremove(ctx, poolid, cpu)) {
                         (*cpus)++;
@@ -3678,7 +3690,9 @@
         }
     }
 
-    libxl_topologyinfo_dispose(&topology);
+    for (cpu = 0; cpu < nr_cpus; cpu++)
+        libxl_cputopology_dispose(&topology[cpu]);
+    free(topology);
 
 out:
     for (p = 0; p < n_pools; p++) {
diff -r bff9e4b818b9 -r 1d8f40029ddb tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl.h	Tue Jan 31 16:34:39 2012 +0000
@@ -576,7 +576,9 @@
    */
 
 int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo);
-int libxl_get_topologyinfo(libxl_ctx *ctx, libxl_topologyinfo *info);
+#define LIBXL_CPUTOPOLOGY_INVALID_ENTRY (~(uint32_t)0)
+libxl_cputopology *libxl_get_cpu_topology(libxl_ctx *ctx, int *nr);
+void libxl_cputopology_list_free(libxl_cputopology *, int nr);
 libxl_vcpuinfo *libxl_list_vcpu(libxl_ctx *ctx, uint32_t domid,
                                        int *nb_vcpu, int *nrcpus);
 int libxl_set_vcpuaffinity(libxl_ctx *ctx, uint32_t domid, uint32_t vcpuid,
diff -r bff9e4b818b9 -r 1d8f40029ddb tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:39 2012 +0000
@@ -376,10 +376,10 @@
     ("phys_cap", uint32),
     ], dispose_fn=None, dir=DIR_OUT)
 
-libxl_topologyinfo = Struct("topologyinfo", [
-    ("coremap", libxl_cpuarray),   # cpu to core map
-    ("socketmap", libxl_cpuarray), # cpu to socket map
-    ("nodemap", libxl_cpuarray),   # cpu to node map
+libxl_cputopology = Struct("cputopology", [
+    ("core", uint32),
+    ("socket", uint32),
+    ("node", uint32),
     ])
 
 libxl_sched_credit = Struct("sched_credit", [
diff -r bff9e4b818b9 -r 1d8f40029ddb tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl_utils.c	Tue Jan 31 16:34:39 2012 +0000
@@ -557,6 +557,14 @@
     return ERROR_FAIL;
 }
 
+void libxl_cputopology_list_free(libxl_cputopology *list, int nr)
+{
+    int i;
+    for (i = 0; i < nr; i++)
+        libxl_cputopology_dispose(&list[i]);
+    free(list);
+}
+
 /*
  * Local variables:
  * mode: C
diff -r bff9e4b818b9 -r 1d8f40029ddb tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 16:34:39 2012 +0000
@@ -3833,10 +3833,11 @@
 
 static void output_topologyinfo(void)
 {
-    libxl_topologyinfo info;
-    int i;
-
-    if (libxl_get_topologyinfo(ctx, &info)) {
+    libxl_cputopology *info;
+    int i, nr;
+
+    info = libxl_get_cpu_topology(ctx, &nr);
+    if (info == NULL) {
         fprintf(stderr, "libxl_get_topologyinfo failed.\n");
         return;
     }
@@ -3844,16 +3845,16 @@
     printf("cpu_topology           :\n");
     printf("cpu:    core    socket     node\n");
 
-    for (i = 0; i < info.coremap.entries; i++) {
-        if (info.coremap.array[i] != LIBXL_CPUARRAY_INVALID_ENTRY)
-            printf("%3d:    %4d     %4d     %4d\n", i, info.coremap.array[i],
-                info.socketmap.array[i], info.nodemap.array[i]);
-    }
+    for (i = 0; i < nr; i++) {
+        if (info[i].core != LIBXL_CPUTOPOLOGY_INVALID_ENTRY)
+            printf("%3d:    %4d     %4d     %4d\n", i,
+                   info[i].core, info[i].socket, info[i].node);
+    }
+
+    libxl_cputopology_list_free(info, nr);
 
     printf("numa_info              : none\n");
 
-    libxl_topologyinfo_dispose(&info);
-
     return;
 }
 
@@ -5350,7 +5351,7 @@
     libxl_cpumap freemap;
     libxl_cpumap cpumap;
     libxl_uuid uuid;
-    libxl_topologyinfo topology;
+    libxl_cputopology *topology;
 
     while (1) {
         opt = getopt_long(argc, argv, "hnf:", long_options, &option_index);
@@ -5459,16 +5460,18 @@
         return -ERROR_FAIL;
     }
     if (!xlu_cfg_get_list(config, "nodes", &nodes, 0, 0)) {
+        int nr;
         n_cpus = 0;
         n_nodes = 0;
-        if (libxl_get_topologyinfo(ctx, &topology)) {
+        topology = libxl_get_cpu_topology(ctx, &nr);
+        if (topology == NULL) {
             fprintf(stderr, "libxl_get_topologyinfo failed\n");
             return -ERROR_FAIL;
         }
         while ((buf = xlu_cfg_get_listitem(nodes, n_nodes)) != NULL) {
             n = atoi(buf);
-            for (i = 0; i < topology.nodemap.entries; i++) {
-                if ((topology.nodemap.array[i] == n) &&
+            for (i = 0; i < nr; i++) {
+                if ((topology[i].node == n) &&
                     libxl_cpumap_test(&freemap, i)) {
                     libxl_cpumap_set(&cpumap, i);
                     n_cpus++;
@@ -5477,7 +5480,7 @@
             n_nodes++;
         }
 
-        libxl_topologyinfo_dispose(&topology);
+        libxl_cputopology_list_free(topology, nr);
 
         if (n_cpus == 0) {
             fprintf(stderr, "no free cpu found\n");
@@ -5799,11 +5802,12 @@
     int schedid;
     int n_pools;
     int node;
+    int n_cpus;
     char name[16];
     libxl_uuid uuid;
     libxl_cpumap cpumap;
     libxl_cpupoolinfo *poolinfo;
-    libxl_topologyinfo topology;
+    libxl_cputopology *topology;
     libxl_dominfo info;
 
     if ((opt = def_getopt(argc, argv, "", "cpupool-numa-split", 0)) != -1)
@@ -5825,21 +5829,22 @@
         return -ERROR_FAIL;
     }
 
-    if (libxl_get_topologyinfo(ctx, &topology)) {
+    topology = libxl_get_cpu_topology(ctx, &n_cpus);
+    if (topology == NULL) {
         fprintf(stderr, "libxl_get_topologyinfo failed\n");
         return -ERROR_FAIL;
     }
 
     if (libxl_cpumap_alloc(ctx, &cpumap)) {
         fprintf(stderr, "Failed to allocate cpumap\n");
-        libxl_topologyinfo_dispose(&topology);
+        libxl_cputopology_list_free(topology, n_cpus);
         return -ERROR_FAIL;
     }
 
     /* Reset Pool-0 to 1st node: first add cpus, then remove cpus to avoid
        a cpupool without cpus in between */
 
-    node = topology.nodemap.array[0];
+    node = topology[0].node;
     if (libxl_cpupool_cpuadd_node(ctx, 0, node, &n)) {
         fprintf(stderr, "error on adding cpu to Pool 0\n");
         return -ERROR_FAIL;
@@ -5853,9 +5858,9 @@
     }
 
     n = 0;
-    for (c = 0; c < topology.nodemap.entries; c++) {
-        if (topology.nodemap.array[c] == node) {
-            topology.nodemap.array[c] = LIBXL_CPUARRAY_INVALID_ENTRY;
+    for (c = 0; c < n_cpus; c++) {
+        if (topology[c].node == node) {
+            topology[c].node = LIBXL_CPUTOPOLOGY_INVALID_ENTRY;
             libxl_cpumap_set(&cpumap, n);
             n++;
         }
@@ -5880,12 +5885,12 @@
     }
     memset(cpumap.map, 0, cpumap.size);
 
-    for (c = 0; c < topology.nodemap.entries; c++) {
-        if (topology.nodemap.array[c] == LIBXL_CPUARRAY_INVALID_ENTRY) {
+    for (c = 0; c < n_cpus; c++) {
+        if (topology[c].node == LIBXL_CPUTOPOLOGY_INVALID_ENTRY) {
             continue;
         }
 
-        node = topology.nodemap.array[c];
+        node = topology[c].node;
         ret = -libxl_cpupool_cpuremove_node(ctx, 0, node, &n);
         if (ret) {
             fprintf(stderr, "error on removing cpu from Pool 0\n");
@@ -5907,15 +5912,15 @@
             goto out;
         }
 
-        for (p = c; p < topology.nodemap.entries; p++) {
-            if (topology.nodemap.array[p] == node) {
-                topology.nodemap.array[p] = LIBXL_CPUARRAY_INVALID_ENTRY;
+        for (p = c; p < n_cpus; p++) {
+            if (topology[p].node == node) {
+                topology[p].node = LIBXL_CPUTOPOLOGY_INVALID_ENTRY;
             }
         }
     }
 
 out:
-    libxl_topologyinfo_dispose(&topology);
+    libxl_cputopology_list_free(topology, n_cpus);
     libxl_cpumap_dispose(&cpumap);
 
     return ret;
diff -r bff9e4b818b9 -r 1d8f40029ddb tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/ocaml/libs/xl/genwrap.py	Tue Jan 31 16:34:39 2012 +0000
@@ -29,6 +29,8 @@
     "device_pci":     DEVICE_FUNCTIONS,
     "physinfo":       [ ("get",            ["unit", "t"]),
                       ],
+    "cputopology":    [ ("get",            ["unit", "t array"]),
+                      ],
     "sched_credit":   [ ("domain_get",     ["domid", "t"]),
                         ("domain_set",     ["domid", "t", "unit"]),
                       ],
@@ -266,7 +268,6 @@
         "domain_create_info",
         "domain_build_info",
         "vcpuinfo",
-        "topologyinfo",
         "event",
         ]
 
diff -r bff9e4b818b9 -r 1d8f40029ddb tools/ocaml/libs/xl/xenlight.ml.in
--- a/tools/ocaml/libs/xl/xenlight.ml.in	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight.ml.in	Tue Jan 31 16:34:39 2012 +0000
@@ -19,17 +19,6 @@
 
 (* @@LIBXL_TYPES@@ *)
 
-module Topologyinfo = struct
-	type t =
-	{
-		core : int;
-		socket : int;
-		node : int;
-	}
-	external get : unit -> t array = "stub_xl_topologyinfo"
-end
-
-
 external send_trigger : domid -> trigger -> int -> unit = "stub_xl_send_trigger"
 external send_sysrq : domid -> char -> unit = "stub_xl_send_sysrq"
 external send_debug_keys : domid -> string -> unit = "stub_xl_send_debug_keys"
diff -r bff9e4b818b9 -r 1d8f40029ddb tools/ocaml/libs/xl/xenlight.mli.in
--- a/tools/ocaml/libs/xl/xenlight.mli.in	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight.mli.in	Tue Jan 31 16:34:39 2012 +0000
@@ -19,16 +19,6 @@
 
 (* @@LIBXL_TYPES@@ *)
 
-module Topologyinfo : sig
-	type t =
-	{
-		core : int;
-		socket : int;
-		node : int;
-	}
-	external get : unit -> t array = "stub_xl_topologyinfo"
-end
-
 external send_trigger : domid -> trigger -> int -> unit = "stub_xl_send_trigger"
 external send_sysrq : domid -> char -> unit = "stub_xl_send_sysrq"
 external send_debug_keys : domid -> string -> unit = "stub_xl_send_debug_keys"
diff -r bff9e4b818b9 -r 1d8f40029ddb tools/ocaml/libs/xl/xenlight_stubs.c
--- a/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Jan 31 16:34:39 2012 +0000
@@ -210,28 +210,6 @@
 
 #include "_libxl_types.inc"
 
-static value Val_topologyinfo(libxl_topologyinfo *c_val)
-{
-	CAMLparam0();
-	CAMLlocal3(v, topology, topologyinfo);
-	int i;
-
-	topologyinfo = caml_alloc_tuple(c_val->coremap.entries);
-	for (i = 0; i < c_val->coremap.entries; i++) {
-		v = Val_none;
-		if (c_val->coremap.array[i] != LIBXL_CPUARRAY_INVALID_ENTRY) {
-			topology = caml_alloc_tuple(3);
-			Store_field(topology, 0, Val_int(c_val->coremap.array[i]));
-			Store_field(topology, 1, Val_int(c_val->socketmap.array[i]));
-			Store_field(topology, 2, Val_int(c_val->nodemap.array[i]));
-			v = Val_some(topology);
-		}
-		Store_field(topologyinfo, i, v);
-	}
-
-	CAMLreturn(topologyinfo);
-}
-
 value stub_xl_device_disk_add(value info, value domid)
 {
 	CAMLparam2(info, domid);
@@ -462,22 +440,33 @@
 	CAMLreturn(physinfo);
 }
 
-value stub_xl_topologyinfo(value unit)
+value stub_xl_cputopology_get(value unit)
 {
 	CAMLparam1(unit);
-	CAMLlocal1(topologyinfo);
-	libxl_topologyinfo c_topologyinfo;
-	int ret;
+	CAMLlocal2(topology, v);
+	libxl_cputopology *c_topology;
+	int i, nr, ret;
 	INIT_STRUCT();
 
 	INIT_CTX();
-	ret = libxl_get_topologyinfo(ctx, &c_topologyinfo);
+
+	c_topology = libxl_get_cpu_topology(ctx, &nr);
 	if (ret != 0)
 		failwith_xl("topologyinfo", &lg);
+
+	topology = caml_alloc_tuple(nr);
+	for (i = 0; i < nr; i++) {
+		if (c_topology[i].core != LIBXL_CPUTOPOLOGY_INVALID_ENTRY)
+			v = Val_some(Val_cputopology(&gc, &lg, &c_topology[i]));
+		else
+			v = Val_none;
+		Store_field(topology, i, v);
+	}
+
+	libxl_cputopology_list_free(c_topology, nr);
+
 	FREE_CTX();
-
-	topologyinfo = Val_topologyinfo(&c_topologyinfo);
-	CAMLreturn(topologyinfo);
+	CAMLreturn(topology);
 }
 
 value stub_xl_sched_credit_domain_get(value domid)

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:49 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9d-0008Jc-FB; Fri, 03 Feb 2012 21:58:49 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9c-0008Hx-A0
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:48 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-27.messagelabs.com!1328306256!62530202!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29930 invoked from network); 3 Feb 2012 21:57:37 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:37 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9Z-0001pp-Ry
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:45 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9Y-0003G7-FQ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:45 +0000
Message-Id: <E1RtR9Y-0003G7-FQ@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:43 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: document /etc/xen/xl.conf
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027679 0
# Node ID 1d063727559851f6950583c33d201f786327657f
# Parent  759be09a0e385c60cdf43b0fe1cb6149661f430d
docs: document /etc/xen/xl.conf

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


diff -r 759be09a0e38 -r 1d0637275598 docs/man/xl.conf.pod.5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/man/xl.conf.pod.5	Tue Jan 31 16:34:39 2012 +0000
@@ -0,0 +1,93 @@
+=head1 NAME
+
+/etc/xen/xl.conf - XL Global/Host Configuration 
+
+=head1 DESCRIPTION
+
+The F<xl.conf> file allows configuration of hostwide C<xl> toolstack
+options.
+
+For details of per-domain configuration options please see
+L<xl.cfg(5)>.
+
+=head1 SYNTAX
+
+The config file consists of a series of C<KEY=VALUE> pairs.
+
+A value C<VALUE> is one of:
+
+=over 4
+
+=item B<"STRING">
+
+A string, surrounded by either single or double quotes.
+
+=item B<NUMBER>
+
+A number, in either decimal, octal (using a C<0> prefix) or
+hexadecimal (using an C<0x> prefix).
+
+=item B<BOOLEAN>
+
+A C<NUMBER> interpreted as C<False> (C<0>) or C<True> (any other
+value).
+
+=item B<[ VALUE, VALUE, ... ]>
+
+A list of C<VALUES> of the above types. Lists are homogeneous and are
+not nested.
+
+=back
+
+The semantics of each C<KEY> defines which form of C<VALUE> is required.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<autoballoon=BOOLEAN>
+
+If enabled then C<xl> will not attempt to reduce the amount of memory
+assigned to domain 0 in order to create free memory when starting a
+new domain. You should set this if you use the C<dom0_mem> hypervisor
+command line to reduce the amount of memory given to domain 0 by
+default.
+
+Default: C<0>
+
+=item B<lockfile="PATH">
+
+Sets the path to the lock file used by xl to serialise certain
+operations (primarily domain creation).
+
+Default: C</var/lock/xl>
+
+=item B<vifscript="PATH">
+
+Configures the default hotplug script used by virtual network devices.
+
+Default: C</etc/xen/scripts/vif-bridge>
+
+=item B<output_format="json|sxp">
+
+Configures the default output format used by xl when printing "machine
+readable" information. The default is to use the C<JSON>
+L<http://www.json.org/> syntax. However for compatibility with the
+previous C<xm> toolstack this can be configured to use the old C<SXP>
+(S-Expression-like) syntax instead.
+
+Default: C<json>
+
+=back
+
+=head1 SEE ALSO
+
+=over 4
+
+=item L<xl(1)>
+
+=item L<xl.cfg(5)>
+
+=item http://www.json.org/
+
+=back

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:49 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9d-0008Jc-FB; Fri, 03 Feb 2012 21:58:49 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9c-0008Hx-A0
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:48 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-27.messagelabs.com!1328306256!62530202!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29930 invoked from network); 3 Feb 2012 21:57:37 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:57:37 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9Z-0001pp-Ry
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:45 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9Y-0003G7-FQ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:45 +0000
Message-Id: <E1RtR9Y-0003G7-FQ@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:43 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: document /etc/xen/xl.conf
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027679 0
# Node ID 1d063727559851f6950583c33d201f786327657f
# Parent  759be09a0e385c60cdf43b0fe1cb6149661f430d
docs: document /etc/xen/xl.conf

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


diff -r 759be09a0e38 -r 1d0637275598 docs/man/xl.conf.pod.5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/man/xl.conf.pod.5	Tue Jan 31 16:34:39 2012 +0000
@@ -0,0 +1,93 @@
+=head1 NAME
+
+/etc/xen/xl.conf - XL Global/Host Configuration 
+
+=head1 DESCRIPTION
+
+The F<xl.conf> file allows configuration of hostwide C<xl> toolstack
+options.
+
+For details of per-domain configuration options please see
+L<xl.cfg(5)>.
+
+=head1 SYNTAX
+
+The config file consists of a series of C<KEY=VALUE> pairs.
+
+A value C<VALUE> is one of:
+
+=over 4
+
+=item B<"STRING">
+
+A string, surrounded by either single or double quotes.
+
+=item B<NUMBER>
+
+A number, in either decimal, octal (using a C<0> prefix) or
+hexadecimal (using an C<0x> prefix).
+
+=item B<BOOLEAN>
+
+A C<NUMBER> interpreted as C<False> (C<0>) or C<True> (any other
+value).
+
+=item B<[ VALUE, VALUE, ... ]>
+
+A list of C<VALUES> of the above types. Lists are homogeneous and are
+not nested.
+
+=back
+
+The semantics of each C<KEY> defines which form of C<VALUE> is required.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<autoballoon=BOOLEAN>
+
+If enabled then C<xl> will not attempt to reduce the amount of memory
+assigned to domain 0 in order to create free memory when starting a
+new domain. You should set this if you use the C<dom0_mem> hypervisor
+command line to reduce the amount of memory given to domain 0 by
+default.
+
+Default: C<0>
+
+=item B<lockfile="PATH">
+
+Sets the path to the lock file used by xl to serialise certain
+operations (primarily domain creation).
+
+Default: C</var/lock/xl>
+
+=item B<vifscript="PATH">
+
+Configures the default hotplug script used by virtual network devices.
+
+Default: C</etc/xen/scripts/vif-bridge>
+
+=item B<output_format="json|sxp">
+
+Configures the default output format used by xl when printing "machine
+readable" information. The default is to use the C<JSON>
+L<http://www.json.org/> syntax. However for compatibility with the
+previous C<xm> toolstack this can be configured to use the old C<SXP>
+(S-Expression-like) syntax instead.
+
+Default: C<json>
+
+=back
+
+=head1 SEE ALSO
+
+=over 4
+
+=item L<xl(1)>
+
+=item L<xl.cfg(5)>
+
+=item http://www.json.org/
+
+=back

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:49 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9d-0008Jj-Hb; Fri, 03 Feb 2012 21:58:49 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9c-0008E4-ET
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:48 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1328306321!13361875!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24315 invoked from network); 3 Feb 2012 21:58:42 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:42 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9U-0001pf-US
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:40 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9T-0003ER-E8
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:40 +0000
Message-Id: <E1RtR9T-0003ER-E8@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:38 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: drop libxl_cpuarray --
	topology was the only user.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027679 0
# Node ID 8eedc39f60e36779ad6885a7622bf16252113c39
# Parent  1d8f40029ddb87c511d0237ab7ae9d4d117ea6cf
libxl: drop libxl_cpuarray -- topology was the only user.

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


diff -r 1d8f40029ddb -r 8eedc39f60e3 tools/libxl/gentest.py
--- a/tools/libxl/gentest.py	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/gentest.py	Tue Jan 31 16:34:39 2012 +0000
@@ -21,7 +21,7 @@
 
 handcoded = ["libxl_cpumap", "libxl_key_value_list",
              "libxl_cpuid_policy_list", "libxl_file_reference",
-             "libxl_string_list", "libxl_cpuarray"]
+             "libxl_string_list"]
 
 def gen_rand_init(ty, v, indent = "    ", parent = None):
     s = ""
@@ -194,23 +194,6 @@
     l[i] = NULL;
     *p = l;
 }
-
-#if 0 /* To be remove in a subsequent patch */
-static void libxl_cpuarray_rand_init(libxl_cpuarray *p)
-{
-    int i;
-    /* Up to 16 VCPUs on 32 PCPUS */
-    p->entries = rand() % 16;
-    p->array = calloc(p->entries, sizeof(*p->array));
-    for (i = 0; i < p->entries; i++) {
-        int r = rand() % 32*1.5; /* 2:1 valid:invalid */
-        if (r >= 32)
-            p->array[i] = LIBXL_CPUARRAY_INVALID_ENTRY;
-        else
-            p->array[i] = r;
-    }
-}
-#endif
 """)
     for ty in builtins + types:
         if ty.typename not in handcoded:
diff -r 1d8f40029ddb -r 8eedc39f60e3 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl.h	Tue Jan 31 16:34:39 2012 +0000
@@ -164,13 +164,6 @@
 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_dispose(libxl_cpuarray *array);
-
-typedef struct {
     /*
      * Path is always set if the file reference is valid. However if
      * mapped is true then the actual file may already be unlinked.
diff -r 1d8f40029ddb -r 8eedc39f60e3 tools/libxl/libxl_json.c
--- a/tools/libxl/libxl_json.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl_json.c	Tue Jan 31 16:34:39 2012 +0000
@@ -246,27 +246,6 @@
     return s;
 }
 
-yajl_gen_status libxl_cpuarray_gen_json(yajl_gen hand,
-                                        libxl_cpuarray *cpuarray)
-{
-    yajl_gen_status s;
-    int i;
-
-    s = yajl_gen_array_open(hand);
-    if (s != yajl_gen_status_ok) goto out;
-
-    for(i=0; i<cpuarray->entries; i++) {
-        if (cpuarray->array[i] == LIBXL_CPUARRAY_INVALID_ENTRY)
-            s = yajl_gen_null(hand);
-        else
-            s = yajl_gen_integer(hand, cpuarray->array[i]);
-        if (s != yajl_gen_status_ok) goto out;
-    }
-    s = yajl_gen_array_close(hand);
-out:
-    return s;
-}
-
 yajl_gen_status libxl_file_reference_gen_json(yajl_gen hand,
                                               libxl_file_reference *p)
 {
diff -r 1d8f40029ddb -r 8eedc39f60e3 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:39 2012 +0000
@@ -9,7 +9,6 @@
 libxl_uuid = Builtin("uuid", passby=PASS_BY_REFERENCE)
 libxl_mac = Builtin("mac", 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", dispose_fn="libxl_string_list_dispose", passby=PASS_BY_REFERENCE)
diff -r 1d8f40029ddb -r 8eedc39f60e3 tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl_utils.c	Tue Jan 31 16:34:39 2012 +0000
@@ -514,30 +514,6 @@
     cpumap->map[cpu / 8] &= ~(1 << (cpu & 7));
 }
 
-int libxl_cpuarray_alloc(libxl_ctx *ctx, libxl_cpuarray *cpuarray)
-{
-    int max_cpus;
-    int i;
-
-    max_cpus = libxl_get_max_cpus(ctx);
-    if (max_cpus == 0)
-        return ERROR_FAIL;
-
-    cpuarray->array = calloc(max_cpus, sizeof(*cpuarray->array));
-    if (!cpuarray->array)
-        return ERROR_NOMEM;
-    cpuarray->entries = max_cpus;
-    for (i = 0; i < max_cpus; i++)
-        cpuarray->array[i] = LIBXL_CPUARRAY_INVALID_ENTRY;
-
-    return 0;
-}
-
-void libxl_cpuarray_dispose(libxl_cpuarray *array)
-{
-    free(array->array);
-}
-
 int libxl_get_max_cpus(libxl_ctx *ctx)
 {
     return xc_get_max_cpus(ctx->xch);
diff -r 1d8f40029ddb -r 8eedc39f60e3 tools/libxl/libxl_utils.h
--- a/tools/libxl/libxl_utils.h	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl_utils.h	Tue Jan 31 16:34:39 2012 +0000
@@ -86,8 +86,6 @@
 #define libxl_for_each_set_cpu(v, m) for (v = 0; v < (m).size * 8; v++) \
                                              if (libxl_cpumap_test(&(m), v))
 
-int libxl_cpuarray_alloc(libxl_ctx *ctx, libxl_cpuarray *cpuarray);
-
 static inline uint32_t libxl__sizekb_to_mb(uint32_t s) {
     return (s + 1023) / 1024;
 }
diff -r 1d8f40029ddb -r 8eedc39f60e3 tools/python/xen/lowlevel/xl/xl.c
--- a/tools/python/xen/lowlevel/xl/xl.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/python/xen/lowlevel/xl/xl.c	Tue Jan 31 16:34:39 2012 +0000
@@ -227,11 +227,6 @@
     return 0;
 }
 
-int attrib__libxl_cpuarray_set(PyObject *v, libxl_cpuarray *pptr)
-{
-    return -1;
-}
-
 int attrib__libxl_file_reference_set(PyObject *v, libxl_file_reference *pptr)
 {
     return genwrap__string_set(v, &pptr->path);
@@ -304,25 +299,6 @@
     return cpulist;
 }
 
-PyObject *attrib__libxl_cpuarray_get(libxl_cpuarray *pptr)
-{
-    PyObject *list = NULL;
-    int i;
-
-    list = PyList_New(0);
-    for (i = 0; i < pptr->entries; i++) {
-        if (pptr->array[i] == LIBXL_CPUARRAY_INVALID_ENTRY) {
-            PyList_Append(list, Py_None);
-        } else {
-            PyObject* pyint = PyInt_FromLong(pptr->array[i]);
-
-            PyList_Append(list, pyint);
-            Py_DECREF(pyint);
-        }
-    }
-    return list;
-}
-
 PyObject *attrib__libxl_file_reference_get(libxl_file_reference *pptr)
 {
     return genwrap__string_get(&pptr->path);

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:49 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9d-0008Jj-Hb; Fri, 03 Feb 2012 21:58:49 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9c-0008E4-ET
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:48 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1328306321!13361875!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24315 invoked from network); 3 Feb 2012 21:58:42 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:42 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9U-0001pf-US
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:40 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9T-0003ER-E8
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:40 +0000
Message-Id: <E1RtR9T-0003ER-E8@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:38 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: drop libxl_cpuarray --
	topology was the only user.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027679 0
# Node ID 8eedc39f60e36779ad6885a7622bf16252113c39
# Parent  1d8f40029ddb87c511d0237ab7ae9d4d117ea6cf
libxl: drop libxl_cpuarray -- topology was the only user.

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


diff -r 1d8f40029ddb -r 8eedc39f60e3 tools/libxl/gentest.py
--- a/tools/libxl/gentest.py	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/gentest.py	Tue Jan 31 16:34:39 2012 +0000
@@ -21,7 +21,7 @@
 
 handcoded = ["libxl_cpumap", "libxl_key_value_list",
              "libxl_cpuid_policy_list", "libxl_file_reference",
-             "libxl_string_list", "libxl_cpuarray"]
+             "libxl_string_list"]
 
 def gen_rand_init(ty, v, indent = "    ", parent = None):
     s = ""
@@ -194,23 +194,6 @@
     l[i] = NULL;
     *p = l;
 }
-
-#if 0 /* To be remove in a subsequent patch */
-static void libxl_cpuarray_rand_init(libxl_cpuarray *p)
-{
-    int i;
-    /* Up to 16 VCPUs on 32 PCPUS */
-    p->entries = rand() % 16;
-    p->array = calloc(p->entries, sizeof(*p->array));
-    for (i = 0; i < p->entries; i++) {
-        int r = rand() % 32*1.5; /* 2:1 valid:invalid */
-        if (r >= 32)
-            p->array[i] = LIBXL_CPUARRAY_INVALID_ENTRY;
-        else
-            p->array[i] = r;
-    }
-}
-#endif
 """)
     for ty in builtins + types:
         if ty.typename not in handcoded:
diff -r 1d8f40029ddb -r 8eedc39f60e3 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl.h	Tue Jan 31 16:34:39 2012 +0000
@@ -164,13 +164,6 @@
 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_dispose(libxl_cpuarray *array);
-
-typedef struct {
     /*
      * Path is always set if the file reference is valid. However if
      * mapped is true then the actual file may already be unlinked.
diff -r 1d8f40029ddb -r 8eedc39f60e3 tools/libxl/libxl_json.c
--- a/tools/libxl/libxl_json.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl_json.c	Tue Jan 31 16:34:39 2012 +0000
@@ -246,27 +246,6 @@
     return s;
 }
 
-yajl_gen_status libxl_cpuarray_gen_json(yajl_gen hand,
-                                        libxl_cpuarray *cpuarray)
-{
-    yajl_gen_status s;
-    int i;
-
-    s = yajl_gen_array_open(hand);
-    if (s != yajl_gen_status_ok) goto out;
-
-    for(i=0; i<cpuarray->entries; i++) {
-        if (cpuarray->array[i] == LIBXL_CPUARRAY_INVALID_ENTRY)
-            s = yajl_gen_null(hand);
-        else
-            s = yajl_gen_integer(hand, cpuarray->array[i]);
-        if (s != yajl_gen_status_ok) goto out;
-    }
-    s = yajl_gen_array_close(hand);
-out:
-    return s;
-}
-
 yajl_gen_status libxl_file_reference_gen_json(yajl_gen hand,
                                               libxl_file_reference *p)
 {
diff -r 1d8f40029ddb -r 8eedc39f60e3 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:39 2012 +0000
@@ -9,7 +9,6 @@
 libxl_uuid = Builtin("uuid", passby=PASS_BY_REFERENCE)
 libxl_mac = Builtin("mac", 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", dispose_fn="libxl_string_list_dispose", passby=PASS_BY_REFERENCE)
diff -r 1d8f40029ddb -r 8eedc39f60e3 tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl_utils.c	Tue Jan 31 16:34:39 2012 +0000
@@ -514,30 +514,6 @@
     cpumap->map[cpu / 8] &= ~(1 << (cpu & 7));
 }
 
-int libxl_cpuarray_alloc(libxl_ctx *ctx, libxl_cpuarray *cpuarray)
-{
-    int max_cpus;
-    int i;
-
-    max_cpus = libxl_get_max_cpus(ctx);
-    if (max_cpus == 0)
-        return ERROR_FAIL;
-
-    cpuarray->array = calloc(max_cpus, sizeof(*cpuarray->array));
-    if (!cpuarray->array)
-        return ERROR_NOMEM;
-    cpuarray->entries = max_cpus;
-    for (i = 0; i < max_cpus; i++)
-        cpuarray->array[i] = LIBXL_CPUARRAY_INVALID_ENTRY;
-
-    return 0;
-}
-
-void libxl_cpuarray_dispose(libxl_cpuarray *array)
-{
-    free(array->array);
-}
-
 int libxl_get_max_cpus(libxl_ctx *ctx)
 {
     return xc_get_max_cpus(ctx->xch);
diff -r 1d8f40029ddb -r 8eedc39f60e3 tools/libxl/libxl_utils.h
--- a/tools/libxl/libxl_utils.h	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl_utils.h	Tue Jan 31 16:34:39 2012 +0000
@@ -86,8 +86,6 @@
 #define libxl_for_each_set_cpu(v, m) for (v = 0; v < (m).size * 8; v++) \
                                              if (libxl_cpumap_test(&(m), v))
 
-int libxl_cpuarray_alloc(libxl_ctx *ctx, libxl_cpuarray *cpuarray);
-
 static inline uint32_t libxl__sizekb_to_mb(uint32_t s) {
     return (s + 1023) / 1024;
 }
diff -r 1d8f40029ddb -r 8eedc39f60e3 tools/python/xen/lowlevel/xl/xl.c
--- a/tools/python/xen/lowlevel/xl/xl.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/python/xen/lowlevel/xl/xl.c	Tue Jan 31 16:34:39 2012 +0000
@@ -227,11 +227,6 @@
     return 0;
 }
 
-int attrib__libxl_cpuarray_set(PyObject *v, libxl_cpuarray *pptr)
-{
-    return -1;
-}
-
 int attrib__libxl_file_reference_set(PyObject *v, libxl_file_reference *pptr)
 {
     return genwrap__string_set(v, &pptr->path);
@@ -304,25 +299,6 @@
     return cpulist;
 }
 
-PyObject *attrib__libxl_cpuarray_get(libxl_cpuarray *pptr)
-{
-    PyObject *list = NULL;
-    int i;
-
-    list = PyList_New(0);
-    for (i = 0; i < pptr->entries; i++) {
-        if (pptr->array[i] == LIBXL_CPUARRAY_INVALID_ENTRY) {
-            PyList_Append(list, Py_None);
-        } else {
-            PyObject* pyint = PyInt_FromLong(pptr->array[i]);
-
-            PyList_Append(list, pyint);
-            Py_DECREF(pyint);
-        }
-    }
-    return list;
-}
-
 PyObject *attrib__libxl_file_reference_get(libxl_file_reference *pptr)
 {
     return genwrap__string_get(&pptr->path);

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:52 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9g-0008MS-KX; Fri, 03 Feb 2012 21:58:52 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9f-0008Gc-Bm
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:51 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-216.messagelabs.com!1328306324!13423977!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25870 invoked from network); 3 Feb 2012 21:58:45 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:45 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9Y-0001pl-0B
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:44 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9W-0003FZ-SP
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:43 +0000
Message-Id: <E1RtR9W-0003FZ-SP@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:40 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: add named enum for timer mode.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027679 0
# Node ID 759be09a0e385c60cdf43b0fe1cb6149661f430d
# Parent  8eedc39f60e36779ad6885a7622bf16252113c39
libxl: add named enum for timer mode.

Unlike previous iterations of this patch the enum values now match the
underlying domctl values.

I looked at updating xl.cfg(5) for these while I was here but frankly, even
after reading the comment in xen/include/public/hvm/params.h, I don't have a
clue what they mean, no_missed_ticks_pending in particular might as well be
written in klingon...

For the same reason I didn't try and give the enum more user-friendly names.

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


diff -r 8eedc39f60e3 -r 759be09a0e38 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl.h	Tue Jan 31 16:34:39 2012 +0000
@@ -203,6 +203,8 @@
 
 typedef struct libxl__ctx libxl_ctx;
 
+#define LIBXL_TIMER_MODE_DEFAULT LIBXL_TIMER_MODE_NO_DELAY_FOR_MISSED_TICKS
+
 #include "_libxl_types.h"
 
 const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx);
diff -r 8eedc39f60e3 -r 759be09a0e38 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl_dom.c	Tue Jan 31 16:34:39 2012 +0000
@@ -251,6 +251,13 @@
     return ret == 0 ? 0 : ERROR_FAIL;
 }
 
+static unsigned long timer_mode(const libxl_domain_build_info *info)
+{
+    const libxl_timer_mode mode = info->u.hvm.timer_mode;
+    assert(mode != LIBXL_TIMER_MODE_DELAY_FOR_MISSED_TICKS &&
+           mode <= LIBXL_TIMER_MODE_ONE_MISSED_TICK_PENDING);
+    return ((unsigned long)mode);
+}
 static int hvm_build_set_params(xc_interface *handle, uint32_t domid,
                                 libxl_domain_build_info *info,
                                 int store_evtchn, unsigned long *store_mfn,
@@ -282,7 +289,7 @@
     xc_set_hvm_param(handle, domid, HVM_PARAM_VIRIDIAN, info->u.hvm.viridian);
     xc_set_hvm_param(handle, domid, HVM_PARAM_HPET_ENABLED, (unsigned long) info->u.hvm.hpet);
 #endif
-    xc_set_hvm_param(handle, domid, HVM_PARAM_TIMER_MODE, (unsigned long) info->u.hvm.timer_mode);
+    xc_set_hvm_param(handle, domid, HVM_PARAM_TIMER_MODE, timer_mode(info));
     xc_set_hvm_param(handle, domid, HVM_PARAM_VPT_ALIGN, (unsigned long) info->u.hvm.vpt_align);
     xc_set_hvm_param(handle, domid, HVM_PARAM_NESTEDHVM, info->u.hvm.nested_hvm);
     xc_set_hvm_param(handle, domid, HVM_PARAM_STORE_EVTCHN, store_evtchn);
diff -r 8eedc39f60e3 -r 759be09a0e38 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:39 2012 +0000
@@ -91,6 +91,14 @@
     (3, "native_paravirt"),
     ])
 
+# Consistent with the values defined for HVM_PARAM_TIMER_MODE.
+libxl_timer_mode = Enumeration("timer_mode", [
+    (0, "delay_for_missed_ticks"),
+    (1, "no_delay_for_missed_ticks"),
+    (2, "no_missed_ticks_pending"),
+    (3, "one_missed_tick_pending"),
+    ])
+
 #
 # Complex libxl types
 #
@@ -229,7 +237,7 @@
                                        ("timeoffset", string),
                                        ("hpet", bool),
                                        ("vpt_align", bool),
-                                       ("timer_mode", integer),
+                                       ("timer_mode", libxl_timer_mode),
                                        ("nested_hvm", bool),
                                        ("no_incr_generationid", bool),
                                        ("nographic",        bool),
diff -r 8eedc39f60e3 -r 759be09a0e38 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 16:34:39 2012 +0000
@@ -358,7 +358,9 @@
         printf("\t\t\t(viridian %d)\n", b_info->u.hvm.viridian);
         printf("\t\t\t(hpet %d)\n", b_info->u.hvm.hpet);
         printf("\t\t\t(vpt_align %d)\n", b_info->u.hvm.vpt_align);
-        printf("\t\t\t(timer_mode %d)\n", b_info->u.hvm.timer_mode);
+        printf("\t\t\t(timer_mode %s)\n",
+               libxl_timer_mode_to_string(b_info->u.hvm.timer_mode));
+
         printf("\t\t\t(nestedhvm %d)\n", b_info->u.hvm.nested_hvm);
         printf("\t\t\t(no_incr_generationid %d)\n",
                     b_info->u.hvm.no_incr_generationid);
@@ -840,8 +842,30 @@
             b_info->u.hvm.hpet = l;
         if (!xlu_cfg_get_long (config, "vpt_align", &l, 0))
             b_info->u.hvm.vpt_align = l;
-        if (!xlu_cfg_get_long (config, "timer_mode", &l, 0))
+
+        if (!xlu_cfg_get_long(config, "timer_mode", &l, 1)) {
+            const char *s = libxl_timer_mode_to_string(l);
+            fprintf(stderr, "WARNING: specifying \"timer_mode\" as an integer is deprecated. "
+                    "Please use the named parameter variant. %s%s%s\n",
+                    s ? "e.g. timer_mode=\"" : "",
+                    s ? s : "",
+                    s ? "\"" : "");
+
+            if (l < LIBXL_TIMER_MODE_DELAY_FOR_MISSED_TICKS ||
+                l > LIBXL_TIMER_MODE_ONE_MISSED_TICK_PENDING) {
+                fprintf(stderr, "ERROR: invalid value %ld for \"timer_mode\"\n", l);
+                exit (1);
+            }
             b_info->u.hvm.timer_mode = l;
+        } else if (!xlu_cfg_get_string(config, "timer_mode", &buf, 0)) {
+            fprintf(stderr, "got a timer mode string: \"%s\"\n", buf);
+            if (libxl_timer_mode_from_string(buf, &b_info->u.hvm.timer_mode)) {
+                fprintf(stderr, "ERROR: invalid value \"%s\" for \"timer_mode\"\n",
+                        buf);
+                exit (1);
+            }
+        }
+
         if (!xlu_cfg_get_long (config, "nestedhvm", &l, 0))
             b_info->u.hvm.nested_hvm = l;
         break;

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:52 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9g-0008MS-KX; Fri, 03 Feb 2012 21:58:52 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9f-0008Gc-Bm
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:51 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-216.messagelabs.com!1328306324!13423977!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25870 invoked from network); 3 Feb 2012 21:58:45 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:45 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9Y-0001pl-0B
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:44 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9W-0003FZ-SP
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:43 +0000
Message-Id: <E1RtR9W-0003FZ-SP@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:40 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: add named enum for timer mode.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027679 0
# Node ID 759be09a0e385c60cdf43b0fe1cb6149661f430d
# Parent  8eedc39f60e36779ad6885a7622bf16252113c39
libxl: add named enum for timer mode.

Unlike previous iterations of this patch the enum values now match the
underlying domctl values.

I looked at updating xl.cfg(5) for these while I was here but frankly, even
after reading the comment in xen/include/public/hvm/params.h, I don't have a
clue what they mean, no_missed_ticks_pending in particular might as well be
written in klingon...

For the same reason I didn't try and give the enum more user-friendly names.

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


diff -r 8eedc39f60e3 -r 759be09a0e38 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl.h	Tue Jan 31 16:34:39 2012 +0000
@@ -203,6 +203,8 @@
 
 typedef struct libxl__ctx libxl_ctx;
 
+#define LIBXL_TIMER_MODE_DEFAULT LIBXL_TIMER_MODE_NO_DELAY_FOR_MISSED_TICKS
+
 #include "_libxl_types.h"
 
 const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx);
diff -r 8eedc39f60e3 -r 759be09a0e38 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl_dom.c	Tue Jan 31 16:34:39 2012 +0000
@@ -251,6 +251,13 @@
     return ret == 0 ? 0 : ERROR_FAIL;
 }
 
+static unsigned long timer_mode(const libxl_domain_build_info *info)
+{
+    const libxl_timer_mode mode = info->u.hvm.timer_mode;
+    assert(mode != LIBXL_TIMER_MODE_DELAY_FOR_MISSED_TICKS &&
+           mode <= LIBXL_TIMER_MODE_ONE_MISSED_TICK_PENDING);
+    return ((unsigned long)mode);
+}
 static int hvm_build_set_params(xc_interface *handle, uint32_t domid,
                                 libxl_domain_build_info *info,
                                 int store_evtchn, unsigned long *store_mfn,
@@ -282,7 +289,7 @@
     xc_set_hvm_param(handle, domid, HVM_PARAM_VIRIDIAN, info->u.hvm.viridian);
     xc_set_hvm_param(handle, domid, HVM_PARAM_HPET_ENABLED, (unsigned long) info->u.hvm.hpet);
 #endif
-    xc_set_hvm_param(handle, domid, HVM_PARAM_TIMER_MODE, (unsigned long) info->u.hvm.timer_mode);
+    xc_set_hvm_param(handle, domid, HVM_PARAM_TIMER_MODE, timer_mode(info));
     xc_set_hvm_param(handle, domid, HVM_PARAM_VPT_ALIGN, (unsigned long) info->u.hvm.vpt_align);
     xc_set_hvm_param(handle, domid, HVM_PARAM_NESTEDHVM, info->u.hvm.nested_hvm);
     xc_set_hvm_param(handle, domid, HVM_PARAM_STORE_EVTCHN, store_evtchn);
diff -r 8eedc39f60e3 -r 759be09a0e38 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Jan 31 16:34:39 2012 +0000
@@ -91,6 +91,14 @@
     (3, "native_paravirt"),
     ])
 
+# Consistent with the values defined for HVM_PARAM_TIMER_MODE.
+libxl_timer_mode = Enumeration("timer_mode", [
+    (0, "delay_for_missed_ticks"),
+    (1, "no_delay_for_missed_ticks"),
+    (2, "no_missed_ticks_pending"),
+    (3, "one_missed_tick_pending"),
+    ])
+
 #
 # Complex libxl types
 #
@@ -229,7 +237,7 @@
                                        ("timeoffset", string),
                                        ("hpet", bool),
                                        ("vpt_align", bool),
-                                       ("timer_mode", integer),
+                                       ("timer_mode", libxl_timer_mode),
                                        ("nested_hvm", bool),
                                        ("no_incr_generationid", bool),
                                        ("nographic",        bool),
diff -r 8eedc39f60e3 -r 759be09a0e38 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 16:34:39 2012 +0000
@@ -358,7 +358,9 @@
         printf("\t\t\t(viridian %d)\n", b_info->u.hvm.viridian);
         printf("\t\t\t(hpet %d)\n", b_info->u.hvm.hpet);
         printf("\t\t\t(vpt_align %d)\n", b_info->u.hvm.vpt_align);
-        printf("\t\t\t(timer_mode %d)\n", b_info->u.hvm.timer_mode);
+        printf("\t\t\t(timer_mode %s)\n",
+               libxl_timer_mode_to_string(b_info->u.hvm.timer_mode));
+
         printf("\t\t\t(nestedhvm %d)\n", b_info->u.hvm.nested_hvm);
         printf("\t\t\t(no_incr_generationid %d)\n",
                     b_info->u.hvm.no_incr_generationid);
@@ -840,8 +842,30 @@
             b_info->u.hvm.hpet = l;
         if (!xlu_cfg_get_long (config, "vpt_align", &l, 0))
             b_info->u.hvm.vpt_align = l;
-        if (!xlu_cfg_get_long (config, "timer_mode", &l, 0))
+
+        if (!xlu_cfg_get_long(config, "timer_mode", &l, 1)) {
+            const char *s = libxl_timer_mode_to_string(l);
+            fprintf(stderr, "WARNING: specifying \"timer_mode\" as an integer is deprecated. "
+                    "Please use the named parameter variant. %s%s%s\n",
+                    s ? "e.g. timer_mode=\"" : "",
+                    s ? s : "",
+                    s ? "\"" : "");
+
+            if (l < LIBXL_TIMER_MODE_DELAY_FOR_MISSED_TICKS ||
+                l > LIBXL_TIMER_MODE_ONE_MISSED_TICK_PENDING) {
+                fprintf(stderr, "ERROR: invalid value %ld for \"timer_mode\"\n", l);
+                exit (1);
+            }
             b_info->u.hvm.timer_mode = l;
+        } else if (!xlu_cfg_get_string(config, "timer_mode", &buf, 0)) {
+            fprintf(stderr, "got a timer mode string: \"%s\"\n", buf);
+            if (libxl_timer_mode_from_string(buf, &b_info->u.hvm.timer_mode)) {
+                fprintf(stderr, "ERROR: invalid value \"%s\" for \"timer_mode\"\n",
+                        buf);
+                exit (1);
+            }
+        }
+
         if (!xlu_cfg_get_long (config, "nestedhvm", &l, 0))
             b_info->u.hvm.nested_hvm = l;
         break;

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:58:57 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9l-0008QI-Ni; Fri, 03 Feb 2012 21:58:57 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9k-0008LK-HH
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:56 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1328306328!10079723!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12974 invoked from network); 3 Feb 2012 21:58:50 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:50 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9c-0001pw-MV
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:48 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9b-0003HB-GZ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:48 +0000
Message-Id: <E1RtR9b-0003HB-GZ@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:45 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: allow enable automatic fallback
	to ACPI events if PV control not available.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027679 0
# Node ID a91aa7a582fb0e13b0782f7d17c249d4b89dddc7
# Parent  1d063727559851f6950583c33d201f786327657f
xl: allow enable automatic fallback to ACPI events if PV control not available.

Add a -F (fallbacks) option to xl destroy|reboot to cause an ACPI shutdown or
reset event to be sent to the guest in the event that the guest does not
support the PV control interface.

This is not the default because the response to these triggers is an
guest-internal configuration.

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


diff -r 1d0637275598 -r a91aa7a582fb docs/man/xl.pod.1
--- a/docs/man/xl.pod.1	Tue Jan 31 16:34:39 2012 +0000
+++ b/docs/man/xl.pod.1	Tue Jan 31 16:34:39 2012 +0000
@@ -365,13 +365,28 @@
 
 For HVM domains this requires PV drivers to be installed in your guest
 OS. If PV drivers are not present but you have configured the guest OS
-to behave appropriately you may be able to use the I<button-press>
-subcommand to trigger a power button press.
+to behave appropriately you may be able to use the I<-F> option
+trigger a reset button press.
 
 The behavior of what happens to a domain when it reboots is set by the
 B<on_reboot> parameter of the domain configuration file when the
 domain was created.
 
+B<OPTIONS>
+
+=over 4
+
+=item B<-F>
+
+If the guest does not support PV reboot control then fallback to
+sending an ACPI power event (equivalent to the I<reset> option to
+I<trigger>.
+
+You should ensure that the guest is configured to behave as expected
+in response to this event.
+
+=back
+
 =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.
@@ -435,8 +450,8 @@
 
 For HVM domains this requires PV drivers to be installed in your guest
 OS. If PV drivers are not present but you have configured the guest OS
-to behave appropriately you may be able to use the I<button-press>
-subcommand to trigger a power button press.
+to behave appropriately you may be able to use the I<-F> option
+trigger a power button press.
 
 The command returns immediately after signally the domain unless that
 B<-w> flag is used.
@@ -453,6 +468,15 @@
 
 Wait for the domain to complete shutdown before returning.
 
+=item B<-F>
+
+If the guest does not support PV shutdown control then fallback to
+sending an ACPI power event (equivalent to the I<power> option to
+I<trigger>.
+
+You should ensure that the guest is configured to behave as expected
+in response to this event.
+
 =back
 
 =item B<sysrq> I<domain-id> I<letter>
diff -r 1d0637275598 -r a91aa7a582fb tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 16:34:39 2012 +0000
@@ -2427,20 +2427,25 @@
     if (rc) { fprintf(stderr,"destroy failed (rc=%d)\n",rc); exit(-1); }
 }
 
-static void shutdown_domain(const char *p, int wait)
+static void shutdown_domain(const char *p, int wait, int fallback_trigger)
 {
     int rc;
     libxl_event *event;
 
     find_domain(p);
     rc=libxl_domain_shutdown(ctx, domid);
-    if (rc) {
-        if (rc == ERROR_NOPARAVIRT) {
+    if (rc == ERROR_NOPARAVIRT) {
+        if (fallback_trigger) {
+            fprintf(stderr, "PV control interface not available:"
+                    " sending ACPI power button event.\n");
+            rc = libxl_send_trigger(ctx, domid, LIBXL_TRIGGER_POWER, 0);
+        } else {
             fprintf(stderr, "PV control interface not available:"
                     " external graceful shutdown not possible.\n");
-            fprintf(stderr, "Use \"xl button-press <dom> power\" or"
-                    " \"xl destroy <dom>\".\n");
+            fprintf(stderr, "Use \"-F\" to fallback to ACPI power event.\n");
         }
+    }
+    if (rc) {
         fprintf(stderr,"shutdown failed (rc=%d)\n",rc);exit(-1);
     }
 
@@ -2481,19 +2486,25 @@
     }
 }
 
-static void reboot_domain(const char *p)
+static void reboot_domain(const char *p, int fallback_trigger)
 {
     int rc;
     find_domain(p);
     rc=libxl_domain_reboot(ctx, domid);
-    if (rc) {
-        if (rc == ERROR_NOPARAVIRT) {
+    if (rc == ERROR_NOPARAVIRT) {
+        if (fallback_trigger) {
+            fprintf(stderr, "PV control interface not available:"
+                    " sending ACPI reset button event.\n");
+            rc = libxl_send_trigger(ctx, domid, LIBXL_TRIGGER_RESET, 0);
+        } else {
             fprintf(stderr, "PV control interface not available:"
                     " external graceful reboot not possible.\n");
-            fprintf(stderr, "Use \"xl button-press <dom> power\" or"
-                    " \"xl destroy <dom>\".\n");
+            fprintf(stderr, "Use \"-F\" to fallback to ACPI reset event.\n");
         }
-        fprintf(stderr,"reboot failed (rc=%d)\n",rc);exit(-1); }
+    }
+    if (rc) {
+        fprintf(stderr,"reboot failed (rc=%d)\n",rc);exit(-1);
+    }
 }
 
 static void list_domains_details(const libxl_dominfo *info, int nb_domain)
@@ -3277,29 +3288,41 @@
 {
     int opt;
     int wait = 0;
-
-    while ((opt = def_getopt(argc, argv, "w", "shutdown", 1)) != -1) {
+    int fallback_trigger = 0;
+
+    while ((opt = def_getopt(argc, argv, "wF", "shutdown", 1)) != -1) {
         switch (opt) {
         case 0: case 2:
             return opt;
         case 'w':
             wait = 1;
             break;
+        case 'F':
+            fallback_trigger = 1;
+            break;
         }
     }
 
-    shutdown_domain(argv[optind], wait);
+    shutdown_domain(argv[optind], wait, fallback_trigger);
     return 0;
 }
 
 int main_reboot(int argc, char **argv)
 {
     int opt;
-
-    if ((opt = def_getopt(argc, argv, "", "reboot", 1)) != -1)
-        return opt;
-
-    reboot_domain(argv[optind]);
+    int fallback_trigger = 0;
+
+    while ((opt = def_getopt(argc, argv, "F", "reboot", 1)) != -1) {
+        switch (opt) {
+        case 0: case 2:
+            return opt;
+        case 'F':
+            fallback_trigger = 1;
+            break;
+        }
+    }
+
+    reboot_domain(argv[optind], fallback_trigger);
     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 Feb 03 21:58:57 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:58:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9l-0008QI-Ni; Fri, 03 Feb 2012 21:58:57 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9k-0008LK-HH
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:56 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1328306328!10079723!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12974 invoked from network); 3 Feb 2012 21:58:50 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:50 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9c-0001pw-MV
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:48 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9b-0003HB-GZ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:48 +0000
Message-Id: <E1RtR9b-0003HB-GZ@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:45 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: allow enable automatic fallback
	to ACPI events if PV control not available.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328027679 0
# Node ID a91aa7a582fb0e13b0782f7d17c249d4b89dddc7
# Parent  1d063727559851f6950583c33d201f786327657f
xl: allow enable automatic fallback to ACPI events if PV control not available.

Add a -F (fallbacks) option to xl destroy|reboot to cause an ACPI shutdown or
reset event to be sent to the guest in the event that the guest does not
support the PV control interface.

This is not the default because the response to these triggers is an
guest-internal configuration.

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


diff -r 1d0637275598 -r a91aa7a582fb docs/man/xl.pod.1
--- a/docs/man/xl.pod.1	Tue Jan 31 16:34:39 2012 +0000
+++ b/docs/man/xl.pod.1	Tue Jan 31 16:34:39 2012 +0000
@@ -365,13 +365,28 @@
 
 For HVM domains this requires PV drivers to be installed in your guest
 OS. If PV drivers are not present but you have configured the guest OS
-to behave appropriately you may be able to use the I<button-press>
-subcommand to trigger a power button press.
+to behave appropriately you may be able to use the I<-F> option
+trigger a reset button press.
 
 The behavior of what happens to a domain when it reboots is set by the
 B<on_reboot> parameter of the domain configuration file when the
 domain was created.
 
+B<OPTIONS>
+
+=over 4
+
+=item B<-F>
+
+If the guest does not support PV reboot control then fallback to
+sending an ACPI power event (equivalent to the I<reset> option to
+I<trigger>.
+
+You should ensure that the guest is configured to behave as expected
+in response to this event.
+
+=back
+
 =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.
@@ -435,8 +450,8 @@
 
 For HVM domains this requires PV drivers to be installed in your guest
 OS. If PV drivers are not present but you have configured the guest OS
-to behave appropriately you may be able to use the I<button-press>
-subcommand to trigger a power button press.
+to behave appropriately you may be able to use the I<-F> option
+trigger a power button press.
 
 The command returns immediately after signally the domain unless that
 B<-w> flag is used.
@@ -453,6 +468,15 @@
 
 Wait for the domain to complete shutdown before returning.
 
+=item B<-F>
+
+If the guest does not support PV shutdown control then fallback to
+sending an ACPI power event (equivalent to the I<power> option to
+I<trigger>.
+
+You should ensure that the guest is configured to behave as expected
+in response to this event.
+
 =back
 
 =item B<sysrq> I<domain-id> I<letter>
diff -r 1d0637275598 -r a91aa7a582fb tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jan 31 16:34:39 2012 +0000
@@ -2427,20 +2427,25 @@
     if (rc) { fprintf(stderr,"destroy failed (rc=%d)\n",rc); exit(-1); }
 }
 
-static void shutdown_domain(const char *p, int wait)
+static void shutdown_domain(const char *p, int wait, int fallback_trigger)
 {
     int rc;
     libxl_event *event;
 
     find_domain(p);
     rc=libxl_domain_shutdown(ctx, domid);
-    if (rc) {
-        if (rc == ERROR_NOPARAVIRT) {
+    if (rc == ERROR_NOPARAVIRT) {
+        if (fallback_trigger) {
+            fprintf(stderr, "PV control interface not available:"
+                    " sending ACPI power button event.\n");
+            rc = libxl_send_trigger(ctx, domid, LIBXL_TRIGGER_POWER, 0);
+        } else {
             fprintf(stderr, "PV control interface not available:"
                     " external graceful shutdown not possible.\n");
-            fprintf(stderr, "Use \"xl button-press <dom> power\" or"
-                    " \"xl destroy <dom>\".\n");
+            fprintf(stderr, "Use \"-F\" to fallback to ACPI power event.\n");
         }
+    }
+    if (rc) {
         fprintf(stderr,"shutdown failed (rc=%d)\n",rc);exit(-1);
     }
 
@@ -2481,19 +2486,25 @@
     }
 }
 
-static void reboot_domain(const char *p)
+static void reboot_domain(const char *p, int fallback_trigger)
 {
     int rc;
     find_domain(p);
     rc=libxl_domain_reboot(ctx, domid);
-    if (rc) {
-        if (rc == ERROR_NOPARAVIRT) {
+    if (rc == ERROR_NOPARAVIRT) {
+        if (fallback_trigger) {
+            fprintf(stderr, "PV control interface not available:"
+                    " sending ACPI reset button event.\n");
+            rc = libxl_send_trigger(ctx, domid, LIBXL_TRIGGER_RESET, 0);
+        } else {
             fprintf(stderr, "PV control interface not available:"
                     " external graceful reboot not possible.\n");
-            fprintf(stderr, "Use \"xl button-press <dom> power\" or"
-                    " \"xl destroy <dom>\".\n");
+            fprintf(stderr, "Use \"-F\" to fallback to ACPI reset event.\n");
         }
-        fprintf(stderr,"reboot failed (rc=%d)\n",rc);exit(-1); }
+    }
+    if (rc) {
+        fprintf(stderr,"reboot failed (rc=%d)\n",rc);exit(-1);
+    }
 }
 
 static void list_domains_details(const libxl_dominfo *info, int nb_domain)
@@ -3277,29 +3288,41 @@
 {
     int opt;
     int wait = 0;
-
-    while ((opt = def_getopt(argc, argv, "w", "shutdown", 1)) != -1) {
+    int fallback_trigger = 0;
+
+    while ((opt = def_getopt(argc, argv, "wF", "shutdown", 1)) != -1) {
         switch (opt) {
         case 0: case 2:
             return opt;
         case 'w':
             wait = 1;
             break;
+        case 'F':
+            fallback_trigger = 1;
+            break;
         }
     }
 
-    shutdown_domain(argv[optind], wait);
+    shutdown_domain(argv[optind], wait, fallback_trigger);
     return 0;
 }
 
 int main_reboot(int argc, char **argv)
 {
     int opt;
-
-    if ((opt = def_getopt(argc, argv, "", "reboot", 1)) != -1)
-        return opt;
-
-    reboot_domain(argv[optind]);
+    int fallback_trigger = 0;
+
+    while ((opt = def_getopt(argc, argv, "F", "reboot", 1)) != -1) {
+        switch (opt) {
+        case 0: case 2:
+            return opt;
+        case 'F':
+            fallback_trigger = 1;
+            break;
+        }
+    }
+
+    reboot_domain(argv[optind], fallback_trigger);
     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 Feb 03 21:59:02 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9q-0008VO-7k; Fri, 03 Feb 2012 21:59:02 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9n-0008Nu-SW
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:00 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-182.messagelabs.com!1328306332!13586194!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17516 invoked from network); 3 Feb 2012 21:58:53 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:53 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9f-0001q4-Pq
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:51 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9d-0003Hu-KA
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:51 +0000
Message-Id: <E1RtR9d-0003Hu-KA@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:48 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Remove p2m_ram_paging_in
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328185354 0
# Node ID 1f8dd56dacdc7004bbe712c984e2c759fcd38696
# Parent  a91aa7a582fb0e13b0782f7d17c249d4b89dddc7
x86/mm: Remove p2m_ram_paging_in

This state in the paging state machine became unnecessary after the last
few updates.

Once eliminated, rename p2m_ram_paging_in_start to p2m_ram_paging_in.

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 a91aa7a582fb -r 1f8dd56dacdc xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/xen/arch/x86/mm.c	Thu Feb 02 12:22:34 2012 +0000
@@ -3573,7 +3573,7 @@
                         rc = -ENOENT;
                         break;
                     }
-                    else if ( p2m_ram_paging_in_start == l1e_p2mt && 
+                    else if ( p2m_ram_paging_in == l1e_p2mt && 
                                 !mfn_valid(l1emfn) )
                     {
                         put_gfn(pg_owner, l1egfn);
@@ -3622,7 +3622,7 @@
                         rc = -ENOENT;
                         break;
                     }
-                    else if ( p2m_ram_paging_in_start == l2e_p2mt && 
+                    else if ( p2m_ram_paging_in == l2e_p2mt && 
                                 !mfn_valid(l2emfn) )
                     {
                         put_gfn(pg_owner, l2egfn);
@@ -3657,7 +3657,7 @@
                         rc = -ENOENT;
                         break;
                     }
-                    else if ( p2m_ram_paging_in_start == l3e_p2mt && 
+                    else if ( p2m_ram_paging_in == l3e_p2mt && 
                                 !mfn_valid(l3emfn) )
                     {
                         put_gfn(pg_owner, l3egfn);
@@ -3692,7 +3692,7 @@
                         rc = -ENOENT;
                         break;
                     }
-                    else if ( p2m_ram_paging_in_start == l4e_p2mt && 
+                    else if ( p2m_ram_paging_in == l4e_p2mt && 
                                 !mfn_valid(l4emfn) )
                     {
                         put_gfn(pg_owner, l4egfn);
diff -r a91aa7a582fb -r 1f8dd56dacdc xen/arch/x86/mm/p2m-ept.c
--- a/xen/arch/x86/mm/p2m-ept.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/xen/arch/x86/mm/p2m-ept.c	Thu Feb 02 12:22:34 2012 +0000
@@ -82,7 +82,6 @@
         case p2m_ram_paging_out:
         case p2m_ram_paged:
         case p2m_ram_paging_in:
-        case p2m_ram_paging_in_start:
         default:
             entry->r = entry->w = entry->x = 0;
             break;
@@ -381,7 +380,7 @@
         old_entry = *ept_entry;
 
         if ( mfn_valid(mfn_x(mfn)) || direct_mmio || p2m_is_paged(p2mt) ||
-             (p2mt == p2m_ram_paging_in_start) )
+             (p2mt == p2m_ram_paging_in) )
         {
             /* Construct the new entry, and then write it once */
             new_entry.emt = epte_get_entry_emt(p2m->domain, gfn, mfn, &ipat,
diff -r a91aa7a582fb -r 1f8dd56dacdc xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Thu Feb 02 12:22:34 2012 +0000
@@ -932,7 +932,7 @@
         if ( p2mt == p2m_ram_paging_out )
             req.flags |= MEM_EVENT_FLAG_EVICT_FAIL;
 
-        set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2m_ram_paging_in_start, a);
+        set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2m_ram_paging_in, a);
     }
     p2m_unlock(p2m);
 
@@ -991,7 +991,7 @@
 
     ret = -ENOENT;
     /* Allow missing pages */
-    if ( (p2mt != p2m_ram_paging_in_start) && (p2mt != p2m_ram_paged) )
+    if ( (p2mt != p2m_ram_paging_in) && (p2mt != p2m_ram_paged) )
         goto out;
 
     /* Allocate a page if the gfn does not have one yet */
@@ -1083,8 +1083,7 @@
             mfn = p2m->get_entry(p2m, rsp.gfn, &p2mt, &a, p2m_query, NULL);
             /* Allow only pages which were prepared properly, or pages which
              * were nominated but not evicted */
-            if ( mfn_valid(mfn) && 
-                 (p2mt == p2m_ram_paging_in || p2mt == p2m_ram_paging_in_start) )
+            if ( mfn_valid(mfn) && (p2mt == p2m_ram_paging_in) )
             {
                 set_p2m_entry(p2m, rsp.gfn, mfn, PAGE_ORDER_4K, 
                                 paging_mode_log_dirty(d) ? p2m_ram_logdirty : 
diff -r a91aa7a582fb -r 1f8dd56dacdc xen/include/asm-x86/p2m.h
--- a/xen/include/asm-x86/p2m.h	Tue Jan 31 16:34:39 2012 +0000
+++ b/xen/include/asm-x86/p2m.h	Thu Feb 02 12:22:34 2012 +0000
@@ -82,9 +82,8 @@
     p2m_ram_paging_out = 9,       /* Memory that is being paged out */
     p2m_ram_paged = 10,           /* Memory that has been paged out */
     p2m_ram_paging_in = 11,       /* Memory that is being paged in */
-    p2m_ram_paging_in_start = 12, /* Memory that is being paged in */
-    p2m_ram_shared = 13,          /* Shared or sharable memory */
-    p2m_ram_broken = 14,          /* Broken page, access cause domain crash */
+    p2m_ram_shared = 12,          /* Shared or sharable memory */
+    p2m_ram_broken = 13,          /* Broken page, access cause domain crash */
 } p2m_type_t;
 
 /*
@@ -131,7 +130,6 @@
                        | p2m_to_mask(p2m_ram_ro)              \
                        | p2m_to_mask(p2m_ram_paging_out)      \
                        | p2m_to_mask(p2m_ram_paged)           \
-                       | p2m_to_mask(p2m_ram_paging_in_start) \
                        | p2m_to_mask(p2m_ram_paging_in)       \
                        | p2m_to_mask(p2m_ram_shared))
 
@@ -158,7 +156,6 @@
 
 #define P2M_PAGING_TYPES (p2m_to_mask(p2m_ram_paging_out)        \
                           | p2m_to_mask(p2m_ram_paged)           \
-                          | p2m_to_mask(p2m_ram_paging_in_start) \
                           | p2m_to_mask(p2m_ram_paging_in))
 
 #define P2M_PAGED_TYPES (p2m_to_mask(p2m_ram_paged))

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:02 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9q-0008VO-7k; Fri, 03 Feb 2012 21:59:02 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9n-0008Nu-SW
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:00 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-182.messagelabs.com!1328306332!13586194!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17516 invoked from network); 3 Feb 2012 21:58:53 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:53 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9f-0001q4-Pq
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:51 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9d-0003Hu-KA
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:51 +0000
Message-Id: <E1RtR9d-0003Hu-KA@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:48 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Remove p2m_ram_paging_in
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328185354 0
# Node ID 1f8dd56dacdc7004bbe712c984e2c759fcd38696
# Parent  a91aa7a582fb0e13b0782f7d17c249d4b89dddc7
x86/mm: Remove p2m_ram_paging_in

This state in the paging state machine became unnecessary after the last
few updates.

Once eliminated, rename p2m_ram_paging_in_start to p2m_ram_paging_in.

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 a91aa7a582fb -r 1f8dd56dacdc xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/xen/arch/x86/mm.c	Thu Feb 02 12:22:34 2012 +0000
@@ -3573,7 +3573,7 @@
                         rc = -ENOENT;
                         break;
                     }
-                    else if ( p2m_ram_paging_in_start == l1e_p2mt && 
+                    else if ( p2m_ram_paging_in == l1e_p2mt && 
                                 !mfn_valid(l1emfn) )
                     {
                         put_gfn(pg_owner, l1egfn);
@@ -3622,7 +3622,7 @@
                         rc = -ENOENT;
                         break;
                     }
-                    else if ( p2m_ram_paging_in_start == l2e_p2mt && 
+                    else if ( p2m_ram_paging_in == l2e_p2mt && 
                                 !mfn_valid(l2emfn) )
                     {
                         put_gfn(pg_owner, l2egfn);
@@ -3657,7 +3657,7 @@
                         rc = -ENOENT;
                         break;
                     }
-                    else if ( p2m_ram_paging_in_start == l3e_p2mt && 
+                    else if ( p2m_ram_paging_in == l3e_p2mt && 
                                 !mfn_valid(l3emfn) )
                     {
                         put_gfn(pg_owner, l3egfn);
@@ -3692,7 +3692,7 @@
                         rc = -ENOENT;
                         break;
                     }
-                    else if ( p2m_ram_paging_in_start == l4e_p2mt && 
+                    else if ( p2m_ram_paging_in == l4e_p2mt && 
                                 !mfn_valid(l4emfn) )
                     {
                         put_gfn(pg_owner, l4egfn);
diff -r a91aa7a582fb -r 1f8dd56dacdc xen/arch/x86/mm/p2m-ept.c
--- a/xen/arch/x86/mm/p2m-ept.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/xen/arch/x86/mm/p2m-ept.c	Thu Feb 02 12:22:34 2012 +0000
@@ -82,7 +82,6 @@
         case p2m_ram_paging_out:
         case p2m_ram_paged:
         case p2m_ram_paging_in:
-        case p2m_ram_paging_in_start:
         default:
             entry->r = entry->w = entry->x = 0;
             break;
@@ -381,7 +380,7 @@
         old_entry = *ept_entry;
 
         if ( mfn_valid(mfn_x(mfn)) || direct_mmio || p2m_is_paged(p2mt) ||
-             (p2mt == p2m_ram_paging_in_start) )
+             (p2mt == p2m_ram_paging_in) )
         {
             /* Construct the new entry, and then write it once */
             new_entry.emt = epte_get_entry_emt(p2m->domain, gfn, mfn, &ipat,
diff -r a91aa7a582fb -r 1f8dd56dacdc xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Tue Jan 31 16:34:39 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Thu Feb 02 12:22:34 2012 +0000
@@ -932,7 +932,7 @@
         if ( p2mt == p2m_ram_paging_out )
             req.flags |= MEM_EVENT_FLAG_EVICT_FAIL;
 
-        set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2m_ram_paging_in_start, a);
+        set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2m_ram_paging_in, a);
     }
     p2m_unlock(p2m);
 
@@ -991,7 +991,7 @@
 
     ret = -ENOENT;
     /* Allow missing pages */
-    if ( (p2mt != p2m_ram_paging_in_start) && (p2mt != p2m_ram_paged) )
+    if ( (p2mt != p2m_ram_paging_in) && (p2mt != p2m_ram_paged) )
         goto out;
 
     /* Allocate a page if the gfn does not have one yet */
@@ -1083,8 +1083,7 @@
             mfn = p2m->get_entry(p2m, rsp.gfn, &p2mt, &a, p2m_query, NULL);
             /* Allow only pages which were prepared properly, or pages which
              * were nominated but not evicted */
-            if ( mfn_valid(mfn) && 
-                 (p2mt == p2m_ram_paging_in || p2mt == p2m_ram_paging_in_start) )
+            if ( mfn_valid(mfn) && (p2mt == p2m_ram_paging_in) )
             {
                 set_p2m_entry(p2m, rsp.gfn, mfn, PAGE_ORDER_4K, 
                                 paging_mode_log_dirty(d) ? p2m_ram_logdirty : 
diff -r a91aa7a582fb -r 1f8dd56dacdc xen/include/asm-x86/p2m.h
--- a/xen/include/asm-x86/p2m.h	Tue Jan 31 16:34:39 2012 +0000
+++ b/xen/include/asm-x86/p2m.h	Thu Feb 02 12:22:34 2012 +0000
@@ -82,9 +82,8 @@
     p2m_ram_paging_out = 9,       /* Memory that is being paged out */
     p2m_ram_paged = 10,           /* Memory that has been paged out */
     p2m_ram_paging_in = 11,       /* Memory that is being paged in */
-    p2m_ram_paging_in_start = 12, /* Memory that is being paged in */
-    p2m_ram_shared = 13,          /* Shared or sharable memory */
-    p2m_ram_broken = 14,          /* Broken page, access cause domain crash */
+    p2m_ram_shared = 12,          /* Shared or sharable memory */
+    p2m_ram_broken = 13,          /* Broken page, access cause domain crash */
 } p2m_type_t;
 
 /*
@@ -131,7 +130,6 @@
                        | p2m_to_mask(p2m_ram_ro)              \
                        | p2m_to_mask(p2m_ram_paging_out)      \
                        | p2m_to_mask(p2m_ram_paged)           \
-                       | p2m_to_mask(p2m_ram_paging_in_start) \
                        | p2m_to_mask(p2m_ram_paging_in)       \
                        | p2m_to_mask(p2m_ram_shared))
 
@@ -158,7 +156,6 @@
 
 #define P2M_PAGING_TYPES (p2m_to_mask(p2m_ram_paging_out)        \
                           | p2m_to_mask(p2m_ram_paged)           \
-                          | p2m_to_mask(p2m_ram_paging_in_start) \
                           | p2m_to_mask(p2m_ram_paging_in))
 
 #define P2M_PAGED_TYPES (p2m_to_mask(p2m_ram_paged))

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:03 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9r-000064-GB; Fri, 03 Feb 2012 21:59:03 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9q-0008W5-QE
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:03 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1328306293!61471913!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25735 invoked from network); 3 Feb 2012 21:58:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9o-0001qT-CX
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:00 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9m-0003Km-1t
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:59 +0000
Message-Id: <E1RtR9m-0003Km-1t@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:56 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Fix paging stats
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328185354 0
# Node ID ac6c596e8439a070212c34379446204818c06884
# Parent  030db911083f44dce966709991eae0d3dd405bf5
x86/mm: Fix paging stats

There are several corner cases in which a page is paged back in, not by paging,
and the stats are not properly updated.

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 030db911083f -r ac6c596e8439 xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Thu Feb 02 12:22:34 2012 +0000
+++ b/xen/arch/x86/mm/mem_sharing.c	Thu Feb 02 12:22:34 2012 +0000
@@ -878,8 +878,12 @@
         ret = -ENOENT;
         mem_sharing_gfn_destroy(cd, gfn_info);
         put_page_and_type(spage);
-    } else
+    } else {
         ret = 0;
+        /* There is a chance we're plugging a hole where a paged out page was */
+        if ( p2m_is_paging(cmfn_type) && (cmfn_type != p2m_ram_paging_out) )
+            atomic_dec(&cd->paged_pages);
+    }
 
     atomic_inc(&nr_saved_mfns);
 
diff -r 030db911083f -r ac6c596e8439 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Thu Feb 02 12:22:34 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Thu Feb 02 12:22:34 2012 +0000
@@ -499,6 +499,11 @@
             /* Count how man PoD entries we'll be replacing if successful */
             pod_count++;
         }
+        else if ( p2m_is_paging(ot) && (ot != p2m_ram_paging_out) )
+        {
+            /* We're plugging a hole in the physmap where a paged out page was */
+            atomic_dec(&d->paged_pages);
+        }
     }
 
     /* Then, look for m->p mappings for this range and deal with them */
@@ -856,7 +861,8 @@
  * released by the guest. The pager is supposed to drop its reference of the
  * gfn.
  */
-void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn)
+void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn,
+                                p2m_type_t p2mt)
 {
     mem_event_request_t req;
 
@@ -875,6 +881,10 @@
     req.flags = MEM_EVENT_FLAG_DROP_PAGE;
 
     mem_event_put_request(d, &d->mem_event->paging, &req);
+
+    /* Update stats unless the page hasn't yet been evicted */
+    if ( p2mt != p2m_ram_paging_out )
+        atomic_dec(&d->paged_pages);
 }
 
 /**
diff -r 030db911083f -r ac6c596e8439 xen/common/memory.c
--- a/xen/common/memory.c	Thu Feb 02 12:22:34 2012 +0000
+++ b/xen/common/memory.c	Thu Feb 02 12:22:34 2012 +0000
@@ -166,7 +166,7 @@
     if ( unlikely(p2m_is_paging(p2mt)) )
     {
         guest_physmap_remove_page(d, gmfn, mfn, 0);
-        p2m_mem_paging_drop_page(d, gmfn);
+        p2m_mem_paging_drop_page(d, gmfn, p2mt);
         put_gfn(d, gmfn);
         return 1;
     }
diff -r 030db911083f -r ac6c596e8439 xen/include/asm-x86/p2m.h
--- a/xen/include/asm-x86/p2m.h	Thu Feb 02 12:22:34 2012 +0000
+++ b/xen/include/asm-x86/p2m.h	Thu Feb 02 12:22:34 2012 +0000
@@ -475,7 +475,8 @@
 /* Evict a frame */
 int p2m_mem_paging_evict(struct domain *d, unsigned long gfn);
 /* Tell xenpaging to drop a paged out frame */
-void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn);
+void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn, 
+                                p2m_type_t p2mt);
 /* Start populating a paged out frame */
 void p2m_mem_paging_populate(struct domain *d, unsigned long gfn);
 /* Prepare the p2m for paging a frame in */
@@ -483,7 +484,8 @@
 /* Resume normal operation (in case a domain was paused) */
 void p2m_mem_paging_resume(struct domain *d);
 #else
-static inline void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn)
+static inline void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn,
+                                            p2m_type_t p2mt)
 { }
 static inline void p2m_mem_paging_populate(struct domain *d, unsigned long gfn)
 { }

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:03 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9r-000064-GB; Fri, 03 Feb 2012 21:59:03 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9q-0008W5-QE
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:03 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1328306293!61471913!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25735 invoked from network); 3 Feb 2012 21:58:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9o-0001qT-CX
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:00 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9m-0003Km-1t
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:59 +0000
Message-Id: <E1RtR9m-0003Km-1t@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:56 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Fix paging stats
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328185354 0
# Node ID ac6c596e8439a070212c34379446204818c06884
# Parent  030db911083f44dce966709991eae0d3dd405bf5
x86/mm: Fix paging stats

There are several corner cases in which a page is paged back in, not by paging,
and the stats are not properly updated.

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 030db911083f -r ac6c596e8439 xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Thu Feb 02 12:22:34 2012 +0000
+++ b/xen/arch/x86/mm/mem_sharing.c	Thu Feb 02 12:22:34 2012 +0000
@@ -878,8 +878,12 @@
         ret = -ENOENT;
         mem_sharing_gfn_destroy(cd, gfn_info);
         put_page_and_type(spage);
-    } else
+    } else {
         ret = 0;
+        /* There is a chance we're plugging a hole where a paged out page was */
+        if ( p2m_is_paging(cmfn_type) && (cmfn_type != p2m_ram_paging_out) )
+            atomic_dec(&cd->paged_pages);
+    }
 
     atomic_inc(&nr_saved_mfns);
 
diff -r 030db911083f -r ac6c596e8439 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Thu Feb 02 12:22:34 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Thu Feb 02 12:22:34 2012 +0000
@@ -499,6 +499,11 @@
             /* Count how man PoD entries we'll be replacing if successful */
             pod_count++;
         }
+        else if ( p2m_is_paging(ot) && (ot != p2m_ram_paging_out) )
+        {
+            /* We're plugging a hole in the physmap where a paged out page was */
+            atomic_dec(&d->paged_pages);
+        }
     }
 
     /* Then, look for m->p mappings for this range and deal with them */
@@ -856,7 +861,8 @@
  * released by the guest. The pager is supposed to drop its reference of the
  * gfn.
  */
-void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn)
+void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn,
+                                p2m_type_t p2mt)
 {
     mem_event_request_t req;
 
@@ -875,6 +881,10 @@
     req.flags = MEM_EVENT_FLAG_DROP_PAGE;
 
     mem_event_put_request(d, &d->mem_event->paging, &req);
+
+    /* Update stats unless the page hasn't yet been evicted */
+    if ( p2mt != p2m_ram_paging_out )
+        atomic_dec(&d->paged_pages);
 }
 
 /**
diff -r 030db911083f -r ac6c596e8439 xen/common/memory.c
--- a/xen/common/memory.c	Thu Feb 02 12:22:34 2012 +0000
+++ b/xen/common/memory.c	Thu Feb 02 12:22:34 2012 +0000
@@ -166,7 +166,7 @@
     if ( unlikely(p2m_is_paging(p2mt)) )
     {
         guest_physmap_remove_page(d, gmfn, mfn, 0);
-        p2m_mem_paging_drop_page(d, gmfn);
+        p2m_mem_paging_drop_page(d, gmfn, p2mt);
         put_gfn(d, gmfn);
         return 1;
     }
diff -r 030db911083f -r ac6c596e8439 xen/include/asm-x86/p2m.h
--- a/xen/include/asm-x86/p2m.h	Thu Feb 02 12:22:34 2012 +0000
+++ b/xen/include/asm-x86/p2m.h	Thu Feb 02 12:22:34 2012 +0000
@@ -475,7 +475,8 @@
 /* Evict a frame */
 int p2m_mem_paging_evict(struct domain *d, unsigned long gfn);
 /* Tell xenpaging to drop a paged out frame */
-void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn);
+void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn, 
+                                p2m_type_t p2mt);
 /* Start populating a paged out frame */
 void p2m_mem_paging_populate(struct domain *d, unsigned long gfn);
 /* Prepare the p2m for paging a frame in */
@@ -483,7 +484,8 @@
 /* Resume normal operation (in case a domain was paused) */
 void p2m_mem_paging_resume(struct domain *d);
 #else
-static inline void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn)
+static inline void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn,
+                                            p2m_type_t p2mt)
 { }
 static inline void p2m_mem_paging_populate(struct domain *d, unsigned long gfn)
 { }

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:03 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9r-00005s-DT; Fri, 03 Feb 2012 21:59:03 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9q-0008Po-HB
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:02 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1328306335!6783461!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21360 invoked from network); 3 Feb 2012 21:58:56 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:56 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9j-0001qI-3a
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:55 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9g-0003Ir-CE
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:53 +0000
Message-Id: <E1RtR9g-0003Ir-CE@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:51 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Don't fail to nominate for
	paging on type flag, rather look at type count
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328185354 0
# Node ID b2bfef17db293905d1d813765904ddc03ba87334
# Parent  1f8dd56dacdc7004bbe712c984e2c759fcd38696
x86/mm: Don't fail to nominate for paging on type flag, rather look at type count

Xen doesn't clean the type flag when dropping the type count for a page to
zero. So, looking at the type flag when nominating a page for paging it's
incorrect. Look at the type count instead.

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


diff -r 1f8dd56dacdc -r b2bfef17db29 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Thu Feb 02 12:22:34 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Thu Feb 02 12:22:34 2012 +0000
@@ -759,7 +759,7 @@
          (1 | PGC_allocated) )
         goto out;
 
-    if ( (page->u.inuse.type_info & PGT_type_mask) != PGT_none )
+    if ( (page->u.inuse.type_info & PGT_count_mask) != 0 )
         goto out;
 
     /* Fix p2m entry */
@@ -820,7 +820,7 @@
          (2 | PGC_allocated) )
         goto out_put;
 
-    if ( (page->u.inuse.type_info & PGT_type_mask) != PGT_none )
+    if ( (page->u.inuse.type_info & PGT_count_mask) != 0 )
         goto out_put;
 
     /* Decrement guest domain's ref count of the page */

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:03 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9r-00005s-DT; Fri, 03 Feb 2012 21:59:03 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9q-0008Po-HB
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:02 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1328306335!6783461!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21360 invoked from network); 3 Feb 2012 21:58:56 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:56 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9j-0001qI-3a
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:55 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9g-0003Ir-CE
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:53 +0000
Message-Id: <E1RtR9g-0003Ir-CE@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:51 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Don't fail to nominate for
	paging on type flag, rather look at type count
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328185354 0
# Node ID b2bfef17db293905d1d813765904ddc03ba87334
# Parent  1f8dd56dacdc7004bbe712c984e2c759fcd38696
x86/mm: Don't fail to nominate for paging on type flag, rather look at type count

Xen doesn't clean the type flag when dropping the type count for a page to
zero. So, looking at the type flag when nominating a page for paging it's
incorrect. Look at the type count instead.

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


diff -r 1f8dd56dacdc -r b2bfef17db29 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Thu Feb 02 12:22:34 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Thu Feb 02 12:22:34 2012 +0000
@@ -759,7 +759,7 @@
          (1 | PGC_allocated) )
         goto out;
 
-    if ( (page->u.inuse.type_info & PGT_type_mask) != PGT_none )
+    if ( (page->u.inuse.type_info & PGT_count_mask) != 0 )
         goto out;
 
     /* Fix p2m entry */
@@ -820,7 +820,7 @@
          (2 | PGC_allocated) )
         goto out_put;
 
-    if ( (page->u.inuse.type_info & PGT_type_mask) != PGT_none )
+    if ( (page->u.inuse.type_info & PGT_count_mask) != 0 )
         goto out_put;
 
     /* Decrement guest domain's ref count of the page */

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:05 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9t-00008U-J1; Fri, 03 Feb 2012 21:59:05 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9s-0008Rf-4u
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:04 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-216.messagelabs.com!1328306336!12863352!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6103 invoked from network); 3 Feb 2012 21:58:57 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:57 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9k-0001qN-Pf
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:56 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9j-0003Jt-Os
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:56 +0000
Message-Id: <E1RtR9j-0003Jt-Os@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:55 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Reorder locks used by shadow
	code in anticipation of synchronized p2m lookups
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328185354 0
# Node ID 030db911083f44dce966709991eae0d3dd405bf5
# Parent  b2bfef17db293905d1d813765904ddc03ba87334
x86/mm: Reorder locks used by shadow code in anticipation of synchronized p2m lookups

Currently, mm-locks.h enforces a strict ordering between locks in the mm
layer lest there be an inversion in the order locks are taken and thus
the risk of deadlock.

Once p2m lookups becoming synchronized, get_gfn* calls take the p2m lock, and a
new set of inversion arises.  Reorder some of the locks in the shadow code so
that even in this case no deadlocks happen.

After this, synchronized p2m lookups are in principle ready to be enabled in
shadow mode.

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 b2bfef17db29 -r 030db911083f xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c	Thu Feb 02 12:22:34 2012 +0000
+++ b/xen/arch/x86/mm/shadow/common.c	Thu Feb 02 12:22:34 2012 +0000
@@ -3609,6 +3609,8 @@
             || end_pfn >= p2m->max_mapped_pfn)
         return -EINVAL;
 
+    /* We perform p2m lookups, so lock the p2m upfront to avoid deadlock */
+    p2m_lock(p2m_get_hostp2m(d));
     paging_lock(d);
 
     if ( dirty_vram && (!nr ||
@@ -3782,6 +3784,7 @@
 
 out:
     paging_unlock(d);
+    p2m_unlock(p2m_get_hostp2m(d));
     return rc;
 }
 
diff -r b2bfef17db29 -r 030db911083f xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c	Thu Feb 02 12:22:34 2012 +0000
+++ b/xen/arch/x86/mm/shadow/multi.c	Thu Feb 02 12:22:34 2012 +0000
@@ -2444,7 +2444,7 @@
     perfc_incr(shadow_validate_gl1e_calls);
 
     gfn = guest_l1e_get_gfn(new_gl1e);
-    gmfn = get_gfn_query(v->domain, gfn, &p2mt);
+    gmfn = get_gfn_query_unlocked(v->domain, gfn_x(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);
@@ -2466,7 +2466,6 @@
     }
 #endif /* OOS */
 
-    put_gfn(v->domain, gfn_x(gfn));
     return result;
 }
 
@@ -4715,8 +4714,6 @@
     unsigned long l3gfn;
     mfn_t l3mfn;
 
-    paging_lock(v->domain);
-
     gcr3 = (v->arch.hvm_vcpu.guest_cr[3]);
     /* fast path: the pagetable belongs to the current context */
     if ( gcr3 == gpa )
@@ -4728,8 +4725,11 @@
     {
         printk(XENLOG_DEBUG "sh_pagetable_dying: gpa not valid %"PRIpaddr"\n",
                gpa);
-        goto out;
+        goto out_put_gfn;
     }
+
+    paging_lock(v->domain);
+
     if ( !fast_path )
     {
         gl3pa = sh_map_domain_page(l3mfn);
@@ -4770,11 +4770,11 @@
 
     v->arch.paging.shadow.pagetable_dying = 1;
 
-out:
     if ( !fast_path )
         unmap_domain_page(gl3pa);
+    paging_unlock(v->domain);
+out_put_gfn:
     put_gfn(v->domain, l3gfn);
-    paging_unlock(v->domain);
 }
 #else
 static void sh_pagetable_dying(struct vcpu *v, paddr_t gpa)
@@ -4782,15 +4782,14 @@
     mfn_t smfn, gmfn;
     p2m_type_t p2mt;
 
+    gmfn = get_gfn_query(v->domain, _gfn(gpa >> PAGE_SHIFT), &p2mt);
     paging_lock(v->domain);
 
-    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) )
     {
@@ -4808,6 +4807,7 @@
     v->arch.paging.shadow.pagetable_dying = 1;
 
     paging_unlock(v->domain);
+    put_gfn(v->domain, gpa >> PAGE_SHIFT);
 }
 #endif
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:05 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9t-00008U-J1; Fri, 03 Feb 2012 21:59:05 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9s-0008Rf-4u
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:04 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-216.messagelabs.com!1328306336!12863352!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6103 invoked from network); 3 Feb 2012 21:58:57 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:57 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9k-0001qN-Pf
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:56 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9j-0003Jt-Os
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:58:56 +0000
Message-Id: <E1RtR9j-0003Jt-Os@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:58:55 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Reorder locks used by shadow
	code in anticipation of synchronized p2m lookups
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328185354 0
# Node ID 030db911083f44dce966709991eae0d3dd405bf5
# Parent  b2bfef17db293905d1d813765904ddc03ba87334
x86/mm: Reorder locks used by shadow code in anticipation of synchronized p2m lookups

Currently, mm-locks.h enforces a strict ordering between locks in the mm
layer lest there be an inversion in the order locks are taken and thus
the risk of deadlock.

Once p2m lookups becoming synchronized, get_gfn* calls take the p2m lock, and a
new set of inversion arises.  Reorder some of the locks in the shadow code so
that even in this case no deadlocks happen.

After this, synchronized p2m lookups are in principle ready to be enabled in
shadow mode.

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 b2bfef17db29 -r 030db911083f xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c	Thu Feb 02 12:22:34 2012 +0000
+++ b/xen/arch/x86/mm/shadow/common.c	Thu Feb 02 12:22:34 2012 +0000
@@ -3609,6 +3609,8 @@
             || end_pfn >= p2m->max_mapped_pfn)
         return -EINVAL;
 
+    /* We perform p2m lookups, so lock the p2m upfront to avoid deadlock */
+    p2m_lock(p2m_get_hostp2m(d));
     paging_lock(d);
 
     if ( dirty_vram && (!nr ||
@@ -3782,6 +3784,7 @@
 
 out:
     paging_unlock(d);
+    p2m_unlock(p2m_get_hostp2m(d));
     return rc;
 }
 
diff -r b2bfef17db29 -r 030db911083f xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c	Thu Feb 02 12:22:34 2012 +0000
+++ b/xen/arch/x86/mm/shadow/multi.c	Thu Feb 02 12:22:34 2012 +0000
@@ -2444,7 +2444,7 @@
     perfc_incr(shadow_validate_gl1e_calls);
 
     gfn = guest_l1e_get_gfn(new_gl1e);
-    gmfn = get_gfn_query(v->domain, gfn, &p2mt);
+    gmfn = get_gfn_query_unlocked(v->domain, gfn_x(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);
@@ -2466,7 +2466,6 @@
     }
 #endif /* OOS */
 
-    put_gfn(v->domain, gfn_x(gfn));
     return result;
 }
 
@@ -4715,8 +4714,6 @@
     unsigned long l3gfn;
     mfn_t l3mfn;
 
-    paging_lock(v->domain);
-
     gcr3 = (v->arch.hvm_vcpu.guest_cr[3]);
     /* fast path: the pagetable belongs to the current context */
     if ( gcr3 == gpa )
@@ -4728,8 +4725,11 @@
     {
         printk(XENLOG_DEBUG "sh_pagetable_dying: gpa not valid %"PRIpaddr"\n",
                gpa);
-        goto out;
+        goto out_put_gfn;
     }
+
+    paging_lock(v->domain);
+
     if ( !fast_path )
     {
         gl3pa = sh_map_domain_page(l3mfn);
@@ -4770,11 +4770,11 @@
 
     v->arch.paging.shadow.pagetable_dying = 1;
 
-out:
     if ( !fast_path )
         unmap_domain_page(gl3pa);
+    paging_unlock(v->domain);
+out_put_gfn:
     put_gfn(v->domain, l3gfn);
-    paging_unlock(v->domain);
 }
 #else
 static void sh_pagetable_dying(struct vcpu *v, paddr_t gpa)
@@ -4782,15 +4782,14 @@
     mfn_t smfn, gmfn;
     p2m_type_t p2mt;
 
+    gmfn = get_gfn_query(v->domain, _gfn(gpa >> PAGE_SHIFT), &p2mt);
     paging_lock(v->domain);
 
-    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) )
     {
@@ -4808,6 +4807,7 @@
     v->arch.paging.shadow.pagetable_dying = 1;
 
     paging_unlock(v->domain);
+    put_gfn(v->domain, gpa >> PAGE_SHIFT);
 }
 #endif
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:09 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9w-0000BX-MA; Fri, 03 Feb 2012 21:59:08 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9v-0000AE-Pc
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:08 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-27.messagelabs.com!1328306323!51504173!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3888 invoked from network); 3 Feb 2012 21:58:44 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:44 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9t-0001r2-JB
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:05 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9q-0003M7-PE
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:04 +0000
Message-Id: <E1RtR9q-0003M7-PE@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:00 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Make sharing ASSERT check
	more accurate
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328185354 0
# Node ID f5d2642c94f424c56a69eefc41239af3a3a345ce
# Parent  ac6c596e8439a070212c34379446204818c06884
x86/mm: Make sharing ASSERT check more accurate

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


diff -r ac6c596e8439 -r f5d2642c94f4 xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Thu Feb 02 12:22:34 2012 +0000
+++ b/xen/arch/x86/mm/mem_sharing.c	Thu Feb 02 12:22:34 2012 +0000
@@ -197,7 +197,10 @@
         struct page_info* page = mfn_to_page(_mfn(mfn));
         if ( page_get_owner(page) == dom_cow )
         {
-            ASSERT(page->u.inuse.type_info & PGT_type_mask); 
+            /* Count has to be at least two, because we're called
+             * with the mfn locked (1) and this is supposed to be 
+             * a shared page (1). */
+            ASSERT((page->u.inuse.type_info & PGT_count_mask) >= 2); 
             ASSERT(get_gpfn_from_mfn(mfn) == SHARED_M2P_ENTRY); 
             return page;
         }

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:09 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9w-0000BX-MA; Fri, 03 Feb 2012 21:59:08 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9v-0000AE-Pc
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:08 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-27.messagelabs.com!1328306323!51504173!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3888 invoked from network); 3 Feb 2012 21:58:44 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:44 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9t-0001r2-JB
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:05 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9q-0003M7-PE
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:04 +0000
Message-Id: <E1RtR9q-0003M7-PE@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:00 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Make sharing ASSERT check
	more accurate
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328185354 0
# Node ID f5d2642c94f424c56a69eefc41239af3a3a345ce
# Parent  ac6c596e8439a070212c34379446204818c06884
x86/mm: Make sharing ASSERT check more accurate

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


diff -r ac6c596e8439 -r f5d2642c94f4 xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Thu Feb 02 12:22:34 2012 +0000
+++ b/xen/arch/x86/mm/mem_sharing.c	Thu Feb 02 12:22:34 2012 +0000
@@ -197,7 +197,10 @@
         struct page_info* page = mfn_to_page(_mfn(mfn));
         if ( page_get_owner(page) == dom_cow )
         {
-            ASSERT(page->u.inuse.type_info & PGT_type_mask); 
+            /* Count has to be at least two, because we're called
+             * with the mfn locked (1) and this is supposed to be 
+             * a shared page (1). */
+            ASSERT((page->u.inuse.type_info & PGT_count_mask) >= 2); 
             ASSERT(get_gpfn_from_mfn(mfn) == SHARED_M2P_ENTRY); 
             return page;
         }

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:11 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:11 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9z-0000EP-P3; Fri, 03 Feb 2012 21:59:11 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9y-0000D4-J2
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1328306299!52846863!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19112 invoked from network); 3 Feb 2012 21:58:20 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9v-0001rB-MR
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:07 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9u-0003NC-Dq
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:07 +0000
Message-Id: <E1RtR9u-0003NC-Dq@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:05 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Make debug_{gfn, mfn,
	gref} calls to sharing more useful and correct
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328185398 0
# Node ID 23fe4a60190f11efc750af51f55228183f7bb736
# Parent  f5d2642c94f424c56a69eefc41239af3a3a345ce
x86/mm: Make debug_{gfn, mfn, gref} calls to sharing more useful and correct

Have them used locked accesors to the gfn and the underlying shared mfn.

Have them return the number of shared refs to the underlying mfn.

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 f5d2642c94f4 -r 23fe4a60190f xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Thu Feb 02 12:22:34 2012 +0000
+++ b/xen/arch/x86/mm/mem_sharing.c	Thu Feb 02 12:23:18 2012 +0000
@@ -45,13 +45,13 @@
 
 DEFINE_PER_CPU(pg_lock_data_t, __pld);
 
+#define MEM_SHARING_DEBUG(_f, _a...)                                  \
+    debugtrace_printk("mem_sharing_debug: %s(): " _f, __func__, ##_a)
+
 #if MEM_SHARING_AUDIT
 
 static void mem_sharing_audit(void);
 
-#define MEM_SHARING_DEBUG(_f, _a...)                                  \
-    debugtrace_printk("mem_sharing_debug: %s(): " _f, __func__, ##_a)
-
 static struct list_head shr_audit_list;
 static spinlock_t shr_audit_lock;
 DEFINE_RCU_READ_LOCK(shr_audit_read_lock);
@@ -398,111 +398,6 @@
     return 0;
 }
 
-int mem_sharing_debug_mfn(unsigned long mfn)
-{
-    struct page_info *page;
-
-    if ( !mfn_valid(_mfn(mfn)) )
-    {
-        gdprintk(XENLOG_ERR, "Invalid MFN=%lx\n", mfn);
-        return -1;
-    }
-    page = mfn_to_page(_mfn(mfn));
-
-    gdprintk(XENLOG_DEBUG, 
-            "Debug page: MFN=%lx is ci=%lx, ti=%lx, owner_id=%d\n",
-            mfn_x(page_to_mfn(page)), 
-            page->count_info, 
-            page->u.inuse.type_info,
-            page_get_owner(page)->domain_id);
-
-    return 0;
-}
-
-int mem_sharing_debug_gfn(struct domain *d, unsigned long gfn)
-{
-    p2m_type_t p2mt;
-    mfn_t mfn;
-
-    mfn = get_gfn_query_unlocked(d, gfn, &p2mt);
-
-    gdprintk(XENLOG_DEBUG, "Debug for domain=%d, gfn=%lx, ", 
-               d->domain_id, 
-               gfn);
-    return mem_sharing_debug_mfn(mfn_x(mfn));
-}
-
-#define SHGNT_PER_PAGE_V1 (PAGE_SIZE / sizeof(grant_entry_v1_t))
-#define shared_entry_v1(t, e) \
-    ((t)->shared_v1[(e)/SHGNT_PER_PAGE_V1][(e)%SHGNT_PER_PAGE_V1])
-#define SHGNT_PER_PAGE_V2 (PAGE_SIZE / sizeof(grant_entry_v2_t))
-#define shared_entry_v2(t, e) \
-    ((t)->shared_v2[(e)/SHGNT_PER_PAGE_V2][(e)%SHGNT_PER_PAGE_V2])
-#define STGNT_PER_PAGE (PAGE_SIZE / sizeof(grant_status_t))
-#define status_entry(t, e) \
-    ((t)->status[(e)/STGNT_PER_PAGE][(e)%STGNT_PER_PAGE])
-
-static grant_entry_header_t *
-shared_entry_header(struct grant_table *t, grant_ref_t ref)
-{
-    ASSERT (t->gt_version != 0);
-    if ( t->gt_version == 1 )
-        return (grant_entry_header_t*)&shared_entry_v1(t, ref);
-    else
-        return &shared_entry_v2(t, ref).hdr;
-}
-
-static int mem_sharing_gref_to_gfn(struct domain *d, 
-                                   grant_ref_t ref, 
-                                   unsigned long *gfn)
-{
-    if ( d->grant_table->gt_version < 1 )
-        return -1;
-
-    if ( d->grant_table->gt_version == 1 ) 
-    {
-        grant_entry_v1_t *sha1;
-        sha1 = &shared_entry_v1(d->grant_table, ref);
-        *gfn = sha1->frame;
-    } 
-    else 
-    {
-        grant_entry_v2_t *sha2;
-        sha2 = &shared_entry_v2(d->grant_table, ref);
-        *gfn = sha2->full_page.frame;
-    }
- 
-    return 0;
-}
-
-
-int mem_sharing_debug_gref(struct domain *d, grant_ref_t ref)
-{
-    grant_entry_header_t *shah;
-    uint16_t status;
-    unsigned long gfn;
-
-    if ( d->grant_table->gt_version < 1 )
-    {
-        gdprintk(XENLOG_ERR, 
-                "Asked to debug [dom=%d,gref=%d], but not yet inited.\n",
-                d->domain_id, ref);
-        return -1;
-    }
-    (void)mem_sharing_gref_to_gfn(d, ref, &gfn); 
-    shah = shared_entry_header(d->grant_table, ref);
-    if ( d->grant_table->gt_version == 1 ) 
-        status = shah->flags;
-    else 
-        status = status_entry(d->grant_table, ref);
-    
-    gdprintk(XENLOG_DEBUG,
-            "==> Grant [dom=%d,ref=%d], status=%x. ", 
-            d->domain_id, ref, status);
-
-    return mem_sharing_debug_gfn(d, gfn); 
-}
-
 /* Functions that change a page's type and ownership */
 static int page_make_sharable(struct domain *d, 
                        struct page_info *page, 
@@ -604,6 +499,117 @@
     return pg;
 }
 
+int mem_sharing_debug_mfn(mfn_t mfn)
+{
+    struct page_info *page;
+    int num_refs;
+
+    if ( (page = __grab_shared_page(mfn)) == NULL)
+    {
+        gdprintk(XENLOG_ERR, "Invalid MFN=%lx\n", mfn_x(mfn));
+        return -1;
+    }
+
+    MEM_SHARING_DEBUG( 
+            "Debug page: MFN=%lx is ci=%lx, ti=%lx, owner_id=%d\n",
+            mfn_x(page_to_mfn(page)), 
+            page->count_info, 
+            page->u.inuse.type_info,
+            page_get_owner(page)->domain_id);
+
+    /* -1 because the page is locked and that's an additional type ref */
+    num_refs = ((int) (page->u.inuse.type_info & PGT_count_mask)) - 1;
+    mem_sharing_page_unlock(page);
+    return num_refs;
+}
+
+int mem_sharing_debug_gfn(struct domain *d, unsigned long gfn)
+{
+    p2m_type_t p2mt;
+    mfn_t mfn;
+    int num_refs;
+
+    mfn = get_gfn_query(d, gfn, &p2mt);
+
+    MEM_SHARING_DEBUG("Debug for domain=%d, gfn=%lx, ", 
+               d->domain_id, 
+               gfn);
+    num_refs = mem_sharing_debug_mfn(mfn);
+    put_gfn(d, gfn);
+    return num_refs;
+}
+
+#define SHGNT_PER_PAGE_V1 (PAGE_SIZE / sizeof(grant_entry_v1_t))
+#define shared_entry_v1(t, e) \
+    ((t)->shared_v1[(e)/SHGNT_PER_PAGE_V1][(e)%SHGNT_PER_PAGE_V1])
+#define SHGNT_PER_PAGE_V2 (PAGE_SIZE / sizeof(grant_entry_v2_t))
+#define shared_entry_v2(t, e) \
+    ((t)->shared_v2[(e)/SHGNT_PER_PAGE_V2][(e)%SHGNT_PER_PAGE_V2])
+#define STGNT_PER_PAGE (PAGE_SIZE / sizeof(grant_status_t))
+#define status_entry(t, e) \
+    ((t)->status[(e)/STGNT_PER_PAGE][(e)%STGNT_PER_PAGE])
+
+static grant_entry_header_t *
+shared_entry_header(struct grant_table *t, grant_ref_t ref)
+{
+    ASSERT (t->gt_version != 0);
+    if ( t->gt_version == 1 )
+        return (grant_entry_header_t*)&shared_entry_v1(t, ref);
+    else
+        return &shared_entry_v2(t, ref).hdr;
+}
+
+static int mem_sharing_gref_to_gfn(struct domain *d, 
+                                   grant_ref_t ref, 
+                                   unsigned long *gfn)
+{
+    if ( d->grant_table->gt_version < 1 )
+        return -1;
+
+    if ( d->grant_table->gt_version == 1 ) 
+    {
+        grant_entry_v1_t *sha1;
+        sha1 = &shared_entry_v1(d->grant_table, ref);
+        *gfn = sha1->frame;
+    } 
+    else 
+    {
+        grant_entry_v2_t *sha2;
+        sha2 = &shared_entry_v2(d->grant_table, ref);
+        *gfn = sha2->full_page.frame;
+    }
+ 
+    return 0;
+}
+
+
+int mem_sharing_debug_gref(struct domain *d, grant_ref_t ref)
+{
+    grant_entry_header_t *shah;
+    uint16_t status;
+    unsigned long gfn;
+
+    if ( d->grant_table->gt_version < 1 )
+    {
+        MEM_SHARING_DEBUG( 
+                "Asked to debug [dom=%d,gref=%d], but not yet inited.\n",
+                d->domain_id, ref);
+        return -1;
+    }
+    (void)mem_sharing_gref_to_gfn(d, ref, &gfn); 
+    shah = shared_entry_header(d->grant_table, ref);
+    if ( d->grant_table->gt_version == 1 ) 
+        status = shah->flags;
+    else 
+        status = status_entry(d->grant_table, ref);
+    
+    MEM_SHARING_DEBUG(
+            "==> Grant [dom=%d,ref=%d], status=%x. ", 
+            d->domain_id, ref, status);
+
+    return mem_sharing_debug_gfn(d, gfn); 
+}
+
 int mem_sharing_nominate_page(struct domain *d,
                               unsigned long gfn,
                               int expected_refcnt,
@@ -1165,7 +1171,7 @@
         case XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_MFN:
         {
             unsigned long mfn = mec->u.debug.u.mfn;
-            rc = mem_sharing_debug_mfn(mfn);
+            rc = mem_sharing_debug_mfn(_mfn(mfn));
         }
         break;
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:11 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:11 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtR9z-0000EP-P3; Fri, 03 Feb 2012 21:59:11 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9y-0000D4-J2
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1328306299!52846863!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19112 invoked from network); 3 Feb 2012 21:58:20 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9v-0001rB-MR
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:07 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9u-0003NC-Dq
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:07 +0000
Message-Id: <E1RtR9u-0003NC-Dq@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:05 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Make debug_{gfn, mfn,
	gref} calls to sharing more useful and correct
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328185398 0
# Node ID 23fe4a60190f11efc750af51f55228183f7bb736
# Parent  f5d2642c94f424c56a69eefc41239af3a3a345ce
x86/mm: Make debug_{gfn, mfn, gref} calls to sharing more useful and correct

Have them used locked accesors to the gfn and the underlying shared mfn.

Have them return the number of shared refs to the underlying mfn.

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 f5d2642c94f4 -r 23fe4a60190f xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Thu Feb 02 12:22:34 2012 +0000
+++ b/xen/arch/x86/mm/mem_sharing.c	Thu Feb 02 12:23:18 2012 +0000
@@ -45,13 +45,13 @@
 
 DEFINE_PER_CPU(pg_lock_data_t, __pld);
 
+#define MEM_SHARING_DEBUG(_f, _a...)                                  \
+    debugtrace_printk("mem_sharing_debug: %s(): " _f, __func__, ##_a)
+
 #if MEM_SHARING_AUDIT
 
 static void mem_sharing_audit(void);
 
-#define MEM_SHARING_DEBUG(_f, _a...)                                  \
-    debugtrace_printk("mem_sharing_debug: %s(): " _f, __func__, ##_a)
-
 static struct list_head shr_audit_list;
 static spinlock_t shr_audit_lock;
 DEFINE_RCU_READ_LOCK(shr_audit_read_lock);
@@ -398,111 +398,6 @@
     return 0;
 }
 
-int mem_sharing_debug_mfn(unsigned long mfn)
-{
-    struct page_info *page;
-
-    if ( !mfn_valid(_mfn(mfn)) )
-    {
-        gdprintk(XENLOG_ERR, "Invalid MFN=%lx\n", mfn);
-        return -1;
-    }
-    page = mfn_to_page(_mfn(mfn));
-
-    gdprintk(XENLOG_DEBUG, 
-            "Debug page: MFN=%lx is ci=%lx, ti=%lx, owner_id=%d\n",
-            mfn_x(page_to_mfn(page)), 
-            page->count_info, 
-            page->u.inuse.type_info,
-            page_get_owner(page)->domain_id);
-
-    return 0;
-}
-
-int mem_sharing_debug_gfn(struct domain *d, unsigned long gfn)
-{
-    p2m_type_t p2mt;
-    mfn_t mfn;
-
-    mfn = get_gfn_query_unlocked(d, gfn, &p2mt);
-
-    gdprintk(XENLOG_DEBUG, "Debug for domain=%d, gfn=%lx, ", 
-               d->domain_id, 
-               gfn);
-    return mem_sharing_debug_mfn(mfn_x(mfn));
-}
-
-#define SHGNT_PER_PAGE_V1 (PAGE_SIZE / sizeof(grant_entry_v1_t))
-#define shared_entry_v1(t, e) \
-    ((t)->shared_v1[(e)/SHGNT_PER_PAGE_V1][(e)%SHGNT_PER_PAGE_V1])
-#define SHGNT_PER_PAGE_V2 (PAGE_SIZE / sizeof(grant_entry_v2_t))
-#define shared_entry_v2(t, e) \
-    ((t)->shared_v2[(e)/SHGNT_PER_PAGE_V2][(e)%SHGNT_PER_PAGE_V2])
-#define STGNT_PER_PAGE (PAGE_SIZE / sizeof(grant_status_t))
-#define status_entry(t, e) \
-    ((t)->status[(e)/STGNT_PER_PAGE][(e)%STGNT_PER_PAGE])
-
-static grant_entry_header_t *
-shared_entry_header(struct grant_table *t, grant_ref_t ref)
-{
-    ASSERT (t->gt_version != 0);
-    if ( t->gt_version == 1 )
-        return (grant_entry_header_t*)&shared_entry_v1(t, ref);
-    else
-        return &shared_entry_v2(t, ref).hdr;
-}
-
-static int mem_sharing_gref_to_gfn(struct domain *d, 
-                                   grant_ref_t ref, 
-                                   unsigned long *gfn)
-{
-    if ( d->grant_table->gt_version < 1 )
-        return -1;
-
-    if ( d->grant_table->gt_version == 1 ) 
-    {
-        grant_entry_v1_t *sha1;
-        sha1 = &shared_entry_v1(d->grant_table, ref);
-        *gfn = sha1->frame;
-    } 
-    else 
-    {
-        grant_entry_v2_t *sha2;
-        sha2 = &shared_entry_v2(d->grant_table, ref);
-        *gfn = sha2->full_page.frame;
-    }
- 
-    return 0;
-}
-
-
-int mem_sharing_debug_gref(struct domain *d, grant_ref_t ref)
-{
-    grant_entry_header_t *shah;
-    uint16_t status;
-    unsigned long gfn;
-
-    if ( d->grant_table->gt_version < 1 )
-    {
-        gdprintk(XENLOG_ERR, 
-                "Asked to debug [dom=%d,gref=%d], but not yet inited.\n",
-                d->domain_id, ref);
-        return -1;
-    }
-    (void)mem_sharing_gref_to_gfn(d, ref, &gfn); 
-    shah = shared_entry_header(d->grant_table, ref);
-    if ( d->grant_table->gt_version == 1 ) 
-        status = shah->flags;
-    else 
-        status = status_entry(d->grant_table, ref);
-    
-    gdprintk(XENLOG_DEBUG,
-            "==> Grant [dom=%d,ref=%d], status=%x. ", 
-            d->domain_id, ref, status);
-
-    return mem_sharing_debug_gfn(d, gfn); 
-}
-
 /* Functions that change a page's type and ownership */
 static int page_make_sharable(struct domain *d, 
                        struct page_info *page, 
@@ -604,6 +499,117 @@
     return pg;
 }
 
+int mem_sharing_debug_mfn(mfn_t mfn)
+{
+    struct page_info *page;
+    int num_refs;
+
+    if ( (page = __grab_shared_page(mfn)) == NULL)
+    {
+        gdprintk(XENLOG_ERR, "Invalid MFN=%lx\n", mfn_x(mfn));
+        return -1;
+    }
+
+    MEM_SHARING_DEBUG( 
+            "Debug page: MFN=%lx is ci=%lx, ti=%lx, owner_id=%d\n",
+            mfn_x(page_to_mfn(page)), 
+            page->count_info, 
+            page->u.inuse.type_info,
+            page_get_owner(page)->domain_id);
+
+    /* -1 because the page is locked and that's an additional type ref */
+    num_refs = ((int) (page->u.inuse.type_info & PGT_count_mask)) - 1;
+    mem_sharing_page_unlock(page);
+    return num_refs;
+}
+
+int mem_sharing_debug_gfn(struct domain *d, unsigned long gfn)
+{
+    p2m_type_t p2mt;
+    mfn_t mfn;
+    int num_refs;
+
+    mfn = get_gfn_query(d, gfn, &p2mt);
+
+    MEM_SHARING_DEBUG("Debug for domain=%d, gfn=%lx, ", 
+               d->domain_id, 
+               gfn);
+    num_refs = mem_sharing_debug_mfn(mfn);
+    put_gfn(d, gfn);
+    return num_refs;
+}
+
+#define SHGNT_PER_PAGE_V1 (PAGE_SIZE / sizeof(grant_entry_v1_t))
+#define shared_entry_v1(t, e) \
+    ((t)->shared_v1[(e)/SHGNT_PER_PAGE_V1][(e)%SHGNT_PER_PAGE_V1])
+#define SHGNT_PER_PAGE_V2 (PAGE_SIZE / sizeof(grant_entry_v2_t))
+#define shared_entry_v2(t, e) \
+    ((t)->shared_v2[(e)/SHGNT_PER_PAGE_V2][(e)%SHGNT_PER_PAGE_V2])
+#define STGNT_PER_PAGE (PAGE_SIZE / sizeof(grant_status_t))
+#define status_entry(t, e) \
+    ((t)->status[(e)/STGNT_PER_PAGE][(e)%STGNT_PER_PAGE])
+
+static grant_entry_header_t *
+shared_entry_header(struct grant_table *t, grant_ref_t ref)
+{
+    ASSERT (t->gt_version != 0);
+    if ( t->gt_version == 1 )
+        return (grant_entry_header_t*)&shared_entry_v1(t, ref);
+    else
+        return &shared_entry_v2(t, ref).hdr;
+}
+
+static int mem_sharing_gref_to_gfn(struct domain *d, 
+                                   grant_ref_t ref, 
+                                   unsigned long *gfn)
+{
+    if ( d->grant_table->gt_version < 1 )
+        return -1;
+
+    if ( d->grant_table->gt_version == 1 ) 
+    {
+        grant_entry_v1_t *sha1;
+        sha1 = &shared_entry_v1(d->grant_table, ref);
+        *gfn = sha1->frame;
+    } 
+    else 
+    {
+        grant_entry_v2_t *sha2;
+        sha2 = &shared_entry_v2(d->grant_table, ref);
+        *gfn = sha2->full_page.frame;
+    }
+ 
+    return 0;
+}
+
+
+int mem_sharing_debug_gref(struct domain *d, grant_ref_t ref)
+{
+    grant_entry_header_t *shah;
+    uint16_t status;
+    unsigned long gfn;
+
+    if ( d->grant_table->gt_version < 1 )
+    {
+        MEM_SHARING_DEBUG( 
+                "Asked to debug [dom=%d,gref=%d], but not yet inited.\n",
+                d->domain_id, ref);
+        return -1;
+    }
+    (void)mem_sharing_gref_to_gfn(d, ref, &gfn); 
+    shah = shared_entry_header(d->grant_table, ref);
+    if ( d->grant_table->gt_version == 1 ) 
+        status = shah->flags;
+    else 
+        status = status_entry(d->grant_table, ref);
+    
+    MEM_SHARING_DEBUG(
+            "==> Grant [dom=%d,ref=%d], status=%x. ", 
+            d->domain_id, ref, status);
+
+    return mem_sharing_debug_gfn(d, gfn); 
+}
+
 int mem_sharing_nominate_page(struct domain *d,
                               unsigned long gfn,
                               int expected_refcnt,
@@ -1165,7 +1171,7 @@
         case XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_MFN:
         {
             unsigned long mfn = mec->u.debug.u.mfn;
-            rc = mem_sharing_debug_mfn(mfn);
+            rc = mem_sharing_debug_mfn(_mfn(mfn));
         }
         break;
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRA7-0000LP-Rk; Fri, 03 Feb 2012 21:59:19 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRA6-0000FV-Ab
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1328306350!11868106!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16077 invoked from network); 3 Feb 2012 21:59:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9y-0001rG-Ey
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9w-0003Nv-Ex
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:09 +0000
Message-Id: <E1RtR9w-0003Nv-Ex@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Fix balooning+sharing
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328185651 0
# Node ID e2e2df4224e221ff7bbb9a75083d3b21f70a47d2
# Parent  23fe4a60190f11efc750af51f55228183f7bb736
x86/mm: Fix balooning+sharing

Never mind that ballooning a shared page makes no sense. We still fix it
because it may be exercised.

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


diff -r 23fe4a60190f -r e2e2df4224e2 xen/common/memory.c
--- a/xen/common/memory.c	Thu Feb 02 12:23:18 2012 +0000
+++ b/xen/common/memory.c	Thu Feb 02 12:27:31 2012 +0000
@@ -183,14 +183,14 @@
             
     page = mfn_to_page(mfn);
 #ifdef CONFIG_X86
-    /* If gmfn is shared, just drop the guest reference (which may or may not
-     * free the page) */
-    if(p2m_is_shared(p2mt))
+    if ( p2m_is_shared(p2mt) )
     {
-        put_page_and_type(page);
-        guest_physmap_remove_page(d, gmfn, mfn, 0);
-        put_gfn(d, gmfn);
-        return 1;
+        /* Unshare the page, bail out on error. We unshare because 
+         * we might be the only one using this shared page, and we
+         * need to trigger proper cleanup. Once done, this is 
+         * like any other page. */
+        if ( mem_sharing_unshare_page(d, gmfn, 0) )
+            return 0;
     }
 
 #endif /* CONFIG_X86 */

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRA7-0000LP-Rk; Fri, 03 Feb 2012 21:59:19 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRA6-0000FV-Ab
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1328306350!11868106!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16077 invoked from network); 3 Feb 2012 21:59:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9y-0001rG-Ey
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9w-0003Nv-Ex
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:09 +0000
Message-Id: <E1RtR9w-0003Nv-Ex@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Fix balooning+sharing
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328185651 0
# Node ID e2e2df4224e221ff7bbb9a75083d3b21f70a47d2
# Parent  23fe4a60190f11efc750af51f55228183f7bb736
x86/mm: Fix balooning+sharing

Never mind that ballooning a shared page makes no sense. We still fix it
because it may be exercised.

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


diff -r 23fe4a60190f -r e2e2df4224e2 xen/common/memory.c
--- a/xen/common/memory.c	Thu Feb 02 12:23:18 2012 +0000
+++ b/xen/common/memory.c	Thu Feb 02 12:27:31 2012 +0000
@@ -183,14 +183,14 @@
             
     page = mfn_to_page(mfn);
 #ifdef CONFIG_X86
-    /* If gmfn is shared, just drop the guest reference (which may or may not
-     * free the page) */
-    if(p2m_is_shared(p2mt))
+    if ( p2m_is_shared(p2mt) )
     {
-        put_page_and_type(page);
-        guest_physmap_remove_page(d, gmfn, mfn, 0);
-        put_gfn(d, gmfn);
-        return 1;
+        /* Unshare the page, bail out on error. We unshare because 
+         * we might be the only one using this shared page, and we
+         * need to trigger proper cleanup. Once done, this is 
+         * like any other page. */
+        if ( mem_sharing_unshare_page(d, gmfn, 0) )
+            return 0;
     }
 
 #endif /* CONFIG_X86 */

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAA-0000NI-2T; Fri, 03 Feb 2012 21:59:22 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRA7-0000L9-WC
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-27.messagelabs.com!1328306314!58731915!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2946 invoked from network); 3 Feb 2012 21:58:35 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:35 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRA5-0001rW-CS
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRA3-0003Q5-Dh
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:16 +0000
Message-Id: <E1RtRA3-0003Q5-Dh@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xsm: Add security labels to
	event-channel dump
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328195794 0
# Node ID 837f3fb6d61f6d5e679be6327220864eb9a3d283
# Parent  fcc071c31e3a3ccc5dfaefd091eedbb608604928
xsm: Add security labels to event-channel dump

In FLASK, event channel labels are distinct from the labels of the
domain using them. When debugging policy issues, it is useful to be
able to view the current label of event channels; add this label to
the event channel dump.

This patch also adds the IRQ associated with a PIRQ for event channels
bound to a PIRQ, and moves the xen_consumer flag to the front to
create more consistent alignment in the output.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r fcc071c31e3a -r 837f3fb6d61f xen/common/event_channel.c
--- a/xen/common/event_channel.c	Thu Feb 02 13:50:48 2012 +0000
+++ b/xen/common/event_channel.c	Thu Feb 02 15:16:34 2012 +0000
@@ -1256,6 +1256,7 @@
 static void domain_dump_evtchn_info(struct domain *d)
 {
     unsigned int port;
+    int irq;
 
     bitmap_scnlistprintf(keyhandler_scratch, sizeof(keyhandler_scratch),
                          d->poll_mask, d->max_vcpus);
@@ -1268,6 +1269,7 @@
     for ( port = 1; port < MAX_EVTCHNS(d); ++port )
     {
         const struct evtchn *chn;
+        char *ssid;
 
         if ( !port_is_valid(d, port) )
             continue;
@@ -1275,11 +1277,12 @@
         if ( chn->state == ECS_FREE )
             continue;
 
-        printk("    %4u [%d/%d]: s=%d n=%d",
+        printk("    %4u [%d/%d]: s=%d n=%d x=%d",
                port,
                !!test_bit(port, &shared_info(d, evtchn_pending)),
                !!test_bit(port, &shared_info(d, evtchn_mask)),
-               chn->state, chn->notify_vcpu_id);
+               chn->state, chn->notify_vcpu_id, chn->xen_consumer);
+
         switch ( chn->state )
         {
         case ECS_UNBOUND:
@@ -1291,13 +1294,21 @@
                    chn->u.interdomain.remote_port);
             break;
         case ECS_PIRQ:
-            printk(" p=%d", chn->u.pirq.irq);
+            irq = domain_pirq_to_irq(d, chn->u.pirq.irq);
+            printk(" p=%d i=%d", chn->u.pirq.irq, irq);
             break;
         case ECS_VIRQ:
             printk(" v=%d", chn->u.virq);
             break;
         }
-        printk(" x=%d\n", chn->xen_consumer);
+
+        ssid = xsm_show_security_evtchn(d, chn);
+        if (ssid) {
+            printk(" Z=%s\n", ssid);
+            xfree(ssid);
+        } else {
+            printk("\n");
+        }
     }
 
     spin_unlock(&d->event_lock);
diff -r fcc071c31e3a -r 837f3fb6d61f xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h	Thu Feb 02 13:50:48 2012 +0000
+++ b/xen/include/xsm/xsm.h	Thu Feb 02 15:16:34 2012 +0000
@@ -99,6 +99,7 @@
     void (*free_security_domain) (struct domain *d);
     int (*alloc_security_evtchn) (struct evtchn *chn);
     void (*free_security_evtchn) (struct evtchn *chn);
+    char *(*show_security_evtchn) (struct domain *d, const struct evtchn *chn);
 
     int (*get_pod_target) (struct domain *d);
     int (*set_pod_target) (struct domain *d);
@@ -424,6 +425,11 @@
     (void)xsm_call(free_security_evtchn(chn));
 }
 
+static inline char *xsm_show_security_evtchn (struct domain *d, const struct evtchn *chn)
+{
+    return xsm_call(show_security_evtchn(d, chn));
+}
+
 static inline int xsm_get_pod_target (struct domain *d)
 {
     return xsm_call(get_pod_target(d));
diff -r fcc071c31e3a -r 837f3fb6d61f xen/xsm/dummy.c
--- a/xen/xsm/dummy.c	Thu Feb 02 13:50:48 2012 +0000
+++ b/xen/xsm/dummy.c	Thu Feb 02 15:16:34 2012 +0000
@@ -290,6 +290,11 @@
     return;
 }
 
+static char *dummy_show_security_evtchn (struct domain *d, const struct evtchn *chn)
+{
+    return NULL;
+}
+
 static int dummy_test_assign_device (uint32_t machine_bdf)
 {
     return 0;
@@ -637,6 +642,7 @@
     set_to_dummy_if_null(ops, free_security_domain);
     set_to_dummy_if_null(ops, alloc_security_evtchn);
     set_to_dummy_if_null(ops, free_security_evtchn);
+    set_to_dummy_if_null(ops, show_security_evtchn);
 
     set_to_dummy_if_null(ops, memory_adjust_reservation);
     set_to_dummy_if_null(ops, memory_stat_reservation);
diff -r fcc071c31e3a -r 837f3fb6d61f xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c	Thu Feb 02 13:50:48 2012 +0000
+++ b/xen/xsm/flask/hooks.c	Thu Feb 02 15:16:34 2012 +0000
@@ -274,6 +274,35 @@
     xfree(esec);
 }
 
+static char *flask_show_security_evtchn(struct domain *d, const struct evtchn *chn)
+{
+    struct evtchn_security_struct *esec;
+    int irq;
+    u32 sid = 0;
+    char *ctx;
+    u32 ctx_len;
+
+    switch ( chn->state )
+    {
+    case ECS_UNBOUND:
+    case ECS_INTERDOMAIN:
+        esec = chn->ssid;
+        if ( esec )
+            sid = esec->sid;
+        break;
+    case ECS_PIRQ:
+        irq = domain_pirq_to_irq(d, chn->u.pirq.irq);
+        if (irq)
+            security_irq_sid(irq, &sid);
+        break;
+    }
+    if ( !sid )
+        return NULL;
+    if (security_sid_to_context(sid, &ctx, &ctx_len))
+        return NULL;
+    return ctx;
+}
+
 static int flask_grant_mapref(struct domain *d1, struct domain *d2, 
                               uint32_t flags)
 {
@@ -1499,6 +1528,7 @@
     .free_security_domain = flask_domain_free_security,
     .alloc_security_evtchn = flask_alloc_security_evtchn,
     .free_security_evtchn = flask_free_security_evtchn,
+    .show_security_evtchn = flask_show_security_evtchn,
 
     .get_pod_target = flask_get_pod_target,
     .set_pod_target = flask_set_pod_target,

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAA-0000NI-2T; Fri, 03 Feb 2012 21:59:22 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRA7-0000L9-WC
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-27.messagelabs.com!1328306314!58731915!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2946 invoked from network); 3 Feb 2012 21:58:35 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:35 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRA5-0001rW-CS
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRA3-0003Q5-Dh
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:16 +0000
Message-Id: <E1RtRA3-0003Q5-Dh@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xsm: Add security labels to
	event-channel dump
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328195794 0
# Node ID 837f3fb6d61f6d5e679be6327220864eb9a3d283
# Parent  fcc071c31e3a3ccc5dfaefd091eedbb608604928
xsm: Add security labels to event-channel dump

In FLASK, event channel labels are distinct from the labels of the
domain using them. When debugging policy issues, it is useful to be
able to view the current label of event channels; add this label to
the event channel dump.

This patch also adds the IRQ associated with a PIRQ for event channels
bound to a PIRQ, and moves the xen_consumer flag to the front to
create more consistent alignment in the output.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r fcc071c31e3a -r 837f3fb6d61f xen/common/event_channel.c
--- a/xen/common/event_channel.c	Thu Feb 02 13:50:48 2012 +0000
+++ b/xen/common/event_channel.c	Thu Feb 02 15:16:34 2012 +0000
@@ -1256,6 +1256,7 @@
 static void domain_dump_evtchn_info(struct domain *d)
 {
     unsigned int port;
+    int irq;
 
     bitmap_scnlistprintf(keyhandler_scratch, sizeof(keyhandler_scratch),
                          d->poll_mask, d->max_vcpus);
@@ -1268,6 +1269,7 @@
     for ( port = 1; port < MAX_EVTCHNS(d); ++port )
     {
         const struct evtchn *chn;
+        char *ssid;
 
         if ( !port_is_valid(d, port) )
             continue;
@@ -1275,11 +1277,12 @@
         if ( chn->state == ECS_FREE )
             continue;
 
-        printk("    %4u [%d/%d]: s=%d n=%d",
+        printk("    %4u [%d/%d]: s=%d n=%d x=%d",
                port,
                !!test_bit(port, &shared_info(d, evtchn_pending)),
                !!test_bit(port, &shared_info(d, evtchn_mask)),
-               chn->state, chn->notify_vcpu_id);
+               chn->state, chn->notify_vcpu_id, chn->xen_consumer);
+
         switch ( chn->state )
         {
         case ECS_UNBOUND:
@@ -1291,13 +1294,21 @@
                    chn->u.interdomain.remote_port);
             break;
         case ECS_PIRQ:
-            printk(" p=%d", chn->u.pirq.irq);
+            irq = domain_pirq_to_irq(d, chn->u.pirq.irq);
+            printk(" p=%d i=%d", chn->u.pirq.irq, irq);
             break;
         case ECS_VIRQ:
             printk(" v=%d", chn->u.virq);
             break;
         }
-        printk(" x=%d\n", chn->xen_consumer);
+
+        ssid = xsm_show_security_evtchn(d, chn);
+        if (ssid) {
+            printk(" Z=%s\n", ssid);
+            xfree(ssid);
+        } else {
+            printk("\n");
+        }
     }
 
     spin_unlock(&d->event_lock);
diff -r fcc071c31e3a -r 837f3fb6d61f xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h	Thu Feb 02 13:50:48 2012 +0000
+++ b/xen/include/xsm/xsm.h	Thu Feb 02 15:16:34 2012 +0000
@@ -99,6 +99,7 @@
     void (*free_security_domain) (struct domain *d);
     int (*alloc_security_evtchn) (struct evtchn *chn);
     void (*free_security_evtchn) (struct evtchn *chn);
+    char *(*show_security_evtchn) (struct domain *d, const struct evtchn *chn);
 
     int (*get_pod_target) (struct domain *d);
     int (*set_pod_target) (struct domain *d);
@@ -424,6 +425,11 @@
     (void)xsm_call(free_security_evtchn(chn));
 }
 
+static inline char *xsm_show_security_evtchn (struct domain *d, const struct evtchn *chn)
+{
+    return xsm_call(show_security_evtchn(d, chn));
+}
+
 static inline int xsm_get_pod_target (struct domain *d)
 {
     return xsm_call(get_pod_target(d));
diff -r fcc071c31e3a -r 837f3fb6d61f xen/xsm/dummy.c
--- a/xen/xsm/dummy.c	Thu Feb 02 13:50:48 2012 +0000
+++ b/xen/xsm/dummy.c	Thu Feb 02 15:16:34 2012 +0000
@@ -290,6 +290,11 @@
     return;
 }
 
+static char *dummy_show_security_evtchn (struct domain *d, const struct evtchn *chn)
+{
+    return NULL;
+}
+
 static int dummy_test_assign_device (uint32_t machine_bdf)
 {
     return 0;
@@ -637,6 +642,7 @@
     set_to_dummy_if_null(ops, free_security_domain);
     set_to_dummy_if_null(ops, alloc_security_evtchn);
     set_to_dummy_if_null(ops, free_security_evtchn);
+    set_to_dummy_if_null(ops, show_security_evtchn);
 
     set_to_dummy_if_null(ops, memory_adjust_reservation);
     set_to_dummy_if_null(ops, memory_stat_reservation);
diff -r fcc071c31e3a -r 837f3fb6d61f xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c	Thu Feb 02 13:50:48 2012 +0000
+++ b/xen/xsm/flask/hooks.c	Thu Feb 02 15:16:34 2012 +0000
@@ -274,6 +274,35 @@
     xfree(esec);
 }
 
+static char *flask_show_security_evtchn(struct domain *d, const struct evtchn *chn)
+{
+    struct evtchn_security_struct *esec;
+    int irq;
+    u32 sid = 0;
+    char *ctx;
+    u32 ctx_len;
+
+    switch ( chn->state )
+    {
+    case ECS_UNBOUND:
+    case ECS_INTERDOMAIN:
+        esec = chn->ssid;
+        if ( esec )
+            sid = esec->sid;
+        break;
+    case ECS_PIRQ:
+        irq = domain_pirq_to_irq(d, chn->u.pirq.irq);
+        if (irq)
+            security_irq_sid(irq, &sid);
+        break;
+    }
+    if ( !sid )
+        return NULL;
+    if (security_sid_to_context(sid, &ctx, &ctx_len))
+        return NULL;
+    return ctx;
+}
+
 static int flask_grant_mapref(struct domain *d1, struct domain *d2, 
                               uint32_t flags)
 {
@@ -1499,6 +1528,7 @@
     .free_security_domain = flask_domain_free_security,
     .alloc_security_evtchn = flask_alloc_security_evtchn,
     .free_security_evtchn = flask_free_security_evtchn,
+    .show_security_evtchn = flask_show_security_evtchn,
 
     .get_pod_target = flask_get_pod_target,
     .set_pod_target = flask_set_pod_target,

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAD-0000PU-5I; Fri, 03 Feb 2012 21:59:25 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAB-0000K4-Fu
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-182.messagelabs.com!1328306354!13096519!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14141 invoked from network); 3 Feb 2012 21:59:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRA2-0001rR-C4
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9z-0003Ou-Sr
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:13 +0000
Message-Id: <E1RtR9z-0003Ou-Sr@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Update QEMU_TAG, for CVE-2012-0029
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328190648 0
# Node ID fcc071c31e3a3ccc5dfaefd091eedbb608604928
# Parent  e2e2df4224e221ff7bbb9a75083d3b21f70a47d2
Update QEMU_TAG, for CVE-2012-0029
---


diff -r e2e2df4224e2 -r fcc071c31e3a Config.mk
--- a/Config.mk	Thu Feb 02 12:27:31 2012 +0000
+++ b/Config.mk	Thu Feb 02 13:50:48 2012 +0000
@@ -227,9 +227,9 @@
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= de05447400930da4be216e4fb0fe52b8be81490e
-# Tue Jan 31 15:42:38 2012 +0000
-# block-vbd: update to new mini-os wait queue API (new linked list API)
+QEMU_TAG ?= ebe37b2a3f844bad02dcc30d081f39eda06118f8
+# Thu Feb 2 13:47:06 2012 +0000
+# e1000: bounds packet size against buffer size
 
 # 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 Fri Feb 03 21:59:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAD-0000PU-5I; Fri, 03 Feb 2012 21:59:25 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAB-0000K4-Fu
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-182.messagelabs.com!1328306354!13096519!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14141 invoked from network); 3 Feb 2012 21:59:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRA2-0001rR-C4
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtR9z-0003Ou-Sr
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:13 +0000
Message-Id: <E1RtR9z-0003Ou-Sr@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Update QEMU_TAG, for CVE-2012-0029
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328190648 0
# Node ID fcc071c31e3a3ccc5dfaefd091eedbb608604928
# Parent  e2e2df4224e221ff7bbb9a75083d3b21f70a47d2
Update QEMU_TAG, for CVE-2012-0029
---


diff -r e2e2df4224e2 -r fcc071c31e3a Config.mk
--- a/Config.mk	Thu Feb 02 12:27:31 2012 +0000
+++ b/Config.mk	Thu Feb 02 13:50:48 2012 +0000
@@ -227,9 +227,9 @@
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= de05447400930da4be216e4fb0fe52b8be81490e
-# Tue Jan 31 15:42:38 2012 +0000
-# block-vbd: update to new mini-os wait queue API (new linked list API)
+QEMU_TAG ?= ebe37b2a3f844bad02dcc30d081f39eda06118f8
+# Thu Feb 2 13:47:06 2012 +0000
+# e1000: bounds packet size against buffer size
 
 # 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 Fri Feb 03 21:59:30 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAI-0000Sq-8h; Fri, 03 Feb 2012 21:59:30 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAG-0000Oc-TJ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:29 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1328306360!13046578!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13064 invoked from network); 3 Feb 2012 21:59:22 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:22 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRA8-0001rb-IE
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRA5-0003Qz-Rm
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:19 +0000
Message-Id: <E1RtRA5-0003Qz-Rm@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xsm: Add security label to IRQ debug
	output
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328195831 0
# Node ID d82a1e3d3c65ff9dd8b318bbe402273b96c4938b
# Parent  837f3fb6d61f6d5e679be6327220864eb9a3d283
xsm: Add security label to IRQ debug output

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 837f3fb6d61f -r d82a1e3d3c65 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Thu Feb 02 15:16:34 2012 +0000
+++ b/xen/arch/x86/irq.c	Thu Feb 02 15:17:11 2012 +0000
@@ -2001,6 +2001,7 @@
     struct domain *d;
     const struct pirq *info;
     unsigned long flags;
+    char *ssid;
 
     printk("Guest interrupt information:\n");
 
@@ -2012,6 +2013,8 @@
         if ( !irq_desc_initialized(desc) || desc->handler == &no_irq_type )
             continue;
 
+        ssid = xsm_show_irq_sid(irq);
+
         spin_lock_irqsave(&desc->lock, flags);
 
         cpumask_scnprintf(keyhandler_scratch, sizeof(keyhandler_scratch),
@@ -2021,6 +2024,9 @@
                irq, keyhandler_scratch, desc->arch.vector,
                desc->handler->typename, desc->status);
 
+        if ( ssid )
+            printk("Z=%-25s ", ssid);
+
         if ( !(desc->status & IRQ_GUEST) )
             printk("mapped, unbound\n");
         else
@@ -2053,6 +2059,8 @@
         }
 
         spin_unlock_irqrestore(&desc->lock, flags);
+
+        xfree(ssid);
     }
 
     dump_ioapic_irq_info();
diff -r 837f3fb6d61f -r d82a1e3d3c65 xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h	Thu Feb 02 15:16:34 2012 +0000
+++ b/xen/include/xsm/xsm.h	Thu Feb 02 15:17:11 2012 +0000
@@ -113,6 +113,8 @@
 
     int (*kexec) (void);
     int (*schedop_shutdown) (struct domain *d1, struct domain *d2);
+
+    char *(*show_irq_sid) (int irq);
     int (*irq_permission) (struct domain *d, int pirq, uint8_t allow);
     int (*iomem_permission) (struct domain *d, uint64_t s, uint64_t e, uint8_t allow);
     int (*pci_config_permission) (struct domain *d, uint32_t machine_bdf, uint16_t start, uint16_t end, uint8_t access);
@@ -477,6 +479,11 @@
     return xsm_call(schedop_shutdown(d1, d2));
 }
 
+static inline char *xsm_show_irq_sid (int irq)
+{
+    return xsm_call(show_irq_sid(irq));
+}
+
 static inline int xsm_irq_permission (struct domain *d, int pirq, uint8_t allow)
 {
     return xsm_call(irq_permission(d, pirq, allow));
diff -r 837f3fb6d61f -r d82a1e3d3c65 xen/xsm/dummy.c
--- a/xen/xsm/dummy.c	Thu Feb 02 15:16:34 2012 +0000
+++ b/xen/xsm/dummy.c	Thu Feb 02 15:17:11 2012 +0000
@@ -365,12 +365,16 @@
     return 0;
 }
 
-
 static long dummy___do_xsm_op(XEN_GUEST_HANDLE(xsm_op_t) op)
 {
     return -ENOSYS;
 }
 
+static char *dummy_show_irq_sid (int irq)
+{
+    return NULL;
+}
+
 static int dummy_irq_permission (struct domain *d, int pirq, uint8_t allow)
 {
     return 0;
@@ -655,6 +659,7 @@
     set_to_dummy_if_null(ops, kexec);
     set_to_dummy_if_null(ops, schedop_shutdown);
 
+    set_to_dummy_if_null(ops, show_irq_sid);
     set_to_dummy_if_null(ops, irq_permission);
     set_to_dummy_if_null(ops, iomem_permission);
     set_to_dummy_if_null(ops, pci_config_permission);
diff -r 837f3fb6d61f -r d82a1e3d3c65 xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c	Thu Feb 02 15:16:34 2012 +0000
+++ b/xen/xsm/flask/hooks.c	Thu Feb 02 15:17:11 2012 +0000
@@ -712,6 +712,20 @@
         return RESOURCE__REMOVE;
 }
 
+static char *flask_show_irq_sid (int irq)
+{
+    u32 sid, ctx_len;
+    char *ctx;
+    int rc = security_irq_sid(irq, &sid);
+    if ( rc )
+        return NULL;
+
+    if (security_sid_to_context(sid, &ctx, &ctx_len))
+        return NULL;
+
+    return ctx;
+}
+
 static int flask_irq_permission (struct domain *d, int pirq, uint8_t access)
 {
     u32 perm;
@@ -1543,6 +1557,8 @@
     .kexec = flask_kexec,
     .schedop_shutdown = flask_schedop_shutdown,
 
+    .show_irq_sid = flask_show_irq_sid,
+
     .irq_permission = flask_irq_permission,
     .iomem_permission = flask_iomem_permission,
     .pci_config_permission = flask_pci_config_permission,

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:30 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAI-0000Sq-8h; Fri, 03 Feb 2012 21:59:30 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAG-0000Oc-TJ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:29 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1328306360!13046578!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13064 invoked from network); 3 Feb 2012 21:59:22 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:22 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRA8-0001rb-IE
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRA5-0003Qz-Rm
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:19 +0000
Message-Id: <E1RtRA5-0003Qz-Rm@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xsm: Add security label to IRQ debug
	output
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328195831 0
# Node ID d82a1e3d3c65ff9dd8b318bbe402273b96c4938b
# Parent  837f3fb6d61f6d5e679be6327220864eb9a3d283
xsm: Add security label to IRQ debug output

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 837f3fb6d61f -r d82a1e3d3c65 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Thu Feb 02 15:16:34 2012 +0000
+++ b/xen/arch/x86/irq.c	Thu Feb 02 15:17:11 2012 +0000
@@ -2001,6 +2001,7 @@
     struct domain *d;
     const struct pirq *info;
     unsigned long flags;
+    char *ssid;
 
     printk("Guest interrupt information:\n");
 
@@ -2012,6 +2013,8 @@
         if ( !irq_desc_initialized(desc) || desc->handler == &no_irq_type )
             continue;
 
+        ssid = xsm_show_irq_sid(irq);
+
         spin_lock_irqsave(&desc->lock, flags);
 
         cpumask_scnprintf(keyhandler_scratch, sizeof(keyhandler_scratch),
@@ -2021,6 +2024,9 @@
                irq, keyhandler_scratch, desc->arch.vector,
                desc->handler->typename, desc->status);
 
+        if ( ssid )
+            printk("Z=%-25s ", ssid);
+
         if ( !(desc->status & IRQ_GUEST) )
             printk("mapped, unbound\n");
         else
@@ -2053,6 +2059,8 @@
         }
 
         spin_unlock_irqrestore(&desc->lock, flags);
+
+        xfree(ssid);
     }
 
     dump_ioapic_irq_info();
diff -r 837f3fb6d61f -r d82a1e3d3c65 xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h	Thu Feb 02 15:16:34 2012 +0000
+++ b/xen/include/xsm/xsm.h	Thu Feb 02 15:17:11 2012 +0000
@@ -113,6 +113,8 @@
 
     int (*kexec) (void);
     int (*schedop_shutdown) (struct domain *d1, struct domain *d2);
+
+    char *(*show_irq_sid) (int irq);
     int (*irq_permission) (struct domain *d, int pirq, uint8_t allow);
     int (*iomem_permission) (struct domain *d, uint64_t s, uint64_t e, uint8_t allow);
     int (*pci_config_permission) (struct domain *d, uint32_t machine_bdf, uint16_t start, uint16_t end, uint8_t access);
@@ -477,6 +479,11 @@
     return xsm_call(schedop_shutdown(d1, d2));
 }
 
+static inline char *xsm_show_irq_sid (int irq)
+{
+    return xsm_call(show_irq_sid(irq));
+}
+
 static inline int xsm_irq_permission (struct domain *d, int pirq, uint8_t allow)
 {
     return xsm_call(irq_permission(d, pirq, allow));
diff -r 837f3fb6d61f -r d82a1e3d3c65 xen/xsm/dummy.c
--- a/xen/xsm/dummy.c	Thu Feb 02 15:16:34 2012 +0000
+++ b/xen/xsm/dummy.c	Thu Feb 02 15:17:11 2012 +0000
@@ -365,12 +365,16 @@
     return 0;
 }
 
-
 static long dummy___do_xsm_op(XEN_GUEST_HANDLE(xsm_op_t) op)
 {
     return -ENOSYS;
 }
 
+static char *dummy_show_irq_sid (int irq)
+{
+    return NULL;
+}
+
 static int dummy_irq_permission (struct domain *d, int pirq, uint8_t allow)
 {
     return 0;
@@ -655,6 +659,7 @@
     set_to_dummy_if_null(ops, kexec);
     set_to_dummy_if_null(ops, schedop_shutdown);
 
+    set_to_dummy_if_null(ops, show_irq_sid);
     set_to_dummy_if_null(ops, irq_permission);
     set_to_dummy_if_null(ops, iomem_permission);
     set_to_dummy_if_null(ops, pci_config_permission);
diff -r 837f3fb6d61f -r d82a1e3d3c65 xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c	Thu Feb 02 15:16:34 2012 +0000
+++ b/xen/xsm/flask/hooks.c	Thu Feb 02 15:17:11 2012 +0000
@@ -712,6 +712,20 @@
         return RESOURCE__REMOVE;
 }
 
+static char *flask_show_irq_sid (int irq)
+{
+    u32 sid, ctx_len;
+    char *ctx;
+    int rc = security_irq_sid(irq, &sid);
+    if ( rc )
+        return NULL;
+
+    if (security_sid_to_context(sid, &ctx, &ctx_len))
+        return NULL;
+
+    return ctx;
+}
+
 static int flask_irq_permission (struct domain *d, int pirq, uint8_t access)
 {
     u32 perm;
@@ -1543,6 +1557,8 @@
     .kexec = flask_kexec,
     .schedop_shutdown = flask_schedop_shutdown,
 
+    .show_irq_sid = flask_show_irq_sid,
+
     .irq_permission = flask_irq_permission,
     .iomem_permission = flask_iomem_permission,
     .pci_config_permission = flask_pci_config_permission,

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:32 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAK-0000UJ-Br; Fri, 03 Feb 2012 21:59:32 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAI-0000Q0-RF
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:31 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1328306363!13897182!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=2.0 required=7.0 tests=SUBJECT_RANDOMQ
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4119 invoked from network); 3 Feb 2012 21:59:24 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAB-0001rf-IY
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRA9-0003Sn-OS
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:23 +0000
Message-Id: <E1RtRA9-0003Sn-OS@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xsm/flask: Use PCI device label for
	PCI-MSI IRQs
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328195866 0
# Node ID 108fa9cf28b36d8d34a847a4cf00f6f4df79a40b
# Parent  d82a1e3d3c65ff9dd8b318bbe402273b96c4938b
xsm/flask: Use PCI device label for PCI-MSI IRQs

Because the PCI-MSI IRQ numbers are allocated dynamically, labeling
them by number is not useful. Instead, for all IRQs beyond
nr_irqs_gsi, use the associated msi_desc to find the PCI device and
use the label of the PCI device for the IRQ.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r d82a1e3d3c65 -r 108fa9cf28b3 xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c	Thu Feb 02 15:17:11 2012 +0000
+++ b/xen/xsm/flask/hooks.c	Thu Feb 02 15:17:46 2012 +0000
@@ -19,6 +19,7 @@
 #include <xen/errno.h>
 #include <xen/guest_access.h>
 #include <xen/xenoprof.h>
+#include <asm/msi.h>
 #include <public/xen.h>
 #include <public/physdev.h>
 #include <public/platform.h>
@@ -62,6 +63,36 @@
     return avc_has_perm(dsec->sid, SECINITSID_XEN, SECCLASS_XEN, perms, NULL);
 }
 
+static int get_irq_sid(int irq, u32 *sid, struct avc_audit_data *ad)
+{
+    struct irq_desc *desc = irq_to_desc(irq);
+    if ( irq >= nr_irqs || irq < 0 )
+        return -EINVAL;
+    if ( irq < nr_irqs_gsi ) {
+        if (ad) {
+            AVC_AUDIT_DATA_INIT(ad, IRQ);
+            ad->irq = irq;
+        }
+        return security_irq_sid(irq, sid);
+    }
+    if ( desc->msi_desc ) {
+        struct pci_dev *dev = desc->msi_desc->dev;
+        u32 sbdf = (dev->seg << 16) | (dev->bus << 8) | dev->devfn;
+        if (ad) {
+            AVC_AUDIT_DATA_INIT(ad, DEV);
+            ad->device = sbdf;
+        }
+        return security_device_sid(sbdf, sid);
+    }
+    if (ad) {
+        AVC_AUDIT_DATA_INIT(ad, IRQ);
+        ad->irq = irq;
+    }
+    /* HPET or IOMMU IRQ, should not be seen by domains */
+    *sid = SECINITSID_UNLABELED;
+    return 0;
+}
+
 static int flask_domain_alloc_security(struct domain *d)
 {
     struct domain_security_struct *dsec;
@@ -292,8 +323,8 @@
         break;
     case ECS_PIRQ:
         irq = domain_pirq_to_irq(d, chn->u.pirq.irq);
-        if (irq)
-            security_irq_sid(irq, &sid);
+        if (irq && get_irq_sid(irq, &sid, NULL))
+            return NULL;
         break;
     }
     if ( !sid )
@@ -716,7 +747,7 @@
 {
     u32 sid, ctx_len;
     char *ctx;
-    int rc = security_irq_sid(irq, &sid);
+    int rc = get_irq_sid(irq, &sid, NULL);
     if ( rc )
         return NULL;
 
@@ -726,7 +757,7 @@
     return ctx;
 }
 
-static int flask_irq_permission (struct domain *d, int pirq, uint8_t access)
+static int flask_irq_permission (struct domain *d, int irq, uint8_t access)
 {
     u32 perm;
     u32 rsid;
@@ -749,13 +780,10 @@
     ssec = current->domain->ssid;
     tsec = d->ssid;
 
-    rc = security_irq_sid(pirq, &rsid);
+    rc = get_irq_sid(irq, &rsid, &ad);
     if ( rc )
         return rc;
 
-    AVC_AUDIT_DATA_INIT(&ad, IRQ);
-    ad.irq = pirq;
-
     rc = avc_has_perm(ssec->sid, rsid, SECCLASS_RESOURCE, perm, &ad);
     if ( rc )
         return rc;
@@ -915,12 +943,10 @@
     struct avc_audit_data ad;
     struct domain_security_struct *ssec;
 
-    rc = security_irq_sid(gsi, &rsid);
+    rc = get_irq_sid(gsi, &rsid, &ad);
     if ( rc )
         return rc;
 
-    AVC_AUDIT_DATA_INIT(&ad, IRQ);
-    ad.irq = gsi;
     ssec = current->domain->ssid;
     return avc_has_perm(ssec->sid, rsid, SECCLASS_RESOURCE, RESOURCE__SETUP, &ad);
 }
@@ -1424,13 +1450,10 @@
 
     irq = domain_pirq_to_irq(d, bind->machine_irq);
 
-    rc = security_irq_sid(irq, &rsid);
+    rc = get_irq_sid(irq, &rsid, &ad);
     if ( rc )
         return rc;
 
-    AVC_AUDIT_DATA_INIT(&ad, IRQ);
-    ad.irq = irq;
-
     ssec = current->domain->ssid;
     rc = avc_has_perm(ssec->sid, rsid, SECCLASS_HVM, HVM__BIND_IRQ, &ad);
     if ( rc )

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:32 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAK-0000UJ-Br; Fri, 03 Feb 2012 21:59:32 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAI-0000Q0-RF
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:31 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1328306363!13897182!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=2.0 required=7.0 tests=SUBJECT_RANDOMQ
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4119 invoked from network); 3 Feb 2012 21:59:24 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAB-0001rf-IY
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRA9-0003Sn-OS
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:23 +0000
Message-Id: <E1RtRA9-0003Sn-OS@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xsm/flask: Use PCI device label for
	PCI-MSI IRQs
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328195866 0
# Node ID 108fa9cf28b36d8d34a847a4cf00f6f4df79a40b
# Parent  d82a1e3d3c65ff9dd8b318bbe402273b96c4938b
xsm/flask: Use PCI device label for PCI-MSI IRQs

Because the PCI-MSI IRQ numbers are allocated dynamically, labeling
them by number is not useful. Instead, for all IRQs beyond
nr_irqs_gsi, use the associated msi_desc to find the PCI device and
use the label of the PCI device for the IRQ.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r d82a1e3d3c65 -r 108fa9cf28b3 xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c	Thu Feb 02 15:17:11 2012 +0000
+++ b/xen/xsm/flask/hooks.c	Thu Feb 02 15:17:46 2012 +0000
@@ -19,6 +19,7 @@
 #include <xen/errno.h>
 #include <xen/guest_access.h>
 #include <xen/xenoprof.h>
+#include <asm/msi.h>
 #include <public/xen.h>
 #include <public/physdev.h>
 #include <public/platform.h>
@@ -62,6 +63,36 @@
     return avc_has_perm(dsec->sid, SECINITSID_XEN, SECCLASS_XEN, perms, NULL);
 }
 
+static int get_irq_sid(int irq, u32 *sid, struct avc_audit_data *ad)
+{
+    struct irq_desc *desc = irq_to_desc(irq);
+    if ( irq >= nr_irqs || irq < 0 )
+        return -EINVAL;
+    if ( irq < nr_irqs_gsi ) {
+        if (ad) {
+            AVC_AUDIT_DATA_INIT(ad, IRQ);
+            ad->irq = irq;
+        }
+        return security_irq_sid(irq, sid);
+    }
+    if ( desc->msi_desc ) {
+        struct pci_dev *dev = desc->msi_desc->dev;
+        u32 sbdf = (dev->seg << 16) | (dev->bus << 8) | dev->devfn;
+        if (ad) {
+            AVC_AUDIT_DATA_INIT(ad, DEV);
+            ad->device = sbdf;
+        }
+        return security_device_sid(sbdf, sid);
+    }
+    if (ad) {
+        AVC_AUDIT_DATA_INIT(ad, IRQ);
+        ad->irq = irq;
+    }
+    /* HPET or IOMMU IRQ, should not be seen by domains */
+    *sid = SECINITSID_UNLABELED;
+    return 0;
+}
+
 static int flask_domain_alloc_security(struct domain *d)
 {
     struct domain_security_struct *dsec;
@@ -292,8 +323,8 @@
         break;
     case ECS_PIRQ:
         irq = domain_pirq_to_irq(d, chn->u.pirq.irq);
-        if (irq)
-            security_irq_sid(irq, &sid);
+        if (irq && get_irq_sid(irq, &sid, NULL))
+            return NULL;
         break;
     }
     if ( !sid )
@@ -716,7 +747,7 @@
 {
     u32 sid, ctx_len;
     char *ctx;
-    int rc = security_irq_sid(irq, &sid);
+    int rc = get_irq_sid(irq, &sid, NULL);
     if ( rc )
         return NULL;
 
@@ -726,7 +757,7 @@
     return ctx;
 }
 
-static int flask_irq_permission (struct domain *d, int pirq, uint8_t access)
+static int flask_irq_permission (struct domain *d, int irq, uint8_t access)
 {
     u32 perm;
     u32 rsid;
@@ -749,13 +780,10 @@
     ssec = current->domain->ssid;
     tsec = d->ssid;
 
-    rc = security_irq_sid(pirq, &rsid);
+    rc = get_irq_sid(irq, &rsid, &ad);
     if ( rc )
         return rc;
 
-    AVC_AUDIT_DATA_INIT(&ad, IRQ);
-    ad.irq = pirq;
-
     rc = avc_has_perm(ssec->sid, rsid, SECCLASS_RESOURCE, perm, &ad);
     if ( rc )
         return rc;
@@ -915,12 +943,10 @@
     struct avc_audit_data ad;
     struct domain_security_struct *ssec;
 
-    rc = security_irq_sid(gsi, &rsid);
+    rc = get_irq_sid(gsi, &rsid, &ad);
     if ( rc )
         return rc;
 
-    AVC_AUDIT_DATA_INIT(&ad, IRQ);
-    ad.irq = gsi;
     ssec = current->domain->ssid;
     return avc_has_perm(ssec->sid, rsid, SECCLASS_RESOURCE, RESOURCE__SETUP, &ad);
 }
@@ -1424,13 +1450,10 @@
 
     irq = domain_pirq_to_irq(d, bind->machine_irq);
 
-    rc = security_irq_sid(irq, &rsid);
+    rc = get_irq_sid(irq, &rsid, &ad);
     if ( rc )
         return rc;
 
-    AVC_AUDIT_DATA_INIT(&ad, IRQ);
-    ad.irq = irq;
-
     ssec = current->domain->ssid;
     rc = avc_has_perm(ssec->sid, rsid, SECCLASS_HVM, HVM__BIND_IRQ, &ad);
     if ( rc )

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:36 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAO-0000Wg-Ey; Fri, 03 Feb 2012 21:59:36 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAM-0000S2-DA
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:34 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-182.messagelabs.com!1328306366!13648827!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3513 invoked from network); 3 Feb 2012 21:59:27 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:27 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAE-0001rj-BZ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:26 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAC-0003Tb-R6
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:25 +0000
Message-Id: <E1RtRAC-0003Tb-R6@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:23 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xsm: Add xsm_map_domain_pirq hook
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328195899 0
# Node ID 1bc1e8eb9ce97aa24f08a9a44969f638a5765070
# Parent  108fa9cf28b36d8d34a847a4cf00f6f4df79a40b
xsm: Add xsm_map_domain_pirq hook

When checking permissions in map_domain_pirq, the msi_desc field of
the irq_desc is not yet populated with the PCI device being used. Pass
in the msi_info structure which contains the intended PCI device whose
label will be used in the security check.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 108fa9cf28b3 -r 1bc1e8eb9ce9 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Thu Feb 02 15:17:46 2012 +0000
+++ b/xen/arch/x86/irq.c	Thu Feb 02 15:18:19 2012 +0000
@@ -1828,7 +1828,7 @@
         return 0;
     }
 
-    ret = xsm_irq_permission(d, irq, 1);
+    ret = xsm_map_domain_pirq(d, irq, data);
     if ( ret )
     {
         dprintk(XENLOG_G_ERR, "dom%d: could not permit access to irq %d mapping to pirq %d\n",
diff -r 108fa9cf28b3 -r 1bc1e8eb9ce9 xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h	Thu Feb 02 15:17:46 2012 +0000
+++ b/xen/include/xsm/xsm.h	Thu Feb 02 15:18:19 2012 +0000
@@ -115,6 +115,7 @@
     int (*schedop_shutdown) (struct domain *d1, struct domain *d2);
 
     char *(*show_irq_sid) (int irq);
+    int (*map_domain_pirq) (struct domain *d, int irq, void *data);
     int (*irq_permission) (struct domain *d, int pirq, uint8_t allow);
     int (*iomem_permission) (struct domain *d, uint64_t s, uint64_t e, uint8_t allow);
     int (*pci_config_permission) (struct domain *d, uint32_t machine_bdf, uint16_t start, uint16_t end, uint8_t access);
@@ -484,6 +485,11 @@
     return xsm_call(show_irq_sid(irq));
 }
 
+static inline int xsm_map_domain_pirq (struct domain *d, int irq, void *data)
+{
+    return xsm_call(map_domain_pirq(d, irq, data));
+}
+
 static inline int xsm_irq_permission (struct domain *d, int pirq, uint8_t allow)
 {
     return xsm_call(irq_permission(d, pirq, allow));
diff -r 108fa9cf28b3 -r 1bc1e8eb9ce9 xen/xsm/dummy.c
--- a/xen/xsm/dummy.c	Thu Feb 02 15:17:46 2012 +0000
+++ b/xen/xsm/dummy.c	Thu Feb 02 15:18:19 2012 +0000
@@ -375,6 +375,11 @@
     return NULL;
 }
 
+static int dummy_map_domain_pirq (struct domain *d, int irq, void *data)
+{
+    return 0;
+}
+
 static int dummy_irq_permission (struct domain *d, int pirq, uint8_t allow)
 {
     return 0;
@@ -660,6 +665,7 @@
     set_to_dummy_if_null(ops, schedop_shutdown);
 
     set_to_dummy_if_null(ops, show_irq_sid);
+    set_to_dummy_if_null(ops, map_domain_pirq);
     set_to_dummy_if_null(ops, irq_permission);
     set_to_dummy_if_null(ops, iomem_permission);
     set_to_dummy_if_null(ops, pci_config_permission);
diff -r 108fa9cf28b3 -r 1bc1e8eb9ce9 xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c	Thu Feb 02 15:17:46 2012 +0000
+++ b/xen/xsm/flask/hooks.c	Thu Feb 02 15:18:19 2012 +0000
@@ -757,6 +757,42 @@
     return ctx;
 }
 
+static int flask_map_domain_pirq (struct domain *d, int irq, void *data)
+{
+    u32 sid;
+    int rc = -EPERM;
+    struct msi_info *msi = data;
+
+    struct domain_security_struct *ssec, *tsec;
+    struct avc_audit_data ad;
+
+    rc = domain_has_perm(current->domain, d, SECCLASS_RESOURCE, RESOURCE__ADD);
+
+    if ( rc )
+        return rc;
+
+    if ( irq >= nr_irqs_gsi && msi ) {
+        u32 machine_bdf = (msi->seg << 16) | (msi->bus << 8) | msi->devfn;
+        AVC_AUDIT_DATA_INIT(&ad, DEV);
+        ad.device = machine_bdf;
+        rc = security_device_sid(machine_bdf, &sid);
+    } else {
+        rc = get_irq_sid(irq, &sid, &ad);
+    }
+    if ( rc )
+        return rc;
+
+    ssec = current->domain->ssid;
+    tsec = d->ssid;
+
+    rc = avc_has_perm(ssec->sid, sid, SECCLASS_RESOURCE, RESOURCE__ADD_IRQ, &ad);
+    if ( rc )
+        return rc;
+
+    rc = avc_has_perm(tsec->sid, sid, SECCLASS_RESOURCE, RESOURCE__USE, &ad);
+    return rc;
+}
+
 static int flask_irq_permission (struct domain *d, int irq, uint8_t access)
 {
     u32 perm;
@@ -1582,6 +1618,7 @@
 
     .show_irq_sid = flask_show_irq_sid,
 
+    .map_domain_pirq = flask_map_domain_pirq,
     .irq_permission = flask_irq_permission,
     .iomem_permission = flask_iomem_permission,
     .pci_config_permission = flask_pci_config_permission,

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:36 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAO-0000Wg-Ey; Fri, 03 Feb 2012 21:59:36 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAM-0000S2-DA
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:34 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-182.messagelabs.com!1328306366!13648827!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3513 invoked from network); 3 Feb 2012 21:59:27 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:27 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAE-0001rj-BZ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:26 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAC-0003Tb-R6
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:25 +0000
Message-Id: <E1RtRAC-0003Tb-R6@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:23 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xsm: Add xsm_map_domain_pirq hook
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328195899 0
# Node ID 1bc1e8eb9ce97aa24f08a9a44969f638a5765070
# Parent  108fa9cf28b36d8d34a847a4cf00f6f4df79a40b
xsm: Add xsm_map_domain_pirq hook

When checking permissions in map_domain_pirq, the msi_desc field of
the irq_desc is not yet populated with the PCI device being used. Pass
in the msi_info structure which contains the intended PCI device whose
label will be used in the security check.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 108fa9cf28b3 -r 1bc1e8eb9ce9 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Thu Feb 02 15:17:46 2012 +0000
+++ b/xen/arch/x86/irq.c	Thu Feb 02 15:18:19 2012 +0000
@@ -1828,7 +1828,7 @@
         return 0;
     }
 
-    ret = xsm_irq_permission(d, irq, 1);
+    ret = xsm_map_domain_pirq(d, irq, data);
     if ( ret )
     {
         dprintk(XENLOG_G_ERR, "dom%d: could not permit access to irq %d mapping to pirq %d\n",
diff -r 108fa9cf28b3 -r 1bc1e8eb9ce9 xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h	Thu Feb 02 15:17:46 2012 +0000
+++ b/xen/include/xsm/xsm.h	Thu Feb 02 15:18:19 2012 +0000
@@ -115,6 +115,7 @@
     int (*schedop_shutdown) (struct domain *d1, struct domain *d2);
 
     char *(*show_irq_sid) (int irq);
+    int (*map_domain_pirq) (struct domain *d, int irq, void *data);
     int (*irq_permission) (struct domain *d, int pirq, uint8_t allow);
     int (*iomem_permission) (struct domain *d, uint64_t s, uint64_t e, uint8_t allow);
     int (*pci_config_permission) (struct domain *d, uint32_t machine_bdf, uint16_t start, uint16_t end, uint8_t access);
@@ -484,6 +485,11 @@
     return xsm_call(show_irq_sid(irq));
 }
 
+static inline int xsm_map_domain_pirq (struct domain *d, int irq, void *data)
+{
+    return xsm_call(map_domain_pirq(d, irq, data));
+}
+
 static inline int xsm_irq_permission (struct domain *d, int pirq, uint8_t allow)
 {
     return xsm_call(irq_permission(d, pirq, allow));
diff -r 108fa9cf28b3 -r 1bc1e8eb9ce9 xen/xsm/dummy.c
--- a/xen/xsm/dummy.c	Thu Feb 02 15:17:46 2012 +0000
+++ b/xen/xsm/dummy.c	Thu Feb 02 15:18:19 2012 +0000
@@ -375,6 +375,11 @@
     return NULL;
 }
 
+static int dummy_map_domain_pirq (struct domain *d, int irq, void *data)
+{
+    return 0;
+}
+
 static int dummy_irq_permission (struct domain *d, int pirq, uint8_t allow)
 {
     return 0;
@@ -660,6 +665,7 @@
     set_to_dummy_if_null(ops, schedop_shutdown);
 
     set_to_dummy_if_null(ops, show_irq_sid);
+    set_to_dummy_if_null(ops, map_domain_pirq);
     set_to_dummy_if_null(ops, irq_permission);
     set_to_dummy_if_null(ops, iomem_permission);
     set_to_dummy_if_null(ops, pci_config_permission);
diff -r 108fa9cf28b3 -r 1bc1e8eb9ce9 xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c	Thu Feb 02 15:17:46 2012 +0000
+++ b/xen/xsm/flask/hooks.c	Thu Feb 02 15:18:19 2012 +0000
@@ -757,6 +757,42 @@
     return ctx;
 }
 
+static int flask_map_domain_pirq (struct domain *d, int irq, void *data)
+{
+    u32 sid;
+    int rc = -EPERM;
+    struct msi_info *msi = data;
+
+    struct domain_security_struct *ssec, *tsec;
+    struct avc_audit_data ad;
+
+    rc = domain_has_perm(current->domain, d, SECCLASS_RESOURCE, RESOURCE__ADD);
+
+    if ( rc )
+        return rc;
+
+    if ( irq >= nr_irqs_gsi && msi ) {
+        u32 machine_bdf = (msi->seg << 16) | (msi->bus << 8) | msi->devfn;
+        AVC_AUDIT_DATA_INIT(&ad, DEV);
+        ad.device = machine_bdf;
+        rc = security_device_sid(machine_bdf, &sid);
+    } else {
+        rc = get_irq_sid(irq, &sid, &ad);
+    }
+    if ( rc )
+        return rc;
+
+    ssec = current->domain->ssid;
+    tsec = d->ssid;
+
+    rc = avc_has_perm(ssec->sid, sid, SECCLASS_RESOURCE, RESOURCE__ADD_IRQ, &ad);
+    if ( rc )
+        return rc;
+
+    rc = avc_has_perm(tsec->sid, sid, SECCLASS_RESOURCE, RESOURCE__USE, &ad);
+    return rc;
+}
+
 static int flask_irq_permission (struct domain *d, int irq, uint8_t access)
 {
     u32 perm;
@@ -1582,6 +1618,7 @@
 
     .show_irq_sid = flask_show_irq_sid,
 
+    .map_domain_pirq = flask_map_domain_pirq,
     .irq_permission = flask_irq_permission,
     .iomem_permission = flask_iomem_permission,
     .pci_config_permission = flask_pci_config_permission,

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:37 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAP-0000Xf-I1; Fri, 03 Feb 2012 21:59:37 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAN-0000T4-P7
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:36 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-216.messagelabs.com!1328306368!13248818!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26783 invoked from network); 3 Feb 2012 21:59:29 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:29 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAG-0001rs-ML
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:28 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAF-0003UX-Vr
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:28 +0000
Message-Id: <E1RtRAF-0003UX-Vr@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:26 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xsm: Use mapped IRQ not PIRQ in
	unmap_domain_pirq
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328195930 0
# Node ID eaffacbba1d527a56d7bd52132e1b09a75dc624e
# Parent  1bc1e8eb9ce97aa24f08a9a44969f638a5765070
xsm: Use mapped IRQ not PIRQ in unmap_domain_pirq

XSM permissions are defined in terms of IRQs, not PIRQs; use the
correct number when checking permission in unmap_domain_pirq.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 1bc1e8eb9ce9 -r eaffacbba1d5 xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c	Thu Feb 02 15:18:19 2012 +0000
+++ b/xen/arch/x86/physdev.c	Thu Feb 02 15:18:50 2012 +0000
@@ -239,7 +239,7 @@
     if ( !IS_PRIV_FOR(current->domain, d) )
         goto free_domain;
 
-    ret = xsm_irq_permission(d, pirq, 0);
+    ret = xsm_irq_permission(d, domain_pirq_to_irq(d, pirq), 0);
     if ( ret )
         goto free_domain;
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:37 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAP-0000Xf-I1; Fri, 03 Feb 2012 21:59:37 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAN-0000T4-P7
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:36 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-216.messagelabs.com!1328306368!13248818!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26783 invoked from network); 3 Feb 2012 21:59:29 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:29 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAG-0001rs-ML
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:28 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAF-0003UX-Vr
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:28 +0000
Message-Id: <E1RtRAF-0003UX-Vr@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:26 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xsm: Use mapped IRQ not PIRQ in
	unmap_domain_pirq
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328195930 0
# Node ID eaffacbba1d527a56d7bd52132e1b09a75dc624e
# Parent  1bc1e8eb9ce97aa24f08a9a44969f638a5765070
xsm: Use mapped IRQ not PIRQ in unmap_domain_pirq

XSM permissions are defined in terms of IRQs, not PIRQs; use the
correct number when checking permission in unmap_domain_pirq.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 1bc1e8eb9ce9 -r eaffacbba1d5 xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c	Thu Feb 02 15:18:19 2012 +0000
+++ b/xen/arch/x86/physdev.c	Thu Feb 02 15:18:50 2012 +0000
@@ -239,7 +239,7 @@
     if ( !IS_PRIV_FOR(current->domain, d) )
         goto free_domain;
 
-    ret = xsm_irq_permission(d, pirq, 0);
+    ret = xsm_irq_permission(d, domain_pirq_to_irq(d, pirq), 0);
     if ( ret )
         goto free_domain;
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:39 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAR-0000ZZ-N7; Fri, 03 Feb 2012 21:59:39 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAP-0000XO-HG
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:37 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-27.messagelabs.com!1328306320!55318881!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18305 invoked from network); 3 Feb 2012 21:58:41 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:41 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAM-0001s6-Tf
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:34 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAL-0003Ws-Dd
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:34 +0000
Message-Id: <E1RtRAL-0003Ws-Dd@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:32 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] flask/policy: Policy build updates
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328196040 0
# Node ID d2c02f12aa82532ccf6321868d57f85b568d6b48
# Parent  80ade5616fc1ccb76a8da3b4eace8b302fdc5219
flask/policy: Policy build updates

Eliminate temporary files used in creating FLASK policy to improve
error reporting during policy build. Syntax errors now point to the
file and line number visible to the user, not the intermediate
temporary file.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 80ade5616fc1 -r d2c02f12aa82 tools/flask/policy/Makefile
--- a/tools/flask/policy/Makefile	Thu Feb 02 15:19:57 2012 +0000
+++ b/tools/flask/policy/Makefile	Thu Feb 02 15:20:40 2012 +0000
@@ -102,9 +102,8 @@
 	POLVER +=$(NAME).$(PV)
 endif
 
-
-# determine the policy version and current kernel version if possible
-M4PARAM += -D mls_num_sens=$(MLS_SENS) -D mls_num_cats=$(MLS_CATS) -D hide_broken_symptoms
+# Always define these because they are referenced even in non-MLS policy
+M4PARAM += -D mls_num_sens=$(MLS_SENS) -D mls_num_cats=$(MLS_CATS)
 
 M4SUPPORT = $(wildcard $(POLDIR)/support/*.spt)
 
@@ -126,9 +125,9 @@
 ALL_TE_FILES := $(ALL_MODULES)
 
 PRE_TE_FILES := $(SECCLASS) $(ISIDS) $(AVS) $(M4SUPPORT) $(POLDIR)/mls 
-POST_TE_FILES := $(POLDIR)/users $(POLDIR)/constraints
+POST_TE_FILES := $(POLDIR)/users $(POLDIR)/constraints $(POLDIR)/initial_sids
 
-POLICY_SECTIONS := tmp/pre_te_files.conf tmp/all_interfaces.conf tmp/all_attrs_types.conf $(GLOBALBOOL) $(GLOBALTUN) tmp/only_te_rules.conf tmp/all_post.conf
+POLICY_SECTIONS := $(PRE_TE_FILES) $(ALL_INTERFACES) $(GLOBALBOOL) $(GLOBALTUN) $(ALL_TE_FILES) $(POST_TE_FILES)
 
 ########################################
 #
@@ -140,7 +139,7 @@
 
 install: $(LOADPATH)
 
-load: tmp/load
+load: .load_stamp
 
 ########################################
 #
@@ -166,11 +165,11 @@
 #
 # Load the binary policy
 #
-tmp/load: reload
-reload: $(LOADPATH) $(FCPATH)
+.load_stamp: reload
+reload: $(LOADPATH)
 	@echo "Loading $(NAME) $(LOADPATH)"
 	$(QUIET) $(LOADPOLICY) $(LOADPATH)
-	@touch tmp/load
+	@touch .load_stamp
 
 ########################################
 #
@@ -181,50 +180,6 @@
 # checkpolicy can use the #line directives provided by -s for error reporting:
 	$(QUIET) m4 -D self_contained_policy $(M4PARAM) -s $^ > $@
 
-tmp/pre_te_files.conf: $(PRE_TE_FILES)
-	@test -d tmp || mkdir -p tmp
-	$(QUIET) cat $^ > $@
-
-tmp/all_interfaces.conf: $(M4SUPPORT) $(ALL_INTERFACES)
-ifeq ($(ALL_INTERFACES),)
-	$(error No enabled modules! $(notdir $(MOD_CONF)) please create a modules.conf file)
-endif
-	@test -d tmp || mkdir -p tmp
-	$(QUIET) cat $^ | sed -e s/dollarsstar/\$$\*/g > $@
-
-tmp/all_te_files.conf: $(ALL_TE_FILES)
-ifeq ($(ALL_TE_FILES),)
-	$(error No enabled modules! $(notdir $(MOD_CONF)) please create a modules.conf file)
-endif
-	@test -d tmp || mkdir -p tmp
-	$(QUIET) cat $^ > $@
-
-tmp/post_te_files.conf: $(POST_TE_FILES)
-	@test -d tmp || mkdir -p tmp
-	$(QUIET) cat $^ > $@
-
-# extract attributes and put them first. extract post te stuff
-# like genfscon and put last.  portcon, nodecon, and netifcon
-# is delayed since they are generated by m4
-tmp/all_attrs_types.conf tmp/all_post.conf: tmp/only_te_rules.conf
-tmp/only_te_rules.conf: tmp/all_te_files.conf tmp/post_te_files.conf
-	$(QUIET) grep ^attribute tmp/all_te_files.conf > tmp/all_attrs_types.conf || true
-	$(QUIET) grep '^type ' tmp/all_te_files.conf >> tmp/all_attrs_types.conf
-	$(QUIET) cat tmp/post_te_files.conf > tmp/all_post.conf
-	$(QUIET) grep '^sid ' tmp/all_te_files.conf >> tmp/all_post.conf || true
-	$(QUIET) grep ^pirqcon tmp/all_te_files.conf >> \
-                      tmp/all_post.conf || true
-	$(QUIET) grep ^ioportcon tmp/all_te_files.conf >> \
-                      tmp/all_post.conf || true
-	$(QUIET) grep ^iomemcon tmp/all_te_files.conf >> \
-                      tmp/all_post.conf || true
-	$(QUIET) grep ^pcidevicecon tmp/all_te_files.conf >> \
-                      tmp/all_post.conf || true
-	$(QUIET) sed -r -e /^attribute/d -e '/^type /d' -e '/^sid /d' \
-                     -e "/^pirqcon/d" -e "/^pcidevicecon/d" -e "/^ioportcon/d" \
-                     -e "/^iomemcon/d" < tmp/all_te_files.conf \
-                     > tmp/only_te_rules.conf
-
 ########################################
 #
 # Remove the dontaudit rules from the policy.conf
diff -r 80ade5616fc1 -r d2c02f12aa82 tools/flask/policy/policy/initial_sids
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/flask/policy/policy/initial_sids	Thu Feb 02 15:20:40 2012 +0000
@@ -0,0 +1,12 @@
+# Labels for initial SIDs
+
+sid xen gen_context(system_u:system_r:xen_t,s0)
+sid dom0 gen_context(system_u:system_r:dom0_t,s0)
+sid domxen gen_context(system_u:system_r:domxen_t,s0)
+sid domio gen_context(system_u:system_r:domio_t,s0)
+sid unlabeled gen_context(system_u:system_r:unlabeled_t,s0)
+sid security gen_context(system_u:system_r:security_t,s0)
+sid irq gen_context(system_u:object_r:irq_t,s0)
+sid iomem gen_context(system_u:object_r:iomem_t,s0)
+sid ioport gen_context(system_u:object_r:ioport_t,s0)
+sid device gen_context(system_u:object_r:device_t,s0)
diff -r 80ade5616fc1 -r d2c02f12aa82 tools/flask/policy/policy/modules/xen/xen.te
--- a/tools/flask/policy/policy/modules/xen/xen.te	Thu Feb 02 15:19:57 2012 +0000
+++ b/tools/flask/policy/policy/modules/xen/xen.te	Thu Feb 02 15:20:40 2012 +0000
@@ -162,16 +162,6 @@
 # Labels for initial SIDs and system role
 #
 ################################################################################
-sid xen gen_context(system_u:system_r:xen_t,s0)
-sid dom0 gen_context(system_u:system_r:dom0_t,s0)
-sid domxen gen_context(system_u:system_r:domxen_t,s0)
-sid domio gen_context(system_u:system_r:domio_t,s0)
-sid unlabeled gen_context(system_u:system_r:unlabeled_t,s0)
-sid security gen_context(system_u:system_r:security_t,s0)
-sid irq gen_context(system_u:object_r:irq_t,s0)
-sid iomem gen_context(system_u:object_r:iomem_t,s0)
-sid ioport gen_context(system_u:object_r:ioport_t,s0)
-sid device gen_context(system_u:object_r:device_t,s0)
 
 role system_r;
 role system_r types { xen_type domain_type };

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:39 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAR-0000ZZ-N7; Fri, 03 Feb 2012 21:59:39 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAP-0000XO-HG
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:37 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-27.messagelabs.com!1328306320!55318881!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18305 invoked from network); 3 Feb 2012 21:58:41 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:58:41 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAM-0001s6-Tf
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:34 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAL-0003Ws-Dd
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:34 +0000
Message-Id: <E1RtRAL-0003Ws-Dd@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:32 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] flask/policy: Policy build updates
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328196040 0
# Node ID d2c02f12aa82532ccf6321868d57f85b568d6b48
# Parent  80ade5616fc1ccb76a8da3b4eace8b302fdc5219
flask/policy: Policy build updates

Eliminate temporary files used in creating FLASK policy to improve
error reporting during policy build. Syntax errors now point to the
file and line number visible to the user, not the intermediate
temporary file.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 80ade5616fc1 -r d2c02f12aa82 tools/flask/policy/Makefile
--- a/tools/flask/policy/Makefile	Thu Feb 02 15:19:57 2012 +0000
+++ b/tools/flask/policy/Makefile	Thu Feb 02 15:20:40 2012 +0000
@@ -102,9 +102,8 @@
 	POLVER +=$(NAME).$(PV)
 endif
 
-
-# determine the policy version and current kernel version if possible
-M4PARAM += -D mls_num_sens=$(MLS_SENS) -D mls_num_cats=$(MLS_CATS) -D hide_broken_symptoms
+# Always define these because they are referenced even in non-MLS policy
+M4PARAM += -D mls_num_sens=$(MLS_SENS) -D mls_num_cats=$(MLS_CATS)
 
 M4SUPPORT = $(wildcard $(POLDIR)/support/*.spt)
 
@@ -126,9 +125,9 @@
 ALL_TE_FILES := $(ALL_MODULES)
 
 PRE_TE_FILES := $(SECCLASS) $(ISIDS) $(AVS) $(M4SUPPORT) $(POLDIR)/mls 
-POST_TE_FILES := $(POLDIR)/users $(POLDIR)/constraints
+POST_TE_FILES := $(POLDIR)/users $(POLDIR)/constraints $(POLDIR)/initial_sids
 
-POLICY_SECTIONS := tmp/pre_te_files.conf tmp/all_interfaces.conf tmp/all_attrs_types.conf $(GLOBALBOOL) $(GLOBALTUN) tmp/only_te_rules.conf tmp/all_post.conf
+POLICY_SECTIONS := $(PRE_TE_FILES) $(ALL_INTERFACES) $(GLOBALBOOL) $(GLOBALTUN) $(ALL_TE_FILES) $(POST_TE_FILES)
 
 ########################################
 #
@@ -140,7 +139,7 @@
 
 install: $(LOADPATH)
 
-load: tmp/load
+load: .load_stamp
 
 ########################################
 #
@@ -166,11 +165,11 @@
 #
 # Load the binary policy
 #
-tmp/load: reload
-reload: $(LOADPATH) $(FCPATH)
+.load_stamp: reload
+reload: $(LOADPATH)
 	@echo "Loading $(NAME) $(LOADPATH)"
 	$(QUIET) $(LOADPOLICY) $(LOADPATH)
-	@touch tmp/load
+	@touch .load_stamp
 
 ########################################
 #
@@ -181,50 +180,6 @@
 # checkpolicy can use the #line directives provided by -s for error reporting:
 	$(QUIET) m4 -D self_contained_policy $(M4PARAM) -s $^ > $@
 
-tmp/pre_te_files.conf: $(PRE_TE_FILES)
-	@test -d tmp || mkdir -p tmp
-	$(QUIET) cat $^ > $@
-
-tmp/all_interfaces.conf: $(M4SUPPORT) $(ALL_INTERFACES)
-ifeq ($(ALL_INTERFACES),)
-	$(error No enabled modules! $(notdir $(MOD_CONF)) please create a modules.conf file)
-endif
-	@test -d tmp || mkdir -p tmp
-	$(QUIET) cat $^ | sed -e s/dollarsstar/\$$\*/g > $@
-
-tmp/all_te_files.conf: $(ALL_TE_FILES)
-ifeq ($(ALL_TE_FILES),)
-	$(error No enabled modules! $(notdir $(MOD_CONF)) please create a modules.conf file)
-endif
-	@test -d tmp || mkdir -p tmp
-	$(QUIET) cat $^ > $@
-
-tmp/post_te_files.conf: $(POST_TE_FILES)
-	@test -d tmp || mkdir -p tmp
-	$(QUIET) cat $^ > $@
-
-# extract attributes and put them first. extract post te stuff
-# like genfscon and put last.  portcon, nodecon, and netifcon
-# is delayed since they are generated by m4
-tmp/all_attrs_types.conf tmp/all_post.conf: tmp/only_te_rules.conf
-tmp/only_te_rules.conf: tmp/all_te_files.conf tmp/post_te_files.conf
-	$(QUIET) grep ^attribute tmp/all_te_files.conf > tmp/all_attrs_types.conf || true
-	$(QUIET) grep '^type ' tmp/all_te_files.conf >> tmp/all_attrs_types.conf
-	$(QUIET) cat tmp/post_te_files.conf > tmp/all_post.conf
-	$(QUIET) grep '^sid ' tmp/all_te_files.conf >> tmp/all_post.conf || true
-	$(QUIET) grep ^pirqcon tmp/all_te_files.conf >> \
-                      tmp/all_post.conf || true
-	$(QUIET) grep ^ioportcon tmp/all_te_files.conf >> \
-                      tmp/all_post.conf || true
-	$(QUIET) grep ^iomemcon tmp/all_te_files.conf >> \
-                      tmp/all_post.conf || true
-	$(QUIET) grep ^pcidevicecon tmp/all_te_files.conf >> \
-                      tmp/all_post.conf || true
-	$(QUIET) sed -r -e /^attribute/d -e '/^type /d' -e '/^sid /d' \
-                     -e "/^pirqcon/d" -e "/^pcidevicecon/d" -e "/^ioportcon/d" \
-                     -e "/^iomemcon/d" < tmp/all_te_files.conf \
-                     > tmp/only_te_rules.conf
-
 ########################################
 #
 # Remove the dontaudit rules from the policy.conf
diff -r 80ade5616fc1 -r d2c02f12aa82 tools/flask/policy/policy/initial_sids
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/flask/policy/policy/initial_sids	Thu Feb 02 15:20:40 2012 +0000
@@ -0,0 +1,12 @@
+# Labels for initial SIDs
+
+sid xen gen_context(system_u:system_r:xen_t,s0)
+sid dom0 gen_context(system_u:system_r:dom0_t,s0)
+sid domxen gen_context(system_u:system_r:domxen_t,s0)
+sid domio gen_context(system_u:system_r:domio_t,s0)
+sid unlabeled gen_context(system_u:system_r:unlabeled_t,s0)
+sid security gen_context(system_u:system_r:security_t,s0)
+sid irq gen_context(system_u:object_r:irq_t,s0)
+sid iomem gen_context(system_u:object_r:iomem_t,s0)
+sid ioport gen_context(system_u:object_r:ioport_t,s0)
+sid device gen_context(system_u:object_r:device_t,s0)
diff -r 80ade5616fc1 -r d2c02f12aa82 tools/flask/policy/policy/modules/xen/xen.te
--- a/tools/flask/policy/policy/modules/xen/xen.te	Thu Feb 02 15:19:57 2012 +0000
+++ b/tools/flask/policy/policy/modules/xen/xen.te	Thu Feb 02 15:20:40 2012 +0000
@@ -162,16 +162,6 @@
 # Labels for initial SIDs and system role
 #
 ################################################################################
-sid xen gen_context(system_u:system_r:xen_t,s0)
-sid dom0 gen_context(system_u:system_r:dom0_t,s0)
-sid domxen gen_context(system_u:system_r:domxen_t,s0)
-sid domio gen_context(system_u:system_r:domio_t,s0)
-sid unlabeled gen_context(system_u:system_r:unlabeled_t,s0)
-sid security gen_context(system_u:system_r:security_t,s0)
-sid irq gen_context(system_u:object_r:irq_t,s0)
-sid iomem gen_context(system_u:object_r:iomem_t,s0)
-sid ioport gen_context(system_u:object_r:ioport_t,s0)
-sid device gen_context(system_u:object_r:device_t,s0)
 
 role system_r;
 role system_r types { xen_type domain_type };

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:40 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAR-0000Zh-Pb; Fri, 03 Feb 2012 21:59:39 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAR-0000VJ-25
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:39 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-216.messagelabs.com!1328306371!13419492!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28323 invoked from network); 3 Feb 2012 21:59:32 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:32 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAJ-0001rx-Q9
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:31 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAH-0003VH-G2
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:31 +0000
Message-Id: <E1RtRAH-0003VH-G2@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:28 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xsm/flask: Improve error reporting
	for ocontexts
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328195964 0
# Node ID 912bbca1a8e7bc93cfe492bc32a352dcd2bd477b
# Parent  eaffacbba1d527a56d7bd52132e1b09a75dc624e
xsm/flask: Improve error reporting for ocontexts

Instead of returning -EINVAL for all errors, return -EEXIST if adding
an entry that overlaps with an existing entry, and -ENOENT if
attempting to remove an entry that does not exist. Adding an ocontext
that already exists with the same SID is no longer an error.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r eaffacbba1d5 -r 912bbca1a8e7 xen/xsm/flask/ss/services.c
--- a/xen/xsm/flask/ss/services.c	Thu Feb 02 15:18:50 2012 +0000
+++ b/xen/xsm/flask/ss/services.c	Thu Feb 02 15:19:24 2012 +0000
@@ -2084,8 +2084,10 @@
         {
             if ( c->u.pirq == add->u.pirq )
             {
+                if ( c->sid[0] == sid )
+                    break;
                 printk("%s: Duplicate pirq %d\n", __FUNCTION__, add->u.pirq);
-                ret = -EINVAL;
+                ret = -EEXIST;
                 break;
             }
             c = c->next;
@@ -2112,10 +2114,14 @@
 
         if (c && c->u.ioport.low_ioport <= high)
         {
+            if (c->u.ioport.low_ioport == low &&
+                c->u.ioport.high_ioport == high && c->sid[0] == sid)
+                break;
+
             printk("%s: IO Port overlap with entry 0x%x - 0x%x\n",
                    __FUNCTION__, c->u.ioport.low_ioport,
                    c->u.ioport.high_ioport);
-            ret = -EINVAL;
+            ret = -EEXIST;
             break;
         }
 
@@ -2142,10 +2148,14 @@
 
         if (c && c->u.iomem.low_iomem <= high)
         {
+            if (c->u.iomem.low_iomem == low &&
+                c->u.iomem.high_iomem == high && c->sid[0] == sid)
+                break;
+
             printk("%s: IO Memory overlap with entry 0x%x - 0x%x\n",
                    __FUNCTION__, c->u.iomem.low_iomem,
                    c->u.iomem.high_iomem);
-            ret = -EINVAL;
+            ret = -EEXIST;
             break;
         }
 
@@ -2171,9 +2181,12 @@
         {
             if ( c->u.device == add->u.device )
             {
+                if ( c->sid[0] == sid )
+                    break;
+
                 printk("%s: Duplicate PCI Device 0x%x\n", __FUNCTION__,
                         add->u.device);
-                ret = -EINVAL;
+                ret = -EEXIST;
                 break;
             }
             c = c->next;
@@ -2230,7 +2243,7 @@
         }
 
         printk("%s: ocontext not found: pirq %d\n", __FUNCTION__, low);
-        ret = -EINVAL;
+        ret = -ENOENT;
         break;
 
     case OCON_IOPORT:
@@ -2257,7 +2270,7 @@
 
         printk("%s: ocontext not found: ioport 0x%x - 0x%x\n", __FUNCTION__,
                 low, high);
-        ret = -EINVAL;
+        ret = -ENOENT;
         break;
 
     case OCON_IOMEM:
@@ -2284,7 +2297,7 @@
 
         printk("%s: ocontext not found: iomem 0x%x - 0x%x\n", __FUNCTION__,
                 low, high);
-        ret = -EINVAL;
+        ret = -ENOENT;
         break;
 
     case OCON_DEVICE:
@@ -2309,7 +2322,7 @@
         }
 
         printk("%s: ocontext not found: pcidevice 0x%x\n", __FUNCTION__, low);
-        ret = -EINVAL;
+        ret = -ENOENT;
         break;
 
     default:

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:40 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAR-0000Zh-Pb; Fri, 03 Feb 2012 21:59:39 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAR-0000VJ-25
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:39 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-216.messagelabs.com!1328306371!13419492!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28323 invoked from network); 3 Feb 2012 21:59:32 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:32 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAJ-0001rx-Q9
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:31 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAH-0003VH-G2
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:31 +0000
Message-Id: <E1RtRAH-0003VH-G2@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:28 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xsm/flask: Improve error reporting
	for ocontexts
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328195964 0
# Node ID 912bbca1a8e7bc93cfe492bc32a352dcd2bd477b
# Parent  eaffacbba1d527a56d7bd52132e1b09a75dc624e
xsm/flask: Improve error reporting for ocontexts

Instead of returning -EINVAL for all errors, return -EEXIST if adding
an entry that overlaps with an existing entry, and -ENOENT if
attempting to remove an entry that does not exist. Adding an ocontext
that already exists with the same SID is no longer an error.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r eaffacbba1d5 -r 912bbca1a8e7 xen/xsm/flask/ss/services.c
--- a/xen/xsm/flask/ss/services.c	Thu Feb 02 15:18:50 2012 +0000
+++ b/xen/xsm/flask/ss/services.c	Thu Feb 02 15:19:24 2012 +0000
@@ -2084,8 +2084,10 @@
         {
             if ( c->u.pirq == add->u.pirq )
             {
+                if ( c->sid[0] == sid )
+                    break;
                 printk("%s: Duplicate pirq %d\n", __FUNCTION__, add->u.pirq);
-                ret = -EINVAL;
+                ret = -EEXIST;
                 break;
             }
             c = c->next;
@@ -2112,10 +2114,14 @@
 
         if (c && c->u.ioport.low_ioport <= high)
         {
+            if (c->u.ioport.low_ioport == low &&
+                c->u.ioport.high_ioport == high && c->sid[0] == sid)
+                break;
+
             printk("%s: IO Port overlap with entry 0x%x - 0x%x\n",
                    __FUNCTION__, c->u.ioport.low_ioport,
                    c->u.ioport.high_ioport);
-            ret = -EINVAL;
+            ret = -EEXIST;
             break;
         }
 
@@ -2142,10 +2148,14 @@
 
         if (c && c->u.iomem.low_iomem <= high)
         {
+            if (c->u.iomem.low_iomem == low &&
+                c->u.iomem.high_iomem == high && c->sid[0] == sid)
+                break;
+
             printk("%s: IO Memory overlap with entry 0x%x - 0x%x\n",
                    __FUNCTION__, c->u.iomem.low_iomem,
                    c->u.iomem.high_iomem);
-            ret = -EINVAL;
+            ret = -EEXIST;
             break;
         }
 
@@ -2171,9 +2181,12 @@
         {
             if ( c->u.device == add->u.device )
             {
+                if ( c->sid[0] == sid )
+                    break;
+
                 printk("%s: Duplicate PCI Device 0x%x\n", __FUNCTION__,
                         add->u.device);
-                ret = -EINVAL;
+                ret = -EEXIST;
                 break;
             }
             c = c->next;
@@ -2230,7 +2243,7 @@
         }
 
         printk("%s: ocontext not found: pirq %d\n", __FUNCTION__, low);
-        ret = -EINVAL;
+        ret = -ENOENT;
         break;
 
     case OCON_IOPORT:
@@ -2257,7 +2270,7 @@
 
         printk("%s: ocontext not found: ioport 0x%x - 0x%x\n", __FUNCTION__,
                 low, high);
-        ret = -EINVAL;
+        ret = -ENOENT;
         break;
 
     case OCON_IOMEM:
@@ -2284,7 +2297,7 @@
 
         printk("%s: ocontext not found: iomem 0x%x - 0x%x\n", __FUNCTION__,
                 low, high);
-        ret = -EINVAL;
+        ret = -ENOENT;
         break;
 
     case OCON_DEVICE:
@@ -2309,7 +2322,7 @@
         }
 
         printk("%s: ocontext not found: pcidevice 0x%x\n", __FUNCTION__, low);
-        ret = -EINVAL;
+        ret = -ENOENT;
         break;
 
     default:

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:41 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAS-0000ar-ST; Fri, 03 Feb 2012 21:59:40 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAR-0000Vd-Ry
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:40 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1328306372!13046590!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13476 invoked from network); 3 Feb 2012 21:59:33 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:33 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAK-0001s1-I9
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:32 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAK-0003WM-AF
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:32 +0000
Message-Id: <E1RtRAK-0003WM-AF@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:31 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xsm/flask: Remove useless back
	pointers
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328195997 0
# Node ID 80ade5616fc1ccb76a8da3b4eace8b302fdc5219
# Parent  912bbca1a8e7bc93cfe492bc32a352dcd2bd477b
xsm/flask: Remove useless back pointers

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 912bbca1a8e7 -r 80ade5616fc1 xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c	Thu Feb 02 15:19:24 2012 +0000
+++ b/xen/xsm/flask/hooks.c	Thu Feb 02 15:19:57 2012 +0000
@@ -104,8 +104,6 @@
 
     memset(dsec, 0, sizeof(struct domain_security_struct));
 
-    dsec->d = d;
-
     if ( is_idle_domain(d) )
     {
         dsec->sid = SECINITSID_XEN;
@@ -281,7 +279,6 @@
 
     memset(esec, 0, sizeof(struct evtchn_security_struct));
 
-    esec->chn = chn;
     esec->sid = SECINITSID_UNLABELED;
 
     chn->ssid = esec;
diff -r 912bbca1a8e7 -r 80ade5616fc1 xen/xsm/flask/include/objsec.h
--- a/xen/xsm/flask/include/objsec.h	Thu Feb 02 15:19:24 2012 +0000
+++ b/xen/xsm/flask/include/objsec.h	Thu Feb 02 15:19:57 2012 +0000
@@ -18,13 +18,11 @@
 #include "avc.h"
 
 struct domain_security_struct {
-    struct domain *d;      /* back pointer to domain object */
     u32 sid;               /* current SID */
     u32 create_sid;
 };
 
 struct evtchn_security_struct {
-    struct evtchn *chn;      /* back pointer to evtchn object */
     u32 sid;                 /* current SID */
 };
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:41 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAS-0000ar-ST; Fri, 03 Feb 2012 21:59:40 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAR-0000Vd-Ry
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:40 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1328306372!13046590!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13476 invoked from network); 3 Feb 2012 21:59:33 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:33 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAK-0001s1-I9
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:32 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAK-0003WM-AF
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:32 +0000
Message-Id: <E1RtRAK-0003WM-AF@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:31 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xsm/flask: Remove useless back
	pointers
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328195997 0
# Node ID 80ade5616fc1ccb76a8da3b4eace8b302fdc5219
# Parent  912bbca1a8e7bc93cfe492bc32a352dcd2bd477b
xsm/flask: Remove useless back pointers

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 912bbca1a8e7 -r 80ade5616fc1 xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c	Thu Feb 02 15:19:24 2012 +0000
+++ b/xen/xsm/flask/hooks.c	Thu Feb 02 15:19:57 2012 +0000
@@ -104,8 +104,6 @@
 
     memset(dsec, 0, sizeof(struct domain_security_struct));
 
-    dsec->d = d;
-
     if ( is_idle_domain(d) )
     {
         dsec->sid = SECINITSID_XEN;
@@ -281,7 +279,6 @@
 
     memset(esec, 0, sizeof(struct evtchn_security_struct));
 
-    esec->chn = chn;
     esec->sid = SECINITSID_UNLABELED;
 
     chn->ssid = esec;
diff -r 912bbca1a8e7 -r 80ade5616fc1 xen/xsm/flask/include/objsec.h
--- a/xen/xsm/flask/include/objsec.h	Thu Feb 02 15:19:24 2012 +0000
+++ b/xen/xsm/flask/include/objsec.h	Thu Feb 02 15:19:57 2012 +0000
@@ -18,13 +18,11 @@
 #include "avc.h"
 
 struct domain_security_struct {
-    struct domain *d;      /* back pointer to domain object */
     u32 sid;               /* current SID */
     u32 create_sid;
 };
 
 struct evtchn_security_struct {
-    struct evtchn *chn;      /* back pointer to evtchn object */
     u32 sid;                 /* current SID */
 };
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:45 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAX-0000dj-2M; Fri, 03 Feb 2012 21:59:45 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAW-0000Yr-4O
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:44 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-216.messagelabs.com!1328306376!12497934!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31728 invoked from network); 3 Feb 2012 21:59:37 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:37 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAO-0001sA-Ke
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:36 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAN-0003Xj-Nt
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:36 +0000
Message-Id: <E1RtRAN-0003Xj-Nt@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:34 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] flask/policy: Add user and
	constraint examples
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328196073 0
# Node ID 87d642dc65bb723fac66a0bfdeb7204174ec293f
# Parent  d2c02f12aa82532ccf6321868d57f85b568d6b48
flask/policy: Add user and constraint examples

These examples show how to use constraints and the user field of the
security label to prevent communication between virtual machines of
different customers in a multi-tenant environment.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r d2c02f12aa82 -r 87d642dc65bb docs/misc/xsm-flask.txt
--- a/docs/misc/xsm-flask.txt	Thu Feb 02 15:20:40 2012 +0000
+++ b/docs/misc/xsm-flask.txt	Thu Feb 02 15:21:13 2012 +0000
@@ -27,14 +27,17 @@
 
 FLASK uses only one domain configuration parameter (seclabel) defining the
 full security label of the newly created domain. If using the example policy,
-"seclabel='system_u:system_r:domU_t'" would be used for normal domains. For
-simple policies including the example policy, the user and role portions of the
-label are unused and will always be "system_u:system_r".  Most of FLASK policy
-consists of defining the interactions allowed between different types (domU_t
-would be the type in this example); FLASK policy does not distinguish between
-domains with the same type. This is the same format as used for SELinux
-labeling; see http://selinuxproject.org for more details on the use of the user,
-role, and optional MLS/MCS labels.
+"seclabel='system_u:system_r:domU_t'" is an example of a normal domain. The
+labels are in the same format as SELinux labels; see http://selinuxproject.org
+for more details on the use of the user, role, and optional MLS/MCS labels.
+
+FLASK policy overview
+---------------------
+
+Most of FLASK policy consists of defining the interactions allowed between
+different types (domU_t would be the type in this example). For simple policies,
+only type enforcement is used and the user and role are set to system_u and
+system_r for all domains.
 
 The FLASK security framework is mostly configured using a security policy file.
 This policy file is not normally generated during the Xen build process because
@@ -57,8 +60,27 @@
  - domU_t is a domain that can communicate with any other domU_t
  - isolated_domU_t can only communicate with dom0
 
-More types can be added to allow groups of domains to communicate without
-allowing communication between groups, or only between certain groups.
+One disadvantage of using type enforcement to enforce isolation is that a new
+type is needed for each group of domains. In addition, it is not possible to
+allow isolated_domU_t cannot to create loopback event channels without allowing
+two domains of type isolated_domU_t to communicate with one another.
+
+Users and roles
+---------------
+
+Users are defined in tools/flask/policy/policy/users. The example policy defines
+two users (customer_1 and customer_2) in addition to the system user system_u.
+Users are visible in the labels of domains and associated objects (event
+channels); in the example policy, "customer_1:vm_r:domU_t" is a valid label for
+the customer_1 user.
+
+Access control rules involving users and roles are defined in the policy
+constraints file (tools/flask/policy/policy/constraints). The example policy
+provides constraints that prevent different users from communicating using
+grants or event channels, while still allowing communication with dom0.
+
+Resource Policy
+---------------
 
 The example policy also includes a resource type (nic_dev_t) for device
 passthrough, configured to allow use by domU_t. To label the PCI device 3:2.0
diff -r d2c02f12aa82 -r 87d642dc65bb tools/flask/policy/policy/constraints
--- a/tools/flask/policy/policy/constraints	Thu Feb 02 15:20:40 2012 +0000
+++ b/tools/flask/policy/policy/constraints	Thu Feb 02 15:21:13 2012 +0000
@@ -22,6 +22,19 @@
 # role_op : == | != | eq | dom | domby | incomp
 #
 # names : name | { name_list }
-# name_list : name | name_list name		
+# name_list : name | name_list name
 #
 
+# Prevent event channels and grants between different customers
+
+constrain event bind (
+	u1 == system_u or
+	u2 == system_u or
+	u1 == u2
+);
+
+constrain grant { map_read map_write copy } (
+	u1 == system_u or
+	u2 == system_u or
+	u1 == u2
+);
diff -r d2c02f12aa82 -r 87d642dc65bb tools/flask/policy/policy/modules/xen/xen.te
--- a/tools/flask/policy/policy/modules/xen/xen.te	Thu Feb 02 15:20:40 2012 +0000
+++ b/tools/flask/policy/policy/modules/xen/xen.te	Thu Feb 02 15:21:13 2012 +0000
@@ -22,22 +22,22 @@
 ################################################################################
 
 # The hypervisor itself
-type xen_t, xen_type, domain_type, mls_priv;
+type xen_t, xen_type, mls_priv;
 
 # Domain 0
 type dom0_t, domain_type, mls_priv;
 
 # Untracked I/O memory (pseudo-domain)
-type domio_t, domain_type;
+type domio_t, xen_type;
 
 # Xen heap (pseudo-domain)
-type domxen_t, domain_type;
+type domxen_t, xen_type;
 
 # Unlabeled objects
-type unlabeled_t, domain_type;
+type unlabeled_t, xen_type;
 
 # The XSM/FLASK security server
-type security_t, domain_type;
+type security_t, xen_type;
 
 # Unlabeled device resources
 # Note: don't allow access to these types directly; see below for how to label
@@ -143,7 +143,11 @@
 
 ################################################################################
 #
-# Constraints
+# Policy constraints
+#
+# Neverallow rules will cause the policy build to fail if an allow rule exists
+# that violates the expression. This is used to ensure proper labeling of
+# objects.
 #
 ################################################################################
 
@@ -159,9 +163,19 @@
 
 ################################################################################
 #
-# Labels for initial SIDs and system role
+# Roles
 #
 ################################################################################
 
+# The object role (object_r) is used for devices, resources, and event channels;
+# it does not need to be defined here and should not be used for domains.
+
+# The system role is used for utility domains and pseudo-domains
 role system_r;
 role system_r types { xen_type domain_type };
+# If you want to prevent domUs from being placed in system_r:
+##role system_r types { xen_type dom0_t };
+
+# The vm role is used for customer virtual machines
+role vm_r;
+role vm_r types { domain_type -dom0_t };
diff -r d2c02f12aa82 -r 87d642dc65bb tools/flask/policy/policy/users
--- a/tools/flask/policy/policy/users	Thu Feb 02 15:20:40 2012 +0000
+++ b/tools/flask/policy/policy/users	Thu Feb 02 15:21:13 2012 +0000
@@ -3,15 +3,9 @@
 # System User configuration.
 #
 
-#
-# gen_user(username, role_set, mls_defaultlevel, mls_range)
-#
-
-#
-# system_u is the user identity for system processes and objects.
-# There should be no corresponding Unix user identity for system,
-# and a user process should never be assigned the system user
-# identity.
-#
+# system_u is the user identity for system domains and objects
 gen_user(system_u,, system_r, s0, s0 - mls_systemhigh)
 
+# Other users are defined using the vm role
+gen_user(customer_1,, vm_r, s0, s0)
+gen_user(customer_2,, vm_r, s0, s0)

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:45 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAX-0000dj-2M; Fri, 03 Feb 2012 21:59:45 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAW-0000Yr-4O
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:44 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-216.messagelabs.com!1328306376!12497934!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31728 invoked from network); 3 Feb 2012 21:59:37 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:37 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAO-0001sA-Ke
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:36 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAN-0003Xj-Nt
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:36 +0000
Message-Id: <E1RtRAN-0003Xj-Nt@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:34 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] flask/policy: Add user and
	constraint examples
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328196073 0
# Node ID 87d642dc65bb723fac66a0bfdeb7204174ec293f
# Parent  d2c02f12aa82532ccf6321868d57f85b568d6b48
flask/policy: Add user and constraint examples

These examples show how to use constraints and the user field of the
security label to prevent communication between virtual machines of
different customers in a multi-tenant environment.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r d2c02f12aa82 -r 87d642dc65bb docs/misc/xsm-flask.txt
--- a/docs/misc/xsm-flask.txt	Thu Feb 02 15:20:40 2012 +0000
+++ b/docs/misc/xsm-flask.txt	Thu Feb 02 15:21:13 2012 +0000
@@ -27,14 +27,17 @@
 
 FLASK uses only one domain configuration parameter (seclabel) defining the
 full security label of the newly created domain. If using the example policy,
-"seclabel='system_u:system_r:domU_t'" would be used for normal domains. For
-simple policies including the example policy, the user and role portions of the
-label are unused and will always be "system_u:system_r".  Most of FLASK policy
-consists of defining the interactions allowed between different types (domU_t
-would be the type in this example); FLASK policy does not distinguish between
-domains with the same type. This is the same format as used for SELinux
-labeling; see http://selinuxproject.org for more details on the use of the user,
-role, and optional MLS/MCS labels.
+"seclabel='system_u:system_r:domU_t'" is an example of a normal domain. The
+labels are in the same format as SELinux labels; see http://selinuxproject.org
+for more details on the use of the user, role, and optional MLS/MCS labels.
+
+FLASK policy overview
+---------------------
+
+Most of FLASK policy consists of defining the interactions allowed between
+different types (domU_t would be the type in this example). For simple policies,
+only type enforcement is used and the user and role are set to system_u and
+system_r for all domains.
 
 The FLASK security framework is mostly configured using a security policy file.
 This policy file is not normally generated during the Xen build process because
@@ -57,8 +60,27 @@
  - domU_t is a domain that can communicate with any other domU_t
  - isolated_domU_t can only communicate with dom0
 
-More types can be added to allow groups of domains to communicate without
-allowing communication between groups, or only between certain groups.
+One disadvantage of using type enforcement to enforce isolation is that a new
+type is needed for each group of domains. In addition, it is not possible to
+allow isolated_domU_t cannot to create loopback event channels without allowing
+two domains of type isolated_domU_t to communicate with one another.
+
+Users and roles
+---------------
+
+Users are defined in tools/flask/policy/policy/users. The example policy defines
+two users (customer_1 and customer_2) in addition to the system user system_u.
+Users are visible in the labels of domains and associated objects (event
+channels); in the example policy, "customer_1:vm_r:domU_t" is a valid label for
+the customer_1 user.
+
+Access control rules involving users and roles are defined in the policy
+constraints file (tools/flask/policy/policy/constraints). The example policy
+provides constraints that prevent different users from communicating using
+grants or event channels, while still allowing communication with dom0.
+
+Resource Policy
+---------------
 
 The example policy also includes a resource type (nic_dev_t) for device
 passthrough, configured to allow use by domU_t. To label the PCI device 3:2.0
diff -r d2c02f12aa82 -r 87d642dc65bb tools/flask/policy/policy/constraints
--- a/tools/flask/policy/policy/constraints	Thu Feb 02 15:20:40 2012 +0000
+++ b/tools/flask/policy/policy/constraints	Thu Feb 02 15:21:13 2012 +0000
@@ -22,6 +22,19 @@
 # role_op : == | != | eq | dom | domby | incomp
 #
 # names : name | { name_list }
-# name_list : name | name_list name		
+# name_list : name | name_list name
 #
 
+# Prevent event channels and grants between different customers
+
+constrain event bind (
+	u1 == system_u or
+	u2 == system_u or
+	u1 == u2
+);
+
+constrain grant { map_read map_write copy } (
+	u1 == system_u or
+	u2 == system_u or
+	u1 == u2
+);
diff -r d2c02f12aa82 -r 87d642dc65bb tools/flask/policy/policy/modules/xen/xen.te
--- a/tools/flask/policy/policy/modules/xen/xen.te	Thu Feb 02 15:20:40 2012 +0000
+++ b/tools/flask/policy/policy/modules/xen/xen.te	Thu Feb 02 15:21:13 2012 +0000
@@ -22,22 +22,22 @@
 ################################################################################
 
 # The hypervisor itself
-type xen_t, xen_type, domain_type, mls_priv;
+type xen_t, xen_type, mls_priv;
 
 # Domain 0
 type dom0_t, domain_type, mls_priv;
 
 # Untracked I/O memory (pseudo-domain)
-type domio_t, domain_type;
+type domio_t, xen_type;
 
 # Xen heap (pseudo-domain)
-type domxen_t, domain_type;
+type domxen_t, xen_type;
 
 # Unlabeled objects
-type unlabeled_t, domain_type;
+type unlabeled_t, xen_type;
 
 # The XSM/FLASK security server
-type security_t, domain_type;
+type security_t, xen_type;
 
 # Unlabeled device resources
 # Note: don't allow access to these types directly; see below for how to label
@@ -143,7 +143,11 @@
 
 ################################################################################
 #
-# Constraints
+# Policy constraints
+#
+# Neverallow rules will cause the policy build to fail if an allow rule exists
+# that violates the expression. This is used to ensure proper labeling of
+# objects.
 #
 ################################################################################
 
@@ -159,9 +163,19 @@
 
 ################################################################################
 #
-# Labels for initial SIDs and system role
+# Roles
 #
 ################################################################################
 
+# The object role (object_r) is used for devices, resources, and event channels;
+# it does not need to be defined here and should not be used for domains.
+
+# The system role is used for utility domains and pseudo-domains
 role system_r;
 role system_r types { xen_type domain_type };
+# If you want to prevent domUs from being placed in system_r:
+##role system_r types { xen_type dom0_t };
+
+# The vm role is used for customer virtual machines
+role vm_r;
+role vm_r types { domain_type -dom0_t };
diff -r d2c02f12aa82 -r 87d642dc65bb tools/flask/policy/policy/users
--- a/tools/flask/policy/policy/users	Thu Feb 02 15:20:40 2012 +0000
+++ b/tools/flask/policy/policy/users	Thu Feb 02 15:21:13 2012 +0000
@@ -3,15 +3,9 @@
 # System User configuration.
 #
 
-#
-# gen_user(username, role_set, mls_defaultlevel, mls_range)
-#
-
-#
-# system_u is the user identity for system processes and objects.
-# There should be no corresponding Unix user identity for system,
-# and a user process should never be assigned the system user
-# identity.
-#
+# system_u is the user identity for system domains and objects
 gen_user(system_u,, system_r, s0, s0 - mls_systemhigh)
 
+# Other users are defined using the vm role
+gen_user(customer_1,, vm_r, s0, s0)
+gen_user(customer_2,, vm_r, s0, s0)

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:50 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAc-0000h3-6S; Fri, 03 Feb 2012 21:59:50 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAb-0000d2-3S
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:49 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-182.messagelabs.com!1328306381!13586239!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18585 invoked from network); 3 Feb 2012 21:59:42 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:42 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAT-0001sL-No
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:41 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAQ-0003Yn-Qs
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:40 +0000
Message-Id: <E1RtRAQ-0003Yn-Qs@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:36 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] flask/policy: use declare_domain for
	dom0_t
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328196102 0
# Node ID 1a748779e068368bcf4e57937798c05f6f8ce3ba
# Parent  87d642dc65bb723fac66a0bfdeb7204174ec293f
flask/policy: use declare_domain for dom0_t

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 87d642dc65bb -r 1a748779e068 tools/flask/policy/policy/modules/xen/xen.if
--- a/tools/flask/policy/policy/modules/xen/xen.if	Thu Feb 02 15:21:13 2012 +0000
+++ b/tools/flask/policy/policy/modules/xen/xen.if	Thu Feb 02 15:21:42 2012 +0000
@@ -5,10 +5,10 @@
 # Domain creation and setup
 #
 ################################################################################
-# declare_domain(type)
+# declare_domain(type, attrs...)
 #   Declare a type as a domain type, and allow basic domain setup
 define(`declare_domain', `
-	type $1, domain_type;
+	type $1, domain_type`'ifelse(`$#', `1', `', `,shift($@)');
 	allow $1 $1:grant { query setup };
 	allow $1 $1:mmu { adjust physmap map_read map_write stat pinpage };
 	allow $1 $1:hvm { getparam setparam };
diff -r 87d642dc65bb -r 1a748779e068 tools/flask/policy/policy/modules/xen/xen.te
--- a/tools/flask/policy/policy/modules/xen/xen.te	Thu Feb 02 15:21:13 2012 +0000
+++ b/tools/flask/policy/policy/modules/xen/xen.te	Thu Feb 02 15:21:42 2012 +0000
@@ -25,7 +25,7 @@
 type xen_t, xen_type, mls_priv;
 
 # Domain 0
-type dom0_t, domain_type, mls_priv;
+declare_domain(dom0_t, mls_priv);
 
 # Untracked I/O memory (pseudo-domain)
 type domio_t, xen_type;
@@ -63,8 +63,6 @@
 	setbool setsecparam add_ocontext del_ocontext };
 
 allow dom0_t dom0_t:domain { getdomaininfo getvcpuinfo getvcpuaffinity };
-allow dom0_t dom0_t:grant { query setup };
-allow dom0_t dom0_t:mmu { adjust physmap map_read map_write stat pinpage };
 allow dom0_t dom0_t:resource { add remove };
 
 admin_device(dom0_t, device_t)

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:50 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAc-0000h3-6S; Fri, 03 Feb 2012 21:59:50 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAb-0000d2-3S
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:49 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-182.messagelabs.com!1328306381!13586239!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18585 invoked from network); 3 Feb 2012 21:59:42 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:42 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAT-0001sL-No
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:41 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAQ-0003Yn-Qs
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:40 +0000
Message-Id: <E1RtRAQ-0003Yn-Qs@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:36 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] flask/policy: use declare_domain for
	dom0_t
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328196102 0
# Node ID 1a748779e068368bcf4e57937798c05f6f8ce3ba
# Parent  87d642dc65bb723fac66a0bfdeb7204174ec293f
flask/policy: use declare_domain for dom0_t

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 87d642dc65bb -r 1a748779e068 tools/flask/policy/policy/modules/xen/xen.if
--- a/tools/flask/policy/policy/modules/xen/xen.if	Thu Feb 02 15:21:13 2012 +0000
+++ b/tools/flask/policy/policy/modules/xen/xen.if	Thu Feb 02 15:21:42 2012 +0000
@@ -5,10 +5,10 @@
 # Domain creation and setup
 #
 ################################################################################
-# declare_domain(type)
+# declare_domain(type, attrs...)
 #   Declare a type as a domain type, and allow basic domain setup
 define(`declare_domain', `
-	type $1, domain_type;
+	type $1, domain_type`'ifelse(`$#', `1', `', `,shift($@)');
 	allow $1 $1:grant { query setup };
 	allow $1 $1:mmu { adjust physmap map_read map_write stat pinpage };
 	allow $1 $1:hvm { getparam setparam };
diff -r 87d642dc65bb -r 1a748779e068 tools/flask/policy/policy/modules/xen/xen.te
--- a/tools/flask/policy/policy/modules/xen/xen.te	Thu Feb 02 15:21:13 2012 +0000
+++ b/tools/flask/policy/policy/modules/xen/xen.te	Thu Feb 02 15:21:42 2012 +0000
@@ -25,7 +25,7 @@
 type xen_t, xen_type, mls_priv;
 
 # Domain 0
-type dom0_t, domain_type, mls_priv;
+declare_domain(dom0_t, mls_priv);
 
 # Untracked I/O memory (pseudo-domain)
 type domio_t, xen_type;
@@ -63,8 +63,6 @@
 	setbool setsecparam add_ocontext del_ocontext };
 
 allow dom0_t dom0_t:domain { getdomaininfo getvcpuinfo getvcpuaffinity };
-allow dom0_t dom0_t:grant { query setup };
-allow dom0_t dom0_t:mmu { adjust physmap map_read map_write stat pinpage };
 allow dom0_t dom0_t:resource { add remove };
 
 admin_device(dom0_t, device_t)

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:52 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAe-0000iQ-97; Fri, 03 Feb 2012 21:59:52 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAc-0000dp-Fa
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:50 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-216.messagelabs.com!1328306383!13877717!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9050 invoked from network); 3 Feb 2012 21:59:44 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:44 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAV-0001sR-E0
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:43 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAU-0003Zw-Vw
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:43 +0000
Message-Id: <E1RtRAU-0003Zw-Vw@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:41 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen/xsm: fix incorrect handling of
	XSM hook return
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328196184 0
# Node ID 833d80d3fbe76775bd91c157bb901e35d474a45b
# Parent  1a748779e068368bcf4e57937798c05f6f8ce3ba
xen/xsm: fix incorrect handling of XSM hook return

If the XSM hook denied access, the execution incorrectly continued on
after an extra unlock domain.

Reported-by: John McDermott <john.mcdermott@nrl.navy.mil>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 1a748779e068 -r 833d80d3fbe7 xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c	Thu Feb 02 15:21:42 2012 +0000
+++ b/xen/arch/x86/domctl.c	Thu Feb 02 15:23:04 2012 +0000
@@ -648,7 +648,7 @@
 
         ret = xsm_machine_address_size(d, domctl->cmd);
         if ( ret )
-            rcu_unlock_domain(d);
+            goto set_machine_address_size_out;
 
         ret = -EBUSY;
         if ( d->tot_pages > 0 )

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:52 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAe-0000iQ-97; Fri, 03 Feb 2012 21:59:52 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAc-0000dp-Fa
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:50 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-216.messagelabs.com!1328306383!13877717!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9050 invoked from network); 3 Feb 2012 21:59:44 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:44 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAV-0001sR-E0
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:43 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAU-0003Zw-Vw
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:43 +0000
Message-Id: <E1RtRAU-0003Zw-Vw@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:41 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen/xsm: fix incorrect handling of
	XSM hook return
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328196184 0
# Node ID 833d80d3fbe76775bd91c157bb901e35d474a45b
# Parent  1a748779e068368bcf4e57937798c05f6f8ce3ba
xen/xsm: fix incorrect handling of XSM hook return

If the XSM hook denied access, the execution incorrectly continued on
after an extra unlock domain.

Reported-by: John McDermott <john.mcdermott@nrl.navy.mil>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 1a748779e068 -r 833d80d3fbe7 xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c	Thu Feb 02 15:21:42 2012 +0000
+++ b/xen/arch/x86/domctl.c	Thu Feb 02 15:23:04 2012 +0000
@@ -648,7 +648,7 @@
 
         ret = xsm_machine_address_size(d, domctl->cmd);
         if ( ret )
-            rcu_unlock_domain(d);
+            goto set_machine_address_size_out;
 
         ret = -EBUSY;
         if ( d->tot_pages > 0 )

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:56 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAi-0000ku-Jy; Fri, 03 Feb 2012 21:59:56 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAg-0000k0-Ka
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:54 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1328306345!61471965!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26448 invoked from network); 3 Feb 2012 21:59:06 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:06 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAe-0001sg-3b
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:52 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAc-0003cF-6k
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:51 +0000
Message-Id: <E1RtRAc-0003cF-6k@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:48 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libflask: Add boolean manipulation
	functions
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328196253 0
# Node ID 300bfdf167fa5c0bcd129914c1bd890b431fdb9e
# Parent  2b092d291348f0cf7f04e5a12af3e293372dd022
libflask: Add boolean manipulation functions

Add wrappers for getting and setting policy booleans by name or ID.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 2b092d291348 -r 300bfdf167fa tools/flask/libflask/flask_op.c
--- a/tools/flask/libflask/flask_op.c	Thu Feb 02 15:23:43 2012 +0000
+++ b/tools/flask/libflask/flask_op.c	Thu Feb 02 15:24:13 2012 +0000
@@ -109,6 +109,65 @@
     return 0;
 }
 
+int flask_getbool_byid(xc_interface *xc_handle, int id, char *name, int *curr, int *pend)
+{
+    flask_op_t op;
+    char buf[255];
+    int rv;
+
+    op.cmd = FLASK_GETBOOL2;
+    op.buf = buf;
+    op.size = 255;
+
+    snprintf(buf, sizeof buf, "%i", id);
+
+    rv = xc_flask_op(xc_handle, &op);
+
+    if ( rv )
+        return rv;
+    
+    sscanf(buf, "%i %i %s", curr, pend, name);
+
+    return rv;
+}
+
+int flask_getbool_byname(xc_interface *xc_handle, char *name, int *curr, int *pend)
+{
+    flask_op_t op;
+    char buf[255];
+    int rv;
+
+    op.cmd = FLASK_GETBOOL_NAMED;
+    op.buf = buf;
+    op.size = 255;
+
+    strncpy(buf, name, op.size);
+
+    rv = xc_flask_op(xc_handle, &op);
+
+    if ( rv )
+        return rv;
+    
+    sscanf(buf, "%i %i", curr, pend);
+
+    return rv;
+}
+
+int flask_setbool(xc_interface *xc_handle, char *name, int value, int commit)
+{
+    flask_op_t op;
+    char buf[255];
+    int size = 255;
+
+    op.cmd = FLASK_SETBOOL_NAMED;
+    op.buf = buf;
+    op.size = size;
+
+    snprintf(buf, size, "%s %i %i", name, value, commit);
+
+    return xc_flask_op(xc_handle, &op);
+}
+
 int flask_add_pirq(xc_interface *xc_handle, unsigned int pirq, char *scontext)
 {
     int err;
diff -r 2b092d291348 -r 300bfdf167fa tools/flask/libflask/include/libflask.h
--- a/tools/flask/libflask/include/libflask.h	Thu Feb 02 15:23:43 2012 +0000
+++ b/tools/flask/libflask/include/libflask.h	Thu Feb 02 15:24:13 2012 +0000
@@ -21,6 +21,9 @@
 int flask_sid_to_context(xc_interface *xc_handle, int sid, char *buf, uint32_t size);
 int flask_getenforce(xc_interface *xc_handle);
 int flask_setenforce(xc_interface *xc_handle, int mode);
+int flask_getbool_byid(xc_interface *xc_handle, int id, char *name, int *curr, int *pend);
+int flask_getbool_byname(xc_interface *xc_handle, char *name, int *curr, int *pend);
+int flask_setbool(xc_interface *xc_handle, char *name, int value, int commit);
 int flask_add_pirq(xc_interface *xc_handle, unsigned int pirq, char *scontext);
 int flask_add_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high,
                       char *scontext);

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:56 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAi-0000ku-Jy; Fri, 03 Feb 2012 21:59:56 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAg-0000k0-Ka
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:54 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1328306345!61471965!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26448 invoked from network); 3 Feb 2012 21:59:06 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:06 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAe-0001sg-3b
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:52 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAc-0003cF-6k
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:51 +0000
Message-Id: <E1RtRAc-0003cF-6k@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:48 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libflask: Add boolean manipulation
	functions
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328196253 0
# Node ID 300bfdf167fa5c0bcd129914c1bd890b431fdb9e
# Parent  2b092d291348f0cf7f04e5a12af3e293372dd022
libflask: Add boolean manipulation functions

Add wrappers for getting and setting policy booleans by name or ID.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 2b092d291348 -r 300bfdf167fa tools/flask/libflask/flask_op.c
--- a/tools/flask/libflask/flask_op.c	Thu Feb 02 15:23:43 2012 +0000
+++ b/tools/flask/libflask/flask_op.c	Thu Feb 02 15:24:13 2012 +0000
@@ -109,6 +109,65 @@
     return 0;
 }
 
+int flask_getbool_byid(xc_interface *xc_handle, int id, char *name, int *curr, int *pend)
+{
+    flask_op_t op;
+    char buf[255];
+    int rv;
+
+    op.cmd = FLASK_GETBOOL2;
+    op.buf = buf;
+    op.size = 255;
+
+    snprintf(buf, sizeof buf, "%i", id);
+
+    rv = xc_flask_op(xc_handle, &op);
+
+    if ( rv )
+        return rv;
+    
+    sscanf(buf, "%i %i %s", curr, pend, name);
+
+    return rv;
+}
+
+int flask_getbool_byname(xc_interface *xc_handle, char *name, int *curr, int *pend)
+{
+    flask_op_t op;
+    char buf[255];
+    int rv;
+
+    op.cmd = FLASK_GETBOOL_NAMED;
+    op.buf = buf;
+    op.size = 255;
+
+    strncpy(buf, name, op.size);
+
+    rv = xc_flask_op(xc_handle, &op);
+
+    if ( rv )
+        return rv;
+    
+    sscanf(buf, "%i %i", curr, pend);
+
+    return rv;
+}
+
+int flask_setbool(xc_interface *xc_handle, char *name, int value, int commit)
+{
+    flask_op_t op;
+    char buf[255];
+    int size = 255;
+
+    op.cmd = FLASK_SETBOOL_NAMED;
+    op.buf = buf;
+    op.size = size;
+
+    snprintf(buf, size, "%s %i %i", name, value, commit);
+
+    return xc_flask_op(xc_handle, &op);
+}
+
 int flask_add_pirq(xc_interface *xc_handle, unsigned int pirq, char *scontext)
 {
     int err;
diff -r 2b092d291348 -r 300bfdf167fa tools/flask/libflask/include/libflask.h
--- a/tools/flask/libflask/include/libflask.h	Thu Feb 02 15:23:43 2012 +0000
+++ b/tools/flask/libflask/include/libflask.h	Thu Feb 02 15:24:13 2012 +0000
@@ -21,6 +21,9 @@
 int flask_sid_to_context(xc_interface *xc_handle, int sid, char *buf, uint32_t size);
 int flask_getenforce(xc_interface *xc_handle);
 int flask_setenforce(xc_interface *xc_handle, int mode);
+int flask_getbool_byid(xc_interface *xc_handle, int id, char *name, int *curr, int *pend);
+int flask_getbool_byname(xc_interface *xc_handle, char *name, int *curr, int *pend);
+int flask_setbool(xc_interface *xc_handle, char *name, int value, int commit);
 int flask_add_pirq(xc_interface *xc_handle, unsigned int pirq, char *scontext);
 int flask_add_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high,
                       char *scontext);

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:59 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAl-0000md-08; Fri, 03 Feb 2012 21:59:59 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAi-0000hy-Im
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:56 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1328306388!11933809!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14374 invoked from network); 3 Feb 2012 21:59:49 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:49 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAa-0001sb-K8
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:48 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAY-0003an-1K
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:47 +0000
Message-Id: <E1RtRAY-0003an-1K@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:43 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xsm/flask: allow policy booleans to
	be addressed by name
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328196223 0
# Node ID 2b092d291348f0cf7f04e5a12af3e293372dd022
# Parent  833d80d3fbe76775bd91c157bb901e35d474a45b
xsm/flask: allow policy booleans to be addressed by name

Booleans are currently only addressable by using a sequence number
that is not easily accessible to tools. Add new FLASK operations to
get/set booleans by name, and to get the name of a boolean given its
ID.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 833d80d3fbe7 -r 2b092d291348 xen/include/public/xsm/flask_op.h
--- a/xen/include/public/xsm/flask_op.h	Thu Feb 02 15:23:04 2012 +0000
+++ b/xen/include/public/xsm/flask_op.h	Thu Feb 02 15:23:43 2012 +0000
@@ -47,8 +47,11 @@
 #define FLASK_MEMBER            20
 #define FLASK_ADD_OCONTEXT      21
 #define FLASK_DEL_OCONTEXT      22
+#define FLASK_GETBOOL_NAMED     23
+#define FLASK_GETBOOL2          24
+#define FLASK_SETBOOL_NAMED     25
 
-#define FLASK_LAST              FLASK_DEL_OCONTEXT
+#define FLASK_LAST              FLASK_SETBOOL_NAMED
 
 typedef struct flask_op {
     uint32_t  cmd;
diff -r 833d80d3fbe7 -r 2b092d291348 xen/xsm/flask/flask_op.c
--- a/xen/xsm/flask/flask_op.c	Thu Feb 02 15:23:04 2012 +0000
+++ b/xen/xsm/flask/flask_op.c	Thu Feb 02 15:23:43 2012 +0000
@@ -47,7 +47,10 @@
         1UL<<FLASK_SETAVC_THRESHOLD | \
         1UL<<FLASK_MEMBER | \
         1UL<<FLASK_ADD_OCONTEXT | \
-        1UL<<FLASK_DEL_OCONTEXT \
+        1UL<<FLASK_DEL_OCONTEXT | \
+        1UL<<FLASK_GETBOOL_NAMED | \
+        1UL<<FLASK_GETBOOL2 | \
+        1UL<<FLASK_SETBOOL_NAMED \
     )
 
 #define FLASK_COPY_OUT \
@@ -65,7 +68,9 @@
         1UL<<FLASK_GETAVC_THRESHOLD | \
         1UL<<FLASK_AVC_HASHSTATS | \
         1UL<<FLASK_AVC_CACHESTATS | \
-        1UL<<FLASK_MEMBER \
+        1UL<<FLASK_MEMBER | \
+        1UL<<FLASK_GETBOOL_NAMED | \
+        1UL<<FLASK_GETBOOL2 \
     )
 
 static DEFINE_SPINLOCK(sel_sem);
@@ -73,6 +78,7 @@
 /* global data for booleans */
 static int bool_num = 0;
 static int *bool_pending_values = NULL;
+static int flask_security_make_bools(void);
 
 extern int ss_initialized;
 
@@ -573,7 +579,7 @@
 static int flask_security_set_bool(char *buf, uint32_t count)
 {
     int length = -EFAULT;
-    int i, new_value;
+    unsigned int i, new_value;
 
     spin_lock(&sel_sem);
 
@@ -585,10 +591,14 @@
     if ( sscanf(buf, "%d %d", &i, &new_value) != 2 )
         goto out;
 
+    if (!bool_pending_values)
+        flask_security_make_bools();
+
+    if ( i >= bool_num )
+        goto out;
+
     if ( new_value )
-    {
         new_value = 1;
-    }
 
     bool_pending_values[i] = new_value;
     length = count;
@@ -598,6 +608,57 @@
     return length;
 }
 
+static int flask_security_set_bool_name(char *buf, uint32_t count)
+{
+    int rv, num;
+    int i, new_value, commit;
+    int *values = NULL;
+    char *name;
+    
+    name = xmalloc_bytes(count);
+    if ( name == NULL )
+        return -ENOMEM;
+
+    spin_lock(&sel_sem);
+
+    rv = domain_has_security(current->domain, SECURITY__SETBOOL);
+    if ( rv )
+        goto out;
+    
+    rv = -EINVAL;
+    if ( sscanf(buf, "%s %d %d", name, &new_value, &commit) != 3 )
+        goto out;
+
+    i = security_find_bool(name);
+    if ( i < 0 )
+        goto out;
+
+    if ( new_value )
+        new_value = 1;
+
+    if ( commit ) {
+        rv = security_get_bools(&num, NULL, &values);
+        if ( rv != 0 )
+            goto out;
+        values[i] = new_value;
+        if (bool_pending_values)
+            bool_pending_values[i] = new_value;
+        rv = security_set_bools(num, values);
+        xfree(values);
+    } else {
+        if (!bool_pending_values)
+            flask_security_make_bools();
+
+        bool_pending_values[i] = new_value;
+        rv = count;
+    }
+
+ out:
+    xfree(name);
+    spin_unlock(&sel_sem);
+    return rv;
+}
+
 static int flask_security_commit_bools(char *buf, uint32_t count)
 {
     int length = -EFAULT;
@@ -613,7 +674,7 @@
     if ( sscanf(buf, "%d", &new_value) != 1 )
         goto out;
 
-    if ( new_value )
+    if ( new_value && bool_pending_values )
         security_set_bools(bool_num, bool_pending_values);
     
     length = count;
@@ -623,10 +684,11 @@
     return length;
 }
 
-static int flask_security_get_bool(char *buf, uint32_t count)
+static int flask_security_get_bool(char *buf, uint32_t count, int named)
 {
     int length;
-    int i, cur_enforcing;
+    int i, cur_enforcing, pend_enforcing;
+    char* name = NULL;
     
     spin_lock(&sel_sem);
     
@@ -641,25 +703,70 @@
         goto out;
     }
 
+    if ( bool_pending_values )
+        pend_enforcing = bool_pending_values[i];
+    else
+        pend_enforcing = cur_enforcing;
+
+    if ( named )
+        name = security_get_bool_name(i);
+    if ( named && !name )
+        goto out;
+
     memset(buf, 0, count);
-    length = snprintf(buf, count, "%d %d", cur_enforcing,
-                      bool_pending_values[i]);
+    if ( named )
+        length = snprintf(buf, count, "%d %d %s", cur_enforcing,
+                          pend_enforcing, name);
+    else
+        length = snprintf(buf, count, "%d %d", cur_enforcing,
+                          pend_enforcing);
 
  out:
+    xfree(name);
     spin_unlock(&sel_sem);
     return length;
 }
 
+static int flask_security_get_bool_name(char *buf, uint32_t count)
+{
+    int rv = -ENOENT;
+    int i, cur_enforcing, pend_enforcing;
+    
+    spin_lock(&sel_sem);
+    
+    i = security_find_bool(buf);
+    if ( i < 0 )
+        goto out;
+
+    cur_enforcing = security_get_bool_value(i);
+    if ( cur_enforcing < 0 )
+    {
+        rv = cur_enforcing;
+        goto out;
+    }
+
+    if ( bool_pending_values )
+        pend_enforcing = bool_pending_values[i];
+    else
+        pend_enforcing = cur_enforcing;
+
+    memset(buf, 0, count);
+    rv = snprintf(buf, count, "%d %d", cur_enforcing, pend_enforcing);
+
+ out:
+    spin_unlock(&sel_sem);
+    return rv;
+}
+
 static int flask_security_make_bools(void)
 {
-    int i, ret = 0;
-    char **names = NULL;
+    int ret = 0;
     int num;
     int *values = NULL;
     
     xfree(bool_pending_values);
     
-    ret = security_get_bools(&num, &names, &values);
+    ret = security_get_bools(&num, NULL, &values);
     if ( ret != 0 )
         goto out;
 
@@ -667,12 +774,6 @@
     bool_pending_values = values;
 
  out:
-    if ( names )
-    {
-        for ( i = 0; i < num; i++ )
-            xfree(names[i]);
-        xfree(names);
-    }    
     return ret;
 }
 
@@ -938,7 +1039,7 @@
 
     case FLASK_GETBOOL:
     {
-        length = flask_security_get_bool(arg, op->size);
+        length = flask_security_get_bool(arg, op->size, 0);
     }
     break;
 
@@ -1010,6 +1111,24 @@
         break;
     }
 
+    case FLASK_GETBOOL_NAMED:
+    {
+        length = flask_security_get_bool_name(arg, op->size);
+    }
+    break;
+
+    case FLASK_GETBOOL2:
+    {
+        length = flask_security_get_bool(arg, op->size, 1);
+    }
+    break;
+
+    case FLASK_SETBOOL_NAMED:
+    {
+        length = flask_security_set_bool_name(arg, op->size);
+    }
+    break;
+
     default:
         length = -ENOSYS;
         break;
diff -r 833d80d3fbe7 -r 2b092d291348 xen/xsm/flask/include/conditional.h
--- a/xen/xsm/flask/include/conditional.h	Thu Feb 02 15:23:04 2012 +0000
+++ b/xen/xsm/flask/include/conditional.h	Thu Feb 02 15:23:43 2012 +0000
@@ -17,6 +17,9 @@
 
 int security_set_bools(int len, int *values);
 
-int security_get_bool_value(int bool);
+int security_find_bool(const char *name);
+
+char *security_get_bool_name(unsigned int bool);
+int security_get_bool_value(unsigned int bool);
 
 #endif
diff -r 833d80d3fbe7 -r 2b092d291348 xen/xsm/flask/ss/services.c
--- a/xen/xsm/flask/ss/services.c	Thu Feb 02 15:23:04 2012 +0000
+++ b/xen/xsm/flask/ss/services.c	Thu Feb 02 15:23:43 2012 +0000
@@ -1883,12 +1883,30 @@
     return rc;
 }
 
+int security_find_bool(const char *name)
+{
+    int i, rv = -ENOENT;
+    POLICY_RDLOCK;
+    for ( i = 0; i < policydb.p_bools.nprim; i++ )
+    {
+        if (!strcmp(name, policydb.p_bool_val_to_name[i]))
+        {
+            rv = i;
+            break;
+        }
+    }
+
+    POLICY_RDUNLOCK;
+    return rv;
+}
+
 int security_get_bools(int *len, char ***names, int **values)
 {
     int i, rc = -ENOMEM;
 
     POLICY_RDLOCK;
-    *names = NULL;
+    if ( names )
+        *names = NULL;
     *values = NULL;
 
     *len = policydb.p_bools.nprim;
@@ -1898,10 +1916,12 @@
         goto out;
     }
 
-    *names = (char**)xmalloc_array(char*, *len);
-    if ( !*names )
-        goto err;
-    memset(*names, 0, sizeof(char*) * *len);
+    if ( names ) {
+        *names = (char**)xmalloc_array(char*, *len);
+        if ( !*names )
+            goto err;
+        memset(*names, 0, sizeof(char*) * *len);
+    }
 
     *values = (int*)xmalloc_array(int, *len);
     if ( !*values )
@@ -1911,19 +1931,21 @@
     {
         size_t name_len;
         (*values)[i] = policydb.bool_val_to_struct[i]->state;
-        name_len = strlen(policydb.p_bool_val_to_name[i]) + 1;
-        (*names)[i] = (char*)xmalloc_array(char, name_len);
-        if ( !(*names)[i] )
-            goto err;
-        strlcpy((*names)[i], policydb.p_bool_val_to_name[i], name_len);
-        (*names)[i][name_len - 1] = 0;
+        if ( names ) {
+            name_len = strlen(policydb.p_bool_val_to_name[i]) + 1;
+            (*names)[i] = (char*)xmalloc_array(char, name_len);
+            if ( !(*names)[i] )
+                goto err;
+            strlcpy((*names)[i], policydb.p_bool_val_to_name[i], name_len);
+            (*names)[i][name_len - 1] = 0;
+        }
     }
     rc = 0;
 out:
     POLICY_RDUNLOCK;
     return rc;
 err:
-    if ( *names )
+    if ( names && *names )
     {
         for ( i = 0; i < *len; i++ )
             xfree((*names)[i]);
@@ -1984,17 +2006,17 @@
     return rc;
 }
 
-int security_get_bool_value(int bool)
+int security_get_bool_value(unsigned int bool)
 {
     int rc = 0;
-    int len;
+    unsigned int len;
 
     POLICY_RDLOCK;
 
     len = policydb.p_bools.nprim;
     if ( bool >= len )
     {
-        rc = -EFAULT;
+        rc = -ENOENT;
         goto out;
     }
 
@@ -2004,6 +2026,29 @@
     return rc;
 }
 
+char *security_get_bool_name(unsigned int bool)
+{
+    unsigned int len;
+    char *rv = NULL;
+
+    POLICY_RDLOCK;
+
+    len = policydb.p_bools.nprim;
+    if ( bool >= len )
+    {
+        goto out;
+    }
+
+    len = strlen(policydb.p_bool_val_to_name[bool]) + 1;
+    rv = xmalloc_array(char, len);
+    if ( !rv )
+        goto out;
+    memcpy(rv, policydb.p_bool_val_to_name[bool], len);
+out:
+    POLICY_RDUNLOCK;
+    return rv;
+}
+
 static int security_preserve_bools(struct policydb *p)
 {
     int rc, nbools = 0, *bvalues = NULL, i;

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 21:59:59 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 21:59:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAl-0000md-08; Fri, 03 Feb 2012 21:59:59 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAi-0000hy-Im
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:56 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1328306388!11933809!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14374 invoked from network); 3 Feb 2012 21:59:49 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:49 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAa-0001sb-K8
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:48 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAY-0003an-1K
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:47 +0000
Message-Id: <E1RtRAY-0003an-1K@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:43 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xsm/flask: allow policy booleans to
	be addressed by name
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328196223 0
# Node ID 2b092d291348f0cf7f04e5a12af3e293372dd022
# Parent  833d80d3fbe76775bd91c157bb901e35d474a45b
xsm/flask: allow policy booleans to be addressed by name

Booleans are currently only addressable by using a sequence number
that is not easily accessible to tools. Add new FLASK operations to
get/set booleans by name, and to get the name of a boolean given its
ID.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 833d80d3fbe7 -r 2b092d291348 xen/include/public/xsm/flask_op.h
--- a/xen/include/public/xsm/flask_op.h	Thu Feb 02 15:23:04 2012 +0000
+++ b/xen/include/public/xsm/flask_op.h	Thu Feb 02 15:23:43 2012 +0000
@@ -47,8 +47,11 @@
 #define FLASK_MEMBER            20
 #define FLASK_ADD_OCONTEXT      21
 #define FLASK_DEL_OCONTEXT      22
+#define FLASK_GETBOOL_NAMED     23
+#define FLASK_GETBOOL2          24
+#define FLASK_SETBOOL_NAMED     25
 
-#define FLASK_LAST              FLASK_DEL_OCONTEXT
+#define FLASK_LAST              FLASK_SETBOOL_NAMED
 
 typedef struct flask_op {
     uint32_t  cmd;
diff -r 833d80d3fbe7 -r 2b092d291348 xen/xsm/flask/flask_op.c
--- a/xen/xsm/flask/flask_op.c	Thu Feb 02 15:23:04 2012 +0000
+++ b/xen/xsm/flask/flask_op.c	Thu Feb 02 15:23:43 2012 +0000
@@ -47,7 +47,10 @@
         1UL<<FLASK_SETAVC_THRESHOLD | \
         1UL<<FLASK_MEMBER | \
         1UL<<FLASK_ADD_OCONTEXT | \
-        1UL<<FLASK_DEL_OCONTEXT \
+        1UL<<FLASK_DEL_OCONTEXT | \
+        1UL<<FLASK_GETBOOL_NAMED | \
+        1UL<<FLASK_GETBOOL2 | \
+        1UL<<FLASK_SETBOOL_NAMED \
     )
 
 #define FLASK_COPY_OUT \
@@ -65,7 +68,9 @@
         1UL<<FLASK_GETAVC_THRESHOLD | \
         1UL<<FLASK_AVC_HASHSTATS | \
         1UL<<FLASK_AVC_CACHESTATS | \
-        1UL<<FLASK_MEMBER \
+        1UL<<FLASK_MEMBER | \
+        1UL<<FLASK_GETBOOL_NAMED | \
+        1UL<<FLASK_GETBOOL2 \
     )
 
 static DEFINE_SPINLOCK(sel_sem);
@@ -73,6 +78,7 @@
 /* global data for booleans */
 static int bool_num = 0;
 static int *bool_pending_values = NULL;
+static int flask_security_make_bools(void);
 
 extern int ss_initialized;
 
@@ -573,7 +579,7 @@
 static int flask_security_set_bool(char *buf, uint32_t count)
 {
     int length = -EFAULT;
-    int i, new_value;
+    unsigned int i, new_value;
 
     spin_lock(&sel_sem);
 
@@ -585,10 +591,14 @@
     if ( sscanf(buf, "%d %d", &i, &new_value) != 2 )
         goto out;
 
+    if (!bool_pending_values)
+        flask_security_make_bools();
+
+    if ( i >= bool_num )
+        goto out;
+
     if ( new_value )
-    {
         new_value = 1;
-    }
 
     bool_pending_values[i] = new_value;
     length = count;
@@ -598,6 +608,57 @@
     return length;
 }
 
+static int flask_security_set_bool_name(char *buf, uint32_t count)
+{
+    int rv, num;
+    int i, new_value, commit;
+    int *values = NULL;
+    char *name;
+    
+    name = xmalloc_bytes(count);
+    if ( name == NULL )
+        return -ENOMEM;
+
+    spin_lock(&sel_sem);
+
+    rv = domain_has_security(current->domain, SECURITY__SETBOOL);
+    if ( rv )
+        goto out;
+    
+    rv = -EINVAL;
+    if ( sscanf(buf, "%s %d %d", name, &new_value, &commit) != 3 )
+        goto out;
+
+    i = security_find_bool(name);
+    if ( i < 0 )
+        goto out;
+
+    if ( new_value )
+        new_value = 1;
+
+    if ( commit ) {
+        rv = security_get_bools(&num, NULL, &values);
+        if ( rv != 0 )
+            goto out;
+        values[i] = new_value;
+        if (bool_pending_values)
+            bool_pending_values[i] = new_value;
+        rv = security_set_bools(num, values);
+        xfree(values);
+    } else {
+        if (!bool_pending_values)
+            flask_security_make_bools();
+
+        bool_pending_values[i] = new_value;
+        rv = count;
+    }
+
+ out:
+    xfree(name);
+    spin_unlock(&sel_sem);
+    return rv;
+}
+
 static int flask_security_commit_bools(char *buf, uint32_t count)
 {
     int length = -EFAULT;
@@ -613,7 +674,7 @@
     if ( sscanf(buf, "%d", &new_value) != 1 )
         goto out;
 
-    if ( new_value )
+    if ( new_value && bool_pending_values )
         security_set_bools(bool_num, bool_pending_values);
     
     length = count;
@@ -623,10 +684,11 @@
     return length;
 }
 
-static int flask_security_get_bool(char *buf, uint32_t count)
+static int flask_security_get_bool(char *buf, uint32_t count, int named)
 {
     int length;
-    int i, cur_enforcing;
+    int i, cur_enforcing, pend_enforcing;
+    char* name = NULL;
     
     spin_lock(&sel_sem);
     
@@ -641,25 +703,70 @@
         goto out;
     }
 
+    if ( bool_pending_values )
+        pend_enforcing = bool_pending_values[i];
+    else
+        pend_enforcing = cur_enforcing;
+
+    if ( named )
+        name = security_get_bool_name(i);
+    if ( named && !name )
+        goto out;
+
     memset(buf, 0, count);
-    length = snprintf(buf, count, "%d %d", cur_enforcing,
-                      bool_pending_values[i]);
+    if ( named )
+        length = snprintf(buf, count, "%d %d %s", cur_enforcing,
+                          pend_enforcing, name);
+    else
+        length = snprintf(buf, count, "%d %d", cur_enforcing,
+                          pend_enforcing);
 
  out:
+    xfree(name);
     spin_unlock(&sel_sem);
     return length;
 }
 
+static int flask_security_get_bool_name(char *buf, uint32_t count)
+{
+    int rv = -ENOENT;
+    int i, cur_enforcing, pend_enforcing;
+    
+    spin_lock(&sel_sem);
+    
+    i = security_find_bool(buf);
+    if ( i < 0 )
+        goto out;
+
+    cur_enforcing = security_get_bool_value(i);
+    if ( cur_enforcing < 0 )
+    {
+        rv = cur_enforcing;
+        goto out;
+    }
+
+    if ( bool_pending_values )
+        pend_enforcing = bool_pending_values[i];
+    else
+        pend_enforcing = cur_enforcing;
+
+    memset(buf, 0, count);
+    rv = snprintf(buf, count, "%d %d", cur_enforcing, pend_enforcing);
+
+ out:
+    spin_unlock(&sel_sem);
+    return rv;
+}
+
 static int flask_security_make_bools(void)
 {
-    int i, ret = 0;
-    char **names = NULL;
+    int ret = 0;
     int num;
     int *values = NULL;
     
     xfree(bool_pending_values);
     
-    ret = security_get_bools(&num, &names, &values);
+    ret = security_get_bools(&num, NULL, &values);
     if ( ret != 0 )
         goto out;
 
@@ -667,12 +774,6 @@
     bool_pending_values = values;
 
  out:
-    if ( names )
-    {
-        for ( i = 0; i < num; i++ )
-            xfree(names[i]);
-        xfree(names);
-    }    
     return ret;
 }
 
@@ -938,7 +1039,7 @@
 
     case FLASK_GETBOOL:
     {
-        length = flask_security_get_bool(arg, op->size);
+        length = flask_security_get_bool(arg, op->size, 0);
     }
     break;
 
@@ -1010,6 +1111,24 @@
         break;
     }
 
+    case FLASK_GETBOOL_NAMED:
+    {
+        length = flask_security_get_bool_name(arg, op->size);
+    }
+    break;
+
+    case FLASK_GETBOOL2:
+    {
+        length = flask_security_get_bool(arg, op->size, 1);
+    }
+    break;
+
+    case FLASK_SETBOOL_NAMED:
+    {
+        length = flask_security_set_bool_name(arg, op->size);
+    }
+    break;
+
     default:
         length = -ENOSYS;
         break;
diff -r 833d80d3fbe7 -r 2b092d291348 xen/xsm/flask/include/conditional.h
--- a/xen/xsm/flask/include/conditional.h	Thu Feb 02 15:23:04 2012 +0000
+++ b/xen/xsm/flask/include/conditional.h	Thu Feb 02 15:23:43 2012 +0000
@@ -17,6 +17,9 @@
 
 int security_set_bools(int len, int *values);
 
-int security_get_bool_value(int bool);
+int security_find_bool(const char *name);
+
+char *security_get_bool_name(unsigned int bool);
+int security_get_bool_value(unsigned int bool);
 
 #endif
diff -r 833d80d3fbe7 -r 2b092d291348 xen/xsm/flask/ss/services.c
--- a/xen/xsm/flask/ss/services.c	Thu Feb 02 15:23:04 2012 +0000
+++ b/xen/xsm/flask/ss/services.c	Thu Feb 02 15:23:43 2012 +0000
@@ -1883,12 +1883,30 @@
     return rc;
 }
 
+int security_find_bool(const char *name)
+{
+    int i, rv = -ENOENT;
+    POLICY_RDLOCK;
+    for ( i = 0; i < policydb.p_bools.nprim; i++ )
+    {
+        if (!strcmp(name, policydb.p_bool_val_to_name[i]))
+        {
+            rv = i;
+            break;
+        }
+    }
+
+    POLICY_RDUNLOCK;
+    return rv;
+}
+
 int security_get_bools(int *len, char ***names, int **values)
 {
     int i, rc = -ENOMEM;
 
     POLICY_RDLOCK;
-    *names = NULL;
+    if ( names )
+        *names = NULL;
     *values = NULL;
 
     *len = policydb.p_bools.nprim;
@@ -1898,10 +1916,12 @@
         goto out;
     }
 
-    *names = (char**)xmalloc_array(char*, *len);
-    if ( !*names )
-        goto err;
-    memset(*names, 0, sizeof(char*) * *len);
+    if ( names ) {
+        *names = (char**)xmalloc_array(char*, *len);
+        if ( !*names )
+            goto err;
+        memset(*names, 0, sizeof(char*) * *len);
+    }
 
     *values = (int*)xmalloc_array(int, *len);
     if ( !*values )
@@ -1911,19 +1931,21 @@
     {
         size_t name_len;
         (*values)[i] = policydb.bool_val_to_struct[i]->state;
-        name_len = strlen(policydb.p_bool_val_to_name[i]) + 1;
-        (*names)[i] = (char*)xmalloc_array(char, name_len);
-        if ( !(*names)[i] )
-            goto err;
-        strlcpy((*names)[i], policydb.p_bool_val_to_name[i], name_len);
-        (*names)[i][name_len - 1] = 0;
+        if ( names ) {
+            name_len = strlen(policydb.p_bool_val_to_name[i]) + 1;
+            (*names)[i] = (char*)xmalloc_array(char, name_len);
+            if ( !(*names)[i] )
+                goto err;
+            strlcpy((*names)[i], policydb.p_bool_val_to_name[i], name_len);
+            (*names)[i][name_len - 1] = 0;
+        }
     }
     rc = 0;
 out:
     POLICY_RDUNLOCK;
     return rc;
 err:
-    if ( *names )
+    if ( names && *names )
     {
         for ( i = 0; i < *len; i++ )
             xfree((*names)[i]);
@@ -1984,17 +2006,17 @@
     return rc;
 }
 
-int security_get_bool_value(int bool)
+int security_get_bool_value(unsigned int bool)
 {
     int rc = 0;
-    int len;
+    unsigned int len;
 
     POLICY_RDLOCK;
 
     len = policydb.p_bools.nprim;
     if ( bool >= len )
     {
-        rc = -EFAULT;
+        rc = -ENOENT;
         goto out;
     }
 
@@ -2004,6 +2026,29 @@
     return rc;
 }
 
+char *security_get_bool_name(unsigned int bool)
+{
+    unsigned int len;
+    char *rv = NULL;
+
+    POLICY_RDLOCK;
+
+    len = policydb.p_bools.nprim;
+    if ( bool >= len )
+    {
+        goto out;
+    }
+
+    len = strlen(policydb.p_bool_val_to_name[bool]) + 1;
+    rv = xmalloc_array(char, len);
+    if ( !rv )
+        goto out;
+    memcpy(rv, policydb.p_bool_val_to_name[bool], len);
+out:
+    POLICY_RDUNLOCK;
+    return rv;
+}
+
 static int security_preserve_bools(struct policydb *p)
 {
     int rc, nbools = 0, *bvalues = NULL, i;

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 22:00:00 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 22:00:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAm-0000na-4T; Fri, 03 Feb 2012 22:00:00 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAk-0000mI-E8
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:58 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-27.messagelabs.com!1328306353!58731950!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3345 invoked from network); 3 Feb 2012 21:59:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAi-0001sv-4g
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:56 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAg-0003e5-Qt
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:55 +0000
Message-Id: <E1RtRAg-0003e5-Qt@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:53 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] flask/policy: Add boolean example
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328196323 0
# Node ID 5201f4233dd549a77a2d46b4dbff65e789299a83
# Parent  2d956b5baeb00b1cd560805896a427d19dd97887
flask/policy: Add boolean example

This shows an example boolean (prot_doms_locked) which can be set at
runtime to prevent dom0 from mapping memory of domains of type
prot_domU_t.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 2d956b5baeb0 -r 5201f4233dd5 docs/misc/xsm-flask.txt
--- a/docs/misc/xsm-flask.txt	Thu Feb 02 15:24:53 2012 +0000
+++ b/docs/misc/xsm-flask.txt	Thu Feb 02 15:25:23 2012 +0000
@@ -55,10 +55,11 @@
 Once dom0 is running, the policy can be reloaded using "xl loadpolicy".
 
 The example policy included with Xen demonstrates most of the features of FLASK
-that can be used without dom0 disaggregation. It has two main types for domUs:
+that can be used without dom0 disaggregation. The main types for domUs are:
 
  - domU_t is a domain that can communicate with any other domU_t
  - isolated_domU_t can only communicate with dom0
+ - prot_domU_t is a domain type whose creation can be disabled with a boolean
 
 One disadvantage of using type enforcement to enforce isolation is that a new
 type is needed for each group of domains. In addition, it is not possible to
diff -r 2d956b5baeb0 -r 5201f4233dd5 tools/flask/policy/policy/modules/xen/xen.te
--- a/tools/flask/policy/policy/modules/xen/xen.te	Thu Feb 02 15:24:53 2012 +0000
+++ b/tools/flask/policy/policy/modules/xen/xen.te	Thu Feb 02 15:25:23 2012 +0000
@@ -73,7 +73,7 @@
 
 domain_self_comms(dom0_t)
 
-auditallow dom0_t security_t:security { load_policy setenforce };
+auditallow dom0_t security_t:security { load_policy setenforce setbool };
 
 ###############################################################################
 #
@@ -92,6 +92,14 @@
 manage_domain(dom0_t, isolated_domU_t)
 domain_comms(dom0_t, isolated_domU_t)
 
+gen_bool(prot_doms_locked, false)
+declare_domain(prot_domU_t)
+if (!prot_doms_locked) {
+	create_domain(dom0_t, prot_domU_t)
+}
+domain_comms(dom0_t, prot_domU_t)
+domain_comms(domU_t, prot_domU_t)
+
 ###############################################################################
 #
 # Device delegation

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 22:00:00 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 22:00:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAm-0000na-4T; Fri, 03 Feb 2012 22:00:00 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAk-0000mI-E8
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:58 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-27.messagelabs.com!1328306353!58731950!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3345 invoked from network); 3 Feb 2012 21:59:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAi-0001sv-4g
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:56 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAg-0003e5-Qt
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:55 +0000
Message-Id: <E1RtRAg-0003e5-Qt@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:53 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] flask/policy: Add boolean example
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328196323 0
# Node ID 5201f4233dd549a77a2d46b4dbff65e789299a83
# Parent  2d956b5baeb00b1cd560805896a427d19dd97887
flask/policy: Add boolean example

This shows an example boolean (prot_doms_locked) which can be set at
runtime to prevent dom0 from mapping memory of domains of type
prot_domU_t.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 2d956b5baeb0 -r 5201f4233dd5 docs/misc/xsm-flask.txt
--- a/docs/misc/xsm-flask.txt	Thu Feb 02 15:24:53 2012 +0000
+++ b/docs/misc/xsm-flask.txt	Thu Feb 02 15:25:23 2012 +0000
@@ -55,10 +55,11 @@
 Once dom0 is running, the policy can be reloaded using "xl loadpolicy".
 
 The example policy included with Xen demonstrates most of the features of FLASK
-that can be used without dom0 disaggregation. It has two main types for domUs:
+that can be used without dom0 disaggregation. The main types for domUs are:
 
  - domU_t is a domain that can communicate with any other domU_t
  - isolated_domU_t can only communicate with dom0
+ - prot_domU_t is a domain type whose creation can be disabled with a boolean
 
 One disadvantage of using type enforcement to enforce isolation is that a new
 type is needed for each group of domains. In addition, it is not possible to
diff -r 2d956b5baeb0 -r 5201f4233dd5 tools/flask/policy/policy/modules/xen/xen.te
--- a/tools/flask/policy/policy/modules/xen/xen.te	Thu Feb 02 15:24:53 2012 +0000
+++ b/tools/flask/policy/policy/modules/xen/xen.te	Thu Feb 02 15:25:23 2012 +0000
@@ -73,7 +73,7 @@
 
 domain_self_comms(dom0_t)
 
-auditallow dom0_t security_t:security { load_policy setenforce };
+auditallow dom0_t security_t:security { load_policy setenforce setbool };
 
 ###############################################################################
 #
@@ -92,6 +92,14 @@
 manage_domain(dom0_t, isolated_domU_t)
 domain_comms(dom0_t, isolated_domU_t)
 
+gen_bool(prot_doms_locked, false)
+declare_domain(prot_domU_t)
+if (!prot_doms_locked) {
+	create_domain(dom0_t, prot_domU_t)
+}
+domain_comms(dom0_t, prot_domU_t)
+domain_comms(domU_t, prot_domU_t)
+
 ###############################################################################
 #
 # Device delegation

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 22:00:02 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 22:00:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAo-0000r1-7I; Fri, 03 Feb 2012 22:00:02 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAn-0000kg-6z
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 22:00:01 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1328306393!10079788!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14286 invoked from network); 3 Feb 2012 21:59:54 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:54 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAf-0001so-H5
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:53 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAe-0003dD-Lh
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:52 +0000
Message-Id: <E1RtRAe-0003dD-Lh@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:52 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] flask: add flask-{get,
	set}-bool tools
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328196293 0
# Node ID 2d956b5baeb00b1cd560805896a427d19dd97887
# Parent  300bfdf167fa5c0bcd129914c1bd890b431fdb9e
flask: add flask-{get,set}-bool tools

These utilities can be used to modify policy booleans, which allow
minor policy changes without reloading the security policy. This can
be used to make security policy change based on external information
such as time of day, user physical presence, completion of system
boot, or other relevant variables.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 300bfdf167fa -r 2d956b5baeb0 tools/flask/utils/Makefile
--- a/tools/flask/utils/Makefile	Thu Feb 02 15:24:13 2012 +0000
+++ b/tools/flask/utils/Makefile	Thu Feb 02 15:24:53 2012 +0000
@@ -11,7 +11,7 @@
 TESTFLAGS= -DTESTING
 TESTENV  = XENSTORED_ROOTDIR=$(TESTDIR) XENSTORED_RUNDIR=$(TESTDIR)
 
-CLIENTS := flask-loadpolicy flask-setenforce flask-getenforce flask-label-pci
+CLIENTS := flask-loadpolicy flask-setenforce flask-getenforce flask-label-pci flask-get-bool flask-set-bool
 CLIENTS_SRCS := $(patsubst flask-%,%.c,$(CLIENTS))
 CLIENTS_OBJS := $(patsubst flask-%,%.o,$(CLIENTS))
 
@@ -30,6 +30,12 @@
 flask-label-pci: label-pci.o
 	$(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@
 
+flask-get-bool: get-bool.o
+	$(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@
+
+flask-set-bool: set-bool.o
+	$(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@
+
 .PHONY: clean
 clean: 
 	rm -f *.o *.opic *.so
diff -r 300bfdf167fa -r 2d956b5baeb0 tools/flask/utils/get-bool.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/flask/utils/get-bool.c	Thu Feb 02 15:24:53 2012 +0000
@@ -0,0 +1,90 @@
+/*
+ *  Author:  Daniel De Graaf <dgdegra@tycho.nsa.gov>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2,
+ *  as published by the Free Software Foundation.
+ */
+
+#include <stdlib.h>
+#include <errno.h>
+#include <stdio.h>
+#include <xenctrl.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <libflask.h>
+
+static void usage(char **argv)
+{
+	fprintf(stderr, "Usage: %s {name|-a}\n", argv[0]);
+	exit(1);
+}
+
+static int all_bools(xc_interface *xch)
+{
+	int err = 0, i = 0, curr, pend;
+	char name[256];
+	while (1) {
+		err = flask_getbool_byid(xch, i, name, &curr, &pend);
+		if (err < 0) {
+			if (errno == ENOENT)
+				return 0;
+			fprintf(stderr, "flask_getbool: Unable to get boolean #%d: %s (%d)",
+				i, strerror(errno), err);
+			return 2;
+		}
+		if (curr == pend)
+			printf("%s: %d\n", name, curr);
+		else
+			printf("%s: %d (pending %d)\n", name, curr, pend);
+		i++;
+	}
+}
+
+int main(int argc, char **argv)
+{
+	int err = 0;
+	xc_interface *xch;
+	int curr, pend;
+
+	if (argc != 2)
+		usage(argv);
+
+	xch = xc_interface_open(0,0,0);
+	if ( !xch )
+	{
+		fprintf(stderr, "Unable to create interface to xenctrl: %s\n",
+				strerror(errno));
+		err = 1;
+		goto done;
+	}
+
+	if (!strcmp(argv[1], "-a"))
+	{
+		err = all_bools(xch);
+		goto done;
+	}
+
+	err = flask_getbool_byname(xch, argv[1], &curr, &pend);
+	if (err) {
+		fprintf(stderr, "flask_getbool: Unable to get boolean %s: %s (%d)",
+			argv[1], strerror(errno), err);
+		err = 2;
+		goto done;
+	}
+
+	if (curr == pend)
+		printf("%s: %d\n", argv[1], curr);
+	else
+		printf("%s: %d (pending %d)\n", argv[1], curr, pend);
+
+ done:
+	if ( xch )
+		xc_interface_close(xch);
+
+	return err;
+}
diff -r 300bfdf167fa -r 2d956b5baeb0 tools/flask/utils/set-bool.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/flask/utils/set-bool.c	Thu Feb 02 15:24:53 2012 +0000
@@ -0,0 +1,72 @@
+/*
+ *  Author:  Daniel De Graaf <dgdegra@tycho.nsa.gov>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2,
+ *  as published by the Free Software Foundation.
+ */
+
+#include <stdlib.h>
+#include <errno.h>
+#include <stdio.h>
+#include <xenctrl.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <libflask.h>
+
+static void usage(char **argv)
+{
+	fprintf(stderr, "Usage: %s name value\n", argv[0]);
+	exit(1);
+}
+
+static int str2bool(const char *str)
+{
+	if (str[0] == '0' || str[0] == '1')
+		return (str[0] == '1');
+	if (!strcasecmp(str, "enabled") || !strcasecmp(str, "on") || !strcasecmp(str, "y"))
+		return 1;
+	if (!strcasecmp(str, "disabled") || !strcasecmp(str, "off") || !strcasecmp(str, "n"))
+		return 0;
+	fprintf(stderr, "Unknown value %s\n", str);
+	exit(1);
+}
+
+int main(int argc, char **argv)
+{
+	int err = 0;
+	xc_interface *xch;
+	int value;
+
+	if (argc != 3)
+		usage(argv);
+
+	value = str2bool(argv[2]);
+
+	xch = xc_interface_open(0,0,0);
+	if ( !xch )
+	{
+		fprintf(stderr, "Unable to create interface to xenctrl: %s\n",
+				strerror(errno));
+		err = 1;
+		goto done;
+	}
+
+	err = flask_setbool(xch, argv[1], value, 1);
+	if (err) {
+		fprintf(stderr, "flask_setbool: Unable to set boolean %s=%s: %s (%d)",
+			argv[1], argv[2], strerror(errno), err);
+		err = 2;
+		goto done;
+	}
+
+ done:
+	if ( xch )
+		xc_interface_close(xch);
+
+	return err;
+}

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 22:00:02 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 22:00:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAo-0000r1-7I; Fri, 03 Feb 2012 22:00:02 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAn-0000kg-6z
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 22:00:01 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1328306393!10079788!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14286 invoked from network); 3 Feb 2012 21:59:54 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:54 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAf-0001so-H5
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:53 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAe-0003dD-Lh
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:52 +0000
Message-Id: <E1RtRAe-0003dD-Lh@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:52 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] flask: add flask-{get,
	set}-bool tools
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328196293 0
# Node ID 2d956b5baeb00b1cd560805896a427d19dd97887
# Parent  300bfdf167fa5c0bcd129914c1bd890b431fdb9e
flask: add flask-{get,set}-bool tools

These utilities can be used to modify policy booleans, which allow
minor policy changes without reloading the security policy. This can
be used to make security policy change based on external information
such as time of day, user physical presence, completion of system
boot, or other relevant variables.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 300bfdf167fa -r 2d956b5baeb0 tools/flask/utils/Makefile
--- a/tools/flask/utils/Makefile	Thu Feb 02 15:24:13 2012 +0000
+++ b/tools/flask/utils/Makefile	Thu Feb 02 15:24:53 2012 +0000
@@ -11,7 +11,7 @@
 TESTFLAGS= -DTESTING
 TESTENV  = XENSTORED_ROOTDIR=$(TESTDIR) XENSTORED_RUNDIR=$(TESTDIR)
 
-CLIENTS := flask-loadpolicy flask-setenforce flask-getenforce flask-label-pci
+CLIENTS := flask-loadpolicy flask-setenforce flask-getenforce flask-label-pci flask-get-bool flask-set-bool
 CLIENTS_SRCS := $(patsubst flask-%,%.c,$(CLIENTS))
 CLIENTS_OBJS := $(patsubst flask-%,%.o,$(CLIENTS))
 
@@ -30,6 +30,12 @@
 flask-label-pci: label-pci.o
 	$(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@
 
+flask-get-bool: get-bool.o
+	$(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@
+
+flask-set-bool: set-bool.o
+	$(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@
+
 .PHONY: clean
 clean: 
 	rm -f *.o *.opic *.so
diff -r 300bfdf167fa -r 2d956b5baeb0 tools/flask/utils/get-bool.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/flask/utils/get-bool.c	Thu Feb 02 15:24:53 2012 +0000
@@ -0,0 +1,90 @@
+/*
+ *  Author:  Daniel De Graaf <dgdegra@tycho.nsa.gov>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2,
+ *  as published by the Free Software Foundation.
+ */
+
+#include <stdlib.h>
+#include <errno.h>
+#include <stdio.h>
+#include <xenctrl.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <libflask.h>
+
+static void usage(char **argv)
+{
+	fprintf(stderr, "Usage: %s {name|-a}\n", argv[0]);
+	exit(1);
+}
+
+static int all_bools(xc_interface *xch)
+{
+	int err = 0, i = 0, curr, pend;
+	char name[256];
+	while (1) {
+		err = flask_getbool_byid(xch, i, name, &curr, &pend);
+		if (err < 0) {
+			if (errno == ENOENT)
+				return 0;
+			fprintf(stderr, "flask_getbool: Unable to get boolean #%d: %s (%d)",
+				i, strerror(errno), err);
+			return 2;
+		}
+		if (curr == pend)
+			printf("%s: %d\n", name, curr);
+		else
+			printf("%s: %d (pending %d)\n", name, curr, pend);
+		i++;
+	}
+}
+
+int main(int argc, char **argv)
+{
+	int err = 0;
+	xc_interface *xch;
+	int curr, pend;
+
+	if (argc != 2)
+		usage(argv);
+
+	xch = xc_interface_open(0,0,0);
+	if ( !xch )
+	{
+		fprintf(stderr, "Unable to create interface to xenctrl: %s\n",
+				strerror(errno));
+		err = 1;
+		goto done;
+	}
+
+	if (!strcmp(argv[1], "-a"))
+	{
+		err = all_bools(xch);
+		goto done;
+	}
+
+	err = flask_getbool_byname(xch, argv[1], &curr, &pend);
+	if (err) {
+		fprintf(stderr, "flask_getbool: Unable to get boolean %s: %s (%d)",
+			argv[1], strerror(errno), err);
+		err = 2;
+		goto done;
+	}
+
+	if (curr == pend)
+		printf("%s: %d\n", argv[1], curr);
+	else
+		printf("%s: %d (pending %d)\n", argv[1], curr, pend);
+
+ done:
+	if ( xch )
+		xc_interface_close(xch);
+
+	return err;
+}
diff -r 300bfdf167fa -r 2d956b5baeb0 tools/flask/utils/set-bool.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/flask/utils/set-bool.c	Thu Feb 02 15:24:53 2012 +0000
@@ -0,0 +1,72 @@
+/*
+ *  Author:  Daniel De Graaf <dgdegra@tycho.nsa.gov>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2,
+ *  as published by the Free Software Foundation.
+ */
+
+#include <stdlib.h>
+#include <errno.h>
+#include <stdio.h>
+#include <xenctrl.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <libflask.h>
+
+static void usage(char **argv)
+{
+	fprintf(stderr, "Usage: %s name value\n", argv[0]);
+	exit(1);
+}
+
+static int str2bool(const char *str)
+{
+	if (str[0] == '0' || str[0] == '1')
+		return (str[0] == '1');
+	if (!strcasecmp(str, "enabled") || !strcasecmp(str, "on") || !strcasecmp(str, "y"))
+		return 1;
+	if (!strcasecmp(str, "disabled") || !strcasecmp(str, "off") || !strcasecmp(str, "n"))
+		return 0;
+	fprintf(stderr, "Unknown value %s\n", str);
+	exit(1);
+}
+
+int main(int argc, char **argv)
+{
+	int err = 0;
+	xc_interface *xch;
+	int value;
+
+	if (argc != 3)
+		usage(argv);
+
+	value = str2bool(argv[2]);
+
+	xch = xc_interface_open(0,0,0);
+	if ( !xch )
+	{
+		fprintf(stderr, "Unable to create interface to xenctrl: %s\n",
+				strerror(errno));
+		err = 1;
+		goto done;
+	}
+
+	err = flask_setbool(xch, argv[1], value, 1);
+	if (err) {
+		fprintf(stderr, "flask_setbool: Unable to set boolean %s=%s: %s (%d)",
+			argv[1], argv[2], strerror(errno), err);
+		err = 2;
+		goto done;
+	}
+
+ done:
+	if ( xch )
+		xc_interface_close(xch);
+
+	return err;
+}

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 22:00:04 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 22:00:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAq-0000sb-Ar; Fri, 03 Feb 2012 22:00:04 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAp-0000rq-Hp
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 22:00:03 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-27.messagelabs.com!1328306346!55318897!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18501 invoked from network); 3 Feb 2012 21:59:07 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:07 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAn-0001t5-6m
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 22:00:01 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAl-0003fo-RJ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 22:00:00 +0000
Message-Id: <E1RtRAl-0003fo-RJ@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:58 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: avoid deadlock after a PCI SERR
	NMI
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1328196538 0
# Node ID dcc6d57e4c07728693c685a2cfa7f094ef726267
# Parent  7091b2e4cc2cff07ad1bf24ba7b9506bae071fa8
x86: avoid deadlock after a PCI SERR NMI

If a PCI System Error (SERR) is asserted it causes an NMI. If this NMI
occurs while the CPU is in printk() then Xen may deadlock as
pci_serr_error() calls console_force_unlock() which screws up the
console lock.

printk() isn't safe to call from NMI context so defer the diagnostic
message to a softirq.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Tested-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 7091b2e4cc2c -r dcc6d57e4c07 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c	Thu Feb 02 15:26:55 2012 +0000
+++ b/xen/arch/x86/traps.c	Thu Feb 02 15:28:58 2012 +0000
@@ -3173,6 +3173,11 @@
     st->vcpu = NULL;
 }
 
+static void pci_serr_softirq(void)
+{
+    printk("\n\nNMI - PCI system error (SERR)\n");
+}
+
 void async_exception_cleanup(struct vcpu *curr)
 {
     int trap;
@@ -3259,10 +3264,11 @@
 
 static void pci_serr_error(struct cpu_user_regs *regs)
 {
-    console_force_unlock();
-    printk("\n\nNMI - PCI system error (SERR)\n");
-
     outb((inb(0x61) & 0x0f) | 0x04, 0x61); /* clear-and-disable the PCI SERR error line. */
+
+    /* Would like to print a diagnostic here but can't call printk()
+       from NMI context -- raise a softirq instead. */
+    raise_softirq(PCI_SERR_SOFTIRQ);
 }
 
 static void io_check_error(struct cpu_user_regs *regs)
@@ -3563,6 +3569,7 @@
     cpu_init();
 
     open_softirq(NMI_MCE_SOFTIRQ, nmi_mce_softirq);
+    open_softirq(PCI_SERR_SOFTIRQ, pci_serr_softirq);
 }
 
 long register_guest_nmi_callback(unsigned long address)
diff -r 7091b2e4cc2c -r dcc6d57e4c07 xen/include/asm-x86/softirq.h
--- a/xen/include/asm-x86/softirq.h	Thu Feb 02 15:26:55 2012 +0000
+++ b/xen/include/asm-x86/softirq.h	Thu Feb 02 15:28:58 2012 +0000
@@ -6,6 +6,7 @@
 #define VCPU_KICK_SOFTIRQ      (NR_COMMON_SOFTIRQS + 2)
 
 #define MACHINE_CHECK_SOFTIRQ  (NR_COMMON_SOFTIRQS + 3)
-#define NR_ARCH_SOFTIRQS       4
+#define PCI_SERR_SOFTIRQ       (NR_COMMON_SOFTIRQS + 4)
+#define NR_ARCH_SOFTIRQS       5
 
 #endif /* __ASM_SOFTIRQ_H__ */

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 22:00:04 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 22:00:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAq-0000sb-Ar; Fri, 03 Feb 2012 22:00:04 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAp-0000rq-Hp
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 22:00:03 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-27.messagelabs.com!1328306346!55318897!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18501 invoked from network); 3 Feb 2012 21:59:07 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:07 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAn-0001t5-6m
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 22:00:01 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAl-0003fo-RJ
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 22:00:00 +0000
Message-Id: <E1RtRAl-0003fo-RJ@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:58 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: avoid deadlock after a PCI SERR
	NMI
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1328196538 0
# Node ID dcc6d57e4c07728693c685a2cfa7f094ef726267
# Parent  7091b2e4cc2cff07ad1bf24ba7b9506bae071fa8
x86: avoid deadlock after a PCI SERR NMI

If a PCI System Error (SERR) is asserted it causes an NMI. If this NMI
occurs while the CPU is in printk() then Xen may deadlock as
pci_serr_error() calls console_force_unlock() which screws up the
console lock.

printk() isn't safe to call from NMI context so defer the diagnostic
message to a softirq.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Tested-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 7091b2e4cc2c -r dcc6d57e4c07 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c	Thu Feb 02 15:26:55 2012 +0000
+++ b/xen/arch/x86/traps.c	Thu Feb 02 15:28:58 2012 +0000
@@ -3173,6 +3173,11 @@
     st->vcpu = NULL;
 }
 
+static void pci_serr_softirq(void)
+{
+    printk("\n\nNMI - PCI system error (SERR)\n");
+}
+
 void async_exception_cleanup(struct vcpu *curr)
 {
     int trap;
@@ -3259,10 +3264,11 @@
 
 static void pci_serr_error(struct cpu_user_regs *regs)
 {
-    console_force_unlock();
-    printk("\n\nNMI - PCI system error (SERR)\n");
-
     outb((inb(0x61) & 0x0f) | 0x04, 0x61); /* clear-and-disable the PCI SERR error line. */
+
+    /* Would like to print a diagnostic here but can't call printk()
+       from NMI context -- raise a softirq instead. */
+    raise_softirq(PCI_SERR_SOFTIRQ);
 }
 
 static void io_check_error(struct cpu_user_regs *regs)
@@ -3563,6 +3569,7 @@
     cpu_init();
 
     open_softirq(NMI_MCE_SOFTIRQ, nmi_mce_softirq);
+    open_softirq(PCI_SERR_SOFTIRQ, pci_serr_softirq);
 }
 
 long register_guest_nmi_callback(unsigned long address)
diff -r 7091b2e4cc2c -r dcc6d57e4c07 xen/include/asm-x86/softirq.h
--- a/xen/include/asm-x86/softirq.h	Thu Feb 02 15:26:55 2012 +0000
+++ b/xen/include/asm-x86/softirq.h	Thu Feb 02 15:28:58 2012 +0000
@@ -6,6 +6,7 @@
 #define VCPU_KICK_SOFTIRQ      (NR_COMMON_SOFTIRQS + 2)
 
 #define MACHINE_CHECK_SOFTIRQ  (NR_COMMON_SOFTIRQS + 3)
-#define NR_ARCH_SOFTIRQS       4
+#define PCI_SERR_SOFTIRQ       (NR_COMMON_SOFTIRQS + 4)
+#define NR_ARCH_SOFTIRQS       5
 
 #endif /* __ASM_SOFTIRQ_H__ */

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 22:00:06 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 22:00:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAs-0000uc-Fs; Fri, 03 Feb 2012 22:00:06 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAr-0000ni-L0
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 22:00:05 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1328306398!11868164!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16945 invoked from network); 3 Feb 2012 21:59:59 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:59 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAk-0001sy-4G
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:58 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAi-0003em-Pf
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:56 +0000
Message-Id: <E1RtRAi-0003em-Pf@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:56 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xsm/flask: Improve domain ID
	auditing in AVCs
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328196415 0
# Node ID 7091b2e4cc2cff07ad1bf24ba7b9506bae071fa8
# Parent  5201f4233dd549a77a2d46b4dbff65e789299a83
xsm/flask: Improve domain ID auditing in AVCs

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 5201f4233dd5 -r 7091b2e4cc2c xen/xsm/flask/avc.c
--- a/xen/xsm/flask/avc.c	Thu Feb 02 15:25:23 2012 +0000
+++ b/xen/xsm/flask/avc.c	Thu Feb 02 15:26:55 2012 +0000
@@ -539,7 +539,7 @@
 void avc_audit(u32 ssid, u32 tsid, u16 tclass, u32 requested,
                struct av_decision *avd, int result, struct avc_audit_data *a)
 {
-    struct domain *d = current->domain;
+    struct domain *cdom = current->domain;
     u32 denied, audited;
 
     denied = requested & ~avd->allowed;
@@ -564,10 +564,17 @@
     avc_dump_av(tclass, audited);
     printk(" for ");
 
-    if ( a && a->d )
-        d = a->d;
-    if ( d )
-        printk("domid=%d ", d->domain_id);
+    if ( a && (a->sdom || a->tdom) )
+    {
+        if ( a->sdom && a->tdom && a->sdom != a->tdom )
+            printk("domid=%d target=%d ", a->sdom->domain_id, a->tdom->domain_id);
+        else if ( a->sdom )
+            printk("domid=%d ", a->sdom->domain_id);
+        else
+            printk("target=%d ", a->tdom->domain_id);
+    }
+    else if ( cdom )
+        printk("domid=%d ", cdom->domain_id);
     switch ( a ? a->type : 0 ) {
     case AVC_AUDIT_DATA_DEV:
         printk("device=0x%lx ", a->device);
diff -r 5201f4233dd5 -r 7091b2e4cc2c xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c	Thu Feb 02 15:25:23 2012 +0000
+++ b/xen/xsm/flask/hooks.c	Thu Feb 02 15:26:55 2012 +0000
@@ -37,11 +37,15 @@
                            u16 class, u32 perms)
 {
     struct domain_security_struct *dsec1, *dsec2;
+    struct avc_audit_data ad;
+    AVC_AUDIT_DATA_INIT(&ad, NONE);
+    ad.sdom = dom1;
+    ad.tdom = dom2;
 
     dsec1 = dom1->ssid;
     dsec2 = dom2->ssid;
 
-    return avc_has_perm(dsec1->sid, dsec2->sid, class, perms, NULL);
+    return avc_has_perm(dsec1->sid, dsec2->sid, class, perms, &ad);
 }
 
 static int domain_has_evtchn(struct domain *d, struct evtchn *chn, u32 perms)
@@ -1323,6 +1327,7 @@
     unsigned long fmfn;
     struct domain_security_struct *dsec;
     u32 fsid;
+    struct avc_audit_data ad;
 
     if (d != t)
         rc = domain_has_perm(d, t, SECCLASS_MMU, MMU__REMOTE_REMAP);
@@ -1337,13 +1342,22 @@
     if ( l1e_get_flags(l1e_from_intpte(fpte)) & _PAGE_RW )
         map_perms |= MMU__MAP_WRITE;
 
+    AVC_AUDIT_DATA_INIT(&ad, RANGE);
     fmfn = get_gfn_untyped(f, l1e_get_pfn(l1e_from_intpte(fpte)));
 
+    ad.sdom = d;
+    ad.tdom = f;
+    ad.range.start = fpte;
+    ad.range.end = fmfn;
+
     rc = get_mfn_sid(fmfn, &fsid);
+
+    put_gfn(f, fmfn);
+
     if ( rc )
         return rc;
 
-    return avc_has_perm(dsec->sid, fsid, SECCLASS_MMU, map_perms, NULL);
+    return avc_has_perm(dsec->sid, fsid, SECCLASS_MMU, map_perms, &ad);
 }
 
 static int flask_mmu_machphys_update(struct domain *d, unsigned long mfn)
diff -r 5201f4233dd5 -r 7091b2e4cc2c xen/xsm/flask/include/avc.h
--- a/xen/xsm/flask/include/avc.h	Thu Feb 02 15:25:23 2012 +0000
+++ b/xen/xsm/flask/include/avc.h	Thu Feb 02 15:26:55 2012 +0000
@@ -38,10 +38,12 @@
 /* Auxiliary data to use in generating the audit record. */
 struct avc_audit_data {
     char    type;
+#define AVC_AUDIT_DATA_NONE  0
 #define AVC_AUDIT_DATA_DEV   1
 #define AVC_AUDIT_DATA_IRQ   2
 #define AVC_AUDIT_DATA_RANGE 3
-    struct domain *d;
+    struct domain *sdom;
+    struct domain *tdom;
     union {
         unsigned long device;
         int irq;

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 22:00:06 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 22:00:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRAs-0000uc-Fs; Fri, 03 Feb 2012 22:00:06 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAr-0000ni-L0
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 22:00:05 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1328306398!11868164!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16945 invoked from network); 3 Feb 2012 21:59:59 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 21:59:59 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAk-0001sy-4G
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:58 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAi-0003em-Pf
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 21:59:56 +0000
Message-Id: <E1RtRAi-0003em-Pf@xenbits.xen.org>
Date: Fri, 03 Feb 2012 21:59:56 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xsm/flask: Improve domain ID
	auditing in AVCs
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328196415 0
# Node ID 7091b2e4cc2cff07ad1bf24ba7b9506bae071fa8
# Parent  5201f4233dd549a77a2d46b4dbff65e789299a83
xsm/flask: Improve domain ID auditing in AVCs

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 5201f4233dd5 -r 7091b2e4cc2c xen/xsm/flask/avc.c
--- a/xen/xsm/flask/avc.c	Thu Feb 02 15:25:23 2012 +0000
+++ b/xen/xsm/flask/avc.c	Thu Feb 02 15:26:55 2012 +0000
@@ -539,7 +539,7 @@
 void avc_audit(u32 ssid, u32 tsid, u16 tclass, u32 requested,
                struct av_decision *avd, int result, struct avc_audit_data *a)
 {
-    struct domain *d = current->domain;
+    struct domain *cdom = current->domain;
     u32 denied, audited;
 
     denied = requested & ~avd->allowed;
@@ -564,10 +564,17 @@
     avc_dump_av(tclass, audited);
     printk(" for ");
 
-    if ( a && a->d )
-        d = a->d;
-    if ( d )
-        printk("domid=%d ", d->domain_id);
+    if ( a && (a->sdom || a->tdom) )
+    {
+        if ( a->sdom && a->tdom && a->sdom != a->tdom )
+            printk("domid=%d target=%d ", a->sdom->domain_id, a->tdom->domain_id);
+        else if ( a->sdom )
+            printk("domid=%d ", a->sdom->domain_id);
+        else
+            printk("target=%d ", a->tdom->domain_id);
+    }
+    else if ( cdom )
+        printk("domid=%d ", cdom->domain_id);
     switch ( a ? a->type : 0 ) {
     case AVC_AUDIT_DATA_DEV:
         printk("device=0x%lx ", a->device);
diff -r 5201f4233dd5 -r 7091b2e4cc2c xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c	Thu Feb 02 15:25:23 2012 +0000
+++ b/xen/xsm/flask/hooks.c	Thu Feb 02 15:26:55 2012 +0000
@@ -37,11 +37,15 @@
                            u16 class, u32 perms)
 {
     struct domain_security_struct *dsec1, *dsec2;
+    struct avc_audit_data ad;
+    AVC_AUDIT_DATA_INIT(&ad, NONE);
+    ad.sdom = dom1;
+    ad.tdom = dom2;
 
     dsec1 = dom1->ssid;
     dsec2 = dom2->ssid;
 
-    return avc_has_perm(dsec1->sid, dsec2->sid, class, perms, NULL);
+    return avc_has_perm(dsec1->sid, dsec2->sid, class, perms, &ad);
 }
 
 static int domain_has_evtchn(struct domain *d, struct evtchn *chn, u32 perms)
@@ -1323,6 +1327,7 @@
     unsigned long fmfn;
     struct domain_security_struct *dsec;
     u32 fsid;
+    struct avc_audit_data ad;
 
     if (d != t)
         rc = domain_has_perm(d, t, SECCLASS_MMU, MMU__REMOTE_REMAP);
@@ -1337,13 +1342,22 @@
     if ( l1e_get_flags(l1e_from_intpte(fpte)) & _PAGE_RW )
         map_perms |= MMU__MAP_WRITE;
 
+    AVC_AUDIT_DATA_INIT(&ad, RANGE);
     fmfn = get_gfn_untyped(f, l1e_get_pfn(l1e_from_intpte(fpte)));
 
+    ad.sdom = d;
+    ad.tdom = f;
+    ad.range.start = fpte;
+    ad.range.end = fmfn;
+
     rc = get_mfn_sid(fmfn, &fsid);
+
+    put_gfn(f, fmfn);
+
     if ( rc )
         return rc;
 
-    return avc_has_perm(dsec->sid, fsid, SECCLASS_MMU, map_perms, NULL);
+    return avc_has_perm(dsec->sid, fsid, SECCLASS_MMU, map_perms, &ad);
 }
 
 static int flask_mmu_machphys_update(struct domain *d, unsigned long mfn)
diff -r 5201f4233dd5 -r 7091b2e4cc2c xen/xsm/flask/include/avc.h
--- a/xen/xsm/flask/include/avc.h	Thu Feb 02 15:25:23 2012 +0000
+++ b/xen/xsm/flask/include/avc.h	Thu Feb 02 15:26:55 2012 +0000
@@ -38,10 +38,12 @@
 /* Auxiliary data to use in generating the audit record. */
 struct avc_audit_data {
     char    type;
+#define AVC_AUDIT_DATA_NONE  0
 #define AVC_AUDIT_DATA_DEV   1
 #define AVC_AUDIT_DATA_IRQ   2
 #define AVC_AUDIT_DATA_RANGE 3
-    struct domain *d;
+    struct domain *sdom;
+    struct domain *tdom;
     union {
         unsigned long device;
         int irq;

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 22:00:39 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 22:00:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRBO-000189-K7; Fri, 03 Feb 2012 22:00:38 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRBN-00016V-6E
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 22:00:37 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-216.messagelabs.com!1328306430!10025676!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13059 invoked from network); 3 Feb 2012 22:00:31 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 22:00:31 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAv-0001w4-0g
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 22:00:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAo-0003gs-HE
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 22:00:07 +0000
Message-Id: <E1RtRAo-0003gs-HE@xenbits.xen.org>
Date: Fri, 03 Feb 2012 22:00:01 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Fix x86_32 build
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328197646 0
# Node ID 3432abcf9380d3840ca38439a304f74a37d155fc
# Parent  dcc6d57e4c07728693c685a2cfa7f094ef726267
Fix x86_32 build

Signed-off-by: Tim Deegan <tim@xen.org>
---


diff -r dcc6d57e4c07 -r 3432abcf9380 xen/common/memory.c
--- a/xen/common/memory.c	Thu Feb 02 15:28:58 2012 +0000
+++ b/xen/common/memory.c	Thu Feb 02 15:47:26 2012 +0000
@@ -182,7 +182,7 @@
     }
             
     page = mfn_to_page(mfn);
-#ifdef CONFIG_X86
+#ifdef CONFIG_X86_64
     if ( p2m_is_shared(p2mt) )
     {
         /* Unshare the page, bail out on error. We unshare because 
@@ -192,8 +192,8 @@
         if ( mem_sharing_unshare_page(d, gmfn, 0) )
             return 0;
     }
+#endif /* CONFIG_X86_64 */
 
-#endif /* CONFIG_X86 */
     if ( unlikely(!get_page(page, d)) )
     {
         put_gfn(d, gmfn);

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 03 22:00:39 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Feb 2012 22:00:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RtRBO-000189-K7; Fri, 03 Feb 2012 22:00:38 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRBN-00016V-6E
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 22:00:37 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-216.messagelabs.com!1328306430!10025676!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13059 invoked from network); 3 Feb 2012 22:00:31 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Feb 2012 22:00:31 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAv-0001w4-0g
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 22:00:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RtRAo-0003gs-HE
	for xen-changelog@lists.xensource.com; Fri, 03 Feb 2012 22:00:07 +0000
Message-Id: <E1RtRAo-0003gs-HE@xenbits.xen.org>
Date: Fri, 03 Feb 2012 22:00:01 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Fix x86_32 build
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328197646 0
# Node ID 3432abcf9380d3840ca38439a304f74a37d155fc
# Parent  dcc6d57e4c07728693c685a2cfa7f094ef726267
Fix x86_32 build

Signed-off-by: Tim Deegan <tim@xen.org>
---


diff -r dcc6d57e4c07 -r 3432abcf9380 xen/common/memory.c
--- a/xen/common/memory.c	Thu Feb 02 15:28:58 2012 +0000
+++ b/xen/common/memory.c	Thu Feb 02 15:47:26 2012 +0000
@@ -182,7 +182,7 @@
     }
             
     page = mfn_to_page(mfn);
-#ifdef CONFIG_X86
+#ifdef CONFIG_X86_64
     if ( p2m_is_shared(p2mt) )
     {
         /* Unshare the page, bail out on error. We unshare because 
@@ -192,8 +192,8 @@
         if ( mem_sharing_unshare_page(d, gmfn, 0) )
             return 0;
     }
+#endif /* CONFIG_X86_64 */
 
-#endif /* CONFIG_X86 */
     if ( unlikely(!get_page(page, d)) )
     {
         put_gfn(d, gmfn);

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:00:34 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:00:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8GB-0000Xx-68; Sun, 05 Feb 2012 20:00:27 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8G9-0000Xa-Od
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:25 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-7.tower-216.messagelabs.com!1328472018!10180375!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15696 invoked from network); 5 Feb 2012 20:00:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 20:00:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8G1-0001jX-Ac
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8G1-0003w5-0p
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:17 +0000
Date: Sun, 05 Feb 2012 20:00:17 +0000
Message-Id: <E1Ru8G1-0003w5-0p@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] console: Fix segfault on
	screendump without VGA adapter
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 986626efecae87af17a9d9726767501cb4687b8c
Author: Alexander Graf <agraf@suse.de>
Date:   Fri Nov 18 16:41:59 2011 +0100

    console: Fix segfault on screendump without VGA adapter
    
    When trying to create a screen dump without having any VGA adapter
    inside the guest, QEMU segfaults.
    
    This is because it's trying to switch back to the "previous" screen
    it was on before dumping the VGA screen. Unfortunately, in my case
    there simply is no previous screen so it accesses a NULL pointer.
    
    Fix it by checking if previous_active_console is actually available.
    
    This is 1.0 material.
    
    Signed-off-by: Alexander Graf <agraf@suse.de>
---
 console.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/console.c b/console.c
index f6fe441..ed6a653 100644
--- a/console.c
+++ b/console.c
@@ -186,7 +186,9 @@ void vga_hw_screen_dump(const char *filename)
         consoles[0]->hw_screen_dump(consoles[0]->hw, filename);
     }
 
-    console_select(previous_active_console->index);
+    if (previous_active_console) {
+        console_select(previous_active_console->index);
+    }
 }
 
 void vga_hw_text_update(console_ch_t *chardata)
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:00:34 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:00:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8GB-0000Xx-68; Sun, 05 Feb 2012 20:00:27 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8G9-0000Xa-Od
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:25 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-7.tower-216.messagelabs.com!1328472018!10180375!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15696 invoked from network); 5 Feb 2012 20:00:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 20:00:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8G1-0001jX-Ac
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8G1-0003w5-0p
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:17 +0000
Date: Sun, 05 Feb 2012 20:00:17 +0000
Message-Id: <E1Ru8G1-0003w5-0p@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] console: Fix segfault on
	screendump without VGA adapter
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 986626efecae87af17a9d9726767501cb4687b8c
Author: Alexander Graf <agraf@suse.de>
Date:   Fri Nov 18 16:41:59 2011 +0100

    console: Fix segfault on screendump without VGA adapter
    
    When trying to create a screen dump without having any VGA adapter
    inside the guest, QEMU segfaults.
    
    This is because it's trying to switch back to the "previous" screen
    it was on before dumping the VGA screen. Unfortunately, in my case
    there simply is no previous screen so it accesses a NULL pointer.
    
    Fix it by checking if previous_active_console is actually available.
    
    This is 1.0 material.
    
    Signed-off-by: Alexander Graf <agraf@suse.de>
---
 console.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/console.c b/console.c
index f6fe441..ed6a653 100644
--- a/console.c
+++ b/console.c
@@ -186,7 +186,9 @@ void vga_hw_screen_dump(const char *filename)
         consoles[0]->hw_screen_dump(consoles[0]->hw, filename);
     }
 
-    console_select(previous_active_console->index);
+    if (previous_active_console) {
+        console_select(previous_active_console->index);
+    }
 }
 
 void vga_hw_text_update(console_ch_t *chardata)
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:00:35 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:00:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8GF-0000YQ-8p; Sun, 05 Feb 2012 20:00:31 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8GD-0000Xm-Re
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:30 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-9.tower-182.messagelabs.com!1328472007!13163797!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8184 invoked from network); 5 Feb 2012 20:00:23 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 20:00:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Fq-0001jU-8Y
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:06 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Fp-0003rV-H0
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:05 +0000
Date: Sun, 05 Feb 2012 20:00:05 +0000
Message-Id: <E1Ru8Fp-0003rV-H0@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] e1000: bounds packet size
	against buffer size
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit d0ed2d2e8e863a9a64c9fc9c08fa68bee546ad00
Author: Anthony Liguori <aliguori@us.ibm.com>
Date:   Mon Jan 23 07:30:43 2012 -0600

    e1000: bounds packet size against buffer size
    
    Otherwise we can write beyond the buffer and corrupt memory.  This is tracked
    as CVE-2012-0029.
    
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 hw/e1000.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/e1000.c b/hw/e1000.c
index 986ed9c..e164d79 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -466,6 +466,8 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
             bytes = split_size;
             if (tp->size + bytes > msh)
                 bytes = msh - tp->size;
+
+            bytes = MIN(sizeof(tp->data) - tp->size, bytes);
             pci_dma_read(&s->dev, addr, tp->data + tp->size, bytes);
             if ((sz = tp->size + bytes) >= hdr && tp->size < hdr)
                 memmove(tp->header, tp->data, hdr);
@@ -481,6 +483,7 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
         // context descriptor TSE is not set, while data descriptor TSE is set
         DBGOUT(TXERR, "TCP segmentaion Error\n");
     } else {
+        split_size = MIN(sizeof(tp->data) - tp->size, split_size);
         pci_dma_read(&s->dev, addr, tp->data + tp->size, split_size);
         tp->size += split_size;
     }
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:00:35 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:00:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8GF-0000YQ-8p; Sun, 05 Feb 2012 20:00:31 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8GD-0000Xm-Re
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:30 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-9.tower-182.messagelabs.com!1328472007!13163797!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8184 invoked from network); 5 Feb 2012 20:00:23 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 20:00:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Fq-0001jU-8Y
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:06 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Fp-0003rV-H0
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:05 +0000
Date: Sun, 05 Feb 2012 20:00:05 +0000
Message-Id: <E1Ru8Fp-0003rV-H0@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] e1000: bounds packet size
	against buffer size
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit d0ed2d2e8e863a9a64c9fc9c08fa68bee546ad00
Author: Anthony Liguori <aliguori@us.ibm.com>
Date:   Mon Jan 23 07:30:43 2012 -0600

    e1000: bounds packet size against buffer size
    
    Otherwise we can write beyond the buffer and corrupt memory.  This is tracked
    as CVE-2012-0029.
    
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 hw/e1000.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/e1000.c b/hw/e1000.c
index 986ed9c..e164d79 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -466,6 +466,8 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
             bytes = split_size;
             if (tp->size + bytes > msh)
                 bytes = msh - tp->size;
+
+            bytes = MIN(sizeof(tp->data) - tp->size, bytes);
             pci_dma_read(&s->dev, addr, tp->data + tp->size, bytes);
             if ((sz = tp->size + bytes) >= hdr && tp->size < hdr)
                 memmove(tp->header, tp->data, hdr);
@@ -481,6 +483,7 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
         // context descriptor TSE is not set, while data descriptor TSE is set
         DBGOUT(TXERR, "TCP segmentaion Error\n");
     } else {
+        split_size = MIN(sizeof(tp->data) - tp->size, split_size);
         pci_dma_read(&s->dev, addr, tp->data + tp->size, split_size);
         tp->size += split_size;
     }
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:00:35 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:00:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8GF-0000YV-Bd; Sun, 05 Feb 2012 20:00:31 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8GE-0000YD-G5
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:30 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-9.tower-27.messagelabs.com!1328471980!61599809!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27296 invoked from network); 5 Feb 2012 19:59:41 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 19:59:41 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8GB-0001ja-Pr
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:27 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8GB-0003ze-Hb
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:27 +0000
Date: Sun, 05 Feb 2012 20:00:27 +0000
Message-Id: <E1Ru8GB-0003ze-Hb@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] pseries: Fix array overrun
	bug in PCI code
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 57ee5f77c09d365d470cd208c76a7a01a85435b2
Author: David Gibson <david@gibson.dropbear.id.au>
Date:   Mon Nov 28 20:21:39 2011 +0000

    pseries: Fix array overrun bug in PCI code
    
    spapr_populate_pci_devices() containd a loop with PCI_NUM_REGIONS (7)
    iterations.  However this overruns the 'bars' global array, which only has
    6 elements. In fact we only want to run this loop for things listed in the
    bars array, so this patch corrects the loop bounds to reflect that.
    
    Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
    Signed-off-by: Alexander Graf <agraf@suse.de>
    (cherry picked from commit 135712de61dfa22368e98914d65b8b0860ec8505)
---
 hw/spapr_pci.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/spapr_pci.c b/hw/spapr_pci.c
index 7162588..9b6a032 100644
--- a/hw/spapr_pci.c
+++ b/hw/spapr_pci.c
@@ -454,7 +454,7 @@ int spapr_populate_pci_devices(sPAPRPHBState *phb,
         reg[0].size = 0;
 
         n = 0;
-        for (i = 0; i < PCI_NUM_REGIONS; ++i) {
+        for (i = 0; i < ARRAY_SIZE(bars); ++i) {
             if (0 == dev->io_regions[i].size) {
                 continue;
             }
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:00:35 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:00:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8GF-0000YV-Bd; Sun, 05 Feb 2012 20:00:31 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8GE-0000YD-G5
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:30 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-9.tower-27.messagelabs.com!1328471980!61599809!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27296 invoked from network); 5 Feb 2012 19:59:41 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 19:59:41 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8GB-0001ja-Pr
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:27 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8GB-0003ze-Hb
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:27 +0000
Date: Sun, 05 Feb 2012 20:00:27 +0000
Message-Id: <E1Ru8GB-0003ze-Hb@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] pseries: Fix array overrun
	bug in PCI code
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 57ee5f77c09d365d470cd208c76a7a01a85435b2
Author: David Gibson <david@gibson.dropbear.id.au>
Date:   Mon Nov 28 20:21:39 2011 +0000

    pseries: Fix array overrun bug in PCI code
    
    spapr_populate_pci_devices() containd a loop with PCI_NUM_REGIONS (7)
    iterations.  However this overruns the 'bars' global array, which only has
    6 elements. In fact we only want to run this loop for things listed in the
    bars array, so this patch corrects the loop bounds to reflect that.
    
    Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
    Signed-off-by: Alexander Graf <agraf@suse.de>
    (cherry picked from commit 135712de61dfa22368e98914d65b8b0860ec8505)
---
 hw/spapr_pci.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/spapr_pci.c b/hw/spapr_pci.c
index 7162588..9b6a032 100644
--- a/hw/spapr_pci.c
+++ b/hw/spapr_pci.c
@@ -454,7 +454,7 @@ int spapr_populate_pci_devices(sPAPRPHBState *phb,
         reg[0].size = 0;
 
         n = 0;
-        for (i = 0; i < PCI_NUM_REGIONS; ++i) {
+        for (i = 0; i < ARRAY_SIZE(bars); ++i) {
             if (0 == dev->io_regions[i].size) {
                 continue;
             }
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:00:53 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:00:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8GY-0000bl-Ev; Sun, 05 Feb 2012 20:00:50 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8GX-0000av-RP
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:50 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-8.tower-174.messagelabs.com!1328472040!12059185!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27333 invoked from network); 5 Feb 2012 20:00:41 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 20:00:41 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8GN-0001jj-PY
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:39 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8GL-00043n-Uf
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:39 +0000
Date: Sun, 05 Feb 2012 20:00:37 +0000
Message-Id: <E1Ru8GL-00043n-Uf@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] kvm-ppc: halt secondary
	cpus when guest reset
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit adf6c527b07b1399cae990d48fa7b87113bd5083
Author: Liu Yu-B13201 <Yu.Liu@freescale.com>
Date:   Mon Nov 28 20:41:18 2011 +0000

    kvm-ppc: halt secondary cpus when guest reset
    
    When guest reset, we need to halt secondary cpus until guest kick them.
    This already works for tcg. The patch add the support for kvm.
    
    Signed-off-by: Liu Yu <yu.liu@freescale.com>
    Signed-off-by: Alexander Graf <agraf@suse.de>
    [agraf: remove in-kernel irqchip code]
    (cherry picked from commit 157feeadbaec09fe4dca539a24f6f6d327d6eeb6)
---
 hw/ppce500_spin.c |    1 +
 target-ppc/kvm.c  |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/hw/ppce500_spin.c b/hw/ppce500_spin.c
index cccd940..2b52728 100644
--- a/hw/ppce500_spin.c
+++ b/hw/ppce500_spin.c
@@ -112,6 +112,7 @@ static void spin_kick(void *data)
 
     env->halted = 0;
     env->exception_index = -1;
+    env->stopped = 0;
     qemu_cpu_kick(env);
 }
 
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 429349f..9b2e605 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -504,7 +504,7 @@ void kvm_arch_post_run(CPUState *env, struct kvm_run *run)
 
 int kvm_arch_process_async_events(CPUState *env)
 {
-    return 0;
+    return env->halted;
 }
 
 static int kvmppc_handle_halt(CPUState *env)
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:00:53 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:00:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8GY-0000bl-Ev; Sun, 05 Feb 2012 20:00:50 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8GX-0000av-RP
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:50 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-8.tower-174.messagelabs.com!1328472040!12059185!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27333 invoked from network); 5 Feb 2012 20:00:41 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 20:00:41 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8GN-0001jj-PY
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:39 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8GL-00043n-Uf
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:39 +0000
Date: Sun, 05 Feb 2012 20:00:37 +0000
Message-Id: <E1Ru8GL-00043n-Uf@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] kvm-ppc: halt secondary
	cpus when guest reset
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit adf6c527b07b1399cae990d48fa7b87113bd5083
Author: Liu Yu-B13201 <Yu.Liu@freescale.com>
Date:   Mon Nov 28 20:41:18 2011 +0000

    kvm-ppc: halt secondary cpus when guest reset
    
    When guest reset, we need to halt secondary cpus until guest kick them.
    This already works for tcg. The patch add the support for kvm.
    
    Signed-off-by: Liu Yu <yu.liu@freescale.com>
    Signed-off-by: Alexander Graf <agraf@suse.de>
    [agraf: remove in-kernel irqchip code]
    (cherry picked from commit 157feeadbaec09fe4dca539a24f6f6d327d6eeb6)
---
 hw/ppce500_spin.c |    1 +
 target-ppc/kvm.c  |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/hw/ppce500_spin.c b/hw/ppce500_spin.c
index cccd940..2b52728 100644
--- a/hw/ppce500_spin.c
+++ b/hw/ppce500_spin.c
@@ -112,6 +112,7 @@ static void spin_kick(void *data)
 
     env->halted = 0;
     env->exception_index = -1;
+    env->stopped = 0;
     qemu_cpu_kick(env);
 }
 
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 429349f..9b2e605 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -504,7 +504,7 @@ void kvm_arch_post_run(CPUState *env, struct kvm_run *run)
 
 int kvm_arch_process_async_events(CPUState *env)
 {
-    return 0;
+    return env->halted;
 }
 
 static int kvmppc_handle_halt(CPUState *env)
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:00:58 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:00:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8Gc-0000cc-HY; Sun, 05 Feb 2012 20:00:54 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Gb-0000c4-2b
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:53 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-3.tower-27.messagelabs.com!1328471995!55446363!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25437 invoked from network); 5 Feb 2012 19:59:56 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 19:59:56 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8GY-0001js-F6
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:50 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8GX-00047X-Tx
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:50 +0000
Date: Sun, 05 Feb 2012 20:00:49 +0000
Message-Id: <E1Ru8GX-00047X-Tx@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] pseries: Emit device tree
	nodes in reg order
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit e295c31e25b044acba2a48f1e7292b9fbb896367
Author: David Gibson <david@gibson.dropbear.id.au>
Date:   Mon Dec 12 18:24:32 2011 +0000

    pseries: Emit device tree nodes in reg order
    
    Although in theory the device tree has no inherent ordering, in practice
    the order of nodes in the device tree does effect the order that devices
    are detected by software.
    
    Currently the ordering is determined by the order the devices appear on
    the QEMU command line. Although that does give the user control over the
    ordering, it is fragile, especially when the user does not generate the
    command line manually - eg. when using libvirt etc.
    
    So order the device tree based on the reg value, ie. the address of on
    the VIO bus of the devices. This gives us a sane and stable ordering.
    
    Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
    Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
    Signed-off-by: Alexander Graf <agraf@suse.de>
    
    [agraf] add braces
    (cherry picked from commit 05c194384f836240ea4c2da5fa3be43a54bff021)
---
 hw/spapr_vio.c |   50 +++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 45 insertions(+), 5 deletions(-)

diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c
index 2dcc036..8bd00ca 100644
--- a/hw/spapr_vio.c
+++ b/hw/spapr_vio.c
@@ -749,21 +749,61 @@ static void spapr_vio_register_devices(void)
 device_init(spapr_vio_register_devices)
 
 #ifdef CONFIG_FDT
+static int compare_reg(const void *p1, const void *p2)
+{
+    VIOsPAPRDevice const *dev1, *dev2;
+
+    dev1 = (VIOsPAPRDevice *)*(DeviceState **)p1;
+    dev2 = (VIOsPAPRDevice *)*(DeviceState **)p2;
+
+    if (dev1->reg < dev2->reg) {
+        return -1;
+    }
+    if (dev1->reg == dev2->reg) {
+        return 0;
+    }
+
+    /* dev1->reg > dev2->reg */
+    return 1;
+}
+
 int spapr_populate_vdevice(VIOsPAPRBus *bus, void *fdt)
 {
-    DeviceState *qdev;
-    int ret = 0;
+    DeviceState *qdev, **qdevs;
+    int i, num, ret = 0;
 
+    /* Count qdevs on the bus list */
+    num = 0;
     QTAILQ_FOREACH(qdev, &bus->bus.children, sibling) {
-        VIOsPAPRDevice *dev = (VIOsPAPRDevice *)qdev;
+        num++;
+    }
+
+    /* Copy out into an array of pointers */
+    qdevs = g_malloc(sizeof(qdev) * num);
+    num = 0;
+    QTAILQ_FOREACH(qdev, &bus->bus.children, sibling) {
+        qdevs[num++] = qdev;
+    }
+
+    /* Sort the array */
+    qsort(qdevs, num, sizeof(qdev), compare_reg);
+
+    /* Hack alert. Give the devices to libfdt in reverse order, we happen
+     * to know that will mean they are in forward order in the tree. */
+    for (i = num - 1; i >= 0; i--) {
+        VIOsPAPRDevice *dev = (VIOsPAPRDevice *)(qdevs[i]);
 
         ret = vio_make_devnode(dev, fdt);
 
         if (ret < 0) {
-            return ret;
+            goto out;
         }
     }
 
-    return 0;
+    ret = 0;
+out:
+    free(qdevs);
+
+    return ret;
 }
 #endif /* CONFIG_FDT */
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:00:58 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:00:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8Gc-0000cc-HY; Sun, 05 Feb 2012 20:00:54 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Gb-0000c4-2b
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:53 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-3.tower-27.messagelabs.com!1328471995!55446363!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25437 invoked from network); 5 Feb 2012 19:59:56 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 19:59:56 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8GY-0001js-F6
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:50 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8GX-00047X-Tx
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:00:50 +0000
Date: Sun, 05 Feb 2012 20:00:49 +0000
Message-Id: <E1Ru8GX-00047X-Tx@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] pseries: Emit device tree
	nodes in reg order
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit e295c31e25b044acba2a48f1e7292b9fbb896367
Author: David Gibson <david@gibson.dropbear.id.au>
Date:   Mon Dec 12 18:24:32 2011 +0000

    pseries: Emit device tree nodes in reg order
    
    Although in theory the device tree has no inherent ordering, in practice
    the order of nodes in the device tree does effect the order that devices
    are detected by software.
    
    Currently the ordering is determined by the order the devices appear on
    the QEMU command line. Although that does give the user control over the
    ordering, it is fragile, especially when the user does not generate the
    command line manually - eg. when using libvirt etc.
    
    So order the device tree based on the reg value, ie. the address of on
    the VIO bus of the devices. This gives us a sane and stable ordering.
    
    Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
    Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
    Signed-off-by: Alexander Graf <agraf@suse.de>
    
    [agraf] add braces
    (cherry picked from commit 05c194384f836240ea4c2da5fa3be43a54bff021)
---
 hw/spapr_vio.c |   50 +++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 45 insertions(+), 5 deletions(-)

diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c
index 2dcc036..8bd00ca 100644
--- a/hw/spapr_vio.c
+++ b/hw/spapr_vio.c
@@ -749,21 +749,61 @@ static void spapr_vio_register_devices(void)
 device_init(spapr_vio_register_devices)
 
 #ifdef CONFIG_FDT
+static int compare_reg(const void *p1, const void *p2)
+{
+    VIOsPAPRDevice const *dev1, *dev2;
+
+    dev1 = (VIOsPAPRDevice *)*(DeviceState **)p1;
+    dev2 = (VIOsPAPRDevice *)*(DeviceState **)p2;
+
+    if (dev1->reg < dev2->reg) {
+        return -1;
+    }
+    if (dev1->reg == dev2->reg) {
+        return 0;
+    }
+
+    /* dev1->reg > dev2->reg */
+    return 1;
+}
+
 int spapr_populate_vdevice(VIOsPAPRBus *bus, void *fdt)
 {
-    DeviceState *qdev;
-    int ret = 0;
+    DeviceState *qdev, **qdevs;
+    int i, num, ret = 0;
 
+    /* Count qdevs on the bus list */
+    num = 0;
     QTAILQ_FOREACH(qdev, &bus->bus.children, sibling) {
-        VIOsPAPRDevice *dev = (VIOsPAPRDevice *)qdev;
+        num++;
+    }
+
+    /* Copy out into an array of pointers */
+    qdevs = g_malloc(sizeof(qdev) * num);
+    num = 0;
+    QTAILQ_FOREACH(qdev, &bus->bus.children, sibling) {
+        qdevs[num++] = qdev;
+    }
+
+    /* Sort the array */
+    qsort(qdevs, num, sizeof(qdev), compare_reg);
+
+    /* Hack alert. Give the devices to libfdt in reverse order, we happen
+     * to know that will mean they are in forward order in the tree. */
+    for (i = num - 1; i >= 0; i--) {
+        VIOsPAPRDevice *dev = (VIOsPAPRDevice *)(qdevs[i]);
 
         ret = vio_make_devnode(dev, fdt);
 
         if (ret < 0) {
-            return ret;
+            goto out;
         }
     }
 
-    return 0;
+    ret = 0;
+out:
+    free(qdevs);
+
+    return ret;
 }
 #endif /* CONFIG_FDT */
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:01:12 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:01:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8Gs-0000fp-LF; Sun, 05 Feb 2012 20:01:10 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Gr-0000eg-OE
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:09 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-3.tower-174.messagelabs.com!1328472061!12014535!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10255 invoked from network); 5 Feb 2012 20:01:02 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 20:01:02 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Gi-0001jz-UQ
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:00 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Gi-0004BB-Ko
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:00 +0000
Date: Sun, 05 Feb 2012 20:01:00 +0000
Message-Id: <E1Ru8Gi-0004BB-Ko@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] pseries: Add a routine to
	find a stable "default" vty and use it
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 447a3b347381162f9c2b1b7831643b6ee0e767ca
Author: David Gibson <david@gibson.dropbear.id.au>
Date:   Mon Dec 12 18:24:33 2011 +0000

    pseries: Add a routine to find a stable "default" vty and use it
    
    In vty_lookup() we have a special case for supporting early debug in
    the kernel. This accepts reg == 0 as a special case to mean "any vty".
    
    We implement this by searching the vtys on the bus and returning the
    first we find. This means that the vty we chose depends on the order
    the vtys are specified on the QEMU command line - because that determines
    the order of the vtys on the bus.
    
    We'd rather the command line order was irrelevant, so instead return
    the vty with the lowest reg value. This is still a guess as to what the
    user really means, but it is at least stable WRT command line ordering.
    
    Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
    Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
    Signed-off-by: Alexander Graf <agraf@suse.de>
    
    [agraf] fix braces
    (cherry picked from commit 98331f8ad6a3e2cfbb402d72e6be47eac7706251)
---
 hw/spapr_vty.c |   47 ++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 38 insertions(+), 9 deletions(-)

diff --git a/hw/spapr_vty.c b/hw/spapr_vty.c
index f23cc36..e2fec58 100644
--- a/hw/spapr_vty.c
+++ b/hw/spapr_vty.c
@@ -156,24 +156,53 @@ static VIOsPAPRDeviceInfo spapr_vty = {
     },
 };
 
+static VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus)
+{
+    VIOsPAPRDevice *sdev, *selected;
+    DeviceState *iter;
+
+    /*
+     * To avoid the console bouncing around we want one VTY to be
+     * the "default". We haven't really got anything to go on, so
+     * arbitrarily choose the one with the lowest reg value.
+     */
+
+    selected = NULL;
+    QTAILQ_FOREACH(iter, &bus->bus.children, sibling) {
+        /* Only look at VTY devices */
+        if (iter->info != &spapr_vty.qdev) {
+            continue;
+        }
+
+        sdev = DO_UPCAST(VIOsPAPRDevice, qdev, iter);
+
+        /* First VTY we've found, so it is selected for now */
+        if (!selected) {
+            selected = sdev;
+            continue;
+        }
+
+        /* Choose VTY with lowest reg value */
+        if (sdev->reg < selected->reg) {
+            selected = sdev;
+        }
+    }
+
+    return selected;
+}
+
 static VIOsPAPRDevice *vty_lookup(sPAPREnvironment *spapr, target_ulong reg)
 {
     VIOsPAPRDevice *sdev;
 
     sdev = spapr_vio_find_by_reg(spapr->vio_bus, reg);
     if (!sdev && reg == 0) {
-        DeviceState *qdev;
-
         /* Hack for kernel early debug, which always specifies reg==0.
-         * We search all VIO devices, and grab the first available vty
-         * device.  This attempts to mimic existing PowerVM behaviour
+         * We search all VIO devices, and grab the vty with the lowest
+         * reg.  This attempts to mimic existing PowerVM behaviour
          * (early debug does work there, despite having no vty with
          * reg==0. */
-        QTAILQ_FOREACH(qdev, &spapr->vio_bus->bus.children, sibling) {
-            if (qdev->info == &spapr_vty.qdev) {
-                return DO_UPCAST(VIOsPAPRDevice, qdev, qdev);
-            }
-        }
+        return spapr_vty_get_default(spapr->vio_bus);
     }
 
     return sdev;
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:01:12 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:01:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8Gs-0000fp-LF; Sun, 05 Feb 2012 20:01:10 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Gr-0000eg-OE
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:09 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-3.tower-174.messagelabs.com!1328472061!12014535!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10255 invoked from network); 5 Feb 2012 20:01:02 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 20:01:02 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Gi-0001jz-UQ
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:00 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Gi-0004BB-Ko
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:00 +0000
Date: Sun, 05 Feb 2012 20:01:00 +0000
Message-Id: <E1Ru8Gi-0004BB-Ko@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] pseries: Add a routine to
	find a stable "default" vty and use it
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 447a3b347381162f9c2b1b7831643b6ee0e767ca
Author: David Gibson <david@gibson.dropbear.id.au>
Date:   Mon Dec 12 18:24:33 2011 +0000

    pseries: Add a routine to find a stable "default" vty and use it
    
    In vty_lookup() we have a special case for supporting early debug in
    the kernel. This accepts reg == 0 as a special case to mean "any vty".
    
    We implement this by searching the vtys on the bus and returning the
    first we find. This means that the vty we chose depends on the order
    the vtys are specified on the QEMU command line - because that determines
    the order of the vtys on the bus.
    
    We'd rather the command line order was irrelevant, so instead return
    the vty with the lowest reg value. This is still a guess as to what the
    user really means, but it is at least stable WRT command line ordering.
    
    Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
    Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
    Signed-off-by: Alexander Graf <agraf@suse.de>
    
    [agraf] fix braces
    (cherry picked from commit 98331f8ad6a3e2cfbb402d72e6be47eac7706251)
---
 hw/spapr_vty.c |   47 ++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 38 insertions(+), 9 deletions(-)

diff --git a/hw/spapr_vty.c b/hw/spapr_vty.c
index f23cc36..e2fec58 100644
--- a/hw/spapr_vty.c
+++ b/hw/spapr_vty.c
@@ -156,24 +156,53 @@ static VIOsPAPRDeviceInfo spapr_vty = {
     },
 };
 
+static VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus)
+{
+    VIOsPAPRDevice *sdev, *selected;
+    DeviceState *iter;
+
+    /*
+     * To avoid the console bouncing around we want one VTY to be
+     * the "default". We haven't really got anything to go on, so
+     * arbitrarily choose the one with the lowest reg value.
+     */
+
+    selected = NULL;
+    QTAILQ_FOREACH(iter, &bus->bus.children, sibling) {
+        /* Only look at VTY devices */
+        if (iter->info != &spapr_vty.qdev) {
+            continue;
+        }
+
+        sdev = DO_UPCAST(VIOsPAPRDevice, qdev, iter);
+
+        /* First VTY we've found, so it is selected for now */
+        if (!selected) {
+            selected = sdev;
+            continue;
+        }
+
+        /* Choose VTY with lowest reg value */
+        if (sdev->reg < selected->reg) {
+            selected = sdev;
+        }
+    }
+
+    return selected;
+}
+
 static VIOsPAPRDevice *vty_lookup(sPAPREnvironment *spapr, target_ulong reg)
 {
     VIOsPAPRDevice *sdev;
 
     sdev = spapr_vio_find_by_reg(spapr->vio_bus, reg);
     if (!sdev && reg == 0) {
-        DeviceState *qdev;
-
         /* Hack for kernel early debug, which always specifies reg==0.
-         * We search all VIO devices, and grab the first available vty
-         * device.  This attempts to mimic existing PowerVM behaviour
+         * We search all VIO devices, and grab the vty with the lowest
+         * reg.  This attempts to mimic existing PowerVM behaviour
          * (early debug does work there, despite having no vty with
          * reg==0. */
-        QTAILQ_FOREACH(qdev, &spapr->vio_bus->bus.children, sibling) {
-            if (qdev->info == &spapr_vty.qdev) {
-                return DO_UPCAST(VIOsPAPRDevice, qdev, qdev);
-            }
-        }
+        return spapr_vty_get_default(spapr->vio_bus);
     }
 
     return sdev;
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:01:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:01:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8H3-0000iK-OY; Sun, 05 Feb 2012 20:01:21 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8H2-0000hD-My
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:20 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-5.tower-21.messagelabs.com!1328472072!4119319!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23043 invoked from network); 5 Feb 2012 20:01:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 20:01:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Gu-0001kZ-0K
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Gt-0004Eg-1n
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:11 +0000
Date: Sun, 05 Feb 2012 20:01:11 +0000
Message-Id: <E1Ru8Gt-0004Eg-1n@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] pseries: Populate
	"/chosen/linux, stdout-path" in the FDT
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 7a6d80e93cb461a985ffb64bc4d19dd5f726386b
Author: David Gibson <david@gibson.dropbear.id.au>
Date:   Tue Dec 13 15:24:34 2011 +1100

    pseries: Populate "/chosen/linux,stdout-path" in the FDT
    
    There is a device tree property "/chosen/linux,stdout-path" which indicates
    which device should be used as stdout - ie. "the console".
    
    Currently we don't specify anything, which means both firmware and Linux
    choose something arbitrarily. Use the routine we added in the last patch
    to pick a default vty and specify it as stdout.
    
    Currently SLOF doesn't use the property, but we are hoping to update it
    to do so.
    
    Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
    Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
    Signed-off-by: Alexander Graf <agraf@suse.de>
    (cherry picked from commit 68f3a94c64bbaaf8c7f2daa70de1b5d87a432f86)
---
 hw/spapr.c     |    2 ++
 hw/spapr_vio.c |   34 ++++++++++++++++++++++++++++++++++
 hw/spapr_vio.h |    3 +++
 hw/spapr_vty.c |    2 +-
 4 files changed, 40 insertions(+), 1 deletions(-)

diff --git a/hw/spapr.c b/hw/spapr.c
index 2b901f1..5a98d86 100644
--- a/hw/spapr.c
+++ b/hw/spapr.c
@@ -351,6 +351,8 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr,
         fprintf(stderr, "Couldn't set up RTAS device tree properties\n");
     }
 
+    spapr_populate_chosen_stdout(fdt, spapr->vio_bus);
+
     _FDT((fdt_pack(fdt)));
 
     cpu_physical_memory_write(fdt_addr, fdt, fdt_totalsize(fdt));
diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c
index 8bd00ca..464fe87 100644
--- a/hw/spapr_vio.c
+++ b/hw/spapr_vio.c
@@ -806,4 +806,38 @@ out:
 
     return ret;
 }
+
+int spapr_populate_chosen_stdout(void *fdt, VIOsPAPRBus *bus)
+{
+    VIOsPAPRDevice *dev;
+    char *name, *path;
+    int ret, offset;
+
+    dev = spapr_vty_get_default(bus);
+    if (!dev)
+        return 0;
+
+    offset = fdt_path_offset(fdt, "/chosen");
+    if (offset < 0) {
+        return offset;
+    }
+
+    name = vio_format_dev_name(dev);
+    if (!name) {
+        return -ENOMEM;
+    }
+
+    if (asprintf(&path, "/vdevice/%s", name) < 0) {
+        path = NULL;
+        ret = -ENOMEM;
+        goto out;
+    }
+
+    ret = fdt_setprop_string(fdt, offset, "linux,stdout-path", path);
+out:
+    free(name);
+    free(path);
+
+    return ret;
+}
 #endif /* CONFIG_FDT */
diff --git a/hw/spapr_vio.h b/hw/spapr_vio.h
index a325a5f..9fcd304 100644
--- a/hw/spapr_vio.h
+++ b/hw/spapr_vio.h
@@ -83,6 +83,7 @@ extern VIOsPAPRBus *spapr_vio_bus_init(void);
 extern VIOsPAPRDevice *spapr_vio_find_by_reg(VIOsPAPRBus *bus, uint32_t reg);
 extern void spapr_vio_bus_register_withprop(VIOsPAPRDeviceInfo *info);
 extern int spapr_populate_vdevice(VIOsPAPRBus *bus, void *fdt);
+extern int spapr_populate_chosen_stdout(void *fdt, VIOsPAPRBus *bus);
 
 extern int spapr_vio_signal(VIOsPAPRDevice *dev, target_ulong mode);
 
@@ -108,6 +109,8 @@ void spapr_vty_create(VIOsPAPRBus *bus, uint32_t reg, CharDriverState *chardev);
 void spapr_vlan_create(VIOsPAPRBus *bus, uint32_t reg, NICInfo *nd);
 void spapr_vscsi_create(VIOsPAPRBus *bus, uint32_t reg);
 
+VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus);
+
 int spapr_tce_set_bypass(uint32_t unit, uint32_t enable);
 void spapr_vio_quiesce(void);
 
diff --git a/hw/spapr_vty.c b/hw/spapr_vty.c
index e2fec58..386ccf7 100644
--- a/hw/spapr_vty.c
+++ b/hw/spapr_vty.c
@@ -156,7 +156,7 @@ static VIOsPAPRDeviceInfo spapr_vty = {
     },
 };
 
-static VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus)
+VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus)
 {
     VIOsPAPRDevice *sdev, *selected;
     DeviceState *iter;
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:01:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:01:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8H3-0000iK-OY; Sun, 05 Feb 2012 20:01:21 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8H2-0000hD-My
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:20 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-5.tower-21.messagelabs.com!1328472072!4119319!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23043 invoked from network); 5 Feb 2012 20:01:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 20:01:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Gu-0001kZ-0K
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Gt-0004Eg-1n
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:11 +0000
Date: Sun, 05 Feb 2012 20:01:11 +0000
Message-Id: <E1Ru8Gt-0004Eg-1n@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] pseries: Populate
	"/chosen/linux, stdout-path" in the FDT
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 7a6d80e93cb461a985ffb64bc4d19dd5f726386b
Author: David Gibson <david@gibson.dropbear.id.au>
Date:   Tue Dec 13 15:24:34 2011 +1100

    pseries: Populate "/chosen/linux,stdout-path" in the FDT
    
    There is a device tree property "/chosen/linux,stdout-path" which indicates
    which device should be used as stdout - ie. "the console".
    
    Currently we don't specify anything, which means both firmware and Linux
    choose something arbitrarily. Use the routine we added in the last patch
    to pick a default vty and specify it as stdout.
    
    Currently SLOF doesn't use the property, but we are hoping to update it
    to do so.
    
    Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
    Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
    Signed-off-by: Alexander Graf <agraf@suse.de>
    (cherry picked from commit 68f3a94c64bbaaf8c7f2daa70de1b5d87a432f86)
---
 hw/spapr.c     |    2 ++
 hw/spapr_vio.c |   34 ++++++++++++++++++++++++++++++++++
 hw/spapr_vio.h |    3 +++
 hw/spapr_vty.c |    2 +-
 4 files changed, 40 insertions(+), 1 deletions(-)

diff --git a/hw/spapr.c b/hw/spapr.c
index 2b901f1..5a98d86 100644
--- a/hw/spapr.c
+++ b/hw/spapr.c
@@ -351,6 +351,8 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr,
         fprintf(stderr, "Couldn't set up RTAS device tree properties\n");
     }
 
+    spapr_populate_chosen_stdout(fdt, spapr->vio_bus);
+
     _FDT((fdt_pack(fdt)));
 
     cpu_physical_memory_write(fdt_addr, fdt, fdt_totalsize(fdt));
diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c
index 8bd00ca..464fe87 100644
--- a/hw/spapr_vio.c
+++ b/hw/spapr_vio.c
@@ -806,4 +806,38 @@ out:
 
     return ret;
 }
+
+int spapr_populate_chosen_stdout(void *fdt, VIOsPAPRBus *bus)
+{
+    VIOsPAPRDevice *dev;
+    char *name, *path;
+    int ret, offset;
+
+    dev = spapr_vty_get_default(bus);
+    if (!dev)
+        return 0;
+
+    offset = fdt_path_offset(fdt, "/chosen");
+    if (offset < 0) {
+        return offset;
+    }
+
+    name = vio_format_dev_name(dev);
+    if (!name) {
+        return -ENOMEM;
+    }
+
+    if (asprintf(&path, "/vdevice/%s", name) < 0) {
+        path = NULL;
+        ret = -ENOMEM;
+        goto out;
+    }
+
+    ret = fdt_setprop_string(fdt, offset, "linux,stdout-path", path);
+out:
+    free(name);
+    free(path);
+
+    return ret;
+}
 #endif /* CONFIG_FDT */
diff --git a/hw/spapr_vio.h b/hw/spapr_vio.h
index a325a5f..9fcd304 100644
--- a/hw/spapr_vio.h
+++ b/hw/spapr_vio.h
@@ -83,6 +83,7 @@ extern VIOsPAPRBus *spapr_vio_bus_init(void);
 extern VIOsPAPRDevice *spapr_vio_find_by_reg(VIOsPAPRBus *bus, uint32_t reg);
 extern void spapr_vio_bus_register_withprop(VIOsPAPRDeviceInfo *info);
 extern int spapr_populate_vdevice(VIOsPAPRBus *bus, void *fdt);
+extern int spapr_populate_chosen_stdout(void *fdt, VIOsPAPRBus *bus);
 
 extern int spapr_vio_signal(VIOsPAPRDevice *dev, target_ulong mode);
 
@@ -108,6 +109,8 @@ void spapr_vty_create(VIOsPAPRBus *bus, uint32_t reg, CharDriverState *chardev);
 void spapr_vlan_create(VIOsPAPRBus *bus, uint32_t reg, NICInfo *nd);
 void spapr_vscsi_create(VIOsPAPRBus *bus, uint32_t reg);
 
+VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus);
+
 int spapr_tce_set_bypass(uint32_t unit, uint32_t enable);
 void spapr_vio_quiesce(void);
 
diff --git a/hw/spapr_vty.c b/hw/spapr_vty.c
index e2fec58..386ccf7 100644
--- a/hw/spapr_vty.c
+++ b/hw/spapr_vty.c
@@ -156,7 +156,7 @@ static VIOsPAPRDeviceInfo spapr_vty = {
     },
 };
 
-static VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus)
+VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus)
 {
     VIOsPAPRDevice *sdev, *selected;
     DeviceState *iter;
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:01:33 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:01:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8HC-0000k4-Rs; Sun, 05 Feb 2012 20:01:30 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8HC-0000j2-3o
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:30 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-16.tower-174.messagelabs.com!1328472082!11911789!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27733 invoked from network); 5 Feb 2012 20:01:23 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 20:01:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8H4-0001kf-Cz
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:22 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8H4-0004IP-3w
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:22 +0000
Date: Sun, 05 Feb 2012 20:01:22 +0000
Message-Id: <E1Ru8H4-0004IP-3w@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] pseries: Don't try to
	munmap() a malloc()ed TCE table
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit d928541b51731a185214924cc5b44cd28020fa4f
Author: David Gibson <david@gibson.dropbear.id.au>
Date:   Wed Jan 11 19:46:27 2012 +0000

    pseries: Don't try to munmap() a malloc()ed TCE table
    
    For the pseries machine, TCE (IOMMU) tables can either be directly
    malloc()ed in qemu or, when running on a KVM which supports it, mmap()ed
    from a KVM ioctl.  The latter option is used when available, because it
    allows the (frequent bottlenext) H_PUT_TCE hypercall to be KVM accelerated.
    However, even when KVM is persent, TCE acceleration is not always possible.
    Only KVM HV supports this ioctl(), not KVM PR, or the kernel could run out
    of contiguous memory to allocate the new table.  In this case we need to
    fall back on the malloc()ed table.
    
    When a device is removed, and we need to remove the TCE table, we need to
    either munmap() or free() the table as appropriate for how it was
    allocated.  The code is supposed to do that, but we buggily fail to
    initialize the tcet->fd variable in the malloc() case, which is used as a
    flag to determine which is the right choice.
    
    This patch fixes the bug, and cleans up error messages relating to this
    path while we're at it.
    
    Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
    Signed-off-by: Alexander Graf <agraf@suse.de>
---
 target-ppc/kvm.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 9b2e605..0410901 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -838,12 +838,18 @@ void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd)
     int fd;
     void *table;
 
+    /* Must set fd to -1 so we don't try to munmap when called for
+     * destroying the table, which the upper layers -will- do
+     */
+    *pfd = -1;
     if (!cap_spapr_tce) {
         return NULL;
     }
 
     fd = kvm_vm_ioctl(kvm_state, KVM_CREATE_SPAPR_TCE, &args);
     if (fd < 0) {
+        fprintf(stderr, "KVM: Failed to create TCE table for liobn 0x%x\n",
+                liobn);
         return NULL;
     }
 
@@ -852,6 +858,8 @@ void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd)
 
     table = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
     if (table == MAP_FAILED) {
+        fprintf(stderr, "KVM: Failed to map TCE table for liobn 0x%x\n",
+                liobn);
         close(fd);
         return NULL;
     }
@@ -871,8 +879,8 @@ int kvmppc_remove_spapr_tce(void *table, int fd, uint32_t window_size)
     len = (window_size / SPAPR_VIO_TCE_PAGE_SIZE)*sizeof(VIOsPAPR_RTCE);
     if ((munmap(table, len) < 0) ||
         (close(fd) < 0)) {
-        fprintf(stderr, "KVM: Unexpected error removing KVM SPAPR TCE "
-                "table: %s", strerror(errno));
+        fprintf(stderr, "KVM: Unexpected error removing TCE table: %s",
+                strerror(errno));
         /* Leak the table */
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:01:33 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:01:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8HC-0000k4-Rs; Sun, 05 Feb 2012 20:01:30 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8HC-0000j2-3o
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:30 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-16.tower-174.messagelabs.com!1328472082!11911789!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27733 invoked from network); 5 Feb 2012 20:01:23 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 20:01:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8H4-0001kf-Cz
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:22 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8H4-0004IP-3w
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:22 +0000
Date: Sun, 05 Feb 2012 20:01:22 +0000
Message-Id: <E1Ru8H4-0004IP-3w@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] pseries: Don't try to
	munmap() a malloc()ed TCE table
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit d928541b51731a185214924cc5b44cd28020fa4f
Author: David Gibson <david@gibson.dropbear.id.au>
Date:   Wed Jan 11 19:46:27 2012 +0000

    pseries: Don't try to munmap() a malloc()ed TCE table
    
    For the pseries machine, TCE (IOMMU) tables can either be directly
    malloc()ed in qemu or, when running on a KVM which supports it, mmap()ed
    from a KVM ioctl.  The latter option is used when available, because it
    allows the (frequent bottlenext) H_PUT_TCE hypercall to be KVM accelerated.
    However, even when KVM is persent, TCE acceleration is not always possible.
    Only KVM HV supports this ioctl(), not KVM PR, or the kernel could run out
    of contiguous memory to allocate the new table.  In this case we need to
    fall back on the malloc()ed table.
    
    When a device is removed, and we need to remove the TCE table, we need to
    either munmap() or free() the table as appropriate for how it was
    allocated.  The code is supposed to do that, but we buggily fail to
    initialize the tcet->fd variable in the malloc() case, which is used as a
    flag to determine which is the right choice.
    
    This patch fixes the bug, and cleans up error messages relating to this
    path while we're at it.
    
    Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
    Signed-off-by: Alexander Graf <agraf@suse.de>
---
 target-ppc/kvm.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 9b2e605..0410901 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -838,12 +838,18 @@ void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd)
     int fd;
     void *table;
 
+    /* Must set fd to -1 so we don't try to munmap when called for
+     * destroying the table, which the upper layers -will- do
+     */
+    *pfd = -1;
     if (!cap_spapr_tce) {
         return NULL;
     }
 
     fd = kvm_vm_ioctl(kvm_state, KVM_CREATE_SPAPR_TCE, &args);
     if (fd < 0) {
+        fprintf(stderr, "KVM: Failed to create TCE table for liobn 0x%x\n",
+                liobn);
         return NULL;
     }
 
@@ -852,6 +858,8 @@ void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd)
 
     table = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
     if (table == MAP_FAILED) {
+        fprintf(stderr, "KVM: Failed to map TCE table for liobn 0x%x\n",
+                liobn);
         close(fd);
         return NULL;
     }
@@ -871,8 +879,8 @@ int kvmppc_remove_spapr_tce(void *table, int fd, uint32_t window_size)
     len = (window_size / SPAPR_VIO_TCE_PAGE_SIZE)*sizeof(VIOsPAPR_RTCE);
     if ((munmap(table, len) < 0) ||
         (close(fd) < 0)) {
-        fprintf(stderr, "KVM: Unexpected error removing KVM SPAPR TCE "
-                "table: %s", strerror(errno));
+        fprintf(stderr, "KVM: Unexpected error removing TCE table: %s",
+                strerror(errno));
         /* Leak the table */
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:01:50 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:01:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8HT-0000n5-1K; Sun, 05 Feb 2012 20:01:47 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8HS-0000m9-16
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:46 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-13.tower-21.messagelabs.com!1328472094!11508450!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24920 invoked from network); 5 Feb 2012 20:01:37 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 20:01:37 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8HG-0001ks-2Z
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:34 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8HE-0004M0-Gs
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:33 +0000
Date: Sun, 05 Feb 2012 20:01:32 +0000
Message-Id: <E1Ru8HE-0004M0-Gs@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] Merge branch 'ppc-1.0' of
	git://repo.or.cz/qemu/agraf
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 102dd9167c121d09c78d6b98da0ff8ed1001590a
Merge: d0ed2d2e8e863a9a64c9fc9c08fa68bee546ad00 d928541b51731a185214924cc5b44cd28020fa4f
Author: Justin M. Forbes <jforbes@redhat.com>
Date:   Wed Feb 1 11:24:47 2012 -0600

    Merge branch 'ppc-1.0' of git://repo.or.cz/qemu/agraf

 console.c         |    4 ++-
 hw/ppce500_spin.c |    1 +
 hw/spapr.c        |    2 +
 hw/spapr_pci.c    |    2 +-
 hw/spapr_vio.c    |   84 +++++++++++++++++++++++++++++++++++++++++++++++++---
 hw/spapr_vio.h    |    3 ++
 hw/spapr_vty.c    |   47 ++++++++++++++++++++++++------
 target-ppc/kvm.c  |   14 +++++++--
 8 files changed, 138 insertions(+), 19 deletions(-)
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:01:50 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:01:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8HT-0000n5-1K; Sun, 05 Feb 2012 20:01:47 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8HS-0000m9-16
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:46 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-13.tower-21.messagelabs.com!1328472094!11508450!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24920 invoked from network); 5 Feb 2012 20:01:37 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 20:01:37 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8HG-0001ks-2Z
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:34 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8HE-0004M0-Gs
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:33 +0000
Date: Sun, 05 Feb 2012 20:01:32 +0000
Message-Id: <E1Ru8HE-0004M0-Gs@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] Merge branch 'ppc-1.0' of
	git://repo.or.cz/qemu/agraf
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 102dd9167c121d09c78d6b98da0ff8ed1001590a
Merge: d0ed2d2e8e863a9a64c9fc9c08fa68bee546ad00 d928541b51731a185214924cc5b44cd28020fa4f
Author: Justin M. Forbes <jforbes@redhat.com>
Date:   Wed Feb 1 11:24:47 2012 -0600

    Merge branch 'ppc-1.0' of git://repo.or.cz/qemu/agraf

 console.c         |    4 ++-
 hw/ppce500_spin.c |    1 +
 hw/spapr.c        |    2 +
 hw/spapr_pci.c    |    2 +-
 hw/spapr_vio.c    |   84 +++++++++++++++++++++++++++++++++++++++++++++++++---
 hw/spapr_vio.h    |    3 ++
 hw/spapr_vty.c    |   47 ++++++++++++++++++++++++------
 target-ppc/kvm.c  |   14 +++++++--
 8 files changed, 138 insertions(+), 19 deletions(-)
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:01:56 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:01:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8Ha-0000p9-4Q; Sun, 05 Feb 2012 20:01:54 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8HZ-0000nL-2n
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:53 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-9.tower-182.messagelabs.com!1328472105!13163899!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9729 invoked from network); 5 Feb 2012 20:01:46 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 20:01:46 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8HR-0001ky-9a
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:45 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8HR-0004RI-25
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:45 +0000
Date: Sun, 05 Feb 2012 20:01:45 +0000
Message-Id: <E1Ru8HR-0004RI-25@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] s390x: add TR function for
	EXECUTE
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 8a0a9cf35bd1abc7a9a11f430a6b14e034f34ba0
Author: Alexander Graf <agraf@suse.de>
Date:   Fri Nov 18 16:45:54 2011 +0100

    s390x: add TR function for EXECUTE
    
    Newer gcc versions (or glibc?) also generate code that tries to EXECUTE
    the TR opcode. Implement it so that we don't break valid guests.
    
    Reported-by: Andreas Faerber <afaerber@suse.de>
    Signed-off-by: Alexander Graf <agraf@suse.de>
---
 target-s390x/op_helper.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/target-s390x/op_helper.c b/target-s390x/op_helper.c
index 137bae7..5ddc7b9 100644
--- a/target-s390x/op_helper.c
+++ b/target-s390x/op_helper.c
@@ -636,6 +636,9 @@ uint32_t HELPER(ex)(uint32_t cc, uint64_t v1, uint64_t addr, uint64_t ret)
         case 0x700:
             cc = helper_xc(l, get_address(0, b1, d1), get_address(0, b2, d2));
             break;
+        case 0xc00:
+            helper_tr(l, get_address(0, b1, d1), get_address(0, b2, d2));
+            break;
         default:
             goto abort;
             break;
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:01:56 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:01:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8Ha-0000p9-4Q; Sun, 05 Feb 2012 20:01:54 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8HZ-0000nL-2n
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:53 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-9.tower-182.messagelabs.com!1328472105!13163899!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9729 invoked from network); 5 Feb 2012 20:01:46 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 20:01:46 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8HR-0001ky-9a
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:45 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8HR-0004RI-25
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:45 +0000
Date: Sun, 05 Feb 2012 20:01:45 +0000
Message-Id: <E1Ru8HR-0004RI-25@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] s390x: add TR function for
	EXECUTE
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 8a0a9cf35bd1abc7a9a11f430a6b14e034f34ba0
Author: Alexander Graf <agraf@suse.de>
Date:   Fri Nov 18 16:45:54 2011 +0100

    s390x: add TR function for EXECUTE
    
    Newer gcc versions (or glibc?) also generate code that tries to EXECUTE
    the TR opcode. Implement it so that we don't break valid guests.
    
    Reported-by: Andreas Faerber <afaerber@suse.de>
    Signed-off-by: Alexander Graf <agraf@suse.de>
---
 target-s390x/op_helper.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/target-s390x/op_helper.c b/target-s390x/op_helper.c
index 137bae7..5ddc7b9 100644
--- a/target-s390x/op_helper.c
+++ b/target-s390x/op_helper.c
@@ -636,6 +636,9 @@ uint32_t HELPER(ex)(uint32_t cc, uint64_t v1, uint64_t addr, uint64_t ret)
         case 0x700:
             cc = helper_xc(l, get_address(0, b1, d1), get_address(0, b2, d2));
             break;
+        case 0xc00:
+            helper_tr(l, get_address(0, b1, d1), get_address(0, b2, d2));
+            break;
         default:
             goto abort;
             break;
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:02:06 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:02:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8Hl-0000s7-7Q; Sun, 05 Feb 2012 20:02:05 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Hj-0000qa-R9
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:02:04 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-11.tower-182.messagelabs.com!1328472116!13761880!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18602 invoked from network); 5 Feb 2012 20:01:57 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 20:01:57 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Hb-0001l5-PY
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:55 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Hb-0004Uq-DE
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:55 +0000
Date: Sun, 05 Feb 2012 20:01:55 +0000
Message-Id: <E1Ru8Hb-0004Uq-DE@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] s390: fix cpu hotplug /
	cpu activity on interrupts
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit d194ba1cdbeee54166845b75f9186a8e401e5f07
Author: Christian Borntraeger <borntraeger@de.ibm.com>
Date:   Sun Nov 20 23:12:03 2011 +0000

    s390: fix cpu hotplug / cpu activity on interrupts
    
    The add_del/running_cpu code and env->halted are tracking stopped cpus.
    Sleeping cpus (idle and enabled for interrupts) are waiting inside the
    kernel.
    No interrupt besides the restart can move a cpu from stopped to
    operational. This is already handled over there. So lets just remove
    the bogus wakup from the common interrupt delivery, otherwise any
    interrupt will wake up a cpu, even if this cpu is stopped (Thus leading
    to strange hangs on sigp restart)
    
    This fixes
    echo 0 > /sys/devices/system/cpu/cpu0/online
    echo 1 > /sys/devices/system/cpu/cpu0/online
    in the guest
    
    Signed-off-by: Christian Borntraeger<borntraeger@de.ibm.com>
    Signed-off-by: Alexander Graf <agraf@suse.de>
    (cherry picked from commit 93116ac0cf9734e7b28886aedf03848b37d6785e)
---
 target-s390x/kvm.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index 40b0ab1..b1404bf 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -185,9 +185,6 @@ void kvm_s390_interrupt_internal(CPUState *env, int type, uint32_t parm,
         return;
     }
 
-    s390_add_running_cpu(env);
-    qemu_cpu_kick(env);
-
     kvmint.type = type;
     kvmint.parm = parm;
     kvmint.parm64 = parm64;
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:02:06 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:02:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8Hl-0000s7-7Q; Sun, 05 Feb 2012 20:02:05 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Hj-0000qa-R9
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:02:04 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-11.tower-182.messagelabs.com!1328472116!13761880!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18602 invoked from network); 5 Feb 2012 20:01:57 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 20:01:57 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Hb-0001l5-PY
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:55 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Hb-0004Uq-DE
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:01:55 +0000
Date: Sun, 05 Feb 2012 20:01:55 +0000
Message-Id: <E1Ru8Hb-0004Uq-DE@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] s390: fix cpu hotplug /
	cpu activity on interrupts
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit d194ba1cdbeee54166845b75f9186a8e401e5f07
Author: Christian Borntraeger <borntraeger@de.ibm.com>
Date:   Sun Nov 20 23:12:03 2011 +0000

    s390: fix cpu hotplug / cpu activity on interrupts
    
    The add_del/running_cpu code and env->halted are tracking stopped cpus.
    Sleeping cpus (idle and enabled for interrupts) are waiting inside the
    kernel.
    No interrupt besides the restart can move a cpu from stopped to
    operational. This is already handled over there. So lets just remove
    the bogus wakup from the common interrupt delivery, otherwise any
    interrupt will wake up a cpu, even if this cpu is stopped (Thus leading
    to strange hangs on sigp restart)
    
    This fixes
    echo 0 > /sys/devices/system/cpu/cpu0/online
    echo 1 > /sys/devices/system/cpu/cpu0/online
    in the guest
    
    Signed-off-by: Christian Borntraeger<borntraeger@de.ibm.com>
    Signed-off-by: Alexander Graf <agraf@suse.de>
    (cherry picked from commit 93116ac0cf9734e7b28886aedf03848b37d6785e)
---
 target-s390x/kvm.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index 40b0ab1..b1404bf 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -185,9 +185,6 @@ void kvm_s390_interrupt_internal(CPUState *env, int type, uint32_t parm,
         return;
     }
 
-    s390_add_running_cpu(env);
-    qemu_cpu_kick(env);
-
     kvmint.type = type;
     kvmint.parm = parm;
     kvmint.parm64 = parm64;
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:02:17 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:02:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8Hx-0000um-BL; Sun, 05 Feb 2012 20:02:17 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Hw-0000tV-4W
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:02:16 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-4.tower-216.messagelabs.com!1328472128!14031536!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5930 invoked from network); 5 Feb 2012 20:02:09 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 20:02:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Ho-0001lg-5J
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:02:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Hl-0004YP-Vm
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:02:08 +0000
Date: Sun, 05 Feb 2012 20:02:05 +0000
Message-Id: <E1Ru8Hl-0004YP-Vm@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] Merge branch 's390-1.0' of
	git://repo.or.cz/qemu/agraf
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 86a8d63bc11431509506b95c1481e1a023302cbc
Merge: 102dd9167c121d09c78d6b98da0ff8ed1001590a d194ba1cdbeee54166845b75f9186a8e401e5f07
Author: Justin M. Forbes <jforbes@redhat.com>
Date:   Wed Feb 1 11:25:23 2012 -0600

    Merge branch 's390-1.0' of git://repo.or.cz/qemu/agraf

 target-s390x/kvm.c       |    3 ---
 target-s390x/op_helper.c |    3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Sun Feb 05 20:02:17 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2012 20:02:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ru8Hx-0000um-BL; Sun, 05 Feb 2012 20:02:17 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Hw-0000tV-4W
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:02:16 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-4.tower-216.messagelabs.com!1328472128!14031536!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5930 invoked from network); 5 Feb 2012 20:02:09 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Feb 2012 20:02:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Ho-0001lg-5J
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:02:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Ru8Hl-0004YP-Vm
	for xen-changelog@lists.xensource.com; Sun, 05 Feb 2012 20:02:08 +0000
Date: Sun, 05 Feb 2012 20:02:05 +0000
Message-Id: <E1Ru8Hl-0004YP-Vm@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] Merge branch 's390-1.0' of
	git://repo.or.cz/qemu/agraf
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 86a8d63bc11431509506b95c1481e1a023302cbc
Merge: 102dd9167c121d09c78d6b98da0ff8ed1001590a d194ba1cdbeee54166845b75f9186a8e401e5f07
Author: Justin M. Forbes <jforbes@redhat.com>
Date:   Wed Feb 1 11:25:23 2012 -0600

    Merge branch 's390-1.0' of git://repo.or.cz/qemu/agraf

 target-s390x/kvm.c       |    3 ---
 target-s390x/op_helper.c |    3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Mon Feb 06 22:44:26 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 06 Feb 2012 22:44:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RuXII-0004iM-1f; Mon, 06 Feb 2012 22:44:18 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RuXIG-0004i7-En
	for xen-changelog@lists.xensource.com; Mon, 06 Feb 2012 22:44:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1328568249!2420952!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28400 invoked from network); 6 Feb 2012 22:44:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Feb 2012 22:44:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RuXI8-00050f-Q9
	for xen-changelog@lists.xensource.com; Mon, 06 Feb 2012 22:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RuXI8-0007gt-8O
	for xen-changelog@lists.xensource.com; Mon, 06 Feb 2012 22:44:08 +0000
Message-Id: <E1RuXI8-0007gt-8O@xenbits.xen.org>
Date: Mon, 06 Feb 2012 22:44:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] ia64: fix build (next instance)
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328546405 -3600
# Node ID 158f9c38d95c19667057beccf35a9d7f704d0df5
# Parent  3432abcf9380d3840ca38439a304f74a37d155fc
ia64: fix build (next instance)

A number of build problems crept in once again. Fix them.

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


diff -r 3432abcf9380 -r 158f9c38d95c xen/common/memory.c
--- a/xen/common/memory.c	Thu Feb 02 15:47:26 2012 +0000
+++ b/xen/common/memory.c	Mon Feb 06 17:40:05 2012 +0100
@@ -683,7 +683,7 @@
         mfn = get_gfn_untyped(d, xrfp.gpfn);
 
         if ( mfn_valid(mfn) )
-            guest_physmap_remove_page(d, xrfp.gpfn, mfn, PAGE_ORDER_4K);
+            guest_physmap_remove_page(d, xrfp.gpfn, mfn, 0);
         else
             rc = -ENOENT;
 
diff -r 3432abcf9380 -r 158f9c38d95c xen/include/asm-ia64/linux-xen/asm/irq.h
--- a/xen/include/asm-ia64/linux-xen/asm/irq.h	Thu Feb 02 15:47:26 2012 +0000
+++ b/xen/include/asm-ia64/linux-xen/asm/irq.h	Mon Feb 06 17:40:05 2012 +0100
@@ -72,7 +72,7 @@
 #define irq_complete_move(x) do {} \
     while(!x)
 
-#define domain_pirq_to_irq(d, irq) domain_irq_to_vector(d, irq)
+#define domain_pirq_to_irq(d, irq) (irq) /* domain_irq_to_vector(d, irq) */
 
 #define hvm_domain_use_pirq(d, info) 0
 #endif
diff -r 3432abcf9380 -r 158f9c38d95c xen/include/asm-ia64/linux-xen/asm/processor.h
--- a/xen/include/asm-ia64/linux-xen/asm/processor.h	Thu Feb 02 15:47:26 2012 +0000
+++ b/xen/include/asm-ia64/linux-xen/asm/processor.h	Mon Feb 06 17:40:05 2012 +0100
@@ -17,7 +17,12 @@
 
 #include <asm/intrinsics.h>
 #include <asm/kregs.h>
+#if !defined(XEN)
 #include <asm/ptrace.h>
+#elif !defined(__ASSEMBLY__)
+struct cpu_user_regs;
+#define pt_regs cpu_user_regs
+#endif
 #include <asm/ustack.h>
 
 /* Our arch specific arch_init_sched_domain is in arch/ia64/kernel/domain.c */
@@ -783,4 +788,8 @@
 
 #endif /* !__ASSEMBLY__ */
 
+#ifdef XEN
+#include <asm/ptrace.h>
+#endif
+
 #endif /* _ASM_IA64_PROCESSOR_H */
diff -r 3432abcf9380 -r 158f9c38d95c xen/include/xen/list.h
--- a/xen/include/xen/list.h	Thu Feb 02 15:47:26 2012 +0000
+++ b/xen/include/xen/list.h	Mon Feb 06 17:40:05 2012 +0100
@@ -8,7 +8,6 @@
 #define __XEN_LIST_H__
 
 #include <xen/lib.h>
-#include <xen/prefetch.h>
 #include <asm/system.h>
 
 /* These are non-NULL pointers that will result in page faults
@@ -40,6 +39,9 @@
 #define LIST_HEAD_READ_MOSTLY(name) \
     struct list_head __read_mostly name = LIST_HEAD_INIT(name)
 
+/* Do not move this ahead of the struct list_head definition! */
+#include <xen/prefetch.h>
+
 static inline void INIT_LIST_HEAD(struct list_head *list)
 {
     list->next = list;
diff -r 3432abcf9380 -r 158f9c38d95c xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h	Thu Feb 02 15:47:26 2012 +0000
+++ b/xen/include/xsm/xsm.h	Mon Feb 06 17:40:05 2012 +0100
@@ -106,6 +106,7 @@
     int (*memory_adjust_reservation) (struct domain *d1, struct domain *d2);
     int (*memory_stat_reservation) (struct domain *d1, struct domain *d2);
     int (*memory_pin_page) (struct domain *d, struct page_info *page);
+    int (*remove_from_physmap) (struct domain *d1, struct domain *d2);
 
     int (*console_io) (struct domain *d, int cmd);
 
@@ -174,7 +175,6 @@
     int (*update_va_mapping) (struct domain *d, struct domain *f, 
                                                             l1_pgentry_t pte);
     int (*add_to_physmap) (struct domain *d1, struct domain *d2);
-    int (*remove_from_physmap) (struct domain *d1, struct domain *d2);
     int (*sendtrigger) (struct domain *d);
     int (*bind_pt_irq) (struct domain *d, struct xen_domctl_bind_pt_irq *bind);
     int (*unbind_pt_irq) (struct domain *d);
@@ -460,6 +460,11 @@
     return xsm_call(memory_pin_page(d, page));
 }
 
+static inline int xsm_remove_from_physmap(struct domain *d1, struct domain *d2)
+{
+    return xsm_call(remove_from_physmap(d1, d2));
+}
+
 static inline int xsm_console_io (struct domain *d, int cmd)
 {
     return xsm_call(console_io(d, cmd));
@@ -764,11 +769,6 @@
     return xsm_call(add_to_physmap(d1, d2));
 }
 
-static inline int xsm_remove_from_physmap(struct domain *d1, struct domain *d2)
-{
-    return xsm_call(remove_from_physmap(d1, d2));
-}
-
 static inline int xsm_sendtrigger(struct domain *d)
 {
     return xsm_call(sendtrigger(d));

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

From xen-changelog-bounces@lists.xensource.com Mon Feb 06 22:44:26 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 06 Feb 2012 22:44:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RuXII-0004iM-1f; Mon, 06 Feb 2012 22:44:18 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RuXIG-0004i7-En
	for xen-changelog@lists.xensource.com; Mon, 06 Feb 2012 22:44:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1328568249!2420952!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28400 invoked from network); 6 Feb 2012 22:44:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Feb 2012 22:44:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RuXI8-00050f-Q9
	for xen-changelog@lists.xensource.com; Mon, 06 Feb 2012 22:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RuXI8-0007gt-8O
	for xen-changelog@lists.xensource.com; Mon, 06 Feb 2012 22:44:08 +0000
Message-Id: <E1RuXI8-0007gt-8O@xenbits.xen.org>
Date: Mon, 06 Feb 2012 22:44:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] ia64: fix build (next instance)
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328546405 -3600
# Node ID 158f9c38d95c19667057beccf35a9d7f704d0df5
# Parent  3432abcf9380d3840ca38439a304f74a37d155fc
ia64: fix build (next instance)

A number of build problems crept in once again. Fix them.

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


diff -r 3432abcf9380 -r 158f9c38d95c xen/common/memory.c
--- a/xen/common/memory.c	Thu Feb 02 15:47:26 2012 +0000
+++ b/xen/common/memory.c	Mon Feb 06 17:40:05 2012 +0100
@@ -683,7 +683,7 @@
         mfn = get_gfn_untyped(d, xrfp.gpfn);
 
         if ( mfn_valid(mfn) )
-            guest_physmap_remove_page(d, xrfp.gpfn, mfn, PAGE_ORDER_4K);
+            guest_physmap_remove_page(d, xrfp.gpfn, mfn, 0);
         else
             rc = -ENOENT;
 
diff -r 3432abcf9380 -r 158f9c38d95c xen/include/asm-ia64/linux-xen/asm/irq.h
--- a/xen/include/asm-ia64/linux-xen/asm/irq.h	Thu Feb 02 15:47:26 2012 +0000
+++ b/xen/include/asm-ia64/linux-xen/asm/irq.h	Mon Feb 06 17:40:05 2012 +0100
@@ -72,7 +72,7 @@
 #define irq_complete_move(x) do {} \
     while(!x)
 
-#define domain_pirq_to_irq(d, irq) domain_irq_to_vector(d, irq)
+#define domain_pirq_to_irq(d, irq) (irq) /* domain_irq_to_vector(d, irq) */
 
 #define hvm_domain_use_pirq(d, info) 0
 #endif
diff -r 3432abcf9380 -r 158f9c38d95c xen/include/asm-ia64/linux-xen/asm/processor.h
--- a/xen/include/asm-ia64/linux-xen/asm/processor.h	Thu Feb 02 15:47:26 2012 +0000
+++ b/xen/include/asm-ia64/linux-xen/asm/processor.h	Mon Feb 06 17:40:05 2012 +0100
@@ -17,7 +17,12 @@
 
 #include <asm/intrinsics.h>
 #include <asm/kregs.h>
+#if !defined(XEN)
 #include <asm/ptrace.h>
+#elif !defined(__ASSEMBLY__)
+struct cpu_user_regs;
+#define pt_regs cpu_user_regs
+#endif
 #include <asm/ustack.h>
 
 /* Our arch specific arch_init_sched_domain is in arch/ia64/kernel/domain.c */
@@ -783,4 +788,8 @@
 
 #endif /* !__ASSEMBLY__ */
 
+#ifdef XEN
+#include <asm/ptrace.h>
+#endif
+
 #endif /* _ASM_IA64_PROCESSOR_H */
diff -r 3432abcf9380 -r 158f9c38d95c xen/include/xen/list.h
--- a/xen/include/xen/list.h	Thu Feb 02 15:47:26 2012 +0000
+++ b/xen/include/xen/list.h	Mon Feb 06 17:40:05 2012 +0100
@@ -8,7 +8,6 @@
 #define __XEN_LIST_H__
 
 #include <xen/lib.h>
-#include <xen/prefetch.h>
 #include <asm/system.h>
 
 /* These are non-NULL pointers that will result in page faults
@@ -40,6 +39,9 @@
 #define LIST_HEAD_READ_MOSTLY(name) \
     struct list_head __read_mostly name = LIST_HEAD_INIT(name)
 
+/* Do not move this ahead of the struct list_head definition! */
+#include <xen/prefetch.h>
+
 static inline void INIT_LIST_HEAD(struct list_head *list)
 {
     list->next = list;
diff -r 3432abcf9380 -r 158f9c38d95c xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h	Thu Feb 02 15:47:26 2012 +0000
+++ b/xen/include/xsm/xsm.h	Mon Feb 06 17:40:05 2012 +0100
@@ -106,6 +106,7 @@
     int (*memory_adjust_reservation) (struct domain *d1, struct domain *d2);
     int (*memory_stat_reservation) (struct domain *d1, struct domain *d2);
     int (*memory_pin_page) (struct domain *d, struct page_info *page);
+    int (*remove_from_physmap) (struct domain *d1, struct domain *d2);
 
     int (*console_io) (struct domain *d, int cmd);
 
@@ -174,7 +175,6 @@
     int (*update_va_mapping) (struct domain *d, struct domain *f, 
                                                             l1_pgentry_t pte);
     int (*add_to_physmap) (struct domain *d1, struct domain *d2);
-    int (*remove_from_physmap) (struct domain *d1, struct domain *d2);
     int (*sendtrigger) (struct domain *d);
     int (*bind_pt_irq) (struct domain *d, struct xen_domctl_bind_pt_irq *bind);
     int (*unbind_pt_irq) (struct domain *d);
@@ -460,6 +460,11 @@
     return xsm_call(memory_pin_page(d, page));
 }
 
+static inline int xsm_remove_from_physmap(struct domain *d1, struct domain *d2)
+{
+    return xsm_call(remove_from_physmap(d1, d2));
+}
+
 static inline int xsm_console_io (struct domain *d, int cmd)
 {
     return xsm_call(console_io(d, cmd));
@@ -764,11 +769,6 @@
     return xsm_call(add_to_physmap(d1, d2));
 }
 
-static inline int xsm_remove_from_physmap(struct domain *d1, struct domain *d2)
-{
-    return xsm_call(remove_from_physmap(d1, d2));
-}
-
 static inline int xsm_sendtrigger(struct domain *d)
 {
     return xsm_call(sendtrigger(d));

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 07 04:33:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Feb 2012 04:33:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rucjy-0005Nn-Eq; Tue, 07 Feb 2012 04:33:14 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjx-0005Ne-2s
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1328589152!51344106!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27968 invoked from network); 7 Feb 2012 04:32:33 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Feb 2012 04:32:33 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucju-0001FI-0v
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjt-00066b-Sk
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:09 +0000
Message-Id: <E1Rucjt-00066b-Sk@xenbits.xen.org>
Date: Tue, 07 Feb 2012 04:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: Remove unused vsscanf/sscanf
	functions
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328533683 28800
# Node ID f665817959942bf1e149e65597187c02d563f83b
# Parent  bf326829102b4778cc1f98cd677234362335f831
xen: Remove unused vsscanf/sscanf functions

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r bf326829102b -r f66581795994 xen/common/vsprintf.c
--- a/xen/common/vsprintf.c	Mon Feb 06 05:07:20 2012 -0800
+++ b/xen/common/vsprintf.c	Mon Feb 06 05:08:03 2012 -0800
@@ -512,223 +512,6 @@
 EXPORT_SYMBOL(vscnprintf);
 
 /**
- * vsscanf - Unformat a buffer into a list of arguments
- * @buf:    input buffer
- * @fmt:    format of buffer
- * @args:   arguments
- */
-int vsscanf(const char * buf, const char * fmt, va_list args)
-{
-    const char *str = buf;
-    const char *next;
-    char digit;
-    int num = 0;
-    int qualifier;
-    int base;
-    int field_width;
-    int is_sign = 0;
-
-    while (*fmt && *str) {
-        /* skip any white space in format */
-        /* white space in format matchs any amount of
-         * white space, including none, in the input.
-         */
-        if (isspace(*fmt)) {
-            while (isspace(*fmt))
-                ++fmt;
-            while (isspace(*str))
-                ++str;
-        }
-
-        /* anything that is not a conversion must match exactly */
-        if (*fmt != '%' && *fmt) {
-            if (*fmt++ != *str++)
-                break;
-            continue;
-        }
-
-        if (!*fmt)
-            break;
-        ++fmt;
-
-        /* skip this conversion.
-         * advance both strings to next white space
-         */
-        if (*fmt == '*') {
-            while (!isspace(*fmt) && *fmt)
-                fmt++;
-            while (!isspace(*str) && *str)
-                str++;
-            continue;
-        }
-
-        /* get field width */
-        field_width = -1;
-        if (isdigit(*fmt))
-            field_width = skip_atoi(&fmt);
-
-        /* get conversion qualifier */
-        qualifier = -1;
-        if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt == 'Z'
-            || *fmt == 'z') {
-            qualifier = *fmt++;
-            if (unlikely(qualifier == *fmt)) {
-                if (qualifier == 'h') {
-                    qualifier = 'H';
-                    fmt++;
-                } else if (qualifier == 'l') {
-                    qualifier = 'L';
-                    fmt++;
-                }
-            }
-        }
-        base = 10;
-        is_sign = 0;
-
-        if (!*fmt || !*str)
-            break;
-
-        switch(*fmt++) {
-            case 'c': {
-                char *s = (char *) va_arg(args,char*);
-                if (field_width == -1)
-                    field_width = 1;
-                do {
-                    *s++ = *str++;
-                } while (--field_width > 0 && *str);
-                num++;
-            }
-            continue;
-            case 's': {
-                char *s = (char *) va_arg(args, char *);
-                if(field_width == -1)
-                    field_width = INT_MAX;
-                /* first, skip leading white space in buffer */
-                while (isspace(*str))
-                    str++;
-
-                /* now copy until next white space */
-                while (*str && !isspace(*str) && field_width--)
-                    *s++ = *str++;
-                *s = '\0';
-                num++;
-            }
-            continue;
-            case 'n': {
-            /* return number of characters read so far */
-                int *i = (int *)va_arg(args,int*);
-                *i = str - buf;
-            }
-            continue;
-            case 'o':
-                base = 8;
-            break;
-            case 'x':
-            case 'X':
-                base = 16;
-            break;
-            case 'i':
-                base = 0;
-            case 'd':
-                is_sign = 1;
-            case 'u':
-            break;
-            case '%':
-                /* looking for '%' in str */
-                if (*str++ != '%') 
-                    return num;
-            continue;
-            default:
-                /* invalid format; stop here */
-                return num;
-        }
-
-        /* have some sort of integer conversion.
-         * first, skip white space in buffer.
-         */
-        while (isspace(*str))
-            str++;
-
-        digit = *str;
-        if (is_sign && digit == '-')
-            digit = *(str + 1);
-
-        if (!digit || (base == 16 && !isxdigit(digit))
-                || (base == 10 && !isdigit(digit))
-                || (base == 8 && (!isdigit(digit) || digit > '7'))
-                || (base == 0 && !isdigit(digit)))
-            break;
-
-        switch(qualifier) {
-            case 'H': /* that's 'hh' in format */
-                if (is_sign) {
-                    signed char *s = (signed char *) va_arg(args,signed char *);
-                    *s = (signed char) simple_strtol(str,&next,base);
-                } else {
-                    unsigned char *s = (unsigned char *) 
-                                                va_arg(args, unsigned char *);
-                    *s = (unsigned char) simple_strtoul(str, &next, base);
-                }
-            break;
-            case 'h':
-                if (is_sign) {
-                    short *s = (short *) va_arg(args,short *);
-                    *s = (short) simple_strtol(str,&next,base);
-                } else {
-                    unsigned short *s = (unsigned short *) 
-                                                va_arg(args, unsigned short *);
-                    *s = (unsigned short) simple_strtoul(str, &next, base);
-                }
-            break;
-            case 'l':
-                if (is_sign) {
-                    long *l = (long *) va_arg(args,long *);
-                    *l = simple_strtol(str,&next,base);
-                } else {
-                    unsigned long *l = (unsigned long*) 
-                                                    va_arg(args,unsigned long*);
-                    *l = simple_strtoul(str,&next,base);
-                }
-            break;
-            case 'L':
-                if (is_sign) {
-                    long long *l = (long long*) va_arg(args,long long *);
-                    *l = simple_strtoll(str,&next,base);
-                } else {
-                    unsigned long long *l = (unsigned long long*) 
-                                            va_arg(args,unsigned long long*);
-                    *l = simple_strtoull(str,&next,base);
-                }
-            break;
-            case 'Z':
-            case 'z': {
-                size_t *s = (size_t*) va_arg(args,size_t*);
-                *s = (size_t) simple_strtoul(str,&next,base);
-            }
-            break;
-            default:
-                if (is_sign) {
-                    int *i = (int *) va_arg(args, int*);
-                    *i = (int) simple_strtol(str,&next,base);
-                } else {
-                    unsigned int *i = (unsigned int*) 
-                                                    va_arg(args, unsigned int*);
-                    *i = (unsigned int) simple_strtoul(str,&next,base);
-                }
-            break;
-        }
-        num++;
-
-        if (!next)
-            break;
-        str = next;
-    }
-    return num;
-}
-
-EXPORT_SYMBOL(vsscanf);
-
-/**
  * snprintf - Format a string and place it in a buffer
  * @buf: The buffer to place the result into
  * @size: The size of the buffer, including the trailing null space
@@ -779,25 +562,6 @@
 }
 EXPORT_SYMBOL(scnprintf);
 
-/**
- * sscanf - Unformat a buffer into a list of arguments
- * @buf:    input buffer
- * @fmt:    formatting of buffer
- * @...:    resulting arguments
- */
-int sscanf(const char * buf, const char * fmt, ...)
-{
-    va_list args;
-    int i;
-
-    va_start(args,fmt);
-    i = vsscanf(buf,fmt,args);
-    va_end(args);
-    return i;
-}
-
-EXPORT_SYMBOL(sscanf);
-
 /*
  * Local variables:
  * mode: C
diff -r bf326829102b -r f66581795994 xen/include/xen/lib.h
--- a/xen/include/xen/lib.h	Mon Feb 06 05:07:20 2012 -0800
+++ b/xen/include/xen/lib.h	Mon Feb 06 05:08:03 2012 -0800
@@ -89,10 +89,6 @@
     __attribute__ ((format (printf, 3, 4)));
 extern int vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
     __attribute__ ((format (printf, 3, 0)));
-extern int sscanf(const char * buf, const char * fmt, ...)
-    __attribute__ ((format (scanf, 2, 3)));
-extern int vsscanf(const char * buf, const char * fmt, va_list args)
-    __attribute__ ((format (scanf, 2, 0)));
 
 long simple_strtol(
     const char *cp,const char **endp, unsigned int base);

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 07 04:33:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Feb 2012 04:33:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rucjy-0005Nn-Eq; Tue, 07 Feb 2012 04:33:14 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjx-0005Ne-2s
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1328589152!51344106!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27968 invoked from network); 7 Feb 2012 04:32:33 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Feb 2012 04:32:33 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucju-0001FI-0v
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjt-00066b-Sk
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:09 +0000
Message-Id: <E1Rucjt-00066b-Sk@xenbits.xen.org>
Date: Tue, 07 Feb 2012 04:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: Remove unused vsscanf/sscanf
	functions
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328533683 28800
# Node ID f665817959942bf1e149e65597187c02d563f83b
# Parent  bf326829102b4778cc1f98cd677234362335f831
xen: Remove unused vsscanf/sscanf functions

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r bf326829102b -r f66581795994 xen/common/vsprintf.c
--- a/xen/common/vsprintf.c	Mon Feb 06 05:07:20 2012 -0800
+++ b/xen/common/vsprintf.c	Mon Feb 06 05:08:03 2012 -0800
@@ -512,223 +512,6 @@
 EXPORT_SYMBOL(vscnprintf);
 
 /**
- * vsscanf - Unformat a buffer into a list of arguments
- * @buf:    input buffer
- * @fmt:    format of buffer
- * @args:   arguments
- */
-int vsscanf(const char * buf, const char * fmt, va_list args)
-{
-    const char *str = buf;
-    const char *next;
-    char digit;
-    int num = 0;
-    int qualifier;
-    int base;
-    int field_width;
-    int is_sign = 0;
-
-    while (*fmt && *str) {
-        /* skip any white space in format */
-        /* white space in format matchs any amount of
-         * white space, including none, in the input.
-         */
-        if (isspace(*fmt)) {
-            while (isspace(*fmt))
-                ++fmt;
-            while (isspace(*str))
-                ++str;
-        }
-
-        /* anything that is not a conversion must match exactly */
-        if (*fmt != '%' && *fmt) {
-            if (*fmt++ != *str++)
-                break;
-            continue;
-        }
-
-        if (!*fmt)
-            break;
-        ++fmt;
-
-        /* skip this conversion.
-         * advance both strings to next white space
-         */
-        if (*fmt == '*') {
-            while (!isspace(*fmt) && *fmt)
-                fmt++;
-            while (!isspace(*str) && *str)
-                str++;
-            continue;
-        }
-
-        /* get field width */
-        field_width = -1;
-        if (isdigit(*fmt))
-            field_width = skip_atoi(&fmt);
-
-        /* get conversion qualifier */
-        qualifier = -1;
-        if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt == 'Z'
-            || *fmt == 'z') {
-            qualifier = *fmt++;
-            if (unlikely(qualifier == *fmt)) {
-                if (qualifier == 'h') {
-                    qualifier = 'H';
-                    fmt++;
-                } else if (qualifier == 'l') {
-                    qualifier = 'L';
-                    fmt++;
-                }
-            }
-        }
-        base = 10;
-        is_sign = 0;
-
-        if (!*fmt || !*str)
-            break;
-
-        switch(*fmt++) {
-            case 'c': {
-                char *s = (char *) va_arg(args,char*);
-                if (field_width == -1)
-                    field_width = 1;
-                do {
-                    *s++ = *str++;
-                } while (--field_width > 0 && *str);
-                num++;
-            }
-            continue;
-            case 's': {
-                char *s = (char *) va_arg(args, char *);
-                if(field_width == -1)
-                    field_width = INT_MAX;
-                /* first, skip leading white space in buffer */
-                while (isspace(*str))
-                    str++;
-
-                /* now copy until next white space */
-                while (*str && !isspace(*str) && field_width--)
-                    *s++ = *str++;
-                *s = '\0';
-                num++;
-            }
-            continue;
-            case 'n': {
-            /* return number of characters read so far */
-                int *i = (int *)va_arg(args,int*);
-                *i = str - buf;
-            }
-            continue;
-            case 'o':
-                base = 8;
-            break;
-            case 'x':
-            case 'X':
-                base = 16;
-            break;
-            case 'i':
-                base = 0;
-            case 'd':
-                is_sign = 1;
-            case 'u':
-            break;
-            case '%':
-                /* looking for '%' in str */
-                if (*str++ != '%') 
-                    return num;
-            continue;
-            default:
-                /* invalid format; stop here */
-                return num;
-        }
-
-        /* have some sort of integer conversion.
-         * first, skip white space in buffer.
-         */
-        while (isspace(*str))
-            str++;
-
-        digit = *str;
-        if (is_sign && digit == '-')
-            digit = *(str + 1);
-
-        if (!digit || (base == 16 && !isxdigit(digit))
-                || (base == 10 && !isdigit(digit))
-                || (base == 8 && (!isdigit(digit) || digit > '7'))
-                || (base == 0 && !isdigit(digit)))
-            break;
-
-        switch(qualifier) {
-            case 'H': /* that's 'hh' in format */
-                if (is_sign) {
-                    signed char *s = (signed char *) va_arg(args,signed char *);
-                    *s = (signed char) simple_strtol(str,&next,base);
-                } else {
-                    unsigned char *s = (unsigned char *) 
-                                                va_arg(args, unsigned char *);
-                    *s = (unsigned char) simple_strtoul(str, &next, base);
-                }
-            break;
-            case 'h':
-                if (is_sign) {
-                    short *s = (short *) va_arg(args,short *);
-                    *s = (short) simple_strtol(str,&next,base);
-                } else {
-                    unsigned short *s = (unsigned short *) 
-                                                va_arg(args, unsigned short *);
-                    *s = (unsigned short) simple_strtoul(str, &next, base);
-                }
-            break;
-            case 'l':
-                if (is_sign) {
-                    long *l = (long *) va_arg(args,long *);
-                    *l = simple_strtol(str,&next,base);
-                } else {
-                    unsigned long *l = (unsigned long*) 
-                                                    va_arg(args,unsigned long*);
-                    *l = simple_strtoul(str,&next,base);
-                }
-            break;
-            case 'L':
-                if (is_sign) {
-                    long long *l = (long long*) va_arg(args,long long *);
-                    *l = simple_strtoll(str,&next,base);
-                } else {
-                    unsigned long long *l = (unsigned long long*) 
-                                            va_arg(args,unsigned long long*);
-                    *l = simple_strtoull(str,&next,base);
-                }
-            break;
-            case 'Z':
-            case 'z': {
-                size_t *s = (size_t*) va_arg(args,size_t*);
-                *s = (size_t) simple_strtoul(str,&next,base);
-            }
-            break;
-            default:
-                if (is_sign) {
-                    int *i = (int *) va_arg(args, int*);
-                    *i = (int) simple_strtol(str,&next,base);
-                } else {
-                    unsigned int *i = (unsigned int*) 
-                                                    va_arg(args, unsigned int*);
-                    *i = (unsigned int) simple_strtoul(str,&next,base);
-                }
-            break;
-        }
-        num++;
-
-        if (!next)
-            break;
-        str = next;
-    }
-    return num;
-}
-
-EXPORT_SYMBOL(vsscanf);
-
-/**
  * snprintf - Format a string and place it in a buffer
  * @buf: The buffer to place the result into
  * @size: The size of the buffer, including the trailing null space
@@ -779,25 +562,6 @@
 }
 EXPORT_SYMBOL(scnprintf);
 
-/**
- * sscanf - Unformat a buffer into a list of arguments
- * @buf:    input buffer
- * @fmt:    formatting of buffer
- * @...:    resulting arguments
- */
-int sscanf(const char * buf, const char * fmt, ...)
-{
-    va_list args;
-    int i;
-
-    va_start(args,fmt);
-    i = vsscanf(buf,fmt,args);
-    va_end(args);
-    return i;
-}
-
-EXPORT_SYMBOL(sscanf);
-
 /*
  * Local variables:
  * mode: C
diff -r bf326829102b -r f66581795994 xen/include/xen/lib.h
--- a/xen/include/xen/lib.h	Mon Feb 06 05:07:20 2012 -0800
+++ b/xen/include/xen/lib.h	Mon Feb 06 05:08:03 2012 -0800
@@ -89,10 +89,6 @@
     __attribute__ ((format (printf, 3, 4)));
 extern int vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
     __attribute__ ((format (printf, 3, 0)));
-extern int sscanf(const char * buf, const char * fmt, ...)
-    __attribute__ ((format (scanf, 2, 3)));
-extern int vsscanf(const char * buf, const char * fmt, va_list args)
-    __attribute__ ((format (scanf, 2, 0)));
 
 long simple_strtol(
     const char *cp,const char **endp, unsigned int base);

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 07 04:33:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Feb 2012 04:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ruck3-0005OO-MR; Tue, 07 Feb 2012 04:33:19 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Ruck1-0005Nc-VD
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-174.messagelabs.com!1328589189!12104222!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10670 invoked from network); 7 Feb 2012 04:33:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Feb 2012 04:33:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjs-0001F9-LY
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjs-00065N-6n
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:08 +0000
Message-Id: <E1Rucjs-00065N-6n@xenbits.xen.org>
Date: Tue, 07 Feb 2012 04:33:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/flask: remove libflask
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328533412 28800
# Node ID c3cfc4d4534daf327b237714ff9834039e80d0fc
# Parent  158f9c38d95c19667057beccf35a9d7f704d0df5
tools/flask: remove libflask

This library has been deprecated since July 2010; remove the in-tree
users and library.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 158f9c38d95c -r c3cfc4d4534d tools/flask/Makefile
--- a/tools/flask/Makefile	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/flask/Makefile	Mon Feb 06 05:03:32 2012 -0800
@@ -2,7 +2,6 @@
 include $(XEN_ROOT)/tools/Rules.mk
 
 SUBDIRS :=
-SUBDIRS += libflask
 SUBDIRS += utils
 
 .PHONY: all clean install
diff -r 158f9c38d95c -r c3cfc4d4534d tools/flask/libflask/Makefile
--- a/tools/flask/libflask/Makefile	Mon Feb 06 17:40:05 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-MAJOR    = 1.0
-MINOR    = 0
-
-XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/Rules.mk
-
-SRCS       :=
-SRCS       += flask_op.c
-
-CFLAGS   += -Werror
-CFLAGS   += -fno-strict-aliasing
-CFLAGS   += -I./include $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude)
-
-LIB_OBJS := $(patsubst %.c,%.o,$(SRCS))
-PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS))
-
-LIB := libflask.a
-LIB += libflask.so libflask.so.$(MAJOR) libflask.so.$(MAJOR).$(MINOR)
-
-.PHONY: all
-all: build
-
-.PHONY: build
-build:
-	$(MAKE) $(LIB)
-
-.PHONY: install
-install: build
-	$(INSTALL_DIR) $(DESTDIR)$(LIBDIR)
-	$(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)
-	$(INSTALL_PROG) libflask.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)
-	$(INSTALL_DATA) libflask.a $(DESTDIR)$(LIBDIR)
-	ln -sf libflask.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libflask.so.$(MAJOR)
-	ln -sf libflask.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libflask.so
-	$(INSTALL_DATA) include/libflask.h $(DESTDIR)$(INCLUDEDIR)/xen/xsm
-
-.PHONY: TAGS
-TAGS:
-	etags -t *.c *.h
-
-.PHONY: clean
-clean:
-	rm -rf *.a *.so* *.o *.opic *.rpm $(LIB) *~ $(DEPS) xen
-
-# libflask
-
-libflask.a: $(LIB_OBJS)
-	$(AR) rc $@ $^
-
-libflask.so: libflask.so.$(MAJOR)
-	ln -sf $< $@
-libflask.so.$(MAJOR): libflask.so.$(MAJOR).$(MINOR)
-	ln -sf $< $@
-
-libflask.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
-	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libflask.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LDLIBS_libxenctrl)
-
--include $(DEPS)
diff -r 158f9c38d95c -r c3cfc4d4534d tools/flask/libflask/flask_op.c
--- a/tools/flask/libflask/flask_op.c	Mon Feb 06 17:40:05 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,559 +0,0 @@
-/*
- *
- *  Authors:  Michael LeMay, <mdlemay@epoch.ncsc.mil>
- *            George Coker, <gscoker@alpha.ncsc.mil>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2,
- *  as published by the Free Software Foundation.
- */
-
-#include <unistd.h>
-#include <stdio.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <sys/ioctl.h>
-#include <libflask.h>
-
-int flask_load(xc_interface *xc_handle, char *buf, uint32_t size)
-{
-    int err;
-    flask_op_t op;
-    
-    op.cmd = FLASK_LOAD;
-    op.buf = buf;
-    op.size = size;
-    
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-
-    return 0;
-}
-
-int flask_context_to_sid(xc_interface *xc_handle, char *buf, uint32_t size, uint32_t *sid)
-{
-    int err;
-    flask_op_t op;
-    
-    op.cmd = FLASK_CONTEXT_TO_SID;
-    op.buf = buf;
-    op.size = size;
-    
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-    
-    sscanf(buf, "%u", sid);
-
-    return 0;
-}
-
-int flask_sid_to_context(xc_interface *xc_handle, int sid, char *buf, uint32_t size)
-{
-    int err;
-    flask_op_t op;
-    
-    op.cmd = FLASK_SID_TO_CONTEXT;
-    op.buf = buf;
-    op.size = size;
-    
-    snprintf(buf, size, "%u", sid);
-
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-
-    return 0;
-}
-
-int flask_getenforce(xc_interface *xc_handle)
-{
-    int err;
-    flask_op_t op;
-    char buf[20];            
-    int size = 20;
-    int mode;
- 
-    op.cmd = FLASK_GETENFORCE;
-    op.buf = buf;
-    op.size = size;
-    
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-
-    sscanf(buf, "%i", &mode);
-
-    return mode;
-}
-
-int flask_setenforce(xc_interface *xc_handle, int mode)
-{
-    int err;
-    flask_op_t op;
-    char buf[20];
-    int size = 20; 
- 
-    op.cmd = FLASK_SETENFORCE;
-    op.buf = buf;
-    op.size = size;
-   
-    snprintf(buf, size, "%i", mode);
- 
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-
-    return 0;
-}
-
-int flask_getbool_byid(xc_interface *xc_handle, int id, char *name, int *curr, int *pend)
-{
-    flask_op_t op;
-    char buf[255];
-    int rv;
-
-    op.cmd = FLASK_GETBOOL2;
-    op.buf = buf;
-    op.size = 255;
-
-    snprintf(buf, sizeof buf, "%i", id);
-
-    rv = xc_flask_op(xc_handle, &op);
-
-    if ( rv )
-        return rv;
-    
-    sscanf(buf, "%i %i %s", curr, pend, name);
-
-    return rv;
-}
-
-int flask_getbool_byname(xc_interface *xc_handle, char *name, int *curr, int *pend)
-{
-    flask_op_t op;
-    char buf[255];
-    int rv;
-
-    op.cmd = FLASK_GETBOOL_NAMED;
-    op.buf = buf;
-    op.size = 255;
-
-    strncpy(buf, name, op.size);
-
-    rv = xc_flask_op(xc_handle, &op);
-
-    if ( rv )
-        return rv;
-    
-    sscanf(buf, "%i %i", curr, pend);
-
-    return rv;
-}
-
-int flask_setbool(xc_interface *xc_handle, char *name, int value, int commit)
-{
-    flask_op_t op;
-    char buf[255];
-    int size = 255;
-
-    op.cmd = FLASK_SETBOOL_NAMED;
-    op.buf = buf;
-    op.size = size;
-
-    snprintf(buf, size, "%s %i %i", name, value, commit);
-
-    return xc_flask_op(xc_handle, &op);
-}
-
-int flask_add_pirq(xc_interface *xc_handle, unsigned int pirq, char *scontext)
-{
-    int err;
-    flask_op_t op;
-    char *buf;
-    char *pirq_s = OCON_PIRQ_STR;
-    int size = INITCONTEXTLEN + strlen(pirq_s) + (sizeof(unsigned int)) +
-                (sizeof(char) * 3);
-
-    if ( (buf = (char *) malloc(size)) == NULL )
-        return -ENOMEM;
-    memset(buf, 0, size);
-
-    op.cmd = FLASK_ADD_OCONTEXT;
-    snprintf(buf, size, "%s %255s %u", pirq_s, scontext, pirq);
-    op.buf = buf;
-    op.size = size;
-
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    free(buf);
-    return 0;
-
-}
-
-int flask_add_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high,
-                      char *scontext)
-{
-    int err;
-    flask_op_t op;
-    char *buf;
-    char *ioport = OCON_IOPORT_STR;
-    int size = INITCONTEXTLEN + strlen(ioport) +
-                (sizeof(unsigned long) * 2) + (sizeof(char) * 4);
-
-    if ( (buf = (char *) malloc(size)) == NULL )
-        return -ENOMEM;
-    memset(buf, 0, size);
-
-    op.cmd = FLASK_ADD_OCONTEXT;
-    snprintf(buf, size, "%s %255s %lu %lu", ioport, scontext, low, high);
-    op.buf = buf;
-    op.size = size;
-
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    free(buf);
-    return 0;
-
-}
-
-int flask_add_iomem(xc_interface *xc_handle, unsigned long low, unsigned long high,
-                     char *scontext)
-{
-    int err;
-    flask_op_t op;
-    char *buf;
-    char *iomem = OCON_IOMEM_STR;
-    int size = INITCONTEXTLEN + strlen(iomem) +
-                (sizeof(unsigned long) * 2) + (sizeof(char) * 4);
-
-    if ( (buf = (char *) malloc(size)) == NULL )
-        return -ENOMEM;
-    memset(buf, 0, size);
-
-    op.cmd = FLASK_ADD_OCONTEXT;
-    snprintf(buf, size, "%s %255s %lu %lu", iomem, scontext, low, high);
-    op.buf = buf;
-    op.size = size;
-
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    free(buf);
-    return 0;
-
-}
-
-int flask_add_device(xc_interface *xc_handle, unsigned long device, char *scontext)
-{
-    int err;
-    flask_op_t op;
-    char *buf;
-    char *dev = OCON_DEVICE_STR;
-    int size = INITCONTEXTLEN + strlen(dev) + (sizeof(unsigned long)) +
-                (sizeof(char) * 3);
-
-    if ( (buf = (char *) malloc(size)) == NULL )
-        return -ENOMEM;
-    memset(buf, 0, size);
-
-    op.cmd = FLASK_ADD_OCONTEXT;
-    snprintf(buf, size, "%s %255s %lu", dev, scontext, device);
-    op.buf = buf;
-    op.size = size;
-
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    free(buf);
-    return 0;
-
-}
-
-int flask_del_pirq(xc_interface *xc_handle, unsigned int pirq)
-{
-    int err;
-    flask_op_t op;
-    char *buf;
-    char *pirq_s = OCON_PIRQ_STR;
-    int size = strlen(pirq_s) + (sizeof(unsigned int)) +
-                (sizeof(char) * 2);
-
-    if ( (buf = (char *) malloc(size)) == NULL )
-        return -ENOMEM;
-    memset(buf, 0, size);
-
-    op.cmd = FLASK_DEL_OCONTEXT;
-    snprintf(buf, size, "%s %u", pirq_s, pirq);
-    op.buf = buf;
-    op.size = size;
-
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    free(buf);
-    return 0;
-
-}
-
-int flask_del_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high)
-{
-    int err;
-    flask_op_t op;
-    char *buf;
-    char *ioport = OCON_IOPORT_STR;
-    int size = strlen(ioport) + (sizeof(unsigned long) * 2) +
-                (sizeof(char) * 3);
-
-    if ( (buf = (char *) malloc(size)) == NULL )
-        return -ENOMEM;
-    memset(buf, 0, size);
-
-    op.cmd = FLASK_DEL_OCONTEXT;
-    snprintf(buf, size, "%s %lu %lu", ioport, low, high);
-    op.buf = buf;
-    op.size = size;
-
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    free(buf);
-    return 0;
-
-}
-
-int flask_del_iomem(xc_interface *xc_handle, unsigned long low, unsigned long high)
-{
-    int err;
-    flask_op_t op;
-    char *buf;
-    char *iomem = OCON_IOMEM_STR;
-    int size = strlen(iomem) + (sizeof(unsigned long) * 2) +
-                (sizeof(char) * 3);
-
-    if ( (buf = (char *) malloc(size)) == NULL )
-        return -ENOMEM;
-    memset(buf, 0, size);
-
-    op.cmd = FLASK_DEL_OCONTEXT;
-    snprintf(buf, size, "%s %lu %lu", iomem, low, high);
-    op.buf = buf;
-    op.size = size;
-
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    free(buf);
-    return 0;
-
-}
-
-int flask_del_device(xc_interface *xc_handle, unsigned long device)
-{
-    int err;
-    flask_op_t op;
-    char *buf;
-    char *dev = OCON_DEVICE_STR;
-    int size = strlen(dev) + (sizeof(unsigned long)) + (sizeof(char) * 2);
-
-    if ( (buf = (char *) malloc(size)) == NULL )
-        return -ENOMEM;
-    memset(buf, 0, size);
-
-    op.cmd = FLASK_DEL_OCONTEXT;
-    snprintf(buf, size, "%s %lu", dev, device);
-    op.buf = buf;
-    op.size = size;
-
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    free(buf);
-    return 0;
-
-}
-
-int flask_access(xc_interface *xc_handle, const char *scon, const char *tcon,
-                u_int16_t tclass, u_int32_t req,
-                u_int32_t *allowed, u_int32_t *decided,
-                u_int32_t *auditallow, u_int32_t *auditdeny,
-                u_int32_t *seqno)
-{
-/* maximum number of digits in a 16-bit decimal number: */
-#define MAX_SHORT_DEC_LEN 5
-
-    char *buf;
-    int bufLen;
-    int err;
-    flask_op_t op;
-    u_int32_t dummy_allowed;
-    u_int32_t dummy_decided;
-    u_int32_t dummy_auditallow;
-    u_int32_t dummy_auditdeny;
-    u_int32_t dummy_seqno;
-  
-    if (!allowed)
-        allowed = &dummy_allowed;
-    if (!decided)
-        decided = &dummy_decided;
-    if (!auditallow)
-        auditallow = &dummy_auditallow;
-    if (!auditdeny)
-        auditdeny = &dummy_auditdeny;
-    if (!seqno)
-        seqno = &dummy_seqno;
-
-    if (!scon)
-        return -EINVAL;
-    if (!tcon)
-        return -EINVAL;
-
-    bufLen = strlen(scon) + 1 + strlen(tcon) + 1 +
-        MAX_SHORT_DEC_LEN + 1 +
-        sizeof(req)*2 + 1;
-    buf = malloc(bufLen);
-    snprintf(buf, bufLen, "%s %s %hu %x", scon, tcon, tclass, req);
-
-    op.cmd = FLASK_ACCESS;
-    op.buf = buf;
-    op.size = strlen(buf)+1;
-    
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-   
-    if (sscanf(op.buf, "%x %x %x %x %u",
-               allowed, decided,
-               auditallow, auditdeny,
-               seqno) != 5) {
-        err = -EILSEQ;
-    }
-
-    err = ((*allowed & req) == req)? 0 : -EPERM;
-
-    return err;
-
-}
-
-int flask_avc_hashstats(xc_interface *xc_handle, char *buf, int size)
-{
-    int err;
-    flask_op_t op;
-  
-    op.cmd = FLASK_AVC_HASHSTATS;
-    op.buf = buf;
-    op.size = size;
-  
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    return 0;
-}
-
-int flask_avc_cachestats(xc_interface *xc_handle, char *buf, int size)
-{
-    int err;
-    flask_op_t op;
-  
-    op.cmd = FLASK_AVC_CACHESTATS;
-    op.buf = buf;
-    op.size = size;
-  
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    return 0;
-}
-
-int flask_policyvers(xc_interface *xc_handle, char *buf, int size)
-{
-    int err;
-    flask_op_t op;
-  
-    op.cmd = FLASK_POLICYVERS;
-    op.buf = buf;
-    op.size = size;
-
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    return 0;
-}
-
-int flask_getavc_threshold(xc_interface *xc_handle)
-{
-    int err;
-    flask_op_t op;
-    char buf[20];            
-    int size = 20;
-    int threshold;
- 
-    op.cmd = FLASK_GETAVC_THRESHOLD;
-    op.buf = buf;
-    op.size = size;
-    
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-
-    sscanf(buf, "%i", &threshold);
-
-    return threshold;
-}
-
-int flask_setavc_threshold(xc_interface *xc_handle, int threshold)
-{
-    int err;
-    flask_op_t op;
-    char buf[20];            
-    int size = 20;
- 
-    op.cmd = FLASK_SETAVC_THRESHOLD;
-    op.buf = buf;
-    op.size = size;
-
-    snprintf(buf, size, "%i", threshold);
- 
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-
-    return 0;
-}
diff -r 158f9c38d95c -r c3cfc4d4534d tools/flask/libflask/include/libflask.h
--- a/tools/flask/libflask/include/libflask.h	Mon Feb 06 17:40:05 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- *
- *  Authors:  Michael LeMay, <mdlemay@epoch.ncsc.mil>
- *            George Coker, <gscoker@alpha.ncsc.mil>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2,
- *  as published by the Free Software Foundation.
- */
-
-#ifndef __LIBFLASK_H__
-#define __LIBFLASK_H__
-
-#include <stdint.h>
-#include <xen/xen.h>
-#include <xen/xsm/flask_op.h>
-#include <xenctrl.h>
-
-int flask_load(xc_interface *xc_handle, char *buf, uint32_t size);
-int flask_context_to_sid(xc_interface *xc_handle, char *buf, uint32_t size, uint32_t *sid);
-int flask_sid_to_context(xc_interface *xc_handle, int sid, char *buf, uint32_t size);
-int flask_getenforce(xc_interface *xc_handle);
-int flask_setenforce(xc_interface *xc_handle, int mode);
-int flask_getbool_byid(xc_interface *xc_handle, int id, char *name, int *curr, int *pend);
-int flask_getbool_byname(xc_interface *xc_handle, char *name, int *curr, int *pend);
-int flask_setbool(xc_interface *xc_handle, char *name, int value, int commit);
-int flask_add_pirq(xc_interface *xc_handle, unsigned int pirq, char *scontext);
-int flask_add_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high,
-                      char *scontext);
-int flask_add_iomem(xc_interface *xc_handle, unsigned long low, unsigned long high,
-                     char *scontext);
-int flask_add_device(xc_interface *xc_handle, unsigned long device, char *scontext);
-int flask_del_pirq(xc_interface *xc_handle, unsigned int pirq);
-int flask_del_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high);
-int flask_del_iomem(xc_interface *xc_handle, unsigned long low, unsigned long high);
-int flask_del_device(xc_interface *xc_handle, unsigned long device);
-int flask_access(xc_interface *xc_handle, const char *scon, const char *tcon,
-                  u_int16_t tclass, u_int32_t req,
-                  u_int32_t *allowed, u_int32_t *decided,
-                  u_int32_t *auditallow, u_int32_t *auditdeny,
-                  u_int32_t *seqno);
-int flask_avc_cachestats(xc_interface *xc_handle, char *buf, int size);
-int flask_policyvers(xc_interface *xc_handle, char *buf, int size);
-int flask_avc_hashstats(xc_interface *xc_handle, char *buf, int size);
-int flask_getavc_threshold(xc_interface *xc_handle);
-int flask_setavc_threshold(xc_interface *xc_handle, int threshold);
-#define flask_add_single_ioport(x, l, s) flask_add_ioport(x, l, l, s)
-#define flask_add_single_iomem(x, l, s) flask_add_iomem(x, l, l, s)
-#define flask_del_single_ioport(x, l) flask_del_ioport(x, l, l)
-#define flask_del_single_iomem(x, l) flask_del_iomem(x, l, l);
-
-#define OCON_PIRQ_STR   "pirq"
-#define OCON_IOPORT_STR "ioport"
-#define OCON_IOMEM_STR  "iomem"
-#define OCON_DEVICE_STR "pcidevice"
-#define INITCONTEXTLEN  256
-#endif /* __LIBFLASK_H__ */
diff -r 158f9c38d95c -r c3cfc4d4534d tools/flask/utils/Makefile
--- a/tools/flask/utils/Makefile	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/flask/utils/Makefile	Mon Feb 06 05:03:32 2012 -0800
@@ -1,11 +1,8 @@
 XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-LIBFLASK_ROOT = $(XEN_ROOT)/tools/flask/libflask
-
 CFLAGS += -Wall -g -Werror
 CFLAGS += $(CFLAGS_libxenctrl)
-CFLAGS += -I$(LIBFLASK_ROOT)/include
 
 TESTDIR  = testsuite/tmp
 TESTFLAGS= -DTESTING
@@ -19,22 +16,22 @@
 all: $(CLIENTS)
 
 flask-loadpolicy: loadpolicy.o
-	$(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@
+	$(CC) $(LDFLAGS) $< $(LDLIBS) $(LDLIBS_libxenctrl) -o $@
 
 flask-setenforce: setenforce.o
-	$(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@
+	$(CC) $(LDFLAGS) $< $(LDLIBS) $(LDLIBS_libxenctrl) -o $@
 
 flask-getenforce: getenforce.o
-	$(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@
+	$(CC) $(LDFLAGS) $< $(LDLIBS) $(LDLIBS_libxenctrl) -o $@
 
 flask-label-pci: label-pci.o
-	$(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@
+	$(CC) $(LDFLAGS) $< $(LDLIBS) $(LDLIBS_libxenctrl) -o $@
 
 flask-get-bool: get-bool.o
-	$(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@
+	$(CC) $(LDFLAGS) $< $(LDLIBS) $(LDLIBS_libxenctrl) -o $@
 
 flask-set-bool: set-bool.o
-	$(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@
+	$(CC) $(LDFLAGS) $< $(LDLIBS) $(LDLIBS_libxenctrl) -o $@
 
 .PHONY: clean
 clean: 
diff -r 158f9c38d95c -r c3cfc4d4534d tools/flask/utils/get-bool.c
--- a/tools/flask/utils/get-bool.c	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/flask/utils/get-bool.c	Mon Feb 06 05:03:32 2012 -0800
@@ -16,7 +16,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <inttypes.h>
-#include <libflask.h>
 
 static void usage(char **argv)
 {
@@ -29,11 +28,11 @@
 	int err = 0, i = 0, curr, pend;
 	char name[256];
 	while (1) {
-		err = flask_getbool_byid(xch, i, name, &curr, &pend);
+		err = xc_flask_getbool_byid(xch, i, name, sizeof name, &curr, &pend);
 		if (err < 0) {
 			if (errno == ENOENT)
 				return 0;
-			fprintf(stderr, "flask_getbool: Unable to get boolean #%d: %s (%d)",
+			fprintf(stderr, "xc_flask_getbool: Unable to get boolean #%d: %s (%d)",
 				i, strerror(errno), err);
 			return 2;
 		}
@@ -69,9 +68,9 @@
 		goto done;
 	}
 
-	err = flask_getbool_byname(xch, argv[1], &curr, &pend);
+	err = xc_flask_getbool_byname(xch, argv[1], &curr, &pend);
 	if (err) {
-		fprintf(stderr, "flask_getbool: Unable to get boolean %s: %s (%d)",
+		fprintf(stderr, "xc_flask_getbool: Unable to get boolean %s: %s (%d)",
 			argv[1], strerror(errno), err);
 		err = 2;
 		goto done;
diff -r 158f9c38d95c -r c3cfc4d4534d tools/flask/utils/getenforce.c
--- a/tools/flask/utils/getenforce.c	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/flask/utils/getenforce.c	Mon Feb 06 05:03:32 2012 -0800
@@ -16,7 +16,6 @@
 #include <sys/stat.h>
 #include <string.h>
 #include <unistd.h>
-#include <libflask.h>
 
 static void usage (int argCnt, const char *args[])
 {
@@ -41,7 +40,7 @@
         goto done;
     }
 
-    ret = flask_getenforce(xch);
+    ret = xc_flask_getenforce(xch);
     if ( ret < 0 )
     {
         errno = -ret;
diff -r 158f9c38d95c -r c3cfc4d4534d tools/flask/utils/label-pci.c
--- a/tools/flask/utils/label-pci.c	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/flask/utils/label-pci.c	Mon Feb 06 05:03:32 2012 -0800
@@ -16,7 +16,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <inttypes.h>
-#include <libflask.h>
 
 /* Pulled from linux/include/linux/ioport.h */
 #define IORESOURCE_TYPE_BITS    0x00001f00  /* Resource type */
@@ -69,9 +68,9 @@
 		goto done;
 	}
 
-	ret = flask_add_device(xch, sbdf, argv[2]);
+	ret = xc_flask_add_device(xch, sbdf, argv[2]);
 	if (ret) {
-		fprintf(stderr, "flask_add_device: Unable to set context of PCI device %s (0x%x) to %s: %d\n",
+		fprintf(stderr, "xc_flask_add_device: Unable to set context of PCI device %s (0x%x) to %s: %d\n",
 			argv[1], sbdf, argv[2], ret);
 		err = 2;
 		goto done;
@@ -80,9 +79,9 @@
 	while (fscanf(f, "0x%"SCNx64" 0x%"SCNx64" 0x%"SCNx64"\n", &start, &end, &flags) == 3) {
 		if (flags & IORESOURCE_IO) {
 			// printf("Port %"PRIx64"-%"PRIx64"\n", start, end);
-			ret = flask_add_ioport(xch, start, end, argv[2]);
+			ret = xc_flask_add_ioport(xch, start, end, argv[2]);
 			if (ret) {
-				fprintf(stderr, "flask_add_ioport %"PRIx64"-%"PRIx64" failed: %d\n",
+				fprintf(stderr, "xc_flask_add_ioport %"PRIx64"-%"PRIx64" failed: %d\n",
 						start, end, ret);
 				err = 2;
 			}
@@ -90,9 +89,9 @@
 			start >>= 12;
 			end >>= 12;
 			// printf("IOMEM %"PRIx64"-%"PRIx64"\n", start, end);
-			ret = flask_add_iomem(xch, start, end, argv[2]);
+			ret = xc_flask_add_iomem(xch, start, end, argv[2]);
 			if (ret) {
-				fprintf(stderr, "flask_add_iomem %"PRIx64"-%"PRIx64" failed: %d\n",
+				fprintf(stderr, "xc_flask_add_iomem %"PRIx64"-%"PRIx64" failed: %d\n",
 						start, end, ret);
 				err = 2;
 			}
@@ -108,9 +107,9 @@
 	if (fscanf(f, "%" SCNu64, &start) != 1)
 		start = 0;
 	if (start) {
-		ret = flask_add_pirq(xch, start, argv[2]);
+		ret = xc_flask_add_pirq(xch, start, argv[2]);
 		if (ret) {
-			fprintf(stderr, "flask_add_pirq %"PRIu64" failed: %d\n",
+			fprintf(stderr, "xc_flask_add_pirq %"PRIu64" failed: %d\n",
 					start, ret);
 			err = 2;
 		}
diff -r 158f9c38d95c -r c3cfc4d4534d tools/flask/utils/loadpolicy.c
--- a/tools/flask/utils/loadpolicy.c	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/flask/utils/loadpolicy.c	Mon Feb 06 05:03:32 2012 -0800
@@ -17,7 +17,6 @@
 #include <sys/stat.h>
 #include <string.h>
 #include <unistd.h>
-#include <libflask.h>
 
 #define USE_MMAP
 
@@ -94,7 +93,7 @@
     }
 #endif
 
-    ret = flask_load(xch, polMemCp, info.st_size);
+    ret = xc_flask_load(xch, polMemCp, info.st_size);
     if ( ret < 0 )
     {
         errno = -ret;
diff -r 158f9c38d95c -r c3cfc4d4534d tools/flask/utils/set-bool.c
--- a/tools/flask/utils/set-bool.c	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/flask/utils/set-bool.c	Mon Feb 06 05:03:32 2012 -0800
@@ -16,7 +16,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <inttypes.h>
-#include <libflask.h>
 
 static void usage(char **argv)
 {
@@ -56,9 +55,9 @@
 		goto done;
 	}
 
-	err = flask_setbool(xch, argv[1], value, 1);
+	err = xc_flask_setbool(xch, argv[1], value, 1);
 	if (err) {
-		fprintf(stderr, "flask_setbool: Unable to set boolean %s=%s: %s (%d)",
+		fprintf(stderr, "xc_flask_setbool: Unable to set boolean %s=%s: %s (%d)",
 			argv[1], argv[2], strerror(errno), err);
 		err = 2;
 		goto done;
diff -r 158f9c38d95c -r c3cfc4d4534d tools/flask/utils/setenforce.c
--- a/tools/flask/utils/setenforce.c	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/flask/utils/setenforce.c	Mon Feb 06 05:03:32 2012 -0800
@@ -16,7 +16,6 @@
 #include <sys/stat.h>
 #include <string.h>
 #include <unistd.h>
-#include <libflask.h>
 
 static void usage (int argCnt, const char *args[])
 {
@@ -45,12 +44,12 @@
 
     if( strlen(args[1]) == 1 && (args[1][0] == '0' || args[1][0] == '1')){
         mode = strtol(args[1], &end, 10);
-        ret = flask_setenforce(xch, mode);
+        ret = xc_flask_setenforce(xch, mode);
     } else {
         if( strcasecmp(args[1], "enforcing") == 0 ){
-            ret = flask_setenforce(xch, 1);
+            ret = xc_flask_setenforce(xch, 1);
         } else if( strcasecmp(args[1], "permissive") == 0 ){
-            ret = flask_setenforce(xch, 0);
+            ret = xc_flask_setenforce(xch, 0);
         } else {
             usage(argCnt, args);
         }
diff -r 158f9c38d95c -r c3cfc4d4534d tools/libxc/xc_flask.c
--- a/tools/libxc/xc_flask.c	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/libxc/xc_flask.c	Mon Feb 06 05:03:32 2012 -0800
@@ -151,6 +151,65 @@
     return 0;
 }
 
+int xc_flask_getbool_byid(xc_interface *xc_handle, int id, char *name, uint32_t size, int *curr, int *pend)
+{
+    flask_op_t op;
+    char buf[255];
+    int rv;
+
+    op.cmd = FLASK_GETBOOL2;
+    op.buf = buf;
+    op.size = 255;
+
+    snprintf(buf, sizeof buf, "%i", id);
+
+    rv = xc_flask_op(xc_handle, &op);
+
+    if ( rv )
+        return rv;
+    
+    sscanf(buf, "%i %i %s", curr, pend, name);
+
+    return rv;
+}
+
+int xc_flask_getbool_byname(xc_interface *xc_handle, char *name, int *curr, int *pend)
+{
+    flask_op_t op;
+    char buf[255];
+    int rv;
+
+    op.cmd = FLASK_GETBOOL_NAMED;
+    op.buf = buf;
+    op.size = 255;
+
+    strncpy(buf, name, op.size);
+
+    rv = xc_flask_op(xc_handle, &op);
+
+    if ( rv )
+        return rv;
+    
+    sscanf(buf, "%i %i", curr, pend);
+
+    return rv;
+}
+
+int xc_flask_setbool(xc_interface *xc_handle, char *name, int value, int commit)
+{
+    flask_op_t op;
+    char buf[255];
+    int size = 255;
+
+    op.cmd = FLASK_SETBOOL_NAMED;
+    op.buf = buf;
+    op.size = size;
+
+    snprintf(buf, size, "%s %i %i", name, value, commit);
+
+    return xc_flask_op(xc_handle, &op);
+}
+
 static int xc_flask_add(xc_interface *xc_handle, char *cat, char *arg, char *scontext)
 {
     char buf[512];
diff -r 158f9c38d95c -r c3cfc4d4534d tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/libxc/xenctrl.h	Mon Feb 06 05:03:32 2012 -0800
@@ -1955,6 +1955,9 @@
 int xc_flask_sid_to_context(xc_interface *xc_handle, int sid, char *buf, uint32_t size);
 int xc_flask_getenforce(xc_interface *xc_handle);
 int xc_flask_setenforce(xc_interface *xc_handle, int mode);
+int xc_flask_getbool_byid(xc_interface *xc_handle, int id, char *name, uint32_t size, int *curr, int *pend);
+int xc_flask_getbool_byname(xc_interface *xc_handle, char *name, int *curr, int *pend);
+int xc_flask_setbool(xc_interface *xc_handle, char *name, int value, int commit);
 int xc_flask_add_pirq(xc_interface *xc_handle, unsigned int pirq, char *scontext);
 int xc_flask_add_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high,
                       char *scontext);
diff -r 158f9c38d95c -r c3cfc4d4534d tools/python/setup.py
--- a/tools/python/setup.py	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/python/setup.py	Mon Feb 06 05:03:32 2012 -0800
@@ -48,7 +48,7 @@
                include_dirs       = [ PATH_XEN, PATH_LIBXC, "xen/lowlevel/flask",
                                       "../flask/libflask/include" ],
                library_dirs       = [ PATH_LIBXC, "../flask/libflask" ],
-               libraries          = [ "xenctrl", "flask" ],
+               libraries          = [ "xenctrl" ],
                depends            = [ PATH_LIBXC + "/libxenctrl.so",
                                       XEN_ROOT + "/tools/flask/libflask/libflask.so" ],
                sources            = [ "xen/lowlevel/flask/flask.c" ])
diff -r 158f9c38d95c -r c3cfc4d4534d tools/python/xen/lowlevel/flask/flask.c
--- a/tools/python/xen/lowlevel/flask/flask.c	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/python/xen/lowlevel/flask/flask.c	Mon Feb 06 05:03:32 2012 -0800
@@ -12,7 +12,6 @@
 
 #include <Python.h>
 #include <xenctrl.h>
-#include <libflask.h>
 
 #define PKG "xen.lowlevel.flask"
 #define CLS "flask"
@@ -58,7 +57,7 @@
         return PyErr_SetFromErrno(xc_error_obj);
     }
     
-    ret = flask_context_to_sid(xc_handle, buf, len, &sid);
+    ret = xc_flask_context_to_sid(xc_handle, buf, len, &sid);
         
     xc_interface_close(xc_handle);
 
@@ -92,7 +91,7 @@
         return PyErr_SetFromErrno(xc_error_obj);
     }
     
-    ret = flask_sid_to_context(xc_handle, sid, ctx, ctx_len);
+    ret = xc_flask_sid_to_context(xc_handle, sid, ctx, ctx_len);
     
     xc_interface_close(xc_handle);
     
@@ -121,7 +120,7 @@
         return PyErr_SetFromErrno(xc_error_obj);
     }
 
-    ret = flask_load(xc_handle, policy, len);
+    ret = xc_flask_load(xc_handle, policy, len);
 
     xc_interface_close(xc_handle);
 
@@ -143,7 +142,7 @@
         return PyErr_SetFromErrno(xc_error_obj);
     }
     
-    ret = flask_getenforce(xc_handle);
+    ret = xc_flask_getenforce(xc_handle);
     
     xc_interface_close(xc_handle);
     
@@ -173,7 +172,7 @@
         return PyErr_SetFromErrno(xc_error_obj);
     }
     
-    ret = flask_setenforce(xc_handle, mode);
+    ret = xc_flask_setenforce(xc_handle, mode);
     
     xc_interface_close(xc_handle);
     
@@ -209,7 +208,7 @@
         return PyErr_SetFromErrno(xc_error_obj);
     }
     
-    ret = flask_access(xc_handle, scon, tcon, tclass, req, &allowed, &decided,
+    ret = xc_flask_access(xc_handle, scon, tcon, tclass, req, &allowed, &decided,
                         &auditallow, &auditdeny, &seqno);
         
     xc_interface_close(xc_handle);

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 07 04:33:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Feb 2012 04:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ruck3-0005OO-MR; Tue, 07 Feb 2012 04:33:19 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Ruck1-0005Nc-VD
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-174.messagelabs.com!1328589189!12104222!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10670 invoked from network); 7 Feb 2012 04:33:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Feb 2012 04:33:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjs-0001F9-LY
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjs-00065N-6n
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:08 +0000
Message-Id: <E1Rucjs-00065N-6n@xenbits.xen.org>
Date: Tue, 07 Feb 2012 04:33:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/flask: remove libflask
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328533412 28800
# Node ID c3cfc4d4534daf327b237714ff9834039e80d0fc
# Parent  158f9c38d95c19667057beccf35a9d7f704d0df5
tools/flask: remove libflask

This library has been deprecated since July 2010; remove the in-tree
users and library.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 158f9c38d95c -r c3cfc4d4534d tools/flask/Makefile
--- a/tools/flask/Makefile	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/flask/Makefile	Mon Feb 06 05:03:32 2012 -0800
@@ -2,7 +2,6 @@
 include $(XEN_ROOT)/tools/Rules.mk
 
 SUBDIRS :=
-SUBDIRS += libflask
 SUBDIRS += utils
 
 .PHONY: all clean install
diff -r 158f9c38d95c -r c3cfc4d4534d tools/flask/libflask/Makefile
--- a/tools/flask/libflask/Makefile	Mon Feb 06 17:40:05 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-MAJOR    = 1.0
-MINOR    = 0
-
-XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/Rules.mk
-
-SRCS       :=
-SRCS       += flask_op.c
-
-CFLAGS   += -Werror
-CFLAGS   += -fno-strict-aliasing
-CFLAGS   += -I./include $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude)
-
-LIB_OBJS := $(patsubst %.c,%.o,$(SRCS))
-PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS))
-
-LIB := libflask.a
-LIB += libflask.so libflask.so.$(MAJOR) libflask.so.$(MAJOR).$(MINOR)
-
-.PHONY: all
-all: build
-
-.PHONY: build
-build:
-	$(MAKE) $(LIB)
-
-.PHONY: install
-install: build
-	$(INSTALL_DIR) $(DESTDIR)$(LIBDIR)
-	$(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)
-	$(INSTALL_PROG) libflask.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)
-	$(INSTALL_DATA) libflask.a $(DESTDIR)$(LIBDIR)
-	ln -sf libflask.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libflask.so.$(MAJOR)
-	ln -sf libflask.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libflask.so
-	$(INSTALL_DATA) include/libflask.h $(DESTDIR)$(INCLUDEDIR)/xen/xsm
-
-.PHONY: TAGS
-TAGS:
-	etags -t *.c *.h
-
-.PHONY: clean
-clean:
-	rm -rf *.a *.so* *.o *.opic *.rpm $(LIB) *~ $(DEPS) xen
-
-# libflask
-
-libflask.a: $(LIB_OBJS)
-	$(AR) rc $@ $^
-
-libflask.so: libflask.so.$(MAJOR)
-	ln -sf $< $@
-libflask.so.$(MAJOR): libflask.so.$(MAJOR).$(MINOR)
-	ln -sf $< $@
-
-libflask.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
-	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libflask.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LDLIBS_libxenctrl)
-
--include $(DEPS)
diff -r 158f9c38d95c -r c3cfc4d4534d tools/flask/libflask/flask_op.c
--- a/tools/flask/libflask/flask_op.c	Mon Feb 06 17:40:05 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,559 +0,0 @@
-/*
- *
- *  Authors:  Michael LeMay, <mdlemay@epoch.ncsc.mil>
- *            George Coker, <gscoker@alpha.ncsc.mil>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2,
- *  as published by the Free Software Foundation.
- */
-
-#include <unistd.h>
-#include <stdio.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <sys/ioctl.h>
-#include <libflask.h>
-
-int flask_load(xc_interface *xc_handle, char *buf, uint32_t size)
-{
-    int err;
-    flask_op_t op;
-    
-    op.cmd = FLASK_LOAD;
-    op.buf = buf;
-    op.size = size;
-    
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-
-    return 0;
-}
-
-int flask_context_to_sid(xc_interface *xc_handle, char *buf, uint32_t size, uint32_t *sid)
-{
-    int err;
-    flask_op_t op;
-    
-    op.cmd = FLASK_CONTEXT_TO_SID;
-    op.buf = buf;
-    op.size = size;
-    
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-    
-    sscanf(buf, "%u", sid);
-
-    return 0;
-}
-
-int flask_sid_to_context(xc_interface *xc_handle, int sid, char *buf, uint32_t size)
-{
-    int err;
-    flask_op_t op;
-    
-    op.cmd = FLASK_SID_TO_CONTEXT;
-    op.buf = buf;
-    op.size = size;
-    
-    snprintf(buf, size, "%u", sid);
-
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-
-    return 0;
-}
-
-int flask_getenforce(xc_interface *xc_handle)
-{
-    int err;
-    flask_op_t op;
-    char buf[20];            
-    int size = 20;
-    int mode;
- 
-    op.cmd = FLASK_GETENFORCE;
-    op.buf = buf;
-    op.size = size;
-    
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-
-    sscanf(buf, "%i", &mode);
-
-    return mode;
-}
-
-int flask_setenforce(xc_interface *xc_handle, int mode)
-{
-    int err;
-    flask_op_t op;
-    char buf[20];
-    int size = 20; 
- 
-    op.cmd = FLASK_SETENFORCE;
-    op.buf = buf;
-    op.size = size;
-   
-    snprintf(buf, size, "%i", mode);
- 
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-
-    return 0;
-}
-
-int flask_getbool_byid(xc_interface *xc_handle, int id, char *name, int *curr, int *pend)
-{
-    flask_op_t op;
-    char buf[255];
-    int rv;
-
-    op.cmd = FLASK_GETBOOL2;
-    op.buf = buf;
-    op.size = 255;
-
-    snprintf(buf, sizeof buf, "%i", id);
-
-    rv = xc_flask_op(xc_handle, &op);
-
-    if ( rv )
-        return rv;
-    
-    sscanf(buf, "%i %i %s", curr, pend, name);
-
-    return rv;
-}
-
-int flask_getbool_byname(xc_interface *xc_handle, char *name, int *curr, int *pend)
-{
-    flask_op_t op;
-    char buf[255];
-    int rv;
-
-    op.cmd = FLASK_GETBOOL_NAMED;
-    op.buf = buf;
-    op.size = 255;
-
-    strncpy(buf, name, op.size);
-
-    rv = xc_flask_op(xc_handle, &op);
-
-    if ( rv )
-        return rv;
-    
-    sscanf(buf, "%i %i", curr, pend);
-
-    return rv;
-}
-
-int flask_setbool(xc_interface *xc_handle, char *name, int value, int commit)
-{
-    flask_op_t op;
-    char buf[255];
-    int size = 255;
-
-    op.cmd = FLASK_SETBOOL_NAMED;
-    op.buf = buf;
-    op.size = size;
-
-    snprintf(buf, size, "%s %i %i", name, value, commit);
-
-    return xc_flask_op(xc_handle, &op);
-}
-
-int flask_add_pirq(xc_interface *xc_handle, unsigned int pirq, char *scontext)
-{
-    int err;
-    flask_op_t op;
-    char *buf;
-    char *pirq_s = OCON_PIRQ_STR;
-    int size = INITCONTEXTLEN + strlen(pirq_s) + (sizeof(unsigned int)) +
-                (sizeof(char) * 3);
-
-    if ( (buf = (char *) malloc(size)) == NULL )
-        return -ENOMEM;
-    memset(buf, 0, size);
-
-    op.cmd = FLASK_ADD_OCONTEXT;
-    snprintf(buf, size, "%s %255s %u", pirq_s, scontext, pirq);
-    op.buf = buf;
-    op.size = size;
-
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    free(buf);
-    return 0;
-
-}
-
-int flask_add_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high,
-                      char *scontext)
-{
-    int err;
-    flask_op_t op;
-    char *buf;
-    char *ioport = OCON_IOPORT_STR;
-    int size = INITCONTEXTLEN + strlen(ioport) +
-                (sizeof(unsigned long) * 2) + (sizeof(char) * 4);
-
-    if ( (buf = (char *) malloc(size)) == NULL )
-        return -ENOMEM;
-    memset(buf, 0, size);
-
-    op.cmd = FLASK_ADD_OCONTEXT;
-    snprintf(buf, size, "%s %255s %lu %lu", ioport, scontext, low, high);
-    op.buf = buf;
-    op.size = size;
-
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    free(buf);
-    return 0;
-
-}
-
-int flask_add_iomem(xc_interface *xc_handle, unsigned long low, unsigned long high,
-                     char *scontext)
-{
-    int err;
-    flask_op_t op;
-    char *buf;
-    char *iomem = OCON_IOMEM_STR;
-    int size = INITCONTEXTLEN + strlen(iomem) +
-                (sizeof(unsigned long) * 2) + (sizeof(char) * 4);
-
-    if ( (buf = (char *) malloc(size)) == NULL )
-        return -ENOMEM;
-    memset(buf, 0, size);
-
-    op.cmd = FLASK_ADD_OCONTEXT;
-    snprintf(buf, size, "%s %255s %lu %lu", iomem, scontext, low, high);
-    op.buf = buf;
-    op.size = size;
-
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    free(buf);
-    return 0;
-
-}
-
-int flask_add_device(xc_interface *xc_handle, unsigned long device, char *scontext)
-{
-    int err;
-    flask_op_t op;
-    char *buf;
-    char *dev = OCON_DEVICE_STR;
-    int size = INITCONTEXTLEN + strlen(dev) + (sizeof(unsigned long)) +
-                (sizeof(char) * 3);
-
-    if ( (buf = (char *) malloc(size)) == NULL )
-        return -ENOMEM;
-    memset(buf, 0, size);
-
-    op.cmd = FLASK_ADD_OCONTEXT;
-    snprintf(buf, size, "%s %255s %lu", dev, scontext, device);
-    op.buf = buf;
-    op.size = size;
-
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    free(buf);
-    return 0;
-
-}
-
-int flask_del_pirq(xc_interface *xc_handle, unsigned int pirq)
-{
-    int err;
-    flask_op_t op;
-    char *buf;
-    char *pirq_s = OCON_PIRQ_STR;
-    int size = strlen(pirq_s) + (sizeof(unsigned int)) +
-                (sizeof(char) * 2);
-
-    if ( (buf = (char *) malloc(size)) == NULL )
-        return -ENOMEM;
-    memset(buf, 0, size);
-
-    op.cmd = FLASK_DEL_OCONTEXT;
-    snprintf(buf, size, "%s %u", pirq_s, pirq);
-    op.buf = buf;
-    op.size = size;
-
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    free(buf);
-    return 0;
-
-}
-
-int flask_del_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high)
-{
-    int err;
-    flask_op_t op;
-    char *buf;
-    char *ioport = OCON_IOPORT_STR;
-    int size = strlen(ioport) + (sizeof(unsigned long) * 2) +
-                (sizeof(char) * 3);
-
-    if ( (buf = (char *) malloc(size)) == NULL )
-        return -ENOMEM;
-    memset(buf, 0, size);
-
-    op.cmd = FLASK_DEL_OCONTEXT;
-    snprintf(buf, size, "%s %lu %lu", ioport, low, high);
-    op.buf = buf;
-    op.size = size;
-
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    free(buf);
-    return 0;
-
-}
-
-int flask_del_iomem(xc_interface *xc_handle, unsigned long low, unsigned long high)
-{
-    int err;
-    flask_op_t op;
-    char *buf;
-    char *iomem = OCON_IOMEM_STR;
-    int size = strlen(iomem) + (sizeof(unsigned long) * 2) +
-                (sizeof(char) * 3);
-
-    if ( (buf = (char *) malloc(size)) == NULL )
-        return -ENOMEM;
-    memset(buf, 0, size);
-
-    op.cmd = FLASK_DEL_OCONTEXT;
-    snprintf(buf, size, "%s %lu %lu", iomem, low, high);
-    op.buf = buf;
-    op.size = size;
-
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    free(buf);
-    return 0;
-
-}
-
-int flask_del_device(xc_interface *xc_handle, unsigned long device)
-{
-    int err;
-    flask_op_t op;
-    char *buf;
-    char *dev = OCON_DEVICE_STR;
-    int size = strlen(dev) + (sizeof(unsigned long)) + (sizeof(char) * 2);
-
-    if ( (buf = (char *) malloc(size)) == NULL )
-        return -ENOMEM;
-    memset(buf, 0, size);
-
-    op.cmd = FLASK_DEL_OCONTEXT;
-    snprintf(buf, size, "%s %lu", dev, device);
-    op.buf = buf;
-    op.size = size;
-
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    free(buf);
-    return 0;
-
-}
-
-int flask_access(xc_interface *xc_handle, const char *scon, const char *tcon,
-                u_int16_t tclass, u_int32_t req,
-                u_int32_t *allowed, u_int32_t *decided,
-                u_int32_t *auditallow, u_int32_t *auditdeny,
-                u_int32_t *seqno)
-{
-/* maximum number of digits in a 16-bit decimal number: */
-#define MAX_SHORT_DEC_LEN 5
-
-    char *buf;
-    int bufLen;
-    int err;
-    flask_op_t op;
-    u_int32_t dummy_allowed;
-    u_int32_t dummy_decided;
-    u_int32_t dummy_auditallow;
-    u_int32_t dummy_auditdeny;
-    u_int32_t dummy_seqno;
-  
-    if (!allowed)
-        allowed = &dummy_allowed;
-    if (!decided)
-        decided = &dummy_decided;
-    if (!auditallow)
-        auditallow = &dummy_auditallow;
-    if (!auditdeny)
-        auditdeny = &dummy_auditdeny;
-    if (!seqno)
-        seqno = &dummy_seqno;
-
-    if (!scon)
-        return -EINVAL;
-    if (!tcon)
-        return -EINVAL;
-
-    bufLen = strlen(scon) + 1 + strlen(tcon) + 1 +
-        MAX_SHORT_DEC_LEN + 1 +
-        sizeof(req)*2 + 1;
-    buf = malloc(bufLen);
-    snprintf(buf, bufLen, "%s %s %hu %x", scon, tcon, tclass, req);
-
-    op.cmd = FLASK_ACCESS;
-    op.buf = buf;
-    op.size = strlen(buf)+1;
-    
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-   
-    if (sscanf(op.buf, "%x %x %x %x %u",
-               allowed, decided,
-               auditallow, auditdeny,
-               seqno) != 5) {
-        err = -EILSEQ;
-    }
-
-    err = ((*allowed & req) == req)? 0 : -EPERM;
-
-    return err;
-
-}
-
-int flask_avc_hashstats(xc_interface *xc_handle, char *buf, int size)
-{
-    int err;
-    flask_op_t op;
-  
-    op.cmd = FLASK_AVC_HASHSTATS;
-    op.buf = buf;
-    op.size = size;
-  
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    return 0;
-}
-
-int flask_avc_cachestats(xc_interface *xc_handle, char *buf, int size)
-{
-    int err;
-    flask_op_t op;
-  
-    op.cmd = FLASK_AVC_CACHESTATS;
-    op.buf = buf;
-    op.size = size;
-  
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    return 0;
-}
-
-int flask_policyvers(xc_interface *xc_handle, char *buf, int size)
-{
-    int err;
-    flask_op_t op;
-  
-    op.cmd = FLASK_POLICYVERS;
-    op.buf = buf;
-    op.size = size;
-
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    return 0;
-}
-
-int flask_getavc_threshold(xc_interface *xc_handle)
-{
-    int err;
-    flask_op_t op;
-    char buf[20];            
-    int size = 20;
-    int threshold;
- 
-    op.cmd = FLASK_GETAVC_THRESHOLD;
-    op.buf = buf;
-    op.size = size;
-    
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-
-    sscanf(buf, "%i", &threshold);
-
-    return threshold;
-}
-
-int flask_setavc_threshold(xc_interface *xc_handle, int threshold)
-{
-    int err;
-    flask_op_t op;
-    char buf[20];            
-    int size = 20;
- 
-    op.cmd = FLASK_SETAVC_THRESHOLD;
-    op.buf = buf;
-    op.size = size;
-
-    snprintf(buf, size, "%i", threshold);
- 
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-
-    return 0;
-}
diff -r 158f9c38d95c -r c3cfc4d4534d tools/flask/libflask/include/libflask.h
--- a/tools/flask/libflask/include/libflask.h	Mon Feb 06 17:40:05 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- *
- *  Authors:  Michael LeMay, <mdlemay@epoch.ncsc.mil>
- *            George Coker, <gscoker@alpha.ncsc.mil>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2,
- *  as published by the Free Software Foundation.
- */
-
-#ifndef __LIBFLASK_H__
-#define __LIBFLASK_H__
-
-#include <stdint.h>
-#include <xen/xen.h>
-#include <xen/xsm/flask_op.h>
-#include <xenctrl.h>
-
-int flask_load(xc_interface *xc_handle, char *buf, uint32_t size);
-int flask_context_to_sid(xc_interface *xc_handle, char *buf, uint32_t size, uint32_t *sid);
-int flask_sid_to_context(xc_interface *xc_handle, int sid, char *buf, uint32_t size);
-int flask_getenforce(xc_interface *xc_handle);
-int flask_setenforce(xc_interface *xc_handle, int mode);
-int flask_getbool_byid(xc_interface *xc_handle, int id, char *name, int *curr, int *pend);
-int flask_getbool_byname(xc_interface *xc_handle, char *name, int *curr, int *pend);
-int flask_setbool(xc_interface *xc_handle, char *name, int value, int commit);
-int flask_add_pirq(xc_interface *xc_handle, unsigned int pirq, char *scontext);
-int flask_add_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high,
-                      char *scontext);
-int flask_add_iomem(xc_interface *xc_handle, unsigned long low, unsigned long high,
-                     char *scontext);
-int flask_add_device(xc_interface *xc_handle, unsigned long device, char *scontext);
-int flask_del_pirq(xc_interface *xc_handle, unsigned int pirq);
-int flask_del_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high);
-int flask_del_iomem(xc_interface *xc_handle, unsigned long low, unsigned long high);
-int flask_del_device(xc_interface *xc_handle, unsigned long device);
-int flask_access(xc_interface *xc_handle, const char *scon, const char *tcon,
-                  u_int16_t tclass, u_int32_t req,
-                  u_int32_t *allowed, u_int32_t *decided,
-                  u_int32_t *auditallow, u_int32_t *auditdeny,
-                  u_int32_t *seqno);
-int flask_avc_cachestats(xc_interface *xc_handle, char *buf, int size);
-int flask_policyvers(xc_interface *xc_handle, char *buf, int size);
-int flask_avc_hashstats(xc_interface *xc_handle, char *buf, int size);
-int flask_getavc_threshold(xc_interface *xc_handle);
-int flask_setavc_threshold(xc_interface *xc_handle, int threshold);
-#define flask_add_single_ioport(x, l, s) flask_add_ioport(x, l, l, s)
-#define flask_add_single_iomem(x, l, s) flask_add_iomem(x, l, l, s)
-#define flask_del_single_ioport(x, l) flask_del_ioport(x, l, l)
-#define flask_del_single_iomem(x, l) flask_del_iomem(x, l, l);
-
-#define OCON_PIRQ_STR   "pirq"
-#define OCON_IOPORT_STR "ioport"
-#define OCON_IOMEM_STR  "iomem"
-#define OCON_DEVICE_STR "pcidevice"
-#define INITCONTEXTLEN  256
-#endif /* __LIBFLASK_H__ */
diff -r 158f9c38d95c -r c3cfc4d4534d tools/flask/utils/Makefile
--- a/tools/flask/utils/Makefile	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/flask/utils/Makefile	Mon Feb 06 05:03:32 2012 -0800
@@ -1,11 +1,8 @@
 XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-LIBFLASK_ROOT = $(XEN_ROOT)/tools/flask/libflask
-
 CFLAGS += -Wall -g -Werror
 CFLAGS += $(CFLAGS_libxenctrl)
-CFLAGS += -I$(LIBFLASK_ROOT)/include
 
 TESTDIR  = testsuite/tmp
 TESTFLAGS= -DTESTING
@@ -19,22 +16,22 @@
 all: $(CLIENTS)
 
 flask-loadpolicy: loadpolicy.o
-	$(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@
+	$(CC) $(LDFLAGS) $< $(LDLIBS) $(LDLIBS_libxenctrl) -o $@
 
 flask-setenforce: setenforce.o
-	$(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@
+	$(CC) $(LDFLAGS) $< $(LDLIBS) $(LDLIBS_libxenctrl) -o $@
 
 flask-getenforce: getenforce.o
-	$(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@
+	$(CC) $(LDFLAGS) $< $(LDLIBS) $(LDLIBS_libxenctrl) -o $@
 
 flask-label-pci: label-pci.o
-	$(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@
+	$(CC) $(LDFLAGS) $< $(LDLIBS) $(LDLIBS_libxenctrl) -o $@
 
 flask-get-bool: get-bool.o
-	$(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@
+	$(CC) $(LDFLAGS) $< $(LDLIBS) $(LDLIBS_libxenctrl) -o $@
 
 flask-set-bool: set-bool.o
-	$(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@
+	$(CC) $(LDFLAGS) $< $(LDLIBS) $(LDLIBS_libxenctrl) -o $@
 
 .PHONY: clean
 clean: 
diff -r 158f9c38d95c -r c3cfc4d4534d tools/flask/utils/get-bool.c
--- a/tools/flask/utils/get-bool.c	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/flask/utils/get-bool.c	Mon Feb 06 05:03:32 2012 -0800
@@ -16,7 +16,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <inttypes.h>
-#include <libflask.h>
 
 static void usage(char **argv)
 {
@@ -29,11 +28,11 @@
 	int err = 0, i = 0, curr, pend;
 	char name[256];
 	while (1) {
-		err = flask_getbool_byid(xch, i, name, &curr, &pend);
+		err = xc_flask_getbool_byid(xch, i, name, sizeof name, &curr, &pend);
 		if (err < 0) {
 			if (errno == ENOENT)
 				return 0;
-			fprintf(stderr, "flask_getbool: Unable to get boolean #%d: %s (%d)",
+			fprintf(stderr, "xc_flask_getbool: Unable to get boolean #%d: %s (%d)",
 				i, strerror(errno), err);
 			return 2;
 		}
@@ -69,9 +68,9 @@
 		goto done;
 	}
 
-	err = flask_getbool_byname(xch, argv[1], &curr, &pend);
+	err = xc_flask_getbool_byname(xch, argv[1], &curr, &pend);
 	if (err) {
-		fprintf(stderr, "flask_getbool: Unable to get boolean %s: %s (%d)",
+		fprintf(stderr, "xc_flask_getbool: Unable to get boolean %s: %s (%d)",
 			argv[1], strerror(errno), err);
 		err = 2;
 		goto done;
diff -r 158f9c38d95c -r c3cfc4d4534d tools/flask/utils/getenforce.c
--- a/tools/flask/utils/getenforce.c	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/flask/utils/getenforce.c	Mon Feb 06 05:03:32 2012 -0800
@@ -16,7 +16,6 @@
 #include <sys/stat.h>
 #include <string.h>
 #include <unistd.h>
-#include <libflask.h>
 
 static void usage (int argCnt, const char *args[])
 {
@@ -41,7 +40,7 @@
         goto done;
     }
 
-    ret = flask_getenforce(xch);
+    ret = xc_flask_getenforce(xch);
     if ( ret < 0 )
     {
         errno = -ret;
diff -r 158f9c38d95c -r c3cfc4d4534d tools/flask/utils/label-pci.c
--- a/tools/flask/utils/label-pci.c	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/flask/utils/label-pci.c	Mon Feb 06 05:03:32 2012 -0800
@@ -16,7 +16,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <inttypes.h>
-#include <libflask.h>
 
 /* Pulled from linux/include/linux/ioport.h */
 #define IORESOURCE_TYPE_BITS    0x00001f00  /* Resource type */
@@ -69,9 +68,9 @@
 		goto done;
 	}
 
-	ret = flask_add_device(xch, sbdf, argv[2]);
+	ret = xc_flask_add_device(xch, sbdf, argv[2]);
 	if (ret) {
-		fprintf(stderr, "flask_add_device: Unable to set context of PCI device %s (0x%x) to %s: %d\n",
+		fprintf(stderr, "xc_flask_add_device: Unable to set context of PCI device %s (0x%x) to %s: %d\n",
 			argv[1], sbdf, argv[2], ret);
 		err = 2;
 		goto done;
@@ -80,9 +79,9 @@
 	while (fscanf(f, "0x%"SCNx64" 0x%"SCNx64" 0x%"SCNx64"\n", &start, &end, &flags) == 3) {
 		if (flags & IORESOURCE_IO) {
 			// printf("Port %"PRIx64"-%"PRIx64"\n", start, end);
-			ret = flask_add_ioport(xch, start, end, argv[2]);
+			ret = xc_flask_add_ioport(xch, start, end, argv[2]);
 			if (ret) {
-				fprintf(stderr, "flask_add_ioport %"PRIx64"-%"PRIx64" failed: %d\n",
+				fprintf(stderr, "xc_flask_add_ioport %"PRIx64"-%"PRIx64" failed: %d\n",
 						start, end, ret);
 				err = 2;
 			}
@@ -90,9 +89,9 @@
 			start >>= 12;
 			end >>= 12;
 			// printf("IOMEM %"PRIx64"-%"PRIx64"\n", start, end);
-			ret = flask_add_iomem(xch, start, end, argv[2]);
+			ret = xc_flask_add_iomem(xch, start, end, argv[2]);
 			if (ret) {
-				fprintf(stderr, "flask_add_iomem %"PRIx64"-%"PRIx64" failed: %d\n",
+				fprintf(stderr, "xc_flask_add_iomem %"PRIx64"-%"PRIx64" failed: %d\n",
 						start, end, ret);
 				err = 2;
 			}
@@ -108,9 +107,9 @@
 	if (fscanf(f, "%" SCNu64, &start) != 1)
 		start = 0;
 	if (start) {
-		ret = flask_add_pirq(xch, start, argv[2]);
+		ret = xc_flask_add_pirq(xch, start, argv[2]);
 		if (ret) {
-			fprintf(stderr, "flask_add_pirq %"PRIu64" failed: %d\n",
+			fprintf(stderr, "xc_flask_add_pirq %"PRIu64" failed: %d\n",
 					start, ret);
 			err = 2;
 		}
diff -r 158f9c38d95c -r c3cfc4d4534d tools/flask/utils/loadpolicy.c
--- a/tools/flask/utils/loadpolicy.c	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/flask/utils/loadpolicy.c	Mon Feb 06 05:03:32 2012 -0800
@@ -17,7 +17,6 @@
 #include <sys/stat.h>
 #include <string.h>
 #include <unistd.h>
-#include <libflask.h>
 
 #define USE_MMAP
 
@@ -94,7 +93,7 @@
     }
 #endif
 
-    ret = flask_load(xch, polMemCp, info.st_size);
+    ret = xc_flask_load(xch, polMemCp, info.st_size);
     if ( ret < 0 )
     {
         errno = -ret;
diff -r 158f9c38d95c -r c3cfc4d4534d tools/flask/utils/set-bool.c
--- a/tools/flask/utils/set-bool.c	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/flask/utils/set-bool.c	Mon Feb 06 05:03:32 2012 -0800
@@ -16,7 +16,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <inttypes.h>
-#include <libflask.h>
 
 static void usage(char **argv)
 {
@@ -56,9 +55,9 @@
 		goto done;
 	}
 
-	err = flask_setbool(xch, argv[1], value, 1);
+	err = xc_flask_setbool(xch, argv[1], value, 1);
 	if (err) {
-		fprintf(stderr, "flask_setbool: Unable to set boolean %s=%s: %s (%d)",
+		fprintf(stderr, "xc_flask_setbool: Unable to set boolean %s=%s: %s (%d)",
 			argv[1], argv[2], strerror(errno), err);
 		err = 2;
 		goto done;
diff -r 158f9c38d95c -r c3cfc4d4534d tools/flask/utils/setenforce.c
--- a/tools/flask/utils/setenforce.c	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/flask/utils/setenforce.c	Mon Feb 06 05:03:32 2012 -0800
@@ -16,7 +16,6 @@
 #include <sys/stat.h>
 #include <string.h>
 #include <unistd.h>
-#include <libflask.h>
 
 static void usage (int argCnt, const char *args[])
 {
@@ -45,12 +44,12 @@
 
     if( strlen(args[1]) == 1 && (args[1][0] == '0' || args[1][0] == '1')){
         mode = strtol(args[1], &end, 10);
-        ret = flask_setenforce(xch, mode);
+        ret = xc_flask_setenforce(xch, mode);
     } else {
         if( strcasecmp(args[1], "enforcing") == 0 ){
-            ret = flask_setenforce(xch, 1);
+            ret = xc_flask_setenforce(xch, 1);
         } else if( strcasecmp(args[1], "permissive") == 0 ){
-            ret = flask_setenforce(xch, 0);
+            ret = xc_flask_setenforce(xch, 0);
         } else {
             usage(argCnt, args);
         }
diff -r 158f9c38d95c -r c3cfc4d4534d tools/libxc/xc_flask.c
--- a/tools/libxc/xc_flask.c	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/libxc/xc_flask.c	Mon Feb 06 05:03:32 2012 -0800
@@ -151,6 +151,65 @@
     return 0;
 }
 
+int xc_flask_getbool_byid(xc_interface *xc_handle, int id, char *name, uint32_t size, int *curr, int *pend)
+{
+    flask_op_t op;
+    char buf[255];
+    int rv;
+
+    op.cmd = FLASK_GETBOOL2;
+    op.buf = buf;
+    op.size = 255;
+
+    snprintf(buf, sizeof buf, "%i", id);
+
+    rv = xc_flask_op(xc_handle, &op);
+
+    if ( rv )
+        return rv;
+    
+    sscanf(buf, "%i %i %s", curr, pend, name);
+
+    return rv;
+}
+
+int xc_flask_getbool_byname(xc_interface *xc_handle, char *name, int *curr, int *pend)
+{
+    flask_op_t op;
+    char buf[255];
+    int rv;
+
+    op.cmd = FLASK_GETBOOL_NAMED;
+    op.buf = buf;
+    op.size = 255;
+
+    strncpy(buf, name, op.size);
+
+    rv = xc_flask_op(xc_handle, &op);
+
+    if ( rv )
+        return rv;
+    
+    sscanf(buf, "%i %i", curr, pend);
+
+    return rv;
+}
+
+int xc_flask_setbool(xc_interface *xc_handle, char *name, int value, int commit)
+{
+    flask_op_t op;
+    char buf[255];
+    int size = 255;
+
+    op.cmd = FLASK_SETBOOL_NAMED;
+    op.buf = buf;
+    op.size = size;
+
+    snprintf(buf, size, "%s %i %i", name, value, commit);
+
+    return xc_flask_op(xc_handle, &op);
+}
+
 static int xc_flask_add(xc_interface *xc_handle, char *cat, char *arg, char *scontext)
 {
     char buf[512];
diff -r 158f9c38d95c -r c3cfc4d4534d tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/libxc/xenctrl.h	Mon Feb 06 05:03:32 2012 -0800
@@ -1955,6 +1955,9 @@
 int xc_flask_sid_to_context(xc_interface *xc_handle, int sid, char *buf, uint32_t size);
 int xc_flask_getenforce(xc_interface *xc_handle);
 int xc_flask_setenforce(xc_interface *xc_handle, int mode);
+int xc_flask_getbool_byid(xc_interface *xc_handle, int id, char *name, uint32_t size, int *curr, int *pend);
+int xc_flask_getbool_byname(xc_interface *xc_handle, char *name, int *curr, int *pend);
+int xc_flask_setbool(xc_interface *xc_handle, char *name, int value, int commit);
 int xc_flask_add_pirq(xc_interface *xc_handle, unsigned int pirq, char *scontext);
 int xc_flask_add_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high,
                       char *scontext);
diff -r 158f9c38d95c -r c3cfc4d4534d tools/python/setup.py
--- a/tools/python/setup.py	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/python/setup.py	Mon Feb 06 05:03:32 2012 -0800
@@ -48,7 +48,7 @@
                include_dirs       = [ PATH_XEN, PATH_LIBXC, "xen/lowlevel/flask",
                                       "../flask/libflask/include" ],
                library_dirs       = [ PATH_LIBXC, "../flask/libflask" ],
-               libraries          = [ "xenctrl", "flask" ],
+               libraries          = [ "xenctrl" ],
                depends            = [ PATH_LIBXC + "/libxenctrl.so",
                                       XEN_ROOT + "/tools/flask/libflask/libflask.so" ],
                sources            = [ "xen/lowlevel/flask/flask.c" ])
diff -r 158f9c38d95c -r c3cfc4d4534d tools/python/xen/lowlevel/flask/flask.c
--- a/tools/python/xen/lowlevel/flask/flask.c	Mon Feb 06 17:40:05 2012 +0100
+++ b/tools/python/xen/lowlevel/flask/flask.c	Mon Feb 06 05:03:32 2012 -0800
@@ -12,7 +12,6 @@
 
 #include <Python.h>
 #include <xenctrl.h>
-#include <libflask.h>
 
 #define PKG "xen.lowlevel.flask"
 #define CLS "flask"
@@ -58,7 +57,7 @@
         return PyErr_SetFromErrno(xc_error_obj);
     }
     
-    ret = flask_context_to_sid(xc_handle, buf, len, &sid);
+    ret = xc_flask_context_to_sid(xc_handle, buf, len, &sid);
         
     xc_interface_close(xc_handle);
 
@@ -92,7 +91,7 @@
         return PyErr_SetFromErrno(xc_error_obj);
     }
     
-    ret = flask_sid_to_context(xc_handle, sid, ctx, ctx_len);
+    ret = xc_flask_sid_to_context(xc_handle, sid, ctx, ctx_len);
     
     xc_interface_close(xc_handle);
     
@@ -121,7 +120,7 @@
         return PyErr_SetFromErrno(xc_error_obj);
     }
 
-    ret = flask_load(xc_handle, policy, len);
+    ret = xc_flask_load(xc_handle, policy, len);
 
     xc_interface_close(xc_handle);
 
@@ -143,7 +142,7 @@
         return PyErr_SetFromErrno(xc_error_obj);
     }
     
-    ret = flask_getenforce(xc_handle);
+    ret = xc_flask_getenforce(xc_handle);
     
     xc_interface_close(xc_handle);
     
@@ -173,7 +172,7 @@
         return PyErr_SetFromErrno(xc_error_obj);
     }
     
-    ret = flask_setenforce(xc_handle, mode);
+    ret = xc_flask_setenforce(xc_handle, mode);
     
     xc_interface_close(xc_handle);
     
@@ -209,7 +208,7 @@
         return PyErr_SetFromErrno(xc_error_obj);
     }
     
-    ret = flask_access(xc_handle, scon, tcon, tclass, req, &allowed, &decided,
+    ret = xc_flask_access(xc_handle, scon, tcon, tclass, req, &allowed, &decided,
                         &auditallow, &auditdeny, &seqno);
         
     xc_interface_close(xc_handle);

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 07 04:33:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Feb 2012 04:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ruck4-0005P0-Vc; Tue, 07 Feb 2012 04:33:20 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Ruck3-0005Nl-2x
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-182.messagelabs.com!1328589189!13915300!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5243 invoked from network); 7 Feb 2012 04:33:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Feb 2012 04:33:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjt-0001FE-Gl
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjt-00066D-C0
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:09 +0000
Message-Id: <E1Rucjt-00066D-C0@xenbits.xen.org>
Date: Tue, 07 Feb 2012 04:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] flask: Update flask_op hypercall
	structure
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328533640 28800
# Node ID bf326829102b4778cc1f98cd677234362335f831
# Parent  28b85ad1fe4e98b336a3ef41eaa89c6a1b7e866a
flask: Update flask_op hypercall structure

Instead of placing string parsing inside the hypervisor, use binary
structures like other Xen hypercalls do.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 28b85ad1fe4e -r bf326829102b tools/libxc/xc_flask.c
--- a/tools/libxc/xc_flask.c	Mon Feb 06 05:04:32 2012 -0800
+++ b/tools/libxc/xc_flask.c	Mon Feb 06 05:07:20 2012 -0800
@@ -30,18 +30,21 @@
 #include <sys/ioctl.h>
 #include <stdint.h>
 
-#define OCON_PIRQ_STR   "pirq"
-#define OCON_IOPORT_STR "ioport"
-#define OCON_IOMEM_STR  "iomem"
-#define OCON_DEVICE_STR "pcidevice"
+#define OCON_ISID    0    /* initial SIDs */
+#define OCON_PIRQ    1    /* physical irqs */
+#define OCON_IOPORT  2    /* io ports */
+#define OCON_IOMEM   3    /* io memory */
+#define OCON_DEVICE  4    /* pci devices */
 #define INITCONTEXTLEN  256
 
-int xc_flask_op(xc_interface *xch, flask_op_t *op)
+int xc_flask_op(xc_interface *xch, xen_flask_op_t *op)
 {
     int ret = -1;
     DECLARE_HYPERCALL;
     DECLARE_HYPERCALL_BOUNCE(op, sizeof(*op), XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
 
+    op->interface_version = XEN_FLASK_INTERFACE_VERSION;
+
     if ( xc_hypercall_bounce_pre(xch, op) )
     {
         PERROR("Could not bounce memory for flask op hypercall");
@@ -63,402 +66,360 @@
     return ret;
 }
 
-int xc_flask_load(xc_interface *xc_handle, char *buf, uint32_t size)
+int xc_flask_load(xc_interface *xch, char *buf, uint32_t size)
 {
     int err;
-    flask_op_t op;
+    DECLARE_FLASK_OP;
+    DECLARE_HYPERCALL_BOUNCE(buf, size, XC_HYPERCALL_BUFFER_BOUNCE_IN);
+    if ( xc_hypercall_bounce_pre(xch, buf) )
+    {
+        PERROR("Could not bounce memory for flask op hypercall");
+        return -1;
+    }
+
+    op.cmd = FLASK_LOAD;
+    op.u.load.size = size;
+    set_xen_guest_handle(op.u.load.buffer, buf);
     
-    op.cmd = FLASK_LOAD;
-    op.buf = buf;
-    op.size = size;
-    
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
+    err = xc_flask_op(xch, &op);
 
-    return 0;
+    xc_hypercall_bounce_post(xch, buf);
+
+    return err;
 }
 
-int xc_flask_context_to_sid(xc_interface *xc_handle, char *buf, uint32_t size, uint32_t *sid)
+int xc_flask_context_to_sid(xc_interface *xch, char *buf, uint32_t size, uint32_t *sid)
 {
     int err;
-    flask_op_t op;
+    DECLARE_FLASK_OP;
+    DECLARE_HYPERCALL_BOUNCE(buf, size, XC_HYPERCALL_BUFFER_BOUNCE_IN);
+
+    if ( xc_hypercall_bounce_pre(xch, buf) )
+    {
+        PERROR("Could not bounce memory for flask op hypercall");
+        return -1;
+    }
+
+    op.cmd = FLASK_CONTEXT_TO_SID;
+    op.u.sid_context.size = size;
+    set_xen_guest_handle(op.u.sid_context.context, buf);
     
-    op.cmd = FLASK_CONTEXT_TO_SID;
-    op.buf = buf;
-    op.size = size;
-    
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-    
-    sscanf(buf, "%u", sid);
+    err = xc_flask_op(xch, &op);
 
-    return 0;
+    if ( !err )
+        *sid = op.u.sid_context.sid;
+
+    xc_hypercall_bounce_post(xch, buf);
+
+    return err;
 }
 
-int xc_flask_sid_to_context(xc_interface *xc_handle, int sid, char *buf, uint32_t size)
+int xc_flask_sid_to_context(xc_interface *xch, int sid, char *buf, uint32_t size)
 {
     int err;
-    flask_op_t op;
+    DECLARE_FLASK_OP;
+    DECLARE_HYPERCALL_BOUNCE(buf, size, XC_HYPERCALL_BUFFER_BOUNCE_OUT);
+
+    if ( xc_hypercall_bounce_pre(xch, buf) )
+    {
+        PERROR("Could not bounce memory for flask op hypercall");
+        return -1;
+    }
+
+    op.cmd = FLASK_SID_TO_CONTEXT;
+    op.u.sid_context.sid = sid;
+    op.u.sid_context.size = size;
+    set_xen_guest_handle(op.u.sid_context.context, buf);
     
-    op.cmd = FLASK_SID_TO_CONTEXT;
-    op.buf = buf;
-    op.size = size;
-    
-    snprintf(buf, size, "%u", sid);
+    err = xc_flask_op(xch, &op);
 
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-
-    return 0;
+    xc_hypercall_bounce_post(xch, buf);
+   
+    return err;
 }
 
-int xc_flask_getenforce(xc_interface *xc_handle)
+int xc_flask_getenforce(xc_interface *xch)
 {
-    int err;
-    flask_op_t op;
-    char buf[20];            
-    int size = 20;
-    int mode;
- 
+    DECLARE_FLASK_OP;
     op.cmd = FLASK_GETENFORCE;
-    op.buf = buf;
-    op.size = size;
     
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-
-    sscanf(buf, "%i", &mode);
-
-    return mode;
+    return xc_flask_op(xch, &op);
 }
 
-int xc_flask_setenforce(xc_interface *xc_handle, int mode)
+int xc_flask_setenforce(xc_interface *xch, int mode)
 {
-    int err;
-    flask_op_t op;
-    char buf[20];
-    int size = 20; 
- 
+    DECLARE_FLASK_OP;
     op.cmd = FLASK_SETENFORCE;
-    op.buf = buf;
-    op.size = size;
+    op.u.enforce.enforcing = mode;
    
-    snprintf(buf, size, "%i", mode);
- 
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-
-    return 0;
+    return xc_flask_op(xch, &op);
 }
 
-int xc_flask_getbool_byid(xc_interface *xc_handle, int id, char *name, uint32_t size, int *curr, int *pend)
+int xc_flask_getbool_byid(xc_interface *xch, int id, char *name, uint32_t size, int *curr, int *pend)
 {
-    flask_op_t op;
-    char buf[255];
     int rv;
+    DECLARE_FLASK_OP;
+    DECLARE_HYPERCALL_BOUNCE(name, size, XC_HYPERCALL_BUFFER_BOUNCE_OUT);
 
-    op.cmd = FLASK_GETBOOL2;
-    op.buf = buf;
-    op.size = 255;
+    if ( xc_hypercall_bounce_pre(xch, name) )
+    {
+        PERROR("Could not bounce memory for flask op hypercall");
+        return -1;
+    }
 
-    snprintf(buf, sizeof buf, "%i", id);
+    op.cmd = FLASK_GETBOOL;
+    op.u.boolean.bool_id = id;
+    op.u.boolean.size = size;
+    set_xen_guest_handle(op.u.boolean.name, name);
 
-    rv = xc_flask_op(xc_handle, &op);
+    rv = xc_flask_op(xch, &op);
+
+    xc_hypercall_bounce_post(xch, name);
 
     if ( rv )
         return rv;
     
-    sscanf(buf, "%i %i %s", curr, pend, name);
+    if ( curr )
+        *curr = op.u.boolean.enforcing;
+    if ( pend )
+        *pend = op.u.boolean.pending;
 
     return rv;
 }
 
-int xc_flask_getbool_byname(xc_interface *xc_handle, char *name, int *curr, int *pend)
+int xc_flask_getbool_byname(xc_interface *xch, char *name, int *curr, int *pend)
 {
-    flask_op_t op;
-    char buf[255];
     int rv;
+    DECLARE_FLASK_OP;
+    DECLARE_HYPERCALL_BOUNCE(name, strlen(name), XC_HYPERCALL_BUFFER_BOUNCE_IN);
 
-    op.cmd = FLASK_GETBOOL_NAMED;
-    op.buf = buf;
-    op.size = 255;
+    op.cmd = FLASK_GETBOOL;
+    op.u.boolean.bool_id = -1;
+    op.u.boolean.size = strlen(name);
+    set_xen_guest_handle(op.u.boolean.name, name);
 
-    strncpy(buf, name, op.size);
+    rv = xc_flask_op(xch, &op);
 
-    rv = xc_flask_op(xc_handle, &op);
+    xc_hypercall_bounce_post(xch, name);
 
     if ( rv )
         return rv;
     
-    sscanf(buf, "%i %i", curr, pend);
+    if ( curr )
+        *curr = op.u.boolean.enforcing;
+    if ( pend )
+        *pend = op.u.boolean.pending;
 
     return rv;
 }
 
-int xc_flask_setbool(xc_interface *xc_handle, char *name, int value, int commit)
+int xc_flask_setbool(xc_interface *xch, char *name, int value, int commit)
 {
-    flask_op_t op;
-    char buf[255];
-    int size = 255;
+    int rv;
+    DECLARE_FLASK_OP;
+    DECLARE_HYPERCALL_BOUNCE(name, strlen(name), XC_HYPERCALL_BUFFER_BOUNCE_IN);
 
-    op.cmd = FLASK_SETBOOL_NAMED;
-    op.buf = buf;
-    op.size = size;
+    op.cmd = FLASK_SETBOOL;
+    op.u.boolean.bool_id = -1;
+    op.u.boolean.new_value = value;
+    op.u.boolean.commit = 1;
+    op.u.boolean.size = strlen(name);
+    set_xen_guest_handle(op.u.boolean.name, name);
 
-    snprintf(buf, size, "%s %i %i", name, value, commit);
+    rv = xc_flask_op(xch, &op);
 
-    return xc_flask_op(xc_handle, &op);
+    xc_hypercall_bounce_post(xch, name);
+
+    return rv;
 }
 
-static int xc_flask_add(xc_interface *xc_handle, char *cat, char *arg, char *scontext)
+
+static int xc_flask_add(xc_interface *xch, uint32_t ocon, uint64_t low, uint64_t high, char *scontext)
 {
-    char buf[512];
-    flask_op_t op;
+    uint32_t sid;
+    int err;
+    DECLARE_FLASK_OP;
 
-    memset(buf, 0, 512);
-    snprintf(buf, 512, "%s %255s %s", cat, scontext, arg);
+    err = xc_flask_context_to_sid(xch, scontext, strlen(scontext), &sid);
+    if ( err )
+        return err;
+
     op.cmd = FLASK_ADD_OCONTEXT;
-    op.buf = buf;
-    op.size = 512;
+    op.u.ocontext.ocon = ocon;
+    op.u.ocontext.sid = sid;
+    op.u.ocontext.low = low;
+    op.u.ocontext.high = high;
     
-    return xc_flask_op(xc_handle, &op);
+    return xc_flask_op(xch, &op);
 }
 
-int xc_flask_add_pirq(xc_interface *xc_handle, unsigned int pirq, char *scontext)
+int xc_flask_add_pirq(xc_interface *xch, unsigned int pirq, char *scontext)
 {
-    char arg[16];
-
-    snprintf(arg, 16, "%u", pirq);
-    return xc_flask_add(xc_handle, OCON_PIRQ_STR, arg, scontext);
+    return xc_flask_add(xch, OCON_PIRQ, pirq, pirq, scontext);
 }
 
-int xc_flask_add_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high,
+int xc_flask_add_ioport(xc_interface *xch, unsigned long low, unsigned long high,
                       char *scontext)
 {
-    char arg[64];
-
-    snprintf(arg, 64, "%lu %lu", low, high);
-    return xc_flask_add(xc_handle, OCON_IOPORT_STR, arg, scontext);
+    return xc_flask_add(xch, OCON_IOPORT, low, high, scontext);
 }
 
-int xc_flask_add_iomem(xc_interface *xc_handle, unsigned long low, unsigned long high,
+int xc_flask_add_iomem(xc_interface *xch, unsigned long low, unsigned long high,
                      char *scontext)
 {
-    char arg[64];
-
-    snprintf(arg, 64, "%lu %lu", low, high);
-    return xc_flask_add(xc_handle, OCON_IOMEM_STR, arg, scontext);
+    return xc_flask_add(xch, OCON_IOMEM, low, high, scontext);
 }
 
-int xc_flask_add_device(xc_interface *xc_handle, unsigned long device, char *scontext)
+int xc_flask_add_device(xc_interface *xch, unsigned long device, char *scontext)
 {
-    char arg[32];
-
-    snprintf(arg, 32, "%lu", device);
-    return xc_flask_add(xc_handle, OCON_DEVICE_STR, arg, scontext);
+    return xc_flask_add(xch, OCON_DEVICE, device, device, scontext);
 }
 
-static int xc_flask_del(xc_interface *xc_handle, char *cat, char *arg)
+static int xc_flask_del(xc_interface *xch, uint32_t ocon, uint64_t low, uint64_t high)
 {
-    char buf[256];
-    flask_op_t op;
+    DECLARE_FLASK_OP;
 
-    memset(buf, 0, 256);
-    snprintf(buf, 256, "%s %s", cat, arg);
     op.cmd = FLASK_DEL_OCONTEXT;
-    op.buf = buf;
-    op.size = 256;
+    op.u.ocontext.ocon = ocon;
+    op.u.ocontext.low = low;
+    op.u.ocontext.high = high;
     
-    return xc_flask_op(xc_handle, &op);
+    return xc_flask_op(xch, &op);
 }
 
-int xc_flask_del_pirq(xc_interface *xc_handle, unsigned int pirq)
+int xc_flask_del_pirq(xc_interface *xch, unsigned int pirq)
 {
-    char arg[16];
-
-    snprintf(arg, 16, "%u", pirq);
-    return xc_flask_del(xc_handle, OCON_PIRQ_STR, arg);
+    return xc_flask_del(xch, OCON_PIRQ, pirq, pirq);
 }
 
-int xc_flask_del_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high)
+int xc_flask_del_ioport(xc_interface *xch, unsigned long low, unsigned long high)
 {
-    char arg[64];
-
-    snprintf(arg, 64, "%lu %lu", low, high);
-    return xc_flask_del(xc_handle, OCON_IOPORT_STR, arg);
+    return xc_flask_del(xch, OCON_IOPORT, low, high);
 }
 
-int xc_flask_del_iomem(xc_interface *xc_handle, unsigned long low, unsigned long high)
+int xc_flask_del_iomem(xc_interface *xch, unsigned long low, unsigned long high)
 {
-    char arg[64];
-
-    snprintf(arg, 64, "%lu %lu", low, high);
-    return xc_flask_del(xc_handle, OCON_IOMEM_STR, arg);
+    return xc_flask_del(xch, OCON_IOMEM, low, high);
 }
 
-int xc_flask_del_device(xc_interface *xc_handle, unsigned long device)
+int xc_flask_del_device(xc_interface *xch, unsigned long device)
 {
-    char arg[32];
-
-    snprintf(arg, 32, "%lu", device);
-    return xc_flask_del(xc_handle, OCON_DEVICE_STR, arg);
+    return xc_flask_del(xch, OCON_DEVICE, device, device);
 }
 
-int xc_flask_access(xc_interface *xc_handle, const char *scon, const char *tcon,
+int xc_flask_access(xc_interface *xch, const char *scon, const char *tcon,
                 uint16_t tclass, uint32_t req,
                 uint32_t *allowed, uint32_t *decided,
                 uint32_t *auditallow, uint32_t *auditdeny,
                 uint32_t *seqno)
 {
-/* maximum number of digits in a 16-bit decimal number: */
-#define MAX_SHORT_DEC_LEN 5
+    DECLARE_FLASK_OP;
+    int err;
 
-    char *buf;
-    int bufLen;
-    int err;
-    flask_op_t op;
-    uint32_t dummy_allowed;
-    uint32_t dummy_decided;
-    uint32_t dummy_auditallow;
-    uint32_t dummy_auditdeny;
-    uint32_t dummy_seqno;
-  
-    if (!allowed)
-        allowed = &dummy_allowed;
-    if (!decided)
-        decided = &dummy_decided;
-    if (!auditallow)
-        auditallow = &dummy_auditallow;
-    if (!auditdeny)
-        auditdeny = &dummy_auditdeny;
-    if (!seqno)
-        seqno = &dummy_seqno;
-
-    if (!scon)
-        return -EINVAL;
-    if (!tcon)
-        return -EINVAL;
-
-    bufLen = strlen(scon) + 1 + strlen(tcon) + 1 +
-        MAX_SHORT_DEC_LEN + 1 +
-        sizeof(req)*2 + 1;
-    buf = malloc(bufLen);
-    snprintf(buf, bufLen, "%s %s %hu %x", scon, tcon, tclass, req);
+    err = xc_flask_context_to_sid(xch, (char*)scon, strlen(scon), &op.u.access.ssid);
+    if ( err )
+        return err;
+    err = xc_flask_context_to_sid(xch, (char*)tcon, strlen(tcon), &op.u.access.tsid);
+    if ( err )
+        return err;
 
     op.cmd = FLASK_ACCESS;
-    op.buf = buf;
-    op.size = strlen(buf)+1;
+    op.u.access.tclass = tclass;
+    op.u.access.req = req;
     
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
+    err = xc_flask_op(xch, &op);
+
+    if ( err )
         return err;
-    }
-   
-    if (sscanf(op.buf, "%x %x %x %x %u",
-               allowed, decided,
-               auditallow, auditdeny,
-               seqno) != 5) {
-        err = -EILSEQ;
-    }
 
-    err = ((*allowed & req) == req)? 0 : -EPERM;
+    if ( allowed )
+        *allowed = op.u.access.allowed;
+    if ( decided )
+        *decided = 0xffffffff;
+    if ( auditallow )
+        *auditallow = op.u.access.audit_allow;
+    if ( auditdeny )
+        *auditdeny = op.u.access.audit_deny;
+    if ( seqno )
+        *seqno = op.u.access.seqno;
+
+    if ( (op.u.access.allowed & req) != req )
+        err = -EPERM;
 
     return err;
-
 }
 
-int xc_flask_avc_hashstats(xc_interface *xc_handle, char *buf, int size)
+int xc_flask_avc_hashstats(xc_interface *xch, char *buf, int size)
 {
     int err;
-    flask_op_t op;
+    DECLARE_FLASK_OP;
   
     op.cmd = FLASK_AVC_HASHSTATS;
-    op.buf = buf;
-    op.size = size;
   
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
+    err = xc_flask_op(xch, &op);
+
+    snprintf(buf, size,
+             "entries: %d\nbuckets used: %d/%d\nlongest chain: %d\n",
+             op.u.hash_stats.entries, op.u.hash_stats.buckets_used,
+             op.u.hash_stats.buckets_total, op.u.hash_stats.max_chain_len);
+
+    return err;
+}
+
+int xc_flask_avc_cachestats(xc_interface *xch, char *buf, int size)
+{
+    int err, n;
+    int i = 0;
+    DECLARE_FLASK_OP;
+
+    n = snprintf(buf, size, "lookups hits misses allocations reclaims frees\n");
+    buf += n;
+    size -= n;
+  
+    op.cmd = FLASK_AVC_CACHESTATS;
+    while ( size > 0 )
     {
-        free(buf);
-        return err;
+        op.u.cache_stats.cpu = i;
+        err = xc_flask_op(xch, &op);
+        if ( err && errno == ENOENT )
+            return 0;
+        if ( err )
+            return err;
+        n = snprintf(buf, size, "%u %u %u %u %u %u\n",
+                     op.u.cache_stats.lookups, op.u.cache_stats.hits,
+                     op.u.cache_stats.misses, op.u.cache_stats.allocations,
+                     op.u.cache_stats.reclaims, op.u.cache_stats.frees);
+        buf += n;
+        size -= n;
+        i++;
     }
 
     return 0;
 }
 
-int xc_flask_avc_cachestats(xc_interface *xc_handle, char *buf, int size)
+int xc_flask_policyvers(xc_interface *xch)
 {
-    int err;
-    flask_op_t op;
-  
-    op.cmd = FLASK_AVC_CACHESTATS;
-    op.buf = buf;
-    op.size = size;
-  
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
+    DECLARE_FLASK_OP;
+    op.cmd = FLASK_POLICYVERS;
 
-    return 0;
+    return xc_flask_op(xch, &op);
 }
 
-int xc_flask_policyvers(xc_interface *xc_handle, char *buf, int size)
+int xc_flask_getavc_threshold(xc_interface *xch)
 {
-    int err;
-    flask_op_t op;
-  
-    op.cmd = FLASK_POLICYVERS;
-    op.buf = buf;
-    op.size = size;
-
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    return 0;
+    DECLARE_FLASK_OP;
+    op.cmd = FLASK_GETAVC_THRESHOLD;
+    
+    return xc_flask_op(xch, &op);
 }
 
-int xc_flask_getavc_threshold(xc_interface *xc_handle)
+int xc_flask_setavc_threshold(xc_interface *xch, int threshold)
 {
-    int err;
-    flask_op_t op;
-    char buf[20];            
-    int size = 20;
-    int threshold;
- 
-    op.cmd = FLASK_GETAVC_THRESHOLD;
-    op.buf = buf;
-    op.size = size;
-    
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
+    DECLARE_FLASK_OP;
+    op.cmd = FLASK_SETAVC_THRESHOLD;
+    op.u.setavc_threshold.threshold = threshold;
 
-    sscanf(buf, "%i", &threshold);
-
-    return threshold;
-}
-
-int xc_flask_setavc_threshold(xc_interface *xc_handle, int threshold)
-{
-    int err;
-    flask_op_t op;
-    char buf[20];            
-    int size = 20;
- 
-    op.cmd = FLASK_SETAVC_THRESHOLD;
-    op.buf = buf;
-    op.size = size;
-
-    snprintf(buf, size, "%i", threshold);
- 
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-
-    return 0;
+    return xc_flask_op(xch, &op);
 }
 
 /*
diff -r 28b85ad1fe4e -r bf326829102b tools/libxc/xc_private.h
--- a/tools/libxc/xc_private.h	Mon Feb 06 05:04:32 2012 -0800
+++ b/tools/libxc/xc_private.h	Mon Feb 06 05:07:20 2012 -0800
@@ -42,11 +42,13 @@
 #define DECLARE_DOMCTL struct xen_domctl domctl = { 0 }
 #define DECLARE_SYSCTL struct xen_sysctl sysctl = { 0 }
 #define DECLARE_PHYSDEV_OP struct physdev_op physdev_op = { 0 }
+#define DECLARE_FLASK_OP struct xen_flask_op op = { 0 }
 #else
 #define DECLARE_HYPERCALL privcmd_hypercall_t hypercall
 #define DECLARE_DOMCTL struct xen_domctl domctl
 #define DECLARE_SYSCTL struct xen_sysctl sysctl
 #define DECLARE_PHYSDEV_OP struct physdev_op physdev_op
+#define DECLARE_FLASK_OP struct xen_flask_op op
 #endif
 
 #undef PAGE_SHIFT
diff -r 28b85ad1fe4e -r bf326829102b tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h	Mon Feb 06 05:04:32 2012 -0800
+++ b/tools/libxc/xenctrl.h	Mon Feb 06 05:07:20 2012 -0800
@@ -1326,7 +1326,7 @@
 
 int xc_version(xc_interface *xch, int cmd, void *arg);
 
-int xc_flask_op(xc_interface *xch, flask_op_t *op);
+int xc_flask_op(xc_interface *xch, xen_flask_op_t *op);
 
 /*
  * Subscribe to state changes in a domain via evtchn.
@@ -1974,7 +1974,7 @@
                   uint32_t *auditallow, uint32_t *auditdeny,
                   uint32_t *seqno);
 int xc_flask_avc_cachestats(xc_interface *xc_handle, char *buf, int size);
-int xc_flask_policyvers(xc_interface *xc_handle, char *buf, int size);
+int xc_flask_policyvers(xc_interface *xc_handle);
 int xc_flask_avc_hashstats(xc_interface *xc_handle, char *buf, int size);
 int xc_flask_getavc_threshold(xc_interface *xc_handle);
 int xc_flask_setavc_threshold(xc_interface *xc_handle, int threshold);
diff -r 28b85ad1fe4e -r bf326829102b xen/include/public/xsm/flask_op.h
--- a/xen/include/public/xsm/flask_op.h	Mon Feb 06 05:04:32 2012 -0800
+++ b/xen/include/public/xsm/flask_op.h	Mon Feb 06 05:07:20 2012 -0800
@@ -25,6 +25,118 @@
 #ifndef __FLASK_OP_H__
 #define __FLASK_OP_H__
 
+#define XEN_FLASK_INTERFACE_VERSION 1
+
+struct xen_flask_load {
+    XEN_GUEST_HANDLE(char) buffer;
+    uint32_t size;
+};
+
+struct xen_flask_setenforce {
+    uint32_t enforcing;
+};
+
+struct xen_flask_sid_context {
+    /* IN/OUT: sid to convert to/from string */
+    uint32_t sid;
+    /* IN: size of the context buffer
+     * OUT: actual size of the output context string
+     */
+    uint32_t size;
+    XEN_GUEST_HANDLE(char) context;
+};
+
+struct xen_flask_access {
+    /* IN: access request */
+    uint32_t ssid;
+    uint32_t tsid;
+    uint32_t tclass;
+    uint32_t req;
+    /* OUT: AVC data */
+    uint32_t allowed;
+    uint32_t audit_allow;
+    uint32_t audit_deny;
+    uint32_t seqno;
+};
+
+struct xen_flask_transition {
+    /* IN: transition SIDs and class */
+    uint32_t ssid;
+    uint32_t tsid;
+    uint32_t tclass;
+    /* OUT: new SID */
+    uint32_t newsid;
+};
+
+struct xen_flask_userlist {
+    /* IN: starting SID for list */
+    uint32_t start_sid;
+    /* IN: size of user string and output buffer
+     * OUT: number of SIDs returned */
+    uint32_t size;
+    union {
+        /* IN: user to enumerate SIDs */
+        XEN_GUEST_HANDLE(char) user;
+        /* OUT: SID list */
+        XEN_GUEST_HANDLE(uint32) sids;
+    } u;
+};
+
+struct xen_flask_boolean {
+    /* IN/OUT: numeric identifier for boolean [GET/SET]
+     * If -1, name will be used and bool_id will be filled in. */
+    uint32_t bool_id;
+    /* OUT: current enforcing value of boolean [GET/SET] */
+    uint8_t enforcing;
+    /* OUT: pending value of boolean [GET/SET] */
+    uint8_t pending;
+    /* IN: new value of boolean [SET] */
+    uint8_t new_value;
+    /* IN: commit new value instead of only setting pending [SET] */
+    uint8_t commit;
+    /* IN: size of boolean name buffer [GET/SET]
+     * OUT: actual size of name [GET only] */
+    uint32_t size;
+    /* IN: if bool_id is -1, used to find boolean [GET/SET]
+     * OUT: textual name of boolean [GET only]
+     */
+    XEN_GUEST_HANDLE(char) name;
+};
+
+struct xen_flask_setavc_threshold {
+    /* IN */
+    uint32_t threshold;
+};
+
+struct xen_flask_hash_stats {
+    /* OUT */
+    uint32_t entries;
+    uint32_t buckets_used;
+    uint32_t buckets_total;
+    uint32_t max_chain_len;
+};
+
+struct xen_flask_cache_stats {
+    /* IN */
+    uint32_t cpu;
+    /* OUT */
+    uint32_t lookups;
+    uint32_t hits;
+    uint32_t misses;
+    uint32_t allocations;
+    uint32_t reclaims;
+    uint32_t frees;
+};
+
+struct xen_flask_ocontext {
+    /* IN */
+    uint32_t ocon;
+    uint32_t sid;
+    uint64_t low, high;
+};
+
+struct xen_flask_op {
+    uint32_t cmd;
 #define FLASK_LOAD              1
 #define FLASK_GETENFORCE        2
 #define FLASK_SETENFORCE        3
@@ -47,18 +159,26 @@
 #define FLASK_MEMBER            20
 #define FLASK_ADD_OCONTEXT      21
 #define FLASK_DEL_OCONTEXT      22
-#define FLASK_GETBOOL_NAMED     23
-#define FLASK_GETBOOL2          24
-#define FLASK_SETBOOL_NAMED     25
-
-#define FLASK_LAST              FLASK_SETBOOL_NAMED
-
-typedef struct flask_op {
-    uint32_t  cmd;
-    uint32_t  size;
-    char      *buf;
-} flask_op_t;
-
-DEFINE_XEN_GUEST_HANDLE(flask_op_t);
+    uint32_t interface_version; /* XEN_FLASK_INTERFACE_VERSION */
+    union {
+        struct xen_flask_load load;
+        struct xen_flask_setenforce enforce;
+        /* FLASK_CONTEXT_TO_SID and FLASK_SID_TO_CONTEXT */
+        struct xen_flask_sid_context sid_context;
+        struct xen_flask_access access;
+        /* FLASK_CREATE, FLASK_RELABEL, FLASK_MEMBER */
+        struct xen_flask_transition transition;
+        struct xen_flask_userlist userlist;
+        /* FLASK_GETBOOL, FLASK_SETBOOL */
+        struct xen_flask_boolean boolean;
+        struct xen_flask_setavc_threshold setavc_threshold;
+        struct xen_flask_hash_stats hash_stats;
+        struct xen_flask_cache_stats cache_stats;
+        /* FLASK_ADD_OCONTEXT, FLASK_DEL_OCONTEXT */
+        struct xen_flask_ocontext ocontext;
+    } u;
+};
+typedef struct xen_flask_op xen_flask_op_t;
+DEFINE_XEN_GUEST_HANDLE(xen_flask_op_t);
 
 #endif
diff -r 28b85ad1fe4e -r bf326829102b xen/xsm/flask/avc.c
--- a/xen/xsm/flask/avc.c	Mon Feb 06 05:04:32 2012 -0800
+++ b/xen/xsm/flask/avc.c	Mon Feb 06 05:07:20 2012 -0800
@@ -28,6 +28,7 @@
 #include <xen/rcupdate.h>
 #include <asm/atomic.h>
 #include <asm/current.h>
+#include <public/xsm/flask_op.h>
 
 #include "avc.h"
 #include "avc_ss.h"
@@ -251,7 +252,7 @@
     printk("AVC INITIALIZED\n");
 }
 
-int avc_get_hash_stats(char *buf, uint32_t size)
+int avc_get_hash_stats(struct xen_flask_hash_stats *arg)
 {
     int i, chain_len, max_chain_len, slots_used;
     struct avc_node *node;
@@ -279,10 +280,12 @@
 
     rcu_read_unlock(&avc_rcu_lock);
     
-    return snprintf(buf, size, "entries: %d\nbuckets used: %d/%d\n"
-                    "longest chain: %d\n",
-                    atomic_read(&avc_cache.active_nodes),
-                    slots_used, AVC_CACHE_SLOTS, max_chain_len);
+    arg->entries = atomic_read(&avc_cache.active_nodes);
+    arg->buckets_used = slots_used;
+    arg->buckets_total = AVC_CACHE_SLOTS;
+    arg->max_chain_len = max_chain_len;
+
+    return 0;
 }
 
 static void avc_node_free(struct rcu_head *rhead)
diff -r 28b85ad1fe4e -r bf326829102b xen/xsm/flask/flask_op.c
--- a/xen/xsm/flask/flask_op.c	Mon Feb 06 05:04:32 2012 -0800
+++ b/xen/xsm/flask/flask_op.c	Mon Feb 06 05:07:20 2012 -0800
@@ -30,10 +30,9 @@
 #endif
 
 #define MAX_POLICY_SIZE 0x4000000
-#define FLASK_COPY_IN \
+
+#define FLASK_COPY_OUT \
     ( \
-        1UL<<FLASK_LOAD | \
-        1UL<<FLASK_SETENFORCE | \
         1UL<<FLASK_CONTEXT_TO_SID | \
         1UL<<FLASK_SID_TO_CONTEXT | \
         1UL<<FLASK_ACCESS | \
@@ -42,36 +41,10 @@
         1UL<<FLASK_USER | \
         1UL<<FLASK_GETBOOL | \
         1UL<<FLASK_SETBOOL | \
-        1UL<<FLASK_COMMITBOOLS | \
-        1UL<<FLASK_DISABLE | \
-        1UL<<FLASK_SETAVC_THRESHOLD | \
-        1UL<<FLASK_MEMBER | \
-        1UL<<FLASK_ADD_OCONTEXT | \
-        1UL<<FLASK_DEL_OCONTEXT | \
-        1UL<<FLASK_GETBOOL_NAMED | \
-        1UL<<FLASK_GETBOOL2 | \
-        1UL<<FLASK_SETBOOL_NAMED \
-    )
-
-#define FLASK_COPY_OUT \
-    ( \
-        1UL<<FLASK_GETENFORCE | \
-        1UL<<FLASK_CONTEXT_TO_SID | \
-        1UL<<FLASK_SID_TO_CONTEXT | \
-        1UL<<FLASK_ACCESS | \
-        1UL<<FLASK_CREATE | \
-        1UL<<FLASK_RELABEL | \
-        1UL<<FLASK_USER | \
-        1UL<<FLASK_POLICYVERS | \
-        1UL<<FLASK_GETBOOL | \
-        1UL<<FLASK_MLS | \
-        1UL<<FLASK_GETAVC_THRESHOLD | \
         1UL<<FLASK_AVC_HASHSTATS | \
         1UL<<FLASK_AVC_CACHESTATS | \
         1UL<<FLASK_MEMBER | \
-        1UL<<FLASK_GETBOOL_NAMED | \
-        1UL<<FLASK_GETBOOL2 \
-    )
+   0)
 
 static DEFINE_SPINLOCK(sel_sem);
 
@@ -96,412 +69,186 @@
                         perms, NULL);
 }
 
-static int flask_security_user(char *buf, uint32_t size)
+static int flask_copyin_string(XEN_GUEST_HANDLE(char) u_buf, char **buf, uint32_t size)
 {
-    char *page = NULL;
-    char *con, *user, *ptr;
-    u32 sid, *sids;
-    int length;
-    char *newcon;
-    int i, rc;
-    u32 len, nsids;
-        
-    length = domain_has_security(current->domain, SECURITY__COMPUTE_USER);
-    if ( length )
-        return length;
-            
-    length = -ENOMEM;
-    con = xmalloc_array(char, size+1);
-    if ( !con )
-        return length;
-    memset(con, 0, size+1);
-    
-    user = xmalloc_array(char, size+1);
-    if ( !user )
-        goto out;
-    memset(user, 0, size+1);
-    
-    length = -ENOMEM;
-    page = xmalloc_bytes(PAGE_SIZE);
-    if ( !page )
-        goto out2;
-    memset(page, 0, PAGE_SIZE);
+    char *tmp = xmalloc_bytes(size + 1);
+    if ( !tmp )
+        return -ENOMEM;
 
-    length = -EINVAL;
-    if ( sscanf(buf, "%s %s", con, user) != 2 )
-        goto out2;
+    if ( copy_from_guest(tmp, u_buf, size) )
+    {
+        xfree(tmp);
+        return -EFAULT;
+    }
+    tmp[size] = 0;
 
-    length = security_context_to_sid(con, strlen(con)+1, &sid);
-    if ( length < 0 )
-        goto out2;
-            
-    length = security_get_user_sids(sid, user, &sids, &nsids);
-    if ( length < 0 )
-        goto out2;
-    
-    length = snprintf(page, PAGE_SIZE, "%u", nsids) + 1;
-    ptr = page + length;
-    for ( i = 0; i < nsids; i++ )
-    {
-        rc = security_sid_to_context(sids[i], &newcon, &len);
-        if ( rc )
-        {
-            length = rc;
-            goto out3;
-        }
-        if ( (length + len) >= PAGE_SIZE )
-        {
-            xfree(newcon);
-            length = -ERANGE;
-            goto out3;
-        }
-        memcpy(ptr, newcon, len);
-        xfree(newcon);
-        ptr += len;
-        length += len;
-    }
-    
-    if ( length > size )
-    {
-        printk( "%s:  context size (%u) exceeds payload "
-                "max\n", __FUNCTION__, length);
-        length = -ERANGE;
-        goto out3;
-    }
-
-    memset(buf, 0, size);
-    memcpy(buf, page, length);
-        
- out3:
-    xfree(sids);
- out2:
-    if ( page )
-        xfree(page);
-    xfree(user);
- out:
-    xfree(con);
-    return length;
+    *buf = tmp;
+    return 0;
 }
 
-static int flask_security_relabel(char *buf, uint32_t size)
+static int flask_security_user(struct xen_flask_userlist *arg)
 {
-    char *scon, *tcon;
-    u32 ssid, tsid, newsid;
-    u16 tclass;
-    int length;
-    char *newcon;
+    char *user;
+    u32 *sids;
+    u32 nsids;
+    int rv;
+
+    rv = domain_has_security(current->domain, SECURITY__COMPUTE_USER);
+    if ( rv )
+        return rv;
+
+    rv = flask_copyin_string(arg->u.user, &user, arg->size);
+    if ( rv )
+        return rv;
+
+    rv = security_get_user_sids(arg->start_sid, user, &sids, &nsids);
+    if ( rv < 0 )
+        goto out;
+
+    if ( nsids * sizeof(sids[0]) > arg->size )
+        nsids = arg->size / sizeof(sids[0]);
+
+    arg->size = nsids;
+
+    if ( copy_to_guest(arg->u.sids, sids, nsids) )
+        rv = -EFAULT;
+
+    xfree(sids);
+ out:
+    xfree(user);
+    return rv;
+}
+
+static int flask_security_relabel(struct xen_flask_transition *arg)
+{
+    int rv;
+
+    rv = domain_has_security(current->domain, SECURITY__COMPUTE_RELABEL);
+    if ( rv )
+        return rv;
+
+    rv = security_change_sid(arg->ssid, arg->tsid, arg->tclass, &arg->newsid);
+
+    return rv;
+}
+
+static int flask_security_create(struct xen_flask_transition *arg)
+{
+    int rv;
+
+    rv = domain_has_security(current->domain, SECURITY__COMPUTE_CREATE);
+    if ( rv )
+        return rv;
+
+    rv = security_transition_sid(arg->ssid, arg->tsid, arg->tclass, &arg->newsid);
+
+    return rv;
+}
+
+static int flask_security_access(struct xen_flask_access *arg)
+{
+    struct av_decision avd;
+    int rv;
+
+    rv = domain_has_security(current->domain, SECURITY__COMPUTE_AV);
+    if ( rv )
+        return rv;
+
+    rv = security_compute_av(arg->ssid, arg->tsid, arg->tclass, arg->req, &avd);
+    if ( rv < 0 )
+        return rv;
+
+    arg->allowed = avd.allowed;
+    arg->audit_allow = avd.auditallow;
+    arg->audit_deny = avd.auditdeny;
+    arg->seqno = avd.seqno;
+                
+    return rv;
+}
+
+static int flask_security_member(struct xen_flask_transition *arg)
+{
+    int rv;
+
+    rv = domain_has_security(current->domain, SECURITY__COMPUTE_MEMBER);
+    if ( rv )
+        return rv;
+
+    rv = security_member_sid(arg->ssid, arg->tsid, arg->tclass, &arg->newsid);
+
+    return rv;
+}
+
+static int flask_security_setenforce(struct xen_flask_setenforce *arg)
+{
+    int enforce = !!(arg->enforcing);
+    int rv;
+
+    if ( enforce == flask_enforcing )
+        return 0;
+
+    rv = domain_has_security(current->domain, SECURITY__SETENFORCE);
+    if ( rv )
+        return rv;
+
+    flask_enforcing = enforce;
+
+    if ( flask_enforcing )
+        avc_ss_reset(0);
+
+    return 0;
+}
+
+static int flask_security_context(struct xen_flask_sid_context *arg)
+{
+    int rv;
+    char *buf;
+
+    rv = domain_has_security(current->domain, SECURITY__CHECK_CONTEXT);
+    if ( rv )
+        return rv;
+
+    rv = flask_copyin_string(arg->context, &buf, arg->size);
+    if ( rv )
+        return rv;
+
+    rv = security_context_to_sid(buf, arg->size, &arg->sid);
+    if ( rv < 0 )
+        goto out;
+
+ out:
+    xfree(buf);
+
+    return rv;
+}
+
+static int flask_security_sid(struct xen_flask_sid_context *arg)
+{
+    int rv;
+    char *context;
     u32 len;
 
-    length = domain_has_security(current->domain, SECURITY__COMPUTE_RELABEL);
-    if ( length )
-        return length;
-            
-    length = -ENOMEM;
-    scon = xmalloc_array(char, size+1);
-    if ( !scon )
-        return length;
-    memset(scon, 0, size+1);
-        
-    tcon = xmalloc_array(char, size+1);
-    if ( !tcon )
-        goto out;
-    memset(tcon, 0, size+1);
-        
-    length = -EINVAL;
-    if ( sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3 )
-        goto out2;
-            
-    length = security_context_to_sid(scon, strlen(scon)+1, &ssid);
-    if ( length < 0 )
-        goto out2;
-    length = security_context_to_sid(tcon, strlen(tcon)+1, &tsid);
-    if ( length < 0 )
-        goto out2;
-            
-    length = security_change_sid(ssid, tsid, tclass, &newsid);
-    if ( length < 0 )
-        goto out2;
-            
-    length = security_sid_to_context(newsid, &newcon, &len);
-    if ( length < 0 )
-        goto out2;
-            
-    if ( len > size )
-    {
-        printk( "%s:  context size (%u) exceeds payload "
-                "max\n", __FUNCTION__, len);
-        length = -ERANGE;
-        goto out3;
-    }
+    rv = domain_has_security(current->domain, SECURITY__CHECK_CONTEXT);
+    if ( rv )
+        return rv;
 
-    memset(buf, 0, size);
-    memcpy(buf, newcon, len);
-    length = len;
+    rv = security_sid_to_context(arg->sid, &context, &len);
+    if ( rv < 0 )
+        return rv;
 
- out3:
-    xfree(newcon);
- out2:
-    xfree(tcon);
- out:
-    xfree(scon);
-    return length;
-}
+    rv = 0;
 
-static int flask_security_create(char *buf, uint32_t size)
-{
-    char *scon, *tcon;
-    u32 ssid, tsid, newsid;
-    u16 tclass;
-    int length;
-    char *newcon;
-    u32 len;
+    if ( len > arg->size )
+        rv = -ERANGE;
 
-    length = domain_has_security(current->domain, SECURITY__COMPUTE_CREATE);
-    if ( length )
-        return length;
+    arg->size = len;
 
-    length = -ENOMEM;
-    scon = xmalloc_array(char, size+1);
-    if ( !scon )
-        return length;
-    memset(scon, 0, size+1);
-
-    tcon = xmalloc_array(char, size+1);
-    if ( !tcon )
-        goto out;
-    memset(tcon, 0, size+1);
-
-    length = -EINVAL;
-    if ( sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3 )
-        goto out2;
-
-    length = security_context_to_sid(scon, strlen(scon)+1, &ssid);
-    if ( length < 0 )
-        goto out2;
-
-    length = security_context_to_sid(tcon, strlen(tcon)+1, &tsid);
-    if ( length < 0 )
-        goto out2;
-
-    length = security_transition_sid(ssid, tsid, tclass, &newsid);
-    if ( length < 0 )
-        goto out2;
-
-    length = security_sid_to_context(newsid, &newcon, &len);
-    if ( length < 0 )    
-        goto out2;
-
-    if ( len > size )
-    {
-        printk( "%s:  context size (%u) exceeds payload "
-                "max\n", __FUNCTION__, len);
-        length = -ERANGE;
-        goto out3;
-    }
-
-    memset(buf, 0, size);
-    memcpy(buf, newcon, len);
-    length = len;
-        
- out3:
-    xfree(newcon);
- out2:
-    xfree(tcon);
- out:
-    xfree(scon);
-    return length;
-}
-
-static int flask_security_access(char *buf, uint32_t size)
-{
-    char *scon, *tcon;
-    u32 ssid, tsid;
-    u16 tclass;
-    u32 req;
-    struct av_decision avd;
-    int length;
-
-    length = domain_has_security(current->domain, SECURITY__COMPUTE_AV);
-    if ( length )
-        return length;
-
-    length = -ENOMEM;
-    scon = xmalloc_array(char, size+1);
-    if (!scon)
-        return length;
-    memset(scon, 0, size+1);
-
-    tcon = xmalloc_array(char, size+1);
-    if ( !tcon )
-        goto out;
-    memset( tcon, 0, size+1 );
-
-    length = -EINVAL;
-    if (sscanf(buf, "%s %s %hu %x", scon, tcon, &tclass, &req) != 4)
-        goto out2;
-
-    length = security_context_to_sid(scon, strlen(scon)+1, &ssid);
-    if ( length < 0 )
-        goto out2;
-
-    length = security_context_to_sid(tcon, strlen(tcon)+1, &tsid);
-    if ( length < 0 )
-        goto out2;
-
-    length = security_compute_av(ssid, tsid, tclass, req, &avd);
-    if ( length < 0 )
-        goto out2;
-
-    memset(buf, 0, size);
-    length = snprintf(buf, size, "%x %x %x %x %u", 
-                      avd.allowed, 0xffffffff,
-                      avd.auditallow, avd.auditdeny, 
-                      avd.seqno);
-                
- out2:
-    xfree(tcon);
- out:
-    xfree(scon);
-    return length;
-}
-
-static int flask_security_member(char *buf, uint32_t size)
-{
-    char *scon, *tcon;
-    u32 ssid, tsid, newsid;
-    u16 tclass;
-    int length;
-    char *newcon;
-    u32 len;
-
-    length = domain_has_security(current->domain, SECURITY__COMPUTE_MEMBER);
-    if ( length )
-        return length;
-
-    length = -ENOMEM;
-    scon = xmalloc_array(char, size+1);
-    if ( !scon )
-        return length;
-    memset(scon, 0, size+1);
-
-    tcon = xmalloc_array(char, size+1);
-    if ( !tcon )
-        goto out;
-    memset(tcon, 0, size+1);
-
-    length = -EINVAL;
-    if ( sscanf(buf, "%s, %s, %hu", scon, tcon, &tclass) != 3 )
-        goto out2;
-
-    length = security_context_to_sid(scon, strlen(scon)+1, &ssid);
-    if ( length < 0 )
-        goto out2;
-
-    length = security_context_to_sid(tcon, strlen(tcon)+1, &tsid);
-    if ( length < 0 )
-        goto out2;
-
-    length = security_member_sid(ssid, tsid, tclass, &newsid);
-    if ( length < 0 )
-        goto out2;
-
-    length = security_sid_to_context(newsid, &newcon, &len);
-    if ( length < 0 )
-        goto out2;
-
-    if ( len > size )
-    {
-        printk("%s:  context size (%u) exceeds payload "
-               "max\n", __FUNCTION__, len);
-        length = -ERANGE;
-        goto out3;
-    }
-
-    memset(buf, 0, size);
-    memcpy(buf, newcon, len);
-    length = len;
-
- out3:
-    xfree(newcon);
- out2:
-    xfree(tcon);
- out:
-    xfree(scon);
-    return length;
-}
-
-static int flask_security_setenforce(char *buf, uint32_t count)
-{
-    int length;
-    int new_value;
-
-    if ( sscanf(buf, "%d", &new_value) != 1 )
-        return -EINVAL;
-
-    if ( new_value != flask_enforcing )
-    {
-        length = domain_has_security(current->domain, SECURITY__SETENFORCE);
-        if ( length )
-            goto out;
-        flask_enforcing = new_value;
-        if ( flask_enforcing )
-            avc_ss_reset(0);
-    }
-    length = count;
-
- out:
-    return length;
-}
-
-static int flask_security_context(char *buf, uint32_t count)
-{
-    u32 sid;
-    int length;
-
-    length = domain_has_security(current->domain, SECURITY__CHECK_CONTEXT);
-    if ( length )
-        goto out;
-
-    length = security_context_to_sid(buf, count, &sid);
-    if ( length < 0 )
-        goto out;
-
-    memset(buf, 0, count);
-    length = snprintf(buf, count, "%u", sid);
-
- out:
-    return length;
-}
-
-static int flask_security_sid(char *buf, uint32_t count)
-{
-    char *context;
-    u32 sid;
-    u32 len;
-    int length;
-
-    length = domain_has_security(current->domain, SECURITY__CHECK_CONTEXT);
-    if ( length )
-        goto out;
-
-    if ( sscanf(buf, "%u", &sid) != 1 )
-        goto out;
-
-    length = security_sid_to_context(sid, &context, &len);
-    if ( length < 0 )
-        goto out;
-
-    if ( len > count )
-        return -ERANGE; 
-
-    memset(buf, 0, count);
-    memcpy(buf, context, len);
-    length = len;
+    if ( !rv && copy_to_guest(arg->context, context, len) )
+        rv = -EFAULT;
 
     xfree(context);
 
- out:
-    return length;
+    return rv;
 }
 
 int flask_disable(void)
@@ -530,229 +277,154 @@
     return 0;
 }
 
-static int flask_security_disable(char *buf, uint32_t count)
+static int flask_security_setavc_threshold(struct xen_flask_setavc_threshold *arg)
 {
-    int length;
-    int new_value;
+    int rv = 0;
 
-    length = -EINVAL;
-    if ( sscanf(buf, "%d", &new_value) != 1 )
-        goto out;
-
-    if ( new_value )
+    if ( arg->threshold != avc_cache_threshold )
     {
-        length = flask_disable();
-        if ( length < 0 )
+        rv = domain_has_security(current->domain, SECURITY__SETSECPARAM);
+        if ( rv )
             goto out;
+        avc_cache_threshold = arg->threshold;
     }
 
-    length = count;
-
  out:
-    return length;
+    return rv;
 }
 
-static int flask_security_setavc_threshold(char *buf, uint32_t count)
+static int flask_security_resolve_bool(struct xen_flask_boolean *arg)
 {
-    int ret;
-    int new_value;
+    char *name;
+    int rv;
 
-    if ( sscanf(buf, "%u", &new_value) != 1 )
-    {
-        ret = -EINVAL;
-        goto out;
-    }
+    if ( arg->bool_id != -1 )
+        return 0;
 
-    if ( new_value != avc_cache_threshold )
-    {
-        ret = domain_has_security(current->domain, SECURITY__SETSECPARAM);
-        if ( ret )
-            goto out;
-        avc_cache_threshold = new_value;
-    }
-    ret = count;
+    rv = flask_copyin_string(arg->name, &name, arg->size);
+    if ( rv )
+        return rv;
 
- out:
-    return ret;
+    arg->bool_id = security_find_bool(name);
+    arg->size = 0;
+
+    xfree(name);
+
+    return 0;
 }
 
-static int flask_security_set_bool(char *buf, uint32_t count)
+static int flask_security_set_bool(struct xen_flask_boolean *arg)
 {
-    int length = -EFAULT;
-    unsigned int i, new_value;
+    int rv;
+
+    rv = flask_security_resolve_bool(arg);
+    if ( rv )
+        return rv;
+
+    rv = domain_has_security(current->domain, SECURITY__SETBOOL);
+    if ( rv )
+        return rv;
 
     spin_lock(&sel_sem);
 
-    length = domain_has_security(current->domain, SECURITY__SETBOOL);
-    if ( length )
-        goto out;
+    if ( arg->commit )
+    {
+        int num;
+        int *values;
 
-    length = -EINVAL;
-    if ( sscanf(buf, "%d %d", &i, &new_value) != 2 )
-        goto out;
+        rv = security_get_bools(&num, NULL, &values);
+        if ( rv != 0 )
+            goto out;
 
-    if (!bool_pending_values)
-        flask_security_make_bools();
+        if ( arg->bool_id >= num )
+        {
+            rv = -ENOENT;
+            goto out;
+        }
+        values[arg->bool_id] = !!(arg->new_value);
 
-    if ( i >= bool_num )
-        goto out;
+        arg->enforcing = arg->pending = !!(arg->new_value);
 
-    if ( new_value )
-        new_value = 1;
+        if ( bool_pending_values )
+            bool_pending_values[arg->bool_id] = !!(arg->new_value);
 
-    bool_pending_values[i] = new_value;
-    length = count;
+        rv = security_set_bools(num, values);
+        xfree(values);
+    }
+    else
+    {
+        if ( !bool_pending_values )
+            flask_security_make_bools();
+
+        if ( arg->bool_id >= bool_num )
+            goto out;
+
+        bool_pending_values[arg->bool_id] = !!(arg->new_value);
+        arg->pending = !!(arg->new_value);
+        arg->enforcing = security_get_bool_value(arg->bool_id);
+
+        rv = 0;
+    }
 
  out:
     spin_unlock(&sel_sem);
-    return length;
+    return rv;
 }
 
-static int flask_security_set_bool_name(char *buf, uint32_t count)
+static int flask_security_commit_bools(void)
 {
-    int rv, num;
-    int i, new_value, commit;
-    int *values = NULL;
-    char *name;
-    
-    name = xmalloc_bytes(count);
-    if ( name == NULL )
-        return -ENOMEM;
+    int rv;
 
     spin_lock(&sel_sem);
 
     rv = domain_has_security(current->domain, SECURITY__SETBOOL);
     if ( rv )
         goto out;
+
+    if ( bool_pending_values )
+        rv = security_set_bools(bool_num, bool_pending_values);
     
-    rv = -EINVAL;
-    if ( sscanf(buf, "%s %d %d", name, &new_value, &commit) != 3 )
-        goto out;
-
-    i = security_find_bool(name);
-    if ( i < 0 )
-        goto out;
-
-    if ( new_value )
-        new_value = 1;
-
-    if ( commit ) {
-        rv = security_get_bools(&num, NULL, &values);
-        if ( rv != 0 )
-            goto out;
-        values[i] = new_value;
-        if (bool_pending_values)
-            bool_pending_values[i] = new_value;
-        rv = security_set_bools(num, values);
-        xfree(values);
-    } else {
-        if (!bool_pending_values)
-            flask_security_make_bools();
-
-        bool_pending_values[i] = new_value;
-        rv = count;
-    }
-
  out:
-    xfree(name);
     spin_unlock(&sel_sem);
     return rv;
 }
 
-static int flask_security_commit_bools(char *buf, uint32_t count)
+static int flask_security_get_bool(struct xen_flask_boolean *arg)
 {
-    int length = -EFAULT;
-    int new_value;
+    int rv;
+
+    rv = flask_security_resolve_bool(arg);
+    if ( rv )
+        return rv;
 
     spin_lock(&sel_sem);
 
-    length = domain_has_security(current->domain, SECURITY__SETBOOL);
-    if ( length )
+    rv = security_get_bool_value(arg->bool_id);
+    if ( rv < 0 )
         goto out;
 
-    length = -EINVAL;
-    if ( sscanf(buf, "%d", &new_value) != 1 )
-        goto out;
-
-    if ( new_value && bool_pending_values )
-        security_set_bools(bool_num, bool_pending_values);
-    
-    length = count;
-
- out:
-    spin_unlock(&sel_sem);
-    return length;
-}
-
-static int flask_security_get_bool(char *buf, uint32_t count, int named)
-{
-    int length;
-    int i, cur_enforcing, pend_enforcing;
-    char* name = NULL;
-    
-    spin_lock(&sel_sem);
-    
-    length = -EINVAL;
-    if ( sscanf(buf, "%d", &i) != 1 )
-        goto out;
-
-    cur_enforcing = security_get_bool_value(i);
-    if ( cur_enforcing < 0 )
-    {
-        length = cur_enforcing;
-        goto out;
-    }
+    arg->enforcing = rv;
 
     if ( bool_pending_values )
-        pend_enforcing = bool_pending_values[i];
+        arg->pending = bool_pending_values[arg->bool_id];
     else
-        pend_enforcing = cur_enforcing;
+        arg->pending = rv;
 
-    if ( named )
-        name = security_get_bool_name(i);
-    if ( named && !name )
-        goto out;
+    rv = 0;
 
-    memset(buf, 0, count);
-    if ( named )
-        length = snprintf(buf, count, "%d %d %s", cur_enforcing,
-                          pend_enforcing, name);
-    else
-        length = snprintf(buf, count, "%d %d", cur_enforcing,
-                          pend_enforcing);
-
- out:
-    xfree(name);
-    spin_unlock(&sel_sem);
-    return length;
-}
-
-static int flask_security_get_bool_name(char *buf, uint32_t count)
-{
-    int rv = -ENOENT;
-    int i, cur_enforcing, pend_enforcing;
-    
-    spin_lock(&sel_sem);
-    
-    i = security_find_bool(buf);
-    if ( i < 0 )
-        goto out;
-
-    cur_enforcing = security_get_bool_value(i);
-    if ( cur_enforcing < 0 )
+    if ( arg->size )
     {
-        rv = cur_enforcing;
-        goto out;
+        char *nameout = security_get_bool_name(arg->bool_id);
+        size_t nameout_len = strlen(nameout);
+        if ( nameout_len > arg->size )
+            rv = -ERANGE;
+        arg->size = nameout_len;
+ 
+        if ( !rv && copy_to_guest(arg->name, nameout, nameout_len) )
+            rv = -EFAULT;
+        xfree(nameout);
     }
 
-    if ( bool_pending_values )
-        pend_enforcing = bool_pending_values[i];
-    else
-        pend_enforcing = cur_enforcing;
-
-    memset(buf, 0, count);
-    rv = snprintf(buf, count, "%d %d", cur_enforcing, pend_enforcing);
-
  out:
     spin_unlock(&sel_sem);
     return rv;
@@ -779,380 +451,212 @@
 
 #ifdef FLASK_AVC_STATS
 
-static int flask_security_avc_cachestats(char *buf, uint32_t count)
+static int flask_security_avc_cachestats(struct xen_flask_cache_stats *arg)
 {
-    char *page = NULL;
-    int len = 0;
-    int length = 0;
-    int cpu;
     struct avc_cache_stats *st;
 
-    page = (char *)xmalloc_bytes(PAGE_SIZE);
-    if ( !page )
-        return -ENOMEM;
-    memset(page, 0, PAGE_SIZE);
+    if ( arg->cpu > nr_cpu_ids )
+        return -ENOENT;
+    if ( !cpu_online(arg->cpu) )
+        return -ENOENT;
 
-    len = snprintf(page, PAGE_SIZE, "lookups hits misses allocations reclaims "
-                   "frees\n");
-    if ( len > count ) {
-        length = -EINVAL;
-        goto out;
-    }
-    
-    memcpy(buf, page, len);
-    buf += len;
-    length += len;
-    count -= len;
+    st = &per_cpu(avc_cache_stats, arg->cpu);
 
-    for_each_online_cpu ( cpu )
-    {
-        st = &per_cpu(avc_cache_stats, cpu);
+    arg->lookups = st->lookups;
+    arg->hits = st->hits;
+    arg->misses = st->misses;
+    arg->allocations = st->allocations;
+    arg->reclaims = st->reclaims;
+    arg->frees = st->frees;
 
-        len = snprintf(page, PAGE_SIZE, "%u %u %u %u %u %u\n", st->lookups,
-                       st->hits, st->misses, st->allocations,
-                       st->reclaims, st->frees);
-        if ( len > count ) {
-            length = -EINVAL;
-            goto out;
-        }
-        memcpy(buf, page, len);
-        buf += len;
-        length += len;
-        count -= len;
-    }
-
- out:
-    xfree(page);    
-    return length;
+    return 0;
 }
 
 #endif
 
-static int flask_security_load(char *buf, uint32_t count)
+static int flask_security_load(struct xen_flask_load *load)
 {
     int ret;
-    int length;
+    void *buf = NULL;
+
+    ret = domain_has_security(current->domain, SECURITY__LOAD_POLICY);
+    if ( ret )
+        return ret;
+
+    if ( load->size > MAX_POLICY_SIZE )
+        return -EINVAL;
+
+    buf = xmalloc_bytes(load->size);
+    if ( !buf )
+        return -ENOMEM;
+
+    if ( copy_from_guest(buf, load->buffer, load->size) )
+    {
+        ret = -EFAULT;
+        goto out_free;
+    }
 
     spin_lock(&sel_sem);
 
-    length = domain_has_security(current->domain, SECURITY__LOAD_POLICY);
-    if ( length )
+    ret = security_load_policy(buf, load->size);
+    if ( ret )
         goto out;
 
-    length = security_load_policy(buf, count);
-    if ( length )
-        goto out;
-
-    ret = flask_security_make_bools();
-    if ( ret )
-        length = ret;
-    else
-        length = count;
+    xfree(bool_pending_values);
+    bool_pending_values = NULL;
+    ret = 0;
 
  out:
     spin_unlock(&sel_sem);
-    return length;
+ out_free:
+    xfree(buf);
+    return ret;
 }
 
-static int flask_ocontext_del(char *buf, uint32_t size)
+static int flask_ocontext_del(struct xen_flask_ocontext *arg)
 {
-    int len = 0;
-    char *ocontext;
-    unsigned long low  = 0;
-    unsigned long high = 0;
+    int rv;
 
-    len = domain_has_security(current->domain, SECURITY__DEL_OCONTEXT);
-    if ( len )
-        return len;
+    if ( arg->low > arg->high )
+        return -EINVAL;
 
-    if ( (ocontext = xmalloc_bytes(size) ) == NULL )
-        return -ENOMEM;
+    rv = domain_has_security(current->domain, SECURITY__DEL_OCONTEXT);
+    if ( rv )
+        return rv;
 
-    len = sscanf(buf, "%s %lu %lu", ocontext, &low, &high);
-    if ( len < 2 )
-    {
-        len = -EINVAL;
-        goto out;
-    }
-    else if ( len == 2 )
-        high = low;
-
-    if ( low > high )
-    {
-        len = -EINVAL;
-        goto out;
-    }
-
-    len = security_ocontext_del(ocontext, low, high);
- out:
-    xfree(ocontext);
-    return len;
+    return security_ocontext_del(arg->ocon, arg->low, arg->high);
 }
 
-static int flask_ocontext_add(char *buf, uint32_t size)
+static int flask_ocontext_add(struct xen_flask_ocontext *arg)
 {
-    int len = 0;
-    u32 sid = 0;
-    unsigned long low  = 0;
-    unsigned long high = 0;
-    char *scontext;
-    char *ocontext;
+    int rv;
 
-    len = domain_has_security(current->domain, SECURITY__ADD_OCONTEXT);
-    if ( len )
-        return len;
+    if ( arg->low > arg->high )
+        return -EINVAL;
 
-    if ( (scontext = xmalloc_bytes(size) ) == NULL )
-        return -ENOMEM;
+    rv = domain_has_security(current->domain, SECURITY__ADD_OCONTEXT);
+    if ( rv )
+        return rv;
 
-    if ( (ocontext = xmalloc_bytes(size) ) == NULL )
-    {
-        xfree(scontext);
-        return -ENOMEM;
-    }
-
-    memset(scontext, 0, size);
-    memset(ocontext, 0, size);
-
-    len = sscanf(buf, "%s %s %lu %lu", ocontext, scontext, &low, &high);
-    if ( len < 3 )
-    {
-        len = -EINVAL;
-        goto out;
-    }
-    else if ( len == 3 )
-        high = low;
-
-    if ( low > high )
-    {
-        len = -EINVAL;
-        goto out;
-    }
-    len = security_context_to_sid(scontext, strlen(scontext)+1, &sid);
-    if ( len < 0 )
-    {
-        len = -EINVAL;
-        goto out;
-    }
-    len = security_ocontext_add(ocontext, low, high, sid);
- out:
-    xfree(ocontext);
-    xfree(scontext);
-    return len;
+    return security_ocontext_add(arg->ocon, arg->low, arg->high, arg->sid);
 }
 
 long do_flask_op(XEN_GUEST_HANDLE(xsm_op_t) u_flask_op)
 {
-    flask_op_t curop, *op = &curop;
-    int rc = 0;
-    int length = 0;
-    char *arg = NULL;
+    xen_flask_op_t op;
+    int rv;
 
-    if ( copy_from_guest(op, u_flask_op, 1) )
+    if ( copy_from_guest(&op, u_flask_op, 1) )
         return -EFAULT;
 
-    if ( op->cmd > FLASK_LAST)
-        return -EINVAL;
+    if ( op.interface_version != XEN_FLASK_INTERFACE_VERSION )
+        return -ENOSYS;
 
-    if ( op->size > MAX_POLICY_SIZE )
-        return -EINVAL;
+    switch ( op.cmd )
+    {
+    case FLASK_LOAD:
+        rv = flask_security_load(&op.u.load);
+        break;
 
-    if ( (op->buf == NULL && op->size != 0) || 
-         (op->buf != NULL && op->size == 0) )
-        return -EINVAL;
-
-    arg = xmalloc_bytes(op->size + 1);
-    if ( !arg )
-        return -ENOMEM;
-
-    memset(arg, 0, op->size + 1);
-
-    if ( (FLASK_COPY_IN&(1UL<<op->cmd)) && op->buf != NULL && 
-         copy_from_guest(arg, guest_handle_from_ptr(op->buf, char), op->size) )
-    {
-        rc = -EFAULT;
-        goto out;
-    }
-
-    switch ( op->cmd )
-    {
-
-    case FLASK_LOAD:
-    {
-        length = flask_security_load(arg, op->size);
-    }
-    break;
-    
     case FLASK_GETENFORCE:
-    {
-        length = snprintf(arg, op->size, "%d", flask_enforcing);
-    }
-    break;    
+        rv = flask_enforcing;
+        break;
 
     case FLASK_SETENFORCE:
-    {
-        length = flask_security_setenforce(arg, op->size);
-    }
-    break;    
+        rv = flask_security_setenforce(&op.u.enforce);
+        break;
 
     case FLASK_CONTEXT_TO_SID:
-    {
-        length = flask_security_context(arg, op->size);
-    }
-    break;    
+        rv = flask_security_context(&op.u.sid_context);
+        break;
 
     case FLASK_SID_TO_CONTEXT:
-    {
-        length = flask_security_sid(arg, op->size);
-    }
-    break; 
+        rv = flask_security_sid(&op.u.sid_context);
+        break;
 
     case FLASK_ACCESS:
-    {
-        length = flask_security_access(arg, op->size);
-    }
-    break;    
+        rv = flask_security_access(&op.u.access);
+        break;
 
     case FLASK_CREATE:
-    {
-        length = flask_security_create(arg, op->size);
-    }
-    break;    
+        rv = flask_security_create(&op.u.transition);
+        break;
 
     case FLASK_RELABEL:
-    {
-        length = flask_security_relabel(arg, op->size);
-    }
-    break;
+        rv = flask_security_relabel(&op.u.transition);
+        break;
 
     case FLASK_USER:
-    {
-        length = flask_security_user(arg, op->size);
-    }
-    break;    
+        rv = flask_security_user(&op.u.userlist);
+        break;
 
     case FLASK_POLICYVERS:
-    {
-        length = snprintf(arg, op->size, "%d", POLICYDB_VERSION_MAX);
-    }
-    break;    
+        rv = POLICYDB_VERSION_MAX;
+        break;
 
     case FLASK_GETBOOL:
-    {
-        length = flask_security_get_bool(arg, op->size, 0);
-    }
-    break;
+        rv = flask_security_get_bool(&op.u.boolean);
+        break;
 
     case FLASK_SETBOOL:
-    {
-        length = flask_security_set_bool(arg, op->size);
-    }
-    break;
+        rv = flask_security_set_bool(&op.u.boolean);
+        break;
 
     case FLASK_COMMITBOOLS:
-    {
-        length = flask_security_commit_bools(arg, op->size);
-    }
-    break;
+        rv = flask_security_commit_bools();
+        break;
 
     case FLASK_MLS:
-    {
-        length = snprintf(arg, op->size, "%d", flask_mls_enabled);
-    }
-    break;    
+        rv = flask_mls_enabled;
+        break;    
 
     case FLASK_DISABLE:
-    {
-        length = flask_security_disable(arg, op->size);
-    }
-    break;    
+        rv = flask_disable();
+        break;
 
     case FLASK_GETAVC_THRESHOLD:
-    {
-        length = snprintf(arg, op->size, "%d", avc_cache_threshold);
-    }
-    break;
+        rv = avc_cache_threshold;
+        break;
 
     case FLASK_SETAVC_THRESHOLD:
-    {
-        length = flask_security_setavc_threshold(arg, op->size);
-    }
-    break;
+        rv = flask_security_setavc_threshold(&op.u.setavc_threshold);
+        break;
 
     case FLASK_AVC_HASHSTATS:
-    {
-        length = avc_get_hash_stats(arg, op->size);
-    }
-    break;
+        rv = avc_get_hash_stats(&op.u.hash_stats);
+        break;
 
-#ifdef FLASK_AVC_STATS    
+#ifdef FLASK_AVC_STATS
     case FLASK_AVC_CACHESTATS:
-    {
-        length = flask_security_avc_cachestats(arg, op->size);
-    }
-    break;
+        rv = flask_security_avc_cachestats(&op.u.cache_stats);
+        break;
 #endif
 
     case FLASK_MEMBER:
-    {
-        length = flask_security_member(arg, op->size);
-    }
-    break;    
+        rv = flask_security_member(&op.u.transition);
+        break;
 
     case FLASK_ADD_OCONTEXT:
-    {
-        length = flask_ocontext_add(arg, op->size);
+        rv = flask_ocontext_add(&op.u.ocontext);
         break;
+
+    case FLASK_DEL_OCONTEXT:
+        rv = flask_ocontext_del(&op.u.ocontext);
+        break;
+
+    default:
+        rv = -ENOSYS;
     }
 
-    case FLASK_DEL_OCONTEXT:
+    if ( rv < 0 )
+        goto out;
+
+    if ( (FLASK_COPY_OUT&(1UL<<op.cmd)) )
     {
-        length = flask_ocontext_del(arg, op->size);
-        break;
+        if ( copy_to_guest(u_flask_op, &op, 1) )
+            rv = -EFAULT;
     }
 
-    case FLASK_GETBOOL_NAMED:
-    {
-        length = flask_security_get_bool_name(arg, op->size);
-    }
-    break;
-
-    case FLASK_GETBOOL2:
-    {
-        length = flask_security_get_bool(arg, op->size, 1);
-    }
-    break;
-
-    case FLASK_SETBOOL_NAMED:
-    {
-        length = flask_security_set_bool_name(arg, op->size);
-    }
-    break;
-
-    default:
-        length = -ENOSYS;
-        break;
-
-    }
-
-    if ( length < 0 )
-    {
-        rc = length;
-        goto out;
-    }
-    
-    if ( (FLASK_COPY_OUT&(1UL<<op->cmd)) && op->buf != NULL && 
-         copy_to_guest(guest_handle_from_ptr(op->buf, char), arg, op->size) )
-    {
-        rc = -EFAULT;
-        goto out;
-    }
-
-    op->size = length;
-    if ( copy_to_guest(u_flask_op, op, 1) )
-        rc = -EFAULT;
-
  out:
-    xfree(arg);
-    return rc;
+    return rv;
 }
diff -r 28b85ad1fe4e -r bf326829102b xen/xsm/flask/include/avc.h
--- a/xen/xsm/flask/include/avc.h	Mon Feb 06 05:04:32 2012 -0800
+++ b/xen/xsm/flask/include/avc.h	Mon Feb 06 05:07:20 2012 -0800
@@ -104,7 +104,8 @@
                                     u32 ssid, u32 tsid, u16 tclass, u32 perms);
 
 /* Exported to selinuxfs */
-int avc_get_hash_stats(char *buf, uint32_t size);
+struct xen_flask_hash_stats;
+int avc_get_hash_stats(struct xen_flask_hash_stats *arg);
 extern unsigned int avc_cache_threshold;
 
 #ifdef FLASK_AVC_STATS
diff -r 28b85ad1fe4e -r bf326829102b xen/xsm/flask/include/security.h
--- a/xen/xsm/flask/include/security.h	Mon Feb 06 05:04:32 2012 -0800
+++ b/xen/xsm/flask/include/security.h	Mon Feb 06 05:07:20 2012 -0800
@@ -90,8 +90,8 @@
 int security_iterate_ioport_sids(u32 start, u32 end,
                                 security_iterate_fn fn, void *data);
 
-int security_ocontext_add(char *ocontext, unsigned long low,
+int security_ocontext_add(u32 ocontext, unsigned long low,
                            unsigned long high, u32 sid);
 
-int security_ocontext_del(char *ocontext, unsigned int low, unsigned int high);
+int security_ocontext_del(u32 ocontext, unsigned int low, unsigned int high);
 #endif /* _FLASK_SECURITY_H_ */
diff -r 28b85ad1fe4e -r bf326829102b xen/xsm/flask/ss/services.c
--- a/xen/xsm/flask/ss/services.c	Mon Feb 06 05:04:32 2012 -0800
+++ b/xen/xsm/flask/ss/services.c	Mon Feb 06 05:07:20 2012 -0800
@@ -2097,17 +2097,14 @@
         return -1;
 }
 
-int security_ocontext_add( char *ocontext, unsigned long low, unsigned long high
+int security_ocontext_add( u32 ocon, unsigned long low, unsigned long high
                             ,u32 sid )
 {
     int ret = 0;
-    int ocon = 0;
     struct ocontext *c;
     struct ocontext *prev;
     struct ocontext *add;
 
-    if ( (ocon = determine_ocontext(ocontext)) < 0 )
-        return -EINVAL;
     if ( (add = xmalloc(struct ocontext)) == NULL )
         return -ENOMEM;
     memset(add, 0, sizeof(struct ocontext));
@@ -2254,15 +2251,11 @@
     return ret;
 }
 
-int security_ocontext_del( char *ocontext, unsigned int low, unsigned int high )
+int security_ocontext_del( u32 ocon, unsigned int low, unsigned int high )
 {
     int ret = 0;
-    int ocon = 0;
     struct ocontext *c, *before_c;
 
-    if ( (ocon = determine_ocontext(ocontext)) < 0 )
-        return -EINVAL;
-
     POLICY_WRLOCK;
     switch( ocon )
     {

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 07 04:33:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Feb 2012 04:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ruck4-0005P0-Vc; Tue, 07 Feb 2012 04:33:20 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Ruck3-0005Nl-2x
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-182.messagelabs.com!1328589189!13915300!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5243 invoked from network); 7 Feb 2012 04:33:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Feb 2012 04:33:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjt-0001FE-Gl
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjt-00066D-C0
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:09 +0000
Message-Id: <E1Rucjt-00066D-C0@xenbits.xen.org>
Date: Tue, 07 Feb 2012 04:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] flask: Update flask_op hypercall
	structure
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328533640 28800
# Node ID bf326829102b4778cc1f98cd677234362335f831
# Parent  28b85ad1fe4e98b336a3ef41eaa89c6a1b7e866a
flask: Update flask_op hypercall structure

Instead of placing string parsing inside the hypervisor, use binary
structures like other Xen hypercalls do.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 28b85ad1fe4e -r bf326829102b tools/libxc/xc_flask.c
--- a/tools/libxc/xc_flask.c	Mon Feb 06 05:04:32 2012 -0800
+++ b/tools/libxc/xc_flask.c	Mon Feb 06 05:07:20 2012 -0800
@@ -30,18 +30,21 @@
 #include <sys/ioctl.h>
 #include <stdint.h>
 
-#define OCON_PIRQ_STR   "pirq"
-#define OCON_IOPORT_STR "ioport"
-#define OCON_IOMEM_STR  "iomem"
-#define OCON_DEVICE_STR "pcidevice"
+#define OCON_ISID    0    /* initial SIDs */
+#define OCON_PIRQ    1    /* physical irqs */
+#define OCON_IOPORT  2    /* io ports */
+#define OCON_IOMEM   3    /* io memory */
+#define OCON_DEVICE  4    /* pci devices */
 #define INITCONTEXTLEN  256
 
-int xc_flask_op(xc_interface *xch, flask_op_t *op)
+int xc_flask_op(xc_interface *xch, xen_flask_op_t *op)
 {
     int ret = -1;
     DECLARE_HYPERCALL;
     DECLARE_HYPERCALL_BOUNCE(op, sizeof(*op), XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
 
+    op->interface_version = XEN_FLASK_INTERFACE_VERSION;
+
     if ( xc_hypercall_bounce_pre(xch, op) )
     {
         PERROR("Could not bounce memory for flask op hypercall");
@@ -63,402 +66,360 @@
     return ret;
 }
 
-int xc_flask_load(xc_interface *xc_handle, char *buf, uint32_t size)
+int xc_flask_load(xc_interface *xch, char *buf, uint32_t size)
 {
     int err;
-    flask_op_t op;
+    DECLARE_FLASK_OP;
+    DECLARE_HYPERCALL_BOUNCE(buf, size, XC_HYPERCALL_BUFFER_BOUNCE_IN);
+    if ( xc_hypercall_bounce_pre(xch, buf) )
+    {
+        PERROR("Could not bounce memory for flask op hypercall");
+        return -1;
+    }
+
+    op.cmd = FLASK_LOAD;
+    op.u.load.size = size;
+    set_xen_guest_handle(op.u.load.buffer, buf);
     
-    op.cmd = FLASK_LOAD;
-    op.buf = buf;
-    op.size = size;
-    
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
+    err = xc_flask_op(xch, &op);
 
-    return 0;
+    xc_hypercall_bounce_post(xch, buf);
+
+    return err;
 }
 
-int xc_flask_context_to_sid(xc_interface *xc_handle, char *buf, uint32_t size, uint32_t *sid)
+int xc_flask_context_to_sid(xc_interface *xch, char *buf, uint32_t size, uint32_t *sid)
 {
     int err;
-    flask_op_t op;
+    DECLARE_FLASK_OP;
+    DECLARE_HYPERCALL_BOUNCE(buf, size, XC_HYPERCALL_BUFFER_BOUNCE_IN);
+
+    if ( xc_hypercall_bounce_pre(xch, buf) )
+    {
+        PERROR("Could not bounce memory for flask op hypercall");
+        return -1;
+    }
+
+    op.cmd = FLASK_CONTEXT_TO_SID;
+    op.u.sid_context.size = size;
+    set_xen_guest_handle(op.u.sid_context.context, buf);
     
-    op.cmd = FLASK_CONTEXT_TO_SID;
-    op.buf = buf;
-    op.size = size;
-    
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-    
-    sscanf(buf, "%u", sid);
+    err = xc_flask_op(xch, &op);
 
-    return 0;
+    if ( !err )
+        *sid = op.u.sid_context.sid;
+
+    xc_hypercall_bounce_post(xch, buf);
+
+    return err;
 }
 
-int xc_flask_sid_to_context(xc_interface *xc_handle, int sid, char *buf, uint32_t size)
+int xc_flask_sid_to_context(xc_interface *xch, int sid, char *buf, uint32_t size)
 {
     int err;
-    flask_op_t op;
+    DECLARE_FLASK_OP;
+    DECLARE_HYPERCALL_BOUNCE(buf, size, XC_HYPERCALL_BUFFER_BOUNCE_OUT);
+
+    if ( xc_hypercall_bounce_pre(xch, buf) )
+    {
+        PERROR("Could not bounce memory for flask op hypercall");
+        return -1;
+    }
+
+    op.cmd = FLASK_SID_TO_CONTEXT;
+    op.u.sid_context.sid = sid;
+    op.u.sid_context.size = size;
+    set_xen_guest_handle(op.u.sid_context.context, buf);
     
-    op.cmd = FLASK_SID_TO_CONTEXT;
-    op.buf = buf;
-    op.size = size;
-    
-    snprintf(buf, size, "%u", sid);
+    err = xc_flask_op(xch, &op);
 
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-
-    return 0;
+    xc_hypercall_bounce_post(xch, buf);
+   
+    return err;
 }
 
-int xc_flask_getenforce(xc_interface *xc_handle)
+int xc_flask_getenforce(xc_interface *xch)
 {
-    int err;
-    flask_op_t op;
-    char buf[20];            
-    int size = 20;
-    int mode;
- 
+    DECLARE_FLASK_OP;
     op.cmd = FLASK_GETENFORCE;
-    op.buf = buf;
-    op.size = size;
     
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-
-    sscanf(buf, "%i", &mode);
-
-    return mode;
+    return xc_flask_op(xch, &op);
 }
 
-int xc_flask_setenforce(xc_interface *xc_handle, int mode)
+int xc_flask_setenforce(xc_interface *xch, int mode)
 {
-    int err;
-    flask_op_t op;
-    char buf[20];
-    int size = 20; 
- 
+    DECLARE_FLASK_OP;
     op.cmd = FLASK_SETENFORCE;
-    op.buf = buf;
-    op.size = size;
+    op.u.enforce.enforcing = mode;
    
-    snprintf(buf, size, "%i", mode);
- 
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-
-    return 0;
+    return xc_flask_op(xch, &op);
 }
 
-int xc_flask_getbool_byid(xc_interface *xc_handle, int id, char *name, uint32_t size, int *curr, int *pend)
+int xc_flask_getbool_byid(xc_interface *xch, int id, char *name, uint32_t size, int *curr, int *pend)
 {
-    flask_op_t op;
-    char buf[255];
     int rv;
+    DECLARE_FLASK_OP;
+    DECLARE_HYPERCALL_BOUNCE(name, size, XC_HYPERCALL_BUFFER_BOUNCE_OUT);
 
-    op.cmd = FLASK_GETBOOL2;
-    op.buf = buf;
-    op.size = 255;
+    if ( xc_hypercall_bounce_pre(xch, name) )
+    {
+        PERROR("Could not bounce memory for flask op hypercall");
+        return -1;
+    }
 
-    snprintf(buf, sizeof buf, "%i", id);
+    op.cmd = FLASK_GETBOOL;
+    op.u.boolean.bool_id = id;
+    op.u.boolean.size = size;
+    set_xen_guest_handle(op.u.boolean.name, name);
 
-    rv = xc_flask_op(xc_handle, &op);
+    rv = xc_flask_op(xch, &op);
+
+    xc_hypercall_bounce_post(xch, name);
 
     if ( rv )
         return rv;
     
-    sscanf(buf, "%i %i %s", curr, pend, name);
+    if ( curr )
+        *curr = op.u.boolean.enforcing;
+    if ( pend )
+        *pend = op.u.boolean.pending;
 
     return rv;
 }
 
-int xc_flask_getbool_byname(xc_interface *xc_handle, char *name, int *curr, int *pend)
+int xc_flask_getbool_byname(xc_interface *xch, char *name, int *curr, int *pend)
 {
-    flask_op_t op;
-    char buf[255];
     int rv;
+    DECLARE_FLASK_OP;
+    DECLARE_HYPERCALL_BOUNCE(name, strlen(name), XC_HYPERCALL_BUFFER_BOUNCE_IN);
 
-    op.cmd = FLASK_GETBOOL_NAMED;
-    op.buf = buf;
-    op.size = 255;
+    op.cmd = FLASK_GETBOOL;
+    op.u.boolean.bool_id = -1;
+    op.u.boolean.size = strlen(name);
+    set_xen_guest_handle(op.u.boolean.name, name);
 
-    strncpy(buf, name, op.size);
+    rv = xc_flask_op(xch, &op);
 
-    rv = xc_flask_op(xc_handle, &op);
+    xc_hypercall_bounce_post(xch, name);
 
     if ( rv )
         return rv;
     
-    sscanf(buf, "%i %i", curr, pend);
+    if ( curr )
+        *curr = op.u.boolean.enforcing;
+    if ( pend )
+        *pend = op.u.boolean.pending;
 
     return rv;
 }
 
-int xc_flask_setbool(xc_interface *xc_handle, char *name, int value, int commit)
+int xc_flask_setbool(xc_interface *xch, char *name, int value, int commit)
 {
-    flask_op_t op;
-    char buf[255];
-    int size = 255;
+    int rv;
+    DECLARE_FLASK_OP;
+    DECLARE_HYPERCALL_BOUNCE(name, strlen(name), XC_HYPERCALL_BUFFER_BOUNCE_IN);
 
-    op.cmd = FLASK_SETBOOL_NAMED;
-    op.buf = buf;
-    op.size = size;
+    op.cmd = FLASK_SETBOOL;
+    op.u.boolean.bool_id = -1;
+    op.u.boolean.new_value = value;
+    op.u.boolean.commit = 1;
+    op.u.boolean.size = strlen(name);
+    set_xen_guest_handle(op.u.boolean.name, name);
 
-    snprintf(buf, size, "%s %i %i", name, value, commit);
+    rv = xc_flask_op(xch, &op);
 
-    return xc_flask_op(xc_handle, &op);
+    xc_hypercall_bounce_post(xch, name);
+
+    return rv;
 }
 
-static int xc_flask_add(xc_interface *xc_handle, char *cat, char *arg, char *scontext)
+
+static int xc_flask_add(xc_interface *xch, uint32_t ocon, uint64_t low, uint64_t high, char *scontext)
 {
-    char buf[512];
-    flask_op_t op;
+    uint32_t sid;
+    int err;
+    DECLARE_FLASK_OP;
 
-    memset(buf, 0, 512);
-    snprintf(buf, 512, "%s %255s %s", cat, scontext, arg);
+    err = xc_flask_context_to_sid(xch, scontext, strlen(scontext), &sid);
+    if ( err )
+        return err;
+
     op.cmd = FLASK_ADD_OCONTEXT;
-    op.buf = buf;
-    op.size = 512;
+    op.u.ocontext.ocon = ocon;
+    op.u.ocontext.sid = sid;
+    op.u.ocontext.low = low;
+    op.u.ocontext.high = high;
     
-    return xc_flask_op(xc_handle, &op);
+    return xc_flask_op(xch, &op);
 }
 
-int xc_flask_add_pirq(xc_interface *xc_handle, unsigned int pirq, char *scontext)
+int xc_flask_add_pirq(xc_interface *xch, unsigned int pirq, char *scontext)
 {
-    char arg[16];
-
-    snprintf(arg, 16, "%u", pirq);
-    return xc_flask_add(xc_handle, OCON_PIRQ_STR, arg, scontext);
+    return xc_flask_add(xch, OCON_PIRQ, pirq, pirq, scontext);
 }
 
-int xc_flask_add_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high,
+int xc_flask_add_ioport(xc_interface *xch, unsigned long low, unsigned long high,
                       char *scontext)
 {
-    char arg[64];
-
-    snprintf(arg, 64, "%lu %lu", low, high);
-    return xc_flask_add(xc_handle, OCON_IOPORT_STR, arg, scontext);
+    return xc_flask_add(xch, OCON_IOPORT, low, high, scontext);
 }
 
-int xc_flask_add_iomem(xc_interface *xc_handle, unsigned long low, unsigned long high,
+int xc_flask_add_iomem(xc_interface *xch, unsigned long low, unsigned long high,
                      char *scontext)
 {
-    char arg[64];
-
-    snprintf(arg, 64, "%lu %lu", low, high);
-    return xc_flask_add(xc_handle, OCON_IOMEM_STR, arg, scontext);
+    return xc_flask_add(xch, OCON_IOMEM, low, high, scontext);
 }
 
-int xc_flask_add_device(xc_interface *xc_handle, unsigned long device, char *scontext)
+int xc_flask_add_device(xc_interface *xch, unsigned long device, char *scontext)
 {
-    char arg[32];
-
-    snprintf(arg, 32, "%lu", device);
-    return xc_flask_add(xc_handle, OCON_DEVICE_STR, arg, scontext);
+    return xc_flask_add(xch, OCON_DEVICE, device, device, scontext);
 }
 
-static int xc_flask_del(xc_interface *xc_handle, char *cat, char *arg)
+static int xc_flask_del(xc_interface *xch, uint32_t ocon, uint64_t low, uint64_t high)
 {
-    char buf[256];
-    flask_op_t op;
+    DECLARE_FLASK_OP;
 
-    memset(buf, 0, 256);
-    snprintf(buf, 256, "%s %s", cat, arg);
     op.cmd = FLASK_DEL_OCONTEXT;
-    op.buf = buf;
-    op.size = 256;
+    op.u.ocontext.ocon = ocon;
+    op.u.ocontext.low = low;
+    op.u.ocontext.high = high;
     
-    return xc_flask_op(xc_handle, &op);
+    return xc_flask_op(xch, &op);
 }
 
-int xc_flask_del_pirq(xc_interface *xc_handle, unsigned int pirq)
+int xc_flask_del_pirq(xc_interface *xch, unsigned int pirq)
 {
-    char arg[16];
-
-    snprintf(arg, 16, "%u", pirq);
-    return xc_flask_del(xc_handle, OCON_PIRQ_STR, arg);
+    return xc_flask_del(xch, OCON_PIRQ, pirq, pirq);
 }
 
-int xc_flask_del_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high)
+int xc_flask_del_ioport(xc_interface *xch, unsigned long low, unsigned long high)
 {
-    char arg[64];
-
-    snprintf(arg, 64, "%lu %lu", low, high);
-    return xc_flask_del(xc_handle, OCON_IOPORT_STR, arg);
+    return xc_flask_del(xch, OCON_IOPORT, low, high);
 }
 
-int xc_flask_del_iomem(xc_interface *xc_handle, unsigned long low, unsigned long high)
+int xc_flask_del_iomem(xc_interface *xch, unsigned long low, unsigned long high)
 {
-    char arg[64];
-
-    snprintf(arg, 64, "%lu %lu", low, high);
-    return xc_flask_del(xc_handle, OCON_IOMEM_STR, arg);
+    return xc_flask_del(xch, OCON_IOMEM, low, high);
 }
 
-int xc_flask_del_device(xc_interface *xc_handle, unsigned long device)
+int xc_flask_del_device(xc_interface *xch, unsigned long device)
 {
-    char arg[32];
-
-    snprintf(arg, 32, "%lu", device);
-    return xc_flask_del(xc_handle, OCON_DEVICE_STR, arg);
+    return xc_flask_del(xch, OCON_DEVICE, device, device);
 }
 
-int xc_flask_access(xc_interface *xc_handle, const char *scon, const char *tcon,
+int xc_flask_access(xc_interface *xch, const char *scon, const char *tcon,
                 uint16_t tclass, uint32_t req,
                 uint32_t *allowed, uint32_t *decided,
                 uint32_t *auditallow, uint32_t *auditdeny,
                 uint32_t *seqno)
 {
-/* maximum number of digits in a 16-bit decimal number: */
-#define MAX_SHORT_DEC_LEN 5
+    DECLARE_FLASK_OP;
+    int err;
 
-    char *buf;
-    int bufLen;
-    int err;
-    flask_op_t op;
-    uint32_t dummy_allowed;
-    uint32_t dummy_decided;
-    uint32_t dummy_auditallow;
-    uint32_t dummy_auditdeny;
-    uint32_t dummy_seqno;
-  
-    if (!allowed)
-        allowed = &dummy_allowed;
-    if (!decided)
-        decided = &dummy_decided;
-    if (!auditallow)
-        auditallow = &dummy_auditallow;
-    if (!auditdeny)
-        auditdeny = &dummy_auditdeny;
-    if (!seqno)
-        seqno = &dummy_seqno;
-
-    if (!scon)
-        return -EINVAL;
-    if (!tcon)
-        return -EINVAL;
-
-    bufLen = strlen(scon) + 1 + strlen(tcon) + 1 +
-        MAX_SHORT_DEC_LEN + 1 +
-        sizeof(req)*2 + 1;
-    buf = malloc(bufLen);
-    snprintf(buf, bufLen, "%s %s %hu %x", scon, tcon, tclass, req);
+    err = xc_flask_context_to_sid(xch, (char*)scon, strlen(scon), &op.u.access.ssid);
+    if ( err )
+        return err;
+    err = xc_flask_context_to_sid(xch, (char*)tcon, strlen(tcon), &op.u.access.tsid);
+    if ( err )
+        return err;
 
     op.cmd = FLASK_ACCESS;
-    op.buf = buf;
-    op.size = strlen(buf)+1;
+    op.u.access.tclass = tclass;
+    op.u.access.req = req;
     
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
+    err = xc_flask_op(xch, &op);
+
+    if ( err )
         return err;
-    }
-   
-    if (sscanf(op.buf, "%x %x %x %x %u",
-               allowed, decided,
-               auditallow, auditdeny,
-               seqno) != 5) {
-        err = -EILSEQ;
-    }
 
-    err = ((*allowed & req) == req)? 0 : -EPERM;
+    if ( allowed )
+        *allowed = op.u.access.allowed;
+    if ( decided )
+        *decided = 0xffffffff;
+    if ( auditallow )
+        *auditallow = op.u.access.audit_allow;
+    if ( auditdeny )
+        *auditdeny = op.u.access.audit_deny;
+    if ( seqno )
+        *seqno = op.u.access.seqno;
+
+    if ( (op.u.access.allowed & req) != req )
+        err = -EPERM;
 
     return err;
-
 }
 
-int xc_flask_avc_hashstats(xc_interface *xc_handle, char *buf, int size)
+int xc_flask_avc_hashstats(xc_interface *xch, char *buf, int size)
 {
     int err;
-    flask_op_t op;
+    DECLARE_FLASK_OP;
   
     op.cmd = FLASK_AVC_HASHSTATS;
-    op.buf = buf;
-    op.size = size;
   
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
+    err = xc_flask_op(xch, &op);
+
+    snprintf(buf, size,
+             "entries: %d\nbuckets used: %d/%d\nlongest chain: %d\n",
+             op.u.hash_stats.entries, op.u.hash_stats.buckets_used,
+             op.u.hash_stats.buckets_total, op.u.hash_stats.max_chain_len);
+
+    return err;
+}
+
+int xc_flask_avc_cachestats(xc_interface *xch, char *buf, int size)
+{
+    int err, n;
+    int i = 0;
+    DECLARE_FLASK_OP;
+
+    n = snprintf(buf, size, "lookups hits misses allocations reclaims frees\n");
+    buf += n;
+    size -= n;
+  
+    op.cmd = FLASK_AVC_CACHESTATS;
+    while ( size > 0 )
     {
-        free(buf);
-        return err;
+        op.u.cache_stats.cpu = i;
+        err = xc_flask_op(xch, &op);
+        if ( err && errno == ENOENT )
+            return 0;
+        if ( err )
+            return err;
+        n = snprintf(buf, size, "%u %u %u %u %u %u\n",
+                     op.u.cache_stats.lookups, op.u.cache_stats.hits,
+                     op.u.cache_stats.misses, op.u.cache_stats.allocations,
+                     op.u.cache_stats.reclaims, op.u.cache_stats.frees);
+        buf += n;
+        size -= n;
+        i++;
     }
 
     return 0;
 }
 
-int xc_flask_avc_cachestats(xc_interface *xc_handle, char *buf, int size)
+int xc_flask_policyvers(xc_interface *xch)
 {
-    int err;
-    flask_op_t op;
-  
-    op.cmd = FLASK_AVC_CACHESTATS;
-    op.buf = buf;
-    op.size = size;
-  
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
+    DECLARE_FLASK_OP;
+    op.cmd = FLASK_POLICYVERS;
 
-    return 0;
+    return xc_flask_op(xch, &op);
 }
 
-int xc_flask_policyvers(xc_interface *xc_handle, char *buf, int size)
+int xc_flask_getavc_threshold(xc_interface *xch)
 {
-    int err;
-    flask_op_t op;
-  
-    op.cmd = FLASK_POLICYVERS;
-    op.buf = buf;
-    op.size = size;
-
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-    {
-        free(buf);
-        return err;
-    }
-
-    return 0;
+    DECLARE_FLASK_OP;
+    op.cmd = FLASK_GETAVC_THRESHOLD;
+    
+    return xc_flask_op(xch, &op);
 }
 
-int xc_flask_getavc_threshold(xc_interface *xc_handle)
+int xc_flask_setavc_threshold(xc_interface *xch, int threshold)
 {
-    int err;
-    flask_op_t op;
-    char buf[20];            
-    int size = 20;
-    int threshold;
- 
-    op.cmd = FLASK_GETAVC_THRESHOLD;
-    op.buf = buf;
-    op.size = size;
-    
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
+    DECLARE_FLASK_OP;
+    op.cmd = FLASK_SETAVC_THRESHOLD;
+    op.u.setavc_threshold.threshold = threshold;
 
-    sscanf(buf, "%i", &threshold);
-
-    return threshold;
-}
-
-int xc_flask_setavc_threshold(xc_interface *xc_handle, int threshold)
-{
-    int err;
-    flask_op_t op;
-    char buf[20];            
-    int size = 20;
- 
-    op.cmd = FLASK_SETAVC_THRESHOLD;
-    op.buf = buf;
-    op.size = size;
-
-    snprintf(buf, size, "%i", threshold);
- 
-    if ( (err = xc_flask_op(xc_handle, &op)) != 0 )
-        return err;
-
-    return 0;
+    return xc_flask_op(xch, &op);
 }
 
 /*
diff -r 28b85ad1fe4e -r bf326829102b tools/libxc/xc_private.h
--- a/tools/libxc/xc_private.h	Mon Feb 06 05:04:32 2012 -0800
+++ b/tools/libxc/xc_private.h	Mon Feb 06 05:07:20 2012 -0800
@@ -42,11 +42,13 @@
 #define DECLARE_DOMCTL struct xen_domctl domctl = { 0 }
 #define DECLARE_SYSCTL struct xen_sysctl sysctl = { 0 }
 #define DECLARE_PHYSDEV_OP struct physdev_op physdev_op = { 0 }
+#define DECLARE_FLASK_OP struct xen_flask_op op = { 0 }
 #else
 #define DECLARE_HYPERCALL privcmd_hypercall_t hypercall
 #define DECLARE_DOMCTL struct xen_domctl domctl
 #define DECLARE_SYSCTL struct xen_sysctl sysctl
 #define DECLARE_PHYSDEV_OP struct physdev_op physdev_op
+#define DECLARE_FLASK_OP struct xen_flask_op op
 #endif
 
 #undef PAGE_SHIFT
diff -r 28b85ad1fe4e -r bf326829102b tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h	Mon Feb 06 05:04:32 2012 -0800
+++ b/tools/libxc/xenctrl.h	Mon Feb 06 05:07:20 2012 -0800
@@ -1326,7 +1326,7 @@
 
 int xc_version(xc_interface *xch, int cmd, void *arg);
 
-int xc_flask_op(xc_interface *xch, flask_op_t *op);
+int xc_flask_op(xc_interface *xch, xen_flask_op_t *op);
 
 /*
  * Subscribe to state changes in a domain via evtchn.
@@ -1974,7 +1974,7 @@
                   uint32_t *auditallow, uint32_t *auditdeny,
                   uint32_t *seqno);
 int xc_flask_avc_cachestats(xc_interface *xc_handle, char *buf, int size);
-int xc_flask_policyvers(xc_interface *xc_handle, char *buf, int size);
+int xc_flask_policyvers(xc_interface *xc_handle);
 int xc_flask_avc_hashstats(xc_interface *xc_handle, char *buf, int size);
 int xc_flask_getavc_threshold(xc_interface *xc_handle);
 int xc_flask_setavc_threshold(xc_interface *xc_handle, int threshold);
diff -r 28b85ad1fe4e -r bf326829102b xen/include/public/xsm/flask_op.h
--- a/xen/include/public/xsm/flask_op.h	Mon Feb 06 05:04:32 2012 -0800
+++ b/xen/include/public/xsm/flask_op.h	Mon Feb 06 05:07:20 2012 -0800
@@ -25,6 +25,118 @@
 #ifndef __FLASK_OP_H__
 #define __FLASK_OP_H__
 
+#define XEN_FLASK_INTERFACE_VERSION 1
+
+struct xen_flask_load {
+    XEN_GUEST_HANDLE(char) buffer;
+    uint32_t size;
+};
+
+struct xen_flask_setenforce {
+    uint32_t enforcing;
+};
+
+struct xen_flask_sid_context {
+    /* IN/OUT: sid to convert to/from string */
+    uint32_t sid;
+    /* IN: size of the context buffer
+     * OUT: actual size of the output context string
+     */
+    uint32_t size;
+    XEN_GUEST_HANDLE(char) context;
+};
+
+struct xen_flask_access {
+    /* IN: access request */
+    uint32_t ssid;
+    uint32_t tsid;
+    uint32_t tclass;
+    uint32_t req;
+    /* OUT: AVC data */
+    uint32_t allowed;
+    uint32_t audit_allow;
+    uint32_t audit_deny;
+    uint32_t seqno;
+};
+
+struct xen_flask_transition {
+    /* IN: transition SIDs and class */
+    uint32_t ssid;
+    uint32_t tsid;
+    uint32_t tclass;
+    /* OUT: new SID */
+    uint32_t newsid;
+};
+
+struct xen_flask_userlist {
+    /* IN: starting SID for list */
+    uint32_t start_sid;
+    /* IN: size of user string and output buffer
+     * OUT: number of SIDs returned */
+    uint32_t size;
+    union {
+        /* IN: user to enumerate SIDs */
+        XEN_GUEST_HANDLE(char) user;
+        /* OUT: SID list */
+        XEN_GUEST_HANDLE(uint32) sids;
+    } u;
+};
+
+struct xen_flask_boolean {
+    /* IN/OUT: numeric identifier for boolean [GET/SET]
+     * If -1, name will be used and bool_id will be filled in. */
+    uint32_t bool_id;
+    /* OUT: current enforcing value of boolean [GET/SET] */
+    uint8_t enforcing;
+    /* OUT: pending value of boolean [GET/SET] */
+    uint8_t pending;
+    /* IN: new value of boolean [SET] */
+    uint8_t new_value;
+    /* IN: commit new value instead of only setting pending [SET] */
+    uint8_t commit;
+    /* IN: size of boolean name buffer [GET/SET]
+     * OUT: actual size of name [GET only] */
+    uint32_t size;
+    /* IN: if bool_id is -1, used to find boolean [GET/SET]
+     * OUT: textual name of boolean [GET only]
+     */
+    XEN_GUEST_HANDLE(char) name;
+};
+
+struct xen_flask_setavc_threshold {
+    /* IN */
+    uint32_t threshold;
+};
+
+struct xen_flask_hash_stats {
+    /* OUT */
+    uint32_t entries;
+    uint32_t buckets_used;
+    uint32_t buckets_total;
+    uint32_t max_chain_len;
+};
+
+struct xen_flask_cache_stats {
+    /* IN */
+    uint32_t cpu;
+    /* OUT */
+    uint32_t lookups;
+    uint32_t hits;
+    uint32_t misses;
+    uint32_t allocations;
+    uint32_t reclaims;
+    uint32_t frees;
+};
+
+struct xen_flask_ocontext {
+    /* IN */
+    uint32_t ocon;
+    uint32_t sid;
+    uint64_t low, high;
+};
+
+struct xen_flask_op {
+    uint32_t cmd;
 #define FLASK_LOAD              1
 #define FLASK_GETENFORCE        2
 #define FLASK_SETENFORCE        3
@@ -47,18 +159,26 @@
 #define FLASK_MEMBER            20
 #define FLASK_ADD_OCONTEXT      21
 #define FLASK_DEL_OCONTEXT      22
-#define FLASK_GETBOOL_NAMED     23
-#define FLASK_GETBOOL2          24
-#define FLASK_SETBOOL_NAMED     25
-
-#define FLASK_LAST              FLASK_SETBOOL_NAMED
-
-typedef struct flask_op {
-    uint32_t  cmd;
-    uint32_t  size;
-    char      *buf;
-} flask_op_t;
-
-DEFINE_XEN_GUEST_HANDLE(flask_op_t);
+    uint32_t interface_version; /* XEN_FLASK_INTERFACE_VERSION */
+    union {
+        struct xen_flask_load load;
+        struct xen_flask_setenforce enforce;
+        /* FLASK_CONTEXT_TO_SID and FLASK_SID_TO_CONTEXT */
+        struct xen_flask_sid_context sid_context;
+        struct xen_flask_access access;
+        /* FLASK_CREATE, FLASK_RELABEL, FLASK_MEMBER */
+        struct xen_flask_transition transition;
+        struct xen_flask_userlist userlist;
+        /* FLASK_GETBOOL, FLASK_SETBOOL */
+        struct xen_flask_boolean boolean;
+        struct xen_flask_setavc_threshold setavc_threshold;
+        struct xen_flask_hash_stats hash_stats;
+        struct xen_flask_cache_stats cache_stats;
+        /* FLASK_ADD_OCONTEXT, FLASK_DEL_OCONTEXT */
+        struct xen_flask_ocontext ocontext;
+    } u;
+};
+typedef struct xen_flask_op xen_flask_op_t;
+DEFINE_XEN_GUEST_HANDLE(xen_flask_op_t);
 
 #endif
diff -r 28b85ad1fe4e -r bf326829102b xen/xsm/flask/avc.c
--- a/xen/xsm/flask/avc.c	Mon Feb 06 05:04:32 2012 -0800
+++ b/xen/xsm/flask/avc.c	Mon Feb 06 05:07:20 2012 -0800
@@ -28,6 +28,7 @@
 #include <xen/rcupdate.h>
 #include <asm/atomic.h>
 #include <asm/current.h>
+#include <public/xsm/flask_op.h>
 
 #include "avc.h"
 #include "avc_ss.h"
@@ -251,7 +252,7 @@
     printk("AVC INITIALIZED\n");
 }
 
-int avc_get_hash_stats(char *buf, uint32_t size)
+int avc_get_hash_stats(struct xen_flask_hash_stats *arg)
 {
     int i, chain_len, max_chain_len, slots_used;
     struct avc_node *node;
@@ -279,10 +280,12 @@
 
     rcu_read_unlock(&avc_rcu_lock);
     
-    return snprintf(buf, size, "entries: %d\nbuckets used: %d/%d\n"
-                    "longest chain: %d\n",
-                    atomic_read(&avc_cache.active_nodes),
-                    slots_used, AVC_CACHE_SLOTS, max_chain_len);
+    arg->entries = atomic_read(&avc_cache.active_nodes);
+    arg->buckets_used = slots_used;
+    arg->buckets_total = AVC_CACHE_SLOTS;
+    arg->max_chain_len = max_chain_len;
+
+    return 0;
 }
 
 static void avc_node_free(struct rcu_head *rhead)
diff -r 28b85ad1fe4e -r bf326829102b xen/xsm/flask/flask_op.c
--- a/xen/xsm/flask/flask_op.c	Mon Feb 06 05:04:32 2012 -0800
+++ b/xen/xsm/flask/flask_op.c	Mon Feb 06 05:07:20 2012 -0800
@@ -30,10 +30,9 @@
 #endif
 
 #define MAX_POLICY_SIZE 0x4000000
-#define FLASK_COPY_IN \
+
+#define FLASK_COPY_OUT \
     ( \
-        1UL<<FLASK_LOAD | \
-        1UL<<FLASK_SETENFORCE | \
         1UL<<FLASK_CONTEXT_TO_SID | \
         1UL<<FLASK_SID_TO_CONTEXT | \
         1UL<<FLASK_ACCESS | \
@@ -42,36 +41,10 @@
         1UL<<FLASK_USER | \
         1UL<<FLASK_GETBOOL | \
         1UL<<FLASK_SETBOOL | \
-        1UL<<FLASK_COMMITBOOLS | \
-        1UL<<FLASK_DISABLE | \
-        1UL<<FLASK_SETAVC_THRESHOLD | \
-        1UL<<FLASK_MEMBER | \
-        1UL<<FLASK_ADD_OCONTEXT | \
-        1UL<<FLASK_DEL_OCONTEXT | \
-        1UL<<FLASK_GETBOOL_NAMED | \
-        1UL<<FLASK_GETBOOL2 | \
-        1UL<<FLASK_SETBOOL_NAMED \
-    )
-
-#define FLASK_COPY_OUT \
-    ( \
-        1UL<<FLASK_GETENFORCE | \
-        1UL<<FLASK_CONTEXT_TO_SID | \
-        1UL<<FLASK_SID_TO_CONTEXT | \
-        1UL<<FLASK_ACCESS | \
-        1UL<<FLASK_CREATE | \
-        1UL<<FLASK_RELABEL | \
-        1UL<<FLASK_USER | \
-        1UL<<FLASK_POLICYVERS | \
-        1UL<<FLASK_GETBOOL | \
-        1UL<<FLASK_MLS | \
-        1UL<<FLASK_GETAVC_THRESHOLD | \
         1UL<<FLASK_AVC_HASHSTATS | \
         1UL<<FLASK_AVC_CACHESTATS | \
         1UL<<FLASK_MEMBER | \
-        1UL<<FLASK_GETBOOL_NAMED | \
-        1UL<<FLASK_GETBOOL2 \
-    )
+   0)
 
 static DEFINE_SPINLOCK(sel_sem);
 
@@ -96,412 +69,186 @@
                         perms, NULL);
 }
 
-static int flask_security_user(char *buf, uint32_t size)
+static int flask_copyin_string(XEN_GUEST_HANDLE(char) u_buf, char **buf, uint32_t size)
 {
-    char *page = NULL;
-    char *con, *user, *ptr;
-    u32 sid, *sids;
-    int length;
-    char *newcon;
-    int i, rc;
-    u32 len, nsids;
-        
-    length = domain_has_security(current->domain, SECURITY__COMPUTE_USER);
-    if ( length )
-        return length;
-            
-    length = -ENOMEM;
-    con = xmalloc_array(char, size+1);
-    if ( !con )
-        return length;
-    memset(con, 0, size+1);
-    
-    user = xmalloc_array(char, size+1);
-    if ( !user )
-        goto out;
-    memset(user, 0, size+1);
-    
-    length = -ENOMEM;
-    page = xmalloc_bytes(PAGE_SIZE);
-    if ( !page )
-        goto out2;
-    memset(page, 0, PAGE_SIZE);
+    char *tmp = xmalloc_bytes(size + 1);
+    if ( !tmp )
+        return -ENOMEM;
 
-    length = -EINVAL;
-    if ( sscanf(buf, "%s %s", con, user) != 2 )
-        goto out2;
+    if ( copy_from_guest(tmp, u_buf, size) )
+    {
+        xfree(tmp);
+        return -EFAULT;
+    }
+    tmp[size] = 0;
 
-    length = security_context_to_sid(con, strlen(con)+1, &sid);
-    if ( length < 0 )
-        goto out2;
-            
-    length = security_get_user_sids(sid, user, &sids, &nsids);
-    if ( length < 0 )
-        goto out2;
-    
-    length = snprintf(page, PAGE_SIZE, "%u", nsids) + 1;
-    ptr = page + length;
-    for ( i = 0; i < nsids; i++ )
-    {
-        rc = security_sid_to_context(sids[i], &newcon, &len);
-        if ( rc )
-        {
-            length = rc;
-            goto out3;
-        }
-        if ( (length + len) >= PAGE_SIZE )
-        {
-            xfree(newcon);
-            length = -ERANGE;
-            goto out3;
-        }
-        memcpy(ptr, newcon, len);
-        xfree(newcon);
-        ptr += len;
-        length += len;
-    }
-    
-    if ( length > size )
-    {
-        printk( "%s:  context size (%u) exceeds payload "
-                "max\n", __FUNCTION__, length);
-        length = -ERANGE;
-        goto out3;
-    }
-
-    memset(buf, 0, size);
-    memcpy(buf, page, length);
-        
- out3:
-    xfree(sids);
- out2:
-    if ( page )
-        xfree(page);
-    xfree(user);
- out:
-    xfree(con);
-    return length;
+    *buf = tmp;
+    return 0;
 }
 
-static int flask_security_relabel(char *buf, uint32_t size)
+static int flask_security_user(struct xen_flask_userlist *arg)
 {
-    char *scon, *tcon;
-    u32 ssid, tsid, newsid;
-    u16 tclass;
-    int length;
-    char *newcon;
+    char *user;
+    u32 *sids;
+    u32 nsids;
+    int rv;
+
+    rv = domain_has_security(current->domain, SECURITY__COMPUTE_USER);
+    if ( rv )
+        return rv;
+
+    rv = flask_copyin_string(arg->u.user, &user, arg->size);
+    if ( rv )
+        return rv;
+
+    rv = security_get_user_sids(arg->start_sid, user, &sids, &nsids);
+    if ( rv < 0 )
+        goto out;
+
+    if ( nsids * sizeof(sids[0]) > arg->size )
+        nsids = arg->size / sizeof(sids[0]);
+
+    arg->size = nsids;
+
+    if ( copy_to_guest(arg->u.sids, sids, nsids) )
+        rv = -EFAULT;
+
+    xfree(sids);
+ out:
+    xfree(user);
+    return rv;
+}
+
+static int flask_security_relabel(struct xen_flask_transition *arg)
+{
+    int rv;
+
+    rv = domain_has_security(current->domain, SECURITY__COMPUTE_RELABEL);
+    if ( rv )
+        return rv;
+
+    rv = security_change_sid(arg->ssid, arg->tsid, arg->tclass, &arg->newsid);
+
+    return rv;
+}
+
+static int flask_security_create(struct xen_flask_transition *arg)
+{
+    int rv;
+
+    rv = domain_has_security(current->domain, SECURITY__COMPUTE_CREATE);
+    if ( rv )
+        return rv;
+
+    rv = security_transition_sid(arg->ssid, arg->tsid, arg->tclass, &arg->newsid);
+
+    return rv;
+}
+
+static int flask_security_access(struct xen_flask_access *arg)
+{
+    struct av_decision avd;
+    int rv;
+
+    rv = domain_has_security(current->domain, SECURITY__COMPUTE_AV);
+    if ( rv )
+        return rv;
+
+    rv = security_compute_av(arg->ssid, arg->tsid, arg->tclass, arg->req, &avd);
+    if ( rv < 0 )
+        return rv;
+
+    arg->allowed = avd.allowed;
+    arg->audit_allow = avd.auditallow;
+    arg->audit_deny = avd.auditdeny;
+    arg->seqno = avd.seqno;
+                
+    return rv;
+}
+
+static int flask_security_member(struct xen_flask_transition *arg)
+{
+    int rv;
+
+    rv = domain_has_security(current->domain, SECURITY__COMPUTE_MEMBER);
+    if ( rv )
+        return rv;
+
+    rv = security_member_sid(arg->ssid, arg->tsid, arg->tclass, &arg->newsid);
+
+    return rv;
+}
+
+static int flask_security_setenforce(struct xen_flask_setenforce *arg)
+{
+    int enforce = !!(arg->enforcing);
+    int rv;
+
+    if ( enforce == flask_enforcing )
+        return 0;
+
+    rv = domain_has_security(current->domain, SECURITY__SETENFORCE);
+    if ( rv )
+        return rv;
+
+    flask_enforcing = enforce;
+
+    if ( flask_enforcing )
+        avc_ss_reset(0);
+
+    return 0;
+}
+
+static int flask_security_context(struct xen_flask_sid_context *arg)
+{
+    int rv;
+    char *buf;
+
+    rv = domain_has_security(current->domain, SECURITY__CHECK_CONTEXT);
+    if ( rv )
+        return rv;
+
+    rv = flask_copyin_string(arg->context, &buf, arg->size);
+    if ( rv )
+        return rv;
+
+    rv = security_context_to_sid(buf, arg->size, &arg->sid);
+    if ( rv < 0 )
+        goto out;
+
+ out:
+    xfree(buf);
+
+    return rv;
+}
+
+static int flask_security_sid(struct xen_flask_sid_context *arg)
+{
+    int rv;
+    char *context;
     u32 len;
 
-    length = domain_has_security(current->domain, SECURITY__COMPUTE_RELABEL);
-    if ( length )
-        return length;
-            
-    length = -ENOMEM;
-    scon = xmalloc_array(char, size+1);
-    if ( !scon )
-        return length;
-    memset(scon, 0, size+1);
-        
-    tcon = xmalloc_array(char, size+1);
-    if ( !tcon )
-        goto out;
-    memset(tcon, 0, size+1);
-        
-    length = -EINVAL;
-    if ( sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3 )
-        goto out2;
-            
-    length = security_context_to_sid(scon, strlen(scon)+1, &ssid);
-    if ( length < 0 )
-        goto out2;
-    length = security_context_to_sid(tcon, strlen(tcon)+1, &tsid);
-    if ( length < 0 )
-        goto out2;
-            
-    length = security_change_sid(ssid, tsid, tclass, &newsid);
-    if ( length < 0 )
-        goto out2;
-            
-    length = security_sid_to_context(newsid, &newcon, &len);
-    if ( length < 0 )
-        goto out2;
-            
-    if ( len > size )
-    {
-        printk( "%s:  context size (%u) exceeds payload "
-                "max\n", __FUNCTION__, len);
-        length = -ERANGE;
-        goto out3;
-    }
+    rv = domain_has_security(current->domain, SECURITY__CHECK_CONTEXT);
+    if ( rv )
+        return rv;
 
-    memset(buf, 0, size);
-    memcpy(buf, newcon, len);
-    length = len;
+    rv = security_sid_to_context(arg->sid, &context, &len);
+    if ( rv < 0 )
+        return rv;
 
- out3:
-    xfree(newcon);
- out2:
-    xfree(tcon);
- out:
-    xfree(scon);
-    return length;
-}
+    rv = 0;
 
-static int flask_security_create(char *buf, uint32_t size)
-{
-    char *scon, *tcon;
-    u32 ssid, tsid, newsid;
-    u16 tclass;
-    int length;
-    char *newcon;
-    u32 len;
+    if ( len > arg->size )
+        rv = -ERANGE;
 
-    length = domain_has_security(current->domain, SECURITY__COMPUTE_CREATE);
-    if ( length )
-        return length;
+    arg->size = len;
 
-    length = -ENOMEM;
-    scon = xmalloc_array(char, size+1);
-    if ( !scon )
-        return length;
-    memset(scon, 0, size+1);
-
-    tcon = xmalloc_array(char, size+1);
-    if ( !tcon )
-        goto out;
-    memset(tcon, 0, size+1);
-
-    length = -EINVAL;
-    if ( sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3 )
-        goto out2;
-
-    length = security_context_to_sid(scon, strlen(scon)+1, &ssid);
-    if ( length < 0 )
-        goto out2;
-
-    length = security_context_to_sid(tcon, strlen(tcon)+1, &tsid);
-    if ( length < 0 )
-        goto out2;
-
-    length = security_transition_sid(ssid, tsid, tclass, &newsid);
-    if ( length < 0 )
-        goto out2;
-
-    length = security_sid_to_context(newsid, &newcon, &len);
-    if ( length < 0 )    
-        goto out2;
-
-    if ( len > size )
-    {
-        printk( "%s:  context size (%u) exceeds payload "
-                "max\n", __FUNCTION__, len);
-        length = -ERANGE;
-        goto out3;
-    }
-
-    memset(buf, 0, size);
-    memcpy(buf, newcon, len);
-    length = len;
-        
- out3:
-    xfree(newcon);
- out2:
-    xfree(tcon);
- out:
-    xfree(scon);
-    return length;
-}
-
-static int flask_security_access(char *buf, uint32_t size)
-{
-    char *scon, *tcon;
-    u32 ssid, tsid;
-    u16 tclass;
-    u32 req;
-    struct av_decision avd;
-    int length;
-
-    length = domain_has_security(current->domain, SECURITY__COMPUTE_AV);
-    if ( length )
-        return length;
-
-    length = -ENOMEM;
-    scon = xmalloc_array(char, size+1);
-    if (!scon)
-        return length;
-    memset(scon, 0, size+1);
-
-    tcon = xmalloc_array(char, size+1);
-    if ( !tcon )
-        goto out;
-    memset( tcon, 0, size+1 );
-
-    length = -EINVAL;
-    if (sscanf(buf, "%s %s %hu %x", scon, tcon, &tclass, &req) != 4)
-        goto out2;
-
-    length = security_context_to_sid(scon, strlen(scon)+1, &ssid);
-    if ( length < 0 )
-        goto out2;
-
-    length = security_context_to_sid(tcon, strlen(tcon)+1, &tsid);
-    if ( length < 0 )
-        goto out2;
-
-    length = security_compute_av(ssid, tsid, tclass, req, &avd);
-    if ( length < 0 )
-        goto out2;
-
-    memset(buf, 0, size);
-    length = snprintf(buf, size, "%x %x %x %x %u", 
-                      avd.allowed, 0xffffffff,
-                      avd.auditallow, avd.auditdeny, 
-                      avd.seqno);
-                
- out2:
-    xfree(tcon);
- out:
-    xfree(scon);
-    return length;
-}
-
-static int flask_security_member(char *buf, uint32_t size)
-{
-    char *scon, *tcon;
-    u32 ssid, tsid, newsid;
-    u16 tclass;
-    int length;
-    char *newcon;
-    u32 len;
-
-    length = domain_has_security(current->domain, SECURITY__COMPUTE_MEMBER);
-    if ( length )
-        return length;
-
-    length = -ENOMEM;
-    scon = xmalloc_array(char, size+1);
-    if ( !scon )
-        return length;
-    memset(scon, 0, size+1);
-
-    tcon = xmalloc_array(char, size+1);
-    if ( !tcon )
-        goto out;
-    memset(tcon, 0, size+1);
-
-    length = -EINVAL;
-    if ( sscanf(buf, "%s, %s, %hu", scon, tcon, &tclass) != 3 )
-        goto out2;
-
-    length = security_context_to_sid(scon, strlen(scon)+1, &ssid);
-    if ( length < 0 )
-        goto out2;
-
-    length = security_context_to_sid(tcon, strlen(tcon)+1, &tsid);
-    if ( length < 0 )
-        goto out2;
-
-    length = security_member_sid(ssid, tsid, tclass, &newsid);
-    if ( length < 0 )
-        goto out2;
-
-    length = security_sid_to_context(newsid, &newcon, &len);
-    if ( length < 0 )
-        goto out2;
-
-    if ( len > size )
-    {
-        printk("%s:  context size (%u) exceeds payload "
-               "max\n", __FUNCTION__, len);
-        length = -ERANGE;
-        goto out3;
-    }
-
-    memset(buf, 0, size);
-    memcpy(buf, newcon, len);
-    length = len;
-
- out3:
-    xfree(newcon);
- out2:
-    xfree(tcon);
- out:
-    xfree(scon);
-    return length;
-}
-
-static int flask_security_setenforce(char *buf, uint32_t count)
-{
-    int length;
-    int new_value;
-
-    if ( sscanf(buf, "%d", &new_value) != 1 )
-        return -EINVAL;
-
-    if ( new_value != flask_enforcing )
-    {
-        length = domain_has_security(current->domain, SECURITY__SETENFORCE);
-        if ( length )
-            goto out;
-        flask_enforcing = new_value;
-        if ( flask_enforcing )
-            avc_ss_reset(0);
-    }
-    length = count;
-
- out:
-    return length;
-}
-
-static int flask_security_context(char *buf, uint32_t count)
-{
-    u32 sid;
-    int length;
-
-    length = domain_has_security(current->domain, SECURITY__CHECK_CONTEXT);
-    if ( length )
-        goto out;
-
-    length = security_context_to_sid(buf, count, &sid);
-    if ( length < 0 )
-        goto out;
-
-    memset(buf, 0, count);
-    length = snprintf(buf, count, "%u", sid);
-
- out:
-    return length;
-}
-
-static int flask_security_sid(char *buf, uint32_t count)
-{
-    char *context;
-    u32 sid;
-    u32 len;
-    int length;
-
-    length = domain_has_security(current->domain, SECURITY__CHECK_CONTEXT);
-    if ( length )
-        goto out;
-
-    if ( sscanf(buf, "%u", &sid) != 1 )
-        goto out;
-
-    length = security_sid_to_context(sid, &context, &len);
-    if ( length < 0 )
-        goto out;
-
-    if ( len > count )
-        return -ERANGE; 
-
-    memset(buf, 0, count);
-    memcpy(buf, context, len);
-    length = len;
+    if ( !rv && copy_to_guest(arg->context, context, len) )
+        rv = -EFAULT;
 
     xfree(context);
 
- out:
-    return length;
+    return rv;
 }
 
 int flask_disable(void)
@@ -530,229 +277,154 @@
     return 0;
 }
 
-static int flask_security_disable(char *buf, uint32_t count)
+static int flask_security_setavc_threshold(struct xen_flask_setavc_threshold *arg)
 {
-    int length;
-    int new_value;
+    int rv = 0;
 
-    length = -EINVAL;
-    if ( sscanf(buf, "%d", &new_value) != 1 )
-        goto out;
-
-    if ( new_value )
+    if ( arg->threshold != avc_cache_threshold )
     {
-        length = flask_disable();
-        if ( length < 0 )
+        rv = domain_has_security(current->domain, SECURITY__SETSECPARAM);
+        if ( rv )
             goto out;
+        avc_cache_threshold = arg->threshold;
     }
 
-    length = count;
-
  out:
-    return length;
+    return rv;
 }
 
-static int flask_security_setavc_threshold(char *buf, uint32_t count)
+static int flask_security_resolve_bool(struct xen_flask_boolean *arg)
 {
-    int ret;
-    int new_value;
+    char *name;
+    int rv;
 
-    if ( sscanf(buf, "%u", &new_value) != 1 )
-    {
-        ret = -EINVAL;
-        goto out;
-    }
+    if ( arg->bool_id != -1 )
+        return 0;
 
-    if ( new_value != avc_cache_threshold )
-    {
-        ret = domain_has_security(current->domain, SECURITY__SETSECPARAM);
-        if ( ret )
-            goto out;
-        avc_cache_threshold = new_value;
-    }
-    ret = count;
+    rv = flask_copyin_string(arg->name, &name, arg->size);
+    if ( rv )
+        return rv;
 
- out:
-    return ret;
+    arg->bool_id = security_find_bool(name);
+    arg->size = 0;
+
+    xfree(name);
+
+    return 0;
 }
 
-static int flask_security_set_bool(char *buf, uint32_t count)
+static int flask_security_set_bool(struct xen_flask_boolean *arg)
 {
-    int length = -EFAULT;
-    unsigned int i, new_value;
+    int rv;
+
+    rv = flask_security_resolve_bool(arg);
+    if ( rv )
+        return rv;
+
+    rv = domain_has_security(current->domain, SECURITY__SETBOOL);
+    if ( rv )
+        return rv;
 
     spin_lock(&sel_sem);
 
-    length = domain_has_security(current->domain, SECURITY__SETBOOL);
-    if ( length )
-        goto out;
+    if ( arg->commit )
+    {
+        int num;
+        int *values;
 
-    length = -EINVAL;
-    if ( sscanf(buf, "%d %d", &i, &new_value) != 2 )
-        goto out;
+        rv = security_get_bools(&num, NULL, &values);
+        if ( rv != 0 )
+            goto out;
 
-    if (!bool_pending_values)
-        flask_security_make_bools();
+        if ( arg->bool_id >= num )
+        {
+            rv = -ENOENT;
+            goto out;
+        }
+        values[arg->bool_id] = !!(arg->new_value);
 
-    if ( i >= bool_num )
-        goto out;
+        arg->enforcing = arg->pending = !!(arg->new_value);
 
-    if ( new_value )
-        new_value = 1;
+        if ( bool_pending_values )
+            bool_pending_values[arg->bool_id] = !!(arg->new_value);
 
-    bool_pending_values[i] = new_value;
-    length = count;
+        rv = security_set_bools(num, values);
+        xfree(values);
+    }
+    else
+    {
+        if ( !bool_pending_values )
+            flask_security_make_bools();
+
+        if ( arg->bool_id >= bool_num )
+            goto out;
+
+        bool_pending_values[arg->bool_id] = !!(arg->new_value);
+        arg->pending = !!(arg->new_value);
+        arg->enforcing = security_get_bool_value(arg->bool_id);
+
+        rv = 0;
+    }
 
  out:
     spin_unlock(&sel_sem);
-    return length;
+    return rv;
 }
 
-static int flask_security_set_bool_name(char *buf, uint32_t count)
+static int flask_security_commit_bools(void)
 {
-    int rv, num;
-    int i, new_value, commit;
-    int *values = NULL;
-    char *name;
-    
-    name = xmalloc_bytes(count);
-    if ( name == NULL )
-        return -ENOMEM;
+    int rv;
 
     spin_lock(&sel_sem);
 
     rv = domain_has_security(current->domain, SECURITY__SETBOOL);
     if ( rv )
         goto out;
+
+    if ( bool_pending_values )
+        rv = security_set_bools(bool_num, bool_pending_values);
     
-    rv = -EINVAL;
-    if ( sscanf(buf, "%s %d %d", name, &new_value, &commit) != 3 )
-        goto out;
-
-    i = security_find_bool(name);
-    if ( i < 0 )
-        goto out;
-
-    if ( new_value )
-        new_value = 1;
-
-    if ( commit ) {
-        rv = security_get_bools(&num, NULL, &values);
-        if ( rv != 0 )
-            goto out;
-        values[i] = new_value;
-        if (bool_pending_values)
-            bool_pending_values[i] = new_value;
-        rv = security_set_bools(num, values);
-        xfree(values);
-    } else {
-        if (!bool_pending_values)
-            flask_security_make_bools();
-
-        bool_pending_values[i] = new_value;
-        rv = count;
-    }
-
  out:
-    xfree(name);
     spin_unlock(&sel_sem);
     return rv;
 }
 
-static int flask_security_commit_bools(char *buf, uint32_t count)
+static int flask_security_get_bool(struct xen_flask_boolean *arg)
 {
-    int length = -EFAULT;
-    int new_value;
+    int rv;
+
+    rv = flask_security_resolve_bool(arg);
+    if ( rv )
+        return rv;
 
     spin_lock(&sel_sem);
 
-    length = domain_has_security(current->domain, SECURITY__SETBOOL);
-    if ( length )
+    rv = security_get_bool_value(arg->bool_id);
+    if ( rv < 0 )
         goto out;
 
-    length = -EINVAL;
-    if ( sscanf(buf, "%d", &new_value) != 1 )
-        goto out;
-
-    if ( new_value && bool_pending_values )
-        security_set_bools(bool_num, bool_pending_values);
-    
-    length = count;
-
- out:
-    spin_unlock(&sel_sem);
-    return length;
-}
-
-static int flask_security_get_bool(char *buf, uint32_t count, int named)
-{
-    int length;
-    int i, cur_enforcing, pend_enforcing;
-    char* name = NULL;
-    
-    spin_lock(&sel_sem);
-    
-    length = -EINVAL;
-    if ( sscanf(buf, "%d", &i) != 1 )
-        goto out;
-
-    cur_enforcing = security_get_bool_value(i);
-    if ( cur_enforcing < 0 )
-    {
-        length = cur_enforcing;
-        goto out;
-    }
+    arg->enforcing = rv;
 
     if ( bool_pending_values )
-        pend_enforcing = bool_pending_values[i];
+        arg->pending = bool_pending_values[arg->bool_id];
     else
-        pend_enforcing = cur_enforcing;
+        arg->pending = rv;
 
-    if ( named )
-        name = security_get_bool_name(i);
-    if ( named && !name )
-        goto out;
+    rv = 0;
 
-    memset(buf, 0, count);
-    if ( named )
-        length = snprintf(buf, count, "%d %d %s", cur_enforcing,
-                          pend_enforcing, name);
-    else
-        length = snprintf(buf, count, "%d %d", cur_enforcing,
-                          pend_enforcing);
-
- out:
-    xfree(name);
-    spin_unlock(&sel_sem);
-    return length;
-}
-
-static int flask_security_get_bool_name(char *buf, uint32_t count)
-{
-    int rv = -ENOENT;
-    int i, cur_enforcing, pend_enforcing;
-    
-    spin_lock(&sel_sem);
-    
-    i = security_find_bool(buf);
-    if ( i < 0 )
-        goto out;
-
-    cur_enforcing = security_get_bool_value(i);
-    if ( cur_enforcing < 0 )
+    if ( arg->size )
     {
-        rv = cur_enforcing;
-        goto out;
+        char *nameout = security_get_bool_name(arg->bool_id);
+        size_t nameout_len = strlen(nameout);
+        if ( nameout_len > arg->size )
+            rv = -ERANGE;
+        arg->size = nameout_len;
+ 
+        if ( !rv && copy_to_guest(arg->name, nameout, nameout_len) )
+            rv = -EFAULT;
+        xfree(nameout);
     }
 
-    if ( bool_pending_values )
-        pend_enforcing = bool_pending_values[i];
-    else
-        pend_enforcing = cur_enforcing;
-
-    memset(buf, 0, count);
-    rv = snprintf(buf, count, "%d %d", cur_enforcing, pend_enforcing);
-
  out:
     spin_unlock(&sel_sem);
     return rv;
@@ -779,380 +451,212 @@
 
 #ifdef FLASK_AVC_STATS
 
-static int flask_security_avc_cachestats(char *buf, uint32_t count)
+static int flask_security_avc_cachestats(struct xen_flask_cache_stats *arg)
 {
-    char *page = NULL;
-    int len = 0;
-    int length = 0;
-    int cpu;
     struct avc_cache_stats *st;
 
-    page = (char *)xmalloc_bytes(PAGE_SIZE);
-    if ( !page )
-        return -ENOMEM;
-    memset(page, 0, PAGE_SIZE);
+    if ( arg->cpu > nr_cpu_ids )
+        return -ENOENT;
+    if ( !cpu_online(arg->cpu) )
+        return -ENOENT;
 
-    len = snprintf(page, PAGE_SIZE, "lookups hits misses allocations reclaims "
-                   "frees\n");
-    if ( len > count ) {
-        length = -EINVAL;
-        goto out;
-    }
-    
-    memcpy(buf, page, len);
-    buf += len;
-    length += len;
-    count -= len;
+    st = &per_cpu(avc_cache_stats, arg->cpu);
 
-    for_each_online_cpu ( cpu )
-    {
-        st = &per_cpu(avc_cache_stats, cpu);
+    arg->lookups = st->lookups;
+    arg->hits = st->hits;
+    arg->misses = st->misses;
+    arg->allocations = st->allocations;
+    arg->reclaims = st->reclaims;
+    arg->frees = st->frees;
 
-        len = snprintf(page, PAGE_SIZE, "%u %u %u %u %u %u\n", st->lookups,
-                       st->hits, st->misses, st->allocations,
-                       st->reclaims, st->frees);
-        if ( len > count ) {
-            length = -EINVAL;
-            goto out;
-        }
-        memcpy(buf, page, len);
-        buf += len;
-        length += len;
-        count -= len;
-    }
-
- out:
-    xfree(page);    
-    return length;
+    return 0;
 }
 
 #endif
 
-static int flask_security_load(char *buf, uint32_t count)
+static int flask_security_load(struct xen_flask_load *load)
 {
     int ret;
-    int length;
+    void *buf = NULL;
+
+    ret = domain_has_security(current->domain, SECURITY__LOAD_POLICY);
+    if ( ret )
+        return ret;
+
+    if ( load->size > MAX_POLICY_SIZE )
+        return -EINVAL;
+
+    buf = xmalloc_bytes(load->size);
+    if ( !buf )
+        return -ENOMEM;
+
+    if ( copy_from_guest(buf, load->buffer, load->size) )
+    {
+        ret = -EFAULT;
+        goto out_free;
+    }
 
     spin_lock(&sel_sem);
 
-    length = domain_has_security(current->domain, SECURITY__LOAD_POLICY);
-    if ( length )
+    ret = security_load_policy(buf, load->size);
+    if ( ret )
         goto out;
 
-    length = security_load_policy(buf, count);
-    if ( length )
-        goto out;
-
-    ret = flask_security_make_bools();
-    if ( ret )
-        length = ret;
-    else
-        length = count;
+    xfree(bool_pending_values);
+    bool_pending_values = NULL;
+    ret = 0;
 
  out:
     spin_unlock(&sel_sem);
-    return length;
+ out_free:
+    xfree(buf);
+    return ret;
 }
 
-static int flask_ocontext_del(char *buf, uint32_t size)
+static int flask_ocontext_del(struct xen_flask_ocontext *arg)
 {
-    int len = 0;
-    char *ocontext;
-    unsigned long low  = 0;
-    unsigned long high = 0;
+    int rv;
 
-    len = domain_has_security(current->domain, SECURITY__DEL_OCONTEXT);
-    if ( len )
-        return len;
+    if ( arg->low > arg->high )
+        return -EINVAL;
 
-    if ( (ocontext = xmalloc_bytes(size) ) == NULL )
-        return -ENOMEM;
+    rv = domain_has_security(current->domain, SECURITY__DEL_OCONTEXT);
+    if ( rv )
+        return rv;
 
-    len = sscanf(buf, "%s %lu %lu", ocontext, &low, &high);
-    if ( len < 2 )
-    {
-        len = -EINVAL;
-        goto out;
-    }
-    else if ( len == 2 )
-        high = low;
-
-    if ( low > high )
-    {
-        len = -EINVAL;
-        goto out;
-    }
-
-    len = security_ocontext_del(ocontext, low, high);
- out:
-    xfree(ocontext);
-    return len;
+    return security_ocontext_del(arg->ocon, arg->low, arg->high);
 }
 
-static int flask_ocontext_add(char *buf, uint32_t size)
+static int flask_ocontext_add(struct xen_flask_ocontext *arg)
 {
-    int len = 0;
-    u32 sid = 0;
-    unsigned long low  = 0;
-    unsigned long high = 0;
-    char *scontext;
-    char *ocontext;
+    int rv;
 
-    len = domain_has_security(current->domain, SECURITY__ADD_OCONTEXT);
-    if ( len )
-        return len;
+    if ( arg->low > arg->high )
+        return -EINVAL;
 
-    if ( (scontext = xmalloc_bytes(size) ) == NULL )
-        return -ENOMEM;
+    rv = domain_has_security(current->domain, SECURITY__ADD_OCONTEXT);
+    if ( rv )
+        return rv;
 
-    if ( (ocontext = xmalloc_bytes(size) ) == NULL )
-    {
-        xfree(scontext);
-        return -ENOMEM;
-    }
-
-    memset(scontext, 0, size);
-    memset(ocontext, 0, size);
-
-    len = sscanf(buf, "%s %s %lu %lu", ocontext, scontext, &low, &high);
-    if ( len < 3 )
-    {
-        len = -EINVAL;
-        goto out;
-    }
-    else if ( len == 3 )
-        high = low;
-
-    if ( low > high )
-    {
-        len = -EINVAL;
-        goto out;
-    }
-    len = security_context_to_sid(scontext, strlen(scontext)+1, &sid);
-    if ( len < 0 )
-    {
-        len = -EINVAL;
-        goto out;
-    }
-    len = security_ocontext_add(ocontext, low, high, sid);
- out:
-    xfree(ocontext);
-    xfree(scontext);
-    return len;
+    return security_ocontext_add(arg->ocon, arg->low, arg->high, arg->sid);
 }
 
 long do_flask_op(XEN_GUEST_HANDLE(xsm_op_t) u_flask_op)
 {
-    flask_op_t curop, *op = &curop;
-    int rc = 0;
-    int length = 0;
-    char *arg = NULL;
+    xen_flask_op_t op;
+    int rv;
 
-    if ( copy_from_guest(op, u_flask_op, 1) )
+    if ( copy_from_guest(&op, u_flask_op, 1) )
         return -EFAULT;
 
-    if ( op->cmd > FLASK_LAST)
-        return -EINVAL;
+    if ( op.interface_version != XEN_FLASK_INTERFACE_VERSION )
+        return -ENOSYS;
 
-    if ( op->size > MAX_POLICY_SIZE )
-        return -EINVAL;
+    switch ( op.cmd )
+    {
+    case FLASK_LOAD:
+        rv = flask_security_load(&op.u.load);
+        break;
 
-    if ( (op->buf == NULL && op->size != 0) || 
-         (op->buf != NULL && op->size == 0) )
-        return -EINVAL;
-
-    arg = xmalloc_bytes(op->size + 1);
-    if ( !arg )
-        return -ENOMEM;
-
-    memset(arg, 0, op->size + 1);
-
-    if ( (FLASK_COPY_IN&(1UL<<op->cmd)) && op->buf != NULL && 
-         copy_from_guest(arg, guest_handle_from_ptr(op->buf, char), op->size) )
-    {
-        rc = -EFAULT;
-        goto out;
-    }
-
-    switch ( op->cmd )
-    {
-
-    case FLASK_LOAD:
-    {
-        length = flask_security_load(arg, op->size);
-    }
-    break;
-    
     case FLASK_GETENFORCE:
-    {
-        length = snprintf(arg, op->size, "%d", flask_enforcing);
-    }
-    break;    
+        rv = flask_enforcing;
+        break;
 
     case FLASK_SETENFORCE:
-    {
-        length = flask_security_setenforce(arg, op->size);
-    }
-    break;    
+        rv = flask_security_setenforce(&op.u.enforce);
+        break;
 
     case FLASK_CONTEXT_TO_SID:
-    {
-        length = flask_security_context(arg, op->size);
-    }
-    break;    
+        rv = flask_security_context(&op.u.sid_context);
+        break;
 
     case FLASK_SID_TO_CONTEXT:
-    {
-        length = flask_security_sid(arg, op->size);
-    }
-    break; 
+        rv = flask_security_sid(&op.u.sid_context);
+        break;
 
     case FLASK_ACCESS:
-    {
-        length = flask_security_access(arg, op->size);
-    }
-    break;    
+        rv = flask_security_access(&op.u.access);
+        break;
 
     case FLASK_CREATE:
-    {
-        length = flask_security_create(arg, op->size);
-    }
-    break;    
+        rv = flask_security_create(&op.u.transition);
+        break;
 
     case FLASK_RELABEL:
-    {
-        length = flask_security_relabel(arg, op->size);
-    }
-    break;
+        rv = flask_security_relabel(&op.u.transition);
+        break;
 
     case FLASK_USER:
-    {
-        length = flask_security_user(arg, op->size);
-    }
-    break;    
+        rv = flask_security_user(&op.u.userlist);
+        break;
 
     case FLASK_POLICYVERS:
-    {
-        length = snprintf(arg, op->size, "%d", POLICYDB_VERSION_MAX);
-    }
-    break;    
+        rv = POLICYDB_VERSION_MAX;
+        break;
 
     case FLASK_GETBOOL:
-    {
-        length = flask_security_get_bool(arg, op->size, 0);
-    }
-    break;
+        rv = flask_security_get_bool(&op.u.boolean);
+        break;
 
     case FLASK_SETBOOL:
-    {
-        length = flask_security_set_bool(arg, op->size);
-    }
-    break;
+        rv = flask_security_set_bool(&op.u.boolean);
+        break;
 
     case FLASK_COMMITBOOLS:
-    {
-        length = flask_security_commit_bools(arg, op->size);
-    }
-    break;
+        rv = flask_security_commit_bools();
+        break;
 
     case FLASK_MLS:
-    {
-        length = snprintf(arg, op->size, "%d", flask_mls_enabled);
-    }
-    break;    
+        rv = flask_mls_enabled;
+        break;    
 
     case FLASK_DISABLE:
-    {
-        length = flask_security_disable(arg, op->size);
-    }
-    break;    
+        rv = flask_disable();
+        break;
 
     case FLASK_GETAVC_THRESHOLD:
-    {
-        length = snprintf(arg, op->size, "%d", avc_cache_threshold);
-    }
-    break;
+        rv = avc_cache_threshold;
+        break;
 
     case FLASK_SETAVC_THRESHOLD:
-    {
-        length = flask_security_setavc_threshold(arg, op->size);
-    }
-    break;
+        rv = flask_security_setavc_threshold(&op.u.setavc_threshold);
+        break;
 
     case FLASK_AVC_HASHSTATS:
-    {
-        length = avc_get_hash_stats(arg, op->size);
-    }
-    break;
+        rv = avc_get_hash_stats(&op.u.hash_stats);
+        break;
 
-#ifdef FLASK_AVC_STATS    
+#ifdef FLASK_AVC_STATS
     case FLASK_AVC_CACHESTATS:
-    {
-        length = flask_security_avc_cachestats(arg, op->size);
-    }
-    break;
+        rv = flask_security_avc_cachestats(&op.u.cache_stats);
+        break;
 #endif
 
     case FLASK_MEMBER:
-    {
-        length = flask_security_member(arg, op->size);
-    }
-    break;    
+        rv = flask_security_member(&op.u.transition);
+        break;
 
     case FLASK_ADD_OCONTEXT:
-    {
-        length = flask_ocontext_add(arg, op->size);
+        rv = flask_ocontext_add(&op.u.ocontext);
         break;
+
+    case FLASK_DEL_OCONTEXT:
+        rv = flask_ocontext_del(&op.u.ocontext);
+        break;
+
+    default:
+        rv = -ENOSYS;
     }
 
-    case FLASK_DEL_OCONTEXT:
+    if ( rv < 0 )
+        goto out;
+
+    if ( (FLASK_COPY_OUT&(1UL<<op.cmd)) )
     {
-        length = flask_ocontext_del(arg, op->size);
-        break;
+        if ( copy_to_guest(u_flask_op, &op, 1) )
+            rv = -EFAULT;
     }
 
-    case FLASK_GETBOOL_NAMED:
-    {
-        length = flask_security_get_bool_name(arg, op->size);
-    }
-    break;
-
-    case FLASK_GETBOOL2:
-    {
-        length = flask_security_get_bool(arg, op->size, 1);
-    }
-    break;
-
-    case FLASK_SETBOOL_NAMED:
-    {
-        length = flask_security_set_bool_name(arg, op->size);
-    }
-    break;
-
-    default:
-        length = -ENOSYS;
-        break;
-
-    }
-
-    if ( length < 0 )
-    {
-        rc = length;
-        goto out;
-    }
-    
-    if ( (FLASK_COPY_OUT&(1UL<<op->cmd)) && op->buf != NULL && 
-         copy_to_guest(guest_handle_from_ptr(op->buf, char), arg, op->size) )
-    {
-        rc = -EFAULT;
-        goto out;
-    }
-
-    op->size = length;
-    if ( copy_to_guest(u_flask_op, op, 1) )
-        rc = -EFAULT;
-
  out:
-    xfree(arg);
-    return rc;
+    return rv;
 }
diff -r 28b85ad1fe4e -r bf326829102b xen/xsm/flask/include/avc.h
--- a/xen/xsm/flask/include/avc.h	Mon Feb 06 05:04:32 2012 -0800
+++ b/xen/xsm/flask/include/avc.h	Mon Feb 06 05:07:20 2012 -0800
@@ -104,7 +104,8 @@
                                     u32 ssid, u32 tsid, u16 tclass, u32 perms);
 
 /* Exported to selinuxfs */
-int avc_get_hash_stats(char *buf, uint32_t size);
+struct xen_flask_hash_stats;
+int avc_get_hash_stats(struct xen_flask_hash_stats *arg);
 extern unsigned int avc_cache_threshold;
 
 #ifdef FLASK_AVC_STATS
diff -r 28b85ad1fe4e -r bf326829102b xen/xsm/flask/include/security.h
--- a/xen/xsm/flask/include/security.h	Mon Feb 06 05:04:32 2012 -0800
+++ b/xen/xsm/flask/include/security.h	Mon Feb 06 05:07:20 2012 -0800
@@ -90,8 +90,8 @@
 int security_iterate_ioport_sids(u32 start, u32 end,
                                 security_iterate_fn fn, void *data);
 
-int security_ocontext_add(char *ocontext, unsigned long low,
+int security_ocontext_add(u32 ocontext, unsigned long low,
                            unsigned long high, u32 sid);
 
-int security_ocontext_del(char *ocontext, unsigned int low, unsigned int high);
+int security_ocontext_del(u32 ocontext, unsigned int low, unsigned int high);
 #endif /* _FLASK_SECURITY_H_ */
diff -r 28b85ad1fe4e -r bf326829102b xen/xsm/flask/ss/services.c
--- a/xen/xsm/flask/ss/services.c	Mon Feb 06 05:04:32 2012 -0800
+++ b/xen/xsm/flask/ss/services.c	Mon Feb 06 05:07:20 2012 -0800
@@ -2097,17 +2097,14 @@
         return -1;
 }
 
-int security_ocontext_add( char *ocontext, unsigned long low, unsigned long high
+int security_ocontext_add( u32 ocon, unsigned long low, unsigned long high
                             ,u32 sid )
 {
     int ret = 0;
-    int ocon = 0;
     struct ocontext *c;
     struct ocontext *prev;
     struct ocontext *add;
 
-    if ( (ocon = determine_ocontext(ocontext)) < 0 )
-        return -EINVAL;
     if ( (add = xmalloc(struct ocontext)) == NULL )
         return -ENOMEM;
     memset(add, 0, sizeof(struct ocontext));
@@ -2254,15 +2251,11 @@
     return ret;
 }
 
-int security_ocontext_del( char *ocontext, unsigned int low, unsigned int high )
+int security_ocontext_del( u32 ocon, unsigned int low, unsigned int high )
 {
     int ret = 0;
-    int ocon = 0;
     struct ocontext *c, *before_c;
 
-    if ( (ocon = determine_ocontext(ocontext)) < 0 )
-        return -EINVAL;
-
     POLICY_WRLOCK;
     switch( ocon )
     {

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 07 04:33:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Feb 2012 04:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ruck3-0005OJ-K1; Tue, 07 Feb 2012 04:33:19 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Ruck2-0005Nf-56
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1328589189!5748381!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19894 invoked from network); 7 Feb 2012 04:33:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Feb 2012 04:33:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjt-0001FC-9O
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjs-00065n-Qa
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:08 +0000
Message-Id: <E1Rucjs-00065n-Qa@xenbits.xen.org>
Date: Tue, 07 Feb 2012 04:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] .gitignore/.hgignore: add missing
	output files
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328533472 28800
# Node ID 28b85ad1fe4e98b336a3ef41eaa89c6a1b7e866a
# Parent  c3cfc4d4534daf327b237714ff9834039e80d0fc
.gitignore/.hgignore: add missing output files

 - extras/mini-os/include/list.h (already in .hgignore)
 - tools/flask/flask-{get,set}-bool
 - tools/flask/loadpolicy no longer exists
 - tools/xenstore/init-xenstore-domain

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r c3cfc4d4534d -r 28b85ad1fe4e .gitignore
--- a/.gitignore	Mon Feb 06 05:03:32 2012 -0800
+++ b/.gitignore	Mon Feb 06 05:04:32 2012 -0800
@@ -64,6 +64,7 @@
 extras/mini-os/include/ia64/offsets.h
 extras/mini-os/include/x86/mini-os
 extras/mini-os/include/xen
+extras/mini-os/include/list.h
 extras/mini-os/mini-os*
 install/*
 linux-[^/]*-paravirt/*
@@ -150,10 +151,11 @@
 tools/firmware/rombios/32bit/32bitbios_flat.h
 tools/firmware/vgabios/vbetables-gen
 tools/firmware/vgabios/vbetables.h
-tools/flask/loadpolicy/flask-loadpolicy
 tools/flask/utils/flask-getenforce
+tools/flask/utils/flask-get-bool
 tools/flask/utils/flask-loadpolicy
 tools/flask/utils/flask-setenforce
+tools/flask/utils/flask-set-bool
 tools/flask/utils/flask-label-pci
 tools/fs-back/fs-backend
 tools/hotplug/common/hotplugpath.sh
@@ -236,6 +238,7 @@
 tools/xenpmd/xenpmd
 tools/xenstat/xentop/xentop
 tools/xenstore/testsuite/tmp/*
+tools/xenstore/init-xenstore-domain
 tools/xenstore/xen
 tools/xenstore/xenstore
 tools/xenstore/xenstore-chmod
diff -r c3cfc4d4534d -r 28b85ad1fe4e .hgignore
--- a/.hgignore	Mon Feb 06 05:03:32 2012 -0800
+++ b/.hgignore	Mon Feb 06 05:04:32 2012 -0800
@@ -154,10 +154,11 @@
 ^tools/firmware/rombios/32bit/32bitbios_flat\.h$
 ^tools/firmware/vgabios/vbetables-gen$
 ^tools/firmware/vgabios/vbetables\.h$
-^tools/flask/loadpolicy/flask-loadpolicy$
 ^tools/flask/utils/flask-getenforce$
+^tools/flask/utils/flask-get-bool$
 ^tools/flask/utils/flask-loadpolicy$
 ^tools/flask/utils/flask-setenforce$
+^tools/flask/utils/flask-set-bool$
 ^tools/flask/utils/flask-label-pci$
 ^tools/fs-back/fs-backend$
 ^tools/hotplug/common/hotplugpath\.sh$
@@ -249,6 +250,7 @@
 ^tools/xenpmd/xenpmd$
 ^tools/xenstat/xentop/xentop$
 ^tools/xenstore/testsuite/tmp/.*$
+^tools/xenstore/init-xenstore-domain$
 ^tools/xenstore/xen$
 ^tools/xenstore/xenstore$
 ^tools/xenstore/xenstore-chmod$

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 07 04:33:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Feb 2012 04:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ruck3-0005OJ-K1; Tue, 07 Feb 2012 04:33:19 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Ruck2-0005Nf-56
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1328589189!5748381!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19894 invoked from network); 7 Feb 2012 04:33:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Feb 2012 04:33:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjt-0001FC-9O
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjs-00065n-Qa
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:08 +0000
Message-Id: <E1Rucjs-00065n-Qa@xenbits.xen.org>
Date: Tue, 07 Feb 2012 04:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] .gitignore/.hgignore: add missing
	output files
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328533472 28800
# Node ID 28b85ad1fe4e98b336a3ef41eaa89c6a1b7e866a
# Parent  c3cfc4d4534daf327b237714ff9834039e80d0fc
.gitignore/.hgignore: add missing output files

 - extras/mini-os/include/list.h (already in .hgignore)
 - tools/flask/flask-{get,set}-bool
 - tools/flask/loadpolicy no longer exists
 - tools/xenstore/init-xenstore-domain

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r c3cfc4d4534d -r 28b85ad1fe4e .gitignore
--- a/.gitignore	Mon Feb 06 05:03:32 2012 -0800
+++ b/.gitignore	Mon Feb 06 05:04:32 2012 -0800
@@ -64,6 +64,7 @@
 extras/mini-os/include/ia64/offsets.h
 extras/mini-os/include/x86/mini-os
 extras/mini-os/include/xen
+extras/mini-os/include/list.h
 extras/mini-os/mini-os*
 install/*
 linux-[^/]*-paravirt/*
@@ -150,10 +151,11 @@
 tools/firmware/rombios/32bit/32bitbios_flat.h
 tools/firmware/vgabios/vbetables-gen
 tools/firmware/vgabios/vbetables.h
-tools/flask/loadpolicy/flask-loadpolicy
 tools/flask/utils/flask-getenforce
+tools/flask/utils/flask-get-bool
 tools/flask/utils/flask-loadpolicy
 tools/flask/utils/flask-setenforce
+tools/flask/utils/flask-set-bool
 tools/flask/utils/flask-label-pci
 tools/fs-back/fs-backend
 tools/hotplug/common/hotplugpath.sh
@@ -236,6 +238,7 @@
 tools/xenpmd/xenpmd
 tools/xenstat/xentop/xentop
 tools/xenstore/testsuite/tmp/*
+tools/xenstore/init-xenstore-domain
 tools/xenstore/xen
 tools/xenstore/xenstore
 tools/xenstore/xenstore-chmod
diff -r c3cfc4d4534d -r 28b85ad1fe4e .hgignore
--- a/.hgignore	Mon Feb 06 05:03:32 2012 -0800
+++ b/.hgignore	Mon Feb 06 05:04:32 2012 -0800
@@ -154,10 +154,11 @@
 ^tools/firmware/rombios/32bit/32bitbios_flat\.h$
 ^tools/firmware/vgabios/vbetables-gen$
 ^tools/firmware/vgabios/vbetables\.h$
-^tools/flask/loadpolicy/flask-loadpolicy$
 ^tools/flask/utils/flask-getenforce$
+^tools/flask/utils/flask-get-bool$
 ^tools/flask/utils/flask-loadpolicy$
 ^tools/flask/utils/flask-setenforce$
+^tools/flask/utils/flask-set-bool$
 ^tools/flask/utils/flask-label-pci$
 ^tools/fs-back/fs-backend$
 ^tools/hotplug/common/hotplugpath\.sh$
@@ -249,6 +250,7 @@
 ^tools/xenpmd/xenpmd$
 ^tools/xenstat/xentop/xentop$
 ^tools/xenstore/testsuite/tmp/.*$
+^tools/xenstore/init-xenstore-domain$
 ^tools/xenstore/xen$
 ^tools/xenstore/xenstore$
 ^tools/xenstore/xenstore-chmod$

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 07 04:33:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Feb 2012 04:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ruck5-0005PU-9Z; Tue, 07 Feb 2012 04:33:21 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Ruck4-0005Ns-ET
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1328589192!13455430!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9582 invoked from network); 7 Feb 2012 04:33:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Feb 2012 04:33:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjw-0001FX-HP
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjw-00068d-GD
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:12 +0000
Message-Id: <E1Rucjw-00068d-GD@xenbits.xen.org>
Date: Tue, 07 Feb 2012 04:33:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Fix error recovery path in
	__gnttab_map_grant_ref
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Haoyu Zhang <haoyu.zhang@huawei.com>
# Date 1328563421 28800
# Node ID 3574f4d67843733ccaabab5f8ebb859c99d7314a
# Parent  5bd5830dea13f2a80a1b9728d3e61c34661fe764
Fix error recovery path in __gnttab_map_grant_ref

In file grant_table.c function __gnttab_map_grant_ref, if
__get_paged_frame failed, the effect of _set_status  previously
called should be rollback, so the flag GTF_reading and _GTF_writing
will be recovered.

Signed-off-by: Haoyu Zhang <haoyu.zhang@huawei.com>
Signed-off-by: Liang Wang <hzwangliang.wang@huawei.com>
Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 5bd5830dea13 -r 3574f4d67843 xen/common/grant_table.c
--- a/xen/common/grant_table.c	Mon Feb 06 13:17:46 2012 -0800
+++ b/xen/common/grant_table.c	Mon Feb 06 13:23:41 2012 -0800
@@ -576,7 +576,7 @@
             if ( rc != GNTST_okay )
             {
                 gfn = INVALID_GFN;
-                goto unlock_out;
+                goto unlock_out_clear;
             }
             act->gfn = gfn;
             act->domid = ld->domain_id;
@@ -734,7 +734,8 @@
     if ( op->flags & GNTMAP_host_map )
         act->pin -= (op->flags & GNTMAP_readonly) ?
             GNTPIN_hstr_inc : GNTPIN_hstw_inc;
-
+ 
+ unlock_out_clear:
     if ( !(op->flags & GNTMAP_readonly) &&
          !(act->pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) )
         gnttab_clear_flag(_GTF_writing, status);

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 07 04:33:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Feb 2012 04:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ruck5-0005PU-9Z; Tue, 07 Feb 2012 04:33:21 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Ruck4-0005Ns-ET
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1328589192!13455430!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9582 invoked from network); 7 Feb 2012 04:33:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Feb 2012 04:33:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjw-0001FX-HP
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjw-00068d-GD
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:12 +0000
Message-Id: <E1Rucjw-00068d-GD@xenbits.xen.org>
Date: Tue, 07 Feb 2012 04:33:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Fix error recovery path in
	__gnttab_map_grant_ref
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Haoyu Zhang <haoyu.zhang@huawei.com>
# Date 1328563421 28800
# Node ID 3574f4d67843733ccaabab5f8ebb859c99d7314a
# Parent  5bd5830dea13f2a80a1b9728d3e61c34661fe764
Fix error recovery path in __gnttab_map_grant_ref

In file grant_table.c function __gnttab_map_grant_ref, if
__get_paged_frame failed, the effect of _set_status  previously
called should be rollback, so the flag GTF_reading and _GTF_writing
will be recovered.

Signed-off-by: Haoyu Zhang <haoyu.zhang@huawei.com>
Signed-off-by: Liang Wang <hzwangliang.wang@huawei.com>
Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 5bd5830dea13 -r 3574f4d67843 xen/common/grant_table.c
--- a/xen/common/grant_table.c	Mon Feb 06 13:17:46 2012 -0800
+++ b/xen/common/grant_table.c	Mon Feb 06 13:23:41 2012 -0800
@@ -576,7 +576,7 @@
             if ( rc != GNTST_okay )
             {
                 gfn = INVALID_GFN;
-                goto unlock_out;
+                goto unlock_out_clear;
             }
             act->gfn = gfn;
             act->domid = ld->domain_id;
@@ -734,7 +734,8 @@
     if ( op->flags & GNTMAP_host_map )
         act->pin -= (op->flags & GNTMAP_readonly) ?
             GNTPIN_hstr_inc : GNTPIN_hstw_inc;
-
+ 
+ unlock_out_clear:
     if ( !(op->flags & GNTMAP_readonly) &&
          !(act->pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) )
         gnttab_clear_flag(_GTF_writing, status);

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 07 04:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Feb 2012 04:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ruck3-0005OE-Hn; Tue, 07 Feb 2012 04:33:19 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Ruck1-0005Nd-UB
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-182.messagelabs.com!1328589190!13974657!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9789 invoked from network); 7 Feb 2012 04:33:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Feb 2012 04:33:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucju-0001FL-EO
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucju-000670-D5
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:10 +0000
Message-Id: <E1Rucju-000670-D5@xenbits.xen.org>
Date: Tue, 07 Feb 2012 04:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Tools: build tests
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328562778 28800
# Node ID ac757b64ff06c81cd161be07c367f67a019e5b93
# Parent  f665817959942bf1e149e65597187c02d563f83b
Tools: build tests

Build tests as part of the tools build.

It is enabled with CONFIG_TESTS in Config.mk

Currently disabled build of tests/regressions and tests/xen-access (in
32-bit mode) as they fail.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r f66581795994 -r ac757b64ff06 Config.mk
--- a/Config.mk	Mon Feb 06 05:08:03 2012 -0800
+++ b/Config.mk	Mon Feb 06 13:12:58 2012 -0800
@@ -243,6 +243,7 @@
 CONFIG_MINITERM    ?= n
 CONFIG_LOMOUNT     ?= n
 CONFIG_SYSTEM_LIBAIO ?= y
+CONFIG_TESTS       ?= y
 
 ifeq ($(OCAML_TOOLS),y)
 OCAML_TOOLS := $(shell ocamlopt -v > /dev/null 2>&1 && echo "y" || echo "n")
diff -r f66581795994 -r ac757b64ff06 tools/Makefile
--- a/tools/Makefile	Mon Feb 06 05:08:03 2012 -0800
+++ b/tools/Makefile	Mon Feb 06 13:12:58 2012 -0800
@@ -45,6 +45,7 @@
 SUBDIRS-$(CONFIG_X86) += xenpaging
 SUBDIRS-$(CONFIG_X86) += debugger/gdbsx
 SUBDIRS-$(CONFIG_X86) += debugger/kdd
+SUBDIRS-$(CONFIG_TESTS) += tests
 
 # These don't cross-compile
 ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
diff -r f66581795994 -r ac757b64ff06 tools/tests/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/tests/Makefile	Mon Feb 06 13:12:58 2012 -0800
@@ -0,0 +1,21 @@
+XEN_ROOT = $(CURDIR)/../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+CFLAGS  += $(CFLAGS_libxenctrl)
+LDLIBS += $(LDLIBS_libxenctrl)
+
+SUBDIRS-y :=
+SUBDIRS-y += mce-test
+SUBDIRS-y += mem-sharing
+ifeq ($(XEN_TARGET_ARCH),__fixme__)
+SUBDIRS-y += regression
+endif
+SUBDIRS-y += x86_emulator
+ifneq ($(XEN_TARGET_ARCH),x86_32)
+SUBDIRS-y += xen-access
+endif
+
+.PHONY: all clean install distclean
+all clean distclean: %: subdirs-%
+
+install:

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 07 04:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Feb 2012 04:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ruck3-0005OE-Hn; Tue, 07 Feb 2012 04:33:19 +0000
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Ruck1-0005Nd-UB
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-182.messagelabs.com!1328589190!13974657!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9789 invoked from network); 7 Feb 2012 04:33:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Feb 2012 04:33:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucju-0001FL-EO
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucju-000670-D5
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:10 +0000
Message-Id: <E1Rucju-000670-D5@xenbits.xen.org>
Date: Tue, 07 Feb 2012 04:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Tools: build tests
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328562778 28800
# Node ID ac757b64ff06c81cd161be07c367f67a019e5b93
# Parent  f665817959942bf1e149e65597187c02d563f83b
Tools: build tests

Build tests as part of the tools build.

It is enabled with CONFIG_TESTS in Config.mk

Currently disabled build of tests/regressions and tests/xen-access (in
32-bit mode) as they fail.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r f66581795994 -r ac757b64ff06 Config.mk
--- a/Config.mk	Mon Feb 06 05:08:03 2012 -0800
+++ b/Config.mk	Mon Feb 06 13:12:58 2012 -0800
@@ -243,6 +243,7 @@
 CONFIG_MINITERM    ?= n
 CONFIG_LOMOUNT     ?= n
 CONFIG_SYSTEM_LIBAIO ?= y
+CONFIG_TESTS       ?= y
 
 ifeq ($(OCAML_TOOLS),y)
 OCAML_TOOLS := $(shell ocamlopt -v > /dev/null 2>&1 && echo "y" || echo "n")
diff -r f66581795994 -r ac757b64ff06 tools/Makefile
--- a/tools/Makefile	Mon Feb 06 05:08:03 2012 -0800
+++ b/tools/Makefile	Mon Feb 06 13:12:58 2012 -0800
@@ -45,6 +45,7 @@
 SUBDIRS-$(CONFIG_X86) += xenpaging
 SUBDIRS-$(CONFIG_X86) += debugger/gdbsx
 SUBDIRS-$(CONFIG_X86) += debugger/kdd
+SUBDIRS-$(CONFIG_TESTS) += tests
 
 # These don't cross-compile
 ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
diff -r f66581795994 -r ac757b64ff06 tools/tests/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/tests/Makefile	Mon Feb 06 13:12:58 2012 -0800
@@ -0,0 +1,21 @@
+XEN_ROOT = $(CURDIR)/../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+CFLAGS  += $(CFLAGS_libxenctrl)
+LDLIBS += $(LDLIBS_libxenctrl)
+
+SUBDIRS-y :=
+SUBDIRS-y += mce-test
+SUBDIRS-y += mem-sharing
+ifeq ($(XEN_TARGET_ARCH),__fixme__)
+SUBDIRS-y += regression
+endif
+SUBDIRS-y += x86_emulator
+ifneq ($(XEN_TARGET_ARCH),x86_32)
+SUBDIRS-y += xen-access
+endif
+
+.PHONY: all clean install distclean
+all clean distclean: %: subdirs-%
+
+install:

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 07 04:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Feb 2012 04:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ruck4-0005Os-SZ; Tue, 07 Feb 2012 04:33:20 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Ruck2-0005Ng-KZ
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1328589191!12251229!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22375 invoked from network); 7 Feb 2012 04:33:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Feb 2012 04:33:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucju-0001FO-V2
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucju-00067O-Tn
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:10 +0000
Message-Id: <E1Rucju-00067O-Tn@xenbits.xen.org>
Date: Tue, 07 Feb 2012 04:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] .hgignore/.gitignore: Add some
	tools/tests binaries
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328562903 28800
# Node ID dd62484da1a1a9294aa4f0221480c8f344f57df0
# Parent  ac757b64ff06c81cd161be07c367f67a019e5b93
.hgignore/.gitignore: Add some tools/tests binaries

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


diff -r ac757b64ff06 -r dd62484da1a1 .gitignore
--- a/.gitignore	Mon Feb 06 13:12:58 2012 -0800
+++ b/.gitignore	Mon Feb 06 13:15:03 2012 -0800
@@ -213,6 +213,7 @@
 tools/tests/regression/build/*
 tools/tests/regression/downloads/*
 tools/tests/mem-sharing/memshrtool
+tools/tests/mce-test/tools/xen-mceinj
 tools/vnet/Make.local
 tools/vnet/build/*
 tools/vnet/gc
diff -r ac757b64ff06 -r dd62484da1a1 .hgignore
--- a/.hgignore	Mon Feb 06 13:12:58 2012 -0800
+++ b/.hgignore	Mon Feb 06 13:15:03 2012 -0800
@@ -224,6 +224,7 @@
 ^tools/tests/regression/downloads/.*$
 ^tools/tests/xen-access/xen-access$
 ^tools/tests/mem-sharing/memshrtool$
+^tools/tests/mce-test/tools/xen-mceinj$
 ^tools/vnet/Make.local$
 ^tools/vnet/build/.*$
 ^tools/vnet/gc$

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 07 04:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Feb 2012 04:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ruck4-0005Os-SZ; Tue, 07 Feb 2012 04:33:20 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Ruck2-0005Ng-KZ
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1328589191!12251229!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22375 invoked from network); 7 Feb 2012 04:33:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Feb 2012 04:33:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucju-0001FO-V2
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucju-00067O-Tn
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:10 +0000
Message-Id: <E1Rucju-00067O-Tn@xenbits.xen.org>
Date: Tue, 07 Feb 2012 04:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] .hgignore/.gitignore: Add some
	tools/tests binaries
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328562903 28800
# Node ID dd62484da1a1a9294aa4f0221480c8f344f57df0
# Parent  ac757b64ff06c81cd161be07c367f67a019e5b93
.hgignore/.gitignore: Add some tools/tests binaries

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


diff -r ac757b64ff06 -r dd62484da1a1 .gitignore
--- a/.gitignore	Mon Feb 06 13:12:58 2012 -0800
+++ b/.gitignore	Mon Feb 06 13:15:03 2012 -0800
@@ -213,6 +213,7 @@
 tools/tests/regression/build/*
 tools/tests/regression/downloads/*
 tools/tests/mem-sharing/memshrtool
+tools/tests/mce-test/tools/xen-mceinj
 tools/vnet/Make.local
 tools/vnet/build/*
 tools/vnet/gc
diff -r ac757b64ff06 -r dd62484da1a1 .hgignore
--- a/.hgignore	Mon Feb 06 13:12:58 2012 -0800
+++ b/.hgignore	Mon Feb 06 13:15:03 2012 -0800
@@ -224,6 +224,7 @@
 ^tools/tests/regression/downloads/.*$
 ^tools/tests/xen-access/xen-access$
 ^tools/tests/mem-sharing/memshrtool$
+^tools/tests/mce-test/tools/xen-mceinj$
 ^tools/vnet/Make.local$
 ^tools/vnet/build/.*$
 ^tools/vnet/gc$

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 07 04:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Feb 2012 04:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ruck5-0005PI-3R; Tue, 07 Feb 2012 04:33:21 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Ruck3-0005Nm-IQ
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1328589191!10255033!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32721 invoked from network); 7 Feb 2012 04:33:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Feb 2012 04:33:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjv-0001FR-FC
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjv-00067m-Dh
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:11 +0000
Message-Id: <E1Rucjv-00067m-Dh@xenbits.xen.org>
Date: Tue, 07 Feb 2012 04:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] IOMMU: Update the maintainer list of
	VT-d
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Xiantao Zhang <xiantao.zhang@intel.com>
# Date 1328562979 28800
# Node ID c16b21da3e38ca1835fb0261ce7b81db60985d50
# Parent  dd62484da1a1a9294aa4f0221480c8f344f57df0
IOMMU: Update the maintainer list of VT-d

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r dd62484da1a1 -r c16b21da3e38 MAINTAINERS
--- a/MAINTAINERS	Mon Feb 06 13:15:03 2012 -0800
+++ b/MAINTAINERS	Mon Feb 06 13:16:19 2012 -0800
@@ -138,7 +138,7 @@
 F:	xen/include/asm-x86/tboot.h
 
 INTEL(R) VT FOR DIRECTED I/O (VT-D)
-M:	Allen Kay <allen.m.kay@intel.com>
+M:	Xiantao Zhang <xiantao.zhang@intel.com>
 S:	Supported
 F:	xen/drivers/passthrough/vtd/
 

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 07 04:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Feb 2012 04:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ruck5-0005PI-3R; Tue, 07 Feb 2012 04:33:21 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Ruck3-0005Nm-IQ
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1328589191!10255033!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32721 invoked from network); 7 Feb 2012 04:33:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Feb 2012 04:33:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjv-0001FR-FC
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjv-00067m-Dh
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:11 +0000
Message-Id: <E1Rucjv-00067m-Dh@xenbits.xen.org>
Date: Tue, 07 Feb 2012 04:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] IOMMU: Update the maintainer list of
	VT-d
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Xiantao Zhang <xiantao.zhang@intel.com>
# Date 1328562979 28800
# Node ID c16b21da3e38ca1835fb0261ce7b81db60985d50
# Parent  dd62484da1a1a9294aa4f0221480c8f344f57df0
IOMMU: Update the maintainer list of VT-d

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r dd62484da1a1 -r c16b21da3e38 MAINTAINERS
--- a/MAINTAINERS	Mon Feb 06 13:15:03 2012 -0800
+++ b/MAINTAINERS	Mon Feb 06 13:16:19 2012 -0800
@@ -138,7 +138,7 @@
 F:	xen/include/asm-x86/tboot.h
 
 INTEL(R) VT FOR DIRECTED I/O (VT-D)
-M:	Allen Kay <allen.m.kay@intel.com>
+M:	Xiantao Zhang <xiantao.zhang@intel.com>
 S:	Supported
 F:	xen/drivers/passthrough/vtd/
 

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 07 04:33:26 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Feb 2012 04:33:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ruck5-0005PZ-CA; Tue, 07 Feb 2012 04:33:21 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Ruck4-0005Nv-Km
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1328589192!10255034!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32734 invoked from network); 7 Feb 2012 04:33:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Feb 2012 04:33:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjw-0001FU-3m
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjv-00068C-V4
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:11 +0000
Message-Id: <E1Rucjv-00068C-V4@xenbits.xen.org>
Date: Tue, 07 Feb 2012 04:33:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] IO-APIC: Reformat IO-APIC RTE debug
	info (v2)
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328563066 28800
# Node ID 5bd5830dea13f2a80a1b9728d3e61c34661fe764
# Parent  c16b21da3e38ca1835fb0261ce7b81db60985d50
IO-APIC: Reformat IO-APIC RTE debug info (v2)

Having the columns aligned makes for much easier reading.  Also remove
the commas which only add to visual clutter in combination with
spaces.

Furthermore, printing fewer characters makes it less likely that the
serial buffer will overflow resulting in loss of critical debugging
information.

Changes since v1:
 *  Format vector as hex rather than dec
 *  Contract some names
 *  destination mode uses 'L' or 'P' instead of full words
 *  trigger mode uses 'L' or 'E' instead of full words
 *  delivery mode uses short string instead of a number

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


diff -r c16b21da3e38 -r 5bd5830dea13 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Mon Feb 06 13:16:19 2012 -0800
+++ b/xen/arch/x86/io_apic.c	Mon Feb 06 13:17:46 2012 -0800
@@ -2374,6 +2374,23 @@
     return 0;
 }
 
+static const char * delivery_mode_2_str(
+    const enum ioapic_irq_destination_types mode)
+{
+    switch ( mode )
+    {
+    case dest_Fixed: return "Fixed";
+    case dest_LowestPrio: return "LoPri";
+    case dest_SMI: return "SMI";
+    case dest_NMI: return "NMI";
+    case dest_INIT: return "INIT";
+    case dest_ExtINT: return "ExINT";
+    case dest__reserved_1:
+    case dest__reserved_2: return "Resvd";
+    default: return "INVAL";
+    }
+}
+
 void dump_ioapic_irq_info(void)
 {
     struct irq_pin_list *entry;
@@ -2406,13 +2423,12 @@
             *(((int *)&rte) + 1) = io_apic_read(entry->apic, 0x11 + 2 * pin);
             spin_unlock_irqrestore(&ioapic_lock, flags);
 
-            printk("vector=%u, delivery_mode=%u, dest_mode=%s, "
-                   "delivery_status=%d, polarity=%d, irr=%d, "
-                   "trigger=%s, mask=%d, dest_id:%d\n",
-                   rte.vector, rte.delivery_mode,
-                   rte.dest_mode ? "logical" : "physical",
+            printk("vec=%02x delivery=%-5s dest=%c status=%d "
+                   "polarity=%d irr=%d trig=%c mask=%d dest_id:%d\n",
+                   rte.vector, delivery_mode_2_str(rte.delivery_mode),
+                   rte.dest_mode ? 'L' : 'P',
                    rte.delivery_status, rte.polarity, rte.irr,
-                   rte.trigger ? "level" : "edge", rte.mask,
+                   rte.trigger ? 'L' : 'E', rte.mask,
                    rte.dest.logical.logical_dest);
 
             if ( entry->next == 0 )

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 07 04:33:26 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Feb 2012 04:33:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ruck5-0005PZ-CA; Tue, 07 Feb 2012 04:33:21 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Ruck4-0005Nv-Km
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1328589192!10255034!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32734 invoked from network); 7 Feb 2012 04:33:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Feb 2012 04:33:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjw-0001FU-3m
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rucjv-00068C-V4
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 04:33:11 +0000
Message-Id: <E1Rucjv-00068C-V4@xenbits.xen.org>
Date: Tue, 07 Feb 2012 04:33:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] IO-APIC: Reformat IO-APIC RTE debug
	info (v2)
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328563066 28800
# Node ID 5bd5830dea13f2a80a1b9728d3e61c34661fe764
# Parent  c16b21da3e38ca1835fb0261ce7b81db60985d50
IO-APIC: Reformat IO-APIC RTE debug info (v2)

Having the columns aligned makes for much easier reading.  Also remove
the commas which only add to visual clutter in combination with
spaces.

Furthermore, printing fewer characters makes it less likely that the
serial buffer will overflow resulting in loss of critical debugging
information.

Changes since v1:
 *  Format vector as hex rather than dec
 *  Contract some names
 *  destination mode uses 'L' or 'P' instead of full words
 *  trigger mode uses 'L' or 'E' instead of full words
 *  delivery mode uses short string instead of a number

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


diff -r c16b21da3e38 -r 5bd5830dea13 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Mon Feb 06 13:16:19 2012 -0800
+++ b/xen/arch/x86/io_apic.c	Mon Feb 06 13:17:46 2012 -0800
@@ -2374,6 +2374,23 @@
     return 0;
 }
 
+static const char * delivery_mode_2_str(
+    const enum ioapic_irq_destination_types mode)
+{
+    switch ( mode )
+    {
+    case dest_Fixed: return "Fixed";
+    case dest_LowestPrio: return "LoPri";
+    case dest_SMI: return "SMI";
+    case dest_NMI: return "NMI";
+    case dest_INIT: return "INIT";
+    case dest_ExtINT: return "ExINT";
+    case dest__reserved_1:
+    case dest__reserved_2: return "Resvd";
+    default: return "INVAL";
+    }
+}
+
 void dump_ioapic_irq_info(void)
 {
     struct irq_pin_list *entry;
@@ -2406,13 +2423,12 @@
             *(((int *)&rte) + 1) = io_apic_read(entry->apic, 0x11 + 2 * pin);
             spin_unlock_irqrestore(&ioapic_lock, flags);
 
-            printk("vector=%u, delivery_mode=%u, dest_mode=%s, "
-                   "delivery_status=%d, polarity=%d, irr=%d, "
-                   "trigger=%s, mask=%d, dest_id:%d\n",
-                   rte.vector, rte.delivery_mode,
-                   rte.dest_mode ? "logical" : "physical",
+            printk("vec=%02x delivery=%-5s dest=%c status=%d "
+                   "polarity=%d irr=%d trig=%c mask=%d dest_id:%d\n",
+                   rte.vector, delivery_mode_2_str(rte.delivery_mode),
+                   rte.dest_mode ? 'L' : 'P',
                    rte.delivery_status, rte.polarity, rte.irr,
-                   rte.trigger ? "level" : "edge", rte.mask,
+                   rte.trigger ? 'L' : 'E', rte.mask,
                    rte.dest.logical.logical_dest);
 
             if ( entry->next == 0 )

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 07 19:55:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Feb 2012 19:55:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rur8L-00056O-59; Tue, 07 Feb 2012 19:55:21 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rur8K-00055i-3S
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 19:55:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-216.messagelabs.com!1328644511!15717187!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24475 invoked from network); 7 Feb 2012 19:55:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Feb 2012 19:55:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rur8B-0004IY-Fz
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 19:55:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rur8B-0007tl-7x
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 19:55:11 +0000
Message-Id: <E1Rur8B-0007tl-7x@xenbits.xen.org>
Date: Tue, 07 Feb 2012 19:55:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/AMD: Add support for AMD's OSVW
	feature in guests.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Boris Ostrovsky <boris.ostrovsky@amd.com>
# Date 1328623519 -3600
# Node ID eae25241d571ecad4d4b69ac89b0accc9e0fbf6c
# Parent  3574f4d67843733ccaabab5f8ebb859c99d7314a
x86/AMD: Add support for AMD's OSVW feature in guests.

In some cases guests should not provide workarounds for errata even when the
physical processor is affected. For example, because of erratum 400 on family
10h processors a Linux guest will read an MSR (resulting in VMEXIT) before
going to idle in order to avoid getting stuck in a non-C0 state. This is not
necessary: HLT and IO instructions are intercepted and therefore there is no
reason for erratum 400 workaround in the guest.

This patch allows us to present a guest with certain errata as fixed,
regardless of the state of actual hardware.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 3574f4d67843 -r eae25241d571 tools/libxc/xc_cpuid_x86.c
--- a/tools/libxc/xc_cpuid_x86.c	Mon Feb 06 13:23:41 2012 -0800
+++ b/tools/libxc/xc_cpuid_x86.c	Tue Feb 07 15:05:19 2012 +0100
@@ -108,6 +108,7 @@
                     bitmaskof(X86_FEATURE_SSE4A) |
                     bitmaskof(X86_FEATURE_MISALIGNSSE) |
                     bitmaskof(X86_FEATURE_3DNOWPREFETCH) |
+                    bitmaskof(X86_FEATURE_OSVW) |
                     bitmaskof(X86_FEATURE_XOP) |
                     bitmaskof(X86_FEATURE_FMA4) |
                     bitmaskof(X86_FEATURE_TBM) |
diff -r 3574f4d67843 -r eae25241d571 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c	Mon Feb 06 13:23:41 2012 -0800
+++ b/xen/arch/x86/hvm/svm/svm.c	Tue Feb 07 15:05:19 2012 +0100
@@ -83,6 +83,10 @@
 
 static bool_t amd_erratum383_found __read_mostly;
 
+/* OSVW bits */
+static uint64_t osvw_length, osvw_status;
+static DEFINE_SPINLOCK(osvw_lock);
+
 void __update_guest_eip(struct cpu_user_regs *regs, unsigned int inst_len)
 {
     struct vcpu *curr = current;
@@ -902,6 +906,69 @@
     reset_stack_and_jump(svm_asm_do_resume);
 }
 
+static void svm_guest_osvw_init(struct vcpu *vcpu)
+{
+    if ( boot_cpu_data.x86_vendor != X86_VENDOR_AMD )
+        return;
+
+    /*
+     * Guests should see errata 400 and 415 as fixed (assuming that
+     * HLT and IO instructions are intercepted).
+     */
+    vcpu->arch.hvm_svm.osvw.length = (osvw_length >= 3) ? osvw_length : 3;
+    vcpu->arch.hvm_svm.osvw.status = osvw_status & ~(6ULL);
+
+    /*
+     * By increasing VCPU's osvw.length to 3 we are telling the guest that
+     * all osvw.status bits inside that length, including bit 0 (which is
+     * reserved for erratum 298), are valid. However, if host processor's
+     * osvw_len is 0 then osvw_status[0] carries no information. We need to
+     * be conservative here and therefore we tell the guest that erratum 298
+     * is present (because we really don't know).
+     */
+    if ( osvw_length == 0 && boot_cpu_data.x86 == 0x10 )
+        vcpu->arch.hvm_svm.osvw.status |= 1;
+}
+
+void svm_host_osvw_reset()
+{
+    spin_lock(&osvw_lock);
+
+    osvw_length = 64; /* One register (MSRC001_0141) worth of errata */
+    osvw_status = 0;
+
+    spin_unlock(&osvw_lock);
+}
+
+void svm_host_osvw_init()
+{
+    spin_lock(&osvw_lock);
+
+    /*
+     * Get OSVW bits. If bits are not the same on different processors then
+     * choose the worst case (i.e. if erratum is present on one processor and
+     * not on another assume that the erratum is present everywhere).
+     */
+    if ( test_bit(X86_FEATURE_OSVW, &boot_cpu_data.x86_capability) )
+    {
+        uint64_t len, status;
+
+        if ( rdmsr_safe(MSR_AMD_OSVW_ID_LENGTH, len) ||
+             rdmsr_safe(MSR_AMD_OSVW_STATUS, status) )
+            len = status = 0;
+
+        if (len < osvw_length)
+            osvw_length = len;
+
+        osvw_status |= status;
+        osvw_status &= (1ULL << osvw_length) - 1;
+    }
+    else
+        osvw_length = osvw_status = 0;
+
+    spin_unlock(&osvw_lock);
+}
+
 static int svm_domain_initialise(struct domain *d)
 {
     return 0;
@@ -930,6 +997,9 @@
     }
 
     vpmu_initialise(v);
+
+    svm_guest_osvw_init(v);
+
     return 0;
 }
 
@@ -1044,6 +1114,27 @@
     }
 }
 
+static int svm_handle_osvw(struct vcpu *v, uint32_t msr, uint64_t *val, bool_t read)
+{
+    uint eax, ebx, ecx, edx;
+
+    /* Guest OSVW support */
+    hvm_cpuid(0x80000001, &eax, &ebx, &ecx, &edx);
+    if ( !test_bit((X86_FEATURE_OSVW & 31), &ecx) )
+        return -1;
+
+    if ( read )
+    {
+        if (msr == MSR_AMD_OSVW_ID_LENGTH)
+            *val = v->arch.hvm_svm.osvw.length;
+        else
+            *val = v->arch.hvm_svm.osvw.status;
+    }
+    /* Writes are ignored */
+
+    return 0;
+}
+
 static int svm_cpu_up(void)
 {
     uint64_t msr_content;
@@ -1094,6 +1185,9 @@
     }
 #endif
 
+    /* Initialize OSVW bits to be used by guests */
+    svm_host_osvw_init();
+
     return 0;
 }
 
@@ -1104,6 +1198,8 @@
     if ( !test_bit(X86_FEATURE_SVM, &boot_cpu_data.x86_capability) )
         return NULL;
 
+    svm_host_osvw_reset();
+
     if ( svm_cpu_up() )
     {
         printk("SVM: failed to initialise.\n");
@@ -1388,6 +1484,13 @@
         vpmu_do_rdmsr(msr, msr_content);
         break;
 
+    case MSR_AMD_OSVW_ID_LENGTH:
+    case MSR_AMD_OSVW_STATUS:
+        ret = svm_handle_osvw(v, msr, msr_content, 1);
+        if ( ret < 0 )
+            goto gpf;
+        break;
+
     default:
         ret = nsvm_rdmsr(v, msr, msr_content);
         if ( ret < 0 )
@@ -1512,6 +1615,13 @@
          */
         break;
 
+    case MSR_AMD_OSVW_ID_LENGTH:
+    case MSR_AMD_OSVW_STATUS:
+        ret = svm_handle_osvw(v, msr, &msr_content, 0);
+        if ( ret < 0 )
+            goto gpf;
+        break;
+
     default:
         ret = nsvm_wrmsr(v, msr, msr_content);
         if ( ret < 0 )
diff -r 3574f4d67843 -r eae25241d571 xen/arch/x86/microcode.c
--- a/xen/arch/x86/microcode.c	Mon Feb 06 13:23:41 2012 -0800
+++ b/xen/arch/x86/microcode.c	Tue Feb 07 15:05:19 2012 +0100
@@ -218,6 +218,16 @@
     info->error = 0;
     info->cpu = cpumask_first(&cpu_online_map);
 
+    if ( microcode_ops->start_update )
+    {
+        ret = microcode_ops->start_update();
+        if ( ret != 0 )
+        {
+            xfree(info);
+            return ret;
+        }
+    }
+
     return continue_hypercall_on_cpu(info->cpu, do_microcode_update, info);
 }
 
@@ -240,6 +250,12 @@
     if ( !data )
         return -ENOMEM;
 
+    if ( microcode_ops->start_update && microcode_ops->start_update() != 0 )
+    {
+        ucode_mod_map(NULL);
+        return 0;
+    }
+
     softirq_tasklet_init(&tasklet, _do_microcode_update, (unsigned long)data);
 
     for_each_online_cpu ( cpu )
diff -r 3574f4d67843 -r eae25241d571 xen/arch/x86/microcode_amd.c
--- a/xen/arch/x86/microcode_amd.c	Mon Feb 06 13:23:41 2012 -0800
+++ b/xen/arch/x86/microcode_amd.c	Tue Feb 07 15:05:19 2012 +0100
@@ -25,6 +25,7 @@
 #include <asm/msr.h>
 #include <asm/processor.h>
 #include <asm/microcode.h>
+#include <asm/hvm/svm/svm.h>
 
 struct equiv_cpu_entry {
     uint32_t installed_cpu;
@@ -71,6 +72,7 @@
 /* serialize access to the physical write */
 static DEFINE_SPINLOCK(microcode_update_lock);
 
+/* See comment in start_update() for cases when this routine fails */
 static int collect_cpu_info(int cpu, struct cpu_signature *csig)
 {
     struct cpuinfo_x86 *c = &cpu_data[cpu];
@@ -287,7 +289,8 @@
     {
         printk(KERN_ERR "microcode: error! Wrong "
                "microcode patch file magic\n");
-        return -EINVAL;
+        error = -EINVAL;
+        goto out;
     }
 
     mc_amd = xmalloc(struct microcode_amd);
@@ -295,7 +298,8 @@
     {
         printk(KERN_ERR "microcode: error! "
                "Can not allocate memory for microcode patch\n");
-        return -ENOMEM;
+        error = -ENOMEM;
+        goto out;
     }
 
     error = install_equiv_cpu_table(mc_amd, buf, &offset);
@@ -303,7 +307,8 @@
     {
         xfree(mc_amd);
         printk(KERN_ERR "microcode: installing equivalent cpu table failed\n");
-        return -EINVAL;
+        error = -EINVAL;
+        goto out;
     }
 
     mc_old = uci->mc.mc_amd;
@@ -337,13 +342,19 @@
     /* On success keep the microcode patch for
      * re-apply on resume.
      */
-    if (error == 1)
+    if ( error == 1 )
     {
         xfree(mc_old);
-        return 0;
+        error = 0;
     }
-    xfree(mc_amd);
-    uci->mc.mc_amd = mc_old;
+    else
+    {
+        xfree(mc_amd);
+        uci->mc.mc_amd = mc_old;
+    }
+
+  out:
+    svm_host_osvw_init();
 
     return error;
 }
@@ -395,11 +406,28 @@
     return -ENOMEM;
 }
 
+static int start_update(void)
+{
+    /*
+     * We assume here that svm_host_osvw_init() will be called on each cpu (from
+     * cpu_request_microcode()).
+     *
+     * Note that if collect_cpu_info() returns an error then
+     * cpu_request_microcode() will not invoked thus leaving OSVW bits not
+     * updated. Currently though collect_cpu_info() will not fail on processors
+     * supporting OSVW so we will not deal with this possibility.
+     */
+    svm_host_osvw_reset();
+
+    return 0;
+}
+
 static const struct microcode_ops microcode_amd_ops = {
     .microcode_resume_match           = microcode_resume_match,
     .cpu_request_microcode            = cpu_request_microcode,
     .collect_cpu_info                 = collect_cpu_info,
     .apply_microcode                  = apply_microcode,
+    .start_update                     = start_update,
 };
 
 static __init int microcode_init_amd(void)
diff -r 3574f4d67843 -r eae25241d571 xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c	Mon Feb 06 13:23:41 2012 -0800
+++ b/xen/arch/x86/platform_hypercall.c	Tue Feb 07 15:05:19 2012 +0100
@@ -166,7 +166,23 @@
             break;
 
         guest_from_compat_handle(data, op->u.microcode.data);
+
+        /*
+         * alloc_vcpu() will access data which is modified during
+         * microcode update
+         */
+        while ( !spin_trylock(&vcpu_alloc_lock) )
+        {
+            if ( hypercall_preempt_check() )
+            {
+                ret = hypercall_create_continuation(
+                    __HYPERVISOR_platform_op, "h", u_xenpf_op);
+                goto out;
+            }
+        }
+
         ret = microcode_update(data, op->u.microcode.length);
+        spin_unlock(&vcpu_alloc_lock);
     }
     break;
 
diff -r 3574f4d67843 -r eae25241d571 xen/common/domctl.c
--- a/xen/common/domctl.c	Mon Feb 06 13:23:41 2012 -0800
+++ b/xen/common/domctl.c	Tue Feb 07 15:05:19 2012 +0100
@@ -29,6 +29,7 @@
 #include <xsm/xsm.h>
 
 static DEFINE_SPINLOCK(domctl_lock);
+DEFINE_SPINLOCK(vcpu_alloc_lock);
 
 int cpumask_to_xenctl_cpumap(
     struct xenctl_cpumap *xenctl_cpumap, const cpumask_t *cpumask)
@@ -506,6 +507,20 @@
         /* Needed, for example, to ensure writable p.t. state is synced. */
         domain_pause(d);
 
+        /*
+         * Certain operations (e.g. CPU microcode updates) modify data which is
+         * used during VCPU allocation/initialization
+         */
+        while ( !spin_trylock(&vcpu_alloc_lock) )
+        {
+            if ( hypercall_preempt_check() )
+            {
+                ret =  hypercall_create_continuation(
+                    __HYPERVISOR_domctl, "h", u_domctl);
+                goto maxvcpu_out_novcpulock;
+            }
+        }
+
         /* We cannot reduce maximum VCPUs. */
         ret = -EINVAL;
         if ( (max < d->max_vcpus) && (d->vcpu[max] != NULL) )
@@ -555,6 +570,9 @@
         ret = 0;
 
     maxvcpu_out:
+        spin_unlock(&vcpu_alloc_lock);
+
+    maxvcpu_out_novcpulock:
         domain_unpause(d);
         rcu_unlock_domain(d);
     }
diff -r 3574f4d67843 -r eae25241d571 xen/include/asm-x86/hvm/svm/svm.h
--- a/xen/include/asm-x86/hvm/svm/svm.h	Mon Feb 06 13:23:41 2012 -0800
+++ b/xen/include/asm-x86/hvm/svm/svm.h	Tue Feb 07 15:05:19 2012 +0100
@@ -98,4 +98,7 @@
                                   ~TSC_RATIO_RSVD_BITS )
 #define vcpu_tsc_ratio(v)       TSC_RATIO((v)->domain->arch.tsc_khz, cpu_khz)
 
+extern void svm_host_osvw_reset(void);
+extern void svm_host_osvw_init(void);
+
 #endif /* __ASM_X86_HVM_SVM_H__ */
diff -r 3574f4d67843 -r eae25241d571 xen/include/asm-x86/hvm/svm/vmcb.h
--- a/xen/include/asm-x86/hvm/svm/vmcb.h	Mon Feb 06 13:23:41 2012 -0800
+++ b/xen/include/asm-x86/hvm/svm/vmcb.h	Tue Feb 07 15:05:19 2012 +0100
@@ -516,6 +516,12 @@
     
     /* AMD lightweight profiling MSR */
     uint64_t guest_lwp_cfg;
+
+    /* OSVW MSRs */
+    struct {
+        u64 length;
+        u64 status;
+    } osvw;
 };
 
 struct vmcb_struct *alloc_vmcb(void);
diff -r 3574f4d67843 -r eae25241d571 xen/include/asm-x86/microcode.h
--- a/xen/include/asm-x86/microcode.h	Mon Feb 06 13:23:41 2012 -0800
+++ b/xen/include/asm-x86/microcode.h	Tue Feb 07 15:05:19 2012 +0100
@@ -11,6 +11,7 @@
     int (*cpu_request_microcode)(int cpu, const void *buf, size_t size);
     int (*collect_cpu_info)(int cpu, struct cpu_signature *csig);
     int (*apply_microcode)(int cpu);
+    int (*start_update)(void);
 };
 
 struct cpu_signature {
diff -r 3574f4d67843 -r eae25241d571 xen/include/xen/domain.h
--- a/xen/include/xen/domain.h	Mon Feb 06 13:23:41 2012 -0800
+++ b/xen/include/xen/domain.h	Tue Feb 07 15:05:19 2012 +0100
@@ -69,6 +69,7 @@
 
 void arch_vcpu_reset(struct vcpu *v);
 
+extern spinlock_t vcpu_alloc_lock;
 bool_t domctl_lock_acquire(void);
 void domctl_lock_release(void);
 

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 07 19:55:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Feb 2012 19:55:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rur8L-00056O-59; Tue, 07 Feb 2012 19:55:21 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rur8K-00055i-3S
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 19:55:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-216.messagelabs.com!1328644511!15717187!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24475 invoked from network); 7 Feb 2012 19:55:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Feb 2012 19:55:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rur8B-0004IY-Fz
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 19:55:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rur8B-0007tl-7x
	for xen-changelog@lists.xensource.com; Tue, 07 Feb 2012 19:55:11 +0000
Message-Id: <E1Rur8B-0007tl-7x@xenbits.xen.org>
Date: Tue, 07 Feb 2012 19:55:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/AMD: Add support for AMD's OSVW
	feature in guests.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Boris Ostrovsky <boris.ostrovsky@amd.com>
# Date 1328623519 -3600
# Node ID eae25241d571ecad4d4b69ac89b0accc9e0fbf6c
# Parent  3574f4d67843733ccaabab5f8ebb859c99d7314a
x86/AMD: Add support for AMD's OSVW feature in guests.

In some cases guests should not provide workarounds for errata even when the
physical processor is affected. For example, because of erratum 400 on family
10h processors a Linux guest will read an MSR (resulting in VMEXIT) before
going to idle in order to avoid getting stuck in a non-C0 state. This is not
necessary: HLT and IO instructions are intercepted and therefore there is no
reason for erratum 400 workaround in the guest.

This patch allows us to present a guest with certain errata as fixed,
regardless of the state of actual hardware.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 3574f4d67843 -r eae25241d571 tools/libxc/xc_cpuid_x86.c
--- a/tools/libxc/xc_cpuid_x86.c	Mon Feb 06 13:23:41 2012 -0800
+++ b/tools/libxc/xc_cpuid_x86.c	Tue Feb 07 15:05:19 2012 +0100
@@ -108,6 +108,7 @@
                     bitmaskof(X86_FEATURE_SSE4A) |
                     bitmaskof(X86_FEATURE_MISALIGNSSE) |
                     bitmaskof(X86_FEATURE_3DNOWPREFETCH) |
+                    bitmaskof(X86_FEATURE_OSVW) |
                     bitmaskof(X86_FEATURE_XOP) |
                     bitmaskof(X86_FEATURE_FMA4) |
                     bitmaskof(X86_FEATURE_TBM) |
diff -r 3574f4d67843 -r eae25241d571 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c	Mon Feb 06 13:23:41 2012 -0800
+++ b/xen/arch/x86/hvm/svm/svm.c	Tue Feb 07 15:05:19 2012 +0100
@@ -83,6 +83,10 @@
 
 static bool_t amd_erratum383_found __read_mostly;
 
+/* OSVW bits */
+static uint64_t osvw_length, osvw_status;
+static DEFINE_SPINLOCK(osvw_lock);
+
 void __update_guest_eip(struct cpu_user_regs *regs, unsigned int inst_len)
 {
     struct vcpu *curr = current;
@@ -902,6 +906,69 @@
     reset_stack_and_jump(svm_asm_do_resume);
 }
 
+static void svm_guest_osvw_init(struct vcpu *vcpu)
+{
+    if ( boot_cpu_data.x86_vendor != X86_VENDOR_AMD )
+        return;
+
+    /*
+     * Guests should see errata 400 and 415 as fixed (assuming that
+     * HLT and IO instructions are intercepted).
+     */
+    vcpu->arch.hvm_svm.osvw.length = (osvw_length >= 3) ? osvw_length : 3;
+    vcpu->arch.hvm_svm.osvw.status = osvw_status & ~(6ULL);
+
+    /*
+     * By increasing VCPU's osvw.length to 3 we are telling the guest that
+     * all osvw.status bits inside that length, including bit 0 (which is
+     * reserved for erratum 298), are valid. However, if host processor's
+     * osvw_len is 0 then osvw_status[0] carries no information. We need to
+     * be conservative here and therefore we tell the guest that erratum 298
+     * is present (because we really don't know).
+     */
+    if ( osvw_length == 0 && boot_cpu_data.x86 == 0x10 )
+        vcpu->arch.hvm_svm.osvw.status |= 1;
+}
+
+void svm_host_osvw_reset()
+{
+    spin_lock(&osvw_lock);
+
+    osvw_length = 64; /* One register (MSRC001_0141) worth of errata */
+    osvw_status = 0;
+
+    spin_unlock(&osvw_lock);
+}
+
+void svm_host_osvw_init()
+{
+    spin_lock(&osvw_lock);
+
+    /*
+     * Get OSVW bits. If bits are not the same on different processors then
+     * choose the worst case (i.e. if erratum is present on one processor and
+     * not on another assume that the erratum is present everywhere).
+     */
+    if ( test_bit(X86_FEATURE_OSVW, &boot_cpu_data.x86_capability) )
+    {
+        uint64_t len, status;
+
+        if ( rdmsr_safe(MSR_AMD_OSVW_ID_LENGTH, len) ||
+             rdmsr_safe(MSR_AMD_OSVW_STATUS, status) )
+            len = status = 0;
+
+        if (len < osvw_length)
+            osvw_length = len;
+
+        osvw_status |= status;
+        osvw_status &= (1ULL << osvw_length) - 1;
+    }
+    else
+        osvw_length = osvw_status = 0;
+
+    spin_unlock(&osvw_lock);
+}
+
 static int svm_domain_initialise(struct domain *d)
 {
     return 0;
@@ -930,6 +997,9 @@
     }
 
     vpmu_initialise(v);
+
+    svm_guest_osvw_init(v);
+
     return 0;
 }
 
@@ -1044,6 +1114,27 @@
     }
 }
 
+static int svm_handle_osvw(struct vcpu *v, uint32_t msr, uint64_t *val, bool_t read)
+{
+    uint eax, ebx, ecx, edx;
+
+    /* Guest OSVW support */
+    hvm_cpuid(0x80000001, &eax, &ebx, &ecx, &edx);
+    if ( !test_bit((X86_FEATURE_OSVW & 31), &ecx) )
+        return -1;
+
+    if ( read )
+    {
+        if (msr == MSR_AMD_OSVW_ID_LENGTH)
+            *val = v->arch.hvm_svm.osvw.length;
+        else
+            *val = v->arch.hvm_svm.osvw.status;
+    }
+    /* Writes are ignored */
+
+    return 0;
+}
+
 static int svm_cpu_up(void)
 {
     uint64_t msr_content;
@@ -1094,6 +1185,9 @@
     }
 #endif
 
+    /* Initialize OSVW bits to be used by guests */
+    svm_host_osvw_init();
+
     return 0;
 }
 
@@ -1104,6 +1198,8 @@
     if ( !test_bit(X86_FEATURE_SVM, &boot_cpu_data.x86_capability) )
         return NULL;
 
+    svm_host_osvw_reset();
+
     if ( svm_cpu_up() )
     {
         printk("SVM: failed to initialise.\n");
@@ -1388,6 +1484,13 @@
         vpmu_do_rdmsr(msr, msr_content);
         break;
 
+    case MSR_AMD_OSVW_ID_LENGTH:
+    case MSR_AMD_OSVW_STATUS:
+        ret = svm_handle_osvw(v, msr, msr_content, 1);
+        if ( ret < 0 )
+            goto gpf;
+        break;
+
     default:
         ret = nsvm_rdmsr(v, msr, msr_content);
         if ( ret < 0 )
@@ -1512,6 +1615,13 @@
          */
         break;
 
+    case MSR_AMD_OSVW_ID_LENGTH:
+    case MSR_AMD_OSVW_STATUS:
+        ret = svm_handle_osvw(v, msr, &msr_content, 0);
+        if ( ret < 0 )
+            goto gpf;
+        break;
+
     default:
         ret = nsvm_wrmsr(v, msr, msr_content);
         if ( ret < 0 )
diff -r 3574f4d67843 -r eae25241d571 xen/arch/x86/microcode.c
--- a/xen/arch/x86/microcode.c	Mon Feb 06 13:23:41 2012 -0800
+++ b/xen/arch/x86/microcode.c	Tue Feb 07 15:05:19 2012 +0100
@@ -218,6 +218,16 @@
     info->error = 0;
     info->cpu = cpumask_first(&cpu_online_map);
 
+    if ( microcode_ops->start_update )
+    {
+        ret = microcode_ops->start_update();
+        if ( ret != 0 )
+        {
+            xfree(info);
+            return ret;
+        }
+    }
+
     return continue_hypercall_on_cpu(info->cpu, do_microcode_update, info);
 }
 
@@ -240,6 +250,12 @@
     if ( !data )
         return -ENOMEM;
 
+    if ( microcode_ops->start_update && microcode_ops->start_update() != 0 )
+    {
+        ucode_mod_map(NULL);
+        return 0;
+    }
+
     softirq_tasklet_init(&tasklet, _do_microcode_update, (unsigned long)data);
 
     for_each_online_cpu ( cpu )
diff -r 3574f4d67843 -r eae25241d571 xen/arch/x86/microcode_amd.c
--- a/xen/arch/x86/microcode_amd.c	Mon Feb 06 13:23:41 2012 -0800
+++ b/xen/arch/x86/microcode_amd.c	Tue Feb 07 15:05:19 2012 +0100
@@ -25,6 +25,7 @@
 #include <asm/msr.h>
 #include <asm/processor.h>
 #include <asm/microcode.h>
+#include <asm/hvm/svm/svm.h>
 
 struct equiv_cpu_entry {
     uint32_t installed_cpu;
@@ -71,6 +72,7 @@
 /* serialize access to the physical write */
 static DEFINE_SPINLOCK(microcode_update_lock);
 
+/* See comment in start_update() for cases when this routine fails */
 static int collect_cpu_info(int cpu, struct cpu_signature *csig)
 {
     struct cpuinfo_x86 *c = &cpu_data[cpu];
@@ -287,7 +289,8 @@
     {
         printk(KERN_ERR "microcode: error! Wrong "
                "microcode patch file magic\n");
-        return -EINVAL;
+        error = -EINVAL;
+        goto out;
     }
 
     mc_amd = xmalloc(struct microcode_amd);
@@ -295,7 +298,8 @@
     {
         printk(KERN_ERR "microcode: error! "
                "Can not allocate memory for microcode patch\n");
-        return -ENOMEM;
+        error = -ENOMEM;
+        goto out;
     }
 
     error = install_equiv_cpu_table(mc_amd, buf, &offset);
@@ -303,7 +307,8 @@
     {
         xfree(mc_amd);
         printk(KERN_ERR "microcode: installing equivalent cpu table failed\n");
-        return -EINVAL;
+        error = -EINVAL;
+        goto out;
     }
 
     mc_old = uci->mc.mc_amd;
@@ -337,13 +342,19 @@
     /* On success keep the microcode patch for
      * re-apply on resume.
      */
-    if (error == 1)
+    if ( error == 1 )
     {
         xfree(mc_old);
-        return 0;
+        error = 0;
     }
-    xfree(mc_amd);
-    uci->mc.mc_amd = mc_old;
+    else
+    {
+        xfree(mc_amd);
+        uci->mc.mc_amd = mc_old;
+    }
+
+  out:
+    svm_host_osvw_init();
 
     return error;
 }
@@ -395,11 +406,28 @@
     return -ENOMEM;
 }
 
+static int start_update(void)
+{
+    /*
+     * We assume here that svm_host_osvw_init() will be called on each cpu (from
+     * cpu_request_microcode()).
+     *
+     * Note that if collect_cpu_info() returns an error then
+     * cpu_request_microcode() will not invoked thus leaving OSVW bits not
+     * updated. Currently though collect_cpu_info() will not fail on processors
+     * supporting OSVW so we will not deal with this possibility.
+     */
+    svm_host_osvw_reset();
+
+    return 0;
+}
+
 static const struct microcode_ops microcode_amd_ops = {
     .microcode_resume_match           = microcode_resume_match,
     .cpu_request_microcode            = cpu_request_microcode,
     .collect_cpu_info                 = collect_cpu_info,
     .apply_microcode                  = apply_microcode,
+    .start_update                     = start_update,
 };
 
 static __init int microcode_init_amd(void)
diff -r 3574f4d67843 -r eae25241d571 xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c	Mon Feb 06 13:23:41 2012 -0800
+++ b/xen/arch/x86/platform_hypercall.c	Tue Feb 07 15:05:19 2012 +0100
@@ -166,7 +166,23 @@
             break;
 
         guest_from_compat_handle(data, op->u.microcode.data);
+
+        /*
+         * alloc_vcpu() will access data which is modified during
+         * microcode update
+         */
+        while ( !spin_trylock(&vcpu_alloc_lock) )
+        {
+            if ( hypercall_preempt_check() )
+            {
+                ret = hypercall_create_continuation(
+                    __HYPERVISOR_platform_op, "h", u_xenpf_op);
+                goto out;
+            }
+        }
+
         ret = microcode_update(data, op->u.microcode.length);
+        spin_unlock(&vcpu_alloc_lock);
     }
     break;
 
diff -r 3574f4d67843 -r eae25241d571 xen/common/domctl.c
--- a/xen/common/domctl.c	Mon Feb 06 13:23:41 2012 -0800
+++ b/xen/common/domctl.c	Tue Feb 07 15:05:19 2012 +0100
@@ -29,6 +29,7 @@
 #include <xsm/xsm.h>
 
 static DEFINE_SPINLOCK(domctl_lock);
+DEFINE_SPINLOCK(vcpu_alloc_lock);
 
 int cpumask_to_xenctl_cpumap(
     struct xenctl_cpumap *xenctl_cpumap, const cpumask_t *cpumask)
@@ -506,6 +507,20 @@
         /* Needed, for example, to ensure writable p.t. state is synced. */
         domain_pause(d);
 
+        /*
+         * Certain operations (e.g. CPU microcode updates) modify data which is
+         * used during VCPU allocation/initialization
+         */
+        while ( !spin_trylock(&vcpu_alloc_lock) )
+        {
+            if ( hypercall_preempt_check() )
+            {
+                ret =  hypercall_create_continuation(
+                    __HYPERVISOR_domctl, "h", u_domctl);
+                goto maxvcpu_out_novcpulock;
+            }
+        }
+
         /* We cannot reduce maximum VCPUs. */
         ret = -EINVAL;
         if ( (max < d->max_vcpus) && (d->vcpu[max] != NULL) )
@@ -555,6 +570,9 @@
         ret = 0;
 
     maxvcpu_out:
+        spin_unlock(&vcpu_alloc_lock);
+
+    maxvcpu_out_novcpulock:
         domain_unpause(d);
         rcu_unlock_domain(d);
     }
diff -r 3574f4d67843 -r eae25241d571 xen/include/asm-x86/hvm/svm/svm.h
--- a/xen/include/asm-x86/hvm/svm/svm.h	Mon Feb 06 13:23:41 2012 -0800
+++ b/xen/include/asm-x86/hvm/svm/svm.h	Tue Feb 07 15:05:19 2012 +0100
@@ -98,4 +98,7 @@
                                   ~TSC_RATIO_RSVD_BITS )
 #define vcpu_tsc_ratio(v)       TSC_RATIO((v)->domain->arch.tsc_khz, cpu_khz)
 
+extern void svm_host_osvw_reset(void);
+extern void svm_host_osvw_init(void);
+
 #endif /* __ASM_X86_HVM_SVM_H__ */
diff -r 3574f4d67843 -r eae25241d571 xen/include/asm-x86/hvm/svm/vmcb.h
--- a/xen/include/asm-x86/hvm/svm/vmcb.h	Mon Feb 06 13:23:41 2012 -0800
+++ b/xen/include/asm-x86/hvm/svm/vmcb.h	Tue Feb 07 15:05:19 2012 +0100
@@ -516,6 +516,12 @@
     
     /* AMD lightweight profiling MSR */
     uint64_t guest_lwp_cfg;
+
+    /* OSVW MSRs */
+    struct {
+        u64 length;
+        u64 status;
+    } osvw;
 };
 
 struct vmcb_struct *alloc_vmcb(void);
diff -r 3574f4d67843 -r eae25241d571 xen/include/asm-x86/microcode.h
--- a/xen/include/asm-x86/microcode.h	Mon Feb 06 13:23:41 2012 -0800
+++ b/xen/include/asm-x86/microcode.h	Tue Feb 07 15:05:19 2012 +0100
@@ -11,6 +11,7 @@
     int (*cpu_request_microcode)(int cpu, const void *buf, size_t size);
     int (*collect_cpu_info)(int cpu, struct cpu_signature *csig);
     int (*apply_microcode)(int cpu);
+    int (*start_update)(void);
 };
 
 struct cpu_signature {
diff -r 3574f4d67843 -r eae25241d571 xen/include/xen/domain.h
--- a/xen/include/xen/domain.h	Mon Feb 06 13:23:41 2012 -0800
+++ b/xen/include/xen/domain.h	Tue Feb 07 15:05:19 2012 +0100
@@ -69,6 +69,7 @@
 
 void arch_vcpu_reset(struct vcpu *v);
 
+extern spinlock_t vcpu_alloc_lock;
 bool_t domctl_lock_acquire(void);
 void domctl_lock_release(void);
 

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 08 12:33:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2012 12:33:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rv6i2-0006Wp-FO; Wed, 08 Feb 2012 12:33:14 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Rv6i0-0006WJ-Pw
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 12:33:13 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-13.tower-216.messagelabs.com!1328704384!13072421!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1585 invoked from network); 8 Feb 2012 12:33:05 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Feb 2012 12:33:05 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Rv6hs-0008UB-6m
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 12:33:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Rv6hr-0002ZZ-Iy
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 12:33:03 +0000
Date: Wed, 08 Feb 2012 12:33:03 +0000
Message-Id: <E1Rv6hr-0002ZZ-Iy@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-unstable] qemu-dm: fix unregister_iomem()
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 8cc8a3651c9c5bc2d0086d12f4b870fc525b9387
Author: Jan Beulich <JBeulich@suse.com>
Date:   Tue Feb 7 18:42:56 2012 +0000

    qemu-dm: fix unregister_iomem()
    
    This function (introduced quite a long time ago in
    e7911109f4321e9ba0cc56a253b653600aa46bea - "disable qemu PCI
    devices in HVM domains") appears to be completely broken, causing
    the regression reported in
    http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1805 (due to
    the newly added caller of it in
    56d7747a3cf811910c4cf865e1ebcb8b82502005 - "qemu: clean up
    MSI-X table handling"). It's unclear how the function can ever have
    fulfilled its purpose: the value returned by iomem_index() is *not* an
    index into mmio[].
    
    Additionally, fix two problems:
    - unregister_iomem() must not clear mmio[].start, otherwise
      cpu_register_physical_memory() won't be able to re-use the previous
      slot, thus causing a leak
    - cpu_unregister_io_memory() must not check mmio[].size, otherwise it
      won't properly clean up entries (temporarily) squashed through
      unregister_iomem()
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
    Tested-by: Yongjie Ren <yongjie.ren@intel.com>
---
 i386-dm/exec-dm.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/i386-dm/exec-dm.c b/i386-dm/exec-dm.c
index 2158f7c..96274d9 100644
--- a/i386-dm/exec-dm.c
+++ b/i386-dm/exec-dm.c
@@ -360,7 +360,7 @@ void cpu_unregister_io_memory(int io_table_address)
     int io_index = io_table_address >> IO_MEM_SHIFT;
 
     for (i = 0; i < mmio_cnt; i++) {
-	if (mmio[i].size && mmio[i].io_index == io_index) {
+	if (mmio[i].io_index == io_index) {
 	   mmio[i].start = mmio[i].size = 0;
 	   break;
 	}
@@ -466,12 +466,16 @@ static int iomem_index(target_phys_addr_t addr)
 
 void unregister_iomem(target_phys_addr_t start)
 {
-    int index = iomem_index(start);
-    if (index) {
+    unsigned int index;
+
+    for (index = 0; index < mmio_cnt; index++)
+        if (start == mmio[index].start)
+            break;
+    if (index < mmio_cnt) {
         fprintf(logfile, "squash iomem [%lx, %lx).\n",
 		(unsigned long)(mmio[index].start),
                 (unsigned long)(mmio[index].start + mmio[index].size));
-        mmio[index].start = mmio[index].size = 0;
+        mmio[index].size = 0;
     }
 }
 
--
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 Feb 08 12:33:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2012 12:33:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rv6i2-0006Wp-FO; Wed, 08 Feb 2012 12:33:14 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Rv6i0-0006WJ-Pw
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 12:33:13 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-13.tower-216.messagelabs.com!1328704384!13072421!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1585 invoked from network); 8 Feb 2012 12:33:05 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Feb 2012 12:33:05 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Rv6hs-0008UB-6m
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 12:33:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Rv6hr-0002ZZ-Iy
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 12:33:03 +0000
Date: Wed, 08 Feb 2012 12:33:03 +0000
Message-Id: <E1Rv6hr-0002ZZ-Iy@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-unstable] qemu-dm: fix unregister_iomem()
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 8cc8a3651c9c5bc2d0086d12f4b870fc525b9387
Author: Jan Beulich <JBeulich@suse.com>
Date:   Tue Feb 7 18:42:56 2012 +0000

    qemu-dm: fix unregister_iomem()
    
    This function (introduced quite a long time ago in
    e7911109f4321e9ba0cc56a253b653600aa46bea - "disable qemu PCI
    devices in HVM domains") appears to be completely broken, causing
    the regression reported in
    http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1805 (due to
    the newly added caller of it in
    56d7747a3cf811910c4cf865e1ebcb8b82502005 - "qemu: clean up
    MSI-X table handling"). It's unclear how the function can ever have
    fulfilled its purpose: the value returned by iomem_index() is *not* an
    index into mmio[].
    
    Additionally, fix two problems:
    - unregister_iomem() must not clear mmio[].start, otherwise
      cpu_register_physical_memory() won't be able to re-use the previous
      slot, thus causing a leak
    - cpu_unregister_io_memory() must not check mmio[].size, otherwise it
      won't properly clean up entries (temporarily) squashed through
      unregister_iomem()
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
    Tested-by: Yongjie Ren <yongjie.ren@intel.com>
---
 i386-dm/exec-dm.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/i386-dm/exec-dm.c b/i386-dm/exec-dm.c
index 2158f7c..96274d9 100644
--- a/i386-dm/exec-dm.c
+++ b/i386-dm/exec-dm.c
@@ -360,7 +360,7 @@ void cpu_unregister_io_memory(int io_table_address)
     int io_index = io_table_address >> IO_MEM_SHIFT;
 
     for (i = 0; i < mmio_cnt; i++) {
-	if (mmio[i].size && mmio[i].io_index == io_index) {
+	if (mmio[i].io_index == io_index) {
 	   mmio[i].start = mmio[i].size = 0;
 	   break;
 	}
@@ -466,12 +466,16 @@ static int iomem_index(target_phys_addr_t addr)
 
 void unregister_iomem(target_phys_addr_t start)
 {
-    int index = iomem_index(start);
-    if (index) {
+    unsigned int index;
+
+    for (index = 0; index < mmio_cnt; index++)
+        if (start == mmio[index].start)
+            break;
+    if (index < mmio_cnt) {
         fprintf(logfile, "squash iomem [%lx, %lx).\n",
 		(unsigned long)(mmio[index].start),
                 (unsigned long)(mmio[index].start + mmio[index].size));
-        mmio[index].start = mmio[index].size = 0;
+        mmio[index].size = 0;
     }
 }
 
--
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 Feb 08 19:33:21 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2012 19:33:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvDGW-0003BO-80; Wed, 08 Feb 2012 19:33:16 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGU-0003BI-E2
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:14 +0000
Received: from [85.158.139.83:2759] by server-9.bemta-5.messagelabs.com id
	45/9C-23757-9FDC23F4; Wed, 08 Feb 2012 19:33:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-182.messagelabs.com!1328729590!6933334!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16555 invoked from network); 8 Feb 2012 19:33:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Feb 2012 19:33:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGQ-0005PL-79
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGP-0000zE-IM
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:09 +0000
Message-Id: <E1RvDGP-0000zE-IM@xenbits.xen.org>
Date: Wed, 08 Feb 2012 19:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: use json output by default
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328634117 0
# Node ID ff52589f29a32c3c2fcd7c1fe882314f202edf0a
# Parent  b611bff9a8fc50cd2ba0cfb6ada31a8390f1bdea
xl: use json output by default

Move the sxp producing code off into a separate file. It is supported
for legacy reasons and needn't be updated other than the improve
compatibility with xm.

libxl_domain_config is not currently generated by the IDL (adding the
necessary support for Array types is on my to do list) so hand code
the json generation function for now.

Since this rather directly exposes a libxl data structure it's not
clear what sort of forward compatibility guarantees we can
make. However it seems like it should be as stable as libxl's own API
(which we are looking to stabilise)

(Gratuitous string.h include needed for memset in libxl_util.h)

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


diff -r b611bff9a8fc -r ff52589f29a3 docs/man/xl.pod.1
--- a/docs/man/xl.pod.1	Tue Feb 07 16:50:17 2012 +0000
+++ b/docs/man/xl.pod.1	Tue Feb 07 17:01:57 2012 +0000
@@ -219,7 +219,7 @@
 =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.
+instead presents the data in as a JSON data structure.
 
 =item B<-Z>, B<--context>
 Also prints the security labels.
diff -r b611bff9a8fc -r ff52589f29a3 tools/hotplug/Linux/init.d/xendomains
--- a/tools/hotplug/Linux/init.d/xendomains	Tue Feb 07 16:50:17 2012 +0000
+++ b/tools/hotplug/Linux/init.d/xendomains	Tue Feb 07 17:01:57 2012 +0000
@@ -202,15 +202,20 @@
     done
 }
 
+LIST_GREP='((domain\|(domid\|(name\|^{$\|"name":\|"domid":'
 parseln()
 {
-    if [[ "$1" =~ '(domain' ]]; then
+    if [[ "$1" =~ '(domain' ]] || [[ "$1" = "{" ]]; then
         name=;id=
-    else if [[ "$1" =~ '(name' ]]; then
+    elif [[ "$1" =~ '(name' ]]; then
         name=$(echo $1 | sed -e 's/^.*(name \(.*\))$/\1/')
-    else if [[ "$1" =~ '(domid' ]]; then
+    elif [[ "$1" =~ '(domid' ]]; then
         id=$(echo $1 | sed -e 's/^.*(domid \(.*\))$/\1/')
-    fi; fi; fi
+    elif [[ "$1" =~ '"name":' ]]; then
+        name=$(echo $1 | sed -e 's/^.*"name": "\(.*\)",$/\1/')
+    elif [[ "$1" =~ '"domid":' ]]; then
+        id=$(echo $1 | sed -e 's/^.*"domid": \(.*\),$/\1/')
+    fi
 
     [ -n "$name" -a -n "$id" ] && return 0 || return 1
 }
@@ -228,7 +233,7 @@
 		RC=0
 		;;
 	esac
-    done < <($CMD list -l | grep '(\(domain\|domid\|name\)')
+    done < <($CMD list -l | grep $LIST_GREP)
     return $RC
 }
 
@@ -310,7 +315,7 @@
 	if test "$state" != "-b---d" -a "$state" != "-----d"; then
 	    return 1;
 	fi
-    done < <($CMD list -l | grep '(\(domain\|domid\|name\)')
+    done < <($CMD list -l | grep $LIST_GREP)
     return 0
 }
 
@@ -441,7 +446,7 @@
 	    fi
 	    kill $WDOG_PID >/dev/null 2>&1
 	fi
-    done < <($CMD list -l | grep '(\(domain\|domid\|name\)')
+    done < <($CMD list -l | grep $LIST_GREP)
 
     # NB. this shuts down ALL Xen domains (politely), not just the ones in
     # AUTODIR/*
@@ -478,7 +483,7 @@
 		return 0
 		;;
 	esac
-    done < <($CMD list -l | grep '(\(domain\|domid\|name\)')
+    done < <($CMD list -l | grep $LIST_GREP)
     return 1
 }
 
diff -r b611bff9a8fc -r ff52589f29a3 tools/libxl/Makefile
--- a/tools/libxl/Makefile	Tue Feb 07 16:50:17 2012 +0000
+++ b/tools/libxl/Makefile	Tue Feb 07 17:01:57 2012 +0000
@@ -66,7 +66,7 @@
 
 CLIENTS = xl testidl
 
-XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o
+XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) # For xentoollog.h
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxenlight)
 
diff -r b611bff9a8fc -r ff52589f29a3 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Feb 07 16:50:17 2012 +0000
+++ b/tools/libxl/libxl.h	Tue Feb 07 17:01:57 2012 +0000
@@ -130,6 +130,7 @@
 #include <stdbool.h>
 #include <stdint.h>
 #include <stdarg.h>
+#include <string.h>
 #include <errno.h>
 #include <netinet/in.h>
 #include <sys/wait.h> /* for pid_t */
@@ -304,6 +305,7 @@
     libxl_action_on_shutdown on_watchdog;
     libxl_action_on_shutdown on_crash;
 } libxl_domain_config;
+char *libxl_domain_config_to_json(libxl_ctx *ctx, libxl_domain_config *p);
 
 /* context functions */
 int libxl_ctx_alloc(libxl_ctx **pctx, int version,
diff -r b611bff9a8fc -r ff52589f29a3 tools/libxl/libxl_json.c
--- a/tools/libxl/libxl_json.c	Tue Feb 07 16:50:17 2012 +0000
+++ b/tools/libxl/libxl_json.c	Tue Feb 07 17:01:57 2012 +0000
@@ -843,6 +843,158 @@
     return ret;
 }
 
+yajl_gen_status libxl_domain_config_gen_json(yajl_gen hand,
+                                             libxl_domain_config *p)
+{
+    yajl_gen_status s;
+    int i;
+
+    s = yajl_gen_map_open(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"c_info",
+                        sizeof("c_info")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = libxl_domain_create_info_gen_json(hand, &p->c_info);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"b_info",
+                        sizeof("b_info")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = libxl_domain_build_info_gen_json(hand, &p->b_info);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"disks",
+                        sizeof("disks")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = yajl_gen_array_open(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    for (i = 0; i < p->num_disks; i++) {
+        s = libxl_device_disk_gen_json(hand, &p->disks[i]);
+        if (s != yajl_gen_status_ok)
+            goto out;
+    }
+    s = yajl_gen_array_close(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"vifs",
+                        sizeof("vifs")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = yajl_gen_array_open(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    for (i = 0; i < p->num_vifs; i++) {
+        s = libxl_device_nic_gen_json(hand, &p->vifs[i]);
+        if (s != yajl_gen_status_ok)
+            goto out;
+    }
+    s = yajl_gen_array_close(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"pcidevs",
+                        sizeof("pcidevs")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = yajl_gen_array_open(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    for (i = 0; i < p->num_pcidevs; i++) {
+        s = libxl_device_pci_gen_json(hand, &p->pcidevs[i]);
+        if (s != yajl_gen_status_ok)
+            goto out;
+    }
+    s = yajl_gen_array_close(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"vfbs",
+                        sizeof("vfbs")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = yajl_gen_array_open(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    for (i = 0; i < p->num_vfbs; i++) {
+        s = libxl_device_vfb_gen_json(hand, &p->vfbs[i]);
+        if (s != yajl_gen_status_ok)
+            goto out;
+    }
+    s = yajl_gen_array_close(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"vkbs",
+                        sizeof("vkbs")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = yajl_gen_array_open(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    for (i = 0; i < p->num_vkbs; i++) {
+        s = libxl_device_vkb_gen_json(hand, &p->vkbs[i]);
+        if (s != yajl_gen_status_ok)
+            goto out;
+    }
+    s = yajl_gen_array_close(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"on_poweroff",
+                        sizeof("on_poweroff")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = libxl_action_on_shutdown_gen_json(hand, &p->on_poweroff);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"on_reboot",
+                        sizeof("on_reboot")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = libxl_action_on_shutdown_gen_json(hand, &p->on_reboot);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"on_watchdog",
+                        sizeof("on_watchdog")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = libxl_action_on_shutdown_gen_json(hand, &p->on_watchdog);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"on_crash",
+                        sizeof("on_crash")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = libxl_action_on_shutdown_gen_json(hand, &p->on_crash);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_map_close(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    out:
+    return s;
+}
+
+char *libxl_domain_config_to_json(libxl_ctx *ctx, libxl_domain_config *p)
+{
+    return libxl__object_to_json(ctx, "libxl_domain_config",
+                        (libxl__gen_json_callback)&libxl_domain_config_gen_json,
+                        (void *)p);
+}
+
 /*
  * Local variables:
  * mode: C
diff -r b611bff9a8fc -r ff52589f29a3 tools/libxl/libxl_json.h
--- a/tools/libxl/libxl_json.h	Tue Feb 07 16:50:17 2012 +0000
+++ b/tools/libxl/libxl_json.h	Tue Feb 07 17:01:57 2012 +0000
@@ -70,4 +70,7 @@
 
 #endif /* !HAVE_YAJL_V2 */
 
+yajl_gen_status libxl_domain_config_gen_json(yajl_gen hand,
+                                             libxl_domain_config *p);
+
 #endif /* LIBXL_JSON_H */
diff -r b611bff9a8fc -r ff52589f29a3 tools/libxl/xl.c
--- a/tools/libxl/xl.c	Tue Feb 07 16:50:17 2012 +0000
+++ b/tools/libxl/xl.c	Tue Feb 07 17:01:57 2012 +0000
@@ -38,6 +38,7 @@
 int autoballoon = 1;
 char *lockfile;
 char *default_vifscript = NULL;
+enum output_format default_output_format = OUTPUT_FORMAT_JSON;
 
 static xentoollog_level minmsglevel = XTL_PROGRESS;
 
@@ -78,6 +79,15 @@
     if (!xlu_cfg_get_string (config, "vifscript", &buf, 0))
         default_vifscript = strdup(buf);
 
+    if (!xlu_cfg_get_string (config, "output_format", &buf, 0)) {
+        if (!strcmp(buf, "json"))
+            default_output_format = OUTPUT_FORMAT_JSON;
+        else if (!strcmp(buf, "sxp"))
+            default_output_format = OUTPUT_FORMAT_SXP;
+        else {
+            fprintf(stderr, "invalid default output format \"%s\"\n", buf);
+        }
+    }
     xlu_cfg_destroy(config);
 }
 
diff -r b611bff9a8fc -r ff52589f29a3 tools/libxl/xl.h
--- a/tools/libxl/xl.h	Tue Feb 07 16:50:17 2012 +0000
+++ b/tools/libxl/xl.h	Tue Feb 07 17:01:57 2012 +0000
@@ -111,6 +111,14 @@
 extern char *lockfile;
 extern char *default_vifscript;
 
+enum output_format {
+    OUTPUT_FORMAT_JSON,
+    OUTPUT_FORMAT_SXP,
+};
+extern enum output_format default_output_format;
+
+extern void printf_info_sexp(int domid, libxl_domain_config *d_config);
+
 #endif /* XL_H */
 
 /*
diff -r b611bff9a8fc -r ff52589f29a3 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Feb 07 16:50:17 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Feb 07 17:01:57 2012 +0000
@@ -38,6 +38,7 @@
 
 #include "libxl.h"
 #include "libxl_utils.h"
+#include "libxl_json.h"
 #include "libxlutil.h"
 #include "xl.h"
 
@@ -289,187 +290,66 @@
     free(s);
 }
 
-static void printf_info(int domid,
+static void printf_info(enum output_format output_format,
+                        int domid,
                         libxl_domain_config *d_config)
 {
-    int i;
-    libxl_dominfo info;
-
-    libxl_domain_create_info *c_info = &d_config->c_info;
-    libxl_domain_build_info *b_info = &d_config->b_info;
-
-    printf("(domain\n\t(domid %d)\n", domid);
-    printf("\t(create_info)\n");
-    printf("\t(hvm %d)\n", c_info->type == LIBXL_DOMAIN_TYPE_HVM);
-    printf("\t(hap %d)\n", c_info->hap);
-    printf("\t(oos %d)\n", c_info->oos);
-    printf("\t(ssidref %d)\n", c_info->ssidref);
-    printf("\t(name %s)\n", c_info->name);
-
-    /* retrieve the UUID from dominfo, since it is probably generated
-     * during parsing and thus does not match the real one
-     */
-    if (libxl_domain_info(ctx, &info, domid) == 0) {
-        printf("\t(uuid " LIBXL_UUID_FMT ")\n", LIBXL_UUID_BYTES(info.uuid));
-    } else {
-        printf("\t(uuid <unknown>)\n");
-    }
-
-    printf("\t(cpupool %s)\n", libxl_cpupoolid_to_name(ctx, c_info->poolid));
-    if (c_info->xsdata)
-        printf("\t(xsdata contains data)\n");
+    if (output_format == OUTPUT_FORMAT_SXP)
+        return printf_info_sexp(domid, d_config);
+
+    yajl_gen_config conf = { 1, "    " };
+    const char *buf;
+    unsigned int len = 0;
+    yajl_gen_status s;
+    yajl_gen hand;
+
+    hand = yajl_gen_alloc(&conf, NULL);
+    if (!hand) {
+        fprintf(stderr, "unable to allocate JSON generator\n");
+        return;
+    }
+
+    s = yajl_gen_map_open(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"domid",
+                        sizeof("domid")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    if (domid != -1)
+        s = yajl_gen_integer(hand, domid);
     else
-        printf("\t(xsdata (null))\n");
-    if (c_info->platformdata)
-        printf("\t(platformdata contains data)\n");
-    else
-        printf("\t(platformdata (null))\n");
-
-
-    printf("\t(build_info)\n");
-    printf("\t(max_vcpus %d)\n", b_info->max_vcpus);
-    printf("\t(tsc_mode %s)\n", libxl_tsc_mode_to_string(b_info->tsc_mode));
-    printf("\t(max_memkb %d)\n", b_info->max_memkb);
-    printf("\t(target_memkb %d)\n", b_info->target_memkb);
-    printf("\t(nomigrate %d)\n", b_info->disable_migrate);
-
-    if (c_info->type == LIBXL_DOMAIN_TYPE_PV && b_info->u.pv.bootloader) {
-        int i;
-        printf("\t(bootloader %s)\n", b_info->u.pv.bootloader);
-        if (b_info->u.pv.bootloader_args) {
-            printf("\t(bootloader_args");
-            for (i=0; b_info->u.pv.bootloader_args[i]; i++)
-                printf(" %s", b_info->u.pv.bootloader_args[i]);
-            printf(")\n");
-        }
-    }
-
-    printf("\t(image\n");
-    switch (c_info->type) {
-    case LIBXL_DOMAIN_TYPE_HVM:
-        printf("\t\t(hvm\n");
-        printf("\t\t\t(firmware %s)\n", b_info->u.hvm.firmware);
-        printf("\t\t\t(video_memkb %d)\n", b_info->video_memkb);
-        printf("\t\t\t(shadow_memkb %d)\n", b_info->shadow_memkb);
-        printf("\t\t\t(pae %d)\n", b_info->u.hvm.pae);
-        printf("\t\t\t(apic %d)\n", b_info->u.hvm.apic);
-        printf("\t\t\t(acpi %d)\n", b_info->u.hvm.acpi);
-        printf("\t\t\t(nx %d)\n", b_info->u.hvm.nx);
-        printf("\t\t\t(viridian %d)\n", b_info->u.hvm.viridian);
-        printf("\t\t\t(hpet %d)\n", b_info->u.hvm.hpet);
-        printf("\t\t\t(vpt_align %d)\n", b_info->u.hvm.vpt_align);
-        printf("\t\t\t(timer_mode %s)\n",
-               libxl_timer_mode_to_string(b_info->u.hvm.timer_mode));
-
-        printf("\t\t\t(nestedhvm %d)\n", b_info->u.hvm.nested_hvm);
-        printf("\t\t\t(no_incr_generationid %d)\n",
-                    b_info->u.hvm.no_incr_generationid);
-
-        printf("\t\t\t(stdvga %d)\n", b_info->u.hvm.stdvga);
-        printf("\t\t\t(vnc %d)\n", b_info->u.hvm.vnc.enable);
-        printf("\t\t\t(vnclisten %s)\n", b_info->u.hvm.vnc.listen);
-        printf("\t\t\t(vncdisplay %d)\n", b_info->u.hvm.vnc.display);
-        printf("\t\t\t(vncunused %d)\n", b_info->u.hvm.vnc.findunused);
-        printf("\t\t\t(keymap %s)\n", b_info->u.hvm.keymap);
-        printf("\t\t\t(sdl %d)\n", b_info->u.hvm.sdl.enable);
-        printf("\t\t\t(opengl %d)\n", b_info->u.hvm.sdl.opengl);
-        printf("\t\t\t(nographic %d)\n", b_info->u.hvm.nographic);
-        printf("\t\t\t(spice %d)\n", b_info->u.hvm.spice.enable);
-        printf("\t\t\t(spiceport %d)\n", b_info->u.hvm.spice.port);
-        printf("\t\t\t(spicetls_port %d)\n", b_info->u.hvm.spice.tls_port);
-        printf("\t\t\t(spicehost %s)\n", b_info->u.hvm.spice.host);
-        printf("\t\t\t(spicedisable_ticketing %d)\n",
-                    b_info->u.hvm.spice.disable_ticketing);
-        printf("\t\t\t(spiceagent_mouse %d)\n", b_info->u.hvm.spice.agent_mouse);
-
-        printf("\t\t\t(device_model %s)\n", b_info->device_model ? : "default");
-        printf("\t\t\t(gfx_passthru %d)\n", b_info->u.hvm.gfx_passthru);
-        printf("\t\t\t(serial %s)\n", b_info->u.hvm.serial);
-        printf("\t\t\t(boot %s)\n", b_info->u.hvm.boot);
-        printf("\t\t\t(usb %d)\n", b_info->u.hvm.usb);
-        printf("\t\t\t(usbdevice %s)\n", b_info->u.hvm.usbdevice);
-        printf("\t\t)\n");
-        break;
-    case LIBXL_DOMAIN_TYPE_PV:
-        printf("\t\t(linux %d)\n", 0);
-        printf("\t\t\t(kernel %s)\n", b_info->u.pv.kernel.path);
-        printf("\t\t\t(cmdline %s)\n", b_info->u.pv.cmdline);
-        printf("\t\t\t(ramdisk %s)\n", b_info->u.pv.ramdisk.path);
-        printf("\t\t\t(e820_host %d)\n", b_info->u.pv.e820_host);
-        printf("\t\t)\n");
-        break;
-    default:
-        fprintf(stderr, "Unknown domain type %d\n", c_info->type);
-        exit(1);
-    }
-    printf("\t)\n");
-
-    for (i = 0; i < d_config->num_disks; i++) {
-        printf("\t(device\n");
-        printf("\t\t(tap\n");
-        printf("\t\t\t(backend_domid %d)\n", d_config->disks[i].backend_domid);
-        printf("\t\t\t(frontend_domid %d)\n", domid);
-        printf("\t\t\t(physpath %s)\n", d_config->disks[i].pdev_path);
-        printf("\t\t\t(phystype %d)\n", d_config->disks[i].backend);
-        printf("\t\t\t(virtpath %s)\n", d_config->disks[i].vdev);
-        printf("\t\t\t(unpluggable %d)\n", d_config->disks[i].removable);
-        printf("\t\t\t(readwrite %d)\n", d_config->disks[i].readwrite);
-        printf("\t\t\t(is_cdrom %d)\n", d_config->disks[i].is_cdrom);
-        printf("\t\t)\n");
-        printf("\t)\n");
-    }
-
-    for (i = 0; i < d_config->num_vifs; i++) {
-        printf("\t(device\n");
-        printf("\t\t(vif\n");
-        if (d_config->vifs[i].ifname)
-            printf("\t\t\t(vifname %s)\n", d_config->vifs[i].ifname);
-        printf("\t\t\t(backend_domid %d)\n", d_config->vifs[i].backend_domid);
-        printf("\t\t\t(frontend_domid %d)\n", domid);
-        printf("\t\t\t(devid %d)\n", d_config->vifs[i].devid);
-        printf("\t\t\t(mtu %d)\n", d_config->vifs[i].mtu);
-        printf("\t\t\t(model %s)\n", d_config->vifs[i].model);
-        printf("\t\t\t(mac %02x%02x%02x%02x%02x%02x)\n",
-               d_config->vifs[i].mac[0], d_config->vifs[i].mac[1],
-               d_config->vifs[i].mac[2], d_config->vifs[i].mac[3],
-               d_config->vifs[i].mac[4], d_config->vifs[i].mac[5]);
-        printf("\t\t)\n");
-        printf("\t)\n");
-    }
-
-    for (i = 0; i < d_config->num_pcidevs; i++) {
-        printf("\t(device\n");
-        printf("\t\t(pci\n");
-        printf("\t\t\t(pci dev %04x:%02x:%02x.%01x@%02x)\n",
-               d_config->pcidevs[i].domain, d_config->pcidevs[i].bus,
-               d_config->pcidevs[i].dev, d_config->pcidevs[i].func,
-               d_config->pcidevs[i].vdevfn);
-        printf("\t\t\t(opts msitranslate %d power_mgmt %d)\n",
-               d_config->pcidevs[i].msitranslate,
-               d_config->pcidevs[i].power_mgmt);
-        printf("\t\t)\n");
-        printf("\t)\n");
-    }
-
-    for (i = 0; i < d_config->num_vfbs; i++) {
-        printf("\t(device\n");
-        printf("\t\t(vfb\n");
-        printf("\t\t\t(backend_domid %d)\n", d_config->vfbs[i].backend_domid);
-        printf("\t\t\t(frontend_domid %d)\n", domid);
-        printf("\t\t\t(devid %d)\n", d_config->vfbs[i].devid);
-        printf("\t\t\t(vnc %d)\n", d_config->vfbs[i].vnc.enable);
-        printf("\t\t\t(vnclisten %s)\n", d_config->vfbs[i].vnc.listen);
-        printf("\t\t\t(vncdisplay %d)\n", d_config->vfbs[i].vnc.display);
-        printf("\t\t\t(vncunused %d)\n", d_config->vfbs[i].vnc.findunused);
-        printf("\t\t\t(keymap %s)\n", d_config->vfbs[i].keymap);
-        printf("\t\t\t(sdl %d)\n", d_config->vfbs[i].sdl.enable);
-        printf("\t\t\t(opengl %d)\n", d_config->vfbs[i].sdl.opengl);
-        printf("\t\t\t(display %s)\n", d_config->vfbs[i].sdl.display);
-        printf("\t\t\t(xauthority %s)\n", d_config->vfbs[i].sdl.xauthority);
-        printf("\t\t)\n");
-        printf("\t)\n");
-    }
-    printf(")\n");
+        s = yajl_gen_null(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"config",
+                        sizeof("config")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = libxl_domain_config_gen_json(hand, d_config);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_map_close(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_get_buf(hand, (const unsigned char **)&buf, &len);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    puts(buf);
+
+out:
+    yajl_gen_free(hand);
+
+    if (s != yajl_gen_status_ok)
+        fprintf(stderr,
+                "unable to format domain config as JSON (YAJL:%d)\n", s);
+
+    if (ferror(stdout) || fflush(stdout)) { perror("stdout"); exit(-1); }
 }
 
 static int parse_action_on_shutdown(const char *buf, libxl_action_on_shutdown *a)
@@ -682,7 +562,7 @@
         c_info->hap = l;
 
     if (xlu_cfg_replace_string (config, "name", &c_info->name, 0)) {
-        fprintf(stderr, "Domain name must be specified.");
+        fprintf(stderr, "Domain name must be specified.\n");
         exit(1);
     }
 
@@ -1723,7 +1603,7 @@
             dom_info->no_incr_generationid;
 
     if (debug || dom_info->dryrun)
-        printf_info(-1, &d_config);
+        printf_info(default_output_format, -1, &d_config);
 
     ret = 0;
     if (dom_info->dryrun)
@@ -2525,7 +2405,7 @@
         CHK_ERRNO(asprintf(&config_file, "<domid %d data>", info[i].domid));
         memset(&d_config, 0x00, sizeof(d_config));
         parse_config_data(config_file, (char *)data, len, &d_config);
-        printf_info(info[i].domid, &d_config);
+        printf_info(default_output_format, info[i].domid, &d_config);
         libxl_domain_config_dispose(&d_config);
         free(data);
         free(config_file);
diff -r b611bff9a8fc -r ff52589f29a3 tools/libxl/xl_sxp.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxl/xl_sxp.c	Tue Feb 07 17:01:57 2012 +0000
@@ -0,0 +1,220 @@
+/*
+ * Copyright (C) 2009      Citrix Ltd.
+ * Author Stefano Stabellini <stefano.stabellini@eu.citrix.com>
+ * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
+ *
+ * This program 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; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program 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.
+ */
+
+/*
+ * Legacy SXP output handling
+ */
+
+#include "libxl_osdeps.h"
+
+#include <stdlib.h>
+
+#include "libxl.h"
+#include "libxl_utils.h"
+#include "xl.h"
+
+/* In general you should not add new output to this function since it
+ * is intended only for legacy use.
+ */
+void printf_info_sexp(int domid, libxl_domain_config *d_config)
+{
+    int i;
+    libxl_dominfo info;
+
+    libxl_domain_create_info *c_info = &d_config->c_info;
+    libxl_domain_build_info *b_info = &d_config->b_info;
+
+    printf("(domain\n\t(domid %d)\n", domid);
+    printf("\t(create_info)\n");
+    printf("\t(hvm %d)\n", c_info->type == LIBXL_DOMAIN_TYPE_HVM);
+    printf("\t(hap %d)\n", c_info->hap);
+    printf("\t(oos %d)\n", c_info->oos);
+    printf("\t(ssidref %d)\n", c_info->ssidref);
+    printf("\t(name %s)\n", c_info->name);
+
+    /* retrieve the UUID from dominfo, since it is probably generated
+     * during parsing and thus does not match the real one
+     */
+    if (libxl_domain_info(ctx, &info, domid) == 0) {
+        printf("\t(uuid " LIBXL_UUID_FMT ")\n", LIBXL_UUID_BYTES(info.uuid));
+    } else {
+        printf("\t(uuid <unknown>)\n");
+    }
+
+    printf("\t(cpupool %s)\n", libxl_cpupoolid_to_name(ctx, c_info->poolid));
+    if (c_info->xsdata)
+        printf("\t(xsdata contains data)\n");
+    else
+        printf("\t(xsdata (null))\n");
+    if (c_info->platformdata)
+        printf("\t(platformdata contains data)\n");
+    else
+        printf("\t(platformdata (null))\n");
+
+
+    printf("\t(build_info)\n");
+    printf("\t(max_vcpus %d)\n", b_info->max_vcpus);
+    printf("\t(tsc_mode %s)\n", libxl_tsc_mode_to_string(b_info->tsc_mode));
+    printf("\t(max_memkb %d)\n", b_info->max_memkb);
+    printf("\t(target_memkb %d)\n", b_info->target_memkb);
+    printf("\t(nomigrate %d)\n", b_info->disable_migrate);
+
+    if (c_info->type == LIBXL_DOMAIN_TYPE_PV && b_info->u.pv.bootloader) {
+        int i;
+        printf("\t(bootloader %s)\n", b_info->u.pv.bootloader);
+        if (b_info->u.pv.bootloader_args) {
+            printf("\t(bootloader_args");
+            for (i=0; b_info->u.pv.bootloader_args[i]; i++)
+                printf(" %s", b_info->u.pv.bootloader_args[i]);
+            printf(")\n");
+        }
+    }
+
+    printf("\t(image\n");
+    switch (c_info->type) {
+    case LIBXL_DOMAIN_TYPE_HVM:
+        printf("\t\t(hvm\n");
+        printf("\t\t\t(firmware %s)\n", b_info->u.hvm.firmware);
+        printf("\t\t\t(video_memkb %d)\n", b_info->video_memkb);
+        printf("\t\t\t(shadow_memkb %d)\n", b_info->shadow_memkb);
+        printf("\t\t\t(pae %d)\n", b_info->u.hvm.pae);
+        printf("\t\t\t(apic %d)\n", b_info->u.hvm.apic);
+        printf("\t\t\t(acpi %d)\n", b_info->u.hvm.acpi);
+        printf("\t\t\t(nx %d)\n", b_info->u.hvm.nx);
+        printf("\t\t\t(viridian %d)\n", b_info->u.hvm.viridian);
+        printf("\t\t\t(hpet %d)\n", b_info->u.hvm.hpet);
+        printf("\t\t\t(vpt_align %d)\n", b_info->u.hvm.vpt_align);
+        printf("\t\t\t(timer_mode %s)\n",
+               libxl_timer_mode_to_string(b_info->u.hvm.timer_mode));
+        printf("\t\t\t(nestedhvm %d)\n", b_info->u.hvm.nested_hvm);
+        printf("\t\t\t(no_incr_generationid %d)\n",
+                    b_info->u.hvm.no_incr_generationid);
+
+        printf("\t\t\t(stdvga %d)\n", b_info->u.hvm.stdvga);
+        printf("\t\t\t(vnc %d)\n", b_info->u.hvm.vnc.enable);
+        printf("\t\t\t(vnclisten %s)\n", b_info->u.hvm.vnc.listen);
+        printf("\t\t\t(vncdisplay %d)\n", b_info->u.hvm.vnc.display);
+        printf("\t\t\t(vncunused %d)\n", b_info->u.hvm.vnc.findunused);
+        printf("\t\t\t(keymap %s)\n", b_info->u.hvm.keymap);
+        printf("\t\t\t(sdl %d)\n", b_info->u.hvm.sdl.enable);
+        printf("\t\t\t(opengl %d)\n", b_info->u.hvm.sdl.opengl);
+        printf("\t\t\t(nographic %d)\n", b_info->u.hvm.nographic);
+        printf("\t\t\t(spice %d)\n", b_info->u.hvm.spice.enable);
+        printf("\t\t\t(spiceport %d)\n", b_info->u.hvm.spice.port);
+        printf("\t\t\t(spicetls_port %d)\n", b_info->u.hvm.spice.tls_port);
+        printf("\t\t\t(spicehost %s)\n", b_info->u.hvm.spice.host);
+        printf("\t\t\t(spicedisable_ticketing %d)\n",
+                    b_info->u.hvm.spice.disable_ticketing);
+        printf("\t\t\t(spiceagent_mouse %d)\n", b_info->u.hvm.spice.agent_mouse);
+
+        printf("\t\t\t(device_model %s)\n", b_info->device_model ? : "default");
+        printf("\t\t\t(gfx_passthru %d)\n", b_info->u.hvm.gfx_passthru);
+        printf("\t\t\t(serial %s)\n", b_info->u.hvm.serial);
+        printf("\t\t\t(boot %s)\n", b_info->u.hvm.boot);
+        printf("\t\t\t(usb %d)\n", b_info->u.hvm.usb);
+        printf("\t\t\t(usbdevice %s)\n", b_info->u.hvm.usbdevice);
+        printf("\t\t)\n");
+        break;
+    case LIBXL_DOMAIN_TYPE_PV:
+        printf("\t\t(linux %d)\n", 0);
+        printf("\t\t\t(kernel %s)\n", b_info->u.pv.kernel.path);
+        printf("\t\t\t(cmdline %s)\n", b_info->u.pv.cmdline);
+        printf("\t\t\t(ramdisk %s)\n", b_info->u.pv.ramdisk.path);
+        printf("\t\t\t(e820_host %d)\n", b_info->u.pv.e820_host);
+        printf("\t\t)\n");
+        break;
+    default:
+        fprintf(stderr, "Unknown domain type %d\n", c_info->type);
+        exit(1);
+    }
+    printf("\t)\n");
+
+    for (i = 0; i < d_config->num_disks; i++) {
+        printf("\t(device\n");
+        printf("\t\t(tap\n");
+        printf("\t\t\t(backend_domid %d)\n", d_config->disks[i].backend_domid);
+        printf("\t\t\t(frontend_domid %d)\n", domid);
+        printf("\t\t\t(physpath %s)\n", d_config->disks[i].pdev_path);
+        printf("\t\t\t(phystype %d)\n", d_config->disks[i].backend);
+        printf("\t\t\t(virtpath %s)\n", d_config->disks[i].vdev);
+        printf("\t\t\t(unpluggable %d)\n", d_config->disks[i].removable);
+        printf("\t\t\t(readwrite %d)\n", d_config->disks[i].readwrite);
+        printf("\t\t\t(is_cdrom %d)\n", d_config->disks[i].is_cdrom);
+        printf("\t\t)\n");
+        printf("\t)\n");
+    }
+
+    for (i = 0; i < d_config->num_vifs; i++) {
+        printf("\t(device\n");
+        printf("\t\t(vif\n");
+        if (d_config->vifs[i].ifname)
+            printf("\t\t\t(vifname %s)\n", d_config->vifs[i].ifname);
+        printf("\t\t\t(backend_domid %d)\n", d_config->vifs[i].backend_domid);
+        printf("\t\t\t(frontend_domid %d)\n", domid);
+        printf("\t\t\t(devid %d)\n", d_config->vifs[i].devid);
+        printf("\t\t\t(mtu %d)\n", d_config->vifs[i].mtu);
+        printf("\t\t\t(model %s)\n", d_config->vifs[i].model);
+        printf("\t\t\t(mac %02x%02x%02x%02x%02x%02x)\n",
+               d_config->vifs[i].mac[0], d_config->vifs[i].mac[1],
+               d_config->vifs[i].mac[2], d_config->vifs[i].mac[3],
+               d_config->vifs[i].mac[4], d_config->vifs[i].mac[5]);
+        printf("\t\t)\n");
+        printf("\t)\n");
+    }
+
+    for (i = 0; i < d_config->num_pcidevs; i++) {
+        printf("\t(device\n");
+        printf("\t\t(pci\n");
+        printf("\t\t\t(pci dev %04x:%02x:%02x.%01x@%02x)\n",
+               d_config->pcidevs[i].domain, d_config->pcidevs[i].bus,
+               d_config->pcidevs[i].dev, d_config->pcidevs[i].func,
+               d_config->pcidevs[i].vdevfn);
+        printf("\t\t\t(opts msitranslate %d power_mgmt %d)\n",
+               d_config->pcidevs[i].msitranslate,
+               d_config->pcidevs[i].power_mgmt);
+        printf("\t\t)\n");
+        printf("\t)\n");
+    }
+
+    for (i = 0; i < d_config->num_vfbs; i++) {
+        printf("\t(device\n");
+        printf("\t\t(vfb\n");
+        printf("\t\t\t(backend_domid %d)\n", d_config->vfbs[i].backend_domid);
+        printf("\t\t\t(frontend_domid %d)\n", domid);
+        printf("\t\t\t(devid %d)\n", d_config->vfbs[i].devid);
+        printf("\t\t\t(vnc %d)\n", d_config->vfbs[i].vnc.enable);
+        printf("\t\t\t(vnclisten %s)\n", d_config->vfbs[i].vnc.listen);
+        printf("\t\t\t(vncdisplay %d)\n", d_config->vfbs[i].vnc.display);
+        printf("\t\t\t(vncunused %d)\n", d_config->vfbs[i].vnc.findunused);
+        printf("\t\t\t(keymap %s)\n", d_config->vfbs[i].keymap);
+        printf("\t\t\t(sdl %d)\n", d_config->vfbs[i].sdl.enable);
+        printf("\t\t\t(opengl %d)\n", d_config->vfbs[i].sdl.opengl);
+        printf("\t\t\t(display %s)\n", d_config->vfbs[i].sdl.display);
+        printf("\t\t\t(xauthority %s)\n", d_config->vfbs[i].sdl.xauthority);
+        printf("\t\t)\n");
+        printf("\t)\n");
+    }
+    printf(")\n");
+}
+
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 08 19:33:21 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2012 19:33:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvDGW-0003BO-80; Wed, 08 Feb 2012 19:33:16 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGU-0003BI-E2
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:14 +0000
Received: from [85.158.139.83:2759] by server-9.bemta-5.messagelabs.com id
	45/9C-23757-9FDC23F4; Wed, 08 Feb 2012 19:33:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-182.messagelabs.com!1328729590!6933334!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16555 invoked from network); 8 Feb 2012 19:33:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Feb 2012 19:33:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGQ-0005PL-79
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGP-0000zE-IM
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:09 +0000
Message-Id: <E1RvDGP-0000zE-IM@xenbits.xen.org>
Date: Wed, 08 Feb 2012 19:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: use json output by default
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328634117 0
# Node ID ff52589f29a32c3c2fcd7c1fe882314f202edf0a
# Parent  b611bff9a8fc50cd2ba0cfb6ada31a8390f1bdea
xl: use json output by default

Move the sxp producing code off into a separate file. It is supported
for legacy reasons and needn't be updated other than the improve
compatibility with xm.

libxl_domain_config is not currently generated by the IDL (adding the
necessary support for Array types is on my to do list) so hand code
the json generation function for now.

Since this rather directly exposes a libxl data structure it's not
clear what sort of forward compatibility guarantees we can
make. However it seems like it should be as stable as libxl's own API
(which we are looking to stabilise)

(Gratuitous string.h include needed for memset in libxl_util.h)

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


diff -r b611bff9a8fc -r ff52589f29a3 docs/man/xl.pod.1
--- a/docs/man/xl.pod.1	Tue Feb 07 16:50:17 2012 +0000
+++ b/docs/man/xl.pod.1	Tue Feb 07 17:01:57 2012 +0000
@@ -219,7 +219,7 @@
 =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.
+instead presents the data in as a JSON data structure.
 
 =item B<-Z>, B<--context>
 Also prints the security labels.
diff -r b611bff9a8fc -r ff52589f29a3 tools/hotplug/Linux/init.d/xendomains
--- a/tools/hotplug/Linux/init.d/xendomains	Tue Feb 07 16:50:17 2012 +0000
+++ b/tools/hotplug/Linux/init.d/xendomains	Tue Feb 07 17:01:57 2012 +0000
@@ -202,15 +202,20 @@
     done
 }
 
+LIST_GREP='((domain\|(domid\|(name\|^{$\|"name":\|"domid":'
 parseln()
 {
-    if [[ "$1" =~ '(domain' ]]; then
+    if [[ "$1" =~ '(domain' ]] || [[ "$1" = "{" ]]; then
         name=;id=
-    else if [[ "$1" =~ '(name' ]]; then
+    elif [[ "$1" =~ '(name' ]]; then
         name=$(echo $1 | sed -e 's/^.*(name \(.*\))$/\1/')
-    else if [[ "$1" =~ '(domid' ]]; then
+    elif [[ "$1" =~ '(domid' ]]; then
         id=$(echo $1 | sed -e 's/^.*(domid \(.*\))$/\1/')
-    fi; fi; fi
+    elif [[ "$1" =~ '"name":' ]]; then
+        name=$(echo $1 | sed -e 's/^.*"name": "\(.*\)",$/\1/')
+    elif [[ "$1" =~ '"domid":' ]]; then
+        id=$(echo $1 | sed -e 's/^.*"domid": \(.*\),$/\1/')
+    fi
 
     [ -n "$name" -a -n "$id" ] && return 0 || return 1
 }
@@ -228,7 +233,7 @@
 		RC=0
 		;;
 	esac
-    done < <($CMD list -l | grep '(\(domain\|domid\|name\)')
+    done < <($CMD list -l | grep $LIST_GREP)
     return $RC
 }
 
@@ -310,7 +315,7 @@
 	if test "$state" != "-b---d" -a "$state" != "-----d"; then
 	    return 1;
 	fi
-    done < <($CMD list -l | grep '(\(domain\|domid\|name\)')
+    done < <($CMD list -l | grep $LIST_GREP)
     return 0
 }
 
@@ -441,7 +446,7 @@
 	    fi
 	    kill $WDOG_PID >/dev/null 2>&1
 	fi
-    done < <($CMD list -l | grep '(\(domain\|domid\|name\)')
+    done < <($CMD list -l | grep $LIST_GREP)
 
     # NB. this shuts down ALL Xen domains (politely), not just the ones in
     # AUTODIR/*
@@ -478,7 +483,7 @@
 		return 0
 		;;
 	esac
-    done < <($CMD list -l | grep '(\(domain\|domid\|name\)')
+    done < <($CMD list -l | grep $LIST_GREP)
     return 1
 }
 
diff -r b611bff9a8fc -r ff52589f29a3 tools/libxl/Makefile
--- a/tools/libxl/Makefile	Tue Feb 07 16:50:17 2012 +0000
+++ b/tools/libxl/Makefile	Tue Feb 07 17:01:57 2012 +0000
@@ -66,7 +66,7 @@
 
 CLIENTS = xl testidl
 
-XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o
+XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) # For xentoollog.h
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxenlight)
 
diff -r b611bff9a8fc -r ff52589f29a3 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Feb 07 16:50:17 2012 +0000
+++ b/tools/libxl/libxl.h	Tue Feb 07 17:01:57 2012 +0000
@@ -130,6 +130,7 @@
 #include <stdbool.h>
 #include <stdint.h>
 #include <stdarg.h>
+#include <string.h>
 #include <errno.h>
 #include <netinet/in.h>
 #include <sys/wait.h> /* for pid_t */
@@ -304,6 +305,7 @@
     libxl_action_on_shutdown on_watchdog;
     libxl_action_on_shutdown on_crash;
 } libxl_domain_config;
+char *libxl_domain_config_to_json(libxl_ctx *ctx, libxl_domain_config *p);
 
 /* context functions */
 int libxl_ctx_alloc(libxl_ctx **pctx, int version,
diff -r b611bff9a8fc -r ff52589f29a3 tools/libxl/libxl_json.c
--- a/tools/libxl/libxl_json.c	Tue Feb 07 16:50:17 2012 +0000
+++ b/tools/libxl/libxl_json.c	Tue Feb 07 17:01:57 2012 +0000
@@ -843,6 +843,158 @@
     return ret;
 }
 
+yajl_gen_status libxl_domain_config_gen_json(yajl_gen hand,
+                                             libxl_domain_config *p)
+{
+    yajl_gen_status s;
+    int i;
+
+    s = yajl_gen_map_open(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"c_info",
+                        sizeof("c_info")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = libxl_domain_create_info_gen_json(hand, &p->c_info);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"b_info",
+                        sizeof("b_info")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = libxl_domain_build_info_gen_json(hand, &p->b_info);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"disks",
+                        sizeof("disks")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = yajl_gen_array_open(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    for (i = 0; i < p->num_disks; i++) {
+        s = libxl_device_disk_gen_json(hand, &p->disks[i]);
+        if (s != yajl_gen_status_ok)
+            goto out;
+    }
+    s = yajl_gen_array_close(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"vifs",
+                        sizeof("vifs")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = yajl_gen_array_open(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    for (i = 0; i < p->num_vifs; i++) {
+        s = libxl_device_nic_gen_json(hand, &p->vifs[i]);
+        if (s != yajl_gen_status_ok)
+            goto out;
+    }
+    s = yajl_gen_array_close(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"pcidevs",
+                        sizeof("pcidevs")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = yajl_gen_array_open(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    for (i = 0; i < p->num_pcidevs; i++) {
+        s = libxl_device_pci_gen_json(hand, &p->pcidevs[i]);
+        if (s != yajl_gen_status_ok)
+            goto out;
+    }
+    s = yajl_gen_array_close(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"vfbs",
+                        sizeof("vfbs")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = yajl_gen_array_open(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    for (i = 0; i < p->num_vfbs; i++) {
+        s = libxl_device_vfb_gen_json(hand, &p->vfbs[i]);
+        if (s != yajl_gen_status_ok)
+            goto out;
+    }
+    s = yajl_gen_array_close(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"vkbs",
+                        sizeof("vkbs")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = yajl_gen_array_open(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    for (i = 0; i < p->num_vkbs; i++) {
+        s = libxl_device_vkb_gen_json(hand, &p->vkbs[i]);
+        if (s != yajl_gen_status_ok)
+            goto out;
+    }
+    s = yajl_gen_array_close(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"on_poweroff",
+                        sizeof("on_poweroff")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = libxl_action_on_shutdown_gen_json(hand, &p->on_poweroff);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"on_reboot",
+                        sizeof("on_reboot")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = libxl_action_on_shutdown_gen_json(hand, &p->on_reboot);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"on_watchdog",
+                        sizeof("on_watchdog")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = libxl_action_on_shutdown_gen_json(hand, &p->on_watchdog);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"on_crash",
+                        sizeof("on_crash")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = libxl_action_on_shutdown_gen_json(hand, &p->on_crash);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_map_close(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    out:
+    return s;
+}
+
+char *libxl_domain_config_to_json(libxl_ctx *ctx, libxl_domain_config *p)
+{
+    return libxl__object_to_json(ctx, "libxl_domain_config",
+                        (libxl__gen_json_callback)&libxl_domain_config_gen_json,
+                        (void *)p);
+}
+
 /*
  * Local variables:
  * mode: C
diff -r b611bff9a8fc -r ff52589f29a3 tools/libxl/libxl_json.h
--- a/tools/libxl/libxl_json.h	Tue Feb 07 16:50:17 2012 +0000
+++ b/tools/libxl/libxl_json.h	Tue Feb 07 17:01:57 2012 +0000
@@ -70,4 +70,7 @@
 
 #endif /* !HAVE_YAJL_V2 */
 
+yajl_gen_status libxl_domain_config_gen_json(yajl_gen hand,
+                                             libxl_domain_config *p);
+
 #endif /* LIBXL_JSON_H */
diff -r b611bff9a8fc -r ff52589f29a3 tools/libxl/xl.c
--- a/tools/libxl/xl.c	Tue Feb 07 16:50:17 2012 +0000
+++ b/tools/libxl/xl.c	Tue Feb 07 17:01:57 2012 +0000
@@ -38,6 +38,7 @@
 int autoballoon = 1;
 char *lockfile;
 char *default_vifscript = NULL;
+enum output_format default_output_format = OUTPUT_FORMAT_JSON;
 
 static xentoollog_level minmsglevel = XTL_PROGRESS;
 
@@ -78,6 +79,15 @@
     if (!xlu_cfg_get_string (config, "vifscript", &buf, 0))
         default_vifscript = strdup(buf);
 
+    if (!xlu_cfg_get_string (config, "output_format", &buf, 0)) {
+        if (!strcmp(buf, "json"))
+            default_output_format = OUTPUT_FORMAT_JSON;
+        else if (!strcmp(buf, "sxp"))
+            default_output_format = OUTPUT_FORMAT_SXP;
+        else {
+            fprintf(stderr, "invalid default output format \"%s\"\n", buf);
+        }
+    }
     xlu_cfg_destroy(config);
 }
 
diff -r b611bff9a8fc -r ff52589f29a3 tools/libxl/xl.h
--- a/tools/libxl/xl.h	Tue Feb 07 16:50:17 2012 +0000
+++ b/tools/libxl/xl.h	Tue Feb 07 17:01:57 2012 +0000
@@ -111,6 +111,14 @@
 extern char *lockfile;
 extern char *default_vifscript;
 
+enum output_format {
+    OUTPUT_FORMAT_JSON,
+    OUTPUT_FORMAT_SXP,
+};
+extern enum output_format default_output_format;
+
+extern void printf_info_sexp(int domid, libxl_domain_config *d_config);
+
 #endif /* XL_H */
 
 /*
diff -r b611bff9a8fc -r ff52589f29a3 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Feb 07 16:50:17 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Feb 07 17:01:57 2012 +0000
@@ -38,6 +38,7 @@
 
 #include "libxl.h"
 #include "libxl_utils.h"
+#include "libxl_json.h"
 #include "libxlutil.h"
 #include "xl.h"
 
@@ -289,187 +290,66 @@
     free(s);
 }
 
-static void printf_info(int domid,
+static void printf_info(enum output_format output_format,
+                        int domid,
                         libxl_domain_config *d_config)
 {
-    int i;
-    libxl_dominfo info;
-
-    libxl_domain_create_info *c_info = &d_config->c_info;
-    libxl_domain_build_info *b_info = &d_config->b_info;
-
-    printf("(domain\n\t(domid %d)\n", domid);
-    printf("\t(create_info)\n");
-    printf("\t(hvm %d)\n", c_info->type == LIBXL_DOMAIN_TYPE_HVM);
-    printf("\t(hap %d)\n", c_info->hap);
-    printf("\t(oos %d)\n", c_info->oos);
-    printf("\t(ssidref %d)\n", c_info->ssidref);
-    printf("\t(name %s)\n", c_info->name);
-
-    /* retrieve the UUID from dominfo, since it is probably generated
-     * during parsing and thus does not match the real one
-     */
-    if (libxl_domain_info(ctx, &info, domid) == 0) {
-        printf("\t(uuid " LIBXL_UUID_FMT ")\n", LIBXL_UUID_BYTES(info.uuid));
-    } else {
-        printf("\t(uuid <unknown>)\n");
-    }
-
-    printf("\t(cpupool %s)\n", libxl_cpupoolid_to_name(ctx, c_info->poolid));
-    if (c_info->xsdata)
-        printf("\t(xsdata contains data)\n");
+    if (output_format == OUTPUT_FORMAT_SXP)
+        return printf_info_sexp(domid, d_config);
+
+    yajl_gen_config conf = { 1, "    " };
+    const char *buf;
+    unsigned int len = 0;
+    yajl_gen_status s;
+    yajl_gen hand;
+
+    hand = yajl_gen_alloc(&conf, NULL);
+    if (!hand) {
+        fprintf(stderr, "unable to allocate JSON generator\n");
+        return;
+    }
+
+    s = yajl_gen_map_open(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"domid",
+                        sizeof("domid")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    if (domid != -1)
+        s = yajl_gen_integer(hand, domid);
     else
-        printf("\t(xsdata (null))\n");
-    if (c_info->platformdata)
-        printf("\t(platformdata contains data)\n");
-    else
-        printf("\t(platformdata (null))\n");
-
-
-    printf("\t(build_info)\n");
-    printf("\t(max_vcpus %d)\n", b_info->max_vcpus);
-    printf("\t(tsc_mode %s)\n", libxl_tsc_mode_to_string(b_info->tsc_mode));
-    printf("\t(max_memkb %d)\n", b_info->max_memkb);
-    printf("\t(target_memkb %d)\n", b_info->target_memkb);
-    printf("\t(nomigrate %d)\n", b_info->disable_migrate);
-
-    if (c_info->type == LIBXL_DOMAIN_TYPE_PV && b_info->u.pv.bootloader) {
-        int i;
-        printf("\t(bootloader %s)\n", b_info->u.pv.bootloader);
-        if (b_info->u.pv.bootloader_args) {
-            printf("\t(bootloader_args");
-            for (i=0; b_info->u.pv.bootloader_args[i]; i++)
-                printf(" %s", b_info->u.pv.bootloader_args[i]);
-            printf(")\n");
-        }
-    }
-
-    printf("\t(image\n");
-    switch (c_info->type) {
-    case LIBXL_DOMAIN_TYPE_HVM:
-        printf("\t\t(hvm\n");
-        printf("\t\t\t(firmware %s)\n", b_info->u.hvm.firmware);
-        printf("\t\t\t(video_memkb %d)\n", b_info->video_memkb);
-        printf("\t\t\t(shadow_memkb %d)\n", b_info->shadow_memkb);
-        printf("\t\t\t(pae %d)\n", b_info->u.hvm.pae);
-        printf("\t\t\t(apic %d)\n", b_info->u.hvm.apic);
-        printf("\t\t\t(acpi %d)\n", b_info->u.hvm.acpi);
-        printf("\t\t\t(nx %d)\n", b_info->u.hvm.nx);
-        printf("\t\t\t(viridian %d)\n", b_info->u.hvm.viridian);
-        printf("\t\t\t(hpet %d)\n", b_info->u.hvm.hpet);
-        printf("\t\t\t(vpt_align %d)\n", b_info->u.hvm.vpt_align);
-        printf("\t\t\t(timer_mode %s)\n",
-               libxl_timer_mode_to_string(b_info->u.hvm.timer_mode));
-
-        printf("\t\t\t(nestedhvm %d)\n", b_info->u.hvm.nested_hvm);
-        printf("\t\t\t(no_incr_generationid %d)\n",
-                    b_info->u.hvm.no_incr_generationid);
-
-        printf("\t\t\t(stdvga %d)\n", b_info->u.hvm.stdvga);
-        printf("\t\t\t(vnc %d)\n", b_info->u.hvm.vnc.enable);
-        printf("\t\t\t(vnclisten %s)\n", b_info->u.hvm.vnc.listen);
-        printf("\t\t\t(vncdisplay %d)\n", b_info->u.hvm.vnc.display);
-        printf("\t\t\t(vncunused %d)\n", b_info->u.hvm.vnc.findunused);
-        printf("\t\t\t(keymap %s)\n", b_info->u.hvm.keymap);
-        printf("\t\t\t(sdl %d)\n", b_info->u.hvm.sdl.enable);
-        printf("\t\t\t(opengl %d)\n", b_info->u.hvm.sdl.opengl);
-        printf("\t\t\t(nographic %d)\n", b_info->u.hvm.nographic);
-        printf("\t\t\t(spice %d)\n", b_info->u.hvm.spice.enable);
-        printf("\t\t\t(spiceport %d)\n", b_info->u.hvm.spice.port);
-        printf("\t\t\t(spicetls_port %d)\n", b_info->u.hvm.spice.tls_port);
-        printf("\t\t\t(spicehost %s)\n", b_info->u.hvm.spice.host);
-        printf("\t\t\t(spicedisable_ticketing %d)\n",
-                    b_info->u.hvm.spice.disable_ticketing);
-        printf("\t\t\t(spiceagent_mouse %d)\n", b_info->u.hvm.spice.agent_mouse);
-
-        printf("\t\t\t(device_model %s)\n", b_info->device_model ? : "default");
-        printf("\t\t\t(gfx_passthru %d)\n", b_info->u.hvm.gfx_passthru);
-        printf("\t\t\t(serial %s)\n", b_info->u.hvm.serial);
-        printf("\t\t\t(boot %s)\n", b_info->u.hvm.boot);
-        printf("\t\t\t(usb %d)\n", b_info->u.hvm.usb);
-        printf("\t\t\t(usbdevice %s)\n", b_info->u.hvm.usbdevice);
-        printf("\t\t)\n");
-        break;
-    case LIBXL_DOMAIN_TYPE_PV:
-        printf("\t\t(linux %d)\n", 0);
-        printf("\t\t\t(kernel %s)\n", b_info->u.pv.kernel.path);
-        printf("\t\t\t(cmdline %s)\n", b_info->u.pv.cmdline);
-        printf("\t\t\t(ramdisk %s)\n", b_info->u.pv.ramdisk.path);
-        printf("\t\t\t(e820_host %d)\n", b_info->u.pv.e820_host);
-        printf("\t\t)\n");
-        break;
-    default:
-        fprintf(stderr, "Unknown domain type %d\n", c_info->type);
-        exit(1);
-    }
-    printf("\t)\n");
-
-    for (i = 0; i < d_config->num_disks; i++) {
-        printf("\t(device\n");
-        printf("\t\t(tap\n");
-        printf("\t\t\t(backend_domid %d)\n", d_config->disks[i].backend_domid);
-        printf("\t\t\t(frontend_domid %d)\n", domid);
-        printf("\t\t\t(physpath %s)\n", d_config->disks[i].pdev_path);
-        printf("\t\t\t(phystype %d)\n", d_config->disks[i].backend);
-        printf("\t\t\t(virtpath %s)\n", d_config->disks[i].vdev);
-        printf("\t\t\t(unpluggable %d)\n", d_config->disks[i].removable);
-        printf("\t\t\t(readwrite %d)\n", d_config->disks[i].readwrite);
-        printf("\t\t\t(is_cdrom %d)\n", d_config->disks[i].is_cdrom);
-        printf("\t\t)\n");
-        printf("\t)\n");
-    }
-
-    for (i = 0; i < d_config->num_vifs; i++) {
-        printf("\t(device\n");
-        printf("\t\t(vif\n");
-        if (d_config->vifs[i].ifname)
-            printf("\t\t\t(vifname %s)\n", d_config->vifs[i].ifname);
-        printf("\t\t\t(backend_domid %d)\n", d_config->vifs[i].backend_domid);
-        printf("\t\t\t(frontend_domid %d)\n", domid);
-        printf("\t\t\t(devid %d)\n", d_config->vifs[i].devid);
-        printf("\t\t\t(mtu %d)\n", d_config->vifs[i].mtu);
-        printf("\t\t\t(model %s)\n", d_config->vifs[i].model);
-        printf("\t\t\t(mac %02x%02x%02x%02x%02x%02x)\n",
-               d_config->vifs[i].mac[0], d_config->vifs[i].mac[1],
-               d_config->vifs[i].mac[2], d_config->vifs[i].mac[3],
-               d_config->vifs[i].mac[4], d_config->vifs[i].mac[5]);
-        printf("\t\t)\n");
-        printf("\t)\n");
-    }
-
-    for (i = 0; i < d_config->num_pcidevs; i++) {
-        printf("\t(device\n");
-        printf("\t\t(pci\n");
-        printf("\t\t\t(pci dev %04x:%02x:%02x.%01x@%02x)\n",
-               d_config->pcidevs[i].domain, d_config->pcidevs[i].bus,
-               d_config->pcidevs[i].dev, d_config->pcidevs[i].func,
-               d_config->pcidevs[i].vdevfn);
-        printf("\t\t\t(opts msitranslate %d power_mgmt %d)\n",
-               d_config->pcidevs[i].msitranslate,
-               d_config->pcidevs[i].power_mgmt);
-        printf("\t\t)\n");
-        printf("\t)\n");
-    }
-
-    for (i = 0; i < d_config->num_vfbs; i++) {
-        printf("\t(device\n");
-        printf("\t\t(vfb\n");
-        printf("\t\t\t(backend_domid %d)\n", d_config->vfbs[i].backend_domid);
-        printf("\t\t\t(frontend_domid %d)\n", domid);
-        printf("\t\t\t(devid %d)\n", d_config->vfbs[i].devid);
-        printf("\t\t\t(vnc %d)\n", d_config->vfbs[i].vnc.enable);
-        printf("\t\t\t(vnclisten %s)\n", d_config->vfbs[i].vnc.listen);
-        printf("\t\t\t(vncdisplay %d)\n", d_config->vfbs[i].vnc.display);
-        printf("\t\t\t(vncunused %d)\n", d_config->vfbs[i].vnc.findunused);
-        printf("\t\t\t(keymap %s)\n", d_config->vfbs[i].keymap);
-        printf("\t\t\t(sdl %d)\n", d_config->vfbs[i].sdl.enable);
-        printf("\t\t\t(opengl %d)\n", d_config->vfbs[i].sdl.opengl);
-        printf("\t\t\t(display %s)\n", d_config->vfbs[i].sdl.display);
-        printf("\t\t\t(xauthority %s)\n", d_config->vfbs[i].sdl.xauthority);
-        printf("\t\t)\n");
-        printf("\t)\n");
-    }
-    printf(")\n");
+        s = yajl_gen_null(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_string(hand, (const unsigned char *)"config",
+                        sizeof("config")-1);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    s = libxl_domain_config_gen_json(hand, d_config);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_map_close(hand);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_get_buf(hand, (const unsigned char **)&buf, &len);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    puts(buf);
+
+out:
+    yajl_gen_free(hand);
+
+    if (s != yajl_gen_status_ok)
+        fprintf(stderr,
+                "unable to format domain config as JSON (YAJL:%d)\n", s);
+
+    if (ferror(stdout) || fflush(stdout)) { perror("stdout"); exit(-1); }
 }
 
 static int parse_action_on_shutdown(const char *buf, libxl_action_on_shutdown *a)
@@ -682,7 +562,7 @@
         c_info->hap = l;
 
     if (xlu_cfg_replace_string (config, "name", &c_info->name, 0)) {
-        fprintf(stderr, "Domain name must be specified.");
+        fprintf(stderr, "Domain name must be specified.\n");
         exit(1);
     }
 
@@ -1723,7 +1603,7 @@
             dom_info->no_incr_generationid;
 
     if (debug || dom_info->dryrun)
-        printf_info(-1, &d_config);
+        printf_info(default_output_format, -1, &d_config);
 
     ret = 0;
     if (dom_info->dryrun)
@@ -2525,7 +2405,7 @@
         CHK_ERRNO(asprintf(&config_file, "<domid %d data>", info[i].domid));
         memset(&d_config, 0x00, sizeof(d_config));
         parse_config_data(config_file, (char *)data, len, &d_config);
-        printf_info(info[i].domid, &d_config);
+        printf_info(default_output_format, info[i].domid, &d_config);
         libxl_domain_config_dispose(&d_config);
         free(data);
         free(config_file);
diff -r b611bff9a8fc -r ff52589f29a3 tools/libxl/xl_sxp.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxl/xl_sxp.c	Tue Feb 07 17:01:57 2012 +0000
@@ -0,0 +1,220 @@
+/*
+ * Copyright (C) 2009      Citrix Ltd.
+ * Author Stefano Stabellini <stefano.stabellini@eu.citrix.com>
+ * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
+ *
+ * This program 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; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program 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.
+ */
+
+/*
+ * Legacy SXP output handling
+ */
+
+#include "libxl_osdeps.h"
+
+#include <stdlib.h>
+
+#include "libxl.h"
+#include "libxl_utils.h"
+#include "xl.h"
+
+/* In general you should not add new output to this function since it
+ * is intended only for legacy use.
+ */
+void printf_info_sexp(int domid, libxl_domain_config *d_config)
+{
+    int i;
+    libxl_dominfo info;
+
+    libxl_domain_create_info *c_info = &d_config->c_info;
+    libxl_domain_build_info *b_info = &d_config->b_info;
+
+    printf("(domain\n\t(domid %d)\n", domid);
+    printf("\t(create_info)\n");
+    printf("\t(hvm %d)\n", c_info->type == LIBXL_DOMAIN_TYPE_HVM);
+    printf("\t(hap %d)\n", c_info->hap);
+    printf("\t(oos %d)\n", c_info->oos);
+    printf("\t(ssidref %d)\n", c_info->ssidref);
+    printf("\t(name %s)\n", c_info->name);
+
+    /* retrieve the UUID from dominfo, since it is probably generated
+     * during parsing and thus does not match the real one
+     */
+    if (libxl_domain_info(ctx, &info, domid) == 0) {
+        printf("\t(uuid " LIBXL_UUID_FMT ")\n", LIBXL_UUID_BYTES(info.uuid));
+    } else {
+        printf("\t(uuid <unknown>)\n");
+    }
+
+    printf("\t(cpupool %s)\n", libxl_cpupoolid_to_name(ctx, c_info->poolid));
+    if (c_info->xsdata)
+        printf("\t(xsdata contains data)\n");
+    else
+        printf("\t(xsdata (null))\n");
+    if (c_info->platformdata)
+        printf("\t(platformdata contains data)\n");
+    else
+        printf("\t(platformdata (null))\n");
+
+
+    printf("\t(build_info)\n");
+    printf("\t(max_vcpus %d)\n", b_info->max_vcpus);
+    printf("\t(tsc_mode %s)\n", libxl_tsc_mode_to_string(b_info->tsc_mode));
+    printf("\t(max_memkb %d)\n", b_info->max_memkb);
+    printf("\t(target_memkb %d)\n", b_info->target_memkb);
+    printf("\t(nomigrate %d)\n", b_info->disable_migrate);
+
+    if (c_info->type == LIBXL_DOMAIN_TYPE_PV && b_info->u.pv.bootloader) {
+        int i;
+        printf("\t(bootloader %s)\n", b_info->u.pv.bootloader);
+        if (b_info->u.pv.bootloader_args) {
+            printf("\t(bootloader_args");
+            for (i=0; b_info->u.pv.bootloader_args[i]; i++)
+                printf(" %s", b_info->u.pv.bootloader_args[i]);
+            printf(")\n");
+        }
+    }
+
+    printf("\t(image\n");
+    switch (c_info->type) {
+    case LIBXL_DOMAIN_TYPE_HVM:
+        printf("\t\t(hvm\n");
+        printf("\t\t\t(firmware %s)\n", b_info->u.hvm.firmware);
+        printf("\t\t\t(video_memkb %d)\n", b_info->video_memkb);
+        printf("\t\t\t(shadow_memkb %d)\n", b_info->shadow_memkb);
+        printf("\t\t\t(pae %d)\n", b_info->u.hvm.pae);
+        printf("\t\t\t(apic %d)\n", b_info->u.hvm.apic);
+        printf("\t\t\t(acpi %d)\n", b_info->u.hvm.acpi);
+        printf("\t\t\t(nx %d)\n", b_info->u.hvm.nx);
+        printf("\t\t\t(viridian %d)\n", b_info->u.hvm.viridian);
+        printf("\t\t\t(hpet %d)\n", b_info->u.hvm.hpet);
+        printf("\t\t\t(vpt_align %d)\n", b_info->u.hvm.vpt_align);
+        printf("\t\t\t(timer_mode %s)\n",
+               libxl_timer_mode_to_string(b_info->u.hvm.timer_mode));
+        printf("\t\t\t(nestedhvm %d)\n", b_info->u.hvm.nested_hvm);
+        printf("\t\t\t(no_incr_generationid %d)\n",
+                    b_info->u.hvm.no_incr_generationid);
+
+        printf("\t\t\t(stdvga %d)\n", b_info->u.hvm.stdvga);
+        printf("\t\t\t(vnc %d)\n", b_info->u.hvm.vnc.enable);
+        printf("\t\t\t(vnclisten %s)\n", b_info->u.hvm.vnc.listen);
+        printf("\t\t\t(vncdisplay %d)\n", b_info->u.hvm.vnc.display);
+        printf("\t\t\t(vncunused %d)\n", b_info->u.hvm.vnc.findunused);
+        printf("\t\t\t(keymap %s)\n", b_info->u.hvm.keymap);
+        printf("\t\t\t(sdl %d)\n", b_info->u.hvm.sdl.enable);
+        printf("\t\t\t(opengl %d)\n", b_info->u.hvm.sdl.opengl);
+        printf("\t\t\t(nographic %d)\n", b_info->u.hvm.nographic);
+        printf("\t\t\t(spice %d)\n", b_info->u.hvm.spice.enable);
+        printf("\t\t\t(spiceport %d)\n", b_info->u.hvm.spice.port);
+        printf("\t\t\t(spicetls_port %d)\n", b_info->u.hvm.spice.tls_port);
+        printf("\t\t\t(spicehost %s)\n", b_info->u.hvm.spice.host);
+        printf("\t\t\t(spicedisable_ticketing %d)\n",
+                    b_info->u.hvm.spice.disable_ticketing);
+        printf("\t\t\t(spiceagent_mouse %d)\n", b_info->u.hvm.spice.agent_mouse);
+
+        printf("\t\t\t(device_model %s)\n", b_info->device_model ? : "default");
+        printf("\t\t\t(gfx_passthru %d)\n", b_info->u.hvm.gfx_passthru);
+        printf("\t\t\t(serial %s)\n", b_info->u.hvm.serial);
+        printf("\t\t\t(boot %s)\n", b_info->u.hvm.boot);
+        printf("\t\t\t(usb %d)\n", b_info->u.hvm.usb);
+        printf("\t\t\t(usbdevice %s)\n", b_info->u.hvm.usbdevice);
+        printf("\t\t)\n");
+        break;
+    case LIBXL_DOMAIN_TYPE_PV:
+        printf("\t\t(linux %d)\n", 0);
+        printf("\t\t\t(kernel %s)\n", b_info->u.pv.kernel.path);
+        printf("\t\t\t(cmdline %s)\n", b_info->u.pv.cmdline);
+        printf("\t\t\t(ramdisk %s)\n", b_info->u.pv.ramdisk.path);
+        printf("\t\t\t(e820_host %d)\n", b_info->u.pv.e820_host);
+        printf("\t\t)\n");
+        break;
+    default:
+        fprintf(stderr, "Unknown domain type %d\n", c_info->type);
+        exit(1);
+    }
+    printf("\t)\n");
+
+    for (i = 0; i < d_config->num_disks; i++) {
+        printf("\t(device\n");
+        printf("\t\t(tap\n");
+        printf("\t\t\t(backend_domid %d)\n", d_config->disks[i].backend_domid);
+        printf("\t\t\t(frontend_domid %d)\n", domid);
+        printf("\t\t\t(physpath %s)\n", d_config->disks[i].pdev_path);
+        printf("\t\t\t(phystype %d)\n", d_config->disks[i].backend);
+        printf("\t\t\t(virtpath %s)\n", d_config->disks[i].vdev);
+        printf("\t\t\t(unpluggable %d)\n", d_config->disks[i].removable);
+        printf("\t\t\t(readwrite %d)\n", d_config->disks[i].readwrite);
+        printf("\t\t\t(is_cdrom %d)\n", d_config->disks[i].is_cdrom);
+        printf("\t\t)\n");
+        printf("\t)\n");
+    }
+
+    for (i = 0; i < d_config->num_vifs; i++) {
+        printf("\t(device\n");
+        printf("\t\t(vif\n");
+        if (d_config->vifs[i].ifname)
+            printf("\t\t\t(vifname %s)\n", d_config->vifs[i].ifname);
+        printf("\t\t\t(backend_domid %d)\n", d_config->vifs[i].backend_domid);
+        printf("\t\t\t(frontend_domid %d)\n", domid);
+        printf("\t\t\t(devid %d)\n", d_config->vifs[i].devid);
+        printf("\t\t\t(mtu %d)\n", d_config->vifs[i].mtu);
+        printf("\t\t\t(model %s)\n", d_config->vifs[i].model);
+        printf("\t\t\t(mac %02x%02x%02x%02x%02x%02x)\n",
+               d_config->vifs[i].mac[0], d_config->vifs[i].mac[1],
+               d_config->vifs[i].mac[2], d_config->vifs[i].mac[3],
+               d_config->vifs[i].mac[4], d_config->vifs[i].mac[5]);
+        printf("\t\t)\n");
+        printf("\t)\n");
+    }
+
+    for (i = 0; i < d_config->num_pcidevs; i++) {
+        printf("\t(device\n");
+        printf("\t\t(pci\n");
+        printf("\t\t\t(pci dev %04x:%02x:%02x.%01x@%02x)\n",
+               d_config->pcidevs[i].domain, d_config->pcidevs[i].bus,
+               d_config->pcidevs[i].dev, d_config->pcidevs[i].func,
+               d_config->pcidevs[i].vdevfn);
+        printf("\t\t\t(opts msitranslate %d power_mgmt %d)\n",
+               d_config->pcidevs[i].msitranslate,
+               d_config->pcidevs[i].power_mgmt);
+        printf("\t\t)\n");
+        printf("\t)\n");
+    }
+
+    for (i = 0; i < d_config->num_vfbs; i++) {
+        printf("\t(device\n");
+        printf("\t\t(vfb\n");
+        printf("\t\t\t(backend_domid %d)\n", d_config->vfbs[i].backend_domid);
+        printf("\t\t\t(frontend_domid %d)\n", domid);
+        printf("\t\t\t(devid %d)\n", d_config->vfbs[i].devid);
+        printf("\t\t\t(vnc %d)\n", d_config->vfbs[i].vnc.enable);
+        printf("\t\t\t(vnclisten %s)\n", d_config->vfbs[i].vnc.listen);
+        printf("\t\t\t(vncdisplay %d)\n", d_config->vfbs[i].vnc.display);
+        printf("\t\t\t(vncunused %d)\n", d_config->vfbs[i].vnc.findunused);
+        printf("\t\t\t(keymap %s)\n", d_config->vfbs[i].keymap);
+        printf("\t\t\t(sdl %d)\n", d_config->vfbs[i].sdl.enable);
+        printf("\t\t\t(opengl %d)\n", d_config->vfbs[i].sdl.opengl);
+        printf("\t\t\t(display %s)\n", d_config->vfbs[i].sdl.display);
+        printf("\t\t\t(xauthority %s)\n", d_config->vfbs[i].sdl.xauthority);
+        printf("\t\t)\n");
+        printf("\t)\n");
+    }
+    printf(")\n");
+}
+
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 08 19:33:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2012 19:33:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvDGY-0003Bo-D1; Wed, 08 Feb 2012 19:33:18 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGX-0003BD-AS
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1328729590!7420468!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20392 invoked from network); 8 Feb 2012 19:33:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Feb 2012 19:33:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGP-0005PI-Hn
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGO-0000ym-SG
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:09 +0000
Message-Id: <E1RvDGO-0000ym-SG@xenbits.xen.org>
Date: Wed, 08 Feb 2012 19:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: Drop -l option to xl cpupool-list
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328633417 0
# Node ID b611bff9a8fc50cd2ba0cfb6ada31a8390f1bdea
# Parent  eae25241d571ecad4d4b69ac89b0accc9e0fbf6c
xl: Drop -l option to xl cpupool-list

The implementation (which was a nop) was removed back in 22838:aab67c1c6b87 but
this now causes "set but not used" warnings from some compilers. Might as well
just nuke the option entirely.

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


diff -r eae25241d571 -r b611bff9a8fc tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Feb 07 15:05:19 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue Feb 07 16:50:17 2012 +0000
@@ -5585,11 +5585,9 @@
     int option_index = 0;
     static struct option long_options[] = {
         {"help", 0, 0, 'h'},
-        {"long", 0, 0, 'l'},
         {"cpus", 0, 0, 'c'},
         {0, 0, 0, 0}
     };
-    int opt_long = 0;
     int opt_cpus = 0;
     const char *pool = NULL;
     libxl_cpupoolinfo *poolinfo;
@@ -5599,7 +5597,7 @@
     int ret = 0;
 
     while (1) {
-        opt = getopt_long(argc, argv, "hlc", long_options, &option_index);
+        opt = getopt_long(argc, argv, "hc", long_options, &option_index);
         if (opt == -1)
             break;
 
@@ -5607,9 +5605,6 @@
         case 'h':
             help("cpupool-list");
             return 0;
-        case 'l':
-            opt_long = 1;
-            break;
         case 'c':
             opt_cpus = 1;
             break;

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 08 19:33:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2012 19:33:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvDGY-0003Bo-D1; Wed, 08 Feb 2012 19:33:18 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGX-0003BD-AS
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1328729590!7420468!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20392 invoked from network); 8 Feb 2012 19:33:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Feb 2012 19:33:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGP-0005PI-Hn
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGO-0000ym-SG
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:09 +0000
Message-Id: <E1RvDGO-0000ym-SG@xenbits.xen.org>
Date: Wed, 08 Feb 2012 19:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: Drop -l option to xl cpupool-list
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328633417 0
# Node ID b611bff9a8fc50cd2ba0cfb6ada31a8390f1bdea
# Parent  eae25241d571ecad4d4b69ac89b0accc9e0fbf6c
xl: Drop -l option to xl cpupool-list

The implementation (which was a nop) was removed back in 22838:aab67c1c6b87 but
this now causes "set but not used" warnings from some compilers. Might as well
just nuke the option entirely.

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


diff -r eae25241d571 -r b611bff9a8fc tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Feb 07 15:05:19 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue Feb 07 16:50:17 2012 +0000
@@ -5585,11 +5585,9 @@
     int option_index = 0;
     static struct option long_options[] = {
         {"help", 0, 0, 'h'},
-        {"long", 0, 0, 'l'},
         {"cpus", 0, 0, 'c'},
         {0, 0, 0, 0}
     };
-    int opt_long = 0;
     int opt_cpus = 0;
     const char *pool = NULL;
     libxl_cpupoolinfo *poolinfo;
@@ -5599,7 +5597,7 @@
     int ret = 0;
 
     while (1) {
-        opt = getopt_long(argc, argv, "hlc", long_options, &option_index);
+        opt = getopt_long(argc, argv, "hc", long_options, &option_index);
         if (opt == -1)
             break;
 
@@ -5607,9 +5605,6 @@
         case 'h':
             help("cpupool-list");
             return 0;
-        case 'l':
-            opt_long = 1;
-            break;
         case 'c':
             opt_cpus = 1;
             break;

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 08 19:33:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2012 19:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvDGa-0003CX-KX; Wed, 08 Feb 2012 19:33:20 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGY-0003BG-GE
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1328729591!8399697!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31831 invoked from network); 8 Feb 2012 19:33:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Feb 2012 19:33:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGR-0005PX-5e
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGR-00010P-4X
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:11 +0000
Message-Id: <E1RvDGR-00010P-4X@xenbits.xen.org>
Date: Wed, 08 Feb 2012 19:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] irq: Add extra debugging to help
	track down why an assertion is failing
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328640252 0
# Node ID 96987c324a4f42bf642e3e15e8e8fff331fef182
# Parent  f84f34ec5fc7613d7a6dd53d18218656c11f0daa
irq: Add extra debugging to help track down why an assertion is failing

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r f84f34ec5fc7 -r 96987c324a4f xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Tue Feb 07 17:21:27 2012 +0000
+++ b/xen/arch/x86/irq.c	Tue Feb 07 18:44:12 2012 +0000
@@ -608,6 +608,8 @@
     desc->handler->enable(desc);
 }
 
+static void dump_irqs(unsigned char key);
+
 fastcall void smp_irq_move_cleanup_interrupt(struct cpu_user_regs *regs)
 {
     unsigned vector, me;
@@ -667,7 +669,18 @@
 
             if ( desc->arch.used_vectors )
             {
-                ASSERT(test_bit(vector, desc->arch.used_vectors));
+                if ( unlikely(!test_bit(vector, desc->arch.used_vectors)) )
+                {
+                    bitmap_scnlistprintf(keyhandler_scratch,
+                                         sizeof(keyhandler_scratch),
+                                         desc->arch.used_vectors->_bits,
+                                         NR_VECTORS);
+                    printk("*** IRQ BUG found ***\n"
+                           "CPU%d -Testing vector %d from bitmap %s\n",
+                           me, vector, keyhandler_scratch);
+                    dump_irqs('i');
+                    BUG();
+                }
                 clear_bit(vector, desc->arch.used_vectors);
             }
         }

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 08 19:33:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2012 19:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvDGa-0003CX-KX; Wed, 08 Feb 2012 19:33:20 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGY-0003BG-GE
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1328729591!8399697!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31831 invoked from network); 8 Feb 2012 19:33:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Feb 2012 19:33:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGR-0005PX-5e
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGR-00010P-4X
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:11 +0000
Message-Id: <E1RvDGR-00010P-4X@xenbits.xen.org>
Date: Wed, 08 Feb 2012 19:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] irq: Add extra debugging to help
	track down why an assertion is failing
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328640252 0
# Node ID 96987c324a4f42bf642e3e15e8e8fff331fef182
# Parent  f84f34ec5fc7613d7a6dd53d18218656c11f0daa
irq: Add extra debugging to help track down why an assertion is failing

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r f84f34ec5fc7 -r 96987c324a4f xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Tue Feb 07 17:21:27 2012 +0000
+++ b/xen/arch/x86/irq.c	Tue Feb 07 18:44:12 2012 +0000
@@ -608,6 +608,8 @@
     desc->handler->enable(desc);
 }
 
+static void dump_irqs(unsigned char key);
+
 fastcall void smp_irq_move_cleanup_interrupt(struct cpu_user_regs *regs)
 {
     unsigned vector, me;
@@ -667,7 +669,18 @@
 
             if ( desc->arch.used_vectors )
             {
-                ASSERT(test_bit(vector, desc->arch.used_vectors));
+                if ( unlikely(!test_bit(vector, desc->arch.used_vectors)) )
+                {
+                    bitmap_scnlistprintf(keyhandler_scratch,
+                                         sizeof(keyhandler_scratch),
+                                         desc->arch.used_vectors->_bits,
+                                         NR_VECTORS);
+                    printk("*** IRQ BUG found ***\n"
+                           "CPU%d -Testing vector %d from bitmap %s\n",
+                           me, vector, keyhandler_scratch);
+                    dump_irqs('i');
+                    BUG();
+                }
                 clear_bit(vector, desc->arch.used_vectors);
             }
         }

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 08 19:33:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2012 19:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvDGa-0003Cc-NC; Wed, 08 Feb 2012 19:33:20 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGY-0003BN-NY
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1328729544!62082723!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14458 invoked from network); 8 Feb 2012 19:32:25 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Feb 2012 19:32:25 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGS-0005Pd-AQ
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGS-00011G-5p
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:12 +0000
Message-Id: <E1RvDGS-00011G-5p@xenbits.xen.org>
Date: Wed, 08 Feb 2012 19:33:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxc: Replace malloc with alloca in
	hot path
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Santosh Jodh <santosh.jodh@citrix.com>
# Date 1328640410 0
# Node ID 8ba7ae0b070b4de93fc033067c61714c202d64c1
# Parent  0a28397a3ee5ce290a35c1b6e6c62466179c40eb
libxc: Replace malloc with alloca in hot path

Replace malloc with alloc in hot paths for improved performance.

Signed-off-by: Santosh Jodh <santosh.jodh@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 0a28397a3ee5 -r 8ba7ae0b070b tools/libxc/xc_linux_osdep.c
--- a/tools/libxc/xc_linux_osdep.c	Tue Feb 07 18:45:00 2012 +0000
+++ b/tools/libxc/xc_linux_osdep.c	Tue Feb 07 18:46:50 2012 +0000
@@ -243,7 +243,7 @@
          * IOCTL_PRIVCMD_MMAPBATCH_V2 is not supported - fall back to
          * IOCTL_PRIVCMD_MMAPBATCH.
          */
-        xen_pfn_t *pfn = malloc(num * sizeof(*pfn));
+        xen_pfn_t *pfn = alloca(num * sizeof(*pfn));
 
         if ( pfn )
         {
@@ -289,8 +289,6 @@
                 break;
             }
 
-            free(pfn);
-
             if ( rc == -ENOENT && i == num )
                 rc = 0;
             else if ( rc )
@@ -525,7 +523,7 @@
     if (flags & XC_GRANT_MAP_SINGLE_DOMAIN)
         domids_stride = 0;
 
-    map = malloc(sizeof(*map) +
+    map = alloca(sizeof(*map) +
                  (count - 1) * sizeof(struct ioctl_gntdev_map_grant_ref));
     if ( map == NULL )
         return NULL;
@@ -599,7 +597,6 @@
     }
 
  out:
-    free(map);
 
     return addr;
 }

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 08 19:33:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2012 19:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvDGa-0003Cc-NC; Wed, 08 Feb 2012 19:33:20 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGY-0003BN-NY
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1328729544!62082723!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14458 invoked from network); 8 Feb 2012 19:32:25 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Feb 2012 19:32:25 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGS-0005Pd-AQ
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGS-00011G-5p
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:12 +0000
Message-Id: <E1RvDGS-00011G-5p@xenbits.xen.org>
Date: Wed, 08 Feb 2012 19:33:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxc: Replace malloc with alloca in
	hot path
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Santosh Jodh <santosh.jodh@citrix.com>
# Date 1328640410 0
# Node ID 8ba7ae0b070b4de93fc033067c61714c202d64c1
# Parent  0a28397a3ee5ce290a35c1b6e6c62466179c40eb
libxc: Replace malloc with alloca in hot path

Replace malloc with alloc in hot paths for improved performance.

Signed-off-by: Santosh Jodh <santosh.jodh@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 0a28397a3ee5 -r 8ba7ae0b070b tools/libxc/xc_linux_osdep.c
--- a/tools/libxc/xc_linux_osdep.c	Tue Feb 07 18:45:00 2012 +0000
+++ b/tools/libxc/xc_linux_osdep.c	Tue Feb 07 18:46:50 2012 +0000
@@ -243,7 +243,7 @@
          * IOCTL_PRIVCMD_MMAPBATCH_V2 is not supported - fall back to
          * IOCTL_PRIVCMD_MMAPBATCH.
          */
-        xen_pfn_t *pfn = malloc(num * sizeof(*pfn));
+        xen_pfn_t *pfn = alloca(num * sizeof(*pfn));
 
         if ( pfn )
         {
@@ -289,8 +289,6 @@
                 break;
             }
 
-            free(pfn);
-
             if ( rc == -ENOENT && i == num )
                 rc = 0;
             else if ( rc )
@@ -525,7 +523,7 @@
     if (flags & XC_GRANT_MAP_SINGLE_DOMAIN)
         domids_stride = 0;
 
-    map = malloc(sizeof(*map) +
+    map = alloca(sizeof(*map) +
                  (count - 1) * sizeof(struct ioctl_gntdev_map_grant_ref));
     if ( map == NULL )
         return NULL;
@@ -599,7 +597,6 @@
     }
 
  out:
-    free(map);
 
     return addr;
 }

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 08 19:33:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2012 19:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvDGZ-0003CJ-Hr; Wed, 08 Feb 2012 19:33:19 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGY-0003BF-Bv
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1328729591!14534420!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14386 invoked from network); 8 Feb 2012 19:33:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Feb 2012 19:33:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGQ-0005PU-R8
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGQ-000101-Jl
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:10 +0000
Message-Id: <E1RvDGQ-000101-Jl@xenbits.xen.org>
Date: Wed, 08 Feb 2012 19:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] pygrub: extlinux parsing correctness
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328635287 0
# Node ID f84f34ec5fc7613d7a6dd53d18218656c11f0daa
# Parent  7a58296824c3bf7a15d563a7a140d20c369c96c8
pygrub: extlinux parsing correctness

The "in" operator should be used instead of the find method, since
we are only interested in knowing whether the line contains "initrd=",
but we don't care about it's position. Also fixes an error that
happens when initrd= it's at the start of the line, since find returns
0 and is evaluated as False.

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 7a58296824c3 -r f84f34ec5fc7 tools/pygrub/src/ExtLinuxConf.py
--- a/tools/pygrub/src/ExtLinuxConf.py	Tue Feb 07 17:18:10 2012 +0000
+++ b/tools/pygrub/src/ExtLinuxConf.py	Tue Feb 07 17:21:27 2012 +0000
@@ -60,7 +60,7 @@
 
                 # Bypass regular self.commands handling
                 com = None
-            elif arg.find("initrd="):
+            elif "initrd=" in arg:
                 # find initrd image in append line
                 args = arg.strip().split(" ")
                 for a in args:

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 08 19:33:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2012 19:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvDGZ-0003CJ-Hr; Wed, 08 Feb 2012 19:33:19 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGY-0003BF-Bv
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1328729591!14534420!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14386 invoked from network); 8 Feb 2012 19:33:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Feb 2012 19:33:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGQ-0005PU-R8
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGQ-000101-Jl
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:10 +0000
Message-Id: <E1RvDGQ-000101-Jl@xenbits.xen.org>
Date: Wed, 08 Feb 2012 19:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] pygrub: extlinux parsing correctness
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328635287 0
# Node ID f84f34ec5fc7613d7a6dd53d18218656c11f0daa
# Parent  7a58296824c3bf7a15d563a7a140d20c369c96c8
pygrub: extlinux parsing correctness

The "in" operator should be used instead of the find method, since
we are only interested in knowing whether the line contains "initrd=",
but we don't care about it's position. Also fixes an error that
happens when initrd= it's at the start of the line, since find returns
0 and is evaluated as False.

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 7a58296824c3 -r f84f34ec5fc7 tools/pygrub/src/ExtLinuxConf.py
--- a/tools/pygrub/src/ExtLinuxConf.py	Tue Feb 07 17:18:10 2012 +0000
+++ b/tools/pygrub/src/ExtLinuxConf.py	Tue Feb 07 17:21:27 2012 +0000
@@ -60,7 +60,7 @@
 
                 # Bypass regular self.commands handling
                 com = None
-            elif arg.find("initrd="):
+            elif "initrd=" in arg:
                 # find initrd image in append line
                 args = arg.strip().split(" ")
                 for a in args:

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 08 19:33:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2012 19:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvDGZ-0003CA-FY; Wed, 08 Feb 2012 19:33:19 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGX-0003BE-HE
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-21.messagelabs.com!1328729590!11061045!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22755 invoked from network); 8 Feb 2012 19:33:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Feb 2012 19:33:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGQ-0005PM-7M
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGQ-0000zc-3K
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:10 +0000
Message-Id: <E1RvDGQ-0000zc-3K@xenbits.xen.org>
Date: Wed, 08 Feb 2012 19:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: remove shebang from
	bash_completion helper
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328635090 0
# Node ID 7a58296824c3bf7a15d563a7a140d20c369c96c8
# Parent  ff52589f29a32c3c2fcd7c1fe882314f202edf0a
libxl: remove shebang from bash_completion helper

Fix rpmlint warning:

xen-tools.x86_64: W: sourced-script-with-shebang
/etc/bash_completion.d/xl.sh /bin/bash
This text file contains a shebang, but is meant to be sourced, not executed.

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


diff -r ff52589f29a3 -r 7a58296824c3 tools/libxl/bash-completion
--- a/tools/libxl/bash-completion	Tue Feb 07 17:01:57 2012 +0000
+++ b/tools/libxl/bash-completion	Tue Feb 07 17:18:10 2012 +0000
@@ -1,4 +1,3 @@
-#!/bin/bash
 # Copy this file to /etc/bash_completion.d/xl.sh
 
 _xl()

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 08 19:33:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2012 19:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvDGZ-0003CA-FY; Wed, 08 Feb 2012 19:33:19 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGX-0003BE-HE
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-21.messagelabs.com!1328729590!11061045!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22755 invoked from network); 8 Feb 2012 19:33:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Feb 2012 19:33:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGQ-0005PM-7M
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGQ-0000zc-3K
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:10 +0000
Message-Id: <E1RvDGQ-0000zc-3K@xenbits.xen.org>
Date: Wed, 08 Feb 2012 19:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: remove shebang from
	bash_completion helper
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328635090 0
# Node ID 7a58296824c3bf7a15d563a7a140d20c369c96c8
# Parent  ff52589f29a32c3c2fcd7c1fe882314f202edf0a
libxl: remove shebang from bash_completion helper

Fix rpmlint warning:

xen-tools.x86_64: W: sourced-script-with-shebang
/etc/bash_completion.d/xl.sh /bin/bash
This text file contains a shebang, but is meant to be sourced, not executed.

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


diff -r ff52589f29a3 -r 7a58296824c3 tools/libxl/bash-completion
--- a/tools/libxl/bash-completion	Tue Feb 07 17:01:57 2012 +0000
+++ b/tools/libxl/bash-completion	Tue Feb 07 17:18:10 2012 +0000
@@ -1,4 +1,3 @@
-#!/bin/bash
 # Copy this file to /etc/bash_completion.d/xl.sh
 
 _xl()

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 08 19:33:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2012 19:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvDGa-0003Ch-PO; Wed, 08 Feb 2012 19:33:20 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGZ-0003BH-7W
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-216.messagelabs.com!1328729592!10662441!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31695 invoked from network); 8 Feb 2012 19:33:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Feb 2012 19:33:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGR-0005Pa-TV
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGR-00010o-LR
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:11 +0000
Message-Id: <E1RvDGR-00010o-LR@xenbits.xen.org>
Date: Wed, 08 Feb 2012 19:33:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] QEMU_TAG update
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328640300 0
# Node ID 0a28397a3ee5ce290a35c1b6e6c62466179c40eb
# Parent  96987c324a4f42bf642e3e15e8e8fff331fef182
QEMU_TAG update
---


diff -r 96987c324a4f -r 0a28397a3ee5 Config.mk
--- a/Config.mk	Tue Feb 07 18:44:12 2012 +0000
+++ b/Config.mk	Tue Feb 07 18:45:00 2012 +0000
@@ -227,9 +227,9 @@
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= ebe37b2a3f844bad02dcc30d081f39eda06118f8
-# Thu Feb 2 13:47:06 2012 +0000
-# e1000: bounds packet size against buffer size
+QEMU_TAG ?= 8cc8a3651c9c5bc2d0086d12f4b870fc525b9387
+# Tue Feb 7 18:42:56 2012 +0000
+# qemu-dm: fix unregister_iomem()
 
 # 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 Feb 08 19:33:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2012 19:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvDGa-0003Ch-PO; Wed, 08 Feb 2012 19:33:20 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGZ-0003BH-7W
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-216.messagelabs.com!1328729592!10662441!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31695 invoked from network); 8 Feb 2012 19:33:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Feb 2012 19:33:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGR-0005Pa-TV
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvDGR-00010o-LR
	for xen-changelog@lists.xensource.com; Wed, 08 Feb 2012 19:33:11 +0000
Message-Id: <E1RvDGR-00010o-LR@xenbits.xen.org>
Date: Wed, 08 Feb 2012 19:33:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] QEMU_TAG update
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328640300 0
# Node ID 0a28397a3ee5ce290a35c1b6e6c62466179c40eb
# Parent  96987c324a4f42bf642e3e15e8e8fff331fef182
QEMU_TAG update
---


diff -r 96987c324a4f -r 0a28397a3ee5 Config.mk
--- a/Config.mk	Tue Feb 07 18:44:12 2012 +0000
+++ b/Config.mk	Tue Feb 07 18:45:00 2012 +0000
@@ -227,9 +227,9 @@
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= ebe37b2a3f844bad02dcc30d081f39eda06118f8
-# Thu Feb 2 13:47:06 2012 +0000
-# e1000: bounds packet size against buffer size
+QEMU_TAG ?= 8cc8a3651c9c5bc2d0086d12f4b870fc525b9387
+# Tue Feb 7 18:42:56 2012 +0000
+# qemu-dm: fix unregister_iomem()
 
 # 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 Thu Feb 09 16:00:33 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQ7-0005yw-J3; Thu, 09 Feb 2012 16:00:27 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ5-0005y2-Vj
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1328803218!14138210!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21825 invoked from network); 9 Feb 2012 16:00:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWPy-0004Or-Ml
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWPx-00061u-Qs
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:18 +0000
Message-Id: <E1RvWPx-00061u-Qs@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: add Ivy Bridge model numbers to
	model specific MSR handling
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328785659 -3600
# Node ID 004a886b35d81330ca4e6c582727193fc0fdf2aa
# Parent  8ba7ae0b070b4de93fc033067c61714c202d64c1
x86: add Ivy Bridge model numbers to model specific MSR handling

This is model 0x3a (decimal 58) as per the most recent SDM.

In vPMU code, also add a forgotten earlier model.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Xiantao Zhang<xiantao.zhang@intel.com>
---


diff -r 8ba7ae0b070b -r 004a886b35d8 xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c	Tue Feb 07 18:46:50 2012 +0000
+++ b/xen/arch/x86/acpi/cpu_idle.c	Thu Feb 09 12:07:39 2012 +0100
@@ -106,6 +106,8 @@
 
     switch ( c->x86_model )
     {
+    /* Ivy bridge */
+    case 0x3A:
     /* Sandy bridge */
     case 0x2A:
     case 0x2D:
diff -r 8ba7ae0b070b -r 004a886b35d8 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c	Tue Feb 07 18:46:50 2012 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c	Thu Feb 09 12:07:39 2012 +0100
@@ -1751,6 +1751,8 @@
         case 37: case 44: case 47:
         /* Sandy Bridge */
         case 42: case 45:
+        /* Ivy Bridge */
+        case 58:
             return nh_lbr;
             break;
         /* Atom */
diff -r 8ba7ae0b070b -r 004a886b35d8 xen/arch/x86/hvm/vmx/vpmu_core2.c
--- a/xen/arch/x86/hvm/vmx/vpmu_core2.c	Tue Feb 07 18:46:50 2012 +0000
+++ b/xen/arch/x86/hvm/vmx/vpmu_core2.c	Thu Feb 09 12:07:39 2012 +0100
@@ -623,8 +623,10 @@
         case 26:
         case 29:
         case 42:
+        case 45:
         case 46:
         case 47:
+        case 58:
             vpmu->arch_vpmu_ops = &core2_vpmu_ops;
             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 Feb 09 16:00:33 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQ7-0005yw-J3; Thu, 09 Feb 2012 16:00:27 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ5-0005y2-Vj
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1328803218!14138210!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21825 invoked from network); 9 Feb 2012 16:00:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWPy-0004Or-Ml
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWPx-00061u-Qs
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:18 +0000
Message-Id: <E1RvWPx-00061u-Qs@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: add Ivy Bridge model numbers to
	model specific MSR handling
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328785659 -3600
# Node ID 004a886b35d81330ca4e6c582727193fc0fdf2aa
# Parent  8ba7ae0b070b4de93fc033067c61714c202d64c1
x86: add Ivy Bridge model numbers to model specific MSR handling

This is model 0x3a (decimal 58) as per the most recent SDM.

In vPMU code, also add a forgotten earlier model.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Xiantao Zhang<xiantao.zhang@intel.com>
---


diff -r 8ba7ae0b070b -r 004a886b35d8 xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c	Tue Feb 07 18:46:50 2012 +0000
+++ b/xen/arch/x86/acpi/cpu_idle.c	Thu Feb 09 12:07:39 2012 +0100
@@ -106,6 +106,8 @@
 
     switch ( c->x86_model )
     {
+    /* Ivy bridge */
+    case 0x3A:
     /* Sandy bridge */
     case 0x2A:
     case 0x2D:
diff -r 8ba7ae0b070b -r 004a886b35d8 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c	Tue Feb 07 18:46:50 2012 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c	Thu Feb 09 12:07:39 2012 +0100
@@ -1751,6 +1751,8 @@
         case 37: case 44: case 47:
         /* Sandy Bridge */
         case 42: case 45:
+        /* Ivy Bridge */
+        case 58:
             return nh_lbr;
             break;
         /* Atom */
diff -r 8ba7ae0b070b -r 004a886b35d8 xen/arch/x86/hvm/vmx/vpmu_core2.c
--- a/xen/arch/x86/hvm/vmx/vpmu_core2.c	Tue Feb 07 18:46:50 2012 +0000
+++ b/xen/arch/x86/hvm/vmx/vpmu_core2.c	Thu Feb 09 12:07:39 2012 +0100
@@ -623,8 +623,10 @@
         case 26:
         case 29:
         case 42:
+        case 45:
         case 46:
         case 47:
+        case 58:
             vpmu->arch_vpmu_ops = &core2_vpmu_ops;
             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 Feb 09 16:00:34 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQB-0005zX-Lt; Thu, 09 Feb 2012 16:00:31 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQA-0005yG-2Q
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:30 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-174.messagelabs.com!1328803222!12707314!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10791 invoked from network); 9 Feb 2012 16:00:23 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ2-0004Ox-GD
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:22 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ1-00065P-Rs
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:22 +0000
Message-Id: <E1RvWQ1-00065P-Rs@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: compile tmem
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787209 0
# Node ID dcb04595033b020f16a1ed642cfbeb263a85e969
# Parent  fe7338e04b37f467a4a8bb773de5f66fcaa90778
arm: compile tmem

Include few missing header files; introduce defined(CONFIG_ARM) where
required.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r fe7338e04b37 -r dcb04595033b xen/common/tmem.c
--- a/xen/common/tmem.c	Thu Feb 09 11:33:28 2012 +0000
+++ b/xen/common/tmem.c	Thu Feb 09 11:33:29 2012 +0000
@@ -22,6 +22,7 @@
 #include <xen/rbtree.h>
 #include <xen/radix-tree.h>
 #include <xen/list.h>
+#include <xen/init.h>
 
 #define EXPORT /* indicates code other modules are dependent upon */
 #define FORWARD
@@ -49,7 +50,7 @@
 #define INVERT_SENTINEL(_x,_y) _x->sentinel = ~_y##_SENTINEL
 #define ASSERT_SENTINEL(_x,_y) \
     ASSERT(_x->sentinel != ~_y##_SENTINEL);ASSERT(_x->sentinel == _y##_SENTINEL)
-#ifdef __i386__
+#if defined(__i386__) || defined(CONFIG_ARM)
 #define POOL_SENTINEL 0x87658765
 #define OBJ_SENTINEL 0x12345678
 #define OBJNODE_SENTINEL 0xfedcba09
diff -r fe7338e04b37 -r dcb04595033b xen/common/tmem_xen.c
--- a/xen/common/tmem_xen.c	Thu Feb 09 11:33:28 2012 +0000
+++ b/xen/common/tmem_xen.c	Thu Feb 09 11:33:29 2012 +0000
@@ -12,6 +12,8 @@
 #include <xen/paging.h>
 #include <xen/domain_page.h>
 #include <xen/cpu.h>
+#include <xen/init.h>
+#include <asm/p2m.h>
 
 #define EXPORT /* indicates code other modules are dependent upon */
 
@@ -87,7 +89,7 @@
 #endif
 }
 
-#ifdef __ia64__
+#if defined(__ia64__) || defined (CONFIG_ARM)
 static inline void *cli_get_page(tmem_cli_mfn_t cmfn, unsigned long *pcli_mfn,
                                  pfp_t **pcli_pfp, bool_t cli_write)
 {

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:34 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQB-0005zX-Lt; Thu, 09 Feb 2012 16:00:31 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQA-0005yG-2Q
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:30 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-174.messagelabs.com!1328803222!12707314!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10791 invoked from network); 9 Feb 2012 16:00:23 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ2-0004Ox-GD
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:22 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ1-00065P-Rs
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:22 +0000
Message-Id: <E1RvWQ1-00065P-Rs@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: compile tmem
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787209 0
# Node ID dcb04595033b020f16a1ed642cfbeb263a85e969
# Parent  fe7338e04b37f467a4a8bb773de5f66fcaa90778
arm: compile tmem

Include few missing header files; introduce defined(CONFIG_ARM) where
required.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r fe7338e04b37 -r dcb04595033b xen/common/tmem.c
--- a/xen/common/tmem.c	Thu Feb 09 11:33:28 2012 +0000
+++ b/xen/common/tmem.c	Thu Feb 09 11:33:29 2012 +0000
@@ -22,6 +22,7 @@
 #include <xen/rbtree.h>
 #include <xen/radix-tree.h>
 #include <xen/list.h>
+#include <xen/init.h>
 
 #define EXPORT /* indicates code other modules are dependent upon */
 #define FORWARD
@@ -49,7 +50,7 @@
 #define INVERT_SENTINEL(_x,_y) _x->sentinel = ~_y##_SENTINEL
 #define ASSERT_SENTINEL(_x,_y) \
     ASSERT(_x->sentinel != ~_y##_SENTINEL);ASSERT(_x->sentinel == _y##_SENTINEL)
-#ifdef __i386__
+#if defined(__i386__) || defined(CONFIG_ARM)
 #define POOL_SENTINEL 0x87658765
 #define OBJ_SENTINEL 0x12345678
 #define OBJNODE_SENTINEL 0xfedcba09
diff -r fe7338e04b37 -r dcb04595033b xen/common/tmem_xen.c
--- a/xen/common/tmem_xen.c	Thu Feb 09 11:33:28 2012 +0000
+++ b/xen/common/tmem_xen.c	Thu Feb 09 11:33:29 2012 +0000
@@ -12,6 +12,8 @@
 #include <xen/paging.h>
 #include <xen/domain_page.h>
 #include <xen/cpu.h>
+#include <xen/init.h>
+#include <asm/p2m.h>
 
 #define EXPORT /* indicates code other modules are dependent upon */
 
@@ -87,7 +89,7 @@
 #endif
 }
 
-#ifdef __ia64__
+#if defined(__ia64__) || defined (CONFIG_ARM)
 static inline void *cli_get_page(tmem_cli_mfn_t cmfn, unsigned long *pcli_mfn,
                                  pfp_t **pcli_pfp, bool_t cli_write)
 {

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:38 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQF-00060o-Oq; Thu, 09 Feb 2012 16:00:35 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQD-0005zp-Eu
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:34 +0000
Received: from [85.158.143.35:34387] by server-2.bemta-4.messagelabs.com id
	A8/BF-02822-0ADE33F4; Thu, 09 Feb 2012 16:00:32 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1328803224!2167490!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27180 invoked from network); 9 Feb 2012 16:00:28 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:28 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ4-0004P0-D8
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:24 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ3-00065w-6v
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:23 +0000
Message-Id: <E1RvWQ3-00065w-6v@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:22 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: header files
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787209 0
# Node ID 46adf08254f9d88ffd3deba833ee89aa977fcb6b
# Parent  dcb04595033b020f16a1ed642cfbeb263a85e969
arm: header files

A simple implementation of everything under asm-arm and arch-arm.h; some
of these files are shamelessly taken from Linux.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/atomic.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/atomic.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,236 @@
+/*
+ *  arch/arm/include/asm/atomic.h
+ *
+ *  Copyright (C) 1996 Russell King.
+ *  Copyright (C) 2002 Deep Blue Solutions Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __ARCH_ARM_ATOMIC__
+#define __ARCH_ARM_ATOMIC__
+
+#include <xen/config.h>
+#include <asm/system.h>
+
+#define build_atomic_read(name, size, type, reg)   \
+static inline type name(const volatile type *addr) \
+{                                                  \
+    type ret;                                      \
+    asm volatile("ldr" size " %0,%1"               \
+                 : reg (ret)                       \
+                 : "m" (*(volatile type *)addr));  \
+    return ret;                                    \
+}
+
+#define build_atomic_write(name, size, type, reg)      \
+static inline void name(volatile type *addr, type val) \
+{                                                      \
+    asm volatile("str" size " %1,%0"                   \
+                 : "=m" (*(volatile type *)addr)       \
+                 : reg (val));                         \
+}
+
+build_atomic_read(read_u8_atomic, "b", uint8_t, "=q")
+build_atomic_read(read_u16_atomic, "h", uint16_t, "=r")
+build_atomic_read(read_u32_atomic, "", uint32_t, "=r")
+//build_atomic_read(read_u64_atomic, "d", uint64_t, "=r")
+build_atomic_read(read_int_atomic, "", int, "=r")
+
+build_atomic_write(write_u8_atomic, "b", uint8_t, "q")
+build_atomic_write(write_u16_atomic, "h", uint16_t, "r")
+build_atomic_write(write_u32_atomic, "", uint32_t, "r")
+//build_atomic_write(write_u64_atomic, "d", uint64_t, "r")
+build_atomic_write(write_int_atomic, "", int, "r")
+
+void __bad_atomic_size(void);
+
+#define read_atomic(p) ({                                               \
+    typeof(*p) __x;                                                     \
+    switch ( sizeof(*p) ) {                                             \
+    case 1: __x = (typeof(*p))read_u8_atomic((uint8_t *)p); break;      \
+    case 2: __x = (typeof(*p))read_u16_atomic((uint16_t *)p); break;    \
+    case 4: __x = (typeof(*p))read_u32_atomic((uint32_t *)p); break;    \
+    default: __x = 0; __bad_atomic_size(); break;                       \
+    }                                                                   \
+    __x;                                                                \
+})
+
+#define write_atomic(p, x) ({                                           \
+    typeof(*p) __x = (x);                                               \
+    switch ( sizeof(*p) ) {                                             \
+    case 1: write_u8_atomic((uint8_t *)p, (uint8_t)__x); break;         \
+    case 2: write_u16_atomic((uint16_t *)p, (uint16_t)__x); break;      \
+    case 4: write_u32_atomic((uint32_t *)p, (uint32_t)__x); break;      \
+    default: __bad_atomic_size(); break;                                \
+    }                                                                   \
+    __x;                                                                \
+})
+
+/*
+ * NB. I've pushed the volatile qualifier into the operations. This allows
+ * fast accessors such as _atomic_read() and _atomic_set() which don't give
+ * the compiler a fit.
+ */
+typedef struct { int counter; } atomic_t;
+
+#define ATOMIC_INIT(i) { (i) }
+
+/*
+ * On ARM, ordinary assignment (str instruction) doesn't clear the local
+ * strex/ldrex monitor on some implementations. The reason we can use it for
+ * atomic_set() is the clrex or dummy strex done on every exception return.
+ */
+#define _atomic_read(v) ((v).counter)
+#define atomic_read(v)  (*(volatile int *)&(v)->counter)
+
+#define _atomic_set(v,i) (((v).counter) = (i))
+#define atomic_set(v,i) (((v)->counter) = (i))
+
+/*
+ * ARMv6 UP and SMP safe atomic ops.  We use load exclusive and
+ * store exclusive to ensure that these are atomic.  We may loop
+ * to ensure that the update happens.
+ */
+static inline void atomic_add(int i, atomic_t *v)
+{
+        unsigned long tmp;
+        int result;
+
+        __asm__ __volatile__("@ atomic_add\n"
+"1:     ldrex   %0, [%3]\n"
+"       add     %0, %0, %4\n"
+"       strex   %1, %0, [%3]\n"
+"       teq     %1, #0\n"
+"       bne     1b"
+        : "=&r" (result), "=&r" (tmp), "+Qo" (v->counter)
+        : "r" (&v->counter), "Ir" (i)
+        : "cc");
+}
+
+static inline int atomic_add_return(int i, atomic_t *v)
+{
+        unsigned long tmp;
+        int result;
+
+        smp_mb();
+
+        __asm__ __volatile__("@ atomic_add_return\n"
+"1:     ldrex   %0, [%3]\n"
+"       add     %0, %0, %4\n"
+"       strex   %1, %0, [%3]\n"
+"       teq     %1, #0\n"
+"       bne     1b"
+        : "=&r" (result), "=&r" (tmp), "+Qo" (v->counter)
+        : "r" (&v->counter), "Ir" (i)
+        : "cc");
+
+        smp_mb();
+
+        return result;
+}
+
+static inline void atomic_sub(int i, atomic_t *v)
+{
+        unsigned long tmp;
+        int result;
+
+        __asm__ __volatile__("@ atomic_sub\n"
+"1:     ldrex   %0, [%3]\n"
+"       sub     %0, %0, %4\n"
+"       strex   %1, %0, [%3]\n"
+"       teq     %1, #0\n"
+"       bne     1b"
+        : "=&r" (result), "=&r" (tmp), "+Qo" (v->counter)
+        : "r" (&v->counter), "Ir" (i)
+        : "cc");
+}
+
+static inline int atomic_sub_return(int i, atomic_t *v)
+{
+        unsigned long tmp;
+        int result;
+
+        smp_mb();
+
+        __asm__ __volatile__("@ atomic_sub_return\n"
+"1:     ldrex   %0, [%3]\n"
+"       sub     %0, %0, %4\n"
+"       strex   %1, %0, [%3]\n"
+"       teq     %1, #0\n"
+"       bne     1b"
+        : "=&r" (result), "=&r" (tmp), "+Qo" (v->counter)
+        : "r" (&v->counter), "Ir" (i)
+        : "cc");
+
+        smp_mb();
+
+        return result;
+}
+
+static inline int atomic_cmpxchg(atomic_t *ptr, int old, int new)
+{
+        unsigned long oldval, res;
+
+        smp_mb();
+
+        do {
+                __asm__ __volatile__("@ atomic_cmpxchg\n"
+                "ldrex  %1, [%3]\n"
+                "mov    %0, #0\n"
+                "teq    %1, %4\n"
+                "strexeq %0, %5, [%3]\n"
+                    : "=&r" (res), "=&r" (oldval), "+Qo" (ptr->counter)
+                    : "r" (&ptr->counter), "Ir" (old), "r" (new)
+                    : "cc");
+        } while (res);
+
+        smp_mb();
+
+        return oldval;
+}
+
+static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
+{
+        unsigned long tmp, tmp2;
+
+        __asm__ __volatile__("@ atomic_clear_mask\n"
+"1:     ldrex   %0, [%3]\n"
+"       bic     %0, %0, %4\n"
+"       strex   %1, %0, [%3]\n"
+"       teq     %1, #0\n"
+"       bne     1b"
+        : "=&r" (tmp), "=&r" (tmp2), "+Qo" (*addr)
+        : "r" (addr), "Ir" (mask)
+        : "cc");
+}
+
+#define atomic_inc(v)           atomic_add(1, v)
+#define atomic_dec(v)           atomic_sub(1, v)
+
+#define atomic_inc_and_test(v)  (atomic_add_return(1, v) == 0)
+#define atomic_dec_and_test(v)  (atomic_sub_return(1, v) == 0)
+#define atomic_inc_return(v)    (atomic_add_return(1, v))
+#define atomic_dec_return(v)    (atomic_sub_return(1, v))
+#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0)
+
+#define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0)
+
+static inline atomic_t atomic_compareandswap(
+    atomic_t old, atomic_t new, atomic_t *v)
+{
+    atomic_t rc;
+    rc.counter = __cmpxchg(&v->counter, old.counter, new.counter, sizeof(int));
+    return rc;
+}
+
+#endif /* __ARCH_ARM_ATOMIC__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/bitops.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/bitops.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,213 @@
+/*
+ * Copyright 1995, Russell King.
+ * Various bits and pieces copyrights include:
+ *  Linus Torvalds (test_bit).
+ * Big endian support: Copyright 2001, Nicolas Pitre
+ *  reworked by rmk.
+ */
+
+#ifndef _ARM_BITOPS_H
+#define _ARM_BITOPS_H
+
+extern void _set_bit(int nr, volatile void * p);
+extern void _clear_bit(int nr, volatile void * p);
+extern void _change_bit(int nr, volatile void * p);
+extern int _test_and_set_bit(int nr, volatile void * p);
+extern int _test_and_clear_bit(int nr, volatile void * p);
+extern int _test_and_change_bit(int nr, volatile void * p);
+
+#define set_bit(n,p)              _set_bit(n,p)
+#define clear_bit(n,p)            _clear_bit(n,p)
+#define change_bit(n,p)           _change_bit(n,p)
+#define test_and_set_bit(n,p)     _test_and_set_bit(n,p)
+#define test_and_clear_bit(n,p)   _test_and_clear_bit(n,p)
+#define test_and_change_bit(n,p)  _test_and_change_bit(n,p)
+
+#define BIT(nr)                 (1UL << (nr))
+#define BIT_MASK(nr)            (1UL << ((nr) % BITS_PER_LONG))
+#define BIT_WORD(nr)            ((nr) / BITS_PER_LONG)
+#define BITS_PER_BYTE           8
+
+#define ADDR (*(volatile long *) addr)
+#define CONST_ADDR (*(const volatile long *) addr)
+
+/**
+ * __test_and_set_bit - Set a bit and return its old value
+ * @nr: Bit to set
+ * @addr: Address to count from
+ *
+ * This operation is non-atomic and can be reordered.
+ * If two examples of this operation race, one can appear to succeed
+ * but actually fail.  You must protect multiple accesses with a lock.
+ */
+static inline int __test_and_set_bit(int nr, volatile void *addr)
+{
+        unsigned long mask = BIT_MASK(nr);
+        volatile unsigned long *p =
+                ((volatile unsigned long *)addr) + BIT_WORD(nr);
+        unsigned long old = *p;
+
+        *p = old | mask;
+        return (old & mask) != 0;
+}
+
+/**
+ * __test_and_clear_bit - Clear a bit and return its old value
+ * @nr: Bit to clear
+ * @addr: Address to count from
+ *
+ * This operation is non-atomic and can be reordered.
+ * If two examples of this operation race, one can appear to succeed
+ * but actually fail.  You must protect multiple accesses with a lock.
+ */
+static inline int __test_and_clear_bit(int nr, volatile void *addr)
+{
+        unsigned long mask = BIT_MASK(nr);
+        volatile unsigned long *p =
+                ((volatile unsigned long *)addr) + BIT_WORD(nr);
+        unsigned long old = *p;
+
+        *p = old & ~mask;
+        return (old & mask) != 0;
+}
+
+/* WARNING: non atomic and it can be reordered! */
+static inline int __test_and_change_bit(int nr,
+                                            volatile void *addr)
+{
+        unsigned long mask = BIT_MASK(nr);
+        volatile unsigned long *p =
+                ((volatile unsigned long *)addr) + BIT_WORD(nr);
+        unsigned long old = *p;
+
+        *p = old ^ mask;
+        return (old & mask) != 0;
+}
+
+/**
+ * test_bit - Determine whether a bit is set
+ * @nr: bit number to test
+ * @addr: Address to start counting from
+ */
+static inline int test_bit(int nr, const volatile void *addr)
+{
+        const volatile unsigned long *p = (const volatile unsigned long *)addr;
+        return 1UL & (p[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
+}
+
+/*
+ * Little endian assembly bitops.  nr = 0 -> byte 0 bit 0.
+ */
+extern int _find_first_zero_bit_le(const void * p, unsigned size);
+extern int _find_next_zero_bit_le(const void * p, int size, int offset);
+extern int _find_first_bit_le(const unsigned long *p, unsigned size);
+extern int _find_next_bit_le(const unsigned long *p, int size, int offset);
+
+/*
+ * Big endian assembly bitops.  nr = 0 -> byte 3 bit 0.
+ */
+extern int _find_first_zero_bit_be(const void * p, unsigned size);
+extern int _find_next_zero_bit_be(const void * p, int size, int offset);
+extern int _find_first_bit_be(const unsigned long *p, unsigned size);
+extern int _find_next_bit_be(const unsigned long *p, int size, int offset);
+
+#ifndef __ARMEB__
+/*
+ * These are the little endian, atomic definitions.
+ */
+#define find_first_zero_bit(p,sz)      _find_first_zero_bit_le(p,sz)
+#define find_next_zero_bit(p,sz,off)   _find_next_zero_bit_le(p,sz,off)
+#define find_first_bit(p,sz)           _find_first_bit_le(p,sz)
+#define find_next_bit(p,sz,off)                _find_next_bit_le(p,sz,off)
+
+#else
+/*
+ * These are the big endian, atomic definitions.
+ */
+#define find_first_zero_bit(p,sz)      _find_first_zero_bit_be(p,sz)
+#define find_next_zero_bit(p,sz,off)   _find_next_zero_bit_be(p,sz,off)
+#define find_first_bit(p,sz)           _find_first_bit_be(p,sz)
+#define find_next_bit(p,sz,off)                _find_next_bit_be(p,sz,off)
+
+#endif
+
+static inline int constant_fls(int x)
+{
+        int r = 32;
+
+        if (!x)
+                return 0;
+        if (!(x & 0xffff0000u)) {
+                x <<= 16;
+                r -= 16;
+        }
+        if (!(x & 0xff000000u)) {
+                x <<= 8;
+                r -= 8;
+        }
+        if (!(x & 0xf0000000u)) {
+                x <<= 4;
+                r -= 4;
+        }
+        if (!(x & 0xc0000000u)) {
+                x <<= 2;
+                r -= 2;
+        }
+        if (!(x & 0x80000000u)) {
+                x <<= 1;
+                r -= 1;
+        }
+        return r;
+}
+
+/*
+ * On ARMv5 and above those functions can be implemented around
+ * the clz instruction for much better code efficiency.
+ */
+
+static inline int fls(int x)
+{
+        int ret;
+
+        if (__builtin_constant_p(x))
+               return constant_fls(x);
+
+        asm("clz\t%0, %1" : "=r" (ret) : "r" (x));
+        ret = 32 - ret;
+        return ret;
+}
+
+#define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); })
+
+/**
+ * find_first_set_bit - find the first set bit in @word
+ * @word: the word to search
+ *
+ * Returns the bit-number of the first set bit (first bit being 0).
+ * The input must *not* be zero.
+ */
+static inline unsigned int find_first_set_bit(unsigned long word)
+{
+        return ffs(word) - 1;
+}
+
+/**
+ * hweightN - returns the hamming weight of a N-bit word
+ * @x: the word to weigh
+ *
+ * The Hamming Weight of a number is the total number of bits set in it.
+ */
+#define hweight64(x) generic_hweight64(x)
+#define hweight32(x) generic_hweight32(x)
+#define hweight16(x) generic_hweight16(x)
+#define hweight8(x) generic_hweight8(x)
+
+#endif /* _ARM_BITOPS_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/bug.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/bug.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,15 @@
+#ifndef __ARM_BUG_H__
+#define __ARM_BUG_H__
+
+#define BUG() __bug(__FILE__, __LINE__)
+#define WARN() __warn(__FILE__, __LINE__)
+
+#endif /* __X86_BUG_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/byteorder.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/byteorder.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,16 @@
+#ifndef __ASM_ARM_BYTEORDER_H__
+#define __ASM_ARM_BYTEORDER_H__
+
+#define __BYTEORDER_HAS_U64__
+
+#include <xen/byteorder/little_endian.h>
+
+#endif /* __ASM_ARM_BYTEORDER_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/cache.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/cache.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,20 @@
+#ifndef __ARCH_ARM_CACHE_H
+#define __ARCH_ARM_CACHE_H
+
+#include <xen/config.h>
+
+/* L1 cache line size */
+#define L1_CACHE_SHIFT  (CONFIG_ARM_L1_CACHE_SHIFT)
+#define L1_CACHE_BYTES  (1 << L1_CACHE_SHIFT)
+
+#define __read_mostly __attribute__((__section__(".data.read_mostly")))
+
+#endif
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/config.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/config.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,122 @@
+/******************************************************************************
+ * config.h
+ *
+ * A Linux-style configuration list.
+ */
+
+#ifndef __ARM_CONFIG_H__
+#define __ARM_CONFIG_H__
+
+#define CONFIG_PAGING_LEVELS 3
+
+#define CONFIG_ARM 1
+
+#define CONFIG_ARM_L1_CACHE_SHIFT 7 /* XXX */
+
+#define CONFIG_SMP 1
+
+#define CONFIG_DOMAIN_PAGE 1
+
+#define OPT_CONSOLE_STR "com1"
+
+#ifdef MAX_PHYS_CPUS
+#define NR_CPUS MAX_PHYS_CPUS
+#else
+#define NR_CPUS 128
+#endif
+
+#define MAX_VIRT_CPUS 128 /* XXX */
+#define MAX_HVM_VCPUS MAX_VIRT_CPUS
+
+#define asmlinkage /* Nothing needed */
+
+/* Linkage for ARM */
+#define __ALIGN .align 2
+#define __ALIGN_STR ".align 2"
+#ifdef __ASSEMBLY__
+#define ALIGN __ALIGN
+#define ALIGN_STR __ALIGN_STR
+#define ENTRY(name)                             \
+  .globl name;                                  \
+  ALIGN;                                        \
+  name:
+#define END(name) \
+  .size name, .-name
+#define ENDPROC(name) \
+  .type name, %function; \
+  END(name)
+#endif
+
+/*
+ * Memory layout:
+ *  0  -   2M   Unmapped
+ *  2M -   4M   Xen text, data, bss
+ *  4M -   6M   Fixmap: special-purpose 4K mapping slots
+ *
+ * 32M - 128M   Frametable: 24 bytes per page for 16GB of RAM
+ *
+ *  1G -   2G   Xenheap: always-mapped memory
+ *  2G -   4G   Domheap: on-demand-mapped
+ */
+
+#define XEN_VIRT_START         0x00200000
+#define FIXMAP_ADDR(n)        (0x00400000 + (n) * PAGE_SIZE)
+#define FRAMETABLE_VIRT_START  0x02000000
+#define XENHEAP_VIRT_START     0x40000000
+#define DOMHEAP_VIRT_START     0x80000000
+
+#define HYPERVISOR_VIRT_START mk_unsigned_long(XEN_VIRT_START)
+
+#define DOMHEAP_ENTRIES        1024  /* 1024 2MB mapping slots */
+
+/* Fixmap slots */
+#define FIXMAP_CONSOLE  0  /* The primary UART */
+#define FIXMAP_PT       1  /* Temporary mappings of pagetable pages */
+#define FIXMAP_MISC     2  /* Ephemeral mappings of hardware */
+#define FIXMAP_GICD     3  /* Interrupt controller: distributor registers */
+#define FIXMAP_GICC1    4  /* Interrupt controller: CPU registers (first page) */
+#define FIXMAP_GICC2    5  /* Interrupt controller: CPU registers (second page) */
+#define FIXMAP_GICH     6  /* Interrupt controller: virtual interface control registers */
+
+#define PAGE_SHIFT              12
+
+#ifndef __ASSEMBLY__
+#define PAGE_SIZE           (1L << PAGE_SHIFT)
+#else
+#define PAGE_SIZE           (1 << PAGE_SHIFT)
+#endif
+#define PAGE_MASK           (~(PAGE_SIZE-1))
+#define PAGE_FLAG_MASK      (~0)
+
+#define STACK_ORDER 3
+#define STACK_SIZE  (PAGE_SIZE << STACK_ORDER)
+
+#ifndef __ASSEMBLY__
+extern unsigned long xen_phys_start;
+extern unsigned long xenheap_phys_end;
+extern unsigned long frametable_virt_end;
+#endif
+
+#define supervisor_mode_kernel (0)
+
+#define watchdog_disable() ((void)0)
+#define watchdog_enable()  ((void)0)
+
+/* Board-specific: base address of PL011 UART */
+#define EARLY_UART_ADDRESS 0x1c090000
+/* Board-specific: base address of GIC + its regs */
+#define GIC_BASE_ADDRESS 0x2c000000
+#define GIC_DR_OFFSET 0x1000
+#define GIC_CR_OFFSET 0x2000
+#define GIC_HR_OFFSET 0x4000 /* Guess work http://lists.infradead.org/pipermail/linux-arm-kernel/2011-September/064219.html */
+#define GIC_VR_OFFSET 0x6000 /* Virtual Machine CPU interface) */
+
+#endif /* __ARM_CONFIG_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/cpregs.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/cpregs.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,207 @@
+#ifndef __ASM_ARM_CPREGS_H
+#define __ASM_ARM_CPREGS_H
+
+#include <xen/stringify.h>
+
+/* Co-processor registers */
+
+/* Layout as used in assembly, with src/dest registers mixed in */
+#define __CP32(r, coproc, opc1, crn, crm, opc2) coproc, opc1, r, crn, crm, opc2
+#define __CP64(r1, r2, coproc, opc, crm) coproc, opc, r1, r2, crm
+#define CP32(r, name...) __CP32(r, name)
+#define CP64(r, name...) __CP64(r, name)
+
+/* Stringified for inline assembly */
+#define LOAD_CP32(r, name...)  "mrc " __stringify(CP32(%r, name)) ";"
+#define STORE_CP32(r, name...) "mcr " __stringify(CP32(%r, name)) ";"
+#define LOAD_CP64(r, name...)  "mrrc " __stringify(CP64(%r, %H##r, name)) ";"
+#define STORE_CP64(r, name...) "mcrr " __stringify(CP64(%r, %H##r, name)) ";"
+
+/* C wrappers */
+#define READ_CP32(name...) ({                                   \
+    register uint32_t _r;                                       \
+    asm volatile(LOAD_CP32(0, name) : "=r" (_r));               \
+    _r; })
+
+#define WRITE_CP32(v, name...) do {                             \
+    register uint32_t _r = (v);                                 \
+    asm volatile(STORE_CP32(0, name) : : "r" (_r));             \
+} while (0)
+
+#define READ_CP64(name...) ({                                   \
+    register uint64_t _r;                                       \
+    asm volatile(LOAD_CP64(0, name) : "=r" (_r));               \
+    _r; })
+
+#define WRITE_CP64(v, name...) do {                             \
+    register uint64_t _r = (v);                                 \
+    asm volatile(STORE_CP64(0, name) : : "r" (_r));             \
+} while (0)
+
+#define __HSR_CPREG_c0  0
+#define __HSR_CPREG_c1  1
+#define __HSR_CPREG_c2  2
+#define __HSR_CPREG_c3  3
+#define __HSR_CPREG_c4  4
+#define __HSR_CPREG_c5  5
+#define __HSR_CPREG_c6  6
+#define __HSR_CPREG_c7  7
+#define __HSR_CPREG_c8  8
+#define __HSR_CPREG_c9  9
+#define __HSR_CPREG_c10 10
+#define __HSR_CPREG_c11 11
+#define __HSR_CPREG_c12 12
+#define __HSR_CPREG_c13 13
+#define __HSR_CPREG_c14 14
+#define __HSR_CPREG_c15 15
+
+#define __HSR_CPREG_0   0
+#define __HSR_CPREG_1   1
+#define __HSR_CPREG_2   2
+#define __HSR_CPREG_3   3
+#define __HSR_CPREG_4   4
+#define __HSR_CPREG_5   5
+#define __HSR_CPREG_6   6
+#define __HSR_CPREG_7   7
+
+#define _HSR_CPREG32(cp,op1,crn,crm,op2) \
+    ((__HSR_CPREG_##crn) << HSR_CP32_CRN_SHIFT) | \
+    ((__HSR_CPREG_##crm) << HSR_CP32_CRM_SHIFT) | \
+    ((__HSR_CPREG_##op1) << HSR_CP32_OP1_SHIFT) | \
+    ((__HSR_CPREG_##op2) << HSR_CP32_OP2_SHIFT)
+
+#define _HSR_CPREG64(cp,op1,crm) \
+    ((__HSR_CPREG_##crm) << HSR_CP64_CRM_SHIFT) | \
+    ((__HSR_CPREG_##op1) << HSR_CP64_OP1_SHIFT)
+
+/* Encode a register as per HSR ISS pattern */
+#define HSR_CPREG32(X) _HSR_CPREG32(X)
+#define HSR_CPREG64(X) _HSR_CPREG64(X)
+
+/*
+ * Order registers by Coprocessor-> CRn-> Opcode 1-> CRm-> Opcode 2
+ *
+ * This matches the ordering used in the ARM as well as the groupings
+ * which the CP registers are allocated in.
+ *
+ * This is slightly different to the form of the instruction
+ * arguments, which are cp,opc1,crn,crm,opc2.
+ */
+
+/* Coprocessor 15 */
+
+/* CP15 CR0: CPUID and Cache Type Registers */
+#define ID_PFR0         p15,0,c0,c1,0   /* Processor Feature Register 0 */
+#define ID_PFR1         p15,0,c0,c1,1   /* Processor Feature Register 1 */
+#define CCSIDR          p15,1,c0,c0,0   /* Cache Size ID Registers */
+#define CLIDR           p15,1,c0,c0,1   /* Cache Level ID Register */
+#define CSSELR          p15,2,c0,c0,0   /* Cache Size Selection Register */
+
+/* CP15 CR1: System Control Registers */
+#define SCTLR           p15,0,c1,c0,0   /* System Control Register */
+#define SCR             p15,0,c1,c1,0   /* Secure Configuration Register */
+#define NSACR           p15,0,c1,c1,2   /* Non-Secure Access Control Register */
+#define HSCTLR          p15,4,c1,c0,0   /* Hyp. System Control Register */
+#define HCR             p15,4,c1,c1,0   /* Hyp. Configuration Register */
+
+/* CP15 CR2: Translation Table Base and Control Registers */
+#define TTBR0           p15,0,c2,c0,0   /* Translation Table Base Reg. 0 */
+#define TTBR1           p15,0,c2,c0,1   /* Translation Table Base Reg. 1 */
+#define TTBCR           p15,0,c2,c0,2   /* Translatation Table Base Control Register */
+#define HTTBR           p15,4,c2        /* Hyp. Translation Table Base Register */
+#define HTCR            p15,4,c2,c0,2   /* Hyp. Translation Control Register */
+#define VTCR            p15,4,c2,c1,2   /* Virtualization Translation Control Register */
+#define VTTBR           p15,6,c2        /* Virtualization Translation Table Base Register */
+
+/* CP15 CR3: Domain Access Control Register */
+
+/* CP15 CR4: */
+
+/* CP15 CR5: Fault Status Registers */
+#define DFSR            p15,0,c5,c0,0   /* Data Fault Status Register */
+#define IFSR            p15,0,c5,c0,1   /* Instruction Fault Status Register */
+#define HSR             p15,4,c5,c2,0   /* Hyp. Syndrome Register */
+
+/* CP15 CR6: Fault Address Registers */
+#define DFAR            p15,0,c6,c0,0   /* Data Fault Address Register  */
+#define IFAR            p15,0,c6,c0,2   /* Instruction Fault Address Register */
+#define HDFAR           p15,4,c6,c0,0   /* Hyp. Data Fault Address Register */
+#define HIFAR           p15,4,c6,c0,2   /* Hyp. Instruction Fault Address Register */
+#define HPFAR           p15,4,c6,c0,4   /* Hyp. IPA Fault Address Register */
+
+/* CP15 CR7: Cache and address translation operations */
+#define PAR             p15,0,c7        /* Physical Address Register */
+#define ICIALLUIS       p15,0,c7,c1,0   /* Invalidate all instruction caches to PoU inner shareable */
+#define BPIALLIS        p15,0,c7,c1,6   /* Invalidate entire branch predictor array inner shareable */
+#define ICIALLU         p15,0,c7,c5,0   /* Invalidate all instruction caches to PoU */
+#define BPIALL          p15,0,c7,c5,6   /* Invalidate entire branch predictor array */
+#define ATS1CPR         p15,0,c7,c8,0   /* Address Translation Stage 1. Non-Secure Kernel Read */
+#define ATS1CPW         p15,0,c7,c8,1   /* Address Translation Stage 1. Non-Secure Kernel Write */
+#define ATS1CUR         p15,0,c7,c8,2   /* Address Translation Stage 1. Non-Secure User Read */
+#define ATS1CUW         p15,0,c7,c8,3   /* Address Translation Stage 1. Non-Secure User Write */
+#define ATS12NSOPR      p15,0,c7,c8,4   /* Address Translation Stage 1+2 Non-Secure Kernel Read */
+#define ATS12NSOPW      p15,0,c7,c8,5   /* Address Translation Stage 1+2 Non-Secure Kernel Write */
+#define ATS12NSOUR      p15,0,c7,c8,6   /* Address Translation Stage 1+2 Non-Secure User Read */
+#define ATS12NSOUW      p15,0,c7,c8,7   /* Address Translation Stage 1+2 Non-Secure User Write */
+#define DCCMVAC         p15,0,c7,c10,1  /* Clean data or unified cache line by MVA to PoC */
+#define DCCISW          p15,0,c7,c14,2  /* Clean and invalidate data cache line by set/way */
+#define ATS1HR          p15,4,c7,c8,0   /* Address Translation Stage 1 Hyp. Read */
+#define ATS1HW          p15,4,c7,c8,1   /* Address Translation Stage 1 Hyp. Write */
+
+/* CP15 CR8: TLB maintenance operations */
+#define TLBIALLIS       p15,0,c8,c3,0   /* Invalidate entire TLB innrer shareable */
+#define TLBIMVAIS       p15,0,c8,c3,1   /* Invalidate unified TLB entry by MVA inner shareable */
+#define TLBIASIDIS      p15,0,c8,c3,2   /* Invalidate unified TLB by ASID match inner shareable */
+#define TLBIMVAAIS      p15,0,c8,c3,3   /* Invalidate unified TLB entry by MVA all ASID inner shareable */
+#define DTLBIALL        p15,0,c8,c6,0   /* Invalidate data TLB */
+#define DTLBIMVA        p15,0,c8,c6,1   /* Invalidate data TLB entry by MVA */
+#define DTLBIASID       p15,0,c8,c6,2   /* Invalidate data TLB by ASID match */
+#define TLBILLHIS       p15,4,c8,c3,0   /* Invalidate Entire Hyp. Unified TLB inner shareable */
+#define TLBIMVAHIS      p15,4,c8,c3,1   /* Invalidate Unified Hyp. TLB by MVA inner shareable */
+#define TLBIALLNSNHIS   p15,4,c8,c7,4   /* Invalidate Entire Non-Secure Non-Hyp. Unified TLB inner shareable */
+#define TLBIALLH        p15,4,c8,c7,0   /* Invalidate Entire Hyp. Unified TLB */
+#define TLBIMVAH        p15,4,c8,c7,1   /* Invalidate Unified Hyp. TLB by MVA */
+#define TLBIALLNSNH     p15,4,c8,c7,4   /* Invalidate Entire Non-Secure Non-Hyp. Unified TLB */
+
+/* CP15 CR9: */
+
+/* CP15 CR10: */
+#define MAIR0           p15,0,c10,c2,0  /* Memory Attribute Indirection Register 0 */
+#define MAIR1           p15,0,c10,c2,1  /* Memory Attribute Indirection Register 1 */
+#define HMAIR0          p15,4,c10,c2,0  /* Hyp. Memory Attribute Indirection Register 0 */
+#define HMAIR1          p15,4,c10,c2,1  /* Hyp. Memory Attribute Indirection Register 1 */
+
+/* CP15 CR11: DMA Operations for TCM Access */
+
+/* CP15 CR12:  */
+#define HVBAR           p15,4,c12,c0,0  /* Hyp. Vector Base Address Register */
+
+/* CP15 CR13:  */
+#define FCSEIDR         p15,0,c13,c0,0  /* FCSE Process ID Register */
+#define CONTEXTIDR      p15,0,c13,c0,1  /* Context ID Register */
+
+/* CP15 CR14:  */
+#define CNTPCT          p15,0,c14       /* Time counter value */
+#define CNTFRQ          p15,0,c14,c0,0  /* Time counter frequency */
+#define CNTKCTL         p15,0,c14,c1,0  /* Time counter kernel control */
+#define CNTP_TVAL       p15,0,c14,c2,0  /* Physical Timer value */
+#define CNTP_CTL        p15,0,c14,c2,1  /* Physical Timer control register */
+#define CNTVCT          p15,1,c14       /* Time counter value + offset */
+#define CNTP_CVAL       p15,2,c14       /* Physical Timer comparator */
+#define CNTVOFF         p15,4,c14       /* Time counter offset */
+#define CNTHCTL         p15,4,c14,c1,0  /* Time counter hyp. control */
+#define CNTHP_TVAL      p15,4,c14,c2,0  /* Hyp. Timer value */
+#define CNTHP_CTL       p15,4,c14,c2,1  /* Hyp. Timer control register */
+#define CNTHP_CVAL      p15,6,c14       /* Hyp. Timer comparator */
+
+/* CP15 CR15: Implementation Defined Registers */
+
+#endif
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/current.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/current.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,60 @@
+#ifndef __ARM_CURRENT_H__
+#define __ARM_CURRENT_H__
+
+#include <xen/config.h>
+#include <xen/percpu.h>
+#include <public/xen.h>
+
+#ifndef __ASSEMBLY__
+
+struct vcpu;
+
+struct cpu_info {
+    struct cpu_user_regs guest_cpu_user_regs;
+    unsigned long elr;
+    unsigned int processor_id;
+    struct vcpu *current_vcpu;
+    unsigned long per_cpu_offset;
+};
+
+static inline struct cpu_info *get_cpu_info(void)
+{
+        register unsigned long sp asm ("sp");
+        return (struct cpu_info *)((sp & ~(STACK_SIZE - 1)) + STACK_SIZE - sizeof(struct cpu_info));
+}
+
+#define get_current()         (get_cpu_info()->current_vcpu)
+#define set_current(vcpu)     (get_cpu_info()->current_vcpu = (vcpu))
+#define current               (get_current())
+
+#define get_processor_id()    (get_cpu_info()->processor_id)
+#define set_processor_id(id)  do {                                      \
+    struct cpu_info *ci__ = get_cpu_info();                             \
+    ci__->per_cpu_offset = __per_cpu_offset[ci__->processor_id = (id)]; \
+} while (0)
+
+#define guest_cpu_user_regs() (&get_cpu_info()->guest_cpu_user_regs)
+
+#define reset_stack_and_jump(__fn)              \
+    __asm__ __volatile__ (                      \
+        "mov sp,%0; b "STR(__fn)      \
+        : : "r" (guest_cpu_user_regs()) : "memory" )
+#endif
+
+
+/*
+ * Which VCPU's state is currently running on each CPU?
+ * This is not necesasrily the same as 'current' as a CPU may be
+ * executing a lazy state switch.
+ */
+DECLARE_PER_CPU(struct vcpu *, curr_vcpu);
+
+#endif /* __ARM_CURRENT_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/debugger.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/debugger.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,15 @@
+#ifndef __ARM_DEBUGGER_H__
+#define __ARM_DEBUGGER_H__
+
+#define debugger_trap_fatal(v, r) ((void) 0)
+#define debugger_trap_immediate() ((void) 0)
+
+#endif /* __ARM_DEBUGGER_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/delay.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/delay.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,15 @@
+#ifndef _ARM_DELAY_H
+#define _ARM_DELAY_H
+
+extern void __udelay(unsigned long usecs);
+#define udelay(n) __udelay(n)
+
+#endif /* defined(_ARM_DELAY_H) */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/desc.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/desc.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,12 @@
+#ifndef __ARCH_DESC_H
+#define __ARCH_DESC_H
+
+#endif /* __ARCH_DESC_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/div64.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/div64.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,235 @@
+/* Taken from Linux arch/arm */
+#ifndef __ASM_ARM_DIV64
+#define __ASM_ARM_DIV64
+
+#include <asm/system.h>
+#include <xen/types.h>
+
+/*
+ * The semantics of do_div() are:
+ *
+ * uint32_t do_div(uint64_t *n, uint32_t base)
+ * {
+ *     uint32_t remainder = *n % base;
+ *     *n = *n / base;
+ *     return remainder;
+ * }
+ *
+ * In other words, a 64-bit dividend with a 32-bit divisor producing
+ * a 64-bit result and a 32-bit remainder.  To accomplish this optimally
+ * we call a special __do_div64 helper with completely non standard
+ * calling convention for arguments and results (beware).
+ */
+
+#ifdef __ARMEB__
+#define __xh "r0"
+#define __xl "r1"
+#else
+#define __xl "r0"
+#define __xh "r1"
+#endif
+
+#define __do_div_asm(n, base)                                  \
+({                                                             \
+       register unsigned int __base      asm("r4") = base;     \
+       register unsigned long long __n   asm("r0") = n;        \
+       register unsigned long long __res asm("r2");            \
+       register unsigned int __rem       asm(__xh);            \
+       asm(    __asmeq("%0", __xh)                             \
+               __asmeq("%1", "r2")                             \
+               __asmeq("%2", "r0")                             \
+               __asmeq("%3", "r4")                             \
+               "bl     __do_div64"                             \
+               : "=r" (__rem), "=r" (__res)                    \
+               : "r" (__n), "r" (__base)                       \
+               : "ip", "lr", "cc");                            \
+       n = __res;                                              \
+       __rem;                                                  \
+})
+
+#if __GNUC__ < 4
+
+/*
+ * gcc versions earlier than 4.0 are simply too problematic for the
+ * optimized implementation below. First there is gcc PR 15089 that
+ * tend to trig on more complex constructs, spurious .global __udivsi3
+ * are inserted even if none of those symbols are referenced in the
+ * generated code, and those gcc versions are not able to do constant
+ * propagation on long long values anyway.
+ */
+#define do_div(n, base) __do_div_asm(n, base)
+
+#elif __GNUC__ >= 4
+
+#include <asm/bug.h>
+
+/*
+ * If the divisor happens to be constant, we determine the appropriate
+ * inverse at compile time to turn the division into a few inline
+ * multiplications instead which is much faster. And yet only if compiling
+ * for ARMv4 or higher (we need umull/umlal) and if the gcc version is
+ * sufficiently recent to perform proper long long constant propagation.
+ * (It is unfortunate that gcc doesn't perform all this internally.)
+ */
+#define do_div(n, base)                                                        \
+({                                                                     \
+       unsigned int __r, __b = (base);                                 \
+       if (!__builtin_constant_p(__b) || __b == 0) {                   \
+               /* non-constant divisor (or zero): slow path */         \
+               __r = __do_div_asm(n, __b);                             \
+       } else if ((__b & (__b - 1)) == 0) {                            \
+               /* Trivial: __b is constant and a power of 2 */         \
+               /* gcc does the right thing with this code.  */         \
+               __r = n;                                                \
+               __r &= (__b - 1);                                       \
+               n /= __b;                                               \
+       } else {                                                        \
+               /* Multiply by inverse of __b: n/b = n*(p/b)/p       */ \
+               /* We rely on the fact that most of this code gets   */ \
+               /* optimized away at compile time due to constant    */ \
+               /* propagation and only a couple inline assembly     */ \
+               /* instructions should remain. Better avoid any      */ \
+               /* code construct that might prevent that.           */ \
+               unsigned long long __res, __x, __t, __m, __n = n;       \
+               unsigned int __c, __p, __z = 0;                         \
+               /* preserve low part of n for reminder computation */   \
+               __r = __n;                                              \
+               /* determine number of bits to represent __b */         \
+               __p = 1 << __div64_fls(__b);                            \
+               /* compute __m = ((__p << 64) + __b - 1) / __b */       \
+               __m = (~0ULL / __b) * __p;                              \
+               __m += (((~0ULL % __b + 1) * __p) + __b - 1) / __b;     \
+               /* compute __res = __m*(~0ULL/__b*__b-1)/(__p << 64) */ \
+               __x = ~0ULL / __b * __b - 1;                            \
+               __res = (__m & 0xffffffff) * (__x & 0xffffffff);        \
+               __res >>= 32;                                           \
+               __res += (__m & 0xffffffff) * (__x >> 32);              \
+               __t = __res;                                            \
+               __res += (__x & 0xffffffff) * (__m >> 32);              \
+               __t = (__res < __t) ? (1ULL << 32) : 0;                 \
+               __res = (__res >> 32) + __t;                            \
+               __res += (__m >> 32) * (__x >> 32);                     \
+               __res /= __p;                                           \
+               /* Now sanitize and optimize what we've got. */         \
+               if (~0ULL % (__b / (__b & -__b)) == 0) {                \
+                       /* those cases can be simplified with: */       \
+                       __n /= (__b & -__b);                            \
+                       __m = ~0ULL / (__b / (__b & -__b));             \
+                       __p = 1;                                        \
+                       __c = 1;                                        \
+               } else if (__res != __x / __b) {                        \
+                       /* We can't get away without a correction    */ \
+                       /* to compensate for bit truncation errors.  */ \
+                       /* To avoid it we'd need an additional bit   */ \
+                       /* to represent __m which would overflow it. */ \
+                       /* Instead we do m=p/b and n/b=(n*m+m)/p.    */ \
+                       __c = 1;                                        \
+                       /* Compute __m = (__p << 64) / __b */           \
+                       __m = (~0ULL / __b) * __p;                      \
+                       __m += ((~0ULL % __b + 1) * __p) / __b;         \
+               } else {                                                \
+                       /* Reduce __m/__p, and try to clear bit 31   */ \
+                       /* of __m when possible otherwise that'll    */ \
+                       /* need extra overflow handling later.       */ \
+                       unsigned int __bits = -(__m & -__m);            \
+                       __bits |= __m >> 32;                            \
+                       __bits = (~__bits) << 1;                        \
+                       /* If __bits == 0 then setting bit 31 is     */ \
+                       /* unavoidable.  Simply apply the maximum    */ \
+                       /* possible reduction in that case.          */ \
+                       /* Otherwise the MSB of __bits indicates the */ \
+                       /* best reduction we should apply.           */ \
+                       if (!__bits) {                                  \
+                               __p /= (__m & -__m);                    \
+                               __m /= (__m & -__m);                    \
+                       } else {                                        \
+                               __p >>= __div64_fls(__bits);            \
+                               __m >>= __div64_fls(__bits);            \
+                       }                                               \
+                       /* No correction needed. */                     \
+                       __c = 0;                                        \
+               }                                                       \
+               /* Now we have a combination of 2 conditions:        */ \
+               /* 1) whether or not we need a correction (__c), and */ \
+               /* 2) whether or not there might be an overflow in   */ \
+               /*    the cross product (__m & ((1<<63) | (1<<31)))  */ \
+               /* Select the best insn combination to perform the   */ \
+               /* actual __m * __n / (__p << 64) operation.         */ \
+               if (!__c) {                                             \
+                       asm (   "umull  %Q0, %R0, %1, %Q2\n\t"          \
+                               "mov    %Q0, #0"                        \
+                               : "=&r" (__res)                         \
+                               : "r" (__m), "r" (__n)                  \
+                               : "cc" );                               \
+               } else if (!(__m & ((1ULL << 63) | (1ULL << 31)))) {    \
+                       __res = __m;                                    \
+                       asm (   "umlal  %Q0, %R0, %Q1, %Q2\n\t"         \
+                               "mov    %Q0, #0"                        \
+                               : "+&r" (__res)                         \
+                               : "r" (__m), "r" (__n)                  \
+                               : "cc" );                               \
+               } else {                                                \
+                       asm (   "umull  %Q0, %R0, %Q1, %Q2\n\t"         \
+                               "cmn    %Q0, %Q1\n\t"                   \
+                               "adcs   %R0, %R0, %R1\n\t"              \
+                               "adc    %Q0, %3, #0"                    \
+                               : "=&r" (__res)                         \
+                               : "r" (__m), "r" (__n), "r" (__z)       \
+                               : "cc" );                               \
+               }                                                       \
+               if (!(__m & ((1ULL << 63) | (1ULL << 31)))) {           \
+                       asm (   "umlal  %R0, %Q0, %R1, %Q2\n\t"         \
+                               "umlal  %R0, %Q0, %Q1, %R2\n\t"         \
+                               "mov    %R0, #0\n\t"                    \
+                               "umlal  %Q0, %R0, %R1, %R2"             \
+                               : "+&r" (__res)                         \
+                               : "r" (__m), "r" (__n)                  \
+                               : "cc" );                               \
+               } else {                                                \
+                       asm (   "umlal  %R0, %Q0, %R2, %Q3\n\t"         \
+                               "umlal  %R0, %1, %Q2, %R3\n\t"          \
+                               "mov    %R0, #0\n\t"                    \
+                               "adds   %Q0, %1, %Q0\n\t"               \
+                               "adc    %R0, %R0, #0\n\t"               \
+                               "umlal  %Q0, %R0, %R2, %R3"             \
+                               : "+&r" (__res), "+&r" (__z)            \
+                               : "r" (__m), "r" (__n)                  \
+                               : "cc" );                               \
+               }                                                       \
+               __res /= __p;                                           \
+               /* The reminder can be computed with 32-bit regs     */ \
+               /* only, and gcc is good at that.                    */ \
+               {                                                       \
+                       unsigned int __res0 = __res;                    \
+                       unsigned int __b0 = __b;                        \
+                       __r -= __res0 * __b0;                           \
+               }                                                       \
+               /* BUG_ON(__r >= __b || __res * __b + __r != n); */     \
+               n = __res;                                              \
+       }                                                               \
+       __r;                                                            \
+})
+
+/* our own fls implementation to make sure constant propagation is fine */
+#define __div64_fls(bits)                                              \
+({                                                                     \
+       unsigned int __left = (bits), __nr = 0;                         \
+       if (__left & 0xffff0000) __nr += 16, __left >>= 16;             \
+       if (__left & 0x0000ff00) __nr +=  8, __left >>=  8;             \
+       if (__left & 0x000000f0) __nr +=  4, __left >>=  4;             \
+       if (__left & 0x0000000c) __nr +=  2, __left >>=  2;             \
+       if (__left & 0x00000002) __nr +=  1;                            \
+       __nr;                                                           \
+})
+
+#endif
+
+#endif
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/elf.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/elf.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,33 @@
+#ifndef __ARM_ELF_H__
+#define __ARM_ELF_H__
+
+typedef struct {
+    unsigned long r0;
+    unsigned long r1;
+    unsigned long r2;
+    unsigned long r3;
+    unsigned long r4;
+    unsigned long r5;
+    unsigned long r6;
+    unsigned long r7;
+    unsigned long r8;
+    unsigned long r9;
+    unsigned long r10;
+    unsigned long r11;
+    unsigned long r12;
+    unsigned long sp;
+    unsigned long lr;
+    unsigned long pc;
+} ELF_Gregset;
+
+#endif /* __ARM_ELF_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/event.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/event.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,41 @@
+#ifndef __ASM_EVENT_H__
+#define __ASM_EVENT_H__
+
+void vcpu_kick(struct vcpu *v);
+void vcpu_mark_events_pending(struct vcpu *v);
+
+static inline int local_events_need_delivery(void)
+{
+    /* TODO
+     * return (vcpu_info(v, evtchn_upcall_pending) &&
+                        !vcpu_info(v, evtchn_upcall_mask)); */
+        return 0;
+}
+
+int local_event_delivery_is_enabled(void);
+
+static inline void local_event_delivery_disable(void)
+{
+    /* TODO current->vcpu_info->evtchn_upcall_mask = 1; */
+}
+
+static inline void local_event_delivery_enable(void)
+{
+    /* TODO current->vcpu_info->evtchn_upcall_mask = 0; */
+}
+
+/* No arch specific virq definition now. Default to global. */
+static inline int arch_virq_is_global(int virq)
+{
+    return 1;
+}
+
+#endif
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/flushtlb.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/flushtlb.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,31 @@
+#ifndef __FLUSHTLB_H__
+#define __FLUSHTLB_H__
+
+#include <xen/cpumask.h>
+
+/*
+ * Filter the given set of CPUs, removing those that definitely flushed their
+ * TLB since @page_timestamp.
+ */
+/* XXX lazy implementation just doesn't clear anything.... */
+#define tlbflush_filter(mask, page_timestamp)                           \
+do {                                                                    \
+} while ( 0 )
+
+#define tlbflush_current_time()                 (0)
+
+/* Flush local TLBs */
+void flush_tlb_local(void);
+
+/* Flush specified CPUs' TLBs */
+void flush_tlb_mask(const cpumask_t *mask);
+
+#endif /* __FLUSHTLB_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/grant_table.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/grant_table.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,35 @@
+#ifndef __ASM_GRANT_TABLE_H__
+#define __ASM_GRANT_TABLE_H__
+
+#include <xen/grant_table.h>
+
+#define INVALID_GFN (-1UL)
+#define INITIAL_NR_GRANT_FRAMES 1
+
+void gnttab_clear_flag(unsigned long nr, uint16_t *addr);
+int create_grant_host_mapping(unsigned long gpaddr,
+        unsigned long mfn, unsigned int flags, unsigned int
+        cache_flags);
+#define gnttab_host_mapping_get_page_type(op, d, rd) (0)
+int replace_grant_host_mapping(unsigned long gpaddr, unsigned long mfn,
+        unsigned long new_gpaddr, unsigned int flags);
+void gnttab_mark_dirty(struct domain *d, unsigned long l);
+#define gnttab_create_status_page(d, t, i) do {} while (0)
+#define gnttab_create_shared_page(d, t, i) do {} while (0)
+#define gnttab_shared_gmfn(d, t, i) (0)
+#define gnttab_status_gmfn(d, t, i) (0)
+#define gnttab_release_host_mappings(domain) 1
+static inline int replace_grant_supported(void)
+{
+    return 1;
+}
+
+#endif /* __ASM_GRANT_TABLE_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/hardirq.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/hardirq.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,28 @@
+#ifndef __ASM_HARDIRQ_H
+#define __ASM_HARDIRQ_H
+
+#include <xen/config.h>
+#include <xen/cache.h>
+#include <xen/smp.h>
+
+typedef struct {
+        unsigned long __softirq_pending;
+        unsigned int __local_irq_count;
+} __cacheline_aligned irq_cpustat_t;
+
+#include <xen/irq_cpustat.h>    /* Standard mappings for irq_cpustat_t above */
+
+#define in_irq() (local_irq_count(smp_processor_id()) != 0)
+
+#define irq_enter()     (local_irq_count(smp_processor_id())++)
+#define irq_exit()      (local_irq_count(smp_processor_id())--)
+
+#endif /* __ASM_HARDIRQ_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/hypercall.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/hypercall.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,14 @@
+#ifndef __ASM_ARM_HYPERCALL_H__
+#define __ASM_ARM_HYPERCALL_H__
+
+#include <public/domctl.h> /* for arch_do_domctl */
+
+#endif /* __ASM_ARM_HYPERCALL_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/init.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/init.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,12 @@
+#ifndef _XEN_ASM_INIT_H
+#define _XEN_ASM_INIT_H
+
+#endif /* _XEN_ASM_INIT_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/io.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/io.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,12 @@
+#ifndef _ASM_IO_H
+#define _ASM_IO_H
+
+#endif
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/iocap.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/iocap.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,20 @@
+#ifndef __X86_IOCAP_H__
+#define __X86_IOCAP_H__
+
+#define cache_flush_permitted(d)                        \
+    (!rangeset_is_empty((d)->iomem_caps))
+
+#define multipage_allocation_permitted(d, order)        \
+    (((order) <= 9) || /* allow 2MB superpages */       \
+     !rangeset_is_empty((d)->iomem_caps))
+
+#endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/multicall.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/multicall.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,23 @@
+#ifndef __ASM_ARM_MULTICALL_H__
+#define __ASM_ARM_MULTICALL_H__
+
+#define do_multicall_call(_call)                             \
+    do {                                                     \
+        __asm__ __volatile__ (                               \
+            ".word 0xe7f000f0@; do_multicall_call\n"         \
+            "    mov r0,#0; @ do_multicall_call\n"           \
+            "    str r0, [r0];\n"                            \
+            :                                                \
+            :                                                \
+            : );                                             \
+    } while ( 0 )
+
+#endif /* __ASM_ARM_MULTICALL_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/nmi.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/nmi.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,15 @@
+#ifndef ASM_NMI_H
+#define ASM_NMI_H
+
+#define register_guest_nmi_callback(a)  (-ENOSYS)
+#define unregister_guest_nmi_callback() (-ENOSYS)
+
+#endif /* ASM_NMI_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/numa.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/numa.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,21 @@
+#ifndef __ARCH_ARM_NUMA_H
+#define __ARCH_ARM_NUMA_H
+
+/* Fake one node for now... */
+#define cpu_to_node(cpu) 0
+#define node_to_cpumask(node)  (cpu_online_map)
+
+static inline __attribute__((pure)) int phys_to_nid(paddr_t addr)
+{
+        return 0;
+}
+
+#endif /* __ARCH_ARM_NUMA_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/paging.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/paging.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,13 @@
+#ifndef _XEN_PAGING_H
+#define _XEN_PAGING_H
+
+#endif /* XEN_PAGING_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/pci.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/pci.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,7 @@
+#ifndef __X86_PCI_H__
+#define __X86_PCI_H__
+
+struct arch_pci_dev {
+};
+
+#endif /* __X86_PCI_H__ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/percpu.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/percpu.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,28 @@
+#ifndef __ARM_PERCPU_H__
+#define __ARM_PERCPU_H__
+
+#ifndef __ASSEMBLY__
+extern char __per_cpu_start[], __per_cpu_data_end[];
+extern unsigned long __per_cpu_offset[NR_CPUS];
+void percpu_init_areas(void);
+#endif
+
+/* Separate out the type, so (int[3], foo) works. */
+#define __DEFINE_PER_CPU(type, name, suffix)                    \
+    __attribute__((__section__(".bss.percpu" #suffix)))         \
+    __typeof__(type) per_cpu_##name
+
+#define per_cpu(var, cpu) ((&per_cpu__##var)[cpu?0:0])
+#define __get_cpu_var(var) per_cpu__##var
+
+#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
+
+#endif /* __ARM_PERCPU_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/processor.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/processor.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,269 @@
+#ifndef __ASM_ARM_PROCESSOR_H
+#define __ASM_ARM_PROCESSOR_H
+
+#include <asm/cpregs.h>
+
+/* PSR bits (CPSR, SPSR)*/
+
+/* 0-4: Mode */
+#define PSR_MODE_MASK 0x1f
+#define PSR_MODE_USR 0x10
+#define PSR_MODE_FIQ 0x11
+#define PSR_MODE_IRQ 0x12
+#define PSR_MODE_SVC 0x13
+#define PSR_MODE_MON 0x16
+#define PSR_MODE_ABT 0x17
+#define PSR_MODE_HYP 0x1a
+#define PSR_MODE_UND 0x1b
+#define PSR_MODE_SYS 0x1f
+
+#define PSR_THUMB        (1<<5)        /* Thumb Mode enable */
+#define PSR_FIQ_MASK        (1<<6)        /* Fast Interrupt mask */
+#define PSR_IRQ_MASK        (1<<7)        /* Interrupt mask */
+#define PSR_ABT_MASK         (1<<8)        /* Asynchronous Abort mask */
+#define PSR_BIG_ENDIAN        (1<<9)        /* Big Endian Mode */
+#define PSR_JAZELLE        (1<<24)        /* Jazelle Mode */
+
+/* TTBCR Translation Table Base Control Register */
+#define TTBCR_N_MASK 0x07
+#define TTBCR_N_16KB 0x00
+#define TTBCR_N_8KB  0x01
+#define TTBCR_N_4KB  0x02
+#define TTBCR_N_2KB  0x03
+#define TTBCR_N_1KB  0x04
+
+/* SCTLR System Control Register. */
+/* HSCTLR is a subset of this. */
+#define SCTLR_TE        (1<<30)
+#define SCTLR_AFE        (1<<29)
+#define SCTLR_TRE        (1<<28)
+#define SCTLR_NMFI        (1<<27)
+#define SCTLR_EE        (1<<25)
+#define SCTLR_VE        (1<<24)
+#define SCTLR_U                (1<<22)
+#define SCTLR_FI        (1<<21)
+#define SCTLR_WXN        (1<<19)
+#define SCTLR_HA        (1<<17)
+#define SCTLR_RR        (1<<14)
+#define SCTLR_V                (1<<13)
+#define SCTLR_I                (1<<12)
+#define SCTLR_Z                (1<<11)
+#define SCTLR_SW        (1<<10)
+#define SCTLR_B                (1<<7)
+#define SCTLR_C                (1<<2)
+#define SCTLR_A                (1<<1)
+#define SCTLR_M                (1<<0)
+
+#define SCTLR_BASE        0x00c50078
+#define HSCTLR_BASE        0x30c51878
+
+/* HCR Hyp Configuration Register */
+#define HCR_TGE                (1<<27)
+#define HCR_TVM                (1<<26)
+#define HCR_TTLB        (1<<25)
+#define HCR_TPU                (1<<24)
+#define HCR_TPC                (1<<23)
+#define HCR_TSW                (1<<22)
+#define HCR_TAC                (1<<21)
+#define HCR_TIDCP        (1<<20)
+#define HCR_TSC                (1<<19)
+#define HCR_TID3        (1<<18)
+#define HCR_TID2        (1<<17)
+#define HCR_TID1        (1<<16)
+#define HCR_TID0        (1<<15)
+#define HCR_TWE                (1<<14)
+#define HCR_TWI                (1<<13)
+#define HCR_DC                (1<<12)
+#define HCR_BSU_MASK        (3<<10)
+#define HCR_FB                (1<<9)
+#define HCR_VA                (1<<8)
+#define HCR_VI                (1<<7)
+#define HCR_VF                (1<<6)
+#define HCR_AMO                (1<<5)
+#define HCR_IMO                (1<<4)
+#define HCR_FMO                (1<<3)
+#define HCR_PTW                (1<<2)
+#define HCR_SWIO        (1<<1)
+#define HCR_VM                (1<<0)
+
+#define HSR_EC_WFI_WFE              0x01
+#define HSR_EC_CP15_32              0x03
+#define HSR_EC_CP15_64              0x04
+#define HSR_EC_CP14_32              0x05
+#define HSR_EC_CP14_DBG             0x06
+#define HSR_EC_CP                   0x07
+#define HSR_EC_CP10                 0x08
+#define HSR_EC_JAZELLE              0x09
+#define HSR_EC_BXJ                  0x0a
+#define HSR_EC_CP14_64              0x0c
+#define HSR_EC_SVC                  0x11
+#define HSR_EC_HVC                  0x12
+#define HSR_EC_INSTR_ABORT_GUEST    0x20
+#define HSR_EC_INSTR_ABORT_HYP      0x21
+#define HSR_EC_DATA_ABORT_GUEST     0x24
+#define HSR_EC_DATA_ABORT_HYP       0x25
+
+#ifndef __ASSEMBLY__
+union hsr {
+    uint32_t bits;
+    struct {
+        unsigned long iss:25;  /* Instruction Specific Syndrome */
+        unsigned long len:1;   /* Instruction length */
+        unsigned long ec:6;    /* Exception Class */
+    };
+
+    struct hsr_cp32 {
+        unsigned long read:1;  /* Direction */
+        unsigned long crm:4;   /* CRm */
+        unsigned long reg:4;   /* Rt */
+        unsigned long sbzp:1;
+        unsigned long crn:4;   /* CRn */
+        unsigned long op1:3;   /* Op1 */
+        unsigned long op2:3;   /* Op2 */
+        unsigned long cc:4;    /* Condition Code */
+        unsigned long ccvalid:1;/* CC Valid */
+        unsigned long len:1;   /* Instruction length */
+        unsigned long ec:6;    /* Exception Class */
+    } cp32; /* HSR_EC_CP15_32, CP14_32, CP10 */
+
+    struct hsr_cp64 {
+        unsigned long read:1;   /* Direction */
+        unsigned long crm:4;    /* CRm */
+        unsigned long reg1:4;   /* Rt1 */
+        unsigned long sbzp1:1;
+        unsigned long reg2:4;   /* Rt2 */
+        unsigned long sbzp2:2;
+        unsigned long op1:4;   /* Op1 */
+        unsigned long cc:4;    /* Condition Code */
+        unsigned long ccvalid:1;/* CC Valid */
+        unsigned long len:1;   /* Instruction length */
+        unsigned long ec:6;    /* Exception Class */
+    } cp64; /* HSR_EC_CP15_64, HSR_EC_CP14_64 */
+
+    struct hsr_dabt {
+        unsigned long dfsc:6;  /* Data Fault Status Code */
+        unsigned long write:1; /* Write / not Read */
+        unsigned long s1ptw:1; /* */
+        unsigned long cache:1; /* Cache Maintenance */
+        unsigned long eat:1;   /* External Abort Type */
+        unsigned long sbzp0:6;
+        unsigned long reg:4;   /* Register */
+        unsigned long sbzp1:1;
+        unsigned long sign:1;  /* Sign extend */
+        unsigned long size:2;  /* Access Size */
+        unsigned long valid:1; /* Syndrome Valid */
+        unsigned long len:1;   /* Instruction length */
+        unsigned long ec:6;    /* Exception Class */
+    } dabt; /* HSR_EC_DATA_ABORT_* */
+};
+#endif
+
+/* HSR.EC == HSR_CP{15,14,10}_32 */
+#define HSR_CP32_OP2_MASK (0x000e0000)
+#define HSR_CP32_OP2_SHIFT (17)
+#define HSR_CP32_OP1_MASK (0x0001c000)
+#define HSR_CP32_OP1_SHIFT (14)
+#define HSR_CP32_CRN_MASK (0x00003c00)
+#define HSR_CP32_CRN_SHIFT (10)
+#define HSR_CP32_CRM_MASK (0x0000001e)
+#define HSR_CP32_CRM_SHIFT (1)
+#define HSR_CP32_REGS_MASK (HSR_CP32_OP1_MASK|HSR_CP32_OP2_MASK|\
+                            HSR_CP32_CRN_MASK|HSR_CP32_CRM_MASK)
+
+/* HSR.EC == HSR_CP{15,14}_64 */
+#define HSR_CP64_OP1_MASK (0x000f0000)
+#define HSR_CP64_OP1_SHIFT (16)
+#define HSR_CP64_CRM_MASK (0x0000001e)
+#define HSR_CP64_CRM_SHIFT (1)
+#define HSR_CP64_REGS_MASK (HSR_CP64_OP1_MASK|HSR_CP64_CRM_MASK)
+
+/* Physical Address Register */
+#define PAR_F           (1<<0)
+
+/* .... If F == 1 */
+#define PAR_FSC_SHIFT   (1)
+#define PAR_FSC_MASK    (0x3f<<PAR_FSC_SHIFT)
+#define PAR_STAGE21     (1<<8)     /* Stage 2 Fault During Stage 1 Walk */
+#define PAR_STAGE2      (1<<9)     /* Stage 2 Fault */
+
+/* If F == 0 */
+#define PAR_MAIR_SHIFT  56                       /* Memory Attributes */
+#define PAR_MAIR_MASK   (0xffLL<<PAR_MAIR_SHIFT)
+#define PAR_NS          (1<<9)                   /* Non-Secure */
+#define PAR_SH_SHIFT    7                        /* Shareability */
+#define PAR_SH_MASK     (3<<PAR_SH_SHIFT)
+
+/* Fault Status Register */
+/*
+ * 543210 BIT
+ * 00XXLL -- XX Fault Level LL
+ * ..01LL -- Translation Fault LL
+ * ..10LL -- Access Fault LL
+ * ..11LL -- Permission Fault LL
+ * 01xxxx -- Abort/Parity
+ * 10xxxx -- Other
+ * 11xxxx -- Implementation Defined
+ */
+#define FSC_TYPE_MASK (0x3<<4)
+#define FSC_TYPE_FAULT (0x00<<4)
+#define FSC_TYPE_ABT   (0x01<<4)
+#define FSC_TYPE_OTH   (0x02<<4)
+#define FSC_TYPE_IMPL  (0x03<<4)
+
+#define FSC_FLT_TRANS  (0x04)
+#define FSC_FLT_ACCESS (0x08)
+#define FSC_FLT_PERM   (0x0c)
+#define FSC_SEA        (0x10) /* Synchronous External Abort */
+#define FSC_SPE        (0x18) /* Memory Access Synchronous Parity Error */
+#define FSC_APE        (0x11) /* Memory Access Asynchronous Parity Error */
+#define FSC_SEATT      (0x14) /* Sync. Ext. Abort Translation Table */
+#define FSC_SPETT      (0x1c) /* Sync. Parity. Error Translation Table */
+#define FSC_AF         (0x21) /* Alignment Fault */
+#define FSC_DE         (0x22) /* Debug Event */
+#define FSC_LKD        (0x34) /* Lockdown Abort */
+#define FSC_CPR        (0x3a) /* Coprocossor Abort */
+
+#define FSC_LL_MASK    (0x03<<0)
+
+/* Time counter hypervisor control register */
+#define CNTHCTL_PA      (1u<<0)  /* Kernel/user access to physical counter */
+#define CNTHCTL_TA      (1u<<1)  /* Kernel/user access to CNTP timer */
+
+/* Timer control registers */
+#define CNTx_CTL_ENABLE   (1u<<0)  /* Enable timer */
+#define CNTx_CTL_MASK     (1u<<1)  /* Mask IRQ */
+#define CNTx_CTL_PENDING  (1u<<2)  /* IRQ pending */
+
+/* CPUID bits */
+#define ID_PFR1_GT_MASK  0x000F0000  /* Generic Timer interface support */
+#define ID_PFR1_GT_v1    0x00010000
+
+#define MSR(reg,val)        asm volatile ("msr "#reg", %0\n" : : "r" (val))
+#define MRS(val,reg)        asm volatile ("mrs %0,"#reg"\n" : "=r" (v))
+
+#ifndef __ASSEMBLY__
+extern uint32_t hyp_traps_vector[8];
+
+void panic_PAR(uint64_t par, const char *when);
+
+void show_execution_state(struct cpu_user_regs *regs);
+void show_registers(struct cpu_user_regs *regs);
+//#define dump_execution_state() run_in_exception_handler(show_execution_state)
+#define dump_execution_state() asm volatile (".word 0xe7f000f0\n"); /* XXX */
+
+#define cpu_relax() barrier() /* Could yield? */
+
+/* All a bit UP for the moment */
+#define cpu_to_core(_cpu)   (0)
+#define cpu_to_socket(_cpu) (0)
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ASM_ARM_PROCESSOR_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/regs.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/regs.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,43 @@
+#ifndef __ARM_REGS_H__
+#define __ARM_REGS_H__
+
+#include <xen/types.h>
+#include <public/xen.h>
+#include <asm/processor.h>
+
+#define psr_mode(psr,m) (((psr) & PSR_MODE_MASK) == m)
+
+#define usr_mode(r)     psr_mode((r)->cpsr,PSR_MODE_USR)
+#define fiq_mode(r)     psr_mode((r)->cpsr,PSR_MODE_FIQ)
+#define irq_mode(r)     psr_mode((r)->cpsr,PSR_MODE_IRQ)
+#define svc_mode(r)     psr_mode((r)->cpsr,PSR_MODE_SVC)
+#define mon_mode(r)     psr_mode((r)->cpsr,PSR_MODE_MON)
+#define abt_mode(r)     psr_mode((r)->cpsr,PSR_MODE_ABT)
+#define hyp_mode(r)     psr_mode((r)->cpsr,PSR_MODE_HYP)
+#define und_mode(r)     psr_mode((r)->cpsr,PSR_MODE_UND)
+#define sys_mode(r)     psr_mode((r)->cpsr,PSR_MODE_SYS)
+
+#define guest_mode(r)                                                         \
+({                                                                            \
+    unsigned long diff = (char *)guest_cpu_user_regs() - (char *)(r);         \
+    /* Frame pointer must point into current CPU stack. */                    \
+    ASSERT(diff < STACK_SIZE);                                                \
+    /* If not a guest frame, it must be a hypervisor frame. */                \
+    ASSERT((diff == 0) || hyp_mode(r));                                       \
+    /* Return TRUE if it's a guest frame. */                                  \
+    (diff == 0);                                                              \
+})
+
+#define return_reg(v) ((v)->arch.user_regs.r0)
+
+#define CTXT_SWITCH_STACK_BYTES (sizeof(struct cpu_user_regs))
+
+#endif /* __ARM_REGS_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/setup.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/setup.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,16 @@
+#ifndef __ARM_SETUP_H_
+#define __ARM_SETUP_H_
+
+#include <public/version.h>
+
+void arch_get_xen_caps(xen_capabilities_info_t *info);
+
+#endif
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/smp.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/smp.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,25 @@
+#ifndef __ASM_SMP_H
+#define __ASM_SMP_H
+
+#ifndef __ASSEMBLY__
+#include <xen/config.h>
+#include <xen/cpumask.h>
+#include <asm/current.h>
+#endif
+
+DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_mask);
+DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
+
+#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
+
+#define raw_smp_processor_id() (get_processor_id())
+
+#endif
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/softirq.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/softirq.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,15 @@
+#ifndef __ASM_SOFTIRQ_H__
+#define __ASM_SOFTIRQ_H__
+
+#define VGIC_SOFTIRQ        (NR_COMMON_SOFTIRQS + 0)
+#define NR_ARCH_SOFTIRQS       1
+
+#endif /* __ASM_SOFTIRQ_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/spinlock.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/spinlock.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,144 @@
+#ifndef __ASM_SPINLOCK_H
+#define __ASM_SPINLOCK_H
+
+#include <xen/config.h>
+#include <xen/lib.h>
+
+static inline void dsb_sev(void)
+{
+    __asm__ __volatile__ (
+        "dsb\n"
+        "sev\n"
+        );
+}
+
+typedef struct {
+    volatile unsigned int lock;
+} raw_spinlock_t;
+
+#define _RAW_SPIN_LOCK_UNLOCKED { 0 }
+
+#define _raw_spin_is_locked(x)          ((x)->lock != 0)
+
+static always_inline void _raw_spin_unlock(raw_spinlock_t *lock)
+{
+    ASSERT(_raw_spin_is_locked(lock));
+
+    smp_mb();
+
+    __asm__ __volatile__(
+"   str     %1, [%0]\n"
+    :
+    : "r" (&lock->lock), "r" (0)
+    : "cc");
+
+    dsb_sev();
+}
+
+static always_inline int _raw_spin_trylock(raw_spinlock_t *lock)
+{
+    unsigned long tmp;
+
+    __asm__ __volatile__(
+"   ldrex   %0, [%1]\n"
+"   teq     %0, #0\n"
+"   strexeq %0, %2, [%1]"
+    : "=&r" (tmp)
+    : "r" (&lock->lock), "r" (1)
+    : "cc");
+
+    if (tmp == 0) {
+        smp_mb();
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+typedef struct {
+    volatile unsigned int lock;
+} raw_rwlock_t;
+
+#define _RAW_RW_LOCK_UNLOCKED { 0 }
+
+static always_inline int _raw_read_trylock(raw_rwlock_t *rw)
+{
+    unsigned long tmp, tmp2 = 1;
+
+    __asm__ __volatile__(
+"1: ldrex   %0, [%2]\n"
+"   adds    %0, %0, #1\n"
+"   strexpl %1, %0, [%2]\n"
+    : "=&r" (tmp), "+r" (tmp2)
+    : "r" (&rw->lock)
+    : "cc");
+
+    smp_mb();
+    return tmp2 == 0;
+}
+
+static always_inline int _raw_write_trylock(raw_rwlock_t *rw)
+{
+    unsigned long tmp;
+
+    __asm__ __volatile__(
+"1: ldrex   %0, [%1]\n"
+"   teq     %0, #0\n"
+"   strexeq %0, %2, [%1]"
+    : "=&r" (tmp)
+    : "r" (&rw->lock), "r" (0x80000000)
+    : "cc");
+
+    if (tmp == 0) {
+        smp_mb();
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+static inline void _raw_read_unlock(raw_rwlock_t *rw)
+{
+    unsigned long tmp, tmp2;
+
+    smp_mb();
+
+    __asm__ __volatile__(
+"1: ldrex   %0, [%2]\n"
+"   sub     %0, %0, #1\n"
+"   strex   %1, %0, [%2]\n"
+"   teq     %1, #0\n"
+"   bne     1b"
+    : "=&r" (tmp), "=&r" (tmp2)
+    : "r" (&rw->lock)
+    : "cc");
+
+    if (tmp == 0)
+        dsb_sev();
+}
+
+static inline void _raw_write_unlock(raw_rwlock_t *rw)
+{
+    smp_mb();
+
+    __asm__ __volatile__(
+    "str    %1, [%0]\n"
+    :
+    : "r" (&rw->lock), "r" (0)
+    : "cc");
+
+    dsb_sev();
+}
+
+#define _raw_rw_is_locked(x) ((x)->lock != 0)
+#define _raw_rw_is_write_locked(x) ((x)->lock == 0x80000000)
+
+#endif /* __ASM_SPINLOCK_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/string.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/string.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,38 @@
+#ifndef __ARM_STRING_H__
+#define __ARM_STRING_H__
+
+#include <xen/config.h>
+
+#define __HAVE_ARCH_MEMCPY
+extern void * memcpy(void *, const void *, __kernel_size_t);
+
+/* Some versions of gcc don't have this builtin. It's non-critical anyway. */
+#define __HAVE_ARCH_MEMMOVE
+extern void *memmove(void *dest, const void *src, size_t n);
+
+#define __HAVE_ARCH_MEMSET
+extern void * memset(void *, int, __kernel_size_t);
+
+extern void __memzero(void *ptr, __kernel_size_t n);
+
+#define memset(p,v,n)                                                   \
+        ({                                                              \
+                void *__p = (p); size_t __n = n;                        \
+                if ((__n) != 0) {                                       \
+                        if (__builtin_constant_p((v)) && (v) == 0)      \
+                                __memzero((__p),(__n));                 \
+                        else                                            \
+                                memset((__p),(v),(__n));                \
+                }                                                       \
+                (__p);                                                  \
+        })
+
+#endif /* __ARM_STRING_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/system.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/system.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,202 @@
+/* Portions taken from Linux arch arm */
+#ifndef __ASM_SYSTEM_H
+#define __ASM_SYSTEM_H
+
+#include <xen/lib.h>
+#include <asm/processor.h>
+
+#define nop() \
+    asm volatile ( "nop" )
+
+#define xchg(ptr,x) \
+        ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
+
+#define isb() __asm__ __volatile__ ("isb" : : : "memory")
+#define dsb() __asm__ __volatile__ ("dsb" : : : "memory")
+#define dmb() __asm__ __volatile__ ("dmb" : : : "memory")
+
+#define mb()            dsb()
+#define rmb()           dsb()
+#define wmb()           mb()
+
+#define smp_mb()        dmb()
+#define smp_rmb()       dmb()
+#define smp_wmb()       dmb()
+
+/*
+ * This is used to ensure the compiler did actually allocate the register we
+ * asked it for some inline assembly sequences.  Apparently we can't trust
+ * the compiler from one version to another so a bit of paranoia won't hurt.
+ * This string is meant to be concatenated with the inline asm string and
+ * will cause compilation to stop on mismatch.
+ * (for details, see gcc PR 15089)
+ */
+#define __asmeq(x, y)  ".ifnc " x "," y " ; .err ; .endif\n\t"
+
+extern void __bad_xchg(volatile void *, int);
+
+static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
+{
+        unsigned long ret;
+        unsigned int tmp;
+
+        smp_mb();
+
+        switch (size) {
+        case 1:
+                asm volatile("@ __xchg1\n"
+                "1:     ldrexb  %0, [%3]\n"
+                "       strexb  %1, %2, [%3]\n"
+                "       teq     %1, #0\n"
+                "       bne     1b"
+                        : "=&r" (ret), "=&r" (tmp)
+                        : "r" (x), "r" (ptr)
+                        : "memory", "cc");
+                break;
+        case 4:
+                asm volatile("@ __xchg4\n"
+                "1:     ldrex   %0, [%3]\n"
+                "       strex   %1, %2, [%3]\n"
+                "       teq     %1, #0\n"
+                "       bne     1b"
+                        : "=&r" (ret), "=&r" (tmp)
+                        : "r" (x), "r" (ptr)
+                        : "memory", "cc");
+                break;
+        default:
+                __bad_xchg(ptr, size), ret = 0;
+                break;
+        }
+        smp_mb();
+
+        return ret;
+}
+
+/*
+ * Atomic compare and exchange.  Compare OLD with MEM, if identical,
+ * store NEW in MEM.  Return the initial value in MEM.  Success is
+ * indicated by comparing RETURN with OLD.
+ */
+
+extern void __bad_cmpxchg(volatile void *ptr, int size);
+
+static always_inline unsigned long __cmpxchg(
+    volatile void *ptr, unsigned long old, unsigned long new, int size)
+{
+    unsigned long /*long*/ oldval, res;
+
+    switch (size) {
+    case 1:
+        do {
+            asm volatile("@ __cmpxchg1\n"
+                         "       ldrexb  %1, [%2]\n"
+                         "       mov     %0, #0\n"
+                         "       teq     %1, %3\n"
+                         "       strexbeq %0, %4, [%2]\n"
+                         : "=&r" (res), "=&r" (oldval)
+                         : "r" (ptr), "Ir" (old), "r" (new)
+                         : "memory", "cc");
+        } while (res);
+        break;
+    case 2:
+        do {
+            asm volatile("@ __cmpxchg2\n"
+                         "       ldrexh  %1, [%2]\n"
+                         "       mov     %0, #0\n"
+                         "       teq     %1, %3\n"
+                         "       strexheq %0, %4, [%2]\n"
+                         : "=&r" (res), "=&r" (oldval)
+                         : "r" (ptr), "Ir" (old), "r" (new)
+                         : "memory", "cc");
+        } while (res);
+        break;
+    case 4:
+        do {
+            asm volatile("@ __cmpxchg4\n"
+                         "       ldrex   %1, [%2]\n"
+                         "       mov     %0, #0\n"
+                         "       teq     %1, %3\n"
+                         "       strexeq %0, %4, [%2]\n"
+                         : "=&r" (res), "=&r" (oldval)
+                         : "r" (ptr), "Ir" (old), "r" (new)
+                         : "memory", "cc");
+        } while (res);
+        break;
+#if 0
+    case 8:
+        do {
+            asm volatile("@ __cmpxchg8\n"
+                         "       ldrexd   %1, [%2]\n"
+                         "       mov      %0, #0\n"
+                         "       teq      %1, %3\n"
+                         "       strexdeq %0, %4, [%2]\n"
+                         : "=&r" (res), "=&r" (oldval)
+                         : "r" (ptr), "Ir" (old), "r" (new)
+                         : "memory", "cc");
+        } while (res);
+        break;
+#endif
+    default:
+        __bad_cmpxchg(ptr, size);
+        oldval = 0;
+    }
+
+    return oldval;
+}
+#define cmpxchg(ptr,o,n)                                                \
+    ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),            \
+                                   (unsigned long)(n),sizeof(*(ptr))))
+
+#define local_irq_disable() asm volatile ( "cpsid i @ local_irq_disable\n" : : : "cc" )
+#define local_irq_enable()  asm volatile ( "cpsie i @ local_irq_enable\n" : : : "cc" )
+
+#define local_save_flags(x)                                      \
+({                                                               \
+    BUILD_BUG_ON(sizeof(x) != sizeof(long));                     \
+    asm volatile ( "mrs %0, cpsr     @ local_save_flags\n"       \
+                  : "=r" (x) :: "memory", "cc" );                \
+})
+#define local_irq_save(x)                                        \
+({                                                               \
+    local_save_flags(x);                                         \
+    local_irq_disable();                                         \
+})
+#define local_irq_restore(x)                                     \
+({                                                               \
+    BUILD_BUG_ON(sizeof(x) != sizeof(long));                     \
+    asm volatile (                                               \
+            "msr     cpsr_c, %0      @ local_irq_restore\n"      \
+            :                                                    \
+            : "r" (flags)                                        \
+            : "memory", "cc");                                   \
+})
+
+static inline int local_irq_is_enabled(void)
+{
+    unsigned long flags;
+    local_save_flags(flags);
+    return !(flags & PSR_IRQ_MASK);
+}
+
+#define local_fiq_enable()  __asm__("cpsie f   @ __stf\n" : : : "memory", "cc")
+#define local_fiq_disable() __asm__("cpsid f   @ __clf\n" : : : "memory", "cc")
+
+#define local_abort_enable() __asm__("cpsie a  @ __sta\n" : : : "memory", "cc")
+#define local_abort_disable() __asm__("cpsid a @ __sta\n" : : : "memory", "cc")
+
+static inline int local_fiq_is_enabled(void)
+{
+    unsigned long flags;
+    local_save_flags(flags);
+    return !!(flags & PSR_FIQ_MASK);
+}
+
+#endif
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/trace.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/trace.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,12 @@
+#ifndef __ASM_TRACE_H__
+#define __ASM_TRACE_H__
+
+#endif /* __ASM_TRACE_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/types.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/types.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,57 @@
+#ifndef __ARM_TYPES_H__
+#define __ARM_TYPES_H__
+
+#ifndef __ASSEMBLY__
+
+#include <xen/config.h>
+
+typedef __signed__ char __s8;
+typedef unsigned char __u8;
+
+typedef __signed__ short __s16;
+typedef unsigned short __u16;
+
+typedef __signed__ int __s32;
+typedef unsigned int __u32;
+
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+typedef __signed__ long long __s64;
+typedef unsigned long long __u64;
+#endif
+
+typedef signed char s8;
+typedef unsigned char u8;
+
+typedef signed short s16;
+typedef unsigned short u16;
+
+typedef signed int s32;
+typedef unsigned int u32;
+
+typedef signed long long s64;
+typedef unsigned long long u64;
+typedef u64 paddr_t;
+#define INVALID_PADDR (~0ULL)
+#define PRIpaddr "016llx"
+
+typedef unsigned long size_t;
+
+typedef char bool_t;
+#define test_and_set_bool(b)   xchg(&(b), 1)
+#define test_and_clear_bool(b) xchg(&(b), 0)
+
+#endif /* __ASSEMBLY__ */
+
+#define BITS_PER_LONG 32
+#define BYTES_PER_LONG 4
+#define LONG_BYTEORDER 2
+
+#endif /* __ARM_TYPES_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/xenoprof.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/xenoprof.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,12 @@
+#ifndef __ASM_XENOPROF_H__
+#define __ASM_XENOPROF_H__
+
+#endif /* __ASM_XENOPROF_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/public/arch-arm.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/public/arch-arm.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,125 @@
+/******************************************************************************
+ * arch-arm.h
+ *
+ * Guest OS interface to ARM Xen.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright 2011 (C) Citrix Systems
+ */
+
+#ifndef __XEN_PUBLIC_ARCH_ARM_H__
+#define __XEN_PUBLIC_ARCH_ARM_H__
+
+#ifndef __ASSEMBLY__
+#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
+    typedef struct { type *p; } __guest_handle_ ## name
+
+#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
+    ___DEFINE_XEN_GUEST_HANDLE(name, type);   \
+    ___DEFINE_XEN_GUEST_HANDLE(const_##name, const type)
+#define DEFINE_XEN_GUEST_HANDLE(name)   __DEFINE_XEN_GUEST_HANDLE(name, name)
+#define __XEN_GUEST_HANDLE(name)        __guest_handle_ ## name
+#define XEN_GUEST_HANDLE(name)          __XEN_GUEST_HANDLE(name)
+#define set_xen_guest_handle_raw(hnd, val)  do { (hnd).p = val; } while (0)
+#ifdef __XEN_TOOLS__
+#define get_xen_guest_handle(val, hnd)  do { val = (hnd).p; } while (0)
+#endif
+#define set_xen_guest_handle(hnd, val) set_xen_guest_handle_raw(hnd, val)
+
+struct cpu_user_regs
+{
+    uint32_t r0;
+    uint32_t r1;
+    uint32_t r2;
+    uint32_t r3;
+    uint32_t r4;
+    uint32_t r5;
+    uint32_t r6;
+    uint32_t r7;
+    uint32_t r8;
+    uint32_t r9;
+    uint32_t r10;
+    union {
+        uint32_t r11;
+        uint32_t fp;
+    };
+    uint32_t r12;
+
+    uint32_t sp; /* r13 - SP: Valid for Hyp. frames only, o/w banked (see below) */
+    uint32_t lr; /* r14 - LR: Valid for Hyp. Same physical register as lr_usr. */
+
+    uint32_t pc; /* Return IP */
+    uint32_t cpsr; /* Return mode */
+    uint32_t pad0; /* Doubleword-align the kernel half of the frame */
+
+    /* Outer guest frame only from here on... */
+
+    uint32_t r8_fiq, r9_fiq, r10_fiq, r11_fiq, r12_fiq;
+
+    uint32_t sp_usr, sp_svc, sp_abt, sp_und, sp_irq, sp_fiq;
+    uint32_t lr_usr, lr_svc, lr_abt, lr_und, lr_irq, lr_fiq;
+
+    uint32_t spsr_svc, spsr_abt, spsr_und, spsr_irq, spsr_fiq;
+};
+typedef struct cpu_user_regs cpu_user_regs_t;
+DEFINE_XEN_GUEST_HANDLE(cpu_user_regs_t);
+
+typedef uint64_t xen_pfn_t;
+#define PRI_xen_pfn PRIx64
+
+/* Maximum number of virtual CPUs in legacy multi-processor guests. */
+/* Only one. All other VCPUS must use VCPUOP_register_vcpu_info */
+#define XEN_LEGACY_MAX_VCPUS 1
+
+typedef uint32_t xen_ulong_t;
+
+struct vcpu_guest_context {
+    struct cpu_user_regs user_regs;         /* User-level CPU registers     */
+    union {
+        uint32_t reg[16];
+        struct {
+            uint32_t __pad[12];
+            uint32_t sp; /* r13 */
+            uint32_t lr; /* r14 */
+            uint32_t pc; /* r15 */
+        };
+    };
+};
+typedef struct vcpu_guest_context vcpu_guest_context_t;
+DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
+
+struct arch_vcpu_info { };
+typedef struct arch_vcpu_info arch_vcpu_info_t;
+
+struct arch_shared_info { };
+typedef struct arch_shared_info arch_shared_info_t;
+#endif
+
+#endif /*  __XEN_PUBLIC_ARCH_ARM_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/public/xen.h
--- a/xen/include/public/xen.h	Thu Feb 09 11:33:29 2012 +0000
+++ b/xen/include/public/xen.h	Thu Feb 09 11:33:29 2012 +0000
@@ -33,6 +33,8 @@
 #include "arch-x86/xen.h"
 #elif defined(__ia64__)
 #include "arch-ia64.h"
+#elif defined(__arm__)
+#include "arch-arm.h"
 #else
 #error "Unsupported architecture"
 #endif

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:38 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQF-00060o-Oq; Thu, 09 Feb 2012 16:00:35 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQD-0005zp-Eu
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:34 +0000
Received: from [85.158.143.35:34387] by server-2.bemta-4.messagelabs.com id
	A8/BF-02822-0ADE33F4; Thu, 09 Feb 2012 16:00:32 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1328803224!2167490!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27180 invoked from network); 9 Feb 2012 16:00:28 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:28 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ4-0004P0-D8
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:24 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ3-00065w-6v
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:23 +0000
Message-Id: <E1RvWQ3-00065w-6v@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:22 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: header files
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787209 0
# Node ID 46adf08254f9d88ffd3deba833ee89aa977fcb6b
# Parent  dcb04595033b020f16a1ed642cfbeb263a85e969
arm: header files

A simple implementation of everything under asm-arm and arch-arm.h; some
of these files are shamelessly taken from Linux.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/atomic.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/atomic.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,236 @@
+/*
+ *  arch/arm/include/asm/atomic.h
+ *
+ *  Copyright (C) 1996 Russell King.
+ *  Copyright (C) 2002 Deep Blue Solutions Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __ARCH_ARM_ATOMIC__
+#define __ARCH_ARM_ATOMIC__
+
+#include <xen/config.h>
+#include <asm/system.h>
+
+#define build_atomic_read(name, size, type, reg)   \
+static inline type name(const volatile type *addr) \
+{                                                  \
+    type ret;                                      \
+    asm volatile("ldr" size " %0,%1"               \
+                 : reg (ret)                       \
+                 : "m" (*(volatile type *)addr));  \
+    return ret;                                    \
+}
+
+#define build_atomic_write(name, size, type, reg)      \
+static inline void name(volatile type *addr, type val) \
+{                                                      \
+    asm volatile("str" size " %1,%0"                   \
+                 : "=m" (*(volatile type *)addr)       \
+                 : reg (val));                         \
+}
+
+build_atomic_read(read_u8_atomic, "b", uint8_t, "=q")
+build_atomic_read(read_u16_atomic, "h", uint16_t, "=r")
+build_atomic_read(read_u32_atomic, "", uint32_t, "=r")
+//build_atomic_read(read_u64_atomic, "d", uint64_t, "=r")
+build_atomic_read(read_int_atomic, "", int, "=r")
+
+build_atomic_write(write_u8_atomic, "b", uint8_t, "q")
+build_atomic_write(write_u16_atomic, "h", uint16_t, "r")
+build_atomic_write(write_u32_atomic, "", uint32_t, "r")
+//build_atomic_write(write_u64_atomic, "d", uint64_t, "r")
+build_atomic_write(write_int_atomic, "", int, "r")
+
+void __bad_atomic_size(void);
+
+#define read_atomic(p) ({                                               \
+    typeof(*p) __x;                                                     \
+    switch ( sizeof(*p) ) {                                             \
+    case 1: __x = (typeof(*p))read_u8_atomic((uint8_t *)p); break;      \
+    case 2: __x = (typeof(*p))read_u16_atomic((uint16_t *)p); break;    \
+    case 4: __x = (typeof(*p))read_u32_atomic((uint32_t *)p); break;    \
+    default: __x = 0; __bad_atomic_size(); break;                       \
+    }                                                                   \
+    __x;                                                                \
+})
+
+#define write_atomic(p, x) ({                                           \
+    typeof(*p) __x = (x);                                               \
+    switch ( sizeof(*p) ) {                                             \
+    case 1: write_u8_atomic((uint8_t *)p, (uint8_t)__x); break;         \
+    case 2: write_u16_atomic((uint16_t *)p, (uint16_t)__x); break;      \
+    case 4: write_u32_atomic((uint32_t *)p, (uint32_t)__x); break;      \
+    default: __bad_atomic_size(); break;                                \
+    }                                                                   \
+    __x;                                                                \
+})
+
+/*
+ * NB. I've pushed the volatile qualifier into the operations. This allows
+ * fast accessors such as _atomic_read() and _atomic_set() which don't give
+ * the compiler a fit.
+ */
+typedef struct { int counter; } atomic_t;
+
+#define ATOMIC_INIT(i) { (i) }
+
+/*
+ * On ARM, ordinary assignment (str instruction) doesn't clear the local
+ * strex/ldrex monitor on some implementations. The reason we can use it for
+ * atomic_set() is the clrex or dummy strex done on every exception return.
+ */
+#define _atomic_read(v) ((v).counter)
+#define atomic_read(v)  (*(volatile int *)&(v)->counter)
+
+#define _atomic_set(v,i) (((v).counter) = (i))
+#define atomic_set(v,i) (((v)->counter) = (i))
+
+/*
+ * ARMv6 UP and SMP safe atomic ops.  We use load exclusive and
+ * store exclusive to ensure that these are atomic.  We may loop
+ * to ensure that the update happens.
+ */
+static inline void atomic_add(int i, atomic_t *v)
+{
+        unsigned long tmp;
+        int result;
+
+        __asm__ __volatile__("@ atomic_add\n"
+"1:     ldrex   %0, [%3]\n"
+"       add     %0, %0, %4\n"
+"       strex   %1, %0, [%3]\n"
+"       teq     %1, #0\n"
+"       bne     1b"
+        : "=&r" (result), "=&r" (tmp), "+Qo" (v->counter)
+        : "r" (&v->counter), "Ir" (i)
+        : "cc");
+}
+
+static inline int atomic_add_return(int i, atomic_t *v)
+{
+        unsigned long tmp;
+        int result;
+
+        smp_mb();
+
+        __asm__ __volatile__("@ atomic_add_return\n"
+"1:     ldrex   %0, [%3]\n"
+"       add     %0, %0, %4\n"
+"       strex   %1, %0, [%3]\n"
+"       teq     %1, #0\n"
+"       bne     1b"
+        : "=&r" (result), "=&r" (tmp), "+Qo" (v->counter)
+        : "r" (&v->counter), "Ir" (i)
+        : "cc");
+
+        smp_mb();
+
+        return result;
+}
+
+static inline void atomic_sub(int i, atomic_t *v)
+{
+        unsigned long tmp;
+        int result;
+
+        __asm__ __volatile__("@ atomic_sub\n"
+"1:     ldrex   %0, [%3]\n"
+"       sub     %0, %0, %4\n"
+"       strex   %1, %0, [%3]\n"
+"       teq     %1, #0\n"
+"       bne     1b"
+        : "=&r" (result), "=&r" (tmp), "+Qo" (v->counter)
+        : "r" (&v->counter), "Ir" (i)
+        : "cc");
+}
+
+static inline int atomic_sub_return(int i, atomic_t *v)
+{
+        unsigned long tmp;
+        int result;
+
+        smp_mb();
+
+        __asm__ __volatile__("@ atomic_sub_return\n"
+"1:     ldrex   %0, [%3]\n"
+"       sub     %0, %0, %4\n"
+"       strex   %1, %0, [%3]\n"
+"       teq     %1, #0\n"
+"       bne     1b"
+        : "=&r" (result), "=&r" (tmp), "+Qo" (v->counter)
+        : "r" (&v->counter), "Ir" (i)
+        : "cc");
+
+        smp_mb();
+
+        return result;
+}
+
+static inline int atomic_cmpxchg(atomic_t *ptr, int old, int new)
+{
+        unsigned long oldval, res;
+
+        smp_mb();
+
+        do {
+                __asm__ __volatile__("@ atomic_cmpxchg\n"
+                "ldrex  %1, [%3]\n"
+                "mov    %0, #0\n"
+                "teq    %1, %4\n"
+                "strexeq %0, %5, [%3]\n"
+                    : "=&r" (res), "=&r" (oldval), "+Qo" (ptr->counter)
+                    : "r" (&ptr->counter), "Ir" (old), "r" (new)
+                    : "cc");
+        } while (res);
+
+        smp_mb();
+
+        return oldval;
+}
+
+static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
+{
+        unsigned long tmp, tmp2;
+
+        __asm__ __volatile__("@ atomic_clear_mask\n"
+"1:     ldrex   %0, [%3]\n"
+"       bic     %0, %0, %4\n"
+"       strex   %1, %0, [%3]\n"
+"       teq     %1, #0\n"
+"       bne     1b"
+        : "=&r" (tmp), "=&r" (tmp2), "+Qo" (*addr)
+        : "r" (addr), "Ir" (mask)
+        : "cc");
+}
+
+#define atomic_inc(v)           atomic_add(1, v)
+#define atomic_dec(v)           atomic_sub(1, v)
+
+#define atomic_inc_and_test(v)  (atomic_add_return(1, v) == 0)
+#define atomic_dec_and_test(v)  (atomic_sub_return(1, v) == 0)
+#define atomic_inc_return(v)    (atomic_add_return(1, v))
+#define atomic_dec_return(v)    (atomic_sub_return(1, v))
+#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0)
+
+#define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0)
+
+static inline atomic_t atomic_compareandswap(
+    atomic_t old, atomic_t new, atomic_t *v)
+{
+    atomic_t rc;
+    rc.counter = __cmpxchg(&v->counter, old.counter, new.counter, sizeof(int));
+    return rc;
+}
+
+#endif /* __ARCH_ARM_ATOMIC__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/bitops.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/bitops.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,213 @@
+/*
+ * Copyright 1995, Russell King.
+ * Various bits and pieces copyrights include:
+ *  Linus Torvalds (test_bit).
+ * Big endian support: Copyright 2001, Nicolas Pitre
+ *  reworked by rmk.
+ */
+
+#ifndef _ARM_BITOPS_H
+#define _ARM_BITOPS_H
+
+extern void _set_bit(int nr, volatile void * p);
+extern void _clear_bit(int nr, volatile void * p);
+extern void _change_bit(int nr, volatile void * p);
+extern int _test_and_set_bit(int nr, volatile void * p);
+extern int _test_and_clear_bit(int nr, volatile void * p);
+extern int _test_and_change_bit(int nr, volatile void * p);
+
+#define set_bit(n,p)              _set_bit(n,p)
+#define clear_bit(n,p)            _clear_bit(n,p)
+#define change_bit(n,p)           _change_bit(n,p)
+#define test_and_set_bit(n,p)     _test_and_set_bit(n,p)
+#define test_and_clear_bit(n,p)   _test_and_clear_bit(n,p)
+#define test_and_change_bit(n,p)  _test_and_change_bit(n,p)
+
+#define BIT(nr)                 (1UL << (nr))
+#define BIT_MASK(nr)            (1UL << ((nr) % BITS_PER_LONG))
+#define BIT_WORD(nr)            ((nr) / BITS_PER_LONG)
+#define BITS_PER_BYTE           8
+
+#define ADDR (*(volatile long *) addr)
+#define CONST_ADDR (*(const volatile long *) addr)
+
+/**
+ * __test_and_set_bit - Set a bit and return its old value
+ * @nr: Bit to set
+ * @addr: Address to count from
+ *
+ * This operation is non-atomic and can be reordered.
+ * If two examples of this operation race, one can appear to succeed
+ * but actually fail.  You must protect multiple accesses with a lock.
+ */
+static inline int __test_and_set_bit(int nr, volatile void *addr)
+{
+        unsigned long mask = BIT_MASK(nr);
+        volatile unsigned long *p =
+                ((volatile unsigned long *)addr) + BIT_WORD(nr);
+        unsigned long old = *p;
+
+        *p = old | mask;
+        return (old & mask) != 0;
+}
+
+/**
+ * __test_and_clear_bit - Clear a bit and return its old value
+ * @nr: Bit to clear
+ * @addr: Address to count from
+ *
+ * This operation is non-atomic and can be reordered.
+ * If two examples of this operation race, one can appear to succeed
+ * but actually fail.  You must protect multiple accesses with a lock.
+ */
+static inline int __test_and_clear_bit(int nr, volatile void *addr)
+{
+        unsigned long mask = BIT_MASK(nr);
+        volatile unsigned long *p =
+                ((volatile unsigned long *)addr) + BIT_WORD(nr);
+        unsigned long old = *p;
+
+        *p = old & ~mask;
+        return (old & mask) != 0;
+}
+
+/* WARNING: non atomic and it can be reordered! */
+static inline int __test_and_change_bit(int nr,
+                                            volatile void *addr)
+{
+        unsigned long mask = BIT_MASK(nr);
+        volatile unsigned long *p =
+                ((volatile unsigned long *)addr) + BIT_WORD(nr);
+        unsigned long old = *p;
+
+        *p = old ^ mask;
+        return (old & mask) != 0;
+}
+
+/**
+ * test_bit - Determine whether a bit is set
+ * @nr: bit number to test
+ * @addr: Address to start counting from
+ */
+static inline int test_bit(int nr, const volatile void *addr)
+{
+        const volatile unsigned long *p = (const volatile unsigned long *)addr;
+        return 1UL & (p[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
+}
+
+/*
+ * Little endian assembly bitops.  nr = 0 -> byte 0 bit 0.
+ */
+extern int _find_first_zero_bit_le(const void * p, unsigned size);
+extern int _find_next_zero_bit_le(const void * p, int size, int offset);
+extern int _find_first_bit_le(const unsigned long *p, unsigned size);
+extern int _find_next_bit_le(const unsigned long *p, int size, int offset);
+
+/*
+ * Big endian assembly bitops.  nr = 0 -> byte 3 bit 0.
+ */
+extern int _find_first_zero_bit_be(const void * p, unsigned size);
+extern int _find_next_zero_bit_be(const void * p, int size, int offset);
+extern int _find_first_bit_be(const unsigned long *p, unsigned size);
+extern int _find_next_bit_be(const unsigned long *p, int size, int offset);
+
+#ifndef __ARMEB__
+/*
+ * These are the little endian, atomic definitions.
+ */
+#define find_first_zero_bit(p,sz)      _find_first_zero_bit_le(p,sz)
+#define find_next_zero_bit(p,sz,off)   _find_next_zero_bit_le(p,sz,off)
+#define find_first_bit(p,sz)           _find_first_bit_le(p,sz)
+#define find_next_bit(p,sz,off)                _find_next_bit_le(p,sz,off)
+
+#else
+/*
+ * These are the big endian, atomic definitions.
+ */
+#define find_first_zero_bit(p,sz)      _find_first_zero_bit_be(p,sz)
+#define find_next_zero_bit(p,sz,off)   _find_next_zero_bit_be(p,sz,off)
+#define find_first_bit(p,sz)           _find_first_bit_be(p,sz)
+#define find_next_bit(p,sz,off)                _find_next_bit_be(p,sz,off)
+
+#endif
+
+static inline int constant_fls(int x)
+{
+        int r = 32;
+
+        if (!x)
+                return 0;
+        if (!(x & 0xffff0000u)) {
+                x <<= 16;
+                r -= 16;
+        }
+        if (!(x & 0xff000000u)) {
+                x <<= 8;
+                r -= 8;
+        }
+        if (!(x & 0xf0000000u)) {
+                x <<= 4;
+                r -= 4;
+        }
+        if (!(x & 0xc0000000u)) {
+                x <<= 2;
+                r -= 2;
+        }
+        if (!(x & 0x80000000u)) {
+                x <<= 1;
+                r -= 1;
+        }
+        return r;
+}
+
+/*
+ * On ARMv5 and above those functions can be implemented around
+ * the clz instruction for much better code efficiency.
+ */
+
+static inline int fls(int x)
+{
+        int ret;
+
+        if (__builtin_constant_p(x))
+               return constant_fls(x);
+
+        asm("clz\t%0, %1" : "=r" (ret) : "r" (x));
+        ret = 32 - ret;
+        return ret;
+}
+
+#define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); })
+
+/**
+ * find_first_set_bit - find the first set bit in @word
+ * @word: the word to search
+ *
+ * Returns the bit-number of the first set bit (first bit being 0).
+ * The input must *not* be zero.
+ */
+static inline unsigned int find_first_set_bit(unsigned long word)
+{
+        return ffs(word) - 1;
+}
+
+/**
+ * hweightN - returns the hamming weight of a N-bit word
+ * @x: the word to weigh
+ *
+ * The Hamming Weight of a number is the total number of bits set in it.
+ */
+#define hweight64(x) generic_hweight64(x)
+#define hweight32(x) generic_hweight32(x)
+#define hweight16(x) generic_hweight16(x)
+#define hweight8(x) generic_hweight8(x)
+
+#endif /* _ARM_BITOPS_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/bug.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/bug.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,15 @@
+#ifndef __ARM_BUG_H__
+#define __ARM_BUG_H__
+
+#define BUG() __bug(__FILE__, __LINE__)
+#define WARN() __warn(__FILE__, __LINE__)
+
+#endif /* __X86_BUG_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/byteorder.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/byteorder.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,16 @@
+#ifndef __ASM_ARM_BYTEORDER_H__
+#define __ASM_ARM_BYTEORDER_H__
+
+#define __BYTEORDER_HAS_U64__
+
+#include <xen/byteorder/little_endian.h>
+
+#endif /* __ASM_ARM_BYTEORDER_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/cache.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/cache.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,20 @@
+#ifndef __ARCH_ARM_CACHE_H
+#define __ARCH_ARM_CACHE_H
+
+#include <xen/config.h>
+
+/* L1 cache line size */
+#define L1_CACHE_SHIFT  (CONFIG_ARM_L1_CACHE_SHIFT)
+#define L1_CACHE_BYTES  (1 << L1_CACHE_SHIFT)
+
+#define __read_mostly __attribute__((__section__(".data.read_mostly")))
+
+#endif
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/config.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/config.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,122 @@
+/******************************************************************************
+ * config.h
+ *
+ * A Linux-style configuration list.
+ */
+
+#ifndef __ARM_CONFIG_H__
+#define __ARM_CONFIG_H__
+
+#define CONFIG_PAGING_LEVELS 3
+
+#define CONFIG_ARM 1
+
+#define CONFIG_ARM_L1_CACHE_SHIFT 7 /* XXX */
+
+#define CONFIG_SMP 1
+
+#define CONFIG_DOMAIN_PAGE 1
+
+#define OPT_CONSOLE_STR "com1"
+
+#ifdef MAX_PHYS_CPUS
+#define NR_CPUS MAX_PHYS_CPUS
+#else
+#define NR_CPUS 128
+#endif
+
+#define MAX_VIRT_CPUS 128 /* XXX */
+#define MAX_HVM_VCPUS MAX_VIRT_CPUS
+
+#define asmlinkage /* Nothing needed */
+
+/* Linkage for ARM */
+#define __ALIGN .align 2
+#define __ALIGN_STR ".align 2"
+#ifdef __ASSEMBLY__
+#define ALIGN __ALIGN
+#define ALIGN_STR __ALIGN_STR
+#define ENTRY(name)                             \
+  .globl name;                                  \
+  ALIGN;                                        \
+  name:
+#define END(name) \
+  .size name, .-name
+#define ENDPROC(name) \
+  .type name, %function; \
+  END(name)
+#endif
+
+/*
+ * Memory layout:
+ *  0  -   2M   Unmapped
+ *  2M -   4M   Xen text, data, bss
+ *  4M -   6M   Fixmap: special-purpose 4K mapping slots
+ *
+ * 32M - 128M   Frametable: 24 bytes per page for 16GB of RAM
+ *
+ *  1G -   2G   Xenheap: always-mapped memory
+ *  2G -   4G   Domheap: on-demand-mapped
+ */
+
+#define XEN_VIRT_START         0x00200000
+#define FIXMAP_ADDR(n)        (0x00400000 + (n) * PAGE_SIZE)
+#define FRAMETABLE_VIRT_START  0x02000000
+#define XENHEAP_VIRT_START     0x40000000
+#define DOMHEAP_VIRT_START     0x80000000
+
+#define HYPERVISOR_VIRT_START mk_unsigned_long(XEN_VIRT_START)
+
+#define DOMHEAP_ENTRIES        1024  /* 1024 2MB mapping slots */
+
+/* Fixmap slots */
+#define FIXMAP_CONSOLE  0  /* The primary UART */
+#define FIXMAP_PT       1  /* Temporary mappings of pagetable pages */
+#define FIXMAP_MISC     2  /* Ephemeral mappings of hardware */
+#define FIXMAP_GICD     3  /* Interrupt controller: distributor registers */
+#define FIXMAP_GICC1    4  /* Interrupt controller: CPU registers (first page) */
+#define FIXMAP_GICC2    5  /* Interrupt controller: CPU registers (second page) */
+#define FIXMAP_GICH     6  /* Interrupt controller: virtual interface control registers */
+
+#define PAGE_SHIFT              12
+
+#ifndef __ASSEMBLY__
+#define PAGE_SIZE           (1L << PAGE_SHIFT)
+#else
+#define PAGE_SIZE           (1 << PAGE_SHIFT)
+#endif
+#define PAGE_MASK           (~(PAGE_SIZE-1))
+#define PAGE_FLAG_MASK      (~0)
+
+#define STACK_ORDER 3
+#define STACK_SIZE  (PAGE_SIZE << STACK_ORDER)
+
+#ifndef __ASSEMBLY__
+extern unsigned long xen_phys_start;
+extern unsigned long xenheap_phys_end;
+extern unsigned long frametable_virt_end;
+#endif
+
+#define supervisor_mode_kernel (0)
+
+#define watchdog_disable() ((void)0)
+#define watchdog_enable()  ((void)0)
+
+/* Board-specific: base address of PL011 UART */
+#define EARLY_UART_ADDRESS 0x1c090000
+/* Board-specific: base address of GIC + its regs */
+#define GIC_BASE_ADDRESS 0x2c000000
+#define GIC_DR_OFFSET 0x1000
+#define GIC_CR_OFFSET 0x2000
+#define GIC_HR_OFFSET 0x4000 /* Guess work http://lists.infradead.org/pipermail/linux-arm-kernel/2011-September/064219.html */
+#define GIC_VR_OFFSET 0x6000 /* Virtual Machine CPU interface) */
+
+#endif /* __ARM_CONFIG_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/cpregs.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/cpregs.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,207 @@
+#ifndef __ASM_ARM_CPREGS_H
+#define __ASM_ARM_CPREGS_H
+
+#include <xen/stringify.h>
+
+/* Co-processor registers */
+
+/* Layout as used in assembly, with src/dest registers mixed in */
+#define __CP32(r, coproc, opc1, crn, crm, opc2) coproc, opc1, r, crn, crm, opc2
+#define __CP64(r1, r2, coproc, opc, crm) coproc, opc, r1, r2, crm
+#define CP32(r, name...) __CP32(r, name)
+#define CP64(r, name...) __CP64(r, name)
+
+/* Stringified for inline assembly */
+#define LOAD_CP32(r, name...)  "mrc " __stringify(CP32(%r, name)) ";"
+#define STORE_CP32(r, name...) "mcr " __stringify(CP32(%r, name)) ";"
+#define LOAD_CP64(r, name...)  "mrrc " __stringify(CP64(%r, %H##r, name)) ";"
+#define STORE_CP64(r, name...) "mcrr " __stringify(CP64(%r, %H##r, name)) ";"
+
+/* C wrappers */
+#define READ_CP32(name...) ({                                   \
+    register uint32_t _r;                                       \
+    asm volatile(LOAD_CP32(0, name) : "=r" (_r));               \
+    _r; })
+
+#define WRITE_CP32(v, name...) do {                             \
+    register uint32_t _r = (v);                                 \
+    asm volatile(STORE_CP32(0, name) : : "r" (_r));             \
+} while (0)
+
+#define READ_CP64(name...) ({                                   \
+    register uint64_t _r;                                       \
+    asm volatile(LOAD_CP64(0, name) : "=r" (_r));               \
+    _r; })
+
+#define WRITE_CP64(v, name...) do {                             \
+    register uint64_t _r = (v);                                 \
+    asm volatile(STORE_CP64(0, name) : : "r" (_r));             \
+} while (0)
+
+#define __HSR_CPREG_c0  0
+#define __HSR_CPREG_c1  1
+#define __HSR_CPREG_c2  2
+#define __HSR_CPREG_c3  3
+#define __HSR_CPREG_c4  4
+#define __HSR_CPREG_c5  5
+#define __HSR_CPREG_c6  6
+#define __HSR_CPREG_c7  7
+#define __HSR_CPREG_c8  8
+#define __HSR_CPREG_c9  9
+#define __HSR_CPREG_c10 10
+#define __HSR_CPREG_c11 11
+#define __HSR_CPREG_c12 12
+#define __HSR_CPREG_c13 13
+#define __HSR_CPREG_c14 14
+#define __HSR_CPREG_c15 15
+
+#define __HSR_CPREG_0   0
+#define __HSR_CPREG_1   1
+#define __HSR_CPREG_2   2
+#define __HSR_CPREG_3   3
+#define __HSR_CPREG_4   4
+#define __HSR_CPREG_5   5
+#define __HSR_CPREG_6   6
+#define __HSR_CPREG_7   7
+
+#define _HSR_CPREG32(cp,op1,crn,crm,op2) \
+    ((__HSR_CPREG_##crn) << HSR_CP32_CRN_SHIFT) | \
+    ((__HSR_CPREG_##crm) << HSR_CP32_CRM_SHIFT) | \
+    ((__HSR_CPREG_##op1) << HSR_CP32_OP1_SHIFT) | \
+    ((__HSR_CPREG_##op2) << HSR_CP32_OP2_SHIFT)
+
+#define _HSR_CPREG64(cp,op1,crm) \
+    ((__HSR_CPREG_##crm) << HSR_CP64_CRM_SHIFT) | \
+    ((__HSR_CPREG_##op1) << HSR_CP64_OP1_SHIFT)
+
+/* Encode a register as per HSR ISS pattern */
+#define HSR_CPREG32(X) _HSR_CPREG32(X)
+#define HSR_CPREG64(X) _HSR_CPREG64(X)
+
+/*
+ * Order registers by Coprocessor-> CRn-> Opcode 1-> CRm-> Opcode 2
+ *
+ * This matches the ordering used in the ARM as well as the groupings
+ * which the CP registers are allocated in.
+ *
+ * This is slightly different to the form of the instruction
+ * arguments, which are cp,opc1,crn,crm,opc2.
+ */
+
+/* Coprocessor 15 */
+
+/* CP15 CR0: CPUID and Cache Type Registers */
+#define ID_PFR0         p15,0,c0,c1,0   /* Processor Feature Register 0 */
+#define ID_PFR1         p15,0,c0,c1,1   /* Processor Feature Register 1 */
+#define CCSIDR          p15,1,c0,c0,0   /* Cache Size ID Registers */
+#define CLIDR           p15,1,c0,c0,1   /* Cache Level ID Register */
+#define CSSELR          p15,2,c0,c0,0   /* Cache Size Selection Register */
+
+/* CP15 CR1: System Control Registers */
+#define SCTLR           p15,0,c1,c0,0   /* System Control Register */
+#define SCR             p15,0,c1,c1,0   /* Secure Configuration Register */
+#define NSACR           p15,0,c1,c1,2   /* Non-Secure Access Control Register */
+#define HSCTLR          p15,4,c1,c0,0   /* Hyp. System Control Register */
+#define HCR             p15,4,c1,c1,0   /* Hyp. Configuration Register */
+
+/* CP15 CR2: Translation Table Base and Control Registers */
+#define TTBR0           p15,0,c2,c0,0   /* Translation Table Base Reg. 0 */
+#define TTBR1           p15,0,c2,c0,1   /* Translation Table Base Reg. 1 */
+#define TTBCR           p15,0,c2,c0,2   /* Translatation Table Base Control Register */
+#define HTTBR           p15,4,c2        /* Hyp. Translation Table Base Register */
+#define HTCR            p15,4,c2,c0,2   /* Hyp. Translation Control Register */
+#define VTCR            p15,4,c2,c1,2   /* Virtualization Translation Control Register */
+#define VTTBR           p15,6,c2        /* Virtualization Translation Table Base Register */
+
+/* CP15 CR3: Domain Access Control Register */
+
+/* CP15 CR4: */
+
+/* CP15 CR5: Fault Status Registers */
+#define DFSR            p15,0,c5,c0,0   /* Data Fault Status Register */
+#define IFSR            p15,0,c5,c0,1   /* Instruction Fault Status Register */
+#define HSR             p15,4,c5,c2,0   /* Hyp. Syndrome Register */
+
+/* CP15 CR6: Fault Address Registers */
+#define DFAR            p15,0,c6,c0,0   /* Data Fault Address Register  */
+#define IFAR            p15,0,c6,c0,2   /* Instruction Fault Address Register */
+#define HDFAR           p15,4,c6,c0,0   /* Hyp. Data Fault Address Register */
+#define HIFAR           p15,4,c6,c0,2   /* Hyp. Instruction Fault Address Register */
+#define HPFAR           p15,4,c6,c0,4   /* Hyp. IPA Fault Address Register */
+
+/* CP15 CR7: Cache and address translation operations */
+#define PAR             p15,0,c7        /* Physical Address Register */
+#define ICIALLUIS       p15,0,c7,c1,0   /* Invalidate all instruction caches to PoU inner shareable */
+#define BPIALLIS        p15,0,c7,c1,6   /* Invalidate entire branch predictor array inner shareable */
+#define ICIALLU         p15,0,c7,c5,0   /* Invalidate all instruction caches to PoU */
+#define BPIALL          p15,0,c7,c5,6   /* Invalidate entire branch predictor array */
+#define ATS1CPR         p15,0,c7,c8,0   /* Address Translation Stage 1. Non-Secure Kernel Read */
+#define ATS1CPW         p15,0,c7,c8,1   /* Address Translation Stage 1. Non-Secure Kernel Write */
+#define ATS1CUR         p15,0,c7,c8,2   /* Address Translation Stage 1. Non-Secure User Read */
+#define ATS1CUW         p15,0,c7,c8,3   /* Address Translation Stage 1. Non-Secure User Write */
+#define ATS12NSOPR      p15,0,c7,c8,4   /* Address Translation Stage 1+2 Non-Secure Kernel Read */
+#define ATS12NSOPW      p15,0,c7,c8,5   /* Address Translation Stage 1+2 Non-Secure Kernel Write */
+#define ATS12NSOUR      p15,0,c7,c8,6   /* Address Translation Stage 1+2 Non-Secure User Read */
+#define ATS12NSOUW      p15,0,c7,c8,7   /* Address Translation Stage 1+2 Non-Secure User Write */
+#define DCCMVAC         p15,0,c7,c10,1  /* Clean data or unified cache line by MVA to PoC */
+#define DCCISW          p15,0,c7,c14,2  /* Clean and invalidate data cache line by set/way */
+#define ATS1HR          p15,4,c7,c8,0   /* Address Translation Stage 1 Hyp. Read */
+#define ATS1HW          p15,4,c7,c8,1   /* Address Translation Stage 1 Hyp. Write */
+
+/* CP15 CR8: TLB maintenance operations */
+#define TLBIALLIS       p15,0,c8,c3,0   /* Invalidate entire TLB innrer shareable */
+#define TLBIMVAIS       p15,0,c8,c3,1   /* Invalidate unified TLB entry by MVA inner shareable */
+#define TLBIASIDIS      p15,0,c8,c3,2   /* Invalidate unified TLB by ASID match inner shareable */
+#define TLBIMVAAIS      p15,0,c8,c3,3   /* Invalidate unified TLB entry by MVA all ASID inner shareable */
+#define DTLBIALL        p15,0,c8,c6,0   /* Invalidate data TLB */
+#define DTLBIMVA        p15,0,c8,c6,1   /* Invalidate data TLB entry by MVA */
+#define DTLBIASID       p15,0,c8,c6,2   /* Invalidate data TLB by ASID match */
+#define TLBILLHIS       p15,4,c8,c3,0   /* Invalidate Entire Hyp. Unified TLB inner shareable */
+#define TLBIMVAHIS      p15,4,c8,c3,1   /* Invalidate Unified Hyp. TLB by MVA inner shareable */
+#define TLBIALLNSNHIS   p15,4,c8,c7,4   /* Invalidate Entire Non-Secure Non-Hyp. Unified TLB inner shareable */
+#define TLBIALLH        p15,4,c8,c7,0   /* Invalidate Entire Hyp. Unified TLB */
+#define TLBIMVAH        p15,4,c8,c7,1   /* Invalidate Unified Hyp. TLB by MVA */
+#define TLBIALLNSNH     p15,4,c8,c7,4   /* Invalidate Entire Non-Secure Non-Hyp. Unified TLB */
+
+/* CP15 CR9: */
+
+/* CP15 CR10: */
+#define MAIR0           p15,0,c10,c2,0  /* Memory Attribute Indirection Register 0 */
+#define MAIR1           p15,0,c10,c2,1  /* Memory Attribute Indirection Register 1 */
+#define HMAIR0          p15,4,c10,c2,0  /* Hyp. Memory Attribute Indirection Register 0 */
+#define HMAIR1          p15,4,c10,c2,1  /* Hyp. Memory Attribute Indirection Register 1 */
+
+/* CP15 CR11: DMA Operations for TCM Access */
+
+/* CP15 CR12:  */
+#define HVBAR           p15,4,c12,c0,0  /* Hyp. Vector Base Address Register */
+
+/* CP15 CR13:  */
+#define FCSEIDR         p15,0,c13,c0,0  /* FCSE Process ID Register */
+#define CONTEXTIDR      p15,0,c13,c0,1  /* Context ID Register */
+
+/* CP15 CR14:  */
+#define CNTPCT          p15,0,c14       /* Time counter value */
+#define CNTFRQ          p15,0,c14,c0,0  /* Time counter frequency */
+#define CNTKCTL         p15,0,c14,c1,0  /* Time counter kernel control */
+#define CNTP_TVAL       p15,0,c14,c2,0  /* Physical Timer value */
+#define CNTP_CTL        p15,0,c14,c2,1  /* Physical Timer control register */
+#define CNTVCT          p15,1,c14       /* Time counter value + offset */
+#define CNTP_CVAL       p15,2,c14       /* Physical Timer comparator */
+#define CNTVOFF         p15,4,c14       /* Time counter offset */
+#define CNTHCTL         p15,4,c14,c1,0  /* Time counter hyp. control */
+#define CNTHP_TVAL      p15,4,c14,c2,0  /* Hyp. Timer value */
+#define CNTHP_CTL       p15,4,c14,c2,1  /* Hyp. Timer control register */
+#define CNTHP_CVAL      p15,6,c14       /* Hyp. Timer comparator */
+
+/* CP15 CR15: Implementation Defined Registers */
+
+#endif
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/current.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/current.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,60 @@
+#ifndef __ARM_CURRENT_H__
+#define __ARM_CURRENT_H__
+
+#include <xen/config.h>
+#include <xen/percpu.h>
+#include <public/xen.h>
+
+#ifndef __ASSEMBLY__
+
+struct vcpu;
+
+struct cpu_info {
+    struct cpu_user_regs guest_cpu_user_regs;
+    unsigned long elr;
+    unsigned int processor_id;
+    struct vcpu *current_vcpu;
+    unsigned long per_cpu_offset;
+};
+
+static inline struct cpu_info *get_cpu_info(void)
+{
+        register unsigned long sp asm ("sp");
+        return (struct cpu_info *)((sp & ~(STACK_SIZE - 1)) + STACK_SIZE - sizeof(struct cpu_info));
+}
+
+#define get_current()         (get_cpu_info()->current_vcpu)
+#define set_current(vcpu)     (get_cpu_info()->current_vcpu = (vcpu))
+#define current               (get_current())
+
+#define get_processor_id()    (get_cpu_info()->processor_id)
+#define set_processor_id(id)  do {                                      \
+    struct cpu_info *ci__ = get_cpu_info();                             \
+    ci__->per_cpu_offset = __per_cpu_offset[ci__->processor_id = (id)]; \
+} while (0)
+
+#define guest_cpu_user_regs() (&get_cpu_info()->guest_cpu_user_regs)
+
+#define reset_stack_and_jump(__fn)              \
+    __asm__ __volatile__ (                      \
+        "mov sp,%0; b "STR(__fn)      \
+        : : "r" (guest_cpu_user_regs()) : "memory" )
+#endif
+
+
+/*
+ * Which VCPU's state is currently running on each CPU?
+ * This is not necesasrily the same as 'current' as a CPU may be
+ * executing a lazy state switch.
+ */
+DECLARE_PER_CPU(struct vcpu *, curr_vcpu);
+
+#endif /* __ARM_CURRENT_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/debugger.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/debugger.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,15 @@
+#ifndef __ARM_DEBUGGER_H__
+#define __ARM_DEBUGGER_H__
+
+#define debugger_trap_fatal(v, r) ((void) 0)
+#define debugger_trap_immediate() ((void) 0)
+
+#endif /* __ARM_DEBUGGER_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/delay.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/delay.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,15 @@
+#ifndef _ARM_DELAY_H
+#define _ARM_DELAY_H
+
+extern void __udelay(unsigned long usecs);
+#define udelay(n) __udelay(n)
+
+#endif /* defined(_ARM_DELAY_H) */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/desc.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/desc.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,12 @@
+#ifndef __ARCH_DESC_H
+#define __ARCH_DESC_H
+
+#endif /* __ARCH_DESC_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/div64.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/div64.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,235 @@
+/* Taken from Linux arch/arm */
+#ifndef __ASM_ARM_DIV64
+#define __ASM_ARM_DIV64
+
+#include <asm/system.h>
+#include <xen/types.h>
+
+/*
+ * The semantics of do_div() are:
+ *
+ * uint32_t do_div(uint64_t *n, uint32_t base)
+ * {
+ *     uint32_t remainder = *n % base;
+ *     *n = *n / base;
+ *     return remainder;
+ * }
+ *
+ * In other words, a 64-bit dividend with a 32-bit divisor producing
+ * a 64-bit result and a 32-bit remainder.  To accomplish this optimally
+ * we call a special __do_div64 helper with completely non standard
+ * calling convention for arguments and results (beware).
+ */
+
+#ifdef __ARMEB__
+#define __xh "r0"
+#define __xl "r1"
+#else
+#define __xl "r0"
+#define __xh "r1"
+#endif
+
+#define __do_div_asm(n, base)                                  \
+({                                                             \
+       register unsigned int __base      asm("r4") = base;     \
+       register unsigned long long __n   asm("r0") = n;        \
+       register unsigned long long __res asm("r2");            \
+       register unsigned int __rem       asm(__xh);            \
+       asm(    __asmeq("%0", __xh)                             \
+               __asmeq("%1", "r2")                             \
+               __asmeq("%2", "r0")                             \
+               __asmeq("%3", "r4")                             \
+               "bl     __do_div64"                             \
+               : "=r" (__rem), "=r" (__res)                    \
+               : "r" (__n), "r" (__base)                       \
+               : "ip", "lr", "cc");                            \
+       n = __res;                                              \
+       __rem;                                                  \
+})
+
+#if __GNUC__ < 4
+
+/*
+ * gcc versions earlier than 4.0 are simply too problematic for the
+ * optimized implementation below. First there is gcc PR 15089 that
+ * tend to trig on more complex constructs, spurious .global __udivsi3
+ * are inserted even if none of those symbols are referenced in the
+ * generated code, and those gcc versions are not able to do constant
+ * propagation on long long values anyway.
+ */
+#define do_div(n, base) __do_div_asm(n, base)
+
+#elif __GNUC__ >= 4
+
+#include <asm/bug.h>
+
+/*
+ * If the divisor happens to be constant, we determine the appropriate
+ * inverse at compile time to turn the division into a few inline
+ * multiplications instead which is much faster. And yet only if compiling
+ * for ARMv4 or higher (we need umull/umlal) and if the gcc version is
+ * sufficiently recent to perform proper long long constant propagation.
+ * (It is unfortunate that gcc doesn't perform all this internally.)
+ */
+#define do_div(n, base)                                                        \
+({                                                                     \
+       unsigned int __r, __b = (base);                                 \
+       if (!__builtin_constant_p(__b) || __b == 0) {                   \
+               /* non-constant divisor (or zero): slow path */         \
+               __r = __do_div_asm(n, __b);                             \
+       } else if ((__b & (__b - 1)) == 0) {                            \
+               /* Trivial: __b is constant and a power of 2 */         \
+               /* gcc does the right thing with this code.  */         \
+               __r = n;                                                \
+               __r &= (__b - 1);                                       \
+               n /= __b;                                               \
+       } else {                                                        \
+               /* Multiply by inverse of __b: n/b = n*(p/b)/p       */ \
+               /* We rely on the fact that most of this code gets   */ \
+               /* optimized away at compile time due to constant    */ \
+               /* propagation and only a couple inline assembly     */ \
+               /* instructions should remain. Better avoid any      */ \
+               /* code construct that might prevent that.           */ \
+               unsigned long long __res, __x, __t, __m, __n = n;       \
+               unsigned int __c, __p, __z = 0;                         \
+               /* preserve low part of n for reminder computation */   \
+               __r = __n;                                              \
+               /* determine number of bits to represent __b */         \
+               __p = 1 << __div64_fls(__b);                            \
+               /* compute __m = ((__p << 64) + __b - 1) / __b */       \
+               __m = (~0ULL / __b) * __p;                              \
+               __m += (((~0ULL % __b + 1) * __p) + __b - 1) / __b;     \
+               /* compute __res = __m*(~0ULL/__b*__b-1)/(__p << 64) */ \
+               __x = ~0ULL / __b * __b - 1;                            \
+               __res = (__m & 0xffffffff) * (__x & 0xffffffff);        \
+               __res >>= 32;                                           \
+               __res += (__m & 0xffffffff) * (__x >> 32);              \
+               __t = __res;                                            \
+               __res += (__x & 0xffffffff) * (__m >> 32);              \
+               __t = (__res < __t) ? (1ULL << 32) : 0;                 \
+               __res = (__res >> 32) + __t;                            \
+               __res += (__m >> 32) * (__x >> 32);                     \
+               __res /= __p;                                           \
+               /* Now sanitize and optimize what we've got. */         \
+               if (~0ULL % (__b / (__b & -__b)) == 0) {                \
+                       /* those cases can be simplified with: */       \
+                       __n /= (__b & -__b);                            \
+                       __m = ~0ULL / (__b / (__b & -__b));             \
+                       __p = 1;                                        \
+                       __c = 1;                                        \
+               } else if (__res != __x / __b) {                        \
+                       /* We can't get away without a correction    */ \
+                       /* to compensate for bit truncation errors.  */ \
+                       /* To avoid it we'd need an additional bit   */ \
+                       /* to represent __m which would overflow it. */ \
+                       /* Instead we do m=p/b and n/b=(n*m+m)/p.    */ \
+                       __c = 1;                                        \
+                       /* Compute __m = (__p << 64) / __b */           \
+                       __m = (~0ULL / __b) * __p;                      \
+                       __m += ((~0ULL % __b + 1) * __p) / __b;         \
+               } else {                                                \
+                       /* Reduce __m/__p, and try to clear bit 31   */ \
+                       /* of __m when possible otherwise that'll    */ \
+                       /* need extra overflow handling later.       */ \
+                       unsigned int __bits = -(__m & -__m);            \
+                       __bits |= __m >> 32;                            \
+                       __bits = (~__bits) << 1;                        \
+                       /* If __bits == 0 then setting bit 31 is     */ \
+                       /* unavoidable.  Simply apply the maximum    */ \
+                       /* possible reduction in that case.          */ \
+                       /* Otherwise the MSB of __bits indicates the */ \
+                       /* best reduction we should apply.           */ \
+                       if (!__bits) {                                  \
+                               __p /= (__m & -__m);                    \
+                               __m /= (__m & -__m);                    \
+                       } else {                                        \
+                               __p >>= __div64_fls(__bits);            \
+                               __m >>= __div64_fls(__bits);            \
+                       }                                               \
+                       /* No correction needed. */                     \
+                       __c = 0;                                        \
+               }                                                       \
+               /* Now we have a combination of 2 conditions:        */ \
+               /* 1) whether or not we need a correction (__c), and */ \
+               /* 2) whether or not there might be an overflow in   */ \
+               /*    the cross product (__m & ((1<<63) | (1<<31)))  */ \
+               /* Select the best insn combination to perform the   */ \
+               /* actual __m * __n / (__p << 64) operation.         */ \
+               if (!__c) {                                             \
+                       asm (   "umull  %Q0, %R0, %1, %Q2\n\t"          \
+                               "mov    %Q0, #0"                        \
+                               : "=&r" (__res)                         \
+                               : "r" (__m), "r" (__n)                  \
+                               : "cc" );                               \
+               } else if (!(__m & ((1ULL << 63) | (1ULL << 31)))) {    \
+                       __res = __m;                                    \
+                       asm (   "umlal  %Q0, %R0, %Q1, %Q2\n\t"         \
+                               "mov    %Q0, #0"                        \
+                               : "+&r" (__res)                         \
+                               : "r" (__m), "r" (__n)                  \
+                               : "cc" );                               \
+               } else {                                                \
+                       asm (   "umull  %Q0, %R0, %Q1, %Q2\n\t"         \
+                               "cmn    %Q0, %Q1\n\t"                   \
+                               "adcs   %R0, %R0, %R1\n\t"              \
+                               "adc    %Q0, %3, #0"                    \
+                               : "=&r" (__res)                         \
+                               : "r" (__m), "r" (__n), "r" (__z)       \
+                               : "cc" );                               \
+               }                                                       \
+               if (!(__m & ((1ULL << 63) | (1ULL << 31)))) {           \
+                       asm (   "umlal  %R0, %Q0, %R1, %Q2\n\t"         \
+                               "umlal  %R0, %Q0, %Q1, %R2\n\t"         \
+                               "mov    %R0, #0\n\t"                    \
+                               "umlal  %Q0, %R0, %R1, %R2"             \
+                               : "+&r" (__res)                         \
+                               : "r" (__m), "r" (__n)                  \
+                               : "cc" );                               \
+               } else {                                                \
+                       asm (   "umlal  %R0, %Q0, %R2, %Q3\n\t"         \
+                               "umlal  %R0, %1, %Q2, %R3\n\t"          \
+                               "mov    %R0, #0\n\t"                    \
+                               "adds   %Q0, %1, %Q0\n\t"               \
+                               "adc    %R0, %R0, #0\n\t"               \
+                               "umlal  %Q0, %R0, %R2, %R3"             \
+                               : "+&r" (__res), "+&r" (__z)            \
+                               : "r" (__m), "r" (__n)                  \
+                               : "cc" );                               \
+               }                                                       \
+               __res /= __p;                                           \
+               /* The reminder can be computed with 32-bit regs     */ \
+               /* only, and gcc is good at that.                    */ \
+               {                                                       \
+                       unsigned int __res0 = __res;                    \
+                       unsigned int __b0 = __b;                        \
+                       __r -= __res0 * __b0;                           \
+               }                                                       \
+               /* BUG_ON(__r >= __b || __res * __b + __r != n); */     \
+               n = __res;                                              \
+       }                                                               \
+       __r;                                                            \
+})
+
+/* our own fls implementation to make sure constant propagation is fine */
+#define __div64_fls(bits)                                              \
+({                                                                     \
+       unsigned int __left = (bits), __nr = 0;                         \
+       if (__left & 0xffff0000) __nr += 16, __left >>= 16;             \
+       if (__left & 0x0000ff00) __nr +=  8, __left >>=  8;             \
+       if (__left & 0x000000f0) __nr +=  4, __left >>=  4;             \
+       if (__left & 0x0000000c) __nr +=  2, __left >>=  2;             \
+       if (__left & 0x00000002) __nr +=  1;                            \
+       __nr;                                                           \
+})
+
+#endif
+
+#endif
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/elf.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/elf.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,33 @@
+#ifndef __ARM_ELF_H__
+#define __ARM_ELF_H__
+
+typedef struct {
+    unsigned long r0;
+    unsigned long r1;
+    unsigned long r2;
+    unsigned long r3;
+    unsigned long r4;
+    unsigned long r5;
+    unsigned long r6;
+    unsigned long r7;
+    unsigned long r8;
+    unsigned long r9;
+    unsigned long r10;
+    unsigned long r11;
+    unsigned long r12;
+    unsigned long sp;
+    unsigned long lr;
+    unsigned long pc;
+} ELF_Gregset;
+
+#endif /* __ARM_ELF_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/event.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/event.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,41 @@
+#ifndef __ASM_EVENT_H__
+#define __ASM_EVENT_H__
+
+void vcpu_kick(struct vcpu *v);
+void vcpu_mark_events_pending(struct vcpu *v);
+
+static inline int local_events_need_delivery(void)
+{
+    /* TODO
+     * return (vcpu_info(v, evtchn_upcall_pending) &&
+                        !vcpu_info(v, evtchn_upcall_mask)); */
+        return 0;
+}
+
+int local_event_delivery_is_enabled(void);
+
+static inline void local_event_delivery_disable(void)
+{
+    /* TODO current->vcpu_info->evtchn_upcall_mask = 1; */
+}
+
+static inline void local_event_delivery_enable(void)
+{
+    /* TODO current->vcpu_info->evtchn_upcall_mask = 0; */
+}
+
+/* No arch specific virq definition now. Default to global. */
+static inline int arch_virq_is_global(int virq)
+{
+    return 1;
+}
+
+#endif
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/flushtlb.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/flushtlb.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,31 @@
+#ifndef __FLUSHTLB_H__
+#define __FLUSHTLB_H__
+
+#include <xen/cpumask.h>
+
+/*
+ * Filter the given set of CPUs, removing those that definitely flushed their
+ * TLB since @page_timestamp.
+ */
+/* XXX lazy implementation just doesn't clear anything.... */
+#define tlbflush_filter(mask, page_timestamp)                           \
+do {                                                                    \
+} while ( 0 )
+
+#define tlbflush_current_time()                 (0)
+
+/* Flush local TLBs */
+void flush_tlb_local(void);
+
+/* Flush specified CPUs' TLBs */
+void flush_tlb_mask(const cpumask_t *mask);
+
+#endif /* __FLUSHTLB_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/grant_table.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/grant_table.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,35 @@
+#ifndef __ASM_GRANT_TABLE_H__
+#define __ASM_GRANT_TABLE_H__
+
+#include <xen/grant_table.h>
+
+#define INVALID_GFN (-1UL)
+#define INITIAL_NR_GRANT_FRAMES 1
+
+void gnttab_clear_flag(unsigned long nr, uint16_t *addr);
+int create_grant_host_mapping(unsigned long gpaddr,
+        unsigned long mfn, unsigned int flags, unsigned int
+        cache_flags);
+#define gnttab_host_mapping_get_page_type(op, d, rd) (0)
+int replace_grant_host_mapping(unsigned long gpaddr, unsigned long mfn,
+        unsigned long new_gpaddr, unsigned int flags);
+void gnttab_mark_dirty(struct domain *d, unsigned long l);
+#define gnttab_create_status_page(d, t, i) do {} while (0)
+#define gnttab_create_shared_page(d, t, i) do {} while (0)
+#define gnttab_shared_gmfn(d, t, i) (0)
+#define gnttab_status_gmfn(d, t, i) (0)
+#define gnttab_release_host_mappings(domain) 1
+static inline int replace_grant_supported(void)
+{
+    return 1;
+}
+
+#endif /* __ASM_GRANT_TABLE_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/hardirq.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/hardirq.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,28 @@
+#ifndef __ASM_HARDIRQ_H
+#define __ASM_HARDIRQ_H
+
+#include <xen/config.h>
+#include <xen/cache.h>
+#include <xen/smp.h>
+
+typedef struct {
+        unsigned long __softirq_pending;
+        unsigned int __local_irq_count;
+} __cacheline_aligned irq_cpustat_t;
+
+#include <xen/irq_cpustat.h>    /* Standard mappings for irq_cpustat_t above */
+
+#define in_irq() (local_irq_count(smp_processor_id()) != 0)
+
+#define irq_enter()     (local_irq_count(smp_processor_id())++)
+#define irq_exit()      (local_irq_count(smp_processor_id())--)
+
+#endif /* __ASM_HARDIRQ_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/hypercall.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/hypercall.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,14 @@
+#ifndef __ASM_ARM_HYPERCALL_H__
+#define __ASM_ARM_HYPERCALL_H__
+
+#include <public/domctl.h> /* for arch_do_domctl */
+
+#endif /* __ASM_ARM_HYPERCALL_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/init.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/init.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,12 @@
+#ifndef _XEN_ASM_INIT_H
+#define _XEN_ASM_INIT_H
+
+#endif /* _XEN_ASM_INIT_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/io.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/io.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,12 @@
+#ifndef _ASM_IO_H
+#define _ASM_IO_H
+
+#endif
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/iocap.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/iocap.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,20 @@
+#ifndef __X86_IOCAP_H__
+#define __X86_IOCAP_H__
+
+#define cache_flush_permitted(d)                        \
+    (!rangeset_is_empty((d)->iomem_caps))
+
+#define multipage_allocation_permitted(d, order)        \
+    (((order) <= 9) || /* allow 2MB superpages */       \
+     !rangeset_is_empty((d)->iomem_caps))
+
+#endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/multicall.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/multicall.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,23 @@
+#ifndef __ASM_ARM_MULTICALL_H__
+#define __ASM_ARM_MULTICALL_H__
+
+#define do_multicall_call(_call)                             \
+    do {                                                     \
+        __asm__ __volatile__ (                               \
+            ".word 0xe7f000f0@; do_multicall_call\n"         \
+            "    mov r0,#0; @ do_multicall_call\n"           \
+            "    str r0, [r0];\n"                            \
+            :                                                \
+            :                                                \
+            : );                                             \
+    } while ( 0 )
+
+#endif /* __ASM_ARM_MULTICALL_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/nmi.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/nmi.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,15 @@
+#ifndef ASM_NMI_H
+#define ASM_NMI_H
+
+#define register_guest_nmi_callback(a)  (-ENOSYS)
+#define unregister_guest_nmi_callback() (-ENOSYS)
+
+#endif /* ASM_NMI_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/numa.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/numa.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,21 @@
+#ifndef __ARCH_ARM_NUMA_H
+#define __ARCH_ARM_NUMA_H
+
+/* Fake one node for now... */
+#define cpu_to_node(cpu) 0
+#define node_to_cpumask(node)  (cpu_online_map)
+
+static inline __attribute__((pure)) int phys_to_nid(paddr_t addr)
+{
+        return 0;
+}
+
+#endif /* __ARCH_ARM_NUMA_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/paging.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/paging.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,13 @@
+#ifndef _XEN_PAGING_H
+#define _XEN_PAGING_H
+
+#endif /* XEN_PAGING_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/pci.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/pci.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,7 @@
+#ifndef __X86_PCI_H__
+#define __X86_PCI_H__
+
+struct arch_pci_dev {
+};
+
+#endif /* __X86_PCI_H__ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/percpu.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/percpu.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,28 @@
+#ifndef __ARM_PERCPU_H__
+#define __ARM_PERCPU_H__
+
+#ifndef __ASSEMBLY__
+extern char __per_cpu_start[], __per_cpu_data_end[];
+extern unsigned long __per_cpu_offset[NR_CPUS];
+void percpu_init_areas(void);
+#endif
+
+/* Separate out the type, so (int[3], foo) works. */
+#define __DEFINE_PER_CPU(type, name, suffix)                    \
+    __attribute__((__section__(".bss.percpu" #suffix)))         \
+    __typeof__(type) per_cpu_##name
+
+#define per_cpu(var, cpu) ((&per_cpu__##var)[cpu?0:0])
+#define __get_cpu_var(var) per_cpu__##var
+
+#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
+
+#endif /* __ARM_PERCPU_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/processor.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/processor.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,269 @@
+#ifndef __ASM_ARM_PROCESSOR_H
+#define __ASM_ARM_PROCESSOR_H
+
+#include <asm/cpregs.h>
+
+/* PSR bits (CPSR, SPSR)*/
+
+/* 0-4: Mode */
+#define PSR_MODE_MASK 0x1f
+#define PSR_MODE_USR 0x10
+#define PSR_MODE_FIQ 0x11
+#define PSR_MODE_IRQ 0x12
+#define PSR_MODE_SVC 0x13
+#define PSR_MODE_MON 0x16
+#define PSR_MODE_ABT 0x17
+#define PSR_MODE_HYP 0x1a
+#define PSR_MODE_UND 0x1b
+#define PSR_MODE_SYS 0x1f
+
+#define PSR_THUMB        (1<<5)        /* Thumb Mode enable */
+#define PSR_FIQ_MASK        (1<<6)        /* Fast Interrupt mask */
+#define PSR_IRQ_MASK        (1<<7)        /* Interrupt mask */
+#define PSR_ABT_MASK         (1<<8)        /* Asynchronous Abort mask */
+#define PSR_BIG_ENDIAN        (1<<9)        /* Big Endian Mode */
+#define PSR_JAZELLE        (1<<24)        /* Jazelle Mode */
+
+/* TTBCR Translation Table Base Control Register */
+#define TTBCR_N_MASK 0x07
+#define TTBCR_N_16KB 0x00
+#define TTBCR_N_8KB  0x01
+#define TTBCR_N_4KB  0x02
+#define TTBCR_N_2KB  0x03
+#define TTBCR_N_1KB  0x04
+
+/* SCTLR System Control Register. */
+/* HSCTLR is a subset of this. */
+#define SCTLR_TE        (1<<30)
+#define SCTLR_AFE        (1<<29)
+#define SCTLR_TRE        (1<<28)
+#define SCTLR_NMFI        (1<<27)
+#define SCTLR_EE        (1<<25)
+#define SCTLR_VE        (1<<24)
+#define SCTLR_U                (1<<22)
+#define SCTLR_FI        (1<<21)
+#define SCTLR_WXN        (1<<19)
+#define SCTLR_HA        (1<<17)
+#define SCTLR_RR        (1<<14)
+#define SCTLR_V                (1<<13)
+#define SCTLR_I                (1<<12)
+#define SCTLR_Z                (1<<11)
+#define SCTLR_SW        (1<<10)
+#define SCTLR_B                (1<<7)
+#define SCTLR_C                (1<<2)
+#define SCTLR_A                (1<<1)
+#define SCTLR_M                (1<<0)
+
+#define SCTLR_BASE        0x00c50078
+#define HSCTLR_BASE        0x30c51878
+
+/* HCR Hyp Configuration Register */
+#define HCR_TGE                (1<<27)
+#define HCR_TVM                (1<<26)
+#define HCR_TTLB        (1<<25)
+#define HCR_TPU                (1<<24)
+#define HCR_TPC                (1<<23)
+#define HCR_TSW                (1<<22)
+#define HCR_TAC                (1<<21)
+#define HCR_TIDCP        (1<<20)
+#define HCR_TSC                (1<<19)
+#define HCR_TID3        (1<<18)
+#define HCR_TID2        (1<<17)
+#define HCR_TID1        (1<<16)
+#define HCR_TID0        (1<<15)
+#define HCR_TWE                (1<<14)
+#define HCR_TWI                (1<<13)
+#define HCR_DC                (1<<12)
+#define HCR_BSU_MASK        (3<<10)
+#define HCR_FB                (1<<9)
+#define HCR_VA                (1<<8)
+#define HCR_VI                (1<<7)
+#define HCR_VF                (1<<6)
+#define HCR_AMO                (1<<5)
+#define HCR_IMO                (1<<4)
+#define HCR_FMO                (1<<3)
+#define HCR_PTW                (1<<2)
+#define HCR_SWIO        (1<<1)
+#define HCR_VM                (1<<0)
+
+#define HSR_EC_WFI_WFE              0x01
+#define HSR_EC_CP15_32              0x03
+#define HSR_EC_CP15_64              0x04
+#define HSR_EC_CP14_32              0x05
+#define HSR_EC_CP14_DBG             0x06
+#define HSR_EC_CP                   0x07
+#define HSR_EC_CP10                 0x08
+#define HSR_EC_JAZELLE              0x09
+#define HSR_EC_BXJ                  0x0a
+#define HSR_EC_CP14_64              0x0c
+#define HSR_EC_SVC                  0x11
+#define HSR_EC_HVC                  0x12
+#define HSR_EC_INSTR_ABORT_GUEST    0x20
+#define HSR_EC_INSTR_ABORT_HYP      0x21
+#define HSR_EC_DATA_ABORT_GUEST     0x24
+#define HSR_EC_DATA_ABORT_HYP       0x25
+
+#ifndef __ASSEMBLY__
+union hsr {
+    uint32_t bits;
+    struct {
+        unsigned long iss:25;  /* Instruction Specific Syndrome */
+        unsigned long len:1;   /* Instruction length */
+        unsigned long ec:6;    /* Exception Class */
+    };
+
+    struct hsr_cp32 {
+        unsigned long read:1;  /* Direction */
+        unsigned long crm:4;   /* CRm */
+        unsigned long reg:4;   /* Rt */
+        unsigned long sbzp:1;
+        unsigned long crn:4;   /* CRn */
+        unsigned long op1:3;   /* Op1 */
+        unsigned long op2:3;   /* Op2 */
+        unsigned long cc:4;    /* Condition Code */
+        unsigned long ccvalid:1;/* CC Valid */
+        unsigned long len:1;   /* Instruction length */
+        unsigned long ec:6;    /* Exception Class */
+    } cp32; /* HSR_EC_CP15_32, CP14_32, CP10 */
+
+    struct hsr_cp64 {
+        unsigned long read:1;   /* Direction */
+        unsigned long crm:4;    /* CRm */
+        unsigned long reg1:4;   /* Rt1 */
+        unsigned long sbzp1:1;
+        unsigned long reg2:4;   /* Rt2 */
+        unsigned long sbzp2:2;
+        unsigned long op1:4;   /* Op1 */
+        unsigned long cc:4;    /* Condition Code */
+        unsigned long ccvalid:1;/* CC Valid */
+        unsigned long len:1;   /* Instruction length */
+        unsigned long ec:6;    /* Exception Class */
+    } cp64; /* HSR_EC_CP15_64, HSR_EC_CP14_64 */
+
+    struct hsr_dabt {
+        unsigned long dfsc:6;  /* Data Fault Status Code */
+        unsigned long write:1; /* Write / not Read */
+        unsigned long s1ptw:1; /* */
+        unsigned long cache:1; /* Cache Maintenance */
+        unsigned long eat:1;   /* External Abort Type */
+        unsigned long sbzp0:6;
+        unsigned long reg:4;   /* Register */
+        unsigned long sbzp1:1;
+        unsigned long sign:1;  /* Sign extend */
+        unsigned long size:2;  /* Access Size */
+        unsigned long valid:1; /* Syndrome Valid */
+        unsigned long len:1;   /* Instruction length */
+        unsigned long ec:6;    /* Exception Class */
+    } dabt; /* HSR_EC_DATA_ABORT_* */
+};
+#endif
+
+/* HSR.EC == HSR_CP{15,14,10}_32 */
+#define HSR_CP32_OP2_MASK (0x000e0000)
+#define HSR_CP32_OP2_SHIFT (17)
+#define HSR_CP32_OP1_MASK (0x0001c000)
+#define HSR_CP32_OP1_SHIFT (14)
+#define HSR_CP32_CRN_MASK (0x00003c00)
+#define HSR_CP32_CRN_SHIFT (10)
+#define HSR_CP32_CRM_MASK (0x0000001e)
+#define HSR_CP32_CRM_SHIFT (1)
+#define HSR_CP32_REGS_MASK (HSR_CP32_OP1_MASK|HSR_CP32_OP2_MASK|\
+                            HSR_CP32_CRN_MASK|HSR_CP32_CRM_MASK)
+
+/* HSR.EC == HSR_CP{15,14}_64 */
+#define HSR_CP64_OP1_MASK (0x000f0000)
+#define HSR_CP64_OP1_SHIFT (16)
+#define HSR_CP64_CRM_MASK (0x0000001e)
+#define HSR_CP64_CRM_SHIFT (1)
+#define HSR_CP64_REGS_MASK (HSR_CP64_OP1_MASK|HSR_CP64_CRM_MASK)
+
+/* Physical Address Register */
+#define PAR_F           (1<<0)
+
+/* .... If F == 1 */
+#define PAR_FSC_SHIFT   (1)
+#define PAR_FSC_MASK    (0x3f<<PAR_FSC_SHIFT)
+#define PAR_STAGE21     (1<<8)     /* Stage 2 Fault During Stage 1 Walk */
+#define PAR_STAGE2      (1<<9)     /* Stage 2 Fault */
+
+/* If F == 0 */
+#define PAR_MAIR_SHIFT  56                       /* Memory Attributes */
+#define PAR_MAIR_MASK   (0xffLL<<PAR_MAIR_SHIFT)
+#define PAR_NS          (1<<9)                   /* Non-Secure */
+#define PAR_SH_SHIFT    7                        /* Shareability */
+#define PAR_SH_MASK     (3<<PAR_SH_SHIFT)
+
+/* Fault Status Register */
+/*
+ * 543210 BIT
+ * 00XXLL -- XX Fault Level LL
+ * ..01LL -- Translation Fault LL
+ * ..10LL -- Access Fault LL
+ * ..11LL -- Permission Fault LL
+ * 01xxxx -- Abort/Parity
+ * 10xxxx -- Other
+ * 11xxxx -- Implementation Defined
+ */
+#define FSC_TYPE_MASK (0x3<<4)
+#define FSC_TYPE_FAULT (0x00<<4)
+#define FSC_TYPE_ABT   (0x01<<4)
+#define FSC_TYPE_OTH   (0x02<<4)
+#define FSC_TYPE_IMPL  (0x03<<4)
+
+#define FSC_FLT_TRANS  (0x04)
+#define FSC_FLT_ACCESS (0x08)
+#define FSC_FLT_PERM   (0x0c)
+#define FSC_SEA        (0x10) /* Synchronous External Abort */
+#define FSC_SPE        (0x18) /* Memory Access Synchronous Parity Error */
+#define FSC_APE        (0x11) /* Memory Access Asynchronous Parity Error */
+#define FSC_SEATT      (0x14) /* Sync. Ext. Abort Translation Table */
+#define FSC_SPETT      (0x1c) /* Sync. Parity. Error Translation Table */
+#define FSC_AF         (0x21) /* Alignment Fault */
+#define FSC_DE         (0x22) /* Debug Event */
+#define FSC_LKD        (0x34) /* Lockdown Abort */
+#define FSC_CPR        (0x3a) /* Coprocossor Abort */
+
+#define FSC_LL_MASK    (0x03<<0)
+
+/* Time counter hypervisor control register */
+#define CNTHCTL_PA      (1u<<0)  /* Kernel/user access to physical counter */
+#define CNTHCTL_TA      (1u<<1)  /* Kernel/user access to CNTP timer */
+
+/* Timer control registers */
+#define CNTx_CTL_ENABLE   (1u<<0)  /* Enable timer */
+#define CNTx_CTL_MASK     (1u<<1)  /* Mask IRQ */
+#define CNTx_CTL_PENDING  (1u<<2)  /* IRQ pending */
+
+/* CPUID bits */
+#define ID_PFR1_GT_MASK  0x000F0000  /* Generic Timer interface support */
+#define ID_PFR1_GT_v1    0x00010000
+
+#define MSR(reg,val)        asm volatile ("msr "#reg", %0\n" : : "r" (val))
+#define MRS(val,reg)        asm volatile ("mrs %0,"#reg"\n" : "=r" (v))
+
+#ifndef __ASSEMBLY__
+extern uint32_t hyp_traps_vector[8];
+
+void panic_PAR(uint64_t par, const char *when);
+
+void show_execution_state(struct cpu_user_regs *regs);
+void show_registers(struct cpu_user_regs *regs);
+//#define dump_execution_state() run_in_exception_handler(show_execution_state)
+#define dump_execution_state() asm volatile (".word 0xe7f000f0\n"); /* XXX */
+
+#define cpu_relax() barrier() /* Could yield? */
+
+/* All a bit UP for the moment */
+#define cpu_to_core(_cpu)   (0)
+#define cpu_to_socket(_cpu) (0)
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ASM_ARM_PROCESSOR_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/regs.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/regs.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,43 @@
+#ifndef __ARM_REGS_H__
+#define __ARM_REGS_H__
+
+#include <xen/types.h>
+#include <public/xen.h>
+#include <asm/processor.h>
+
+#define psr_mode(psr,m) (((psr) & PSR_MODE_MASK) == m)
+
+#define usr_mode(r)     psr_mode((r)->cpsr,PSR_MODE_USR)
+#define fiq_mode(r)     psr_mode((r)->cpsr,PSR_MODE_FIQ)
+#define irq_mode(r)     psr_mode((r)->cpsr,PSR_MODE_IRQ)
+#define svc_mode(r)     psr_mode((r)->cpsr,PSR_MODE_SVC)
+#define mon_mode(r)     psr_mode((r)->cpsr,PSR_MODE_MON)
+#define abt_mode(r)     psr_mode((r)->cpsr,PSR_MODE_ABT)
+#define hyp_mode(r)     psr_mode((r)->cpsr,PSR_MODE_HYP)
+#define und_mode(r)     psr_mode((r)->cpsr,PSR_MODE_UND)
+#define sys_mode(r)     psr_mode((r)->cpsr,PSR_MODE_SYS)
+
+#define guest_mode(r)                                                         \
+({                                                                            \
+    unsigned long diff = (char *)guest_cpu_user_regs() - (char *)(r);         \
+    /* Frame pointer must point into current CPU stack. */                    \
+    ASSERT(diff < STACK_SIZE);                                                \
+    /* If not a guest frame, it must be a hypervisor frame. */                \
+    ASSERT((diff == 0) || hyp_mode(r));                                       \
+    /* Return TRUE if it's a guest frame. */                                  \
+    (diff == 0);                                                              \
+})
+
+#define return_reg(v) ((v)->arch.user_regs.r0)
+
+#define CTXT_SWITCH_STACK_BYTES (sizeof(struct cpu_user_regs))
+
+#endif /* __ARM_REGS_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/setup.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/setup.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,16 @@
+#ifndef __ARM_SETUP_H_
+#define __ARM_SETUP_H_
+
+#include <public/version.h>
+
+void arch_get_xen_caps(xen_capabilities_info_t *info);
+
+#endif
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/smp.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/smp.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,25 @@
+#ifndef __ASM_SMP_H
+#define __ASM_SMP_H
+
+#ifndef __ASSEMBLY__
+#include <xen/config.h>
+#include <xen/cpumask.h>
+#include <asm/current.h>
+#endif
+
+DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_mask);
+DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
+
+#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
+
+#define raw_smp_processor_id() (get_processor_id())
+
+#endif
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/softirq.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/softirq.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,15 @@
+#ifndef __ASM_SOFTIRQ_H__
+#define __ASM_SOFTIRQ_H__
+
+#define VGIC_SOFTIRQ        (NR_COMMON_SOFTIRQS + 0)
+#define NR_ARCH_SOFTIRQS       1
+
+#endif /* __ASM_SOFTIRQ_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/spinlock.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/spinlock.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,144 @@
+#ifndef __ASM_SPINLOCK_H
+#define __ASM_SPINLOCK_H
+
+#include <xen/config.h>
+#include <xen/lib.h>
+
+static inline void dsb_sev(void)
+{
+    __asm__ __volatile__ (
+        "dsb\n"
+        "sev\n"
+        );
+}
+
+typedef struct {
+    volatile unsigned int lock;
+} raw_spinlock_t;
+
+#define _RAW_SPIN_LOCK_UNLOCKED { 0 }
+
+#define _raw_spin_is_locked(x)          ((x)->lock != 0)
+
+static always_inline void _raw_spin_unlock(raw_spinlock_t *lock)
+{
+    ASSERT(_raw_spin_is_locked(lock));
+
+    smp_mb();
+
+    __asm__ __volatile__(
+"   str     %1, [%0]\n"
+    :
+    : "r" (&lock->lock), "r" (0)
+    : "cc");
+
+    dsb_sev();
+}
+
+static always_inline int _raw_spin_trylock(raw_spinlock_t *lock)
+{
+    unsigned long tmp;
+
+    __asm__ __volatile__(
+"   ldrex   %0, [%1]\n"
+"   teq     %0, #0\n"
+"   strexeq %0, %2, [%1]"
+    : "=&r" (tmp)
+    : "r" (&lock->lock), "r" (1)
+    : "cc");
+
+    if (tmp == 0) {
+        smp_mb();
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+typedef struct {
+    volatile unsigned int lock;
+} raw_rwlock_t;
+
+#define _RAW_RW_LOCK_UNLOCKED { 0 }
+
+static always_inline int _raw_read_trylock(raw_rwlock_t *rw)
+{
+    unsigned long tmp, tmp2 = 1;
+
+    __asm__ __volatile__(
+"1: ldrex   %0, [%2]\n"
+"   adds    %0, %0, #1\n"
+"   strexpl %1, %0, [%2]\n"
+    : "=&r" (tmp), "+r" (tmp2)
+    : "r" (&rw->lock)
+    : "cc");
+
+    smp_mb();
+    return tmp2 == 0;
+}
+
+static always_inline int _raw_write_trylock(raw_rwlock_t *rw)
+{
+    unsigned long tmp;
+
+    __asm__ __volatile__(
+"1: ldrex   %0, [%1]\n"
+"   teq     %0, #0\n"
+"   strexeq %0, %2, [%1]"
+    : "=&r" (tmp)
+    : "r" (&rw->lock), "r" (0x80000000)
+    : "cc");
+
+    if (tmp == 0) {
+        smp_mb();
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+static inline void _raw_read_unlock(raw_rwlock_t *rw)
+{
+    unsigned long tmp, tmp2;
+
+    smp_mb();
+
+    __asm__ __volatile__(
+"1: ldrex   %0, [%2]\n"
+"   sub     %0, %0, #1\n"
+"   strex   %1, %0, [%2]\n"
+"   teq     %1, #0\n"
+"   bne     1b"
+    : "=&r" (tmp), "=&r" (tmp2)
+    : "r" (&rw->lock)
+    : "cc");
+
+    if (tmp == 0)
+        dsb_sev();
+}
+
+static inline void _raw_write_unlock(raw_rwlock_t *rw)
+{
+    smp_mb();
+
+    __asm__ __volatile__(
+    "str    %1, [%0]\n"
+    :
+    : "r" (&rw->lock), "r" (0)
+    : "cc");
+
+    dsb_sev();
+}
+
+#define _raw_rw_is_locked(x) ((x)->lock != 0)
+#define _raw_rw_is_write_locked(x) ((x)->lock == 0x80000000)
+
+#endif /* __ASM_SPINLOCK_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/string.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/string.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,38 @@
+#ifndef __ARM_STRING_H__
+#define __ARM_STRING_H__
+
+#include <xen/config.h>
+
+#define __HAVE_ARCH_MEMCPY
+extern void * memcpy(void *, const void *, __kernel_size_t);
+
+/* Some versions of gcc don't have this builtin. It's non-critical anyway. */
+#define __HAVE_ARCH_MEMMOVE
+extern void *memmove(void *dest, const void *src, size_t n);
+
+#define __HAVE_ARCH_MEMSET
+extern void * memset(void *, int, __kernel_size_t);
+
+extern void __memzero(void *ptr, __kernel_size_t n);
+
+#define memset(p,v,n)                                                   \
+        ({                                                              \
+                void *__p = (p); size_t __n = n;                        \
+                if ((__n) != 0) {                                       \
+                        if (__builtin_constant_p((v)) && (v) == 0)      \
+                                __memzero((__p),(__n));                 \
+                        else                                            \
+                                memset((__p),(v),(__n));                \
+                }                                                       \
+                (__p);                                                  \
+        })
+
+#endif /* __ARM_STRING_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/system.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/system.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,202 @@
+/* Portions taken from Linux arch arm */
+#ifndef __ASM_SYSTEM_H
+#define __ASM_SYSTEM_H
+
+#include <xen/lib.h>
+#include <asm/processor.h>
+
+#define nop() \
+    asm volatile ( "nop" )
+
+#define xchg(ptr,x) \
+        ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
+
+#define isb() __asm__ __volatile__ ("isb" : : : "memory")
+#define dsb() __asm__ __volatile__ ("dsb" : : : "memory")
+#define dmb() __asm__ __volatile__ ("dmb" : : : "memory")
+
+#define mb()            dsb()
+#define rmb()           dsb()
+#define wmb()           mb()
+
+#define smp_mb()        dmb()
+#define smp_rmb()       dmb()
+#define smp_wmb()       dmb()
+
+/*
+ * This is used to ensure the compiler did actually allocate the register we
+ * asked it for some inline assembly sequences.  Apparently we can't trust
+ * the compiler from one version to another so a bit of paranoia won't hurt.
+ * This string is meant to be concatenated with the inline asm string and
+ * will cause compilation to stop on mismatch.
+ * (for details, see gcc PR 15089)
+ */
+#define __asmeq(x, y)  ".ifnc " x "," y " ; .err ; .endif\n\t"
+
+extern void __bad_xchg(volatile void *, int);
+
+static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
+{
+        unsigned long ret;
+        unsigned int tmp;
+
+        smp_mb();
+
+        switch (size) {
+        case 1:
+                asm volatile("@ __xchg1\n"
+                "1:     ldrexb  %0, [%3]\n"
+                "       strexb  %1, %2, [%3]\n"
+                "       teq     %1, #0\n"
+                "       bne     1b"
+                        : "=&r" (ret), "=&r" (tmp)
+                        : "r" (x), "r" (ptr)
+                        : "memory", "cc");
+                break;
+        case 4:
+                asm volatile("@ __xchg4\n"
+                "1:     ldrex   %0, [%3]\n"
+                "       strex   %1, %2, [%3]\n"
+                "       teq     %1, #0\n"
+                "       bne     1b"
+                        : "=&r" (ret), "=&r" (tmp)
+                        : "r" (x), "r" (ptr)
+                        : "memory", "cc");
+                break;
+        default:
+                __bad_xchg(ptr, size), ret = 0;
+                break;
+        }
+        smp_mb();
+
+        return ret;
+}
+
+/*
+ * Atomic compare and exchange.  Compare OLD with MEM, if identical,
+ * store NEW in MEM.  Return the initial value in MEM.  Success is
+ * indicated by comparing RETURN with OLD.
+ */
+
+extern void __bad_cmpxchg(volatile void *ptr, int size);
+
+static always_inline unsigned long __cmpxchg(
+    volatile void *ptr, unsigned long old, unsigned long new, int size)
+{
+    unsigned long /*long*/ oldval, res;
+
+    switch (size) {
+    case 1:
+        do {
+            asm volatile("@ __cmpxchg1\n"
+                         "       ldrexb  %1, [%2]\n"
+                         "       mov     %0, #0\n"
+                         "       teq     %1, %3\n"
+                         "       strexbeq %0, %4, [%2]\n"
+                         : "=&r" (res), "=&r" (oldval)
+                         : "r" (ptr), "Ir" (old), "r" (new)
+                         : "memory", "cc");
+        } while (res);
+        break;
+    case 2:
+        do {
+            asm volatile("@ __cmpxchg2\n"
+                         "       ldrexh  %1, [%2]\n"
+                         "       mov     %0, #0\n"
+                         "       teq     %1, %3\n"
+                         "       strexheq %0, %4, [%2]\n"
+                         : "=&r" (res), "=&r" (oldval)
+                         : "r" (ptr), "Ir" (old), "r" (new)
+                         : "memory", "cc");
+        } while (res);
+        break;
+    case 4:
+        do {
+            asm volatile("@ __cmpxchg4\n"
+                         "       ldrex   %1, [%2]\n"
+                         "       mov     %0, #0\n"
+                         "       teq     %1, %3\n"
+                         "       strexeq %0, %4, [%2]\n"
+                         : "=&r" (res), "=&r" (oldval)
+                         : "r" (ptr), "Ir" (old), "r" (new)
+                         : "memory", "cc");
+        } while (res);
+        break;
+#if 0
+    case 8:
+        do {
+            asm volatile("@ __cmpxchg8\n"
+                         "       ldrexd   %1, [%2]\n"
+                         "       mov      %0, #0\n"
+                         "       teq      %1, %3\n"
+                         "       strexdeq %0, %4, [%2]\n"
+                         : "=&r" (res), "=&r" (oldval)
+                         : "r" (ptr), "Ir" (old), "r" (new)
+                         : "memory", "cc");
+        } while (res);
+        break;
+#endif
+    default:
+        __bad_cmpxchg(ptr, size);
+        oldval = 0;
+    }
+
+    return oldval;
+}
+#define cmpxchg(ptr,o,n)                                                \
+    ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),            \
+                                   (unsigned long)(n),sizeof(*(ptr))))
+
+#define local_irq_disable() asm volatile ( "cpsid i @ local_irq_disable\n" : : : "cc" )
+#define local_irq_enable()  asm volatile ( "cpsie i @ local_irq_enable\n" : : : "cc" )
+
+#define local_save_flags(x)                                      \
+({                                                               \
+    BUILD_BUG_ON(sizeof(x) != sizeof(long));                     \
+    asm volatile ( "mrs %0, cpsr     @ local_save_flags\n"       \
+                  : "=r" (x) :: "memory", "cc" );                \
+})
+#define local_irq_save(x)                                        \
+({                                                               \
+    local_save_flags(x);                                         \
+    local_irq_disable();                                         \
+})
+#define local_irq_restore(x)                                     \
+({                                                               \
+    BUILD_BUG_ON(sizeof(x) != sizeof(long));                     \
+    asm volatile (                                               \
+            "msr     cpsr_c, %0      @ local_irq_restore\n"      \
+            :                                                    \
+            : "r" (flags)                                        \
+            : "memory", "cc");                                   \
+})
+
+static inline int local_irq_is_enabled(void)
+{
+    unsigned long flags;
+    local_save_flags(flags);
+    return !(flags & PSR_IRQ_MASK);
+}
+
+#define local_fiq_enable()  __asm__("cpsie f   @ __stf\n" : : : "memory", "cc")
+#define local_fiq_disable() __asm__("cpsid f   @ __clf\n" : : : "memory", "cc")
+
+#define local_abort_enable() __asm__("cpsie a  @ __sta\n" : : : "memory", "cc")
+#define local_abort_disable() __asm__("cpsid a @ __sta\n" : : : "memory", "cc")
+
+static inline int local_fiq_is_enabled(void)
+{
+    unsigned long flags;
+    local_save_flags(flags);
+    return !!(flags & PSR_FIQ_MASK);
+}
+
+#endif
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/trace.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/trace.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,12 @@
+#ifndef __ASM_TRACE_H__
+#define __ASM_TRACE_H__
+
+#endif /* __ASM_TRACE_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/types.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/types.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,57 @@
+#ifndef __ARM_TYPES_H__
+#define __ARM_TYPES_H__
+
+#ifndef __ASSEMBLY__
+
+#include <xen/config.h>
+
+typedef __signed__ char __s8;
+typedef unsigned char __u8;
+
+typedef __signed__ short __s16;
+typedef unsigned short __u16;
+
+typedef __signed__ int __s32;
+typedef unsigned int __u32;
+
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+typedef __signed__ long long __s64;
+typedef unsigned long long __u64;
+#endif
+
+typedef signed char s8;
+typedef unsigned char u8;
+
+typedef signed short s16;
+typedef unsigned short u16;
+
+typedef signed int s32;
+typedef unsigned int u32;
+
+typedef signed long long s64;
+typedef unsigned long long u64;
+typedef u64 paddr_t;
+#define INVALID_PADDR (~0ULL)
+#define PRIpaddr "016llx"
+
+typedef unsigned long size_t;
+
+typedef char bool_t;
+#define test_and_set_bool(b)   xchg(&(b), 1)
+#define test_and_clear_bool(b) xchg(&(b), 0)
+
+#endif /* __ASSEMBLY__ */
+
+#define BITS_PER_LONG 32
+#define BYTES_PER_LONG 4
+#define LONG_BYTEORDER 2
+
+#endif /* __ARM_TYPES_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/asm-arm/xenoprof.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/xenoprof.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,12 @@
+#ifndef __ASM_XENOPROF_H__
+#define __ASM_XENOPROF_H__
+
+#endif /* __ASM_XENOPROF_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/public/arch-arm.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/public/arch-arm.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,125 @@
+/******************************************************************************
+ * arch-arm.h
+ *
+ * Guest OS interface to ARM Xen.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright 2011 (C) Citrix Systems
+ */
+
+#ifndef __XEN_PUBLIC_ARCH_ARM_H__
+#define __XEN_PUBLIC_ARCH_ARM_H__
+
+#ifndef __ASSEMBLY__
+#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
+    typedef struct { type *p; } __guest_handle_ ## name
+
+#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
+    ___DEFINE_XEN_GUEST_HANDLE(name, type);   \
+    ___DEFINE_XEN_GUEST_HANDLE(const_##name, const type)
+#define DEFINE_XEN_GUEST_HANDLE(name)   __DEFINE_XEN_GUEST_HANDLE(name, name)
+#define __XEN_GUEST_HANDLE(name)        __guest_handle_ ## name
+#define XEN_GUEST_HANDLE(name)          __XEN_GUEST_HANDLE(name)
+#define set_xen_guest_handle_raw(hnd, val)  do { (hnd).p = val; } while (0)
+#ifdef __XEN_TOOLS__
+#define get_xen_guest_handle(val, hnd)  do { val = (hnd).p; } while (0)
+#endif
+#define set_xen_guest_handle(hnd, val) set_xen_guest_handle_raw(hnd, val)
+
+struct cpu_user_regs
+{
+    uint32_t r0;
+    uint32_t r1;
+    uint32_t r2;
+    uint32_t r3;
+    uint32_t r4;
+    uint32_t r5;
+    uint32_t r6;
+    uint32_t r7;
+    uint32_t r8;
+    uint32_t r9;
+    uint32_t r10;
+    union {
+        uint32_t r11;
+        uint32_t fp;
+    };
+    uint32_t r12;
+
+    uint32_t sp; /* r13 - SP: Valid for Hyp. frames only, o/w banked (see below) */
+    uint32_t lr; /* r14 - LR: Valid for Hyp. Same physical register as lr_usr. */
+
+    uint32_t pc; /* Return IP */
+    uint32_t cpsr; /* Return mode */
+    uint32_t pad0; /* Doubleword-align the kernel half of the frame */
+
+    /* Outer guest frame only from here on... */
+
+    uint32_t r8_fiq, r9_fiq, r10_fiq, r11_fiq, r12_fiq;
+
+    uint32_t sp_usr, sp_svc, sp_abt, sp_und, sp_irq, sp_fiq;
+    uint32_t lr_usr, lr_svc, lr_abt, lr_und, lr_irq, lr_fiq;
+
+    uint32_t spsr_svc, spsr_abt, spsr_und, spsr_irq, spsr_fiq;
+};
+typedef struct cpu_user_regs cpu_user_regs_t;
+DEFINE_XEN_GUEST_HANDLE(cpu_user_regs_t);
+
+typedef uint64_t xen_pfn_t;
+#define PRI_xen_pfn PRIx64
+
+/* Maximum number of virtual CPUs in legacy multi-processor guests. */
+/* Only one. All other VCPUS must use VCPUOP_register_vcpu_info */
+#define XEN_LEGACY_MAX_VCPUS 1
+
+typedef uint32_t xen_ulong_t;
+
+struct vcpu_guest_context {
+    struct cpu_user_regs user_regs;         /* User-level CPU registers     */
+    union {
+        uint32_t reg[16];
+        struct {
+            uint32_t __pad[12];
+            uint32_t sp; /* r13 */
+            uint32_t lr; /* r14 */
+            uint32_t pc; /* r15 */
+        };
+    };
+};
+typedef struct vcpu_guest_context vcpu_guest_context_t;
+DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
+
+struct arch_vcpu_info { };
+typedef struct arch_vcpu_info arch_vcpu_info_t;
+
+struct arch_shared_info { };
+typedef struct arch_shared_info arch_shared_info_t;
+#endif
+
+#endif /*  __XEN_PUBLIC_ARCH_ARM_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r dcb04595033b -r 46adf08254f9 xen/include/public/xen.h
--- a/xen/include/public/xen.h	Thu Feb 09 11:33:29 2012 +0000
+++ b/xen/include/public/xen.h	Thu Feb 09 11:33:29 2012 +0000
@@ -33,6 +33,8 @@
 #include "arch-x86/xen.h"
 #elif defined(__ia64__)
 #include "arch-ia64.h"
+#elif defined(__arm__)
+#include "arch-arm.h"
 #else
 #error "Unsupported architecture"
 #endif

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:39 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQG-00061H-VI; Thu, 09 Feb 2012 16:00:36 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQF-0005zI-8N
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:35 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-216.messagelabs.com!1328803227!13282820!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21372 invoked from network); 9 Feb 2012 16:00:28 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:28 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ6-0004P7-UJ
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:26 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ6-00066v-Fp
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:26 +0000
Message-Id: <E1RvWQ6-00066v-Fp@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:25 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: entry.S and head.S
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787209 0
# Node ID 0d42f7875293ff128f377fa5ec5fdca9c4237dae
# Parent  227302111affce41568ff02ab9d7fa91ae2a4e8d
arm: entry.S and head.S

Low level assembly routines, including entry.S and head.S.
Also the linker script and a collection of dummy functions that we plan
to reduce to zero as soon as possible.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 227302111aff -r 0d42f7875293 xen/arch/arm/asm-offsets.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/asm-offsets.c	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,76 @@
+/*
+ * Generate definitions needed by assembly language modules.
+ * This code generates raw asm output which is post-processed
+ * to extract and format the required data.
+ */
+#define COMPILE_OFFSETS
+
+#include <xen/config.h>
+#include <xen/types.h>
+#include <public/xen.h>
+#include <asm/current.h>
+
+#define DEFINE(_sym, _val) \
+    __asm__ __volatile__ ( "\n->" #_sym " %0 " #_val : : "i" (_val) )
+#define BLANK() \
+    __asm__ __volatile__ ( "\n->" : : )
+#define OFFSET(_sym, _str, _mem) \
+    DEFINE(_sym, offsetof(_str, _mem));
+
+/* base-2 logarithm */
+#define __L2(_x)  (((_x) & 0x00000002) ?   1 : 0)
+#define __L4(_x)  (((_x) & 0x0000000c) ? ( 2 + __L2( (_x)>> 2)) : __L2( _x))
+#define __L8(_x)  (((_x) & 0x000000f0) ? ( 4 + __L4( (_x)>> 4)) : __L4( _x))
+#define __L16(_x) (((_x) & 0x0000ff00) ? ( 8 + __L8( (_x)>> 8)) : __L8( _x))
+#define LOG_2(_x) (((_x) & 0xffff0000) ? (16 + __L16((_x)>>16)) : __L16(_x))
+
+void __dummy__(void)
+{
+   OFFSET(UREGS_sp, struct cpu_user_regs, sp);
+   OFFSET(UREGS_lr, struct cpu_user_regs, lr);
+   OFFSET(UREGS_pc, struct cpu_user_regs, pc);
+   OFFSET(UREGS_cpsr, struct cpu_user_regs, cpsr);
+
+   OFFSET(UREGS_LR_usr, struct cpu_user_regs, lr_usr);
+   OFFSET(UREGS_SP_usr, struct cpu_user_regs, sp_usr);
+
+   OFFSET(UREGS_SP_svc, struct cpu_user_regs, sp_svc);
+   OFFSET(UREGS_LR_svc, struct cpu_user_regs, lr_svc);
+   OFFSET(UREGS_SPSR_svc, struct cpu_user_regs, spsr_svc);
+
+   OFFSET(UREGS_SP_abt, struct cpu_user_regs, sp_abt);
+   OFFSET(UREGS_LR_abt, struct cpu_user_regs, lr_abt);
+   OFFSET(UREGS_SPSR_abt, struct cpu_user_regs, spsr_abt);
+
+   OFFSET(UREGS_SP_und, struct cpu_user_regs, sp_und);
+   OFFSET(UREGS_LR_und, struct cpu_user_regs, lr_und);
+   OFFSET(UREGS_SPSR_und, struct cpu_user_regs, spsr_und);
+
+   OFFSET(UREGS_SP_irq, struct cpu_user_regs, sp_irq);
+   OFFSET(UREGS_LR_irq, struct cpu_user_regs, lr_irq);
+   OFFSET(UREGS_SPSR_irq, struct cpu_user_regs, spsr_irq);
+
+   OFFSET(UREGS_SP_fiq, struct cpu_user_regs, sp_fiq);
+   OFFSET(UREGS_LR_fiq, struct cpu_user_regs, lr_fiq);
+   OFFSET(UREGS_SPSR_fiq, struct cpu_user_regs, spsr_fiq);
+
+   OFFSET(UREGS_R8_fiq, struct cpu_user_regs, r8_fiq);
+   OFFSET(UREGS_R9_fiq, struct cpu_user_regs, r9_fiq);
+   OFFSET(UREGS_R10_fiq, struct cpu_user_regs, r10_fiq);
+   OFFSET(UREGS_R11_fiq, struct cpu_user_regs, r11_fiq);
+   OFFSET(UREGS_R12_fiq, struct cpu_user_regs, r12_fiq);
+
+   OFFSET(UREGS_kernel_sizeof, struct cpu_user_regs, cpsr);
+   DEFINE(UREGS_user_sizeof, sizeof(struct cpu_user_regs));
+   BLANK();
+
+   DEFINE(CPUINFO_sizeof, sizeof(struct cpu_info));
+}
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 227302111aff -r 0d42f7875293 xen/arch/arm/dummy.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/dummy.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,72 @@
+/* Nothing is mapped at 1G, for the moment */
+#define DUMMY(x) \
+       .globl x; \
+x:     .word 0xe7f000f0
+/* x:  mov r0, #0x40000000 ; str r0, [r0]; b x */
+
+#define  NOP(x) \
+       .globl x; \
+x:     mov pc, lr
+
+DUMMY(alloc_pirq_struct);
+DUMMY(alloc_vcpu_guest_context);
+DUMMY(arch_do_domctl);
+DUMMY(arch_do_sysctl);
+DUMMY(arch_do_vcpu_op);
+DUMMY(arch_get_info_guest);
+DUMMY(arch_get_xen_caps);
+DUMMY(arch_memory_op);
+DUMMY(arch_set_info_guest);
+DUMMY(arch_vcpu_reset);
+DUMMY(create_grant_host_mapping);
+DUMMY(__cpu_die);
+DUMMY(__cpu_disable);
+DUMMY(__cpu_up);
+DUMMY(do_get_pm_info);
+DUMMY(domain_get_maximum_gpfn);
+DUMMY(domain_relinquish_resources);
+DUMMY(domain_set_time_offset);
+DUMMY(dom_cow);
+DUMMY(donate_page);
+DUMMY(do_pm_op);
+DUMMY(flush_tlb_mask);
+DUMMY(free_vcpu_guest_context);
+DUMMY(get_page);
+DUMMY(get_page_type);
+DUMMY(gmfn_to_mfn);
+DUMMY(gnttab_clear_flag);
+DUMMY(gnttab_host_mapping_get_page_type);
+DUMMY(gnttab_mark_dirty);
+DUMMY(hypercall_create_continuation);
+DUMMY(iommu_map_page);
+DUMMY(iommu_unmap_page);
+DUMMY(is_iomem_page);
+DUMMY(local_event_delivery_enable);
+DUMMY(local_events_need_delivery);
+DUMMY(machine_to_phys_mapping_valid);
+DUMMY(max_page);
+DUMMY(node_online_map);
+DUMMY(nr_irqs_gsi);
+DUMMY(p2m_pod_decrease_reservation);
+DUMMY(guest_physmap_mark_populate_on_demand);
+DUMMY(page_get_owner_and_reference);
+DUMMY(page_is_ram_type);
+DUMMY(per_cpu__cpu_core_mask);
+DUMMY(per_cpu__cpu_sibling_mask);
+DUMMY(__per_cpu_offset);
+DUMMY(pirq_guest_bind);
+DUMMY(pirq_guest_unbind);
+DUMMY(pirq_set_affinity);
+DUMMY(put_page);
+DUMMY(put_page_type);
+DUMMY(replace_grant_host_mapping);
+DUMMY(send_timer_event);
+DUMMY(share_xen_page_with_privileged_guests);
+DUMMY(smp_send_state_dump);
+DUMMY(steal_page);
+DUMMY(sync_vcpu_execstate);
+DUMMY(__udelay);
+NOP(update_vcpu_system_time);
+DUMMY(vcpu_mark_events_pending);
+DUMMY(vcpu_show_execution_state);
+DUMMY(wallclock_time);
diff -r 227302111aff -r 0d42f7875293 xen/arch/arm/entry.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/entry.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,107 @@
+#include <xen/config.h>
+#include <asm/asm_defns.h>
+
+#define SAVE_ONE_BANKED(reg)   mrs r11, reg; str r11, [sp, #UREGS_##reg]
+#define RESTORE_ONE_BANKED(reg)        ldr r11, [sp, #UREGS_##reg]; msr reg, r11
+
+#define SAVE_BANKED(mode) \
+       SAVE_ONE_BANKED(SP_##mode) ; SAVE_ONE_BANKED(LR_##mode) ; SAVE_ONE_BANKED(SPSR_##mode)
+
+#define RESTORE_BANKED(mode) \
+       RESTORE_ONE_BANKED(SP_##mode) ; RESTORE_ONE_BANKED(LR_##mode) ; RESTORE_ONE_BANKED(SPSR_##mode)
+
+#define SAVE_ALL                                                                                       \
+       sub sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */                                      \
+       push {r0-r12}; /* Save R0-R12 */                                                                \
+                                                                                                       \
+       mrs r11, ELR_hyp;               /* ELR_hyp is return address. */                                \
+       str r11, [sp, #UREGS_pc];                                                                       \
+                                                                                                       \
+       str lr, [sp, #UREGS_lr];                                                                        \
+                                                                                                       \
+       add r11, sp, #UREGS_kernel_sizeof+4;                                                            \
+       str r11, [sp, #UREGS_sp];                                                                       \
+                                                                                                       \
+       mrs r11, SPSR_hyp;                                                                              \
+       str r11, [sp, #UREGS_cpsr];                                                                     \
+       and r11, #PSR_MODE_MASK;                                                                        \
+       cmp r11, #PSR_MODE_HYP;                                                                         \
+       blne save_guest_regs
+
+save_guest_regs:
+       ldr r11, [sp, #UREGS_lr]
+       str r11, [sp, #UREGS_LR_usr]
+       ldr r11, =0xffffffff  /* Clobber SP which is only valid for hypervisor frames. */
+       str r11, [sp, #UREGS_sp]
+       SAVE_ONE_BANKED(SP_usr)
+       SAVE_BANKED(svc)
+       SAVE_BANKED(abt)
+       SAVE_BANKED(und)
+       SAVE_BANKED(irq)
+       SAVE_BANKED(fiq)
+       SAVE_ONE_BANKED(R8_fiq); SAVE_ONE_BANKED(R9_fiq); SAVE_ONE_BANKED(R10_fiq)
+       SAVE_ONE_BANKED(R11_fiq); SAVE_ONE_BANKED(R12_fiq);
+       mov pc, lr
+
+#define DEFINE_TRAP_ENTRY(trap)                                                                                \
+       ALIGN;                                                                                          \
+trap_##trap:                                                                                           \
+       SAVE_ALL;                                                                                       \
+       adr lr, return_from_trap;                                                                       \
+       mov r0, sp;                                                                                     \
+       mov r11, sp;                                                                                    \
+       bic sp, #7; /* Align the stack pointer (noop on guest trap) */                                  \
+       b do_trap_##trap
+
+.globl hyp_traps_vector
+       .align 5
+hyp_traps_vector:
+       .word 0                         /* 0x00 - Reset */
+       b trap_undefined_instruction    /* 0x04 - Undefined Instruction */
+       b trap_supervisor_call          /* 0x08 - Supervisor Call */
+       b trap_prefetch_abort           /* 0x0c - Prefetch Abort */
+       b trap_data_abort               /* 0x10 - Data Abort */
+       b trap_hypervisor               /* 0x14 - Hypervisor */
+       b trap_irq                      /* 0x18 - IRQ */
+       b trap_fiq                      /* 0x1c - FIQ */
+
+DEFINE_TRAP_ENTRY(undefined_instruction)
+DEFINE_TRAP_ENTRY(supervisor_call)
+DEFINE_TRAP_ENTRY(prefetch_abort)
+DEFINE_TRAP_ENTRY(data_abort)
+DEFINE_TRAP_ENTRY(hypervisor)
+DEFINE_TRAP_ENTRY(irq)
+DEFINE_TRAP_ENTRY(fiq)
+
+ENTRY(return_from_trap)
+       ldr r11, [sp, #UREGS_cpsr]
+       and r11, #PSR_MODE_MASK
+       cmp r11, #PSR_MODE_HYP
+       beq return_to_hypervisor
+
+ENTRY(return_to_guest)
+       mov r11, sp
+       bic sp, #7 /* Align the stack pointer */
+       bl leave_hypervisor_tail
+       ldr r11, [sp, #UREGS_pc]
+       msr ELR_hyp, r11
+       ldr r11, [sp, #UREGS_cpsr]
+       msr SPSR_hyp, r11
+       RESTORE_ONE_BANKED(SP_usr)
+       RESTORE_BANKED(svc)
+       RESTORE_BANKED(abt)
+       RESTORE_BANKED(und)
+       RESTORE_BANKED(irq)
+       RESTORE_BANKED(fiq)
+       RESTORE_ONE_BANKED(R8_fiq); RESTORE_ONE_BANKED(R9_fiq); RESTORE_ONE_BANKED(R10_fiq)
+       RESTORE_ONE_BANKED(R11_fiq); RESTORE_ONE_BANKED(R12_fiq);
+       ldr lr, [sp, #UREGS_LR_usr]
+       pop {r0-r12}
+       add sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */
+       eret
+
+ENTRY(return_to_hypervisor)
+       ldr lr, [sp, #UREGS_lr]
+       pop {r0-r12}
+       add sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */
+       eret
diff -r 227302111aff -r 0d42f7875293 xen/arch/arm/head.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/head.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,298 @@
+/*
+ * xen/arch/arm/head.S
+ *
+ * Start-of-day code for an ARMv7-A with virt extensions.
+ *
+ * Tim Deegan <tim@xen.org>
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <asm/config.h>
+#include <asm/page.h>
+#include <asm/asm_defns.h>
+
+
+/* Macro to print a string to the UART, if there is one.
+ * Clobbers r0-r3. */
+#ifdef EARLY_UART_ADDRESS
+#define PRINT(_s)       \
+       adr   r0, 98f ; \
+       bl    puts    ; \
+       b     99f     ; \
+98:    .asciz _s     ; \
+       .align 2      ; \
+99:
+#else
+#define PRINT(s)
+#endif
+
+       .arm
+
+       /* This must be the very first address in the loaded image.
+        * It should be linked at XEN_VIRT_START, and loaded at any
+        * 2MB-aligned address.  All of text+data+bss must fit in 2MB,
+        * or the initial pagetable code below will need adjustment. */
+       .global start
+start:
+       cpsid aif                    /* Disable all interrupts */
+
+       /* Save the bootloader arguments in less-clobberable registers */
+       mov   r7, r1                 /* r7 := ARM-linux machine type */
+       mov   r8, r2                 /* r8 := ATAG base address */
+
+       /* Find out where we are */
+       ldr   r0, =start
+       adr   r9, start              /* r9  := paddr (start) */
+       sub   r10, r9, r0            /* r10 := phys-offset */
+
+#ifdef EARLY_UART_ADDRESS
+       /* Say hello */
+       ldr   r11, =EARLY_UART_ADDRESS  /* r11 := UART base address */
+       bl    init_uart
+#endif
+
+       /* Check that this CPU has Hyp mode */
+       mrc   CP32(r0, ID_PFR1)
+       and   r0, r0, #0xf000        /* Bits 12-15 define virt extensions */
+       teq   r0, #0x1000            /* Must == 0x1 or may be incompatible */
+       beq   1f
+       bl    putn
+       PRINT("- CPU doesn't support the virtualization extensions -\r\n")
+       b     fail
+1:
+       /* Check if we're already in it */
+       mrs   r0, cpsr
+       and   r0, r0, #0x1f          /* Mode is in the low 5 bits of CPSR */
+       teq   r0, #0x1a              /* Hyp Mode? */
+       bne   1f
+       PRINT("- Started in Hyp mode -\r\n")
+       b     hyp
+1:
+       /* Otherwise, it must have been Secure Supervisor mode */
+       mrc   CP32(r0, SCR)
+       tst   r0, #0x1               /* Not-Secure bit set? */
+       beq   1f
+       PRINT("- CPU is not in Hyp mode or Secure state -\r\n")
+       b     fail
+1:
+       /* OK, we're in Secure state. */
+       PRINT("- Started in Secure state -\r\n- Entering Hyp mode -\r\n")
+
+       /* Dance into Hyp mode */
+       cpsid aif, #0x16             /* Enter Monitor mode */
+       mrc   CP32(r0, SCR)
+       orr   r0, r0, #0x100         /* Set HCE */
+       orr   r0, r0, #0xb1          /* Set SCD, AW, FW and NS */
+       bic   r0, r0, #0xe           /* Clear EA, FIQ and IRQ */
+       mcr   CP32(r0, SCR)
+       /* Ugly: the system timer's frequency register is only
+        * programmable in Secure state.  Since we don't know where its
+        * memory-mapped control registers live, we can't find out the
+        * right frequency.  Use the VE model's default frequency here. */
+       ldr   r0, =0x5f5e100         /* 100 MHz */
+       mcr   CP32(r0, CNTFRQ)
+       ldr   r0, =0x40c00           /* SMP, c11, c10 in non-secure mode */
+       mcr   CP32(r0, NSACR)
+       /* Continuing ugliness: Set up the GIC so NS state owns interrupts */
+       mov   r0, #GIC_BASE_ADDRESS
+       add   r0, r0, #GIC_DR_OFFSET
+       mov   r1, #0
+       str   r1, [r0]               /* Disable delivery in the distributor */
+       add   r0, r0, #0x80          /* GICD_IGROUP0 */
+       mov   r2, #0xffffffff        /* All interrupts to group 1 */
+       str   r2, [r0]
+       str   r2, [r0, #4]
+       str   r2, [r0, #8]
+       /* Must drop priority mask below 0x80 before entering NS state */
+       mov   r0, #GIC_BASE_ADDRESS
+       add   r0, r0, #GIC_CR_OFFSET
+       ldr   r1, =0xff
+       str   r1, [r0, #0x4]         /* -> GICC_PMR */
+       /* Reset a few config registers */
+       mov   r0, #0
+       mcr   CP32(r0, FCSEIDR)
+       mcr   CP32(r0, CONTEXTIDR)
+       /* FIXME: ought to reset some other NS control regs here */
+       adr   r1, 1f
+       adr   r0, hyp                /* Store paddr (hyp entry point) */
+       str   r0, [r1]               /* where we can use it for RFE */
+       isb                          /* Ensure we see the stored target address */
+       rfeia r1                     /* Enter Hyp mode */
+
+1:     .word 0                      /* PC to enter Hyp mode at */
+       .word 0x000001da             /* CPSR: LE, Abort/IRQ/FIQ off, Hyp */
+
+hyp:
+       PRINT("- Setting up control registers -\r\n")
+
+       /* Set up memory attribute type tables */
+       ldr   r0, =MAIR0VAL
+       ldr   r1, =MAIR1VAL
+       mcr   CP32(r0, MAIR0)
+       mcr   CP32(r1, MAIR1)
+       mcr   CP32(r0, HMAIR0)
+       mcr   CP32(r1, HMAIR1)
+
+       /* Set up the HTCR:
+        * PT walks use Outer-Shareable accesses,
+        * PT walks are write-back, no-write-allocate in both cache levels,
+        * Full 32-bit address space goes through this table. */
+       ldr   r0, =0x80002500
+       mcr   CP32(r0, HTCR)
+
+       /* Set up the HSCTLR:
+        * Exceptions in LE ARM,
+        * Low-latency IRQs disabled,
+        * Write-implies-XN disabled (for now),
+        * I-cache and d-cache enabled,
+        * Alignment checking enabled,
+        * MMU translation disabled (for now). */
+       ldr   r0, =(HSCTLR_BASE|SCTLR_A|SCTLR_C)
+       mcr   CP32(r0, HSCTLR)
+
+       /* Write Xen's PT's paddr into the HTTBR */
+       ldr   r4, =xen_pgtable
+       add   r4, r4, r10            /* r4 := paddr (xen_pagetable) */
+       mov   r5, #0                 /* r4:r5 is paddr (xen_pagetable) */
+       mcrr  CP64(r4, r5, HTTBR)
+
+       /* Build the baseline idle pagetable's first-level entries */
+       ldr   r1, =xen_second
+       add   r1, r1, r10            /* r1 := paddr (xen_second) */
+       mov   r3, #0x0
+       orr   r2, r1, #0xe00         /* r2:r3 := table map of xen_second */
+       orr   r2, r2, #0x07f         /* (+ rights for linear PT) */
+       strd  r2, r3, [r4, #0]       /* Map it in slot 0 */
+       add   r2, r2, #0x1000
+       strd  r2, r3, [r4, #8]       /* Map 2nd page in slot 1 */
+       add   r2, r2, #0x1000
+       strd  r2, r3, [r4, #16]      /* Map 3rd page in slot 2 */
+       add   r2, r2, #0x1000
+       strd  r2, r3, [r4, #24]      /* Map 4th page in slot 3 */
+
+       /* Now set up the second-level entries */
+       orr   r2, r9, #0xe00
+       orr   r2, r2, #0x07d         /* r2:r3 := 2MB normal map of Xen */
+       mov   r4, r9, lsr #18        /* Slot for paddr(start) */
+       strd  r2, r3, [r1, r4]       /* Map Xen there */
+       ldr   r4, =start
+       lsr   r4, #18                /* Slot for vaddr(start) */
+       strd  r2, r3, [r1, r4]       /* Map Xen there too */
+#ifdef EARLY_UART_ADDRESS
+       ldr   r3, =(1<<(54-32))      /* NS for device mapping */
+       lsr   r2, r11, #21
+       lsl   r2, r2, #21            /* 2MB-aligned paddr of UART */
+       orr   r2, r2, #0xe00
+       orr   r2, r2, #0x071         /* r2:r3 := 2MB dev map including UART */
+       add   r4, r4, #8
+       strd  r2, r3, [r1, r4]       /* Map it in the fixmap's slot */
+#endif
+
+       PRINT("- Turning on paging -\r\n")
+
+       ldr   r1, =paging            /* Explicit vaddr, not RIP-relative */
+       mrc   CP32(r0, HSCTLR)
+       orr   r0, r0, #0x1           /* Add in the MMU enable bit */
+       dsb                          /* Flush PTE writes and finish reads */
+       mcr   CP32(r0, HSCTLR)       /* now paging is enabled */
+       isb                          /* Now, flush the icache */
+       mov   pc, r1                 /* Get a proper vaddr into PC */
+paging:
+
+#ifdef EARLY_UART_ADDRESS
+       /* Recover the UART address in the new address space */
+       lsl   r11, #11
+       lsr   r11, #11               /* UART base's offset from 2MB base */
+       adr   r0, start
+       add   r0, r0, #0x200000      /* vaddr of the fixmap's 2MB slot */
+       add   r11, r11, r0           /* r11 := vaddr (UART base address) */
+#endif
+
+       PRINT("- Entering C -\r\n")
+
+       ldr   sp, =init_stack        /* Supply a stack */
+       add   sp, #STACK_SIZE        /* (which grows down from the top). */
+       sub   sp, #CPUINFO_sizeof    /* Make room for CPU save record */
+       mov   r0, r10                /* Marshal args: - phys_offset */
+       mov   r1, r7                 /*               - machine type */
+       mov   r2, r8                 /*               - ATAG address */
+       b     start_xen              /* and disappear into the land of C */
+
+/* Fail-stop
+ * r0: string explaining why */
+fail:  PRINT("- Boot failed -\r\n")
+1:     wfe
+       b     1b
+
+#ifdef EARLY_UART_ADDRESS
+
+/* Bring up the UART. Specific to the PL011 UART.
+ * Clobbers r0-r2 */
+init_uart:
+       mov   r1, #0x0
+       str   r1, [r11, #0x24]       /* -> UARTIBRD (Baud divisor fraction) */
+       mov   r1, #0x4               /* 7.3728MHz / 0x4 == 16 * 115200 */
+       str   r1, [r11, #0x24]       /* -> UARTIBRD (Baud divisor integer) */
+       mov   r1, #0x60              /* 8n1 */
+       str   r1, [r11, #0x24]       /* -> UARTLCR_H (Line control) */
+       ldr   r1, =0x00000301        /* RXE | TXE | UARTEN */
+       str   r1, [r11, #0x30]       /* -> UARTCR (Control Register) */
+       adr   r0, 1f
+       b     puts
+1:     .asciz "- UART enabled -\r\n"
+       .align 4
+
+/* Print early debug messages.  Specific to the PL011 UART.
+ * r0: Nul-terminated string to print.
+ * Clobbers r0-r2 */
+puts:
+       ldr   r2, [r11, #0x18]       /* <- UARTFR (Flag register) */
+       tst   r2, #0x8               /* Check BUSY bit */
+       bne   puts                   /* Wait for the UART to be ready */
+       ldrb  r2, [r0], #1           /* Load next char */
+       teq   r2, #0                 /* Exit on nul*/
+       moveq pc, lr
+       str   r2, [r11]              /* -> UARTDR (Data Register) */
+       b     puts
+
+/* Print a 32-bit number in hex.  Specific to the PL011 UART.
+ * r0: Number to print.
+ * clobbers r0-r3 */
+putn:
+       adr   r1, hex
+       mov   r3, #8
+1:     ldr   r2, [r11, #0x18]       /* <- UARTFR (Flag register) */
+       tst   r2, #0x8               /* Check BUSY bit */
+       bne   1b                     /* Wait for the UART to be ready */
+       and   r2, r0, #0xf0000000    /* Mask off the top nybble */
+       ldrb  r2, [r1, r2, lsr #28]  /* Convert to a char */
+       str   r2, [r11]              /* -> UARTDR (Data Register) */
+       lsl   r0, #4                 /* Roll it through one nybble at a time */
+       subs  r3, r3, #1
+       bne   1b
+       adr   r0, crlf               /* Finish with a newline */
+       b     puts
+
+crlf:  .asciz "\r\n"
+hex:   .ascii "0123456789abcdef"
+       .align 2
+
+#else  /* EARLY_UART_ADDRESS */
+
+init_uart:
+.global early_puts
+early_puts:
+puts:
+putn:  mov   pc, lr
+
+#endif /* EARLY_UART_ADDRESS */
diff -r 227302111aff -r 0d42f7875293 xen/arch/arm/xen.lds.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/xen.lds.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,141 @@
+/* Excerpts written by Martin Mares <mj@atrey.karlin.mff.cuni.cz> */
+/* Modified for i386/x86-64 Xen by Keir Fraser */
+/* Modified for ARM Xen by Ian Campbell */
+
+#include <xen/config.h>
+#include <xen/cache.h>
+#include <asm/page.h>
+#include <asm/percpu.h>
+#undef ENTRY
+#undef ALIGN
+
+ENTRY(start)
+
+OUTPUT_ARCH(arm)
+
+PHDRS
+{
+  text PT_LOAD /* XXX should be AT ( XEN_PHYS_START ) */ ;
+}
+SECTIONS
+{
+  . = XEN_VIRT_START;
+  _start = .;
+  .text : /* XXX should be AT ( XEN_PHYS_START ) */ {
+        _stext = .;            /* Text section */
+       *(.text)
+       *(.fixup)
+       *(.gnu.warning)
+       _etext = .;             /* End of text section */
+  } :text = 0x9090
+
+  . = ALIGN(PAGE_SIZE);
+  .rodata : {
+        _srodata = .;          /* Read-only data */
+       *(.rodata)
+       *(.rodata.*)
+        _erodata = .;          /* End of read-only data */
+  } :text
+
+  .data : {                    /* Data */
+       . = ALIGN(PAGE_SIZE);
+       *(.data.page_aligned)
+       *(.data)
+       *(.data.rel)
+       *(.data.rel.*)
+       CONSTRUCTORS
+  } :text
+
+  . = ALIGN(SMP_CACHE_BYTES);
+  .data.read_mostly : {
+       /* Exception table */
+       __start___ex_table = .;
+       *(.ex_table)
+       __stop___ex_table = .;
+
+       /* Pre-exception table */
+       __start___pre_ex_table = .;
+       *(.ex_table.pre)
+       __stop___pre_ex_table = .;
+
+       *(.data.read_mostly)
+       *(.data.rel.ro)
+       *(.data.rel.ro.*)
+  } :text
+
+#ifdef LOCK_PROFILE
+  . = ALIGN(32);
+  __lock_profile_start = .;
+  .lockprofile.data : { *(.lockprofile.data) } :text
+  __lock_profile_end = .;
+#endif
+
+  . = ALIGN(PAGE_SIZE);             /* Init code and data */
+  __init_begin = .;
+  .init.text : {
+       _sinittext = .;
+       *(.init.text)
+       _einittext = .;
+  } :text
+  . = ALIGN(PAGE_SIZE);
+  .init.data : {
+       *(.init.rodata)
+       *(.init.rodata.str*)
+       *(.init.data)
+       *(.init.data.rel)
+       *(.init.data.rel.*)
+  } :text
+  . = ALIGN(32);
+  .init.setup : {
+       __setup_start = .;
+       *(.init.setup)
+       __setup_end = .;
+  } :text
+  .initcall.init : {
+       __initcall_start = .;
+       *(.initcallpresmp.init)
+       __presmp_initcall_end = .;
+       *(.initcall1.init)
+       __initcall_end = .;
+  } :text
+  .xsm_initcall.init : {
+       __xsm_initcall_start = .;
+       *(.xsm_initcall.init)
+       __xsm_initcall_end = .;
+  } :text
+  . = ALIGN(STACK_SIZE);
+  __init_end = .;
+
+  .bss : {                     /* BSS */
+       __bss_start = .;
+       *(.bss.stack_aligned)
+       . = ALIGN(PAGE_SIZE);
+       *(.bss.page_aligned)
+       *(.bss)
+       . = ALIGN(SMP_CACHE_BYTES);
+       __per_cpu_start = .;
+       *(.bss.percpu)
+       . = ALIGN(SMP_CACHE_BYTES);
+       *(.bss.percpu.read_mostly)
+       . = ALIGN(SMP_CACHE_BYTES);
+       __per_cpu_data_end = .;
+  } :text
+  _end = . ;
+
+  /* Sections to be discarded */
+  /DISCARD/ : {
+       *(.exit.text)
+       *(.exit.data)
+       *(.exitcall.exit)
+       *(.eh_frame)
+  }
+
+  /* Stabs debugging sections.  */
+  .stab 0 : { *(.stab) }
+  .stabstr 0 : { *(.stabstr) }
+  .stab.excl 0 : { *(.stab.excl) }
+  .stab.exclstr 0 : { *(.stab.exclstr) }
+  .stab.index 0 : { *(.stab.index) }
+  .stab.indexstr 0 : { *(.stab.indexstr) }
+  .comment 0 : { *(.comment) }
+}
diff -r 227302111aff -r 0d42f7875293 xen/include/asm-arm/asm_defns.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/asm_defns.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,18 @@
+#ifndef __ARM_ASM_DEFNS_H__
+#define __ARM_ASM_DEFNS_H__
+
+#ifndef COMPILE_OFFSETS
+/* NB. Auto-generated from arch/.../asm-offsets.c */
+#include <asm/asm-offsets.h>
+#endif
+#include <asm/processor.h>
+
+#endif /* __ARM_ASM_DEFNS_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:39 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQG-00061H-VI; Thu, 09 Feb 2012 16:00:36 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQF-0005zI-8N
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:35 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-216.messagelabs.com!1328803227!13282820!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21372 invoked from network); 9 Feb 2012 16:00:28 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:28 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ6-0004P7-UJ
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:26 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ6-00066v-Fp
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:26 +0000
Message-Id: <E1RvWQ6-00066v-Fp@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:25 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: entry.S and head.S
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787209 0
# Node ID 0d42f7875293ff128f377fa5ec5fdca9c4237dae
# Parent  227302111affce41568ff02ab9d7fa91ae2a4e8d
arm: entry.S and head.S

Low level assembly routines, including entry.S and head.S.
Also the linker script and a collection of dummy functions that we plan
to reduce to zero as soon as possible.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 227302111aff -r 0d42f7875293 xen/arch/arm/asm-offsets.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/asm-offsets.c	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,76 @@
+/*
+ * Generate definitions needed by assembly language modules.
+ * This code generates raw asm output which is post-processed
+ * to extract and format the required data.
+ */
+#define COMPILE_OFFSETS
+
+#include <xen/config.h>
+#include <xen/types.h>
+#include <public/xen.h>
+#include <asm/current.h>
+
+#define DEFINE(_sym, _val) \
+    __asm__ __volatile__ ( "\n->" #_sym " %0 " #_val : : "i" (_val) )
+#define BLANK() \
+    __asm__ __volatile__ ( "\n->" : : )
+#define OFFSET(_sym, _str, _mem) \
+    DEFINE(_sym, offsetof(_str, _mem));
+
+/* base-2 logarithm */
+#define __L2(_x)  (((_x) & 0x00000002) ?   1 : 0)
+#define __L4(_x)  (((_x) & 0x0000000c) ? ( 2 + __L2( (_x)>> 2)) : __L2( _x))
+#define __L8(_x)  (((_x) & 0x000000f0) ? ( 4 + __L4( (_x)>> 4)) : __L4( _x))
+#define __L16(_x) (((_x) & 0x0000ff00) ? ( 8 + __L8( (_x)>> 8)) : __L8( _x))
+#define LOG_2(_x) (((_x) & 0xffff0000) ? (16 + __L16((_x)>>16)) : __L16(_x))
+
+void __dummy__(void)
+{
+   OFFSET(UREGS_sp, struct cpu_user_regs, sp);
+   OFFSET(UREGS_lr, struct cpu_user_regs, lr);
+   OFFSET(UREGS_pc, struct cpu_user_regs, pc);
+   OFFSET(UREGS_cpsr, struct cpu_user_regs, cpsr);
+
+   OFFSET(UREGS_LR_usr, struct cpu_user_regs, lr_usr);
+   OFFSET(UREGS_SP_usr, struct cpu_user_regs, sp_usr);
+
+   OFFSET(UREGS_SP_svc, struct cpu_user_regs, sp_svc);
+   OFFSET(UREGS_LR_svc, struct cpu_user_regs, lr_svc);
+   OFFSET(UREGS_SPSR_svc, struct cpu_user_regs, spsr_svc);
+
+   OFFSET(UREGS_SP_abt, struct cpu_user_regs, sp_abt);
+   OFFSET(UREGS_LR_abt, struct cpu_user_regs, lr_abt);
+   OFFSET(UREGS_SPSR_abt, struct cpu_user_regs, spsr_abt);
+
+   OFFSET(UREGS_SP_und, struct cpu_user_regs, sp_und);
+   OFFSET(UREGS_LR_und, struct cpu_user_regs, lr_und);
+   OFFSET(UREGS_SPSR_und, struct cpu_user_regs, spsr_und);
+
+   OFFSET(UREGS_SP_irq, struct cpu_user_regs, sp_irq);
+   OFFSET(UREGS_LR_irq, struct cpu_user_regs, lr_irq);
+   OFFSET(UREGS_SPSR_irq, struct cpu_user_regs, spsr_irq);
+
+   OFFSET(UREGS_SP_fiq, struct cpu_user_regs, sp_fiq);
+   OFFSET(UREGS_LR_fiq, struct cpu_user_regs, lr_fiq);
+   OFFSET(UREGS_SPSR_fiq, struct cpu_user_regs, spsr_fiq);
+
+   OFFSET(UREGS_R8_fiq, struct cpu_user_regs, r8_fiq);
+   OFFSET(UREGS_R9_fiq, struct cpu_user_regs, r9_fiq);
+   OFFSET(UREGS_R10_fiq, struct cpu_user_regs, r10_fiq);
+   OFFSET(UREGS_R11_fiq, struct cpu_user_regs, r11_fiq);
+   OFFSET(UREGS_R12_fiq, struct cpu_user_regs, r12_fiq);
+
+   OFFSET(UREGS_kernel_sizeof, struct cpu_user_regs, cpsr);
+   DEFINE(UREGS_user_sizeof, sizeof(struct cpu_user_regs));
+   BLANK();
+
+   DEFINE(CPUINFO_sizeof, sizeof(struct cpu_info));
+}
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 227302111aff -r 0d42f7875293 xen/arch/arm/dummy.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/dummy.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,72 @@
+/* Nothing is mapped at 1G, for the moment */
+#define DUMMY(x) \
+       .globl x; \
+x:     .word 0xe7f000f0
+/* x:  mov r0, #0x40000000 ; str r0, [r0]; b x */
+
+#define  NOP(x) \
+       .globl x; \
+x:     mov pc, lr
+
+DUMMY(alloc_pirq_struct);
+DUMMY(alloc_vcpu_guest_context);
+DUMMY(arch_do_domctl);
+DUMMY(arch_do_sysctl);
+DUMMY(arch_do_vcpu_op);
+DUMMY(arch_get_info_guest);
+DUMMY(arch_get_xen_caps);
+DUMMY(arch_memory_op);
+DUMMY(arch_set_info_guest);
+DUMMY(arch_vcpu_reset);
+DUMMY(create_grant_host_mapping);
+DUMMY(__cpu_die);
+DUMMY(__cpu_disable);
+DUMMY(__cpu_up);
+DUMMY(do_get_pm_info);
+DUMMY(domain_get_maximum_gpfn);
+DUMMY(domain_relinquish_resources);
+DUMMY(domain_set_time_offset);
+DUMMY(dom_cow);
+DUMMY(donate_page);
+DUMMY(do_pm_op);
+DUMMY(flush_tlb_mask);
+DUMMY(free_vcpu_guest_context);
+DUMMY(get_page);
+DUMMY(get_page_type);
+DUMMY(gmfn_to_mfn);
+DUMMY(gnttab_clear_flag);
+DUMMY(gnttab_host_mapping_get_page_type);
+DUMMY(gnttab_mark_dirty);
+DUMMY(hypercall_create_continuation);
+DUMMY(iommu_map_page);
+DUMMY(iommu_unmap_page);
+DUMMY(is_iomem_page);
+DUMMY(local_event_delivery_enable);
+DUMMY(local_events_need_delivery);
+DUMMY(machine_to_phys_mapping_valid);
+DUMMY(max_page);
+DUMMY(node_online_map);
+DUMMY(nr_irqs_gsi);
+DUMMY(p2m_pod_decrease_reservation);
+DUMMY(guest_physmap_mark_populate_on_demand);
+DUMMY(page_get_owner_and_reference);
+DUMMY(page_is_ram_type);
+DUMMY(per_cpu__cpu_core_mask);
+DUMMY(per_cpu__cpu_sibling_mask);
+DUMMY(__per_cpu_offset);
+DUMMY(pirq_guest_bind);
+DUMMY(pirq_guest_unbind);
+DUMMY(pirq_set_affinity);
+DUMMY(put_page);
+DUMMY(put_page_type);
+DUMMY(replace_grant_host_mapping);
+DUMMY(send_timer_event);
+DUMMY(share_xen_page_with_privileged_guests);
+DUMMY(smp_send_state_dump);
+DUMMY(steal_page);
+DUMMY(sync_vcpu_execstate);
+DUMMY(__udelay);
+NOP(update_vcpu_system_time);
+DUMMY(vcpu_mark_events_pending);
+DUMMY(vcpu_show_execution_state);
+DUMMY(wallclock_time);
diff -r 227302111aff -r 0d42f7875293 xen/arch/arm/entry.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/entry.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,107 @@
+#include <xen/config.h>
+#include <asm/asm_defns.h>
+
+#define SAVE_ONE_BANKED(reg)   mrs r11, reg; str r11, [sp, #UREGS_##reg]
+#define RESTORE_ONE_BANKED(reg)        ldr r11, [sp, #UREGS_##reg]; msr reg, r11
+
+#define SAVE_BANKED(mode) \
+       SAVE_ONE_BANKED(SP_##mode) ; SAVE_ONE_BANKED(LR_##mode) ; SAVE_ONE_BANKED(SPSR_##mode)
+
+#define RESTORE_BANKED(mode) \
+       RESTORE_ONE_BANKED(SP_##mode) ; RESTORE_ONE_BANKED(LR_##mode) ; RESTORE_ONE_BANKED(SPSR_##mode)
+
+#define SAVE_ALL                                                                                       \
+       sub sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */                                      \
+       push {r0-r12}; /* Save R0-R12 */                                                                \
+                                                                                                       \
+       mrs r11, ELR_hyp;               /* ELR_hyp is return address. */                                \
+       str r11, [sp, #UREGS_pc];                                                                       \
+                                                                                                       \
+       str lr, [sp, #UREGS_lr];                                                                        \
+                                                                                                       \
+       add r11, sp, #UREGS_kernel_sizeof+4;                                                            \
+       str r11, [sp, #UREGS_sp];                                                                       \
+                                                                                                       \
+       mrs r11, SPSR_hyp;                                                                              \
+       str r11, [sp, #UREGS_cpsr];                                                                     \
+       and r11, #PSR_MODE_MASK;                                                                        \
+       cmp r11, #PSR_MODE_HYP;                                                                         \
+       blne save_guest_regs
+
+save_guest_regs:
+       ldr r11, [sp, #UREGS_lr]
+       str r11, [sp, #UREGS_LR_usr]
+       ldr r11, =0xffffffff  /* Clobber SP which is only valid for hypervisor frames. */
+       str r11, [sp, #UREGS_sp]
+       SAVE_ONE_BANKED(SP_usr)
+       SAVE_BANKED(svc)
+       SAVE_BANKED(abt)
+       SAVE_BANKED(und)
+       SAVE_BANKED(irq)
+       SAVE_BANKED(fiq)
+       SAVE_ONE_BANKED(R8_fiq); SAVE_ONE_BANKED(R9_fiq); SAVE_ONE_BANKED(R10_fiq)
+       SAVE_ONE_BANKED(R11_fiq); SAVE_ONE_BANKED(R12_fiq);
+       mov pc, lr
+
+#define DEFINE_TRAP_ENTRY(trap)                                                                                \
+       ALIGN;                                                                                          \
+trap_##trap:                                                                                           \
+       SAVE_ALL;                                                                                       \
+       adr lr, return_from_trap;                                                                       \
+       mov r0, sp;                                                                                     \
+       mov r11, sp;                                                                                    \
+       bic sp, #7; /* Align the stack pointer (noop on guest trap) */                                  \
+       b do_trap_##trap
+
+.globl hyp_traps_vector
+       .align 5
+hyp_traps_vector:
+       .word 0                         /* 0x00 - Reset */
+       b trap_undefined_instruction    /* 0x04 - Undefined Instruction */
+       b trap_supervisor_call          /* 0x08 - Supervisor Call */
+       b trap_prefetch_abort           /* 0x0c - Prefetch Abort */
+       b trap_data_abort               /* 0x10 - Data Abort */
+       b trap_hypervisor               /* 0x14 - Hypervisor */
+       b trap_irq                      /* 0x18 - IRQ */
+       b trap_fiq                      /* 0x1c - FIQ */
+
+DEFINE_TRAP_ENTRY(undefined_instruction)
+DEFINE_TRAP_ENTRY(supervisor_call)
+DEFINE_TRAP_ENTRY(prefetch_abort)
+DEFINE_TRAP_ENTRY(data_abort)
+DEFINE_TRAP_ENTRY(hypervisor)
+DEFINE_TRAP_ENTRY(irq)
+DEFINE_TRAP_ENTRY(fiq)
+
+ENTRY(return_from_trap)
+       ldr r11, [sp, #UREGS_cpsr]
+       and r11, #PSR_MODE_MASK
+       cmp r11, #PSR_MODE_HYP
+       beq return_to_hypervisor
+
+ENTRY(return_to_guest)
+       mov r11, sp
+       bic sp, #7 /* Align the stack pointer */
+       bl leave_hypervisor_tail
+       ldr r11, [sp, #UREGS_pc]
+       msr ELR_hyp, r11
+       ldr r11, [sp, #UREGS_cpsr]
+       msr SPSR_hyp, r11
+       RESTORE_ONE_BANKED(SP_usr)
+       RESTORE_BANKED(svc)
+       RESTORE_BANKED(abt)
+       RESTORE_BANKED(und)
+       RESTORE_BANKED(irq)
+       RESTORE_BANKED(fiq)
+       RESTORE_ONE_BANKED(R8_fiq); RESTORE_ONE_BANKED(R9_fiq); RESTORE_ONE_BANKED(R10_fiq)
+       RESTORE_ONE_BANKED(R11_fiq); RESTORE_ONE_BANKED(R12_fiq);
+       ldr lr, [sp, #UREGS_LR_usr]
+       pop {r0-r12}
+       add sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */
+       eret
+
+ENTRY(return_to_hypervisor)
+       ldr lr, [sp, #UREGS_lr]
+       pop {r0-r12}
+       add sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */
+       eret
diff -r 227302111aff -r 0d42f7875293 xen/arch/arm/head.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/head.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,298 @@
+/*
+ * xen/arch/arm/head.S
+ *
+ * Start-of-day code for an ARMv7-A with virt extensions.
+ *
+ * Tim Deegan <tim@xen.org>
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <asm/config.h>
+#include <asm/page.h>
+#include <asm/asm_defns.h>
+
+
+/* Macro to print a string to the UART, if there is one.
+ * Clobbers r0-r3. */
+#ifdef EARLY_UART_ADDRESS
+#define PRINT(_s)       \
+       adr   r0, 98f ; \
+       bl    puts    ; \
+       b     99f     ; \
+98:    .asciz _s     ; \
+       .align 2      ; \
+99:
+#else
+#define PRINT(s)
+#endif
+
+       .arm
+
+       /* This must be the very first address in the loaded image.
+        * It should be linked at XEN_VIRT_START, and loaded at any
+        * 2MB-aligned address.  All of text+data+bss must fit in 2MB,
+        * or the initial pagetable code below will need adjustment. */
+       .global start
+start:
+       cpsid aif                    /* Disable all interrupts */
+
+       /* Save the bootloader arguments in less-clobberable registers */
+       mov   r7, r1                 /* r7 := ARM-linux machine type */
+       mov   r8, r2                 /* r8 := ATAG base address */
+
+       /* Find out where we are */
+       ldr   r0, =start
+       adr   r9, start              /* r9  := paddr (start) */
+       sub   r10, r9, r0            /* r10 := phys-offset */
+
+#ifdef EARLY_UART_ADDRESS
+       /* Say hello */
+       ldr   r11, =EARLY_UART_ADDRESS  /* r11 := UART base address */
+       bl    init_uart
+#endif
+
+       /* Check that this CPU has Hyp mode */
+       mrc   CP32(r0, ID_PFR1)
+       and   r0, r0, #0xf000        /* Bits 12-15 define virt extensions */
+       teq   r0, #0x1000            /* Must == 0x1 or may be incompatible */
+       beq   1f
+       bl    putn
+       PRINT("- CPU doesn't support the virtualization extensions -\r\n")
+       b     fail
+1:
+       /* Check if we're already in it */
+       mrs   r0, cpsr
+       and   r0, r0, #0x1f          /* Mode is in the low 5 bits of CPSR */
+       teq   r0, #0x1a              /* Hyp Mode? */
+       bne   1f
+       PRINT("- Started in Hyp mode -\r\n")
+       b     hyp
+1:
+       /* Otherwise, it must have been Secure Supervisor mode */
+       mrc   CP32(r0, SCR)
+       tst   r0, #0x1               /* Not-Secure bit set? */
+       beq   1f
+       PRINT("- CPU is not in Hyp mode or Secure state -\r\n")
+       b     fail
+1:
+       /* OK, we're in Secure state. */
+       PRINT("- Started in Secure state -\r\n- Entering Hyp mode -\r\n")
+
+       /* Dance into Hyp mode */
+       cpsid aif, #0x16             /* Enter Monitor mode */
+       mrc   CP32(r0, SCR)
+       orr   r0, r0, #0x100         /* Set HCE */
+       orr   r0, r0, #0xb1          /* Set SCD, AW, FW and NS */
+       bic   r0, r0, #0xe           /* Clear EA, FIQ and IRQ */
+       mcr   CP32(r0, SCR)
+       /* Ugly: the system timer's frequency register is only
+        * programmable in Secure state.  Since we don't know where its
+        * memory-mapped control registers live, we can't find out the
+        * right frequency.  Use the VE model's default frequency here. */
+       ldr   r0, =0x5f5e100         /* 100 MHz */
+       mcr   CP32(r0, CNTFRQ)
+       ldr   r0, =0x40c00           /* SMP, c11, c10 in non-secure mode */
+       mcr   CP32(r0, NSACR)
+       /* Continuing ugliness: Set up the GIC so NS state owns interrupts */
+       mov   r0, #GIC_BASE_ADDRESS
+       add   r0, r0, #GIC_DR_OFFSET
+       mov   r1, #0
+       str   r1, [r0]               /* Disable delivery in the distributor */
+       add   r0, r0, #0x80          /* GICD_IGROUP0 */
+       mov   r2, #0xffffffff        /* All interrupts to group 1 */
+       str   r2, [r0]
+       str   r2, [r0, #4]
+       str   r2, [r0, #8]
+       /* Must drop priority mask below 0x80 before entering NS state */
+       mov   r0, #GIC_BASE_ADDRESS
+       add   r0, r0, #GIC_CR_OFFSET
+       ldr   r1, =0xff
+       str   r1, [r0, #0x4]         /* -> GICC_PMR */
+       /* Reset a few config registers */
+       mov   r0, #0
+       mcr   CP32(r0, FCSEIDR)
+       mcr   CP32(r0, CONTEXTIDR)
+       /* FIXME: ought to reset some other NS control regs here */
+       adr   r1, 1f
+       adr   r0, hyp                /* Store paddr (hyp entry point) */
+       str   r0, [r1]               /* where we can use it for RFE */
+       isb                          /* Ensure we see the stored target address */
+       rfeia r1                     /* Enter Hyp mode */
+
+1:     .word 0                      /* PC to enter Hyp mode at */
+       .word 0x000001da             /* CPSR: LE, Abort/IRQ/FIQ off, Hyp */
+
+hyp:
+       PRINT("- Setting up control registers -\r\n")
+
+       /* Set up memory attribute type tables */
+       ldr   r0, =MAIR0VAL
+       ldr   r1, =MAIR1VAL
+       mcr   CP32(r0, MAIR0)
+       mcr   CP32(r1, MAIR1)
+       mcr   CP32(r0, HMAIR0)
+       mcr   CP32(r1, HMAIR1)
+
+       /* Set up the HTCR:
+        * PT walks use Outer-Shareable accesses,
+        * PT walks are write-back, no-write-allocate in both cache levels,
+        * Full 32-bit address space goes through this table. */
+       ldr   r0, =0x80002500
+       mcr   CP32(r0, HTCR)
+
+       /* Set up the HSCTLR:
+        * Exceptions in LE ARM,
+        * Low-latency IRQs disabled,
+        * Write-implies-XN disabled (for now),
+        * I-cache and d-cache enabled,
+        * Alignment checking enabled,
+        * MMU translation disabled (for now). */
+       ldr   r0, =(HSCTLR_BASE|SCTLR_A|SCTLR_C)
+       mcr   CP32(r0, HSCTLR)
+
+       /* Write Xen's PT's paddr into the HTTBR */
+       ldr   r4, =xen_pgtable
+       add   r4, r4, r10            /* r4 := paddr (xen_pagetable) */
+       mov   r5, #0                 /* r4:r5 is paddr (xen_pagetable) */
+       mcrr  CP64(r4, r5, HTTBR)
+
+       /* Build the baseline idle pagetable's first-level entries */
+       ldr   r1, =xen_second
+       add   r1, r1, r10            /* r1 := paddr (xen_second) */
+       mov   r3, #0x0
+       orr   r2, r1, #0xe00         /* r2:r3 := table map of xen_second */
+       orr   r2, r2, #0x07f         /* (+ rights for linear PT) */
+       strd  r2, r3, [r4, #0]       /* Map it in slot 0 */
+       add   r2, r2, #0x1000
+       strd  r2, r3, [r4, #8]       /* Map 2nd page in slot 1 */
+       add   r2, r2, #0x1000
+       strd  r2, r3, [r4, #16]      /* Map 3rd page in slot 2 */
+       add   r2, r2, #0x1000
+       strd  r2, r3, [r4, #24]      /* Map 4th page in slot 3 */
+
+       /* Now set up the second-level entries */
+       orr   r2, r9, #0xe00
+       orr   r2, r2, #0x07d         /* r2:r3 := 2MB normal map of Xen */
+       mov   r4, r9, lsr #18        /* Slot for paddr(start) */
+       strd  r2, r3, [r1, r4]       /* Map Xen there */
+       ldr   r4, =start
+       lsr   r4, #18                /* Slot for vaddr(start) */
+       strd  r2, r3, [r1, r4]       /* Map Xen there too */
+#ifdef EARLY_UART_ADDRESS
+       ldr   r3, =(1<<(54-32))      /* NS for device mapping */
+       lsr   r2, r11, #21
+       lsl   r2, r2, #21            /* 2MB-aligned paddr of UART */
+       orr   r2, r2, #0xe00
+       orr   r2, r2, #0x071         /* r2:r3 := 2MB dev map including UART */
+       add   r4, r4, #8
+       strd  r2, r3, [r1, r4]       /* Map it in the fixmap's slot */
+#endif
+
+       PRINT("- Turning on paging -\r\n")
+
+       ldr   r1, =paging            /* Explicit vaddr, not RIP-relative */
+       mrc   CP32(r0, HSCTLR)
+       orr   r0, r0, #0x1           /* Add in the MMU enable bit */
+       dsb                          /* Flush PTE writes and finish reads */
+       mcr   CP32(r0, HSCTLR)       /* now paging is enabled */
+       isb                          /* Now, flush the icache */
+       mov   pc, r1                 /* Get a proper vaddr into PC */
+paging:
+
+#ifdef EARLY_UART_ADDRESS
+       /* Recover the UART address in the new address space */
+       lsl   r11, #11
+       lsr   r11, #11               /* UART base's offset from 2MB base */
+       adr   r0, start
+       add   r0, r0, #0x200000      /* vaddr of the fixmap's 2MB slot */
+       add   r11, r11, r0           /* r11 := vaddr (UART base address) */
+#endif
+
+       PRINT("- Entering C -\r\n")
+
+       ldr   sp, =init_stack        /* Supply a stack */
+       add   sp, #STACK_SIZE        /* (which grows down from the top). */
+       sub   sp, #CPUINFO_sizeof    /* Make room for CPU save record */
+       mov   r0, r10                /* Marshal args: - phys_offset */
+       mov   r1, r7                 /*               - machine type */
+       mov   r2, r8                 /*               - ATAG address */
+       b     start_xen              /* and disappear into the land of C */
+
+/* Fail-stop
+ * r0: string explaining why */
+fail:  PRINT("- Boot failed -\r\n")
+1:     wfe
+       b     1b
+
+#ifdef EARLY_UART_ADDRESS
+
+/* Bring up the UART. Specific to the PL011 UART.
+ * Clobbers r0-r2 */
+init_uart:
+       mov   r1, #0x0
+       str   r1, [r11, #0x24]       /* -> UARTIBRD (Baud divisor fraction) */
+       mov   r1, #0x4               /* 7.3728MHz / 0x4 == 16 * 115200 */
+       str   r1, [r11, #0x24]       /* -> UARTIBRD (Baud divisor integer) */
+       mov   r1, #0x60              /* 8n1 */
+       str   r1, [r11, #0x24]       /* -> UARTLCR_H (Line control) */
+       ldr   r1, =0x00000301        /* RXE | TXE | UARTEN */
+       str   r1, [r11, #0x30]       /* -> UARTCR (Control Register) */
+       adr   r0, 1f
+       b     puts
+1:     .asciz "- UART enabled -\r\n"
+       .align 4
+
+/* Print early debug messages.  Specific to the PL011 UART.
+ * r0: Nul-terminated string to print.
+ * Clobbers r0-r2 */
+puts:
+       ldr   r2, [r11, #0x18]       /* <- UARTFR (Flag register) */
+       tst   r2, #0x8               /* Check BUSY bit */
+       bne   puts                   /* Wait for the UART to be ready */
+       ldrb  r2, [r0], #1           /* Load next char */
+       teq   r2, #0                 /* Exit on nul*/
+       moveq pc, lr
+       str   r2, [r11]              /* -> UARTDR (Data Register) */
+       b     puts
+
+/* Print a 32-bit number in hex.  Specific to the PL011 UART.
+ * r0: Number to print.
+ * clobbers r0-r3 */
+putn:
+       adr   r1, hex
+       mov   r3, #8
+1:     ldr   r2, [r11, #0x18]       /* <- UARTFR (Flag register) */
+       tst   r2, #0x8               /* Check BUSY bit */
+       bne   1b                     /* Wait for the UART to be ready */
+       and   r2, r0, #0xf0000000    /* Mask off the top nybble */
+       ldrb  r2, [r1, r2, lsr #28]  /* Convert to a char */
+       str   r2, [r11]              /* -> UARTDR (Data Register) */
+       lsl   r0, #4                 /* Roll it through one nybble at a time */
+       subs  r3, r3, #1
+       bne   1b
+       adr   r0, crlf               /* Finish with a newline */
+       b     puts
+
+crlf:  .asciz "\r\n"
+hex:   .ascii "0123456789abcdef"
+       .align 2
+
+#else  /* EARLY_UART_ADDRESS */
+
+init_uart:
+.global early_puts
+early_puts:
+puts:
+putn:  mov   pc, lr
+
+#endif /* EARLY_UART_ADDRESS */
diff -r 227302111aff -r 0d42f7875293 xen/arch/arm/xen.lds.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/xen.lds.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,141 @@
+/* Excerpts written by Martin Mares <mj@atrey.karlin.mff.cuni.cz> */
+/* Modified for i386/x86-64 Xen by Keir Fraser */
+/* Modified for ARM Xen by Ian Campbell */
+
+#include <xen/config.h>
+#include <xen/cache.h>
+#include <asm/page.h>
+#include <asm/percpu.h>
+#undef ENTRY
+#undef ALIGN
+
+ENTRY(start)
+
+OUTPUT_ARCH(arm)
+
+PHDRS
+{
+  text PT_LOAD /* XXX should be AT ( XEN_PHYS_START ) */ ;
+}
+SECTIONS
+{
+  . = XEN_VIRT_START;
+  _start = .;
+  .text : /* XXX should be AT ( XEN_PHYS_START ) */ {
+        _stext = .;            /* Text section */
+       *(.text)
+       *(.fixup)
+       *(.gnu.warning)
+       _etext = .;             /* End of text section */
+  } :text = 0x9090
+
+  . = ALIGN(PAGE_SIZE);
+  .rodata : {
+        _srodata = .;          /* Read-only data */
+       *(.rodata)
+       *(.rodata.*)
+        _erodata = .;          /* End of read-only data */
+  } :text
+
+  .data : {                    /* Data */
+       . = ALIGN(PAGE_SIZE);
+       *(.data.page_aligned)
+       *(.data)
+       *(.data.rel)
+       *(.data.rel.*)
+       CONSTRUCTORS
+  } :text
+
+  . = ALIGN(SMP_CACHE_BYTES);
+  .data.read_mostly : {
+       /* Exception table */
+       __start___ex_table = .;
+       *(.ex_table)
+       __stop___ex_table = .;
+
+       /* Pre-exception table */
+       __start___pre_ex_table = .;
+       *(.ex_table.pre)
+       __stop___pre_ex_table = .;
+
+       *(.data.read_mostly)
+       *(.data.rel.ro)
+       *(.data.rel.ro.*)
+  } :text
+
+#ifdef LOCK_PROFILE
+  . = ALIGN(32);
+  __lock_profile_start = .;
+  .lockprofile.data : { *(.lockprofile.data) } :text
+  __lock_profile_end = .;
+#endif
+
+  . = ALIGN(PAGE_SIZE);             /* Init code and data */
+  __init_begin = .;
+  .init.text : {
+       _sinittext = .;
+       *(.init.text)
+       _einittext = .;
+  } :text
+  . = ALIGN(PAGE_SIZE);
+  .init.data : {
+       *(.init.rodata)
+       *(.init.rodata.str*)
+       *(.init.data)
+       *(.init.data.rel)
+       *(.init.data.rel.*)
+  } :text
+  . = ALIGN(32);
+  .init.setup : {
+       __setup_start = .;
+       *(.init.setup)
+       __setup_end = .;
+  } :text
+  .initcall.init : {
+       __initcall_start = .;
+       *(.initcallpresmp.init)
+       __presmp_initcall_end = .;
+       *(.initcall1.init)
+       __initcall_end = .;
+  } :text
+  .xsm_initcall.init : {
+       __xsm_initcall_start = .;
+       *(.xsm_initcall.init)
+       __xsm_initcall_end = .;
+  } :text
+  . = ALIGN(STACK_SIZE);
+  __init_end = .;
+
+  .bss : {                     /* BSS */
+       __bss_start = .;
+       *(.bss.stack_aligned)
+       . = ALIGN(PAGE_SIZE);
+       *(.bss.page_aligned)
+       *(.bss)
+       . = ALIGN(SMP_CACHE_BYTES);
+       __per_cpu_start = .;
+       *(.bss.percpu)
+       . = ALIGN(SMP_CACHE_BYTES);
+       *(.bss.percpu.read_mostly)
+       . = ALIGN(SMP_CACHE_BYTES);
+       __per_cpu_data_end = .;
+  } :text
+  _end = . ;
+
+  /* Sections to be discarded */
+  /DISCARD/ : {
+       *(.exit.text)
+       *(.exit.data)
+       *(.exitcall.exit)
+       *(.eh_frame)
+  }
+
+  /* Stabs debugging sections.  */
+  .stab 0 : { *(.stab) }
+  .stabstr 0 : { *(.stabstr) }
+  .stab.excl 0 : { *(.stab.excl) }
+  .stab.exclstr 0 : { *(.stab.exclstr) }
+  .stab.index 0 : { *(.stab.index) }
+  .stab.indexstr 0 : { *(.stab.indexstr) }
+  .comment 0 : { *(.comment) }
+}
diff -r 227302111aff -r 0d42f7875293 xen/include/asm-arm/asm_defns.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/asm_defns.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,18 @@
+#ifndef __ARM_ASM_DEFNS_H__
+#define __ARM_ASM_DEFNS_H__
+
+#ifndef COMPILE_OFFSETS
+/* NB. Auto-generated from arch/.../asm-offsets.c */
+#include <asm/asm-offsets.h>
+#endif
+#include <asm/processor.h>
+
+#endif /* __ARM_ASM_DEFNS_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:39 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQI-00062K-CO; Thu, 09 Feb 2012 16:00:38 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQH-0005zW-0I
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:37 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1328803229!14122254!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26895 invoked from network); 9 Feb 2012 16:00:30 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:30 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ9-0004PF-5B
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:29 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ8-00067m-DP
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:28 +0000
Message-Id: <E1RvWQ8-00067m-DP@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:27 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: domain_build
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787209 0
# Node ID a8c70f22d704452513c5728dd99bf5a3c2ca3b84
# Parent  1cfe402b934af74c02685ca5304a0b75c84092da
arm: domain_build

Functions to build dom0: memory allocation, p2m construction, mappings
of the MMIO regions, ATAG setup.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 1cfe402b934a -r a8c70f22d704 xen/arch/arm/domain_build.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/domain_build.c	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,213 @@
+#include <xen/config.h>
+#include <xen/init.h>
+#include <xen/lib.h>
+#include <xen/mm.h>
+#include <xen/domain_page.h>
+#include <xen/sched.h>
+#include <xen/libelf.h>
+#include <asm/irq.h>
+
+#include "gic.h"
+
+static unsigned int __initdata opt_dom0_max_vcpus;
+integer_param("dom0_max_vcpus", opt_dom0_max_vcpus);
+
+struct vcpu *__init alloc_dom0_vcpu0(void)
+{
+    dom0->vcpu = xmalloc_array(struct vcpu *, opt_dom0_max_vcpus);
+    if ( !dom0->vcpu )
+    {
+            printk("failed to alloc dom0->vccpu\n");
+        return NULL;
+    }
+    memset(dom0->vcpu, 0, opt_dom0_max_vcpus * sizeof(*dom0->vcpu));
+    dom0->max_vcpus = opt_dom0_max_vcpus;
+
+    return alloc_vcpu(dom0, 0, 0);
+}
+
+extern void guest_mode_entry(void);
+
+static void copy_from_flash(void *dst, paddr_t flash, unsigned long len)
+{
+    void *src = (void *)FIXMAP_ADDR(FIXMAP_MISC);
+    unsigned long offs;
+
+    printk("Copying %#lx bytes from flash %"PRIpaddr" to %p-%p: [",
+           len, flash, dst, dst+(1<<23));
+    for ( offs = 0; offs < len ; offs += PAGE_SIZE )
+    {
+        if ( ( offs % (1<<20) ) == 0 )
+            printk(".");
+        set_fixmap(FIXMAP_MISC, (flash+offs) >> PAGE_SHIFT, DEV_SHARED);
+        memcpy(dst+offs, src, PAGE_SIZE);
+    }
+    printk("]\n");
+
+    clear_fixmap(FIXMAP_MISC);
+}
+
+static void setup_linux_atag(paddr_t tags, paddr_t ram_s, paddr_t ram_e)
+{
+    paddr_t ma = gvirt_to_maddr(tags);
+    void *map = map_domain_page(ma>>PAGE_SHIFT);
+    void *p = map + (tags & (PAGE_SIZE - 1));
+    char cmdline[] = "earlyprintk=xenboot console=ttyAMA1 root=/dev/mmcblk0 debug rw";
+
+    /* not enough room on this page for all the tags */
+    BUG_ON(PAGE_SIZE - (tags & (PAGE_SIZE - 1)) < 8 * sizeof(uint32_t));
+
+#define TAG(type, val) *(type*)p = val; p+= sizeof(type)
+
+    /* ATAG_CORE */
+    TAG(uint32_t, 2);
+    TAG(uint32_t, 0x54410001);
+
+    /* ATAG_MEM */
+    TAG(uint32_t, 4);
+    TAG(uint32_t, 0x54410002);
+    TAG(uint32_t, (ram_e - ram_s) & 0xFFFFFFFF);
+    TAG(uint32_t, ram_s & 0xFFFFFFFF);
+
+    /* ATAG_CMDLINE */
+    TAG(uint32_t, 2 + ((strlen(cmdline) + 4) >> 2));
+    TAG(uint32_t, 0x54410009);
+    memcpy(p, cmdline, strlen(cmdline) + 1);
+    p += ((strlen(cmdline) + 4) >> 2) << 2;
+
+    /* ATAG_NONE */
+    TAG(uint32_t, 0);
+    TAG(uint32_t, 0);
+
+#undef TAG
+
+    unmap_domain_page(map);
+}
+
+/* Store kernel in first 8M of flash */
+#define KERNEL_FLASH_ADDRESS 0x00000000UL
+#define KERNEL_FLASH_SIZE    0x00800000UL
+
+int construct_dom0(struct domain *d)
+{
+    int rc, kernel_order;
+    void *kernel_img;
+
+    struct vcpu *v = d->vcpu[0];
+    struct cpu_user_regs *regs = &v->arch.user_regs;
+
+    struct elf_binary elf;
+    struct elf_dom_parms parms;
+
+    /* Sanity! */
+    BUG_ON(d->domain_id != 0);
+    BUG_ON(d->vcpu[0] == NULL);
+    BUG_ON(v->is_initialised);
+
+    printk("*** LOADING DOMAIN 0 ***\n");
+
+    kernel_order = get_order_from_bytes(KERNEL_FLASH_SIZE);
+    kernel_img = alloc_xenheap_pages(kernel_order, 0);
+    if ( kernel_img == NULL )
+        panic("Cannot allocate temporary buffer for kernel.\n");
+
+    copy_from_flash(kernel_img, KERNEL_FLASH_ADDRESS, KERNEL_FLASH_SIZE);
+
+    d->max_pages = ~0U;
+
+    if ( (rc = elf_init(&elf, kernel_img, KERNEL_FLASH_SIZE )) != 0 )
+        return rc;  memset(regs, 0, sizeof(*regs));
+#ifdef VERBOSE
+    elf_set_verbose(&elf);
+#endif
+    elf_parse_binary(&elf);
+    if ( (rc = elf_xen_parse(&elf, &parms)) != 0 )
+        return rc;
+
+    if ( (rc = p2m_alloc_table(d)) != 0 )
+        return rc;
+
+    /* 128M at 3G physical */
+    /* TODO size and location according to platform info */
+    printk("Populate P2M %#llx->%#llx\n", 0xc0000000ULL, 0xc8000000ULL);
+    p2m_populate_ram(d, 0xc0000000ULL, 0xc8000000ULL);
+
+    printk("Map CS2 MMIO regions 1:1 in the P2M %#llx->%#llx\n", 0x18000000ULL, 0x1BFFFFFFULL);
+    map_mmio_regions(d, 0x18000000, 0x1BFFFFFF, 0x18000000);
+    printk("Map CS3 MMIO regions 1:1 in the P2M %#llx->%#llx\n", 0x1C000000ULL, 0x1FFFFFFFULL);
+    map_mmio_regions(d, 0x1C000000, 0x1FFFFFFF, 0x1C000000);
+    printk("Map VGIC MMIO regions 1:1 in the P2M %#llx->%#llx\n", 0x2C008000ULL, 0x2DFFFFFFULL);
+    map_mmio_regions(d, 0x2C008000, 0x2DFFFFFF, 0x2C008000);
+
+    gicv_setup(d);
+
+    printk("Routing peripheral interrupts to guest\n");
+    /* TODO Get from device tree */
+    gic_route_irq_to_guest(d, 34, "timer0");
+    /*gic_route_irq_to_guest(d, 37, "uart0"); -- XXX used by Xen*/
+    gic_route_irq_to_guest(d, 38, "uart1");
+    gic_route_irq_to_guest(d, 39, "uart2");
+    gic_route_irq_to_guest(d, 40, "uart3");
+    gic_route_irq_to_guest(d, 41, "mmc0-1");
+    gic_route_irq_to_guest(d, 42, "mmc0-2");
+    gic_route_irq_to_guest(d, 44, "keyboard");
+    gic_route_irq_to_guest(d, 45, "mouse");
+    gic_route_irq_to_guest(d, 46, "lcd");
+    gic_route_irq_to_guest(d, 47, "eth");
+
+    /* Enable second stage translation */
+    WRITE_CP32(READ_CP32(HCR) | HCR_VM, HCR); isb();
+
+    /* The following load uses domain's p2m */
+    p2m_load_VTTBR(d);
+
+    printk("Loading ELF image into guest memory\n");
+    elf.dest = (void*)(unsigned long)parms.virt_kstart;
+    elf_load_binary(&elf);
+
+    printk("Free temporary kernel buffer\n");
+    free_xenheap_pages(kernel_img, kernel_order);
+
+    setup_linux_atag(0xc0000100ULL, 0xc0000000ULL, 0xc8000000ULL);
+
+    clear_bit(_VPF_down, &v->pause_flags);
+
+    memset(regs, 0, sizeof(*regs));
+
+    regs->pc = (uint32_t)parms.virt_entry;
+
+    regs->cpsr = PSR_ABT_MASK|PSR_FIQ_MASK|PSR_IRQ_MASK|PSR_MODE_SVC;
+
+/* FROM LINUX head.S
+
+ * Kernel startup entry point.
+ * ---------------------------
+ *
+ * This is normally called from the decompressor code.  The requirements
+ * are: MMU = off, D-cache = off, I-cache = dont care, r0 = 0,
+ * r1 = machine nr, r2 = atags or dtb pointer.
+ *...
+ */
+
+    regs->r0 = 0; /* SBZ */
+    regs->r1 = 2272; /* Machine NR: Versatile Express */
+    regs->r2 = 0xc0000100; /* ATAGS */
+
+    WRITE_CP32(SCTLR_BASE, SCTLR);
+
+    WRITE_CP32(HCR_AMO|HCR_IMO|HCR_VM, HCR);
+    isb();
+
+    local_abort_enable();
+
+    return 0;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 1cfe402b934a -r a8c70f22d704 xen/common/libelf/libelf-dominfo.c
--- a/xen/common/libelf/libelf-dominfo.c	Thu Feb 09 11:33:29 2012 +0000
+++ b/xen/common/libelf/libelf-dominfo.c	Thu Feb 09 11:33:29 2012 +0000
@@ -341,6 +341,12 @@
         return 0;
     }
 
+    if ( elf_uval(elf, elf->ehdr, e_machine) == EM_ARM )
+    {
+         elf_msg(elf, "%s: Not bothering with notes on ARM\n", __FUNCTION__);
+         return 0;
+    }
+
     /* Check the contents of the Xen notes or guest string. */
     if ( ((strlen(parms->loader) == 0) ||
           strncmp(parms->loader, "generic", 7)) &&
diff -r 1cfe402b934a -r a8c70f22d704 xen/include/asm-arm/setup.h
--- a/xen/include/asm-arm/setup.h	Thu Feb 09 11:33:29 2012 +0000
+++ b/xen/include/asm-arm/setup.h	Thu Feb 09 11:33:29 2012 +0000
@@ -5,6 +5,8 @@
 
 void arch_get_xen_caps(xen_capabilities_info_t *info);
 
+int construct_dom0(struct domain *d);
+
 #endif
 /*
  * Local variables:
diff -r 1cfe402b934a -r a8c70f22d704 xen/include/xen/libelf.h
--- a/xen/include/xen/libelf.h	Thu Feb 09 11:33:29 2012 +0000
+++ b/xen/include/xen/libelf.h	Thu Feb 09 11:33:29 2012 +0000
@@ -23,7 +23,7 @@
 #ifndef __XEN_LIBELF_H__
 #define __XEN_LIBELF_H__
 
-#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__) || defined(__arm__)
 #define XEN_ELF_LITTLE_ENDIAN
 #else
 #error define architectural endianness

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:39 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQI-00062K-CO; Thu, 09 Feb 2012 16:00:38 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQH-0005zW-0I
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:37 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1328803229!14122254!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26895 invoked from network); 9 Feb 2012 16:00:30 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:30 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ9-0004PF-5B
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:29 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ8-00067m-DP
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:28 +0000
Message-Id: <E1RvWQ8-00067m-DP@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:27 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: domain_build
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787209 0
# Node ID a8c70f22d704452513c5728dd99bf5a3c2ca3b84
# Parent  1cfe402b934af74c02685ca5304a0b75c84092da
arm: domain_build

Functions to build dom0: memory allocation, p2m construction, mappings
of the MMIO regions, ATAG setup.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 1cfe402b934a -r a8c70f22d704 xen/arch/arm/domain_build.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/domain_build.c	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,213 @@
+#include <xen/config.h>
+#include <xen/init.h>
+#include <xen/lib.h>
+#include <xen/mm.h>
+#include <xen/domain_page.h>
+#include <xen/sched.h>
+#include <xen/libelf.h>
+#include <asm/irq.h>
+
+#include "gic.h"
+
+static unsigned int __initdata opt_dom0_max_vcpus;
+integer_param("dom0_max_vcpus", opt_dom0_max_vcpus);
+
+struct vcpu *__init alloc_dom0_vcpu0(void)
+{
+    dom0->vcpu = xmalloc_array(struct vcpu *, opt_dom0_max_vcpus);
+    if ( !dom0->vcpu )
+    {
+            printk("failed to alloc dom0->vccpu\n");
+        return NULL;
+    }
+    memset(dom0->vcpu, 0, opt_dom0_max_vcpus * sizeof(*dom0->vcpu));
+    dom0->max_vcpus = opt_dom0_max_vcpus;
+
+    return alloc_vcpu(dom0, 0, 0);
+}
+
+extern void guest_mode_entry(void);
+
+static void copy_from_flash(void *dst, paddr_t flash, unsigned long len)
+{
+    void *src = (void *)FIXMAP_ADDR(FIXMAP_MISC);
+    unsigned long offs;
+
+    printk("Copying %#lx bytes from flash %"PRIpaddr" to %p-%p: [",
+           len, flash, dst, dst+(1<<23));
+    for ( offs = 0; offs < len ; offs += PAGE_SIZE )
+    {
+        if ( ( offs % (1<<20) ) == 0 )
+            printk(".");
+        set_fixmap(FIXMAP_MISC, (flash+offs) >> PAGE_SHIFT, DEV_SHARED);
+        memcpy(dst+offs, src, PAGE_SIZE);
+    }
+    printk("]\n");
+
+    clear_fixmap(FIXMAP_MISC);
+}
+
+static void setup_linux_atag(paddr_t tags, paddr_t ram_s, paddr_t ram_e)
+{
+    paddr_t ma = gvirt_to_maddr(tags);
+    void *map = map_domain_page(ma>>PAGE_SHIFT);
+    void *p = map + (tags & (PAGE_SIZE - 1));
+    char cmdline[] = "earlyprintk=xenboot console=ttyAMA1 root=/dev/mmcblk0 debug rw";
+
+    /* not enough room on this page for all the tags */
+    BUG_ON(PAGE_SIZE - (tags & (PAGE_SIZE - 1)) < 8 * sizeof(uint32_t));
+
+#define TAG(type, val) *(type*)p = val; p+= sizeof(type)
+
+    /* ATAG_CORE */
+    TAG(uint32_t, 2);
+    TAG(uint32_t, 0x54410001);
+
+    /* ATAG_MEM */
+    TAG(uint32_t, 4);
+    TAG(uint32_t, 0x54410002);
+    TAG(uint32_t, (ram_e - ram_s) & 0xFFFFFFFF);
+    TAG(uint32_t, ram_s & 0xFFFFFFFF);
+
+    /* ATAG_CMDLINE */
+    TAG(uint32_t, 2 + ((strlen(cmdline) + 4) >> 2));
+    TAG(uint32_t, 0x54410009);
+    memcpy(p, cmdline, strlen(cmdline) + 1);
+    p += ((strlen(cmdline) + 4) >> 2) << 2;
+
+    /* ATAG_NONE */
+    TAG(uint32_t, 0);
+    TAG(uint32_t, 0);
+
+#undef TAG
+
+    unmap_domain_page(map);
+}
+
+/* Store kernel in first 8M of flash */
+#define KERNEL_FLASH_ADDRESS 0x00000000UL
+#define KERNEL_FLASH_SIZE    0x00800000UL
+
+int construct_dom0(struct domain *d)
+{
+    int rc, kernel_order;
+    void *kernel_img;
+
+    struct vcpu *v = d->vcpu[0];
+    struct cpu_user_regs *regs = &v->arch.user_regs;
+
+    struct elf_binary elf;
+    struct elf_dom_parms parms;
+
+    /* Sanity! */
+    BUG_ON(d->domain_id != 0);
+    BUG_ON(d->vcpu[0] == NULL);
+    BUG_ON(v->is_initialised);
+
+    printk("*** LOADING DOMAIN 0 ***\n");
+
+    kernel_order = get_order_from_bytes(KERNEL_FLASH_SIZE);
+    kernel_img = alloc_xenheap_pages(kernel_order, 0);
+    if ( kernel_img == NULL )
+        panic("Cannot allocate temporary buffer for kernel.\n");
+
+    copy_from_flash(kernel_img, KERNEL_FLASH_ADDRESS, KERNEL_FLASH_SIZE);
+
+    d->max_pages = ~0U;
+
+    if ( (rc = elf_init(&elf, kernel_img, KERNEL_FLASH_SIZE )) != 0 )
+        return rc;  memset(regs, 0, sizeof(*regs));
+#ifdef VERBOSE
+    elf_set_verbose(&elf);
+#endif
+    elf_parse_binary(&elf);
+    if ( (rc = elf_xen_parse(&elf, &parms)) != 0 )
+        return rc;
+
+    if ( (rc = p2m_alloc_table(d)) != 0 )
+        return rc;
+
+    /* 128M at 3G physical */
+    /* TODO size and location according to platform info */
+    printk("Populate P2M %#llx->%#llx\n", 0xc0000000ULL, 0xc8000000ULL);
+    p2m_populate_ram(d, 0xc0000000ULL, 0xc8000000ULL);
+
+    printk("Map CS2 MMIO regions 1:1 in the P2M %#llx->%#llx\n", 0x18000000ULL, 0x1BFFFFFFULL);
+    map_mmio_regions(d, 0x18000000, 0x1BFFFFFF, 0x18000000);
+    printk("Map CS3 MMIO regions 1:1 in the P2M %#llx->%#llx\n", 0x1C000000ULL, 0x1FFFFFFFULL);
+    map_mmio_regions(d, 0x1C000000, 0x1FFFFFFF, 0x1C000000);
+    printk("Map VGIC MMIO regions 1:1 in the P2M %#llx->%#llx\n", 0x2C008000ULL, 0x2DFFFFFFULL);
+    map_mmio_regions(d, 0x2C008000, 0x2DFFFFFF, 0x2C008000);
+
+    gicv_setup(d);
+
+    printk("Routing peripheral interrupts to guest\n");
+    /* TODO Get from device tree */
+    gic_route_irq_to_guest(d, 34, "timer0");
+    /*gic_route_irq_to_guest(d, 37, "uart0"); -- XXX used by Xen*/
+    gic_route_irq_to_guest(d, 38, "uart1");
+    gic_route_irq_to_guest(d, 39, "uart2");
+    gic_route_irq_to_guest(d, 40, "uart3");
+    gic_route_irq_to_guest(d, 41, "mmc0-1");
+    gic_route_irq_to_guest(d, 42, "mmc0-2");
+    gic_route_irq_to_guest(d, 44, "keyboard");
+    gic_route_irq_to_guest(d, 45, "mouse");
+    gic_route_irq_to_guest(d, 46, "lcd");
+    gic_route_irq_to_guest(d, 47, "eth");
+
+    /* Enable second stage translation */
+    WRITE_CP32(READ_CP32(HCR) | HCR_VM, HCR); isb();
+
+    /* The following load uses domain's p2m */
+    p2m_load_VTTBR(d);
+
+    printk("Loading ELF image into guest memory\n");
+    elf.dest = (void*)(unsigned long)parms.virt_kstart;
+    elf_load_binary(&elf);
+
+    printk("Free temporary kernel buffer\n");
+    free_xenheap_pages(kernel_img, kernel_order);
+
+    setup_linux_atag(0xc0000100ULL, 0xc0000000ULL, 0xc8000000ULL);
+
+    clear_bit(_VPF_down, &v->pause_flags);
+
+    memset(regs, 0, sizeof(*regs));
+
+    regs->pc = (uint32_t)parms.virt_entry;
+
+    regs->cpsr = PSR_ABT_MASK|PSR_FIQ_MASK|PSR_IRQ_MASK|PSR_MODE_SVC;
+
+/* FROM LINUX head.S
+
+ * Kernel startup entry point.
+ * ---------------------------
+ *
+ * This is normally called from the decompressor code.  The requirements
+ * are: MMU = off, D-cache = off, I-cache = dont care, r0 = 0,
+ * r1 = machine nr, r2 = atags or dtb pointer.
+ *...
+ */
+
+    regs->r0 = 0; /* SBZ */
+    regs->r1 = 2272; /* Machine NR: Versatile Express */
+    regs->r2 = 0xc0000100; /* ATAGS */
+
+    WRITE_CP32(SCTLR_BASE, SCTLR);
+
+    WRITE_CP32(HCR_AMO|HCR_IMO|HCR_VM, HCR);
+    isb();
+
+    local_abort_enable();
+
+    return 0;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 1cfe402b934a -r a8c70f22d704 xen/common/libelf/libelf-dominfo.c
--- a/xen/common/libelf/libelf-dominfo.c	Thu Feb 09 11:33:29 2012 +0000
+++ b/xen/common/libelf/libelf-dominfo.c	Thu Feb 09 11:33:29 2012 +0000
@@ -341,6 +341,12 @@
         return 0;
     }
 
+    if ( elf_uval(elf, elf->ehdr, e_machine) == EM_ARM )
+    {
+         elf_msg(elf, "%s: Not bothering with notes on ARM\n", __FUNCTION__);
+         return 0;
+    }
+
     /* Check the contents of the Xen notes or guest string. */
     if ( ((strlen(parms->loader) == 0) ||
           strncmp(parms->loader, "generic", 7)) &&
diff -r 1cfe402b934a -r a8c70f22d704 xen/include/asm-arm/setup.h
--- a/xen/include/asm-arm/setup.h	Thu Feb 09 11:33:29 2012 +0000
+++ b/xen/include/asm-arm/setup.h	Thu Feb 09 11:33:29 2012 +0000
@@ -5,6 +5,8 @@
 
 void arch_get_xen_caps(xen_capabilities_info_t *info);
 
+int construct_dom0(struct domain *d);
+
 #endif
 /*
  * Local variables:
diff -r 1cfe402b934a -r a8c70f22d704 xen/include/xen/libelf.h
--- a/xen/include/xen/libelf.h	Thu Feb 09 11:33:29 2012 +0000
+++ b/xen/include/xen/libelf.h	Thu Feb 09 11:33:29 2012 +0000
@@ -23,7 +23,7 @@
 #ifndef __XEN_LIBELF_H__
 #define __XEN_LIBELF_H__
 
-#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__) || defined(__arm__)
 #define XEN_ELF_LITTLE_ENDIAN
 #else
 #error define architectural endianness

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:40 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQH-00061T-2y; Thu, 09 Feb 2012 16:00:37 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQF-0005zQ-TO
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:36 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-27.messagelabs.com!1328803175!52086233!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31408 invoked from network); 9 Feb 2012 15:59:36 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 15:59:36 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ5-0004P3-Q5
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:25 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ4-00066Z-QM
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:25 +0000
Message-Id: <E1RvWQ4-00066Z-QM@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:24 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: bit manipulation,
	copy and division libraries
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787209 0
# Node ID 227302111affce41568ff02ab9d7fa91ae2a4e8d
# Parent  46adf08254f9d88ffd3deba833ee89aa977fcb6b
arm: bit manipulation, copy and division libraries

Bit manipulation, division and memcpy & friends implementations for the
ARM architecture, shamelessly taken from Linux.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/Makefile	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,5 @@
+obj-y += memcpy.o memmove.o memset.o memzero.o
+obj-y += findbit.o setbit.o
+obj-y += setbit.o clearbit.o changebit.o
+obj-y += testsetbit.o testclearbit.o testchangebit.o
+obj-y += lib1funcs.o div64.o
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/assembler.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/assembler.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,49 @@
+#ifndef __ARCH_ARM_LIB_ASSEMBLER_H__
+#define __ARCH_ARM_LIB_ASSEMBLER_H__
+
+/* From Linux arch/arm/include/asm/assembler.h */
+/*
+ * Data preload for architectures that support it
+ */
+#define PLD(code...)    code
+
+/*
+ * This can be used to enable code to cacheline align the destination
+ * pointer when bulk writing to memory.  Experiments on StrongARM and
+ * XScale didn't show this a worthwhile thing to do when the cache is not
+ * set to write-allocate (this would need further testing on XScale when WA
+ * is used).
+ *
+ * On Feroceon there is much to gain however, regardless of cache mode.
+ */
+#ifdef CONFIG_CPU_FEROCEON /* Not in Xen... */
+#define CALGN(code...) code
+#else
+#define CALGN(code...)
+#endif
+
+// No Thumb, hence:
+#define W(instr)        instr
+#define ARM(instr...)   instr
+#define THUMB(instr...)
+
+#ifdef CONFIG_ARM_UNWIND
+#define UNWIND(code...)         code
+#else
+#define UNWIND(code...)
+#endif
+
+#define pull            lsl
+#define push            lsr
+#define get_byte_0      lsr #24
+#define get_byte_1      lsr #16
+#define get_byte_2      lsr #8
+#define get_byte_3      lsl #0
+#define put_byte_0      lsl #24
+#define put_byte_1      lsl #16
+#define put_byte_2      lsl #8
+#define put_byte_3      lsl #0
+
+#define smp_dmb dmb
+
+#endif /*  __ARCH_ARM_LIB_ASSEMBLER_H__ */
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/bitops.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/bitops.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,87 @@
+#include <xen/config.h>
+
+#if __LINUX_ARM_ARCH__ >= 6
+       .macro  bitop, instr
+       ands    ip, r1, #3
+       strneb  r1, [ip]                @ assert word-aligned
+       mov     r2, #1
+       and     r3, r0, #31             @ Get bit offset
+       mov     r0, r0, lsr #5
+       add     r1, r1, r0, lsl #2      @ Get word offset
+       mov     r3, r2, lsl r3
+1:     ldrex   r2, [r1]
+       \instr  r2, r2, r3
+       strex   r0, r2, [r1]
+       cmp     r0, #0
+       bne     1b
+       bx      lr
+       .endm
+
+       .macro  testop, instr, store
+       ands    ip, r1, #3
+       strneb  r1, [ip]                @ assert word-aligned
+       mov     r2, #1
+       and     r3, r0, #31             @ Get bit offset
+       mov     r0, r0, lsr #5
+       add     r1, r1, r0, lsl #2      @ Get word offset
+       mov     r3, r2, lsl r3          @ create mask
+       smp_dmb
+1:     ldrex   r2, [r1]
+       ands    r0, r2, r3              @ save old value of bit
+       \instr  r2, r2, r3              @ toggle bit
+       strex   ip, r2, [r1]
+       cmp     ip, #0
+       bne     1b
+       smp_dmb
+       cmp     r0, #0
+       movne   r0, #1
+2:     bx      lr
+       .endm
+#else
+       .macro  bitop, name, instr
+ENTRY( \name           )
+UNWIND(        .fnstart        )
+       ands    ip, r1, #3
+       strneb  r1, [ip]                @ assert word-aligned
+       and     r2, r0, #31
+       mov     r0, r0, lsr #5
+       mov     r3, #1
+       mov     r3, r3, lsl r2
+       save_and_disable_irqs ip
+       ldr     r2, [r1, r0, lsl #2]
+       \instr  r2, r2, r3
+       str     r2, [r1, r0, lsl #2]
+       restore_irqs ip
+       mov     pc, lr
+UNWIND(        .fnend          )
+ENDPROC(\name          )
+       .endm
+
+/**
+ * testop - implement a test_and_xxx_bit operation.
+ * @instr: operational instruction
+ * @store: store instruction
+ *
+ * Note: we can trivially conditionalise the store instruction
+ * to avoid dirtying the data cache.
+ */
+       .macro  testop, name, instr, store
+ENTRY( \name           )
+UNWIND(        .fnstart        )
+       ands    ip, r1, #3
+       strneb  r1, [ip]                @ assert word-aligned
+       and     r3, r0, #31
+       mov     r0, r0, lsr #5
+       save_and_disable_irqs ip
+       ldr     r2, [r1, r0, lsl #2]!
+       mov     r0, #1
+       tst     r2, r0, lsl r3
+       \instr  r2, r2, r0, lsl r3
+       \store  r2, [r1]
+       moveq   r0, #0
+       restore_irqs ip
+       mov     pc, lr
+UNWIND(        .fnend          )
+ENDPROC(\name          )
+       .endm
+#endif
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/changebit.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/changebit.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,18 @@
+/*
+ *  linux/arch/arm/lib/changebit.S
+ *
+ *  Copyright (C) 1995-1996 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <xen/config.h>
+
+#include "assembler.h"
+#include "bitops.h"
+                .text
+
+ENTRY(_change_bit)
+       bitop   eor
+ENDPROC(_change_bit)
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/clearbit.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/clearbit.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,19 @@
+/*
+ *  linux/arch/arm/lib/clearbit.S
+ *
+ *  Copyright (C) 1995-1996 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <xen/config.h>
+
+#include "assembler.h"
+#include "bitops.h"
+                .text
+
+ENTRY(_clear_bit)
+       bitop   bic
+ENDPROC(_clear_bit)
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/copy_template.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/copy_template.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,267 @@
+/*
+ *  linux/arch/arm/lib/copy_template.s
+ *
+ *  Code template for optimized memory copy functions
+ *
+ *  Author:    Nicolas Pitre
+ *  Created:   Sep 28, 2005
+ *  Copyright: MontaVista Software, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+
+/*
+ * Theory of operation
+ * -------------------
+ *
+ * This file provides the core code for a forward memory copy used in
+ * the implementation of memcopy(), copy_to_user() and copy_from_user().
+ *
+ * The including file must define the following accessor macros
+ * according to the need of the given function:
+ *
+ * ldr1w ptr reg abort
+ *
+ *     This loads one word from 'ptr', stores it in 'reg' and increments
+ *     'ptr' to the next word. The 'abort' argument is used for fixup tables.
+ *
+ * ldr4w ptr reg1 reg2 reg3 reg4 abort
+ * ldr8w ptr, reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
+ *
+ *     This loads four or eight words starting from 'ptr', stores them
+ *     in provided registers and increments 'ptr' past those words.
+ *     The'abort' argument is used for fixup tables.
+ *
+ * ldr1b ptr reg cond abort
+ *
+ *     Similar to ldr1w, but it loads a byte and increments 'ptr' one byte.
+ *     It also must apply the condition code if provided, otherwise the
+ *     "al" condition is assumed by default.
+ *
+ * str1w ptr reg abort
+ * str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
+ * str1b ptr reg cond abort
+ *
+ *     Same as their ldr* counterparts, but data is stored to 'ptr' location
+ *     rather than being loaded.
+ *
+ * enter reg1 reg2
+ *
+ *     Preserve the provided registers on the stack plus any additional
+ *     data as needed by the implementation including this code. Called
+ *     upon code entry.
+ *
+ * exit reg1 reg2
+ *
+ *     Restore registers with the values previously saved with the
+ *     'preserv' macro. Called upon code termination.
+ *
+ * LDR1W_SHIFT
+ * STR1W_SHIFT
+ *
+ *     Correction to be applied to the "ip" register when branching into
+ *     the ldr1w or str1w instructions (some of these macros may expand to
+ *     than one 32bit instruction in Thumb-2)
+ */
+
+
+               enter   r4, lr
+
+               subs    r2, r2, #4
+               blt     8f
+               ands    ip, r0, #3
+       PLD(    pld     [r1, #0]                )
+               bne     9f
+               ands    ip, r1, #3
+               bne     10f
+
+1:             subs    r2, r2, #(28)
+               stmfd   sp!, {r5 - r8}
+               blt     5f
+
+       CALGN(  ands    ip, r0, #31             )
+       CALGN(  rsb     r3, ip, #32             )
+       CALGN(  sbcnes  r4, r3, r2              )  @ C is always set here
+       CALGN(  bcs     2f                      )
+       CALGN(  adr     r4, 6f                  )
+       CALGN(  subs    r2, r2, r3              )  @ C gets set
+       CALGN(  add     pc, r4, ip              )
+
+       PLD(    pld     [r1, #0]                )
+2:     PLD(    subs    r2, r2, #96             )
+       PLD(    pld     [r1, #28]               )
+       PLD(    blt     4f                      )
+       PLD(    pld     [r1, #60]               )
+       PLD(    pld     [r1, #92]               )
+
+3:     PLD(    pld     [r1, #124]              )
+4:             ldr8w   r1, r3, r4, r5, r6, r7, r8, ip, lr, abort=20f
+               subs    r2, r2, #32
+               str8w   r0, r3, r4, r5, r6, r7, r8, ip, lr, abort=20f
+               bge     3b
+       PLD(    cmn     r2, #96                 )
+       PLD(    bge     4b                      )
+
+5:             ands    ip, r2, #28
+               rsb     ip, ip, #32
+#if LDR1W_SHIFT > 0
+               lsl     ip, ip, #LDR1W_SHIFT
+#endif
+               addne   pc, pc, ip              @ C is always clear here
+               b       7f
+6:
+               .rept   (1 << LDR1W_SHIFT)
+               W(nop)
+               .endr
+               ldr1w   r1, r3, abort=20f
+               ldr1w   r1, r4, abort=20f
+               ldr1w   r1, r5, abort=20f
+               ldr1w   r1, r6, abort=20f
+               ldr1w   r1, r7, abort=20f
+               ldr1w   r1, r8, abort=20f
+               ldr1w   r1, lr, abort=20f
+
+#if LDR1W_SHIFT < STR1W_SHIFT
+               lsl     ip, ip, #STR1W_SHIFT - LDR1W_SHIFT
+#elif LDR1W_SHIFT > STR1W_SHIFT
+               lsr     ip, ip, #LDR1W_SHIFT - STR1W_SHIFT
+#endif
+               add     pc, pc, ip
+               nop
+               .rept   (1 << STR1W_SHIFT)
+               W(nop)
+               .endr
+               str1w   r0, r3, abort=20f
+               str1w   r0, r4, abort=20f
+               str1w   r0, r5, abort=20f
+               str1w   r0, r6, abort=20f
+               str1w   r0, r7, abort=20f
+               str1w   r0, r8, abort=20f
+               str1w   r0, lr, abort=20f
+
+       CALGN(  bcs     2b                      )
+
+7:             ldmfd   sp!, {r5 - r8}
+
+8:             movs    r2, r2, lsl #31
+               ldr1b   r1, r3, ne, abort=21f
+               ldr1b   r1, r4, cs, abort=21f
+               ldr1b   r1, ip, cs, abort=21f
+               str1b   r0, r3, ne, abort=21f
+               str1b   r0, r4, cs, abort=21f
+               str1b   r0, ip, cs, abort=21f
+
+               exit    r4, pc
+
+9:             rsb     ip, ip, #4
+               cmp     ip, #2
+               ldr1b   r1, r3, gt, abort=21f
+               ldr1b   r1, r4, ge, abort=21f
+               ldr1b   r1, lr, abort=21f
+               str1b   r0, r3, gt, abort=21f
+               str1b   r0, r4, ge, abort=21f
+               subs    r2, r2, ip
+               str1b   r0, lr, abort=21f
+               blt     8b
+               ands    ip, r1, #3
+               beq     1b
+
+10:            bic     r1, r1, #3
+               cmp     ip, #2
+               ldr1w   r1, lr, abort=21f
+               beq     17f
+               bgt     18f
+
+
+               .macro  forward_copy_shift pull push
+
+               subs    r2, r2, #28
+               blt     14f
+
+       CALGN(  ands    ip, r0, #31             )
+       CALGN(  rsb     ip, ip, #32             )
+       CALGN(  sbcnes  r4, ip, r2              )  @ C is always set here
+       CALGN(  subcc   r2, r2, ip              )
+       CALGN(  bcc     15f                     )
+
+11:            stmfd   sp!, {r5 - r9}
+
+       PLD(    pld     [r1, #0]                )
+       PLD(    subs    r2, r2, #96             )
+       PLD(    pld     [r1, #28]               )
+       PLD(    blt     13f                     )
+       PLD(    pld     [r1, #60]               )
+       PLD(    pld     [r1, #92]               )
+
+12:    PLD(    pld     [r1, #124]              )
+13:            ldr4w   r1, r4, r5, r6, r7, abort=19f
+               mov     r3, lr, pull #\pull
+               subs    r2, r2, #32
+               ldr4w   r1, r8, r9, ip, lr, abort=19f
+               orr     r3, r3, r4, push #\push
+               mov     r4, r4, pull #\pull
+               orr     r4, r4, r5, push #\push
+               mov     r5, r5, pull #\pull
+               orr     r5, r5, r6, push #\push
+               mov     r6, r6, pull #\pull
+               orr     r6, r6, r7, push #\push
+               mov     r7, r7, pull #\pull
+               orr     r7, r7, r8, push #\push
+               mov     r8, r8, pull #\pull
+               orr     r8, r8, r9, push #\push
+               mov     r9, r9, pull #\pull
+               orr     r9, r9, ip, push #\push
+               mov     ip, ip, pull #\pull
+               orr     ip, ip, lr, push #\push
+               str8w   r0, r3, r4, r5, r6, r7, r8, r9, ip, , abort=19f
+               bge     12b
+       PLD(    cmn     r2, #96                 )
+       PLD(    bge     13b                     )
+
+               ldmfd   sp!, {r5 - r9}
+
+14:            ands    ip, r2, #28
+               beq     16f
+
+15:            mov     r3, lr, pull #\pull
+               ldr1w   r1, lr, abort=21f
+               subs    ip, ip, #4
+               orr     r3, r3, lr, push #\push
+               str1w   r0, r3, abort=21f
+               bgt     15b
+       CALGN(  cmp     r2, #0                  )
+       CALGN(  bge     11b                     )
+
+16:            sub     r1, r1, #(\push / 8)
+               b       8b
+
+               .endm
+
+
+               forward_copy_shift      pull=8  push=24
+
+17:            forward_copy_shift      pull=16 push=16
+
+18:            forward_copy_shift      pull=24 push=8
+
+
+/*
+ * Abort preamble and completion macros.
+ * If a fixup handler is required then those macros must surround it.
+ * It is assumed that the fixup code will handle the private part of
+ * the exit macro.
+ */
+
+       .macro  copy_abort_preamble
+19:    ldmfd   sp!, {r5 - r9}
+       b       21f
+20:    ldmfd   sp!, {r5 - r8}
+21:
+       .endm
+
+       .macro  copy_abort_end
+       ldmfd   sp!, {r4, pc}
+       .endm
+
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/div64.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/div64.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,211 @@
+/*
+ *  linux/arch/arm/lib/div64.S
+ *
+ *  Optimized computation of 64-bit dividend / 32-bit divisor
+ *
+ *  Author:    Nicolas Pitre
+ *  Created:   Oct 5, 2003
+ *  Copyright: Monta Vista Software, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+
+#include <xen/config.h>
+#include "assembler.h"
+
+#ifdef __ARMEB__
+#define xh r0
+#define xl r1
+#define yh r2
+#define yl r3
+#else
+#define xl r0
+#define xh r1
+#define yl r2
+#define yh r3
+#endif
+
+/*
+ * __do_div64: perform a division with 64-bit dividend and 32-bit divisor.
+ *
+ * Note: Calling convention is totally non standard for optimal code.
+ *       This is meant to be used by do_div() from include/asm/div64.h only.
+ *
+ * Input parameters:
+ *     xh-xl   = dividend (clobbered)
+ *     r4      = divisor (preserved)
+ *
+ * Output values:
+ *     yh-yl   = result
+ *     xh      = remainder
+ *
+ * Clobbered regs: xl, ip
+ */
+
+ENTRY(__do_div64)
+UNWIND(.fnstart)
+
+       @ Test for easy paths first.
+       subs    ip, r4, #1
+       bls     9f                      @ divisor is 0 or 1
+       tst     ip, r4
+       beq     8f                      @ divisor is power of 2
+
+       @ See if we need to handle upper 32-bit result.
+       cmp     xh, r4
+       mov     yh, #0
+       blo     3f
+
+       @ Align divisor with upper part of dividend.
+       @ The aligned divisor is stored in yl preserving the original.
+       @ The bit position is stored in ip.
+
+#if __LINUX_ARM_ARCH__ >= 5
+
+       clz     yl, r4
+       clz     ip, xh
+       sub     yl, yl, ip
+       mov     ip, #1
+       mov     ip, ip, lsl yl
+       mov     yl, r4, lsl yl
+
+#else
+
+       mov     yl, r4
+       mov     ip, #1
+1:     cmp     yl, #0x80000000
+       cmpcc   yl, xh
+       movcc   yl, yl, lsl #1
+       movcc   ip, ip, lsl #1
+       bcc     1b
+
+#endif
+
+       @ The division loop for needed upper bit positions.
+       @ Break out early if dividend reaches 0.
+2:     cmp     xh, yl
+       orrcs   yh, yh, ip
+       subcss  xh, xh, yl
+       movnes  ip, ip, lsr #1
+       mov     yl, yl, lsr #1
+       bne     2b
+
+       @ See if we need to handle lower 32-bit result.
+3:     cmp     xh, #0
+       mov     yl, #0
+       cmpeq   xl, r4
+       movlo   xh, xl
+       movlo   pc, lr
+
+       @ The division loop for lower bit positions.
+       @ Here we shift remainer bits leftwards rather than moving the
+       @ divisor for comparisons, considering the carry-out bit as well.
+       mov     ip, #0x80000000
+4:     movs    xl, xl, lsl #1
+       adcs    xh, xh, xh
+       beq     6f
+       cmpcc   xh, r4
+5:     orrcs   yl, yl, ip
+       subcs   xh, xh, r4
+       movs    ip, ip, lsr #1
+       bne     4b
+       mov     pc, lr
+
+       @ The top part of remainder became zero.  If carry is set
+       @ (the 33th bit) this is a false positive so resume the loop.
+       @ Otherwise, if lower part is also null then we are done.
+6:     bcs     5b
+       cmp     xl, #0
+       moveq   pc, lr
+
+       @ We still have remainer bits in the low part.  Bring them up.
+
+#if __LINUX_ARM_ARCH__ >= 5
+
+       clz     xh, xl                  @ we know xh is zero here so...
+       add     xh, xh, #1
+       mov     xl, xl, lsl xh
+       mov     ip, ip, lsr xh
+
+#else
+
+7:     movs    xl, xl, lsl #1
+       mov     ip, ip, lsr #1
+       bcc     7b
+
+#endif
+
+       @ Current remainder is now 1.  It is worthless to compare with
+       @ divisor at this point since divisor can not be smaller than 3 here.
+       @ If possible, branch for another shift in the division loop.
+       @ If no bit position left then we are done.
+       movs    ip, ip, lsr #1
+       mov     xh, #1
+       bne     4b
+       mov     pc, lr
+
+8:     @ Division by a power of 2: determine what that divisor order is
+       @ then simply shift values around
+
+#if __LINUX_ARM_ARCH__ >= 5
+
+       clz     ip, r4
+       rsb     ip, ip, #31
+
+#else
+
+       mov     yl, r4
+       cmp     r4, #(1 << 16)
+       mov     ip, #0
+       movhs   yl, yl, lsr #16
+       movhs   ip, #16
+
+       cmp     yl, #(1 << 8)
+       movhs   yl, yl, lsr #8
+       addhs   ip, ip, #8
+
+       cmp     yl, #(1 << 4)
+       movhs   yl, yl, lsr #4
+       addhs   ip, ip, #4
+
+       cmp     yl, #(1 << 2)
+       addhi   ip, ip, #3
+       addls   ip, ip, yl, lsr #1
+
+#endif
+
+       mov     yh, xh, lsr ip
+       mov     yl, xl, lsr ip
+       rsb     ip, ip, #32
+ ARM(  orr     yl, yl, xh, lsl ip      )
+ THUMB(        lsl     xh, xh, ip              )
+ THUMB(        orr     yl, yl, xh              )
+       mov     xh, xl, lsl ip
+       mov     xh, xh, lsr ip
+       mov     pc, lr
+
+       @ eq -> division by 1: obvious enough...
+9:     moveq   yl, xl
+       moveq   yh, xh
+       moveq   xh, #0
+       moveq   pc, lr
+UNWIND(.fnend)
+
+UNWIND(.fnstart)
+UNWIND(.pad #4)
+UNWIND(.save {lr})
+Ldiv0_64:
+       @ Division by 0:
+       str     lr, [sp, #-8]!
+       bl      __div0
+
+       @ as wrong as it could be...
+       mov     yl, #0
+       mov     yh, #0
+       mov     xh, #0
+       ldr     pc, [sp], #8
+
+UNWIND(.fnend)
+ENDPROC(__do_div64)
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/findbit.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/findbit.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,198 @@
+/*
+ *  linux/arch/arm/lib/findbit.S
+ *
+ *  Copyright (C) 1995-2000 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 16th March 2001 - John Ripley <jripley@sonicblue.com>
+ *   Fixed so that "size" is an exclusive not an inclusive quantity.
+ *   All users of these functions expect exclusive sizes, and may
+ *   also call with zero size.
+ * Reworked by rmk.
+ */
+
+#include <xen/config.h>
+
+#include "assembler.h"
+                .text
+
+/*
+ * Purpose  : Find a 'zero' bit
+ * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit);
+ */
+ENTRY(_find_first_zero_bit_le)
+               teq     r1, #0
+               beq     3f
+               mov     r2, #0
+1:
+ ARM(          ldrb    r3, [r0, r2, lsr #3]    )
+ THUMB(                lsr     r3, r2, #3              )
+ THUMB(                ldrb    r3, [r0, r3]            )
+               eors    r3, r3, #0xff           @ invert bits
+               bne     .L_found                @ any now set - found zero bit
+               add     r2, r2, #8              @ next bit pointer
+2:             cmp     r2, r1                  @ any more?
+               blo     1b
+3:             mov     r0, r1                  @ no free bits
+               mov     pc, lr
+ENDPROC(_find_first_zero_bit_le)
+
+/*
+ * Purpose  : Find next 'zero' bit
+ * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset)
+ */
+ENTRY(_find_next_zero_bit_le)
+               teq     r1, #0
+               beq     3b
+               ands    ip, r2, #7
+               beq     1b                      @ If new byte, goto old routine
+ ARM(          ldrb    r3, [r0, r2, lsr #3]    )
+ THUMB(                lsr     r3, r2, #3              )
+ THUMB(                ldrb    r3, [r0, r3]            )
+               eor     r3, r3, #0xff           @ now looking for a 1 bit
+               movs    r3, r3, lsr ip          @ shift off unused bits
+               bne     .L_found
+               orr     r2, r2, #7              @ if zero, then no bits here
+               add     r2, r2, #1              @ align bit pointer
+               b       2b                      @ loop for next bit
+ENDPROC(_find_next_zero_bit_le)
+
+/*
+ * Purpose  : Find a 'one' bit
+ * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit);
+ */
+ENTRY(_find_first_bit_le)
+               teq     r1, #0
+               beq     3f
+               mov     r2, #0
+1:
+ ARM(          ldrb    r3, [r0, r2, lsr #3]    )
+ THUMB(                lsr     r3, r2, #3              )
+ THUMB(                ldrb    r3, [r0, r3]            )
+               movs    r3, r3
+               bne     .L_found                @ any now set - found zero bit
+               add     r2, r2, #8              @ next bit pointer
+2:             cmp     r2, r1                  @ any more?
+               blo     1b
+3:             mov     r0, r1                  @ no free bits
+               mov     pc, lr
+ENDPROC(_find_first_bit_le)
+
+/*
+ * Purpose  : Find next 'one' bit
+ * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset)
+ */
+ENTRY(_find_next_bit_le)
+               teq     r1, #0
+               beq     3b
+               ands    ip, r2, #7
+               beq     1b                      @ If new byte, goto old routine
+ ARM(          ldrb    r3, [r0, r2, lsr #3]    )
+ THUMB(                lsr     r3, r2, #3              )
+ THUMB(                ldrb    r3, [r0, r3]            )
+               movs    r3, r3, lsr ip          @ shift off unused bits
+               bne     .L_found
+               orr     r2, r2, #7              @ if zero, then no bits here
+               add     r2, r2, #1              @ align bit pointer
+               b       2b                      @ loop for next bit
+ENDPROC(_find_next_bit_le)
+
+#ifdef __ARMEB__
+
+ENTRY(_find_first_zero_bit_be)
+               teq     r1, #0
+               beq     3f
+               mov     r2, #0
+1:             eor     r3, r2, #0x18           @ big endian byte ordering
+ ARM(          ldrb    r3, [r0, r3, lsr #3]    )
+ THUMB(                lsr     r3, #3                  )
+ THUMB(                ldrb    r3, [r0, r3]            )
+               eors    r3, r3, #0xff           @ invert bits
+               bne     .L_found                @ any now set - found zero bit
+               add     r2, r2, #8              @ next bit pointer
+2:             cmp     r2, r1                  @ any more?
+               blo     1b
+3:             mov     r0, r1                  @ no free bits
+               mov     pc, lr
+ENDPROC(_find_first_zero_bit_be)
+
+ENTRY(_find_next_zero_bit_be)
+               teq     r1, #0
+               beq     3b
+               ands    ip, r2, #7
+               beq     1b                      @ If new byte, goto old routine
+               eor     r3, r2, #0x18           @ big endian byte ordering
+ ARM(          ldrb    r3, [r0, r3, lsr #3]    )
+ THUMB(                lsr     r3, #3                  )
+ THUMB(                ldrb    r3, [r0, r3]            )
+               eor     r3, r3, #0xff           @ now looking for a 1 bit
+               movs    r3, r3, lsr ip          @ shift off unused bits
+               bne     .L_found
+               orr     r2, r2, #7              @ if zero, then no bits here
+               add     r2, r2, #1              @ align bit pointer
+               b       2b                      @ loop for next bit
+ENDPROC(_find_next_zero_bit_be)
+
+ENTRY(_find_first_bit_be)
+               teq     r1, #0
+               beq     3f
+               mov     r2, #0
+1:             eor     r3, r2, #0x18           @ big endian byte ordering
+ ARM(          ldrb    r3, [r0, r3, lsr #3]    )
+ THUMB(                lsr     r3, #3                  )
+ THUMB(                ldrb    r3, [r0, r3]            )
+               movs    r3, r3
+               bne     .L_found                @ any now set - found zero bit
+               add     r2, r2, #8              @ next bit pointer
+2:             cmp     r2, r1                  @ any more?
+               blo     1b
+3:             mov     r0, r1                  @ no free bits
+               mov     pc, lr
+ENDPROC(_find_first_bit_be)
+
+ENTRY(_find_next_bit_be)
+               teq     r1, #0
+               beq     3b
+               ands    ip, r2, #7
+               beq     1b                      @ If new byte, goto old routine
+               eor     r3, r2, #0x18           @ big endian byte ordering
+ ARM(          ldrb    r3, [r0, r3, lsr #3]    )
+ THUMB(                lsr     r3, #3                  )
+ THUMB(                ldrb    r3, [r0, r3]            )
+               movs    r3, r3, lsr ip          @ shift off unused bits
+               bne     .L_found
+               orr     r2, r2, #7              @ if zero, then no bits here
+               add     r2, r2, #1              @ align bit pointer
+               b       2b                      @ loop for next bit
+ENDPROC(_find_next_bit_be)
+
+#endif
+
+/*
+ * One or more bits in the LSB of r3 are assumed to be set.
+ */
+.L_found:
+#if __LINUX_ARM_ARCH__ >= 5
+               rsb     r0, r3, #0
+               and     r3, r3, r0
+               clz     r3, r3
+               rsb     r3, r3, #31
+               add     r0, r2, r3
+#else
+               tst     r3, #0x0f
+               addeq   r2, r2, #4
+               movne   r3, r3, lsl #4
+               tst     r3, #0x30
+               addeq   r2, r2, #2
+               movne   r3, r3, lsl #2
+               tst     r3, #0x40
+               addeq   r2, r2, #1
+               mov     r0, r2
+#endif
+               cmp     r1, r0                  @ Clamp to maxbit
+               movlo   r0, r1
+               mov     pc, lr
+
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/lib1funcs.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/lib1funcs.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,389 @@
+/*
+ * linux/arch/arm/lib/lib1funcs.S: Optimized ARM division routines
+ *
+ * Author: Nicolas Pitre <nico@fluxnic.net>
+ *   - contributed to gcc-3.4 on Sep 30, 2003
+ *   - adapted for the Linux kernel on Oct 2, 2003
+ */
+
+/* Copyright 1995, 1996, 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
+
+This file is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+This file 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
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+
+#include <xen/config.h>
+#include "assembler.h"
+
+.macro ARM_DIV_BODY dividend, divisor, result, curbit
+
+#if __LINUX_ARM_ARCH__ >= 5
+
+       clz     \curbit, \divisor
+       clz     \result, \dividend
+       sub     \result, \curbit, \result
+       mov     \curbit, #1
+       mov     \divisor, \divisor, lsl \result
+       mov     \curbit, \curbit, lsl \result
+       mov     \result, #0
+
+#else
+
+       @ Initially shift the divisor left 3 bits if possible,
+       @ set curbit accordingly.  This allows for curbit to be located
+       @ at the left end of each 4 bit nibbles in the division loop
+       @ to save one loop in most cases.
+       tst     \divisor, #0xe0000000
+       moveq   \divisor, \divisor, lsl #3
+       moveq   \curbit, #8
+       movne   \curbit, #1
+
+       @ Unless the divisor is very big, shift it up in multiples of
+       @ four bits, since this is the amount of unwinding in the main
+       @ division loop.  Continue shifting until the divisor is
+       @ larger than the dividend.
+1:     cmp     \divisor, #0x10000000
+       cmplo   \divisor, \dividend
+       movlo   \divisor, \divisor, lsl #4
+       movlo   \curbit, \curbit, lsl #4
+       blo     1b
+
+       @ For very big divisors, we must shift it a bit at a time, or
+       @ we will be in danger of overflowing.
+1:     cmp     \divisor, #0x80000000
+       cmplo   \divisor, \dividend
+       movlo   \divisor, \divisor, lsl #1
+       movlo   \curbit, \curbit, lsl #1
+       blo     1b
+
+       mov     \result, #0
+
+#endif
+
+       @ Division loop
+1:     cmp     \dividend, \divisor
+       subhs   \dividend, \dividend, \divisor
+       orrhs   \result,   \result,   \curbit
+       cmp     \dividend, \divisor,  lsr #1
+       subhs   \dividend, \dividend, \divisor, lsr #1
+       orrhs   \result,   \result,   \curbit,  lsr #1
+       cmp     \dividend, \divisor,  lsr #2
+       subhs   \dividend, \dividend, \divisor, lsr #2
+       orrhs   \result,   \result,   \curbit,  lsr #2
+       cmp     \dividend, \divisor,  lsr #3
+       subhs   \dividend, \dividend, \divisor, lsr #3
+       orrhs   \result,   \result,   \curbit,  lsr #3
+       cmp     \dividend, #0                   @ Early termination?
+       movnes  \curbit,   \curbit,  lsr #4     @ No, any more bits to do?
+       movne   \divisor,  \divisor, lsr #4
+       bne     1b
+
+.endm
+
+
+.macro ARM_DIV2_ORDER divisor, order
+
+#if __LINUX_ARM_ARCH__ >= 5
+
+       clz     \order, \divisor
+       rsb     \order, \order, #31
+
+#else
+
+       cmp     \divisor, #(1 << 16)
+       movhs   \divisor, \divisor, lsr #16
+       movhs   \order, #16
+       movlo   \order, #0
+
+       cmp     \divisor, #(1 << 8)
+       movhs   \divisor, \divisor, lsr #8
+       addhs   \order, \order, #8
+
+       cmp     \divisor, #(1 << 4)
+       movhs   \divisor, \divisor, lsr #4
+       addhs   \order, \order, #4
+
+       cmp     \divisor, #(1 << 2)
+       addhi   \order, \order, #3
+       addls   \order, \order, \divisor, lsr #1
+
+#endif
+
+.endm
+
+
+.macro ARM_MOD_BODY dividend, divisor, order, spare
+
+#if __LINUX_ARM_ARCH__ >= 5
+
+       clz     \order, \divisor
+       clz     \spare, \dividend
+       sub     \order, \order, \spare
+       mov     \divisor, \divisor, lsl \order
+
+#else
+
+       mov     \order, #0
+
+       @ Unless the divisor is very big, shift it up in multiples of
+       @ four bits, since this is the amount of unwinding in the main
+       @ division loop.  Continue shifting until the divisor is
+       @ larger than the dividend.
+1:     cmp     \divisor, #0x10000000
+       cmplo   \divisor, \dividend
+       movlo   \divisor, \divisor, lsl #4
+       addlo   \order, \order, #4
+       blo     1b
+
+       @ For very big divisors, we must shift it a bit at a time, or
+       @ we will be in danger of overflowing.
+1:     cmp     \divisor, #0x80000000
+       cmplo   \divisor, \dividend
+       movlo   \divisor, \divisor, lsl #1
+       addlo   \order, \order, #1
+       blo     1b
+
+#endif
+
+       @ Perform all needed substractions to keep only the reminder.
+       @ Do comparisons in batch of 4 first.
+       subs    \order, \order, #3              @ yes, 3 is intended here
+       blt     2f
+
+1:     cmp     \dividend, \divisor
+       subhs   \dividend, \dividend, \divisor
+       cmp     \dividend, \divisor,  lsr #1
+       subhs   \dividend, \dividend, \divisor, lsr #1
+       cmp     \dividend, \divisor,  lsr #2
+       subhs   \dividend, \dividend, \divisor, lsr #2
+       cmp     \dividend, \divisor,  lsr #3
+       subhs   \dividend, \dividend, \divisor, lsr #3
+       cmp     \dividend, #1
+       mov     \divisor, \divisor, lsr #4
+       subges  \order, \order, #4
+       bge     1b
+
+       tst     \order, #3
+       teqne   \dividend, #0
+       beq     5f
+
+       @ Either 1, 2 or 3 comparison/substractions are left.
+2:     cmn     \order, #2
+       blt     4f
+       beq     3f
+       cmp     \dividend, \divisor
+       subhs   \dividend, \dividend, \divisor
+       mov     \divisor,  \divisor,  lsr #1
+3:     cmp     \dividend, \divisor
+       subhs   \dividend, \dividend, \divisor
+       mov     \divisor,  \divisor,  lsr #1
+4:     cmp     \dividend, \divisor
+       subhs   \dividend, \dividend, \divisor
+5:
+.endm
+
+
+ENTRY(__udivsi3)
+ENTRY(__aeabi_uidiv)
+UNWIND(.fnstart)
+
+       subs    r2, r1, #1
+       moveq   pc, lr
+       bcc     Ldiv0
+       cmp     r0, r1
+       bls     11f
+       tst     r1, r2
+       beq     12f
+
+       ARM_DIV_BODY r0, r1, r2, r3
+
+       mov     r0, r2
+       mov     pc, lr
+
+11:    moveq   r0, #1
+       movne   r0, #0
+       mov     pc, lr
+
+12:    ARM_DIV2_ORDER r1, r2
+
+       mov     r0, r0, lsr r2
+       mov     pc, lr
+
+UNWIND(.fnend)
+ENDPROC(__udivsi3)
+ENDPROC(__aeabi_uidiv)
+
+ENTRY(__umodsi3)
+UNWIND(.fnstart)
+
+       subs    r2, r1, #1                      @ compare divisor with 1
+       bcc     Ldiv0
+       cmpne   r0, r1                          @ compare dividend with divisor
+       moveq   r0, #0
+       tsthi   r1, r2                          @ see if divisor is power of 2
+       andeq   r0, r0, r2
+       movls   pc, lr
+
+       ARM_MOD_BODY r0, r1, r2, r3
+
+       mov     pc, lr
+
+UNWIND(.fnend)
+ENDPROC(__umodsi3)
+
+ENTRY(__divsi3)
+ENTRY(__aeabi_idiv)
+UNWIND(.fnstart)
+
+       cmp     r1, #0
+       eor     ip, r0, r1                      @ save the sign of the result.
+       beq     Ldiv0
+       rsbmi   r1, r1, #0                      @ loops below use unsigned.
+       subs    r2, r1, #1                      @ division by 1 or -1 ?
+       beq     10f
+       movs    r3, r0
+       rsbmi   r3, r0, #0                      @ positive dividend value
+       cmp     r3, r1
+       bls     11f
+       tst     r1, r2                          @ divisor is power of 2 ?
+       beq     12f
+
+       ARM_DIV_BODY r3, r1, r0, r2
+
+       cmp     ip, #0
+       rsbmi   r0, r0, #0
+       mov     pc, lr
+
+10:    teq     ip, r0                          @ same sign ?
+       rsbmi   r0, r0, #0
+       mov     pc, lr
+
+11:    movlo   r0, #0
+       moveq   r0, ip, asr #31
+       orreq   r0, r0, #1
+       mov     pc, lr
+
+12:    ARM_DIV2_ORDER r1, r2
+
+       cmp     ip, #0
+       mov     r0, r3, lsr r2
+       rsbmi   r0, r0, #0
+       mov     pc, lr
+
+UNWIND(.fnend)
+ENDPROC(__divsi3)
+ENDPROC(__aeabi_idiv)
+
+ENTRY(__modsi3)
+UNWIND(.fnstart)
+
+       cmp     r1, #0
+       beq     Ldiv0
+       rsbmi   r1, r1, #0                      @ loops below use unsigned.
+       movs    ip, r0                          @ preserve sign of dividend
+       rsbmi   r0, r0, #0                      @ if negative make positive
+       subs    r2, r1, #1                      @ compare divisor with 1
+       cmpne   r0, r1                          @ compare dividend with divisor
+       moveq   r0, #0
+       tsthi   r1, r2                          @ see if divisor is power of 2
+       andeq   r0, r0, r2
+       bls     10f
+
+       ARM_MOD_BODY r0, r1, r2, r3
+
+10:    cmp     ip, #0
+       rsbmi   r0, r0, #0
+       mov     pc, lr
+
+UNWIND(.fnend)
+ENDPROC(__modsi3)
+
+#ifdef CONFIG_AEABI
+
+ENTRY(__aeabi_uidivmod)
+UNWIND(.fnstart)
+UNWIND(.save {r0, r1, ip, lr}  )
+
+       stmfd   sp!, {r0, r1, ip, lr}
+       bl      __aeabi_uidiv
+       ldmfd   sp!, {r1, r2, ip, lr}
+       mul     r3, r0, r2
+       sub     r1, r1, r3
+       mov     pc, lr
+
+UNWIND(.fnend)
+ENDPROC(__aeabi_uidivmod)
+
+ENTRY(__aeabi_idivmod)
+UNWIND(.fnstart)
+UNWIND(.save {r0, r1, ip, lr}  )
+       stmfd   sp!, {r0, r1, ip, lr}
+       bl      __aeabi_idiv
+       ldmfd   sp!, {r1, r2, ip, lr}
+       mul     r3, r0, r2
+       sub     r1, r1, r3
+       mov     pc, lr
+
+UNWIND(.fnend)
+ENDPROC(__aeabi_idivmod)
+
+ENTRY(__aeabi_uldivmod)
+UNWIND(.fnstart)
+UNWIND(.save {lr}      )
+       sub sp, sp, #8
+       stmfd   sp!, {sp, lr}
+       bl __qdivrem
+       ldr lr, [sp, #4]
+       add sp, sp, #8
+       ldmfd sp!, {r2, r3}
+       mov     pc, lr
+
+UNWIND(.fnend)
+ENDPROC(__aeabi_uldivmod)
+
+ENTRY(__aeabi_ldivmod)
+UNWIND(.fnstart)
+UNWIND(.save {lr}      )
+       sub sp, sp, #16
+       stmfd   sp!, {sp, lr}
+       bl __ldivmod_helper
+       ldr lr, [sp, #4]
+       add sp, sp, #16
+       ldmfd   sp!, {r2, r3}
+       mov     pc, lr
+
+UNWIND(.fnend)
+ENDPROC(__aeabi_ldivmod)
+#endif
+
+Ldiv0:
+UNWIND(.fnstart)
+UNWIND(.pad #4)
+UNWIND(.save {lr})
+       str     lr, [sp, #-8]!
+       bl      __div0
+       mov     r0, #0                  @ About as wrong as it could be.
+       ldr     pc, [sp], #8
+UNWIND(.fnend)
+ENDPROC(Ldiv0)
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/memcpy.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/memcpy.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,63 @@
+/*
+ *  linux/arch/arm/lib/memcpy.S
+ *
+ *  Author:    Nicolas Pitre
+ *  Created:   Sep 28, 2005
+ *  Copyright: MontaVista Software, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+
+#include <xen/config.h>
+#include "assembler.h"
+
+#define LDR1W_SHIFT    0
+#define STR1W_SHIFT    0
+
+       .macro ldr1w ptr reg abort
+       W(ldr) \reg, [\ptr], #4
+       .endm
+
+       .macro ldr4w ptr reg1 reg2 reg3 reg4 abort
+       ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4}
+       .endm
+
+       .macro ldr8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
+       ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8}
+       .endm
+
+       .macro ldr1b ptr reg cond=al abort
+       ldr\cond\()b \reg, [\ptr], #1
+       .endm
+
+       .macro str1w ptr reg abort
+       W(str) \reg, [\ptr], #4
+       .endm
+
+       .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
+       stmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8}
+       .endm
+
+       .macro str1b ptr reg cond=al abort
+       str\cond\()b \reg, [\ptr], #1
+       .endm
+
+       .macro enter reg1 reg2
+       stmdb sp!, {r0, \reg1, \reg2}
+       .endm
+
+       .macro exit reg1 reg2
+       ldmfd sp!, {r0, \reg1, \reg2}
+       .endm
+
+       .text
+
+/* Prototype: void *memcpy(void *dest, const void *src, size_t n); */
+
+ENTRY(memcpy)
+
+#include "copy_template.S"
+
+ENDPROC(memcpy)
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/memmove.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/memmove.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,200 @@
+/*
+ *  linux/arch/arm/lib/memmove.S
+ *
+ *  Author:    Nicolas Pitre
+ *  Created:   Sep 28, 2005
+ *  Copyright: (C) MontaVista Software Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+
+#include <xen/config.h>
+
+#include "assembler.h"
+
+               .text
+
+/*
+ * Prototype: void *memmove(void *dest, const void *src, size_t n);
+ *
+ * Note:
+ *
+ * If the memory regions don't overlap, we simply branch to memcpy which is
+ * normally a bit faster. Otherwise the copy is done going downwards.  This
+ * is a transposition of the code from copy_template.S but with the copy
+ * occurring in the opposite direction.
+ */
+
+ENTRY(memmove)
+
+               subs    ip, r0, r1
+               cmphi   r2, ip
+               bls     memcpy
+
+               stmfd   sp!, {r0, r4, lr}
+               add     r1, r1, r2
+               add     r0, r0, r2
+               subs    r2, r2, #4
+               blt     8f
+               ands    ip, r0, #3
+       PLD(    pld     [r1, #-4]               )
+               bne     9f
+               ands    ip, r1, #3
+               bne     10f
+
+1:             subs    r2, r2, #(28)
+               stmfd   sp!, {r5 - r8}
+               blt     5f
+
+       CALGN(  ands    ip, r0, #31             )
+       CALGN(  sbcnes  r4, ip, r2              )  @ C is always set here
+       CALGN(  bcs     2f                      )
+       CALGN(  adr     r4, 6f                  )
+       CALGN(  subs    r2, r2, ip              )  @ C is set here
+       CALGN(  rsb     ip, ip, #32             )
+       CALGN(  add     pc, r4, ip              )
+
+       PLD(    pld     [r1, #-4]               )
+2:     PLD(    subs    r2, r2, #96             )
+       PLD(    pld     [r1, #-32]              )
+       PLD(    blt     4f                      )
+       PLD(    pld     [r1, #-64]              )
+       PLD(    pld     [r1, #-96]              )
+
+3:     PLD(    pld     [r1, #-128]             )
+4:             ldmdb   r1!, {r3, r4, r5, r6, r7, r8, ip, lr}
+               subs    r2, r2, #32
+               stmdb   r0!, {r3, r4, r5, r6, r7, r8, ip, lr}
+               bge     3b
+       PLD(    cmn     r2, #96                 )
+       PLD(    bge     4b                      )
+
+5:             ands    ip, r2, #28
+               rsb     ip, ip, #32
+               addne   pc, pc, ip              @ C is always clear here
+               b       7f
+6:             W(nop)
+               W(ldr)  r3, [r1, #-4]!
+               W(ldr)  r4, [r1, #-4]!
+               W(ldr)  r5, [r1, #-4]!
+               W(ldr)  r6, [r1, #-4]!
+               W(ldr)  r7, [r1, #-4]!
+               W(ldr)  r8, [r1, #-4]!
+               W(ldr)  lr, [r1, #-4]!
+
+               add     pc, pc, ip
+               nop
+               W(nop)
+               W(str)  r3, [r0, #-4]!
+               W(str)  r4, [r0, #-4]!
+               W(str)  r5, [r0, #-4]!
+               W(str)  r6, [r0, #-4]!
+               W(str)  r7, [r0, #-4]!
+               W(str)  r8, [r0, #-4]!
+               W(str)  lr, [r0, #-4]!
+
+       CALGN(  bcs     2b                      )
+
+7:             ldmfd   sp!, {r5 - r8}
+
+8:             movs    r2, r2, lsl #31
+               ldrneb  r3, [r1, #-1]!
+               ldrcsb  r4, [r1, #-1]!
+               ldrcsb  ip, [r1, #-1]
+               strneb  r3, [r0, #-1]!
+               strcsb  r4, [r0, #-1]!
+               strcsb  ip, [r0, #-1]
+               ldmfd   sp!, {r0, r4, pc}
+
+9:             cmp     ip, #2
+               ldrgtb  r3, [r1, #-1]!
+               ldrgeb  r4, [r1, #-1]!
+               ldrb    lr, [r1, #-1]!
+               strgtb  r3, [r0, #-1]!
+               strgeb  r4, [r0, #-1]!
+               subs    r2, r2, ip
+               strb    lr, [r0, #-1]!
+               blt     8b
+               ands    ip, r1, #3
+               beq     1b
+
+10:            bic     r1, r1, #3
+               cmp     ip, #2
+               ldr     r3, [r1, #0]
+               beq     17f
+               blt     18f
+
+
+               .macro  backward_copy_shift push pull
+
+               subs    r2, r2, #28
+               blt     14f
+
+       CALGN(  ands    ip, r0, #31             )
+       CALGN(  sbcnes  r4, ip, r2              )  @ C is always set here
+       CALGN(  subcc   r2, r2, ip              )
+       CALGN(  bcc     15f                     )
+
+11:            stmfd   sp!, {r5 - r9}
+
+       PLD(    pld     [r1, #-4]               )
+       PLD(    subs    r2, r2, #96             )
+       PLD(    pld     [r1, #-32]              )
+       PLD(    blt     13f                     )
+       PLD(    pld     [r1, #-64]              )
+       PLD(    pld     [r1, #-96]              )
+
+12:    PLD(    pld     [r1, #-128]             )
+13:            ldmdb   r1!, {r7, r8, r9, ip}
+               mov     lr, r3, push #\push
+               subs    r2, r2, #32
+               ldmdb   r1!, {r3, r4, r5, r6}
+               orr     lr, lr, ip, pull #\pull
+               mov     ip, ip, push #\push
+               orr     ip, ip, r9, pull #\pull
+               mov     r9, r9, push #\push
+               orr     r9, r9, r8, pull #\pull
+               mov     r8, r8, push #\push
+               orr     r8, r8, r7, pull #\pull
+               mov     r7, r7, push #\push
+               orr     r7, r7, r6, pull #\pull
+               mov     r6, r6, push #\push
+               orr     r6, r6, r5, pull #\pull
+               mov     r5, r5, push #\push
+               orr     r5, r5, r4, pull #\pull
+               mov     r4, r4, push #\push
+               orr     r4, r4, r3, pull #\pull
+               stmdb   r0!, {r4 - r9, ip, lr}
+               bge     12b
+       PLD(    cmn     r2, #96                 )
+       PLD(    bge     13b                     )
+
+               ldmfd   sp!, {r5 - r9}
+
+14:            ands    ip, r2, #28
+               beq     16f
+
+15:            mov     lr, r3, push #\push
+               ldr     r3, [r1, #-4]!
+               subs    ip, ip, #4
+               orr     lr, lr, r3, pull #\pull
+               str     lr, [r0, #-4]!
+               bgt     15b
+       CALGN(  cmp     r2, #0                  )
+       CALGN(  bge     11b                     )
+
+16:            add     r1, r1, #(\pull / 8)
+               b       8b
+
+               .endm
+
+
+               backward_copy_shift     push=8  pull=24
+
+17:            backward_copy_shift     push=16 pull=16
+
+18:            backward_copy_shift     push=24 pull=8
+
+ENDPROC(memmove)
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/memset.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/memset.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,129 @@
+/*
+ *  linux/arch/arm/lib/memset.S
+ *
+ *  Copyright (C) 1995-2000 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ *  ASM optimised string functions
+ */
+
+#include <xen/config.h>
+
+#include "assembler.h"
+
+       .text
+       .align  5
+       .word   0
+
+1:     subs    r2, r2, #4              @ 1 do we have enough
+       blt     5f                      @ 1 bytes to align with?
+       cmp     r3, #2                  @ 1
+       strltb  r1, [r0], #1            @ 1
+       strleb  r1, [r0], #1            @ 1
+       strb    r1, [r0], #1            @ 1
+       add     r2, r2, r3              @ 1 (r2 = r2 - (4 - r3))
+/*
+ * The pointer is now aligned and the length is adjusted.  Try doing the
+ * memset again.
+ */
+
+ENTRY(memset)
+       ands    r3, r0, #3              @ 1 unaligned?
+       bne     1b                      @ 1
+/*
+ * we know that the pointer in r0 is aligned to a word boundary.
+ */
+       orr     r1, r1, r1, lsl #8
+       orr     r1, r1, r1, lsl #16
+       mov     r3, r1
+       cmp     r2, #16
+       blt     4f
+
+#if ! CALGN(1)+0
+
+/*
+ * We need an extra register for this loop - save the return address and
+ * use the LR
+ */
+       str     lr, [sp, #-4]!
+       mov     ip, r1
+       mov     lr, r1
+
+2:     subs    r2, r2, #64
+       stmgeia r0!, {r1, r3, ip, lr}   @ 64 bytes at a time.
+       stmgeia r0!, {r1, r3, ip, lr}
+       stmgeia r0!, {r1, r3, ip, lr}
+       stmgeia r0!, {r1, r3, ip, lr}
+       bgt     2b
+       ldmeqfd sp!, {pc}               @ Now <64 bytes to go.
+/*
+ * No need to correct the count; we're only testing bits from now on
+ */
+       tst     r2, #32
+       stmneia r0!, {r1, r3, ip, lr}
+       stmneia r0!, {r1, r3, ip, lr}
+       tst     r2, #16
+       stmneia r0!, {r1, r3, ip, lr}
+       ldr     lr, [sp], #4
+
+#else
+
+/*
+ * This version aligns the destination pointer in order to write
+ * whole cache lines at once.
+ */
+
+       stmfd   sp!, {r4-r7, lr}
+       mov     r4, r1
+       mov     r5, r1
+       mov     r6, r1
+       mov     r7, r1
+       mov     ip, r1
+       mov     lr, r1
+
+       cmp     r2, #96
+       tstgt   r0, #31
+       ble     3f
+
+       and     ip, r0, #31
+       rsb     ip, ip, #32
+       sub     r2, r2, ip
+       movs    ip, ip, lsl #(32 - 4)
+       stmcsia r0!, {r4, r5, r6, r7}
+       stmmiia r0!, {r4, r5}
+       tst     ip, #(1 << 30)
+       mov     ip, r1
+       strne   r1, [r0], #4
+
+3:     subs    r2, r2, #64
+       stmgeia r0!, {r1, r3-r7, ip, lr}
+       stmgeia r0!, {r1, r3-r7, ip, lr}
+       bgt     3b
+       ldmeqfd sp!, {r4-r7, pc}
+
+       tst     r2, #32
+       stmneia r0!, {r1, r3-r7, ip, lr}
+       tst     r2, #16
+       stmneia r0!, {r4-r7}
+       ldmfd   sp!, {r4-r7, lr}
+
+#endif
+
+4:     tst     r2, #8
+       stmneia r0!, {r1, r3}
+       tst     r2, #4
+       strne   r1, [r0], #4
+/*
+ * When we get here, we've got less than 4 bytes to zero.  We
+ * may have an unaligned pointer as well.
+ */
+5:     tst     r2, #2
+       strneb  r1, [r0], #1
+       strneb  r1, [r0], #1
+       tst     r2, #1
+       strneb  r1, [r0], #1
+       mov     pc, lr
+ENDPROC(memset)
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/memzero.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/memzero.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,127 @@
+/*
+ *  linux/arch/arm/lib/memzero.S
+ *
+ *  Copyright (C) 1995-2000 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <xen/config.h>
+
+#include "assembler.h"
+
+       .text
+       .align  5
+       .word   0
+/*
+ * Align the pointer in r0.  r3 contains the number of bytes that we are
+ * mis-aligned by, and r1 is the number of bytes.  If r1 < 4, then we
+ * don't bother; we use byte stores instead.
+ */
+1:     subs    r1, r1, #4              @ 1 do we have enough
+       blt     5f                      @ 1 bytes to align with?
+       cmp     r3, #2                  @ 1
+       strltb  r2, [r0], #1            @ 1
+       strleb  r2, [r0], #1            @ 1
+       strb    r2, [r0], #1            @ 1
+       add     r1, r1, r3              @ 1 (r1 = r1 - (4 - r3))
+/*
+ * The pointer is now aligned and the length is adjusted.  Try doing the
+ * memzero again.
+ */
+
+ENTRY(__memzero)
+       mov     r2, #0                  @ 1
+       ands    r3, r0, #3              @ 1 unaligned?
+       bne     1b                      @ 1
+/*
+ * r3 = 0, and we know that the pointer in r0 is aligned to a word boundary.
+ */
+       cmp     r1, #16                 @ 1 we can skip this chunk if we
+       blt     4f                      @ 1 have < 16 bytes
+
+#if ! CALGN(1)+0
+
+/*
+ * We need an extra register for this loop - save the return address and
+ * use the LR
+ */
+       str     lr, [sp, #-4]!          @ 1
+       mov     ip, r2                  @ 1
+       mov     lr, r2                  @ 1
+
+3:     subs    r1, r1, #64             @ 1 write 32 bytes out per loop
+       stmgeia r0!, {r2, r3, ip, lr}   @ 4
+       stmgeia r0!, {r2, r3, ip, lr}   @ 4
+       stmgeia r0!, {r2, r3, ip, lr}   @ 4
+       stmgeia r0!, {r2, r3, ip, lr}   @ 4
+       bgt     3b                      @ 1
+       ldmeqfd sp!, {pc}               @ 1/2 quick exit
+/*
+ * No need to correct the count; we're only testing bits from now on
+ */
+       tst     r1, #32                 @ 1
+       stmneia r0!, {r2, r3, ip, lr}   @ 4
+       stmneia r0!, {r2, r3, ip, lr}   @ 4
+       tst     r1, #16                 @ 1 16 bytes or more?
+       stmneia r0!, {r2, r3, ip, lr}   @ 4
+       ldr     lr, [sp], #4            @ 1
+
+#else
+
+/*
+ * This version aligns the destination pointer in order to write
+ * whole cache lines at once.
+ */
+
+       stmfd   sp!, {r4-r7, lr}
+       mov     r4, r2
+       mov     r5, r2
+       mov     r6, r2
+       mov     r7, r2
+       mov     ip, r2
+       mov     lr, r2
+
+       cmp     r1, #96
+       andgts  ip, r0, #31
+       ble     3f
+
+       rsb     ip, ip, #32
+       sub     r1, r1, ip
+       movs    ip, ip, lsl #(32 - 4)
+       stmcsia r0!, {r4, r5, r6, r7}
+       stmmiia r0!, {r4, r5}
+       movs    ip, ip, lsl #2
+       strcs   r2, [r0], #4
+
+3:     subs    r1, r1, #64
+       stmgeia r0!, {r2-r7, ip, lr}
+       stmgeia r0!, {r2-r7, ip, lr}
+       bgt     3b
+       ldmeqfd sp!, {r4-r7, pc}
+
+       tst     r1, #32
+       stmneia r0!, {r2-r7, ip, lr}
+       tst     r1, #16
+       stmneia r0!, {r4-r7}
+       ldmfd   sp!, {r4-r7, lr}
+
+#endif
+
+4:     tst     r1, #8                  @ 1 8 bytes or more?
+       stmneia r0!, {r2, r3}           @ 2
+       tst     r1, #4                  @ 1 4 bytes or more?
+       strne   r2, [r0], #4            @ 1
+/*
+ * When we get here, we've got less than 4 bytes to zero.  We
+ * may have an unaligned pointer as well.
+ */
+5:     tst     r1, #2                  @ 1 2 bytes or more?
+       strneb  r2, [r0], #1            @ 1
+       strneb  r2, [r0], #1            @ 1
+       tst     r1, #1                  @ 1 a byte left over
+       strneb  r2, [r0], #1            @ 1
+       mov     pc, lr                  @ 1
+ENDPROC(__memzero)
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/setbit.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/setbit.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,18 @@
+/*
+ *  linux/arch/arm/lib/setbit.S
+ *
+ *  Copyright (C) 1995-1996 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <xen/config.h>
+
+#include "assembler.h"
+#include "bitops.h"
+       .text
+
+ENTRY(_set_bit)
+       bitop   orr
+ENDPROC(_set_bit)
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/testchangebit.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/testchangebit.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,18 @@
+/*
+ *  linux/arch/arm/lib/testchangebit.S
+ *
+ *  Copyright (C) 1995-1996 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <xen/config.h>
+
+#include "assembler.h"
+#include "bitops.h"
+                .text
+
+ENTRY(_test_and_change_bit)
+       testop  eor, str
+ENDPROC(_test_and_change_bit)
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/testclearbit.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/testclearbit.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,18 @@
+/*
+ *  linux/arch/arm/lib/testclearbit.S
+ *
+ *  Copyright (C) 1995-1996 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <xen/config.h>
+
+#include "assembler.h"
+#include "bitops.h"
+                .text
+
+ENTRY(_test_and_clear_bit)
+       testop  bicne, strne
+ENDPROC(_test_and_clear_bit)
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/testsetbit.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/testsetbit.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,18 @@
+/*
+ *  linux/arch/arm/lib/testsetbit.S
+ *
+ *  Copyright (C) 1995-1996 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <xen/config.h>
+
+#include "assembler.h"
+#include "bitops.h"
+                .text
+
+ENTRY(_test_and_set_bit)
+       testop  orreq, streq
+ENDPROC(_test_and_set_bit)
diff -r 46adf08254f9 -r 227302111aff xen/include/asm-arm/config.h
--- a/xen/include/asm-arm/config.h	Thu Feb 09 11:33:29 2012 +0000
+++ b/xen/include/asm-arm/config.h	Thu Feb 09 11:33:29 2012 +0000
@@ -30,6 +30,9 @@
 
 #define asmlinkage /* Nothing needed */
 
+#define __LINUX_ARM_ARCH__ 7
+#define CONFIG_AEABI
+
 /* Linkage for ARM */
 #define __ALIGN .align 2
 #define __ALIGN_STR ".align 2"

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:40 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQH-00061T-2y; Thu, 09 Feb 2012 16:00:37 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQF-0005zQ-TO
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:36 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-27.messagelabs.com!1328803175!52086233!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31408 invoked from network); 9 Feb 2012 15:59:36 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 15:59:36 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ5-0004P3-Q5
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:25 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ4-00066Z-QM
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:25 +0000
Message-Id: <E1RvWQ4-00066Z-QM@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:24 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: bit manipulation,
	copy and division libraries
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787209 0
# Node ID 227302111affce41568ff02ab9d7fa91ae2a4e8d
# Parent  46adf08254f9d88ffd3deba833ee89aa977fcb6b
arm: bit manipulation, copy and division libraries

Bit manipulation, division and memcpy & friends implementations for the
ARM architecture, shamelessly taken from Linux.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/Makefile	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,5 @@
+obj-y += memcpy.o memmove.o memset.o memzero.o
+obj-y += findbit.o setbit.o
+obj-y += setbit.o clearbit.o changebit.o
+obj-y += testsetbit.o testclearbit.o testchangebit.o
+obj-y += lib1funcs.o div64.o
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/assembler.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/assembler.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,49 @@
+#ifndef __ARCH_ARM_LIB_ASSEMBLER_H__
+#define __ARCH_ARM_LIB_ASSEMBLER_H__
+
+/* From Linux arch/arm/include/asm/assembler.h */
+/*
+ * Data preload for architectures that support it
+ */
+#define PLD(code...)    code
+
+/*
+ * This can be used to enable code to cacheline align the destination
+ * pointer when bulk writing to memory.  Experiments on StrongARM and
+ * XScale didn't show this a worthwhile thing to do when the cache is not
+ * set to write-allocate (this would need further testing on XScale when WA
+ * is used).
+ *
+ * On Feroceon there is much to gain however, regardless of cache mode.
+ */
+#ifdef CONFIG_CPU_FEROCEON /* Not in Xen... */
+#define CALGN(code...) code
+#else
+#define CALGN(code...)
+#endif
+
+// No Thumb, hence:
+#define W(instr)        instr
+#define ARM(instr...)   instr
+#define THUMB(instr...)
+
+#ifdef CONFIG_ARM_UNWIND
+#define UNWIND(code...)         code
+#else
+#define UNWIND(code...)
+#endif
+
+#define pull            lsl
+#define push            lsr
+#define get_byte_0      lsr #24
+#define get_byte_1      lsr #16
+#define get_byte_2      lsr #8
+#define get_byte_3      lsl #0
+#define put_byte_0      lsl #24
+#define put_byte_1      lsl #16
+#define put_byte_2      lsl #8
+#define put_byte_3      lsl #0
+
+#define smp_dmb dmb
+
+#endif /*  __ARCH_ARM_LIB_ASSEMBLER_H__ */
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/bitops.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/bitops.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,87 @@
+#include <xen/config.h>
+
+#if __LINUX_ARM_ARCH__ >= 6
+       .macro  bitop, instr
+       ands    ip, r1, #3
+       strneb  r1, [ip]                @ assert word-aligned
+       mov     r2, #1
+       and     r3, r0, #31             @ Get bit offset
+       mov     r0, r0, lsr #5
+       add     r1, r1, r0, lsl #2      @ Get word offset
+       mov     r3, r2, lsl r3
+1:     ldrex   r2, [r1]
+       \instr  r2, r2, r3
+       strex   r0, r2, [r1]
+       cmp     r0, #0
+       bne     1b
+       bx      lr
+       .endm
+
+       .macro  testop, instr, store
+       ands    ip, r1, #3
+       strneb  r1, [ip]                @ assert word-aligned
+       mov     r2, #1
+       and     r3, r0, #31             @ Get bit offset
+       mov     r0, r0, lsr #5
+       add     r1, r1, r0, lsl #2      @ Get word offset
+       mov     r3, r2, lsl r3          @ create mask
+       smp_dmb
+1:     ldrex   r2, [r1]
+       ands    r0, r2, r3              @ save old value of bit
+       \instr  r2, r2, r3              @ toggle bit
+       strex   ip, r2, [r1]
+       cmp     ip, #0
+       bne     1b
+       smp_dmb
+       cmp     r0, #0
+       movne   r0, #1
+2:     bx      lr
+       .endm
+#else
+       .macro  bitop, name, instr
+ENTRY( \name           )
+UNWIND(        .fnstart        )
+       ands    ip, r1, #3
+       strneb  r1, [ip]                @ assert word-aligned
+       and     r2, r0, #31
+       mov     r0, r0, lsr #5
+       mov     r3, #1
+       mov     r3, r3, lsl r2
+       save_and_disable_irqs ip
+       ldr     r2, [r1, r0, lsl #2]
+       \instr  r2, r2, r3
+       str     r2, [r1, r0, lsl #2]
+       restore_irqs ip
+       mov     pc, lr
+UNWIND(        .fnend          )
+ENDPROC(\name          )
+       .endm
+
+/**
+ * testop - implement a test_and_xxx_bit operation.
+ * @instr: operational instruction
+ * @store: store instruction
+ *
+ * Note: we can trivially conditionalise the store instruction
+ * to avoid dirtying the data cache.
+ */
+       .macro  testop, name, instr, store
+ENTRY( \name           )
+UNWIND(        .fnstart        )
+       ands    ip, r1, #3
+       strneb  r1, [ip]                @ assert word-aligned
+       and     r3, r0, #31
+       mov     r0, r0, lsr #5
+       save_and_disable_irqs ip
+       ldr     r2, [r1, r0, lsl #2]!
+       mov     r0, #1
+       tst     r2, r0, lsl r3
+       \instr  r2, r2, r0, lsl r3
+       \store  r2, [r1]
+       moveq   r0, #0
+       restore_irqs ip
+       mov     pc, lr
+UNWIND(        .fnend          )
+ENDPROC(\name          )
+       .endm
+#endif
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/changebit.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/changebit.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,18 @@
+/*
+ *  linux/arch/arm/lib/changebit.S
+ *
+ *  Copyright (C) 1995-1996 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <xen/config.h>
+
+#include "assembler.h"
+#include "bitops.h"
+                .text
+
+ENTRY(_change_bit)
+       bitop   eor
+ENDPROC(_change_bit)
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/clearbit.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/clearbit.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,19 @@
+/*
+ *  linux/arch/arm/lib/clearbit.S
+ *
+ *  Copyright (C) 1995-1996 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <xen/config.h>
+
+#include "assembler.h"
+#include "bitops.h"
+                .text
+
+ENTRY(_clear_bit)
+       bitop   bic
+ENDPROC(_clear_bit)
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/copy_template.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/copy_template.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,267 @@
+/*
+ *  linux/arch/arm/lib/copy_template.s
+ *
+ *  Code template for optimized memory copy functions
+ *
+ *  Author:    Nicolas Pitre
+ *  Created:   Sep 28, 2005
+ *  Copyright: MontaVista Software, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+
+/*
+ * Theory of operation
+ * -------------------
+ *
+ * This file provides the core code for a forward memory copy used in
+ * the implementation of memcopy(), copy_to_user() and copy_from_user().
+ *
+ * The including file must define the following accessor macros
+ * according to the need of the given function:
+ *
+ * ldr1w ptr reg abort
+ *
+ *     This loads one word from 'ptr', stores it in 'reg' and increments
+ *     'ptr' to the next word. The 'abort' argument is used for fixup tables.
+ *
+ * ldr4w ptr reg1 reg2 reg3 reg4 abort
+ * ldr8w ptr, reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
+ *
+ *     This loads four or eight words starting from 'ptr', stores them
+ *     in provided registers and increments 'ptr' past those words.
+ *     The'abort' argument is used for fixup tables.
+ *
+ * ldr1b ptr reg cond abort
+ *
+ *     Similar to ldr1w, but it loads a byte and increments 'ptr' one byte.
+ *     It also must apply the condition code if provided, otherwise the
+ *     "al" condition is assumed by default.
+ *
+ * str1w ptr reg abort
+ * str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
+ * str1b ptr reg cond abort
+ *
+ *     Same as their ldr* counterparts, but data is stored to 'ptr' location
+ *     rather than being loaded.
+ *
+ * enter reg1 reg2
+ *
+ *     Preserve the provided registers on the stack plus any additional
+ *     data as needed by the implementation including this code. Called
+ *     upon code entry.
+ *
+ * exit reg1 reg2
+ *
+ *     Restore registers with the values previously saved with the
+ *     'preserv' macro. Called upon code termination.
+ *
+ * LDR1W_SHIFT
+ * STR1W_SHIFT
+ *
+ *     Correction to be applied to the "ip" register when branching into
+ *     the ldr1w or str1w instructions (some of these macros may expand to
+ *     than one 32bit instruction in Thumb-2)
+ */
+
+
+               enter   r4, lr
+
+               subs    r2, r2, #4
+               blt     8f
+               ands    ip, r0, #3
+       PLD(    pld     [r1, #0]                )
+               bne     9f
+               ands    ip, r1, #3
+               bne     10f
+
+1:             subs    r2, r2, #(28)
+               stmfd   sp!, {r5 - r8}
+               blt     5f
+
+       CALGN(  ands    ip, r0, #31             )
+       CALGN(  rsb     r3, ip, #32             )
+       CALGN(  sbcnes  r4, r3, r2              )  @ C is always set here
+       CALGN(  bcs     2f                      )
+       CALGN(  adr     r4, 6f                  )
+       CALGN(  subs    r2, r2, r3              )  @ C gets set
+       CALGN(  add     pc, r4, ip              )
+
+       PLD(    pld     [r1, #0]                )
+2:     PLD(    subs    r2, r2, #96             )
+       PLD(    pld     [r1, #28]               )
+       PLD(    blt     4f                      )
+       PLD(    pld     [r1, #60]               )
+       PLD(    pld     [r1, #92]               )
+
+3:     PLD(    pld     [r1, #124]              )
+4:             ldr8w   r1, r3, r4, r5, r6, r7, r8, ip, lr, abort=20f
+               subs    r2, r2, #32
+               str8w   r0, r3, r4, r5, r6, r7, r8, ip, lr, abort=20f
+               bge     3b
+       PLD(    cmn     r2, #96                 )
+       PLD(    bge     4b                      )
+
+5:             ands    ip, r2, #28
+               rsb     ip, ip, #32
+#if LDR1W_SHIFT > 0
+               lsl     ip, ip, #LDR1W_SHIFT
+#endif
+               addne   pc, pc, ip              @ C is always clear here
+               b       7f
+6:
+               .rept   (1 << LDR1W_SHIFT)
+               W(nop)
+               .endr
+               ldr1w   r1, r3, abort=20f
+               ldr1w   r1, r4, abort=20f
+               ldr1w   r1, r5, abort=20f
+               ldr1w   r1, r6, abort=20f
+               ldr1w   r1, r7, abort=20f
+               ldr1w   r1, r8, abort=20f
+               ldr1w   r1, lr, abort=20f
+
+#if LDR1W_SHIFT < STR1W_SHIFT
+               lsl     ip, ip, #STR1W_SHIFT - LDR1W_SHIFT
+#elif LDR1W_SHIFT > STR1W_SHIFT
+               lsr     ip, ip, #LDR1W_SHIFT - STR1W_SHIFT
+#endif
+               add     pc, pc, ip
+               nop
+               .rept   (1 << STR1W_SHIFT)
+               W(nop)
+               .endr
+               str1w   r0, r3, abort=20f
+               str1w   r0, r4, abort=20f
+               str1w   r0, r5, abort=20f
+               str1w   r0, r6, abort=20f
+               str1w   r0, r7, abort=20f
+               str1w   r0, r8, abort=20f
+               str1w   r0, lr, abort=20f
+
+       CALGN(  bcs     2b                      )
+
+7:             ldmfd   sp!, {r5 - r8}
+
+8:             movs    r2, r2, lsl #31
+               ldr1b   r1, r3, ne, abort=21f
+               ldr1b   r1, r4, cs, abort=21f
+               ldr1b   r1, ip, cs, abort=21f
+               str1b   r0, r3, ne, abort=21f
+               str1b   r0, r4, cs, abort=21f
+               str1b   r0, ip, cs, abort=21f
+
+               exit    r4, pc
+
+9:             rsb     ip, ip, #4
+               cmp     ip, #2
+               ldr1b   r1, r3, gt, abort=21f
+               ldr1b   r1, r4, ge, abort=21f
+               ldr1b   r1, lr, abort=21f
+               str1b   r0, r3, gt, abort=21f
+               str1b   r0, r4, ge, abort=21f
+               subs    r2, r2, ip
+               str1b   r0, lr, abort=21f
+               blt     8b
+               ands    ip, r1, #3
+               beq     1b
+
+10:            bic     r1, r1, #3
+               cmp     ip, #2
+               ldr1w   r1, lr, abort=21f
+               beq     17f
+               bgt     18f
+
+
+               .macro  forward_copy_shift pull push
+
+               subs    r2, r2, #28
+               blt     14f
+
+       CALGN(  ands    ip, r0, #31             )
+       CALGN(  rsb     ip, ip, #32             )
+       CALGN(  sbcnes  r4, ip, r2              )  @ C is always set here
+       CALGN(  subcc   r2, r2, ip              )
+       CALGN(  bcc     15f                     )
+
+11:            stmfd   sp!, {r5 - r9}
+
+       PLD(    pld     [r1, #0]                )
+       PLD(    subs    r2, r2, #96             )
+       PLD(    pld     [r1, #28]               )
+       PLD(    blt     13f                     )
+       PLD(    pld     [r1, #60]               )
+       PLD(    pld     [r1, #92]               )
+
+12:    PLD(    pld     [r1, #124]              )
+13:            ldr4w   r1, r4, r5, r6, r7, abort=19f
+               mov     r3, lr, pull #\pull
+               subs    r2, r2, #32
+               ldr4w   r1, r8, r9, ip, lr, abort=19f
+               orr     r3, r3, r4, push #\push
+               mov     r4, r4, pull #\pull
+               orr     r4, r4, r5, push #\push
+               mov     r5, r5, pull #\pull
+               orr     r5, r5, r6, push #\push
+               mov     r6, r6, pull #\pull
+               orr     r6, r6, r7, push #\push
+               mov     r7, r7, pull #\pull
+               orr     r7, r7, r8, push #\push
+               mov     r8, r8, pull #\pull
+               orr     r8, r8, r9, push #\push
+               mov     r9, r9, pull #\pull
+               orr     r9, r9, ip, push #\push
+               mov     ip, ip, pull #\pull
+               orr     ip, ip, lr, push #\push
+               str8w   r0, r3, r4, r5, r6, r7, r8, r9, ip, , abort=19f
+               bge     12b
+       PLD(    cmn     r2, #96                 )
+       PLD(    bge     13b                     )
+
+               ldmfd   sp!, {r5 - r9}
+
+14:            ands    ip, r2, #28
+               beq     16f
+
+15:            mov     r3, lr, pull #\pull
+               ldr1w   r1, lr, abort=21f
+               subs    ip, ip, #4
+               orr     r3, r3, lr, push #\push
+               str1w   r0, r3, abort=21f
+               bgt     15b
+       CALGN(  cmp     r2, #0                  )
+       CALGN(  bge     11b                     )
+
+16:            sub     r1, r1, #(\push / 8)
+               b       8b
+
+               .endm
+
+
+               forward_copy_shift      pull=8  push=24
+
+17:            forward_copy_shift      pull=16 push=16
+
+18:            forward_copy_shift      pull=24 push=8
+
+
+/*
+ * Abort preamble and completion macros.
+ * If a fixup handler is required then those macros must surround it.
+ * It is assumed that the fixup code will handle the private part of
+ * the exit macro.
+ */
+
+       .macro  copy_abort_preamble
+19:    ldmfd   sp!, {r5 - r9}
+       b       21f
+20:    ldmfd   sp!, {r5 - r8}
+21:
+       .endm
+
+       .macro  copy_abort_end
+       ldmfd   sp!, {r4, pc}
+       .endm
+
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/div64.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/div64.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,211 @@
+/*
+ *  linux/arch/arm/lib/div64.S
+ *
+ *  Optimized computation of 64-bit dividend / 32-bit divisor
+ *
+ *  Author:    Nicolas Pitre
+ *  Created:   Oct 5, 2003
+ *  Copyright: Monta Vista Software, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+
+#include <xen/config.h>
+#include "assembler.h"
+
+#ifdef __ARMEB__
+#define xh r0
+#define xl r1
+#define yh r2
+#define yl r3
+#else
+#define xl r0
+#define xh r1
+#define yl r2
+#define yh r3
+#endif
+
+/*
+ * __do_div64: perform a division with 64-bit dividend and 32-bit divisor.
+ *
+ * Note: Calling convention is totally non standard for optimal code.
+ *       This is meant to be used by do_div() from include/asm/div64.h only.
+ *
+ * Input parameters:
+ *     xh-xl   = dividend (clobbered)
+ *     r4      = divisor (preserved)
+ *
+ * Output values:
+ *     yh-yl   = result
+ *     xh      = remainder
+ *
+ * Clobbered regs: xl, ip
+ */
+
+ENTRY(__do_div64)
+UNWIND(.fnstart)
+
+       @ Test for easy paths first.
+       subs    ip, r4, #1
+       bls     9f                      @ divisor is 0 or 1
+       tst     ip, r4
+       beq     8f                      @ divisor is power of 2
+
+       @ See if we need to handle upper 32-bit result.
+       cmp     xh, r4
+       mov     yh, #0
+       blo     3f
+
+       @ Align divisor with upper part of dividend.
+       @ The aligned divisor is stored in yl preserving the original.
+       @ The bit position is stored in ip.
+
+#if __LINUX_ARM_ARCH__ >= 5
+
+       clz     yl, r4
+       clz     ip, xh
+       sub     yl, yl, ip
+       mov     ip, #1
+       mov     ip, ip, lsl yl
+       mov     yl, r4, lsl yl
+
+#else
+
+       mov     yl, r4
+       mov     ip, #1
+1:     cmp     yl, #0x80000000
+       cmpcc   yl, xh
+       movcc   yl, yl, lsl #1
+       movcc   ip, ip, lsl #1
+       bcc     1b
+
+#endif
+
+       @ The division loop for needed upper bit positions.
+       @ Break out early if dividend reaches 0.
+2:     cmp     xh, yl
+       orrcs   yh, yh, ip
+       subcss  xh, xh, yl
+       movnes  ip, ip, lsr #1
+       mov     yl, yl, lsr #1
+       bne     2b
+
+       @ See if we need to handle lower 32-bit result.
+3:     cmp     xh, #0
+       mov     yl, #0
+       cmpeq   xl, r4
+       movlo   xh, xl
+       movlo   pc, lr
+
+       @ The division loop for lower bit positions.
+       @ Here we shift remainer bits leftwards rather than moving the
+       @ divisor for comparisons, considering the carry-out bit as well.
+       mov     ip, #0x80000000
+4:     movs    xl, xl, lsl #1
+       adcs    xh, xh, xh
+       beq     6f
+       cmpcc   xh, r4
+5:     orrcs   yl, yl, ip
+       subcs   xh, xh, r4
+       movs    ip, ip, lsr #1
+       bne     4b
+       mov     pc, lr
+
+       @ The top part of remainder became zero.  If carry is set
+       @ (the 33th bit) this is a false positive so resume the loop.
+       @ Otherwise, if lower part is also null then we are done.
+6:     bcs     5b
+       cmp     xl, #0
+       moveq   pc, lr
+
+       @ We still have remainer bits in the low part.  Bring them up.
+
+#if __LINUX_ARM_ARCH__ >= 5
+
+       clz     xh, xl                  @ we know xh is zero here so...
+       add     xh, xh, #1
+       mov     xl, xl, lsl xh
+       mov     ip, ip, lsr xh
+
+#else
+
+7:     movs    xl, xl, lsl #1
+       mov     ip, ip, lsr #1
+       bcc     7b
+
+#endif
+
+       @ Current remainder is now 1.  It is worthless to compare with
+       @ divisor at this point since divisor can not be smaller than 3 here.
+       @ If possible, branch for another shift in the division loop.
+       @ If no bit position left then we are done.
+       movs    ip, ip, lsr #1
+       mov     xh, #1
+       bne     4b
+       mov     pc, lr
+
+8:     @ Division by a power of 2: determine what that divisor order is
+       @ then simply shift values around
+
+#if __LINUX_ARM_ARCH__ >= 5
+
+       clz     ip, r4
+       rsb     ip, ip, #31
+
+#else
+
+       mov     yl, r4
+       cmp     r4, #(1 << 16)
+       mov     ip, #0
+       movhs   yl, yl, lsr #16
+       movhs   ip, #16
+
+       cmp     yl, #(1 << 8)
+       movhs   yl, yl, lsr #8
+       addhs   ip, ip, #8
+
+       cmp     yl, #(1 << 4)
+       movhs   yl, yl, lsr #4
+       addhs   ip, ip, #4
+
+       cmp     yl, #(1 << 2)
+       addhi   ip, ip, #3
+       addls   ip, ip, yl, lsr #1
+
+#endif
+
+       mov     yh, xh, lsr ip
+       mov     yl, xl, lsr ip
+       rsb     ip, ip, #32
+ ARM(  orr     yl, yl, xh, lsl ip      )
+ THUMB(        lsl     xh, xh, ip              )
+ THUMB(        orr     yl, yl, xh              )
+       mov     xh, xl, lsl ip
+       mov     xh, xh, lsr ip
+       mov     pc, lr
+
+       @ eq -> division by 1: obvious enough...
+9:     moveq   yl, xl
+       moveq   yh, xh
+       moveq   xh, #0
+       moveq   pc, lr
+UNWIND(.fnend)
+
+UNWIND(.fnstart)
+UNWIND(.pad #4)
+UNWIND(.save {lr})
+Ldiv0_64:
+       @ Division by 0:
+       str     lr, [sp, #-8]!
+       bl      __div0
+
+       @ as wrong as it could be...
+       mov     yl, #0
+       mov     yh, #0
+       mov     xh, #0
+       ldr     pc, [sp], #8
+
+UNWIND(.fnend)
+ENDPROC(__do_div64)
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/findbit.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/findbit.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,198 @@
+/*
+ *  linux/arch/arm/lib/findbit.S
+ *
+ *  Copyright (C) 1995-2000 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 16th March 2001 - John Ripley <jripley@sonicblue.com>
+ *   Fixed so that "size" is an exclusive not an inclusive quantity.
+ *   All users of these functions expect exclusive sizes, and may
+ *   also call with zero size.
+ * Reworked by rmk.
+ */
+
+#include <xen/config.h>
+
+#include "assembler.h"
+                .text
+
+/*
+ * Purpose  : Find a 'zero' bit
+ * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit);
+ */
+ENTRY(_find_first_zero_bit_le)
+               teq     r1, #0
+               beq     3f
+               mov     r2, #0
+1:
+ ARM(          ldrb    r3, [r0, r2, lsr #3]    )
+ THUMB(                lsr     r3, r2, #3              )
+ THUMB(                ldrb    r3, [r0, r3]            )
+               eors    r3, r3, #0xff           @ invert bits
+               bne     .L_found                @ any now set - found zero bit
+               add     r2, r2, #8              @ next bit pointer
+2:             cmp     r2, r1                  @ any more?
+               blo     1b
+3:             mov     r0, r1                  @ no free bits
+               mov     pc, lr
+ENDPROC(_find_first_zero_bit_le)
+
+/*
+ * Purpose  : Find next 'zero' bit
+ * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset)
+ */
+ENTRY(_find_next_zero_bit_le)
+               teq     r1, #0
+               beq     3b
+               ands    ip, r2, #7
+               beq     1b                      @ If new byte, goto old routine
+ ARM(          ldrb    r3, [r0, r2, lsr #3]    )
+ THUMB(                lsr     r3, r2, #3              )
+ THUMB(                ldrb    r3, [r0, r3]            )
+               eor     r3, r3, #0xff           @ now looking for a 1 bit
+               movs    r3, r3, lsr ip          @ shift off unused bits
+               bne     .L_found
+               orr     r2, r2, #7              @ if zero, then no bits here
+               add     r2, r2, #1              @ align bit pointer
+               b       2b                      @ loop for next bit
+ENDPROC(_find_next_zero_bit_le)
+
+/*
+ * Purpose  : Find a 'one' bit
+ * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit);
+ */
+ENTRY(_find_first_bit_le)
+               teq     r1, #0
+               beq     3f
+               mov     r2, #0
+1:
+ ARM(          ldrb    r3, [r0, r2, lsr #3]    )
+ THUMB(                lsr     r3, r2, #3              )
+ THUMB(                ldrb    r3, [r0, r3]            )
+               movs    r3, r3
+               bne     .L_found                @ any now set - found zero bit
+               add     r2, r2, #8              @ next bit pointer
+2:             cmp     r2, r1                  @ any more?
+               blo     1b
+3:             mov     r0, r1                  @ no free bits
+               mov     pc, lr
+ENDPROC(_find_first_bit_le)
+
+/*
+ * Purpose  : Find next 'one' bit
+ * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset)
+ */
+ENTRY(_find_next_bit_le)
+               teq     r1, #0
+               beq     3b
+               ands    ip, r2, #7
+               beq     1b                      @ If new byte, goto old routine
+ ARM(          ldrb    r3, [r0, r2, lsr #3]    )
+ THUMB(                lsr     r3, r2, #3              )
+ THUMB(                ldrb    r3, [r0, r3]            )
+               movs    r3, r3, lsr ip          @ shift off unused bits
+               bne     .L_found
+               orr     r2, r2, #7              @ if zero, then no bits here
+               add     r2, r2, #1              @ align bit pointer
+               b       2b                      @ loop for next bit
+ENDPROC(_find_next_bit_le)
+
+#ifdef __ARMEB__
+
+ENTRY(_find_first_zero_bit_be)
+               teq     r1, #0
+               beq     3f
+               mov     r2, #0
+1:             eor     r3, r2, #0x18           @ big endian byte ordering
+ ARM(          ldrb    r3, [r0, r3, lsr #3]    )
+ THUMB(                lsr     r3, #3                  )
+ THUMB(                ldrb    r3, [r0, r3]            )
+               eors    r3, r3, #0xff           @ invert bits
+               bne     .L_found                @ any now set - found zero bit
+               add     r2, r2, #8              @ next bit pointer
+2:             cmp     r2, r1                  @ any more?
+               blo     1b
+3:             mov     r0, r1                  @ no free bits
+               mov     pc, lr
+ENDPROC(_find_first_zero_bit_be)
+
+ENTRY(_find_next_zero_bit_be)
+               teq     r1, #0
+               beq     3b
+               ands    ip, r2, #7
+               beq     1b                      @ If new byte, goto old routine
+               eor     r3, r2, #0x18           @ big endian byte ordering
+ ARM(          ldrb    r3, [r0, r3, lsr #3]    )
+ THUMB(                lsr     r3, #3                  )
+ THUMB(                ldrb    r3, [r0, r3]            )
+               eor     r3, r3, #0xff           @ now looking for a 1 bit
+               movs    r3, r3, lsr ip          @ shift off unused bits
+               bne     .L_found
+               orr     r2, r2, #7              @ if zero, then no bits here
+               add     r2, r2, #1              @ align bit pointer
+               b       2b                      @ loop for next bit
+ENDPROC(_find_next_zero_bit_be)
+
+ENTRY(_find_first_bit_be)
+               teq     r1, #0
+               beq     3f
+               mov     r2, #0
+1:             eor     r3, r2, #0x18           @ big endian byte ordering
+ ARM(          ldrb    r3, [r0, r3, lsr #3]    )
+ THUMB(                lsr     r3, #3                  )
+ THUMB(                ldrb    r3, [r0, r3]            )
+               movs    r3, r3
+               bne     .L_found                @ any now set - found zero bit
+               add     r2, r2, #8              @ next bit pointer
+2:             cmp     r2, r1                  @ any more?
+               blo     1b
+3:             mov     r0, r1                  @ no free bits
+               mov     pc, lr
+ENDPROC(_find_first_bit_be)
+
+ENTRY(_find_next_bit_be)
+               teq     r1, #0
+               beq     3b
+               ands    ip, r2, #7
+               beq     1b                      @ If new byte, goto old routine
+               eor     r3, r2, #0x18           @ big endian byte ordering
+ ARM(          ldrb    r3, [r0, r3, lsr #3]    )
+ THUMB(                lsr     r3, #3                  )
+ THUMB(                ldrb    r3, [r0, r3]            )
+               movs    r3, r3, lsr ip          @ shift off unused bits
+               bne     .L_found
+               orr     r2, r2, #7              @ if zero, then no bits here
+               add     r2, r2, #1              @ align bit pointer
+               b       2b                      @ loop for next bit
+ENDPROC(_find_next_bit_be)
+
+#endif
+
+/*
+ * One or more bits in the LSB of r3 are assumed to be set.
+ */
+.L_found:
+#if __LINUX_ARM_ARCH__ >= 5
+               rsb     r0, r3, #0
+               and     r3, r3, r0
+               clz     r3, r3
+               rsb     r3, r3, #31
+               add     r0, r2, r3
+#else
+               tst     r3, #0x0f
+               addeq   r2, r2, #4
+               movne   r3, r3, lsl #4
+               tst     r3, #0x30
+               addeq   r2, r2, #2
+               movne   r3, r3, lsl #2
+               tst     r3, #0x40
+               addeq   r2, r2, #1
+               mov     r0, r2
+#endif
+               cmp     r1, r0                  @ Clamp to maxbit
+               movlo   r0, r1
+               mov     pc, lr
+
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/lib1funcs.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/lib1funcs.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,389 @@
+/*
+ * linux/arch/arm/lib/lib1funcs.S: Optimized ARM division routines
+ *
+ * Author: Nicolas Pitre <nico@fluxnic.net>
+ *   - contributed to gcc-3.4 on Sep 30, 2003
+ *   - adapted for the Linux kernel on Oct 2, 2003
+ */
+
+/* Copyright 1995, 1996, 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
+
+This file is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+This file 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
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+
+#include <xen/config.h>
+#include "assembler.h"
+
+.macro ARM_DIV_BODY dividend, divisor, result, curbit
+
+#if __LINUX_ARM_ARCH__ >= 5
+
+       clz     \curbit, \divisor
+       clz     \result, \dividend
+       sub     \result, \curbit, \result
+       mov     \curbit, #1
+       mov     \divisor, \divisor, lsl \result
+       mov     \curbit, \curbit, lsl \result
+       mov     \result, #0
+
+#else
+
+       @ Initially shift the divisor left 3 bits if possible,
+       @ set curbit accordingly.  This allows for curbit to be located
+       @ at the left end of each 4 bit nibbles in the division loop
+       @ to save one loop in most cases.
+       tst     \divisor, #0xe0000000
+       moveq   \divisor, \divisor, lsl #3
+       moveq   \curbit, #8
+       movne   \curbit, #1
+
+       @ Unless the divisor is very big, shift it up in multiples of
+       @ four bits, since this is the amount of unwinding in the main
+       @ division loop.  Continue shifting until the divisor is
+       @ larger than the dividend.
+1:     cmp     \divisor, #0x10000000
+       cmplo   \divisor, \dividend
+       movlo   \divisor, \divisor, lsl #4
+       movlo   \curbit, \curbit, lsl #4
+       blo     1b
+
+       @ For very big divisors, we must shift it a bit at a time, or
+       @ we will be in danger of overflowing.
+1:     cmp     \divisor, #0x80000000
+       cmplo   \divisor, \dividend
+       movlo   \divisor, \divisor, lsl #1
+       movlo   \curbit, \curbit, lsl #1
+       blo     1b
+
+       mov     \result, #0
+
+#endif
+
+       @ Division loop
+1:     cmp     \dividend, \divisor
+       subhs   \dividend, \dividend, \divisor
+       orrhs   \result,   \result,   \curbit
+       cmp     \dividend, \divisor,  lsr #1
+       subhs   \dividend, \dividend, \divisor, lsr #1
+       orrhs   \result,   \result,   \curbit,  lsr #1
+       cmp     \dividend, \divisor,  lsr #2
+       subhs   \dividend, \dividend, \divisor, lsr #2
+       orrhs   \result,   \result,   \curbit,  lsr #2
+       cmp     \dividend, \divisor,  lsr #3
+       subhs   \dividend, \dividend, \divisor, lsr #3
+       orrhs   \result,   \result,   \curbit,  lsr #3
+       cmp     \dividend, #0                   @ Early termination?
+       movnes  \curbit,   \curbit,  lsr #4     @ No, any more bits to do?
+       movne   \divisor,  \divisor, lsr #4
+       bne     1b
+
+.endm
+
+
+.macro ARM_DIV2_ORDER divisor, order
+
+#if __LINUX_ARM_ARCH__ >= 5
+
+       clz     \order, \divisor
+       rsb     \order, \order, #31
+
+#else
+
+       cmp     \divisor, #(1 << 16)
+       movhs   \divisor, \divisor, lsr #16
+       movhs   \order, #16
+       movlo   \order, #0
+
+       cmp     \divisor, #(1 << 8)
+       movhs   \divisor, \divisor, lsr #8
+       addhs   \order, \order, #8
+
+       cmp     \divisor, #(1 << 4)
+       movhs   \divisor, \divisor, lsr #4
+       addhs   \order, \order, #4
+
+       cmp     \divisor, #(1 << 2)
+       addhi   \order, \order, #3
+       addls   \order, \order, \divisor, lsr #1
+
+#endif
+
+.endm
+
+
+.macro ARM_MOD_BODY dividend, divisor, order, spare
+
+#if __LINUX_ARM_ARCH__ >= 5
+
+       clz     \order, \divisor
+       clz     \spare, \dividend
+       sub     \order, \order, \spare
+       mov     \divisor, \divisor, lsl \order
+
+#else
+
+       mov     \order, #0
+
+       @ Unless the divisor is very big, shift it up in multiples of
+       @ four bits, since this is the amount of unwinding in the main
+       @ division loop.  Continue shifting until the divisor is
+       @ larger than the dividend.
+1:     cmp     \divisor, #0x10000000
+       cmplo   \divisor, \dividend
+       movlo   \divisor, \divisor, lsl #4
+       addlo   \order, \order, #4
+       blo     1b
+
+       @ For very big divisors, we must shift it a bit at a time, or
+       @ we will be in danger of overflowing.
+1:     cmp     \divisor, #0x80000000
+       cmplo   \divisor, \dividend
+       movlo   \divisor, \divisor, lsl #1
+       addlo   \order, \order, #1
+       blo     1b
+
+#endif
+
+       @ Perform all needed substractions to keep only the reminder.
+       @ Do comparisons in batch of 4 first.
+       subs    \order, \order, #3              @ yes, 3 is intended here
+       blt     2f
+
+1:     cmp     \dividend, \divisor
+       subhs   \dividend, \dividend, \divisor
+       cmp     \dividend, \divisor,  lsr #1
+       subhs   \dividend, \dividend, \divisor, lsr #1
+       cmp     \dividend, \divisor,  lsr #2
+       subhs   \dividend, \dividend, \divisor, lsr #2
+       cmp     \dividend, \divisor,  lsr #3
+       subhs   \dividend, \dividend, \divisor, lsr #3
+       cmp     \dividend, #1
+       mov     \divisor, \divisor, lsr #4
+       subges  \order, \order, #4
+       bge     1b
+
+       tst     \order, #3
+       teqne   \dividend, #0
+       beq     5f
+
+       @ Either 1, 2 or 3 comparison/substractions are left.
+2:     cmn     \order, #2
+       blt     4f
+       beq     3f
+       cmp     \dividend, \divisor
+       subhs   \dividend, \dividend, \divisor
+       mov     \divisor,  \divisor,  lsr #1
+3:     cmp     \dividend, \divisor
+       subhs   \dividend, \dividend, \divisor
+       mov     \divisor,  \divisor,  lsr #1
+4:     cmp     \dividend, \divisor
+       subhs   \dividend, \dividend, \divisor
+5:
+.endm
+
+
+ENTRY(__udivsi3)
+ENTRY(__aeabi_uidiv)
+UNWIND(.fnstart)
+
+       subs    r2, r1, #1
+       moveq   pc, lr
+       bcc     Ldiv0
+       cmp     r0, r1
+       bls     11f
+       tst     r1, r2
+       beq     12f
+
+       ARM_DIV_BODY r0, r1, r2, r3
+
+       mov     r0, r2
+       mov     pc, lr
+
+11:    moveq   r0, #1
+       movne   r0, #0
+       mov     pc, lr
+
+12:    ARM_DIV2_ORDER r1, r2
+
+       mov     r0, r0, lsr r2
+       mov     pc, lr
+
+UNWIND(.fnend)
+ENDPROC(__udivsi3)
+ENDPROC(__aeabi_uidiv)
+
+ENTRY(__umodsi3)
+UNWIND(.fnstart)
+
+       subs    r2, r1, #1                      @ compare divisor with 1
+       bcc     Ldiv0
+       cmpne   r0, r1                          @ compare dividend with divisor
+       moveq   r0, #0
+       tsthi   r1, r2                          @ see if divisor is power of 2
+       andeq   r0, r0, r2
+       movls   pc, lr
+
+       ARM_MOD_BODY r0, r1, r2, r3
+
+       mov     pc, lr
+
+UNWIND(.fnend)
+ENDPROC(__umodsi3)
+
+ENTRY(__divsi3)
+ENTRY(__aeabi_idiv)
+UNWIND(.fnstart)
+
+       cmp     r1, #0
+       eor     ip, r0, r1                      @ save the sign of the result.
+       beq     Ldiv0
+       rsbmi   r1, r1, #0                      @ loops below use unsigned.
+       subs    r2, r1, #1                      @ division by 1 or -1 ?
+       beq     10f
+       movs    r3, r0
+       rsbmi   r3, r0, #0                      @ positive dividend value
+       cmp     r3, r1
+       bls     11f
+       tst     r1, r2                          @ divisor is power of 2 ?
+       beq     12f
+
+       ARM_DIV_BODY r3, r1, r0, r2
+
+       cmp     ip, #0
+       rsbmi   r0, r0, #0
+       mov     pc, lr
+
+10:    teq     ip, r0                          @ same sign ?
+       rsbmi   r0, r0, #0
+       mov     pc, lr
+
+11:    movlo   r0, #0
+       moveq   r0, ip, asr #31
+       orreq   r0, r0, #1
+       mov     pc, lr
+
+12:    ARM_DIV2_ORDER r1, r2
+
+       cmp     ip, #0
+       mov     r0, r3, lsr r2
+       rsbmi   r0, r0, #0
+       mov     pc, lr
+
+UNWIND(.fnend)
+ENDPROC(__divsi3)
+ENDPROC(__aeabi_idiv)
+
+ENTRY(__modsi3)
+UNWIND(.fnstart)
+
+       cmp     r1, #0
+       beq     Ldiv0
+       rsbmi   r1, r1, #0                      @ loops below use unsigned.
+       movs    ip, r0                          @ preserve sign of dividend
+       rsbmi   r0, r0, #0                      @ if negative make positive
+       subs    r2, r1, #1                      @ compare divisor with 1
+       cmpne   r0, r1                          @ compare dividend with divisor
+       moveq   r0, #0
+       tsthi   r1, r2                          @ see if divisor is power of 2
+       andeq   r0, r0, r2
+       bls     10f
+
+       ARM_MOD_BODY r0, r1, r2, r3
+
+10:    cmp     ip, #0
+       rsbmi   r0, r0, #0
+       mov     pc, lr
+
+UNWIND(.fnend)
+ENDPROC(__modsi3)
+
+#ifdef CONFIG_AEABI
+
+ENTRY(__aeabi_uidivmod)
+UNWIND(.fnstart)
+UNWIND(.save {r0, r1, ip, lr}  )
+
+       stmfd   sp!, {r0, r1, ip, lr}
+       bl      __aeabi_uidiv
+       ldmfd   sp!, {r1, r2, ip, lr}
+       mul     r3, r0, r2
+       sub     r1, r1, r3
+       mov     pc, lr
+
+UNWIND(.fnend)
+ENDPROC(__aeabi_uidivmod)
+
+ENTRY(__aeabi_idivmod)
+UNWIND(.fnstart)
+UNWIND(.save {r0, r1, ip, lr}  )
+       stmfd   sp!, {r0, r1, ip, lr}
+       bl      __aeabi_idiv
+       ldmfd   sp!, {r1, r2, ip, lr}
+       mul     r3, r0, r2
+       sub     r1, r1, r3
+       mov     pc, lr
+
+UNWIND(.fnend)
+ENDPROC(__aeabi_idivmod)
+
+ENTRY(__aeabi_uldivmod)
+UNWIND(.fnstart)
+UNWIND(.save {lr}      )
+       sub sp, sp, #8
+       stmfd   sp!, {sp, lr}
+       bl __qdivrem
+       ldr lr, [sp, #4]
+       add sp, sp, #8
+       ldmfd sp!, {r2, r3}
+       mov     pc, lr
+
+UNWIND(.fnend)
+ENDPROC(__aeabi_uldivmod)
+
+ENTRY(__aeabi_ldivmod)
+UNWIND(.fnstart)
+UNWIND(.save {lr}      )
+       sub sp, sp, #16
+       stmfd   sp!, {sp, lr}
+       bl __ldivmod_helper
+       ldr lr, [sp, #4]
+       add sp, sp, #16
+       ldmfd   sp!, {r2, r3}
+       mov     pc, lr
+
+UNWIND(.fnend)
+ENDPROC(__aeabi_ldivmod)
+#endif
+
+Ldiv0:
+UNWIND(.fnstart)
+UNWIND(.pad #4)
+UNWIND(.save {lr})
+       str     lr, [sp, #-8]!
+       bl      __div0
+       mov     r0, #0                  @ About as wrong as it could be.
+       ldr     pc, [sp], #8
+UNWIND(.fnend)
+ENDPROC(Ldiv0)
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/memcpy.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/memcpy.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,63 @@
+/*
+ *  linux/arch/arm/lib/memcpy.S
+ *
+ *  Author:    Nicolas Pitre
+ *  Created:   Sep 28, 2005
+ *  Copyright: MontaVista Software, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+
+#include <xen/config.h>
+#include "assembler.h"
+
+#define LDR1W_SHIFT    0
+#define STR1W_SHIFT    0
+
+       .macro ldr1w ptr reg abort
+       W(ldr) \reg, [\ptr], #4
+       .endm
+
+       .macro ldr4w ptr reg1 reg2 reg3 reg4 abort
+       ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4}
+       .endm
+
+       .macro ldr8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
+       ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8}
+       .endm
+
+       .macro ldr1b ptr reg cond=al abort
+       ldr\cond\()b \reg, [\ptr], #1
+       .endm
+
+       .macro str1w ptr reg abort
+       W(str) \reg, [\ptr], #4
+       .endm
+
+       .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
+       stmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8}
+       .endm
+
+       .macro str1b ptr reg cond=al abort
+       str\cond\()b \reg, [\ptr], #1
+       .endm
+
+       .macro enter reg1 reg2
+       stmdb sp!, {r0, \reg1, \reg2}
+       .endm
+
+       .macro exit reg1 reg2
+       ldmfd sp!, {r0, \reg1, \reg2}
+       .endm
+
+       .text
+
+/* Prototype: void *memcpy(void *dest, const void *src, size_t n); */
+
+ENTRY(memcpy)
+
+#include "copy_template.S"
+
+ENDPROC(memcpy)
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/memmove.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/memmove.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,200 @@
+/*
+ *  linux/arch/arm/lib/memmove.S
+ *
+ *  Author:    Nicolas Pitre
+ *  Created:   Sep 28, 2005
+ *  Copyright: (C) MontaVista Software Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+
+#include <xen/config.h>
+
+#include "assembler.h"
+
+               .text
+
+/*
+ * Prototype: void *memmove(void *dest, const void *src, size_t n);
+ *
+ * Note:
+ *
+ * If the memory regions don't overlap, we simply branch to memcpy which is
+ * normally a bit faster. Otherwise the copy is done going downwards.  This
+ * is a transposition of the code from copy_template.S but with the copy
+ * occurring in the opposite direction.
+ */
+
+ENTRY(memmove)
+
+               subs    ip, r0, r1
+               cmphi   r2, ip
+               bls     memcpy
+
+               stmfd   sp!, {r0, r4, lr}
+               add     r1, r1, r2
+               add     r0, r0, r2
+               subs    r2, r2, #4
+               blt     8f
+               ands    ip, r0, #3
+       PLD(    pld     [r1, #-4]               )
+               bne     9f
+               ands    ip, r1, #3
+               bne     10f
+
+1:             subs    r2, r2, #(28)
+               stmfd   sp!, {r5 - r8}
+               blt     5f
+
+       CALGN(  ands    ip, r0, #31             )
+       CALGN(  sbcnes  r4, ip, r2              )  @ C is always set here
+       CALGN(  bcs     2f                      )
+       CALGN(  adr     r4, 6f                  )
+       CALGN(  subs    r2, r2, ip              )  @ C is set here
+       CALGN(  rsb     ip, ip, #32             )
+       CALGN(  add     pc, r4, ip              )
+
+       PLD(    pld     [r1, #-4]               )
+2:     PLD(    subs    r2, r2, #96             )
+       PLD(    pld     [r1, #-32]              )
+       PLD(    blt     4f                      )
+       PLD(    pld     [r1, #-64]              )
+       PLD(    pld     [r1, #-96]              )
+
+3:     PLD(    pld     [r1, #-128]             )
+4:             ldmdb   r1!, {r3, r4, r5, r6, r7, r8, ip, lr}
+               subs    r2, r2, #32
+               stmdb   r0!, {r3, r4, r5, r6, r7, r8, ip, lr}
+               bge     3b
+       PLD(    cmn     r2, #96                 )
+       PLD(    bge     4b                      )
+
+5:             ands    ip, r2, #28
+               rsb     ip, ip, #32
+               addne   pc, pc, ip              @ C is always clear here
+               b       7f
+6:             W(nop)
+               W(ldr)  r3, [r1, #-4]!
+               W(ldr)  r4, [r1, #-4]!
+               W(ldr)  r5, [r1, #-4]!
+               W(ldr)  r6, [r1, #-4]!
+               W(ldr)  r7, [r1, #-4]!
+               W(ldr)  r8, [r1, #-4]!
+               W(ldr)  lr, [r1, #-4]!
+
+               add     pc, pc, ip
+               nop
+               W(nop)
+               W(str)  r3, [r0, #-4]!
+               W(str)  r4, [r0, #-4]!
+               W(str)  r5, [r0, #-4]!
+               W(str)  r6, [r0, #-4]!
+               W(str)  r7, [r0, #-4]!
+               W(str)  r8, [r0, #-4]!
+               W(str)  lr, [r0, #-4]!
+
+       CALGN(  bcs     2b                      )
+
+7:             ldmfd   sp!, {r5 - r8}
+
+8:             movs    r2, r2, lsl #31
+               ldrneb  r3, [r1, #-1]!
+               ldrcsb  r4, [r1, #-1]!
+               ldrcsb  ip, [r1, #-1]
+               strneb  r3, [r0, #-1]!
+               strcsb  r4, [r0, #-1]!
+               strcsb  ip, [r0, #-1]
+               ldmfd   sp!, {r0, r4, pc}
+
+9:             cmp     ip, #2
+               ldrgtb  r3, [r1, #-1]!
+               ldrgeb  r4, [r1, #-1]!
+               ldrb    lr, [r1, #-1]!
+               strgtb  r3, [r0, #-1]!
+               strgeb  r4, [r0, #-1]!
+               subs    r2, r2, ip
+               strb    lr, [r0, #-1]!
+               blt     8b
+               ands    ip, r1, #3
+               beq     1b
+
+10:            bic     r1, r1, #3
+               cmp     ip, #2
+               ldr     r3, [r1, #0]
+               beq     17f
+               blt     18f
+
+
+               .macro  backward_copy_shift push pull
+
+               subs    r2, r2, #28
+               blt     14f
+
+       CALGN(  ands    ip, r0, #31             )
+       CALGN(  sbcnes  r4, ip, r2              )  @ C is always set here
+       CALGN(  subcc   r2, r2, ip              )
+       CALGN(  bcc     15f                     )
+
+11:            stmfd   sp!, {r5 - r9}
+
+       PLD(    pld     [r1, #-4]               )
+       PLD(    subs    r2, r2, #96             )
+       PLD(    pld     [r1, #-32]              )
+       PLD(    blt     13f                     )
+       PLD(    pld     [r1, #-64]              )
+       PLD(    pld     [r1, #-96]              )
+
+12:    PLD(    pld     [r1, #-128]             )
+13:            ldmdb   r1!, {r7, r8, r9, ip}
+               mov     lr, r3, push #\push
+               subs    r2, r2, #32
+               ldmdb   r1!, {r3, r4, r5, r6}
+               orr     lr, lr, ip, pull #\pull
+               mov     ip, ip, push #\push
+               orr     ip, ip, r9, pull #\pull
+               mov     r9, r9, push #\push
+               orr     r9, r9, r8, pull #\pull
+               mov     r8, r8, push #\push
+               orr     r8, r8, r7, pull #\pull
+               mov     r7, r7, push #\push
+               orr     r7, r7, r6, pull #\pull
+               mov     r6, r6, push #\push
+               orr     r6, r6, r5, pull #\pull
+               mov     r5, r5, push #\push
+               orr     r5, r5, r4, pull #\pull
+               mov     r4, r4, push #\push
+               orr     r4, r4, r3, pull #\pull
+               stmdb   r0!, {r4 - r9, ip, lr}
+               bge     12b
+       PLD(    cmn     r2, #96                 )
+       PLD(    bge     13b                     )
+
+               ldmfd   sp!, {r5 - r9}
+
+14:            ands    ip, r2, #28
+               beq     16f
+
+15:            mov     lr, r3, push #\push
+               ldr     r3, [r1, #-4]!
+               subs    ip, ip, #4
+               orr     lr, lr, r3, pull #\pull
+               str     lr, [r0, #-4]!
+               bgt     15b
+       CALGN(  cmp     r2, #0                  )
+       CALGN(  bge     11b                     )
+
+16:            add     r1, r1, #(\pull / 8)
+               b       8b
+
+               .endm
+
+
+               backward_copy_shift     push=8  pull=24
+
+17:            backward_copy_shift     push=16 pull=16
+
+18:            backward_copy_shift     push=24 pull=8
+
+ENDPROC(memmove)
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/memset.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/memset.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,129 @@
+/*
+ *  linux/arch/arm/lib/memset.S
+ *
+ *  Copyright (C) 1995-2000 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ *  ASM optimised string functions
+ */
+
+#include <xen/config.h>
+
+#include "assembler.h"
+
+       .text
+       .align  5
+       .word   0
+
+1:     subs    r2, r2, #4              @ 1 do we have enough
+       blt     5f                      @ 1 bytes to align with?
+       cmp     r3, #2                  @ 1
+       strltb  r1, [r0], #1            @ 1
+       strleb  r1, [r0], #1            @ 1
+       strb    r1, [r0], #1            @ 1
+       add     r2, r2, r3              @ 1 (r2 = r2 - (4 - r3))
+/*
+ * The pointer is now aligned and the length is adjusted.  Try doing the
+ * memset again.
+ */
+
+ENTRY(memset)
+       ands    r3, r0, #3              @ 1 unaligned?
+       bne     1b                      @ 1
+/*
+ * we know that the pointer in r0 is aligned to a word boundary.
+ */
+       orr     r1, r1, r1, lsl #8
+       orr     r1, r1, r1, lsl #16
+       mov     r3, r1
+       cmp     r2, #16
+       blt     4f
+
+#if ! CALGN(1)+0
+
+/*
+ * We need an extra register for this loop - save the return address and
+ * use the LR
+ */
+       str     lr, [sp, #-4]!
+       mov     ip, r1
+       mov     lr, r1
+
+2:     subs    r2, r2, #64
+       stmgeia r0!, {r1, r3, ip, lr}   @ 64 bytes at a time.
+       stmgeia r0!, {r1, r3, ip, lr}
+       stmgeia r0!, {r1, r3, ip, lr}
+       stmgeia r0!, {r1, r3, ip, lr}
+       bgt     2b
+       ldmeqfd sp!, {pc}               @ Now <64 bytes to go.
+/*
+ * No need to correct the count; we're only testing bits from now on
+ */
+       tst     r2, #32
+       stmneia r0!, {r1, r3, ip, lr}
+       stmneia r0!, {r1, r3, ip, lr}
+       tst     r2, #16
+       stmneia r0!, {r1, r3, ip, lr}
+       ldr     lr, [sp], #4
+
+#else
+
+/*
+ * This version aligns the destination pointer in order to write
+ * whole cache lines at once.
+ */
+
+       stmfd   sp!, {r4-r7, lr}
+       mov     r4, r1
+       mov     r5, r1
+       mov     r6, r1
+       mov     r7, r1
+       mov     ip, r1
+       mov     lr, r1
+
+       cmp     r2, #96
+       tstgt   r0, #31
+       ble     3f
+
+       and     ip, r0, #31
+       rsb     ip, ip, #32
+       sub     r2, r2, ip
+       movs    ip, ip, lsl #(32 - 4)
+       stmcsia r0!, {r4, r5, r6, r7}
+       stmmiia r0!, {r4, r5}
+       tst     ip, #(1 << 30)
+       mov     ip, r1
+       strne   r1, [r0], #4
+
+3:     subs    r2, r2, #64
+       stmgeia r0!, {r1, r3-r7, ip, lr}
+       stmgeia r0!, {r1, r3-r7, ip, lr}
+       bgt     3b
+       ldmeqfd sp!, {r4-r7, pc}
+
+       tst     r2, #32
+       stmneia r0!, {r1, r3-r7, ip, lr}
+       tst     r2, #16
+       stmneia r0!, {r4-r7}
+       ldmfd   sp!, {r4-r7, lr}
+
+#endif
+
+4:     tst     r2, #8
+       stmneia r0!, {r1, r3}
+       tst     r2, #4
+       strne   r1, [r0], #4
+/*
+ * When we get here, we've got less than 4 bytes to zero.  We
+ * may have an unaligned pointer as well.
+ */
+5:     tst     r2, #2
+       strneb  r1, [r0], #1
+       strneb  r1, [r0], #1
+       tst     r2, #1
+       strneb  r1, [r0], #1
+       mov     pc, lr
+ENDPROC(memset)
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/memzero.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/memzero.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,127 @@
+/*
+ *  linux/arch/arm/lib/memzero.S
+ *
+ *  Copyright (C) 1995-2000 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <xen/config.h>
+
+#include "assembler.h"
+
+       .text
+       .align  5
+       .word   0
+/*
+ * Align the pointer in r0.  r3 contains the number of bytes that we are
+ * mis-aligned by, and r1 is the number of bytes.  If r1 < 4, then we
+ * don't bother; we use byte stores instead.
+ */
+1:     subs    r1, r1, #4              @ 1 do we have enough
+       blt     5f                      @ 1 bytes to align with?
+       cmp     r3, #2                  @ 1
+       strltb  r2, [r0], #1            @ 1
+       strleb  r2, [r0], #1            @ 1
+       strb    r2, [r0], #1            @ 1
+       add     r1, r1, r3              @ 1 (r1 = r1 - (4 - r3))
+/*
+ * The pointer is now aligned and the length is adjusted.  Try doing the
+ * memzero again.
+ */
+
+ENTRY(__memzero)
+       mov     r2, #0                  @ 1
+       ands    r3, r0, #3              @ 1 unaligned?
+       bne     1b                      @ 1
+/*
+ * r3 = 0, and we know that the pointer in r0 is aligned to a word boundary.
+ */
+       cmp     r1, #16                 @ 1 we can skip this chunk if we
+       blt     4f                      @ 1 have < 16 bytes
+
+#if ! CALGN(1)+0
+
+/*
+ * We need an extra register for this loop - save the return address and
+ * use the LR
+ */
+       str     lr, [sp, #-4]!          @ 1
+       mov     ip, r2                  @ 1
+       mov     lr, r2                  @ 1
+
+3:     subs    r1, r1, #64             @ 1 write 32 bytes out per loop
+       stmgeia r0!, {r2, r3, ip, lr}   @ 4
+       stmgeia r0!, {r2, r3, ip, lr}   @ 4
+       stmgeia r0!, {r2, r3, ip, lr}   @ 4
+       stmgeia r0!, {r2, r3, ip, lr}   @ 4
+       bgt     3b                      @ 1
+       ldmeqfd sp!, {pc}               @ 1/2 quick exit
+/*
+ * No need to correct the count; we're only testing bits from now on
+ */
+       tst     r1, #32                 @ 1
+       stmneia r0!, {r2, r3, ip, lr}   @ 4
+       stmneia r0!, {r2, r3, ip, lr}   @ 4
+       tst     r1, #16                 @ 1 16 bytes or more?
+       stmneia r0!, {r2, r3, ip, lr}   @ 4
+       ldr     lr, [sp], #4            @ 1
+
+#else
+
+/*
+ * This version aligns the destination pointer in order to write
+ * whole cache lines at once.
+ */
+
+       stmfd   sp!, {r4-r7, lr}
+       mov     r4, r2
+       mov     r5, r2
+       mov     r6, r2
+       mov     r7, r2
+       mov     ip, r2
+       mov     lr, r2
+
+       cmp     r1, #96
+       andgts  ip, r0, #31
+       ble     3f
+
+       rsb     ip, ip, #32
+       sub     r1, r1, ip
+       movs    ip, ip, lsl #(32 - 4)
+       stmcsia r0!, {r4, r5, r6, r7}
+       stmmiia r0!, {r4, r5}
+       movs    ip, ip, lsl #2
+       strcs   r2, [r0], #4
+
+3:     subs    r1, r1, #64
+       stmgeia r0!, {r2-r7, ip, lr}
+       stmgeia r0!, {r2-r7, ip, lr}
+       bgt     3b
+       ldmeqfd sp!, {r4-r7, pc}
+
+       tst     r1, #32
+       stmneia r0!, {r2-r7, ip, lr}
+       tst     r1, #16
+       stmneia r0!, {r4-r7}
+       ldmfd   sp!, {r4-r7, lr}
+
+#endif
+
+4:     tst     r1, #8                  @ 1 8 bytes or more?
+       stmneia r0!, {r2, r3}           @ 2
+       tst     r1, #4                  @ 1 4 bytes or more?
+       strne   r2, [r0], #4            @ 1
+/*
+ * When we get here, we've got less than 4 bytes to zero.  We
+ * may have an unaligned pointer as well.
+ */
+5:     tst     r1, #2                  @ 1 2 bytes or more?
+       strneb  r2, [r0], #1            @ 1
+       strneb  r2, [r0], #1            @ 1
+       tst     r1, #1                  @ 1 a byte left over
+       strneb  r2, [r0], #1            @ 1
+       mov     pc, lr                  @ 1
+ENDPROC(__memzero)
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/setbit.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/setbit.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,18 @@
+/*
+ *  linux/arch/arm/lib/setbit.S
+ *
+ *  Copyright (C) 1995-1996 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <xen/config.h>
+
+#include "assembler.h"
+#include "bitops.h"
+       .text
+
+ENTRY(_set_bit)
+       bitop   orr
+ENDPROC(_set_bit)
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/testchangebit.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/testchangebit.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,18 @@
+/*
+ *  linux/arch/arm/lib/testchangebit.S
+ *
+ *  Copyright (C) 1995-1996 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <xen/config.h>
+
+#include "assembler.h"
+#include "bitops.h"
+                .text
+
+ENTRY(_test_and_change_bit)
+       testop  eor, str
+ENDPROC(_test_and_change_bit)
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/testclearbit.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/testclearbit.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,18 @@
+/*
+ *  linux/arch/arm/lib/testclearbit.S
+ *
+ *  Copyright (C) 1995-1996 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <xen/config.h>
+
+#include "assembler.h"
+#include "bitops.h"
+                .text
+
+ENTRY(_test_and_clear_bit)
+       testop  bicne, strne
+ENDPROC(_test_and_clear_bit)
diff -r 46adf08254f9 -r 227302111aff xen/arch/arm/lib/testsetbit.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/lib/testsetbit.S	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,18 @@
+/*
+ *  linux/arch/arm/lib/testsetbit.S
+ *
+ *  Copyright (C) 1995-1996 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <xen/config.h>
+
+#include "assembler.h"
+#include "bitops.h"
+                .text
+
+ENTRY(_test_and_set_bit)
+       testop  orreq, streq
+ENDPROC(_test_and_set_bit)
diff -r 46adf08254f9 -r 227302111aff xen/include/asm-arm/config.h
--- a/xen/include/asm-arm/config.h	Thu Feb 09 11:33:29 2012 +0000
+++ b/xen/include/asm-arm/config.h	Thu Feb 09 11:33:29 2012 +0000
@@ -30,6 +30,9 @@
 
 #define asmlinkage /* Nothing needed */
 
+#define __LINUX_ARM_ARCH__ 7
+#define CONFIG_AEABI
+
 /* Linkage for ARM */
 #define __ALIGN .align 2
 #define __ALIGN_STR ".align 2"

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:40 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQI-00062F-9D; Thu, 09 Feb 2012 16:00:38 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQG-000613-N6
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:36 +0000
Received: from [85.158.139.83:23890] by server-2.bemta-5.messagelabs.com id
	39/84-20725-3ADE33F4; Thu, 09 Feb 2012 16:00:35 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1328803233!13810420!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22565 invoked from network); 9 Feb 2012 16:00:34 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:34 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQA-0004PL-HH
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:30 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQA-00068f-Ev
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:30 +0000
Message-Id: <E1RvWQA-00068f-Ev@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:29 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: mmio handlers
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787210 0
# Node ID e267c40ab2782dec0dc7cf2b1e822ac1b27d37a9
# Parent  f770f641498bbdb2aca90bf6a0db7a2eaf0247a0
arm: mmio handlers

Basic infrastructure to emulate mmio reads and writes.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r f770f641498b -r e267c40ab278 xen/arch/arm/io.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/io.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,50 @@
+/*
+ * xen/arch/arm/io.h
+ *
+ * ARM I/O handlers
+ *
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <xen/config.h>
+#include <xen/lib.h>
+#include <asm/current.h>
+
+#include "io.h"
+
+static const struct mmio_handler *const mmio_handlers[] =
+{
+};
+#define MMIO_HANDLER_NR ARRAY_SIZE(mmio_handlers)
+
+int handle_mmio(mmio_info_t *info)
+{
+    struct vcpu *v = current;
+    int i;
+
+    for ( i = 0; i < MMIO_HANDLER_NR; i++ )
+        if ( mmio_handlers[i]->check_handler(v, info->gpa) )
+            return info->dabt.write ?
+                mmio_handlers[i]->write_handler(v, info) :
+                mmio_handlers[i]->read_handler(v, info);
+
+    return 0;
+}
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r f770f641498b -r e267c40ab278 xen/arch/arm/io.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/io.h	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,53 @@
+/*
+ * xen/arch/arm/io.h
+ *
+ * ARM I/O handlers
+ *
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#ifndef __ARCH_ARM_IO_H__
+#define __ARCH_ARM_IO_H__
+
+#include <xen/lib.h>
+#include <asm/processor.h>
+
+typedef struct
+{
+    struct hsr_dabt dabt;
+    uint32_t gva;
+    paddr_t gpa;
+} mmio_info_t;
+
+typedef int (*mmio_read_t)(struct vcpu *v, mmio_info_t *info);
+typedef int (*mmio_write_t)(struct vcpu *v, mmio_info_t *info);
+typedef int (*mmio_check_t)(struct vcpu *v, paddr_t addr);
+
+struct mmio_handler {
+    mmio_check_t check_handler;
+    mmio_read_t read_handler;
+    mmio_write_t write_handler;
+};
+
+extern int handle_mmio(mmio_info_t *info);
+
+#endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:40 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQJ-00062z-Ps; Thu, 09 Feb 2012 16:00:39 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQH-0005zl-Hr
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:37 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1328803228!8545576!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4000 invoked from network); 9 Feb 2012 16:00:29 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:29 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ7-0004PA-Us
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:27 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ7-00067Q-KZ
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:27 +0000
Message-Id: <E1RvWQ7-00067Q-KZ@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:26 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: domain
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787209 0
# Node ID 1cfe402b934af74c02685ca5304a0b75c84092da
# Parent  0d42f7875293ff128f377fa5ec5fdca9c4237dae
arm: domain

Domain creation and destruction, vcpu initialization and destruction,
arch specific scheduling functions called by common code.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 0d42f7875293 -r 1cfe402b934a xen/arch/arm/domain.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/domain.c	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,253 @@
+#include <xen/config.h>
+#include <xen/init.h>
+#include <xen/lib.h>
+#include <xen/sched.h>
+#include <xen/softirq.h>
+#include <xen/wait.h>
+#include <xen/errno.h>
+
+#include <asm/current.h>
+#include <asm/regs.h>
+#include <asm/p2m.h>
+#include <asm/irq.h>
+
+DEFINE_PER_CPU(struct vcpu *, curr_vcpu);
+
+static void continue_idle_domain(struct vcpu *v)
+{
+    reset_stack_and_jump(idle_loop);
+}
+
+static void continue_nonidle_domain(struct vcpu *v)
+{
+    /* check_wakeup_from_wait(); */
+    reset_stack_and_jump(return_from_trap);
+}
+
+void idle_loop(void)
+{
+    for ( ; ; )
+    {
+        /* TODO
+           if ( cpu_is_offline(smp_processor_id()) )
+           play_dead();
+           (*pm_idle)();
+           BUG();
+        */
+        do_tasklet();
+        do_softirq();
+    }
+}
+
+static void ctxt_switch_from(struct vcpu *p)
+{
+
+}
+
+static void ctxt_switch_to(struct vcpu *n)
+{
+    p2m_load_VTTBR(n->domain);
+}
+
+static void __context_switch(void)
+{
+    struct cpu_user_regs *stack_regs = guest_cpu_user_regs();
+    unsigned int          cpu = smp_processor_id();
+    struct vcpu          *p = per_cpu(curr_vcpu, cpu);
+    struct vcpu          *n = current;
+
+    ASSERT(p != n);
+    ASSERT(cpumask_empty(n->vcpu_dirty_cpumask));
+
+    if ( !is_idle_vcpu(p) )
+    {
+        memcpy(&p->arch.user_regs, stack_regs, CTXT_SWITCH_STACK_BYTES);
+        ctxt_switch_from(p);
+    }
+
+    if ( !is_idle_vcpu(n) )
+    {
+        memcpy(stack_regs, &n->arch.user_regs, CTXT_SWITCH_STACK_BYTES);
+        ctxt_switch_to(n);
+    }
+
+    per_cpu(curr_vcpu, cpu) = n;
+
+}
+
+static void schedule_tail(struct vcpu *v)
+{
+    if ( is_idle_vcpu(v) )
+        continue_idle_domain(v);
+    else
+        continue_nonidle_domain(v);
+}
+
+void context_switch(struct vcpu *prev, struct vcpu *next)
+{
+    unsigned int cpu = smp_processor_id();
+
+    ASSERT(local_irq_is_enabled());
+
+    printk("context switch %d:%d%s -> %d:%d%s\n",
+           prev->domain->domain_id, prev->vcpu_id, is_idle_vcpu(prev) ? " (idle)" : "",
+           next->domain->domain_id, next->vcpu_id, is_idle_vcpu(next) ? " (idle)" : "");
+
+    /* TODO
+       if (prev != next)
+       update_runstate_area(prev);
+    */
+
+    local_irq_disable();
+
+    set_current(next);
+
+    if ( (per_cpu(curr_vcpu, cpu) == next) ||
+         (is_idle_vcpu(next) && cpu_online(cpu)) )
+    {
+        local_irq_enable();
+    }
+    else
+    {
+        __context_switch();
+
+        /* Re-enable interrupts before restoring state which may fault. */
+        local_irq_enable();
+    }
+
+    context_saved(prev);
+
+    /* TODO
+       if (prev != next)
+       update_runstate_area(next);
+    */
+
+    schedule_tail(next);
+    BUG();
+
+}
+
+void continue_running(struct vcpu *same)
+{
+    schedule_tail(same);
+    BUG();
+}
+
+int __sync_local_execstate(void)
+{
+    unsigned long flags;
+    int switch_required;
+
+    local_irq_save(flags);
+
+    switch_required = (this_cpu(curr_vcpu) != current);
+
+    if ( switch_required )
+    {
+        ASSERT(current == idle_vcpu[smp_processor_id()]);
+        __context_switch();
+    }
+
+    local_irq_restore(flags);
+
+    return switch_required;
+}
+
+void sync_local_execstate(void)
+{
+    (void)__sync_local_execstate();
+}
+
+void startup_cpu_idle_loop(void)
+{
+        struct vcpu *v = current;
+
+        ASSERT(is_idle_vcpu(v));
+        /* TODO
+           cpumask_set_cpu(v->processor, v->domain->domain_dirty_cpumask);
+           cpumask_set_cpu(v->processor, v->vcpu_dirty_cpumask);
+        */
+
+        reset_stack_and_jump(idle_loop);
+}
+
+struct domain *alloc_domain_struct(void)
+{
+    struct domain *d;
+    BUILD_BUG_ON(sizeof(*d) > PAGE_SIZE);
+    d = alloc_xenheap_pages(0, 0);
+    if ( d != NULL )
+        clear_page(d);
+    return d;
+}
+
+void free_domain_struct(struct domain *d)
+{
+    free_xenheap_page(d);
+}
+
+void dump_pageframe_info(struct domain *d)
+{
+
+}
+
+struct vcpu *alloc_vcpu_struct(void)
+{
+    struct vcpu *v;
+    BUILD_BUG_ON(sizeof(*v) > PAGE_SIZE);
+    v = alloc_xenheap_pages(0, 0);
+    if ( v != NULL )
+        clear_page(v);
+    return v;
+}
+
+void free_vcpu_struct(struct vcpu *v)
+{
+    free_xenheap_page(v);
+}
+
+int vcpu_initialise(struct vcpu *v)
+{
+    int rc = 0;
+
+    return rc;
+}
+
+void vcpu_destroy(struct vcpu *v)
+{
+
+}
+
+int arch_domain_create(struct domain *d, unsigned int domcr_flags)
+{
+    int rc;
+
+    d->max_vcpus = 8;
+
+    rc = 0;
+fail:
+    return rc;
+}
+
+void arch_domain_destroy(struct domain *d)
+{
+    /* p2m_destroy */
+    /* domain_vgic_destroy */
+}
+
+void arch_dump_domain_info(struct domain *d)
+{
+}
+
+void arch_dump_vcpu_info(struct vcpu *v)
+{
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 0d42f7875293 -r 1cfe402b934a xen/include/asm-arm/domain.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/domain.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,43 @@
+#ifndef __ASM_DOMAIN_H__
+#define __ASM_DOMAIN_H__
+
+#include <xen/config.h>
+#include <xen/cache.h>
+#include <asm/page.h>
+#include <asm/p2m.h>
+
+struct pending_irq
+{
+    int irq;
+    struct irq_desc *desc; /* only set it the irq corresponds to a physical irq */
+    uint8_t priority;
+    struct list_head link;
+};
+
+struct arch_domain
+{
+}  __cacheline_aligned;
+
+struct arch_vcpu
+{
+    struct cpu_user_regs user_regs;
+
+    uint32_t sctlr;
+    uint32_t ttbr0, ttbr1, ttbcr;
+
+}  __cacheline_aligned;
+
+void vcpu_show_execution_state(struct vcpu *);
+void vcpu_show_registers(const struct vcpu *);
+
+#endif /* __ASM_DOMAIN_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:40 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQI-00062F-9D; Thu, 09 Feb 2012 16:00:38 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQG-000613-N6
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:36 +0000
Received: from [85.158.139.83:23890] by server-2.bemta-5.messagelabs.com id
	39/84-20725-3ADE33F4; Thu, 09 Feb 2012 16:00:35 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1328803233!13810420!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22565 invoked from network); 9 Feb 2012 16:00:34 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:34 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQA-0004PL-HH
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:30 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQA-00068f-Ev
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:30 +0000
Message-Id: <E1RvWQA-00068f-Ev@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:29 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: mmio handlers
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787210 0
# Node ID e267c40ab2782dec0dc7cf2b1e822ac1b27d37a9
# Parent  f770f641498bbdb2aca90bf6a0db7a2eaf0247a0
arm: mmio handlers

Basic infrastructure to emulate mmio reads and writes.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r f770f641498b -r e267c40ab278 xen/arch/arm/io.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/io.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,50 @@
+/*
+ * xen/arch/arm/io.h
+ *
+ * ARM I/O handlers
+ *
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <xen/config.h>
+#include <xen/lib.h>
+#include <asm/current.h>
+
+#include "io.h"
+
+static const struct mmio_handler *const mmio_handlers[] =
+{
+};
+#define MMIO_HANDLER_NR ARRAY_SIZE(mmio_handlers)
+
+int handle_mmio(mmio_info_t *info)
+{
+    struct vcpu *v = current;
+    int i;
+
+    for ( i = 0; i < MMIO_HANDLER_NR; i++ )
+        if ( mmio_handlers[i]->check_handler(v, info->gpa) )
+            return info->dabt.write ?
+                mmio_handlers[i]->write_handler(v, info) :
+                mmio_handlers[i]->read_handler(v, info);
+
+    return 0;
+}
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r f770f641498b -r e267c40ab278 xen/arch/arm/io.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/io.h	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,53 @@
+/*
+ * xen/arch/arm/io.h
+ *
+ * ARM I/O handlers
+ *
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#ifndef __ARCH_ARM_IO_H__
+#define __ARCH_ARM_IO_H__
+
+#include <xen/lib.h>
+#include <asm/processor.h>
+
+typedef struct
+{
+    struct hsr_dabt dabt;
+    uint32_t gva;
+    paddr_t gpa;
+} mmio_info_t;
+
+typedef int (*mmio_read_t)(struct vcpu *v, mmio_info_t *info);
+typedef int (*mmio_write_t)(struct vcpu *v, mmio_info_t *info);
+typedef int (*mmio_check_t)(struct vcpu *v, paddr_t addr);
+
+struct mmio_handler {
+    mmio_check_t check_handler;
+    mmio_read_t read_handler;
+    mmio_write_t write_handler;
+};
+
+extern int handle_mmio(mmio_info_t *info);
+
+#endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:40 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQJ-00062z-Ps; Thu, 09 Feb 2012 16:00:39 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQH-0005zl-Hr
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:37 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1328803228!8545576!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4000 invoked from network); 9 Feb 2012 16:00:29 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:29 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ7-0004PA-Us
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:27 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ7-00067Q-KZ
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:27 +0000
Message-Id: <E1RvWQ7-00067Q-KZ@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:26 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: domain
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787209 0
# Node ID 1cfe402b934af74c02685ca5304a0b75c84092da
# Parent  0d42f7875293ff128f377fa5ec5fdca9c4237dae
arm: domain

Domain creation and destruction, vcpu initialization and destruction,
arch specific scheduling functions called by common code.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 0d42f7875293 -r 1cfe402b934a xen/arch/arm/domain.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/domain.c	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,253 @@
+#include <xen/config.h>
+#include <xen/init.h>
+#include <xen/lib.h>
+#include <xen/sched.h>
+#include <xen/softirq.h>
+#include <xen/wait.h>
+#include <xen/errno.h>
+
+#include <asm/current.h>
+#include <asm/regs.h>
+#include <asm/p2m.h>
+#include <asm/irq.h>
+
+DEFINE_PER_CPU(struct vcpu *, curr_vcpu);
+
+static void continue_idle_domain(struct vcpu *v)
+{
+    reset_stack_and_jump(idle_loop);
+}
+
+static void continue_nonidle_domain(struct vcpu *v)
+{
+    /* check_wakeup_from_wait(); */
+    reset_stack_and_jump(return_from_trap);
+}
+
+void idle_loop(void)
+{
+    for ( ; ; )
+    {
+        /* TODO
+           if ( cpu_is_offline(smp_processor_id()) )
+           play_dead();
+           (*pm_idle)();
+           BUG();
+        */
+        do_tasklet();
+        do_softirq();
+    }
+}
+
+static void ctxt_switch_from(struct vcpu *p)
+{
+
+}
+
+static void ctxt_switch_to(struct vcpu *n)
+{
+    p2m_load_VTTBR(n->domain);
+}
+
+static void __context_switch(void)
+{
+    struct cpu_user_regs *stack_regs = guest_cpu_user_regs();
+    unsigned int          cpu = smp_processor_id();
+    struct vcpu          *p = per_cpu(curr_vcpu, cpu);
+    struct vcpu          *n = current;
+
+    ASSERT(p != n);
+    ASSERT(cpumask_empty(n->vcpu_dirty_cpumask));
+
+    if ( !is_idle_vcpu(p) )
+    {
+        memcpy(&p->arch.user_regs, stack_regs, CTXT_SWITCH_STACK_BYTES);
+        ctxt_switch_from(p);
+    }
+
+    if ( !is_idle_vcpu(n) )
+    {
+        memcpy(stack_regs, &n->arch.user_regs, CTXT_SWITCH_STACK_BYTES);
+        ctxt_switch_to(n);
+    }
+
+    per_cpu(curr_vcpu, cpu) = n;
+
+}
+
+static void schedule_tail(struct vcpu *v)
+{
+    if ( is_idle_vcpu(v) )
+        continue_idle_domain(v);
+    else
+        continue_nonidle_domain(v);
+}
+
+void context_switch(struct vcpu *prev, struct vcpu *next)
+{
+    unsigned int cpu = smp_processor_id();
+
+    ASSERT(local_irq_is_enabled());
+
+    printk("context switch %d:%d%s -> %d:%d%s\n",
+           prev->domain->domain_id, prev->vcpu_id, is_idle_vcpu(prev) ? " (idle)" : "",
+           next->domain->domain_id, next->vcpu_id, is_idle_vcpu(next) ? " (idle)" : "");
+
+    /* TODO
+       if (prev != next)
+       update_runstate_area(prev);
+    */
+
+    local_irq_disable();
+
+    set_current(next);
+
+    if ( (per_cpu(curr_vcpu, cpu) == next) ||
+         (is_idle_vcpu(next) && cpu_online(cpu)) )
+    {
+        local_irq_enable();
+    }
+    else
+    {
+        __context_switch();
+
+        /* Re-enable interrupts before restoring state which may fault. */
+        local_irq_enable();
+    }
+
+    context_saved(prev);
+
+    /* TODO
+       if (prev != next)
+       update_runstate_area(next);
+    */
+
+    schedule_tail(next);
+    BUG();
+
+}
+
+void continue_running(struct vcpu *same)
+{
+    schedule_tail(same);
+    BUG();
+}
+
+int __sync_local_execstate(void)
+{
+    unsigned long flags;
+    int switch_required;
+
+    local_irq_save(flags);
+
+    switch_required = (this_cpu(curr_vcpu) != current);
+
+    if ( switch_required )
+    {
+        ASSERT(current == idle_vcpu[smp_processor_id()]);
+        __context_switch();
+    }
+
+    local_irq_restore(flags);
+
+    return switch_required;
+}
+
+void sync_local_execstate(void)
+{
+    (void)__sync_local_execstate();
+}
+
+void startup_cpu_idle_loop(void)
+{
+        struct vcpu *v = current;
+
+        ASSERT(is_idle_vcpu(v));
+        /* TODO
+           cpumask_set_cpu(v->processor, v->domain->domain_dirty_cpumask);
+           cpumask_set_cpu(v->processor, v->vcpu_dirty_cpumask);
+        */
+
+        reset_stack_and_jump(idle_loop);
+}
+
+struct domain *alloc_domain_struct(void)
+{
+    struct domain *d;
+    BUILD_BUG_ON(sizeof(*d) > PAGE_SIZE);
+    d = alloc_xenheap_pages(0, 0);
+    if ( d != NULL )
+        clear_page(d);
+    return d;
+}
+
+void free_domain_struct(struct domain *d)
+{
+    free_xenheap_page(d);
+}
+
+void dump_pageframe_info(struct domain *d)
+{
+
+}
+
+struct vcpu *alloc_vcpu_struct(void)
+{
+    struct vcpu *v;
+    BUILD_BUG_ON(sizeof(*v) > PAGE_SIZE);
+    v = alloc_xenheap_pages(0, 0);
+    if ( v != NULL )
+        clear_page(v);
+    return v;
+}
+
+void free_vcpu_struct(struct vcpu *v)
+{
+    free_xenheap_page(v);
+}
+
+int vcpu_initialise(struct vcpu *v)
+{
+    int rc = 0;
+
+    return rc;
+}
+
+void vcpu_destroy(struct vcpu *v)
+{
+
+}
+
+int arch_domain_create(struct domain *d, unsigned int domcr_flags)
+{
+    int rc;
+
+    d->max_vcpus = 8;
+
+    rc = 0;
+fail:
+    return rc;
+}
+
+void arch_domain_destroy(struct domain *d)
+{
+    /* p2m_destroy */
+    /* domain_vgic_destroy */
+}
+
+void arch_dump_domain_info(struct domain *d)
+{
+}
+
+void arch_dump_vcpu_info(struct vcpu *v)
+{
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 0d42f7875293 -r 1cfe402b934a xen/include/asm-arm/domain.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/domain.h	Thu Feb 09 11:33:29 2012 +0000
@@ -0,0 +1,43 @@
+#ifndef __ASM_DOMAIN_H__
+#define __ASM_DOMAIN_H__
+
+#include <xen/config.h>
+#include <xen/cache.h>
+#include <asm/page.h>
+#include <asm/p2m.h>
+
+struct pending_irq
+{
+    int irq;
+    struct irq_desc *desc; /* only set it the irq corresponds to a physical irq */
+    uint8_t priority;
+    struct list_head link;
+};
+
+struct arch_domain
+{
+}  __cacheline_aligned;
+
+struct arch_vcpu
+{
+    struct cpu_user_regs user_regs;
+
+    uint32_t sctlr;
+    uint32_t ttbr0, ttbr1, ttbcr;
+
+}  __cacheline_aligned;
+
+void vcpu_show_execution_state(struct vcpu *);
+void vcpu_show_registers(const struct vcpu *);
+
+#endif /* __ASM_DOMAIN_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:42 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQM-00065Q-2q; Thu, 09 Feb 2012 16:00:42 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQI-0005zq-D6
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:38 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-174.messagelabs.com!1328803230!12715309!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14871 invoked from network); 9 Feb 2012 16:00:31 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:31 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQA-0004PI-0X
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:30 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ9-00068G-S6
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:29 +0000
Message-Id: <E1RvWQ9-00068G-S6@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:29 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: driver for CoreLink GIC-400
	Generic Interrupt Controller
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787210 0
# Node ID f770f641498bbdb2aca90bf6a0db7a2eaf0247a0
# Parent  a8c70f22d704452513c5728dd99bf5a3c2ca3b84
arm: driver for CoreLink GIC-400 Generic Interrupt Controller

- GICC, GICD and GICH initialization;

- interrupts routing, acking and EOI;

- interrupt injection into guests;

- maintenance interrupt handler, that takes care of EOI physical
  interrupts on behalf of the guest;

- a function to remap the virtual cpu interface into the guest address
  space, where the guest expect the GICC to be.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r a8c70f22d704 -r f770f641498b xen/arch/arm/domain.c
--- a/xen/arch/arm/domain.c	Thu Feb 09 11:33:29 2012 +0000
+++ b/xen/arch/arm/domain.c	Thu Feb 09 11:33:30 2012 +0000
@@ -11,6 +11,8 @@
 #include <asm/p2m.h>
 #include <asm/irq.h>
 
+#include "gic.h"
+
 DEFINE_PER_CPU(struct vcpu *, curr_vcpu);
 
 static void continue_idle_domain(struct vcpu *v)
diff -r a8c70f22d704 -r f770f641498b xen/arch/arm/gic.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/gic.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,473 @@
+/*
+ * xen/arch/arm/gic.c
+ *
+ * ARM Generic Interrupt Controller support
+ *
+ * Tim Deegan <tim@xen.org>
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <xen/config.h>
+#include <xen/lib.h>
+#include <xen/init.h>
+#include <xen/mm.h>
+#include <xen/irq.h>
+#include <xen/sched.h>
+#include <xen/errno.h>
+#include <xen/softirq.h>
+#include <asm/p2m.h>
+#include <asm/domain.h>
+
+#include "gic.h"
+
+/* Access to the GIC Distributor registers through the fixmap */
+#define GICD ((volatile uint32_t *) FIXMAP_ADDR(FIXMAP_GICD))
+#define GICC ((volatile uint32_t *) (FIXMAP_ADDR(FIXMAP_GICC1)  \
+                                     + (GIC_CR_OFFSET & 0xfff)))
+#define GICH ((volatile uint32_t *) (FIXMAP_ADDR(FIXMAP_GICH)  \
+                                     + (GIC_HR_OFFSET & 0xfff)))
+
+/* Global state */
+static struct {
+    paddr_t dbase;       /* Address of distributor registers */
+    paddr_t cbase;       /* Address of CPU interface registers */
+    paddr_t hbase;       /* Address of virtual interface registers */
+    unsigned int lines;
+    unsigned int cpus;
+    spinlock_t lock;
+} gic;
+
+irq_desc_t irq_desc[NR_IRQS];
+unsigned nr_lrs;
+
+static unsigned int gic_irq_startup(struct irq_desc *desc)
+{
+    uint32_t enabler;
+    int irq = desc->irq;
+
+    /* Enable routing */
+    enabler = GICD[GICD_ISENABLER + irq / 32];
+    GICD[GICD_ISENABLER + irq / 32] = enabler | (1u << (irq % 32));
+
+    return 0;
+}
+
+static void gic_irq_shutdown(struct irq_desc *desc)
+{
+    uint32_t enabler;
+    int irq = desc->irq;
+
+    /* Disable routing */
+    enabler = GICD[GICD_ICENABLER + irq / 32];
+    GICD[GICD_ICENABLER + irq / 32] = enabler | (1u << (irq % 32));
+}
+
+static void gic_irq_enable(struct irq_desc *desc)
+{
+
+}
+
+static void gic_irq_disable(struct irq_desc *desc)
+{
+
+}
+
+static void gic_irq_ack(struct irq_desc *desc)
+{
+    /* No ACK -- reading IAR has done this for us */
+}
+
+static void gic_host_irq_end(struct irq_desc *desc)
+{
+    int irq = desc->irq;
+    /* Lower the priority */
+    GICC[GICC_EOIR] = irq;
+    /* Deactivate */
+    GICC[GICC_DIR] = irq;
+}
+
+static void gic_guest_irq_end(struct irq_desc *desc)
+{
+    int irq = desc->irq;
+    /* Lower the priority of the IRQ */
+    GICC[GICC_EOIR] = irq;
+    /* Deactivation happens in maintenance interrupt / via GICV */
+}
+
+static void gic_irq_set_affinity(struct irq_desc *desc, const cpumask_t *mask)
+{
+    BUG();
+}
+
+/* XXX different for level vs edge */
+static hw_irq_controller gic_host_irq_type = {
+    .typename = "gic",
+    .startup = gic_irq_startup,
+    .shutdown = gic_irq_shutdown,
+    .enable = gic_irq_enable,
+    .disable = gic_irq_disable,
+    .ack = gic_irq_ack,
+    .end = gic_host_irq_end,
+    .set_affinity = gic_irq_set_affinity,
+};
+static hw_irq_controller gic_guest_irq_type = {
+    .typename = "gic",
+    .startup = gic_irq_startup,
+    .shutdown = gic_irq_shutdown,
+    .enable = gic_irq_enable,
+    .disable = gic_irq_disable,
+    .ack = gic_irq_ack,
+    .end = gic_guest_irq_end,
+    .set_affinity = gic_irq_set_affinity,
+};
+
+/* Program the GIC to route an interrupt */
+static int gic_route_irq(unsigned int irq, bool_t level,
+                         unsigned int cpu_mask, unsigned int priority)
+{
+    volatile unsigned char *bytereg;
+    uint32_t cfg, edgebit;
+    struct irq_desc *desc = irq_to_desc(irq);
+    unsigned long flags;
+
+    ASSERT(!(cpu_mask & ~0xff));  /* Targets bitmap only supports 8 CPUs */
+    ASSERT(priority <= 0xff);     /* Only 8 bits of priority */
+    ASSERT(irq < gic.lines + 32); /* Can't route interrupts that don't exist */
+
+    spin_lock_irqsave(&desc->lock, flags);
+    spin_lock(&gic.lock);
+
+    if ( desc->action != NULL )
+    {
+        spin_unlock(&desc->lock);
+        return -EBUSY;
+    }
+
+    desc->handler = &gic_host_irq_type;
+
+    /* Disable interrupt */
+    desc->handler->shutdown(desc);
+
+    /* Set edge / level */
+    cfg = GICD[GICD_ICFGR + irq / 16];
+    edgebit = 2u << (2 * (irq % 16));
+    if ( level )
+        cfg &= ~edgebit;
+    else
+        cfg |= edgebit;
+    GICD[GICD_ICFGR + irq / 16] = cfg;
+
+    /* Set target CPU mask (RAZ/WI on uniprocessor) */
+    bytereg = (unsigned char *) (GICD + GICD_ITARGETSR);
+    bytereg[irq] = cpu_mask;
+
+    /* Set priority */
+    bytereg = (unsigned char *) (GICD + GICD_IPRIORITYR);
+    bytereg[irq] = priority;
+
+    spin_unlock(&gic.lock);
+    spin_unlock_irqrestore(&desc->lock, flags);
+    return 0;
+}
+
+static void __init gic_dist_init(void)
+{
+    uint32_t type;
+    uint32_t cpumask = 1 << smp_processor_id();
+    int i;
+
+    cpumask |= cpumask << 8;
+    cpumask |= cpumask << 16;
+
+    /* Disable the distributor */
+    GICD[GICD_CTLR] = 0;
+
+    type = GICD[GICD_TYPER];
+    gic.lines = 32 * (type & GICD_TYPE_LINES);
+    gic.cpus = 1 + ((type & GICD_TYPE_CPUS) >> 5);
+    printk("GIC: %d lines, %d cpu%s%s (IID %8.8x).\n",
+           gic.lines, gic.cpus, (gic.cpus == 1) ? "" : "s",
+           (type & GICD_TYPE_SEC) ? ", secure" : "",
+           GICD[GICD_IIDR]);
+
+    /* Default all global IRQs to level, active low */
+    for ( i = 32; i < gic.lines; i += 16 )
+        GICD[GICD_ICFGR + i / 16] = 0x0;
+
+    /* Route all global IRQs to this CPU */
+    for ( i = 32; i < gic.lines; i += 4 )
+        GICD[GICD_ICFGR + i / 4] = cpumask;
+
+    /* Default priority for global interrupts */
+    for ( i = 32; i < gic.lines; i += 4 )
+        GICD[GICD_IPRIORITYR + i / 4] = 0xa0a0a0a0;
+
+    /* Disable all global interrupts */
+    for ( i = 32; i < gic.lines; i += 32 )
+        GICD[GICD_ICENABLER + i / 32] = ~0ul;
+
+    /* Turn on the distributor */
+    GICD[GICD_CTLR] = GICD_CTL_ENABLE;
+}
+
+static void __cpuinit gic_cpu_init(void)
+{
+    int i;
+
+    /* Disable all PPI and enable all SGI */
+    GICD[GICD_ICENABLER] = 0xffff0000; /* Disable all PPI */
+    GICD[GICD_ISENABLER] = 0x0000ffff; /* Enable all SGI */
+    /* Set PPI and SGI priorities */
+    for (i = 0; i < 32; i += 4)
+        GICD[GICD_IPRIORITYR + i / 4] = 0xa0a0a0a0;
+
+    /* Local settings: interface controller */
+    GICC[GICC_PMR] = 0xff;                /* Don't mask by priority */
+    GICC[GICC_BPR] = 0;                   /* Finest granularity of priority */
+    GICC[GICC_CTLR] = GICC_CTL_ENABLE|GICC_CTL_EOI;    /* Turn on delivery */
+}
+
+static void __cpuinit gic_hyp_init(void)
+{
+    uint32_t vtr;
+
+    vtr = GICH[GICH_VTR];
+    nr_lrs  = (vtr & GICH_VTR_NRLRGS) + 1;
+    printk("GICH: %d list registers available\n", nr_lrs);
+
+    GICH[GICH_HCR] = GICH_HCR_EN;
+    GICH[GICH_MISR] = GICH_MISR_EOI;
+}
+
+/* Set up the GIC */
+void gic_init(void)
+{
+    /* XXX FIXME get this from devicetree */
+    gic.dbase = GIC_BASE_ADDRESS + GIC_DR_OFFSET;
+    gic.cbase = GIC_BASE_ADDRESS + GIC_CR_OFFSET;
+    gic.hbase = GIC_BASE_ADDRESS + GIC_HR_OFFSET;
+    set_fixmap(FIXMAP_GICD, gic.dbase >> PAGE_SHIFT, DEV_SHARED);
+    BUILD_BUG_ON(FIXMAP_ADDR(FIXMAP_GICC1) !=
+                 FIXMAP_ADDR(FIXMAP_GICC2)-PAGE_SIZE);
+    set_fixmap(FIXMAP_GICC1, gic.cbase >> PAGE_SHIFT, DEV_SHARED);
+    set_fixmap(FIXMAP_GICC2, (gic.cbase >> PAGE_SHIFT) + 1, DEV_SHARED);
+    set_fixmap(FIXMAP_GICH, gic.hbase >> PAGE_SHIFT, DEV_SHARED);
+
+    /* Global settings: interrupt distributor */
+    spin_lock_init(&gic.lock);
+    spin_lock(&gic.lock);
+
+    gic_dist_init();
+    gic_cpu_init();
+    gic_hyp_init();
+
+    spin_unlock(&gic.lock);
+}
+
+void gic_route_irqs(void)
+{
+    /* XXX should get these from DT */
+    /* GIC maintenance */
+    gic_route_irq(25, 1, 1u << smp_processor_id(), 0xa0);
+    /* Hypervisor Timer */
+    gic_route_irq(26, 1, 1u << smp_processor_id(), 0xa0);
+    /* Timer */
+    gic_route_irq(30, 1, 1u << smp_processor_id(), 0xa0);
+    /* UART */
+    gic_route_irq(37, 0, 1u << smp_processor_id(), 0xa0);
+}
+
+void __init release_irq(unsigned int irq)
+{
+    struct irq_desc *desc;
+    unsigned long flags;
+   struct irqaction *action;
+
+    desc = irq_to_desc(irq);
+
+    spin_lock_irqsave(&desc->lock,flags);
+    action = desc->action;
+    desc->action  = NULL;
+    desc->status |= IRQ_DISABLED;
+
+    spin_lock(&gic.lock);
+    desc->handler->shutdown(desc);
+    spin_unlock(&gic.lock);
+
+    spin_unlock_irqrestore(&desc->lock,flags);
+
+    /* Wait to make sure it's not being used on another CPU */
+    do { smp_mb(); } while ( desc->status & IRQ_INPROGRESS );
+
+    if (action && action->free_on_release)
+        xfree(action);
+}
+
+static int __setup_irq(struct irq_desc *desc, unsigned int irq,
+                       struct irqaction *new)
+{
+    if ( desc->action != NULL )
+        return -EBUSY;
+
+    desc->action  = new;
+    desc->status &= ~IRQ_DISABLED;
+    dsb();
+
+    desc->handler->startup(desc);
+
+    return 0;
+}
+
+int __init setup_irq(unsigned int irq, struct irqaction *new)
+{
+    int rc;
+    unsigned long flags;
+    struct irq_desc *desc;
+
+    desc = irq_to_desc(irq);
+
+    spin_lock_irqsave(&desc->lock, flags);
+
+    rc = __setup_irq(desc, irq, new);
+
+    spin_unlock_irqrestore(&desc->lock,flags);
+
+    return rc;
+}
+
+void gic_set_guest_irq(unsigned int virtual_irq,
+        unsigned int state, unsigned int priority)
+{
+    BUG_ON(virtual_irq > nr_lrs);
+    GICH[GICH_LR + virtual_irq] = state |
+        GICH_LR_MAINTENANCE_IRQ |
+        ((priority >> 3) << GICH_LR_PRIORITY_SHIFT) |
+        ((virtual_irq & GICH_LR_VIRTUAL_MASK) << GICH_LR_VIRTUAL_SHIFT);
+}
+
+void gic_inject_irq_start(void)
+{
+    uint32_t hcr;
+    hcr = READ_CP32(HCR);
+    WRITE_CP32(hcr | HCR_VI, HCR);
+    isb();
+}
+
+void gic_inject_irq_stop(void)
+{
+    uint32_t hcr;
+    hcr = READ_CP32(HCR);
+    if (hcr & HCR_VI) {
+        WRITE_CP32(hcr & ~HCR_VI, HCR);
+        isb();
+    }
+}
+
+int gic_route_irq_to_guest(struct domain *d, unsigned int irq,
+                           const char * devname)
+{
+    struct irqaction *action;
+    struct irq_desc *desc = irq_to_desc(irq);
+    unsigned long flags;
+    int retval;
+
+    action = xmalloc(struct irqaction);
+    if (!action)
+        return -ENOMEM;
+
+    action->dev_id = d;
+    action->name = devname;
+
+    spin_lock_irqsave(&desc->lock, flags);
+
+    desc->handler = &gic_guest_irq_type;
+    desc->status |= IRQ_GUEST;
+
+    retval = __setup_irq(desc, irq, action);
+    if (retval) {
+        xfree(action);
+        goto out;
+    }
+
+out:
+    spin_unlock_irqrestore(&desc->lock, flags);
+    return retval;
+}
+
+/* Accept an interrupt from the GIC and dispatch its handler */
+void gic_interrupt(struct cpu_user_regs *regs, int is_fiq)
+{
+    uint32_t intack = GICC[GICC_IAR];
+    unsigned int irq = intack & GICC_IA_IRQ;
+
+    if ( irq == 1023 )
+        /* Spurious interrupt */
+        return;
+
+    do_IRQ(regs, irq, is_fiq);
+}
+
+void gicv_setup(struct domain *d)
+{
+    /* map the gic virtual cpu interface in the gic cpu interface region of
+     * the guest */
+    printk("mapping GICC at %#"PRIx32" to %#"PRIx32"\n",
+           GIC_BASE_ADDRESS + GIC_CR_OFFSET,
+           GIC_BASE_ADDRESS + GIC_VR_OFFSET);
+    map_mmio_regions(d, GIC_BASE_ADDRESS + GIC_CR_OFFSET,
+                        GIC_BASE_ADDRESS + GIC_CR_OFFSET + (2 * PAGE_SIZE) - 1,
+                        GIC_BASE_ADDRESS + GIC_VR_OFFSET);
+}
+
+static void maintenance_interrupt(int irq, void *dev_id, struct cpu_user_regs *regs)
+{
+    int i, virq;
+    uint32_t lr;
+    uint64_t eisr = GICH[GICH_EISR0] | (((uint64_t) GICH[GICH_EISR1]) << 32);
+
+    for ( i = 0; i < 64; i++ ) {
+        if ( eisr & ((uint64_t)1 << i) ) {
+            struct pending_irq *p;
+
+            lr = GICH[GICH_LR + i];
+            virq = lr & GICH_LR_VIRTUAL_MASK;
+            GICH[GICH_LR + i] = 0;
+
+            spin_lock(&current->arch.vgic.lock);
+            p = irq_to_pending(current, virq);
+            if ( p->desc != NULL ) {
+                p->desc->status &= ~IRQ_INPROGRESS;
+                GICC[GICC_DIR] = virq;
+            }
+            gic_inject_irq_stop();
+            list_del(&p->link);
+            INIT_LIST_HEAD(&p->link);
+            cpu_raise_softirq(current->processor, VGIC_SOFTIRQ);
+            spin_unlock(&current->arch.vgic.lock);
+        }
+    }
+}
+
+void __cpuinit init_maintenance_interrupt(void)
+{
+    request_irq(25, maintenance_interrupt, 0, "irq-maintenance", NULL);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r a8c70f22d704 -r f770f641498b xen/arch/arm/gic.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/gic.h	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,151 @@
+/*
+ * xen/arch/arm/gic.h
+ *
+ * ARM Generic Interrupt Controller support
+ *
+ * Tim Deegan <tim@xen.org>
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#ifndef __ARCH_ARM_GIC_H__
+#define __ARCH_ARM_GIC_H__
+
+#define GICD_CTLR       (0x000/4)
+#define GICD_TYPER      (0x004/4)
+#define GICD_IIDR       (0x008/4)
+#define GICD_IGROUPR    (0x080/4)
+#define GICD_IGROUPRN   (0x0FC/4)
+#define GICD_ISENABLER  (0x100/4)
+#define GICD_ISENABLERN (0x17C/4)
+#define GICD_ICENABLER  (0x180/4)
+#define GICD_ICENABLERN (0x1fC/4)
+#define GICD_ISPENDR    (0x200/4)
+#define GICD_ISPENDRN   (0x27C/4)
+#define GICD_ICPENDR    (0x280/4)
+#define GICD_ICPENDRN   (0x2FC/4)
+#define GICD_ISACTIVER  (0x300/4)
+#define GICD_ISACTIVERN (0x37C/4)
+#define GICD_ICACTIVER  (0x380/4)
+#define GICD_ICACTIVERN (0x3FC/4)
+#define GICD_IPRIORITYR (0x400/4)
+#define GICD_IPRIORITYRN (0x7F8/4)
+#define GICD_ITARGETSR  (0x800/4)
+#define GICD_ITARGETSRN (0xBF8/4)
+#define GICD_ICFGR      (0xC00/4)
+#define GICD_ICFGRN     (0xCFC/4)
+#define GICD_NSACR      (0xE00/4)
+#define GICD_NSACRN     (0xEFC/4)
+#define GICD_ICPIDR2    (0xFE8/4)
+#define GICD_SGIR       (0xF00/4)
+#define GICD_CPENDSGIR  (0xF10/4)
+#define GICD_CPENDSGIRN (0xF1C/4)
+#define GICD_SPENDSGIR  (0xF20/4)
+#define GICD_SPENDSGIRN (0xF2C/4)
+#define GICD_ICPIDR2    (0xFE8/4)
+
+#define GICC_CTLR       (0x0000/4)
+#define GICC_PMR        (0x0004/4)
+#define GICC_BPR        (0x0008/4)
+#define GICC_IAR        (0x000C/4)
+#define GICC_EOIR       (0x0010/4)
+#define GICC_RPR        (0x0014/4)
+#define GICC_HPPIR      (0x0018/4)
+#define GICC_APR        (0x00D0/4)
+#define GICC_NSAPR      (0x00E0/4)
+#define GICC_DIR        (0x1000/4)
+
+#define GICH_HCR        (0x00/4)
+#define GICH_VTR        (0x04/4)
+#define GICH_VMCR       (0x08/4)
+#define GICH_MISR       (0x10/4)
+#define GICH_EISR0      (0x20/4)
+#define GICH_EISR1      (0x24/4)
+#define GICH_ELRSR0     (0x30/4)
+#define GICH_ELRSR1     (0x34/4)
+#define GICH_APR        (0xF0/4)
+#define GICH_LR         (0x100/4)
+
+/* Register bits */
+#define GICD_CTL_ENABLE 0x1
+
+#define GICD_TYPE_LINES 0x01f
+#define GICD_TYPE_CPUS  0x0e0
+#define GICD_TYPE_SEC   0x400
+
+#define GICC_CTL_ENABLE 0x1
+#define GICC_CTL_EOI    (0x1 << 9)
+
+#define GICC_IA_IRQ     0x03ff
+#define GICC_IA_CPU     0x1c00
+
+#define GICH_HCR_EN       (1 << 0)
+#define GICH_HCR_UIE      (1 << 1)
+#define GICH_HCR_LRENPIE  (1 << 2)
+#define GICH_HCR_NPIE     (1 << 3)
+#define GICH_HCR_VGRP0EIE (1 << 4)
+#define GICH_HCR_VGRP0DIE (1 << 5)
+#define GICH_HCR_VGRP1EIE (1 << 6)
+#define GICH_HCR_VGRP1DIE (1 << 7)
+
+#define GICH_MISR_EOI     (1 << 0)
+#define GICH_MISR_U       (1 << 1)
+#define GICH_MISR_LRENP   (1 << 2)
+#define GICH_MISR_NP      (1 << 3)
+#define GICH_MISR_VGRP0E  (1 << 4)
+#define GICH_MISR_VGRP0D  (1 << 5)
+#define GICH_MISR_VGRP1E  (1 << 6)
+#define GICH_MISR_VGRP1D  (1 << 7)
+
+#define GICH_LR_VIRTUAL_MASK    0x3ff
+#define GICH_LR_VIRTUAL_SHIFT   0
+#define GICH_LR_PHYSICAL_MASK   0x3ff
+#define GICH_LR_PHYSICAL_SHIFT  10
+#define GICH_LR_STATE_MASK      0x3
+#define GICH_LR_STATE_SHIFT     28
+#define GICH_LR_PRIORITY_SHIFT  23
+#define GICH_LR_MAINTENANCE_IRQ (1<<19)
+#define GICH_LR_PENDING         (1<<28)
+#define GICH_LR_ACTIVE          (1<<29)
+#define GICH_LR_GRP1            (1<<30)
+#define GICH_LR_HW              (1<<31)
+#define GICH_LR_CPUID_SHIFT     9
+#define GICH_VTR_NRLRGS         0x3f
+
+extern struct pending_irq *irq_to_pending(struct vcpu *v, unsigned int irq);
+
+extern void gic_route_irqs(void);
+
+extern void __cpuinit init_maintenance_interrupt(void);
+extern void gic_set_guest_irq(unsigned int irq,
+        unsigned int state, unsigned int priority);
+extern void gic_inject_irq_start(void);
+extern void gic_inject_irq_stop(void);
+extern int gic_route_irq_to_guest(struct domain *d, unsigned int irq,
+                                  const char * devname);
+
+/* Accept an interrupt from the GIC and dispatch its handler */
+extern void gic_interrupt(struct cpu_user_regs *regs, int is_fiq);
+/* Bring up the interrupt controller */
+extern void gic_init(void);
+/* setup the gic virtual interface for a guest */
+extern void gicv_setup(struct domain *d);
+#endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:42 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQM-00065Q-2q; Thu, 09 Feb 2012 16:00:42 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQI-0005zq-D6
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:38 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-174.messagelabs.com!1328803230!12715309!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14871 invoked from network); 9 Feb 2012 16:00:31 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:31 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQA-0004PI-0X
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:30 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ9-00068G-S6
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:29 +0000
Message-Id: <E1RvWQ9-00068G-S6@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:29 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: driver for CoreLink GIC-400
	Generic Interrupt Controller
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787210 0
# Node ID f770f641498bbdb2aca90bf6a0db7a2eaf0247a0
# Parent  a8c70f22d704452513c5728dd99bf5a3c2ca3b84
arm: driver for CoreLink GIC-400 Generic Interrupt Controller

- GICC, GICD and GICH initialization;

- interrupts routing, acking and EOI;

- interrupt injection into guests;

- maintenance interrupt handler, that takes care of EOI physical
  interrupts on behalf of the guest;

- a function to remap the virtual cpu interface into the guest address
  space, where the guest expect the GICC to be.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r a8c70f22d704 -r f770f641498b xen/arch/arm/domain.c
--- a/xen/arch/arm/domain.c	Thu Feb 09 11:33:29 2012 +0000
+++ b/xen/arch/arm/domain.c	Thu Feb 09 11:33:30 2012 +0000
@@ -11,6 +11,8 @@
 #include <asm/p2m.h>
 #include <asm/irq.h>
 
+#include "gic.h"
+
 DEFINE_PER_CPU(struct vcpu *, curr_vcpu);
 
 static void continue_idle_domain(struct vcpu *v)
diff -r a8c70f22d704 -r f770f641498b xen/arch/arm/gic.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/gic.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,473 @@
+/*
+ * xen/arch/arm/gic.c
+ *
+ * ARM Generic Interrupt Controller support
+ *
+ * Tim Deegan <tim@xen.org>
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <xen/config.h>
+#include <xen/lib.h>
+#include <xen/init.h>
+#include <xen/mm.h>
+#include <xen/irq.h>
+#include <xen/sched.h>
+#include <xen/errno.h>
+#include <xen/softirq.h>
+#include <asm/p2m.h>
+#include <asm/domain.h>
+
+#include "gic.h"
+
+/* Access to the GIC Distributor registers through the fixmap */
+#define GICD ((volatile uint32_t *) FIXMAP_ADDR(FIXMAP_GICD))
+#define GICC ((volatile uint32_t *) (FIXMAP_ADDR(FIXMAP_GICC1)  \
+                                     + (GIC_CR_OFFSET & 0xfff)))
+#define GICH ((volatile uint32_t *) (FIXMAP_ADDR(FIXMAP_GICH)  \
+                                     + (GIC_HR_OFFSET & 0xfff)))
+
+/* Global state */
+static struct {
+    paddr_t dbase;       /* Address of distributor registers */
+    paddr_t cbase;       /* Address of CPU interface registers */
+    paddr_t hbase;       /* Address of virtual interface registers */
+    unsigned int lines;
+    unsigned int cpus;
+    spinlock_t lock;
+} gic;
+
+irq_desc_t irq_desc[NR_IRQS];
+unsigned nr_lrs;
+
+static unsigned int gic_irq_startup(struct irq_desc *desc)
+{
+    uint32_t enabler;
+    int irq = desc->irq;
+
+    /* Enable routing */
+    enabler = GICD[GICD_ISENABLER + irq / 32];
+    GICD[GICD_ISENABLER + irq / 32] = enabler | (1u << (irq % 32));
+
+    return 0;
+}
+
+static void gic_irq_shutdown(struct irq_desc *desc)
+{
+    uint32_t enabler;
+    int irq = desc->irq;
+
+    /* Disable routing */
+    enabler = GICD[GICD_ICENABLER + irq / 32];
+    GICD[GICD_ICENABLER + irq / 32] = enabler | (1u << (irq % 32));
+}
+
+static void gic_irq_enable(struct irq_desc *desc)
+{
+
+}
+
+static void gic_irq_disable(struct irq_desc *desc)
+{
+
+}
+
+static void gic_irq_ack(struct irq_desc *desc)
+{
+    /* No ACK -- reading IAR has done this for us */
+}
+
+static void gic_host_irq_end(struct irq_desc *desc)
+{
+    int irq = desc->irq;
+    /* Lower the priority */
+    GICC[GICC_EOIR] = irq;
+    /* Deactivate */
+    GICC[GICC_DIR] = irq;
+}
+
+static void gic_guest_irq_end(struct irq_desc *desc)
+{
+    int irq = desc->irq;
+    /* Lower the priority of the IRQ */
+    GICC[GICC_EOIR] = irq;
+    /* Deactivation happens in maintenance interrupt / via GICV */
+}
+
+static void gic_irq_set_affinity(struct irq_desc *desc, const cpumask_t *mask)
+{
+    BUG();
+}
+
+/* XXX different for level vs edge */
+static hw_irq_controller gic_host_irq_type = {
+    .typename = "gic",
+    .startup = gic_irq_startup,
+    .shutdown = gic_irq_shutdown,
+    .enable = gic_irq_enable,
+    .disable = gic_irq_disable,
+    .ack = gic_irq_ack,
+    .end = gic_host_irq_end,
+    .set_affinity = gic_irq_set_affinity,
+};
+static hw_irq_controller gic_guest_irq_type = {
+    .typename = "gic",
+    .startup = gic_irq_startup,
+    .shutdown = gic_irq_shutdown,
+    .enable = gic_irq_enable,
+    .disable = gic_irq_disable,
+    .ack = gic_irq_ack,
+    .end = gic_guest_irq_end,
+    .set_affinity = gic_irq_set_affinity,
+};
+
+/* Program the GIC to route an interrupt */
+static int gic_route_irq(unsigned int irq, bool_t level,
+                         unsigned int cpu_mask, unsigned int priority)
+{
+    volatile unsigned char *bytereg;
+    uint32_t cfg, edgebit;
+    struct irq_desc *desc = irq_to_desc(irq);
+    unsigned long flags;
+
+    ASSERT(!(cpu_mask & ~0xff));  /* Targets bitmap only supports 8 CPUs */
+    ASSERT(priority <= 0xff);     /* Only 8 bits of priority */
+    ASSERT(irq < gic.lines + 32); /* Can't route interrupts that don't exist */
+
+    spin_lock_irqsave(&desc->lock, flags);
+    spin_lock(&gic.lock);
+
+    if ( desc->action != NULL )
+    {
+        spin_unlock(&desc->lock);
+        return -EBUSY;
+    }
+
+    desc->handler = &gic_host_irq_type;
+
+    /* Disable interrupt */
+    desc->handler->shutdown(desc);
+
+    /* Set edge / level */
+    cfg = GICD[GICD_ICFGR + irq / 16];
+    edgebit = 2u << (2 * (irq % 16));
+    if ( level )
+        cfg &= ~edgebit;
+    else
+        cfg |= edgebit;
+    GICD[GICD_ICFGR + irq / 16] = cfg;
+
+    /* Set target CPU mask (RAZ/WI on uniprocessor) */
+    bytereg = (unsigned char *) (GICD + GICD_ITARGETSR);
+    bytereg[irq] = cpu_mask;
+
+    /* Set priority */
+    bytereg = (unsigned char *) (GICD + GICD_IPRIORITYR);
+    bytereg[irq] = priority;
+
+    spin_unlock(&gic.lock);
+    spin_unlock_irqrestore(&desc->lock, flags);
+    return 0;
+}
+
+static void __init gic_dist_init(void)
+{
+    uint32_t type;
+    uint32_t cpumask = 1 << smp_processor_id();
+    int i;
+
+    cpumask |= cpumask << 8;
+    cpumask |= cpumask << 16;
+
+    /* Disable the distributor */
+    GICD[GICD_CTLR] = 0;
+
+    type = GICD[GICD_TYPER];
+    gic.lines = 32 * (type & GICD_TYPE_LINES);
+    gic.cpus = 1 + ((type & GICD_TYPE_CPUS) >> 5);
+    printk("GIC: %d lines, %d cpu%s%s (IID %8.8x).\n",
+           gic.lines, gic.cpus, (gic.cpus == 1) ? "" : "s",
+           (type & GICD_TYPE_SEC) ? ", secure" : "",
+           GICD[GICD_IIDR]);
+
+    /* Default all global IRQs to level, active low */
+    for ( i = 32; i < gic.lines; i += 16 )
+        GICD[GICD_ICFGR + i / 16] = 0x0;
+
+    /* Route all global IRQs to this CPU */
+    for ( i = 32; i < gic.lines; i += 4 )
+        GICD[GICD_ICFGR + i / 4] = cpumask;
+
+    /* Default priority for global interrupts */
+    for ( i = 32; i < gic.lines; i += 4 )
+        GICD[GICD_IPRIORITYR + i / 4] = 0xa0a0a0a0;
+
+    /* Disable all global interrupts */
+    for ( i = 32; i < gic.lines; i += 32 )
+        GICD[GICD_ICENABLER + i / 32] = ~0ul;
+
+    /* Turn on the distributor */
+    GICD[GICD_CTLR] = GICD_CTL_ENABLE;
+}
+
+static void __cpuinit gic_cpu_init(void)
+{
+    int i;
+
+    /* Disable all PPI and enable all SGI */
+    GICD[GICD_ICENABLER] = 0xffff0000; /* Disable all PPI */
+    GICD[GICD_ISENABLER] = 0x0000ffff; /* Enable all SGI */
+    /* Set PPI and SGI priorities */
+    for (i = 0; i < 32; i += 4)
+        GICD[GICD_IPRIORITYR + i / 4] = 0xa0a0a0a0;
+
+    /* Local settings: interface controller */
+    GICC[GICC_PMR] = 0xff;                /* Don't mask by priority */
+    GICC[GICC_BPR] = 0;                   /* Finest granularity of priority */
+    GICC[GICC_CTLR] = GICC_CTL_ENABLE|GICC_CTL_EOI;    /* Turn on delivery */
+}
+
+static void __cpuinit gic_hyp_init(void)
+{
+    uint32_t vtr;
+
+    vtr = GICH[GICH_VTR];
+    nr_lrs  = (vtr & GICH_VTR_NRLRGS) + 1;
+    printk("GICH: %d list registers available\n", nr_lrs);
+
+    GICH[GICH_HCR] = GICH_HCR_EN;
+    GICH[GICH_MISR] = GICH_MISR_EOI;
+}
+
+/* Set up the GIC */
+void gic_init(void)
+{
+    /* XXX FIXME get this from devicetree */
+    gic.dbase = GIC_BASE_ADDRESS + GIC_DR_OFFSET;
+    gic.cbase = GIC_BASE_ADDRESS + GIC_CR_OFFSET;
+    gic.hbase = GIC_BASE_ADDRESS + GIC_HR_OFFSET;
+    set_fixmap(FIXMAP_GICD, gic.dbase >> PAGE_SHIFT, DEV_SHARED);
+    BUILD_BUG_ON(FIXMAP_ADDR(FIXMAP_GICC1) !=
+                 FIXMAP_ADDR(FIXMAP_GICC2)-PAGE_SIZE);
+    set_fixmap(FIXMAP_GICC1, gic.cbase >> PAGE_SHIFT, DEV_SHARED);
+    set_fixmap(FIXMAP_GICC2, (gic.cbase >> PAGE_SHIFT) + 1, DEV_SHARED);
+    set_fixmap(FIXMAP_GICH, gic.hbase >> PAGE_SHIFT, DEV_SHARED);
+
+    /* Global settings: interrupt distributor */
+    spin_lock_init(&gic.lock);
+    spin_lock(&gic.lock);
+
+    gic_dist_init();
+    gic_cpu_init();
+    gic_hyp_init();
+
+    spin_unlock(&gic.lock);
+}
+
+void gic_route_irqs(void)
+{
+    /* XXX should get these from DT */
+    /* GIC maintenance */
+    gic_route_irq(25, 1, 1u << smp_processor_id(), 0xa0);
+    /* Hypervisor Timer */
+    gic_route_irq(26, 1, 1u << smp_processor_id(), 0xa0);
+    /* Timer */
+    gic_route_irq(30, 1, 1u << smp_processor_id(), 0xa0);
+    /* UART */
+    gic_route_irq(37, 0, 1u << smp_processor_id(), 0xa0);
+}
+
+void __init release_irq(unsigned int irq)
+{
+    struct irq_desc *desc;
+    unsigned long flags;
+   struct irqaction *action;
+
+    desc = irq_to_desc(irq);
+
+    spin_lock_irqsave(&desc->lock,flags);
+    action = desc->action;
+    desc->action  = NULL;
+    desc->status |= IRQ_DISABLED;
+
+    spin_lock(&gic.lock);
+    desc->handler->shutdown(desc);
+    spin_unlock(&gic.lock);
+
+    spin_unlock_irqrestore(&desc->lock,flags);
+
+    /* Wait to make sure it's not being used on another CPU */
+    do { smp_mb(); } while ( desc->status & IRQ_INPROGRESS );
+
+    if (action && action->free_on_release)
+        xfree(action);
+}
+
+static int __setup_irq(struct irq_desc *desc, unsigned int irq,
+                       struct irqaction *new)
+{
+    if ( desc->action != NULL )
+        return -EBUSY;
+
+    desc->action  = new;
+    desc->status &= ~IRQ_DISABLED;
+    dsb();
+
+    desc->handler->startup(desc);
+
+    return 0;
+}
+
+int __init setup_irq(unsigned int irq, struct irqaction *new)
+{
+    int rc;
+    unsigned long flags;
+    struct irq_desc *desc;
+
+    desc = irq_to_desc(irq);
+
+    spin_lock_irqsave(&desc->lock, flags);
+
+    rc = __setup_irq(desc, irq, new);
+
+    spin_unlock_irqrestore(&desc->lock,flags);
+
+    return rc;
+}
+
+void gic_set_guest_irq(unsigned int virtual_irq,
+        unsigned int state, unsigned int priority)
+{
+    BUG_ON(virtual_irq > nr_lrs);
+    GICH[GICH_LR + virtual_irq] = state |
+        GICH_LR_MAINTENANCE_IRQ |
+        ((priority >> 3) << GICH_LR_PRIORITY_SHIFT) |
+        ((virtual_irq & GICH_LR_VIRTUAL_MASK) << GICH_LR_VIRTUAL_SHIFT);
+}
+
+void gic_inject_irq_start(void)
+{
+    uint32_t hcr;
+    hcr = READ_CP32(HCR);
+    WRITE_CP32(hcr | HCR_VI, HCR);
+    isb();
+}
+
+void gic_inject_irq_stop(void)
+{
+    uint32_t hcr;
+    hcr = READ_CP32(HCR);
+    if (hcr & HCR_VI) {
+        WRITE_CP32(hcr & ~HCR_VI, HCR);
+        isb();
+    }
+}
+
+int gic_route_irq_to_guest(struct domain *d, unsigned int irq,
+                           const char * devname)
+{
+    struct irqaction *action;
+    struct irq_desc *desc = irq_to_desc(irq);
+    unsigned long flags;
+    int retval;
+
+    action = xmalloc(struct irqaction);
+    if (!action)
+        return -ENOMEM;
+
+    action->dev_id = d;
+    action->name = devname;
+
+    spin_lock_irqsave(&desc->lock, flags);
+
+    desc->handler = &gic_guest_irq_type;
+    desc->status |= IRQ_GUEST;
+
+    retval = __setup_irq(desc, irq, action);
+    if (retval) {
+        xfree(action);
+        goto out;
+    }
+
+out:
+    spin_unlock_irqrestore(&desc->lock, flags);
+    return retval;
+}
+
+/* Accept an interrupt from the GIC and dispatch its handler */
+void gic_interrupt(struct cpu_user_regs *regs, int is_fiq)
+{
+    uint32_t intack = GICC[GICC_IAR];
+    unsigned int irq = intack & GICC_IA_IRQ;
+
+    if ( irq == 1023 )
+        /* Spurious interrupt */
+        return;
+
+    do_IRQ(regs, irq, is_fiq);
+}
+
+void gicv_setup(struct domain *d)
+{
+    /* map the gic virtual cpu interface in the gic cpu interface region of
+     * the guest */
+    printk("mapping GICC at %#"PRIx32" to %#"PRIx32"\n",
+           GIC_BASE_ADDRESS + GIC_CR_OFFSET,
+           GIC_BASE_ADDRESS + GIC_VR_OFFSET);
+    map_mmio_regions(d, GIC_BASE_ADDRESS + GIC_CR_OFFSET,
+                        GIC_BASE_ADDRESS + GIC_CR_OFFSET + (2 * PAGE_SIZE) - 1,
+                        GIC_BASE_ADDRESS + GIC_VR_OFFSET);
+}
+
+static void maintenance_interrupt(int irq, void *dev_id, struct cpu_user_regs *regs)
+{
+    int i, virq;
+    uint32_t lr;
+    uint64_t eisr = GICH[GICH_EISR0] | (((uint64_t) GICH[GICH_EISR1]) << 32);
+
+    for ( i = 0; i < 64; i++ ) {
+        if ( eisr & ((uint64_t)1 << i) ) {
+            struct pending_irq *p;
+
+            lr = GICH[GICH_LR + i];
+            virq = lr & GICH_LR_VIRTUAL_MASK;
+            GICH[GICH_LR + i] = 0;
+
+            spin_lock(&current->arch.vgic.lock);
+            p = irq_to_pending(current, virq);
+            if ( p->desc != NULL ) {
+                p->desc->status &= ~IRQ_INPROGRESS;
+                GICC[GICC_DIR] = virq;
+            }
+            gic_inject_irq_stop();
+            list_del(&p->link);
+            INIT_LIST_HEAD(&p->link);
+            cpu_raise_softirq(current->processor, VGIC_SOFTIRQ);
+            spin_unlock(&current->arch.vgic.lock);
+        }
+    }
+}
+
+void __cpuinit init_maintenance_interrupt(void)
+{
+    request_irq(25, maintenance_interrupt, 0, "irq-maintenance", NULL);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r a8c70f22d704 -r f770f641498b xen/arch/arm/gic.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/gic.h	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,151 @@
+/*
+ * xen/arch/arm/gic.h
+ *
+ * ARM Generic Interrupt Controller support
+ *
+ * Tim Deegan <tim@xen.org>
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#ifndef __ARCH_ARM_GIC_H__
+#define __ARCH_ARM_GIC_H__
+
+#define GICD_CTLR       (0x000/4)
+#define GICD_TYPER      (0x004/4)
+#define GICD_IIDR       (0x008/4)
+#define GICD_IGROUPR    (0x080/4)
+#define GICD_IGROUPRN   (0x0FC/4)
+#define GICD_ISENABLER  (0x100/4)
+#define GICD_ISENABLERN (0x17C/4)
+#define GICD_ICENABLER  (0x180/4)
+#define GICD_ICENABLERN (0x1fC/4)
+#define GICD_ISPENDR    (0x200/4)
+#define GICD_ISPENDRN   (0x27C/4)
+#define GICD_ICPENDR    (0x280/4)
+#define GICD_ICPENDRN   (0x2FC/4)
+#define GICD_ISACTIVER  (0x300/4)
+#define GICD_ISACTIVERN (0x37C/4)
+#define GICD_ICACTIVER  (0x380/4)
+#define GICD_ICACTIVERN (0x3FC/4)
+#define GICD_IPRIORITYR (0x400/4)
+#define GICD_IPRIORITYRN (0x7F8/4)
+#define GICD_ITARGETSR  (0x800/4)
+#define GICD_ITARGETSRN (0xBF8/4)
+#define GICD_ICFGR      (0xC00/4)
+#define GICD_ICFGRN     (0xCFC/4)
+#define GICD_NSACR      (0xE00/4)
+#define GICD_NSACRN     (0xEFC/4)
+#define GICD_ICPIDR2    (0xFE8/4)
+#define GICD_SGIR       (0xF00/4)
+#define GICD_CPENDSGIR  (0xF10/4)
+#define GICD_CPENDSGIRN (0xF1C/4)
+#define GICD_SPENDSGIR  (0xF20/4)
+#define GICD_SPENDSGIRN (0xF2C/4)
+#define GICD_ICPIDR2    (0xFE8/4)
+
+#define GICC_CTLR       (0x0000/4)
+#define GICC_PMR        (0x0004/4)
+#define GICC_BPR        (0x0008/4)
+#define GICC_IAR        (0x000C/4)
+#define GICC_EOIR       (0x0010/4)
+#define GICC_RPR        (0x0014/4)
+#define GICC_HPPIR      (0x0018/4)
+#define GICC_APR        (0x00D0/4)
+#define GICC_NSAPR      (0x00E0/4)
+#define GICC_DIR        (0x1000/4)
+
+#define GICH_HCR        (0x00/4)
+#define GICH_VTR        (0x04/4)
+#define GICH_VMCR       (0x08/4)
+#define GICH_MISR       (0x10/4)
+#define GICH_EISR0      (0x20/4)
+#define GICH_EISR1      (0x24/4)
+#define GICH_ELRSR0     (0x30/4)
+#define GICH_ELRSR1     (0x34/4)
+#define GICH_APR        (0xF0/4)
+#define GICH_LR         (0x100/4)
+
+/* Register bits */
+#define GICD_CTL_ENABLE 0x1
+
+#define GICD_TYPE_LINES 0x01f
+#define GICD_TYPE_CPUS  0x0e0
+#define GICD_TYPE_SEC   0x400
+
+#define GICC_CTL_ENABLE 0x1
+#define GICC_CTL_EOI    (0x1 << 9)
+
+#define GICC_IA_IRQ     0x03ff
+#define GICC_IA_CPU     0x1c00
+
+#define GICH_HCR_EN       (1 << 0)
+#define GICH_HCR_UIE      (1 << 1)
+#define GICH_HCR_LRENPIE  (1 << 2)
+#define GICH_HCR_NPIE     (1 << 3)
+#define GICH_HCR_VGRP0EIE (1 << 4)
+#define GICH_HCR_VGRP0DIE (1 << 5)
+#define GICH_HCR_VGRP1EIE (1 << 6)
+#define GICH_HCR_VGRP1DIE (1 << 7)
+
+#define GICH_MISR_EOI     (1 << 0)
+#define GICH_MISR_U       (1 << 1)
+#define GICH_MISR_LRENP   (1 << 2)
+#define GICH_MISR_NP      (1 << 3)
+#define GICH_MISR_VGRP0E  (1 << 4)
+#define GICH_MISR_VGRP0D  (1 << 5)
+#define GICH_MISR_VGRP1E  (1 << 6)
+#define GICH_MISR_VGRP1D  (1 << 7)
+
+#define GICH_LR_VIRTUAL_MASK    0x3ff
+#define GICH_LR_VIRTUAL_SHIFT   0
+#define GICH_LR_PHYSICAL_MASK   0x3ff
+#define GICH_LR_PHYSICAL_SHIFT  10
+#define GICH_LR_STATE_MASK      0x3
+#define GICH_LR_STATE_SHIFT     28
+#define GICH_LR_PRIORITY_SHIFT  23
+#define GICH_LR_MAINTENANCE_IRQ (1<<19)
+#define GICH_LR_PENDING         (1<<28)
+#define GICH_LR_ACTIVE          (1<<29)
+#define GICH_LR_GRP1            (1<<30)
+#define GICH_LR_HW              (1<<31)
+#define GICH_LR_CPUID_SHIFT     9
+#define GICH_VTR_NRLRGS         0x3f
+
+extern struct pending_irq *irq_to_pending(struct vcpu *v, unsigned int irq);
+
+extern void gic_route_irqs(void);
+
+extern void __cpuinit init_maintenance_interrupt(void);
+extern void gic_set_guest_irq(unsigned int irq,
+        unsigned int state, unsigned int priority);
+extern void gic_inject_irq_start(void);
+extern void gic_inject_irq_stop(void);
+extern int gic_route_irq_to_guest(struct domain *d, unsigned int irq,
+                                  const char * devname);
+
+/* Accept an interrupt from the GIC and dispatch its handler */
+extern void gic_interrupt(struct cpu_user_regs *regs, int is_fiq);
+/* Bring up the interrupt controller */
+extern void gic_init(void);
+/* setup the gic virtual interface for a guest */
+extern void gicv_setup(struct domain *d);
+#endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:43 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQM-00065X-5h; Thu, 09 Feb 2012 16:00:42 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQJ-00060K-GP
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:39 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1328803231!12716598!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17042 invoked from network); 9 Feb 2012 16:00:32 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:32 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQB-0004PO-Lb
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:31 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQB-000696-5V
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:31 +0000
Message-Id: <E1RvWQB-000696-5V@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:30 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: irq
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787210 0
# Node ID ac9edea95835be288e6043be8710171cb1fa060f
# Parent  e267c40ab2782dec0dc7cf2b1e822ac1b27d37a9
arm: irq

A simple do_IRQ and request_irq implementation for ARM.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r e267c40ab278 -r ac9edea95835 xen/arch/arm/irq.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/irq.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,179 @@
+/*
+ * xen/arch/arm/irq.c
+ *
+ * ARM Interrupt support
+ *
+ * Ian Campbell <ian.campbell@citrix.com>
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <xen/config.h>
+#include <xen/lib.h>
+#include <xen/spinlock.h>
+#include <xen/irq.h>
+#include <xen/init.h>
+#include <xen/errno.h>
+#include <xen/sched.h>
+
+#include "gic.h"
+
+static void enable_none(struct irq_desc *irq) { }
+static unsigned int startup_none(struct irq_desc *irq) { return 0; }
+static void disable_none(struct irq_desc *irq) { }
+static void ack_none(struct irq_desc *irq)
+{
+    printk("unexpected IRQ trap at irq %02x\n", irq->irq);
+}
+
+#define shutdown_none   disable_none
+#define end_none        enable_none
+
+hw_irq_controller no_irq_type = {
+    .typename = "none",
+    .startup = startup_none,
+    .shutdown = shutdown_none,
+    .enable = enable_none,
+    .disable = disable_none,
+    .ack = ack_none,
+    .end = end_none
+};
+
+int __init arch_init_one_irq_desc(struct irq_desc *desc)
+{
+    return 0;
+}
+
+
+static int __init init_irq_data(void)
+{
+    int irq;
+
+    for (irq = 0; irq < NR_IRQS; irq++) {
+        struct irq_desc *desc = irq_to_desc(irq);
+        init_one_irq_desc(desc);
+        desc->irq = irq;
+        desc->action  = NULL;
+    }
+    return 0;
+}
+
+void __init init_IRQ(void)
+{
+    BUG_ON(init_irq_data() < 0);
+}
+
+int __init request_irq(unsigned int irq,
+        void (*handler)(int, void *, struct cpu_user_regs *),
+        unsigned long irqflags, const char * devname, void *dev_id)
+{
+    struct irqaction *action;
+    int retval;
+
+    /*
+     * Sanity-check: shared interrupts must pass in a real dev-ID,
+     * otherwise we'll have trouble later trying to figure out
+     * which interrupt is which (messes up the interrupt freeing
+     * logic etc).
+     */
+    if (irq >= nr_irqs)
+        return -EINVAL;
+    if (!handler)
+        return -EINVAL;
+
+    action = xmalloc(struct irqaction);
+    if (!action)
+        return -ENOMEM;
+
+    action->handler = handler;
+    action->name = devname;
+    action->dev_id = dev_id;
+    action->free_on_release = 1;
+
+    retval = setup_irq(irq, action);
+    if (retval)
+        xfree(action);
+
+    return retval;
+}
+
+/* Dispatch an interrupt */
+void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq)
+{
+    struct irq_desc *desc = irq_to_desc(irq);
+    struct irqaction *action = desc->action;
+
+    /* TODO: perfc_incr(irqs); */
+
+    /* TODO: this_cpu(irq_count)++; */
+
+    irq_enter();
+
+    spin_lock(&desc->lock);
+    desc->handler->ack(desc);
+
+    if ( action == NULL )
+    {
+        printk("Unknown %s %#3.3x\n",
+               is_fiq ? "FIQ" : "IRQ", irq);
+        goto out;
+    }
+
+    if ( desc->status & IRQ_GUEST )
+    {
+        struct domain *d = action->dev_id;
+
+        desc->handler->end(desc);
+
+        desc->status |= IRQ_INPROGRESS;
+
+        /* XXX: inject irq into the guest */
+        goto out_no_end;
+    }
+
+    desc->status |= IRQ_PENDING;
+
+    /*
+     * Since we set PENDING, if another processor is handling a different
+     * instance of this same irq, the other processor will take care of it.
+     */
+    if ( desc->status & (IRQ_DISABLED | IRQ_INPROGRESS) )
+        goto out;
+
+    desc->status |= IRQ_INPROGRESS;
+
+    action = desc->action;
+    while ( desc->status & IRQ_PENDING )
+    {
+        desc->status &= ~IRQ_PENDING;
+        spin_unlock_irq(&desc->lock);
+        action->handler(irq, action->dev_id, regs);
+        spin_lock_irq(&desc->lock);
+    }
+
+    desc->status &= ~IRQ_INPROGRESS;
+
+out:
+    desc->handler->end(desc);
+out_no_end:
+    spin_unlock(&desc->lock);
+    irq_exit();
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e267c40ab278 -r ac9edea95835 xen/include/asm-arm/irq.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/irq.h	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,30 @@
+#ifndef _ASM_HW_IRQ_H
+#define _ASM_HW_IRQ_H
+
+#include <xen/config.h>
+
+#define NR_VECTORS 256 /* XXX */
+
+typedef struct {
+    DECLARE_BITMAP(_bits,NR_VECTORS);
+} vmask_t;
+
+struct arch_pirq
+{
+};
+
+struct irq_cfg {
+#define arch_irq_desc irq_cfg
+};
+
+void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq);
+
+#endif /* _ASM_HW_IRQ_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e267c40ab278 -r ac9edea95835 xen/include/asm-arm/setup.h
--- a/xen/include/asm-arm/setup.h	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/include/asm-arm/setup.h	Thu Feb 09 11:33:30 2012 +0000
@@ -7,6 +7,8 @@
 
 int construct_dom0(struct domain *d);
 
+void init_IRQ(void);
+
 #endif
 /*
  * Local variables:
diff -r e267c40ab278 -r ac9edea95835 xen/include/xen/irq.h
--- a/xen/include/xen/irq.h	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/include/xen/irq.h	Thu Feb 09 11:33:30 2012 +0000
@@ -106,6 +106,19 @@
 
 #define request_irq(irq, handler, irqflags, devname, devid) \
     request_irq_vector(irq_to_vector(irq), handler, irqflags, devname, devid)
+
+#elif defined(__arm__)
+
+#define NR_IRQS		1024
+#define nr_irqs NR_IRQS
+extern irq_desc_t irq_desc[NR_IRQS];
+
+extern int setup_irq(unsigned int irq, struct irqaction *);
+extern void release_irq(unsigned int irq);
+extern int request_irq(unsigned int irq,
+               void (*handler)(int, void *, struct cpu_user_regs *),
+               unsigned long irqflags, const char * devname, void *dev_id);
+
 #else
 extern int setup_irq(unsigned int irq, struct irqaction *);
 extern void release_irq(unsigned int irq);

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:43 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQM-00065X-5h; Thu, 09 Feb 2012 16:00:42 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQJ-00060K-GP
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:39 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1328803231!12716598!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17042 invoked from network); 9 Feb 2012 16:00:32 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:32 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQB-0004PO-Lb
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:31 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQB-000696-5V
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:31 +0000
Message-Id: <E1RvWQB-000696-5V@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:30 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: irq
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787210 0
# Node ID ac9edea95835be288e6043be8710171cb1fa060f
# Parent  e267c40ab2782dec0dc7cf2b1e822ac1b27d37a9
arm: irq

A simple do_IRQ and request_irq implementation for ARM.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r e267c40ab278 -r ac9edea95835 xen/arch/arm/irq.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/irq.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,179 @@
+/*
+ * xen/arch/arm/irq.c
+ *
+ * ARM Interrupt support
+ *
+ * Ian Campbell <ian.campbell@citrix.com>
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <xen/config.h>
+#include <xen/lib.h>
+#include <xen/spinlock.h>
+#include <xen/irq.h>
+#include <xen/init.h>
+#include <xen/errno.h>
+#include <xen/sched.h>
+
+#include "gic.h"
+
+static void enable_none(struct irq_desc *irq) { }
+static unsigned int startup_none(struct irq_desc *irq) { return 0; }
+static void disable_none(struct irq_desc *irq) { }
+static void ack_none(struct irq_desc *irq)
+{
+    printk("unexpected IRQ trap at irq %02x\n", irq->irq);
+}
+
+#define shutdown_none   disable_none
+#define end_none        enable_none
+
+hw_irq_controller no_irq_type = {
+    .typename = "none",
+    .startup = startup_none,
+    .shutdown = shutdown_none,
+    .enable = enable_none,
+    .disable = disable_none,
+    .ack = ack_none,
+    .end = end_none
+};
+
+int __init arch_init_one_irq_desc(struct irq_desc *desc)
+{
+    return 0;
+}
+
+
+static int __init init_irq_data(void)
+{
+    int irq;
+
+    for (irq = 0; irq < NR_IRQS; irq++) {
+        struct irq_desc *desc = irq_to_desc(irq);
+        init_one_irq_desc(desc);
+        desc->irq = irq;
+        desc->action  = NULL;
+    }
+    return 0;
+}
+
+void __init init_IRQ(void)
+{
+    BUG_ON(init_irq_data() < 0);
+}
+
+int __init request_irq(unsigned int irq,
+        void (*handler)(int, void *, struct cpu_user_regs *),
+        unsigned long irqflags, const char * devname, void *dev_id)
+{
+    struct irqaction *action;
+    int retval;
+
+    /*
+     * Sanity-check: shared interrupts must pass in a real dev-ID,
+     * otherwise we'll have trouble later trying to figure out
+     * which interrupt is which (messes up the interrupt freeing
+     * logic etc).
+     */
+    if (irq >= nr_irqs)
+        return -EINVAL;
+    if (!handler)
+        return -EINVAL;
+
+    action = xmalloc(struct irqaction);
+    if (!action)
+        return -ENOMEM;
+
+    action->handler = handler;
+    action->name = devname;
+    action->dev_id = dev_id;
+    action->free_on_release = 1;
+
+    retval = setup_irq(irq, action);
+    if (retval)
+        xfree(action);
+
+    return retval;
+}
+
+/* Dispatch an interrupt */
+void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq)
+{
+    struct irq_desc *desc = irq_to_desc(irq);
+    struct irqaction *action = desc->action;
+
+    /* TODO: perfc_incr(irqs); */
+
+    /* TODO: this_cpu(irq_count)++; */
+
+    irq_enter();
+
+    spin_lock(&desc->lock);
+    desc->handler->ack(desc);
+
+    if ( action == NULL )
+    {
+        printk("Unknown %s %#3.3x\n",
+               is_fiq ? "FIQ" : "IRQ", irq);
+        goto out;
+    }
+
+    if ( desc->status & IRQ_GUEST )
+    {
+        struct domain *d = action->dev_id;
+
+        desc->handler->end(desc);
+
+        desc->status |= IRQ_INPROGRESS;
+
+        /* XXX: inject irq into the guest */
+        goto out_no_end;
+    }
+
+    desc->status |= IRQ_PENDING;
+
+    /*
+     * Since we set PENDING, if another processor is handling a different
+     * instance of this same irq, the other processor will take care of it.
+     */
+    if ( desc->status & (IRQ_DISABLED | IRQ_INPROGRESS) )
+        goto out;
+
+    desc->status |= IRQ_INPROGRESS;
+
+    action = desc->action;
+    while ( desc->status & IRQ_PENDING )
+    {
+        desc->status &= ~IRQ_PENDING;
+        spin_unlock_irq(&desc->lock);
+        action->handler(irq, action->dev_id, regs);
+        spin_lock_irq(&desc->lock);
+    }
+
+    desc->status &= ~IRQ_INPROGRESS;
+
+out:
+    desc->handler->end(desc);
+out_no_end:
+    spin_unlock(&desc->lock);
+    irq_exit();
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e267c40ab278 -r ac9edea95835 xen/include/asm-arm/irq.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/irq.h	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,30 @@
+#ifndef _ASM_HW_IRQ_H
+#define _ASM_HW_IRQ_H
+
+#include <xen/config.h>
+
+#define NR_VECTORS 256 /* XXX */
+
+typedef struct {
+    DECLARE_BITMAP(_bits,NR_VECTORS);
+} vmask_t;
+
+struct arch_pirq
+{
+};
+
+struct irq_cfg {
+#define arch_irq_desc irq_cfg
+};
+
+void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq);
+
+#endif /* _ASM_HW_IRQ_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e267c40ab278 -r ac9edea95835 xen/include/asm-arm/setup.h
--- a/xen/include/asm-arm/setup.h	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/include/asm-arm/setup.h	Thu Feb 09 11:33:30 2012 +0000
@@ -7,6 +7,8 @@
 
 int construct_dom0(struct domain *d);
 
+void init_IRQ(void);
+
 #endif
 /*
  * Local variables:
diff -r e267c40ab278 -r ac9edea95835 xen/include/xen/irq.h
--- a/xen/include/xen/irq.h	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/include/xen/irq.h	Thu Feb 09 11:33:30 2012 +0000
@@ -106,6 +106,19 @@
 
 #define request_irq(irq, handler, irqflags, devname, devid) \
     request_irq_vector(irq_to_vector(irq), handler, irqflags, devname, devid)
+
+#elif defined(__arm__)
+
+#define NR_IRQS		1024
+#define nr_irqs NR_IRQS
+extern irq_desc_t irq_desc[NR_IRQS];
+
+extern int setup_irq(unsigned int irq, struct irqaction *);
+extern void release_irq(unsigned int irq);
+extern int request_irq(unsigned int irq,
+               void (*handler)(int, void *, struct cpu_user_regs *),
+               unsigned long irqflags, const char * devname, void *dev_id);
+
 #else
 extern int setup_irq(unsigned int irq, struct irqaction *);
 extern void release_irq(unsigned int irq);

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:44 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQN-00066x-Bw; Thu, 09 Feb 2012 16:00:43 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQL-00065D-V5
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:42 +0000
Received: from [85.158.139.83:3199] by server-8.bemta-5.messagelabs.com id
	CD/BE-08951-9ADE33F4; Thu, 09 Feb 2012 16:00:41 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-182.messagelabs.com!1328803238!13861756!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10801 invoked from network); 9 Feb 2012 16:00:39 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:39 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQI-0004Pm-F8
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:38 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQH-0006CR-1T
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:38 +0000
Message-Id: <E1RvWQH-0006CR-1T@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:36 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: trap handlers
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787210 0
# Node ID 17e746636da434748b6f3e19a413e8ca08f24914
# Parent  d8d5dece1afdde05d176dd7bce414139d786fa4f
arm: trap handlers

Functions executed exiting from the guest and returning to the guest:
trap and hypercall handlers and leave_hypervisor_tail.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r d8d5dece1afd -r 17e746636da4 xen/arch/arm/traps.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/traps.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,609 @@
+/*
+ * xen/arch/arm/traps.c
+ *
+ * ARM Trap handlers
+ *
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <xen/config.h>
+#include <xen/init.h>
+#include <xen/string.h>
+#include <xen/version.h>
+#include <xen/smp.h>
+#include <xen/symbols.h>
+#include <xen/irq.h>
+#include <xen/lib.h>
+#include <xen/mm.h>
+#include <xen/errno.h>
+#include <xen/hypercall.h>
+#include <xen/softirq.h>
+#include <public/xen.h>
+#include <asm/regs.h>
+#include <asm/cpregs.h>
+
+#include "io.h"
+#include "vtimer.h"
+#include "gic.h"
+
+/* The base of the stack must always be double-word aligned, which means
+ * that both the kernel half of struct cpu_user_regs (which is pushed in
+ * entry.S) and struct cpu_info (which lives at the bottom of a Xen
+ * stack) must be doubleword-aligned in size.  */
+static inline void check_stack_alignment_constraints(void) {
+    BUILD_BUG_ON((sizeof (struct cpu_user_regs)) & 0x7);
+    BUILD_BUG_ON((offsetof(struct cpu_user_regs, r8_fiq)) & 0x7);
+    BUILD_BUG_ON((sizeof (struct cpu_info)) & 0x7);
+}
+
+static int debug_stack_lines = 20;
+integer_param("debug_stack_lines", debug_stack_lines);
+
+#define stack_words_per_line 8
+
+asmlinkage void __div0(void)
+{
+    printk("Division by zero in hypervisor.\n");
+    BUG();
+}
+
+/* XXX could/should be common code */
+static void print_xen_info(void)
+{
+    char taint_str[TAINT_STRING_MAX_LEN];
+    char debug = 'n';
+
+#ifndef NDEBUG
+    debug = 'y';
+#endif
+
+    printk("----[ Xen-%d.%d%s  x86_64  debug=%c  %s ]----\n",
+           xen_major_version(), xen_minor_version(), xen_extra_version(),
+           debug, print_tainted(taint_str));
+}
+
+static const char *decode_fsc(uint32_t fsc, int *level)
+{
+    const char *msg = NULL;
+
+    switch ( fsc & 0x3f )
+    {
+    case FSC_FLT_TRANS ... FSC_FLT_TRANS + 3:
+        msg = "Translation fault";
+        *level = fsc & FSC_LL_MASK;
+        break;
+    case FSC_FLT_ACCESS ... FSC_FLT_ACCESS + 3:
+        msg = "Access fault";
+        *level = fsc & FSC_LL_MASK;
+        break;
+    case FSC_FLT_PERM ... FSC_FLT_PERM + 3:
+        msg = "Permission fault";
+        *level = fsc & FSC_LL_MASK;
+        break;
+
+    case FSC_SEA:
+        msg = "Synchronous External Abort";
+        break;
+    case FSC_SPE:
+        msg = "Memory Access Synchronous Parity Error";
+        break;
+    case FSC_APE:
+        msg = "Memory Access Asynchronous Parity Error";
+        break;
+    case FSC_SEATT ... FSC_SEATT + 3:
+        msg = "Sync. Ext. Abort Translation Table";
+        *level = fsc & FSC_LL_MASK;
+        break;
+    case FSC_SPETT ... FSC_SPETT + 3:
+        msg = "Sync. Parity. Error Translation Table";
+        *level = fsc & FSC_LL_MASK;
+        break;
+    case FSC_AF:
+        msg = "Alignment Fault";
+        break;
+    case FSC_DE:
+        msg = "Debug Event";
+        break;
+
+    case FSC_LKD:
+        msg = "Implementation Fault: Lockdown Abort";
+        break;
+    case FSC_CPR:
+        msg = "Implementation Fault: Coprocossor Abort";
+        break;
+
+    default:
+        msg = "Unknown Failure";
+        break;
+    }
+    return msg;
+}
+
+static const char *fsc_level_str(int level)
+{
+    switch ( level )
+    {
+    case -1: return "";
+    case 1:  return " at level 1";
+    case 2:  return " at level 2";
+    case 3:  return " at level 3";
+    default: return " (level invalid)";
+    }
+}
+
+void panic_PAR(uint64_t par, const char *when)
+{
+    if ( par & PAR_F )
+    {
+        const char *msg;
+        int level = -1;
+        int stage = par & PAR_STAGE2 ? 2 : 1;
+        int second_in_first = !!(par & PAR_STAGE21);
+
+        msg = decode_fsc( (par&PAR_FSC_MASK) >> PAR_FSC_SHIFT, &level);
+
+        printk("PAR: %010"PRIx64": %s stage %d%s%s\n",
+               par, msg,
+               stage,
+               second_in_first ? " during second stage lookup" : "",
+               fsc_level_str(level));
+    }
+    else
+    {
+        printk("PAR: %010"PRIx64": paddr:%010"PRIx64
+               " attr %"PRIx64" sh %"PRIx64" %s\n",
+               par, par & PADDR_MASK, par >> PAR_MAIR_SHIFT,
+               (par & PAR_SH_MASK) >> PAR_SH_SHIFT,
+               (par & PAR_NS) ? "Non-Secure" : "Secure");
+    }
+    panic("Error during %s-to-physical address translation\n", when);
+}
+
+void show_registers(struct cpu_user_regs *regs)
+{
+    static const char *mode_strings[] = {
+       [PSR_MODE_USR] = "USR",
+       [PSR_MODE_FIQ] = "FIQ",
+       [PSR_MODE_IRQ] = "IRQ",
+       [PSR_MODE_SVC] = "SVC",
+       [PSR_MODE_MON] = "MON",
+       [PSR_MODE_ABT] = "ABT",
+       [PSR_MODE_HYP] = "HYP",
+       [PSR_MODE_UND] = "UND",
+       [PSR_MODE_SYS] = "SYS"
+    };
+
+    print_xen_info();
+    printk("CPU:    %d\n", smp_processor_id());
+    printk("PC:     %08"PRIx32, regs->pc);
+    if ( !guest_mode(regs) )
+            print_symbol(" %s", regs->pc);
+    printk("\n");
+    printk("CPSR:   %08"PRIx32" MODE:%s\n", regs->cpsr,
+           mode_strings[regs->cpsr & PSR_MODE_MASK]);
+    printk("     R0: %08"PRIx32" R1: %08"PRIx32" R2: %08"PRIx32" R3: %08"PRIx32"\n",
+           regs->r0, regs->r1, regs->r2, regs->r3);
+    printk("     R4: %08"PRIx32" R5: %08"PRIx32" R6: %08"PRIx32" R7: %08"PRIx32"\n",
+           regs->r4, regs->r5, regs->r6, regs->r7);
+    printk("     R8: %08"PRIx32" R9: %08"PRIx32" R10:%08"PRIx32" R11:%08"PRIx32" R12:%08"PRIx32"\n",
+           regs->r8, regs->r9, regs->r10, regs->r11, regs->r12);
+
+    if ( guest_mode(regs) )
+    {
+        printk("USR: SP: %08"PRIx32" LR: %08"PRIx32" CPSR:%08"PRIx32"\n",
+               regs->sp_usr, regs->lr_usr, regs->cpsr);
+        printk("SVC: SP: %08"PRIx32" LR: %08"PRIx32" SPSR:%08"PRIx32"\n",
+               regs->sp_svc, regs->lr_svc, regs->spsr_svc);
+        printk("ABT: SP: %08"PRIx32" LR: %08"PRIx32" SPSR:%08"PRIx32"\n",
+               regs->sp_abt, regs->lr_abt, regs->spsr_abt);
+        printk("UND: SP: %08"PRIx32" LR: %08"PRIx32" SPSR:%08"PRIx32"\n",
+               regs->sp_und, regs->lr_und, regs->spsr_und);
+        printk("IRQ: SP: %08"PRIx32" LR: %08"PRIx32" SPSR:%08"PRIx32"\n",
+               regs->sp_irq, regs->lr_irq, regs->spsr_irq);
+        printk("FIQ: SP: %08"PRIx32" LR: %08"PRIx32" SPSR:%08"PRIx32"\n",
+               regs->sp_fiq, regs->lr_fiq, regs->spsr_fiq);
+        printk("FIQ: R8: %08"PRIx32" R9: %08"PRIx32" R10:%08"PRIx32" R11:%08"PRIx32" R12:%08"PRIx32"\n",
+               regs->r8_fiq, regs->r9_fiq, regs->r10_fiq, regs->r11_fiq, regs->r11_fiq);
+        printk("\n");
+        printk("TTBR0 %08"PRIx32" TTBR1 %08"PRIx32" TTBCR %08"PRIx32"\n",
+               READ_CP32(TTBR0), READ_CP32(TTBR1), READ_CP32(TTBCR));
+        printk("SCTLR %08"PRIx32"\n", READ_CP32(SCTLR));
+        printk("VTTBR %010"PRIx64"\n", READ_CP64(VTTBR));
+        printk("\n");
+    }
+    else
+    {
+        printk("     SP: %08"PRIx32" LR: %08"PRIx32"\n", regs->sp, regs->lr);
+        printk("\n");
+    }
+
+    printk("HTTBR %"PRIx64"\n", READ_CP64(HTTBR));
+    printk("HDFAR %"PRIx32"\n", READ_CP32(HDFAR));
+    printk("HIFAR %"PRIx32"\n", READ_CP32(HIFAR));
+    printk("HPFAR %"PRIx32"\n", READ_CP32(HPFAR));
+    printk("HCR %08"PRIx32"\n", READ_CP32(HCR));
+    printk("HSR   %"PRIx32"\n", READ_CP32(HSR));
+    printk("\n");
+
+    printk("DFSR %"PRIx32" DFAR %"PRIx32"\n", READ_CP32(DFSR), READ_CP32(DFAR));
+    printk("IFSR %"PRIx32" IFAR %"PRIx32"\n", READ_CP32(IFSR), READ_CP32(IFAR));
+    printk("\n");
+}
+
+static void show_guest_stack(struct cpu_user_regs *regs)
+{
+    printk("GUEST STACK GOES HERE\n");
+}
+
+#define STACK_BEFORE_EXCEPTION(regs) ((uint32_t*)(regs)->sp)
+
+static void show_trace(struct cpu_user_regs *regs)
+{
+    uint32_t *frame, next, addr, low, high;
+
+    printk("Xen call trace:\n   ");
+
+    printk("[<%p>]", _p(regs->pc));
+    print_symbol(" %s\n   ", regs->pc);
+
+    /* Bounds for range of valid frame pointer. */
+    low  = (uint32_t)(STACK_BEFORE_EXCEPTION(regs)/* - 2*/);
+    high = (low & ~(STACK_SIZE - 1)) +
+        (STACK_SIZE - sizeof(struct cpu_info));
+
+    /* Frame:
+     * (largest address)
+     * | cpu_info
+     * | [...]                                   |
+     * | return addr      <-----------------,    |
+     * | fp --------------------------------+----'
+     * | [...]                              |
+     * | return addr      <------------,    |
+     * | fp ---------------------------+----'
+     * | [...]                         |
+     * | return addr      <- regs->fp  |
+     * | fp ---------------------------'
+     * |
+     * v (smallest address, sp)
+     */
+
+    /* The initial frame pointer. */
+    next = regs->fp;
+
+    for ( ; ; )
+    {
+        if ( (next < low) || (next >= high) )
+            break;
+        {
+            /* Ordinary stack frame. */
+            frame = (uint32_t *)next;
+            next  = frame[-1];
+            addr  = frame[0];
+        }
+
+        printk("[<%p>]", _p(addr));
+        print_symbol(" %s\n   ", addr);
+
+        low = (uint32_t)&frame[1];
+    }
+
+    printk("\n");
+}
+
+void show_stack(struct cpu_user_regs *regs)
+{
+    uint32_t *stack = STACK_BEFORE_EXCEPTION(regs), addr;
+    int i;
+
+    if ( guest_mode(regs) )
+        return show_guest_stack(regs);
+
+    printk("Xen stack trace from sp=%p:\n  ", stack);
+
+    for ( i = 0; i < (debug_stack_lines*stack_words_per_line); i++ )
+    {
+        if ( ((long)stack & (STACK_SIZE-BYTES_PER_LONG)) == 0 )
+            break;
+        if ( (i != 0) && ((i % stack_words_per_line) == 0) )
+            printk("\n  ");
+
+        addr = *stack++;
+        printk(" %p", _p(addr));
+    }
+    if ( i == 0 )
+        printk("Stack empty.");
+    printk("\n");
+
+    show_trace(regs);
+}
+
+void show_execution_state(struct cpu_user_regs *regs)
+{
+    show_registers(regs);
+    show_stack(regs);
+}
+
+static void do_unexpected_trap(const char *msg, struct cpu_user_regs *regs)
+{
+    printk("Unexpected Trap: %s\n", msg);
+    show_execution_state(regs);
+    while(1);
+}
+
+asmlinkage void do_trap_undefined_instruction(struct cpu_user_regs *regs)
+{
+    do_unexpected_trap("Undefined Instruction", regs);
+}
+
+asmlinkage void do_trap_supervisor_call(struct cpu_user_regs *regs)
+{
+    do_unexpected_trap("Supervisor Call", regs);
+}
+
+asmlinkage void do_trap_prefetch_abort(struct cpu_user_regs *regs)
+{
+    do_unexpected_trap("Prefetch Abort", regs);
+}
+
+asmlinkage void do_trap_data_abort(struct cpu_user_regs *regs)
+{
+    do_unexpected_trap("Data Abort", regs);
+}
+
+unsigned long do_arch_0(unsigned int cmd, unsigned long long value)
+{
+        printk("do_arch_0 cmd=%x arg=%llx\n", cmd, value);
+        return 0;
+}
+
+typedef unsigned long arm_hypercall_t(
+    unsigned int, unsigned int, unsigned int, unsigned int, unsigned int,
+    unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
+
+#define HYPERCALL(x)                                        \
+    [ __HYPERVISOR_ ## x ] = (arm_hypercall_t *) do_ ## x
+
+static arm_hypercall_t *arm_hypercall_table[] = {
+    HYPERCALL(arch_0),
+    HYPERCALL(sched_op),
+    HYPERCALL(console_io),
+};
+
+static void do_debug_trap(struct cpu_user_regs *regs, unsigned int code)
+{
+    uint32_t reg, *r;
+
+    switch ( code ) {
+    case 0xe0 ... 0xef:
+        reg = code - 0xe0;
+        r = &regs->r0 + reg;
+        printk("R%d = %#010"PRIx32" at %#010"PRIx32"\n", reg, *r, regs->pc);
+        break;
+    case 0xfd:
+        printk("Reached %08"PRIx32"\n", regs->pc);
+        break;
+    case 0xfe:
+        printk("%c", (char)(regs->r0 & 0xff));
+        break;
+    case 0xff:
+        printk("DEBUG\n");
+        show_execution_state(regs);
+        break;
+    default:
+        panic("Unhandled debug trap %#x\n", code);
+        break;
+    }
+}
+
+static void do_trap_hypercall(struct cpu_user_regs *regs, unsigned long iss)
+{
+    local_irq_enable();
+
+    regs->r0 = arm_hypercall_table[iss](regs->r0,
+                             regs->r1,
+                             regs->r2,
+                             regs->r3,
+                             regs->r4,
+                             regs->r5,
+                             regs->r6,
+                             regs->r7,
+                             regs->r8,
+                             regs->r9);
+}
+
+static void do_cp15_32(struct cpu_user_regs *regs,
+                       union hsr hsr)
+{
+    struct hsr_cp32 cp32 = hsr.cp32;
+    uint32_t *r = &regs->r0 + cp32.reg;
+
+    if ( !cp32.ccvalid ) {
+        dprintk(XENLOG_ERR, "cp_15(32): need to handle invalid condition codes\n");
+        domain_crash_synchronous();
+    }
+    if ( cp32.cc != 0xe ) {
+        dprintk(XENLOG_ERR, "cp_15(32): need to handle condition codes %x\n",
+                cp32.cc);
+        domain_crash_synchronous();
+    }
+
+    switch ( hsr.bits & HSR_CP32_REGS_MASK )
+    {
+    case HSR_CPREG32(CLIDR):
+        if ( !cp32.read )
+        {
+            dprintk(XENLOG_ERR,
+                    "attempt to write to read-only register CLIDR\n");
+            domain_crash_synchronous();
+        }
+        *r = READ_CP32(CLIDR);
+        break;
+    case HSR_CPREG32(CCSIDR):
+        if ( !cp32.read )
+        {
+            dprintk(XENLOG_ERR,
+                    "attempt to write to read-only register CSSIDR\n");
+            domain_crash_synchronous();
+        }
+        *r = READ_CP32(CCSIDR);
+        break;
+    case HSR_CPREG32(DCCISW):
+        if ( cp32.read )
+        {
+            dprintk(XENLOG_ERR,
+                    "attempt to read from write-only register DCCISW\n");
+            domain_crash_synchronous();
+        }
+        WRITE_CP32(*r, DCCISW);
+        break;
+    case HSR_CPREG32(CNTP_CTL):
+    case HSR_CPREG32(CNTP_TVAL):
+        /* emulate timer */
+        break;
+    default:
+        printk("%s p15, %d, r%d, cr%d, cr%d, %d @ %#08x\n",
+               cp32.read ? "mrc" : "mcr",
+               cp32.op1, cp32.reg, cp32.crn, cp32.crm, cp32.op2, regs->pc);
+        panic("unhandled 32-bit CP15 access %#x\n", hsr.bits & HSR_CP32_REGS_MASK);
+    }
+    regs->pc += cp32.len ? 4 : 2;
+
+}
+
+static void do_cp15_64(struct cpu_user_regs *regs,
+                       union hsr hsr)
+{
+    struct hsr_cp64 cp64 = hsr.cp64;
+
+    if ( !cp64.ccvalid ) {
+        dprintk(XENLOG_ERR, "cp_15(64): need to handle invalid condition codes\n");
+        domain_crash_synchronous();
+    }
+    if ( cp64.cc != 0xe ) {
+        dprintk(XENLOG_ERR, "cp_15(64): need to handle condition codes %x\n",
+                cp64.cc);
+        domain_crash_synchronous();
+    }
+
+    switch ( hsr.bits & HSR_CP64_REGS_MASK )
+    {
+    case HSR_CPREG64(CNTPCT):
+        /* emulate timer */
+        break;
+    default:
+        printk("%s p15, %d, r%d, r%d, cr%d @ %#08x\n",
+               cp64.read ? "mrrc" : "mcrr",
+               cp64.op1, cp64.reg1, cp64.reg2, cp64.crm, regs->pc);
+        panic("unhandled 64-bit CP15 access %#x\n", hsr.bits & HSR_CP64_REGS_MASK);
+    }
+    regs->pc += cp64.len ? 4 : 2;
+
+}
+
+static void do_trap_data_abort_guest(struct cpu_user_regs *regs,
+                                     struct hsr_dabt dabt)
+{
+    const char *msg;
+    int level = -1;
+    mmio_info_t info;
+
+    if (dabt.s1ptw)
+        goto bad_data_abort;
+
+    info.dabt = dabt;
+    info.gva = READ_CP32(HDFAR);
+    info.gpa = gva_to_ipa(info.gva);
+
+    if (handle_mmio(&info))
+    {
+        regs->pc += dabt.len ? 4 : 2;
+        return;
+    }
+
+bad_data_abort:
+
+    msg = decode_fsc( dabt.dfsc, &level);
+
+    printk("Guest data abort: %s%s%s\n"
+           "    gva=%"PRIx32" gpa=%"PRIpaddr"\n",
+           msg, dabt.s1ptw ? " S2 during S1" : "",
+           fsc_level_str(level),
+           info.gva, info.gpa);
+    if (dabt.valid)
+        printk("    size=%d sign=%d write=%d reg=%d\n",
+               dabt.size, dabt.sign, dabt.write, dabt.reg);
+    else
+        printk("    instruction syndrome invalid\n");
+    printk("    eat=%d cm=%d s1ptw=%d dfsc=%d\n",
+           dabt.eat, dabt.cache, dabt.s1ptw, dabt.dfsc);
+
+    show_execution_state(regs);
+    panic("Unhandled guest data abort\n");
+}
+
+asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)
+{
+    union hsr hsr = { .bits = READ_CP32(HSR) };
+
+    switch (hsr.ec) {
+    case HSR_EC_CP15_32:
+        do_cp15_32(regs, hsr);
+        break;
+    case HSR_EC_CP15_64:
+        do_cp15_64(regs, hsr);
+        break;
+    case HSR_EC_HVC:
+        if ( (hsr.iss & 0xff00) == 0xff00 )
+            return do_debug_trap(regs, hsr.iss & 0x00ff);
+        do_trap_hypercall(regs, hsr.iss);
+        break;
+    case HSR_EC_DATA_ABORT_GUEST:
+        do_trap_data_abort_guest(regs, hsr.dabt);
+        break;
+    default:
+        printk("Hypervisor Trap. HSR=0x%x EC=0x%x IL=%x Syndrome=%"PRIx32"\n",
+               hsr.bits, hsr.ec, hsr.len, hsr.iss);
+        do_unexpected_trap("Hypervisor", regs);
+    }
+}
+
+asmlinkage void do_trap_irq(struct cpu_user_regs *regs)
+{
+    gic_interrupt(regs, 0);
+}
+
+asmlinkage void do_trap_fiq(struct cpu_user_regs *regs)
+{
+    gic_interrupt(regs, 1);
+}
+
+asmlinkage void leave_hypervisor_tail(void)
+{
+    while (1)
+    {
+        local_irq_disable();
+        if (!softirq_pending(smp_processor_id()))
+            return;
+        local_irq_enable();
+        do_softirq();
+    }
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:44 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQN-00066x-Bw; Thu, 09 Feb 2012 16:00:43 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQL-00065D-V5
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:42 +0000
Received: from [85.158.139.83:3199] by server-8.bemta-5.messagelabs.com id
	CD/BE-08951-9ADE33F4; Thu, 09 Feb 2012 16:00:41 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-182.messagelabs.com!1328803238!13861756!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10801 invoked from network); 9 Feb 2012 16:00:39 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:39 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQI-0004Pm-F8
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:38 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQH-0006CR-1T
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:38 +0000
Message-Id: <E1RvWQH-0006CR-1T@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:36 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: trap handlers
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787210 0
# Node ID 17e746636da434748b6f3e19a413e8ca08f24914
# Parent  d8d5dece1afdde05d176dd7bce414139d786fa4f
arm: trap handlers

Functions executed exiting from the guest and returning to the guest:
trap and hypercall handlers and leave_hypervisor_tail.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r d8d5dece1afd -r 17e746636da4 xen/arch/arm/traps.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/traps.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,609 @@
+/*
+ * xen/arch/arm/traps.c
+ *
+ * ARM Trap handlers
+ *
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <xen/config.h>
+#include <xen/init.h>
+#include <xen/string.h>
+#include <xen/version.h>
+#include <xen/smp.h>
+#include <xen/symbols.h>
+#include <xen/irq.h>
+#include <xen/lib.h>
+#include <xen/mm.h>
+#include <xen/errno.h>
+#include <xen/hypercall.h>
+#include <xen/softirq.h>
+#include <public/xen.h>
+#include <asm/regs.h>
+#include <asm/cpregs.h>
+
+#include "io.h"
+#include "vtimer.h"
+#include "gic.h"
+
+/* The base of the stack must always be double-word aligned, which means
+ * that both the kernel half of struct cpu_user_regs (which is pushed in
+ * entry.S) and struct cpu_info (which lives at the bottom of a Xen
+ * stack) must be doubleword-aligned in size.  */
+static inline void check_stack_alignment_constraints(void) {
+    BUILD_BUG_ON((sizeof (struct cpu_user_regs)) & 0x7);
+    BUILD_BUG_ON((offsetof(struct cpu_user_regs, r8_fiq)) & 0x7);
+    BUILD_BUG_ON((sizeof (struct cpu_info)) & 0x7);
+}
+
+static int debug_stack_lines = 20;
+integer_param("debug_stack_lines", debug_stack_lines);
+
+#define stack_words_per_line 8
+
+asmlinkage void __div0(void)
+{
+    printk("Division by zero in hypervisor.\n");
+    BUG();
+}
+
+/* XXX could/should be common code */
+static void print_xen_info(void)
+{
+    char taint_str[TAINT_STRING_MAX_LEN];
+    char debug = 'n';
+
+#ifndef NDEBUG
+    debug = 'y';
+#endif
+
+    printk("----[ Xen-%d.%d%s  x86_64  debug=%c  %s ]----\n",
+           xen_major_version(), xen_minor_version(), xen_extra_version(),
+           debug, print_tainted(taint_str));
+}
+
+static const char *decode_fsc(uint32_t fsc, int *level)
+{
+    const char *msg = NULL;
+
+    switch ( fsc & 0x3f )
+    {
+    case FSC_FLT_TRANS ... FSC_FLT_TRANS + 3:
+        msg = "Translation fault";
+        *level = fsc & FSC_LL_MASK;
+        break;
+    case FSC_FLT_ACCESS ... FSC_FLT_ACCESS + 3:
+        msg = "Access fault";
+        *level = fsc & FSC_LL_MASK;
+        break;
+    case FSC_FLT_PERM ... FSC_FLT_PERM + 3:
+        msg = "Permission fault";
+        *level = fsc & FSC_LL_MASK;
+        break;
+
+    case FSC_SEA:
+        msg = "Synchronous External Abort";
+        break;
+    case FSC_SPE:
+        msg = "Memory Access Synchronous Parity Error";
+        break;
+    case FSC_APE:
+        msg = "Memory Access Asynchronous Parity Error";
+        break;
+    case FSC_SEATT ... FSC_SEATT + 3:
+        msg = "Sync. Ext. Abort Translation Table";
+        *level = fsc & FSC_LL_MASK;
+        break;
+    case FSC_SPETT ... FSC_SPETT + 3:
+        msg = "Sync. Parity. Error Translation Table";
+        *level = fsc & FSC_LL_MASK;
+        break;
+    case FSC_AF:
+        msg = "Alignment Fault";
+        break;
+    case FSC_DE:
+        msg = "Debug Event";
+        break;
+
+    case FSC_LKD:
+        msg = "Implementation Fault: Lockdown Abort";
+        break;
+    case FSC_CPR:
+        msg = "Implementation Fault: Coprocossor Abort";
+        break;
+
+    default:
+        msg = "Unknown Failure";
+        break;
+    }
+    return msg;
+}
+
+static const char *fsc_level_str(int level)
+{
+    switch ( level )
+    {
+    case -1: return "";
+    case 1:  return " at level 1";
+    case 2:  return " at level 2";
+    case 3:  return " at level 3";
+    default: return " (level invalid)";
+    }
+}
+
+void panic_PAR(uint64_t par, const char *when)
+{
+    if ( par & PAR_F )
+    {
+        const char *msg;
+        int level = -1;
+        int stage = par & PAR_STAGE2 ? 2 : 1;
+        int second_in_first = !!(par & PAR_STAGE21);
+
+        msg = decode_fsc( (par&PAR_FSC_MASK) >> PAR_FSC_SHIFT, &level);
+
+        printk("PAR: %010"PRIx64": %s stage %d%s%s\n",
+               par, msg,
+               stage,
+               second_in_first ? " during second stage lookup" : "",
+               fsc_level_str(level));
+    }
+    else
+    {
+        printk("PAR: %010"PRIx64": paddr:%010"PRIx64
+               " attr %"PRIx64" sh %"PRIx64" %s\n",
+               par, par & PADDR_MASK, par >> PAR_MAIR_SHIFT,
+               (par & PAR_SH_MASK) >> PAR_SH_SHIFT,
+               (par & PAR_NS) ? "Non-Secure" : "Secure");
+    }
+    panic("Error during %s-to-physical address translation\n", when);
+}
+
+void show_registers(struct cpu_user_regs *regs)
+{
+    static const char *mode_strings[] = {
+       [PSR_MODE_USR] = "USR",
+       [PSR_MODE_FIQ] = "FIQ",
+       [PSR_MODE_IRQ] = "IRQ",
+       [PSR_MODE_SVC] = "SVC",
+       [PSR_MODE_MON] = "MON",
+       [PSR_MODE_ABT] = "ABT",
+       [PSR_MODE_HYP] = "HYP",
+       [PSR_MODE_UND] = "UND",
+       [PSR_MODE_SYS] = "SYS"
+    };
+
+    print_xen_info();
+    printk("CPU:    %d\n", smp_processor_id());
+    printk("PC:     %08"PRIx32, regs->pc);
+    if ( !guest_mode(regs) )
+            print_symbol(" %s", regs->pc);
+    printk("\n");
+    printk("CPSR:   %08"PRIx32" MODE:%s\n", regs->cpsr,
+           mode_strings[regs->cpsr & PSR_MODE_MASK]);
+    printk("     R0: %08"PRIx32" R1: %08"PRIx32" R2: %08"PRIx32" R3: %08"PRIx32"\n",
+           regs->r0, regs->r1, regs->r2, regs->r3);
+    printk("     R4: %08"PRIx32" R5: %08"PRIx32" R6: %08"PRIx32" R7: %08"PRIx32"\n",
+           regs->r4, regs->r5, regs->r6, regs->r7);
+    printk("     R8: %08"PRIx32" R9: %08"PRIx32" R10:%08"PRIx32" R11:%08"PRIx32" R12:%08"PRIx32"\n",
+           regs->r8, regs->r9, regs->r10, regs->r11, regs->r12);
+
+    if ( guest_mode(regs) )
+    {
+        printk("USR: SP: %08"PRIx32" LR: %08"PRIx32" CPSR:%08"PRIx32"\n",
+               regs->sp_usr, regs->lr_usr, regs->cpsr);
+        printk("SVC: SP: %08"PRIx32" LR: %08"PRIx32" SPSR:%08"PRIx32"\n",
+               regs->sp_svc, regs->lr_svc, regs->spsr_svc);
+        printk("ABT: SP: %08"PRIx32" LR: %08"PRIx32" SPSR:%08"PRIx32"\n",
+               regs->sp_abt, regs->lr_abt, regs->spsr_abt);
+        printk("UND: SP: %08"PRIx32" LR: %08"PRIx32" SPSR:%08"PRIx32"\n",
+               regs->sp_und, regs->lr_und, regs->spsr_und);
+        printk("IRQ: SP: %08"PRIx32" LR: %08"PRIx32" SPSR:%08"PRIx32"\n",
+               regs->sp_irq, regs->lr_irq, regs->spsr_irq);
+        printk("FIQ: SP: %08"PRIx32" LR: %08"PRIx32" SPSR:%08"PRIx32"\n",
+               regs->sp_fiq, regs->lr_fiq, regs->spsr_fiq);
+        printk("FIQ: R8: %08"PRIx32" R9: %08"PRIx32" R10:%08"PRIx32" R11:%08"PRIx32" R12:%08"PRIx32"\n",
+               regs->r8_fiq, regs->r9_fiq, regs->r10_fiq, regs->r11_fiq, regs->r11_fiq);
+        printk("\n");
+        printk("TTBR0 %08"PRIx32" TTBR1 %08"PRIx32" TTBCR %08"PRIx32"\n",
+               READ_CP32(TTBR0), READ_CP32(TTBR1), READ_CP32(TTBCR));
+        printk("SCTLR %08"PRIx32"\n", READ_CP32(SCTLR));
+        printk("VTTBR %010"PRIx64"\n", READ_CP64(VTTBR));
+        printk("\n");
+    }
+    else
+    {
+        printk("     SP: %08"PRIx32" LR: %08"PRIx32"\n", regs->sp, regs->lr);
+        printk("\n");
+    }
+
+    printk("HTTBR %"PRIx64"\n", READ_CP64(HTTBR));
+    printk("HDFAR %"PRIx32"\n", READ_CP32(HDFAR));
+    printk("HIFAR %"PRIx32"\n", READ_CP32(HIFAR));
+    printk("HPFAR %"PRIx32"\n", READ_CP32(HPFAR));
+    printk("HCR %08"PRIx32"\n", READ_CP32(HCR));
+    printk("HSR   %"PRIx32"\n", READ_CP32(HSR));
+    printk("\n");
+
+    printk("DFSR %"PRIx32" DFAR %"PRIx32"\n", READ_CP32(DFSR), READ_CP32(DFAR));
+    printk("IFSR %"PRIx32" IFAR %"PRIx32"\n", READ_CP32(IFSR), READ_CP32(IFAR));
+    printk("\n");
+}
+
+static void show_guest_stack(struct cpu_user_regs *regs)
+{
+    printk("GUEST STACK GOES HERE\n");
+}
+
+#define STACK_BEFORE_EXCEPTION(regs) ((uint32_t*)(regs)->sp)
+
+static void show_trace(struct cpu_user_regs *regs)
+{
+    uint32_t *frame, next, addr, low, high;
+
+    printk("Xen call trace:\n   ");
+
+    printk("[<%p>]", _p(regs->pc));
+    print_symbol(" %s\n   ", regs->pc);
+
+    /* Bounds for range of valid frame pointer. */
+    low  = (uint32_t)(STACK_BEFORE_EXCEPTION(regs)/* - 2*/);
+    high = (low & ~(STACK_SIZE - 1)) +
+        (STACK_SIZE - sizeof(struct cpu_info));
+
+    /* Frame:
+     * (largest address)
+     * | cpu_info
+     * | [...]                                   |
+     * | return addr      <-----------------,    |
+     * | fp --------------------------------+----'
+     * | [...]                              |
+     * | return addr      <------------,    |
+     * | fp ---------------------------+----'
+     * | [...]                         |
+     * | return addr      <- regs->fp  |
+     * | fp ---------------------------'
+     * |
+     * v (smallest address, sp)
+     */
+
+    /* The initial frame pointer. */
+    next = regs->fp;
+
+    for ( ; ; )
+    {
+        if ( (next < low) || (next >= high) )
+            break;
+        {
+            /* Ordinary stack frame. */
+            frame = (uint32_t *)next;
+            next  = frame[-1];
+            addr  = frame[0];
+        }
+
+        printk("[<%p>]", _p(addr));
+        print_symbol(" %s\n   ", addr);
+
+        low = (uint32_t)&frame[1];
+    }
+
+    printk("\n");
+}
+
+void show_stack(struct cpu_user_regs *regs)
+{
+    uint32_t *stack = STACK_BEFORE_EXCEPTION(regs), addr;
+    int i;
+
+    if ( guest_mode(regs) )
+        return show_guest_stack(regs);
+
+    printk("Xen stack trace from sp=%p:\n  ", stack);
+
+    for ( i = 0; i < (debug_stack_lines*stack_words_per_line); i++ )
+    {
+        if ( ((long)stack & (STACK_SIZE-BYTES_PER_LONG)) == 0 )
+            break;
+        if ( (i != 0) && ((i % stack_words_per_line) == 0) )
+            printk("\n  ");
+
+        addr = *stack++;
+        printk(" %p", _p(addr));
+    }
+    if ( i == 0 )
+        printk("Stack empty.");
+    printk("\n");
+
+    show_trace(regs);
+}
+
+void show_execution_state(struct cpu_user_regs *regs)
+{
+    show_registers(regs);
+    show_stack(regs);
+}
+
+static void do_unexpected_trap(const char *msg, struct cpu_user_regs *regs)
+{
+    printk("Unexpected Trap: %s\n", msg);
+    show_execution_state(regs);
+    while(1);
+}
+
+asmlinkage void do_trap_undefined_instruction(struct cpu_user_regs *regs)
+{
+    do_unexpected_trap("Undefined Instruction", regs);
+}
+
+asmlinkage void do_trap_supervisor_call(struct cpu_user_regs *regs)
+{
+    do_unexpected_trap("Supervisor Call", regs);
+}
+
+asmlinkage void do_trap_prefetch_abort(struct cpu_user_regs *regs)
+{
+    do_unexpected_trap("Prefetch Abort", regs);
+}
+
+asmlinkage void do_trap_data_abort(struct cpu_user_regs *regs)
+{
+    do_unexpected_trap("Data Abort", regs);
+}
+
+unsigned long do_arch_0(unsigned int cmd, unsigned long long value)
+{
+        printk("do_arch_0 cmd=%x arg=%llx\n", cmd, value);
+        return 0;
+}
+
+typedef unsigned long arm_hypercall_t(
+    unsigned int, unsigned int, unsigned int, unsigned int, unsigned int,
+    unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
+
+#define HYPERCALL(x)                                        \
+    [ __HYPERVISOR_ ## x ] = (arm_hypercall_t *) do_ ## x
+
+static arm_hypercall_t *arm_hypercall_table[] = {
+    HYPERCALL(arch_0),
+    HYPERCALL(sched_op),
+    HYPERCALL(console_io),
+};
+
+static void do_debug_trap(struct cpu_user_regs *regs, unsigned int code)
+{
+    uint32_t reg, *r;
+
+    switch ( code ) {
+    case 0xe0 ... 0xef:
+        reg = code - 0xe0;
+        r = &regs->r0 + reg;
+        printk("R%d = %#010"PRIx32" at %#010"PRIx32"\n", reg, *r, regs->pc);
+        break;
+    case 0xfd:
+        printk("Reached %08"PRIx32"\n", regs->pc);
+        break;
+    case 0xfe:
+        printk("%c", (char)(regs->r0 & 0xff));
+        break;
+    case 0xff:
+        printk("DEBUG\n");
+        show_execution_state(regs);
+        break;
+    default:
+        panic("Unhandled debug trap %#x\n", code);
+        break;
+    }
+}
+
+static void do_trap_hypercall(struct cpu_user_regs *regs, unsigned long iss)
+{
+    local_irq_enable();
+
+    regs->r0 = arm_hypercall_table[iss](regs->r0,
+                             regs->r1,
+                             regs->r2,
+                             regs->r3,
+                             regs->r4,
+                             regs->r5,
+                             regs->r6,
+                             regs->r7,
+                             regs->r8,
+                             regs->r9);
+}
+
+static void do_cp15_32(struct cpu_user_regs *regs,
+                       union hsr hsr)
+{
+    struct hsr_cp32 cp32 = hsr.cp32;
+    uint32_t *r = &regs->r0 + cp32.reg;
+
+    if ( !cp32.ccvalid ) {
+        dprintk(XENLOG_ERR, "cp_15(32): need to handle invalid condition codes\n");
+        domain_crash_synchronous();
+    }
+    if ( cp32.cc != 0xe ) {
+        dprintk(XENLOG_ERR, "cp_15(32): need to handle condition codes %x\n",
+                cp32.cc);
+        domain_crash_synchronous();
+    }
+
+    switch ( hsr.bits & HSR_CP32_REGS_MASK )
+    {
+    case HSR_CPREG32(CLIDR):
+        if ( !cp32.read )
+        {
+            dprintk(XENLOG_ERR,
+                    "attempt to write to read-only register CLIDR\n");
+            domain_crash_synchronous();
+        }
+        *r = READ_CP32(CLIDR);
+        break;
+    case HSR_CPREG32(CCSIDR):
+        if ( !cp32.read )
+        {
+            dprintk(XENLOG_ERR,
+                    "attempt to write to read-only register CSSIDR\n");
+            domain_crash_synchronous();
+        }
+        *r = READ_CP32(CCSIDR);
+        break;
+    case HSR_CPREG32(DCCISW):
+        if ( cp32.read )
+        {
+            dprintk(XENLOG_ERR,
+                    "attempt to read from write-only register DCCISW\n");
+            domain_crash_synchronous();
+        }
+        WRITE_CP32(*r, DCCISW);
+        break;
+    case HSR_CPREG32(CNTP_CTL):
+    case HSR_CPREG32(CNTP_TVAL):
+        /* emulate timer */
+        break;
+    default:
+        printk("%s p15, %d, r%d, cr%d, cr%d, %d @ %#08x\n",
+               cp32.read ? "mrc" : "mcr",
+               cp32.op1, cp32.reg, cp32.crn, cp32.crm, cp32.op2, regs->pc);
+        panic("unhandled 32-bit CP15 access %#x\n", hsr.bits & HSR_CP32_REGS_MASK);
+    }
+    regs->pc += cp32.len ? 4 : 2;
+
+}
+
+static void do_cp15_64(struct cpu_user_regs *regs,
+                       union hsr hsr)
+{
+    struct hsr_cp64 cp64 = hsr.cp64;
+
+    if ( !cp64.ccvalid ) {
+        dprintk(XENLOG_ERR, "cp_15(64): need to handle invalid condition codes\n");
+        domain_crash_synchronous();
+    }
+    if ( cp64.cc != 0xe ) {
+        dprintk(XENLOG_ERR, "cp_15(64): need to handle condition codes %x\n",
+                cp64.cc);
+        domain_crash_synchronous();
+    }
+
+    switch ( hsr.bits & HSR_CP64_REGS_MASK )
+    {
+    case HSR_CPREG64(CNTPCT):
+        /* emulate timer */
+        break;
+    default:
+        printk("%s p15, %d, r%d, r%d, cr%d @ %#08x\n",
+               cp64.read ? "mrrc" : "mcrr",
+               cp64.op1, cp64.reg1, cp64.reg2, cp64.crm, regs->pc);
+        panic("unhandled 64-bit CP15 access %#x\n", hsr.bits & HSR_CP64_REGS_MASK);
+    }
+    regs->pc += cp64.len ? 4 : 2;
+
+}
+
+static void do_trap_data_abort_guest(struct cpu_user_regs *regs,
+                                     struct hsr_dabt dabt)
+{
+    const char *msg;
+    int level = -1;
+    mmio_info_t info;
+
+    if (dabt.s1ptw)
+        goto bad_data_abort;
+
+    info.dabt = dabt;
+    info.gva = READ_CP32(HDFAR);
+    info.gpa = gva_to_ipa(info.gva);
+
+    if (handle_mmio(&info))
+    {
+        regs->pc += dabt.len ? 4 : 2;
+        return;
+    }
+
+bad_data_abort:
+
+    msg = decode_fsc( dabt.dfsc, &level);
+
+    printk("Guest data abort: %s%s%s\n"
+           "    gva=%"PRIx32" gpa=%"PRIpaddr"\n",
+           msg, dabt.s1ptw ? " S2 during S1" : "",
+           fsc_level_str(level),
+           info.gva, info.gpa);
+    if (dabt.valid)
+        printk("    size=%d sign=%d write=%d reg=%d\n",
+               dabt.size, dabt.sign, dabt.write, dabt.reg);
+    else
+        printk("    instruction syndrome invalid\n");
+    printk("    eat=%d cm=%d s1ptw=%d dfsc=%d\n",
+           dabt.eat, dabt.cache, dabt.s1ptw, dabt.dfsc);
+
+    show_execution_state(regs);
+    panic("Unhandled guest data abort\n");
+}
+
+asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)
+{
+    union hsr hsr = { .bits = READ_CP32(HSR) };
+
+    switch (hsr.ec) {
+    case HSR_EC_CP15_32:
+        do_cp15_32(regs, hsr);
+        break;
+    case HSR_EC_CP15_64:
+        do_cp15_64(regs, hsr);
+        break;
+    case HSR_EC_HVC:
+        if ( (hsr.iss & 0xff00) == 0xff00 )
+            return do_debug_trap(regs, hsr.iss & 0x00ff);
+        do_trap_hypercall(regs, hsr.iss);
+        break;
+    case HSR_EC_DATA_ABORT_GUEST:
+        do_trap_data_abort_guest(regs, hsr.dabt);
+        break;
+    default:
+        printk("Hypervisor Trap. HSR=0x%x EC=0x%x IL=%x Syndrome=%"PRIx32"\n",
+               hsr.bits, hsr.ec, hsr.len, hsr.iss);
+        do_unexpected_trap("Hypervisor", regs);
+    }
+}
+
+asmlinkage void do_trap_irq(struct cpu_user_regs *regs)
+{
+    gic_interrupt(regs, 0);
+}
+
+asmlinkage void do_trap_fiq(struct cpu_user_regs *regs)
+{
+    gic_interrupt(regs, 1);
+}
+
+asmlinkage void leave_hypervisor_tail(void)
+{
+    while (1)
+    {
+        local_irq_disable();
+        if (!softirq_pending(smp_processor_id()))
+            return;
+        local_irq_enable();
+        do_softirq();
+    }
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:45 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQO-00068H-K2; Thu, 09 Feb 2012 16:00:44 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQM-00061w-TZ
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:43 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-216.messagelabs.com!1328803233!10806558!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32762 invoked from network); 9 Feb 2012 16:00:34 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:34 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQD-0004PR-Pe
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:33 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQC-00069g-BA
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:33 +0000
Message-Id: <E1RvWQC-00069g-BA@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:31 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: mm and p2m
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787210 0
# Node ID c69ed5c72f52d48e2594e314282cadb9c4ebb699
# Parent  ac9edea95835be288e6043be8710171cb1fa060f
arm: mm and p2m

Functions to setup pagetables, handle the p2m, map and unmap domain
pages, copy data to/from guest addresses.
The implementation is based on the LPAE extension for ARMv7 and makes
use of the two level transtion mechanism.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r ac9edea95835 -r c69ed5c72f52 xen/arch/arm/domain.c
--- a/xen/arch/arm/domain.c	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/arch/arm/domain.c	Thu Feb 09 11:33:30 2012 +0000
@@ -224,6 +224,10 @@
 {
     int rc;
 
+    rc = -ENOMEM;
+    if ( (rc = p2m_init(d)) != 0 )
+        goto fail;
+
     d->max_vcpus = 8;
 
     rc = 0;
diff -r ac9edea95835 -r c69ed5c72f52 xen/arch/arm/guestcopy.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/guestcopy.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,81 @@
+#include <xen/config.h>
+#include <xen/lib.h>
+#include <xen/domain_page.h>
+
+#include <asm/mm.h>
+#include <asm/guest_access.h>
+
+unsigned long raw_copy_to_guest(void *to, const void *from, unsigned len)
+{
+    /* XXX needs to handle faults */
+    unsigned offset = ((unsigned long)to & ~PAGE_MASK);
+
+    while ( len )
+    {
+        paddr_t g = gvirt_to_maddr((uint32_t) to);
+        void *p = map_domain_page(g>>PAGE_SHIFT);
+        unsigned size = min(len, (unsigned)PAGE_SIZE - offset);
+
+        p += offset;
+        memcpy(p, from, size);
+
+        unmap_domain_page(p - offset);
+        len -= size;
+        from += size;
+        to += size;
+        offset = 0;
+    }
+
+    return 0;
+}
+
+unsigned long raw_clear_guest(void *to, unsigned len)
+{
+    /* XXX needs to handle faults */
+    unsigned offset = ((unsigned long)to & ~PAGE_MASK);
+
+    while ( len )
+    {
+        paddr_t g = gvirt_to_maddr((uint32_t) to);
+        void *p = map_domain_page(g>>PAGE_SHIFT);
+        unsigned size = min(len, (unsigned)PAGE_SIZE - offset);
+
+        p += offset;
+        memset(p, 0x00, size);
+
+        unmap_domain_page(p - offset);
+        len -= size;
+        to += size;
+        offset = 0;
+    }
+
+    return 0;
+}
+
+unsigned long raw_copy_from_guest(void *to, const void __user *from, unsigned len)
+{
+    while ( len )
+    {
+        paddr_t g = gvirt_to_maddr((uint32_t) from & PAGE_MASK);
+        void *p = map_domain_page(g>>PAGE_SHIFT);
+        unsigned size = min(len, (unsigned)(PAGE_SIZE - ((unsigned)from & (~PAGE_MASK))));
+
+        p += ((unsigned long)from & (~PAGE_MASK));
+
+        memcpy(to, p, size);
+
+        unmap_domain_page(p);
+        len -= size;
+        from += size;
+        to += size;
+    }
+    return 0;
+}
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r ac9edea95835 -r c69ed5c72f52 xen/arch/arm/mm.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/mm.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,321 @@
+/*
+ * xen/arch/arm/mm.c
+ *
+ * MMU code for an ARMv7-A with virt extensions.
+ *
+ * Tim Deegan <tim@xen.org>
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <xen/config.h>
+#include <xen/compile.h>
+#include <xen/types.h>
+#include <xen/init.h>
+#include <xen/mm.h>
+#include <xen/preempt.h>
+#include <asm/page.h>
+#include <asm/current.h>
+
+struct domain *dom_xen, *dom_io;
+
+/* Static start-of-day pagetables that we use before the allocators are up */
+lpae_t xen_pgtable[LPAE_ENTRIES] __attribute__((__aligned__(4096)));
+lpae_t xen_second[LPAE_ENTRIES*4] __attribute__((__aligned__(4096*4)));
+static lpae_t xen_fixmap[LPAE_ENTRIES] __attribute__((__aligned__(4096)));
+static lpae_t xen_xenmap[LPAE_ENTRIES] __attribute__((__aligned__(4096)));
+
+/* Limits of the Xen heap */
+unsigned long xenheap_mfn_start, xenheap_mfn_end;
+unsigned long xenheap_virt_end;
+
+unsigned long frametable_virt_end;
+
+/* Map a 4k page in a fixmap entry */
+void set_fixmap(unsigned map, unsigned long mfn, unsigned attributes)
+{
+    lpae_t pte = mfn_to_xen_entry(mfn);
+    pte.pt.table = 1; /* 4k mappings always have this bit set */
+    pte.pt.ai = attributes;
+    write_pte(xen_fixmap + third_table_offset(FIXMAP_ADDR(map)), pte);
+    flush_xen_data_tlb_va(FIXMAP_ADDR(map));
+}
+
+/* Remove a mapping from a fixmap entry */
+void clear_fixmap(unsigned map)
+{
+    lpae_t pte = {0};
+    write_pte(xen_fixmap + third_table_offset(FIXMAP_ADDR(map)), pte);
+    flush_xen_data_tlb_va(FIXMAP_ADDR(map));
+}
+
+/* Map a page of domheap memory */
+void *map_domain_page(unsigned long mfn)
+{
+    unsigned long flags;
+    lpae_t *map = xen_second + second_linear_offset(DOMHEAP_VIRT_START);
+    unsigned long slot_mfn = mfn & ~LPAE_ENTRY_MASK;
+    uint32_t va;
+    lpae_t pte;
+    int i, slot;
+
+    local_irq_save(flags);
+
+    /* The map is laid out as an open-addressed hash table where each
+     * entry is a 2MB superpage pte.  We use the available bits of each
+     * PTE as a reference count; when the refcount is zero the slot can
+     * be reused. */
+    for ( slot = (slot_mfn >> LPAE_SHIFT) % DOMHEAP_ENTRIES, i = 0;
+          i < DOMHEAP_ENTRIES;
+          slot = (slot + 1) % DOMHEAP_ENTRIES, i++ )
+    {
+        if ( map[slot].pt.avail == 0 )
+        {
+            /* Commandeer this 2MB slot */
+            pte = mfn_to_xen_entry(slot_mfn);
+            pte.pt.avail = 1;
+            write_pte(map + slot, pte);
+            break;
+        }
+        else if ( map[slot].pt.avail < 0xf && map[slot].pt.base == slot_mfn )
+        {
+            /* This slot already points to the right place; reuse it */
+            map[slot].pt.avail++;
+            break;
+        }
+    }
+    /* If the map fills up, the callers have misbehaved. */
+    BUG_ON(i == DOMHEAP_ENTRIES);
+
+#ifndef NDEBUG
+    /* Searching the hash could get slow if the map starts filling up.
+     * Cross that bridge when we come to it */
+    {
+        static int max_tries = 32;
+        if ( i >= max_tries )
+        {
+            dprintk(XENLOG_WARNING, "Domheap map is filling: %i tries\n", i);
+            max_tries *= 2;
+        }
+    }
+#endif
+
+    local_irq_restore(flags);
+
+    va = (DOMHEAP_VIRT_START
+          + (slot << SECOND_SHIFT)
+          + ((mfn & LPAE_ENTRY_MASK) << THIRD_SHIFT));
+
+    /*
+     * We may not have flushed this specific subpage at map time,
+     * since we only flush the 4k page not the superpage
+     */
+    flush_xen_data_tlb_va(va);
+
+    return (void *)va;
+}
+
+/* Release a mapping taken with map_domain_page() */
+void unmap_domain_page(const void *va)
+{
+    unsigned long flags;
+    lpae_t *map = xen_second + second_linear_offset(DOMHEAP_VIRT_START);
+    int slot = ((unsigned long) va - DOMHEAP_VIRT_START) >> SECOND_SHIFT;
+
+    local_irq_save(flags);
+
+    ASSERT(slot >= 0 && slot < DOMHEAP_ENTRIES);
+    ASSERT(map[slot].pt.avail != 0);
+
+    map[slot].pt.avail--;
+
+    local_irq_restore(flags);
+}
+
+
+/* Boot-time pagetable setup.
+ * Changes here may need matching changes in head.S */
+void __init setup_pagetables(unsigned long boot_phys_offset)
+{
+    paddr_t xen_paddr, phys_offset;
+    unsigned long dest_va;
+    lpae_t pte, *p;
+    int i;
+
+    if ( boot_phys_offset != 0 )
+    {
+        /* Remove the old identity mapping of the boot paddr */
+        pte.bits = 0;
+        dest_va = (unsigned long)_start + boot_phys_offset;
+        write_pte(xen_second + second_linear_offset(dest_va), pte);
+    }
+
+    xen_paddr = XEN_PADDR;
+
+    /* Map the destination in the empty L2 above the fixmap */
+    dest_va = FIXMAP_ADDR(0) + (1u << SECOND_SHIFT);
+    pte = mfn_to_xen_entry(xen_paddr >> PAGE_SHIFT);
+    write_pte(xen_second + second_table_offset(dest_va), pte);
+
+    /* Calculate virt-to-phys offset for the new location */
+    phys_offset = xen_paddr - (unsigned long) _start;
+
+    /* Copy */
+    memcpy((void *) dest_va, _start, _end - _start);
+
+    /* Beware!  Any state we modify between now and the PT switch may be
+     * discarded when we switch over to the copy. */
+
+    /* Update the copy of xen_pgtable to use the new paddrs */
+    p = (void *) xen_pgtable + dest_va - (unsigned long) _start;
+    for ( i = 0; i < 4; i++)
+        p[i].pt.base += (phys_offset - boot_phys_offset) >> PAGE_SHIFT;
+    p = (void *) xen_second + dest_va - (unsigned long) _start;
+    for ( i = 0; i < 4 * LPAE_ENTRIES; i++)
+        if ( p[i].pt.valid )
+                p[i].pt.base += (phys_offset - boot_phys_offset) >> PAGE_SHIFT;
+
+    /* Change pagetables to the copy in the relocated Xen */
+    asm volatile (
+        STORE_CP64(0, HTTBR)          /* Change translation base */
+        "dsb;"                        /* Ensure visibility of HTTBR update */
+        STORE_CP32(0, TLBIALLH)       /* Flush hypervisor TLB */
+        STORE_CP32(0, BPIALL)         /* Flush branch predictor */
+        "dsb;"                        /* Ensure completion of TLB+BP flush */
+        "isb;"
+        : : "r" ((unsigned long) xen_pgtable + phys_offset) : "memory");
+
+    /* Undo the temporary map */
+    pte.bits = 0;
+    write_pte(xen_second + second_table_offset(dest_va), pte);
+    /*
+     * Have removed a mapping previously used for .text. Flush everything
+     * for safety.
+     */
+    asm volatile (
+        "dsb;"                        /* Ensure visibility of PTE write */
+        STORE_CP32(0, TLBIALLH)       /* Flush hypervisor TLB */
+        STORE_CP32(0, BPIALL)         /* Flush branch predictor */
+        "dsb;"                        /* Ensure completion of TLB+BP flush */
+        "isb;"
+        : : "r" (i /*dummy*/) : "memory");
+
+    /* Link in the fixmap pagetable */
+    pte = mfn_to_xen_entry((((unsigned long) xen_fixmap) + phys_offset)
+                           >> PAGE_SHIFT);
+    pte.pt.table = 1;
+    write_pte(xen_second + second_table_offset(FIXMAP_ADDR(0)), pte);
+    /*
+     * No flush required here. Individual flushes are done in
+     * set_fixmap as entries are used.
+     */
+
+    /* Break up the Xen mapping into 4k pages and protect them separately. */
+    for ( i = 0; i < LPAE_ENTRIES; i++ )
+    {
+        unsigned long mfn = paddr_to_pfn(xen_paddr) + i;
+        unsigned long va = XEN_VIRT_START + (i << PAGE_SHIFT);
+        if ( !is_kernel(va) )
+            break;
+        pte = mfn_to_xen_entry(mfn);
+        pte.pt.table = 1; /* 4k mappings always have this bit set */
+        if ( is_kernel_text(va) || is_kernel_inittext(va) )
+        {
+            pte.pt.xn = 0;
+            pte.pt.ro = 1;
+        }
+        if ( is_kernel_rodata(va) )
+            pte.pt.ro = 1;
+        write_pte(xen_xenmap + i, pte);
+        /* No flush required here as page table is not hooked in yet. */
+    }
+    pte = mfn_to_xen_entry((((unsigned long) xen_xenmap) + phys_offset)
+                           >> PAGE_SHIFT);
+    pte.pt.table = 1;
+    write_pte(xen_second + second_linear_offset(XEN_VIRT_START), pte);
+    /* Have changed a mapping used for .text. Flush everything for safety. */
+    asm volatile (
+        "dsb;"                        /* Ensure visibility of PTE write */
+        STORE_CP32(0, TLBIALLH)       /* Flush hypervisor TLB */
+        STORE_CP32(0, BPIALL)         /* Flush branch predictor */
+        "dsb;"                        /* Ensure completion of TLB+BP flush */
+        "isb;"
+        : : "r" (i /*dummy*/) : "memory");
+
+    /* From now on, no mapping may be both writable and executable. */
+    WRITE_CP32(READ_CP32(HSCTLR) | SCTLR_WXN, HSCTLR);
+}
+
+/* Create Xen's mappings of memory.
+ * Base and virt must be 32MB aligned and size a multiple of 32MB. */
+static void __init create_mappings(unsigned long virt,
+                                   unsigned long base_mfn,
+                                   unsigned long nr_mfns)
+{
+    unsigned long i, count;
+    lpae_t pte, *p;
+
+    ASSERT(!((virt >> PAGE_SHIFT) % (16 * LPAE_ENTRIES)));
+    ASSERT(!(base_mfn % (16 * LPAE_ENTRIES)));
+    ASSERT(!(nr_mfns % (16 * LPAE_ENTRIES)));
+
+    count = nr_mfns / LPAE_ENTRIES;
+    p = xen_second + second_linear_offset(virt);
+    pte = mfn_to_xen_entry(base_mfn);
+    pte.pt.hint = 1;  /* These maps are in 16-entry contiguous chunks. */
+    for ( i = 0; i < count; i++ )
+    {
+        write_pte(p + i, pte);
+        pte.pt.base += 1 << LPAE_SHIFT;
+    }
+    flush_xen_data_tlb();
+}
+
+/* Set up the xenheap: up to 1GB of contiguous, always-mapped memory. */
+void __init setup_xenheap_mappings(unsigned long base_mfn,
+                                   unsigned long nr_mfns)
+{
+    create_mappings(XENHEAP_VIRT_START, base_mfn, nr_mfns);
+
+    /* Record where the xenheap is, for translation routines. */
+    xenheap_virt_end = XENHEAP_VIRT_START + nr_mfns * PAGE_SIZE;
+    xenheap_mfn_start = base_mfn;
+    xenheap_mfn_end = base_mfn + nr_mfns;
+}
+
+/* Map a frame table to cover physical addresses ps through pe */
+void __init setup_frametable_mappings(paddr_t ps, paddr_t pe)
+{
+    unsigned long nr_pages = (pe - ps) >> PAGE_SHIFT;
+    unsigned long frametable_size = nr_pages * sizeof(struct page_info);
+    unsigned long base_mfn;
+
+    /* Round up to 32M boundary */
+    frametable_size = (frametable_size + 0x1ffffff) & ~0x1ffffff;
+    base_mfn = alloc_boot_pages(frametable_size >> PAGE_SHIFT, 5);
+    create_mappings(FRAMETABLE_VIRT_START, base_mfn, frametable_size >> PAGE_SHIFT);
+
+    memset(&frame_table[0], 0, nr_pages * sizeof(struct page_info));
+    memset(&frame_table[nr_pages], -1,
+           frametable_size - (nr_pages * sizeof(struct page_info)));
+
+    frametable_virt_end = FRAMETABLE_VIRT_START + (nr_pages * sizeof(struct page_info));
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r ac9edea95835 -r c69ed5c72f52 xen/arch/arm/p2m.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/p2m.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,214 @@
+#include <xen/config.h>
+#include <xen/sched.h>
+#include <xen/lib.h>
+#include <xen/errno.h>
+#include <xen/domain_page.h>
+
+void p2m_load_VTTBR(struct domain *d)
+{
+    struct p2m_domain *p2m = &d->arch.p2m;
+    paddr_t maddr = page_to_maddr(p2m->first_level);
+    uint64_t vttbr = maddr;
+
+    vttbr |= ((uint64_t)p2m->vmid&0xff)<<48;
+
+    printk("VTTBR dom%d = %"PRIx64"\n", d->domain_id, vttbr);
+
+    WRITE_CP64(vttbr, VTTBR);
+    isb(); /* Ensure update is visible */
+}
+
+static int p2m_create_entry(struct domain *d,
+                            lpae_t *entry)
+{
+    struct p2m_domain *p2m = &d->arch.p2m;
+    struct page_info *page;
+    void *p;
+    lpae_t pte;
+
+    BUG_ON(entry->p2m.valid);
+
+    page = alloc_domheap_page(d, 0);
+    if ( page == NULL )
+        return -ENOMEM;
+
+    page_list_add(page, &p2m->pages);
+
+    p = __map_domain_page(page);
+    clear_page(p);
+    unmap_domain_page(p);
+
+    pte = mfn_to_p2m_entry(page_to_mfn(page));
+
+    write_pte(entry, pte);
+
+    return 0;
+}
+
+static int create_p2m_entries(struct domain *d,
+                     int alloc,
+                     paddr_t start_gpaddr,
+                     paddr_t end_gpaddr,
+                     paddr_t maddr)
+{
+    int rc;
+    struct p2m_domain *p2m = &d->arch.p2m;
+    lpae_t *first = NULL, *second = NULL, *third = NULL;
+    paddr_t addr;
+    unsigned long cur_first_offset = ~0, cur_second_offset = ~0;
+
+    /* XXX Don't actually handle 40 bit guest physical addresses */
+    BUG_ON(start_gpaddr & 0x8000000000ULL);
+    BUG_ON(end_gpaddr   & 0x8000000000ULL);
+
+    first = __map_domain_page(p2m->first_level);
+
+    for(addr = start_gpaddr; addr < end_gpaddr; addr += PAGE_SIZE)
+    {
+        if ( !first[first_table_offset(addr)].p2m.valid )
+        {
+            rc = p2m_create_entry(d, &first[first_table_offset(addr)]);
+            if ( rc < 0 ) {
+                printk("p2m_populate_ram: L1 failed\n");
+                goto out;
+            }
+        }
+
+        BUG_ON(!first[first_table_offset(addr)].p2m.valid);
+
+        if ( cur_first_offset != first_table_offset(addr) )
+        {
+            if (second) unmap_domain_page(second);
+            second = map_domain_page(first[first_table_offset(addr)].p2m.base);
+            cur_first_offset = first_table_offset(addr);
+        }
+        /* else: second already valid */
+
+        if ( !second[second_table_offset(addr)].p2m.valid )
+        {
+            rc = p2m_create_entry(d, &second[second_table_offset(addr)]);
+            if ( rc < 0 ) {
+                printk("p2m_populate_ram: L2 failed\n");
+                goto out;
+            }
+        }
+
+        BUG_ON(!second[second_table_offset(addr)].p2m.valid);
+
+        if ( cur_second_offset != second_table_offset(addr) )
+        {
+            /* map third level */
+            if (third) unmap_domain_page(third);
+            third = map_domain_page(second[second_table_offset(addr)].p2m.base);
+            cur_second_offset = second_table_offset(addr);
+        }
+        /* else: third already valid */
+
+        BUG_ON(third[third_table_offset(addr)].p2m.valid);
+
+        /* Allocate a new RAM page and attach */
+        if (alloc)
+        {
+            struct page_info *page;
+            lpae_t pte;
+
+            rc = -ENOMEM;
+            page = alloc_domheap_page(d, 0);
+            if ( page == NULL ) {
+                printk("p2m_populate_ram: failed to allocate page\n");
+                goto out;
+            }
+
+            pte = mfn_to_p2m_entry(page_to_mfn(page));
+
+            write_pte(&third[third_table_offset(addr)], pte);
+        } else {
+            lpae_t pte = mfn_to_p2m_entry(maddr >> PAGE_SHIFT);
+            write_pte(&third[third_table_offset(addr)], pte);
+            maddr += PAGE_SIZE;
+        }
+    }
+
+    rc = 0;
+
+out:
+    spin_lock(&p2m->lock);
+
+    if (third) unmap_domain_page(third);
+    if (second) unmap_domain_page(second);
+    if (first) unmap_domain_page(first);
+
+    spin_unlock(&p2m->lock);
+
+    return rc;
+}
+
+int p2m_populate_ram(struct domain *d,
+                     paddr_t start,
+                     paddr_t end)
+{
+    return create_p2m_entries(d, 1, start, end, 0);
+}
+
+int map_mmio_regions(struct domain *d,
+                     paddr_t start_gaddr,
+                     paddr_t end_gaddr,
+                     paddr_t maddr)
+{
+    return create_p2m_entries(d, 0, start_gaddr, end_gaddr, maddr);
+}
+
+int p2m_alloc_table(struct domain *d)
+{
+    struct p2m_domain *p2m = &d->arch.p2m;
+    struct page_info *page;
+    void *p;
+
+    /* First level P2M is 2 consecutive pages */
+    page = alloc_domheap_pages(d, 1, 0);
+    if ( page == NULL )
+        return -ENOMEM;
+
+    spin_lock(&p2m->lock);
+
+    page_list_add(page, &p2m->pages);
+
+    /* Clear both first level pages */
+    p = __map_domain_page(page);
+    clear_page(p);
+    unmap_domain_page(p);
+
+    p = __map_domain_page(page + 1);
+    clear_page(p);
+    unmap_domain_page(p);
+
+    p2m->first_level = page;
+
+    spin_unlock(&p2m->lock);
+
+    return 0;
+}
+
+int p2m_init(struct domain *d)
+{
+    struct p2m_domain *p2m = &d->arch.p2m;
+
+    spin_lock_init(&p2m->lock);
+    INIT_PAGE_LIST_HEAD(&p2m->pages);
+
+    /* XXX allocate properly */
+    /* Zero is reserved */
+    p2m->vmid = d->domain_id + 1;
+
+    p2m->first_level = NULL;
+
+    return 0;
+}
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r ac9edea95835 -r c69ed5c72f52 xen/include/asm-arm/domain.h
--- a/xen/include/asm-arm/domain.h	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/include/asm-arm/domain.h	Thu Feb 09 11:33:30 2012 +0000
@@ -16,6 +16,8 @@
 
 struct arch_domain
 {
+    struct p2m_domain p2m;
+
 }  __cacheline_aligned;
 
 struct arch_vcpu
diff -r ac9edea95835 -r c69ed5c72f52 xen/include/asm-arm/guest_access.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/guest_access.h	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,131 @@
+#ifndef __ASM_ARM_GUEST_ACCESS_H__
+#define __ASM_ARM_GUEST_ACCESS_H__
+
+#include <xen/guest_access.h>
+#include <xen/errno.h>
+
+/* Guests have their own comlete address space */
+#define access_ok(addr,size) (1)
+
+#define array_access_ok(addr,count,size) \
+    (likely(count < (~0UL/size)) && access_ok(addr,count*size))
+
+unsigned long raw_copy_to_guest(void *to, const void *from, unsigned len);
+unsigned long raw_copy_from_guest(void *to, const void *from, unsigned len);
+unsigned long raw_clear_guest(void *to, unsigned len);
+
+#define __raw_copy_to_guest raw_copy_to_guest
+#define __raw_copy_from_guest raw_copy_from_guest
+#define __raw_clear_guest raw_clear_guest
+
+/* Remainder copied from x86 -- could be common? */
+
+/* Is the guest handle a NULL reference? */
+#define guest_handle_is_null(hnd)        ((hnd).p == NULL)
+
+/* Offset the given guest handle into the array it refers to. */
+#define guest_handle_add_offset(hnd, nr) ((hnd).p += (nr))
+#define guest_handle_subtract_offset(hnd, nr) ((hnd).p -= (nr))
+
+/* Cast a guest handle to the specified type of handle. */
+#define guest_handle_cast(hnd, type) ({         \
+    type *_x = (hnd).p;                         \
+    (XEN_GUEST_HANDLE(type)) { _x };            \
+})
+
+#define guest_handle_from_ptr(ptr, type)        \
+    ((XEN_GUEST_HANDLE(type)) { (type *)ptr })
+#define const_guest_handle_from_ptr(ptr, type)  \
+    ((XEN_GUEST_HANDLE(const_##type)) { (const type *)ptr })
+
+/*
+ * Copy an array of objects to guest context via a guest handle,
+ * specifying an offset into the guest array.
+ */
+#define copy_to_guest_offset(hnd, off, ptr, nr) ({      \
+    const typeof(*(ptr)) *_s = (ptr);                   \
+    char (*_d)[sizeof(*_s)] = (void *)(hnd).p;          \
+    ((void)((hnd).p == (ptr)));                         \
+    raw_copy_to_guest(_d+(off), _s, sizeof(*_s)*(nr));  \
+})
+
+/*
+ * Clear an array of objects in guest context via a guest handle,
+ * specifying an offset into the guest array.
+ */
+#define clear_guest_offset(hnd, off, ptr, nr) ({      \
+    raw_clear_guest(_d+(off), nr);  \
+})
+
+/*
+ * Copy an array of objects from guest context via a guest handle,
+ * specifying an offset into the guest array.
+ */
+#define copy_from_guest_offset(ptr, hnd, off, nr) ({    \
+    const typeof(*(ptr)) *_s = (hnd).p;                 \
+    typeof(*(ptr)) *_d = (ptr);                         \
+    raw_copy_from_guest(_d, _s+(off), sizeof(*_d)*(nr));\
+})
+
+/* Copy sub-field of a structure to guest context via a guest handle. */
+#define copy_field_to_guest(hnd, ptr, field) ({         \
+    const typeof(&(ptr)->field) _s = &(ptr)->field;     \
+    void *_d = &(hnd).p->field;                         \
+    ((void)(&(hnd).p->field == &(ptr)->field));         \
+    raw_copy_to_guest(_d, _s, sizeof(*_s));             \
+})
+
+/* Copy sub-field of a structure from guest context via a guest handle. */
+#define copy_field_from_guest(ptr, hnd, field) ({       \
+    const typeof(&(ptr)->field) _s = &(hnd).p->field;   \
+    typeof(&(ptr)->field) _d = &(ptr)->field;           \
+    raw_copy_from_guest(_d, _s, sizeof(*_d));           \
+})
+
+/*
+ * Pre-validate a guest handle.
+ * Allows use of faster __copy_* functions.
+ */
+/* All ARM guests are paging mode external and hence safe */
+#define guest_handle_okay(hnd, nr) (1)
+#define guest_handle_subrange_okay(hnd, first, last) (1)
+
+#define __copy_to_guest_offset(hnd, off, ptr, nr) ({    \
+    const typeof(*(ptr)) *_s = (ptr);                   \
+    char (*_d)[sizeof(*_s)] = (void *)(hnd).p;          \
+    ((void)((hnd).p == (ptr)));                         \
+    __raw_copy_to_guest(_d+(off), _s, sizeof(*_s)*(nr));\
+})
+
+#define __clear_guest_offset(hnd, off, ptr, nr) ({      \
+    __raw_clear_guest(_d+(off), nr);  \
+})
+
+#define __copy_from_guest_offset(ptr, hnd, off, nr) ({  \
+    const typeof(*(ptr)) *_s = (hnd).p;                 \
+    typeof(*(ptr)) *_d = (ptr);                         \
+    __raw_copy_from_guest(_d, _s+(off), sizeof(*_d)*(nr));\
+})
+
+#define __copy_field_to_guest(hnd, ptr, field) ({       \
+    const typeof(&(ptr)->field) _s = &(ptr)->field;     \
+    void *_d = &(hnd).p->field;                         \
+    ((void)(&(hnd).p->field == &(ptr)->field));         \
+    __raw_copy_to_guest(_d, _s, sizeof(*_s));           \
+})
+
+#define __copy_field_from_guest(ptr, hnd, field) ({     \
+    const typeof(&(ptr)->field) _s = &(hnd).p->field;   \
+    typeof(&(ptr)->field) _d = &(ptr)->field;           \
+    __raw_copy_from_guest(_d, _s, sizeof(*_d));         \
+})
+
+#endif /* __ASM_ARM_GUEST_ACCESS_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r ac9edea95835 -r c69ed5c72f52 xen/include/asm-arm/mm.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/mm.h	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,315 @@
+#ifndef __ARCH_ARM_MM__
+#define __ARCH_ARM_MM__
+
+#include <xen/config.h>
+#include <xen/kernel.h>
+#include <asm/page.h>
+#include <public/xen.h>
+
+/* Find a suitable place at the top of memory for Xen to live */
+/* XXX For now, use the top of the VE's 4GB RAM, at a 40-bit alias */
+#define XEN_PADDR 0x80ffe00000ull
+
+/*
+ * Per-page-frame information.
+ *
+ * Every architecture must ensure the following:
+ *  1. 'struct page_info' contains a 'struct page_list_entry list'.
+ *  2. Provide a PFN_ORDER() macro for accessing the order of a free page.
+ */
+#define PFN_ORDER(_pfn) ((_pfn)->v.free.order)
+
+struct page_info
+{
+    /* Each frame can be threaded onto a doubly-linked list. */
+    struct page_list_entry list;
+
+    /* Reference count and various PGC_xxx flags and fields. */
+    unsigned long count_info;
+
+    /* Context-dependent fields follow... */
+    union {
+        /* Page is in use: ((count_info & PGC_count_mask) != 0). */
+        struct {
+            /* Type reference count and various PGT_xxx flags and fields. */
+            unsigned long type_info;
+        } inuse;
+        /* Page is on a free list: ((count_info & PGC_count_mask) == 0). */
+        struct {
+            /* Do TLBs need flushing for safety before next page use? */
+            bool_t need_tlbflush;
+        } free;
+
+    } u;
+
+    union {
+        /* Page is in use, but not as a shadow. */
+        struct {
+            /* Owner of this page (zero if page is anonymous). */
+            struct domain *domain;
+        } inuse;
+
+        /* Page is on a free list. */
+        struct {
+            /* Order-size of the free chunk this page is the head of. */
+            unsigned int order;
+        } free;
+
+    } v;
+
+    union {
+        /*
+         * Timestamp from 'TLB clock', used to avoid extra safety flushes.
+         * Only valid for: a) free pages, and b) pages with zero type count
+         */
+        u32 tlbflush_timestamp;
+    };
+    u64 pad;
+};
+
+#define PG_shift(idx)   (BITS_PER_LONG - (idx))
+#define PG_mask(x, idx) (x ## UL << PG_shift(idx))
+
+#define PGT_none          PG_mask(0, 4)  /* no special uses of this page   */
+#define PGT_writable_page PG_mask(7, 4)  /* has writable mappings?         */
+#define PGT_shared_page   PG_mask(8, 4)  /* CoW sharable page              */
+#define PGT_type_mask     PG_mask(15, 4) /* Bits 28-31 or 60-63.           */
+
+ /* Owning guest has pinned this page to its current type? */
+#define _PGT_pinned       PG_shift(5)
+#define PGT_pinned        PG_mask(1, 5)
+
+ /* Count of uses of this frame as its current type. */
+#define PGT_count_width   PG_shift(9)
+#define PGT_count_mask    ((1UL<<PGT_count_width)-1)
+
+ /* Cleared when the owning guest 'frees' this page. */
+#define _PGC_allocated    PG_shift(1)
+#define PGC_allocated     PG_mask(1, 1)
+  /* Page is Xen heap? */
+#define _PGC_xen_heap     PG_shift(2)
+#define PGC_xen_heap      PG_mask(1, 2)
+/* ... */
+/* Page is broken? */
+#define _PGC_broken       PG_shift(7)
+#define PGC_broken        PG_mask(1, 7)
+ /* Mutually-exclusive page states: { inuse, offlining, offlined, free }. */
+#define PGC_state         PG_mask(3, 9)
+#define PGC_state_inuse   PG_mask(0, 9)
+#define PGC_state_offlining PG_mask(1, 9)
+#define PGC_state_offlined PG_mask(2, 9)
+#define PGC_state_free    PG_mask(3, 9)
+#define page_state_is(pg, st) (((pg)->count_info&PGC_state) == PGC_state_##st)
+
+/* Count of references to this frame. */
+#define PGC_count_width   PG_shift(9)
+#define PGC_count_mask    ((1UL<<PGC_count_width)-1)
+
+extern unsigned long xenheap_mfn_start, xenheap_mfn_end;
+extern unsigned long xenheap_virt_end;
+
+#define is_xen_heap_page(page) is_xen_heap_mfn(page_to_mfn(page))
+#define is_xen_heap_mfn(mfn) ({                                 \
+    unsigned long _mfn = (mfn);                                 \
+    (_mfn >= xenheap_mfn_start && _mfn < xenheap_mfn_end);      \
+})
+#define is_xen_fixed_mfn(mfn) is_xen_heap_mfn(mfn)
+
+#define page_get_owner(_p)    (_p)->v.inuse.domain
+#define page_set_owner(_p,_d) ((_p)->v.inuse.domain = (_d))
+
+#define maddr_get_owner(ma)   (page_get_owner(maddr_to_page((ma))))
+#define vaddr_get_owner(va)   (page_get_owner(virt_to_page((va))))
+
+#define XENSHARE_writable 0
+#define XENSHARE_readonly 1
+extern void share_xen_page_with_guest(
+    struct page_info *page, struct domain *d, int readonly);
+extern void share_xen_page_with_privileged_guests(
+    struct page_info *page, int readonly);
+
+#define frame_table ((struct page_info *)FRAMETABLE_VIRT_START)
+
+extern unsigned long max_page;
+extern unsigned long total_pages;
+
+/* Boot-time pagetable setup */
+extern void setup_pagetables(unsigned long boot_phys_offset);
+/* Set up the xenheap: up to 1GB of contiguous, always-mapped memory.
+ * Base must be 32MB aligned and size a multiple of 32MB. */
+extern void setup_xenheap_mappings(unsigned long base_mfn, unsigned long nr_mfns);
+/* Map a frame table to cover physical addresses ps through pe */
+extern void setup_frametable_mappings(paddr_t ps, paddr_t pe);
+/* Map a 4k page in a fixmap entry */
+extern void set_fixmap(unsigned map, unsigned long mfn, unsigned attributes);
+/* Remove a mapping from a fixmap entry */
+extern void clear_fixmap(unsigned map);
+
+
+#define mfn_valid(mfn)        ({                                              \
+    unsigned long __m_f_n = (mfn);                                            \
+    likely(__m_f_n < max_page);                                               \
+})
+
+#define max_pdx                 max_page
+/* XXX Assume everything in the 40-bit physical alias 0x8000000000 for now */
+#define pfn_to_pdx(pfn)         ((pfn) - 0x8000000UL)
+#define pdx_to_pfn(pdx)         ((pdx) + 0x8000000UL)
+#define virt_to_pdx(va)         virt_to_mfn(va)
+#define pdx_to_virt(pdx)        mfn_to_virt(pdx)
+
+/* Convert between machine frame numbers and page-info structures. */
+#define mfn_to_page(mfn)  (frame_table + pfn_to_pdx(mfn))
+#define page_to_mfn(pg)   pdx_to_pfn((unsigned long)((pg) - frame_table))
+#define __page_to_mfn(pg)  page_to_mfn(pg)
+#define __mfn_to_page(mfn) mfn_to_page(mfn)
+
+/* Convert between machine addresses and page-info structures. */
+#define maddr_to_page(ma) __mfn_to_page((ma) >> PAGE_SHIFT)
+#define page_to_maddr(pg) ((paddr_t)__page_to_mfn(pg) << PAGE_SHIFT)
+
+/* Convert between frame number and address formats.  */
+#define pfn_to_paddr(pfn) ((paddr_t)(pfn) << PAGE_SHIFT)
+#define paddr_to_pfn(pa)  ((unsigned long)((pa) >> PAGE_SHIFT))
+#define paddr_to_pdx(pa)    pfn_to_pdx(paddr_to_pfn(pa))
+
+
+static inline paddr_t virt_to_maddr(void *va)
+{
+    uint64_t par = va_to_par((uint32_t)va);
+    return (par & PADDR_MASK & PAGE_MASK) | ((unsigned long) va & ~PAGE_MASK);
+}
+
+static inline void *maddr_to_virt(paddr_t ma)
+{
+    ASSERT(is_xen_heap_mfn(ma >> PAGE_SHIFT));
+    ma -= pfn_to_paddr(xenheap_mfn_start);
+    return (void *)(unsigned long) ma + XENHEAP_VIRT_START;
+}
+
+static inline paddr_t gvirt_to_maddr(uint32_t va)
+{
+    uint64_t par = gva_to_par(va);
+    return (par & PADDR_MASK & PAGE_MASK) | ((unsigned long) va & ~PAGE_MASK);
+}
+
+/* Convert between Xen-heap virtual addresses and machine addresses. */
+#define __pa(x)             (virt_to_maddr(x))
+#define __va(x)             (maddr_to_virt(x))
+
+/* Convert between Xen-heap virtual addresses and machine frame numbers. */
+#define virt_to_mfn(va)   (virt_to_maddr(va) >> PAGE_SHIFT)
+#define mfn_to_virt(mfn)  (maddr_to_virt((paddr_t)(mfn) << PAGE_SHIFT))
+
+
+static inline int get_order_from_bytes(paddr_t size)
+{
+    int order;
+    size = (size-1) >> PAGE_SHIFT;
+    for ( order = 0; size; order++ )
+        size >>= 1;
+    return order;
+}
+
+static inline int get_order_from_pages(unsigned long nr_pages)
+{
+    int order;
+    nr_pages--;
+    for ( order = 0; nr_pages; order++ )
+        nr_pages >>= 1;
+    return order;
+}
+
+
+/* Convert between Xen-heap virtual addresses and page-info structures. */
+static inline struct page_info *virt_to_page(const void *v)
+{
+    unsigned long va = (unsigned long)v;
+    ASSERT(va >= XENHEAP_VIRT_START);
+    ASSERT(va < xenheap_virt_end);
+
+    return frame_table + ((va - XENHEAP_VIRT_START) >> PAGE_SHIFT);
+}
+
+static inline void *page_to_virt(const struct page_info *pg)
+{
+    ASSERT((unsigned long)pg - FRAMETABLE_VIRT_START < frametable_virt_end);
+    return (void *)(XENHEAP_VIRT_START +
+                    ((unsigned long)pg - FRAMETABLE_VIRT_START) /
+                    (sizeof(*pg) / (sizeof(*pg) & -sizeof(*pg))) *
+                    (PAGE_SIZE / (sizeof(*pg) & -sizeof(*pg))));
+
+}
+
+struct domain *page_get_owner_and_reference(struct page_info *page);
+void put_page(struct page_info *page);
+int  get_page(struct page_info *page, struct domain *domain);
+
+/*
+ * The MPT (machine->physical mapping table) is an array of word-sized
+ * values, indexed on machine frame number. It is expected that guest OSes
+ * will use it to store a "physical" frame number to give the appearance of
+ * contiguous (or near contiguous) physical memory.
+ */
+#undef  machine_to_phys_mapping
+#define machine_to_phys_mapping  ((unsigned long *)RDWR_MPT_VIRT_START)
+#define INVALID_M2P_ENTRY        (~0UL)
+#define VALID_M2P(_e)            (!((_e) & (1UL<<(BITS_PER_LONG-1))))
+#define SHARED_M2P_ENTRY         (~0UL - 1UL)
+#define SHARED_M2P(_e)           ((_e) == SHARED_M2P_ENTRY)
+
+#define _set_gpfn_from_mfn(mfn, pfn) ({                        \
+    struct domain *d = page_get_owner(__mfn_to_page(mfn));     \
+    if(d && (d == dom_cow))                                    \
+        machine_to_phys_mapping[(mfn)] = SHARED_M2P_ENTRY;     \
+    else                                                       \
+        machine_to_phys_mapping[(mfn)] = (pfn);                \
+    })
+
+#define put_gfn(d, g)   ((void)0)
+
+#define INVALID_MFN             (~0UL)
+
+/* Xen always owns P2M on ARM */
+#define set_gpfn_from_mfn(mfn, pfn) do { (void) (mfn), (void)(pfn); } while (0)
+#define mfn_to_gmfn(_d, mfn)  (mfn)
+
+
+/* Arch-specific portion of memory_op hypercall. */
+long arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg);
+
+int steal_page(
+    struct domain *d, struct page_info *page, unsigned int memflags);
+int donate_page(
+    struct domain *d, struct page_info *page, unsigned int memflags);
+
+#define domain_set_alloc_bitsize(d) ((void)0)
+#define domain_clamp_alloc_bitsize(d, b) (b)
+
+unsigned long domain_get_maximum_gpfn(struct domain *d);
+
+extern struct domain *dom_xen, *dom_io, *dom_cow;
+
+#define memguard_init(_s)              (_s)
+#define memguard_guard_stack(_p)       ((void)0)
+#define memguard_guard_range(_p,_l)    ((void)0)
+#define memguard_unguard_range(_p,_l)  ((void)0)
+int guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn,
+                                          unsigned int order);
+
+extern void put_page_type(struct page_info *page);
+static inline void put_page_and_type(struct page_info *page)
+{
+    put_page_type(page);
+    put_page(page);
+}
+
+#endif /*  __ARCH_ARM_MM__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r ac9edea95835 -r c69ed5c72f52 xen/include/asm-arm/p2m.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/p2m.h	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,88 @@
+#ifndef _XEN_P2M_H
+#define _XEN_P2M_H
+
+#include <xen/mm.h>
+
+struct domain;
+
+/* Per-p2m-table state */
+struct p2m_domain {
+    /* Lock that protects updates to the p2m */
+    spinlock_t lock;
+
+    /* Pages used to construct the p2m */
+    struct page_list_head pages;
+
+    /* Root of p2m page tables, 2 contiguous pages */
+    struct page_info *first_level;
+
+    /* Current VMID in use */
+    uint8_t vmid;
+};
+
+/* Init the datastructures for later use by the p2m code */
+int p2m_init(struct domain *d);
+
+/* Allocate a new p2m table for a domain.
+ *
+ * Returns 0 for success or -errno.
+ */
+int p2m_alloc_table(struct domain *d);
+
+/* */
+void p2m_load_VTTBR(struct domain *d);
+
+/* Setup p2m RAM mapping for domain d from start-end. */
+int p2m_populate_ram(struct domain *d, paddr_t start, paddr_t end);
+/* Map MMIO regions in the p2m: start_gaddr and end_gaddr is the range
+ * in the guest physical address space to map, starting from the machine
+ * address maddr. */
+int map_mmio_regions(struct domain *d, paddr_t start_gaddr,
+                     paddr_t end_gaddr, paddr_t maddr);
+
+unsigned long gmfn_to_mfn(struct domain *d, unsigned long gpfn);
+
+/*
+ * Populate-on-demand
+ */
+
+/* Call when decreasing memory reservation to handle PoD entries properly.
+ * Will return '1' if all entries were handled and nothing more need be done.*/
+int
+p2m_pod_decrease_reservation(struct domain *d,
+                             xen_pfn_t gpfn,
+                             unsigned int order);
+
+/* Compatibility function exporting the old untyped interface */
+static inline unsigned long get_gfn_untyped(struct domain *d, unsigned long gpfn)
+{
+    return gmfn_to_mfn(d, gpfn);
+}
+
+int get_page_type(struct page_info *page, unsigned long type);
+int is_iomem_page(unsigned long mfn);
+static inline int get_page_and_type(struct page_info *page,
+                                    struct domain *domain,
+                                    unsigned long type)
+{
+    int rc = get_page(page, domain);
+
+    if ( likely(rc) && unlikely(!get_page_type(page, type)) )
+    {
+        put_page(page);
+        rc = 0;
+    }
+
+    return rc;
+}
+
+#endif /* _XEN_P2M_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r ac9edea95835 -r c69ed5c72f52 xen/include/asm-arm/page.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/page.h	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,335 @@
+#ifndef __ARM_PAGE_H__
+#define __ARM_PAGE_H__
+
+#include <xen/config.h>
+
+#define PADDR_BITS              40
+#define PADDR_MASK              ((1ULL << PADDR_BITS)-1)
+
+#define VADDR_BITS              32
+#define VADDR_MASK              (~0UL)
+
+/* Shareability values for the LPAE entries */
+#define LPAE_SH_NON_SHAREABLE 0x0
+#define LPAE_SH_UNPREDICTALE  0x1
+#define LPAE_SH_OUTER         0x2
+#define LPAE_SH_INNER         0x3
+
+/* LPAE Memory region attributes, to match Linux's (non-LPAE) choices.
+ * Indexed by the AttrIndex bits of a LPAE entry;
+ * the 8-bit fields are packed little-endian into MAIR0 and MAIR1
+ *
+ *                 ai    encoding
+ *   UNCACHED      000   0000 0000  -- Strongly Ordered
+ *   BUFFERABLE    001   0100 0100  -- Non-Cacheable
+ *   WRITETHROUGH  010   1010 1010  -- Write-through
+ *   WRITEBACK     011   1110 1110  -- Write-back
+ *   DEV_SHARED    100   0000 0100  -- Device
+ *   ??            101
+ *   reserved      110
+ *   WRITEALLOC    111   1111 1111  -- Write-back write-allocate
+ *
+ *   DEV_NONSHARED 100   (== DEV_SHARED)
+ *   DEV_WC        001   (== BUFFERABLE)
+ *   DEV_CACHED    011   (== WRITEBACK)
+ */
+#define MAIR0VAL 0xeeaa4400
+#define MAIR1VAL 0xff000004
+
+#define UNCACHED      0x0
+#define BUFFERABLE    0x1
+#define WRITETHROUGH  0x2
+#define WRITEBACK     0x3
+#define DEV_SHARED    0x4
+#define WRITEALLOC    0x7
+#define DEV_NONSHARED DEV_SHARED
+#define DEV_WC        BUFFERABLE
+#define DEV_CACHED    WRITEBACK
+
+
+#ifndef __ASSEMBLY__
+
+#include <xen/types.h>
+#include <xen/lib.h>
+
+/* WARNING!  Unlike the Intel pagetable code, where l1 is the lowest
+ * level and l4 is the root of the trie, the ARM pagetables follow ARM's
+ * documentation: the levels are called first, second &c in the order
+ * that the MMU walks them (i.e. "first" is the root of the trie). */
+
+/******************************************************************************
+ * ARMv7-A LPAE pagetables: 3-level trie, mapping 40-bit input to
+ * 40-bit output addresses.  Tables at all levels have 512 64-bit entries
+ * (i.e. are 4Kb long).
+ *
+ * The bit-shuffling that has the permission bits in branch nodes in a
+ * different place from those in leaf nodes seems to be to allow linear
+ * pagetable tricks.  If we're not doing that then the set of permission
+ * bits that's not in use in a given node type can be used as
+ * extra software-defined bits. */
+
+typedef struct {
+    /* These are used in all kinds of entry. */
+    unsigned long valid:1;      /* Valid mapping */
+    unsigned long table:1;      /* == 1 in 4k map entries too */
+
+    /* These ten bits are only used in Block entries and are ignored
+     * in Table entries. */
+    unsigned long ai:3;         /* Attribute Index */
+    unsigned long ns:1;         /* Not-Secure */
+    unsigned long user:1;       /* User-visible */
+    unsigned long ro:1;         /* Read-Only */
+    unsigned long sh:2;         /* Shareability */
+    unsigned long af:1;         /* Access Flag */
+    unsigned long ng:1;         /* Not-Global */
+
+    /* The base address must be approprately aligned for Block entries */
+    unsigned long base:28;      /* Base address of block or next table */
+    unsigned long sbz:12;       /* Must be zero */
+
+    /* These seven bits are only used in Block entries and are ignored
+     * in Table entries. */
+    unsigned long hint:1;       /* In a block of 16 contiguous entries */
+    unsigned long pxn:1;        /* Privileged-XN */
+    unsigned long xn:1;         /* eXecute-Never */
+    unsigned long avail:4;      /* Ignored by hardware */
+
+    /* These 5 bits are only used in Table entries and are ignored in
+     * Block entries */
+    unsigned long pxnt:1;       /* Privileged-XN */
+    unsigned long xnt:1;        /* eXecute-Never */
+    unsigned long apt:2;        /* Access Permissions */
+    unsigned long nst:1;        /* Not-Secure */
+} __attribute__((__packed__)) lpae_pt_t;
+
+/* The p2m tables have almost the same layout, but some of the permission
+ * and cache-control bits are laid out differently (or missing) */
+typedef struct {
+    /* These are used in all kinds of entry. */
+    unsigned long valid:1;      /* Valid mapping */
+    unsigned long table:1;      /* == 1 in 4k map entries too */
+
+    /* These ten bits are only used in Block entries and are ignored
+     * in Table entries. */
+    unsigned long mattr:4;      /* Memory Attributes */
+    unsigned long read:1;       /* Read access */
+    unsigned long write:1;      /* Write access */
+    unsigned long sh:2;         /* Shareability */
+    unsigned long af:1;         /* Access Flag */
+    unsigned long sbz4:1;
+
+    /* The base address must be approprately aligned for Block entries */
+    unsigned long base:28;      /* Base address of block or next table */
+    unsigned long sbz3:12;
+
+    /* These seven bits are only used in Block entries and are ignored
+     * in Table entries. */
+    unsigned long hint:1;       /* In a block of 16 contiguous entries */
+    unsigned long sbz2:1;
+    unsigned long xn:1;         /* eXecute-Never */
+    unsigned long avail:4;      /* Ignored by hardware */
+
+    unsigned long sbz1:5;
+} __attribute__((__packed__)) lpae_p2m_t;
+
+typedef union {
+    uint64_t bits;
+    lpae_pt_t pt;
+    lpae_p2m_t p2m;
+} lpae_t;
+
+/* Standard entry type that we'll use to build Xen's own pagetables.
+ * We put the same permissions at every level, because they're ignored
+ * by the walker in non-leaf entries. */
+static inline lpae_t mfn_to_xen_entry(unsigned long mfn)
+{
+    paddr_t pa = ((paddr_t) mfn) << PAGE_SHIFT;
+    lpae_t e = (lpae_t) {
+        .pt = {
+            .xn = 1,              /* No need to execute outside .text */
+            .ng = 1,              /* Makes TLB flushes easier */
+            .af = 1,              /* No need for access tracking */
+            .sh = LPAE_SH_OUTER,  /* Xen mappings are globally coherent */
+            .ns = 1,              /* Hyp mode is in the non-secure world */
+            .user = 1,            /* See below */
+            .ai = WRITEALLOC,
+            .table = 0,           /* Set to 1 for links and 4k maps */
+            .valid = 1,           /* Mappings are present */
+        }};;
+    /* Setting the User bit is strange, but the ATS1H[RW] instructions
+     * don't seem to work otherwise, and since we never run on Xen
+     * pagetables un User mode it's OK.  If this changes, remember
+     * to update the hard-coded values in head.S too */
+
+    ASSERT(!(pa & ~PAGE_MASK));
+    ASSERT(!(pa & ~PADDR_MASK));
+
+    // XXX shifts
+    e.bits |= pa;
+    return e;
+}
+
+static inline lpae_t mfn_to_p2m_entry(unsigned long mfn)
+{
+    paddr_t pa = ((paddr_t) mfn) << PAGE_SHIFT;
+    lpae_t e = (lpae_t) {
+        .p2m.xn = 0,
+        .p2m.af = 1,
+        .p2m.sh = LPAE_SH_OUTER,
+        .p2m.write = 1,
+        .p2m.read = 1,
+        .p2m.mattr = 0xf,
+        .p2m.table = 1,
+        .p2m.valid = 1,
+    };
+
+    ASSERT(!(pa & ~PAGE_MASK));
+    ASSERT(!(pa & ~PADDR_MASK));
+
+    e.bits |= pa;
+
+    return e;
+}
+
+/* Write a pagetable entry */
+static inline void write_pte(lpae_t *p, lpae_t pte)
+{
+    asm volatile (
+        /* Safely write the entry (STRD is atomic on CPUs that support LPAE) */
+        "strd %0, %H0, [%1];"
+        /* Push this cacheline to the PoC so the rest of the system sees it. */
+        STORE_CP32(1, DCCMVAC)
+        : : "r" (pte.bits), "r" (p) : "memory");
+}
+
+/*
+ * Flush all hypervisor mappings from the data TLB. This is not
+ * sufficient when changing code mappings or for self modifying code.
+ */
+static inline void flush_xen_data_tlb(void)
+{
+    register unsigned long r0 asm ("r0");
+    asm volatile("dsb;" /* Ensure preceding are visible */
+                 STORE_CP32(0, TLBIALLH)
+                 "dsb;" /* Ensure completion of the TLB flush */
+                 "isb;"
+                 : : "r" (r0) /* dummy */: "memory");
+}
+
+/*
+ * Flush one VA's hypervisor mappings from the data TLB. This is not
+ * sufficient when changing code mappings or for self modifying code.
+ */
+static inline void flush_xen_data_tlb_va(unsigned long va)
+{
+    asm volatile("dsb;" /* Ensure preceding are visible */
+                 STORE_CP32(0, TLBIMVAH)
+                 "dsb;" /* Ensure completion of the TLB flush */
+                 "isb;"
+                 : : "r" (va) : "memory");
+}
+
+/* Flush all non-hypervisor mappings from the TLB */
+static inline void flush_guest_tlb(void)
+{
+    register unsigned long r0 asm ("r0");
+    WRITE_CP32(r0 /* dummy */, TLBIALLNSNH);
+}
+
+/* Ask the MMU to translate a VA for us */
+static inline uint64_t __va_to_par(uint32_t va)
+{
+    uint64_t par, tmp;
+    tmp = READ_CP64(PAR);
+    WRITE_CP32(va, ATS1HR);
+    isb(); /* Ensure result is available. */
+    par = READ_CP64(PAR);
+    WRITE_CP64(tmp, PAR);
+    return par;
+}
+
+static inline uint64_t va_to_par(uint32_t va)
+{
+    uint64_t par = __va_to_par(va);
+    /* It is not OK to call this with an invalid VA */
+    if ( par & PAR_F ) panic_PAR(par, "Hypervisor");
+    return par;
+}
+
+/* Ask the MMU to translate a Guest VA for us */
+static inline uint64_t __gva_to_par(uint32_t va)
+{
+    uint64_t par, tmp;
+    tmp = READ_CP64(PAR);
+    WRITE_CP32(va, ATS12NSOPR);
+    isb(); /* Ensure result is available. */
+    par = READ_CP64(PAR);
+    WRITE_CP64(tmp, PAR);
+    return par;
+}
+static inline uint64_t gva_to_par(uint32_t va)
+{
+    uint64_t par = __gva_to_par(va);
+    /* It is not OK to call this with an invalid VA */
+    /* XXX harsh for a guest address... */
+    if ( par & PAR_F ) panic_PAR(par, "Guest");
+    return par;
+}
+static inline uint64_t __gva_to_ipa(uint32_t va)
+{
+    uint64_t par, tmp;
+    tmp = READ_CP64(PAR);
+    WRITE_CP32(va, ATS1CPR);
+    isb(); /* Ensure result is available. */
+    par = READ_CP64(PAR);
+    WRITE_CP64(tmp, PAR);
+    return par;
+}
+static inline uint64_t gva_to_ipa(uint32_t va)
+{
+    uint64_t par = __gva_to_ipa(va);
+    /* It is not OK to call this with an invalid VA */
+    /* XXX harsh for a guest address... */
+    if ( par & PAR_F ) panic_PAR(par, "Guest");
+    return (par & PADDR_MASK & PAGE_MASK) | ((unsigned long) va & ~PAGE_MASK);
+}
+/* Bits in the PAR returned by va_to_par */
+#define PAR_FAULT 0x1
+
+#endif /* __ASSEMBLY__ */
+
+/* These numbers add up to a 39-bit input address space.  The  ARMv7-A
+ * architecture actually specifies a 40-bit input address space for the p2m,
+ * with an 8K (1024-entry) top-level table. */
+
+#define LPAE_SHIFT      9
+#define LPAE_ENTRIES    (1u << LPAE_SHIFT)
+#define LPAE_ENTRY_MASK (LPAE_ENTRIES - 1)
+
+#define THIRD_SHIFT  PAGE_SHIFT
+#define SECOND_SHIFT (THIRD_SHIFT + LPAE_SHIFT)
+#define FIRST_SHIFT  (SECOND_SHIFT + LPAE_SHIFT)
+
+/* Calculate the offsets into the pagetables for a given VA */
+#define first_linear_offset(va) (va >> FIRST_SHIFT)
+#define second_linear_offset(va) (va >> SECOND_SHIFT)
+#define third_linear_offset(va) (va >> THIRD_SHIFT)
+#define first_table_offset(va) (first_linear_offset(va))
+#define second_table_offset(va) (second_linear_offset(va) & LPAE_ENTRY_MASK)
+#define third_table_offset(va) (third_linear_offset(va) & LPAE_ENTRY_MASK)
+
+#define clear_page(page)memset((void *)(page), 0, PAGE_SIZE)
+
+#define PAGE_ALIGN(x) (((x) + PAGE_SIZE - 1) & PAGE_MASK)
+
+#endif /* __ARM_PAGE_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:45 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQO-00068H-K2; Thu, 09 Feb 2012 16:00:44 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQM-00061w-TZ
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:43 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-216.messagelabs.com!1328803233!10806558!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32762 invoked from network); 9 Feb 2012 16:00:34 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:34 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQD-0004PR-Pe
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:33 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQC-00069g-BA
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:33 +0000
Message-Id: <E1RvWQC-00069g-BA@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:31 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: mm and p2m
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787210 0
# Node ID c69ed5c72f52d48e2594e314282cadb9c4ebb699
# Parent  ac9edea95835be288e6043be8710171cb1fa060f
arm: mm and p2m

Functions to setup pagetables, handle the p2m, map and unmap domain
pages, copy data to/from guest addresses.
The implementation is based on the LPAE extension for ARMv7 and makes
use of the two level transtion mechanism.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r ac9edea95835 -r c69ed5c72f52 xen/arch/arm/domain.c
--- a/xen/arch/arm/domain.c	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/arch/arm/domain.c	Thu Feb 09 11:33:30 2012 +0000
@@ -224,6 +224,10 @@
 {
     int rc;
 
+    rc = -ENOMEM;
+    if ( (rc = p2m_init(d)) != 0 )
+        goto fail;
+
     d->max_vcpus = 8;
 
     rc = 0;
diff -r ac9edea95835 -r c69ed5c72f52 xen/arch/arm/guestcopy.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/guestcopy.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,81 @@
+#include <xen/config.h>
+#include <xen/lib.h>
+#include <xen/domain_page.h>
+
+#include <asm/mm.h>
+#include <asm/guest_access.h>
+
+unsigned long raw_copy_to_guest(void *to, const void *from, unsigned len)
+{
+    /* XXX needs to handle faults */
+    unsigned offset = ((unsigned long)to & ~PAGE_MASK);
+
+    while ( len )
+    {
+        paddr_t g = gvirt_to_maddr((uint32_t) to);
+        void *p = map_domain_page(g>>PAGE_SHIFT);
+        unsigned size = min(len, (unsigned)PAGE_SIZE - offset);
+
+        p += offset;
+        memcpy(p, from, size);
+
+        unmap_domain_page(p - offset);
+        len -= size;
+        from += size;
+        to += size;
+        offset = 0;
+    }
+
+    return 0;
+}
+
+unsigned long raw_clear_guest(void *to, unsigned len)
+{
+    /* XXX needs to handle faults */
+    unsigned offset = ((unsigned long)to & ~PAGE_MASK);
+
+    while ( len )
+    {
+        paddr_t g = gvirt_to_maddr((uint32_t) to);
+        void *p = map_domain_page(g>>PAGE_SHIFT);
+        unsigned size = min(len, (unsigned)PAGE_SIZE - offset);
+
+        p += offset;
+        memset(p, 0x00, size);
+
+        unmap_domain_page(p - offset);
+        len -= size;
+        to += size;
+        offset = 0;
+    }
+
+    return 0;
+}
+
+unsigned long raw_copy_from_guest(void *to, const void __user *from, unsigned len)
+{
+    while ( len )
+    {
+        paddr_t g = gvirt_to_maddr((uint32_t) from & PAGE_MASK);
+        void *p = map_domain_page(g>>PAGE_SHIFT);
+        unsigned size = min(len, (unsigned)(PAGE_SIZE - ((unsigned)from & (~PAGE_MASK))));
+
+        p += ((unsigned long)from & (~PAGE_MASK));
+
+        memcpy(to, p, size);
+
+        unmap_domain_page(p);
+        len -= size;
+        from += size;
+        to += size;
+    }
+    return 0;
+}
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r ac9edea95835 -r c69ed5c72f52 xen/arch/arm/mm.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/mm.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,321 @@
+/*
+ * xen/arch/arm/mm.c
+ *
+ * MMU code for an ARMv7-A with virt extensions.
+ *
+ * Tim Deegan <tim@xen.org>
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <xen/config.h>
+#include <xen/compile.h>
+#include <xen/types.h>
+#include <xen/init.h>
+#include <xen/mm.h>
+#include <xen/preempt.h>
+#include <asm/page.h>
+#include <asm/current.h>
+
+struct domain *dom_xen, *dom_io;
+
+/* Static start-of-day pagetables that we use before the allocators are up */
+lpae_t xen_pgtable[LPAE_ENTRIES] __attribute__((__aligned__(4096)));
+lpae_t xen_second[LPAE_ENTRIES*4] __attribute__((__aligned__(4096*4)));
+static lpae_t xen_fixmap[LPAE_ENTRIES] __attribute__((__aligned__(4096)));
+static lpae_t xen_xenmap[LPAE_ENTRIES] __attribute__((__aligned__(4096)));
+
+/* Limits of the Xen heap */
+unsigned long xenheap_mfn_start, xenheap_mfn_end;
+unsigned long xenheap_virt_end;
+
+unsigned long frametable_virt_end;
+
+/* Map a 4k page in a fixmap entry */
+void set_fixmap(unsigned map, unsigned long mfn, unsigned attributes)
+{
+    lpae_t pte = mfn_to_xen_entry(mfn);
+    pte.pt.table = 1; /* 4k mappings always have this bit set */
+    pte.pt.ai = attributes;
+    write_pte(xen_fixmap + third_table_offset(FIXMAP_ADDR(map)), pte);
+    flush_xen_data_tlb_va(FIXMAP_ADDR(map));
+}
+
+/* Remove a mapping from a fixmap entry */
+void clear_fixmap(unsigned map)
+{
+    lpae_t pte = {0};
+    write_pte(xen_fixmap + third_table_offset(FIXMAP_ADDR(map)), pte);
+    flush_xen_data_tlb_va(FIXMAP_ADDR(map));
+}
+
+/* Map a page of domheap memory */
+void *map_domain_page(unsigned long mfn)
+{
+    unsigned long flags;
+    lpae_t *map = xen_second + second_linear_offset(DOMHEAP_VIRT_START);
+    unsigned long slot_mfn = mfn & ~LPAE_ENTRY_MASK;
+    uint32_t va;
+    lpae_t pte;
+    int i, slot;
+
+    local_irq_save(flags);
+
+    /* The map is laid out as an open-addressed hash table where each
+     * entry is a 2MB superpage pte.  We use the available bits of each
+     * PTE as a reference count; when the refcount is zero the slot can
+     * be reused. */
+    for ( slot = (slot_mfn >> LPAE_SHIFT) % DOMHEAP_ENTRIES, i = 0;
+          i < DOMHEAP_ENTRIES;
+          slot = (slot + 1) % DOMHEAP_ENTRIES, i++ )
+    {
+        if ( map[slot].pt.avail == 0 )
+        {
+            /* Commandeer this 2MB slot */
+            pte = mfn_to_xen_entry(slot_mfn);
+            pte.pt.avail = 1;
+            write_pte(map + slot, pte);
+            break;
+        }
+        else if ( map[slot].pt.avail < 0xf && map[slot].pt.base == slot_mfn )
+        {
+            /* This slot already points to the right place; reuse it */
+            map[slot].pt.avail++;
+            break;
+        }
+    }
+    /* If the map fills up, the callers have misbehaved. */
+    BUG_ON(i == DOMHEAP_ENTRIES);
+
+#ifndef NDEBUG
+    /* Searching the hash could get slow if the map starts filling up.
+     * Cross that bridge when we come to it */
+    {
+        static int max_tries = 32;
+        if ( i >= max_tries )
+        {
+            dprintk(XENLOG_WARNING, "Domheap map is filling: %i tries\n", i);
+            max_tries *= 2;
+        }
+    }
+#endif
+
+    local_irq_restore(flags);
+
+    va = (DOMHEAP_VIRT_START
+          + (slot << SECOND_SHIFT)
+          + ((mfn & LPAE_ENTRY_MASK) << THIRD_SHIFT));
+
+    /*
+     * We may not have flushed this specific subpage at map time,
+     * since we only flush the 4k page not the superpage
+     */
+    flush_xen_data_tlb_va(va);
+
+    return (void *)va;
+}
+
+/* Release a mapping taken with map_domain_page() */
+void unmap_domain_page(const void *va)
+{
+    unsigned long flags;
+    lpae_t *map = xen_second + second_linear_offset(DOMHEAP_VIRT_START);
+    int slot = ((unsigned long) va - DOMHEAP_VIRT_START) >> SECOND_SHIFT;
+
+    local_irq_save(flags);
+
+    ASSERT(slot >= 0 && slot < DOMHEAP_ENTRIES);
+    ASSERT(map[slot].pt.avail != 0);
+
+    map[slot].pt.avail--;
+
+    local_irq_restore(flags);
+}
+
+
+/* Boot-time pagetable setup.
+ * Changes here may need matching changes in head.S */
+void __init setup_pagetables(unsigned long boot_phys_offset)
+{
+    paddr_t xen_paddr, phys_offset;
+    unsigned long dest_va;
+    lpae_t pte, *p;
+    int i;
+
+    if ( boot_phys_offset != 0 )
+    {
+        /* Remove the old identity mapping of the boot paddr */
+        pte.bits = 0;
+        dest_va = (unsigned long)_start + boot_phys_offset;
+        write_pte(xen_second + second_linear_offset(dest_va), pte);
+    }
+
+    xen_paddr = XEN_PADDR;
+
+    /* Map the destination in the empty L2 above the fixmap */
+    dest_va = FIXMAP_ADDR(0) + (1u << SECOND_SHIFT);
+    pte = mfn_to_xen_entry(xen_paddr >> PAGE_SHIFT);
+    write_pte(xen_second + second_table_offset(dest_va), pte);
+
+    /* Calculate virt-to-phys offset for the new location */
+    phys_offset = xen_paddr - (unsigned long) _start;
+
+    /* Copy */
+    memcpy((void *) dest_va, _start, _end - _start);
+
+    /* Beware!  Any state we modify between now and the PT switch may be
+     * discarded when we switch over to the copy. */
+
+    /* Update the copy of xen_pgtable to use the new paddrs */
+    p = (void *) xen_pgtable + dest_va - (unsigned long) _start;
+    for ( i = 0; i < 4; i++)
+        p[i].pt.base += (phys_offset - boot_phys_offset) >> PAGE_SHIFT;
+    p = (void *) xen_second + dest_va - (unsigned long) _start;
+    for ( i = 0; i < 4 * LPAE_ENTRIES; i++)
+        if ( p[i].pt.valid )
+                p[i].pt.base += (phys_offset - boot_phys_offset) >> PAGE_SHIFT;
+
+    /* Change pagetables to the copy in the relocated Xen */
+    asm volatile (
+        STORE_CP64(0, HTTBR)          /* Change translation base */
+        "dsb;"                        /* Ensure visibility of HTTBR update */
+        STORE_CP32(0, TLBIALLH)       /* Flush hypervisor TLB */
+        STORE_CP32(0, BPIALL)         /* Flush branch predictor */
+        "dsb;"                        /* Ensure completion of TLB+BP flush */
+        "isb;"
+        : : "r" ((unsigned long) xen_pgtable + phys_offset) : "memory");
+
+    /* Undo the temporary map */
+    pte.bits = 0;
+    write_pte(xen_second + second_table_offset(dest_va), pte);
+    /*
+     * Have removed a mapping previously used for .text. Flush everything
+     * for safety.
+     */
+    asm volatile (
+        "dsb;"                        /* Ensure visibility of PTE write */
+        STORE_CP32(0, TLBIALLH)       /* Flush hypervisor TLB */
+        STORE_CP32(0, BPIALL)         /* Flush branch predictor */
+        "dsb;"                        /* Ensure completion of TLB+BP flush */
+        "isb;"
+        : : "r" (i /*dummy*/) : "memory");
+
+    /* Link in the fixmap pagetable */
+    pte = mfn_to_xen_entry((((unsigned long) xen_fixmap) + phys_offset)
+                           >> PAGE_SHIFT);
+    pte.pt.table = 1;
+    write_pte(xen_second + second_table_offset(FIXMAP_ADDR(0)), pte);
+    /*
+     * No flush required here. Individual flushes are done in
+     * set_fixmap as entries are used.
+     */
+
+    /* Break up the Xen mapping into 4k pages and protect them separately. */
+    for ( i = 0; i < LPAE_ENTRIES; i++ )
+    {
+        unsigned long mfn = paddr_to_pfn(xen_paddr) + i;
+        unsigned long va = XEN_VIRT_START + (i << PAGE_SHIFT);
+        if ( !is_kernel(va) )
+            break;
+        pte = mfn_to_xen_entry(mfn);
+        pte.pt.table = 1; /* 4k mappings always have this bit set */
+        if ( is_kernel_text(va) || is_kernel_inittext(va) )
+        {
+            pte.pt.xn = 0;
+            pte.pt.ro = 1;
+        }
+        if ( is_kernel_rodata(va) )
+            pte.pt.ro = 1;
+        write_pte(xen_xenmap + i, pte);
+        /* No flush required here as page table is not hooked in yet. */
+    }
+    pte = mfn_to_xen_entry((((unsigned long) xen_xenmap) + phys_offset)
+                           >> PAGE_SHIFT);
+    pte.pt.table = 1;
+    write_pte(xen_second + second_linear_offset(XEN_VIRT_START), pte);
+    /* Have changed a mapping used for .text. Flush everything for safety. */
+    asm volatile (
+        "dsb;"                        /* Ensure visibility of PTE write */
+        STORE_CP32(0, TLBIALLH)       /* Flush hypervisor TLB */
+        STORE_CP32(0, BPIALL)         /* Flush branch predictor */
+        "dsb;"                        /* Ensure completion of TLB+BP flush */
+        "isb;"
+        : : "r" (i /*dummy*/) : "memory");
+
+    /* From now on, no mapping may be both writable and executable. */
+    WRITE_CP32(READ_CP32(HSCTLR) | SCTLR_WXN, HSCTLR);
+}
+
+/* Create Xen's mappings of memory.
+ * Base and virt must be 32MB aligned and size a multiple of 32MB. */
+static void __init create_mappings(unsigned long virt,
+                                   unsigned long base_mfn,
+                                   unsigned long nr_mfns)
+{
+    unsigned long i, count;
+    lpae_t pte, *p;
+
+    ASSERT(!((virt >> PAGE_SHIFT) % (16 * LPAE_ENTRIES)));
+    ASSERT(!(base_mfn % (16 * LPAE_ENTRIES)));
+    ASSERT(!(nr_mfns % (16 * LPAE_ENTRIES)));
+
+    count = nr_mfns / LPAE_ENTRIES;
+    p = xen_second + second_linear_offset(virt);
+    pte = mfn_to_xen_entry(base_mfn);
+    pte.pt.hint = 1;  /* These maps are in 16-entry contiguous chunks. */
+    for ( i = 0; i < count; i++ )
+    {
+        write_pte(p + i, pte);
+        pte.pt.base += 1 << LPAE_SHIFT;
+    }
+    flush_xen_data_tlb();
+}
+
+/* Set up the xenheap: up to 1GB of contiguous, always-mapped memory. */
+void __init setup_xenheap_mappings(unsigned long base_mfn,
+                                   unsigned long nr_mfns)
+{
+    create_mappings(XENHEAP_VIRT_START, base_mfn, nr_mfns);
+
+    /* Record where the xenheap is, for translation routines. */
+    xenheap_virt_end = XENHEAP_VIRT_START + nr_mfns * PAGE_SIZE;
+    xenheap_mfn_start = base_mfn;
+    xenheap_mfn_end = base_mfn + nr_mfns;
+}
+
+/* Map a frame table to cover physical addresses ps through pe */
+void __init setup_frametable_mappings(paddr_t ps, paddr_t pe)
+{
+    unsigned long nr_pages = (pe - ps) >> PAGE_SHIFT;
+    unsigned long frametable_size = nr_pages * sizeof(struct page_info);
+    unsigned long base_mfn;
+
+    /* Round up to 32M boundary */
+    frametable_size = (frametable_size + 0x1ffffff) & ~0x1ffffff;
+    base_mfn = alloc_boot_pages(frametable_size >> PAGE_SHIFT, 5);
+    create_mappings(FRAMETABLE_VIRT_START, base_mfn, frametable_size >> PAGE_SHIFT);
+
+    memset(&frame_table[0], 0, nr_pages * sizeof(struct page_info));
+    memset(&frame_table[nr_pages], -1,
+           frametable_size - (nr_pages * sizeof(struct page_info)));
+
+    frametable_virt_end = FRAMETABLE_VIRT_START + (nr_pages * sizeof(struct page_info));
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r ac9edea95835 -r c69ed5c72f52 xen/arch/arm/p2m.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/p2m.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,214 @@
+#include <xen/config.h>
+#include <xen/sched.h>
+#include <xen/lib.h>
+#include <xen/errno.h>
+#include <xen/domain_page.h>
+
+void p2m_load_VTTBR(struct domain *d)
+{
+    struct p2m_domain *p2m = &d->arch.p2m;
+    paddr_t maddr = page_to_maddr(p2m->first_level);
+    uint64_t vttbr = maddr;
+
+    vttbr |= ((uint64_t)p2m->vmid&0xff)<<48;
+
+    printk("VTTBR dom%d = %"PRIx64"\n", d->domain_id, vttbr);
+
+    WRITE_CP64(vttbr, VTTBR);
+    isb(); /* Ensure update is visible */
+}
+
+static int p2m_create_entry(struct domain *d,
+                            lpae_t *entry)
+{
+    struct p2m_domain *p2m = &d->arch.p2m;
+    struct page_info *page;
+    void *p;
+    lpae_t pte;
+
+    BUG_ON(entry->p2m.valid);
+
+    page = alloc_domheap_page(d, 0);
+    if ( page == NULL )
+        return -ENOMEM;
+
+    page_list_add(page, &p2m->pages);
+
+    p = __map_domain_page(page);
+    clear_page(p);
+    unmap_domain_page(p);
+
+    pte = mfn_to_p2m_entry(page_to_mfn(page));
+
+    write_pte(entry, pte);
+
+    return 0;
+}
+
+static int create_p2m_entries(struct domain *d,
+                     int alloc,
+                     paddr_t start_gpaddr,
+                     paddr_t end_gpaddr,
+                     paddr_t maddr)
+{
+    int rc;
+    struct p2m_domain *p2m = &d->arch.p2m;
+    lpae_t *first = NULL, *second = NULL, *third = NULL;
+    paddr_t addr;
+    unsigned long cur_first_offset = ~0, cur_second_offset = ~0;
+
+    /* XXX Don't actually handle 40 bit guest physical addresses */
+    BUG_ON(start_gpaddr & 0x8000000000ULL);
+    BUG_ON(end_gpaddr   & 0x8000000000ULL);
+
+    first = __map_domain_page(p2m->first_level);
+
+    for(addr = start_gpaddr; addr < end_gpaddr; addr += PAGE_SIZE)
+    {
+        if ( !first[first_table_offset(addr)].p2m.valid )
+        {
+            rc = p2m_create_entry(d, &first[first_table_offset(addr)]);
+            if ( rc < 0 ) {
+                printk("p2m_populate_ram: L1 failed\n");
+                goto out;
+            }
+        }
+
+        BUG_ON(!first[first_table_offset(addr)].p2m.valid);
+
+        if ( cur_first_offset != first_table_offset(addr) )
+        {
+            if (second) unmap_domain_page(second);
+            second = map_domain_page(first[first_table_offset(addr)].p2m.base);
+            cur_first_offset = first_table_offset(addr);
+        }
+        /* else: second already valid */
+
+        if ( !second[second_table_offset(addr)].p2m.valid )
+        {
+            rc = p2m_create_entry(d, &second[second_table_offset(addr)]);
+            if ( rc < 0 ) {
+                printk("p2m_populate_ram: L2 failed\n");
+                goto out;
+            }
+        }
+
+        BUG_ON(!second[second_table_offset(addr)].p2m.valid);
+
+        if ( cur_second_offset != second_table_offset(addr) )
+        {
+            /* map third level */
+            if (third) unmap_domain_page(third);
+            third = map_domain_page(second[second_table_offset(addr)].p2m.base);
+            cur_second_offset = second_table_offset(addr);
+        }
+        /* else: third already valid */
+
+        BUG_ON(third[third_table_offset(addr)].p2m.valid);
+
+        /* Allocate a new RAM page and attach */
+        if (alloc)
+        {
+            struct page_info *page;
+            lpae_t pte;
+
+            rc = -ENOMEM;
+            page = alloc_domheap_page(d, 0);
+            if ( page == NULL ) {
+                printk("p2m_populate_ram: failed to allocate page\n");
+                goto out;
+            }
+
+            pte = mfn_to_p2m_entry(page_to_mfn(page));
+
+            write_pte(&third[third_table_offset(addr)], pte);
+        } else {
+            lpae_t pte = mfn_to_p2m_entry(maddr >> PAGE_SHIFT);
+            write_pte(&third[third_table_offset(addr)], pte);
+            maddr += PAGE_SIZE;
+        }
+    }
+
+    rc = 0;
+
+out:
+    spin_lock(&p2m->lock);
+
+    if (third) unmap_domain_page(third);
+    if (second) unmap_domain_page(second);
+    if (first) unmap_domain_page(first);
+
+    spin_unlock(&p2m->lock);
+
+    return rc;
+}
+
+int p2m_populate_ram(struct domain *d,
+                     paddr_t start,
+                     paddr_t end)
+{
+    return create_p2m_entries(d, 1, start, end, 0);
+}
+
+int map_mmio_regions(struct domain *d,
+                     paddr_t start_gaddr,
+                     paddr_t end_gaddr,
+                     paddr_t maddr)
+{
+    return create_p2m_entries(d, 0, start_gaddr, end_gaddr, maddr);
+}
+
+int p2m_alloc_table(struct domain *d)
+{
+    struct p2m_domain *p2m = &d->arch.p2m;
+    struct page_info *page;
+    void *p;
+
+    /* First level P2M is 2 consecutive pages */
+    page = alloc_domheap_pages(d, 1, 0);
+    if ( page == NULL )
+        return -ENOMEM;
+
+    spin_lock(&p2m->lock);
+
+    page_list_add(page, &p2m->pages);
+
+    /* Clear both first level pages */
+    p = __map_domain_page(page);
+    clear_page(p);
+    unmap_domain_page(p);
+
+    p = __map_domain_page(page + 1);
+    clear_page(p);
+    unmap_domain_page(p);
+
+    p2m->first_level = page;
+
+    spin_unlock(&p2m->lock);
+
+    return 0;
+}
+
+int p2m_init(struct domain *d)
+{
+    struct p2m_domain *p2m = &d->arch.p2m;
+
+    spin_lock_init(&p2m->lock);
+    INIT_PAGE_LIST_HEAD(&p2m->pages);
+
+    /* XXX allocate properly */
+    /* Zero is reserved */
+    p2m->vmid = d->domain_id + 1;
+
+    p2m->first_level = NULL;
+
+    return 0;
+}
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r ac9edea95835 -r c69ed5c72f52 xen/include/asm-arm/domain.h
--- a/xen/include/asm-arm/domain.h	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/include/asm-arm/domain.h	Thu Feb 09 11:33:30 2012 +0000
@@ -16,6 +16,8 @@
 
 struct arch_domain
 {
+    struct p2m_domain p2m;
+
 }  __cacheline_aligned;
 
 struct arch_vcpu
diff -r ac9edea95835 -r c69ed5c72f52 xen/include/asm-arm/guest_access.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/guest_access.h	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,131 @@
+#ifndef __ASM_ARM_GUEST_ACCESS_H__
+#define __ASM_ARM_GUEST_ACCESS_H__
+
+#include <xen/guest_access.h>
+#include <xen/errno.h>
+
+/* Guests have their own comlete address space */
+#define access_ok(addr,size) (1)
+
+#define array_access_ok(addr,count,size) \
+    (likely(count < (~0UL/size)) && access_ok(addr,count*size))
+
+unsigned long raw_copy_to_guest(void *to, const void *from, unsigned len);
+unsigned long raw_copy_from_guest(void *to, const void *from, unsigned len);
+unsigned long raw_clear_guest(void *to, unsigned len);
+
+#define __raw_copy_to_guest raw_copy_to_guest
+#define __raw_copy_from_guest raw_copy_from_guest
+#define __raw_clear_guest raw_clear_guest
+
+/* Remainder copied from x86 -- could be common? */
+
+/* Is the guest handle a NULL reference? */
+#define guest_handle_is_null(hnd)        ((hnd).p == NULL)
+
+/* Offset the given guest handle into the array it refers to. */
+#define guest_handle_add_offset(hnd, nr) ((hnd).p += (nr))
+#define guest_handle_subtract_offset(hnd, nr) ((hnd).p -= (nr))
+
+/* Cast a guest handle to the specified type of handle. */
+#define guest_handle_cast(hnd, type) ({         \
+    type *_x = (hnd).p;                         \
+    (XEN_GUEST_HANDLE(type)) { _x };            \
+})
+
+#define guest_handle_from_ptr(ptr, type)        \
+    ((XEN_GUEST_HANDLE(type)) { (type *)ptr })
+#define const_guest_handle_from_ptr(ptr, type)  \
+    ((XEN_GUEST_HANDLE(const_##type)) { (const type *)ptr })
+
+/*
+ * Copy an array of objects to guest context via a guest handle,
+ * specifying an offset into the guest array.
+ */
+#define copy_to_guest_offset(hnd, off, ptr, nr) ({      \
+    const typeof(*(ptr)) *_s = (ptr);                   \
+    char (*_d)[sizeof(*_s)] = (void *)(hnd).p;          \
+    ((void)((hnd).p == (ptr)));                         \
+    raw_copy_to_guest(_d+(off), _s, sizeof(*_s)*(nr));  \
+})
+
+/*
+ * Clear an array of objects in guest context via a guest handle,
+ * specifying an offset into the guest array.
+ */
+#define clear_guest_offset(hnd, off, ptr, nr) ({      \
+    raw_clear_guest(_d+(off), nr);  \
+})
+
+/*
+ * Copy an array of objects from guest context via a guest handle,
+ * specifying an offset into the guest array.
+ */
+#define copy_from_guest_offset(ptr, hnd, off, nr) ({    \
+    const typeof(*(ptr)) *_s = (hnd).p;                 \
+    typeof(*(ptr)) *_d = (ptr);                         \
+    raw_copy_from_guest(_d, _s+(off), sizeof(*_d)*(nr));\
+})
+
+/* Copy sub-field of a structure to guest context via a guest handle. */
+#define copy_field_to_guest(hnd, ptr, field) ({         \
+    const typeof(&(ptr)->field) _s = &(ptr)->field;     \
+    void *_d = &(hnd).p->field;                         \
+    ((void)(&(hnd).p->field == &(ptr)->field));         \
+    raw_copy_to_guest(_d, _s, sizeof(*_s));             \
+})
+
+/* Copy sub-field of a structure from guest context via a guest handle. */
+#define copy_field_from_guest(ptr, hnd, field) ({       \
+    const typeof(&(ptr)->field) _s = &(hnd).p->field;   \
+    typeof(&(ptr)->field) _d = &(ptr)->field;           \
+    raw_copy_from_guest(_d, _s, sizeof(*_d));           \
+})
+
+/*
+ * Pre-validate a guest handle.
+ * Allows use of faster __copy_* functions.
+ */
+/* All ARM guests are paging mode external and hence safe */
+#define guest_handle_okay(hnd, nr) (1)
+#define guest_handle_subrange_okay(hnd, first, last) (1)
+
+#define __copy_to_guest_offset(hnd, off, ptr, nr) ({    \
+    const typeof(*(ptr)) *_s = (ptr);                   \
+    char (*_d)[sizeof(*_s)] = (void *)(hnd).p;          \
+    ((void)((hnd).p == (ptr)));                         \
+    __raw_copy_to_guest(_d+(off), _s, sizeof(*_s)*(nr));\
+})
+
+#define __clear_guest_offset(hnd, off, ptr, nr) ({      \
+    __raw_clear_guest(_d+(off), nr);  \
+})
+
+#define __copy_from_guest_offset(ptr, hnd, off, nr) ({  \
+    const typeof(*(ptr)) *_s = (hnd).p;                 \
+    typeof(*(ptr)) *_d = (ptr);                         \
+    __raw_copy_from_guest(_d, _s+(off), sizeof(*_d)*(nr));\
+})
+
+#define __copy_field_to_guest(hnd, ptr, field) ({       \
+    const typeof(&(ptr)->field) _s = &(ptr)->field;     \
+    void *_d = &(hnd).p->field;                         \
+    ((void)(&(hnd).p->field == &(ptr)->field));         \
+    __raw_copy_to_guest(_d, _s, sizeof(*_s));           \
+})
+
+#define __copy_field_from_guest(ptr, hnd, field) ({     \
+    const typeof(&(ptr)->field) _s = &(hnd).p->field;   \
+    typeof(&(ptr)->field) _d = &(ptr)->field;           \
+    __raw_copy_from_guest(_d, _s, sizeof(*_d));         \
+})
+
+#endif /* __ASM_ARM_GUEST_ACCESS_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r ac9edea95835 -r c69ed5c72f52 xen/include/asm-arm/mm.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/mm.h	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,315 @@
+#ifndef __ARCH_ARM_MM__
+#define __ARCH_ARM_MM__
+
+#include <xen/config.h>
+#include <xen/kernel.h>
+#include <asm/page.h>
+#include <public/xen.h>
+
+/* Find a suitable place at the top of memory for Xen to live */
+/* XXX For now, use the top of the VE's 4GB RAM, at a 40-bit alias */
+#define XEN_PADDR 0x80ffe00000ull
+
+/*
+ * Per-page-frame information.
+ *
+ * Every architecture must ensure the following:
+ *  1. 'struct page_info' contains a 'struct page_list_entry list'.
+ *  2. Provide a PFN_ORDER() macro for accessing the order of a free page.
+ */
+#define PFN_ORDER(_pfn) ((_pfn)->v.free.order)
+
+struct page_info
+{
+    /* Each frame can be threaded onto a doubly-linked list. */
+    struct page_list_entry list;
+
+    /* Reference count and various PGC_xxx flags and fields. */
+    unsigned long count_info;
+
+    /* Context-dependent fields follow... */
+    union {
+        /* Page is in use: ((count_info & PGC_count_mask) != 0). */
+        struct {
+            /* Type reference count and various PGT_xxx flags and fields. */
+            unsigned long type_info;
+        } inuse;
+        /* Page is on a free list: ((count_info & PGC_count_mask) == 0). */
+        struct {
+            /* Do TLBs need flushing for safety before next page use? */
+            bool_t need_tlbflush;
+        } free;
+
+    } u;
+
+    union {
+        /* Page is in use, but not as a shadow. */
+        struct {
+            /* Owner of this page (zero if page is anonymous). */
+            struct domain *domain;
+        } inuse;
+
+        /* Page is on a free list. */
+        struct {
+            /* Order-size of the free chunk this page is the head of. */
+            unsigned int order;
+        } free;
+
+    } v;
+
+    union {
+        /*
+         * Timestamp from 'TLB clock', used to avoid extra safety flushes.
+         * Only valid for: a) free pages, and b) pages with zero type count
+         */
+        u32 tlbflush_timestamp;
+    };
+    u64 pad;
+};
+
+#define PG_shift(idx)   (BITS_PER_LONG - (idx))
+#define PG_mask(x, idx) (x ## UL << PG_shift(idx))
+
+#define PGT_none          PG_mask(0, 4)  /* no special uses of this page   */
+#define PGT_writable_page PG_mask(7, 4)  /* has writable mappings?         */
+#define PGT_shared_page   PG_mask(8, 4)  /* CoW sharable page              */
+#define PGT_type_mask     PG_mask(15, 4) /* Bits 28-31 or 60-63.           */
+
+ /* Owning guest has pinned this page to its current type? */
+#define _PGT_pinned       PG_shift(5)
+#define PGT_pinned        PG_mask(1, 5)
+
+ /* Count of uses of this frame as its current type. */
+#define PGT_count_width   PG_shift(9)
+#define PGT_count_mask    ((1UL<<PGT_count_width)-1)
+
+ /* Cleared when the owning guest 'frees' this page. */
+#define _PGC_allocated    PG_shift(1)
+#define PGC_allocated     PG_mask(1, 1)
+  /* Page is Xen heap? */
+#define _PGC_xen_heap     PG_shift(2)
+#define PGC_xen_heap      PG_mask(1, 2)
+/* ... */
+/* Page is broken? */
+#define _PGC_broken       PG_shift(7)
+#define PGC_broken        PG_mask(1, 7)
+ /* Mutually-exclusive page states: { inuse, offlining, offlined, free }. */
+#define PGC_state         PG_mask(3, 9)
+#define PGC_state_inuse   PG_mask(0, 9)
+#define PGC_state_offlining PG_mask(1, 9)
+#define PGC_state_offlined PG_mask(2, 9)
+#define PGC_state_free    PG_mask(3, 9)
+#define page_state_is(pg, st) (((pg)->count_info&PGC_state) == PGC_state_##st)
+
+/* Count of references to this frame. */
+#define PGC_count_width   PG_shift(9)
+#define PGC_count_mask    ((1UL<<PGC_count_width)-1)
+
+extern unsigned long xenheap_mfn_start, xenheap_mfn_end;
+extern unsigned long xenheap_virt_end;
+
+#define is_xen_heap_page(page) is_xen_heap_mfn(page_to_mfn(page))
+#define is_xen_heap_mfn(mfn) ({                                 \
+    unsigned long _mfn = (mfn);                                 \
+    (_mfn >= xenheap_mfn_start && _mfn < xenheap_mfn_end);      \
+})
+#define is_xen_fixed_mfn(mfn) is_xen_heap_mfn(mfn)
+
+#define page_get_owner(_p)    (_p)->v.inuse.domain
+#define page_set_owner(_p,_d) ((_p)->v.inuse.domain = (_d))
+
+#define maddr_get_owner(ma)   (page_get_owner(maddr_to_page((ma))))
+#define vaddr_get_owner(va)   (page_get_owner(virt_to_page((va))))
+
+#define XENSHARE_writable 0
+#define XENSHARE_readonly 1
+extern void share_xen_page_with_guest(
+    struct page_info *page, struct domain *d, int readonly);
+extern void share_xen_page_with_privileged_guests(
+    struct page_info *page, int readonly);
+
+#define frame_table ((struct page_info *)FRAMETABLE_VIRT_START)
+
+extern unsigned long max_page;
+extern unsigned long total_pages;
+
+/* Boot-time pagetable setup */
+extern void setup_pagetables(unsigned long boot_phys_offset);
+/* Set up the xenheap: up to 1GB of contiguous, always-mapped memory.
+ * Base must be 32MB aligned and size a multiple of 32MB. */
+extern void setup_xenheap_mappings(unsigned long base_mfn, unsigned long nr_mfns);
+/* Map a frame table to cover physical addresses ps through pe */
+extern void setup_frametable_mappings(paddr_t ps, paddr_t pe);
+/* Map a 4k page in a fixmap entry */
+extern void set_fixmap(unsigned map, unsigned long mfn, unsigned attributes);
+/* Remove a mapping from a fixmap entry */
+extern void clear_fixmap(unsigned map);
+
+
+#define mfn_valid(mfn)        ({                                              \
+    unsigned long __m_f_n = (mfn);                                            \
+    likely(__m_f_n < max_page);                                               \
+})
+
+#define max_pdx                 max_page
+/* XXX Assume everything in the 40-bit physical alias 0x8000000000 for now */
+#define pfn_to_pdx(pfn)         ((pfn) - 0x8000000UL)
+#define pdx_to_pfn(pdx)         ((pdx) + 0x8000000UL)
+#define virt_to_pdx(va)         virt_to_mfn(va)
+#define pdx_to_virt(pdx)        mfn_to_virt(pdx)
+
+/* Convert between machine frame numbers and page-info structures. */
+#define mfn_to_page(mfn)  (frame_table + pfn_to_pdx(mfn))
+#define page_to_mfn(pg)   pdx_to_pfn((unsigned long)((pg) - frame_table))
+#define __page_to_mfn(pg)  page_to_mfn(pg)
+#define __mfn_to_page(mfn) mfn_to_page(mfn)
+
+/* Convert between machine addresses and page-info structures. */
+#define maddr_to_page(ma) __mfn_to_page((ma) >> PAGE_SHIFT)
+#define page_to_maddr(pg) ((paddr_t)__page_to_mfn(pg) << PAGE_SHIFT)
+
+/* Convert between frame number and address formats.  */
+#define pfn_to_paddr(pfn) ((paddr_t)(pfn) << PAGE_SHIFT)
+#define paddr_to_pfn(pa)  ((unsigned long)((pa) >> PAGE_SHIFT))
+#define paddr_to_pdx(pa)    pfn_to_pdx(paddr_to_pfn(pa))
+
+
+static inline paddr_t virt_to_maddr(void *va)
+{
+    uint64_t par = va_to_par((uint32_t)va);
+    return (par & PADDR_MASK & PAGE_MASK) | ((unsigned long) va & ~PAGE_MASK);
+}
+
+static inline void *maddr_to_virt(paddr_t ma)
+{
+    ASSERT(is_xen_heap_mfn(ma >> PAGE_SHIFT));
+    ma -= pfn_to_paddr(xenheap_mfn_start);
+    return (void *)(unsigned long) ma + XENHEAP_VIRT_START;
+}
+
+static inline paddr_t gvirt_to_maddr(uint32_t va)
+{
+    uint64_t par = gva_to_par(va);
+    return (par & PADDR_MASK & PAGE_MASK) | ((unsigned long) va & ~PAGE_MASK);
+}
+
+/* Convert between Xen-heap virtual addresses and machine addresses. */
+#define __pa(x)             (virt_to_maddr(x))
+#define __va(x)             (maddr_to_virt(x))
+
+/* Convert between Xen-heap virtual addresses and machine frame numbers. */
+#define virt_to_mfn(va)   (virt_to_maddr(va) >> PAGE_SHIFT)
+#define mfn_to_virt(mfn)  (maddr_to_virt((paddr_t)(mfn) << PAGE_SHIFT))
+
+
+static inline int get_order_from_bytes(paddr_t size)
+{
+    int order;
+    size = (size-1) >> PAGE_SHIFT;
+    for ( order = 0; size; order++ )
+        size >>= 1;
+    return order;
+}
+
+static inline int get_order_from_pages(unsigned long nr_pages)
+{
+    int order;
+    nr_pages--;
+    for ( order = 0; nr_pages; order++ )
+        nr_pages >>= 1;
+    return order;
+}
+
+
+/* Convert between Xen-heap virtual addresses and page-info structures. */
+static inline struct page_info *virt_to_page(const void *v)
+{
+    unsigned long va = (unsigned long)v;
+    ASSERT(va >= XENHEAP_VIRT_START);
+    ASSERT(va < xenheap_virt_end);
+
+    return frame_table + ((va - XENHEAP_VIRT_START) >> PAGE_SHIFT);
+}
+
+static inline void *page_to_virt(const struct page_info *pg)
+{
+    ASSERT((unsigned long)pg - FRAMETABLE_VIRT_START < frametable_virt_end);
+    return (void *)(XENHEAP_VIRT_START +
+                    ((unsigned long)pg - FRAMETABLE_VIRT_START) /
+                    (sizeof(*pg) / (sizeof(*pg) & -sizeof(*pg))) *
+                    (PAGE_SIZE / (sizeof(*pg) & -sizeof(*pg))));
+
+}
+
+struct domain *page_get_owner_and_reference(struct page_info *page);
+void put_page(struct page_info *page);
+int  get_page(struct page_info *page, struct domain *domain);
+
+/*
+ * The MPT (machine->physical mapping table) is an array of word-sized
+ * values, indexed on machine frame number. It is expected that guest OSes
+ * will use it to store a "physical" frame number to give the appearance of
+ * contiguous (or near contiguous) physical memory.
+ */
+#undef  machine_to_phys_mapping
+#define machine_to_phys_mapping  ((unsigned long *)RDWR_MPT_VIRT_START)
+#define INVALID_M2P_ENTRY        (~0UL)
+#define VALID_M2P(_e)            (!((_e) & (1UL<<(BITS_PER_LONG-1))))
+#define SHARED_M2P_ENTRY         (~0UL - 1UL)
+#define SHARED_M2P(_e)           ((_e) == SHARED_M2P_ENTRY)
+
+#define _set_gpfn_from_mfn(mfn, pfn) ({                        \
+    struct domain *d = page_get_owner(__mfn_to_page(mfn));     \
+    if(d && (d == dom_cow))                                    \
+        machine_to_phys_mapping[(mfn)] = SHARED_M2P_ENTRY;     \
+    else                                                       \
+        machine_to_phys_mapping[(mfn)] = (pfn);                \
+    })
+
+#define put_gfn(d, g)   ((void)0)
+
+#define INVALID_MFN             (~0UL)
+
+/* Xen always owns P2M on ARM */
+#define set_gpfn_from_mfn(mfn, pfn) do { (void) (mfn), (void)(pfn); } while (0)
+#define mfn_to_gmfn(_d, mfn)  (mfn)
+
+
+/* Arch-specific portion of memory_op hypercall. */
+long arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg);
+
+int steal_page(
+    struct domain *d, struct page_info *page, unsigned int memflags);
+int donate_page(
+    struct domain *d, struct page_info *page, unsigned int memflags);
+
+#define domain_set_alloc_bitsize(d) ((void)0)
+#define domain_clamp_alloc_bitsize(d, b) (b)
+
+unsigned long domain_get_maximum_gpfn(struct domain *d);
+
+extern struct domain *dom_xen, *dom_io, *dom_cow;
+
+#define memguard_init(_s)              (_s)
+#define memguard_guard_stack(_p)       ((void)0)
+#define memguard_guard_range(_p,_l)    ((void)0)
+#define memguard_unguard_range(_p,_l)  ((void)0)
+int guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn,
+                                          unsigned int order);
+
+extern void put_page_type(struct page_info *page);
+static inline void put_page_and_type(struct page_info *page)
+{
+    put_page_type(page);
+    put_page(page);
+}
+
+#endif /*  __ARCH_ARM_MM__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r ac9edea95835 -r c69ed5c72f52 xen/include/asm-arm/p2m.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/p2m.h	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,88 @@
+#ifndef _XEN_P2M_H
+#define _XEN_P2M_H
+
+#include <xen/mm.h>
+
+struct domain;
+
+/* Per-p2m-table state */
+struct p2m_domain {
+    /* Lock that protects updates to the p2m */
+    spinlock_t lock;
+
+    /* Pages used to construct the p2m */
+    struct page_list_head pages;
+
+    /* Root of p2m page tables, 2 contiguous pages */
+    struct page_info *first_level;
+
+    /* Current VMID in use */
+    uint8_t vmid;
+};
+
+/* Init the datastructures for later use by the p2m code */
+int p2m_init(struct domain *d);
+
+/* Allocate a new p2m table for a domain.
+ *
+ * Returns 0 for success or -errno.
+ */
+int p2m_alloc_table(struct domain *d);
+
+/* */
+void p2m_load_VTTBR(struct domain *d);
+
+/* Setup p2m RAM mapping for domain d from start-end. */
+int p2m_populate_ram(struct domain *d, paddr_t start, paddr_t end);
+/* Map MMIO regions in the p2m: start_gaddr and end_gaddr is the range
+ * in the guest physical address space to map, starting from the machine
+ * address maddr. */
+int map_mmio_regions(struct domain *d, paddr_t start_gaddr,
+                     paddr_t end_gaddr, paddr_t maddr);
+
+unsigned long gmfn_to_mfn(struct domain *d, unsigned long gpfn);
+
+/*
+ * Populate-on-demand
+ */
+
+/* Call when decreasing memory reservation to handle PoD entries properly.
+ * Will return '1' if all entries were handled and nothing more need be done.*/
+int
+p2m_pod_decrease_reservation(struct domain *d,
+                             xen_pfn_t gpfn,
+                             unsigned int order);
+
+/* Compatibility function exporting the old untyped interface */
+static inline unsigned long get_gfn_untyped(struct domain *d, unsigned long gpfn)
+{
+    return gmfn_to_mfn(d, gpfn);
+}
+
+int get_page_type(struct page_info *page, unsigned long type);
+int is_iomem_page(unsigned long mfn);
+static inline int get_page_and_type(struct page_info *page,
+                                    struct domain *domain,
+                                    unsigned long type)
+{
+    int rc = get_page(page, domain);
+
+    if ( likely(rc) && unlikely(!get_page_type(page, type)) )
+    {
+        put_page(page);
+        rc = 0;
+    }
+
+    return rc;
+}
+
+#endif /* _XEN_P2M_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r ac9edea95835 -r c69ed5c72f52 xen/include/asm-arm/page.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/page.h	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,335 @@
+#ifndef __ARM_PAGE_H__
+#define __ARM_PAGE_H__
+
+#include <xen/config.h>
+
+#define PADDR_BITS              40
+#define PADDR_MASK              ((1ULL << PADDR_BITS)-1)
+
+#define VADDR_BITS              32
+#define VADDR_MASK              (~0UL)
+
+/* Shareability values for the LPAE entries */
+#define LPAE_SH_NON_SHAREABLE 0x0
+#define LPAE_SH_UNPREDICTALE  0x1
+#define LPAE_SH_OUTER         0x2
+#define LPAE_SH_INNER         0x3
+
+/* LPAE Memory region attributes, to match Linux's (non-LPAE) choices.
+ * Indexed by the AttrIndex bits of a LPAE entry;
+ * the 8-bit fields are packed little-endian into MAIR0 and MAIR1
+ *
+ *                 ai    encoding
+ *   UNCACHED      000   0000 0000  -- Strongly Ordered
+ *   BUFFERABLE    001   0100 0100  -- Non-Cacheable
+ *   WRITETHROUGH  010   1010 1010  -- Write-through
+ *   WRITEBACK     011   1110 1110  -- Write-back
+ *   DEV_SHARED    100   0000 0100  -- Device
+ *   ??            101
+ *   reserved      110
+ *   WRITEALLOC    111   1111 1111  -- Write-back write-allocate
+ *
+ *   DEV_NONSHARED 100   (== DEV_SHARED)
+ *   DEV_WC        001   (== BUFFERABLE)
+ *   DEV_CACHED    011   (== WRITEBACK)
+ */
+#define MAIR0VAL 0xeeaa4400
+#define MAIR1VAL 0xff000004
+
+#define UNCACHED      0x0
+#define BUFFERABLE    0x1
+#define WRITETHROUGH  0x2
+#define WRITEBACK     0x3
+#define DEV_SHARED    0x4
+#define WRITEALLOC    0x7
+#define DEV_NONSHARED DEV_SHARED
+#define DEV_WC        BUFFERABLE
+#define DEV_CACHED    WRITEBACK
+
+
+#ifndef __ASSEMBLY__
+
+#include <xen/types.h>
+#include <xen/lib.h>
+
+/* WARNING!  Unlike the Intel pagetable code, where l1 is the lowest
+ * level and l4 is the root of the trie, the ARM pagetables follow ARM's
+ * documentation: the levels are called first, second &c in the order
+ * that the MMU walks them (i.e. "first" is the root of the trie). */
+
+/******************************************************************************
+ * ARMv7-A LPAE pagetables: 3-level trie, mapping 40-bit input to
+ * 40-bit output addresses.  Tables at all levels have 512 64-bit entries
+ * (i.e. are 4Kb long).
+ *
+ * The bit-shuffling that has the permission bits in branch nodes in a
+ * different place from those in leaf nodes seems to be to allow linear
+ * pagetable tricks.  If we're not doing that then the set of permission
+ * bits that's not in use in a given node type can be used as
+ * extra software-defined bits. */
+
+typedef struct {
+    /* These are used in all kinds of entry. */
+    unsigned long valid:1;      /* Valid mapping */
+    unsigned long table:1;      /* == 1 in 4k map entries too */
+
+    /* These ten bits are only used in Block entries and are ignored
+     * in Table entries. */
+    unsigned long ai:3;         /* Attribute Index */
+    unsigned long ns:1;         /* Not-Secure */
+    unsigned long user:1;       /* User-visible */
+    unsigned long ro:1;         /* Read-Only */
+    unsigned long sh:2;         /* Shareability */
+    unsigned long af:1;         /* Access Flag */
+    unsigned long ng:1;         /* Not-Global */
+
+    /* The base address must be approprately aligned for Block entries */
+    unsigned long base:28;      /* Base address of block or next table */
+    unsigned long sbz:12;       /* Must be zero */
+
+    /* These seven bits are only used in Block entries and are ignored
+     * in Table entries. */
+    unsigned long hint:1;       /* In a block of 16 contiguous entries */
+    unsigned long pxn:1;        /* Privileged-XN */
+    unsigned long xn:1;         /* eXecute-Never */
+    unsigned long avail:4;      /* Ignored by hardware */
+
+    /* These 5 bits are only used in Table entries and are ignored in
+     * Block entries */
+    unsigned long pxnt:1;       /* Privileged-XN */
+    unsigned long xnt:1;        /* eXecute-Never */
+    unsigned long apt:2;        /* Access Permissions */
+    unsigned long nst:1;        /* Not-Secure */
+} __attribute__((__packed__)) lpae_pt_t;
+
+/* The p2m tables have almost the same layout, but some of the permission
+ * and cache-control bits are laid out differently (or missing) */
+typedef struct {
+    /* These are used in all kinds of entry. */
+    unsigned long valid:1;      /* Valid mapping */
+    unsigned long table:1;      /* == 1 in 4k map entries too */
+
+    /* These ten bits are only used in Block entries and are ignored
+     * in Table entries. */
+    unsigned long mattr:4;      /* Memory Attributes */
+    unsigned long read:1;       /* Read access */
+    unsigned long write:1;      /* Write access */
+    unsigned long sh:2;         /* Shareability */
+    unsigned long af:1;         /* Access Flag */
+    unsigned long sbz4:1;
+
+    /* The base address must be approprately aligned for Block entries */
+    unsigned long base:28;      /* Base address of block or next table */
+    unsigned long sbz3:12;
+
+    /* These seven bits are only used in Block entries and are ignored
+     * in Table entries. */
+    unsigned long hint:1;       /* In a block of 16 contiguous entries */
+    unsigned long sbz2:1;
+    unsigned long xn:1;         /* eXecute-Never */
+    unsigned long avail:4;      /* Ignored by hardware */
+
+    unsigned long sbz1:5;
+} __attribute__((__packed__)) lpae_p2m_t;
+
+typedef union {
+    uint64_t bits;
+    lpae_pt_t pt;
+    lpae_p2m_t p2m;
+} lpae_t;
+
+/* Standard entry type that we'll use to build Xen's own pagetables.
+ * We put the same permissions at every level, because they're ignored
+ * by the walker in non-leaf entries. */
+static inline lpae_t mfn_to_xen_entry(unsigned long mfn)
+{
+    paddr_t pa = ((paddr_t) mfn) << PAGE_SHIFT;
+    lpae_t e = (lpae_t) {
+        .pt = {
+            .xn = 1,              /* No need to execute outside .text */
+            .ng = 1,              /* Makes TLB flushes easier */
+            .af = 1,              /* No need for access tracking */
+            .sh = LPAE_SH_OUTER,  /* Xen mappings are globally coherent */
+            .ns = 1,              /* Hyp mode is in the non-secure world */
+            .user = 1,            /* See below */
+            .ai = WRITEALLOC,
+            .table = 0,           /* Set to 1 for links and 4k maps */
+            .valid = 1,           /* Mappings are present */
+        }};;
+    /* Setting the User bit is strange, but the ATS1H[RW] instructions
+     * don't seem to work otherwise, and since we never run on Xen
+     * pagetables un User mode it's OK.  If this changes, remember
+     * to update the hard-coded values in head.S too */
+
+    ASSERT(!(pa & ~PAGE_MASK));
+    ASSERT(!(pa & ~PADDR_MASK));
+
+    // XXX shifts
+    e.bits |= pa;
+    return e;
+}
+
+static inline lpae_t mfn_to_p2m_entry(unsigned long mfn)
+{
+    paddr_t pa = ((paddr_t) mfn) << PAGE_SHIFT;
+    lpae_t e = (lpae_t) {
+        .p2m.xn = 0,
+        .p2m.af = 1,
+        .p2m.sh = LPAE_SH_OUTER,
+        .p2m.write = 1,
+        .p2m.read = 1,
+        .p2m.mattr = 0xf,
+        .p2m.table = 1,
+        .p2m.valid = 1,
+    };
+
+    ASSERT(!(pa & ~PAGE_MASK));
+    ASSERT(!(pa & ~PADDR_MASK));
+
+    e.bits |= pa;
+
+    return e;
+}
+
+/* Write a pagetable entry */
+static inline void write_pte(lpae_t *p, lpae_t pte)
+{
+    asm volatile (
+        /* Safely write the entry (STRD is atomic on CPUs that support LPAE) */
+        "strd %0, %H0, [%1];"
+        /* Push this cacheline to the PoC so the rest of the system sees it. */
+        STORE_CP32(1, DCCMVAC)
+        : : "r" (pte.bits), "r" (p) : "memory");
+}
+
+/*
+ * Flush all hypervisor mappings from the data TLB. This is not
+ * sufficient when changing code mappings or for self modifying code.
+ */
+static inline void flush_xen_data_tlb(void)
+{
+    register unsigned long r0 asm ("r0");
+    asm volatile("dsb;" /* Ensure preceding are visible */
+                 STORE_CP32(0, TLBIALLH)
+                 "dsb;" /* Ensure completion of the TLB flush */
+                 "isb;"
+                 : : "r" (r0) /* dummy */: "memory");
+}
+
+/*
+ * Flush one VA's hypervisor mappings from the data TLB. This is not
+ * sufficient when changing code mappings or for self modifying code.
+ */
+static inline void flush_xen_data_tlb_va(unsigned long va)
+{
+    asm volatile("dsb;" /* Ensure preceding are visible */
+                 STORE_CP32(0, TLBIMVAH)
+                 "dsb;" /* Ensure completion of the TLB flush */
+                 "isb;"
+                 : : "r" (va) : "memory");
+}
+
+/* Flush all non-hypervisor mappings from the TLB */
+static inline void flush_guest_tlb(void)
+{
+    register unsigned long r0 asm ("r0");
+    WRITE_CP32(r0 /* dummy */, TLBIALLNSNH);
+}
+
+/* Ask the MMU to translate a VA for us */
+static inline uint64_t __va_to_par(uint32_t va)
+{
+    uint64_t par, tmp;
+    tmp = READ_CP64(PAR);
+    WRITE_CP32(va, ATS1HR);
+    isb(); /* Ensure result is available. */
+    par = READ_CP64(PAR);
+    WRITE_CP64(tmp, PAR);
+    return par;
+}
+
+static inline uint64_t va_to_par(uint32_t va)
+{
+    uint64_t par = __va_to_par(va);
+    /* It is not OK to call this with an invalid VA */
+    if ( par & PAR_F ) panic_PAR(par, "Hypervisor");
+    return par;
+}
+
+/* Ask the MMU to translate a Guest VA for us */
+static inline uint64_t __gva_to_par(uint32_t va)
+{
+    uint64_t par, tmp;
+    tmp = READ_CP64(PAR);
+    WRITE_CP32(va, ATS12NSOPR);
+    isb(); /* Ensure result is available. */
+    par = READ_CP64(PAR);
+    WRITE_CP64(tmp, PAR);
+    return par;
+}
+static inline uint64_t gva_to_par(uint32_t va)
+{
+    uint64_t par = __gva_to_par(va);
+    /* It is not OK to call this with an invalid VA */
+    /* XXX harsh for a guest address... */
+    if ( par & PAR_F ) panic_PAR(par, "Guest");
+    return par;
+}
+static inline uint64_t __gva_to_ipa(uint32_t va)
+{
+    uint64_t par, tmp;
+    tmp = READ_CP64(PAR);
+    WRITE_CP32(va, ATS1CPR);
+    isb(); /* Ensure result is available. */
+    par = READ_CP64(PAR);
+    WRITE_CP64(tmp, PAR);
+    return par;
+}
+static inline uint64_t gva_to_ipa(uint32_t va)
+{
+    uint64_t par = __gva_to_ipa(va);
+    /* It is not OK to call this with an invalid VA */
+    /* XXX harsh for a guest address... */
+    if ( par & PAR_F ) panic_PAR(par, "Guest");
+    return (par & PADDR_MASK & PAGE_MASK) | ((unsigned long) va & ~PAGE_MASK);
+}
+/* Bits in the PAR returned by va_to_par */
+#define PAR_FAULT 0x1
+
+#endif /* __ASSEMBLY__ */
+
+/* These numbers add up to a 39-bit input address space.  The  ARMv7-A
+ * architecture actually specifies a 40-bit input address space for the p2m,
+ * with an 8K (1024-entry) top-level table. */
+
+#define LPAE_SHIFT      9
+#define LPAE_ENTRIES    (1u << LPAE_SHIFT)
+#define LPAE_ENTRY_MASK (LPAE_ENTRIES - 1)
+
+#define THIRD_SHIFT  PAGE_SHIFT
+#define SECOND_SHIFT (THIRD_SHIFT + LPAE_SHIFT)
+#define FIRST_SHIFT  (SECOND_SHIFT + LPAE_SHIFT)
+
+/* Calculate the offsets into the pagetables for a given VA */
+#define first_linear_offset(va) (va >> FIRST_SHIFT)
+#define second_linear_offset(va) (va >> SECOND_SHIFT)
+#define third_linear_offset(va) (va >> THIRD_SHIFT)
+#define first_table_offset(va) (first_linear_offset(va))
+#define second_table_offset(va) (second_linear_offset(va) & LPAE_ENTRY_MASK)
+#define third_table_offset(va) (third_linear_offset(va) & LPAE_ENTRY_MASK)
+
+#define clear_page(page)memset((void *)(page), 0, PAGE_SIZE)
+
+#define PAGE_ALIGN(x) (((x) + PAGE_SIZE - 1) & PAGE_MASK)
+
+#endif /* __ARM_PAGE_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:45 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQO-00067t-Em; Thu, 09 Feb 2012 16:00:44 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQM-00061x-Ux
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:43 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-216.messagelabs.com!1328803235!13583316!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8213 invoked from network); 9 Feb 2012 16:00:36 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:36 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQF-0004PX-7S
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:35 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQE-0006B5-V6
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:34 +0000
Message-Id: <E1RvWQE-0006B5-V6@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:34 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: early setup code
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787210 0
# Node ID a6ba766d6d4f84b203d9e849b496ba7b958593df
# Parent  cf2dbf91276ab3eb41efdf637215785c7491be17
arm: early setup code

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r cf2dbf91276a -r a6ba766d6d4f xen/arch/arm/setup.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/setup.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,206 @@
+/*
+ * xen/arch/arm/setup.c
+ *
+ * Early bringup code for an ARMv7-A with virt extensions.
+ *
+ * Tim Deegan <tim@xen.org>
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <xen/config.h>
+#include <xen/compile.h>
+#include <xen/domain_page.h>
+#include <xen/types.h>
+#include <xen/string.h>
+#include <xen/serial.h>
+#include <xen/sched.h>
+#include <xen/console.h>
+#include <xen/init.h>
+#include <xen/irq.h>
+#include <xen/mm.h>
+#include <xen/softirq.h>
+#include <xen/keyhandler.h>
+#include <xen/cpu.h>
+#include <asm/page.h>
+#include <asm/current.h>
+#include <asm/setup.h>
+#include "gic.h"
+
+/* maxcpus: maximum number of CPUs to activate. */
+static unsigned int __initdata max_cpus = NR_CPUS;
+
+/* Xen stack for bringing up the first CPU. */
+unsigned char init_stack[STACK_SIZE] __attribute__((__aligned__(STACK_SIZE)));
+
+extern char __init_begin[], __init_end[], __bss_start[];
+
+static __attribute_used__ void init_done(void)
+{
+    /* TODO: free (or page-protect) the init areas.
+       memset(__init_begin, 0xcc, __init_end - __init_begin);
+       free_xen_data(__init_begin, __init_end);
+    */
+    printk("Freed %ldkB init memory.\n", (long)(__init_end-__init_begin)>>10);
+
+    startup_cpu_idle_loop();
+}
+
+static void __init init_idle_domain(void)
+{
+        scheduler_init();
+        set_current(idle_vcpu[0]);
+        this_cpu(curr_vcpu) = current;
+        /* TODO: setup_idle_pagetable(); */
+}
+
+void __init start_xen(unsigned long boot_phys_offset,
+                      unsigned long arm_type,
+                      unsigned long atag_paddr)
+
+{
+    int i;
+
+    setup_pagetables(boot_phys_offset);
+
+#ifdef EARLY_UART_ADDRESS
+    /* Map the UART */
+    /* TODO Need to get device tree or command line for UART address */
+    set_fixmap(FIXMAP_CONSOLE, EARLY_UART_ADDRESS >> PAGE_SHIFT, DEV_SHARED);
+    pl011_init(0, FIXMAP_ADDR(FIXMAP_CONSOLE));
+    console_init_preirq();
+#endif
+
+    set_current((struct vcpu *)0xfffff000); /* debug sanity */
+    idle_vcpu[0] = current;
+    set_processor_id(0); /* needed early, for smp_processor_id() */
+
+    /* TODO: smp_prepare_boot_cpu(void) */
+    cpumask_set_cpu(smp_processor_id(), &cpu_online_map);
+    cpumask_set_cpu(smp_processor_id(), &cpu_present_map);
+
+    smp_prepare_cpus(max_cpus);
+
+    init_xen_time();
+
+    /* TODO: This needs some thought, as well as device-tree mapping.
+     * For testing, assume that the whole xenheap is contiguous in RAM */
+    setup_xenheap_mappings(0x8000000, 0x40000); /* 1 GB @ 512GB */
+    /* Must pass a single mapped page for populating bootmem_region_list. */
+    init_boot_pages(pfn_to_paddr(xenheap_mfn_start),
+                    pfn_to_paddr(xenheap_mfn_start+1));
+
+    /* Add non-xenheap memory */
+    init_boot_pages(0x8040000000, 0x80c0000000); /* 2 GB @513GB */
+
+    /* TODO Make sure Xen's own pages aren't added
+     *     -- the memory above doesn't include our relocation target.  */
+    /* TODO Handle payloads too */
+
+    /* TODO Need to find actual memory, for now use 4GB at 512GB */
+    setup_frametable_mappings(0x8000000000ULL, 0x8100000000UL);
+
+    /* Add xenheap memory */
+    init_xenheap_pages(pfn_to_paddr(xenheap_mfn_start+1),
+                       pfn_to_paddr(xenheap_mfn_end));
+
+    end_boot_allocator();
+
+    /* Setup Hyp vector base */
+    WRITE_CP32((uint32_t) hyp_traps_vector, HVBAR);
+    printk("Set hyp vector base to %"PRIx32" (expected %p)\n",
+           READ_CP32(HVBAR), hyp_traps_vector);
+
+    /* Setup Stage 2 address translation */
+    /* SH0=00, ORGN0=IRGN0=01
+     * SL0=01 (Level-1)
+     * T0SZ=(1)1000 = -8 (40 bit physical addresses)
+     */
+    WRITE_CP32(0x80002558, VTCR); isb();
+
+    softirq_init();
+    tasklet_subsys_init();
+
+    init_IRQ();
+
+    gic_init();
+
+    gic_route_irqs();
+
+    init_maintenance_interrupt();
+    init_timer_interrupt();
+
+    timer_init();
+
+    init_idle_domain();
+
+    rcu_init();
+
+    local_irq_enable();
+
+    initialize_keytable();
+
+    console_init_postirq();
+
+    do_presmp_initcalls();
+
+    for_each_present_cpu ( i )
+    {
+        if ( (num_online_cpus() < max_cpus) && !cpu_online(i) )
+        {
+            int ret = cpu_up(i);
+            if ( ret != 0 )
+                printk("Failed to bring up CPU %u (error %d)\n", i, ret);
+        }
+    }
+
+    printk("Brought up %ld CPUs\n", (long)num_online_cpus());
+    /* TODO: smp_cpus_done(); */
+
+    do_initcalls();
+
+    /* Create initial domain 0. */
+    dom0 = domain_create(0, 0, 0);
+    if ( dom0 == NULL )
+            printk("domain_create failed\n");
+    if ( (dom0 == NULL) || (alloc_dom0_vcpu0() == NULL) )
+            panic("Error creating domain 0\n");
+
+    dom0->is_privileged = 1;
+    dom0->target = NULL;
+
+    if ( construct_dom0(dom0) != 0)
+            panic("Could not set up DOM0 guest OS\n");
+
+    /* Scrub RAM that is still free and so may go to an unprivileged domain.
+       XXX too slow in simulator
+       scrub_heap_pages();
+    */
+
+    console_endboot();
+
+    /* Hide UART from DOM0 if we're using it */
+    serial_endboot();
+
+    domain_unpause_by_systemcontroller(dom0);
+
+    reset_stack_and_jump(init_done);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:45 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQO-00067t-Em; Thu, 09 Feb 2012 16:00:44 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQM-00061x-Ux
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:43 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-216.messagelabs.com!1328803235!13583316!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8213 invoked from network); 9 Feb 2012 16:00:36 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:36 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQF-0004PX-7S
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:35 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQE-0006B5-V6
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:34 +0000
Message-Id: <E1RvWQE-0006B5-V6@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:34 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: early setup code
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787210 0
# Node ID a6ba766d6d4f84b203d9e849b496ba7b958593df
# Parent  cf2dbf91276ab3eb41efdf637215785c7491be17
arm: early setup code

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r cf2dbf91276a -r a6ba766d6d4f xen/arch/arm/setup.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/setup.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,206 @@
+/*
+ * xen/arch/arm/setup.c
+ *
+ * Early bringup code for an ARMv7-A with virt extensions.
+ *
+ * Tim Deegan <tim@xen.org>
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <xen/config.h>
+#include <xen/compile.h>
+#include <xen/domain_page.h>
+#include <xen/types.h>
+#include <xen/string.h>
+#include <xen/serial.h>
+#include <xen/sched.h>
+#include <xen/console.h>
+#include <xen/init.h>
+#include <xen/irq.h>
+#include <xen/mm.h>
+#include <xen/softirq.h>
+#include <xen/keyhandler.h>
+#include <xen/cpu.h>
+#include <asm/page.h>
+#include <asm/current.h>
+#include <asm/setup.h>
+#include "gic.h"
+
+/* maxcpus: maximum number of CPUs to activate. */
+static unsigned int __initdata max_cpus = NR_CPUS;
+
+/* Xen stack for bringing up the first CPU. */
+unsigned char init_stack[STACK_SIZE] __attribute__((__aligned__(STACK_SIZE)));
+
+extern char __init_begin[], __init_end[], __bss_start[];
+
+static __attribute_used__ void init_done(void)
+{
+    /* TODO: free (or page-protect) the init areas.
+       memset(__init_begin, 0xcc, __init_end - __init_begin);
+       free_xen_data(__init_begin, __init_end);
+    */
+    printk("Freed %ldkB init memory.\n", (long)(__init_end-__init_begin)>>10);
+
+    startup_cpu_idle_loop();
+}
+
+static void __init init_idle_domain(void)
+{
+        scheduler_init();
+        set_current(idle_vcpu[0]);
+        this_cpu(curr_vcpu) = current;
+        /* TODO: setup_idle_pagetable(); */
+}
+
+void __init start_xen(unsigned long boot_phys_offset,
+                      unsigned long arm_type,
+                      unsigned long atag_paddr)
+
+{
+    int i;
+
+    setup_pagetables(boot_phys_offset);
+
+#ifdef EARLY_UART_ADDRESS
+    /* Map the UART */
+    /* TODO Need to get device tree or command line for UART address */
+    set_fixmap(FIXMAP_CONSOLE, EARLY_UART_ADDRESS >> PAGE_SHIFT, DEV_SHARED);
+    pl011_init(0, FIXMAP_ADDR(FIXMAP_CONSOLE));
+    console_init_preirq();
+#endif
+
+    set_current((struct vcpu *)0xfffff000); /* debug sanity */
+    idle_vcpu[0] = current;
+    set_processor_id(0); /* needed early, for smp_processor_id() */
+
+    /* TODO: smp_prepare_boot_cpu(void) */
+    cpumask_set_cpu(smp_processor_id(), &cpu_online_map);
+    cpumask_set_cpu(smp_processor_id(), &cpu_present_map);
+
+    smp_prepare_cpus(max_cpus);
+
+    init_xen_time();
+
+    /* TODO: This needs some thought, as well as device-tree mapping.
+     * For testing, assume that the whole xenheap is contiguous in RAM */
+    setup_xenheap_mappings(0x8000000, 0x40000); /* 1 GB @ 512GB */
+    /* Must pass a single mapped page for populating bootmem_region_list. */
+    init_boot_pages(pfn_to_paddr(xenheap_mfn_start),
+                    pfn_to_paddr(xenheap_mfn_start+1));
+
+    /* Add non-xenheap memory */
+    init_boot_pages(0x8040000000, 0x80c0000000); /* 2 GB @513GB */
+
+    /* TODO Make sure Xen's own pages aren't added
+     *     -- the memory above doesn't include our relocation target.  */
+    /* TODO Handle payloads too */
+
+    /* TODO Need to find actual memory, for now use 4GB at 512GB */
+    setup_frametable_mappings(0x8000000000ULL, 0x8100000000UL);
+
+    /* Add xenheap memory */
+    init_xenheap_pages(pfn_to_paddr(xenheap_mfn_start+1),
+                       pfn_to_paddr(xenheap_mfn_end));
+
+    end_boot_allocator();
+
+    /* Setup Hyp vector base */
+    WRITE_CP32((uint32_t) hyp_traps_vector, HVBAR);
+    printk("Set hyp vector base to %"PRIx32" (expected %p)\n",
+           READ_CP32(HVBAR), hyp_traps_vector);
+
+    /* Setup Stage 2 address translation */
+    /* SH0=00, ORGN0=IRGN0=01
+     * SL0=01 (Level-1)
+     * T0SZ=(1)1000 = -8 (40 bit physical addresses)
+     */
+    WRITE_CP32(0x80002558, VTCR); isb();
+
+    softirq_init();
+    tasklet_subsys_init();
+
+    init_IRQ();
+
+    gic_init();
+
+    gic_route_irqs();
+
+    init_maintenance_interrupt();
+    init_timer_interrupt();
+
+    timer_init();
+
+    init_idle_domain();
+
+    rcu_init();
+
+    local_irq_enable();
+
+    initialize_keytable();
+
+    console_init_postirq();
+
+    do_presmp_initcalls();
+
+    for_each_present_cpu ( i )
+    {
+        if ( (num_online_cpus() < max_cpus) && !cpu_online(i) )
+        {
+            int ret = cpu_up(i);
+            if ( ret != 0 )
+                printk("Failed to bring up CPU %u (error %d)\n", i, ret);
+        }
+    }
+
+    printk("Brought up %ld CPUs\n", (long)num_online_cpus());
+    /* TODO: smp_cpus_done(); */
+
+    do_initcalls();
+
+    /* Create initial domain 0. */
+    dom0 = domain_create(0, 0, 0);
+    if ( dom0 == NULL )
+            printk("domain_create failed\n");
+    if ( (dom0 == NULL) || (alloc_dom0_vcpu0() == NULL) )
+            panic("Error creating domain 0\n");
+
+    dom0->is_privileged = 1;
+    dom0->target = NULL;
+
+    if ( construct_dom0(dom0) != 0)
+            panic("Could not set up DOM0 guest OS\n");
+
+    /* Scrub RAM that is still free and so may go to an unprivileged domain.
+       XXX too slow in simulator
+       scrub_heap_pages();
+    */
+
+    console_endboot();
+
+    /* Hide UART from DOM0 if we're using it */
+    serial_endboot();
+
+    domain_unpause_by_systemcontroller(dom0);
+
+    reset_stack_and_jump(init_done);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:45 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQO-000684-HI; Thu, 09 Feb 2012 16:00:44 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQN-000622-89
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:43 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1328803235!12645653!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16370 invoked from network); 9 Feb 2012 16:00:36 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:36 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQF-0004Pb-OI
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:35 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQF-0006BY-LK
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:35 +0000
Message-Id: <E1RvWQF-0006BY-LK@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:35 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: shutdown, smp and smpboot
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787210 0
# Node ID d112c692b49599ecdbb6d8c86e910f26cd485ffc
# Parent  a6ba766d6d4f84b203d9e849b496ba7b958593df
arm: shutdown, smp and smpboot

Dummy implementation of machine_* and smp_*

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r a6ba766d6d4f -r d112c692b495 xen/arch/arm/shutdown.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/shutdown.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,23 @@
+#include <xen/config.h>
+#include <xen/lib.h>
+
+void machine_halt(void)
+{
+        /* TODO: halt */
+        while(1) ;
+}
+
+void machine_restart(unsigned int delay_millisecs)
+{
+        /* TODO: restart */
+        printk("Cannot restart yet\n");
+        while(1);
+}
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r a6ba766d6d4f -r d112c692b495 xen/arch/arm/smp.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/smp.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,29 @@
+#include <xen/config.h>
+#include <asm/smp.h>
+
+void smp_call_function(
+    void (*func) (void *info),
+    void *info,
+    int wait)
+{
+    /* TODO: No SMP just now, does not include self so nothing to do.
+       cpumask_t allbutself = cpu_online_map;
+       cpu_clear(smp_processor_id(), allbutself);
+       on_selected_cpus(&allbutself, func, info, wait);
+    */
+}
+void smp_send_event_check_mask(const cpumask_t *mask)
+{
+    /* TODO: No SMP just now, does not include self so nothing to do.
+       send_IPI_mask(mask, EVENT_CHECK_VECTOR);
+    */
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r a6ba766d6d4f -r d112c692b495 xen/arch/arm/smpboot.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/smpboot.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,50 @@
+/*
+ * xen/arch/arm/smpboot.c
+ *
+ * Dummy smpboot support
+ *
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <xen/cpumask.h>
+#include <xen/smp.h>
+#include <xen/init.h>
+
+cpumask_t cpu_online_map;
+EXPORT_SYMBOL(cpu_online_map);
+cpumask_t cpu_present_map;
+EXPORT_SYMBOL(cpu_online_map);
+cpumask_t cpu_possible_map;
+EXPORT_SYMBOL(cpu_possible_map);
+
+void __init
+smp_prepare_cpus (unsigned int max_cpus)
+{
+        set_processor_id(0); /* needed early, for smp_processor_id() */
+
+        cpumask_clear(&cpu_online_map);
+        cpumask_clear(&cpu_present_map);
+        cpumask_clear(&cpu_possible_map);
+        cpumask_set_cpu(0, &cpu_online_map);
+        cpumask_set_cpu(0, &cpu_present_map);
+        cpumask_set_cpu(0, &cpu_possible_map);
+        return;
+}
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:45 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQO-000684-HI; Thu, 09 Feb 2012 16:00:44 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQN-000622-89
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:43 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1328803235!12645653!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16370 invoked from network); 9 Feb 2012 16:00:36 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:36 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQF-0004Pb-OI
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:35 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQF-0006BY-LK
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:35 +0000
Message-Id: <E1RvWQF-0006BY-LK@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:35 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: shutdown, smp and smpboot
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787210 0
# Node ID d112c692b49599ecdbb6d8c86e910f26cd485ffc
# Parent  a6ba766d6d4f84b203d9e849b496ba7b958593df
arm: shutdown, smp and smpboot

Dummy implementation of machine_* and smp_*

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r a6ba766d6d4f -r d112c692b495 xen/arch/arm/shutdown.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/shutdown.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,23 @@
+#include <xen/config.h>
+#include <xen/lib.h>
+
+void machine_halt(void)
+{
+        /* TODO: halt */
+        while(1) ;
+}
+
+void machine_restart(unsigned int delay_millisecs)
+{
+        /* TODO: restart */
+        printk("Cannot restart yet\n");
+        while(1);
+}
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r a6ba766d6d4f -r d112c692b495 xen/arch/arm/smp.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/smp.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,29 @@
+#include <xen/config.h>
+#include <asm/smp.h>
+
+void smp_call_function(
+    void (*func) (void *info),
+    void *info,
+    int wait)
+{
+    /* TODO: No SMP just now, does not include self so nothing to do.
+       cpumask_t allbutself = cpu_online_map;
+       cpu_clear(smp_processor_id(), allbutself);
+       on_selected_cpus(&allbutself, func, info, wait);
+    */
+}
+void smp_send_event_check_mask(const cpumask_t *mask)
+{
+    /* TODO: No SMP just now, does not include self so nothing to do.
+       send_IPI_mask(mask, EVENT_CHECK_VECTOR);
+    */
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r a6ba766d6d4f -r d112c692b495 xen/arch/arm/smpboot.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/smpboot.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,50 @@
+/*
+ * xen/arch/arm/smpboot.c
+ *
+ * Dummy smpboot support
+ *
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <xen/cpumask.h>
+#include <xen/smp.h>
+#include <xen/init.h>
+
+cpumask_t cpu_online_map;
+EXPORT_SYMBOL(cpu_online_map);
+cpumask_t cpu_present_map;
+EXPORT_SYMBOL(cpu_online_map);
+cpumask_t cpu_possible_map;
+EXPORT_SYMBOL(cpu_possible_map);
+
+void __init
+smp_prepare_cpus (unsigned int max_cpus)
+{
+        set_processor_id(0); /* needed early, for smp_processor_id() */
+
+        cpumask_clear(&cpu_online_map);
+        cpumask_clear(&cpu_present_map);
+        cpumask_clear(&cpu_possible_map);
+        cpumask_set_cpu(0, &cpu_online_map);
+        cpumask_set_cpu(0, &cpu_present_map);
+        cpumask_set_cpu(0, &cpu_possible_map);
+        return;
+}
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:47 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQP-00069y-SJ; Thu, 09 Feb 2012 16:00:45 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQO-00062x-QQ
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:45 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-21.messagelabs.com!1328803236!12178310!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26771 invoked from network); 9 Feb 2012 16:00:37 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:37 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQG-0004Ph-Ep
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:36 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQG-0006C0-BV
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:36 +0000
Message-Id: <E1RvWQG-0006C0-BV@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:35 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: driver for the generic timer
	for ARMv7
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787210 0
# Node ID d8d5dece1afdde05d176dd7bce414139d786fa4f
# Parent  d112c692b49599ecdbb6d8c86e910f26cd485ffc
arm: driver for the generic timer for ARMv7

Driver for the generic timer for ARMv7 with virtualization extensions.
Currently it is based on the kernel timer rather than the hypervisor timer
because the latter does not work correctly on our test environment.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r d112c692b495 -r d8d5dece1afd xen/arch/arm/time.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/time.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,181 @@
+/*
+ * xen/arch/arm/time.c
+ *
+ * Time and timer support, using the ARM Generic Timer interfaces
+ *
+ * Tim Deegan <tim@xen.org>
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <xen/config.h>
+#include <xen/console.h>
+#include <xen/init.h>
+#include <xen/irq.h>
+#include <xen/lib.h>
+#include <xen/mm.h>
+#include <xen/softirq.h>
+#include <xen/time.h>
+#include <asm/system.h>
+
+/* Unfortunately the hypervisor timer interrupt appears to be buggy */
+#define USE_HYP_TIMER 0
+
+/* For fine-grained timekeeping, we use the ARM "Generic Timer", a
+ * register-mapped time source in the SoC. */
+static uint32_t __read_mostly cntfrq;      /* Ticks per second */
+static uint64_t __read_mostly boot_count;  /* Counter value at boot time */
+
+/*static inline*/ s_time_t ticks_to_ns(uint64_t ticks)
+{
+    return muldiv64(ticks, SECONDS(1), cntfrq);
+}
+
+/*static inline*/ uint64_t ns_to_ticks(s_time_t ns)
+{
+    return muldiv64(ns, cntfrq, SECONDS(1));
+}
+
+/* TODO: On a real system the firmware would have set the frequency in
+   the CNTFRQ register.  Also we'd need to use devicetree to find
+   the RTC.  When we've seen some real systems, we can delete this.
+static uint32_t calibrate_timer(void)
+{
+    uint32_t sec;
+    uint64_t start, end;
+    paddr_t rtc_base = 0x1C170000ull;
+    volatile uint32_t *rtc;
+
+    ASSERT(!local_irq_is_enabled());
+    set_fixmap(FIXMAP_MISC, rtc_base >> PAGE_SHIFT, DEV_SHARED);
+    rtc = (uint32_t *) FIXMAP_ADDR(FIXMAP_MISC);
+
+    printk("Calibrating timer against RTC...");
+    // Turn on the RTC
+    rtc[3] = 1;
+    // Wait for an edge
+    sec = rtc[0] + 1;
+    do {} while ( rtc[0] != sec );
+    // Now time a few seconds
+    start = READ_CP64(CNTPCT);
+    do {} while ( rtc[0] < sec + 32 );
+    end = READ_CP64(CNTPCT);
+    printk("done.\n");
+
+    clear_fixmap(FIXMAP_MISC);
+    return (end - start) / 32;
+}
+*/
+
+/* Set up the timer on the boot CPU */
+int __init init_xen_time(void)
+{
+    /* Check that this CPU supports the Generic Timer interface */
+    if ( (READ_CP32(ID_PFR1) & ID_PFR1_GT_MASK) != ID_PFR1_GT_v1 )
+        panic("CPU does not support the Generic Timer v1 interface.\n");
+
+    cntfrq = READ_CP32(CNTFRQ);
+    boot_count = READ_CP64(CNTPCT);
+    printk("Using generic timer at %"PRIu32" Hz\n", cntfrq);
+
+    return 0;
+}
+
+/* Return number of nanoseconds since boot */
+s_time_t get_s_time(void)
+{
+    uint64_t ticks = READ_CP64(CNTPCT) - boot_count;
+    return ticks_to_ns(ticks);
+}
+
+/* Set the timer to wake us up at a particular time.
+ * Timeout is a Xen system time (nanoseconds since boot); 0 disables the timer.
+ * Returns 1 on success; 0 if the timeout is too soon or is in the past. */
+int reprogram_timer(s_time_t timeout)
+{
+    uint64_t deadline;
+
+    if ( timeout == 0 )
+    {
+#if USE_HYP_TIMER
+        WRITE_CP32(0, CNTHP_CTL);
+#else
+        WRITE_CP32(0, CNTP_CTL);
+#endif
+        return 1;
+    }
+
+    deadline = ns_to_ticks(timeout) + boot_count;
+#if USE_HYP_TIMER
+    WRITE_CP64(deadline, CNTHP_CVAL);
+    WRITE_CP32(CNTx_CTL_ENABLE, CNTHP_CTL);
+#else
+    WRITE_CP64(deadline, CNTP_CVAL);
+    WRITE_CP32(CNTx_CTL_ENABLE, CNTP_CTL);
+#endif
+    isb();
+
+    /* No need to check for timers in the past; the Generic Timer fires
+     * on a signed 63-bit comparison. */
+    return 1;
+}
+
+/* Handle the firing timer */
+static void timer_interrupt(int irq, void *dev_id, struct cpu_user_regs *regs)
+{
+    if ( irq == 26 && READ_CP32(CNTHP_CTL) & CNTx_CTL_PENDING )
+    {
+        /* Signal the generic timer code to do its work */
+        raise_softirq(TIMER_SOFTIRQ);
+        /* Disable the timer to avoid more interrupts */
+        WRITE_CP32(0, CNTHP_CTL);
+    }
+
+    if (irq == 30 && READ_CP32(CNTP_CTL) & CNTx_CTL_PENDING )
+    {
+        /* Signal the generic timer code to do its work */
+        raise_softirq(TIMER_SOFTIRQ);
+        /* Disable the timer to avoid more interrupts */
+        WRITE_CP32(0, CNTP_CTL);
+    }
+}
+
+/* Set up the timer interrupt on this CPU */
+void __cpuinit init_timer_interrupt(void)
+{
+    /* Sensible defaults */
+    WRITE_CP64(0, CNTVOFF);     /* No VM-specific offset */
+    WRITE_CP32(0, CNTKCTL);     /* No user-mode access */
+#if USE_HYP_TIMER
+    /* Let the VMs read the physical counter and timer so they can tell time */
+    WRITE_CP32(CNTHCTL_PA|CNTHCTL_TA, CNTHCTL);
+#else
+    /* Cannot let VMs access physical counter if we are using it */
+    WRITE_CP32(0, CNTHCTL);
+#endif
+    WRITE_CP32(0, CNTP_CTL);    /* Physical timer disabled */
+    WRITE_CP32(0, CNTHP_CTL);   /* Hypervisor's timer disabled */
+    isb();
+
+    /* XXX Need to find this IRQ number from devicetree? */
+    request_irq(26, timer_interrupt, 0, "hyptimer", NULL);
+    request_irq(30, timer_interrupt, 0, "phytimer", NULL);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r d112c692b495 -r d8d5dece1afd xen/include/asm-arm/time.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/time.h	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,26 @@
+#ifndef __ARM_TIME_H__
+#define __ARM_TIME_H__
+
+typedef unsigned long cycles_t;
+
+static inline cycles_t get_cycles (void)
+{
+        return 0;
+}
+
+struct tm;
+struct tm wallclock_time(void);
+
+
+/* Set up the timer interrupt on this CPU */
+extern void __cpuinit init_timer_interrupt(void);
+
+#endif /* __ARM_TIME_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:47 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQP-00069y-SJ; Thu, 09 Feb 2012 16:00:45 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQO-00062x-QQ
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:45 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-21.messagelabs.com!1328803236!12178310!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26771 invoked from network); 9 Feb 2012 16:00:37 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:37 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQG-0004Ph-Ep
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:36 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQG-0006C0-BV
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:36 +0000
Message-Id: <E1RvWQG-0006C0-BV@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:35 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: driver for the generic timer
	for ARMv7
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787210 0
# Node ID d8d5dece1afdde05d176dd7bce414139d786fa4f
# Parent  d112c692b49599ecdbb6d8c86e910f26cd485ffc
arm: driver for the generic timer for ARMv7

Driver for the generic timer for ARMv7 with virtualization extensions.
Currently it is based on the kernel timer rather than the hypervisor timer
because the latter does not work correctly on our test environment.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r d112c692b495 -r d8d5dece1afd xen/arch/arm/time.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/time.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,181 @@
+/*
+ * xen/arch/arm/time.c
+ *
+ * Time and timer support, using the ARM Generic Timer interfaces
+ *
+ * Tim Deegan <tim@xen.org>
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <xen/config.h>
+#include <xen/console.h>
+#include <xen/init.h>
+#include <xen/irq.h>
+#include <xen/lib.h>
+#include <xen/mm.h>
+#include <xen/softirq.h>
+#include <xen/time.h>
+#include <asm/system.h>
+
+/* Unfortunately the hypervisor timer interrupt appears to be buggy */
+#define USE_HYP_TIMER 0
+
+/* For fine-grained timekeeping, we use the ARM "Generic Timer", a
+ * register-mapped time source in the SoC. */
+static uint32_t __read_mostly cntfrq;      /* Ticks per second */
+static uint64_t __read_mostly boot_count;  /* Counter value at boot time */
+
+/*static inline*/ s_time_t ticks_to_ns(uint64_t ticks)
+{
+    return muldiv64(ticks, SECONDS(1), cntfrq);
+}
+
+/*static inline*/ uint64_t ns_to_ticks(s_time_t ns)
+{
+    return muldiv64(ns, cntfrq, SECONDS(1));
+}
+
+/* TODO: On a real system the firmware would have set the frequency in
+   the CNTFRQ register.  Also we'd need to use devicetree to find
+   the RTC.  When we've seen some real systems, we can delete this.
+static uint32_t calibrate_timer(void)
+{
+    uint32_t sec;
+    uint64_t start, end;
+    paddr_t rtc_base = 0x1C170000ull;
+    volatile uint32_t *rtc;
+
+    ASSERT(!local_irq_is_enabled());
+    set_fixmap(FIXMAP_MISC, rtc_base >> PAGE_SHIFT, DEV_SHARED);
+    rtc = (uint32_t *) FIXMAP_ADDR(FIXMAP_MISC);
+
+    printk("Calibrating timer against RTC...");
+    // Turn on the RTC
+    rtc[3] = 1;
+    // Wait for an edge
+    sec = rtc[0] + 1;
+    do {} while ( rtc[0] != sec );
+    // Now time a few seconds
+    start = READ_CP64(CNTPCT);
+    do {} while ( rtc[0] < sec + 32 );
+    end = READ_CP64(CNTPCT);
+    printk("done.\n");
+
+    clear_fixmap(FIXMAP_MISC);
+    return (end - start) / 32;
+}
+*/
+
+/* Set up the timer on the boot CPU */
+int __init init_xen_time(void)
+{
+    /* Check that this CPU supports the Generic Timer interface */
+    if ( (READ_CP32(ID_PFR1) & ID_PFR1_GT_MASK) != ID_PFR1_GT_v1 )
+        panic("CPU does not support the Generic Timer v1 interface.\n");
+
+    cntfrq = READ_CP32(CNTFRQ);
+    boot_count = READ_CP64(CNTPCT);
+    printk("Using generic timer at %"PRIu32" Hz\n", cntfrq);
+
+    return 0;
+}
+
+/* Return number of nanoseconds since boot */
+s_time_t get_s_time(void)
+{
+    uint64_t ticks = READ_CP64(CNTPCT) - boot_count;
+    return ticks_to_ns(ticks);
+}
+
+/* Set the timer to wake us up at a particular time.
+ * Timeout is a Xen system time (nanoseconds since boot); 0 disables the timer.
+ * Returns 1 on success; 0 if the timeout is too soon or is in the past. */
+int reprogram_timer(s_time_t timeout)
+{
+    uint64_t deadline;
+
+    if ( timeout == 0 )
+    {
+#if USE_HYP_TIMER
+        WRITE_CP32(0, CNTHP_CTL);
+#else
+        WRITE_CP32(0, CNTP_CTL);
+#endif
+        return 1;
+    }
+
+    deadline = ns_to_ticks(timeout) + boot_count;
+#if USE_HYP_TIMER
+    WRITE_CP64(deadline, CNTHP_CVAL);
+    WRITE_CP32(CNTx_CTL_ENABLE, CNTHP_CTL);
+#else
+    WRITE_CP64(deadline, CNTP_CVAL);
+    WRITE_CP32(CNTx_CTL_ENABLE, CNTP_CTL);
+#endif
+    isb();
+
+    /* No need to check for timers in the past; the Generic Timer fires
+     * on a signed 63-bit comparison. */
+    return 1;
+}
+
+/* Handle the firing timer */
+static void timer_interrupt(int irq, void *dev_id, struct cpu_user_regs *regs)
+{
+    if ( irq == 26 && READ_CP32(CNTHP_CTL) & CNTx_CTL_PENDING )
+    {
+        /* Signal the generic timer code to do its work */
+        raise_softirq(TIMER_SOFTIRQ);
+        /* Disable the timer to avoid more interrupts */
+        WRITE_CP32(0, CNTHP_CTL);
+    }
+
+    if (irq == 30 && READ_CP32(CNTP_CTL) & CNTx_CTL_PENDING )
+    {
+        /* Signal the generic timer code to do its work */
+        raise_softirq(TIMER_SOFTIRQ);
+        /* Disable the timer to avoid more interrupts */
+        WRITE_CP32(0, CNTP_CTL);
+    }
+}
+
+/* Set up the timer interrupt on this CPU */
+void __cpuinit init_timer_interrupt(void)
+{
+    /* Sensible defaults */
+    WRITE_CP64(0, CNTVOFF);     /* No VM-specific offset */
+    WRITE_CP32(0, CNTKCTL);     /* No user-mode access */
+#if USE_HYP_TIMER
+    /* Let the VMs read the physical counter and timer so they can tell time */
+    WRITE_CP32(CNTHCTL_PA|CNTHCTL_TA, CNTHCTL);
+#else
+    /* Cannot let VMs access physical counter if we are using it */
+    WRITE_CP32(0, CNTHCTL);
+#endif
+    WRITE_CP32(0, CNTP_CTL);    /* Physical timer disabled */
+    WRITE_CP32(0, CNTHP_CTL);   /* Hypervisor's timer disabled */
+    isb();
+
+    /* XXX Need to find this IRQ number from devicetree? */
+    request_irq(26, timer_interrupt, 0, "hyptimer", NULL);
+    request_irq(30, timer_interrupt, 0, "phytimer", NULL);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r d112c692b495 -r d8d5dece1afd xen/include/asm-arm/time.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/time.h	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,26 @@
+#ifndef __ARM_TIME_H__
+#define __ARM_TIME_H__
+
+typedef unsigned long cycles_t;
+
+static inline cycles_t get_cycles (void)
+{
+        return 0;
+}
+
+struct tm;
+struct tm wallclock_time(void);
+
+
+/* Set up the timer interrupt on this CPU */
+extern void __cpuinit init_timer_interrupt(void);
+
+#endif /* __ARM_TIME_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:49 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQS-0006D2-VO; Thu, 09 Feb 2012 16:00:48 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQR-00065q-Sb
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:48 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-216.messagelabs.com!1328803239!13583330!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8572 invoked from network); 9 Feb 2012 16:00:41 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:41 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQJ-0004Ps-QC
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:39 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQJ-0006DP-LX
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:39 +0000
Message-Id: <E1RvWQJ-0006DP-LX@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:39 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: vtimer
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787210 0
# Node ID 18b9ea53c8ac0e2d6aee68dd50a50c0b08a01a1e
# Parent  e8b7d44947e4fe07b5934b72eaa081ca5c4e637e
arm: vtimer

Emulation of the generic timer kernel registers.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r e8b7d44947e4 -r 18b9ea53c8ac xen/arch/arm/domain.c
--- a/xen/arch/arm/domain.c	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/arch/arm/domain.c	Thu Feb 09 11:33:30 2012 +0000
@@ -12,6 +12,7 @@
 #include <asm/irq.h>
 
 #include "gic.h"
+#include "vtimer.h"
 
 DEFINE_PER_CPU(struct vcpu *, curr_vcpu);
 
@@ -215,6 +216,9 @@
     if ( (rc = vcpu_vgic_init(v)) != 0 )
         return rc;
 
+    if ( (rc = vcpu_vtimer_init(v)) != 0 )
+        return rc;
+
     return rc;
 }
 
diff -r e8b7d44947e4 -r 18b9ea53c8ac xen/arch/arm/traps.c
--- a/xen/arch/arm/traps.c	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/arch/arm/traps.c	Thu Feb 09 11:33:30 2012 +0000
@@ -468,7 +468,7 @@
         break;
     case HSR_CPREG32(CNTP_CTL):
     case HSR_CPREG32(CNTP_TVAL):
-        /* emulate timer */
+        BUG_ON(!vtimer_emulate(regs, hsr));
         break;
     default:
         printk("%s p15, %d, r%d, cr%d, cr%d, %d @ %#08x\n",
@@ -498,7 +498,7 @@
     switch ( hsr.bits & HSR_CP64_REGS_MASK )
     {
     case HSR_CPREG64(CNTPCT):
-        /* emulate timer */
+        BUG_ON(!vtimer_emulate(regs, hsr));
         break;
     default:
         printk("%s p15, %d, r%d, r%d, cr%d @ %#08x\n",
diff -r e8b7d44947e4 -r 18b9ea53c8ac xen/arch/arm/vtimer.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/vtimer.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,148 @@
+/*
+ * xen/arch/arm/vtimer.c
+ *
+ * ARM Virtual Timer emulation support
+ *
+ * Ian Campbell <ian.campbell@citrix.com>
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <xen/config.h>
+#include <xen/lib.h>
+#include <xen/timer.h>
+#include <xen/sched.h>
+#include "gic.h"
+
+extern s_time_t ticks_to_ns(uint64_t ticks);
+extern uint64_t ns_to_ticks(s_time_t ns);
+
+static void vtimer_expired(void *data)
+{
+    struct vcpu *v = data;
+    v->arch.vtimer.ctl |= CNTx_CTL_PENDING;
+    v->arch.vtimer.ctl &= ~CNTx_CTL_MASK;
+    vgic_vcpu_inject_irq(v, 30, 1);
+}
+
+int vcpu_vtimer_init(struct vcpu *v)
+{
+    init_timer(&v->arch.vtimer.timer,
+               vtimer_expired, v,
+               smp_processor_id());
+    v->arch.vtimer.ctl = 0;
+    v->arch.vtimer.offset = NOW();
+    v->arch.vtimer.cval = NOW();
+    return 0;
+}
+
+static int vtimer_emulate_32(struct cpu_user_regs *regs, union hsr hsr)
+{
+    struct vcpu *v = current;
+    struct hsr_cp32 cp32 = hsr.cp32;
+    uint32_t *r = &regs->r0 + cp32.reg;
+    s_time_t now;
+
+    switch ( hsr.bits & HSR_CP32_REGS_MASK )
+    {
+    case HSR_CPREG32(CNTP_CTL):
+        if ( cp32.read )
+        {
+            *r = v->arch.vtimer.ctl;
+        }
+        else
+        {
+            v->arch.vtimer.ctl = *r;
+
+            if ( v->arch.vtimer.ctl & CNTx_CTL_ENABLE )
+            {
+                set_timer(&v->arch.vtimer.timer,
+                          v->arch.vtimer.cval + v->arch.vtimer.offset);
+            }
+            else
+                stop_timer(&v->arch.vtimer.timer);
+        }
+
+        return 1;
+
+    case HSR_CPREG32(CNTP_TVAL):
+        now = NOW() - v->arch.vtimer.offset;
+        if ( cp32.read )
+        {
+            *r = (uint32_t)(ns_to_ticks(v->arch.vtimer.cval - now) & 0xffffffffull);
+        }
+        else
+        {
+            v->arch.vtimer.cval = now + ticks_to_ns(*r);
+            if ( v->arch.vtimer.ctl & CNTx_CTL_ENABLE )
+            {
+                set_timer(&v->arch.vtimer.timer,
+                          v->arch.vtimer.cval + v->arch.vtimer.offset);
+            }
+        }
+
+        return 1;
+
+    default:
+        return 0;
+    }
+}
+
+static int vtimer_emulate_64(struct cpu_user_regs *regs, union hsr hsr)
+{
+    struct vcpu *v = current;
+    struct hsr_cp64 cp64 = hsr.cp64;
+    uint32_t *r1 = &regs->r0 + cp64.reg1;
+    uint32_t *r2 = &regs->r0 + cp64.reg2;
+    s_time_t now;
+
+    switch ( hsr.bits & HSR_CP64_REGS_MASK )
+    {
+    case HSR_CPREG64(CNTPCT):
+        if ( cp64.read )
+        {
+            now = NOW() - v->arch.vtimer.offset;
+            *r1 = (uint32_t)(now & 0xffffffff);
+            *r2 = (uint32_t)(now >> 32);
+            return 1;
+        }
+        else
+        {
+            printk("READ from R/O CNTPCT\n");
+            return 0;
+        }
+
+    default:
+        return 0;
+    }
+}
+
+int vtimer_emulate(struct cpu_user_regs *regs, union hsr hsr)
+{
+    switch (hsr.ec) {
+    case HSR_EC_CP15_32:
+        return vtimer_emulate_32(regs, hsr);
+    case HSR_EC_CP15_64:
+        return vtimer_emulate_64(regs, hsr);
+    default:
+        return 0;
+    }
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e8b7d44947e4 -r 18b9ea53c8ac xen/arch/arm/vtimer.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/vtimer.h	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,35 @@
+/*
+ * xen/arch/arm/vtimer.h
+ *
+ * ARM Virtual Timer emulation support
+ *
+ * Ian Campbell <ian.campbell@citrix.com>
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#ifndef __ARCH_ARM_VTIMER_H__
+#define __ARCH_ARM_VTIMER_H__
+
+extern int vcpu_vtimer_init(struct vcpu *v);
+extern int vtimer_emulate(struct cpu_user_regs *regs, union hsr hsr);
+
+#endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e8b7d44947e4 -r 18b9ea53c8ac xen/include/asm-arm/domain.h
--- a/xen/include/asm-arm/domain.h	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/include/asm-arm/domain.h	Thu Feb 09 11:33:30 2012 +0000
@@ -57,6 +57,13 @@
         struct list_head inflight_irqs;
         spinlock_t lock;
     } vgic;
+
+    struct {
+        struct timer timer;
+        uint32_t ctl;
+        s_time_t offset;
+        s_time_t cval;
+    } vtimer;
 }  __cacheline_aligned;
 
 void vcpu_show_execution_state(struct vcpu *);

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:49 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQS-0006D2-VO; Thu, 09 Feb 2012 16:00:48 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQR-00065q-Sb
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:48 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-216.messagelabs.com!1328803239!13583330!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8572 invoked from network); 9 Feb 2012 16:00:41 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:41 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQJ-0004Ps-QC
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:39 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQJ-0006DP-LX
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:39 +0000
Message-Id: <E1RvWQJ-0006DP-LX@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:39 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: vtimer
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787210 0
# Node ID 18b9ea53c8ac0e2d6aee68dd50a50c0b08a01a1e
# Parent  e8b7d44947e4fe07b5934b72eaa081ca5c4e637e
arm: vtimer

Emulation of the generic timer kernel registers.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r e8b7d44947e4 -r 18b9ea53c8ac xen/arch/arm/domain.c
--- a/xen/arch/arm/domain.c	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/arch/arm/domain.c	Thu Feb 09 11:33:30 2012 +0000
@@ -12,6 +12,7 @@
 #include <asm/irq.h>
 
 #include "gic.h"
+#include "vtimer.h"
 
 DEFINE_PER_CPU(struct vcpu *, curr_vcpu);
 
@@ -215,6 +216,9 @@
     if ( (rc = vcpu_vgic_init(v)) != 0 )
         return rc;
 
+    if ( (rc = vcpu_vtimer_init(v)) != 0 )
+        return rc;
+
     return rc;
 }
 
diff -r e8b7d44947e4 -r 18b9ea53c8ac xen/arch/arm/traps.c
--- a/xen/arch/arm/traps.c	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/arch/arm/traps.c	Thu Feb 09 11:33:30 2012 +0000
@@ -468,7 +468,7 @@
         break;
     case HSR_CPREG32(CNTP_CTL):
     case HSR_CPREG32(CNTP_TVAL):
-        /* emulate timer */
+        BUG_ON(!vtimer_emulate(regs, hsr));
         break;
     default:
         printk("%s p15, %d, r%d, cr%d, cr%d, %d @ %#08x\n",
@@ -498,7 +498,7 @@
     switch ( hsr.bits & HSR_CP64_REGS_MASK )
     {
     case HSR_CPREG64(CNTPCT):
-        /* emulate timer */
+        BUG_ON(!vtimer_emulate(regs, hsr));
         break;
     default:
         printk("%s p15, %d, r%d, r%d, cr%d @ %#08x\n",
diff -r e8b7d44947e4 -r 18b9ea53c8ac xen/arch/arm/vtimer.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/vtimer.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,148 @@
+/*
+ * xen/arch/arm/vtimer.c
+ *
+ * ARM Virtual Timer emulation support
+ *
+ * Ian Campbell <ian.campbell@citrix.com>
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <xen/config.h>
+#include <xen/lib.h>
+#include <xen/timer.h>
+#include <xen/sched.h>
+#include "gic.h"
+
+extern s_time_t ticks_to_ns(uint64_t ticks);
+extern uint64_t ns_to_ticks(s_time_t ns);
+
+static void vtimer_expired(void *data)
+{
+    struct vcpu *v = data;
+    v->arch.vtimer.ctl |= CNTx_CTL_PENDING;
+    v->arch.vtimer.ctl &= ~CNTx_CTL_MASK;
+    vgic_vcpu_inject_irq(v, 30, 1);
+}
+
+int vcpu_vtimer_init(struct vcpu *v)
+{
+    init_timer(&v->arch.vtimer.timer,
+               vtimer_expired, v,
+               smp_processor_id());
+    v->arch.vtimer.ctl = 0;
+    v->arch.vtimer.offset = NOW();
+    v->arch.vtimer.cval = NOW();
+    return 0;
+}
+
+static int vtimer_emulate_32(struct cpu_user_regs *regs, union hsr hsr)
+{
+    struct vcpu *v = current;
+    struct hsr_cp32 cp32 = hsr.cp32;
+    uint32_t *r = &regs->r0 + cp32.reg;
+    s_time_t now;
+
+    switch ( hsr.bits & HSR_CP32_REGS_MASK )
+    {
+    case HSR_CPREG32(CNTP_CTL):
+        if ( cp32.read )
+        {
+            *r = v->arch.vtimer.ctl;
+        }
+        else
+        {
+            v->arch.vtimer.ctl = *r;
+
+            if ( v->arch.vtimer.ctl & CNTx_CTL_ENABLE )
+            {
+                set_timer(&v->arch.vtimer.timer,
+                          v->arch.vtimer.cval + v->arch.vtimer.offset);
+            }
+            else
+                stop_timer(&v->arch.vtimer.timer);
+        }
+
+        return 1;
+
+    case HSR_CPREG32(CNTP_TVAL):
+        now = NOW() - v->arch.vtimer.offset;
+        if ( cp32.read )
+        {
+            *r = (uint32_t)(ns_to_ticks(v->arch.vtimer.cval - now) & 0xffffffffull);
+        }
+        else
+        {
+            v->arch.vtimer.cval = now + ticks_to_ns(*r);
+            if ( v->arch.vtimer.ctl & CNTx_CTL_ENABLE )
+            {
+                set_timer(&v->arch.vtimer.timer,
+                          v->arch.vtimer.cval + v->arch.vtimer.offset);
+            }
+        }
+
+        return 1;
+
+    default:
+        return 0;
+    }
+}
+
+static int vtimer_emulate_64(struct cpu_user_regs *regs, union hsr hsr)
+{
+    struct vcpu *v = current;
+    struct hsr_cp64 cp64 = hsr.cp64;
+    uint32_t *r1 = &regs->r0 + cp64.reg1;
+    uint32_t *r2 = &regs->r0 + cp64.reg2;
+    s_time_t now;
+
+    switch ( hsr.bits & HSR_CP64_REGS_MASK )
+    {
+    case HSR_CPREG64(CNTPCT):
+        if ( cp64.read )
+        {
+            now = NOW() - v->arch.vtimer.offset;
+            *r1 = (uint32_t)(now & 0xffffffff);
+            *r2 = (uint32_t)(now >> 32);
+            return 1;
+        }
+        else
+        {
+            printk("READ from R/O CNTPCT\n");
+            return 0;
+        }
+
+    default:
+        return 0;
+    }
+}
+
+int vtimer_emulate(struct cpu_user_regs *regs, union hsr hsr)
+{
+    switch (hsr.ec) {
+    case HSR_EC_CP15_32:
+        return vtimer_emulate_32(regs, hsr);
+    case HSR_EC_CP15_64:
+        return vtimer_emulate_64(regs, hsr);
+    default:
+        return 0;
+    }
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e8b7d44947e4 -r 18b9ea53c8ac xen/arch/arm/vtimer.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/vtimer.h	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,35 @@
+/*
+ * xen/arch/arm/vtimer.h
+ *
+ * ARM Virtual Timer emulation support
+ *
+ * Ian Campbell <ian.campbell@citrix.com>
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#ifndef __ARCH_ARM_VTIMER_H__
+#define __ARCH_ARM_VTIMER_H__
+
+extern int vcpu_vtimer_init(struct vcpu *v);
+extern int vtimer_emulate(struct cpu_user_regs *regs, union hsr hsr);
+
+#endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e8b7d44947e4 -r 18b9ea53c8ac xen/include/asm-arm/domain.h
--- a/xen/include/asm-arm/domain.h	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/include/asm-arm/domain.h	Thu Feb 09 11:33:30 2012 +0000
@@ -57,6 +57,13 @@
         struct list_head inflight_irqs;
         spinlock_t lock;
     } vgic;
+
+    struct {
+        struct timer timer;
+        uint32_t ctl;
+        s_time_t offset;
+        s_time_t cval;
+    } vtimer;
 }  __cacheline_aligned;
 
 void vcpu_show_execution_state(struct vcpu *);

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:50 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQU-0006EC-24; Thu, 09 Feb 2012 16:00:50 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQR-00065l-Nk
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:48 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1328803200!51784783!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17394 invoked from network); 9 Feb 2012 16:00:02 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:02 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQJ-0004Pp-3h
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:39 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQI-0006Cz-VN
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:39 +0000
Message-Id: <E1RvWQI-0006Cz-VN@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:38 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: vgic emulation
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787210 0
# Node ID e8b7d44947e4fe07b5934b72eaa081ca5c4e637e
# Parent  17e746636da434748b6f3e19a413e8ca08f24914
arm: vgic emulation

- emulation of the GICD interface for the guest;

- interrupt injection into the guest;

- keep track of inflight irqs using a list, ordered by priority.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 17e746636da4 -r e8b7d44947e4 xen/arch/arm/domain.c
--- a/xen/arch/arm/domain.c	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/arch/arm/domain.c	Thu Feb 09 11:33:30 2012 +0000
@@ -212,6 +212,9 @@
 {
     int rc = 0;
 
+    if ( (rc = vcpu_vgic_init(v)) != 0 )
+        return rc;
+
     return rc;
 }
 
@@ -230,6 +233,9 @@
 
     d->max_vcpus = 8;
 
+    if ( (rc = domain_vgic_init(d)) != 0 )
+        goto fail;
+
     rc = 0;
 fail:
     return rc;
diff -r 17e746636da4 -r e8b7d44947e4 xen/arch/arm/gic.h
--- a/xen/arch/arm/gic.h	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/arch/arm/gic.h	Thu Feb 09 11:33:30 2012 +0000
@@ -121,6 +121,9 @@
 #define GICH_LR_CPUID_SHIFT     9
 #define GICH_VTR_NRLRGS         0x3f
 
+extern int domain_vgic_init(struct domain *d);
+extern int vcpu_vgic_init(struct vcpu *v);
+extern void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int irq,int virtual);
 extern struct pending_irq *irq_to_pending(struct vcpu *v, unsigned int irq);
 
 extern void gic_route_irqs(void);
diff -r 17e746636da4 -r e8b7d44947e4 xen/arch/arm/io.c
--- a/xen/arch/arm/io.c	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/arch/arm/io.c	Thu Feb 09 11:33:30 2012 +0000
@@ -24,6 +24,7 @@
 
 static const struct mmio_handler *const mmio_handlers[] =
 {
+    &vgic_distr_mmio_handler,
 };
 #define MMIO_HANDLER_NR ARRAY_SIZE(mmio_handlers)
 
diff -r 17e746636da4 -r e8b7d44947e4 xen/arch/arm/io.h
--- a/xen/arch/arm/io.h	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/arch/arm/io.h	Thu Feb 09 11:33:30 2012 +0000
@@ -39,6 +39,8 @@
     mmio_write_t write_handler;
 };
 
+extern const struct mmio_handler vgic_distr_mmio_handler;
+
 extern int handle_mmio(mmio_info_t *info);
 
 #endif
diff -r 17e746636da4 -r e8b7d44947e4 xen/arch/arm/irq.c
--- a/xen/arch/arm/irq.c	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/arch/arm/irq.c	Thu Feb 09 11:33:30 2012 +0000
@@ -136,7 +136,8 @@
 
         desc->status |= IRQ_INPROGRESS;
 
-        /* XXX: inject irq into the guest */
+        /* XXX: inject irq into all guest vcpus */
+        vgic_vcpu_inject_irq(d->vcpu[0], irq, 0);
         goto out_no_end;
     }
 
diff -r 17e746636da4 -r e8b7d44947e4 xen/arch/arm/vgic.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/vgic.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,605 @@
+/*
+ * xen/arch/arm/vgic.c
+ *
+ * ARM Virtual Generic Interrupt Controller support
+ *
+ * Ian Campbell <ian.campbell@citrix.com>
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <xen/config.h>
+#include <xen/lib.h>
+#include <xen/init.h>
+#include <xen/softirq.h>
+#include <xen/irq.h>
+#include <xen/sched.h>
+
+#include <asm/current.h>
+
+#include "io.h"
+#include "gic.h"
+
+#define VGIC_DISTR_BASE_ADDRESS 0x000000002c001000
+
+#define REG(n) (n/4)
+
+/* Number of ranks of interrupt registers for a domain */
+#define DOMAIN_NR_RANKS(d) (((d)->arch.vgic.nr_lines+31)/32)
+
+/*
+ * Rank containing GICD_<FOO><n> for GICD_<FOO> with
+ * <b>-bits-per-interrupt
+ */
+static inline int REG_RANK_NR(int b, uint32_t n)
+{
+    switch ( b )
+    {
+    case 8: return n >> 3;
+    case 4: return n >> 2;
+    case 2: return n >> 1;
+    default: BUG();
+    }
+}
+
+/*
+ * Offset of GICD_<FOO><n> with its rank, for GICD_<FOO> with
+ * <b>-bits-per-interrupt.
+ */
+#define REG_RANK_INDEX(b, n) ((n) & ((b)-1))
+
+/*
+ * Returns rank corresponding to a GICD_<FOO><n> register for
+ * GICD_<FOO> with <b>-bits-per-interrupt.
+ */
+static struct vgic_irq_rank *vgic_irq_rank(struct vcpu *v, int b, int n)
+{
+    int rank = REG_RANK_NR(b, n);
+
+    if ( rank == 0 )
+        return &v->arch.vgic.private_irqs;
+    else if ( rank <= DOMAIN_NR_RANKS(v->domain) )
+        return &v->domain->arch.vgic.shared_irqs[rank - 1];
+    else
+        return NULL;
+}
+
+int domain_vgic_init(struct domain *d)
+{
+    int i;
+
+    d->arch.vgic.ctlr = 0;
+    d->arch.vgic.nr_lines = 32;
+    d->arch.vgic.shared_irqs =
+        xmalloc_array(struct vgic_irq_rank, DOMAIN_NR_RANKS(d));
+    d->arch.vgic.pending_irqs =
+        xmalloc_array(struct pending_irq,
+                d->arch.vgic.nr_lines + (32 * d->max_vcpus));
+    for (i=0; i<d->arch.vgic.nr_lines + (32 * d->max_vcpus); i++)
+        INIT_LIST_HEAD(&d->arch.vgic.pending_irqs[i].link);
+    for (i=0; i<DOMAIN_NR_RANKS(d); i++)
+        spin_lock_init(&d->arch.vgic.shared_irqs[i].lock);
+    return 0;
+}
+
+int vcpu_vgic_init(struct vcpu *v)
+{
+    int i;
+    memset(&v->arch.vgic.private_irqs, 0, sizeof(v->arch.vgic.private_irqs));
+
+    spin_lock_init(&v->arch.vgic.private_irqs.lock);
+
+    /* For SGI and PPI the target is always this CPU */
+    for ( i = 0 ; i < 8 ; i++ )
+        v->arch.vgic.private_irqs.itargets[i] =
+              (1<<(v->vcpu_id+0))
+            | (1<<(v->vcpu_id+8))
+            | (1<<(v->vcpu_id+16))
+            | (1<<(v->vcpu_id+24));
+    INIT_LIST_HEAD(&v->arch.vgic.inflight_irqs);
+    spin_lock_init(&v->arch.vgic.lock);
+
+    return 0;
+}
+
+#define vgic_lock(v)   spin_lock(&(v)->domain->arch.vgic.lock)
+#define vgic_unlock(v) spin_unlock(&(v)->domain->arch.vgic.lock)
+
+#define vgic_lock_rank(v, r) spin_lock(&(r)->lock)
+#define vgic_unlock_rank(v, r) spin_unlock(&(r)->lock)
+
+static uint32_t byte_read(uint32_t val, int sign, int offset)
+{
+    int byte = offset & 0x3;
+
+    val = val >> (8*byte);
+    if ( sign && (val & 0x80) )
+        val |= 0xffffff00;
+    else
+        val &= 0x000000ff;
+    return val;
+}
+
+static void byte_write(uint32_t *reg, uint32_t var, int offset)
+{
+    int byte = offset & 0x3;
+
+    var &= (0xff << (8*byte));
+
+    *reg &= ~(0xff << (8*byte));
+    *reg |= var;
+}
+
+static int vgic_distr_mmio_read(struct vcpu *v, mmio_info_t *info)
+{
+    struct hsr_dabt dabt = info->dabt;
+    struct cpu_user_regs *regs = guest_cpu_user_regs();
+    uint32_t *r = &regs->r0 + dabt.reg;
+    struct vgic_irq_rank *rank;
+    int offset = (int)(info->gpa - VGIC_DISTR_BASE_ADDRESS);
+    int gicd_reg = REG(offset);
+
+    switch ( gicd_reg )
+    {
+    case GICD_CTLR:
+        if ( dabt.size != 2 ) goto bad_width;
+        vgic_lock(v);
+        *r = v->domain->arch.vgic.ctlr;
+        vgic_unlock(v);
+        return 1;
+    case GICD_TYPER:
+        if ( dabt.size != 2 ) goto bad_width;
+        /* No secure world support for guests. */
+        vgic_lock(v);
+        *r = ( (v->domain->max_vcpus<<5) & GICD_TYPE_CPUS )
+            |( ((v->domain->arch.vgic.nr_lines/32)) & GICD_TYPE_LINES );
+        vgic_unlock(v);
+        return 1;
+    case GICD_IIDR:
+        if ( dabt.size != 2 ) goto bad_width;
+        /*
+         * XXX Do we need a JEP106 manufacturer ID?
+         * Just use the physical h/w value for now
+         */
+        *r = 0x0000043b;
+        return 1;
+
+    /* Implementation defined -- read as zero */
+    case REG(0x020) ... REG(0x03c):
+        goto read_as_zero;
+
+    case GICD_IGROUPR ... GICD_IGROUPRN:
+        /* We do not implement security extensions for guests, read zero */
+        goto read_as_zero;
+
+    case GICD_ISENABLER ... GICD_ISENABLERN:
+        if ( dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ISENABLER);
+        if ( rank == NULL) goto read_as_zero;
+        vgic_lock_rank(v, rank);
+        *r = rank->ienable;
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ICENABLER ... GICD_ICENABLERN:
+        if ( dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ICENABLER);
+        if ( rank == NULL) goto read_as_zero;
+        vgic_lock_rank(v, rank);
+        *r = rank->ienable;
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ISPENDR ... GICD_ISPENDRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ISPENDR);
+        if ( rank == NULL) goto read_as_zero;
+        vgic_lock_rank(v, rank);
+        *r = byte_read(rank->ipend, dabt.sign, offset);
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ICPENDR ... GICD_ICPENDRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ICPENDR);
+        if ( rank == NULL) goto read_as_zero;
+        vgic_lock_rank(v, rank);
+        *r = byte_read(rank->ipend, dabt.sign, offset);
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ISACTIVER ... GICD_ISACTIVERN:
+        if ( dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ISACTIVER);
+        if ( rank == NULL) goto read_as_zero;
+        vgic_lock_rank(v, rank);
+        *r = rank->iactive;
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ICACTIVER ... GICD_ICACTIVERN:
+        if ( dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ICACTIVER);
+        if ( rank == NULL) goto read_as_zero;
+        vgic_lock_rank(v, rank);
+        *r = rank->iactive;
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ITARGETSR ... GICD_ITARGETSRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ITARGETSR);
+        if ( rank == NULL) goto read_as_zero;
+
+        vgic_lock_rank(v, rank);
+        *r = rank->itargets[REG_RANK_INDEX(8, gicd_reg - GICD_ITARGETSR)];
+        if ( dabt.size == 0 )
+            *r = byte_read(*r, dabt.sign, offset);
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_IPRIORITYR ... GICD_IPRIORITYRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_IPRIORITYR);
+        if ( rank == NULL) goto read_as_zero;
+
+        vgic_lock_rank(v, rank);
+        *r = rank->ipriority[REG_RANK_INDEX(8, gicd_reg - GICD_IPRIORITYR)];
+        if ( dabt.size == 0 )
+            *r = byte_read(*r, dabt.sign, offset);
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ICFGR ... GICD_ICFGRN:
+        if ( dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 2, gicd_reg - GICD_ICFGR);
+        if ( rank == NULL) goto read_as_zero;
+        vgic_lock_rank(v, rank);
+        *r = rank->icfg[REG_RANK_INDEX(2, gicd_reg - GICD_ICFGR)];
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_NSACR ... GICD_NSACRN:
+        /* We do not implement securty extensions for guests, read zero */
+        goto read_as_zero;
+
+    case GICD_SGIR:
+        if ( dabt.size != 2 ) goto bad_width;
+        /* Write only -- read unknown */
+        *r = 0xdeadbeef;
+        return 1;
+
+    case GICD_CPENDSGIR ... GICD_CPENDSGIRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_CPENDSGIR);
+        if ( rank == NULL) goto read_as_zero;
+        vgic_lock_rank(v, rank);
+        *r = byte_read(rank->pendsgi, dabt.sign, offset);
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_SPENDSGIR ... GICD_SPENDSGIRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_SPENDSGIR);
+        if ( rank == NULL) goto read_as_zero;
+        vgic_lock_rank(v, rank);
+        *r = byte_read(rank->pendsgi, dabt.sign, offset);
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    /* Implementation defined -- read as zero */
+    case REG(0xfd0) ... REG(0xfe4):
+        goto read_as_zero;
+
+    case GICD_ICPIDR2:
+        if ( dabt.size != 2 ) goto bad_width;
+        printk("vGICD: unhandled read from ICPIDR2\n");
+        return 0;
+
+    /* Implementation defined -- read as zero */
+    case REG(0xfec) ... REG(0xffc):
+        goto read_as_zero;
+
+    /* Reserved -- read as zero */
+    case REG(0x00c) ... REG(0x01c):
+    case REG(0x040) ... REG(0x07c):
+    case REG(0x7fc):
+    case REG(0xbfc):
+    case REG(0xf04) ... REG(0xf0c):
+    case REG(0xf30) ... REG(0xfcc):
+        goto read_as_zero;
+
+    default:
+        printk("vGICD: unhandled read r%d offset %#08x\n",
+               dabt.reg, offset);
+        return 0;
+    }
+
+bad_width:
+    printk("vGICD: bad read width %d r%d offset %#08x\n",
+           dabt.size, dabt.reg, offset);
+    domain_crash_synchronous();
+    return 0;
+
+read_as_zero:
+    if ( dabt.size != 2 ) goto bad_width;
+    *r = 0;
+    return 1;
+}
+
+static int vgic_distr_mmio_write(struct vcpu *v, mmio_info_t *info)
+{
+    struct hsr_dabt dabt = info->dabt;
+    struct cpu_user_regs *regs = guest_cpu_user_regs();
+    uint32_t *r = &regs->r0 + dabt.reg;
+    struct vgic_irq_rank *rank;
+    int offset = (int)(info->gpa - VGIC_DISTR_BASE_ADDRESS);
+    int gicd_reg = REG(offset);
+
+    switch ( gicd_reg )
+    {
+    case GICD_CTLR:
+        if ( dabt.size != 2 ) goto bad_width;
+        /* Ignore all but the enable bit */
+        v->domain->arch.vgic.ctlr = (*r) & GICD_CTL_ENABLE;
+        return 1;
+
+    /* R/O -- write ignored */
+    case GICD_TYPER:
+    case GICD_IIDR:
+        goto write_ignore;
+
+    /* Implementation defined -- write ignored */
+    case REG(0x020) ... REG(0x03c):
+        goto write_ignore;
+
+    case GICD_IGROUPR ... GICD_IGROUPRN:
+        /* We do not implement securty extensions for guests, write ignore */
+        goto write_ignore;
+
+    case GICD_ISENABLER ... GICD_ISENABLERN:
+        if ( dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ISENABLER);
+        if ( rank == NULL) goto write_ignore;
+        vgic_lock_rank(v, rank);
+        rank->ienable |= *r;
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ICENABLER ... GICD_ICENABLERN:
+        if ( dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ICENABLER);
+        if ( rank == NULL) goto write_ignore;
+        vgic_lock_rank(v, rank);
+        rank->ienable &= ~*r;
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ISPENDR ... GICD_ISPENDRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        printk("vGICD: unhandled %s write %#"PRIx32" to ISPENDR%d\n",
+               dabt.size ? "word" : "byte", *r, gicd_reg - GICD_ISPENDR);
+        return 0;
+
+    case GICD_ICPENDR ... GICD_ICPENDRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        printk("vGICD: unhandled %s write %#"PRIx32" to ICPENDR%d\n",
+               dabt.size ? "word" : "byte", *r, gicd_reg - GICD_ICPENDR);
+        return 0;
+
+    case GICD_ISACTIVER ... GICD_ISACTIVERN:
+        if ( dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ISACTIVER);
+        if ( rank == NULL) goto write_ignore;
+        vgic_lock_rank(v, rank);
+        rank->iactive &= ~*r;
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ICACTIVER ... GICD_ICACTIVERN:
+        if ( dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ICACTIVER);
+        if ( rank == NULL) goto write_ignore;
+        vgic_lock_rank(v, rank);
+        rank->iactive &= ~*r;
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ITARGETSR ... GICD_ITARGETSR + 7:
+        /* SGI/PPI target is read only */
+        goto write_ignore;
+
+    case GICD_ITARGETSR + 8 ... GICD_ITARGETSRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ITARGETSR);
+        if ( rank == NULL) goto write_ignore;
+        vgic_lock_rank(v, rank);
+        if ( dabt.size == 2 )
+            rank->itargets[REG_RANK_INDEX(8, gicd_reg - GICD_ITARGETSR)] = *r;
+        else
+            byte_write(&rank->itargets[REG_RANK_INDEX(8, gicd_reg - GICD_ITARGETSR)],
+                       *r, offset);
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_IPRIORITYR ... GICD_IPRIORITYRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_IPRIORITYR);
+        if ( rank == NULL) goto write_ignore;
+        vgic_lock_rank(v, rank);
+        if ( dabt.size == 2 )
+            rank->ipriority[REG_RANK_INDEX(8, gicd_reg - GICD_IPRIORITYR)] = *r;
+        else
+            byte_write(&rank->ipriority[REG_RANK_INDEX(8, gicd_reg - GICD_IPRIORITYR)],
+                       *r, offset);
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ICFGR: /* SGIs */
+        goto write_ignore;
+    case GICD_ICFGR + 1: /* PPIs */
+        /* It is implementation defined if these are writeable. We chose not */
+        goto write_ignore;
+    case GICD_ICFGR + 2 ... GICD_ICFGRN: /* SPIs */
+        if ( dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 2, gicd_reg - GICD_ICFGR);
+        vgic_lock_rank(v, rank);
+        if ( rank == NULL) goto write_ignore;
+        rank->icfg[REG_RANK_INDEX(2, gicd_reg - GICD_ICFGR)] = *r;
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_NSACR ... GICD_NSACRN:
+        /* We do not implement securty extensions for guests, write ignore */
+        goto write_ignore;
+
+    case GICD_SGIR:
+        if ( dabt.size != 2 ) goto bad_width;
+        printk("vGICD: unhandled write %#"PRIx32" to ICFGR%d\n",
+               *r, gicd_reg - GICD_ICFGR);
+        return 0;
+
+    case GICD_CPENDSGIR ... GICD_CPENDSGIRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        printk("vGICD: unhandled %s write %#"PRIx32" to ICPENDSGIR%d\n",
+               dabt.size ? "word" : "byte", *r, gicd_reg - GICD_CPENDSGIR);
+        return 0;
+
+    case GICD_SPENDSGIR ... GICD_SPENDSGIRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        printk("vGICD: unhandled %s write %#"PRIx32" to ISPENDSGIR%d\n",
+               dabt.size ? "word" : "byte", *r, gicd_reg - GICD_SPENDSGIR);
+        return 0;
+
+    /* Implementation defined -- write ignored */
+    case REG(0xfd0) ... REG(0xfe4):
+        goto write_ignore;
+
+    /* R/O -- write ignore */
+    case GICD_ICPIDR2:
+        goto write_ignore;
+
+    /* Implementation defined -- write ignored */
+    case REG(0xfec) ... REG(0xffc):
+        goto write_ignore;
+
+    /* Reserved -- write ignored */
+    case REG(0x00c) ... REG(0x01c):
+    case REG(0x040) ... REG(0x07c):
+    case REG(0x7fc):
+    case REG(0xbfc):
+    case REG(0xf04) ... REG(0xf0c):
+    case REG(0xf30) ... REG(0xfcc):
+        goto write_ignore;
+
+    default:
+        printk("vGICD: unhandled write r%d=%"PRIx32" offset %#08x\n",
+               dabt.reg, *r, offset);
+        return 0;
+    }
+
+bad_width:
+    printk("vGICD: bad write width %d r%d=%"PRIx32" offset %#08x\n",
+           dabt.size, dabt.reg, *r, offset);
+    domain_crash_synchronous();
+    return 0;
+
+write_ignore:
+    if ( dabt.size != 2 ) goto bad_width;
+    return 0;
+}
+
+static int vgic_distr_mmio_check(struct vcpu *v, paddr_t addr)
+{
+    return addr >= VGIC_DISTR_BASE_ADDRESS && addr < (VGIC_DISTR_BASE_ADDRESS+PAGE_SIZE);
+}
+
+const struct mmio_handler vgic_distr_mmio_handler = {
+    .check_handler = vgic_distr_mmio_check,
+    .read_handler  = vgic_distr_mmio_read,
+    .write_handler = vgic_distr_mmio_write,
+};
+
+struct pending_irq *irq_to_pending(struct vcpu *v, unsigned int irq)
+{
+    struct pending_irq *n;
+    /* Pending irqs allocation strategy: the first vgic.nr_lines irqs
+     * are used for SPIs; the rests are used for per cpu irqs */
+    if ( irq < 32 )
+        n = &v->domain->arch.vgic.pending_irqs[irq + (v->vcpu_id * 32)
+            + v->domain->arch.vgic.nr_lines];
+    else
+        n = &v->domain->arch.vgic.pending_irqs[irq - 32];
+    return n;
+}
+
+void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int irq, int virtual)
+{
+    int idx = irq >> 2, byte = irq & 0x3;
+    uint8_t priority;
+    struct vgic_irq_rank *rank = vgic_irq_rank(v, 8, idx);
+    struct pending_irq *iter, *n = irq_to_pending(v, irq);
+
+    /* irq still pending */
+    if (!list_empty(&n->link))
+        return;
+
+    priority = byte_read(rank->ipriority[REG_RANK_INDEX(8, idx)], 0, byte);
+
+    n->irq = irq;
+    n->priority = priority;
+    if (!virtual)
+        n->desc = irq_to_desc(irq);
+    else
+        n->desc = NULL;
+
+    gic_set_guest_irq(irq, GICH_LR_PENDING, priority);
+
+    spin_lock(&v->arch.vgic.lock);
+    list_for_each_entry ( iter, &v->arch.vgic.inflight_irqs, link )
+    {
+        if ( iter->priority < priority )
+        {
+            list_add_tail(&n->link, &iter->link);
+            spin_unlock(&v->arch.vgic.lock);
+            return;
+        }
+    }
+    list_add(&n->link, &v->arch.vgic.inflight_irqs);
+    spin_unlock(&v->arch.vgic.lock);
+    /* we have a new higher priority irq, inject it into the guest */
+    cpu_raise_softirq(v->processor, VGIC_SOFTIRQ);
+}
+
+static void vgic_softirq(void)
+{
+    if (list_empty(&current->arch.vgic.inflight_irqs))
+        return;
+
+    gic_inject_irq_start();
+}
+
+static int __init init_vgic_softirq(void)
+{
+    open_softirq(VGIC_SOFTIRQ, vgic_softirq);
+    return 0;
+}
+__initcall(init_vgic_softirq);
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
+
diff -r 17e746636da4 -r e8b7d44947e4 xen/include/asm-arm/domain.h
--- a/xen/include/asm-arm/domain.h	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/include/asm-arm/domain.h	Thu Feb 09 11:33:30 2012 +0000
@@ -6,6 +6,15 @@
 #include <asm/page.h>
 #include <asm/p2m.h>
 
+/* Represents state corresponding to a block of 32 interrupts */
+struct vgic_irq_rank {
+    spinlock_t lock; /* Covers access to all other members of this struct */
+    uint32_t ienable, iactive, ipend, pendsgi;
+    uint32_t icfg[2];
+    uint32_t ipriority[8];
+    uint32_t itargets[8];
+};
+
 struct pending_irq
 {
     int irq;
@@ -18,6 +27,22 @@
 {
     struct p2m_domain p2m;
 
+    struct {
+        /*
+         * Covers access to other members of this struct _except_ for
+         * shared_irqs where each member contains its own locking.
+         *
+         * If both class of lock is required then this lock must be
+         * taken first. If multiple rank locks are required (including
+         * the per-vcpu private_irqs rank) then they must be taken in
+         * rank order.
+         */
+        spinlock_t lock;
+        int ctlr;
+        int nr_lines;
+        struct vgic_irq_rank *shared_irqs;
+        struct pending_irq *pending_irqs;
+    } vgic;
 }  __cacheline_aligned;
 
 struct arch_vcpu
@@ -27,6 +52,11 @@
     uint32_t sctlr;
     uint32_t ttbr0, ttbr1, ttbcr;
 
+    struct {
+        struct vgic_irq_rank private_irqs;
+        struct list_head inflight_irqs;
+        spinlock_t lock;
+    } vgic;
 }  __cacheline_aligned;
 
 void vcpu_show_execution_state(struct vcpu *);

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:50 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQU-0006EC-24; Thu, 09 Feb 2012 16:00:50 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQR-00065l-Nk
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:48 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1328803200!51784783!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17394 invoked from network); 9 Feb 2012 16:00:02 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:02 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQJ-0004Pp-3h
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:39 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQI-0006Cz-VN
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:39 +0000
Message-Id: <E1RvWQI-0006Cz-VN@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:38 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: vgic emulation
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787210 0
# Node ID e8b7d44947e4fe07b5934b72eaa081ca5c4e637e
# Parent  17e746636da434748b6f3e19a413e8ca08f24914
arm: vgic emulation

- emulation of the GICD interface for the guest;

- interrupt injection into the guest;

- keep track of inflight irqs using a list, ordered by priority.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 17e746636da4 -r e8b7d44947e4 xen/arch/arm/domain.c
--- a/xen/arch/arm/domain.c	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/arch/arm/domain.c	Thu Feb 09 11:33:30 2012 +0000
@@ -212,6 +212,9 @@
 {
     int rc = 0;
 
+    if ( (rc = vcpu_vgic_init(v)) != 0 )
+        return rc;
+
     return rc;
 }
 
@@ -230,6 +233,9 @@
 
     d->max_vcpus = 8;
 
+    if ( (rc = domain_vgic_init(d)) != 0 )
+        goto fail;
+
     rc = 0;
 fail:
     return rc;
diff -r 17e746636da4 -r e8b7d44947e4 xen/arch/arm/gic.h
--- a/xen/arch/arm/gic.h	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/arch/arm/gic.h	Thu Feb 09 11:33:30 2012 +0000
@@ -121,6 +121,9 @@
 #define GICH_LR_CPUID_SHIFT     9
 #define GICH_VTR_NRLRGS         0x3f
 
+extern int domain_vgic_init(struct domain *d);
+extern int vcpu_vgic_init(struct vcpu *v);
+extern void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int irq,int virtual);
 extern struct pending_irq *irq_to_pending(struct vcpu *v, unsigned int irq);
 
 extern void gic_route_irqs(void);
diff -r 17e746636da4 -r e8b7d44947e4 xen/arch/arm/io.c
--- a/xen/arch/arm/io.c	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/arch/arm/io.c	Thu Feb 09 11:33:30 2012 +0000
@@ -24,6 +24,7 @@
 
 static const struct mmio_handler *const mmio_handlers[] =
 {
+    &vgic_distr_mmio_handler,
 };
 #define MMIO_HANDLER_NR ARRAY_SIZE(mmio_handlers)
 
diff -r 17e746636da4 -r e8b7d44947e4 xen/arch/arm/io.h
--- a/xen/arch/arm/io.h	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/arch/arm/io.h	Thu Feb 09 11:33:30 2012 +0000
@@ -39,6 +39,8 @@
     mmio_write_t write_handler;
 };
 
+extern const struct mmio_handler vgic_distr_mmio_handler;
+
 extern int handle_mmio(mmio_info_t *info);
 
 #endif
diff -r 17e746636da4 -r e8b7d44947e4 xen/arch/arm/irq.c
--- a/xen/arch/arm/irq.c	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/arch/arm/irq.c	Thu Feb 09 11:33:30 2012 +0000
@@ -136,7 +136,8 @@
 
         desc->status |= IRQ_INPROGRESS;
 
-        /* XXX: inject irq into the guest */
+        /* XXX: inject irq into all guest vcpus */
+        vgic_vcpu_inject_irq(d->vcpu[0], irq, 0);
         goto out_no_end;
     }
 
diff -r 17e746636da4 -r e8b7d44947e4 xen/arch/arm/vgic.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/vgic.c	Thu Feb 09 11:33:30 2012 +0000
@@ -0,0 +1,605 @@
+/*
+ * xen/arch/arm/vgic.c
+ *
+ * ARM Virtual Generic Interrupt Controller support
+ *
+ * Ian Campbell <ian.campbell@citrix.com>
+ * Copyright (c) 2011 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#include <xen/config.h>
+#include <xen/lib.h>
+#include <xen/init.h>
+#include <xen/softirq.h>
+#include <xen/irq.h>
+#include <xen/sched.h>
+
+#include <asm/current.h>
+
+#include "io.h"
+#include "gic.h"
+
+#define VGIC_DISTR_BASE_ADDRESS 0x000000002c001000
+
+#define REG(n) (n/4)
+
+/* Number of ranks of interrupt registers for a domain */
+#define DOMAIN_NR_RANKS(d) (((d)->arch.vgic.nr_lines+31)/32)
+
+/*
+ * Rank containing GICD_<FOO><n> for GICD_<FOO> with
+ * <b>-bits-per-interrupt
+ */
+static inline int REG_RANK_NR(int b, uint32_t n)
+{
+    switch ( b )
+    {
+    case 8: return n >> 3;
+    case 4: return n >> 2;
+    case 2: return n >> 1;
+    default: BUG();
+    }
+}
+
+/*
+ * Offset of GICD_<FOO><n> with its rank, for GICD_<FOO> with
+ * <b>-bits-per-interrupt.
+ */
+#define REG_RANK_INDEX(b, n) ((n) & ((b)-1))
+
+/*
+ * Returns rank corresponding to a GICD_<FOO><n> register for
+ * GICD_<FOO> with <b>-bits-per-interrupt.
+ */
+static struct vgic_irq_rank *vgic_irq_rank(struct vcpu *v, int b, int n)
+{
+    int rank = REG_RANK_NR(b, n);
+
+    if ( rank == 0 )
+        return &v->arch.vgic.private_irqs;
+    else if ( rank <= DOMAIN_NR_RANKS(v->domain) )
+        return &v->domain->arch.vgic.shared_irqs[rank - 1];
+    else
+        return NULL;
+}
+
+int domain_vgic_init(struct domain *d)
+{
+    int i;
+
+    d->arch.vgic.ctlr = 0;
+    d->arch.vgic.nr_lines = 32;
+    d->arch.vgic.shared_irqs =
+        xmalloc_array(struct vgic_irq_rank, DOMAIN_NR_RANKS(d));
+    d->arch.vgic.pending_irqs =
+        xmalloc_array(struct pending_irq,
+                d->arch.vgic.nr_lines + (32 * d->max_vcpus));
+    for (i=0; i<d->arch.vgic.nr_lines + (32 * d->max_vcpus); i++)
+        INIT_LIST_HEAD(&d->arch.vgic.pending_irqs[i].link);
+    for (i=0; i<DOMAIN_NR_RANKS(d); i++)
+        spin_lock_init(&d->arch.vgic.shared_irqs[i].lock);
+    return 0;
+}
+
+int vcpu_vgic_init(struct vcpu *v)
+{
+    int i;
+    memset(&v->arch.vgic.private_irqs, 0, sizeof(v->arch.vgic.private_irqs));
+
+    spin_lock_init(&v->arch.vgic.private_irqs.lock);
+
+    /* For SGI and PPI the target is always this CPU */
+    for ( i = 0 ; i < 8 ; i++ )
+        v->arch.vgic.private_irqs.itargets[i] =
+              (1<<(v->vcpu_id+0))
+            | (1<<(v->vcpu_id+8))
+            | (1<<(v->vcpu_id+16))
+            | (1<<(v->vcpu_id+24));
+    INIT_LIST_HEAD(&v->arch.vgic.inflight_irqs);
+    spin_lock_init(&v->arch.vgic.lock);
+
+    return 0;
+}
+
+#define vgic_lock(v)   spin_lock(&(v)->domain->arch.vgic.lock)
+#define vgic_unlock(v) spin_unlock(&(v)->domain->arch.vgic.lock)
+
+#define vgic_lock_rank(v, r) spin_lock(&(r)->lock)
+#define vgic_unlock_rank(v, r) spin_unlock(&(r)->lock)
+
+static uint32_t byte_read(uint32_t val, int sign, int offset)
+{
+    int byte = offset & 0x3;
+
+    val = val >> (8*byte);
+    if ( sign && (val & 0x80) )
+        val |= 0xffffff00;
+    else
+        val &= 0x000000ff;
+    return val;
+}
+
+static void byte_write(uint32_t *reg, uint32_t var, int offset)
+{
+    int byte = offset & 0x3;
+
+    var &= (0xff << (8*byte));
+
+    *reg &= ~(0xff << (8*byte));
+    *reg |= var;
+}
+
+static int vgic_distr_mmio_read(struct vcpu *v, mmio_info_t *info)
+{
+    struct hsr_dabt dabt = info->dabt;
+    struct cpu_user_regs *regs = guest_cpu_user_regs();
+    uint32_t *r = &regs->r0 + dabt.reg;
+    struct vgic_irq_rank *rank;
+    int offset = (int)(info->gpa - VGIC_DISTR_BASE_ADDRESS);
+    int gicd_reg = REG(offset);
+
+    switch ( gicd_reg )
+    {
+    case GICD_CTLR:
+        if ( dabt.size != 2 ) goto bad_width;
+        vgic_lock(v);
+        *r = v->domain->arch.vgic.ctlr;
+        vgic_unlock(v);
+        return 1;
+    case GICD_TYPER:
+        if ( dabt.size != 2 ) goto bad_width;
+        /* No secure world support for guests. */
+        vgic_lock(v);
+        *r = ( (v->domain->max_vcpus<<5) & GICD_TYPE_CPUS )
+            |( ((v->domain->arch.vgic.nr_lines/32)) & GICD_TYPE_LINES );
+        vgic_unlock(v);
+        return 1;
+    case GICD_IIDR:
+        if ( dabt.size != 2 ) goto bad_width;
+        /*
+         * XXX Do we need a JEP106 manufacturer ID?
+         * Just use the physical h/w value for now
+         */
+        *r = 0x0000043b;
+        return 1;
+
+    /* Implementation defined -- read as zero */
+    case REG(0x020) ... REG(0x03c):
+        goto read_as_zero;
+
+    case GICD_IGROUPR ... GICD_IGROUPRN:
+        /* We do not implement security extensions for guests, read zero */
+        goto read_as_zero;
+
+    case GICD_ISENABLER ... GICD_ISENABLERN:
+        if ( dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ISENABLER);
+        if ( rank == NULL) goto read_as_zero;
+        vgic_lock_rank(v, rank);
+        *r = rank->ienable;
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ICENABLER ... GICD_ICENABLERN:
+        if ( dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ICENABLER);
+        if ( rank == NULL) goto read_as_zero;
+        vgic_lock_rank(v, rank);
+        *r = rank->ienable;
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ISPENDR ... GICD_ISPENDRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ISPENDR);
+        if ( rank == NULL) goto read_as_zero;
+        vgic_lock_rank(v, rank);
+        *r = byte_read(rank->ipend, dabt.sign, offset);
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ICPENDR ... GICD_ICPENDRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ICPENDR);
+        if ( rank == NULL) goto read_as_zero;
+        vgic_lock_rank(v, rank);
+        *r = byte_read(rank->ipend, dabt.sign, offset);
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ISACTIVER ... GICD_ISACTIVERN:
+        if ( dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ISACTIVER);
+        if ( rank == NULL) goto read_as_zero;
+        vgic_lock_rank(v, rank);
+        *r = rank->iactive;
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ICACTIVER ... GICD_ICACTIVERN:
+        if ( dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ICACTIVER);
+        if ( rank == NULL) goto read_as_zero;
+        vgic_lock_rank(v, rank);
+        *r = rank->iactive;
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ITARGETSR ... GICD_ITARGETSRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ITARGETSR);
+        if ( rank == NULL) goto read_as_zero;
+
+        vgic_lock_rank(v, rank);
+        *r = rank->itargets[REG_RANK_INDEX(8, gicd_reg - GICD_ITARGETSR)];
+        if ( dabt.size == 0 )
+            *r = byte_read(*r, dabt.sign, offset);
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_IPRIORITYR ... GICD_IPRIORITYRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_IPRIORITYR);
+        if ( rank == NULL) goto read_as_zero;
+
+        vgic_lock_rank(v, rank);
+        *r = rank->ipriority[REG_RANK_INDEX(8, gicd_reg - GICD_IPRIORITYR)];
+        if ( dabt.size == 0 )
+            *r = byte_read(*r, dabt.sign, offset);
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ICFGR ... GICD_ICFGRN:
+        if ( dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 2, gicd_reg - GICD_ICFGR);
+        if ( rank == NULL) goto read_as_zero;
+        vgic_lock_rank(v, rank);
+        *r = rank->icfg[REG_RANK_INDEX(2, gicd_reg - GICD_ICFGR)];
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_NSACR ... GICD_NSACRN:
+        /* We do not implement securty extensions for guests, read zero */
+        goto read_as_zero;
+
+    case GICD_SGIR:
+        if ( dabt.size != 2 ) goto bad_width;
+        /* Write only -- read unknown */
+        *r = 0xdeadbeef;
+        return 1;
+
+    case GICD_CPENDSGIR ... GICD_CPENDSGIRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_CPENDSGIR);
+        if ( rank == NULL) goto read_as_zero;
+        vgic_lock_rank(v, rank);
+        *r = byte_read(rank->pendsgi, dabt.sign, offset);
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_SPENDSGIR ... GICD_SPENDSGIRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_SPENDSGIR);
+        if ( rank == NULL) goto read_as_zero;
+        vgic_lock_rank(v, rank);
+        *r = byte_read(rank->pendsgi, dabt.sign, offset);
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    /* Implementation defined -- read as zero */
+    case REG(0xfd0) ... REG(0xfe4):
+        goto read_as_zero;
+
+    case GICD_ICPIDR2:
+        if ( dabt.size != 2 ) goto bad_width;
+        printk("vGICD: unhandled read from ICPIDR2\n");
+        return 0;
+
+    /* Implementation defined -- read as zero */
+    case REG(0xfec) ... REG(0xffc):
+        goto read_as_zero;
+
+    /* Reserved -- read as zero */
+    case REG(0x00c) ... REG(0x01c):
+    case REG(0x040) ... REG(0x07c):
+    case REG(0x7fc):
+    case REG(0xbfc):
+    case REG(0xf04) ... REG(0xf0c):
+    case REG(0xf30) ... REG(0xfcc):
+        goto read_as_zero;
+
+    default:
+        printk("vGICD: unhandled read r%d offset %#08x\n",
+               dabt.reg, offset);
+        return 0;
+    }
+
+bad_width:
+    printk("vGICD: bad read width %d r%d offset %#08x\n",
+           dabt.size, dabt.reg, offset);
+    domain_crash_synchronous();
+    return 0;
+
+read_as_zero:
+    if ( dabt.size != 2 ) goto bad_width;
+    *r = 0;
+    return 1;
+}
+
+static int vgic_distr_mmio_write(struct vcpu *v, mmio_info_t *info)
+{
+    struct hsr_dabt dabt = info->dabt;
+    struct cpu_user_regs *regs = guest_cpu_user_regs();
+    uint32_t *r = &regs->r0 + dabt.reg;
+    struct vgic_irq_rank *rank;
+    int offset = (int)(info->gpa - VGIC_DISTR_BASE_ADDRESS);
+    int gicd_reg = REG(offset);
+
+    switch ( gicd_reg )
+    {
+    case GICD_CTLR:
+        if ( dabt.size != 2 ) goto bad_width;
+        /* Ignore all but the enable bit */
+        v->domain->arch.vgic.ctlr = (*r) & GICD_CTL_ENABLE;
+        return 1;
+
+    /* R/O -- write ignored */
+    case GICD_TYPER:
+    case GICD_IIDR:
+        goto write_ignore;
+
+    /* Implementation defined -- write ignored */
+    case REG(0x020) ... REG(0x03c):
+        goto write_ignore;
+
+    case GICD_IGROUPR ... GICD_IGROUPRN:
+        /* We do not implement securty extensions for guests, write ignore */
+        goto write_ignore;
+
+    case GICD_ISENABLER ... GICD_ISENABLERN:
+        if ( dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ISENABLER);
+        if ( rank == NULL) goto write_ignore;
+        vgic_lock_rank(v, rank);
+        rank->ienable |= *r;
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ICENABLER ... GICD_ICENABLERN:
+        if ( dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ICENABLER);
+        if ( rank == NULL) goto write_ignore;
+        vgic_lock_rank(v, rank);
+        rank->ienable &= ~*r;
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ISPENDR ... GICD_ISPENDRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        printk("vGICD: unhandled %s write %#"PRIx32" to ISPENDR%d\n",
+               dabt.size ? "word" : "byte", *r, gicd_reg - GICD_ISPENDR);
+        return 0;
+
+    case GICD_ICPENDR ... GICD_ICPENDRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        printk("vGICD: unhandled %s write %#"PRIx32" to ICPENDR%d\n",
+               dabt.size ? "word" : "byte", *r, gicd_reg - GICD_ICPENDR);
+        return 0;
+
+    case GICD_ISACTIVER ... GICD_ISACTIVERN:
+        if ( dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ISACTIVER);
+        if ( rank == NULL) goto write_ignore;
+        vgic_lock_rank(v, rank);
+        rank->iactive &= ~*r;
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ICACTIVER ... GICD_ICACTIVERN:
+        if ( dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ICACTIVER);
+        if ( rank == NULL) goto write_ignore;
+        vgic_lock_rank(v, rank);
+        rank->iactive &= ~*r;
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ITARGETSR ... GICD_ITARGETSR + 7:
+        /* SGI/PPI target is read only */
+        goto write_ignore;
+
+    case GICD_ITARGETSR + 8 ... GICD_ITARGETSRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ITARGETSR);
+        if ( rank == NULL) goto write_ignore;
+        vgic_lock_rank(v, rank);
+        if ( dabt.size == 2 )
+            rank->itargets[REG_RANK_INDEX(8, gicd_reg - GICD_ITARGETSR)] = *r;
+        else
+            byte_write(&rank->itargets[REG_RANK_INDEX(8, gicd_reg - GICD_ITARGETSR)],
+                       *r, offset);
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_IPRIORITYR ... GICD_IPRIORITYRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_IPRIORITYR);
+        if ( rank == NULL) goto write_ignore;
+        vgic_lock_rank(v, rank);
+        if ( dabt.size == 2 )
+            rank->ipriority[REG_RANK_INDEX(8, gicd_reg - GICD_IPRIORITYR)] = *r;
+        else
+            byte_write(&rank->ipriority[REG_RANK_INDEX(8, gicd_reg - GICD_IPRIORITYR)],
+                       *r, offset);
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_ICFGR: /* SGIs */
+        goto write_ignore;
+    case GICD_ICFGR + 1: /* PPIs */
+        /* It is implementation defined if these are writeable. We chose not */
+        goto write_ignore;
+    case GICD_ICFGR + 2 ... GICD_ICFGRN: /* SPIs */
+        if ( dabt.size != 2 ) goto bad_width;
+        rank = vgic_irq_rank(v, 2, gicd_reg - GICD_ICFGR);
+        vgic_lock_rank(v, rank);
+        if ( rank == NULL) goto write_ignore;
+        rank->icfg[REG_RANK_INDEX(2, gicd_reg - GICD_ICFGR)] = *r;
+        vgic_unlock_rank(v, rank);
+        return 1;
+
+    case GICD_NSACR ... GICD_NSACRN:
+        /* We do not implement securty extensions for guests, write ignore */
+        goto write_ignore;
+
+    case GICD_SGIR:
+        if ( dabt.size != 2 ) goto bad_width;
+        printk("vGICD: unhandled write %#"PRIx32" to ICFGR%d\n",
+               *r, gicd_reg - GICD_ICFGR);
+        return 0;
+
+    case GICD_CPENDSGIR ... GICD_CPENDSGIRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        printk("vGICD: unhandled %s write %#"PRIx32" to ICPENDSGIR%d\n",
+               dabt.size ? "word" : "byte", *r, gicd_reg - GICD_CPENDSGIR);
+        return 0;
+
+    case GICD_SPENDSGIR ... GICD_SPENDSGIRN:
+        if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
+        printk("vGICD: unhandled %s write %#"PRIx32" to ISPENDSGIR%d\n",
+               dabt.size ? "word" : "byte", *r, gicd_reg - GICD_SPENDSGIR);
+        return 0;
+
+    /* Implementation defined -- write ignored */
+    case REG(0xfd0) ... REG(0xfe4):
+        goto write_ignore;
+
+    /* R/O -- write ignore */
+    case GICD_ICPIDR2:
+        goto write_ignore;
+
+    /* Implementation defined -- write ignored */
+    case REG(0xfec) ... REG(0xffc):
+        goto write_ignore;
+
+    /* Reserved -- write ignored */
+    case REG(0x00c) ... REG(0x01c):
+    case REG(0x040) ... REG(0x07c):
+    case REG(0x7fc):
+    case REG(0xbfc):
+    case REG(0xf04) ... REG(0xf0c):
+    case REG(0xf30) ... REG(0xfcc):
+        goto write_ignore;
+
+    default:
+        printk("vGICD: unhandled write r%d=%"PRIx32" offset %#08x\n",
+               dabt.reg, *r, offset);
+        return 0;
+    }
+
+bad_width:
+    printk("vGICD: bad write width %d r%d=%"PRIx32" offset %#08x\n",
+           dabt.size, dabt.reg, *r, offset);
+    domain_crash_synchronous();
+    return 0;
+
+write_ignore:
+    if ( dabt.size != 2 ) goto bad_width;
+    return 0;
+}
+
+static int vgic_distr_mmio_check(struct vcpu *v, paddr_t addr)
+{
+    return addr >= VGIC_DISTR_BASE_ADDRESS && addr < (VGIC_DISTR_BASE_ADDRESS+PAGE_SIZE);
+}
+
+const struct mmio_handler vgic_distr_mmio_handler = {
+    .check_handler = vgic_distr_mmio_check,
+    .read_handler  = vgic_distr_mmio_read,
+    .write_handler = vgic_distr_mmio_write,
+};
+
+struct pending_irq *irq_to_pending(struct vcpu *v, unsigned int irq)
+{
+    struct pending_irq *n;
+    /* Pending irqs allocation strategy: the first vgic.nr_lines irqs
+     * are used for SPIs; the rests are used for per cpu irqs */
+    if ( irq < 32 )
+        n = &v->domain->arch.vgic.pending_irqs[irq + (v->vcpu_id * 32)
+            + v->domain->arch.vgic.nr_lines];
+    else
+        n = &v->domain->arch.vgic.pending_irqs[irq - 32];
+    return n;
+}
+
+void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int irq, int virtual)
+{
+    int idx = irq >> 2, byte = irq & 0x3;
+    uint8_t priority;
+    struct vgic_irq_rank *rank = vgic_irq_rank(v, 8, idx);
+    struct pending_irq *iter, *n = irq_to_pending(v, irq);
+
+    /* irq still pending */
+    if (!list_empty(&n->link))
+        return;
+
+    priority = byte_read(rank->ipriority[REG_RANK_INDEX(8, idx)], 0, byte);
+
+    n->irq = irq;
+    n->priority = priority;
+    if (!virtual)
+        n->desc = irq_to_desc(irq);
+    else
+        n->desc = NULL;
+
+    gic_set_guest_irq(irq, GICH_LR_PENDING, priority);
+
+    spin_lock(&v->arch.vgic.lock);
+    list_for_each_entry ( iter, &v->arch.vgic.inflight_irqs, link )
+    {
+        if ( iter->priority < priority )
+        {
+            list_add_tail(&n->link, &iter->link);
+            spin_unlock(&v->arch.vgic.lock);
+            return;
+        }
+    }
+    list_add(&n->link, &v->arch.vgic.inflight_irqs);
+    spin_unlock(&v->arch.vgic.lock);
+    /* we have a new higher priority irq, inject it into the guest */
+    cpu_raise_softirq(v->processor, VGIC_SOFTIRQ);
+}
+
+static void vgic_softirq(void)
+{
+    if (list_empty(&current->arch.vgic.inflight_irqs))
+        return;
+
+    gic_inject_irq_start();
+}
+
+static int __init init_vgic_softirq(void)
+{
+    open_softirq(VGIC_SOFTIRQ, vgic_softirq);
+    return 0;
+}
+__initcall(init_vgic_softirq);
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
+
diff -r 17e746636da4 -r e8b7d44947e4 xen/include/asm-arm/domain.h
--- a/xen/include/asm-arm/domain.h	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/include/asm-arm/domain.h	Thu Feb 09 11:33:30 2012 +0000
@@ -6,6 +6,15 @@
 #include <asm/page.h>
 #include <asm/p2m.h>
 
+/* Represents state corresponding to a block of 32 interrupts */
+struct vgic_irq_rank {
+    spinlock_t lock; /* Covers access to all other members of this struct */
+    uint32_t ienable, iactive, ipend, pendsgi;
+    uint32_t icfg[2];
+    uint32_t ipriority[8];
+    uint32_t itargets[8];
+};
+
 struct pending_irq
 {
     int irq;
@@ -18,6 +27,22 @@
 {
     struct p2m_domain p2m;
 
+    struct {
+        /*
+         * Covers access to other members of this struct _except_ for
+         * shared_irqs where each member contains its own locking.
+         *
+         * If both class of lock is required then this lock must be
+         * taken first. If multiple rank locks are required (including
+         * the per-vcpu private_irqs rank) then they must be taken in
+         * rank order.
+         */
+        spinlock_t lock;
+        int ctlr;
+        int nr_lines;
+        struct vgic_irq_rank *shared_irqs;
+        struct pending_irq *pending_irqs;
+    } vgic;
 }  __cacheline_aligned;
 
 struct arch_vcpu
@@ -27,6 +52,11 @@
     uint32_t sctlr;
     uint32_t ttbr0, ttbr1, ttbcr;
 
+    struct {
+        struct vgic_irq_rank private_irqs;
+        struct list_head inflight_irqs;
+        spinlock_t lock;
+    } vgic;
 }  __cacheline_aligned;
 
 void vcpu_show_execution_state(struct vcpu *);

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:52 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQW-0006G7-7L; Thu, 09 Feb 2012 16:00:52 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQU-00068S-68
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:50 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-174.messagelabs.com!1328803242!8491508!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21990 invoked from network); 9 Feb 2012 16:00:43 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:43 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ1-0004Ou-GY
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ0-00064H-5I
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:20 +0000
Message-Id: <E1RvWQ0-00064H-5I@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen/common/Makefile: introduce
	HAS_{CPUFREQ, PCI, PASSTHROUGH, NS16550, KEXEC}
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787208 0
# Node ID fe7338e04b37f467a4a8bb773de5f66fcaa90778
# Parent  004a886b35d81330ca4e6c582727193fc0fdf2aa
xen/common/Makefile: introduce HAS_{CPUFREQ,PCI,PASSTHROUGH,NS16550,KEXEC}

- make the compilation of ns16550.c depend upon HAS_NS16550;

- make the compilation of cpufreq depend upon HAS_CPUFREQ;

- make the compilation of pci depend upon HAS_PCI;

- make the compilation of passthrough depend upon HAS_PASSTHROUGH;

- make the compilation of kexec depend upon HAS_KEXEC.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 004a886b35d8 -r fe7338e04b37 xen/arch/ia64/Rules.mk
--- a/xen/arch/ia64/Rules.mk	Thu Feb 09 12:07:39 2012 +0100
+++ b/xen/arch/ia64/Rules.mk	Thu Feb 09 11:33:28 2012 +0000
@@ -4,6 +4,11 @@
 ia64 := y
 HAS_ACPI := y
 HAS_VGA  := y
+HAS_CPUFREQ := y
+HAS_PCI := y
+HAS_PASSTHROUGH := y
+HAS_NS16550 := y
+HAS_KEXEC := y
 xenoprof := y
 no_warns ?= n
 vti_debug ?= n
diff -r 004a886b35d8 -r fe7338e04b37 xen/arch/x86/Rules.mk
--- a/xen/arch/x86/Rules.mk	Thu Feb 09 12:07:39 2012 +0100
+++ b/xen/arch/x86/Rules.mk	Thu Feb 09 11:33:28 2012 +0000
@@ -3,6 +3,11 @@
 
 HAS_ACPI := y
 HAS_VGA  := y
+HAS_CPUFREQ := y
+HAS_PCI := y
+HAS_PASSTHROUGH := y
+HAS_NS16550 := y
+HAS_KEXEC := y
 xenoprof := y
 
 #
diff -r 004a886b35d8 -r fe7338e04b37 xen/common/Makefile
--- a/xen/common/Makefile	Thu Feb 09 12:07:39 2012 +0100
+++ b/xen/common/Makefile	Thu Feb 09 11:33:28 2012 +0000
@@ -8,7 +8,7 @@
 obj-y += irq.o
 obj-y += kernel.o
 obj-y += keyhandler.o
-obj-y += kexec.o
+obj-$(HAS_KEXEC) += kexec.o
 obj-y += lib.o
 obj-y += memory.o
 obj-y += multicall.o
diff -r 004a886b35d8 -r fe7338e04b37 xen/common/shutdown.c
--- a/xen/common/shutdown.c	Thu Feb 09 12:07:39 2012 +0100
+++ b/xen/common/shutdown.c	Thu Feb 09 11:33:28 2012 +0000
@@ -6,7 +6,9 @@
 #include <xen/delay.h>
 #include <xen/shutdown.h>
 #include <xen/console.h>
+#ifdef CONFIG_KEXEC
 #include <xen/kexec.h>
+#endif
 #include <asm/debugger.h>
 #include <public/sched.h>
 
@@ -58,7 +60,9 @@
     case SHUTDOWN_watchdog:
     {
         printk("Domain 0 shutdown: watchdog rebooting machine.\n");
+#ifdef CONFIG_KEXEC
         kexec_crash();
+#endif
         machine_restart(0);
         break; /* not reached */
     }
diff -r 004a886b35d8 -r fe7338e04b37 xen/drivers/Makefile
--- a/xen/drivers/Makefile	Thu Feb 09 12:07:39 2012 +0100
+++ b/xen/drivers/Makefile	Thu Feb 09 11:33:28 2012 +0000
@@ -1,6 +1,6 @@
 subdir-y += char
-subdir-y += cpufreq
-subdir-y += pci
-subdir-y += passthrough
+subdir-$(HAS_CPUFREQ) += cpufreq
+subdir-$(HAS_PCI) += pci
+subdir-$(HAS_PASSTHROUGH) += passthrough
 subdir-$(HAS_ACPI) += acpi
 subdir-$(HAS_VGA) += video
diff -r 004a886b35d8 -r fe7338e04b37 xen/drivers/char/Makefile
--- a/xen/drivers/char/Makefile	Thu Feb 09 12:07:39 2012 +0100
+++ b/xen/drivers/char/Makefile	Thu Feb 09 11:33:28 2012 +0000
@@ -1,3 +1,3 @@
 obj-y += console.o
-obj-y += ns16550.o
+obj-$(HAS_NS16550) += ns16550.o
 obj-y += serial.o
diff -r 004a886b35d8 -r fe7338e04b37 xen/drivers/char/console.c
--- a/xen/drivers/char/console.c	Thu Feb 09 12:07:39 2012 +0100
+++ b/xen/drivers/char/console.c	Thu Feb 09 11:33:28 2012 +0000
@@ -22,7 +22,9 @@
 #include <xen/guest_access.h>
 #include <xen/shutdown.h>
 #include <xen/vga.h>
+#ifdef CONFIG_KEXEC
 #include <xen/kexec.h>
+#endif
 #include <asm/debugger.h>
 #include <asm/div64.h>
 #include <xen/hypercall.h> /* for do_console_io */
@@ -963,7 +965,9 @@
 
     debugger_trap_immediate();
 
+#ifdef CONFIG_KEXEC
     kexec_crash();
+#endif
 
     if ( opt_noreboot )
     {
diff -r 004a886b35d8 -r fe7338e04b37 xen/include/asm-ia64/config.h
--- a/xen/include/asm-ia64/config.h	Thu Feb 09 12:07:39 2012 +0100
+++ b/xen/include/asm-ia64/config.h	Thu Feb 09 11:33:28 2012 +0000
@@ -20,6 +20,7 @@
 #define CONFIG_EFI
 #define CONFIG_EFI_PCDP
 #define CONFIG_SERIAL_SGI_L1_CONSOLE
+#define CONFIG_KEXEC 1
 #define CONFIG_XENOPROF 1
 
 #define CONFIG_XEN_SMP
diff -r 004a886b35d8 -r fe7338e04b37 xen/include/asm-x86/config.h
--- a/xen/include/asm-x86/config.h	Thu Feb 09 12:07:39 2012 +0100
+++ b/xen/include/asm-x86/config.h	Thu Feb 09 11:33:28 2012 +0000
@@ -49,6 +49,7 @@
 #define CONFIG_HOTPLUG_CPU 1
 
 #define CONFIG_XENOPROF 1
+#define CONFIG_KEXEC 1
 
 #define HZ 100
 

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 16:00:52 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 16:00:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvWQW-0006G7-7L; Thu, 09 Feb 2012 16:00:52 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQU-00068S-68
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:50 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-174.messagelabs.com!1328803242!8491508!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21990 invoked from network); 9 Feb 2012 16:00:43 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 16:00:43 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ1-0004Ou-GY
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvWQ0-00064H-5I
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 16:00:20 +0000
Message-Id: <E1RvWQ0-00064H-5I@xenbits.xen.org>
Date: Thu, 09 Feb 2012 16:00:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen/common/Makefile: introduce
	HAS_{CPUFREQ, PCI, PASSTHROUGH, NS16550, KEXEC}
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328787208 0
# Node ID fe7338e04b37f467a4a8bb773de5f66fcaa90778
# Parent  004a886b35d81330ca4e6c582727193fc0fdf2aa
xen/common/Makefile: introduce HAS_{CPUFREQ,PCI,PASSTHROUGH,NS16550,KEXEC}

- make the compilation of ns16550.c depend upon HAS_NS16550;

- make the compilation of cpufreq depend upon HAS_CPUFREQ;

- make the compilation of pci depend upon HAS_PCI;

- make the compilation of passthrough depend upon HAS_PASSTHROUGH;

- make the compilation of kexec depend upon HAS_KEXEC.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 004a886b35d8 -r fe7338e04b37 xen/arch/ia64/Rules.mk
--- a/xen/arch/ia64/Rules.mk	Thu Feb 09 12:07:39 2012 +0100
+++ b/xen/arch/ia64/Rules.mk	Thu Feb 09 11:33:28 2012 +0000
@@ -4,6 +4,11 @@
 ia64 := y
 HAS_ACPI := y
 HAS_VGA  := y
+HAS_CPUFREQ := y
+HAS_PCI := y
+HAS_PASSTHROUGH := y
+HAS_NS16550 := y
+HAS_KEXEC := y
 xenoprof := y
 no_warns ?= n
 vti_debug ?= n
diff -r 004a886b35d8 -r fe7338e04b37 xen/arch/x86/Rules.mk
--- a/xen/arch/x86/Rules.mk	Thu Feb 09 12:07:39 2012 +0100
+++ b/xen/arch/x86/Rules.mk	Thu Feb 09 11:33:28 2012 +0000
@@ -3,6 +3,11 @@
 
 HAS_ACPI := y
 HAS_VGA  := y
+HAS_CPUFREQ := y
+HAS_PCI := y
+HAS_PASSTHROUGH := y
+HAS_NS16550 := y
+HAS_KEXEC := y
 xenoprof := y
 
 #
diff -r 004a886b35d8 -r fe7338e04b37 xen/common/Makefile
--- a/xen/common/Makefile	Thu Feb 09 12:07:39 2012 +0100
+++ b/xen/common/Makefile	Thu Feb 09 11:33:28 2012 +0000
@@ -8,7 +8,7 @@
 obj-y += irq.o
 obj-y += kernel.o
 obj-y += keyhandler.o
-obj-y += kexec.o
+obj-$(HAS_KEXEC) += kexec.o
 obj-y += lib.o
 obj-y += memory.o
 obj-y += multicall.o
diff -r 004a886b35d8 -r fe7338e04b37 xen/common/shutdown.c
--- a/xen/common/shutdown.c	Thu Feb 09 12:07:39 2012 +0100
+++ b/xen/common/shutdown.c	Thu Feb 09 11:33:28 2012 +0000
@@ -6,7 +6,9 @@
 #include <xen/delay.h>
 #include <xen/shutdown.h>
 #include <xen/console.h>
+#ifdef CONFIG_KEXEC
 #include <xen/kexec.h>
+#endif
 #include <asm/debugger.h>
 #include <public/sched.h>
 
@@ -58,7 +60,9 @@
     case SHUTDOWN_watchdog:
     {
         printk("Domain 0 shutdown: watchdog rebooting machine.\n");
+#ifdef CONFIG_KEXEC
         kexec_crash();
+#endif
         machine_restart(0);
         break; /* not reached */
     }
diff -r 004a886b35d8 -r fe7338e04b37 xen/drivers/Makefile
--- a/xen/drivers/Makefile	Thu Feb 09 12:07:39 2012 +0100
+++ b/xen/drivers/Makefile	Thu Feb 09 11:33:28 2012 +0000
@@ -1,6 +1,6 @@
 subdir-y += char
-subdir-y += cpufreq
-subdir-y += pci
-subdir-y += passthrough
+subdir-$(HAS_CPUFREQ) += cpufreq
+subdir-$(HAS_PCI) += pci
+subdir-$(HAS_PASSTHROUGH) += passthrough
 subdir-$(HAS_ACPI) += acpi
 subdir-$(HAS_VGA) += video
diff -r 004a886b35d8 -r fe7338e04b37 xen/drivers/char/Makefile
--- a/xen/drivers/char/Makefile	Thu Feb 09 12:07:39 2012 +0100
+++ b/xen/drivers/char/Makefile	Thu Feb 09 11:33:28 2012 +0000
@@ -1,3 +1,3 @@
 obj-y += console.o
-obj-y += ns16550.o
+obj-$(HAS_NS16550) += ns16550.o
 obj-y += serial.o
diff -r 004a886b35d8 -r fe7338e04b37 xen/drivers/char/console.c
--- a/xen/drivers/char/console.c	Thu Feb 09 12:07:39 2012 +0100
+++ b/xen/drivers/char/console.c	Thu Feb 09 11:33:28 2012 +0000
@@ -22,7 +22,9 @@
 #include <xen/guest_access.h>
 #include <xen/shutdown.h>
 #include <xen/vga.h>
+#ifdef CONFIG_KEXEC
 #include <xen/kexec.h>
+#endif
 #include <asm/debugger.h>
 #include <asm/div64.h>
 #include <xen/hypercall.h> /* for do_console_io */
@@ -963,7 +965,9 @@
 
     debugger_trap_immediate();
 
+#ifdef CONFIG_KEXEC
     kexec_crash();
+#endif
 
     if ( opt_noreboot )
     {
diff -r 004a886b35d8 -r fe7338e04b37 xen/include/asm-ia64/config.h
--- a/xen/include/asm-ia64/config.h	Thu Feb 09 12:07:39 2012 +0100
+++ b/xen/include/asm-ia64/config.h	Thu Feb 09 11:33:28 2012 +0000
@@ -20,6 +20,7 @@
 #define CONFIG_EFI
 #define CONFIG_EFI_PCDP
 #define CONFIG_SERIAL_SGI_L1_CONSOLE
+#define CONFIG_KEXEC 1
 #define CONFIG_XENOPROF 1
 
 #define CONFIG_XEN_SMP
diff -r 004a886b35d8 -r fe7338e04b37 xen/include/asm-x86/config.h
--- a/xen/include/asm-x86/config.h	Thu Feb 09 12:07:39 2012 +0100
+++ b/xen/include/asm-x86/config.h	Thu Feb 09 11:33:28 2012 +0000
@@ -49,6 +49,7 @@
 #define CONFIG_HOTPLUG_CPU 1
 
 #define CONFIG_XENOPROF 1
+#define CONFIG_KEXEC 1
 
 #define HZ 100
 

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:18 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rvag6-0001Mr-M1; Thu, 09 Feb 2012 20:33:14 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag5-0001ML-BP
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:13 +0000
Received: from [85.158.139.83:17088] by server-7.bemta-5.messagelabs.com id
	4F/9A-01252-88D243F4; Thu, 09 Feb 2012 20:33:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-182.messagelabs.com!1328819591!14431671!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3614 invoked from network); 9 Feb 2012 20:33:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag2-0007hu-R1
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag2-0004Ks-JM
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:10 +0000
Message-Id: <E1Rvag2-0004Ks-JM@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/python: remove references to
	removed libflask from setup.py
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328796750 28800
# Node ID 77a906fc5082508e2a9605f957aeca2e24b6f488
# Parent  593deed8f62d73dc617f6dd0a95abd05755d002e
tools/python: remove references to removed libflask from setup.py

Build in SLES11 SP1/2 fails after libflask removal.

> building 'flask' extension
> error: ../../tools/flask/libflask/libflask.so: No such file or
> directory
> make[3]: *** [install] Error 1
> make[3]: Leaving directory
> `/usr/src/packages/BUILD/xen-4.2.24701/non-dbg/tools/python'
> make[2]: *** [subdir-install-python] Error 2

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


diff -r 593deed8f62d -r 77a906fc5082 tools/python/setup.py
--- a/tools/python/setup.py	Thu Feb 09 06:09:17 2012 -0800
+++ b/tools/python/setup.py	Thu Feb 09 06:12:30 2012 -0800
@@ -45,12 +45,10 @@
 
 flask = Extension("flask",
                extra_compile_args = extra_compile_args,
-               include_dirs       = [ PATH_XEN, PATH_LIBXC, "xen/lowlevel/flask",
-                                      "../flask/libflask/include" ],
-               library_dirs       = [ PATH_LIBXC, "../flask/libflask" ],
+               include_dirs       = [ PATH_XEN, PATH_LIBXC, "xen/lowlevel/flask" ],
+               library_dirs       = [ PATH_LIBXC ],
                libraries          = [ "xenctrl" ],
-               depends            = [ PATH_LIBXC + "/libxenctrl.so",
-                                      XEN_ROOT + "/tools/flask/libflask/libflask.so" ],
+               depends            = [ PATH_LIBXC + "/libxenctrl.so" ],
                sources            = [ "xen/lowlevel/flask/flask.c" ])
 
 ptsname = Extension("ptsname",

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:18 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rvag6-0001Mr-M1; Thu, 09 Feb 2012 20:33:14 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag5-0001ML-BP
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:13 +0000
Received: from [85.158.139.83:17088] by server-7.bemta-5.messagelabs.com id
	4F/9A-01252-88D243F4; Thu, 09 Feb 2012 20:33:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-182.messagelabs.com!1328819591!14431671!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3614 invoked from network); 9 Feb 2012 20:33:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag2-0007hu-R1
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag2-0004Ks-JM
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:10 +0000
Message-Id: <E1Rvag2-0004Ks-JM@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/python: remove references to
	removed libflask from setup.py
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328796750 28800
# Node ID 77a906fc5082508e2a9605f957aeca2e24b6f488
# Parent  593deed8f62d73dc617f6dd0a95abd05755d002e
tools/python: remove references to removed libflask from setup.py

Build in SLES11 SP1/2 fails after libflask removal.

> building 'flask' extension
> error: ../../tools/flask/libflask/libflask.so: No such file or
> directory
> make[3]: *** [install] Error 1
> make[3]: Leaving directory
> `/usr/src/packages/BUILD/xen-4.2.24701/non-dbg/tools/python'
> make[2]: *** [subdir-install-python] Error 2

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


diff -r 593deed8f62d -r 77a906fc5082 tools/python/setup.py
--- a/tools/python/setup.py	Thu Feb 09 06:09:17 2012 -0800
+++ b/tools/python/setup.py	Thu Feb 09 06:12:30 2012 -0800
@@ -45,12 +45,10 @@
 
 flask = Extension("flask",
                extra_compile_args = extra_compile_args,
-               include_dirs       = [ PATH_XEN, PATH_LIBXC, "xen/lowlevel/flask",
-                                      "../flask/libflask/include" ],
-               library_dirs       = [ PATH_LIBXC, "../flask/libflask" ],
+               include_dirs       = [ PATH_XEN, PATH_LIBXC, "xen/lowlevel/flask" ],
+               library_dirs       = [ PATH_LIBXC ],
                libraries          = [ "xenctrl" ],
-               depends            = [ PATH_LIBXC + "/libxenctrl.so",
-                                      XEN_ROOT + "/tools/flask/libflask/libflask.so" ],
+               depends            = [ PATH_LIBXC + "/libxenctrl.so" ],
                sources            = [ "xen/lowlevel/flask/flask.c" ])
 
 ptsname = Extension("ptsname",

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:19 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rvag6-0001Mc-GS; Thu, 09 Feb 2012 20:33:14 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag4-0001MJ-P5
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:13 +0000
Received: from [85.158.139.83:17065] by server-11.bemta-5.messagelabs.com id
	7C/95-13907-88D243F4; Thu, 09 Feb 2012 20:33:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-182.messagelabs.com!1328819590!14431670!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3599 invoked from network); 9 Feb 2012 20:33:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag1-0007ho-Sb
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag1-0004K5-Hb
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:09 +0000
Message-Id: <E1Rvag1-0004K5-Hb@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] vpmu: Remove unnecessary spaces at
	the end of lines
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
# Date 1328796521 28800
# Node ID 1817738de02198c4bfe31c6e030c6c3924ee1335
# Parent  33344b15a5dc686c9273a7de0fa46ffaac555f37
vpmu: Remove unnecessary spaces at the end of lines

Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 33344b15a5dc -r 1817738de021 xen/arch/x86/oprofile/nmi_int.c
--- a/xen/arch/x86/oprofile/nmi_int.c	Thu Feb 09 06:08:02 2012 -0800
+++ b/xen/arch/x86/oprofile/nmi_int.c	Thu Feb 09 06:08:41 2012 -0800
@@ -24,10 +24,10 @@
 #include <asm/apic.h>
 #include <asm/regs.h>
 #include <asm/current.h>
- 
+
 #include "op_counter.h"
 #include "op_x86_model.h"
- 
+
 struct op_counter_config counter_config[OP_MAX_COUNTER];
 struct op_ibs_config ibs_config;
 
@@ -91,12 +91,12 @@
 	if ( ovf && is_active(current->domain) && !xen_mode )
 		send_guest_vcpu_virq(current, VIRQ_XENOPROF);
 
-	if ( ovf == 2 ) 
+	if ( ovf == 2 )
                 current->nmi_pending = 1;
 	return 1;
 }
- 
- 
+
+
 static void nmi_cpu_save_registers(struct op_msrs *msrs)
 {
 	unsigned int const nr_ctrs = model->num_counters;
@@ -108,7 +108,7 @@
 	for (i = 0; i < nr_ctrs; ++i) {
 		rdmsrl(counters[i].addr, counters[i].value);
 	}
- 
+
 	for (i = 0; i < nr_ctrls; ++i) {
 		rdmsrl(controls[i].addr, controls[i].value);
 	}
@@ -195,7 +195,7 @@
 	 * of msrs are distinct for save and setup operations
 	 */
 	on_each_cpu(nmi_save_registers, NULL, 1);
- 	return 0;
+	return 0;
 }
 
 int nmi_enable_virq(void)
@@ -208,7 +208,7 @@
 void nmi_disable_virq(void)
 {
 	unset_nmi_callback();
-} 
+}
 
 
 static void nmi_restore_registers(struct op_msrs * msrs)
@@ -222,12 +222,12 @@
 	for (i = 0; i < nr_ctrls; ++i) {
 		wrmsrl(controls[i].addr, controls[i].value);
 	}
- 
+
 	for (i = 0; i < nr_ctrs; ++i) {
 		wrmsrl(counters[i].addr, counters[i].value);
 	}
 }
- 
+
 
 static void nmi_cpu_shutdown(void * dummy)
 {
@@ -236,7 +236,7 @@
 	nmi_restore_registers(msrs);
 }
 
- 
+
 void nmi_release_counters(void)
 {
 	on_each_cpu(nmi_cpu_shutdown, NULL, 1);
@@ -244,7 +244,7 @@
 	free_msrs();
 }
 
- 
+
 static void nmi_cpu_start(void * dummy)
 {
 	int cpu = smp_processor_id();
@@ -253,15 +253,15 @@
 	apic_write(APIC_LVTPC, APIC_DM_NMI);
 	model->start(msrs);
 }
- 
+
 
 int nmi_start(void)
 {
 	on_each_cpu(nmi_cpu_start, NULL, 1);
 	return 0;
 }
- 
- 
+
+
 static void nmi_cpu_stop(void * dummy)
 {
 	unsigned int v;
@@ -285,8 +285,8 @@
 	apic_write(APIC_LVTPC, saved_lvtpc[cpu]);
 	apic_write(APIC_LVTERR, v);
 }
- 
- 
+
+
 void nmi_stop(void)
 {
 	on_each_cpu(nmi_cpu_stop, NULL, 1);
@@ -294,7 +294,7 @@
 
 
 static int __init p4_init(char ** cpu_type)
-{ 
+{
 	__u8 cpu_model = current_cpu_data.x86_model;
 
 	if ((cpu_model > 6) || (cpu_model == 5)) {
@@ -402,7 +402,7 @@
 	__u8 vendor = current_cpu_data.x86_vendor;
 	__u8 family = current_cpu_data.x86;
 	__u8 _model = current_cpu_data.x86_model;
- 
+
 	if (!cpu_has_apic) {
 		printk("xenoprof: Initialization failed. No APIC\n");
 		return -ENODEV;
@@ -451,7 +451,7 @@
                                 break;
 			}
 			break;
- 
+
 		case X86_VENDOR_INTEL:
 			switch (family) {
 				/* Pentium IV */
diff -r 33344b15a5dc -r 1817738de021 xen/arch/x86/oprofile/op_model_ppro.c
--- a/xen/arch/x86/oprofile/op_model_ppro.c	Thu Feb 09 06:08:02 2012 -0800
+++ b/xen/arch/x86/oprofile/op_model_ppro.c	Thu Feb 09 06:08:41 2012 -0800
@@ -21,7 +21,7 @@
 #include <asm/current.h>
 #include <asm/hvm/vpmu.h>
 #include <asm/hvm/vmx/vpmu_core2.h>
- 
+
 #include "op_x86_model.h"
 #include "op_counter.h"
 
@@ -42,7 +42,7 @@
 static int num_counters = 2;
 static int counter_width = 32;
 
-#define CTR_OVERFLOWED(n) (!((n) & (1ULL<<(counter_width-1)))) 
+#define CTR_OVERFLOWED(n) (!((n) & (1ULL<<(counter_width-1))))
 
 #define CTRL_READ(msr_content,msrs,c) do {rdmsrl((msrs->controls[(c)].addr), (msr_content));} while (0)
 #define CTRL_WRITE(msr_content,msrs,c) do {wrmsrl((msrs->controls[(c)].addr), (msr_content));} while (0)
@@ -54,11 +54,11 @@
 #define CTRL_SET_KERN(val,k) (val |= ((k & 1ULL) << 17))
 #define CTRL_SET_UM(val, m) (val |= (m << 8))
 #define CTRL_SET_EVENT(val, e) (val |= e)
-#define IS_ACTIVE(val) (val & (1ULL << 22) )  
+#define IS_ACTIVE(val) (val & (1ULL << 22) )
 #define IS_ENABLE(val) (val & (1ULL << 20) )
 static unsigned long reset_value[OP_MAX_COUNTER];
 int ppro_has_global_ctrl = 0;
- 
+
 static void ppro_fill_in_addresses(struct op_msrs * const msrs)
 {
 	int i;
@@ -74,7 +74,7 @@
 {
 	uint64_t msr_content;
 	int i;
-	
+
 	if (cpu_has_arch_perfmon) {
 		union cpuid10_eax eax;
 		eax.full = cpuid_eax(0xa);
@@ -98,7 +98,7 @@
 		CTRL_CLEAR(msr_content);
 		CTRL_WRITE(msr_content, msrs, i);
 	}
-	
+
 	/* avoid a false detection of ctr overflows in NMI handler */
 	for (i = 0; i < num_counters; ++i)
 		wrmsrl(msrs->counters[i].addr, ~0x0ULL);
@@ -142,8 +142,8 @@
 		if (CTR_OVERFLOWED(val)) {
 			xenoprof_log_event(current, regs, eip, mode, i);
 			wrmsrl(msrs->counters[i].addr, -reset_value[i]);
-			if ( is_passive(current->domain) && (mode != 2) && 
-				vpmu_is_set(vcpu_vpmu(current), PASSIVE_DOMAIN_ALLOCATED) ) 
+			if ( is_passive(current->domain) && (mode != 2) &&
+				vpmu_is_set(vcpu_vpmu(current), PASSIVE_DOMAIN_ALLOCATED) )
 			{
 				if ( IS_ACTIVE(msrs_content[i].control) )
 				{
@@ -164,7 +164,7 @@
 	return ovf;
 }
 
- 
+
 static void ppro_start(struct op_msrs const * const msrs)
 {
 	uint64_t msr_content;
@@ -206,7 +206,7 @@
 	if ( (msr_index >= MSR_IA32_PERFCTR0) &&
             (msr_index < (MSR_IA32_PERFCTR0 + num_counters)) )
 	{
-        	*type = MSR_TYPE_ARCH_COUNTER;
+		*type = MSR_TYPE_ARCH_COUNTER;
 		*index = msr_index - MSR_IA32_PERFCTR0;
 		return 1;
         }
@@ -237,7 +237,7 @@
         gdprintk(XENLOG_WARNING, "Insufficient memory for oprofile, oprofile is "
                  "unavailable on domain %d vcpu %d.\n",
                  v->vcpu_id, v->domain->domain_id);
-        return 0;	
+        return 0;
 }
 
 static void ppro_free_msr(struct vcpu *v)
@@ -261,13 +261,13 @@
 	case MSR_TYPE_ARCH_CTRL:
 		*msr_content = msrs[index].control;
 		break;
-	}	
+	}
 }
 
 static void ppro_save_msr(struct vcpu *v, int type, int index, u64 msr_content)
 {
 	struct arch_msr_pair *msrs = vcpu_vpmu(v)->context;
-	
+
 	switch ( type )
 	{
 	case MSR_TYPE_ARCH_COUNTER:
@@ -276,7 +276,7 @@
 	case MSR_TYPE_ARCH_CTRL:
 		msrs[index].control = msr_content;
 		break;
-	}	
+	}
 }
 
 /*

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:19 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rvag6-0001Mc-GS; Thu, 09 Feb 2012 20:33:14 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag4-0001MJ-P5
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:13 +0000
Received: from [85.158.139.83:17065] by server-11.bemta-5.messagelabs.com id
	7C/95-13907-88D243F4; Thu, 09 Feb 2012 20:33:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-182.messagelabs.com!1328819590!14431670!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3599 invoked from network); 9 Feb 2012 20:33:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag1-0007ho-Sb
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag1-0004K5-Hb
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:09 +0000
Message-Id: <E1Rvag1-0004K5-Hb@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] vpmu: Remove unnecessary spaces at
	the end of lines
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
# Date 1328796521 28800
# Node ID 1817738de02198c4bfe31c6e030c6c3924ee1335
# Parent  33344b15a5dc686c9273a7de0fa46ffaac555f37
vpmu: Remove unnecessary spaces at the end of lines

Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 33344b15a5dc -r 1817738de021 xen/arch/x86/oprofile/nmi_int.c
--- a/xen/arch/x86/oprofile/nmi_int.c	Thu Feb 09 06:08:02 2012 -0800
+++ b/xen/arch/x86/oprofile/nmi_int.c	Thu Feb 09 06:08:41 2012 -0800
@@ -24,10 +24,10 @@
 #include <asm/apic.h>
 #include <asm/regs.h>
 #include <asm/current.h>
- 
+
 #include "op_counter.h"
 #include "op_x86_model.h"
- 
+
 struct op_counter_config counter_config[OP_MAX_COUNTER];
 struct op_ibs_config ibs_config;
 
@@ -91,12 +91,12 @@
 	if ( ovf && is_active(current->domain) && !xen_mode )
 		send_guest_vcpu_virq(current, VIRQ_XENOPROF);
 
-	if ( ovf == 2 ) 
+	if ( ovf == 2 )
                 current->nmi_pending = 1;
 	return 1;
 }
- 
- 
+
+
 static void nmi_cpu_save_registers(struct op_msrs *msrs)
 {
 	unsigned int const nr_ctrs = model->num_counters;
@@ -108,7 +108,7 @@
 	for (i = 0; i < nr_ctrs; ++i) {
 		rdmsrl(counters[i].addr, counters[i].value);
 	}
- 
+
 	for (i = 0; i < nr_ctrls; ++i) {
 		rdmsrl(controls[i].addr, controls[i].value);
 	}
@@ -195,7 +195,7 @@
 	 * of msrs are distinct for save and setup operations
 	 */
 	on_each_cpu(nmi_save_registers, NULL, 1);
- 	return 0;
+	return 0;
 }
 
 int nmi_enable_virq(void)
@@ -208,7 +208,7 @@
 void nmi_disable_virq(void)
 {
 	unset_nmi_callback();
-} 
+}
 
 
 static void nmi_restore_registers(struct op_msrs * msrs)
@@ -222,12 +222,12 @@
 	for (i = 0; i < nr_ctrls; ++i) {
 		wrmsrl(controls[i].addr, controls[i].value);
 	}
- 
+
 	for (i = 0; i < nr_ctrs; ++i) {
 		wrmsrl(counters[i].addr, counters[i].value);
 	}
 }
- 
+
 
 static void nmi_cpu_shutdown(void * dummy)
 {
@@ -236,7 +236,7 @@
 	nmi_restore_registers(msrs);
 }
 
- 
+
 void nmi_release_counters(void)
 {
 	on_each_cpu(nmi_cpu_shutdown, NULL, 1);
@@ -244,7 +244,7 @@
 	free_msrs();
 }
 
- 
+
 static void nmi_cpu_start(void * dummy)
 {
 	int cpu = smp_processor_id();
@@ -253,15 +253,15 @@
 	apic_write(APIC_LVTPC, APIC_DM_NMI);
 	model->start(msrs);
 }
- 
+
 
 int nmi_start(void)
 {
 	on_each_cpu(nmi_cpu_start, NULL, 1);
 	return 0;
 }
- 
- 
+
+
 static void nmi_cpu_stop(void * dummy)
 {
 	unsigned int v;
@@ -285,8 +285,8 @@
 	apic_write(APIC_LVTPC, saved_lvtpc[cpu]);
 	apic_write(APIC_LVTERR, v);
 }
- 
- 
+
+
 void nmi_stop(void)
 {
 	on_each_cpu(nmi_cpu_stop, NULL, 1);
@@ -294,7 +294,7 @@
 
 
 static int __init p4_init(char ** cpu_type)
-{ 
+{
 	__u8 cpu_model = current_cpu_data.x86_model;
 
 	if ((cpu_model > 6) || (cpu_model == 5)) {
@@ -402,7 +402,7 @@
 	__u8 vendor = current_cpu_data.x86_vendor;
 	__u8 family = current_cpu_data.x86;
 	__u8 _model = current_cpu_data.x86_model;
- 
+
 	if (!cpu_has_apic) {
 		printk("xenoprof: Initialization failed. No APIC\n");
 		return -ENODEV;
@@ -451,7 +451,7 @@
                                 break;
 			}
 			break;
- 
+
 		case X86_VENDOR_INTEL:
 			switch (family) {
 				/* Pentium IV */
diff -r 33344b15a5dc -r 1817738de021 xen/arch/x86/oprofile/op_model_ppro.c
--- a/xen/arch/x86/oprofile/op_model_ppro.c	Thu Feb 09 06:08:02 2012 -0800
+++ b/xen/arch/x86/oprofile/op_model_ppro.c	Thu Feb 09 06:08:41 2012 -0800
@@ -21,7 +21,7 @@
 #include <asm/current.h>
 #include <asm/hvm/vpmu.h>
 #include <asm/hvm/vmx/vpmu_core2.h>
- 
+
 #include "op_x86_model.h"
 #include "op_counter.h"
 
@@ -42,7 +42,7 @@
 static int num_counters = 2;
 static int counter_width = 32;
 
-#define CTR_OVERFLOWED(n) (!((n) & (1ULL<<(counter_width-1)))) 
+#define CTR_OVERFLOWED(n) (!((n) & (1ULL<<(counter_width-1))))
 
 #define CTRL_READ(msr_content,msrs,c) do {rdmsrl((msrs->controls[(c)].addr), (msr_content));} while (0)
 #define CTRL_WRITE(msr_content,msrs,c) do {wrmsrl((msrs->controls[(c)].addr), (msr_content));} while (0)
@@ -54,11 +54,11 @@
 #define CTRL_SET_KERN(val,k) (val |= ((k & 1ULL) << 17))
 #define CTRL_SET_UM(val, m) (val |= (m << 8))
 #define CTRL_SET_EVENT(val, e) (val |= e)
-#define IS_ACTIVE(val) (val & (1ULL << 22) )  
+#define IS_ACTIVE(val) (val & (1ULL << 22) )
 #define IS_ENABLE(val) (val & (1ULL << 20) )
 static unsigned long reset_value[OP_MAX_COUNTER];
 int ppro_has_global_ctrl = 0;
- 
+
 static void ppro_fill_in_addresses(struct op_msrs * const msrs)
 {
 	int i;
@@ -74,7 +74,7 @@
 {
 	uint64_t msr_content;
 	int i;
-	
+
 	if (cpu_has_arch_perfmon) {
 		union cpuid10_eax eax;
 		eax.full = cpuid_eax(0xa);
@@ -98,7 +98,7 @@
 		CTRL_CLEAR(msr_content);
 		CTRL_WRITE(msr_content, msrs, i);
 	}
-	
+
 	/* avoid a false detection of ctr overflows in NMI handler */
 	for (i = 0; i < num_counters; ++i)
 		wrmsrl(msrs->counters[i].addr, ~0x0ULL);
@@ -142,8 +142,8 @@
 		if (CTR_OVERFLOWED(val)) {
 			xenoprof_log_event(current, regs, eip, mode, i);
 			wrmsrl(msrs->counters[i].addr, -reset_value[i]);
-			if ( is_passive(current->domain) && (mode != 2) && 
-				vpmu_is_set(vcpu_vpmu(current), PASSIVE_DOMAIN_ALLOCATED) ) 
+			if ( is_passive(current->domain) && (mode != 2) &&
+				vpmu_is_set(vcpu_vpmu(current), PASSIVE_DOMAIN_ALLOCATED) )
 			{
 				if ( IS_ACTIVE(msrs_content[i].control) )
 				{
@@ -164,7 +164,7 @@
 	return ovf;
 }
 
- 
+
 static void ppro_start(struct op_msrs const * const msrs)
 {
 	uint64_t msr_content;
@@ -206,7 +206,7 @@
 	if ( (msr_index >= MSR_IA32_PERFCTR0) &&
             (msr_index < (MSR_IA32_PERFCTR0 + num_counters)) )
 	{
-        	*type = MSR_TYPE_ARCH_COUNTER;
+		*type = MSR_TYPE_ARCH_COUNTER;
 		*index = msr_index - MSR_IA32_PERFCTR0;
 		return 1;
         }
@@ -237,7 +237,7 @@
         gdprintk(XENLOG_WARNING, "Insufficient memory for oprofile, oprofile is "
                  "unavailable on domain %d vcpu %d.\n",
                  v->vcpu_id, v->domain->domain_id);
-        return 0;	
+        return 0;
 }
 
 static void ppro_free_msr(struct vcpu *v)
@@ -261,13 +261,13 @@
 	case MSR_TYPE_ARCH_CTRL:
 		*msr_content = msrs[index].control;
 		break;
-	}	
+	}
 }
 
 static void ppro_save_msr(struct vcpu *v, int type, int index, u64 msr_content)
 {
 	struct arch_msr_pair *msrs = vcpu_vpmu(v)->context;
-	
+
 	switch ( type )
 	{
 	case MSR_TYPE_ARCH_COUNTER:
@@ -276,7 +276,7 @@
 	case MSR_TYPE_ARCH_CTRL:
 		msrs[index].control = msr_content;
 		break;
-	}	
+	}
 }
 
 /*

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:19 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rvag6-0001Mm-JY; Thu, 09 Feb 2012 20:33:14 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag4-0001MK-Va
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:13 +0000
Received: from [85.158.139.83:17073] by server-5.bemta-5.messagelabs.com id
	DD/80-03847-88D243F4; Thu, 09 Feb 2012 20:33:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-182.messagelabs.com!1328819590!14441640!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20249 invoked from network); 9 Feb 2012 20:33:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag2-0007hr-AA
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag2-0004KT-2Q
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:10 +0000
Message-Id: <E1Rvag2-0004KT-2Q@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] vpmu: Rename PASSIVE_DOMAIN_ALLOCATED
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
# Date 1328796557 28800
# Node ID 593deed8f62d73dc617f6dd0a95abd05755d002e
# Parent  1817738de02198c4bfe31c6e030c6c3924ee1335
vpmu: Rename PASSIVE_DOMAIN_ALLOCATED

This patch renames the define PASSIVE_DOMAIN_ALLOCATED to follow the
same scheme of the other defines.

Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 1817738de021 -r 593deed8f62d xen/arch/x86/oprofile/nmi_int.c
--- a/xen/arch/x86/oprofile/nmi_int.c	Thu Feb 09 06:08:41 2012 -0800
+++ b/xen/arch/x86/oprofile/nmi_int.c	Thu Feb 09 06:09:17 2012 -0800
@@ -47,7 +47,7 @@
 	if ( !model->is_arch_pmu_msr(msr, typep, indexp) )
 		return 0;
 
-	if ( !vpmu_is_set(vpmu, PASSIVE_DOMAIN_ALLOCATED) )
+	if ( !vpmu_is_set(vpmu, VPMU_PASSIVE_DOMAIN_ALLOCATED) )
 		if ( ! model->allocated_msr(current) )
 			return 0;
 	return 1;
@@ -78,7 +78,7 @@
 void passive_domain_destroy(struct vcpu *v)
 {
 	struct vpmu_struct *vpmu = vcpu_vpmu(v);
-	if ( vpmu_is_set(vpmu, PASSIVE_DOMAIN_ALLOCATED) )
+	if ( vpmu_is_set(vpmu, VPMU_PASSIVE_DOMAIN_ALLOCATED) )
 		model->free_msr(v);
 }
 
diff -r 1817738de021 -r 593deed8f62d xen/arch/x86/oprofile/op_model_ppro.c
--- a/xen/arch/x86/oprofile/op_model_ppro.c	Thu Feb 09 06:08:41 2012 -0800
+++ b/xen/arch/x86/oprofile/op_model_ppro.c	Thu Feb 09 06:09:17 2012 -0800
@@ -143,7 +143,8 @@
 			xenoprof_log_event(current, regs, eip, mode, i);
 			wrmsrl(msrs->counters[i].addr, -reset_value[i]);
 			if ( is_passive(current->domain) && (mode != 2) &&
-				vpmu_is_set(vcpu_vpmu(current), PASSIVE_DOMAIN_ALLOCATED) )
+				vpmu_is_set(vcpu_vpmu(current),
+                                            VPMU_PASSIVE_DOMAIN_ALLOCATED) )
 			{
 				if ( IS_ACTIVE(msrs_content[i].control) )
 				{
@@ -231,7 +232,7 @@
 		goto out;
 	vpmu->context = (void *)msr_content;
 	vpmu_clear(vpmu);
-	vpmu_set(vpmu, PASSIVE_DOMAIN_ALLOCATED);
+	vpmu_set(vpmu, VPMU_PASSIVE_DOMAIN_ALLOCATED);
 	return 1;
 out:
         gdprintk(XENLOG_WARNING, "Insufficient memory for oprofile, oprofile is "
@@ -244,10 +245,10 @@
 {
 	struct vpmu_struct *vpmu = vcpu_vpmu(v);
 
-	if ( !vpmu_is_set(vpmu, PASSIVE_DOMAIN_ALLOCATED) )
+	if ( !vpmu_is_set(vpmu, VPMU_PASSIVE_DOMAIN_ALLOCATED) )
 		return;
 	xfree(vpmu->context);
-	vpmu_reset(vpmu, PASSIVE_DOMAIN_ALLOCATED);
+	vpmu_reset(vpmu, VPMU_PASSIVE_DOMAIN_ALLOCATED);
 }
 
 static void ppro_load_msr(struct vcpu *v, int type, int index, u64 *msr_content)
diff -r 1817738de021 -r 593deed8f62d xen/include/asm-x86/hvm/vpmu.h
--- a/xen/include/asm-x86/hvm/vpmu.h	Thu Feb 09 06:08:41 2012 -0800
+++ b/xen/include/asm-x86/hvm/vpmu.h	Thu Feb 09 06:09:17 2012 -0800
@@ -68,7 +68,7 @@
 #define VPMU_CONTEXT_ALLOCATED              0x1
 #define VPMU_CONTEXT_LOADED                 0x2
 #define VPMU_RUNNING                        0x4
-#define PASSIVE_DOMAIN_ALLOCATED	    0x8
+#define VPMU_PASSIVE_DOMAIN_ALLOCATED       0x8
 
 #define vpmu_set(_vpmu, _x)    ((_vpmu)->flags |= (_x))
 #define vpmu_reset(_vpmu, _x)  ((_vpmu)->flags &= ~(_x))

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:19 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rvag6-0001Mm-JY; Thu, 09 Feb 2012 20:33:14 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag4-0001MK-Va
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:13 +0000
Received: from [85.158.139.83:17073] by server-5.bemta-5.messagelabs.com id
	DD/80-03847-88D243F4; Thu, 09 Feb 2012 20:33:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-182.messagelabs.com!1328819590!14441640!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20249 invoked from network); 9 Feb 2012 20:33:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag2-0007hr-AA
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag2-0004KT-2Q
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:10 +0000
Message-Id: <E1Rvag2-0004KT-2Q@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] vpmu: Rename PASSIVE_DOMAIN_ALLOCATED
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
# Date 1328796557 28800
# Node ID 593deed8f62d73dc617f6dd0a95abd05755d002e
# Parent  1817738de02198c4bfe31c6e030c6c3924ee1335
vpmu: Rename PASSIVE_DOMAIN_ALLOCATED

This patch renames the define PASSIVE_DOMAIN_ALLOCATED to follow the
same scheme of the other defines.

Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 1817738de021 -r 593deed8f62d xen/arch/x86/oprofile/nmi_int.c
--- a/xen/arch/x86/oprofile/nmi_int.c	Thu Feb 09 06:08:41 2012 -0800
+++ b/xen/arch/x86/oprofile/nmi_int.c	Thu Feb 09 06:09:17 2012 -0800
@@ -47,7 +47,7 @@
 	if ( !model->is_arch_pmu_msr(msr, typep, indexp) )
 		return 0;
 
-	if ( !vpmu_is_set(vpmu, PASSIVE_DOMAIN_ALLOCATED) )
+	if ( !vpmu_is_set(vpmu, VPMU_PASSIVE_DOMAIN_ALLOCATED) )
 		if ( ! model->allocated_msr(current) )
 			return 0;
 	return 1;
@@ -78,7 +78,7 @@
 void passive_domain_destroy(struct vcpu *v)
 {
 	struct vpmu_struct *vpmu = vcpu_vpmu(v);
-	if ( vpmu_is_set(vpmu, PASSIVE_DOMAIN_ALLOCATED) )
+	if ( vpmu_is_set(vpmu, VPMU_PASSIVE_DOMAIN_ALLOCATED) )
 		model->free_msr(v);
 }
 
diff -r 1817738de021 -r 593deed8f62d xen/arch/x86/oprofile/op_model_ppro.c
--- a/xen/arch/x86/oprofile/op_model_ppro.c	Thu Feb 09 06:08:41 2012 -0800
+++ b/xen/arch/x86/oprofile/op_model_ppro.c	Thu Feb 09 06:09:17 2012 -0800
@@ -143,7 +143,8 @@
 			xenoprof_log_event(current, regs, eip, mode, i);
 			wrmsrl(msrs->counters[i].addr, -reset_value[i]);
 			if ( is_passive(current->domain) && (mode != 2) &&
-				vpmu_is_set(vcpu_vpmu(current), PASSIVE_DOMAIN_ALLOCATED) )
+				vpmu_is_set(vcpu_vpmu(current),
+                                            VPMU_PASSIVE_DOMAIN_ALLOCATED) )
 			{
 				if ( IS_ACTIVE(msrs_content[i].control) )
 				{
@@ -231,7 +232,7 @@
 		goto out;
 	vpmu->context = (void *)msr_content;
 	vpmu_clear(vpmu);
-	vpmu_set(vpmu, PASSIVE_DOMAIN_ALLOCATED);
+	vpmu_set(vpmu, VPMU_PASSIVE_DOMAIN_ALLOCATED);
 	return 1;
 out:
         gdprintk(XENLOG_WARNING, "Insufficient memory for oprofile, oprofile is "
@@ -244,10 +245,10 @@
 {
 	struct vpmu_struct *vpmu = vcpu_vpmu(v);
 
-	if ( !vpmu_is_set(vpmu, PASSIVE_DOMAIN_ALLOCATED) )
+	if ( !vpmu_is_set(vpmu, VPMU_PASSIVE_DOMAIN_ALLOCATED) )
 		return;
 	xfree(vpmu->context);
-	vpmu_reset(vpmu, PASSIVE_DOMAIN_ALLOCATED);
+	vpmu_reset(vpmu, VPMU_PASSIVE_DOMAIN_ALLOCATED);
 }
 
 static void ppro_load_msr(struct vcpu *v, int type, int index, u64 *msr_content)
diff -r 1817738de021 -r 593deed8f62d xen/include/asm-x86/hvm/vpmu.h
--- a/xen/include/asm-x86/hvm/vpmu.h	Thu Feb 09 06:08:41 2012 -0800
+++ b/xen/include/asm-x86/hvm/vpmu.h	Thu Feb 09 06:09:17 2012 -0800
@@ -68,7 +68,7 @@
 #define VPMU_CONTEXT_ALLOCATED              0x1
 #define VPMU_CONTEXT_LOADED                 0x2
 #define VPMU_RUNNING                        0x4
-#define PASSIVE_DOMAIN_ALLOCATED	    0x8
+#define VPMU_PASSIVE_DOMAIN_ALLOCATED       0x8
 
 #define vpmu_set(_vpmu, _x)    ((_vpmu)->flags |= (_x))
 #define vpmu_reset(_vpmu, _x)  ((_vpmu)->flags &= ~(_x))

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:19 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rvag7-0001N5-OY; Thu, 09 Feb 2012 20:33:15 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag6-0001Ma-Ad
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1328819528!60479913!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9925 invoked from network); 9 Feb 2012 20:32:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:32:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag3-0007i0-OT
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag3-0004Lf-NF
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:11 +0000
Message-Id: <E1Rvag3-0004Lf-NF@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] CONFIG: remove #ifdef __ia64__ from
	the x86 arch tree
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328797249 28800
# Node ID 85c14cbc8f7823f4a41933c526b808176fe32891
# Parent  94dc7b5aa86e547004f0f97439230523d64ee00f
CONFIG: remove #ifdef __ia64__ from the x86 arch tree

__ia64__ really really should not be defined in the x86 arch subtree,
so remove it from xen/include/public/arch-x86/hvm/save.h

This in turn allows the removal of VIOAPIC_IS_IOSAPIC, as x86 does not
use streamlined {IO,L}APICs, allowing for the removal of more code
from the x86 tree.

Changes since v2:
 *  Leave the EOI register write protected by VIOAPIC_VERSION_ID >=
    0x20.  Currently, only version 0x11 is emulated, but leave this
    correct code in place in case a decision is make to emulate the
    newer version.

Changes since v1:
 *  Refresh patch following the decision not to try emulating a
    version 0x20 IOAPIC

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


diff -r 94dc7b5aa86e -r 85c14cbc8f78 xen/arch/x86/hvm/vioapic.c
--- a/xen/arch/x86/hvm/vioapic.c	Thu Feb 09 06:14:20 2012 -0800
+++ b/xen/arch/x86/hvm/vioapic.c	Thu Feb 09 06:20:49 2012 -0800
@@ -59,12 +59,10 @@
                   | (VIOAPIC_VERSION_ID & 0xff));
         break;
 
-#if !VIOAPIC_IS_IOSAPIC
     case VIOAPIC_REG_APIC_ID:
     case VIOAPIC_REG_ARB_ID:
         result = ((vioapic->id & 0xf) << 24);
         break;
-#endif
 
     default:
     {
@@ -179,14 +177,12 @@
         /* Writes are ignored. */
         break;
 
-#if !VIOAPIC_IS_IOSAPIC
     case VIOAPIC_REG_APIC_ID:
         vioapic->id = (val >> 24) & 0xf;
         break;
 
     case VIOAPIC_REG_ARB_ID:
         break;
-#endif
 
     default:
     {
@@ -227,7 +223,7 @@
         vioapic_write_indirect(vioapic, length, val);
         break;
 
-#if VIOAPIC_IS_IOSAPIC
+#if VIOAPIC_VERSION_ID >= 0x20
     case VIOAPIC_REG_EOI:
         vioapic_update_EOI(v->domain, val);
         break;
diff -r 94dc7b5aa86e -r 85c14cbc8f78 xen/include/asm-x86/hvm/vioapic.h
--- a/xen/include/asm-x86/hvm/vioapic.h	Thu Feb 09 06:14:20 2012 -0800
+++ b/xen/include/asm-x86/hvm/vioapic.h	Thu Feb 09 06:20:49 2012 -0800
@@ -30,11 +30,7 @@
 #include <xen/smp.h>
 #include <public/hvm/save.h>
 
-#if !VIOAPIC_IS_IOSAPIC
 #define VIOAPIC_VERSION_ID 0x11 /* IOAPIC version */
-#else
-#define VIOAPIC_VERSION_ID 0x21 /* IOSAPIC version */
-#endif
 
 #define VIOAPIC_EDGE_TRIG  0
 #define VIOAPIC_LEVEL_TRIG 1
diff -r 94dc7b5aa86e -r 85c14cbc8f78 xen/include/public/arch-x86/hvm/save.h
--- a/xen/include/public/arch-x86/hvm/save.h	Thu Feb 09 06:14:20 2012 -0800
+++ b/xen/include/public/arch-x86/hvm/save.h	Thu Feb 09 06:20:49 2012 -0800
@@ -344,12 +344,7 @@
  * IO-APIC
  */
 
-#ifdef __ia64__
-#define VIOAPIC_IS_IOSAPIC 1
-#define VIOAPIC_NUM_PINS  24
-#else
 #define VIOAPIC_NUM_PINS  48 /* 16 ISA IRQs, 32 non-legacy PCI IRQS. */
-#endif
 
 struct hvm_hw_vioapic {
     uint64_t base_address;
@@ -368,13 +363,8 @@
             uint8_t trig_mode:1;
             uint8_t mask:1;
             uint8_t reserve:7;
-#if !VIOAPIC_IS_IOSAPIC
             uint8_t reserved[4];
             uint8_t dest_id;
-#else
-            uint8_t reserved[3];
-            uint16_t dest_id;
-#endif
         } fields;
     } redirtbl[VIOAPIC_NUM_PINS];
 };

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:19 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rvag7-0001N5-OY; Thu, 09 Feb 2012 20:33:15 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag6-0001Ma-Ad
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1328819528!60479913!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9925 invoked from network); 9 Feb 2012 20:32:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:32:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag3-0007i0-OT
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag3-0004Lf-NF
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:11 +0000
Message-Id: <E1Rvag3-0004Lf-NF@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] CONFIG: remove #ifdef __ia64__ from
	the x86 arch tree
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328797249 28800
# Node ID 85c14cbc8f7823f4a41933c526b808176fe32891
# Parent  94dc7b5aa86e547004f0f97439230523d64ee00f
CONFIG: remove #ifdef __ia64__ from the x86 arch tree

__ia64__ really really should not be defined in the x86 arch subtree,
so remove it from xen/include/public/arch-x86/hvm/save.h

This in turn allows the removal of VIOAPIC_IS_IOSAPIC, as x86 does not
use streamlined {IO,L}APICs, allowing for the removal of more code
from the x86 tree.

Changes since v2:
 *  Leave the EOI register write protected by VIOAPIC_VERSION_ID >=
    0x20.  Currently, only version 0x11 is emulated, but leave this
    correct code in place in case a decision is make to emulate the
    newer version.

Changes since v1:
 *  Refresh patch following the decision not to try emulating a
    version 0x20 IOAPIC

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


diff -r 94dc7b5aa86e -r 85c14cbc8f78 xen/arch/x86/hvm/vioapic.c
--- a/xen/arch/x86/hvm/vioapic.c	Thu Feb 09 06:14:20 2012 -0800
+++ b/xen/arch/x86/hvm/vioapic.c	Thu Feb 09 06:20:49 2012 -0800
@@ -59,12 +59,10 @@
                   | (VIOAPIC_VERSION_ID & 0xff));
         break;
 
-#if !VIOAPIC_IS_IOSAPIC
     case VIOAPIC_REG_APIC_ID:
     case VIOAPIC_REG_ARB_ID:
         result = ((vioapic->id & 0xf) << 24);
         break;
-#endif
 
     default:
     {
@@ -179,14 +177,12 @@
         /* Writes are ignored. */
         break;
 
-#if !VIOAPIC_IS_IOSAPIC
     case VIOAPIC_REG_APIC_ID:
         vioapic->id = (val >> 24) & 0xf;
         break;
 
     case VIOAPIC_REG_ARB_ID:
         break;
-#endif
 
     default:
     {
@@ -227,7 +223,7 @@
         vioapic_write_indirect(vioapic, length, val);
         break;
 
-#if VIOAPIC_IS_IOSAPIC
+#if VIOAPIC_VERSION_ID >= 0x20
     case VIOAPIC_REG_EOI:
         vioapic_update_EOI(v->domain, val);
         break;
diff -r 94dc7b5aa86e -r 85c14cbc8f78 xen/include/asm-x86/hvm/vioapic.h
--- a/xen/include/asm-x86/hvm/vioapic.h	Thu Feb 09 06:14:20 2012 -0800
+++ b/xen/include/asm-x86/hvm/vioapic.h	Thu Feb 09 06:20:49 2012 -0800
@@ -30,11 +30,7 @@
 #include <xen/smp.h>
 #include <public/hvm/save.h>
 
-#if !VIOAPIC_IS_IOSAPIC
 #define VIOAPIC_VERSION_ID 0x11 /* IOAPIC version */
-#else
-#define VIOAPIC_VERSION_ID 0x21 /* IOSAPIC version */
-#endif
 
 #define VIOAPIC_EDGE_TRIG  0
 #define VIOAPIC_LEVEL_TRIG 1
diff -r 94dc7b5aa86e -r 85c14cbc8f78 xen/include/public/arch-x86/hvm/save.h
--- a/xen/include/public/arch-x86/hvm/save.h	Thu Feb 09 06:14:20 2012 -0800
+++ b/xen/include/public/arch-x86/hvm/save.h	Thu Feb 09 06:20:49 2012 -0800
@@ -344,12 +344,7 @@
  * IO-APIC
  */
 
-#ifdef __ia64__
-#define VIOAPIC_IS_IOSAPIC 1
-#define VIOAPIC_NUM_PINS  24
-#else
 #define VIOAPIC_NUM_PINS  48 /* 16 ISA IRQs, 32 non-legacy PCI IRQS. */
-#endif
 
 struct hvm_hw_vioapic {
     uint64_t base_address;
@@ -368,13 +363,8 @@
             uint8_t trig_mode:1;
             uint8_t mask:1;
             uint8_t reserve:7;
-#if !VIOAPIC_IS_IOSAPIC
             uint8_t reserved[4];
             uint8_t dest_id;
-#else
-            uint8_t reserved[3];
-            uint16_t dest_id;
-#endif
         } fields;
     } redirtbl[VIOAPIC_NUM_PINS];
 };

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvagB-0001OB-0L; Thu, 09 Feb 2012 20:33:19 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag9-0001MF-FO
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1328819589!12677325!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15887 invoked from network); 9 Feb 2012 20:33:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag1-0007hl-28
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag1-0004Jh-0o
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:09 +0000
Message-Id: <E1Rvag1-0004Jh-0o@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] vpmu: Use macros to access struct
	vpmu_struct.flags
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
# Date 1328796482 28800
# Node ID 33344b15a5dc686c9273a7de0fa46ffaac555f37
# Parent  6f6a6d1d2fb651d76d4f162eb984c01689fb4fc0
vpmu: Use macros to access struct vpmu_struct.flags

This patch introduces some macros realising the access to the item
'flags' in the struct vpmu_struct (see
xen/include/asm-x86/hvm/vpmu.h).  Only bits within 'flags' are
set/reset/checked.

Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 6f6a6d1d2fb6 -r 33344b15a5dc xen/arch/x86/hvm/svm/vpmu.c
--- a/xen/arch/x86/hvm/svm/vpmu.c	Thu Feb 09 06:06:26 2012 -0800
+++ b/xen/arch/x86/hvm/svm/vpmu.c	Thu Feb 09 06:08:02 2012 -0800
@@ -188,8 +188,8 @@
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
     struct amd_vpmu_context *ctxt = vpmu->context;
 
-    if ( !((vpmu->flags & VPMU_CONTEXT_ALLOCATED) &&
-           (vpmu->flags & VPMU_RUNNING)) )
+    if ( !(vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) &&
+           vpmu_is_set(vpmu, VPMU_RUNNING)) )
         return;
 
     context_restore(v);
@@ -214,8 +214,8 @@
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
     struct amd_vpmu_context *ctx = vpmu->context;
 
-    if ( !((vpmu->flags & VPMU_CONTEXT_ALLOCATED) &&
-           (vpmu->flags & VPMU_RUNNING)) )
+    if ( !(vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) &&
+           vpmu_is_set(vpmu, VPMU_RUNNING)) )
         return;
 
     context_save(v);
@@ -261,20 +261,20 @@
 
     /* check if the first counter is enabled */
     if ( (get_pmu_reg_type(msr) == MSR_TYPE_CTRL) &&
-        is_pmu_enabled(msr_content) && !(vpmu->flags & VPMU_RUNNING) )
+        is_pmu_enabled(msr_content) && !vpmu_is_set(vpmu, VPMU_RUNNING) )
     {
         if ( !acquire_pmu_ownership(PMU_OWNER_HVM) )
             return 1;
-        vpmu->flags |= VPMU_RUNNING;
+        vpmu_set(vpmu, VPMU_RUNNING);
         apic_write(APIC_LVTPC, PMU_APIC_VECTOR);
     }
 
     /* stop saving & restore if guest stops first counter */
-    if ( (get_pmu_reg_type(msr) == MSR_TYPE_CTRL) && 
-        (is_pmu_enabled(msr_content) == 0) && (vpmu->flags & VPMU_RUNNING) )
+    if ( (get_pmu_reg_type(msr) == MSR_TYPE_CTRL) &&
+        (is_pmu_enabled(msr_content) == 0) && vpmu_is_set(vpmu, VPMU_RUNNING) )
     {
         apic_write(APIC_LVTPC, PMU_APIC_VECTOR | APIC_LVT_MASKED);
-        vpmu->flags &= ~VPMU_RUNNING;
+        vpmu_reset(vpmu, VPMU_RUNNING);
         release_pmu_ownship(PMU_OWNER_HVM);
     }
 
@@ -298,7 +298,7 @@
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
     uint8_t family = current_cpu_data.x86;
 
-    if ( vpmu->flags & VPMU_CONTEXT_ALLOCATED )
+    if ( vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) )
         return;
 
     if ( counters == NULL )
@@ -333,22 +333,22 @@
     }
 
     vpmu->context = (void *)ctxt;
-    vpmu->flags |= VPMU_CONTEXT_ALLOCATED;
+    vpmu_set(vpmu, VPMU_CONTEXT_ALLOCATED);
 }
 
 static void amd_vpmu_destroy(struct vcpu *v)
 {
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
 
-    if ( !(vpmu->flags & VPMU_CONTEXT_ALLOCATED) )
+    if ( !vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) )
         return;
 
     xfree(vpmu->context);
-    vpmu->flags &= ~VPMU_CONTEXT_ALLOCATED;
+    vpmu_reset(vpmu, VPMU_CONTEXT_ALLOCATED);
 
-    if ( vpmu->flags & VPMU_RUNNING )
+    if ( vpmu_is_set(vpmu, VPMU_RUNNING) )
     {
-        vpmu->flags &= ~VPMU_RUNNING;
+        vpmu_reset(vpmu, VPMU_RUNNING);
         release_pmu_ownship(PMU_OWNER_HVM);
     }
 }
diff -r 6f6a6d1d2fb6 -r 33344b15a5dc xen/arch/x86/hvm/vmx/vpmu_core2.c
--- a/xen/arch/x86/hvm/vmx/vpmu_core2.c	Thu Feb 09 06:06:26 2012 -0800
+++ b/xen/arch/x86/hvm/vmx/vpmu_core2.c	Thu Feb 09 06:08:02 2012 -0800
@@ -266,17 +266,17 @@
 {
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
 
-    if ( !((vpmu->flags & VPMU_CONTEXT_ALLOCATED) &&
-           (vpmu->flags & VPMU_CONTEXT_LOADED)) )
+    if ( !(vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) &&
+           vpmu_is_set(vpmu, VPMU_CONTEXT_LOADED)) )
         return;
 
     __core2_vpmu_save(v);
 
     /* Unset PMU MSR bitmap to trap lazy load. */
-    if ( !(vpmu->flags & VPMU_RUNNING) && cpu_has_vmx_msr_bitmap )
+    if ( !vpmu_is_set(vpmu, VPMU_RUNNING) && cpu_has_vmx_msr_bitmap )
         core2_vpmu_unset_msr_bitmap(v->arch.hvm_vmx.msr_bitmap);
 
-    vpmu->flags &= ~VPMU_CONTEXT_LOADED;
+    vpmu_reset(vpmu, VPMU_CONTEXT_LOADED);
     return;
 }
 
@@ -303,11 +303,11 @@
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
 
     /* Only when PMU is counting, we load PMU context immediately. */
-    if ( !((vpmu->flags & VPMU_CONTEXT_ALLOCATED) &&
-           (vpmu->flags & VPMU_RUNNING)) )
+    if ( !(vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) &&
+           vpmu_is_set(vpmu, VPMU_RUNNING)) )
         return;
     __core2_vpmu_load(v);
-    vpmu->flags |= VPMU_CONTEXT_LOADED;
+    vpmu_set(vpmu, VPMU_CONTEXT_LOADED);
 }
 
 static int core2_vpmu_alloc_resource(struct vcpu *v)
@@ -373,17 +373,17 @@
     if ( !is_core2_vpmu_msr(msr_index, type, index) )
         return 0;
 
-    if ( unlikely(!(vpmu->flags & VPMU_CONTEXT_ALLOCATED)) &&
+    if ( unlikely(!vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED)) &&
 	 (vpmu->context != NULL ||
 	  !core2_vpmu_alloc_resource(current)) )
         return 0;
-    vpmu->flags |= VPMU_CONTEXT_ALLOCATED;
+    vpmu_set(vpmu, VPMU_CONTEXT_ALLOCATED);
 
     /* Do the lazy load staff. */
-    if ( !(vpmu->flags & VPMU_CONTEXT_LOADED) )
+    if ( !vpmu_is_set(vpmu, VPMU_CONTEXT_LOADED) )
     {
         __core2_vpmu_load(current);
-        vpmu->flags |= VPMU_CONTEXT_LOADED;
+        vpmu_set(vpmu, VPMU_CONTEXT_LOADED);
         if ( cpu_has_vmx_msr_bitmap )
             core2_vpmu_set_msr_bitmap(current->arch.hvm_vmx.msr_bitmap);
     }
@@ -467,12 +467,12 @@
     for ( i = 0; i < core2_get_pmc_count(); i++ )
         pmu_enable |= core2_vpmu_cxt->pmu_enable->arch_pmc_enable[i];
     if ( pmu_enable )
-        vpmu->flags |= VPMU_RUNNING;
+        vpmu_set(vpmu, VPMU_RUNNING);
     else
-        vpmu->flags &= ~VPMU_RUNNING;
+        vpmu_reset(vpmu, VPMU_RUNNING);
 
     /* Setup LVTPC in local apic */
-    if ( vpmu->flags & VPMU_RUNNING &&
+    if ( vpmu_is_set(vpmu, VPMU_RUNNING) &&
          is_vlapic_lvtpc_enabled(vcpu_vlapic(v)) )
         apic_write_around(APIC_LVTPC, PMU_APIC_VECTOR);
     else
@@ -588,14 +588,14 @@
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
     struct core2_vpmu_context *core2_vpmu_cxt = vpmu->context;
 
-    if ( !(vpmu->flags & VPMU_CONTEXT_ALLOCATED) )
+    if ( !vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) )
         return;
     xfree(core2_vpmu_cxt->pmu_enable);
     xfree(vpmu->context);
     if ( cpu_has_vmx_msr_bitmap )
         core2_vpmu_unset_msr_bitmap(v->arch.hvm_vmx.msr_bitmap);
     release_pmu_ownship(PMU_OWNER_HVM);
-    vpmu->flags &= ~VPMU_CONTEXT_ALLOCATED;
+    vpmu_reset(vpmu, VPMU_CONTEXT_ALLOCATED);
 }
 
 struct arch_vpmu_ops core2_vpmu_ops = {
diff -r 6f6a6d1d2fb6 -r 33344b15a5dc xen/arch/x86/hvm/vpmu.c
--- a/xen/arch/x86/hvm/vpmu.c	Thu Feb 09 06:06:26 2012 -0800
+++ b/xen/arch/x86/hvm/vpmu.c	Thu Feb 09 06:08:02 2012 -0800
@@ -86,7 +86,7 @@
     if ( !opt_vpmu_enabled )
         return;
 
-    if ( vpmu->flags & VPMU_CONTEXT_ALLOCATED )
+    if ( vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) )
         vpmu_destroy(v);
 
     switch ( vendor )
@@ -110,7 +110,7 @@
 
     if ( vpmu->arch_vpmu_ops != NULL )
     {
-        vpmu->flags = 0;
+        vpmu_clear(vpmu);
         vpmu->context = NULL;
         vpmu->arch_vpmu_ops->arch_vpmu_initialise(v);
     }
diff -r 6f6a6d1d2fb6 -r 33344b15a5dc xen/arch/x86/oprofile/nmi_int.c
--- a/xen/arch/x86/oprofile/nmi_int.c	Thu Feb 09 06:06:26 2012 -0800
+++ b/xen/arch/x86/oprofile/nmi_int.c	Thu Feb 09 06:08:02 2012 -0800
@@ -47,7 +47,7 @@
 	if ( !model->is_arch_pmu_msr(msr, typep, indexp) )
 		return 0;
 
-	if ( !(vpmu->flags & PASSIVE_DOMAIN_ALLOCATED) )
+	if ( !vpmu_is_set(vpmu, PASSIVE_DOMAIN_ALLOCATED) )
 		if ( ! model->allocated_msr(current) )
 			return 0;
 	return 1;
@@ -78,7 +78,7 @@
 void passive_domain_destroy(struct vcpu *v)
 {
 	struct vpmu_struct *vpmu = vcpu_vpmu(v);
-	if ( vpmu->flags & PASSIVE_DOMAIN_ALLOCATED )
+	if ( vpmu_is_set(vpmu, PASSIVE_DOMAIN_ALLOCATED) )
 		model->free_msr(v);
 }
 
diff -r 6f6a6d1d2fb6 -r 33344b15a5dc xen/arch/x86/oprofile/op_model_ppro.c
--- a/xen/arch/x86/oprofile/op_model_ppro.c	Thu Feb 09 06:06:26 2012 -0800
+++ b/xen/arch/x86/oprofile/op_model_ppro.c	Thu Feb 09 06:08:02 2012 -0800
@@ -143,7 +143,7 @@
 			xenoprof_log_event(current, regs, eip, mode, i);
 			wrmsrl(msrs->counters[i].addr, -reset_value[i]);
 			if ( is_passive(current->domain) && (mode != 2) && 
-				(vcpu_vpmu(current)->flags & PASSIVE_DOMAIN_ALLOCATED) ) 
+				vpmu_is_set(vcpu_vpmu(current), PASSIVE_DOMAIN_ALLOCATED) ) 
 			{
 				if ( IS_ACTIVE(msrs_content[i].control) )
 				{
@@ -230,8 +230,8 @@
 	if ( !msr_content )
 		goto out;
 	vpmu->context = (void *)msr_content;
-	vpmu->flags = 0;
-	vpmu->flags |= PASSIVE_DOMAIN_ALLOCATED;
+	vpmu_clear(vpmu);
+	vpmu_set(vpmu, PASSIVE_DOMAIN_ALLOCATED);
 	return 1;
 out:
         gdprintk(XENLOG_WARNING, "Insufficient memory for oprofile, oprofile is "
@@ -244,10 +244,10 @@
 {
 	struct vpmu_struct *vpmu = vcpu_vpmu(v);
 
-	if ( !(vpmu->flags & PASSIVE_DOMAIN_ALLOCATED) )
+	if ( !vpmu_is_set(vpmu, PASSIVE_DOMAIN_ALLOCATED) )
 		return;
 	xfree(vpmu->context);
-	vpmu->flags &= ~PASSIVE_DOMAIN_ALLOCATED;
+	vpmu_reset(vpmu, PASSIVE_DOMAIN_ALLOCATED);
 }
 
 static void ppro_load_msr(struct vcpu *v, int type, int index, u64 *msr_content)
diff -r 6f6a6d1d2fb6 -r 33344b15a5dc xen/include/asm-x86/hvm/vpmu.h
--- a/xen/include/asm-x86/hvm/vpmu.h	Thu Feb 09 06:06:26 2012 -0800
+++ b/xen/include/asm-x86/hvm/vpmu.h	Thu Feb 09 06:08:02 2012 -0800
@@ -69,6 +69,12 @@
 #define VPMU_CONTEXT_LOADED                 0x2
 #define VPMU_RUNNING                        0x4
 #define PASSIVE_DOMAIN_ALLOCATED	    0x8
+
+#define vpmu_set(_vpmu, _x)    ((_vpmu)->flags |= (_x))
+#define vpmu_reset(_vpmu, _x)  ((_vpmu)->flags &= ~(_x))
+#define vpmu_is_set(_vpmu, _x) ((_vpmu)->flags & (_x))
+#define vpmu_clear(_vpmu)      ((_vpmu)->flags = 0)
+
 int vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content);
 int vpmu_do_rdmsr(unsigned int msr, uint64_t *msr_content);
 int vpmu_do_interrupt(struct cpu_user_regs *regs);

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvagB-0001OB-0L; Thu, 09 Feb 2012 20:33:19 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag9-0001MF-FO
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1328819589!12677325!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15887 invoked from network); 9 Feb 2012 20:33:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag1-0007hl-28
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag1-0004Jh-0o
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:09 +0000
Message-Id: <E1Rvag1-0004Jh-0o@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] vpmu: Use macros to access struct
	vpmu_struct.flags
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
# Date 1328796482 28800
# Node ID 33344b15a5dc686c9273a7de0fa46ffaac555f37
# Parent  6f6a6d1d2fb651d76d4f162eb984c01689fb4fc0
vpmu: Use macros to access struct vpmu_struct.flags

This patch introduces some macros realising the access to the item
'flags' in the struct vpmu_struct (see
xen/include/asm-x86/hvm/vpmu.h).  Only bits within 'flags' are
set/reset/checked.

Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 6f6a6d1d2fb6 -r 33344b15a5dc xen/arch/x86/hvm/svm/vpmu.c
--- a/xen/arch/x86/hvm/svm/vpmu.c	Thu Feb 09 06:06:26 2012 -0800
+++ b/xen/arch/x86/hvm/svm/vpmu.c	Thu Feb 09 06:08:02 2012 -0800
@@ -188,8 +188,8 @@
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
     struct amd_vpmu_context *ctxt = vpmu->context;
 
-    if ( !((vpmu->flags & VPMU_CONTEXT_ALLOCATED) &&
-           (vpmu->flags & VPMU_RUNNING)) )
+    if ( !(vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) &&
+           vpmu_is_set(vpmu, VPMU_RUNNING)) )
         return;
 
     context_restore(v);
@@ -214,8 +214,8 @@
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
     struct amd_vpmu_context *ctx = vpmu->context;
 
-    if ( !((vpmu->flags & VPMU_CONTEXT_ALLOCATED) &&
-           (vpmu->flags & VPMU_RUNNING)) )
+    if ( !(vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) &&
+           vpmu_is_set(vpmu, VPMU_RUNNING)) )
         return;
 
     context_save(v);
@@ -261,20 +261,20 @@
 
     /* check if the first counter is enabled */
     if ( (get_pmu_reg_type(msr) == MSR_TYPE_CTRL) &&
-        is_pmu_enabled(msr_content) && !(vpmu->flags & VPMU_RUNNING) )
+        is_pmu_enabled(msr_content) && !vpmu_is_set(vpmu, VPMU_RUNNING) )
     {
         if ( !acquire_pmu_ownership(PMU_OWNER_HVM) )
             return 1;
-        vpmu->flags |= VPMU_RUNNING;
+        vpmu_set(vpmu, VPMU_RUNNING);
         apic_write(APIC_LVTPC, PMU_APIC_VECTOR);
     }
 
     /* stop saving & restore if guest stops first counter */
-    if ( (get_pmu_reg_type(msr) == MSR_TYPE_CTRL) && 
-        (is_pmu_enabled(msr_content) == 0) && (vpmu->flags & VPMU_RUNNING) )
+    if ( (get_pmu_reg_type(msr) == MSR_TYPE_CTRL) &&
+        (is_pmu_enabled(msr_content) == 0) && vpmu_is_set(vpmu, VPMU_RUNNING) )
     {
         apic_write(APIC_LVTPC, PMU_APIC_VECTOR | APIC_LVT_MASKED);
-        vpmu->flags &= ~VPMU_RUNNING;
+        vpmu_reset(vpmu, VPMU_RUNNING);
         release_pmu_ownship(PMU_OWNER_HVM);
     }
 
@@ -298,7 +298,7 @@
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
     uint8_t family = current_cpu_data.x86;
 
-    if ( vpmu->flags & VPMU_CONTEXT_ALLOCATED )
+    if ( vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) )
         return;
 
     if ( counters == NULL )
@@ -333,22 +333,22 @@
     }
 
     vpmu->context = (void *)ctxt;
-    vpmu->flags |= VPMU_CONTEXT_ALLOCATED;
+    vpmu_set(vpmu, VPMU_CONTEXT_ALLOCATED);
 }
 
 static void amd_vpmu_destroy(struct vcpu *v)
 {
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
 
-    if ( !(vpmu->flags & VPMU_CONTEXT_ALLOCATED) )
+    if ( !vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) )
         return;
 
     xfree(vpmu->context);
-    vpmu->flags &= ~VPMU_CONTEXT_ALLOCATED;
+    vpmu_reset(vpmu, VPMU_CONTEXT_ALLOCATED);
 
-    if ( vpmu->flags & VPMU_RUNNING )
+    if ( vpmu_is_set(vpmu, VPMU_RUNNING) )
     {
-        vpmu->flags &= ~VPMU_RUNNING;
+        vpmu_reset(vpmu, VPMU_RUNNING);
         release_pmu_ownship(PMU_OWNER_HVM);
     }
 }
diff -r 6f6a6d1d2fb6 -r 33344b15a5dc xen/arch/x86/hvm/vmx/vpmu_core2.c
--- a/xen/arch/x86/hvm/vmx/vpmu_core2.c	Thu Feb 09 06:06:26 2012 -0800
+++ b/xen/arch/x86/hvm/vmx/vpmu_core2.c	Thu Feb 09 06:08:02 2012 -0800
@@ -266,17 +266,17 @@
 {
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
 
-    if ( !((vpmu->flags & VPMU_CONTEXT_ALLOCATED) &&
-           (vpmu->flags & VPMU_CONTEXT_LOADED)) )
+    if ( !(vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) &&
+           vpmu_is_set(vpmu, VPMU_CONTEXT_LOADED)) )
         return;
 
     __core2_vpmu_save(v);
 
     /* Unset PMU MSR bitmap to trap lazy load. */
-    if ( !(vpmu->flags & VPMU_RUNNING) && cpu_has_vmx_msr_bitmap )
+    if ( !vpmu_is_set(vpmu, VPMU_RUNNING) && cpu_has_vmx_msr_bitmap )
         core2_vpmu_unset_msr_bitmap(v->arch.hvm_vmx.msr_bitmap);
 
-    vpmu->flags &= ~VPMU_CONTEXT_LOADED;
+    vpmu_reset(vpmu, VPMU_CONTEXT_LOADED);
     return;
 }
 
@@ -303,11 +303,11 @@
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
 
     /* Only when PMU is counting, we load PMU context immediately. */
-    if ( !((vpmu->flags & VPMU_CONTEXT_ALLOCATED) &&
-           (vpmu->flags & VPMU_RUNNING)) )
+    if ( !(vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) &&
+           vpmu_is_set(vpmu, VPMU_RUNNING)) )
         return;
     __core2_vpmu_load(v);
-    vpmu->flags |= VPMU_CONTEXT_LOADED;
+    vpmu_set(vpmu, VPMU_CONTEXT_LOADED);
 }
 
 static int core2_vpmu_alloc_resource(struct vcpu *v)
@@ -373,17 +373,17 @@
     if ( !is_core2_vpmu_msr(msr_index, type, index) )
         return 0;
 
-    if ( unlikely(!(vpmu->flags & VPMU_CONTEXT_ALLOCATED)) &&
+    if ( unlikely(!vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED)) &&
 	 (vpmu->context != NULL ||
 	  !core2_vpmu_alloc_resource(current)) )
         return 0;
-    vpmu->flags |= VPMU_CONTEXT_ALLOCATED;
+    vpmu_set(vpmu, VPMU_CONTEXT_ALLOCATED);
 
     /* Do the lazy load staff. */
-    if ( !(vpmu->flags & VPMU_CONTEXT_LOADED) )
+    if ( !vpmu_is_set(vpmu, VPMU_CONTEXT_LOADED) )
     {
         __core2_vpmu_load(current);
-        vpmu->flags |= VPMU_CONTEXT_LOADED;
+        vpmu_set(vpmu, VPMU_CONTEXT_LOADED);
         if ( cpu_has_vmx_msr_bitmap )
             core2_vpmu_set_msr_bitmap(current->arch.hvm_vmx.msr_bitmap);
     }
@@ -467,12 +467,12 @@
     for ( i = 0; i < core2_get_pmc_count(); i++ )
         pmu_enable |= core2_vpmu_cxt->pmu_enable->arch_pmc_enable[i];
     if ( pmu_enable )
-        vpmu->flags |= VPMU_RUNNING;
+        vpmu_set(vpmu, VPMU_RUNNING);
     else
-        vpmu->flags &= ~VPMU_RUNNING;
+        vpmu_reset(vpmu, VPMU_RUNNING);
 
     /* Setup LVTPC in local apic */
-    if ( vpmu->flags & VPMU_RUNNING &&
+    if ( vpmu_is_set(vpmu, VPMU_RUNNING) &&
          is_vlapic_lvtpc_enabled(vcpu_vlapic(v)) )
         apic_write_around(APIC_LVTPC, PMU_APIC_VECTOR);
     else
@@ -588,14 +588,14 @@
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
     struct core2_vpmu_context *core2_vpmu_cxt = vpmu->context;
 
-    if ( !(vpmu->flags & VPMU_CONTEXT_ALLOCATED) )
+    if ( !vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) )
         return;
     xfree(core2_vpmu_cxt->pmu_enable);
     xfree(vpmu->context);
     if ( cpu_has_vmx_msr_bitmap )
         core2_vpmu_unset_msr_bitmap(v->arch.hvm_vmx.msr_bitmap);
     release_pmu_ownship(PMU_OWNER_HVM);
-    vpmu->flags &= ~VPMU_CONTEXT_ALLOCATED;
+    vpmu_reset(vpmu, VPMU_CONTEXT_ALLOCATED);
 }
 
 struct arch_vpmu_ops core2_vpmu_ops = {
diff -r 6f6a6d1d2fb6 -r 33344b15a5dc xen/arch/x86/hvm/vpmu.c
--- a/xen/arch/x86/hvm/vpmu.c	Thu Feb 09 06:06:26 2012 -0800
+++ b/xen/arch/x86/hvm/vpmu.c	Thu Feb 09 06:08:02 2012 -0800
@@ -86,7 +86,7 @@
     if ( !opt_vpmu_enabled )
         return;
 
-    if ( vpmu->flags & VPMU_CONTEXT_ALLOCATED )
+    if ( vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) )
         vpmu_destroy(v);
 
     switch ( vendor )
@@ -110,7 +110,7 @@
 
     if ( vpmu->arch_vpmu_ops != NULL )
     {
-        vpmu->flags = 0;
+        vpmu_clear(vpmu);
         vpmu->context = NULL;
         vpmu->arch_vpmu_ops->arch_vpmu_initialise(v);
     }
diff -r 6f6a6d1d2fb6 -r 33344b15a5dc xen/arch/x86/oprofile/nmi_int.c
--- a/xen/arch/x86/oprofile/nmi_int.c	Thu Feb 09 06:06:26 2012 -0800
+++ b/xen/arch/x86/oprofile/nmi_int.c	Thu Feb 09 06:08:02 2012 -0800
@@ -47,7 +47,7 @@
 	if ( !model->is_arch_pmu_msr(msr, typep, indexp) )
 		return 0;
 
-	if ( !(vpmu->flags & PASSIVE_DOMAIN_ALLOCATED) )
+	if ( !vpmu_is_set(vpmu, PASSIVE_DOMAIN_ALLOCATED) )
 		if ( ! model->allocated_msr(current) )
 			return 0;
 	return 1;
@@ -78,7 +78,7 @@
 void passive_domain_destroy(struct vcpu *v)
 {
 	struct vpmu_struct *vpmu = vcpu_vpmu(v);
-	if ( vpmu->flags & PASSIVE_DOMAIN_ALLOCATED )
+	if ( vpmu_is_set(vpmu, PASSIVE_DOMAIN_ALLOCATED) )
 		model->free_msr(v);
 }
 
diff -r 6f6a6d1d2fb6 -r 33344b15a5dc xen/arch/x86/oprofile/op_model_ppro.c
--- a/xen/arch/x86/oprofile/op_model_ppro.c	Thu Feb 09 06:06:26 2012 -0800
+++ b/xen/arch/x86/oprofile/op_model_ppro.c	Thu Feb 09 06:08:02 2012 -0800
@@ -143,7 +143,7 @@
 			xenoprof_log_event(current, regs, eip, mode, i);
 			wrmsrl(msrs->counters[i].addr, -reset_value[i]);
 			if ( is_passive(current->domain) && (mode != 2) && 
-				(vcpu_vpmu(current)->flags & PASSIVE_DOMAIN_ALLOCATED) ) 
+				vpmu_is_set(vcpu_vpmu(current), PASSIVE_DOMAIN_ALLOCATED) ) 
 			{
 				if ( IS_ACTIVE(msrs_content[i].control) )
 				{
@@ -230,8 +230,8 @@
 	if ( !msr_content )
 		goto out;
 	vpmu->context = (void *)msr_content;
-	vpmu->flags = 0;
-	vpmu->flags |= PASSIVE_DOMAIN_ALLOCATED;
+	vpmu_clear(vpmu);
+	vpmu_set(vpmu, PASSIVE_DOMAIN_ALLOCATED);
 	return 1;
 out:
         gdprintk(XENLOG_WARNING, "Insufficient memory for oprofile, oprofile is "
@@ -244,10 +244,10 @@
 {
 	struct vpmu_struct *vpmu = vcpu_vpmu(v);
 
-	if ( !(vpmu->flags & PASSIVE_DOMAIN_ALLOCATED) )
+	if ( !vpmu_is_set(vpmu, PASSIVE_DOMAIN_ALLOCATED) )
 		return;
 	xfree(vpmu->context);
-	vpmu->flags &= ~PASSIVE_DOMAIN_ALLOCATED;
+	vpmu_reset(vpmu, PASSIVE_DOMAIN_ALLOCATED);
 }
 
 static void ppro_load_msr(struct vcpu *v, int type, int index, u64 *msr_content)
diff -r 6f6a6d1d2fb6 -r 33344b15a5dc xen/include/asm-x86/hvm/vpmu.h
--- a/xen/include/asm-x86/hvm/vpmu.h	Thu Feb 09 06:06:26 2012 -0800
+++ b/xen/include/asm-x86/hvm/vpmu.h	Thu Feb 09 06:08:02 2012 -0800
@@ -69,6 +69,12 @@
 #define VPMU_CONTEXT_LOADED                 0x2
 #define VPMU_RUNNING                        0x4
 #define PASSIVE_DOMAIN_ALLOCATED	    0x8
+
+#define vpmu_set(_vpmu, _x)    ((_vpmu)->flags |= (_x))
+#define vpmu_reset(_vpmu, _x)  ((_vpmu)->flags &= ~(_x))
+#define vpmu_is_set(_vpmu, _x) ((_vpmu)->flags & (_x))
+#define vpmu_clear(_vpmu)      ((_vpmu)->flags = 0)
+
 int vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content);
 int vpmu_do_rdmsr(unsigned int msr, uint64_t *msr_content);
 int vpmu_do_interrupt(struct cpu_user_regs *regs);

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rvag9-0001NR-Rd; Thu, 09 Feb 2012 20:33:17 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag8-0001ME-BU
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-216.messagelabs.com!1328819589!13315391!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21245 invoked from network); 9 Feb 2012 20:33:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag0-0007hi-Qy
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag0-0004JG-EO
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:08 +0000
Message-Id: <E1Rvag0-0004JG-EO@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] amd iommu: Remove redundant checks
	from iommu emulation code path
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328796386 28800
# Node ID 6f6a6d1d2fb651d76d4f162eb984c01689fb4fc0
# Parent  18b9ea53c8ac0e2d6aee68dd50a50c0b08a01a1e
amd iommu: Remove redundant checks from iommu emulation code path

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 18b9ea53c8ac -r 6f6a6d1d2fb6 xen/drivers/passthrough/amd/iommu_guest.c
--- a/xen/drivers/passthrough/amd/iommu_guest.c	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/drivers/passthrough/amd/iommu_guest.c	Thu Feb 09 06:06:26 2012 -0800
@@ -805,9 +805,6 @@
     p2m_type_t t;
     struct guest_iommu *iommu = domain_iommu(d);
 
-    if ( !is_hvm_domain(d) || !iommu_enabled || !iommuv2_enabled )
-        return 0;
-
     if ( !iommu )
         return -EACCES;
 
@@ -896,9 +893,6 @@
 {
     struct guest_iommu *iommu;
 
-    if ( !is_hvm_domain(d) || !iommu_enabled || !iommuv2_enabled )
-        return;
-
     iommu = domain_iommu(d);
     if ( !iommu )
         return;

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rvag9-0001NR-Rd; Thu, 09 Feb 2012 20:33:17 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag8-0001ME-BU
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-216.messagelabs.com!1328819589!13315391!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21245 invoked from network); 9 Feb 2012 20:33:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag0-0007hi-Qy
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag0-0004JG-EO
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:08 +0000
Message-Id: <E1Rvag0-0004JG-EO@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] amd iommu: Remove redundant checks
	from iommu emulation code path
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328796386 28800
# Node ID 6f6a6d1d2fb651d76d4f162eb984c01689fb4fc0
# Parent  18b9ea53c8ac0e2d6aee68dd50a50c0b08a01a1e
amd iommu: Remove redundant checks from iommu emulation code path

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 18b9ea53c8ac -r 6f6a6d1d2fb6 xen/drivers/passthrough/amd/iommu_guest.c
--- a/xen/drivers/passthrough/amd/iommu_guest.c	Thu Feb 09 11:33:30 2012 +0000
+++ b/xen/drivers/passthrough/amd/iommu_guest.c	Thu Feb 09 06:06:26 2012 -0800
@@ -805,9 +805,6 @@
     p2m_type_t t;
     struct guest_iommu *iommu = domain_iommu(d);
 
-    if ( !is_hvm_domain(d) || !iommu_enabled || !iommuv2_enabled )
-        return 0;
-
     if ( !iommu )
         return -EACCES;
 
@@ -896,9 +893,6 @@
 {
     struct guest_iommu *iommu;
 
-    if ( !is_hvm_domain(d) || !iommu_enabled || !iommuv2_enabled )
-        return;
-
     iommu = domain_iommu(d);
     if ( !iommu )
         return;

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvagB-0001OO-3z; Thu, 09 Feb 2012 20:33:19 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag9-0001NL-Hb
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:17 +0000
Received: from [85.158.139.83:8376] by server-9.bemta-5.messagelabs.com id
	70/34-23757-C8D243F4; Thu, 09 Feb 2012 20:33:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-182.messagelabs.com!1328819594!14441644!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20288 invoked from network); 9 Feb 2012 20:33:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag6-0007iF-CF
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag6-0004Nd-At
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:14 +0000
Message-Id: <E1Rvag6-0004Nd-At@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: support zImage format kernels
	for dom0
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1328801570 0
# Node ID da77e2bfcd14b75eb3c341b98b75dfed20ec0bdc
# Parent  48294c0c475d0b5c0f8476c5e6e71cb76c7d9fa8
arm: support zImage format kernels for dom0

Allow a zImage format kernel to be used for dom0.  zImages are (by
default) hardcoded with the RAM location so adjust the RAM in the
memory map to match the physical memory map (0x80000000).

Vmlinux ELF images are loaded using a hack to locate the RAM so the
IPA is the same as the kernel's VA so the elf loader does the right
thing.  If an ELF image is loaded the RAM will be located at
0xC0000000 (as before).

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 48294c0c475d -r da77e2bfcd14 xen/arch/arm/Makefile
--- a/xen/arch/arm/Makefile	Thu Feb 09 15:32:50 2012 +0000
+++ b/xen/arch/arm/Makefile	Thu Feb 09 15:32:50 2012 +0000
@@ -7,6 +7,7 @@
 obj-y += gic.o
 obj-y += io.o
 obj-y += irq.o
+obj-y += kernel.o
 obj-y += mm.o
 obj-y += p2m.o
 obj-y += guestcopy.o
diff -r 48294c0c475d -r da77e2bfcd14 xen/arch/arm/domain_build.c
--- a/xen/arch/arm/domain_build.c	Thu Feb 09 15:32:50 2012 +0000
+++ b/xen/arch/arm/domain_build.c	Thu Feb 09 15:32:50 2012 +0000
@@ -4,10 +4,10 @@
 #include <xen/mm.h>
 #include <xen/domain_page.h>
 #include <xen/sched.h>
-#include <xen/libelf.h>
 #include <asm/irq.h>
 
 #include "gic.h"
+#include "kernel.h"
 
 static unsigned int __initdata opt_dom0_max_vcpus;
 integer_param("dom0_max_vcpus", opt_dom0_max_vcpus);
@@ -28,25 +28,6 @@
 
 extern void guest_mode_entry(void);
 
-static void copy_from_flash(void *dst, paddr_t flash, unsigned long len)
-{
-    void *src = (void *)FIXMAP_ADDR(FIXMAP_MISC);
-    unsigned long offs;
-
-    printk("Copying %#lx bytes from flash %"PRIpaddr" to %p-%p: [",
-           len, flash, dst, dst+(1<<23));
-    for ( offs = 0; offs < len ; offs += PAGE_SIZE )
-    {
-        if ( ( offs % (1<<20) ) == 0 )
-            printk(".");
-        set_fixmap(FIXMAP_MISC, (flash+offs) >> PAGE_SHIFT, DEV_SHARED);
-        memcpy(dst+offs, src, PAGE_SIZE);
-    }
-    printk("]\n");
-
-    clear_fixmap(FIXMAP_MISC);
-}
-
 static void setup_linux_atag(paddr_t tags, paddr_t ram_s, paddr_t ram_e)
 {
     paddr_t ma = gvirt_to_maddr(tags);
@@ -84,21 +65,14 @@
     unmap_domain_page(map);
 }
 
-/* Store kernel in first 8M of flash */
-#define KERNEL_FLASH_ADDRESS 0x00000000UL
-#define KERNEL_FLASH_SIZE    0x00800000UL
-
 int construct_dom0(struct domain *d)
 {
-    int rc, kernel_order;
-    void *kernel_img;
+    struct kernel_info kinfo = {};
+    int rc;
 
     struct vcpu *v = d->vcpu[0];
     struct cpu_user_regs *regs = &v->arch.user_regs;
 
-    struct elf_binary elf;
-    struct elf_dom_parms parms;
-
     /* Sanity! */
     BUG_ON(d->domain_id != 0);
     BUG_ON(d->vcpu[0] == NULL);
@@ -106,31 +80,22 @@
 
     printk("*** LOADING DOMAIN 0 ***\n");
 
-    kernel_order = get_order_from_bytes(KERNEL_FLASH_SIZE);
-    kernel_img = alloc_xenheap_pages(kernel_order, 0);
-    if ( kernel_img == NULL )
-        panic("Cannot allocate temporary buffer for kernel.\n");
+    /* 128M at 2G physical */
+    /* TODO size and location from DT. */
+    kinfo.ram_start = 0x80000000;
+    kinfo.ram_end   = 0x88000000;
 
-    copy_from_flash(kernel_img, KERNEL_FLASH_ADDRESS, KERNEL_FLASH_SIZE);
+    rc = kernel_prepare(&kinfo);
+    if (rc < 0)
+        return rc;
 
     d->max_pages = ~0U;
 
-    if ( (rc = elf_init(&elf, kernel_img, KERNEL_FLASH_SIZE )) != 0 )
-        return rc;  memset(regs, 0, sizeof(*regs));
-#ifdef VERBOSE
-    elf_set_verbose(&elf);
-#endif
-    elf_parse_binary(&elf);
-    if ( (rc = elf_xen_parse(&elf, &parms)) != 0 )
-        return rc;
-
     if ( (rc = p2m_alloc_table(d)) != 0 )
         return rc;
 
-    /* 128M at 3G physical */
-    /* TODO size and location according to platform info */
-    printk("Populate P2M %#llx->%#llx\n", 0xc0000000ULL, 0xc8000000ULL);
-    p2m_populate_ram(d, 0xc0000000ULL, 0xc8000000ULL);
+    printk("Populate P2M %#llx->%#llx\n", kinfo.ram_start, kinfo.ram_end);
+    p2m_populate_ram(d, kinfo.ram_start, kinfo.ram_end);
 
     printk("Map CS2 MMIO regions 1:1 in the P2M %#llx->%#llx\n", 0x18000000ULL, 0x1BFFFFFFULL);
     map_mmio_regions(d, 0x18000000, 0x1BFFFFFF, 0x18000000);
@@ -161,20 +126,15 @@
     /* The following load uses domain's p2m */
     p2m_load_VTTBR(d);
 
-    printk("Loading ELF image into guest memory\n");
-    elf.dest = (void*)(unsigned long)parms.virt_kstart;
-    elf_load_binary(&elf);
+    kernel_load(&kinfo);
 
-    printk("Free temporary kernel buffer\n");
-    free_xenheap_pages(kernel_img, kernel_order);
-
-    setup_linux_atag(0xc0000100ULL, 0xc0000000ULL, 0xc8000000ULL);
+    setup_linux_atag(kinfo.ram_start + 0x100, kinfo.ram_start, kinfo.ram_end);
 
     clear_bit(_VPF_down, &v->pause_flags);
 
     memset(regs, 0, sizeof(*regs));
 
-    regs->pc = (uint32_t)parms.virt_entry;
+    regs->pc = (uint32_t)kinfo.entry;
 
     regs->cpsr = PSR_ABT_MASK|PSR_FIQ_MASK|PSR_IRQ_MASK|PSR_MODE_SVC;
 
@@ -191,7 +151,7 @@
 
     regs->r0 = 0; /* SBZ */
     regs->r1 = 2272; /* Machine NR: Versatile Express */
-    regs->r2 = 0xc0000100; /* ATAGS */
+    regs->r2 = kinfo.ram_start + 0x100; /* ATAGS */
 
     WRITE_CP32(SCTLR_BASE, SCTLR);
 
diff -r 48294c0c475d -r da77e2bfcd14 xen/arch/arm/kernel.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/kernel.c	Thu Feb 09 15:32:50 2012 +0000
@@ -0,0 +1,167 @@
+/*
+ * Kernel image loading.
+ *
+ * Copyright (C) 2011 Citrix Systems, Inc.
+ */
+#include <xen/config.h>
+#include <xen/errno.h>
+#include <xen/init.h>
+#include <xen/lib.h>
+#include <xen/mm.h>
+#include <xen/domain_page.h>
+#include <xen/sched.h>
+
+#include "kernel.h"
+
+/* Store kernel in first 8M of flash */
+#define KERNEL_FLASH_ADDRESS 0x00000000UL
+#define KERNEL_FLASH_SIZE    0x00800000UL
+
+#define ZIMAGE_MAGIC_OFFSET 0x24
+#define ZIMAGE_START_OFFSET 0x28
+#define ZIMAGE_END_OFFSET   0x2c
+
+#define ZIMAGE_MAGIC 0x016f2818
+
+static void kernel_zimage_load(struct kernel_info *info)
+{
+    paddr_t load_addr = info->zimage.load_addr;
+    paddr_t len = info->zimage.len;
+    paddr_t flash = KERNEL_FLASH_ADDRESS;
+    void *src = (void *)FIXMAP_ADDR(FIXMAP_MISC);
+    unsigned long offs;
+
+    printk("Loading %"PRIpaddr" byte zImage from flash %"PRIpaddr" to %"PRIpaddr"-%"PRIpaddr": [",
+           len, flash, load_addr, load_addr + len);
+    for ( offs = 0; offs < len; offs += PAGE_SIZE )
+    {
+        paddr_t ma = gvirt_to_maddr(load_addr + offs);
+        void *dst = map_domain_page(ma>>PAGE_SHIFT);
+
+        if ( ( offs % (1<<20) ) == 0 )
+            printk(".");
+
+        set_fixmap(FIXMAP_MISC, (flash+offs) >> PAGE_SHIFT, DEV_SHARED);
+        memcpy(dst, src, PAGE_SIZE);
+        clear_fixmap(FIXMAP_MISC);
+
+        unmap_domain_page(dst);
+    }
+    printk("]\n");
+}
+
+/**
+ * Check the image is a zImage and return the load address and length
+ * (FIXME: including any appended DTB).
+ */
+static int kernel_try_zimage_prepare(struct kernel_info *info)
+{
+    uint32_t *zimage = (void *)FIXMAP_ADDR(FIXMAP_MISC);
+    uint32_t start, end;
+
+    set_fixmap(FIXMAP_MISC, KERNEL_FLASH_ADDRESS >> PAGE_SHIFT, DEV_SHARED);
+
+    if (zimage[ZIMAGE_MAGIC_OFFSET/4] != ZIMAGE_MAGIC)
+        return -EINVAL;
+
+    start = zimage[ZIMAGE_START_OFFSET/4];
+    end = zimage[ZIMAGE_END_OFFSET/4];
+
+    clear_fixmap(FIXMAP_MISC);
+
+    /* FIXME: get RAM location from appended DTB (if there is one)? */
+
+    /*
+     * If start is zero, the zImage is position independent -- load it
+     * at 32k from start of RAM.
+     */
+    if (start == 0)
+        info->zimage.load_addr = info->ram_start + 0x8000;
+    else
+        info->zimage.load_addr = start;
+    info->zimage.len = end - start;
+
+    info->entry = info->zimage.load_addr;
+    info->load = kernel_zimage_load;
+
+    return 0;
+}
+
+static void kernel_elf_load(struct kernel_info *info)
+{
+    printk("Loading ELF image into guest memory\n");
+    info->elf.elf.dest = (void*)(unsigned long)info->elf.parms.virt_kstart;
+    elf_load_binary(&info->elf.elf);
+
+    printk("Free temporary kernel buffer\n");
+    free_xenheap_pages(info->kernel_img, info->kernel_order);
+}
+
+static void copy_from_flash(void *dst, paddr_t flash, unsigned long len)
+{
+    void *src = (void *)FIXMAP_ADDR(FIXMAP_MISC);
+    unsigned long offs;
+
+    printk("Copying %#lx bytes from flash %"PRIpaddr" to %p-%p: [",
+           len, flash, dst, dst+(1<<23));
+    for ( offs = 0; offs < len ; offs += PAGE_SIZE )
+    {
+        if ( ( offs % (1<<20) ) == 0 )
+            printk(".");
+        set_fixmap(FIXMAP_MISC, (flash+offs) >> PAGE_SHIFT, DEV_SHARED);
+        memcpy(dst+offs, src, PAGE_SIZE);
+    }
+    printk("]\n");
+
+    clear_fixmap(FIXMAP_MISC);
+}
+
+static int kernel_try_elf_prepare(struct kernel_info *info)
+{
+    int rc;
+
+    info->kernel_order = get_order_from_bytes(KERNEL_FLASH_SIZE);
+    info->kernel_img = alloc_xenheap_pages(info->kernel_order, 0);
+    if ( info->kernel_img == NULL )
+        panic("Cannot allocate temporary buffer for kernel.\n");
+
+    copy_from_flash(info->kernel_img, KERNEL_FLASH_ADDRESS, KERNEL_FLASH_SIZE);
+
+    if ( (rc = elf_init(&info->elf.elf, info->kernel_img, KERNEL_FLASH_SIZE )) != 0 )
+        return rc;
+#ifdef VERBOSE
+    elf_set_verbose(&info->elf.elf);
+#endif
+    elf_parse_binary(&info->elf.elf);
+    if ( (rc = elf_xen_parse(&info->elf.elf, &info->elf.parms)) != 0 )
+        return rc;
+
+    /*
+     * FIXME: can the ELF header be used to find the physical address
+     * to load the image to?  Instead of making virt == phys by
+     * relocating the guest's RAM.
+     */
+    info->ram_start = 0xc0000000;
+    info->ram_end   = 0xc8000000;
+
+    info->entry = info->elf.parms.virt_entry;
+    info->load = kernel_elf_load;
+
+    return 0;
+}
+
+int kernel_prepare(struct kernel_info *info)
+{
+    int rc;
+
+    rc = kernel_try_zimage_prepare(info);
+    if (rc < 0)
+        rc = kernel_try_elf_prepare(info);
+
+    return rc;
+}
+
+void kernel_load(struct kernel_info *info)
+{
+    info->load(info);
+}
diff -r 48294c0c475d -r da77e2bfcd14 xen/arch/arm/kernel.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/kernel.h	Thu Feb 09 15:32:50 2012 +0000
@@ -0,0 +1,37 @@
+/*
+ * Kernel image loading.
+ *
+ * Copyright (C) 2011 Citrix Systems, Inc.
+ */
+#ifndef __ARCH_ARM_KERNEL_H__
+#define __ARCH_ARM_KERNEL_H__
+
+#include <xen/libelf.h>
+
+struct kernel_info {
+    paddr_t entry;
+    paddr_t ram_start;
+    paddr_t ram_end;
+
+    void *kernel_img;
+    unsigned kernel_order;
+
+    union {
+        struct {
+            paddr_t load_addr;
+            paddr_t len;
+        } zimage;
+
+        struct {
+            struct elf_binary elf;
+            struct elf_dom_parms parms;
+        } elf;
+    };
+
+    void (*load)(struct kernel_info *info);
+};
+
+int kernel_prepare(struct kernel_info *info);
+void kernel_load(struct kernel_info *info);
+
+#endif /* #ifdef __ARCH_ARM_KERNEL_H__ */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvagB-0001OO-3z; Thu, 09 Feb 2012 20:33:19 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag9-0001NL-Hb
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:17 +0000
Received: from [85.158.139.83:8376] by server-9.bemta-5.messagelabs.com id
	70/34-23757-C8D243F4; Thu, 09 Feb 2012 20:33:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-182.messagelabs.com!1328819594!14441644!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20288 invoked from network); 9 Feb 2012 20:33:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag6-0007iF-CF
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag6-0004Nd-At
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:14 +0000
Message-Id: <E1Rvag6-0004Nd-At@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: support zImage format kernels
	for dom0
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1328801570 0
# Node ID da77e2bfcd14b75eb3c341b98b75dfed20ec0bdc
# Parent  48294c0c475d0b5c0f8476c5e6e71cb76c7d9fa8
arm: support zImage format kernels for dom0

Allow a zImage format kernel to be used for dom0.  zImages are (by
default) hardcoded with the RAM location so adjust the RAM in the
memory map to match the physical memory map (0x80000000).

Vmlinux ELF images are loaded using a hack to locate the RAM so the
IPA is the same as the kernel's VA so the elf loader does the right
thing.  If an ELF image is loaded the RAM will be located at
0xC0000000 (as before).

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 48294c0c475d -r da77e2bfcd14 xen/arch/arm/Makefile
--- a/xen/arch/arm/Makefile	Thu Feb 09 15:32:50 2012 +0000
+++ b/xen/arch/arm/Makefile	Thu Feb 09 15:32:50 2012 +0000
@@ -7,6 +7,7 @@
 obj-y += gic.o
 obj-y += io.o
 obj-y += irq.o
+obj-y += kernel.o
 obj-y += mm.o
 obj-y += p2m.o
 obj-y += guestcopy.o
diff -r 48294c0c475d -r da77e2bfcd14 xen/arch/arm/domain_build.c
--- a/xen/arch/arm/domain_build.c	Thu Feb 09 15:32:50 2012 +0000
+++ b/xen/arch/arm/domain_build.c	Thu Feb 09 15:32:50 2012 +0000
@@ -4,10 +4,10 @@
 #include <xen/mm.h>
 #include <xen/domain_page.h>
 #include <xen/sched.h>
-#include <xen/libelf.h>
 #include <asm/irq.h>
 
 #include "gic.h"
+#include "kernel.h"
 
 static unsigned int __initdata opt_dom0_max_vcpus;
 integer_param("dom0_max_vcpus", opt_dom0_max_vcpus);
@@ -28,25 +28,6 @@
 
 extern void guest_mode_entry(void);
 
-static void copy_from_flash(void *dst, paddr_t flash, unsigned long len)
-{
-    void *src = (void *)FIXMAP_ADDR(FIXMAP_MISC);
-    unsigned long offs;
-
-    printk("Copying %#lx bytes from flash %"PRIpaddr" to %p-%p: [",
-           len, flash, dst, dst+(1<<23));
-    for ( offs = 0; offs < len ; offs += PAGE_SIZE )
-    {
-        if ( ( offs % (1<<20) ) == 0 )
-            printk(".");
-        set_fixmap(FIXMAP_MISC, (flash+offs) >> PAGE_SHIFT, DEV_SHARED);
-        memcpy(dst+offs, src, PAGE_SIZE);
-    }
-    printk("]\n");
-
-    clear_fixmap(FIXMAP_MISC);
-}
-
 static void setup_linux_atag(paddr_t tags, paddr_t ram_s, paddr_t ram_e)
 {
     paddr_t ma = gvirt_to_maddr(tags);
@@ -84,21 +65,14 @@
     unmap_domain_page(map);
 }
 
-/* Store kernel in first 8M of flash */
-#define KERNEL_FLASH_ADDRESS 0x00000000UL
-#define KERNEL_FLASH_SIZE    0x00800000UL
-
 int construct_dom0(struct domain *d)
 {
-    int rc, kernel_order;
-    void *kernel_img;
+    struct kernel_info kinfo = {};
+    int rc;
 
     struct vcpu *v = d->vcpu[0];
     struct cpu_user_regs *regs = &v->arch.user_regs;
 
-    struct elf_binary elf;
-    struct elf_dom_parms parms;
-
     /* Sanity! */
     BUG_ON(d->domain_id != 0);
     BUG_ON(d->vcpu[0] == NULL);
@@ -106,31 +80,22 @@
 
     printk("*** LOADING DOMAIN 0 ***\n");
 
-    kernel_order = get_order_from_bytes(KERNEL_FLASH_SIZE);
-    kernel_img = alloc_xenheap_pages(kernel_order, 0);
-    if ( kernel_img == NULL )
-        panic("Cannot allocate temporary buffer for kernel.\n");
+    /* 128M at 2G physical */
+    /* TODO size and location from DT. */
+    kinfo.ram_start = 0x80000000;
+    kinfo.ram_end   = 0x88000000;
 
-    copy_from_flash(kernel_img, KERNEL_FLASH_ADDRESS, KERNEL_FLASH_SIZE);
+    rc = kernel_prepare(&kinfo);
+    if (rc < 0)
+        return rc;
 
     d->max_pages = ~0U;
 
-    if ( (rc = elf_init(&elf, kernel_img, KERNEL_FLASH_SIZE )) != 0 )
-        return rc;  memset(regs, 0, sizeof(*regs));
-#ifdef VERBOSE
-    elf_set_verbose(&elf);
-#endif
-    elf_parse_binary(&elf);
-    if ( (rc = elf_xen_parse(&elf, &parms)) != 0 )
-        return rc;
-
     if ( (rc = p2m_alloc_table(d)) != 0 )
         return rc;
 
-    /* 128M at 3G physical */
-    /* TODO size and location according to platform info */
-    printk("Populate P2M %#llx->%#llx\n", 0xc0000000ULL, 0xc8000000ULL);
-    p2m_populate_ram(d, 0xc0000000ULL, 0xc8000000ULL);
+    printk("Populate P2M %#llx->%#llx\n", kinfo.ram_start, kinfo.ram_end);
+    p2m_populate_ram(d, kinfo.ram_start, kinfo.ram_end);
 
     printk("Map CS2 MMIO regions 1:1 in the P2M %#llx->%#llx\n", 0x18000000ULL, 0x1BFFFFFFULL);
     map_mmio_regions(d, 0x18000000, 0x1BFFFFFF, 0x18000000);
@@ -161,20 +126,15 @@
     /* The following load uses domain's p2m */
     p2m_load_VTTBR(d);
 
-    printk("Loading ELF image into guest memory\n");
-    elf.dest = (void*)(unsigned long)parms.virt_kstart;
-    elf_load_binary(&elf);
+    kernel_load(&kinfo);
 
-    printk("Free temporary kernel buffer\n");
-    free_xenheap_pages(kernel_img, kernel_order);
-
-    setup_linux_atag(0xc0000100ULL, 0xc0000000ULL, 0xc8000000ULL);
+    setup_linux_atag(kinfo.ram_start + 0x100, kinfo.ram_start, kinfo.ram_end);
 
     clear_bit(_VPF_down, &v->pause_flags);
 
     memset(regs, 0, sizeof(*regs));
 
-    regs->pc = (uint32_t)parms.virt_entry;
+    regs->pc = (uint32_t)kinfo.entry;
 
     regs->cpsr = PSR_ABT_MASK|PSR_FIQ_MASK|PSR_IRQ_MASK|PSR_MODE_SVC;
 
@@ -191,7 +151,7 @@
 
     regs->r0 = 0; /* SBZ */
     regs->r1 = 2272; /* Machine NR: Versatile Express */
-    regs->r2 = 0xc0000100; /* ATAGS */
+    regs->r2 = kinfo.ram_start + 0x100; /* ATAGS */
 
     WRITE_CP32(SCTLR_BASE, SCTLR);
 
diff -r 48294c0c475d -r da77e2bfcd14 xen/arch/arm/kernel.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/kernel.c	Thu Feb 09 15:32:50 2012 +0000
@@ -0,0 +1,167 @@
+/*
+ * Kernel image loading.
+ *
+ * Copyright (C) 2011 Citrix Systems, Inc.
+ */
+#include <xen/config.h>
+#include <xen/errno.h>
+#include <xen/init.h>
+#include <xen/lib.h>
+#include <xen/mm.h>
+#include <xen/domain_page.h>
+#include <xen/sched.h>
+
+#include "kernel.h"
+
+/* Store kernel in first 8M of flash */
+#define KERNEL_FLASH_ADDRESS 0x00000000UL
+#define KERNEL_FLASH_SIZE    0x00800000UL
+
+#define ZIMAGE_MAGIC_OFFSET 0x24
+#define ZIMAGE_START_OFFSET 0x28
+#define ZIMAGE_END_OFFSET   0x2c
+
+#define ZIMAGE_MAGIC 0x016f2818
+
+static void kernel_zimage_load(struct kernel_info *info)
+{
+    paddr_t load_addr = info->zimage.load_addr;
+    paddr_t len = info->zimage.len;
+    paddr_t flash = KERNEL_FLASH_ADDRESS;
+    void *src = (void *)FIXMAP_ADDR(FIXMAP_MISC);
+    unsigned long offs;
+
+    printk("Loading %"PRIpaddr" byte zImage from flash %"PRIpaddr" to %"PRIpaddr"-%"PRIpaddr": [",
+           len, flash, load_addr, load_addr + len);
+    for ( offs = 0; offs < len; offs += PAGE_SIZE )
+    {
+        paddr_t ma = gvirt_to_maddr(load_addr + offs);
+        void *dst = map_domain_page(ma>>PAGE_SHIFT);
+
+        if ( ( offs % (1<<20) ) == 0 )
+            printk(".");
+
+        set_fixmap(FIXMAP_MISC, (flash+offs) >> PAGE_SHIFT, DEV_SHARED);
+        memcpy(dst, src, PAGE_SIZE);
+        clear_fixmap(FIXMAP_MISC);
+
+        unmap_domain_page(dst);
+    }
+    printk("]\n");
+}
+
+/**
+ * Check the image is a zImage and return the load address and length
+ * (FIXME: including any appended DTB).
+ */
+static int kernel_try_zimage_prepare(struct kernel_info *info)
+{
+    uint32_t *zimage = (void *)FIXMAP_ADDR(FIXMAP_MISC);
+    uint32_t start, end;
+
+    set_fixmap(FIXMAP_MISC, KERNEL_FLASH_ADDRESS >> PAGE_SHIFT, DEV_SHARED);
+
+    if (zimage[ZIMAGE_MAGIC_OFFSET/4] != ZIMAGE_MAGIC)
+        return -EINVAL;
+
+    start = zimage[ZIMAGE_START_OFFSET/4];
+    end = zimage[ZIMAGE_END_OFFSET/4];
+
+    clear_fixmap(FIXMAP_MISC);
+
+    /* FIXME: get RAM location from appended DTB (if there is one)? */
+
+    /*
+     * If start is zero, the zImage is position independent -- load it
+     * at 32k from start of RAM.
+     */
+    if (start == 0)
+        info->zimage.load_addr = info->ram_start + 0x8000;
+    else
+        info->zimage.load_addr = start;
+    info->zimage.len = end - start;
+
+    info->entry = info->zimage.load_addr;
+    info->load = kernel_zimage_load;
+
+    return 0;
+}
+
+static void kernel_elf_load(struct kernel_info *info)
+{
+    printk("Loading ELF image into guest memory\n");
+    info->elf.elf.dest = (void*)(unsigned long)info->elf.parms.virt_kstart;
+    elf_load_binary(&info->elf.elf);
+
+    printk("Free temporary kernel buffer\n");
+    free_xenheap_pages(info->kernel_img, info->kernel_order);
+}
+
+static void copy_from_flash(void *dst, paddr_t flash, unsigned long len)
+{
+    void *src = (void *)FIXMAP_ADDR(FIXMAP_MISC);
+    unsigned long offs;
+
+    printk("Copying %#lx bytes from flash %"PRIpaddr" to %p-%p: [",
+           len, flash, dst, dst+(1<<23));
+    for ( offs = 0; offs < len ; offs += PAGE_SIZE )
+    {
+        if ( ( offs % (1<<20) ) == 0 )
+            printk(".");
+        set_fixmap(FIXMAP_MISC, (flash+offs) >> PAGE_SHIFT, DEV_SHARED);
+        memcpy(dst+offs, src, PAGE_SIZE);
+    }
+    printk("]\n");
+
+    clear_fixmap(FIXMAP_MISC);
+}
+
+static int kernel_try_elf_prepare(struct kernel_info *info)
+{
+    int rc;
+
+    info->kernel_order = get_order_from_bytes(KERNEL_FLASH_SIZE);
+    info->kernel_img = alloc_xenheap_pages(info->kernel_order, 0);
+    if ( info->kernel_img == NULL )
+        panic("Cannot allocate temporary buffer for kernel.\n");
+
+    copy_from_flash(info->kernel_img, KERNEL_FLASH_ADDRESS, KERNEL_FLASH_SIZE);
+
+    if ( (rc = elf_init(&info->elf.elf, info->kernel_img, KERNEL_FLASH_SIZE )) != 0 )
+        return rc;
+#ifdef VERBOSE
+    elf_set_verbose(&info->elf.elf);
+#endif
+    elf_parse_binary(&info->elf.elf);
+    if ( (rc = elf_xen_parse(&info->elf.elf, &info->elf.parms)) != 0 )
+        return rc;
+
+    /*
+     * FIXME: can the ELF header be used to find the physical address
+     * to load the image to?  Instead of making virt == phys by
+     * relocating the guest's RAM.
+     */
+    info->ram_start = 0xc0000000;
+    info->ram_end   = 0xc8000000;
+
+    info->entry = info->elf.parms.virt_entry;
+    info->load = kernel_elf_load;
+
+    return 0;
+}
+
+int kernel_prepare(struct kernel_info *info)
+{
+    int rc;
+
+    rc = kernel_try_zimage_prepare(info);
+    if (rc < 0)
+        rc = kernel_try_elf_prepare(info);
+
+    return rc;
+}
+
+void kernel_load(struct kernel_info *info)
+{
+    info->load(info);
+}
diff -r 48294c0c475d -r da77e2bfcd14 xen/arch/arm/kernel.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/kernel.h	Thu Feb 09 15:32:50 2012 +0000
@@ -0,0 +1,37 @@
+/*
+ * Kernel image loading.
+ *
+ * Copyright (C) 2011 Citrix Systems, Inc.
+ */
+#ifndef __ARCH_ARM_KERNEL_H__
+#define __ARCH_ARM_KERNEL_H__
+
+#include <xen/libelf.h>
+
+struct kernel_info {
+    paddr_t entry;
+    paddr_t ram_start;
+    paddr_t ram_end;
+
+    void *kernel_img;
+    unsigned kernel_order;
+
+    union {
+        struct {
+            paddr_t load_addr;
+            paddr_t len;
+        } zimage;
+
+        struct {
+            struct elf_binary elf;
+            struct elf_dom_parms parms;
+        } elf;
+    };
+
+    void (*load)(struct kernel_info *info);
+};
+
+int kernel_prepare(struct kernel_info *info);
+void kernel_load(struct kernel_info *info);
+
+#endif /* #ifdef __ARCH_ARM_KERNEL_H__ */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvagD-0001Qq-FU; Thu, 09 Feb 2012 20:33:21 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvagC-0001Mw-Aw
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-21.messagelabs.com!1328819593!12209593!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28726 invoked from network); 9 Feb 2012 20:33:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag4-0007i6-Po
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag4-0004MT-OD
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:12 +0000
Message-Id: <E1Rvag4-0004MT-OD@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: define domain_pirq_to_irq
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328801570 0
# Node ID 2555dd616551cf92daf53ccdcfb2d8ee3ebaab53
# Parent  62404735e437320bfdfdc302eabe752ba32a6171
arm: define domain_pirq_to_irq

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 62404735e437 -r 2555dd616551 xen/include/asm-arm/irq.h
--- a/xen/include/asm-arm/irq.h	Thu Feb 09 06:28:53 2012 -0800
+++ b/xen/include/asm-arm/irq.h	Thu Feb 09 15:32:50 2012 +0000
@@ -19,6 +19,8 @@
 
 void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq);
 
+#define domain_pirq_to_irq(d, pirq) (pirq)
+
 #endif /* _ASM_HW_IRQ_H */
 /*
  * Local variables:

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvagD-0001Qq-FU; Thu, 09 Feb 2012 20:33:21 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvagC-0001Mw-Aw
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-21.messagelabs.com!1328819593!12209593!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28726 invoked from network); 9 Feb 2012 20:33:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag4-0007i6-Po
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag4-0004MT-OD
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:12 +0000
Message-Id: <E1Rvag4-0004MT-OD@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: define domain_pirq_to_irq
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328801570 0
# Node ID 2555dd616551cf92daf53ccdcfb2d8ee3ebaab53
# Parent  62404735e437320bfdfdc302eabe752ba32a6171
arm: define domain_pirq_to_irq

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 62404735e437 -r 2555dd616551 xen/include/asm-arm/irq.h
--- a/xen/include/asm-arm/irq.h	Thu Feb 09 06:28:53 2012 -0800
+++ b/xen/include/asm-arm/irq.h	Thu Feb 09 15:32:50 2012 +0000
@@ -19,6 +19,8 @@
 
 void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq);
 
+#define domain_pirq_to_irq(d, pirq) (pirq)
+
 #endif /* _ASM_HW_IRQ_H */
 /*
  * Local variables:

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvagD-0001Qg-CG; Thu, 09 Feb 2012 20:33:21 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvagB-0001Mb-N3
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-174.messagelabs.com!1328819592!12737424!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30271 invoked from network); 9 Feb 2012 20:33:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag4-0007i3-9B
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag4-0004M3-7x
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:12 +0000
Message-Id: <E1Rvag4-0004M3-7x@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Tools: Make xen-access test compile
	in 32 bits mode
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328797733 28800
# Node ID 62404735e437320bfdfdc302eabe752ba32a6171
# Parent  85c14cbc8f7823f4a41933c526b808176fe32891
Tools: Make xen-access test compile in 32 bits mode

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: Keir Fraser <keir@xen.org>
---


diff -r 85c14cbc8f78 -r 62404735e437 tools/tests/Makefile
--- a/tools/tests/Makefile	Thu Feb 09 06:20:49 2012 -0800
+++ b/tools/tests/Makefile	Thu Feb 09 06:28:53 2012 -0800
@@ -11,9 +11,7 @@
 SUBDIRS-y += regression
 endif
 SUBDIRS-y += x86_emulator
-ifneq ($(XEN_TARGET_ARCH),x86_32)
 SUBDIRS-y += xen-access
-endif
 
 .PHONY: all clean install distclean
 all clean distclean: %: subdirs-%
diff -r 85c14cbc8f78 -r 62404735e437 tools/tests/xen-access/xen-access.c
--- a/tools/tests/xen-access/xen-access.c	Thu Feb 09 06:20:49 2012 -0800
+++ b/tools/tests/xen-access/xen-access.c	Thu Feb 09 06:28:53 2012 -0800
@@ -600,14 +600,15 @@
             case MEM_EVENT_REASON_VIOLATION:
                 rc = xc_hvm_get_mem_access(xch, domain_id, req.gfn, &access);
 
-                printf("PAGE ACCESS: %c%c%c for GFN %lx (offset %06lx) gla %016lx (vcpu %d)\n",
-                        req.access_r ? 'r' : '-',
-                        req.access_w ? 'w' : '-',
-                        req.access_x ? 'x' : '-',
-                        req.gfn,
-                        req.offset,
-                        req.gla,
-                        req.vcpu_id);
+                printf("PAGE ACCESS: %c%c%c for GFN %"PRIx64" (offset %06"
+                       PRIx64") gla %016"PRIx64" (vcpu %d)\n",
+                       req.access_r ? 'r' : '-',
+                       req.access_w ? 'w' : '-',
+                       req.access_x ? 'x' : '-',
+                       req.gfn,
+                       req.offset,
+                       req.gla,
+                       req.vcpu_id);
 
                 if ( default_access != after_first_access )
                     rc = xc_hvm_set_mem_access(xch, domain_id, after_first_access, req.gfn, 1);
@@ -617,8 +618,10 @@
                 rsp.p2mt = req.p2mt;
                 break;
             case MEM_EVENT_REASON_INT3:
-                printf("INT3: rip=%016lx, gfn=%lx (vcpu %d)\n", req.gla, req.gfn,
-                        req.vcpu_id);
+                printf("INT3: rip=%016"PRIx64", gfn=%"PRIx64" (vcpu %d)\n", 
+                       req.gla, 
+                       req.gfn,
+                       req.vcpu_id);
 
                 /* Reinject */
                 rc = xc_hvm_inject_trap(xch, domain_id, req.vcpu_id, 3, -1, 0);

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvagD-0001Qg-CG; Thu, 09 Feb 2012 20:33:21 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvagB-0001Mb-N3
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-174.messagelabs.com!1328819592!12737424!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30271 invoked from network); 9 Feb 2012 20:33:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag4-0007i3-9B
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag4-0004M3-7x
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:12 +0000
Message-Id: <E1Rvag4-0004M3-7x@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Tools: Make xen-access test compile
	in 32 bits mode
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328797733 28800
# Node ID 62404735e437320bfdfdc302eabe752ba32a6171
# Parent  85c14cbc8f7823f4a41933c526b808176fe32891
Tools: Make xen-access test compile in 32 bits mode

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: Keir Fraser <keir@xen.org>
---


diff -r 85c14cbc8f78 -r 62404735e437 tools/tests/Makefile
--- a/tools/tests/Makefile	Thu Feb 09 06:20:49 2012 -0800
+++ b/tools/tests/Makefile	Thu Feb 09 06:28:53 2012 -0800
@@ -11,9 +11,7 @@
 SUBDIRS-y += regression
 endif
 SUBDIRS-y += x86_emulator
-ifneq ($(XEN_TARGET_ARCH),x86_32)
 SUBDIRS-y += xen-access
-endif
 
 .PHONY: all clean install distclean
 all clean distclean: %: subdirs-%
diff -r 85c14cbc8f78 -r 62404735e437 tools/tests/xen-access/xen-access.c
--- a/tools/tests/xen-access/xen-access.c	Thu Feb 09 06:20:49 2012 -0800
+++ b/tools/tests/xen-access/xen-access.c	Thu Feb 09 06:28:53 2012 -0800
@@ -600,14 +600,15 @@
             case MEM_EVENT_REASON_VIOLATION:
                 rc = xc_hvm_get_mem_access(xch, domain_id, req.gfn, &access);
 
-                printf("PAGE ACCESS: %c%c%c for GFN %lx (offset %06lx) gla %016lx (vcpu %d)\n",
-                        req.access_r ? 'r' : '-',
-                        req.access_w ? 'w' : '-',
-                        req.access_x ? 'x' : '-',
-                        req.gfn,
-                        req.offset,
-                        req.gla,
-                        req.vcpu_id);
+                printf("PAGE ACCESS: %c%c%c for GFN %"PRIx64" (offset %06"
+                       PRIx64") gla %016"PRIx64" (vcpu %d)\n",
+                       req.access_r ? 'r' : '-',
+                       req.access_w ? 'w' : '-',
+                       req.access_x ? 'x' : '-',
+                       req.gfn,
+                       req.offset,
+                       req.gla,
+                       req.vcpu_id);
 
                 if ( default_access != after_first_access )
                     rc = xc_hvm_set_mem_access(xch, domain_id, after_first_access, req.gfn, 1);
@@ -617,8 +618,10 @@
                 rsp.p2mt = req.p2mt;
                 break;
             case MEM_EVENT_REASON_INT3:
-                printf("INT3: rip=%016lx, gfn=%lx (vcpu %d)\n", req.gla, req.gfn,
-                        req.vcpu_id);
+                printf("INT3: rip=%016"PRIx64", gfn=%"PRIx64" (vcpu %d)\n", 
+                       req.gla, 
+                       req.gfn,
+                       req.vcpu_id);
 
                 /* Reinject */
                 rc = xc_hvm_inject_trap(xch, domain_id, req.vcpu_id, 3, -1, 0);

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvagC-0001PK-7A; Thu, 09 Feb 2012 20:33:20 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvagA-0001MV-ND
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1328819591!14171260!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20642 invoked from network); 9 Feb 2012 20:33:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag3-0007hx-6r
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag3-0004LH-5W
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:11 +0000
Message-Id: <E1Rvag3-0004LH-5W@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] CONFIG: remove CONFIG_SMP #ifdefs
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328796860 28800
# Node ID 94dc7b5aa86e547004f0f97439230523d64ee00f
# Parent  77a906fc5082508e2a9605f957aeca2e24b6f488
CONFIG: remove CONFIG_SMP #ifdefs

CONFIG_SMP is always enabled and !CONFIG_SMP is not supported.  So
simplify the code a little by removing all #ifdefs.

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


diff -r 77a906fc5082 -r 94dc7b5aa86e xen/arch/x86/apic.c
--- a/xen/arch/x86/apic.c	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/arch/x86/apic.c	Thu Feb 09 06:14:20 2012 -0800
@@ -145,9 +145,8 @@
 
 void __init apic_intr_init(void)
 {
-#ifdef CONFIG_SMP
     smp_intr_init();
-#endif
+
     /* self generated IPI for local APIC timer */
     set_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt);
 
diff -r 77a906fc5082 -r 94dc7b5aa86e xen/arch/x86/cpu/amd.c
--- a/xen/arch/x86/cpu/amd.c	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/arch/x86/cpu/amd.c	Thu Feb 09 06:14:20 2012 -0800
@@ -370,7 +370,6 @@
 {
 	u32 l, h;
 
-#ifdef CONFIG_SMP
 	unsigned long long value;
 
 	/* Disable TLB flush filter by setting HWCR.FFDIS on K8
@@ -384,7 +383,6 @@
 		value |= 1 << 6;
 		wrmsrl(MSR_K7_HWCR, value);
 	}
-#endif
 
 	/*
 	 *	FIXME: We should handle the K5 here. Set up the write
diff -r 77a906fc5082 -r 94dc7b5aa86e xen/arch/x86/cpu/mtrr/cyrix.c
--- a/xen/arch/x86/cpu/mtrr/cyrix.c	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/arch/x86/cpu/mtrr/cyrix.c	Thu Feb 09 06:14:20 2012 -0800
@@ -279,9 +279,7 @@
 	struct set_mtrr_context ctxt;
 	unsigned char ccr[7];
 	int ccrc[7] = { 0, 0, 0, 0, 0, 0, 0 };
-#ifdef CONFIG_SMP
 	int i;
-#endif
 
 	/* flush cache and enable MAPEN */
 	set_mtrr_prepare_save(&ctxt);
@@ -334,14 +332,13 @@
 		ccrc[5] = 1;
 		setCx86(CX86_CCR5, ccr[5]);
 	}
-#ifdef CONFIG_SMP
+
 	for (i = 0; i < 7; i++)
 		ccr_state[i] = ccr[i];
 	for (i = 0; i < 8; i++)
 		cyrix_get_arr(i,
 			      &arr_state[i].base, &arr_state[i].size,
 			      &arr_state[i].type);
-#endif
 
 	set_mtrr_done(&ctxt);	/* flush cache and disable MAPEN */
 
diff -r 77a906fc5082 -r 94dc7b5aa86e xen/arch/x86/cpu/mtrr/main.c
--- a/xen/arch/x86/cpu/mtrr/main.c	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/arch/x86/cpu/mtrr/main.c	Thu Feb 09 06:14:20 2012 -0800
@@ -142,8 +142,6 @@
  */
 int hold_mtrr_updates_on_aps;
 
-#ifdef CONFIG_SMP
-
 static void ipi_handler(void *info)
 /*  [SUMMARY] Synchronisation handler. Executed by "other" CPUs.
     [RETURNS] Nothing.
@@ -175,8 +173,6 @@
 	local_irq_restore(flags);
 }
 
-#endif
-
 static inline int types_compatible(mtrr_type type1, mtrr_type type2) {
 	return type1 == MTRR_TYPE_UNCACHABLE ||
 	       type2 == MTRR_TYPE_UNCACHABLE ||
diff -r 77a906fc5082 -r 94dc7b5aa86e xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/arch/x86/io_apic.c	Thu Feb 09 06:14:20 2012 -0800
@@ -513,7 +513,6 @@
     }
 }
 
-#ifdef CONFIG_SMP
 static void
 set_ioapic_affinity_irq(struct irq_desc *desc, const cpumask_t *mask)
 {
@@ -550,7 +549,6 @@
     spin_unlock_irqrestore(&ioapic_lock, flags);
 
 }
-#endif /* CONFIG_SMP */
 
 /*
  * Find the IRQ entry number of a certain pin.
@@ -630,7 +628,6 @@
  * we need to reprogram the ioredtbls to cater for the cpus which have come online
  * so mask in all cases should simply be TARGET_CPUS
  */
-#ifdef CONFIG_SMP
 void /*__init*/ setup_ioapic_dest(void)
 {
     int pin, ioapic, irq, irq_entry;
@@ -653,7 +650,6 @@
 
     }
 }
-#endif
 
 /*
  * EISA Edge/Level control register, ELCR
diff -r 77a906fc5082 -r 94dc7b5aa86e xen/arch/x86/oprofile/nmi_int.c
--- a/xen/arch/x86/oprofile/nmi_int.c	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/arch/x86/oprofile/nmi_int.c	Thu Feb 09 06:14:20 2012 -0800
@@ -304,11 +304,6 @@
 		return 0;
 	}
 
-#ifndef CONFIG_SMP
-	*cpu_type = "i386/p4", XENOPROF_CPU_TYPE_SIZE);
-	model = &op_p4_spec;
-	return 1;
-#else
 	switch (current_cpu_data.x86_num_siblings) {
 		case 1:
 			*cpu_type = "i386/p4";
@@ -320,7 +315,7 @@
 			model = &op_p4_ht2_spec;
 			return 1;
 	}
-#endif
+
 	printk("Xenoprof ERROR: P4 HyperThreading detected with > 2 threads\n");
 
 	return 0;
diff -r 77a906fc5082 -r 94dc7b5aa86e xen/arch/x86/oprofile/op_model_p4.c
--- a/xen/arch/x86/oprofile/op_model_p4.c	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/arch/x86/oprofile/op_model_p4.c	Thu Feb 09 06:14:20 2012 -0800
@@ -40,19 +40,13 @@
    kernel boot-time. */
 static inline void setup_num_counters(void)
 {
-#ifdef CONFIG_SMP
 	if (boot_cpu_data.x86_num_siblings == 2) 	/* XXX */
 		num_counters = NUM_COUNTERS_HT2;
-#endif
 }
 
 static int inline addr_increment(void)
 {
-#ifdef CONFIG_SMP
 	return boot_cpu_data.x86_num_siblings == 2 ? 2 : 1;
-#else
-	return 1;
-#endif
 }
 
 
@@ -383,11 +377,8 @@
    or "odd" part of all the divided resources. */
 static unsigned int get_stagger(void)
 {
-#ifdef CONFIG_SMP
 	int cpu = smp_processor_id();
 	return (cpu != cpumask_first(per_cpu(cpu_sibling_mask, cpu)));
-#endif	
-	return 0;
 }
 
 
@@ -709,7 +700,6 @@
 }
 
 
-#ifdef CONFIG_SMP
 struct op_x86_model_spec const op_p4_ht2_spec = {
 	.num_counters = NUM_COUNTERS_HT2,
 	.num_controls = NUM_CONTROLS_HT2,
@@ -719,7 +709,7 @@
 	.start = &p4_start,
 	.stop = &p4_stop
 };
-#endif
+
 
 struct op_x86_model_spec const op_p4_spec = {
 	.num_counters = NUM_COUNTERS_NON_HT,
diff -r 77a906fc5082 -r 94dc7b5aa86e xen/common/rcupdate.c
--- a/xen/common/rcupdate.c	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/common/rcupdate.c	Thu Feb 09 06:14:20 2012 -0800
@@ -83,9 +83,7 @@
     long            blimit;           /* Upper limit on a processed batch */
     int cpu;
     struct rcu_head barrier;
-#ifdef CONFIG_SMP
     long            last_rs_qlen;     /* qlen during the last resched */
-#endif
 };
 
 static DEFINE_PER_CPU(struct rcu_data, rcu_data);
diff -r 77a906fc5082 -r 94dc7b5aa86e xen/include/asm-x86/config.h
--- a/xen/include/asm-x86/config.h	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/include/asm-x86/config.h	Thu Feb 09 06:14:20 2012 -0800
@@ -21,7 +21,6 @@
 #define CONFIG_X86 1
 #define CONFIG_X86_HT 1
 #define CONFIG_PAGING_ASSISTANCE 1
-#define CONFIG_SMP 1
 #define CONFIG_X86_LOCAL_APIC 1
 #define CONFIG_X86_GOOD_APIC 1
 #define CONFIG_X86_IO_APIC 1
diff -r 77a906fc5082 -r 94dc7b5aa86e xen/include/asm-x86/processor.h
--- a/xen/include/asm-x86/processor.h	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/include/asm-x86/processor.h	Thu Feb 09 06:14:20 2012 -0800
@@ -189,13 +189,8 @@
 
 extern struct cpuinfo_x86 boot_cpu_data;
 
-#ifdef CONFIG_SMP
 extern struct cpuinfo_x86 cpu_data[];
 #define current_cpu_data cpu_data[smp_processor_id()]
-#else
-#define cpu_data (&boot_cpu_data)
-#define current_cpu_data boot_cpu_data
-#endif
 
 extern void set_cpuid_faulting(bool_t enable);
 
diff -r 77a906fc5082 -r 94dc7b5aa86e xen/include/asm-x86/smp.h
--- a/xen/include/asm-x86/smp.h	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/include/asm-x86/smp.h	Thu Feb 09 06:14:20 2012 -0800
@@ -17,7 +17,6 @@
 #endif
 
 #define BAD_APICID -1U
-#ifdef CONFIG_SMP
 #ifndef __ASSEMBLY__
 
 /*
@@ -65,11 +64,4 @@
 
 #endif /* !__ASSEMBLY__ */
 
-#else /* CONFIG_SMP */
-
-#define cpu_physical_id(cpu)		boot_cpu_physical_apicid
-
-#define NO_PROC_ID		0xFF		/* No processor magic marker */
-
 #endif
-#endif
diff -r 77a906fc5082 -r 94dc7b5aa86e xen/include/asm-x86/system.h
--- a/xen/include/asm-x86/system.h	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/include/asm-x86/system.h	Thu Feb 09 06:14:20 2012 -0800
@@ -154,15 +154,9 @@
 #define rmb()           barrier()
 #define wmb()           barrier()
 
-#ifdef CONFIG_SMP
 #define smp_mb()        mb()
 #define smp_rmb()       rmb()
 #define smp_wmb()       wmb()
-#else
-#define smp_mb()        barrier()
-#define smp_rmb()       barrier()
-#define smp_wmb()       barrier()
-#endif
 
 #define set_mb(var, value) do { xchg(&var, value); } while (0)
 #define set_wmb(var, value) do { var = value; wmb(); } while (0)

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvagC-0001PK-7A; Thu, 09 Feb 2012 20:33:20 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvagA-0001MV-ND
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1328819591!14171260!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20642 invoked from network); 9 Feb 2012 20:33:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag3-0007hx-6r
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag3-0004LH-5W
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:11 +0000
Message-Id: <E1Rvag3-0004LH-5W@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] CONFIG: remove CONFIG_SMP #ifdefs
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328796860 28800
# Node ID 94dc7b5aa86e547004f0f97439230523d64ee00f
# Parent  77a906fc5082508e2a9605f957aeca2e24b6f488
CONFIG: remove CONFIG_SMP #ifdefs

CONFIG_SMP is always enabled and !CONFIG_SMP is not supported.  So
simplify the code a little by removing all #ifdefs.

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


diff -r 77a906fc5082 -r 94dc7b5aa86e xen/arch/x86/apic.c
--- a/xen/arch/x86/apic.c	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/arch/x86/apic.c	Thu Feb 09 06:14:20 2012 -0800
@@ -145,9 +145,8 @@
 
 void __init apic_intr_init(void)
 {
-#ifdef CONFIG_SMP
     smp_intr_init();
-#endif
+
     /* self generated IPI for local APIC timer */
     set_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt);
 
diff -r 77a906fc5082 -r 94dc7b5aa86e xen/arch/x86/cpu/amd.c
--- a/xen/arch/x86/cpu/amd.c	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/arch/x86/cpu/amd.c	Thu Feb 09 06:14:20 2012 -0800
@@ -370,7 +370,6 @@
 {
 	u32 l, h;
 
-#ifdef CONFIG_SMP
 	unsigned long long value;
 
 	/* Disable TLB flush filter by setting HWCR.FFDIS on K8
@@ -384,7 +383,6 @@
 		value |= 1 << 6;
 		wrmsrl(MSR_K7_HWCR, value);
 	}
-#endif
 
 	/*
 	 *	FIXME: We should handle the K5 here. Set up the write
diff -r 77a906fc5082 -r 94dc7b5aa86e xen/arch/x86/cpu/mtrr/cyrix.c
--- a/xen/arch/x86/cpu/mtrr/cyrix.c	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/arch/x86/cpu/mtrr/cyrix.c	Thu Feb 09 06:14:20 2012 -0800
@@ -279,9 +279,7 @@
 	struct set_mtrr_context ctxt;
 	unsigned char ccr[7];
 	int ccrc[7] = { 0, 0, 0, 0, 0, 0, 0 };
-#ifdef CONFIG_SMP
 	int i;
-#endif
 
 	/* flush cache and enable MAPEN */
 	set_mtrr_prepare_save(&ctxt);
@@ -334,14 +332,13 @@
 		ccrc[5] = 1;
 		setCx86(CX86_CCR5, ccr[5]);
 	}
-#ifdef CONFIG_SMP
+
 	for (i = 0; i < 7; i++)
 		ccr_state[i] = ccr[i];
 	for (i = 0; i < 8; i++)
 		cyrix_get_arr(i,
 			      &arr_state[i].base, &arr_state[i].size,
 			      &arr_state[i].type);
-#endif
 
 	set_mtrr_done(&ctxt);	/* flush cache and disable MAPEN */
 
diff -r 77a906fc5082 -r 94dc7b5aa86e xen/arch/x86/cpu/mtrr/main.c
--- a/xen/arch/x86/cpu/mtrr/main.c	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/arch/x86/cpu/mtrr/main.c	Thu Feb 09 06:14:20 2012 -0800
@@ -142,8 +142,6 @@
  */
 int hold_mtrr_updates_on_aps;
 
-#ifdef CONFIG_SMP
-
 static void ipi_handler(void *info)
 /*  [SUMMARY] Synchronisation handler. Executed by "other" CPUs.
     [RETURNS] Nothing.
@@ -175,8 +173,6 @@
 	local_irq_restore(flags);
 }
 
-#endif
-
 static inline int types_compatible(mtrr_type type1, mtrr_type type2) {
 	return type1 == MTRR_TYPE_UNCACHABLE ||
 	       type2 == MTRR_TYPE_UNCACHABLE ||
diff -r 77a906fc5082 -r 94dc7b5aa86e xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/arch/x86/io_apic.c	Thu Feb 09 06:14:20 2012 -0800
@@ -513,7 +513,6 @@
     }
 }
 
-#ifdef CONFIG_SMP
 static void
 set_ioapic_affinity_irq(struct irq_desc *desc, const cpumask_t *mask)
 {
@@ -550,7 +549,6 @@
     spin_unlock_irqrestore(&ioapic_lock, flags);
 
 }
-#endif /* CONFIG_SMP */
 
 /*
  * Find the IRQ entry number of a certain pin.
@@ -630,7 +628,6 @@
  * we need to reprogram the ioredtbls to cater for the cpus which have come online
  * so mask in all cases should simply be TARGET_CPUS
  */
-#ifdef CONFIG_SMP
 void /*__init*/ setup_ioapic_dest(void)
 {
     int pin, ioapic, irq, irq_entry;
@@ -653,7 +650,6 @@
 
     }
 }
-#endif
 
 /*
  * EISA Edge/Level control register, ELCR
diff -r 77a906fc5082 -r 94dc7b5aa86e xen/arch/x86/oprofile/nmi_int.c
--- a/xen/arch/x86/oprofile/nmi_int.c	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/arch/x86/oprofile/nmi_int.c	Thu Feb 09 06:14:20 2012 -0800
@@ -304,11 +304,6 @@
 		return 0;
 	}
 
-#ifndef CONFIG_SMP
-	*cpu_type = "i386/p4", XENOPROF_CPU_TYPE_SIZE);
-	model = &op_p4_spec;
-	return 1;
-#else
 	switch (current_cpu_data.x86_num_siblings) {
 		case 1:
 			*cpu_type = "i386/p4";
@@ -320,7 +315,7 @@
 			model = &op_p4_ht2_spec;
 			return 1;
 	}
-#endif
+
 	printk("Xenoprof ERROR: P4 HyperThreading detected with > 2 threads\n");
 
 	return 0;
diff -r 77a906fc5082 -r 94dc7b5aa86e xen/arch/x86/oprofile/op_model_p4.c
--- a/xen/arch/x86/oprofile/op_model_p4.c	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/arch/x86/oprofile/op_model_p4.c	Thu Feb 09 06:14:20 2012 -0800
@@ -40,19 +40,13 @@
    kernel boot-time. */
 static inline void setup_num_counters(void)
 {
-#ifdef CONFIG_SMP
 	if (boot_cpu_data.x86_num_siblings == 2) 	/* XXX */
 		num_counters = NUM_COUNTERS_HT2;
-#endif
 }
 
 static int inline addr_increment(void)
 {
-#ifdef CONFIG_SMP
 	return boot_cpu_data.x86_num_siblings == 2 ? 2 : 1;
-#else
-	return 1;
-#endif
 }
 
 
@@ -383,11 +377,8 @@
    or "odd" part of all the divided resources. */
 static unsigned int get_stagger(void)
 {
-#ifdef CONFIG_SMP
 	int cpu = smp_processor_id();
 	return (cpu != cpumask_first(per_cpu(cpu_sibling_mask, cpu)));
-#endif	
-	return 0;
 }
 
 
@@ -709,7 +700,6 @@
 }
 
 
-#ifdef CONFIG_SMP
 struct op_x86_model_spec const op_p4_ht2_spec = {
 	.num_counters = NUM_COUNTERS_HT2,
 	.num_controls = NUM_CONTROLS_HT2,
@@ -719,7 +709,7 @@
 	.start = &p4_start,
 	.stop = &p4_stop
 };
-#endif
+
 
 struct op_x86_model_spec const op_p4_spec = {
 	.num_counters = NUM_COUNTERS_NON_HT,
diff -r 77a906fc5082 -r 94dc7b5aa86e xen/common/rcupdate.c
--- a/xen/common/rcupdate.c	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/common/rcupdate.c	Thu Feb 09 06:14:20 2012 -0800
@@ -83,9 +83,7 @@
     long            blimit;           /* Upper limit on a processed batch */
     int cpu;
     struct rcu_head barrier;
-#ifdef CONFIG_SMP
     long            last_rs_qlen;     /* qlen during the last resched */
-#endif
 };
 
 static DEFINE_PER_CPU(struct rcu_data, rcu_data);
diff -r 77a906fc5082 -r 94dc7b5aa86e xen/include/asm-x86/config.h
--- a/xen/include/asm-x86/config.h	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/include/asm-x86/config.h	Thu Feb 09 06:14:20 2012 -0800
@@ -21,7 +21,6 @@
 #define CONFIG_X86 1
 #define CONFIG_X86_HT 1
 #define CONFIG_PAGING_ASSISTANCE 1
-#define CONFIG_SMP 1
 #define CONFIG_X86_LOCAL_APIC 1
 #define CONFIG_X86_GOOD_APIC 1
 #define CONFIG_X86_IO_APIC 1
diff -r 77a906fc5082 -r 94dc7b5aa86e xen/include/asm-x86/processor.h
--- a/xen/include/asm-x86/processor.h	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/include/asm-x86/processor.h	Thu Feb 09 06:14:20 2012 -0800
@@ -189,13 +189,8 @@
 
 extern struct cpuinfo_x86 boot_cpu_data;
 
-#ifdef CONFIG_SMP
 extern struct cpuinfo_x86 cpu_data[];
 #define current_cpu_data cpu_data[smp_processor_id()]
-#else
-#define cpu_data (&boot_cpu_data)
-#define current_cpu_data boot_cpu_data
-#endif
 
 extern void set_cpuid_faulting(bool_t enable);
 
diff -r 77a906fc5082 -r 94dc7b5aa86e xen/include/asm-x86/smp.h
--- a/xen/include/asm-x86/smp.h	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/include/asm-x86/smp.h	Thu Feb 09 06:14:20 2012 -0800
@@ -17,7 +17,6 @@
 #endif
 
 #define BAD_APICID -1U
-#ifdef CONFIG_SMP
 #ifndef __ASSEMBLY__
 
 /*
@@ -65,11 +64,4 @@
 
 #endif /* !__ASSEMBLY__ */
 
-#else /* CONFIG_SMP */
-
-#define cpu_physical_id(cpu)		boot_cpu_physical_apicid
-
-#define NO_PROC_ID		0xFF		/* No processor magic marker */
-
 #endif
-#endif
diff -r 77a906fc5082 -r 94dc7b5aa86e xen/include/asm-x86/system.h
--- a/xen/include/asm-x86/system.h	Thu Feb 09 06:12:30 2012 -0800
+++ b/xen/include/asm-x86/system.h	Thu Feb 09 06:14:20 2012 -0800
@@ -154,15 +154,9 @@
 #define rmb()           barrier()
 #define wmb()           barrier()
 
-#ifdef CONFIG_SMP
 #define smp_mb()        mb()
 #define smp_rmb()       rmb()
 #define smp_wmb()       wmb()
-#else
-#define smp_mb()        barrier()
-#define smp_rmb()       barrier()
-#define smp_wmb()       barrier()
-#endif
 
 #define set_mb(var, value) do { xchg(&var, value); } while (0)
 #define set_wmb(var, value) do { var = value; wmb(); } while (0)

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvagD-0001Qz-IX; Thu, 09 Feb 2012 20:33:21 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvagC-0001N3-VT
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1328819593!10723058!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25724 invoked from network); 9 Feb 2012 20:33:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag5-0007i9-ED
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag5-0004Mr-9m
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:13 +0000
Message-Id: <E1Rvag5-0004Mr-9m@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: define stub
	arch_dump_shared_mem_info
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328801570 0
# Node ID a979f7b9edde7dc65945c08e9a293f4e4e7a78b3
# Parent  2555dd616551cf92daf53ccdcfb2d8ee3ebaab53
arm: define stub arch_dump_shared_mem_info

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 2555dd616551 -r a979f7b9edde xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c	Thu Feb 09 15:32:50 2012 +0000
+++ b/xen/arch/arm/mm.c	Thu Feb 09 15:32:50 2012 +0000
@@ -311,6 +311,10 @@
     frametable_virt_end = FRAMETABLE_VIRT_START + (nr_pages * sizeof(struct page_info));
 }
 
+void arch_dump_shared_mem_info(void)
+{
+}
+
 /*
  * 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 Feb 09 20:33:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvagD-0001Qz-IX; Thu, 09 Feb 2012 20:33:21 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvagC-0001N3-VT
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1328819593!10723058!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25724 invoked from network); 9 Feb 2012 20:33:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag5-0007i9-ED
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag5-0004Mr-9m
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:13 +0000
Message-Id: <E1Rvag5-0004Mr-9m@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: define stub
	arch_dump_shared_mem_info
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328801570 0
# Node ID a979f7b9edde7dc65945c08e9a293f4e4e7a78b3
# Parent  2555dd616551cf92daf53ccdcfb2d8ee3ebaab53
arm: define stub arch_dump_shared_mem_info

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 2555dd616551 -r a979f7b9edde xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c	Thu Feb 09 15:32:50 2012 +0000
+++ b/xen/arch/arm/mm.c	Thu Feb 09 15:32:50 2012 +0000
@@ -311,6 +311,10 @@
     frametable_virt_end = FRAMETABLE_VIRT_START + (nr_pages * sizeof(struct page_info));
 }
 
+void arch_dump_shared_mem_info(void)
+{
+}
+
 /*
  * 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 Feb 09 20:33:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvagE-0001Rg-LH; Thu, 09 Feb 2012 20:33:22 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvagD-0001N8-8c
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1328819594!14154283!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15985 invoked from network); 9 Feb 2012 20:33:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag5-0007iC-Ro
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag5-0004NF-QK
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:13 +0000
Message-Id: <E1Rvag5-0004NF-QK@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: makefiles
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328801570 0
# Node ID 48294c0c475d0b5c0f8476c5e6e71cb76c7d9fa8
# Parent  a979f7b9edde7dc65945c08e9a293f4e4e7a78b3
arm: makefiles

Makefile and config options for the ARM architecture.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r a979f7b9edde -r 48294c0c475d config/arm.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/config/arm.mk	Thu Feb 09 15:32:50 2012 +0000
@@ -0,0 +1,18 @@
+CONFIG_ARM := y
+CONFIG_ARM_32 := y
+CONFIG_ARM_$(XEN_OS) := y
+
+# -march= -mcpu=
+
+# Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb:
+CFLAGS += -marm
+
+HAS_PL011 := y
+
+# Use only if calling $(LD) directly.
+#LDFLAGS_DIRECT_OpenBSD = _obsd
+#LDFLAGS_DIRECT_FreeBSD = _fbsd
+LDFLAGS_DIRECT_Linux = _linux
+LDFLAGS_DIRECT += -marmelf$(LDFLAGS_DIRECT_$(XEN_OS))_eabi
+
+CONFIG_LOAD_ADDRESS ?= 0x80000000
diff -r a979f7b9edde -r 48294c0c475d xen/arch/arm/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/Makefile	Thu Feb 09 15:32:50 2012 +0000
@@ -0,0 +1,76 @@
+subdir-y += lib
+
+obj-y += dummy.o
+obj-y += entry.o
+obj-y += domain.o
+obj-y += domain_build.o
+obj-y += gic.o
+obj-y += io.o
+obj-y += irq.o
+obj-y += mm.o
+obj-y += p2m.o
+obj-y += guestcopy.o
+obj-y += setup.o
+obj-y += time.o
+obj-y += smpboot.o
+obj-y += smp.o
+obj-y += shutdown.o
+obj-y += traps.o
+obj-y += vgic.o
+obj-y += vtimer.o
+
+#obj-bin-y += ....o
+
+ALL_OBJS := head.o $(ALL_OBJS)
+
+$(TARGET): $(TARGET)-syms
+	# XXX: VE model loads by VMA so instead of
+	# making a proper ELF we link with LMA == VMA and adjust crudely
+	$(OBJCOPY) --change-addresses +0x7fe00000 $< $@
+	# XXX strip it
+
+#$(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
+#	./boot/mkelf32 $(TARGET)-syms $(TARGET) 0x100000 \
+#	`$(NM) -nr $(TARGET)-syms | head -n 1 | sed -e 's/^\([^ ]*\).*/0x\1/'`
+
+ifeq ($(lto),y)
+# Gather all LTO objects together
+prelink_lto.o: $(ALL_OBJS)
+	$(LD_LTO) -r -o $@ $^
+
+# Link it with all the binary objects
+prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o
+	$(LD) $(LDFLAGS) -r -o $@ $^
+else
+prelink.o: $(ALL_OBJS)
+	$(LD) $(LDFLAGS) -r -o $@ $^
+endif
+
+$(BASEDIR)/common/symbols-dummy.o:
+	$(MAKE) -f $(BASEDIR)/Rules.mk -C $(BASEDIR)/common symbols-dummy.o
+
+$(TARGET)-syms: prelink.o xen.lds $(BASEDIR)/common/symbols-dummy.o
+	$(LD) $(LDFLAGS) -T xen.lds -N prelink.o \
+	    $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0
+	$(NM) -n $(@D)/.$(@F).0 | $(BASEDIR)/tools/symbols >$(@D)/.$(@F).0.S
+	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0.o
+	$(LD) $(LDFLAGS) -T xen.lds -N prelink.o \
+	    $(@D)/.$(@F).0.o -o $(@D)/.$(@F).1
+	$(NM) -n $(@D)/.$(@F).1 | $(BASEDIR)/tools/symbols >$(@D)/.$(@F).1.S
+	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1.o
+	$(LD) $(LDFLAGS) -T xen.lds -N prelink.o \
+	    $(@D)/.$(@F).1.o -o $@
+	rm -f $(@D)/.$(@F).[0-9]*
+
+asm-offsets.s: asm-offsets.c
+	$(CC) $(filter-out -flto,$(CFLAGS)) -S -o $@ $<
+
+xen.lds: xen.lds.S
+	$(CC) -P -E -Ui386 $(AFLAGS) -DXEN_PHYS_START=$(CONFIG_LOAD_ADDRESS) -o $@ $<
+	sed -e 's/xen\.lds\.o:/xen\.lds:/g' <.xen.lds.d >.xen.lds.d.new
+	mv -f .xen.lds.d.new .xen.lds.d
+
+.PHONY: clean
+clean::
+	rm -f asm-offsets.s xen.lds
+	rm -f $(BASEDIR)/.xen-syms.[0-9]*
diff -r a979f7b9edde -r 48294c0c475d xen/arch/arm/Rules.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/Rules.mk	Thu Feb 09 15:32:50 2012 +0000
@@ -0,0 +1,29 @@
+########################################
+# arm-specific definitions
+
+#
+# If you change any of these configuration options then you must
+# 'make clean' before rebuilding.
+#
+
+CFLAGS += -fno-builtin -fno-common -Wredundant-decls
+CFLAGS += -iwithprefix include -Werror -Wno-pointer-arith -pipe
+CFLAGS += -I$(BASEDIR)/include
+
+# Prevent floating-point variables from creeping into Xen.
+CFLAGS += -msoft-float
+
+$(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
+$(call cc-option-add,CFLAGS,CC,-Wnested-externs)
+
+arm := y
+
+ifneq ($(call cc-option,$(CC),-fvisibility=hidden,n),n)
+CFLAGS += -DGCC_HAS_VISIBILITY_ATTRIBUTE
+endif
+
+CFLAGS += -march=armv7-a -mcpu=cortex-a15
+
+# Require GCC v3.4+ (to avoid issues with alignment constraints in Xen headers)
+check-$(gcc) = $(call cc-ver-check,CC,0x030400,"Xen requires at least gcc-3.4")
+$(eval $(check-y))

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvagE-0001Rg-LH; Thu, 09 Feb 2012 20:33:22 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvagD-0001N8-8c
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1328819594!14154283!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15985 invoked from network); 9 Feb 2012 20:33:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag5-0007iC-Ro
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag5-0004NF-QK
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:13 +0000
Message-Id: <E1Rvag5-0004NF-QK@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: makefiles
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328801570 0
# Node ID 48294c0c475d0b5c0f8476c5e6e71cb76c7d9fa8
# Parent  a979f7b9edde7dc65945c08e9a293f4e4e7a78b3
arm: makefiles

Makefile and config options for the ARM architecture.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r a979f7b9edde -r 48294c0c475d config/arm.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/config/arm.mk	Thu Feb 09 15:32:50 2012 +0000
@@ -0,0 +1,18 @@
+CONFIG_ARM := y
+CONFIG_ARM_32 := y
+CONFIG_ARM_$(XEN_OS) := y
+
+# -march= -mcpu=
+
+# Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb:
+CFLAGS += -marm
+
+HAS_PL011 := y
+
+# Use only if calling $(LD) directly.
+#LDFLAGS_DIRECT_OpenBSD = _obsd
+#LDFLAGS_DIRECT_FreeBSD = _fbsd
+LDFLAGS_DIRECT_Linux = _linux
+LDFLAGS_DIRECT += -marmelf$(LDFLAGS_DIRECT_$(XEN_OS))_eabi
+
+CONFIG_LOAD_ADDRESS ?= 0x80000000
diff -r a979f7b9edde -r 48294c0c475d xen/arch/arm/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/Makefile	Thu Feb 09 15:32:50 2012 +0000
@@ -0,0 +1,76 @@
+subdir-y += lib
+
+obj-y += dummy.o
+obj-y += entry.o
+obj-y += domain.o
+obj-y += domain_build.o
+obj-y += gic.o
+obj-y += io.o
+obj-y += irq.o
+obj-y += mm.o
+obj-y += p2m.o
+obj-y += guestcopy.o
+obj-y += setup.o
+obj-y += time.o
+obj-y += smpboot.o
+obj-y += smp.o
+obj-y += shutdown.o
+obj-y += traps.o
+obj-y += vgic.o
+obj-y += vtimer.o
+
+#obj-bin-y += ....o
+
+ALL_OBJS := head.o $(ALL_OBJS)
+
+$(TARGET): $(TARGET)-syms
+	# XXX: VE model loads by VMA so instead of
+	# making a proper ELF we link with LMA == VMA and adjust crudely
+	$(OBJCOPY) --change-addresses +0x7fe00000 $< $@
+	# XXX strip it
+
+#$(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
+#	./boot/mkelf32 $(TARGET)-syms $(TARGET) 0x100000 \
+#	`$(NM) -nr $(TARGET)-syms | head -n 1 | sed -e 's/^\([^ ]*\).*/0x\1/'`
+
+ifeq ($(lto),y)
+# Gather all LTO objects together
+prelink_lto.o: $(ALL_OBJS)
+	$(LD_LTO) -r -o $@ $^
+
+# Link it with all the binary objects
+prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o
+	$(LD) $(LDFLAGS) -r -o $@ $^
+else
+prelink.o: $(ALL_OBJS)
+	$(LD) $(LDFLAGS) -r -o $@ $^
+endif
+
+$(BASEDIR)/common/symbols-dummy.o:
+	$(MAKE) -f $(BASEDIR)/Rules.mk -C $(BASEDIR)/common symbols-dummy.o
+
+$(TARGET)-syms: prelink.o xen.lds $(BASEDIR)/common/symbols-dummy.o
+	$(LD) $(LDFLAGS) -T xen.lds -N prelink.o \
+	    $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0
+	$(NM) -n $(@D)/.$(@F).0 | $(BASEDIR)/tools/symbols >$(@D)/.$(@F).0.S
+	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0.o
+	$(LD) $(LDFLAGS) -T xen.lds -N prelink.o \
+	    $(@D)/.$(@F).0.o -o $(@D)/.$(@F).1
+	$(NM) -n $(@D)/.$(@F).1 | $(BASEDIR)/tools/symbols >$(@D)/.$(@F).1.S
+	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1.o
+	$(LD) $(LDFLAGS) -T xen.lds -N prelink.o \
+	    $(@D)/.$(@F).1.o -o $@
+	rm -f $(@D)/.$(@F).[0-9]*
+
+asm-offsets.s: asm-offsets.c
+	$(CC) $(filter-out -flto,$(CFLAGS)) -S -o $@ $<
+
+xen.lds: xen.lds.S
+	$(CC) -P -E -Ui386 $(AFLAGS) -DXEN_PHYS_START=$(CONFIG_LOAD_ADDRESS) -o $@ $<
+	sed -e 's/xen\.lds\.o:/xen\.lds:/g' <.xen.lds.d >.xen.lds.d.new
+	mv -f .xen.lds.d.new .xen.lds.d
+
+.PHONY: clean
+clean::
+	rm -f asm-offsets.s xen.lds
+	rm -f $(BASEDIR)/.xen-syms.[0-9]*
diff -r a979f7b9edde -r 48294c0c475d xen/arch/arm/Rules.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/Rules.mk	Thu Feb 09 15:32:50 2012 +0000
@@ -0,0 +1,29 @@
+########################################
+# arm-specific definitions
+
+#
+# If you change any of these configuration options then you must
+# 'make clean' before rebuilding.
+#
+
+CFLAGS += -fno-builtin -fno-common -Wredundant-decls
+CFLAGS += -iwithprefix include -Werror -Wno-pointer-arith -pipe
+CFLAGS += -I$(BASEDIR)/include
+
+# Prevent floating-point variables from creeping into Xen.
+CFLAGS += -msoft-float
+
+$(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
+$(call cc-option-add,CFLAGS,CC,-Wnested-externs)
+
+arm := y
+
+ifneq ($(call cc-option,$(CC),-fvisibility=hidden,n),n)
+CFLAGS += -DGCC_HAS_VISIBILITY_ATTRIBUTE
+endif
+
+CFLAGS += -march=armv7-a -mcpu=cortex-a15
+
+# Require GCC v3.4+ (to avoid issues with alignment constraints in Xen headers)
+check-$(gcc) = $(call cc-ver-check,CC,0x030400,"Xen requires at least gcc-3.4")
+$(eval $(check-y))

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvagF-0001T1-PJ; Thu, 09 Feb 2012 20:33:23 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvagE-0001NK-BF
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-174.messagelabs.com!1328819595!8523067!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2888 invoked from network); 9 Feb 2012 20:33:16 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:16 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag6-0007iI-Se
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag6-0004O1-RQ
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:14 +0000
Message-Id: <E1Rvag6-0004O1-RQ@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: copy DTB appended to zImage
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1328801570 0
# Node ID fb71a97fe339282965d584663236ce71a2400659
# Parent  da77e2bfcd14b75eb3c341b98b75dfed20ec0bdc
arm: copy DTB appended to zImage

When copying a zImage from flash, also copy any appended device tree
blob.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r da77e2bfcd14 -r fb71a97fe339 xen/arch/arm/kernel.c
--- a/xen/arch/arm/kernel.c	Thu Feb 09 15:32:50 2012 +0000
+++ b/xen/arch/arm/kernel.c	Thu Feb 09 15:32:50 2012 +0000
@@ -10,6 +10,7 @@
 #include <xen/mm.h>
 #include <xen/domain_page.h>
 #include <xen/sched.h>
+#include <asm/byteorder.h>
 
 #include "kernel.h"
 
@@ -23,6 +24,40 @@
 
 #define ZIMAGE_MAGIC 0x016f2818
 
+struct minimal_dtb_header {
+    uint32_t magic;
+    uint32_t total_size;
+    /* There are other fields but we don't use them yet. */
+};
+
+#define DTB_MAGIC 0xd00dfeed
+
+static void copy_from_flash(void *dst, paddr_t flash, unsigned long len)
+{
+    void *src = (void *)FIXMAP_ADDR(FIXMAP_MISC);
+
+    printk("Copying %#lx bytes from flash %"PRIpaddr" to %p",
+           len, flash, dst);
+
+    while (len) {
+        paddr_t p;
+        unsigned long l, s;
+
+        p = flash >> PAGE_SHIFT;
+        s = flash & (PAGE_SIZE-1);
+        l = min(PAGE_SIZE - s, len);
+
+        set_fixmap(FIXMAP_MISC, p, DEV_SHARED);
+        memcpy(dst, src + s, l);
+
+        flash += l;
+        dst += l;
+        len -= l;
+    }
+
+    clear_fixmap(FIXMAP_MISC);
+}
+
 static void kernel_zimage_load(struct kernel_info *info)
 {
     paddr_t load_addr = info->zimage.load_addr;
@@ -58,6 +93,7 @@
 {
     uint32_t *zimage = (void *)FIXMAP_ADDR(FIXMAP_MISC);
     uint32_t start, end;
+    struct minimal_dtb_header dtb_hdr;
 
     set_fixmap(FIXMAP_MISC, KERNEL_FLASH_ADDRESS >> PAGE_SHIFT, DEV_SHARED);
 
@@ -69,6 +105,14 @@
 
     clear_fixmap(FIXMAP_MISC);
 
+    /*
+     * Check for an appended DTB.
+     */
+    copy_from_flash(&dtb_hdr, KERNEL_FLASH_ADDRESS + end - start, sizeof(dtb_hdr));
+    if (be32_to_cpu(dtb_hdr.magic) == DTB_MAGIC) {
+        end += be32_to_cpu(dtb_hdr.total_size);
+    }
+
     /* FIXME: get RAM location from appended DTB (if there is one)? */
 
     /*
@@ -97,25 +141,6 @@
     free_xenheap_pages(info->kernel_img, info->kernel_order);
 }
 
-static void copy_from_flash(void *dst, paddr_t flash, unsigned long len)
-{
-    void *src = (void *)FIXMAP_ADDR(FIXMAP_MISC);
-    unsigned long offs;
-
-    printk("Copying %#lx bytes from flash %"PRIpaddr" to %p-%p: [",
-           len, flash, dst, dst+(1<<23));
-    for ( offs = 0; offs < len ; offs += PAGE_SIZE )
-    {
-        if ( ( offs % (1<<20) ) == 0 )
-            printk(".");
-        set_fixmap(FIXMAP_MISC, (flash+offs) >> PAGE_SHIFT, DEV_SHARED);
-        memcpy(dst+offs, src, PAGE_SIZE);
-    }
-    printk("]\n");
-
-    clear_fixmap(FIXMAP_MISC);
-}
-
 static int kernel_try_elf_prepare(struct kernel_info *info)
 {
     int rc;

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvagF-0001T1-PJ; Thu, 09 Feb 2012 20:33:23 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvagE-0001NK-BF
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-174.messagelabs.com!1328819595!8523067!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2888 invoked from network); 9 Feb 2012 20:33:16 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:16 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag6-0007iI-Se
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag6-0004O1-RQ
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:14 +0000
Message-Id: <E1Rvag6-0004O1-RQ@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: copy DTB appended to zImage
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1328801570 0
# Node ID fb71a97fe339282965d584663236ce71a2400659
# Parent  da77e2bfcd14b75eb3c341b98b75dfed20ec0bdc
arm: copy DTB appended to zImage

When copying a zImage from flash, also copy any appended device tree
blob.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r da77e2bfcd14 -r fb71a97fe339 xen/arch/arm/kernel.c
--- a/xen/arch/arm/kernel.c	Thu Feb 09 15:32:50 2012 +0000
+++ b/xen/arch/arm/kernel.c	Thu Feb 09 15:32:50 2012 +0000
@@ -10,6 +10,7 @@
 #include <xen/mm.h>
 #include <xen/domain_page.h>
 #include <xen/sched.h>
+#include <asm/byteorder.h>
 
 #include "kernel.h"
 
@@ -23,6 +24,40 @@
 
 #define ZIMAGE_MAGIC 0x016f2818
 
+struct minimal_dtb_header {
+    uint32_t magic;
+    uint32_t total_size;
+    /* There are other fields but we don't use them yet. */
+};
+
+#define DTB_MAGIC 0xd00dfeed
+
+static void copy_from_flash(void *dst, paddr_t flash, unsigned long len)
+{
+    void *src = (void *)FIXMAP_ADDR(FIXMAP_MISC);
+
+    printk("Copying %#lx bytes from flash %"PRIpaddr" to %p",
+           len, flash, dst);
+
+    while (len) {
+        paddr_t p;
+        unsigned long l, s;
+
+        p = flash >> PAGE_SHIFT;
+        s = flash & (PAGE_SIZE-1);
+        l = min(PAGE_SIZE - s, len);
+
+        set_fixmap(FIXMAP_MISC, p, DEV_SHARED);
+        memcpy(dst, src + s, l);
+
+        flash += l;
+        dst += l;
+        len -= l;
+    }
+
+    clear_fixmap(FIXMAP_MISC);
+}
+
 static void kernel_zimage_load(struct kernel_info *info)
 {
     paddr_t load_addr = info->zimage.load_addr;
@@ -58,6 +93,7 @@
 {
     uint32_t *zimage = (void *)FIXMAP_ADDR(FIXMAP_MISC);
     uint32_t start, end;
+    struct minimal_dtb_header dtb_hdr;
 
     set_fixmap(FIXMAP_MISC, KERNEL_FLASH_ADDRESS >> PAGE_SHIFT, DEV_SHARED);
 
@@ -69,6 +105,14 @@
 
     clear_fixmap(FIXMAP_MISC);
 
+    /*
+     * Check for an appended DTB.
+     */
+    copy_from_flash(&dtb_hdr, KERNEL_FLASH_ADDRESS + end - start, sizeof(dtb_hdr));
+    if (be32_to_cpu(dtb_hdr.magic) == DTB_MAGIC) {
+        end += be32_to_cpu(dtb_hdr.total_size);
+    }
+
     /* FIXME: get RAM location from appended DTB (if there is one)? */
 
     /*
@@ -97,25 +141,6 @@
     free_xenheap_pages(info->kernel_img, info->kernel_order);
 }
 
-static void copy_from_flash(void *dst, paddr_t flash, unsigned long len)
-{
-    void *src = (void *)FIXMAP_ADDR(FIXMAP_MISC);
-    unsigned long offs;
-
-    printk("Copying %#lx bytes from flash %"PRIpaddr" to %p-%p: [",
-           len, flash, dst, dst+(1<<23));
-    for ( offs = 0; offs < len ; offs += PAGE_SIZE )
-    {
-        if ( ( offs % (1<<20) ) == 0 )
-            printk(".");
-        set_fixmap(FIXMAP_MISC, (flash+offs) >> PAGE_SHIFT, DEV_SHARED);
-        memcpy(dst+offs, src, PAGE_SIZE);
-    }
-    printk("]\n");
-
-    clear_fixmap(FIXMAP_MISC);
-}
-
 static int kernel_try_elf_prepare(struct kernel_info *info)
 {
     int rc;

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvagG-0001UB-SF; Thu, 09 Feb 2012 20:33:24 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvagF-0001NQ-9Y
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1328819595!10863759!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11516 invoked from network); 9 Feb 2012 20:33:16 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:16 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag7-0007iL-DV
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag7-0004OP-CL
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:15 +0000
Message-Id: <E1Rvag7-0004OP-CL@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] gnttab: miscellaneous fixes
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328801956 -3600
# Node ID 9fc810bb814558bc5c8f9d086af7576516e07244
# Parent  fb71a97fe339282965d584663236ce71a2400659
gnttab: miscellaneous fixes

- _GTF_* constants name bit positions, so binary arithmetic on them is
  wrong
- gnttab_clear_flag() cannot (on x86 and ia64 at least) simply use
  clear_bit(), as that may access more than the two bytes that are
  intended to be accessed

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


diff -r fb71a97fe339 -r 9fc810bb8145 xen/common/grant_table.c
--- a/xen/common/grant_table.c	Thu Feb 09 15:32:50 2012 +0000
+++ b/xen/common/grant_table.c	Thu Feb 09 16:39:16 2012 +0100
@@ -397,7 +397,8 @@
              (id != domid) ||
              (!readonly && (flags & GTF_readonly)) )
         {
-            gnttab_clear_flag(_GTF_reading | _GTF_writing, status);
+            gnttab_clear_flag(_GTF_writing, status);
+            gnttab_clear_flag(_GTF_reading, status);
             PIN_FAIL(done, GNTST_general_error,
                      "Unstable flags (%x) or dom (%d). (expected dom %d) "
                      "(r/w: %d)\n",
@@ -1716,14 +1717,14 @@
    under the domain's grant table lock. */
 /* Only safe on transitive grants.  Even then, note that we don't
    attempt to drop any pin on the referent grant. */
-static void __fixup_status_for_pin(struct active_grant_entry *act,
+static void __fixup_status_for_pin(const struct active_grant_entry *act,
                                    uint16_t *status)
 {
     if ( !(act->pin & GNTPIN_hstw_mask) )
-        *status &= ~_GTF_writing;
+        *status &= ~GTF_writing;
 
     if ( !(act->pin & GNTPIN_hstr_mask) )
-        *status &= ~_GTF_reading;
+        *status &= ~GTF_reading;
 }
 
 /* Grab a frame number from a grant entry and update the flags and pin
diff -r fb71a97fe339 -r 9fc810bb8145 xen/include/asm-ia64/grant_table.h
--- a/xen/include/asm-ia64/grant_table.h	Thu Feb 09 15:32:50 2012 +0000
+++ b/xen/include/asm-ia64/grant_table.h	Thu Feb 09 16:39:16 2012 +0100
@@ -5,6 +5,8 @@
 #ifndef __ASM_GRANT_TABLE_H__
 #define __ASM_GRANT_TABLE_H__
 
+#include <asm/intrinsics.h>
+
 #define INITIAL_NR_GRANT_FRAMES 1
 
 // for grant map/unmap
@@ -82,9 +84,19 @@
 
 #define gnttab_mark_dirty(d, f) ((void)f)
 
-static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
+static inline void gnttab_clear_flag(unsigned int nr, volatile uint16_t *st)
 {
-	clear_bit(nr, addr);
+	/*
+	 * Note that this cannot be clear_bit(), as the access must be
+	 * confined to the specified 2 bytes.
+	 */
+	uint16_t mask = ~(1 << nr), old;
+	CMPXCHG_BUGCHECK_DECL
+
+	do {
+		CMPXCHG_BUGCHECK(st);
+		old = *st;
+	} while (cmpxchg_rel(st, old, old & mask) != old);
 }
 
 #define gnttab_host_mapping_get_page_type(op, ld, rd)   \
diff -r fb71a97fe339 -r 9fc810bb8145 xen/include/asm-x86/grant_table.h
--- a/xen/include/asm-x86/grant_table.h	Thu Feb 09 15:32:50 2012 +0000
+++ b/xen/include/asm-x86/grant_table.h	Thu Feb 09 16:39:16 2012 +0100
@@ -48,9 +48,13 @@
 
 #define gnttab_mark_dirty(d, f) paging_mark_dirty((d), (f))
 
-static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
+static inline void gnttab_clear_flag(unsigned int nr, uint16_t *st)
 {
-    clear_bit(nr, (unsigned long *)addr);
+    /*
+     * Note that this cannot be clear_bit(), as the access must be
+     * confined to the specified 2 bytes.
+     */
+    asm volatile ("lock btrw %1,%0" : "=m" (*st) : "Ir" (nr), "m" (*st));
 }
 
 /* Foreign mappings of HHVM-guest pages do not modify the type count. */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 09 20:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2012 20:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RvagG-0001UB-SF; Thu, 09 Feb 2012 20:33:24 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvagF-0001NQ-9Y
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1328819595!10863759!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11516 invoked from network); 9 Feb 2012 20:33:16 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	9 Feb 2012 20:33:16 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag7-0007iL-DV
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvag7-0004OP-CL
	for xen-changelog@lists.xensource.com; Thu, 09 Feb 2012 20:33:15 +0000
Message-Id: <E1Rvag7-0004OP-CL@xenbits.xen.org>
Date: Thu, 09 Feb 2012 20:33:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] gnttab: miscellaneous fixes
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328801956 -3600
# Node ID 9fc810bb814558bc5c8f9d086af7576516e07244
# Parent  fb71a97fe339282965d584663236ce71a2400659
gnttab: miscellaneous fixes

- _GTF_* constants name bit positions, so binary arithmetic on them is
  wrong
- gnttab_clear_flag() cannot (on x86 and ia64 at least) simply use
  clear_bit(), as that may access more than the two bytes that are
  intended to be accessed

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


diff -r fb71a97fe339 -r 9fc810bb8145 xen/common/grant_table.c
--- a/xen/common/grant_table.c	Thu Feb 09 15:32:50 2012 +0000
+++ b/xen/common/grant_table.c	Thu Feb 09 16:39:16 2012 +0100
@@ -397,7 +397,8 @@
              (id != domid) ||
              (!readonly && (flags & GTF_readonly)) )
         {
-            gnttab_clear_flag(_GTF_reading | _GTF_writing, status);
+            gnttab_clear_flag(_GTF_writing, status);
+            gnttab_clear_flag(_GTF_reading, status);
             PIN_FAIL(done, GNTST_general_error,
                      "Unstable flags (%x) or dom (%d). (expected dom %d) "
                      "(r/w: %d)\n",
@@ -1716,14 +1717,14 @@
    under the domain's grant table lock. */
 /* Only safe on transitive grants.  Even then, note that we don't
    attempt to drop any pin on the referent grant. */
-static void __fixup_status_for_pin(struct active_grant_entry *act,
+static void __fixup_status_for_pin(const struct active_grant_entry *act,
                                    uint16_t *status)
 {
     if ( !(act->pin & GNTPIN_hstw_mask) )
-        *status &= ~_GTF_writing;
+        *status &= ~GTF_writing;
 
     if ( !(act->pin & GNTPIN_hstr_mask) )
-        *status &= ~_GTF_reading;
+        *status &= ~GTF_reading;
 }
 
 /* Grab a frame number from a grant entry and update the flags and pin
diff -r fb71a97fe339 -r 9fc810bb8145 xen/include/asm-ia64/grant_table.h
--- a/xen/include/asm-ia64/grant_table.h	Thu Feb 09 15:32:50 2012 +0000
+++ b/xen/include/asm-ia64/grant_table.h	Thu Feb 09 16:39:16 2012 +0100
@@ -5,6 +5,8 @@
 #ifndef __ASM_GRANT_TABLE_H__
 #define __ASM_GRANT_TABLE_H__
 
+#include <asm/intrinsics.h>
+
 #define INITIAL_NR_GRANT_FRAMES 1
 
 // for grant map/unmap
@@ -82,9 +84,19 @@
 
 #define gnttab_mark_dirty(d, f) ((void)f)
 
-static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
+static inline void gnttab_clear_flag(unsigned int nr, volatile uint16_t *st)
 {
-	clear_bit(nr, addr);
+	/*
+	 * Note that this cannot be clear_bit(), as the access must be
+	 * confined to the specified 2 bytes.
+	 */
+	uint16_t mask = ~(1 << nr), old;
+	CMPXCHG_BUGCHECK_DECL
+
+	do {
+		CMPXCHG_BUGCHECK(st);
+		old = *st;
+	} while (cmpxchg_rel(st, old, old & mask) != old);
 }
 
 #define gnttab_host_mapping_get_page_type(op, ld, rd)   \
diff -r fb71a97fe339 -r 9fc810bb8145 xen/include/asm-x86/grant_table.h
--- a/xen/include/asm-x86/grant_table.h	Thu Feb 09 15:32:50 2012 +0000
+++ b/xen/include/asm-x86/grant_table.h	Thu Feb 09 16:39:16 2012 +0100
@@ -48,9 +48,13 @@
 
 #define gnttab_mark_dirty(d, f) paging_mark_dirty((d), (f))
 
-static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
+static inline void gnttab_clear_flag(unsigned int nr, uint16_t *st)
 {
-    clear_bit(nr, (unsigned long *)addr);
+    /*
+     * Note that this cannot be clear_bit(), as the access must be
+     * confined to the specified 2 bytes.
+     */
+    asm volatile ("lock btrw %1,%0" : "=m" (*st) : "Ir" (nr), "m" (*st));
 }
 
 /* Foreign mappings of HHVM-guest pages do not modify the type count. */

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 10 16:55:19 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2012 16:55:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rvtkh-0003np-EW; Fri, 10 Feb 2012 16:55:15 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvtkf-0003mO-KS
	for xen-changelog@lists.xensource.com; Fri, 10 Feb 2012 16:55:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-27.messagelabs.com!1328892876!59359340!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14536 invoked from network); 10 Feb 2012 16:54:37 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	10 Feb 2012 16:54:37 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvtkY-0006Dy-FB
	for xen-changelog@lists.xensource.com; Fri, 10 Feb 2012 16:55:06 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvtkX-0007bl-SS
	for xen-changelog@lists.xensource.com; Fri, 10 Feb 2012 16:55:05 +0000
Message-Id: <E1RvtkX-0007bl-SS@xenbits.xen.org>
Date: Fri, 10 Feb 2012 16:55:05 +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] Update Xen public headers
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328890307 -3600
# Node ID 7c89207af621ff8293f9b64c046eb70a8f85ef75
# Parent  ddb83aec5afc6f7980aaae2497a5b171c1549eff
Update Xen public headers

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


diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/arch-arm.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/xen/interface/arch-arm.h	Fri Feb 10 17:11:47 2012 +0100
@@ -0,0 +1,125 @@
+/******************************************************************************
+ * arch-arm.h
+ *
+ * Guest OS interface to ARM Xen.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright 2011 (C) Citrix Systems
+ */
+
+#ifndef __XEN_PUBLIC_ARCH_ARM_H__
+#define __XEN_PUBLIC_ARCH_ARM_H__
+
+#ifndef __ASSEMBLY__
+#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
+    typedef struct { type *p; } __guest_handle_ ## name
+
+#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
+    ___DEFINE_XEN_GUEST_HANDLE(name, type);   \
+    ___DEFINE_XEN_GUEST_HANDLE(const_##name, const type)
+#define DEFINE_XEN_GUEST_HANDLE(name)   __DEFINE_XEN_GUEST_HANDLE(name, name)
+#define __XEN_GUEST_HANDLE(name)        __guest_handle_ ## name
+#define XEN_GUEST_HANDLE(name)          __XEN_GUEST_HANDLE(name)
+#define set_xen_guest_handle_raw(hnd, val)  do { (hnd).p = val; } while (0)
+#ifdef __XEN_TOOLS__
+#define get_xen_guest_handle(val, hnd)  do { val = (hnd).p; } while (0)
+#endif
+#define set_xen_guest_handle(hnd, val) set_xen_guest_handle_raw(hnd, val)
+
+struct cpu_user_regs
+{
+    uint32_t r0;
+    uint32_t r1;
+    uint32_t r2;
+    uint32_t r3;
+    uint32_t r4;
+    uint32_t r5;
+    uint32_t r6;
+    uint32_t r7;
+    uint32_t r8;
+    uint32_t r9;
+    uint32_t r10;
+    union {
+        uint32_t r11;
+        uint32_t fp;
+    };
+    uint32_t r12;
+
+    uint32_t sp; /* r13 - SP: Valid for Hyp. frames only, o/w banked (see below) */
+    uint32_t lr; /* r14 - LR: Valid for Hyp. Same physical register as lr_usr. */
+
+    uint32_t pc; /* Return IP */
+    uint32_t cpsr; /* Return mode */
+    uint32_t pad0; /* Doubleword-align the kernel half of the frame */
+
+    /* Outer guest frame only from here on... */
+
+    uint32_t r8_fiq, r9_fiq, r10_fiq, r11_fiq, r12_fiq;
+
+    uint32_t sp_usr, sp_svc, sp_abt, sp_und, sp_irq, sp_fiq;
+    uint32_t lr_usr, lr_svc, lr_abt, lr_und, lr_irq, lr_fiq;
+
+    uint32_t spsr_svc, spsr_abt, spsr_und, spsr_irq, spsr_fiq;
+};
+typedef struct cpu_user_regs cpu_user_regs_t;
+DEFINE_XEN_GUEST_HANDLE(cpu_user_regs_t);
+
+typedef uint64_t xen_pfn_t;
+#define PRI_xen_pfn PRIx64
+
+/* Maximum number of virtual CPUs in legacy multi-processor guests. */
+/* Only one. All other VCPUS must use VCPUOP_register_vcpu_info */
+#define XEN_LEGACY_MAX_VCPUS 1
+
+typedef uint32_t xen_ulong_t;
+
+struct vcpu_guest_context {
+    struct cpu_user_regs user_regs;         /* User-level CPU registers     */
+    union {
+        uint32_t reg[16];
+        struct {
+            uint32_t __pad[12];
+            uint32_t sp; /* r13 */
+            uint32_t lr; /* r14 */
+            uint32_t pc; /* r15 */
+        };
+    };
+};
+typedef struct vcpu_guest_context vcpu_guest_context_t;
+DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
+
+struct arch_vcpu_info { };
+typedef struct arch_vcpu_info arch_vcpu_info_t;
+
+struct arch_shared_info { };
+typedef struct arch_shared_info arch_shared_info_t;
+#endif
+
+#endif /*  __XEN_PUBLIC_ARCH_ARM_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/arch-x86/hvm/save.h
--- a/include/xen/interface/arch-x86/hvm/save.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/arch-x86/hvm/save.h	Fri Feb 10 17:11:47 2012 +0100
@@ -344,12 +344,7 @@
  * IO-APIC
  */
 
-#ifdef __ia64__
-#define VIOAPIC_IS_IOSAPIC 1
-#define VIOAPIC_NUM_PINS  24
-#else
 #define VIOAPIC_NUM_PINS  48 /* 16 ISA IRQs, 32 non-legacy PCI IRQS. */
-#endif
 
 struct hvm_hw_vioapic {
     uint64_t base_address;
@@ -368,13 +363,8 @@
             uint8_t trig_mode:1;
             uint8_t mask:1;
             uint8_t reserve:7;
-#if !VIOAPIC_IS_IOSAPIC
             uint8_t reserved[4];
             uint8_t dest_id;
-#else
-            uint8_t reserved[3];
-            uint16_t dest_id;
-#endif
         } fields;
     } redirtbl[VIOAPIC_NUM_PINS];
 };
@@ -564,7 +554,7 @@
 
         struct { char x[0]; } ymm;    /* YMM */
     } save_area;
-} __attribute__((packed));
+};
 
 #define CPU_XSAVE_CODE  16
 
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/arch-x86/xen.h
--- a/include/xen/interface/arch-x86/xen.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/arch-x86/xen.h	Fri Feb 10 17:11:47 2012 +0100
@@ -82,7 +82,13 @@
 typedef unsigned long xen_ulong_t;
 
 /*
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_set_trap_table(const struct trap_info traps[]);
+ * `
+ */
+/*
  * Send an array of these to HYPERVISOR_set_trap_table().
+ * Terminate the array with a sentinel entry, with traps[].address==0.
  * The privilege level specifies which modes may enter a trap via a software
  * interrupt. On x86/64, since rings 1 and 2 are unavailable, we allocate
  * privilege levels as follows:
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/domctl.h
--- a/include/xen/interface/domctl.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/domctl.h	Fri Feb 10 17:11:47 2012 +0100
@@ -742,8 +742,12 @@
     uint32_t       op;           /* XEN_DOMCTL_MEM_EVENT_OP_*_* */
     uint32_t       mode;         /* XEN_DOMCTL_MEM_EVENT_OP_* */
 
-    /* OP_ENABLE */
-    uint64_aligned_t shared_addr;  /* IN:  Virtual address of shared page */
+    union {
+        /* OP_ENABLE IN:  Virtual address of shared page */
+        uint64_aligned_t shared_addr;  
+        /* PAGING_PREP IN: buffer to immediately fill page in */
+        uint64_aligned_t buffer;
+    } u;
     uint64_aligned_t ring_addr;    /* IN:  Virtual address of ring page */
 
     /* Other OPs */
@@ -767,10 +771,24 @@
 #define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GFN      5
 #define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_MFN      6
 #define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GREF     7
+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_ADD_PHYSMAP    8
 
 #define XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID  (-10)
 #define XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID  (-9)
 
+/* The following allows sharing of grant refs. This is useful
+ * for sharing utilities sitting as "filters" in IO backends
+ * (e.g. memshr + blktap(2)). The IO backend is only exposed 
+ * to grant references, and this allows sharing of the grefs */
+#define XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF_FLAG   (1ULL << 62)
+
+#define XEN_DOMCTL_MEM_SHARING_FIELD_MAKE_GREF(field, val)  \
+    (field) = (XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF_FLAG | val)
+#define XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF(field)         \
+    ((field) & XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF_FLAG)
+#define XEN_DOMCTL_MEM_SHARING_FIELD_GET_GREF(field)        \
+    ((field) & (~XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF_FLAG))
+
 struct xen_domctl_mem_sharing_op {
     uint8_t op; /* XEN_DOMCTL_MEM_EVENT_OP_* */
 
@@ -784,8 +802,11 @@
             } u;
             uint64_aligned_t  handle;     /* OUT: the handle           */
         } nominate;
-        struct mem_sharing_op_share {     /* OP_SHARE */
+        struct mem_sharing_op_share {     /* OP_SHARE/ADD_PHYSMAP */
+            uint64_aligned_t source_gfn;    /* IN: the gfn of the source page */
             uint64_aligned_t source_handle; /* IN: handle to the source page */
+            domid_t          client_domain; /* IN: the client domain id */
+            uint64_aligned_t client_gfn;    /* IN: the client gfn */
             uint64_aligned_t client_handle; /* IN: handle to the client page */
         } share; 
         struct mem_sharing_op_debug {     /* OP_DEBUG_xxx */
@@ -800,6 +821,21 @@
 typedef struct xen_domctl_mem_sharing_op xen_domctl_mem_sharing_op_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_mem_sharing_op_t);
 
+struct xen_domctl_audit_p2m {
+    /* OUT error counts */
+    uint64_t orphans;
+    uint64_t m2p_bad;
+    uint64_t p2m_bad;
+};
+typedef struct xen_domctl_audit_p2m xen_domctl_audit_p2m_t;
+DEFINE_XEN_GUEST_HANDLE(xen_domctl_audit_p2m_t);
+
+struct xen_domctl_set_virq_handler {
+    uint32_t virq; /* IN */
+};
+typedef struct xen_domctl_set_virq_handler xen_domctl_set_virq_handler_t;
+DEFINE_XEN_GUEST_HANDLE(xen_domctl_set_virq_handler_t);
+
 #if defined(__i386__) || defined(__x86_64__)
 /* XEN_DOMCTL_setvcpuextstate */
 /* XEN_DOMCTL_getvcpuextstate */
@@ -898,6 +934,8 @@
 #define XEN_DOMCTL_setvcpuextstate               62
 #define XEN_DOMCTL_getvcpuextstate               63
 #define XEN_DOMCTL_set_access_required           64
+#define XEN_DOMCTL_audit_p2m                     65
+#define XEN_DOMCTL_set_virq_handler              66
 #define XEN_DOMCTL_gdbsx_guestmemio            1000
 #define XEN_DOMCTL_gdbsx_pausevcpu             1001
 #define XEN_DOMCTL_gdbsx_unpausevcpu           1002
@@ -951,6 +989,8 @@
         struct xen_domctl_vcpuextstate      vcpuextstate;
 #endif
         struct xen_domctl_set_access_required access_required;
+        struct xen_domctl_audit_p2m         audit_p2m;
+        struct xen_domctl_set_virq_handler  set_virq_handler;
         struct xen_domctl_gdbsx_memio       gdbsx_guest_memio;
         struct xen_domctl_gdbsx_pauseunp_vcpu gdbsx_pauseunp_vcpu;
         struct xen_domctl_gdbsx_domstatus   gdbsx_domstatus;
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/grant_table.h
--- a/include/xen/interface/grant_table.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/grant_table.h	Fri Feb 10 17:11:47 2012 +0100
@@ -117,6 +117,13 @@
 };
 typedef struct grant_entry_v1 grant_entry_v1_t;
 
+/* The first few grant table entries will be preserved across grant table
+ * version changes and may be pre-populated at domain creation by tools.
+ */
+#define GNTTAB_NR_RESERVED_ENTRIES     8
+#define GNTTAB_RESERVED_CONSOLE        0
+#define GNTTAB_RESERVED_XENSTORE       1
+
 /*
  * Type of grant entry.
  *  GTF_invalid: This grant entry grants no privileges.
@@ -511,6 +518,20 @@
 typedef struct gnttab_get_version gnttab_get_version_t;
 DEFINE_XEN_GUEST_HANDLE(gnttab_get_version_t);
 
+/* 
+ * GNTTABOP_swap_grant_ref: Swap the contents of two grant entries.
+ */
+#define GNTTABOP_swap_grant_ref	      11
+struct gnttab_swap_grant_ref {
+    /* IN parameters */
+    grant_ref_t ref_a;
+    grant_ref_t ref_b;
+    /* OUT parameters */
+    int16_t status;             /* GNTST_* */
+};
+typedef struct gnttab_swap_grant_ref gnttab_swap_grant_ref_t;
+DEFINE_XEN_GUEST_HANDLE(gnttab_swap_grant_ref_t);
+
 #endif /* __XEN_INTERFACE_VERSION__ */
 
 /*
@@ -566,7 +587,7 @@
 #define GNTST_bad_page         (-9) /* Specified page was invalid for op.    */
 #define GNTST_bad_copy_arg    (-10) /* copy arguments cross page boundary.   */
 #define GNTST_address_too_big (-11) /* transfer page address too large.      */
-#define GNTST_eagain          (-12) /* Could not map at the moment. Retry.   */
+#define GNTST_eagain          (-12) /* Operation not done; try again.        */
 
 #define GNTTABOP_error_msgs {                   \
     "okay",                                     \
@@ -581,7 +602,7 @@
     "bad page",                                 \
     "copy arguments cross page boundary",       \
     "page address size too large",              \
-    "could not map at the moment, retry"        \
+    "operation not done; try again"             \
 }
 
 #endif /* __XEN_PUBLIC_GRANT_TABLE_H__ */
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/hvm/hvm_info_table.h
--- a/include/xen/interface/hvm/hvm_info_table.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/hvm/hvm_info_table.h	Fri Feb 10 17:11:47 2012 +0100
@@ -37,9 +37,6 @@
     uint32_t    length;
     uint8_t     checksum;
 
-    /* Should firmware build ACPI tables? */
-    uint8_t     acpi_enabled;
-
     /* Should firmware build APIC descriptors (APIC MADT / MP BIOS)? */
     uint8_t     apic_mode;
 
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/hvm/hvm_op.h
--- a/include/xen/interface/hvm/hvm_op.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/hvm/hvm_op.h	Fri Feb 10 17:11:47 2012 +0100
@@ -174,6 +174,9 @@
     HVMMEM_access_rwx,
     HVMMEM_access_rx2rw,       /* Page starts off as r-x, but automatically
                                 * change to r-w on a write */
+    HVMMEM_access_n2rwx,       /* Log access: starts off as n, automatically 
+                                * goes to rwx, generating an event without
+                                * pausing the vcpu */
     HVMMEM_access_default      /* Take the domain default */
 } hvmmem_access_t;
 /* Notify that a region of memory is to have specific access types */
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/hvm/params.h
--- a/include/xen/interface/hvm/params.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/hvm/params.h	Fri Feb 10 17:11:47 2012 +0100
@@ -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__ */
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/mem_event.h
--- a/include/xen/interface/mem_event.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/mem_event.h	Fri Feb 10 17:11:47 2012 +0100
@@ -39,6 +39,8 @@
 #define MEM_EVENT_FLAG_VCPU_PAUSED  (1 << 0)
 #define MEM_EVENT_FLAG_DROP_PAGE    (1 << 1)
 #define MEM_EVENT_FLAG_EVICT_FAIL   (1 << 2)
+#define MEM_EVENT_FLAG_FOREIGN      (1 << 3)
+#define MEM_EVENT_FLAG_DUMMY        (1 << 4)
 
 /* Reasons for the memory event request */
 #define MEM_EVENT_REASON_UNKNOWN     0    /* typical reason */
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/memory.h
--- a/include/xen/interface/memory.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/memory.h	Fri Feb 10 17:11:47 2012 +0100
@@ -208,10 +208,14 @@
     /* Which domain to change the mapping for. */
     domid_t domid;
 
+    /* Number of pages to go through for gmfn_range */
+    uint16_t    size;
+
     /* Source mapping space. */
 #define XENMAPSPACE_shared_info 0 /* shared info page */
 #define XENMAPSPACE_grant_table 1 /* grant table page */
 #define XENMAPSPACE_gmfn        2 /* GMFN */
+#define XENMAPSPACE_gmfn_range  3 /* GMFN range */
     unsigned int space;
 
 #define XENMAPIDX_grant_table_status 0x80000000
@@ -225,6 +229,22 @@
 typedef struct xen_add_to_physmap xen_add_to_physmap_t;
 DEFINE_XEN_GUEST_HANDLE(xen_add_to_physmap_t);
 
+/*
+ * Unmaps the page appearing at a particular GPFN from the specified guest's
+ * pseudophysical address space.
+ * arg == addr of xen_remove_from_physmap_t.
+ */
+#define XENMEM_remove_from_physmap      15
+struct xen_remove_from_physmap {
+    /* Which domain to change the mapping for. */
+    domid_t domid;
+
+    /* GPFN of the current mapping of the page. */
+    xen_pfn_t     gpfn;
+};
+typedef struct xen_remove_from_physmap xen_remove_from_physmap_t;
+DEFINE_XEN_GUEST_HANDLE(xen_remove_from_physmap_t);
+
 /*** REMOVED ***/
 /*#define XENMEM_translate_gpfn_list  8*/
 
@@ -290,6 +310,7 @@
  * The call never fails. 
  */
 #define XENMEM_get_sharing_freed_pages    18
+#define XENMEM_get_sharing_shared_pages   19
 
 #endif /* __XEN_PUBLIC_MEMORY_H__ */
 
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/physdev.h
--- a/include/xen/interface/physdev.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/physdev.h	Fri Feb 10 17:11:47 2012 +0100
@@ -49,7 +49,15 @@
  * will automatically get unmasked. The page registered is used as a bit
  * array indexed by Xen's PIRQ value.
  */
-#define PHYSDEVOP_pirq_eoi_gmfn         17
+#define PHYSDEVOP_pirq_eoi_gmfn_v1       17
+/*
+ * Register a shared page for the hypervisor to indicate whether the
+ * guest must issue PHYSDEVOP_eoi. This hypercall is very similar to
+ * PHYSDEVOP_pirq_eoi_gmfn_v1 but it doesn't change the semantics of
+ * PHYSDEVOP_eoi. The page registered is used as a bit array indexed by
+ * Xen's PIRQ value.
+ */
+#define PHYSDEVOP_pirq_eoi_gmfn_v2       28
 struct physdev_pirq_eoi_gmfn {
     /* IN */
     xen_pfn_t gmfn;
@@ -325,6 +333,12 @@
 #define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY XENIRQSTAT_needs_eoi
 #define PHYSDEVOP_IRQ_SHARED             XENIRQSTAT_shared
 
+#if __XEN_INTERFACE_VERSION__ < 0x00040200
+#define PHYSDEVOP_pirq_eoi_gmfn PHYSDEVOP_pirq_eoi_gmfn_v1
+#else
+#define PHYSDEVOP_pirq_eoi_gmfn PHYSDEVOP_pirq_eoi_gmfn_v2
+#endif
+
 #endif /* __XEN_PUBLIC_PHYSDEV_H__ */
 
 /*
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/platform.h
--- a/include/xen/interface/platform.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/platform.h	Fri Feb 10 17:11:47 2012 +0100
@@ -449,6 +449,21 @@
 typedef struct xenpf_pcpuinfo xenpf_pcpuinfo_t;
 DEFINE_XEN_GUEST_HANDLE(xenpf_pcpuinfo_t);
 
+#define XENPF_get_cpu_version 48
+struct xenpf_pcpu_version {
+    /* IN */
+    uint32_t xen_cpuid;
+    /* OUT */
+    /* The maxium cpu_id that is present */
+    uint32_t max_present;
+    char vendor_id[12];
+    uint32_t family;
+    uint32_t model;
+    uint32_t stepping;
+};
+typedef struct xenpf_pcpu_version xenpf_pcpu_version_t;
+DEFINE_XEN_GUEST_HANDLE(xenpf_pcpu_version_t);
+
 #define XENPF_cpu_online    56
 #define XENPF_cpu_offline   57
 struct xenpf_cpu_ol
@@ -492,6 +507,7 @@
         struct xenpf_getidletime       getidletime;
         struct xenpf_set_processor_pminfo set_pminfo;
         struct xenpf_pcpuinfo          pcpu_info;
+        struct xenpf_pcpu_version      pcpu_version;
         struct xenpf_cpu_ol            cpu_ol;
         struct xenpf_cpu_hotadd        cpu_add;
         struct xenpf_mem_hotadd        mem_add;
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/trace.h
--- a/include/xen/interface/trace.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/trace.h	Fri Feb 10 17:11:47 2012 +0100
@@ -164,6 +164,10 @@
 #define TRC_HVM_RDTSC           (TRC_HVM_HANDLER + 0x1a)
 #define TRC_HVM_INTR_WINDOW     (TRC_HVM_HANDLER + 0x20)
 #define TRC_HVM_NPF             (TRC_HVM_HANDLER + 0x21)
+#define TRC_HVM_REALMODE_EMULATE (TRC_HVM_HANDLER + 0x22)
+#define TRC_HVM_TRAP             (TRC_HVM_HANDLER + 0x23)
+#define TRC_HVM_TRAP_DEBUG       (TRC_HVM_HANDLER + 0x24)
+#define TRC_HVM_VLAPIC           (TRC_HVM_HANDLER + 0x25)
 
 #define TRC_HVM_IOPORT_WRITE    (TRC_HVM_HANDLER + 0x216)
 #define TRC_HVM_IOMEM_WRITE     (TRC_HVM_HANDLER + 0x217)
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/xen-compat.h
--- a/include/xen/interface/xen-compat.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/xen-compat.h	Fri Feb 10 17:11:47 2012 +0100
@@ -27,7 +27,7 @@
 #ifndef __XEN_PUBLIC_XEN_COMPAT_H__
 #define __XEN_PUBLIC_XEN_COMPAT_H__
 
-#define __XEN_LATEST_INTERFACE_VERSION__ 0x0003020a
+#define __XEN_LATEST_INTERFACE_VERSION__ 0x00040200
 
 #if defined(__XEN__) || defined(__XEN_TOOLS__)
 /* Xen is built with matching headers and implements the latest interface. */
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/xen.h
--- a/include/xen/interface/xen.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/xen.h	Fri Feb 10 17:11:47 2012 +0100
@@ -33,6 +33,8 @@
 #include "arch-x86/xen.h"
 #elif defined(__ia64__)
 #include "arch-ia64.h"
+#elif defined(__arm__)
+#include "arch-arm.h"
 #else
 #error "Unsupported architecture"
 #endif
@@ -55,6 +57,10 @@
  * HYPERCALLS
  */
 
+/* `incontents 100 hcalls List of hypercalls
+ * ` enum hypercall_num { // __HYPERVISOR_* => HYPERVISOR_*()
+ */
+
 #define __HYPERVISOR_set_trap_table        0
 #define __HYPERVISOR_mmu_update            1
 #define __HYPERVISOR_set_gdt               2
@@ -105,6 +111,8 @@
 #define __HYPERVISOR_arch_6               54
 #define __HYPERVISOR_arch_7               55
 
+/* ` } */
+
 /*
  * HYPERCALL COMPATIBILITY.
  */
@@ -163,8 +171,11 @@
 #define NR_VIRQS       24
 
 /*
- * HYPERVISOR_mmu_update(reqs, count, pdone, foreigndom)
- * 
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_mmu_update(const struct mmu_update reqs[],
+ * `                       unsigned count, unsigned *done_out,
+ * `                       unsigned foreigndom)
+ * `
  * @reqs is an array of mmu_update_t structures ((ptr, val) pairs).
  * @count is the length of the above array.
  * @pdone is an output parameter indicating number of completed operations
@@ -187,6 +198,40 @@
  * FD == DOMID_XEN: Map restricted areas of Xen's heap space.
  * ptr[:2]  -- Machine address of the page-table entry to modify.
  * val      -- Value to write.
+ *
+ * There also certain implicit requirements when using this hypercall. The
+ * pages that make up a pagetable must be mapped read-only in the guest.
+ * This prevents uncontrolled guest updates to the pagetable. Xen strictly
+ * enforces this, and will disallow any pagetable update which will end up
+ * mapping pagetable page RW, and will disallow using any writable page as a
+ * pagetable. In practice it means that when constructing a page table for a
+ * process, thread, etc, we MUST be very dilligient in following these rules:
+ *  1). Start with top-level page (PGD or in Xen language: L4). Fill out
+ *      the entries.
+ *  2). Keep on going, filling out the upper (PUD or L3), and middle (PMD
+ *      or L2).
+ *  3). Start filling out the PTE table (L1) with the PTE entries. Once
+ *  	done, make sure to set each of those entries to RO (so writeable bit
+ *  	is unset). Once that has been completed, set the PMD (L2) for this
+ *  	PTE table as RO.
+ *  4). When completed with all of the PMD (L2) entries, and all of them have
+ *  	been set to RO, make sure to set RO the PUD (L3). Do the same
+ *  	operation on PGD (L4) pagetable entries that have a PUD (L3) entry.
+ *  5). Now before you can use those pages (so setting the cr3), you MUST also
+ *      pin them so that the hypervisor can verify the entries. This is done
+ *      via the HYPERVISOR_mmuext_op(MMUEXT_PIN_L4_TABLE, guest physical frame
+ *      number of the PGD (L4)). And this point the HYPERVISOR_mmuext_op(
+ *      MMUEXT_NEW_BASEPTR, guest physical frame number of the PGD (L4)) can be
+ *      issued.
+ * For 32-bit guests, the L4 is not used (as there is less pagetables), so
+ * instead use L3.
+ * At this point the pagetables can be modified using the MMU_NORMAL_PT_UPDATE
+ * hypercall. Also if so desired the OS can also try to write to the PTE
+ * and be trapped by the hypervisor (as the PTE entry is RO).
+ *
+ * To deallocate the pages, the operations are the reverse of the steps
+ * mentioned above. The argument is MMUEXT_UNPIN_TABLE for all levels and the
+ * pagetable MUST not be in use (meaning that the cr3 is not set to it).
  * 
  * ptr[1:0] == MMU_MACHPHYS_UPDATE:
  * Updates an entry in the machine->pseudo-physical mapping table.
@@ -197,6 +242,72 @@
  * ptr[1:0] == MMU_PT_UPDATE_PRESERVE_AD:
  * As MMU_NORMAL_PT_UPDATE above, but A/D bits currently in the PTE are ORed
  * with those in @val.
+ *
+ * @val is usually the machine frame number along with some attributes.
+ * The attributes by default follow the architecture defined bits. Meaning that
+ * if this is a X86_64 machine and four page table layout is used, the layout
+ * of val is:
+ *  - 63 if set means No execute (NX)
+ *  - 46-13 the machine frame number
+ *  - 12 available for guest
+ *  - 11 available for guest
+ *  - 10 available for guest
+ *  - 9 available for guest
+ *  - 8 global
+ *  - 7 PAT (PSE is disabled, must use hypercall to make 4MB or 2MB pages)
+ *  - 6 dirty
+ *  - 5 accessed
+ *  - 4 page cached disabled
+ *  - 3 page write through
+ *  - 2 userspace accessible
+ *  - 1 writeable
+ *  - 0 present
+ *
+ *  The one bits that does not fit with the default layout is the PAGE_PSE
+ *  also called PAGE_PAT). The MMUEXT_[UN]MARK_SUPER arguments to the
+ *  HYPERVISOR_mmuext_op serve as mechanism to set a pagetable to be 4MB
+ *  (or 2MB) instead of using the PAGE_PSE bit.
+ *
+ *  The reason that the PAGE_PSE (bit 7) is not being utilized is due to Xen
+ *  using it as the Page Attribute Table (PAT) bit - for details on it please
+ *  refer to Intel SDM 10.12. The PAT allows to set the caching attributes of
+ *  pages instead of using MTRRs.
+ *
+ *  The PAT MSR is as follow (it is a 64-bit value, each entry is 8 bits):
+ *             PAT4                 PAT0
+ *   +---+----+----+----+-----+----+----+
+ *    WC | WC | WB | UC | UC- | WC | WB |  <= Linux
+ *   +---+----+----+----+-----+----+----+
+ *    WC | WT | WB | UC | UC- | WT | WB |  <= BIOS (default when machine boots)
+ *   +---+----+----+----+-----+----+----+
+ *    WC | WP | WC | UC | UC- | WT | WB |  <= Xen
+ *   +---+----+----+----+-----+----+----+
+ *
+ *  The lookup of this index table translates to looking up
+ *  Bit 7, Bit 4, and Bit 3 of val entry:
+ *
+ *  PAT/PSE (bit 7) ... PCD (bit 4) .. PWT (bit 3).
+ *
+ *  If all bits are off, then we are using PAT0. If bit 3 turned on,
+ *  then we are using PAT1, if bit 3 and bit 4, then PAT2..
+ *
+ *  As you can see, the Linux PAT1 translates to PAT4 under Xen. Which means
+ *  that if a guest that follows Linux's PAT setup and would like to set Write
+ *  Combined on pages it MUST use PAT4 entry. Meaning that Bit 7 (PAGE_PAT) is
+ *  set. For example, under Linux it only uses PAT0, PAT1, and PAT2 for the
+ *  caching as:
+ *
+ *   WB = none (so PAT0)
+ *   WC = PWT (bit 3 on)
+ *   UC = PWT | PCD (bit 3 and 4 are on).
+ *
+ * To make it work with Xen, it needs to translate the WC bit as so:
+ *
+ *  PWT (so bit 3 on) --> PAT (so bit 7 is on) and clear bit 3
+ *
+ * And to translate back it would:
+ *
+ * PAT (bit 7 on) --> PWT (bit 3 on) and clear bit 7.
  */
 #define MMU_NORMAL_PT_UPDATE      0 /* checked '*ptr = val'. ptr is MA.      */
 #define MMU_MACHPHYS_UPDATE       1 /* ptr = MA of frame to modify entry for */
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/xenoprof.h
--- a/include/xen/interface/xenoprof.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/xenoprof.h	Fri Feb 10 17:11:47 2012 +0100
@@ -68,7 +68,7 @@
 };
 
 /* PC value that indicates a special code */
-#define XENOPROF_ESCAPE_CODE ~0UL
+#define XENOPROF_ESCAPE_CODE (~0ULL)
 /* Transient events for the xenoprof->oprofile cpu buf */
 #define XENOPROF_TRACE_BEGIN 1
 
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/xsm/flask_op.h
--- a/include/xen/interface/xsm/flask_op.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/xsm/flask_op.h	Fri Feb 10 17:11:47 2012 +0100
@@ -25,6 +25,118 @@
 #ifndef __FLASK_OP_H__
 #define __FLASK_OP_H__
 
+#define XEN_FLASK_INTERFACE_VERSION 1
+
+struct xen_flask_load {
+    XEN_GUEST_HANDLE(char) buffer;
+    uint32_t size;
+};
+
+struct xen_flask_setenforce {
+    uint32_t enforcing;
+};
+
+struct xen_flask_sid_context {
+    /* IN/OUT: sid to convert to/from string */
+    uint32_t sid;
+    /* IN: size of the context buffer
+     * OUT: actual size of the output context string
+     */
+    uint32_t size;
+    XEN_GUEST_HANDLE(char) context;
+};
+
+struct xen_flask_access {
+    /* IN: access request */
+    uint32_t ssid;
+    uint32_t tsid;
+    uint32_t tclass;
+    uint32_t req;
+    /* OUT: AVC data */
+    uint32_t allowed;
+    uint32_t audit_allow;
+    uint32_t audit_deny;
+    uint32_t seqno;
+};
+
+struct xen_flask_transition {
+    /* IN: transition SIDs and class */
+    uint32_t ssid;
+    uint32_t tsid;
+    uint32_t tclass;
+    /* OUT: new SID */
+    uint32_t newsid;
+};
+
+struct xen_flask_userlist {
+    /* IN: starting SID for list */
+    uint32_t start_sid;
+    /* IN: size of user string and output buffer
+     * OUT: number of SIDs returned */
+    uint32_t size;
+    union {
+        /* IN: user to enumerate SIDs */
+        XEN_GUEST_HANDLE(char) user;
+        /* OUT: SID list */
+        XEN_GUEST_HANDLE(uint32) sids;
+    } u;
+};
+
+struct xen_flask_boolean {
+    /* IN/OUT: numeric identifier for boolean [GET/SET]
+     * If -1, name will be used and bool_id will be filled in. */
+    uint32_t bool_id;
+    /* OUT: current enforcing value of boolean [GET/SET] */
+    uint8_t enforcing;
+    /* OUT: pending value of boolean [GET/SET] */
+    uint8_t pending;
+    /* IN: new value of boolean [SET] */
+    uint8_t new_value;
+    /* IN: commit new value instead of only setting pending [SET] */
+    uint8_t commit;
+    /* IN: size of boolean name buffer [GET/SET]
+     * OUT: actual size of name [GET only] */
+    uint32_t size;
+    /* IN: if bool_id is -1, used to find boolean [GET/SET]
+     * OUT: textual name of boolean [GET only]
+     */
+    XEN_GUEST_HANDLE(char) name;
+};
+
+struct xen_flask_setavc_threshold {
+    /* IN */
+    uint32_t threshold;
+};
+
+struct xen_flask_hash_stats {
+    /* OUT */
+    uint32_t entries;
+    uint32_t buckets_used;
+    uint32_t buckets_total;
+    uint32_t max_chain_len;
+};
+
+struct xen_flask_cache_stats {
+    /* IN */
+    uint32_t cpu;
+    /* OUT */
+    uint32_t lookups;
+    uint32_t hits;
+    uint32_t misses;
+    uint32_t allocations;
+    uint32_t reclaims;
+    uint32_t frees;
+};
+
+struct xen_flask_ocontext {
+    /* IN */
+    uint32_t ocon;
+    uint32_t sid;
+    uint64_t low, high;
+};
+
+struct xen_flask_op {
+    uint32_t cmd;
 #define FLASK_LOAD              1
 #define FLASK_GETENFORCE        2
 #define FLASK_SETENFORCE        3
@@ -47,15 +159,26 @@
 #define FLASK_MEMBER            20
 #define FLASK_ADD_OCONTEXT      21
 #define FLASK_DEL_OCONTEXT      22
-
-#define FLASK_LAST              FLASK_DEL_OCONTEXT
-
-typedef struct flask_op {
-    uint32_t  cmd;
-    uint32_t  size;
-    char      *buf;
-} flask_op_t;
-
-DEFINE_XEN_GUEST_HANDLE(flask_op_t);
+    uint32_t interface_version; /* XEN_FLASK_INTERFACE_VERSION */
+    union {
+        struct xen_flask_load load;
+        struct xen_flask_setenforce enforce;
+        /* FLASK_CONTEXT_TO_SID and FLASK_SID_TO_CONTEXT */
+        struct xen_flask_sid_context sid_context;
+        struct xen_flask_access access;
+        /* FLASK_CREATE, FLASK_RELABEL, FLASK_MEMBER */
+        struct xen_flask_transition transition;
+        struct xen_flask_userlist userlist;
+        /* FLASK_GETBOOL, FLASK_SETBOOL */
+        struct xen_flask_boolean boolean;
+        struct xen_flask_setavc_threshold setavc_threshold;
+        struct xen_flask_hash_stats hash_stats;
+        struct xen_flask_cache_stats cache_stats;
+        /* FLASK_ADD_OCONTEXT, FLASK_DEL_OCONTEXT */
+        struct xen_flask_ocontext ocontext;
+    } u;
+};
+typedef struct xen_flask_op xen_flask_op_t;
+DEFINE_XEN_GUEST_HANDLE(xen_flask_op_t);
 
 #endif

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 10 16:55:19 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2012 16:55:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rvtkh-0003np-EW; Fri, 10 Feb 2012 16:55:15 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvtkf-0003mO-KS
	for xen-changelog@lists.xensource.com; Fri, 10 Feb 2012 16:55:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-27.messagelabs.com!1328892876!59359340!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14536 invoked from network); 10 Feb 2012 16:54:37 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	10 Feb 2012 16:54:37 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvtkY-0006Dy-FB
	for xen-changelog@lists.xensource.com; Fri, 10 Feb 2012 16:55:06 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvtkX-0007bl-SS
	for xen-changelog@lists.xensource.com; Fri, 10 Feb 2012 16:55:05 +0000
Message-Id: <E1RvtkX-0007bl-SS@xenbits.xen.org>
Date: Fri, 10 Feb 2012 16:55:05 +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] Update Xen public headers
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328890307 -3600
# Node ID 7c89207af621ff8293f9b64c046eb70a8f85ef75
# Parent  ddb83aec5afc6f7980aaae2497a5b171c1549eff
Update Xen public headers

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


diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/arch-arm.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/xen/interface/arch-arm.h	Fri Feb 10 17:11:47 2012 +0100
@@ -0,0 +1,125 @@
+/******************************************************************************
+ * arch-arm.h
+ *
+ * Guest OS interface to ARM Xen.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright 2011 (C) Citrix Systems
+ */
+
+#ifndef __XEN_PUBLIC_ARCH_ARM_H__
+#define __XEN_PUBLIC_ARCH_ARM_H__
+
+#ifndef __ASSEMBLY__
+#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
+    typedef struct { type *p; } __guest_handle_ ## name
+
+#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
+    ___DEFINE_XEN_GUEST_HANDLE(name, type);   \
+    ___DEFINE_XEN_GUEST_HANDLE(const_##name, const type)
+#define DEFINE_XEN_GUEST_HANDLE(name)   __DEFINE_XEN_GUEST_HANDLE(name, name)
+#define __XEN_GUEST_HANDLE(name)        __guest_handle_ ## name
+#define XEN_GUEST_HANDLE(name)          __XEN_GUEST_HANDLE(name)
+#define set_xen_guest_handle_raw(hnd, val)  do { (hnd).p = val; } while (0)
+#ifdef __XEN_TOOLS__
+#define get_xen_guest_handle(val, hnd)  do { val = (hnd).p; } while (0)
+#endif
+#define set_xen_guest_handle(hnd, val) set_xen_guest_handle_raw(hnd, val)
+
+struct cpu_user_regs
+{
+    uint32_t r0;
+    uint32_t r1;
+    uint32_t r2;
+    uint32_t r3;
+    uint32_t r4;
+    uint32_t r5;
+    uint32_t r6;
+    uint32_t r7;
+    uint32_t r8;
+    uint32_t r9;
+    uint32_t r10;
+    union {
+        uint32_t r11;
+        uint32_t fp;
+    };
+    uint32_t r12;
+
+    uint32_t sp; /* r13 - SP: Valid for Hyp. frames only, o/w banked (see below) */
+    uint32_t lr; /* r14 - LR: Valid for Hyp. Same physical register as lr_usr. */
+
+    uint32_t pc; /* Return IP */
+    uint32_t cpsr; /* Return mode */
+    uint32_t pad0; /* Doubleword-align the kernel half of the frame */
+
+    /* Outer guest frame only from here on... */
+
+    uint32_t r8_fiq, r9_fiq, r10_fiq, r11_fiq, r12_fiq;
+
+    uint32_t sp_usr, sp_svc, sp_abt, sp_und, sp_irq, sp_fiq;
+    uint32_t lr_usr, lr_svc, lr_abt, lr_und, lr_irq, lr_fiq;
+
+    uint32_t spsr_svc, spsr_abt, spsr_und, spsr_irq, spsr_fiq;
+};
+typedef struct cpu_user_regs cpu_user_regs_t;
+DEFINE_XEN_GUEST_HANDLE(cpu_user_regs_t);
+
+typedef uint64_t xen_pfn_t;
+#define PRI_xen_pfn PRIx64
+
+/* Maximum number of virtual CPUs in legacy multi-processor guests. */
+/* Only one. All other VCPUS must use VCPUOP_register_vcpu_info */
+#define XEN_LEGACY_MAX_VCPUS 1
+
+typedef uint32_t xen_ulong_t;
+
+struct vcpu_guest_context {
+    struct cpu_user_regs user_regs;         /* User-level CPU registers     */
+    union {
+        uint32_t reg[16];
+        struct {
+            uint32_t __pad[12];
+            uint32_t sp; /* r13 */
+            uint32_t lr; /* r14 */
+            uint32_t pc; /* r15 */
+        };
+    };
+};
+typedef struct vcpu_guest_context vcpu_guest_context_t;
+DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
+
+struct arch_vcpu_info { };
+typedef struct arch_vcpu_info arch_vcpu_info_t;
+
+struct arch_shared_info { };
+typedef struct arch_shared_info arch_shared_info_t;
+#endif
+
+#endif /*  __XEN_PUBLIC_ARCH_ARM_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/arch-x86/hvm/save.h
--- a/include/xen/interface/arch-x86/hvm/save.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/arch-x86/hvm/save.h	Fri Feb 10 17:11:47 2012 +0100
@@ -344,12 +344,7 @@
  * IO-APIC
  */
 
-#ifdef __ia64__
-#define VIOAPIC_IS_IOSAPIC 1
-#define VIOAPIC_NUM_PINS  24
-#else
 #define VIOAPIC_NUM_PINS  48 /* 16 ISA IRQs, 32 non-legacy PCI IRQS. */
-#endif
 
 struct hvm_hw_vioapic {
     uint64_t base_address;
@@ -368,13 +363,8 @@
             uint8_t trig_mode:1;
             uint8_t mask:1;
             uint8_t reserve:7;
-#if !VIOAPIC_IS_IOSAPIC
             uint8_t reserved[4];
             uint8_t dest_id;
-#else
-            uint8_t reserved[3];
-            uint16_t dest_id;
-#endif
         } fields;
     } redirtbl[VIOAPIC_NUM_PINS];
 };
@@ -564,7 +554,7 @@
 
         struct { char x[0]; } ymm;    /* YMM */
     } save_area;
-} __attribute__((packed));
+};
 
 #define CPU_XSAVE_CODE  16
 
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/arch-x86/xen.h
--- a/include/xen/interface/arch-x86/xen.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/arch-x86/xen.h	Fri Feb 10 17:11:47 2012 +0100
@@ -82,7 +82,13 @@
 typedef unsigned long xen_ulong_t;
 
 /*
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_set_trap_table(const struct trap_info traps[]);
+ * `
+ */
+/*
  * Send an array of these to HYPERVISOR_set_trap_table().
+ * Terminate the array with a sentinel entry, with traps[].address==0.
  * The privilege level specifies which modes may enter a trap via a software
  * interrupt. On x86/64, since rings 1 and 2 are unavailable, we allocate
  * privilege levels as follows:
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/domctl.h
--- a/include/xen/interface/domctl.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/domctl.h	Fri Feb 10 17:11:47 2012 +0100
@@ -742,8 +742,12 @@
     uint32_t       op;           /* XEN_DOMCTL_MEM_EVENT_OP_*_* */
     uint32_t       mode;         /* XEN_DOMCTL_MEM_EVENT_OP_* */
 
-    /* OP_ENABLE */
-    uint64_aligned_t shared_addr;  /* IN:  Virtual address of shared page */
+    union {
+        /* OP_ENABLE IN:  Virtual address of shared page */
+        uint64_aligned_t shared_addr;  
+        /* PAGING_PREP IN: buffer to immediately fill page in */
+        uint64_aligned_t buffer;
+    } u;
     uint64_aligned_t ring_addr;    /* IN:  Virtual address of ring page */
 
     /* Other OPs */
@@ -767,10 +771,24 @@
 #define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GFN      5
 #define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_MFN      6
 #define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GREF     7
+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_ADD_PHYSMAP    8
 
 #define XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID  (-10)
 #define XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID  (-9)
 
+/* The following allows sharing of grant refs. This is useful
+ * for sharing utilities sitting as "filters" in IO backends
+ * (e.g. memshr + blktap(2)). The IO backend is only exposed 
+ * to grant references, and this allows sharing of the grefs */
+#define XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF_FLAG   (1ULL << 62)
+
+#define XEN_DOMCTL_MEM_SHARING_FIELD_MAKE_GREF(field, val)  \
+    (field) = (XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF_FLAG | val)
+#define XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF(field)         \
+    ((field) & XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF_FLAG)
+#define XEN_DOMCTL_MEM_SHARING_FIELD_GET_GREF(field)        \
+    ((field) & (~XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF_FLAG))
+
 struct xen_domctl_mem_sharing_op {
     uint8_t op; /* XEN_DOMCTL_MEM_EVENT_OP_* */
 
@@ -784,8 +802,11 @@
             } u;
             uint64_aligned_t  handle;     /* OUT: the handle           */
         } nominate;
-        struct mem_sharing_op_share {     /* OP_SHARE */
+        struct mem_sharing_op_share {     /* OP_SHARE/ADD_PHYSMAP */
+            uint64_aligned_t source_gfn;    /* IN: the gfn of the source page */
             uint64_aligned_t source_handle; /* IN: handle to the source page */
+            domid_t          client_domain; /* IN: the client domain id */
+            uint64_aligned_t client_gfn;    /* IN: the client gfn */
             uint64_aligned_t client_handle; /* IN: handle to the client page */
         } share; 
         struct mem_sharing_op_debug {     /* OP_DEBUG_xxx */
@@ -800,6 +821,21 @@
 typedef struct xen_domctl_mem_sharing_op xen_domctl_mem_sharing_op_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_mem_sharing_op_t);
 
+struct xen_domctl_audit_p2m {
+    /* OUT error counts */
+    uint64_t orphans;
+    uint64_t m2p_bad;
+    uint64_t p2m_bad;
+};
+typedef struct xen_domctl_audit_p2m xen_domctl_audit_p2m_t;
+DEFINE_XEN_GUEST_HANDLE(xen_domctl_audit_p2m_t);
+
+struct xen_domctl_set_virq_handler {
+    uint32_t virq; /* IN */
+};
+typedef struct xen_domctl_set_virq_handler xen_domctl_set_virq_handler_t;
+DEFINE_XEN_GUEST_HANDLE(xen_domctl_set_virq_handler_t);
+
 #if defined(__i386__) || defined(__x86_64__)
 /* XEN_DOMCTL_setvcpuextstate */
 /* XEN_DOMCTL_getvcpuextstate */
@@ -898,6 +934,8 @@
 #define XEN_DOMCTL_setvcpuextstate               62
 #define XEN_DOMCTL_getvcpuextstate               63
 #define XEN_DOMCTL_set_access_required           64
+#define XEN_DOMCTL_audit_p2m                     65
+#define XEN_DOMCTL_set_virq_handler              66
 #define XEN_DOMCTL_gdbsx_guestmemio            1000
 #define XEN_DOMCTL_gdbsx_pausevcpu             1001
 #define XEN_DOMCTL_gdbsx_unpausevcpu           1002
@@ -951,6 +989,8 @@
         struct xen_domctl_vcpuextstate      vcpuextstate;
 #endif
         struct xen_domctl_set_access_required access_required;
+        struct xen_domctl_audit_p2m         audit_p2m;
+        struct xen_domctl_set_virq_handler  set_virq_handler;
         struct xen_domctl_gdbsx_memio       gdbsx_guest_memio;
         struct xen_domctl_gdbsx_pauseunp_vcpu gdbsx_pauseunp_vcpu;
         struct xen_domctl_gdbsx_domstatus   gdbsx_domstatus;
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/grant_table.h
--- a/include/xen/interface/grant_table.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/grant_table.h	Fri Feb 10 17:11:47 2012 +0100
@@ -117,6 +117,13 @@
 };
 typedef struct grant_entry_v1 grant_entry_v1_t;
 
+/* The first few grant table entries will be preserved across grant table
+ * version changes and may be pre-populated at domain creation by tools.
+ */
+#define GNTTAB_NR_RESERVED_ENTRIES     8
+#define GNTTAB_RESERVED_CONSOLE        0
+#define GNTTAB_RESERVED_XENSTORE       1
+
 /*
  * Type of grant entry.
  *  GTF_invalid: This grant entry grants no privileges.
@@ -511,6 +518,20 @@
 typedef struct gnttab_get_version gnttab_get_version_t;
 DEFINE_XEN_GUEST_HANDLE(gnttab_get_version_t);
 
+/* 
+ * GNTTABOP_swap_grant_ref: Swap the contents of two grant entries.
+ */
+#define GNTTABOP_swap_grant_ref	      11
+struct gnttab_swap_grant_ref {
+    /* IN parameters */
+    grant_ref_t ref_a;
+    grant_ref_t ref_b;
+    /* OUT parameters */
+    int16_t status;             /* GNTST_* */
+};
+typedef struct gnttab_swap_grant_ref gnttab_swap_grant_ref_t;
+DEFINE_XEN_GUEST_HANDLE(gnttab_swap_grant_ref_t);
+
 #endif /* __XEN_INTERFACE_VERSION__ */
 
 /*
@@ -566,7 +587,7 @@
 #define GNTST_bad_page         (-9) /* Specified page was invalid for op.    */
 #define GNTST_bad_copy_arg    (-10) /* copy arguments cross page boundary.   */
 #define GNTST_address_too_big (-11) /* transfer page address too large.      */
-#define GNTST_eagain          (-12) /* Could not map at the moment. Retry.   */
+#define GNTST_eagain          (-12) /* Operation not done; try again.        */
 
 #define GNTTABOP_error_msgs {                   \
     "okay",                                     \
@@ -581,7 +602,7 @@
     "bad page",                                 \
     "copy arguments cross page boundary",       \
     "page address size too large",              \
-    "could not map at the moment, retry"        \
+    "operation not done; try again"             \
 }
 
 #endif /* __XEN_PUBLIC_GRANT_TABLE_H__ */
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/hvm/hvm_info_table.h
--- a/include/xen/interface/hvm/hvm_info_table.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/hvm/hvm_info_table.h	Fri Feb 10 17:11:47 2012 +0100
@@ -37,9 +37,6 @@
     uint32_t    length;
     uint8_t     checksum;
 
-    /* Should firmware build ACPI tables? */
-    uint8_t     acpi_enabled;
-
     /* Should firmware build APIC descriptors (APIC MADT / MP BIOS)? */
     uint8_t     apic_mode;
 
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/hvm/hvm_op.h
--- a/include/xen/interface/hvm/hvm_op.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/hvm/hvm_op.h	Fri Feb 10 17:11:47 2012 +0100
@@ -174,6 +174,9 @@
     HVMMEM_access_rwx,
     HVMMEM_access_rx2rw,       /* Page starts off as r-x, but automatically
                                 * change to r-w on a write */
+    HVMMEM_access_n2rwx,       /* Log access: starts off as n, automatically 
+                                * goes to rwx, generating an event without
+                                * pausing the vcpu */
     HVMMEM_access_default      /* Take the domain default */
 } hvmmem_access_t;
 /* Notify that a region of memory is to have specific access types */
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/hvm/params.h
--- a/include/xen/interface/hvm/params.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/hvm/params.h	Fri Feb 10 17:11:47 2012 +0100
@@ -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__ */
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/mem_event.h
--- a/include/xen/interface/mem_event.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/mem_event.h	Fri Feb 10 17:11:47 2012 +0100
@@ -39,6 +39,8 @@
 #define MEM_EVENT_FLAG_VCPU_PAUSED  (1 << 0)
 #define MEM_EVENT_FLAG_DROP_PAGE    (1 << 1)
 #define MEM_EVENT_FLAG_EVICT_FAIL   (1 << 2)
+#define MEM_EVENT_FLAG_FOREIGN      (1 << 3)
+#define MEM_EVENT_FLAG_DUMMY        (1 << 4)
 
 /* Reasons for the memory event request */
 #define MEM_EVENT_REASON_UNKNOWN     0    /* typical reason */
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/memory.h
--- a/include/xen/interface/memory.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/memory.h	Fri Feb 10 17:11:47 2012 +0100
@@ -208,10 +208,14 @@
     /* Which domain to change the mapping for. */
     domid_t domid;
 
+    /* Number of pages to go through for gmfn_range */
+    uint16_t    size;
+
     /* Source mapping space. */
 #define XENMAPSPACE_shared_info 0 /* shared info page */
 #define XENMAPSPACE_grant_table 1 /* grant table page */
 #define XENMAPSPACE_gmfn        2 /* GMFN */
+#define XENMAPSPACE_gmfn_range  3 /* GMFN range */
     unsigned int space;
 
 #define XENMAPIDX_grant_table_status 0x80000000
@@ -225,6 +229,22 @@
 typedef struct xen_add_to_physmap xen_add_to_physmap_t;
 DEFINE_XEN_GUEST_HANDLE(xen_add_to_physmap_t);
 
+/*
+ * Unmaps the page appearing at a particular GPFN from the specified guest's
+ * pseudophysical address space.
+ * arg == addr of xen_remove_from_physmap_t.
+ */
+#define XENMEM_remove_from_physmap      15
+struct xen_remove_from_physmap {
+    /* Which domain to change the mapping for. */
+    domid_t domid;
+
+    /* GPFN of the current mapping of the page. */
+    xen_pfn_t     gpfn;
+};
+typedef struct xen_remove_from_physmap xen_remove_from_physmap_t;
+DEFINE_XEN_GUEST_HANDLE(xen_remove_from_physmap_t);
+
 /*** REMOVED ***/
 /*#define XENMEM_translate_gpfn_list  8*/
 
@@ -290,6 +310,7 @@
  * The call never fails. 
  */
 #define XENMEM_get_sharing_freed_pages    18
+#define XENMEM_get_sharing_shared_pages   19
 
 #endif /* __XEN_PUBLIC_MEMORY_H__ */
 
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/physdev.h
--- a/include/xen/interface/physdev.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/physdev.h	Fri Feb 10 17:11:47 2012 +0100
@@ -49,7 +49,15 @@
  * will automatically get unmasked. The page registered is used as a bit
  * array indexed by Xen's PIRQ value.
  */
-#define PHYSDEVOP_pirq_eoi_gmfn         17
+#define PHYSDEVOP_pirq_eoi_gmfn_v1       17
+/*
+ * Register a shared page for the hypervisor to indicate whether the
+ * guest must issue PHYSDEVOP_eoi. This hypercall is very similar to
+ * PHYSDEVOP_pirq_eoi_gmfn_v1 but it doesn't change the semantics of
+ * PHYSDEVOP_eoi. The page registered is used as a bit array indexed by
+ * Xen's PIRQ value.
+ */
+#define PHYSDEVOP_pirq_eoi_gmfn_v2       28
 struct physdev_pirq_eoi_gmfn {
     /* IN */
     xen_pfn_t gmfn;
@@ -325,6 +333,12 @@
 #define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY XENIRQSTAT_needs_eoi
 #define PHYSDEVOP_IRQ_SHARED             XENIRQSTAT_shared
 
+#if __XEN_INTERFACE_VERSION__ < 0x00040200
+#define PHYSDEVOP_pirq_eoi_gmfn PHYSDEVOP_pirq_eoi_gmfn_v1
+#else
+#define PHYSDEVOP_pirq_eoi_gmfn PHYSDEVOP_pirq_eoi_gmfn_v2
+#endif
+
 #endif /* __XEN_PUBLIC_PHYSDEV_H__ */
 
 /*
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/platform.h
--- a/include/xen/interface/platform.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/platform.h	Fri Feb 10 17:11:47 2012 +0100
@@ -449,6 +449,21 @@
 typedef struct xenpf_pcpuinfo xenpf_pcpuinfo_t;
 DEFINE_XEN_GUEST_HANDLE(xenpf_pcpuinfo_t);
 
+#define XENPF_get_cpu_version 48
+struct xenpf_pcpu_version {
+    /* IN */
+    uint32_t xen_cpuid;
+    /* OUT */
+    /* The maxium cpu_id that is present */
+    uint32_t max_present;
+    char vendor_id[12];
+    uint32_t family;
+    uint32_t model;
+    uint32_t stepping;
+};
+typedef struct xenpf_pcpu_version xenpf_pcpu_version_t;
+DEFINE_XEN_GUEST_HANDLE(xenpf_pcpu_version_t);
+
 #define XENPF_cpu_online    56
 #define XENPF_cpu_offline   57
 struct xenpf_cpu_ol
@@ -492,6 +507,7 @@
         struct xenpf_getidletime       getidletime;
         struct xenpf_set_processor_pminfo set_pminfo;
         struct xenpf_pcpuinfo          pcpu_info;
+        struct xenpf_pcpu_version      pcpu_version;
         struct xenpf_cpu_ol            cpu_ol;
         struct xenpf_cpu_hotadd        cpu_add;
         struct xenpf_mem_hotadd        mem_add;
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/trace.h
--- a/include/xen/interface/trace.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/trace.h	Fri Feb 10 17:11:47 2012 +0100
@@ -164,6 +164,10 @@
 #define TRC_HVM_RDTSC           (TRC_HVM_HANDLER + 0x1a)
 #define TRC_HVM_INTR_WINDOW     (TRC_HVM_HANDLER + 0x20)
 #define TRC_HVM_NPF             (TRC_HVM_HANDLER + 0x21)
+#define TRC_HVM_REALMODE_EMULATE (TRC_HVM_HANDLER + 0x22)
+#define TRC_HVM_TRAP             (TRC_HVM_HANDLER + 0x23)
+#define TRC_HVM_TRAP_DEBUG       (TRC_HVM_HANDLER + 0x24)
+#define TRC_HVM_VLAPIC           (TRC_HVM_HANDLER + 0x25)
 
 #define TRC_HVM_IOPORT_WRITE    (TRC_HVM_HANDLER + 0x216)
 #define TRC_HVM_IOMEM_WRITE     (TRC_HVM_HANDLER + 0x217)
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/xen-compat.h
--- a/include/xen/interface/xen-compat.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/xen-compat.h	Fri Feb 10 17:11:47 2012 +0100
@@ -27,7 +27,7 @@
 #ifndef __XEN_PUBLIC_XEN_COMPAT_H__
 #define __XEN_PUBLIC_XEN_COMPAT_H__
 
-#define __XEN_LATEST_INTERFACE_VERSION__ 0x0003020a
+#define __XEN_LATEST_INTERFACE_VERSION__ 0x00040200
 
 #if defined(__XEN__) || defined(__XEN_TOOLS__)
 /* Xen is built with matching headers and implements the latest interface. */
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/xen.h
--- a/include/xen/interface/xen.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/xen.h	Fri Feb 10 17:11:47 2012 +0100
@@ -33,6 +33,8 @@
 #include "arch-x86/xen.h"
 #elif defined(__ia64__)
 #include "arch-ia64.h"
+#elif defined(__arm__)
+#include "arch-arm.h"
 #else
 #error "Unsupported architecture"
 #endif
@@ -55,6 +57,10 @@
  * HYPERCALLS
  */
 
+/* `incontents 100 hcalls List of hypercalls
+ * ` enum hypercall_num { // __HYPERVISOR_* => HYPERVISOR_*()
+ */
+
 #define __HYPERVISOR_set_trap_table        0
 #define __HYPERVISOR_mmu_update            1
 #define __HYPERVISOR_set_gdt               2
@@ -105,6 +111,8 @@
 #define __HYPERVISOR_arch_6               54
 #define __HYPERVISOR_arch_7               55
 
+/* ` } */
+
 /*
  * HYPERCALL COMPATIBILITY.
  */
@@ -163,8 +171,11 @@
 #define NR_VIRQS       24
 
 /*
- * HYPERVISOR_mmu_update(reqs, count, pdone, foreigndom)
- * 
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_mmu_update(const struct mmu_update reqs[],
+ * `                       unsigned count, unsigned *done_out,
+ * `                       unsigned foreigndom)
+ * `
  * @reqs is an array of mmu_update_t structures ((ptr, val) pairs).
  * @count is the length of the above array.
  * @pdone is an output parameter indicating number of completed operations
@@ -187,6 +198,40 @@
  * FD == DOMID_XEN: Map restricted areas of Xen's heap space.
  * ptr[:2]  -- Machine address of the page-table entry to modify.
  * val      -- Value to write.
+ *
+ * There also certain implicit requirements when using this hypercall. The
+ * pages that make up a pagetable must be mapped read-only in the guest.
+ * This prevents uncontrolled guest updates to the pagetable. Xen strictly
+ * enforces this, and will disallow any pagetable update which will end up
+ * mapping pagetable page RW, and will disallow using any writable page as a
+ * pagetable. In practice it means that when constructing a page table for a
+ * process, thread, etc, we MUST be very dilligient in following these rules:
+ *  1). Start with top-level page (PGD or in Xen language: L4). Fill out
+ *      the entries.
+ *  2). Keep on going, filling out the upper (PUD or L3), and middle (PMD
+ *      or L2).
+ *  3). Start filling out the PTE table (L1) with the PTE entries. Once
+ *  	done, make sure to set each of those entries to RO (so writeable bit
+ *  	is unset). Once that has been completed, set the PMD (L2) for this
+ *  	PTE table as RO.
+ *  4). When completed with all of the PMD (L2) entries, and all of them have
+ *  	been set to RO, make sure to set RO the PUD (L3). Do the same
+ *  	operation on PGD (L4) pagetable entries that have a PUD (L3) entry.
+ *  5). Now before you can use those pages (so setting the cr3), you MUST also
+ *      pin them so that the hypervisor can verify the entries. This is done
+ *      via the HYPERVISOR_mmuext_op(MMUEXT_PIN_L4_TABLE, guest physical frame
+ *      number of the PGD (L4)). And this point the HYPERVISOR_mmuext_op(
+ *      MMUEXT_NEW_BASEPTR, guest physical frame number of the PGD (L4)) can be
+ *      issued.
+ * For 32-bit guests, the L4 is not used (as there is less pagetables), so
+ * instead use L3.
+ * At this point the pagetables can be modified using the MMU_NORMAL_PT_UPDATE
+ * hypercall. Also if so desired the OS can also try to write to the PTE
+ * and be trapped by the hypervisor (as the PTE entry is RO).
+ *
+ * To deallocate the pages, the operations are the reverse of the steps
+ * mentioned above. The argument is MMUEXT_UNPIN_TABLE for all levels and the
+ * pagetable MUST not be in use (meaning that the cr3 is not set to it).
  * 
  * ptr[1:0] == MMU_MACHPHYS_UPDATE:
  * Updates an entry in the machine->pseudo-physical mapping table.
@@ -197,6 +242,72 @@
  * ptr[1:0] == MMU_PT_UPDATE_PRESERVE_AD:
  * As MMU_NORMAL_PT_UPDATE above, but A/D bits currently in the PTE are ORed
  * with those in @val.
+ *
+ * @val is usually the machine frame number along with some attributes.
+ * The attributes by default follow the architecture defined bits. Meaning that
+ * if this is a X86_64 machine and four page table layout is used, the layout
+ * of val is:
+ *  - 63 if set means No execute (NX)
+ *  - 46-13 the machine frame number
+ *  - 12 available for guest
+ *  - 11 available for guest
+ *  - 10 available for guest
+ *  - 9 available for guest
+ *  - 8 global
+ *  - 7 PAT (PSE is disabled, must use hypercall to make 4MB or 2MB pages)
+ *  - 6 dirty
+ *  - 5 accessed
+ *  - 4 page cached disabled
+ *  - 3 page write through
+ *  - 2 userspace accessible
+ *  - 1 writeable
+ *  - 0 present
+ *
+ *  The one bits that does not fit with the default layout is the PAGE_PSE
+ *  also called PAGE_PAT). The MMUEXT_[UN]MARK_SUPER arguments to the
+ *  HYPERVISOR_mmuext_op serve as mechanism to set a pagetable to be 4MB
+ *  (or 2MB) instead of using the PAGE_PSE bit.
+ *
+ *  The reason that the PAGE_PSE (bit 7) is not being utilized is due to Xen
+ *  using it as the Page Attribute Table (PAT) bit - for details on it please
+ *  refer to Intel SDM 10.12. The PAT allows to set the caching attributes of
+ *  pages instead of using MTRRs.
+ *
+ *  The PAT MSR is as follow (it is a 64-bit value, each entry is 8 bits):
+ *             PAT4                 PAT0
+ *   +---+----+----+----+-----+----+----+
+ *    WC | WC | WB | UC | UC- | WC | WB |  <= Linux
+ *   +---+----+----+----+-----+----+----+
+ *    WC | WT | WB | UC | UC- | WT | WB |  <= BIOS (default when machine boots)
+ *   +---+----+----+----+-----+----+----+
+ *    WC | WP | WC | UC | UC- | WT | WB |  <= Xen
+ *   +---+----+----+----+-----+----+----+
+ *
+ *  The lookup of this index table translates to looking up
+ *  Bit 7, Bit 4, and Bit 3 of val entry:
+ *
+ *  PAT/PSE (bit 7) ... PCD (bit 4) .. PWT (bit 3).
+ *
+ *  If all bits are off, then we are using PAT0. If bit 3 turned on,
+ *  then we are using PAT1, if bit 3 and bit 4, then PAT2..
+ *
+ *  As you can see, the Linux PAT1 translates to PAT4 under Xen. Which means
+ *  that if a guest that follows Linux's PAT setup and would like to set Write
+ *  Combined on pages it MUST use PAT4 entry. Meaning that Bit 7 (PAGE_PAT) is
+ *  set. For example, under Linux it only uses PAT0, PAT1, and PAT2 for the
+ *  caching as:
+ *
+ *   WB = none (so PAT0)
+ *   WC = PWT (bit 3 on)
+ *   UC = PWT | PCD (bit 3 and 4 are on).
+ *
+ * To make it work with Xen, it needs to translate the WC bit as so:
+ *
+ *  PWT (so bit 3 on) --> PAT (so bit 7 is on) and clear bit 3
+ *
+ * And to translate back it would:
+ *
+ * PAT (bit 7 on) --> PWT (bit 3 on) and clear bit 7.
  */
 #define MMU_NORMAL_PT_UPDATE      0 /* checked '*ptr = val'. ptr is MA.      */
 #define MMU_MACHPHYS_UPDATE       1 /* ptr = MA of frame to modify entry for */
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/xenoprof.h
--- a/include/xen/interface/xenoprof.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/xenoprof.h	Fri Feb 10 17:11:47 2012 +0100
@@ -68,7 +68,7 @@
 };
 
 /* PC value that indicates a special code */
-#define XENOPROF_ESCAPE_CODE ~0UL
+#define XENOPROF_ESCAPE_CODE (~0ULL)
 /* Transient events for the xenoprof->oprofile cpu buf */
 #define XENOPROF_TRACE_BEGIN 1
 
diff -r ddb83aec5afc -r 7c89207af621 include/xen/interface/xsm/flask_op.h
--- a/include/xen/interface/xsm/flask_op.h	Wed Feb 01 13:59:04 2012 +0100
+++ b/include/xen/interface/xsm/flask_op.h	Fri Feb 10 17:11:47 2012 +0100
@@ -25,6 +25,118 @@
 #ifndef __FLASK_OP_H__
 #define __FLASK_OP_H__
 
+#define XEN_FLASK_INTERFACE_VERSION 1
+
+struct xen_flask_load {
+    XEN_GUEST_HANDLE(char) buffer;
+    uint32_t size;
+};
+
+struct xen_flask_setenforce {
+    uint32_t enforcing;
+};
+
+struct xen_flask_sid_context {
+    /* IN/OUT: sid to convert to/from string */
+    uint32_t sid;
+    /* IN: size of the context buffer
+     * OUT: actual size of the output context string
+     */
+    uint32_t size;
+    XEN_GUEST_HANDLE(char) context;
+};
+
+struct xen_flask_access {
+    /* IN: access request */
+    uint32_t ssid;
+    uint32_t tsid;
+    uint32_t tclass;
+    uint32_t req;
+    /* OUT: AVC data */
+    uint32_t allowed;
+    uint32_t audit_allow;
+    uint32_t audit_deny;
+    uint32_t seqno;
+};
+
+struct xen_flask_transition {
+    /* IN: transition SIDs and class */
+    uint32_t ssid;
+    uint32_t tsid;
+    uint32_t tclass;
+    /* OUT: new SID */
+    uint32_t newsid;
+};
+
+struct xen_flask_userlist {
+    /* IN: starting SID for list */
+    uint32_t start_sid;
+    /* IN: size of user string and output buffer
+     * OUT: number of SIDs returned */
+    uint32_t size;
+    union {
+        /* IN: user to enumerate SIDs */
+        XEN_GUEST_HANDLE(char) user;
+        /* OUT: SID list */
+        XEN_GUEST_HANDLE(uint32) sids;
+    } u;
+};
+
+struct xen_flask_boolean {
+    /* IN/OUT: numeric identifier for boolean [GET/SET]
+     * If -1, name will be used and bool_id will be filled in. */
+    uint32_t bool_id;
+    /* OUT: current enforcing value of boolean [GET/SET] */
+    uint8_t enforcing;
+    /* OUT: pending value of boolean [GET/SET] */
+    uint8_t pending;
+    /* IN: new value of boolean [SET] */
+    uint8_t new_value;
+    /* IN: commit new value instead of only setting pending [SET] */
+    uint8_t commit;
+    /* IN: size of boolean name buffer [GET/SET]
+     * OUT: actual size of name [GET only] */
+    uint32_t size;
+    /* IN: if bool_id is -1, used to find boolean [GET/SET]
+     * OUT: textual name of boolean [GET only]
+     */
+    XEN_GUEST_HANDLE(char) name;
+};
+
+struct xen_flask_setavc_threshold {
+    /* IN */
+    uint32_t threshold;
+};
+
+struct xen_flask_hash_stats {
+    /* OUT */
+    uint32_t entries;
+    uint32_t buckets_used;
+    uint32_t buckets_total;
+    uint32_t max_chain_len;
+};
+
+struct xen_flask_cache_stats {
+    /* IN */
+    uint32_t cpu;
+    /* OUT */
+    uint32_t lookups;
+    uint32_t hits;
+    uint32_t misses;
+    uint32_t allocations;
+    uint32_t reclaims;
+    uint32_t frees;
+};
+
+struct xen_flask_ocontext {
+    /* IN */
+    uint32_t ocon;
+    uint32_t sid;
+    uint64_t low, high;
+};
+
+struct xen_flask_op {
+    uint32_t cmd;
 #define FLASK_LOAD              1
 #define FLASK_GETENFORCE        2
 #define FLASK_SETENFORCE        3
@@ -47,15 +159,26 @@
 #define FLASK_MEMBER            20
 #define FLASK_ADD_OCONTEXT      21
 #define FLASK_DEL_OCONTEXT      22
-
-#define FLASK_LAST              FLASK_DEL_OCONTEXT
-
-typedef struct flask_op {
-    uint32_t  cmd;
-    uint32_t  size;
-    char      *buf;
-} flask_op_t;
-
-DEFINE_XEN_GUEST_HANDLE(flask_op_t);
+    uint32_t interface_version; /* XEN_FLASK_INTERFACE_VERSION */
+    union {
+        struct xen_flask_load load;
+        struct xen_flask_setenforce enforce;
+        /* FLASK_CONTEXT_TO_SID and FLASK_SID_TO_CONTEXT */
+        struct xen_flask_sid_context sid_context;
+        struct xen_flask_access access;
+        /* FLASK_CREATE, FLASK_RELABEL, FLASK_MEMBER */
+        struct xen_flask_transition transition;
+        struct xen_flask_userlist userlist;
+        /* FLASK_GETBOOL, FLASK_SETBOOL */
+        struct xen_flask_boolean boolean;
+        struct xen_flask_setavc_threshold setavc_threshold;
+        struct xen_flask_hash_stats hash_stats;
+        struct xen_flask_cache_stats cache_stats;
+        /* FLASK_ADD_OCONTEXT, FLASK_DEL_OCONTEXT */
+        struct xen_flask_ocontext ocontext;
+    } u;
+};
+typedef struct xen_flask_op xen_flask_op_t;
+DEFINE_XEN_GUEST_HANDLE(xen_flask_op_t);
 
 #endif

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 10 16:55:19 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2012 16:55:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rvtki-0003oG-JT; Fri, 10 Feb 2012 16:55:16 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvtkh-0003mM-AY
	for xen-changelog@lists.xensource.com; Fri, 10 Feb 2012 16:55:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-174.messagelabs.com!1328892907!12817526!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21195 invoked from network); 10 Feb 2012 16:55:09 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	10 Feb 2012 16:55:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvtkZ-0006E1-8R
	for xen-changelog@lists.xensource.com; Fri, 10 Feb 2012 16:55:07 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvtkY-0007cK-K8
	for xen-changelog@lists.xensource.com; Fri, 10 Feb 2012 16:55:06 +0000
Message-Id: <E1RvtkY-0007cK-K8@xenbits.xen.org>
Date: Fri, 10 Feb 2012 16:55: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] xenoprof: backward compatibility
	for changed XENOPROF_ESCAPE_CODE
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328892405 -3600
# Node ID b9627a5740d223827053317cd9c8f40c721db972
# Parent  7c89207af621ff8293f9b64c046eb70a8f85ef75
xenoprof: backward compatibility for changed XENOPROF_ESCAPE_CODE

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


diff -r 7c89207af621 -r b9627a5740d2 drivers/xen/xenoprof/xenoprofile.c
--- a/drivers/xen/xenoprof/xenoprofile.c	Fri Feb 10 17:11:47 2012 +0100
+++ b/drivers/xen/xenoprof/xenoprofile.c	Fri Feb 10 17:46:45 2012 +0100
@@ -120,6 +120,10 @@
 /* Check whether the given entry is an escape code */
 static int xenoprof_is_escape(xenoprof_buf_t * buf, int tail)
 {
+#if CONFIG_XEN_COMPAT < 0x040200 && !defined(CONFIG_64BIT)
+	if (buf->event_log[tail].eip == (unsigned long)XENOPROF_ESCAPE_CODE)
+		return 1;
+#endif
 	return (buf->event_log[tail].eip == XENOPROF_ESCAPE_CODE);
 }
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 10 16:55:19 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2012 16:55:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rvtki-0003oG-JT; Fri, 10 Feb 2012 16:55:16 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rvtkh-0003mM-AY
	for xen-changelog@lists.xensource.com; Fri, 10 Feb 2012 16:55:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-174.messagelabs.com!1328892907!12817526!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21195 invoked from network); 10 Feb 2012 16:55:09 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	10 Feb 2012 16:55:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvtkZ-0006E1-8R
	for xen-changelog@lists.xensource.com; Fri, 10 Feb 2012 16:55:07 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RvtkY-0007cK-K8
	for xen-changelog@lists.xensource.com; Fri, 10 Feb 2012 16:55:06 +0000
Message-Id: <E1RvtkY-0007cK-K8@xenbits.xen.org>
Date: Fri, 10 Feb 2012 16:55: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] xenoprof: backward compatibility
	for changed XENOPROF_ESCAPE_CODE
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328892405 -3600
# Node ID b9627a5740d223827053317cd9c8f40c721db972
# Parent  7c89207af621ff8293f9b64c046eb70a8f85ef75
xenoprof: backward compatibility for changed XENOPROF_ESCAPE_CODE

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


diff -r 7c89207af621 -r b9627a5740d2 drivers/xen/xenoprof/xenoprofile.c
--- a/drivers/xen/xenoprof/xenoprofile.c	Fri Feb 10 17:11:47 2012 +0100
+++ b/drivers/xen/xenoprof/xenoprofile.c	Fri Feb 10 17:46:45 2012 +0100
@@ -120,6 +120,10 @@
 /* Check whether the given entry is an escape code */
 static int xenoprof_is_escape(xenoprof_buf_t * buf, int tail)
 {
+#if CONFIG_XEN_COMPAT < 0x040200 && !defined(CONFIG_64BIT)
+	if (buf->event_log[tail].eip == (unsigned long)XENOPROF_ESCAPE_CODE)
+		return 1;
+#endif
 	return (buf->event_log[tail].eip == XENOPROF_ESCAPE_CODE);
 }
 

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eC-0003YP-DD; Sat, 11 Feb 2012 04:33:16 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eB-0003Xz-7D
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1328934754!51989448!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23667 invoked from network); 11 Feb 2012 04:32:35 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:35 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e8-0006Qc-Ft
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e8-000191-BX
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:12 +0000
Message-Id: <E1Rw4e8-000191-BX@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/libxl: pull xenstore/console
	domids from xenstore
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812409 0
# Node ID b0d53cb93cc6e47ea467ab7c24d42ed4090259b7
# Parent  f341c34b6342d597b123e02db533a75a30f86197
tools/libxl: pull xenstore/console domids from xenstore

Instead of assuming that xenstored and xenconsoled are running in dom0,
pull the domain IDs from xenstore.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r f341c34b6342 -r b0d53cb93cc6 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c	Thu Feb 09 18:25:49 2012 +0000
+++ b/tools/libxl/libxl_dom.c	Thu Feb 09 18:33:29 2012 +0000
@@ -64,6 +64,7 @@
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int tsc_mode;
+    char *xs_domid, *con_domid;
     xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus);
     libxl_set_vcpuaffinity_all(ctx, domid, info->max_vcpus, &info->cpumap);
     xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb + LIBXL_MAXMEM_CONSTANT);
@@ -96,9 +97,18 @@
         xc_shadow_control(ctx->xch, domid, XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION, NULL, 0, &shadow, 0, NULL);
     }
 
-    state->store_port = xc_evtchn_alloc_unbound(ctx->xch, domid, 0);
-    state->console_port = xc_evtchn_alloc_unbound(ctx->xch, domid, 0);
+    xs_domid = xs_read(ctx->xsh, XBT_NULL, "/tool/xenstored/domid", NULL);
+    state->store_domid = xs_domid ? atoi(xs_domid) : 0;
+    free(xs_domid);
+
+    con_domid = xs_read(ctx->xsh, XBT_NULL, "/tool/xenconsoled/domid", NULL);
+    state->console_domid = con_domid ? atoi(con_domid) : 0;
+    free(con_domid);
+
+    state->store_port = xc_evtchn_alloc_unbound(ctx->xch, domid, state->store_domid);
+    state->console_port = xc_evtchn_alloc_unbound(ctx->xch, domid, state->console_domid);
     state->vm_generationid_addr = 0;
+
     return 0;
 }
 
diff -r f341c34b6342 -r b0d53cb93cc6 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Thu Feb 09 18:25:49 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Thu Feb 09 18:33:29 2012 +0000
@@ -595,9 +595,11 @@
     libxl__domain_type((gc), (domid)) == LIBXL_DOMAIN_TYPE_##type
 typedef struct {
     uint32_t store_port;
+    uint32_t store_domid;
     unsigned long store_mfn;
 
     uint32_t console_port;
+    uint32_t console_domid;
     unsigned long console_mfn;
 
     unsigned long vm_generationid_addr;

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eC-0003YP-DD; Sat, 11 Feb 2012 04:33:16 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eB-0003Xz-7D
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1328934754!51989448!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23667 invoked from network); 11 Feb 2012 04:32:35 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:35 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e8-0006Qc-Ft
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e8-000191-BX
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:12 +0000
Message-Id: <E1Rw4e8-000191-BX@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/libxl: pull xenstore/console
	domids from xenstore
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812409 0
# Node ID b0d53cb93cc6e47ea467ab7c24d42ed4090259b7
# Parent  f341c34b6342d597b123e02db533a75a30f86197
tools/libxl: pull xenstore/console domids from xenstore

Instead of assuming that xenstored and xenconsoled are running in dom0,
pull the domain IDs from xenstore.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r f341c34b6342 -r b0d53cb93cc6 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c	Thu Feb 09 18:25:49 2012 +0000
+++ b/tools/libxl/libxl_dom.c	Thu Feb 09 18:33:29 2012 +0000
@@ -64,6 +64,7 @@
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int tsc_mode;
+    char *xs_domid, *con_domid;
     xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus);
     libxl_set_vcpuaffinity_all(ctx, domid, info->max_vcpus, &info->cpumap);
     xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb + LIBXL_MAXMEM_CONSTANT);
@@ -96,9 +97,18 @@
         xc_shadow_control(ctx->xch, domid, XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION, NULL, 0, &shadow, 0, NULL);
     }
 
-    state->store_port = xc_evtchn_alloc_unbound(ctx->xch, domid, 0);
-    state->console_port = xc_evtchn_alloc_unbound(ctx->xch, domid, 0);
+    xs_domid = xs_read(ctx->xsh, XBT_NULL, "/tool/xenstored/domid", NULL);
+    state->store_domid = xs_domid ? atoi(xs_domid) : 0;
+    free(xs_domid);
+
+    con_domid = xs_read(ctx->xsh, XBT_NULL, "/tool/xenconsoled/domid", NULL);
+    state->console_domid = con_domid ? atoi(con_domid) : 0;
+    free(con_domid);
+
+    state->store_port = xc_evtchn_alloc_unbound(ctx->xch, domid, state->store_domid);
+    state->console_port = xc_evtchn_alloc_unbound(ctx->xch, domid, state->console_domid);
     state->vm_generationid_addr = 0;
+
     return 0;
 }
 
diff -r f341c34b6342 -r b0d53cb93cc6 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Thu Feb 09 18:25:49 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Thu Feb 09 18:33:29 2012 +0000
@@ -595,9 +595,11 @@
     libxl__domain_type((gc), (domid)) == LIBXL_DOMAIN_TYPE_##type
 typedef struct {
     uint32_t store_port;
+    uint32_t store_domid;
     unsigned long store_mfn;
 
     uint32_t console_port;
+    uint32_t console_domid;
     unsigned long console_mfn;
 
     unsigned long vm_generationid_addr;

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:21 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eA-0003Y4-W9; Sat, 11 Feb 2012 04:33:15 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e9-0003Xe-AV
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:13 +0000
Received: from [85.158.139.83:27455] by server-5.bemta-5.messagelabs.com id
	09/4E-03847-88FE53F4; Sat, 11 Feb 2012 04:33:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-182.messagelabs.com!1328934790!14539280!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31390 invoked from network); 11 Feb 2012 04:33:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e5-0006QK-Dn
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e5-00016e-2z
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:09 +0000
Message-Id: <E1Rw4e5-00016e-2z@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] stubdom: update README to reference
	xl configuration syntax
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328805926 0
# Node ID b90f65c03f516baf85246a842dafafa47f9f6a7f
# Parent  86f2630d62a913d74367aa4fb1350439dda03c95
stubdom: update README to reference xl configuration syntax

Remove reference to fsback -- it was removed some time ago.

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


diff -r 86f2630d62a9 -r b90f65c03f51 stubdom/README
--- a/stubdom/README	Thu Feb 09 16:03:05 2012 +0000
+++ b/stubdom/README	Thu Feb 09 16:45:26 2012 +0000
@@ -10,6 +10,20 @@
 of video memory for the HVM domain, you need to avoid the need for ballooning,
 by using the hypervisor dom0_mem= option for instance.
 
+Using with XL
+-------------
+
+The enable IOEMU stub domains set the following in your domain
+config:
+
+    device_model_stubdomain_override = 1
+
+See xl.cfg(5) for more details of the xl domain configuration syntax
+and http://wiki.xen.org/wiki/Device_Model_Stub_Domains for more
+information on device model stub domains
+
+Using with XM/xend
+------------------
 
 There is a sample configuration set in xmexample.hvm-stubdom
 
@@ -18,19 +32,6 @@
 device_model = 'stubdom-dm'
 
 
-To run
-======
-
-mkdir -p /exports/usr/share/xen/qemu
-ln -s /usr/share/xen/qemu/keymaps /exports/usr/share/xen/qemu
-mkdir -p /exports/var/lib
-ln -s /var/lib/xen /exports/var/lib
-/usr/sbin/fs-backend &
-
-xm create hvmconfig
-
-
-
                                    PV-GRUB
                                    =======
 

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:21 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eA-0003Y4-W9; Sat, 11 Feb 2012 04:33:15 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e9-0003Xe-AV
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:13 +0000
Received: from [85.158.139.83:27455] by server-5.bemta-5.messagelabs.com id
	09/4E-03847-88FE53F4; Sat, 11 Feb 2012 04:33:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-182.messagelabs.com!1328934790!14539280!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31390 invoked from network); 11 Feb 2012 04:33:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e5-0006QK-Dn
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e5-00016e-2z
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:09 +0000
Message-Id: <E1Rw4e5-00016e-2z@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] stubdom: update README to reference
	xl configuration syntax
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328805926 0
# Node ID b90f65c03f516baf85246a842dafafa47f9f6a7f
# Parent  86f2630d62a913d74367aa4fb1350439dda03c95
stubdom: update README to reference xl configuration syntax

Remove reference to fsback -- it was removed some time ago.

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


diff -r 86f2630d62a9 -r b90f65c03f51 stubdom/README
--- a/stubdom/README	Thu Feb 09 16:03:05 2012 +0000
+++ b/stubdom/README	Thu Feb 09 16:45:26 2012 +0000
@@ -10,6 +10,20 @@
 of video memory for the HVM domain, you need to avoid the need for ballooning,
 by using the hypervisor dom0_mem= option for instance.
 
+Using with XL
+-------------
+
+The enable IOEMU stub domains set the following in your domain
+config:
+
+    device_model_stubdomain_override = 1
+
+See xl.cfg(5) for more details of the xl domain configuration syntax
+and http://wiki.xen.org/wiki/Device_Model_Stub_Domains for more
+information on device model stub domains
+
+Using with XM/xend
+------------------
 
 There is a sample configuration set in xmexample.hvm-stubdom
 
@@ -18,19 +32,6 @@
 device_model = 'stubdom-dm'
 
 
-To run
-======
-
-mkdir -p /exports/usr/share/xen/qemu
-ln -s /usr/share/xen/qemu/keymaps /exports/usr/share/xen/qemu
-mkdir -p /exports/var/lib
-ln -s /var/lib/xen /exports/var/lib
-/usr/sbin/fs-backend &
-
-xm create hvmconfig
-
-
-
                                    PV-GRUB
                                    =======
 

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:21 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eB-0003Y9-8H; Sat, 11 Feb 2012 04:33:15 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eA-0003Xp-A7
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-27.messagelabs.com!1328934769!65395324!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2756 invoked from network); 11 Feb 2012 04:32:50 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:50 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e7-0006QY-Rx
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e7-00018d-QV
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:11 +0000
Message-Id: <E1Rw4e7-00018d-QV@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] flask/policy: add device model types
	to example policy
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328811949 0
# Node ID f341c34b6342d597b123e02db533a75a30f86197
# Parent  90fbc6b03d2f85577642c591d482ccc3dac532ae
flask/policy: add device model types to example policy

This adds an example user for device_model_stubdomain_seclabel.

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


diff -r 90fbc6b03d2f -r f341c34b6342 docs/misc/xsm-flask.txt
--- a/docs/misc/xsm-flask.txt	Thu Feb 09 18:25:15 2012 +0000
+++ b/docs/misc/xsm-flask.txt	Thu Feb 09 18:25:49 2012 +0000
@@ -61,6 +61,10 @@
  - isolated_domU_t can only communicate with dom0
  - prot_domU_t is a domain type whose creation can be disabled with a boolean
 
+HVM domains with stubdomain device models use two types (one per domain):
+ - domHVM_t is an HVM domain that uses a stubdomain device model
+ - dm_dom_t is the device model for a domain with type domHVM_t
+
 One disadvantage of using type enforcement to enforce isolation is that a new
 type is needed for each group of domains. In addition, it is not possible to
 allow isolated_domU_t cannot to create loopback event channels without allowing
diff -r 90fbc6b03d2f -r f341c34b6342 tools/flask/policy/policy/modules/xen/xen.if
--- a/tools/flask/policy/policy/modules/xen/xen.if	Thu Feb 09 18:25:15 2012 +0000
+++ b/tools/flask/policy/policy/modules/xen/xen.if	Thu Feb 09 18:25:49 2012 +0000
@@ -25,7 +25,7 @@
 	allow $1 $2:shadow enable;
 	allow $1 $2:mmu {map_read map_write adjust memorymap physmap pinpage};
 	allow $1 $2:grant setup;
-	allow $1 $2:hvm { cacheattr getparam hvmctl irqlevel pciroute setparam };
+	allow $1 $2:hvm { cacheattr getparam hvmctl irqlevel pciroute setparam pcilevel trackdirtyvram };
 	allow $1 $2_$1_channel:event create;
 ')
 
@@ -36,6 +36,7 @@
 			getaddrsize pause unpause trigger shutdown destroy
 			setvcpuaffinity setdomainmaxmem };
 ')
+
 ################################################################################
 #
 # Inter-domain communication
@@ -75,6 +76,14 @@
 	allow $1 $1:grant { map_read map_write copy unmap };
 ')
 
+# device_model(dm_dom, hvm_dom)
+#   Define how a device model domain interacts with its target
+define(`device_model', `
+	domain_comms($1, $2)
+	allow $1 $2:domain { set_target shutdown };
+	allow $1 $2:mmu { map_read map_write adjust physmap };
+	allow $1 $2:hvm { getparam setparam trackdirtyvram hvmctl irqlevel pciroute };
+')
 ################################################################################
 #
 # Device types and delegation (PCI passthrough)
diff -r 90fbc6b03d2f -r f341c34b6342 tools/flask/policy/policy/modules/xen/xen.te
--- a/tools/flask/policy/policy/modules/xen/xen.te	Thu Feb 09 18:25:15 2012 +0000
+++ b/tools/flask/policy/policy/modules/xen/xen.te	Thu Feb 09 18:25:49 2012 +0000
@@ -100,6 +100,19 @@
 domain_comms(dom0_t, prot_domU_t)
 domain_comms(domU_t, prot_domU_t)
 
+# domHVM_t is meant to be paired with a qemu-dm stub domain of type dm_dom_t
+declare_domain(domHVM_t)
+create_domain(dom0_t, domHVM_t)
+manage_domain(dom0_t, domHVM_t)
+domain_comms(dom0_t, domHVM_t)
+domain_self_comms(domHVM_t)
+
+declare_domain(dm_dom_t)
+create_domain(dom0_t, dm_dom_t)
+manage_domain(dom0_t, dm_dom_t)
+domain_comms(dom0_t, dm_dom_t)
+device_model(dm_dom_t, domHVM_t)
+
 ###############################################################################
 #
 # Device delegation

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:21 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eB-0003Y9-8H; Sat, 11 Feb 2012 04:33:15 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eA-0003Xp-A7
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-27.messagelabs.com!1328934769!65395324!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2756 invoked from network); 11 Feb 2012 04:32:50 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:50 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e7-0006QY-Rx
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e7-00018d-QV
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:11 +0000
Message-Id: <E1Rw4e7-00018d-QV@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] flask/policy: add device model types
	to example policy
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328811949 0
# Node ID f341c34b6342d597b123e02db533a75a30f86197
# Parent  90fbc6b03d2f85577642c591d482ccc3dac532ae
flask/policy: add device model types to example policy

This adds an example user for device_model_stubdomain_seclabel.

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


diff -r 90fbc6b03d2f -r f341c34b6342 docs/misc/xsm-flask.txt
--- a/docs/misc/xsm-flask.txt	Thu Feb 09 18:25:15 2012 +0000
+++ b/docs/misc/xsm-flask.txt	Thu Feb 09 18:25:49 2012 +0000
@@ -61,6 +61,10 @@
  - isolated_domU_t can only communicate with dom0
  - prot_domU_t is a domain type whose creation can be disabled with a boolean
 
+HVM domains with stubdomain device models use two types (one per domain):
+ - domHVM_t is an HVM domain that uses a stubdomain device model
+ - dm_dom_t is the device model for a domain with type domHVM_t
+
 One disadvantage of using type enforcement to enforce isolation is that a new
 type is needed for each group of domains. In addition, it is not possible to
 allow isolated_domU_t cannot to create loopback event channels without allowing
diff -r 90fbc6b03d2f -r f341c34b6342 tools/flask/policy/policy/modules/xen/xen.if
--- a/tools/flask/policy/policy/modules/xen/xen.if	Thu Feb 09 18:25:15 2012 +0000
+++ b/tools/flask/policy/policy/modules/xen/xen.if	Thu Feb 09 18:25:49 2012 +0000
@@ -25,7 +25,7 @@
 	allow $1 $2:shadow enable;
 	allow $1 $2:mmu {map_read map_write adjust memorymap physmap pinpage};
 	allow $1 $2:grant setup;
-	allow $1 $2:hvm { cacheattr getparam hvmctl irqlevel pciroute setparam };
+	allow $1 $2:hvm { cacheattr getparam hvmctl irqlevel pciroute setparam pcilevel trackdirtyvram };
 	allow $1 $2_$1_channel:event create;
 ')
 
@@ -36,6 +36,7 @@
 			getaddrsize pause unpause trigger shutdown destroy
 			setvcpuaffinity setdomainmaxmem };
 ')
+
 ################################################################################
 #
 # Inter-domain communication
@@ -75,6 +76,14 @@
 	allow $1 $1:grant { map_read map_write copy unmap };
 ')
 
+# device_model(dm_dom, hvm_dom)
+#   Define how a device model domain interacts with its target
+define(`device_model', `
+	domain_comms($1, $2)
+	allow $1 $2:domain { set_target shutdown };
+	allow $1 $2:mmu { map_read map_write adjust physmap };
+	allow $1 $2:hvm { getparam setparam trackdirtyvram hvmctl irqlevel pciroute };
+')
 ################################################################################
 #
 # Device types and delegation (PCI passthrough)
diff -r 90fbc6b03d2f -r f341c34b6342 tools/flask/policy/policy/modules/xen/xen.te
--- a/tools/flask/policy/policy/modules/xen/xen.te	Thu Feb 09 18:25:15 2012 +0000
+++ b/tools/flask/policy/policy/modules/xen/xen.te	Thu Feb 09 18:25:49 2012 +0000
@@ -100,6 +100,19 @@
 domain_comms(dom0_t, prot_domU_t)
 domain_comms(domU_t, prot_domU_t)
 
+# domHVM_t is meant to be paired with a qemu-dm stub domain of type dm_dom_t
+declare_domain(domHVM_t)
+create_domain(dom0_t, domHVM_t)
+manage_domain(dom0_t, domHVM_t)
+domain_comms(dom0_t, domHVM_t)
+domain_self_comms(domHVM_t)
+
+declare_domain(dm_dom_t)
+create_domain(dom0_t, dm_dom_t)
+manage_domain(dom0_t, dm_dom_t)
+domain_comms(dom0_t, dm_dom_t)
+device_model(dm_dom_t, domHVM_t)
+
 ###############################################################################
 #
 # Device delegation

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eA-0003Xu-Pl; Sat, 11 Feb 2012 04:33:14 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e9-0003Xd-27
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1328934727!60651283!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17955 invoked from network); 11 Feb 2012 04:32:08 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:08 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e6-0006QQ-HS
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e6-00017R-5l
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:10 +0000
Message-Id: <E1Rw4e6-00017R-5l@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: bugfix: create_domain()
	return to caller if !daemonize
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Shriram Rajagopalan <rshriram@cs.ubc.ca>
# Date 1328810784 0
# Node ID af96b99b607da7d2923cf522acf149f41d8b230c
# Parent  f24828bc8e251304201d18c62482c8da3760a8fd
libxl: bugfix: create_domain() return to caller if !daemonize

Currently the create_domain function does not honor
the daemonize flag properly. It exits irrespective of
the value of the flag. This patch fixes the issue.

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r f24828bc8e25 -r af96b99b607d tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Thu Feb 09 18:03:07 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Thu Feb 09 18:06:24 2012 +0000
@@ -1852,7 +1852,7 @@
      * If we have daemonized then do not return to the caller -- this has
      * already happened in the parent.
      */
-    if ( !need_daemon )
+    if ( daemonize && !need_daemon )
         exit(ret);
 
     return ret;

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:21 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eF-0003ZE-Eb; Sat, 11 Feb 2012 04:33:19 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eD-0003YT-1L
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-27.messagelabs.com!1328934743!52289668!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5286 invoked from network); 11 Feb 2012 04:32:24 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eA-0006Ql-2m
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e9-0001AF-Ul
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:13 +0000
Message-Id: <E1Rw4e9-0001AF-Ul@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mini-os: remove per-fd evtchn limit
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Alex Zeffertt <alex.zeffertt@eu.citrix.com>
# Date 1328812410 0
# Node ID 0bf5499b770d640b7575694c438cb6943d769262
# Parent  37a71b91baf02bd736d1c14fda7b9d59b0eec18e
mini-os: remove per-fd evtchn limit

This changes the minios evtchn implementation to use a list instead of
an array which ahis allows it to grow as necessary to support any number
of ports, only limited by Xen (NR_EVS is 1024, should be enough for now).

Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com>
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r 37a71b91baf0 -r 0bf5499b770d extras/mini-os/include/lib.h
--- a/extras/mini-os/include/lib.h	Thu Feb 09 18:33:30 2012 +0000
+++ b/extras/mini-os/include/lib.h	Thu Feb 09 18:33:30 2012 +0000
@@ -52,6 +52,7 @@
 #include <stddef.h>
 #include <xen/xen.h>
 #include <xen/event_channel.h>
+#include <sys/queue.h>
 #include "gntmap.h"
 
 #ifdef HAVE_LIBC
@@ -143,7 +144,14 @@
     FTYPE_SAVEFILE,
 };
 
-#define MAX_EVTCHN_PORTS 16
+LIST_HEAD(evtchn_port_list, evtchn_port_info);
+
+struct evtchn_port_info {
+        LIST_ENTRY(evtchn_port_info) list;
+        evtchn_port_t port;
+        unsigned long pending;
+        int bound;
+};
 
 extern struct file {
     enum fd_type type;
@@ -158,13 +166,7 @@
 	    off_t offset;
 	} file;
 	struct {
-            /* To each event channel FD is associated a series of ports which
-             * wakes select for this FD. */
-            struct {
-                evtchn_port_t port;
-                unsigned long pending;
-                int bound;
-            } ports[MAX_EVTCHN_PORTS];
+	    struct evtchn_port_list ports;
 	} evtchn;
 	struct gntmap gntmap;
 	struct {
diff -r 37a71b91baf0 -r 0bf5499b770d tools/libxc/xc_minios.c
--- a/tools/libxc/xc_minios.c	Thu Feb 09 18:33:30 2012 +0000
+++ b/tools/libxc/xc_minios.c	Thu Feb 09 18:33:30 2012 +0000
@@ -20,6 +20,7 @@
  */
 
 #undef NDEBUG
+#include "xen-external/bsd-sys-queue.h"
 #include <mini-os/types.h>
 #include <mini-os/os.h>
 #include <mini-os/mm.h>
@@ -210,15 +211,34 @@
     },
 };
 
+
+/* XXX Note: This is not threadsafe */
+static struct evtchn_port_info* port_alloc(int fd) {
+    struct evtchn_port_info *port_info;
+    port_info = malloc(sizeof(struct evtchn_port_info));
+    if (port_info == NULL)
+        return NULL;
+    port_info->pending = 0;
+    port_info->port = -1;
+    port_info->bound = 0;
+
+    LIST_INSERT_HEAD(&files[fd].evtchn.ports, port_info, list);
+    return port_info;
+}
+
+static void port_dealloc(struct evtchn_port_info *port_info) {
+    if (port_info->bound)
+        unbind_evtchn(port_info->port);
+    LIST_REMOVE(port_info, list);
+    free(port_info);
+}
+
 static xc_osdep_handle minios_evtchn_open(xc_evtchn *xce)
 {
-    int fd = alloc_fd(FTYPE_EVTCHN), i;
+    int fd = alloc_fd(FTYPE_EVTCHN);
     if ( fd == -1 )
         return XC_OSDEP_OPEN_ERROR;
-    for (i = 0; i < MAX_EVTCHN_PORTS; i++) {
-	files[fd].evtchn.ports[i].port = -1;
-        files[fd].evtchn.ports[i].bound = 0;
-    }
+    LIST_INIT(&files[fd].evtchn.ports);
     printf("evtchn_open() -> %d\n", fd);
     return (xc_osdep_handle)fd;
 }
@@ -231,10 +251,10 @@
 
 void minios_evtchn_close_fd(int fd)
 {
-    int i;
-    for (i = 0; i < MAX_EVTCHN_PORTS; i++)
-        if (files[fd].evtchn.ports[i].bound)
-            unbind_evtchn(files[fd].evtchn.ports[i].port);
+    struct evtchn_port_info *port_info, *tmp;
+    LIST_FOREACH_SAFE(port_info, &files[fd].evtchn.ports, list, tmp)
+        port_dealloc(port_info);
+
     files[fd].type = FTYPE_NONE;
 }
 
@@ -256,35 +276,21 @@
     return ret;
 }
 
-/* XXX Note: This is not threadsafe */
-static int port_alloc(int fd) {
-    int i;
-    for (i= 0; i < MAX_EVTCHN_PORTS; i++)
-	if (files[fd].evtchn.ports[i].port == -1)
-	    break;
-    if (i == MAX_EVTCHN_PORTS) {
-	printf("Too many ports in xc handle\n");
-	errno = EMFILE;
-	return -1;
-    }
-    files[fd].evtchn.ports[i].pending = 0;
-    return i;
-}
-
 static void evtchn_handler(evtchn_port_t port, struct pt_regs *regs, void *data)
 {
     int fd = (int)(intptr_t)data;
-    int i;
+    struct evtchn_port_info *port_info;
     assert(files[fd].type == FTYPE_EVTCHN);
     mask_evtchn(port);
-    for (i= 0; i < MAX_EVTCHN_PORTS; i++)
-	if (files[fd].evtchn.ports[i].port == port)
-	    break;
-    if (i == MAX_EVTCHN_PORTS) {
-	printk("Unknown port for handle %d\n", fd);
-	return;
+    LIST_FOREACH(port_info, &files[fd].evtchn.ports, list) {
+        if (port_info->port == port)
+            goto found;
     }
-    files[fd].evtchn.ports[i].pending = 1;
+    printk("Unknown port for handle %d\n", fd);
+    return;
+
+ found:
+    port_info->pending = 1;
     files[fd].read = 1;
     wake_up(&event_queue);
 }
@@ -292,12 +298,13 @@
 static evtchn_port_or_error_t minios_evtchn_bind_unbound_port(xc_evtchn *xce, xc_osdep_handle h, int domid)
 {
     int fd = (int)h;
-    int ret, i;
+    struct evtchn_port_info *port_info;
+    int ret;
     evtchn_port_t port;
 
     assert(get_current() == main_thread);
-    i = port_alloc(fd);
-    if (i == -1)
+    port_info = port_alloc(fd);
+    if (port_info == NULL)
 	return -1;
 
     printf("xc_evtchn_bind_unbound_port(%d)", domid);
@@ -305,11 +312,12 @@
     printf(" = %d\n", ret);
 
     if (ret < 0) {
+	port_dealloc(port_info);
 	errno = -ret;
 	return -1;
     }
-    files[fd].evtchn.ports[i].bound = 1;
-    files[fd].evtchn.ports[i].port = port;
+    port_info->bound = 1;
+    port_info->port = port;
     unmask_evtchn(port);
     return port;
 }
@@ -318,12 +326,13 @@
     evtchn_port_t remote_port)
 {
     int fd = (int)h;
+    struct evtchn_port_info *port_info;
     evtchn_port_t local_port;
-    int ret, i;
+    int ret;
 
     assert(get_current() == main_thread);
-    i = port_alloc(fd);
-    if (i == -1)
+    port_info = port_alloc(fd);
+    if (port_info == NULL)
 	return -1;
 
     printf("xc_evtchn_bind_interdomain(%d, %"PRId32")", domid, remote_port);
@@ -331,11 +340,12 @@
     printf(" = %d\n", ret);
 
     if (ret < 0) {
+	port_dealloc(port_info);
 	errno = -ret;
 	return -1;
     }
-    files[fd].evtchn.ports[i].bound = 1;
-    files[fd].evtchn.ports[i].port = local_port;
+    port_info->bound = 1;
+    port_info->port = local_port;
     unmask_evtchn(local_port);
     return local_port;
 }
@@ -343,42 +353,40 @@
 static int minios_evtchn_unbind(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t port)
 {
     int fd = (int)h;
-    int i;
-    for (i = 0; i < MAX_EVTCHN_PORTS; i++)
-	if (files[fd].evtchn.ports[i].port == port) {
-	    files[fd].evtchn.ports[i].port = -1;
-	    break;
-	}
-    if (i == MAX_EVTCHN_PORTS) {
-	printf("Warning: couldn't find port %"PRId32" for xc handle %x\n", port, fd);
-	errno = -EINVAL;
-	return -1;
+    struct evtchn_port_info *port_info;
+
+    LIST_FOREACH(port_info, &files[fd].evtchn.ports, list) {
+        if (port_info->port == port) {
+            port_dealloc(port_info);
+            return 0;
+        }
     }
-    files[fd].evtchn.ports[i].bound = 0;
-    unbind_evtchn(port);
-    return 0;
+    printf("Warning: couldn't find port %"PRId32" for xc handle %x\n", port, fd);
+    errno = -EINVAL;
+    return -1;
 }
 
 static evtchn_port_or_error_t minios_evtchn_bind_virq(xc_evtchn *xce, xc_osdep_handle h, unsigned int virq)
 {
     int fd = (int)h;
+    struct evtchn_port_info *port_info;
     evtchn_port_t port;
-    int i;
 
     assert(get_current() == main_thread);
-    i = port_alloc(fd);
-    if (i == -1)
+    port_info = port_alloc(fd);
+    if (port_info == NULL)
 	return -1;
 
     printf("xc_evtchn_bind_virq(%d)", virq);
     port = bind_virq(virq, evtchn_handler, (void*)(intptr_t)fd);
 
     if (port < 0) {
+	port_dealloc(port_info);
 	errno = -port;
 	return -1;
     }
-    files[fd].evtchn.ports[i].bound = 1;
-    files[fd].evtchn.ports[i].port = port;
+    port_info->bound = 1;
+    port_info->port = port;
     unmask_evtchn(port);
     return port;
 }
@@ -386,18 +394,18 @@
 static evtchn_port_or_error_t minios_evtchn_pending(xc_evtchn *xce, xc_osdep_handle h)
 {
     int fd = (int)h;
-    int i;
+    struct evtchn_port_info *port_info;
     unsigned long flags;
     evtchn_port_t ret = -1;
 
     local_irq_save(flags);
     files[fd].read = 0;
-    for (i = 0; i < MAX_EVTCHN_PORTS; i++) {
-        evtchn_port_t port = files[fd].evtchn.ports[i].port;
-        if (port != -1 && files[fd].evtchn.ports[i].pending) {
+
+    LIST_FOREACH(port_info, &files[fd].evtchn.ports, list) {
+        if (port_info->port != -1 && port_info->pending) {
             if (ret == -1) {
-                ret = port;
-                files[fd].evtchn.ports[i].pending = 0;
+                ret = port_info->port;
+                port_info->pending = 0;
             } else {
                 files[fd].read = 1;
                 break;

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eA-0003Xu-Pl; Sat, 11 Feb 2012 04:33:14 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e9-0003Xd-27
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1328934727!60651283!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17955 invoked from network); 11 Feb 2012 04:32:08 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:08 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e6-0006QQ-HS
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e6-00017R-5l
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:10 +0000
Message-Id: <E1Rw4e6-00017R-5l@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: bugfix: create_domain()
	return to caller if !daemonize
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Shriram Rajagopalan <rshriram@cs.ubc.ca>
# Date 1328810784 0
# Node ID af96b99b607da7d2923cf522acf149f41d8b230c
# Parent  f24828bc8e251304201d18c62482c8da3760a8fd
libxl: bugfix: create_domain() return to caller if !daemonize

Currently the create_domain function does not honor
the daemonize flag properly. It exits irrespective of
the value of the flag. This patch fixes the issue.

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r f24828bc8e25 -r af96b99b607d tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Thu Feb 09 18:03:07 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Thu Feb 09 18:06:24 2012 +0000
@@ -1852,7 +1852,7 @@
      * If we have daemonized then do not return to the caller -- this has
      * already happened in the parent.
      */
-    if ( !need_daemon )
+    if ( daemonize && !need_daemon )
         exit(ret);
 
     return ret;

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:21 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eF-0003ZE-Eb; Sat, 11 Feb 2012 04:33:19 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eD-0003YT-1L
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-27.messagelabs.com!1328934743!52289668!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5286 invoked from network); 11 Feb 2012 04:32:24 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eA-0006Ql-2m
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e9-0001AF-Ul
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:13 +0000
Message-Id: <E1Rw4e9-0001AF-Ul@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mini-os: remove per-fd evtchn limit
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Alex Zeffertt <alex.zeffertt@eu.citrix.com>
# Date 1328812410 0
# Node ID 0bf5499b770d640b7575694c438cb6943d769262
# Parent  37a71b91baf02bd736d1c14fda7b9d59b0eec18e
mini-os: remove per-fd evtchn limit

This changes the minios evtchn implementation to use a list instead of
an array which ahis allows it to grow as necessary to support any number
of ports, only limited by Xen (NR_EVS is 1024, should be enough for now).

Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com>
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r 37a71b91baf0 -r 0bf5499b770d extras/mini-os/include/lib.h
--- a/extras/mini-os/include/lib.h	Thu Feb 09 18:33:30 2012 +0000
+++ b/extras/mini-os/include/lib.h	Thu Feb 09 18:33:30 2012 +0000
@@ -52,6 +52,7 @@
 #include <stddef.h>
 #include <xen/xen.h>
 #include <xen/event_channel.h>
+#include <sys/queue.h>
 #include "gntmap.h"
 
 #ifdef HAVE_LIBC
@@ -143,7 +144,14 @@
     FTYPE_SAVEFILE,
 };
 
-#define MAX_EVTCHN_PORTS 16
+LIST_HEAD(evtchn_port_list, evtchn_port_info);
+
+struct evtchn_port_info {
+        LIST_ENTRY(evtchn_port_info) list;
+        evtchn_port_t port;
+        unsigned long pending;
+        int bound;
+};
 
 extern struct file {
     enum fd_type type;
@@ -158,13 +166,7 @@
 	    off_t offset;
 	} file;
 	struct {
-            /* To each event channel FD is associated a series of ports which
-             * wakes select for this FD. */
-            struct {
-                evtchn_port_t port;
-                unsigned long pending;
-                int bound;
-            } ports[MAX_EVTCHN_PORTS];
+	    struct evtchn_port_list ports;
 	} evtchn;
 	struct gntmap gntmap;
 	struct {
diff -r 37a71b91baf0 -r 0bf5499b770d tools/libxc/xc_minios.c
--- a/tools/libxc/xc_minios.c	Thu Feb 09 18:33:30 2012 +0000
+++ b/tools/libxc/xc_minios.c	Thu Feb 09 18:33:30 2012 +0000
@@ -20,6 +20,7 @@
  */
 
 #undef NDEBUG
+#include "xen-external/bsd-sys-queue.h"
 #include <mini-os/types.h>
 #include <mini-os/os.h>
 #include <mini-os/mm.h>
@@ -210,15 +211,34 @@
     },
 };
 
+
+/* XXX Note: This is not threadsafe */
+static struct evtchn_port_info* port_alloc(int fd) {
+    struct evtchn_port_info *port_info;
+    port_info = malloc(sizeof(struct evtchn_port_info));
+    if (port_info == NULL)
+        return NULL;
+    port_info->pending = 0;
+    port_info->port = -1;
+    port_info->bound = 0;
+
+    LIST_INSERT_HEAD(&files[fd].evtchn.ports, port_info, list);
+    return port_info;
+}
+
+static void port_dealloc(struct evtchn_port_info *port_info) {
+    if (port_info->bound)
+        unbind_evtchn(port_info->port);
+    LIST_REMOVE(port_info, list);
+    free(port_info);
+}
+
 static xc_osdep_handle minios_evtchn_open(xc_evtchn *xce)
 {
-    int fd = alloc_fd(FTYPE_EVTCHN), i;
+    int fd = alloc_fd(FTYPE_EVTCHN);
     if ( fd == -1 )
         return XC_OSDEP_OPEN_ERROR;
-    for (i = 0; i < MAX_EVTCHN_PORTS; i++) {
-	files[fd].evtchn.ports[i].port = -1;
-        files[fd].evtchn.ports[i].bound = 0;
-    }
+    LIST_INIT(&files[fd].evtchn.ports);
     printf("evtchn_open() -> %d\n", fd);
     return (xc_osdep_handle)fd;
 }
@@ -231,10 +251,10 @@
 
 void minios_evtchn_close_fd(int fd)
 {
-    int i;
-    for (i = 0; i < MAX_EVTCHN_PORTS; i++)
-        if (files[fd].evtchn.ports[i].bound)
-            unbind_evtchn(files[fd].evtchn.ports[i].port);
+    struct evtchn_port_info *port_info, *tmp;
+    LIST_FOREACH_SAFE(port_info, &files[fd].evtchn.ports, list, tmp)
+        port_dealloc(port_info);
+
     files[fd].type = FTYPE_NONE;
 }
 
@@ -256,35 +276,21 @@
     return ret;
 }
 
-/* XXX Note: This is not threadsafe */
-static int port_alloc(int fd) {
-    int i;
-    for (i= 0; i < MAX_EVTCHN_PORTS; i++)
-	if (files[fd].evtchn.ports[i].port == -1)
-	    break;
-    if (i == MAX_EVTCHN_PORTS) {
-	printf("Too many ports in xc handle\n");
-	errno = EMFILE;
-	return -1;
-    }
-    files[fd].evtchn.ports[i].pending = 0;
-    return i;
-}
-
 static void evtchn_handler(evtchn_port_t port, struct pt_regs *regs, void *data)
 {
     int fd = (int)(intptr_t)data;
-    int i;
+    struct evtchn_port_info *port_info;
     assert(files[fd].type == FTYPE_EVTCHN);
     mask_evtchn(port);
-    for (i= 0; i < MAX_EVTCHN_PORTS; i++)
-	if (files[fd].evtchn.ports[i].port == port)
-	    break;
-    if (i == MAX_EVTCHN_PORTS) {
-	printk("Unknown port for handle %d\n", fd);
-	return;
+    LIST_FOREACH(port_info, &files[fd].evtchn.ports, list) {
+        if (port_info->port == port)
+            goto found;
     }
-    files[fd].evtchn.ports[i].pending = 1;
+    printk("Unknown port for handle %d\n", fd);
+    return;
+
+ found:
+    port_info->pending = 1;
     files[fd].read = 1;
     wake_up(&event_queue);
 }
@@ -292,12 +298,13 @@
 static evtchn_port_or_error_t minios_evtchn_bind_unbound_port(xc_evtchn *xce, xc_osdep_handle h, int domid)
 {
     int fd = (int)h;
-    int ret, i;
+    struct evtchn_port_info *port_info;
+    int ret;
     evtchn_port_t port;
 
     assert(get_current() == main_thread);
-    i = port_alloc(fd);
-    if (i == -1)
+    port_info = port_alloc(fd);
+    if (port_info == NULL)
 	return -1;
 
     printf("xc_evtchn_bind_unbound_port(%d)", domid);
@@ -305,11 +312,12 @@
     printf(" = %d\n", ret);
 
     if (ret < 0) {
+	port_dealloc(port_info);
 	errno = -ret;
 	return -1;
     }
-    files[fd].evtchn.ports[i].bound = 1;
-    files[fd].evtchn.ports[i].port = port;
+    port_info->bound = 1;
+    port_info->port = port;
     unmask_evtchn(port);
     return port;
 }
@@ -318,12 +326,13 @@
     evtchn_port_t remote_port)
 {
     int fd = (int)h;
+    struct evtchn_port_info *port_info;
     evtchn_port_t local_port;
-    int ret, i;
+    int ret;
 
     assert(get_current() == main_thread);
-    i = port_alloc(fd);
-    if (i == -1)
+    port_info = port_alloc(fd);
+    if (port_info == NULL)
 	return -1;
 
     printf("xc_evtchn_bind_interdomain(%d, %"PRId32")", domid, remote_port);
@@ -331,11 +340,12 @@
     printf(" = %d\n", ret);
 
     if (ret < 0) {
+	port_dealloc(port_info);
 	errno = -ret;
 	return -1;
     }
-    files[fd].evtchn.ports[i].bound = 1;
-    files[fd].evtchn.ports[i].port = local_port;
+    port_info->bound = 1;
+    port_info->port = local_port;
     unmask_evtchn(local_port);
     return local_port;
 }
@@ -343,42 +353,40 @@
 static int minios_evtchn_unbind(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t port)
 {
     int fd = (int)h;
-    int i;
-    for (i = 0; i < MAX_EVTCHN_PORTS; i++)
-	if (files[fd].evtchn.ports[i].port == port) {
-	    files[fd].evtchn.ports[i].port = -1;
-	    break;
-	}
-    if (i == MAX_EVTCHN_PORTS) {
-	printf("Warning: couldn't find port %"PRId32" for xc handle %x\n", port, fd);
-	errno = -EINVAL;
-	return -1;
+    struct evtchn_port_info *port_info;
+
+    LIST_FOREACH(port_info, &files[fd].evtchn.ports, list) {
+        if (port_info->port == port) {
+            port_dealloc(port_info);
+            return 0;
+        }
     }
-    files[fd].evtchn.ports[i].bound = 0;
-    unbind_evtchn(port);
-    return 0;
+    printf("Warning: couldn't find port %"PRId32" for xc handle %x\n", port, fd);
+    errno = -EINVAL;
+    return -1;
 }
 
 static evtchn_port_or_error_t minios_evtchn_bind_virq(xc_evtchn *xce, xc_osdep_handle h, unsigned int virq)
 {
     int fd = (int)h;
+    struct evtchn_port_info *port_info;
     evtchn_port_t port;
-    int i;
 
     assert(get_current() == main_thread);
-    i = port_alloc(fd);
-    if (i == -1)
+    port_info = port_alloc(fd);
+    if (port_info == NULL)
 	return -1;
 
     printf("xc_evtchn_bind_virq(%d)", virq);
     port = bind_virq(virq, evtchn_handler, (void*)(intptr_t)fd);
 
     if (port < 0) {
+	port_dealloc(port_info);
 	errno = -port;
 	return -1;
     }
-    files[fd].evtchn.ports[i].bound = 1;
-    files[fd].evtchn.ports[i].port = port;
+    port_info->bound = 1;
+    port_info->port = port;
     unmask_evtchn(port);
     return port;
 }
@@ -386,18 +394,18 @@
 static evtchn_port_or_error_t minios_evtchn_pending(xc_evtchn *xce, xc_osdep_handle h)
 {
     int fd = (int)h;
-    int i;
+    struct evtchn_port_info *port_info;
     unsigned long flags;
     evtchn_port_t ret = -1;
 
     local_irq_save(flags);
     files[fd].read = 0;
-    for (i = 0; i < MAX_EVTCHN_PORTS; i++) {
-        evtchn_port_t port = files[fd].evtchn.ports[i].port;
-        if (port != -1 && files[fd].evtchn.ports[i].pending) {
+
+    LIST_FOREACH(port_info, &files[fd].evtchn.ports, list) {
+        if (port_info->port != -1 && port_info->pending) {
             if (ret == -1) {
-                ret = port;
-                files[fd].evtchn.ports[i].pending = 0;
+                ret = port_info->port;
+                port_info->pending = 0;
             } else {
                 files[fd].read = 1;
                 break;

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eF-0003Yx-4O; Sat, 11 Feb 2012 04:33:19 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eC-0003Xa-Vm
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-216.messagelabs.com!1328934789!13804161!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25705 invoked from network); 11 Feb 2012 04:33:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e5-0006QH-0s
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e4-00016F-Fu
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:08 +0000
Message-Id: <E1Rw4e4-00016F-Fu@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mini-os: stop compiler complaint
	about unused variables
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User John McDermott <john.mcdermott@nrl.navy.mil>
# Date 1328803385 0
# Node ID 86f2630d62a913d74367aa4fb1350439dda03c95
# Parent  9fc810bb814558bc5c8f9d086af7576516e07244
mini-os: stop compiler complaint about unused variables

gcc (GCC) 4.6.2 20111027 (Red Hat 4.6.2-1) complains about unused variables
in mini-os drivers

Signed-off-by: John McDermott <john.mcdermott@nrl.navy.mil>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 9fc810bb8145 -r 86f2630d62a9 extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c	Thu Feb 09 16:39:16 2012 +0100
+++ b/extras/mini-os/blkfront.c	Thu Feb 09 16:03:05 2012 +0000
@@ -171,6 +171,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:
diff -r 9fc810bb8145 -r 86f2630d62a9 extras/mini-os/console/xencons_ring.c
--- a/extras/mini-os/console/xencons_ring.c	Thu Feb 09 16:39:16 2012 +0100
+++ b/extras/mini-os/console/xencons_ring.c	Thu Feb 09 16:03:05 2012 +0000
@@ -317,6 +317,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:
diff -r 9fc810bb8145 -r 86f2630d62a9 extras/mini-os/fbfront.c
--- a/extras/mini-os/fbfront.c	Thu Feb 09 16:39:16 2012 +0100
+++ b/extras/mini-os/fbfront.c	Thu Feb 09 16:03:05 2012 +0000
@@ -142,6 +142,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:
@@ -503,6 +504,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:
diff -r 9fc810bb8145 -r 86f2630d62a9 extras/mini-os/netfront.c
--- a/extras/mini-os/netfront.c	Thu Feb 09 16:39:16 2012 +0100
+++ b/extras/mini-os/netfront.c	Thu Feb 09 16:03:05 2012 +0000
@@ -421,6 +421,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:
diff -r 9fc810bb8145 -r 86f2630d62a9 extras/mini-os/pcifront.c
--- a/extras/mini-os/pcifront.c	Thu Feb 09 16:39:16 2012 +0100
+++ b/extras/mini-os/pcifront.c	Thu Feb 09 16:03:05 2012 +0000
@@ -222,6 +222,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eF-0003Yx-4O; Sat, 11 Feb 2012 04:33:19 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eC-0003Xa-Vm
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-216.messagelabs.com!1328934789!13804161!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25705 invoked from network); 11 Feb 2012 04:33:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e5-0006QH-0s
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e4-00016F-Fu
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:08 +0000
Message-Id: <E1Rw4e4-00016F-Fu@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mini-os: stop compiler complaint
	about unused variables
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User John McDermott <john.mcdermott@nrl.navy.mil>
# Date 1328803385 0
# Node ID 86f2630d62a913d74367aa4fb1350439dda03c95
# Parent  9fc810bb814558bc5c8f9d086af7576516e07244
mini-os: stop compiler complaint about unused variables

gcc (GCC) 4.6.2 20111027 (Red Hat 4.6.2-1) complains about unused variables
in mini-os drivers

Signed-off-by: John McDermott <john.mcdermott@nrl.navy.mil>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 9fc810bb8145 -r 86f2630d62a9 extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c	Thu Feb 09 16:39:16 2012 +0100
+++ b/extras/mini-os/blkfront.c	Thu Feb 09 16:03:05 2012 +0000
@@ -171,6 +171,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:
diff -r 9fc810bb8145 -r 86f2630d62a9 extras/mini-os/console/xencons_ring.c
--- a/extras/mini-os/console/xencons_ring.c	Thu Feb 09 16:39:16 2012 +0100
+++ b/extras/mini-os/console/xencons_ring.c	Thu Feb 09 16:03:05 2012 +0000
@@ -317,6 +317,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:
diff -r 9fc810bb8145 -r 86f2630d62a9 extras/mini-os/fbfront.c
--- a/extras/mini-os/fbfront.c	Thu Feb 09 16:39:16 2012 +0100
+++ b/extras/mini-os/fbfront.c	Thu Feb 09 16:03:05 2012 +0000
@@ -142,6 +142,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:
@@ -503,6 +504,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:
diff -r 9fc810bb8145 -r 86f2630d62a9 extras/mini-os/netfront.c
--- a/extras/mini-os/netfront.c	Thu Feb 09 16:39:16 2012 +0100
+++ b/extras/mini-os/netfront.c	Thu Feb 09 16:03:05 2012 +0000
@@ -421,6 +421,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:
diff -r 9fc810bb8145 -r 86f2630d62a9 extras/mini-os/pcifront.c
--- a/extras/mini-os/pcifront.c	Thu Feb 09 16:39:16 2012 +0100
+++ b/extras/mini-os/pcifront.c	Thu Feb 09 16:03:05 2012 +0000
@@ -222,6 +222,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eH-0003an-Ql; Sat, 11 Feb 2012 04:33:21 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eF-0003Yw-9d
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1328934745!53806609!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7802 invoked from network); 11 Feb 2012 04:32:26 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:26 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eB-0006Qu-Lj
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eB-0001BQ-HJ
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:15 +0000
Message-Id: <E1Rw4eB-0001BQ-HJ@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mini-os: make frontends and xenbus
	optional
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812412 0
# Node ID 585caf50a9260d3fc6a4ece0450d10d34e73489f
# Parent  86dca025cc2dbc74a7a0e71f3dd2aef747752dda
mini-os: make frontends and xenbus optional

This adds compile-time logic to disable certain frontends in mini-os:
 - pcifront is disabled by default, enabled for ioemu
 - blkfront, netfront, fbfront, kbdfront, consfront are enabled by default
 - xenbus is required for any frontend, and is enabled by default

If all frontends and xenbus are disabled, mini-os will run without
needing to communicate with xenstore, making it suitable to run the
xenstore daemon. The console frontend is not required for the initial
console, only consoles opened via openpt or ptmx.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/Makefile
--- a/extras/mini-os/Makefile	Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/Makefile	Thu Feb 09 18:33:32 2012 +0000
@@ -20,11 +20,25 @@
 CONFIG_SPARSE_BSS ?= y
 CONFIG_QEMU_XS_ARGS ?= n
 CONFIG_TEST ?= n
+CONFIG_PCIFRONT ?= n
+CONFIG_BLKFRONT ?= y
+CONFIG_NETFRONT ?= y
+CONFIG_FBFRONT ?= y
+CONFIG_KBDFRONT ?= y
+CONFIG_CONSFRONT ?= y
+CONFIG_XENBUS ?= y
 
 # Export config items as compiler directives
 flags-$(CONFIG_START_NETWORK) += -DCONFIG_START_NETWORK
 flags-$(CONFIG_SPARSE_BSS) += -DCONFIG_SPARSE_BSS
 flags-$(CONFIG_QEMU_XS_ARGS) += -DCONFIG_QEMU_XS_ARGS
+flags-$(CONFIG_PCIFRONT) += -DCONFIG_PCIFRONT
+flags-$(CONFIG_BLKFRONT) += -DCONFIG_BLKFRONT
+flags-$(CONFIG_NETFRONT) += -DCONFIG_NETFRONT
+flags-$(CONFIG_KBDFRONT) += -DCONFIG_KBDFRONT
+flags-$(CONFIG_FBFRONT) += -DCONFIG_FBFRONT
+flags-$(CONFIG_CONSFRONT) += -DCONFIG_CONSFRONT
+flags-$(CONFIG_XENBUS) += -DCONFIG_XENBUS
 
 DEF_CFLAGS += $(flags-y)
 
@@ -50,10 +64,10 @@
 # Subdirectories common to mini-os
 SUBDIRS := lib xenbus console
 
-src-y += blkfront.c
+src-$(CONFIG_BLKFRONT) += blkfront.c
 src-y += daytime.c
 src-y += events.c
-src-y += fbfront.c
+src-$(CONFIG_FBFRONT) += fbfront.c
 src-y += gntmap.c
 src-y += gnttab.c
 src-y += hypervisor.c
@@ -61,8 +75,8 @@
 src-y += lock.c
 src-y += main.c
 src-y += mm.c
-src-y += netfront.c
-src-y += pcifront.c
+src-$(CONFIG_NETFRONT) += netfront.c
+src-$(CONFIG_PCIFRONT) += pcifront.c
 src-y += sched.c
 src-$(CONFIG_TEST) += test.c
 
@@ -73,12 +87,13 @@
 src-y += lib/string.c
 src-y += lib/sys.c
 src-y += lib/xmalloc.c
-src-y += lib/xs.c
+src-$(CONFIG_XENBUS) += lib/xs.c
 
-src-y += xenbus/xenbus.c
+src-$(CONFIG_XENBUS) += xenbus/xenbus.c
 
 src-y += console/console.c
 src-y += console/xencons_ring.c
+src-$(CONFIG_CONSFRONT) += console/xenbus.c
 
 # The common mini-os objects to build.
 APP_OBJS :=
@@ -113,7 +128,10 @@
 LWC	:= $(shell find $(LWIPDIR)/ -type f -name '*.c')
 LWC	:= $(filter-out %6.c %ip6_addr.c %ethernetif.c, $(LWC))
 LWO	:= $(patsubst %.c,%.o,$(LWC))
-LWO	+= $(addprefix $(OBJ_DIR)/,lwip-arch.o lwip-net.o)
+LWO	+= $(OBJ_DIR)/lwip-arch.o
+ifeq ($(CONFIG_NETFRONT),y)
+LWO += $(OBJ_DIR)/lwip-net.o
+endif
 
 $(OBJ_DIR)/lwip.a: $(LWO)
 	$(RM) $@
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/console/console.c
--- a/extras/mini-os/console/console.c	Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/console/console.c	Thu Feb 09 18:33:32 2012 +0000
@@ -158,8 +158,3 @@
     /* This is also required to notify the daemon */
     printk("done.\n");
 }
-
-void fini_console(struct consfront_dev *dev)
-{
-    if (dev) free_consfront(dev);
-}
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/console/console.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/console/console.h	Thu Feb 09 18:33:32 2012 +0000
@@ -0,0 +1,2 @@
+
+void console_handle_input(evtchn_port_t port, struct pt_regs *regs, void *data);
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/console/xenbus.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/console/xenbus.c	Thu Feb 09 18:33:32 2012 +0000
@@ -0,0 +1,198 @@
+#include <mini-os/types.h>
+#include <mini-os/wait.h>
+#include <mini-os/mm.h>
+#include <mini-os/hypervisor.h>
+#include <mini-os/events.h>
+#include <mini-os/os.h>
+#include <mini-os/lib.h>
+#include <mini-os/xenbus.h>
+#include <xen/io/console.h>
+#include <xen/io/protocols.h>
+#include <xen/io/ring.h>
+#include <mini-os/xmalloc.h>
+#include <mini-os/gnttab.h>
+#include "console.h"
+
+void free_consfront(struct consfront_dev *dev)
+{
+    char* err = NULL;
+    XenbusState state;
+
+    char path[strlen(dev->backend) + 1 + 5 + 1];
+    char nodename[strlen(dev->nodename) + 1 + 5 + 1];
+
+    snprintf(path, sizeof(path), "%s/state", dev->backend);
+    snprintf(nodename, sizeof(nodename), "%s/state", dev->nodename);
+
+    if ((err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosing)) != NULL) {
+        printk("free_consfront: error changing state to %d: %s\n",
+                XenbusStateClosing, err);
+        goto close;
+    }
+    state = xenbus_read_integer(path);
+    while (err == NULL && state < XenbusStateClosing)
+        err = xenbus_wait_for_state_change(path, &state, &dev->events);
+    if (err) free(err);
+
+    if ((err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosed)) != NULL) {
+        printk("free_consfront: error changing state to %d: %s\n",
+                XenbusStateClosed, err);
+        goto close;
+    }
+
+close:
+    if (err) free(err);
+    xenbus_unwatch_path_token(XBT_NIL, path, path);
+
+    mask_evtchn(dev->evtchn);
+    unbind_evtchn(dev->evtchn);
+    free(dev->backend);
+    free(dev->nodename);
+
+    gnttab_end_access(dev->ring_ref);
+
+    free_page(dev->ring);
+    free(dev);
+}
+
+struct consfront_dev *init_consfront(char *_nodename)
+{
+    xenbus_transaction_t xbt;
+    char* err;
+    char* message=NULL;
+    int retry=0;
+    char* msg = NULL;
+    char nodename[256];
+    char path[256];
+    static int consfrontends = 3;
+    struct consfront_dev *dev;
+    int res;
+
+    if (!_nodename)
+        snprintf(nodename, sizeof(nodename), "device/console/%d", consfrontends);
+    else
+        strncpy(nodename, _nodename, sizeof(nodename));
+
+    printk("******************* CONSFRONT for %s **********\n\n\n", nodename);
+
+    consfrontends++;
+    dev = malloc(sizeof(*dev));
+    memset(dev, 0, sizeof(*dev));
+    dev->nodename = strdup(nodename);
+#ifdef HAVE_LIBC
+    dev->fd = -1;
+#endif
+
+    snprintf(path, sizeof(path), "%s/backend-id", nodename);
+    if ((res = xenbus_read_integer(path)) < 0) 
+        return NULL;
+    else
+        dev->dom = res;
+    evtchn_alloc_unbound(dev->dom, console_handle_input, dev, &dev->evtchn);
+
+    dev->ring = (struct xencons_interface *) alloc_page();
+    memset(dev->ring, 0, PAGE_SIZE);
+    dev->ring_ref = gnttab_grant_access(dev->dom, virt_to_mfn(dev->ring), 0);
+
+    dev->events = NULL;
+
+again:
+    err = xenbus_transaction_start(&xbt);
+    if (err) {
+        printk("starting transaction\n");
+        free(err);
+    }
+
+    err = xenbus_printf(xbt, nodename, "ring-ref","%u",
+                dev->ring_ref);
+    if (err) {
+        message = "writing ring-ref";
+        goto abort_transaction;
+    }
+    err = xenbus_printf(xbt, nodename,
+                "port", "%u", dev->evtchn);
+    if (err) {
+        message = "writing event-channel";
+        goto abort_transaction;
+    }
+    err = xenbus_printf(xbt, nodename,
+                "protocol", "%s", XEN_IO_PROTO_ABI_NATIVE);
+    if (err) {
+        message = "writing protocol";
+        goto abort_transaction;
+    }
+
+    err = xenbus_printf(xbt, nodename, "type", "%s", "ioemu");
+    if (err) {
+        message = "writing type";
+        goto abort_transaction;
+    }
+
+    snprintf(path, sizeof(path), "%s/state", nodename);
+    err = xenbus_switch_state(xbt, path, XenbusStateConnected);
+    if (err) {
+        message = "switching state";
+        goto abort_transaction;
+    }
+
+
+    err = xenbus_transaction_end(xbt, 0, &retry);
+    if (err) free(err);
+    if (retry) {
+            goto again;
+        printk("completing transaction\n");
+    }
+
+    goto done;
+
+abort_transaction:
+    free(err);
+    err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
+    goto error;
+
+done:
+
+    snprintf(path, sizeof(path), "%s/backend", nodename);
+    msg = xenbus_read(XBT_NIL, path, &dev->backend);
+    if (msg) {
+        printk("Error %s when reading the backend path %s\n", msg, path);
+        goto error;
+    }
+
+    printk("backend at %s\n", dev->backend);
+
+    {
+        XenbusState state;
+        char path[strlen(dev->backend) + 1 + 19 + 1];
+        snprintf(path, sizeof(path), "%s/state", dev->backend);
+        
+	xenbus_watch_path_token(XBT_NIL, path, path, &dev->events);
+        msg = NULL;
+        state = xenbus_read_integer(path);
+        while (msg == NULL && state < XenbusStateConnected)
+            msg = xenbus_wait_for_state_change(path, &state, &dev->events);
+        if (msg != NULL || state != XenbusStateConnected) {
+            printk("backend not available, state=%d\n", state);
+            xenbus_unwatch_path_token(XBT_NIL, path, path);
+            goto error;
+        }
+    }
+    unmask_evtchn(dev->evtchn);
+
+    printk("**************************\n");
+
+    return dev;
+
+error:
+    free(msg);
+    free(err);
+    free_consfront(dev);
+    return NULL;
+}
+
+void fini_console(struct consfront_dev *dev)
+{
+    if (dev) free_consfront(dev);
+}
+
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/console/xencons_ring.c
--- a/extras/mini-os/console/xencons_ring.c	Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/console/xencons_ring.c	Thu Feb 09 18:33:32 2012 +0000
@@ -11,6 +11,7 @@
 #include <xen/io/ring.h>
 #include <mini-os/xmalloc.h>
 #include <mini-os/gnttab.h>
+#include "console.h"
 
 DECLARE_WAIT_QUEUE_HEAD(console_queue);
 
@@ -70,7 +71,7 @@
 
 
 
-static void handle_input(evtchn_port_t port, struct pt_regs *regs, void *data)
+void console_handle_input(evtchn_port_t port, struct pt_regs *regs, void *data)
 {
 	struct consfront_dev *dev = (struct consfront_dev *) data;
 #ifdef HAVE_LIBC
@@ -173,7 +174,7 @@
 	dev->evtchn = start_info.console.domU.evtchn;
 	dev->ring = (struct xencons_interface *) mfn_to_virt(start_info.console.domU.mfn);
 
-	err = bind_evtchn(dev->evtchn, handle_input, dev);
+	err = bind_evtchn(dev->evtchn, console_handle_input, dev);
 	if (err <= 0) {
 		printk("XEN console request chn bind failed %i\n", err);
                 free(dev);
@@ -187,184 +188,6 @@
 	return dev;
 }
 
-void free_consfront(struct consfront_dev *dev)
-{
-    char* err = NULL;
-    XenbusState state;
-
-    char path[strlen(dev->backend) + 1 + 5 + 1];
-    char nodename[strlen(dev->nodename) + 1 + 5 + 1];
-
-    snprintf(path, sizeof(path), "%s/state", dev->backend);
-    snprintf(nodename, sizeof(nodename), "%s/state", dev->nodename);
-
-    if ((err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosing)) != NULL) {
-        printk("free_consfront: error changing state to %d: %s\n",
-                XenbusStateClosing, err);
-        goto close;
-    }
-    state = xenbus_read_integer(path);
-    while (err == NULL && state < XenbusStateClosing)
-        err = xenbus_wait_for_state_change(path, &state, &dev->events);
-    if (err) free(err);
-
-    if ((err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosed)) != NULL) {
-        printk("free_consfront: error changing state to %d: %s\n",
-                XenbusStateClosed, err);
-        goto close;
-    }
-
-close:
-    if (err) free(err);
-    xenbus_unwatch_path_token(XBT_NIL, path, path);
-
-    mask_evtchn(dev->evtchn);
-    unbind_evtchn(dev->evtchn);
-    free(dev->backend);
-    free(dev->nodename);
-
-    gnttab_end_access(dev->ring_ref);
-
-    free_page(dev->ring);
-    free(dev);
-}
-
-struct consfront_dev *init_consfront(char *_nodename)
-{
-    xenbus_transaction_t xbt;
-    char* err;
-    char* message=NULL;
-    int retry=0;
-    char* msg = NULL;
-    char nodename[256];
-    char path[256];
-    static int consfrontends = 3;
-    struct consfront_dev *dev;
-    int res;
-
-    if (!_nodename)
-        snprintf(nodename, sizeof(nodename), "device/console/%d", consfrontends);
-    else
-        strncpy(nodename, _nodename, sizeof(nodename));
-
-    printk("******************* CONSFRONT for %s **********\n\n\n", nodename);
-
-    consfrontends++;
-    dev = malloc(sizeof(*dev));
-    memset(dev, 0, sizeof(*dev));
-    dev->nodename = strdup(nodename);
-#ifdef HAVE_LIBC
-    dev->fd = -1;
-#endif
-
-    snprintf(path, sizeof(path), "%s/backend-id", nodename);
-    if ((res = xenbus_read_integer(path)) < 0) 
-        return NULL;
-    else
-        dev->dom = res;
-    evtchn_alloc_unbound(dev->dom, handle_input, dev, &dev->evtchn);
-
-    dev->ring = (struct xencons_interface *) alloc_page();
-    memset(dev->ring, 0, PAGE_SIZE);
-    dev->ring_ref = gnttab_grant_access(dev->dom, virt_to_mfn(dev->ring), 0);
-
-    dev->events = NULL;
-
-again:
-    err = xenbus_transaction_start(&xbt);
-    if (err) {
-        printk("starting transaction\n");
-        free(err);
-    }
-
-    err = xenbus_printf(xbt, nodename, "ring-ref","%u",
-                dev->ring_ref);
-    if (err) {
-        message = "writing ring-ref";
-        goto abort_transaction;
-    }
-    err = xenbus_printf(xbt, nodename,
-                "port", "%u", dev->evtchn);
-    if (err) {
-        message = "writing event-channel";
-        goto abort_transaction;
-    }
-    err = xenbus_printf(xbt, nodename,
-                "protocol", "%s", XEN_IO_PROTO_ABI_NATIVE);
-    if (err) {
-        message = "writing protocol";
-        goto abort_transaction;
-    }
-
-    err = xenbus_printf(xbt, nodename, "type", "%s", "ioemu");
-    if (err) {
-        message = "writing type";
-        goto abort_transaction;
-    }
-
-    snprintf(path, sizeof(path), "%s/state", nodename);
-    err = xenbus_switch_state(xbt, path, XenbusStateConnected);
-    if (err) {
-        message = "switching state";
-        goto abort_transaction;
-    }
-
-
-    err = xenbus_transaction_end(xbt, 0, &retry);
-    if (err) free(err);
-    if (retry) {
-            goto again;
-        printk("completing transaction\n");
-    }
-
-    goto done;
-
-abort_transaction:
-    free(err);
-    err = xenbus_transaction_end(xbt, 1, &retry);
-    printk("Abort transaction %s\n", message);
-    goto error;
-
-done:
-
-    snprintf(path, sizeof(path), "%s/backend", nodename);
-    msg = xenbus_read(XBT_NIL, path, &dev->backend);
-    if (msg) {
-        printk("Error %s when reading the backend path %s\n", msg, path);
-        goto error;
-    }
-
-    printk("backend at %s\n", dev->backend);
-
-    {
-        XenbusState state;
-        char path[strlen(dev->backend) + 1 + 19 + 1];
-        snprintf(path, sizeof(path), "%s/state", dev->backend);
-        
-	xenbus_watch_path_token(XBT_NIL, path, path, &dev->events);
-        msg = NULL;
-        state = xenbus_read_integer(path);
-        while (msg == NULL && state < XenbusStateConnected)
-            msg = xenbus_wait_for_state_change(path, &state, &dev->events);
-        if (msg != NULL || state != XenbusStateConnected) {
-            printk("backend not available, state=%d\n", state);
-            xenbus_unwatch_path_token(XBT_NIL, path, path);
-            goto error;
-        }
-    }
-    unmask_evtchn(dev->evtchn);
-
-    printk("**************************\n");
-
-    return dev;
-
-error:
-    free(msg);
-    free(err);
-    free_consfront(dev);
-    return NULL;
-}
-
 void xencons_resume(void)
 {
 	(void)xencons_ring_init();
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/include/lib.h
--- a/extras/mini-os/include/lib.h	Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/include/lib.h	Thu Feb 09 18:33:32 2012 +0000
@@ -184,11 +184,13 @@
 	struct {
 	    struct consfront_dev *dev;
 	} cons;
+#ifdef CONFIG_XENBUS
         struct {
             /* To each xenbus FD is associated a queue of watch events for this
              * FD.  */
             xenbus_event_queue events;
         } xenbus;
+#endif
     };
     int read;	/* maybe available for read */
 } files[];
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/include/xenbus.h
--- a/extras/mini-os/include/xenbus.h	Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/include/xenbus.h	Thu Feb 09 18:33:32 2012 +0000
@@ -6,8 +6,14 @@
 typedef unsigned long xenbus_transaction_t;
 #define XBT_NIL ((xenbus_transaction_t)0)
 
+#ifdef CONFIG_XENBUS
 /* Initialize the XenBus system. */
 void init_xenbus(void);
+#else
+static inline void init_xenbus(void)
+{
+}
+#endif
 
 /* Read the value associated with a path.  Returns a malloc'd error
    string on failure and sets *value to NULL.  On success, *value is
@@ -98,7 +104,13 @@
 /* Utility function to figure out our domain id */
 domid_t xenbus_get_self_id(void);
 
+#ifdef CONFIG_XENBUS
 /* Reset the XenBus system. */
 void fini_xenbus(void);
+#else
+static inline void fini_xenbus(void)
+{
+}
+#endif
 
 #endif /* XENBUS_H__ */
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/kernel.c
--- a/extras/mini-os/kernel.c	Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/kernel.c	Thu Feb 09 18:33:32 2012 +0000
@@ -142,10 +142,6 @@
     /* Reset grant tables */
     fini_gnttab();
 
-    /* Reset the console driver. */
-    fini_console(NULL);
-    /* TODO: record new ring mfn & event in start_info */
-
     /* Reset XenBus */
     fini_xenbus();
 
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/lib/sys.c
--- a/extras/mini-os/lib/sys.c	Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/lib/sys.c	Thu Feb 09 18:33:32 2012 +0000
@@ -164,6 +164,7 @@
     return -1;
 }
 
+#ifdef CONFIG_CONSFRONT
 int posix_openpt(int flags)
 {
     struct consfront_dev *dev;
@@ -192,6 +193,18 @@
     printk("fd(%d) = open_savefile\n", dev->fd);
     return(dev->fd);
 }
+#else
+int posix_openpt(int flags)
+{
+	errno = EIO;
+	return -1;
+}
+int open_savefile(const char *path, int save)
+{
+	errno = EIO;
+	return -1;
+}
+#endif
 
 int open(const char *pathname, int flags, ...)
 {
@@ -241,6 +254,7 @@
 	case FTYPE_SOCKET:
 	    return lwip_read(files[fd].socket.fd, buf, nbytes);
 #endif
+#ifdef CONFIG_NETFRONT
 	case FTYPE_TAP: {
 	    ssize_t ret;
 	    ret = netfront_receive(files[fd].tap.dev, buf, nbytes);
@@ -250,6 +264,8 @@
 	    }
 	    return ret;
 	}
+#endif
+#ifdef CONFIG_KBDFRONT
         case FTYPE_KBD: {
             int ret, n;
             n = nbytes / sizeof(union xenkbd_in_event);
@@ -260,6 +276,8 @@
 	    }
 	    return ret * sizeof(union xenkbd_in_event);
         }
+#endif
+#ifdef CONFIG_FBFRONT
         case FTYPE_FB: {
             int ret, n;
             n = nbytes / sizeof(union xenfb_in_event);
@@ -270,6 +288,7 @@
 	    }
 	    return ret * sizeof(union xenfb_in_event);
         }
+#endif
 	default:
 	    break;
     }
@@ -297,9 +316,11 @@
 	case FTYPE_SOCKET:
 	    return lwip_write(files[fd].socket.fd, (void*) buf, nbytes);
 #endif
+#ifdef CONFIG_NETFRONT
 	case FTYPE_TAP:
 	    netfront_xmit(files[fd].tap.dev, (void*) buf, nbytes);
 	    return nbytes;
+#endif
 	default:
 	    break;
     }
@@ -326,9 +347,11 @@
         default:
 	    files[fd].type = FTYPE_NONE;
 	    return 0;
+#ifdef CONFIG_XENBUS
 	case FTYPE_XENBUS:
             xs_daemon_close((void*)(intptr_t) fd);
             return 0;
+#endif
 #ifdef HAVE_LWIP
 	case FTYPE_SOCKET: {
 	    int res = lwip_close(files[fd].socket.fd);
@@ -345,27 +368,37 @@
 	case FTYPE_GNTMAP:
 	    minios_gnttab_close_fd(fd);
 	    return 0;
+#ifdef CONFIG_NETFRONT
 	case FTYPE_TAP:
 	    shutdown_netfront(files[fd].tap.dev);
 	    files[fd].type = FTYPE_NONE;
 	    return 0;
+#endif
+#ifdef CONFIG_BLKFRONT
 	case FTYPE_BLK:
             shutdown_blkfront(files[fd].blk.dev);
 	    files[fd].type = FTYPE_NONE;
 	    return 0;
+#endif
+#ifdef CONFIG_KBDFRONT
 	case FTYPE_KBD:
             shutdown_kbdfront(files[fd].kbd.dev);
             files[fd].type = FTYPE_NONE;
             return 0;
+#endif
+#ifdef CONFIG_FBFRONT
 	case FTYPE_FB:
             shutdown_fbfront(files[fd].fb.dev);
             files[fd].type = FTYPE_NONE;
             return 0;
+#endif
+#ifdef CONFIG_CONSFRONT
         case FTYPE_SAVEFILE:
         case FTYPE_CONSOLE:
             fini_console(files[fd].cons.dev);
             files[fd].type = FTYPE_NONE;
             return 0;
+#endif
 	case FTYPE_NONE:
 	    break;
     }
@@ -611,6 +644,7 @@
                 n++;
 	    FD_CLR(i, exceptfds);
 	    break;
+#ifdef CONFIG_XENBUS
 	case FTYPE_XENBUS:
 	    if (FD_ISSET(i, readfds)) {
                 if (files[i].xenbus.events)
@@ -621,6 +655,7 @@
 	    FD_CLR(i, writefds);
 	    FD_CLR(i, exceptfds);
 	    break;
+#endif
 	case FTYPE_EVTCHN:
 	case FTYPE_TAP:
 	case FTYPE_BLK:
@@ -705,11 +740,19 @@
     fd_set myread, mywrite, myexcept;
     struct thread *thread = get_current();
     s_time_t start = NOW(), stop;
+#ifdef CONFIG_NETFRONT
     DEFINE_WAIT(netfront_w);
+#endif
     DEFINE_WAIT(event_w);
+#ifdef CONFIG_BLKFRONT
     DEFINE_WAIT(blkfront_w);
+#endif
+#ifdef CONFIG_XENBUS
     DEFINE_WAIT(xenbus_watch_w);
+#endif
+#ifdef CONFIG_KBDFRONT
     DEFINE_WAIT(kbdfront_w);
+#endif
     DEFINE_WAIT(console_w);
 
     assert(thread == main_thread);
@@ -727,11 +770,19 @@
     /* Tell people we're going to sleep before looking at what they are
      * saying, hence letting them wake us if events happen between here and
      * schedule() */
+#ifdef CONFIG_NETFRONT
     add_waiter(netfront_w, netfront_queue);
+#endif
     add_waiter(event_w, event_queue);
+#ifdef CONFIG_BLKFRONT
     add_waiter(blkfront_w, blkfront_queue);
+#endif
+#ifdef CONFIG_XENBUS
     add_waiter(xenbus_watch_w, xenbus_watch_queue);
+#endif
+#ifdef CONFIG_KBDFRONT
     add_waiter(kbdfront_w, kbdfront_queue);
+#endif
     add_waiter(console_w, console_queue);
 
     if (readfds)
@@ -814,11 +865,19 @@
     ret = -1;
 
 out:
+#ifdef CONFIG_NETFRONT
     remove_waiter(netfront_w, netfront_queue);
+#endif
     remove_waiter(event_w, event_queue);
+#ifdef CONFIG_BLKFRONT
     remove_waiter(blkfront_w, blkfront_queue);
+#endif
+#ifdef CONFIG_XENBUS
     remove_waiter(xenbus_watch_w, xenbus_watch_queue);
+#endif
+#ifdef CONFIG_KBDFRONT
     remove_waiter(kbdfront_w, kbdfront_queue);
+#endif
     remove_waiter(console_w, console_queue);
     return ret;
 }
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/main.c
--- a/extras/mini-os/main.c	Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/main.c	Thu Feb 09 18:33:32 2012 +0000
@@ -63,10 +63,12 @@
 #ifdef CONFIG_SPARSE_BSS
     sparse((unsigned long) &__app_bss_start, &__app_bss_end - &__app_bss_start);
 #endif
-#if defined(HAVE_LWIP) && defined(CONFIG_START_NETWORK)
+#if defined(HAVE_LWIP) && defined(CONFIG_START_NETWORK) && defined(CONFIG_NETFRONT)
     start_networking();
 #endif
+#ifdef CONFIG_PCIFRONT
     create_thread("pcifront", pcifront_watches, NULL);
+#endif
 
 #ifdef CONFIG_QEMU_XS_ARGS
     /* Fetch argc, argv from XenStore */
@@ -169,7 +171,7 @@
     close_all_files();
     __libc_fini_array();
     printk("main returned %d\n", ret);
-#ifdef HAVE_LWIP
+#if defined(HAVE_LWIP) && defined(CONFIG_NETFRONT)
     stop_networking();
 #endif
     stop_kernel();
diff -r 86dca025cc2d -r 585caf50a926 stubdom/ioemu-minios.cfg
--- a/stubdom/ioemu-minios.cfg	Thu Feb 09 18:33:31 2012 +0000
+++ b/stubdom/ioemu-minios.cfg	Thu Feb 09 18:33:32 2012 +0000
@@ -1,2 +1,3 @@
 CONFIG_START_NETWORK=n
 CONFIG_QEMU_XS_ARGS=y
+CONFIG_PCIFRONT=y

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eH-0003an-Ql; Sat, 11 Feb 2012 04:33:21 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eF-0003Yw-9d
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1328934745!53806609!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7802 invoked from network); 11 Feb 2012 04:32:26 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:26 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eB-0006Qu-Lj
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eB-0001BQ-HJ
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:15 +0000
Message-Id: <E1Rw4eB-0001BQ-HJ@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mini-os: make frontends and xenbus
	optional
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812412 0
# Node ID 585caf50a9260d3fc6a4ece0450d10d34e73489f
# Parent  86dca025cc2dbc74a7a0e71f3dd2aef747752dda
mini-os: make frontends and xenbus optional

This adds compile-time logic to disable certain frontends in mini-os:
 - pcifront is disabled by default, enabled for ioemu
 - blkfront, netfront, fbfront, kbdfront, consfront are enabled by default
 - xenbus is required for any frontend, and is enabled by default

If all frontends and xenbus are disabled, mini-os will run without
needing to communicate with xenstore, making it suitable to run the
xenstore daemon. The console frontend is not required for the initial
console, only consoles opened via openpt or ptmx.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/Makefile
--- a/extras/mini-os/Makefile	Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/Makefile	Thu Feb 09 18:33:32 2012 +0000
@@ -20,11 +20,25 @@
 CONFIG_SPARSE_BSS ?= y
 CONFIG_QEMU_XS_ARGS ?= n
 CONFIG_TEST ?= n
+CONFIG_PCIFRONT ?= n
+CONFIG_BLKFRONT ?= y
+CONFIG_NETFRONT ?= y
+CONFIG_FBFRONT ?= y
+CONFIG_KBDFRONT ?= y
+CONFIG_CONSFRONT ?= y
+CONFIG_XENBUS ?= y
 
 # Export config items as compiler directives
 flags-$(CONFIG_START_NETWORK) += -DCONFIG_START_NETWORK
 flags-$(CONFIG_SPARSE_BSS) += -DCONFIG_SPARSE_BSS
 flags-$(CONFIG_QEMU_XS_ARGS) += -DCONFIG_QEMU_XS_ARGS
+flags-$(CONFIG_PCIFRONT) += -DCONFIG_PCIFRONT
+flags-$(CONFIG_BLKFRONT) += -DCONFIG_BLKFRONT
+flags-$(CONFIG_NETFRONT) += -DCONFIG_NETFRONT
+flags-$(CONFIG_KBDFRONT) += -DCONFIG_KBDFRONT
+flags-$(CONFIG_FBFRONT) += -DCONFIG_FBFRONT
+flags-$(CONFIG_CONSFRONT) += -DCONFIG_CONSFRONT
+flags-$(CONFIG_XENBUS) += -DCONFIG_XENBUS
 
 DEF_CFLAGS += $(flags-y)
 
@@ -50,10 +64,10 @@
 # Subdirectories common to mini-os
 SUBDIRS := lib xenbus console
 
-src-y += blkfront.c
+src-$(CONFIG_BLKFRONT) += blkfront.c
 src-y += daytime.c
 src-y += events.c
-src-y += fbfront.c
+src-$(CONFIG_FBFRONT) += fbfront.c
 src-y += gntmap.c
 src-y += gnttab.c
 src-y += hypervisor.c
@@ -61,8 +75,8 @@
 src-y += lock.c
 src-y += main.c
 src-y += mm.c
-src-y += netfront.c
-src-y += pcifront.c
+src-$(CONFIG_NETFRONT) += netfront.c
+src-$(CONFIG_PCIFRONT) += pcifront.c
 src-y += sched.c
 src-$(CONFIG_TEST) += test.c
 
@@ -73,12 +87,13 @@
 src-y += lib/string.c
 src-y += lib/sys.c
 src-y += lib/xmalloc.c
-src-y += lib/xs.c
+src-$(CONFIG_XENBUS) += lib/xs.c
 
-src-y += xenbus/xenbus.c
+src-$(CONFIG_XENBUS) += xenbus/xenbus.c
 
 src-y += console/console.c
 src-y += console/xencons_ring.c
+src-$(CONFIG_CONSFRONT) += console/xenbus.c
 
 # The common mini-os objects to build.
 APP_OBJS :=
@@ -113,7 +128,10 @@
 LWC	:= $(shell find $(LWIPDIR)/ -type f -name '*.c')
 LWC	:= $(filter-out %6.c %ip6_addr.c %ethernetif.c, $(LWC))
 LWO	:= $(patsubst %.c,%.o,$(LWC))
-LWO	+= $(addprefix $(OBJ_DIR)/,lwip-arch.o lwip-net.o)
+LWO	+= $(OBJ_DIR)/lwip-arch.o
+ifeq ($(CONFIG_NETFRONT),y)
+LWO += $(OBJ_DIR)/lwip-net.o
+endif
 
 $(OBJ_DIR)/lwip.a: $(LWO)
 	$(RM) $@
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/console/console.c
--- a/extras/mini-os/console/console.c	Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/console/console.c	Thu Feb 09 18:33:32 2012 +0000
@@ -158,8 +158,3 @@
     /* This is also required to notify the daemon */
     printk("done.\n");
 }
-
-void fini_console(struct consfront_dev *dev)
-{
-    if (dev) free_consfront(dev);
-}
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/console/console.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/console/console.h	Thu Feb 09 18:33:32 2012 +0000
@@ -0,0 +1,2 @@
+
+void console_handle_input(evtchn_port_t port, struct pt_regs *regs, void *data);
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/console/xenbus.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/console/xenbus.c	Thu Feb 09 18:33:32 2012 +0000
@@ -0,0 +1,198 @@
+#include <mini-os/types.h>
+#include <mini-os/wait.h>
+#include <mini-os/mm.h>
+#include <mini-os/hypervisor.h>
+#include <mini-os/events.h>
+#include <mini-os/os.h>
+#include <mini-os/lib.h>
+#include <mini-os/xenbus.h>
+#include <xen/io/console.h>
+#include <xen/io/protocols.h>
+#include <xen/io/ring.h>
+#include <mini-os/xmalloc.h>
+#include <mini-os/gnttab.h>
+#include "console.h"
+
+void free_consfront(struct consfront_dev *dev)
+{
+    char* err = NULL;
+    XenbusState state;
+
+    char path[strlen(dev->backend) + 1 + 5 + 1];
+    char nodename[strlen(dev->nodename) + 1 + 5 + 1];
+
+    snprintf(path, sizeof(path), "%s/state", dev->backend);
+    snprintf(nodename, sizeof(nodename), "%s/state", dev->nodename);
+
+    if ((err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosing)) != NULL) {
+        printk("free_consfront: error changing state to %d: %s\n",
+                XenbusStateClosing, err);
+        goto close;
+    }
+    state = xenbus_read_integer(path);
+    while (err == NULL && state < XenbusStateClosing)
+        err = xenbus_wait_for_state_change(path, &state, &dev->events);
+    if (err) free(err);
+
+    if ((err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosed)) != NULL) {
+        printk("free_consfront: error changing state to %d: %s\n",
+                XenbusStateClosed, err);
+        goto close;
+    }
+
+close:
+    if (err) free(err);
+    xenbus_unwatch_path_token(XBT_NIL, path, path);
+
+    mask_evtchn(dev->evtchn);
+    unbind_evtchn(dev->evtchn);
+    free(dev->backend);
+    free(dev->nodename);
+
+    gnttab_end_access(dev->ring_ref);
+
+    free_page(dev->ring);
+    free(dev);
+}
+
+struct consfront_dev *init_consfront(char *_nodename)
+{
+    xenbus_transaction_t xbt;
+    char* err;
+    char* message=NULL;
+    int retry=0;
+    char* msg = NULL;
+    char nodename[256];
+    char path[256];
+    static int consfrontends = 3;
+    struct consfront_dev *dev;
+    int res;
+
+    if (!_nodename)
+        snprintf(nodename, sizeof(nodename), "device/console/%d", consfrontends);
+    else
+        strncpy(nodename, _nodename, sizeof(nodename));
+
+    printk("******************* CONSFRONT for %s **********\n\n\n", nodename);
+
+    consfrontends++;
+    dev = malloc(sizeof(*dev));
+    memset(dev, 0, sizeof(*dev));
+    dev->nodename = strdup(nodename);
+#ifdef HAVE_LIBC
+    dev->fd = -1;
+#endif
+
+    snprintf(path, sizeof(path), "%s/backend-id", nodename);
+    if ((res = xenbus_read_integer(path)) < 0) 
+        return NULL;
+    else
+        dev->dom = res;
+    evtchn_alloc_unbound(dev->dom, console_handle_input, dev, &dev->evtchn);
+
+    dev->ring = (struct xencons_interface *) alloc_page();
+    memset(dev->ring, 0, PAGE_SIZE);
+    dev->ring_ref = gnttab_grant_access(dev->dom, virt_to_mfn(dev->ring), 0);
+
+    dev->events = NULL;
+
+again:
+    err = xenbus_transaction_start(&xbt);
+    if (err) {
+        printk("starting transaction\n");
+        free(err);
+    }
+
+    err = xenbus_printf(xbt, nodename, "ring-ref","%u",
+                dev->ring_ref);
+    if (err) {
+        message = "writing ring-ref";
+        goto abort_transaction;
+    }
+    err = xenbus_printf(xbt, nodename,
+                "port", "%u", dev->evtchn);
+    if (err) {
+        message = "writing event-channel";
+        goto abort_transaction;
+    }
+    err = xenbus_printf(xbt, nodename,
+                "protocol", "%s", XEN_IO_PROTO_ABI_NATIVE);
+    if (err) {
+        message = "writing protocol";
+        goto abort_transaction;
+    }
+
+    err = xenbus_printf(xbt, nodename, "type", "%s", "ioemu");
+    if (err) {
+        message = "writing type";
+        goto abort_transaction;
+    }
+
+    snprintf(path, sizeof(path), "%s/state", nodename);
+    err = xenbus_switch_state(xbt, path, XenbusStateConnected);
+    if (err) {
+        message = "switching state";
+        goto abort_transaction;
+    }
+
+
+    err = xenbus_transaction_end(xbt, 0, &retry);
+    if (err) free(err);
+    if (retry) {
+            goto again;
+        printk("completing transaction\n");
+    }
+
+    goto done;
+
+abort_transaction:
+    free(err);
+    err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
+    goto error;
+
+done:
+
+    snprintf(path, sizeof(path), "%s/backend", nodename);
+    msg = xenbus_read(XBT_NIL, path, &dev->backend);
+    if (msg) {
+        printk("Error %s when reading the backend path %s\n", msg, path);
+        goto error;
+    }
+
+    printk("backend at %s\n", dev->backend);
+
+    {
+        XenbusState state;
+        char path[strlen(dev->backend) + 1 + 19 + 1];
+        snprintf(path, sizeof(path), "%s/state", dev->backend);
+        
+	xenbus_watch_path_token(XBT_NIL, path, path, &dev->events);
+        msg = NULL;
+        state = xenbus_read_integer(path);
+        while (msg == NULL && state < XenbusStateConnected)
+            msg = xenbus_wait_for_state_change(path, &state, &dev->events);
+        if (msg != NULL || state != XenbusStateConnected) {
+            printk("backend not available, state=%d\n", state);
+            xenbus_unwatch_path_token(XBT_NIL, path, path);
+            goto error;
+        }
+    }
+    unmask_evtchn(dev->evtchn);
+
+    printk("**************************\n");
+
+    return dev;
+
+error:
+    free(msg);
+    free(err);
+    free_consfront(dev);
+    return NULL;
+}
+
+void fini_console(struct consfront_dev *dev)
+{
+    if (dev) free_consfront(dev);
+}
+
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/console/xencons_ring.c
--- a/extras/mini-os/console/xencons_ring.c	Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/console/xencons_ring.c	Thu Feb 09 18:33:32 2012 +0000
@@ -11,6 +11,7 @@
 #include <xen/io/ring.h>
 #include <mini-os/xmalloc.h>
 #include <mini-os/gnttab.h>
+#include "console.h"
 
 DECLARE_WAIT_QUEUE_HEAD(console_queue);
 
@@ -70,7 +71,7 @@
 
 
 
-static void handle_input(evtchn_port_t port, struct pt_regs *regs, void *data)
+void console_handle_input(evtchn_port_t port, struct pt_regs *regs, void *data)
 {
 	struct consfront_dev *dev = (struct consfront_dev *) data;
 #ifdef HAVE_LIBC
@@ -173,7 +174,7 @@
 	dev->evtchn = start_info.console.domU.evtchn;
 	dev->ring = (struct xencons_interface *) mfn_to_virt(start_info.console.domU.mfn);
 
-	err = bind_evtchn(dev->evtchn, handle_input, dev);
+	err = bind_evtchn(dev->evtchn, console_handle_input, dev);
 	if (err <= 0) {
 		printk("XEN console request chn bind failed %i\n", err);
                 free(dev);
@@ -187,184 +188,6 @@
 	return dev;
 }
 
-void free_consfront(struct consfront_dev *dev)
-{
-    char* err = NULL;
-    XenbusState state;
-
-    char path[strlen(dev->backend) + 1 + 5 + 1];
-    char nodename[strlen(dev->nodename) + 1 + 5 + 1];
-
-    snprintf(path, sizeof(path), "%s/state", dev->backend);
-    snprintf(nodename, sizeof(nodename), "%s/state", dev->nodename);
-
-    if ((err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosing)) != NULL) {
-        printk("free_consfront: error changing state to %d: %s\n",
-                XenbusStateClosing, err);
-        goto close;
-    }
-    state = xenbus_read_integer(path);
-    while (err == NULL && state < XenbusStateClosing)
-        err = xenbus_wait_for_state_change(path, &state, &dev->events);
-    if (err) free(err);
-
-    if ((err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosed)) != NULL) {
-        printk("free_consfront: error changing state to %d: %s\n",
-                XenbusStateClosed, err);
-        goto close;
-    }
-
-close:
-    if (err) free(err);
-    xenbus_unwatch_path_token(XBT_NIL, path, path);
-
-    mask_evtchn(dev->evtchn);
-    unbind_evtchn(dev->evtchn);
-    free(dev->backend);
-    free(dev->nodename);
-
-    gnttab_end_access(dev->ring_ref);
-
-    free_page(dev->ring);
-    free(dev);
-}
-
-struct consfront_dev *init_consfront(char *_nodename)
-{
-    xenbus_transaction_t xbt;
-    char* err;
-    char* message=NULL;
-    int retry=0;
-    char* msg = NULL;
-    char nodename[256];
-    char path[256];
-    static int consfrontends = 3;
-    struct consfront_dev *dev;
-    int res;
-
-    if (!_nodename)
-        snprintf(nodename, sizeof(nodename), "device/console/%d", consfrontends);
-    else
-        strncpy(nodename, _nodename, sizeof(nodename));
-
-    printk("******************* CONSFRONT for %s **********\n\n\n", nodename);
-
-    consfrontends++;
-    dev = malloc(sizeof(*dev));
-    memset(dev, 0, sizeof(*dev));
-    dev->nodename = strdup(nodename);
-#ifdef HAVE_LIBC
-    dev->fd = -1;
-#endif
-
-    snprintf(path, sizeof(path), "%s/backend-id", nodename);
-    if ((res = xenbus_read_integer(path)) < 0) 
-        return NULL;
-    else
-        dev->dom = res;
-    evtchn_alloc_unbound(dev->dom, handle_input, dev, &dev->evtchn);
-
-    dev->ring = (struct xencons_interface *) alloc_page();
-    memset(dev->ring, 0, PAGE_SIZE);
-    dev->ring_ref = gnttab_grant_access(dev->dom, virt_to_mfn(dev->ring), 0);
-
-    dev->events = NULL;
-
-again:
-    err = xenbus_transaction_start(&xbt);
-    if (err) {
-        printk("starting transaction\n");
-        free(err);
-    }
-
-    err = xenbus_printf(xbt, nodename, "ring-ref","%u",
-                dev->ring_ref);
-    if (err) {
-        message = "writing ring-ref";
-        goto abort_transaction;
-    }
-    err = xenbus_printf(xbt, nodename,
-                "port", "%u", dev->evtchn);
-    if (err) {
-        message = "writing event-channel";
-        goto abort_transaction;
-    }
-    err = xenbus_printf(xbt, nodename,
-                "protocol", "%s", XEN_IO_PROTO_ABI_NATIVE);
-    if (err) {
-        message = "writing protocol";
-        goto abort_transaction;
-    }
-
-    err = xenbus_printf(xbt, nodename, "type", "%s", "ioemu");
-    if (err) {
-        message = "writing type";
-        goto abort_transaction;
-    }
-
-    snprintf(path, sizeof(path), "%s/state", nodename);
-    err = xenbus_switch_state(xbt, path, XenbusStateConnected);
-    if (err) {
-        message = "switching state";
-        goto abort_transaction;
-    }
-
-
-    err = xenbus_transaction_end(xbt, 0, &retry);
-    if (err) free(err);
-    if (retry) {
-            goto again;
-        printk("completing transaction\n");
-    }
-
-    goto done;
-
-abort_transaction:
-    free(err);
-    err = xenbus_transaction_end(xbt, 1, &retry);
-    printk("Abort transaction %s\n", message);
-    goto error;
-
-done:
-
-    snprintf(path, sizeof(path), "%s/backend", nodename);
-    msg = xenbus_read(XBT_NIL, path, &dev->backend);
-    if (msg) {
-        printk("Error %s when reading the backend path %s\n", msg, path);
-        goto error;
-    }
-
-    printk("backend at %s\n", dev->backend);
-
-    {
-        XenbusState state;
-        char path[strlen(dev->backend) + 1 + 19 + 1];
-        snprintf(path, sizeof(path), "%s/state", dev->backend);
-        
-	xenbus_watch_path_token(XBT_NIL, path, path, &dev->events);
-        msg = NULL;
-        state = xenbus_read_integer(path);
-        while (msg == NULL && state < XenbusStateConnected)
-            msg = xenbus_wait_for_state_change(path, &state, &dev->events);
-        if (msg != NULL || state != XenbusStateConnected) {
-            printk("backend not available, state=%d\n", state);
-            xenbus_unwatch_path_token(XBT_NIL, path, path);
-            goto error;
-        }
-    }
-    unmask_evtchn(dev->evtchn);
-
-    printk("**************************\n");
-
-    return dev;
-
-error:
-    free(msg);
-    free(err);
-    free_consfront(dev);
-    return NULL;
-}
-
 void xencons_resume(void)
 {
 	(void)xencons_ring_init();
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/include/lib.h
--- a/extras/mini-os/include/lib.h	Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/include/lib.h	Thu Feb 09 18:33:32 2012 +0000
@@ -184,11 +184,13 @@
 	struct {
 	    struct consfront_dev *dev;
 	} cons;
+#ifdef CONFIG_XENBUS
         struct {
             /* To each xenbus FD is associated a queue of watch events for this
              * FD.  */
             xenbus_event_queue events;
         } xenbus;
+#endif
     };
     int read;	/* maybe available for read */
 } files[];
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/include/xenbus.h
--- a/extras/mini-os/include/xenbus.h	Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/include/xenbus.h	Thu Feb 09 18:33:32 2012 +0000
@@ -6,8 +6,14 @@
 typedef unsigned long xenbus_transaction_t;
 #define XBT_NIL ((xenbus_transaction_t)0)
 
+#ifdef CONFIG_XENBUS
 /* Initialize the XenBus system. */
 void init_xenbus(void);
+#else
+static inline void init_xenbus(void)
+{
+}
+#endif
 
 /* Read the value associated with a path.  Returns a malloc'd error
    string on failure and sets *value to NULL.  On success, *value is
@@ -98,7 +104,13 @@
 /* Utility function to figure out our domain id */
 domid_t xenbus_get_self_id(void);
 
+#ifdef CONFIG_XENBUS
 /* Reset the XenBus system. */
 void fini_xenbus(void);
+#else
+static inline void fini_xenbus(void)
+{
+}
+#endif
 
 #endif /* XENBUS_H__ */
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/kernel.c
--- a/extras/mini-os/kernel.c	Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/kernel.c	Thu Feb 09 18:33:32 2012 +0000
@@ -142,10 +142,6 @@
     /* Reset grant tables */
     fini_gnttab();
 
-    /* Reset the console driver. */
-    fini_console(NULL);
-    /* TODO: record new ring mfn & event in start_info */
-
     /* Reset XenBus */
     fini_xenbus();
 
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/lib/sys.c
--- a/extras/mini-os/lib/sys.c	Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/lib/sys.c	Thu Feb 09 18:33:32 2012 +0000
@@ -164,6 +164,7 @@
     return -1;
 }
 
+#ifdef CONFIG_CONSFRONT
 int posix_openpt(int flags)
 {
     struct consfront_dev *dev;
@@ -192,6 +193,18 @@
     printk("fd(%d) = open_savefile\n", dev->fd);
     return(dev->fd);
 }
+#else
+int posix_openpt(int flags)
+{
+	errno = EIO;
+	return -1;
+}
+int open_savefile(const char *path, int save)
+{
+	errno = EIO;
+	return -1;
+}
+#endif
 
 int open(const char *pathname, int flags, ...)
 {
@@ -241,6 +254,7 @@
 	case FTYPE_SOCKET:
 	    return lwip_read(files[fd].socket.fd, buf, nbytes);
 #endif
+#ifdef CONFIG_NETFRONT
 	case FTYPE_TAP: {
 	    ssize_t ret;
 	    ret = netfront_receive(files[fd].tap.dev, buf, nbytes);
@@ -250,6 +264,8 @@
 	    }
 	    return ret;
 	}
+#endif
+#ifdef CONFIG_KBDFRONT
         case FTYPE_KBD: {
             int ret, n;
             n = nbytes / sizeof(union xenkbd_in_event);
@@ -260,6 +276,8 @@
 	    }
 	    return ret * sizeof(union xenkbd_in_event);
         }
+#endif
+#ifdef CONFIG_FBFRONT
         case FTYPE_FB: {
             int ret, n;
             n = nbytes / sizeof(union xenfb_in_event);
@@ -270,6 +288,7 @@
 	    }
 	    return ret * sizeof(union xenfb_in_event);
         }
+#endif
 	default:
 	    break;
     }
@@ -297,9 +316,11 @@
 	case FTYPE_SOCKET:
 	    return lwip_write(files[fd].socket.fd, (void*) buf, nbytes);
 #endif
+#ifdef CONFIG_NETFRONT
 	case FTYPE_TAP:
 	    netfront_xmit(files[fd].tap.dev, (void*) buf, nbytes);
 	    return nbytes;
+#endif
 	default:
 	    break;
     }
@@ -326,9 +347,11 @@
         default:
 	    files[fd].type = FTYPE_NONE;
 	    return 0;
+#ifdef CONFIG_XENBUS
 	case FTYPE_XENBUS:
             xs_daemon_close((void*)(intptr_t) fd);
             return 0;
+#endif
 #ifdef HAVE_LWIP
 	case FTYPE_SOCKET: {
 	    int res = lwip_close(files[fd].socket.fd);
@@ -345,27 +368,37 @@
 	case FTYPE_GNTMAP:
 	    minios_gnttab_close_fd(fd);
 	    return 0;
+#ifdef CONFIG_NETFRONT
 	case FTYPE_TAP:
 	    shutdown_netfront(files[fd].tap.dev);
 	    files[fd].type = FTYPE_NONE;
 	    return 0;
+#endif
+#ifdef CONFIG_BLKFRONT
 	case FTYPE_BLK:
             shutdown_blkfront(files[fd].blk.dev);
 	    files[fd].type = FTYPE_NONE;
 	    return 0;
+#endif
+#ifdef CONFIG_KBDFRONT
 	case FTYPE_KBD:
             shutdown_kbdfront(files[fd].kbd.dev);
             files[fd].type = FTYPE_NONE;
             return 0;
+#endif
+#ifdef CONFIG_FBFRONT
 	case FTYPE_FB:
             shutdown_fbfront(files[fd].fb.dev);
             files[fd].type = FTYPE_NONE;
             return 0;
+#endif
+#ifdef CONFIG_CONSFRONT
         case FTYPE_SAVEFILE:
         case FTYPE_CONSOLE:
             fini_console(files[fd].cons.dev);
             files[fd].type = FTYPE_NONE;
             return 0;
+#endif
 	case FTYPE_NONE:
 	    break;
     }
@@ -611,6 +644,7 @@
                 n++;
 	    FD_CLR(i, exceptfds);
 	    break;
+#ifdef CONFIG_XENBUS
 	case FTYPE_XENBUS:
 	    if (FD_ISSET(i, readfds)) {
                 if (files[i].xenbus.events)
@@ -621,6 +655,7 @@
 	    FD_CLR(i, writefds);
 	    FD_CLR(i, exceptfds);
 	    break;
+#endif
 	case FTYPE_EVTCHN:
 	case FTYPE_TAP:
 	case FTYPE_BLK:
@@ -705,11 +740,19 @@
     fd_set myread, mywrite, myexcept;
     struct thread *thread = get_current();
     s_time_t start = NOW(), stop;
+#ifdef CONFIG_NETFRONT
     DEFINE_WAIT(netfront_w);
+#endif
     DEFINE_WAIT(event_w);
+#ifdef CONFIG_BLKFRONT
     DEFINE_WAIT(blkfront_w);
+#endif
+#ifdef CONFIG_XENBUS
     DEFINE_WAIT(xenbus_watch_w);
+#endif
+#ifdef CONFIG_KBDFRONT
     DEFINE_WAIT(kbdfront_w);
+#endif
     DEFINE_WAIT(console_w);
 
     assert(thread == main_thread);
@@ -727,11 +770,19 @@
     /* Tell people we're going to sleep before looking at what they are
      * saying, hence letting them wake us if events happen between here and
      * schedule() */
+#ifdef CONFIG_NETFRONT
     add_waiter(netfront_w, netfront_queue);
+#endif
     add_waiter(event_w, event_queue);
+#ifdef CONFIG_BLKFRONT
     add_waiter(blkfront_w, blkfront_queue);
+#endif
+#ifdef CONFIG_XENBUS
     add_waiter(xenbus_watch_w, xenbus_watch_queue);
+#endif
+#ifdef CONFIG_KBDFRONT
     add_waiter(kbdfront_w, kbdfront_queue);
+#endif
     add_waiter(console_w, console_queue);
 
     if (readfds)
@@ -814,11 +865,19 @@
     ret = -1;
 
 out:
+#ifdef CONFIG_NETFRONT
     remove_waiter(netfront_w, netfront_queue);
+#endif
     remove_waiter(event_w, event_queue);
+#ifdef CONFIG_BLKFRONT
     remove_waiter(blkfront_w, blkfront_queue);
+#endif
+#ifdef CONFIG_XENBUS
     remove_waiter(xenbus_watch_w, xenbus_watch_queue);
+#endif
+#ifdef CONFIG_KBDFRONT
     remove_waiter(kbdfront_w, kbdfront_queue);
+#endif
     remove_waiter(console_w, console_queue);
     return ret;
 }
diff -r 86dca025cc2d -r 585caf50a926 extras/mini-os/main.c
--- a/extras/mini-os/main.c	Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/main.c	Thu Feb 09 18:33:32 2012 +0000
@@ -63,10 +63,12 @@
 #ifdef CONFIG_SPARSE_BSS
     sparse((unsigned long) &__app_bss_start, &__app_bss_end - &__app_bss_start);
 #endif
-#if defined(HAVE_LWIP) && defined(CONFIG_START_NETWORK)
+#if defined(HAVE_LWIP) && defined(CONFIG_START_NETWORK) && defined(CONFIG_NETFRONT)
     start_networking();
 #endif
+#ifdef CONFIG_PCIFRONT
     create_thread("pcifront", pcifront_watches, NULL);
+#endif
 
 #ifdef CONFIG_QEMU_XS_ARGS
     /* Fetch argc, argv from XenStore */
@@ -169,7 +171,7 @@
     close_all_files();
     __libc_fini_array();
     printk("main returned %d\n", ret);
-#ifdef HAVE_LWIP
+#if defined(HAVE_LWIP) && defined(CONFIG_NETFRONT)
     stop_networking();
 #endif
     stop_kernel();
diff -r 86dca025cc2d -r 585caf50a926 stubdom/ioemu-minios.cfg
--- a/stubdom/ioemu-minios.cfg	Thu Feb 09 18:33:31 2012 +0000
+++ b/stubdom/ioemu-minios.cfg	Thu Feb 09 18:33:32 2012 +0000
@@ -1,2 +1,3 @@
 CONFIG_START_NETWORK=n
 CONFIG_QEMU_XS_ARGS=y
+CONFIG_PCIFRONT=y

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eH-0003ag-Mm; Sat, 11 Feb 2012 04:33:21 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eF-0003Xq-BL
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1328934728!60651285!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18010 invoked from network); 11 Feb 2012 04:32:09 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e7-0006QW-QL
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e7-00018F-9o
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:11 +0000
Message-Id: <E1Rw4e7-00018F-9o@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Add
	device_model_stubdomain_seclabel
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328811915 0
# Node ID 90fbc6b03d2f85577642c591d482ccc3dac532ae
# Parent  0f9e4b424d7c55e5ebfbfe933ceeb647f2cd6176
libxl: Add device_model_stubdomain_seclabel

This allows the security label of stub domains to be specified.

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 0f9e4b424d7c -r 90fbc6b03d2f docs/man/xl.cfg.pod.5
--- a/docs/man/xl.cfg.pod.5	Thu Feb 09 18:07:48 2012 +0000
+++ b/docs/man/xl.cfg.pod.5	Thu Feb 09 18:25:15 2012 +0000
@@ -789,6 +789,10 @@
 be automatically selected based upon the other features and options
 you have selected.
 
+=item B<device_model_stubdomain_seclabel="LABEL">
+
+Assign an XSM security label to the device-model stubdomain.
+
 =item B<device_model_args=[ "ARG", "ARG", ...]>
 
 Pass additional arbitrary options on the devide-model command
diff -r 0f9e4b424d7c -r 90fbc6b03d2f tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Thu Feb 09 18:07:48 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Thu Feb 09 18:25:15 2012 +0000
@@ -703,6 +703,7 @@
     dm_config.c_info.type = LIBXL_DOMAIN_TYPE_PV;
     dm_config.c_info.name = libxl__sprintf(gc, "%s-dm",
                                     libxl__domid_to_name(gc, guest_domid));
+    dm_config.c_info.ssidref = guest_config->b_info.device_model_ssidref;
 
     libxl_uuid_generate(&dm_config.c_info.uuid);
 
diff -r 0f9e4b424d7c -r 90fbc6b03d2f tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Thu Feb 09 18:07:48 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Thu Feb 09 18:25:15 2012 +0000
@@ -217,6 +217,7 @@
     ("device_model_stubdomain", bool),
     # you set device_model you must set device_model_version too
     ("device_model",     string),
+    ("device_model_ssidref", uint32),
 
     # extra parameters pass directly to qemu, NULL terminated
     ("extra",            libxl_string_list),
diff -r 0f9e4b424d7c -r 90fbc6b03d2f tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Thu Feb 09 18:07:48 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Thu Feb 09 18:25:15 2012 +0000
@@ -1134,6 +1134,21 @@
     if (!xlu_cfg_get_long (config, "device_model_stubdomain_override", &l, 0))
         b_info->device_model_stubdomain = l;
 
+    if (!xlu_cfg_get_string (config, "device_model_stubdomain_seclabel",
+                             &buf, 0)) {
+        e = libxl_flask_context_to_sid(ctx, (char *)buf, strlen(buf),
+                                    &b_info->device_model_ssidref);
+        if (e) {
+            if (errno == ENOSYS) {
+                fprintf(stderr, "XSM Disabled:"
+                        " device_model_stubdomain_seclabel not supported\n");
+            } else {
+                fprintf(stderr, "Invalid device_model_stubdomain_seclabel:"
+                        " %s\n", buf);
+                exit(1);
+            }
+        }
+    }
 #define parse_extra_args(type)                                            \
     e = xlu_cfg_get_list_as_string_list(config, "device_model_args"#type, \
                                     &b_info->extra##type, 0);            \

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eH-0003ay-Ve; Sat, 11 Feb 2012 04:33:21 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eF-0003Xr-I3
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1328934791!12894669!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11120 invoked from network); 11 Feb 2012 04:33:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e6-0006QT-SL
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e6-00017q-O9
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:10 +0000
Message-Id: <E1Rw4e6-00017q-O9@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: helper function to send
	commands to traditional qemu
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Shriram Rajagopalan <rshriram@cs.ubc.ca>
# Date 1328810868 0
# Node ID 0f9e4b424d7c55e5ebfbfe933ceeb647f2cd6176
# Parent  af96b99b607da7d2923cf522acf149f41d8b230c
libxl: helper function to send commands to traditional qemu

Introduce a helper function to send commands to traditional
qemu. qemu_pci_add_xenstore, qemu_pci_remove_xenstore,
libxl__domain_save_device_model and libxl_domain_unpause have
been refactored to use this function.

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r af96b99b607d -r 0f9e4b424d7c tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Thu Feb 09 18:06:24 2012 +0000
+++ b/tools/libxl/libxl.c	Thu Feb 09 18:07:48 2012 +0000
@@ -586,7 +586,7 @@
         path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
         state = libxl__xs_read(gc, XBT_NULL, path);
         if (state != NULL && !strcmp(state, "paused")) {
-            libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "/local/domain/0/device-model/%d/command", domid), "continue");
+            libxl__qemu_traditional_cmd(gc, domid, "continue");
             libxl__wait_for_device_model(gc, domid, "running",
                                          NULL, NULL, NULL);
         }
diff -r af96b99b607d -r 0f9e4b424d7c tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c	Thu Feb 09 18:06:24 2012 +0000
+++ b/tools/libxl/libxl_dom.c	Thu Feb 09 18:07:48 2012 +0000
@@ -355,6 +355,15 @@
     return rc;
 }
 
+int libxl__qemu_traditional_cmd(libxl__gc *gc, uint32_t domid,
+                                const char *cmd)
+{
+    char *path = NULL;
+    path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/command",
+                          domid);
+    return libxl__xs_write(gc, XBT_NULL, path, "%s", cmd);
+}
+
 int libxl__domain_restore_common(libxl__gc *gc, uint32_t domid,
                                  libxl_domain_build_info *info,
                                  libxl__domain_build_state *state,
@@ -637,12 +646,9 @@
 
     switch (libxl__device_model_version_running(gc, domid)) {
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: {
-        char *path = NULL;
         LIBXL__LOG(ctx, LIBXL__LOG_DEBUG,
                    "Saving device model state to %s", filename);
-        path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/command",
-                              domid);
-        libxl__xs_write(gc, XBT_NULL, path, "save");
+        libxl__qemu_traditional_cmd(gc, domid, "save");
         libxl__wait_for_device_model(gc, domid, "paused", NULL, NULL, NULL);
         break;
     }
diff -r af96b99b607d -r 0f9e4b424d7c tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Thu Feb 09 18:06:24 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Thu Feb 09 18:07:48 2012 +0000
@@ -617,6 +617,8 @@
               libxl_domain_build_info *info,
               libxl__domain_build_state *state);
 
+_hidden int libxl__qemu_traditional_cmd(libxl__gc *gc, uint32_t domid,
+                                        const char *cmd);
 _hidden int libxl__domain_rename(libxl__gc *gc, uint32_t domid,
                                  const char *old_name, const char *new_name,
                                  xs_transaction_t trans);
diff -r af96b99b607d -r 0f9e4b424d7c tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Thu Feb 09 18:06:24 2012 +0000
+++ b/tools/libxl/libxl_pci.c	Thu Feb 09 18:07:48 2012 +0000
@@ -602,9 +602,8 @@
         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"));
+
+    libxl__qemu_traditional_cmd(gc, domid, "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",
@@ -857,12 +856,11 @@
     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"));
+        libxl__qemu_traditional_cmd(gc, domid, "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");

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eH-0003ag-Mm; Sat, 11 Feb 2012 04:33:21 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eF-0003Xq-BL
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1328934728!60651285!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18010 invoked from network); 11 Feb 2012 04:32:09 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e7-0006QW-QL
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e7-00018F-9o
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:11 +0000
Message-Id: <E1Rw4e7-00018F-9o@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Add
	device_model_stubdomain_seclabel
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328811915 0
# Node ID 90fbc6b03d2f85577642c591d482ccc3dac532ae
# Parent  0f9e4b424d7c55e5ebfbfe933ceeb647f2cd6176
libxl: Add device_model_stubdomain_seclabel

This allows the security label of stub domains to be specified.

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 0f9e4b424d7c -r 90fbc6b03d2f docs/man/xl.cfg.pod.5
--- a/docs/man/xl.cfg.pod.5	Thu Feb 09 18:07:48 2012 +0000
+++ b/docs/man/xl.cfg.pod.5	Thu Feb 09 18:25:15 2012 +0000
@@ -789,6 +789,10 @@
 be automatically selected based upon the other features and options
 you have selected.
 
+=item B<device_model_stubdomain_seclabel="LABEL">
+
+Assign an XSM security label to the device-model stubdomain.
+
 =item B<device_model_args=[ "ARG", "ARG", ...]>
 
 Pass additional arbitrary options on the devide-model command
diff -r 0f9e4b424d7c -r 90fbc6b03d2f tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Thu Feb 09 18:07:48 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Thu Feb 09 18:25:15 2012 +0000
@@ -703,6 +703,7 @@
     dm_config.c_info.type = LIBXL_DOMAIN_TYPE_PV;
     dm_config.c_info.name = libxl__sprintf(gc, "%s-dm",
                                     libxl__domid_to_name(gc, guest_domid));
+    dm_config.c_info.ssidref = guest_config->b_info.device_model_ssidref;
 
     libxl_uuid_generate(&dm_config.c_info.uuid);
 
diff -r 0f9e4b424d7c -r 90fbc6b03d2f tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Thu Feb 09 18:07:48 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Thu Feb 09 18:25:15 2012 +0000
@@ -217,6 +217,7 @@
     ("device_model_stubdomain", bool),
     # you set device_model you must set device_model_version too
     ("device_model",     string),
+    ("device_model_ssidref", uint32),
 
     # extra parameters pass directly to qemu, NULL terminated
     ("extra",            libxl_string_list),
diff -r 0f9e4b424d7c -r 90fbc6b03d2f tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Thu Feb 09 18:07:48 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Thu Feb 09 18:25:15 2012 +0000
@@ -1134,6 +1134,21 @@
     if (!xlu_cfg_get_long (config, "device_model_stubdomain_override", &l, 0))
         b_info->device_model_stubdomain = l;
 
+    if (!xlu_cfg_get_string (config, "device_model_stubdomain_seclabel",
+                             &buf, 0)) {
+        e = libxl_flask_context_to_sid(ctx, (char *)buf, strlen(buf),
+                                    &b_info->device_model_ssidref);
+        if (e) {
+            if (errno == ENOSYS) {
+                fprintf(stderr, "XSM Disabled:"
+                        " device_model_stubdomain_seclabel not supported\n");
+            } else {
+                fprintf(stderr, "Invalid device_model_stubdomain_seclabel:"
+                        " %s\n", buf);
+                exit(1);
+            }
+        }
+    }
 #define parse_extra_args(type)                                            \
     e = xlu_cfg_get_list_as_string_list(config, "device_model_args"#type, \
                                     &b_info->extra##type, 0);            \

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eH-0003ay-Ve; Sat, 11 Feb 2012 04:33:21 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eF-0003Xr-I3
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1328934791!12894669!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11120 invoked from network); 11 Feb 2012 04:33:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e6-0006QT-SL
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e6-00017q-O9
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:10 +0000
Message-Id: <E1Rw4e6-00017q-O9@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: helper function to send
	commands to traditional qemu
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Shriram Rajagopalan <rshriram@cs.ubc.ca>
# Date 1328810868 0
# Node ID 0f9e4b424d7c55e5ebfbfe933ceeb647f2cd6176
# Parent  af96b99b607da7d2923cf522acf149f41d8b230c
libxl: helper function to send commands to traditional qemu

Introduce a helper function to send commands to traditional
qemu. qemu_pci_add_xenstore, qemu_pci_remove_xenstore,
libxl__domain_save_device_model and libxl_domain_unpause have
been refactored to use this function.

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r af96b99b607d -r 0f9e4b424d7c tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Thu Feb 09 18:06:24 2012 +0000
+++ b/tools/libxl/libxl.c	Thu Feb 09 18:07:48 2012 +0000
@@ -586,7 +586,7 @@
         path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
         state = libxl__xs_read(gc, XBT_NULL, path);
         if (state != NULL && !strcmp(state, "paused")) {
-            libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "/local/domain/0/device-model/%d/command", domid), "continue");
+            libxl__qemu_traditional_cmd(gc, domid, "continue");
             libxl__wait_for_device_model(gc, domid, "running",
                                          NULL, NULL, NULL);
         }
diff -r af96b99b607d -r 0f9e4b424d7c tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c	Thu Feb 09 18:06:24 2012 +0000
+++ b/tools/libxl/libxl_dom.c	Thu Feb 09 18:07:48 2012 +0000
@@ -355,6 +355,15 @@
     return rc;
 }
 
+int libxl__qemu_traditional_cmd(libxl__gc *gc, uint32_t domid,
+                                const char *cmd)
+{
+    char *path = NULL;
+    path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/command",
+                          domid);
+    return libxl__xs_write(gc, XBT_NULL, path, "%s", cmd);
+}
+
 int libxl__domain_restore_common(libxl__gc *gc, uint32_t domid,
                                  libxl_domain_build_info *info,
                                  libxl__domain_build_state *state,
@@ -637,12 +646,9 @@
 
     switch (libxl__device_model_version_running(gc, domid)) {
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: {
-        char *path = NULL;
         LIBXL__LOG(ctx, LIBXL__LOG_DEBUG,
                    "Saving device model state to %s", filename);
-        path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/command",
-                              domid);
-        libxl__xs_write(gc, XBT_NULL, path, "save");
+        libxl__qemu_traditional_cmd(gc, domid, "save");
         libxl__wait_for_device_model(gc, domid, "paused", NULL, NULL, NULL);
         break;
     }
diff -r af96b99b607d -r 0f9e4b424d7c tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Thu Feb 09 18:06:24 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Thu Feb 09 18:07:48 2012 +0000
@@ -617,6 +617,8 @@
               libxl_domain_build_info *info,
               libxl__domain_build_state *state);
 
+_hidden int libxl__qemu_traditional_cmd(libxl__gc *gc, uint32_t domid,
+                                        const char *cmd);
 _hidden int libxl__domain_rename(libxl__gc *gc, uint32_t domid,
                                  const char *old_name, const char *new_name,
                                  xs_transaction_t trans);
diff -r af96b99b607d -r 0f9e4b424d7c tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Thu Feb 09 18:06:24 2012 +0000
+++ b/tools/libxl/libxl_pci.c	Thu Feb 09 18:07:48 2012 +0000
@@ -602,9 +602,8 @@
         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"));
+
+    libxl__qemu_traditional_cmd(gc, domid, "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",
@@ -857,12 +856,11 @@
     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"));
+        libxl__qemu_traditional_cmd(gc, domid, "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");

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eH-0003aN-IP; Sat, 11 Feb 2012 04:33:21 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eE-0003Yr-Go
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-27.messagelabs.com!1328934765!59399012!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=1.4 required=7.0 tests=INFO_TLD
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9548 invoked from network); 11 Feb 2012 04:32:46 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:46 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eB-0006Qr-1Q
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eB-0001B2-05
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:15 +0000
Message-Id: <E1Rw4eB-0001B2-05@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mini-os: Move test functions into
	test.c
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812411 0
# Node ID 86dca025cc2dbc74a7a0e71f3dd2aef747752dda
# Parent  3fb4a870393a84f695a9caacf8ae6f79f7e64941
mini-os: Move test functions into test.c

While useful, these test functions should not be compiled into every
mini-os instance that we compile.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r 3fb4a870393a -r 86dca025cc2d extras/mini-os/Makefile
--- a/extras/mini-os/Makefile	Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/Makefile	Thu Feb 09 18:33:31 2012 +0000
@@ -19,6 +19,7 @@
 CONFIG_START_NETWORK ?= y
 CONFIG_SPARSE_BSS ?= y
 CONFIG_QEMU_XS_ARGS ?= n
+CONFIG_TEST ?= n
 
 # Export config items as compiler directives
 flags-$(CONFIG_START_NETWORK) += -DCONFIG_START_NETWORK
@@ -63,6 +64,7 @@
 src-y += netfront.c
 src-y += pcifront.c
 src-y += sched.c
+src-$(CONFIG_TEST) += test.c
 
 src-y += lib/ctype.c
 src-y += lib/math.c
diff -r 3fb4a870393a -r 86dca025cc2d extras/mini-os/kernel.c
--- a/extras/mini-os/kernel.c	Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/kernel.c	Thu Feb 09 18:33:31 2012 +0000
@@ -46,8 +46,6 @@
 #include <xen/features.h>
 #include <xen/version.h>
 
-static struct netfront_dev *net_dev;
-
 uint8_t xen_features[XENFEAT_NR_SUBMAPS * 32];
 
 void setup_xen_features(void)
@@ -66,407 +64,10 @@
     }
 }
 
-void test_xenbus(void);
-
-static void xenbus_tester(void *p)
-{
-    printk("Xenbus tests disabled, because of a Xend bug.\n");
-    /* test_xenbus(); */
-}
-
-static void periodic_thread(void *p)
-{
-    struct timeval tv;
-    printk("Periodic thread started.\n");
-    for(;;)
-    {
-        gettimeofday(&tv, NULL);
-        printk("T(s=%ld us=%ld)\n", tv.tv_sec, tv.tv_usec);
-        msleep(1000);
-    }
-}
-
-static void netfront_thread(void *p)
-{
-    net_dev = init_netfront(NULL, NULL, NULL, NULL);
-}
-
-static struct blkfront_dev *blk_dev;
-static struct blkfront_info blk_info;
-static uint64_t blk_size_read;
-static uint64_t blk_size_write;
-
-struct blk_req {
-    struct blkfront_aiocb aiocb;
-    int rand_value;
-    struct blk_req *next;
-};
-
-#ifdef BLKTEST_WRITE
-static struct blk_req *blk_to_read;
-#endif
-
-static struct blk_req *blk_alloc_req(uint64_t sector)
-{
-    struct blk_req *req = xmalloc(struct blk_req);
-    req->aiocb.aio_dev = blk_dev;
-    req->aiocb.aio_buf = _xmalloc(blk_info.sector_size, blk_info.sector_size);
-    req->aiocb.aio_nbytes = blk_info.sector_size;
-    req->aiocb.aio_offset = sector * blk_info.sector_size;
-    req->aiocb.data = req;
-    req->next = NULL;
-    return req;
-}
-
-static void blk_read_completed(struct blkfront_aiocb *aiocb, int ret)
-{
-    struct blk_req *req = aiocb->data;
-    if (ret)
-        printk("got error code %d when reading at offset %ld\n", ret, aiocb->aio_offset);
-    else
-        blk_size_read += blk_info.sector_size;
-    free(aiocb->aio_buf);
-    free(req);
-}
-
-static void blk_read_sector(uint64_t sector)
-{
-    struct blk_req *req;
-
-    req = blk_alloc_req(sector);
-    req->aiocb.aio_cb = blk_read_completed;
-
-    blkfront_aio_read(&req->aiocb);
-}
-
-#ifdef BLKTEST_WRITE
-static void blk_write_read_completed(struct blkfront_aiocb *aiocb, int ret)
-{
-    struct blk_req *req = aiocb->data;
-    int rand_value;
-    int i;
-    int *buf;
-
-    if (ret) {
-        printk("got error code %d when reading back at offset %ld\n", ret, aiocb->aio_offset);
-        free(aiocb->aio_buf);
-        free(req);
-        return;
-    }
-    blk_size_read += blk_info.sector_size;
-    buf = (int*) aiocb->aio_buf;
-    rand_value = req->rand_value;
-    for (i = 0; i < blk_info.sector_size / sizeof(int); i++) {
-        if (buf[i] != rand_value) {
-            printk("bogus data at offset %ld\n", aiocb->aio_offset + i);
-            break;
-        }
-        rand_value *= RAND_MIX;
-    }
-    free(aiocb->aio_buf);
-    free(req);
-}
-
-static void blk_write_completed(struct blkfront_aiocb *aiocb, int ret)
-{
-    struct blk_req *req = aiocb->data;
-    if (ret) {
-        printk("got error code %d when writing at offset %ld\n", ret, aiocb->aio_offset);
-        free(aiocb->aio_buf);
-        free(req);
-        return;
-    }
-    blk_size_write += blk_info.sector_size;
-    /* Push write check */
-    req->next = blk_to_read;
-    blk_to_read = req;
-}
-
-static void blk_write_sector(uint64_t sector)
-{
-    struct blk_req *req;
-    int rand_value;
-    int i;
-    int *buf;
-
-    req = blk_alloc_req(sector);
-    req->aiocb.aio_cb = blk_write_completed;
-    req->rand_value = rand_value = rand();
-
-    buf = (int*) req->aiocb.aio_buf;
-    for (i = 0; i < blk_info.sector_size / sizeof(int); i++) {
-        buf[i] = rand_value;
-        rand_value *= RAND_MIX;
-    }
-
-    blkfront_aio_write(&req->aiocb);
-}
-#endif
-
-static void blkfront_thread(void *p)
-{
-    time_t lasttime = 0;
-
-    blk_dev = init_blkfront(NULL, &blk_info);
-    if (!blk_dev)
-        return;
-
-    if (blk_info.info & VDISK_CDROM)
-        printk("Block device is a CDROM\n");
-    if (blk_info.info & VDISK_REMOVABLE)
-        printk("Block device is removable\n");
-    if (blk_info.info & VDISK_READONLY)
-        printk("Block device is read-only\n");
-
-#ifdef BLKTEST_WRITE
-    if (blk_info.mode == O_RDWR) {
-        blk_write_sector(0);
-        blk_write_sector(blk_info.sectors-1);
-    } else
-#endif
-    {
-        blk_read_sector(0);
-        blk_read_sector(blk_info.sectors-1);
-    }
-
-    while (1) {
-        uint64_t sector = rand() % blk_info.sectors;
-        struct timeval tv;
-#ifdef BLKTEST_WRITE
-        if (blk_info.mode == O_RDWR)
-            blk_write_sector(sector);
-        else
-#endif
-            blk_read_sector(sector);
-        blkfront_aio_poll(blk_dev);
-        gettimeofday(&tv, NULL);
-        if (tv.tv_sec > lasttime + 10) {
-            printk("%llu read, %llu write\n", blk_size_read, blk_size_write);
-            lasttime = tv.tv_sec;
-        }
-
-#ifdef BLKTEST_WRITE
-        while (blk_to_read) {
-            struct blk_req *req = blk_to_read;
-            blk_to_read = blk_to_read->next;
-            req->aiocb.aio_cb = blk_write_read_completed;
-            blkfront_aio_read(&req->aiocb);
-        }
-#endif
-    }
-}
-
-#define WIDTH 800
-#define HEIGHT 600
-#define DEPTH 32
-
-static uint32_t *fb;
-static int refresh_period = 50;
-static struct fbfront_dev *fb_dev;
-static struct semaphore fbfront_sem = __SEMAPHORE_INITIALIZER(fbfront_sem, 0);
-
-static void fbfront_drawvert(int x, int y1, int y2, uint32_t color)
-{
-    int y;
-    if (x < 0)
-        return;
-    if (x >= WIDTH)
-        return;
-    if (y1 < 0)
-        y1 = 0;
-    if (y2 >= HEIGHT)
-        y2 = HEIGHT-1;
-    for (y = y1; y <= y2; y++)
-        fb[x + y*WIDTH] ^= color;
-}
-
-static void fbfront_drawhoriz(int x1, int x2, int y, uint32_t color)
-{
-    int x;
-    if (y < 0)
-        return;
-    if (y >= HEIGHT)
-        return;
-    if (x1 < 0)
-        x1 = 0;
-    if (x2 >= WIDTH)
-        x2 = WIDTH-1;
-    for (x = x1; x <= x2; x++)
-        fb[x + y*WIDTH] ^= color;
-}
-
-static void fbfront_thread(void *p)
-{
-    size_t line_length = WIDTH * (DEPTH / 8);
-    size_t memsize = HEIGHT * line_length;
-    unsigned long *mfns;
-    int i, n = (memsize + PAGE_SIZE-1) / PAGE_SIZE;
-
-    memsize = n * PAGE_SIZE;
-    fb = _xmalloc(memsize, PAGE_SIZE);
-    memset(fb, 0, memsize);
-    mfns = xmalloc_array(unsigned long, n);
-    for (i = 0; i < n; i++)
-        mfns[i] = virtual_to_mfn((char *) fb + i * PAGE_SIZE);
-    fb_dev = init_fbfront(NULL, mfns, WIDTH, HEIGHT, DEPTH, line_length, n);
-    xfree(mfns);
-    if (!fb_dev) {
-        xfree(fb);
-        return;
-    }
-    up(&fbfront_sem);
-}
-
-static void clip_cursor(int *x, int *y)
-{
-    if (*x < 0)
-        *x = 0;
-    if (*x >= WIDTH)
-        *x = WIDTH - 1;
-    if (*y < 0)
-        *y = 0;
-    if (*y >= HEIGHT)
-        *y = HEIGHT - 1;
-}
-
-static void refresh_cursor(int new_x, int new_y)
-{
-    static int old_x = -1, old_y = -1;
-
-    if (!refresh_period)
-        return;
-
-    if (old_x != -1 && old_y != -1) {
-        fbfront_drawvert(old_x, old_y + 1, old_y + 8, 0xffffffff);
-        fbfront_drawhoriz(old_x + 1, old_x + 8, old_y, 0xffffffff);
-        fbfront_update(fb_dev, old_x, old_y, 9, 9);
-    }
-    old_x = new_x;
-    old_y = new_y;
-    fbfront_drawvert(new_x, new_y + 1, new_y + 8, 0xffffffff);
-    fbfront_drawhoriz(new_x + 1, new_x + 8, new_y, 0xffffffff);
-    fbfront_update(fb_dev, new_x, new_y, 9, 9);
-}
-
-static struct kbdfront_dev *kbd_dev;
-static void kbdfront_thread(void *p)
-{
-    DEFINE_WAIT(w);
-    DEFINE_WAIT(w2);
-    int x = WIDTH / 2, y = HEIGHT / 2, z = 0;
-
-    kbd_dev = init_kbdfront(NULL, 1);
-    if (!kbd_dev)
-        return;
-
-    down(&fbfront_sem);
-    refresh_cursor(x, y);
-    while (1) {
-        union xenkbd_in_event kbdevent;
-        union xenfb_in_event fbevent;
-        int sleep = 1;
-
-        add_waiter(w, kbdfront_queue);
-        add_waiter(w2, fbfront_queue);
-
-        while (kbdfront_receive(kbd_dev, &kbdevent, 1) != 0) {
-            sleep = 0;
-            switch(kbdevent.type) {
-            case XENKBD_TYPE_MOTION:
-                printk("motion x:%d y:%d z:%d\n",
-                        kbdevent.motion.rel_x,
-                        kbdevent.motion.rel_y,
-                        kbdevent.motion.rel_z);
-                x += kbdevent.motion.rel_x;
-                y += kbdevent.motion.rel_y;
-                z += kbdevent.motion.rel_z;
-                clip_cursor(&x, &y);
-                refresh_cursor(x, y);
-                break;
-            case XENKBD_TYPE_POS:
-                printk("pos x:%d y:%d dz:%d\n",
-                        kbdevent.pos.abs_x,
-                        kbdevent.pos.abs_y,
-                        kbdevent.pos.rel_z);
-                x = kbdevent.pos.abs_x;
-                y = kbdevent.pos.abs_y;
-                z = kbdevent.pos.rel_z;
-                clip_cursor(&x, &y);
-                refresh_cursor(x, y);
-                break;
-            case XENKBD_TYPE_KEY:
-                printk("key %d %s\n",
-                        kbdevent.key.keycode,
-                        kbdevent.key.pressed ? "pressed" : "released");
-                if (kbdevent.key.keycode == BTN_LEFT) {
-                    printk("mouse %s at (%d,%d,%d)\n",
-                            kbdevent.key.pressed ? "clic" : "release", x, y, z);
-                    if (kbdevent.key.pressed) {
-                        uint32_t color = rand();
-                        fbfront_drawvert(x - 16, y - 16, y + 15, color);
-                        fbfront_drawhoriz(x - 16, x + 15, y + 16, color);
-                        fbfront_drawvert(x + 16, y - 15, y + 16, color);
-                        fbfront_drawhoriz(x - 15, x + 16, y - 16, color);
-                        fbfront_update(fb_dev, x - 16, y - 16, 33, 33);
-                    }
-                } else if (kbdevent.key.keycode == KEY_Q) {
-                    struct sched_shutdown sched_shutdown = { .reason = SHUTDOWN_poweroff };
-                    HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
-                    do_exit();
-                }
-                break;
-            }
-        }
-        while (fbfront_receive(fb_dev, &fbevent, 1) != 0) {
-            sleep = 0;
-            switch(fbevent.type) {
-            case XENFB_TYPE_REFRESH_PERIOD:
-                refresh_period = fbevent.refresh_period.period;
-                printk("refresh period %d\n", refresh_period);
-                refresh_cursor(x, y);
-                break;
-            }
-        }
-        if (sleep)
-            schedule();
-    }
-}
-
-static struct pcifront_dev *pci_dev;
-
-static void print_pcidev(unsigned int domain, unsigned int bus, unsigned int slot, unsigned int fun)
-{
-    unsigned int vendor, device, rev, class;
-
-    pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x00, 2, &vendor);
-    pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x02, 2, &device);
-    pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x08, 1, &rev);
-    pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x0a, 2, &class);
-
-    printk("%04x:%02x:%02x.%02x %04x: %04x:%04x (rev %02x)\n", domain, bus, slot, fun, class, vendor, device, rev);
-}
-
-static void pcifront_thread(void *p)
-{
-    pcifront_watches(NULL);
-    pci_dev = init_pcifront(NULL);
-    if (!pci_dev)
-        return;
-    printk("PCI devices:\n");
-    pcifront_scan(pci_dev, print_pcidev);
-}
-
 /* This should be overridden by the application we are linked against. */
 __attribute__((weak)) int app_main(start_info_t *si)
 {
     printk("Dummy main: start_info=%p\n", si);
-    create_thread("xenbus_tester", xenbus_tester, si);
-    create_thread("periodic_thread", periodic_thread, si);
-    create_thread("netfront", netfront_thread, si);
-    create_thread("blkfront", blkfront_thread, si);
-    create_thread("fbfront", fbfront_thread, si);
-    create_thread("kbdfront", kbdfront_thread, si);
-    create_thread("pcifront", pcifront_thread, si);
     return 0;
 }
 
@@ -534,21 +135,6 @@
 
 void stop_kernel(void)
 {
-    if (net_dev)
-        shutdown_netfront(net_dev);
-
-    if (blk_dev)
-        shutdown_blkfront(blk_dev);
-
-    if (fb_dev)
-        shutdown_fbfront(fb_dev);
-
-    if (kbd_dev)
-        shutdown_kbdfront(kbd_dev);
-
-    if (pci_dev)
-        shutdown_pcifront(pci_dev);
-
     /* TODO: fs import */
 
     local_irq_disable();
diff -r 3fb4a870393a -r 86dca025cc2d extras/mini-os/test.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/test.c	Thu Feb 09 18:33:31 2012 +0000
@@ -0,0 +1,469 @@
+/******************************************************************************
+ * test.c
+ * 
+ * Test code for all the various frontends; split from kernel.c
+ * 
+ * Copyright (c) 2002-2003, K A Fraser & R Neugebauer
+ * Copyright (c) 2005, Grzegorz Milos, Intel Research Cambridge
+ * Copyright (c) 2006, Robert Kaiser, FH Wiesbaden
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <mini-os/os.h>
+#include <mini-os/hypervisor.h>
+#include <mini-os/mm.h>
+#include <mini-os/events.h>
+#include <mini-os/time.h>
+#include <mini-os/types.h>
+#include <mini-os/lib.h>
+#include <mini-os/sched.h>
+#include <mini-os/xenbus.h>
+#include <mini-os/gnttab.h>
+#include <mini-os/netfront.h>
+#include <mini-os/blkfront.h>
+#include <mini-os/fbfront.h>
+#include <mini-os/pcifront.h>
+#include <mini-os/xmalloc.h>
+#include <fcntl.h>
+#include <xen/features.h>
+#include <xen/version.h>
+
+static struct netfront_dev *net_dev;
+
+void test_xenbus(void);
+
+static void xenbus_tester(void *p)
+{
+    printk("Xenbus tests disabled, because of a Xend bug.\n");
+    /* test_xenbus(); */
+}
+
+static void periodic_thread(void *p)
+{
+    struct timeval tv;
+    printk("Periodic thread started.\n");
+    for(;;)
+    {
+        gettimeofday(&tv, NULL);
+        printk("T(s=%ld us=%ld)\n", tv.tv_sec, tv.tv_usec);
+        msleep(1000);
+    }
+}
+
+static void netfront_thread(void *p)
+{
+    net_dev = init_netfront(NULL, NULL, NULL, NULL);
+}
+
+static struct blkfront_dev *blk_dev;
+static struct blkfront_info blk_info;
+static uint64_t blk_size_read;
+static uint64_t blk_size_write;
+
+struct blk_req {
+    struct blkfront_aiocb aiocb;
+    int rand_value;
+    struct blk_req *next;
+};
+
+#ifdef BLKTEST_WRITE
+static struct blk_req *blk_to_read;
+#endif
+
+static struct blk_req *blk_alloc_req(uint64_t sector)
+{
+    struct blk_req *req = xmalloc(struct blk_req);
+    req->aiocb.aio_dev = blk_dev;
+    req->aiocb.aio_buf = _xmalloc(blk_info.sector_size, blk_info.sector_size);
+    req->aiocb.aio_nbytes = blk_info.sector_size;
+    req->aiocb.aio_offset = sector * blk_info.sector_size;
+    req->aiocb.data = req;
+    req->next = NULL;
+    return req;
+}
+
+static void blk_read_completed(struct blkfront_aiocb *aiocb, int ret)
+{
+    struct blk_req *req = aiocb->data;
+    if (ret)
+        printk("got error code %d when reading at offset %ld\n", ret, aiocb->aio_offset);
+    else
+        blk_size_read += blk_info.sector_size;
+    free(aiocb->aio_buf);
+    free(req);
+}
+
+static void blk_read_sector(uint64_t sector)
+{
+    struct blk_req *req;
+
+    req = blk_alloc_req(sector);
+    req->aiocb.aio_cb = blk_read_completed;
+
+    blkfront_aio_read(&req->aiocb);
+}
+
+#ifdef BLKTEST_WRITE
+static void blk_write_read_completed(struct blkfront_aiocb *aiocb, int ret)
+{
+    struct blk_req *req = aiocb->data;
+    int rand_value;
+    int i;
+    int *buf;
+
+    if (ret) {
+        printk("got error code %d when reading back at offset %ld\n", ret, aiocb->aio_offset);
+        free(aiocb->aio_buf);
+        free(req);
+        return;
+    }
+    blk_size_read += blk_info.sector_size;
+    buf = (int*) aiocb->aio_buf;
+    rand_value = req->rand_value;
+    for (i = 0; i < blk_info.sector_size / sizeof(int); i++) {
+        if (buf[i] != rand_value) {
+            printk("bogus data at offset %ld\n", aiocb->aio_offset + i);
+            break;
+        }
+        rand_value *= RAND_MIX;
+    }
+    free(aiocb->aio_buf);
+    free(req);
+}
+
+static void blk_write_completed(struct blkfront_aiocb *aiocb, int ret)
+{
+    struct blk_req *req = aiocb->data;
+    if (ret) {
+        printk("got error code %d when writing at offset %ld\n", ret, aiocb->aio_offset);
+        free(aiocb->aio_buf);
+        free(req);
+        return;
+    }
+    blk_size_write += blk_info.sector_size;
+    /* Push write check */
+    req->next = blk_to_read;
+    blk_to_read = req;
+}
+
+static void blk_write_sector(uint64_t sector)
+{
+    struct blk_req *req;
+    int rand_value;
+    int i;
+    int *buf;
+
+    req = blk_alloc_req(sector);
+    req->aiocb.aio_cb = blk_write_completed;
+    req->rand_value = rand_value = rand();
+
+    buf = (int*) req->aiocb.aio_buf;
+    for (i = 0; i < blk_info.sector_size / sizeof(int); i++) {
+        buf[i] = rand_value;
+        rand_value *= RAND_MIX;
+    }
+
+    blkfront_aio_write(&req->aiocb);
+}
+#endif
+
+static void blkfront_thread(void *p)
+{
+    time_t lasttime = 0;
+
+    blk_dev = init_blkfront(NULL, &blk_info);
+    if (!blk_dev)
+        return;
+
+    if (blk_info.info & VDISK_CDROM)
+        printk("Block device is a CDROM\n");
+    if (blk_info.info & VDISK_REMOVABLE)
+        printk("Block device is removable\n");
+    if (blk_info.info & VDISK_READONLY)
+        printk("Block device is read-only\n");
+
+#ifdef BLKTEST_WRITE
+    if (blk_info.mode == O_RDWR) {
+        blk_write_sector(0);
+        blk_write_sector(blk_info.sectors-1);
+    } else
+#endif
+    {
+        blk_read_sector(0);
+        blk_read_sector(blk_info.sectors-1);
+    }
+
+    while (1) {
+        uint64_t sector = rand() % blk_info.sectors;
+        struct timeval tv;
+#ifdef BLKTEST_WRITE
+        if (blk_info.mode == O_RDWR)
+            blk_write_sector(sector);
+        else
+#endif
+            blk_read_sector(sector);
+        blkfront_aio_poll(blk_dev);
+        gettimeofday(&tv, NULL);
+        if (tv.tv_sec > lasttime + 10) {
+            printk("%llu read, %llu write\n", blk_size_read, blk_size_write);
+            lasttime = tv.tv_sec;
+        }
+
+#ifdef BLKTEST_WRITE
+        while (blk_to_read) {
+            struct blk_req *req = blk_to_read;
+            blk_to_read = blk_to_read->next;
+            req->aiocb.aio_cb = blk_write_read_completed;
+            blkfront_aio_read(&req->aiocb);
+        }
+#endif
+    }
+}
+
+#define WIDTH 800
+#define HEIGHT 600
+#define DEPTH 32
+
+static uint32_t *fb;
+static int refresh_period = 50;
+static struct fbfront_dev *fb_dev;
+static struct semaphore fbfront_sem = __SEMAPHORE_INITIALIZER(fbfront_sem, 0);
+
+static void fbfront_drawvert(int x, int y1, int y2, uint32_t color)
+{
+    int y;
+    if (x < 0)
+        return;
+    if (x >= WIDTH)
+        return;
+    if (y1 < 0)
+        y1 = 0;
+    if (y2 >= HEIGHT)
+        y2 = HEIGHT-1;
+    for (y = y1; y <= y2; y++)
+        fb[x + y*WIDTH] ^= color;
+}
+
+static void fbfront_drawhoriz(int x1, int x2, int y, uint32_t color)
+{
+    int x;
+    if (y < 0)
+        return;
+    if (y >= HEIGHT)
+        return;
+    if (x1 < 0)
+        x1 = 0;
+    if (x2 >= WIDTH)
+        x2 = WIDTH-1;
+    for (x = x1; x <= x2; x++)
+        fb[x + y*WIDTH] ^= color;
+}
+
+static void fbfront_thread(void *p)
+{
+    size_t line_length = WIDTH * (DEPTH / 8);
+    size_t memsize = HEIGHT * line_length;
+    unsigned long *mfns;
+    int i, n = (memsize + PAGE_SIZE-1) / PAGE_SIZE;
+
+    memsize = n * PAGE_SIZE;
+    fb = _xmalloc(memsize, PAGE_SIZE);
+    memset(fb, 0, memsize);
+    mfns = xmalloc_array(unsigned long, n);
+    for (i = 0; i < n; i++)
+        mfns[i] = virtual_to_mfn((char *) fb + i * PAGE_SIZE);
+    fb_dev = init_fbfront(NULL, mfns, WIDTH, HEIGHT, DEPTH, line_length, n);
+    xfree(mfns);
+    if (!fb_dev) {
+        xfree(fb);
+        return;
+    }
+    up(&fbfront_sem);
+}
+
+static void clip_cursor(int *x, int *y)
+{
+    if (*x < 0)
+        *x = 0;
+    if (*x >= WIDTH)
+        *x = WIDTH - 1;
+    if (*y < 0)
+        *y = 0;
+    if (*y >= HEIGHT)
+        *y = HEIGHT - 1;
+}
+
+static void refresh_cursor(int new_x, int new_y)
+{
+    static int old_x = -1, old_y = -1;
+
+    if (!refresh_period)
+        return;
+
+    if (old_x != -1 && old_y != -1) {
+        fbfront_drawvert(old_x, old_y + 1, old_y + 8, 0xffffffff);
+        fbfront_drawhoriz(old_x + 1, old_x + 8, old_y, 0xffffffff);
+        fbfront_update(fb_dev, old_x, old_y, 9, 9);
+    }
+    old_x = new_x;
+    old_y = new_y;
+    fbfront_drawvert(new_x, new_y + 1, new_y + 8, 0xffffffff);
+    fbfront_drawhoriz(new_x + 1, new_x + 8, new_y, 0xffffffff);
+    fbfront_update(fb_dev, new_x, new_y, 9, 9);
+}
+
+static struct kbdfront_dev *kbd_dev;
+static void kbdfront_thread(void *p)
+{
+    DEFINE_WAIT(w);
+    DEFINE_WAIT(w2);
+    int x = WIDTH / 2, y = HEIGHT / 2, z = 0;
+
+    kbd_dev = init_kbdfront(NULL, 1);
+    if (!kbd_dev)
+        return;
+
+    down(&fbfront_sem);
+    refresh_cursor(x, y);
+    while (1) {
+        union xenkbd_in_event kbdevent;
+        union xenfb_in_event fbevent;
+        int sleep = 1;
+
+        add_waiter(w, kbdfront_queue);
+        add_waiter(w2, fbfront_queue);
+
+        while (kbdfront_receive(kbd_dev, &kbdevent, 1) != 0) {
+            sleep = 0;
+            switch(kbdevent.type) {
+            case XENKBD_TYPE_MOTION:
+                printk("motion x:%d y:%d z:%d\n",
+                        kbdevent.motion.rel_x,
+                        kbdevent.motion.rel_y,
+                        kbdevent.motion.rel_z);
+                x += kbdevent.motion.rel_x;
+                y += kbdevent.motion.rel_y;
+                z += kbdevent.motion.rel_z;
+                clip_cursor(&x, &y);
+                refresh_cursor(x, y);
+                break;
+            case XENKBD_TYPE_POS:
+                printk("pos x:%d y:%d dz:%d\n",
+                        kbdevent.pos.abs_x,
+                        kbdevent.pos.abs_y,
+                        kbdevent.pos.rel_z);
+                x = kbdevent.pos.abs_x;
+                y = kbdevent.pos.abs_y;
+                z = kbdevent.pos.rel_z;
+                clip_cursor(&x, &y);
+                refresh_cursor(x, y);
+                break;
+            case XENKBD_TYPE_KEY:
+                printk("key %d %s\n",
+                        kbdevent.key.keycode,
+                        kbdevent.key.pressed ? "pressed" : "released");
+                if (kbdevent.key.keycode == BTN_LEFT) {
+                    printk("mouse %s at (%d,%d,%d)\n",
+                            kbdevent.key.pressed ? "clic" : "release", x, y, z);
+                    if (kbdevent.key.pressed) {
+                        uint32_t color = rand();
+                        fbfront_drawvert(x - 16, y - 16, y + 15, color);
+                        fbfront_drawhoriz(x - 16, x + 15, y + 16, color);
+                        fbfront_drawvert(x + 16, y - 15, y + 16, color);
+                        fbfront_drawhoriz(x - 15, x + 16, y - 16, color);
+                        fbfront_update(fb_dev, x - 16, y - 16, 33, 33);
+                    }
+                } else if (kbdevent.key.keycode == KEY_Q) {
+                    struct sched_shutdown sched_shutdown = { .reason = SHUTDOWN_poweroff };
+                    HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
+                    do_exit();
+                }
+                break;
+            }
+        }
+        while (fbfront_receive(fb_dev, &fbevent, 1) != 0) {
+            sleep = 0;
+            switch(fbevent.type) {
+            case XENFB_TYPE_REFRESH_PERIOD:
+                refresh_period = fbevent.refresh_period.period;
+                printk("refresh period %d\n", refresh_period);
+                refresh_cursor(x, y);
+                break;
+            }
+        }
+        if (sleep)
+            schedule();
+    }
+}
+
+static struct pcifront_dev *pci_dev;
+
+static void print_pcidev(unsigned int domain, unsigned int bus, unsigned int slot, unsigned int fun)
+{
+    unsigned int vendor, device, rev, class;
+
+    pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x00, 2, &vendor);
+    pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x02, 2, &device);
+    pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x08, 1, &rev);
+    pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x0a, 2, &class);
+
+    printk("%04x:%02x:%02x.%02x %04x: %04x:%04x (rev %02x)\n", domain, bus, slot, fun, class, vendor, device, rev);
+}
+
+static void pcifront_thread(void *p)
+{
+    pcifront_watches(NULL);
+    pci_dev = init_pcifront(NULL);
+    if (!pci_dev)
+        return;
+    printk("PCI devices:\n");
+    pcifront_scan(pci_dev, print_pcidev);
+}
+
+int app_main(start_info_t *si)
+{
+    printk("Test main: start_info=%p\n", si);
+    create_thread("xenbus_tester", xenbus_tester, si);
+    create_thread("periodic_thread", periodic_thread, si);
+    create_thread("netfront", netfront_thread, si);
+    create_thread("blkfront", blkfront_thread, si);
+    create_thread("fbfront", fbfront_thread, si);
+    create_thread("kbdfront", kbdfront_thread, si);
+    create_thread("pcifront", pcifront_thread, si);
+    return 0;
+}
+
+void shutdown_frontends(void)
+{
+    if (net_dev)
+        shutdown_netfront(net_dev);
+
+    if (blk_dev)
+        shutdown_blkfront(blk_dev);
+
+    if (fb_dev)
+        shutdown_fbfront(fb_dev);
+
+    if (kbd_dev)
+        shutdown_kbdfront(kbd_dev);
+
+    if (pci_dev)
+        shutdown_pcifront(pci_dev);
+}
diff -r 3fb4a870393a -r 86dca025cc2d stubdom/c/minios.cfg
--- a/stubdom/c/minios.cfg	Thu Feb 09 18:33:31 2012 +0000
+++ b/stubdom/c/minios.cfg	Thu Feb 09 18:33:31 2012 +0000
@@ -0,0 +1,1 @@
+CONFIG_TEST=y
diff -r 3fb4a870393a -r 86dca025cc2d stubdom/caml/minios.cfg
--- a/stubdom/caml/minios.cfg	Thu Feb 09 18:33:31 2012 +0000
+++ b/stubdom/caml/minios.cfg	Thu Feb 09 18:33:31 2012 +0000
@@ -0,0 +1,1 @@
+CONFIG_TEST=y

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eH-0003aN-IP; Sat, 11 Feb 2012 04:33:21 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eE-0003Yr-Go
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-27.messagelabs.com!1328934765!59399012!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=1.4 required=7.0 tests=INFO_TLD
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9548 invoked from network); 11 Feb 2012 04:32:46 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:46 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eB-0006Qr-1Q
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eB-0001B2-05
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:15 +0000
Message-Id: <E1Rw4eB-0001B2-05@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mini-os: Move test functions into
	test.c
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812411 0
# Node ID 86dca025cc2dbc74a7a0e71f3dd2aef747752dda
# Parent  3fb4a870393a84f695a9caacf8ae6f79f7e64941
mini-os: Move test functions into test.c

While useful, these test functions should not be compiled into every
mini-os instance that we compile.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r 3fb4a870393a -r 86dca025cc2d extras/mini-os/Makefile
--- a/extras/mini-os/Makefile	Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/Makefile	Thu Feb 09 18:33:31 2012 +0000
@@ -19,6 +19,7 @@
 CONFIG_START_NETWORK ?= y
 CONFIG_SPARSE_BSS ?= y
 CONFIG_QEMU_XS_ARGS ?= n
+CONFIG_TEST ?= n
 
 # Export config items as compiler directives
 flags-$(CONFIG_START_NETWORK) += -DCONFIG_START_NETWORK
@@ -63,6 +64,7 @@
 src-y += netfront.c
 src-y += pcifront.c
 src-y += sched.c
+src-$(CONFIG_TEST) += test.c
 
 src-y += lib/ctype.c
 src-y += lib/math.c
diff -r 3fb4a870393a -r 86dca025cc2d extras/mini-os/kernel.c
--- a/extras/mini-os/kernel.c	Thu Feb 09 18:33:31 2012 +0000
+++ b/extras/mini-os/kernel.c	Thu Feb 09 18:33:31 2012 +0000
@@ -46,8 +46,6 @@
 #include <xen/features.h>
 #include <xen/version.h>
 
-static struct netfront_dev *net_dev;
-
 uint8_t xen_features[XENFEAT_NR_SUBMAPS * 32];
 
 void setup_xen_features(void)
@@ -66,407 +64,10 @@
     }
 }
 
-void test_xenbus(void);
-
-static void xenbus_tester(void *p)
-{
-    printk("Xenbus tests disabled, because of a Xend bug.\n");
-    /* test_xenbus(); */
-}
-
-static void periodic_thread(void *p)
-{
-    struct timeval tv;
-    printk("Periodic thread started.\n");
-    for(;;)
-    {
-        gettimeofday(&tv, NULL);
-        printk("T(s=%ld us=%ld)\n", tv.tv_sec, tv.tv_usec);
-        msleep(1000);
-    }
-}
-
-static void netfront_thread(void *p)
-{
-    net_dev = init_netfront(NULL, NULL, NULL, NULL);
-}
-
-static struct blkfront_dev *blk_dev;
-static struct blkfront_info blk_info;
-static uint64_t blk_size_read;
-static uint64_t blk_size_write;
-
-struct blk_req {
-    struct blkfront_aiocb aiocb;
-    int rand_value;
-    struct blk_req *next;
-};
-
-#ifdef BLKTEST_WRITE
-static struct blk_req *blk_to_read;
-#endif
-
-static struct blk_req *blk_alloc_req(uint64_t sector)
-{
-    struct blk_req *req = xmalloc(struct blk_req);
-    req->aiocb.aio_dev = blk_dev;
-    req->aiocb.aio_buf = _xmalloc(blk_info.sector_size, blk_info.sector_size);
-    req->aiocb.aio_nbytes = blk_info.sector_size;
-    req->aiocb.aio_offset = sector * blk_info.sector_size;
-    req->aiocb.data = req;
-    req->next = NULL;
-    return req;
-}
-
-static void blk_read_completed(struct blkfront_aiocb *aiocb, int ret)
-{
-    struct blk_req *req = aiocb->data;
-    if (ret)
-        printk("got error code %d when reading at offset %ld\n", ret, aiocb->aio_offset);
-    else
-        blk_size_read += blk_info.sector_size;
-    free(aiocb->aio_buf);
-    free(req);
-}
-
-static void blk_read_sector(uint64_t sector)
-{
-    struct blk_req *req;
-
-    req = blk_alloc_req(sector);
-    req->aiocb.aio_cb = blk_read_completed;
-
-    blkfront_aio_read(&req->aiocb);
-}
-
-#ifdef BLKTEST_WRITE
-static void blk_write_read_completed(struct blkfront_aiocb *aiocb, int ret)
-{
-    struct blk_req *req = aiocb->data;
-    int rand_value;
-    int i;
-    int *buf;
-
-    if (ret) {
-        printk("got error code %d when reading back at offset %ld\n", ret, aiocb->aio_offset);
-        free(aiocb->aio_buf);
-        free(req);
-        return;
-    }
-    blk_size_read += blk_info.sector_size;
-    buf = (int*) aiocb->aio_buf;
-    rand_value = req->rand_value;
-    for (i = 0; i < blk_info.sector_size / sizeof(int); i++) {
-        if (buf[i] != rand_value) {
-            printk("bogus data at offset %ld\n", aiocb->aio_offset + i);
-            break;
-        }
-        rand_value *= RAND_MIX;
-    }
-    free(aiocb->aio_buf);
-    free(req);
-}
-
-static void blk_write_completed(struct blkfront_aiocb *aiocb, int ret)
-{
-    struct blk_req *req = aiocb->data;
-    if (ret) {
-        printk("got error code %d when writing at offset %ld\n", ret, aiocb->aio_offset);
-        free(aiocb->aio_buf);
-        free(req);
-        return;
-    }
-    blk_size_write += blk_info.sector_size;
-    /* Push write check */
-    req->next = blk_to_read;
-    blk_to_read = req;
-}
-
-static void blk_write_sector(uint64_t sector)
-{
-    struct blk_req *req;
-    int rand_value;
-    int i;
-    int *buf;
-
-    req = blk_alloc_req(sector);
-    req->aiocb.aio_cb = blk_write_completed;
-    req->rand_value = rand_value = rand();
-
-    buf = (int*) req->aiocb.aio_buf;
-    for (i = 0; i < blk_info.sector_size / sizeof(int); i++) {
-        buf[i] = rand_value;
-        rand_value *= RAND_MIX;
-    }
-
-    blkfront_aio_write(&req->aiocb);
-}
-#endif
-
-static void blkfront_thread(void *p)
-{
-    time_t lasttime = 0;
-
-    blk_dev = init_blkfront(NULL, &blk_info);
-    if (!blk_dev)
-        return;
-
-    if (blk_info.info & VDISK_CDROM)
-        printk("Block device is a CDROM\n");
-    if (blk_info.info & VDISK_REMOVABLE)
-        printk("Block device is removable\n");
-    if (blk_info.info & VDISK_READONLY)
-        printk("Block device is read-only\n");
-
-#ifdef BLKTEST_WRITE
-    if (blk_info.mode == O_RDWR) {
-        blk_write_sector(0);
-        blk_write_sector(blk_info.sectors-1);
-    } else
-#endif
-    {
-        blk_read_sector(0);
-        blk_read_sector(blk_info.sectors-1);
-    }
-
-    while (1) {
-        uint64_t sector = rand() % blk_info.sectors;
-        struct timeval tv;
-#ifdef BLKTEST_WRITE
-        if (blk_info.mode == O_RDWR)
-            blk_write_sector(sector);
-        else
-#endif
-            blk_read_sector(sector);
-        blkfront_aio_poll(blk_dev);
-        gettimeofday(&tv, NULL);
-        if (tv.tv_sec > lasttime + 10) {
-            printk("%llu read, %llu write\n", blk_size_read, blk_size_write);
-            lasttime = tv.tv_sec;
-        }
-
-#ifdef BLKTEST_WRITE
-        while (blk_to_read) {
-            struct blk_req *req = blk_to_read;
-            blk_to_read = blk_to_read->next;
-            req->aiocb.aio_cb = blk_write_read_completed;
-            blkfront_aio_read(&req->aiocb);
-        }
-#endif
-    }
-}
-
-#define WIDTH 800
-#define HEIGHT 600
-#define DEPTH 32
-
-static uint32_t *fb;
-static int refresh_period = 50;
-static struct fbfront_dev *fb_dev;
-static struct semaphore fbfront_sem = __SEMAPHORE_INITIALIZER(fbfront_sem, 0);
-
-static void fbfront_drawvert(int x, int y1, int y2, uint32_t color)
-{
-    int y;
-    if (x < 0)
-        return;
-    if (x >= WIDTH)
-        return;
-    if (y1 < 0)
-        y1 = 0;
-    if (y2 >= HEIGHT)
-        y2 = HEIGHT-1;
-    for (y = y1; y <= y2; y++)
-        fb[x + y*WIDTH] ^= color;
-}
-
-static void fbfront_drawhoriz(int x1, int x2, int y, uint32_t color)
-{
-    int x;
-    if (y < 0)
-        return;
-    if (y >= HEIGHT)
-        return;
-    if (x1 < 0)
-        x1 = 0;
-    if (x2 >= WIDTH)
-        x2 = WIDTH-1;
-    for (x = x1; x <= x2; x++)
-        fb[x + y*WIDTH] ^= color;
-}
-
-static void fbfront_thread(void *p)
-{
-    size_t line_length = WIDTH * (DEPTH / 8);
-    size_t memsize = HEIGHT * line_length;
-    unsigned long *mfns;
-    int i, n = (memsize + PAGE_SIZE-1) / PAGE_SIZE;
-
-    memsize = n * PAGE_SIZE;
-    fb = _xmalloc(memsize, PAGE_SIZE);
-    memset(fb, 0, memsize);
-    mfns = xmalloc_array(unsigned long, n);
-    for (i = 0; i < n; i++)
-        mfns[i] = virtual_to_mfn((char *) fb + i * PAGE_SIZE);
-    fb_dev = init_fbfront(NULL, mfns, WIDTH, HEIGHT, DEPTH, line_length, n);
-    xfree(mfns);
-    if (!fb_dev) {
-        xfree(fb);
-        return;
-    }
-    up(&fbfront_sem);
-}
-
-static void clip_cursor(int *x, int *y)
-{
-    if (*x < 0)
-        *x = 0;
-    if (*x >= WIDTH)
-        *x = WIDTH - 1;
-    if (*y < 0)
-        *y = 0;
-    if (*y >= HEIGHT)
-        *y = HEIGHT - 1;
-}
-
-static void refresh_cursor(int new_x, int new_y)
-{
-    static int old_x = -1, old_y = -1;
-
-    if (!refresh_period)
-        return;
-
-    if (old_x != -1 && old_y != -1) {
-        fbfront_drawvert(old_x, old_y + 1, old_y + 8, 0xffffffff);
-        fbfront_drawhoriz(old_x + 1, old_x + 8, old_y, 0xffffffff);
-        fbfront_update(fb_dev, old_x, old_y, 9, 9);
-    }
-    old_x = new_x;
-    old_y = new_y;
-    fbfront_drawvert(new_x, new_y + 1, new_y + 8, 0xffffffff);
-    fbfront_drawhoriz(new_x + 1, new_x + 8, new_y, 0xffffffff);
-    fbfront_update(fb_dev, new_x, new_y, 9, 9);
-}
-
-static struct kbdfront_dev *kbd_dev;
-static void kbdfront_thread(void *p)
-{
-    DEFINE_WAIT(w);
-    DEFINE_WAIT(w2);
-    int x = WIDTH / 2, y = HEIGHT / 2, z = 0;
-
-    kbd_dev = init_kbdfront(NULL, 1);
-    if (!kbd_dev)
-        return;
-
-    down(&fbfront_sem);
-    refresh_cursor(x, y);
-    while (1) {
-        union xenkbd_in_event kbdevent;
-        union xenfb_in_event fbevent;
-        int sleep = 1;
-
-        add_waiter(w, kbdfront_queue);
-        add_waiter(w2, fbfront_queue);
-
-        while (kbdfront_receive(kbd_dev, &kbdevent, 1) != 0) {
-            sleep = 0;
-            switch(kbdevent.type) {
-            case XENKBD_TYPE_MOTION:
-                printk("motion x:%d y:%d z:%d\n",
-                        kbdevent.motion.rel_x,
-                        kbdevent.motion.rel_y,
-                        kbdevent.motion.rel_z);
-                x += kbdevent.motion.rel_x;
-                y += kbdevent.motion.rel_y;
-                z += kbdevent.motion.rel_z;
-                clip_cursor(&x, &y);
-                refresh_cursor(x, y);
-                break;
-            case XENKBD_TYPE_POS:
-                printk("pos x:%d y:%d dz:%d\n",
-                        kbdevent.pos.abs_x,
-                        kbdevent.pos.abs_y,
-                        kbdevent.pos.rel_z);
-                x = kbdevent.pos.abs_x;
-                y = kbdevent.pos.abs_y;
-                z = kbdevent.pos.rel_z;
-                clip_cursor(&x, &y);
-                refresh_cursor(x, y);
-                break;
-            case XENKBD_TYPE_KEY:
-                printk("key %d %s\n",
-                        kbdevent.key.keycode,
-                        kbdevent.key.pressed ? "pressed" : "released");
-                if (kbdevent.key.keycode == BTN_LEFT) {
-                    printk("mouse %s at (%d,%d,%d)\n",
-                            kbdevent.key.pressed ? "clic" : "release", x, y, z);
-                    if (kbdevent.key.pressed) {
-                        uint32_t color = rand();
-                        fbfront_drawvert(x - 16, y - 16, y + 15, color);
-                        fbfront_drawhoriz(x - 16, x + 15, y + 16, color);
-                        fbfront_drawvert(x + 16, y - 15, y + 16, color);
-                        fbfront_drawhoriz(x - 15, x + 16, y - 16, color);
-                        fbfront_update(fb_dev, x - 16, y - 16, 33, 33);
-                    }
-                } else if (kbdevent.key.keycode == KEY_Q) {
-                    struct sched_shutdown sched_shutdown = { .reason = SHUTDOWN_poweroff };
-                    HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
-                    do_exit();
-                }
-                break;
-            }
-        }
-        while (fbfront_receive(fb_dev, &fbevent, 1) != 0) {
-            sleep = 0;
-            switch(fbevent.type) {
-            case XENFB_TYPE_REFRESH_PERIOD:
-                refresh_period = fbevent.refresh_period.period;
-                printk("refresh period %d\n", refresh_period);
-                refresh_cursor(x, y);
-                break;
-            }
-        }
-        if (sleep)
-            schedule();
-    }
-}
-
-static struct pcifront_dev *pci_dev;
-
-static void print_pcidev(unsigned int domain, unsigned int bus, unsigned int slot, unsigned int fun)
-{
-    unsigned int vendor, device, rev, class;
-
-    pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x00, 2, &vendor);
-    pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x02, 2, &device);
-    pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x08, 1, &rev);
-    pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x0a, 2, &class);
-
-    printk("%04x:%02x:%02x.%02x %04x: %04x:%04x (rev %02x)\n", domain, bus, slot, fun, class, vendor, device, rev);
-}
-
-static void pcifront_thread(void *p)
-{
-    pcifront_watches(NULL);
-    pci_dev = init_pcifront(NULL);
-    if (!pci_dev)
-        return;
-    printk("PCI devices:\n");
-    pcifront_scan(pci_dev, print_pcidev);
-}
-
 /* This should be overridden by the application we are linked against. */
 __attribute__((weak)) int app_main(start_info_t *si)
 {
     printk("Dummy main: start_info=%p\n", si);
-    create_thread("xenbus_tester", xenbus_tester, si);
-    create_thread("periodic_thread", periodic_thread, si);
-    create_thread("netfront", netfront_thread, si);
-    create_thread("blkfront", blkfront_thread, si);
-    create_thread("fbfront", fbfront_thread, si);
-    create_thread("kbdfront", kbdfront_thread, si);
-    create_thread("pcifront", pcifront_thread, si);
     return 0;
 }
 
@@ -534,21 +135,6 @@
 
 void stop_kernel(void)
 {
-    if (net_dev)
-        shutdown_netfront(net_dev);
-
-    if (blk_dev)
-        shutdown_blkfront(blk_dev);
-
-    if (fb_dev)
-        shutdown_fbfront(fb_dev);
-
-    if (kbd_dev)
-        shutdown_kbdfront(kbd_dev);
-
-    if (pci_dev)
-        shutdown_pcifront(pci_dev);
-
     /* TODO: fs import */
 
     local_irq_disable();
diff -r 3fb4a870393a -r 86dca025cc2d extras/mini-os/test.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/test.c	Thu Feb 09 18:33:31 2012 +0000
@@ -0,0 +1,469 @@
+/******************************************************************************
+ * test.c
+ * 
+ * Test code for all the various frontends; split from kernel.c
+ * 
+ * Copyright (c) 2002-2003, K A Fraser & R Neugebauer
+ * Copyright (c) 2005, Grzegorz Milos, Intel Research Cambridge
+ * Copyright (c) 2006, Robert Kaiser, FH Wiesbaden
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <mini-os/os.h>
+#include <mini-os/hypervisor.h>
+#include <mini-os/mm.h>
+#include <mini-os/events.h>
+#include <mini-os/time.h>
+#include <mini-os/types.h>
+#include <mini-os/lib.h>
+#include <mini-os/sched.h>
+#include <mini-os/xenbus.h>
+#include <mini-os/gnttab.h>
+#include <mini-os/netfront.h>
+#include <mini-os/blkfront.h>
+#include <mini-os/fbfront.h>
+#include <mini-os/pcifront.h>
+#include <mini-os/xmalloc.h>
+#include <fcntl.h>
+#include <xen/features.h>
+#include <xen/version.h>
+
+static struct netfront_dev *net_dev;
+
+void test_xenbus(void);
+
+static void xenbus_tester(void *p)
+{
+    printk("Xenbus tests disabled, because of a Xend bug.\n");
+    /* test_xenbus(); */
+}
+
+static void periodic_thread(void *p)
+{
+    struct timeval tv;
+    printk("Periodic thread started.\n");
+    for(;;)
+    {
+        gettimeofday(&tv, NULL);
+        printk("T(s=%ld us=%ld)\n", tv.tv_sec, tv.tv_usec);
+        msleep(1000);
+    }
+}
+
+static void netfront_thread(void *p)
+{
+    net_dev = init_netfront(NULL, NULL, NULL, NULL);
+}
+
+static struct blkfront_dev *blk_dev;
+static struct blkfront_info blk_info;
+static uint64_t blk_size_read;
+static uint64_t blk_size_write;
+
+struct blk_req {
+    struct blkfront_aiocb aiocb;
+    int rand_value;
+    struct blk_req *next;
+};
+
+#ifdef BLKTEST_WRITE
+static struct blk_req *blk_to_read;
+#endif
+
+static struct blk_req *blk_alloc_req(uint64_t sector)
+{
+    struct blk_req *req = xmalloc(struct blk_req);
+    req->aiocb.aio_dev = blk_dev;
+    req->aiocb.aio_buf = _xmalloc(blk_info.sector_size, blk_info.sector_size);
+    req->aiocb.aio_nbytes = blk_info.sector_size;
+    req->aiocb.aio_offset = sector * blk_info.sector_size;
+    req->aiocb.data = req;
+    req->next = NULL;
+    return req;
+}
+
+static void blk_read_completed(struct blkfront_aiocb *aiocb, int ret)
+{
+    struct blk_req *req = aiocb->data;
+    if (ret)
+        printk("got error code %d when reading at offset %ld\n", ret, aiocb->aio_offset);
+    else
+        blk_size_read += blk_info.sector_size;
+    free(aiocb->aio_buf);
+    free(req);
+}
+
+static void blk_read_sector(uint64_t sector)
+{
+    struct blk_req *req;
+
+    req = blk_alloc_req(sector);
+    req->aiocb.aio_cb = blk_read_completed;
+
+    blkfront_aio_read(&req->aiocb);
+}
+
+#ifdef BLKTEST_WRITE
+static void blk_write_read_completed(struct blkfront_aiocb *aiocb, int ret)
+{
+    struct blk_req *req = aiocb->data;
+    int rand_value;
+    int i;
+    int *buf;
+
+    if (ret) {
+        printk("got error code %d when reading back at offset %ld\n", ret, aiocb->aio_offset);
+        free(aiocb->aio_buf);
+        free(req);
+        return;
+    }
+    blk_size_read += blk_info.sector_size;
+    buf = (int*) aiocb->aio_buf;
+    rand_value = req->rand_value;
+    for (i = 0; i < blk_info.sector_size / sizeof(int); i++) {
+        if (buf[i] != rand_value) {
+            printk("bogus data at offset %ld\n", aiocb->aio_offset + i);
+            break;
+        }
+        rand_value *= RAND_MIX;
+    }
+    free(aiocb->aio_buf);
+    free(req);
+}
+
+static void blk_write_completed(struct blkfront_aiocb *aiocb, int ret)
+{
+    struct blk_req *req = aiocb->data;
+    if (ret) {
+        printk("got error code %d when writing at offset %ld\n", ret, aiocb->aio_offset);
+        free(aiocb->aio_buf);
+        free(req);
+        return;
+    }
+    blk_size_write += blk_info.sector_size;
+    /* Push write check */
+    req->next = blk_to_read;
+    blk_to_read = req;
+}
+
+static void blk_write_sector(uint64_t sector)
+{
+    struct blk_req *req;
+    int rand_value;
+    int i;
+    int *buf;
+
+    req = blk_alloc_req(sector);
+    req->aiocb.aio_cb = blk_write_completed;
+    req->rand_value = rand_value = rand();
+
+    buf = (int*) req->aiocb.aio_buf;
+    for (i = 0; i < blk_info.sector_size / sizeof(int); i++) {
+        buf[i] = rand_value;
+        rand_value *= RAND_MIX;
+    }
+
+    blkfront_aio_write(&req->aiocb);
+}
+#endif
+
+static void blkfront_thread(void *p)
+{
+    time_t lasttime = 0;
+
+    blk_dev = init_blkfront(NULL, &blk_info);
+    if (!blk_dev)
+        return;
+
+    if (blk_info.info & VDISK_CDROM)
+        printk("Block device is a CDROM\n");
+    if (blk_info.info & VDISK_REMOVABLE)
+        printk("Block device is removable\n");
+    if (blk_info.info & VDISK_READONLY)
+        printk("Block device is read-only\n");
+
+#ifdef BLKTEST_WRITE
+    if (blk_info.mode == O_RDWR) {
+        blk_write_sector(0);
+        blk_write_sector(blk_info.sectors-1);
+    } else
+#endif
+    {
+        blk_read_sector(0);
+        blk_read_sector(blk_info.sectors-1);
+    }
+
+    while (1) {
+        uint64_t sector = rand() % blk_info.sectors;
+        struct timeval tv;
+#ifdef BLKTEST_WRITE
+        if (blk_info.mode == O_RDWR)
+            blk_write_sector(sector);
+        else
+#endif
+            blk_read_sector(sector);
+        blkfront_aio_poll(blk_dev);
+        gettimeofday(&tv, NULL);
+        if (tv.tv_sec > lasttime + 10) {
+            printk("%llu read, %llu write\n", blk_size_read, blk_size_write);
+            lasttime = tv.tv_sec;
+        }
+
+#ifdef BLKTEST_WRITE
+        while (blk_to_read) {
+            struct blk_req *req = blk_to_read;
+            blk_to_read = blk_to_read->next;
+            req->aiocb.aio_cb = blk_write_read_completed;
+            blkfront_aio_read(&req->aiocb);
+        }
+#endif
+    }
+}
+
+#define WIDTH 800
+#define HEIGHT 600
+#define DEPTH 32
+
+static uint32_t *fb;
+static int refresh_period = 50;
+static struct fbfront_dev *fb_dev;
+static struct semaphore fbfront_sem = __SEMAPHORE_INITIALIZER(fbfront_sem, 0);
+
+static void fbfront_drawvert(int x, int y1, int y2, uint32_t color)
+{
+    int y;
+    if (x < 0)
+        return;
+    if (x >= WIDTH)
+        return;
+    if (y1 < 0)
+        y1 = 0;
+    if (y2 >= HEIGHT)
+        y2 = HEIGHT-1;
+    for (y = y1; y <= y2; y++)
+        fb[x + y*WIDTH] ^= color;
+}
+
+static void fbfront_drawhoriz(int x1, int x2, int y, uint32_t color)
+{
+    int x;
+    if (y < 0)
+        return;
+    if (y >= HEIGHT)
+        return;
+    if (x1 < 0)
+        x1 = 0;
+    if (x2 >= WIDTH)
+        x2 = WIDTH-1;
+    for (x = x1; x <= x2; x++)
+        fb[x + y*WIDTH] ^= color;
+}
+
+static void fbfront_thread(void *p)
+{
+    size_t line_length = WIDTH * (DEPTH / 8);
+    size_t memsize = HEIGHT * line_length;
+    unsigned long *mfns;
+    int i, n = (memsize + PAGE_SIZE-1) / PAGE_SIZE;
+
+    memsize = n * PAGE_SIZE;
+    fb = _xmalloc(memsize, PAGE_SIZE);
+    memset(fb, 0, memsize);
+    mfns = xmalloc_array(unsigned long, n);
+    for (i = 0; i < n; i++)
+        mfns[i] = virtual_to_mfn((char *) fb + i * PAGE_SIZE);
+    fb_dev = init_fbfront(NULL, mfns, WIDTH, HEIGHT, DEPTH, line_length, n);
+    xfree(mfns);
+    if (!fb_dev) {
+        xfree(fb);
+        return;
+    }
+    up(&fbfront_sem);
+}
+
+static void clip_cursor(int *x, int *y)
+{
+    if (*x < 0)
+        *x = 0;
+    if (*x >= WIDTH)
+        *x = WIDTH - 1;
+    if (*y < 0)
+        *y = 0;
+    if (*y >= HEIGHT)
+        *y = HEIGHT - 1;
+}
+
+static void refresh_cursor(int new_x, int new_y)
+{
+    static int old_x = -1, old_y = -1;
+
+    if (!refresh_period)
+        return;
+
+    if (old_x != -1 && old_y != -1) {
+        fbfront_drawvert(old_x, old_y + 1, old_y + 8, 0xffffffff);
+        fbfront_drawhoriz(old_x + 1, old_x + 8, old_y, 0xffffffff);
+        fbfront_update(fb_dev, old_x, old_y, 9, 9);
+    }
+    old_x = new_x;
+    old_y = new_y;
+    fbfront_drawvert(new_x, new_y + 1, new_y + 8, 0xffffffff);
+    fbfront_drawhoriz(new_x + 1, new_x + 8, new_y, 0xffffffff);
+    fbfront_update(fb_dev, new_x, new_y, 9, 9);
+}
+
+static struct kbdfront_dev *kbd_dev;
+static void kbdfront_thread(void *p)
+{
+    DEFINE_WAIT(w);
+    DEFINE_WAIT(w2);
+    int x = WIDTH / 2, y = HEIGHT / 2, z = 0;
+
+    kbd_dev = init_kbdfront(NULL, 1);
+    if (!kbd_dev)
+        return;
+
+    down(&fbfront_sem);
+    refresh_cursor(x, y);
+    while (1) {
+        union xenkbd_in_event kbdevent;
+        union xenfb_in_event fbevent;
+        int sleep = 1;
+
+        add_waiter(w, kbdfront_queue);
+        add_waiter(w2, fbfront_queue);
+
+        while (kbdfront_receive(kbd_dev, &kbdevent, 1) != 0) {
+            sleep = 0;
+            switch(kbdevent.type) {
+            case XENKBD_TYPE_MOTION:
+                printk("motion x:%d y:%d z:%d\n",
+                        kbdevent.motion.rel_x,
+                        kbdevent.motion.rel_y,
+                        kbdevent.motion.rel_z);
+                x += kbdevent.motion.rel_x;
+                y += kbdevent.motion.rel_y;
+                z += kbdevent.motion.rel_z;
+                clip_cursor(&x, &y);
+                refresh_cursor(x, y);
+                break;
+            case XENKBD_TYPE_POS:
+                printk("pos x:%d y:%d dz:%d\n",
+                        kbdevent.pos.abs_x,
+                        kbdevent.pos.abs_y,
+                        kbdevent.pos.rel_z);
+                x = kbdevent.pos.abs_x;
+                y = kbdevent.pos.abs_y;
+                z = kbdevent.pos.rel_z;
+                clip_cursor(&x, &y);
+                refresh_cursor(x, y);
+                break;
+            case XENKBD_TYPE_KEY:
+                printk("key %d %s\n",
+                        kbdevent.key.keycode,
+                        kbdevent.key.pressed ? "pressed" : "released");
+                if (kbdevent.key.keycode == BTN_LEFT) {
+                    printk("mouse %s at (%d,%d,%d)\n",
+                            kbdevent.key.pressed ? "clic" : "release", x, y, z);
+                    if (kbdevent.key.pressed) {
+                        uint32_t color = rand();
+                        fbfront_drawvert(x - 16, y - 16, y + 15, color);
+                        fbfront_drawhoriz(x - 16, x + 15, y + 16, color);
+                        fbfront_drawvert(x + 16, y - 15, y + 16, color);
+                        fbfront_drawhoriz(x - 15, x + 16, y - 16, color);
+                        fbfront_update(fb_dev, x - 16, y - 16, 33, 33);
+                    }
+                } else if (kbdevent.key.keycode == KEY_Q) {
+                    struct sched_shutdown sched_shutdown = { .reason = SHUTDOWN_poweroff };
+                    HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
+                    do_exit();
+                }
+                break;
+            }
+        }
+        while (fbfront_receive(fb_dev, &fbevent, 1) != 0) {
+            sleep = 0;
+            switch(fbevent.type) {
+            case XENFB_TYPE_REFRESH_PERIOD:
+                refresh_period = fbevent.refresh_period.period;
+                printk("refresh period %d\n", refresh_period);
+                refresh_cursor(x, y);
+                break;
+            }
+        }
+        if (sleep)
+            schedule();
+    }
+}
+
+static struct pcifront_dev *pci_dev;
+
+static void print_pcidev(unsigned int domain, unsigned int bus, unsigned int slot, unsigned int fun)
+{
+    unsigned int vendor, device, rev, class;
+
+    pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x00, 2, &vendor);
+    pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x02, 2, &device);
+    pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x08, 1, &rev);
+    pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x0a, 2, &class);
+
+    printk("%04x:%02x:%02x.%02x %04x: %04x:%04x (rev %02x)\n", domain, bus, slot, fun, class, vendor, device, rev);
+}
+
+static void pcifront_thread(void *p)
+{
+    pcifront_watches(NULL);
+    pci_dev = init_pcifront(NULL);
+    if (!pci_dev)
+        return;
+    printk("PCI devices:\n");
+    pcifront_scan(pci_dev, print_pcidev);
+}
+
+int app_main(start_info_t *si)
+{
+    printk("Test main: start_info=%p\n", si);
+    create_thread("xenbus_tester", xenbus_tester, si);
+    create_thread("periodic_thread", periodic_thread, si);
+    create_thread("netfront", netfront_thread, si);
+    create_thread("blkfront", blkfront_thread, si);
+    create_thread("fbfront", fbfront_thread, si);
+    create_thread("kbdfront", kbdfront_thread, si);
+    create_thread("pcifront", pcifront_thread, si);
+    return 0;
+}
+
+void shutdown_frontends(void)
+{
+    if (net_dev)
+        shutdown_netfront(net_dev);
+
+    if (blk_dev)
+        shutdown_blkfront(blk_dev);
+
+    if (fb_dev)
+        shutdown_fbfront(fb_dev);
+
+    if (kbd_dev)
+        shutdown_kbdfront(kbd_dev);
+
+    if (pci_dev)
+        shutdown_pcifront(pci_dev);
+}
diff -r 3fb4a870393a -r 86dca025cc2d stubdom/c/minios.cfg
--- a/stubdom/c/minios.cfg	Thu Feb 09 18:33:31 2012 +0000
+++ b/stubdom/c/minios.cfg	Thu Feb 09 18:33:31 2012 +0000
@@ -0,0 +1,1 @@
+CONFIG_TEST=y
diff -r 3fb4a870393a -r 86dca025cc2d stubdom/caml/minios.cfg
--- a/stubdom/caml/minios.cfg	Thu Feb 09 18:33:31 2012 +0000
+++ b/stubdom/caml/minios.cfg	Thu Feb 09 18:33:31 2012 +0000
@@ -0,0 +1,1 @@
+CONFIG_TEST=y

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eI-0003cO-Fo; Sat, 11 Feb 2012 04:33:22 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eG-0003Yb-By
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1328934744!53806608!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7785 invoked from network); 11 Feb 2012 04:32:25 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:25 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eA-0006Qo-Ja
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eA-0001Ad-FE
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:14 +0000
Message-Id: <E1Rw4eA-0001Ad-FE@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mini-os: create app-specific
	configuration
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812411 0
# Node ID 3fb4a870393a84f695a9caacf8ae6f79f7e64941
# Parent  0bf5499b770d640b7575694c438cb6943d769262
mini-os: create app-specific configuration

Instead of using CONFIG_QEMU and CONFIG_GRUB to enable or disable minios
code, create CONFIG_ items for features and use application-specific
configuration files to enable or disable the features.

The configuration flags are currently added to the compiler command
line; as the number of flags grows this may need to move to a header.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r 0bf5499b770d -r 3fb4a870393a extras/mini-os/Makefile
--- a/extras/mini-os/Makefile	Thu Feb 09 18:33:30 2012 +0000
+++ b/extras/mini-os/Makefile	Thu Feb 09 18:33:31 2012 +0000
@@ -8,10 +8,25 @@
 include $(XEN_ROOT)/Config.mk
 OBJ_DIR ?= $(CURDIR)
 
-ifneq ($(stubdom),y)
+ifeq ($(MINIOS_CONFIG),)
 include Config.mk
+else
+EXTRA_DEPS += $(MINIOS_CONFIG)
+include $(MINIOS_CONFIG)
 endif
 
+# Configuration defaults
+CONFIG_START_NETWORK ?= y
+CONFIG_SPARSE_BSS ?= y
+CONFIG_QEMU_XS_ARGS ?= n
+
+# Export config items as compiler directives
+flags-$(CONFIG_START_NETWORK) += -DCONFIG_START_NETWORK
+flags-$(CONFIG_SPARSE_BSS) += -DCONFIG_SPARSE_BSS
+flags-$(CONFIG_QEMU_XS_ARGS) += -DCONFIG_QEMU_XS_ARGS
+
+DEF_CFLAGS += $(flags-y)
+
 # Include common mini-os makerules.
 include minios.mk
 
@@ -34,13 +49,38 @@
 # Subdirectories common to mini-os
 SUBDIRS := lib xenbus console
 
+src-y += blkfront.c
+src-y += daytime.c
+src-y += events.c
+src-y += fbfront.c
+src-y += gntmap.c
+src-y += gnttab.c
+src-y += hypervisor.c
+src-y += kernel.c
+src-y += lock.c
+src-y += main.c
+src-y += mm.c
+src-y += netfront.c
+src-y += pcifront.c
+src-y += sched.c
+
+src-y += lib/ctype.c
+src-y += lib/math.c
+src-y += lib/printf.c
+src-y += lib/stack_chk_fail.c
+src-y += lib/string.c
+src-y += lib/sys.c
+src-y += lib/xmalloc.c
+src-y += lib/xs.c
+
+src-y += xenbus/xenbus.c
+
+src-y += console/console.c
+src-y += console/xencons_ring.c
+
 # The common mini-os objects to build.
 APP_OBJS :=
-OBJS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(wildcard *.c))
-OBJS += $(patsubst %.c,$(OBJ_DIR)/%.o,$(wildcard lib/*.c))
-OBJS += $(patsubst %.c,$(OBJ_DIR)/%.o,$(wildcard xenbus/*.c))
-OBJS += $(patsubst %.c,$(OBJ_DIR)/%.o,$(wildcard console/*.c))
-
+OBJS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(src-y))
 
 .PHONY: default
 default: $(OBJ_DIR)/$(TARGET)
diff -r 0bf5499b770d -r 3fb4a870393a extras/mini-os/main.c
--- a/extras/mini-os/main.c	Thu Feb 09 18:33:30 2012 +0000
+++ b/extras/mini-os/main.c	Thu Feb 09 18:33:31 2012 +0000
@@ -43,13 +43,13 @@
 static void call_main(void *p)
 {
     char *c, quote;
-#ifdef CONFIG_QEMU
+#ifdef CONFIG_QEMU_XS_ARGS
     char *domargs, *msg;
 #endif
     int argc;
     char **argv;
     char *envp[] = { NULL };
-#ifdef CONFIG_QEMU
+#ifdef CONFIG_QEMU_XS_ARGS
     char *vm;
     char path[128];
     int domid;
@@ -60,15 +60,15 @@
      * crashing. */
     //sleep(1);
 
-#ifndef CONFIG_GRUB
+#ifdef CONFIG_SPARSE_BSS
     sparse((unsigned long) &__app_bss_start, &__app_bss_end - &__app_bss_start);
-#if defined(HAVE_LWIP) && !defined(CONFIG_QEMU)
+#endif
+#if defined(HAVE_LWIP) && defined(CONFIG_START_NETWORK)
     start_networking();
 #endif
-#endif
     create_thread("pcifront", pcifront_watches, NULL);
 
-#ifdef CONFIG_QEMU
+#ifdef CONFIG_QEMU_XS_ARGS
     /* Fetch argc, argv from XenStore */
     domid = xenbus_read_integer("target");
     if (domid == -1) {
@@ -132,7 +132,7 @@
 #define PARSE_ARGS_STORE(ARGS) PARSE_ARGS(ARGS, argv[argc++] = c, memmove(c, c + 1, strlen(c + 1) + 1), *c++ = 0)
 
     PARSE_ARGS_COUNT((char*)start_info.cmd_line);
-#ifdef CONFIG_QEMU
+#ifdef CONFIG_QEMU_XS_ARGS
     PARSE_ARGS_COUNT(domargs);
 #endif
 
@@ -141,7 +141,7 @@
     argc = 1;
 
     PARSE_ARGS_STORE((char*)start_info.cmd_line)
-#ifdef CONFIG_QEMU
+#ifdef CONFIG_QEMU_XS_ARGS
     PARSE_ARGS_STORE(domargs)
 #endif
 
diff -r 0bf5499b770d -r 3fb4a870393a extras/mini-os/minios.mk
--- a/extras/mini-os/minios.mk	Thu Feb 09 18:33:30 2012 +0000
+++ b/extras/mini-os/minios.mk	Thu Feb 09 18:33:31 2012 +0000
@@ -39,8 +39,8 @@
 
 # Special build dependencies.
 # Rebuild all after touching this/these file(s)
-EXTRA_DEPS = $(MINI-OS_ROOT)/minios.mk \
-		$(MINI-OS_ROOT)/$(TARGET_ARCH_DIR)/arch.mk
+EXTRA_DEPS += $(MINI-OS_ROOT)/minios.mk
+EXTRA_DEPS += $(MINI-OS_ROOT)/$(TARGET_ARCH_DIR)/arch.mk
 
 # Find all header files for checking dependencies.
 HDRS := $(wildcard $(MINI-OS_ROOT)/include/*.h)
diff -r 0bf5499b770d -r 3fb4a870393a stubdom/Makefile
--- a/stubdom/Makefile	Thu Feb 09 18:33:30 2012 +0000
+++ b/stubdom/Makefile	Thu Feb 09 18:33:31 2012 +0000
@@ -341,19 +341,19 @@
 .PHONY: ioemu-stubdom
 ioemu-stubdom: APP_OBJS=$(CURDIR)/ioemu/i386-stubdom/qemu.a $(CURDIR)/ioemu/i386-stubdom/libqemu.a $(CURDIR)/ioemu/libqemu_common.a
 ioemu-stubdom: mini-os-$(XEN_TARGET_ARCH)-ioemu lwip-$(XEN_TARGET_ARCH) libxc ioemu
-	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_QEMU $(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS="$(APP_OBJS)"
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/ioemu-minios.cfg" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS="$(APP_OBJS)"
 
 .PHONY: caml-stubdom
 caml-stubdom: mini-os-$(XEN_TARGET_ARCH)-caml lwip-$(XEN_TARGET_ARCH) libxc cross-ocaml caml
-	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_CAML $(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS="$(CURDIR)/caml/main-caml.o $(CURDIR)/caml/caml.o $(CAMLLIB)/libasmrun.a"
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/caml/minios.cfg" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS="$(CURDIR)/caml/main-caml.o $(CURDIR)/caml/caml.o $(CAMLLIB)/libasmrun.a"
 
 .PHONY: c-stubdom
 c-stubdom: mini-os-$(XEN_TARGET_ARCH)-c lwip-$(XEN_TARGET_ARCH) libxc c
-	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_C $(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS=$(CURDIR)/c/main.a
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/c/minios.cfg" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS=$(CURDIR)/c/main.a
 
 .PHONY: pv-grub
 pv-grub: mini-os-$(XEN_TARGET_ARCH)-grub libxc grub
-	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_GRUB $(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/grub-$(XEN_TARGET_ARCH)/main.a
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/grub/minios.cfg" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/grub-$(XEN_TARGET_ARCH)/main.a
 
 #########
 # install
diff -r 0bf5499b770d -r 3fb4a870393a stubdom/grub/minios.cfg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stubdom/grub/minios.cfg	Thu Feb 09 18:33:31 2012 +0000
@@ -0,0 +1,2 @@
+CONFIG_START_NETWORK=n
+CONFIG_SPARSE_BSS=n
diff -r 0bf5499b770d -r 3fb4a870393a stubdom/ioemu-minios.cfg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stubdom/ioemu-minios.cfg	Thu Feb 09 18:33:31 2012 +0000
@@ -0,0 +1,2 @@
+CONFIG_START_NETWORK=n
+CONFIG_QEMU_XS_ARGS=y

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eI-0003cO-Fo; Sat, 11 Feb 2012 04:33:22 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eG-0003Yb-By
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1328934744!53806608!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7785 invoked from network); 11 Feb 2012 04:32:25 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:25 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eA-0006Qo-Ja
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eA-0001Ad-FE
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:14 +0000
Message-Id: <E1Rw4eA-0001Ad-FE@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mini-os: create app-specific
	configuration
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812411 0
# Node ID 3fb4a870393a84f695a9caacf8ae6f79f7e64941
# Parent  0bf5499b770d640b7575694c438cb6943d769262
mini-os: create app-specific configuration

Instead of using CONFIG_QEMU and CONFIG_GRUB to enable or disable minios
code, create CONFIG_ items for features and use application-specific
configuration files to enable or disable the features.

The configuration flags are currently added to the compiler command
line; as the number of flags grows this may need to move to a header.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r 0bf5499b770d -r 3fb4a870393a extras/mini-os/Makefile
--- a/extras/mini-os/Makefile	Thu Feb 09 18:33:30 2012 +0000
+++ b/extras/mini-os/Makefile	Thu Feb 09 18:33:31 2012 +0000
@@ -8,10 +8,25 @@
 include $(XEN_ROOT)/Config.mk
 OBJ_DIR ?= $(CURDIR)
 
-ifneq ($(stubdom),y)
+ifeq ($(MINIOS_CONFIG),)
 include Config.mk
+else
+EXTRA_DEPS += $(MINIOS_CONFIG)
+include $(MINIOS_CONFIG)
 endif
 
+# Configuration defaults
+CONFIG_START_NETWORK ?= y
+CONFIG_SPARSE_BSS ?= y
+CONFIG_QEMU_XS_ARGS ?= n
+
+# Export config items as compiler directives
+flags-$(CONFIG_START_NETWORK) += -DCONFIG_START_NETWORK
+flags-$(CONFIG_SPARSE_BSS) += -DCONFIG_SPARSE_BSS
+flags-$(CONFIG_QEMU_XS_ARGS) += -DCONFIG_QEMU_XS_ARGS
+
+DEF_CFLAGS += $(flags-y)
+
 # Include common mini-os makerules.
 include minios.mk
 
@@ -34,13 +49,38 @@
 # Subdirectories common to mini-os
 SUBDIRS := lib xenbus console
 
+src-y += blkfront.c
+src-y += daytime.c
+src-y += events.c
+src-y += fbfront.c
+src-y += gntmap.c
+src-y += gnttab.c
+src-y += hypervisor.c
+src-y += kernel.c
+src-y += lock.c
+src-y += main.c
+src-y += mm.c
+src-y += netfront.c
+src-y += pcifront.c
+src-y += sched.c
+
+src-y += lib/ctype.c
+src-y += lib/math.c
+src-y += lib/printf.c
+src-y += lib/stack_chk_fail.c
+src-y += lib/string.c
+src-y += lib/sys.c
+src-y += lib/xmalloc.c
+src-y += lib/xs.c
+
+src-y += xenbus/xenbus.c
+
+src-y += console/console.c
+src-y += console/xencons_ring.c
+
 # The common mini-os objects to build.
 APP_OBJS :=
-OBJS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(wildcard *.c))
-OBJS += $(patsubst %.c,$(OBJ_DIR)/%.o,$(wildcard lib/*.c))
-OBJS += $(patsubst %.c,$(OBJ_DIR)/%.o,$(wildcard xenbus/*.c))
-OBJS += $(patsubst %.c,$(OBJ_DIR)/%.o,$(wildcard console/*.c))
-
+OBJS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(src-y))
 
 .PHONY: default
 default: $(OBJ_DIR)/$(TARGET)
diff -r 0bf5499b770d -r 3fb4a870393a extras/mini-os/main.c
--- a/extras/mini-os/main.c	Thu Feb 09 18:33:30 2012 +0000
+++ b/extras/mini-os/main.c	Thu Feb 09 18:33:31 2012 +0000
@@ -43,13 +43,13 @@
 static void call_main(void *p)
 {
     char *c, quote;
-#ifdef CONFIG_QEMU
+#ifdef CONFIG_QEMU_XS_ARGS
     char *domargs, *msg;
 #endif
     int argc;
     char **argv;
     char *envp[] = { NULL };
-#ifdef CONFIG_QEMU
+#ifdef CONFIG_QEMU_XS_ARGS
     char *vm;
     char path[128];
     int domid;
@@ -60,15 +60,15 @@
      * crashing. */
     //sleep(1);
 
-#ifndef CONFIG_GRUB
+#ifdef CONFIG_SPARSE_BSS
     sparse((unsigned long) &__app_bss_start, &__app_bss_end - &__app_bss_start);
-#if defined(HAVE_LWIP) && !defined(CONFIG_QEMU)
+#endif
+#if defined(HAVE_LWIP) && defined(CONFIG_START_NETWORK)
     start_networking();
 #endif
-#endif
     create_thread("pcifront", pcifront_watches, NULL);
 
-#ifdef CONFIG_QEMU
+#ifdef CONFIG_QEMU_XS_ARGS
     /* Fetch argc, argv from XenStore */
     domid = xenbus_read_integer("target");
     if (domid == -1) {
@@ -132,7 +132,7 @@
 #define PARSE_ARGS_STORE(ARGS) PARSE_ARGS(ARGS, argv[argc++] = c, memmove(c, c + 1, strlen(c + 1) + 1), *c++ = 0)
 
     PARSE_ARGS_COUNT((char*)start_info.cmd_line);
-#ifdef CONFIG_QEMU
+#ifdef CONFIG_QEMU_XS_ARGS
     PARSE_ARGS_COUNT(domargs);
 #endif
 
@@ -141,7 +141,7 @@
     argc = 1;
 
     PARSE_ARGS_STORE((char*)start_info.cmd_line)
-#ifdef CONFIG_QEMU
+#ifdef CONFIG_QEMU_XS_ARGS
     PARSE_ARGS_STORE(domargs)
 #endif
 
diff -r 0bf5499b770d -r 3fb4a870393a extras/mini-os/minios.mk
--- a/extras/mini-os/minios.mk	Thu Feb 09 18:33:30 2012 +0000
+++ b/extras/mini-os/minios.mk	Thu Feb 09 18:33:31 2012 +0000
@@ -39,8 +39,8 @@
 
 # Special build dependencies.
 # Rebuild all after touching this/these file(s)
-EXTRA_DEPS = $(MINI-OS_ROOT)/minios.mk \
-		$(MINI-OS_ROOT)/$(TARGET_ARCH_DIR)/arch.mk
+EXTRA_DEPS += $(MINI-OS_ROOT)/minios.mk
+EXTRA_DEPS += $(MINI-OS_ROOT)/$(TARGET_ARCH_DIR)/arch.mk
 
 # Find all header files for checking dependencies.
 HDRS := $(wildcard $(MINI-OS_ROOT)/include/*.h)
diff -r 0bf5499b770d -r 3fb4a870393a stubdom/Makefile
--- a/stubdom/Makefile	Thu Feb 09 18:33:30 2012 +0000
+++ b/stubdom/Makefile	Thu Feb 09 18:33:31 2012 +0000
@@ -341,19 +341,19 @@
 .PHONY: ioemu-stubdom
 ioemu-stubdom: APP_OBJS=$(CURDIR)/ioemu/i386-stubdom/qemu.a $(CURDIR)/ioemu/i386-stubdom/libqemu.a $(CURDIR)/ioemu/libqemu_common.a
 ioemu-stubdom: mini-os-$(XEN_TARGET_ARCH)-ioemu lwip-$(XEN_TARGET_ARCH) libxc ioemu
-	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_QEMU $(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS="$(APP_OBJS)"
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/ioemu-minios.cfg" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS="$(APP_OBJS)"
 
 .PHONY: caml-stubdom
 caml-stubdom: mini-os-$(XEN_TARGET_ARCH)-caml lwip-$(XEN_TARGET_ARCH) libxc cross-ocaml caml
-	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_CAML $(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS="$(CURDIR)/caml/main-caml.o $(CURDIR)/caml/caml.o $(CAMLLIB)/libasmrun.a"
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/caml/minios.cfg" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS="$(CURDIR)/caml/main-caml.o $(CURDIR)/caml/caml.o $(CAMLLIB)/libasmrun.a"
 
 .PHONY: c-stubdom
 c-stubdom: mini-os-$(XEN_TARGET_ARCH)-c lwip-$(XEN_TARGET_ARCH) libxc c
-	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_C $(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS=$(CURDIR)/c/main.a
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/c/minios.cfg" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS=$(CURDIR)/c/main.a
 
 .PHONY: pv-grub
 pv-grub: mini-os-$(XEN_TARGET_ARCH)-grub libxc grub
-	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="-DCONFIG_GRUB $(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/grub-$(XEN_TARGET_ARCH)/main.a
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/grub/minios.cfg" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/grub-$(XEN_TARGET_ARCH)/main.a
 
 #########
 # install
diff -r 0bf5499b770d -r 3fb4a870393a stubdom/grub/minios.cfg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stubdom/grub/minios.cfg	Thu Feb 09 18:33:31 2012 +0000
@@ -0,0 +1,2 @@
+CONFIG_START_NETWORK=n
+CONFIG_SPARSE_BSS=n
diff -r 0bf5499b770d -r 3fb4a870393a stubdom/ioemu-minios.cfg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stubdom/ioemu-minios.cfg	Thu Feb 09 18:33:31 2012 +0000
@@ -0,0 +1,2 @@
+CONFIG_START_NETWORK=n
+CONFIG_QEMU_XS_ARGS=y

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eK-0003eY-5E; Sat, 11 Feb 2012 04:33:24 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eI-0003aD-8w
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:22 +0000
Received: from [85.158.143.35:31155] by server-2.bemta-4.messagelabs.com id
	7B/5D-02822-19FE53F4; Sat, 11 Feb 2012 04:33:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1328934799!2386549!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22374 invoked from network); 11 Feb 2012 04:33:20 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eF-0006RF-Am
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eF-0001EJ-9Q
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:19 +0000
Message-Id: <E1Rw4eF-0001EJ-9Q@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstored: add --event parameter for
	bootstrapping
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812415 0
# Node ID c442ebf5834d7b1a08d40a99a2babd0517e02713
# Parent  f371834bac0998d1eaa0cb5d8943f1c231afc5d1
xenstored: add --event parameter for bootstrapping

When xenstored is run in a minios domain, it needs a bootstrap
connection to dom0 so that additional domain introduce messages can be
sent to it.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r f371834bac09 -r c442ebf5834d tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:34 2012 +0000
+++ b/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:35 2012 +0000
@@ -1749,6 +1749,7 @@
 	{ "no-domain-init", 0, NULL, 'D' },
 	{ "entry-nb", 1, NULL, 'E' },
 	{ "pid-file", 1, NULL, 'F' },
+	{ "event", 1, NULL, 'e' },
 	{ "help", 0, NULL, 'H' },
 	{ "no-fork", 0, NULL, 'N' },
 	{ "output-pid", 0, NULL, 'P' },
@@ -1763,6 +1764,7 @@
 	{ NULL, 0, NULL, 0 } };
 
 extern void dump_conn(struct connection *conn); 
+int dom0_event = 0;
 
 int main(int argc, char *argv[])
 {
@@ -1820,6 +1822,9 @@
 		case 'W':
 			quota_nb_watch_per_domain = strtol(optarg, NULL, 10);
 			break;
+		case 'e':
+			dom0_event = strtol(optarg, NULL, 10);
+			break;
 		}
 	}
 	if (optind != argc)
diff -r f371834bac09 -r c442ebf5834d tools/xenstore/xenstored_core.h
--- a/tools/xenstore/xenstored_core.h	Thu Feb 09 18:33:34 2012 +0000
+++ b/tools/xenstore/xenstored_core.h	Thu Feb 09 18:33:35 2012 +0000
@@ -168,6 +168,7 @@
 void dtrace_io(const struct connection *conn, const struct buffered_data *data, int out);
 
 extern int event_fd;
+extern int dom0_event;
 
 /* Map the kernel's xenstore page. */
 void *xenbus_map(void);
@@ -190,6 +191,8 @@
 /* Open a pipe for signal handling */
 void init_pipe(int reopen_log_pipe[2]);
 
+xc_gnttab **xcg_handle;
+
 #endif /* _XENSTORED_CORE_H */
 
 /*
diff -r f371834bac09 -r c442ebf5834d tools/xenstore/xenstored_domain.c
--- a/tools/xenstore/xenstored_domain.c	Thu Feb 09 18:33:34 2012 +0000
+++ b/tools/xenstore/xenstored_domain.c	Thu Feb 09 18:33:35 2012 +0000
@@ -35,7 +35,7 @@
 #include <xen/grant_table.h>
 
 static xc_interface **xc_handle;
-static xc_gnttab **xcg_handle;
+xc_gnttab **xcg_handle;
 static evtchn_port_t virq_port;
 
 xc_evtchn *xce_handle = NULL;
diff -r f371834bac09 -r c442ebf5834d tools/xenstore/xenstored_minios.c
--- a/tools/xenstore/xenstored_minios.c	Thu Feb 09 18:33:34 2012 +0000
+++ b/tools/xenstore/xenstored_minios.c	Thu Feb 09 18:33:35 2012 +0000
@@ -46,15 +46,17 @@
 
 evtchn_port_t xenbus_evtchn(void)
 {
-	return -1;
+	return dom0_event;
 }
 
 void *xenbus_map(void)
 {
-	return NULL;
+	return xc_gnttab_map_grant_ref(*xcg_handle, 0,
+			GNTTAB_RESERVED_XENSTORE, PROT_READ|PROT_WRITE);
 }
 
 void unmap_xenbus(void *interface)
 {
+	xc_gnttab_munmap(*xcg_handle, interface, 1);
 }
 

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eK-0003eY-5E; Sat, 11 Feb 2012 04:33:24 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eI-0003aD-8w
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:22 +0000
Received: from [85.158.143.35:31155] by server-2.bemta-4.messagelabs.com id
	7B/5D-02822-19FE53F4; Sat, 11 Feb 2012 04:33:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1328934799!2386549!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22374 invoked from network); 11 Feb 2012 04:33:20 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eF-0006RF-Am
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eF-0001EJ-9Q
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:19 +0000
Message-Id: <E1Rw4eF-0001EJ-9Q@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstored: add --event parameter for
	bootstrapping
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812415 0
# Node ID c442ebf5834d7b1a08d40a99a2babd0517e02713
# Parent  f371834bac0998d1eaa0cb5d8943f1c231afc5d1
xenstored: add --event parameter for bootstrapping

When xenstored is run in a minios domain, it needs a bootstrap
connection to dom0 so that additional domain introduce messages can be
sent to it.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r f371834bac09 -r c442ebf5834d tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:34 2012 +0000
+++ b/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:35 2012 +0000
@@ -1749,6 +1749,7 @@
 	{ "no-domain-init", 0, NULL, 'D' },
 	{ "entry-nb", 1, NULL, 'E' },
 	{ "pid-file", 1, NULL, 'F' },
+	{ "event", 1, NULL, 'e' },
 	{ "help", 0, NULL, 'H' },
 	{ "no-fork", 0, NULL, 'N' },
 	{ "output-pid", 0, NULL, 'P' },
@@ -1763,6 +1764,7 @@
 	{ NULL, 0, NULL, 0 } };
 
 extern void dump_conn(struct connection *conn); 
+int dom0_event = 0;
 
 int main(int argc, char *argv[])
 {
@@ -1820,6 +1822,9 @@
 		case 'W':
 			quota_nb_watch_per_domain = strtol(optarg, NULL, 10);
 			break;
+		case 'e':
+			dom0_event = strtol(optarg, NULL, 10);
+			break;
 		}
 	}
 	if (optind != argc)
diff -r f371834bac09 -r c442ebf5834d tools/xenstore/xenstored_core.h
--- a/tools/xenstore/xenstored_core.h	Thu Feb 09 18:33:34 2012 +0000
+++ b/tools/xenstore/xenstored_core.h	Thu Feb 09 18:33:35 2012 +0000
@@ -168,6 +168,7 @@
 void dtrace_io(const struct connection *conn, const struct buffered_data *data, int out);
 
 extern int event_fd;
+extern int dom0_event;
 
 /* Map the kernel's xenstore page. */
 void *xenbus_map(void);
@@ -190,6 +191,8 @@
 /* Open a pipe for signal handling */
 void init_pipe(int reopen_log_pipe[2]);
 
+xc_gnttab **xcg_handle;
+
 #endif /* _XENSTORED_CORE_H */
 
 /*
diff -r f371834bac09 -r c442ebf5834d tools/xenstore/xenstored_domain.c
--- a/tools/xenstore/xenstored_domain.c	Thu Feb 09 18:33:34 2012 +0000
+++ b/tools/xenstore/xenstored_domain.c	Thu Feb 09 18:33:35 2012 +0000
@@ -35,7 +35,7 @@
 #include <xen/grant_table.h>
 
 static xc_interface **xc_handle;
-static xc_gnttab **xcg_handle;
+xc_gnttab **xcg_handle;
 static evtchn_port_t virq_port;
 
 xc_evtchn *xce_handle = NULL;
diff -r f371834bac09 -r c442ebf5834d tools/xenstore/xenstored_minios.c
--- a/tools/xenstore/xenstored_minios.c	Thu Feb 09 18:33:34 2012 +0000
+++ b/tools/xenstore/xenstored_minios.c	Thu Feb 09 18:33:35 2012 +0000
@@ -46,15 +46,17 @@
 
 evtchn_port_t xenbus_evtchn(void)
 {
-	return -1;
+	return dom0_event;
 }
 
 void *xenbus_map(void)
 {
-	return NULL;
+	return xc_gnttab_map_grant_ref(*xcg_handle, 0,
+			GNTTAB_RESERVED_XENSTORE, PROT_READ|PROT_WRITE);
 }
 
 void unmap_xenbus(void *interface)
 {
+	xc_gnttab_munmap(*xcg_handle, interface, 1);
 }
 

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eJ-0003dw-Pc; Sat, 11 Feb 2012 04:33:23 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eH-0003aD-OL
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:21 +0000
Received: from [85.158.143.35:51457] by server-2.bemta-4.messagelabs.com id
	2B/5D-02822-09FE53F4; Sat, 11 Feb 2012 04:33:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1328934798!2386548!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22360 invoked from network); 11 Feb 2012 04:33:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eE-0006R9-84
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eE-0001DO-6i
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:18 +0000
Message-Id: <E1Rw4eE-0001DO-6i@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstored: add --internal-db flag
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812414 0
# Node ID 2094ba2c2f322ae6280e57cafef19557d46a314a
# Parent  b06f156d5d7209ea8e53cd5caf4c4e5b93768150
xenstored: add --internal-db flag

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r b06f156d5d72 -r 2094ba2c2f32 tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:33 2012 +0000
+++ b/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:34 2012 +0000
@@ -63,7 +63,7 @@
 static bool remove_local = true;
 static int reopen_log_pipe[2];
 static char *tracefile = NULL;
-static TDB_CONTEXT *tdb_ctx;
+static TDB_CONTEXT *tdb_ctx = NULL;
 
 static void corrupt(struct connection *conn, const char *fmt, ...);
 static void check_store(void);
@@ -92,8 +92,9 @@
 
 bool replace_tdb(const char *newname, TDB_CONTEXT *newtdb)
 {
-	if (rename(newname, xs_daemon_tdb()) != 0)
-		return false;
+	if (!(tdb_ctx->flags & TDB_INTERNAL))
+		if (rename(newname, xs_daemon_tdb()) != 0)
+			return false;
 	tdb_close(tdb_ctx);
 	tdb_ctx = talloc_steal(talloc_autofree_context(), newtdb);
 	return true;
@@ -1410,7 +1411,7 @@
 }
 #endif
 
-#define TDB_FLAGS 0
+static int tdb_flags;
 
 /* We create initial nodes manually. */
 static void manual_node(const char *name, const char *child)
@@ -1435,7 +1436,9 @@
 {
 	char *tdbname;
 	tdbname = talloc_strdup(talloc_autofree_context(), xs_daemon_tdb());
-	tdb_ctx = tdb_open(tdbname, 0, TDB_FLAGS, O_RDWR, 0);
+
+	if (!(tdb_flags & TDB_INTERNAL))
+		tdb_ctx = tdb_open(tdbname, 0, tdb_flags, O_RDWR, 0);
 
 	if (tdb_ctx) {
 		/* XXX When we make xenstored able to restart, this will have
@@ -1466,7 +1469,7 @@
 		talloc_free(tlocal);
 	}
 	else {
-		tdb_ctx = tdb_open(tdbname, 7919, TDB_FLAGS, O_RDWR|O_CREAT,
+		tdb_ctx = tdb_open(tdbname, 7919, tdb_flags, O_RDWR|O_CREAT,
 				   0640);
 		if (!tdb_ctx)
 			barf_perror("Could not create tdb file %s", tdbname);
@@ -1783,6 +1786,7 @@
 "  --transaction <nb>  limit the number of transaction allowed per domain,\n"
 "  --no-recovery       to request that no recovery should be attempted when\n"
 "                      the store is corrupted (debug only),\n"
+"  --internal-db       store database in memory, not on disk\n"
 "  --preserve-local    to request that /local is preserved on start-up,\n"
 "  --verbose           to request verbose execution.\n");
 }
@@ -1800,6 +1804,7 @@
 	{ "transaction", 1, NULL, 't' },
 	{ "no-recovery", 0, NULL, 'R' },
 	{ "preserve-local", 0, NULL, 'L' },
+	{ "internal-db", 0, NULL, 'I' },
 	{ "verbose", 0, NULL, 'V' },
 	{ "watch-nb", 1, NULL, 'W' },
 	{ NULL, 0, NULL, 0 } };
@@ -1853,6 +1858,9 @@
 		case 'T':
 			tracefile = optarg;
 			break;
+		case 'I':
+			tdb_flags = TDB_INTERNAL|TDB_NOLOCK;
+			break;
 		case 'V':
 			verbose = true;
 			break;

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eJ-0003di-KO; Sat, 11 Feb 2012 04:33:23 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eH-0003Ys-Iq
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1328934746!53806610!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7808 invoked from network); 11 Feb 2012 04:32:27 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:27 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eC-0006Qx-3H
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eC-0001Bo-1t
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:16 +0000
Message-Id: <E1Rw4eC-0001Bo-1t@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstored: use grant references
	instead of map_foreign_range
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Alex Zeffertt <alex.zeffertt@eu.citrix.com>
# Date 1328812412 0
# Node ID aae516b78fce679f9c367231b7a3891814fcfdbb
# Parent  585caf50a9260d3fc6a4ece0450d10d34e73489f
xenstored: use grant references instead of map_foreign_range

make xenstored use grantref rather than map_foreign_range (which can
only be used by privileged domains)

This patch modifies the xenstore daemon to use xc_gnttab_map_grant_ref
instead of xc_map_foreign_range where available.

Previous versions of this patch have been sent to xen-devel. See
http://lists.xensource.com/archives/html/xen-devel/2008-07/msg00610.html
http://lists.xensource.com/archives/html/xen-devel/2009-03/msg01492.html

Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com>
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r 585caf50a926 -r aae516b78fce tools/xenstore/xenstored_domain.c
--- a/tools/xenstore/xenstored_domain.c	Thu Feb 09 18:33:32 2012 +0000
+++ b/tools/xenstore/xenstored_domain.c	Thu Feb 09 18:33:32 2012 +0000
@@ -32,8 +32,10 @@
 #include "xenstored_watch.h"
 
 #include <xenctrl.h>
+#include <xen/grant_table.h>
 
 static xc_interface **xc_handle;
+static xc_gnttab **xcg_handle;
 static evtchn_port_t virq_port;
 
 xc_evtchn *xce_handle = NULL;
@@ -163,6 +165,26 @@
 	return len;
 }
 
+static void *map_interface(domid_t domid, unsigned long mfn)
+{
+	if (*xcg_handle >= 0) {
+		/* this is the preferred method */
+		return xc_gnttab_map_grant_ref(*xcg_handle, domid,
+			GNTTAB_RESERVED_XENSTORE, PROT_READ|PROT_WRITE);
+	} else {
+		return xc_map_foreign_range(*xc_handle, domid,
+			getpagesize(), PROT_READ|PROT_WRITE, mfn);
+	}
+}
+
+static void unmap_interface(void *interface)
+{
+	if (*xcg_handle >= 0)
+		xc_gnttab_munmap(*xcg_handle, interface, 1);
+	else
+		munmap(interface, getpagesize());
+}
+
 static int destroy_domain(void *_domain)
 {
 	struct domain *domain = _domain;
@@ -174,8 +196,14 @@
 			eprintf("> Unbinding port %i failed!\n", domain->port);
 	}
 
-	if (domain->interface)
-		munmap(domain->interface, getpagesize());
+	if (domain->interface) {
+		/* Domain 0 was mapped by dom0_init, so it must be unmapped
+		   using munmap() and not the grant unmap call. */
+		if (domain->domid == 0)
+			munmap(domain->interface, getpagesize());
+		else
+			unmap_interface(domain->interface);
+	}
 
 	fire_watches(NULL, "@releaseDomain", false);
 
@@ -344,9 +372,7 @@
 	domain = find_domain_by_domid(domid);
 
 	if (domain == NULL) {
-		interface = xc_map_foreign_range(
-			*xc_handle, domid,
-			getpagesize(), PROT_READ|PROT_WRITE, mfn);
+		interface = map_interface(domid, mfn);
 		if (!interface) {
 			send_error(conn, errno);
 			return;
@@ -354,7 +380,7 @@
 		/* Hang domain off "in" until we're finished. */
 		domain = new_domain(in, domid, port);
 		if (!domain) {
-			munmap(interface, getpagesize());
+			unmap_interface(interface);
 			send_error(conn, errno);
 			return;
 		}
@@ -552,6 +578,12 @@
 	return 0;
 }
 
+static int close_xcg_handle(void *_handle)
+{
+	xc_gnttab_close(*(xc_gnttab **)_handle);
+	return 0;
+}
+
 /* Returns the implicit path of a connection (only domains have this) */
 const char *get_implicit_path(const struct connection *conn)
 {
@@ -603,6 +635,16 @@
 
 	talloc_set_destructor(xc_handle, close_xc_handle);
 
+	xcg_handle = talloc(talloc_autofree_context(), xc_gnttab*);
+	if (!xcg_handle)
+		barf_perror("Failed to allocate domain gnttab handle");
+
+	*xcg_handle = xc_gnttab_open(NULL, 0);
+	if (*xcg_handle < 0)
+		xprintf("WARNING: Failed to open connection to gnttab\n");
+	else
+		talloc_set_destructor(xcg_handle, close_xcg_handle);
+
 	xce_handle = xc_evtchn_open(NULL, 0);
 
 	if (xce_handle == NULL)

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eJ-0003dw-Pc; Sat, 11 Feb 2012 04:33:23 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eH-0003aD-OL
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:21 +0000
Received: from [85.158.143.35:51457] by server-2.bemta-4.messagelabs.com id
	2B/5D-02822-09FE53F4; Sat, 11 Feb 2012 04:33:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1328934798!2386548!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22360 invoked from network); 11 Feb 2012 04:33:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eE-0006R9-84
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eE-0001DO-6i
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:18 +0000
Message-Id: <E1Rw4eE-0001DO-6i@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstored: add --internal-db flag
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812414 0
# Node ID 2094ba2c2f322ae6280e57cafef19557d46a314a
# Parent  b06f156d5d7209ea8e53cd5caf4c4e5b93768150
xenstored: add --internal-db flag

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r b06f156d5d72 -r 2094ba2c2f32 tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:33 2012 +0000
+++ b/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:34 2012 +0000
@@ -63,7 +63,7 @@
 static bool remove_local = true;
 static int reopen_log_pipe[2];
 static char *tracefile = NULL;
-static TDB_CONTEXT *tdb_ctx;
+static TDB_CONTEXT *tdb_ctx = NULL;
 
 static void corrupt(struct connection *conn, const char *fmt, ...);
 static void check_store(void);
@@ -92,8 +92,9 @@
 
 bool replace_tdb(const char *newname, TDB_CONTEXT *newtdb)
 {
-	if (rename(newname, xs_daemon_tdb()) != 0)
-		return false;
+	if (!(tdb_ctx->flags & TDB_INTERNAL))
+		if (rename(newname, xs_daemon_tdb()) != 0)
+			return false;
 	tdb_close(tdb_ctx);
 	tdb_ctx = talloc_steal(talloc_autofree_context(), newtdb);
 	return true;
@@ -1410,7 +1411,7 @@
 }
 #endif
 
-#define TDB_FLAGS 0
+static int tdb_flags;
 
 /* We create initial nodes manually. */
 static void manual_node(const char *name, const char *child)
@@ -1435,7 +1436,9 @@
 {
 	char *tdbname;
 	tdbname = talloc_strdup(talloc_autofree_context(), xs_daemon_tdb());
-	tdb_ctx = tdb_open(tdbname, 0, TDB_FLAGS, O_RDWR, 0);
+
+	if (!(tdb_flags & TDB_INTERNAL))
+		tdb_ctx = tdb_open(tdbname, 0, tdb_flags, O_RDWR, 0);
 
 	if (tdb_ctx) {
 		/* XXX When we make xenstored able to restart, this will have
@@ -1466,7 +1469,7 @@
 		talloc_free(tlocal);
 	}
 	else {
-		tdb_ctx = tdb_open(tdbname, 7919, TDB_FLAGS, O_RDWR|O_CREAT,
+		tdb_ctx = tdb_open(tdbname, 7919, tdb_flags, O_RDWR|O_CREAT,
 				   0640);
 		if (!tdb_ctx)
 			barf_perror("Could not create tdb file %s", tdbname);
@@ -1783,6 +1786,7 @@
 "  --transaction <nb>  limit the number of transaction allowed per domain,\n"
 "  --no-recovery       to request that no recovery should be attempted when\n"
 "                      the store is corrupted (debug only),\n"
+"  --internal-db       store database in memory, not on disk\n"
 "  --preserve-local    to request that /local is preserved on start-up,\n"
 "  --verbose           to request verbose execution.\n");
 }
@@ -1800,6 +1804,7 @@
 	{ "transaction", 1, NULL, 't' },
 	{ "no-recovery", 0, NULL, 'R' },
 	{ "preserve-local", 0, NULL, 'L' },
+	{ "internal-db", 0, NULL, 'I' },
 	{ "verbose", 0, NULL, 'V' },
 	{ "watch-nb", 1, NULL, 'W' },
 	{ NULL, 0, NULL, 0 } };
@@ -1853,6 +1858,9 @@
 		case 'T':
 			tracefile = optarg;
 			break;
+		case 'I':
+			tdb_flags = TDB_INTERNAL|TDB_NOLOCK;
+			break;
 		case 'V':
 			verbose = true;
 			break;

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eJ-0003di-KO; Sat, 11 Feb 2012 04:33:23 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eH-0003Ys-Iq
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1328934746!53806610!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7808 invoked from network); 11 Feb 2012 04:32:27 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:27 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eC-0006Qx-3H
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eC-0001Bo-1t
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:16 +0000
Message-Id: <E1Rw4eC-0001Bo-1t@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstored: use grant references
	instead of map_foreign_range
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Alex Zeffertt <alex.zeffertt@eu.citrix.com>
# Date 1328812412 0
# Node ID aae516b78fce679f9c367231b7a3891814fcfdbb
# Parent  585caf50a9260d3fc6a4ece0450d10d34e73489f
xenstored: use grant references instead of map_foreign_range

make xenstored use grantref rather than map_foreign_range (which can
only be used by privileged domains)

This patch modifies the xenstore daemon to use xc_gnttab_map_grant_ref
instead of xc_map_foreign_range where available.

Previous versions of this patch have been sent to xen-devel. See
http://lists.xensource.com/archives/html/xen-devel/2008-07/msg00610.html
http://lists.xensource.com/archives/html/xen-devel/2009-03/msg01492.html

Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com>
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r 585caf50a926 -r aae516b78fce tools/xenstore/xenstored_domain.c
--- a/tools/xenstore/xenstored_domain.c	Thu Feb 09 18:33:32 2012 +0000
+++ b/tools/xenstore/xenstored_domain.c	Thu Feb 09 18:33:32 2012 +0000
@@ -32,8 +32,10 @@
 #include "xenstored_watch.h"
 
 #include <xenctrl.h>
+#include <xen/grant_table.h>
 
 static xc_interface **xc_handle;
+static xc_gnttab **xcg_handle;
 static evtchn_port_t virq_port;
 
 xc_evtchn *xce_handle = NULL;
@@ -163,6 +165,26 @@
 	return len;
 }
 
+static void *map_interface(domid_t domid, unsigned long mfn)
+{
+	if (*xcg_handle >= 0) {
+		/* this is the preferred method */
+		return xc_gnttab_map_grant_ref(*xcg_handle, domid,
+			GNTTAB_RESERVED_XENSTORE, PROT_READ|PROT_WRITE);
+	} else {
+		return xc_map_foreign_range(*xc_handle, domid,
+			getpagesize(), PROT_READ|PROT_WRITE, mfn);
+	}
+}
+
+static void unmap_interface(void *interface)
+{
+	if (*xcg_handle >= 0)
+		xc_gnttab_munmap(*xcg_handle, interface, 1);
+	else
+		munmap(interface, getpagesize());
+}
+
 static int destroy_domain(void *_domain)
 {
 	struct domain *domain = _domain;
@@ -174,8 +196,14 @@
 			eprintf("> Unbinding port %i failed!\n", domain->port);
 	}
 
-	if (domain->interface)
-		munmap(domain->interface, getpagesize());
+	if (domain->interface) {
+		/* Domain 0 was mapped by dom0_init, so it must be unmapped
+		   using munmap() and not the grant unmap call. */
+		if (domain->domid == 0)
+			munmap(domain->interface, getpagesize());
+		else
+			unmap_interface(domain->interface);
+	}
 
 	fire_watches(NULL, "@releaseDomain", false);
 
@@ -344,9 +372,7 @@
 	domain = find_domain_by_domid(domid);
 
 	if (domain == NULL) {
-		interface = xc_map_foreign_range(
-			*xc_handle, domid,
-			getpagesize(), PROT_READ|PROT_WRITE, mfn);
+		interface = map_interface(domid, mfn);
 		if (!interface) {
 			send_error(conn, errno);
 			return;
@@ -354,7 +380,7 @@
 		/* Hang domain off "in" until we're finished. */
 		domain = new_domain(in, domid, port);
 		if (!domain) {
-			munmap(interface, getpagesize());
+			unmap_interface(interface);
 			send_error(conn, errno);
 			return;
 		}
@@ -552,6 +578,12 @@
 	return 0;
 }
 
+static int close_xcg_handle(void *_handle)
+{
+	xc_gnttab_close(*(xc_gnttab **)_handle);
+	return 0;
+}
+
 /* Returns the implicit path of a connection (only domains have this) */
 const char *get_implicit_path(const struct connection *conn)
 {
@@ -603,6 +635,16 @@
 
 	talloc_set_destructor(xc_handle, close_xc_handle);
 
+	xcg_handle = talloc(talloc_autofree_context(), xc_gnttab*);
+	if (!xcg_handle)
+		barf_perror("Failed to allocate domain gnttab handle");
+
+	*xcg_handle = xc_gnttab_open(NULL, 0);
+	if (*xcg_handle < 0)
+		xprintf("WARNING: Failed to open connection to gnttab\n");
+	else
+		talloc_set_destructor(xcg_handle, close_xcg_handle);
+
 	xce_handle = xc_evtchn_open(NULL, 0);
 
 	if (xce_handle == NULL)

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eK-0003eR-0x; Sat, 11 Feb 2012 04:33:24 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eI-0003YU-2L
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1328934794!12894671!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11148 invoked from network); 11 Feb 2012 04:33:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e9-0006Qi-I6
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e9-00019r-De
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:13 +0000
Message-Id: <E1Rw4e9-00019r-De@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mini-os: avoid crash if no console
	is provided
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812410 0
# Node ID 37a71b91baf02bd736d1c14fda7b9d59b0eec18e
# Parent  691758c8786149c07c3050ca34823b2fdc57f568
mini-os: avoid crash if no console is provided

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r 691758c87861 -r 37a71b91baf0 extras/mini-os/console/xencons_ring.c
--- a/extras/mini-os/console/xencons_ring.c	Thu Feb 09 18:33:30 2012 +0000
+++ b/extras/mini-os/console/xencons_ring.c	Thu Feb 09 18:33:30 2012 +0000
@@ -25,7 +25,10 @@
 
 static inline struct xencons_interface *xencons_interface(void)
 {
-    return mfn_to_virt(start_info.console.domU.mfn);
+    if (start_info.console.domU.evtchn)
+        return mfn_to_virt(start_info.console.domU.mfn);
+    else
+        return NULL;
 } 
  
 int xencons_ring_send_no_notify(struct consfront_dev *dev, const char *data, unsigned len)
@@ -38,6 +41,8 @@
             intf = xencons_interface();
         else
             intf = dev->ring;
+        if (!intf)
+            return sent;
 
 	cons = intf->out_cons;
 	prod = intf->out_prod;

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eK-0003eR-0x; Sat, 11 Feb 2012 04:33:24 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eI-0003YU-2L
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1328934794!12894671!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11148 invoked from network); 11 Feb 2012 04:33:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e9-0006Qi-I6
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e9-00019r-De
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:13 +0000
Message-Id: <E1Rw4e9-00019r-De@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mini-os: avoid crash if no console
	is provided
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812410 0
# Node ID 37a71b91baf02bd736d1c14fda7b9d59b0eec18e
# Parent  691758c8786149c07c3050ca34823b2fdc57f568
mini-os: avoid crash if no console is provided

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r 691758c87861 -r 37a71b91baf0 extras/mini-os/console/xencons_ring.c
--- a/extras/mini-os/console/xencons_ring.c	Thu Feb 09 18:33:30 2012 +0000
+++ b/extras/mini-os/console/xencons_ring.c	Thu Feb 09 18:33:30 2012 +0000
@@ -25,7 +25,10 @@
 
 static inline struct xencons_interface *xencons_interface(void)
 {
-    return mfn_to_virt(start_info.console.domU.mfn);
+    if (start_info.console.domU.evtchn)
+        return mfn_to_virt(start_info.console.domU.mfn);
+    else
+        return NULL;
 } 
  
 int xencons_ring_send_no_notify(struct consfront_dev *dev, const char *data, unsigned len)
@@ -38,6 +41,8 @@
             intf = xencons_interface();
         else
             intf = dev->ring;
+        if (!intf)
+            return sent;
 
 	cons = intf->out_cons;
 	prod = intf->out_prod;

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eK-0003ej-Ac; Sat, 11 Feb 2012 04:33:24 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eI-0003YW-3r
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1328934793!11067059!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29090 invoked from network); 11 Feb 2012 04:33:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e8-0006Qf-Uc
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e8-00019T-T8
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:12 +0000
Message-Id: <E1Rw4e8-00019T-T8@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] lib{xc,
	xl}: Seed grant tables with xenstore and console grants
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Alex Zeffertt <alex.zeffertt@eu.citrix.com>
# Date 1328812410 0
# Node ID 691758c8786149c07c3050ca34823b2fdc57f568
# Parent  b0d53cb93cc6e47ea467ab7c24d42ed4090259b7
lib{xc,xl}: Seed grant tables with xenstore and console grants

This patch claims one reserved grant entry for the console and another
for the xenstore. It modifies the builder to fill in the grant table
entries for the console and the xenstore.

Previous versions of this patch have been sent to xen-devel. See
http://lists.xensource.com/archives/html/xen-devel/2008-07/msg00610.html
http://lists.xensource.com/archives/html/xen-devel/2009-03/msg01491.html

Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com>
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r b0d53cb93cc6 -r 691758c87861 tools/libxc/xc_dom.h
--- a/tools/libxc/xc_dom.h	Thu Feb 09 18:33:29 2012 +0000
+++ b/tools/libxc/xc_dom.h	Thu Feb 09 18:33:30 2012 +0000
@@ -18,6 +18,9 @@
 
 #define INVALID_P2M_ENTRY   ((xen_pfn_t)-1)
 
+/* Scrach PFN for temporary mappings in HVM */
+#define SCRATCH_PFN_GNTTAB 0xFFFFE
+
 /* --- typedefs and structs ---------------------------------------- */
 
 typedef uint64_t xen_vaddr_t;
@@ -107,6 +110,8 @@
     unsigned long flags;
     unsigned int console_evtchn;
     unsigned int xenstore_evtchn;
+    domid_t console_domid;
+    domid_t xenstore_domid;
     xen_pfn_t shared_info_mfn;
 
     xc_interface *xch;
@@ -200,6 +205,17 @@
                            xen_pfn_t count);
 int xc_dom_boot_image(struct xc_dom_image *dom);
 int xc_dom_compat_check(struct xc_dom_image *dom);
+int xc_dom_gnttab_init(struct xc_dom_image *dom);
+int xc_dom_gnttab_hvm_seed(xc_interface *xch, domid_t domid,
+                           xen_pfn_t console_gmfn,
+                           xen_pfn_t xenstore_gmfn,
+                           domid_t console_domid,
+                           domid_t xenstore_domid);
+int xc_dom_gnttab_seed(xc_interface *xch, domid_t domid,
+                       xen_pfn_t console_gmfn,
+                       xen_pfn_t xenstore_gmfn,
+                       domid_t console_domid,
+                       domid_t xenstore_domid);
 
 /* --- debugging bits ---------------------------------------------- */
 
diff -r b0d53cb93cc6 -r 691758c87861 tools/libxc/xc_dom_boot.c
--- a/tools/libxc/xc_dom_boot.c	Thu Feb 09 18:33:29 2012 +0000
+++ b/tools/libxc/xc_dom_boot.c	Thu Feb 09 18:33:30 2012 +0000
@@ -34,6 +34,7 @@
 #include "xg_private.h"
 #include "xc_dom.h"
 #include <xen/hvm/params.h>
+#include <xen/grant_table.h>
 
 /* ------------------------------------------------------------------------ */
 
@@ -275,6 +276,161 @@
     return rc;
 }
 
+static xen_pfn_t xc_dom_gnttab_setup(xc_interface *xch, domid_t domid)
+{
+    gnttab_setup_table_t setup;
+    DECLARE_HYPERCALL_BUFFER(xen_pfn_t, gmfnp);
+    int rc;
+    xen_pfn_t gmfn;
+
+    gmfnp = xc_hypercall_buffer_alloc(xch, gmfnp, sizeof(*gmfnp));
+    if (gmfnp == NULL)
+        return -1;
+
+    setup.dom = domid;
+    setup.nr_frames = 1;
+    set_xen_guest_handle(setup.frame_list, gmfnp);
+    setup.status = 0;
+
+    rc = xc_gnttab_op(xch, GNTTABOP_setup_table, &setup, sizeof(setup), 1);
+    gmfn = *gmfnp;
+    xc_hypercall_buffer_free(xch, gmfnp);
+
+    if ( rc != 0 || setup.status != GNTST_okay )
+    {
+        xc_dom_panic(xch, XC_INTERNAL_ERROR,
+                     "%s: failed to setup domU grant table "
+                     "[errno=%d, status=%" PRId16 "]\n",
+                     __FUNCTION__, rc != 0 ? errno : 0, setup.status);
+        return -1;
+    }
+
+    return gmfn;
+}
+
+int xc_dom_gnttab_seed(xc_interface *xch, domid_t domid,
+                       xen_pfn_t console_gmfn,
+                       xen_pfn_t xenstore_gmfn,
+                       domid_t console_domid,
+                       domid_t xenstore_domid)
+{
+
+    xen_pfn_t gnttab_gmfn;
+    grant_entry_v1_t *gnttab;
+
+    gnttab_gmfn = xc_dom_gnttab_setup(xch, domid);
+    if ( gnttab_gmfn == -1 )
+        return -1;
+
+    gnttab = xc_map_foreign_range(xch,
+                                  domid,
+                                  PAGE_SIZE,
+                                  PROT_READ|PROT_WRITE,
+                                  gnttab_gmfn);
+    if ( gnttab == NULL )
+    {
+        xc_dom_panic(xch, XC_INTERNAL_ERROR,
+                     "%s: failed to map domU grant table "
+                     "[errno=%d]\n",
+                     __FUNCTION__, errno);
+        return -1;
+    }
+
+    if ( domid != console_domid  && console_gmfn != -1)
+    {
+        gnttab[GNTTAB_RESERVED_CONSOLE].flags = GTF_permit_access;
+        gnttab[GNTTAB_RESERVED_CONSOLE].domid = console_domid;
+        gnttab[GNTTAB_RESERVED_CONSOLE].frame = console_gmfn;
+    }
+    if ( domid != xenstore_domid && xenstore_gmfn != -1)
+    {
+        gnttab[GNTTAB_RESERVED_XENSTORE].flags = GTF_permit_access;
+        gnttab[GNTTAB_RESERVED_XENSTORE].domid = xenstore_domid;
+        gnttab[GNTTAB_RESERVED_XENSTORE].frame = xenstore_gmfn;
+    }
+
+    if ( munmap(gnttab, PAGE_SIZE) == -1 )
+    {
+        xc_dom_panic(xch, XC_INTERNAL_ERROR,
+                     "%s: failed to unmap domU grant table "
+                     "[errno=%d]\n",
+                     __FUNCTION__, errno);
+        return -1;
+    }
+
+    return 0;
+}
+
+int xc_dom_gnttab_hvm_seed(xc_interface *xch, domid_t domid,
+                           xen_pfn_t console_gpfn,
+                           xen_pfn_t xenstore_gpfn,
+                           domid_t console_domid,
+                           domid_t xenstore_domid)
+{
+    int rc;
+    struct xen_add_to_physmap xatp = {
+        .domid = domid,
+        .space = XENMAPSPACE_grant_table,
+        .idx   = 0,
+        .gpfn  = SCRATCH_PFN_GNTTAB
+    };
+    struct xen_remove_from_physmap xrfp = {
+        .domid = domid,
+        .gpfn  = SCRATCH_PFN_GNTTAB
+    };
+
+    rc = do_memory_op(xch, XENMEM_add_to_physmap, &xatp, sizeof(xatp));
+    if ( rc != 0 )
+    {
+        xc_dom_panic(xch, XC_INTERNAL_ERROR,
+                     "%s: failed to add gnttab to physmap "
+                     "[errno=%d]\n",
+                     __FUNCTION__, errno);
+        return -1;
+    }
+
+    rc = xc_dom_gnttab_seed(xch, domid,
+                            console_gpfn, xenstore_gpfn,
+                            console_domid, xenstore_domid);
+    if (rc != 0)
+    {
+        xc_dom_panic(xch, XC_INTERNAL_ERROR,
+                     "%s: failed to seed gnttab entries\n",
+                     __FUNCTION__);
+        (void) do_memory_op(xch, XENMEM_remove_from_physmap, &xrfp, sizeof(xrfp));
+        return -1;
+    }
+
+    rc = do_memory_op(xch, XENMEM_remove_from_physmap, &xrfp, sizeof(xrfp));
+    if (rc != 0)
+    {
+        xc_dom_panic(xch, XC_INTERNAL_ERROR,
+                     "%s: failed to remove gnttab from physmap "
+                     "[errno=%d]\n",
+                     __FUNCTION__, errno);
+        return -1;
+    }
+
+    return 0;
+}
+
+int xc_dom_gnttab_init(struct xc_dom_image *dom)
+{
+    xen_pfn_t console_gmfn;
+    xen_pfn_t xenstore_gmfn;
+    int autotranslated;
+
+    autotranslated = xc_dom_feature_translated(dom);
+    console_gmfn = autotranslated ?
+           dom->console_pfn : xc_dom_p2m_host(dom, dom->console_pfn);
+    xenstore_gmfn = autotranslated ?
+           dom->xenstore_pfn : xc_dom_p2m_host(dom, dom->xenstore_pfn);
+
+    return xc_dom_gnttab_seed(dom->xch, dom->guest_domid,
+                              console_gmfn, xenstore_gmfn,
+                              dom->console_domid, dom->xenstore_domid);
+}
+
 /*
  * Local variables:
  * mode: C
diff -r b0d53cb93cc6 -r 691758c87861 tools/libxc/xc_dom_compat_linux.c
--- a/tools/libxc/xc_dom_compat_linux.c	Thu Feb 09 18:33:29 2012 +0000
+++ b/tools/libxc/xc_dom_compat_linux.c	Thu Feb 09 18:33:30 2012 +0000
@@ -62,6 +62,8 @@
         goto out;
     if ( (rc = xc_dom_boot_image(dom)) != 0 )
         goto out;
+    if ( (rc = xc_dom_gnttab_init(dom)) != 0)
+        goto out;
 
     *console_mfn = xc_dom_p2m_host(dom, dom->console_pfn);
     *store_mfn = xc_dom_p2m_host(dom, dom->xenstore_pfn);
diff -r b0d53cb93cc6 -r 691758c87861 tools/libxc/xc_domain_restore.c
--- a/tools/libxc/xc_domain_restore.c	Thu Feb 09 18:33:29 2012 +0000
+++ b/tools/libxc/xc_domain_restore.c	Thu Feb 09 18:33:30 2012 +0000
@@ -1259,7 +1259,8 @@
 
 int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
                       unsigned int store_evtchn, unsigned long *store_mfn,
-                      unsigned int console_evtchn, unsigned long *console_mfn,
+                      domid_t store_domid, unsigned int console_evtchn,
+                      unsigned long *console_mfn, domid_t console_domid,
                       unsigned int hvm, unsigned int pae, int superpages,
                       int no_incr_generationid,
                       unsigned long *vm_generationid_addr)
@@ -2018,6 +2019,14 @@
         memcpy(ctx->live_p2m, ctx->p2m, dinfo->p2m_size * sizeof(xen_pfn_t));
     munmap(ctx->live_p2m, P2M_FL_ENTRIES * PAGE_SIZE);
 
+    rc = xc_dom_gnttab_seed(xch, dom, *console_mfn, *store_mfn,
+                            console_domid, store_domid);
+    if (rc != 0)
+    {
+        ERROR("error seeding grant table");
+        goto out;
+    }
+
     DPRINTF("Domain ready to be built.\n");
     rc = 0;
     goto out;
@@ -2076,6 +2085,14 @@
         goto out;
     }
 
+    rc = xc_dom_gnttab_hvm_seed(xch, dom, *console_mfn, *store_mfn,
+                                console_domid, store_domid);
+    if (rc != 0)
+    {
+        ERROR("error seeding grant table");
+        goto out;
+    }
+
     /* HVM success! */
     rc = 0;
 
diff -r b0d53cb93cc6 -r 691758c87861 tools/libxc/xenguest.h
--- a/tools/libxc/xenguest.h	Thu Feb 09 18:33:29 2012 +0000
+++ b/tools/libxc/xenguest.h	Thu Feb 09 18:33:30 2012 +0000
@@ -79,7 +79,8 @@
  */
 int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
                       unsigned int store_evtchn, unsigned long *store_mfn,
-                      unsigned int console_evtchn, unsigned long *console_mfn,
+                      domid_t store_domid, unsigned int console_evtchn,
+                      unsigned long *console_mfn, domid_t console_domid,
                       unsigned int hvm, unsigned int pae, int superpages,
                       int no_incr_generationid,
 		      unsigned long *vm_generationid_addr);
diff -r b0d53cb93cc6 -r 691758c87861 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c	Thu Feb 09 18:33:29 2012 +0000
+++ b/tools/libxl/libxl_dom.c	Thu Feb 09 18:33:30 2012 +0000
@@ -225,7 +225,9 @@
 
     dom->flags = flags;
     dom->console_evtchn = state->console_port;
+    dom->console_domid = state->console_domid;
     dom->xenstore_evtchn = state->store_port;
+    dom->xenstore_domid = state->store_domid;
 
     if ( (ret = xc_dom_boot_xen_init(dom, ctx->xch, domid)) != 0 ) {
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_boot_xen_init failed");
@@ -251,6 +253,10 @@
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_boot_image failed");
         goto out;
     }
+    if ( (ret = xc_dom_gnttab_init(dom)) != 0 ) {
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_gnttab_init failed");
+        goto out;
+    }
 
     state->console_mfn = xc_dom_p2m_host(dom, dom->console_pfn);
     state->store_mfn = xc_dom_p2m_host(dom, dom->xenstore_pfn);
@@ -271,7 +277,8 @@
 static int hvm_build_set_params(xc_interface *handle, uint32_t domid,
                                 libxl_domain_build_info *info,
                                 int store_evtchn, unsigned long *store_mfn,
-                                int console_evtchn, unsigned long *console_mfn)
+                                int console_evtchn, unsigned long *console_mfn,
+                                domid_t store_domid, domid_t console_domid)
 {
     struct hvm_info_table *va_hvm;
     uint8_t *va_map, sum;
@@ -304,6 +311,8 @@
     xc_set_hvm_param(handle, domid, HVM_PARAM_NESTEDHVM, info->u.hvm.nested_hvm);
     xc_set_hvm_param(handle, domid, HVM_PARAM_STORE_EVTCHN, store_evtchn);
     xc_set_hvm_param(handle, domid, HVM_PARAM_CONSOLE_EVTCHN, console_evtchn);
+
+    xc_dom_gnttab_hvm_seed(handle, domid, *console_mfn, *store_mfn, console_domid, store_domid);
     return 0;
 }
 
@@ -355,7 +364,9 @@
         goto out;
     }
     ret = hvm_build_set_params(ctx->xch, domid, info, state->store_port,
-                               &state->store_mfn, state->console_port, &state->console_mfn);
+                               &state->store_mfn, state->console_port,
+                               &state->console_mfn, state->store_domid,
+                               state->console_domid);
     if (ret) {
         LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, ret, "hvm build set params failed");
         goto out;
@@ -402,7 +413,8 @@
     }
     rc = xc_domain_restore(ctx->xch, fd, domid,
                            state->store_port, &state->store_mfn,
-                           state->console_port, &state->console_mfn,
+                           state->store_domid, state->console_port,
+                           &state->console_mfn, state->console_domid,
                            hvm, pae, superpages, no_incr_generationid,
                            &state->vm_generationid_addr);
     if ( rc ) {
diff -r b0d53cb93cc6 -r 691758c87861 tools/xcutils/xc_restore.c
--- a/tools/xcutils/xc_restore.c	Thu Feb 09 18:33:29 2012 +0000
+++ b/tools/xcutils/xc_restore.c	Thu Feb 09 18:33:30 2012 +0000
@@ -45,8 +45,8 @@
     else
 	    superpages = !!hvm;
 
-    ret = xc_domain_restore(xch, io_fd, domid, store_evtchn, &store_mfn,
-                            console_evtchn, &console_mfn, hvm, pae, superpages,
+    ret = xc_domain_restore(xch, io_fd, domid, store_evtchn, &store_mfn, 0,
+                            console_evtchn, &console_mfn, 0, hvm, pae, superpages,
                             0, NULL);
 
     if ( ret == 0 )

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eK-0003f1-I9; Sat, 11 Feb 2012 04:33:24 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eI-0003cC-Rw
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-27.messagelabs.com!1328934770!59399015!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9742 invoked from network); 11 Feb 2012 04:32:51 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:51 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eG-0006RL-CJ
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eG-0001F5-Aw
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:20 +0000
Message-Id: <E1Rw4eG-0001F5-Aw@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstored: use
	domain_is_unprivileged instead of checking conn->id
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812415 0
# Node ID 98f45814fbacaa844a204693529d806d4f9c7c05
# Parent  095c3cbf7f6e894531c183600fee9ea06217d947
xenstored: use domain_is_unprivileged instead of checking conn->id

This centralizes all the permission checking for privileged domains in
preparation for allowing domains other than dom0 to be privileged.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r 095c3cbf7f6e -r 98f45814fbac tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:35 2012 +0000
+++ b/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:35 2012 +0000
@@ -462,7 +462,7 @@
 		mask &= ~XS_PERM_WRITE;
 
 	/* Owners and tools get it all... */
-	if (!conn->id || perms[0].id == conn->id
+	if (!domain_is_unprivileged(conn) || perms[0].id == conn->id
                 || (conn->target && perms[0].id == conn->target->id))
 		return (XS_PERM_READ|XS_PERM_WRITE|XS_PERM_OWNER) & mask;
 
@@ -800,11 +800,11 @@
 	node->tdb = tdb_context(conn);
 	node->name = talloc_strdup(node, name);
 
-	/* Inherit permissions, except domains own what they create */
+	/* Inherit permissions, except unprivileged domains own what they create */
 	node->num_perms = parent->num_perms;
 	node->perms = talloc_memdup(node, parent->perms,
 				    node->num_perms * sizeof(node->perms[0]));
-	if (conn && conn->id)
+	if (domain_is_unprivileged(conn))
 		node->perms[0].id = conn->id;
 
 	/* No children, no data */
diff -r 095c3cbf7f6e -r 98f45814fbac tools/xenstore/xenstored_domain.c
--- a/tools/xenstore/xenstored_domain.c	Thu Feb 09 18:33:35 2012 +0000
+++ b/tools/xenstore/xenstored_domain.c	Thu Feb 09 18:33:35 2012 +0000
@@ -354,7 +354,7 @@
 		return;
 	}
 
-	if (conn->id != 0 || !conn->can_write) {
+	if (domain_is_unprivileged(conn) || !conn->can_write) {
 		send_error(conn, EACCES);
 		return;
 	}
@@ -418,7 +418,7 @@
 		return;
 	}
 
-	if (conn->id != 0 || !conn->can_write) {
+	if (domain_is_unprivileged(conn) || !conn->can_write) {
 		send_error(conn, EACCES);
 		return;
 	}
@@ -470,7 +470,7 @@
 		return;
 	}
 
-	if (conn->id != 0) {
+	if (domain_is_unprivileged(conn)) {
 		send_error(conn, EACCES);
 		return;
 	}
@@ -507,7 +507,7 @@
 		return;
 	}
 
-	if (conn->id != 0) {
+	if (domain_is_unprivileged(conn)) {
 		send_error(conn, EACCES);
 		return;
 	}

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eK-0003ej-Ac; Sat, 11 Feb 2012 04:33:24 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eI-0003YW-3r
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1328934793!11067059!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29090 invoked from network); 11 Feb 2012 04:33:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e8-0006Qf-Uc
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e8-00019T-T8
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:12 +0000
Message-Id: <E1Rw4e8-00019T-T8@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] lib{xc,
	xl}: Seed grant tables with xenstore and console grants
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Alex Zeffertt <alex.zeffertt@eu.citrix.com>
# Date 1328812410 0
# Node ID 691758c8786149c07c3050ca34823b2fdc57f568
# Parent  b0d53cb93cc6e47ea467ab7c24d42ed4090259b7
lib{xc,xl}: Seed grant tables with xenstore and console grants

This patch claims one reserved grant entry for the console and another
for the xenstore. It modifies the builder to fill in the grant table
entries for the console and the xenstore.

Previous versions of this patch have been sent to xen-devel. See
http://lists.xensource.com/archives/html/xen-devel/2008-07/msg00610.html
http://lists.xensource.com/archives/html/xen-devel/2009-03/msg01491.html

Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com>
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r b0d53cb93cc6 -r 691758c87861 tools/libxc/xc_dom.h
--- a/tools/libxc/xc_dom.h	Thu Feb 09 18:33:29 2012 +0000
+++ b/tools/libxc/xc_dom.h	Thu Feb 09 18:33:30 2012 +0000
@@ -18,6 +18,9 @@
 
 #define INVALID_P2M_ENTRY   ((xen_pfn_t)-1)
 
+/* Scrach PFN for temporary mappings in HVM */
+#define SCRATCH_PFN_GNTTAB 0xFFFFE
+
 /* --- typedefs and structs ---------------------------------------- */
 
 typedef uint64_t xen_vaddr_t;
@@ -107,6 +110,8 @@
     unsigned long flags;
     unsigned int console_evtchn;
     unsigned int xenstore_evtchn;
+    domid_t console_domid;
+    domid_t xenstore_domid;
     xen_pfn_t shared_info_mfn;
 
     xc_interface *xch;
@@ -200,6 +205,17 @@
                            xen_pfn_t count);
 int xc_dom_boot_image(struct xc_dom_image *dom);
 int xc_dom_compat_check(struct xc_dom_image *dom);
+int xc_dom_gnttab_init(struct xc_dom_image *dom);
+int xc_dom_gnttab_hvm_seed(xc_interface *xch, domid_t domid,
+                           xen_pfn_t console_gmfn,
+                           xen_pfn_t xenstore_gmfn,
+                           domid_t console_domid,
+                           domid_t xenstore_domid);
+int xc_dom_gnttab_seed(xc_interface *xch, domid_t domid,
+                       xen_pfn_t console_gmfn,
+                       xen_pfn_t xenstore_gmfn,
+                       domid_t console_domid,
+                       domid_t xenstore_domid);
 
 /* --- debugging bits ---------------------------------------------- */
 
diff -r b0d53cb93cc6 -r 691758c87861 tools/libxc/xc_dom_boot.c
--- a/tools/libxc/xc_dom_boot.c	Thu Feb 09 18:33:29 2012 +0000
+++ b/tools/libxc/xc_dom_boot.c	Thu Feb 09 18:33:30 2012 +0000
@@ -34,6 +34,7 @@
 #include "xg_private.h"
 #include "xc_dom.h"
 #include <xen/hvm/params.h>
+#include <xen/grant_table.h>
 
 /* ------------------------------------------------------------------------ */
 
@@ -275,6 +276,161 @@
     return rc;
 }
 
+static xen_pfn_t xc_dom_gnttab_setup(xc_interface *xch, domid_t domid)
+{
+    gnttab_setup_table_t setup;
+    DECLARE_HYPERCALL_BUFFER(xen_pfn_t, gmfnp);
+    int rc;
+    xen_pfn_t gmfn;
+
+    gmfnp = xc_hypercall_buffer_alloc(xch, gmfnp, sizeof(*gmfnp));
+    if (gmfnp == NULL)
+        return -1;
+
+    setup.dom = domid;
+    setup.nr_frames = 1;
+    set_xen_guest_handle(setup.frame_list, gmfnp);
+    setup.status = 0;
+
+    rc = xc_gnttab_op(xch, GNTTABOP_setup_table, &setup, sizeof(setup), 1);
+    gmfn = *gmfnp;
+    xc_hypercall_buffer_free(xch, gmfnp);
+
+    if ( rc != 0 || setup.status != GNTST_okay )
+    {
+        xc_dom_panic(xch, XC_INTERNAL_ERROR,
+                     "%s: failed to setup domU grant table "
+                     "[errno=%d, status=%" PRId16 "]\n",
+                     __FUNCTION__, rc != 0 ? errno : 0, setup.status);
+        return -1;
+    }
+
+    return gmfn;
+}
+
+int xc_dom_gnttab_seed(xc_interface *xch, domid_t domid,
+                       xen_pfn_t console_gmfn,
+                       xen_pfn_t xenstore_gmfn,
+                       domid_t console_domid,
+                       domid_t xenstore_domid)
+{
+
+    xen_pfn_t gnttab_gmfn;
+    grant_entry_v1_t *gnttab;
+
+    gnttab_gmfn = xc_dom_gnttab_setup(xch, domid);
+    if ( gnttab_gmfn == -1 )
+        return -1;
+
+    gnttab = xc_map_foreign_range(xch,
+                                  domid,
+                                  PAGE_SIZE,
+                                  PROT_READ|PROT_WRITE,
+                                  gnttab_gmfn);
+    if ( gnttab == NULL )
+    {
+        xc_dom_panic(xch, XC_INTERNAL_ERROR,
+                     "%s: failed to map domU grant table "
+                     "[errno=%d]\n",
+                     __FUNCTION__, errno);
+        return -1;
+    }
+
+    if ( domid != console_domid  && console_gmfn != -1)
+    {
+        gnttab[GNTTAB_RESERVED_CONSOLE].flags = GTF_permit_access;
+        gnttab[GNTTAB_RESERVED_CONSOLE].domid = console_domid;
+        gnttab[GNTTAB_RESERVED_CONSOLE].frame = console_gmfn;
+    }
+    if ( domid != xenstore_domid && xenstore_gmfn != -1)
+    {
+        gnttab[GNTTAB_RESERVED_XENSTORE].flags = GTF_permit_access;
+        gnttab[GNTTAB_RESERVED_XENSTORE].domid = xenstore_domid;
+        gnttab[GNTTAB_RESERVED_XENSTORE].frame = xenstore_gmfn;
+    }
+
+    if ( munmap(gnttab, PAGE_SIZE) == -1 )
+    {
+        xc_dom_panic(xch, XC_INTERNAL_ERROR,
+                     "%s: failed to unmap domU grant table "
+                     "[errno=%d]\n",
+                     __FUNCTION__, errno);
+        return -1;
+    }
+
+    return 0;
+}
+
+int xc_dom_gnttab_hvm_seed(xc_interface *xch, domid_t domid,
+                           xen_pfn_t console_gpfn,
+                           xen_pfn_t xenstore_gpfn,
+                           domid_t console_domid,
+                           domid_t xenstore_domid)
+{
+    int rc;
+    struct xen_add_to_physmap xatp = {
+        .domid = domid,
+        .space = XENMAPSPACE_grant_table,
+        .idx   = 0,
+        .gpfn  = SCRATCH_PFN_GNTTAB
+    };
+    struct xen_remove_from_physmap xrfp = {
+        .domid = domid,
+        .gpfn  = SCRATCH_PFN_GNTTAB
+    };
+
+    rc = do_memory_op(xch, XENMEM_add_to_physmap, &xatp, sizeof(xatp));
+    if ( rc != 0 )
+    {
+        xc_dom_panic(xch, XC_INTERNAL_ERROR,
+                     "%s: failed to add gnttab to physmap "
+                     "[errno=%d]\n",
+                     __FUNCTION__, errno);
+        return -1;
+    }
+
+    rc = xc_dom_gnttab_seed(xch, domid,
+                            console_gpfn, xenstore_gpfn,
+                            console_domid, xenstore_domid);
+    if (rc != 0)
+    {
+        xc_dom_panic(xch, XC_INTERNAL_ERROR,
+                     "%s: failed to seed gnttab entries\n",
+                     __FUNCTION__);
+        (void) do_memory_op(xch, XENMEM_remove_from_physmap, &xrfp, sizeof(xrfp));
+        return -1;
+    }
+
+    rc = do_memory_op(xch, XENMEM_remove_from_physmap, &xrfp, sizeof(xrfp));
+    if (rc != 0)
+    {
+        xc_dom_panic(xch, XC_INTERNAL_ERROR,
+                     "%s: failed to remove gnttab from physmap "
+                     "[errno=%d]\n",
+                     __FUNCTION__, errno);
+        return -1;
+    }
+
+    return 0;
+}
+
+int xc_dom_gnttab_init(struct xc_dom_image *dom)
+{
+    xen_pfn_t console_gmfn;
+    xen_pfn_t xenstore_gmfn;
+    int autotranslated;
+
+    autotranslated = xc_dom_feature_translated(dom);
+    console_gmfn = autotranslated ?
+           dom->console_pfn : xc_dom_p2m_host(dom, dom->console_pfn);
+    xenstore_gmfn = autotranslated ?
+           dom->xenstore_pfn : xc_dom_p2m_host(dom, dom->xenstore_pfn);
+
+    return xc_dom_gnttab_seed(dom->xch, dom->guest_domid,
+                              console_gmfn, xenstore_gmfn,
+                              dom->console_domid, dom->xenstore_domid);
+}
+
 /*
  * Local variables:
  * mode: C
diff -r b0d53cb93cc6 -r 691758c87861 tools/libxc/xc_dom_compat_linux.c
--- a/tools/libxc/xc_dom_compat_linux.c	Thu Feb 09 18:33:29 2012 +0000
+++ b/tools/libxc/xc_dom_compat_linux.c	Thu Feb 09 18:33:30 2012 +0000
@@ -62,6 +62,8 @@
         goto out;
     if ( (rc = xc_dom_boot_image(dom)) != 0 )
         goto out;
+    if ( (rc = xc_dom_gnttab_init(dom)) != 0)
+        goto out;
 
     *console_mfn = xc_dom_p2m_host(dom, dom->console_pfn);
     *store_mfn = xc_dom_p2m_host(dom, dom->xenstore_pfn);
diff -r b0d53cb93cc6 -r 691758c87861 tools/libxc/xc_domain_restore.c
--- a/tools/libxc/xc_domain_restore.c	Thu Feb 09 18:33:29 2012 +0000
+++ b/tools/libxc/xc_domain_restore.c	Thu Feb 09 18:33:30 2012 +0000
@@ -1259,7 +1259,8 @@
 
 int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
                       unsigned int store_evtchn, unsigned long *store_mfn,
-                      unsigned int console_evtchn, unsigned long *console_mfn,
+                      domid_t store_domid, unsigned int console_evtchn,
+                      unsigned long *console_mfn, domid_t console_domid,
                       unsigned int hvm, unsigned int pae, int superpages,
                       int no_incr_generationid,
                       unsigned long *vm_generationid_addr)
@@ -2018,6 +2019,14 @@
         memcpy(ctx->live_p2m, ctx->p2m, dinfo->p2m_size * sizeof(xen_pfn_t));
     munmap(ctx->live_p2m, P2M_FL_ENTRIES * PAGE_SIZE);
 
+    rc = xc_dom_gnttab_seed(xch, dom, *console_mfn, *store_mfn,
+                            console_domid, store_domid);
+    if (rc != 0)
+    {
+        ERROR("error seeding grant table");
+        goto out;
+    }
+
     DPRINTF("Domain ready to be built.\n");
     rc = 0;
     goto out;
@@ -2076,6 +2085,14 @@
         goto out;
     }
 
+    rc = xc_dom_gnttab_hvm_seed(xch, dom, *console_mfn, *store_mfn,
+                                console_domid, store_domid);
+    if (rc != 0)
+    {
+        ERROR("error seeding grant table");
+        goto out;
+    }
+
     /* HVM success! */
     rc = 0;
 
diff -r b0d53cb93cc6 -r 691758c87861 tools/libxc/xenguest.h
--- a/tools/libxc/xenguest.h	Thu Feb 09 18:33:29 2012 +0000
+++ b/tools/libxc/xenguest.h	Thu Feb 09 18:33:30 2012 +0000
@@ -79,7 +79,8 @@
  */
 int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
                       unsigned int store_evtchn, unsigned long *store_mfn,
-                      unsigned int console_evtchn, unsigned long *console_mfn,
+                      domid_t store_domid, unsigned int console_evtchn,
+                      unsigned long *console_mfn, domid_t console_domid,
                       unsigned int hvm, unsigned int pae, int superpages,
                       int no_incr_generationid,
 		      unsigned long *vm_generationid_addr);
diff -r b0d53cb93cc6 -r 691758c87861 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c	Thu Feb 09 18:33:29 2012 +0000
+++ b/tools/libxl/libxl_dom.c	Thu Feb 09 18:33:30 2012 +0000
@@ -225,7 +225,9 @@
 
     dom->flags = flags;
     dom->console_evtchn = state->console_port;
+    dom->console_domid = state->console_domid;
     dom->xenstore_evtchn = state->store_port;
+    dom->xenstore_domid = state->store_domid;
 
     if ( (ret = xc_dom_boot_xen_init(dom, ctx->xch, domid)) != 0 ) {
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_boot_xen_init failed");
@@ -251,6 +253,10 @@
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_boot_image failed");
         goto out;
     }
+    if ( (ret = xc_dom_gnttab_init(dom)) != 0 ) {
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_gnttab_init failed");
+        goto out;
+    }
 
     state->console_mfn = xc_dom_p2m_host(dom, dom->console_pfn);
     state->store_mfn = xc_dom_p2m_host(dom, dom->xenstore_pfn);
@@ -271,7 +277,8 @@
 static int hvm_build_set_params(xc_interface *handle, uint32_t domid,
                                 libxl_domain_build_info *info,
                                 int store_evtchn, unsigned long *store_mfn,
-                                int console_evtchn, unsigned long *console_mfn)
+                                int console_evtchn, unsigned long *console_mfn,
+                                domid_t store_domid, domid_t console_domid)
 {
     struct hvm_info_table *va_hvm;
     uint8_t *va_map, sum;
@@ -304,6 +311,8 @@
     xc_set_hvm_param(handle, domid, HVM_PARAM_NESTEDHVM, info->u.hvm.nested_hvm);
     xc_set_hvm_param(handle, domid, HVM_PARAM_STORE_EVTCHN, store_evtchn);
     xc_set_hvm_param(handle, domid, HVM_PARAM_CONSOLE_EVTCHN, console_evtchn);
+
+    xc_dom_gnttab_hvm_seed(handle, domid, *console_mfn, *store_mfn, console_domid, store_domid);
     return 0;
 }
 
@@ -355,7 +364,9 @@
         goto out;
     }
     ret = hvm_build_set_params(ctx->xch, domid, info, state->store_port,
-                               &state->store_mfn, state->console_port, &state->console_mfn);
+                               &state->store_mfn, state->console_port,
+                               &state->console_mfn, state->store_domid,
+                               state->console_domid);
     if (ret) {
         LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, ret, "hvm build set params failed");
         goto out;
@@ -402,7 +413,8 @@
     }
     rc = xc_domain_restore(ctx->xch, fd, domid,
                            state->store_port, &state->store_mfn,
-                           state->console_port, &state->console_mfn,
+                           state->store_domid, state->console_port,
+                           &state->console_mfn, state->console_domid,
                            hvm, pae, superpages, no_incr_generationid,
                            &state->vm_generationid_addr);
     if ( rc ) {
diff -r b0d53cb93cc6 -r 691758c87861 tools/xcutils/xc_restore.c
--- a/tools/xcutils/xc_restore.c	Thu Feb 09 18:33:29 2012 +0000
+++ b/tools/xcutils/xc_restore.c	Thu Feb 09 18:33:30 2012 +0000
@@ -45,8 +45,8 @@
     else
 	    superpages = !!hvm;
 
-    ret = xc_domain_restore(xch, io_fd, domid, store_evtchn, &store_mfn,
-                            console_evtchn, &console_mfn, hvm, pae, superpages,
+    ret = xc_domain_restore(xch, io_fd, domid, store_evtchn, &store_mfn, 0,
+                            console_evtchn, &console_mfn, 0, hvm, pae, superpages,
                             0, NULL);
 
     if ( ret == 0 )

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eK-0003f1-I9; Sat, 11 Feb 2012 04:33:24 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eI-0003cC-Rw
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-27.messagelabs.com!1328934770!59399015!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9742 invoked from network); 11 Feb 2012 04:32:51 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:51 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eG-0006RL-CJ
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eG-0001F5-Aw
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:20 +0000
Message-Id: <E1Rw4eG-0001F5-Aw@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstored: use
	domain_is_unprivileged instead of checking conn->id
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812415 0
# Node ID 98f45814fbacaa844a204693529d806d4f9c7c05
# Parent  095c3cbf7f6e894531c183600fee9ea06217d947
xenstored: use domain_is_unprivileged instead of checking conn->id

This centralizes all the permission checking for privileged domains in
preparation for allowing domains other than dom0 to be privileged.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r 095c3cbf7f6e -r 98f45814fbac tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:35 2012 +0000
+++ b/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:35 2012 +0000
@@ -462,7 +462,7 @@
 		mask &= ~XS_PERM_WRITE;
 
 	/* Owners and tools get it all... */
-	if (!conn->id || perms[0].id == conn->id
+	if (!domain_is_unprivileged(conn) || perms[0].id == conn->id
                 || (conn->target && perms[0].id == conn->target->id))
 		return (XS_PERM_READ|XS_PERM_WRITE|XS_PERM_OWNER) & mask;
 
@@ -800,11 +800,11 @@
 	node->tdb = tdb_context(conn);
 	node->name = talloc_strdup(node, name);
 
-	/* Inherit permissions, except domains own what they create */
+	/* Inherit permissions, except unprivileged domains own what they create */
 	node->num_perms = parent->num_perms;
 	node->perms = talloc_memdup(node, parent->perms,
 				    node->num_perms * sizeof(node->perms[0]));
-	if (conn && conn->id)
+	if (domain_is_unprivileged(conn))
 		node->perms[0].id = conn->id;
 
 	/* No children, no data */
diff -r 095c3cbf7f6e -r 98f45814fbac tools/xenstore/xenstored_domain.c
--- a/tools/xenstore/xenstored_domain.c	Thu Feb 09 18:33:35 2012 +0000
+++ b/tools/xenstore/xenstored_domain.c	Thu Feb 09 18:33:35 2012 +0000
@@ -354,7 +354,7 @@
 		return;
 	}
 
-	if (conn->id != 0 || !conn->can_write) {
+	if (domain_is_unprivileged(conn) || !conn->can_write) {
 		send_error(conn, EACCES);
 		return;
 	}
@@ -418,7 +418,7 @@
 		return;
 	}
 
-	if (conn->id != 0 || !conn->can_write) {
+	if (domain_is_unprivileged(conn) || !conn->can_write) {
 		send_error(conn, EACCES);
 		return;
 	}
@@ -470,7 +470,7 @@
 		return;
 	}
 
-	if (conn->id != 0) {
+	if (domain_is_unprivileged(conn)) {
 		send_error(conn, EACCES);
 		return;
 	}
@@ -507,7 +507,7 @@
 		return;
 	}
 
-	if (conn->id != 0) {
+	if (domain_is_unprivileged(conn)) {
 		send_error(conn, EACCES);
 		return;
 	}

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eH-0003aH-EE; Sat, 11 Feb 2012 04:33:21 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eE-0003Xg-Lf
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-21.messagelabs.com!1328934790!10201349!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21039 invoked from network); 11 Feb 2012 04:33:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e5-0006QN-Tr
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e5-000172-JS
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:09 +0000
Message-Id: <E1Rw4e5-000172-JS@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: add reference for vcpu-set
	command.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Wei Liu <wei.liu2@citrix.com>
# Date 1328810587 0
# Node ID f24828bc8e251304201d18c62482c8da3760a8fd
# Parent  b90f65c03f516baf85246a842dafafa47f9f6a7f
xl: add reference for vcpu-set command.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r b90f65c03f51 -r f24828bc8e25 docs/man/xl.pod.1
--- a/docs/man/xl.pod.1	Thu Feb 09 16:45:26 2012 +0000
+++ b/docs/man/xl.pod.1	Thu Feb 09 18:03:07 2012 +0000
@@ -512,6 +512,9 @@
 configured VCPU count is an error.  Trying to set VCPUs to < 1 will be
 quietly ignored.
 
+Some guests may need to actually bring the newly added CPU online
+after B<vcpu-set>, go to B<SEE ALSO> section for information.
+
 =item B<vcpu-list> [I<domain-id>]
 
 Lists VCPU information for a specific domain.  If no domain is
@@ -1093,6 +1096,10 @@
 L<http://xenbits.xen.org/docs/unstable/misc/xl-disk-configuration.txt>
 L<http://xenbits.xen.org/docs/unstable/misc/xsm-flask.txt>
 
+For systems that don't automatically bring CPU online:
+
+L<http://wiki.xen.org/wiki/Paravirt_Linux_CPU_Hotplug>
+
 =head1 BUGS
 
 Send bugs to xen-devel@lists.xensource.com, see

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eH-0003aH-EE; Sat, 11 Feb 2012 04:33:21 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eE-0003Xg-Lf
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-21.messagelabs.com!1328934790!10201349!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21039 invoked from network); 11 Feb 2012 04:33:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e5-0006QN-Tr
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4e5-000172-JS
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:09 +0000
Message-Id: <E1Rw4e5-000172-JS@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: add reference for vcpu-set
	command.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Wei Liu <wei.liu2@citrix.com>
# Date 1328810587 0
# Node ID f24828bc8e251304201d18c62482c8da3760a8fd
# Parent  b90f65c03f516baf85246a842dafafa47f9f6a7f
xl: add reference for vcpu-set command.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r b90f65c03f51 -r f24828bc8e25 docs/man/xl.pod.1
--- a/docs/man/xl.pod.1	Thu Feb 09 16:45:26 2012 +0000
+++ b/docs/man/xl.pod.1	Thu Feb 09 18:03:07 2012 +0000
@@ -512,6 +512,9 @@
 configured VCPU count is an error.  Trying to set VCPUs to < 1 will be
 quietly ignored.
 
+Some guests may need to actually bring the newly added CPU online
+after B<vcpu-set>, go to B<SEE ALSO> section for information.
+
 =item B<vcpu-list> [I<domain-id>]
 
 Lists VCPU information for a specific domain.  If no domain is
@@ -1093,6 +1096,10 @@
 L<http://xenbits.xen.org/docs/unstable/misc/xl-disk-configuration.txt>
 L<http://xenbits.xen.org/docs/unstable/misc/xsm-flask.txt>
 
+For systems that don't automatically bring CPU online:
+
+L<http://wiki.xen.org/wiki/Paravirt_Linux_CPU_Hotplug>
+
 =head1 BUGS
 
 Send bugs to xen-devel@lists.xensource.com, see

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:27 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eM-0003iz-Ne; Sat, 11 Feb 2012 04:33:26 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eK-0003ZH-Re
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1328934797!8765264!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14477 invoked from network); 11 Feb 2012 04:33:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eC-0006R0-K4
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eC-0001CC-Ip
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:16 +0000
Message-Id: <E1Rw4eC-0001CC-Ip@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstored: refactor socket setup code
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812413 0
# Node ID 674fcff272be09962eba636361623f3874906ace
# Parent  aae516b78fce679f9c367231b7a3891814fcfdbb
xenstored: refactor socket setup code

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r aae516b78fce -r 674fcff272be tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:32 2012 +0000
+++ b/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:33 2012 +0000
@@ -343,13 +343,6 @@
 	return max;
 }
 
-static int destroy_fd(void *_fd)
-{
-	int *fd = _fd;
-	close(*fd);
-	return 0;
-}
-
 /* Is child a subnode of parent, or equal? */
 bool is_child(const char *child, const char *parent)
 {
@@ -1705,6 +1698,51 @@
 	umask(0);
 }
 
+static int destroy_fd(void *_fd)
+{
+	int *fd = _fd;
+	close(*fd);
+	return 0;
+}
+
+static void init_sockets(int **psock, int **pro_sock)
+{
+	struct sockaddr_un addr;
+	int *sock, *ro_sock;
+	/* Create sockets for them to listen to. */
+	*psock = sock = talloc(talloc_autofree_context(), int);
+	*sock = socket(PF_UNIX, SOCK_STREAM, 0);
+	if (*sock < 0)
+		barf_perror("Could not create socket");
+	*pro_sock = ro_sock = talloc(talloc_autofree_context(), int);
+	*ro_sock = socket(PF_UNIX, SOCK_STREAM, 0);
+	if (*ro_sock < 0)
+		barf_perror("Could not create socket");
+	talloc_set_destructor(sock, destroy_fd);
+	talloc_set_destructor(ro_sock, destroy_fd);
+
+	/* FIXME: Be more sophisticated, don't mug running daemon. */
+	unlink(xs_daemon_socket());
+	unlink(xs_daemon_socket_ro());
+
+	addr.sun_family = AF_UNIX;
+	strcpy(addr.sun_path, xs_daemon_socket());
+	if (bind(*sock, (struct sockaddr *)&addr, sizeof(addr)) != 0)
+		barf_perror("Could not bind socket to %s", xs_daemon_socket());
+	strcpy(addr.sun_path, xs_daemon_socket_ro());
+	if (bind(*ro_sock, (struct sockaddr *)&addr, sizeof(addr)) != 0)
+		barf_perror("Could not bind socket to %s",
+			    xs_daemon_socket_ro());
+	if (chmod(xs_daemon_socket(), 0600) != 0
+	    || chmod(xs_daemon_socket_ro(), 0660) != 0)
+		barf_perror("Could not chmod sockets");
+
+	if (listen(*sock, 1) != 0
+	    || listen(*ro_sock, 1) != 0)
+		barf_perror("Could not listen on sockets");
+
+
+}
 
 static void usage(void)
 {
@@ -1753,7 +1791,6 @@
 int main(int argc, char *argv[])
 {
 	int opt, *sock, *ro_sock, max;
-	struct sockaddr_un addr;
 	fd_set inset, outset;
 	bool dofork = true;
 	bool outputpid = false;
@@ -1837,40 +1874,10 @@
 	if (!dofork)
 		talloc_enable_leak_report_full();
 
-	/* Create sockets for them to listen to. */
-	sock = talloc(talloc_autofree_context(), int);
-	*sock = socket(PF_UNIX, SOCK_STREAM, 0);
-	if (*sock < 0)
-		barf_perror("Could not create socket");
-	ro_sock = talloc(talloc_autofree_context(), int);
-	*ro_sock = socket(PF_UNIX, SOCK_STREAM, 0);
-	if (*ro_sock < 0)
-		barf_perror("Could not create socket");
-	talloc_set_destructor(sock, destroy_fd);
-	talloc_set_destructor(ro_sock, destroy_fd);
-
 	/* Don't kill us with SIGPIPE. */
 	signal(SIGPIPE, SIG_IGN);
 
-	/* FIXME: Be more sophisticated, don't mug running daemon. */
-	unlink(xs_daemon_socket());
-	unlink(xs_daemon_socket_ro());
-
-	addr.sun_family = AF_UNIX;
-	strcpy(addr.sun_path, xs_daemon_socket());
-	if (bind(*sock, (struct sockaddr *)&addr, sizeof(addr)) != 0)
-		barf_perror("Could not bind socket to %s", xs_daemon_socket());
-	strcpy(addr.sun_path, xs_daemon_socket_ro());
-	if (bind(*ro_sock, (struct sockaddr *)&addr, sizeof(addr)) != 0)
-		barf_perror("Could not bind socket to %s",
-			    xs_daemon_socket_ro());
-	if (chmod(xs_daemon_socket(), 0600) != 0
-	    || chmod(xs_daemon_socket_ro(), 0660) != 0)
-		barf_perror("Could not chmod sockets");
-
-	if (listen(*sock, 1) != 0
-	    || listen(*ro_sock, 1) != 0)
-		barf_perror("Could not listen on sockets");
+	init_sockets(&sock, &ro_sock);
 
 	if (pipe(reopen_log_pipe)) {
 		barf_perror("pipe");

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:28 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eN-0003jL-1C; Sat, 11 Feb 2012 04:33:27 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eK-0003ev-UR
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-27.messagelabs.com!1328934751!52289673!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5621 invoked from network); 11 Feb 2012 04:32:32 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:32 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eI-0006RX-Fj
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:22 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eI-0001HA-EV
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:22 +0000
Message-Id: <E1Rw4eI-0001HA-EV@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: deal with
	MEM_EVENT_FLAG_EVICT_FAIL request in tools/xenpaging
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328813273 0
# Node ID 730f6ed72d70ae59b2ce93e343ebe500a41ee63a
# Parent  e0392842b8a31146d84d7162de55fe275e4e5ea0
xenpaging: deal with MEM_EVENT_FLAG_EVICT_FAIL request in tools/xenpaging

If a page is nominated but not evicted,then dom0 accesses the page,it
will change the page's p2mt to be p2m_ram_paging_in,and the req.flags
is MEM_EVENT_FLAG_EVICT_FAIL;so it will fail in p2m_mem_paging_evict()
because of the p2mt;and paging->num_paged_out will not increase in
this case;After the paging process is terminated, the p2mt
p2m_ram_paging_in still remains in p2m table.Once domU accesses the
nominated page,it will result in BSOD or vm'stuck.

The patch adds the dealing of this request to resume the page before
xenpaging is ended.

[ This can happen if p2m_mem_paging_populate() was called by a foreign
domain. In this case MEM_EVENT_FLAG_VCPU_PAUSED is not set and xenpaging
will not sent a response. And in this case the ring is in an
inconsistent state anyway, new requests cant be added, I think. - Olaf ]

Signed-off-by: hongkaixing <hongkaixing@huawei.com>
Signed-off-by: shizhen <bicky.shi@huawei.com>
Acked-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r e0392842b8a3 -r 730f6ed72d70 tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Thu Feb 09 18:41:03 2012 +0000
+++ b/tools/xenpaging/xenpaging.c	Thu Feb 09 18:47:53 2012 +0000
@@ -911,7 +911,7 @@
                         !!(req.flags & MEM_EVENT_FLAG_EVICT_FAIL) );
 
                 /* Tell Xen to resume the vcpu */
-                if ( req.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
+                if (( req.flags & MEM_EVENT_FLAG_VCPU_PAUSED ) || ( req.flags & MEM_EVENT_FLAG_EVICT_FAIL ))
                 {
                     /* Prepare the response */
                     rsp.gfn = req.gfn;

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:28 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eN-0003jL-1C; Sat, 11 Feb 2012 04:33:27 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eK-0003ev-UR
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-27.messagelabs.com!1328934751!52289673!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5621 invoked from network); 11 Feb 2012 04:32:32 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:32 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eI-0006RX-Fj
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:22 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eI-0001HA-EV
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:22 +0000
Message-Id: <E1Rw4eI-0001HA-EV@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: deal with
	MEM_EVENT_FLAG_EVICT_FAIL request in tools/xenpaging
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328813273 0
# Node ID 730f6ed72d70ae59b2ce93e343ebe500a41ee63a
# Parent  e0392842b8a31146d84d7162de55fe275e4e5ea0
xenpaging: deal with MEM_EVENT_FLAG_EVICT_FAIL request in tools/xenpaging

If a page is nominated but not evicted,then dom0 accesses the page,it
will change the page's p2mt to be p2m_ram_paging_in,and the req.flags
is MEM_EVENT_FLAG_EVICT_FAIL;so it will fail in p2m_mem_paging_evict()
because of the p2mt;and paging->num_paged_out will not increase in
this case;After the paging process is terminated, the p2mt
p2m_ram_paging_in still remains in p2m table.Once domU accesses the
nominated page,it will result in BSOD or vm'stuck.

The patch adds the dealing of this request to resume the page before
xenpaging is ended.

[ This can happen if p2m_mem_paging_populate() was called by a foreign
domain. In this case MEM_EVENT_FLAG_VCPU_PAUSED is not set and xenpaging
will not sent a response. And in this case the ring is in an
inconsistent state anyway, new requests cant be added, I think. - Olaf ]

Signed-off-by: hongkaixing <hongkaixing@huawei.com>
Signed-off-by: shizhen <bicky.shi@huawei.com>
Acked-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r e0392842b8a3 -r 730f6ed72d70 tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Thu Feb 09 18:41:03 2012 +0000
+++ b/tools/xenpaging/xenpaging.c	Thu Feb 09 18:47:53 2012 +0000
@@ -911,7 +911,7 @@
                         !!(req.flags & MEM_EVENT_FLAG_EVICT_FAIL) );
 
                 /* Tell Xen to resume the vcpu */
-                if ( req.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
+                if (( req.flags & MEM_EVENT_FLAG_VCPU_PAUSED ) || ( req.flags & MEM_EVENT_FLAG_EVICT_FAIL ))
                 {
                     /* Prepare the response */
                     rsp.gfn = req.gfn;

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:27 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eM-0003iz-Ne; Sat, 11 Feb 2012 04:33:26 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eK-0003ZH-Re
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1328934797!8765264!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14477 invoked from network); 11 Feb 2012 04:33:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eC-0006R0-K4
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eC-0001CC-Ip
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:16 +0000
Message-Id: <E1Rw4eC-0001CC-Ip@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstored: refactor socket setup code
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812413 0
# Node ID 674fcff272be09962eba636361623f3874906ace
# Parent  aae516b78fce679f9c367231b7a3891814fcfdbb
xenstored: refactor socket setup code

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r aae516b78fce -r 674fcff272be tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:32 2012 +0000
+++ b/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:33 2012 +0000
@@ -343,13 +343,6 @@
 	return max;
 }
 
-static int destroy_fd(void *_fd)
-{
-	int *fd = _fd;
-	close(*fd);
-	return 0;
-}
-
 /* Is child a subnode of parent, or equal? */
 bool is_child(const char *child, const char *parent)
 {
@@ -1705,6 +1698,51 @@
 	umask(0);
 }
 
+static int destroy_fd(void *_fd)
+{
+	int *fd = _fd;
+	close(*fd);
+	return 0;
+}
+
+static void init_sockets(int **psock, int **pro_sock)
+{
+	struct sockaddr_un addr;
+	int *sock, *ro_sock;
+	/* Create sockets for them to listen to. */
+	*psock = sock = talloc(talloc_autofree_context(), int);
+	*sock = socket(PF_UNIX, SOCK_STREAM, 0);
+	if (*sock < 0)
+		barf_perror("Could not create socket");
+	*pro_sock = ro_sock = talloc(talloc_autofree_context(), int);
+	*ro_sock = socket(PF_UNIX, SOCK_STREAM, 0);
+	if (*ro_sock < 0)
+		barf_perror("Could not create socket");
+	talloc_set_destructor(sock, destroy_fd);
+	talloc_set_destructor(ro_sock, destroy_fd);
+
+	/* FIXME: Be more sophisticated, don't mug running daemon. */
+	unlink(xs_daemon_socket());
+	unlink(xs_daemon_socket_ro());
+
+	addr.sun_family = AF_UNIX;
+	strcpy(addr.sun_path, xs_daemon_socket());
+	if (bind(*sock, (struct sockaddr *)&addr, sizeof(addr)) != 0)
+		barf_perror("Could not bind socket to %s", xs_daemon_socket());
+	strcpy(addr.sun_path, xs_daemon_socket_ro());
+	if (bind(*ro_sock, (struct sockaddr *)&addr, sizeof(addr)) != 0)
+		barf_perror("Could not bind socket to %s",
+			    xs_daemon_socket_ro());
+	if (chmod(xs_daemon_socket(), 0600) != 0
+	    || chmod(xs_daemon_socket_ro(), 0660) != 0)
+		barf_perror("Could not chmod sockets");
+
+	if (listen(*sock, 1) != 0
+	    || listen(*ro_sock, 1) != 0)
+		barf_perror("Could not listen on sockets");
+
+
+}
 
 static void usage(void)
 {
@@ -1753,7 +1791,6 @@
 int main(int argc, char *argv[])
 {
 	int opt, *sock, *ro_sock, max;
-	struct sockaddr_un addr;
 	fd_set inset, outset;
 	bool dofork = true;
 	bool outputpid = false;
@@ -1837,40 +1874,10 @@
 	if (!dofork)
 		talloc_enable_leak_report_full();
 
-	/* Create sockets for them to listen to. */
-	sock = talloc(talloc_autofree_context(), int);
-	*sock = socket(PF_UNIX, SOCK_STREAM, 0);
-	if (*sock < 0)
-		barf_perror("Could not create socket");
-	ro_sock = talloc(talloc_autofree_context(), int);
-	*ro_sock = socket(PF_UNIX, SOCK_STREAM, 0);
-	if (*ro_sock < 0)
-		barf_perror("Could not create socket");
-	talloc_set_destructor(sock, destroy_fd);
-	talloc_set_destructor(ro_sock, destroy_fd);
-
 	/* Don't kill us with SIGPIPE. */
 	signal(SIGPIPE, SIG_IGN);
 
-	/* FIXME: Be more sophisticated, don't mug running daemon. */
-	unlink(xs_daemon_socket());
-	unlink(xs_daemon_socket_ro());
-
-	addr.sun_family = AF_UNIX;
-	strcpy(addr.sun_path, xs_daemon_socket());
-	if (bind(*sock, (struct sockaddr *)&addr, sizeof(addr)) != 0)
-		barf_perror("Could not bind socket to %s", xs_daemon_socket());
-	strcpy(addr.sun_path, xs_daemon_socket_ro());
-	if (bind(*ro_sock, (struct sockaddr *)&addr, sizeof(addr)) != 0)
-		barf_perror("Could not bind socket to %s",
-			    xs_daemon_socket_ro());
-	if (chmod(xs_daemon_socket(), 0600) != 0
-	    || chmod(xs_daemon_socket_ro(), 0660) != 0)
-		barf_perror("Could not chmod sockets");
-
-	if (listen(*sock, 1) != 0
-	    || listen(*ro_sock, 1) != 0)
-		barf_perror("Could not listen on sockets");
+	init_sockets(&sock, &ro_sock);
 
 	if (pipe(reopen_log_pipe)) {
 		barf_perror("pipe");

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:28 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eN-0003jn-H6; Sat, 11 Feb 2012 04:33:27 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eL-0003Zc-HO
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1328934797!6422482!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3166 invoked from network); 11 Feb 2012 04:33:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eD-0006R3-5A
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eD-0001Cb-3d
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:17 +0000
Message-Id: <E1Rw4eD-0001Cb-3d@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstored: add NO_SOCKETS
	compilation option
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Alex Zeffertt <alex.zeffertt@eu.citrix.com>
# Date 1328812413 0
# Node ID d847e5c4b6c9b7cd9c7cf449dfd87ffb077a50fa
# Parent  674fcff272be09962eba636361623f3874906ace
xenstored: add NO_SOCKETS compilation option

Add option for compiling xenstored without unix sockets to support
running on mini-OS

Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com>
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r 674fcff272be -r d847e5c4b6c9 tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:33 2012 +0000
+++ b/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:33 2012 +0000
@@ -19,9 +19,11 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/select.h>
+#ifndef NO_SOCKETS
 #include <sys/socket.h>
-#include <sys/select.h>
 #include <sys/un.h>
+#endif
 #include <sys/time.h>
 #include <time.h>
 #include <unistd.h>
@@ -320,8 +322,10 @@
 	FD_ZERO(inset);
 	FD_ZERO(outset);
 
-	set_fd(sock,               inset, &max);
-	set_fd(ro_sock,            inset, &max);
+	if (sock != -1)
+		set_fd(sock, inset, &max);
+	if (ro_sock != -1)
+		set_fd(ro_sock, inset, &max);
 	set_fd(reopen_log_pipe[0], inset, &max);
 
 	if (xce_handle != NULL)
@@ -1345,6 +1349,11 @@
 	return new;
 }
 
+#ifdef NO_SOCKETS
+static void accept_connection(int sock, bool canwrite)
+{
+}
+#else
 static int writefd(struct connection *conn, const void *data, unsigned int len)
 {
 	int rc;
@@ -1399,6 +1408,7 @@
 	} else
 		close(fd);
 }
+#endif
 
 #define TDB_FLAGS 0
 
@@ -1698,6 +1708,13 @@
 	umask(0);
 }
 
+#ifdef NO_SOCKETS
+static void init_sockets(int **psock, int **pro_sock)
+{
+	static int minus_one = -1;
+	*psock = *pro_sock = &minus_one;
+}
+#else
 static int destroy_fd(void *_fd)
 {
 	int *fd = _fd;
@@ -1743,6 +1760,7 @@
 
 
 }
+#endif
 
 static void usage(void)
 {
@@ -1938,10 +1956,10 @@
 			reopen_log();
 		}
 
-		if (FD_ISSET(*sock, &inset))
+		if (*sock != -1 && FD_ISSET(*sock, &inset))
 			accept_connection(*sock, true);
 
-		if (FD_ISSET(*ro_sock, &inset))
+		if (*ro_sock != -1 && FD_ISSET(*ro_sock, &inset))
 			accept_connection(*ro_sock, false);
 
 		if (evtchn_fd != -1 && FD_ISSET(evtchn_fd, &inset))

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:28 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eN-0003jn-H6; Sat, 11 Feb 2012 04:33:27 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eL-0003Zc-HO
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1328934797!6422482!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3166 invoked from network); 11 Feb 2012 04:33:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eD-0006R3-5A
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eD-0001Cb-3d
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:17 +0000
Message-Id: <E1Rw4eD-0001Cb-3d@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstored: add NO_SOCKETS
	compilation option
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Alex Zeffertt <alex.zeffertt@eu.citrix.com>
# Date 1328812413 0
# Node ID d847e5c4b6c9b7cd9c7cf449dfd87ffb077a50fa
# Parent  674fcff272be09962eba636361623f3874906ace
xenstored: add NO_SOCKETS compilation option

Add option for compiling xenstored without unix sockets to support
running on mini-OS

Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com>
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r 674fcff272be -r d847e5c4b6c9 tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:33 2012 +0000
+++ b/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:33 2012 +0000
@@ -19,9 +19,11 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/select.h>
+#ifndef NO_SOCKETS
 #include <sys/socket.h>
-#include <sys/select.h>
 #include <sys/un.h>
+#endif
 #include <sys/time.h>
 #include <time.h>
 #include <unistd.h>
@@ -320,8 +322,10 @@
 	FD_ZERO(inset);
 	FD_ZERO(outset);
 
-	set_fd(sock,               inset, &max);
-	set_fd(ro_sock,            inset, &max);
+	if (sock != -1)
+		set_fd(sock, inset, &max);
+	if (ro_sock != -1)
+		set_fd(ro_sock, inset, &max);
 	set_fd(reopen_log_pipe[0], inset, &max);
 
 	if (xce_handle != NULL)
@@ -1345,6 +1349,11 @@
 	return new;
 }
 
+#ifdef NO_SOCKETS
+static void accept_connection(int sock, bool canwrite)
+{
+}
+#else
 static int writefd(struct connection *conn, const void *data, unsigned int len)
 {
 	int rc;
@@ -1399,6 +1408,7 @@
 	} else
 		close(fd);
 }
+#endif
 
 #define TDB_FLAGS 0
 
@@ -1698,6 +1708,13 @@
 	umask(0);
 }
 
+#ifdef NO_SOCKETS
+static void init_sockets(int **psock, int **pro_sock)
+{
+	static int minus_one = -1;
+	*psock = *pro_sock = &minus_one;
+}
+#else
 static int destroy_fd(void *_fd)
 {
 	int *fd = _fd;
@@ -1743,6 +1760,7 @@
 
 
 }
+#endif
 
 static void usage(void)
 {
@@ -1938,10 +1956,10 @@
 			reopen_log();
 		}
 
-		if (FD_ISSET(*sock, &inset))
+		if (*sock != -1 && FD_ISSET(*sock, &inset))
 			accept_connection(*sock, true);
 
-		if (FD_ISSET(*ro_sock, &inset))
+		if (*ro_sock != -1 && FD_ISSET(*ro_sock, &inset))
 			accept_connection(*ro_sock, false);
 
 		if (evtchn_fd != -1 && FD_ISSET(evtchn_fd, &inset))

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:29 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eP-0003mV-C0; Sat, 11 Feb 2012 04:33:29 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eN-0003cJ-QN
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:28 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1328934799!11051943!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16830 invoked from network); 11 Feb 2012 04:33:20 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eE-0006RC-PH
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eE-0001Dn-O2
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:18 +0000
Message-Id: <E1Rw4eE-0001Dn-O2@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstored: support running in minios
	stubdom
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812414 0
# Node ID f371834bac0998d1eaa0cb5d8943f1c231afc5d1
# Parent  2094ba2c2f322ae6280e57cafef19557d46a314a
xenstored: support running in minios stubdom

A previous versions of this patch has been sent to xen-devel. See
http://lists.xensource.com/archives/html/xen-devel/2009-03/msg01655.html

Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com>
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r 2094ba2c2f32 -r f371834bac09 tools/xenstore/Makefile
--- a/tools/xenstore/Makefile	Thu Feb 09 18:33:34 2012 +0000
+++ b/tools/xenstore/Makefile	Thu Feb 09 18:33:34 2012 +0000
@@ -13,9 +13,10 @@
 
 XENSTORED_OBJS = xenstored_core.o xenstored_watch.o xenstored_domain.o xenstored_transaction.o xs_lib.o talloc.o utils.o tdb.o hashtable.o
 
-XENSTORED_OBJS_$(CONFIG_Linux) = xenstored_linux.o
-XENSTORED_OBJS_$(CONFIG_SunOS) = xenstored_solaris.o xenstored_probes.o
-XENSTORED_OBJS_$(CONFIG_NetBSD) = xenstored_netbsd.o
+XENSTORED_OBJS_$(CONFIG_Linux) = xenstored_linux.o xenstored_posix.o
+XENSTORED_OBJS_$(CONFIG_SunOS) = xenstored_solaris.o xenstored_posix.o xenstored_probes.o
+XENSTORED_OBJS_$(CONFIG_NetBSD) = xenstored_netbsd.o xenstored_posix.o
+XENSTORED_OBJS_$(CONFIG_MiniOS) = xenstored_minios.o
 
 XENSTORED_OBJS += $(XENSTORED_OBJS_y)
 
@@ -28,6 +29,10 @@
 
 ALL_TARGETS = libxenstore.so libxenstore.a clients xs_tdb_dump xenstored
 
+ifdef CONFIG_STUBDOM
+CFLAGS += -DNO_SOCKETS=1
+endif
+
 .PHONY: all
 all: $(ALL_TARGETS)
 
@@ -49,6 +54,9 @@
 xenstored: $(XENSTORED_OBJS)
 	$(CC) $(LDFLAGS) $^ $(LDLIBS_libxenctrl) $(SOCKET_LIBS) -o $@ $(APPEND_LDFLAGS)
 
+xenstored.a: $(XENSTORED_OBJS)
+	$(AR) cr $@ $^
+
 $(CLIENTS): xenstore
 	ln -f xenstore $@
 
diff -r 2094ba2c2f32 -r f371834bac09 tools/xenstore/utils.h
--- a/tools/xenstore/utils.h	Thu Feb 09 18:33:34 2012 +0000
+++ b/tools/xenstore/utils.h	Thu Feb 09 18:33:34 2012 +0000
@@ -19,7 +19,9 @@
 	return streq(a + strlen(a) - strlen(b), b);
 }
 
+#ifndef ARRAY_SIZE
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#endif
 
 void barf(const char *fmt, ...) __attribute__((noreturn));
 void barf_perror(const char *fmt, ...) __attribute__((noreturn));
diff -r 2094ba2c2f32 -r f371834bac09 tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:34 2012 +0000
+++ b/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:34 2012 +0000
@@ -224,7 +224,6 @@
 	}
 }
 
-
 static bool write_messages(struct connection *conn)
 {
 	int ret;
@@ -327,7 +326,8 @@
 		set_fd(sock, inset, &max);
 	if (ro_sock != -1)
 		set_fd(ro_sock, inset, &max);
-	set_fd(reopen_log_pipe[0], inset, &max);
+	if (reopen_log_pipe[0] != -1)
+		set_fd(reopen_log_pipe[0], inset, &max);
 
 	if (xce_handle != NULL)
 		set_fd(xc_evtchn_fd(xce_handle), inset, &max);
@@ -1664,53 +1664,6 @@
 }
 
 
-static void write_pidfile(const char *pidfile)
-{
-	char buf[100];
-	int len;
-	int fd;
-
-	fd = open(pidfile, O_RDWR | O_CREAT, 0600);
-	if (fd == -1)
-		barf_perror("Opening pid file %s", pidfile);
-
-	/* We exit silently if daemon already running. */
-	if (lockf(fd, F_TLOCK, 0) == -1)
-		exit(0);
-
-	len = snprintf(buf, sizeof(buf), "%ld\n", (long)getpid());
-	if (write(fd, buf, len) != len)
-		barf_perror("Writing pid file %s", pidfile);
-}
-
-/* Stevens. */
-static void daemonize(void)
-{
-	pid_t pid;
-
-	/* Separate from our parent via fork, so init inherits us. */
-	if ((pid = fork()) < 0)
-		barf_perror("Failed to fork daemon");
-	if (pid != 0)
-		exit(0);
-
-	/* Session leader so ^C doesn't whack us. */
-	setsid();
-
-	/* Let session leader exit so child cannot regain CTTY */
-	if ((pid = fork()) < 0)
-		barf_perror("Failed to fork daemon");
-	if (pid != 0)
-		exit(0);
-
-	/* Move off any mount points we might be in. */
-	if (chdir("/") == -1)
-		barf_perror("Failed to chdir");
-
-	/* Discard our parent's old-fashioned umask prejudices. */
-	umask(0);
-}
-
 #ifdef NO_SOCKETS
 static void init_sockets(int **psock, int **pro_sock)
 {
@@ -1874,20 +1827,10 @@
 
 	reopen_log();
 
-	/* make sure xenstored directory exists */
-	if (mkdir(xs_daemon_rundir(), 0755)) {
-		if (errno != EEXIST) {
-			perror("error: mkdir daemon rundir");
-			exit(-1);
-		}
-	}
-
-	if (mkdir(xs_daemon_rootdir(), 0755)) {
-		if (errno != EEXIST) {
-			perror("error: mkdir daemon rootdir");
-			exit(-1);
-		}
-	}
+	/* make sure xenstored directories exist */
+	/* Errors ignored here, will be reported when we open files */
+	mkdir(xs_daemon_rundir(), 0755);
+	mkdir(xs_daemon_rootdir(), 0755);
 
 	if (dofork) {
 		openlog("xenstored", 0, LOG_DAEMON);
@@ -1904,10 +1847,7 @@
 	signal(SIGPIPE, SIG_IGN);
 
 	init_sockets(&sock, &ro_sock);
-
-	if (pipe(reopen_log_pipe)) {
-		barf_perror("pipe");
-	}
+	init_pipe(reopen_log_pipe);
 
 	/* Setup the database */
 	setup_structure();
@@ -1925,16 +1865,8 @@
 	}
 
 	/* redirect to /dev/null now we're ready to accept connections */
-	if (dofork) {
-		int devnull = open("/dev/null", O_RDWR);
-		if (devnull == -1)
-			barf_perror("Could not open /dev/null\n");
-		dup2(devnull, STDIN_FILENO);
-		dup2(devnull, STDOUT_FILENO);
-		dup2(devnull, STDERR_FILENO);
-		close(devnull);
-		xprintf = trace;
-	}
+	if (dofork)
+		finish_daemonize();
 
 	signal(SIGHUP, trigger_reopen_log);
 
@@ -1957,7 +1889,7 @@
 			barf_perror("Select failed");
 		}
 
-		if (FD_ISSET(reopen_log_pipe[0], &inset)) {
+		if (reopen_log_pipe[0] != -1 && FD_ISSET(reopen_log_pipe[0], &inset)) {
 			char c;
 			if (read(reopen_log_pipe[0], &c, 1) != 1)
 				barf_perror("read failed");
diff -r 2094ba2c2f32 -r f371834bac09 tools/xenstore/xenstored_core.h
--- a/tools/xenstore/xenstored_core.h	Thu Feb 09 18:33:34 2012 +0000
+++ b/tools/xenstore/xenstored_core.h	Thu Feb 09 18:33:34 2012 +0000
@@ -171,6 +171,7 @@
 
 /* Map the kernel's xenstore page. */
 void *xenbus_map(void);
+void unmap_xenbus(void *interface);
 
 /* Return the event channel used by xenbus. */
 evtchn_port_t xenbus_evtchn(void);
@@ -178,6 +179,17 @@
 /* Tell the kernel xenstored is running. */
 void xenbus_notify_running(void);
 
+/* Write out the pidfile */
+void write_pidfile(const char *pidfile);
+
+/* Fork but do not close terminal FDs */
+void daemonize(void);
+/* Close stdin/stdout/stderr to complete daemonize */
+void finish_daemonize(void);
+
+/* Open a pipe for signal handling */
+void init_pipe(int reopen_log_pipe[2]);
+
 #endif /* _XENSTORED_CORE_H */
 
 /*
diff -r 2094ba2c2f32 -r f371834bac09 tools/xenstore/xenstored_domain.c
--- a/tools/xenstore/xenstored_domain.c	Thu Feb 09 18:33:34 2012 +0000
+++ b/tools/xenstore/xenstored_domain.c	Thu Feb 09 18:33:34 2012 +0000
@@ -200,7 +200,7 @@
 		/* Domain 0 was mapped by dom0_init, so it must be unmapped
 		   using munmap() and not the grant unmap call. */
 		if (domain->domid == 0)
-			munmap(domain->interface, getpagesize());
+			unmap_xenbus(domain->interface);
 		else
 			unmap_interface(domain->interface);
 	}
diff -r 2094ba2c2f32 -r f371834bac09 tools/xenstore/xenstored_minios.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/xenstore/xenstored_minios.c	Thu Feb 09 18:33:34 2012 +0000
@@ -0,0 +1,60 @@
+/* 
+    Simple prototype Xen Store Daemon providing simple tree-like database.
+    Copyright (C) 2005 Rusty Russell IBM Corporation
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program 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 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 <sys/types.h>
+#include <sys/mman.h>
+#include <xenctrl.h>
+#include "xenstored_core.h"
+#include <xen/grant_table.h>
+
+void write_pidfile(const char *pidfile)
+{
+}
+
+void daemonize(void)
+{
+}
+
+void finish_daemonize(void)
+{
+}
+
+void init_pipe(int reopen_log_pipe[2])
+{
+	reopen_log_pipe[0] = -1;
+	reopen_log_pipe[1] = -1;
+}
+
+void xenbus_notify_running(void)
+{
+}
+
+evtchn_port_t xenbus_evtchn(void)
+{
+	return -1;
+}
+
+void *xenbus_map(void)
+{
+	return NULL;
+}
+
+void unmap_xenbus(void *interface)
+{
+}
+
diff -r 2094ba2c2f32 -r f371834bac09 tools/xenstore/xenstored_posix.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/xenstore/xenstored_posix.c	Thu Feb 09 18:33:34 2012 +0000
@@ -0,0 +1,99 @@
+/* 
+    Simple prototype Xen Store Daemon providing simple tree-like database.
+    Copyright (C) 2005 Rusty Russell IBM Corporation
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program 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 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 <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+
+#include "utils.h"
+#include "xenstored_core.h"
+
+void write_pidfile(const char *pidfile)
+{
+	char buf[100];
+	int len;
+	int fd;
+
+	fd = open(pidfile, O_RDWR | O_CREAT, 0600);
+	if (fd == -1)
+		barf_perror("Opening pid file %s", pidfile);
+
+	/* We exit silently if daemon already running. */
+	if (lockf(fd, F_TLOCK, 0) == -1)
+		exit(0);
+
+	len = snprintf(buf, sizeof(buf), "%ld\n", (long)getpid());
+	if (write(fd, buf, len) != len)
+		barf_perror("Writing pid file %s", pidfile);
+}
+
+/* Stevens. */
+void daemonize(void)
+{
+	pid_t pid;
+
+	/* Separate from our parent via fork, so init inherits us. */
+	if ((pid = fork()) < 0)
+		barf_perror("Failed to fork daemon");
+	if (pid != 0)
+		exit(0);
+
+	/* Session leader so ^C doesn't whack us. */
+	setsid();
+
+	/* Let session leader exit so child cannot regain CTTY */
+	if ((pid = fork()) < 0)
+		barf_perror("Failed to fork daemon");
+	if (pid != 0)
+		exit(0);
+
+	/* Move off any mount points we might be in. */
+	if (chdir("/") == -1)
+		barf_perror("Failed to chdir");
+
+	/* Discard our parent's old-fashioned umask prejudices. */
+	umask(0);
+}
+
+void finish_daemonize(void)
+{
+	int devnull = open("/dev/null", O_RDWR);
+	if (devnull == -1)
+		barf_perror("Could not open /dev/null\n");
+	dup2(devnull, STDIN_FILENO);
+	dup2(devnull, STDOUT_FILENO);
+	dup2(devnull, STDERR_FILENO);
+	close(devnull);
+	xprintf = trace;
+}
+
+void init_pipe(int reopen_log_pipe[2])
+{
+	if (pipe(reopen_log_pipe)) {
+		barf_perror("pipe");
+	}
+}
+
+void unmap_xenbus(void *interface)
+{
+	munmap(interface, getpagesize());
+}

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:29 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eP-0003mV-C0; Sat, 11 Feb 2012 04:33:29 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eN-0003cJ-QN
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:28 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1328934799!11051943!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16830 invoked from network); 11 Feb 2012 04:33:20 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eE-0006RC-PH
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eE-0001Dn-O2
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:18 +0000
Message-Id: <E1Rw4eE-0001Dn-O2@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstored: support running in minios
	stubdom
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812414 0
# Node ID f371834bac0998d1eaa0cb5d8943f1c231afc5d1
# Parent  2094ba2c2f322ae6280e57cafef19557d46a314a
xenstored: support running in minios stubdom

A previous versions of this patch has been sent to xen-devel. See
http://lists.xensource.com/archives/html/xen-devel/2009-03/msg01655.html

Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com>
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r 2094ba2c2f32 -r f371834bac09 tools/xenstore/Makefile
--- a/tools/xenstore/Makefile	Thu Feb 09 18:33:34 2012 +0000
+++ b/tools/xenstore/Makefile	Thu Feb 09 18:33:34 2012 +0000
@@ -13,9 +13,10 @@
 
 XENSTORED_OBJS = xenstored_core.o xenstored_watch.o xenstored_domain.o xenstored_transaction.o xs_lib.o talloc.o utils.o tdb.o hashtable.o
 
-XENSTORED_OBJS_$(CONFIG_Linux) = xenstored_linux.o
-XENSTORED_OBJS_$(CONFIG_SunOS) = xenstored_solaris.o xenstored_probes.o
-XENSTORED_OBJS_$(CONFIG_NetBSD) = xenstored_netbsd.o
+XENSTORED_OBJS_$(CONFIG_Linux) = xenstored_linux.o xenstored_posix.o
+XENSTORED_OBJS_$(CONFIG_SunOS) = xenstored_solaris.o xenstored_posix.o xenstored_probes.o
+XENSTORED_OBJS_$(CONFIG_NetBSD) = xenstored_netbsd.o xenstored_posix.o
+XENSTORED_OBJS_$(CONFIG_MiniOS) = xenstored_minios.o
 
 XENSTORED_OBJS += $(XENSTORED_OBJS_y)
 
@@ -28,6 +29,10 @@
 
 ALL_TARGETS = libxenstore.so libxenstore.a clients xs_tdb_dump xenstored
 
+ifdef CONFIG_STUBDOM
+CFLAGS += -DNO_SOCKETS=1
+endif
+
 .PHONY: all
 all: $(ALL_TARGETS)
 
@@ -49,6 +54,9 @@
 xenstored: $(XENSTORED_OBJS)
 	$(CC) $(LDFLAGS) $^ $(LDLIBS_libxenctrl) $(SOCKET_LIBS) -o $@ $(APPEND_LDFLAGS)
 
+xenstored.a: $(XENSTORED_OBJS)
+	$(AR) cr $@ $^
+
 $(CLIENTS): xenstore
 	ln -f xenstore $@
 
diff -r 2094ba2c2f32 -r f371834bac09 tools/xenstore/utils.h
--- a/tools/xenstore/utils.h	Thu Feb 09 18:33:34 2012 +0000
+++ b/tools/xenstore/utils.h	Thu Feb 09 18:33:34 2012 +0000
@@ -19,7 +19,9 @@
 	return streq(a + strlen(a) - strlen(b), b);
 }
 
+#ifndef ARRAY_SIZE
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#endif
 
 void barf(const char *fmt, ...) __attribute__((noreturn));
 void barf_perror(const char *fmt, ...) __attribute__((noreturn));
diff -r 2094ba2c2f32 -r f371834bac09 tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:34 2012 +0000
+++ b/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:34 2012 +0000
@@ -224,7 +224,6 @@
 	}
 }
 
-
 static bool write_messages(struct connection *conn)
 {
 	int ret;
@@ -327,7 +326,8 @@
 		set_fd(sock, inset, &max);
 	if (ro_sock != -1)
 		set_fd(ro_sock, inset, &max);
-	set_fd(reopen_log_pipe[0], inset, &max);
+	if (reopen_log_pipe[0] != -1)
+		set_fd(reopen_log_pipe[0], inset, &max);
 
 	if (xce_handle != NULL)
 		set_fd(xc_evtchn_fd(xce_handle), inset, &max);
@@ -1664,53 +1664,6 @@
 }
 
 
-static void write_pidfile(const char *pidfile)
-{
-	char buf[100];
-	int len;
-	int fd;
-
-	fd = open(pidfile, O_RDWR | O_CREAT, 0600);
-	if (fd == -1)
-		barf_perror("Opening pid file %s", pidfile);
-
-	/* We exit silently if daemon already running. */
-	if (lockf(fd, F_TLOCK, 0) == -1)
-		exit(0);
-
-	len = snprintf(buf, sizeof(buf), "%ld\n", (long)getpid());
-	if (write(fd, buf, len) != len)
-		barf_perror("Writing pid file %s", pidfile);
-}
-
-/* Stevens. */
-static void daemonize(void)
-{
-	pid_t pid;
-
-	/* Separate from our parent via fork, so init inherits us. */
-	if ((pid = fork()) < 0)
-		barf_perror("Failed to fork daemon");
-	if (pid != 0)
-		exit(0);
-
-	/* Session leader so ^C doesn't whack us. */
-	setsid();
-
-	/* Let session leader exit so child cannot regain CTTY */
-	if ((pid = fork()) < 0)
-		barf_perror("Failed to fork daemon");
-	if (pid != 0)
-		exit(0);
-
-	/* Move off any mount points we might be in. */
-	if (chdir("/") == -1)
-		barf_perror("Failed to chdir");
-
-	/* Discard our parent's old-fashioned umask prejudices. */
-	umask(0);
-}
-
 #ifdef NO_SOCKETS
 static void init_sockets(int **psock, int **pro_sock)
 {
@@ -1874,20 +1827,10 @@
 
 	reopen_log();
 
-	/* make sure xenstored directory exists */
-	if (mkdir(xs_daemon_rundir(), 0755)) {
-		if (errno != EEXIST) {
-			perror("error: mkdir daemon rundir");
-			exit(-1);
-		}
-	}
-
-	if (mkdir(xs_daemon_rootdir(), 0755)) {
-		if (errno != EEXIST) {
-			perror("error: mkdir daemon rootdir");
-			exit(-1);
-		}
-	}
+	/* make sure xenstored directories exist */
+	/* Errors ignored here, will be reported when we open files */
+	mkdir(xs_daemon_rundir(), 0755);
+	mkdir(xs_daemon_rootdir(), 0755);
 
 	if (dofork) {
 		openlog("xenstored", 0, LOG_DAEMON);
@@ -1904,10 +1847,7 @@
 	signal(SIGPIPE, SIG_IGN);
 
 	init_sockets(&sock, &ro_sock);
-
-	if (pipe(reopen_log_pipe)) {
-		barf_perror("pipe");
-	}
+	init_pipe(reopen_log_pipe);
 
 	/* Setup the database */
 	setup_structure();
@@ -1925,16 +1865,8 @@
 	}
 
 	/* redirect to /dev/null now we're ready to accept connections */
-	if (dofork) {
-		int devnull = open("/dev/null", O_RDWR);
-		if (devnull == -1)
-			barf_perror("Could not open /dev/null\n");
-		dup2(devnull, STDIN_FILENO);
-		dup2(devnull, STDOUT_FILENO);
-		dup2(devnull, STDERR_FILENO);
-		close(devnull);
-		xprintf = trace;
-	}
+	if (dofork)
+		finish_daemonize();
 
 	signal(SIGHUP, trigger_reopen_log);
 
@@ -1957,7 +1889,7 @@
 			barf_perror("Select failed");
 		}
 
-		if (FD_ISSET(reopen_log_pipe[0], &inset)) {
+		if (reopen_log_pipe[0] != -1 && FD_ISSET(reopen_log_pipe[0], &inset)) {
 			char c;
 			if (read(reopen_log_pipe[0], &c, 1) != 1)
 				barf_perror("read failed");
diff -r 2094ba2c2f32 -r f371834bac09 tools/xenstore/xenstored_core.h
--- a/tools/xenstore/xenstored_core.h	Thu Feb 09 18:33:34 2012 +0000
+++ b/tools/xenstore/xenstored_core.h	Thu Feb 09 18:33:34 2012 +0000
@@ -171,6 +171,7 @@
 
 /* Map the kernel's xenstore page. */
 void *xenbus_map(void);
+void unmap_xenbus(void *interface);
 
 /* Return the event channel used by xenbus. */
 evtchn_port_t xenbus_evtchn(void);
@@ -178,6 +179,17 @@
 /* Tell the kernel xenstored is running. */
 void xenbus_notify_running(void);
 
+/* Write out the pidfile */
+void write_pidfile(const char *pidfile);
+
+/* Fork but do not close terminal FDs */
+void daemonize(void);
+/* Close stdin/stdout/stderr to complete daemonize */
+void finish_daemonize(void);
+
+/* Open a pipe for signal handling */
+void init_pipe(int reopen_log_pipe[2]);
+
 #endif /* _XENSTORED_CORE_H */
 
 /*
diff -r 2094ba2c2f32 -r f371834bac09 tools/xenstore/xenstored_domain.c
--- a/tools/xenstore/xenstored_domain.c	Thu Feb 09 18:33:34 2012 +0000
+++ b/tools/xenstore/xenstored_domain.c	Thu Feb 09 18:33:34 2012 +0000
@@ -200,7 +200,7 @@
 		/* Domain 0 was mapped by dom0_init, so it must be unmapped
 		   using munmap() and not the grant unmap call. */
 		if (domain->domid == 0)
-			munmap(domain->interface, getpagesize());
+			unmap_xenbus(domain->interface);
 		else
 			unmap_interface(domain->interface);
 	}
diff -r 2094ba2c2f32 -r f371834bac09 tools/xenstore/xenstored_minios.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/xenstore/xenstored_minios.c	Thu Feb 09 18:33:34 2012 +0000
@@ -0,0 +1,60 @@
+/* 
+    Simple prototype Xen Store Daemon providing simple tree-like database.
+    Copyright (C) 2005 Rusty Russell IBM Corporation
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program 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 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 <sys/types.h>
+#include <sys/mman.h>
+#include <xenctrl.h>
+#include "xenstored_core.h"
+#include <xen/grant_table.h>
+
+void write_pidfile(const char *pidfile)
+{
+}
+
+void daemonize(void)
+{
+}
+
+void finish_daemonize(void)
+{
+}
+
+void init_pipe(int reopen_log_pipe[2])
+{
+	reopen_log_pipe[0] = -1;
+	reopen_log_pipe[1] = -1;
+}
+
+void xenbus_notify_running(void)
+{
+}
+
+evtchn_port_t xenbus_evtchn(void)
+{
+	return -1;
+}
+
+void *xenbus_map(void)
+{
+	return NULL;
+}
+
+void unmap_xenbus(void *interface)
+{
+}
+
diff -r 2094ba2c2f32 -r f371834bac09 tools/xenstore/xenstored_posix.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/xenstore/xenstored_posix.c	Thu Feb 09 18:33:34 2012 +0000
@@ -0,0 +1,99 @@
+/* 
+    Simple prototype Xen Store Daemon providing simple tree-like database.
+    Copyright (C) 2005 Rusty Russell IBM Corporation
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program 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 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 <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+
+#include "utils.h"
+#include "xenstored_core.h"
+
+void write_pidfile(const char *pidfile)
+{
+	char buf[100];
+	int len;
+	int fd;
+
+	fd = open(pidfile, O_RDWR | O_CREAT, 0600);
+	if (fd == -1)
+		barf_perror("Opening pid file %s", pidfile);
+
+	/* We exit silently if daemon already running. */
+	if (lockf(fd, F_TLOCK, 0) == -1)
+		exit(0);
+
+	len = snprintf(buf, sizeof(buf), "%ld\n", (long)getpid());
+	if (write(fd, buf, len) != len)
+		barf_perror("Writing pid file %s", pidfile);
+}
+
+/* Stevens. */
+void daemonize(void)
+{
+	pid_t pid;
+
+	/* Separate from our parent via fork, so init inherits us. */
+	if ((pid = fork()) < 0)
+		barf_perror("Failed to fork daemon");
+	if (pid != 0)
+		exit(0);
+
+	/* Session leader so ^C doesn't whack us. */
+	setsid();
+
+	/* Let session leader exit so child cannot regain CTTY */
+	if ((pid = fork()) < 0)
+		barf_perror("Failed to fork daemon");
+	if (pid != 0)
+		exit(0);
+
+	/* Move off any mount points we might be in. */
+	if (chdir("/") == -1)
+		barf_perror("Failed to chdir");
+
+	/* Discard our parent's old-fashioned umask prejudices. */
+	umask(0);
+}
+
+void finish_daemonize(void)
+{
+	int devnull = open("/dev/null", O_RDWR);
+	if (devnull == -1)
+		barf_perror("Could not open /dev/null\n");
+	dup2(devnull, STDIN_FILENO);
+	dup2(devnull, STDOUT_FILENO);
+	dup2(devnull, STDERR_FILENO);
+	close(devnull);
+	xprintf = trace;
+}
+
+void init_pipe(int reopen_log_pipe[2])
+{
+	if (pipe(reopen_log_pipe)) {
+		barf_perror("pipe");
+	}
+}
+
+void unmap_xenbus(void *interface)
+{
+	munmap(interface, getpagesize());
+}

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:30 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eP-0003m9-3u; Sat, 11 Feb 2012 04:33:29 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eM-0003Zu-0e
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-21.messagelabs.com!1328934798!4540699!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24419 invoked from network); 11 Feb 2012 04:33:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eD-0006R6-ML
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eD-0001D0-Kh
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:17 +0000
Message-Id: <E1Rw4eD-0001D0-Kh@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstored: support for tdb_copy with
	TDB_INTERNAL
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Alex Zeffertt <alex.zeffertt@eu.citrix.com>
# Date 1328812413 0
# Node ID b06f156d5d7209ea8e53cd5caf4c4e5b93768150
# Parent  d847e5c4b6c9b7cd9c7cf449dfd87ffb077a50fa
xenstored: support for tdb_copy with TDB_INTERNAL

The tdb_copy function should honor the TDB_INTERNAL flag for in-memory
databases; this is required to run in mini-os which does not use a
filesystem.

Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com>
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r d847e5c4b6c9 -r b06f156d5d72 tools/xenstore/tdb.c
--- a/tools/xenstore/tdb.c	Thu Feb 09 18:33:33 2012 +0000
+++ b/tools/xenstore/tdb.c	Thu Feb 09 18:33:33 2012 +0000
@@ -2103,6 +2103,41 @@
 	int fd, saved_errno;
 	TDB_CONTEXT *copy;
 
+	if (tdb->flags & TDB_INTERNAL) {
+		struct tdb_header *copydb;
+		
+		copy = talloc_zero(outfile, TDB_CONTEXT);
+		if (copy == NULL) {
+			errno = ENOMEM;
+			goto intfail;
+		}
+		memcpy(copy, tdb, sizeof(TDB_CONTEXT));
+
+		if (copy->name || copy->locked || copy->device || copy->inode) {
+			fprintf(stderr, "tdb_copy assumption(s) failed\n");
+			goto intfail;
+		}
+
+		copydb = talloc_zero_size(copy, copy->map_size);
+		if (copydb == NULL) {
+			errno = ENOMEM;
+			goto intfail;
+		}
+		memcpy(copydb, copy->map_ptr, copy->map_size);
+		copy->map_ptr = (char*) copydb;
+
+		if (tdb_brlock(tdb, GLOBAL_LOCK, F_UNLCK, F_SETLKW, 0) == -1)
+			goto intfail;
+
+		copy->next = tdbs;
+		tdbs = copy;
+
+		return copy;
+intfail:
+		talloc_free(copy);
+		return NULL;
+	}
+
 	fd = open(outfile, O_TRUNC|O_CREAT|O_WRONLY, 0640);
 	if (fd < 0)
 		return NULL;

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:30 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eP-0003m9-3u; Sat, 11 Feb 2012 04:33:29 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eM-0003Zu-0e
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-21.messagelabs.com!1328934798!4540699!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24419 invoked from network); 11 Feb 2012 04:33:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eD-0006R6-ML
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eD-0001D0-Kh
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:17 +0000
Message-Id: <E1Rw4eD-0001D0-Kh@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstored: support for tdb_copy with
	TDB_INTERNAL
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Alex Zeffertt <alex.zeffertt@eu.citrix.com>
# Date 1328812413 0
# Node ID b06f156d5d7209ea8e53cd5caf4c4e5b93768150
# Parent  d847e5c4b6c9b7cd9c7cf449dfd87ffb077a50fa
xenstored: support for tdb_copy with TDB_INTERNAL

The tdb_copy function should honor the TDB_INTERNAL flag for in-memory
databases; this is required to run in mini-os which does not use a
filesystem.

Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com>
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r d847e5c4b6c9 -r b06f156d5d72 tools/xenstore/tdb.c
--- a/tools/xenstore/tdb.c	Thu Feb 09 18:33:33 2012 +0000
+++ b/tools/xenstore/tdb.c	Thu Feb 09 18:33:33 2012 +0000
@@ -2103,6 +2103,41 @@
 	int fd, saved_errno;
 	TDB_CONTEXT *copy;
 
+	if (tdb->flags & TDB_INTERNAL) {
+		struct tdb_header *copydb;
+		
+		copy = talloc_zero(outfile, TDB_CONTEXT);
+		if (copy == NULL) {
+			errno = ENOMEM;
+			goto intfail;
+		}
+		memcpy(copy, tdb, sizeof(TDB_CONTEXT));
+
+		if (copy->name || copy->locked || copy->device || copy->inode) {
+			fprintf(stderr, "tdb_copy assumption(s) failed\n");
+			goto intfail;
+		}
+
+		copydb = talloc_zero_size(copy, copy->map_size);
+		if (copydb == NULL) {
+			errno = ENOMEM;
+			goto intfail;
+		}
+		memcpy(copydb, copy->map_ptr, copy->map_size);
+		copy->map_ptr = (char*) copydb;
+
+		if (tdb_brlock(tdb, GLOBAL_LOCK, F_UNLCK, F_SETLKW, 0) == -1)
+			goto intfail;
+
+		copy->next = tdbs;
+		tdbs = copy;
+
+		return copy;
+intfail:
+		talloc_free(copy);
+		return NULL;
+	}
+
 	fd = open(outfile, O_TRUNC|O_CREAT|O_WRONLY, 0640);
 	if (fd < 0)
 		return NULL;

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:30 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eP-0003mq-Hb; Sat, 11 Feb 2012 04:33:29 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eO-0003co-GV
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:28 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-174.messagelabs.com!1328934800!12861898!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18540 invoked from network); 11 Feb 2012 04:33:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eF-0006RI-V1
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eF-0001Eh-QC
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:19 +0000
Message-Id: <E1Rw4eF-0001Eh-QC@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] stubdom: enable xenstored build
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812415 0
# Node ID 095c3cbf7f6e894531c183600fee9ea06217d947
# Parent  c442ebf5834d7b1a08d40a99a2babd0517e02713
stubdom: enable xenstored build

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r c442ebf5834d -r 095c3cbf7f6e extras/mini-os/Makefile
--- a/extras/mini-os/Makefile	Thu Feb 09 18:33:35 2012 +0000
+++ b/extras/mini-os/Makefile	Thu Feb 09 18:33:35 2012 +0000
@@ -27,6 +27,7 @@
 CONFIG_KBDFRONT ?= y
 CONFIG_CONSFRONT ?= y
 CONFIG_XENBUS ?= y
+CONFIG_LWIP ?= $(lwip)
 
 # Export config items as compiler directives
 flags-$(CONFIG_START_NETWORK) += -DCONFIG_START_NETWORK
@@ -123,7 +124,7 @@
 arch_lib:
 	$(MAKE) --directory=$(TARGET_ARCH_DIR) OBJ_DIR=$(OBJ_DIR)/$(TARGET_ARCH_DIR) || exit 1;
 
-ifeq ($(lwip),y)
+ifeq ($(CONFIG_LWIP),y)
 # lwIP library
 LWC	:= $(shell find $(LWIPDIR)/ -type f -name '*.c')
 LWC	:= $(filter-out %6.c %ip6_addr.c %ethernetif.c, $(LWC))
diff -r c442ebf5834d -r 095c3cbf7f6e stubdom/Makefile
--- a/stubdom/Makefile	Thu Feb 09 18:33:35 2012 +0000
+++ b/stubdom/Makefile	Thu Feb 09 18:33:35 2012 +0000
@@ -74,14 +74,14 @@
 
 TARGET_LDFLAGS += -nostdlib -L$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib
 
-TARGETS=ioemu c caml grub
+TARGETS=ioemu c caml grub xenstore
 
 CROSS_MAKE := $(MAKE) DESTDIR=
 
 .PHONY: all
 all: build
 ifeq ($(STUBDOM_SUPPORTED),1)
-build: genpath ioemu-stubdom c-stubdom pv-grub
+build: genpath ioemu-stubdom c-stubdom pv-grub xenstore-stubdom
 else
 build: genpath
 endif
@@ -262,6 +262,11 @@
 	  ln -sf $(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/*.c . && \
 	  ln -sf $(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/*.h . && \
 	  ln -sf $(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/Makefile . )
+	mkdir -p xenstore
+	[ -h xenstore/Makefile ] || ( cd xenstore && \
+	  ln -sf $(XEN_ROOT)/tools/xenstore/*.c . && \
+	  ln -sf $(XEN_ROOT)/tools/xenstore/*.h . && \
+	  ln -sf $(XEN_ROOT)/tools/xenstore/Makefile . )
 	$(CROSS_MAKE) -C $(MINI_OS) links
 	touch mk-headers-$(XEN_TARGET_ARCH)
 
@@ -334,6 +339,14 @@
 	mkdir -p grub-$(XEN_TARGET_ARCH)
 	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C $@ OBJ_DIR=$(CURDIR)/grub-$(XEN_TARGET_ARCH)
 
+##########
+# xenstore
+##########
+
+.PHONY: xenstore
+xenstore: $(CROSS_ROOT)
+	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C $@ xenstored.a CONFIG_STUBDOM=y
+
 ########
 # minios
 ########
@@ -355,12 +368,16 @@
 pv-grub: mini-os-$(XEN_TARGET_ARCH)-grub libxc grub
 	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/grub/minios.cfg" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/grub-$(XEN_TARGET_ARCH)/main.a
 
+.PHONY: xenstore-stubdom
+xenstore-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstore libxc xenstore
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstore-minios.cfg" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstore/xenstored.a
+
 #########
 # install
 #########
 
 ifeq ($(STUBDOM_SUPPORTED),1)
-install: genpath install-readme install-ioemu install-grub
+install: genpath install-readme install-ioemu install-grub install-xenstore
 else
 install: genpath
 endif
@@ -379,6 +396,10 @@
 	$(INSTALL_DIR) "$(DESTDIR)$(XENFIRMWAREDIR)"
 	$(INSTALL_DATA) mini-os-$(XEN_TARGET_ARCH)-grub/mini-os.gz "$(DESTDIR)$(XENFIRMWAREDIR)/pv-grub-$(XEN_TARGET_ARCH).gz"
 
+install-xenstore: xenstore-stubdom
+	$(INSTALL_DIR) "$(DESTDIR)/usr/lib/xen/boot"
+	$(INSTALL_PROG) mini-os-$(XEN_TARGET_ARCH)-xenstore/mini-os.gz "$(DESTDIR)/usr/lib/xen/boot/xenstore-stubdom.gz"
+
 #######
 # clean
 #######
@@ -390,12 +411,14 @@
 	rm -fr mini-os-$(XEN_TARGET_ARCH)-c
 	rm -fr mini-os-$(XEN_TARGET_ARCH)-caml
 	rm -fr mini-os-$(XEN_TARGET_ARCH)-grub
+	rm -fr mini-os-$(XEN_TARGET_ARCH)-xenstore
 	$(CROSS_MAKE) -C caml clean
 	$(CROSS_MAKE) -C c clean
 	rm -fr grub-$(XEN_TARGET_ARCH)
 	rm -f $(STUBDOMPATH)
 	[ ! -d libxc-$(XEN_TARGET_ARCH) ] || $(CROSS_MAKE) -C libxc-$(XEN_TARGET_ARCH) clean
 	-[ ! -d ioemu ] || $(CROSS_MAKE) -C ioemu clean
+	-[ ! -d xenstore ] || $(CROSS_MAKE) -C xenstore clean
 
 # clean the cross-compilation result
 .PHONY: crossclean
diff -r c442ebf5834d -r 095c3cbf7f6e stubdom/xenstore-minios.cfg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stubdom/xenstore-minios.cfg	Thu Feb 09 18:33:35 2012 +0000
@@ -0,0 +1,7 @@
+CONFIG_BLKFRONT=n
+CONFIG_NETFRONT=n
+CONFIG_FBFRONT=n
+CONFIG_KBDFRONT=n
+CONFIG_CONSFRONT=n
+CONFIG_XENBUS=n
+CONFIG_LWIP=n

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:30 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eP-0003mq-Hb; Sat, 11 Feb 2012 04:33:29 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eO-0003co-GV
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:28 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-174.messagelabs.com!1328934800!12861898!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18540 invoked from network); 11 Feb 2012 04:33:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eF-0006RI-V1
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eF-0001Eh-QC
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:19 +0000
Message-Id: <E1Rw4eF-0001Eh-QC@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] stubdom: enable xenstored build
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812415 0
# Node ID 095c3cbf7f6e894531c183600fee9ea06217d947
# Parent  c442ebf5834d7b1a08d40a99a2babd0517e02713
stubdom: enable xenstored build

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r c442ebf5834d -r 095c3cbf7f6e extras/mini-os/Makefile
--- a/extras/mini-os/Makefile	Thu Feb 09 18:33:35 2012 +0000
+++ b/extras/mini-os/Makefile	Thu Feb 09 18:33:35 2012 +0000
@@ -27,6 +27,7 @@
 CONFIG_KBDFRONT ?= y
 CONFIG_CONSFRONT ?= y
 CONFIG_XENBUS ?= y
+CONFIG_LWIP ?= $(lwip)
 
 # Export config items as compiler directives
 flags-$(CONFIG_START_NETWORK) += -DCONFIG_START_NETWORK
@@ -123,7 +124,7 @@
 arch_lib:
 	$(MAKE) --directory=$(TARGET_ARCH_DIR) OBJ_DIR=$(OBJ_DIR)/$(TARGET_ARCH_DIR) || exit 1;
 
-ifeq ($(lwip),y)
+ifeq ($(CONFIG_LWIP),y)
 # lwIP library
 LWC	:= $(shell find $(LWIPDIR)/ -type f -name '*.c')
 LWC	:= $(filter-out %6.c %ip6_addr.c %ethernetif.c, $(LWC))
diff -r c442ebf5834d -r 095c3cbf7f6e stubdom/Makefile
--- a/stubdom/Makefile	Thu Feb 09 18:33:35 2012 +0000
+++ b/stubdom/Makefile	Thu Feb 09 18:33:35 2012 +0000
@@ -74,14 +74,14 @@
 
 TARGET_LDFLAGS += -nostdlib -L$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib
 
-TARGETS=ioemu c caml grub
+TARGETS=ioemu c caml grub xenstore
 
 CROSS_MAKE := $(MAKE) DESTDIR=
 
 .PHONY: all
 all: build
 ifeq ($(STUBDOM_SUPPORTED),1)
-build: genpath ioemu-stubdom c-stubdom pv-grub
+build: genpath ioemu-stubdom c-stubdom pv-grub xenstore-stubdom
 else
 build: genpath
 endif
@@ -262,6 +262,11 @@
 	  ln -sf $(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/*.c . && \
 	  ln -sf $(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/*.h . && \
 	  ln -sf $(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/Makefile . )
+	mkdir -p xenstore
+	[ -h xenstore/Makefile ] || ( cd xenstore && \
+	  ln -sf $(XEN_ROOT)/tools/xenstore/*.c . && \
+	  ln -sf $(XEN_ROOT)/tools/xenstore/*.h . && \
+	  ln -sf $(XEN_ROOT)/tools/xenstore/Makefile . )
 	$(CROSS_MAKE) -C $(MINI_OS) links
 	touch mk-headers-$(XEN_TARGET_ARCH)
 
@@ -334,6 +339,14 @@
 	mkdir -p grub-$(XEN_TARGET_ARCH)
 	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C $@ OBJ_DIR=$(CURDIR)/grub-$(XEN_TARGET_ARCH)
 
+##########
+# xenstore
+##########
+
+.PHONY: xenstore
+xenstore: $(CROSS_ROOT)
+	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C $@ xenstored.a CONFIG_STUBDOM=y
+
 ########
 # minios
 ########
@@ -355,12 +368,16 @@
 pv-grub: mini-os-$(XEN_TARGET_ARCH)-grub libxc grub
 	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/grub/minios.cfg" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/grub-$(XEN_TARGET_ARCH)/main.a
 
+.PHONY: xenstore-stubdom
+xenstore-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstore libxc xenstore
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstore-minios.cfg" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstore/xenstored.a
+
 #########
 # install
 #########
 
 ifeq ($(STUBDOM_SUPPORTED),1)
-install: genpath install-readme install-ioemu install-grub
+install: genpath install-readme install-ioemu install-grub install-xenstore
 else
 install: genpath
 endif
@@ -379,6 +396,10 @@
 	$(INSTALL_DIR) "$(DESTDIR)$(XENFIRMWAREDIR)"
 	$(INSTALL_DATA) mini-os-$(XEN_TARGET_ARCH)-grub/mini-os.gz "$(DESTDIR)$(XENFIRMWAREDIR)/pv-grub-$(XEN_TARGET_ARCH).gz"
 
+install-xenstore: xenstore-stubdom
+	$(INSTALL_DIR) "$(DESTDIR)/usr/lib/xen/boot"
+	$(INSTALL_PROG) mini-os-$(XEN_TARGET_ARCH)-xenstore/mini-os.gz "$(DESTDIR)/usr/lib/xen/boot/xenstore-stubdom.gz"
+
 #######
 # clean
 #######
@@ -390,12 +411,14 @@
 	rm -fr mini-os-$(XEN_TARGET_ARCH)-c
 	rm -fr mini-os-$(XEN_TARGET_ARCH)-caml
 	rm -fr mini-os-$(XEN_TARGET_ARCH)-grub
+	rm -fr mini-os-$(XEN_TARGET_ARCH)-xenstore
 	$(CROSS_MAKE) -C caml clean
 	$(CROSS_MAKE) -C c clean
 	rm -fr grub-$(XEN_TARGET_ARCH)
 	rm -f $(STUBDOMPATH)
 	[ ! -d libxc-$(XEN_TARGET_ARCH) ] || $(CROSS_MAKE) -C libxc-$(XEN_TARGET_ARCH) clean
 	-[ ! -d ioemu ] || $(CROSS_MAKE) -C ioemu clean
+	-[ ! -d xenstore ] || $(CROSS_MAKE) -C xenstore clean
 
 # clean the cross-compilation result
 .PHONY: crossclean
diff -r c442ebf5834d -r 095c3cbf7f6e stubdom/xenstore-minios.cfg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stubdom/xenstore-minios.cfg	Thu Feb 09 18:33:35 2012 +0000
@@ -0,0 +1,7 @@
+CONFIG_BLKFRONT=n
+CONFIG_NETFRONT=n
+CONFIG_FBFRONT=n
+CONFIG_KBDFRONT=n
+CONFIG_CONSFRONT=n
+CONFIG_XENBUS=n
+CONFIG_LWIP=n

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:32 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eS-0003qj-75; Sat, 11 Feb 2012 04:33:32 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eP-0003dl-5u
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:29 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-21.messagelabs.com!1328934801!10201357!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21416 invoked from network); 11 Feb 2012 04:33:22 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:22 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eG-0006RO-Tb
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eG-0001FT-S3
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:20 +0000
Message-Id: <E1Rw4eG-0001FT-S3@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstored: add --priv-domid parameter
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812416 0
# Node ID a298150d23a04346668324aebc0c47d5f939b3d7
# Parent  98f45814fbacaa844a204693529d806d4f9c7c05
xenstored: add --priv-domid parameter

This parameter identifies an alternative service domain which has
superuser access to the xenstore database, which is currently required
to set up a new domain's xenstore entries.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r 98f45814fbac -r a298150d23a0 tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:35 2012 +0000
+++ b/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:36 2012 +0000
@@ -1752,6 +1752,7 @@
 	{ "event", 1, NULL, 'e' },
 	{ "help", 0, NULL, 'H' },
 	{ "no-fork", 0, NULL, 'N' },
+	{ "priv-domid", 1, NULL, 'p' },
 	{ "output-pid", 0, NULL, 'P' },
 	{ "entry-size", 1, NULL, 'S' },
 	{ "trace-file", 1, NULL, 'T' },
@@ -1765,6 +1766,7 @@
 
 extern void dump_conn(struct connection *conn); 
 int dom0_event = 0;
+int priv_domid = 0;
 
 int main(int argc, char *argv[])
 {
@@ -1825,6 +1827,9 @@
 		case 'e':
 			dom0_event = strtol(optarg, NULL, 10);
 			break;
+		case 'p':
+			priv_domid = strtol(optarg, NULL, 10);
+			break;
 		}
 	}
 	if (optind != argc)
diff -r 98f45814fbac -r a298150d23a0 tools/xenstore/xenstored_core.h
--- a/tools/xenstore/xenstored_core.h	Thu Feb 09 18:33:35 2012 +0000
+++ b/tools/xenstore/xenstored_core.h	Thu Feb 09 18:33:36 2012 +0000
@@ -169,6 +169,7 @@
 
 extern int event_fd;
 extern int dom0_event;
+extern int priv_domid;
 
 /* Map the kernel's xenstore page. */
 void *xenbus_map(void);
diff -r 98f45814fbac -r a298150d23a0 tools/xenstore/xenstored_domain.c
--- a/tools/xenstore/xenstored_domain.c	Thu Feb 09 18:33:35 2012 +0000
+++ b/tools/xenstore/xenstored_domain.c	Thu Feb 09 18:33:36 2012 +0000
@@ -259,7 +259,7 @@
 
 bool domain_is_unprivileged(struct connection *conn)
 {
-	return (conn && conn->domain && conn->domain->domid != 0);
+	return (conn && conn->domain && conn->domain->domid != 0 && conn->domain->domid != priv_domid);
 }
 
 bool domain_can_write(struct connection *conn)

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:32 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eS-0003qj-75; Sat, 11 Feb 2012 04:33:32 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eP-0003dl-5u
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:29 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-21.messagelabs.com!1328934801!10201357!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21416 invoked from network); 11 Feb 2012 04:33:22 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:22 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eG-0006RO-Tb
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eG-0001FT-S3
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:20 +0000
Message-Id: <E1Rw4eG-0001FT-S3@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstored: add --priv-domid parameter
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812416 0
# Node ID a298150d23a04346668324aebc0c47d5f939b3d7
# Parent  98f45814fbacaa844a204693529d806d4f9c7c05
xenstored: add --priv-domid parameter

This parameter identifies an alternative service domain which has
superuser access to the xenstore database, which is currently required
to set up a new domain's xenstore entries.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r 98f45814fbac -r a298150d23a0 tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:35 2012 +0000
+++ b/tools/xenstore/xenstored_core.c	Thu Feb 09 18:33:36 2012 +0000
@@ -1752,6 +1752,7 @@
 	{ "event", 1, NULL, 'e' },
 	{ "help", 0, NULL, 'H' },
 	{ "no-fork", 0, NULL, 'N' },
+	{ "priv-domid", 1, NULL, 'p' },
 	{ "output-pid", 0, NULL, 'P' },
 	{ "entry-size", 1, NULL, 'S' },
 	{ "trace-file", 1, NULL, 'T' },
@@ -1765,6 +1766,7 @@
 
 extern void dump_conn(struct connection *conn); 
 int dom0_event = 0;
+int priv_domid = 0;
 
 int main(int argc, char *argv[])
 {
@@ -1825,6 +1827,9 @@
 		case 'e':
 			dom0_event = strtol(optarg, NULL, 10);
 			break;
+		case 'p':
+			priv_domid = strtol(optarg, NULL, 10);
+			break;
 		}
 	}
 	if (optind != argc)
diff -r 98f45814fbac -r a298150d23a0 tools/xenstore/xenstored_core.h
--- a/tools/xenstore/xenstored_core.h	Thu Feb 09 18:33:35 2012 +0000
+++ b/tools/xenstore/xenstored_core.h	Thu Feb 09 18:33:36 2012 +0000
@@ -169,6 +169,7 @@
 
 extern int event_fd;
 extern int dom0_event;
+extern int priv_domid;
 
 /* Map the kernel's xenstore page. */
 void *xenbus_map(void);
diff -r 98f45814fbac -r a298150d23a0 tools/xenstore/xenstored_domain.c
--- a/tools/xenstore/xenstored_domain.c	Thu Feb 09 18:33:35 2012 +0000
+++ b/tools/xenstore/xenstored_domain.c	Thu Feb 09 18:33:36 2012 +0000
@@ -259,7 +259,7 @@
 
 bool domain_is_unprivileged(struct connection *conn)
 {
-	return (conn && conn->domain && conn->domain->domid != 0);
+	return (conn && conn->domain && conn->domain->domid != 0 && conn->domain->domid != priv_domid);
 }
 
 bool domain_can_write(struct connection *conn)

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:32 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eS-0003qy-Bs; Sat, 11 Feb 2012 04:33:32 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eQ-0003f9-3w
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:30 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1328934801!12714757!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23287 invoked from network); 11 Feb 2012 04:33:23 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eH-0006RR-E6
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eH-0001Fr-Cv
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:21 +0000
Message-Id: <E1Rw4eH-0001Fr-Cv@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstored: Add stub domain builder
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812416 0
# Node ID 28300f4562de59d4a857eb7aac6f2cf69813e6bf
# Parent  a298150d23a04346668324aebc0c47d5f939b3d7
xenstored: Add stub domain builder

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r a298150d23a0 -r 28300f4562de tools/include/xen-sys/Linux/xenbus_dev.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/include/xen-sys/Linux/xenbus_dev.h	Thu Feb 09 18:33:36 2012 +0000
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * evtchn.h
+ *
+ * Interface to /dev/xen/xenbus_backend.
+ *
+ * Copyright (c) 2011 Bastian Blank <waldi@debian.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef __LINUX_XEN_XENBUS_DEV_H__
+#define __LINUX_XEN_XENBUS_DEV_H__
+
+#include <linux/ioctl.h>
+
+#define IOCTL_XENBUS_BACKEND_EVTCHN			\
+	_IOC(_IOC_NONE, 'B', 0, 0)
+
+#define IOCTL_XENBUS_BACKEND_SETUP			\
+	_IOC(_IOC_NONE, 'B', 1, 0)
+
+#endif /* __LINUX_XEN_XENBUS_DEV_H__ */
diff -r a298150d23a0 -r 28300f4562de tools/xenstore/Makefile
--- a/tools/xenstore/Makefile	Thu Feb 09 18:33:36 2012 +0000
+++ b/tools/xenstore/Makefile	Thu Feb 09 18:33:36 2012 +0000
@@ -27,7 +27,7 @@
 xenstore xenstore-control: CFLAGS += -static
 endif
 
-ALL_TARGETS = libxenstore.so libxenstore.a clients xs_tdb_dump xenstored
+ALL_TARGETS = libxenstore.so libxenstore.a clients xs_tdb_dump xenstored init-xenstore-domain
 
 ifdef CONFIG_STUBDOM
 CFLAGS += -DNO_SOCKETS=1
@@ -50,7 +50,12 @@
 
 CFLAGS += -DHAVE_DTRACE=1
 endif
- 
+
+init-xenstore-domain.o: CFLAGS += $(CFLAGS_libxenguest)
+
+init-xenstore-domain: init-xenstore-domain.o $(LIBXENSTORE)
+	$(CC) $(LDFLAGS) $^ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) -o $@ $(APPEND_LDFLAGS)
+
 xenstored: $(XENSTORED_OBJS)
 	$(CC) $(LDFLAGS) $^ $(LDLIBS_libxenctrl) $(SOCKET_LIBS) -o $@ $(APPEND_LDFLAGS)
 
@@ -86,7 +91,7 @@
 clean:
 	rm -f *.a *.o *.opic *.so* xenstored_probes.h
 	rm -f xenstored xs_random xs_stress xs_crashme
-	rm -f xs_tdb_dump xenstore-control
+	rm -f xs_tdb_dump xenstore-control init-xenstore-domain
 	rm -f xenstore $(CLIENTS)
 	$(RM) $(DEPS)
 
diff -r a298150d23a0 -r 28300f4562de tools/xenstore/init-xenstore-domain.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/xenstore/init-xenstore-domain.c	Thu Feb 09 18:33:36 2012 +0000
@@ -0,0 +1,94 @@
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <xenctrl.h>
+#include <xc_dom.h>
+#include <xs.h>
+#include <xen/sys/xenbus_dev.h>
+
+static uint32_t domid = -1;
+
+static int build(xc_interface *xch, char** argv)
+{
+	char cmdline[512];
+	uint32_t ssid;
+	xen_domain_handle_t handle = { 0 };
+	int rv;
+	int xs_fd = open("/dev/xen/xenbus_backend", O_RDWR);
+	struct xc_dom_image *dom;
+	int maxmem = atoi(argv[2]);
+	int limit_kb = (maxmem + 1)*1024;
+
+	rv = xc_flask_context_to_sid(xch, argv[3], strlen(argv[3]), &ssid);
+	if (rv) return rv;
+	rv = xc_domain_create(xch, ssid, handle, 0, &domid);
+	if (rv) return rv;
+	rv = xc_domain_max_vcpus(xch, domid, 1);
+	if (rv) return rv;
+	rv = xc_domain_setmaxmem(xch, domid, limit_kb);
+	if (rv) return rv;
+	rv = xc_domain_set_memmap_limit(xch, domid, limit_kb);
+	if (rv) return rv;
+
+	rv = ioctl(xs_fd, IOCTL_XENBUS_BACKEND_SETUP, domid);
+	if (rv < 0) return rv;
+	snprintf(cmdline, 512, "--event %d --internal-db", rv);
+
+	dom = xc_dom_allocate(xch, cmdline, NULL);
+	rv = xc_dom_kernel_file(dom, argv[1]);
+	if (rv) return rv;
+	rv = xc_dom_boot_xen_init(dom, xch, domid);
+	if (rv) return rv;
+	rv = xc_dom_parse_image(dom);
+	if (rv) return rv;
+	rv = xc_dom_mem_init(dom, maxmem);
+	if (rv) return rv;
+	rv = xc_dom_boot_mem_init(dom);
+	if (rv) return rv;
+	rv = xc_dom_build_image(dom);
+	if (rv) return rv;
+	rv = xc_dom_boot_image(dom);
+	if (rv) return rv;
+
+	xc_dom_release(dom);
+
+	rv = xc_domain_set_virq_handler(xch, domid, VIRQ_DOM_EXC);
+	if (rv) return rv;
+	rv = xc_domain_unpause(xch, domid);
+	if (rv) return rv;
+
+	return 0;
+}
+
+int main(int argc, char** argv)
+{
+	xc_interface *xch;
+	struct xs_handle *xsh;
+	char buf[16];
+	int rv;
+
+	if (argc != 4) {
+		printf("Use: %s <xenstore-kernel> <memory_mb> <flask-label>\n", argv[0]);
+		return 2;
+	}
+
+	xch = xc_interface_open(NULL, NULL, 0);
+	if (!xch) return 1;
+
+	rv = build(xch, argv);
+
+	xc_interface_close(xch);
+
+	if (rv) return 1;
+
+	xsh = xs_open(0);
+	rv = snprintf(buf, 16, "%d", domid);
+	xs_write(xsh, XBT_NULL, "/tool/xenstored/domid", buf, rv);
+	xs_daemon_close(xsh);
+
+	return 0;
+}

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:32 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eS-0003qy-Bs; Sat, 11 Feb 2012 04:33:32 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eQ-0003f9-3w
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:30 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1328934801!12714757!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23287 invoked from network); 11 Feb 2012 04:33:23 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eH-0006RR-E6
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eH-0001Fr-Cv
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:21 +0000
Message-Id: <E1Rw4eH-0001Fr-Cv@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstored: Add stub domain builder
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328812416 0
# Node ID 28300f4562de59d4a857eb7aac6f2cf69813e6bf
# Parent  a298150d23a04346668324aebc0c47d5f939b3d7
xenstored: Add stub domain builder

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---


diff -r a298150d23a0 -r 28300f4562de tools/include/xen-sys/Linux/xenbus_dev.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/include/xen-sys/Linux/xenbus_dev.h	Thu Feb 09 18:33:36 2012 +0000
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * evtchn.h
+ *
+ * Interface to /dev/xen/xenbus_backend.
+ *
+ * Copyright (c) 2011 Bastian Blank <waldi@debian.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef __LINUX_XEN_XENBUS_DEV_H__
+#define __LINUX_XEN_XENBUS_DEV_H__
+
+#include <linux/ioctl.h>
+
+#define IOCTL_XENBUS_BACKEND_EVTCHN			\
+	_IOC(_IOC_NONE, 'B', 0, 0)
+
+#define IOCTL_XENBUS_BACKEND_SETUP			\
+	_IOC(_IOC_NONE, 'B', 1, 0)
+
+#endif /* __LINUX_XEN_XENBUS_DEV_H__ */
diff -r a298150d23a0 -r 28300f4562de tools/xenstore/Makefile
--- a/tools/xenstore/Makefile	Thu Feb 09 18:33:36 2012 +0000
+++ b/tools/xenstore/Makefile	Thu Feb 09 18:33:36 2012 +0000
@@ -27,7 +27,7 @@
 xenstore xenstore-control: CFLAGS += -static
 endif
 
-ALL_TARGETS = libxenstore.so libxenstore.a clients xs_tdb_dump xenstored
+ALL_TARGETS = libxenstore.so libxenstore.a clients xs_tdb_dump xenstored init-xenstore-domain
 
 ifdef CONFIG_STUBDOM
 CFLAGS += -DNO_SOCKETS=1
@@ -50,7 +50,12 @@
 
 CFLAGS += -DHAVE_DTRACE=1
 endif
- 
+
+init-xenstore-domain.o: CFLAGS += $(CFLAGS_libxenguest)
+
+init-xenstore-domain: init-xenstore-domain.o $(LIBXENSTORE)
+	$(CC) $(LDFLAGS) $^ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) -o $@ $(APPEND_LDFLAGS)
+
 xenstored: $(XENSTORED_OBJS)
 	$(CC) $(LDFLAGS) $^ $(LDLIBS_libxenctrl) $(SOCKET_LIBS) -o $@ $(APPEND_LDFLAGS)
 
@@ -86,7 +91,7 @@
 clean:
 	rm -f *.a *.o *.opic *.so* xenstored_probes.h
 	rm -f xenstored xs_random xs_stress xs_crashme
-	rm -f xs_tdb_dump xenstore-control
+	rm -f xs_tdb_dump xenstore-control init-xenstore-domain
 	rm -f xenstore $(CLIENTS)
 	$(RM) $(DEPS)
 
diff -r a298150d23a0 -r 28300f4562de tools/xenstore/init-xenstore-domain.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/xenstore/init-xenstore-domain.c	Thu Feb 09 18:33:36 2012 +0000
@@ -0,0 +1,94 @@
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <xenctrl.h>
+#include <xc_dom.h>
+#include <xs.h>
+#include <xen/sys/xenbus_dev.h>
+
+static uint32_t domid = -1;
+
+static int build(xc_interface *xch, char** argv)
+{
+	char cmdline[512];
+	uint32_t ssid;
+	xen_domain_handle_t handle = { 0 };
+	int rv;
+	int xs_fd = open("/dev/xen/xenbus_backend", O_RDWR);
+	struct xc_dom_image *dom;
+	int maxmem = atoi(argv[2]);
+	int limit_kb = (maxmem + 1)*1024;
+
+	rv = xc_flask_context_to_sid(xch, argv[3], strlen(argv[3]), &ssid);
+	if (rv) return rv;
+	rv = xc_domain_create(xch, ssid, handle, 0, &domid);
+	if (rv) return rv;
+	rv = xc_domain_max_vcpus(xch, domid, 1);
+	if (rv) return rv;
+	rv = xc_domain_setmaxmem(xch, domid, limit_kb);
+	if (rv) return rv;
+	rv = xc_domain_set_memmap_limit(xch, domid, limit_kb);
+	if (rv) return rv;
+
+	rv = ioctl(xs_fd, IOCTL_XENBUS_BACKEND_SETUP, domid);
+	if (rv < 0) return rv;
+	snprintf(cmdline, 512, "--event %d --internal-db", rv);
+
+	dom = xc_dom_allocate(xch, cmdline, NULL);
+	rv = xc_dom_kernel_file(dom, argv[1]);
+	if (rv) return rv;
+	rv = xc_dom_boot_xen_init(dom, xch, domid);
+	if (rv) return rv;
+	rv = xc_dom_parse_image(dom);
+	if (rv) return rv;
+	rv = xc_dom_mem_init(dom, maxmem);
+	if (rv) return rv;
+	rv = xc_dom_boot_mem_init(dom);
+	if (rv) return rv;
+	rv = xc_dom_build_image(dom);
+	if (rv) return rv;
+	rv = xc_dom_boot_image(dom);
+	if (rv) return rv;
+
+	xc_dom_release(dom);
+
+	rv = xc_domain_set_virq_handler(xch, domid, VIRQ_DOM_EXC);
+	if (rv) return rv;
+	rv = xc_domain_unpause(xch, domid);
+	if (rv) return rv;
+
+	return 0;
+}
+
+int main(int argc, char** argv)
+{
+	xc_interface *xch;
+	struct xs_handle *xsh;
+	char buf[16];
+	int rv;
+
+	if (argc != 4) {
+		printf("Use: %s <xenstore-kernel> <memory_mb> <flask-label>\n", argv[0]);
+		return 2;
+	}
+
+	xch = xc_interface_open(NULL, NULL, 0);
+	if (!xch) return 1;
+
+	rv = build(xch, argv);
+
+	xc_interface_close(xch);
+
+	if (rv) return 1;
+
+	xsh = xs_open(0);
+	rv = snprintf(buf, 16, "%d", domid);
+	xs_write(xsh, XBT_NULL, "/tool/xenstored/domid", buf, rv);
+	xs_daemon_close(xsh);
+
+	return 0;
+}

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:32 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eS-0003r9-FT; Sat, 11 Feb 2012 04:33:32 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eP-0003iI-Lo
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:30 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1328934740!60651296!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18530 invoked from network); 11 Feb 2012 04:32:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eJ-0006Rd-Id
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eJ-0001Hx-HH
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:23 +0000
Message-Id: <E1Rw4eJ-0001Hx-HH@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:23 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Clean up locking now that
	p2m lockups are fully synchronized
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328890027 0
# Node ID a55ea8dc9c2566eabd19211c7debe575b63be0e3
# Parent  7f79475d3de7fc1a10be590ad0c3e9f631b6ca88
x86/mm: Clean up locking now that p2m lockups are fully synchronized

With p2m lookups fully synchronized, many routines need not
call p2m_lock any longer. Also, many routines can logically
assert holding the p2m for a specific gfn.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 7f79475d3de7 -r a55ea8dc9c25 xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/mem_sharing.c	Fri Feb 10 16:07:07 2012 +0000
@@ -877,9 +877,7 @@
         goto err_unlock;
     }
 
-    p2m_lock(p2m);
     ret = set_p2m_entry(p2m, cgfn, smfn, PAGE_ORDER_4K, p2m_ram_shared, a);
-    p2m_unlock(p2m);
 
     /* Tempted to turn this into an assert */
     if ( !ret )
diff -r 7f79475d3de7 -r a55ea8dc9c25 xen/arch/x86/mm/mm-locks.h
--- a/xen/arch/x86/mm/mm-locks.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/mm-locks.h	Fri Feb 10 16:07:07 2012 +0000
@@ -165,9 +165,11 @@
 
 declare_mm_lock(p2m)
 #define p2m_lock(p)           mm_lock_recursive(p2m, &(p)->lock)
-#define p2m_lock_recursive(p) mm_lock_recursive(p2m, &(p)->lock)
+#define gfn_lock(p,g,o)       mm_lock_recursive(p2m, &(p)->lock)
 #define p2m_unlock(p)         mm_unlock(&(p)->lock)
+#define gfn_unlock(p,g,o)     mm_unlock(&(p)->lock)
 #define p2m_locked_by_me(p)   mm_locked_by_me(&(p)->lock)
+#define gfn_locked_by_me(p,g) mm_locked_by_me(&(p)->lock)
 
 /* Sharing per page lock
  *
diff -r 7f79475d3de7 -r a55ea8dc9c25 xen/arch/x86/mm/p2m-ept.c
--- a/xen/arch/x86/mm/p2m-ept.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/p2m-ept.c	Fri Feb 10 16:07:07 2012 +0000
@@ -46,31 +46,6 @@
     return (e->epte != 0 && e->sa_p2mt != p2m_invalid);
 }
 
-/* Non-ept "lock-and-check" wrapper */
-static int ept_pod_check_and_populate(struct p2m_domain *p2m, unsigned long gfn,
-                                      ept_entry_t *entry, int order,
-                                      p2m_query_t q)
-{
-    int r;
-
-    /* This is called from the p2m lookups, which can happen with or 
-     * without the lock hed. */
-    p2m_lock_recursive(p2m);
-
-    /* Check to make sure this is still PoD */
-    if ( entry->sa_p2mt != p2m_populate_on_demand )
-    {
-        p2m_unlock(p2m);
-        return 0;
-    }
-
-    r = p2m_pod_demand_populate(p2m, gfn, order, q);
-
-    p2m_unlock(p2m);
-
-    return r;
-}
-
 static void ept_p2m_type_to_flags(ept_entry_t *entry, p2m_type_t type, p2m_access_t access)
 {
     /* First apply type permissions */
@@ -551,8 +526,8 @@
             index = gfn_remainder >> ( i * EPT_TABLE_ORDER);
             ept_entry = table + index;
 
-            if ( !ept_pod_check_and_populate(p2m, gfn,
-                                             ept_entry, 9, q) )
+            if ( !p2m_pod_demand_populate(p2m, gfn, 
+                                            PAGE_ORDER_2M, q) )
                 goto retry;
             else
                 goto out;
@@ -574,8 +549,8 @@
 
         ASSERT(i == 0);
         
-        if ( ept_pod_check_and_populate(p2m, gfn,
-                                        ept_entry, 0, q) )
+        if ( p2m_pod_demand_populate(p2m, gfn, 
+                                        PAGE_ORDER_4K, q) )
             goto out;
     }
 
diff -r 7f79475d3de7 -r a55ea8dc9c25 xen/arch/x86/mm/p2m-pod.c
--- a/xen/arch/x86/mm/p2m-pod.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/p2m-pod.c	Fri Feb 10 16:07:07 2012 +0000
@@ -521,7 +521,7 @@
     /* Figure out if we need to steal some freed memory for our cache */
     steal_for_cache =  ( p2m->pod.entry_count > p2m->pod.count );
 
-    p2m_lock(p2m);
+    gfn_lock(p2m, gpfn, order);
 
     if ( unlikely(d->is_dying) )
         goto out_unlock;
@@ -615,7 +615,7 @@
     }
 
 out_unlock:
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gpfn, order);
 
 out:
     return ret;
@@ -964,7 +964,7 @@
     mfn_t mfn;
     int i;
 
-    ASSERT(p2m_locked_by_me(p2m));
+    ASSERT(gfn_locked_by_me(p2m, gfn));
 
     /* This check is done with the p2m lock held.  This will make sure that
      * even if d->is_dying changes under our feet, p2m_pod_empty_cache() 
@@ -972,6 +972,7 @@
     if ( unlikely(d->is_dying) )
         goto out_fail;
 
+    
     /* Because PoD does not have cache list for 1GB pages, it has to remap
      * 1GB region to 2MB chunks for a retry. */
     if ( order == PAGE_ORDER_1G )
@@ -981,6 +982,9 @@
          * split 1GB into 512 2MB pages here. But We only do once here because
          * set_p2m_entry() should automatically shatter the 1GB page into 
          * 512 2MB pages. The rest of 511 calls are unnecessary.
+         *
+         * NOTE: In a fine-grained p2m locking scenario this operation
+         * may need to promote its locking from gfn->1g superpage
          */
         set_p2m_entry(p2m, gfn_aligned, _mfn(0), PAGE_ORDER_2M,
                       p2m_populate_on_demand, p2m->default_access);
@@ -1104,7 +1108,7 @@
     if ( rc != 0 )
         return rc;
 
-    p2m_lock(p2m);
+    gfn_lock(p2m, gfn, order);
 
     P2M_DEBUG("mark pod gfn=%#lx\n", gfn);
 
@@ -1138,7 +1142,7 @@
         BUG_ON(p2m->pod.entry_count < 0);
     }
 
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, order);
 
 out:
     return rc;
diff -r 7f79475d3de7 -r a55ea8dc9c25 xen/arch/x86/mm/p2m-pt.c
--- a/xen/arch/x86/mm/p2m-pt.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/p2m-pt.c	Fri Feb 10 16:07:07 2012 +0000
@@ -473,31 +473,6 @@
 }
 
 
-/* Non-ept "lock-and-check" wrapper */
-static int p2m_pod_check_and_populate(struct p2m_domain *p2m, unsigned long gfn,
-                                      l1_pgentry_t *p2m_entry, int order,
-                                      p2m_query_t q)
-{
-    int r;
-
-    /* This is called from the p2m lookups, which can happen with or 
-     * without the lock hed. */
-    p2m_lock_recursive(p2m);
-
-    /* Check to make sure this is still PoD */
-    if ( p2m_flags_to_type(l1e_get_flags(*p2m_entry)) != p2m_populate_on_demand )
-    {
-        p2m_unlock(p2m);
-        return 0;
-    }
-
-    r = p2m_pod_demand_populate(p2m, gfn, order, q);
-
-    p2m_unlock(p2m);
-
-    return r;
-}
-
 /* Read the current domain's p2m table (through the linear mapping). */
 static mfn_t p2m_gfn_to_mfn_current(struct p2m_domain *p2m, 
                                     unsigned long gfn, p2m_type_t *t, 
@@ -540,8 +515,7 @@
             /* The read has succeeded, so we know that mapping exists */
             if ( q != p2m_query )
             {
-                if ( !p2m_pod_check_and_populate(p2m, gfn,
-                                      (l1_pgentry_t *) &l3e, PAGE_ORDER_1G, q) )
+                if ( !p2m_pod_demand_populate(p2m, gfn, PAGE_ORDER_1G, q) )
                     goto pod_retry_l3;
                 p2mt = p2m_invalid;
                 gdprintk(XENLOG_ERR, "%s: Allocate 1GB failed!\n", __func__);
@@ -593,8 +567,8 @@
              * exits at this point.  */
             if ( q != p2m_query )
             {
-                if ( !p2m_pod_check_and_populate(p2m, gfn,
-                                                 p2m_entry, 9, q) )
+                if ( !p2m_pod_demand_populate(p2m, gfn, 
+                                                PAGE_ORDER_2M, q) )
                     goto pod_retry_l2;
 
                 /* Allocate failed. */
@@ -651,8 +625,8 @@
              * exits at this point.  */
             if ( q != p2m_query )
             {
-                if ( !p2m_pod_check_and_populate(p2m, gfn,
-                                                 (l1_pgentry_t *)p2m_entry, 0, q) )
+                if ( !p2m_pod_demand_populate(p2m, gfn, 
+                                                PAGE_ORDER_4K, q) )
                     goto pod_retry_l1;
 
                 /* Allocate failed. */
@@ -742,8 +716,7 @@
             {
                 if ( q != p2m_query )
                 {
-                    if ( !p2m_pod_check_and_populate(p2m, gfn,
-                                      (l1_pgentry_t *) l3e, PAGE_ORDER_1G, q) )
+                    if ( !p2m_pod_demand_populate(p2m, gfn, PAGE_ORDER_1G, q) )
                         goto pod_retry_l3;
                     gdprintk(XENLOG_ERR, "%s: Allocate 1GB failed!\n", __func__);
                 }
@@ -781,8 +754,7 @@
         if ( p2m_flags_to_type(l2e_get_flags(*l2e)) == p2m_populate_on_demand )
         {
             if ( q != p2m_query ) {
-                if ( !p2m_pod_check_and_populate(p2m, gfn,
-                                                 (l1_pgentry_t *)l2e, PAGE_ORDER_2M, q) )
+                if ( !p2m_pod_demand_populate(p2m, gfn, PAGE_ORDER_2M, q) )
                     goto pod_retry_l2;
             } else
                 *t = p2m_populate_on_demand;
@@ -815,8 +787,7 @@
         if ( p2m_flags_to_type(l1e_get_flags(*l1e)) == p2m_populate_on_demand )
         {
             if ( q != p2m_query ) {
-                if ( !p2m_pod_check_and_populate(p2m, gfn,
-                                                 (l1_pgentry_t *)l1e, PAGE_ORDER_4K, q) )
+                if ( !p2m_pod_demand_populate(p2m, gfn, PAGE_ORDER_4K, q) )
                     goto pod_retry_l1;
             } else
                 *t = p2m_populate_on_demand;
diff -r 7f79475d3de7 -r a55ea8dc9c25 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Fri Feb 10 16:07:07 2012 +0000
@@ -161,7 +161,7 @@
     /* For now only perform locking on hap domains */
     if ( locked && (hap_enabled(p2m->domain)) )
         /* Grab the lock here, don't release until put_gfn */
-        p2m_lock(p2m);
+        gfn_lock(p2m, gfn, 0);
 
     mfn = p2m->get_entry(p2m, gfn, t, a, q, page_order);
 
@@ -194,9 +194,9 @@
         /* Nothing to do in this case */
         return;
 
-    ASSERT(p2m_locked_by_me(p2m));
+    ASSERT(gfn_locked_by_me(p2m, gfn));
 
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, 0);
 }
 
 int set_p2m_entry(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn, 
@@ -207,7 +207,7 @@
     unsigned int order;
     int rc = 1;
 
-    ASSERT(p2m_locked_by_me(p2m));
+    ASSERT(gfn_locked_by_me(p2m, gfn));
 
     while ( todo )
     {
@@ -429,6 +429,7 @@
         return;
     }
 
+    ASSERT(gfn_locked_by_me(p2m, gfn));
     P2M_DEBUG("removing gfn=%#lx mfn=%#lx\n", gfn, mfn);
 
     if ( mfn_valid(_mfn(mfn)) )
@@ -449,9 +450,9 @@
                           unsigned long mfn, unsigned int page_order)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
-    p2m_lock(p2m);
+    gfn_lock(p2m, gfn, page_order);
     p2m_remove_page(p2m, gfn, mfn, page_order);
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, page_order);
 }
 
 int
@@ -590,13 +591,13 @@
 
     BUG_ON(p2m_is_grant(ot) || p2m_is_grant(nt));
 
-    p2m_lock(p2m);
+    gfn_lock(p2m, gfn, 0);
 
     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);
 
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, 0);
 
     return pt;
 }
@@ -645,7 +646,7 @@
     if ( !paging_mode_translate(d) )
         return 0;
 
-    p2m_lock(p2m);
+    gfn_lock(p2m, gfn, 0);
     omfn = p2m->get_entry(p2m, gfn, &ot, &a, p2m_query, NULL);
     if ( p2m_is_grant(ot) )
     {
@@ -661,7 +662,7 @@
 
     P2M_DEBUG("set mmio %lx %lx\n", gfn, mfn_x(mfn));
     rc = set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2m_mmio_direct, p2m->default_access);
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, 0);
     if ( 0 == rc )
         gdprintk(XENLOG_ERR,
             "set_mmio_p2m_entry: set_p2m_entry failed! mfn=%08lx\n",
@@ -681,7 +682,7 @@
     if ( !paging_mode_translate(d) )
         return 0;
 
-    p2m_lock(p2m);
+    gfn_lock(p2m, gfn, 0);
     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. */
@@ -694,7 +695,7 @@
     rc = set_p2m_entry(p2m, gfn, _mfn(INVALID_MFN), PAGE_ORDER_4K, p2m_invalid, p2m->default_access);
 
 out:
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, 0);
 
     return rc;
 }
@@ -711,7 +712,7 @@
     if ( !paging_mode_translate(p2m->domain) )
         return 0;
 
-    p2m_lock(p2m);
+    gfn_lock(p2m, gfn, 0);
     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 */
@@ -723,7 +724,7 @@
 
     P2M_DEBUG("set shared %lx %lx\n", gfn, mfn_x(mfn));
     rc = set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2m_ram_shared, p2m->default_access);
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, 0);
     if ( 0 == rc )
         gdprintk(XENLOG_ERR,
             "set_shared_p2m_entry: set_p2m_entry failed! mfn=%08lx\n",
@@ -759,7 +760,7 @@
     mfn_t mfn;
     int ret = -EBUSY;
 
-    p2m_lock(p2m);
+    gfn_lock(p2m, gfn, 0);
 
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
 
@@ -789,7 +790,7 @@
     ret = 0;
 
  out:
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, 0);
     return ret;
 }
 
@@ -821,7 +822,7 @@
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     int ret = -EBUSY;
 
-    p2m_lock(p2m);
+    gfn_lock(p2m, gfn, 0);
 
     /* Get mfn */
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
@@ -865,7 +866,7 @@
     put_page(page);
 
  out:
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, 0);
     return ret;
 }
 
@@ -950,7 +951,7 @@
     req.type = MEM_EVENT_TYPE_PAGING;
 
     /* Fix p2m mapping */
-    p2m_lock(p2m);
+    gfn_lock(p2m, gfn, 0);
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
     /* Allow only nominated or evicted pages to enter page-in path */
     if ( p2mt == p2m_ram_paging_out || p2mt == p2m_ram_paged )
@@ -961,7 +962,7 @@
 
         set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2m_ram_paging_in, a);
     }
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, 0);
 
     /* Pause domain if request came from guest and gfn has paging type */
     if ( p2m_is_paging(p2mt) && v->domain == d )
@@ -1012,7 +1013,7 @@
              (!access_ok(user_ptr, PAGE_SIZE)) )
             return -EINVAL;
 
-    p2m_lock(p2m);
+    gfn_lock(p2m, gfn, 0);
 
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
 
@@ -1071,7 +1072,7 @@
     ret = 0;
 
  out:
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, 0);
     return ret;
 }
 
@@ -1106,7 +1107,7 @@
         /* Fix p2m entry if the page was not dropped */
         if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) )
         {
-            p2m_lock(p2m);
+            gfn_lock(p2m, rsp.gfn, 0);
             mfn = p2m->get_entry(p2m, rsp.gfn, &p2mt, &a, p2m_query, NULL);
             /* Allow only pages which were prepared properly, or pages which
              * were nominated but not evicted */
@@ -1117,7 +1118,7 @@
                                 p2m_ram_rw, a);
                 set_gpfn_from_mfn(mfn_x(mfn), rsp.gfn);
             }
-            p2m_unlock(p2m);
+            gfn_unlock(p2m, rsp.gfn, 0);
         }
         /* Unpause domain */
         if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
@@ -1138,13 +1139,13 @@
     p2m_access_t p2ma;
     
     /* First, handle rx2rw conversion automatically */
-    p2m_lock(p2m);
+    gfn_lock(p2m, gfn, 0);
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &p2ma, p2m_query, NULL);
 
     if ( access_w && p2ma == p2m_access_rx2rw ) 
     {
         p2m->set_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2mt, p2m_access_rw);
-        p2m_unlock(p2m);
+        gfn_unlock(p2m, gfn, 0);
         return 1;
     }
     else if ( p2ma == p2m_access_n2rwx )
@@ -1152,7 +1153,7 @@
         ASSERT(access_w || access_r || access_x);
         p2m->set_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2mt, p2m_access_rwx);
     }
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, 0);
 
     /* Otherwise, check if there is a memory event listener, and send the message along */
     if ( mem_event_claim_slot(d, &d->mem_event->access) == -ENOSYS )
@@ -1171,9 +1172,9 @@
             if ( p2ma != p2m_access_n2rwx )
             {
                 /* A listener is not required, so clear the access restrictions */
-                p2m_lock(p2m);
+                gfn_lock(p2m, gfn, 0);
                 p2m->set_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2mt, p2m_access_rwx);
-                p2m_unlock(p2m);
+                gfn_unlock(p2m, gfn, 0);
             }
             return 1;
         }
@@ -1304,7 +1305,10 @@
         return 0;
     }
 
+    gfn_lock(p2m, gfn, 0);
     mfn = p2m->get_entry(p2m, pfn, &t, &a, p2m_query, NULL);
+    gfn_unlock(p2m, gfn, 0);
+
     if ( mfn_x(mfn) == INVALID_MFN )
         return -ESRCH;
     

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:32 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eS-0003r9-FT; Sat, 11 Feb 2012 04:33:32 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eP-0003iI-Lo
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:30 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1328934740!60651296!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18530 invoked from network); 11 Feb 2012 04:32:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:32:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eJ-0006Rd-Id
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eJ-0001Hx-HH
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:23 +0000
Message-Id: <E1Rw4eJ-0001Hx-HH@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:23 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Clean up locking now that
	p2m lockups are fully synchronized
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328890027 0
# Node ID a55ea8dc9c2566eabd19211c7debe575b63be0e3
# Parent  7f79475d3de7fc1a10be590ad0c3e9f631b6ca88
x86/mm: Clean up locking now that p2m lockups are fully synchronized

With p2m lookups fully synchronized, many routines need not
call p2m_lock any longer. Also, many routines can logically
assert holding the p2m for a specific gfn.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 7f79475d3de7 -r a55ea8dc9c25 xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/mem_sharing.c	Fri Feb 10 16:07:07 2012 +0000
@@ -877,9 +877,7 @@
         goto err_unlock;
     }
 
-    p2m_lock(p2m);
     ret = set_p2m_entry(p2m, cgfn, smfn, PAGE_ORDER_4K, p2m_ram_shared, a);
-    p2m_unlock(p2m);
 
     /* Tempted to turn this into an assert */
     if ( !ret )
diff -r 7f79475d3de7 -r a55ea8dc9c25 xen/arch/x86/mm/mm-locks.h
--- a/xen/arch/x86/mm/mm-locks.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/mm-locks.h	Fri Feb 10 16:07:07 2012 +0000
@@ -165,9 +165,11 @@
 
 declare_mm_lock(p2m)
 #define p2m_lock(p)           mm_lock_recursive(p2m, &(p)->lock)
-#define p2m_lock_recursive(p) mm_lock_recursive(p2m, &(p)->lock)
+#define gfn_lock(p,g,o)       mm_lock_recursive(p2m, &(p)->lock)
 #define p2m_unlock(p)         mm_unlock(&(p)->lock)
+#define gfn_unlock(p,g,o)     mm_unlock(&(p)->lock)
 #define p2m_locked_by_me(p)   mm_locked_by_me(&(p)->lock)
+#define gfn_locked_by_me(p,g) mm_locked_by_me(&(p)->lock)
 
 /* Sharing per page lock
  *
diff -r 7f79475d3de7 -r a55ea8dc9c25 xen/arch/x86/mm/p2m-ept.c
--- a/xen/arch/x86/mm/p2m-ept.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/p2m-ept.c	Fri Feb 10 16:07:07 2012 +0000
@@ -46,31 +46,6 @@
     return (e->epte != 0 && e->sa_p2mt != p2m_invalid);
 }
 
-/* Non-ept "lock-and-check" wrapper */
-static int ept_pod_check_and_populate(struct p2m_domain *p2m, unsigned long gfn,
-                                      ept_entry_t *entry, int order,
-                                      p2m_query_t q)
-{
-    int r;
-
-    /* This is called from the p2m lookups, which can happen with or 
-     * without the lock hed. */
-    p2m_lock_recursive(p2m);
-
-    /* Check to make sure this is still PoD */
-    if ( entry->sa_p2mt != p2m_populate_on_demand )
-    {
-        p2m_unlock(p2m);
-        return 0;
-    }
-
-    r = p2m_pod_demand_populate(p2m, gfn, order, q);
-
-    p2m_unlock(p2m);
-
-    return r;
-}
-
 static void ept_p2m_type_to_flags(ept_entry_t *entry, p2m_type_t type, p2m_access_t access)
 {
     /* First apply type permissions */
@@ -551,8 +526,8 @@
             index = gfn_remainder >> ( i * EPT_TABLE_ORDER);
             ept_entry = table + index;
 
-            if ( !ept_pod_check_and_populate(p2m, gfn,
-                                             ept_entry, 9, q) )
+            if ( !p2m_pod_demand_populate(p2m, gfn, 
+                                            PAGE_ORDER_2M, q) )
                 goto retry;
             else
                 goto out;
@@ -574,8 +549,8 @@
 
         ASSERT(i == 0);
         
-        if ( ept_pod_check_and_populate(p2m, gfn,
-                                        ept_entry, 0, q) )
+        if ( p2m_pod_demand_populate(p2m, gfn, 
+                                        PAGE_ORDER_4K, q) )
             goto out;
     }
 
diff -r 7f79475d3de7 -r a55ea8dc9c25 xen/arch/x86/mm/p2m-pod.c
--- a/xen/arch/x86/mm/p2m-pod.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/p2m-pod.c	Fri Feb 10 16:07:07 2012 +0000
@@ -521,7 +521,7 @@
     /* Figure out if we need to steal some freed memory for our cache */
     steal_for_cache =  ( p2m->pod.entry_count > p2m->pod.count );
 
-    p2m_lock(p2m);
+    gfn_lock(p2m, gpfn, order);
 
     if ( unlikely(d->is_dying) )
         goto out_unlock;
@@ -615,7 +615,7 @@
     }
 
 out_unlock:
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gpfn, order);
 
 out:
     return ret;
@@ -964,7 +964,7 @@
     mfn_t mfn;
     int i;
 
-    ASSERT(p2m_locked_by_me(p2m));
+    ASSERT(gfn_locked_by_me(p2m, gfn));
 
     /* This check is done with the p2m lock held.  This will make sure that
      * even if d->is_dying changes under our feet, p2m_pod_empty_cache() 
@@ -972,6 +972,7 @@
     if ( unlikely(d->is_dying) )
         goto out_fail;
 
+    
     /* Because PoD does not have cache list for 1GB pages, it has to remap
      * 1GB region to 2MB chunks for a retry. */
     if ( order == PAGE_ORDER_1G )
@@ -981,6 +982,9 @@
          * split 1GB into 512 2MB pages here. But We only do once here because
          * set_p2m_entry() should automatically shatter the 1GB page into 
          * 512 2MB pages. The rest of 511 calls are unnecessary.
+         *
+         * NOTE: In a fine-grained p2m locking scenario this operation
+         * may need to promote its locking from gfn->1g superpage
          */
         set_p2m_entry(p2m, gfn_aligned, _mfn(0), PAGE_ORDER_2M,
                       p2m_populate_on_demand, p2m->default_access);
@@ -1104,7 +1108,7 @@
     if ( rc != 0 )
         return rc;
 
-    p2m_lock(p2m);
+    gfn_lock(p2m, gfn, order);
 
     P2M_DEBUG("mark pod gfn=%#lx\n", gfn);
 
@@ -1138,7 +1142,7 @@
         BUG_ON(p2m->pod.entry_count < 0);
     }
 
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, order);
 
 out:
     return rc;
diff -r 7f79475d3de7 -r a55ea8dc9c25 xen/arch/x86/mm/p2m-pt.c
--- a/xen/arch/x86/mm/p2m-pt.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/p2m-pt.c	Fri Feb 10 16:07:07 2012 +0000
@@ -473,31 +473,6 @@
 }
 
 
-/* Non-ept "lock-and-check" wrapper */
-static int p2m_pod_check_and_populate(struct p2m_domain *p2m, unsigned long gfn,
-                                      l1_pgentry_t *p2m_entry, int order,
-                                      p2m_query_t q)
-{
-    int r;
-
-    /* This is called from the p2m lookups, which can happen with or 
-     * without the lock hed. */
-    p2m_lock_recursive(p2m);
-
-    /* Check to make sure this is still PoD */
-    if ( p2m_flags_to_type(l1e_get_flags(*p2m_entry)) != p2m_populate_on_demand )
-    {
-        p2m_unlock(p2m);
-        return 0;
-    }
-
-    r = p2m_pod_demand_populate(p2m, gfn, order, q);
-
-    p2m_unlock(p2m);
-
-    return r;
-}
-
 /* Read the current domain's p2m table (through the linear mapping). */
 static mfn_t p2m_gfn_to_mfn_current(struct p2m_domain *p2m, 
                                     unsigned long gfn, p2m_type_t *t, 
@@ -540,8 +515,7 @@
             /* The read has succeeded, so we know that mapping exists */
             if ( q != p2m_query )
             {
-                if ( !p2m_pod_check_and_populate(p2m, gfn,
-                                      (l1_pgentry_t *) &l3e, PAGE_ORDER_1G, q) )
+                if ( !p2m_pod_demand_populate(p2m, gfn, PAGE_ORDER_1G, q) )
                     goto pod_retry_l3;
                 p2mt = p2m_invalid;
                 gdprintk(XENLOG_ERR, "%s: Allocate 1GB failed!\n", __func__);
@@ -593,8 +567,8 @@
              * exits at this point.  */
             if ( q != p2m_query )
             {
-                if ( !p2m_pod_check_and_populate(p2m, gfn,
-                                                 p2m_entry, 9, q) )
+                if ( !p2m_pod_demand_populate(p2m, gfn, 
+                                                PAGE_ORDER_2M, q) )
                     goto pod_retry_l2;
 
                 /* Allocate failed. */
@@ -651,8 +625,8 @@
              * exits at this point.  */
             if ( q != p2m_query )
             {
-                if ( !p2m_pod_check_and_populate(p2m, gfn,
-                                                 (l1_pgentry_t *)p2m_entry, 0, q) )
+                if ( !p2m_pod_demand_populate(p2m, gfn, 
+                                                PAGE_ORDER_4K, q) )
                     goto pod_retry_l1;
 
                 /* Allocate failed. */
@@ -742,8 +716,7 @@
             {
                 if ( q != p2m_query )
                 {
-                    if ( !p2m_pod_check_and_populate(p2m, gfn,
-                                      (l1_pgentry_t *) l3e, PAGE_ORDER_1G, q) )
+                    if ( !p2m_pod_demand_populate(p2m, gfn, PAGE_ORDER_1G, q) )
                         goto pod_retry_l3;
                     gdprintk(XENLOG_ERR, "%s: Allocate 1GB failed!\n", __func__);
                 }
@@ -781,8 +754,7 @@
         if ( p2m_flags_to_type(l2e_get_flags(*l2e)) == p2m_populate_on_demand )
         {
             if ( q != p2m_query ) {
-                if ( !p2m_pod_check_and_populate(p2m, gfn,
-                                                 (l1_pgentry_t *)l2e, PAGE_ORDER_2M, q) )
+                if ( !p2m_pod_demand_populate(p2m, gfn, PAGE_ORDER_2M, q) )
                     goto pod_retry_l2;
             } else
                 *t = p2m_populate_on_demand;
@@ -815,8 +787,7 @@
         if ( p2m_flags_to_type(l1e_get_flags(*l1e)) == p2m_populate_on_demand )
         {
             if ( q != p2m_query ) {
-                if ( !p2m_pod_check_and_populate(p2m, gfn,
-                                                 (l1_pgentry_t *)l1e, PAGE_ORDER_4K, q) )
+                if ( !p2m_pod_demand_populate(p2m, gfn, PAGE_ORDER_4K, q) )
                     goto pod_retry_l1;
             } else
                 *t = p2m_populate_on_demand;
diff -r 7f79475d3de7 -r a55ea8dc9c25 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Fri Feb 10 16:07:07 2012 +0000
@@ -161,7 +161,7 @@
     /* For now only perform locking on hap domains */
     if ( locked && (hap_enabled(p2m->domain)) )
         /* Grab the lock here, don't release until put_gfn */
-        p2m_lock(p2m);
+        gfn_lock(p2m, gfn, 0);
 
     mfn = p2m->get_entry(p2m, gfn, t, a, q, page_order);
 
@@ -194,9 +194,9 @@
         /* Nothing to do in this case */
         return;
 
-    ASSERT(p2m_locked_by_me(p2m));
+    ASSERT(gfn_locked_by_me(p2m, gfn));
 
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, 0);
 }
 
 int set_p2m_entry(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn, 
@@ -207,7 +207,7 @@
     unsigned int order;
     int rc = 1;
 
-    ASSERT(p2m_locked_by_me(p2m));
+    ASSERT(gfn_locked_by_me(p2m, gfn));
 
     while ( todo )
     {
@@ -429,6 +429,7 @@
         return;
     }
 
+    ASSERT(gfn_locked_by_me(p2m, gfn));
     P2M_DEBUG("removing gfn=%#lx mfn=%#lx\n", gfn, mfn);
 
     if ( mfn_valid(_mfn(mfn)) )
@@ -449,9 +450,9 @@
                           unsigned long mfn, unsigned int page_order)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
-    p2m_lock(p2m);
+    gfn_lock(p2m, gfn, page_order);
     p2m_remove_page(p2m, gfn, mfn, page_order);
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, page_order);
 }
 
 int
@@ -590,13 +591,13 @@
 
     BUG_ON(p2m_is_grant(ot) || p2m_is_grant(nt));
 
-    p2m_lock(p2m);
+    gfn_lock(p2m, gfn, 0);
 
     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);
 
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, 0);
 
     return pt;
 }
@@ -645,7 +646,7 @@
     if ( !paging_mode_translate(d) )
         return 0;
 
-    p2m_lock(p2m);
+    gfn_lock(p2m, gfn, 0);
     omfn = p2m->get_entry(p2m, gfn, &ot, &a, p2m_query, NULL);
     if ( p2m_is_grant(ot) )
     {
@@ -661,7 +662,7 @@
 
     P2M_DEBUG("set mmio %lx %lx\n", gfn, mfn_x(mfn));
     rc = set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2m_mmio_direct, p2m->default_access);
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, 0);
     if ( 0 == rc )
         gdprintk(XENLOG_ERR,
             "set_mmio_p2m_entry: set_p2m_entry failed! mfn=%08lx\n",
@@ -681,7 +682,7 @@
     if ( !paging_mode_translate(d) )
         return 0;
 
-    p2m_lock(p2m);
+    gfn_lock(p2m, gfn, 0);
     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. */
@@ -694,7 +695,7 @@
     rc = set_p2m_entry(p2m, gfn, _mfn(INVALID_MFN), PAGE_ORDER_4K, p2m_invalid, p2m->default_access);
 
 out:
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, 0);
 
     return rc;
 }
@@ -711,7 +712,7 @@
     if ( !paging_mode_translate(p2m->domain) )
         return 0;
 
-    p2m_lock(p2m);
+    gfn_lock(p2m, gfn, 0);
     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 */
@@ -723,7 +724,7 @@
 
     P2M_DEBUG("set shared %lx %lx\n", gfn, mfn_x(mfn));
     rc = set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2m_ram_shared, p2m->default_access);
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, 0);
     if ( 0 == rc )
         gdprintk(XENLOG_ERR,
             "set_shared_p2m_entry: set_p2m_entry failed! mfn=%08lx\n",
@@ -759,7 +760,7 @@
     mfn_t mfn;
     int ret = -EBUSY;
 
-    p2m_lock(p2m);
+    gfn_lock(p2m, gfn, 0);
 
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
 
@@ -789,7 +790,7 @@
     ret = 0;
 
  out:
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, 0);
     return ret;
 }
 
@@ -821,7 +822,7 @@
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     int ret = -EBUSY;
 
-    p2m_lock(p2m);
+    gfn_lock(p2m, gfn, 0);
 
     /* Get mfn */
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
@@ -865,7 +866,7 @@
     put_page(page);
 
  out:
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, 0);
     return ret;
 }
 
@@ -950,7 +951,7 @@
     req.type = MEM_EVENT_TYPE_PAGING;
 
     /* Fix p2m mapping */
-    p2m_lock(p2m);
+    gfn_lock(p2m, gfn, 0);
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
     /* Allow only nominated or evicted pages to enter page-in path */
     if ( p2mt == p2m_ram_paging_out || p2mt == p2m_ram_paged )
@@ -961,7 +962,7 @@
 
         set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2m_ram_paging_in, a);
     }
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, 0);
 
     /* Pause domain if request came from guest and gfn has paging type */
     if ( p2m_is_paging(p2mt) && v->domain == d )
@@ -1012,7 +1013,7 @@
              (!access_ok(user_ptr, PAGE_SIZE)) )
             return -EINVAL;
 
-    p2m_lock(p2m);
+    gfn_lock(p2m, gfn, 0);
 
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
 
@@ -1071,7 +1072,7 @@
     ret = 0;
 
  out:
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, 0);
     return ret;
 }
 
@@ -1106,7 +1107,7 @@
         /* Fix p2m entry if the page was not dropped */
         if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) )
         {
-            p2m_lock(p2m);
+            gfn_lock(p2m, rsp.gfn, 0);
             mfn = p2m->get_entry(p2m, rsp.gfn, &p2mt, &a, p2m_query, NULL);
             /* Allow only pages which were prepared properly, or pages which
              * were nominated but not evicted */
@@ -1117,7 +1118,7 @@
                                 p2m_ram_rw, a);
                 set_gpfn_from_mfn(mfn_x(mfn), rsp.gfn);
             }
-            p2m_unlock(p2m);
+            gfn_unlock(p2m, rsp.gfn, 0);
         }
         /* Unpause domain */
         if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
@@ -1138,13 +1139,13 @@
     p2m_access_t p2ma;
     
     /* First, handle rx2rw conversion automatically */
-    p2m_lock(p2m);
+    gfn_lock(p2m, gfn, 0);
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &p2ma, p2m_query, NULL);
 
     if ( access_w && p2ma == p2m_access_rx2rw ) 
     {
         p2m->set_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2mt, p2m_access_rw);
-        p2m_unlock(p2m);
+        gfn_unlock(p2m, gfn, 0);
         return 1;
     }
     else if ( p2ma == p2m_access_n2rwx )
@@ -1152,7 +1153,7 @@
         ASSERT(access_w || access_r || access_x);
         p2m->set_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2mt, p2m_access_rwx);
     }
-    p2m_unlock(p2m);
+    gfn_unlock(p2m, gfn, 0);
 
     /* Otherwise, check if there is a memory event listener, and send the message along */
     if ( mem_event_claim_slot(d, &d->mem_event->access) == -ENOSYS )
@@ -1171,9 +1172,9 @@
             if ( p2ma != p2m_access_n2rwx )
             {
                 /* A listener is not required, so clear the access restrictions */
-                p2m_lock(p2m);
+                gfn_lock(p2m, gfn, 0);
                 p2m->set_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2mt, p2m_access_rwx);
-                p2m_unlock(p2m);
+                gfn_unlock(p2m, gfn, 0);
             }
             return 1;
         }
@@ -1304,7 +1305,10 @@
         return 0;
     }
 
+    gfn_lock(p2m, gfn, 0);
     mfn = p2m->get_entry(p2m, pfn, &t, &a, p2m_query, NULL);
+    gfn_unlock(p2m, gfn, 0);
+
     if ( mfn_x(mfn) == INVALID_MFN )
         return -ESRCH;
     

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:34 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eT-0003tZ-VG; Sat, 11 Feb 2012 04:33:33 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eR-0003iM-Mg
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:32 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-21.messagelabs.com!1328934803!11432080!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12098 invoked from network); 11 Feb 2012 04:33:24 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eJ-0006Ra-0w
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eI-0001HY-Vu
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:22 +0000
Message-Id: <E1Rw4eI-0001HY-Vu@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:22 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Make p2m lookups fully
	synchronized wrt modifications
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328890027 0
# Node ID 7f79475d3de7fc1a10be590ad0c3e9f631b6ca88
# Parent  730f6ed72d70ae59b2ce93e343ebe500a41ee63a
x86/mm: Make p2m lookups fully synchronized wrt modifications

We achieve this by locking/unlocking the global p2m_lock in get/put_gfn.

The lock is always taken recursively, as there are many paths that
call get_gfn, and later, make another attempt at grabbing the p2m_lock.

The lock is not taken for shadow lookups. We believe there are no problems
remaining for synchronized p2m+shadow paging, but we are not enabling this
combination due to lack of testing. Unlocked shadow p2m access are tolerable as
long as shadows do not gain support for paging or sharing.

HAP (EPT) lookups and all modifications do take the lock.

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 730f6ed72d70 -r 7f79475d3de7 xen/arch/x86/mm/hap/hap.c
--- a/xen/arch/x86/mm/hap/hap.c	Thu Feb 09 18:47:53 2012 +0000
+++ b/xen/arch/x86/mm/hap/hap.c	Fri Feb 10 16:07:07 2012 +0000
@@ -786,7 +786,14 @@
 static void hap_update_paging_modes(struct vcpu *v)
 {
     struct domain *d = v->domain;
+    unsigned long cr3_gfn = v->arch.hvm_vcpu.guest_cr[3];
+    p2m_type_t t;
 
+    /* We hold onto the cr3 as it may be modified later, and
+     * we need to respect lock ordering. No need for 
+     * checks here as they are performed by vmx_load_pdptrs
+     * (the potential user of the cr3) */
+    (void)get_gfn(d, cr3_gfn, &t);
     paging_lock(d);
 
     v->arch.paging.mode = hap_paging_get_mode(v);
@@ -803,6 +810,7 @@
     hap_update_cr3(v, 0);
 
     paging_unlock(d);
+    put_gfn(d, cr3_gfn);
 }
 
 #if CONFIG_PAGING_LEVELS == 3
diff -r 730f6ed72d70 -r 7f79475d3de7 xen/arch/x86/mm/mm-locks.h
--- a/xen/arch/x86/mm/mm-locks.h	Thu Feb 09 18:47:53 2012 +0000
+++ b/xen/arch/x86/mm/mm-locks.h	Fri Feb 10 16:07:07 2012 +0000
@@ -144,6 +144,31 @@
  *                                                                      *
  ************************************************************************/
 
+declare_mm_lock(nestedp2m)
+#define nestedp2m_lock(d)   mm_lock(nestedp2m, &(d)->arch.nested_p2m_lock)
+#define nestedp2m_unlock(d) mm_unlock(&(d)->arch.nested_p2m_lock)
+
+/* P2M lock (per-p2m-table)
+ * 
+ * This protects all queries and updates to the p2m table. 
+ *
+ * A note about ordering:
+ *   The order established here is enforced on all mutations of a p2m.
+ *   For lookups, the order established here is enforced only for hap
+ *   domains (1. shadow domains present a few nasty inversions; 
+ *            2. shadow domains do not support paging and sharing, 
+ *               the main sources of dynamic p2m mutations)
+ * 
+ * The lock is recursive as it is common for a code path to look up a gfn
+ * and later mutate it.
+ */
+
+declare_mm_lock(p2m)
+#define p2m_lock(p)           mm_lock_recursive(p2m, &(p)->lock)
+#define p2m_lock_recursive(p) mm_lock_recursive(p2m, &(p)->lock)
+#define p2m_unlock(p)         mm_unlock(&(p)->lock)
+#define p2m_locked_by_me(p)   mm_locked_by_me(&(p)->lock)
+
 /* Sharing per page lock
  *
  * This is an external lock, not represented by an mm_lock_t. The memory
@@ -167,21 +192,6 @@
  * - setting the "cr3" field of any p2m table to a non-CR3_EADDR value. 
  *   (i.e. assigning a p2m table to be the shadow of that cr3 */
 
-declare_mm_lock(nestedp2m)
-#define nestedp2m_lock(d)   mm_lock(nestedp2m, &(d)->arch.nested_p2m_lock)
-#define nestedp2m_unlock(d) mm_unlock(&(d)->arch.nested_p2m_lock)
-
-/* P2M lock (per-p2m-table)
- * 
- * This protects all updates to the p2m table.  Updates are expected to
- * be safe against concurrent reads, which do *not* require the lock. */
-
-declare_mm_lock(p2m)
-#define p2m_lock(p)           mm_lock(p2m, &(p)->lock)
-#define p2m_lock_recursive(p) mm_lock_recursive(p2m, &(p)->lock)
-#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, 
diff -r 730f6ed72d70 -r 7f79475d3de7 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Thu Feb 09 18:47:53 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Fri Feb 10 16:07:07 2012 +0000
@@ -144,9 +144,9 @@
     p2m_unlock(p2m);
 }
 
-mfn_t get_gfn_type_access(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)
+                    unsigned int *page_order, bool_t locked)
 {
     mfn_t mfn;
 
@@ -158,6 +158,11 @@
         return _mfn(gfn);
     }
 
+    /* For now only perform locking on hap domains */
+    if ( locked && (hap_enabled(p2m->domain)) )
+        /* Grab the lock here, don't release until put_gfn */
+        p2m_lock(p2m);
+
     mfn = p2m->get_entry(p2m, gfn, t, a, q, page_order);
 
 #ifdef __x86_64__
@@ -182,6 +187,18 @@
     return mfn;
 }
 
+void __put_gfn(struct p2m_domain *p2m, unsigned long gfn)
+{
+    if ( !p2m || !paging_mode_translate(p2m->domain) 
+              || !hap_enabled(p2m->domain) )
+        /* Nothing to do in this case */
+        return;
+
+    ASSERT(p2m_locked_by_me(p2m));
+
+    p2m_unlock(p2m);
+}
+
 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 730f6ed72d70 -r 7f79475d3de7 xen/include/asm-x86/mm.h
--- a/xen/include/asm-x86/mm.h	Thu Feb 09 18:47:53 2012 +0000
+++ b/xen/include/asm-x86/mm.h	Fri Feb 10 16:07:07 2012 +0000
@@ -350,9 +350,9 @@
  * of (gfn,domain) tupples to a list of gfn's that the shared page is currently 
  * backing. Nesting may happen when sharing (and locking) two pages -- deadlock 
  * is avoided by locking pages in increasing order.
- * Memory sharing may take the p2m_lock within a page_lock/unlock
- * critical section. We enforce ordering between page_lock and p2m_lock using an
- * mm-locks.h construct. 
+ * All memory sharing code paths take the p2m lock of the affected gfn before
+ * taking the lock for the underlying page. We enforce ordering between page_lock 
+ * and p2m_lock using an mm-locks.h construct. 
  *
  * These two users (pte serialization and memory sharing) do not collide, since
  * sharing is only supported for hvm guests, which do not perform pv pte updates.
diff -r 730f6ed72d70 -r 7f79475d3de7 xen/include/asm-x86/p2m.h
--- a/xen/include/asm-x86/p2m.h	Thu Feb 09 18:47:53 2012 +0000
+++ b/xen/include/asm-x86/p2m.h	Fri Feb 10 16:07:07 2012 +0000
@@ -309,9 +309,14 @@
 
 #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. ****/
+/**** p2m query accessors. They lock p2m_lock, and thus serialize
+ * lookups wrt modifications. They _do not_ release the lock on exit.
+ * After calling any of the variants below, caller needs to use
+ * put_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, bool_t locked);
 
 /* Read a particular P2M table, mapping pages as we go.  Most callers
  * should _not_ call this directly; use the other get_gfn* functions
@@ -320,9 +325,8 @@
  * 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 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);
+#define get_gfn_type_access(p, g, t, a, q, o)   \
+        __get_gfn_type_access((p), (g), (t), (a), (q), (o), 1)
 
 /* General conversion function from gfn to mfn */
 static inline mfn_t get_gfn_type(struct domain *d,
@@ -353,21 +357,28 @@
     return INVALID_MFN;
 }
 
-/* This is a noop for now. */
-static inline void __put_gfn(struct p2m_domain *p2m, unsigned long gfn)
-{
-}
+/* Will release the p2m_lock for this gfn entry. */
+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)
+/* The intent of the "unlocked" accessor is to have the caller not worry about
+ * put_gfn. They apply to very specific situations: debug printk's, dumps 
+ * during a domain crash, or to peek at a p2m entry/type. Caller is not 
+ * holding the p2m entry exclusively during or after calling this. 
+ *
+ * Note that an unlocked accessor only makes sense for a "query" lookup.
+ * Any other type of query can cause a change in the p2m and may need to
+ * perform locking.
+ */
+static inline mfn_t get_gfn_query_unlocked(struct domain *d, 
+                                           unsigned long gfn, 
+                                           p2m_type_t *t)
+{
+    p2m_access_t a;
+    return __get_gfn_type_access(p2m_get_hostp2m(d), gfn, t, &a, 
+                                    p2m_query, NULL, 0);
+}
 
 /* General conversion function from mfn to gfn */
 static inline unsigned long mfn_to_gfn(struct domain *d, mfn_t mfn)

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:34 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eT-0003tZ-VG; Sat, 11 Feb 2012 04:33:33 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eR-0003iM-Mg
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:32 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-21.messagelabs.com!1328934803!11432080!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12098 invoked from network); 11 Feb 2012 04:33:24 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eJ-0006Ra-0w
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eI-0001HY-Vu
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:22 +0000
Message-Id: <E1Rw4eI-0001HY-Vu@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:22 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Make p2m lookups fully
	synchronized wrt modifications
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328890027 0
# Node ID 7f79475d3de7fc1a10be590ad0c3e9f631b6ca88
# Parent  730f6ed72d70ae59b2ce93e343ebe500a41ee63a
x86/mm: Make p2m lookups fully synchronized wrt modifications

We achieve this by locking/unlocking the global p2m_lock in get/put_gfn.

The lock is always taken recursively, as there are many paths that
call get_gfn, and later, make another attempt at grabbing the p2m_lock.

The lock is not taken for shadow lookups. We believe there are no problems
remaining for synchronized p2m+shadow paging, but we are not enabling this
combination due to lack of testing. Unlocked shadow p2m access are tolerable as
long as shadows do not gain support for paging or sharing.

HAP (EPT) lookups and all modifications do take the lock.

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 730f6ed72d70 -r 7f79475d3de7 xen/arch/x86/mm/hap/hap.c
--- a/xen/arch/x86/mm/hap/hap.c	Thu Feb 09 18:47:53 2012 +0000
+++ b/xen/arch/x86/mm/hap/hap.c	Fri Feb 10 16:07:07 2012 +0000
@@ -786,7 +786,14 @@
 static void hap_update_paging_modes(struct vcpu *v)
 {
     struct domain *d = v->domain;
+    unsigned long cr3_gfn = v->arch.hvm_vcpu.guest_cr[3];
+    p2m_type_t t;
 
+    /* We hold onto the cr3 as it may be modified later, and
+     * we need to respect lock ordering. No need for 
+     * checks here as they are performed by vmx_load_pdptrs
+     * (the potential user of the cr3) */
+    (void)get_gfn(d, cr3_gfn, &t);
     paging_lock(d);
 
     v->arch.paging.mode = hap_paging_get_mode(v);
@@ -803,6 +810,7 @@
     hap_update_cr3(v, 0);
 
     paging_unlock(d);
+    put_gfn(d, cr3_gfn);
 }
 
 #if CONFIG_PAGING_LEVELS == 3
diff -r 730f6ed72d70 -r 7f79475d3de7 xen/arch/x86/mm/mm-locks.h
--- a/xen/arch/x86/mm/mm-locks.h	Thu Feb 09 18:47:53 2012 +0000
+++ b/xen/arch/x86/mm/mm-locks.h	Fri Feb 10 16:07:07 2012 +0000
@@ -144,6 +144,31 @@
  *                                                                      *
  ************************************************************************/
 
+declare_mm_lock(nestedp2m)
+#define nestedp2m_lock(d)   mm_lock(nestedp2m, &(d)->arch.nested_p2m_lock)
+#define nestedp2m_unlock(d) mm_unlock(&(d)->arch.nested_p2m_lock)
+
+/* P2M lock (per-p2m-table)
+ * 
+ * This protects all queries and updates to the p2m table. 
+ *
+ * A note about ordering:
+ *   The order established here is enforced on all mutations of a p2m.
+ *   For lookups, the order established here is enforced only for hap
+ *   domains (1. shadow domains present a few nasty inversions; 
+ *            2. shadow domains do not support paging and sharing, 
+ *               the main sources of dynamic p2m mutations)
+ * 
+ * The lock is recursive as it is common for a code path to look up a gfn
+ * and later mutate it.
+ */
+
+declare_mm_lock(p2m)
+#define p2m_lock(p)           mm_lock_recursive(p2m, &(p)->lock)
+#define p2m_lock_recursive(p) mm_lock_recursive(p2m, &(p)->lock)
+#define p2m_unlock(p)         mm_unlock(&(p)->lock)
+#define p2m_locked_by_me(p)   mm_locked_by_me(&(p)->lock)
+
 /* Sharing per page lock
  *
  * This is an external lock, not represented by an mm_lock_t. The memory
@@ -167,21 +192,6 @@
  * - setting the "cr3" field of any p2m table to a non-CR3_EADDR value. 
  *   (i.e. assigning a p2m table to be the shadow of that cr3 */
 
-declare_mm_lock(nestedp2m)
-#define nestedp2m_lock(d)   mm_lock(nestedp2m, &(d)->arch.nested_p2m_lock)
-#define nestedp2m_unlock(d) mm_unlock(&(d)->arch.nested_p2m_lock)
-
-/* P2M lock (per-p2m-table)
- * 
- * This protects all updates to the p2m table.  Updates are expected to
- * be safe against concurrent reads, which do *not* require the lock. */
-
-declare_mm_lock(p2m)
-#define p2m_lock(p)           mm_lock(p2m, &(p)->lock)
-#define p2m_lock_recursive(p) mm_lock_recursive(p2m, &(p)->lock)
-#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, 
diff -r 730f6ed72d70 -r 7f79475d3de7 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Thu Feb 09 18:47:53 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Fri Feb 10 16:07:07 2012 +0000
@@ -144,9 +144,9 @@
     p2m_unlock(p2m);
 }
 
-mfn_t get_gfn_type_access(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)
+                    unsigned int *page_order, bool_t locked)
 {
     mfn_t mfn;
 
@@ -158,6 +158,11 @@
         return _mfn(gfn);
     }
 
+    /* For now only perform locking on hap domains */
+    if ( locked && (hap_enabled(p2m->domain)) )
+        /* Grab the lock here, don't release until put_gfn */
+        p2m_lock(p2m);
+
     mfn = p2m->get_entry(p2m, gfn, t, a, q, page_order);
 
 #ifdef __x86_64__
@@ -182,6 +187,18 @@
     return mfn;
 }
 
+void __put_gfn(struct p2m_domain *p2m, unsigned long gfn)
+{
+    if ( !p2m || !paging_mode_translate(p2m->domain) 
+              || !hap_enabled(p2m->domain) )
+        /* Nothing to do in this case */
+        return;
+
+    ASSERT(p2m_locked_by_me(p2m));
+
+    p2m_unlock(p2m);
+}
+
 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 730f6ed72d70 -r 7f79475d3de7 xen/include/asm-x86/mm.h
--- a/xen/include/asm-x86/mm.h	Thu Feb 09 18:47:53 2012 +0000
+++ b/xen/include/asm-x86/mm.h	Fri Feb 10 16:07:07 2012 +0000
@@ -350,9 +350,9 @@
  * of (gfn,domain) tupples to a list of gfn's that the shared page is currently 
  * backing. Nesting may happen when sharing (and locking) two pages -- deadlock 
  * is avoided by locking pages in increasing order.
- * Memory sharing may take the p2m_lock within a page_lock/unlock
- * critical section. We enforce ordering between page_lock and p2m_lock using an
- * mm-locks.h construct. 
+ * All memory sharing code paths take the p2m lock of the affected gfn before
+ * taking the lock for the underlying page. We enforce ordering between page_lock 
+ * and p2m_lock using an mm-locks.h construct. 
  *
  * These two users (pte serialization and memory sharing) do not collide, since
  * sharing is only supported for hvm guests, which do not perform pv pte updates.
diff -r 730f6ed72d70 -r 7f79475d3de7 xen/include/asm-x86/p2m.h
--- a/xen/include/asm-x86/p2m.h	Thu Feb 09 18:47:53 2012 +0000
+++ b/xen/include/asm-x86/p2m.h	Fri Feb 10 16:07:07 2012 +0000
@@ -309,9 +309,14 @@
 
 #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. ****/
+/**** p2m query accessors. They lock p2m_lock, and thus serialize
+ * lookups wrt modifications. They _do not_ release the lock on exit.
+ * After calling any of the variants below, caller needs to use
+ * put_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, bool_t locked);
 
 /* Read a particular P2M table, mapping pages as we go.  Most callers
  * should _not_ call this directly; use the other get_gfn* functions
@@ -320,9 +325,8 @@
  * 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 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);
+#define get_gfn_type_access(p, g, t, a, q, o)   \
+        __get_gfn_type_access((p), (g), (t), (a), (q), (o), 1)
 
 /* General conversion function from gfn to mfn */
 static inline mfn_t get_gfn_type(struct domain *d,
@@ -353,21 +357,28 @@
     return INVALID_MFN;
 }
 
-/* This is a noop for now. */
-static inline void __put_gfn(struct p2m_domain *p2m, unsigned long gfn)
-{
-}
+/* Will release the p2m_lock for this gfn entry. */
+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)
+/* The intent of the "unlocked" accessor is to have the caller not worry about
+ * put_gfn. They apply to very specific situations: debug printk's, dumps 
+ * during a domain crash, or to peek at a p2m entry/type. Caller is not 
+ * holding the p2m entry exclusively during or after calling this. 
+ *
+ * Note that an unlocked accessor only makes sense for a "query" lookup.
+ * Any other type of query can cause a change in the p2m and may need to
+ * perform locking.
+ */
+static inline mfn_t get_gfn_query_unlocked(struct domain *d, 
+                                           unsigned long gfn, 
+                                           p2m_type_t *t)
+{
+    p2m_access_t a;
+    return __get_gfn_type_access(p2m_get_hostp2m(d), gfn, t, &a, 
+                                    p2m_query, NULL, 0);
+}
 
 /* General conversion function from mfn to gfn */
 static inline unsigned long mfn_to_gfn(struct domain *d, mfn_t mfn)

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:36 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eW-0003wT-93; Sat, 11 Feb 2012 04:33:36 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eT-0003kv-Gr
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:33 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1328934805!12856085!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5114 invoked from network); 11 Feb 2012 04:33:26 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:26 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eL-0006Ru-85
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:25 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eL-0001JC-6b
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:25 +0000
Message-Id: <E1Rw4eL-0001JC-6b@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:24 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Revert changeset
	24582:f6c33cfe7333
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328890027 0
# Node ID c6adf6ef3afb22fb1fd265d76300e6e5a84e1d5f
# Parent  e0ddac877f420e51314a97fc9f9f7befb44dc5a1
x86/mm: Revert changeset 24582:f6c33cfe7333

With synchronized p2m lookups this is no longer needed, and we can lock the p2m
up-front.

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


diff -r e0ddac877f42 -r c6adf6ef3afb xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Fri Feb 10 16:07:07 2012 +0000
@@ -361,6 +361,8 @@
     if (p2m == NULL)
         return;
 
+    p2m_lock(p2m);
+
 #ifdef __x86_64__
     for ( gfn=0; gfn < p2m->max_mapped_pfn; gfn++ )
     {
@@ -374,8 +376,6 @@
     }
 #endif
 
-    p2m_lock(p2m);
-
     p2m->phys_table = pagetable_null();
 
     while ( (pg = page_list_remove_head(&p2m->pages)) )

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:36 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eW-0003wT-93; Sat, 11 Feb 2012 04:33:36 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eT-0003kv-Gr
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:33 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1328934805!12856085!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5114 invoked from network); 11 Feb 2012 04:33:26 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:26 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eL-0006Ru-85
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:25 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eL-0001JC-6b
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:25 +0000
Message-Id: <E1Rw4eL-0001JC-6b@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:24 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Revert changeset
	24582:f6c33cfe7333
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328890027 0
# Node ID c6adf6ef3afb22fb1fd265d76300e6e5a84e1d5f
# Parent  e0ddac877f420e51314a97fc9f9f7befb44dc5a1
x86/mm: Revert changeset 24582:f6c33cfe7333

With synchronized p2m lookups this is no longer needed, and we can lock the p2m
up-front.

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


diff -r e0ddac877f42 -r c6adf6ef3afb xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Fri Feb 10 16:07:07 2012 +0000
@@ -361,6 +361,8 @@
     if (p2m == NULL)
         return;
 
+    p2m_lock(p2m);
+
 #ifdef __x86_64__
     for ( gfn=0; gfn < p2m->max_mapped_pfn; gfn++ )
     {
@@ -374,8 +376,6 @@
     }
 #endif
 
-    p2m_lock(p2m);
-
     p2m->phys_table = pagetable_null();
 
     while ( (pg = page_list_remove_head(&p2m->pages)) )

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:36 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eW-0003wk-D8; Sat, 11 Feb 2012 04:33:36 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eT-0003ko-Gl
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:34 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1328934804!12894680!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11500 invoked from network); 11 Feb 2012 04:33:25 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:25 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eK-0006Rh-3u
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:24 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eK-0001IL-2d
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:24 +0000
Message-Id: <E1Rw4eK-0001IL-2d@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:23 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Rework locking in the PoD
	layer
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328890027 0
# Node ID 28edc2b31a9bc50bae915129dfbd315a73260a09
# Parent  a55ea8dc9c2566eabd19211c7debe575b63be0e3
x86/mm: Rework locking in the PoD layer

The PoD layer has a complex locking discipline. It relies on the
p2m being globally locked, and it also relies on the page alloc
lock to protect some of its data structures. Replace this all by an
explicit pod lock: per p2m, order enforced.

Three consequences:
    - Critical sections in the pod code protected by the page alloc
      lock are now reduced to modifications of the domain page list.
    - When the p2m lock becomes fine-grained, there are no
      assumptions broken in the PoD layer.
    - The locking is easier to understand.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r a55ea8dc9c25 -r 28edc2b31a9b xen/arch/x86/mm/mm-locks.h
--- a/xen/arch/x86/mm/mm-locks.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/mm-locks.h	Fri Feb 10 16:07:07 2012 +0000
@@ -194,6 +194,16 @@
  * - setting the "cr3" field of any p2m table to a non-CR3_EADDR value. 
  *   (i.e. assigning a p2m table to be the shadow of that cr3 */
 
+/* PoD lock (per-p2m-table)
+ * 
+ * Protects private PoD data structs: entry and cache
+ * counts, page lists, sweep parameters. */
+
+declare_mm_lock(pod)
+#define pod_lock(p)           mm_lock(pod, &(p)->pod.lock)
+#define pod_unlock(p)         mm_unlock(&(p)->pod.lock)
+#define pod_locked_by_me(p)   mm_locked_by_me(&(p)->pod.lock)
+
 /* Page alloc lock (per-domain)
  *
  * This is an external lock, not represented by an mm_lock_t. However, 
diff -r a55ea8dc9c25 -r 28edc2b31a9b xen/arch/x86/mm/p2m-pod.c
--- a/xen/arch/x86/mm/p2m-pod.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/p2m-pod.c	Fri Feb 10 16:07:07 2012 +0000
@@ -100,7 +100,7 @@
     }
 #endif
 
-    ASSERT(p2m_locked_by_me(p2m));
+    ASSERT(pod_locked_by_me(p2m));
 
     /*
      * Pages from domain_alloc and returned by the balloon driver aren't
@@ -114,15 +114,16 @@
         unmap_domain_page(b);
     }
 
+    /* First, take all pages off the domain list */
     lock_page_alloc(p2m);
-
-    /* First, take all pages off the domain list */
     for(i=0; i < 1 << order ; i++)
     {
         p = page + i;
         page_list_del(p, &d->page_list);
     }
 
+    unlock_page_alloc(p2m);
+
     /* Then add the first one to the appropriate populate-on-demand list */
     switch(order)
     {
@@ -138,25 +139,20 @@
         BUG();
     }
 
-    /* Ensure that the PoD cache has never been emptied.  
-     * This may cause "zombie domains" since the page will never be freed. */
-    BUG_ON( d->arch.relmem != RELMEM_not_started );
-
-    unlock_page_alloc(p2m);
-
     return 0;
 }
 
 /* Get a page of size order from the populate-on-demand cache.  Will break
  * down 2-meg pages into singleton pages automatically.  Returns null if
- * a superpage is requested and no superpages are available.  Must be called
- * with the d->page_lock held. */
+ * a superpage is requested and no superpages are available. */
 static struct page_info * p2m_pod_cache_get(struct p2m_domain *p2m,
                                             unsigned long order)
 {
     struct page_info *p = NULL;
     int i;
 
+    ASSERT(pod_locked_by_me(p2m));
+
     if ( order == PAGE_ORDER_2M && page_list_empty(&p2m->pod.super) )
     {
         return NULL;
@@ -185,7 +181,7 @@
     case PAGE_ORDER_2M:
         BUG_ON( page_list_empty(&p2m->pod.super) );
         p = page_list_remove_head(&p2m->pod.super);
-        p2m->pod.count -= 1 << order; /* Lock: page_alloc */
+        p2m->pod.count -= 1 << order;
         break;
     case PAGE_ORDER_4K:
         BUG_ON( page_list_empty(&p2m->pod.single) );
@@ -197,11 +193,13 @@
     }
 
     /* Put the pages back on the domain page_list */
+    lock_page_alloc(p2m);
     for ( i = 0 ; i < (1 << order); i++ )
     {
         BUG_ON(page_get_owner(p + i) != p2m->domain);
         page_list_add_tail(p + i, &p2m->domain->page_list);
     }
+    unlock_page_alloc(p2m);
 
     return p;
 }
@@ -213,6 +211,8 @@
     struct domain *d = p2m->domain;
     int ret = 0;
 
+    ASSERT(pod_locked_by_me(p2m));
+
     /* Increasing the target */
     while ( pod_target > p2m->pod.count )
     {
@@ -250,17 +250,13 @@
     }
 
     /* Decreasing the target */
-    /* We hold the p2m lock here, so we don't need to worry about
+    /* We hold the pod lock here, so we don't need to worry about
      * cache disappearing under our feet. */
     while ( pod_target < p2m->pod.count )
     {
         struct page_info * page;
         int order, i;
 
-        /* Grab the lock before checking that pod.super is empty, or the last
-         * entries may disappear before we grab the lock. */
-        lock_page_alloc(p2m);
-
         if ( (p2m->pod.count - pod_target) > SUPERPAGE_PAGES
              && !page_list_empty(&p2m->pod.super) )
             order = PAGE_ORDER_2M;
@@ -271,8 +267,6 @@
 
         ASSERT(page != NULL);
 
-        unlock_page_alloc(p2m);
-
         /* Then free them */
         for ( i = 0 ; i < (1 << order) ; i++ )
         {
@@ -348,7 +342,7 @@
     int ret = 0;
     unsigned long populated;
 
-    p2m_lock(p2m);
+    pod_lock(p2m);
 
     /* P == B: Nothing to do. */
     if ( p2m->pod.entry_count == 0 )
@@ -377,7 +371,7 @@
     ret = p2m_pod_set_cache_target(p2m, pod_target, 1/*preemptible*/);
 
 out:
-    p2m_unlock(p2m);
+    pod_unlock(p2m);
 
     return ret;
 }
@@ -390,7 +384,7 @@
 
     /* After this barrier no new PoD activities can happen. */
     BUG_ON(!d->is_dying);
-    spin_barrier(&p2m->lock.lock);
+    spin_barrier(&p2m->pod.lock.lock);
 
     lock_page_alloc(p2m);
 
@@ -431,7 +425,7 @@
     if ( !(d = page_get_owner(p)) || !(p2m = p2m_get_hostp2m(d)) )
         return 0;
 
-    lock_page_alloc(p2m);
+    pod_lock(p2m);
     bmfn = mfn_x(page_to_mfn(p));
     page_list_for_each_safe(q, tmp, &p2m->pod.super)
     {
@@ -462,12 +456,14 @@
         }
     }
 
-    unlock_page_alloc(p2m);
+    pod_unlock(p2m);
     return 0;
 
 pod_hit:
+    lock_page_alloc(p2m);
     page_list_add_tail(p, &d->arch.relmem_list);
     unlock_page_alloc(p2m);
+    pod_unlock(p2m);
     return 1;
 }
 
@@ -486,9 +482,9 @@
     if ( unlikely(!p) )
         return;
 
-    p2m_lock(p2m);
+    pod_lock(p2m);
     p2m_pod_cache_add(p2m, p, PAGE_ORDER_4K);
-    p2m_unlock(p2m);
+    pod_unlock(p2m);
     return;
 }
 
@@ -511,18 +507,18 @@
 
     int steal_for_cache = 0;
     int pod = 0, nonpod = 0, ram = 0;
-    
+
+    gfn_lock(p2m, gpfn, order);
+    pod_lock(p2m);    
 
     /* If we don't have any outstanding PoD entries, let things take their
      * course */
     if ( p2m->pod.entry_count == 0 )
-        goto out;
+        goto out_unlock;
 
     /* Figure out if we need to steal some freed memory for our cache */
     steal_for_cache =  ( p2m->pod.entry_count > p2m->pod.count );
 
-    gfn_lock(p2m, gpfn, order);
-
     if ( unlikely(d->is_dying) )
         goto out_unlock;
 
@@ -554,7 +550,7 @@
         /* All PoD: Mark the whole region invalid and tell caller
          * we're done. */
         set_p2m_entry(p2m, gpfn, _mfn(INVALID_MFN), order, p2m_invalid, p2m->default_access);
-        p2m->pod.entry_count-=(1<<order); /* Lock: p2m */
+        p2m->pod.entry_count-=(1<<order);
         BUG_ON(p2m->pod.entry_count < 0);
         ret = 1;
         goto out_entry_check;
@@ -578,7 +574,7 @@
         if ( t == p2m_populate_on_demand )
         {
             set_p2m_entry(p2m, gpfn + i, _mfn(INVALID_MFN), 0, p2m_invalid, p2m->default_access);
-            p2m->pod.entry_count--; /* Lock: p2m */
+            p2m->pod.entry_count--;
             BUG_ON(p2m->pod.entry_count < 0);
             pod--;
         }
@@ -615,9 +611,8 @@
     }
 
 out_unlock:
+    pod_unlock(p2m);
     gfn_unlock(p2m, gpfn, order);
-
-out:
     return ret;
 }
 
@@ -630,7 +625,8 @@
 
 
 /* Search for all-zero superpages to be reclaimed as superpages for the
- * PoD cache. Must be called w/ p2m lock held, page_alloc lock not held. */
+ * PoD cache. Must be called w/ pod lock held, must lock the superpage
+ * in the p2m */
 static int
 p2m_pod_zero_check_superpage(struct p2m_domain *p2m, unsigned long gfn)
 {
@@ -642,6 +638,8 @@
     int max_ref = 1;
     struct domain *d = p2m->domain;
 
+    ASSERT(pod_locked_by_me(p2m));
+
     if ( !superpage_aligned(gfn) )
         goto out;
 
@@ -649,6 +647,10 @@
     if ( paging_mode_shadow(d) )
         max_ref++;
 
+    /* NOTE: this is why we don't enforce deadlock constraints between p2m 
+     * and pod locks */
+    gfn_lock(p2m, gfn, SUPERPAGE_ORDER);
+
     /* Look up the mfns, checking to make sure they're the same mfn
      * and aligned, and mapping them. */
     for ( i=0; i<SUPERPAGE_PAGES; i++ )
@@ -761,6 +763,7 @@
         set_p2m_entry(p2m, gfn, mfn0, 9, type0, p2m->default_access);
     
 out:
+    gfn_unlock(p2m, gfn, SUPERPAGE_ORDER);
     return ret;
 }
 
@@ -922,6 +925,10 @@
     limit = (start > POD_SWEEP_LIMIT) ? (start - POD_SWEEP_LIMIT) : 0;
 
     /* FIXME: Figure out how to avoid superpages */
+    /* NOTE: Promote to globally locking the p2m. This will get complicated
+     * in a fine-grained scenario. If we lock each gfn individually we must be
+     * careful about spinlock recursion limits and POD_SWEEP_STRIDE. */
+    p2m_lock(p2m);
     for ( i=p2m->pod.reclaim_single; i > 0 ; i-- )
     {
         p2m_access_t a;
@@ -940,7 +947,7 @@
         /* Stop if we're past our limit and we have found *something*.
          *
          * NB that this is a zero-sum game; we're increasing our cache size
-         * by re-increasing our 'debt'.  Since we hold the p2m lock,
+         * by re-increasing our 'debt'.  Since we hold the pod lock,
          * (entry_count - count) must remain the same. */
         if ( p2m->pod.count > 0 && i < limit )
             break;
@@ -949,6 +956,7 @@
     if ( j )
         p2m_pod_zero_check(p2m, gfns, j);
 
+    p2m_unlock(p2m);
     p2m->pod.reclaim_single = i ? i - 1 : i;
 
 }
@@ -965,8 +973,9 @@
     int i;
 
     ASSERT(gfn_locked_by_me(p2m, gfn));
+    pod_lock(p2m);
 
-    /* This check is done with the p2m lock held.  This will make sure that
+    /* This check is done with the pod lock held.  This will make sure that
      * even if d->is_dying changes under our feet, p2m_pod_empty_cache() 
      * won't start until we're done. */
     if ( unlikely(d->is_dying) )
@@ -977,6 +986,7 @@
      * 1GB region to 2MB chunks for a retry. */
     if ( order == PAGE_ORDER_1G )
     {
+        pod_unlock(p2m);
         gfn_aligned = (gfn >> order) << order;
         /* Note that we are supposed to call set_p2m_entry() 512 times to 
          * split 1GB into 512 2MB pages here. But We only do once here because
@@ -1000,11 +1010,15 @@
 
         /* If we're low, start a sweep */
         if ( order == PAGE_ORDER_2M && page_list_empty(&p2m->pod.super) )
+            /* Note that sweeps scan other ranges in the p2m. In an scenario
+             * in which p2m locks are fine-grained, this may result in deadlock.
+             * Using trylock on the gfn's as we sweep would avoid it. */
             p2m_pod_emergency_sweep_super(p2m);
 
         if ( page_list_empty(&p2m->pod.single) &&
              ( ( order == PAGE_ORDER_4K )
                || (order == PAGE_ORDER_2M && page_list_empty(&p2m->pod.super) ) ) )
+            /* Same comment regarding deadlock applies */
             p2m_pod_emergency_sweep(p2m);
     }
 
@@ -1012,8 +1026,6 @@
     if ( q == p2m_guest && gfn > p2m->pod.max_guest )
         p2m->pod.max_guest = gfn;
 
-    lock_page_alloc(p2m);
-
     if ( p2m->pod.count == 0 )
         goto out_of_memory;
 
@@ -1026,8 +1038,6 @@
 
     BUG_ON((mfn_x(mfn) & ((1 << order)-1)) != 0);
 
-    unlock_page_alloc(p2m);
-
     gfn_aligned = (gfn >> order) << order;
 
     set_p2m_entry(p2m, gfn_aligned, mfn, order, p2m_ram_rw, p2m->default_access);
@@ -1038,7 +1048,7 @@
         paging_mark_dirty(d, mfn_x(mfn) + i);
     }
     
-    p2m->pod.entry_count -= (1 << order); /* Lock: p2m */
+    p2m->pod.entry_count -= (1 << order);
     BUG_ON(p2m->pod.entry_count < 0);
 
     if ( tb_init_done )
@@ -1056,20 +1066,24 @@
         __trace_var(TRC_MEM_POD_POPULATE, 0, sizeof(t), &t);
     }
 
+    pod_unlock(p2m);
     return 0;
 out_of_memory:
-    unlock_page_alloc(p2m);
+    pod_unlock(p2m);
 
     printk("%s: Out of populate-on-demand memory! tot_pages %" PRIu32 " pod_entries %" PRIi32 "\n",
            __func__, d->tot_pages, p2m->pod.entry_count);
     domain_crash(d);
 out_fail:
+    pod_unlock(p2m);
     return -1;
 remap_and_retry:
     BUG_ON(order != PAGE_ORDER_2M);
-    unlock_page_alloc(p2m);
+    pod_unlock(p2m);
 
     /* Remap this 2-meg region in singleton chunks */
+    /* NOTE: In a p2m fine-grained lock scenario this might
+     * need promoting the gfn lock from gfn->2M superpage */
     gfn_aligned = (gfn>>order)<<order;
     for(i=0; i<(1<<order); i++)
         set_p2m_entry(p2m, gfn_aligned+i, _mfn(0), PAGE_ORDER_4K,
@@ -1137,9 +1151,11 @@
         rc = -EINVAL;
     else
     {
-        p2m->pod.entry_count += 1 << order; /* Lock: p2m */
+        pod_lock(p2m);
+        p2m->pod.entry_count += 1 << order;
         p2m->pod.entry_count -= pod_count;
         BUG_ON(p2m->pod.entry_count < 0);
+        pod_unlock(p2m);
     }
 
     gfn_unlock(p2m, gfn, order);
diff -r a55ea8dc9c25 -r 28edc2b31a9b xen/arch/x86/mm/p2m-pt.c
--- a/xen/arch/x86/mm/p2m-pt.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/p2m-pt.c	Fri Feb 10 16:07:07 2012 +0000
@@ -954,6 +954,7 @@
     struct domain *d = p2m->domain;
 
     ASSERT(p2m_locked_by_me(p2m));
+    ASSERT(pod_locked_by_me(p2m));
 
     test_linear = ( (d == current->domain)
                     && !pagetable_is_null(current->arch.monitor_table) );
diff -r a55ea8dc9c25 -r 28edc2b31a9b xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Fri Feb 10 16:07:07 2012 +0000
@@ -72,6 +72,7 @@
 static void p2m_initialise(struct domain *d, struct p2m_domain *p2m)
 {
     mm_lock_init(&p2m->lock);
+    mm_lock_init(&p2m->pod.lock);
     INIT_LIST_HEAD(&p2m->np2m_list);
     INIT_PAGE_LIST_HEAD(&p2m->pages);
     INIT_PAGE_LIST_HEAD(&p2m->pod.super);
@@ -568,8 +569,10 @@
             rc = -EINVAL;
         else
         {
-            p2m->pod.entry_count -= pod_count; /* Lock: p2m */
+            pod_lock(p2m);
+            p2m->pod.entry_count -= pod_count;
             BUG_ON(p2m->pod.entry_count < 0);
+            pod_unlock(p2m);
         }
     }
 
@@ -1350,6 +1353,7 @@
     /* "Host" p2m tables can have shared entries &c that need a bit more 
      * care when discarding them */
     ASSERT(p2m_is_nestedp2m(p2m));
+    /* Nested p2m's do not do pod, hence the asserts (and no pod lock)*/
     ASSERT(page_list_empty(&p2m->pod.super));
     ASSERT(page_list_empty(&p2m->pod.single));
 
@@ -1507,6 +1511,7 @@
     P2M_PRINTK("p2m audit starts\n");
 
     p2m_lock(p2m);
+    pod_lock(p2m);
 
     if (p2m->audit_p2m)
         pmbad = p2m->audit_p2m(p2m);
@@ -1567,6 +1572,7 @@
     }
     spin_unlock(&d->page_alloc_lock);
 
+    pod_unlock(p2m);
     p2m_unlock(p2m);
  
     P2M_PRINTK("p2m audit complete\n");
diff -r a55ea8dc9c25 -r 28edc2b31a9b xen/include/asm-x86/p2m.h
--- a/xen/include/asm-x86/p2m.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/asm-x86/p2m.h	Fri Feb 10 16:07:07 2012 +0000
@@ -261,25 +261,12 @@
     unsigned long max_mapped_pfn;
 
     /* Populate-on-demand variables
-     * NB on locking.  {super,single,count} are
-     * covered by d->page_alloc_lock, since they're almost always used in
-     * conjunction with that functionality.  {entry_count} is covered by
-     * the domain p2m lock, since it's almost always used in conjunction
-     * with changing the p2m tables.
-     *
-     * At this point, both locks are held in two places.  In both,
-     * the order is [p2m,page_alloc]:
-     * + p2m_pod_decrease_reservation() calls p2m_pod_cache_add(),
-     *   which grabs page_alloc
-     * + 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.
-     */
+     * All variables are protected with the pod lock. We cannot rely on
+     * the p2m lock if it's turned into a fine-grained lock.
+     * We only use the domain page_alloc lock for additions and 
+     * deletions to the domain's page list. Because we use it nested
+     * within the PoD lock, we enforce it's ordering (by remembering
+     * the unlock level in the arch_domain sub struct). */
     struct {
         struct page_list_head super,   /* List of superpages                */
                          single;       /* Non-super lists                   */
@@ -288,6 +275,8 @@
         unsigned         reclaim_super; /* Last gpfn of a scan */
         unsigned         reclaim_single; /* Last gpfn of a scan */
         unsigned         max_guest;    /* gpfn of max guest demand-populate */
+        mm_lock_t        lock;         /* Locking of private pod structs,   *
+                                        * not relying on the p2m lock.      */
     } pod;
 };
 

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:36 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eW-0003wk-D8; Sat, 11 Feb 2012 04:33:36 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eT-0003ko-Gl
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:34 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1328934804!12894680!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11500 invoked from network); 11 Feb 2012 04:33:25 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:25 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eK-0006Rh-3u
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:24 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eK-0001IL-2d
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:24 +0000
Message-Id: <E1Rw4eK-0001IL-2d@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:23 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Rework locking in the PoD
	layer
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328890027 0
# Node ID 28edc2b31a9bc50bae915129dfbd315a73260a09
# Parent  a55ea8dc9c2566eabd19211c7debe575b63be0e3
x86/mm: Rework locking in the PoD layer

The PoD layer has a complex locking discipline. It relies on the
p2m being globally locked, and it also relies on the page alloc
lock to protect some of its data structures. Replace this all by an
explicit pod lock: per p2m, order enforced.

Three consequences:
    - Critical sections in the pod code protected by the page alloc
      lock are now reduced to modifications of the domain page list.
    - When the p2m lock becomes fine-grained, there are no
      assumptions broken in the PoD layer.
    - The locking is easier to understand.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r a55ea8dc9c25 -r 28edc2b31a9b xen/arch/x86/mm/mm-locks.h
--- a/xen/arch/x86/mm/mm-locks.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/mm-locks.h	Fri Feb 10 16:07:07 2012 +0000
@@ -194,6 +194,16 @@
  * - setting the "cr3" field of any p2m table to a non-CR3_EADDR value. 
  *   (i.e. assigning a p2m table to be the shadow of that cr3 */
 
+/* PoD lock (per-p2m-table)
+ * 
+ * Protects private PoD data structs: entry and cache
+ * counts, page lists, sweep parameters. */
+
+declare_mm_lock(pod)
+#define pod_lock(p)           mm_lock(pod, &(p)->pod.lock)
+#define pod_unlock(p)         mm_unlock(&(p)->pod.lock)
+#define pod_locked_by_me(p)   mm_locked_by_me(&(p)->pod.lock)
+
 /* Page alloc lock (per-domain)
  *
  * This is an external lock, not represented by an mm_lock_t. However, 
diff -r a55ea8dc9c25 -r 28edc2b31a9b xen/arch/x86/mm/p2m-pod.c
--- a/xen/arch/x86/mm/p2m-pod.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/p2m-pod.c	Fri Feb 10 16:07:07 2012 +0000
@@ -100,7 +100,7 @@
     }
 #endif
 
-    ASSERT(p2m_locked_by_me(p2m));
+    ASSERT(pod_locked_by_me(p2m));
 
     /*
      * Pages from domain_alloc and returned by the balloon driver aren't
@@ -114,15 +114,16 @@
         unmap_domain_page(b);
     }
 
+    /* First, take all pages off the domain list */
     lock_page_alloc(p2m);
-
-    /* First, take all pages off the domain list */
     for(i=0; i < 1 << order ; i++)
     {
         p = page + i;
         page_list_del(p, &d->page_list);
     }
 
+    unlock_page_alloc(p2m);
+
     /* Then add the first one to the appropriate populate-on-demand list */
     switch(order)
     {
@@ -138,25 +139,20 @@
         BUG();
     }
 
-    /* Ensure that the PoD cache has never been emptied.  
-     * This may cause "zombie domains" since the page will never be freed. */
-    BUG_ON( d->arch.relmem != RELMEM_not_started );
-
-    unlock_page_alloc(p2m);
-
     return 0;
 }
 
 /* Get a page of size order from the populate-on-demand cache.  Will break
  * down 2-meg pages into singleton pages automatically.  Returns null if
- * a superpage is requested and no superpages are available.  Must be called
- * with the d->page_lock held. */
+ * a superpage is requested and no superpages are available. */
 static struct page_info * p2m_pod_cache_get(struct p2m_domain *p2m,
                                             unsigned long order)
 {
     struct page_info *p = NULL;
     int i;
 
+    ASSERT(pod_locked_by_me(p2m));
+
     if ( order == PAGE_ORDER_2M && page_list_empty(&p2m->pod.super) )
     {
         return NULL;
@@ -185,7 +181,7 @@
     case PAGE_ORDER_2M:
         BUG_ON( page_list_empty(&p2m->pod.super) );
         p = page_list_remove_head(&p2m->pod.super);
-        p2m->pod.count -= 1 << order; /* Lock: page_alloc */
+        p2m->pod.count -= 1 << order;
         break;
     case PAGE_ORDER_4K:
         BUG_ON( page_list_empty(&p2m->pod.single) );
@@ -197,11 +193,13 @@
     }
 
     /* Put the pages back on the domain page_list */
+    lock_page_alloc(p2m);
     for ( i = 0 ; i < (1 << order); i++ )
     {
         BUG_ON(page_get_owner(p + i) != p2m->domain);
         page_list_add_tail(p + i, &p2m->domain->page_list);
     }
+    unlock_page_alloc(p2m);
 
     return p;
 }
@@ -213,6 +211,8 @@
     struct domain *d = p2m->domain;
     int ret = 0;
 
+    ASSERT(pod_locked_by_me(p2m));
+
     /* Increasing the target */
     while ( pod_target > p2m->pod.count )
     {
@@ -250,17 +250,13 @@
     }
 
     /* Decreasing the target */
-    /* We hold the p2m lock here, so we don't need to worry about
+    /* We hold the pod lock here, so we don't need to worry about
      * cache disappearing under our feet. */
     while ( pod_target < p2m->pod.count )
     {
         struct page_info * page;
         int order, i;
 
-        /* Grab the lock before checking that pod.super is empty, or the last
-         * entries may disappear before we grab the lock. */
-        lock_page_alloc(p2m);
-
         if ( (p2m->pod.count - pod_target) > SUPERPAGE_PAGES
              && !page_list_empty(&p2m->pod.super) )
             order = PAGE_ORDER_2M;
@@ -271,8 +267,6 @@
 
         ASSERT(page != NULL);
 
-        unlock_page_alloc(p2m);
-
         /* Then free them */
         for ( i = 0 ; i < (1 << order) ; i++ )
         {
@@ -348,7 +342,7 @@
     int ret = 0;
     unsigned long populated;
 
-    p2m_lock(p2m);
+    pod_lock(p2m);
 
     /* P == B: Nothing to do. */
     if ( p2m->pod.entry_count == 0 )
@@ -377,7 +371,7 @@
     ret = p2m_pod_set_cache_target(p2m, pod_target, 1/*preemptible*/);
 
 out:
-    p2m_unlock(p2m);
+    pod_unlock(p2m);
 
     return ret;
 }
@@ -390,7 +384,7 @@
 
     /* After this barrier no new PoD activities can happen. */
     BUG_ON(!d->is_dying);
-    spin_barrier(&p2m->lock.lock);
+    spin_barrier(&p2m->pod.lock.lock);
 
     lock_page_alloc(p2m);
 
@@ -431,7 +425,7 @@
     if ( !(d = page_get_owner(p)) || !(p2m = p2m_get_hostp2m(d)) )
         return 0;
 
-    lock_page_alloc(p2m);
+    pod_lock(p2m);
     bmfn = mfn_x(page_to_mfn(p));
     page_list_for_each_safe(q, tmp, &p2m->pod.super)
     {
@@ -462,12 +456,14 @@
         }
     }
 
-    unlock_page_alloc(p2m);
+    pod_unlock(p2m);
     return 0;
 
 pod_hit:
+    lock_page_alloc(p2m);
     page_list_add_tail(p, &d->arch.relmem_list);
     unlock_page_alloc(p2m);
+    pod_unlock(p2m);
     return 1;
 }
 
@@ -486,9 +482,9 @@
     if ( unlikely(!p) )
         return;
 
-    p2m_lock(p2m);
+    pod_lock(p2m);
     p2m_pod_cache_add(p2m, p, PAGE_ORDER_4K);
-    p2m_unlock(p2m);
+    pod_unlock(p2m);
     return;
 }
 
@@ -511,18 +507,18 @@
 
     int steal_for_cache = 0;
     int pod = 0, nonpod = 0, ram = 0;
-    
+
+    gfn_lock(p2m, gpfn, order);
+    pod_lock(p2m);    
 
     /* If we don't have any outstanding PoD entries, let things take their
      * course */
     if ( p2m->pod.entry_count == 0 )
-        goto out;
+        goto out_unlock;
 
     /* Figure out if we need to steal some freed memory for our cache */
     steal_for_cache =  ( p2m->pod.entry_count > p2m->pod.count );
 
-    gfn_lock(p2m, gpfn, order);
-
     if ( unlikely(d->is_dying) )
         goto out_unlock;
 
@@ -554,7 +550,7 @@
         /* All PoD: Mark the whole region invalid and tell caller
          * we're done. */
         set_p2m_entry(p2m, gpfn, _mfn(INVALID_MFN), order, p2m_invalid, p2m->default_access);
-        p2m->pod.entry_count-=(1<<order); /* Lock: p2m */
+        p2m->pod.entry_count-=(1<<order);
         BUG_ON(p2m->pod.entry_count < 0);
         ret = 1;
         goto out_entry_check;
@@ -578,7 +574,7 @@
         if ( t == p2m_populate_on_demand )
         {
             set_p2m_entry(p2m, gpfn + i, _mfn(INVALID_MFN), 0, p2m_invalid, p2m->default_access);
-            p2m->pod.entry_count--; /* Lock: p2m */
+            p2m->pod.entry_count--;
             BUG_ON(p2m->pod.entry_count < 0);
             pod--;
         }
@@ -615,9 +611,8 @@
     }
 
 out_unlock:
+    pod_unlock(p2m);
     gfn_unlock(p2m, gpfn, order);
-
-out:
     return ret;
 }
 
@@ -630,7 +625,8 @@
 
 
 /* Search for all-zero superpages to be reclaimed as superpages for the
- * PoD cache. Must be called w/ p2m lock held, page_alloc lock not held. */
+ * PoD cache. Must be called w/ pod lock held, must lock the superpage
+ * in the p2m */
 static int
 p2m_pod_zero_check_superpage(struct p2m_domain *p2m, unsigned long gfn)
 {
@@ -642,6 +638,8 @@
     int max_ref = 1;
     struct domain *d = p2m->domain;
 
+    ASSERT(pod_locked_by_me(p2m));
+
     if ( !superpage_aligned(gfn) )
         goto out;
 
@@ -649,6 +647,10 @@
     if ( paging_mode_shadow(d) )
         max_ref++;
 
+    /* NOTE: this is why we don't enforce deadlock constraints between p2m 
+     * and pod locks */
+    gfn_lock(p2m, gfn, SUPERPAGE_ORDER);
+
     /* Look up the mfns, checking to make sure they're the same mfn
      * and aligned, and mapping them. */
     for ( i=0; i<SUPERPAGE_PAGES; i++ )
@@ -761,6 +763,7 @@
         set_p2m_entry(p2m, gfn, mfn0, 9, type0, p2m->default_access);
     
 out:
+    gfn_unlock(p2m, gfn, SUPERPAGE_ORDER);
     return ret;
 }
 
@@ -922,6 +925,10 @@
     limit = (start > POD_SWEEP_LIMIT) ? (start - POD_SWEEP_LIMIT) : 0;
 
     /* FIXME: Figure out how to avoid superpages */
+    /* NOTE: Promote to globally locking the p2m. This will get complicated
+     * in a fine-grained scenario. If we lock each gfn individually we must be
+     * careful about spinlock recursion limits and POD_SWEEP_STRIDE. */
+    p2m_lock(p2m);
     for ( i=p2m->pod.reclaim_single; i > 0 ; i-- )
     {
         p2m_access_t a;
@@ -940,7 +947,7 @@
         /* Stop if we're past our limit and we have found *something*.
          *
          * NB that this is a zero-sum game; we're increasing our cache size
-         * by re-increasing our 'debt'.  Since we hold the p2m lock,
+         * by re-increasing our 'debt'.  Since we hold the pod lock,
          * (entry_count - count) must remain the same. */
         if ( p2m->pod.count > 0 && i < limit )
             break;
@@ -949,6 +956,7 @@
     if ( j )
         p2m_pod_zero_check(p2m, gfns, j);
 
+    p2m_unlock(p2m);
     p2m->pod.reclaim_single = i ? i - 1 : i;
 
 }
@@ -965,8 +973,9 @@
     int i;
 
     ASSERT(gfn_locked_by_me(p2m, gfn));
+    pod_lock(p2m);
 
-    /* This check is done with the p2m lock held.  This will make sure that
+    /* This check is done with the pod lock held.  This will make sure that
      * even if d->is_dying changes under our feet, p2m_pod_empty_cache() 
      * won't start until we're done. */
     if ( unlikely(d->is_dying) )
@@ -977,6 +986,7 @@
      * 1GB region to 2MB chunks for a retry. */
     if ( order == PAGE_ORDER_1G )
     {
+        pod_unlock(p2m);
         gfn_aligned = (gfn >> order) << order;
         /* Note that we are supposed to call set_p2m_entry() 512 times to 
          * split 1GB into 512 2MB pages here. But We only do once here because
@@ -1000,11 +1010,15 @@
 
         /* If we're low, start a sweep */
         if ( order == PAGE_ORDER_2M && page_list_empty(&p2m->pod.super) )
+            /* Note that sweeps scan other ranges in the p2m. In an scenario
+             * in which p2m locks are fine-grained, this may result in deadlock.
+             * Using trylock on the gfn's as we sweep would avoid it. */
             p2m_pod_emergency_sweep_super(p2m);
 
         if ( page_list_empty(&p2m->pod.single) &&
              ( ( order == PAGE_ORDER_4K )
                || (order == PAGE_ORDER_2M && page_list_empty(&p2m->pod.super) ) ) )
+            /* Same comment regarding deadlock applies */
             p2m_pod_emergency_sweep(p2m);
     }
 
@@ -1012,8 +1026,6 @@
     if ( q == p2m_guest && gfn > p2m->pod.max_guest )
         p2m->pod.max_guest = gfn;
 
-    lock_page_alloc(p2m);
-
     if ( p2m->pod.count == 0 )
         goto out_of_memory;
 
@@ -1026,8 +1038,6 @@
 
     BUG_ON((mfn_x(mfn) & ((1 << order)-1)) != 0);
 
-    unlock_page_alloc(p2m);
-
     gfn_aligned = (gfn >> order) << order;
 
     set_p2m_entry(p2m, gfn_aligned, mfn, order, p2m_ram_rw, p2m->default_access);
@@ -1038,7 +1048,7 @@
         paging_mark_dirty(d, mfn_x(mfn) + i);
     }
     
-    p2m->pod.entry_count -= (1 << order); /* Lock: p2m */
+    p2m->pod.entry_count -= (1 << order);
     BUG_ON(p2m->pod.entry_count < 0);
 
     if ( tb_init_done )
@@ -1056,20 +1066,24 @@
         __trace_var(TRC_MEM_POD_POPULATE, 0, sizeof(t), &t);
     }
 
+    pod_unlock(p2m);
     return 0;
 out_of_memory:
-    unlock_page_alloc(p2m);
+    pod_unlock(p2m);
 
     printk("%s: Out of populate-on-demand memory! tot_pages %" PRIu32 " pod_entries %" PRIi32 "\n",
            __func__, d->tot_pages, p2m->pod.entry_count);
     domain_crash(d);
 out_fail:
+    pod_unlock(p2m);
     return -1;
 remap_and_retry:
     BUG_ON(order != PAGE_ORDER_2M);
-    unlock_page_alloc(p2m);
+    pod_unlock(p2m);
 
     /* Remap this 2-meg region in singleton chunks */
+    /* NOTE: In a p2m fine-grained lock scenario this might
+     * need promoting the gfn lock from gfn->2M superpage */
     gfn_aligned = (gfn>>order)<<order;
     for(i=0; i<(1<<order); i++)
         set_p2m_entry(p2m, gfn_aligned+i, _mfn(0), PAGE_ORDER_4K,
@@ -1137,9 +1151,11 @@
         rc = -EINVAL;
     else
     {
-        p2m->pod.entry_count += 1 << order; /* Lock: p2m */
+        pod_lock(p2m);
+        p2m->pod.entry_count += 1 << order;
         p2m->pod.entry_count -= pod_count;
         BUG_ON(p2m->pod.entry_count < 0);
+        pod_unlock(p2m);
     }
 
     gfn_unlock(p2m, gfn, order);
diff -r a55ea8dc9c25 -r 28edc2b31a9b xen/arch/x86/mm/p2m-pt.c
--- a/xen/arch/x86/mm/p2m-pt.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/p2m-pt.c	Fri Feb 10 16:07:07 2012 +0000
@@ -954,6 +954,7 @@
     struct domain *d = p2m->domain;
 
     ASSERT(p2m_locked_by_me(p2m));
+    ASSERT(pod_locked_by_me(p2m));
 
     test_linear = ( (d == current->domain)
                     && !pagetable_is_null(current->arch.monitor_table) );
diff -r a55ea8dc9c25 -r 28edc2b31a9b xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Fri Feb 10 16:07:07 2012 +0000
@@ -72,6 +72,7 @@
 static void p2m_initialise(struct domain *d, struct p2m_domain *p2m)
 {
     mm_lock_init(&p2m->lock);
+    mm_lock_init(&p2m->pod.lock);
     INIT_LIST_HEAD(&p2m->np2m_list);
     INIT_PAGE_LIST_HEAD(&p2m->pages);
     INIT_PAGE_LIST_HEAD(&p2m->pod.super);
@@ -568,8 +569,10 @@
             rc = -EINVAL;
         else
         {
-            p2m->pod.entry_count -= pod_count; /* Lock: p2m */
+            pod_lock(p2m);
+            p2m->pod.entry_count -= pod_count;
             BUG_ON(p2m->pod.entry_count < 0);
+            pod_unlock(p2m);
         }
     }
 
@@ -1350,6 +1353,7 @@
     /* "Host" p2m tables can have shared entries &c that need a bit more 
      * care when discarding them */
     ASSERT(p2m_is_nestedp2m(p2m));
+    /* Nested p2m's do not do pod, hence the asserts (and no pod lock)*/
     ASSERT(page_list_empty(&p2m->pod.super));
     ASSERT(page_list_empty(&p2m->pod.single));
 
@@ -1507,6 +1511,7 @@
     P2M_PRINTK("p2m audit starts\n");
 
     p2m_lock(p2m);
+    pod_lock(p2m);
 
     if (p2m->audit_p2m)
         pmbad = p2m->audit_p2m(p2m);
@@ -1567,6 +1572,7 @@
     }
     spin_unlock(&d->page_alloc_lock);
 
+    pod_unlock(p2m);
     p2m_unlock(p2m);
  
     P2M_PRINTK("p2m audit complete\n");
diff -r a55ea8dc9c25 -r 28edc2b31a9b xen/include/asm-x86/p2m.h
--- a/xen/include/asm-x86/p2m.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/asm-x86/p2m.h	Fri Feb 10 16:07:07 2012 +0000
@@ -261,25 +261,12 @@
     unsigned long max_mapped_pfn;
 
     /* Populate-on-demand variables
-     * NB on locking.  {super,single,count} are
-     * covered by d->page_alloc_lock, since they're almost always used in
-     * conjunction with that functionality.  {entry_count} is covered by
-     * the domain p2m lock, since it's almost always used in conjunction
-     * with changing the p2m tables.
-     *
-     * At this point, both locks are held in two places.  In both,
-     * the order is [p2m,page_alloc]:
-     * + p2m_pod_decrease_reservation() calls p2m_pod_cache_add(),
-     *   which grabs page_alloc
-     * + 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.
-     */
+     * All variables are protected with the pod lock. We cannot rely on
+     * the p2m lock if it's turned into a fine-grained lock.
+     * We only use the domain page_alloc lock for additions and 
+     * deletions to the domain's page list. Because we use it nested
+     * within the PoD lock, we enforce it's ordering (by remembering
+     * the unlock level in the arch_domain sub struct). */
     struct {
         struct page_list_head super,   /* List of superpages                */
                          single;       /* Non-super lists                   */
@@ -288,6 +275,8 @@
         unsigned         reclaim_super; /* Last gpfn of a scan */
         unsigned         reclaim_single; /* Last gpfn of a scan */
         unsigned         max_guest;    /* gpfn of max guest demand-populate */
+        mm_lock_t        lock;         /* Locking of private pod structs,   *
+                                        * not relying on the p2m lock.      */
     } pod;
 };
 

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:37 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eW-0003ww-H3; Sat, 11 Feb 2012 04:33:36 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eT-0003lR-S4
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:34 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1328934805!12714761!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23315 invoked from network); 11 Feb 2012 04:33:26 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:26 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eK-0006Rn-NW
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:24 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eK-0001Io-MH
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:24 +0000
Message-Id: <E1Rw4eK-0001Io-MH@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:24 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Re-order calls to put_gfn() around
	wait queue invocations
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328890027 0
# Node ID e0ddac877f420e51314a97fc9f9f7befb44dc5a1
# Parent  28edc2b31a9bc50bae915129dfbd315a73260a09
Re-order calls to put_gfn() around wait queue invocations

Since we use wait queues to handle potential ring congestion cases,
code paths that try to generate a mem event while holding a gfn lock
would go to sleep in non-preemptible mode.

Most such code paths can be fixed by simply postponing event generation until
locks are released.

Signed-off-by: Adin Scannell <adin@scannell.ca>
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 28edc2b31a9b -r e0ddac877f42 xen/arch/x86/hvm/emulate.c
--- a/xen/arch/x86/hvm/emulate.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/hvm/emulate.c	Fri Feb 10 16:07:07 2012 +0000
@@ -67,8 +67,8 @@
     ram_mfn = get_gfn_unshare(curr->domain, ram_gfn, &p2mt);
     if ( p2m_is_paging(p2mt) )
     {
+        put_gfn(curr->domain, ram_gfn); 
         p2m_mem_paging_populate(curr->domain, ram_gfn);
-        put_gfn(curr->domain, ram_gfn); 
         return X86EMUL_RETRY;
     }
     if ( p2m_is_shared(p2mt) )
diff -r 28edc2b31a9b -r e0ddac877f42 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/hvm/hvm.c	Fri Feb 10 16:07:07 2012 +0000
@@ -64,6 +64,7 @@
 #include <public/version.h>
 #include <public/memory.h>
 #include <asm/mem_event.h>
+#include <asm/mem_access.h>
 #include <public/mem_event.h>
 
 bool_t __read_mostly hvm_enabled;
@@ -363,8 +364,8 @@
     }
     if ( p2m_is_paging(p2mt) )
     {
+        put_gfn(d, gmfn);
         p2m_mem_paging_populate(d, gmfn);
-        put_gfn(d, gmfn);
         return -ENOENT;
     }
     if ( p2m_is_shared(p2mt) )
@@ -1195,7 +1196,8 @@
     mfn_t mfn;
     struct vcpu *v = current;
     struct p2m_domain *p2m;
-    int rc, fall_through = 0;
+    int rc, fall_through = 0, paged = 0;
+    mem_event_request_t *req_ptr = NULL;
 
     /* On Nested Virtualization, walk the guest page table.
      * If this succeeds, all is fine.
@@ -1270,7 +1272,7 @@
         if ( violation )
         {
             if ( p2m_mem_access_check(gpa, gla_valid, gla, access_r, 
-                                        access_w, access_x) )
+                                        access_w, access_x, &req_ptr) )
             {
                 fall_through = 1;
             } else {
@@ -1297,7 +1299,7 @@
 #ifdef __x86_64__
     /* Check if the page has been paged out */
     if ( p2m_is_paged(p2mt) || (p2mt == p2m_ram_paging_out) )
-        p2m_mem_paging_populate(v->domain, gfn);
+        paged = 1;
 
     /* Mem sharing: unshare the page and try again */
     if ( access_w && (p2mt == p2m_ram_shared) )
@@ -1343,6 +1345,13 @@
 
 out_put_gfn:
     put_gfn(p2m->domain, gfn);
+    if ( paged )
+        p2m_mem_paging_populate(v->domain, gfn);
+    if ( req_ptr )
+    {
+        mem_access_send_req(v->domain, req_ptr);
+        xfree(req_ptr);
+    }
     return rc;
 }
 
@@ -1849,8 +1858,8 @@
     }
     if ( p2m_is_paging(p2mt) )
     {
+        put_gfn(d, gfn);
         p2m_mem_paging_populate(d, gfn);
-        put_gfn(d, gfn);
         return NULL;
     }
 
@@ -2325,8 +2334,8 @@
 
         if ( p2m_is_paging(p2mt) )
         {
+            put_gfn(curr->domain, gfn);
             p2m_mem_paging_populate(curr->domain, gfn);
-            put_gfn(curr->domain, gfn);
             return HVMCOPY_gfn_paged_out;
         }
         if ( p2m_is_shared(p2mt) )
@@ -3923,8 +3932,8 @@
             mfn_t mfn = get_gfn_unshare(d, pfn, &t);
             if ( p2m_is_paging(t) )
             {
+                put_gfn(d, pfn);
                 p2m_mem_paging_populate(d, pfn);
-                put_gfn(d, pfn);
                 rc = -EINVAL;
                 goto param_fail3;
             }
@@ -4040,8 +4049,8 @@
             mfn = get_gfn_unshare(d, pfn, &t);
             if ( p2m_is_paging(t) )
             {
+                put_gfn(d, pfn);
                 p2m_mem_paging_populate(d, pfn);
-                put_gfn(d, pfn);
                 rc = -EINVAL;
                 goto param_fail4;
             }
diff -r 28edc2b31a9b -r e0ddac877f42 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm.c	Fri Feb 10 16:07:07 2012 +0000
@@ -3536,8 +3536,8 @@
 
             if ( p2m_is_paged(p2mt) )
             {
+                put_gfn(pt_owner, gmfn);
                 p2m_mem_paging_populate(pg_owner, gmfn);
-                put_gfn(pt_owner, gmfn);
                 rc = -ENOENT;
                 break;
             }
@@ -3568,8 +3568,8 @@
 
                     if ( p2m_is_paged(l1e_p2mt) )
                     {
+                        put_gfn(pg_owner, l1egfn);
                         p2m_mem_paging_populate(pg_owner, l1e_get_pfn(l1e));
-                        put_gfn(pg_owner, l1egfn);
                         rc = -ENOENT;
                         break;
                     }
@@ -3617,8 +3617,8 @@
 
                     if ( p2m_is_paged(l2e_p2mt) )
                     {
+                        put_gfn(pg_owner, l2egfn);
                         p2m_mem_paging_populate(pg_owner, l2egfn);
-                        put_gfn(pg_owner, l2egfn);
                         rc = -ENOENT;
                         break;
                     }
@@ -3652,8 +3652,8 @@
 
                     if ( p2m_is_paged(l3e_p2mt) )
                     {
+                        put_gfn(pg_owner, l3egfn);
                         p2m_mem_paging_populate(pg_owner, l3egfn);
-                        put_gfn(pg_owner, l3egfn);
                         rc = -ENOENT;
                         break;
                     }
@@ -3687,8 +3687,8 @@
 
                     if ( p2m_is_paged(l4e_p2mt) )
                     {
+                        put_gfn(pg_owner, l4egfn);
                         p2m_mem_paging_populate(pg_owner, l4egfn);
-                        put_gfn(pg_owner, l4egfn);
                         rc = -ENOENT;
                         break;
                     }
diff -r 28edc2b31a9b -r e0ddac877f42 xen/arch/x86/mm/guest_walk.c
--- a/xen/arch/x86/mm/guest_walk.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/guest_walk.c	Fri Feb 10 16:07:07 2012 +0000
@@ -102,8 +102,8 @@
     if ( p2m_is_paging(*p2mt) )
     {
         ASSERT(!p2m_is_nestedp2m(p2m));
+        __put_gfn(p2m, gfn_x(gfn));
         p2m_mem_paging_populate(p2m->domain, gfn_x(gfn));
-        __put_gfn(p2m, gfn_x(gfn));
         *rc = _PAGE_PAGED;
         return NULL;
     }
diff -r 28edc2b31a9b -r e0ddac877f42 xen/arch/x86/mm/hap/guest_walk.c
--- a/xen/arch/x86/mm/hap/guest_walk.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/hap/guest_walk.c	Fri Feb 10 16:07:07 2012 +0000
@@ -64,10 +64,9 @@
     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);
+        p2m_mem_paging_populate(p2m->domain, cr3 >> PAGE_SHIFT);
         return INVALID_GFN;
     }
     if ( p2m_is_shared(p2mt) )
@@ -101,10 +100,9 @@
         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));
+            p2m_mem_paging_populate(p2m->domain, gfn_x(gfn));
             return INVALID_GFN;
         }
         if ( p2m_is_shared(p2mt) )
diff -r 28edc2b31a9b -r e0ddac877f42 xen/arch/x86/mm/mem_access.c
--- a/xen/arch/x86/mm/mem_access.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/mem_access.c	Fri Feb 10 16:07:07 2012 +0000
@@ -47,6 +47,16 @@
     return rc;
 }
 
+int mem_access_send_req(struct domain *d, mem_event_request_t *req)
+{
+    int rc = mem_event_claim_slot(d, &d->mem_event->access);
+    if ( rc < 0 )
+        return rc;
+
+    mem_event_put_request(d, &d->mem_event->access, req);
+
+    return 0;
+} 
 
 /*
  * Local variables:
diff -r 28edc2b31a9b -r e0ddac877f42 xen/arch/x86/mm/mem_event.c
--- a/xen/arch/x86/mm/mem_event.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/mem_event.c	Fri Feb 10 16:07:07 2012 +0000
@@ -423,6 +423,11 @@
     return rc;
 }
 
+bool_t mem_event_check_ring(struct mem_event_domain *med)
+{
+    return (med->ring_page != NULL);
+}
+
 /*
  * Determines whether or not the current vCPU belongs to the target domain,
  * and calls the appropriate wait function.  If it is a guest vCPU, then we
diff -r 28edc2b31a9b -r e0ddac877f42 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Fri Feb 10 16:07:07 2012 +0000
@@ -1130,17 +1130,18 @@
 }
 
 bool_t p2m_mem_access_check(unsigned long gpa, bool_t gla_valid, unsigned long gla, 
-                          bool_t access_r, bool_t access_w, bool_t access_x)
+                          bool_t access_r, bool_t access_w, bool_t access_x,
+                          mem_event_request_t **req_ptr)
 {
     struct vcpu *v = current;
-    mem_event_request_t req;
     unsigned long gfn = gpa >> PAGE_SHIFT;
     struct domain *d = v->domain;    
     struct p2m_domain* p2m = p2m_get_hostp2m(d);
     mfn_t mfn;
     p2m_type_t p2mt;
     p2m_access_t p2ma;
-    
+    mem_event_request_t *req;
+
     /* First, handle rx2rw conversion automatically */
     gfn_lock(p2m, gfn, 0);
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &p2ma, p2m_query, NULL);
@@ -1159,7 +1160,7 @@
     gfn_unlock(p2m, gfn, 0);
 
     /* Otherwise, check if there is a memory event listener, and send the message along */
-    if ( mem_event_claim_slot(d, &d->mem_event->access) == -ENOSYS )
+    if ( !mem_event_check_ring(&d->mem_event->access) || !req_ptr ) 
     {
         /* No listener */
         if ( p2m->access_required ) 
@@ -1183,29 +1184,34 @@
         }
     }
 
-    memset(&req, 0, sizeof(req));
-    req.type = MEM_EVENT_TYPE_ACCESS;
-    req.reason = MEM_EVENT_REASON_VIOLATION;
+    *req_ptr = NULL;
+    req = xmalloc(mem_event_request_t);
+    if ( req )
+    {
+        *req_ptr = req;
+        memset(req, 0, sizeof(req));
+        req->type = MEM_EVENT_TYPE_ACCESS;
+        req->reason = MEM_EVENT_REASON_VIOLATION;
+
+        /* Pause the current VCPU */
+        if ( p2ma != p2m_access_n2rwx )
+            req->flags |= MEM_EVENT_FLAG_VCPU_PAUSED;
+
+        /* Send request to mem event */
+        req->gfn = gfn;
+        req->offset = gpa & ((1 << PAGE_SHIFT) - 1);
+        req->gla_valid = gla_valid;
+        req->gla = gla;
+        req->access_r = access_r;
+        req->access_w = access_w;
+        req->access_x = access_x;
+    
+        req->vcpu_id = v->vcpu_id;
+    }
 
     /* Pause the current VCPU */
     if ( p2ma != p2m_access_n2rwx )
-    {
         vcpu_pause_nosync(v);
-        req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED;
-    } 
-
-    /* Send request to mem event */
-    req.gfn = gfn;
-    req.offset = gpa & ((1 << PAGE_SHIFT) - 1);
-    req.gla_valid = gla_valid;
-    req.gla = gla;
-    req.access_r = access_r;
-    req.access_w = access_w;
-    req.access_x = access_x;
-    
-    req.vcpu_id = v->vcpu_id;
-
-    mem_event_put_request(d, &d->mem_event->access, &req);
 
     /* VCPU may be paused, return whether we promoted automatically */
     return (p2ma == p2m_access_n2rwx);
diff -r 28edc2b31a9b -r e0ddac877f42 xen/common/grant_table.c
--- a/xen/common/grant_table.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/common/grant_table.c	Fri Feb 10 16:07:07 2012 +0000
@@ -164,8 +164,8 @@
         *frame = mfn_x(mfn);
         if ( p2m_is_paging(p2mt) )
         {
+            put_gfn(rd, gfn);
             p2m_mem_paging_populate(rd, gfn);
-            put_gfn(rd, gfn);
             rc = GNTST_eagain;
         }
     } else {
diff -r 28edc2b31a9b -r e0ddac877f42 xen/common/memory.c
--- a/xen/common/memory.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/common/memory.c	Fri Feb 10 16:07:07 2012 +0000
@@ -166,8 +166,8 @@
     if ( unlikely(p2m_is_paging(p2mt)) )
     {
         guest_physmap_remove_page(d, gmfn, mfn, 0);
+        put_gfn(d, gmfn);
         p2m_mem_paging_drop_page(d, gmfn, p2mt);
-        put_gfn(d, gmfn);
         return 1;
     }
 #else
diff -r 28edc2b31a9b -r e0ddac877f42 xen/include/asm-x86/mem_access.h
--- a/xen/include/asm-x86/mem_access.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/asm-x86/mem_access.h	Fri Feb 10 16:07:07 2012 +0000
@@ -23,6 +23,7 @@
 
 int mem_access_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec,
                       XEN_GUEST_HANDLE(void) u_domctl);
+int mem_access_send_req(struct domain *d, mem_event_request_t *req);
 
 
 /*
diff -r 28edc2b31a9b -r e0ddac877f42 xen/include/asm-x86/mem_event.h
--- a/xen/include/asm-x86/mem_event.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/asm-x86/mem_event.h	Fri Feb 10 16:07:07 2012 +0000
@@ -24,6 +24,9 @@
 #ifndef __MEM_EVENT_H__
 #define __MEM_EVENT_H__
 
+/* Returns whether a ring has been set up */
+bool_t mem_event_check_ring(struct mem_event_domain *med);
+
 /* Returns 0 on success, -ENOSYS if there is no ring, -EBUSY if there is no
  * available space. For success or -EBUSY, the vCPU may be left blocked
  * temporarily to ensure that the ring does not lose future events.  In
diff -r 28edc2b31a9b -r e0ddac877f42 xen/include/asm-x86/p2m.h
--- a/xen/include/asm-x86/p2m.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/asm-x86/p2m.h	Fri Feb 10 16:07:07 2012 +0000
@@ -494,9 +494,12 @@
 #ifdef __x86_64__
 /* Send mem event based on the access (gla is -1ull if not available).  Handles
  * the rw2rx conversion. Boolean return value indicates if access rights have 
- * been promoted with no underlying vcpu pause. */
+ * been promoted with no underlying vcpu pause. If the req_ptr has been populated, 
+ * then the caller must put the event in the ring (once having released get_gfn*
+ * locks -- caller must also xfree the request. */
 bool_t p2m_mem_access_check(unsigned long gpa, bool_t gla_valid, unsigned long gla, 
-                          bool_t access_r, bool_t access_w, bool_t access_x);
+                          bool_t access_r, bool_t access_w, bool_t access_x,
+                          mem_event_request_t **req_ptr);
 /* Resumes the running of the VCPU, restarting the last instruction */
 void p2m_mem_access_resume(struct domain *d);
 
@@ -513,7 +516,8 @@
 #else
 static inline bool_t p2m_mem_access_check(unsigned long gpa, bool_t gla_valid, 
                                         unsigned long gla, bool_t access_r, 
-                                        bool_t access_w, bool_t access_x)
+                                        bool_t access_w, bool_t access_x,
+                                        mem_event_request_t **req_ptr)
 { return 1; }
 static inline int p2m_set_mem_access(struct domain *d, 
                                      unsigned long start_pfn, 

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:37 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eW-0003ww-H3; Sat, 11 Feb 2012 04:33:36 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eT-0003lR-S4
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:34 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1328934805!12714761!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23315 invoked from network); 11 Feb 2012 04:33:26 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:26 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eK-0006Rn-NW
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:24 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eK-0001Io-MH
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:24 +0000
Message-Id: <E1Rw4eK-0001Io-MH@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:24 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Re-order calls to put_gfn() around
	wait queue invocations
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328890027 0
# Node ID e0ddac877f420e51314a97fc9f9f7befb44dc5a1
# Parent  28edc2b31a9bc50bae915129dfbd315a73260a09
Re-order calls to put_gfn() around wait queue invocations

Since we use wait queues to handle potential ring congestion cases,
code paths that try to generate a mem event while holding a gfn lock
would go to sleep in non-preemptible mode.

Most such code paths can be fixed by simply postponing event generation until
locks are released.

Signed-off-by: Adin Scannell <adin@scannell.ca>
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 28edc2b31a9b -r e0ddac877f42 xen/arch/x86/hvm/emulate.c
--- a/xen/arch/x86/hvm/emulate.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/hvm/emulate.c	Fri Feb 10 16:07:07 2012 +0000
@@ -67,8 +67,8 @@
     ram_mfn = get_gfn_unshare(curr->domain, ram_gfn, &p2mt);
     if ( p2m_is_paging(p2mt) )
     {
+        put_gfn(curr->domain, ram_gfn); 
         p2m_mem_paging_populate(curr->domain, ram_gfn);
-        put_gfn(curr->domain, ram_gfn); 
         return X86EMUL_RETRY;
     }
     if ( p2m_is_shared(p2mt) )
diff -r 28edc2b31a9b -r e0ddac877f42 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/hvm/hvm.c	Fri Feb 10 16:07:07 2012 +0000
@@ -64,6 +64,7 @@
 #include <public/version.h>
 #include <public/memory.h>
 #include <asm/mem_event.h>
+#include <asm/mem_access.h>
 #include <public/mem_event.h>
 
 bool_t __read_mostly hvm_enabled;
@@ -363,8 +364,8 @@
     }
     if ( p2m_is_paging(p2mt) )
     {
+        put_gfn(d, gmfn);
         p2m_mem_paging_populate(d, gmfn);
-        put_gfn(d, gmfn);
         return -ENOENT;
     }
     if ( p2m_is_shared(p2mt) )
@@ -1195,7 +1196,8 @@
     mfn_t mfn;
     struct vcpu *v = current;
     struct p2m_domain *p2m;
-    int rc, fall_through = 0;
+    int rc, fall_through = 0, paged = 0;
+    mem_event_request_t *req_ptr = NULL;
 
     /* On Nested Virtualization, walk the guest page table.
      * If this succeeds, all is fine.
@@ -1270,7 +1272,7 @@
         if ( violation )
         {
             if ( p2m_mem_access_check(gpa, gla_valid, gla, access_r, 
-                                        access_w, access_x) )
+                                        access_w, access_x, &req_ptr) )
             {
                 fall_through = 1;
             } else {
@@ -1297,7 +1299,7 @@
 #ifdef __x86_64__
     /* Check if the page has been paged out */
     if ( p2m_is_paged(p2mt) || (p2mt == p2m_ram_paging_out) )
-        p2m_mem_paging_populate(v->domain, gfn);
+        paged = 1;
 
     /* Mem sharing: unshare the page and try again */
     if ( access_w && (p2mt == p2m_ram_shared) )
@@ -1343,6 +1345,13 @@
 
 out_put_gfn:
     put_gfn(p2m->domain, gfn);
+    if ( paged )
+        p2m_mem_paging_populate(v->domain, gfn);
+    if ( req_ptr )
+    {
+        mem_access_send_req(v->domain, req_ptr);
+        xfree(req_ptr);
+    }
     return rc;
 }
 
@@ -1849,8 +1858,8 @@
     }
     if ( p2m_is_paging(p2mt) )
     {
+        put_gfn(d, gfn);
         p2m_mem_paging_populate(d, gfn);
-        put_gfn(d, gfn);
         return NULL;
     }
 
@@ -2325,8 +2334,8 @@
 
         if ( p2m_is_paging(p2mt) )
         {
+            put_gfn(curr->domain, gfn);
             p2m_mem_paging_populate(curr->domain, gfn);
-            put_gfn(curr->domain, gfn);
             return HVMCOPY_gfn_paged_out;
         }
         if ( p2m_is_shared(p2mt) )
@@ -3923,8 +3932,8 @@
             mfn_t mfn = get_gfn_unshare(d, pfn, &t);
             if ( p2m_is_paging(t) )
             {
+                put_gfn(d, pfn);
                 p2m_mem_paging_populate(d, pfn);
-                put_gfn(d, pfn);
                 rc = -EINVAL;
                 goto param_fail3;
             }
@@ -4040,8 +4049,8 @@
             mfn = get_gfn_unshare(d, pfn, &t);
             if ( p2m_is_paging(t) )
             {
+                put_gfn(d, pfn);
                 p2m_mem_paging_populate(d, pfn);
-                put_gfn(d, pfn);
                 rc = -EINVAL;
                 goto param_fail4;
             }
diff -r 28edc2b31a9b -r e0ddac877f42 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm.c	Fri Feb 10 16:07:07 2012 +0000
@@ -3536,8 +3536,8 @@
 
             if ( p2m_is_paged(p2mt) )
             {
+                put_gfn(pt_owner, gmfn);
                 p2m_mem_paging_populate(pg_owner, gmfn);
-                put_gfn(pt_owner, gmfn);
                 rc = -ENOENT;
                 break;
             }
@@ -3568,8 +3568,8 @@
 
                     if ( p2m_is_paged(l1e_p2mt) )
                     {
+                        put_gfn(pg_owner, l1egfn);
                         p2m_mem_paging_populate(pg_owner, l1e_get_pfn(l1e));
-                        put_gfn(pg_owner, l1egfn);
                         rc = -ENOENT;
                         break;
                     }
@@ -3617,8 +3617,8 @@
 
                     if ( p2m_is_paged(l2e_p2mt) )
                     {
+                        put_gfn(pg_owner, l2egfn);
                         p2m_mem_paging_populate(pg_owner, l2egfn);
-                        put_gfn(pg_owner, l2egfn);
                         rc = -ENOENT;
                         break;
                     }
@@ -3652,8 +3652,8 @@
 
                     if ( p2m_is_paged(l3e_p2mt) )
                     {
+                        put_gfn(pg_owner, l3egfn);
                         p2m_mem_paging_populate(pg_owner, l3egfn);
-                        put_gfn(pg_owner, l3egfn);
                         rc = -ENOENT;
                         break;
                     }
@@ -3687,8 +3687,8 @@
 
                     if ( p2m_is_paged(l4e_p2mt) )
                     {
+                        put_gfn(pg_owner, l4egfn);
                         p2m_mem_paging_populate(pg_owner, l4egfn);
-                        put_gfn(pg_owner, l4egfn);
                         rc = -ENOENT;
                         break;
                     }
diff -r 28edc2b31a9b -r e0ddac877f42 xen/arch/x86/mm/guest_walk.c
--- a/xen/arch/x86/mm/guest_walk.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/guest_walk.c	Fri Feb 10 16:07:07 2012 +0000
@@ -102,8 +102,8 @@
     if ( p2m_is_paging(*p2mt) )
     {
         ASSERT(!p2m_is_nestedp2m(p2m));
+        __put_gfn(p2m, gfn_x(gfn));
         p2m_mem_paging_populate(p2m->domain, gfn_x(gfn));
-        __put_gfn(p2m, gfn_x(gfn));
         *rc = _PAGE_PAGED;
         return NULL;
     }
diff -r 28edc2b31a9b -r e0ddac877f42 xen/arch/x86/mm/hap/guest_walk.c
--- a/xen/arch/x86/mm/hap/guest_walk.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/hap/guest_walk.c	Fri Feb 10 16:07:07 2012 +0000
@@ -64,10 +64,9 @@
     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);
+        p2m_mem_paging_populate(p2m->domain, cr3 >> PAGE_SHIFT);
         return INVALID_GFN;
     }
     if ( p2m_is_shared(p2mt) )
@@ -101,10 +100,9 @@
         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));
+            p2m_mem_paging_populate(p2m->domain, gfn_x(gfn));
             return INVALID_GFN;
         }
         if ( p2m_is_shared(p2mt) )
diff -r 28edc2b31a9b -r e0ddac877f42 xen/arch/x86/mm/mem_access.c
--- a/xen/arch/x86/mm/mem_access.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/mem_access.c	Fri Feb 10 16:07:07 2012 +0000
@@ -47,6 +47,16 @@
     return rc;
 }
 
+int mem_access_send_req(struct domain *d, mem_event_request_t *req)
+{
+    int rc = mem_event_claim_slot(d, &d->mem_event->access);
+    if ( rc < 0 )
+        return rc;
+
+    mem_event_put_request(d, &d->mem_event->access, req);
+
+    return 0;
+} 
 
 /*
  * Local variables:
diff -r 28edc2b31a9b -r e0ddac877f42 xen/arch/x86/mm/mem_event.c
--- a/xen/arch/x86/mm/mem_event.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/mem_event.c	Fri Feb 10 16:07:07 2012 +0000
@@ -423,6 +423,11 @@
     return rc;
 }
 
+bool_t mem_event_check_ring(struct mem_event_domain *med)
+{
+    return (med->ring_page != NULL);
+}
+
 /*
  * Determines whether or not the current vCPU belongs to the target domain,
  * and calls the appropriate wait function.  If it is a guest vCPU, then we
diff -r 28edc2b31a9b -r e0ddac877f42 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Fri Feb 10 16:07:07 2012 +0000
@@ -1130,17 +1130,18 @@
 }
 
 bool_t p2m_mem_access_check(unsigned long gpa, bool_t gla_valid, unsigned long gla, 
-                          bool_t access_r, bool_t access_w, bool_t access_x)
+                          bool_t access_r, bool_t access_w, bool_t access_x,
+                          mem_event_request_t **req_ptr)
 {
     struct vcpu *v = current;
-    mem_event_request_t req;
     unsigned long gfn = gpa >> PAGE_SHIFT;
     struct domain *d = v->domain;    
     struct p2m_domain* p2m = p2m_get_hostp2m(d);
     mfn_t mfn;
     p2m_type_t p2mt;
     p2m_access_t p2ma;
-    
+    mem_event_request_t *req;
+
     /* First, handle rx2rw conversion automatically */
     gfn_lock(p2m, gfn, 0);
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &p2ma, p2m_query, NULL);
@@ -1159,7 +1160,7 @@
     gfn_unlock(p2m, gfn, 0);
 
     /* Otherwise, check if there is a memory event listener, and send the message along */
-    if ( mem_event_claim_slot(d, &d->mem_event->access) == -ENOSYS )
+    if ( !mem_event_check_ring(&d->mem_event->access) || !req_ptr ) 
     {
         /* No listener */
         if ( p2m->access_required ) 
@@ -1183,29 +1184,34 @@
         }
     }
 
-    memset(&req, 0, sizeof(req));
-    req.type = MEM_EVENT_TYPE_ACCESS;
-    req.reason = MEM_EVENT_REASON_VIOLATION;
+    *req_ptr = NULL;
+    req = xmalloc(mem_event_request_t);
+    if ( req )
+    {
+        *req_ptr = req;
+        memset(req, 0, sizeof(req));
+        req->type = MEM_EVENT_TYPE_ACCESS;
+        req->reason = MEM_EVENT_REASON_VIOLATION;
+
+        /* Pause the current VCPU */
+        if ( p2ma != p2m_access_n2rwx )
+            req->flags |= MEM_EVENT_FLAG_VCPU_PAUSED;
+
+        /* Send request to mem event */
+        req->gfn = gfn;
+        req->offset = gpa & ((1 << PAGE_SHIFT) - 1);
+        req->gla_valid = gla_valid;
+        req->gla = gla;
+        req->access_r = access_r;
+        req->access_w = access_w;
+        req->access_x = access_x;
+    
+        req->vcpu_id = v->vcpu_id;
+    }
 
     /* Pause the current VCPU */
     if ( p2ma != p2m_access_n2rwx )
-    {
         vcpu_pause_nosync(v);
-        req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED;
-    } 
-
-    /* Send request to mem event */
-    req.gfn = gfn;
-    req.offset = gpa & ((1 << PAGE_SHIFT) - 1);
-    req.gla_valid = gla_valid;
-    req.gla = gla;
-    req.access_r = access_r;
-    req.access_w = access_w;
-    req.access_x = access_x;
-    
-    req.vcpu_id = v->vcpu_id;
-
-    mem_event_put_request(d, &d->mem_event->access, &req);
 
     /* VCPU may be paused, return whether we promoted automatically */
     return (p2ma == p2m_access_n2rwx);
diff -r 28edc2b31a9b -r e0ddac877f42 xen/common/grant_table.c
--- a/xen/common/grant_table.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/common/grant_table.c	Fri Feb 10 16:07:07 2012 +0000
@@ -164,8 +164,8 @@
         *frame = mfn_x(mfn);
         if ( p2m_is_paging(p2mt) )
         {
+            put_gfn(rd, gfn);
             p2m_mem_paging_populate(rd, gfn);
-            put_gfn(rd, gfn);
             rc = GNTST_eagain;
         }
     } else {
diff -r 28edc2b31a9b -r e0ddac877f42 xen/common/memory.c
--- a/xen/common/memory.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/common/memory.c	Fri Feb 10 16:07:07 2012 +0000
@@ -166,8 +166,8 @@
     if ( unlikely(p2m_is_paging(p2mt)) )
     {
         guest_physmap_remove_page(d, gmfn, mfn, 0);
+        put_gfn(d, gmfn);
         p2m_mem_paging_drop_page(d, gmfn, p2mt);
-        put_gfn(d, gmfn);
         return 1;
     }
 #else
diff -r 28edc2b31a9b -r e0ddac877f42 xen/include/asm-x86/mem_access.h
--- a/xen/include/asm-x86/mem_access.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/asm-x86/mem_access.h	Fri Feb 10 16:07:07 2012 +0000
@@ -23,6 +23,7 @@
 
 int mem_access_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec,
                       XEN_GUEST_HANDLE(void) u_domctl);
+int mem_access_send_req(struct domain *d, mem_event_request_t *req);
 
 
 /*
diff -r 28edc2b31a9b -r e0ddac877f42 xen/include/asm-x86/mem_event.h
--- a/xen/include/asm-x86/mem_event.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/asm-x86/mem_event.h	Fri Feb 10 16:07:07 2012 +0000
@@ -24,6 +24,9 @@
 #ifndef __MEM_EVENT_H__
 #define __MEM_EVENT_H__
 
+/* Returns whether a ring has been set up */
+bool_t mem_event_check_ring(struct mem_event_domain *med);
+
 /* Returns 0 on success, -ENOSYS if there is no ring, -EBUSY if there is no
  * available space. For success or -EBUSY, the vCPU may be left blocked
  * temporarily to ensure that the ring does not lose future events.  In
diff -r 28edc2b31a9b -r e0ddac877f42 xen/include/asm-x86/p2m.h
--- a/xen/include/asm-x86/p2m.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/asm-x86/p2m.h	Fri Feb 10 16:07:07 2012 +0000
@@ -494,9 +494,12 @@
 #ifdef __x86_64__
 /* Send mem event based on the access (gla is -1ull if not available).  Handles
  * the rw2rx conversion. Boolean return value indicates if access rights have 
- * been promoted with no underlying vcpu pause. */
+ * been promoted with no underlying vcpu pause. If the req_ptr has been populated, 
+ * then the caller must put the event in the ring (once having released get_gfn*
+ * locks -- caller must also xfree the request. */
 bool_t p2m_mem_access_check(unsigned long gpa, bool_t gla_valid, unsigned long gla, 
-                          bool_t access_r, bool_t access_w, bool_t access_x);
+                          bool_t access_r, bool_t access_w, bool_t access_x,
+                          mem_event_request_t **req_ptr);
 /* Resumes the running of the VCPU, restarting the last instruction */
 void p2m_mem_access_resume(struct domain *d);
 
@@ -513,7 +516,8 @@
 #else
 static inline bool_t p2m_mem_access_check(unsigned long gpa, bool_t gla_valid, 
                                         unsigned long gla, bool_t access_r, 
-                                        bool_t access_w, bool_t access_x)
+                                        bool_t access_w, bool_t access_x,
+                                        mem_event_request_t **req_ptr)
 { return 1; }
 static inline int p2m_set_mem_access(struct domain *d, 
                                      unsigned long start_pfn, 

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:37 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eW-0003xZ-ST; Sat, 11 Feb 2012 04:33:36 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eU-0003ly-G0
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:34 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-21.messagelabs.com!1328934806!10201361!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21474 invoked from network); 11 Feb 2012 04:33:27 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:27 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eL-0006Ry-Oi
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:25 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eL-0001Ja-NL
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:25 +0000
Message-Id: <E1Rw4eL-0001Ja-NL@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:25 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Refactor possibly
	deadlocking get_gfn calls
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328890027 0
# Node ID 9496b7cf14206642140587c3821217aa974f839d
# Parent  c6adf6ef3afb22fb1fd265d76300e6e5a84e1d5f
x86/mm: Refactor possibly deadlocking get_gfn calls

When calling get_gfn multiple times on different gfn's in the same function, we
can easily deadlock if p2m lookups are locked. Thus, refactor these calls to
enforce simple deadlock-avoidance rules:
 - Lowest-numbered domain first
 - Lowest-numbered gfn first

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


diff -r c6adf6ef3afb -r 9496b7cf1420 xen/arch/x86/hvm/emulate.c
--- a/xen/arch/x86/hvm/emulate.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/hvm/emulate.c	Fri Feb 10 16:07:07 2012 +0000
@@ -660,12 +660,13 @@
 {
     struct hvm_emulate_ctxt *hvmemul_ctxt =
         container_of(ctxt, struct hvm_emulate_ctxt, ctxt);
-    unsigned long saddr, daddr, bytes, sgfn, dgfn;
+    unsigned long saddr, daddr, bytes;
     paddr_t sgpa, dgpa;
     uint32_t pfec = PFEC_page_present;
-    p2m_type_t p2mt;
+    p2m_type_t sp2mt, dp2mt;
     int rc, df = !!(ctxt->regs->eflags & X86_EFLAGS_DF);
     char *buf;
+    struct two_gfns tg;
 
     rc = hvmemul_virtual_to_linear(
         src_seg, src_offset, bytes_per_rep, reps, hvm_access_read,
@@ -693,26 +694,23 @@
     if ( rc != X86EMUL_OKAY )
         return rc;
 
-    /* XXX In a fine-grained p2m locking scenario, we need to sort this
-     * get_gfn's, or else we might deadlock */
-    sgfn = sgpa >> PAGE_SHIFT;
-    (void)get_gfn(current->domain, sgfn, &p2mt);
-    if ( !p2m_is_ram(p2mt) && !p2m_is_grant(p2mt) )
+    get_two_gfns(current->domain, sgpa >> PAGE_SHIFT, &sp2mt, NULL, NULL,
+                 current->domain, dgpa >> PAGE_SHIFT, &dp2mt, NULL, NULL,
+                 p2m_guest, &tg);
+
+    if ( !p2m_is_ram(sp2mt) && !p2m_is_grant(sp2mt) )
     {
         rc = hvmemul_do_mmio(
             sgpa, reps, bytes_per_rep, dgpa, IOREQ_READ, df, NULL);
-        put_gfn(current->domain, sgfn);
+        put_two_gfns(&tg);
         return rc;
     }
 
-    dgfn = dgpa >> PAGE_SHIFT;
-    (void)get_gfn(current->domain, dgfn, &p2mt);
-    if ( !p2m_is_ram(p2mt) && !p2m_is_grant(p2mt) )
+    if ( !p2m_is_ram(dp2mt) && !p2m_is_grant(dp2mt) )
     {
         rc = hvmemul_do_mmio(
             dgpa, reps, bytes_per_rep, sgpa, IOREQ_WRITE, df, NULL);
-        put_gfn(current->domain, sgfn);
-        put_gfn(current->domain, dgfn);
+        put_two_gfns(&tg);
         return rc;
     }
 
@@ -730,8 +728,7 @@
      */
     if ( ((dgpa + bytes_per_rep) > sgpa) && (dgpa < (sgpa + bytes)) )
     {
-        put_gfn(current->domain, sgfn);
-        put_gfn(current->domain, dgfn);
+        put_two_gfns(&tg);
         return X86EMUL_UNHANDLEABLE;
     }
 
@@ -743,8 +740,7 @@
     buf = xmalloc_bytes(bytes);
     if ( buf == NULL )
     {
-        put_gfn(current->domain, sgfn);
-        put_gfn(current->domain, dgfn);
+        put_two_gfns(&tg);
         return X86EMUL_UNHANDLEABLE;
     }
 
@@ -757,8 +753,7 @@
         rc = hvm_copy_to_guest_phys(dgpa, buf, bytes);
 
     xfree(buf);
-    put_gfn(current->domain, sgfn);
-    put_gfn(current->domain, dgfn);
+    put_two_gfns(&tg);
 
     if ( rc == HVMCOPY_gfn_paged_out )
         return X86EMUL_RETRY;
diff -r c6adf6ef3afb -r 9496b7cf1420 xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/mem_sharing.c	Fri Feb 10 16:07:07 2012 +0000
@@ -727,11 +727,11 @@
     int ret = -EINVAL;
     mfn_t smfn, cmfn;
     p2m_type_t smfn_type, cmfn_type;
+    struct two_gfns tg;
 
-    /* XXX if sd == cd handle potential deadlock by ordering
-     * the get_ and put_gfn's */
-    smfn = get_gfn(sd, sgfn, &smfn_type);
-    cmfn = get_gfn(cd, cgfn, &cmfn_type);
+    get_two_gfns(sd, sgfn, &smfn_type, NULL, &smfn,
+                 cd, cgfn, &cmfn_type, NULL, &cmfn,
+                 p2m_query, &tg);
 
     /* This tricky business is to avoid two callers deadlocking if 
      * grabbing pages in opposite client/source order */
@@ -828,8 +828,7 @@
     ret = 0;
     
 err_out:
-    put_gfn(cd, cgfn);
-    put_gfn(sd, sgfn);
+    put_two_gfns(&tg);
     return ret;
 }
 
@@ -843,11 +842,11 @@
     struct gfn_info *gfn_info;
     struct p2m_domain *p2m = p2m_get_hostp2m(cd);
     p2m_access_t a;
-    
-    /* XXX if sd == cd handle potential deadlock by ordering
-     * the get_ and put_gfn's */
-    smfn = get_gfn_query(sd, sgfn, &smfn_type);
-    cmfn = get_gfn_type_access(p2m, cgfn, &cmfn_type, &a, p2m_query, NULL);
+    struct two_gfns tg;
+
+    get_two_gfns(sd, sgfn, &smfn_type, NULL, &smfn,
+                 cd, cgfn, &cmfn_type, &a, &cmfn,
+                 p2m_query, &tg);
 
     /* Get the source shared page, check and lock */
     ret = XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID;
@@ -897,8 +896,7 @@
 err_unlock:
     mem_sharing_page_unlock(spage);
 err_out:
-    put_gfn(cd, cgfn);
-    put_gfn(sd, sgfn);
+    put_two_gfns(&tg);
     return ret;
 }
 
diff -r c6adf6ef3afb -r 9496b7cf1420 xen/include/asm-x86/p2m.h
--- a/xen/include/asm-x86/p2m.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/asm-x86/p2m.h	Fri Feb 10 16:07:07 2012 +0000
@@ -378,6 +378,66 @@
         return mfn_x(mfn);
 }
 
+/* Deadlock-avoidance scheme when calling get_gfn on different gfn's */
+struct two_gfns {
+    struct domain  *first_domain;
+    unsigned long   first_gfn;
+    struct domain  *second_domain;
+    unsigned long   second_gfn;
+};
+
+#define assign_pointers(dest, source)                                        \
+do {                                                                         \
+    dest ## _mfn = (source ## mfn) ? (source ## mfn) : &__ ## dest ## _mfn;  \
+    dest ## _a   = (source ## a)   ? (source ## a)   : &__ ## dest ## _a;    \
+    dest ## _t   = (source ## t)   ? (source ## t)   : &__ ## dest ## _t;    \
+} while(0)
+
+/* Returns mfn, type and access for potential caller consumption, but any
+ * of those can be NULL */
+static inline void get_two_gfns(struct domain *rd, unsigned long rgfn,
+        p2m_type_t *rt, p2m_access_t *ra, mfn_t *rmfn, struct domain *ld, 
+        unsigned long lgfn, p2m_type_t *lt, p2m_access_t *la, mfn_t *lmfn,
+        p2m_query_t q, struct two_gfns *rval)
+{
+    mfn_t           *first_mfn, *second_mfn, __first_mfn, __second_mfn;
+    p2m_access_t    *first_a, *second_a, __first_a, __second_a;
+    p2m_type_t      *first_t, *second_t, __first_t, __second_t;
+
+    /* Sort by domain, if same domain by gfn */
+    if ( (rd->domain_id <= ld->domain_id) || ((rd == ld) && (rgfn <= lgfn)) )
+    {
+        rval->first_domain  = rd;
+        rval->first_gfn     = rgfn;
+        rval->second_domain = ld;
+        rval->second_gfn    = lgfn;
+        assign_pointers(first, r);
+        assign_pointers(second, l);
+    } else {
+        rval->first_domain  = ld;
+        rval->first_gfn     = lgfn;
+        rval->second_domain = rd;
+        rval->second_gfn    = rgfn;
+        assign_pointers(first, l);
+        assign_pointers(second, r);
+    }
+
+    /* Now do the gets */
+    *first_mfn  = get_gfn_type_access(p2m_get_hostp2m(rval->first_domain), 
+                                      rval->first_gfn, first_t, first_a, q, NULL);
+    *second_mfn = get_gfn_type_access(p2m_get_hostp2m(rval->second_domain), 
+                                      rval->second_gfn, second_t, second_a, q, NULL);
+}
+
+static inline void put_two_gfns(struct two_gfns *arg)
+{
+    if ( !arg )
+        return;
+
+    put_gfn(arg->second_domain, arg->second_gfn);
+    put_gfn(arg->first_domain, arg->first_gfn);
+}
+
 /* Init the datastructures for later use by the p2m code */
 int p2m_init(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 Sat Feb 11 04:33:37 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eX-0003y3-3v; Sat, 11 Feb 2012 04:33:37 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eU-0003mP-LD
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:34 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1328934806!12856087!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5142 invoked from network); 11 Feb 2012 04:33:27 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:27 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eM-0006S5-9i
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:26 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eM-0001Jz-8P
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:26 +0000
Message-Id: <E1Rw4eM-0001Jz-8P@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:25 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: When removing/adding a page
	from/to the physmap, keep in mind it could be shared
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328890027 0
# Node ID 0362b6cf03bfc41ddc3e1c4f24076730435965dd
# Parent  9496b7cf14206642140587c3821217aa974f839d
x86/mm: When removing/adding a page from/to the physmap, keep in mind it could be shared

When removing the m2p mapping it is unconditionally set to invalid, which
breaks sharing.

When adding to the physmap, if the previous holder of that entry is a shared
page, we unshare to default to normal case handling.

And, we cannot add a shared page directly to the physmap. Proper interfaces
must be employed, otherwise book-keeping goes awry.

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 9496b7cf1420 -r 0362b6cf03bf xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Fri Feb 10 16:07:07 2012 +0000
@@ -438,7 +438,7 @@
         for ( i = 0; i < (1UL << page_order); i++ )
         {
             mfn_return = p2m->get_entry(p2m, gfn + i, &t, &a, p2m_query, NULL);
-            if ( !p2m_is_grant(t) )
+            if ( !p2m_is_grant(t) && !p2m_is_shared(t) )
                 set_gpfn_from_mfn(mfn+i, INVALID_M2P_ENTRY);
             ASSERT( !p2m_is_valid(t) || mfn + i == mfn_x(mfn_return) );
         }
@@ -500,6 +500,22 @@
     for ( i = 0; i < (1UL << page_order); i++ )
     {
         omfn = p2m->get_entry(p2m, gfn + i, &ot, &a, p2m_query, NULL);
+#ifdef __x86_64__
+        if ( p2m_is_shared(ot) )
+        {
+            /* Do an unshare to cleanly take care of all corner 
+             * cases. */
+            int rc;
+            rc = mem_sharing_unshare_page(p2m->domain, gfn + i, 0);
+            if ( rc )
+            {
+                p2m_unlock(p2m);
+                return rc;
+            }
+            omfn = p2m->get_entry(p2m, gfn + i, &ot, &a, p2m_query, NULL);
+            ASSERT(!p2m_is_shared(ot));
+        }
+#endif /* __x86_64__ */
         if ( p2m_is_grant(ot) )
         {
             /* Really shouldn't be unmapping grant maps this way */
@@ -528,6 +544,14 @@
     /* Then, look for m->p mappings for this range and deal with them */
     for ( i = 0; i < (1UL << page_order); i++ )
     {
+        if ( page_get_owner(mfn_to_page(_mfn(mfn + i))) == dom_cow )
+        {
+            /* This is no way to add a shared page to your physmap! */
+            gdprintk(XENLOG_ERR, "Adding shared mfn %lx directly to dom %hu "
+                        "physmap not allowed.\n", mfn+i, d->domain_id);
+            p2m_unlock(p2m);
+            return -EINVAL;
+        }
         if ( page_get_owner(mfn_to_page(_mfn(mfn + i))) != d )
             continue;
         ogfn = mfn_to_gfn(d, _mfn(mfn+i));

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:37 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eW-0003xZ-ST; Sat, 11 Feb 2012 04:33:36 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eU-0003ly-G0
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:34 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-21.messagelabs.com!1328934806!10201361!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21474 invoked from network); 11 Feb 2012 04:33:27 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:27 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eL-0006Ry-Oi
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:25 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eL-0001Ja-NL
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:25 +0000
Message-Id: <E1Rw4eL-0001Ja-NL@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:25 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Refactor possibly
	deadlocking get_gfn calls
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328890027 0
# Node ID 9496b7cf14206642140587c3821217aa974f839d
# Parent  c6adf6ef3afb22fb1fd265d76300e6e5a84e1d5f
x86/mm: Refactor possibly deadlocking get_gfn calls

When calling get_gfn multiple times on different gfn's in the same function, we
can easily deadlock if p2m lookups are locked. Thus, refactor these calls to
enforce simple deadlock-avoidance rules:
 - Lowest-numbered domain first
 - Lowest-numbered gfn first

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


diff -r c6adf6ef3afb -r 9496b7cf1420 xen/arch/x86/hvm/emulate.c
--- a/xen/arch/x86/hvm/emulate.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/hvm/emulate.c	Fri Feb 10 16:07:07 2012 +0000
@@ -660,12 +660,13 @@
 {
     struct hvm_emulate_ctxt *hvmemul_ctxt =
         container_of(ctxt, struct hvm_emulate_ctxt, ctxt);
-    unsigned long saddr, daddr, bytes, sgfn, dgfn;
+    unsigned long saddr, daddr, bytes;
     paddr_t sgpa, dgpa;
     uint32_t pfec = PFEC_page_present;
-    p2m_type_t p2mt;
+    p2m_type_t sp2mt, dp2mt;
     int rc, df = !!(ctxt->regs->eflags & X86_EFLAGS_DF);
     char *buf;
+    struct two_gfns tg;
 
     rc = hvmemul_virtual_to_linear(
         src_seg, src_offset, bytes_per_rep, reps, hvm_access_read,
@@ -693,26 +694,23 @@
     if ( rc != X86EMUL_OKAY )
         return rc;
 
-    /* XXX In a fine-grained p2m locking scenario, we need to sort this
-     * get_gfn's, or else we might deadlock */
-    sgfn = sgpa >> PAGE_SHIFT;
-    (void)get_gfn(current->domain, sgfn, &p2mt);
-    if ( !p2m_is_ram(p2mt) && !p2m_is_grant(p2mt) )
+    get_two_gfns(current->domain, sgpa >> PAGE_SHIFT, &sp2mt, NULL, NULL,
+                 current->domain, dgpa >> PAGE_SHIFT, &dp2mt, NULL, NULL,
+                 p2m_guest, &tg);
+
+    if ( !p2m_is_ram(sp2mt) && !p2m_is_grant(sp2mt) )
     {
         rc = hvmemul_do_mmio(
             sgpa, reps, bytes_per_rep, dgpa, IOREQ_READ, df, NULL);
-        put_gfn(current->domain, sgfn);
+        put_two_gfns(&tg);
         return rc;
     }
 
-    dgfn = dgpa >> PAGE_SHIFT;
-    (void)get_gfn(current->domain, dgfn, &p2mt);
-    if ( !p2m_is_ram(p2mt) && !p2m_is_grant(p2mt) )
+    if ( !p2m_is_ram(dp2mt) && !p2m_is_grant(dp2mt) )
     {
         rc = hvmemul_do_mmio(
             dgpa, reps, bytes_per_rep, sgpa, IOREQ_WRITE, df, NULL);
-        put_gfn(current->domain, sgfn);
-        put_gfn(current->domain, dgfn);
+        put_two_gfns(&tg);
         return rc;
     }
 
@@ -730,8 +728,7 @@
      */
     if ( ((dgpa + bytes_per_rep) > sgpa) && (dgpa < (sgpa + bytes)) )
     {
-        put_gfn(current->domain, sgfn);
-        put_gfn(current->domain, dgfn);
+        put_two_gfns(&tg);
         return X86EMUL_UNHANDLEABLE;
     }
 
@@ -743,8 +740,7 @@
     buf = xmalloc_bytes(bytes);
     if ( buf == NULL )
     {
-        put_gfn(current->domain, sgfn);
-        put_gfn(current->domain, dgfn);
+        put_two_gfns(&tg);
         return X86EMUL_UNHANDLEABLE;
     }
 
@@ -757,8 +753,7 @@
         rc = hvm_copy_to_guest_phys(dgpa, buf, bytes);
 
     xfree(buf);
-    put_gfn(current->domain, sgfn);
-    put_gfn(current->domain, dgfn);
+    put_two_gfns(&tg);
 
     if ( rc == HVMCOPY_gfn_paged_out )
         return X86EMUL_RETRY;
diff -r c6adf6ef3afb -r 9496b7cf1420 xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/mem_sharing.c	Fri Feb 10 16:07:07 2012 +0000
@@ -727,11 +727,11 @@
     int ret = -EINVAL;
     mfn_t smfn, cmfn;
     p2m_type_t smfn_type, cmfn_type;
+    struct two_gfns tg;
 
-    /* XXX if sd == cd handle potential deadlock by ordering
-     * the get_ and put_gfn's */
-    smfn = get_gfn(sd, sgfn, &smfn_type);
-    cmfn = get_gfn(cd, cgfn, &cmfn_type);
+    get_two_gfns(sd, sgfn, &smfn_type, NULL, &smfn,
+                 cd, cgfn, &cmfn_type, NULL, &cmfn,
+                 p2m_query, &tg);
 
     /* This tricky business is to avoid two callers deadlocking if 
      * grabbing pages in opposite client/source order */
@@ -828,8 +828,7 @@
     ret = 0;
     
 err_out:
-    put_gfn(cd, cgfn);
-    put_gfn(sd, sgfn);
+    put_two_gfns(&tg);
     return ret;
 }
 
@@ -843,11 +842,11 @@
     struct gfn_info *gfn_info;
     struct p2m_domain *p2m = p2m_get_hostp2m(cd);
     p2m_access_t a;
-    
-    /* XXX if sd == cd handle potential deadlock by ordering
-     * the get_ and put_gfn's */
-    smfn = get_gfn_query(sd, sgfn, &smfn_type);
-    cmfn = get_gfn_type_access(p2m, cgfn, &cmfn_type, &a, p2m_query, NULL);
+    struct two_gfns tg;
+
+    get_two_gfns(sd, sgfn, &smfn_type, NULL, &smfn,
+                 cd, cgfn, &cmfn_type, &a, &cmfn,
+                 p2m_query, &tg);
 
     /* Get the source shared page, check and lock */
     ret = XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID;
@@ -897,8 +896,7 @@
 err_unlock:
     mem_sharing_page_unlock(spage);
 err_out:
-    put_gfn(cd, cgfn);
-    put_gfn(sd, sgfn);
+    put_two_gfns(&tg);
     return ret;
 }
 
diff -r c6adf6ef3afb -r 9496b7cf1420 xen/include/asm-x86/p2m.h
--- a/xen/include/asm-x86/p2m.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/asm-x86/p2m.h	Fri Feb 10 16:07:07 2012 +0000
@@ -378,6 +378,66 @@
         return mfn_x(mfn);
 }
 
+/* Deadlock-avoidance scheme when calling get_gfn on different gfn's */
+struct two_gfns {
+    struct domain  *first_domain;
+    unsigned long   first_gfn;
+    struct domain  *second_domain;
+    unsigned long   second_gfn;
+};
+
+#define assign_pointers(dest, source)                                        \
+do {                                                                         \
+    dest ## _mfn = (source ## mfn) ? (source ## mfn) : &__ ## dest ## _mfn;  \
+    dest ## _a   = (source ## a)   ? (source ## a)   : &__ ## dest ## _a;    \
+    dest ## _t   = (source ## t)   ? (source ## t)   : &__ ## dest ## _t;    \
+} while(0)
+
+/* Returns mfn, type and access for potential caller consumption, but any
+ * of those can be NULL */
+static inline void get_two_gfns(struct domain *rd, unsigned long rgfn,
+        p2m_type_t *rt, p2m_access_t *ra, mfn_t *rmfn, struct domain *ld, 
+        unsigned long lgfn, p2m_type_t *lt, p2m_access_t *la, mfn_t *lmfn,
+        p2m_query_t q, struct two_gfns *rval)
+{
+    mfn_t           *first_mfn, *second_mfn, __first_mfn, __second_mfn;
+    p2m_access_t    *first_a, *second_a, __first_a, __second_a;
+    p2m_type_t      *first_t, *second_t, __first_t, __second_t;
+
+    /* Sort by domain, if same domain by gfn */
+    if ( (rd->domain_id <= ld->domain_id) || ((rd == ld) && (rgfn <= lgfn)) )
+    {
+        rval->first_domain  = rd;
+        rval->first_gfn     = rgfn;
+        rval->second_domain = ld;
+        rval->second_gfn    = lgfn;
+        assign_pointers(first, r);
+        assign_pointers(second, l);
+    } else {
+        rval->first_domain  = ld;
+        rval->first_gfn     = lgfn;
+        rval->second_domain = rd;
+        rval->second_gfn    = rgfn;
+        assign_pointers(first, l);
+        assign_pointers(second, r);
+    }
+
+    /* Now do the gets */
+    *first_mfn  = get_gfn_type_access(p2m_get_hostp2m(rval->first_domain), 
+                                      rval->first_gfn, first_t, first_a, q, NULL);
+    *second_mfn = get_gfn_type_access(p2m_get_hostp2m(rval->second_domain), 
+                                      rval->second_gfn, second_t, second_a, q, NULL);
+}
+
+static inline void put_two_gfns(struct two_gfns *arg)
+{
+    if ( !arg )
+        return;
+
+    put_gfn(arg->second_domain, arg->second_gfn);
+    put_gfn(arg->first_domain, arg->first_gfn);
+}
+
 /* Init the datastructures for later use by the p2m code */
 int p2m_init(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 Sat Feb 11 04:33:37 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eX-0003y3-3v; Sat, 11 Feb 2012 04:33:37 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eU-0003mP-LD
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:34 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1328934806!12856087!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5142 invoked from network); 11 Feb 2012 04:33:27 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:27 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eM-0006S5-9i
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:26 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eM-0001Jz-8P
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:26 +0000
Message-Id: <E1Rw4eM-0001Jz-8P@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:25 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: When removing/adding a page
	from/to the physmap, keep in mind it could be shared
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328890027 0
# Node ID 0362b6cf03bfc41ddc3e1c4f24076730435965dd
# Parent  9496b7cf14206642140587c3821217aa974f839d
x86/mm: When removing/adding a page from/to the physmap, keep in mind it could be shared

When removing the m2p mapping it is unconditionally set to invalid, which
breaks sharing.

When adding to the physmap, if the previous holder of that entry is a shared
page, we unshare to default to normal case handling.

And, we cannot add a shared page directly to the physmap. Proper interfaces
must be employed, otherwise book-keeping goes awry.

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 9496b7cf1420 -r 0362b6cf03bf xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Fri Feb 10 16:07:07 2012 +0000
@@ -438,7 +438,7 @@
         for ( i = 0; i < (1UL << page_order); i++ )
         {
             mfn_return = p2m->get_entry(p2m, gfn + i, &t, &a, p2m_query, NULL);
-            if ( !p2m_is_grant(t) )
+            if ( !p2m_is_grant(t) && !p2m_is_shared(t) )
                 set_gpfn_from_mfn(mfn+i, INVALID_M2P_ENTRY);
             ASSERT( !p2m_is_valid(t) || mfn + i == mfn_x(mfn_return) );
         }
@@ -500,6 +500,22 @@
     for ( i = 0; i < (1UL << page_order); i++ )
     {
         omfn = p2m->get_entry(p2m, gfn + i, &ot, &a, p2m_query, NULL);
+#ifdef __x86_64__
+        if ( p2m_is_shared(ot) )
+        {
+            /* Do an unshare to cleanly take care of all corner 
+             * cases. */
+            int rc;
+            rc = mem_sharing_unshare_page(p2m->domain, gfn + i, 0);
+            if ( rc )
+            {
+                p2m_unlock(p2m);
+                return rc;
+            }
+            omfn = p2m->get_entry(p2m, gfn + i, &ot, &a, p2m_query, NULL);
+            ASSERT(!p2m_is_shared(ot));
+        }
+#endif /* __x86_64__ */
         if ( p2m_is_grant(ot) )
         {
             /* Really shouldn't be unmapping grant maps this way */
@@ -528,6 +544,14 @@
     /* Then, look for m->p mappings for this range and deal with them */
     for ( i = 0; i < (1UL << page_order); i++ )
     {
+        if ( page_get_owner(mfn_to_page(_mfn(mfn + i))) == dom_cow )
+        {
+            /* This is no way to add a shared page to your physmap! */
+            gdprintk(XENLOG_ERR, "Adding shared mfn %lx directly to dom %hu "
+                        "physmap not allowed.\n", mfn+i, d->domain_id);
+            p2m_unlock(p2m);
+            return -EINVAL;
+        }
         if ( page_get_owner(mfn_to_page(_mfn(mfn + i))) != d )
             continue;
         ogfn = mfn_to_gfn(d, _mfn(mfn+i));

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:38 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eY-00040U-3W; Sat, 11 Feb 2012 04:33:38 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eW-0003pE-BI
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:36 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1328934808!12894684!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11542 invoked from network); 11 Feb 2012 04:33:29 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:29 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eN-0006SL-VU
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:27 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eN-0001LB-U7
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:27 +0000
Message-Id: <E1Rw4eN-0001LB-U7@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:27 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xend: populate HVM guest grant table
	on boot
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328894690 0
# Node ID 9ad1e42c341bc78463b6f6610a6300f75b535fbb
# Parent  0dcb9d1e7b554a9f6f76b62b38a139acf9b2180a
xend: populate HVM guest grant table on boot

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


diff -r 0dcb9d1e7b55 -r 9ad1e42c341b tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/python/xen/lowlevel/xc/xc.c	Fri Feb 10 17:24:50 2012 +0000
@@ -1008,6 +1008,30 @@
     return Py_BuildValue("{}");
 }
 
+static PyObject *pyxc_gnttab_hvm_seed(XcObject *self,
+				      PyObject *args,
+				      PyObject *kwds)
+{
+    uint32_t dom, console_domid, xenstore_domid;
+    unsigned long xenstore_gmfn = 0;
+    unsigned long console_gmfn = 0;
+    static char *kwd_list[] = { "domid",
+				"console_gmfn", "xenstore_gmfn",
+				"console_domid", "xenstore_domid", NULL };
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiii", kwd_list,
+                                      &dom,
+				      &console_gmfn, &xenstore_gmfn,
+				      &console_domid, &xenstore_domid) )
+        return NULL;
+
+    if ( xc_dom_gnttab_hvm_seed(self->xc_handle, dom,
+				console_gmfn, xenstore_gmfn,
+				console_domid, xenstore_domid) != 0 )
+        return pyxc_error_to_exception(self->xc_handle);
+
+    return Py_None;
+}
+
 static PyObject *pyxc_evtchn_alloc_unbound(XcObject *self,
                                            PyObject *args,
                                            PyObject *kwds)
@@ -2439,6 +2463,17 @@
       " vcpu_avail [long, 1]: Which Virtual CPUS available.\n\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
+    { "gnttab_hvm_seed",
+      (PyCFunction)pyxc_gnttab_hvm_seed,
+      METH_KEYWORDS, "\n"
+      "Initialise HVM guest grant table.\n"
+      " dom     [int]:      Identifier of domain to build into.\n"
+      " console_gmfn [int]: \n"
+      " xenstore_gmfn [int]: \n"
+      " console_domid [int]: \n"
+      " xenstore_domid [int]: \n"
+      "Returns: None on sucess. Raises exception on error.\n" },
+
     { "hvm_get_param", 
       (PyCFunction)pyxc_get_hvm_param, 
       METH_VARARGS | METH_KEYWORDS, "\n"
diff -r 0dcb9d1e7b55 -r 9ad1e42c341b tools/python/xen/xend/XendConstants.py
--- a/tools/python/xen/xend/XendConstants.py	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/python/xen/xend/XendConstants.py	Fri Feb 10 17:24:50 2012 +0000
@@ -52,6 +52,7 @@
 HVM_PARAM_HPET_ENABLED = 11
 HVM_PARAM_ACPI_S_STATE = 14
 HVM_PARAM_VPT_ALIGN    = 16
+HVM_PARAM_CONSOLE_PFN  = 17
 HVM_PARAM_NESTEDHVM    = 24 # x86
 
 restart_modes = [
diff -r 0dcb9d1e7b55 -r 9ad1e42c341b tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/python/xen/xend/image.py	Fri Feb 10 17:24:50 2012 +0000
@@ -971,6 +971,13 @@
         xc.hvm_set_param(self.vm.getDomid(), HVM_PARAM_STORE_EVTCHN,
                          store_evtchn)
 
+        console_mfn = xc.hvm_get_param(self.vm.getDomid(), HVM_PARAM_CONSOLE_PFN)
+        xc.gnttab_hvm_seed(domid = self.vm.getDomid(),
+                           console_gmfn = console_mfn,
+                           xenstore_gmfn = rc['store_mfn'],
+                           console_domid = 0,
+                           xenstore_domid = 0)
+
         return rc
 
 

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:38 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eY-00040U-3W; Sat, 11 Feb 2012 04:33:38 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eW-0003pE-BI
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:36 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1328934808!12894684!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11542 invoked from network); 11 Feb 2012 04:33:29 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:29 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eN-0006SL-VU
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:27 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eN-0001LB-U7
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:27 +0000
Message-Id: <E1Rw4eN-0001LB-U7@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:27 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xend: populate HVM guest grant table
	on boot
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328894690 0
# Node ID 9ad1e42c341bc78463b6f6610a6300f75b535fbb
# Parent  0dcb9d1e7b554a9f6f76b62b38a139acf9b2180a
xend: populate HVM guest grant table on boot

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


diff -r 0dcb9d1e7b55 -r 9ad1e42c341b tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/python/xen/lowlevel/xc/xc.c	Fri Feb 10 17:24:50 2012 +0000
@@ -1008,6 +1008,30 @@
     return Py_BuildValue("{}");
 }
 
+static PyObject *pyxc_gnttab_hvm_seed(XcObject *self,
+				      PyObject *args,
+				      PyObject *kwds)
+{
+    uint32_t dom, console_domid, xenstore_domid;
+    unsigned long xenstore_gmfn = 0;
+    unsigned long console_gmfn = 0;
+    static char *kwd_list[] = { "domid",
+				"console_gmfn", "xenstore_gmfn",
+				"console_domid", "xenstore_domid", NULL };
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiii", kwd_list,
+                                      &dom,
+				      &console_gmfn, &xenstore_gmfn,
+				      &console_domid, &xenstore_domid) )
+        return NULL;
+
+    if ( xc_dom_gnttab_hvm_seed(self->xc_handle, dom,
+				console_gmfn, xenstore_gmfn,
+				console_domid, xenstore_domid) != 0 )
+        return pyxc_error_to_exception(self->xc_handle);
+
+    return Py_None;
+}
+
 static PyObject *pyxc_evtchn_alloc_unbound(XcObject *self,
                                            PyObject *args,
                                            PyObject *kwds)
@@ -2439,6 +2463,17 @@
       " vcpu_avail [long, 1]: Which Virtual CPUS available.\n\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
+    { "gnttab_hvm_seed",
+      (PyCFunction)pyxc_gnttab_hvm_seed,
+      METH_KEYWORDS, "\n"
+      "Initialise HVM guest grant table.\n"
+      " dom     [int]:      Identifier of domain to build into.\n"
+      " console_gmfn [int]: \n"
+      " xenstore_gmfn [int]: \n"
+      " console_domid [int]: \n"
+      " xenstore_domid [int]: \n"
+      "Returns: None on sucess. Raises exception on error.\n" },
+
     { "hvm_get_param", 
       (PyCFunction)pyxc_get_hvm_param, 
       METH_VARARGS | METH_KEYWORDS, "\n"
diff -r 0dcb9d1e7b55 -r 9ad1e42c341b tools/python/xen/xend/XendConstants.py
--- a/tools/python/xen/xend/XendConstants.py	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/python/xen/xend/XendConstants.py	Fri Feb 10 17:24:50 2012 +0000
@@ -52,6 +52,7 @@
 HVM_PARAM_HPET_ENABLED = 11
 HVM_PARAM_ACPI_S_STATE = 14
 HVM_PARAM_VPT_ALIGN    = 16
+HVM_PARAM_CONSOLE_PFN  = 17
 HVM_PARAM_NESTEDHVM    = 24 # x86
 
 restart_modes = [
diff -r 0dcb9d1e7b55 -r 9ad1e42c341b tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/python/xen/xend/image.py	Fri Feb 10 17:24:50 2012 +0000
@@ -971,6 +971,13 @@
         xc.hvm_set_param(self.vm.getDomid(), HVM_PARAM_STORE_EVTCHN,
                          store_evtchn)
 
+        console_mfn = xc.hvm_get_param(self.vm.getDomid(), HVM_PARAM_CONSOLE_PFN)
+        xc.gnttab_hvm_seed(domid = self.vm.getDomid(),
+                           console_gmfn = console_mfn,
+                           xenstore_gmfn = rc['store_mfn'],
+                           console_domid = 0,
+                           xenstore_domid = 0)
+
         return rc
 
 

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:38 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eY-00040j-8a; Sat, 11 Feb 2012 04:33:38 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eW-0003pS-Gw
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:36 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-174.messagelabs.com!1328934807!12749241!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24154 invoked from network); 11 Feb 2012 04:33:29 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:29 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eN-0006SG-EB
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:27 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eN-0001Km-Ct
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:27 +0000
Message-Id: <E1Rw4eN-0001Km-Ct@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:26 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: New sharing audit memop
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328890027 0
# Node ID 0dcb9d1e7b554a9f6f76b62b38a139acf9b2180a
# Parent  ae27691530e7d5047b46bf865fe3dd080a082f75
x86/mm: New sharing audit memop

Remove costly mem_sharing audits from the inline path, and instead make them
callable as a memop.

Have the audit function return the number of errors detected.

Update memshrtool to be able to trigger audits.

Set sharing audits as enabled by default.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: Adin Scannell <adin@scannell.ca>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r ae27691530e7 -r 0dcb9d1e7b55 tools/libxc/xc_memshr.c
--- a/tools/libxc/xc_memshr.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/libxc/xc_memshr.c	Fri Feb 10 16:07:07 2012 +0000
@@ -211,6 +211,17 @@
     return xc_memshr_memop(xch, domid, &mso);
 }
 
+int xc_memshr_audit(xc_interface *xch)
+{
+    xen_mem_sharing_op_t mso;
+
+    memset(&mso, 0, sizeof(mso));
+
+    mso.op = XENMEM_sharing_op_audit;
+
+    return do_memory_op(xch, XENMEM_sharing_op, &mso, sizeof(mso));
+}
+
 long xc_sharing_freed_pages(xc_interface *xch)
 {
     return do_memory_op(xch, XENMEM_get_sharing_freed_pages, NULL, 0);
diff -r ae27691530e7 -r 0dcb9d1e7b55 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/libxc/xenctrl.h	Fri Feb 10 16:07:07 2012 +0000
@@ -1951,6 +1951,7 @@
 int xc_memshr_debug_gref(xc_interface *xch,
                          domid_t domid,
                          grant_ref_t gref);
+int xc_memshr_audit(xc_interface *xch);
 
 int xc_flask_load(xc_interface *xc_handle, char *buf, uint32_t size);
 int xc_flask_context_to_sid(xc_interface *xc_handle, char *buf, uint32_t size, uint32_t *sid);
diff -r ae27691530e7 -r 0dcb9d1e7b55 tools/tests/mem-sharing/memshrtool.c
--- a/tools/tests/mem-sharing/memshrtool.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/tests/mem-sharing/memshrtool.c	Fri Feb 10 16:07:07 2012 +0000
@@ -27,6 +27,7 @@
     printf("  add-to-physmap <domid> <gfn> <source> <source-gfn> <source-handle>\n");
     printf("                          - Populate a page in a domain with a shared page.\n");
     printf("  debug-gfn <domid> <gfn> - Debug a particular domain and gfn.\n");
+    printf("  audit                   - Audit the sharing subsytem in Xen.\n");
     return 1;
 }
 
@@ -160,6 +161,16 @@
         gfn = strtol(argv[3], NULL, 0);
         R(xc_memshr_debug_gfn(xch, domid, gfn));
     }
+    else if( !strcasecmp(cmd, "audit") )
+    {
+        int rc = xc_memshr_audit(xch);
+        if ( rc < 0 )
+        {
+            printf("error executing xc_memshr_audit: %s\n", strerror(errno));
+            return rc;
+        }
+        printf("Audit returned %d errors.\n", rc);
+    }
 
     return 0;
 }
diff -r ae27691530e7 -r 0dcb9d1e7b55 xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/mem_sharing.c	Fri Feb 10 16:07:07 2012 +0000
@@ -50,8 +50,6 @@
 
 #if MEM_SHARING_AUDIT
 
-static void mem_sharing_audit(void);
-
 static struct list_head shr_audit_list;
 static spinlock_t shr_audit_lock;
 DEFINE_RCU_READ_LOCK(shr_audit_read_lock);
@@ -81,7 +79,10 @@
 
 #else
 
-#define mem_sharing_audit() ((void)0)
+int mem_sharing_audit(void)
+{
+    return -ENOSYS;
+}
 
 #define audit_add_list(p)  ((void)0)
 static inline void audit_del_list(struct page_info *page)
@@ -210,7 +211,7 @@
 }
 
 #if MEM_SHARING_AUDIT
-static void mem_sharing_audit(void)
+int mem_sharing_audit(void)
 {
     int errors = 0;
     unsigned long count_expected;
@@ -336,6 +337,7 @@
         errors++;
     }
 
+    return errors;
 }
 #endif
 
@@ -912,7 +914,6 @@
     gfn_info_t *gfn_info = NULL;
     struct list_head *le;
    
-    mem_sharing_audit();
     mfn = get_gfn(d, gfn, &p2mt);
     
     /* Has someone already unshared it? */
@@ -1176,8 +1177,6 @@
             break;
     }
 
-    mem_sharing_audit();
-
     return rc;
 }
 
diff -r ae27691530e7 -r 0dcb9d1e7b55 xen/arch/x86/x86_64/compat/mm.c
--- a/xen/arch/x86/x86_64/compat/mm.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/x86_64/compat/mm.c	Fri Feb 10 16:07:07 2012 +0000
@@ -3,6 +3,7 @@
 #include <compat/memory.h>
 #include <compat/xen.h>
 #include <asm/mem_event.h>
+#include <asm/mem_sharing.h>
 
 int compat_set_gdt(XEN_GUEST_HANDLE(uint) frame_list, unsigned int entries)
 {
@@ -228,6 +229,8 @@
         xen_mem_sharing_op_t mso;
         if ( copy_from_guest(&mso, arg, 1) )
             return -EFAULT;
+        if ( mso.op == XENMEM_sharing_op_audit )
+            return mem_sharing_audit(); 
         rc = do_mem_event_op(op, mso.domain, (void *) &mso);
         if ( !rc && copy_to_guest(arg, &mso, 1) )
             return -EFAULT;
diff -r ae27691530e7 -r 0dcb9d1e7b55 xen/arch/x86/x86_64/mm.c
--- a/xen/arch/x86/x86_64/mm.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/x86_64/mm.c	Fri Feb 10 16:07:07 2012 +0000
@@ -1117,6 +1117,8 @@
         xen_mem_sharing_op_t mso;
         if ( copy_from_guest(&mso, arg, 1) )
             return -EFAULT;
+        if ( mso.op == XENMEM_sharing_op_audit )
+            return mem_sharing_audit(); 
         rc = do_mem_event_op(op, mso.domain, (void *) &mso);
         if ( !rc && copy_to_guest(arg, &mso, 1) )
             return -EFAULT;
diff -r ae27691530e7 -r 0dcb9d1e7b55 xen/include/asm-x86/mem_sharing.h
--- a/xen/include/asm-x86/mem_sharing.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/asm-x86/mem_sharing.h	Fri Feb 10 16:07:07 2012 +0000
@@ -26,7 +26,7 @@
 #include <public/memory.h>
 
 /* Auditing of memory sharing code? */
-#define MEM_SHARING_AUDIT 0
+#define MEM_SHARING_AUDIT 1
 
 typedef uint64_t shr_handle_t; 
 
@@ -61,6 +61,7 @@
                        xen_mem_sharing_op_t *mec);
 int mem_sharing_domctl(struct domain *d, 
                        xen_domctl_mem_sharing_op_t *mec);
+int mem_sharing_audit(void);
 void mem_sharing_init(void);
 
 #else 
diff -r ae27691530e7 -r 0dcb9d1e7b55 xen/include/public/memory.h
--- a/xen/include/public/memory.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/public/memory.h	Fri Feb 10 16:07:07 2012 +0000
@@ -349,6 +349,7 @@
 #define XENMEM_sharing_op_debug_mfn         5
 #define XENMEM_sharing_op_debug_gref        6
 #define XENMEM_sharing_op_add_physmap       7
+#define XENMEM_sharing_op_audit             8
 
 #define XENMEM_SHARING_OP_S_HANDLE_INVALID  (-10)
 #define XENMEM_SHARING_OP_C_HANDLE_INVALID  (-9)

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:38 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eY-00040j-8a; Sat, 11 Feb 2012 04:33:38 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eW-0003pS-Gw
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:36 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-174.messagelabs.com!1328934807!12749241!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24154 invoked from network); 11 Feb 2012 04:33:29 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:29 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eN-0006SG-EB
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:27 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eN-0001Km-Ct
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:27 +0000
Message-Id: <E1Rw4eN-0001Km-Ct@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:26 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: New sharing audit memop
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328890027 0
# Node ID 0dcb9d1e7b554a9f6f76b62b38a139acf9b2180a
# Parent  ae27691530e7d5047b46bf865fe3dd080a082f75
x86/mm: New sharing audit memop

Remove costly mem_sharing audits from the inline path, and instead make them
callable as a memop.

Have the audit function return the number of errors detected.

Update memshrtool to be able to trigger audits.

Set sharing audits as enabled by default.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: Adin Scannell <adin@scannell.ca>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r ae27691530e7 -r 0dcb9d1e7b55 tools/libxc/xc_memshr.c
--- a/tools/libxc/xc_memshr.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/libxc/xc_memshr.c	Fri Feb 10 16:07:07 2012 +0000
@@ -211,6 +211,17 @@
     return xc_memshr_memop(xch, domid, &mso);
 }
 
+int xc_memshr_audit(xc_interface *xch)
+{
+    xen_mem_sharing_op_t mso;
+
+    memset(&mso, 0, sizeof(mso));
+
+    mso.op = XENMEM_sharing_op_audit;
+
+    return do_memory_op(xch, XENMEM_sharing_op, &mso, sizeof(mso));
+}
+
 long xc_sharing_freed_pages(xc_interface *xch)
 {
     return do_memory_op(xch, XENMEM_get_sharing_freed_pages, NULL, 0);
diff -r ae27691530e7 -r 0dcb9d1e7b55 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/libxc/xenctrl.h	Fri Feb 10 16:07:07 2012 +0000
@@ -1951,6 +1951,7 @@
 int xc_memshr_debug_gref(xc_interface *xch,
                          domid_t domid,
                          grant_ref_t gref);
+int xc_memshr_audit(xc_interface *xch);
 
 int xc_flask_load(xc_interface *xc_handle, char *buf, uint32_t size);
 int xc_flask_context_to_sid(xc_interface *xc_handle, char *buf, uint32_t size, uint32_t *sid);
diff -r ae27691530e7 -r 0dcb9d1e7b55 tools/tests/mem-sharing/memshrtool.c
--- a/tools/tests/mem-sharing/memshrtool.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/tests/mem-sharing/memshrtool.c	Fri Feb 10 16:07:07 2012 +0000
@@ -27,6 +27,7 @@
     printf("  add-to-physmap <domid> <gfn> <source> <source-gfn> <source-handle>\n");
     printf("                          - Populate a page in a domain with a shared page.\n");
     printf("  debug-gfn <domid> <gfn> - Debug a particular domain and gfn.\n");
+    printf("  audit                   - Audit the sharing subsytem in Xen.\n");
     return 1;
 }
 
@@ -160,6 +161,16 @@
         gfn = strtol(argv[3], NULL, 0);
         R(xc_memshr_debug_gfn(xch, domid, gfn));
     }
+    else if( !strcasecmp(cmd, "audit") )
+    {
+        int rc = xc_memshr_audit(xch);
+        if ( rc < 0 )
+        {
+            printf("error executing xc_memshr_audit: %s\n", strerror(errno));
+            return rc;
+        }
+        printf("Audit returned %d errors.\n", rc);
+    }
 
     return 0;
 }
diff -r ae27691530e7 -r 0dcb9d1e7b55 xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/mem_sharing.c	Fri Feb 10 16:07:07 2012 +0000
@@ -50,8 +50,6 @@
 
 #if MEM_SHARING_AUDIT
 
-static void mem_sharing_audit(void);
-
 static struct list_head shr_audit_list;
 static spinlock_t shr_audit_lock;
 DEFINE_RCU_READ_LOCK(shr_audit_read_lock);
@@ -81,7 +79,10 @@
 
 #else
 
-#define mem_sharing_audit() ((void)0)
+int mem_sharing_audit(void)
+{
+    return -ENOSYS;
+}
 
 #define audit_add_list(p)  ((void)0)
 static inline void audit_del_list(struct page_info *page)
@@ -210,7 +211,7 @@
 }
 
 #if MEM_SHARING_AUDIT
-static void mem_sharing_audit(void)
+int mem_sharing_audit(void)
 {
     int errors = 0;
     unsigned long count_expected;
@@ -336,6 +337,7 @@
         errors++;
     }
 
+    return errors;
 }
 #endif
 
@@ -912,7 +914,6 @@
     gfn_info_t *gfn_info = NULL;
     struct list_head *le;
    
-    mem_sharing_audit();
     mfn = get_gfn(d, gfn, &p2mt);
     
     /* Has someone already unshared it? */
@@ -1176,8 +1177,6 @@
             break;
     }
 
-    mem_sharing_audit();
-
     return rc;
 }
 
diff -r ae27691530e7 -r 0dcb9d1e7b55 xen/arch/x86/x86_64/compat/mm.c
--- a/xen/arch/x86/x86_64/compat/mm.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/x86_64/compat/mm.c	Fri Feb 10 16:07:07 2012 +0000
@@ -3,6 +3,7 @@
 #include <compat/memory.h>
 #include <compat/xen.h>
 #include <asm/mem_event.h>
+#include <asm/mem_sharing.h>
 
 int compat_set_gdt(XEN_GUEST_HANDLE(uint) frame_list, unsigned int entries)
 {
@@ -228,6 +229,8 @@
         xen_mem_sharing_op_t mso;
         if ( copy_from_guest(&mso, arg, 1) )
             return -EFAULT;
+        if ( mso.op == XENMEM_sharing_op_audit )
+            return mem_sharing_audit(); 
         rc = do_mem_event_op(op, mso.domain, (void *) &mso);
         if ( !rc && copy_to_guest(arg, &mso, 1) )
             return -EFAULT;
diff -r ae27691530e7 -r 0dcb9d1e7b55 xen/arch/x86/x86_64/mm.c
--- a/xen/arch/x86/x86_64/mm.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/x86_64/mm.c	Fri Feb 10 16:07:07 2012 +0000
@@ -1117,6 +1117,8 @@
         xen_mem_sharing_op_t mso;
         if ( copy_from_guest(&mso, arg, 1) )
             return -EFAULT;
+        if ( mso.op == XENMEM_sharing_op_audit )
+            return mem_sharing_audit(); 
         rc = do_mem_event_op(op, mso.domain, (void *) &mso);
         if ( !rc && copy_to_guest(arg, &mso, 1) )
             return -EFAULT;
diff -r ae27691530e7 -r 0dcb9d1e7b55 xen/include/asm-x86/mem_sharing.h
--- a/xen/include/asm-x86/mem_sharing.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/asm-x86/mem_sharing.h	Fri Feb 10 16:07:07 2012 +0000
@@ -26,7 +26,7 @@
 #include <public/memory.h>
 
 /* Auditing of memory sharing code? */
-#define MEM_SHARING_AUDIT 0
+#define MEM_SHARING_AUDIT 1
 
 typedef uint64_t shr_handle_t; 
 
@@ -61,6 +61,7 @@
                        xen_mem_sharing_op_t *mec);
 int mem_sharing_domctl(struct domain *d, 
                        xen_domctl_mem_sharing_op_t *mec);
+int mem_sharing_audit(void);
 void mem_sharing_init(void);
 
 #else 
diff -r ae27691530e7 -r 0dcb9d1e7b55 xen/include/public/memory.h
--- a/xen/include/public/memory.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/public/memory.h	Fri Feb 10 16:07:07 2012 +0000
@@ -349,6 +349,7 @@
 #define XENMEM_sharing_op_debug_mfn         5
 #define XENMEM_sharing_op_debug_gref        6
 #define XENMEM_sharing_op_add_physmap       7
+#define XENMEM_sharing_op_audit             8
 
 #define XENMEM_SHARING_OP_S_HANDLE_INVALID  (-10)
 #define XENMEM_SHARING_OP_C_HANDLE_INVALID  (-9)

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:39 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eZ-000435-HI; Sat, 11 Feb 2012 04:33:39 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eW-0003px-TY
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:37 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-21.messagelabs.com!1328934807!10201363!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21484 invoked from network); 11 Feb 2012 04:33:28 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:28 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eM-0006SB-Sy
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:26 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eM-0001KN-QN
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:26 +0000
Message-Id: <E1Rw4eM-0001KN-QN@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:26 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Use memops for mem paging, sharing,
	and access, instead of domctls
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328890027 0
# Node ID ae27691530e7d5047b46bf865fe3dd080a082f75
# Parent  0362b6cf03bfc41ddc3e1c4f24076730435965dd
Use memops for mem paging, sharing, and access, instead of domctls

Per page operations in the paging, sharing, and access tracking subsystems are
all implemented with domctls (e.g. a domctl to evict one page, or to share one
page).

Under heavy load, the domctl path reveals a lack of scalability. The domctl
lock serializes dom0's vcpus in the hypervisor. When performing thousands of
per-page operations on dozens of domains, these vcpus will spin in the
hypervisor. Beyond the aggressive locking, an added inefficiency of blocking
vcpus in the domctl lock is that dom0 is prevented from re-scheduling any of
its other work-starved processes.

We retain the domctl interface for setting up and tearing down
paging/sharing/mem access for a domain. But we migrate all the per page
operations to use the memory_op hypercalls (e.g XENMEM_*).

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla>
Signed-off-by: Adin Scannell <adin@scannell.ca>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 0362b6cf03bf -r ae27691530e7 tools/libxc/xc_mem_access.c
--- a/tools/libxc/xc_mem_access.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/libxc/xc_mem_access.c	Fri Feb 10 16:07:07 2012 +0000
@@ -30,7 +30,7 @@
     return xc_mem_event_control(xch, domain_id,
                                 XEN_DOMCTL_MEM_EVENT_OP_ACCESS_ENABLE,
                                 XEN_DOMCTL_MEM_EVENT_OP_ACCESS,
-                                shared_page, ring_page, INVALID_MFN);
+                                shared_page, ring_page);
 }
 
 int xc_mem_access_disable(xc_interface *xch, domid_t domain_id)
@@ -38,15 +38,15 @@
     return xc_mem_event_control(xch, domain_id,
                                 XEN_DOMCTL_MEM_EVENT_OP_ACCESS_DISABLE,
                                 XEN_DOMCTL_MEM_EVENT_OP_ACCESS,
-                                NULL, NULL, INVALID_MFN);
+                                NULL, NULL);
 }
 
 int xc_mem_access_resume(xc_interface *xch, domid_t domain_id, unsigned long gfn)
 {
-    return xc_mem_event_control(xch, domain_id,
-                                XEN_DOMCTL_MEM_EVENT_OP_ACCESS_RESUME,
-                                XEN_DOMCTL_MEM_EVENT_OP_ACCESS,
-                                NULL, NULL, gfn);
+    return xc_mem_event_memop(xch, domain_id,
+                                XENMEM_access_op_resume,
+                                XENMEM_access_op,
+                                gfn, NULL);
 }
 
 /*
diff -r 0362b6cf03bf -r ae27691530e7 tools/libxc/xc_mem_event.c
--- a/tools/libxc/xc_mem_event.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/libxc/xc_mem_event.c	Fri Feb 10 16:07:07 2012 +0000
@@ -24,8 +24,7 @@
 #include "xc_private.h"
 
 int xc_mem_event_control(xc_interface *xch, domid_t domain_id, unsigned int op,
-                         unsigned int mode, void *page,
-                         void *ring_page, unsigned long gfn)
+                         unsigned int mode, void *page, void *ring_page)
 {
     DECLARE_DOMCTL;
 
@@ -34,11 +33,25 @@
     domctl.u.mem_event_op.op = op;
     domctl.u.mem_event_op.mode = mode;
 
-    domctl.u.mem_event_op.u.shared_addr = (unsigned long)page;
+    domctl.u.mem_event_op.shared_addr = (unsigned long)page;
     domctl.u.mem_event_op.ring_addr = (unsigned long)ring_page;
-
-    domctl.u.mem_event_op.gfn = gfn;
     
     return do_domctl(xch, &domctl);
 }
 
+int xc_mem_event_memop(xc_interface *xch, domid_t domain_id, 
+                        unsigned int op, unsigned int mode,
+                        uint64_t gfn, void *buffer)
+{
+    xen_mem_event_op_t meo;
+
+    memset(&meo, 0, sizeof(meo));
+
+    meo.op      = op;
+    meo.domain  = domain_id;
+    meo.gfn     = gfn;
+    meo.buffer  = (unsigned long) buffer;
+
+    return do_memory_op(xch, mode, &meo, sizeof(meo));
+}
+
diff -r 0362b6cf03bf -r ae27691530e7 tools/libxc/xc_mem_paging.c
--- a/tools/libxc/xc_mem_paging.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/libxc/xc_mem_paging.c	Fri Feb 10 16:07:07 2012 +0000
@@ -30,7 +30,7 @@
     return xc_mem_event_control(xch, domain_id,
                                 XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE,
                                 XEN_DOMCTL_MEM_EVENT_OP_PAGING,
-                                shared_page, ring_page, INVALID_MFN);
+                                shared_page, ring_page);
 }
 
 int xc_mem_paging_disable(xc_interface *xch, domid_t domain_id)
@@ -38,31 +38,31 @@
     return xc_mem_event_control(xch, domain_id,
                                 XEN_DOMCTL_MEM_EVENT_OP_PAGING_DISABLE,
                                 XEN_DOMCTL_MEM_EVENT_OP_PAGING,
-                                NULL, NULL, INVALID_MFN);
+                                NULL, NULL);
 }
 
 int xc_mem_paging_nominate(xc_interface *xch, domid_t domain_id, unsigned long gfn)
 {
-    return xc_mem_event_control(xch, domain_id,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING_NOMINATE,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING,
-                                NULL, NULL, gfn);
+    return xc_mem_event_memop(xch, domain_id,
+                                XENMEM_paging_op_nominate,
+                                XENMEM_paging_op,
+                                gfn, NULL);
 }
 
 int xc_mem_paging_evict(xc_interface *xch, domid_t domain_id, unsigned long gfn)
 {
-    return xc_mem_event_control(xch, domain_id,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING_EVICT,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING,
-                                NULL, NULL, gfn);
+    return xc_mem_event_memop(xch, domain_id,
+                                XENMEM_paging_op_evict,
+                                XENMEM_paging_op,
+                                gfn, NULL);
 }
 
 int xc_mem_paging_prep(xc_interface *xch, domid_t domain_id, unsigned long gfn)
 {
-    return xc_mem_event_control(xch, domain_id,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING,
-                                NULL, NULL, gfn);
+    return xc_mem_event_memop(xch, domain_id,
+                                XENMEM_paging_op_prep,
+                                XENMEM_paging_op,
+                                gfn, NULL);
 }
 
 int xc_mem_paging_load(xc_interface *xch, domid_t domain_id, 
@@ -81,10 +81,10 @@
     if ( mlock(buffer, XC_PAGE_SIZE) )
         return -1;
         
-    rc = xc_mem_event_control(xch, domain_id,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING,
-                                buffer, NULL, gfn);
+    rc = xc_mem_event_memop(xch, domain_id,
+                                XENMEM_paging_op_prep,
+                                XENMEM_paging_op,
+                                gfn, buffer);
 
     old_errno = errno;
     munlock(buffer, XC_PAGE_SIZE);
@@ -95,10 +95,10 @@
 
 int xc_mem_paging_resume(xc_interface *xch, domid_t domain_id, unsigned long gfn)
 {
-    return xc_mem_event_control(xch, domain_id,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING_RESUME,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING,
-                                NULL, NULL, gfn);
+    return xc_mem_event_memop(xch, domain_id,
+                                XENMEM_paging_op_resume,
+                                XENMEM_paging_op,
+                                gfn, NULL);
 }
 
 
diff -r 0362b6cf03bf -r ae27691530e7 tools/libxc/xc_memshr.c
--- a/tools/libxc/xc_memshr.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/libxc/xc_memshr.c	Fri Feb 10 16:07:07 2012 +0000
@@ -36,32 +36,38 @@
     domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
     domctl.domain = domid;
     op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_CONTROL;
+    op->op = XEN_DOMCTL_MEM_SHARING_CONTROL;
     op->u.enable = enable;
 
     return do_domctl(xch, &domctl);
 }
 
+static int xc_memshr_memop(xc_interface *xch, domid_t domid, 
+                            xen_mem_sharing_op_t *mso)
+{
+    mso->domain = domid;
+
+    return do_memory_op(xch, XENMEM_sharing_op, mso, sizeof(*mso));
+}
+
 int xc_memshr_nominate_gfn(xc_interface *xch,
                            domid_t domid,
                            unsigned long gfn,
                            uint64_t *handle)
 {
-    DECLARE_DOMCTL;
-    struct xen_domctl_mem_sharing_op *op;
-    int ret;
+    int rc;
+    xen_mem_sharing_op_t mso;
 
-    domctl.cmd = XEN_DOMCTL_mem_sharing_op;
-    domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
-    domctl.domain = domid;
-    op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GFN;
-    op->u.nominate.u.gfn = gfn;
+    memset(&mso, 0, sizeof(mso));
 
-    ret = do_domctl(xch, &domctl);
-    if(!ret) *handle = op->u.nominate.handle; 
+    mso.op = XENMEM_sharing_op_nominate_gfn;
+    mso.u.nominate.u.gfn = gfn; 
 
-    return ret;
+    rc = xc_memshr_memop(xch, domid, &mso);
+
+    if (!rc) *handle = mso.u.nominate.handle; 
+
+    return rc;
 }
 
 int xc_memshr_nominate_gref(xc_interface *xch,
@@ -69,21 +75,19 @@
                             grant_ref_t gref,
                             uint64_t *handle)
 {
-    DECLARE_DOMCTL;
-    struct xen_domctl_mem_sharing_op *op;
-    int ret;
+    int rc;
+    xen_mem_sharing_op_t mso;
 
-    domctl.cmd = XEN_DOMCTL_mem_sharing_op;
-    domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
-    domctl.domain = domid;
-    op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GREF;
-    op->u.nominate.u.grant_ref = gref;
+    memset(&mso, 0, sizeof(mso));
 
-    ret = do_domctl(xch, &domctl);
-    if(!ret) *handle = op->u.nominate.handle; 
+    mso.op = XENMEM_sharing_op_nominate_gref;
+    mso.u.nominate.u.grant_ref = gref; 
 
-    return ret;
+    rc = xc_memshr_memop(xch, domid, &mso);
+
+    if (!rc) *handle = mso.u.nominate.handle; 
+
+    return rc;
 }
 
 int xc_memshr_share_gfns(xc_interface *xch,
@@ -94,21 +98,19 @@
                          unsigned long client_gfn,
                          uint64_t client_handle)
 {
-    DECLARE_DOMCTL;
-    struct xen_domctl_mem_sharing_op *op;
+    xen_mem_sharing_op_t mso;
 
-    domctl.cmd = XEN_DOMCTL_mem_sharing_op;
-    domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
-    domctl.domain = source_domain;
-    op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_SHARE;
-    op->u.share.source_handle = source_handle;
-    op->u.share.source_gfn    = source_gfn;
-    op->u.share.client_domain = client_domain;
-    op->u.share.client_gfn    = client_gfn;
-    op->u.share.client_handle = client_handle;
+    memset(&mso, 0, sizeof(mso));
 
-    return do_domctl(xch, &domctl);
+    mso.op = XENMEM_sharing_op_share;
+
+    mso.u.share.source_handle = source_handle;
+    mso.u.share.source_gfn    = source_gfn;
+    mso.u.share.client_domain = client_domain;
+    mso.u.share.client_gfn    = client_gfn;
+    mso.u.share.client_handle = client_handle;
+
+    return xc_memshr_memop(xch, source_domain, &mso);
 }
 
 int xc_memshr_share_grefs(xc_interface *xch,
@@ -119,21 +121,19 @@
                           grant_ref_t client_gref,
                           uint64_t client_handle)
 {
-    DECLARE_DOMCTL;
-    struct xen_domctl_mem_sharing_op *op;
+    xen_mem_sharing_op_t mso;
 
-    domctl.cmd = XEN_DOMCTL_mem_sharing_op;
-    domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
-    domctl.domain = source_domain;
-    op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_SHARE;
-    op->u.share.source_handle = source_handle;
-    XEN_DOMCTL_MEM_SHARING_FIELD_MAKE_GREF(op->u.share.source_gfn, source_gref);
-    op->u.share.client_domain = client_domain;
-    XEN_DOMCTL_MEM_SHARING_FIELD_MAKE_GREF(op->u.share.client_gfn, client_gref);
-    op->u.share.client_handle = client_handle;
+    memset(&mso, 0, sizeof(mso));
 
-    return do_domctl(xch, &domctl);
+    mso.op = XENMEM_sharing_op_share;
+
+    mso.u.share.source_handle = source_handle;
+    XENMEM_SHARING_OP_FIELD_MAKE_GREF(mso.u.share.source_gfn, source_gref);
+    mso.u.share.client_domain = client_domain;
+    XENMEM_SHARING_OP_FIELD_MAKE_GREF(mso.u.share.client_gfn, client_gref);
+    mso.u.share.client_handle = client_handle;
+
+    return xc_memshr_memop(xch, source_domain, &mso);
 }
 
 int xc_memshr_add_to_physmap(xc_interface *xch,
@@ -143,86 +143,72 @@
                     domid_t client_domain,
                     unsigned long client_gfn)
 {
-    DECLARE_DOMCTL;
-    struct xen_domctl_mem_sharing_op *op;
+    xen_mem_sharing_op_t mso;
 
-    domctl.cmd                  = XEN_DOMCTL_mem_sharing_op;
-    domctl.interface_version    = XEN_DOMCTL_INTERFACE_VERSION;
-    domctl.domain               = source_domain;
-    op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_ADD_PHYSMAP;
-    op->u.share.source_gfn      = source_gfn;
-    op->u.share.source_handle   = source_handle;
-    op->u.share.client_gfn      = client_gfn;
-    op->u.share.client_domain   = client_domain;
+    memset(&mso, 0, sizeof(mso));
 
-    return do_domctl(xch, &domctl);
+    mso.op = XENMEM_sharing_op_add_physmap;
+
+    mso.u.share.source_handle = source_handle;
+    mso.u.share.source_gfn    = source_gfn;
+    mso.u.share.client_domain = client_domain;
+    mso.u.share.client_gfn    = client_gfn;
+
+    return xc_memshr_memop(xch, source_domain, &mso);
 }
 
 int xc_memshr_domain_resume(xc_interface *xch,
                             domid_t domid)
 {
-    DECLARE_DOMCTL;
-    struct xen_domctl_mem_sharing_op *op;
+    xen_mem_sharing_op_t mso;
 
-    domctl.cmd = XEN_DOMCTL_mem_sharing_op;
-    domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
-    domctl.domain = domid;
-    op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_RESUME;
+    memset(&mso, 0, sizeof(mso));
 
-    return do_domctl(xch, &domctl);
+    mso.op = XENMEM_sharing_op_resume;
+
+    return xc_memshr_memop(xch, domid, &mso);
 }
 
 int xc_memshr_debug_gfn(xc_interface *xch,
                         domid_t domid,
                         unsigned long gfn)
 {
-    DECLARE_DOMCTL;
-    struct xen_domctl_mem_sharing_op *op;
+    xen_mem_sharing_op_t mso;
 
-    domctl.cmd = XEN_DOMCTL_mem_sharing_op;
-    domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
-    domctl.domain = domid;
-    op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GFN;
-    op->u.debug.u.gfn = gfn;
+    memset(&mso, 0, sizeof(mso));
 
-    return do_domctl(xch, &domctl);
+    mso.op = XENMEM_sharing_op_debug_gfn;
+    mso.u.debug.u.gfn = gfn; 
+
+    return xc_memshr_memop(xch, domid, &mso);
 }
 
 int xc_memshr_debug_mfn(xc_interface *xch,
                         domid_t domid,
                         unsigned long mfn)
 {
-    DECLARE_DOMCTL;
-    struct xen_domctl_mem_sharing_op *op;
+    xen_mem_sharing_op_t mso;
 
-    domctl.cmd = XEN_DOMCTL_mem_sharing_op;
-    domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
-    domctl.domain = domid;
-    op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_MFN;
-    op->u.debug.u.mfn = mfn;
+    memset(&mso, 0, sizeof(mso));
 
-    return do_domctl(xch, &domctl);
+    mso.op = XENMEM_sharing_op_debug_mfn;
+    mso.u.debug.u.mfn = mfn; 
+
+    return xc_memshr_memop(xch, domid, &mso);
 }
 
 int xc_memshr_debug_gref(xc_interface *xch,
                          domid_t domid,
                          grant_ref_t gref)
 {
-    DECLARE_DOMCTL;
-    struct xen_domctl_mem_sharing_op *op;
+    xen_mem_sharing_op_t mso;
 
-    domctl.cmd = XEN_DOMCTL_mem_sharing_op;
-    domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
-    domctl.domain = domid;
-    op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GREF;
-    op->u.debug.u.gref = gref;
+    memset(&mso, 0, sizeof(mso));
 
-    return do_domctl(xch, &domctl);
+    mso.op = XENMEM_sharing_op_debug_gref;
+    mso.u.debug.u.gref = gref; 
+
+    return xc_memshr_memop(xch, domid, &mso);
 }
 
 long xc_sharing_freed_pages(xc_interface *xch)
diff -r 0362b6cf03bf -r ae27691530e7 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/libxc/xenctrl.h	Fri Feb 10 16:07:07 2012 +0000
@@ -1883,8 +1883,10 @@
  * mem_event operations
  */
 int xc_mem_event_control(xc_interface *xch, domid_t domain_id, unsigned int op,
-                         unsigned int mode, void *shared_page,
-                          void *ring_page, unsigned long gfn);
+                         unsigned int mode, void *shared_page, void *ring_page);
+int xc_mem_event_memop(xc_interface *xch, domid_t domain_id, 
+                        unsigned int op, unsigned int mode,
+                        uint64_t gfn, void *buffer);
 
 int xc_mem_paging_enable(xc_interface *xch, domid_t domain_id,
                         void *shared_page, void *ring_page);
diff -r 0362b6cf03bf -r ae27691530e7 tools/memshr/interface.c
--- a/tools/memshr/interface.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/memshr/interface.c	Fri Feb 10 16:07:07 2012 +0000
@@ -186,12 +186,12 @@
            remove the relevant ones from the map */
         switch(ret)
         {
-            case XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID:
+            case XENMEM_SHARING_OP_S_HANDLE_INVALID:
                 ret = blockshr_shrhnd_remove(memshr.blks, source_st, NULL);
                 if(ret) DPRINTF("Could not rm invl s_hnd: %u %"PRId64" %"PRId64"\n", 
                                     source_st.domain, source_st.frame, source_st.handle);
                 break;
-            case XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID:
+            case XENMEM_SHARING_OP_C_HANDLE_INVALID:
                 ret = blockshr_shrhnd_remove(memshr.blks, client_st, NULL);
                 if(ret) DPRINTF("Could not rm invl c_hnd: %u %"PRId64" %"PRId64"\n", 
                                     client_st.domain, client_st.frame, client_st.handle);
diff -r 0362b6cf03bf -r ae27691530e7 tools/tests/mem-sharing/memshrtool.c
--- a/tools/tests/mem-sharing/memshrtool.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/tests/mem-sharing/memshrtool.c	Fri Feb 10 16:07:07 2012 +0000
@@ -34,9 +34,9 @@
     int rc = f; \
     if ( rc < 0 ) { \
         printf("error executing %s: %s\n", #f, \
-                ((errno * -1) == XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID) ? \
+                ((errno * -1) == XENMEM_SHARING_OP_S_HANDLE_INVALID) ? \
                 "problem with client handle" :\
-                ((errno * -1) == XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID) ? \
+                ((errno * -1) == XENMEM_SHARING_OP_C_HANDLE_INVALID) ? \
                 "problem with source handle" : strerror(errno)); \
         return rc; \
     } \
diff -r 0362b6cf03bf -r ae27691530e7 xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/domctl.c	Fri Feb 10 16:07:07 2012 +0000
@@ -1463,7 +1463,6 @@
             if ( !ret )
                 ret = mem_sharing_domctl(d, &domctl->u.mem_sharing_op);
             rcu_unlock_domain(d);
-            copy_to_guest(u_domctl, domctl, 1);
         } 
     }
     break;
diff -r 0362b6cf03bf -r ae27691530e7 xen/arch/x86/mm/mem_access.c
--- a/xen/arch/x86/mm/mem_access.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/mem_access.c	Fri Feb 10 16:07:07 2012 +0000
@@ -25,14 +25,13 @@
 #include <asm/mem_event.h>
 
 
-int mem_access_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec,
-                      XEN_GUEST_HANDLE(void) u_domctl)
+int mem_access_memop(struct domain *d, xen_mem_event_op_t *meo)
 {
     int rc;
 
-    switch( mec->op )
+    switch( meo->op )
     {
-    case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_RESUME:
+    case XENMEM_access_op_resume:
     {
         p2m_mem_access_resume(d);
         rc = 0;
diff -r 0362b6cf03bf -r ae27691530e7 xen/arch/x86/mm/mem_event.c
--- a/xen/arch/x86/mm/mem_event.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/mem_event.c	Fri Feb 10 16:07:07 2012 +0000
@@ -28,6 +28,7 @@
 #include <asm/mem_event.h>
 #include <asm/mem_paging.h>
 #include <asm/mem_access.h>
+#include <asm/mem_sharing.h>
 
 /* for public/io/ring.h macros */
 #define xen_mb()   mb()
@@ -49,7 +50,7 @@
     struct domain *dom_mem_event = current->domain;
     struct vcpu *v = current;
     unsigned long ring_addr = mec->ring_addr;
-    unsigned long shared_addr = mec->u.shared_addr;
+    unsigned long shared_addr = mec->shared_addr;
     l1_pgentry_t l1e;
     unsigned long shared_gfn = 0, ring_gfn = 0; /* gcc ... */
     p2m_type_t p2mt;
@@ -460,6 +461,54 @@
     p2m_mem_access_resume(v->domain);
 }
 
+struct domain *get_mem_event_op_target(uint32_t domain, int *rc)
+{
+    struct domain *d;
+
+    /* Get the target domain */
+    *rc = rcu_lock_remote_target_domain_by_id(domain, &d);
+    if ( *rc != 0 )
+        return NULL;
+
+    /* Not dying? */
+    if ( d->is_dying )
+    {
+        rcu_unlock_domain(d);
+        *rc = -EINVAL;
+        return NULL;
+    }
+    
+    return d;
+}
+
+int do_mem_event_op(int op, uint32_t domain, void *arg)
+{
+    int ret;
+    struct domain *d;
+
+    d = get_mem_event_op_target(domain, &ret);
+    if ( !d )
+        return ret;
+
+    switch (op)
+    {
+        case XENMEM_paging_op:
+            ret = mem_paging_memop(d, (xen_mem_event_op_t *) arg);
+            break;
+        case XENMEM_access_op:
+            ret = mem_access_memop(d, (xen_mem_event_op_t *) arg);
+            break;
+        case XENMEM_sharing_op:
+            ret = mem_sharing_memop(d, (xen_mem_sharing_op_t *) arg);
+            break;
+        default:
+            ret = -ENOSYS;
+    }
+
+    rcu_unlock_domain(d);
+    return ret;
+}
+
 int mem_event_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec,
                      XEN_GUEST_HANDLE(void) u_domctl)
 {
@@ -533,11 +582,8 @@
         break;
 
         default:
-        {
-            if ( med->ring_page )
-                rc = mem_paging_domctl(d, mec, u_domctl);
-        }
-        break;
+            rc = -ENOSYS;
+            break;
         }
     }
     break;
@@ -572,14 +618,14 @@
         break;
 
         default:
-        {
-            if ( med->ring_page )
-                rc = mem_access_domctl(d, mec, u_domctl);
-        }
-        break;
+            rc = -ENOSYS;
+            break;
         }
     }
     break;
+
+    default:
+        rc = -ENOSYS;
     }
 
     return rc;
diff -r 0362b6cf03bf -r ae27691530e7 xen/arch/x86/mm/mem_paging.c
--- a/xen/arch/x86/mm/mem_paging.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/mem_paging.c	Fri Feb 10 16:07:07 2012 +0000
@@ -25,33 +25,32 @@
 #include <asm/mem_event.h>
 
 
-int mem_paging_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec,
-                      XEN_GUEST_HANDLE(void) u_domctl)
+int mem_paging_memop(struct domain *d, xen_mem_event_op_t *mec)
 {
     switch( mec->op )
     {
-    case XEN_DOMCTL_MEM_EVENT_OP_PAGING_NOMINATE:
+    case XENMEM_paging_op_nominate:
     {
         unsigned long gfn = mec->gfn;
         return p2m_mem_paging_nominate(d, gfn);
     }
     break;
 
-    case XEN_DOMCTL_MEM_EVENT_OP_PAGING_EVICT:
+    case XENMEM_paging_op_evict:
     {
         unsigned long gfn = mec->gfn;
         return p2m_mem_paging_evict(d, gfn);
     }
     break;
 
-    case XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP:
+    case XENMEM_paging_op_prep:
     {
         unsigned long gfn = mec->gfn;
-        return p2m_mem_paging_prep(d, gfn, mec->u.buffer);
+        return p2m_mem_paging_prep(d, gfn, mec->buffer);
     }
     break;
 
-    case XEN_DOMCTL_MEM_EVENT_OP_PAGING_RESUME:
+    case XENMEM_paging_op_resume:
     {
         p2m_mem_paging_resume(d);
         return 0;
diff -r 0362b6cf03bf -r ae27691530e7 xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/mem_sharing.c	Fri Feb 10 16:07:07 2012 +0000
@@ -747,12 +747,12 @@
     }
     else if ( mfn_x(smfn) < mfn_x(cmfn) )
     {
-        ret = XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID;
+        ret = XENMEM_SHARING_OP_S_HANDLE_INVALID;
         spage = firstpg = __grab_shared_page(smfn);
         if ( spage == NULL )
             goto err_out;
 
-        ret = XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID;
+        ret = XENMEM_SHARING_OP_C_HANDLE_INVALID;
         cpage = secondpg = __grab_shared_page(cmfn);
         if ( cpage == NULL )
         {
@@ -760,12 +760,12 @@
             goto err_out;
         }
     } else {
-        ret = XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID;
+        ret = XENMEM_SHARING_OP_C_HANDLE_INVALID;
         cpage = firstpg = __grab_shared_page(cmfn);
         if ( cpage == NULL )
             goto err_out;
 
-        ret = XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID;
+        ret = XENMEM_SHARING_OP_S_HANDLE_INVALID;
         spage = secondpg = __grab_shared_page(smfn);
         if ( spage == NULL )
         {
@@ -780,14 +780,14 @@
     /* Check that the handles match */
     if ( spage->sharing->handle != sh )
     {
-        ret = XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID;
+        ret = XENMEM_SHARING_OP_S_HANDLE_INVALID;
         mem_sharing_page_unlock(secondpg);
         mem_sharing_page_unlock(firstpg);
         goto err_out;
     }
     if ( cpage->sharing->handle != ch )
     {
-        ret = XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID;
+        ret = XENMEM_SHARING_OP_C_HANDLE_INVALID;
         mem_sharing_page_unlock(secondpg);
         mem_sharing_page_unlock(firstpg);
         goto err_out;
@@ -849,7 +849,7 @@
                  p2m_query, &tg);
 
     /* Get the source shared page, check and lock */
-    ret = XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID;
+    ret = XENMEM_SHARING_OP_S_HANDLE_INVALID;
     spage = __grab_shared_page(smfn);
     if ( spage == NULL )
         goto err_out;
@@ -863,7 +863,7 @@
     if ( mfn_valid(cmfn) ||
          (!(p2m_is_ram(cmfn_type))) )
     {
-        ret = XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID;
+        ret = XENMEM_SHARING_OP_C_HANDLE_INVALID;
         goto err_unlock;
     }
 
@@ -1014,9 +1014,9 @@
     return 0;
 }
 
-int mem_sharing_domctl(struct domain *d, xen_domctl_mem_sharing_op_t *mec)
+int mem_sharing_memop(struct domain *d, xen_mem_sharing_op_t *mec)
 {
-    int rc;
+    int rc = 0;
 
     /* Only HAP is supported */
     if ( !hap_enabled(d) )
@@ -1024,14 +1024,7 @@
 
     switch(mec->op)
     {
-        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_CONTROL:
-        {
-            d->arch.hvm_domain.mem_sharing_enabled = mec->u.enable;
-            rc = 0;
-        }
-        break;
-
-        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GFN:
+        case XENMEM_sharing_op_nominate_gfn:
         {
             unsigned long gfn = mec->u.nominate.u.gfn;
             shr_handle_t handle;
@@ -1042,7 +1035,7 @@
         }
         break;
 
-        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GREF:
+        case XENMEM_sharing_op_nominate_gref:
         {
             grant_ref_t gref = mec->u.nominate.u.grant_ref;
             unsigned long gfn;
@@ -1057,7 +1050,7 @@
         }
         break;
 
-        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_SHARE:
+        case XENMEM_sharing_op_share:
         {
             unsigned long sgfn, cgfn;
             struct domain *cd;
@@ -1066,38 +1059,38 @@
             if ( !mem_sharing_enabled(d) )
                 return -EINVAL;
 
-            cd = get_domain_by_id(mec->u.share.client_domain);
+            cd = get_mem_event_op_target(mec->u.share.client_domain, &rc);
             if ( !cd )
-                return -ESRCH;
+                return rc;
 
             if ( !mem_sharing_enabled(cd) )
             {
-                put_domain(cd);
+                rcu_unlock_domain(cd);
                 return -EINVAL;
             }
 
-            if ( XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF(mec->u.share.source_gfn) )
+            if ( XENMEM_SHARING_OP_FIELD_IS_GREF(mec->u.share.source_gfn) )
             {
                 grant_ref_t gref = (grant_ref_t) 
-                                    (XEN_DOMCTL_MEM_SHARING_FIELD_GET_GREF(
+                                    (XENMEM_SHARING_OP_FIELD_GET_GREF(
                                         mec->u.share.source_gfn));
                 if ( mem_sharing_gref_to_gfn(d, gref, &sgfn) < 0 )
                 {
-                    put_domain(cd);
+                    rcu_unlock_domain(cd);
                     return -EINVAL;
                 }
             } else {
                 sgfn  = mec->u.share.source_gfn;
             }
 
-            if ( XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF(mec->u.share.client_gfn) )
+            if ( XENMEM_SHARING_OP_FIELD_IS_GREF(mec->u.share.client_gfn) )
             {
                 grant_ref_t gref = (grant_ref_t) 
-                                    (XEN_DOMCTL_MEM_SHARING_FIELD_GET_GREF(
+                                    (XENMEM_SHARING_OP_FIELD_GET_GREF(
                                         mec->u.share.client_gfn));
                 if ( mem_sharing_gref_to_gfn(cd, gref, &cgfn) < 0 )
                 {
-                    put_domain(cd);
+                    rcu_unlock_domain(cd);
                     return -EINVAL;
                 }
             } else {
@@ -1109,11 +1102,11 @@
 
             rc = mem_sharing_share_pages(d, sgfn, sh, cd, cgfn, ch); 
 
-            put_domain(cd);
+            rcu_unlock_domain(cd);
         }
         break;
 
-        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_ADD_PHYSMAP:
+        case XENMEM_sharing_op_add_physmap:
         {
             unsigned long sgfn, cgfn;
             struct domain *cd;
@@ -1122,20 +1115,20 @@
             if ( !mem_sharing_enabled(d) )
                 return -EINVAL;
 
-            cd = get_domain_by_id(mec->u.share.client_domain);
+            cd = get_mem_event_op_target(mec->u.share.client_domain, &rc);
             if ( !cd )
-                return -ESRCH;
+                return rc;
 
             if ( !mem_sharing_enabled(cd) )
             {
-                put_domain(cd);
+                rcu_unlock_domain(cd);
                 return -EINVAL;
             }
 
-            if ( XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF(mec->u.share.source_gfn) )
+            if ( XENMEM_SHARING_OP_FIELD_IS_GREF(mec->u.share.source_gfn) )
             {
                 /* Cannot add a gref to the physmap */
-                put_domain(cd);
+                rcu_unlock_domain(cd);
                 return -EINVAL;
             }
 
@@ -1145,11 +1138,11 @@
 
             rc = mem_sharing_add_to_physmap(d, sgfn, sh, cd, cgfn); 
 
-            put_domain(cd);
+            rcu_unlock_domain(cd);
         }
         break;
 
-        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_RESUME:
+        case XENMEM_sharing_op_resume:
         {
             if ( !mem_sharing_enabled(d) )
                 return -EINVAL;
@@ -1157,21 +1150,21 @@
         }
         break;
 
-        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GFN:
+        case XENMEM_sharing_op_debug_gfn:
         {
             unsigned long gfn = mec->u.debug.u.gfn;
             rc = mem_sharing_debug_gfn(d, gfn);
         }
         break;
 
-        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_MFN:
+        case XENMEM_sharing_op_debug_mfn:
         {
             unsigned long mfn = mec->u.debug.u.mfn;
             rc = mem_sharing_debug_mfn(_mfn(mfn));
         }
         break;
 
-        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GREF:
+        case XENMEM_sharing_op_debug_gref:
         {
             grant_ref_t gref = mec->u.debug.u.gref;
             rc = mem_sharing_debug_gref(d, gref);
@@ -1188,6 +1181,30 @@
     return rc;
 }
 
+int mem_sharing_domctl(struct domain *d, xen_domctl_mem_sharing_op_t *mec)
+{
+    int rc;
+
+    /* Only HAP is supported */
+    if ( !hap_enabled(d) )
+         return -ENODEV;
+
+    switch(mec->op)
+    {
+        case XEN_DOMCTL_MEM_SHARING_CONTROL:
+        {
+            d->arch.hvm_domain.mem_sharing_enabled = mec->u.enable;
+            rc = 0;
+        }
+        break;
+
+        default:
+            rc = -ENOSYS;
+    }
+
+    return rc;
+}
+
 void __init mem_sharing_init(void)
 {
     printk("Initing memory sharing.\n");
diff -r 0362b6cf03bf -r ae27691530e7 xen/arch/x86/x86_64/compat/mm.c
--- a/xen/arch/x86/x86_64/compat/mm.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/x86_64/compat/mm.c	Fri Feb 10 16:07:07 2012 +0000
@@ -2,6 +2,7 @@
 #include <xen/multicall.h>
 #include <compat/memory.h>
 #include <compat/xen.h>
+#include <asm/mem_event.h>
 
 int compat_set_gdt(XEN_GUEST_HANDLE(uint) frame_list, unsigned int entries)
 {
@@ -211,6 +212,28 @@
     case XENMEM_get_sharing_shared_pages:
         return mem_sharing_get_nr_shared_mfns();
 
+    case XENMEM_paging_op:
+    case XENMEM_access_op:
+    {
+        xen_mem_event_op_t meo;
+        if ( copy_from_guest(&meo, arg, 1) )
+            return -EFAULT;
+        rc = do_mem_event_op(op, meo.domain, (void *) &meo);
+        if ( !rc && copy_to_guest(arg, &meo, 1) )
+            return -EFAULT;
+        break;
+    }
+    case XENMEM_sharing_op:
+    {
+        xen_mem_sharing_op_t mso;
+        if ( copy_from_guest(&mso, arg, 1) )
+            return -EFAULT;
+        rc = do_mem_event_op(op, mso.domain, (void *) &mso);
+        if ( !rc && copy_to_guest(arg, &mso, 1) )
+            return -EFAULT;
+        break;
+    }
+
     default:
         rc = -ENOSYS;
         break;
diff -r 0362b6cf03bf -r ae27691530e7 xen/arch/x86/x86_64/mm.c
--- a/xen/arch/x86/x86_64/mm.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/x86_64/mm.c	Fri Feb 10 16:07:07 2012 +0000
@@ -34,6 +34,7 @@
 #include <asm/msr.h>
 #include <asm/setup.h>
 #include <asm/numa.h>
+#include <asm/mem_event.h>
 #include <asm/mem_sharing.h>
 #include <public/memory.h>
 
@@ -1100,6 +1101,28 @@
     case XENMEM_get_sharing_shared_pages:
         return mem_sharing_get_nr_shared_mfns();
 
+    case XENMEM_paging_op:
+    case XENMEM_access_op:
+    {
+        xen_mem_event_op_t meo;
+        if ( copy_from_guest(&meo, arg, 1) )
+            return -EFAULT;
+        rc = do_mem_event_op(op, meo.domain, (void *) &meo);
+        if ( !rc && copy_to_guest(arg, &meo, 1) )
+            return -EFAULT;
+        break;
+    }
+    case XENMEM_sharing_op:
+    {
+        xen_mem_sharing_op_t mso;
+        if ( copy_from_guest(&mso, arg, 1) )
+            return -EFAULT;
+        rc = do_mem_event_op(op, mso.domain, (void *) &mso);
+        if ( !rc && copy_to_guest(arg, &mso, 1) )
+            return -EFAULT;
+        break;
+    }
+
     default:
         rc = -ENOSYS;
         break;
diff -r 0362b6cf03bf -r ae27691530e7 xen/include/asm-x86/mem_access.h
--- a/xen/include/asm-x86/mem_access.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/asm-x86/mem_access.h	Fri Feb 10 16:07:07 2012 +0000
@@ -21,8 +21,7 @@
  */
 
 
-int mem_access_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec,
-                      XEN_GUEST_HANDLE(void) u_domctl);
+int mem_access_memop(struct domain *d, xen_mem_event_op_t *meo);
 int mem_access_send_req(struct domain *d, mem_event_request_t *req);
 
 
diff -r 0362b6cf03bf -r ae27691530e7 xen/include/asm-x86/mem_event.h
--- a/xen/include/asm-x86/mem_event.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/asm-x86/mem_event.h	Fri Feb 10 16:07:07 2012 +0000
@@ -42,6 +42,8 @@
 int mem_event_get_response(struct domain *d, struct mem_event_domain *med,
                            mem_event_response_t *rsp);
 
+struct domain *get_mem_event_op_target(uint32_t domain, int *rc);
+int do_mem_event_op(int op, uint32_t domain, void *arg);
 int mem_event_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec,
                      XEN_GUEST_HANDLE(void) u_domctl);
 
diff -r 0362b6cf03bf -r ae27691530e7 xen/include/asm-x86/mem_paging.h
--- a/xen/include/asm-x86/mem_paging.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/asm-x86/mem_paging.h	Fri Feb 10 16:07:07 2012 +0000
@@ -21,8 +21,7 @@
  */
 
 
-int mem_paging_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec,
-                      XEN_GUEST_HANDLE(void) u_domctl);
+int mem_paging_memop(struct domain *d, xen_mem_event_op_t *meo);
 
 
 /*
diff -r 0362b6cf03bf -r ae27691530e7 xen/include/asm-x86/mem_sharing.h
--- a/xen/include/asm-x86/mem_sharing.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/asm-x86/mem_sharing.h	Fri Feb 10 16:07:07 2012 +0000
@@ -23,6 +23,7 @@
 #define __MEM_SHARING_H__
 
 #include <public/domctl.h>
+#include <public/memory.h>
 
 /* Auditing of memory sharing code? */
 #define MEM_SHARING_AUDIT 0
@@ -56,6 +57,8 @@
                              unsigned long gfn, 
                              uint16_t flags);
 int mem_sharing_sharing_resume(struct domain *d);
+int mem_sharing_memop(struct domain *d, 
+                       xen_mem_sharing_op_t *mec);
 int mem_sharing_domctl(struct domain *d, 
                        xen_domctl_mem_sharing_op_t *mec);
 void mem_sharing_init(void);
diff -r 0362b6cf03bf -r ae27691530e7 xen/include/public/domctl.h
--- a/xen/include/public/domctl.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/public/domctl.h	Fri Feb 10 16:07:07 2012 +0000
@@ -711,47 +711,43 @@
 
 /*
 * Domain memory paging
- * Page memory in and out. 
+ * Page memory in and out.
+ * Domctl interface to set up and tear down the 
+ * pager<->hypervisor interface. Use XENMEM_paging_op*
+ * to perform per-page operations.
  */
 #define XEN_DOMCTL_MEM_EVENT_OP_PAGING            1
 
 #define XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE     0
 #define XEN_DOMCTL_MEM_EVENT_OP_PAGING_DISABLE    1
-#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_NOMINATE   2
-#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_EVICT      3
-#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP       4
-#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_RESUME     5
 
 /*
  * Access permissions.
  *
+ * As with paging, use the domctl for teardown/setup of the
+ * helper<->hypervisor interface.
+ *
  * There are HVM hypercalls to set the per-page access permissions of every
  * page in a domain.  When one of these permissions--independent, read, 
  * write, and execute--is violated, the VCPU is paused and a memory event 
- * is sent with what happened.  (See public/mem_event.h)  The memory event 
- * handler can then resume the VCPU and redo the access with an 
- * ACCESS_RESUME mode for the following domctl.
+ * is sent with what happened.  (See public/mem_event.h) .
+ *
+ * The memory event handler can then resume the VCPU and redo the access 
+ * with a XENMEM_access_op_resume hypercall.
  */
 #define XEN_DOMCTL_MEM_EVENT_OP_ACCESS            2
 
 #define XEN_DOMCTL_MEM_EVENT_OP_ACCESS_ENABLE     0
 #define XEN_DOMCTL_MEM_EVENT_OP_ACCESS_DISABLE    1
-#define XEN_DOMCTL_MEM_EVENT_OP_ACCESS_RESUME     2
 
+/* Use for teardown/setup of helper<->hypervisor interface for paging, 
+ * access and sharing.*/
 struct xen_domctl_mem_event_op {
     uint32_t       op;           /* XEN_DOMCTL_MEM_EVENT_OP_*_* */
     uint32_t       mode;         /* XEN_DOMCTL_MEM_EVENT_OP_* */
 
-    union {
-        /* OP_ENABLE IN:  Virtual address of shared page */
-        uint64_aligned_t shared_addr;  
-        /* PAGING_PREP IN: buffer to immediately fill page in */
-        uint64_aligned_t buffer;
-    } u;
+    uint64_aligned_t shared_addr;  /* IN:  Virtual address of shared page */
     uint64_aligned_t ring_addr;    /* IN:  Virtual address of ring page */
-
-    /* Other OPs */
-    uint64_aligned_t gfn;          /* IN:  gfn of page being operated on */
 };
 typedef struct xen_domctl_mem_event_op xen_domctl_mem_event_op_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_mem_event_op_t);
@@ -759,63 +755,15 @@
 /*
  * Memory sharing operations
  */
-/* XEN_DOMCTL_mem_sharing_op */
-
-#define XEN_DOMCTL_MEM_EVENT_OP_SHARING                3
-
-#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_CONTROL        0
-#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GFN   1
-#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GREF  2
-#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_SHARE          3
-#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_RESUME         4
-#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GFN      5
-#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_MFN      6
-#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GREF     7
-#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_ADD_PHYSMAP    8
-
-#define XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID  (-10)
-#define XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID  (-9)
-
-/* The following allows sharing of grant refs. This is useful
- * for sharing utilities sitting as "filters" in IO backends
- * (e.g. memshr + blktap(2)). The IO backend is only exposed 
- * to grant references, and this allows sharing of the grefs */
-#define XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF_FLAG   (1ULL << 62)
-
-#define XEN_DOMCTL_MEM_SHARING_FIELD_MAKE_GREF(field, val)  \
-    (field) = (XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF_FLAG | val)
-#define XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF(field)         \
-    ((field) & XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF_FLAG)
-#define XEN_DOMCTL_MEM_SHARING_FIELD_GET_GREF(field)        \
-    ((field) & (~XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF_FLAG))
+/* XEN_DOMCTL_mem_sharing_op.
+ * The CONTROL sub-domctl is used for bringup/teardown. */
+#define XEN_DOMCTL_MEM_SHARING_CONTROL          0
 
 struct xen_domctl_mem_sharing_op {
-    uint8_t op; /* XEN_DOMCTL_MEM_EVENT_OP_* */
+    uint8_t op; /* XEN_DOMCTL_MEM_SHARING_* */
 
     union {
-        uint8_t enable;                   /* OP_CONTROL                */
-
-        struct mem_sharing_op_nominate {  /* OP_NOMINATE_xxx           */
-            union {
-                uint64_aligned_t gfn;     /* IN: gfn to nominate       */
-                uint32_t      grant_ref;  /* IN: grant ref to nominate */
-            } u;
-            uint64_aligned_t  handle;     /* OUT: the handle           */
-        } nominate;
-        struct mem_sharing_op_share {     /* OP_SHARE/ADD_PHYSMAP */
-            uint64_aligned_t source_gfn;    /* IN: the gfn of the source page */
-            uint64_aligned_t source_handle; /* IN: handle to the source page */
-            domid_t          client_domain; /* IN: the client domain id */
-            uint64_aligned_t client_gfn;    /* IN: the client gfn */
-            uint64_aligned_t client_handle; /* IN: handle to the client page */
-        } share; 
-        struct mem_sharing_op_debug {     /* OP_DEBUG_xxx */
-            union {
-                uint64_aligned_t gfn;      /* IN: gfn to debug          */
-                uint64_aligned_t mfn;      /* IN: mfn to debug          */
-                grant_ref_t    gref;       /* IN: gref to debug         */
-            } u;
-        } debug;
+        uint8_t enable;                   /* CONTROL */
     } u;
 };
 typedef struct xen_domctl_mem_sharing_op xen_domctl_mem_sharing_op_t;
diff -r 0362b6cf03bf -r ae27691530e7 xen/include/public/memory.h
--- a/xen/include/public/memory.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/public/memory.h	Fri Feb 10 16:07:07 2012 +0000
@@ -305,6 +305,12 @@
 };
 typedef struct xen_pod_target xen_pod_target_t;
 
+#if defined(__XEN__) || defined(__XEN_TOOLS__)
+
+#ifndef uint64_aligned_t
+#define uint64_aligned_t uint64_t
+#endif
+
 /*
  * Get the number of MFNs saved through memory sharing.
  * The call never fails. 
@@ -312,6 +318,87 @@
 #define XENMEM_get_sharing_freed_pages    18
 #define XENMEM_get_sharing_shared_pages   19
 
+#define XENMEM_paging_op                    20
+#define XENMEM_paging_op_nominate           0
+#define XENMEM_paging_op_evict              1
+#define XENMEM_paging_op_prep               2
+#define XENMEM_paging_op_resume             3
+
+#define XENMEM_access_op                    21
+#define XENMEM_access_op_resume             0
+
+struct xen_mem_event_op {
+    uint8_t     op;         /* XENMEM_*_op_* */
+    domid_t     domain;
+    
+
+    /* PAGING_PREP IN: buffer to immediately fill page in */
+    uint64_aligned_t    buffer;
+    /* Other OPs */
+    uint64_aligned_t    gfn;           /* IN:  gfn of page being operated on */
+};
+typedef struct xen_mem_event_op xen_mem_event_op_t;
+DEFINE_XEN_GUEST_HANDLE(xen_mem_event_op_t);
+
+#define XENMEM_sharing_op                   22
+#define XENMEM_sharing_op_nominate_gfn      0
+#define XENMEM_sharing_op_nominate_gref     1
+#define XENMEM_sharing_op_share             2
+#define XENMEM_sharing_op_resume            3
+#define XENMEM_sharing_op_debug_gfn         4
+#define XENMEM_sharing_op_debug_mfn         5
+#define XENMEM_sharing_op_debug_gref        6
+#define XENMEM_sharing_op_add_physmap       7
+
+#define XENMEM_SHARING_OP_S_HANDLE_INVALID  (-10)
+#define XENMEM_SHARING_OP_C_HANDLE_INVALID  (-9)
+
+/* The following allows sharing of grant refs. This is useful
+ * for sharing utilities sitting as "filters" in IO backends
+ * (e.g. memshr + blktap(2)). The IO backend is only exposed 
+ * to grant references, and this allows sharing of the grefs */
+#define XENMEM_SHARING_OP_FIELD_IS_GREF_FLAG   (1ULL << 62)
+
+#define XENMEM_SHARING_OP_FIELD_MAKE_GREF(field, val)  \
+    (field) = (XENMEM_SHARING_OP_FIELD_IS_GREF_FLAG | val)
+#define XENMEM_SHARING_OP_FIELD_IS_GREF(field)         \
+    ((field) & XENMEM_SHARING_OP_FIELD_IS_GREF_FLAG)
+#define XENMEM_SHARING_OP_FIELD_GET_GREF(field)        \
+    ((field) & (~XENMEM_SHARING_OP_FIELD_IS_GREF_FLAG))
+
+struct xen_mem_sharing_op {
+    uint8_t     op;     /* XENMEM_sharing_op_* */
+    domid_t     domain;
+
+    union {
+        struct mem_sharing_op_nominate {  /* OP_NOMINATE_xxx           */
+            union {
+                uint64_aligned_t gfn;     /* IN: gfn to nominate       */
+                uint32_t      grant_ref;  /* IN: grant ref to nominate */
+            } u;
+            uint64_aligned_t  handle;     /* OUT: the handle           */
+        } nominate;
+        struct mem_sharing_op_share {     /* OP_SHARE/ADD_PHYSMAP */
+            uint64_aligned_t source_gfn;    /* IN: the gfn of the source page */
+            uint64_aligned_t source_handle; /* IN: handle to the source page */
+            uint64_aligned_t client_gfn;    /* IN: the client gfn */
+            uint64_aligned_t client_handle; /* IN: handle to the client page */
+            domid_t  client_domain; /* IN: the client domain id */
+        } share; 
+        struct mem_sharing_op_debug {     /* OP_DEBUG_xxx */
+            union {
+                uint64_aligned_t gfn;      /* IN: gfn to debug          */
+                uint64_aligned_t mfn;      /* IN: mfn to debug          */
+                uint32_t gref;     /* IN: gref to debug         */
+            } u;
+        } debug;
+    } u;
+};
+typedef struct xen_mem_sharing_op xen_mem_sharing_op_t;
+DEFINE_XEN_GUEST_HANDLE(xen_mem_sharing_op_t);
+
+#endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */
+
 #endif /* __XEN_PUBLIC_MEMORY_H__ */
 
 /*

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:39 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4eZ-000435-HI; Sat, 11 Feb 2012 04:33:39 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eW-0003px-TY
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:37 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-21.messagelabs.com!1328934807!10201363!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21484 invoked from network); 11 Feb 2012 04:33:28 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:28 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eM-0006SB-Sy
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:26 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eM-0001KN-QN
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:26 +0000
Message-Id: <E1Rw4eM-0001KN-QN@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:26 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Use memops for mem paging, sharing,
	and access, instead of domctls
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1328890027 0
# Node ID ae27691530e7d5047b46bf865fe3dd080a082f75
# Parent  0362b6cf03bfc41ddc3e1c4f24076730435965dd
Use memops for mem paging, sharing, and access, instead of domctls

Per page operations in the paging, sharing, and access tracking subsystems are
all implemented with domctls (e.g. a domctl to evict one page, or to share one
page).

Under heavy load, the domctl path reveals a lack of scalability. The domctl
lock serializes dom0's vcpus in the hypervisor. When performing thousands of
per-page operations on dozens of domains, these vcpus will spin in the
hypervisor. Beyond the aggressive locking, an added inefficiency of blocking
vcpus in the domctl lock is that dom0 is prevented from re-scheduling any of
its other work-starved processes.

We retain the domctl interface for setting up and tearing down
paging/sharing/mem access for a domain. But we migrate all the per page
operations to use the memory_op hypercalls (e.g XENMEM_*).

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla>
Signed-off-by: Adin Scannell <adin@scannell.ca>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 0362b6cf03bf -r ae27691530e7 tools/libxc/xc_mem_access.c
--- a/tools/libxc/xc_mem_access.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/libxc/xc_mem_access.c	Fri Feb 10 16:07:07 2012 +0000
@@ -30,7 +30,7 @@
     return xc_mem_event_control(xch, domain_id,
                                 XEN_DOMCTL_MEM_EVENT_OP_ACCESS_ENABLE,
                                 XEN_DOMCTL_MEM_EVENT_OP_ACCESS,
-                                shared_page, ring_page, INVALID_MFN);
+                                shared_page, ring_page);
 }
 
 int xc_mem_access_disable(xc_interface *xch, domid_t domain_id)
@@ -38,15 +38,15 @@
     return xc_mem_event_control(xch, domain_id,
                                 XEN_DOMCTL_MEM_EVENT_OP_ACCESS_DISABLE,
                                 XEN_DOMCTL_MEM_EVENT_OP_ACCESS,
-                                NULL, NULL, INVALID_MFN);
+                                NULL, NULL);
 }
 
 int xc_mem_access_resume(xc_interface *xch, domid_t domain_id, unsigned long gfn)
 {
-    return xc_mem_event_control(xch, domain_id,
-                                XEN_DOMCTL_MEM_EVENT_OP_ACCESS_RESUME,
-                                XEN_DOMCTL_MEM_EVENT_OP_ACCESS,
-                                NULL, NULL, gfn);
+    return xc_mem_event_memop(xch, domain_id,
+                                XENMEM_access_op_resume,
+                                XENMEM_access_op,
+                                gfn, NULL);
 }
 
 /*
diff -r 0362b6cf03bf -r ae27691530e7 tools/libxc/xc_mem_event.c
--- a/tools/libxc/xc_mem_event.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/libxc/xc_mem_event.c	Fri Feb 10 16:07:07 2012 +0000
@@ -24,8 +24,7 @@
 #include "xc_private.h"
 
 int xc_mem_event_control(xc_interface *xch, domid_t domain_id, unsigned int op,
-                         unsigned int mode, void *page,
-                         void *ring_page, unsigned long gfn)
+                         unsigned int mode, void *page, void *ring_page)
 {
     DECLARE_DOMCTL;
 
@@ -34,11 +33,25 @@
     domctl.u.mem_event_op.op = op;
     domctl.u.mem_event_op.mode = mode;
 
-    domctl.u.mem_event_op.u.shared_addr = (unsigned long)page;
+    domctl.u.mem_event_op.shared_addr = (unsigned long)page;
     domctl.u.mem_event_op.ring_addr = (unsigned long)ring_page;
-
-    domctl.u.mem_event_op.gfn = gfn;
     
     return do_domctl(xch, &domctl);
 }
 
+int xc_mem_event_memop(xc_interface *xch, domid_t domain_id, 
+                        unsigned int op, unsigned int mode,
+                        uint64_t gfn, void *buffer)
+{
+    xen_mem_event_op_t meo;
+
+    memset(&meo, 0, sizeof(meo));
+
+    meo.op      = op;
+    meo.domain  = domain_id;
+    meo.gfn     = gfn;
+    meo.buffer  = (unsigned long) buffer;
+
+    return do_memory_op(xch, mode, &meo, sizeof(meo));
+}
+
diff -r 0362b6cf03bf -r ae27691530e7 tools/libxc/xc_mem_paging.c
--- a/tools/libxc/xc_mem_paging.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/libxc/xc_mem_paging.c	Fri Feb 10 16:07:07 2012 +0000
@@ -30,7 +30,7 @@
     return xc_mem_event_control(xch, domain_id,
                                 XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE,
                                 XEN_DOMCTL_MEM_EVENT_OP_PAGING,
-                                shared_page, ring_page, INVALID_MFN);
+                                shared_page, ring_page);
 }
 
 int xc_mem_paging_disable(xc_interface *xch, domid_t domain_id)
@@ -38,31 +38,31 @@
     return xc_mem_event_control(xch, domain_id,
                                 XEN_DOMCTL_MEM_EVENT_OP_PAGING_DISABLE,
                                 XEN_DOMCTL_MEM_EVENT_OP_PAGING,
-                                NULL, NULL, INVALID_MFN);
+                                NULL, NULL);
 }
 
 int xc_mem_paging_nominate(xc_interface *xch, domid_t domain_id, unsigned long gfn)
 {
-    return xc_mem_event_control(xch, domain_id,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING_NOMINATE,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING,
-                                NULL, NULL, gfn);
+    return xc_mem_event_memop(xch, domain_id,
+                                XENMEM_paging_op_nominate,
+                                XENMEM_paging_op,
+                                gfn, NULL);
 }
 
 int xc_mem_paging_evict(xc_interface *xch, domid_t domain_id, unsigned long gfn)
 {
-    return xc_mem_event_control(xch, domain_id,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING_EVICT,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING,
-                                NULL, NULL, gfn);
+    return xc_mem_event_memop(xch, domain_id,
+                                XENMEM_paging_op_evict,
+                                XENMEM_paging_op,
+                                gfn, NULL);
 }
 
 int xc_mem_paging_prep(xc_interface *xch, domid_t domain_id, unsigned long gfn)
 {
-    return xc_mem_event_control(xch, domain_id,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING,
-                                NULL, NULL, gfn);
+    return xc_mem_event_memop(xch, domain_id,
+                                XENMEM_paging_op_prep,
+                                XENMEM_paging_op,
+                                gfn, NULL);
 }
 
 int xc_mem_paging_load(xc_interface *xch, domid_t domain_id, 
@@ -81,10 +81,10 @@
     if ( mlock(buffer, XC_PAGE_SIZE) )
         return -1;
         
-    rc = xc_mem_event_control(xch, domain_id,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING,
-                                buffer, NULL, gfn);
+    rc = xc_mem_event_memop(xch, domain_id,
+                                XENMEM_paging_op_prep,
+                                XENMEM_paging_op,
+                                gfn, buffer);
 
     old_errno = errno;
     munlock(buffer, XC_PAGE_SIZE);
@@ -95,10 +95,10 @@
 
 int xc_mem_paging_resume(xc_interface *xch, domid_t domain_id, unsigned long gfn)
 {
-    return xc_mem_event_control(xch, domain_id,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING_RESUME,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING,
-                                NULL, NULL, gfn);
+    return xc_mem_event_memop(xch, domain_id,
+                                XENMEM_paging_op_resume,
+                                XENMEM_paging_op,
+                                gfn, NULL);
 }
 
 
diff -r 0362b6cf03bf -r ae27691530e7 tools/libxc/xc_memshr.c
--- a/tools/libxc/xc_memshr.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/libxc/xc_memshr.c	Fri Feb 10 16:07:07 2012 +0000
@@ -36,32 +36,38 @@
     domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
     domctl.domain = domid;
     op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_CONTROL;
+    op->op = XEN_DOMCTL_MEM_SHARING_CONTROL;
     op->u.enable = enable;
 
     return do_domctl(xch, &domctl);
 }
 
+static int xc_memshr_memop(xc_interface *xch, domid_t domid, 
+                            xen_mem_sharing_op_t *mso)
+{
+    mso->domain = domid;
+
+    return do_memory_op(xch, XENMEM_sharing_op, mso, sizeof(*mso));
+}
+
 int xc_memshr_nominate_gfn(xc_interface *xch,
                            domid_t domid,
                            unsigned long gfn,
                            uint64_t *handle)
 {
-    DECLARE_DOMCTL;
-    struct xen_domctl_mem_sharing_op *op;
-    int ret;
+    int rc;
+    xen_mem_sharing_op_t mso;
 
-    domctl.cmd = XEN_DOMCTL_mem_sharing_op;
-    domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
-    domctl.domain = domid;
-    op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GFN;
-    op->u.nominate.u.gfn = gfn;
+    memset(&mso, 0, sizeof(mso));
 
-    ret = do_domctl(xch, &domctl);
-    if(!ret) *handle = op->u.nominate.handle; 
+    mso.op = XENMEM_sharing_op_nominate_gfn;
+    mso.u.nominate.u.gfn = gfn; 
 
-    return ret;
+    rc = xc_memshr_memop(xch, domid, &mso);
+
+    if (!rc) *handle = mso.u.nominate.handle; 
+
+    return rc;
 }
 
 int xc_memshr_nominate_gref(xc_interface *xch,
@@ -69,21 +75,19 @@
                             grant_ref_t gref,
                             uint64_t *handle)
 {
-    DECLARE_DOMCTL;
-    struct xen_domctl_mem_sharing_op *op;
-    int ret;
+    int rc;
+    xen_mem_sharing_op_t mso;
 
-    domctl.cmd = XEN_DOMCTL_mem_sharing_op;
-    domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
-    domctl.domain = domid;
-    op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GREF;
-    op->u.nominate.u.grant_ref = gref;
+    memset(&mso, 0, sizeof(mso));
 
-    ret = do_domctl(xch, &domctl);
-    if(!ret) *handle = op->u.nominate.handle; 
+    mso.op = XENMEM_sharing_op_nominate_gref;
+    mso.u.nominate.u.grant_ref = gref; 
 
-    return ret;
+    rc = xc_memshr_memop(xch, domid, &mso);
+
+    if (!rc) *handle = mso.u.nominate.handle; 
+
+    return rc;
 }
 
 int xc_memshr_share_gfns(xc_interface *xch,
@@ -94,21 +98,19 @@
                          unsigned long client_gfn,
                          uint64_t client_handle)
 {
-    DECLARE_DOMCTL;
-    struct xen_domctl_mem_sharing_op *op;
+    xen_mem_sharing_op_t mso;
 
-    domctl.cmd = XEN_DOMCTL_mem_sharing_op;
-    domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
-    domctl.domain = source_domain;
-    op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_SHARE;
-    op->u.share.source_handle = source_handle;
-    op->u.share.source_gfn    = source_gfn;
-    op->u.share.client_domain = client_domain;
-    op->u.share.client_gfn    = client_gfn;
-    op->u.share.client_handle = client_handle;
+    memset(&mso, 0, sizeof(mso));
 
-    return do_domctl(xch, &domctl);
+    mso.op = XENMEM_sharing_op_share;
+
+    mso.u.share.source_handle = source_handle;
+    mso.u.share.source_gfn    = source_gfn;
+    mso.u.share.client_domain = client_domain;
+    mso.u.share.client_gfn    = client_gfn;
+    mso.u.share.client_handle = client_handle;
+
+    return xc_memshr_memop(xch, source_domain, &mso);
 }
 
 int xc_memshr_share_grefs(xc_interface *xch,
@@ -119,21 +121,19 @@
                           grant_ref_t client_gref,
                           uint64_t client_handle)
 {
-    DECLARE_DOMCTL;
-    struct xen_domctl_mem_sharing_op *op;
+    xen_mem_sharing_op_t mso;
 
-    domctl.cmd = XEN_DOMCTL_mem_sharing_op;
-    domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
-    domctl.domain = source_domain;
-    op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_SHARE;
-    op->u.share.source_handle = source_handle;
-    XEN_DOMCTL_MEM_SHARING_FIELD_MAKE_GREF(op->u.share.source_gfn, source_gref);
-    op->u.share.client_domain = client_domain;
-    XEN_DOMCTL_MEM_SHARING_FIELD_MAKE_GREF(op->u.share.client_gfn, client_gref);
-    op->u.share.client_handle = client_handle;
+    memset(&mso, 0, sizeof(mso));
 
-    return do_domctl(xch, &domctl);
+    mso.op = XENMEM_sharing_op_share;
+
+    mso.u.share.source_handle = source_handle;
+    XENMEM_SHARING_OP_FIELD_MAKE_GREF(mso.u.share.source_gfn, source_gref);
+    mso.u.share.client_domain = client_domain;
+    XENMEM_SHARING_OP_FIELD_MAKE_GREF(mso.u.share.client_gfn, client_gref);
+    mso.u.share.client_handle = client_handle;
+
+    return xc_memshr_memop(xch, source_domain, &mso);
 }
 
 int xc_memshr_add_to_physmap(xc_interface *xch,
@@ -143,86 +143,72 @@
                     domid_t client_domain,
                     unsigned long client_gfn)
 {
-    DECLARE_DOMCTL;
-    struct xen_domctl_mem_sharing_op *op;
+    xen_mem_sharing_op_t mso;
 
-    domctl.cmd                  = XEN_DOMCTL_mem_sharing_op;
-    domctl.interface_version    = XEN_DOMCTL_INTERFACE_VERSION;
-    domctl.domain               = source_domain;
-    op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_ADD_PHYSMAP;
-    op->u.share.source_gfn      = source_gfn;
-    op->u.share.source_handle   = source_handle;
-    op->u.share.client_gfn      = client_gfn;
-    op->u.share.client_domain   = client_domain;
+    memset(&mso, 0, sizeof(mso));
 
-    return do_domctl(xch, &domctl);
+    mso.op = XENMEM_sharing_op_add_physmap;
+
+    mso.u.share.source_handle = source_handle;
+    mso.u.share.source_gfn    = source_gfn;
+    mso.u.share.client_domain = client_domain;
+    mso.u.share.client_gfn    = client_gfn;
+
+    return xc_memshr_memop(xch, source_domain, &mso);
 }
 
 int xc_memshr_domain_resume(xc_interface *xch,
                             domid_t domid)
 {
-    DECLARE_DOMCTL;
-    struct xen_domctl_mem_sharing_op *op;
+    xen_mem_sharing_op_t mso;
 
-    domctl.cmd = XEN_DOMCTL_mem_sharing_op;
-    domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
-    domctl.domain = domid;
-    op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_RESUME;
+    memset(&mso, 0, sizeof(mso));
 
-    return do_domctl(xch, &domctl);
+    mso.op = XENMEM_sharing_op_resume;
+
+    return xc_memshr_memop(xch, domid, &mso);
 }
 
 int xc_memshr_debug_gfn(xc_interface *xch,
                         domid_t domid,
                         unsigned long gfn)
 {
-    DECLARE_DOMCTL;
-    struct xen_domctl_mem_sharing_op *op;
+    xen_mem_sharing_op_t mso;
 
-    domctl.cmd = XEN_DOMCTL_mem_sharing_op;
-    domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
-    domctl.domain = domid;
-    op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GFN;
-    op->u.debug.u.gfn = gfn;
+    memset(&mso, 0, sizeof(mso));
 
-    return do_domctl(xch, &domctl);
+    mso.op = XENMEM_sharing_op_debug_gfn;
+    mso.u.debug.u.gfn = gfn; 
+
+    return xc_memshr_memop(xch, domid, &mso);
 }
 
 int xc_memshr_debug_mfn(xc_interface *xch,
                         domid_t domid,
                         unsigned long mfn)
 {
-    DECLARE_DOMCTL;
-    struct xen_domctl_mem_sharing_op *op;
+    xen_mem_sharing_op_t mso;
 
-    domctl.cmd = XEN_DOMCTL_mem_sharing_op;
-    domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
-    domctl.domain = domid;
-    op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_MFN;
-    op->u.debug.u.mfn = mfn;
+    memset(&mso, 0, sizeof(mso));
 
-    return do_domctl(xch, &domctl);
+    mso.op = XENMEM_sharing_op_debug_mfn;
+    mso.u.debug.u.mfn = mfn; 
+
+    return xc_memshr_memop(xch, domid, &mso);
 }
 
 int xc_memshr_debug_gref(xc_interface *xch,
                          domid_t domid,
                          grant_ref_t gref)
 {
-    DECLARE_DOMCTL;
-    struct xen_domctl_mem_sharing_op *op;
+    xen_mem_sharing_op_t mso;
 
-    domctl.cmd = XEN_DOMCTL_mem_sharing_op;
-    domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
-    domctl.domain = domid;
-    op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GREF;
-    op->u.debug.u.gref = gref;
+    memset(&mso, 0, sizeof(mso));
 
-    return do_domctl(xch, &domctl);
+    mso.op = XENMEM_sharing_op_debug_gref;
+    mso.u.debug.u.gref = gref; 
+
+    return xc_memshr_memop(xch, domid, &mso);
 }
 
 long xc_sharing_freed_pages(xc_interface *xch)
diff -r 0362b6cf03bf -r ae27691530e7 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/libxc/xenctrl.h	Fri Feb 10 16:07:07 2012 +0000
@@ -1883,8 +1883,10 @@
  * mem_event operations
  */
 int xc_mem_event_control(xc_interface *xch, domid_t domain_id, unsigned int op,
-                         unsigned int mode, void *shared_page,
-                          void *ring_page, unsigned long gfn);
+                         unsigned int mode, void *shared_page, void *ring_page);
+int xc_mem_event_memop(xc_interface *xch, domid_t domain_id, 
+                        unsigned int op, unsigned int mode,
+                        uint64_t gfn, void *buffer);
 
 int xc_mem_paging_enable(xc_interface *xch, domid_t domain_id,
                         void *shared_page, void *ring_page);
diff -r 0362b6cf03bf -r ae27691530e7 tools/memshr/interface.c
--- a/tools/memshr/interface.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/memshr/interface.c	Fri Feb 10 16:07:07 2012 +0000
@@ -186,12 +186,12 @@
            remove the relevant ones from the map */
         switch(ret)
         {
-            case XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID:
+            case XENMEM_SHARING_OP_S_HANDLE_INVALID:
                 ret = blockshr_shrhnd_remove(memshr.blks, source_st, NULL);
                 if(ret) DPRINTF("Could not rm invl s_hnd: %u %"PRId64" %"PRId64"\n", 
                                     source_st.domain, source_st.frame, source_st.handle);
                 break;
-            case XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID:
+            case XENMEM_SHARING_OP_C_HANDLE_INVALID:
                 ret = blockshr_shrhnd_remove(memshr.blks, client_st, NULL);
                 if(ret) DPRINTF("Could not rm invl c_hnd: %u %"PRId64" %"PRId64"\n", 
                                     client_st.domain, client_st.frame, client_st.handle);
diff -r 0362b6cf03bf -r ae27691530e7 tools/tests/mem-sharing/memshrtool.c
--- a/tools/tests/mem-sharing/memshrtool.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/tools/tests/mem-sharing/memshrtool.c	Fri Feb 10 16:07:07 2012 +0000
@@ -34,9 +34,9 @@
     int rc = f; \
     if ( rc < 0 ) { \
         printf("error executing %s: %s\n", #f, \
-                ((errno * -1) == XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID) ? \
+                ((errno * -1) == XENMEM_SHARING_OP_S_HANDLE_INVALID) ? \
                 "problem with client handle" :\
-                ((errno * -1) == XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID) ? \
+                ((errno * -1) == XENMEM_SHARING_OP_C_HANDLE_INVALID) ? \
                 "problem with source handle" : strerror(errno)); \
         return rc; \
     } \
diff -r 0362b6cf03bf -r ae27691530e7 xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/domctl.c	Fri Feb 10 16:07:07 2012 +0000
@@ -1463,7 +1463,6 @@
             if ( !ret )
                 ret = mem_sharing_domctl(d, &domctl->u.mem_sharing_op);
             rcu_unlock_domain(d);
-            copy_to_guest(u_domctl, domctl, 1);
         } 
     }
     break;
diff -r 0362b6cf03bf -r ae27691530e7 xen/arch/x86/mm/mem_access.c
--- a/xen/arch/x86/mm/mem_access.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/mem_access.c	Fri Feb 10 16:07:07 2012 +0000
@@ -25,14 +25,13 @@
 #include <asm/mem_event.h>
 
 
-int mem_access_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec,
-                      XEN_GUEST_HANDLE(void) u_domctl)
+int mem_access_memop(struct domain *d, xen_mem_event_op_t *meo)
 {
     int rc;
 
-    switch( mec->op )
+    switch( meo->op )
     {
-    case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_RESUME:
+    case XENMEM_access_op_resume:
     {
         p2m_mem_access_resume(d);
         rc = 0;
diff -r 0362b6cf03bf -r ae27691530e7 xen/arch/x86/mm/mem_event.c
--- a/xen/arch/x86/mm/mem_event.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/mem_event.c	Fri Feb 10 16:07:07 2012 +0000
@@ -28,6 +28,7 @@
 #include <asm/mem_event.h>
 #include <asm/mem_paging.h>
 #include <asm/mem_access.h>
+#include <asm/mem_sharing.h>
 
 /* for public/io/ring.h macros */
 #define xen_mb()   mb()
@@ -49,7 +50,7 @@
     struct domain *dom_mem_event = current->domain;
     struct vcpu *v = current;
     unsigned long ring_addr = mec->ring_addr;
-    unsigned long shared_addr = mec->u.shared_addr;
+    unsigned long shared_addr = mec->shared_addr;
     l1_pgentry_t l1e;
     unsigned long shared_gfn = 0, ring_gfn = 0; /* gcc ... */
     p2m_type_t p2mt;
@@ -460,6 +461,54 @@
     p2m_mem_access_resume(v->domain);
 }
 
+struct domain *get_mem_event_op_target(uint32_t domain, int *rc)
+{
+    struct domain *d;
+
+    /* Get the target domain */
+    *rc = rcu_lock_remote_target_domain_by_id(domain, &d);
+    if ( *rc != 0 )
+        return NULL;
+
+    /* Not dying? */
+    if ( d->is_dying )
+    {
+        rcu_unlock_domain(d);
+        *rc = -EINVAL;
+        return NULL;
+    }
+    
+    return d;
+}
+
+int do_mem_event_op(int op, uint32_t domain, void *arg)
+{
+    int ret;
+    struct domain *d;
+
+    d = get_mem_event_op_target(domain, &ret);
+    if ( !d )
+        return ret;
+
+    switch (op)
+    {
+        case XENMEM_paging_op:
+            ret = mem_paging_memop(d, (xen_mem_event_op_t *) arg);
+            break;
+        case XENMEM_access_op:
+            ret = mem_access_memop(d, (xen_mem_event_op_t *) arg);
+            break;
+        case XENMEM_sharing_op:
+            ret = mem_sharing_memop(d, (xen_mem_sharing_op_t *) arg);
+            break;
+        default:
+            ret = -ENOSYS;
+    }
+
+    rcu_unlock_domain(d);
+    return ret;
+}
+
 int mem_event_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec,
                      XEN_GUEST_HANDLE(void) u_domctl)
 {
@@ -533,11 +582,8 @@
         break;
 
         default:
-        {
-            if ( med->ring_page )
-                rc = mem_paging_domctl(d, mec, u_domctl);
-        }
-        break;
+            rc = -ENOSYS;
+            break;
         }
     }
     break;
@@ -572,14 +618,14 @@
         break;
 
         default:
-        {
-            if ( med->ring_page )
-                rc = mem_access_domctl(d, mec, u_domctl);
-        }
-        break;
+            rc = -ENOSYS;
+            break;
         }
     }
     break;
+
+    default:
+        rc = -ENOSYS;
     }
 
     return rc;
diff -r 0362b6cf03bf -r ae27691530e7 xen/arch/x86/mm/mem_paging.c
--- a/xen/arch/x86/mm/mem_paging.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/mem_paging.c	Fri Feb 10 16:07:07 2012 +0000
@@ -25,33 +25,32 @@
 #include <asm/mem_event.h>
 
 
-int mem_paging_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec,
-                      XEN_GUEST_HANDLE(void) u_domctl)
+int mem_paging_memop(struct domain *d, xen_mem_event_op_t *mec)
 {
     switch( mec->op )
     {
-    case XEN_DOMCTL_MEM_EVENT_OP_PAGING_NOMINATE:
+    case XENMEM_paging_op_nominate:
     {
         unsigned long gfn = mec->gfn;
         return p2m_mem_paging_nominate(d, gfn);
     }
     break;
 
-    case XEN_DOMCTL_MEM_EVENT_OP_PAGING_EVICT:
+    case XENMEM_paging_op_evict:
     {
         unsigned long gfn = mec->gfn;
         return p2m_mem_paging_evict(d, gfn);
     }
     break;
 
-    case XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP:
+    case XENMEM_paging_op_prep:
     {
         unsigned long gfn = mec->gfn;
-        return p2m_mem_paging_prep(d, gfn, mec->u.buffer);
+        return p2m_mem_paging_prep(d, gfn, mec->buffer);
     }
     break;
 
-    case XEN_DOMCTL_MEM_EVENT_OP_PAGING_RESUME:
+    case XENMEM_paging_op_resume:
     {
         p2m_mem_paging_resume(d);
         return 0;
diff -r 0362b6cf03bf -r ae27691530e7 xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/mm/mem_sharing.c	Fri Feb 10 16:07:07 2012 +0000
@@ -747,12 +747,12 @@
     }
     else if ( mfn_x(smfn) < mfn_x(cmfn) )
     {
-        ret = XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID;
+        ret = XENMEM_SHARING_OP_S_HANDLE_INVALID;
         spage = firstpg = __grab_shared_page(smfn);
         if ( spage == NULL )
             goto err_out;
 
-        ret = XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID;
+        ret = XENMEM_SHARING_OP_C_HANDLE_INVALID;
         cpage = secondpg = __grab_shared_page(cmfn);
         if ( cpage == NULL )
         {
@@ -760,12 +760,12 @@
             goto err_out;
         }
     } else {
-        ret = XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID;
+        ret = XENMEM_SHARING_OP_C_HANDLE_INVALID;
         cpage = firstpg = __grab_shared_page(cmfn);
         if ( cpage == NULL )
             goto err_out;
 
-        ret = XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID;
+        ret = XENMEM_SHARING_OP_S_HANDLE_INVALID;
         spage = secondpg = __grab_shared_page(smfn);
         if ( spage == NULL )
         {
@@ -780,14 +780,14 @@
     /* Check that the handles match */
     if ( spage->sharing->handle != sh )
     {
-        ret = XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID;
+        ret = XENMEM_SHARING_OP_S_HANDLE_INVALID;
         mem_sharing_page_unlock(secondpg);
         mem_sharing_page_unlock(firstpg);
         goto err_out;
     }
     if ( cpage->sharing->handle != ch )
     {
-        ret = XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID;
+        ret = XENMEM_SHARING_OP_C_HANDLE_INVALID;
         mem_sharing_page_unlock(secondpg);
         mem_sharing_page_unlock(firstpg);
         goto err_out;
@@ -849,7 +849,7 @@
                  p2m_query, &tg);
 
     /* Get the source shared page, check and lock */
-    ret = XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID;
+    ret = XENMEM_SHARING_OP_S_HANDLE_INVALID;
     spage = __grab_shared_page(smfn);
     if ( spage == NULL )
         goto err_out;
@@ -863,7 +863,7 @@
     if ( mfn_valid(cmfn) ||
          (!(p2m_is_ram(cmfn_type))) )
     {
-        ret = XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID;
+        ret = XENMEM_SHARING_OP_C_HANDLE_INVALID;
         goto err_unlock;
     }
 
@@ -1014,9 +1014,9 @@
     return 0;
 }
 
-int mem_sharing_domctl(struct domain *d, xen_domctl_mem_sharing_op_t *mec)
+int mem_sharing_memop(struct domain *d, xen_mem_sharing_op_t *mec)
 {
-    int rc;
+    int rc = 0;
 
     /* Only HAP is supported */
     if ( !hap_enabled(d) )
@@ -1024,14 +1024,7 @@
 
     switch(mec->op)
     {
-        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_CONTROL:
-        {
-            d->arch.hvm_domain.mem_sharing_enabled = mec->u.enable;
-            rc = 0;
-        }
-        break;
-
-        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GFN:
+        case XENMEM_sharing_op_nominate_gfn:
         {
             unsigned long gfn = mec->u.nominate.u.gfn;
             shr_handle_t handle;
@@ -1042,7 +1035,7 @@
         }
         break;
 
-        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GREF:
+        case XENMEM_sharing_op_nominate_gref:
         {
             grant_ref_t gref = mec->u.nominate.u.grant_ref;
             unsigned long gfn;
@@ -1057,7 +1050,7 @@
         }
         break;
 
-        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_SHARE:
+        case XENMEM_sharing_op_share:
         {
             unsigned long sgfn, cgfn;
             struct domain *cd;
@@ -1066,38 +1059,38 @@
             if ( !mem_sharing_enabled(d) )
                 return -EINVAL;
 
-            cd = get_domain_by_id(mec->u.share.client_domain);
+            cd = get_mem_event_op_target(mec->u.share.client_domain, &rc);
             if ( !cd )
-                return -ESRCH;
+                return rc;
 
             if ( !mem_sharing_enabled(cd) )
             {
-                put_domain(cd);
+                rcu_unlock_domain(cd);
                 return -EINVAL;
             }
 
-            if ( XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF(mec->u.share.source_gfn) )
+            if ( XENMEM_SHARING_OP_FIELD_IS_GREF(mec->u.share.source_gfn) )
             {
                 grant_ref_t gref = (grant_ref_t) 
-                                    (XEN_DOMCTL_MEM_SHARING_FIELD_GET_GREF(
+                                    (XENMEM_SHARING_OP_FIELD_GET_GREF(
                                         mec->u.share.source_gfn));
                 if ( mem_sharing_gref_to_gfn(d, gref, &sgfn) < 0 )
                 {
-                    put_domain(cd);
+                    rcu_unlock_domain(cd);
                     return -EINVAL;
                 }
             } else {
                 sgfn  = mec->u.share.source_gfn;
             }
 
-            if ( XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF(mec->u.share.client_gfn) )
+            if ( XENMEM_SHARING_OP_FIELD_IS_GREF(mec->u.share.client_gfn) )
             {
                 grant_ref_t gref = (grant_ref_t) 
-                                    (XEN_DOMCTL_MEM_SHARING_FIELD_GET_GREF(
+                                    (XENMEM_SHARING_OP_FIELD_GET_GREF(
                                         mec->u.share.client_gfn));
                 if ( mem_sharing_gref_to_gfn(cd, gref, &cgfn) < 0 )
                 {
-                    put_domain(cd);
+                    rcu_unlock_domain(cd);
                     return -EINVAL;
                 }
             } else {
@@ -1109,11 +1102,11 @@
 
             rc = mem_sharing_share_pages(d, sgfn, sh, cd, cgfn, ch); 
 
-            put_domain(cd);
+            rcu_unlock_domain(cd);
         }
         break;
 
-        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_ADD_PHYSMAP:
+        case XENMEM_sharing_op_add_physmap:
         {
             unsigned long sgfn, cgfn;
             struct domain *cd;
@@ -1122,20 +1115,20 @@
             if ( !mem_sharing_enabled(d) )
                 return -EINVAL;
 
-            cd = get_domain_by_id(mec->u.share.client_domain);
+            cd = get_mem_event_op_target(mec->u.share.client_domain, &rc);
             if ( !cd )
-                return -ESRCH;
+                return rc;
 
             if ( !mem_sharing_enabled(cd) )
             {
-                put_domain(cd);
+                rcu_unlock_domain(cd);
                 return -EINVAL;
             }
 
-            if ( XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF(mec->u.share.source_gfn) )
+            if ( XENMEM_SHARING_OP_FIELD_IS_GREF(mec->u.share.source_gfn) )
             {
                 /* Cannot add a gref to the physmap */
-                put_domain(cd);
+                rcu_unlock_domain(cd);
                 return -EINVAL;
             }
 
@@ -1145,11 +1138,11 @@
 
             rc = mem_sharing_add_to_physmap(d, sgfn, sh, cd, cgfn); 
 
-            put_domain(cd);
+            rcu_unlock_domain(cd);
         }
         break;
 
-        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_RESUME:
+        case XENMEM_sharing_op_resume:
         {
             if ( !mem_sharing_enabled(d) )
                 return -EINVAL;
@@ -1157,21 +1150,21 @@
         }
         break;
 
-        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GFN:
+        case XENMEM_sharing_op_debug_gfn:
         {
             unsigned long gfn = mec->u.debug.u.gfn;
             rc = mem_sharing_debug_gfn(d, gfn);
         }
         break;
 
-        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_MFN:
+        case XENMEM_sharing_op_debug_mfn:
         {
             unsigned long mfn = mec->u.debug.u.mfn;
             rc = mem_sharing_debug_mfn(_mfn(mfn));
         }
         break;
 
-        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GREF:
+        case XENMEM_sharing_op_debug_gref:
         {
             grant_ref_t gref = mec->u.debug.u.gref;
             rc = mem_sharing_debug_gref(d, gref);
@@ -1188,6 +1181,30 @@
     return rc;
 }
 
+int mem_sharing_domctl(struct domain *d, xen_domctl_mem_sharing_op_t *mec)
+{
+    int rc;
+
+    /* Only HAP is supported */
+    if ( !hap_enabled(d) )
+         return -ENODEV;
+
+    switch(mec->op)
+    {
+        case XEN_DOMCTL_MEM_SHARING_CONTROL:
+        {
+            d->arch.hvm_domain.mem_sharing_enabled = mec->u.enable;
+            rc = 0;
+        }
+        break;
+
+        default:
+            rc = -ENOSYS;
+    }
+
+    return rc;
+}
+
 void __init mem_sharing_init(void)
 {
     printk("Initing memory sharing.\n");
diff -r 0362b6cf03bf -r ae27691530e7 xen/arch/x86/x86_64/compat/mm.c
--- a/xen/arch/x86/x86_64/compat/mm.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/x86_64/compat/mm.c	Fri Feb 10 16:07:07 2012 +0000
@@ -2,6 +2,7 @@
 #include <xen/multicall.h>
 #include <compat/memory.h>
 #include <compat/xen.h>
+#include <asm/mem_event.h>
 
 int compat_set_gdt(XEN_GUEST_HANDLE(uint) frame_list, unsigned int entries)
 {
@@ -211,6 +212,28 @@
     case XENMEM_get_sharing_shared_pages:
         return mem_sharing_get_nr_shared_mfns();
 
+    case XENMEM_paging_op:
+    case XENMEM_access_op:
+    {
+        xen_mem_event_op_t meo;
+        if ( copy_from_guest(&meo, arg, 1) )
+            return -EFAULT;
+        rc = do_mem_event_op(op, meo.domain, (void *) &meo);
+        if ( !rc && copy_to_guest(arg, &meo, 1) )
+            return -EFAULT;
+        break;
+    }
+    case XENMEM_sharing_op:
+    {
+        xen_mem_sharing_op_t mso;
+        if ( copy_from_guest(&mso, arg, 1) )
+            return -EFAULT;
+        rc = do_mem_event_op(op, mso.domain, (void *) &mso);
+        if ( !rc && copy_to_guest(arg, &mso, 1) )
+            return -EFAULT;
+        break;
+    }
+
     default:
         rc = -ENOSYS;
         break;
diff -r 0362b6cf03bf -r ae27691530e7 xen/arch/x86/x86_64/mm.c
--- a/xen/arch/x86/x86_64/mm.c	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/arch/x86/x86_64/mm.c	Fri Feb 10 16:07:07 2012 +0000
@@ -34,6 +34,7 @@
 #include <asm/msr.h>
 #include <asm/setup.h>
 #include <asm/numa.h>
+#include <asm/mem_event.h>
 #include <asm/mem_sharing.h>
 #include <public/memory.h>
 
@@ -1100,6 +1101,28 @@
     case XENMEM_get_sharing_shared_pages:
         return mem_sharing_get_nr_shared_mfns();
 
+    case XENMEM_paging_op:
+    case XENMEM_access_op:
+    {
+        xen_mem_event_op_t meo;
+        if ( copy_from_guest(&meo, arg, 1) )
+            return -EFAULT;
+        rc = do_mem_event_op(op, meo.domain, (void *) &meo);
+        if ( !rc && copy_to_guest(arg, &meo, 1) )
+            return -EFAULT;
+        break;
+    }
+    case XENMEM_sharing_op:
+    {
+        xen_mem_sharing_op_t mso;
+        if ( copy_from_guest(&mso, arg, 1) )
+            return -EFAULT;
+        rc = do_mem_event_op(op, mso.domain, (void *) &mso);
+        if ( !rc && copy_to_guest(arg, &mso, 1) )
+            return -EFAULT;
+        break;
+    }
+
     default:
         rc = -ENOSYS;
         break;
diff -r 0362b6cf03bf -r ae27691530e7 xen/include/asm-x86/mem_access.h
--- a/xen/include/asm-x86/mem_access.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/asm-x86/mem_access.h	Fri Feb 10 16:07:07 2012 +0000
@@ -21,8 +21,7 @@
  */
 
 
-int mem_access_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec,
-                      XEN_GUEST_HANDLE(void) u_domctl);
+int mem_access_memop(struct domain *d, xen_mem_event_op_t *meo);
 int mem_access_send_req(struct domain *d, mem_event_request_t *req);
 
 
diff -r 0362b6cf03bf -r ae27691530e7 xen/include/asm-x86/mem_event.h
--- a/xen/include/asm-x86/mem_event.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/asm-x86/mem_event.h	Fri Feb 10 16:07:07 2012 +0000
@@ -42,6 +42,8 @@
 int mem_event_get_response(struct domain *d, struct mem_event_domain *med,
                            mem_event_response_t *rsp);
 
+struct domain *get_mem_event_op_target(uint32_t domain, int *rc);
+int do_mem_event_op(int op, uint32_t domain, void *arg);
 int mem_event_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec,
                      XEN_GUEST_HANDLE(void) u_domctl);
 
diff -r 0362b6cf03bf -r ae27691530e7 xen/include/asm-x86/mem_paging.h
--- a/xen/include/asm-x86/mem_paging.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/asm-x86/mem_paging.h	Fri Feb 10 16:07:07 2012 +0000
@@ -21,8 +21,7 @@
  */
 
 
-int mem_paging_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec,
-                      XEN_GUEST_HANDLE(void) u_domctl);
+int mem_paging_memop(struct domain *d, xen_mem_event_op_t *meo);
 
 
 /*
diff -r 0362b6cf03bf -r ae27691530e7 xen/include/asm-x86/mem_sharing.h
--- a/xen/include/asm-x86/mem_sharing.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/asm-x86/mem_sharing.h	Fri Feb 10 16:07:07 2012 +0000
@@ -23,6 +23,7 @@
 #define __MEM_SHARING_H__
 
 #include <public/domctl.h>
+#include <public/memory.h>
 
 /* Auditing of memory sharing code? */
 #define MEM_SHARING_AUDIT 0
@@ -56,6 +57,8 @@
                              unsigned long gfn, 
                              uint16_t flags);
 int mem_sharing_sharing_resume(struct domain *d);
+int mem_sharing_memop(struct domain *d, 
+                       xen_mem_sharing_op_t *mec);
 int mem_sharing_domctl(struct domain *d, 
                        xen_domctl_mem_sharing_op_t *mec);
 void mem_sharing_init(void);
diff -r 0362b6cf03bf -r ae27691530e7 xen/include/public/domctl.h
--- a/xen/include/public/domctl.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/public/domctl.h	Fri Feb 10 16:07:07 2012 +0000
@@ -711,47 +711,43 @@
 
 /*
 * Domain memory paging
- * Page memory in and out. 
+ * Page memory in and out.
+ * Domctl interface to set up and tear down the 
+ * pager<->hypervisor interface. Use XENMEM_paging_op*
+ * to perform per-page operations.
  */
 #define XEN_DOMCTL_MEM_EVENT_OP_PAGING            1
 
 #define XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE     0
 #define XEN_DOMCTL_MEM_EVENT_OP_PAGING_DISABLE    1
-#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_NOMINATE   2
-#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_EVICT      3
-#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP       4
-#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_RESUME     5
 
 /*
  * Access permissions.
  *
+ * As with paging, use the domctl for teardown/setup of the
+ * helper<->hypervisor interface.
+ *
  * There are HVM hypercalls to set the per-page access permissions of every
  * page in a domain.  When one of these permissions--independent, read, 
  * write, and execute--is violated, the VCPU is paused and a memory event 
- * is sent with what happened.  (See public/mem_event.h)  The memory event 
- * handler can then resume the VCPU and redo the access with an 
- * ACCESS_RESUME mode for the following domctl.
+ * is sent with what happened.  (See public/mem_event.h) .
+ *
+ * The memory event handler can then resume the VCPU and redo the access 
+ * with a XENMEM_access_op_resume hypercall.
  */
 #define XEN_DOMCTL_MEM_EVENT_OP_ACCESS            2
 
 #define XEN_DOMCTL_MEM_EVENT_OP_ACCESS_ENABLE     0
 #define XEN_DOMCTL_MEM_EVENT_OP_ACCESS_DISABLE    1
-#define XEN_DOMCTL_MEM_EVENT_OP_ACCESS_RESUME     2
 
+/* Use for teardown/setup of helper<->hypervisor interface for paging, 
+ * access and sharing.*/
 struct xen_domctl_mem_event_op {
     uint32_t       op;           /* XEN_DOMCTL_MEM_EVENT_OP_*_* */
     uint32_t       mode;         /* XEN_DOMCTL_MEM_EVENT_OP_* */
 
-    union {
-        /* OP_ENABLE IN:  Virtual address of shared page */
-        uint64_aligned_t shared_addr;  
-        /* PAGING_PREP IN: buffer to immediately fill page in */
-        uint64_aligned_t buffer;
-    } u;
+    uint64_aligned_t shared_addr;  /* IN:  Virtual address of shared page */
     uint64_aligned_t ring_addr;    /* IN:  Virtual address of ring page */
-
-    /* Other OPs */
-    uint64_aligned_t gfn;          /* IN:  gfn of page being operated on */
 };
 typedef struct xen_domctl_mem_event_op xen_domctl_mem_event_op_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_mem_event_op_t);
@@ -759,63 +755,15 @@
 /*
  * Memory sharing operations
  */
-/* XEN_DOMCTL_mem_sharing_op */
-
-#define XEN_DOMCTL_MEM_EVENT_OP_SHARING                3
-
-#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_CONTROL        0
-#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GFN   1
-#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GREF  2
-#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_SHARE          3
-#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_RESUME         4
-#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GFN      5
-#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_MFN      6
-#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GREF     7
-#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_ADD_PHYSMAP    8
-
-#define XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID  (-10)
-#define XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID  (-9)
-
-/* The following allows sharing of grant refs. This is useful
- * for sharing utilities sitting as "filters" in IO backends
- * (e.g. memshr + blktap(2)). The IO backend is only exposed 
- * to grant references, and this allows sharing of the grefs */
-#define XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF_FLAG   (1ULL << 62)
-
-#define XEN_DOMCTL_MEM_SHARING_FIELD_MAKE_GREF(field, val)  \
-    (field) = (XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF_FLAG | val)
-#define XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF(field)         \
-    ((field) & XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF_FLAG)
-#define XEN_DOMCTL_MEM_SHARING_FIELD_GET_GREF(field)        \
-    ((field) & (~XEN_DOMCTL_MEM_SHARING_FIELD_IS_GREF_FLAG))
+/* XEN_DOMCTL_mem_sharing_op.
+ * The CONTROL sub-domctl is used for bringup/teardown. */
+#define XEN_DOMCTL_MEM_SHARING_CONTROL          0
 
 struct xen_domctl_mem_sharing_op {
-    uint8_t op; /* XEN_DOMCTL_MEM_EVENT_OP_* */
+    uint8_t op; /* XEN_DOMCTL_MEM_SHARING_* */
 
     union {
-        uint8_t enable;                   /* OP_CONTROL                */
-
-        struct mem_sharing_op_nominate {  /* OP_NOMINATE_xxx           */
-            union {
-                uint64_aligned_t gfn;     /* IN: gfn to nominate       */
-                uint32_t      grant_ref;  /* IN: grant ref to nominate */
-            } u;
-            uint64_aligned_t  handle;     /* OUT: the handle           */
-        } nominate;
-        struct mem_sharing_op_share {     /* OP_SHARE/ADD_PHYSMAP */
-            uint64_aligned_t source_gfn;    /* IN: the gfn of the source page */
-            uint64_aligned_t source_handle; /* IN: handle to the source page */
-            domid_t          client_domain; /* IN: the client domain id */
-            uint64_aligned_t client_gfn;    /* IN: the client gfn */
-            uint64_aligned_t client_handle; /* IN: handle to the client page */
-        } share; 
-        struct mem_sharing_op_debug {     /* OP_DEBUG_xxx */
-            union {
-                uint64_aligned_t gfn;      /* IN: gfn to debug          */
-                uint64_aligned_t mfn;      /* IN: mfn to debug          */
-                grant_ref_t    gref;       /* IN: gref to debug         */
-            } u;
-        } debug;
+        uint8_t enable;                   /* CONTROL */
     } u;
 };
 typedef struct xen_domctl_mem_sharing_op xen_domctl_mem_sharing_op_t;
diff -r 0362b6cf03bf -r ae27691530e7 xen/include/public/memory.h
--- a/xen/include/public/memory.h	Fri Feb 10 16:07:07 2012 +0000
+++ b/xen/include/public/memory.h	Fri Feb 10 16:07:07 2012 +0000
@@ -305,6 +305,12 @@
 };
 typedef struct xen_pod_target xen_pod_target_t;
 
+#if defined(__XEN__) || defined(__XEN_TOOLS__)
+
+#ifndef uint64_aligned_t
+#define uint64_aligned_t uint64_t
+#endif
+
 /*
  * Get the number of MFNs saved through memory sharing.
  * The call never fails. 
@@ -312,6 +318,87 @@
 #define XENMEM_get_sharing_freed_pages    18
 #define XENMEM_get_sharing_shared_pages   19
 
+#define XENMEM_paging_op                    20
+#define XENMEM_paging_op_nominate           0
+#define XENMEM_paging_op_evict              1
+#define XENMEM_paging_op_prep               2
+#define XENMEM_paging_op_resume             3
+
+#define XENMEM_access_op                    21
+#define XENMEM_access_op_resume             0
+
+struct xen_mem_event_op {
+    uint8_t     op;         /* XENMEM_*_op_* */
+    domid_t     domain;
+    
+
+    /* PAGING_PREP IN: buffer to immediately fill page in */
+    uint64_aligned_t    buffer;
+    /* Other OPs */
+    uint64_aligned_t    gfn;           /* IN:  gfn of page being operated on */
+};
+typedef struct xen_mem_event_op xen_mem_event_op_t;
+DEFINE_XEN_GUEST_HANDLE(xen_mem_event_op_t);
+
+#define XENMEM_sharing_op                   22
+#define XENMEM_sharing_op_nominate_gfn      0
+#define XENMEM_sharing_op_nominate_gref     1
+#define XENMEM_sharing_op_share             2
+#define XENMEM_sharing_op_resume            3
+#define XENMEM_sharing_op_debug_gfn         4
+#define XENMEM_sharing_op_debug_mfn         5
+#define XENMEM_sharing_op_debug_gref        6
+#define XENMEM_sharing_op_add_physmap       7
+
+#define XENMEM_SHARING_OP_S_HANDLE_INVALID  (-10)
+#define XENMEM_SHARING_OP_C_HANDLE_INVALID  (-9)
+
+/* The following allows sharing of grant refs. This is useful
+ * for sharing utilities sitting as "filters" in IO backends
+ * (e.g. memshr + blktap(2)). The IO backend is only exposed 
+ * to grant references, and this allows sharing of the grefs */
+#define XENMEM_SHARING_OP_FIELD_IS_GREF_FLAG   (1ULL << 62)
+
+#define XENMEM_SHARING_OP_FIELD_MAKE_GREF(field, val)  \
+    (field) = (XENMEM_SHARING_OP_FIELD_IS_GREF_FLAG | val)
+#define XENMEM_SHARING_OP_FIELD_IS_GREF(field)         \
+    ((field) & XENMEM_SHARING_OP_FIELD_IS_GREF_FLAG)
+#define XENMEM_SHARING_OP_FIELD_GET_GREF(field)        \
+    ((field) & (~XENMEM_SHARING_OP_FIELD_IS_GREF_FLAG))
+
+struct xen_mem_sharing_op {
+    uint8_t     op;     /* XENMEM_sharing_op_* */
+    domid_t     domain;
+
+    union {
+        struct mem_sharing_op_nominate {  /* OP_NOMINATE_xxx           */
+            union {
+                uint64_aligned_t gfn;     /* IN: gfn to nominate       */
+                uint32_t      grant_ref;  /* IN: grant ref to nominate */
+            } u;
+            uint64_aligned_t  handle;     /* OUT: the handle           */
+        } nominate;
+        struct mem_sharing_op_share {     /* OP_SHARE/ADD_PHYSMAP */
+            uint64_aligned_t source_gfn;    /* IN: the gfn of the source page */
+            uint64_aligned_t source_handle; /* IN: handle to the source page */
+            uint64_aligned_t client_gfn;    /* IN: the client gfn */
+            uint64_aligned_t client_handle; /* IN: handle to the client page */
+            domid_t  client_domain; /* IN: the client domain id */
+        } share; 
+        struct mem_sharing_op_debug {     /* OP_DEBUG_xxx */
+            union {
+                uint64_aligned_t gfn;      /* IN: gfn to debug          */
+                uint64_aligned_t mfn;      /* IN: mfn to debug          */
+                uint32_t gref;     /* IN: gref to debug         */
+            } u;
+        } debug;
+    } u;
+};
+typedef struct xen_mem_sharing_op xen_mem_sharing_op_t;
+DEFINE_XEN_GUEST_HANDLE(xen_mem_sharing_op_t);
+
+#endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */
+
 #endif /* __XEN_PUBLIC_MEMORY_H__ */
 
 /*

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:53 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4em-0004Ik-SP; Sat, 11 Feb 2012 04:33:52 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4el-0004BL-55
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:51 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-174.messagelabs.com!1328934802!12913326!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22938 invoked from network); 11 Feb 2012 04:33:23 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eH-0006RU-VM
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eH-0001GG-U7
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:21 +0000
Message-Id: <E1Rw4eH-0001GG-U7@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: fix bootloader args setting
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Zhigang Wang <zhigang.x.wang@oracle.com>
# Date 1328812863 0
# Node ID e0392842b8a31146d84d7162de55fe275e4e5ea0
# Parent  28300f4562de59d4a857eb7aac6f2cf69813e6bf
libxl: fix bootloader args setting

When bootloader_args = ['foo', 'bar'], then info->u.pv.bootloader_args =

    foo\0
    bar\0
    \0

Before this patch, 'p++' points to the next character of 'foo\0' and never
comes to 'bar\0' (because of the '\0' in 'foo\0'), so the args will be:

    args[0] = 'oo\0'
    args[1] = 'o\0'

After this patch, 'p++' points to the next string of pv.bootloader_args, so we
get the correct args:

    args[0] = 'foo\0'
    args[1] = 'bar\0'

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 28300f4562de -r e0392842b8a3 tools/libxl/libxl_bootloader.c
--- a/tools/libxl/libxl_bootloader.c	Thu Feb 09 18:33:36 2012 +0000
+++ b/tools/libxl/libxl_bootloader.c	Thu Feb 09 18:41:03 2012 +0000
@@ -49,9 +49,11 @@
     flexarray_set(args, nr++, libxl__sprintf(gc, "--output-directory=%s", "/var/run/libxl/"));
 
     if (info->u.pv.bootloader_args) {
-        char *p = info->u.pv.bootloader_args[0];
-        while (*(p++))
-            flexarray_set(args, nr++, p);
+        char **p = info->u.pv.bootloader_args;
+        while (*p) {
+            flexarray_set(args, nr++, *p);
+            p++;
+        }
     }
 
     flexarray_set(args, nr++, disk);

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

From xen-changelog-bounces@lists.xensource.com Sat Feb 11 04:33:53 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Feb 2012 04:33:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rw4em-0004Ik-SP; Sat, 11 Feb 2012 04:33:52 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4el-0004BL-55
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:51 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-174.messagelabs.com!1328934802!12913326!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22938 invoked from network); 11 Feb 2012 04:33:23 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Feb 2012 04:33:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eH-0006RU-VM
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rw4eH-0001GG-U7
	for xen-changelog@lists.xensource.com; Sat, 11 Feb 2012 04:33:21 +0000
Message-Id: <E1Rw4eH-0001GG-U7@xenbits.xen.org>
Date: Sat, 11 Feb 2012 04:33:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: fix bootloader args setting
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Zhigang Wang <zhigang.x.wang@oracle.com>
# Date 1328812863 0
# Node ID e0392842b8a31146d84d7162de55fe275e4e5ea0
# Parent  28300f4562de59d4a857eb7aac6f2cf69813e6bf
libxl: fix bootloader args setting

When bootloader_args = ['foo', 'bar'], then info->u.pv.bootloader_args =

    foo\0
    bar\0
    \0

Before this patch, 'p++' points to the next character of 'foo\0' and never
comes to 'bar\0' (because of the '\0' in 'foo\0'), so the args will be:

    args[0] = 'oo\0'
    args[1] = 'o\0'

After this patch, 'p++' points to the next string of pv.bootloader_args, so we
get the correct args:

    args[0] = 'foo\0'
    args[1] = 'bar\0'

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 28300f4562de -r e0392842b8a3 tools/libxl/libxl_bootloader.c
--- a/tools/libxl/libxl_bootloader.c	Thu Feb 09 18:33:36 2012 +0000
+++ b/tools/libxl/libxl_bootloader.c	Thu Feb 09 18:41:03 2012 +0000
@@ -49,9 +49,11 @@
     flexarray_set(args, nr++, libxl__sprintf(gc, "--output-directory=%s", "/var/run/libxl/"));
 
     if (info->u.pv.bootloader_args) {
-        char *p = info->u.pv.bootloader_args[0];
-        while (*(p++))
-            flexarray_set(args, nr++, p);
+        char **p = info->u.pv.bootloader_args;
+        while (*p) {
+            flexarray_set(args, nr++, *p);
+            p++;
+        }
     }
 
     flexarray_set(args, nr++, disk);

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 01:00:27 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 01:00:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rx6km-0005bI-VW; Tue, 14 Feb 2012 01:00:20 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rx6kl-0005SM-DR
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 01:00:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-27.messagelabs.com!1329181173!59969570!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3706 invoked from network); 14 Feb 2012 00:59:34 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 00:59:34 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rx6kj-0000Nc-04
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 01:00:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rx6ki-00050c-Mr
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 01:00:16 +0000
Message-Id: <E1Rx6ki-00050c-Mr@xenbits.xen.org>
Date: Tue, 14 Feb 2012 01:00:15 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] xl: Drop -l option to xl
	cpupool-list
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329155867 0
# Node ID f2543f449a49b8979becbf6888e009973427089a
# Parent  cccd6c68e1b9527f556deef760713380801db9b5
xl: Drop -l option to xl cpupool-list

The implementation (which was a nop) was removed back in 22838:aab67c1c6b87 but
this now causes "set but not used" warnings from some compilers. Might as well
just nuke the option entirely.

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

xen-unstable changeset: 24703:b611bff9a8fc
Backport-requested-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r cccd6c68e1b9 -r f2543f449a49 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Thu Feb 02 13:56:13 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Mon Feb 13 17:57:47 2012 +0000
@@ -5444,11 +5444,9 @@
     int option_index = 0;
     static struct option long_options[] = {
         {"help", 0, 0, 'h'},
-        {"long", 0, 0, 'l'},
         {"cpus", 0, 0, 'c'},
         {0, 0, 0, 0}
     };
-    int opt_long = 0;
     int opt_cpus = 0;
     const char *pool = NULL;
     libxl_cpupoolinfo *poolinfo;
@@ -5458,7 +5456,7 @@
     int ret = 0;
 
     while (1) {
-        opt = getopt_long(argc, argv, "hlc", long_options, &option_index);
+        opt = getopt_long(argc, argv, "hc", long_options, &option_index);
         if (opt == -1)
             break;
 
@@ -5466,9 +5464,6 @@
         case 'h':
             help("cpupool-list");
             return 0;
-        case 'l':
-            opt_long = 1;
-            break;
         case 'c':
             opt_cpus = 1;
             break;

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 01:00:27 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 01:00:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rx6km-0005bI-VW; Tue, 14 Feb 2012 01:00:20 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rx6kl-0005SM-DR
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 01:00:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-27.messagelabs.com!1329181173!59969570!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3706 invoked from network); 14 Feb 2012 00:59:34 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 00:59:34 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rx6kj-0000Nc-04
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 01:00:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rx6ki-00050c-Mr
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 01:00:16 +0000
Message-Id: <E1Rx6ki-00050c-Mr@xenbits.xen.org>
Date: Tue, 14 Feb 2012 01:00:15 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] xl: Drop -l option to xl
	cpupool-list
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329155867 0
# Node ID f2543f449a49b8979becbf6888e009973427089a
# Parent  cccd6c68e1b9527f556deef760713380801db9b5
xl: Drop -l option to xl cpupool-list

The implementation (which was a nop) was removed back in 22838:aab67c1c6b87 but
this now causes "set but not used" warnings from some compilers. Might as well
just nuke the option entirely.

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

xen-unstable changeset: 24703:b611bff9a8fc
Backport-requested-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r cccd6c68e1b9 -r f2543f449a49 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Thu Feb 02 13:56:13 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Mon Feb 13 17:57:47 2012 +0000
@@ -5444,11 +5444,9 @@
     int option_index = 0;
     static struct option long_options[] = {
         {"help", 0, 0, 'h'},
-        {"long", 0, 0, 'l'},
         {"cpus", 0, 0, 'c'},
         {0, 0, 0, 0}
     };
-    int opt_long = 0;
     int opt_cpus = 0;
     const char *pool = NULL;
     libxl_cpupoolinfo *poolinfo;
@@ -5458,7 +5456,7 @@
     int ret = 0;
 
     while (1) {
-        opt = getopt_long(argc, argv, "hlc", long_options, &option_index);
+        opt = getopt_long(argc, argv, "hc", long_options, &option_index);
         if (opt == -1)
             break;
 
@@ -5466,9 +5464,6 @@
         case 'h':
             help("cpupool-list");
             return 0;
-        case 'l':
-            opt_long = 1;
-            break;
         case 'c':
             opt_cpus = 1;
             break;

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 11:44:16 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 11:44:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxGnt-0001A2-MK; Tue, 14 Feb 2012 11:44:13 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RxGns-00019q-UK
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 11:44:13 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-2.tower-21.messagelabs.com!1329219845!3934909!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14521 invoked from network); 14 Feb 2012 11:44:06 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 11:44:06 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RxGnl-0006kP-1A
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 11:44:05 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RxGnk-0004eY-D2
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 11:44:04 +0000
Date: Tue, 14 Feb 2012 11:44:04 +0000
Message-Id: <E1RxGnk-0004eY-D2@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-unstable] qemu: Don't access
	/proc/bus/pci unless graphics pass-thru is enabled
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 414b878e8ea17c65cd0d7f9dfc38dba472857f74
Author: George Dunlap <george.dunlap@eu.citrix.com>
Date:   Mon Feb 13 17:00:13 2012 +0000

    qemu: Don't access /proc/bus/pci unless graphics pass-thru is enabled
    
    A recent changeset introduced a bug whereby an initialization function
    that reads /proc/bus/pci is called from graphics set-up functions even
    if pass-through graphics are not enabled.  If qemu is run without
    permission to this file, this causes qemu to fail during
    initialization.
    
    This patch re-works the functions so that the initialization happens
    only if we actually need to do the pci host read or write.  It also
    makes failures call abort().
    
    Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
    Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 hw/pass-through.h |    2 +
 hw/pt-graphics.c  |   73 ++++++++++++++++++++++++++++++++++++----------------
 2 files changed, 52 insertions(+), 23 deletions(-)

diff --git a/hw/pass-through.h b/hw/pass-through.h
index 884139c..e641b56 100644
--- a/hw/pass-through.h
+++ b/hw/pass-through.h
@@ -29,6 +29,8 @@
 /* Log acesss */
 #define PT_LOGGING_ENABLED
 
+/* Print errors even if logging is disabled */
+#define PT_ERR(_f, _a...)   fprintf(logfile, "%s: " _f, __func__, ##_a)
 #ifdef PT_LOGGING_ENABLED
 #define PT_LOG(_f, _a...)   fprintf(logfile, "%s: " _f, __func__, ##_a)
 #define PT_LOG_DEV(_dev, _f, _a...)   fprintf(logfile, "%s: [%02x:%02x:%01x] " _f, __func__,    \
diff --git a/hw/pt-graphics.c b/hw/pt-graphics.c
index fec7390..d4f11db 100644
--- a/hw/pt-graphics.c
+++ b/hw/pt-graphics.c
@@ -23,11 +23,17 @@ void intel_pch_init(PCIBus *bus)
 {
     uint16_t vid, did;
     uint8_t  rid;
-    struct pci_dev *pci_dev_1f = pt_pci_get_dev(0, 0x1f, 0);
+    struct pci_dev *pci_dev_1f;
 
-    if ( !gfx_passthru || !pci_dev_1f )
+    if ( !gfx_passthru )
         return;
 
+    if ( !(pci_dev_1f=pt_pci_get_dev(0, 0x1f, 0)) )
+    {
+        PT_ERR("Error: Can't get pci_dev_host_bridge\n");
+        abort();
+    }
+
     vid = pt_pci_host_read(pci_dev_1f, PCI_VENDOR_ID, 2);
     did = pt_pci_host_read(pci_dev_1f, PCI_DEVICE_ID, 2);
     rid = pt_pci_host_read(pci_dev_1f, PCI_REVISION, 1);
@@ -39,36 +45,45 @@ void intel_pch_init(PCIBus *bus)
 
 void igd_pci_write(PCIDevice *pci_dev, uint32_t config_addr, uint32_t val, int len)
 {
-    struct pci_dev *pci_dev_host_bridge = pt_pci_get_dev(0, 0, 0);
+    struct pci_dev *pci_dev_host_bridge;
     assert(pci_dev->devfn == 0x00);
-    if ( !igd_passthru ) {
-        pci_default_write_config(pci_dev, config_addr, val, len);
-        return;
-    }
+    if ( !igd_passthru )
+        goto write_default;
 
     switch (config_addr)
     {
         case 0x58:        // PAVPC Offset
-            pt_pci_host_write(pci_dev_host_bridge, config_addr, val, len);
-#ifdef PT_DEBUG_PCI_CONFIG_ACCESS
-            PT_LOG_DEV(pci_dev, "addr=%x len=%x val=%x\n",
-                    config_addr, len, val);
-#endif
             break;
         default:
-            pci_default_write_config(pci_dev, config_addr, val, len);
+            goto write_default;
+    }
+
+    /* Host write */
+    if ( !(pci_dev_host_bridge = pt_pci_get_dev(0, 0, 0)) )
+    {
+        PT_ERR("Error: Can't get pci_dev_host_bridge\n");
+        abort();
     }
+
+    pt_pci_host_write(pci_dev_host_bridge, config_addr, val, len);
+#ifdef PT_DEBUG_PCI_CONFIG_ACCESS
+    PT_LOG_DEV(pci_dev, "addr=%x len=%x val=%x\n",
+               config_addr, len, val);
+#endif
+    return;
+
+write_default:
+    pci_default_write_config(pci_dev, config_addr, val, len);
 }
 
 uint32_t igd_pci_read(PCIDevice *pci_dev, uint32_t config_addr, int len)
 {
-    struct pci_dev *pci_dev_host_bridge = pt_pci_get_dev(0, 0, 0);
+    struct pci_dev *pci_dev_host_bridge;
     uint32_t val;
 
     assert(pci_dev->devfn == 0x00);
-    if ( !igd_passthru ) {
-        return pci_default_read_config(pci_dev, config_addr, len);
-    }
+    if ( !igd_passthru )
+        goto read_default;
 
     switch (config_addr)
     {
@@ -81,16 +96,28 @@ uint32_t igd_pci_read(PCIDevice *pci_dev, uint32_t config_addr, int len)
         case 0x58:        /* SNB: PAVPC Offset */
         case 0xa4:        /* SNB: graphics base of stolen memory */
         case 0xa8:        /* SNB: base of GTT stolen memory */
-            val = pt_pci_host_read(pci_dev_host_bridge, config_addr, len);
-#ifdef PT_DEBUG_PCI_CONFIG_ACCESS
-            PT_LOG_DEV(pci_dev, "addr=%x len=%x val=%x\n",
-                    config_addr, len, val);
-#endif
             break;
         default:
-            val = pci_default_read_config(pci_dev, config_addr, len);
+            goto read_default;
     }
+
+    /* Host read */
+    if ( !(pci_dev_host_bridge = pt_pci_get_dev(0, 0, 0)) )
+    {
+        PT_ERR("Error: Can't get pci_dev_host_bridge\n");
+        abort();
+    }
+
+    val = pt_pci_host_read(pci_dev_host_bridge, config_addr, len);
+#ifdef PT_DEBUG_PCI_CONFIG_ACCESS
+    PT_LOG_DEV(pci_dev, "addr=%x len=%x val=%x\n",
+               config_addr, len, val);
+#endif
     return val;
+   
+read_default:
+   
+   return pci_default_read_config(pci_dev, config_addr, len);
 }
 
 /*
--
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 Tue Feb 14 11:44:16 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 11:44:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxGnt-0001A2-MK; Tue, 14 Feb 2012 11:44:13 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RxGns-00019q-UK
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 11:44:13 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-2.tower-21.messagelabs.com!1329219845!3934909!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14521 invoked from network); 14 Feb 2012 11:44:06 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 11:44:06 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RxGnl-0006kP-1A
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 11:44:05 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RxGnk-0004eY-D2
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 11:44:04 +0000
Date: Tue, 14 Feb 2012 11:44:04 +0000
Message-Id: <E1RxGnk-0004eY-D2@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-unstable] qemu: Don't access
	/proc/bus/pci unless graphics pass-thru is enabled
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 414b878e8ea17c65cd0d7f9dfc38dba472857f74
Author: George Dunlap <george.dunlap@eu.citrix.com>
Date:   Mon Feb 13 17:00:13 2012 +0000

    qemu: Don't access /proc/bus/pci unless graphics pass-thru is enabled
    
    A recent changeset introduced a bug whereby an initialization function
    that reads /proc/bus/pci is called from graphics set-up functions even
    if pass-through graphics are not enabled.  If qemu is run without
    permission to this file, this causes qemu to fail during
    initialization.
    
    This patch re-works the functions so that the initialization happens
    only if we actually need to do the pci host read or write.  It also
    makes failures call abort().
    
    Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
    Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 hw/pass-through.h |    2 +
 hw/pt-graphics.c  |   73 ++++++++++++++++++++++++++++++++++++----------------
 2 files changed, 52 insertions(+), 23 deletions(-)

diff --git a/hw/pass-through.h b/hw/pass-through.h
index 884139c..e641b56 100644
--- a/hw/pass-through.h
+++ b/hw/pass-through.h
@@ -29,6 +29,8 @@
 /* Log acesss */
 #define PT_LOGGING_ENABLED
 
+/* Print errors even if logging is disabled */
+#define PT_ERR(_f, _a...)   fprintf(logfile, "%s: " _f, __func__, ##_a)
 #ifdef PT_LOGGING_ENABLED
 #define PT_LOG(_f, _a...)   fprintf(logfile, "%s: " _f, __func__, ##_a)
 #define PT_LOG_DEV(_dev, _f, _a...)   fprintf(logfile, "%s: [%02x:%02x:%01x] " _f, __func__,    \
diff --git a/hw/pt-graphics.c b/hw/pt-graphics.c
index fec7390..d4f11db 100644
--- a/hw/pt-graphics.c
+++ b/hw/pt-graphics.c
@@ -23,11 +23,17 @@ void intel_pch_init(PCIBus *bus)
 {
     uint16_t vid, did;
     uint8_t  rid;
-    struct pci_dev *pci_dev_1f = pt_pci_get_dev(0, 0x1f, 0);
+    struct pci_dev *pci_dev_1f;
 
-    if ( !gfx_passthru || !pci_dev_1f )
+    if ( !gfx_passthru )
         return;
 
+    if ( !(pci_dev_1f=pt_pci_get_dev(0, 0x1f, 0)) )
+    {
+        PT_ERR("Error: Can't get pci_dev_host_bridge\n");
+        abort();
+    }
+
     vid = pt_pci_host_read(pci_dev_1f, PCI_VENDOR_ID, 2);
     did = pt_pci_host_read(pci_dev_1f, PCI_DEVICE_ID, 2);
     rid = pt_pci_host_read(pci_dev_1f, PCI_REVISION, 1);
@@ -39,36 +45,45 @@ void intel_pch_init(PCIBus *bus)
 
 void igd_pci_write(PCIDevice *pci_dev, uint32_t config_addr, uint32_t val, int len)
 {
-    struct pci_dev *pci_dev_host_bridge = pt_pci_get_dev(0, 0, 0);
+    struct pci_dev *pci_dev_host_bridge;
     assert(pci_dev->devfn == 0x00);
-    if ( !igd_passthru ) {
-        pci_default_write_config(pci_dev, config_addr, val, len);
-        return;
-    }
+    if ( !igd_passthru )
+        goto write_default;
 
     switch (config_addr)
     {
         case 0x58:        // PAVPC Offset
-            pt_pci_host_write(pci_dev_host_bridge, config_addr, val, len);
-#ifdef PT_DEBUG_PCI_CONFIG_ACCESS
-            PT_LOG_DEV(pci_dev, "addr=%x len=%x val=%x\n",
-                    config_addr, len, val);
-#endif
             break;
         default:
-            pci_default_write_config(pci_dev, config_addr, val, len);
+            goto write_default;
+    }
+
+    /* Host write */
+    if ( !(pci_dev_host_bridge = pt_pci_get_dev(0, 0, 0)) )
+    {
+        PT_ERR("Error: Can't get pci_dev_host_bridge\n");
+        abort();
     }
+
+    pt_pci_host_write(pci_dev_host_bridge, config_addr, val, len);
+#ifdef PT_DEBUG_PCI_CONFIG_ACCESS
+    PT_LOG_DEV(pci_dev, "addr=%x len=%x val=%x\n",
+               config_addr, len, val);
+#endif
+    return;
+
+write_default:
+    pci_default_write_config(pci_dev, config_addr, val, len);
 }
 
 uint32_t igd_pci_read(PCIDevice *pci_dev, uint32_t config_addr, int len)
 {
-    struct pci_dev *pci_dev_host_bridge = pt_pci_get_dev(0, 0, 0);
+    struct pci_dev *pci_dev_host_bridge;
     uint32_t val;
 
     assert(pci_dev->devfn == 0x00);
-    if ( !igd_passthru ) {
-        return pci_default_read_config(pci_dev, config_addr, len);
-    }
+    if ( !igd_passthru )
+        goto read_default;
 
     switch (config_addr)
     {
@@ -81,16 +96,28 @@ uint32_t igd_pci_read(PCIDevice *pci_dev, uint32_t config_addr, int len)
         case 0x58:        /* SNB: PAVPC Offset */
         case 0xa4:        /* SNB: graphics base of stolen memory */
         case 0xa8:        /* SNB: base of GTT stolen memory */
-            val = pt_pci_host_read(pci_dev_host_bridge, config_addr, len);
-#ifdef PT_DEBUG_PCI_CONFIG_ACCESS
-            PT_LOG_DEV(pci_dev, "addr=%x len=%x val=%x\n",
-                    config_addr, len, val);
-#endif
             break;
         default:
-            val = pci_default_read_config(pci_dev, config_addr, len);
+            goto read_default;
     }
+
+    /* Host read */
+    if ( !(pci_dev_host_bridge = pt_pci_get_dev(0, 0, 0)) )
+    {
+        PT_ERR("Error: Can't get pci_dev_host_bridge\n");
+        abort();
+    }
+
+    val = pt_pci_host_read(pci_dev_host_bridge, config_addr, len);
+#ifdef PT_DEBUG_PCI_CONFIG_ACCESS
+    PT_LOG_DEV(pci_dev, "addr=%x len=%x val=%x\n",
+               config_addr, len, val);
+#endif
     return val;
+   
+read_default:
+   
+   return pci_default_read_config(pci_dev, config_addr, len);
 }
 
 /*
--
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 Tue Feb 14 23:55:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDM-0004uZ-Bi; Tue, 14 Feb 2012 23:55:16 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDL-0004u9-3U
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:15 +0000
Received: from [85.158.139.83:45040] by server-6.bemta-5.messagelabs.com id
	DF/49-27305-264FA3F4; Tue, 14 Feb 2012 23:55:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-182.messagelabs.com!1329263712!7752238!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31090 invoked from network); 14 Feb 2012 23:55:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDH-0007hl-F1
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDH-0002Al-AP
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:11 +0000
Message-Id: <E1RxSDH-0002Al-AP@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] hvmloader: Only compile
	32bitbios_support.c when rombios is enabled
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Julian Pidancet <julian.pidancet@gmail.com>
# Date 1329137266 0
# Node ID e1f10d12b9fe5eca56cb7bc5ac332662865cf42f
# Parent  6ae5506e49abbe07b3b84c56cda114f59beb7ebe
hvmloader: Only compile 32bitbios_support.c when rombios is enabled

32bitbios_support.c only contains code specific to rombios, and should
not be built-in when building hvmloader for SeaBIOS only (as for
rombios.c).

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 6ae5506e49ab -r e1f10d12b9fe tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile	Mon Feb 13 13:12:30 2012 +0100
+++ b/tools/firmware/hvmloader/Makefile	Mon Feb 13 12:47:46 2012 +0000
@@ -29,7 +29,7 @@
 CFLAGS += $(CFLAGS_xeninclude)
 
 OBJS  = hvmloader.o mp_tables.o util.o smbios.o 
-OBJS += 32bitbios_support.o smp.o cacheattr.o xenbus.o
+OBJS += smp.o cacheattr.o xenbus.o
 OBJS += e820.o pci.o pir.o ctype.o
 ifeq ($(debug),y)
 OBJS += tests.o
@@ -39,7 +39,7 @@
 
 ROMBIOS_DIR := ../rombios
 ifneq ($(ROMBIOS_DIR),)
-OBJS += rombios.o
+OBJS += 32bitbios_support.o rombios.o
 CFLAGS += -DENABLE_ROMBIOS
 ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest
 endif

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDM-0004uZ-Bi; Tue, 14 Feb 2012 23:55:16 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDL-0004u9-3U
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:15 +0000
Received: from [85.158.139.83:45040] by server-6.bemta-5.messagelabs.com id
	DF/49-27305-264FA3F4; Tue, 14 Feb 2012 23:55:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-182.messagelabs.com!1329263712!7752238!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31090 invoked from network); 14 Feb 2012 23:55:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDH-0007hl-F1
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDH-0002Al-AP
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:11 +0000
Message-Id: <E1RxSDH-0002Al-AP@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] hvmloader: Only compile
	32bitbios_support.c when rombios is enabled
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Julian Pidancet <julian.pidancet@gmail.com>
# Date 1329137266 0
# Node ID e1f10d12b9fe5eca56cb7bc5ac332662865cf42f
# Parent  6ae5506e49abbe07b3b84c56cda114f59beb7ebe
hvmloader: Only compile 32bitbios_support.c when rombios is enabled

32bitbios_support.c only contains code specific to rombios, and should
not be built-in when building hvmloader for SeaBIOS only (as for
rombios.c).

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 6ae5506e49ab -r e1f10d12b9fe tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile	Mon Feb 13 13:12:30 2012 +0100
+++ b/tools/firmware/hvmloader/Makefile	Mon Feb 13 12:47:46 2012 +0000
@@ -29,7 +29,7 @@
 CFLAGS += $(CFLAGS_xeninclude)
 
 OBJS  = hvmloader.o mp_tables.o util.o smbios.o 
-OBJS += 32bitbios_support.o smp.o cacheattr.o xenbus.o
+OBJS += smp.o cacheattr.o xenbus.o
 OBJS += e820.o pci.o pir.o ctype.o
 ifeq ($(debug),y)
 OBJS += tests.o
@@ -39,7 +39,7 @@
 
 ROMBIOS_DIR := ../rombios
 ifneq ($(ROMBIOS_DIR),)
-OBJS += rombios.o
+OBJS += 32bitbios_support.o rombios.o
 CFLAGS += -DENABLE_ROMBIOS
 ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest
 endif

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDL-0004uG-6P; Tue, 14 Feb 2012 23:55:15 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDJ-0004u0-IN
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:13 +0000
Received: from [85.158.143.35:57538] by server-1.bemta-4.messagelabs.com id
	19/72-20925-064FA3F4; Tue, 14 Feb 2012 23:55:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1329263710!1882317!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22932 invoked from network); 14 Feb 2012 23:55:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDG-0007hf-By
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDF-00029v-Qs
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:09 +0000
Message-Id: <E1RxSDF-00029v-Qs@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/paging: use clear_guest() for
	zero-filling guest buffers
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329134942 -3600
# Node ID e953d536d3c6e344cf310f63ead9feda87cc67b0
# Parent  9ad1e42c341bc78463b6f6610a6300f75b535fbb
x86/paging: use clear_guest() for zero-filling guest buffers

While static arrays of all zeros may be tolerable (but are simply
inefficient now that we have the necessary infrastructure), using on-
stack arrays for this purpose (particularly when their size doesn't
have an upper limit enforced) is calling for eventual problems (even
if the code can be reached via administrative interfaces only).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
---


diff -r 9ad1e42c341b -r e953d536d3c6 xen/arch/x86/mm/paging.c
--- a/xen/arch/x86/mm/paging.c	Fri Feb 10 17:24:50 2012 +0000
+++ b/xen/arch/x86/mm/paging.c	Mon Feb 13 13:09:02 2012 +0100
@@ -21,11 +21,11 @@
  */
 
 #include <xen/init.h>
+#include <xen/guest_access.h>
 #include <asm/paging.h>
 #include <asm/shadow.h>
 #include <asm/p2m.h>
 #include <asm/hap.h>
-#include <asm/guest_access.h>
 #include <asm/hvm/nestedhvm.h>
 #include <xen/numa.h>
 #include <xsm/xsm.h>
@@ -383,26 +383,30 @@
                   (pages < sc->pages) && (i2 < LOGDIRTY_NODE_ENTRIES);
                   i2++ )
             {
-                static unsigned long zeroes[PAGE_SIZE/BYTES_PER_LONG];
                 unsigned int bytes = PAGE_SIZE;
                 l1 = ((l2 && mfn_valid(l2[i2])) ?
-                      map_domain_page(mfn_x(l2[i2])) : zeroes);
+                      map_domain_page(mfn_x(l2[i2])) : NULL);
                 if ( unlikely(((sc->pages - pages + 7) >> 3) < bytes) )
                     bytes = (unsigned int)((sc->pages - pages + 7) >> 3);
                 if ( likely(peek) )
                 {
-                    if ( copy_to_guest_offset(sc->dirty_bitmap, pages >> 3,
-                                              (uint8_t *)l1, bytes) != 0 )
+                    if ( (l1 ? copy_to_guest_offset(sc->dirty_bitmap,
+                                                    pages >> 3, (uint8_t *)l1,
+                                                    bytes)
+                             : clear_guest_offset(sc->dirty_bitmap,
+                                                  pages >> 3, bytes)) != 0 )
                     {
                         rv = -EFAULT;
                         goto out;
                     }
                 }
-                if ( clean && l1 != zeroes )
-                    clear_page(l1);
                 pages += bytes << 3;
-                if ( l1 != zeroes )
+                if ( l1 )
+                {
+                    if ( clean )
+                        clear_page(l1);
                     unmap_domain_page(l1);
+                }
             }
             if ( l2 )
                 unmap_domain_page(l2);
@@ -462,12 +466,9 @@
 
     if ( !d->arch.paging.log_dirty.fault_count &&
          !d->arch.paging.log_dirty.dirty_count ) {
-        int size = (nr + BITS_PER_LONG - 1) / BITS_PER_LONG;
-        unsigned long zeroes[size];
-        memset(zeroes, 0x00, size * BYTES_PER_LONG);
-        rv = 0;
-        if ( copy_to_guest_offset(dirty_bitmap, 0, (uint8_t *) zeroes,
-                                  size * BYTES_PER_LONG) != 0 )
+        unsigned int size = BITS_TO_LONGS(nr);
+
+        if ( clear_guest(dirty_bitmap, size * BYTES_PER_LONG) != 0 )
             rv = -EFAULT;
         goto out;
     }
@@ -495,11 +496,10 @@
                   (pages < nr) && (i2 < LOGDIRTY_NODE_ENTRIES);
                   i2++ )
             {
-                static unsigned long zeroes[PAGE_SIZE/BYTES_PER_LONG];
                 unsigned int bytes = PAGE_SIZE;
                 uint8_t *s;
                 l1 = ((l2 && mfn_valid(l2[i2])) ?
-                      map_domain_page(mfn_x(l2[i2])) : zeroes);
+                      map_domain_page(mfn_x(l2[i2])) : NULL);
 
                 s = ((uint8_t*)l1) + (b1 >> 3);
                 bytes -= b1 >> 3;
@@ -507,9 +507,18 @@
                 if ( likely(((nr - pages + 7) >> 3) < bytes) )
                     bytes = (unsigned int)((nr - pages + 7) >> 3);
 
+                if ( !l1 )
+                {
+                    if ( clear_guest_offset(dirty_bitmap, pages >> 3,
+                                            bytes) != 0 )
+                    {
+                        rv = -EFAULT;
+                        goto out;
+                    }
+                }
                 /* begin_pfn is not 32K aligned, hence we have to bit
                  * shift the bitmap */
-                if ( b1 & 0x7 )
+                else if ( b1 & 0x7 )
                 {
                     int i, j;
                     uint32_t *l = (uint32_t*) s;
@@ -553,11 +562,12 @@
                     }
                 }
 
-                if ( l1 != zeroes )
+                pages += bytes << 3;
+                if ( l1 )
+                {
                     clear_page(l1);
-                pages += bytes << 3;
-                if ( l1 != zeroes )
                     unmap_domain_page(l1);
+                }
                 b1 = b1 & 0x7;
             }
             b2 = 0;

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDL-0004uG-6P; Tue, 14 Feb 2012 23:55:15 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDJ-0004u0-IN
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:13 +0000
Received: from [85.158.143.35:57538] by server-1.bemta-4.messagelabs.com id
	19/72-20925-064FA3F4; Tue, 14 Feb 2012 23:55:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1329263710!1882317!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22932 invoked from network); 14 Feb 2012 23:55:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDG-0007hf-By
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDF-00029v-Qs
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:09 +0000
Message-Id: <E1RxSDF-00029v-Qs@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/paging: use clear_guest() for
	zero-filling guest buffers
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329134942 -3600
# Node ID e953d536d3c6e344cf310f63ead9feda87cc67b0
# Parent  9ad1e42c341bc78463b6f6610a6300f75b535fbb
x86/paging: use clear_guest() for zero-filling guest buffers

While static arrays of all zeros may be tolerable (but are simply
inefficient now that we have the necessary infrastructure), using on-
stack arrays for this purpose (particularly when their size doesn't
have an upper limit enforced) is calling for eventual problems (even
if the code can be reached via administrative interfaces only).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
---


diff -r 9ad1e42c341b -r e953d536d3c6 xen/arch/x86/mm/paging.c
--- a/xen/arch/x86/mm/paging.c	Fri Feb 10 17:24:50 2012 +0000
+++ b/xen/arch/x86/mm/paging.c	Mon Feb 13 13:09:02 2012 +0100
@@ -21,11 +21,11 @@
  */
 
 #include <xen/init.h>
+#include <xen/guest_access.h>
 #include <asm/paging.h>
 #include <asm/shadow.h>
 #include <asm/p2m.h>
 #include <asm/hap.h>
-#include <asm/guest_access.h>
 #include <asm/hvm/nestedhvm.h>
 #include <xen/numa.h>
 #include <xsm/xsm.h>
@@ -383,26 +383,30 @@
                   (pages < sc->pages) && (i2 < LOGDIRTY_NODE_ENTRIES);
                   i2++ )
             {
-                static unsigned long zeroes[PAGE_SIZE/BYTES_PER_LONG];
                 unsigned int bytes = PAGE_SIZE;
                 l1 = ((l2 && mfn_valid(l2[i2])) ?
-                      map_domain_page(mfn_x(l2[i2])) : zeroes);
+                      map_domain_page(mfn_x(l2[i2])) : NULL);
                 if ( unlikely(((sc->pages - pages + 7) >> 3) < bytes) )
                     bytes = (unsigned int)((sc->pages - pages + 7) >> 3);
                 if ( likely(peek) )
                 {
-                    if ( copy_to_guest_offset(sc->dirty_bitmap, pages >> 3,
-                                              (uint8_t *)l1, bytes) != 0 )
+                    if ( (l1 ? copy_to_guest_offset(sc->dirty_bitmap,
+                                                    pages >> 3, (uint8_t *)l1,
+                                                    bytes)
+                             : clear_guest_offset(sc->dirty_bitmap,
+                                                  pages >> 3, bytes)) != 0 )
                     {
                         rv = -EFAULT;
                         goto out;
                     }
                 }
-                if ( clean && l1 != zeroes )
-                    clear_page(l1);
                 pages += bytes << 3;
-                if ( l1 != zeroes )
+                if ( l1 )
+                {
+                    if ( clean )
+                        clear_page(l1);
                     unmap_domain_page(l1);
+                }
             }
             if ( l2 )
                 unmap_domain_page(l2);
@@ -462,12 +466,9 @@
 
     if ( !d->arch.paging.log_dirty.fault_count &&
          !d->arch.paging.log_dirty.dirty_count ) {
-        int size = (nr + BITS_PER_LONG - 1) / BITS_PER_LONG;
-        unsigned long zeroes[size];
-        memset(zeroes, 0x00, size * BYTES_PER_LONG);
-        rv = 0;
-        if ( copy_to_guest_offset(dirty_bitmap, 0, (uint8_t *) zeroes,
-                                  size * BYTES_PER_LONG) != 0 )
+        unsigned int size = BITS_TO_LONGS(nr);
+
+        if ( clear_guest(dirty_bitmap, size * BYTES_PER_LONG) != 0 )
             rv = -EFAULT;
         goto out;
     }
@@ -495,11 +496,10 @@
                   (pages < nr) && (i2 < LOGDIRTY_NODE_ENTRIES);
                   i2++ )
             {
-                static unsigned long zeroes[PAGE_SIZE/BYTES_PER_LONG];
                 unsigned int bytes = PAGE_SIZE;
                 uint8_t *s;
                 l1 = ((l2 && mfn_valid(l2[i2])) ?
-                      map_domain_page(mfn_x(l2[i2])) : zeroes);
+                      map_domain_page(mfn_x(l2[i2])) : NULL);
 
                 s = ((uint8_t*)l1) + (b1 >> 3);
                 bytes -= b1 >> 3;
@@ -507,9 +507,18 @@
                 if ( likely(((nr - pages + 7) >> 3) < bytes) )
                     bytes = (unsigned int)((nr - pages + 7) >> 3);
 
+                if ( !l1 )
+                {
+                    if ( clear_guest_offset(dirty_bitmap, pages >> 3,
+                                            bytes) != 0 )
+                    {
+                        rv = -EFAULT;
+                        goto out;
+                    }
+                }
                 /* begin_pfn is not 32K aligned, hence we have to bit
                  * shift the bitmap */
-                if ( b1 & 0x7 )
+                else if ( b1 & 0x7 )
                 {
                     int i, j;
                     uint32_t *l = (uint32_t*) s;
@@ -553,11 +562,12 @@
                     }
                 }
 
-                if ( l1 != zeroes )
+                pages += bytes << 3;
+                if ( l1 )
+                {
                     clear_page(l1);
-                pages += bytes << 3;
-                if ( l1 != zeroes )
                     unmap_domain_page(l1);
+                }
                 b1 = b1 & 0x7;
             }
             b2 = 0;

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:21 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDM-0004uT-9A; Tue, 14 Feb 2012 23:55:16 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDK-0004u8-QZ
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1329263648!61105746!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16937 invoked from network); 14 Feb 2012 23:54:09 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:54:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDG-0007hi-Nc
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDG-0002AL-Fm
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:10 +0000
Message-Id: <E1RxSDG-0002AL-Fm@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/vMCE: MC{G,
	i}_CTL handling adjustments
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329135150 -3600
# Node ID 6ae5506e49abbe07b3b84c56cda114f59beb7ebe
# Parent  e953d536d3c6e344cf310f63ead9feda87cc67b0
x86/vMCE: MC{G,i}_CTL handling adjustments

- g_mcg_cap was read to determine whether MCG_CTL exists before it got
  initialized
- h_mci_ctrl[] and dom_vmce()->mci_ctl[] both got initialized via
  memset() with an inappropriate size (hence causing a [minor?]
  information leak)

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


diff -r e953d536d3c6 -r 6ae5506e49ab xen/arch/x86/cpu/mcheck/mce.c
--- a/xen/arch/x86/cpu/mcheck/mce.c	Mon Feb 13 13:09:02 2012 +0100
+++ b/xen/arch/x86/cpu/mcheck/mce.c	Mon Feb 13 13:12:30 2012 +0100
@@ -29,7 +29,7 @@
 bool_t __read_mostly mce_broadcast = 0;
 bool_t is_mc_panic;
 unsigned int __read_mostly nr_mce_banks;
-int __read_mostly firstbank;
+unsigned int __read_mostly firstbank;
 
 static void intpose_init(void);
 static void mcinfo_clear(struct mc_info *);
@@ -650,7 +650,7 @@
  * Check if bank 0 is usable for MCE. It isn't for AMD K7,
  * and Intel P6 family before model 0x1a.
  */
-int mce_firstbank(struct cpuinfo_x86 *c)
+unsigned int mce_firstbank(struct cpuinfo_x86 *c)
 {
     if (c->x86 == 6) {
         if (c->x86_vendor == X86_VENDOR_AMD)
diff -r e953d536d3c6 -r 6ae5506e49ab xen/arch/x86/cpu/mcheck/mce.h
--- a/xen/arch/x86/cpu/mcheck/mce.h	Mon Feb 13 13:09:02 2012 +0100
+++ b/xen/arch/x86/cpu/mcheck/mce.h	Mon Feb 13 13:12:30 2012 +0100
@@ -52,7 +52,7 @@
 int unmmap_broken_page(struct domain *d, mfn_t mfn, unsigned long gfn);
 
 u64 mce_cap_init(void);
-extern int firstbank;
+extern unsigned int firstbank;
 
 int intel_mce_rdmsr(uint32_t msr, uint64_t *val);
 int intel_mce_wrmsr(uint32_t msr, uint64_t val);
@@ -61,7 +61,7 @@
     struct mcinfo_global *mig, struct mc_info *mi);
 
 int mce_available(struct cpuinfo_x86 *c);
-int mce_firstbank(struct cpuinfo_x86 *c);
+unsigned int mce_firstbank(struct cpuinfo_x86 *c);
 /* Helper functions used for collecting error telemetry */
 struct mc_info *x86_mcinfo_getptr(void);
 void mc_panic(char *s);
diff -r e953d536d3c6 -r 6ae5506e49ab xen/arch/x86/cpu/mcheck/vmce.c
--- a/xen/arch/x86/cpu/mcheck/vmce.c	Mon Feb 13 13:09:02 2012 +0100
+++ b/xen/arch/x86/cpu/mcheck/vmce.c	Mon Feb 13 13:12:30 2012 +0100
@@ -39,7 +39,7 @@
         return -ENOMEM;
     }
     memset(dom_vmce(d)->mci_ctl, ~0,
-           sizeof(dom_vmce(d)->mci_ctl));
+           nr_mce_banks * sizeof(*dom_vmce(d)->mci_ctl));
 
     dom_vmce(d)->mcg_status = 0x0;
     dom_vmce(d)->mcg_cap = g_mcg_cap;
@@ -438,7 +438,7 @@
 int vmce_init(struct cpuinfo_x86 *c)
 {
     u64 value;
-    int i;
+    unsigned int i;
 
     if ( !h_mci_ctrl )
     {
@@ -449,17 +449,17 @@
             return -ENOMEM;
         }
         /* Don't care banks before firstbank */
-        memset(h_mci_ctrl, 0xff, sizeof(h_mci_ctrl));
+        memset(h_mci_ctrl, ~0,
+               min(firstbank, nr_mce_banks) * sizeof(*h_mci_ctrl));
         for (i = firstbank; i < nr_mce_banks; i++)
             rdmsrl(MSR_IA32_MCx_CTL(i), h_mci_ctrl[i]);
     }
 
-    if (g_mcg_cap & MCG_CTL_P)
-        rdmsrl(MSR_IA32_MCG_CTL, h_mcg_ctl);
-
     rdmsrl(MSR_IA32_MCG_CAP, value);
     /* For Guest vMCE usage */
     g_mcg_cap = value & ~MCG_CMCI_P;
+    if (value & MCG_CTL_P)
+        rdmsrl(MSR_IA32_MCG_CTL, h_mcg_ctl);
 
     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 Feb 14 23:55:21 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDM-0004uT-9A; Tue, 14 Feb 2012 23:55:16 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDK-0004u8-QZ
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1329263648!61105746!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16937 invoked from network); 14 Feb 2012 23:54:09 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:54:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDG-0007hi-Nc
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDG-0002AL-Fm
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:10 +0000
Message-Id: <E1RxSDG-0002AL-Fm@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/vMCE: MC{G,
	i}_CTL handling adjustments
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329135150 -3600
# Node ID 6ae5506e49abbe07b3b84c56cda114f59beb7ebe
# Parent  e953d536d3c6e344cf310f63ead9feda87cc67b0
x86/vMCE: MC{G,i}_CTL handling adjustments

- g_mcg_cap was read to determine whether MCG_CTL exists before it got
  initialized
- h_mci_ctrl[] and dom_vmce()->mci_ctl[] both got initialized via
  memset() with an inappropriate size (hence causing a [minor?]
  information leak)

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


diff -r e953d536d3c6 -r 6ae5506e49ab xen/arch/x86/cpu/mcheck/mce.c
--- a/xen/arch/x86/cpu/mcheck/mce.c	Mon Feb 13 13:09:02 2012 +0100
+++ b/xen/arch/x86/cpu/mcheck/mce.c	Mon Feb 13 13:12:30 2012 +0100
@@ -29,7 +29,7 @@
 bool_t __read_mostly mce_broadcast = 0;
 bool_t is_mc_panic;
 unsigned int __read_mostly nr_mce_banks;
-int __read_mostly firstbank;
+unsigned int __read_mostly firstbank;
 
 static void intpose_init(void);
 static void mcinfo_clear(struct mc_info *);
@@ -650,7 +650,7 @@
  * Check if bank 0 is usable for MCE. It isn't for AMD K7,
  * and Intel P6 family before model 0x1a.
  */
-int mce_firstbank(struct cpuinfo_x86 *c)
+unsigned int mce_firstbank(struct cpuinfo_x86 *c)
 {
     if (c->x86 == 6) {
         if (c->x86_vendor == X86_VENDOR_AMD)
diff -r e953d536d3c6 -r 6ae5506e49ab xen/arch/x86/cpu/mcheck/mce.h
--- a/xen/arch/x86/cpu/mcheck/mce.h	Mon Feb 13 13:09:02 2012 +0100
+++ b/xen/arch/x86/cpu/mcheck/mce.h	Mon Feb 13 13:12:30 2012 +0100
@@ -52,7 +52,7 @@
 int unmmap_broken_page(struct domain *d, mfn_t mfn, unsigned long gfn);
 
 u64 mce_cap_init(void);
-extern int firstbank;
+extern unsigned int firstbank;
 
 int intel_mce_rdmsr(uint32_t msr, uint64_t *val);
 int intel_mce_wrmsr(uint32_t msr, uint64_t val);
@@ -61,7 +61,7 @@
     struct mcinfo_global *mig, struct mc_info *mi);
 
 int mce_available(struct cpuinfo_x86 *c);
-int mce_firstbank(struct cpuinfo_x86 *c);
+unsigned int mce_firstbank(struct cpuinfo_x86 *c);
 /* Helper functions used for collecting error telemetry */
 struct mc_info *x86_mcinfo_getptr(void);
 void mc_panic(char *s);
diff -r e953d536d3c6 -r 6ae5506e49ab xen/arch/x86/cpu/mcheck/vmce.c
--- a/xen/arch/x86/cpu/mcheck/vmce.c	Mon Feb 13 13:09:02 2012 +0100
+++ b/xen/arch/x86/cpu/mcheck/vmce.c	Mon Feb 13 13:12:30 2012 +0100
@@ -39,7 +39,7 @@
         return -ENOMEM;
     }
     memset(dom_vmce(d)->mci_ctl, ~0,
-           sizeof(dom_vmce(d)->mci_ctl));
+           nr_mce_banks * sizeof(*dom_vmce(d)->mci_ctl));
 
     dom_vmce(d)->mcg_status = 0x0;
     dom_vmce(d)->mcg_cap = g_mcg_cap;
@@ -438,7 +438,7 @@
 int vmce_init(struct cpuinfo_x86 *c)
 {
     u64 value;
-    int i;
+    unsigned int i;
 
     if ( !h_mci_ctrl )
     {
@@ -449,17 +449,17 @@
             return -ENOMEM;
         }
         /* Don't care banks before firstbank */
-        memset(h_mci_ctrl, 0xff, sizeof(h_mci_ctrl));
+        memset(h_mci_ctrl, ~0,
+               min(firstbank, nr_mce_banks) * sizeof(*h_mci_ctrl));
         for (i = firstbank; i < nr_mce_banks; i++)
             rdmsrl(MSR_IA32_MCx_CTL(i), h_mci_ctrl[i]);
     }
 
-    if (g_mcg_cap & MCG_CTL_P)
-        rdmsrl(MSR_IA32_MCG_CTL, h_mcg_ctl);
-
     rdmsrl(MSR_IA32_MCG_CAP, value);
     /* For Guest vMCE usage */
     g_mcg_cap = value & ~MCG_CMCI_P;
+    if (value & MCG_CTL_P)
+        rdmsrl(MSR_IA32_MCG_CTL, h_mcg_ctl);
 
     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 Feb 14 23:55:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDP-0004vA-Eu; Tue, 14 Feb 2012 23:55:19 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDO-0004uA-72
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-27.messagelabs.com!1329263656!56729179!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5550 invoked from network); 14 Feb 2012 23:54:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:54:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDI-0007ho-QY
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDI-0002BB-KS
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:12 +0000
Message-Id: <E1RxSDI-0002BB-KS@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] hvmloader: Allow the mkhex command
	to take several file arguments
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Julian Pidancet <julian.pidancet@gmail.com>
# Date 1329137300 0
# Node ID 0fe9e2556e201eb4d9fe41c95b610697e1ca2c4c
# Parent  e1f10d12b9fe5eca56cb7bc5ac332662865cf42f
hvmloader: Allow the mkhex command to take several file arguments
Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r e1f10d12b9fe -r 0fe9e2556e20 tools/firmware/hvmloader/mkhex
--- a/tools/firmware/hvmloader/mkhex	Mon Feb 13 12:47:46 2012 +0000
+++ b/tools/firmware/hvmloader/mkhex	Mon Feb 13 12:48:20 2012 +0000
@@ -21,6 +21,7 @@
 #
 
 echo "unsigned $1[] = {"
-od -v -t x $2 | sed 's/^[0-9]*  */0x/' | sed 's/  */, 0x/g' | sed 's/$/,/' | sed 's/0x,//' | sed 's/^[0-9]*,//'
+shift
+od -v -t x $@ | sed 's/^[0-9]*  */0x/' | sed 's/  */, 0x/g' | sed 's/$/,/' | sed 's/0x,//' | sed 's/^[0-9]*,//'
 echo "};"
 

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDP-0004vA-Eu; Tue, 14 Feb 2012 23:55:19 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDO-0004uA-72
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-27.messagelabs.com!1329263656!56729179!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5550 invoked from network); 14 Feb 2012 23:54:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:54:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDI-0007ho-QY
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDI-0002BB-KS
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:12 +0000
Message-Id: <E1RxSDI-0002BB-KS@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] hvmloader: Allow the mkhex command
	to take several file arguments
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Julian Pidancet <julian.pidancet@gmail.com>
# Date 1329137300 0
# Node ID 0fe9e2556e201eb4d9fe41c95b610697e1ca2c4c
# Parent  e1f10d12b9fe5eca56cb7bc5ac332662865cf42f
hvmloader: Allow the mkhex command to take several file arguments
Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r e1f10d12b9fe -r 0fe9e2556e20 tools/firmware/hvmloader/mkhex
--- a/tools/firmware/hvmloader/mkhex	Mon Feb 13 12:47:46 2012 +0000
+++ b/tools/firmware/hvmloader/mkhex	Mon Feb 13 12:48:20 2012 +0000
@@ -21,6 +21,7 @@
 #
 
 echo "unsigned $1[] = {"
-od -v -t x $2 | sed 's/^[0-9]*  */0x/' | sed 's/  */, 0x/g' | sed 's/$/,/' | sed 's/0x,//' | sed 's/^[0-9]*,//'
+shift
+od -v -t x $@ | sed 's/^[0-9]*  */0x/' | sed 's/  */, 0x/g' | sed 's/$/,/' | sed 's/0x,//' | sed 's/^[0-9]*,//'
 echo "};"
 

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDP-0004vL-Jw; Tue, 14 Feb 2012 23:55:19 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDO-0004uq-R5
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:19 +0000
Received: from [85.158.139.83:49286] by server-11.bemta-5.messagelabs.com id
	19/29-14397-664FA3F4; Tue, 14 Feb 2012 23:55:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-182.messagelabs.com!1329263714!15010958!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19729 invoked from network); 14 Feb 2012 23:55:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDJ-0007hr-Te
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDJ-0002Bd-Rr
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:13 +0000
Message-Id: <E1RxSDJ-0002Bd-Rr@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] firmware: Use mkhex from hvmloader
	directory for etherboot ROMs
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Julian Pidancet <julian.pidancet@gmail.com>
# Date 1329137346 0
# Node ID ab47cfef2b0a774d3c576c5c7a4a3cda350cf61a
# Parent  0fe9e2556e201eb4d9fe41c95b610697e1ca2c4c
firmware: Use mkhex from hvmloader directory for etherboot ROMs

To remain consistent with how other ROMs are built into hvmloader,
call mkhex on etherboot ROMs from the hvmloader directory, instead of
the etherboot directory. In other words, eb-roms.h is not used any
more.

Introduce ETHERBOOT_NICS config option to choose which ROMs should be
built (kept rtl8139 and 8086100e per default as before).

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 0fe9e2556e20 -r ab47cfef2b0a Config.mk
--- a/Config.mk	Mon Feb 13 12:48:20 2012 +0000
+++ b/Config.mk	Mon Feb 13 12:49:06 2012 +0000
@@ -222,6 +222,8 @@
 QEMU_UPSTREAM_REVISION ?= master
 SEABIOS_UPSTREAM_TAG ?= rel-1.6.3.1
 
+ETHERBOOT_NICS ?= rtl8139 8086100e
+
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
diff -r 0fe9e2556e20 -r ab47cfef2b0a tools/firmware/etherboot/Config
--- a/tools/firmware/etherboot/Config	Mon Feb 13 12:48:20 2012 +0000
+++ b/tools/firmware/etherboot/Config	Mon Feb 13 12:49:06 2012 +0000
@@ -1,5 +1,3 @@
-
-NICS = rtl8139 8086100e
 
 CFLAGS += -UPXE_DHCP_STRICT
 CFLAGS += -DPXE_DHCP_STRICT
diff -r 0fe9e2556e20 -r ab47cfef2b0a tools/firmware/etherboot/Makefile
--- a/tools/firmware/etherboot/Makefile	Mon Feb 13 12:48:20 2012 +0000
+++ b/tools/firmware/etherboot/Makefile	Mon Feb 13 12:49:06 2012 +0000
@@ -17,23 +17,16 @@
 D=ipxe
 T=ipxe.tar.gz
 
-ROMS = $(addprefix $D/src/bin/, $(addsuffix .rom, $(NICS)))
+ROMS = $(addprefix $D/src/bin/, $(addsuffix .rom, $(ETHERBOOT_NICS)))
 
 .NOTPARALLEL:
 
 .PHONY: all
-all: eb-roms.h
+all: $(ROMS)
 
 %.rom: $D/src/arch/i386/Makefile
 	$(MAKE) -C $D/src bin/$(*F).rom
 
-eb-roms.h.new: $(ROMS)
-	cat $^ | ../hvmloader/mkhex etherboot >$@
-
-eb-roms.h: Config
-	$(MAKE) NO_WERROR=1 $@.new
-	mv -f $@.new $@
-
 $T:
 	if ! wget -O _$T $(IPXE_TARBALL_URL); then \
 		$(GIT) clone $(IPXE_GIT_URL) $D.git; \
@@ -56,7 +49,7 @@
 
 .PHONY: clean
 clean:
-	rm -rf $D $D.git *~ eb-roms.h _$T $T
+	rm -rf $D $D.git *~ _$T $T
 
 .PHONY: distclean
 distclean: clean
diff -r 0fe9e2556e20 -r ab47cfef2b0a tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile	Mon Feb 13 12:48:20 2012 +0000
+++ b/tools/firmware/hvmloader/Makefile	Mon Feb 13 12:49:06 2012 +0000
@@ -58,6 +58,8 @@
 CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.bin
 endif
 
+ETHERBOOT_ROMS := $(addprefix ../etherboot/ipxe/src/bin/, $(addsuffix .rom, $(ETHERBOOT_NICS)))
+
 .PHONY: all
 all: subdirs-all
 	$(MAKE) hvmloader
@@ -70,7 +72,7 @@
 	$(OBJCOPY) hvmloader.tmp hvmloader
 	rm -f hvmloader.tmp
 
-roms.inc: $(ROMBIOS_ROM) $(SEABIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM) ../etherboot/eb-roms.h
+roms.inc: $(ROMBIOS_ROM) $(SEABIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM) $(ETHERBOOT_ROMS)
 	echo "/* Autogenerated file. DO NOT EDIT */" > $@.new
 
 ifneq ($(ROMBIOS_ROM),)
@@ -95,10 +97,11 @@
 	sh ./mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> $@.new
 	echo "#endif" >> $@.new
 endif
-
+ifneq ($(ETHERBOOT_ROMS),)
 	echo "#ifdef ROM_INCLUDE_ETHERBOOT" >> $@.new
-	cat ../etherboot/eb-roms.h >> $@.new
+	sh ./mkhex etherboot $(ETHERBOOT_ROMS) >> $@.new
 	echo "#endif" >> $@.new
+endif
 
 	mv $@.new $@
 

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDP-0004vL-Jw; Tue, 14 Feb 2012 23:55:19 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDO-0004uq-R5
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:19 +0000
Received: from [85.158.139.83:49286] by server-11.bemta-5.messagelabs.com id
	19/29-14397-664FA3F4; Tue, 14 Feb 2012 23:55:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-182.messagelabs.com!1329263714!15010958!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19729 invoked from network); 14 Feb 2012 23:55:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDJ-0007hr-Te
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDJ-0002Bd-Rr
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:13 +0000
Message-Id: <E1RxSDJ-0002Bd-Rr@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] firmware: Use mkhex from hvmloader
	directory for etherboot ROMs
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Julian Pidancet <julian.pidancet@gmail.com>
# Date 1329137346 0
# Node ID ab47cfef2b0a774d3c576c5c7a4a3cda350cf61a
# Parent  0fe9e2556e201eb4d9fe41c95b610697e1ca2c4c
firmware: Use mkhex from hvmloader directory for etherboot ROMs

To remain consistent with how other ROMs are built into hvmloader,
call mkhex on etherboot ROMs from the hvmloader directory, instead of
the etherboot directory. In other words, eb-roms.h is not used any
more.

Introduce ETHERBOOT_NICS config option to choose which ROMs should be
built (kept rtl8139 and 8086100e per default as before).

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 0fe9e2556e20 -r ab47cfef2b0a Config.mk
--- a/Config.mk	Mon Feb 13 12:48:20 2012 +0000
+++ b/Config.mk	Mon Feb 13 12:49:06 2012 +0000
@@ -222,6 +222,8 @@
 QEMU_UPSTREAM_REVISION ?= master
 SEABIOS_UPSTREAM_TAG ?= rel-1.6.3.1
 
+ETHERBOOT_NICS ?= rtl8139 8086100e
+
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
diff -r 0fe9e2556e20 -r ab47cfef2b0a tools/firmware/etherboot/Config
--- a/tools/firmware/etherboot/Config	Mon Feb 13 12:48:20 2012 +0000
+++ b/tools/firmware/etherboot/Config	Mon Feb 13 12:49:06 2012 +0000
@@ -1,5 +1,3 @@
-
-NICS = rtl8139 8086100e
 
 CFLAGS += -UPXE_DHCP_STRICT
 CFLAGS += -DPXE_DHCP_STRICT
diff -r 0fe9e2556e20 -r ab47cfef2b0a tools/firmware/etherboot/Makefile
--- a/tools/firmware/etherboot/Makefile	Mon Feb 13 12:48:20 2012 +0000
+++ b/tools/firmware/etherboot/Makefile	Mon Feb 13 12:49:06 2012 +0000
@@ -17,23 +17,16 @@
 D=ipxe
 T=ipxe.tar.gz
 
-ROMS = $(addprefix $D/src/bin/, $(addsuffix .rom, $(NICS)))
+ROMS = $(addprefix $D/src/bin/, $(addsuffix .rom, $(ETHERBOOT_NICS)))
 
 .NOTPARALLEL:
 
 .PHONY: all
-all: eb-roms.h
+all: $(ROMS)
 
 %.rom: $D/src/arch/i386/Makefile
 	$(MAKE) -C $D/src bin/$(*F).rom
 
-eb-roms.h.new: $(ROMS)
-	cat $^ | ../hvmloader/mkhex etherboot >$@
-
-eb-roms.h: Config
-	$(MAKE) NO_WERROR=1 $@.new
-	mv -f $@.new $@
-
 $T:
 	if ! wget -O _$T $(IPXE_TARBALL_URL); then \
 		$(GIT) clone $(IPXE_GIT_URL) $D.git; \
@@ -56,7 +49,7 @@
 
 .PHONY: clean
 clean:
-	rm -rf $D $D.git *~ eb-roms.h _$T $T
+	rm -rf $D $D.git *~ _$T $T
 
 .PHONY: distclean
 distclean: clean
diff -r 0fe9e2556e20 -r ab47cfef2b0a tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile	Mon Feb 13 12:48:20 2012 +0000
+++ b/tools/firmware/hvmloader/Makefile	Mon Feb 13 12:49:06 2012 +0000
@@ -58,6 +58,8 @@
 CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.bin
 endif
 
+ETHERBOOT_ROMS := $(addprefix ../etherboot/ipxe/src/bin/, $(addsuffix .rom, $(ETHERBOOT_NICS)))
+
 .PHONY: all
 all: subdirs-all
 	$(MAKE) hvmloader
@@ -70,7 +72,7 @@
 	$(OBJCOPY) hvmloader.tmp hvmloader
 	rm -f hvmloader.tmp
 
-roms.inc: $(ROMBIOS_ROM) $(SEABIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM) ../etherboot/eb-roms.h
+roms.inc: $(ROMBIOS_ROM) $(SEABIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM) $(ETHERBOOT_ROMS)
 	echo "/* Autogenerated file. DO NOT EDIT */" > $@.new
 
 ifneq ($(ROMBIOS_ROM),)
@@ -95,10 +97,11 @@
 	sh ./mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> $@.new
 	echo "#endif" >> $@.new
 endif
-
+ifneq ($(ETHERBOOT_ROMS),)
 	echo "#ifdef ROM_INCLUDE_ETHERBOOT" >> $@.new
-	cat ../etherboot/eb-roms.h >> $@.new
+	sh ./mkhex etherboot $(ETHERBOOT_ROMS) >> $@.new
 	echo "#endif" >> $@.new
+endif
 
 	mv $@.new $@
 

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDP-0004vG-HY; Tue, 14 Feb 2012 23:55:19 +0000
Received: from mail6.bemta14.messagelabs.com ([193.109.254.103])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDO-0004um-QJ
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:19 +0000
Received: from [193.109.254.147:52688] by server-1.bemta-14.messagelabs.com id
	BF/7F-12485-564FA3F4; Tue, 14 Feb 2012 23:55:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1329263664!52763634!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG, UPPERCASE_25_50
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15260 invoked from network); 14 Feb 2012 23:54:25 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:54:25 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDM-0007hx-3y
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDL-0002CU-ST
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:15 +0000
Message-Id: <E1RxSDL-0002CU-ST@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] firmware: Introduce CONFIG_ROMBIOS
	and CONFIG_SEABIOS options
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Julian Pidancet <julian.pidancet@gmail.com>
# Date 1329137446 0
# Node ID 79fe73117c12d5f20468df0961274656378dfb53
# Parent  e4d8d2524407c8dd85409d142e7fbbdbd5033193
firmware: Introduce CONFIG_ROMBIOS and CONFIG_SEABIOS options

This patch introduces configuration options allowing to built either a
rombios only or a seabios only hvmloader.

Building option ROMs like vgabios or etherboot is only enabled for a
rombios hvmloader, since SeaBIOS takes care or extracting option ROMs
itself from the PCI devices (these option ROMs are provided by the
device model and do not need to be built in hvmloader).

The Makefile in tools/firmware/ now only checks for bcc if rombios is
enabled.

These two configuration options are left on by default to remain
compatible.

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r e4d8d2524407 -r 79fe73117c12 Config.mk
--- a/Config.mk	Mon Feb 13 12:50:04 2012 +0000
+++ b/Config.mk	Mon Feb 13 12:50:46 2012 +0000
@@ -224,6 +224,9 @@
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
+CONFIG_ROMBIOS ?= y
+CONFIG_SEABIOS ?= y
+
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
diff -r e4d8d2524407 -r 79fe73117c12 tools/firmware/Makefile
--- a/tools/firmware/Makefile	Mon Feb 13 12:50:04 2012 +0000
+++ b/tools/firmware/Makefile	Mon Feb 13 12:50:46 2012 +0000
@@ -5,19 +5,20 @@
 TARGET      := hvmloader/hvmloader
 INST_DIR := $(DESTDIR)$(XENFIRMWAREDIR)
 
-SUBDIRS :=
-SUBDIRS += seabios-dir
-SUBDIRS += rombios
-SUBDIRS += vgabios
-SUBDIRS += etherboot
-SUBDIRS += hvmloader
+SUBDIRS-y :=
+SUBDIRS-$(CONFIG_SEABIOS) += seabios-dir
+SUBDIRS-$(CONFIG_ROMBIOS) += rombios
+SUBDIRS-$(CONFIG_ROMBIOS) += vgabios
+SUBDIRS-$(CONFIG_ROMBIOS) += etherboot
+SUBDIRS-y += hvmloader
 
 seabios-dir:
 	GIT=$(GIT) $(XEN_ROOT)/scripts/git-checkout.sh $(SEABIOS_UPSTREAM_URL) $(SEABIOS_UPSTREAM_TAG) seabios-dir
 	cp seabios-config seabios-dir/.config;
 
 .PHONY: all
-all: seabios-dir
+all: $(SUBDIRS-y)
+ifeq ($(CONFIG_ROMBIOS),y)
 	@set -e; if [ $$((`( bcc -v 2>&1 | grep version || echo 0.0.0 ) | cut -d' ' -f 3 | awk -F. '{ printf "0x%02x%02x%02x", $$1, $$2, $$3}'`)) -lt $$((0x00100e)) ] ; then \
 	echo "==========================================================================="; \
 	echo "Require dev86 rpm or bin86 & bcc debs version >= 0.16.14 to build firmware!"; \
@@ -25,7 +26,8 @@
 	echo "==========================================================================="; \
 	false ; \
 	fi
-	$(MAKE) subdirs-$@; \
+endif
+	$(MAKE) subdirs-$@
 
 
 .PHONY: install
diff -r e4d8d2524407 -r 79fe73117c12 tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile	Mon Feb 13 12:50:04 2012 +0000
+++ b/tools/firmware/hvmloader/Makefile	Mon Feb 13 12:50:46 2012 +0000
@@ -38,27 +38,33 @@
 CIRRUSVGA_DEBUG ?= n
 
 ROMBIOS_DIR := ../rombios
-ifneq ($(ROMBIOS_DIR),)
-OBJS += optionroms.o 32bitbios_support.o rombios.o
-CFLAGS += -DENABLE_ROMBIOS
-ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest
-endif
+SEABIOS_DIR := ../seabios-dir
 
-SEABIOS_DIR := ../seabios-dir
-ifneq ($(SEABIOS_DIR),)
-OBJS += seabios.o
-CFLAGS += -DENABLE_SEABIOS
-SEABIOS_ROM := $(SEABIOS_DIR)/out/bios.bin
-endif
-
+ifeq ($(CONFIG_ROMBIOS),y)
 STDVGA_ROM    := ../vgabios/VGABIOS-lgpl-latest.bin
 ifeq ($(CIRRUSVGA_DEBUG),y)
 CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.debug.bin
 else
 CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.bin
 endif
+ETHERBOOT_ROMS := $(addprefix ../etherboot/ipxe/src/bin/, $(addsuffix .rom, $(ETHERBOOT_NICS)))
+endif
 
-ETHERBOOT_ROMS := $(addprefix ../etherboot/ipxe/src/bin/, $(addsuffix .rom, $(ETHERBOOT_NICS)))
+ROMS := 
+
+ifeq ($(CONFIG_ROMBIOS),y)
+OBJS += optionroms.o 32bitbios_support.o rombios.o
+CFLAGS += -DENABLE_ROMBIOS
+ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest
+ROMS += $(ROMBIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM) $(ETHERBOOT_ROMS)
+endif
+
+ifeq ($(CONFIG_SEABIOS),y)
+OBJS += seabios.o
+CFLAGS += -DENABLE_SEABIOS
+SEABIOS_ROM := $(SEABIOS_DIR)/out/bios.bin
+ROMS += $(SEABIOS_ROM)
+endif
 
 .PHONY: all
 all: subdirs-all
@@ -72,7 +78,7 @@
 	$(OBJCOPY) hvmloader.tmp hvmloader
 	rm -f hvmloader.tmp
 
-roms.inc: $(ROMBIOS_ROM) $(SEABIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM) $(ETHERBOOT_ROMS)
+roms.inc: $(ROMS)
 	echo "/* Autogenerated file. DO NOT EDIT */" > $@.new
 
 ifneq ($(ROMBIOS_ROM),)

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDP-0004vG-HY; Tue, 14 Feb 2012 23:55:19 +0000
Received: from mail6.bemta14.messagelabs.com ([193.109.254.103])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDO-0004um-QJ
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:19 +0000
Received: from [193.109.254.147:52688] by server-1.bemta-14.messagelabs.com id
	BF/7F-12485-564FA3F4; Tue, 14 Feb 2012 23:55:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1329263664!52763634!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG, UPPERCASE_25_50
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15260 invoked from network); 14 Feb 2012 23:54:25 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:54:25 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDM-0007hx-3y
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDL-0002CU-ST
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:15 +0000
Message-Id: <E1RxSDL-0002CU-ST@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] firmware: Introduce CONFIG_ROMBIOS
	and CONFIG_SEABIOS options
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Julian Pidancet <julian.pidancet@gmail.com>
# Date 1329137446 0
# Node ID 79fe73117c12d5f20468df0961274656378dfb53
# Parent  e4d8d2524407c8dd85409d142e7fbbdbd5033193
firmware: Introduce CONFIG_ROMBIOS and CONFIG_SEABIOS options

This patch introduces configuration options allowing to built either a
rombios only or a seabios only hvmloader.

Building option ROMs like vgabios or etherboot is only enabled for a
rombios hvmloader, since SeaBIOS takes care or extracting option ROMs
itself from the PCI devices (these option ROMs are provided by the
device model and do not need to be built in hvmloader).

The Makefile in tools/firmware/ now only checks for bcc if rombios is
enabled.

These two configuration options are left on by default to remain
compatible.

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r e4d8d2524407 -r 79fe73117c12 Config.mk
--- a/Config.mk	Mon Feb 13 12:50:04 2012 +0000
+++ b/Config.mk	Mon Feb 13 12:50:46 2012 +0000
@@ -224,6 +224,9 @@
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
+CONFIG_ROMBIOS ?= y
+CONFIG_SEABIOS ?= y
+
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
diff -r e4d8d2524407 -r 79fe73117c12 tools/firmware/Makefile
--- a/tools/firmware/Makefile	Mon Feb 13 12:50:04 2012 +0000
+++ b/tools/firmware/Makefile	Mon Feb 13 12:50:46 2012 +0000
@@ -5,19 +5,20 @@
 TARGET      := hvmloader/hvmloader
 INST_DIR := $(DESTDIR)$(XENFIRMWAREDIR)
 
-SUBDIRS :=
-SUBDIRS += seabios-dir
-SUBDIRS += rombios
-SUBDIRS += vgabios
-SUBDIRS += etherboot
-SUBDIRS += hvmloader
+SUBDIRS-y :=
+SUBDIRS-$(CONFIG_SEABIOS) += seabios-dir
+SUBDIRS-$(CONFIG_ROMBIOS) += rombios
+SUBDIRS-$(CONFIG_ROMBIOS) += vgabios
+SUBDIRS-$(CONFIG_ROMBIOS) += etherboot
+SUBDIRS-y += hvmloader
 
 seabios-dir:
 	GIT=$(GIT) $(XEN_ROOT)/scripts/git-checkout.sh $(SEABIOS_UPSTREAM_URL) $(SEABIOS_UPSTREAM_TAG) seabios-dir
 	cp seabios-config seabios-dir/.config;
 
 .PHONY: all
-all: seabios-dir
+all: $(SUBDIRS-y)
+ifeq ($(CONFIG_ROMBIOS),y)
 	@set -e; if [ $$((`( bcc -v 2>&1 | grep version || echo 0.0.0 ) | cut -d' ' -f 3 | awk -F. '{ printf "0x%02x%02x%02x", $$1, $$2, $$3}'`)) -lt $$((0x00100e)) ] ; then \
 	echo "==========================================================================="; \
 	echo "Require dev86 rpm or bin86 & bcc debs version >= 0.16.14 to build firmware!"; \
@@ -25,7 +26,8 @@
 	echo "==========================================================================="; \
 	false ; \
 	fi
-	$(MAKE) subdirs-$@; \
+endif
+	$(MAKE) subdirs-$@
 
 
 .PHONY: install
diff -r e4d8d2524407 -r 79fe73117c12 tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile	Mon Feb 13 12:50:04 2012 +0000
+++ b/tools/firmware/hvmloader/Makefile	Mon Feb 13 12:50:46 2012 +0000
@@ -38,27 +38,33 @@
 CIRRUSVGA_DEBUG ?= n
 
 ROMBIOS_DIR := ../rombios
-ifneq ($(ROMBIOS_DIR),)
-OBJS += optionroms.o 32bitbios_support.o rombios.o
-CFLAGS += -DENABLE_ROMBIOS
-ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest
-endif
+SEABIOS_DIR := ../seabios-dir
 
-SEABIOS_DIR := ../seabios-dir
-ifneq ($(SEABIOS_DIR),)
-OBJS += seabios.o
-CFLAGS += -DENABLE_SEABIOS
-SEABIOS_ROM := $(SEABIOS_DIR)/out/bios.bin
-endif
-
+ifeq ($(CONFIG_ROMBIOS),y)
 STDVGA_ROM    := ../vgabios/VGABIOS-lgpl-latest.bin
 ifeq ($(CIRRUSVGA_DEBUG),y)
 CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.debug.bin
 else
 CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.bin
 endif
+ETHERBOOT_ROMS := $(addprefix ../etherboot/ipxe/src/bin/, $(addsuffix .rom, $(ETHERBOOT_NICS)))
+endif
 
-ETHERBOOT_ROMS := $(addprefix ../etherboot/ipxe/src/bin/, $(addsuffix .rom, $(ETHERBOOT_NICS)))
+ROMS := 
+
+ifeq ($(CONFIG_ROMBIOS),y)
+OBJS += optionroms.o 32bitbios_support.o rombios.o
+CFLAGS += -DENABLE_ROMBIOS
+ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest
+ROMS += $(ROMBIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM) $(ETHERBOOT_ROMS)
+endif
+
+ifeq ($(CONFIG_SEABIOS),y)
+OBJS += seabios.o
+CFLAGS += -DENABLE_SEABIOS
+SEABIOS_ROM := $(SEABIOS_DIR)/out/bios.bin
+ROMS += $(SEABIOS_ROM)
+endif
 
 .PHONY: all
 all: subdirs-all
@@ -72,7 +78,7 @@
 	$(OBJCOPY) hvmloader.tmp hvmloader
 	rm -f hvmloader.tmp
 
-roms.inc: $(ROMBIOS_ROM) $(SEABIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM) $(ETHERBOOT_ROMS)
+roms.inc: $(ROMS)
 	echo "/* Autogenerated file. DO NOT EDIT */" > $@.new
 
 ifneq ($(ROMBIOS_ROM),)

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:27 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDS-0004xJ-Po; Tue, 14 Feb 2012 23:55:22 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDR-0004wL-L1
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:22 +0000
Received: from [85.158.139.83:45151] by server-7.bemta-5.messagelabs.com id
	87/9B-16195-864FA3F4; Tue, 14 Feb 2012 23:55:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-182.messagelabs.com!1329263718!15010962!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19853 invoked from network); 14 Feb 2012 23:55:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDO-0007i6-4u
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDO-0002Dk-3e
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:18 +0000
Message-Id: <E1RxSDO-0002Dk-3e@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libfdt: fixup libfdt_env.h for xen
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329140048 0
# Node ID e060d1bd7b60556fde01873aaaf3d8e4c298a5d2
# Parent  fcc188f21e471d2e9eaf1ddf22a728763a84cca2
libfdt: fixup libfdt_env.h for xen

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r fcc188f21e47 -r e060d1bd7b60 xen/common/libfdt/libfdt_env.h
--- a/xen/common/libfdt/libfdt_env.h	Mon Feb 13 13:33:26 2012 +0000
+++ b/xen/common/libfdt/libfdt_env.h	Mon Feb 13 13:34:08 2012 +0000
@@ -1,23 +1,16 @@
 #ifndef _LIBFDT_ENV_H
 #define _LIBFDT_ENV_H
 
-#include <stddef.h>
-#include <stdint.h>
-#include <string.h>
+#include <xen/config.h>
+#include <xen/types.h>
+#include <xen/string.h>
+#include <asm/byteorder.h>
 
-#define _B(n)	((unsigned long long)((uint8_t *)&x)[n])
-static inline uint32_t fdt32_to_cpu(uint32_t x)
-{
-	return (_B(0) << 24) | (_B(1) << 16) | (_B(2) << 8) | _B(3);
-}
-#define cpu_to_fdt32(x) fdt32_to_cpu(x)
-
-static inline uint64_t fdt64_to_cpu(uint64_t x)
-{
-	return (_B(0) << 56) | (_B(1) << 48) | (_B(2) << 40) | (_B(3) << 32)
-		| (_B(4) << 24) | (_B(5) << 16) | (_B(6) << 8) | _B(7);
-}
-#define cpu_to_fdt64(x) fdt64_to_cpu(x)
-#undef _B
+#define fdt16_to_cpu(x) be16_to_cpu(x)
+#define cpu_to_fdt16(x) cpu_to_be16(x)
+#define fdt32_to_cpu(x) be32_to_cpu(x)
+#define cpu_to_fdt32(x) cpu_to_be32(x)
+#define fdt64_to_cpu(x) be64_to_cpu(x)
+#define cpu_to_fdt64(x) cpu_to_be64(x)
 
 #endif /* _LIBFDT_ENV_H */
diff -r fcc188f21e47 -r e060d1bd7b60 xen/include/xen/types.h
--- a/xen/include/xen/types.h	Mon Feb 13 13:33:26 2012 +0000
+++ b/xen/include/xen/types.h	Mon Feb 13 13:34:08 2012 +0000
@@ -57,4 +57,6 @@
 typedef __u64 __le64;
 typedef __u64 __be64;
 
+typedef unsigned long uintptr_t;
+
 #endif /* __TYPES_H__ */

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:27 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDS-0004xJ-Po; Tue, 14 Feb 2012 23:55:22 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDR-0004wL-L1
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:22 +0000
Received: from [85.158.139.83:45151] by server-7.bemta-5.messagelabs.com id
	87/9B-16195-864FA3F4; Tue, 14 Feb 2012 23:55:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-182.messagelabs.com!1329263718!15010962!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19853 invoked from network); 14 Feb 2012 23:55:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDO-0007i6-4u
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDO-0002Dk-3e
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:18 +0000
Message-Id: <E1RxSDO-0002Dk-3e@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libfdt: fixup libfdt_env.h for xen
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329140048 0
# Node ID e060d1bd7b60556fde01873aaaf3d8e4c298a5d2
# Parent  fcc188f21e471d2e9eaf1ddf22a728763a84cca2
libfdt: fixup libfdt_env.h for xen

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r fcc188f21e47 -r e060d1bd7b60 xen/common/libfdt/libfdt_env.h
--- a/xen/common/libfdt/libfdt_env.h	Mon Feb 13 13:33:26 2012 +0000
+++ b/xen/common/libfdt/libfdt_env.h	Mon Feb 13 13:34:08 2012 +0000
@@ -1,23 +1,16 @@
 #ifndef _LIBFDT_ENV_H
 #define _LIBFDT_ENV_H
 
-#include <stddef.h>
-#include <stdint.h>
-#include <string.h>
+#include <xen/config.h>
+#include <xen/types.h>
+#include <xen/string.h>
+#include <asm/byteorder.h>
 
-#define _B(n)	((unsigned long long)((uint8_t *)&x)[n])
-static inline uint32_t fdt32_to_cpu(uint32_t x)
-{
-	return (_B(0) << 24) | (_B(1) << 16) | (_B(2) << 8) | _B(3);
-}
-#define cpu_to_fdt32(x) fdt32_to_cpu(x)
-
-static inline uint64_t fdt64_to_cpu(uint64_t x)
-{
-	return (_B(0) << 56) | (_B(1) << 48) | (_B(2) << 40) | (_B(3) << 32)
-		| (_B(4) << 24) | (_B(5) << 16) | (_B(6) << 8) | _B(7);
-}
-#define cpu_to_fdt64(x) fdt64_to_cpu(x)
-#undef _B
+#define fdt16_to_cpu(x) be16_to_cpu(x)
+#define cpu_to_fdt16(x) cpu_to_be16(x)
+#define fdt32_to_cpu(x) be32_to_cpu(x)
+#define cpu_to_fdt32(x) cpu_to_be32(x)
+#define fdt64_to_cpu(x) be64_to_cpu(x)
+#define cpu_to_fdt64(x) cpu_to_be64(x)
 
 #endif /* _LIBFDT_ENV_H */
diff -r fcc188f21e47 -r e060d1bd7b60 xen/include/xen/types.h
--- a/xen/include/xen/types.h	Mon Feb 13 13:33:26 2012 +0000
+++ b/xen/include/xen/types.h	Mon Feb 13 13:34:08 2012 +0000
@@ -57,4 +57,6 @@
 typedef __u64 __le64;
 typedef __u64 __be64;
 
+typedef unsigned long uintptr_t;
+
 #endif /* __TYPES_H__ */

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:27 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDV-0004yp-Sq; Tue, 14 Feb 2012 23:55:25 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDU-0004y6-O4
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1329263682!52449936!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23198 invoked from network); 14 Feb 2012 23:54:43 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:54:43 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDR-0007iO-TY
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDR-0002G8-Rr
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:21 +0000
Message-Id: <E1RxSDR-0002G8-Rr@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm,
	device tree: parse the DTB for RAM location and size
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329143089 0
# Node ID 40879997c29fa71c2de3ccb67995c01c1a6daf10
# Parent  f89c9a13529a0808bab24bb88bea6448eeb09cd9
arm, device tree: parse the DTB for RAM location and size

Prior to setting up the page tables, parse the DTB for the location
and size of RAM.

Use this information to get the physical address to relocate Xen to in
setup_pagetables().

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r f89c9a13529a -r 40879997c29f xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/arch/arm/mm.c	Mon Feb 13 14:24:49 2012 +0000
@@ -20,6 +20,7 @@
 #include <xen/config.h>
 #include <xen/compile.h>
 #include <xen/types.h>
+#include <xen/device_tree.h>
 #include <xen/init.h>
 #include <xen/mm.h>
 #include <xen/preempt.h>
@@ -159,7 +160,7 @@
         write_pte(xen_second + second_linear_offset(dest_va), pte);
     }
 
-    xen_paddr = XEN_PADDR;
+    xen_paddr = device_tree_get_xen_paddr();
 
     /* Map the destination in the boot misc area. */
     dest_va = BOOT_MISC_VIRT_START;
diff -r f89c9a13529a -r 40879997c29f xen/arch/arm/setup.c
--- a/xen/arch/arm/setup.c	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/arch/arm/setup.c	Mon Feb 13 14:24:49 2012 +0000
@@ -19,6 +19,7 @@
 
 #include <xen/config.h>
 #include <xen/compile.h>
+#include <xen/device_tree.h>
 #include <xen/domain_page.h>
 #include <xen/types.h>
 #include <xen/string.h>
@@ -68,8 +69,13 @@
                       unsigned long atag_paddr)
 
 {
+    void *fdt;
     int i;
 
+    fdt = (void *)BOOT_MISC_VIRT_START
+        + (atag_paddr & ((1 << SECOND_SHIFT) - 1));
+    device_tree_early_init(fdt);
+
     setup_pagetables(boot_phys_offset);
 
 #ifdef EARLY_UART_ADDRESS
diff -r f89c9a13529a -r 40879997c29f xen/common/Makefile
--- a/xen/common/Makefile	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/common/Makefile	Mon Feb 13 14:24:49 2012 +0000
@@ -1,6 +1,7 @@
 obj-y += bitmap.o
 obj-y += cpu.o
 obj-y += cpupool.o
+obj-$(HAS_DEVICE_TREE) += device_tree.o
 obj-y += domctl.o
 obj-y += domain.o
 obj-y += event_channel.o
@@ -60,3 +61,5 @@
 
 subdir-y += libelf
 subdir-$(HAS_DEVICE_TREE) += libfdt
+
+CFLAGS += -Ilibfdt
diff -r f89c9a13529a -r 40879997c29f xen/common/device_tree.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/device_tree.c	Mon Feb 13 14:24:49 2012 +0000
@@ -0,0 +1,179 @@
+/*
+ * Device Tree
+ *
+ * Copyright (C) 2012 Citrix Systems, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <xen/config.h>
+#include <xen/types.h>
+#include <xen/init.h>
+#include <xen/device_tree.h>
+#include <xen/kernel.h>
+#include <xen/lib.h>
+#include <xen/mm.h>
+#include <xen/stdarg.h>
+#include <xen/string.h>
+#include <asm/early_printk.h>
+
+#include <libfdt.h>
+
+struct dt_early_info __initdata early_info;
+
+static void __init get_val(const u32 **cell, u32 cells, u64 *val)
+{
+    *val = 0;
+
+    while (cells--) {
+        *val <<= 32;
+        *val |= fdt32_to_cpu(*(*cell)++);
+    }
+}
+
+static void __init get_register(const u32 **cell, u32 address_cells, u32 size_cells,
+                                u64 *start, u64 *size)
+{
+    get_val(cell, address_cells, start);
+    get_val(cell, size_cells, size);
+}
+
+static u32 __init prop_by_name_u32(const void *fdt, int node, const char *prop_name)
+{
+    const struct fdt_property *prop;
+
+    prop = fdt_get_property(fdt, node, prop_name, NULL);
+    if (!prop || prop->len < sizeof(u32))
+        return 0; /* default to 0 */
+
+    return fdt32_to_cpu(*(uint32_t*)prop->data);
+}
+
+static void __init process_memory_node(const void *fdt, int node,
+                                       u32 address_cells, u32 size_cells)
+{
+    const struct fdt_property *prop;
+    size_t reg_cells;
+    int i;
+    int banks;
+    const u32 *cell;
+    paddr_t start, size;
+
+    if (address_cells < 1 || size_cells < 1) {
+        early_printk("fdt: node `%s': invalid #address-cells or #size-cells",
+                     fdt_get_name(fdt, node, NULL));
+        return;
+    }
+
+    prop = fdt_get_property(fdt, node, "reg", NULL);
+    if (!prop) {
+        early_printk("fdt: node `%s': missing `reg' property\n",
+                     fdt_get_name(fdt, node, NULL));
+        return;
+    }
+
+    cell = (const u32 *)prop->data;
+    reg_cells = address_cells + size_cells;
+    banks = fdt32_to_cpu(prop->len) / (reg_cells * sizeof(u32));
+
+    for (i = 0; i < banks && early_info.mem.nr_banks < NR_MEM_BANKS; i++) {
+        get_register(&cell, address_cells, size_cells, &start, &size);
+        early_info.mem.bank[early_info.mem.nr_banks].start = start;
+        early_info.mem.bank[early_info.mem.nr_banks].size = size;
+        early_info.mem.nr_banks++;
+    }
+}
+
+#define MAX_DEPTH 16
+
+static void __init early_scan(const void *fdt)
+{
+    int node;
+    int depth;
+    const char *name;
+    u32 address_cells[MAX_DEPTH];
+    u32 size_cells[MAX_DEPTH];
+
+    for (node = 0; depth >= 0; node = fdt_next_node(fdt, node, &depth)) {
+        name = fdt_get_name(fdt, node, NULL);
+
+        if (depth >= MAX_DEPTH) {
+            early_printk("fdt: node '%s': nested too deep\n",
+                         fdt_get_name(fdt, node, NULL));
+            continue;
+        }
+
+        address_cells[depth] = prop_by_name_u32(fdt, node, "#address-cells");
+        size_cells[depth] = prop_by_name_u32(fdt, node, "#size-cells");
+
+        if (strncmp(name, "memory", 6) == 0)
+            process_memory_node(fdt, node, address_cells[depth-1], size_cells[depth-1]);
+    }
+}
+
+static void __init early_print_info(void)
+{
+    struct dt_mem_info *mi = &early_info.mem;
+    int i;
+
+    for (i = 0; i < mi->nr_banks; i++)
+        early_printk("RAM: %016llx - %016llx\n",
+                     mi->bank[i].start, mi->bank[i].start + mi->bank[i].size - 1);
+}
+
+/**
+ * device_tree_early_init - initialize early info from a DTB
+ * @fdt: flattened device tree binary
+ */
+void __init device_tree_early_init(const void *fdt)
+{
+    int ret;
+
+    ret = fdt_check_header(fdt);
+    if (ret < 0)
+        early_panic("No valid device tree\n");
+
+    early_scan(fdt);
+    early_print_info();
+}
+
+/**
+ * device_tree_get_xen_paddr - get physical address to relocate Xen to
+ *
+ * Xen is relocated to the top of RAM and aligned to a XEN_PADDR_ALIGN
+ * boundary.
+ */
+paddr_t __init device_tree_get_xen_paddr(void)
+{
+    struct dt_mem_info *mi = &early_info.mem;
+    paddr_t min_size;
+    paddr_t paddr = 0, t;
+    int i;
+
+    min_size = (_end - _start + (XEN_PADDR_ALIGN-1)) & ~(XEN_PADDR_ALIGN-1);
+
+    /* Find the highest bank with enough space. */
+    for (i = 0; i < mi->nr_banks; i++) {
+        if (mi->bank[i].size >= min_size) {
+            t = mi->bank[i].start + mi->bank[i].size - min_size;
+            if (t > paddr)
+                paddr = t;
+        }
+    }
+
+    if (!paddr)
+        early_panic("Not enough memory to relocate Xen\n");
+
+    return paddr;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r f89c9a13529a -r 40879997c29f xen/include/asm-arm/mm.h
--- a/xen/include/asm-arm/mm.h	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/include/asm-arm/mm.h	Mon Feb 13 14:24:49 2012 +0000
@@ -6,9 +6,8 @@
 #include <asm/page.h>
 #include <public/xen.h>
 
-/* Find a suitable place at the top of memory for Xen to live */
-/* XXX For now, use the top of the VE's 4GB RAM, at a 40-bit alias */
-#define XEN_PADDR 0x80ffe00000ull
+/* Align Xen to a 2 MiB boundary. */
+#define XEN_PADDR_ALIGN (1 << 21)
 
 /*
  * Per-page-frame information.
diff -r f89c9a13529a -r 40879997c29f xen/include/xen/device_tree.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/xen/device_tree.h	Mon Feb 13 14:24:49 2012 +0000
@@ -0,0 +1,36 @@
+/*
+ * Device Tree
+ *
+ * Copyright (C) 2012 Citrix Systems, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __XEN_DEVICE_TREE_H__
+#define __XEN_DEVICE_TREE_H__
+
+#include <xen/types.h>
+
+#define NR_MEM_BANKS 8
+
+struct membank {
+    paddr_t start;
+    paddr_t size;
+};
+
+struct dt_mem_info {
+    int nr_banks;
+    struct membank bank[NR_MEM_BANKS];
+};
+
+struct dt_early_info {
+    struct dt_mem_info mem;
+};
+
+extern struct dt_early_info early_info;
+
+void device_tree_early_init(const void *fdt);
+paddr_t device_tree_get_xen_paddr(void);
+
+#endif

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:27 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDV-0004yp-Sq; Tue, 14 Feb 2012 23:55:25 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDU-0004y6-O4
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1329263682!52449936!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23198 invoked from network); 14 Feb 2012 23:54:43 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:54:43 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDR-0007iO-TY
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDR-0002G8-Rr
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:21 +0000
Message-Id: <E1RxSDR-0002G8-Rr@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm,
	device tree: parse the DTB for RAM location and size
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329143089 0
# Node ID 40879997c29fa71c2de3ccb67995c01c1a6daf10
# Parent  f89c9a13529a0808bab24bb88bea6448eeb09cd9
arm, device tree: parse the DTB for RAM location and size

Prior to setting up the page tables, parse the DTB for the location
and size of RAM.

Use this information to get the physical address to relocate Xen to in
setup_pagetables().

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r f89c9a13529a -r 40879997c29f xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/arch/arm/mm.c	Mon Feb 13 14:24:49 2012 +0000
@@ -20,6 +20,7 @@
 #include <xen/config.h>
 #include <xen/compile.h>
 #include <xen/types.h>
+#include <xen/device_tree.h>
 #include <xen/init.h>
 #include <xen/mm.h>
 #include <xen/preempt.h>
@@ -159,7 +160,7 @@
         write_pte(xen_second + second_linear_offset(dest_va), pte);
     }
 
-    xen_paddr = XEN_PADDR;
+    xen_paddr = device_tree_get_xen_paddr();
 
     /* Map the destination in the boot misc area. */
     dest_va = BOOT_MISC_VIRT_START;
diff -r f89c9a13529a -r 40879997c29f xen/arch/arm/setup.c
--- a/xen/arch/arm/setup.c	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/arch/arm/setup.c	Mon Feb 13 14:24:49 2012 +0000
@@ -19,6 +19,7 @@
 
 #include <xen/config.h>
 #include <xen/compile.h>
+#include <xen/device_tree.h>
 #include <xen/domain_page.h>
 #include <xen/types.h>
 #include <xen/string.h>
@@ -68,8 +69,13 @@
                       unsigned long atag_paddr)
 
 {
+    void *fdt;
     int i;
 
+    fdt = (void *)BOOT_MISC_VIRT_START
+        + (atag_paddr & ((1 << SECOND_SHIFT) - 1));
+    device_tree_early_init(fdt);
+
     setup_pagetables(boot_phys_offset);
 
 #ifdef EARLY_UART_ADDRESS
diff -r f89c9a13529a -r 40879997c29f xen/common/Makefile
--- a/xen/common/Makefile	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/common/Makefile	Mon Feb 13 14:24:49 2012 +0000
@@ -1,6 +1,7 @@
 obj-y += bitmap.o
 obj-y += cpu.o
 obj-y += cpupool.o
+obj-$(HAS_DEVICE_TREE) += device_tree.o
 obj-y += domctl.o
 obj-y += domain.o
 obj-y += event_channel.o
@@ -60,3 +61,5 @@
 
 subdir-y += libelf
 subdir-$(HAS_DEVICE_TREE) += libfdt
+
+CFLAGS += -Ilibfdt
diff -r f89c9a13529a -r 40879997c29f xen/common/device_tree.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/device_tree.c	Mon Feb 13 14:24:49 2012 +0000
@@ -0,0 +1,179 @@
+/*
+ * Device Tree
+ *
+ * Copyright (C) 2012 Citrix Systems, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <xen/config.h>
+#include <xen/types.h>
+#include <xen/init.h>
+#include <xen/device_tree.h>
+#include <xen/kernel.h>
+#include <xen/lib.h>
+#include <xen/mm.h>
+#include <xen/stdarg.h>
+#include <xen/string.h>
+#include <asm/early_printk.h>
+
+#include <libfdt.h>
+
+struct dt_early_info __initdata early_info;
+
+static void __init get_val(const u32 **cell, u32 cells, u64 *val)
+{
+    *val = 0;
+
+    while (cells--) {
+        *val <<= 32;
+        *val |= fdt32_to_cpu(*(*cell)++);
+    }
+}
+
+static void __init get_register(const u32 **cell, u32 address_cells, u32 size_cells,
+                                u64 *start, u64 *size)
+{
+    get_val(cell, address_cells, start);
+    get_val(cell, size_cells, size);
+}
+
+static u32 __init prop_by_name_u32(const void *fdt, int node, const char *prop_name)
+{
+    const struct fdt_property *prop;
+
+    prop = fdt_get_property(fdt, node, prop_name, NULL);
+    if (!prop || prop->len < sizeof(u32))
+        return 0; /* default to 0 */
+
+    return fdt32_to_cpu(*(uint32_t*)prop->data);
+}
+
+static void __init process_memory_node(const void *fdt, int node,
+                                       u32 address_cells, u32 size_cells)
+{
+    const struct fdt_property *prop;
+    size_t reg_cells;
+    int i;
+    int banks;
+    const u32 *cell;
+    paddr_t start, size;
+
+    if (address_cells < 1 || size_cells < 1) {
+        early_printk("fdt: node `%s': invalid #address-cells or #size-cells",
+                     fdt_get_name(fdt, node, NULL));
+        return;
+    }
+
+    prop = fdt_get_property(fdt, node, "reg", NULL);
+    if (!prop) {
+        early_printk("fdt: node `%s': missing `reg' property\n",
+                     fdt_get_name(fdt, node, NULL));
+        return;
+    }
+
+    cell = (const u32 *)prop->data;
+    reg_cells = address_cells + size_cells;
+    banks = fdt32_to_cpu(prop->len) / (reg_cells * sizeof(u32));
+
+    for (i = 0; i < banks && early_info.mem.nr_banks < NR_MEM_BANKS; i++) {
+        get_register(&cell, address_cells, size_cells, &start, &size);
+        early_info.mem.bank[early_info.mem.nr_banks].start = start;
+        early_info.mem.bank[early_info.mem.nr_banks].size = size;
+        early_info.mem.nr_banks++;
+    }
+}
+
+#define MAX_DEPTH 16
+
+static void __init early_scan(const void *fdt)
+{
+    int node;
+    int depth;
+    const char *name;
+    u32 address_cells[MAX_DEPTH];
+    u32 size_cells[MAX_DEPTH];
+
+    for (node = 0; depth >= 0; node = fdt_next_node(fdt, node, &depth)) {
+        name = fdt_get_name(fdt, node, NULL);
+
+        if (depth >= MAX_DEPTH) {
+            early_printk("fdt: node '%s': nested too deep\n",
+                         fdt_get_name(fdt, node, NULL));
+            continue;
+        }
+
+        address_cells[depth] = prop_by_name_u32(fdt, node, "#address-cells");
+        size_cells[depth] = prop_by_name_u32(fdt, node, "#size-cells");
+
+        if (strncmp(name, "memory", 6) == 0)
+            process_memory_node(fdt, node, address_cells[depth-1], size_cells[depth-1]);
+    }
+}
+
+static void __init early_print_info(void)
+{
+    struct dt_mem_info *mi = &early_info.mem;
+    int i;
+
+    for (i = 0; i < mi->nr_banks; i++)
+        early_printk("RAM: %016llx - %016llx\n",
+                     mi->bank[i].start, mi->bank[i].start + mi->bank[i].size - 1);
+}
+
+/**
+ * device_tree_early_init - initialize early info from a DTB
+ * @fdt: flattened device tree binary
+ */
+void __init device_tree_early_init(const void *fdt)
+{
+    int ret;
+
+    ret = fdt_check_header(fdt);
+    if (ret < 0)
+        early_panic("No valid device tree\n");
+
+    early_scan(fdt);
+    early_print_info();
+}
+
+/**
+ * device_tree_get_xen_paddr - get physical address to relocate Xen to
+ *
+ * Xen is relocated to the top of RAM and aligned to a XEN_PADDR_ALIGN
+ * boundary.
+ */
+paddr_t __init device_tree_get_xen_paddr(void)
+{
+    struct dt_mem_info *mi = &early_info.mem;
+    paddr_t min_size;
+    paddr_t paddr = 0, t;
+    int i;
+
+    min_size = (_end - _start + (XEN_PADDR_ALIGN-1)) & ~(XEN_PADDR_ALIGN-1);
+
+    /* Find the highest bank with enough space. */
+    for (i = 0; i < mi->nr_banks; i++) {
+        if (mi->bank[i].size >= min_size) {
+            t = mi->bank[i].start + mi->bank[i].size - min_size;
+            if (t > paddr)
+                paddr = t;
+        }
+    }
+
+    if (!paddr)
+        early_panic("Not enough memory to relocate Xen\n");
+
+    return paddr;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r f89c9a13529a -r 40879997c29f xen/include/asm-arm/mm.h
--- a/xen/include/asm-arm/mm.h	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/include/asm-arm/mm.h	Mon Feb 13 14:24:49 2012 +0000
@@ -6,9 +6,8 @@
 #include <asm/page.h>
 #include <public/xen.h>
 
-/* Find a suitable place at the top of memory for Xen to live */
-/* XXX For now, use the top of the VE's 4GB RAM, at a 40-bit alias */
-#define XEN_PADDR 0x80ffe00000ull
+/* Align Xen to a 2 MiB boundary. */
+#define XEN_PADDR_ALIGN (1 << 21)
 
 /*
  * Per-page-frame information.
diff -r f89c9a13529a -r 40879997c29f xen/include/xen/device_tree.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/xen/device_tree.h	Mon Feb 13 14:24:49 2012 +0000
@@ -0,0 +1,36 @@
+/*
+ * Device Tree
+ *
+ * Copyright (C) 2012 Citrix Systems, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __XEN_DEVICE_TREE_H__
+#define __XEN_DEVICE_TREE_H__
+
+#include <xen/types.h>
+
+#define NR_MEM_BANKS 8
+
+struct membank {
+    paddr_t start;
+    paddr_t size;
+};
+
+struct dt_mem_info {
+    int nr_banks;
+    struct membank bank[NR_MEM_BANKS];
+};
+
+struct dt_early_info {
+    struct dt_mem_info mem;
+};
+
+extern struct dt_early_info early_info;
+
+void device_tree_early_init(const void *fdt);
+paddr_t device_tree_get_xen_paddr(void);
+
+#endif

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:28 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDX-0004ze-2x; Tue, 14 Feb 2012 23:55:27 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDV-0004vR-9f
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1329263717!8235227!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21587 invoked from network); 14 Feb 2012 23:55:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDM-0007i0-Nf
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDM-0002Cu-Ki
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:16 +0000
Message-Id: <E1RxSDM-0002Cu-Ki@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] MAINTAINERS: Add entry for ARM w/
	virt extensions port
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329137608 0
# Node ID bd0a11ed1a67fd9b970f4b043879afdbc7f50d0c
# Parent  79fe73117c12d5f20468df0961274656378dfb53
MAINTAINERS: Add entry for ARM w/ virt extensions port

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 79fe73117c12 -r bd0a11ed1a67 MAINTAINERS
--- a/MAINTAINERS	Mon Feb 13 12:50:46 2012 +0000
+++ b/MAINTAINERS	Mon Feb 13 12:53:28 2012 +0000
@@ -97,6 +97,15 @@
 S:	Supported
 F:	xen/arch/x86/hvm/svm/
 
+ARM (W/ VIRTUALISATION EXTENSIONS) ARCHITECTURE
+M:	Ian Campbell <ian.campbell@citrix.com>
+M:	Stefano Stabellini <stefano.stabellini@citrix.com>
+M:	Tim Deegan <tim@xen.org>
+S:	Supported
+L:	xen-devel@lists.xensource.com
+F:	xen/arch/arm/
+F:	xen/include/asm-arm/
+
 CPU POOLS
 M:	Juergen Gross <juergen.gross@ts.fujitsu.com>
 S:	Supported

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:28 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDX-0004ze-2x; Tue, 14 Feb 2012 23:55:27 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDV-0004vR-9f
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1329263717!8235227!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21587 invoked from network); 14 Feb 2012 23:55:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDM-0007i0-Nf
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDM-0002Cu-Ki
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:16 +0000
Message-Id: <E1RxSDM-0002Cu-Ki@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] MAINTAINERS: Add entry for ARM w/
	virt extensions port
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329137608 0
# Node ID bd0a11ed1a67fd9b970f4b043879afdbc7f50d0c
# Parent  79fe73117c12d5f20468df0961274656378dfb53
MAINTAINERS: Add entry for ARM w/ virt extensions port

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 79fe73117c12 -r bd0a11ed1a67 MAINTAINERS
--- a/MAINTAINERS	Mon Feb 13 12:50:46 2012 +0000
+++ b/MAINTAINERS	Mon Feb 13 12:53:28 2012 +0000
@@ -97,6 +97,15 @@
 S:	Supported
 F:	xen/arch/x86/hvm/svm/
 
+ARM (W/ VIRTUALISATION EXTENSIONS) ARCHITECTURE
+M:	Ian Campbell <ian.campbell@citrix.com>
+M:	Stefano Stabellini <stefano.stabellini@citrix.com>
+M:	Tim Deegan <tim@xen.org>
+S:	Supported
+L:	xen-devel@lists.xensource.com
+F:	xen/arch/arm/
+F:	xen/include/asm-arm/
+
 CPU POOLS
 M:	Juergen Gross <juergen.gross@ts.fujitsu.com>
 S:	Supported

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:29 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDW-0004zZ-W4; Tue, 14 Feb 2012 23:55:26 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDU-0004vC-SQ
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-174.messagelabs.com!1329263715!9168109!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31983 invoked from network); 14 Feb 2012 23:55:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDL-0007hu-6p
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDK-0002C3-UK
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:14 +0000
Message-Id: <E1RxSDK-0002C3-UK@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] hvmloader: Move option ROM loading
	into a separate optionnal file
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Julian Pidancet <julian.pidancet@gmail.com>
# Date 1329137404 0
# Node ID e4d8d2524407c8dd85409d142e7fbbdbd5033193
# Parent  ab47cfef2b0a774d3c576c5c7a4a3cda350cf61a
hvmloader: Move option ROM loading into a separate optionnal file

Make load_rom field in struct bios_config an optionnal callback rather
than a boolean value. It allow BIOS specific code to implement it's
own option ROM loading methods.

Facilities to scan PCI devices, extract an deploy ROMs are moved into
a separate file that can be compiled optionnaly.

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r ab47cfef2b0a -r e4d8d2524407 tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile	Mon Feb 13 12:49:06 2012 +0000
+++ b/tools/firmware/hvmloader/Makefile	Mon Feb 13 12:50:04 2012 +0000
@@ -39,7 +39,7 @@
 
 ROMBIOS_DIR := ../rombios
 ifneq ($(ROMBIOS_DIR),)
-OBJS += 32bitbios_support.o rombios.o
+OBJS += optionroms.o 32bitbios_support.o rombios.o
 CFLAGS += -DENABLE_ROMBIOS
 ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest
 endif
diff -r ab47cfef2b0a -r e4d8d2524407 tools/firmware/hvmloader/config.h
--- a/tools/firmware/hvmloader/config.h	Mon Feb 13 12:49:06 2012 +0000
+++ b/tools/firmware/hvmloader/config.h	Mon Feb 13 12:50:04 2012 +0000
@@ -18,8 +18,7 @@
     unsigned int bios_address;
 
     /* ROMS */
-    int load_roms;
-    unsigned int optionrom_start, optionrom_end;
+    void (*load_roms)(void);
 
     void (*bios_load)(const struct bios_config *config);
 
diff -r ab47cfef2b0a -r e4d8d2524407 tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c	Mon Feb 13 12:49:06 2012 +0000
+++ b/tools/firmware/hvmloader/hvmloader.c	Mon Feb 13 12:50:04 2012 +0000
@@ -24,16 +24,11 @@
 #include "hypercall.h"
 #include "config.h"
 #include "pci_regs.h"
-#include "option_rom.h"
 #include "apic_regs.h"
 #include "acpi/acpi2_0.h"
 #include <xen/version.h>
 #include <xen/hvm/params.h>
 
-#define ROM_INCLUDE_VGABIOS
-#define ROM_INCLUDE_ETHERBOOT
-#include "roms.inc"
-
 asm (
     "    .text                       \n"
     "    .globl _start               \n"
@@ -147,169 +142,6 @@
     printf("Detected Xen v%u.%u%s\n", eax >> 16, eax & 0xffff, extraversion);
 }
 
-/*
- * Scan the list of Option ROMs at @roms for one which supports 
- * PCI (@vendor_id, @device_id) found at slot @devfn. If one is found,
- * copy it to @dest and return its size rounded up to a multiple 2kB. This
- * function will not copy ROMs beyond address option_rom_end.
- */
-#define round_option_rom(x) (((x) + 2047) & ~2047)
-static int scan_option_rom(
-    unsigned int option_rom_end,
-    uint8_t devfn, uint16_t vendor_id, uint16_t device_id,
-    void *roms, uint32_t dest)
-{
-    struct option_rom_header *rom;
-    struct option_rom_pnp_header *pnph;
-    struct option_rom_pci_header *pcih;
-    uint8_t csum;
-    int i;
-
-    static uint32_t orom_ids[64];
-    static int nr_roms;
-
-    /* Avoid duplicate ROMs. */
-    for ( i = 0; i < nr_roms; i++ )
-        if ( orom_ids[i] == (vendor_id | ((uint32_t)device_id << 16)) )
-            return 0;
-
-    rom = roms;
-    for ( ; ; )
-    {
-        /* Invalid signature means we're out of option ROMs. */
-        if ( strncmp((char *)rom->signature, "\x55\xaa", 2) ||
-             (rom->rom_size == 0) )
-            break;
-
-        /* Invalid checksum means we're out of option ROMs. */
-        csum = 0;
-        for ( i = 0; i < (rom->rom_size * 512); i++ )
-            csum += ((uint8_t *)rom)[i];
-        if ( csum != 0 )
-            break;
-
-        /* Check the PCI PnP header (if any) for a match. */
-        pcih = (struct option_rom_pci_header *)
-            ((char *)rom + rom->pci_header_offset);
-        if ( (rom->pci_header_offset != 0) &&
-             !strncmp((char *)pcih->signature, "PCIR", 4) &&
-             (pcih->vendor_id == vendor_id) &&
-             (pcih->device_id == device_id) )
-            goto found;
-
-        rom = (struct option_rom_header *)
-            ((char *)rom + rom->rom_size * 512);
-    }
-
-    return 0;
-
- found:
-    /* Find the PnP expansion header (if any). */
-    pnph = ((rom->expansion_header_offset != 0)
-            ? ((struct option_rom_pnp_header *)
-               ((char *)rom + rom->expansion_header_offset))
-            : ((struct option_rom_pnp_header *)NULL));
-    while ( (pnph != NULL) && strncmp((char *)pnph->signature, "$PnP", 4) )
-        pnph = ((pnph->next_header_offset != 0)
-                ? ((struct option_rom_pnp_header *)
-                   ((char *)rom + pnph->next_header_offset))
-                : ((struct option_rom_pnp_header *)NULL));
-
-    printf("Loading PCI Option ROM ...\n");
-    if ( (pnph != NULL) && (pnph->manufacturer_name_offset != 0) )
-        printf(" - Manufacturer: %s\n",
-               (char *)rom + pnph->manufacturer_name_offset);
-    if ( (pnph != NULL) && (pnph->product_name_offset != 0) )
-        printf(" - Product name: %s\n",
-               (char *)rom + pnph->product_name_offset);
-
-    if ( (dest + rom->rom_size * 512 + 1) > option_rom_end )
-    {
-        printf("Option ROM size %x exceeds available space\n",
-               rom->rom_size * 512);
-        return 0;
-    }
-
-    orom_ids[nr_roms++] = vendor_id | ((uint32_t)device_id << 16);
-    memcpy((void *)dest, rom, rom->rom_size * 512);
-    *(uint8_t *)(dest + rom->rom_size * 512) = devfn;
-    return round_option_rom(rom->rom_size * 512 + 1);
-}
-
-/*
- * Scan the PCI bus for the first NIC supported by etherboot, and copy
- * the corresponding rom data to *copy_rom_dest. Returns the length of the
- * selected rom, or 0 if no NIC found.
- */
-static int scan_etherboot_nic(unsigned int option_rom_end,
-                              uint32_t copy_rom_dest)
-{
-    uint16_t class, vendor_id, device_id, devfn;
-    int rom_size = 0;
-
-    for ( devfn = 0; (devfn < 256) && !rom_size; devfn++ )
-    {
-        class     = pci_readw(devfn, PCI_CLASS_DEVICE);
-        vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
-        device_id = pci_readw(devfn, PCI_DEVICE_ID);
-
-        /* We're only interested in NICs. */
-        if ( (vendor_id != 0xffff) &&
-             (device_id != 0xffff) &&
-             (class == 0x0200) )
-            rom_size = scan_option_rom(
-                option_rom_end,
-                devfn, vendor_id, device_id, etherboot, copy_rom_dest);
-    }
-
-    return rom_size;
-}
-
-/*
- * Scan the PCI bus for the devices that have an option ROM, and copy
- * the corresponding rom data to rom_phys_addr.
- */
-static int pci_load_option_roms(unsigned int option_rom_end,
-                                uint32_t rom_base_addr)
-{
-    uint32_t option_rom_addr, rom_phys_addr = rom_base_addr;
-    uint16_t vendor_id, device_id, devfn, class;
-
-    for ( devfn = 0; devfn < 256; devfn++ )
-    {
-        class     = pci_readb(devfn, PCI_CLASS_DEVICE + 1);
-        vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
-        device_id = pci_readw(devfn, PCI_DEVICE_ID);
-
-        if ( (vendor_id == 0xffff) && (device_id == 0xffff) )
-            continue;
-
-        /*
-         * Currently only scan options from mass storage devices and serial
-         * bus controller (Fibre Channel included).
-         */
-        if ( (class != 0x1) && (class != 0xc) )
-            continue;
-
-        option_rom_addr = pci_readl(devfn, PCI_ROM_ADDRESS);
-        if ( !option_rom_addr )
-            continue;
-
-        /* Ensure Expansion Bar is enabled before copying */
-        pci_writel(devfn, PCI_ROM_ADDRESS, option_rom_addr | 0x1);
-
-        rom_phys_addr += scan_option_rom(
-            option_rom_end,
-            devfn, vendor_id, device_id,
-            (void *)(option_rom_addr & ~2047), rom_phys_addr);
-
-        /* Restore the default original value of Expansion Bar */
-        pci_writel(devfn, PCI_ROM_ADDRESS, option_rom_addr);
-    }
-
-    return rom_phys_addr - rom_base_addr;
-}
-
 /* Replace possibly erroneous memory-size CMOS fields with correct values. */
 static void cmos_write_memory_size(void)
 {
@@ -421,8 +253,6 @@
 int main(void)
 {
     const struct bios_config *bios;
-    int option_rom_sz = 0, vgabios_sz = 0, etherboot_sz = 0;
-    uint32_t etherboot_phys_addr = 0, option_rom_phys_addr = 0;
     int acpi_enabled;
 
     /* Initialise hypercall stubs with RET, rendering them no-ops. */
@@ -471,41 +301,7 @@
     }
 
     if ( bios->load_roms )
-    {
-        switch ( virtual_vga )
-        {
-        case VGA_cirrus:
-            printf("Loading Cirrus VGABIOS ...\n");
-            memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
-                   vgabios_cirrusvga, sizeof(vgabios_cirrusvga));
-            vgabios_sz = round_option_rom(sizeof(vgabios_cirrusvga));
-            break;
-        case VGA_std:
-            printf("Loading Standard VGABIOS ...\n");
-            memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
-                   vgabios_stdvga, sizeof(vgabios_stdvga));
-            vgabios_sz = round_option_rom(sizeof(vgabios_stdvga));
-            break;
-        case VGA_pt:
-            printf("Loading VGABIOS of passthroughed gfx ...\n");
-            vgabios_sz = round_option_rom(
-                (*(uint8_t *)(VGABIOS_PHYSICAL_ADDRESS+2)) * 512);
-            break;
-        default:
-            printf("No emulated VGA adaptor ...\n");
-            break;
-        }
-
-        etherboot_phys_addr = VGABIOS_PHYSICAL_ADDRESS + vgabios_sz;
-        if ( etherboot_phys_addr < bios->optionrom_start )
-            etherboot_phys_addr = bios->optionrom_start;
-        etherboot_sz = scan_etherboot_nic(bios->optionrom_end,
-                                          etherboot_phys_addr);
-
-        option_rom_phys_addr = etherboot_phys_addr + etherboot_sz;
-        option_rom_sz = pci_load_option_roms(bios->optionrom_end,
-                                             option_rom_phys_addr);
-    }
+        bios->load_roms();
 
     acpi_enabled = !strncmp(xenstore_read("platform/acpi", "1"), "1", 1);
 
@@ -536,18 +332,6 @@
     if ( SCRATCH_PHYSICAL_ADDRESS != scratch_start )
         printf(" %05x-%05lx: Scratch space\n",
                SCRATCH_PHYSICAL_ADDRESS, scratch_start);
-    if ( vgabios_sz )
-        printf(" %05x-%05x: VGA BIOS\n",
-               VGABIOS_PHYSICAL_ADDRESS,
-               VGABIOS_PHYSICAL_ADDRESS + vgabios_sz - 1);
-    if ( etherboot_sz )
-        printf(" %05x-%05x: Etherboot ROM\n",
-               etherboot_phys_addr,
-               etherboot_phys_addr + etherboot_sz - 1);
-    if ( option_rom_sz )
-        printf(" %05x-%05x: PCI Option ROMs\n",
-               option_rom_phys_addr,
-               option_rom_phys_addr + option_rom_sz - 1);
     printf(" %05x-%05x: Main BIOS\n",
            bios->bios_address,
            bios->bios_address + bios->image_size - 1);
diff -r ab47cfef2b0a -r e4d8d2524407 tools/firmware/hvmloader/option_rom.h
--- a/tools/firmware/hvmloader/option_rom.h	Mon Feb 13 12:49:06 2012 +0000
+++ b/tools/firmware/hvmloader/option_rom.h	Mon Feb 13 12:50:04 2012 +0000
@@ -47,6 +47,13 @@
     uint16_t reserved;
 } __attribute__ ((packed));
 
+#define round_option_rom(x) (((x) + 2047) & ~2047)
+int scan_etherboot_nic(unsigned int option_rom_end,
+                       uint32_t copy_rom_dest,
+                       void *etherboot_rom);
+int pci_load_option_roms(unsigned int option_rom_end,
+                         uint32_t rom_base_addr);
+
 #endif /* __HVMLOADER_OPTION_ROM_H__ */
 
 /*
diff -r ab47cfef2b0a -r e4d8d2524407 tools/firmware/hvmloader/optionroms.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/firmware/hvmloader/optionroms.c	Mon Feb 13 12:50:04 2012 +0000
@@ -0,0 +1,189 @@
+/*
+ * optionroms.c: Option ROM loading support.
+ *
+ * Leendert van Doorn, leendert@watson.ibm.com
+ * Copyright (c) 2005, International Business Machines Corporation.
+ *
+ * Copyright (c) 2006, Keir Fraser, XenSource Inc.
+ *
+ * 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 "config.h"
+#include "option_rom.h"
+#include "util.h"
+#include "pci_regs.h"
+
+/*
+ * Scan the list of Option ROMs at @roms for one which supports 
+ * PCI (@vendor_id, @device_id) found at slot @devfn. If one is found,
+ * copy it to @dest and return its size rounded up to a multiple 2kB. This
+ * function will not copy ROMs beyond address option_rom_end.
+ */
+static int scan_option_rom(
+    unsigned int option_rom_end,
+    uint8_t devfn, uint16_t vendor_id, uint16_t device_id,
+    void *roms, uint32_t dest)
+{
+    struct option_rom_header *rom;
+    struct option_rom_pnp_header *pnph;
+    struct option_rom_pci_header *pcih;
+    uint8_t csum;
+    int i;
+
+    static uint32_t orom_ids[64];
+    static int nr_roms;
+
+    /* Avoid duplicate ROMs. */
+    for ( i = 0; i < nr_roms; i++ )
+        if ( orom_ids[i] == (vendor_id | ((uint32_t)device_id << 16)) )
+            return 0;
+
+    rom = roms;
+    for ( ; ; )
+    {
+        /* Invalid signature means we're out of option ROMs. */
+        if ( strncmp((char *)rom->signature, "\x55\xaa", 2) ||
+             (rom->rom_size == 0) )
+            break;
+
+        /* Invalid checksum means we're out of option ROMs. */
+        csum = 0;
+        for ( i = 0; i < (rom->rom_size * 512); i++ )
+            csum += ((uint8_t *)rom)[i];
+        if ( csum != 0 )
+            break;
+
+        /* Check the PCI PnP header (if any) for a match. */
+        pcih = (struct option_rom_pci_header *)
+            ((char *)rom + rom->pci_header_offset);
+        if ( (rom->pci_header_offset != 0) &&
+             !strncmp((char *)pcih->signature, "PCIR", 4) &&
+             (pcih->vendor_id == vendor_id) &&
+             (pcih->device_id == device_id) )
+            goto found;
+
+        rom = (struct option_rom_header *)
+            ((char *)rom + rom->rom_size * 512);
+    }
+
+    return 0;
+
+ found:
+    /* Find the PnP expansion header (if any). */
+    pnph = ((rom->expansion_header_offset != 0)
+            ? ((struct option_rom_pnp_header *)
+               ((char *)rom + rom->expansion_header_offset))
+            : ((struct option_rom_pnp_header *)NULL));
+    while ( (pnph != NULL) && strncmp((char *)pnph->signature, "$PnP", 4) )
+        pnph = ((pnph->next_header_offset != 0)
+                ? ((struct option_rom_pnp_header *)
+                   ((char *)rom + pnph->next_header_offset))
+                : ((struct option_rom_pnp_header *)NULL));
+
+    printf("Loading PCI Option ROM ...\n");
+    if ( (pnph != NULL) && (pnph->manufacturer_name_offset != 0) )
+        printf(" - Manufacturer: %s\n",
+               (char *)rom + pnph->manufacturer_name_offset);
+    if ( (pnph != NULL) && (pnph->product_name_offset != 0) )
+        printf(" - Product name: %s\n",
+               (char *)rom + pnph->product_name_offset);
+
+    if ( (dest + rom->rom_size * 512 + 1) > option_rom_end )
+    {
+        printf("Option ROM size %x exceeds available space\n",
+               rom->rom_size * 512);
+        return 0;
+    }
+
+    orom_ids[nr_roms++] = vendor_id | ((uint32_t)device_id << 16);
+    memcpy((void *)dest, rom, rom->rom_size * 512);
+    *(uint8_t *)(dest + rom->rom_size * 512) = devfn;
+    return round_option_rom(rom->rom_size * 512 + 1);
+}
+
+/*
+ * Scan the PCI bus for the first NIC supported by etherboot, and copy
+ * the corresponding rom data to *copy_rom_dest. Returns the length of the
+ * selected rom, or 0 if no NIC found.
+ */
+int scan_etherboot_nic(unsigned int option_rom_end,
+                       uint32_t copy_rom_dest,
+                       void *etherboot_rom)
+{
+    uint16_t class, vendor_id, device_id, devfn;
+    int rom_size = 0;
+
+    for ( devfn = 0; (devfn < 256) && !rom_size; devfn++ )
+    {
+        class     = pci_readw(devfn, PCI_CLASS_DEVICE);
+        vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
+        device_id = pci_readw(devfn, PCI_DEVICE_ID);
+
+        /* We're only interested in NICs. */
+        if ( (vendor_id != 0xffff) &&
+             (device_id != 0xffff) &&
+             (class == 0x0200) )
+            rom_size = scan_option_rom(
+                option_rom_end,
+                devfn, vendor_id, device_id, etherboot_rom, copy_rom_dest);
+    }
+
+    return rom_size;
+}
+
+/*
+ * Scan the PCI bus for the devices that have an option ROM, and copy
+ * the corresponding rom data to rom_phys_addr.
+ */
+int pci_load_option_roms(unsigned int option_rom_end,
+                         uint32_t rom_base_addr)
+{
+    uint32_t option_rom_addr, rom_phys_addr = rom_base_addr;
+    uint16_t vendor_id, device_id, devfn, class;
+
+    for ( devfn = 0; devfn < 256; devfn++ )
+    {
+        class     = pci_readb(devfn, PCI_CLASS_DEVICE + 1);
+        vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
+        device_id = pci_readw(devfn, PCI_DEVICE_ID);
+
+        if ( (vendor_id == 0xffff) && (device_id == 0xffff) )
+            continue;
+
+        /*
+         * Currently only scan options from mass storage devices and serial
+         * bus controller (Fibre Channel included).
+         */
+        if ( (class != 0x1) && (class != 0xc) )
+            continue;
+
+        option_rom_addr = pci_readl(devfn, PCI_ROM_ADDRESS);
+        if ( !option_rom_addr )
+            continue;
+
+        /* Ensure Expansion Bar is enabled before copying */
+        pci_writel(devfn, PCI_ROM_ADDRESS, option_rom_addr | 0x1);
+
+        rom_phys_addr += scan_option_rom(
+            option_rom_end,
+            devfn, vendor_id, device_id,
+            (void *)(option_rom_addr & ~2047), rom_phys_addr);
+
+        /* Restore the default original value of Expansion Bar */
+        pci_writel(devfn, PCI_ROM_ADDRESS, option_rom_addr);
+    }
+
+    return rom_phys_addr - rom_base_addr;
+}
diff -r ab47cfef2b0a -r e4d8d2524407 tools/firmware/hvmloader/rombios.c
--- a/tools/firmware/hvmloader/rombios.c	Mon Feb 13 12:49:06 2012 +0000
+++ b/tools/firmware/hvmloader/rombios.c	Mon Feb 13 12:50:04 2012 +0000
@@ -29,10 +29,13 @@
 #include "pci_regs.h"
 #include "util.h"
 #include "hypercall.h"
+#include "option_rom.h"
 
 #include <xen/hvm/params.h>
 
 #define ROM_INCLUDE_ROMBIOS
+#define ROM_INCLUDE_VGABIOS
+#define ROM_INCLUDE_ETHERBOOT
 #include "roms.inc"
 
 #define ROMBIOS_BEGIN          0x000F0000
@@ -64,6 +67,61 @@
     memset(info, 0, sizeof(*info));
 }
 
+static void rombios_load_roms(void)
+{
+    int option_rom_sz = 0, vgabios_sz = 0, etherboot_sz = 0;
+    uint32_t etherboot_phys_addr = 0, option_rom_phys_addr = 0;
+
+    switch ( virtual_vga )
+    {
+    case VGA_cirrus:
+        printf("Loading Cirrus VGABIOS ...\n");
+        memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
+               vgabios_cirrusvga, sizeof(vgabios_cirrusvga));
+        vgabios_sz = round_option_rom(sizeof(vgabios_cirrusvga));
+        break;
+    case VGA_std:
+        printf("Loading Standard VGABIOS ...\n");
+        memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
+               vgabios_stdvga, sizeof(vgabios_stdvga));
+        vgabios_sz = round_option_rom(sizeof(vgabios_stdvga));
+        break;
+    case VGA_pt:
+        printf("Loading VGABIOS of passthroughed gfx ...\n");
+        vgabios_sz = round_option_rom(
+            (*(uint8_t *)(VGABIOS_PHYSICAL_ADDRESS+2)) * 512);
+        break;
+    default:
+        printf("No emulated VGA adaptor ...\n");
+        break;
+    }
+
+    etherboot_phys_addr = VGABIOS_PHYSICAL_ADDRESS + vgabios_sz;
+    if ( etherboot_phys_addr < OPTIONROM_PHYSICAL_ADDRESS )
+        etherboot_phys_addr = OPTIONROM_PHYSICAL_ADDRESS;
+    etherboot_sz = scan_etherboot_nic(OPTIONROM_PHYSICAL_END,
+                                      etherboot_phys_addr,
+                                      etherboot);
+
+    option_rom_phys_addr = etherboot_phys_addr + etherboot_sz;
+    option_rom_sz = pci_load_option_roms(OPTIONROM_PHYSICAL_END,
+                                         option_rom_phys_addr);
+
+    printf("Option ROMs:\n");
+    if ( vgabios_sz )
+        printf(" %05x-%05x: VGA BIOS\n",
+               VGABIOS_PHYSICAL_ADDRESS,
+               VGABIOS_PHYSICAL_ADDRESS + vgabios_sz - 1);
+    if ( etherboot_sz )
+        printf(" %05x-%05x: Etherboot ROM\n",
+               etherboot_phys_addr,
+               etherboot_phys_addr + etherboot_sz - 1);
+    if ( option_rom_sz )
+        printf(" %05x-%05x: PCI Option ROMs\n",
+               option_rom_phys_addr,
+               option_rom_phys_addr + option_rom_sz - 1);
+}
+
 static void rombios_load(const struct bios_config *config)
 {
     uint32_t bioshigh;
@@ -158,10 +216,7 @@
 
     .bios_address = ROMBIOS_PHYSICAL_ADDRESS,
 
-    .load_roms = 1,
-
-    .optionrom_start = OPTIONROM_PHYSICAL_ADDRESS,
-    .optionrom_end = OPTIONROM_PHYSICAL_END,
+    .load_roms = rombios_load_roms,
 
     .bios_load = rombios_load,
 
diff -r ab47cfef2b0a -r e4d8d2524407 tools/firmware/hvmloader/seabios.c
--- a/tools/firmware/hvmloader/seabios.c	Mon Feb 13 12:49:06 2012 +0000
+++ b/tools/firmware/hvmloader/seabios.c	Mon Feb 13 12:50:04 2012 +0000
@@ -143,10 +143,7 @@
 
     .bios_address = SEABIOS_PHYSICAL_ADDRESS,
 
-    .load_roms = 0,
-
-    .optionrom_start = 0,
-    .optionrom_end = 0,
+    .load_roms = NULL,
 
     .bios_load = NULL,
 

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:29 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDW-0004zZ-W4; Tue, 14 Feb 2012 23:55:26 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDU-0004vC-SQ
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-174.messagelabs.com!1329263715!9168109!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31983 invoked from network); 14 Feb 2012 23:55:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDL-0007hu-6p
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDK-0002C3-UK
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:14 +0000
Message-Id: <E1RxSDK-0002C3-UK@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] hvmloader: Move option ROM loading
	into a separate optionnal file
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Julian Pidancet <julian.pidancet@gmail.com>
# Date 1329137404 0
# Node ID e4d8d2524407c8dd85409d142e7fbbdbd5033193
# Parent  ab47cfef2b0a774d3c576c5c7a4a3cda350cf61a
hvmloader: Move option ROM loading into a separate optionnal file

Make load_rom field in struct bios_config an optionnal callback rather
than a boolean value. It allow BIOS specific code to implement it's
own option ROM loading methods.

Facilities to scan PCI devices, extract an deploy ROMs are moved into
a separate file that can be compiled optionnaly.

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r ab47cfef2b0a -r e4d8d2524407 tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile	Mon Feb 13 12:49:06 2012 +0000
+++ b/tools/firmware/hvmloader/Makefile	Mon Feb 13 12:50:04 2012 +0000
@@ -39,7 +39,7 @@
 
 ROMBIOS_DIR := ../rombios
 ifneq ($(ROMBIOS_DIR),)
-OBJS += 32bitbios_support.o rombios.o
+OBJS += optionroms.o 32bitbios_support.o rombios.o
 CFLAGS += -DENABLE_ROMBIOS
 ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest
 endif
diff -r ab47cfef2b0a -r e4d8d2524407 tools/firmware/hvmloader/config.h
--- a/tools/firmware/hvmloader/config.h	Mon Feb 13 12:49:06 2012 +0000
+++ b/tools/firmware/hvmloader/config.h	Mon Feb 13 12:50:04 2012 +0000
@@ -18,8 +18,7 @@
     unsigned int bios_address;
 
     /* ROMS */
-    int load_roms;
-    unsigned int optionrom_start, optionrom_end;
+    void (*load_roms)(void);
 
     void (*bios_load)(const struct bios_config *config);
 
diff -r ab47cfef2b0a -r e4d8d2524407 tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c	Mon Feb 13 12:49:06 2012 +0000
+++ b/tools/firmware/hvmloader/hvmloader.c	Mon Feb 13 12:50:04 2012 +0000
@@ -24,16 +24,11 @@
 #include "hypercall.h"
 #include "config.h"
 #include "pci_regs.h"
-#include "option_rom.h"
 #include "apic_regs.h"
 #include "acpi/acpi2_0.h"
 #include <xen/version.h>
 #include <xen/hvm/params.h>
 
-#define ROM_INCLUDE_VGABIOS
-#define ROM_INCLUDE_ETHERBOOT
-#include "roms.inc"
-
 asm (
     "    .text                       \n"
     "    .globl _start               \n"
@@ -147,169 +142,6 @@
     printf("Detected Xen v%u.%u%s\n", eax >> 16, eax & 0xffff, extraversion);
 }
 
-/*
- * Scan the list of Option ROMs at @roms for one which supports 
- * PCI (@vendor_id, @device_id) found at slot @devfn. If one is found,
- * copy it to @dest and return its size rounded up to a multiple 2kB. This
- * function will not copy ROMs beyond address option_rom_end.
- */
-#define round_option_rom(x) (((x) + 2047) & ~2047)
-static int scan_option_rom(
-    unsigned int option_rom_end,
-    uint8_t devfn, uint16_t vendor_id, uint16_t device_id,
-    void *roms, uint32_t dest)
-{
-    struct option_rom_header *rom;
-    struct option_rom_pnp_header *pnph;
-    struct option_rom_pci_header *pcih;
-    uint8_t csum;
-    int i;
-
-    static uint32_t orom_ids[64];
-    static int nr_roms;
-
-    /* Avoid duplicate ROMs. */
-    for ( i = 0; i < nr_roms; i++ )
-        if ( orom_ids[i] == (vendor_id | ((uint32_t)device_id << 16)) )
-            return 0;
-
-    rom = roms;
-    for ( ; ; )
-    {
-        /* Invalid signature means we're out of option ROMs. */
-        if ( strncmp((char *)rom->signature, "\x55\xaa", 2) ||
-             (rom->rom_size == 0) )
-            break;
-
-        /* Invalid checksum means we're out of option ROMs. */
-        csum = 0;
-        for ( i = 0; i < (rom->rom_size * 512); i++ )
-            csum += ((uint8_t *)rom)[i];
-        if ( csum != 0 )
-            break;
-
-        /* Check the PCI PnP header (if any) for a match. */
-        pcih = (struct option_rom_pci_header *)
-            ((char *)rom + rom->pci_header_offset);
-        if ( (rom->pci_header_offset != 0) &&
-             !strncmp((char *)pcih->signature, "PCIR", 4) &&
-             (pcih->vendor_id == vendor_id) &&
-             (pcih->device_id == device_id) )
-            goto found;
-
-        rom = (struct option_rom_header *)
-            ((char *)rom + rom->rom_size * 512);
-    }
-
-    return 0;
-
- found:
-    /* Find the PnP expansion header (if any). */
-    pnph = ((rom->expansion_header_offset != 0)
-            ? ((struct option_rom_pnp_header *)
-               ((char *)rom + rom->expansion_header_offset))
-            : ((struct option_rom_pnp_header *)NULL));
-    while ( (pnph != NULL) && strncmp((char *)pnph->signature, "$PnP", 4) )
-        pnph = ((pnph->next_header_offset != 0)
-                ? ((struct option_rom_pnp_header *)
-                   ((char *)rom + pnph->next_header_offset))
-                : ((struct option_rom_pnp_header *)NULL));
-
-    printf("Loading PCI Option ROM ...\n");
-    if ( (pnph != NULL) && (pnph->manufacturer_name_offset != 0) )
-        printf(" - Manufacturer: %s\n",
-               (char *)rom + pnph->manufacturer_name_offset);
-    if ( (pnph != NULL) && (pnph->product_name_offset != 0) )
-        printf(" - Product name: %s\n",
-               (char *)rom + pnph->product_name_offset);
-
-    if ( (dest + rom->rom_size * 512 + 1) > option_rom_end )
-    {
-        printf("Option ROM size %x exceeds available space\n",
-               rom->rom_size * 512);
-        return 0;
-    }
-
-    orom_ids[nr_roms++] = vendor_id | ((uint32_t)device_id << 16);
-    memcpy((void *)dest, rom, rom->rom_size * 512);
-    *(uint8_t *)(dest + rom->rom_size * 512) = devfn;
-    return round_option_rom(rom->rom_size * 512 + 1);
-}
-
-/*
- * Scan the PCI bus for the first NIC supported by etherboot, and copy
- * the corresponding rom data to *copy_rom_dest. Returns the length of the
- * selected rom, or 0 if no NIC found.
- */
-static int scan_etherboot_nic(unsigned int option_rom_end,
-                              uint32_t copy_rom_dest)
-{
-    uint16_t class, vendor_id, device_id, devfn;
-    int rom_size = 0;
-
-    for ( devfn = 0; (devfn < 256) && !rom_size; devfn++ )
-    {
-        class     = pci_readw(devfn, PCI_CLASS_DEVICE);
-        vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
-        device_id = pci_readw(devfn, PCI_DEVICE_ID);
-
-        /* We're only interested in NICs. */
-        if ( (vendor_id != 0xffff) &&
-             (device_id != 0xffff) &&
-             (class == 0x0200) )
-            rom_size = scan_option_rom(
-                option_rom_end,
-                devfn, vendor_id, device_id, etherboot, copy_rom_dest);
-    }
-
-    return rom_size;
-}
-
-/*
- * Scan the PCI bus for the devices that have an option ROM, and copy
- * the corresponding rom data to rom_phys_addr.
- */
-static int pci_load_option_roms(unsigned int option_rom_end,
-                                uint32_t rom_base_addr)
-{
-    uint32_t option_rom_addr, rom_phys_addr = rom_base_addr;
-    uint16_t vendor_id, device_id, devfn, class;
-
-    for ( devfn = 0; devfn < 256; devfn++ )
-    {
-        class     = pci_readb(devfn, PCI_CLASS_DEVICE + 1);
-        vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
-        device_id = pci_readw(devfn, PCI_DEVICE_ID);
-
-        if ( (vendor_id == 0xffff) && (device_id == 0xffff) )
-            continue;
-
-        /*
-         * Currently only scan options from mass storage devices and serial
-         * bus controller (Fibre Channel included).
-         */
-        if ( (class != 0x1) && (class != 0xc) )
-            continue;
-
-        option_rom_addr = pci_readl(devfn, PCI_ROM_ADDRESS);
-        if ( !option_rom_addr )
-            continue;
-
-        /* Ensure Expansion Bar is enabled before copying */
-        pci_writel(devfn, PCI_ROM_ADDRESS, option_rom_addr | 0x1);
-
-        rom_phys_addr += scan_option_rom(
-            option_rom_end,
-            devfn, vendor_id, device_id,
-            (void *)(option_rom_addr & ~2047), rom_phys_addr);
-
-        /* Restore the default original value of Expansion Bar */
-        pci_writel(devfn, PCI_ROM_ADDRESS, option_rom_addr);
-    }
-
-    return rom_phys_addr - rom_base_addr;
-}
-
 /* Replace possibly erroneous memory-size CMOS fields with correct values. */
 static void cmos_write_memory_size(void)
 {
@@ -421,8 +253,6 @@
 int main(void)
 {
     const struct bios_config *bios;
-    int option_rom_sz = 0, vgabios_sz = 0, etherboot_sz = 0;
-    uint32_t etherboot_phys_addr = 0, option_rom_phys_addr = 0;
     int acpi_enabled;
 
     /* Initialise hypercall stubs with RET, rendering them no-ops. */
@@ -471,41 +301,7 @@
     }
 
     if ( bios->load_roms )
-    {
-        switch ( virtual_vga )
-        {
-        case VGA_cirrus:
-            printf("Loading Cirrus VGABIOS ...\n");
-            memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
-                   vgabios_cirrusvga, sizeof(vgabios_cirrusvga));
-            vgabios_sz = round_option_rom(sizeof(vgabios_cirrusvga));
-            break;
-        case VGA_std:
-            printf("Loading Standard VGABIOS ...\n");
-            memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
-                   vgabios_stdvga, sizeof(vgabios_stdvga));
-            vgabios_sz = round_option_rom(sizeof(vgabios_stdvga));
-            break;
-        case VGA_pt:
-            printf("Loading VGABIOS of passthroughed gfx ...\n");
-            vgabios_sz = round_option_rom(
-                (*(uint8_t *)(VGABIOS_PHYSICAL_ADDRESS+2)) * 512);
-            break;
-        default:
-            printf("No emulated VGA adaptor ...\n");
-            break;
-        }
-
-        etherboot_phys_addr = VGABIOS_PHYSICAL_ADDRESS + vgabios_sz;
-        if ( etherboot_phys_addr < bios->optionrom_start )
-            etherboot_phys_addr = bios->optionrom_start;
-        etherboot_sz = scan_etherboot_nic(bios->optionrom_end,
-                                          etherboot_phys_addr);
-
-        option_rom_phys_addr = etherboot_phys_addr + etherboot_sz;
-        option_rom_sz = pci_load_option_roms(bios->optionrom_end,
-                                             option_rom_phys_addr);
-    }
+        bios->load_roms();
 
     acpi_enabled = !strncmp(xenstore_read("platform/acpi", "1"), "1", 1);
 
@@ -536,18 +332,6 @@
     if ( SCRATCH_PHYSICAL_ADDRESS != scratch_start )
         printf(" %05x-%05lx: Scratch space\n",
                SCRATCH_PHYSICAL_ADDRESS, scratch_start);
-    if ( vgabios_sz )
-        printf(" %05x-%05x: VGA BIOS\n",
-               VGABIOS_PHYSICAL_ADDRESS,
-               VGABIOS_PHYSICAL_ADDRESS + vgabios_sz - 1);
-    if ( etherboot_sz )
-        printf(" %05x-%05x: Etherboot ROM\n",
-               etherboot_phys_addr,
-               etherboot_phys_addr + etherboot_sz - 1);
-    if ( option_rom_sz )
-        printf(" %05x-%05x: PCI Option ROMs\n",
-               option_rom_phys_addr,
-               option_rom_phys_addr + option_rom_sz - 1);
     printf(" %05x-%05x: Main BIOS\n",
            bios->bios_address,
            bios->bios_address + bios->image_size - 1);
diff -r ab47cfef2b0a -r e4d8d2524407 tools/firmware/hvmloader/option_rom.h
--- a/tools/firmware/hvmloader/option_rom.h	Mon Feb 13 12:49:06 2012 +0000
+++ b/tools/firmware/hvmloader/option_rom.h	Mon Feb 13 12:50:04 2012 +0000
@@ -47,6 +47,13 @@
     uint16_t reserved;
 } __attribute__ ((packed));
 
+#define round_option_rom(x) (((x) + 2047) & ~2047)
+int scan_etherboot_nic(unsigned int option_rom_end,
+                       uint32_t copy_rom_dest,
+                       void *etherboot_rom);
+int pci_load_option_roms(unsigned int option_rom_end,
+                         uint32_t rom_base_addr);
+
 #endif /* __HVMLOADER_OPTION_ROM_H__ */
 
 /*
diff -r ab47cfef2b0a -r e4d8d2524407 tools/firmware/hvmloader/optionroms.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/firmware/hvmloader/optionroms.c	Mon Feb 13 12:50:04 2012 +0000
@@ -0,0 +1,189 @@
+/*
+ * optionroms.c: Option ROM loading support.
+ *
+ * Leendert van Doorn, leendert@watson.ibm.com
+ * Copyright (c) 2005, International Business Machines Corporation.
+ *
+ * Copyright (c) 2006, Keir Fraser, XenSource Inc.
+ *
+ * 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 "config.h"
+#include "option_rom.h"
+#include "util.h"
+#include "pci_regs.h"
+
+/*
+ * Scan the list of Option ROMs at @roms for one which supports 
+ * PCI (@vendor_id, @device_id) found at slot @devfn. If one is found,
+ * copy it to @dest and return its size rounded up to a multiple 2kB. This
+ * function will not copy ROMs beyond address option_rom_end.
+ */
+static int scan_option_rom(
+    unsigned int option_rom_end,
+    uint8_t devfn, uint16_t vendor_id, uint16_t device_id,
+    void *roms, uint32_t dest)
+{
+    struct option_rom_header *rom;
+    struct option_rom_pnp_header *pnph;
+    struct option_rom_pci_header *pcih;
+    uint8_t csum;
+    int i;
+
+    static uint32_t orom_ids[64];
+    static int nr_roms;
+
+    /* Avoid duplicate ROMs. */
+    for ( i = 0; i < nr_roms; i++ )
+        if ( orom_ids[i] == (vendor_id | ((uint32_t)device_id << 16)) )
+            return 0;
+
+    rom = roms;
+    for ( ; ; )
+    {
+        /* Invalid signature means we're out of option ROMs. */
+        if ( strncmp((char *)rom->signature, "\x55\xaa", 2) ||
+             (rom->rom_size == 0) )
+            break;
+
+        /* Invalid checksum means we're out of option ROMs. */
+        csum = 0;
+        for ( i = 0; i < (rom->rom_size * 512); i++ )
+            csum += ((uint8_t *)rom)[i];
+        if ( csum != 0 )
+            break;
+
+        /* Check the PCI PnP header (if any) for a match. */
+        pcih = (struct option_rom_pci_header *)
+            ((char *)rom + rom->pci_header_offset);
+        if ( (rom->pci_header_offset != 0) &&
+             !strncmp((char *)pcih->signature, "PCIR", 4) &&
+             (pcih->vendor_id == vendor_id) &&
+             (pcih->device_id == device_id) )
+            goto found;
+
+        rom = (struct option_rom_header *)
+            ((char *)rom + rom->rom_size * 512);
+    }
+
+    return 0;
+
+ found:
+    /* Find the PnP expansion header (if any). */
+    pnph = ((rom->expansion_header_offset != 0)
+            ? ((struct option_rom_pnp_header *)
+               ((char *)rom + rom->expansion_header_offset))
+            : ((struct option_rom_pnp_header *)NULL));
+    while ( (pnph != NULL) && strncmp((char *)pnph->signature, "$PnP", 4) )
+        pnph = ((pnph->next_header_offset != 0)
+                ? ((struct option_rom_pnp_header *)
+                   ((char *)rom + pnph->next_header_offset))
+                : ((struct option_rom_pnp_header *)NULL));
+
+    printf("Loading PCI Option ROM ...\n");
+    if ( (pnph != NULL) && (pnph->manufacturer_name_offset != 0) )
+        printf(" - Manufacturer: %s\n",
+               (char *)rom + pnph->manufacturer_name_offset);
+    if ( (pnph != NULL) && (pnph->product_name_offset != 0) )
+        printf(" - Product name: %s\n",
+               (char *)rom + pnph->product_name_offset);
+
+    if ( (dest + rom->rom_size * 512 + 1) > option_rom_end )
+    {
+        printf("Option ROM size %x exceeds available space\n",
+               rom->rom_size * 512);
+        return 0;
+    }
+
+    orom_ids[nr_roms++] = vendor_id | ((uint32_t)device_id << 16);
+    memcpy((void *)dest, rom, rom->rom_size * 512);
+    *(uint8_t *)(dest + rom->rom_size * 512) = devfn;
+    return round_option_rom(rom->rom_size * 512 + 1);
+}
+
+/*
+ * Scan the PCI bus for the first NIC supported by etherboot, and copy
+ * the corresponding rom data to *copy_rom_dest. Returns the length of the
+ * selected rom, or 0 if no NIC found.
+ */
+int scan_etherboot_nic(unsigned int option_rom_end,
+                       uint32_t copy_rom_dest,
+                       void *etherboot_rom)
+{
+    uint16_t class, vendor_id, device_id, devfn;
+    int rom_size = 0;
+
+    for ( devfn = 0; (devfn < 256) && !rom_size; devfn++ )
+    {
+        class     = pci_readw(devfn, PCI_CLASS_DEVICE);
+        vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
+        device_id = pci_readw(devfn, PCI_DEVICE_ID);
+
+        /* We're only interested in NICs. */
+        if ( (vendor_id != 0xffff) &&
+             (device_id != 0xffff) &&
+             (class == 0x0200) )
+            rom_size = scan_option_rom(
+                option_rom_end,
+                devfn, vendor_id, device_id, etherboot_rom, copy_rom_dest);
+    }
+
+    return rom_size;
+}
+
+/*
+ * Scan the PCI bus for the devices that have an option ROM, and copy
+ * the corresponding rom data to rom_phys_addr.
+ */
+int pci_load_option_roms(unsigned int option_rom_end,
+                         uint32_t rom_base_addr)
+{
+    uint32_t option_rom_addr, rom_phys_addr = rom_base_addr;
+    uint16_t vendor_id, device_id, devfn, class;
+
+    for ( devfn = 0; devfn < 256; devfn++ )
+    {
+        class     = pci_readb(devfn, PCI_CLASS_DEVICE + 1);
+        vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
+        device_id = pci_readw(devfn, PCI_DEVICE_ID);
+
+        if ( (vendor_id == 0xffff) && (device_id == 0xffff) )
+            continue;
+
+        /*
+         * Currently only scan options from mass storage devices and serial
+         * bus controller (Fibre Channel included).
+         */
+        if ( (class != 0x1) && (class != 0xc) )
+            continue;
+
+        option_rom_addr = pci_readl(devfn, PCI_ROM_ADDRESS);
+        if ( !option_rom_addr )
+            continue;
+
+        /* Ensure Expansion Bar is enabled before copying */
+        pci_writel(devfn, PCI_ROM_ADDRESS, option_rom_addr | 0x1);
+
+        rom_phys_addr += scan_option_rom(
+            option_rom_end,
+            devfn, vendor_id, device_id,
+            (void *)(option_rom_addr & ~2047), rom_phys_addr);
+
+        /* Restore the default original value of Expansion Bar */
+        pci_writel(devfn, PCI_ROM_ADDRESS, option_rom_addr);
+    }
+
+    return rom_phys_addr - rom_base_addr;
+}
diff -r ab47cfef2b0a -r e4d8d2524407 tools/firmware/hvmloader/rombios.c
--- a/tools/firmware/hvmloader/rombios.c	Mon Feb 13 12:49:06 2012 +0000
+++ b/tools/firmware/hvmloader/rombios.c	Mon Feb 13 12:50:04 2012 +0000
@@ -29,10 +29,13 @@
 #include "pci_regs.h"
 #include "util.h"
 #include "hypercall.h"
+#include "option_rom.h"
 
 #include <xen/hvm/params.h>
 
 #define ROM_INCLUDE_ROMBIOS
+#define ROM_INCLUDE_VGABIOS
+#define ROM_INCLUDE_ETHERBOOT
 #include "roms.inc"
 
 #define ROMBIOS_BEGIN          0x000F0000
@@ -64,6 +67,61 @@
     memset(info, 0, sizeof(*info));
 }
 
+static void rombios_load_roms(void)
+{
+    int option_rom_sz = 0, vgabios_sz = 0, etherboot_sz = 0;
+    uint32_t etherboot_phys_addr = 0, option_rom_phys_addr = 0;
+
+    switch ( virtual_vga )
+    {
+    case VGA_cirrus:
+        printf("Loading Cirrus VGABIOS ...\n");
+        memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
+               vgabios_cirrusvga, sizeof(vgabios_cirrusvga));
+        vgabios_sz = round_option_rom(sizeof(vgabios_cirrusvga));
+        break;
+    case VGA_std:
+        printf("Loading Standard VGABIOS ...\n");
+        memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
+               vgabios_stdvga, sizeof(vgabios_stdvga));
+        vgabios_sz = round_option_rom(sizeof(vgabios_stdvga));
+        break;
+    case VGA_pt:
+        printf("Loading VGABIOS of passthroughed gfx ...\n");
+        vgabios_sz = round_option_rom(
+            (*(uint8_t *)(VGABIOS_PHYSICAL_ADDRESS+2)) * 512);
+        break;
+    default:
+        printf("No emulated VGA adaptor ...\n");
+        break;
+    }
+
+    etherboot_phys_addr = VGABIOS_PHYSICAL_ADDRESS + vgabios_sz;
+    if ( etherboot_phys_addr < OPTIONROM_PHYSICAL_ADDRESS )
+        etherboot_phys_addr = OPTIONROM_PHYSICAL_ADDRESS;
+    etherboot_sz = scan_etherboot_nic(OPTIONROM_PHYSICAL_END,
+                                      etherboot_phys_addr,
+                                      etherboot);
+
+    option_rom_phys_addr = etherboot_phys_addr + etherboot_sz;
+    option_rom_sz = pci_load_option_roms(OPTIONROM_PHYSICAL_END,
+                                         option_rom_phys_addr);
+
+    printf("Option ROMs:\n");
+    if ( vgabios_sz )
+        printf(" %05x-%05x: VGA BIOS\n",
+               VGABIOS_PHYSICAL_ADDRESS,
+               VGABIOS_PHYSICAL_ADDRESS + vgabios_sz - 1);
+    if ( etherboot_sz )
+        printf(" %05x-%05x: Etherboot ROM\n",
+               etherboot_phys_addr,
+               etherboot_phys_addr + etherboot_sz - 1);
+    if ( option_rom_sz )
+        printf(" %05x-%05x: PCI Option ROMs\n",
+               option_rom_phys_addr,
+               option_rom_phys_addr + option_rom_sz - 1);
+}
+
 static void rombios_load(const struct bios_config *config)
 {
     uint32_t bioshigh;
@@ -158,10 +216,7 @@
 
     .bios_address = ROMBIOS_PHYSICAL_ADDRESS,
 
-    .load_roms = 1,
-
-    .optionrom_start = OPTIONROM_PHYSICAL_ADDRESS,
-    .optionrom_end = OPTIONROM_PHYSICAL_END,
+    .load_roms = rombios_load_roms,
 
     .bios_load = rombios_load,
 
diff -r ab47cfef2b0a -r e4d8d2524407 tools/firmware/hvmloader/seabios.c
--- a/tools/firmware/hvmloader/seabios.c	Mon Feb 13 12:49:06 2012 +0000
+++ b/tools/firmware/hvmloader/seabios.c	Mon Feb 13 12:50:04 2012 +0000
@@ -143,10 +143,7 @@
 
     .bios_address = SEABIOS_PHYSICAL_ADDRESS,
 
-    .load_roms = 0,
-
-    .optionrom_start = 0,
-    .optionrom_end = 0,
+    .load_roms = NULL,
 
     .bios_load = NULL,
 

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:29 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDX-0004zs-5n; Tue, 14 Feb 2012 23:55:27 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDV-0004yO-O3
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1329263590!52742705!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12142 invoked from network); 14 Feb 2012 23:53:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:53:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDT-0007iV-7l
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDT-0002Gw-60
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:23 +0000
Message-Id: <E1RxSDT-0002Gw-60@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:22 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: remove duplicate line
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Zhigang Wang <zhigang.x.wang@oracle.com>
# Date 1329152172 0
# Node ID 154b63ca7847a0c7a68acfab51e8929f197cbf23
# Parent  cbd7eab2d11208d30e7bd6a1f62791fe9675608f
xl: remove duplicate line

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r cbd7eab2d112 -r 154b63ca7847 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Mon Feb 13 14:33:10 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Mon Feb 13 16:56:12 2012 +0000
@@ -756,8 +756,6 @@
 
         xlu_cfg_replace_string (config, "kernel", &b_info->u.pv.kernel.path, 0);
 
-        xlu_cfg_replace_string (config, "kernel", &b_info->u.pv.kernel.path, 0);
-
         xlu_cfg_get_string (config, "root", &root, 0);
         xlu_cfg_get_string (config, "extra", &extra, 0);
 

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:29 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDX-0004zs-5n; Tue, 14 Feb 2012 23:55:27 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDV-0004yO-O3
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1329263590!52742705!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12142 invoked from network); 14 Feb 2012 23:53:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:53:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDT-0007iV-7l
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDT-0002Gw-60
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:23 +0000
Message-Id: <E1RxSDT-0002Gw-60@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:22 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: remove duplicate line
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Zhigang Wang <zhigang.x.wang@oracle.com>
# Date 1329152172 0
# Node ID 154b63ca7847a0c7a68acfab51e8929f197cbf23
# Parent  cbd7eab2d11208d30e7bd6a1f62791fe9675608f
xl: remove duplicate line

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r cbd7eab2d112 -r 154b63ca7847 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Mon Feb 13 14:33:10 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Mon Feb 13 16:56:12 2012 +0000
@@ -756,8 +756,6 @@
 
         xlu_cfg_replace_string (config, "kernel", &b_info->u.pv.kernel.path, 0);
 
-        xlu_cfg_replace_string (config, "kernel", &b_info->u.pv.kernel.path, 0);
-
         xlu_cfg_get_string (config, "root", &root, 0);
         xlu_cfg_get_string (config, "extra", &extra, 0);
 

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:30 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDY-00051N-Dn; Tue, 14 Feb 2012 23:55:28 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDX-0004yn-6d
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:27 +0000
Received: from [85.158.139.83:49475] by server-9.bemta-5.messagelabs.com id
	05/B9-30171-E64FA3F4; Tue, 14 Feb 2012 23:55:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-182.messagelabs.com!1329263724!15080964!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30956 invoked from network); 14 Feb 2012 23:55:25 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:25 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDU-0007ie-FD
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:24 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDU-0002Hl-Dm
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:24 +0000
Message-Id: <E1RxSDU-0002Hl-Dm@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:23 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] QEMU_TAG update
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329152624 0
# Node ID 7fd8f10cfd3eaf9f0982eb6fd49334a1e229ba98
# Parent  c04194934a3ec5818bac53e3175a94d60b703c16
QEMU_TAG update
---


diff -r c04194934a3e -r 7fd8f10cfd3e Config.mk
--- a/Config.mk	Mon Feb 13 16:57:53 2012 +0000
+++ b/Config.mk	Mon Feb 13 17:03:44 2012 +0000
@@ -232,9 +232,9 @@
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= 8cc8a3651c9c5bc2d0086d12f4b870fc525b9387
-# Tue Feb 7 18:42:56 2012 +0000
-# qemu-dm: fix unregister_iomem()
+QEMU_TAG ?= 414b878e8ea17c65cd0d7f9dfc38dba472857f74
+# Mon Feb 13 17:00:13 2012 +0000
+# qemu: Don't access /proc/bus/pci unless graphics pass-thru is enabled
 
 # 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 Tue Feb 14 23:55:30 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDY-00051N-Dn; Tue, 14 Feb 2012 23:55:28 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDX-0004yn-6d
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:27 +0000
Received: from [85.158.139.83:49475] by server-9.bemta-5.messagelabs.com id
	05/B9-30171-E64FA3F4; Tue, 14 Feb 2012 23:55:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-182.messagelabs.com!1329263724!15080964!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30956 invoked from network); 14 Feb 2012 23:55:25 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:25 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDU-0007ie-FD
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:24 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDU-0002Hl-Dm
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:24 +0000
Message-Id: <E1RxSDU-0002Hl-Dm@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:23 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] QEMU_TAG update
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329152624 0
# Node ID 7fd8f10cfd3eaf9f0982eb6fd49334a1e229ba98
# Parent  c04194934a3ec5818bac53e3175a94d60b703c16
QEMU_TAG update
---


diff -r c04194934a3e -r 7fd8f10cfd3e Config.mk
--- a/Config.mk	Mon Feb 13 16:57:53 2012 +0000
+++ b/Config.mk	Mon Feb 13 17:03:44 2012 +0000
@@ -232,9 +232,9 @@
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= 8cc8a3651c9c5bc2d0086d12f4b870fc525b9387
-# Tue Feb 7 18:42:56 2012 +0000
-# qemu-dm: fix unregister_iomem()
+QEMU_TAG ?= 414b878e8ea17c65cd0d7f9dfc38dba472857f74
+# Mon Feb 13 17:00:13 2012 +0000
+# qemu: Don't access /proc/bus/pci unless graphics pass-thru is enabled
 
 # 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 Tue Feb 14 23:55:30 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDY-00051D-BC; Tue, 14 Feb 2012 23:55:28 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDW-0004yn-B1
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:26 +0000
Received: from [85.158.139.83:49458] by server-9.bemta-5.messagelabs.com id
	03/B9-30171-D64FA3F4; Tue, 14 Feb 2012 23:55:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-182.messagelabs.com!1329263723!15080960!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30836 invoked from network); 14 Feb 2012 23:55:24 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDS-0007iR-K6
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:22 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDS-0002GY-Ie
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:22 +0000
Message-Id: <E1RxSDS-0002GY-Ie@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: setup MM using information from
	the device tree
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329143590 0
# Node ID cbd7eab2d11208d30e7bd6a1f62791fe9675608f
# Parent  40879997c29fa71c2de3ccb67995c01c1a6daf10
arm: setup MM using information from the device tree

Setup memory management, heaps etc. using the location and size of the
first memory bank given in the device tree.

The DTB is also copied so it can be used afterwards.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 40879997c29f -r cbd7eab2d112 xen/arch/arm/kernel.c
--- a/xen/arch/arm/kernel.c	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/arch/arm/kernel.c	Mon Feb 13 14:33:10 2012 +0000
@@ -11,6 +11,7 @@
 #include <xen/domain_page.h>
 #include <xen/sched.h>
 #include <asm/byteorder.h>
+#include <asm/setup.h>
 
 #include "kernel.h"
 
@@ -32,25 +33,28 @@
 
 #define DTB_MAGIC 0xd00dfeed
 
-static void copy_from_flash(void *dst, paddr_t flash, unsigned long len)
+/**
+ * copy_from_paddr - copy data from a physical address
+ * @dst: destination virtual address
+ * @paddr: source physical address
+ * @len: length to copy
+ */
+void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len)
 {
     void *src = (void *)FIXMAP_ADDR(FIXMAP_MISC);
 
-    printk("Copying %#lx bytes from flash %"PRIpaddr" to %p",
-           len, flash, dst);
-
     while (len) {
         paddr_t p;
         unsigned long l, s;
 
-        p = flash >> PAGE_SHIFT;
-        s = flash & (PAGE_SIZE-1);
+        p = paddr >> PAGE_SHIFT;
+        s = paddr & (PAGE_SIZE-1);
         l = min(PAGE_SIZE - s, len);
 
         set_fixmap(FIXMAP_MISC, p, DEV_SHARED);
         memcpy(dst, src + s, l);
 
-        flash += l;
+        paddr += l;
         dst += l;
         len -= l;
     }
@@ -108,7 +112,7 @@
     /*
      * Check for an appended DTB.
      */
-    copy_from_flash(&dtb_hdr, KERNEL_FLASH_ADDRESS + end - start, sizeof(dtb_hdr));
+    copy_from_paddr(&dtb_hdr, KERNEL_FLASH_ADDRESS + end - start, sizeof(dtb_hdr));
     if (be32_to_cpu(dtb_hdr.magic) == DTB_MAGIC) {
         end += be32_to_cpu(dtb_hdr.total_size);
     }
@@ -150,7 +154,7 @@
     if ( info->kernel_img == NULL )
         panic("Cannot allocate temporary buffer for kernel.\n");
 
-    copy_from_flash(info->kernel_img, KERNEL_FLASH_ADDRESS, KERNEL_FLASH_SIZE);
+    copy_from_paddr(info->kernel_img, KERNEL_FLASH_ADDRESS, KERNEL_FLASH_SIZE);
 
     if ( (rc = elf_init(&info->elf.elf, info->kernel_img, KERNEL_FLASH_SIZE )) != 0 )
         return rc;
diff -r 40879997c29f -r cbd7eab2d112 xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/arch/arm/mm.c	Mon Feb 13 14:33:10 2012 +0000
@@ -39,6 +39,7 @@
 unsigned long xenheap_mfn_start, xenheap_mfn_end;
 unsigned long xenheap_virt_end;
 
+unsigned long frametable_base_mfn;
 unsigned long frametable_virt_end;
 
 /* Map a 4k page in a fixmap entry */
@@ -301,6 +302,8 @@
     unsigned long frametable_size = nr_pages * sizeof(struct page_info);
     unsigned long base_mfn;
 
+    frametable_base_mfn = ps >> PAGE_SHIFT;
+
     /* Round up to 32M boundary */
     frametable_size = (frametable_size + 0x1ffffff) & ~0x1ffffff;
     base_mfn = alloc_boot_pages(frametable_size >> PAGE_SHIFT, 5);
diff -r 40879997c29f -r cbd7eab2d112 xen/arch/arm/setup.c
--- a/xen/arch/arm/setup.c	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/arch/arm/setup.c	Mon Feb 13 14:33:10 2012 +0000
@@ -64,17 +64,90 @@
         /* TODO: setup_idle_pagetable(); */
 }
 
+static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size)
+{
+    paddr_t ram_start;
+    paddr_t ram_end;
+    paddr_t ram_size;
+    unsigned long ram_pages;
+    unsigned long heap_pages, xenheap_pages, domheap_pages;
+    unsigned long dtb_pages;
+    unsigned long boot_mfn_start, boot_mfn_end;
+
+    /*
+     * TODO: only using the first RAM bank for now.  The heaps and the
+     * frame table assume RAM is physically contiguous.
+     */
+    ram_start = early_info.mem.bank[0].start;
+    ram_size  = early_info.mem.bank[0].size;
+    ram_end = ram_start + ram_size;
+    ram_pages = ram_size >> PAGE_SHIFT;
+
+    /*
+     * Calculate the sizes for the heaps using these constraints:
+     *
+     *  - heaps must be 32 MiB aligned
+     *  - must not include Xen itself
+     *  - xen heap must be at most 1 GiB
+     *
+     * XXX: needs a platform with at least 1GiB of RAM or the dom
+     * heap will be empty and no domains can be created.
+     */
+    heap_pages = (ram_size >> PAGE_SHIFT) - (32 << (20 - PAGE_SHIFT));
+    xenheap_pages = min(1ul << (30 - PAGE_SHIFT), heap_pages);
+    domheap_pages = heap_pages - xenheap_pages;
+
+    printk("Xen heap: %lu pages  Dom heap: %lu pages\n", xenheap_pages, domheap_pages);
+
+    setup_xenheap_mappings(ram_start >> PAGE_SHIFT, xenheap_pages);
+
+    /*
+     * Need a single mapped page for populating bootmem_region_list
+     * and enough mapped pages for copying the DTB.
+     *
+     * TODO: The DTB (and other payloads) are assumed to be towards
+     * the start of RAM.
+     */
+    dtb_pages = (dtb_size + PAGE_SIZE-1) >> PAGE_SHIFT;
+    boot_mfn_start = xenheap_mfn_end - dtb_pages - 1;
+    boot_mfn_end = xenheap_mfn_end;
+
+    init_boot_pages(pfn_to_paddr(boot_mfn_start), pfn_to_paddr(boot_mfn_end));
+
+    /*
+     * Copy the DTB.
+     *
+     * TODO: handle other payloads too.
+     */
+    device_tree_flattened = mfn_to_virt(alloc_boot_pages(dtb_pages, 1));
+    copy_from_paddr(device_tree_flattened, dtb_paddr, dtb_size);
+
+    /* Add non-xenheap memory */
+    init_boot_pages(pfn_to_paddr(xenheap_mfn_start + xenheap_pages),
+                    pfn_to_paddr(xenheap_mfn_start + xenheap_pages + domheap_pages));
+
+    setup_frametable_mappings(ram_start, ram_end);
+
+    /* Add xenheap memory that was not already added to the boot
+       allocator. */
+    init_xenheap_pages(pfn_to_paddr(xenheap_mfn_start),
+                       pfn_to_paddr(boot_mfn_start));
+
+    end_boot_allocator();
+}
+
 void __init start_xen(unsigned long boot_phys_offset,
                       unsigned long arm_type,
                       unsigned long atag_paddr)
 
 {
     void *fdt;
+    size_t fdt_size;
     int i;
 
     fdt = (void *)BOOT_MISC_VIRT_START
         + (atag_paddr & ((1 << SECOND_SHIFT) - 1));
-    device_tree_early_init(fdt);
+    fdt_size = device_tree_early_init(fdt);
 
     setup_pagetables(boot_phys_offset);
 
@@ -98,28 +171,7 @@
 
     init_xen_time();
 
-    /* TODO: This needs some thought, as well as device-tree mapping.
-     * For testing, assume that the whole xenheap is contiguous in RAM */
-    setup_xenheap_mappings(0x8000000, 0x40000); /* 1 GB @ 512GB */
-    /* Must pass a single mapped page for populating bootmem_region_list. */
-    init_boot_pages(pfn_to_paddr(xenheap_mfn_start),
-                    pfn_to_paddr(xenheap_mfn_start+1));
-
-    /* Add non-xenheap memory */
-    init_boot_pages(0x8040000000, 0x80c0000000); /* 2 GB @513GB */
-
-    /* TODO Make sure Xen's own pages aren't added
-     *     -- the memory above doesn't include our relocation target.  */
-    /* TODO Handle payloads too */
-
-    /* TODO Need to find actual memory, for now use 4GB at 512GB */
-    setup_frametable_mappings(0x8000000000ULL, 0x8100000000UL);
-
-    /* Add xenheap memory */
-    init_xenheap_pages(pfn_to_paddr(xenheap_mfn_start+1),
-                       pfn_to_paddr(xenheap_mfn_end));
-
-    end_boot_allocator();
+    setup_mm(atag_paddr, fdt_size);
 
     /* Setup Hyp vector base */
     WRITE_CP32((uint32_t) hyp_traps_vector, HVBAR);
diff -r 40879997c29f -r cbd7eab2d112 xen/common/device_tree.c
--- a/xen/common/device_tree.c	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/common/device_tree.c	Mon Feb 13 14:33:10 2012 +0000
@@ -22,6 +22,7 @@
 #include <libfdt.h>
 
 struct dt_early_info __initdata early_info;
+void *device_tree_flattened;
 
 static void __init get_val(const u32 **cell, u32 cells, u64 *val)
 {
@@ -126,8 +127,10 @@
 /**
  * device_tree_early_init - initialize early info from a DTB
  * @fdt: flattened device tree binary
+ *
+ * Returns the size of the DTB.
  */
-void __init device_tree_early_init(const void *fdt)
+size_t __init device_tree_early_init(const void *fdt)
 {
     int ret;
 
@@ -137,6 +140,8 @@
 
     early_scan(fdt);
     early_print_info();
+
+    return fdt_totalsize(fdt);
 }
 
 /**
diff -r 40879997c29f -r cbd7eab2d112 xen/include/asm-arm/mm.h
--- a/xen/include/asm-arm/mm.h	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/include/asm-arm/mm.h	Mon Feb 13 14:33:10 2012 +0000
@@ -128,6 +128,8 @@
     struct page_info *page, int readonly);
 
 #define frame_table ((struct page_info *)FRAMETABLE_VIRT_START)
+/* MFN of the first page in the frame table. */
+extern unsigned long frametable_base_mfn;
 
 extern unsigned long max_page;
 extern unsigned long total_pages;
@@ -151,15 +153,14 @@
 })
 
 #define max_pdx                 max_page
-/* XXX Assume everything in the 40-bit physical alias 0x8000000000 for now */
-#define pfn_to_pdx(pfn)         ((pfn) - 0x8000000UL)
-#define pdx_to_pfn(pdx)         ((pdx) + 0x8000000UL)
+#define pfn_to_pdx(pfn)         (pfn)
+#define pdx_to_pfn(pdx)         (pdx)
 #define virt_to_pdx(va)         virt_to_mfn(va)
 #define pdx_to_virt(pdx)        mfn_to_virt(pdx)
 
 /* Convert between machine frame numbers and page-info structures. */
-#define mfn_to_page(mfn)  (frame_table + pfn_to_pdx(mfn))
-#define page_to_mfn(pg)   pdx_to_pfn((unsigned long)((pg) - frame_table))
+#define mfn_to_page(mfn)  (frame_table + (pfn_to_pdx(mfn) - frametable_base_mfn))
+#define page_to_mfn(pg)   pdx_to_pfn((unsigned long)((pg) - frame_table) + frametable_base_mfn)
 #define __page_to_mfn(pg)  page_to_mfn(pg)
 #define __mfn_to_page(mfn) mfn_to_page(mfn)
 
diff -r 40879997c29f -r cbd7eab2d112 xen/include/asm-arm/setup.h
--- a/xen/include/asm-arm/setup.h	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/include/asm-arm/setup.h	Mon Feb 13 14:33:10 2012 +0000
@@ -3,6 +3,8 @@
 
 #include <public/version.h>
 
+void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len);
+
 void arch_get_xen_caps(xen_capabilities_info_t *info);
 
 int construct_dom0(struct domain *d);
diff -r 40879997c29f -r cbd7eab2d112 xen/include/xen/device_tree.h
--- a/xen/include/xen/device_tree.h	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/include/xen/device_tree.h	Mon Feb 13 14:33:10 2012 +0000
@@ -29,8 +29,9 @@
 };
 
 extern struct dt_early_info early_info;
+extern void *device_tree_flattened;
 
-void device_tree_early_init(const void *fdt);
+size_t device_tree_early_init(const void *fdt);
 paddr_t device_tree_get_xen_paddr(void);
 
 #endif

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:30 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDY-00051D-BC; Tue, 14 Feb 2012 23:55:28 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDW-0004yn-B1
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:26 +0000
Received: from [85.158.139.83:49458] by server-9.bemta-5.messagelabs.com id
	03/B9-30171-D64FA3F4; Tue, 14 Feb 2012 23:55:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-182.messagelabs.com!1329263723!15080960!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30836 invoked from network); 14 Feb 2012 23:55:24 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDS-0007iR-K6
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:22 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDS-0002GY-Ie
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:22 +0000
Message-Id: <E1RxSDS-0002GY-Ie@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: setup MM using information from
	the device tree
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329143590 0
# Node ID cbd7eab2d11208d30e7bd6a1f62791fe9675608f
# Parent  40879997c29fa71c2de3ccb67995c01c1a6daf10
arm: setup MM using information from the device tree

Setup memory management, heaps etc. using the location and size of the
first memory bank given in the device tree.

The DTB is also copied so it can be used afterwards.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 40879997c29f -r cbd7eab2d112 xen/arch/arm/kernel.c
--- a/xen/arch/arm/kernel.c	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/arch/arm/kernel.c	Mon Feb 13 14:33:10 2012 +0000
@@ -11,6 +11,7 @@
 #include <xen/domain_page.h>
 #include <xen/sched.h>
 #include <asm/byteorder.h>
+#include <asm/setup.h>
 
 #include "kernel.h"
 
@@ -32,25 +33,28 @@
 
 #define DTB_MAGIC 0xd00dfeed
 
-static void copy_from_flash(void *dst, paddr_t flash, unsigned long len)
+/**
+ * copy_from_paddr - copy data from a physical address
+ * @dst: destination virtual address
+ * @paddr: source physical address
+ * @len: length to copy
+ */
+void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len)
 {
     void *src = (void *)FIXMAP_ADDR(FIXMAP_MISC);
 
-    printk("Copying %#lx bytes from flash %"PRIpaddr" to %p",
-           len, flash, dst);
-
     while (len) {
         paddr_t p;
         unsigned long l, s;
 
-        p = flash >> PAGE_SHIFT;
-        s = flash & (PAGE_SIZE-1);
+        p = paddr >> PAGE_SHIFT;
+        s = paddr & (PAGE_SIZE-1);
         l = min(PAGE_SIZE - s, len);
 
         set_fixmap(FIXMAP_MISC, p, DEV_SHARED);
         memcpy(dst, src + s, l);
 
-        flash += l;
+        paddr += l;
         dst += l;
         len -= l;
     }
@@ -108,7 +112,7 @@
     /*
      * Check for an appended DTB.
      */
-    copy_from_flash(&dtb_hdr, KERNEL_FLASH_ADDRESS + end - start, sizeof(dtb_hdr));
+    copy_from_paddr(&dtb_hdr, KERNEL_FLASH_ADDRESS + end - start, sizeof(dtb_hdr));
     if (be32_to_cpu(dtb_hdr.magic) == DTB_MAGIC) {
         end += be32_to_cpu(dtb_hdr.total_size);
     }
@@ -150,7 +154,7 @@
     if ( info->kernel_img == NULL )
         panic("Cannot allocate temporary buffer for kernel.\n");
 
-    copy_from_flash(info->kernel_img, KERNEL_FLASH_ADDRESS, KERNEL_FLASH_SIZE);
+    copy_from_paddr(info->kernel_img, KERNEL_FLASH_ADDRESS, KERNEL_FLASH_SIZE);
 
     if ( (rc = elf_init(&info->elf.elf, info->kernel_img, KERNEL_FLASH_SIZE )) != 0 )
         return rc;
diff -r 40879997c29f -r cbd7eab2d112 xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/arch/arm/mm.c	Mon Feb 13 14:33:10 2012 +0000
@@ -39,6 +39,7 @@
 unsigned long xenheap_mfn_start, xenheap_mfn_end;
 unsigned long xenheap_virt_end;
 
+unsigned long frametable_base_mfn;
 unsigned long frametable_virt_end;
 
 /* Map a 4k page in a fixmap entry */
@@ -301,6 +302,8 @@
     unsigned long frametable_size = nr_pages * sizeof(struct page_info);
     unsigned long base_mfn;
 
+    frametable_base_mfn = ps >> PAGE_SHIFT;
+
     /* Round up to 32M boundary */
     frametable_size = (frametable_size + 0x1ffffff) & ~0x1ffffff;
     base_mfn = alloc_boot_pages(frametable_size >> PAGE_SHIFT, 5);
diff -r 40879997c29f -r cbd7eab2d112 xen/arch/arm/setup.c
--- a/xen/arch/arm/setup.c	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/arch/arm/setup.c	Mon Feb 13 14:33:10 2012 +0000
@@ -64,17 +64,90 @@
         /* TODO: setup_idle_pagetable(); */
 }
 
+static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size)
+{
+    paddr_t ram_start;
+    paddr_t ram_end;
+    paddr_t ram_size;
+    unsigned long ram_pages;
+    unsigned long heap_pages, xenheap_pages, domheap_pages;
+    unsigned long dtb_pages;
+    unsigned long boot_mfn_start, boot_mfn_end;
+
+    /*
+     * TODO: only using the first RAM bank for now.  The heaps and the
+     * frame table assume RAM is physically contiguous.
+     */
+    ram_start = early_info.mem.bank[0].start;
+    ram_size  = early_info.mem.bank[0].size;
+    ram_end = ram_start + ram_size;
+    ram_pages = ram_size >> PAGE_SHIFT;
+
+    /*
+     * Calculate the sizes for the heaps using these constraints:
+     *
+     *  - heaps must be 32 MiB aligned
+     *  - must not include Xen itself
+     *  - xen heap must be at most 1 GiB
+     *
+     * XXX: needs a platform with at least 1GiB of RAM or the dom
+     * heap will be empty and no domains can be created.
+     */
+    heap_pages = (ram_size >> PAGE_SHIFT) - (32 << (20 - PAGE_SHIFT));
+    xenheap_pages = min(1ul << (30 - PAGE_SHIFT), heap_pages);
+    domheap_pages = heap_pages - xenheap_pages;
+
+    printk("Xen heap: %lu pages  Dom heap: %lu pages\n", xenheap_pages, domheap_pages);
+
+    setup_xenheap_mappings(ram_start >> PAGE_SHIFT, xenheap_pages);
+
+    /*
+     * Need a single mapped page for populating bootmem_region_list
+     * and enough mapped pages for copying the DTB.
+     *
+     * TODO: The DTB (and other payloads) are assumed to be towards
+     * the start of RAM.
+     */
+    dtb_pages = (dtb_size + PAGE_SIZE-1) >> PAGE_SHIFT;
+    boot_mfn_start = xenheap_mfn_end - dtb_pages - 1;
+    boot_mfn_end = xenheap_mfn_end;
+
+    init_boot_pages(pfn_to_paddr(boot_mfn_start), pfn_to_paddr(boot_mfn_end));
+
+    /*
+     * Copy the DTB.
+     *
+     * TODO: handle other payloads too.
+     */
+    device_tree_flattened = mfn_to_virt(alloc_boot_pages(dtb_pages, 1));
+    copy_from_paddr(device_tree_flattened, dtb_paddr, dtb_size);
+
+    /* Add non-xenheap memory */
+    init_boot_pages(pfn_to_paddr(xenheap_mfn_start + xenheap_pages),
+                    pfn_to_paddr(xenheap_mfn_start + xenheap_pages + domheap_pages));
+
+    setup_frametable_mappings(ram_start, ram_end);
+
+    /* Add xenheap memory that was not already added to the boot
+       allocator. */
+    init_xenheap_pages(pfn_to_paddr(xenheap_mfn_start),
+                       pfn_to_paddr(boot_mfn_start));
+
+    end_boot_allocator();
+}
+
 void __init start_xen(unsigned long boot_phys_offset,
                       unsigned long arm_type,
                       unsigned long atag_paddr)
 
 {
     void *fdt;
+    size_t fdt_size;
     int i;
 
     fdt = (void *)BOOT_MISC_VIRT_START
         + (atag_paddr & ((1 << SECOND_SHIFT) - 1));
-    device_tree_early_init(fdt);
+    fdt_size = device_tree_early_init(fdt);
 
     setup_pagetables(boot_phys_offset);
 
@@ -98,28 +171,7 @@
 
     init_xen_time();
 
-    /* TODO: This needs some thought, as well as device-tree mapping.
-     * For testing, assume that the whole xenheap is contiguous in RAM */
-    setup_xenheap_mappings(0x8000000, 0x40000); /* 1 GB @ 512GB */
-    /* Must pass a single mapped page for populating bootmem_region_list. */
-    init_boot_pages(pfn_to_paddr(xenheap_mfn_start),
-                    pfn_to_paddr(xenheap_mfn_start+1));
-
-    /* Add non-xenheap memory */
-    init_boot_pages(0x8040000000, 0x80c0000000); /* 2 GB @513GB */
-
-    /* TODO Make sure Xen's own pages aren't added
-     *     -- the memory above doesn't include our relocation target.  */
-    /* TODO Handle payloads too */
-
-    /* TODO Need to find actual memory, for now use 4GB at 512GB */
-    setup_frametable_mappings(0x8000000000ULL, 0x8100000000UL);
-
-    /* Add xenheap memory */
-    init_xenheap_pages(pfn_to_paddr(xenheap_mfn_start+1),
-                       pfn_to_paddr(xenheap_mfn_end));
-
-    end_boot_allocator();
+    setup_mm(atag_paddr, fdt_size);
 
     /* Setup Hyp vector base */
     WRITE_CP32((uint32_t) hyp_traps_vector, HVBAR);
diff -r 40879997c29f -r cbd7eab2d112 xen/common/device_tree.c
--- a/xen/common/device_tree.c	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/common/device_tree.c	Mon Feb 13 14:33:10 2012 +0000
@@ -22,6 +22,7 @@
 #include <libfdt.h>
 
 struct dt_early_info __initdata early_info;
+void *device_tree_flattened;
 
 static void __init get_val(const u32 **cell, u32 cells, u64 *val)
 {
@@ -126,8 +127,10 @@
 /**
  * device_tree_early_init - initialize early info from a DTB
  * @fdt: flattened device tree binary
+ *
+ * Returns the size of the DTB.
  */
-void __init device_tree_early_init(const void *fdt)
+size_t __init device_tree_early_init(const void *fdt)
 {
     int ret;
 
@@ -137,6 +140,8 @@
 
     early_scan(fdt);
     early_print_info();
+
+    return fdt_totalsize(fdt);
 }
 
 /**
diff -r 40879997c29f -r cbd7eab2d112 xen/include/asm-arm/mm.h
--- a/xen/include/asm-arm/mm.h	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/include/asm-arm/mm.h	Mon Feb 13 14:33:10 2012 +0000
@@ -128,6 +128,8 @@
     struct page_info *page, int readonly);
 
 #define frame_table ((struct page_info *)FRAMETABLE_VIRT_START)
+/* MFN of the first page in the frame table. */
+extern unsigned long frametable_base_mfn;
 
 extern unsigned long max_page;
 extern unsigned long total_pages;
@@ -151,15 +153,14 @@
 })
 
 #define max_pdx                 max_page
-/* XXX Assume everything in the 40-bit physical alias 0x8000000000 for now */
-#define pfn_to_pdx(pfn)         ((pfn) - 0x8000000UL)
-#define pdx_to_pfn(pdx)         ((pdx) + 0x8000000UL)
+#define pfn_to_pdx(pfn)         (pfn)
+#define pdx_to_pfn(pdx)         (pdx)
 #define virt_to_pdx(va)         virt_to_mfn(va)
 #define pdx_to_virt(pdx)        mfn_to_virt(pdx)
 
 /* Convert between machine frame numbers and page-info structures. */
-#define mfn_to_page(mfn)  (frame_table + pfn_to_pdx(mfn))
-#define page_to_mfn(pg)   pdx_to_pfn((unsigned long)((pg) - frame_table))
+#define mfn_to_page(mfn)  (frame_table + (pfn_to_pdx(mfn) - frametable_base_mfn))
+#define page_to_mfn(pg)   pdx_to_pfn((unsigned long)((pg) - frame_table) + frametable_base_mfn)
 #define __page_to_mfn(pg)  page_to_mfn(pg)
 #define __mfn_to_page(mfn) mfn_to_page(mfn)
 
diff -r 40879997c29f -r cbd7eab2d112 xen/include/asm-arm/setup.h
--- a/xen/include/asm-arm/setup.h	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/include/asm-arm/setup.h	Mon Feb 13 14:33:10 2012 +0000
@@ -3,6 +3,8 @@
 
 #include <public/version.h>
 
+void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len);
+
 void arch_get_xen_caps(xen_capabilities_info_t *info);
 
 int construct_dom0(struct domain *d);
diff -r 40879997c29f -r cbd7eab2d112 xen/include/xen/device_tree.h
--- a/xen/include/xen/device_tree.h	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/include/xen/device_tree.h	Mon Feb 13 14:33:10 2012 +0000
@@ -29,8 +29,9 @@
 };
 
 extern struct dt_early_info early_info;
+extern void *device_tree_flattened;
 
-void device_tree_early_init(const void *fdt);
+size_t device_tree_early_init(const void *fdt);
 paddr_t device_tree_get_xen_paddr(void);
 
 #endif

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:30 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDZ-000543-Vr; Tue, 14 Feb 2012 23:55:29 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDZ-0004y0-7P
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:29 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1329263721!8746634!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28993 invoked from network); 14 Feb 2012 23:55:22 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:22 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDQ-0007iI-O4
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDQ-0002FM-Me
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:20 +0000
Message-Id: <E1RxSDQ-0002FM-Me@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: map device tree blob in initial
	page tables
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329143089 0
# Node ID 62c701cc8715dc259a127ee42b3fa4da313e61ee
# Parent  14a97085fbec0d3a87c584a1c2b268a4f61fc57c
arm: map device tree blob in initial page tables

Add a mapping for the device tree blob in the initial page tables.
This will allow the DTB to be parsed for memory information prior to
setting up the real page tables.

It is mapped into the first L2 slot after the fixmap.  When this slot
is reused in setup_pagetables(), flush the TLB.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 14a97085fbec -r 62c701cc8715 xen/arch/arm/head.S
--- a/xen/arch/arm/head.S	Mon Feb 13 14:24:48 2012 +0000
+++ b/xen/arch/arm/head.S	Mon Feb 13 14:24:49 2012 +0000
@@ -202,7 +202,16 @@
        orr   r2, r2, #0x071         /* r2:r3 := 2MB dev map including UART */
        add   r4, r4, #8
        strd  r2, r3, [r1, r4]       /* Map it in the fixmap's slot */
+#else
+       add   r4, r4, #8             /* Skip over unused fixmap slot */
 #endif
+       mov   r3, #0x0
+       lsr   r2, r8, #21
+       lsl   r2, r2, #21            /* 2MB-aligned paddr of DTB */
+       orr   r2, r2, #0xf00
+       orr   r2, r2, #0x07d         /* r2:r3 := 2MB RAM incl. DTB */
+       add   r4, r4, #8
+       strd  r2, r3, [r1, r4]       /* Map it in the early boot slot */
 
        PRINT("- Turning on paging -\r\n")
 
diff -r 14a97085fbec -r 62c701cc8715 xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c	Mon Feb 13 14:24:48 2012 +0000
+++ b/xen/arch/arm/mm.c	Mon Feb 13 14:24:49 2012 +0000
@@ -161,10 +161,11 @@
 
     xen_paddr = XEN_PADDR;
 
-    /* Map the destination in the empty L2 above the fixmap */
-    dest_va = FIXMAP_ADDR(0) + (1u << SECOND_SHIFT);
+    /* Map the destination in the boot misc area. */
+    dest_va = BOOT_MISC_VIRT_START;
     pte = mfn_to_xen_entry(xen_paddr >> PAGE_SHIFT);
     write_pte(xen_second + second_table_offset(dest_va), pte);
+    flush_xen_data_tlb_va(dest_va);
 
     /* Calculate virt-to-phys offset for the new location */
     phys_offset = xen_paddr - (unsigned long) _start;
diff -r 14a97085fbec -r 62c701cc8715 xen/include/asm-arm/config.h
--- a/xen/include/asm-arm/config.h	Mon Feb 13 14:24:48 2012 +0000
+++ b/xen/include/asm-arm/config.h	Mon Feb 13 14:24:49 2012 +0000
@@ -55,15 +55,21 @@
  *  0  -   2M   Unmapped
  *  2M -   4M   Xen text, data, bss
  *  4M -   6M   Fixmap: special-purpose 4K mapping slots
+ *  6M  -  8M   Early boot misc (see below)
  *
  * 32M - 128M   Frametable: 24 bytes per page for 16GB of RAM
  *
  *  1G -   2G   Xenheap: always-mapped memory
  *  2G -   4G   Domheap: on-demand-mapped
+ *
+ * The early boot misc area is used:
+ *   - in head.S for the DTB for device_tree_early_init().
+ *   - in setup_pagetables() when relocating Xen.
  */
 
 #define XEN_VIRT_START         0x00200000
 #define FIXMAP_ADDR(n)        (0x00400000 + (n) * PAGE_SIZE)
+#define BOOT_MISC_VIRT_START   0x00600000
 #define FRAMETABLE_VIRT_START  0x02000000
 #define XENHEAP_VIRT_START     0x40000000
 #define DOMHEAP_VIRT_START     0x80000000

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:30 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDZ-000543-Vr; Tue, 14 Feb 2012 23:55:29 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDZ-0004y0-7P
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:29 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1329263721!8746634!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28993 invoked from network); 14 Feb 2012 23:55:22 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:22 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDQ-0007iI-O4
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDQ-0002FM-Me
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:20 +0000
Message-Id: <E1RxSDQ-0002FM-Me@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: map device tree blob in initial
	page tables
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329143089 0
# Node ID 62c701cc8715dc259a127ee42b3fa4da313e61ee
# Parent  14a97085fbec0d3a87c584a1c2b268a4f61fc57c
arm: map device tree blob in initial page tables

Add a mapping for the device tree blob in the initial page tables.
This will allow the DTB to be parsed for memory information prior to
setting up the real page tables.

It is mapped into the first L2 slot after the fixmap.  When this slot
is reused in setup_pagetables(), flush the TLB.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 14a97085fbec -r 62c701cc8715 xen/arch/arm/head.S
--- a/xen/arch/arm/head.S	Mon Feb 13 14:24:48 2012 +0000
+++ b/xen/arch/arm/head.S	Mon Feb 13 14:24:49 2012 +0000
@@ -202,7 +202,16 @@
        orr   r2, r2, #0x071         /* r2:r3 := 2MB dev map including UART */
        add   r4, r4, #8
        strd  r2, r3, [r1, r4]       /* Map it in the fixmap's slot */
+#else
+       add   r4, r4, #8             /* Skip over unused fixmap slot */
 #endif
+       mov   r3, #0x0
+       lsr   r2, r8, #21
+       lsl   r2, r2, #21            /* 2MB-aligned paddr of DTB */
+       orr   r2, r2, #0xf00
+       orr   r2, r2, #0x07d         /* r2:r3 := 2MB RAM incl. DTB */
+       add   r4, r4, #8
+       strd  r2, r3, [r1, r4]       /* Map it in the early boot slot */
 
        PRINT("- Turning on paging -\r\n")
 
diff -r 14a97085fbec -r 62c701cc8715 xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c	Mon Feb 13 14:24:48 2012 +0000
+++ b/xen/arch/arm/mm.c	Mon Feb 13 14:24:49 2012 +0000
@@ -161,10 +161,11 @@
 
     xen_paddr = XEN_PADDR;
 
-    /* Map the destination in the empty L2 above the fixmap */
-    dest_va = FIXMAP_ADDR(0) + (1u << SECOND_SHIFT);
+    /* Map the destination in the boot misc area. */
+    dest_va = BOOT_MISC_VIRT_START;
     pte = mfn_to_xen_entry(xen_paddr >> PAGE_SHIFT);
     write_pte(xen_second + second_table_offset(dest_va), pte);
+    flush_xen_data_tlb_va(dest_va);
 
     /* Calculate virt-to-phys offset for the new location */
     phys_offset = xen_paddr - (unsigned long) _start;
diff -r 14a97085fbec -r 62c701cc8715 xen/include/asm-arm/config.h
--- a/xen/include/asm-arm/config.h	Mon Feb 13 14:24:48 2012 +0000
+++ b/xen/include/asm-arm/config.h	Mon Feb 13 14:24:49 2012 +0000
@@ -55,15 +55,21 @@
  *  0  -   2M   Unmapped
  *  2M -   4M   Xen text, data, bss
  *  4M -   6M   Fixmap: special-purpose 4K mapping slots
+ *  6M  -  8M   Early boot misc (see below)
  *
  * 32M - 128M   Frametable: 24 bytes per page for 16GB of RAM
  *
  *  1G -   2G   Xenheap: always-mapped memory
  *  2G -   4G   Domheap: on-demand-mapped
+ *
+ * The early boot misc area is used:
+ *   - in head.S for the DTB for device_tree_early_init().
+ *   - in setup_pagetables() when relocating Xen.
  */
 
 #define XEN_VIRT_START         0x00200000
 #define FIXMAP_ADDR(n)        (0x00400000 + (n) * PAGE_SIZE)
+#define BOOT_MISC_VIRT_START   0x00600000
 #define FRAMETABLE_VIRT_START  0x02000000
 #define XENHEAP_VIRT_START     0x40000000
 #define DOMHEAP_VIRT_START     0x80000000

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:30 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDa-00054E-2H; Tue, 14 Feb 2012 23:55:30 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDZ-0004ym-7l
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:29 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1329263684!52449940!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23254 invoked from network); 14 Feb 2012 23:54:45 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:54:45 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDT-0007ia-VN
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDT-0002HM-Qw
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:23 +0000
Message-Id: <E1RxSDT-0002HM-Qw@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:23 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: Add -F to usage for xl
	shutdown/reboot
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329152273 0
# Node ID c04194934a3ec5818bac53e3175a94d60b703c16
# Parent  154b63ca7847a0c7a68acfab51e8929f197cbf23
xl: Add -F to usage for xl shutdown/reboot

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


diff -r 154b63ca7847 -r c04194934a3e tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c	Mon Feb 13 16:56:12 2012 +0000
+++ b/tools/libxl/xl_cmdtable.c	Mon Feb 13 16:57:53 2012 +0000
@@ -48,12 +48,19 @@
     { "shutdown",
       &main_shutdown, 0,
       "Issue a shutdown signal to a domain",
-      "<Domain>",
+      "[options] <Domain>",
+      "-h                      Print this help.\n"
+      "-F                      Fallback to ACPI power event for HVM guests with\n"
+      "                        no PV drivers.\n"
+      "-w                      Wait for guest to shutdown.\n"
     },
     { "reboot",
       &main_reboot, 0,
       "Issue a reboot signal to a domain",
-      "<Domain>",
+      "[options] <Domain>",
+      "-h                      Print this help.\n"
+      "-F                      Fallback to ACPI reset event for HVM guests with\n"
+      "                        no PV drivers.\n"
     },
     { "pci-attach",
       &main_pciattach, 0,

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:30 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDa-00054E-2H; Tue, 14 Feb 2012 23:55:30 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDZ-0004ym-7l
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:29 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1329263684!52449940!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23254 invoked from network); 14 Feb 2012 23:54:45 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:54:45 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDT-0007ia-VN
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDT-0002HM-Qw
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:23 +0000
Message-Id: <E1RxSDT-0002HM-Qw@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:23 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: Add -F to usage for xl
	shutdown/reboot
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329152273 0
# Node ID c04194934a3ec5818bac53e3175a94d60b703c16
# Parent  154b63ca7847a0c7a68acfab51e8929f197cbf23
xl: Add -F to usage for xl shutdown/reboot

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


diff -r 154b63ca7847 -r c04194934a3e tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c	Mon Feb 13 16:56:12 2012 +0000
+++ b/tools/libxl/xl_cmdtable.c	Mon Feb 13 16:57:53 2012 +0000
@@ -48,12 +48,19 @@
     { "shutdown",
       &main_shutdown, 0,
       "Issue a shutdown signal to a domain",
-      "<Domain>",
+      "[options] <Domain>",
+      "-h                      Print this help.\n"
+      "-F                      Fallback to ACPI power event for HVM guests with\n"
+      "                        no PV drivers.\n"
+      "-w                      Wait for guest to shutdown.\n"
     },
     { "reboot",
       &main_reboot, 0,
       "Issue a reboot signal to a domain",
-      "<Domain>",
+      "[options] <Domain>",
+      "-h                      Print this help.\n"
+      "-F                      Fallback to ACPI reset event for HVM guests with\n"
+      "                        no PV drivers.\n"
     },
     { "pci-attach",
       &main_pciattach, 0,

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:30 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDY-00051X-H0; Tue, 14 Feb 2012 23:55:28 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDX-0004wb-7K
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:27 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1329263719!13181745!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10849 invoked from network); 14 Feb 2012 23:55:20 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDO-0007i9-O4
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDO-0002E8-LW
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:18 +0000
Message-Id: <E1RxSDO-0002E8-LW@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libfdt: add to build
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329140087 0
# Node ID 9207cc3a0862d925d0574834b6f56636bf05ea30
# Parent  e060d1bd7b60556fde01873aaaf3d8e4c298a5d2
libfdt: add to build

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r e060d1bd7b60 -r 9207cc3a0862 xen/arch/arm/Rules.mk
--- a/xen/arch/arm/Rules.mk	Mon Feb 13 13:34:08 2012 +0000
+++ b/xen/arch/arm/Rules.mk	Mon Feb 13 13:34:47 2012 +0000
@@ -6,6 +6,8 @@
 # 'make clean' before rebuilding.
 #
 
+HAS_DEVICE_TREE := y
+
 CFLAGS += -fno-builtin -fno-common -Wredundant-decls
 CFLAGS += -iwithprefix include -Werror -Wno-pointer-arith -pipe
 CFLAGS += -I$(BASEDIR)/include
diff -r e060d1bd7b60 -r 9207cc3a0862 xen/common/Makefile
--- a/xen/common/Makefile	Mon Feb 13 13:34:08 2012 +0000
+++ b/xen/common/Makefile	Mon Feb 13 13:34:47 2012 +0000
@@ -59,3 +59,4 @@
 subdir-$(ia64) += hvm
 
 subdir-y += libelf
+subdir-$(HAS_DEVICE_TREE) += libfdt
diff -r e060d1bd7b60 -r 9207cc3a0862 xen/common/libfdt/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/Makefile	Mon Feb 13 13:34:47 2012 +0000
@@ -0,0 +1,5 @@
+include Makefile.libfdt
+
+obj-y += $(LIBFDT_OBJS)
+
+CFLAGS += -I.

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:30 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDY-00051X-H0; Tue, 14 Feb 2012 23:55:28 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDX-0004wb-7K
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:27 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1329263719!13181745!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10849 invoked from network); 14 Feb 2012 23:55:20 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDO-0007i9-O4
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDO-0002E8-LW
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:18 +0000
Message-Id: <E1RxSDO-0002E8-LW@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libfdt: add to build
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329140087 0
# Node ID 9207cc3a0862d925d0574834b6f56636bf05ea30
# Parent  e060d1bd7b60556fde01873aaaf3d8e4c298a5d2
libfdt: add to build

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r e060d1bd7b60 -r 9207cc3a0862 xen/arch/arm/Rules.mk
--- a/xen/arch/arm/Rules.mk	Mon Feb 13 13:34:08 2012 +0000
+++ b/xen/arch/arm/Rules.mk	Mon Feb 13 13:34:47 2012 +0000
@@ -6,6 +6,8 @@
 # 'make clean' before rebuilding.
 #
 
+HAS_DEVICE_TREE := y
+
 CFLAGS += -fno-builtin -fno-common -Wredundant-decls
 CFLAGS += -iwithprefix include -Werror -Wno-pointer-arith -pipe
 CFLAGS += -I$(BASEDIR)/include
diff -r e060d1bd7b60 -r 9207cc3a0862 xen/common/Makefile
--- a/xen/common/Makefile	Mon Feb 13 13:34:08 2012 +0000
+++ b/xen/common/Makefile	Mon Feb 13 13:34:47 2012 +0000
@@ -59,3 +59,4 @@
 subdir-$(ia64) += hvm
 
 subdir-y += libelf
+subdir-$(HAS_DEVICE_TREE) += libfdt
diff -r e060d1bd7b60 -r 9207cc3a0862 xen/common/libfdt/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/Makefile	Mon Feb 13 13:34:47 2012 +0000
@@ -0,0 +1,5 @@
+include Makefile.libfdt
+
+obj-y += $(LIBFDT_OBJS)
+
+CFLAGS += -I.

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:30 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDZ-00053W-PM; Tue, 14 Feb 2012 23:55:29 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDX-0004wq-NW
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:27 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-174.messagelabs.com!1329263719!13401413!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21938 invoked from network); 14 Feb 2012 23:55:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDP-0007iC-GX
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDP-0002EY-Ez
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:19 +0000
Message-Id: <E1RxSDP-0002EY-Ez@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: few missing #define
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329143085 0
# Node ID 865d6bb72b5beac73b89dcacb8ea0fd29ed07c24
# Parent  9207cc3a0862d925d0574834b6f56636bf05ea30
arm: few missing #define

Few missing #define are the cause of a compile failure with
XEN_TARGET_ARM=arm and XEN_COMPILE_ARM=arm (for example in the case of a
native compilation). This patch fill the gaps.

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


diff -r 9207cc3a0862 -r 865d6bb72b5b xen/include/public/arch-arm.h
--- a/xen/include/public/arch-arm.h	Mon Feb 13 13:34:47 2012 +0000
+++ b/xen/include/public/arch-arm.h	Mon Feb 13 14:24:45 2012 +0000
@@ -110,6 +110,8 @@
 
 struct arch_shared_info { };
 typedef struct arch_shared_info arch_shared_info_t;
+typedef uint64_t xen_callback_t;
+
 #endif
 
 #endif /*  __XEN_PUBLIC_ARCH_ARM_H__ */
diff -r 9207cc3a0862 -r 865d6bb72b5b xen/include/public/io/protocols.h
--- a/xen/include/public/io/protocols.h	Mon Feb 13 13:34:47 2012 +0000
+++ b/xen/include/public/io/protocols.h	Mon Feb 13 14:24:45 2012 +0000
@@ -26,6 +26,7 @@
 #define XEN_IO_PROTO_ABI_X86_32     "x86_32-abi"
 #define XEN_IO_PROTO_ABI_X86_64     "x86_64-abi"
 #define XEN_IO_PROTO_ABI_IA64       "ia64-abi"
+#define XEN_IO_PROTO_ABI_ARM        "arm-abi"
 
 #if defined(__i386__)
 # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_32
@@ -33,6 +34,8 @@
 # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_64
 #elif defined(__ia64__)
 # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_IA64
+#elif defined(__arm__)
+# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_ARM
 #else
 # error arch fixup needed here
 #endif

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:30 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDZ-00053W-PM; Tue, 14 Feb 2012 23:55:29 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDX-0004wq-NW
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:27 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-174.messagelabs.com!1329263719!13401413!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21938 invoked from network); 14 Feb 2012 23:55:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDP-0007iC-GX
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDP-0002EY-Ez
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:19 +0000
Message-Id: <E1RxSDP-0002EY-Ez@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: few missing #define
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329143085 0
# Node ID 865d6bb72b5beac73b89dcacb8ea0fd29ed07c24
# Parent  9207cc3a0862d925d0574834b6f56636bf05ea30
arm: few missing #define

Few missing #define are the cause of a compile failure with
XEN_TARGET_ARM=arm and XEN_COMPILE_ARM=arm (for example in the case of a
native compilation). This patch fill the gaps.

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


diff -r 9207cc3a0862 -r 865d6bb72b5b xen/include/public/arch-arm.h
--- a/xen/include/public/arch-arm.h	Mon Feb 13 13:34:47 2012 +0000
+++ b/xen/include/public/arch-arm.h	Mon Feb 13 14:24:45 2012 +0000
@@ -110,6 +110,8 @@
 
 struct arch_shared_info { };
 typedef struct arch_shared_info arch_shared_info_t;
+typedef uint64_t xen_callback_t;
+
 #endif
 
 #endif /*  __XEN_PUBLIC_ARCH_ARM_H__ */
diff -r 9207cc3a0862 -r 865d6bb72b5b xen/include/public/io/protocols.h
--- a/xen/include/public/io/protocols.h	Mon Feb 13 13:34:47 2012 +0000
+++ b/xen/include/public/io/protocols.h	Mon Feb 13 14:24:45 2012 +0000
@@ -26,6 +26,7 @@
 #define XEN_IO_PROTO_ABI_X86_32     "x86_32-abi"
 #define XEN_IO_PROTO_ABI_X86_64     "x86_64-abi"
 #define XEN_IO_PROTO_ABI_IA64       "ia64-abi"
+#define XEN_IO_PROTO_ABI_ARM        "arm-abi"
 
 #if defined(__i386__)
 # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_32
@@ -33,6 +34,8 @@
 # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_64
 #elif defined(__ia64__)
 # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_IA64
+#elif defined(__arm__)
+# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_ARM
 #else
 # error arch fixup needed here
 #endif

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:31 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDZ-00053H-KO; Tue, 14 Feb 2012 23:55:29 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDX-0004zV-DQ
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:27 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1329263685!52449942!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23275 invoked from network); 14 Feb 2012 23:54:46 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:54:46 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDV-0007ih-0U
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:25 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDU-0002I7-VG
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:24 +0000
Message-Id: <E1RxSDU-0002I7-VG@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:24 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] blktap2/libvhd: Build shared objects
	using -fPIC.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329154190 0
# Node ID acf4ad70c87b502207a50d99840bf58c9b238fff
# Parent  7fd8f10cfd3eaf9f0982eb6fd49334a1e229ba98
blktap2/libvhd: Build shared objects using -fPIC.

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


diff -r 7fd8f10cfd3e -r acf4ad70c87b tools/blktap2/vhd/lib/Makefile
--- a/tools/blktap2/vhd/lib/Makefile	Mon Feb 13 17:03:44 2012 +0000
+++ b/tools/blktap2/vhd/lib/Makefile	Mon Feb 13 17:29:50 2012 +0000
@@ -49,27 +49,32 @@
 LIB-OBJS         = $(patsubst %.c,%.o,$(LIB-SRCS))
 LIB-OBJS        += $(LVM-UTIL-OBJ)
 
+LIB-PICOBJS      = $(patsubst %.o,%.opic,$(LIB-OBJS))
+
 LIBVHD           = libvhd.a libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR)
 
 all: build
 
-build: $(LIBVHD-BUILD)
+build: libvhd.a libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR)
 
 libvhd.a: $(LIB-OBJS)
+	$(AR) rc $@ $^
+
+libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR): $(LIB-PICOBJS)
 	$(CC) -Wl,$(SONAME_LDFLAG),$(LIBVHD-SONAME) $(SHLIB_LDFLAGS) \
 		$(LDFLAGS) -o libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) $^ $(LIBS)
 	ln -sf libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) libvhd.so.$(LIBVHD-MAJOR)
 	ln -sf libvhd.so.$(LIBVHD-MAJOR) libvhd.so
-	$(AR) rc $@ $^
 
 install: all
 	$(INSTALL_DIR) -p $(DESTDIR)$(INST-DIR)
-	$(INSTALL_PROG) $(LIBVHD) $(DESTDIR)$(INST-DIR)
+	$(INSTALL_PROG) libvhd.a $(DESTDIR)$(INST-DIR)
+	$(INSTALL_PROG) libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) $(DESTDIR)$(INST-DIR)
 	ln -sf libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) $(DESTDIR)$(INST-DIR)/libvhd.so.$(LIBVHD-MAJOR)
 	ln -sf libvhd.so.$(LIBVHD-MAJOR) $(DESTDIR)$(INST-DIR)/libvhd.so
 
 clean:
-	rm -rf *.a *.so* *.o *~ $(DEPS) $(LIBVHD)
+	rm -rf *.a *.so* *.o *.opic *~ $(DEPS) $(LIBVHD)
 
 .PHONY: all build clean install libvhd
 

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:31 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDZ-00053H-KO; Tue, 14 Feb 2012 23:55:29 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDX-0004zV-DQ
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:27 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1329263685!52449942!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23275 invoked from network); 14 Feb 2012 23:54:46 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:54:46 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDV-0007ih-0U
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:25 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDU-0002I7-VG
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:24 +0000
Message-Id: <E1RxSDU-0002I7-VG@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:24 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] blktap2/libvhd: Build shared objects
	using -fPIC.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329154190 0
# Node ID acf4ad70c87b502207a50d99840bf58c9b238fff
# Parent  7fd8f10cfd3eaf9f0982eb6fd49334a1e229ba98
blktap2/libvhd: Build shared objects using -fPIC.

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


diff -r 7fd8f10cfd3e -r acf4ad70c87b tools/blktap2/vhd/lib/Makefile
--- a/tools/blktap2/vhd/lib/Makefile	Mon Feb 13 17:03:44 2012 +0000
+++ b/tools/blktap2/vhd/lib/Makefile	Mon Feb 13 17:29:50 2012 +0000
@@ -49,27 +49,32 @@
 LIB-OBJS         = $(patsubst %.c,%.o,$(LIB-SRCS))
 LIB-OBJS        += $(LVM-UTIL-OBJ)
 
+LIB-PICOBJS      = $(patsubst %.o,%.opic,$(LIB-OBJS))
+
 LIBVHD           = libvhd.a libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR)
 
 all: build
 
-build: $(LIBVHD-BUILD)
+build: libvhd.a libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR)
 
 libvhd.a: $(LIB-OBJS)
+	$(AR) rc $@ $^
+
+libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR): $(LIB-PICOBJS)
 	$(CC) -Wl,$(SONAME_LDFLAG),$(LIBVHD-SONAME) $(SHLIB_LDFLAGS) \
 		$(LDFLAGS) -o libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) $^ $(LIBS)
 	ln -sf libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) libvhd.so.$(LIBVHD-MAJOR)
 	ln -sf libvhd.so.$(LIBVHD-MAJOR) libvhd.so
-	$(AR) rc $@ $^
 
 install: all
 	$(INSTALL_DIR) -p $(DESTDIR)$(INST-DIR)
-	$(INSTALL_PROG) $(LIBVHD) $(DESTDIR)$(INST-DIR)
+	$(INSTALL_PROG) libvhd.a $(DESTDIR)$(INST-DIR)
+	$(INSTALL_PROG) libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) $(DESTDIR)$(INST-DIR)
 	ln -sf libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) $(DESTDIR)$(INST-DIR)/libvhd.so.$(LIBVHD-MAJOR)
 	ln -sf libvhd.so.$(LIBVHD-MAJOR) $(DESTDIR)$(INST-DIR)/libvhd.so
 
 clean:
-	rm -rf *.a *.so* *.o *~ $(DEPS) $(LIBVHD)
+	rm -rf *.a *.so* *.o *.opic *~ $(DEPS) $(LIBVHD)
 
 .PHONY: all build clean install libvhd
 

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:32 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDb-00057A-CT; Tue, 14 Feb 2012 23:55:31 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDZ-00052g-Te
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:30 +0000
Received: from [85.158.139.83:49521] by server-1.bemta-5.messagelabs.com id
	50/72-28458-174FA3F4; Tue, 14 Feb 2012 23:55:29 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-182.messagelabs.com!1329263727!15088882!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9048 invoked from network); 14 Feb 2012 23:55:28 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:28 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDW-0007it-Le
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:26 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDW-0002JH-Jn
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:26 +0000
Message-Id: <E1RxSDW-0002JH-Jn@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:26 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: make qemu build use correct
	PYTHON version
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329157048 0
# Node ID f3d137e3e6c79ea9c66e7b224c9041404e753149
# Parent  60526e46625c20e5475fbf4f403dd164bb699037
tools: make qemu build use correct PYTHON version

Pass --python=$(PYTHON) to qemu's configure.
Fixes error:
Python not found. Use --python=/path/to/python

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 60526e46625c -r f3d137e3e6c7 tools/Makefile
--- a/tools/Makefile	Mon Feb 13 17:45:13 2012 +0000
+++ b/tools/Makefile	Mon Feb 13 18:17:28 2012 +0000
@@ -155,6 +155,7 @@
 		-L$(XEN_ROOT)/tools/xenstore" \
 		--bindir=$(LIBEXEC) \
 		--disable-kvm \
+		--python=$(PYTHON) \
 		$(IOEMU_CONFIGURE_CROSS); \
 	$(MAKE) install
 

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:32 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDb-00057A-CT; Tue, 14 Feb 2012 23:55:31 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDZ-00052g-Te
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:30 +0000
Received: from [85.158.139.83:49521] by server-1.bemta-5.messagelabs.com id
	50/72-28458-174FA3F4; Tue, 14 Feb 2012 23:55:29 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-182.messagelabs.com!1329263727!15088882!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9048 invoked from network); 14 Feb 2012 23:55:28 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:28 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDW-0007it-Le
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:26 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDW-0002JH-Jn
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:26 +0000
Message-Id: <E1RxSDW-0002JH-Jn@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:26 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: make qemu build use correct
	PYTHON version
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329157048 0
# Node ID f3d137e3e6c79ea9c66e7b224c9041404e753149
# Parent  60526e46625c20e5475fbf4f403dd164bb699037
tools: make qemu build use correct PYTHON version

Pass --python=$(PYTHON) to qemu's configure.
Fixes error:
Python not found. Use --python=/path/to/python

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 60526e46625c -r f3d137e3e6c7 tools/Makefile
--- a/tools/Makefile	Mon Feb 13 17:45:13 2012 +0000
+++ b/tools/Makefile	Mon Feb 13 18:17:28 2012 +0000
@@ -155,6 +155,7 @@
 		-L$(XEN_ROOT)/tools/xenstore" \
 		--bindir=$(LIBEXEC) \
 		--disable-kvm \
+		--python=$(PYTHON) \
 		$(IOEMU_CONFIGURE_CROSS); \
 	$(MAKE) install
 

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:32 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDb-00056g-5o; Tue, 14 Feb 2012 23:55:31 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDZ-0004y3-Iw
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:29 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-174.messagelabs.com!1329263721!13401417!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22250 invoked from network); 14 Feb 2012 23:55:22 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:22 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDR-0007iL-A8
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDR-0002Fk-8l
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:21 +0000
Message-Id: <E1RxSDR-0002Fk-8l@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: add early_printk()
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329143089 0
# Node ID f89c9a13529a0808bab24bb88bea6448eeb09cd9
# Parent  62c701cc8715dc259a127ee42b3fa4da313e61ee
arm: add early_printk()

Add early_printk() which can be used before setup_pagetables().  This
will be used when doing the early parsing of the DTB.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 62c701cc8715 -r f89c9a13529a xen/arch/arm/Makefile
--- a/xen/arch/arm/Makefile	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/arch/arm/Makefile	Mon Feb 13 14:24:49 2012 +0000
@@ -1,6 +1,7 @@
 subdir-y += lib
 
 obj-y += dummy.o
+obj-y += early_printk.o
 obj-y += entry.o
 obj-y += domain.o
 obj-y += domain_build.o
diff -r 62c701cc8715 -r f89c9a13529a xen/arch/arm/early_printk.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/early_printk.c	Mon Feb 13 14:24:49 2012 +0000
@@ -0,0 +1,72 @@
+/*
+ * printk() for use before the final page tables are setup.
+ *
+ * Copyright (C) 2012 Citrix Systems, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <xen/config.h>
+#include <xen/init.h>
+#include <xen/lib.h>
+#include <xen/stdarg.h>
+#include <xen/string.h>
+#include <asm/early_printk.h>
+
+#ifdef EARLY_UART_ADDRESS
+
+static void __init early_putch(char c)
+{
+    volatile uint32_t *r;
+
+    r = (uint32_t *)((EARLY_UART_ADDRESS & 0x001fffff)
+                     + XEN_VIRT_START + (1 << 21));
+
+    /* XXX: assuming a PL011 UART. */
+    while(*(r + 0x6) & 0x8)
+        ;
+    *r = c;
+}
+
+static void __init early_puts(const char *s)
+{
+    while (*s != '\0') {
+        if (*s == '\n')
+            early_putch('\r');
+        early_putch(*s);
+        s++;
+    }
+}
+
+static void __init early_vprintk(const char *fmt, va_list args)
+{
+    char buf[80];
+
+    vsnprintf(buf, sizeof(buf), fmt, args);
+    early_puts(buf);
+}
+
+void __init early_printk(const char *fmt, ...)
+{
+    va_list args;
+
+    va_start(args, fmt);
+    early_vprintk(fmt, args);
+    va_end(args);
+}
+
+void __attribute__((noreturn)) __init
+early_panic(const char *fmt, ...)
+{
+    va_list args;
+
+    va_start(args, fmt);
+    early_vprintk(fmt, args);
+    va_end(args);
+
+    while(1);
+}
+
+#endif /* #ifdef EARLY_UART_ADDRESS */
diff -r 62c701cc8715 -r f89c9a13529a xen/include/asm-arm/early_printk.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/early_printk.h	Mon Feb 13 14:24:49 2012 +0000
@@ -0,0 +1,27 @@
+/*
+ * printk() for use before the final page tables are setup.
+ *
+ * Copyright (C) 2012 Citrix Systems, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __ARM_EARLY_PRINTK_H__
+#define __ARM_EARLY_PRINTK_H__
+
+#include <xen/config.h>
+
+#ifdef EARLY_UART_ADDRESS
+
+void early_printk(const char *fmt, ...);
+void early_panic(const char *fmt, ...);
+
+#else
+
+static inline void early_printk(const char *fmt, ...) {}
+static inline void early_panic(const char *fmt, ...) {}
+
+#endif
+
+#endif

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:32 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDb-00056g-5o; Tue, 14 Feb 2012 23:55:31 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDZ-0004y3-Iw
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:29 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-174.messagelabs.com!1329263721!13401417!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22250 invoked from network); 14 Feb 2012 23:55:22 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:22 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDR-0007iL-A8
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDR-0002Fk-8l
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:21 +0000
Message-Id: <E1RxSDR-0002Fk-8l@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: add early_printk()
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329143089 0
# Node ID f89c9a13529a0808bab24bb88bea6448eeb09cd9
# Parent  62c701cc8715dc259a127ee42b3fa4da313e61ee
arm: add early_printk()

Add early_printk() which can be used before setup_pagetables().  This
will be used when doing the early parsing of the DTB.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 62c701cc8715 -r f89c9a13529a xen/arch/arm/Makefile
--- a/xen/arch/arm/Makefile	Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/arch/arm/Makefile	Mon Feb 13 14:24:49 2012 +0000
@@ -1,6 +1,7 @@
 subdir-y += lib
 
 obj-y += dummy.o
+obj-y += early_printk.o
 obj-y += entry.o
 obj-y += domain.o
 obj-y += domain_build.o
diff -r 62c701cc8715 -r f89c9a13529a xen/arch/arm/early_printk.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/early_printk.c	Mon Feb 13 14:24:49 2012 +0000
@@ -0,0 +1,72 @@
+/*
+ * printk() for use before the final page tables are setup.
+ *
+ * Copyright (C) 2012 Citrix Systems, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <xen/config.h>
+#include <xen/init.h>
+#include <xen/lib.h>
+#include <xen/stdarg.h>
+#include <xen/string.h>
+#include <asm/early_printk.h>
+
+#ifdef EARLY_UART_ADDRESS
+
+static void __init early_putch(char c)
+{
+    volatile uint32_t *r;
+
+    r = (uint32_t *)((EARLY_UART_ADDRESS & 0x001fffff)
+                     + XEN_VIRT_START + (1 << 21));
+
+    /* XXX: assuming a PL011 UART. */
+    while(*(r + 0x6) & 0x8)
+        ;
+    *r = c;
+}
+
+static void __init early_puts(const char *s)
+{
+    while (*s != '\0') {
+        if (*s == '\n')
+            early_putch('\r');
+        early_putch(*s);
+        s++;
+    }
+}
+
+static void __init early_vprintk(const char *fmt, va_list args)
+{
+    char buf[80];
+
+    vsnprintf(buf, sizeof(buf), fmt, args);
+    early_puts(buf);
+}
+
+void __init early_printk(const char *fmt, ...)
+{
+    va_list args;
+
+    va_start(args, fmt);
+    early_vprintk(fmt, args);
+    va_end(args);
+}
+
+void __attribute__((noreturn)) __init
+early_panic(const char *fmt, ...)
+{
+    va_list args;
+
+    va_start(args, fmt);
+    early_vprintk(fmt, args);
+    va_end(args);
+
+    while(1);
+}
+
+#endif /* #ifdef EARLY_UART_ADDRESS */
diff -r 62c701cc8715 -r f89c9a13529a xen/include/asm-arm/early_printk.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/early_printk.h	Mon Feb 13 14:24:49 2012 +0000
@@ -0,0 +1,27 @@
+/*
+ * printk() for use before the final page tables are setup.
+ *
+ * Copyright (C) 2012 Citrix Systems, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __ARM_EARLY_PRINTK_H__
+#define __ARM_EARLY_PRINTK_H__
+
+#include <xen/config.h>
+
+#ifdef EARLY_UART_ADDRESS
+
+void early_printk(const char *fmt, ...);
+void early_panic(const char *fmt, ...);
+
+#else
+
+static inline void early_printk(const char *fmt, ...) {}
+static inline void early_panic(const char *fmt, ...) {}
+
+#endif
+
+#endif

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:35 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDf-0005BX-FW; Tue, 14 Feb 2012 23:55:35 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDd-000514-Lj
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:33 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1329263726!13353015!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1887 invoked from network); 14 Feb 2012 23:55:27 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:27 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDW-0007iq-47
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:26 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDW-0002It-2X
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:26 +0000
Message-Id: <E1RxSDW-0002It-2X@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:25 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: Add defaultbridge config option
	for xl.conf
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Stefan Bader <stefan.bader@canonical.com>
# Date 1329155113 0
# Node ID 60526e46625c20e5475fbf4f403dd164bb699037
# Parent  e03d1005e484e8ad055687952b1e30d56632e8c2
xl: Add defaultbridge config option for xl.conf

Currently guests created with the xl stack will have "xenbr0"
written as their default into xenstore. It can be changed in
the individual guest config files, but there is no way to
have that default globally changed.

Add a config option to xl.conf that allows to have a different
default bridge name.

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r e03d1005e484 -r 60526e46625c docs/man/xl.conf.pod.5
--- a/docs/man/xl.conf.pod.5	Mon Feb 13 17:32:21 2012 +0000
+++ b/docs/man/xl.conf.pod.5	Mon Feb 13 17:45:13 2012 +0000
@@ -68,6 +68,12 @@
 
 Default: C</etc/xen/scripts/vif-bridge>
 
+=item B<defaultbridge="NAME">
+
+Configures the default bridge to set for virtual network devices.
+
+Default: C<xenbr0>
+
 =item B<output_format="json|sxp">
 
 Configures the default output format used by xl when printing "machine
diff -r e03d1005e484 -r 60526e46625c tools/libxl/xl.c
--- a/tools/libxl/xl.c	Mon Feb 13 17:32:21 2012 +0000
+++ b/tools/libxl/xl.c	Mon Feb 13 17:45:13 2012 +0000
@@ -38,6 +38,7 @@
 int autoballoon = 1;
 char *lockfile;
 char *default_vifscript = NULL;
+char *default_bridge = NULL;
 enum output_format default_output_format = OUTPUT_FORMAT_JSON;
 
 static xentoollog_level minmsglevel = XTL_PROGRESS;
@@ -79,6 +80,9 @@
     if (!xlu_cfg_get_string (config, "vifscript", &buf, 0))
         default_vifscript = strdup(buf);
 
+    if (!xlu_cfg_get_string (config, "defaultbridge", &buf, 0))
+	default_bridge = strdup(buf);
+
     if (!xlu_cfg_get_string (config, "output_format", &buf, 0)) {
         if (!strcmp(buf, "json"))
             default_output_format = OUTPUT_FORMAT_JSON;
diff -r e03d1005e484 -r 60526e46625c tools/libxl/xl.h
--- a/tools/libxl/xl.h	Mon Feb 13 17:32:21 2012 +0000
+++ b/tools/libxl/xl.h	Mon Feb 13 17:45:13 2012 +0000
@@ -110,6 +110,7 @@
 extern int dryrun_only;
 extern char *lockfile;
 extern char *default_vifscript;
+extern char *default_bridge;
 
 enum output_format {
     OUTPUT_FORMAT_JSON,
diff -r e03d1005e484 -r 60526e46625c tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Mon Feb 13 17:32:21 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Mon Feb 13 17:45:13 2012 +0000
@@ -840,6 +840,11 @@
                 nic->script = strdup(default_vifscript);
             }
 
+	    if (default_bridge) {
+		free(nic->bridge);
+		nic->bridge = strdup(default_bridge);
+	    }
+
             p = strtok(buf2, ",");
             if (!p)
                 goto skip;

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:35 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDf-0005BX-FW; Tue, 14 Feb 2012 23:55:35 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDd-000514-Lj
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:33 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1329263726!13353015!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1887 invoked from network); 14 Feb 2012 23:55:27 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:27 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDW-0007iq-47
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:26 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDW-0002It-2X
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:26 +0000
Message-Id: <E1RxSDW-0002It-2X@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:25 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: Add defaultbridge config option
	for xl.conf
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Stefan Bader <stefan.bader@canonical.com>
# Date 1329155113 0
# Node ID 60526e46625c20e5475fbf4f403dd164bb699037
# Parent  e03d1005e484e8ad055687952b1e30d56632e8c2
xl: Add defaultbridge config option for xl.conf

Currently guests created with the xl stack will have "xenbr0"
written as their default into xenstore. It can be changed in
the individual guest config files, but there is no way to
have that default globally changed.

Add a config option to xl.conf that allows to have a different
default bridge name.

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r e03d1005e484 -r 60526e46625c docs/man/xl.conf.pod.5
--- a/docs/man/xl.conf.pod.5	Mon Feb 13 17:32:21 2012 +0000
+++ b/docs/man/xl.conf.pod.5	Mon Feb 13 17:45:13 2012 +0000
@@ -68,6 +68,12 @@
 
 Default: C</etc/xen/scripts/vif-bridge>
 
+=item B<defaultbridge="NAME">
+
+Configures the default bridge to set for virtual network devices.
+
+Default: C<xenbr0>
+
 =item B<output_format="json|sxp">
 
 Configures the default output format used by xl when printing "machine
diff -r e03d1005e484 -r 60526e46625c tools/libxl/xl.c
--- a/tools/libxl/xl.c	Mon Feb 13 17:32:21 2012 +0000
+++ b/tools/libxl/xl.c	Mon Feb 13 17:45:13 2012 +0000
@@ -38,6 +38,7 @@
 int autoballoon = 1;
 char *lockfile;
 char *default_vifscript = NULL;
+char *default_bridge = NULL;
 enum output_format default_output_format = OUTPUT_FORMAT_JSON;
 
 static xentoollog_level minmsglevel = XTL_PROGRESS;
@@ -79,6 +80,9 @@
     if (!xlu_cfg_get_string (config, "vifscript", &buf, 0))
         default_vifscript = strdup(buf);
 
+    if (!xlu_cfg_get_string (config, "defaultbridge", &buf, 0))
+	default_bridge = strdup(buf);
+
     if (!xlu_cfg_get_string (config, "output_format", &buf, 0)) {
         if (!strcmp(buf, "json"))
             default_output_format = OUTPUT_FORMAT_JSON;
diff -r e03d1005e484 -r 60526e46625c tools/libxl/xl.h
--- a/tools/libxl/xl.h	Mon Feb 13 17:32:21 2012 +0000
+++ b/tools/libxl/xl.h	Mon Feb 13 17:45:13 2012 +0000
@@ -110,6 +110,7 @@
 extern int dryrun_only;
 extern char *lockfile;
 extern char *default_vifscript;
+extern char *default_bridge;
 
 enum output_format {
     OUTPUT_FORMAT_JSON,
diff -r e03d1005e484 -r 60526e46625c tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Mon Feb 13 17:32:21 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Mon Feb 13 17:45:13 2012 +0000
@@ -840,6 +840,11 @@
                 nic->script = strdup(default_vifscript);
             }
 
+	    if (default_bridge) {
+		free(nic->bridge);
+		nic->bridge = strdup(default_bridge);
+	    }
+
             p = strtok(buf2, ",");
             if (!p)
                 goto skip;

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:37 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDh-0005DY-Ik; Tue, 14 Feb 2012 23:55:37 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDf-0005Ap-32
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:35 +0000
Received: from [85.158.139.83:51662] by server-8.bemta-5.messagelabs.com id
	AE/4D-09797-674FA3F4; Tue, 14 Feb 2012 23:55:34 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-182.messagelabs.com!1329263727!7752254!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31524 invoked from network); 14 Feb 2012 23:55:28 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:28 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDX-0007ix-Eu
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:27 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDX-0002Jh-AC
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:27 +0000
Message-Id: <E1RxSDX-0002Jh-AC@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:26 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: fixup hard tabs
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329153968 0
# Node ID 0ba87b95e80bae059fe70b4b117dcc409f2471ef
# Parent  f3d137e3e6c79ea9c66e7b224c9041404e753149
arm: fixup hard tabs

Unfortunately the tool I was using to apply patches mangles hard tabs. This
patch corrects this in the effected files (which is fortunately only a subset
of .S or files imported from Linux).

This commit fixes this error such that the tree represents the state it would
have been in had I correctly committed what I was sent.

"git diff" and "git diff -b" vs. Stefano's v6 branch now contain the same
output -- i.e. only the intervening development

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/dummy.S
--- a/xen/arch/arm/dummy.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/dummy.S	Mon Feb 13 17:26:08 2012 +0000
@@ -1,13 +1,13 @@
 /* Nothing is mapped at 1G, for the moment */
 #define DUMMY(x) \
-       .globl x; \
-x:     .word 0xe7f000f0
-/* x:  mov r0, #0x40000000 ; str r0, [r0]; b x */
+	.globl x; \
+x:	.word 0xe7f000f0
+/* x:	mov r0, #0x40000000 ; str r0, [r0]; b x */
 
 #define  NOP(x) \
-       .globl x; \
-x:     mov pc, lr
-
+	.globl x; \
+x:	mov pc, lr
+	
 DUMMY(alloc_pirq_struct);
 DUMMY(alloc_vcpu_guest_context);
 DUMMY(arch_do_domctl);
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/entry.S
--- a/xen/arch/arm/entry.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/entry.S	Mon Feb 13 17:26:08 2012 +0000
@@ -1,69 +1,69 @@
 #include <xen/config.h>
 #include <asm/asm_defns.h>
 
-#define SAVE_ONE_BANKED(reg)   mrs r11, reg; str r11, [sp, #UREGS_##reg]
-#define RESTORE_ONE_BANKED(reg)        ldr r11, [sp, #UREGS_##reg]; msr reg, r11
+#define SAVE_ONE_BANKED(reg)	mrs r11, reg; str r11, [sp, #UREGS_##reg]
+#define RESTORE_ONE_BANKED(reg)	ldr r11, [sp, #UREGS_##reg]; msr reg, r11
 
 #define SAVE_BANKED(mode) \
-       SAVE_ONE_BANKED(SP_##mode) ; SAVE_ONE_BANKED(LR_##mode) ; SAVE_ONE_BANKED(SPSR_##mode)
+	SAVE_ONE_BANKED(SP_##mode) ; SAVE_ONE_BANKED(LR_##mode) ; SAVE_ONE_BANKED(SPSR_##mode)
 
 #define RESTORE_BANKED(mode) \
-       RESTORE_ONE_BANKED(SP_##mode) ; RESTORE_ONE_BANKED(LR_##mode) ; RESTORE_ONE_BANKED(SPSR_##mode)
+	RESTORE_ONE_BANKED(SP_##mode) ; RESTORE_ONE_BANKED(LR_##mode) ; RESTORE_ONE_BANKED(SPSR_##mode)
 
-#define SAVE_ALL                                                                                       \
-       sub sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */                                      \
-       push {r0-r12}; /* Save R0-R12 */                                                                \
-                                                                                                       \
-       mrs r11, ELR_hyp;               /* ELR_hyp is return address. */                                \
-       str r11, [sp, #UREGS_pc];                                                                       \
-                                                                                                       \
-       str lr, [sp, #UREGS_lr];                                                                        \
-                                                                                                       \
-       add r11, sp, #UREGS_kernel_sizeof+4;                                                            \
-       str r11, [sp, #UREGS_sp];                                                                       \
-                                                                                                       \
-       mrs r11, SPSR_hyp;                                                                              \
-       str r11, [sp, #UREGS_cpsr];                                                                     \
-       and r11, #PSR_MODE_MASK;                                                                        \
-       cmp r11, #PSR_MODE_HYP;                                                                         \
-       blne save_guest_regs
+#define SAVE_ALL											\
+	sub sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */					\
+	push {r0-r12}; /* Save R0-R12 */								\
+													\
+	mrs r11, ELR_hyp;		/* ELR_hyp is return address. */				\
+	str r11, [sp, #UREGS_pc];									\
+													\
+	str lr, [sp, #UREGS_lr];									\
+													\
+	add r11, sp, #UREGS_kernel_sizeof+4;								\
+	str r11, [sp, #UREGS_sp];									\
+													\
+	mrs r11, SPSR_hyp;										\
+	str r11, [sp, #UREGS_cpsr];									\
+	and r11, #PSR_MODE_MASK;									\
+	cmp r11, #PSR_MODE_HYP;										\
+	blne save_guest_regs
 
 save_guest_regs:
-       ldr r11, [sp, #UREGS_lr]
-       str r11, [sp, #UREGS_LR_usr]
-       ldr r11, =0xffffffff  /* Clobber SP which is only valid for hypervisor frames. */
-       str r11, [sp, #UREGS_sp]
-       SAVE_ONE_BANKED(SP_usr)
-       SAVE_BANKED(svc)
-       SAVE_BANKED(abt)
-       SAVE_BANKED(und)
-       SAVE_BANKED(irq)
-       SAVE_BANKED(fiq)
-       SAVE_ONE_BANKED(R8_fiq); SAVE_ONE_BANKED(R9_fiq); SAVE_ONE_BANKED(R10_fiq)
-       SAVE_ONE_BANKED(R11_fiq); SAVE_ONE_BANKED(R12_fiq);
-       mov pc, lr
+	ldr r11, [sp, #UREGS_lr]
+	str r11, [sp, #UREGS_LR_usr]
+	ldr r11, =0xffffffff  /* Clobber SP which is only valid for hypervisor frames. */
+	str r11, [sp, #UREGS_sp]
+	SAVE_ONE_BANKED(SP_usr)
+	SAVE_BANKED(svc)
+	SAVE_BANKED(abt)
+	SAVE_BANKED(und)
+	SAVE_BANKED(irq)
+	SAVE_BANKED(fiq)
+	SAVE_ONE_BANKED(R8_fiq); SAVE_ONE_BANKED(R9_fiq); SAVE_ONE_BANKED(R10_fiq)
+	SAVE_ONE_BANKED(R11_fiq); SAVE_ONE_BANKED(R12_fiq);
+	mov pc, lr
 
-#define DEFINE_TRAP_ENTRY(trap)                                                                                \
-       ALIGN;                                                                                          \
-trap_##trap:                                                                                           \
-       SAVE_ALL;                                                                                       \
-       adr lr, return_from_trap;                                                                       \
-       mov r0, sp;                                                                                     \
-       mov r11, sp;                                                                                    \
-       bic sp, #7; /* Align the stack pointer (noop on guest trap) */                                  \
-       b do_trap_##trap
+#define DEFINE_TRAP_ENTRY(trap)										\
+	ALIGN;												\
+trap_##trap:												\
+	SAVE_ALL;											\
+	adr lr, return_from_trap;									\
+	mov r0, sp;											\
+	mov r11, sp;											\
+	bic sp, #7; /* Align the stack pointer (noop on guest trap) */					\
+	b do_trap_##trap
 
 .globl hyp_traps_vector
-       .align 5
+	.align 5
 hyp_traps_vector:
-       .word 0                         /* 0x00 - Reset */
-       b trap_undefined_instruction    /* 0x04 - Undefined Instruction */
-       b trap_supervisor_call          /* 0x08 - Supervisor Call */
-       b trap_prefetch_abort           /* 0x0c - Prefetch Abort */
-       b trap_data_abort               /* 0x10 - Data Abort */
-       b trap_hypervisor               /* 0x14 - Hypervisor */
-       b trap_irq                      /* 0x18 - IRQ */
-       b trap_fiq                      /* 0x1c - FIQ */
+	.word 0				/* 0x00 - Reset */
+	b trap_undefined_instruction	/* 0x04 - Undefined Instruction */
+	b trap_supervisor_call		/* 0x08 - Supervisor Call */
+	b trap_prefetch_abort		/* 0x0c - Prefetch Abort */
+	b trap_data_abort		/* 0x10 - Data Abort */
+	b trap_hypervisor		/* 0x14 - Hypervisor */
+	b trap_irq			/* 0x18 - IRQ */
+	b trap_fiq			/* 0x1c - FIQ */
 
 DEFINE_TRAP_ENTRY(undefined_instruction)
 DEFINE_TRAP_ENTRY(supervisor_call)
@@ -74,34 +74,34 @@
 DEFINE_TRAP_ENTRY(fiq)
 
 ENTRY(return_from_trap)
-       ldr r11, [sp, #UREGS_cpsr]
-       and r11, #PSR_MODE_MASK
-       cmp r11, #PSR_MODE_HYP
-       beq return_to_hypervisor
+	ldr r11, [sp, #UREGS_cpsr]
+	and r11, #PSR_MODE_MASK
+	cmp r11, #PSR_MODE_HYP
+	beq return_to_hypervisor
 
 ENTRY(return_to_guest)
-       mov r11, sp
-       bic sp, #7 /* Align the stack pointer */
-       bl leave_hypervisor_tail
-       ldr r11, [sp, #UREGS_pc]
-       msr ELR_hyp, r11
-       ldr r11, [sp, #UREGS_cpsr]
-       msr SPSR_hyp, r11
-       RESTORE_ONE_BANKED(SP_usr)
-       RESTORE_BANKED(svc)
-       RESTORE_BANKED(abt)
-       RESTORE_BANKED(und)
-       RESTORE_BANKED(irq)
-       RESTORE_BANKED(fiq)
-       RESTORE_ONE_BANKED(R8_fiq); RESTORE_ONE_BANKED(R9_fiq); RESTORE_ONE_BANKED(R10_fiq)
-       RESTORE_ONE_BANKED(R11_fiq); RESTORE_ONE_BANKED(R12_fiq);
-       ldr lr, [sp, #UREGS_LR_usr]
-       pop {r0-r12}
-       add sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */
-       eret
+	mov r11, sp
+	bic sp, #7 /* Align the stack pointer */
+	bl leave_hypervisor_tail
+	ldr r11, [sp, #UREGS_pc]
+	msr ELR_hyp, r11
+	ldr r11, [sp, #UREGS_cpsr]
+	msr SPSR_hyp, r11
+	RESTORE_ONE_BANKED(SP_usr)
+	RESTORE_BANKED(svc)
+	RESTORE_BANKED(abt)
+	RESTORE_BANKED(und)
+	RESTORE_BANKED(irq)
+	RESTORE_BANKED(fiq)
+	RESTORE_ONE_BANKED(R8_fiq); RESTORE_ONE_BANKED(R9_fiq); RESTORE_ONE_BANKED(R10_fiq)
+	RESTORE_ONE_BANKED(R11_fiq); RESTORE_ONE_BANKED(R12_fiq);
+	ldr lr, [sp, #UREGS_LR_usr]
+	pop {r0-r12}
+	add sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */
+	eret
 
 ENTRY(return_to_hypervisor)
-       ldr lr, [sp, #UREGS_lr]
-       pop {r0-r12}
-       add sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */
-       eret
+	ldr lr, [sp, #UREGS_lr]
+	pop {r0-r12}
+	add sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */
+	eret
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/head.S
--- a/xen/arch/arm/head.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/head.S	Mon Feb 13 17:26:08 2012 +0000
@@ -26,281 +26,281 @@
  * Clobbers r0-r3. */
 #ifdef EARLY_UART_ADDRESS
 #define PRINT(_s)       \
-       adr   r0, 98f ; \
-       bl    puts    ; \
-       b     99f     ; \
-98:    .asciz _s     ; \
-       .align 2      ; \
+	adr   r0, 98f ; \
+	bl    puts    ; \
+	b     99f     ; \
+98:	.asciz _s     ; \
+	.align 2      ; \
 99:
 #else
 #define PRINT(s)
 #endif
 
-       .arm
+	.arm
 
-       /* This must be the very first address in the loaded image.
-        * It should be linked at XEN_VIRT_START, and loaded at any
-        * 2MB-aligned address.  All of text+data+bss must fit in 2MB,
-        * or the initial pagetable code below will need adjustment. */
-       .global start
+	/* This must be the very first address in the loaded image.
+	 * It should be linked at XEN_VIRT_START, and loaded at any
+	 * 2MB-aligned address.  All of text+data+bss must fit in 2MB,
+	 * or the initial pagetable code below will need adjustment. */
+	.global start
 start:
-       cpsid aif                    /* Disable all interrupts */
+	cpsid aif                    /* Disable all interrupts */
 
-       /* Save the bootloader arguments in less-clobberable registers */
-       mov   r7, r1                 /* r7 := ARM-linux machine type */
-       mov   r8, r2                 /* r8 := ATAG base address */
+	/* Save the bootloader arguments in less-clobberable registers */
+	mov   r7, r1                 /* r7 := ARM-linux machine type */
+	mov   r8, r2                 /* r8 := ATAG base address */
 
-       /* Find out where we are */
-       ldr   r0, =start
-       adr   r9, start              /* r9  := paddr (start) */
-       sub   r10, r9, r0            /* r10 := phys-offset */
+	/* Find out where we are */
+	ldr   r0, =start
+	adr   r9, start              /* r9  := paddr (start) */
+	sub   r10, r9, r0            /* r10 := phys-offset */
 
-        /* Using the DTB in the .dtb section? */
+	/* Using the DTB in the .dtb section? */
 #ifdef CONFIG_DTB_FILE
-        ldr   r8, =_sdtb
-        add   r8, r10                /* r8 := paddr(DTB) */
+	ldr   r8, =_sdtb
+	add   r8, r10                /* r8 := paddr(DTB) */
 #endif
 
 #ifdef EARLY_UART_ADDRESS
-       /* Say hello */
-       ldr   r11, =EARLY_UART_ADDRESS  /* r11 := UART base address */
-       bl    init_uart
+	/* Say hello */
+	ldr   r11, =EARLY_UART_ADDRESS  /* r11 := UART base address */
+	bl    init_uart
 #endif
 
-       /* Check that this CPU has Hyp mode */
-       mrc   CP32(r0, ID_PFR1)
-       and   r0, r0, #0xf000        /* Bits 12-15 define virt extensions */
-       teq   r0, #0x1000            /* Must == 0x1 or may be incompatible */
-       beq   1f
-       bl    putn
-       PRINT("- CPU doesn't support the virtualization extensions -\r\n")
-       b     fail
+	/* Check that this CPU has Hyp mode */
+	mrc   CP32(r0, ID_PFR1)
+	and   r0, r0, #0xf000        /* Bits 12-15 define virt extensions */
+	teq   r0, #0x1000            /* Must == 0x1 or may be incompatible */
+	beq   1f
+	bl    putn
+	PRINT("- CPU doesn't support the virtualization extensions -\r\n")
+	b     fail
 1:
-       /* Check if we're already in it */
-       mrs   r0, cpsr
-       and   r0, r0, #0x1f          /* Mode is in the low 5 bits of CPSR */
-       teq   r0, #0x1a              /* Hyp Mode? */
-       bne   1f
-       PRINT("- Started in Hyp mode -\r\n")
-       b     hyp
+	/* Check if we're already in it */
+	mrs   r0, cpsr
+	and   r0, r0, #0x1f          /* Mode is in the low 5 bits of CPSR */
+	teq   r0, #0x1a              /* Hyp Mode? */
+	bne   1f
+	PRINT("- Started in Hyp mode -\r\n")
+	b     hyp
 1:
-       /* Otherwise, it must have been Secure Supervisor mode */
-       mrc   CP32(r0, SCR)
-       tst   r0, #0x1               /* Not-Secure bit set? */
-       beq   1f
-       PRINT("- CPU is not in Hyp mode or Secure state -\r\n")
-       b     fail
+	/* Otherwise, it must have been Secure Supervisor mode */
+	mrc   CP32(r0, SCR)
+	tst   r0, #0x1               /* Not-Secure bit set? */
+	beq   1f
+	PRINT("- CPU is not in Hyp mode or Secure state -\r\n")
+	b     fail
 1:
-       /* OK, we're in Secure state. */
-       PRINT("- Started in Secure state -\r\n- Entering Hyp mode -\r\n")
+	/* OK, we're in Secure state. */
+	PRINT("- Started in Secure state -\r\n- Entering Hyp mode -\r\n")
 
-       /* Dance into Hyp mode */
-       cpsid aif, #0x16             /* Enter Monitor mode */
-       mrc   CP32(r0, SCR)
-       orr   r0, r0, #0x100         /* Set HCE */
-       orr   r0, r0, #0xb1          /* Set SCD, AW, FW and NS */
-       bic   r0, r0, #0xe           /* Clear EA, FIQ and IRQ */
-       mcr   CP32(r0, SCR)
-       /* Ugly: the system timer's frequency register is only
-        * programmable in Secure state.  Since we don't know where its
-        * memory-mapped control registers live, we can't find out the
-        * right frequency.  Use the VE model's default frequency here. */
-       ldr   r0, =0x5f5e100         /* 100 MHz */
-       mcr   CP32(r0, CNTFRQ)
-       ldr   r0, =0x40c00           /* SMP, c11, c10 in non-secure mode */
-       mcr   CP32(r0, NSACR)
-       /* Continuing ugliness: Set up the GIC so NS state owns interrupts */
-       mov   r0, #GIC_BASE_ADDRESS
-       add   r0, r0, #GIC_DR_OFFSET
-       mov   r1, #0
-       str   r1, [r0]               /* Disable delivery in the distributor */
-       add   r0, r0, #0x80          /* GICD_IGROUP0 */
-       mov   r2, #0xffffffff        /* All interrupts to group 1 */
-       str   r2, [r0]
-       str   r2, [r0, #4]
-       str   r2, [r0, #8]
-       /* Must drop priority mask below 0x80 before entering NS state */
-       mov   r0, #GIC_BASE_ADDRESS
-       add   r0, r0, #GIC_CR_OFFSET
-       ldr   r1, =0xff
-       str   r1, [r0, #0x4]         /* -> GICC_PMR */
-       /* Reset a few config registers */
-       mov   r0, #0
-       mcr   CP32(r0, FCSEIDR)
-       mcr   CP32(r0, CONTEXTIDR)
-       /* FIXME: ought to reset some other NS control regs here */
-       adr   r1, 1f
-       adr   r0, hyp                /* Store paddr (hyp entry point) */
-       str   r0, [r1]               /* where we can use it for RFE */
-       isb                          /* Ensure we see the stored target address */
-       rfeia r1                     /* Enter Hyp mode */
+	/* Dance into Hyp mode */
+	cpsid aif, #0x16             /* Enter Monitor mode */
+	mrc   CP32(r0, SCR)
+	orr   r0, r0, #0x100         /* Set HCE */
+	orr   r0, r0, #0xb1          /* Set SCD, AW, FW and NS */
+	bic   r0, r0, #0xe           /* Clear EA, FIQ and IRQ */
+	mcr   CP32(r0, SCR)
+	/* Ugly: the system timer's frequency register is only
+	 * programmable in Secure state.  Since we don't know where its
+	 * memory-mapped control registers live, we can't find out the
+	 * right frequency.  Use the VE model's default frequency here. */
+	ldr   r0, =0x5f5e100         /* 100 MHz */
+	mcr   CP32(r0, CNTFRQ)
+	ldr   r0, =0x40c00           /* SMP, c11, c10 in non-secure mode */
+	mcr   CP32(r0, NSACR)
+	/* Continuing ugliness: Set up the GIC so NS state owns interrupts */
+	mov   r0, #GIC_BASE_ADDRESS
+	add   r0, r0, #GIC_DR_OFFSET
+	mov   r1, #0
+	str   r1, [r0]               /* Disable delivery in the distributor */
+	add   r0, r0, #0x80          /* GICD_IGROUP0 */
+	mov   r2, #0xffffffff        /* All interrupts to group 1 */
+	str   r2, [r0]
+	str   r2, [r0, #4]
+	str   r2, [r0, #8]
+	/* Must drop priority mask below 0x80 before entering NS state */
+	mov   r0, #GIC_BASE_ADDRESS
+	add   r0, r0, #GIC_CR_OFFSET
+	ldr   r1, =0xff
+	str   r1, [r0, #0x4]         /* -> GICC_PMR */
+	/* Reset a few config registers */
+	mov   r0, #0
+	mcr   CP32(r0, FCSEIDR)
+	mcr   CP32(r0, CONTEXTIDR)
+	/* FIXME: ought to reset some other NS control regs here */
+	adr   r1, 1f
+	adr   r0, hyp                /* Store paddr (hyp entry point) */
+	str   r0, [r1]               /* where we can use it for RFE */
+	isb                          /* Ensure we see the stored target address */
+	rfeia r1                     /* Enter Hyp mode */
 
-1:     .word 0                      /* PC to enter Hyp mode at */
-       .word 0x000001da             /* CPSR: LE, Abort/IRQ/FIQ off, Hyp */
+1:	.word 0                      /* PC to enter Hyp mode at */
+	.word 0x000001da             /* CPSR: LE, Abort/IRQ/FIQ off, Hyp */
 
 hyp:
-       PRINT("- Setting up control registers -\r\n")
+	PRINT("- Setting up control registers -\r\n")
 
-       /* Set up memory attribute type tables */
-       ldr   r0, =MAIR0VAL
-       ldr   r1, =MAIR1VAL
-       mcr   CP32(r0, MAIR0)
-       mcr   CP32(r1, MAIR1)
-       mcr   CP32(r0, HMAIR0)
-       mcr   CP32(r1, HMAIR1)
+	/* Set up memory attribute type tables */
+	ldr   r0, =MAIR0VAL
+	ldr   r1, =MAIR1VAL
+	mcr   CP32(r0, MAIR0)
+	mcr   CP32(r1, MAIR1)
+	mcr   CP32(r0, HMAIR0)
+	mcr   CP32(r1, HMAIR1)
 
-       /* Set up the HTCR:
-        * PT walks use Outer-Shareable accesses,
-        * PT walks are write-back, no-write-allocate in both cache levels,
-        * Full 32-bit address space goes through this table. */
-       ldr   r0, =0x80002500
-       mcr   CP32(r0, HTCR)
+	/* Set up the HTCR:
+	 * PT walks use Outer-Shareable accesses,
+	 * PT walks are write-back, no-write-allocate in both cache levels,
+	 * Full 32-bit address space goes through this table. */
+	ldr   r0, =0x80002500
+	mcr   CP32(r0, HTCR)
 
-       /* Set up the HSCTLR:
-        * Exceptions in LE ARM,
-        * Low-latency IRQs disabled,
-        * Write-implies-XN disabled (for now),
-        * I-cache and d-cache enabled,
-        * Alignment checking enabled,
-        * MMU translation disabled (for now). */
-       ldr   r0, =(HSCTLR_BASE|SCTLR_A|SCTLR_C)
-       mcr   CP32(r0, HSCTLR)
+	/* Set up the HSCTLR:
+	 * Exceptions in LE ARM,
+	 * Low-latency IRQs disabled,
+	 * Write-implies-XN disabled (for now),
+	 * I-cache and d-cache enabled,
+	 * Alignment checking enabled,
+	 * MMU translation disabled (for now). */
+	ldr   r0, =(HSCTLR_BASE|SCTLR_A|SCTLR_C)
+	mcr   CP32(r0, HSCTLR)
 
-       /* Write Xen's PT's paddr into the HTTBR */
-       ldr   r4, =xen_pgtable
-       add   r4, r4, r10            /* r4 := paddr (xen_pagetable) */
-       mov   r5, #0                 /* r4:r5 is paddr (xen_pagetable) */
-       mcrr  CP64(r4, r5, HTTBR)
+	/* Write Xen's PT's paddr into the HTTBR */
+	ldr   r4, =xen_pgtable
+	add   r4, r4, r10            /* r4 := paddr (xen_pagetable) */
+	mov   r5, #0                 /* r4:r5 is paddr (xen_pagetable) */
+	mcrr  CP64(r4, r5, HTTBR)
 
-       /* Build the baseline idle pagetable's first-level entries */
-       ldr   r1, =xen_second
-       add   r1, r1, r10            /* r1 := paddr (xen_second) */
-       mov   r3, #0x0
-       orr   r2, r1, #0xe00         /* r2:r3 := table map of xen_second */
-       orr   r2, r2, #0x07f         /* (+ rights for linear PT) */
-       strd  r2, r3, [r4, #0]       /* Map it in slot 0 */
-       add   r2, r2, #0x1000
-       strd  r2, r3, [r4, #8]       /* Map 2nd page in slot 1 */
-       add   r2, r2, #0x1000
-       strd  r2, r3, [r4, #16]      /* Map 3rd page in slot 2 */
-       add   r2, r2, #0x1000
-       strd  r2, r3, [r4, #24]      /* Map 4th page in slot 3 */
+	/* Build the baseline idle pagetable's first-level entries */
+	ldr   r1, =xen_second
+	add   r1, r1, r10            /* r1 := paddr (xen_second) */
+	mov   r3, #0x0
+	orr   r2, r1, #0xe00         /* r2:r3 := table map of xen_second */
+	orr   r2, r2, #0x07f         /* (+ rights for linear PT) */
+	strd  r2, r3, [r4, #0]       /* Map it in slot 0 */
+	add   r2, r2, #0x1000
+	strd  r2, r3, [r4, #8]       /* Map 2nd page in slot 1 */
+	add   r2, r2, #0x1000
+	strd  r2, r3, [r4, #16]      /* Map 3rd page in slot 2 */
+	add   r2, r2, #0x1000
+	strd  r2, r3, [r4, #24]      /* Map 4th page in slot 3 */
 
-       /* Now set up the second-level entries */
-       orr   r2, r9, #0xe00
-       orr   r2, r2, #0x07d         /* r2:r3 := 2MB normal map of Xen */
-       mov   r4, r9, lsr #18        /* Slot for paddr(start) */
-       strd  r2, r3, [r1, r4]       /* Map Xen there */
-       ldr   r4, =start
-       lsr   r4, #18                /* Slot for vaddr(start) */
-       strd  r2, r3, [r1, r4]       /* Map Xen there too */
+	/* Now set up the second-level entries */
+	orr   r2, r9, #0xe00
+	orr   r2, r2, #0x07d         /* r2:r3 := 2MB normal map of Xen */
+	mov   r4, r9, lsr #18        /* Slot for paddr(start) */
+	strd  r2, r3, [r1, r4]       /* Map Xen there */
+	ldr   r4, =start
+	lsr   r4, #18                /* Slot for vaddr(start) */
+	strd  r2, r3, [r1, r4]       /* Map Xen there too */
 #ifdef EARLY_UART_ADDRESS
-       ldr   r3, =(1<<(54-32))      /* NS for device mapping */
-       lsr   r2, r11, #21
-       lsl   r2, r2, #21            /* 2MB-aligned paddr of UART */
-       orr   r2, r2, #0xe00
-       orr   r2, r2, #0x071         /* r2:r3 := 2MB dev map including UART */
-       add   r4, r4, #8
-       strd  r2, r3, [r1, r4]       /* Map it in the fixmap's slot */
+	ldr   r3, =(1<<(54-32))      /* NS for device mapping */
+	lsr   r2, r11, #21
+	lsl   r2, r2, #21            /* 2MB-aligned paddr of UART */
+	orr   r2, r2, #0xe00
+	orr   r2, r2, #0x071         /* r2:r3 := 2MB dev map including UART */
+	add   r4, r4, #8
+	strd  r2, r3, [r1, r4]       /* Map it in the fixmap's slot */
 #else
-       add   r4, r4, #8             /* Skip over unused fixmap slot */
+	add   r4, r4, #8             /* Skip over unused fixmap slot */
 #endif
-       mov   r3, #0x0
-       lsr   r2, r8, #21
-       lsl   r2, r2, #21            /* 2MB-aligned paddr of DTB */
-       orr   r2, r2, #0xf00
-       orr   r2, r2, #0x07d         /* r2:r3 := 2MB RAM incl. DTB */
-       add   r4, r4, #8
-       strd  r2, r3, [r1, r4]       /* Map it in the early boot slot */
+	mov   r3, #0x0
+	lsr   r2, r8, #21
+	lsl   r2, r2, #21            /* 2MB-aligned paddr of DTB */
+	orr   r2, r2, #0xf00
+	orr   r2, r2, #0x07d         /* r2:r3 := 2MB RAM incl. DTB */
+	add   r4, r4, #8
+	strd  r2, r3, [r1, r4]       /* Map it in the early boot slot */
 
-       PRINT("- Turning on paging -\r\n")
+	PRINT("- Turning on paging -\r\n")
 
-       ldr   r1, =paging            /* Explicit vaddr, not RIP-relative */
-       mrc   CP32(r0, HSCTLR)
-       orr   r0, r0, #0x1           /* Add in the MMU enable bit */
-       dsb                          /* Flush PTE writes and finish reads */
-       mcr   CP32(r0, HSCTLR)       /* now paging is enabled */
-       isb                          /* Now, flush the icache */
-       mov   pc, r1                 /* Get a proper vaddr into PC */
+	ldr   r1, =paging            /* Explicit vaddr, not RIP-relative */
+	mrc   CP32(r0, HSCTLR)
+	orr   r0, r0, #0x1           /* Add in the MMU enable bit */
+	dsb                          /* Flush PTE writes and finish reads */
+	mcr   CP32(r0, HSCTLR)       /* now paging is enabled */
+	isb                          /* Now, flush the icache */
+	mov   pc, r1                 /* Get a proper vaddr into PC */
 paging:
 
 #ifdef EARLY_UART_ADDRESS
-       /* Recover the UART address in the new address space */
-       lsl   r11, #11
-       lsr   r11, #11               /* UART base's offset from 2MB base */
-       adr   r0, start
-       add   r0, r0, #0x200000      /* vaddr of the fixmap's 2MB slot */
-       add   r11, r11, r0           /* r11 := vaddr (UART base address) */
+	/* Recover the UART address in the new address space */
+	lsl   r11, #11
+	lsr   r11, #11               /* UART base's offset from 2MB base */
+	adr   r0, start
+	add   r0, r0, #0x200000      /* vaddr of the fixmap's 2MB slot */
+	add   r11, r11, r0           /* r11 := vaddr (UART base address) */
 #endif
 
-       PRINT("- Entering C -\r\n")
+	PRINT("- Entering C -\r\n")
 
-       ldr   sp, =init_stack        /* Supply a stack */
-       add   sp, #STACK_SIZE        /* (which grows down from the top). */
-       sub   sp, #CPUINFO_sizeof    /* Make room for CPU save record */
-       mov   r0, r10                /* Marshal args: - phys_offset */
-       mov   r1, r7                 /*               - machine type */
-       mov   r2, r8                 /*               - ATAG address */
-       b     start_xen              /* and disappear into the land of C */
+	ldr   sp, =init_stack        /* Supply a stack */
+	add   sp, #STACK_SIZE        /* (which grows down from the top). */
+	sub   sp, #CPUINFO_sizeof    /* Make room for CPU save record */
+	mov   r0, r10                /* Marshal args: - phys_offset */
+	mov   r1, r7                 /*               - machine type */
+	mov   r2, r8                 /*               - ATAG address */
+	b     start_xen              /* and disappear into the land of C */
 
 /* Fail-stop
  * r0: string explaining why */
-fail:  PRINT("- Boot failed -\r\n")
-1:     wfe
-       b     1b
+fail:	PRINT("- Boot failed -\r\n")
+1:	wfe
+	b     1b
 
 #ifdef EARLY_UART_ADDRESS
 
 /* Bring up the UART. Specific to the PL011 UART.
  * Clobbers r0-r2 */
 init_uart:
-       mov   r1, #0x0
-       str   r1, [r11, #0x24]       /* -> UARTIBRD (Baud divisor fraction) */
-       mov   r1, #0x4               /* 7.3728MHz / 0x4 == 16 * 115200 */
-       str   r1, [r11, #0x24]       /* -> UARTIBRD (Baud divisor integer) */
-       mov   r1, #0x60              /* 8n1 */
-       str   r1, [r11, #0x24]       /* -> UARTLCR_H (Line control) */
-       ldr   r1, =0x00000301        /* RXE | TXE | UARTEN */
-       str   r1, [r11, #0x30]       /* -> UARTCR (Control Register) */
-       adr   r0, 1f
-       b     puts
-1:     .asciz "- UART enabled -\r\n"
-       .align 4
+	mov   r1, #0x0
+	str   r1, [r11, #0x24]       /* -> UARTIBRD (Baud divisor fraction) */
+	mov   r1, #0x4               /* 7.3728MHz / 0x4 == 16 * 115200 */
+	str   r1, [r11, #0x24]       /* -> UARTIBRD (Baud divisor integer) */
+	mov   r1, #0x60              /* 8n1 */
+	str   r1, [r11, #0x24]       /* -> UARTLCR_H (Line control) */
+	ldr   r1, =0x00000301        /* RXE | TXE | UARTEN */
+	str   r1, [r11, #0x30]       /* -> UARTCR (Control Register) */
+	adr   r0, 1f
+	b     puts
+1:	.asciz "- UART enabled -\r\n"
+	.align 4
 
 /* Print early debug messages.  Specific to the PL011 UART.
  * r0: Nul-terminated string to print.
  * Clobbers r0-r2 */
 puts:
-       ldr   r2, [r11, #0x18]       /* <- UARTFR (Flag register) */
-       tst   r2, #0x8               /* Check BUSY bit */
-       bne   puts                   /* Wait for the UART to be ready */
-       ldrb  r2, [r0], #1           /* Load next char */
-       teq   r2, #0                 /* Exit on nul*/
-       moveq pc, lr
-       str   r2, [r11]              /* -> UARTDR (Data Register) */
-       b     puts
+	ldr   r2, [r11, #0x18]       /* <- UARTFR (Flag register) */
+	tst   r2, #0x8               /* Check BUSY bit */
+	bne   puts                   /* Wait for the UART to be ready */
+	ldrb  r2, [r0], #1           /* Load next char */
+	teq   r2, #0                 /* Exit on nul*/
+	moveq pc, lr
+	str   r2, [r11]              /* -> UARTDR (Data Register) */
+	b     puts
 
 /* Print a 32-bit number in hex.  Specific to the PL011 UART.
  * r0: Number to print.
  * clobbers r0-r3 */
 putn:
-       adr   r1, hex
-       mov   r3, #8
-1:     ldr   r2, [r11, #0x18]       /* <- UARTFR (Flag register) */
-       tst   r2, #0x8               /* Check BUSY bit */
-       bne   1b                     /* Wait for the UART to be ready */
-       and   r2, r0, #0xf0000000    /* Mask off the top nybble */
-       ldrb  r2, [r1, r2, lsr #28]  /* Convert to a char */
-       str   r2, [r11]              /* -> UARTDR (Data Register) */
-       lsl   r0, #4                 /* Roll it through one nybble at a time */
-       subs  r3, r3, #1
-       bne   1b
-       adr   r0, crlf               /* Finish with a newline */
-       b     puts
+	adr   r1, hex
+	mov   r3, #8
+1:	ldr   r2, [r11, #0x18]       /* <- UARTFR (Flag register) */
+	tst   r2, #0x8               /* Check BUSY bit */
+	bne   1b                     /* Wait for the UART to be ready */
+	and   r2, r0, #0xf0000000    /* Mask off the top nybble */
+	ldrb  r2, [r1, r2, lsr #28]  /* Convert to a char */
+	str   r2, [r11]              /* -> UARTDR (Data Register) */
+	lsl   r0, #4                 /* Roll it through one nybble at a time */
+	subs  r3, r3, #1
+	bne   1b
+	adr   r0, crlf               /* Finish with a newline */
+	b     puts
 
-crlf:  .asciz "\r\n"
-hex:   .ascii "0123456789abcdef"
-       .align 2
+crlf:	.asciz "\r\n"
+hex:	.ascii "0123456789abcdef"
+	.align 2
 
 #else  /* EARLY_UART_ADDRESS */
 
@@ -308,6 +308,6 @@
 .global early_puts
 early_puts:
 puts:
-putn:  mov   pc, lr
+putn:	mov   pc, lr
 
 #endif /* EARLY_UART_ADDRESS */
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/bitops.h
--- a/xen/arch/arm/lib/bitops.h	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/bitops.h	Mon Feb 13 17:26:08 2012 +0000
@@ -1,61 +1,61 @@
 #include <xen/config.h>
 
 #if __LINUX_ARM_ARCH__ >= 6
-       .macro  bitop, instr
-       ands    ip, r1, #3
-       strneb  r1, [ip]                @ assert word-aligned
-       mov     r2, #1
-       and     r3, r0, #31             @ Get bit offset
-       mov     r0, r0, lsr #5
-       add     r1, r1, r0, lsl #2      @ Get word offset
-       mov     r3, r2, lsl r3
-1:     ldrex   r2, [r1]
-       \instr  r2, r2, r3
-       strex   r0, r2, [r1]
-       cmp     r0, #0
-       bne     1b
-       bx      lr
-       .endm
+	.macro	bitop, instr
+	ands	ip, r1, #3
+	strneb	r1, [ip]		@ assert word-aligned
+	mov	r2, #1
+	and	r3, r0, #31		@ Get bit offset
+	mov	r0, r0, lsr #5
+	add	r1, r1, r0, lsl #2	@ Get word offset
+	mov	r3, r2, lsl r3
+1:	ldrex	r2, [r1]
+	\instr	r2, r2, r3
+	strex	r0, r2, [r1]
+	cmp	r0, #0
+	bne	1b
+	bx	lr
+	.endm
 
-       .macro  testop, instr, store
-       ands    ip, r1, #3
-       strneb  r1, [ip]                @ assert word-aligned
-       mov     r2, #1
-       and     r3, r0, #31             @ Get bit offset
-       mov     r0, r0, lsr #5
-       add     r1, r1, r0, lsl #2      @ Get word offset
-       mov     r3, r2, lsl r3          @ create mask
-       smp_dmb
-1:     ldrex   r2, [r1]
-       ands    r0, r2, r3              @ save old value of bit
-       \instr  r2, r2, r3              @ toggle bit
-       strex   ip, r2, [r1]
-       cmp     ip, #0
-       bne     1b
-       smp_dmb
-       cmp     r0, #0
-       movne   r0, #1
-2:     bx      lr
-       .endm
+	.macro	testop, instr, store
+	ands	ip, r1, #3
+	strneb	r1, [ip]		@ assert word-aligned
+	mov	r2, #1
+	and	r3, r0, #31		@ Get bit offset
+	mov	r0, r0, lsr #5
+	add	r1, r1, r0, lsl #2	@ Get word offset
+	mov	r3, r2, lsl r3		@ create mask
+	smp_dmb
+1:	ldrex	r2, [r1]
+	ands	r0, r2, r3		@ save old value of bit
+	\instr	r2, r2, r3		@ toggle bit
+	strex	ip, r2, [r1]
+	cmp	ip, #0
+	bne	1b
+	smp_dmb
+	cmp	r0, #0
+	movne	r0, #1
+2:	bx	lr
+	.endm
 #else
-       .macro  bitop, name, instr
-ENTRY( \name           )
-UNWIND(        .fnstart        )
-       ands    ip, r1, #3
-       strneb  r1, [ip]                @ assert word-aligned
-       and     r2, r0, #31
-       mov     r0, r0, lsr #5
-       mov     r3, #1
-       mov     r3, r3, lsl r2
-       save_and_disable_irqs ip
-       ldr     r2, [r1, r0, lsl #2]
-       \instr  r2, r2, r3
-       str     r2, [r1, r0, lsl #2]
-       restore_irqs ip
-       mov     pc, lr
-UNWIND(        .fnend          )
-ENDPROC(\name          )
-       .endm
+	.macro	bitop, name, instr
+ENTRY(	\name		)
+UNWIND(	.fnstart	)
+	ands	ip, r1, #3
+	strneb	r1, [ip]		@ assert word-aligned
+	and	r2, r0, #31
+	mov	r0, r0, lsr #5
+	mov	r3, #1
+	mov	r3, r3, lsl r2
+	save_and_disable_irqs ip
+	ldr	r2, [r1, r0, lsl #2]
+	\instr	r2, r2, r3
+	str	r2, [r1, r0, lsl #2]
+	restore_irqs ip
+	mov	pc, lr
+UNWIND(	.fnend		)
+ENDPROC(\name		)
+	.endm
 
 /**
  * testop - implement a test_and_xxx_bit operation.
@@ -65,23 +65,23 @@
  * Note: we can trivially conditionalise the store instruction
  * to avoid dirtying the data cache.
  */
-       .macro  testop, name, instr, store
-ENTRY( \name           )
-UNWIND(        .fnstart        )
-       ands    ip, r1, #3
-       strneb  r1, [ip]                @ assert word-aligned
-       and     r3, r0, #31
-       mov     r0, r0, lsr #5
-       save_and_disable_irqs ip
-       ldr     r2, [r1, r0, lsl #2]!
-       mov     r0, #1
-       tst     r2, r0, lsl r3
-       \instr  r2, r2, r0, lsl r3
-       \store  r2, [r1]
-       moveq   r0, #0
-       restore_irqs ip
-       mov     pc, lr
-UNWIND(        .fnend          )
-ENDPROC(\name          )
-       .endm
+	.macro	testop, name, instr, store
+ENTRY(	\name		)
+UNWIND(	.fnstart	)
+	ands	ip, r1, #3
+	strneb	r1, [ip]		@ assert word-aligned
+	and	r3, r0, #31
+	mov	r0, r0, lsr #5
+	save_and_disable_irqs ip
+	ldr	r2, [r1, r0, lsl #2]!
+	mov	r0, #1
+	tst	r2, r0, lsl r3
+	\instr	r2, r2, r0, lsl r3
+	\store	r2, [r1]
+	moveq	r0, #0
+	restore_irqs ip
+	mov	pc, lr
+UNWIND(	.fnend		)
+ENDPROC(\name		)
+	.endm
 #endif
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/changebit.S
--- a/xen/arch/arm/lib/changebit.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/changebit.S	Mon Feb 13 17:26:08 2012 +0000
@@ -14,5 +14,5 @@
                 .text
 
 ENTRY(_change_bit)
-       bitop   eor
+	bitop	eor
 ENDPROC(_change_bit)
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/clearbit.S
--- a/xen/arch/arm/lib/clearbit.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/clearbit.S	Mon Feb 13 17:26:08 2012 +0000
@@ -15,5 +15,5 @@
                 .text
 
 ENTRY(_clear_bit)
-       bitop   bic
+	bitop	bic
 ENDPROC(_clear_bit)
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/copy_template.S
--- a/xen/arch/arm/lib/copy_template.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/copy_template.S	Mon Feb 13 17:26:08 2012 +0000
@@ -3,9 +3,9 @@
  *
  *  Code template for optimized memory copy functions
  *
- *  Author:    Nicolas Pitre
- *  Created:   Sep 28, 2005
- *  Copyright: MontaVista Software, Inc.
+ *  Author:	Nicolas Pitre
+ *  Created:	Sep 28, 2005
+ *  Copyright:	MontaVista Software, Inc.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
@@ -24,227 +24,227 @@
  *
  * ldr1w ptr reg abort
  *
- *     This loads one word from 'ptr', stores it in 'reg' and increments
- *     'ptr' to the next word. The 'abort' argument is used for fixup tables.
+ *	This loads one word from 'ptr', stores it in 'reg' and increments
+ *	'ptr' to the next word. The 'abort' argument is used for fixup tables.
  *
  * ldr4w ptr reg1 reg2 reg3 reg4 abort
  * ldr8w ptr, reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
  *
- *     This loads four or eight words starting from 'ptr', stores them
- *     in provided registers and increments 'ptr' past those words.
- *     The'abort' argument is used for fixup tables.
+ *	This loads four or eight words starting from 'ptr', stores them
+ *	in provided registers and increments 'ptr' past those words.
+ *	The'abort' argument is used for fixup tables.
  *
  * ldr1b ptr reg cond abort
  *
- *     Similar to ldr1w, but it loads a byte and increments 'ptr' one byte.
- *     It also must apply the condition code if provided, otherwise the
- *     "al" condition is assumed by default.
+ *	Similar to ldr1w, but it loads a byte and increments 'ptr' one byte.
+ *	It also must apply the condition code if provided, otherwise the
+ *	"al" condition is assumed by default.
  *
  * str1w ptr reg abort
  * str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
  * str1b ptr reg cond abort
  *
- *     Same as their ldr* counterparts, but data is stored to 'ptr' location
- *     rather than being loaded.
+ *	Same as their ldr* counterparts, but data is stored to 'ptr' location
+ *	rather than being loaded.
  *
  * enter reg1 reg2
  *
- *     Preserve the provided registers on the stack plus any additional
- *     data as needed by the implementation including this code. Called
- *     upon code entry.
+ *	Preserve the provided registers on the stack plus any additional
+ *	data as needed by the implementation including this code. Called
+ *	upon code entry.
  *
  * exit reg1 reg2
  *
- *     Restore registers with the values previously saved with the
- *     'preserv' macro. Called upon code termination.
+ *	Restore registers with the values previously saved with the
+ *	'preserv' macro. Called upon code termination.
  *
  * LDR1W_SHIFT
  * STR1W_SHIFT
  *
- *     Correction to be applied to the "ip" register when branching into
- *     the ldr1w or str1w instructions (some of these macros may expand to
- *     than one 32bit instruction in Thumb-2)
+ *	Correction to be applied to the "ip" register when branching into
+ *	the ldr1w or str1w instructions (some of these macros may expand to
+ *	than one 32bit instruction in Thumb-2)
  */
 
 
-               enter   r4, lr
+		enter	r4, lr
 
-               subs    r2, r2, #4
-               blt     8f
-               ands    ip, r0, #3
-       PLD(    pld     [r1, #0]                )
-               bne     9f
-               ands    ip, r1, #3
-               bne     10f
+		subs	r2, r2, #4
+		blt	8f
+		ands	ip, r0, #3
+	PLD(	pld	[r1, #0]		)
+		bne	9f
+		ands	ip, r1, #3
+		bne	10f
 
-1:             subs    r2, r2, #(28)
-               stmfd   sp!, {r5 - r8}
-               blt     5f
+1:		subs	r2, r2, #(28)
+		stmfd	sp!, {r5 - r8}
+		blt	5f
 
-       CALGN(  ands    ip, r0, #31             )
-       CALGN(  rsb     r3, ip, #32             )
-       CALGN(  sbcnes  r4, r3, r2              )  @ C is always set here
-       CALGN(  bcs     2f                      )
-       CALGN(  adr     r4, 6f                  )
-       CALGN(  subs    r2, r2, r3              )  @ C gets set
-       CALGN(  add     pc, r4, ip              )
+	CALGN(	ands	ip, r0, #31		)
+	CALGN(	rsb	r3, ip, #32		)
+	CALGN(	sbcnes	r4, r3, r2		)  @ C is always set here
+	CALGN(	bcs	2f			)
+	CALGN(	adr	r4, 6f			)
+	CALGN(	subs	r2, r2, r3		)  @ C gets set
+	CALGN(	add	pc, r4, ip		)
 
-       PLD(    pld     [r1, #0]                )
-2:     PLD(    subs    r2, r2, #96             )
-       PLD(    pld     [r1, #28]               )
-       PLD(    blt     4f                      )
-       PLD(    pld     [r1, #60]               )
-       PLD(    pld     [r1, #92]               )
+	PLD(	pld	[r1, #0]		)
+2:	PLD(	subs	r2, r2, #96		)
+	PLD(	pld	[r1, #28]		)
+	PLD(	blt	4f			)
+	PLD(	pld	[r1, #60]		)
+	PLD(	pld	[r1, #92]		)
 
-3:     PLD(    pld     [r1, #124]              )
-4:             ldr8w   r1, r3, r4, r5, r6, r7, r8, ip, lr, abort=20f
-               subs    r2, r2, #32
-               str8w   r0, r3, r4, r5, r6, r7, r8, ip, lr, abort=20f
-               bge     3b
-       PLD(    cmn     r2, #96                 )
-       PLD(    bge     4b                      )
+3:	PLD(	pld	[r1, #124]		)
+4:		ldr8w	r1, r3, r4, r5, r6, r7, r8, ip, lr, abort=20f
+		subs	r2, r2, #32
+		str8w	r0, r3, r4, r5, r6, r7, r8, ip, lr, abort=20f
+		bge	3b
+	PLD(	cmn	r2, #96			)
+	PLD(	bge	4b			)
 
-5:             ands    ip, r2, #28
-               rsb     ip, ip, #32
+5:		ands	ip, r2, #28
+		rsb	ip, ip, #32
 #if LDR1W_SHIFT > 0
-               lsl     ip, ip, #LDR1W_SHIFT
+		lsl	ip, ip, #LDR1W_SHIFT
 #endif
-               addne   pc, pc, ip              @ C is always clear here
-               b       7f
+		addne	pc, pc, ip		@ C is always clear here
+		b	7f
 6:
-               .rept   (1 << LDR1W_SHIFT)
-               W(nop)
-               .endr
-               ldr1w   r1, r3, abort=20f
-               ldr1w   r1, r4, abort=20f
-               ldr1w   r1, r5, abort=20f
-               ldr1w   r1, r6, abort=20f
-               ldr1w   r1, r7, abort=20f
-               ldr1w   r1, r8, abort=20f
-               ldr1w   r1, lr, abort=20f
+		.rept	(1 << LDR1W_SHIFT)
+		W(nop)
+		.endr
+		ldr1w	r1, r3, abort=20f
+		ldr1w	r1, r4, abort=20f
+		ldr1w	r1, r5, abort=20f
+		ldr1w	r1, r6, abort=20f
+		ldr1w	r1, r7, abort=20f
+		ldr1w	r1, r8, abort=20f
+		ldr1w	r1, lr, abort=20f
 
 #if LDR1W_SHIFT < STR1W_SHIFT
-               lsl     ip, ip, #STR1W_SHIFT - LDR1W_SHIFT
+		lsl	ip, ip, #STR1W_SHIFT - LDR1W_SHIFT
 #elif LDR1W_SHIFT > STR1W_SHIFT
-               lsr     ip, ip, #LDR1W_SHIFT - STR1W_SHIFT
+		lsr	ip, ip, #LDR1W_SHIFT - STR1W_SHIFT
 #endif
-               add     pc, pc, ip
-               nop
-               .rept   (1 << STR1W_SHIFT)
-               W(nop)
-               .endr
-               str1w   r0, r3, abort=20f
-               str1w   r0, r4, abort=20f
-               str1w   r0, r5, abort=20f
-               str1w   r0, r6, abort=20f
-               str1w   r0, r7, abort=20f
-               str1w   r0, r8, abort=20f
-               str1w   r0, lr, abort=20f
+		add	pc, pc, ip
+		nop
+		.rept	(1 << STR1W_SHIFT)
+		W(nop)
+		.endr
+		str1w	r0, r3, abort=20f
+		str1w	r0, r4, abort=20f
+		str1w	r0, r5, abort=20f
+		str1w	r0, r6, abort=20f
+		str1w	r0, r7, abort=20f
+		str1w	r0, r8, abort=20f
+		str1w	r0, lr, abort=20f
 
-       CALGN(  bcs     2b                      )
+	CALGN(	bcs	2b			)
 
-7:             ldmfd   sp!, {r5 - r8}
+7:		ldmfd	sp!, {r5 - r8}
 
-8:             movs    r2, r2, lsl #31
-               ldr1b   r1, r3, ne, abort=21f
-               ldr1b   r1, r4, cs, abort=21f
-               ldr1b   r1, ip, cs, abort=21f
-               str1b   r0, r3, ne, abort=21f
-               str1b   r0, r4, cs, abort=21f
-               str1b   r0, ip, cs, abort=21f
+8:		movs	r2, r2, lsl #31
+		ldr1b	r1, r3, ne, abort=21f
+		ldr1b	r1, r4, cs, abort=21f
+		ldr1b	r1, ip, cs, abort=21f
+		str1b	r0, r3, ne, abort=21f
+		str1b	r0, r4, cs, abort=21f
+		str1b	r0, ip, cs, abort=21f
 
-               exit    r4, pc
+		exit	r4, pc
 
-9:             rsb     ip, ip, #4
-               cmp     ip, #2
-               ldr1b   r1, r3, gt, abort=21f
-               ldr1b   r1, r4, ge, abort=21f
-               ldr1b   r1, lr, abort=21f
-               str1b   r0, r3, gt, abort=21f
-               str1b   r0, r4, ge, abort=21f
-               subs    r2, r2, ip
-               str1b   r0, lr, abort=21f
-               blt     8b
-               ands    ip, r1, #3
-               beq     1b
+9:		rsb	ip, ip, #4
+		cmp	ip, #2
+		ldr1b	r1, r3, gt, abort=21f
+		ldr1b	r1, r4, ge, abort=21f
+		ldr1b	r1, lr, abort=21f
+		str1b	r0, r3, gt, abort=21f
+		str1b	r0, r4, ge, abort=21f
+		subs	r2, r2, ip
+		str1b	r0, lr, abort=21f
+		blt	8b
+		ands	ip, r1, #3
+		beq	1b
 
-10:            bic     r1, r1, #3
-               cmp     ip, #2
-               ldr1w   r1, lr, abort=21f
-               beq     17f
-               bgt     18f
+10:		bic	r1, r1, #3
+		cmp	ip, #2
+		ldr1w	r1, lr, abort=21f
+		beq	17f
+		bgt	18f
 
 
-               .macro  forward_copy_shift pull push
+		.macro	forward_copy_shift pull push
 
-               subs    r2, r2, #28
-               blt     14f
+		subs	r2, r2, #28
+		blt	14f
 
-       CALGN(  ands    ip, r0, #31             )
-       CALGN(  rsb     ip, ip, #32             )
-       CALGN(  sbcnes  r4, ip, r2              )  @ C is always set here
-       CALGN(  subcc   r2, r2, ip              )
-       CALGN(  bcc     15f                     )
+	CALGN(	ands	ip, r0, #31		)
+	CALGN(	rsb	ip, ip, #32		)
+	CALGN(	sbcnes	r4, ip, r2		)  @ C is always set here
+	CALGN(	subcc	r2, r2, ip		)
+	CALGN(	bcc	15f			)
 
-11:            stmfd   sp!, {r5 - r9}
+11:		stmfd	sp!, {r5 - r9}
 
-       PLD(    pld     [r1, #0]                )
-       PLD(    subs    r2, r2, #96             )
-       PLD(    pld     [r1, #28]               )
-       PLD(    blt     13f                     )
-       PLD(    pld     [r1, #60]               )
-       PLD(    pld     [r1, #92]               )
+	PLD(	pld	[r1, #0]		)
+	PLD(	subs	r2, r2, #96		)
+	PLD(	pld	[r1, #28]		)
+	PLD(	blt	13f			)
+	PLD(	pld	[r1, #60]		)
+	PLD(	pld	[r1, #92]		)
 
-12:    PLD(    pld     [r1, #124]              )
-13:            ldr4w   r1, r4, r5, r6, r7, abort=19f
-               mov     r3, lr, pull #\pull
-               subs    r2, r2, #32
-               ldr4w   r1, r8, r9, ip, lr, abort=19f
-               orr     r3, r3, r4, push #\push
-               mov     r4, r4, pull #\pull
-               orr     r4, r4, r5, push #\push
-               mov     r5, r5, pull #\pull
-               orr     r5, r5, r6, push #\push
-               mov     r6, r6, pull #\pull
-               orr     r6, r6, r7, push #\push
-               mov     r7, r7, pull #\pull
-               orr     r7, r7, r8, push #\push
-               mov     r8, r8, pull #\pull
-               orr     r8, r8, r9, push #\push
-               mov     r9, r9, pull #\pull
-               orr     r9, r9, ip, push #\push
-               mov     ip, ip, pull #\pull
-               orr     ip, ip, lr, push #\push
-               str8w   r0, r3, r4, r5, r6, r7, r8, r9, ip, , abort=19f
-               bge     12b
-       PLD(    cmn     r2, #96                 )
-       PLD(    bge     13b                     )
+12:	PLD(	pld	[r1, #124]		)
+13:		ldr4w	r1, r4, r5, r6, r7, abort=19f
+		mov	r3, lr, pull #\pull
+		subs	r2, r2, #32
+		ldr4w	r1, r8, r9, ip, lr, abort=19f
+		orr	r3, r3, r4, push #\push
+		mov	r4, r4, pull #\pull
+		orr	r4, r4, r5, push #\push
+		mov	r5, r5, pull #\pull
+		orr	r5, r5, r6, push #\push
+		mov	r6, r6, pull #\pull
+		orr	r6, r6, r7, push #\push
+		mov	r7, r7, pull #\pull
+		orr	r7, r7, r8, push #\push
+		mov	r8, r8, pull #\pull
+		orr	r8, r8, r9, push #\push
+		mov	r9, r9, pull #\pull
+		orr	r9, r9, ip, push #\push
+		mov	ip, ip, pull #\pull
+		orr	ip, ip, lr, push #\push
+		str8w	r0, r3, r4, r5, r6, r7, r8, r9, ip, , abort=19f
+		bge	12b
+	PLD(	cmn	r2, #96			)
+	PLD(	bge	13b			)
 
-               ldmfd   sp!, {r5 - r9}
+		ldmfd	sp!, {r5 - r9}
 
-14:            ands    ip, r2, #28
-               beq     16f
+14:		ands	ip, r2, #28
+		beq	16f
 
-15:            mov     r3, lr, pull #\pull
-               ldr1w   r1, lr, abort=21f
-               subs    ip, ip, #4
-               orr     r3, r3, lr, push #\push
-               str1w   r0, r3, abort=21f
-               bgt     15b
-       CALGN(  cmp     r2, #0                  )
-       CALGN(  bge     11b                     )
+15:		mov	r3, lr, pull #\pull
+		ldr1w	r1, lr, abort=21f
+		subs	ip, ip, #4
+		orr	r3, r3, lr, push #\push
+		str1w	r0, r3, abort=21f
+		bgt	15b
+	CALGN(	cmp	r2, #0			)
+	CALGN(	bge	11b			)
 
-16:            sub     r1, r1, #(\push / 8)
-               b       8b
+16:		sub	r1, r1, #(\push / 8)
+		b	8b
 
-               .endm
+		.endm
 
 
-               forward_copy_shift      pull=8  push=24
+		forward_copy_shift	pull=8	push=24
 
-17:            forward_copy_shift      pull=16 push=16
+17:		forward_copy_shift	pull=16	push=16
 
-18:            forward_copy_shift      pull=24 push=8
+18:		forward_copy_shift	pull=24	push=8
 
 
 /*
@@ -254,14 +254,14 @@
  * the exit macro.
  */
 
-       .macro  copy_abort_preamble
-19:    ldmfd   sp!, {r5 - r9}
-       b       21f
-20:    ldmfd   sp!, {r5 - r8}
+	.macro	copy_abort_preamble
+19:	ldmfd	sp!, {r5 - r9}
+	b	21f
+20:	ldmfd	sp!, {r5 - r8}
 21:
-       .endm
+	.endm
 
-       .macro  copy_abort_end
-       ldmfd   sp!, {r4, pc}
-       .endm
+	.macro	copy_abort_end
+	ldmfd	sp!, {r4, pc}
+	.endm
 
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/div64.S
--- a/xen/arch/arm/lib/div64.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/div64.S	Mon Feb 13 17:26:08 2012 +0000
@@ -3,9 +3,9 @@
  *
  *  Optimized computation of 64-bit dividend / 32-bit divisor
  *
- *  Author:    Nicolas Pitre
- *  Created:   Oct 5, 2003
- *  Copyright: Monta Vista Software, Inc.
+ *  Author:	Nicolas Pitre
+ *  Created:	Oct 5, 2003
+ *  Copyright:	Monta Vista Software, Inc.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
@@ -14,7 +14,7 @@
 
 #include <xen/config.h>
 #include "assembler.h"
-
+	
 #ifdef __ARMEB__
 #define xh r0
 #define xl r1
@@ -34,12 +34,12 @@
  *       This is meant to be used by do_div() from include/asm/div64.h only.
  *
  * Input parameters:
- *     xh-xl   = dividend (clobbered)
- *     r4      = divisor (preserved)
+ * 	xh-xl	= dividend (clobbered)
+ * 	r4	= divisor (preserved)
  *
  * Output values:
- *     yh-yl   = result
- *     xh      = remainder
+ * 	yh-yl	= result
+ * 	xh	= remainder
  *
  * Clobbered regs: xl, ip
  */
@@ -47,165 +47,165 @@
 ENTRY(__do_div64)
 UNWIND(.fnstart)
 
-       @ Test for easy paths first.
-       subs    ip, r4, #1
-       bls     9f                      @ divisor is 0 or 1
-       tst     ip, r4
-       beq     8f                      @ divisor is power of 2
+	@ Test for easy paths first.
+	subs	ip, r4, #1
+	bls	9f			@ divisor is 0 or 1
+	tst	ip, r4
+	beq	8f			@ divisor is power of 2
 
-       @ See if we need to handle upper 32-bit result.
-       cmp     xh, r4
-       mov     yh, #0
-       blo     3f
+	@ See if we need to handle upper 32-bit result.
+	cmp	xh, r4
+	mov	yh, #0
+	blo	3f
 
-       @ Align divisor with upper part of dividend.
-       @ The aligned divisor is stored in yl preserving the original.
-       @ The bit position is stored in ip.
+	@ Align divisor with upper part of dividend.
+	@ The aligned divisor is stored in yl preserving the original.
+	@ The bit position is stored in ip.
 
 #if __LINUX_ARM_ARCH__ >= 5
 
-       clz     yl, r4
-       clz     ip, xh
-       sub     yl, yl, ip
-       mov     ip, #1
-       mov     ip, ip, lsl yl
-       mov     yl, r4, lsl yl
+	clz	yl, r4
+	clz	ip, xh
+	sub	yl, yl, ip
+	mov	ip, #1
+	mov	ip, ip, lsl yl
+	mov	yl, r4, lsl yl
 
 #else
 
-       mov     yl, r4
-       mov     ip, #1
-1:     cmp     yl, #0x80000000
-       cmpcc   yl, xh
-       movcc   yl, yl, lsl #1
-       movcc   ip, ip, lsl #1
-       bcc     1b
+	mov	yl, r4
+	mov	ip, #1
+1:	cmp	yl, #0x80000000
+	cmpcc	yl, xh
+	movcc	yl, yl, lsl #1
+	movcc	ip, ip, lsl #1
+	bcc	1b
 
 #endif
 
-       @ The division loop for needed upper bit positions.
-       @ Break out early if dividend reaches 0.
-2:     cmp     xh, yl
-       orrcs   yh, yh, ip
-       subcss  xh, xh, yl
-       movnes  ip, ip, lsr #1
-       mov     yl, yl, lsr #1
-       bne     2b
+	@ The division loop for needed upper bit positions.
+ 	@ Break out early if dividend reaches 0.
+2:	cmp	xh, yl
+	orrcs	yh, yh, ip
+	subcss	xh, xh, yl
+	movnes	ip, ip, lsr #1
+	mov	yl, yl, lsr #1
+	bne	2b
 
-       @ See if we need to handle lower 32-bit result.
-3:     cmp     xh, #0
-       mov     yl, #0
-       cmpeq   xl, r4
-       movlo   xh, xl
-       movlo   pc, lr
+	@ See if we need to handle lower 32-bit result.
+3:	cmp	xh, #0
+	mov	yl, #0
+	cmpeq	xl, r4
+	movlo	xh, xl
+	movlo	pc, lr
 
-       @ The division loop for lower bit positions.
-       @ Here we shift remainer bits leftwards rather than moving the
-       @ divisor for comparisons, considering the carry-out bit as well.
-       mov     ip, #0x80000000
-4:     movs    xl, xl, lsl #1
-       adcs    xh, xh, xh
-       beq     6f
-       cmpcc   xh, r4
-5:     orrcs   yl, yl, ip
-       subcs   xh, xh, r4
-       movs    ip, ip, lsr #1
-       bne     4b
-       mov     pc, lr
+	@ The division loop for lower bit positions.
+	@ Here we shift remainer bits leftwards rather than moving the
+	@ divisor for comparisons, considering the carry-out bit as well.
+	mov	ip, #0x80000000
+4:	movs	xl, xl, lsl #1
+	adcs	xh, xh, xh
+	beq	6f
+	cmpcc	xh, r4
+5:	orrcs	yl, yl, ip
+	subcs	xh, xh, r4
+	movs	ip, ip, lsr #1
+	bne	4b
+	mov	pc, lr
 
-       @ The top part of remainder became zero.  If carry is set
-       @ (the 33th bit) this is a false positive so resume the loop.
-       @ Otherwise, if lower part is also null then we are done.
-6:     bcs     5b
-       cmp     xl, #0
-       moveq   pc, lr
+	@ The top part of remainder became zero.  If carry is set
+	@ (the 33th bit) this is a false positive so resume the loop.
+	@ Otherwise, if lower part is also null then we are done.
+6:	bcs	5b
+	cmp	xl, #0
+	moveq	pc, lr
 
-       @ We still have remainer bits in the low part.  Bring them up.
+	@ We still have remainer bits in the low part.  Bring them up.
 
 #if __LINUX_ARM_ARCH__ >= 5
 
-       clz     xh, xl                  @ we know xh is zero here so...
-       add     xh, xh, #1
-       mov     xl, xl, lsl xh
-       mov     ip, ip, lsr xh
+	clz	xh, xl			@ we know xh is zero here so...
+	add	xh, xh, #1
+	mov	xl, xl, lsl xh
+	mov	ip, ip, lsr xh
 
 #else
 
-7:     movs    xl, xl, lsl #1
-       mov     ip, ip, lsr #1
-       bcc     7b
+7:	movs	xl, xl, lsl #1
+	mov	ip, ip, lsr #1
+	bcc	7b
 
 #endif
 
-       @ Current remainder is now 1.  It is worthless to compare with
-       @ divisor at this point since divisor can not be smaller than 3 here.
-       @ If possible, branch for another shift in the division loop.
-       @ If no bit position left then we are done.
-       movs    ip, ip, lsr #1
-       mov     xh, #1
-       bne     4b
-       mov     pc, lr
+	@ Current remainder is now 1.  It is worthless to compare with
+	@ divisor at this point since divisor can not be smaller than 3 here.
+	@ If possible, branch for another shift in the division loop.
+	@ If no bit position left then we are done.
+	movs	ip, ip, lsr #1
+	mov	xh, #1
+	bne	4b
+	mov	pc, lr
 
-8:     @ Division by a power of 2: determine what that divisor order is
-       @ then simply shift values around
+8:	@ Division by a power of 2: determine what that divisor order is
+	@ then simply shift values around
 
 #if __LINUX_ARM_ARCH__ >= 5
 
-       clz     ip, r4
-       rsb     ip, ip, #31
+	clz	ip, r4
+	rsb	ip, ip, #31
 
 #else
 
-       mov     yl, r4
-       cmp     r4, #(1 << 16)
-       mov     ip, #0
-       movhs   yl, yl, lsr #16
-       movhs   ip, #16
+	mov	yl, r4
+	cmp	r4, #(1 << 16)
+	mov	ip, #0
+	movhs	yl, yl, lsr #16
+	movhs	ip, #16
 
-       cmp     yl, #(1 << 8)
-       movhs   yl, yl, lsr #8
-       addhs   ip, ip, #8
+	cmp	yl, #(1 << 8)
+	movhs	yl, yl, lsr #8
+	addhs	ip, ip, #8
 
-       cmp     yl, #(1 << 4)
-       movhs   yl, yl, lsr #4
-       addhs   ip, ip, #4
+	cmp	yl, #(1 << 4)
+	movhs	yl, yl, lsr #4
+	addhs	ip, ip, #4
 
-       cmp     yl, #(1 << 2)
-       addhi   ip, ip, #3
-       addls   ip, ip, yl, lsr #1
+	cmp	yl, #(1 << 2)
+	addhi	ip, ip, #3
+	addls	ip, ip, yl, lsr #1
 
 #endif
 
-       mov     yh, xh, lsr ip
-       mov     yl, xl, lsr ip
-       rsb     ip, ip, #32
- ARM(  orr     yl, yl, xh, lsl ip      )
- THUMB(        lsl     xh, xh, ip              )
- THUMB(        orr     yl, yl, xh              )
-       mov     xh, xl, lsl ip
-       mov     xh, xh, lsr ip
-       mov     pc, lr
+	mov	yh, xh, lsr ip
+	mov	yl, xl, lsr ip
+	rsb	ip, ip, #32
+ ARM(	orr	yl, yl, xh, lsl ip	)
+ THUMB(	lsl	xh, xh, ip		)
+ THUMB(	orr	yl, yl, xh		)
+	mov	xh, xl, lsl ip
+	mov	xh, xh, lsr ip
+	mov	pc, lr
 
-       @ eq -> division by 1: obvious enough...
-9:     moveq   yl, xl
-       moveq   yh, xh
-       moveq   xh, #0
-       moveq   pc, lr
+	@ eq -> division by 1: obvious enough...
+9:	moveq	yl, xl
+	moveq	yh, xh
+	moveq	xh, #0
+	moveq	pc, lr
 UNWIND(.fnend)
 
 UNWIND(.fnstart)
 UNWIND(.pad #4)
 UNWIND(.save {lr})
 Ldiv0_64:
-       @ Division by 0:
-       str     lr, [sp, #-8]!
-       bl      __div0
+	@ Division by 0:
+	str	lr, [sp, #-8]!
+	bl	__div0
 
-       @ as wrong as it could be...
-       mov     yl, #0
-       mov     yh, #0
-       mov     xh, #0
-       ldr     pc, [sp], #8
+	@ as wrong as it could be...
+	mov	yl, #0
+	mov	yh, #0
+	mov	xh, #0
+	ldr	pc, [sp], #8
 
 UNWIND(.fnend)
 ENDPROC(__do_div64)
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/findbit.S
--- a/xen/arch/arm/lib/findbit.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/findbit.S	Mon Feb 13 17:26:08 2012 +0000
@@ -24,20 +24,20 @@
  * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit);
  */
 ENTRY(_find_first_zero_bit_le)
-               teq     r1, #0
-               beq     3f
-               mov     r2, #0
+		teq	r1, #0	
+		beq	3f
+		mov	r2, #0
 1:
- ARM(          ldrb    r3, [r0, r2, lsr #3]    )
- THUMB(                lsr     r3, r2, #3              )
- THUMB(                ldrb    r3, [r0, r3]            )
-               eors    r3, r3, #0xff           @ invert bits
-               bne     .L_found                @ any now set - found zero bit
-               add     r2, r2, #8              @ next bit pointer
-2:             cmp     r2, r1                  @ any more?
-               blo     1b
-3:             mov     r0, r1                  @ no free bits
-               mov     pc, lr
+ ARM(		ldrb	r3, [r0, r2, lsr #3]	)
+ THUMB(		lsr	r3, r2, #3		)
+ THUMB(		ldrb	r3, [r0, r3]		)
+		eors	r3, r3, #0xff		@ invert bits
+		bne	.L_found		@ any now set - found zero bit
+		add	r2, r2, #8		@ next bit pointer
+2:		cmp	r2, r1			@ any more?
+		blo	1b
+3:		mov	r0, r1			@ no free bits
+		mov	pc, lr
 ENDPROC(_find_first_zero_bit_le)
 
 /*
@@ -45,19 +45,19 @@
  * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset)
  */
 ENTRY(_find_next_zero_bit_le)
-               teq     r1, #0
-               beq     3b
-               ands    ip, r2, #7
-               beq     1b                      @ If new byte, goto old routine
- ARM(          ldrb    r3, [r0, r2, lsr #3]    )
- THUMB(                lsr     r3, r2, #3              )
- THUMB(                ldrb    r3, [r0, r3]            )
-               eor     r3, r3, #0xff           @ now looking for a 1 bit
-               movs    r3, r3, lsr ip          @ shift off unused bits
-               bne     .L_found
-               orr     r2, r2, #7              @ if zero, then no bits here
-               add     r2, r2, #1              @ align bit pointer
-               b       2b                      @ loop for next bit
+		teq	r1, #0
+		beq	3b
+		ands	ip, r2, #7
+		beq	1b			@ If new byte, goto old routine
+ ARM(		ldrb	r3, [r0, r2, lsr #3]	)
+ THUMB(		lsr	r3, r2, #3		)
+ THUMB(		ldrb	r3, [r0, r3]		)
+		eor	r3, r3, #0xff		@ now looking for a 1 bit
+		movs	r3, r3, lsr ip		@ shift off unused bits
+		bne	.L_found
+		orr	r2, r2, #7		@ if zero, then no bits here
+		add	r2, r2, #1		@ align bit pointer
+		b	2b			@ loop for next bit
 ENDPROC(_find_next_zero_bit_le)
 
 /*
@@ -65,20 +65,20 @@
  * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit);
  */
 ENTRY(_find_first_bit_le)
-               teq     r1, #0
-               beq     3f
-               mov     r2, #0
+		teq	r1, #0	
+		beq	3f
+		mov	r2, #0
 1:
- ARM(          ldrb    r3, [r0, r2, lsr #3]    )
- THUMB(                lsr     r3, r2, #3              )
- THUMB(                ldrb    r3, [r0, r3]            )
-               movs    r3, r3
-               bne     .L_found                @ any now set - found zero bit
-               add     r2, r2, #8              @ next bit pointer
-2:             cmp     r2, r1                  @ any more?
-               blo     1b
-3:             mov     r0, r1                  @ no free bits
-               mov     pc, lr
+ ARM(		ldrb	r3, [r0, r2, lsr #3]	)
+ THUMB(		lsr	r3, r2, #3		)
+ THUMB(		ldrb	r3, [r0, r3]		)
+		movs	r3, r3
+		bne	.L_found		@ any now set - found zero bit
+		add	r2, r2, #8		@ next bit pointer
+2:		cmp	r2, r1			@ any more?
+		blo	1b
+3:		mov	r0, r1			@ no free bits
+		mov	pc, lr
 ENDPROC(_find_first_bit_le)
 
 /*
@@ -86,87 +86,87 @@
  * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset)
  */
 ENTRY(_find_next_bit_le)
-               teq     r1, #0
-               beq     3b
-               ands    ip, r2, #7
-               beq     1b                      @ If new byte, goto old routine
- ARM(          ldrb    r3, [r0, r2, lsr #3]    )
- THUMB(                lsr     r3, r2, #3              )
- THUMB(                ldrb    r3, [r0, r3]            )
-               movs    r3, r3, lsr ip          @ shift off unused bits
-               bne     .L_found
-               orr     r2, r2, #7              @ if zero, then no bits here
-               add     r2, r2, #1              @ align bit pointer
-               b       2b                      @ loop for next bit
+		teq	r1, #0
+		beq	3b
+		ands	ip, r2, #7
+		beq	1b			@ If new byte, goto old routine
+ ARM(		ldrb	r3, [r0, r2, lsr #3]	)
+ THUMB(		lsr	r3, r2, #3		)
+ THUMB(		ldrb	r3, [r0, r3]		)
+		movs	r3, r3, lsr ip		@ shift off unused bits
+		bne	.L_found
+		orr	r2, r2, #7		@ if zero, then no bits here
+		add	r2, r2, #1		@ align bit pointer
+		b	2b			@ loop for next bit
 ENDPROC(_find_next_bit_le)
 
 #ifdef __ARMEB__
 
 ENTRY(_find_first_zero_bit_be)
-               teq     r1, #0
-               beq     3f
-               mov     r2, #0
-1:             eor     r3, r2, #0x18           @ big endian byte ordering
- ARM(          ldrb    r3, [r0, r3, lsr #3]    )
- THUMB(                lsr     r3, #3                  )
- THUMB(                ldrb    r3, [r0, r3]            )
-               eors    r3, r3, #0xff           @ invert bits
-               bne     .L_found                @ any now set - found zero bit
-               add     r2, r2, #8              @ next bit pointer
-2:             cmp     r2, r1                  @ any more?
-               blo     1b
-3:             mov     r0, r1                  @ no free bits
-               mov     pc, lr
+		teq	r1, #0
+		beq	3f
+		mov	r2, #0
+1:		eor	r3, r2, #0x18		@ big endian byte ordering
+ ARM(		ldrb	r3, [r0, r3, lsr #3]	)
+ THUMB(		lsr	r3, #3			)
+ THUMB(		ldrb	r3, [r0, r3]		)
+		eors	r3, r3, #0xff		@ invert bits
+		bne	.L_found		@ any now set - found zero bit
+		add	r2, r2, #8		@ next bit pointer
+2:		cmp	r2, r1			@ any more?
+		blo	1b
+3:		mov	r0, r1			@ no free bits
+		mov	pc, lr
 ENDPROC(_find_first_zero_bit_be)
 
 ENTRY(_find_next_zero_bit_be)
-               teq     r1, #0
-               beq     3b
-               ands    ip, r2, #7
-               beq     1b                      @ If new byte, goto old routine
-               eor     r3, r2, #0x18           @ big endian byte ordering
- ARM(          ldrb    r3, [r0, r3, lsr #3]    )
- THUMB(                lsr     r3, #3                  )
- THUMB(                ldrb    r3, [r0, r3]            )
-               eor     r3, r3, #0xff           @ now looking for a 1 bit
-               movs    r3, r3, lsr ip          @ shift off unused bits
-               bne     .L_found
-               orr     r2, r2, #7              @ if zero, then no bits here
-               add     r2, r2, #1              @ align bit pointer
-               b       2b                      @ loop for next bit
+		teq	r1, #0
+		beq	3b
+		ands	ip, r2, #7
+		beq	1b			@ If new byte, goto old routine
+		eor	r3, r2, #0x18		@ big endian byte ordering
+ ARM(		ldrb	r3, [r0, r3, lsr #3]	)
+ THUMB(		lsr	r3, #3			)
+ THUMB(		ldrb	r3, [r0, r3]		)
+		eor	r3, r3, #0xff		@ now looking for a 1 bit
+		movs	r3, r3, lsr ip		@ shift off unused bits
+		bne	.L_found
+		orr	r2, r2, #7		@ if zero, then no bits here
+		add	r2, r2, #1		@ align bit pointer
+		b	2b			@ loop for next bit
 ENDPROC(_find_next_zero_bit_be)
 
 ENTRY(_find_first_bit_be)
-               teq     r1, #0
-               beq     3f
-               mov     r2, #0
-1:             eor     r3, r2, #0x18           @ big endian byte ordering
- ARM(          ldrb    r3, [r0, r3, lsr #3]    )
- THUMB(                lsr     r3, #3                  )
- THUMB(                ldrb    r3, [r0, r3]            )
-               movs    r3, r3
-               bne     .L_found                @ any now set - found zero bit
-               add     r2, r2, #8              @ next bit pointer
-2:             cmp     r2, r1                  @ any more?
-               blo     1b
-3:             mov     r0, r1                  @ no free bits
-               mov     pc, lr
+		teq	r1, #0
+		beq	3f
+		mov	r2, #0
+1:		eor	r3, r2, #0x18		@ big endian byte ordering
+ ARM(		ldrb	r3, [r0, r3, lsr #3]	)
+ THUMB(		lsr	r3, #3			)
+ THUMB(		ldrb	r3, [r0, r3]		)
+		movs	r3, r3
+		bne	.L_found		@ any now set - found zero bit
+		add	r2, r2, #8		@ next bit pointer
+2:		cmp	r2, r1			@ any more?
+		blo	1b
+3:		mov	r0, r1			@ no free bits
+		mov	pc, lr
 ENDPROC(_find_first_bit_be)
 
 ENTRY(_find_next_bit_be)
-               teq     r1, #0
-               beq     3b
-               ands    ip, r2, #7
-               beq     1b                      @ If new byte, goto old routine
-               eor     r3, r2, #0x18           @ big endian byte ordering
- ARM(          ldrb    r3, [r0, r3, lsr #3]    )
- THUMB(                lsr     r3, #3                  )
- THUMB(                ldrb    r3, [r0, r3]            )
-               movs    r3, r3, lsr ip          @ shift off unused bits
-               bne     .L_found
-               orr     r2, r2, #7              @ if zero, then no bits here
-               add     r2, r2, #1              @ align bit pointer
-               b       2b                      @ loop for next bit
+		teq	r1, #0
+		beq	3b
+		ands	ip, r2, #7
+		beq	1b			@ If new byte, goto old routine
+		eor	r3, r2, #0x18		@ big endian byte ordering
+ ARM(		ldrb	r3, [r0, r3, lsr #3]	)
+ THUMB(		lsr	r3, #3			)
+ THUMB(		ldrb	r3, [r0, r3]		)
+		movs	r3, r3, lsr ip		@ shift off unused bits
+		bne	.L_found
+		orr	r2, r2, #7		@ if zero, then no bits here
+		add	r2, r2, #1		@ align bit pointer
+		b	2b			@ loop for next bit
 ENDPROC(_find_next_bit_be)
 
 #endif
@@ -176,23 +176,23 @@
  */
 .L_found:
 #if __LINUX_ARM_ARCH__ >= 5
-               rsb     r0, r3, #0
-               and     r3, r3, r0
-               clz     r3, r3
-               rsb     r3, r3, #31
-               add     r0, r2, r3
+		rsb	r0, r3, #0
+		and	r3, r3, r0
+		clz	r3, r3
+		rsb	r3, r3, #31
+		add	r0, r2, r3
 #else
-               tst     r3, #0x0f
-               addeq   r2, r2, #4
-               movne   r3, r3, lsl #4
-               tst     r3, #0x30
-               addeq   r2, r2, #2
-               movne   r3, r3, lsl #2
-               tst     r3, #0x40
-               addeq   r2, r2, #1
-               mov     r0, r2
+		tst	r3, #0x0f
+		addeq	r2, r2, #4
+		movne	r3, r3, lsl #4
+		tst	r3, #0x30
+		addeq	r2, r2, #2
+		movne	r3, r3, lsl #2
+		tst	r3, #0x40
+		addeq	r2, r2, #1
+		mov	r0, r2
 #endif
-               cmp     r1, r0                  @ Clamp to maxbit
-               movlo   r0, r1
-               mov     pc, lr
+		cmp	r1, r0			@ Clamp to maxbit
+		movlo	r0, r1
+		mov	pc, lr
 
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/lib1funcs.S
--- a/xen/arch/arm/lib/lib1funcs.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/lib1funcs.S	Mon Feb 13 17:26:08 2012 +0000
@@ -40,64 +40,64 @@
 
 #if __LINUX_ARM_ARCH__ >= 5
 
-       clz     \curbit, \divisor
-       clz     \result, \dividend
-       sub     \result, \curbit, \result
-       mov     \curbit, #1
-       mov     \divisor, \divisor, lsl \result
-       mov     \curbit, \curbit, lsl \result
-       mov     \result, #0
-
+	clz	\curbit, \divisor
+	clz	\result, \dividend
+	sub	\result, \curbit, \result
+	mov	\curbit, #1
+	mov	\divisor, \divisor, lsl \result
+	mov	\curbit, \curbit, lsl \result
+	mov	\result, #0
+	
 #else
 
-       @ Initially shift the divisor left 3 bits if possible,
-       @ set curbit accordingly.  This allows for curbit to be located
-       @ at the left end of each 4 bit nibbles in the division loop
-       @ to save one loop in most cases.
-       tst     \divisor, #0xe0000000
-       moveq   \divisor, \divisor, lsl #3
-       moveq   \curbit, #8
-       movne   \curbit, #1
+	@ Initially shift the divisor left 3 bits if possible,
+	@ set curbit accordingly.  This allows for curbit to be located
+	@ at the left end of each 4 bit nibbles in the division loop
+	@ to save one loop in most cases.
+	tst	\divisor, #0xe0000000
+	moveq	\divisor, \divisor, lsl #3
+	moveq	\curbit, #8
+	movne	\curbit, #1
 
-       @ Unless the divisor is very big, shift it up in multiples of
-       @ four bits, since this is the amount of unwinding in the main
-       @ division loop.  Continue shifting until the divisor is
-       @ larger than the dividend.
-1:     cmp     \divisor, #0x10000000
-       cmplo   \divisor, \dividend
-       movlo   \divisor, \divisor, lsl #4
-       movlo   \curbit, \curbit, lsl #4
-       blo     1b
+	@ Unless the divisor is very big, shift it up in multiples of
+	@ four bits, since this is the amount of unwinding in the main
+	@ division loop.  Continue shifting until the divisor is 
+	@ larger than the dividend.
+1:	cmp	\divisor, #0x10000000
+	cmplo	\divisor, \dividend
+	movlo	\divisor, \divisor, lsl #4
+	movlo	\curbit, \curbit, lsl #4
+	blo	1b
 
-       @ For very big divisors, we must shift it a bit at a time, or
-       @ we will be in danger of overflowing.
-1:     cmp     \divisor, #0x80000000
-       cmplo   \divisor, \dividend
-       movlo   \divisor, \divisor, lsl #1
-       movlo   \curbit, \curbit, lsl #1
-       blo     1b
+	@ For very big divisors, we must shift it a bit at a time, or
+	@ we will be in danger of overflowing.
+1:	cmp	\divisor, #0x80000000
+	cmplo	\divisor, \dividend
+	movlo	\divisor, \divisor, lsl #1
+	movlo	\curbit, \curbit, lsl #1
+	blo	1b
 
-       mov     \result, #0
+	mov	\result, #0
 
 #endif
 
-       @ Division loop
-1:     cmp     \dividend, \divisor
-       subhs   \dividend, \dividend, \divisor
-       orrhs   \result,   \result,   \curbit
-       cmp     \dividend, \divisor,  lsr #1
-       subhs   \dividend, \dividend, \divisor, lsr #1
-       orrhs   \result,   \result,   \curbit,  lsr #1
-       cmp     \dividend, \divisor,  lsr #2
-       subhs   \dividend, \dividend, \divisor, lsr #2
-       orrhs   \result,   \result,   \curbit,  lsr #2
-       cmp     \dividend, \divisor,  lsr #3
-       subhs   \dividend, \dividend, \divisor, lsr #3
-       orrhs   \result,   \result,   \curbit,  lsr #3
-       cmp     \dividend, #0                   @ Early termination?
-       movnes  \curbit,   \curbit,  lsr #4     @ No, any more bits to do?
-       movne   \divisor,  \divisor, lsr #4
-       bne     1b
+	@ Division loop
+1:	cmp	\dividend, \divisor
+	subhs	\dividend, \dividend, \divisor
+	orrhs	\result,   \result,   \curbit
+	cmp	\dividend, \divisor,  lsr #1
+	subhs	\dividend, \dividend, \divisor, lsr #1
+	orrhs	\result,   \result,   \curbit,  lsr #1
+	cmp	\dividend, \divisor,  lsr #2
+	subhs	\dividend, \dividend, \divisor, lsr #2
+	orrhs	\result,   \result,   \curbit,  lsr #2
+	cmp	\dividend, \divisor,  lsr #3
+	subhs	\dividend, \dividend, \divisor, lsr #3
+	orrhs	\result,   \result,   \curbit,  lsr #3
+	cmp	\dividend, #0			@ Early termination?
+	movnes	\curbit,   \curbit,  lsr #4	@ No, any more bits to do?
+	movne	\divisor,  \divisor, lsr #4
+	bne	1b
 
 .endm
 
@@ -106,27 +106,27 @@
 
 #if __LINUX_ARM_ARCH__ >= 5
 
-       clz     \order, \divisor
-       rsb     \order, \order, #31
+	clz	\order, \divisor
+	rsb	\order, \order, #31
 
 #else
 
-       cmp     \divisor, #(1 << 16)
-       movhs   \divisor, \divisor, lsr #16
-       movhs   \order, #16
-       movlo   \order, #0
+	cmp	\divisor, #(1 << 16)
+	movhs	\divisor, \divisor, lsr #16
+	movhs	\order, #16
+	movlo	\order, #0
 
-       cmp     \divisor, #(1 << 8)
-       movhs   \divisor, \divisor, lsr #8
-       addhs   \order, \order, #8
+	cmp	\divisor, #(1 << 8)
+	movhs	\divisor, \divisor, lsr #8
+	addhs	\order, \order, #8
 
-       cmp     \divisor, #(1 << 4)
-       movhs   \divisor, \divisor, lsr #4
-       addhs   \order, \order, #4
+	cmp	\divisor, #(1 << 4)
+	movhs	\divisor, \divisor, lsr #4
+	addhs	\order, \order, #4
 
-       cmp     \divisor, #(1 << 2)
-       addhi   \order, \order, #3
-       addls   \order, \order, \divisor, lsr #1
+	cmp	\divisor, #(1 << 2)
+	addhi	\order, \order, #3
+	addls	\order, \order, \divisor, lsr #1
 
 #endif
 
@@ -137,69 +137,69 @@
 
 #if __LINUX_ARM_ARCH__ >= 5
 
-       clz     \order, \divisor
-       clz     \spare, \dividend
-       sub     \order, \order, \spare
-       mov     \divisor, \divisor, lsl \order
+	clz	\order, \divisor
+	clz	\spare, \dividend
+	sub	\order, \order, \spare
+	mov	\divisor, \divisor, lsl \order
 
 #else
 
-       mov     \order, #0
+	mov	\order, #0
 
-       @ Unless the divisor is very big, shift it up in multiples of
-       @ four bits, since this is the amount of unwinding in the main
-       @ division loop.  Continue shifting until the divisor is
-       @ larger than the dividend.
-1:     cmp     \divisor, #0x10000000
-       cmplo   \divisor, \dividend
-       movlo   \divisor, \divisor, lsl #4
-       addlo   \order, \order, #4
-       blo     1b
+	@ Unless the divisor is very big, shift it up in multiples of
+	@ four bits, since this is the amount of unwinding in the main
+	@ division loop.  Continue shifting until the divisor is 
+	@ larger than the dividend.
+1:	cmp	\divisor, #0x10000000
+	cmplo	\divisor, \dividend
+	movlo	\divisor, \divisor, lsl #4
+	addlo	\order, \order, #4
+	blo	1b
 
-       @ For very big divisors, we must shift it a bit at a time, or
-       @ we will be in danger of overflowing.
-1:     cmp     \divisor, #0x80000000
-       cmplo   \divisor, \dividend
-       movlo   \divisor, \divisor, lsl #1
-       addlo   \order, \order, #1
-       blo     1b
+	@ For very big divisors, we must shift it a bit at a time, or
+	@ we will be in danger of overflowing.
+1:	cmp	\divisor, #0x80000000
+	cmplo	\divisor, \dividend
+	movlo	\divisor, \divisor, lsl #1
+	addlo	\order, \order, #1
+	blo	1b
 
 #endif
 
-       @ Perform all needed substractions to keep only the reminder.
-       @ Do comparisons in batch of 4 first.
-       subs    \order, \order, #3              @ yes, 3 is intended here
-       blt     2f
+	@ Perform all needed substractions to keep only the reminder.
+	@ Do comparisons in batch of 4 first.
+	subs	\order, \order, #3		@ yes, 3 is intended here
+	blt	2f
 
-1:     cmp     \dividend, \divisor
-       subhs   \dividend, \dividend, \divisor
-       cmp     \dividend, \divisor,  lsr #1
-       subhs   \dividend, \dividend, \divisor, lsr #1
-       cmp     \dividend, \divisor,  lsr #2
-       subhs   \dividend, \dividend, \divisor, lsr #2
-       cmp     \dividend, \divisor,  lsr #3
-       subhs   \dividend, \dividend, \divisor, lsr #3
-       cmp     \dividend, #1
-       mov     \divisor, \divisor, lsr #4
-       subges  \order, \order, #4
-       bge     1b
+1:	cmp	\dividend, \divisor
+	subhs	\dividend, \dividend, \divisor
+	cmp	\dividend, \divisor,  lsr #1
+	subhs	\dividend, \dividend, \divisor, lsr #1
+	cmp	\dividend, \divisor,  lsr #2
+	subhs	\dividend, \dividend, \divisor, lsr #2
+	cmp	\dividend, \divisor,  lsr #3
+	subhs	\dividend, \dividend, \divisor, lsr #3
+	cmp	\dividend, #1
+	mov	\divisor, \divisor, lsr #4
+	subges	\order, \order, #4
+	bge	1b
 
-       tst     \order, #3
-       teqne   \dividend, #0
-       beq     5f
+	tst	\order, #3
+	teqne	\dividend, #0
+	beq	5f
 
-       @ Either 1, 2 or 3 comparison/substractions are left.
-2:     cmn     \order, #2
-       blt     4f
-       beq     3f
-       cmp     \dividend, \divisor
-       subhs   \dividend, \dividend, \divisor
-       mov     \divisor,  \divisor,  lsr #1
-3:     cmp     \dividend, \divisor
-       subhs   \dividend, \dividend, \divisor
-       mov     \divisor,  \divisor,  lsr #1
-4:     cmp     \dividend, \divisor
-       subhs   \dividend, \dividend, \divisor
+	@ Either 1, 2 or 3 comparison/substractions are left.
+2:	cmn	\order, #2
+	blt	4f
+	beq	3f
+	cmp	\dividend, \divisor
+	subhs	\dividend, \dividend, \divisor
+	mov	\divisor,  \divisor,  lsr #1
+3:	cmp	\dividend, \divisor
+	subhs	\dividend, \dividend, \divisor
+	mov	\divisor,  \divisor,  lsr #1
+4:	cmp	\dividend, \divisor
+	subhs	\dividend, \dividend, \divisor
 5:
 .endm
 
@@ -208,27 +208,27 @@
 ENTRY(__aeabi_uidiv)
 UNWIND(.fnstart)
 
-       subs    r2, r1, #1
-       moveq   pc, lr
-       bcc     Ldiv0
-       cmp     r0, r1
-       bls     11f
-       tst     r1, r2
-       beq     12f
+	subs	r2, r1, #1
+	moveq	pc, lr
+	bcc	Ldiv0
+	cmp	r0, r1
+	bls	11f
+	tst	r1, r2
+	beq	12f
 
-       ARM_DIV_BODY r0, r1, r2, r3
+	ARM_DIV_BODY r0, r1, r2, r3
 
-       mov     r0, r2
-       mov     pc, lr
+	mov	r0, r2
+	mov	pc, lr
 
-11:    moveq   r0, #1
-       movne   r0, #0
-       mov     pc, lr
+11:	moveq	r0, #1
+	movne	r0, #0
+	mov	pc, lr
 
-12:    ARM_DIV2_ORDER r1, r2
+12:	ARM_DIV2_ORDER r1, r2
 
-       mov     r0, r0, lsr r2
-       mov     pc, lr
+	mov	r0, r0, lsr r2
+	mov	pc, lr
 
 UNWIND(.fnend)
 ENDPROC(__udivsi3)
@@ -237,17 +237,17 @@
 ENTRY(__umodsi3)
 UNWIND(.fnstart)
 
-       subs    r2, r1, #1                      @ compare divisor with 1
-       bcc     Ldiv0
-       cmpne   r0, r1                          @ compare dividend with divisor
-       moveq   r0, #0
-       tsthi   r1, r2                          @ see if divisor is power of 2
-       andeq   r0, r0, r2
-       movls   pc, lr
+	subs	r2, r1, #1			@ compare divisor with 1
+	bcc	Ldiv0
+	cmpne	r0, r1				@ compare dividend with divisor
+	moveq   r0, #0
+	tsthi	r1, r2				@ see if divisor is power of 2
+	andeq	r0, r0, r2
+	movls	pc, lr
 
-       ARM_MOD_BODY r0, r1, r2, r3
+	ARM_MOD_BODY r0, r1, r2, r3
 
-       mov     pc, lr
+	mov	pc, lr
 
 UNWIND(.fnend)
 ENDPROC(__umodsi3)
@@ -256,40 +256,40 @@
 ENTRY(__aeabi_idiv)
 UNWIND(.fnstart)
 
-       cmp     r1, #0
-       eor     ip, r0, r1                      @ save the sign of the result.
-       beq     Ldiv0
-       rsbmi   r1, r1, #0                      @ loops below use unsigned.
-       subs    r2, r1, #1                      @ division by 1 or -1 ?
-       beq     10f
-       movs    r3, r0
-       rsbmi   r3, r0, #0                      @ positive dividend value
-       cmp     r3, r1
-       bls     11f
-       tst     r1, r2                          @ divisor is power of 2 ?
-       beq     12f
+	cmp	r1, #0
+	eor	ip, r0, r1			@ save the sign of the result.
+	beq	Ldiv0
+	rsbmi	r1, r1, #0			@ loops below use unsigned.
+	subs	r2, r1, #1			@ division by 1 or -1 ?
+	beq	10f
+	movs	r3, r0
+	rsbmi	r3, r0, #0			@ positive dividend value
+	cmp	r3, r1
+	bls	11f
+	tst	r1, r2				@ divisor is power of 2 ?
+	beq	12f
 
-       ARM_DIV_BODY r3, r1, r0, r2
+	ARM_DIV_BODY r3, r1, r0, r2
 
-       cmp     ip, #0
-       rsbmi   r0, r0, #0
-       mov     pc, lr
+	cmp	ip, #0
+	rsbmi	r0, r0, #0
+	mov	pc, lr
 
-10:    teq     ip, r0                          @ same sign ?
-       rsbmi   r0, r0, #0
-       mov     pc, lr
+10:	teq	ip, r0				@ same sign ?
+	rsbmi	r0, r0, #0
+	mov	pc, lr
 
-11:    movlo   r0, #0
-       moveq   r0, ip, asr #31
-       orreq   r0, r0, #1
-       mov     pc, lr
+11:	movlo	r0, #0
+	moveq	r0, ip, asr #31
+	orreq	r0, r0, #1
+	mov	pc, lr
 
-12:    ARM_DIV2_ORDER r1, r2
+12:	ARM_DIV2_ORDER r1, r2
 
-       cmp     ip, #0
-       mov     r0, r3, lsr r2
-       rsbmi   r0, r0, #0
-       mov     pc, lr
+	cmp	ip, #0
+	mov	r0, r3, lsr r2
+	rsbmi	r0, r0, #0
+	mov	pc, lr
 
 UNWIND(.fnend)
 ENDPROC(__divsi3)
@@ -298,23 +298,23 @@
 ENTRY(__modsi3)
 UNWIND(.fnstart)
 
-       cmp     r1, #0
-       beq     Ldiv0
-       rsbmi   r1, r1, #0                      @ loops below use unsigned.
-       movs    ip, r0                          @ preserve sign of dividend
-       rsbmi   r0, r0, #0                      @ if negative make positive
-       subs    r2, r1, #1                      @ compare divisor with 1
-       cmpne   r0, r1                          @ compare dividend with divisor
-       moveq   r0, #0
-       tsthi   r1, r2                          @ see if divisor is power of 2
-       andeq   r0, r0, r2
-       bls     10f
+	cmp	r1, #0
+	beq	Ldiv0
+	rsbmi	r1, r1, #0			@ loops below use unsigned.
+	movs	ip, r0				@ preserve sign of dividend
+	rsbmi	r0, r0, #0			@ if negative make positive
+	subs	r2, r1, #1			@ compare divisor with 1
+	cmpne	r0, r1				@ compare dividend with divisor
+	moveq	r0, #0
+	tsthi	r1, r2				@ see if divisor is power of 2
+	andeq	r0, r0, r2
+	bls	10f
 
-       ARM_MOD_BODY r0, r1, r2, r3
+	ARM_MOD_BODY r0, r1, r2, r3
 
-10:    cmp     ip, #0
-       rsbmi   r0, r0, #0
-       mov     pc, lr
+10:	cmp	ip, #0
+	rsbmi	r0, r0, #0
+	mov	pc, lr
 
 UNWIND(.fnend)
 ENDPROC(__modsi3)
@@ -323,56 +323,56 @@
 
 ENTRY(__aeabi_uidivmod)
 UNWIND(.fnstart)
-UNWIND(.save {r0, r1, ip, lr}  )
+UNWIND(.save {r0, r1, ip, lr}	)
 
-       stmfd   sp!, {r0, r1, ip, lr}
-       bl      __aeabi_uidiv
-       ldmfd   sp!, {r1, r2, ip, lr}
-       mul     r3, r0, r2
-       sub     r1, r1, r3
-       mov     pc, lr
+	stmfd	sp!, {r0, r1, ip, lr}
+	bl	__aeabi_uidiv
+	ldmfd	sp!, {r1, r2, ip, lr}
+	mul	r3, r0, r2
+	sub	r1, r1, r3
+	mov	pc, lr
 
 UNWIND(.fnend)
 ENDPROC(__aeabi_uidivmod)
 
 ENTRY(__aeabi_idivmod)
 UNWIND(.fnstart)
-UNWIND(.save {r0, r1, ip, lr}  )
-       stmfd   sp!, {r0, r1, ip, lr}
-       bl      __aeabi_idiv
-       ldmfd   sp!, {r1, r2, ip, lr}
-       mul     r3, r0, r2
-       sub     r1, r1, r3
-       mov     pc, lr
+UNWIND(.save {r0, r1, ip, lr}	)
+	stmfd	sp!, {r0, r1, ip, lr}
+	bl	__aeabi_idiv
+	ldmfd	sp!, {r1, r2, ip, lr}
+	mul	r3, r0, r2
+	sub	r1, r1, r3
+	mov	pc, lr
 
 UNWIND(.fnend)
 ENDPROC(__aeabi_idivmod)
 
 ENTRY(__aeabi_uldivmod)
 UNWIND(.fnstart)
-UNWIND(.save {lr}      )
-       sub sp, sp, #8
-       stmfd   sp!, {sp, lr}
-       bl __qdivrem
-       ldr lr, [sp, #4]
-       add sp, sp, #8
-       ldmfd sp!, {r2, r3}
-       mov     pc, lr
+UNWIND(.save {lr}	)
+	sub sp, sp, #8
+	stmfd   sp!, {sp, lr}
+	bl __qdivrem
+	ldr lr, [sp, #4]
+	add sp, sp, #8
+	ldmfd sp!, {r2, r3}
+	mov	pc, lr
 
 UNWIND(.fnend)
 ENDPROC(__aeabi_uldivmod)
 
 ENTRY(__aeabi_ldivmod)
 UNWIND(.fnstart)
-UNWIND(.save {lr}      )
-       sub sp, sp, #16
-       stmfd   sp!, {sp, lr}
-       bl __ldivmod_helper
-       ldr lr, [sp, #4]
-       add sp, sp, #16
-       ldmfd   sp!, {r2, r3}
-       mov     pc, lr
-
+UNWIND(.save {lr}	)
+	sub sp, sp, #16
+	stmfd   sp!, {sp, lr}
+	bl __ldivmod_helper
+	ldr lr, [sp, #4]
+	add sp, sp, #16
+	ldmfd	sp!, {r2, r3}
+	mov	pc, lr
+	
 UNWIND(.fnend)
 ENDPROC(__aeabi_ldivmod)
 #endif
@@ -381,9 +381,9 @@
 UNWIND(.fnstart)
 UNWIND(.pad #4)
 UNWIND(.save {lr})
-       str     lr, [sp, #-8]!
-       bl      __div0
-       mov     r0, #0                  @ About as wrong as it could be.
-       ldr     pc, [sp], #8
+	str	lr, [sp, #-8]!
+	bl	__div0
+	mov	r0, #0			@ About as wrong as it could be.
+	ldr	pc, [sp], #8
 UNWIND(.fnend)
 ENDPROC(Ldiv0)
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/memcpy.S
--- a/xen/arch/arm/lib/memcpy.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/memcpy.S	Mon Feb 13 17:26:08 2012 +0000
@@ -1,9 +1,9 @@
 /*
  *  linux/arch/arm/lib/memcpy.S
  *
- *  Author:    Nicolas Pitre
- *  Created:   Sep 28, 2005
- *  Copyright: MontaVista Software, Inc.
+ *  Author:	Nicolas Pitre
+ *  Created:	Sep 28, 2005
+ *  Copyright:	MontaVista Software, Inc.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
@@ -13,46 +13,46 @@
 #include <xen/config.h>
 #include "assembler.h"
 
-#define LDR1W_SHIFT    0
-#define STR1W_SHIFT    0
+#define LDR1W_SHIFT	0
+#define STR1W_SHIFT	0
 
-       .macro ldr1w ptr reg abort
-       W(ldr) \reg, [\ptr], #4
-       .endm
+	.macro ldr1w ptr reg abort
+	W(ldr) \reg, [\ptr], #4
+	.endm
 
-       .macro ldr4w ptr reg1 reg2 reg3 reg4 abort
-       ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4}
-       .endm
+	.macro ldr4w ptr reg1 reg2 reg3 reg4 abort
+	ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4}
+	.endm
 
-       .macro ldr8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
-       ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8}
-       .endm
+	.macro ldr8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
+	ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8}
+	.endm
 
-       .macro ldr1b ptr reg cond=al abort
-       ldr\cond\()b \reg, [\ptr], #1
-       .endm
+	.macro ldr1b ptr reg cond=al abort
+	ldr\cond\()b \reg, [\ptr], #1
+	.endm
 
-       .macro str1w ptr reg abort
-       W(str) \reg, [\ptr], #4
-       .endm
+	.macro str1w ptr reg abort
+	W(str) \reg, [\ptr], #4
+	.endm
 
-       .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
-       stmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8}
-       .endm
+	.macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
+	stmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8}
+	.endm
 
-       .macro str1b ptr reg cond=al abort
-       str\cond\()b \reg, [\ptr], #1
-       .endm
+	.macro str1b ptr reg cond=al abort
+	str\cond\()b \reg, [\ptr], #1
+	.endm
 
-       .macro enter reg1 reg2
-       stmdb sp!, {r0, \reg1, \reg2}
-       .endm
+	.macro enter reg1 reg2
+	stmdb sp!, {r0, \reg1, \reg2}
+	.endm
 
-       .macro exit reg1 reg2
-       ldmfd sp!, {r0, \reg1, \reg2}
-       .endm
+	.macro exit reg1 reg2
+	ldmfd sp!, {r0, \reg1, \reg2}
+	.endm
 
-       .text
+	.text
 
 /* Prototype: void *memcpy(void *dest, const void *src, size_t n); */
 
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/memmove.S
--- a/xen/arch/arm/lib/memmove.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/memmove.S	Mon Feb 13 17:26:08 2012 +0000
@@ -1,9 +1,9 @@
 /*
  *  linux/arch/arm/lib/memmove.S
  *
- *  Author:    Nicolas Pitre
- *  Created:   Sep 28, 2005
- *  Copyright: (C) MontaVista Software Inc.
+ *  Author:	Nicolas Pitre
+ *  Created:	Sep 28, 2005
+ *  Copyright:	(C) MontaVista Software Inc.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
@@ -14,7 +14,7 @@
 
 #include "assembler.h"
 
-               .text
+		.text
 
 /*
  * Prototype: void *memmove(void *dest, const void *src, size_t n);
@@ -29,172 +29,172 @@
 
 ENTRY(memmove)
 
-               subs    ip, r0, r1
-               cmphi   r2, ip
-               bls     memcpy
+		subs	ip, r0, r1
+		cmphi	r2, ip
+		bls	memcpy
 
-               stmfd   sp!, {r0, r4, lr}
-               add     r1, r1, r2
-               add     r0, r0, r2
-               subs    r2, r2, #4
-               blt     8f
-               ands    ip, r0, #3
-       PLD(    pld     [r1, #-4]               )
-               bne     9f
-               ands    ip, r1, #3
-               bne     10f
+		stmfd	sp!, {r0, r4, lr}
+		add	r1, r1, r2
+		add	r0, r0, r2
+		subs	r2, r2, #4
+		blt	8f
+		ands	ip, r0, #3
+	PLD(	pld	[r1, #-4]		)
+		bne	9f
+		ands	ip, r1, #3
+		bne	10f
 
-1:             subs    r2, r2, #(28)
-               stmfd   sp!, {r5 - r8}
-               blt     5f
+1:		subs	r2, r2, #(28)
+		stmfd	sp!, {r5 - r8}
+		blt	5f
 
-       CALGN(  ands    ip, r0, #31             )
-       CALGN(  sbcnes  r4, ip, r2              )  @ C is always set here
-       CALGN(  bcs     2f                      )
-       CALGN(  adr     r4, 6f                  )
-       CALGN(  subs    r2, r2, ip              )  @ C is set here
-       CALGN(  rsb     ip, ip, #32             )
-       CALGN(  add     pc, r4, ip              )
+	CALGN(	ands	ip, r0, #31		)
+	CALGN(	sbcnes	r4, ip, r2		)  @ C is always set here
+	CALGN(	bcs	2f			)
+	CALGN(	adr	r4, 6f			)
+	CALGN(	subs	r2, r2, ip		)  @ C is set here
+	CALGN(	rsb	ip, ip, #32		)
+	CALGN(	add	pc, r4, ip		)
 
-       PLD(    pld     [r1, #-4]               )
-2:     PLD(    subs    r2, r2, #96             )
-       PLD(    pld     [r1, #-32]              )
-       PLD(    blt     4f                      )
-       PLD(    pld     [r1, #-64]              )
-       PLD(    pld     [r1, #-96]              )
+	PLD(	pld	[r1, #-4]		)
+2:	PLD(	subs	r2, r2, #96		)
+	PLD(	pld	[r1, #-32]		)
+	PLD(	blt	4f			)
+	PLD(	pld	[r1, #-64]		)
+	PLD(	pld	[r1, #-96]		)
 
-3:     PLD(    pld     [r1, #-128]             )
-4:             ldmdb   r1!, {r3, r4, r5, r6, r7, r8, ip, lr}
-               subs    r2, r2, #32
-               stmdb   r0!, {r3, r4, r5, r6, r7, r8, ip, lr}
-               bge     3b
-       PLD(    cmn     r2, #96                 )
-       PLD(    bge     4b                      )
+3:	PLD(	pld	[r1, #-128]		)
+4:		ldmdb	r1!, {r3, r4, r5, r6, r7, r8, ip, lr}
+		subs	r2, r2, #32
+		stmdb	r0!, {r3, r4, r5, r6, r7, r8, ip, lr}
+		bge	3b
+	PLD(	cmn	r2, #96			)
+	PLD(	bge	4b			)
 
-5:             ands    ip, r2, #28
-               rsb     ip, ip, #32
-               addne   pc, pc, ip              @ C is always clear here
-               b       7f
-6:             W(nop)
-               W(ldr)  r3, [r1, #-4]!
-               W(ldr)  r4, [r1, #-4]!
-               W(ldr)  r5, [r1, #-4]!
-               W(ldr)  r6, [r1, #-4]!
-               W(ldr)  r7, [r1, #-4]!
-               W(ldr)  r8, [r1, #-4]!
-               W(ldr)  lr, [r1, #-4]!
+5:		ands	ip, r2, #28
+		rsb	ip, ip, #32
+		addne	pc, pc, ip		@ C is always clear here
+		b	7f
+6:		W(nop)
+		W(ldr)	r3, [r1, #-4]!
+		W(ldr)	r4, [r1, #-4]!
+		W(ldr)	r5, [r1, #-4]!
+		W(ldr)	r6, [r1, #-4]!
+		W(ldr)	r7, [r1, #-4]!
+		W(ldr)	r8, [r1, #-4]!
+		W(ldr)	lr, [r1, #-4]!
 
-               add     pc, pc, ip
-               nop
-               W(nop)
-               W(str)  r3, [r0, #-4]!
-               W(str)  r4, [r0, #-4]!
-               W(str)  r5, [r0, #-4]!
-               W(str)  r6, [r0, #-4]!
-               W(str)  r7, [r0, #-4]!
-               W(str)  r8, [r0, #-4]!
-               W(str)  lr, [r0, #-4]!
+		add	pc, pc, ip
+		nop
+		W(nop)
+		W(str)	r3, [r0, #-4]!
+		W(str)	r4, [r0, #-4]!
+		W(str)	r5, [r0, #-4]!
+		W(str)	r6, [r0, #-4]!
+		W(str)	r7, [r0, #-4]!
+		W(str)	r8, [r0, #-4]!
+		W(str)	lr, [r0, #-4]!
 
-       CALGN(  bcs     2b                      )
+	CALGN(	bcs	2b			)
 
-7:             ldmfd   sp!, {r5 - r8}
+7:		ldmfd	sp!, {r5 - r8}
 
-8:             movs    r2, r2, lsl #31
-               ldrneb  r3, [r1, #-1]!
-               ldrcsb  r4, [r1, #-1]!
-               ldrcsb  ip, [r1, #-1]
-               strneb  r3, [r0, #-1]!
-               strcsb  r4, [r0, #-1]!
-               strcsb  ip, [r0, #-1]
-               ldmfd   sp!, {r0, r4, pc}
+8:		movs	r2, r2, lsl #31
+		ldrneb	r3, [r1, #-1]!
+		ldrcsb	r4, [r1, #-1]!
+		ldrcsb	ip, [r1, #-1]
+		strneb	r3, [r0, #-1]!
+		strcsb	r4, [r0, #-1]!
+		strcsb	ip, [r0, #-1]
+		ldmfd	sp!, {r0, r4, pc}
 
-9:             cmp     ip, #2
-               ldrgtb  r3, [r1, #-1]!
-               ldrgeb  r4, [r1, #-1]!
-               ldrb    lr, [r1, #-1]!
-               strgtb  r3, [r0, #-1]!
-               strgeb  r4, [r0, #-1]!
-               subs    r2, r2, ip
-               strb    lr, [r0, #-1]!
-               blt     8b
-               ands    ip, r1, #3
-               beq     1b
+9:		cmp	ip, #2
+		ldrgtb	r3, [r1, #-1]!
+		ldrgeb	r4, [r1, #-1]!
+		ldrb	lr, [r1, #-1]!
+		strgtb	r3, [r0, #-1]!
+		strgeb	r4, [r0, #-1]!
+		subs	r2, r2, ip
+		strb	lr, [r0, #-1]!
+		blt	8b
+		ands	ip, r1, #3
+		beq	1b
 
-10:            bic     r1, r1, #3
-               cmp     ip, #2
-               ldr     r3, [r1, #0]
-               beq     17f
-               blt     18f
+10:		bic	r1, r1, #3
+		cmp	ip, #2
+		ldr	r3, [r1, #0]
+		beq	17f
+		blt	18f
 
 
-               .macro  backward_copy_shift push pull
+		.macro	backward_copy_shift push pull
 
-               subs    r2, r2, #28
-               blt     14f
+		subs	r2, r2, #28
+		blt	14f
 
-       CALGN(  ands    ip, r0, #31             )
-       CALGN(  sbcnes  r4, ip, r2              )  @ C is always set here
-       CALGN(  subcc   r2, r2, ip              )
-       CALGN(  bcc     15f                     )
+	CALGN(	ands	ip, r0, #31		)
+	CALGN(	sbcnes	r4, ip, r2		)  @ C is always set here
+	CALGN(	subcc	r2, r2, ip		)
+	CALGN(	bcc	15f			)
 
-11:            stmfd   sp!, {r5 - r9}
+11:		stmfd	sp!, {r5 - r9}
 
-       PLD(    pld     [r1, #-4]               )
-       PLD(    subs    r2, r2, #96             )
-       PLD(    pld     [r1, #-32]              )
-       PLD(    blt     13f                     )
-       PLD(    pld     [r1, #-64]              )
-       PLD(    pld     [r1, #-96]              )
+	PLD(	pld	[r1, #-4]		)
+	PLD(	subs	r2, r2, #96		)
+	PLD(	pld	[r1, #-32]		)
+	PLD(	blt	13f			)
+	PLD(	pld	[r1, #-64]		)
+	PLD(	pld	[r1, #-96]		)
 
-12:    PLD(    pld     [r1, #-128]             )
-13:            ldmdb   r1!, {r7, r8, r9, ip}
-               mov     lr, r3, push #\push
-               subs    r2, r2, #32
-               ldmdb   r1!, {r3, r4, r5, r6}
-               orr     lr, lr, ip, pull #\pull
-               mov     ip, ip, push #\push
-               orr     ip, ip, r9, pull #\pull
-               mov     r9, r9, push #\push
-               orr     r9, r9, r8, pull #\pull
-               mov     r8, r8, push #\push
-               orr     r8, r8, r7, pull #\pull
-               mov     r7, r7, push #\push
-               orr     r7, r7, r6, pull #\pull
-               mov     r6, r6, push #\push
-               orr     r6, r6, r5, pull #\pull
-               mov     r5, r5, push #\push
-               orr     r5, r5, r4, pull #\pull
-               mov     r4, r4, push #\push
-               orr     r4, r4, r3, pull #\pull
-               stmdb   r0!, {r4 - r9, ip, lr}
-               bge     12b
-       PLD(    cmn     r2, #96                 )
-       PLD(    bge     13b                     )
+12:	PLD(	pld	[r1, #-128]		)
+13:		ldmdb   r1!, {r7, r8, r9, ip}
+		mov     lr, r3, push #\push
+		subs    r2, r2, #32
+		ldmdb   r1!, {r3, r4, r5, r6}
+		orr     lr, lr, ip, pull #\pull
+		mov     ip, ip, push #\push
+		orr     ip, ip, r9, pull #\pull
+		mov     r9, r9, push #\push
+		orr     r9, r9, r8, pull #\pull
+		mov     r8, r8, push #\push
+		orr     r8, r8, r7, pull #\pull
+		mov     r7, r7, push #\push
+		orr     r7, r7, r6, pull #\pull
+		mov     r6, r6, push #\push
+		orr     r6, r6, r5, pull #\pull
+		mov     r5, r5, push #\push
+		orr     r5, r5, r4, pull #\pull
+		mov     r4, r4, push #\push
+		orr     r4, r4, r3, pull #\pull
+		stmdb   r0!, {r4 - r9, ip, lr}
+		bge	12b
+	PLD(	cmn	r2, #96			)
+	PLD(	bge	13b			)
 
-               ldmfd   sp!, {r5 - r9}
+		ldmfd	sp!, {r5 - r9}
 
-14:            ands    ip, r2, #28
-               beq     16f
+14:		ands	ip, r2, #28
+		beq	16f
 
-15:            mov     lr, r3, push #\push
-               ldr     r3, [r1, #-4]!
-               subs    ip, ip, #4
-               orr     lr, lr, r3, pull #\pull
-               str     lr, [r0, #-4]!
-               bgt     15b
-       CALGN(  cmp     r2, #0                  )
-       CALGN(  bge     11b                     )
+15:		mov     lr, r3, push #\push
+		ldr	r3, [r1, #-4]!
+		subs	ip, ip, #4
+		orr	lr, lr, r3, pull #\pull
+		str	lr, [r0, #-4]!
+		bgt	15b
+	CALGN(	cmp	r2, #0			)
+	CALGN(	bge	11b			)
 
-16:            add     r1, r1, #(\pull / 8)
-               b       8b
+16:		add	r1, r1, #(\pull / 8)
+		b	8b
 
-               .endm
+		.endm
 
 
-               backward_copy_shift     push=8  pull=24
+		backward_copy_shift	push=8	pull=24
 
-17:            backward_copy_shift     push=16 pull=16
+17:		backward_copy_shift	push=16	pull=16
 
-18:            backward_copy_shift     push=24 pull=8
+18:		backward_copy_shift	push=24	pull=8
 
 ENDPROC(memmove)
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/memset.S
--- a/xen/arch/arm/lib/memset.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/memset.S	Mon Feb 13 17:26:08 2012 +0000
@@ -14,33 +14,33 @@
 
 #include "assembler.h"
 
-       .text
-       .align  5
-       .word   0
+	.text
+	.align	5
+	.word	0
 
-1:     subs    r2, r2, #4              @ 1 do we have enough
-       blt     5f                      @ 1 bytes to align with?
-       cmp     r3, #2                  @ 1
-       strltb  r1, [r0], #1            @ 1
-       strleb  r1, [r0], #1            @ 1
-       strb    r1, [r0], #1            @ 1
-       add     r2, r2, r3              @ 1 (r2 = r2 - (4 - r3))
+1:	subs	r2, r2, #4		@ 1 do we have enough
+	blt	5f			@ 1 bytes to align with?
+	cmp	r3, #2			@ 1
+	strltb	r1, [r0], #1		@ 1
+	strleb	r1, [r0], #1		@ 1
+	strb	r1, [r0], #1		@ 1
+	add	r2, r2, r3		@ 1 (r2 = r2 - (4 - r3))
 /*
  * The pointer is now aligned and the length is adjusted.  Try doing the
  * memset again.
  */
 
 ENTRY(memset)
-       ands    r3, r0, #3              @ 1 unaligned?
-       bne     1b                      @ 1
+	ands	r3, r0, #3		@ 1 unaligned?
+	bne	1b			@ 1
 /*
  * we know that the pointer in r0 is aligned to a word boundary.
  */
-       orr     r1, r1, r1, lsl #8
-       orr     r1, r1, r1, lsl #16
-       mov     r3, r1
-       cmp     r2, #16
-       blt     4f
+	orr	r1, r1, r1, lsl #8
+	orr	r1, r1, r1, lsl #16
+	mov	r3, r1
+	cmp	r2, #16
+	blt	4f
 
 #if ! CALGN(1)+0
 
@@ -48,26 +48,26 @@
  * We need an extra register for this loop - save the return address and
  * use the LR
  */
-       str     lr, [sp, #-4]!
-       mov     ip, r1
-       mov     lr, r1
+	str	lr, [sp, #-4]!
+	mov	ip, r1
+	mov	lr, r1
 
-2:     subs    r2, r2, #64
-       stmgeia r0!, {r1, r3, ip, lr}   @ 64 bytes at a time.
-       stmgeia r0!, {r1, r3, ip, lr}
-       stmgeia r0!, {r1, r3, ip, lr}
-       stmgeia r0!, {r1, r3, ip, lr}
-       bgt     2b
-       ldmeqfd sp!, {pc}               @ Now <64 bytes to go.
+2:	subs	r2, r2, #64
+	stmgeia	r0!, {r1, r3, ip, lr}	@ 64 bytes at a time.
+	stmgeia	r0!, {r1, r3, ip, lr}
+	stmgeia	r0!, {r1, r3, ip, lr}
+	stmgeia	r0!, {r1, r3, ip, lr}
+	bgt	2b
+	ldmeqfd	sp!, {pc}		@ Now <64 bytes to go.
 /*
  * No need to correct the count; we're only testing bits from now on
  */
-       tst     r2, #32
-       stmneia r0!, {r1, r3, ip, lr}
-       stmneia r0!, {r1, r3, ip, lr}
-       tst     r2, #16
-       stmneia r0!, {r1, r3, ip, lr}
-       ldr     lr, [sp], #4
+	tst	r2, #32
+	stmneia	r0!, {r1, r3, ip, lr}
+	stmneia	r0!, {r1, r3, ip, lr}
+	tst	r2, #16
+	stmneia	r0!, {r1, r3, ip, lr}
+	ldr	lr, [sp], #4
 
 #else
 
@@ -76,54 +76,54 @@
  * whole cache lines at once.
  */
 
-       stmfd   sp!, {r4-r7, lr}
-       mov     r4, r1
-       mov     r5, r1
-       mov     r6, r1
-       mov     r7, r1
-       mov     ip, r1
-       mov     lr, r1
+	stmfd	sp!, {r4-r7, lr}
+	mov	r4, r1
+	mov	r5, r1
+	mov	r6, r1
+	mov	r7, r1
+	mov	ip, r1
+	mov	lr, r1
 
-       cmp     r2, #96
-       tstgt   r0, #31
-       ble     3f
+	cmp	r2, #96
+	tstgt	r0, #31
+	ble	3f
 
-       and     ip, r0, #31
-       rsb     ip, ip, #32
-       sub     r2, r2, ip
-       movs    ip, ip, lsl #(32 - 4)
-       stmcsia r0!, {r4, r5, r6, r7}
-       stmmiia r0!, {r4, r5}
-       tst     ip, #(1 << 30)
-       mov     ip, r1
-       strne   r1, [r0], #4
+	and	ip, r0, #31
+	rsb	ip, ip, #32
+	sub	r2, r2, ip
+	movs	ip, ip, lsl #(32 - 4)
+	stmcsia	r0!, {r4, r5, r6, r7}
+	stmmiia	r0!, {r4, r5}
+	tst	ip, #(1 << 30)
+	mov	ip, r1
+	strne	r1, [r0], #4
 
-3:     subs    r2, r2, #64
-       stmgeia r0!, {r1, r3-r7, ip, lr}
-       stmgeia r0!, {r1, r3-r7, ip, lr}
-       bgt     3b
-       ldmeqfd sp!, {r4-r7, pc}
+3:	subs	r2, r2, #64
+	stmgeia	r0!, {r1, r3-r7, ip, lr}
+	stmgeia	r0!, {r1, r3-r7, ip, lr}
+	bgt	3b
+	ldmeqfd	sp!, {r4-r7, pc}
 
-       tst     r2, #32
-       stmneia r0!, {r1, r3-r7, ip, lr}
-       tst     r2, #16
-       stmneia r0!, {r4-r7}
-       ldmfd   sp!, {r4-r7, lr}
+	tst	r2, #32
+	stmneia	r0!, {r1, r3-r7, ip, lr}
+	tst	r2, #16
+	stmneia	r0!, {r4-r7}
+	ldmfd	sp!, {r4-r7, lr}
 
 #endif
 
-4:     tst     r2, #8
-       stmneia r0!, {r1, r3}
-       tst     r2, #4
-       strne   r1, [r0], #4
+4:	tst	r2, #8
+	stmneia	r0!, {r1, r3}
+	tst	r2, #4
+	strne	r1, [r0], #4
 /*
  * When we get here, we've got less than 4 bytes to zero.  We
  * may have an unaligned pointer as well.
  */
-5:     tst     r2, #2
-       strneb  r1, [r0], #1
-       strneb  r1, [r0], #1
-       tst     r2, #1
-       strneb  r1, [r0], #1
-       mov     pc, lr
+5:	tst	r2, #2
+	strneb	r1, [r0], #1
+	strneb	r1, [r0], #1
+	tst	r2, #1
+	strneb	r1, [r0], #1
+	mov	pc, lr
 ENDPROC(memset)
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/memzero.S
--- a/xen/arch/arm/lib/memzero.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/memzero.S	Mon Feb 13 17:26:08 2012 +0000
@@ -12,35 +12,35 @@
 
 #include "assembler.h"
 
-       .text
-       .align  5
-       .word   0
+	.text
+	.align	5
+	.word	0
 /*
  * Align the pointer in r0.  r3 contains the number of bytes that we are
  * mis-aligned by, and r1 is the number of bytes.  If r1 < 4, then we
  * don't bother; we use byte stores instead.
  */
-1:     subs    r1, r1, #4              @ 1 do we have enough
-       blt     5f                      @ 1 bytes to align with?
-       cmp     r3, #2                  @ 1
-       strltb  r2, [r0], #1            @ 1
-       strleb  r2, [r0], #1            @ 1
-       strb    r2, [r0], #1            @ 1
-       add     r1, r1, r3              @ 1 (r1 = r1 - (4 - r3))
+1:	subs	r1, r1, #4		@ 1 do we have enough
+	blt	5f			@ 1 bytes to align with?
+	cmp	r3, #2			@ 1
+	strltb	r2, [r0], #1		@ 1
+	strleb	r2, [r0], #1		@ 1
+	strb	r2, [r0], #1		@ 1
+	add	r1, r1, r3		@ 1 (r1 = r1 - (4 - r3))
 /*
  * The pointer is now aligned and the length is adjusted.  Try doing the
  * memzero again.
  */
 
 ENTRY(__memzero)
-       mov     r2, #0                  @ 1
-       ands    r3, r0, #3              @ 1 unaligned?
-       bne     1b                      @ 1
+	mov	r2, #0			@ 1
+	ands	r3, r0, #3		@ 1 unaligned?
+	bne	1b			@ 1
 /*
  * r3 = 0, and we know that the pointer in r0 is aligned to a word boundary.
  */
-       cmp     r1, #16                 @ 1 we can skip this chunk if we
-       blt     4f                      @ 1 have < 16 bytes
+	cmp	r1, #16			@ 1 we can skip this chunk if we
+	blt	4f			@ 1 have < 16 bytes
 
 #if ! CALGN(1)+0
 
@@ -48,26 +48,26 @@
  * We need an extra register for this loop - save the return address and
  * use the LR
  */
-       str     lr, [sp, #-4]!          @ 1
-       mov     ip, r2                  @ 1
-       mov     lr, r2                  @ 1
+	str	lr, [sp, #-4]!		@ 1
+	mov	ip, r2			@ 1
+	mov	lr, r2			@ 1
 
-3:     subs    r1, r1, #64             @ 1 write 32 bytes out per loop
-       stmgeia r0!, {r2, r3, ip, lr}   @ 4
-       stmgeia r0!, {r2, r3, ip, lr}   @ 4
-       stmgeia r0!, {r2, r3, ip, lr}   @ 4
-       stmgeia r0!, {r2, r3, ip, lr}   @ 4
-       bgt     3b                      @ 1
-       ldmeqfd sp!, {pc}               @ 1/2 quick exit
+3:	subs	r1, r1, #64		@ 1 write 32 bytes out per loop
+	stmgeia	r0!, {r2, r3, ip, lr}	@ 4
+	stmgeia	r0!, {r2, r3, ip, lr}	@ 4
+	stmgeia	r0!, {r2, r3, ip, lr}	@ 4
+	stmgeia	r0!, {r2, r3, ip, lr}	@ 4
+	bgt	3b			@ 1
+	ldmeqfd	sp!, {pc}		@ 1/2 quick exit
 /*
  * No need to correct the count; we're only testing bits from now on
  */
-       tst     r1, #32                 @ 1
-       stmneia r0!, {r2, r3, ip, lr}   @ 4
-       stmneia r0!, {r2, r3, ip, lr}   @ 4
-       tst     r1, #16                 @ 1 16 bytes or more?
-       stmneia r0!, {r2, r3, ip, lr}   @ 4
-       ldr     lr, [sp], #4            @ 1
+	tst	r1, #32			@ 1
+	stmneia	r0!, {r2, r3, ip, lr}	@ 4
+	stmneia	r0!, {r2, r3, ip, lr}	@ 4
+	tst	r1, #16			@ 1 16 bytes or more?
+	stmneia	r0!, {r2, r3, ip, lr}	@ 4
+	ldr	lr, [sp], #4		@ 1
 
 #else
 
@@ -76,52 +76,52 @@
  * whole cache lines at once.
  */
 
-       stmfd   sp!, {r4-r7, lr}
-       mov     r4, r2
-       mov     r5, r2
-       mov     r6, r2
-       mov     r7, r2
-       mov     ip, r2
-       mov     lr, r2
+	stmfd	sp!, {r4-r7, lr}
+	mov	r4, r2
+	mov	r5, r2
+	mov	r6, r2
+	mov	r7, r2
+	mov	ip, r2
+	mov	lr, r2
 
-       cmp     r1, #96
-       andgts  ip, r0, #31
-       ble     3f
+	cmp	r1, #96
+	andgts	ip, r0, #31
+	ble	3f
 
-       rsb     ip, ip, #32
-       sub     r1, r1, ip
-       movs    ip, ip, lsl #(32 - 4)
-       stmcsia r0!, {r4, r5, r6, r7}
-       stmmiia r0!, {r4, r5}
-       movs    ip, ip, lsl #2
-       strcs   r2, [r0], #4
+	rsb	ip, ip, #32
+	sub	r1, r1, ip
+	movs	ip, ip, lsl #(32 - 4)
+	stmcsia	r0!, {r4, r5, r6, r7}
+	stmmiia	r0!, {r4, r5}
+	movs	ip, ip, lsl #2
+	strcs	r2, [r0], #4
 
-3:     subs    r1, r1, #64
-       stmgeia r0!, {r2-r7, ip, lr}
-       stmgeia r0!, {r2-r7, ip, lr}
-       bgt     3b
-       ldmeqfd sp!, {r4-r7, pc}
+3:	subs	r1, r1, #64
+	stmgeia	r0!, {r2-r7, ip, lr}
+	stmgeia	r0!, {r2-r7, ip, lr}
+	bgt	3b
+	ldmeqfd	sp!, {r4-r7, pc}
 
-       tst     r1, #32
-       stmneia r0!, {r2-r7, ip, lr}
-       tst     r1, #16
-       stmneia r0!, {r4-r7}
-       ldmfd   sp!, {r4-r7, lr}
+	tst	r1, #32
+	stmneia	r0!, {r2-r7, ip, lr}
+	tst	r1, #16
+	stmneia	r0!, {r4-r7}
+	ldmfd	sp!, {r4-r7, lr}
 
 #endif
 
-4:     tst     r1, #8                  @ 1 8 bytes or more?
-       stmneia r0!, {r2, r3}           @ 2
-       tst     r1, #4                  @ 1 4 bytes or more?
-       strne   r2, [r0], #4            @ 1
+4:	tst	r1, #8			@ 1 8 bytes or more?
+	stmneia	r0!, {r2, r3}		@ 2
+	tst	r1, #4			@ 1 4 bytes or more?
+	strne	r2, [r0], #4		@ 1
 /*
  * When we get here, we've got less than 4 bytes to zero.  We
  * may have an unaligned pointer as well.
  */
-5:     tst     r1, #2                  @ 1 2 bytes or more?
-       strneb  r2, [r0], #1            @ 1
-       strneb  r2, [r0], #1            @ 1
-       tst     r1, #1                  @ 1 a byte left over
-       strneb  r2, [r0], #1            @ 1
-       mov     pc, lr                  @ 1
+5:	tst	r1, #2			@ 1 2 bytes or more?
+	strneb	r2, [r0], #1		@ 1
+	strneb	r2, [r0], #1		@ 1
+	tst	r1, #1			@ 1 a byte left over
+	strneb	r2, [r0], #1		@ 1
+	mov	pc, lr			@ 1
 ENDPROC(__memzero)
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/setbit.S
--- a/xen/arch/arm/lib/setbit.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/setbit.S	Mon Feb 13 17:26:08 2012 +0000
@@ -11,8 +11,8 @@
 
 #include "assembler.h"
 #include "bitops.h"
-       .text
+	.text
 
 ENTRY(_set_bit)
-       bitop   orr
+	bitop	orr
 ENDPROC(_set_bit)
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/testchangebit.S
--- a/xen/arch/arm/lib/testchangebit.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/testchangebit.S	Mon Feb 13 17:26:08 2012 +0000
@@ -14,5 +14,5 @@
                 .text
 
 ENTRY(_test_and_change_bit)
-       testop  eor, str
+	testop	eor, str
 ENDPROC(_test_and_change_bit)
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/testclearbit.S
--- a/xen/arch/arm/lib/testclearbit.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/testclearbit.S	Mon Feb 13 17:26:08 2012 +0000
@@ -14,5 +14,5 @@
                 .text
 
 ENTRY(_test_and_clear_bit)
-       testop  bicne, strne
+	testop	bicne, strne
 ENDPROC(_test_and_clear_bit)
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/testsetbit.S
--- a/xen/arch/arm/lib/testsetbit.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/testsetbit.S	Mon Feb 13 17:26:08 2012 +0000
@@ -14,5 +14,5 @@
                 .text
 
 ENTRY(_test_and_set_bit)
-       testop  orreq, streq
+	testop	orreq, streq
 ENDPROC(_test_and_set_bit)
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/include/asm-arm/bitops.h
--- a/xen/include/asm-arm/bitops.h	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/include/asm-arm/bitops.h	Mon Feb 13 17:26:08 2012 +0000
@@ -115,19 +115,19 @@
 /*
  * These are the little endian, atomic definitions.
  */
-#define find_first_zero_bit(p,sz)      _find_first_zero_bit_le(p,sz)
-#define find_next_zero_bit(p,sz,off)   _find_next_zero_bit_le(p,sz,off)
-#define find_first_bit(p,sz)           _find_first_bit_le(p,sz)
-#define find_next_bit(p,sz,off)                _find_next_bit_le(p,sz,off)
+#define find_first_zero_bit(p,sz)	_find_first_zero_bit_le(p,sz)
+#define find_next_zero_bit(p,sz,off)	_find_next_zero_bit_le(p,sz,off)
+#define find_first_bit(p,sz)		_find_first_bit_le(p,sz)
+#define find_next_bit(p,sz,off)		_find_next_bit_le(p,sz,off)
 
 #else
 /*
  * These are the big endian, atomic definitions.
  */
-#define find_first_zero_bit(p,sz)      _find_first_zero_bit_be(p,sz)
-#define find_next_zero_bit(p,sz,off)   _find_next_zero_bit_be(p,sz,off)
-#define find_first_bit(p,sz)           _find_first_bit_be(p,sz)
-#define find_next_bit(p,sz,off)                _find_next_bit_be(p,sz,off)
+#define find_first_zero_bit(p,sz)	_find_first_zero_bit_be(p,sz)
+#define find_next_zero_bit(p,sz,off)	_find_next_zero_bit_be(p,sz,off)
+#define find_first_bit(p,sz)		_find_first_bit_be(p,sz)
+#define find_next_bit(p,sz,off)		_find_next_bit_be(p,sz,off)
 
 #endif
 
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/include/asm-arm/div64.h
--- a/xen/include/asm-arm/div64.h	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/include/asm-arm/div64.h	Mon Feb 13 17:26:08 2012 +0000
@@ -10,9 +10,9 @@
  *
  * uint32_t do_div(uint64_t *n, uint32_t base)
  * {
- *     uint32_t remainder = *n % base;
- *     *n = *n / base;
- *     return remainder;
+ * 	uint32_t remainder = *n % base;
+ * 	*n = *n / base;
+ * 	return remainder;
  * }
  *
  * In other words, a 64-bit dividend with a 32-bit divisor producing
@@ -29,22 +29,22 @@
 #define __xh "r1"
 #endif
 
-#define __do_div_asm(n, base)                                  \
-({                                                             \
-       register unsigned int __base      asm("r4") = base;     \
-       register unsigned long long __n   asm("r0") = n;        \
-       register unsigned long long __res asm("r2");            \
-       register unsigned int __rem       asm(__xh);            \
-       asm(    __asmeq("%0", __xh)                             \
-               __asmeq("%1", "r2")                             \
-               __asmeq("%2", "r0")                             \
-               __asmeq("%3", "r4")                             \
-               "bl     __do_div64"                             \
-               : "=r" (__rem), "=r" (__res)                    \
-               : "r" (__n), "r" (__base)                       \
-               : "ip", "lr", "cc");                            \
-       n = __res;                                              \
-       __rem;                                                  \
+#define __do_div_asm(n, base)					\
+({								\
+	register unsigned int __base      asm("r4") = base;	\
+	register unsigned long long __n   asm("r0") = n;	\
+	register unsigned long long __res asm("r2");		\
+	register unsigned int __rem       asm(__xh);		\
+	asm(	__asmeq("%0", __xh)				\
+		__asmeq("%1", "r2")				\
+		__asmeq("%2", "r0")				\
+		__asmeq("%3", "r4")				\
+		"bl	__do_div64"				\
+		: "=r" (__rem), "=r" (__res)			\
+		: "r" (__n), "r" (__base)			\
+		: "ip", "lr", "cc");				\
+	n = __res;						\
+	__rem;							\
 })
 
 #if __GNUC__ < 4
@@ -71,155 +71,155 @@
  * sufficiently recent to perform proper long long constant propagation.
  * (It is unfortunate that gcc doesn't perform all this internally.)
  */
-#define do_div(n, base)                                                        \
-({                                                                     \
-       unsigned int __r, __b = (base);                                 \
-       if (!__builtin_constant_p(__b) || __b == 0) {                   \
-               /* non-constant divisor (or zero): slow path */         \
-               __r = __do_div_asm(n, __b);                             \
-       } else if ((__b & (__b - 1)) == 0) {                            \
-               /* Trivial: __b is constant and a power of 2 */         \
-               /* gcc does the right thing with this code.  */         \
-               __r = n;                                                \
-               __r &= (__b - 1);                                       \
-               n /= __b;                                               \
-       } else {                                                        \
-               /* Multiply by inverse of __b: n/b = n*(p/b)/p       */ \
-               /* We rely on the fact that most of this code gets   */ \
-               /* optimized away at compile time due to constant    */ \
-               /* propagation and only a couple inline assembly     */ \
-               /* instructions should remain. Better avoid any      */ \
-               /* code construct that might prevent that.           */ \
-               unsigned long long __res, __x, __t, __m, __n = n;       \
-               unsigned int __c, __p, __z = 0;                         \
-               /* preserve low part of n for reminder computation */   \
-               __r = __n;                                              \
-               /* determine number of bits to represent __b */         \
-               __p = 1 << __div64_fls(__b);                            \
-               /* compute __m = ((__p << 64) + __b - 1) / __b */       \
-               __m = (~0ULL / __b) * __p;                              \
-               __m += (((~0ULL % __b + 1) * __p) + __b - 1) / __b;     \
-               /* compute __res = __m*(~0ULL/__b*__b-1)/(__p << 64) */ \
-               __x = ~0ULL / __b * __b - 1;                            \
-               __res = (__m & 0xffffffff) * (__x & 0xffffffff);        \
-               __res >>= 32;                                           \
-               __res += (__m & 0xffffffff) * (__x >> 32);              \
-               __t = __res;                                            \
-               __res += (__x & 0xffffffff) * (__m >> 32);              \
-               __t = (__res < __t) ? (1ULL << 32) : 0;                 \
-               __res = (__res >> 32) + __t;                            \
-               __res += (__m >> 32) * (__x >> 32);                     \
-               __res /= __p;                                           \
-               /* Now sanitize and optimize what we've got. */         \
-               if (~0ULL % (__b / (__b & -__b)) == 0) {                \
-                       /* those cases can be simplified with: */       \
-                       __n /= (__b & -__b);                            \
-                       __m = ~0ULL / (__b / (__b & -__b));             \
-                       __p = 1;                                        \
-                       __c = 1;                                        \
-               } else if (__res != __x / __b) {                        \
-                       /* We can't get away without a correction    */ \
-                       /* to compensate for bit truncation errors.  */ \
-                       /* To avoid it we'd need an additional bit   */ \
-                       /* to represent __m which would overflow it. */ \
-                       /* Instead we do m=p/b and n/b=(n*m+m)/p.    */ \
-                       __c = 1;                                        \
-                       /* Compute __m = (__p << 64) / __b */           \
-                       __m = (~0ULL / __b) * __p;                      \
-                       __m += ((~0ULL % __b + 1) * __p) / __b;         \
-               } else {                                                \
-                       /* Reduce __m/__p, and try to clear bit 31   */ \
-                       /* of __m when possible otherwise that'll    */ \
-                       /* need extra overflow handling later.       */ \
-                       unsigned int __bits = -(__m & -__m);            \
-                       __bits |= __m >> 32;                            \
-                       __bits = (~__bits) << 1;                        \
-                       /* If __bits == 0 then setting bit 31 is     */ \
-                       /* unavoidable.  Simply apply the maximum    */ \
-                       /* possible reduction in that case.          */ \
-                       /* Otherwise the MSB of __bits indicates the */ \
-                       /* best reduction we should apply.           */ \
-                       if (!__bits) {                                  \
-                               __p /= (__m & -__m);                    \
-                               __m /= (__m & -__m);                    \
-                       } else {                                        \
-                               __p >>= __div64_fls(__bits);            \
-                               __m >>= __div64_fls(__bits);            \
-                       }                                               \
-                       /* No correction needed. */                     \
-                       __c = 0;                                        \
-               }                                                       \
-               /* Now we have a combination of 2 conditions:        */ \
-               /* 1) whether or not we need a correction (__c), and */ \
-               /* 2) whether or not there might be an overflow in   */ \
-               /*    the cross product (__m & ((1<<63) | (1<<31)))  */ \
-               /* Select the best insn combination to perform the   */ \
-               /* actual __m * __n / (__p << 64) operation.         */ \
-               if (!__c) {                                             \
-                       asm (   "umull  %Q0, %R0, %1, %Q2\n\t"          \
-                               "mov    %Q0, #0"                        \
-                               : "=&r" (__res)                         \
-                               : "r" (__m), "r" (__n)                  \
-                               : "cc" );                               \
-               } else if (!(__m & ((1ULL << 63) | (1ULL << 31)))) {    \
-                       __res = __m;                                    \
-                       asm (   "umlal  %Q0, %R0, %Q1, %Q2\n\t"         \
-                               "mov    %Q0, #0"                        \
-                               : "+&r" (__res)                         \
-                               : "r" (__m), "r" (__n)                  \
-                               : "cc" );                               \
-               } else {                                                \
-                       asm (   "umull  %Q0, %R0, %Q1, %Q2\n\t"         \
-                               "cmn    %Q0, %Q1\n\t"                   \
-                               "adcs   %R0, %R0, %R1\n\t"              \
-                               "adc    %Q0, %3, #0"                    \
-                               : "=&r" (__res)                         \
-                               : "r" (__m), "r" (__n), "r" (__z)       \
-                               : "cc" );                               \
-               }                                                       \
-               if (!(__m & ((1ULL << 63) | (1ULL << 31)))) {           \
-                       asm (   "umlal  %R0, %Q0, %R1, %Q2\n\t"         \
-                               "umlal  %R0, %Q0, %Q1, %R2\n\t"         \
-                               "mov    %R0, #0\n\t"                    \
-                               "umlal  %Q0, %R0, %R1, %R2"             \
-                               : "+&r" (__res)                         \
-                               : "r" (__m), "r" (__n)                  \
-                               : "cc" );                               \
-               } else {                                                \
-                       asm (   "umlal  %R0, %Q0, %R2, %Q3\n\t"         \
-                               "umlal  %R0, %1, %Q2, %R3\n\t"          \
-                               "mov    %R0, #0\n\t"                    \
-                               "adds   %Q0, %1, %Q0\n\t"               \
-                               "adc    %R0, %R0, #0\n\t"               \
-                               "umlal  %Q0, %R0, %R2, %R3"             \
-                               : "+&r" (__res), "+&r" (__z)            \
-                               : "r" (__m), "r" (__n)                  \
-                               : "cc" );                               \
-               }                                                       \
-               __res /= __p;                                           \
-               /* The reminder can be computed with 32-bit regs     */ \
-               /* only, and gcc is good at that.                    */ \
-               {                                                       \
-                       unsigned int __res0 = __res;                    \
-                       unsigned int __b0 = __b;                        \
-                       __r -= __res0 * __b0;                           \
-               }                                                       \
-               /* BUG_ON(__r >= __b || __res * __b + __r != n); */     \
-               n = __res;                                              \
-       }                                                               \
-       __r;                                                            \
+#define do_div(n, base)							\
+({									\
+	unsigned int __r, __b = (base);					\
+	if (!__builtin_constant_p(__b) || __b == 0) {			\
+		/* non-constant divisor (or zero): slow path */		\
+		__r = __do_div_asm(n, __b);				\
+	} else if ((__b & (__b - 1)) == 0) {				\
+		/* Trivial: __b is constant and a power of 2 */		\
+		/* gcc does the right thing with this code.  */		\
+		__r = n;						\
+		__r &= (__b - 1);					\
+		n /= __b;						\
+	} else {							\
+		/* Multiply by inverse of __b: n/b = n*(p/b)/p       */	\
+		/* We rely on the fact that most of this code gets   */	\
+		/* optimized away at compile time due to constant    */	\
+		/* propagation and only a couple inline assembly     */	\
+		/* instructions should remain. Better avoid any      */	\
+		/* code construct that might prevent that.           */	\
+		unsigned long long __res, __x, __t, __m, __n = n;	\
+		unsigned int __c, __p, __z = 0;				\
+		/* preserve low part of n for reminder computation */	\
+		__r = __n;						\
+		/* determine number of bits to represent __b */		\
+		__p = 1 << __div64_fls(__b);				\
+		/* compute __m = ((__p << 64) + __b - 1) / __b */	\
+		__m = (~0ULL / __b) * __p;				\
+		__m += (((~0ULL % __b + 1) * __p) + __b - 1) / __b;	\
+		/* compute __res = __m*(~0ULL/__b*__b-1)/(__p << 64) */	\
+		__x = ~0ULL / __b * __b - 1;				\
+		__res = (__m & 0xffffffff) * (__x & 0xffffffff);	\
+		__res >>= 32;						\
+		__res += (__m & 0xffffffff) * (__x >> 32);		\
+		__t = __res;						\
+		__res += (__x & 0xffffffff) * (__m >> 32);		\
+		__t = (__res < __t) ? (1ULL << 32) : 0;			\
+		__res = (__res >> 32) + __t;				\
+		__res += (__m >> 32) * (__x >> 32);			\
+		__res /= __p;						\
+		/* Now sanitize and optimize what we've got. */		\
+		if (~0ULL % (__b / (__b & -__b)) == 0) {		\
+			/* those cases can be simplified with: */	\
+			__n /= (__b & -__b);				\
+			__m = ~0ULL / (__b / (__b & -__b));		\
+			__p = 1;					\
+			__c = 1;					\
+		} else if (__res != __x / __b) {			\
+			/* We can't get away without a correction    */	\
+			/* to compensate for bit truncation errors.  */	\
+			/* To avoid it we'd need an additional bit   */	\
+			/* to represent __m which would overflow it. */	\
+			/* Instead we do m=p/b and n/b=(n*m+m)/p.    */	\
+			__c = 1;					\
+			/* Compute __m = (__p << 64) / __b */		\
+			__m = (~0ULL / __b) * __p;			\
+			__m += ((~0ULL % __b + 1) * __p) / __b;		\
+		} else {						\
+			/* Reduce __m/__p, and try to clear bit 31   */	\
+			/* of __m when possible otherwise that'll    */	\
+			/* need extra overflow handling later.       */	\
+			unsigned int __bits = -(__m & -__m);		\
+			__bits |= __m >> 32;				\
+			__bits = (~__bits) << 1;			\
+			/* If __bits == 0 then setting bit 31 is     */	\
+			/* unavoidable.  Simply apply the maximum    */	\
+			/* possible reduction in that case.          */	\
+			/* Otherwise the MSB of __bits indicates the */	\
+			/* best reduction we should apply.           */	\
+			if (!__bits) {					\
+				__p /= (__m & -__m);			\
+				__m /= (__m & -__m);			\
+			} else {					\
+				__p >>= __div64_fls(__bits);		\
+				__m >>= __div64_fls(__bits);		\
+			}						\
+			/* No correction needed. */			\
+			__c = 0;					\
+		}							\
+		/* Now we have a combination of 2 conditions:        */	\
+		/* 1) whether or not we need a correction (__c), and */	\
+		/* 2) whether or not there might be an overflow in   */	\
+		/*    the cross product (__m & ((1<<63) | (1<<31)))  */	\
+		/* Select the best insn combination to perform the   */	\
+		/* actual __m * __n / (__p << 64) operation.         */	\
+		if (!__c) {						\
+			asm (	"umull	%Q0, %R0, %1, %Q2\n\t"		\
+				"mov	%Q0, #0"			\
+				: "=&r" (__res)				\
+				: "r" (__m), "r" (__n)			\
+				: "cc" );				\
+		} else if (!(__m & ((1ULL << 63) | (1ULL << 31)))) {	\
+			__res = __m;					\
+			asm (	"umlal	%Q0, %R0, %Q1, %Q2\n\t"		\
+				"mov	%Q0, #0"			\
+				: "+&r" (__res)				\
+				: "r" (__m), "r" (__n)			\
+				: "cc" );				\
+		} else {						\
+			asm (	"umull	%Q0, %R0, %Q1, %Q2\n\t"		\
+				"cmn	%Q0, %Q1\n\t"			\
+				"adcs	%R0, %R0, %R1\n\t"		\
+				"adc	%Q0, %3, #0"			\
+				: "=&r" (__res)				\
+				: "r" (__m), "r" (__n), "r" (__z)	\
+				: "cc" );				\
+		}							\
+		if (!(__m & ((1ULL << 63) | (1ULL << 31)))) {		\
+			asm (	"umlal	%R0, %Q0, %R1, %Q2\n\t"		\
+				"umlal	%R0, %Q0, %Q1, %R2\n\t"		\
+				"mov	%R0, #0\n\t"			\
+				"umlal	%Q0, %R0, %R1, %R2"		\
+				: "+&r" (__res)				\
+				: "r" (__m), "r" (__n)			\
+				: "cc" );				\
+		} else {						\
+			asm (	"umlal	%R0, %Q0, %R2, %Q3\n\t"		\
+				"umlal	%R0, %1, %Q2, %R3\n\t"		\
+				"mov	%R0, #0\n\t"			\
+				"adds	%Q0, %1, %Q0\n\t"		\
+				"adc	%R0, %R0, #0\n\t"		\
+				"umlal	%Q0, %R0, %R2, %R3"		\
+				: "+&r" (__res), "+&r" (__z)		\
+				: "r" (__m), "r" (__n)			\
+				: "cc" );				\
+		}							\
+		__res /= __p;						\
+		/* The reminder can be computed with 32-bit regs     */	\
+		/* only, and gcc is good at that.                    */	\
+		{							\
+			unsigned int __res0 = __res;			\
+			unsigned int __b0 = __b;			\
+			__r -= __res0 * __b0;				\
+		}							\
+		/* BUG_ON(__r >= __b || __res * __b + __r != n); */	\
+		n = __res;						\
+	}								\
+	__r;								\
 })
 
 /* our own fls implementation to make sure constant propagation is fine */
-#define __div64_fls(bits)                                              \
-({                                                                     \
-       unsigned int __left = (bits), __nr = 0;                         \
-       if (__left & 0xffff0000) __nr += 16, __left >>= 16;             \
-       if (__left & 0x0000ff00) __nr +=  8, __left >>=  8;             \
-       if (__left & 0x000000f0) __nr +=  4, __left >>=  4;             \
-       if (__left & 0x0000000c) __nr +=  2, __left >>=  2;             \
-       if (__left & 0x00000002) __nr +=  1;                            \
-       __nr;                                                           \
+#define __div64_fls(bits)						\
+({									\
+	unsigned int __left = (bits), __nr = 0;				\
+	if (__left & 0xffff0000) __nr += 16, __left >>= 16;		\
+	if (__left & 0x0000ff00) __nr +=  8, __left >>=  8;		\
+	if (__left & 0x000000f0) __nr +=  4, __left >>=  4;		\
+	if (__left & 0x0000000c) __nr +=  2, __left >>=  2;		\
+	if (__left & 0x00000002) __nr +=  1;				\
+	__nr;								\
 })
 
 #endif
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/include/asm-arm/numa.h
--- a/xen/include/asm-arm/numa.h	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/include/asm-arm/numa.h	Mon Feb 13 17:26:08 2012 +0000
@@ -3,7 +3,7 @@
 
 /* Fake one node for now... */
 #define cpu_to_node(cpu) 0
-#define node_to_cpumask(node)  (cpu_online_map)
+#define node_to_cpumask(node)	(cpu_online_map)
 
 static inline __attribute__((pure)) int phys_to_nid(paddr_t addr)
 {

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:37 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDh-0005DY-Ik; Tue, 14 Feb 2012 23:55:37 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDf-0005Ap-32
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:35 +0000
Received: from [85.158.139.83:51662] by server-8.bemta-5.messagelabs.com id
	AE/4D-09797-674FA3F4; Tue, 14 Feb 2012 23:55:34 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-182.messagelabs.com!1329263727!7752254!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31524 invoked from network); 14 Feb 2012 23:55:28 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:28 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDX-0007ix-Eu
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:27 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDX-0002Jh-AC
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:27 +0000
Message-Id: <E1RxSDX-0002Jh-AC@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:26 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: fixup hard tabs
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329153968 0
# Node ID 0ba87b95e80bae059fe70b4b117dcc409f2471ef
# Parent  f3d137e3e6c79ea9c66e7b224c9041404e753149
arm: fixup hard tabs

Unfortunately the tool I was using to apply patches mangles hard tabs. This
patch corrects this in the effected files (which is fortunately only a subset
of .S or files imported from Linux).

This commit fixes this error such that the tree represents the state it would
have been in had I correctly committed what I was sent.

"git diff" and "git diff -b" vs. Stefano's v6 branch now contain the same
output -- i.e. only the intervening development

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/dummy.S
--- a/xen/arch/arm/dummy.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/dummy.S	Mon Feb 13 17:26:08 2012 +0000
@@ -1,13 +1,13 @@
 /* Nothing is mapped at 1G, for the moment */
 #define DUMMY(x) \
-       .globl x; \
-x:     .word 0xe7f000f0
-/* x:  mov r0, #0x40000000 ; str r0, [r0]; b x */
+	.globl x; \
+x:	.word 0xe7f000f0
+/* x:	mov r0, #0x40000000 ; str r0, [r0]; b x */
 
 #define  NOP(x) \
-       .globl x; \
-x:     mov pc, lr
-
+	.globl x; \
+x:	mov pc, lr
+	
 DUMMY(alloc_pirq_struct);
 DUMMY(alloc_vcpu_guest_context);
 DUMMY(arch_do_domctl);
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/entry.S
--- a/xen/arch/arm/entry.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/entry.S	Mon Feb 13 17:26:08 2012 +0000
@@ -1,69 +1,69 @@
 #include <xen/config.h>
 #include <asm/asm_defns.h>
 
-#define SAVE_ONE_BANKED(reg)   mrs r11, reg; str r11, [sp, #UREGS_##reg]
-#define RESTORE_ONE_BANKED(reg)        ldr r11, [sp, #UREGS_##reg]; msr reg, r11
+#define SAVE_ONE_BANKED(reg)	mrs r11, reg; str r11, [sp, #UREGS_##reg]
+#define RESTORE_ONE_BANKED(reg)	ldr r11, [sp, #UREGS_##reg]; msr reg, r11
 
 #define SAVE_BANKED(mode) \
-       SAVE_ONE_BANKED(SP_##mode) ; SAVE_ONE_BANKED(LR_##mode) ; SAVE_ONE_BANKED(SPSR_##mode)
+	SAVE_ONE_BANKED(SP_##mode) ; SAVE_ONE_BANKED(LR_##mode) ; SAVE_ONE_BANKED(SPSR_##mode)
 
 #define RESTORE_BANKED(mode) \
-       RESTORE_ONE_BANKED(SP_##mode) ; RESTORE_ONE_BANKED(LR_##mode) ; RESTORE_ONE_BANKED(SPSR_##mode)
+	RESTORE_ONE_BANKED(SP_##mode) ; RESTORE_ONE_BANKED(LR_##mode) ; RESTORE_ONE_BANKED(SPSR_##mode)
 
-#define SAVE_ALL                                                                                       \
-       sub sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */                                      \
-       push {r0-r12}; /* Save R0-R12 */                                                                \
-                                                                                                       \
-       mrs r11, ELR_hyp;               /* ELR_hyp is return address. */                                \
-       str r11, [sp, #UREGS_pc];                                                                       \
-                                                                                                       \
-       str lr, [sp, #UREGS_lr];                                                                        \
-                                                                                                       \
-       add r11, sp, #UREGS_kernel_sizeof+4;                                                            \
-       str r11, [sp, #UREGS_sp];                                                                       \
-                                                                                                       \
-       mrs r11, SPSR_hyp;                                                                              \
-       str r11, [sp, #UREGS_cpsr];                                                                     \
-       and r11, #PSR_MODE_MASK;                                                                        \
-       cmp r11, #PSR_MODE_HYP;                                                                         \
-       blne save_guest_regs
+#define SAVE_ALL											\
+	sub sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */					\
+	push {r0-r12}; /* Save R0-R12 */								\
+													\
+	mrs r11, ELR_hyp;		/* ELR_hyp is return address. */				\
+	str r11, [sp, #UREGS_pc];									\
+													\
+	str lr, [sp, #UREGS_lr];									\
+													\
+	add r11, sp, #UREGS_kernel_sizeof+4;								\
+	str r11, [sp, #UREGS_sp];									\
+													\
+	mrs r11, SPSR_hyp;										\
+	str r11, [sp, #UREGS_cpsr];									\
+	and r11, #PSR_MODE_MASK;									\
+	cmp r11, #PSR_MODE_HYP;										\
+	blne save_guest_regs
 
 save_guest_regs:
-       ldr r11, [sp, #UREGS_lr]
-       str r11, [sp, #UREGS_LR_usr]
-       ldr r11, =0xffffffff  /* Clobber SP which is only valid for hypervisor frames. */
-       str r11, [sp, #UREGS_sp]
-       SAVE_ONE_BANKED(SP_usr)
-       SAVE_BANKED(svc)
-       SAVE_BANKED(abt)
-       SAVE_BANKED(und)
-       SAVE_BANKED(irq)
-       SAVE_BANKED(fiq)
-       SAVE_ONE_BANKED(R8_fiq); SAVE_ONE_BANKED(R9_fiq); SAVE_ONE_BANKED(R10_fiq)
-       SAVE_ONE_BANKED(R11_fiq); SAVE_ONE_BANKED(R12_fiq);
-       mov pc, lr
+	ldr r11, [sp, #UREGS_lr]
+	str r11, [sp, #UREGS_LR_usr]
+	ldr r11, =0xffffffff  /* Clobber SP which is only valid for hypervisor frames. */
+	str r11, [sp, #UREGS_sp]
+	SAVE_ONE_BANKED(SP_usr)
+	SAVE_BANKED(svc)
+	SAVE_BANKED(abt)
+	SAVE_BANKED(und)
+	SAVE_BANKED(irq)
+	SAVE_BANKED(fiq)
+	SAVE_ONE_BANKED(R8_fiq); SAVE_ONE_BANKED(R9_fiq); SAVE_ONE_BANKED(R10_fiq)
+	SAVE_ONE_BANKED(R11_fiq); SAVE_ONE_BANKED(R12_fiq);
+	mov pc, lr
 
-#define DEFINE_TRAP_ENTRY(trap)                                                                                \
-       ALIGN;                                                                                          \
-trap_##trap:                                                                                           \
-       SAVE_ALL;                                                                                       \
-       adr lr, return_from_trap;                                                                       \
-       mov r0, sp;                                                                                     \
-       mov r11, sp;                                                                                    \
-       bic sp, #7; /* Align the stack pointer (noop on guest trap) */                                  \
-       b do_trap_##trap
+#define DEFINE_TRAP_ENTRY(trap)										\
+	ALIGN;												\
+trap_##trap:												\
+	SAVE_ALL;											\
+	adr lr, return_from_trap;									\
+	mov r0, sp;											\
+	mov r11, sp;											\
+	bic sp, #7; /* Align the stack pointer (noop on guest trap) */					\
+	b do_trap_##trap
 
 .globl hyp_traps_vector
-       .align 5
+	.align 5
 hyp_traps_vector:
-       .word 0                         /* 0x00 - Reset */
-       b trap_undefined_instruction    /* 0x04 - Undefined Instruction */
-       b trap_supervisor_call          /* 0x08 - Supervisor Call */
-       b trap_prefetch_abort           /* 0x0c - Prefetch Abort */
-       b trap_data_abort               /* 0x10 - Data Abort */
-       b trap_hypervisor               /* 0x14 - Hypervisor */
-       b trap_irq                      /* 0x18 - IRQ */
-       b trap_fiq                      /* 0x1c - FIQ */
+	.word 0				/* 0x00 - Reset */
+	b trap_undefined_instruction	/* 0x04 - Undefined Instruction */
+	b trap_supervisor_call		/* 0x08 - Supervisor Call */
+	b trap_prefetch_abort		/* 0x0c - Prefetch Abort */
+	b trap_data_abort		/* 0x10 - Data Abort */
+	b trap_hypervisor		/* 0x14 - Hypervisor */
+	b trap_irq			/* 0x18 - IRQ */
+	b trap_fiq			/* 0x1c - FIQ */
 
 DEFINE_TRAP_ENTRY(undefined_instruction)
 DEFINE_TRAP_ENTRY(supervisor_call)
@@ -74,34 +74,34 @@
 DEFINE_TRAP_ENTRY(fiq)
 
 ENTRY(return_from_trap)
-       ldr r11, [sp, #UREGS_cpsr]
-       and r11, #PSR_MODE_MASK
-       cmp r11, #PSR_MODE_HYP
-       beq return_to_hypervisor
+	ldr r11, [sp, #UREGS_cpsr]
+	and r11, #PSR_MODE_MASK
+	cmp r11, #PSR_MODE_HYP
+	beq return_to_hypervisor
 
 ENTRY(return_to_guest)
-       mov r11, sp
-       bic sp, #7 /* Align the stack pointer */
-       bl leave_hypervisor_tail
-       ldr r11, [sp, #UREGS_pc]
-       msr ELR_hyp, r11
-       ldr r11, [sp, #UREGS_cpsr]
-       msr SPSR_hyp, r11
-       RESTORE_ONE_BANKED(SP_usr)
-       RESTORE_BANKED(svc)
-       RESTORE_BANKED(abt)
-       RESTORE_BANKED(und)
-       RESTORE_BANKED(irq)
-       RESTORE_BANKED(fiq)
-       RESTORE_ONE_BANKED(R8_fiq); RESTORE_ONE_BANKED(R9_fiq); RESTORE_ONE_BANKED(R10_fiq)
-       RESTORE_ONE_BANKED(R11_fiq); RESTORE_ONE_BANKED(R12_fiq);
-       ldr lr, [sp, #UREGS_LR_usr]
-       pop {r0-r12}
-       add sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */
-       eret
+	mov r11, sp
+	bic sp, #7 /* Align the stack pointer */
+	bl leave_hypervisor_tail
+	ldr r11, [sp, #UREGS_pc]
+	msr ELR_hyp, r11
+	ldr r11, [sp, #UREGS_cpsr]
+	msr SPSR_hyp, r11
+	RESTORE_ONE_BANKED(SP_usr)
+	RESTORE_BANKED(svc)
+	RESTORE_BANKED(abt)
+	RESTORE_BANKED(und)
+	RESTORE_BANKED(irq)
+	RESTORE_BANKED(fiq)
+	RESTORE_ONE_BANKED(R8_fiq); RESTORE_ONE_BANKED(R9_fiq); RESTORE_ONE_BANKED(R10_fiq)
+	RESTORE_ONE_BANKED(R11_fiq); RESTORE_ONE_BANKED(R12_fiq);
+	ldr lr, [sp, #UREGS_LR_usr]
+	pop {r0-r12}
+	add sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */
+	eret
 
 ENTRY(return_to_hypervisor)
-       ldr lr, [sp, #UREGS_lr]
-       pop {r0-r12}
-       add sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */
-       eret
+	ldr lr, [sp, #UREGS_lr]
+	pop {r0-r12}
+	add sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */
+	eret
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/head.S
--- a/xen/arch/arm/head.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/head.S	Mon Feb 13 17:26:08 2012 +0000
@@ -26,281 +26,281 @@
  * Clobbers r0-r3. */
 #ifdef EARLY_UART_ADDRESS
 #define PRINT(_s)       \
-       adr   r0, 98f ; \
-       bl    puts    ; \
-       b     99f     ; \
-98:    .asciz _s     ; \
-       .align 2      ; \
+	adr   r0, 98f ; \
+	bl    puts    ; \
+	b     99f     ; \
+98:	.asciz _s     ; \
+	.align 2      ; \
 99:
 #else
 #define PRINT(s)
 #endif
 
-       .arm
+	.arm
 
-       /* This must be the very first address in the loaded image.
-        * It should be linked at XEN_VIRT_START, and loaded at any
-        * 2MB-aligned address.  All of text+data+bss must fit in 2MB,
-        * or the initial pagetable code below will need adjustment. */
-       .global start
+	/* This must be the very first address in the loaded image.
+	 * It should be linked at XEN_VIRT_START, and loaded at any
+	 * 2MB-aligned address.  All of text+data+bss must fit in 2MB,
+	 * or the initial pagetable code below will need adjustment. */
+	.global start
 start:
-       cpsid aif                    /* Disable all interrupts */
+	cpsid aif                    /* Disable all interrupts */
 
-       /* Save the bootloader arguments in less-clobberable registers */
-       mov   r7, r1                 /* r7 := ARM-linux machine type */
-       mov   r8, r2                 /* r8 := ATAG base address */
+	/* Save the bootloader arguments in less-clobberable registers */
+	mov   r7, r1                 /* r7 := ARM-linux machine type */
+	mov   r8, r2                 /* r8 := ATAG base address */
 
-       /* Find out where we are */
-       ldr   r0, =start
-       adr   r9, start              /* r9  := paddr (start) */
-       sub   r10, r9, r0            /* r10 := phys-offset */
+	/* Find out where we are */
+	ldr   r0, =start
+	adr   r9, start              /* r9  := paddr (start) */
+	sub   r10, r9, r0            /* r10 := phys-offset */
 
-        /* Using the DTB in the .dtb section? */
+	/* Using the DTB in the .dtb section? */
 #ifdef CONFIG_DTB_FILE
-        ldr   r8, =_sdtb
-        add   r8, r10                /* r8 := paddr(DTB) */
+	ldr   r8, =_sdtb
+	add   r8, r10                /* r8 := paddr(DTB) */
 #endif
 
 #ifdef EARLY_UART_ADDRESS
-       /* Say hello */
-       ldr   r11, =EARLY_UART_ADDRESS  /* r11 := UART base address */
-       bl    init_uart
+	/* Say hello */
+	ldr   r11, =EARLY_UART_ADDRESS  /* r11 := UART base address */
+	bl    init_uart
 #endif
 
-       /* Check that this CPU has Hyp mode */
-       mrc   CP32(r0, ID_PFR1)
-       and   r0, r0, #0xf000        /* Bits 12-15 define virt extensions */
-       teq   r0, #0x1000            /* Must == 0x1 or may be incompatible */
-       beq   1f
-       bl    putn
-       PRINT("- CPU doesn't support the virtualization extensions -\r\n")
-       b     fail
+	/* Check that this CPU has Hyp mode */
+	mrc   CP32(r0, ID_PFR1)
+	and   r0, r0, #0xf000        /* Bits 12-15 define virt extensions */
+	teq   r0, #0x1000            /* Must == 0x1 or may be incompatible */
+	beq   1f
+	bl    putn
+	PRINT("- CPU doesn't support the virtualization extensions -\r\n")
+	b     fail
 1:
-       /* Check if we're already in it */
-       mrs   r0, cpsr
-       and   r0, r0, #0x1f          /* Mode is in the low 5 bits of CPSR */
-       teq   r0, #0x1a              /* Hyp Mode? */
-       bne   1f
-       PRINT("- Started in Hyp mode -\r\n")
-       b     hyp
+	/* Check if we're already in it */
+	mrs   r0, cpsr
+	and   r0, r0, #0x1f          /* Mode is in the low 5 bits of CPSR */
+	teq   r0, #0x1a              /* Hyp Mode? */
+	bne   1f
+	PRINT("- Started in Hyp mode -\r\n")
+	b     hyp
 1:
-       /* Otherwise, it must have been Secure Supervisor mode */
-       mrc   CP32(r0, SCR)
-       tst   r0, #0x1               /* Not-Secure bit set? */
-       beq   1f
-       PRINT("- CPU is not in Hyp mode or Secure state -\r\n")
-       b     fail
+	/* Otherwise, it must have been Secure Supervisor mode */
+	mrc   CP32(r0, SCR)
+	tst   r0, #0x1               /* Not-Secure bit set? */
+	beq   1f
+	PRINT("- CPU is not in Hyp mode or Secure state -\r\n")
+	b     fail
 1:
-       /* OK, we're in Secure state. */
-       PRINT("- Started in Secure state -\r\n- Entering Hyp mode -\r\n")
+	/* OK, we're in Secure state. */
+	PRINT("- Started in Secure state -\r\n- Entering Hyp mode -\r\n")
 
-       /* Dance into Hyp mode */
-       cpsid aif, #0x16             /* Enter Monitor mode */
-       mrc   CP32(r0, SCR)
-       orr   r0, r0, #0x100         /* Set HCE */
-       orr   r0, r0, #0xb1          /* Set SCD, AW, FW and NS */
-       bic   r0, r0, #0xe           /* Clear EA, FIQ and IRQ */
-       mcr   CP32(r0, SCR)
-       /* Ugly: the system timer's frequency register is only
-        * programmable in Secure state.  Since we don't know where its
-        * memory-mapped control registers live, we can't find out the
-        * right frequency.  Use the VE model's default frequency here. */
-       ldr   r0, =0x5f5e100         /* 100 MHz */
-       mcr   CP32(r0, CNTFRQ)
-       ldr   r0, =0x40c00           /* SMP, c11, c10 in non-secure mode */
-       mcr   CP32(r0, NSACR)
-       /* Continuing ugliness: Set up the GIC so NS state owns interrupts */
-       mov   r0, #GIC_BASE_ADDRESS
-       add   r0, r0, #GIC_DR_OFFSET
-       mov   r1, #0
-       str   r1, [r0]               /* Disable delivery in the distributor */
-       add   r0, r0, #0x80          /* GICD_IGROUP0 */
-       mov   r2, #0xffffffff        /* All interrupts to group 1 */
-       str   r2, [r0]
-       str   r2, [r0, #4]
-       str   r2, [r0, #8]
-       /* Must drop priority mask below 0x80 before entering NS state */
-       mov   r0, #GIC_BASE_ADDRESS
-       add   r0, r0, #GIC_CR_OFFSET
-       ldr   r1, =0xff
-       str   r1, [r0, #0x4]         /* -> GICC_PMR */
-       /* Reset a few config registers */
-       mov   r0, #0
-       mcr   CP32(r0, FCSEIDR)
-       mcr   CP32(r0, CONTEXTIDR)
-       /* FIXME: ought to reset some other NS control regs here */
-       adr   r1, 1f
-       adr   r0, hyp                /* Store paddr (hyp entry point) */
-       str   r0, [r1]               /* where we can use it for RFE */
-       isb                          /* Ensure we see the stored target address */
-       rfeia r1                     /* Enter Hyp mode */
+	/* Dance into Hyp mode */
+	cpsid aif, #0x16             /* Enter Monitor mode */
+	mrc   CP32(r0, SCR)
+	orr   r0, r0, #0x100         /* Set HCE */
+	orr   r0, r0, #0xb1          /* Set SCD, AW, FW and NS */
+	bic   r0, r0, #0xe           /* Clear EA, FIQ and IRQ */
+	mcr   CP32(r0, SCR)
+	/* Ugly: the system timer's frequency register is only
+	 * programmable in Secure state.  Since we don't know where its
+	 * memory-mapped control registers live, we can't find out the
+	 * right frequency.  Use the VE model's default frequency here. */
+	ldr   r0, =0x5f5e100         /* 100 MHz */
+	mcr   CP32(r0, CNTFRQ)
+	ldr   r0, =0x40c00           /* SMP, c11, c10 in non-secure mode */
+	mcr   CP32(r0, NSACR)
+	/* Continuing ugliness: Set up the GIC so NS state owns interrupts */
+	mov   r0, #GIC_BASE_ADDRESS
+	add   r0, r0, #GIC_DR_OFFSET
+	mov   r1, #0
+	str   r1, [r0]               /* Disable delivery in the distributor */
+	add   r0, r0, #0x80          /* GICD_IGROUP0 */
+	mov   r2, #0xffffffff        /* All interrupts to group 1 */
+	str   r2, [r0]
+	str   r2, [r0, #4]
+	str   r2, [r0, #8]
+	/* Must drop priority mask below 0x80 before entering NS state */
+	mov   r0, #GIC_BASE_ADDRESS
+	add   r0, r0, #GIC_CR_OFFSET
+	ldr   r1, =0xff
+	str   r1, [r0, #0x4]         /* -> GICC_PMR */
+	/* Reset a few config registers */
+	mov   r0, #0
+	mcr   CP32(r0, FCSEIDR)
+	mcr   CP32(r0, CONTEXTIDR)
+	/* FIXME: ought to reset some other NS control regs here */
+	adr   r1, 1f
+	adr   r0, hyp                /* Store paddr (hyp entry point) */
+	str   r0, [r1]               /* where we can use it for RFE */
+	isb                          /* Ensure we see the stored target address */
+	rfeia r1                     /* Enter Hyp mode */
 
-1:     .word 0                      /* PC to enter Hyp mode at */
-       .word 0x000001da             /* CPSR: LE, Abort/IRQ/FIQ off, Hyp */
+1:	.word 0                      /* PC to enter Hyp mode at */
+	.word 0x000001da             /* CPSR: LE, Abort/IRQ/FIQ off, Hyp */
 
 hyp:
-       PRINT("- Setting up control registers -\r\n")
+	PRINT("- Setting up control registers -\r\n")
 
-       /* Set up memory attribute type tables */
-       ldr   r0, =MAIR0VAL
-       ldr   r1, =MAIR1VAL
-       mcr   CP32(r0, MAIR0)
-       mcr   CP32(r1, MAIR1)
-       mcr   CP32(r0, HMAIR0)
-       mcr   CP32(r1, HMAIR1)
+	/* Set up memory attribute type tables */
+	ldr   r0, =MAIR0VAL
+	ldr   r1, =MAIR1VAL
+	mcr   CP32(r0, MAIR0)
+	mcr   CP32(r1, MAIR1)
+	mcr   CP32(r0, HMAIR0)
+	mcr   CP32(r1, HMAIR1)
 
-       /* Set up the HTCR:
-        * PT walks use Outer-Shareable accesses,
-        * PT walks are write-back, no-write-allocate in both cache levels,
-        * Full 32-bit address space goes through this table. */
-       ldr   r0, =0x80002500
-       mcr   CP32(r0, HTCR)
+	/* Set up the HTCR:
+	 * PT walks use Outer-Shareable accesses,
+	 * PT walks are write-back, no-write-allocate in both cache levels,
+	 * Full 32-bit address space goes through this table. */
+	ldr   r0, =0x80002500
+	mcr   CP32(r0, HTCR)
 
-       /* Set up the HSCTLR:
-        * Exceptions in LE ARM,
-        * Low-latency IRQs disabled,
-        * Write-implies-XN disabled (for now),
-        * I-cache and d-cache enabled,
-        * Alignment checking enabled,
-        * MMU translation disabled (for now). */
-       ldr   r0, =(HSCTLR_BASE|SCTLR_A|SCTLR_C)
-       mcr   CP32(r0, HSCTLR)
+	/* Set up the HSCTLR:
+	 * Exceptions in LE ARM,
+	 * Low-latency IRQs disabled,
+	 * Write-implies-XN disabled (for now),
+	 * I-cache and d-cache enabled,
+	 * Alignment checking enabled,
+	 * MMU translation disabled (for now). */
+	ldr   r0, =(HSCTLR_BASE|SCTLR_A|SCTLR_C)
+	mcr   CP32(r0, HSCTLR)
 
-       /* Write Xen's PT's paddr into the HTTBR */
-       ldr   r4, =xen_pgtable
-       add   r4, r4, r10            /* r4 := paddr (xen_pagetable) */
-       mov   r5, #0                 /* r4:r5 is paddr (xen_pagetable) */
-       mcrr  CP64(r4, r5, HTTBR)
+	/* Write Xen's PT's paddr into the HTTBR */
+	ldr   r4, =xen_pgtable
+	add   r4, r4, r10            /* r4 := paddr (xen_pagetable) */
+	mov   r5, #0                 /* r4:r5 is paddr (xen_pagetable) */
+	mcrr  CP64(r4, r5, HTTBR)
 
-       /* Build the baseline idle pagetable's first-level entries */
-       ldr   r1, =xen_second
-       add   r1, r1, r10            /* r1 := paddr (xen_second) */
-       mov   r3, #0x0
-       orr   r2, r1, #0xe00         /* r2:r3 := table map of xen_second */
-       orr   r2, r2, #0x07f         /* (+ rights for linear PT) */
-       strd  r2, r3, [r4, #0]       /* Map it in slot 0 */
-       add   r2, r2, #0x1000
-       strd  r2, r3, [r4, #8]       /* Map 2nd page in slot 1 */
-       add   r2, r2, #0x1000
-       strd  r2, r3, [r4, #16]      /* Map 3rd page in slot 2 */
-       add   r2, r2, #0x1000
-       strd  r2, r3, [r4, #24]      /* Map 4th page in slot 3 */
+	/* Build the baseline idle pagetable's first-level entries */
+	ldr   r1, =xen_second
+	add   r1, r1, r10            /* r1 := paddr (xen_second) */
+	mov   r3, #0x0
+	orr   r2, r1, #0xe00         /* r2:r3 := table map of xen_second */
+	orr   r2, r2, #0x07f         /* (+ rights for linear PT) */
+	strd  r2, r3, [r4, #0]       /* Map it in slot 0 */
+	add   r2, r2, #0x1000
+	strd  r2, r3, [r4, #8]       /* Map 2nd page in slot 1 */
+	add   r2, r2, #0x1000
+	strd  r2, r3, [r4, #16]      /* Map 3rd page in slot 2 */
+	add   r2, r2, #0x1000
+	strd  r2, r3, [r4, #24]      /* Map 4th page in slot 3 */
 
-       /* Now set up the second-level entries */
-       orr   r2, r9, #0xe00
-       orr   r2, r2, #0x07d         /* r2:r3 := 2MB normal map of Xen */
-       mov   r4, r9, lsr #18        /* Slot for paddr(start) */
-       strd  r2, r3, [r1, r4]       /* Map Xen there */
-       ldr   r4, =start
-       lsr   r4, #18                /* Slot for vaddr(start) */
-       strd  r2, r3, [r1, r4]       /* Map Xen there too */
+	/* Now set up the second-level entries */
+	orr   r2, r9, #0xe00
+	orr   r2, r2, #0x07d         /* r2:r3 := 2MB normal map of Xen */
+	mov   r4, r9, lsr #18        /* Slot for paddr(start) */
+	strd  r2, r3, [r1, r4]       /* Map Xen there */
+	ldr   r4, =start
+	lsr   r4, #18                /* Slot for vaddr(start) */
+	strd  r2, r3, [r1, r4]       /* Map Xen there too */
 #ifdef EARLY_UART_ADDRESS
-       ldr   r3, =(1<<(54-32))      /* NS for device mapping */
-       lsr   r2, r11, #21
-       lsl   r2, r2, #21            /* 2MB-aligned paddr of UART */
-       orr   r2, r2, #0xe00
-       orr   r2, r2, #0x071         /* r2:r3 := 2MB dev map including UART */
-       add   r4, r4, #8
-       strd  r2, r3, [r1, r4]       /* Map it in the fixmap's slot */
+	ldr   r3, =(1<<(54-32))      /* NS for device mapping */
+	lsr   r2, r11, #21
+	lsl   r2, r2, #21            /* 2MB-aligned paddr of UART */
+	orr   r2, r2, #0xe00
+	orr   r2, r2, #0x071         /* r2:r3 := 2MB dev map including UART */
+	add   r4, r4, #8
+	strd  r2, r3, [r1, r4]       /* Map it in the fixmap's slot */
 #else
-       add   r4, r4, #8             /* Skip over unused fixmap slot */
+	add   r4, r4, #8             /* Skip over unused fixmap slot */
 #endif
-       mov   r3, #0x0
-       lsr   r2, r8, #21
-       lsl   r2, r2, #21            /* 2MB-aligned paddr of DTB */
-       orr   r2, r2, #0xf00
-       orr   r2, r2, #0x07d         /* r2:r3 := 2MB RAM incl. DTB */
-       add   r4, r4, #8
-       strd  r2, r3, [r1, r4]       /* Map it in the early boot slot */
+	mov   r3, #0x0
+	lsr   r2, r8, #21
+	lsl   r2, r2, #21            /* 2MB-aligned paddr of DTB */
+	orr   r2, r2, #0xf00
+	orr   r2, r2, #0x07d         /* r2:r3 := 2MB RAM incl. DTB */
+	add   r4, r4, #8
+	strd  r2, r3, [r1, r4]       /* Map it in the early boot slot */
 
-       PRINT("- Turning on paging -\r\n")
+	PRINT("- Turning on paging -\r\n")
 
-       ldr   r1, =paging            /* Explicit vaddr, not RIP-relative */
-       mrc   CP32(r0, HSCTLR)
-       orr   r0, r0, #0x1           /* Add in the MMU enable bit */
-       dsb                          /* Flush PTE writes and finish reads */
-       mcr   CP32(r0, HSCTLR)       /* now paging is enabled */
-       isb                          /* Now, flush the icache */
-       mov   pc, r1                 /* Get a proper vaddr into PC */
+	ldr   r1, =paging            /* Explicit vaddr, not RIP-relative */
+	mrc   CP32(r0, HSCTLR)
+	orr   r0, r0, #0x1           /* Add in the MMU enable bit */
+	dsb                          /* Flush PTE writes and finish reads */
+	mcr   CP32(r0, HSCTLR)       /* now paging is enabled */
+	isb                          /* Now, flush the icache */
+	mov   pc, r1                 /* Get a proper vaddr into PC */
 paging:
 
 #ifdef EARLY_UART_ADDRESS
-       /* Recover the UART address in the new address space */
-       lsl   r11, #11
-       lsr   r11, #11               /* UART base's offset from 2MB base */
-       adr   r0, start
-       add   r0, r0, #0x200000      /* vaddr of the fixmap's 2MB slot */
-       add   r11, r11, r0           /* r11 := vaddr (UART base address) */
+	/* Recover the UART address in the new address space */
+	lsl   r11, #11
+	lsr   r11, #11               /* UART base's offset from 2MB base */
+	adr   r0, start
+	add   r0, r0, #0x200000      /* vaddr of the fixmap's 2MB slot */
+	add   r11, r11, r0           /* r11 := vaddr (UART base address) */
 #endif
 
-       PRINT("- Entering C -\r\n")
+	PRINT("- Entering C -\r\n")
 
-       ldr   sp, =init_stack        /* Supply a stack */
-       add   sp, #STACK_SIZE        /* (which grows down from the top). */
-       sub   sp, #CPUINFO_sizeof    /* Make room for CPU save record */
-       mov   r0, r10                /* Marshal args: - phys_offset */
-       mov   r1, r7                 /*               - machine type */
-       mov   r2, r8                 /*               - ATAG address */
-       b     start_xen              /* and disappear into the land of C */
+	ldr   sp, =init_stack        /* Supply a stack */
+	add   sp, #STACK_SIZE        /* (which grows down from the top). */
+	sub   sp, #CPUINFO_sizeof    /* Make room for CPU save record */
+	mov   r0, r10                /* Marshal args: - phys_offset */
+	mov   r1, r7                 /*               - machine type */
+	mov   r2, r8                 /*               - ATAG address */
+	b     start_xen              /* and disappear into the land of C */
 
 /* Fail-stop
  * r0: string explaining why */
-fail:  PRINT("- Boot failed -\r\n")
-1:     wfe
-       b     1b
+fail:	PRINT("- Boot failed -\r\n")
+1:	wfe
+	b     1b
 
 #ifdef EARLY_UART_ADDRESS
 
 /* Bring up the UART. Specific to the PL011 UART.
  * Clobbers r0-r2 */
 init_uart:
-       mov   r1, #0x0
-       str   r1, [r11, #0x24]       /* -> UARTIBRD (Baud divisor fraction) */
-       mov   r1, #0x4               /* 7.3728MHz / 0x4 == 16 * 115200 */
-       str   r1, [r11, #0x24]       /* -> UARTIBRD (Baud divisor integer) */
-       mov   r1, #0x60              /* 8n1 */
-       str   r1, [r11, #0x24]       /* -> UARTLCR_H (Line control) */
-       ldr   r1, =0x00000301        /* RXE | TXE | UARTEN */
-       str   r1, [r11, #0x30]       /* -> UARTCR (Control Register) */
-       adr   r0, 1f
-       b     puts
-1:     .asciz "- UART enabled -\r\n"
-       .align 4
+	mov   r1, #0x0
+	str   r1, [r11, #0x24]       /* -> UARTIBRD (Baud divisor fraction) */
+	mov   r1, #0x4               /* 7.3728MHz / 0x4 == 16 * 115200 */
+	str   r1, [r11, #0x24]       /* -> UARTIBRD (Baud divisor integer) */
+	mov   r1, #0x60              /* 8n1 */
+	str   r1, [r11, #0x24]       /* -> UARTLCR_H (Line control) */
+	ldr   r1, =0x00000301        /* RXE | TXE | UARTEN */
+	str   r1, [r11, #0x30]       /* -> UARTCR (Control Register) */
+	adr   r0, 1f
+	b     puts
+1:	.asciz "- UART enabled -\r\n"
+	.align 4
 
 /* Print early debug messages.  Specific to the PL011 UART.
  * r0: Nul-terminated string to print.
  * Clobbers r0-r2 */
 puts:
-       ldr   r2, [r11, #0x18]       /* <- UARTFR (Flag register) */
-       tst   r2, #0x8               /* Check BUSY bit */
-       bne   puts                   /* Wait for the UART to be ready */
-       ldrb  r2, [r0], #1           /* Load next char */
-       teq   r2, #0                 /* Exit on nul*/
-       moveq pc, lr
-       str   r2, [r11]              /* -> UARTDR (Data Register) */
-       b     puts
+	ldr   r2, [r11, #0x18]       /* <- UARTFR (Flag register) */
+	tst   r2, #0x8               /* Check BUSY bit */
+	bne   puts                   /* Wait for the UART to be ready */
+	ldrb  r2, [r0], #1           /* Load next char */
+	teq   r2, #0                 /* Exit on nul*/
+	moveq pc, lr
+	str   r2, [r11]              /* -> UARTDR (Data Register) */
+	b     puts
 
 /* Print a 32-bit number in hex.  Specific to the PL011 UART.
  * r0: Number to print.
  * clobbers r0-r3 */
 putn:
-       adr   r1, hex
-       mov   r3, #8
-1:     ldr   r2, [r11, #0x18]       /* <- UARTFR (Flag register) */
-       tst   r2, #0x8               /* Check BUSY bit */
-       bne   1b                     /* Wait for the UART to be ready */
-       and   r2, r0, #0xf0000000    /* Mask off the top nybble */
-       ldrb  r2, [r1, r2, lsr #28]  /* Convert to a char */
-       str   r2, [r11]              /* -> UARTDR (Data Register) */
-       lsl   r0, #4                 /* Roll it through one nybble at a time */
-       subs  r3, r3, #1
-       bne   1b
-       adr   r0, crlf               /* Finish with a newline */
-       b     puts
+	adr   r1, hex
+	mov   r3, #8
+1:	ldr   r2, [r11, #0x18]       /* <- UARTFR (Flag register) */
+	tst   r2, #0x8               /* Check BUSY bit */
+	bne   1b                     /* Wait for the UART to be ready */
+	and   r2, r0, #0xf0000000    /* Mask off the top nybble */
+	ldrb  r2, [r1, r2, lsr #28]  /* Convert to a char */
+	str   r2, [r11]              /* -> UARTDR (Data Register) */
+	lsl   r0, #4                 /* Roll it through one nybble at a time */
+	subs  r3, r3, #1
+	bne   1b
+	adr   r0, crlf               /* Finish with a newline */
+	b     puts
 
-crlf:  .asciz "\r\n"
-hex:   .ascii "0123456789abcdef"
-       .align 2
+crlf:	.asciz "\r\n"
+hex:	.ascii "0123456789abcdef"
+	.align 2
 
 #else  /* EARLY_UART_ADDRESS */
 
@@ -308,6 +308,6 @@
 .global early_puts
 early_puts:
 puts:
-putn:  mov   pc, lr
+putn:	mov   pc, lr
 
 #endif /* EARLY_UART_ADDRESS */
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/bitops.h
--- a/xen/arch/arm/lib/bitops.h	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/bitops.h	Mon Feb 13 17:26:08 2012 +0000
@@ -1,61 +1,61 @@
 #include <xen/config.h>
 
 #if __LINUX_ARM_ARCH__ >= 6
-       .macro  bitop, instr
-       ands    ip, r1, #3
-       strneb  r1, [ip]                @ assert word-aligned
-       mov     r2, #1
-       and     r3, r0, #31             @ Get bit offset
-       mov     r0, r0, lsr #5
-       add     r1, r1, r0, lsl #2      @ Get word offset
-       mov     r3, r2, lsl r3
-1:     ldrex   r2, [r1]
-       \instr  r2, r2, r3
-       strex   r0, r2, [r1]
-       cmp     r0, #0
-       bne     1b
-       bx      lr
-       .endm
+	.macro	bitop, instr
+	ands	ip, r1, #3
+	strneb	r1, [ip]		@ assert word-aligned
+	mov	r2, #1
+	and	r3, r0, #31		@ Get bit offset
+	mov	r0, r0, lsr #5
+	add	r1, r1, r0, lsl #2	@ Get word offset
+	mov	r3, r2, lsl r3
+1:	ldrex	r2, [r1]
+	\instr	r2, r2, r3
+	strex	r0, r2, [r1]
+	cmp	r0, #0
+	bne	1b
+	bx	lr
+	.endm
 
-       .macro  testop, instr, store
-       ands    ip, r1, #3
-       strneb  r1, [ip]                @ assert word-aligned
-       mov     r2, #1
-       and     r3, r0, #31             @ Get bit offset
-       mov     r0, r0, lsr #5
-       add     r1, r1, r0, lsl #2      @ Get word offset
-       mov     r3, r2, lsl r3          @ create mask
-       smp_dmb
-1:     ldrex   r2, [r1]
-       ands    r0, r2, r3              @ save old value of bit
-       \instr  r2, r2, r3              @ toggle bit
-       strex   ip, r2, [r1]
-       cmp     ip, #0
-       bne     1b
-       smp_dmb
-       cmp     r0, #0
-       movne   r0, #1
-2:     bx      lr
-       .endm
+	.macro	testop, instr, store
+	ands	ip, r1, #3
+	strneb	r1, [ip]		@ assert word-aligned
+	mov	r2, #1
+	and	r3, r0, #31		@ Get bit offset
+	mov	r0, r0, lsr #5
+	add	r1, r1, r0, lsl #2	@ Get word offset
+	mov	r3, r2, lsl r3		@ create mask
+	smp_dmb
+1:	ldrex	r2, [r1]
+	ands	r0, r2, r3		@ save old value of bit
+	\instr	r2, r2, r3		@ toggle bit
+	strex	ip, r2, [r1]
+	cmp	ip, #0
+	bne	1b
+	smp_dmb
+	cmp	r0, #0
+	movne	r0, #1
+2:	bx	lr
+	.endm
 #else
-       .macro  bitop, name, instr
-ENTRY( \name           )
-UNWIND(        .fnstart        )
-       ands    ip, r1, #3
-       strneb  r1, [ip]                @ assert word-aligned
-       and     r2, r0, #31
-       mov     r0, r0, lsr #5
-       mov     r3, #1
-       mov     r3, r3, lsl r2
-       save_and_disable_irqs ip
-       ldr     r2, [r1, r0, lsl #2]
-       \instr  r2, r2, r3
-       str     r2, [r1, r0, lsl #2]
-       restore_irqs ip
-       mov     pc, lr
-UNWIND(        .fnend          )
-ENDPROC(\name          )
-       .endm
+	.macro	bitop, name, instr
+ENTRY(	\name		)
+UNWIND(	.fnstart	)
+	ands	ip, r1, #3
+	strneb	r1, [ip]		@ assert word-aligned
+	and	r2, r0, #31
+	mov	r0, r0, lsr #5
+	mov	r3, #1
+	mov	r3, r3, lsl r2
+	save_and_disable_irqs ip
+	ldr	r2, [r1, r0, lsl #2]
+	\instr	r2, r2, r3
+	str	r2, [r1, r0, lsl #2]
+	restore_irqs ip
+	mov	pc, lr
+UNWIND(	.fnend		)
+ENDPROC(\name		)
+	.endm
 
 /**
  * testop - implement a test_and_xxx_bit operation.
@@ -65,23 +65,23 @@
  * Note: we can trivially conditionalise the store instruction
  * to avoid dirtying the data cache.
  */
-       .macro  testop, name, instr, store
-ENTRY( \name           )
-UNWIND(        .fnstart        )
-       ands    ip, r1, #3
-       strneb  r1, [ip]                @ assert word-aligned
-       and     r3, r0, #31
-       mov     r0, r0, lsr #5
-       save_and_disable_irqs ip
-       ldr     r2, [r1, r0, lsl #2]!
-       mov     r0, #1
-       tst     r2, r0, lsl r3
-       \instr  r2, r2, r0, lsl r3
-       \store  r2, [r1]
-       moveq   r0, #0
-       restore_irqs ip
-       mov     pc, lr
-UNWIND(        .fnend          )
-ENDPROC(\name          )
-       .endm
+	.macro	testop, name, instr, store
+ENTRY(	\name		)
+UNWIND(	.fnstart	)
+	ands	ip, r1, #3
+	strneb	r1, [ip]		@ assert word-aligned
+	and	r3, r0, #31
+	mov	r0, r0, lsr #5
+	save_and_disable_irqs ip
+	ldr	r2, [r1, r0, lsl #2]!
+	mov	r0, #1
+	tst	r2, r0, lsl r3
+	\instr	r2, r2, r0, lsl r3
+	\store	r2, [r1]
+	moveq	r0, #0
+	restore_irqs ip
+	mov	pc, lr
+UNWIND(	.fnend		)
+ENDPROC(\name		)
+	.endm
 #endif
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/changebit.S
--- a/xen/arch/arm/lib/changebit.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/changebit.S	Mon Feb 13 17:26:08 2012 +0000
@@ -14,5 +14,5 @@
                 .text
 
 ENTRY(_change_bit)
-       bitop   eor
+	bitop	eor
 ENDPROC(_change_bit)
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/clearbit.S
--- a/xen/arch/arm/lib/clearbit.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/clearbit.S	Mon Feb 13 17:26:08 2012 +0000
@@ -15,5 +15,5 @@
                 .text
 
 ENTRY(_clear_bit)
-       bitop   bic
+	bitop	bic
 ENDPROC(_clear_bit)
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/copy_template.S
--- a/xen/arch/arm/lib/copy_template.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/copy_template.S	Mon Feb 13 17:26:08 2012 +0000
@@ -3,9 +3,9 @@
  *
  *  Code template for optimized memory copy functions
  *
- *  Author:    Nicolas Pitre
- *  Created:   Sep 28, 2005
- *  Copyright: MontaVista Software, Inc.
+ *  Author:	Nicolas Pitre
+ *  Created:	Sep 28, 2005
+ *  Copyright:	MontaVista Software, Inc.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
@@ -24,227 +24,227 @@
  *
  * ldr1w ptr reg abort
  *
- *     This loads one word from 'ptr', stores it in 'reg' and increments
- *     'ptr' to the next word. The 'abort' argument is used for fixup tables.
+ *	This loads one word from 'ptr', stores it in 'reg' and increments
+ *	'ptr' to the next word. The 'abort' argument is used for fixup tables.
  *
  * ldr4w ptr reg1 reg2 reg3 reg4 abort
  * ldr8w ptr, reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
  *
- *     This loads four or eight words starting from 'ptr', stores them
- *     in provided registers and increments 'ptr' past those words.
- *     The'abort' argument is used for fixup tables.
+ *	This loads four or eight words starting from 'ptr', stores them
+ *	in provided registers and increments 'ptr' past those words.
+ *	The'abort' argument is used for fixup tables.
  *
  * ldr1b ptr reg cond abort
  *
- *     Similar to ldr1w, but it loads a byte and increments 'ptr' one byte.
- *     It also must apply the condition code if provided, otherwise the
- *     "al" condition is assumed by default.
+ *	Similar to ldr1w, but it loads a byte and increments 'ptr' one byte.
+ *	It also must apply the condition code if provided, otherwise the
+ *	"al" condition is assumed by default.
  *
  * str1w ptr reg abort
  * str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
  * str1b ptr reg cond abort
  *
- *     Same as their ldr* counterparts, but data is stored to 'ptr' location
- *     rather than being loaded.
+ *	Same as their ldr* counterparts, but data is stored to 'ptr' location
+ *	rather than being loaded.
  *
  * enter reg1 reg2
  *
- *     Preserve the provided registers on the stack plus any additional
- *     data as needed by the implementation including this code. Called
- *     upon code entry.
+ *	Preserve the provided registers on the stack plus any additional
+ *	data as needed by the implementation including this code. Called
+ *	upon code entry.
  *
  * exit reg1 reg2
  *
- *     Restore registers with the values previously saved with the
- *     'preserv' macro. Called upon code termination.
+ *	Restore registers with the values previously saved with the
+ *	'preserv' macro. Called upon code termination.
  *
  * LDR1W_SHIFT
  * STR1W_SHIFT
  *
- *     Correction to be applied to the "ip" register when branching into
- *     the ldr1w or str1w instructions (some of these macros may expand to
- *     than one 32bit instruction in Thumb-2)
+ *	Correction to be applied to the "ip" register when branching into
+ *	the ldr1w or str1w instructions (some of these macros may expand to
+ *	than one 32bit instruction in Thumb-2)
  */
 
 
-               enter   r4, lr
+		enter	r4, lr
 
-               subs    r2, r2, #4
-               blt     8f
-               ands    ip, r0, #3
-       PLD(    pld     [r1, #0]                )
-               bne     9f
-               ands    ip, r1, #3
-               bne     10f
+		subs	r2, r2, #4
+		blt	8f
+		ands	ip, r0, #3
+	PLD(	pld	[r1, #0]		)
+		bne	9f
+		ands	ip, r1, #3
+		bne	10f
 
-1:             subs    r2, r2, #(28)
-               stmfd   sp!, {r5 - r8}
-               blt     5f
+1:		subs	r2, r2, #(28)
+		stmfd	sp!, {r5 - r8}
+		blt	5f
 
-       CALGN(  ands    ip, r0, #31             )
-       CALGN(  rsb     r3, ip, #32             )
-       CALGN(  sbcnes  r4, r3, r2              )  @ C is always set here
-       CALGN(  bcs     2f                      )
-       CALGN(  adr     r4, 6f                  )
-       CALGN(  subs    r2, r2, r3              )  @ C gets set
-       CALGN(  add     pc, r4, ip              )
+	CALGN(	ands	ip, r0, #31		)
+	CALGN(	rsb	r3, ip, #32		)
+	CALGN(	sbcnes	r4, r3, r2		)  @ C is always set here
+	CALGN(	bcs	2f			)
+	CALGN(	adr	r4, 6f			)
+	CALGN(	subs	r2, r2, r3		)  @ C gets set
+	CALGN(	add	pc, r4, ip		)
 
-       PLD(    pld     [r1, #0]                )
-2:     PLD(    subs    r2, r2, #96             )
-       PLD(    pld     [r1, #28]               )
-       PLD(    blt     4f                      )
-       PLD(    pld     [r1, #60]               )
-       PLD(    pld     [r1, #92]               )
+	PLD(	pld	[r1, #0]		)
+2:	PLD(	subs	r2, r2, #96		)
+	PLD(	pld	[r1, #28]		)
+	PLD(	blt	4f			)
+	PLD(	pld	[r1, #60]		)
+	PLD(	pld	[r1, #92]		)
 
-3:     PLD(    pld     [r1, #124]              )
-4:             ldr8w   r1, r3, r4, r5, r6, r7, r8, ip, lr, abort=20f
-               subs    r2, r2, #32
-               str8w   r0, r3, r4, r5, r6, r7, r8, ip, lr, abort=20f
-               bge     3b
-       PLD(    cmn     r2, #96                 )
-       PLD(    bge     4b                      )
+3:	PLD(	pld	[r1, #124]		)
+4:		ldr8w	r1, r3, r4, r5, r6, r7, r8, ip, lr, abort=20f
+		subs	r2, r2, #32
+		str8w	r0, r3, r4, r5, r6, r7, r8, ip, lr, abort=20f
+		bge	3b
+	PLD(	cmn	r2, #96			)
+	PLD(	bge	4b			)
 
-5:             ands    ip, r2, #28
-               rsb     ip, ip, #32
+5:		ands	ip, r2, #28
+		rsb	ip, ip, #32
 #if LDR1W_SHIFT > 0
-               lsl     ip, ip, #LDR1W_SHIFT
+		lsl	ip, ip, #LDR1W_SHIFT
 #endif
-               addne   pc, pc, ip              @ C is always clear here
-               b       7f
+		addne	pc, pc, ip		@ C is always clear here
+		b	7f
 6:
-               .rept   (1 << LDR1W_SHIFT)
-               W(nop)
-               .endr
-               ldr1w   r1, r3, abort=20f
-               ldr1w   r1, r4, abort=20f
-               ldr1w   r1, r5, abort=20f
-               ldr1w   r1, r6, abort=20f
-               ldr1w   r1, r7, abort=20f
-               ldr1w   r1, r8, abort=20f
-               ldr1w   r1, lr, abort=20f
+		.rept	(1 << LDR1W_SHIFT)
+		W(nop)
+		.endr
+		ldr1w	r1, r3, abort=20f
+		ldr1w	r1, r4, abort=20f
+		ldr1w	r1, r5, abort=20f
+		ldr1w	r1, r6, abort=20f
+		ldr1w	r1, r7, abort=20f
+		ldr1w	r1, r8, abort=20f
+		ldr1w	r1, lr, abort=20f
 
 #if LDR1W_SHIFT < STR1W_SHIFT
-               lsl     ip, ip, #STR1W_SHIFT - LDR1W_SHIFT
+		lsl	ip, ip, #STR1W_SHIFT - LDR1W_SHIFT
 #elif LDR1W_SHIFT > STR1W_SHIFT
-               lsr     ip, ip, #LDR1W_SHIFT - STR1W_SHIFT
+		lsr	ip, ip, #LDR1W_SHIFT - STR1W_SHIFT
 #endif
-               add     pc, pc, ip
-               nop
-               .rept   (1 << STR1W_SHIFT)
-               W(nop)
-               .endr
-               str1w   r0, r3, abort=20f
-               str1w   r0, r4, abort=20f
-               str1w   r0, r5, abort=20f
-               str1w   r0, r6, abort=20f
-               str1w   r0, r7, abort=20f
-               str1w   r0, r8, abort=20f
-               str1w   r0, lr, abort=20f
+		add	pc, pc, ip
+		nop
+		.rept	(1 << STR1W_SHIFT)
+		W(nop)
+		.endr
+		str1w	r0, r3, abort=20f
+		str1w	r0, r4, abort=20f
+		str1w	r0, r5, abort=20f
+		str1w	r0, r6, abort=20f
+		str1w	r0, r7, abort=20f
+		str1w	r0, r8, abort=20f
+		str1w	r0, lr, abort=20f
 
-       CALGN(  bcs     2b                      )
+	CALGN(	bcs	2b			)
 
-7:             ldmfd   sp!, {r5 - r8}
+7:		ldmfd	sp!, {r5 - r8}
 
-8:             movs    r2, r2, lsl #31
-               ldr1b   r1, r3, ne, abort=21f
-               ldr1b   r1, r4, cs, abort=21f
-               ldr1b   r1, ip, cs, abort=21f
-               str1b   r0, r3, ne, abort=21f
-               str1b   r0, r4, cs, abort=21f
-               str1b   r0, ip, cs, abort=21f
+8:		movs	r2, r2, lsl #31
+		ldr1b	r1, r3, ne, abort=21f
+		ldr1b	r1, r4, cs, abort=21f
+		ldr1b	r1, ip, cs, abort=21f
+		str1b	r0, r3, ne, abort=21f
+		str1b	r0, r4, cs, abort=21f
+		str1b	r0, ip, cs, abort=21f
 
-               exit    r4, pc
+		exit	r4, pc
 
-9:             rsb     ip, ip, #4
-               cmp     ip, #2
-               ldr1b   r1, r3, gt, abort=21f
-               ldr1b   r1, r4, ge, abort=21f
-               ldr1b   r1, lr, abort=21f
-               str1b   r0, r3, gt, abort=21f
-               str1b   r0, r4, ge, abort=21f
-               subs    r2, r2, ip
-               str1b   r0, lr, abort=21f
-               blt     8b
-               ands    ip, r1, #3
-               beq     1b
+9:		rsb	ip, ip, #4
+		cmp	ip, #2
+		ldr1b	r1, r3, gt, abort=21f
+		ldr1b	r1, r4, ge, abort=21f
+		ldr1b	r1, lr, abort=21f
+		str1b	r0, r3, gt, abort=21f
+		str1b	r0, r4, ge, abort=21f
+		subs	r2, r2, ip
+		str1b	r0, lr, abort=21f
+		blt	8b
+		ands	ip, r1, #3
+		beq	1b
 
-10:            bic     r1, r1, #3
-               cmp     ip, #2
-               ldr1w   r1, lr, abort=21f
-               beq     17f
-               bgt     18f
+10:		bic	r1, r1, #3
+		cmp	ip, #2
+		ldr1w	r1, lr, abort=21f
+		beq	17f
+		bgt	18f
 
 
-               .macro  forward_copy_shift pull push
+		.macro	forward_copy_shift pull push
 
-               subs    r2, r2, #28
-               blt     14f
+		subs	r2, r2, #28
+		blt	14f
 
-       CALGN(  ands    ip, r0, #31             )
-       CALGN(  rsb     ip, ip, #32             )
-       CALGN(  sbcnes  r4, ip, r2              )  @ C is always set here
-       CALGN(  subcc   r2, r2, ip              )
-       CALGN(  bcc     15f                     )
+	CALGN(	ands	ip, r0, #31		)
+	CALGN(	rsb	ip, ip, #32		)
+	CALGN(	sbcnes	r4, ip, r2		)  @ C is always set here
+	CALGN(	subcc	r2, r2, ip		)
+	CALGN(	bcc	15f			)
 
-11:            stmfd   sp!, {r5 - r9}
+11:		stmfd	sp!, {r5 - r9}
 
-       PLD(    pld     [r1, #0]                )
-       PLD(    subs    r2, r2, #96             )
-       PLD(    pld     [r1, #28]               )
-       PLD(    blt     13f                     )
-       PLD(    pld     [r1, #60]               )
-       PLD(    pld     [r1, #92]               )
+	PLD(	pld	[r1, #0]		)
+	PLD(	subs	r2, r2, #96		)
+	PLD(	pld	[r1, #28]		)
+	PLD(	blt	13f			)
+	PLD(	pld	[r1, #60]		)
+	PLD(	pld	[r1, #92]		)
 
-12:    PLD(    pld     [r1, #124]              )
-13:            ldr4w   r1, r4, r5, r6, r7, abort=19f
-               mov     r3, lr, pull #\pull
-               subs    r2, r2, #32
-               ldr4w   r1, r8, r9, ip, lr, abort=19f
-               orr     r3, r3, r4, push #\push
-               mov     r4, r4, pull #\pull
-               orr     r4, r4, r5, push #\push
-               mov     r5, r5, pull #\pull
-               orr     r5, r5, r6, push #\push
-               mov     r6, r6, pull #\pull
-               orr     r6, r6, r7, push #\push
-               mov     r7, r7, pull #\pull
-               orr     r7, r7, r8, push #\push
-               mov     r8, r8, pull #\pull
-               orr     r8, r8, r9, push #\push
-               mov     r9, r9, pull #\pull
-               orr     r9, r9, ip, push #\push
-               mov     ip, ip, pull #\pull
-               orr     ip, ip, lr, push #\push
-               str8w   r0, r3, r4, r5, r6, r7, r8, r9, ip, , abort=19f
-               bge     12b
-       PLD(    cmn     r2, #96                 )
-       PLD(    bge     13b                     )
+12:	PLD(	pld	[r1, #124]		)
+13:		ldr4w	r1, r4, r5, r6, r7, abort=19f
+		mov	r3, lr, pull #\pull
+		subs	r2, r2, #32
+		ldr4w	r1, r8, r9, ip, lr, abort=19f
+		orr	r3, r3, r4, push #\push
+		mov	r4, r4, pull #\pull
+		orr	r4, r4, r5, push #\push
+		mov	r5, r5, pull #\pull
+		orr	r5, r5, r6, push #\push
+		mov	r6, r6, pull #\pull
+		orr	r6, r6, r7, push #\push
+		mov	r7, r7, pull #\pull
+		orr	r7, r7, r8, push #\push
+		mov	r8, r8, pull #\pull
+		orr	r8, r8, r9, push #\push
+		mov	r9, r9, pull #\pull
+		orr	r9, r9, ip, push #\push
+		mov	ip, ip, pull #\pull
+		orr	ip, ip, lr, push #\push
+		str8w	r0, r3, r4, r5, r6, r7, r8, r9, ip, , abort=19f
+		bge	12b
+	PLD(	cmn	r2, #96			)
+	PLD(	bge	13b			)
 
-               ldmfd   sp!, {r5 - r9}
+		ldmfd	sp!, {r5 - r9}
 
-14:            ands    ip, r2, #28
-               beq     16f
+14:		ands	ip, r2, #28
+		beq	16f
 
-15:            mov     r3, lr, pull #\pull
-               ldr1w   r1, lr, abort=21f
-               subs    ip, ip, #4
-               orr     r3, r3, lr, push #\push
-               str1w   r0, r3, abort=21f
-               bgt     15b
-       CALGN(  cmp     r2, #0                  )
-       CALGN(  bge     11b                     )
+15:		mov	r3, lr, pull #\pull
+		ldr1w	r1, lr, abort=21f
+		subs	ip, ip, #4
+		orr	r3, r3, lr, push #\push
+		str1w	r0, r3, abort=21f
+		bgt	15b
+	CALGN(	cmp	r2, #0			)
+	CALGN(	bge	11b			)
 
-16:            sub     r1, r1, #(\push / 8)
-               b       8b
+16:		sub	r1, r1, #(\push / 8)
+		b	8b
 
-               .endm
+		.endm
 
 
-               forward_copy_shift      pull=8  push=24
+		forward_copy_shift	pull=8	push=24
 
-17:            forward_copy_shift      pull=16 push=16
+17:		forward_copy_shift	pull=16	push=16
 
-18:            forward_copy_shift      pull=24 push=8
+18:		forward_copy_shift	pull=24	push=8
 
 
 /*
@@ -254,14 +254,14 @@
  * the exit macro.
  */
 
-       .macro  copy_abort_preamble
-19:    ldmfd   sp!, {r5 - r9}
-       b       21f
-20:    ldmfd   sp!, {r5 - r8}
+	.macro	copy_abort_preamble
+19:	ldmfd	sp!, {r5 - r9}
+	b	21f
+20:	ldmfd	sp!, {r5 - r8}
 21:
-       .endm
+	.endm
 
-       .macro  copy_abort_end
-       ldmfd   sp!, {r4, pc}
-       .endm
+	.macro	copy_abort_end
+	ldmfd	sp!, {r4, pc}
+	.endm
 
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/div64.S
--- a/xen/arch/arm/lib/div64.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/div64.S	Mon Feb 13 17:26:08 2012 +0000
@@ -3,9 +3,9 @@
  *
  *  Optimized computation of 64-bit dividend / 32-bit divisor
  *
- *  Author:    Nicolas Pitre
- *  Created:   Oct 5, 2003
- *  Copyright: Monta Vista Software, Inc.
+ *  Author:	Nicolas Pitre
+ *  Created:	Oct 5, 2003
+ *  Copyright:	Monta Vista Software, Inc.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
@@ -14,7 +14,7 @@
 
 #include <xen/config.h>
 #include "assembler.h"
-
+	
 #ifdef __ARMEB__
 #define xh r0
 #define xl r1
@@ -34,12 +34,12 @@
  *       This is meant to be used by do_div() from include/asm/div64.h only.
  *
  * Input parameters:
- *     xh-xl   = dividend (clobbered)
- *     r4      = divisor (preserved)
+ * 	xh-xl	= dividend (clobbered)
+ * 	r4	= divisor (preserved)
  *
  * Output values:
- *     yh-yl   = result
- *     xh      = remainder
+ * 	yh-yl	= result
+ * 	xh	= remainder
  *
  * Clobbered regs: xl, ip
  */
@@ -47,165 +47,165 @@
 ENTRY(__do_div64)
 UNWIND(.fnstart)
 
-       @ Test for easy paths first.
-       subs    ip, r4, #1
-       bls     9f                      @ divisor is 0 or 1
-       tst     ip, r4
-       beq     8f                      @ divisor is power of 2
+	@ Test for easy paths first.
+	subs	ip, r4, #1
+	bls	9f			@ divisor is 0 or 1
+	tst	ip, r4
+	beq	8f			@ divisor is power of 2
 
-       @ See if we need to handle upper 32-bit result.
-       cmp     xh, r4
-       mov     yh, #0
-       blo     3f
+	@ See if we need to handle upper 32-bit result.
+	cmp	xh, r4
+	mov	yh, #0
+	blo	3f
 
-       @ Align divisor with upper part of dividend.
-       @ The aligned divisor is stored in yl preserving the original.
-       @ The bit position is stored in ip.
+	@ Align divisor with upper part of dividend.
+	@ The aligned divisor is stored in yl preserving the original.
+	@ The bit position is stored in ip.
 
 #if __LINUX_ARM_ARCH__ >= 5
 
-       clz     yl, r4
-       clz     ip, xh
-       sub     yl, yl, ip
-       mov     ip, #1
-       mov     ip, ip, lsl yl
-       mov     yl, r4, lsl yl
+	clz	yl, r4
+	clz	ip, xh
+	sub	yl, yl, ip
+	mov	ip, #1
+	mov	ip, ip, lsl yl
+	mov	yl, r4, lsl yl
 
 #else
 
-       mov     yl, r4
-       mov     ip, #1
-1:     cmp     yl, #0x80000000
-       cmpcc   yl, xh
-       movcc   yl, yl, lsl #1
-       movcc   ip, ip, lsl #1
-       bcc     1b
+	mov	yl, r4
+	mov	ip, #1
+1:	cmp	yl, #0x80000000
+	cmpcc	yl, xh
+	movcc	yl, yl, lsl #1
+	movcc	ip, ip, lsl #1
+	bcc	1b
 
 #endif
 
-       @ The division loop for needed upper bit positions.
-       @ Break out early if dividend reaches 0.
-2:     cmp     xh, yl
-       orrcs   yh, yh, ip
-       subcss  xh, xh, yl
-       movnes  ip, ip, lsr #1
-       mov     yl, yl, lsr #1
-       bne     2b
+	@ The division loop for needed upper bit positions.
+ 	@ Break out early if dividend reaches 0.
+2:	cmp	xh, yl
+	orrcs	yh, yh, ip
+	subcss	xh, xh, yl
+	movnes	ip, ip, lsr #1
+	mov	yl, yl, lsr #1
+	bne	2b
 
-       @ See if we need to handle lower 32-bit result.
-3:     cmp     xh, #0
-       mov     yl, #0
-       cmpeq   xl, r4
-       movlo   xh, xl
-       movlo   pc, lr
+	@ See if we need to handle lower 32-bit result.
+3:	cmp	xh, #0
+	mov	yl, #0
+	cmpeq	xl, r4
+	movlo	xh, xl
+	movlo	pc, lr
 
-       @ The division loop for lower bit positions.
-       @ Here we shift remainer bits leftwards rather than moving the
-       @ divisor for comparisons, considering the carry-out bit as well.
-       mov     ip, #0x80000000
-4:     movs    xl, xl, lsl #1
-       adcs    xh, xh, xh
-       beq     6f
-       cmpcc   xh, r4
-5:     orrcs   yl, yl, ip
-       subcs   xh, xh, r4
-       movs    ip, ip, lsr #1
-       bne     4b
-       mov     pc, lr
+	@ The division loop for lower bit positions.
+	@ Here we shift remainer bits leftwards rather than moving the
+	@ divisor for comparisons, considering the carry-out bit as well.
+	mov	ip, #0x80000000
+4:	movs	xl, xl, lsl #1
+	adcs	xh, xh, xh
+	beq	6f
+	cmpcc	xh, r4
+5:	orrcs	yl, yl, ip
+	subcs	xh, xh, r4
+	movs	ip, ip, lsr #1
+	bne	4b
+	mov	pc, lr
 
-       @ The top part of remainder became zero.  If carry is set
-       @ (the 33th bit) this is a false positive so resume the loop.
-       @ Otherwise, if lower part is also null then we are done.
-6:     bcs     5b
-       cmp     xl, #0
-       moveq   pc, lr
+	@ The top part of remainder became zero.  If carry is set
+	@ (the 33th bit) this is a false positive so resume the loop.
+	@ Otherwise, if lower part is also null then we are done.
+6:	bcs	5b
+	cmp	xl, #0
+	moveq	pc, lr
 
-       @ We still have remainer bits in the low part.  Bring them up.
+	@ We still have remainer bits in the low part.  Bring them up.
 
 #if __LINUX_ARM_ARCH__ >= 5
 
-       clz     xh, xl                  @ we know xh is zero here so...
-       add     xh, xh, #1
-       mov     xl, xl, lsl xh
-       mov     ip, ip, lsr xh
+	clz	xh, xl			@ we know xh is zero here so...
+	add	xh, xh, #1
+	mov	xl, xl, lsl xh
+	mov	ip, ip, lsr xh
 
 #else
 
-7:     movs    xl, xl, lsl #1
-       mov     ip, ip, lsr #1
-       bcc     7b
+7:	movs	xl, xl, lsl #1
+	mov	ip, ip, lsr #1
+	bcc	7b
 
 #endif
 
-       @ Current remainder is now 1.  It is worthless to compare with
-       @ divisor at this point since divisor can not be smaller than 3 here.
-       @ If possible, branch for another shift in the division loop.
-       @ If no bit position left then we are done.
-       movs    ip, ip, lsr #1
-       mov     xh, #1
-       bne     4b
-       mov     pc, lr
+	@ Current remainder is now 1.  It is worthless to compare with
+	@ divisor at this point since divisor can not be smaller than 3 here.
+	@ If possible, branch for another shift in the division loop.
+	@ If no bit position left then we are done.
+	movs	ip, ip, lsr #1
+	mov	xh, #1
+	bne	4b
+	mov	pc, lr
 
-8:     @ Division by a power of 2: determine what that divisor order is
-       @ then simply shift values around
+8:	@ Division by a power of 2: determine what that divisor order is
+	@ then simply shift values around
 
 #if __LINUX_ARM_ARCH__ >= 5
 
-       clz     ip, r4
-       rsb     ip, ip, #31
+	clz	ip, r4
+	rsb	ip, ip, #31
 
 #else
 
-       mov     yl, r4
-       cmp     r4, #(1 << 16)
-       mov     ip, #0
-       movhs   yl, yl, lsr #16
-       movhs   ip, #16
+	mov	yl, r4
+	cmp	r4, #(1 << 16)
+	mov	ip, #0
+	movhs	yl, yl, lsr #16
+	movhs	ip, #16
 
-       cmp     yl, #(1 << 8)
-       movhs   yl, yl, lsr #8
-       addhs   ip, ip, #8
+	cmp	yl, #(1 << 8)
+	movhs	yl, yl, lsr #8
+	addhs	ip, ip, #8
 
-       cmp     yl, #(1 << 4)
-       movhs   yl, yl, lsr #4
-       addhs   ip, ip, #4
+	cmp	yl, #(1 << 4)
+	movhs	yl, yl, lsr #4
+	addhs	ip, ip, #4
 
-       cmp     yl, #(1 << 2)
-       addhi   ip, ip, #3
-       addls   ip, ip, yl, lsr #1
+	cmp	yl, #(1 << 2)
+	addhi	ip, ip, #3
+	addls	ip, ip, yl, lsr #1
 
 #endif
 
-       mov     yh, xh, lsr ip
-       mov     yl, xl, lsr ip
-       rsb     ip, ip, #32
- ARM(  orr     yl, yl, xh, lsl ip      )
- THUMB(        lsl     xh, xh, ip              )
- THUMB(        orr     yl, yl, xh              )
-       mov     xh, xl, lsl ip
-       mov     xh, xh, lsr ip
-       mov     pc, lr
+	mov	yh, xh, lsr ip
+	mov	yl, xl, lsr ip
+	rsb	ip, ip, #32
+ ARM(	orr	yl, yl, xh, lsl ip	)
+ THUMB(	lsl	xh, xh, ip		)
+ THUMB(	orr	yl, yl, xh		)
+	mov	xh, xl, lsl ip
+	mov	xh, xh, lsr ip
+	mov	pc, lr
 
-       @ eq -> division by 1: obvious enough...
-9:     moveq   yl, xl
-       moveq   yh, xh
-       moveq   xh, #0
-       moveq   pc, lr
+	@ eq -> division by 1: obvious enough...
+9:	moveq	yl, xl
+	moveq	yh, xh
+	moveq	xh, #0
+	moveq	pc, lr
 UNWIND(.fnend)
 
 UNWIND(.fnstart)
 UNWIND(.pad #4)
 UNWIND(.save {lr})
 Ldiv0_64:
-       @ Division by 0:
-       str     lr, [sp, #-8]!
-       bl      __div0
+	@ Division by 0:
+	str	lr, [sp, #-8]!
+	bl	__div0
 
-       @ as wrong as it could be...
-       mov     yl, #0
-       mov     yh, #0
-       mov     xh, #0
-       ldr     pc, [sp], #8
+	@ as wrong as it could be...
+	mov	yl, #0
+	mov	yh, #0
+	mov	xh, #0
+	ldr	pc, [sp], #8
 
 UNWIND(.fnend)
 ENDPROC(__do_div64)
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/findbit.S
--- a/xen/arch/arm/lib/findbit.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/findbit.S	Mon Feb 13 17:26:08 2012 +0000
@@ -24,20 +24,20 @@
  * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit);
  */
 ENTRY(_find_first_zero_bit_le)
-               teq     r1, #0
-               beq     3f
-               mov     r2, #0
+		teq	r1, #0	
+		beq	3f
+		mov	r2, #0
 1:
- ARM(          ldrb    r3, [r0, r2, lsr #3]    )
- THUMB(                lsr     r3, r2, #3              )
- THUMB(                ldrb    r3, [r0, r3]            )
-               eors    r3, r3, #0xff           @ invert bits
-               bne     .L_found                @ any now set - found zero bit
-               add     r2, r2, #8              @ next bit pointer
-2:             cmp     r2, r1                  @ any more?
-               blo     1b
-3:             mov     r0, r1                  @ no free bits
-               mov     pc, lr
+ ARM(		ldrb	r3, [r0, r2, lsr #3]	)
+ THUMB(		lsr	r3, r2, #3		)
+ THUMB(		ldrb	r3, [r0, r3]		)
+		eors	r3, r3, #0xff		@ invert bits
+		bne	.L_found		@ any now set - found zero bit
+		add	r2, r2, #8		@ next bit pointer
+2:		cmp	r2, r1			@ any more?
+		blo	1b
+3:		mov	r0, r1			@ no free bits
+		mov	pc, lr
 ENDPROC(_find_first_zero_bit_le)
 
 /*
@@ -45,19 +45,19 @@
  * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset)
  */
 ENTRY(_find_next_zero_bit_le)
-               teq     r1, #0
-               beq     3b
-               ands    ip, r2, #7
-               beq     1b                      @ If new byte, goto old routine
- ARM(          ldrb    r3, [r0, r2, lsr #3]    )
- THUMB(                lsr     r3, r2, #3              )
- THUMB(                ldrb    r3, [r0, r3]            )
-               eor     r3, r3, #0xff           @ now looking for a 1 bit
-               movs    r3, r3, lsr ip          @ shift off unused bits
-               bne     .L_found
-               orr     r2, r2, #7              @ if zero, then no bits here
-               add     r2, r2, #1              @ align bit pointer
-               b       2b                      @ loop for next bit
+		teq	r1, #0
+		beq	3b
+		ands	ip, r2, #7
+		beq	1b			@ If new byte, goto old routine
+ ARM(		ldrb	r3, [r0, r2, lsr #3]	)
+ THUMB(		lsr	r3, r2, #3		)
+ THUMB(		ldrb	r3, [r0, r3]		)
+		eor	r3, r3, #0xff		@ now looking for a 1 bit
+		movs	r3, r3, lsr ip		@ shift off unused bits
+		bne	.L_found
+		orr	r2, r2, #7		@ if zero, then no bits here
+		add	r2, r2, #1		@ align bit pointer
+		b	2b			@ loop for next bit
 ENDPROC(_find_next_zero_bit_le)
 
 /*
@@ -65,20 +65,20 @@
  * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit);
  */
 ENTRY(_find_first_bit_le)
-               teq     r1, #0
-               beq     3f
-               mov     r2, #0
+		teq	r1, #0	
+		beq	3f
+		mov	r2, #0
 1:
- ARM(          ldrb    r3, [r0, r2, lsr #3]    )
- THUMB(                lsr     r3, r2, #3              )
- THUMB(                ldrb    r3, [r0, r3]            )
-               movs    r3, r3
-               bne     .L_found                @ any now set - found zero bit
-               add     r2, r2, #8              @ next bit pointer
-2:             cmp     r2, r1                  @ any more?
-               blo     1b
-3:             mov     r0, r1                  @ no free bits
-               mov     pc, lr
+ ARM(		ldrb	r3, [r0, r2, lsr #3]	)
+ THUMB(		lsr	r3, r2, #3		)
+ THUMB(		ldrb	r3, [r0, r3]		)
+		movs	r3, r3
+		bne	.L_found		@ any now set - found zero bit
+		add	r2, r2, #8		@ next bit pointer
+2:		cmp	r2, r1			@ any more?
+		blo	1b
+3:		mov	r0, r1			@ no free bits
+		mov	pc, lr
 ENDPROC(_find_first_bit_le)
 
 /*
@@ -86,87 +86,87 @@
  * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset)
  */
 ENTRY(_find_next_bit_le)
-               teq     r1, #0
-               beq     3b
-               ands    ip, r2, #7
-               beq     1b                      @ If new byte, goto old routine
- ARM(          ldrb    r3, [r0, r2, lsr #3]    )
- THUMB(                lsr     r3, r2, #3              )
- THUMB(                ldrb    r3, [r0, r3]            )
-               movs    r3, r3, lsr ip          @ shift off unused bits
-               bne     .L_found
-               orr     r2, r2, #7              @ if zero, then no bits here
-               add     r2, r2, #1              @ align bit pointer
-               b       2b                      @ loop for next bit
+		teq	r1, #0
+		beq	3b
+		ands	ip, r2, #7
+		beq	1b			@ If new byte, goto old routine
+ ARM(		ldrb	r3, [r0, r2, lsr #3]	)
+ THUMB(		lsr	r3, r2, #3		)
+ THUMB(		ldrb	r3, [r0, r3]		)
+		movs	r3, r3, lsr ip		@ shift off unused bits
+		bne	.L_found
+		orr	r2, r2, #7		@ if zero, then no bits here
+		add	r2, r2, #1		@ align bit pointer
+		b	2b			@ loop for next bit
 ENDPROC(_find_next_bit_le)
 
 #ifdef __ARMEB__
 
 ENTRY(_find_first_zero_bit_be)
-               teq     r1, #0
-               beq     3f
-               mov     r2, #0
-1:             eor     r3, r2, #0x18           @ big endian byte ordering
- ARM(          ldrb    r3, [r0, r3, lsr #3]    )
- THUMB(                lsr     r3, #3                  )
- THUMB(                ldrb    r3, [r0, r3]            )
-               eors    r3, r3, #0xff           @ invert bits
-               bne     .L_found                @ any now set - found zero bit
-               add     r2, r2, #8              @ next bit pointer
-2:             cmp     r2, r1                  @ any more?
-               blo     1b
-3:             mov     r0, r1                  @ no free bits
-               mov     pc, lr
+		teq	r1, #0
+		beq	3f
+		mov	r2, #0
+1:		eor	r3, r2, #0x18		@ big endian byte ordering
+ ARM(		ldrb	r3, [r0, r3, lsr #3]	)
+ THUMB(		lsr	r3, #3			)
+ THUMB(		ldrb	r3, [r0, r3]		)
+		eors	r3, r3, #0xff		@ invert bits
+		bne	.L_found		@ any now set - found zero bit
+		add	r2, r2, #8		@ next bit pointer
+2:		cmp	r2, r1			@ any more?
+		blo	1b
+3:		mov	r0, r1			@ no free bits
+		mov	pc, lr
 ENDPROC(_find_first_zero_bit_be)
 
 ENTRY(_find_next_zero_bit_be)
-               teq     r1, #0
-               beq     3b
-               ands    ip, r2, #7
-               beq     1b                      @ If new byte, goto old routine
-               eor     r3, r2, #0x18           @ big endian byte ordering
- ARM(          ldrb    r3, [r0, r3, lsr #3]    )
- THUMB(                lsr     r3, #3                  )
- THUMB(                ldrb    r3, [r0, r3]            )
-               eor     r3, r3, #0xff           @ now looking for a 1 bit
-               movs    r3, r3, lsr ip          @ shift off unused bits
-               bne     .L_found
-               orr     r2, r2, #7              @ if zero, then no bits here
-               add     r2, r2, #1              @ align bit pointer
-               b       2b                      @ loop for next bit
+		teq	r1, #0
+		beq	3b
+		ands	ip, r2, #7
+		beq	1b			@ If new byte, goto old routine
+		eor	r3, r2, #0x18		@ big endian byte ordering
+ ARM(		ldrb	r3, [r0, r3, lsr #3]	)
+ THUMB(		lsr	r3, #3			)
+ THUMB(		ldrb	r3, [r0, r3]		)
+		eor	r3, r3, #0xff		@ now looking for a 1 bit
+		movs	r3, r3, lsr ip		@ shift off unused bits
+		bne	.L_found
+		orr	r2, r2, #7		@ if zero, then no bits here
+		add	r2, r2, #1		@ align bit pointer
+		b	2b			@ loop for next bit
 ENDPROC(_find_next_zero_bit_be)
 
 ENTRY(_find_first_bit_be)
-               teq     r1, #0
-               beq     3f
-               mov     r2, #0
-1:             eor     r3, r2, #0x18           @ big endian byte ordering
- ARM(          ldrb    r3, [r0, r3, lsr #3]    )
- THUMB(                lsr     r3, #3                  )
- THUMB(                ldrb    r3, [r0, r3]            )
-               movs    r3, r3
-               bne     .L_found                @ any now set - found zero bit
-               add     r2, r2, #8              @ next bit pointer
-2:             cmp     r2, r1                  @ any more?
-               blo     1b
-3:             mov     r0, r1                  @ no free bits
-               mov     pc, lr
+		teq	r1, #0
+		beq	3f
+		mov	r2, #0
+1:		eor	r3, r2, #0x18		@ big endian byte ordering
+ ARM(		ldrb	r3, [r0, r3, lsr #3]	)
+ THUMB(		lsr	r3, #3			)
+ THUMB(		ldrb	r3, [r0, r3]		)
+		movs	r3, r3
+		bne	.L_found		@ any now set - found zero bit
+		add	r2, r2, #8		@ next bit pointer
+2:		cmp	r2, r1			@ any more?
+		blo	1b
+3:		mov	r0, r1			@ no free bits
+		mov	pc, lr
 ENDPROC(_find_first_bit_be)
 
 ENTRY(_find_next_bit_be)
-               teq     r1, #0
-               beq     3b
-               ands    ip, r2, #7
-               beq     1b                      @ If new byte, goto old routine
-               eor     r3, r2, #0x18           @ big endian byte ordering
- ARM(          ldrb    r3, [r0, r3, lsr #3]    )
- THUMB(                lsr     r3, #3                  )
- THUMB(                ldrb    r3, [r0, r3]            )
-               movs    r3, r3, lsr ip          @ shift off unused bits
-               bne     .L_found
-               orr     r2, r2, #7              @ if zero, then no bits here
-               add     r2, r2, #1              @ align bit pointer
-               b       2b                      @ loop for next bit
+		teq	r1, #0
+		beq	3b
+		ands	ip, r2, #7
+		beq	1b			@ If new byte, goto old routine
+		eor	r3, r2, #0x18		@ big endian byte ordering
+ ARM(		ldrb	r3, [r0, r3, lsr #3]	)
+ THUMB(		lsr	r3, #3			)
+ THUMB(		ldrb	r3, [r0, r3]		)
+		movs	r3, r3, lsr ip		@ shift off unused bits
+		bne	.L_found
+		orr	r2, r2, #7		@ if zero, then no bits here
+		add	r2, r2, #1		@ align bit pointer
+		b	2b			@ loop for next bit
 ENDPROC(_find_next_bit_be)
 
 #endif
@@ -176,23 +176,23 @@
  */
 .L_found:
 #if __LINUX_ARM_ARCH__ >= 5
-               rsb     r0, r3, #0
-               and     r3, r3, r0
-               clz     r3, r3
-               rsb     r3, r3, #31
-               add     r0, r2, r3
+		rsb	r0, r3, #0
+		and	r3, r3, r0
+		clz	r3, r3
+		rsb	r3, r3, #31
+		add	r0, r2, r3
 #else
-               tst     r3, #0x0f
-               addeq   r2, r2, #4
-               movne   r3, r3, lsl #4
-               tst     r3, #0x30
-               addeq   r2, r2, #2
-               movne   r3, r3, lsl #2
-               tst     r3, #0x40
-               addeq   r2, r2, #1
-               mov     r0, r2
+		tst	r3, #0x0f
+		addeq	r2, r2, #4
+		movne	r3, r3, lsl #4
+		tst	r3, #0x30
+		addeq	r2, r2, #2
+		movne	r3, r3, lsl #2
+		tst	r3, #0x40
+		addeq	r2, r2, #1
+		mov	r0, r2
 #endif
-               cmp     r1, r0                  @ Clamp to maxbit
-               movlo   r0, r1
-               mov     pc, lr
+		cmp	r1, r0			@ Clamp to maxbit
+		movlo	r0, r1
+		mov	pc, lr
 
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/lib1funcs.S
--- a/xen/arch/arm/lib/lib1funcs.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/lib1funcs.S	Mon Feb 13 17:26:08 2012 +0000
@@ -40,64 +40,64 @@
 
 #if __LINUX_ARM_ARCH__ >= 5
 
-       clz     \curbit, \divisor
-       clz     \result, \dividend
-       sub     \result, \curbit, \result
-       mov     \curbit, #1
-       mov     \divisor, \divisor, lsl \result
-       mov     \curbit, \curbit, lsl \result
-       mov     \result, #0
-
+	clz	\curbit, \divisor
+	clz	\result, \dividend
+	sub	\result, \curbit, \result
+	mov	\curbit, #1
+	mov	\divisor, \divisor, lsl \result
+	mov	\curbit, \curbit, lsl \result
+	mov	\result, #0
+	
 #else
 
-       @ Initially shift the divisor left 3 bits if possible,
-       @ set curbit accordingly.  This allows for curbit to be located
-       @ at the left end of each 4 bit nibbles in the division loop
-       @ to save one loop in most cases.
-       tst     \divisor, #0xe0000000
-       moveq   \divisor, \divisor, lsl #3
-       moveq   \curbit, #8
-       movne   \curbit, #1
+	@ Initially shift the divisor left 3 bits if possible,
+	@ set curbit accordingly.  This allows for curbit to be located
+	@ at the left end of each 4 bit nibbles in the division loop
+	@ to save one loop in most cases.
+	tst	\divisor, #0xe0000000
+	moveq	\divisor, \divisor, lsl #3
+	moveq	\curbit, #8
+	movne	\curbit, #1
 
-       @ Unless the divisor is very big, shift it up in multiples of
-       @ four bits, since this is the amount of unwinding in the main
-       @ division loop.  Continue shifting until the divisor is
-       @ larger than the dividend.
-1:     cmp     \divisor, #0x10000000
-       cmplo   \divisor, \dividend
-       movlo   \divisor, \divisor, lsl #4
-       movlo   \curbit, \curbit, lsl #4
-       blo     1b
+	@ Unless the divisor is very big, shift it up in multiples of
+	@ four bits, since this is the amount of unwinding in the main
+	@ division loop.  Continue shifting until the divisor is 
+	@ larger than the dividend.
+1:	cmp	\divisor, #0x10000000
+	cmplo	\divisor, \dividend
+	movlo	\divisor, \divisor, lsl #4
+	movlo	\curbit, \curbit, lsl #4
+	blo	1b
 
-       @ For very big divisors, we must shift it a bit at a time, or
-       @ we will be in danger of overflowing.
-1:     cmp     \divisor, #0x80000000
-       cmplo   \divisor, \dividend
-       movlo   \divisor, \divisor, lsl #1
-       movlo   \curbit, \curbit, lsl #1
-       blo     1b
+	@ For very big divisors, we must shift it a bit at a time, or
+	@ we will be in danger of overflowing.
+1:	cmp	\divisor, #0x80000000
+	cmplo	\divisor, \dividend
+	movlo	\divisor, \divisor, lsl #1
+	movlo	\curbit, \curbit, lsl #1
+	blo	1b
 
-       mov     \result, #0
+	mov	\result, #0
 
 #endif
 
-       @ Division loop
-1:     cmp     \dividend, \divisor
-       subhs   \dividend, \dividend, \divisor
-       orrhs   \result,   \result,   \curbit
-       cmp     \dividend, \divisor,  lsr #1
-       subhs   \dividend, \dividend, \divisor, lsr #1
-       orrhs   \result,   \result,   \curbit,  lsr #1
-       cmp     \dividend, \divisor,  lsr #2
-       subhs   \dividend, \dividend, \divisor, lsr #2
-       orrhs   \result,   \result,   \curbit,  lsr #2
-       cmp     \dividend, \divisor,  lsr #3
-       subhs   \dividend, \dividend, \divisor, lsr #3
-       orrhs   \result,   \result,   \curbit,  lsr #3
-       cmp     \dividend, #0                   @ Early termination?
-       movnes  \curbit,   \curbit,  lsr #4     @ No, any more bits to do?
-       movne   \divisor,  \divisor, lsr #4
-       bne     1b
+	@ Division loop
+1:	cmp	\dividend, \divisor
+	subhs	\dividend, \dividend, \divisor
+	orrhs	\result,   \result,   \curbit
+	cmp	\dividend, \divisor,  lsr #1
+	subhs	\dividend, \dividend, \divisor, lsr #1
+	orrhs	\result,   \result,   \curbit,  lsr #1
+	cmp	\dividend, \divisor,  lsr #2
+	subhs	\dividend, \dividend, \divisor, lsr #2
+	orrhs	\result,   \result,   \curbit,  lsr #2
+	cmp	\dividend, \divisor,  lsr #3
+	subhs	\dividend, \dividend, \divisor, lsr #3
+	orrhs	\result,   \result,   \curbit,  lsr #3
+	cmp	\dividend, #0			@ Early termination?
+	movnes	\curbit,   \curbit,  lsr #4	@ No, any more bits to do?
+	movne	\divisor,  \divisor, lsr #4
+	bne	1b
 
 .endm
 
@@ -106,27 +106,27 @@
 
 #if __LINUX_ARM_ARCH__ >= 5
 
-       clz     \order, \divisor
-       rsb     \order, \order, #31
+	clz	\order, \divisor
+	rsb	\order, \order, #31
 
 #else
 
-       cmp     \divisor, #(1 << 16)
-       movhs   \divisor, \divisor, lsr #16
-       movhs   \order, #16
-       movlo   \order, #0
+	cmp	\divisor, #(1 << 16)
+	movhs	\divisor, \divisor, lsr #16
+	movhs	\order, #16
+	movlo	\order, #0
 
-       cmp     \divisor, #(1 << 8)
-       movhs   \divisor, \divisor, lsr #8
-       addhs   \order, \order, #8
+	cmp	\divisor, #(1 << 8)
+	movhs	\divisor, \divisor, lsr #8
+	addhs	\order, \order, #8
 
-       cmp     \divisor, #(1 << 4)
-       movhs   \divisor, \divisor, lsr #4
-       addhs   \order, \order, #4
+	cmp	\divisor, #(1 << 4)
+	movhs	\divisor, \divisor, lsr #4
+	addhs	\order, \order, #4
 
-       cmp     \divisor, #(1 << 2)
-       addhi   \order, \order, #3
-       addls   \order, \order, \divisor, lsr #1
+	cmp	\divisor, #(1 << 2)
+	addhi	\order, \order, #3
+	addls	\order, \order, \divisor, lsr #1
 
 #endif
 
@@ -137,69 +137,69 @@
 
 #if __LINUX_ARM_ARCH__ >= 5
 
-       clz     \order, \divisor
-       clz     \spare, \dividend
-       sub     \order, \order, \spare
-       mov     \divisor, \divisor, lsl \order
+	clz	\order, \divisor
+	clz	\spare, \dividend
+	sub	\order, \order, \spare
+	mov	\divisor, \divisor, lsl \order
 
 #else
 
-       mov     \order, #0
+	mov	\order, #0
 
-       @ Unless the divisor is very big, shift it up in multiples of
-       @ four bits, since this is the amount of unwinding in the main
-       @ division loop.  Continue shifting until the divisor is
-       @ larger than the dividend.
-1:     cmp     \divisor, #0x10000000
-       cmplo   \divisor, \dividend
-       movlo   \divisor, \divisor, lsl #4
-       addlo   \order, \order, #4
-       blo     1b
+	@ Unless the divisor is very big, shift it up in multiples of
+	@ four bits, since this is the amount of unwinding in the main
+	@ division loop.  Continue shifting until the divisor is 
+	@ larger than the dividend.
+1:	cmp	\divisor, #0x10000000
+	cmplo	\divisor, \dividend
+	movlo	\divisor, \divisor, lsl #4
+	addlo	\order, \order, #4
+	blo	1b
 
-       @ For very big divisors, we must shift it a bit at a time, or
-       @ we will be in danger of overflowing.
-1:     cmp     \divisor, #0x80000000
-       cmplo   \divisor, \dividend
-       movlo   \divisor, \divisor, lsl #1
-       addlo   \order, \order, #1
-       blo     1b
+	@ For very big divisors, we must shift it a bit at a time, or
+	@ we will be in danger of overflowing.
+1:	cmp	\divisor, #0x80000000
+	cmplo	\divisor, \dividend
+	movlo	\divisor, \divisor, lsl #1
+	addlo	\order, \order, #1
+	blo	1b
 
 #endif
 
-       @ Perform all needed substractions to keep only the reminder.
-       @ Do comparisons in batch of 4 first.
-       subs    \order, \order, #3              @ yes, 3 is intended here
-       blt     2f
+	@ Perform all needed substractions to keep only the reminder.
+	@ Do comparisons in batch of 4 first.
+	subs	\order, \order, #3		@ yes, 3 is intended here
+	blt	2f
 
-1:     cmp     \dividend, \divisor
-       subhs   \dividend, \dividend, \divisor
-       cmp     \dividend, \divisor,  lsr #1
-       subhs   \dividend, \dividend, \divisor, lsr #1
-       cmp     \dividend, \divisor,  lsr #2
-       subhs   \dividend, \dividend, \divisor, lsr #2
-       cmp     \dividend, \divisor,  lsr #3
-       subhs   \dividend, \dividend, \divisor, lsr #3
-       cmp     \dividend, #1
-       mov     \divisor, \divisor, lsr #4
-       subges  \order, \order, #4
-       bge     1b
+1:	cmp	\dividend, \divisor
+	subhs	\dividend, \dividend, \divisor
+	cmp	\dividend, \divisor,  lsr #1
+	subhs	\dividend, \dividend, \divisor, lsr #1
+	cmp	\dividend, \divisor,  lsr #2
+	subhs	\dividend, \dividend, \divisor, lsr #2
+	cmp	\dividend, \divisor,  lsr #3
+	subhs	\dividend, \dividend, \divisor, lsr #3
+	cmp	\dividend, #1
+	mov	\divisor, \divisor, lsr #4
+	subges	\order, \order, #4
+	bge	1b
 
-       tst     \order, #3
-       teqne   \dividend, #0
-       beq     5f
+	tst	\order, #3
+	teqne	\dividend, #0
+	beq	5f
 
-       @ Either 1, 2 or 3 comparison/substractions are left.
-2:     cmn     \order, #2
-       blt     4f
-       beq     3f
-       cmp     \dividend, \divisor
-       subhs   \dividend, \dividend, \divisor
-       mov     \divisor,  \divisor,  lsr #1
-3:     cmp     \dividend, \divisor
-       subhs   \dividend, \dividend, \divisor
-       mov     \divisor,  \divisor,  lsr #1
-4:     cmp     \dividend, \divisor
-       subhs   \dividend, \dividend, \divisor
+	@ Either 1, 2 or 3 comparison/substractions are left.
+2:	cmn	\order, #2
+	blt	4f
+	beq	3f
+	cmp	\dividend, \divisor
+	subhs	\dividend, \dividend, \divisor
+	mov	\divisor,  \divisor,  lsr #1
+3:	cmp	\dividend, \divisor
+	subhs	\dividend, \dividend, \divisor
+	mov	\divisor,  \divisor,  lsr #1
+4:	cmp	\dividend, \divisor
+	subhs	\dividend, \dividend, \divisor
 5:
 .endm
 
@@ -208,27 +208,27 @@
 ENTRY(__aeabi_uidiv)
 UNWIND(.fnstart)
 
-       subs    r2, r1, #1
-       moveq   pc, lr
-       bcc     Ldiv0
-       cmp     r0, r1
-       bls     11f
-       tst     r1, r2
-       beq     12f
+	subs	r2, r1, #1
+	moveq	pc, lr
+	bcc	Ldiv0
+	cmp	r0, r1
+	bls	11f
+	tst	r1, r2
+	beq	12f
 
-       ARM_DIV_BODY r0, r1, r2, r3
+	ARM_DIV_BODY r0, r1, r2, r3
 
-       mov     r0, r2
-       mov     pc, lr
+	mov	r0, r2
+	mov	pc, lr
 
-11:    moveq   r0, #1
-       movne   r0, #0
-       mov     pc, lr
+11:	moveq	r0, #1
+	movne	r0, #0
+	mov	pc, lr
 
-12:    ARM_DIV2_ORDER r1, r2
+12:	ARM_DIV2_ORDER r1, r2
 
-       mov     r0, r0, lsr r2
-       mov     pc, lr
+	mov	r0, r0, lsr r2
+	mov	pc, lr
 
 UNWIND(.fnend)
 ENDPROC(__udivsi3)
@@ -237,17 +237,17 @@
 ENTRY(__umodsi3)
 UNWIND(.fnstart)
 
-       subs    r2, r1, #1                      @ compare divisor with 1
-       bcc     Ldiv0
-       cmpne   r0, r1                          @ compare dividend with divisor
-       moveq   r0, #0
-       tsthi   r1, r2                          @ see if divisor is power of 2
-       andeq   r0, r0, r2
-       movls   pc, lr
+	subs	r2, r1, #1			@ compare divisor with 1
+	bcc	Ldiv0
+	cmpne	r0, r1				@ compare dividend with divisor
+	moveq   r0, #0
+	tsthi	r1, r2				@ see if divisor is power of 2
+	andeq	r0, r0, r2
+	movls	pc, lr
 
-       ARM_MOD_BODY r0, r1, r2, r3
+	ARM_MOD_BODY r0, r1, r2, r3
 
-       mov     pc, lr
+	mov	pc, lr
 
 UNWIND(.fnend)
 ENDPROC(__umodsi3)
@@ -256,40 +256,40 @@
 ENTRY(__aeabi_idiv)
 UNWIND(.fnstart)
 
-       cmp     r1, #0
-       eor     ip, r0, r1                      @ save the sign of the result.
-       beq     Ldiv0
-       rsbmi   r1, r1, #0                      @ loops below use unsigned.
-       subs    r2, r1, #1                      @ division by 1 or -1 ?
-       beq     10f
-       movs    r3, r0
-       rsbmi   r3, r0, #0                      @ positive dividend value
-       cmp     r3, r1
-       bls     11f
-       tst     r1, r2                          @ divisor is power of 2 ?
-       beq     12f
+	cmp	r1, #0
+	eor	ip, r0, r1			@ save the sign of the result.
+	beq	Ldiv0
+	rsbmi	r1, r1, #0			@ loops below use unsigned.
+	subs	r2, r1, #1			@ division by 1 or -1 ?
+	beq	10f
+	movs	r3, r0
+	rsbmi	r3, r0, #0			@ positive dividend value
+	cmp	r3, r1
+	bls	11f
+	tst	r1, r2				@ divisor is power of 2 ?
+	beq	12f
 
-       ARM_DIV_BODY r3, r1, r0, r2
+	ARM_DIV_BODY r3, r1, r0, r2
 
-       cmp     ip, #0
-       rsbmi   r0, r0, #0
-       mov     pc, lr
+	cmp	ip, #0
+	rsbmi	r0, r0, #0
+	mov	pc, lr
 
-10:    teq     ip, r0                          @ same sign ?
-       rsbmi   r0, r0, #0
-       mov     pc, lr
+10:	teq	ip, r0				@ same sign ?
+	rsbmi	r0, r0, #0
+	mov	pc, lr
 
-11:    movlo   r0, #0
-       moveq   r0, ip, asr #31
-       orreq   r0, r0, #1
-       mov     pc, lr
+11:	movlo	r0, #0
+	moveq	r0, ip, asr #31
+	orreq	r0, r0, #1
+	mov	pc, lr
 
-12:    ARM_DIV2_ORDER r1, r2
+12:	ARM_DIV2_ORDER r1, r2
 
-       cmp     ip, #0
-       mov     r0, r3, lsr r2
-       rsbmi   r0, r0, #0
-       mov     pc, lr
+	cmp	ip, #0
+	mov	r0, r3, lsr r2
+	rsbmi	r0, r0, #0
+	mov	pc, lr
 
 UNWIND(.fnend)
 ENDPROC(__divsi3)
@@ -298,23 +298,23 @@
 ENTRY(__modsi3)
 UNWIND(.fnstart)
 
-       cmp     r1, #0
-       beq     Ldiv0
-       rsbmi   r1, r1, #0                      @ loops below use unsigned.
-       movs    ip, r0                          @ preserve sign of dividend
-       rsbmi   r0, r0, #0                      @ if negative make positive
-       subs    r2, r1, #1                      @ compare divisor with 1
-       cmpne   r0, r1                          @ compare dividend with divisor
-       moveq   r0, #0
-       tsthi   r1, r2                          @ see if divisor is power of 2
-       andeq   r0, r0, r2
-       bls     10f
+	cmp	r1, #0
+	beq	Ldiv0
+	rsbmi	r1, r1, #0			@ loops below use unsigned.
+	movs	ip, r0				@ preserve sign of dividend
+	rsbmi	r0, r0, #0			@ if negative make positive
+	subs	r2, r1, #1			@ compare divisor with 1
+	cmpne	r0, r1				@ compare dividend with divisor
+	moveq	r0, #0
+	tsthi	r1, r2				@ see if divisor is power of 2
+	andeq	r0, r0, r2
+	bls	10f
 
-       ARM_MOD_BODY r0, r1, r2, r3
+	ARM_MOD_BODY r0, r1, r2, r3
 
-10:    cmp     ip, #0
-       rsbmi   r0, r0, #0
-       mov     pc, lr
+10:	cmp	ip, #0
+	rsbmi	r0, r0, #0
+	mov	pc, lr
 
 UNWIND(.fnend)
 ENDPROC(__modsi3)
@@ -323,56 +323,56 @@
 
 ENTRY(__aeabi_uidivmod)
 UNWIND(.fnstart)
-UNWIND(.save {r0, r1, ip, lr}  )
+UNWIND(.save {r0, r1, ip, lr}	)
 
-       stmfd   sp!, {r0, r1, ip, lr}
-       bl      __aeabi_uidiv
-       ldmfd   sp!, {r1, r2, ip, lr}
-       mul     r3, r0, r2
-       sub     r1, r1, r3
-       mov     pc, lr
+	stmfd	sp!, {r0, r1, ip, lr}
+	bl	__aeabi_uidiv
+	ldmfd	sp!, {r1, r2, ip, lr}
+	mul	r3, r0, r2
+	sub	r1, r1, r3
+	mov	pc, lr
 
 UNWIND(.fnend)
 ENDPROC(__aeabi_uidivmod)
 
 ENTRY(__aeabi_idivmod)
 UNWIND(.fnstart)
-UNWIND(.save {r0, r1, ip, lr}  )
-       stmfd   sp!, {r0, r1, ip, lr}
-       bl      __aeabi_idiv
-       ldmfd   sp!, {r1, r2, ip, lr}
-       mul     r3, r0, r2
-       sub     r1, r1, r3
-       mov     pc, lr
+UNWIND(.save {r0, r1, ip, lr}	)
+	stmfd	sp!, {r0, r1, ip, lr}
+	bl	__aeabi_idiv
+	ldmfd	sp!, {r1, r2, ip, lr}
+	mul	r3, r0, r2
+	sub	r1, r1, r3
+	mov	pc, lr
 
 UNWIND(.fnend)
 ENDPROC(__aeabi_idivmod)
 
 ENTRY(__aeabi_uldivmod)
 UNWIND(.fnstart)
-UNWIND(.save {lr}      )
-       sub sp, sp, #8
-       stmfd   sp!, {sp, lr}
-       bl __qdivrem
-       ldr lr, [sp, #4]
-       add sp, sp, #8
-       ldmfd sp!, {r2, r3}
-       mov     pc, lr
+UNWIND(.save {lr}	)
+	sub sp, sp, #8
+	stmfd   sp!, {sp, lr}
+	bl __qdivrem
+	ldr lr, [sp, #4]
+	add sp, sp, #8
+	ldmfd sp!, {r2, r3}
+	mov	pc, lr
 
 UNWIND(.fnend)
 ENDPROC(__aeabi_uldivmod)
 
 ENTRY(__aeabi_ldivmod)
 UNWIND(.fnstart)
-UNWIND(.save {lr}      )
-       sub sp, sp, #16
-       stmfd   sp!, {sp, lr}
-       bl __ldivmod_helper
-       ldr lr, [sp, #4]
-       add sp, sp, #16
-       ldmfd   sp!, {r2, r3}
-       mov     pc, lr
-
+UNWIND(.save {lr}	)
+	sub sp, sp, #16
+	stmfd   sp!, {sp, lr}
+	bl __ldivmod_helper
+	ldr lr, [sp, #4]
+	add sp, sp, #16
+	ldmfd	sp!, {r2, r3}
+	mov	pc, lr
+	
 UNWIND(.fnend)
 ENDPROC(__aeabi_ldivmod)
 #endif
@@ -381,9 +381,9 @@
 UNWIND(.fnstart)
 UNWIND(.pad #4)
 UNWIND(.save {lr})
-       str     lr, [sp, #-8]!
-       bl      __div0
-       mov     r0, #0                  @ About as wrong as it could be.
-       ldr     pc, [sp], #8
+	str	lr, [sp, #-8]!
+	bl	__div0
+	mov	r0, #0			@ About as wrong as it could be.
+	ldr	pc, [sp], #8
 UNWIND(.fnend)
 ENDPROC(Ldiv0)
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/memcpy.S
--- a/xen/arch/arm/lib/memcpy.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/memcpy.S	Mon Feb 13 17:26:08 2012 +0000
@@ -1,9 +1,9 @@
 /*
  *  linux/arch/arm/lib/memcpy.S
  *
- *  Author:    Nicolas Pitre
- *  Created:   Sep 28, 2005
- *  Copyright: MontaVista Software, Inc.
+ *  Author:	Nicolas Pitre
+ *  Created:	Sep 28, 2005
+ *  Copyright:	MontaVista Software, Inc.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
@@ -13,46 +13,46 @@
 #include <xen/config.h>
 #include "assembler.h"
 
-#define LDR1W_SHIFT    0
-#define STR1W_SHIFT    0
+#define LDR1W_SHIFT	0
+#define STR1W_SHIFT	0
 
-       .macro ldr1w ptr reg abort
-       W(ldr) \reg, [\ptr], #4
-       .endm
+	.macro ldr1w ptr reg abort
+	W(ldr) \reg, [\ptr], #4
+	.endm
 
-       .macro ldr4w ptr reg1 reg2 reg3 reg4 abort
-       ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4}
-       .endm
+	.macro ldr4w ptr reg1 reg2 reg3 reg4 abort
+	ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4}
+	.endm
 
-       .macro ldr8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
-       ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8}
-       .endm
+	.macro ldr8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
+	ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8}
+	.endm
 
-       .macro ldr1b ptr reg cond=al abort
-       ldr\cond\()b \reg, [\ptr], #1
-       .endm
+	.macro ldr1b ptr reg cond=al abort
+	ldr\cond\()b \reg, [\ptr], #1
+	.endm
 
-       .macro str1w ptr reg abort
-       W(str) \reg, [\ptr], #4
-       .endm
+	.macro str1w ptr reg abort
+	W(str) \reg, [\ptr], #4
+	.endm
 
-       .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
-       stmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8}
-       .endm
+	.macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
+	stmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8}
+	.endm
 
-       .macro str1b ptr reg cond=al abort
-       str\cond\()b \reg, [\ptr], #1
-       .endm
+	.macro str1b ptr reg cond=al abort
+	str\cond\()b \reg, [\ptr], #1
+	.endm
 
-       .macro enter reg1 reg2
-       stmdb sp!, {r0, \reg1, \reg2}
-       .endm
+	.macro enter reg1 reg2
+	stmdb sp!, {r0, \reg1, \reg2}
+	.endm
 
-       .macro exit reg1 reg2
-       ldmfd sp!, {r0, \reg1, \reg2}
-       .endm
+	.macro exit reg1 reg2
+	ldmfd sp!, {r0, \reg1, \reg2}
+	.endm
 
-       .text
+	.text
 
 /* Prototype: void *memcpy(void *dest, const void *src, size_t n); */
 
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/memmove.S
--- a/xen/arch/arm/lib/memmove.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/memmove.S	Mon Feb 13 17:26:08 2012 +0000
@@ -1,9 +1,9 @@
 /*
  *  linux/arch/arm/lib/memmove.S
  *
- *  Author:    Nicolas Pitre
- *  Created:   Sep 28, 2005
- *  Copyright: (C) MontaVista Software Inc.
+ *  Author:	Nicolas Pitre
+ *  Created:	Sep 28, 2005
+ *  Copyright:	(C) MontaVista Software Inc.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
@@ -14,7 +14,7 @@
 
 #include "assembler.h"
 
-               .text
+		.text
 
 /*
  * Prototype: void *memmove(void *dest, const void *src, size_t n);
@@ -29,172 +29,172 @@
 
 ENTRY(memmove)
 
-               subs    ip, r0, r1
-               cmphi   r2, ip
-               bls     memcpy
+		subs	ip, r0, r1
+		cmphi	r2, ip
+		bls	memcpy
 
-               stmfd   sp!, {r0, r4, lr}
-               add     r1, r1, r2
-               add     r0, r0, r2
-               subs    r2, r2, #4
-               blt     8f
-               ands    ip, r0, #3
-       PLD(    pld     [r1, #-4]               )
-               bne     9f
-               ands    ip, r1, #3
-               bne     10f
+		stmfd	sp!, {r0, r4, lr}
+		add	r1, r1, r2
+		add	r0, r0, r2
+		subs	r2, r2, #4
+		blt	8f
+		ands	ip, r0, #3
+	PLD(	pld	[r1, #-4]		)
+		bne	9f
+		ands	ip, r1, #3
+		bne	10f
 
-1:             subs    r2, r2, #(28)
-               stmfd   sp!, {r5 - r8}
-               blt     5f
+1:		subs	r2, r2, #(28)
+		stmfd	sp!, {r5 - r8}
+		blt	5f
 
-       CALGN(  ands    ip, r0, #31             )
-       CALGN(  sbcnes  r4, ip, r2              )  @ C is always set here
-       CALGN(  bcs     2f                      )
-       CALGN(  adr     r4, 6f                  )
-       CALGN(  subs    r2, r2, ip              )  @ C is set here
-       CALGN(  rsb     ip, ip, #32             )
-       CALGN(  add     pc, r4, ip              )
+	CALGN(	ands	ip, r0, #31		)
+	CALGN(	sbcnes	r4, ip, r2		)  @ C is always set here
+	CALGN(	bcs	2f			)
+	CALGN(	adr	r4, 6f			)
+	CALGN(	subs	r2, r2, ip		)  @ C is set here
+	CALGN(	rsb	ip, ip, #32		)
+	CALGN(	add	pc, r4, ip		)
 
-       PLD(    pld     [r1, #-4]               )
-2:     PLD(    subs    r2, r2, #96             )
-       PLD(    pld     [r1, #-32]              )
-       PLD(    blt     4f                      )
-       PLD(    pld     [r1, #-64]              )
-       PLD(    pld     [r1, #-96]              )
+	PLD(	pld	[r1, #-4]		)
+2:	PLD(	subs	r2, r2, #96		)
+	PLD(	pld	[r1, #-32]		)
+	PLD(	blt	4f			)
+	PLD(	pld	[r1, #-64]		)
+	PLD(	pld	[r1, #-96]		)
 
-3:     PLD(    pld     [r1, #-128]             )
-4:             ldmdb   r1!, {r3, r4, r5, r6, r7, r8, ip, lr}
-               subs    r2, r2, #32
-               stmdb   r0!, {r3, r4, r5, r6, r7, r8, ip, lr}
-               bge     3b
-       PLD(    cmn     r2, #96                 )
-       PLD(    bge     4b                      )
+3:	PLD(	pld	[r1, #-128]		)
+4:		ldmdb	r1!, {r3, r4, r5, r6, r7, r8, ip, lr}
+		subs	r2, r2, #32
+		stmdb	r0!, {r3, r4, r5, r6, r7, r8, ip, lr}
+		bge	3b
+	PLD(	cmn	r2, #96			)
+	PLD(	bge	4b			)
 
-5:             ands    ip, r2, #28
-               rsb     ip, ip, #32
-               addne   pc, pc, ip              @ C is always clear here
-               b       7f
-6:             W(nop)
-               W(ldr)  r3, [r1, #-4]!
-               W(ldr)  r4, [r1, #-4]!
-               W(ldr)  r5, [r1, #-4]!
-               W(ldr)  r6, [r1, #-4]!
-               W(ldr)  r7, [r1, #-4]!
-               W(ldr)  r8, [r1, #-4]!
-               W(ldr)  lr, [r1, #-4]!
+5:		ands	ip, r2, #28
+		rsb	ip, ip, #32
+		addne	pc, pc, ip		@ C is always clear here
+		b	7f
+6:		W(nop)
+		W(ldr)	r3, [r1, #-4]!
+		W(ldr)	r4, [r1, #-4]!
+		W(ldr)	r5, [r1, #-4]!
+		W(ldr)	r6, [r1, #-4]!
+		W(ldr)	r7, [r1, #-4]!
+		W(ldr)	r8, [r1, #-4]!
+		W(ldr)	lr, [r1, #-4]!
 
-               add     pc, pc, ip
-               nop
-               W(nop)
-               W(str)  r3, [r0, #-4]!
-               W(str)  r4, [r0, #-4]!
-               W(str)  r5, [r0, #-4]!
-               W(str)  r6, [r0, #-4]!
-               W(str)  r7, [r0, #-4]!
-               W(str)  r8, [r0, #-4]!
-               W(str)  lr, [r0, #-4]!
+		add	pc, pc, ip
+		nop
+		W(nop)
+		W(str)	r3, [r0, #-4]!
+		W(str)	r4, [r0, #-4]!
+		W(str)	r5, [r0, #-4]!
+		W(str)	r6, [r0, #-4]!
+		W(str)	r7, [r0, #-4]!
+		W(str)	r8, [r0, #-4]!
+		W(str)	lr, [r0, #-4]!
 
-       CALGN(  bcs     2b                      )
+	CALGN(	bcs	2b			)
 
-7:             ldmfd   sp!, {r5 - r8}
+7:		ldmfd	sp!, {r5 - r8}
 
-8:             movs    r2, r2, lsl #31
-               ldrneb  r3, [r1, #-1]!
-               ldrcsb  r4, [r1, #-1]!
-               ldrcsb  ip, [r1, #-1]
-               strneb  r3, [r0, #-1]!
-               strcsb  r4, [r0, #-1]!
-               strcsb  ip, [r0, #-1]
-               ldmfd   sp!, {r0, r4, pc}
+8:		movs	r2, r2, lsl #31
+		ldrneb	r3, [r1, #-1]!
+		ldrcsb	r4, [r1, #-1]!
+		ldrcsb	ip, [r1, #-1]
+		strneb	r3, [r0, #-1]!
+		strcsb	r4, [r0, #-1]!
+		strcsb	ip, [r0, #-1]
+		ldmfd	sp!, {r0, r4, pc}
 
-9:             cmp     ip, #2
-               ldrgtb  r3, [r1, #-1]!
-               ldrgeb  r4, [r1, #-1]!
-               ldrb    lr, [r1, #-1]!
-               strgtb  r3, [r0, #-1]!
-               strgeb  r4, [r0, #-1]!
-               subs    r2, r2, ip
-               strb    lr, [r0, #-1]!
-               blt     8b
-               ands    ip, r1, #3
-               beq     1b
+9:		cmp	ip, #2
+		ldrgtb	r3, [r1, #-1]!
+		ldrgeb	r4, [r1, #-1]!
+		ldrb	lr, [r1, #-1]!
+		strgtb	r3, [r0, #-1]!
+		strgeb	r4, [r0, #-1]!
+		subs	r2, r2, ip
+		strb	lr, [r0, #-1]!
+		blt	8b
+		ands	ip, r1, #3
+		beq	1b
 
-10:            bic     r1, r1, #3
-               cmp     ip, #2
-               ldr     r3, [r1, #0]
-               beq     17f
-               blt     18f
+10:		bic	r1, r1, #3
+		cmp	ip, #2
+		ldr	r3, [r1, #0]
+		beq	17f
+		blt	18f
 
 
-               .macro  backward_copy_shift push pull
+		.macro	backward_copy_shift push pull
 
-               subs    r2, r2, #28
-               blt     14f
+		subs	r2, r2, #28
+		blt	14f
 
-       CALGN(  ands    ip, r0, #31             )
-       CALGN(  sbcnes  r4, ip, r2              )  @ C is always set here
-       CALGN(  subcc   r2, r2, ip              )
-       CALGN(  bcc     15f                     )
+	CALGN(	ands	ip, r0, #31		)
+	CALGN(	sbcnes	r4, ip, r2		)  @ C is always set here
+	CALGN(	subcc	r2, r2, ip		)
+	CALGN(	bcc	15f			)
 
-11:            stmfd   sp!, {r5 - r9}
+11:		stmfd	sp!, {r5 - r9}
 
-       PLD(    pld     [r1, #-4]               )
-       PLD(    subs    r2, r2, #96             )
-       PLD(    pld     [r1, #-32]              )
-       PLD(    blt     13f                     )
-       PLD(    pld     [r1, #-64]              )
-       PLD(    pld     [r1, #-96]              )
+	PLD(	pld	[r1, #-4]		)
+	PLD(	subs	r2, r2, #96		)
+	PLD(	pld	[r1, #-32]		)
+	PLD(	blt	13f			)
+	PLD(	pld	[r1, #-64]		)
+	PLD(	pld	[r1, #-96]		)
 
-12:    PLD(    pld     [r1, #-128]             )
-13:            ldmdb   r1!, {r7, r8, r9, ip}
-               mov     lr, r3, push #\push
-               subs    r2, r2, #32
-               ldmdb   r1!, {r3, r4, r5, r6}
-               orr     lr, lr, ip, pull #\pull
-               mov     ip, ip, push #\push
-               orr     ip, ip, r9, pull #\pull
-               mov     r9, r9, push #\push
-               orr     r9, r9, r8, pull #\pull
-               mov     r8, r8, push #\push
-               orr     r8, r8, r7, pull #\pull
-               mov     r7, r7, push #\push
-               orr     r7, r7, r6, pull #\pull
-               mov     r6, r6, push #\push
-               orr     r6, r6, r5, pull #\pull
-               mov     r5, r5, push #\push
-               orr     r5, r5, r4, pull #\pull
-               mov     r4, r4, push #\push
-               orr     r4, r4, r3, pull #\pull
-               stmdb   r0!, {r4 - r9, ip, lr}
-               bge     12b
-       PLD(    cmn     r2, #96                 )
-       PLD(    bge     13b                     )
+12:	PLD(	pld	[r1, #-128]		)
+13:		ldmdb   r1!, {r7, r8, r9, ip}
+		mov     lr, r3, push #\push
+		subs    r2, r2, #32
+		ldmdb   r1!, {r3, r4, r5, r6}
+		orr     lr, lr, ip, pull #\pull
+		mov     ip, ip, push #\push
+		orr     ip, ip, r9, pull #\pull
+		mov     r9, r9, push #\push
+		orr     r9, r9, r8, pull #\pull
+		mov     r8, r8, push #\push
+		orr     r8, r8, r7, pull #\pull
+		mov     r7, r7, push #\push
+		orr     r7, r7, r6, pull #\pull
+		mov     r6, r6, push #\push
+		orr     r6, r6, r5, pull #\pull
+		mov     r5, r5, push #\push
+		orr     r5, r5, r4, pull #\pull
+		mov     r4, r4, push #\push
+		orr     r4, r4, r3, pull #\pull
+		stmdb   r0!, {r4 - r9, ip, lr}
+		bge	12b
+	PLD(	cmn	r2, #96			)
+	PLD(	bge	13b			)
 
-               ldmfd   sp!, {r5 - r9}
+		ldmfd	sp!, {r5 - r9}
 
-14:            ands    ip, r2, #28
-               beq     16f
+14:		ands	ip, r2, #28
+		beq	16f
 
-15:            mov     lr, r3, push #\push
-               ldr     r3, [r1, #-4]!
-               subs    ip, ip, #4
-               orr     lr, lr, r3, pull #\pull
-               str     lr, [r0, #-4]!
-               bgt     15b
-       CALGN(  cmp     r2, #0                  )
-       CALGN(  bge     11b                     )
+15:		mov     lr, r3, push #\push
+		ldr	r3, [r1, #-4]!
+		subs	ip, ip, #4
+		orr	lr, lr, r3, pull #\pull
+		str	lr, [r0, #-4]!
+		bgt	15b
+	CALGN(	cmp	r2, #0			)
+	CALGN(	bge	11b			)
 
-16:            add     r1, r1, #(\pull / 8)
-               b       8b
+16:		add	r1, r1, #(\pull / 8)
+		b	8b
 
-               .endm
+		.endm
 
 
-               backward_copy_shift     push=8  pull=24
+		backward_copy_shift	push=8	pull=24
 
-17:            backward_copy_shift     push=16 pull=16
+17:		backward_copy_shift	push=16	pull=16
 
-18:            backward_copy_shift     push=24 pull=8
+18:		backward_copy_shift	push=24	pull=8
 
 ENDPROC(memmove)
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/memset.S
--- a/xen/arch/arm/lib/memset.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/memset.S	Mon Feb 13 17:26:08 2012 +0000
@@ -14,33 +14,33 @@
 
 #include "assembler.h"
 
-       .text
-       .align  5
-       .word   0
+	.text
+	.align	5
+	.word	0
 
-1:     subs    r2, r2, #4              @ 1 do we have enough
-       blt     5f                      @ 1 bytes to align with?
-       cmp     r3, #2                  @ 1
-       strltb  r1, [r0], #1            @ 1
-       strleb  r1, [r0], #1            @ 1
-       strb    r1, [r0], #1            @ 1
-       add     r2, r2, r3              @ 1 (r2 = r2 - (4 - r3))
+1:	subs	r2, r2, #4		@ 1 do we have enough
+	blt	5f			@ 1 bytes to align with?
+	cmp	r3, #2			@ 1
+	strltb	r1, [r0], #1		@ 1
+	strleb	r1, [r0], #1		@ 1
+	strb	r1, [r0], #1		@ 1
+	add	r2, r2, r3		@ 1 (r2 = r2 - (4 - r3))
 /*
  * The pointer is now aligned and the length is adjusted.  Try doing the
  * memset again.
  */
 
 ENTRY(memset)
-       ands    r3, r0, #3              @ 1 unaligned?
-       bne     1b                      @ 1
+	ands	r3, r0, #3		@ 1 unaligned?
+	bne	1b			@ 1
 /*
  * we know that the pointer in r0 is aligned to a word boundary.
  */
-       orr     r1, r1, r1, lsl #8
-       orr     r1, r1, r1, lsl #16
-       mov     r3, r1
-       cmp     r2, #16
-       blt     4f
+	orr	r1, r1, r1, lsl #8
+	orr	r1, r1, r1, lsl #16
+	mov	r3, r1
+	cmp	r2, #16
+	blt	4f
 
 #if ! CALGN(1)+0
 
@@ -48,26 +48,26 @@
  * We need an extra register for this loop - save the return address and
  * use the LR
  */
-       str     lr, [sp, #-4]!
-       mov     ip, r1
-       mov     lr, r1
+	str	lr, [sp, #-4]!
+	mov	ip, r1
+	mov	lr, r1
 
-2:     subs    r2, r2, #64
-       stmgeia r0!, {r1, r3, ip, lr}   @ 64 bytes at a time.
-       stmgeia r0!, {r1, r3, ip, lr}
-       stmgeia r0!, {r1, r3, ip, lr}
-       stmgeia r0!, {r1, r3, ip, lr}
-       bgt     2b
-       ldmeqfd sp!, {pc}               @ Now <64 bytes to go.
+2:	subs	r2, r2, #64
+	stmgeia	r0!, {r1, r3, ip, lr}	@ 64 bytes at a time.
+	stmgeia	r0!, {r1, r3, ip, lr}
+	stmgeia	r0!, {r1, r3, ip, lr}
+	stmgeia	r0!, {r1, r3, ip, lr}
+	bgt	2b
+	ldmeqfd	sp!, {pc}		@ Now <64 bytes to go.
 /*
  * No need to correct the count; we're only testing bits from now on
  */
-       tst     r2, #32
-       stmneia r0!, {r1, r3, ip, lr}
-       stmneia r0!, {r1, r3, ip, lr}
-       tst     r2, #16
-       stmneia r0!, {r1, r3, ip, lr}
-       ldr     lr, [sp], #4
+	tst	r2, #32
+	stmneia	r0!, {r1, r3, ip, lr}
+	stmneia	r0!, {r1, r3, ip, lr}
+	tst	r2, #16
+	stmneia	r0!, {r1, r3, ip, lr}
+	ldr	lr, [sp], #4
 
 #else
 
@@ -76,54 +76,54 @@
  * whole cache lines at once.
  */
 
-       stmfd   sp!, {r4-r7, lr}
-       mov     r4, r1
-       mov     r5, r1
-       mov     r6, r1
-       mov     r7, r1
-       mov     ip, r1
-       mov     lr, r1
+	stmfd	sp!, {r4-r7, lr}
+	mov	r4, r1
+	mov	r5, r1
+	mov	r6, r1
+	mov	r7, r1
+	mov	ip, r1
+	mov	lr, r1
 
-       cmp     r2, #96
-       tstgt   r0, #31
-       ble     3f
+	cmp	r2, #96
+	tstgt	r0, #31
+	ble	3f
 
-       and     ip, r0, #31
-       rsb     ip, ip, #32
-       sub     r2, r2, ip
-       movs    ip, ip, lsl #(32 - 4)
-       stmcsia r0!, {r4, r5, r6, r7}
-       stmmiia r0!, {r4, r5}
-       tst     ip, #(1 << 30)
-       mov     ip, r1
-       strne   r1, [r0], #4
+	and	ip, r0, #31
+	rsb	ip, ip, #32
+	sub	r2, r2, ip
+	movs	ip, ip, lsl #(32 - 4)
+	stmcsia	r0!, {r4, r5, r6, r7}
+	stmmiia	r0!, {r4, r5}
+	tst	ip, #(1 << 30)
+	mov	ip, r1
+	strne	r1, [r0], #4
 
-3:     subs    r2, r2, #64
-       stmgeia r0!, {r1, r3-r7, ip, lr}
-       stmgeia r0!, {r1, r3-r7, ip, lr}
-       bgt     3b
-       ldmeqfd sp!, {r4-r7, pc}
+3:	subs	r2, r2, #64
+	stmgeia	r0!, {r1, r3-r7, ip, lr}
+	stmgeia	r0!, {r1, r3-r7, ip, lr}
+	bgt	3b
+	ldmeqfd	sp!, {r4-r7, pc}
 
-       tst     r2, #32
-       stmneia r0!, {r1, r3-r7, ip, lr}
-       tst     r2, #16
-       stmneia r0!, {r4-r7}
-       ldmfd   sp!, {r4-r7, lr}
+	tst	r2, #32
+	stmneia	r0!, {r1, r3-r7, ip, lr}
+	tst	r2, #16
+	stmneia	r0!, {r4-r7}
+	ldmfd	sp!, {r4-r7, lr}
 
 #endif
 
-4:     tst     r2, #8
-       stmneia r0!, {r1, r3}
-       tst     r2, #4
-       strne   r1, [r0], #4
+4:	tst	r2, #8
+	stmneia	r0!, {r1, r3}
+	tst	r2, #4
+	strne	r1, [r0], #4
 /*
  * When we get here, we've got less than 4 bytes to zero.  We
  * may have an unaligned pointer as well.
  */
-5:     tst     r2, #2
-       strneb  r1, [r0], #1
-       strneb  r1, [r0], #1
-       tst     r2, #1
-       strneb  r1, [r0], #1
-       mov     pc, lr
+5:	tst	r2, #2
+	strneb	r1, [r0], #1
+	strneb	r1, [r0], #1
+	tst	r2, #1
+	strneb	r1, [r0], #1
+	mov	pc, lr
 ENDPROC(memset)
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/memzero.S
--- a/xen/arch/arm/lib/memzero.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/memzero.S	Mon Feb 13 17:26:08 2012 +0000
@@ -12,35 +12,35 @@
 
 #include "assembler.h"
 
-       .text
-       .align  5
-       .word   0
+	.text
+	.align	5
+	.word	0
 /*
  * Align the pointer in r0.  r3 contains the number of bytes that we are
  * mis-aligned by, and r1 is the number of bytes.  If r1 < 4, then we
  * don't bother; we use byte stores instead.
  */
-1:     subs    r1, r1, #4              @ 1 do we have enough
-       blt     5f                      @ 1 bytes to align with?
-       cmp     r3, #2                  @ 1
-       strltb  r2, [r0], #1            @ 1
-       strleb  r2, [r0], #1            @ 1
-       strb    r2, [r0], #1            @ 1
-       add     r1, r1, r3              @ 1 (r1 = r1 - (4 - r3))
+1:	subs	r1, r1, #4		@ 1 do we have enough
+	blt	5f			@ 1 bytes to align with?
+	cmp	r3, #2			@ 1
+	strltb	r2, [r0], #1		@ 1
+	strleb	r2, [r0], #1		@ 1
+	strb	r2, [r0], #1		@ 1
+	add	r1, r1, r3		@ 1 (r1 = r1 - (4 - r3))
 /*
  * The pointer is now aligned and the length is adjusted.  Try doing the
  * memzero again.
  */
 
 ENTRY(__memzero)
-       mov     r2, #0                  @ 1
-       ands    r3, r0, #3              @ 1 unaligned?
-       bne     1b                      @ 1
+	mov	r2, #0			@ 1
+	ands	r3, r0, #3		@ 1 unaligned?
+	bne	1b			@ 1
 /*
  * r3 = 0, and we know that the pointer in r0 is aligned to a word boundary.
  */
-       cmp     r1, #16                 @ 1 we can skip this chunk if we
-       blt     4f                      @ 1 have < 16 bytes
+	cmp	r1, #16			@ 1 we can skip this chunk if we
+	blt	4f			@ 1 have < 16 bytes
 
 #if ! CALGN(1)+0
 
@@ -48,26 +48,26 @@
  * We need an extra register for this loop - save the return address and
  * use the LR
  */
-       str     lr, [sp, #-4]!          @ 1
-       mov     ip, r2                  @ 1
-       mov     lr, r2                  @ 1
+	str	lr, [sp, #-4]!		@ 1
+	mov	ip, r2			@ 1
+	mov	lr, r2			@ 1
 
-3:     subs    r1, r1, #64             @ 1 write 32 bytes out per loop
-       stmgeia r0!, {r2, r3, ip, lr}   @ 4
-       stmgeia r0!, {r2, r3, ip, lr}   @ 4
-       stmgeia r0!, {r2, r3, ip, lr}   @ 4
-       stmgeia r0!, {r2, r3, ip, lr}   @ 4
-       bgt     3b                      @ 1
-       ldmeqfd sp!, {pc}               @ 1/2 quick exit
+3:	subs	r1, r1, #64		@ 1 write 32 bytes out per loop
+	stmgeia	r0!, {r2, r3, ip, lr}	@ 4
+	stmgeia	r0!, {r2, r3, ip, lr}	@ 4
+	stmgeia	r0!, {r2, r3, ip, lr}	@ 4
+	stmgeia	r0!, {r2, r3, ip, lr}	@ 4
+	bgt	3b			@ 1
+	ldmeqfd	sp!, {pc}		@ 1/2 quick exit
 /*
  * No need to correct the count; we're only testing bits from now on
  */
-       tst     r1, #32                 @ 1
-       stmneia r0!, {r2, r3, ip, lr}   @ 4
-       stmneia r0!, {r2, r3, ip, lr}   @ 4
-       tst     r1, #16                 @ 1 16 bytes or more?
-       stmneia r0!, {r2, r3, ip, lr}   @ 4
-       ldr     lr, [sp], #4            @ 1
+	tst	r1, #32			@ 1
+	stmneia	r0!, {r2, r3, ip, lr}	@ 4
+	stmneia	r0!, {r2, r3, ip, lr}	@ 4
+	tst	r1, #16			@ 1 16 bytes or more?
+	stmneia	r0!, {r2, r3, ip, lr}	@ 4
+	ldr	lr, [sp], #4		@ 1
 
 #else
 
@@ -76,52 +76,52 @@
  * whole cache lines at once.
  */
 
-       stmfd   sp!, {r4-r7, lr}
-       mov     r4, r2
-       mov     r5, r2
-       mov     r6, r2
-       mov     r7, r2
-       mov     ip, r2
-       mov     lr, r2
+	stmfd	sp!, {r4-r7, lr}
+	mov	r4, r2
+	mov	r5, r2
+	mov	r6, r2
+	mov	r7, r2
+	mov	ip, r2
+	mov	lr, r2
 
-       cmp     r1, #96
-       andgts  ip, r0, #31
-       ble     3f
+	cmp	r1, #96
+	andgts	ip, r0, #31
+	ble	3f
 
-       rsb     ip, ip, #32
-       sub     r1, r1, ip
-       movs    ip, ip, lsl #(32 - 4)
-       stmcsia r0!, {r4, r5, r6, r7}
-       stmmiia r0!, {r4, r5}
-       movs    ip, ip, lsl #2
-       strcs   r2, [r0], #4
+	rsb	ip, ip, #32
+	sub	r1, r1, ip
+	movs	ip, ip, lsl #(32 - 4)
+	stmcsia	r0!, {r4, r5, r6, r7}
+	stmmiia	r0!, {r4, r5}
+	movs	ip, ip, lsl #2
+	strcs	r2, [r0], #4
 
-3:     subs    r1, r1, #64
-       stmgeia r0!, {r2-r7, ip, lr}
-       stmgeia r0!, {r2-r7, ip, lr}
-       bgt     3b
-       ldmeqfd sp!, {r4-r7, pc}
+3:	subs	r1, r1, #64
+	stmgeia	r0!, {r2-r7, ip, lr}
+	stmgeia	r0!, {r2-r7, ip, lr}
+	bgt	3b
+	ldmeqfd	sp!, {r4-r7, pc}
 
-       tst     r1, #32
-       stmneia r0!, {r2-r7, ip, lr}
-       tst     r1, #16
-       stmneia r0!, {r4-r7}
-       ldmfd   sp!, {r4-r7, lr}
+	tst	r1, #32
+	stmneia	r0!, {r2-r7, ip, lr}
+	tst	r1, #16
+	stmneia	r0!, {r4-r7}
+	ldmfd	sp!, {r4-r7, lr}
 
 #endif
 
-4:     tst     r1, #8                  @ 1 8 bytes or more?
-       stmneia r0!, {r2, r3}           @ 2
-       tst     r1, #4                  @ 1 4 bytes or more?
-       strne   r2, [r0], #4            @ 1
+4:	tst	r1, #8			@ 1 8 bytes or more?
+	stmneia	r0!, {r2, r3}		@ 2
+	tst	r1, #4			@ 1 4 bytes or more?
+	strne	r2, [r0], #4		@ 1
 /*
  * When we get here, we've got less than 4 bytes to zero.  We
  * may have an unaligned pointer as well.
  */
-5:     tst     r1, #2                  @ 1 2 bytes or more?
-       strneb  r2, [r0], #1            @ 1
-       strneb  r2, [r0], #1            @ 1
-       tst     r1, #1                  @ 1 a byte left over
-       strneb  r2, [r0], #1            @ 1
-       mov     pc, lr                  @ 1
+5:	tst	r1, #2			@ 1 2 bytes or more?
+	strneb	r2, [r0], #1		@ 1
+	strneb	r2, [r0], #1		@ 1
+	tst	r1, #1			@ 1 a byte left over
+	strneb	r2, [r0], #1		@ 1
+	mov	pc, lr			@ 1
 ENDPROC(__memzero)
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/setbit.S
--- a/xen/arch/arm/lib/setbit.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/setbit.S	Mon Feb 13 17:26:08 2012 +0000
@@ -11,8 +11,8 @@
 
 #include "assembler.h"
 #include "bitops.h"
-       .text
+	.text
 
 ENTRY(_set_bit)
-       bitop   orr
+	bitop	orr
 ENDPROC(_set_bit)
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/testchangebit.S
--- a/xen/arch/arm/lib/testchangebit.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/testchangebit.S	Mon Feb 13 17:26:08 2012 +0000
@@ -14,5 +14,5 @@
                 .text
 
 ENTRY(_test_and_change_bit)
-       testop  eor, str
+	testop	eor, str
 ENDPROC(_test_and_change_bit)
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/testclearbit.S
--- a/xen/arch/arm/lib/testclearbit.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/testclearbit.S	Mon Feb 13 17:26:08 2012 +0000
@@ -14,5 +14,5 @@
                 .text
 
 ENTRY(_test_and_clear_bit)
-       testop  bicne, strne
+	testop	bicne, strne
 ENDPROC(_test_and_clear_bit)
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/arch/arm/lib/testsetbit.S
--- a/xen/arch/arm/lib/testsetbit.S	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/arch/arm/lib/testsetbit.S	Mon Feb 13 17:26:08 2012 +0000
@@ -14,5 +14,5 @@
                 .text
 
 ENTRY(_test_and_set_bit)
-       testop  orreq, streq
+	testop	orreq, streq
 ENDPROC(_test_and_set_bit)
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/include/asm-arm/bitops.h
--- a/xen/include/asm-arm/bitops.h	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/include/asm-arm/bitops.h	Mon Feb 13 17:26:08 2012 +0000
@@ -115,19 +115,19 @@
 /*
  * These are the little endian, atomic definitions.
  */
-#define find_first_zero_bit(p,sz)      _find_first_zero_bit_le(p,sz)
-#define find_next_zero_bit(p,sz,off)   _find_next_zero_bit_le(p,sz,off)
-#define find_first_bit(p,sz)           _find_first_bit_le(p,sz)
-#define find_next_bit(p,sz,off)                _find_next_bit_le(p,sz,off)
+#define find_first_zero_bit(p,sz)	_find_first_zero_bit_le(p,sz)
+#define find_next_zero_bit(p,sz,off)	_find_next_zero_bit_le(p,sz,off)
+#define find_first_bit(p,sz)		_find_first_bit_le(p,sz)
+#define find_next_bit(p,sz,off)		_find_next_bit_le(p,sz,off)
 
 #else
 /*
  * These are the big endian, atomic definitions.
  */
-#define find_first_zero_bit(p,sz)      _find_first_zero_bit_be(p,sz)
-#define find_next_zero_bit(p,sz,off)   _find_next_zero_bit_be(p,sz,off)
-#define find_first_bit(p,sz)           _find_first_bit_be(p,sz)
-#define find_next_bit(p,sz,off)                _find_next_bit_be(p,sz,off)
+#define find_first_zero_bit(p,sz)	_find_first_zero_bit_be(p,sz)
+#define find_next_zero_bit(p,sz,off)	_find_next_zero_bit_be(p,sz,off)
+#define find_first_bit(p,sz)		_find_first_bit_be(p,sz)
+#define find_next_bit(p,sz,off)		_find_next_bit_be(p,sz,off)
 
 #endif
 
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/include/asm-arm/div64.h
--- a/xen/include/asm-arm/div64.h	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/include/asm-arm/div64.h	Mon Feb 13 17:26:08 2012 +0000
@@ -10,9 +10,9 @@
  *
  * uint32_t do_div(uint64_t *n, uint32_t base)
  * {
- *     uint32_t remainder = *n % base;
- *     *n = *n / base;
- *     return remainder;
+ * 	uint32_t remainder = *n % base;
+ * 	*n = *n / base;
+ * 	return remainder;
  * }
  *
  * In other words, a 64-bit dividend with a 32-bit divisor producing
@@ -29,22 +29,22 @@
 #define __xh "r1"
 #endif
 
-#define __do_div_asm(n, base)                                  \
-({                                                             \
-       register unsigned int __base      asm("r4") = base;     \
-       register unsigned long long __n   asm("r0") = n;        \
-       register unsigned long long __res asm("r2");            \
-       register unsigned int __rem       asm(__xh);            \
-       asm(    __asmeq("%0", __xh)                             \
-               __asmeq("%1", "r2")                             \
-               __asmeq("%2", "r0")                             \
-               __asmeq("%3", "r4")                             \
-               "bl     __do_div64"                             \
-               : "=r" (__rem), "=r" (__res)                    \
-               : "r" (__n), "r" (__base)                       \
-               : "ip", "lr", "cc");                            \
-       n = __res;                                              \
-       __rem;                                                  \
+#define __do_div_asm(n, base)					\
+({								\
+	register unsigned int __base      asm("r4") = base;	\
+	register unsigned long long __n   asm("r0") = n;	\
+	register unsigned long long __res asm("r2");		\
+	register unsigned int __rem       asm(__xh);		\
+	asm(	__asmeq("%0", __xh)				\
+		__asmeq("%1", "r2")				\
+		__asmeq("%2", "r0")				\
+		__asmeq("%3", "r4")				\
+		"bl	__do_div64"				\
+		: "=r" (__rem), "=r" (__res)			\
+		: "r" (__n), "r" (__base)			\
+		: "ip", "lr", "cc");				\
+	n = __res;						\
+	__rem;							\
 })
 
 #if __GNUC__ < 4
@@ -71,155 +71,155 @@
  * sufficiently recent to perform proper long long constant propagation.
  * (It is unfortunate that gcc doesn't perform all this internally.)
  */
-#define do_div(n, base)                                                        \
-({                                                                     \
-       unsigned int __r, __b = (base);                                 \
-       if (!__builtin_constant_p(__b) || __b == 0) {                   \
-               /* non-constant divisor (or zero): slow path */         \
-               __r = __do_div_asm(n, __b);                             \
-       } else if ((__b & (__b - 1)) == 0) {                            \
-               /* Trivial: __b is constant and a power of 2 */         \
-               /* gcc does the right thing with this code.  */         \
-               __r = n;                                                \
-               __r &= (__b - 1);                                       \
-               n /= __b;                                               \
-       } else {                                                        \
-               /* Multiply by inverse of __b: n/b = n*(p/b)/p       */ \
-               /* We rely on the fact that most of this code gets   */ \
-               /* optimized away at compile time due to constant    */ \
-               /* propagation and only a couple inline assembly     */ \
-               /* instructions should remain. Better avoid any      */ \
-               /* code construct that might prevent that.           */ \
-               unsigned long long __res, __x, __t, __m, __n = n;       \
-               unsigned int __c, __p, __z = 0;                         \
-               /* preserve low part of n for reminder computation */   \
-               __r = __n;                                              \
-               /* determine number of bits to represent __b */         \
-               __p = 1 << __div64_fls(__b);                            \
-               /* compute __m = ((__p << 64) + __b - 1) / __b */       \
-               __m = (~0ULL / __b) * __p;                              \
-               __m += (((~0ULL % __b + 1) * __p) + __b - 1) / __b;     \
-               /* compute __res = __m*(~0ULL/__b*__b-1)/(__p << 64) */ \
-               __x = ~0ULL / __b * __b - 1;                            \
-               __res = (__m & 0xffffffff) * (__x & 0xffffffff);        \
-               __res >>= 32;                                           \
-               __res += (__m & 0xffffffff) * (__x >> 32);              \
-               __t = __res;                                            \
-               __res += (__x & 0xffffffff) * (__m >> 32);              \
-               __t = (__res < __t) ? (1ULL << 32) : 0;                 \
-               __res = (__res >> 32) + __t;                            \
-               __res += (__m >> 32) * (__x >> 32);                     \
-               __res /= __p;                                           \
-               /* Now sanitize and optimize what we've got. */         \
-               if (~0ULL % (__b / (__b & -__b)) == 0) {                \
-                       /* those cases can be simplified with: */       \
-                       __n /= (__b & -__b);                            \
-                       __m = ~0ULL / (__b / (__b & -__b));             \
-                       __p = 1;                                        \
-                       __c = 1;                                        \
-               } else if (__res != __x / __b) {                        \
-                       /* We can't get away without a correction    */ \
-                       /* to compensate for bit truncation errors.  */ \
-                       /* To avoid it we'd need an additional bit   */ \
-                       /* to represent __m which would overflow it. */ \
-                       /* Instead we do m=p/b and n/b=(n*m+m)/p.    */ \
-                       __c = 1;                                        \
-                       /* Compute __m = (__p << 64) / __b */           \
-                       __m = (~0ULL / __b) * __p;                      \
-                       __m += ((~0ULL % __b + 1) * __p) / __b;         \
-               } else {                                                \
-                       /* Reduce __m/__p, and try to clear bit 31   */ \
-                       /* of __m when possible otherwise that'll    */ \
-                       /* need extra overflow handling later.       */ \
-                       unsigned int __bits = -(__m & -__m);            \
-                       __bits |= __m >> 32;                            \
-                       __bits = (~__bits) << 1;                        \
-                       /* If __bits == 0 then setting bit 31 is     */ \
-                       /* unavoidable.  Simply apply the maximum    */ \
-                       /* possible reduction in that case.          */ \
-                       /* Otherwise the MSB of __bits indicates the */ \
-                       /* best reduction we should apply.           */ \
-                       if (!__bits) {                                  \
-                               __p /= (__m & -__m);                    \
-                               __m /= (__m & -__m);                    \
-                       } else {                                        \
-                               __p >>= __div64_fls(__bits);            \
-                               __m >>= __div64_fls(__bits);            \
-                       }                                               \
-                       /* No correction needed. */                     \
-                       __c = 0;                                        \
-               }                                                       \
-               /* Now we have a combination of 2 conditions:        */ \
-               /* 1) whether or not we need a correction (__c), and */ \
-               /* 2) whether or not there might be an overflow in   */ \
-               /*    the cross product (__m & ((1<<63) | (1<<31)))  */ \
-               /* Select the best insn combination to perform the   */ \
-               /* actual __m * __n / (__p << 64) operation.         */ \
-               if (!__c) {                                             \
-                       asm (   "umull  %Q0, %R0, %1, %Q2\n\t"          \
-                               "mov    %Q0, #0"                        \
-                               : "=&r" (__res)                         \
-                               : "r" (__m), "r" (__n)                  \
-                               : "cc" );                               \
-               } else if (!(__m & ((1ULL << 63) | (1ULL << 31)))) {    \
-                       __res = __m;                                    \
-                       asm (   "umlal  %Q0, %R0, %Q1, %Q2\n\t"         \
-                               "mov    %Q0, #0"                        \
-                               : "+&r" (__res)                         \
-                               : "r" (__m), "r" (__n)                  \
-                               : "cc" );                               \
-               } else {                                                \
-                       asm (   "umull  %Q0, %R0, %Q1, %Q2\n\t"         \
-                               "cmn    %Q0, %Q1\n\t"                   \
-                               "adcs   %R0, %R0, %R1\n\t"              \
-                               "adc    %Q0, %3, #0"                    \
-                               : "=&r" (__res)                         \
-                               : "r" (__m), "r" (__n), "r" (__z)       \
-                               : "cc" );                               \
-               }                                                       \
-               if (!(__m & ((1ULL << 63) | (1ULL << 31)))) {           \
-                       asm (   "umlal  %R0, %Q0, %R1, %Q2\n\t"         \
-                               "umlal  %R0, %Q0, %Q1, %R2\n\t"         \
-                               "mov    %R0, #0\n\t"                    \
-                               "umlal  %Q0, %R0, %R1, %R2"             \
-                               : "+&r" (__res)                         \
-                               : "r" (__m), "r" (__n)                  \
-                               : "cc" );                               \
-               } else {                                                \
-                       asm (   "umlal  %R0, %Q0, %R2, %Q3\n\t"         \
-                               "umlal  %R0, %1, %Q2, %R3\n\t"          \
-                               "mov    %R0, #0\n\t"                    \
-                               "adds   %Q0, %1, %Q0\n\t"               \
-                               "adc    %R0, %R0, #0\n\t"               \
-                               "umlal  %Q0, %R0, %R2, %R3"             \
-                               : "+&r" (__res), "+&r" (__z)            \
-                               : "r" (__m), "r" (__n)                  \
-                               : "cc" );                               \
-               }                                                       \
-               __res /= __p;                                           \
-               /* The reminder can be computed with 32-bit regs     */ \
-               /* only, and gcc is good at that.                    */ \
-               {                                                       \
-                       unsigned int __res0 = __res;                    \
-                       unsigned int __b0 = __b;                        \
-                       __r -= __res0 * __b0;                           \
-               }                                                       \
-               /* BUG_ON(__r >= __b || __res * __b + __r != n); */     \
-               n = __res;                                              \
-       }                                                               \
-       __r;                                                            \
+#define do_div(n, base)							\
+({									\
+	unsigned int __r, __b = (base);					\
+	if (!__builtin_constant_p(__b) || __b == 0) {			\
+		/* non-constant divisor (or zero): slow path */		\
+		__r = __do_div_asm(n, __b);				\
+	} else if ((__b & (__b - 1)) == 0) {				\
+		/* Trivial: __b is constant and a power of 2 */		\
+		/* gcc does the right thing with this code.  */		\
+		__r = n;						\
+		__r &= (__b - 1);					\
+		n /= __b;						\
+	} else {							\
+		/* Multiply by inverse of __b: n/b = n*(p/b)/p       */	\
+		/* We rely on the fact that most of this code gets   */	\
+		/* optimized away at compile time due to constant    */	\
+		/* propagation and only a couple inline assembly     */	\
+		/* instructions should remain. Better avoid any      */	\
+		/* code construct that might prevent that.           */	\
+		unsigned long long __res, __x, __t, __m, __n = n;	\
+		unsigned int __c, __p, __z = 0;				\
+		/* preserve low part of n for reminder computation */	\
+		__r = __n;						\
+		/* determine number of bits to represent __b */		\
+		__p = 1 << __div64_fls(__b);				\
+		/* compute __m = ((__p << 64) + __b - 1) / __b */	\
+		__m = (~0ULL / __b) * __p;				\
+		__m += (((~0ULL % __b + 1) * __p) + __b - 1) / __b;	\
+		/* compute __res = __m*(~0ULL/__b*__b-1)/(__p << 64) */	\
+		__x = ~0ULL / __b * __b - 1;				\
+		__res = (__m & 0xffffffff) * (__x & 0xffffffff);	\
+		__res >>= 32;						\
+		__res += (__m & 0xffffffff) * (__x >> 32);		\
+		__t = __res;						\
+		__res += (__x & 0xffffffff) * (__m >> 32);		\
+		__t = (__res < __t) ? (1ULL << 32) : 0;			\
+		__res = (__res >> 32) + __t;				\
+		__res += (__m >> 32) * (__x >> 32);			\
+		__res /= __p;						\
+		/* Now sanitize and optimize what we've got. */		\
+		if (~0ULL % (__b / (__b & -__b)) == 0) {		\
+			/* those cases can be simplified with: */	\
+			__n /= (__b & -__b);				\
+			__m = ~0ULL / (__b / (__b & -__b));		\
+			__p = 1;					\
+			__c = 1;					\
+		} else if (__res != __x / __b) {			\
+			/* We can't get away without a correction    */	\
+			/* to compensate for bit truncation errors.  */	\
+			/* To avoid it we'd need an additional bit   */	\
+			/* to represent __m which would overflow it. */	\
+			/* Instead we do m=p/b and n/b=(n*m+m)/p.    */	\
+			__c = 1;					\
+			/* Compute __m = (__p << 64) / __b */		\
+			__m = (~0ULL / __b) * __p;			\
+			__m += ((~0ULL % __b + 1) * __p) / __b;		\
+		} else {						\
+			/* Reduce __m/__p, and try to clear bit 31   */	\
+			/* of __m when possible otherwise that'll    */	\
+			/* need extra overflow handling later.       */	\
+			unsigned int __bits = -(__m & -__m);		\
+			__bits |= __m >> 32;				\
+			__bits = (~__bits) << 1;			\
+			/* If __bits == 0 then setting bit 31 is     */	\
+			/* unavoidable.  Simply apply the maximum    */	\
+			/* possible reduction in that case.          */	\
+			/* Otherwise the MSB of __bits indicates the */	\
+			/* best reduction we should apply.           */	\
+			if (!__bits) {					\
+				__p /= (__m & -__m);			\
+				__m /= (__m & -__m);			\
+			} else {					\
+				__p >>= __div64_fls(__bits);		\
+				__m >>= __div64_fls(__bits);		\
+			}						\
+			/* No correction needed. */			\
+			__c = 0;					\
+		}							\
+		/* Now we have a combination of 2 conditions:        */	\
+		/* 1) whether or not we need a correction (__c), and */	\
+		/* 2) whether or not there might be an overflow in   */	\
+		/*    the cross product (__m & ((1<<63) | (1<<31)))  */	\
+		/* Select the best insn combination to perform the   */	\
+		/* actual __m * __n / (__p << 64) operation.         */	\
+		if (!__c) {						\
+			asm (	"umull	%Q0, %R0, %1, %Q2\n\t"		\
+				"mov	%Q0, #0"			\
+				: "=&r" (__res)				\
+				: "r" (__m), "r" (__n)			\
+				: "cc" );				\
+		} else if (!(__m & ((1ULL << 63) | (1ULL << 31)))) {	\
+			__res = __m;					\
+			asm (	"umlal	%Q0, %R0, %Q1, %Q2\n\t"		\
+				"mov	%Q0, #0"			\
+				: "+&r" (__res)				\
+				: "r" (__m), "r" (__n)			\
+				: "cc" );				\
+		} else {						\
+			asm (	"umull	%Q0, %R0, %Q1, %Q2\n\t"		\
+				"cmn	%Q0, %Q1\n\t"			\
+				"adcs	%R0, %R0, %R1\n\t"		\
+				"adc	%Q0, %3, #0"			\
+				: "=&r" (__res)				\
+				: "r" (__m), "r" (__n), "r" (__z)	\
+				: "cc" );				\
+		}							\
+		if (!(__m & ((1ULL << 63) | (1ULL << 31)))) {		\
+			asm (	"umlal	%R0, %Q0, %R1, %Q2\n\t"		\
+				"umlal	%R0, %Q0, %Q1, %R2\n\t"		\
+				"mov	%R0, #0\n\t"			\
+				"umlal	%Q0, %R0, %R1, %R2"		\
+				: "+&r" (__res)				\
+				: "r" (__m), "r" (__n)			\
+				: "cc" );				\
+		} else {						\
+			asm (	"umlal	%R0, %Q0, %R2, %Q3\n\t"		\
+				"umlal	%R0, %1, %Q2, %R3\n\t"		\
+				"mov	%R0, #0\n\t"			\
+				"adds	%Q0, %1, %Q0\n\t"		\
+				"adc	%R0, %R0, #0\n\t"		\
+				"umlal	%Q0, %R0, %R2, %R3"		\
+				: "+&r" (__res), "+&r" (__z)		\
+				: "r" (__m), "r" (__n)			\
+				: "cc" );				\
+		}							\
+		__res /= __p;						\
+		/* The reminder can be computed with 32-bit regs     */	\
+		/* only, and gcc is good at that.                    */	\
+		{							\
+			unsigned int __res0 = __res;			\
+			unsigned int __b0 = __b;			\
+			__r -= __res0 * __b0;				\
+		}							\
+		/* BUG_ON(__r >= __b || __res * __b + __r != n); */	\
+		n = __res;						\
+	}								\
+	__r;								\
 })
 
 /* our own fls implementation to make sure constant propagation is fine */
-#define __div64_fls(bits)                                              \
-({                                                                     \
-       unsigned int __left = (bits), __nr = 0;                         \
-       if (__left & 0xffff0000) __nr += 16, __left >>= 16;             \
-       if (__left & 0x0000ff00) __nr +=  8, __left >>=  8;             \
-       if (__left & 0x000000f0) __nr +=  4, __left >>=  4;             \
-       if (__left & 0x0000000c) __nr +=  2, __left >>=  2;             \
-       if (__left & 0x00000002) __nr +=  1;                            \
-       __nr;                                                           \
+#define __div64_fls(bits)						\
+({									\
+	unsigned int __left = (bits), __nr = 0;				\
+	if (__left & 0xffff0000) __nr += 16, __left >>= 16;		\
+	if (__left & 0x0000ff00) __nr +=  8, __left >>=  8;		\
+	if (__left & 0x000000f0) __nr +=  4, __left >>=  4;		\
+	if (__left & 0x0000000c) __nr +=  2, __left >>=  2;		\
+	if (__left & 0x00000002) __nr +=  1;				\
+	__nr;								\
 })
 
 #endif
diff -r f3d137e3e6c7 -r 0ba87b95e80b xen/include/asm-arm/numa.h
--- a/xen/include/asm-arm/numa.h	Mon Feb 13 18:17:28 2012 +0000
+++ b/xen/include/asm-arm/numa.h	Mon Feb 13 17:26:08 2012 +0000
@@ -3,7 +3,7 @@
 
 /* Fake one node for now... */
 #define cpu_to_node(cpu) 0
-#define node_to_cpumask(node)  (cpu_online_map)
+#define node_to_cpumask(node)	(cpu_online_map)
 
 static inline __attribute__((pure)) int phys_to_nid(paddr_t addr)
 {

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:45 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDo-0005Ii-RR; Tue, 14 Feb 2012 23:55:44 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDn-0005EM-Id
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:43 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-216.messagelabs.com!1329263725!12115168!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32649 invoked from network); 14 Feb 2012 23:55:26 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:26 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDV-0007im-I5
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:25 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDV-0002IV-Gr
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:25 +0000
Message-Id: <E1RxSDV-0002IV-Gr@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:25 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: only compile libfsimage/xfs
	on X86
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329154341 0
# Node ID e03d1005e484e8ad055687952b1e30d56632e8c2
# Parent  acf4ad70c87b502207a50d99840bf58c9b238fff
tools: only compile libfsimage/xfs on X86

xfs is not portable, only compile it on X86

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r acf4ad70c87b -r e03d1005e484 tools/libfsimage/Makefile
--- a/tools/libfsimage/Makefile	Mon Feb 13 17:29:50 2012 +0000
+++ b/tools/libfsimage/Makefile	Mon Feb 13 17:32:21 2012 +0000
@@ -1,7 +1,8 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-SUBDIRS-y = common ufs reiserfs iso9660 fat zfs xfs
+SUBDIRS-y = common ufs reiserfs iso9660 fat zfs
+SUBDIRS-$(CONFIG_X86) += xfs
 SUBDIRS-y += $(shell env CC="$(CC)" ./check-libext2fs)
 
 .PHONY: all clean install

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:45 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDo-0005Ii-RR; Tue, 14 Feb 2012 23:55:44 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDn-0005EM-Id
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:43 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-216.messagelabs.com!1329263725!12115168!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32649 invoked from network); 14 Feb 2012 23:55:26 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:26 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDV-0007im-I5
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:25 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDV-0002IV-Gr
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:25 +0000
Message-Id: <E1RxSDV-0002IV-Gr@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:25 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: only compile libfsimage/xfs
	on X86
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329154341 0
# Node ID e03d1005e484e8ad055687952b1e30d56632e8c2
# Parent  acf4ad70c87b502207a50d99840bf58c9b238fff
tools: only compile libfsimage/xfs on X86

xfs is not portable, only compile it on X86

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r acf4ad70c87b -r e03d1005e484 tools/libfsimage/Makefile
--- a/tools/libfsimage/Makefile	Mon Feb 13 17:29:50 2012 +0000
+++ b/tools/libfsimage/Makefile	Mon Feb 13 17:32:21 2012 +0000
@@ -1,7 +1,8 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-SUBDIRS-y = common ufs reiserfs iso9660 fat zfs xfs
+SUBDIRS-y = common ufs reiserfs iso9660 fat zfs
+SUBDIRS-$(CONFIG_X86) += xfs
 SUBDIRS-y += $(shell env CC="$(CC)" ./check-libext2fs)
 
 .PHONY: all clean install

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:46 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDp-0005K3-Ur; Tue, 14 Feb 2012 23:55:45 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDn-0005E0-8p
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:44 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-216.messagelabs.com!1329263718!12115159!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32542 invoked from network); 14 Feb 2012 23:55:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDN-0007i3-RV
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDN-0002DJ-Bn
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:17 +0000
Message-Id: <E1RxSDN-0002DJ-Bn@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libfdt: add version 1.3.0
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329140006 0
# Node ID fcc188f21e471d2e9eaf1ddf22a728763a84cca2
# Parent  bd0a11ed1a67fd9b970f4b043879afdbc7f50d0c
libfdt: add version 1.3.0

Add libfdt 1.3.0 from http://git.jdl.com/gitweb/?p=dtc.git

This will be used by Xen to parse the DTBs provided by bootloaders on
ARM platforms.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/Makefile.libfdt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/Makefile.libfdt	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,10 @@
+# Makefile.libfdt
+#
+# This is not a complete Makefile of itself.  Instead, it is designed to
+# be easily embeddable into other systems of Makefiles.
+#
+LIBFDT_soname = libfdt.$(SHAREDLIB_EXT).1
+LIBFDT_INCLUDES = fdt.h libfdt.h
+LIBFDT_VERSION = version.lds
+LIBFDT_SRCS = fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c
+LIBFDT_OBJS = $(LIBFDT_SRCS:%.c=%.o)
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/TODO
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/TODO	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,3 @@
+- Tree traversal functions
+- Graft function
+- Complete libfdt.h documenting comments
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/fdt.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/fdt.c	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,222 @@
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ *
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ *     You should have received a copy of the GNU General Public
+ *     License along with this library; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ *  b) Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *     1. Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *     2. Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "libfdt_env.h"
+
+#include <fdt.h>
+#include <libfdt.h>
+
+#include "libfdt_internal.h"
+
+int fdt_check_header(const void *fdt)
+{
+	if (fdt_magic(fdt) == FDT_MAGIC) {
+		/* Complete tree */
+		if (fdt_version(fdt) < FDT_FIRST_SUPPORTED_VERSION)
+			return -FDT_ERR_BADVERSION;
+		if (fdt_last_comp_version(fdt) > FDT_LAST_SUPPORTED_VERSION)
+			return -FDT_ERR_BADVERSION;
+	} else if (fdt_magic(fdt) == FDT_SW_MAGIC) {
+		/* Unfinished sequential-write blob */
+		if (fdt_size_dt_struct(fdt) == 0)
+			return -FDT_ERR_BADSTATE;
+	} else {
+		return -FDT_ERR_BADMAGIC;
+	}
+
+	return 0;
+}
+
+const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int len)
+{
+	const char *p;
+
+	if (fdt_version(fdt) >= 0x11)
+		if (((offset + len) < offset)
+		    || ((offset + len) > fdt_size_dt_struct(fdt)))
+			return NULL;
+
+	p = _fdt_offset_ptr(fdt, offset);
+
+	if (p + len < p)
+		return NULL;
+	return p;
+}
+
+uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset)
+{
+	const uint32_t *tagp, *lenp;
+	uint32_t tag;
+	int offset = startoffset;
+	const char *p;
+
+	*nextoffset = -FDT_ERR_TRUNCATED;
+	tagp = fdt_offset_ptr(fdt, offset, FDT_TAGSIZE);
+	if (!tagp)
+		return FDT_END; /* premature end */
+	tag = fdt32_to_cpu(*tagp);
+	offset += FDT_TAGSIZE;
+
+	*nextoffset = -FDT_ERR_BADSTRUCTURE;
+	switch (tag) {
+	case FDT_BEGIN_NODE:
+		/* skip name */
+		do {
+			p = fdt_offset_ptr(fdt, offset++, 1);
+		} while (p && (*p != '\0'));
+		if (!p)
+			return FDT_END; /* premature end */
+		break;
+
+	case FDT_PROP:
+		lenp = fdt_offset_ptr(fdt, offset, sizeof(*lenp));
+		if (!lenp)
+			return FDT_END; /* premature end */
+		/* skip-name offset, length and value */
+		offset += sizeof(struct fdt_property) - FDT_TAGSIZE
+			+ fdt32_to_cpu(*lenp);
+		break;
+
+	case FDT_END:
+	case FDT_END_NODE:
+	case FDT_NOP:
+		break;
+
+	default:
+		return FDT_END;
+	}
+
+	if (!fdt_offset_ptr(fdt, startoffset, offset - startoffset))
+		return FDT_END; /* premature end */
+
+	*nextoffset = FDT_TAGALIGN(offset);
+	return tag;
+}
+
+int _fdt_check_node_offset(const void *fdt, int offset)
+{
+	if ((offset < 0) || (offset % FDT_TAGSIZE)
+	    || (fdt_next_tag(fdt, offset, &offset) != FDT_BEGIN_NODE))
+		return -FDT_ERR_BADOFFSET;
+
+	return offset;
+}
+
+int _fdt_check_prop_offset(const void *fdt, int offset)
+{
+	if ((offset < 0) || (offset % FDT_TAGSIZE)
+	    || (fdt_next_tag(fdt, offset, &offset) != FDT_PROP))
+		return -FDT_ERR_BADOFFSET;
+
+	return offset;
+}
+
+int fdt_next_node(const void *fdt, int offset, int *depth)
+{
+	int nextoffset = 0;
+	uint32_t tag;
+
+	if (offset >= 0)
+		if ((nextoffset = _fdt_check_node_offset(fdt, offset)) < 0)
+			return nextoffset;
+
+	do {
+		offset = nextoffset;
+		tag = fdt_next_tag(fdt, offset, &nextoffset);
+
+		switch (tag) {
+		case FDT_PROP:
+		case FDT_NOP:
+			break;
+
+		case FDT_BEGIN_NODE:
+			if (depth)
+				(*depth)++;
+			break;
+
+		case FDT_END_NODE:
+			if (depth && ((--(*depth)) < 0))
+				return nextoffset;
+			break;
+
+		case FDT_END:
+			if ((nextoffset >= 0)
+			    || ((nextoffset == -FDT_ERR_TRUNCATED) && !depth))
+				return -FDT_ERR_NOTFOUND;
+			else
+				return nextoffset;
+		}
+	} while (tag != FDT_BEGIN_NODE);
+
+	return offset;
+}
+
+const char *_fdt_find_string(const char *strtab, int tabsize, const char *s)
+{
+	int len = strlen(s) + 1;
+	const char *last = strtab + tabsize - len;
+	const char *p;
+
+	for (p = strtab; p <= last; p++)
+		if (memcmp(p, s, len) == 0)
+			return p;
+	return NULL;
+}
+
+int fdt_move(const void *fdt, void *buf, int bufsize)
+{
+	FDT_CHECK_HEADER(fdt);
+
+	if (fdt_totalsize(fdt) > bufsize)
+		return -FDT_ERR_NOSPACE;
+
+	memmove(buf, fdt, fdt_totalsize(fdt));
+	return 0;
+}
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/fdt.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/fdt.h	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,60 @@
+#ifndef _FDT_H
+#define _FDT_H
+
+#ifndef __ASSEMBLY__
+
+struct fdt_header {
+	uint32_t magic;			 /* magic word FDT_MAGIC */
+	uint32_t totalsize;		 /* total size of DT block */
+	uint32_t off_dt_struct;		 /* offset to structure */
+	uint32_t off_dt_strings;	 /* offset to strings */
+	uint32_t off_mem_rsvmap;	 /* offset to memory reserve map */
+	uint32_t version;		 /* format version */
+	uint32_t last_comp_version;	 /* last compatible version */
+
+	/* version 2 fields below */
+	uint32_t boot_cpuid_phys;	 /* Which physical CPU id we're
+					    booting on */
+	/* version 3 fields below */
+	uint32_t size_dt_strings;	 /* size of the strings block */
+
+	/* version 17 fields below */
+	uint32_t size_dt_struct;	 /* size of the structure block */
+};
+
+struct fdt_reserve_entry {
+	uint64_t address;
+	uint64_t size;
+};
+
+struct fdt_node_header {
+	uint32_t tag;
+	char name[0];
+};
+
+struct fdt_property {
+	uint32_t tag;
+	uint32_t len;
+	uint32_t nameoff;
+	char data[0];
+};
+
+#endif /* !__ASSEMBLY */
+
+#define FDT_MAGIC	0xd00dfeed	/* 4: version, 4: total size */
+#define FDT_TAGSIZE	sizeof(uint32_t)
+
+#define FDT_BEGIN_NODE	0x1		/* Start node: full name */
+#define FDT_END_NODE	0x2		/* End node */
+#define FDT_PROP	0x3		/* Property: name off,
+					   size, content */
+#define FDT_NOP		0x4		/* nop */
+#define FDT_END		0x9
+
+#define FDT_V1_SIZE	(7*sizeof(uint32_t))
+#define FDT_V2_SIZE	(FDT_V1_SIZE + sizeof(uint32_t))
+#define FDT_V3_SIZE	(FDT_V2_SIZE + sizeof(uint32_t))
+#define FDT_V16_SIZE	FDT_V3_SIZE
+#define FDT_V17_SIZE	(FDT_V16_SIZE + sizeof(uint32_t))
+
+#endif /* _FDT_H */
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/fdt_ro.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/fdt_ro.c	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,574 @@
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ *
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ *     You should have received a copy of the GNU General Public
+ *     License along with this library; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ *  b) Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *     1. Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *     2. Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "libfdt_env.h"
+
+#include <fdt.h>
+#include <libfdt.h>
+
+#include "libfdt_internal.h"
+
+static int _fdt_nodename_eq(const void *fdt, int offset,
+			    const char *s, int len)
+{
+	const char *p = fdt_offset_ptr(fdt, offset + FDT_TAGSIZE, len+1);
+
+	if (! p)
+		/* short match */
+		return 0;
+
+	if (memcmp(p, s, len) != 0)
+		return 0;
+
+	if (p[len] == '\0')
+		return 1;
+	else if (!memchr(s, '@', len) && (p[len] == '@'))
+		return 1;
+	else
+		return 0;
+}
+
+const char *fdt_string(const void *fdt, int stroffset)
+{
+	return (const char *)fdt + fdt_off_dt_strings(fdt) + stroffset;
+}
+
+static int _fdt_string_eq(const void *fdt, int stroffset,
+			  const char *s, int len)
+{
+	const char *p = fdt_string(fdt, stroffset);
+
+	return (strlen(p) == len) && (memcmp(p, s, len) == 0);
+}
+
+int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size)
+{
+	FDT_CHECK_HEADER(fdt);
+	*address = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->address);
+	*size = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->size);
+	return 0;
+}
+
+int fdt_num_mem_rsv(const void *fdt)
+{
+	int i = 0;
+
+	while (fdt64_to_cpu(_fdt_mem_rsv(fdt, i)->size) != 0)
+		i++;
+	return i;
+}
+
+static int _nextprop(const void *fdt, int offset)
+{
+	uint32_t tag;
+	int nextoffset;
+
+	do {
+		tag = fdt_next_tag(fdt, offset, &nextoffset);
+
+		switch (tag) {
+		case FDT_END:
+			if (nextoffset >= 0)
+				return -FDT_ERR_BADSTRUCTURE;
+			else
+				return nextoffset;
+
+		case FDT_PROP:
+			return offset;
+		}
+		offset = nextoffset;
+	} while (tag == FDT_NOP);
+
+	return -FDT_ERR_NOTFOUND;
+}
+
+int fdt_subnode_offset_namelen(const void *fdt, int offset,
+			       const char *name, int namelen)
+{
+	int depth;
+
+	FDT_CHECK_HEADER(fdt);
+
+	for (depth = 0;
+	     (offset >= 0) && (depth >= 0);
+	     offset = fdt_next_node(fdt, offset, &depth))
+		if ((depth == 1)
+		    && _fdt_nodename_eq(fdt, offset, name, namelen))
+			return offset;
+
+	if (depth < 0)
+		return -FDT_ERR_NOTFOUND;
+	return offset; /* error */
+}
+
+int fdt_subnode_offset(const void *fdt, int parentoffset,
+		       const char *name)
+{
+	return fdt_subnode_offset_namelen(fdt, parentoffset, name, strlen(name));
+}
+
+int fdt_path_offset(const void *fdt, const char *path)
+{
+	const char *end = path + strlen(path);
+	const char *p = path;
+	int offset = 0;
+
+	FDT_CHECK_HEADER(fdt);
+
+	/* see if we have an alias */
+	if (*path != '/') {
+		const char *q = strchr(path, '/');
+
+		if (!q)
+			q = end;
+
+		p = fdt_get_alias_namelen(fdt, p, q - p);
+		if (!p)
+			return -FDT_ERR_BADPATH;
+		offset = fdt_path_offset(fdt, p);
+
+		p = q;
+	}
+
+	while (*p) {
+		const char *q;
+
+		while (*p == '/')
+			p++;
+		if (! *p)
+			return offset;
+		q = strchr(p, '/');
+		if (! q)
+			q = end;
+
+		offset = fdt_subnode_offset_namelen(fdt, offset, p, q-p);
+		if (offset < 0)
+			return offset;
+
+		p = q;
+	}
+
+	return offset;
+}
+
+const char *fdt_get_name(const void *fdt, int nodeoffset, int *len)
+{
+	const struct fdt_node_header *nh = _fdt_offset_ptr(fdt, nodeoffset);
+	int err;
+
+	if (((err = fdt_check_header(fdt)) != 0)
+	    || ((err = _fdt_check_node_offset(fdt, nodeoffset)) < 0))
+			goto fail;
+
+	if (len)
+		*len = strlen(nh->name);
+
+	return nh->name;
+
+ fail:
+	if (len)
+		*len = err;
+	return NULL;
+}
+
+int fdt_first_property_offset(const void *fdt, int nodeoffset)
+{
+	int offset;
+
+	if ((offset = _fdt_check_node_offset(fdt, nodeoffset)) < 0)
+		return offset;
+
+	return _nextprop(fdt, offset);
+}
+
+int fdt_next_property_offset(const void *fdt, int offset)
+{
+	if ((offset = _fdt_check_prop_offset(fdt, offset)) < 0)
+		return offset;
+
+	return _nextprop(fdt, offset);
+}
+
+const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
+						      int offset,
+						      int *lenp)
+{
+	int err;
+	const struct fdt_property *prop;
+
+	if ((err = _fdt_check_prop_offset(fdt, offset)) < 0) {
+		if (lenp)
+			*lenp = err;
+		return NULL;
+	}
+
+	prop = _fdt_offset_ptr(fdt, offset);
+
+	if (lenp)
+		*lenp = fdt32_to_cpu(prop->len);
+
+	return prop;
+}
+
+const struct fdt_property *fdt_get_property_namelen(const void *fdt,
+						    int offset,
+						    const char *name,
+						    int namelen, int *lenp)
+{
+	for (offset = fdt_first_property_offset(fdt, offset);
+	     (offset >= 0);
+	     (offset = fdt_next_property_offset(fdt, offset))) {
+		const struct fdt_property *prop;
+
+		if (!(prop = fdt_get_property_by_offset(fdt, offset, lenp))) {
+			offset = -FDT_ERR_INTERNAL;
+			break;
+		}
+		if (_fdt_string_eq(fdt, fdt32_to_cpu(prop->nameoff),
+				   name, namelen))
+			return prop;
+	}
+
+	if (lenp)
+		*lenp = offset;
+	return NULL;
+}
+
+const struct fdt_property *fdt_get_property(const void *fdt,
+					    int nodeoffset,
+					    const char *name, int *lenp)
+{
+	return fdt_get_property_namelen(fdt, nodeoffset, name,
+					strlen(name), lenp);
+}
+
+const void *fdt_getprop_namelen(const void *fdt, int nodeoffset,
+				const char *name, int namelen, int *lenp)
+{
+	const struct fdt_property *prop;
+
+	prop = fdt_get_property_namelen(fdt, nodeoffset, name, namelen, lenp);
+	if (! prop)
+		return NULL;
+
+	return prop->data;
+}
+
+const void *fdt_getprop_by_offset(const void *fdt, int offset,
+				  const char **namep, int *lenp)
+{
+	const struct fdt_property *prop;
+
+	prop = fdt_get_property_by_offset(fdt, offset, lenp);
+	if (!prop)
+		return NULL;
+	if (namep)
+		*namep = fdt_string(fdt, fdt32_to_cpu(prop->nameoff));
+	return prop->data;
+}
+
+const void *fdt_getprop(const void *fdt, int nodeoffset,
+			const char *name, int *lenp)
+{
+	return fdt_getprop_namelen(fdt, nodeoffset, name, strlen(name), lenp);
+}
+
+uint32_t fdt_get_phandle(const void *fdt, int nodeoffset)
+{
+	const uint32_t *php;
+	int len;
+
+	/* FIXME: This is a bit sub-optimal, since we potentially scan
+	 * over all the properties twice. */
+	php = fdt_getprop(fdt, nodeoffset, "phandle", &len);
+	if (!php || (len != sizeof(*php))) {
+		php = fdt_getprop(fdt, nodeoffset, "linux,phandle", &len);
+		if (!php || (len != sizeof(*php)))
+			return 0;
+	}
+
+	return fdt32_to_cpu(*php);
+}
+
+const char *fdt_get_alias_namelen(const void *fdt,
+				  const char *name, int namelen)
+{
+	int aliasoffset;
+
+	aliasoffset = fdt_path_offset(fdt, "/aliases");
+	if (aliasoffset < 0)
+		return NULL;
+
+	return fdt_getprop_namelen(fdt, aliasoffset, name, namelen, NULL);
+}
+
+const char *fdt_get_alias(const void *fdt, const char *name)
+{
+	return fdt_get_alias_namelen(fdt, name, strlen(name));
+}
+
+int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen)
+{
+	int pdepth = 0, p = 0;
+	int offset, depth, namelen;
+	const char *name;
+
+	FDT_CHECK_HEADER(fdt);
+
+	if (buflen < 2)
+		return -FDT_ERR_NOSPACE;
+
+	for (offset = 0, depth = 0;
+	     (offset >= 0) && (offset <= nodeoffset);
+	     offset = fdt_next_node(fdt, offset, &depth)) {
+		while (pdepth > depth) {
+			do {
+				p--;
+			} while (buf[p-1] != '/');
+			pdepth--;
+		}
+
+		if (pdepth >= depth) {
+			name = fdt_get_name(fdt, offset, &namelen);
+			if (!name)
+				return namelen;
+			if ((p + namelen + 1) <= buflen) {
+				memcpy(buf + p, name, namelen);
+				p += namelen;
+				buf[p++] = '/';
+				pdepth++;
+			}
+		}
+
+		if (offset == nodeoffset) {
+			if (pdepth < (depth + 1))
+				return -FDT_ERR_NOSPACE;
+
+			if (p > 1) /* special case so that root path is "/", not "" */
+				p--;
+			buf[p] = '\0';
+			return 0;
+		}
+	}
+
+	if ((offset == -FDT_ERR_NOTFOUND) || (offset >= 0))
+		return -FDT_ERR_BADOFFSET;
+	else if (offset == -FDT_ERR_BADOFFSET)
+		return -FDT_ERR_BADSTRUCTURE;
+
+	return offset; /* error from fdt_next_node() */
+}
+
+int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset,
+				 int supernodedepth, int *nodedepth)
+{
+	int offset, depth;
+	int supernodeoffset = -FDT_ERR_INTERNAL;
+
+	FDT_CHECK_HEADER(fdt);
+
+	if (supernodedepth < 0)
+		return -FDT_ERR_NOTFOUND;
+
+	for (offset = 0, depth = 0;
+	     (offset >= 0) && (offset <= nodeoffset);
+	     offset = fdt_next_node(fdt, offset, &depth)) {
+		if (depth == supernodedepth)
+			supernodeoffset = offset;
+
+		if (offset == nodeoffset) {
+			if (nodedepth)
+				*nodedepth = depth;
+
+			if (supernodedepth > depth)
+				return -FDT_ERR_NOTFOUND;
+			else
+				return supernodeoffset;
+		}
+	}
+
+	if ((offset == -FDT_ERR_NOTFOUND) || (offset >= 0))
+		return -FDT_ERR_BADOFFSET;
+	else if (offset == -FDT_ERR_BADOFFSET)
+		return -FDT_ERR_BADSTRUCTURE;
+
+	return offset; /* error from fdt_next_node() */
+}
+
+int fdt_node_depth(const void *fdt, int nodeoffset)
+{
+	int nodedepth;
+	int err;
+
+	err = fdt_supernode_atdepth_offset(fdt, nodeoffset, 0, &nodedepth);
+	if (err)
+		return (err < 0) ? err : -FDT_ERR_INTERNAL;
+	return nodedepth;
+}
+
+int fdt_parent_offset(const void *fdt, int nodeoffset)
+{
+	int nodedepth = fdt_node_depth(fdt, nodeoffset);
+
+	if (nodedepth < 0)
+		return nodedepth;
+	return fdt_supernode_atdepth_offset(fdt, nodeoffset,
+					    nodedepth - 1, NULL);
+}
+
+int fdt_node_offset_by_prop_value(const void *fdt, int startoffset,
+				  const char *propname,
+				  const void *propval, int proplen)
+{
+	int offset;
+	const void *val;
+	int len;
+
+	FDT_CHECK_HEADER(fdt);
+
+	/* FIXME: The algorithm here is pretty horrible: we scan each
+	 * property of a node in fdt_getprop(), then if that didn't
+	 * find what we want, we scan over them again making our way
+	 * to the next node.  Still it's the easiest to implement
+	 * approach; performance can come later. */
+	for (offset = fdt_next_node(fdt, startoffset, NULL);
+	     offset >= 0;
+	     offset = fdt_next_node(fdt, offset, NULL)) {
+		val = fdt_getprop(fdt, offset, propname, &len);
+		if (val && (len == proplen)
+		    && (memcmp(val, propval, len) == 0))
+			return offset;
+	}
+
+	return offset; /* error from fdt_next_node() */
+}
+
+int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle)
+{
+	int offset;
+
+	if ((phandle == 0) || (phandle == -1))
+		return -FDT_ERR_BADPHANDLE;
+
+	FDT_CHECK_HEADER(fdt);
+
+	/* FIXME: The algorithm here is pretty horrible: we
+	 * potentially scan each property of a node in
+	 * fdt_get_phandle(), then if that didn't find what
+	 * we want, we scan over them again making our way to the next
+	 * node.  Still it's the easiest to implement approach;
+	 * performance can come later. */
+	for (offset = fdt_next_node(fdt, -1, NULL);
+	     offset >= 0;
+	     offset = fdt_next_node(fdt, offset, NULL)) {
+		if (fdt_get_phandle(fdt, offset) == phandle)
+			return offset;
+	}
+
+	return offset; /* error from fdt_next_node() */
+}
+
+static int _fdt_stringlist_contains(const char *strlist, int listlen,
+				    const char *str)
+{
+	int len = strlen(str);
+	const char *p;
+
+	while (listlen >= len) {
+		if (memcmp(str, strlist, len+1) == 0)
+			return 1;
+		p = memchr(strlist, '\0', listlen);
+		if (!p)
+			return 0; /* malformed strlist.. */
+		listlen -= (p-strlist) + 1;
+		strlist = p + 1;
+	}
+	return 0;
+}
+
+int fdt_node_check_compatible(const void *fdt, int nodeoffset,
+			      const char *compatible)
+{
+	const void *prop;
+	int len;
+
+	prop = fdt_getprop(fdt, nodeoffset, "compatible", &len);
+	if (!prop)
+		return len;
+	if (_fdt_stringlist_contains(prop, len, compatible))
+		return 0;
+	else
+		return 1;
+}
+
+int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
+				  const char *compatible)
+{
+	int offset, err;
+
+	FDT_CHECK_HEADER(fdt);
+
+	/* FIXME: The algorithm here is pretty horrible: we scan each
+	 * property of a node in fdt_node_check_compatible(), then if
+	 * that didn't find what we want, we scan over them again
+	 * making our way to the next node.  Still it's the easiest to
+	 * implement approach; performance can come later. */
+	for (offset = fdt_next_node(fdt, startoffset, NULL);
+	     offset >= 0;
+	     offset = fdt_next_node(fdt, offset, NULL)) {
+		err = fdt_node_check_compatible(fdt, offset, compatible);
+		if ((err < 0) && (err != -FDT_ERR_NOTFOUND))
+			return err;
+		else if (err == 0)
+			return offset;
+	}
+
+	return offset; /* error from fdt_next_node() */
+}
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/fdt_rw.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/fdt_rw.c	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,465 @@
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ *
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ *     You should have received a copy of the GNU General Public
+ *     License along with this library; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ *  b) Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *     1. Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *     2. Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "libfdt_env.h"
+
+#include <fdt.h>
+#include <libfdt.h>
+
+#include "libfdt_internal.h"
+
+static int _fdt_blocks_misordered(const void *fdt,
+			      int mem_rsv_size, int struct_size)
+{
+	return (fdt_off_mem_rsvmap(fdt) < FDT_ALIGN(sizeof(struct fdt_header), 8))
+		|| (fdt_off_dt_struct(fdt) <
+		    (fdt_off_mem_rsvmap(fdt) + mem_rsv_size))
+		|| (fdt_off_dt_strings(fdt) <
+		    (fdt_off_dt_struct(fdt) + struct_size))
+		|| (fdt_totalsize(fdt) <
+		    (fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt)));
+}
+
+static int _fdt_rw_check_header(void *fdt)
+{
+	FDT_CHECK_HEADER(fdt);
+
+	if (fdt_version(fdt) < 17)
+		return -FDT_ERR_BADVERSION;
+	if (_fdt_blocks_misordered(fdt, sizeof(struct fdt_reserve_entry),
+				   fdt_size_dt_struct(fdt)))
+		return -FDT_ERR_BADLAYOUT;
+	if (fdt_version(fdt) > 17)
+		fdt_set_version(fdt, 17);
+
+	return 0;
+}
+
+#define FDT_RW_CHECK_HEADER(fdt) \
+	{ \
+		int err; \
+		if ((err = _fdt_rw_check_header(fdt)) != 0) \
+			return err; \
+	}
+
+static inline int _fdt_data_size(void *fdt)
+{
+	return fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt);
+}
+
+static int _fdt_splice(void *fdt, void *splicepoint, int oldlen, int newlen)
+{
+	char *p = splicepoint;
+	char *end = (char *)fdt + _fdt_data_size(fdt);
+
+	if (((p + oldlen) < p) || ((p + oldlen) > end))
+		return -FDT_ERR_BADOFFSET;
+	if ((end - oldlen + newlen) > ((char *)fdt + fdt_totalsize(fdt)))
+		return -FDT_ERR_NOSPACE;
+	memmove(p + newlen, p + oldlen, end - p - oldlen);
+	return 0;
+}
+
+static int _fdt_splice_mem_rsv(void *fdt, struct fdt_reserve_entry *p,
+			       int oldn, int newn)
+{
+	int delta = (newn - oldn) * sizeof(*p);
+	int err;
+	err = _fdt_splice(fdt, p, oldn * sizeof(*p), newn * sizeof(*p));
+	if (err)
+		return err;
+	fdt_set_off_dt_struct(fdt, fdt_off_dt_struct(fdt) + delta);
+	fdt_set_off_dt_strings(fdt, fdt_off_dt_strings(fdt) + delta);
+	return 0;
+}
+
+static int _fdt_splice_struct(void *fdt, void *p,
+			      int oldlen, int newlen)
+{
+	int delta = newlen - oldlen;
+	int err;
+
+	if ((err = _fdt_splice(fdt, p, oldlen, newlen)))
+		return err;
+
+	fdt_set_size_dt_struct(fdt, fdt_size_dt_struct(fdt) + delta);
+	fdt_set_off_dt_strings(fdt, fdt_off_dt_strings(fdt) + delta);
+	return 0;
+}
+
+static int _fdt_splice_string(void *fdt, int newlen)
+{
+	void *p = (char *)fdt
+		+ fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt);
+	int err;
+
+	if ((err = _fdt_splice(fdt, p, 0, newlen)))
+		return err;
+
+	fdt_set_size_dt_strings(fdt, fdt_size_dt_strings(fdt) + newlen);
+	return 0;
+}
+
+static int _fdt_find_add_string(void *fdt, const char *s)
+{
+	char *strtab = (char *)fdt + fdt_off_dt_strings(fdt);
+	const char *p;
+	char *new;
+	int len = strlen(s) + 1;
+	int err;
+
+	p = _fdt_find_string(strtab, fdt_size_dt_strings(fdt), s);
+	if (p)
+		/* found it */
+		return (p - strtab);
+
+	new = strtab + fdt_size_dt_strings(fdt);
+	err = _fdt_splice_string(fdt, len);
+	if (err)
+		return err;
+
+	memcpy(new, s, len);
+	return (new - strtab);
+}
+
+int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size)
+{
+	struct fdt_reserve_entry *re;
+	int err;
+
+	FDT_RW_CHECK_HEADER(fdt);
+
+	re = _fdt_mem_rsv_w(fdt, fdt_num_mem_rsv(fdt));
+	err = _fdt_splice_mem_rsv(fdt, re, 0, 1);
+	if (err)
+		return err;
+
+	re->address = cpu_to_fdt64(address);
+	re->size = cpu_to_fdt64(size);
+	return 0;
+}
+
+int fdt_del_mem_rsv(void *fdt, int n)
+{
+	struct fdt_reserve_entry *re = _fdt_mem_rsv_w(fdt, n);
+	int err;
+
+	FDT_RW_CHECK_HEADER(fdt);
+
+	if (n >= fdt_num_mem_rsv(fdt))
+		return -FDT_ERR_NOTFOUND;
+
+	err = _fdt_splice_mem_rsv(fdt, re, 1, 0);
+	if (err)
+		return err;
+	return 0;
+}
+
+static int _fdt_resize_property(void *fdt, int nodeoffset, const char *name,
+				int len, struct fdt_property **prop)
+{
+	int oldlen;
+	int err;
+
+	*prop = fdt_get_property_w(fdt, nodeoffset, name, &oldlen);
+	if (! (*prop))
+		return oldlen;
+
+	if ((err = _fdt_splice_struct(fdt, (*prop)->data, FDT_TAGALIGN(oldlen),
+				      FDT_TAGALIGN(len))))
+		return err;
+
+	(*prop)->len = cpu_to_fdt32(len);
+	return 0;
+}
+
+static int _fdt_add_property(void *fdt, int nodeoffset, const char *name,
+			     int len, struct fdt_property **prop)
+{
+	int proplen;
+	int nextoffset;
+	int namestroff;
+	int err;
+
+	if ((nextoffset = _fdt_check_node_offset(fdt, nodeoffset)) < 0)
+		return nextoffset;
+
+	namestroff = _fdt_find_add_string(fdt, name);
+	if (namestroff < 0)
+		return namestroff;
+
+	*prop = _fdt_offset_ptr_w(fdt, nextoffset);
+	proplen = sizeof(**prop) + FDT_TAGALIGN(len);
+
+	err = _fdt_splice_struct(fdt, *prop, 0, proplen);
+	if (err)
+		return err;
+
+	(*prop)->tag = cpu_to_fdt32(FDT_PROP);
+	(*prop)->nameoff = cpu_to_fdt32(namestroff);
+	(*prop)->len = cpu_to_fdt32(len);
+	return 0;
+}
+
+int fdt_set_name(void *fdt, int nodeoffset, const char *name)
+{
+	char *namep;
+	int oldlen, newlen;
+	int err;
+
+	FDT_RW_CHECK_HEADER(fdt);
+
+	namep = (char *)(uintptr_t)fdt_get_name(fdt, nodeoffset, &oldlen);
+	if (!namep)
+		return oldlen;
+
+	newlen = strlen(name);
+
+	err = _fdt_splice_struct(fdt, namep, FDT_TAGALIGN(oldlen+1),
+				 FDT_TAGALIGN(newlen+1));
+	if (err)
+		return err;
+
+	memcpy(namep, name, newlen+1);
+	return 0;
+}
+
+int fdt_setprop(void *fdt, int nodeoffset, const char *name,
+		const void *val, int len)
+{
+	struct fdt_property *prop;
+	int err;
+
+	FDT_RW_CHECK_HEADER(fdt);
+
+	err = _fdt_resize_property(fdt, nodeoffset, name, len, &prop);
+	if (err == -FDT_ERR_NOTFOUND)
+		err = _fdt_add_property(fdt, nodeoffset, name, len, &prop);
+	if (err)
+		return err;
+
+	memcpy(prop->data, val, len);
+	return 0;
+}
+
+int fdt_delprop(void *fdt, int nodeoffset, const char *name)
+{
+	struct fdt_property *prop;
+	int len, proplen;
+
+	FDT_RW_CHECK_HEADER(fdt);
+
+	prop = fdt_get_property_w(fdt, nodeoffset, name, &len);
+	if (! prop)
+		return len;
+
+	proplen = sizeof(*prop) + FDT_TAGALIGN(len);
+	return _fdt_splice_struct(fdt, prop, proplen, 0);
+}
+
+int fdt_add_subnode_namelen(void *fdt, int parentoffset,
+			    const char *name, int namelen)
+{
+	struct fdt_node_header *nh;
+	int offset, nextoffset;
+	int nodelen;
+	int err;
+	uint32_t tag;
+	uint32_t *endtag;
+
+	FDT_RW_CHECK_HEADER(fdt);
+
+	offset = fdt_subnode_offset_namelen(fdt, parentoffset, name, namelen);
+	if (offset >= 0)
+		return -FDT_ERR_EXISTS;
+	else if (offset != -FDT_ERR_NOTFOUND)
+		return offset;
+
+	/* Try to place the new node after the parent's properties */
+	fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */
+	do {
+		offset = nextoffset;
+		tag = fdt_next_tag(fdt, offset, &nextoffset);
+	} while ((tag == FDT_PROP) || (tag == FDT_NOP));
+
+	nh = _fdt_offset_ptr_w(fdt, offset);
+	nodelen = sizeof(*nh) + FDT_TAGALIGN(namelen+1) + FDT_TAGSIZE;
+
+	err = _fdt_splice_struct(fdt, nh, 0, nodelen);
+	if (err)
+		return err;
+
+	nh->tag = cpu_to_fdt32(FDT_BEGIN_NODE);
+	memset(nh->name, 0, FDT_TAGALIGN(namelen+1));
+	memcpy(nh->name, name, namelen);
+	endtag = (uint32_t *)((char *)nh + nodelen - FDT_TAGSIZE);
+	*endtag = cpu_to_fdt32(FDT_END_NODE);
+
+	return offset;
+}
+
+int fdt_add_subnode(void *fdt, int parentoffset, const char *name)
+{
+	return fdt_add_subnode_namelen(fdt, parentoffset, name, strlen(name));
+}
+
+int fdt_del_node(void *fdt, int nodeoffset)
+{
+	int endoffset;
+
+	FDT_RW_CHECK_HEADER(fdt);
+
+	endoffset = _fdt_node_end_offset(fdt, nodeoffset);
+	if (endoffset < 0)
+		return endoffset;
+
+	return _fdt_splice_struct(fdt, _fdt_offset_ptr_w(fdt, nodeoffset),
+				  endoffset - nodeoffset, 0);
+}
+
+static void _fdt_packblocks(const char *old, char *new,
+			    int mem_rsv_size, int struct_size)
+{
+	int mem_rsv_off, struct_off, strings_off;
+
+	mem_rsv_off = FDT_ALIGN(sizeof(struct fdt_header), 8);
+	struct_off = mem_rsv_off + mem_rsv_size;
+	strings_off = struct_off + struct_size;
+
+	memmove(new + mem_rsv_off, old + fdt_off_mem_rsvmap(old), mem_rsv_size);
+	fdt_set_off_mem_rsvmap(new, mem_rsv_off);
+
+	memmove(new + struct_off, old + fdt_off_dt_struct(old), struct_size);
+	fdt_set_off_dt_struct(new, struct_off);
+	fdt_set_size_dt_struct(new, struct_size);
+
+	memmove(new + strings_off, old + fdt_off_dt_strings(old),
+		fdt_size_dt_strings(old));
+	fdt_set_off_dt_strings(new, strings_off);
+	fdt_set_size_dt_strings(new, fdt_size_dt_strings(old));
+}
+
+int fdt_open_into(const void *fdt, void *buf, int bufsize)
+{
+	int err;
+	int mem_rsv_size, struct_size;
+	int newsize;
+	const char *fdtstart = fdt;
+	const char *fdtend = fdtstart + fdt_totalsize(fdt);
+	char *tmp;
+
+	FDT_CHECK_HEADER(fdt);
+
+	mem_rsv_size = (fdt_num_mem_rsv(fdt)+1)
+		* sizeof(struct fdt_reserve_entry);
+
+	if (fdt_version(fdt) >= 17) {
+		struct_size = fdt_size_dt_struct(fdt);
+	} else {
+		struct_size = 0;
+		while (fdt_next_tag(fdt, struct_size, &struct_size) != FDT_END)
+			;
+		if (struct_size < 0)
+			return struct_size;
+	}
+
+	if (!_fdt_blocks_misordered(fdt, mem_rsv_size, struct_size)) {
+		/* no further work necessary */
+		err = fdt_move(fdt, buf, bufsize);
+		if (err)
+			return err;
+		fdt_set_version(buf, 17);
+		fdt_set_size_dt_struct(buf, struct_size);
+		fdt_set_totalsize(buf, bufsize);
+		return 0;
+	}
+
+	/* Need to reorder */
+	newsize = FDT_ALIGN(sizeof(struct fdt_header), 8) + mem_rsv_size
+		+ struct_size + fdt_size_dt_strings(fdt);
+
+	if (bufsize < newsize)
+		return -FDT_ERR_NOSPACE;
+
+	/* First attempt to build converted tree at beginning of buffer */
+	tmp = buf;
+	/* But if that overlaps with the old tree... */
+	if (((tmp + newsize) > fdtstart) && (tmp < fdtend)) {
+		/* Try right after the old tree instead */
+		tmp = (char *)(uintptr_t)fdtend;
+		if ((tmp + newsize) > ((char *)buf + bufsize))
+			return -FDT_ERR_NOSPACE;
+	}
+
+	_fdt_packblocks(fdt, tmp, mem_rsv_size, struct_size);
+	memmove(buf, tmp, newsize);
+
+	fdt_set_magic(buf, FDT_MAGIC);
+	fdt_set_totalsize(buf, bufsize);
+	fdt_set_version(buf, 17);
+	fdt_set_last_comp_version(buf, 16);
+	fdt_set_boot_cpuid_phys(buf, fdt_boot_cpuid_phys(fdt));
+
+	return 0;
+}
+
+int fdt_pack(void *fdt)
+{
+	int mem_rsv_size;
+
+	FDT_RW_CHECK_HEADER(fdt);
+
+	mem_rsv_size = (fdt_num_mem_rsv(fdt)+1)
+		* sizeof(struct fdt_reserve_entry);
+	_fdt_packblocks(fdt, fdt, mem_rsv_size, fdt_size_dt_struct(fdt));
+	fdt_set_totalsize(fdt, _fdt_data_size(fdt));
+
+	return 0;
+}
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/fdt_strerror.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/fdt_strerror.c	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,96 @@
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ *
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ *     You should have received a copy of the GNU General Public
+ *     License along with this library; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ *  b) Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *     1. Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *     2. Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "libfdt_env.h"
+
+#include <fdt.h>
+#include <libfdt.h>
+
+#include "libfdt_internal.h"
+
+struct fdt_errtabent {
+	const char *str;
+};
+
+#define FDT_ERRTABENT(val) \
+	[(val)] = { .str = #val, }
+
+static struct fdt_errtabent fdt_errtable[] = {
+	FDT_ERRTABENT(FDT_ERR_NOTFOUND),
+	FDT_ERRTABENT(FDT_ERR_EXISTS),
+	FDT_ERRTABENT(FDT_ERR_NOSPACE),
+
+	FDT_ERRTABENT(FDT_ERR_BADOFFSET),
+	FDT_ERRTABENT(FDT_ERR_BADPATH),
+	FDT_ERRTABENT(FDT_ERR_BADSTATE),
+
+	FDT_ERRTABENT(FDT_ERR_TRUNCATED),
+	FDT_ERRTABENT(FDT_ERR_BADMAGIC),
+	FDT_ERRTABENT(FDT_ERR_BADVERSION),
+	FDT_ERRTABENT(FDT_ERR_BADSTRUCTURE),
+	FDT_ERRTABENT(FDT_ERR_BADLAYOUT),
+};
+#define FDT_ERRTABSIZE	(sizeof(fdt_errtable) / sizeof(fdt_errtable[0]))
+
+const char *fdt_strerror(int errval)
+{
+	if (errval > 0)
+		return "<valid offset/length>";
+	else if (errval == 0)
+		return "<no error>";
+	else if (errval > -FDT_ERRTABSIZE) {
+		const char *s = fdt_errtable[-errval].str;
+
+		if (s)
+			return s;
+	}
+
+	return "<unknown error>";
+}
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/fdt_sw.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/fdt_sw.c	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,256 @@
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ *
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ *     You should have received a copy of the GNU General Public
+ *     License along with this library; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ *  b) Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *     1. Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *     2. Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "libfdt_env.h"
+
+#include <fdt.h>
+#include <libfdt.h>
+
+#include "libfdt_internal.h"
+
+static int _fdt_sw_check_header(void *fdt)
+{
+	if (fdt_magic(fdt) != FDT_SW_MAGIC)
+		return -FDT_ERR_BADMAGIC;
+	/* FIXME: should check more details about the header state */
+	return 0;
+}
+
+#define FDT_SW_CHECK_HEADER(fdt) \
+	{ \
+		int err; \
+		if ((err = _fdt_sw_check_header(fdt)) != 0) \
+			return err; \
+	}
+
+static void *_fdt_grab_space(void *fdt, size_t len)
+{
+	int offset = fdt_size_dt_struct(fdt);
+	int spaceleft;
+
+	spaceleft = fdt_totalsize(fdt) - fdt_off_dt_struct(fdt)
+		- fdt_size_dt_strings(fdt);
+
+	if ((offset + len < offset) || (offset + len > spaceleft))
+		return NULL;
+
+	fdt_set_size_dt_struct(fdt, offset + len);
+	return _fdt_offset_ptr_w(fdt, offset);
+}
+
+int fdt_create(void *buf, int bufsize)
+{
+	void *fdt = buf;
+
+	if (bufsize < sizeof(struct fdt_header))
+		return -FDT_ERR_NOSPACE;
+
+	memset(buf, 0, bufsize);
+
+	fdt_set_magic(fdt, FDT_SW_MAGIC);
+	fdt_set_version(fdt, FDT_LAST_SUPPORTED_VERSION);
+	fdt_set_last_comp_version(fdt, FDT_FIRST_SUPPORTED_VERSION);
+	fdt_set_totalsize(fdt,  bufsize);
+
+	fdt_set_off_mem_rsvmap(fdt, FDT_ALIGN(sizeof(struct fdt_header),
+					      sizeof(struct fdt_reserve_entry)));
+	fdt_set_off_dt_struct(fdt, fdt_off_mem_rsvmap(fdt));
+	fdt_set_off_dt_strings(fdt, bufsize);
+
+	return 0;
+}
+
+int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size)
+{
+	struct fdt_reserve_entry *re;
+	int offset;
+
+	FDT_SW_CHECK_HEADER(fdt);
+
+	if (fdt_size_dt_struct(fdt))
+		return -FDT_ERR_BADSTATE;
+
+	offset = fdt_off_dt_struct(fdt);
+	if ((offset + sizeof(*re)) > fdt_totalsize(fdt))
+		return -FDT_ERR_NOSPACE;
+
+	re = (struct fdt_reserve_entry *)((char *)fdt + offset);
+	re->address = cpu_to_fdt64(addr);
+	re->size = cpu_to_fdt64(size);
+
+	fdt_set_off_dt_struct(fdt, offset + sizeof(*re));
+
+	return 0;
+}
+
+int fdt_finish_reservemap(void *fdt)
+{
+	return fdt_add_reservemap_entry(fdt, 0, 0);
+}
+
+int fdt_begin_node(void *fdt, const char *name)
+{
+	struct fdt_node_header *nh;
+	int namelen = strlen(name) + 1;
+
+	FDT_SW_CHECK_HEADER(fdt);
+
+	nh = _fdt_grab_space(fdt, sizeof(*nh) + FDT_TAGALIGN(namelen));
+	if (! nh)
+		return -FDT_ERR_NOSPACE;
+
+	nh->tag = cpu_to_fdt32(FDT_BEGIN_NODE);
+	memcpy(nh->name, name, namelen);
+	return 0;
+}
+
+int fdt_end_node(void *fdt)
+{
+	uint32_t *en;
+
+	FDT_SW_CHECK_HEADER(fdt);
+
+	en = _fdt_grab_space(fdt, FDT_TAGSIZE);
+	if (! en)
+		return -FDT_ERR_NOSPACE;
+
+	*en = cpu_to_fdt32(FDT_END_NODE);
+	return 0;
+}
+
+static int _fdt_find_add_string(void *fdt, const char *s)
+{
+	char *strtab = (char *)fdt + fdt_totalsize(fdt);
+	const char *p;
+	int strtabsize = fdt_size_dt_strings(fdt);
+	int len = strlen(s) + 1;
+	int struct_top, offset;
+
+	p = _fdt_find_string(strtab - strtabsize, strtabsize, s);
+	if (p)
+		return p - strtab;
+
+	/* Add it */
+	offset = -strtabsize - len;
+	struct_top = fdt_off_dt_struct(fdt) + fdt_size_dt_struct(fdt);
+	if (fdt_totalsize(fdt) + offset < struct_top)
+		return 0; /* no more room :( */
+
+	memcpy(strtab + offset, s, len);
+	fdt_set_size_dt_strings(fdt, strtabsize + len);
+	return offset;
+}
+
+int fdt_property(void *fdt, const char *name, const void *val, int len)
+{
+	struct fdt_property *prop;
+	int nameoff;
+
+	FDT_SW_CHECK_HEADER(fdt);
+
+	nameoff = _fdt_find_add_string(fdt, name);
+	if (nameoff == 0)
+		return -FDT_ERR_NOSPACE;
+
+	prop = _fdt_grab_space(fdt, sizeof(*prop) + FDT_TAGALIGN(len));
+	if (! prop)
+		return -FDT_ERR_NOSPACE;
+
+	prop->tag = cpu_to_fdt32(FDT_PROP);
+	prop->nameoff = cpu_to_fdt32(nameoff);
+	prop->len = cpu_to_fdt32(len);
+	memcpy(prop->data, val, len);
+	return 0;
+}
+
+int fdt_finish(void *fdt)
+{
+	char *p = (char *)fdt;
+	uint32_t *end;
+	int oldstroffset, newstroffset;
+	uint32_t tag;
+	int offset, nextoffset;
+
+	FDT_SW_CHECK_HEADER(fdt);
+
+	/* Add terminator */
+	end = _fdt_grab_space(fdt, sizeof(*end));
+	if (! end)
+		return -FDT_ERR_NOSPACE;
+	*end = cpu_to_fdt32(FDT_END);
+
+	/* Relocate the string table */
+	oldstroffset = fdt_totalsize(fdt) - fdt_size_dt_strings(fdt);
+	newstroffset = fdt_off_dt_struct(fdt) + fdt_size_dt_struct(fdt);
+	memmove(p + newstroffset, p + oldstroffset, fdt_size_dt_strings(fdt));
+	fdt_set_off_dt_strings(fdt, newstroffset);
+
+	/* Walk the structure, correcting string offsets */
+	offset = 0;
+	while ((tag = fdt_next_tag(fdt, offset, &nextoffset)) != FDT_END) {
+		if (tag == FDT_PROP) {
+			struct fdt_property *prop =
+				_fdt_offset_ptr_w(fdt, offset);
+			int nameoff;
+
+			nameoff = fdt32_to_cpu(prop->nameoff);
+			nameoff += fdt_size_dt_strings(fdt);
+			prop->nameoff = cpu_to_fdt32(nameoff);
+		}
+		offset = nextoffset;
+	}
+	if (nextoffset < 0)
+		return nextoffset;
+
+	/* Finally, adjust the header */
+	fdt_set_totalsize(fdt, newstroffset + fdt_size_dt_strings(fdt));
+	fdt_set_magic(fdt, FDT_MAGIC);
+	return 0;
+}
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/fdt_wip.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/fdt_wip.c	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,118 @@
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ *
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ *     You should have received a copy of the GNU General Public
+ *     License along with this library; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ *  b) Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *     1. Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *     2. Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "libfdt_env.h"
+
+#include <fdt.h>
+#include <libfdt.h>
+
+#include "libfdt_internal.h"
+
+int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
+			const void *val, int len)
+{
+	void *propval;
+	int proplen;
+
+	propval = fdt_getprop_w(fdt, nodeoffset, name, &proplen);
+	if (! propval)
+		return proplen;
+
+	if (proplen != len)
+		return -FDT_ERR_NOSPACE;
+
+	memcpy(propval, val, len);
+	return 0;
+}
+
+static void _fdt_nop_region(void *start, int len)
+{
+	uint32_t *p;
+
+	for (p = start; (char *)p < ((char *)start + len); p++)
+		*p = cpu_to_fdt32(FDT_NOP);
+}
+
+int fdt_nop_property(void *fdt, int nodeoffset, const char *name)
+{
+	struct fdt_property *prop;
+	int len;
+
+	prop = fdt_get_property_w(fdt, nodeoffset, name, &len);
+	if (! prop)
+		return len;
+
+	_fdt_nop_region(prop, len + sizeof(*prop));
+
+	return 0;
+}
+
+int _fdt_node_end_offset(void *fdt, int offset)
+{
+	int depth = 0;
+
+	while ((offset >= 0) && (depth >= 0))
+		offset = fdt_next_node(fdt, offset, &depth);
+
+	return offset;
+}
+
+int fdt_nop_node(void *fdt, int nodeoffset)
+{
+	int endoffset;
+
+	endoffset = _fdt_node_end_offset(fdt, nodeoffset);
+	if (endoffset < 0)
+		return endoffset;
+
+	_fdt_nop_region(fdt_offset_ptr_w(fdt, nodeoffset, 0),
+			endoffset - nodeoffset);
+	return 0;
+}
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/libfdt.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/libfdt.h	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,1235 @@
+#ifndef _LIBFDT_H
+#define _LIBFDT_H
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ *
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ *     You should have received a copy of the GNU General Public
+ *     License along with this library; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ *  b) Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *     1. Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *     2. Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <libfdt_env.h>
+#include <fdt.h>
+
+#define FDT_FIRST_SUPPORTED_VERSION	0x10
+#define FDT_LAST_SUPPORTED_VERSION	0x11
+
+/* Error codes: informative error codes */
+#define FDT_ERR_NOTFOUND	1
+	/* FDT_ERR_NOTFOUND: The requested node or property does not exist */
+#define FDT_ERR_EXISTS		2
+	/* FDT_ERR_EXISTS: Attemped to create a node or property which
+	 * already exists */
+#define FDT_ERR_NOSPACE		3
+	/* FDT_ERR_NOSPACE: Operation needed to expand the device
+	 * tree, but its buffer did not have sufficient space to
+	 * contain the expanded tree. Use fdt_open_into() to move the
+	 * device tree to a buffer with more space. */
+
+/* Error codes: codes for bad parameters */
+#define FDT_ERR_BADOFFSET	4
+	/* FDT_ERR_BADOFFSET: Function was passed a structure block
+	 * offset which is out-of-bounds, or which points to an
+	 * unsuitable part of the structure for the operation. */
+#define FDT_ERR_BADPATH		5
+	/* FDT_ERR_BADPATH: Function was passed a badly formatted path
+	 * (e.g. missing a leading / for a function which requires an
+	 * absolute path) */
+#define FDT_ERR_BADPHANDLE	6
+	/* FDT_ERR_BADPHANDLE: Function was passed an invalid phandle
+	 * value.  phandle values of 0 and -1 are not permitted. */
+#define FDT_ERR_BADSTATE	7
+	/* FDT_ERR_BADSTATE: Function was passed an incomplete device
+	 * tree created by the sequential-write functions, which is
+	 * not sufficiently complete for the requested operation. */
+
+/* Error codes: codes for bad device tree blobs */
+#define FDT_ERR_TRUNCATED	8
+	/* FDT_ERR_TRUNCATED: Structure block of the given device tree
+	 * ends without an FDT_END tag. */
+#define FDT_ERR_BADMAGIC	9
+	/* FDT_ERR_BADMAGIC: Given "device tree" appears not to be a
+	 * device tree at all - it is missing the flattened device
+	 * tree magic number. */
+#define FDT_ERR_BADVERSION	10
+	/* FDT_ERR_BADVERSION: Given device tree has a version which
+	 * can't be handled by the requested operation.  For
+	 * read-write functions, this may mean that fdt_open_into() is
+	 * required to convert the tree to the expected version. */
+#define FDT_ERR_BADSTRUCTURE	11
+	/* FDT_ERR_BADSTRUCTURE: Given device tree has a corrupt
+	 * structure block or other serious error (e.g. misnested
+	 * nodes, or subnodes preceding properties). */
+#define FDT_ERR_BADLAYOUT	12
+	/* FDT_ERR_BADLAYOUT: For read-write functions, the given
+	 * device tree has it's sub-blocks in an order that the
+	 * function can't handle (memory reserve map, then structure,
+	 * then strings).  Use fdt_open_into() to reorganize the tree
+	 * into a form suitable for the read-write operations. */
+
+/* "Can't happen" error indicating a bug in libfdt */
+#define FDT_ERR_INTERNAL	13
+	/* FDT_ERR_INTERNAL: libfdt has failed an internal assertion.
+	 * Should never be returned, if it is, it indicates a bug in
+	 * libfdt itself. */
+
+#define FDT_ERR_MAX		13
+
+/**********************************************************************/
+/* Low-level functions (you probably don't need these)                */
+/**********************************************************************/
+
+const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen);
+static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
+{
+	return (void *)(uintptr_t)fdt_offset_ptr(fdt, offset, checklen);
+}
+
+uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset);
+
+/**********************************************************************/
+/* Traversal functions                                                */
+/**********************************************************************/
+
+int fdt_next_node(const void *fdt, int offset, int *depth);
+
+/**********************************************************************/
+/* General functions                                                  */
+/**********************************************************************/
+
+#define fdt_get_header(fdt, field) \
+	(fdt32_to_cpu(((const struct fdt_header *)(fdt))->field))
+#define fdt_magic(fdt) 			(fdt_get_header(fdt, magic))
+#define fdt_totalsize(fdt)		(fdt_get_header(fdt, totalsize))
+#define fdt_off_dt_struct(fdt)		(fdt_get_header(fdt, off_dt_struct))
+#define fdt_off_dt_strings(fdt)		(fdt_get_header(fdt, off_dt_strings))
+#define fdt_off_mem_rsvmap(fdt)		(fdt_get_header(fdt, off_mem_rsvmap))
+#define fdt_version(fdt)		(fdt_get_header(fdt, version))
+#define fdt_last_comp_version(fdt) 	(fdt_get_header(fdt, last_comp_version))
+#define fdt_boot_cpuid_phys(fdt) 	(fdt_get_header(fdt, boot_cpuid_phys))
+#define fdt_size_dt_strings(fdt) 	(fdt_get_header(fdt, size_dt_strings))
+#define fdt_size_dt_struct(fdt)		(fdt_get_header(fdt, size_dt_struct))
+
+#define __fdt_set_hdr(name) \
+	static inline void fdt_set_##name(void *fdt, uint32_t val) \
+	{ \
+		struct fdt_header *fdth = (struct fdt_header*)fdt; \
+		fdth->name = cpu_to_fdt32(val); \
+	}
+__fdt_set_hdr(magic);
+__fdt_set_hdr(totalsize);
+__fdt_set_hdr(off_dt_struct);
+__fdt_set_hdr(off_dt_strings);
+__fdt_set_hdr(off_mem_rsvmap);
+__fdt_set_hdr(version);
+__fdt_set_hdr(last_comp_version);
+__fdt_set_hdr(boot_cpuid_phys);
+__fdt_set_hdr(size_dt_strings);
+__fdt_set_hdr(size_dt_struct);
+#undef __fdt_set_hdr
+
+/**
+ * fdt_check_header - sanity check a device tree or possible device tree
+ * @fdt: pointer to data which might be a flattened device tree
+ *
+ * fdt_check_header() checks that the given buffer contains what
+ * appears to be a flattened device tree with sane information in its
+ * header.
+ *
+ * returns:
+ *     0, if the buffer appears to contain a valid device tree
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE, standard meanings, as above
+ */
+int fdt_check_header(const void *fdt);
+
+/**
+ * fdt_move - move a device tree around in memory
+ * @fdt: pointer to the device tree to move
+ * @buf: pointer to memory where the device is to be moved
+ * @bufsize: size of the memory space at buf
+ *
+ * fdt_move() relocates, if possible, the device tree blob located at
+ * fdt to the buffer at buf of size bufsize.  The buffer may overlap
+ * with the existing device tree blob at fdt.  Therefore,
+ *     fdt_move(fdt, fdt, fdt_totalsize(fdt))
+ * should always succeed.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_NOSPACE, bufsize is insufficient to contain the device tree
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE, standard meanings
+ */
+int fdt_move(const void *fdt, void *buf, int bufsize);
+
+/**********************************************************************/
+/* Read-only functions                                                */
+/**********************************************************************/
+
+/**
+ * fdt_string - retrieve a string from the strings block of a device tree
+ * @fdt: pointer to the device tree blob
+ * @stroffset: offset of the string within the strings block (native endian)
+ *
+ * fdt_string() retrieves a pointer to a single string from the
+ * strings block of the device tree blob at fdt.
+ *
+ * returns:
+ *     a pointer to the string, on success
+ *     NULL, if stroffset is out of bounds
+ */
+const char *fdt_string(const void *fdt, int stroffset);
+
+/**
+ * fdt_num_mem_rsv - retrieve the number of memory reserve map entries
+ * @fdt: pointer to the device tree blob
+ *
+ * Returns the number of entries in the device tree blob's memory
+ * reservation map.  This does not include the terminating 0,0 entry
+ * or any other (0,0) entries reserved for expansion.
+ *
+ * returns:
+ *     the number of entries
+ */
+int fdt_num_mem_rsv(const void *fdt);
+
+/**
+ * fdt_get_mem_rsv - retrieve one memory reserve map entry
+ * @fdt: pointer to the device tree blob
+ * @address, @size: pointers to 64-bit variables
+ *
+ * On success, *address and *size will contain the address and size of
+ * the n-th reserve map entry from the device tree blob, in
+ * native-endian format.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE, standard meanings
+ */
+int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size);
+
+/**
+ * fdt_subnode_offset_namelen - find a subnode based on substring
+ * @fdt: pointer to the device tree blob
+ * @parentoffset: structure block offset of a node
+ * @name: name of the subnode to locate
+ * @namelen: number of characters of name to consider
+ *
+ * Identical to fdt_subnode_offset(), but only examine the first
+ * namelen characters of name for matching the subnode name.  This is
+ * useful for finding subnodes based on a portion of a larger string,
+ * such as a full path.
+ */
+int fdt_subnode_offset_namelen(const void *fdt, int parentoffset,
+			       const char *name, int namelen);
+/**
+ * fdt_subnode_offset - find a subnode of a given node
+ * @fdt: pointer to the device tree blob
+ * @parentoffset: structure block offset of a node
+ * @name: name of the subnode to locate
+ *
+ * fdt_subnode_offset() finds a subnode of the node at structure block
+ * offset parentoffset with the given name.  name may include a unit
+ * address, in which case fdt_subnode_offset() will find the subnode
+ * with that unit address, or the unit address may be omitted, in
+ * which case fdt_subnode_offset() will find an arbitrary subnode
+ * whose name excluding unit address matches the given name.
+ *
+ * returns:
+ *	structure block offset of the requested subnode (>=0), on success
+ *	-FDT_ERR_NOTFOUND, if the requested subnode does not exist
+ *	-FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE tag
+ *      -FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_TRUNCATED, standard meanings.
+ */
+int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name);
+
+/**
+ * fdt_path_offset - find a tree node by its full path
+ * @fdt: pointer to the device tree blob
+ * @path: full path of the node to locate
+ *
+ * fdt_path_offset() finds a node of a given path in the device tree.
+ * Each path component may omit the unit address portion, but the
+ * results of this are undefined if any such path component is
+ * ambiguous (that is if there are multiple nodes at the relevant
+ * level matching the given component, differentiated only by unit
+ * address).
+ *
+ * returns:
+ *	structure block offset of the node with the requested path (>=0), on success
+ *	-FDT_ERR_BADPATH, given path does not begin with '/' or is invalid
+ *	-FDT_ERR_NOTFOUND, if the requested node does not exist
+ *      -FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_TRUNCATED, standard meanings.
+ */
+int fdt_path_offset(const void *fdt, const char *path);
+
+/**
+ * fdt_get_name - retrieve the name of a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: structure block offset of the starting node
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * fdt_get_name() retrieves the name (including unit address) of the
+ * device tree node at structure block offset nodeoffset.  If lenp is
+ * non-NULL, the length of this name is also returned, in the integer
+ * pointed to by lenp.
+ *
+ * returns:
+ *	pointer to the node's name, on success
+ *		If lenp is non-NULL, *lenp contains the length of that name (>=0)
+ *	NULL, on error
+ *		if lenp is non-NULL *lenp contains an error code (<0):
+ *		-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *		-FDT_ERR_BADMAGIC,
+ *		-FDT_ERR_BADVERSION,
+ *		-FDT_ERR_BADSTATE, standard meanings
+ */
+const char *fdt_get_name(const void *fdt, int nodeoffset, int *lenp);
+
+/**
+ * fdt_first_property_offset - find the offset of a node's first property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: structure block offset of a node
+ *
+ * fdt_first_property_offset() finds the first property of the node at
+ * the given structure block offset.
+ *
+ * returns:
+ *	structure block offset of the property (>=0), on success
+ *	-FDT_ERR_NOTFOUND, if the requested node has no properties
+ *	-FDT_ERR_BADOFFSET, if nodeoffset did not point to an FDT_BEGIN_NODE tag
+ *      -FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_TRUNCATED, standard meanings.
+ */
+int fdt_first_property_offset(const void *fdt, int nodeoffset);
+
+/**
+ * fdt_next_property_offset - step through a node's properties
+ * @fdt: pointer to the device tree blob
+ * @offset: structure block offset of a property
+ *
+ * fdt_next_property_offset() finds the property immediately after the
+ * one at the given structure block offset.  This will be a property
+ * of the same node as the given property.
+ *
+ * returns:
+ *	structure block offset of the next property (>=0), on success
+ *	-FDT_ERR_NOTFOUND, if the given property is the last in its node
+ *	-FDT_ERR_BADOFFSET, if nodeoffset did not point to an FDT_PROP tag
+ *      -FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_TRUNCATED, standard meanings.
+ */
+int fdt_next_property_offset(const void *fdt, int offset);
+
+/**
+ * fdt_get_property_by_offset - retrieve the property at a given offset
+ * @fdt: pointer to the device tree blob
+ * @offset: offset of the property to retrieve
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * fdt_get_property_by_offset() retrieves a pointer to the
+ * fdt_property structure within the device tree blob at the given
+ * offset.  If lenp is non-NULL, the length of the property value is
+ * also returned, in the integer pointed to by lenp.
+ *
+ * returns:
+ *	pointer to the structure representing the property
+ *		if lenp is non-NULL, *lenp contains the length of the property
+ *		value (>=0)
+ *	NULL, on error
+ *		if lenp is non-NULL, *lenp contains an error code (<0):
+ *		-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_PROP tag
+ *		-FDT_ERR_BADMAGIC,
+ *		-FDT_ERR_BADVERSION,
+ *		-FDT_ERR_BADSTATE,
+ *		-FDT_ERR_BADSTRUCTURE,
+ *		-FDT_ERR_TRUNCATED, standard meanings
+ */
+const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
+						      int offset,
+						      int *lenp);
+
+/**
+ * fdt_get_property_namelen - find a property based on substring
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to find
+ * @name: name of the property to find
+ * @namelen: number of characters of name to consider
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * Identical to fdt_get_property_namelen(), but only examine the first
+ * namelen characters of name for matching the property name.
+ */
+const struct fdt_property *fdt_get_property_namelen(const void *fdt,
+						    int nodeoffset,
+						    const char *name,
+						    int namelen, int *lenp);
+
+/**
+ * fdt_get_property - find a given property in a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to find
+ * @name: name of the property to find
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * fdt_get_property() retrieves a pointer to the fdt_property
+ * structure within the device tree blob corresponding to the property
+ * named 'name' of the node at offset nodeoffset.  If lenp is
+ * non-NULL, the length of the property value is also returned, in the
+ * integer pointed to by lenp.
+ *
+ * returns:
+ *	pointer to the structure representing the property
+ *		if lenp is non-NULL, *lenp contains the length of the property
+ *		value (>=0)
+ *	NULL, on error
+ *		if lenp is non-NULL, *lenp contains an error code (<0):
+ *		-FDT_ERR_NOTFOUND, node does not have named property
+ *		-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *		-FDT_ERR_BADMAGIC,
+ *		-FDT_ERR_BADVERSION,
+ *		-FDT_ERR_BADSTATE,
+ *		-FDT_ERR_BADSTRUCTURE,
+ *		-FDT_ERR_TRUNCATED, standard meanings
+ */
+const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset,
+					    const char *name, int *lenp);
+static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset,
+						      const char *name,
+						      int *lenp)
+{
+	return (struct fdt_property *)(uintptr_t)
+		fdt_get_property(fdt, nodeoffset, name, lenp);
+}
+
+/**
+ * fdt_getprop_by_offset - retrieve the value of a property at a given offset
+ * @fdt: pointer to the device tree blob
+ * @ffset: offset of the property to read
+ * @namep: pointer to a string variable (will be overwritten) or NULL
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * fdt_getprop_by_offset() retrieves a pointer to the value of the
+ * property at structure block offset 'offset' (this will be a pointer
+ * to within the device blob itself, not a copy of the value).  If
+ * lenp is non-NULL, the length of the property value is also
+ * returned, in the integer pointed to by lenp.  If namep is non-NULL,
+ * the property's namne will also be returned in the char * pointed to
+ * by namep (this will be a pointer to within the device tree's string
+ * block, not a new copy of the name).
+ *
+ * returns:
+ *	pointer to the property's value
+ *		if lenp is non-NULL, *lenp contains the length of the property
+ *		value (>=0)
+ *		if namep is non-NULL *namep contiains a pointer to the property
+ *		name.
+ *	NULL, on error
+ *		if lenp is non-NULL, *lenp contains an error code (<0):
+ *		-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_PROP tag
+ *		-FDT_ERR_BADMAGIC,
+ *		-FDT_ERR_BADVERSION,
+ *		-FDT_ERR_BADSTATE,
+ *		-FDT_ERR_BADSTRUCTURE,
+ *		-FDT_ERR_TRUNCATED, standard meanings
+ */
+const void *fdt_getprop_by_offset(const void *fdt, int offset,
+				  const char **namep, int *lenp);
+
+/**
+ * fdt_getprop_namelen - get property value based on substring
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to find
+ * @name: name of the property to find
+ * @namelen: number of characters of name to consider
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * Identical to fdt_getprop(), but only examine the first namelen
+ * characters of name for matching the property name.
+ */
+const void *fdt_getprop_namelen(const void *fdt, int nodeoffset,
+				const char *name, int namelen, int *lenp);
+
+/**
+ * fdt_getprop - retrieve the value of a given property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to find
+ * @name: name of the property to find
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * fdt_getprop() retrieves a pointer to the value of the property
+ * named 'name' of the node at offset nodeoffset (this will be a
+ * pointer to within the device blob itself, not a copy of the value).
+ * If lenp is non-NULL, the length of the property value is also
+ * returned, in the integer pointed to by lenp.
+ *
+ * returns:
+ *	pointer to the property's value
+ *		if lenp is non-NULL, *lenp contains the length of the property
+ *		value (>=0)
+ *	NULL, on error
+ *		if lenp is non-NULL, *lenp contains an error code (<0):
+ *		-FDT_ERR_NOTFOUND, node does not have named property
+ *		-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *		-FDT_ERR_BADMAGIC,
+ *		-FDT_ERR_BADVERSION,
+ *		-FDT_ERR_BADSTATE,
+ *		-FDT_ERR_BADSTRUCTURE,
+ *		-FDT_ERR_TRUNCATED, standard meanings
+ */
+const void *fdt_getprop(const void *fdt, int nodeoffset,
+			const char *name, int *lenp);
+static inline void *fdt_getprop_w(void *fdt, int nodeoffset,
+				  const char *name, int *lenp)
+{
+	return (void *)(uintptr_t)fdt_getprop(fdt, nodeoffset, name, lenp);
+}
+
+/**
+ * fdt_get_phandle - retrieve the phandle of a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: structure block offset of the node
+ *
+ * fdt_get_phandle() retrieves the phandle of the device tree node at
+ * structure block offset nodeoffset.
+ *
+ * returns:
+ *	the phandle of the node at nodeoffset, on success (!= 0, != -1)
+ *	0, if the node has no phandle, or another error occurs
+ */
+uint32_t fdt_get_phandle(const void *fdt, int nodeoffset);
+
+/**
+ * fdt_get_alias_namelen - get alias based on substring
+ * @fdt: pointer to the device tree blob
+ * @name: name of the alias th look up
+ * @namelen: number of characters of name to consider
+ *
+ * Identical to fdt_get_alias(), but only examine the first namelen
+ * characters of name for matching the alias name.
+ */
+const char *fdt_get_alias_namelen(const void *fdt,
+				  const char *name, int namelen);
+
+/**
+ * fdt_get_alias - retreive the path referenced by a given alias
+ * @fdt: pointer to the device tree blob
+ * @name: name of the alias th look up
+ *
+ * fdt_get_alias() retrieves the value of a given alias.  That is, the
+ * value of the property named 'name' in the node /aliases.
+ *
+ * returns:
+ *	a pointer to the expansion of the alias named 'name', of it exists
+ *	NULL, if the given alias or the /aliases node does not exist
+ */
+const char *fdt_get_alias(const void *fdt, const char *name);
+
+/**
+ * fdt_get_path - determine the full path of a node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose path to find
+ * @buf: character buffer to contain the returned path (will be overwritten)
+ * @buflen: size of the character buffer at buf
+ *
+ * fdt_get_path() computes the full path of the node at offset
+ * nodeoffset, and records that path in the buffer at buf.
+ *
+ * NOTE: This function is expensive, as it must scan the device tree
+ * structure from the start to nodeoffset.
+ *
+ * returns:
+ *	0, on success
+ *		buf contains the absolute path of the node at
+ *		nodeoffset, as a NUL-terminated string.
+ * 	-FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ *	-FDT_ERR_NOSPACE, the path of the given node is longer than (bufsize-1)
+ *		characters and will not fit in the given buffer.
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen);
+
+/**
+ * fdt_supernode_atdepth_offset - find a specific ancestor of a node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose parent to find
+ * @supernodedepth: depth of the ancestor to find
+ * @nodedepth: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * fdt_supernode_atdepth_offset() finds an ancestor of the given node
+ * at a specific depth from the root (where the root itself has depth
+ * 0, its immediate subnodes depth 1 and so forth).  So
+ *	fdt_supernode_atdepth_offset(fdt, nodeoffset, 0, NULL);
+ * will always return 0, the offset of the root node.  If the node at
+ * nodeoffset has depth D, then:
+ *	fdt_supernode_atdepth_offset(fdt, nodeoffset, D, NULL);
+ * will return nodeoffset itself.
+ *
+ * NOTE: This function is expensive, as it must scan the device tree
+ * structure from the start to nodeoffset.
+ *
+ * returns:
+
+ *	structure block offset of the node at node offset's ancestor
+ *		of depth supernodedepth (>=0), on success
+ * 	-FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+*	-FDT_ERR_NOTFOUND, supernodedepth was greater than the depth of nodeoffset
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset,
+				 int supernodedepth, int *nodedepth);
+
+/**
+ * fdt_node_depth - find the depth of a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose parent to find
+ *
+ * fdt_node_depth() finds the depth of a given node.  The root node
+ * has depth 0, its immediate subnodes depth 1 and so forth.
+ *
+ * NOTE: This function is expensive, as it must scan the device tree
+ * structure from the start to nodeoffset.
+ *
+ * returns:
+ *	depth of the node at nodeoffset (>=0), on success
+ * 	-FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_depth(const void *fdt, int nodeoffset);
+
+/**
+ * fdt_parent_offset - find the parent of a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose parent to find
+ *
+ * fdt_parent_offset() locates the parent node of a given node (that
+ * is, it finds the offset of the node which contains the node at
+ * nodeoffset as a subnode).
+ *
+ * NOTE: This function is expensive, as it must scan the device tree
+ * structure from the start to nodeoffset, *twice*.
+ *
+ * returns:
+ *	structure block offset of the parent of the node at nodeoffset
+ *		(>=0), on success
+ * 	-FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_parent_offset(const void *fdt, int nodeoffset);
+
+/**
+ * fdt_node_offset_by_prop_value - find nodes with a given property value
+ * @fdt: pointer to the device tree blob
+ * @startoffset: only find nodes after this offset
+ * @propname: property name to check
+ * @propval: property value to search for
+ * @proplen: length of the value in propval
+ *
+ * fdt_node_offset_by_prop_value() returns the offset of the first
+ * node after startoffset, which has a property named propname whose
+ * value is of length proplen and has value equal to propval; or if
+ * startoffset is -1, the very first such node in the tree.
+ *
+ * To iterate through all nodes matching the criterion, the following
+ * idiom can be used:
+ *	offset = fdt_node_offset_by_prop_value(fdt, -1, propname,
+ *					       propval, proplen);
+ *	while (offset != -FDT_ERR_NOTFOUND) {
+ *		// other code here
+ *		offset = fdt_node_offset_by_prop_value(fdt, offset, propname,
+ *						       propval, proplen);
+ *	}
+ *
+ * Note the -1 in the first call to the function, if 0 is used here
+ * instead, the function will never locate the root node, even if it
+ * matches the criterion.
+ *
+ * returns:
+ *	structure block offset of the located node (>= 0, >startoffset),
+ *		 on success
+ *	-FDT_ERR_NOTFOUND, no node matching the criterion exists in the
+ *		tree after startoffset
+ * 	-FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_offset_by_prop_value(const void *fdt, int startoffset,
+				  const char *propname,
+				  const void *propval, int proplen);
+
+/**
+ * fdt_node_offset_by_phandle - find the node with a given phandle
+ * @fdt: pointer to the device tree blob
+ * @phandle: phandle value
+ *
+ * fdt_node_offset_by_phandle() returns the offset of the node
+ * which has the given phandle value.  If there is more than one node
+ * in the tree with the given phandle (an invalid tree), results are
+ * undefined.
+ *
+ * returns:
+ *	structure block offset of the located node (>= 0), on success
+ *	-FDT_ERR_NOTFOUND, no node with that phandle exists
+ *	-FDT_ERR_BADPHANDLE, given phandle value was invalid (0 or -1)
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle);
+
+/**
+ * fdt_node_check_compatible: check a node's compatible property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of a tree node
+ * @compatible: string to match against
+ *
+ *
+ * fdt_node_check_compatible() returns 0 if the given node contains a
+ * 'compatible' property with the given string as one of its elements,
+ * it returns non-zero otherwise, or on error.
+ *
+ * returns:
+ *	0, if the node has a 'compatible' property listing the given string
+ *	1, if the node has a 'compatible' property, but it does not list
+ *		the given string
+ *	-FDT_ERR_NOTFOUND, if the given node has no 'compatible' property
+ * 	-FDT_ERR_BADOFFSET, if nodeoffset does not refer to a BEGIN_NODE tag
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_check_compatible(const void *fdt, int nodeoffset,
+			      const char *compatible);
+
+/**
+ * fdt_node_offset_by_compatible - find nodes with a given 'compatible' value
+ * @fdt: pointer to the device tree blob
+ * @startoffset: only find nodes after this offset
+ * @compatible: 'compatible' string to match against
+ *
+ * fdt_node_offset_by_compatible() returns the offset of the first
+ * node after startoffset, which has a 'compatible' property which
+ * lists the given compatible string; or if startoffset is -1, the
+ * very first such node in the tree.
+ *
+ * To iterate through all nodes matching the criterion, the following
+ * idiom can be used:
+ *	offset = fdt_node_offset_by_compatible(fdt, -1, compatible);
+ *	while (offset != -FDT_ERR_NOTFOUND) {
+ *		// other code here
+ *		offset = fdt_node_offset_by_compatible(fdt, offset, compatible);
+ *	}
+ *
+ * Note the -1 in the first call to the function, if 0 is used here
+ * instead, the function will never locate the root node, even if it
+ * matches the criterion.
+ *
+ * returns:
+ *	structure block offset of the located node (>= 0, >startoffset),
+ *		 on success
+ *	-FDT_ERR_NOTFOUND, no node matching the criterion exists in the
+ *		tree after startoffset
+ * 	-FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
+				  const char *compatible);
+
+/**********************************************************************/
+/* Write-in-place functions                                           */
+/**********************************************************************/
+
+/**
+ * fdt_setprop_inplace - change a property's value, but not its size
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to change
+ * @val: pointer to data to replace the property value with
+ * @len: length of the property value
+ *
+ * fdt_setprop_inplace() replaces the value of a given property with
+ * the data in val, of length len.  This function cannot change the
+ * size of a property, and so will only work if len is equal to the
+ * current length of the property.
+ *
+ * This function will alter only the bytes in the blob which contain
+ * the given property value, and will not alter or move any other part
+ * of the tree.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_NOSPACE, if len is not equal to the property's current length
+ *	-FDT_ERR_NOTFOUND, node does not have the named property
+ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
+			const void *val, int len);
+
+/**
+ * fdt_setprop_inplace_cell - change the value of a single-cell property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to change
+ * @val: cell (32-bit integer) value to replace the property with
+ *
+ * fdt_setprop_inplace_cell() replaces the value of a given property
+ * with the 32-bit integer cell value in val, converting val to
+ * big-endian if necessary.  This function cannot change the size of a
+ * property, and so will only work if the property already exists and
+ * has length 4.
+ *
+ * This function will alter only the bytes in the blob which contain
+ * the given property value, and will not alter or move any other part
+ * of the tree.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_NOSPACE, if the property's length is not equal to 4
+  *	-FDT_ERR_NOTFOUND, node does not have the named property
+ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset,
+					   const char *name, uint32_t val)
+{
+	val = cpu_to_fdt32(val);
+	return fdt_setprop_inplace(fdt, nodeoffset, name, &val, sizeof(val));
+}
+
+/**
+ * fdt_nop_property - replace a property with nop tags
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to nop
+ * @name: name of the property to nop
+ *
+ * fdt_nop_property() will replace a given property's representation
+ * in the blob with FDT_NOP tags, effectively removing it from the
+ * tree.
+ *
+ * This function will alter only the bytes in the blob which contain
+ * the property, and will not alter or move any other part of the
+ * tree.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_NOTFOUND, node does not have the named property
+ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_nop_property(void *fdt, int nodeoffset, const char *name);
+
+/**
+ * fdt_nop_node - replace a node (subtree) with nop tags
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node to nop
+ *
+ * fdt_nop_node() will replace a given node's representation in the
+ * blob, including all its subnodes, if any, with FDT_NOP tags,
+ * effectively removing it from the tree.
+ *
+ * This function will alter only the bytes in the blob which contain
+ * the node and its properties and subnodes, and will not alter or
+ * move any other part of the tree.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_nop_node(void *fdt, int nodeoffset);
+
+/**********************************************************************/
+/* Sequential write functions                                         */
+/**********************************************************************/
+
+int fdt_create(void *buf, int bufsize);
+int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size);
+int fdt_finish_reservemap(void *fdt);
+int fdt_begin_node(void *fdt, const char *name);
+int fdt_property(void *fdt, const char *name, const void *val, int len);
+static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val)
+{
+	val = cpu_to_fdt32(val);
+	return fdt_property(fdt, name, &val, sizeof(val));
+}
+#define fdt_property_string(fdt, name, str) \
+	fdt_property(fdt, name, str, strlen(str)+1)
+int fdt_end_node(void *fdt);
+int fdt_finish(void *fdt);
+
+/**********************************************************************/
+/* Read-write functions                                               */
+/**********************************************************************/
+
+int fdt_open_into(const void *fdt, void *buf, int bufsize);
+int fdt_pack(void *fdt);
+
+/**
+ * fdt_add_mem_rsv - add one memory reserve map entry
+ * @fdt: pointer to the device tree blob
+ * @address, @size: 64-bit values (native endian)
+ *
+ * Adds a reserve map entry to the given blob reserving a region at
+ * address address of length size.
+ *
+ * This function will insert data into the reserve map and will
+ * therefore change the indexes of some entries in the table.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_NOSPACE, there is insufficient free space in the blob to
+ *		contain the new reservation entry
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_BADLAYOUT,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size);
+
+/**
+ * fdt_del_mem_rsv - remove a memory reserve map entry
+ * @fdt: pointer to the device tree blob
+ * @n: entry to remove
+ *
+ * fdt_del_mem_rsv() removes the n-th memory reserve map entry from
+ * the blob.
+ *
+ * This function will delete data from the reservation table and will
+ * therefore change the indexes of some entries in the table.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_NOTFOUND, there is no entry of the given index (i.e. there
+ *		are less than n+1 reserve map entries)
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_BADLAYOUT,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_del_mem_rsv(void *fdt, int n);
+
+/**
+ * fdt_set_name - change the name of a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: structure block offset of a node
+ * @name: name to give the node
+ *
+ * fdt_set_name() replaces the name (including unit address, if any)
+ * of the given node with the given string.  NOTE: this function can't
+ * efficiently check if the new name is unique amongst the given
+ * node's siblings; results are undefined if this function is invoked
+ * with a name equal to one of the given node's siblings.
+ *
+ * This function may insert or delete data from the blob, and will
+ * therefore change the offsets of some existing nodes.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_NOSPACE, there is insufficient free space in the blob
+ *		to contain the new name
+ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE, standard meanings
+ */
+int fdt_set_name(void *fdt, int nodeoffset, const char *name);
+
+/**
+ * fdt_setprop - create or change a property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to change
+ * @val: pointer to data to set the property value to
+ * @len: length of the property value
+ *
+ * fdt_setprop() sets the value of the named property in the given
+ * node to the given value and length, creating the property if it
+ * does not already exist.
+ *
+ * This function may insert or delete data from the blob, and will
+ * therefore change the offsets of some existing nodes.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_NOSPACE, there is insufficient free space in the blob to
+ *		contain the new property value
+ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *	-FDT_ERR_BADLAYOUT,
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_BADLAYOUT,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_setprop(void *fdt, int nodeoffset, const char *name,
+		const void *val, int len);
+
+/**
+ * fdt_setprop_cell - set a property to a single cell value
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to change
+ * @val: 32-bit integer value for the property (native endian)
+ *
+ * fdt_setprop_cell() sets the value of the named property in the
+ * given node to the given cell value (converting to big-endian if
+ * necessary), or creates a new property with that value if it does
+ * not already exist.
+ *
+ * This function may insert or delete data from the blob, and will
+ * therefore change the offsets of some existing nodes.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_NOSPACE, there is insufficient free space in the blob to
+ *		contain the new property value
+ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *	-FDT_ERR_BADLAYOUT,
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_BADLAYOUT,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name,
+				   uint32_t val)
+{
+	val = cpu_to_fdt32(val);
+	return fdt_setprop(fdt, nodeoffset, name, &val, sizeof(val));
+}
+
+/**
+ * fdt_setprop_string - set a property to a string value
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to change
+ * @str: string value for the property
+ *
+ * fdt_setprop_string() sets the value of the named property in the
+ * given node to the given string value (using the length of the
+ * string to determine the new length of the property), or creates a
+ * new property with that value if it does not already exist.
+ *
+ * This function may insert or delete data from the blob, and will
+ * therefore change the offsets of some existing nodes.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_NOSPACE, there is insufficient free space in the blob to
+ *		contain the new property value
+ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *	-FDT_ERR_BADLAYOUT,
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_BADLAYOUT,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+#define fdt_setprop_string(fdt, nodeoffset, name, str) \
+	fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
+
+/**
+ * fdt_delprop - delete a property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to nop
+ * @name: name of the property to nop
+ *
+ * fdt_del_property() will delete the given property.
+ *
+ * This function will delete data from the blob, and will therefore
+ * change the offsets of some existing nodes.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_NOTFOUND, node does not have the named property
+ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *	-FDT_ERR_BADLAYOUT,
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_delprop(void *fdt, int nodeoffset, const char *name);
+
+/**
+ * fdt_add_subnode_namelen - creates a new node based on substring
+ * @fdt: pointer to the device tree blob
+ * @parentoffset: structure block offset of a node
+ * @name: name of the subnode to locate
+ * @namelen: number of characters of name to consider
+ *
+ * Identical to fdt_add_subnode(), but use only the first namelen
+ * characters of name as the name of the new node.  This is useful for
+ * creating subnodes based on a portion of a larger string, such as a
+ * full path.
+ */
+int fdt_add_subnode_namelen(void *fdt, int parentoffset,
+			    const char *name, int namelen);
+
+/**
+ * fdt_add_subnode - creates a new node
+ * @fdt: pointer to the device tree blob
+ * @parentoffset: structure block offset of a node
+ * @name: name of the subnode to locate
+ *
+ * fdt_add_subnode() creates a new node as a subnode of the node at
+ * structure block offset parentoffset, with the given name (which
+ * should include the unit address, if any).
+ *
+ * This function will insert data into the blob, and will therefore
+ * change the offsets of some existing nodes.
+
+ * returns:
+ *	structure block offset of the created nodeequested subnode (>=0), on success
+ *	-FDT_ERR_NOTFOUND, if the requested subnode does not exist
+ *	-FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE tag
+ *	-FDT_ERR_EXISTS, if the node at parentoffset already has a subnode of
+ *		the given name
+ *	-FDT_ERR_NOSPACE, if there is insufficient free space in the
+ *		blob to contain the new node
+ *	-FDT_ERR_NOSPACE
+ *	-FDT_ERR_BADLAYOUT
+ *      -FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_TRUNCATED, standard meanings.
+ */
+int fdt_add_subnode(void *fdt, int parentoffset, const char *name);
+
+/**
+ * fdt_del_node - delete a node (subtree)
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node to nop
+ *
+ * fdt_del_node() will remove the given node, including all its
+ * subnodes if any, from the blob.
+ *
+ * This function will delete data from the blob, and will therefore
+ * change the offsets of some existing nodes.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *	-FDT_ERR_BADLAYOUT,
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_del_node(void *fdt, int nodeoffset);
+
+/**********************************************************************/
+/* Debugging / informational functions                                */
+/**********************************************************************/
+
+const char *fdt_strerror(int errval);
+
+#endif /* _LIBFDT_H */
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/libfdt_env.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/libfdt_env.h	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,23 @@
+#ifndef _LIBFDT_ENV_H
+#define _LIBFDT_ENV_H
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#define _B(n)	((unsigned long long)((uint8_t *)&x)[n])
+static inline uint32_t fdt32_to_cpu(uint32_t x)
+{
+	return (_B(0) << 24) | (_B(1) << 16) | (_B(2) << 8) | _B(3);
+}
+#define cpu_to_fdt32(x) fdt32_to_cpu(x)
+
+static inline uint64_t fdt64_to_cpu(uint64_t x)
+{
+	return (_B(0) << 56) | (_B(1) << 48) | (_B(2) << 40) | (_B(3) << 32)
+		| (_B(4) << 24) | (_B(5) << 16) | (_B(6) << 8) | _B(7);
+}
+#define cpu_to_fdt64(x) fdt64_to_cpu(x)
+#undef _B
+
+#endif /* _LIBFDT_ENV_H */
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/libfdt_internal.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/libfdt_internal.h	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,95 @@
+#ifndef _LIBFDT_INTERNAL_H
+#define _LIBFDT_INTERNAL_H
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ *
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ *     You should have received a copy of the GNU General Public
+ *     License along with this library; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ *  b) Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *     1. Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *     2. Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <fdt.h>
+
+#define FDT_ALIGN(x, a)		(((x) + (a) - 1) & ~((a) - 1))
+#define FDT_TAGALIGN(x)		(FDT_ALIGN((x), FDT_TAGSIZE))
+
+#define FDT_CHECK_HEADER(fdt) \
+	{ \
+		int err; \
+		if ((err = fdt_check_header(fdt)) != 0) \
+			return err; \
+	}
+
+int _fdt_check_node_offset(const void *fdt, int offset);
+int _fdt_check_prop_offset(const void *fdt, int offset);
+const char *_fdt_find_string(const char *strtab, int tabsize, const char *s);
+int _fdt_node_end_offset(void *fdt, int nodeoffset);
+
+static inline const void *_fdt_offset_ptr(const void *fdt, int offset)
+{
+	return (const char *)fdt + fdt_off_dt_struct(fdt) + offset;
+}
+
+static inline void *_fdt_offset_ptr_w(void *fdt, int offset)
+{
+	return (void *)(uintptr_t)_fdt_offset_ptr(fdt, offset);
+}
+
+static inline const struct fdt_reserve_entry *_fdt_mem_rsv(const void *fdt, int n)
+{
+	const struct fdt_reserve_entry *rsv_table =
+		(const struct fdt_reserve_entry *)
+		((const char *)fdt + fdt_off_mem_rsvmap(fdt));
+
+	return rsv_table + n;
+}
+static inline struct fdt_reserve_entry *_fdt_mem_rsv_w(void *fdt, int n)
+{
+	return (void *)(uintptr_t)_fdt_mem_rsv(fdt, n);
+}
+
+#define FDT_SW_MAGIC		(~FDT_MAGIC)
+
+#endif /* _LIBFDT_INTERNAL_H */
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/version.lds
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/version.lds	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,54 @@
+LIBFDT_1.2 {
+	global:
+		fdt_next_node;
+		fdt_check_header;
+		fdt_move;
+		fdt_string;
+		fdt_num_mem_rsv;
+		fdt_get_mem_rsv;
+		fdt_subnode_offset_namelen;
+		fdt_subnode_offset;
+		fdt_path_offset;
+		fdt_get_name;
+		fdt_get_property_namelen;
+		fdt_get_property;
+		fdt_getprop_namelen;
+		fdt_getprop;
+		fdt_get_phandle;
+		fdt_get_alias_namelen;
+		fdt_get_alias;
+		fdt_get_path;
+		fdt_supernode_atdepth_offset;
+		fdt_node_depth;
+		fdt_parent_offset;
+		fdt_node_offset_by_prop_value;
+		fdt_node_offset_by_phandle;
+		fdt_node_check_compatible;
+		fdt_node_offset_by_compatible;
+		fdt_setprop_inplace;
+		fdt_nop_property;
+		fdt_nop_node;
+		fdt_create;
+		fdt_add_reservemap_entry;
+		fdt_finish_reservemap;
+		fdt_begin_node;
+		fdt_property;
+		fdt_end_node;
+		fdt_finish;
+		fdt_open_into;
+		fdt_pack;
+		fdt_add_mem_rsv;
+		fdt_del_mem_rsv;
+		fdt_set_name;
+		fdt_setprop;
+		fdt_delprop;
+		fdt_add_subnode_namelen;
+		fdt_add_subnode;
+		fdt_del_node;
+		fdt_strerror;
+		fdt_offset_ptr;
+		fdt_next_tag;
+
+	local:
+		*;
+};

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:55:46 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:55:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSDp-0005K3-Ur; Tue, 14 Feb 2012 23:55:45 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDn-0005E0-8p
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:44 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-216.messagelabs.com!1329263718!12115159!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32542 invoked from network); 14 Feb 2012 23:55:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDN-0007i3-RV
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDN-0002DJ-Bn
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:17 +0000
Message-Id: <E1RxSDN-0002DJ-Bn@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libfdt: add version 1.3.0
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329140006 0
# Node ID fcc188f21e471d2e9eaf1ddf22a728763a84cca2
# Parent  bd0a11ed1a67fd9b970f4b043879afdbc7f50d0c
libfdt: add version 1.3.0

Add libfdt 1.3.0 from http://git.jdl.com/gitweb/?p=dtc.git

This will be used by Xen to parse the DTBs provided by bootloaders on
ARM platforms.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/Makefile.libfdt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/Makefile.libfdt	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,10 @@
+# Makefile.libfdt
+#
+# This is not a complete Makefile of itself.  Instead, it is designed to
+# be easily embeddable into other systems of Makefiles.
+#
+LIBFDT_soname = libfdt.$(SHAREDLIB_EXT).1
+LIBFDT_INCLUDES = fdt.h libfdt.h
+LIBFDT_VERSION = version.lds
+LIBFDT_SRCS = fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c
+LIBFDT_OBJS = $(LIBFDT_SRCS:%.c=%.o)
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/TODO
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/TODO	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,3 @@
+- Tree traversal functions
+- Graft function
+- Complete libfdt.h documenting comments
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/fdt.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/fdt.c	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,222 @@
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ *
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ *     You should have received a copy of the GNU General Public
+ *     License along with this library; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ *  b) Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *     1. Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *     2. Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "libfdt_env.h"
+
+#include <fdt.h>
+#include <libfdt.h>
+
+#include "libfdt_internal.h"
+
+int fdt_check_header(const void *fdt)
+{
+	if (fdt_magic(fdt) == FDT_MAGIC) {
+		/* Complete tree */
+		if (fdt_version(fdt) < FDT_FIRST_SUPPORTED_VERSION)
+			return -FDT_ERR_BADVERSION;
+		if (fdt_last_comp_version(fdt) > FDT_LAST_SUPPORTED_VERSION)
+			return -FDT_ERR_BADVERSION;
+	} else if (fdt_magic(fdt) == FDT_SW_MAGIC) {
+		/* Unfinished sequential-write blob */
+		if (fdt_size_dt_struct(fdt) == 0)
+			return -FDT_ERR_BADSTATE;
+	} else {
+		return -FDT_ERR_BADMAGIC;
+	}
+
+	return 0;
+}
+
+const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int len)
+{
+	const char *p;
+
+	if (fdt_version(fdt) >= 0x11)
+		if (((offset + len) < offset)
+		    || ((offset + len) > fdt_size_dt_struct(fdt)))
+			return NULL;
+
+	p = _fdt_offset_ptr(fdt, offset);
+
+	if (p + len < p)
+		return NULL;
+	return p;
+}
+
+uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset)
+{
+	const uint32_t *tagp, *lenp;
+	uint32_t tag;
+	int offset = startoffset;
+	const char *p;
+
+	*nextoffset = -FDT_ERR_TRUNCATED;
+	tagp = fdt_offset_ptr(fdt, offset, FDT_TAGSIZE);
+	if (!tagp)
+		return FDT_END; /* premature end */
+	tag = fdt32_to_cpu(*tagp);
+	offset += FDT_TAGSIZE;
+
+	*nextoffset = -FDT_ERR_BADSTRUCTURE;
+	switch (tag) {
+	case FDT_BEGIN_NODE:
+		/* skip name */
+		do {
+			p = fdt_offset_ptr(fdt, offset++, 1);
+		} while (p && (*p != '\0'));
+		if (!p)
+			return FDT_END; /* premature end */
+		break;
+
+	case FDT_PROP:
+		lenp = fdt_offset_ptr(fdt, offset, sizeof(*lenp));
+		if (!lenp)
+			return FDT_END; /* premature end */
+		/* skip-name offset, length and value */
+		offset += sizeof(struct fdt_property) - FDT_TAGSIZE
+			+ fdt32_to_cpu(*lenp);
+		break;
+
+	case FDT_END:
+	case FDT_END_NODE:
+	case FDT_NOP:
+		break;
+
+	default:
+		return FDT_END;
+	}
+
+	if (!fdt_offset_ptr(fdt, startoffset, offset - startoffset))
+		return FDT_END; /* premature end */
+
+	*nextoffset = FDT_TAGALIGN(offset);
+	return tag;
+}
+
+int _fdt_check_node_offset(const void *fdt, int offset)
+{
+	if ((offset < 0) || (offset % FDT_TAGSIZE)
+	    || (fdt_next_tag(fdt, offset, &offset) != FDT_BEGIN_NODE))
+		return -FDT_ERR_BADOFFSET;
+
+	return offset;
+}
+
+int _fdt_check_prop_offset(const void *fdt, int offset)
+{
+	if ((offset < 0) || (offset % FDT_TAGSIZE)
+	    || (fdt_next_tag(fdt, offset, &offset) != FDT_PROP))
+		return -FDT_ERR_BADOFFSET;
+
+	return offset;
+}
+
+int fdt_next_node(const void *fdt, int offset, int *depth)
+{
+	int nextoffset = 0;
+	uint32_t tag;
+
+	if (offset >= 0)
+		if ((nextoffset = _fdt_check_node_offset(fdt, offset)) < 0)
+			return nextoffset;
+
+	do {
+		offset = nextoffset;
+		tag = fdt_next_tag(fdt, offset, &nextoffset);
+
+		switch (tag) {
+		case FDT_PROP:
+		case FDT_NOP:
+			break;
+
+		case FDT_BEGIN_NODE:
+			if (depth)
+				(*depth)++;
+			break;
+
+		case FDT_END_NODE:
+			if (depth && ((--(*depth)) < 0))
+				return nextoffset;
+			break;
+
+		case FDT_END:
+			if ((nextoffset >= 0)
+			    || ((nextoffset == -FDT_ERR_TRUNCATED) && !depth))
+				return -FDT_ERR_NOTFOUND;
+			else
+				return nextoffset;
+		}
+	} while (tag != FDT_BEGIN_NODE);
+
+	return offset;
+}
+
+const char *_fdt_find_string(const char *strtab, int tabsize, const char *s)
+{
+	int len = strlen(s) + 1;
+	const char *last = strtab + tabsize - len;
+	const char *p;
+
+	for (p = strtab; p <= last; p++)
+		if (memcmp(p, s, len) == 0)
+			return p;
+	return NULL;
+}
+
+int fdt_move(const void *fdt, void *buf, int bufsize)
+{
+	FDT_CHECK_HEADER(fdt);
+
+	if (fdt_totalsize(fdt) > bufsize)
+		return -FDT_ERR_NOSPACE;
+
+	memmove(buf, fdt, fdt_totalsize(fdt));
+	return 0;
+}
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/fdt.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/fdt.h	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,60 @@
+#ifndef _FDT_H
+#define _FDT_H
+
+#ifndef __ASSEMBLY__
+
+struct fdt_header {
+	uint32_t magic;			 /* magic word FDT_MAGIC */
+	uint32_t totalsize;		 /* total size of DT block */
+	uint32_t off_dt_struct;		 /* offset to structure */
+	uint32_t off_dt_strings;	 /* offset to strings */
+	uint32_t off_mem_rsvmap;	 /* offset to memory reserve map */
+	uint32_t version;		 /* format version */
+	uint32_t last_comp_version;	 /* last compatible version */
+
+	/* version 2 fields below */
+	uint32_t boot_cpuid_phys;	 /* Which physical CPU id we're
+					    booting on */
+	/* version 3 fields below */
+	uint32_t size_dt_strings;	 /* size of the strings block */
+
+	/* version 17 fields below */
+	uint32_t size_dt_struct;	 /* size of the structure block */
+};
+
+struct fdt_reserve_entry {
+	uint64_t address;
+	uint64_t size;
+};
+
+struct fdt_node_header {
+	uint32_t tag;
+	char name[0];
+};
+
+struct fdt_property {
+	uint32_t tag;
+	uint32_t len;
+	uint32_t nameoff;
+	char data[0];
+};
+
+#endif /* !__ASSEMBLY */
+
+#define FDT_MAGIC	0xd00dfeed	/* 4: version, 4: total size */
+#define FDT_TAGSIZE	sizeof(uint32_t)
+
+#define FDT_BEGIN_NODE	0x1		/* Start node: full name */
+#define FDT_END_NODE	0x2		/* End node */
+#define FDT_PROP	0x3		/* Property: name off,
+					   size, content */
+#define FDT_NOP		0x4		/* nop */
+#define FDT_END		0x9
+
+#define FDT_V1_SIZE	(7*sizeof(uint32_t))
+#define FDT_V2_SIZE	(FDT_V1_SIZE + sizeof(uint32_t))
+#define FDT_V3_SIZE	(FDT_V2_SIZE + sizeof(uint32_t))
+#define FDT_V16_SIZE	FDT_V3_SIZE
+#define FDT_V17_SIZE	(FDT_V16_SIZE + sizeof(uint32_t))
+
+#endif /* _FDT_H */
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/fdt_ro.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/fdt_ro.c	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,574 @@
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ *
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ *     You should have received a copy of the GNU General Public
+ *     License along with this library; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ *  b) Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *     1. Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *     2. Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "libfdt_env.h"
+
+#include <fdt.h>
+#include <libfdt.h>
+
+#include "libfdt_internal.h"
+
+static int _fdt_nodename_eq(const void *fdt, int offset,
+			    const char *s, int len)
+{
+	const char *p = fdt_offset_ptr(fdt, offset + FDT_TAGSIZE, len+1);
+
+	if (! p)
+		/* short match */
+		return 0;
+
+	if (memcmp(p, s, len) != 0)
+		return 0;
+
+	if (p[len] == '\0')
+		return 1;
+	else if (!memchr(s, '@', len) && (p[len] == '@'))
+		return 1;
+	else
+		return 0;
+}
+
+const char *fdt_string(const void *fdt, int stroffset)
+{
+	return (const char *)fdt + fdt_off_dt_strings(fdt) + stroffset;
+}
+
+static int _fdt_string_eq(const void *fdt, int stroffset,
+			  const char *s, int len)
+{
+	const char *p = fdt_string(fdt, stroffset);
+
+	return (strlen(p) == len) && (memcmp(p, s, len) == 0);
+}
+
+int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size)
+{
+	FDT_CHECK_HEADER(fdt);
+	*address = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->address);
+	*size = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->size);
+	return 0;
+}
+
+int fdt_num_mem_rsv(const void *fdt)
+{
+	int i = 0;
+
+	while (fdt64_to_cpu(_fdt_mem_rsv(fdt, i)->size) != 0)
+		i++;
+	return i;
+}
+
+static int _nextprop(const void *fdt, int offset)
+{
+	uint32_t tag;
+	int nextoffset;
+
+	do {
+		tag = fdt_next_tag(fdt, offset, &nextoffset);
+
+		switch (tag) {
+		case FDT_END:
+			if (nextoffset >= 0)
+				return -FDT_ERR_BADSTRUCTURE;
+			else
+				return nextoffset;
+
+		case FDT_PROP:
+			return offset;
+		}
+		offset = nextoffset;
+	} while (tag == FDT_NOP);
+
+	return -FDT_ERR_NOTFOUND;
+}
+
+int fdt_subnode_offset_namelen(const void *fdt, int offset,
+			       const char *name, int namelen)
+{
+	int depth;
+
+	FDT_CHECK_HEADER(fdt);
+
+	for (depth = 0;
+	     (offset >= 0) && (depth >= 0);
+	     offset = fdt_next_node(fdt, offset, &depth))
+		if ((depth == 1)
+		    && _fdt_nodename_eq(fdt, offset, name, namelen))
+			return offset;
+
+	if (depth < 0)
+		return -FDT_ERR_NOTFOUND;
+	return offset; /* error */
+}
+
+int fdt_subnode_offset(const void *fdt, int parentoffset,
+		       const char *name)
+{
+	return fdt_subnode_offset_namelen(fdt, parentoffset, name, strlen(name));
+}
+
+int fdt_path_offset(const void *fdt, const char *path)
+{
+	const char *end = path + strlen(path);
+	const char *p = path;
+	int offset = 0;
+
+	FDT_CHECK_HEADER(fdt);
+
+	/* see if we have an alias */
+	if (*path != '/') {
+		const char *q = strchr(path, '/');
+
+		if (!q)
+			q = end;
+
+		p = fdt_get_alias_namelen(fdt, p, q - p);
+		if (!p)
+			return -FDT_ERR_BADPATH;
+		offset = fdt_path_offset(fdt, p);
+
+		p = q;
+	}
+
+	while (*p) {
+		const char *q;
+
+		while (*p == '/')
+			p++;
+		if (! *p)
+			return offset;
+		q = strchr(p, '/');
+		if (! q)
+			q = end;
+
+		offset = fdt_subnode_offset_namelen(fdt, offset, p, q-p);
+		if (offset < 0)
+			return offset;
+
+		p = q;
+	}
+
+	return offset;
+}
+
+const char *fdt_get_name(const void *fdt, int nodeoffset, int *len)
+{
+	const struct fdt_node_header *nh = _fdt_offset_ptr(fdt, nodeoffset);
+	int err;
+
+	if (((err = fdt_check_header(fdt)) != 0)
+	    || ((err = _fdt_check_node_offset(fdt, nodeoffset)) < 0))
+			goto fail;
+
+	if (len)
+		*len = strlen(nh->name);
+
+	return nh->name;
+
+ fail:
+	if (len)
+		*len = err;
+	return NULL;
+}
+
+int fdt_first_property_offset(const void *fdt, int nodeoffset)
+{
+	int offset;
+
+	if ((offset = _fdt_check_node_offset(fdt, nodeoffset)) < 0)
+		return offset;
+
+	return _nextprop(fdt, offset);
+}
+
+int fdt_next_property_offset(const void *fdt, int offset)
+{
+	if ((offset = _fdt_check_prop_offset(fdt, offset)) < 0)
+		return offset;
+
+	return _nextprop(fdt, offset);
+}
+
+const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
+						      int offset,
+						      int *lenp)
+{
+	int err;
+	const struct fdt_property *prop;
+
+	if ((err = _fdt_check_prop_offset(fdt, offset)) < 0) {
+		if (lenp)
+			*lenp = err;
+		return NULL;
+	}
+
+	prop = _fdt_offset_ptr(fdt, offset);
+
+	if (lenp)
+		*lenp = fdt32_to_cpu(prop->len);
+
+	return prop;
+}
+
+const struct fdt_property *fdt_get_property_namelen(const void *fdt,
+						    int offset,
+						    const char *name,
+						    int namelen, int *lenp)
+{
+	for (offset = fdt_first_property_offset(fdt, offset);
+	     (offset >= 0);
+	     (offset = fdt_next_property_offset(fdt, offset))) {
+		const struct fdt_property *prop;
+
+		if (!(prop = fdt_get_property_by_offset(fdt, offset, lenp))) {
+			offset = -FDT_ERR_INTERNAL;
+			break;
+		}
+		if (_fdt_string_eq(fdt, fdt32_to_cpu(prop->nameoff),
+				   name, namelen))
+			return prop;
+	}
+
+	if (lenp)
+		*lenp = offset;
+	return NULL;
+}
+
+const struct fdt_property *fdt_get_property(const void *fdt,
+					    int nodeoffset,
+					    const char *name, int *lenp)
+{
+	return fdt_get_property_namelen(fdt, nodeoffset, name,
+					strlen(name), lenp);
+}
+
+const void *fdt_getprop_namelen(const void *fdt, int nodeoffset,
+				const char *name, int namelen, int *lenp)
+{
+	const struct fdt_property *prop;
+
+	prop = fdt_get_property_namelen(fdt, nodeoffset, name, namelen, lenp);
+	if (! prop)
+		return NULL;
+
+	return prop->data;
+}
+
+const void *fdt_getprop_by_offset(const void *fdt, int offset,
+				  const char **namep, int *lenp)
+{
+	const struct fdt_property *prop;
+
+	prop = fdt_get_property_by_offset(fdt, offset, lenp);
+	if (!prop)
+		return NULL;
+	if (namep)
+		*namep = fdt_string(fdt, fdt32_to_cpu(prop->nameoff));
+	return prop->data;
+}
+
+const void *fdt_getprop(const void *fdt, int nodeoffset,
+			const char *name, int *lenp)
+{
+	return fdt_getprop_namelen(fdt, nodeoffset, name, strlen(name), lenp);
+}
+
+uint32_t fdt_get_phandle(const void *fdt, int nodeoffset)
+{
+	const uint32_t *php;
+	int len;
+
+	/* FIXME: This is a bit sub-optimal, since we potentially scan
+	 * over all the properties twice. */
+	php = fdt_getprop(fdt, nodeoffset, "phandle", &len);
+	if (!php || (len != sizeof(*php))) {
+		php = fdt_getprop(fdt, nodeoffset, "linux,phandle", &len);
+		if (!php || (len != sizeof(*php)))
+			return 0;
+	}
+
+	return fdt32_to_cpu(*php);
+}
+
+const char *fdt_get_alias_namelen(const void *fdt,
+				  const char *name, int namelen)
+{
+	int aliasoffset;
+
+	aliasoffset = fdt_path_offset(fdt, "/aliases");
+	if (aliasoffset < 0)
+		return NULL;
+
+	return fdt_getprop_namelen(fdt, aliasoffset, name, namelen, NULL);
+}
+
+const char *fdt_get_alias(const void *fdt, const char *name)
+{
+	return fdt_get_alias_namelen(fdt, name, strlen(name));
+}
+
+int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen)
+{
+	int pdepth = 0, p = 0;
+	int offset, depth, namelen;
+	const char *name;
+
+	FDT_CHECK_HEADER(fdt);
+
+	if (buflen < 2)
+		return -FDT_ERR_NOSPACE;
+
+	for (offset = 0, depth = 0;
+	     (offset >= 0) && (offset <= nodeoffset);
+	     offset = fdt_next_node(fdt, offset, &depth)) {
+		while (pdepth > depth) {
+			do {
+				p--;
+			} while (buf[p-1] != '/');
+			pdepth--;
+		}
+
+		if (pdepth >= depth) {
+			name = fdt_get_name(fdt, offset, &namelen);
+			if (!name)
+				return namelen;
+			if ((p + namelen + 1) <= buflen) {
+				memcpy(buf + p, name, namelen);
+				p += namelen;
+				buf[p++] = '/';
+				pdepth++;
+			}
+		}
+
+		if (offset == nodeoffset) {
+			if (pdepth < (depth + 1))
+				return -FDT_ERR_NOSPACE;
+
+			if (p > 1) /* special case so that root path is "/", not "" */
+				p--;
+			buf[p] = '\0';
+			return 0;
+		}
+	}
+
+	if ((offset == -FDT_ERR_NOTFOUND) || (offset >= 0))
+		return -FDT_ERR_BADOFFSET;
+	else if (offset == -FDT_ERR_BADOFFSET)
+		return -FDT_ERR_BADSTRUCTURE;
+
+	return offset; /* error from fdt_next_node() */
+}
+
+int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset,
+				 int supernodedepth, int *nodedepth)
+{
+	int offset, depth;
+	int supernodeoffset = -FDT_ERR_INTERNAL;
+
+	FDT_CHECK_HEADER(fdt);
+
+	if (supernodedepth < 0)
+		return -FDT_ERR_NOTFOUND;
+
+	for (offset = 0, depth = 0;
+	     (offset >= 0) && (offset <= nodeoffset);
+	     offset = fdt_next_node(fdt, offset, &depth)) {
+		if (depth == supernodedepth)
+			supernodeoffset = offset;
+
+		if (offset == nodeoffset) {
+			if (nodedepth)
+				*nodedepth = depth;
+
+			if (supernodedepth > depth)
+				return -FDT_ERR_NOTFOUND;
+			else
+				return supernodeoffset;
+		}
+	}
+
+	if ((offset == -FDT_ERR_NOTFOUND) || (offset >= 0))
+		return -FDT_ERR_BADOFFSET;
+	else if (offset == -FDT_ERR_BADOFFSET)
+		return -FDT_ERR_BADSTRUCTURE;
+
+	return offset; /* error from fdt_next_node() */
+}
+
+int fdt_node_depth(const void *fdt, int nodeoffset)
+{
+	int nodedepth;
+	int err;
+
+	err = fdt_supernode_atdepth_offset(fdt, nodeoffset, 0, &nodedepth);
+	if (err)
+		return (err < 0) ? err : -FDT_ERR_INTERNAL;
+	return nodedepth;
+}
+
+int fdt_parent_offset(const void *fdt, int nodeoffset)
+{
+	int nodedepth = fdt_node_depth(fdt, nodeoffset);
+
+	if (nodedepth < 0)
+		return nodedepth;
+	return fdt_supernode_atdepth_offset(fdt, nodeoffset,
+					    nodedepth - 1, NULL);
+}
+
+int fdt_node_offset_by_prop_value(const void *fdt, int startoffset,
+				  const char *propname,
+				  const void *propval, int proplen)
+{
+	int offset;
+	const void *val;
+	int len;
+
+	FDT_CHECK_HEADER(fdt);
+
+	/* FIXME: The algorithm here is pretty horrible: we scan each
+	 * property of a node in fdt_getprop(), then if that didn't
+	 * find what we want, we scan over them again making our way
+	 * to the next node.  Still it's the easiest to implement
+	 * approach; performance can come later. */
+	for (offset = fdt_next_node(fdt, startoffset, NULL);
+	     offset >= 0;
+	     offset = fdt_next_node(fdt, offset, NULL)) {
+		val = fdt_getprop(fdt, offset, propname, &len);
+		if (val && (len == proplen)
+		    && (memcmp(val, propval, len) == 0))
+			return offset;
+	}
+
+	return offset; /* error from fdt_next_node() */
+}
+
+int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle)
+{
+	int offset;
+
+	if ((phandle == 0) || (phandle == -1))
+		return -FDT_ERR_BADPHANDLE;
+
+	FDT_CHECK_HEADER(fdt);
+
+	/* FIXME: The algorithm here is pretty horrible: we
+	 * potentially scan each property of a node in
+	 * fdt_get_phandle(), then if that didn't find what
+	 * we want, we scan over them again making our way to the next
+	 * node.  Still it's the easiest to implement approach;
+	 * performance can come later. */
+	for (offset = fdt_next_node(fdt, -1, NULL);
+	     offset >= 0;
+	     offset = fdt_next_node(fdt, offset, NULL)) {
+		if (fdt_get_phandle(fdt, offset) == phandle)
+			return offset;
+	}
+
+	return offset; /* error from fdt_next_node() */
+}
+
+static int _fdt_stringlist_contains(const char *strlist, int listlen,
+				    const char *str)
+{
+	int len = strlen(str);
+	const char *p;
+
+	while (listlen >= len) {
+		if (memcmp(str, strlist, len+1) == 0)
+			return 1;
+		p = memchr(strlist, '\0', listlen);
+		if (!p)
+			return 0; /* malformed strlist.. */
+		listlen -= (p-strlist) + 1;
+		strlist = p + 1;
+	}
+	return 0;
+}
+
+int fdt_node_check_compatible(const void *fdt, int nodeoffset,
+			      const char *compatible)
+{
+	const void *prop;
+	int len;
+
+	prop = fdt_getprop(fdt, nodeoffset, "compatible", &len);
+	if (!prop)
+		return len;
+	if (_fdt_stringlist_contains(prop, len, compatible))
+		return 0;
+	else
+		return 1;
+}
+
+int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
+				  const char *compatible)
+{
+	int offset, err;
+
+	FDT_CHECK_HEADER(fdt);
+
+	/* FIXME: The algorithm here is pretty horrible: we scan each
+	 * property of a node in fdt_node_check_compatible(), then if
+	 * that didn't find what we want, we scan over them again
+	 * making our way to the next node.  Still it's the easiest to
+	 * implement approach; performance can come later. */
+	for (offset = fdt_next_node(fdt, startoffset, NULL);
+	     offset >= 0;
+	     offset = fdt_next_node(fdt, offset, NULL)) {
+		err = fdt_node_check_compatible(fdt, offset, compatible);
+		if ((err < 0) && (err != -FDT_ERR_NOTFOUND))
+			return err;
+		else if (err == 0)
+			return offset;
+	}
+
+	return offset; /* error from fdt_next_node() */
+}
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/fdt_rw.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/fdt_rw.c	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,465 @@
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ *
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ *     You should have received a copy of the GNU General Public
+ *     License along with this library; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ *  b) Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *     1. Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *     2. Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "libfdt_env.h"
+
+#include <fdt.h>
+#include <libfdt.h>
+
+#include "libfdt_internal.h"
+
+static int _fdt_blocks_misordered(const void *fdt,
+			      int mem_rsv_size, int struct_size)
+{
+	return (fdt_off_mem_rsvmap(fdt) < FDT_ALIGN(sizeof(struct fdt_header), 8))
+		|| (fdt_off_dt_struct(fdt) <
+		    (fdt_off_mem_rsvmap(fdt) + mem_rsv_size))
+		|| (fdt_off_dt_strings(fdt) <
+		    (fdt_off_dt_struct(fdt) + struct_size))
+		|| (fdt_totalsize(fdt) <
+		    (fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt)));
+}
+
+static int _fdt_rw_check_header(void *fdt)
+{
+	FDT_CHECK_HEADER(fdt);
+
+	if (fdt_version(fdt) < 17)
+		return -FDT_ERR_BADVERSION;
+	if (_fdt_blocks_misordered(fdt, sizeof(struct fdt_reserve_entry),
+				   fdt_size_dt_struct(fdt)))
+		return -FDT_ERR_BADLAYOUT;
+	if (fdt_version(fdt) > 17)
+		fdt_set_version(fdt, 17);
+
+	return 0;
+}
+
+#define FDT_RW_CHECK_HEADER(fdt) \
+	{ \
+		int err; \
+		if ((err = _fdt_rw_check_header(fdt)) != 0) \
+			return err; \
+	}
+
+static inline int _fdt_data_size(void *fdt)
+{
+	return fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt);
+}
+
+static int _fdt_splice(void *fdt, void *splicepoint, int oldlen, int newlen)
+{
+	char *p = splicepoint;
+	char *end = (char *)fdt + _fdt_data_size(fdt);
+
+	if (((p + oldlen) < p) || ((p + oldlen) > end))
+		return -FDT_ERR_BADOFFSET;
+	if ((end - oldlen + newlen) > ((char *)fdt + fdt_totalsize(fdt)))
+		return -FDT_ERR_NOSPACE;
+	memmove(p + newlen, p + oldlen, end - p - oldlen);
+	return 0;
+}
+
+static int _fdt_splice_mem_rsv(void *fdt, struct fdt_reserve_entry *p,
+			       int oldn, int newn)
+{
+	int delta = (newn - oldn) * sizeof(*p);
+	int err;
+	err = _fdt_splice(fdt, p, oldn * sizeof(*p), newn * sizeof(*p));
+	if (err)
+		return err;
+	fdt_set_off_dt_struct(fdt, fdt_off_dt_struct(fdt) + delta);
+	fdt_set_off_dt_strings(fdt, fdt_off_dt_strings(fdt) + delta);
+	return 0;
+}
+
+static int _fdt_splice_struct(void *fdt, void *p,
+			      int oldlen, int newlen)
+{
+	int delta = newlen - oldlen;
+	int err;
+
+	if ((err = _fdt_splice(fdt, p, oldlen, newlen)))
+		return err;
+
+	fdt_set_size_dt_struct(fdt, fdt_size_dt_struct(fdt) + delta);
+	fdt_set_off_dt_strings(fdt, fdt_off_dt_strings(fdt) + delta);
+	return 0;
+}
+
+static int _fdt_splice_string(void *fdt, int newlen)
+{
+	void *p = (char *)fdt
+		+ fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt);
+	int err;
+
+	if ((err = _fdt_splice(fdt, p, 0, newlen)))
+		return err;
+
+	fdt_set_size_dt_strings(fdt, fdt_size_dt_strings(fdt) + newlen);
+	return 0;
+}
+
+static int _fdt_find_add_string(void *fdt, const char *s)
+{
+	char *strtab = (char *)fdt + fdt_off_dt_strings(fdt);
+	const char *p;
+	char *new;
+	int len = strlen(s) + 1;
+	int err;
+
+	p = _fdt_find_string(strtab, fdt_size_dt_strings(fdt), s);
+	if (p)
+		/* found it */
+		return (p - strtab);
+
+	new = strtab + fdt_size_dt_strings(fdt);
+	err = _fdt_splice_string(fdt, len);
+	if (err)
+		return err;
+
+	memcpy(new, s, len);
+	return (new - strtab);
+}
+
+int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size)
+{
+	struct fdt_reserve_entry *re;
+	int err;
+
+	FDT_RW_CHECK_HEADER(fdt);
+
+	re = _fdt_mem_rsv_w(fdt, fdt_num_mem_rsv(fdt));
+	err = _fdt_splice_mem_rsv(fdt, re, 0, 1);
+	if (err)
+		return err;
+
+	re->address = cpu_to_fdt64(address);
+	re->size = cpu_to_fdt64(size);
+	return 0;
+}
+
+int fdt_del_mem_rsv(void *fdt, int n)
+{
+	struct fdt_reserve_entry *re = _fdt_mem_rsv_w(fdt, n);
+	int err;
+
+	FDT_RW_CHECK_HEADER(fdt);
+
+	if (n >= fdt_num_mem_rsv(fdt))
+		return -FDT_ERR_NOTFOUND;
+
+	err = _fdt_splice_mem_rsv(fdt, re, 1, 0);
+	if (err)
+		return err;
+	return 0;
+}
+
+static int _fdt_resize_property(void *fdt, int nodeoffset, const char *name,
+				int len, struct fdt_property **prop)
+{
+	int oldlen;
+	int err;
+
+	*prop = fdt_get_property_w(fdt, nodeoffset, name, &oldlen);
+	if (! (*prop))
+		return oldlen;
+
+	if ((err = _fdt_splice_struct(fdt, (*prop)->data, FDT_TAGALIGN(oldlen),
+				      FDT_TAGALIGN(len))))
+		return err;
+
+	(*prop)->len = cpu_to_fdt32(len);
+	return 0;
+}
+
+static int _fdt_add_property(void *fdt, int nodeoffset, const char *name,
+			     int len, struct fdt_property **prop)
+{
+	int proplen;
+	int nextoffset;
+	int namestroff;
+	int err;
+
+	if ((nextoffset = _fdt_check_node_offset(fdt, nodeoffset)) < 0)
+		return nextoffset;
+
+	namestroff = _fdt_find_add_string(fdt, name);
+	if (namestroff < 0)
+		return namestroff;
+
+	*prop = _fdt_offset_ptr_w(fdt, nextoffset);
+	proplen = sizeof(**prop) + FDT_TAGALIGN(len);
+
+	err = _fdt_splice_struct(fdt, *prop, 0, proplen);
+	if (err)
+		return err;
+
+	(*prop)->tag = cpu_to_fdt32(FDT_PROP);
+	(*prop)->nameoff = cpu_to_fdt32(namestroff);
+	(*prop)->len = cpu_to_fdt32(len);
+	return 0;
+}
+
+int fdt_set_name(void *fdt, int nodeoffset, const char *name)
+{
+	char *namep;
+	int oldlen, newlen;
+	int err;
+
+	FDT_RW_CHECK_HEADER(fdt);
+
+	namep = (char *)(uintptr_t)fdt_get_name(fdt, nodeoffset, &oldlen);
+	if (!namep)
+		return oldlen;
+
+	newlen = strlen(name);
+
+	err = _fdt_splice_struct(fdt, namep, FDT_TAGALIGN(oldlen+1),
+				 FDT_TAGALIGN(newlen+1));
+	if (err)
+		return err;
+
+	memcpy(namep, name, newlen+1);
+	return 0;
+}
+
+int fdt_setprop(void *fdt, int nodeoffset, const char *name,
+		const void *val, int len)
+{
+	struct fdt_property *prop;
+	int err;
+
+	FDT_RW_CHECK_HEADER(fdt);
+
+	err = _fdt_resize_property(fdt, nodeoffset, name, len, &prop);
+	if (err == -FDT_ERR_NOTFOUND)
+		err = _fdt_add_property(fdt, nodeoffset, name, len, &prop);
+	if (err)
+		return err;
+
+	memcpy(prop->data, val, len);
+	return 0;
+}
+
+int fdt_delprop(void *fdt, int nodeoffset, const char *name)
+{
+	struct fdt_property *prop;
+	int len, proplen;
+
+	FDT_RW_CHECK_HEADER(fdt);
+
+	prop = fdt_get_property_w(fdt, nodeoffset, name, &len);
+	if (! prop)
+		return len;
+
+	proplen = sizeof(*prop) + FDT_TAGALIGN(len);
+	return _fdt_splice_struct(fdt, prop, proplen, 0);
+}
+
+int fdt_add_subnode_namelen(void *fdt, int parentoffset,
+			    const char *name, int namelen)
+{
+	struct fdt_node_header *nh;
+	int offset, nextoffset;
+	int nodelen;
+	int err;
+	uint32_t tag;
+	uint32_t *endtag;
+
+	FDT_RW_CHECK_HEADER(fdt);
+
+	offset = fdt_subnode_offset_namelen(fdt, parentoffset, name, namelen);
+	if (offset >= 0)
+		return -FDT_ERR_EXISTS;
+	else if (offset != -FDT_ERR_NOTFOUND)
+		return offset;
+
+	/* Try to place the new node after the parent's properties */
+	fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */
+	do {
+		offset = nextoffset;
+		tag = fdt_next_tag(fdt, offset, &nextoffset);
+	} while ((tag == FDT_PROP) || (tag == FDT_NOP));
+
+	nh = _fdt_offset_ptr_w(fdt, offset);
+	nodelen = sizeof(*nh) + FDT_TAGALIGN(namelen+1) + FDT_TAGSIZE;
+
+	err = _fdt_splice_struct(fdt, nh, 0, nodelen);
+	if (err)
+		return err;
+
+	nh->tag = cpu_to_fdt32(FDT_BEGIN_NODE);
+	memset(nh->name, 0, FDT_TAGALIGN(namelen+1));
+	memcpy(nh->name, name, namelen);
+	endtag = (uint32_t *)((char *)nh + nodelen - FDT_TAGSIZE);
+	*endtag = cpu_to_fdt32(FDT_END_NODE);
+
+	return offset;
+}
+
+int fdt_add_subnode(void *fdt, int parentoffset, const char *name)
+{
+	return fdt_add_subnode_namelen(fdt, parentoffset, name, strlen(name));
+}
+
+int fdt_del_node(void *fdt, int nodeoffset)
+{
+	int endoffset;
+
+	FDT_RW_CHECK_HEADER(fdt);
+
+	endoffset = _fdt_node_end_offset(fdt, nodeoffset);
+	if (endoffset < 0)
+		return endoffset;
+
+	return _fdt_splice_struct(fdt, _fdt_offset_ptr_w(fdt, nodeoffset),
+				  endoffset - nodeoffset, 0);
+}
+
+static void _fdt_packblocks(const char *old, char *new,
+			    int mem_rsv_size, int struct_size)
+{
+	int mem_rsv_off, struct_off, strings_off;
+
+	mem_rsv_off = FDT_ALIGN(sizeof(struct fdt_header), 8);
+	struct_off = mem_rsv_off + mem_rsv_size;
+	strings_off = struct_off + struct_size;
+
+	memmove(new + mem_rsv_off, old + fdt_off_mem_rsvmap(old), mem_rsv_size);
+	fdt_set_off_mem_rsvmap(new, mem_rsv_off);
+
+	memmove(new + struct_off, old + fdt_off_dt_struct(old), struct_size);
+	fdt_set_off_dt_struct(new, struct_off);
+	fdt_set_size_dt_struct(new, struct_size);
+
+	memmove(new + strings_off, old + fdt_off_dt_strings(old),
+		fdt_size_dt_strings(old));
+	fdt_set_off_dt_strings(new, strings_off);
+	fdt_set_size_dt_strings(new, fdt_size_dt_strings(old));
+}
+
+int fdt_open_into(const void *fdt, void *buf, int bufsize)
+{
+	int err;
+	int mem_rsv_size, struct_size;
+	int newsize;
+	const char *fdtstart = fdt;
+	const char *fdtend = fdtstart + fdt_totalsize(fdt);
+	char *tmp;
+
+	FDT_CHECK_HEADER(fdt);
+
+	mem_rsv_size = (fdt_num_mem_rsv(fdt)+1)
+		* sizeof(struct fdt_reserve_entry);
+
+	if (fdt_version(fdt) >= 17) {
+		struct_size = fdt_size_dt_struct(fdt);
+	} else {
+		struct_size = 0;
+		while (fdt_next_tag(fdt, struct_size, &struct_size) != FDT_END)
+			;
+		if (struct_size < 0)
+			return struct_size;
+	}
+
+	if (!_fdt_blocks_misordered(fdt, mem_rsv_size, struct_size)) {
+		/* no further work necessary */
+		err = fdt_move(fdt, buf, bufsize);
+		if (err)
+			return err;
+		fdt_set_version(buf, 17);
+		fdt_set_size_dt_struct(buf, struct_size);
+		fdt_set_totalsize(buf, bufsize);
+		return 0;
+	}
+
+	/* Need to reorder */
+	newsize = FDT_ALIGN(sizeof(struct fdt_header), 8) + mem_rsv_size
+		+ struct_size + fdt_size_dt_strings(fdt);
+
+	if (bufsize < newsize)
+		return -FDT_ERR_NOSPACE;
+
+	/* First attempt to build converted tree at beginning of buffer */
+	tmp = buf;
+	/* But if that overlaps with the old tree... */
+	if (((tmp + newsize) > fdtstart) && (tmp < fdtend)) {
+		/* Try right after the old tree instead */
+		tmp = (char *)(uintptr_t)fdtend;
+		if ((tmp + newsize) > ((char *)buf + bufsize))
+			return -FDT_ERR_NOSPACE;
+	}
+
+	_fdt_packblocks(fdt, tmp, mem_rsv_size, struct_size);
+	memmove(buf, tmp, newsize);
+
+	fdt_set_magic(buf, FDT_MAGIC);
+	fdt_set_totalsize(buf, bufsize);
+	fdt_set_version(buf, 17);
+	fdt_set_last_comp_version(buf, 16);
+	fdt_set_boot_cpuid_phys(buf, fdt_boot_cpuid_phys(fdt));
+
+	return 0;
+}
+
+int fdt_pack(void *fdt)
+{
+	int mem_rsv_size;
+
+	FDT_RW_CHECK_HEADER(fdt);
+
+	mem_rsv_size = (fdt_num_mem_rsv(fdt)+1)
+		* sizeof(struct fdt_reserve_entry);
+	_fdt_packblocks(fdt, fdt, mem_rsv_size, fdt_size_dt_struct(fdt));
+	fdt_set_totalsize(fdt, _fdt_data_size(fdt));
+
+	return 0;
+}
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/fdt_strerror.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/fdt_strerror.c	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,96 @@
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ *
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ *     You should have received a copy of the GNU General Public
+ *     License along with this library; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ *  b) Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *     1. Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *     2. Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "libfdt_env.h"
+
+#include <fdt.h>
+#include <libfdt.h>
+
+#include "libfdt_internal.h"
+
+struct fdt_errtabent {
+	const char *str;
+};
+
+#define FDT_ERRTABENT(val) \
+	[(val)] = { .str = #val, }
+
+static struct fdt_errtabent fdt_errtable[] = {
+	FDT_ERRTABENT(FDT_ERR_NOTFOUND),
+	FDT_ERRTABENT(FDT_ERR_EXISTS),
+	FDT_ERRTABENT(FDT_ERR_NOSPACE),
+
+	FDT_ERRTABENT(FDT_ERR_BADOFFSET),
+	FDT_ERRTABENT(FDT_ERR_BADPATH),
+	FDT_ERRTABENT(FDT_ERR_BADSTATE),
+
+	FDT_ERRTABENT(FDT_ERR_TRUNCATED),
+	FDT_ERRTABENT(FDT_ERR_BADMAGIC),
+	FDT_ERRTABENT(FDT_ERR_BADVERSION),
+	FDT_ERRTABENT(FDT_ERR_BADSTRUCTURE),
+	FDT_ERRTABENT(FDT_ERR_BADLAYOUT),
+};
+#define FDT_ERRTABSIZE	(sizeof(fdt_errtable) / sizeof(fdt_errtable[0]))
+
+const char *fdt_strerror(int errval)
+{
+	if (errval > 0)
+		return "<valid offset/length>";
+	else if (errval == 0)
+		return "<no error>";
+	else if (errval > -FDT_ERRTABSIZE) {
+		const char *s = fdt_errtable[-errval].str;
+
+		if (s)
+			return s;
+	}
+
+	return "<unknown error>";
+}
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/fdt_sw.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/fdt_sw.c	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,256 @@
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ *
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ *     You should have received a copy of the GNU General Public
+ *     License along with this library; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ *  b) Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *     1. Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *     2. Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "libfdt_env.h"
+
+#include <fdt.h>
+#include <libfdt.h>
+
+#include "libfdt_internal.h"
+
+static int _fdt_sw_check_header(void *fdt)
+{
+	if (fdt_magic(fdt) != FDT_SW_MAGIC)
+		return -FDT_ERR_BADMAGIC;
+	/* FIXME: should check more details about the header state */
+	return 0;
+}
+
+#define FDT_SW_CHECK_HEADER(fdt) \
+	{ \
+		int err; \
+		if ((err = _fdt_sw_check_header(fdt)) != 0) \
+			return err; \
+	}
+
+static void *_fdt_grab_space(void *fdt, size_t len)
+{
+	int offset = fdt_size_dt_struct(fdt);
+	int spaceleft;
+
+	spaceleft = fdt_totalsize(fdt) - fdt_off_dt_struct(fdt)
+		- fdt_size_dt_strings(fdt);
+
+	if ((offset + len < offset) || (offset + len > spaceleft))
+		return NULL;
+
+	fdt_set_size_dt_struct(fdt, offset + len);
+	return _fdt_offset_ptr_w(fdt, offset);
+}
+
+int fdt_create(void *buf, int bufsize)
+{
+	void *fdt = buf;
+
+	if (bufsize < sizeof(struct fdt_header))
+		return -FDT_ERR_NOSPACE;
+
+	memset(buf, 0, bufsize);
+
+	fdt_set_magic(fdt, FDT_SW_MAGIC);
+	fdt_set_version(fdt, FDT_LAST_SUPPORTED_VERSION);
+	fdt_set_last_comp_version(fdt, FDT_FIRST_SUPPORTED_VERSION);
+	fdt_set_totalsize(fdt,  bufsize);
+
+	fdt_set_off_mem_rsvmap(fdt, FDT_ALIGN(sizeof(struct fdt_header),
+					      sizeof(struct fdt_reserve_entry)));
+	fdt_set_off_dt_struct(fdt, fdt_off_mem_rsvmap(fdt));
+	fdt_set_off_dt_strings(fdt, bufsize);
+
+	return 0;
+}
+
+int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size)
+{
+	struct fdt_reserve_entry *re;
+	int offset;
+
+	FDT_SW_CHECK_HEADER(fdt);
+
+	if (fdt_size_dt_struct(fdt))
+		return -FDT_ERR_BADSTATE;
+
+	offset = fdt_off_dt_struct(fdt);
+	if ((offset + sizeof(*re)) > fdt_totalsize(fdt))
+		return -FDT_ERR_NOSPACE;
+
+	re = (struct fdt_reserve_entry *)((char *)fdt + offset);
+	re->address = cpu_to_fdt64(addr);
+	re->size = cpu_to_fdt64(size);
+
+	fdt_set_off_dt_struct(fdt, offset + sizeof(*re));
+
+	return 0;
+}
+
+int fdt_finish_reservemap(void *fdt)
+{
+	return fdt_add_reservemap_entry(fdt, 0, 0);
+}
+
+int fdt_begin_node(void *fdt, const char *name)
+{
+	struct fdt_node_header *nh;
+	int namelen = strlen(name) + 1;
+
+	FDT_SW_CHECK_HEADER(fdt);
+
+	nh = _fdt_grab_space(fdt, sizeof(*nh) + FDT_TAGALIGN(namelen));
+	if (! nh)
+		return -FDT_ERR_NOSPACE;
+
+	nh->tag = cpu_to_fdt32(FDT_BEGIN_NODE);
+	memcpy(nh->name, name, namelen);
+	return 0;
+}
+
+int fdt_end_node(void *fdt)
+{
+	uint32_t *en;
+
+	FDT_SW_CHECK_HEADER(fdt);
+
+	en = _fdt_grab_space(fdt, FDT_TAGSIZE);
+	if (! en)
+		return -FDT_ERR_NOSPACE;
+
+	*en = cpu_to_fdt32(FDT_END_NODE);
+	return 0;
+}
+
+static int _fdt_find_add_string(void *fdt, const char *s)
+{
+	char *strtab = (char *)fdt + fdt_totalsize(fdt);
+	const char *p;
+	int strtabsize = fdt_size_dt_strings(fdt);
+	int len = strlen(s) + 1;
+	int struct_top, offset;
+
+	p = _fdt_find_string(strtab - strtabsize, strtabsize, s);
+	if (p)
+		return p - strtab;
+
+	/* Add it */
+	offset = -strtabsize - len;
+	struct_top = fdt_off_dt_struct(fdt) + fdt_size_dt_struct(fdt);
+	if (fdt_totalsize(fdt) + offset < struct_top)
+		return 0; /* no more room :( */
+
+	memcpy(strtab + offset, s, len);
+	fdt_set_size_dt_strings(fdt, strtabsize + len);
+	return offset;
+}
+
+int fdt_property(void *fdt, const char *name, const void *val, int len)
+{
+	struct fdt_property *prop;
+	int nameoff;
+
+	FDT_SW_CHECK_HEADER(fdt);
+
+	nameoff = _fdt_find_add_string(fdt, name);
+	if (nameoff == 0)
+		return -FDT_ERR_NOSPACE;
+
+	prop = _fdt_grab_space(fdt, sizeof(*prop) + FDT_TAGALIGN(len));
+	if (! prop)
+		return -FDT_ERR_NOSPACE;
+
+	prop->tag = cpu_to_fdt32(FDT_PROP);
+	prop->nameoff = cpu_to_fdt32(nameoff);
+	prop->len = cpu_to_fdt32(len);
+	memcpy(prop->data, val, len);
+	return 0;
+}
+
+int fdt_finish(void *fdt)
+{
+	char *p = (char *)fdt;
+	uint32_t *end;
+	int oldstroffset, newstroffset;
+	uint32_t tag;
+	int offset, nextoffset;
+
+	FDT_SW_CHECK_HEADER(fdt);
+
+	/* Add terminator */
+	end = _fdt_grab_space(fdt, sizeof(*end));
+	if (! end)
+		return -FDT_ERR_NOSPACE;
+	*end = cpu_to_fdt32(FDT_END);
+
+	/* Relocate the string table */
+	oldstroffset = fdt_totalsize(fdt) - fdt_size_dt_strings(fdt);
+	newstroffset = fdt_off_dt_struct(fdt) + fdt_size_dt_struct(fdt);
+	memmove(p + newstroffset, p + oldstroffset, fdt_size_dt_strings(fdt));
+	fdt_set_off_dt_strings(fdt, newstroffset);
+
+	/* Walk the structure, correcting string offsets */
+	offset = 0;
+	while ((tag = fdt_next_tag(fdt, offset, &nextoffset)) != FDT_END) {
+		if (tag == FDT_PROP) {
+			struct fdt_property *prop =
+				_fdt_offset_ptr_w(fdt, offset);
+			int nameoff;
+
+			nameoff = fdt32_to_cpu(prop->nameoff);
+			nameoff += fdt_size_dt_strings(fdt);
+			prop->nameoff = cpu_to_fdt32(nameoff);
+		}
+		offset = nextoffset;
+	}
+	if (nextoffset < 0)
+		return nextoffset;
+
+	/* Finally, adjust the header */
+	fdt_set_totalsize(fdt, newstroffset + fdt_size_dt_strings(fdt));
+	fdt_set_magic(fdt, FDT_MAGIC);
+	return 0;
+}
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/fdt_wip.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/fdt_wip.c	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,118 @@
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ *
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ *     You should have received a copy of the GNU General Public
+ *     License along with this library; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ *  b) Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *     1. Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *     2. Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "libfdt_env.h"
+
+#include <fdt.h>
+#include <libfdt.h>
+
+#include "libfdt_internal.h"
+
+int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
+			const void *val, int len)
+{
+	void *propval;
+	int proplen;
+
+	propval = fdt_getprop_w(fdt, nodeoffset, name, &proplen);
+	if (! propval)
+		return proplen;
+
+	if (proplen != len)
+		return -FDT_ERR_NOSPACE;
+
+	memcpy(propval, val, len);
+	return 0;
+}
+
+static void _fdt_nop_region(void *start, int len)
+{
+	uint32_t *p;
+
+	for (p = start; (char *)p < ((char *)start + len); p++)
+		*p = cpu_to_fdt32(FDT_NOP);
+}
+
+int fdt_nop_property(void *fdt, int nodeoffset, const char *name)
+{
+	struct fdt_property *prop;
+	int len;
+
+	prop = fdt_get_property_w(fdt, nodeoffset, name, &len);
+	if (! prop)
+		return len;
+
+	_fdt_nop_region(prop, len + sizeof(*prop));
+
+	return 0;
+}
+
+int _fdt_node_end_offset(void *fdt, int offset)
+{
+	int depth = 0;
+
+	while ((offset >= 0) && (depth >= 0))
+		offset = fdt_next_node(fdt, offset, &depth);
+
+	return offset;
+}
+
+int fdt_nop_node(void *fdt, int nodeoffset)
+{
+	int endoffset;
+
+	endoffset = _fdt_node_end_offset(fdt, nodeoffset);
+	if (endoffset < 0)
+		return endoffset;
+
+	_fdt_nop_region(fdt_offset_ptr_w(fdt, nodeoffset, 0),
+			endoffset - nodeoffset);
+	return 0;
+}
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/libfdt.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/libfdt.h	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,1235 @@
+#ifndef _LIBFDT_H
+#define _LIBFDT_H
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ *
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ *     You should have received a copy of the GNU General Public
+ *     License along with this library; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ *  b) Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *     1. Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *     2. Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <libfdt_env.h>
+#include <fdt.h>
+
+#define FDT_FIRST_SUPPORTED_VERSION	0x10
+#define FDT_LAST_SUPPORTED_VERSION	0x11
+
+/* Error codes: informative error codes */
+#define FDT_ERR_NOTFOUND	1
+	/* FDT_ERR_NOTFOUND: The requested node or property does not exist */
+#define FDT_ERR_EXISTS		2
+	/* FDT_ERR_EXISTS: Attemped to create a node or property which
+	 * already exists */
+#define FDT_ERR_NOSPACE		3
+	/* FDT_ERR_NOSPACE: Operation needed to expand the device
+	 * tree, but its buffer did not have sufficient space to
+	 * contain the expanded tree. Use fdt_open_into() to move the
+	 * device tree to a buffer with more space. */
+
+/* Error codes: codes for bad parameters */
+#define FDT_ERR_BADOFFSET	4
+	/* FDT_ERR_BADOFFSET: Function was passed a structure block
+	 * offset which is out-of-bounds, or which points to an
+	 * unsuitable part of the structure for the operation. */
+#define FDT_ERR_BADPATH		5
+	/* FDT_ERR_BADPATH: Function was passed a badly formatted path
+	 * (e.g. missing a leading / for a function which requires an
+	 * absolute path) */
+#define FDT_ERR_BADPHANDLE	6
+	/* FDT_ERR_BADPHANDLE: Function was passed an invalid phandle
+	 * value.  phandle values of 0 and -1 are not permitted. */
+#define FDT_ERR_BADSTATE	7
+	/* FDT_ERR_BADSTATE: Function was passed an incomplete device
+	 * tree created by the sequential-write functions, which is
+	 * not sufficiently complete for the requested operation. */
+
+/* Error codes: codes for bad device tree blobs */
+#define FDT_ERR_TRUNCATED	8
+	/* FDT_ERR_TRUNCATED: Structure block of the given device tree
+	 * ends without an FDT_END tag. */
+#define FDT_ERR_BADMAGIC	9
+	/* FDT_ERR_BADMAGIC: Given "device tree" appears not to be a
+	 * device tree at all - it is missing the flattened device
+	 * tree magic number. */
+#define FDT_ERR_BADVERSION	10
+	/* FDT_ERR_BADVERSION: Given device tree has a version which
+	 * can't be handled by the requested operation.  For
+	 * read-write functions, this may mean that fdt_open_into() is
+	 * required to convert the tree to the expected version. */
+#define FDT_ERR_BADSTRUCTURE	11
+	/* FDT_ERR_BADSTRUCTURE: Given device tree has a corrupt
+	 * structure block or other serious error (e.g. misnested
+	 * nodes, or subnodes preceding properties). */
+#define FDT_ERR_BADLAYOUT	12
+	/* FDT_ERR_BADLAYOUT: For read-write functions, the given
+	 * device tree has it's sub-blocks in an order that the
+	 * function can't handle (memory reserve map, then structure,
+	 * then strings).  Use fdt_open_into() to reorganize the tree
+	 * into a form suitable for the read-write operations. */
+
+/* "Can't happen" error indicating a bug in libfdt */
+#define FDT_ERR_INTERNAL	13
+	/* FDT_ERR_INTERNAL: libfdt has failed an internal assertion.
+	 * Should never be returned, if it is, it indicates a bug in
+	 * libfdt itself. */
+
+#define FDT_ERR_MAX		13
+
+/**********************************************************************/
+/* Low-level functions (you probably don't need these)                */
+/**********************************************************************/
+
+const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen);
+static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
+{
+	return (void *)(uintptr_t)fdt_offset_ptr(fdt, offset, checklen);
+}
+
+uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset);
+
+/**********************************************************************/
+/* Traversal functions                                                */
+/**********************************************************************/
+
+int fdt_next_node(const void *fdt, int offset, int *depth);
+
+/**********************************************************************/
+/* General functions                                                  */
+/**********************************************************************/
+
+#define fdt_get_header(fdt, field) \
+	(fdt32_to_cpu(((const struct fdt_header *)(fdt))->field))
+#define fdt_magic(fdt) 			(fdt_get_header(fdt, magic))
+#define fdt_totalsize(fdt)		(fdt_get_header(fdt, totalsize))
+#define fdt_off_dt_struct(fdt)		(fdt_get_header(fdt, off_dt_struct))
+#define fdt_off_dt_strings(fdt)		(fdt_get_header(fdt, off_dt_strings))
+#define fdt_off_mem_rsvmap(fdt)		(fdt_get_header(fdt, off_mem_rsvmap))
+#define fdt_version(fdt)		(fdt_get_header(fdt, version))
+#define fdt_last_comp_version(fdt) 	(fdt_get_header(fdt, last_comp_version))
+#define fdt_boot_cpuid_phys(fdt) 	(fdt_get_header(fdt, boot_cpuid_phys))
+#define fdt_size_dt_strings(fdt) 	(fdt_get_header(fdt, size_dt_strings))
+#define fdt_size_dt_struct(fdt)		(fdt_get_header(fdt, size_dt_struct))
+
+#define __fdt_set_hdr(name) \
+	static inline void fdt_set_##name(void *fdt, uint32_t val) \
+	{ \
+		struct fdt_header *fdth = (struct fdt_header*)fdt; \
+		fdth->name = cpu_to_fdt32(val); \
+	}
+__fdt_set_hdr(magic);
+__fdt_set_hdr(totalsize);
+__fdt_set_hdr(off_dt_struct);
+__fdt_set_hdr(off_dt_strings);
+__fdt_set_hdr(off_mem_rsvmap);
+__fdt_set_hdr(version);
+__fdt_set_hdr(last_comp_version);
+__fdt_set_hdr(boot_cpuid_phys);
+__fdt_set_hdr(size_dt_strings);
+__fdt_set_hdr(size_dt_struct);
+#undef __fdt_set_hdr
+
+/**
+ * fdt_check_header - sanity check a device tree or possible device tree
+ * @fdt: pointer to data which might be a flattened device tree
+ *
+ * fdt_check_header() checks that the given buffer contains what
+ * appears to be a flattened device tree with sane information in its
+ * header.
+ *
+ * returns:
+ *     0, if the buffer appears to contain a valid device tree
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE, standard meanings, as above
+ */
+int fdt_check_header(const void *fdt);
+
+/**
+ * fdt_move - move a device tree around in memory
+ * @fdt: pointer to the device tree to move
+ * @buf: pointer to memory where the device is to be moved
+ * @bufsize: size of the memory space at buf
+ *
+ * fdt_move() relocates, if possible, the device tree blob located at
+ * fdt to the buffer at buf of size bufsize.  The buffer may overlap
+ * with the existing device tree blob at fdt.  Therefore,
+ *     fdt_move(fdt, fdt, fdt_totalsize(fdt))
+ * should always succeed.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_NOSPACE, bufsize is insufficient to contain the device tree
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE, standard meanings
+ */
+int fdt_move(const void *fdt, void *buf, int bufsize);
+
+/**********************************************************************/
+/* Read-only functions                                                */
+/**********************************************************************/
+
+/**
+ * fdt_string - retrieve a string from the strings block of a device tree
+ * @fdt: pointer to the device tree blob
+ * @stroffset: offset of the string within the strings block (native endian)
+ *
+ * fdt_string() retrieves a pointer to a single string from the
+ * strings block of the device tree blob at fdt.
+ *
+ * returns:
+ *     a pointer to the string, on success
+ *     NULL, if stroffset is out of bounds
+ */
+const char *fdt_string(const void *fdt, int stroffset);
+
+/**
+ * fdt_num_mem_rsv - retrieve the number of memory reserve map entries
+ * @fdt: pointer to the device tree blob
+ *
+ * Returns the number of entries in the device tree blob's memory
+ * reservation map.  This does not include the terminating 0,0 entry
+ * or any other (0,0) entries reserved for expansion.
+ *
+ * returns:
+ *     the number of entries
+ */
+int fdt_num_mem_rsv(const void *fdt);
+
+/**
+ * fdt_get_mem_rsv - retrieve one memory reserve map entry
+ * @fdt: pointer to the device tree blob
+ * @address, @size: pointers to 64-bit variables
+ *
+ * On success, *address and *size will contain the address and size of
+ * the n-th reserve map entry from the device tree blob, in
+ * native-endian format.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE, standard meanings
+ */
+int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size);
+
+/**
+ * fdt_subnode_offset_namelen - find a subnode based on substring
+ * @fdt: pointer to the device tree blob
+ * @parentoffset: structure block offset of a node
+ * @name: name of the subnode to locate
+ * @namelen: number of characters of name to consider
+ *
+ * Identical to fdt_subnode_offset(), but only examine the first
+ * namelen characters of name for matching the subnode name.  This is
+ * useful for finding subnodes based on a portion of a larger string,
+ * such as a full path.
+ */
+int fdt_subnode_offset_namelen(const void *fdt, int parentoffset,
+			       const char *name, int namelen);
+/**
+ * fdt_subnode_offset - find a subnode of a given node
+ * @fdt: pointer to the device tree blob
+ * @parentoffset: structure block offset of a node
+ * @name: name of the subnode to locate
+ *
+ * fdt_subnode_offset() finds a subnode of the node at structure block
+ * offset parentoffset with the given name.  name may include a unit
+ * address, in which case fdt_subnode_offset() will find the subnode
+ * with that unit address, or the unit address may be omitted, in
+ * which case fdt_subnode_offset() will find an arbitrary subnode
+ * whose name excluding unit address matches the given name.
+ *
+ * returns:
+ *	structure block offset of the requested subnode (>=0), on success
+ *	-FDT_ERR_NOTFOUND, if the requested subnode does not exist
+ *	-FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE tag
+ *      -FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_TRUNCATED, standard meanings.
+ */
+int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name);
+
+/**
+ * fdt_path_offset - find a tree node by its full path
+ * @fdt: pointer to the device tree blob
+ * @path: full path of the node to locate
+ *
+ * fdt_path_offset() finds a node of a given path in the device tree.
+ * Each path component may omit the unit address portion, but the
+ * results of this are undefined if any such path component is
+ * ambiguous (that is if there are multiple nodes at the relevant
+ * level matching the given component, differentiated only by unit
+ * address).
+ *
+ * returns:
+ *	structure block offset of the node with the requested path (>=0), on success
+ *	-FDT_ERR_BADPATH, given path does not begin with '/' or is invalid
+ *	-FDT_ERR_NOTFOUND, if the requested node does not exist
+ *      -FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_TRUNCATED, standard meanings.
+ */
+int fdt_path_offset(const void *fdt, const char *path);
+
+/**
+ * fdt_get_name - retrieve the name of a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: structure block offset of the starting node
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * fdt_get_name() retrieves the name (including unit address) of the
+ * device tree node at structure block offset nodeoffset.  If lenp is
+ * non-NULL, the length of this name is also returned, in the integer
+ * pointed to by lenp.
+ *
+ * returns:
+ *	pointer to the node's name, on success
+ *		If lenp is non-NULL, *lenp contains the length of that name (>=0)
+ *	NULL, on error
+ *		if lenp is non-NULL *lenp contains an error code (<0):
+ *		-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *		-FDT_ERR_BADMAGIC,
+ *		-FDT_ERR_BADVERSION,
+ *		-FDT_ERR_BADSTATE, standard meanings
+ */
+const char *fdt_get_name(const void *fdt, int nodeoffset, int *lenp);
+
+/**
+ * fdt_first_property_offset - find the offset of a node's first property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: structure block offset of a node
+ *
+ * fdt_first_property_offset() finds the first property of the node at
+ * the given structure block offset.
+ *
+ * returns:
+ *	structure block offset of the property (>=0), on success
+ *	-FDT_ERR_NOTFOUND, if the requested node has no properties
+ *	-FDT_ERR_BADOFFSET, if nodeoffset did not point to an FDT_BEGIN_NODE tag
+ *      -FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_TRUNCATED, standard meanings.
+ */
+int fdt_first_property_offset(const void *fdt, int nodeoffset);
+
+/**
+ * fdt_next_property_offset - step through a node's properties
+ * @fdt: pointer to the device tree blob
+ * @offset: structure block offset of a property
+ *
+ * fdt_next_property_offset() finds the property immediately after the
+ * one at the given structure block offset.  This will be a property
+ * of the same node as the given property.
+ *
+ * returns:
+ *	structure block offset of the next property (>=0), on success
+ *	-FDT_ERR_NOTFOUND, if the given property is the last in its node
+ *	-FDT_ERR_BADOFFSET, if nodeoffset did not point to an FDT_PROP tag
+ *      -FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_TRUNCATED, standard meanings.
+ */
+int fdt_next_property_offset(const void *fdt, int offset);
+
+/**
+ * fdt_get_property_by_offset - retrieve the property at a given offset
+ * @fdt: pointer to the device tree blob
+ * @offset: offset of the property to retrieve
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * fdt_get_property_by_offset() retrieves a pointer to the
+ * fdt_property structure within the device tree blob at the given
+ * offset.  If lenp is non-NULL, the length of the property value is
+ * also returned, in the integer pointed to by lenp.
+ *
+ * returns:
+ *	pointer to the structure representing the property
+ *		if lenp is non-NULL, *lenp contains the length of the property
+ *		value (>=0)
+ *	NULL, on error
+ *		if lenp is non-NULL, *lenp contains an error code (<0):
+ *		-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_PROP tag
+ *		-FDT_ERR_BADMAGIC,
+ *		-FDT_ERR_BADVERSION,
+ *		-FDT_ERR_BADSTATE,
+ *		-FDT_ERR_BADSTRUCTURE,
+ *		-FDT_ERR_TRUNCATED, standard meanings
+ */
+const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
+						      int offset,
+						      int *lenp);
+
+/**
+ * fdt_get_property_namelen - find a property based on substring
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to find
+ * @name: name of the property to find
+ * @namelen: number of characters of name to consider
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * Identical to fdt_get_property_namelen(), but only examine the first
+ * namelen characters of name for matching the property name.
+ */
+const struct fdt_property *fdt_get_property_namelen(const void *fdt,
+						    int nodeoffset,
+						    const char *name,
+						    int namelen, int *lenp);
+
+/**
+ * fdt_get_property - find a given property in a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to find
+ * @name: name of the property to find
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * fdt_get_property() retrieves a pointer to the fdt_property
+ * structure within the device tree blob corresponding to the property
+ * named 'name' of the node at offset nodeoffset.  If lenp is
+ * non-NULL, the length of the property value is also returned, in the
+ * integer pointed to by lenp.
+ *
+ * returns:
+ *	pointer to the structure representing the property
+ *		if lenp is non-NULL, *lenp contains the length of the property
+ *		value (>=0)
+ *	NULL, on error
+ *		if lenp is non-NULL, *lenp contains an error code (<0):
+ *		-FDT_ERR_NOTFOUND, node does not have named property
+ *		-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *		-FDT_ERR_BADMAGIC,
+ *		-FDT_ERR_BADVERSION,
+ *		-FDT_ERR_BADSTATE,
+ *		-FDT_ERR_BADSTRUCTURE,
+ *		-FDT_ERR_TRUNCATED, standard meanings
+ */
+const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset,
+					    const char *name, int *lenp);
+static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset,
+						      const char *name,
+						      int *lenp)
+{
+	return (struct fdt_property *)(uintptr_t)
+		fdt_get_property(fdt, nodeoffset, name, lenp);
+}
+
+/**
+ * fdt_getprop_by_offset - retrieve the value of a property at a given offset
+ * @fdt: pointer to the device tree blob
+ * @ffset: offset of the property to read
+ * @namep: pointer to a string variable (will be overwritten) or NULL
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * fdt_getprop_by_offset() retrieves a pointer to the value of the
+ * property at structure block offset 'offset' (this will be a pointer
+ * to within the device blob itself, not a copy of the value).  If
+ * lenp is non-NULL, the length of the property value is also
+ * returned, in the integer pointed to by lenp.  If namep is non-NULL,
+ * the property's namne will also be returned in the char * pointed to
+ * by namep (this will be a pointer to within the device tree's string
+ * block, not a new copy of the name).
+ *
+ * returns:
+ *	pointer to the property's value
+ *		if lenp is non-NULL, *lenp contains the length of the property
+ *		value (>=0)
+ *		if namep is non-NULL *namep contiains a pointer to the property
+ *		name.
+ *	NULL, on error
+ *		if lenp is non-NULL, *lenp contains an error code (<0):
+ *		-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_PROP tag
+ *		-FDT_ERR_BADMAGIC,
+ *		-FDT_ERR_BADVERSION,
+ *		-FDT_ERR_BADSTATE,
+ *		-FDT_ERR_BADSTRUCTURE,
+ *		-FDT_ERR_TRUNCATED, standard meanings
+ */
+const void *fdt_getprop_by_offset(const void *fdt, int offset,
+				  const char **namep, int *lenp);
+
+/**
+ * fdt_getprop_namelen - get property value based on substring
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to find
+ * @name: name of the property to find
+ * @namelen: number of characters of name to consider
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * Identical to fdt_getprop(), but only examine the first namelen
+ * characters of name for matching the property name.
+ */
+const void *fdt_getprop_namelen(const void *fdt, int nodeoffset,
+				const char *name, int namelen, int *lenp);
+
+/**
+ * fdt_getprop - retrieve the value of a given property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to find
+ * @name: name of the property to find
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * fdt_getprop() retrieves a pointer to the value of the property
+ * named 'name' of the node at offset nodeoffset (this will be a
+ * pointer to within the device blob itself, not a copy of the value).
+ * If lenp is non-NULL, the length of the property value is also
+ * returned, in the integer pointed to by lenp.
+ *
+ * returns:
+ *	pointer to the property's value
+ *		if lenp is non-NULL, *lenp contains the length of the property
+ *		value (>=0)
+ *	NULL, on error
+ *		if lenp is non-NULL, *lenp contains an error code (<0):
+ *		-FDT_ERR_NOTFOUND, node does not have named property
+ *		-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *		-FDT_ERR_BADMAGIC,
+ *		-FDT_ERR_BADVERSION,
+ *		-FDT_ERR_BADSTATE,
+ *		-FDT_ERR_BADSTRUCTURE,
+ *		-FDT_ERR_TRUNCATED, standard meanings
+ */
+const void *fdt_getprop(const void *fdt, int nodeoffset,
+			const char *name, int *lenp);
+static inline void *fdt_getprop_w(void *fdt, int nodeoffset,
+				  const char *name, int *lenp)
+{
+	return (void *)(uintptr_t)fdt_getprop(fdt, nodeoffset, name, lenp);
+}
+
+/**
+ * fdt_get_phandle - retrieve the phandle of a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: structure block offset of the node
+ *
+ * fdt_get_phandle() retrieves the phandle of the device tree node at
+ * structure block offset nodeoffset.
+ *
+ * returns:
+ *	the phandle of the node at nodeoffset, on success (!= 0, != -1)
+ *	0, if the node has no phandle, or another error occurs
+ */
+uint32_t fdt_get_phandle(const void *fdt, int nodeoffset);
+
+/**
+ * fdt_get_alias_namelen - get alias based on substring
+ * @fdt: pointer to the device tree blob
+ * @name: name of the alias th look up
+ * @namelen: number of characters of name to consider
+ *
+ * Identical to fdt_get_alias(), but only examine the first namelen
+ * characters of name for matching the alias name.
+ */
+const char *fdt_get_alias_namelen(const void *fdt,
+				  const char *name, int namelen);
+
+/**
+ * fdt_get_alias - retreive the path referenced by a given alias
+ * @fdt: pointer to the device tree blob
+ * @name: name of the alias th look up
+ *
+ * fdt_get_alias() retrieves the value of a given alias.  That is, the
+ * value of the property named 'name' in the node /aliases.
+ *
+ * returns:
+ *	a pointer to the expansion of the alias named 'name', of it exists
+ *	NULL, if the given alias or the /aliases node does not exist
+ */
+const char *fdt_get_alias(const void *fdt, const char *name);
+
+/**
+ * fdt_get_path - determine the full path of a node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose path to find
+ * @buf: character buffer to contain the returned path (will be overwritten)
+ * @buflen: size of the character buffer at buf
+ *
+ * fdt_get_path() computes the full path of the node at offset
+ * nodeoffset, and records that path in the buffer at buf.
+ *
+ * NOTE: This function is expensive, as it must scan the device tree
+ * structure from the start to nodeoffset.
+ *
+ * returns:
+ *	0, on success
+ *		buf contains the absolute path of the node at
+ *		nodeoffset, as a NUL-terminated string.
+ * 	-FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ *	-FDT_ERR_NOSPACE, the path of the given node is longer than (bufsize-1)
+ *		characters and will not fit in the given buffer.
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen);
+
+/**
+ * fdt_supernode_atdepth_offset - find a specific ancestor of a node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose parent to find
+ * @supernodedepth: depth of the ancestor to find
+ * @nodedepth: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * fdt_supernode_atdepth_offset() finds an ancestor of the given node
+ * at a specific depth from the root (where the root itself has depth
+ * 0, its immediate subnodes depth 1 and so forth).  So
+ *	fdt_supernode_atdepth_offset(fdt, nodeoffset, 0, NULL);
+ * will always return 0, the offset of the root node.  If the node at
+ * nodeoffset has depth D, then:
+ *	fdt_supernode_atdepth_offset(fdt, nodeoffset, D, NULL);
+ * will return nodeoffset itself.
+ *
+ * NOTE: This function is expensive, as it must scan the device tree
+ * structure from the start to nodeoffset.
+ *
+ * returns:
+
+ *	structure block offset of the node at node offset's ancestor
+ *		of depth supernodedepth (>=0), on success
+ * 	-FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+*	-FDT_ERR_NOTFOUND, supernodedepth was greater than the depth of nodeoffset
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset,
+				 int supernodedepth, int *nodedepth);
+
+/**
+ * fdt_node_depth - find the depth of a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose parent to find
+ *
+ * fdt_node_depth() finds the depth of a given node.  The root node
+ * has depth 0, its immediate subnodes depth 1 and so forth.
+ *
+ * NOTE: This function is expensive, as it must scan the device tree
+ * structure from the start to nodeoffset.
+ *
+ * returns:
+ *	depth of the node at nodeoffset (>=0), on success
+ * 	-FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_depth(const void *fdt, int nodeoffset);
+
+/**
+ * fdt_parent_offset - find the parent of a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose parent to find
+ *
+ * fdt_parent_offset() locates the parent node of a given node (that
+ * is, it finds the offset of the node which contains the node at
+ * nodeoffset as a subnode).
+ *
+ * NOTE: This function is expensive, as it must scan the device tree
+ * structure from the start to nodeoffset, *twice*.
+ *
+ * returns:
+ *	structure block offset of the parent of the node at nodeoffset
+ *		(>=0), on success
+ * 	-FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_parent_offset(const void *fdt, int nodeoffset);
+
+/**
+ * fdt_node_offset_by_prop_value - find nodes with a given property value
+ * @fdt: pointer to the device tree blob
+ * @startoffset: only find nodes after this offset
+ * @propname: property name to check
+ * @propval: property value to search for
+ * @proplen: length of the value in propval
+ *
+ * fdt_node_offset_by_prop_value() returns the offset of the first
+ * node after startoffset, which has a property named propname whose
+ * value is of length proplen and has value equal to propval; or if
+ * startoffset is -1, the very first such node in the tree.
+ *
+ * To iterate through all nodes matching the criterion, the following
+ * idiom can be used:
+ *	offset = fdt_node_offset_by_prop_value(fdt, -1, propname,
+ *					       propval, proplen);
+ *	while (offset != -FDT_ERR_NOTFOUND) {
+ *		// other code here
+ *		offset = fdt_node_offset_by_prop_value(fdt, offset, propname,
+ *						       propval, proplen);
+ *	}
+ *
+ * Note the -1 in the first call to the function, if 0 is used here
+ * instead, the function will never locate the root node, even if it
+ * matches the criterion.
+ *
+ * returns:
+ *	structure block offset of the located node (>= 0, >startoffset),
+ *		 on success
+ *	-FDT_ERR_NOTFOUND, no node matching the criterion exists in the
+ *		tree after startoffset
+ * 	-FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_offset_by_prop_value(const void *fdt, int startoffset,
+				  const char *propname,
+				  const void *propval, int proplen);
+
+/**
+ * fdt_node_offset_by_phandle - find the node with a given phandle
+ * @fdt: pointer to the device tree blob
+ * @phandle: phandle value
+ *
+ * fdt_node_offset_by_phandle() returns the offset of the node
+ * which has the given phandle value.  If there is more than one node
+ * in the tree with the given phandle (an invalid tree), results are
+ * undefined.
+ *
+ * returns:
+ *	structure block offset of the located node (>= 0), on success
+ *	-FDT_ERR_NOTFOUND, no node with that phandle exists
+ *	-FDT_ERR_BADPHANDLE, given phandle value was invalid (0 or -1)
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle);
+
+/**
+ * fdt_node_check_compatible: check a node's compatible property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of a tree node
+ * @compatible: string to match against
+ *
+ *
+ * fdt_node_check_compatible() returns 0 if the given node contains a
+ * 'compatible' property with the given string as one of its elements,
+ * it returns non-zero otherwise, or on error.
+ *
+ * returns:
+ *	0, if the node has a 'compatible' property listing the given string
+ *	1, if the node has a 'compatible' property, but it does not list
+ *		the given string
+ *	-FDT_ERR_NOTFOUND, if the given node has no 'compatible' property
+ * 	-FDT_ERR_BADOFFSET, if nodeoffset does not refer to a BEGIN_NODE tag
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_check_compatible(const void *fdt, int nodeoffset,
+			      const char *compatible);
+
+/**
+ * fdt_node_offset_by_compatible - find nodes with a given 'compatible' value
+ * @fdt: pointer to the device tree blob
+ * @startoffset: only find nodes after this offset
+ * @compatible: 'compatible' string to match against
+ *
+ * fdt_node_offset_by_compatible() returns the offset of the first
+ * node after startoffset, which has a 'compatible' property which
+ * lists the given compatible string; or if startoffset is -1, the
+ * very first such node in the tree.
+ *
+ * To iterate through all nodes matching the criterion, the following
+ * idiom can be used:
+ *	offset = fdt_node_offset_by_compatible(fdt, -1, compatible);
+ *	while (offset != -FDT_ERR_NOTFOUND) {
+ *		// other code here
+ *		offset = fdt_node_offset_by_compatible(fdt, offset, compatible);
+ *	}
+ *
+ * Note the -1 in the first call to the function, if 0 is used here
+ * instead, the function will never locate the root node, even if it
+ * matches the criterion.
+ *
+ * returns:
+ *	structure block offset of the located node (>= 0, >startoffset),
+ *		 on success
+ *	-FDT_ERR_NOTFOUND, no node matching the criterion exists in the
+ *		tree after startoffset
+ * 	-FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
+				  const char *compatible);
+
+/**********************************************************************/
+/* Write-in-place functions                                           */
+/**********************************************************************/
+
+/**
+ * fdt_setprop_inplace - change a property's value, but not its size
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to change
+ * @val: pointer to data to replace the property value with
+ * @len: length of the property value
+ *
+ * fdt_setprop_inplace() replaces the value of a given property with
+ * the data in val, of length len.  This function cannot change the
+ * size of a property, and so will only work if len is equal to the
+ * current length of the property.
+ *
+ * This function will alter only the bytes in the blob which contain
+ * the given property value, and will not alter or move any other part
+ * of the tree.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_NOSPACE, if len is not equal to the property's current length
+ *	-FDT_ERR_NOTFOUND, node does not have the named property
+ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
+			const void *val, int len);
+
+/**
+ * fdt_setprop_inplace_cell - change the value of a single-cell property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to change
+ * @val: cell (32-bit integer) value to replace the property with
+ *
+ * fdt_setprop_inplace_cell() replaces the value of a given property
+ * with the 32-bit integer cell value in val, converting val to
+ * big-endian if necessary.  This function cannot change the size of a
+ * property, and so will only work if the property already exists and
+ * has length 4.
+ *
+ * This function will alter only the bytes in the blob which contain
+ * the given property value, and will not alter or move any other part
+ * of the tree.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_NOSPACE, if the property's length is not equal to 4
+  *	-FDT_ERR_NOTFOUND, node does not have the named property
+ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset,
+					   const char *name, uint32_t val)
+{
+	val = cpu_to_fdt32(val);
+	return fdt_setprop_inplace(fdt, nodeoffset, name, &val, sizeof(val));
+}
+
+/**
+ * fdt_nop_property - replace a property with nop tags
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to nop
+ * @name: name of the property to nop
+ *
+ * fdt_nop_property() will replace a given property's representation
+ * in the blob with FDT_NOP tags, effectively removing it from the
+ * tree.
+ *
+ * This function will alter only the bytes in the blob which contain
+ * the property, and will not alter or move any other part of the
+ * tree.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_NOTFOUND, node does not have the named property
+ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_nop_property(void *fdt, int nodeoffset, const char *name);
+
+/**
+ * fdt_nop_node - replace a node (subtree) with nop tags
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node to nop
+ *
+ * fdt_nop_node() will replace a given node's representation in the
+ * blob, including all its subnodes, if any, with FDT_NOP tags,
+ * effectively removing it from the tree.
+ *
+ * This function will alter only the bytes in the blob which contain
+ * the node and its properties and subnodes, and will not alter or
+ * move any other part of the tree.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_nop_node(void *fdt, int nodeoffset);
+
+/**********************************************************************/
+/* Sequential write functions                                         */
+/**********************************************************************/
+
+int fdt_create(void *buf, int bufsize);
+int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size);
+int fdt_finish_reservemap(void *fdt);
+int fdt_begin_node(void *fdt, const char *name);
+int fdt_property(void *fdt, const char *name, const void *val, int len);
+static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val)
+{
+	val = cpu_to_fdt32(val);
+	return fdt_property(fdt, name, &val, sizeof(val));
+}
+#define fdt_property_string(fdt, name, str) \
+	fdt_property(fdt, name, str, strlen(str)+1)
+int fdt_end_node(void *fdt);
+int fdt_finish(void *fdt);
+
+/**********************************************************************/
+/* Read-write functions                                               */
+/**********************************************************************/
+
+int fdt_open_into(const void *fdt, void *buf, int bufsize);
+int fdt_pack(void *fdt);
+
+/**
+ * fdt_add_mem_rsv - add one memory reserve map entry
+ * @fdt: pointer to the device tree blob
+ * @address, @size: 64-bit values (native endian)
+ *
+ * Adds a reserve map entry to the given blob reserving a region at
+ * address address of length size.
+ *
+ * This function will insert data into the reserve map and will
+ * therefore change the indexes of some entries in the table.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_NOSPACE, there is insufficient free space in the blob to
+ *		contain the new reservation entry
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_BADLAYOUT,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size);
+
+/**
+ * fdt_del_mem_rsv - remove a memory reserve map entry
+ * @fdt: pointer to the device tree blob
+ * @n: entry to remove
+ *
+ * fdt_del_mem_rsv() removes the n-th memory reserve map entry from
+ * the blob.
+ *
+ * This function will delete data from the reservation table and will
+ * therefore change the indexes of some entries in the table.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_NOTFOUND, there is no entry of the given index (i.e. there
+ *		are less than n+1 reserve map entries)
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_BADLAYOUT,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_del_mem_rsv(void *fdt, int n);
+
+/**
+ * fdt_set_name - change the name of a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: structure block offset of a node
+ * @name: name to give the node
+ *
+ * fdt_set_name() replaces the name (including unit address, if any)
+ * of the given node with the given string.  NOTE: this function can't
+ * efficiently check if the new name is unique amongst the given
+ * node's siblings; results are undefined if this function is invoked
+ * with a name equal to one of the given node's siblings.
+ *
+ * This function may insert or delete data from the blob, and will
+ * therefore change the offsets of some existing nodes.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_NOSPACE, there is insufficient free space in the blob
+ *		to contain the new name
+ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE, standard meanings
+ */
+int fdt_set_name(void *fdt, int nodeoffset, const char *name);
+
+/**
+ * fdt_setprop - create or change a property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to change
+ * @val: pointer to data to set the property value to
+ * @len: length of the property value
+ *
+ * fdt_setprop() sets the value of the named property in the given
+ * node to the given value and length, creating the property if it
+ * does not already exist.
+ *
+ * This function may insert or delete data from the blob, and will
+ * therefore change the offsets of some existing nodes.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_NOSPACE, there is insufficient free space in the blob to
+ *		contain the new property value
+ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *	-FDT_ERR_BADLAYOUT,
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_BADLAYOUT,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_setprop(void *fdt, int nodeoffset, const char *name,
+		const void *val, int len);
+
+/**
+ * fdt_setprop_cell - set a property to a single cell value
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to change
+ * @val: 32-bit integer value for the property (native endian)
+ *
+ * fdt_setprop_cell() sets the value of the named property in the
+ * given node to the given cell value (converting to big-endian if
+ * necessary), or creates a new property with that value if it does
+ * not already exist.
+ *
+ * This function may insert or delete data from the blob, and will
+ * therefore change the offsets of some existing nodes.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_NOSPACE, there is insufficient free space in the blob to
+ *		contain the new property value
+ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *	-FDT_ERR_BADLAYOUT,
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_BADLAYOUT,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name,
+				   uint32_t val)
+{
+	val = cpu_to_fdt32(val);
+	return fdt_setprop(fdt, nodeoffset, name, &val, sizeof(val));
+}
+
+/**
+ * fdt_setprop_string - set a property to a string value
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to change
+ * @str: string value for the property
+ *
+ * fdt_setprop_string() sets the value of the named property in the
+ * given node to the given string value (using the length of the
+ * string to determine the new length of the property), or creates a
+ * new property with that value if it does not already exist.
+ *
+ * This function may insert or delete data from the blob, and will
+ * therefore change the offsets of some existing nodes.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_NOSPACE, there is insufficient free space in the blob to
+ *		contain the new property value
+ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *	-FDT_ERR_BADLAYOUT,
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_BADLAYOUT,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+#define fdt_setprop_string(fdt, nodeoffset, name, str) \
+	fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
+
+/**
+ * fdt_delprop - delete a property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to nop
+ * @name: name of the property to nop
+ *
+ * fdt_del_property() will delete the given property.
+ *
+ * This function will delete data from the blob, and will therefore
+ * change the offsets of some existing nodes.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_NOTFOUND, node does not have the named property
+ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *	-FDT_ERR_BADLAYOUT,
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_delprop(void *fdt, int nodeoffset, const char *name);
+
+/**
+ * fdt_add_subnode_namelen - creates a new node based on substring
+ * @fdt: pointer to the device tree blob
+ * @parentoffset: structure block offset of a node
+ * @name: name of the subnode to locate
+ * @namelen: number of characters of name to consider
+ *
+ * Identical to fdt_add_subnode(), but use only the first namelen
+ * characters of name as the name of the new node.  This is useful for
+ * creating subnodes based on a portion of a larger string, such as a
+ * full path.
+ */
+int fdt_add_subnode_namelen(void *fdt, int parentoffset,
+			    const char *name, int namelen);
+
+/**
+ * fdt_add_subnode - creates a new node
+ * @fdt: pointer to the device tree blob
+ * @parentoffset: structure block offset of a node
+ * @name: name of the subnode to locate
+ *
+ * fdt_add_subnode() creates a new node as a subnode of the node at
+ * structure block offset parentoffset, with the given name (which
+ * should include the unit address, if any).
+ *
+ * This function will insert data into the blob, and will therefore
+ * change the offsets of some existing nodes.
+
+ * returns:
+ *	structure block offset of the created nodeequested subnode (>=0), on success
+ *	-FDT_ERR_NOTFOUND, if the requested subnode does not exist
+ *	-FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE tag
+ *	-FDT_ERR_EXISTS, if the node at parentoffset already has a subnode of
+ *		the given name
+ *	-FDT_ERR_NOSPACE, if there is insufficient free space in the
+ *		blob to contain the new node
+ *	-FDT_ERR_NOSPACE
+ *	-FDT_ERR_BADLAYOUT
+ *      -FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_TRUNCATED, standard meanings.
+ */
+int fdt_add_subnode(void *fdt, int parentoffset, const char *name);
+
+/**
+ * fdt_del_node - delete a node (subtree)
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node to nop
+ *
+ * fdt_del_node() will remove the given node, including all its
+ * subnodes if any, from the blob.
+ *
+ * This function will delete data from the blob, and will therefore
+ * change the offsets of some existing nodes.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *	-FDT_ERR_BADLAYOUT,
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_del_node(void *fdt, int nodeoffset);
+
+/**********************************************************************/
+/* Debugging / informational functions                                */
+/**********************************************************************/
+
+const char *fdt_strerror(int errval);
+
+#endif /* _LIBFDT_H */
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/libfdt_env.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/libfdt_env.h	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,23 @@
+#ifndef _LIBFDT_ENV_H
+#define _LIBFDT_ENV_H
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#define _B(n)	((unsigned long long)((uint8_t *)&x)[n])
+static inline uint32_t fdt32_to_cpu(uint32_t x)
+{
+	return (_B(0) << 24) | (_B(1) << 16) | (_B(2) << 8) | _B(3);
+}
+#define cpu_to_fdt32(x) fdt32_to_cpu(x)
+
+static inline uint64_t fdt64_to_cpu(uint64_t x)
+{
+	return (_B(0) << 56) | (_B(1) << 48) | (_B(2) << 40) | (_B(3) << 32)
+		| (_B(4) << 24) | (_B(5) << 16) | (_B(6) << 8) | _B(7);
+}
+#define cpu_to_fdt64(x) fdt64_to_cpu(x)
+#undef _B
+
+#endif /* _LIBFDT_ENV_H */
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/libfdt_internal.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/libfdt_internal.h	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,95 @@
+#ifndef _LIBFDT_INTERNAL_H
+#define _LIBFDT_INTERNAL_H
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ *
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ *     You should have received a copy of the GNU General Public
+ *     License along with this library; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ *  b) Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *     1. Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *     2. Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <fdt.h>
+
+#define FDT_ALIGN(x, a)		(((x) + (a) - 1) & ~((a) - 1))
+#define FDT_TAGALIGN(x)		(FDT_ALIGN((x), FDT_TAGSIZE))
+
+#define FDT_CHECK_HEADER(fdt) \
+	{ \
+		int err; \
+		if ((err = fdt_check_header(fdt)) != 0) \
+			return err; \
+	}
+
+int _fdt_check_node_offset(const void *fdt, int offset);
+int _fdt_check_prop_offset(const void *fdt, int offset);
+const char *_fdt_find_string(const char *strtab, int tabsize, const char *s);
+int _fdt_node_end_offset(void *fdt, int nodeoffset);
+
+static inline const void *_fdt_offset_ptr(const void *fdt, int offset)
+{
+	return (const char *)fdt + fdt_off_dt_struct(fdt) + offset;
+}
+
+static inline void *_fdt_offset_ptr_w(void *fdt, int offset)
+{
+	return (void *)(uintptr_t)_fdt_offset_ptr(fdt, offset);
+}
+
+static inline const struct fdt_reserve_entry *_fdt_mem_rsv(const void *fdt, int n)
+{
+	const struct fdt_reserve_entry *rsv_table =
+		(const struct fdt_reserve_entry *)
+		((const char *)fdt + fdt_off_mem_rsvmap(fdt));
+
+	return rsv_table + n;
+}
+static inline struct fdt_reserve_entry *_fdt_mem_rsv_w(void *fdt, int n)
+{
+	return (void *)(uintptr_t)_fdt_mem_rsv(fdt, n);
+}
+
+#define FDT_SW_MAGIC		(~FDT_MAGIC)
+
+#endif /* _LIBFDT_INTERNAL_H */
diff -r bd0a11ed1a67 -r fcc188f21e47 xen/common/libfdt/version.lds
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/libfdt/version.lds	Mon Feb 13 13:33:26 2012 +0000
@@ -0,0 +1,54 @@
+LIBFDT_1.2 {
+	global:
+		fdt_next_node;
+		fdt_check_header;
+		fdt_move;
+		fdt_string;
+		fdt_num_mem_rsv;
+		fdt_get_mem_rsv;
+		fdt_subnode_offset_namelen;
+		fdt_subnode_offset;
+		fdt_path_offset;
+		fdt_get_name;
+		fdt_get_property_namelen;
+		fdt_get_property;
+		fdt_getprop_namelen;
+		fdt_getprop;
+		fdt_get_phandle;
+		fdt_get_alias_namelen;
+		fdt_get_alias;
+		fdt_get_path;
+		fdt_supernode_atdepth_offset;
+		fdt_node_depth;
+		fdt_parent_offset;
+		fdt_node_offset_by_prop_value;
+		fdt_node_offset_by_phandle;
+		fdt_node_check_compatible;
+		fdt_node_offset_by_compatible;
+		fdt_setprop_inplace;
+		fdt_nop_property;
+		fdt_nop_node;
+		fdt_create;
+		fdt_add_reservemap_entry;
+		fdt_finish_reservemap;
+		fdt_begin_node;
+		fdt_property;
+		fdt_end_node;
+		fdt_finish;
+		fdt_open_into;
+		fdt_pack;
+		fdt_add_mem_rsv;
+		fdt_del_mem_rsv;
+		fdt_set_name;
+		fdt_setprop;
+		fdt_delprop;
+		fdt_add_subnode_namelen;
+		fdt_add_subnode;
+		fdt_del_node;
+		fdt_strerror;
+		fdt_offset_ptr;
+		fdt_next_tag;
+
+	local:
+		*;
+};

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:56:33 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:56:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSEb-0005dx-7f; Tue, 14 Feb 2012 23:56:33 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSEZ-0005cv-Cb
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:56:31 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1329263720!9195120!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7473 invoked from network); 14 Feb 2012 23:55:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDQ-0007iF-6g
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDQ-0002Ey-5L
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:20 +0000
Message-Id: <E1RxSDQ-0002Ey-5L@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: link a device tree blob into
	the xen image
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329143088 0
# Node ID 14a97085fbec0d3a87c584a1c2b268a4f61fc57c
# Parent  865d6bb72b5beac73b89dcacb8ea0fd29ed07c24
arm: link a device tree blob into the xen image

Link a device tree blob (DTB) into the xen image.  This is loaded
immediately after Xen and xen_start() is called with the correct
address in atag_paddr.

The DTB file must be supplied by setting the CONFIG_DTB_FILE variable
in .config or on the make command line.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 865d6bb72b5b -r 14a97085fbec config/arm.mk
--- a/config/arm.mk	Mon Feb 13 14:24:45 2012 +0000
+++ b/config/arm.mk	Mon Feb 13 14:24:48 2012 +0000
@@ -16,3 +16,9 @@
 LDFLAGS_DIRECT += -marmelf$(LDFLAGS_DIRECT_$(XEN_OS))_eabi
 
 CONFIG_LOAD_ADDRESS ?= 0x80000000
+
+# XXX: When running on the model there is no bootloader to provide a
+# device tree.  It must be linked into Xen.
+ifndef CONFIG_DTB_FILE
+$(error CONFIG_DTB_FILE must be set to the absolute filename of a DTB)
+endif
diff -r 865d6bb72b5b -r 14a97085fbec xen/arch/arm/Makefile
--- a/xen/arch/arm/Makefile	Mon Feb 13 14:24:45 2012 +0000
+++ b/xen/arch/arm/Makefile	Mon Feb 13 14:24:48 2012 +0000
@@ -22,12 +22,17 @@
 
 #obj-bin-y += ....o
 
+ifdef CONFIG_DTB_FILE
+obj-y += dtb.o
+AFLAGS += -DCONFIG_DTB_FILE=\"$(CONFIG_DTB_FILE)\"
+endif
+
 ALL_OBJS := head.o $(ALL_OBJS)
 
 $(TARGET): $(TARGET)-syms
 	# XXX: VE model loads by VMA so instead of
 	# making a proper ELF we link with LMA == VMA and adjust crudely
-	$(OBJCOPY) --change-addresses +0x7fe00000 $< $@
+	$(OBJCOPY) --change-addresses +0x80000000 $< $@
 	# XXX strip it
 
 #$(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
@@ -71,6 +76,8 @@
 	sed -e 's/xen\.lds\.o:/xen\.lds:/g' <.xen.lds.d >.xen.lds.d.new
 	mv -f .xen.lds.d.new .xen.lds.d
 
+dtb.o: $(CONFIG_DTB_FILE)
+
 .PHONY: clean
 clean::
 	rm -f asm-offsets.s xen.lds
diff -r 865d6bb72b5b -r 14a97085fbec xen/arch/arm/dtb.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/dtb.S	Mon Feb 13 14:24:48 2012 +0000
@@ -0,0 +1,2 @@
+        .section .dtb,#alloc
+        .incbin CONFIG_DTB_FILE
diff -r 865d6bb72b5b -r 14a97085fbec xen/arch/arm/head.S
--- a/xen/arch/arm/head.S	Mon Feb 13 14:24:45 2012 +0000
+++ b/xen/arch/arm/head.S	Mon Feb 13 14:24:48 2012 +0000
@@ -55,6 +55,12 @@
        adr   r9, start              /* r9  := paddr (start) */
        sub   r10, r9, r0            /* r10 := phys-offset */
 
+        /* Using the DTB in the .dtb section? */
+#ifdef CONFIG_DTB_FILE
+        ldr   r8, =_sdtb
+        add   r8, r10                /* r8 := paddr(DTB) */
+#endif
+
 #ifdef EARLY_UART_ADDRESS
        /* Say hello */
        ldr   r11, =EARLY_UART_ADDRESS  /* r11 := UART base address */
diff -r 865d6bb72b5b -r 14a97085fbec xen/arch/arm/xen.lds.S
--- a/xen/arch/arm/xen.lds.S	Mon Feb 13 14:24:45 2012 +0000
+++ b/xen/arch/arm/xen.lds.S	Mon Feb 13 14:24:48 2012 +0000
@@ -122,6 +122,10 @@
   } :text
   _end = . ;
 
+  /* Section for the device tree blob (if any). */
+  _sdtb = .;
+  .dtb : { *(.dtb) } :text
+
   /* Sections to be discarded */
   /DISCARD/ : {
        *(.exit.text)

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

From xen-changelog-bounces@lists.xensource.com Tue Feb 14 23:56:33 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2012 23:56:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxSEb-0005dx-7f; Tue, 14 Feb 2012 23:56:33 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSEZ-0005cv-Cb
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:56:31 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1329263720!9195120!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7473 invoked from network); 14 Feb 2012 23:55:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Feb 2012 23:55:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDQ-0007iF-6g
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxSDQ-0002Ey-5L
	for xen-changelog@lists.xensource.com; Tue, 14 Feb 2012 23:55:20 +0000
Message-Id: <E1RxSDQ-0002Ey-5L@xenbits.xen.org>
Date: Tue, 14 Feb 2012 23:55:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: link a device tree blob into
	the xen image
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329143088 0
# Node ID 14a97085fbec0d3a87c584a1c2b268a4f61fc57c
# Parent  865d6bb72b5beac73b89dcacb8ea0fd29ed07c24
arm: link a device tree blob into the xen image

Link a device tree blob (DTB) into the xen image.  This is loaded
immediately after Xen and xen_start() is called with the correct
address in atag_paddr.

The DTB file must be supplied by setting the CONFIG_DTB_FILE variable
in .config or on the make command line.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 865d6bb72b5b -r 14a97085fbec config/arm.mk
--- a/config/arm.mk	Mon Feb 13 14:24:45 2012 +0000
+++ b/config/arm.mk	Mon Feb 13 14:24:48 2012 +0000
@@ -16,3 +16,9 @@
 LDFLAGS_DIRECT += -marmelf$(LDFLAGS_DIRECT_$(XEN_OS))_eabi
 
 CONFIG_LOAD_ADDRESS ?= 0x80000000
+
+# XXX: When running on the model there is no bootloader to provide a
+# device tree.  It must be linked into Xen.
+ifndef CONFIG_DTB_FILE
+$(error CONFIG_DTB_FILE must be set to the absolute filename of a DTB)
+endif
diff -r 865d6bb72b5b -r 14a97085fbec xen/arch/arm/Makefile
--- a/xen/arch/arm/Makefile	Mon Feb 13 14:24:45 2012 +0000
+++ b/xen/arch/arm/Makefile	Mon Feb 13 14:24:48 2012 +0000
@@ -22,12 +22,17 @@
 
 #obj-bin-y += ....o
 
+ifdef CONFIG_DTB_FILE
+obj-y += dtb.o
+AFLAGS += -DCONFIG_DTB_FILE=\"$(CONFIG_DTB_FILE)\"
+endif
+
 ALL_OBJS := head.o $(ALL_OBJS)
 
 $(TARGET): $(TARGET)-syms
 	# XXX: VE model loads by VMA so instead of
 	# making a proper ELF we link with LMA == VMA and adjust crudely
-	$(OBJCOPY) --change-addresses +0x7fe00000 $< $@
+	$(OBJCOPY) --change-addresses +0x80000000 $< $@
 	# XXX strip it
 
 #$(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
@@ -71,6 +76,8 @@
 	sed -e 's/xen\.lds\.o:/xen\.lds:/g' <.xen.lds.d >.xen.lds.d.new
 	mv -f .xen.lds.d.new .xen.lds.d
 
+dtb.o: $(CONFIG_DTB_FILE)
+
 .PHONY: clean
 clean::
 	rm -f asm-offsets.s xen.lds
diff -r 865d6bb72b5b -r 14a97085fbec xen/arch/arm/dtb.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/dtb.S	Mon Feb 13 14:24:48 2012 +0000
@@ -0,0 +1,2 @@
+        .section .dtb,#alloc
+        .incbin CONFIG_DTB_FILE
diff -r 865d6bb72b5b -r 14a97085fbec xen/arch/arm/head.S
--- a/xen/arch/arm/head.S	Mon Feb 13 14:24:45 2012 +0000
+++ b/xen/arch/arm/head.S	Mon Feb 13 14:24:48 2012 +0000
@@ -55,6 +55,12 @@
        adr   r9, start              /* r9  := paddr (start) */
        sub   r10, r9, r0            /* r10 := phys-offset */
 
+        /* Using the DTB in the .dtb section? */
+#ifdef CONFIG_DTB_FILE
+        ldr   r8, =_sdtb
+        add   r8, r10                /* r8 := paddr(DTB) */
+#endif
+
 #ifdef EARLY_UART_ADDRESS
        /* Say hello */
        ldr   r11, =EARLY_UART_ADDRESS  /* r11 := UART base address */
diff -r 865d6bb72b5b -r 14a97085fbec xen/arch/arm/xen.lds.S
--- a/xen/arch/arm/xen.lds.S	Mon Feb 13 14:24:45 2012 +0000
+++ b/xen/arch/arm/xen.lds.S	Mon Feb 13 14:24:48 2012 +0000
@@ -122,6 +122,10 @@
   } :text
   _end = . ;
 
+  /* Section for the device tree blob (if any). */
+  _sdtb = .;
+  .dtb : { *(.dtb) } :text
+
   /* Sections to be discarded */
   /DISCARD/ : {
        *(.exit.text)

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 11:11:11 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 11:11:11 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxclP-0000EN-NI; Wed, 15 Feb 2012 11:11:07 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxclO-0000EI-8U
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 11:11:06 +0000
Received: from [85.158.139.83:4748] by server-4.bemta-5.messagelabs.com id
	FB/A6-10788-9C29B3F4; Wed, 15 Feb 2012 11:11:05 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-182.messagelabs.com!1329304263!15165940!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17172 invoked from network); 15 Feb 2012 11:11:04 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 11:11:04 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxclL-0008MZ-BV
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 11:11:03 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxclL-000253-56
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 11:11:03 +0000
Message-Id: <E1RxclL-000253-56@xenbits.xen.org>
Date: Wed, 15 Feb 2012 11:11:02 +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] blkfront: properly fail packet
	requests
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329304142 -3600
# Node ID dc034d0ccdd857503de483012bea9c8e549daa76
# Parent  b9627a5740d223827053317cd9c8f40c721db972
blkfront: properly fail packet requests

c/s 1036:f5635e334aa5 ("blkfront: forward unknown IOCTLs to
scsi_cmd_ioctl() for /dev/sdX") uncovered a problem in blkfront's
request handling: blk_pc_request()-s, among other sources resulting
from the handling of the SG_IO ioctl in scsi_cmd_ioctl(), must not be
passed to end_request() without prior adjustment: Neither is their
->hard_cur_sectors necessarily correct (potentially resulting in an
infinite loop), nor is ->errors ever getting set properly to reflect
the failure (sg_io() intentionally ignores the return value from
blk_execute_rq()).

As blktap2's internally created devices have the same deficiency, fix
this there too.

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


diff -r b9627a5740d2 -r dc034d0ccdd8 drivers/xen/blkfront/blkfront.c
--- a/drivers/xen/blkfront/blkfront.c	Fri Feb 10 17:46:45 2012 +0100
+++ b/drivers/xen/blkfront/blkfront.c	Wed Feb 15 12:09:02 2012 +0100
@@ -709,6 +709,12 @@
 	while ((req = elv_next_request(rq)) != NULL) {
 		info = req->rq_disk->private_data;
 		if (!blk_fs_request(req)) {
+			if (blk_pc_request(req)) {
+				req->errors = (DID_ERROR << 16)
+					      | (DRIVER_INVALID << 24);
+				req->hard_cur_sectors = (req->data_len
+							 + 511) >> 9;
+			}
 			end_request(req, 0);
 			continue;
 		}
diff -r b9627a5740d2 -r dc034d0ccdd8 drivers/xen/blktap2/device.c
--- a/drivers/xen/blktap2/device.c	Fri Feb 10 17:46:45 2012 +0100
+++ b/drivers/xen/blktap2/device.c	Wed Feb 15 12:09:02 2012 +0100
@@ -3,6 +3,7 @@
 #include <linux/cdrom.h>
 #include <linux/hdreg.h>
 #include <linux/module.h>
+#include <scsi/scsi.h>
 #include <asm/tlbflush.h>
 
 #include <scsi/scsi.h>
@@ -825,6 +826,12 @@
 
 	while ((req = elv_next_request(rq)) != NULL) {
 		if (!blk_fs_request(req)) {
+			if (blk_pc_request(req)) {
+				req->errors = (DID_ERROR << 16)
+					      | (DRIVER_INVALID << 24);
+				req->hard_cur_sectors = (req->data_len
+							 + 511) >> 9;
+			}
 			end_request(req, 0);
 			continue;
 		}
@@ -912,9 +919,16 @@
 
 fail:
 	while ((req = elv_next_request(rq))) {
-		BTERR("device closed: failing secs %llu - %llu\n",
-		      (unsigned long long)req->sector,
-		      (unsigned long long)req->sector + req->nr_sectors);
+		if (blk_fs_request(req)) {
+			unsigned long long sec = req->sector;
+
+			BTERR("device closed: failing secs %#Lx-%#Lx\n",
+			      sec, sec + req->nr_sectors - 1);
+		} else if (blk_pc_request(req)) {
+			req->errors = (DID_ERROR << 16)
+				      | (DRIVER_INVALID << 24);
+			req->hard_cur_sectors = (req->data_len + 511) >> 9;
+		}
 		end_request(req, 0);
 	}
 }

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 11:11:11 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 11:11:11 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxclP-0000EN-NI; Wed, 15 Feb 2012 11:11:07 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxclO-0000EI-8U
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 11:11:06 +0000
Received: from [85.158.139.83:4748] by server-4.bemta-5.messagelabs.com id
	FB/A6-10788-9C29B3F4; Wed, 15 Feb 2012 11:11:05 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-182.messagelabs.com!1329304263!15165940!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17172 invoked from network); 15 Feb 2012 11:11:04 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 11:11:04 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxclL-0008MZ-BV
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 11:11:03 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxclL-000253-56
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 11:11:03 +0000
Message-Id: <E1RxclL-000253-56@xenbits.xen.org>
Date: Wed, 15 Feb 2012 11:11:02 +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] blkfront: properly fail packet
	requests
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329304142 -3600
# Node ID dc034d0ccdd857503de483012bea9c8e549daa76
# Parent  b9627a5740d223827053317cd9c8f40c721db972
blkfront: properly fail packet requests

c/s 1036:f5635e334aa5 ("blkfront: forward unknown IOCTLs to
scsi_cmd_ioctl() for /dev/sdX") uncovered a problem in blkfront's
request handling: blk_pc_request()-s, among other sources resulting
from the handling of the SG_IO ioctl in scsi_cmd_ioctl(), must not be
passed to end_request() without prior adjustment: Neither is their
->hard_cur_sectors necessarily correct (potentially resulting in an
infinite loop), nor is ->errors ever getting set properly to reflect
the failure (sg_io() intentionally ignores the return value from
blk_execute_rq()).

As blktap2's internally created devices have the same deficiency, fix
this there too.

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


diff -r b9627a5740d2 -r dc034d0ccdd8 drivers/xen/blkfront/blkfront.c
--- a/drivers/xen/blkfront/blkfront.c	Fri Feb 10 17:46:45 2012 +0100
+++ b/drivers/xen/blkfront/blkfront.c	Wed Feb 15 12:09:02 2012 +0100
@@ -709,6 +709,12 @@
 	while ((req = elv_next_request(rq)) != NULL) {
 		info = req->rq_disk->private_data;
 		if (!blk_fs_request(req)) {
+			if (blk_pc_request(req)) {
+				req->errors = (DID_ERROR << 16)
+					      | (DRIVER_INVALID << 24);
+				req->hard_cur_sectors = (req->data_len
+							 + 511) >> 9;
+			}
 			end_request(req, 0);
 			continue;
 		}
diff -r b9627a5740d2 -r dc034d0ccdd8 drivers/xen/blktap2/device.c
--- a/drivers/xen/blktap2/device.c	Fri Feb 10 17:46:45 2012 +0100
+++ b/drivers/xen/blktap2/device.c	Wed Feb 15 12:09:02 2012 +0100
@@ -3,6 +3,7 @@
 #include <linux/cdrom.h>
 #include <linux/hdreg.h>
 #include <linux/module.h>
+#include <scsi/scsi.h>
 #include <asm/tlbflush.h>
 
 #include <scsi/scsi.h>
@@ -825,6 +826,12 @@
 
 	while ((req = elv_next_request(rq)) != NULL) {
 		if (!blk_fs_request(req)) {
+			if (blk_pc_request(req)) {
+				req->errors = (DID_ERROR << 16)
+					      | (DRIVER_INVALID << 24);
+				req->hard_cur_sectors = (req->data_len
+							 + 511) >> 9;
+			}
 			end_request(req, 0);
 			continue;
 		}
@@ -912,9 +919,16 @@
 
 fail:
 	while ((req = elv_next_request(rq))) {
-		BTERR("device closed: failing secs %llu - %llu\n",
-		      (unsigned long long)req->sector,
-		      (unsigned long long)req->sector + req->nr_sectors);
+		if (blk_fs_request(req)) {
+			unsigned long long sec = req->sector;
+
+			BTERR("device closed: failing secs %#Lx-%#Lx\n",
+			      sec, sec + req->nr_sectors - 1);
+		} else if (blk_pc_request(req)) {
+			req->errors = (DID_ERROR << 16)
+				      | (DRIVER_INVALID << 24);
+			req->hard_cur_sectors = (req->data_len + 511) >> 9;
+		}
 		end_request(req, 0);
 	}
 }

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 17:11:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 17:11:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxiO0-0007NA-Qq; Wed, 15 Feb 2012 17:11:20 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxiNz-0007Mu-UO
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 17:11:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1329325869!13510418!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28035 invoked from network); 15 Feb 2012 17:11:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 17:11:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxiNp-0004qy-2E
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 17:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxiNo-00041X-Oi
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 17:11:08 +0000
Message-Id: <E1RxiNo-00041X-Oi@xenbits.xen.org>
Date: Wed, 15 Feb 2012 17:11:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: don't allow Dom0 to map MSI-X
	table writably
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329303884 -3600
# Node ID 618cbd27bac06fe39b1c6f28ded6d4d7f444e7bd
# Parent  0ba87b95e80bae059fe70b4b117dcc409f2471ef
x86: don't allow Dom0 to map MSI-X table writably

With the traditional qemu tree fixed to not use PROT_WRITE anymore in
the mmap() call for this region, and with the upstream qemu tree not
being capable of handling passthrough, yet, there's no need to treat
Dom specially here anymore.

This continues to leave unaddressed the case where PV guests map the
MSI-X table page(s) before setting up the first MSI-X interrupt (see
the original c/s 22182:68cc3c514a0a description for options).

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


diff -r 0ba87b95e80b -r 618cbd27bac0 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c	Mon Feb 13 17:26:08 2012 +0000
+++ b/xen/arch/x86/mm.c	Wed Feb 15 12:04:44 2012 +0100
@@ -869,7 +869,7 @@
             return -EINVAL;
         }
 
-        if ( !(l1f & _PAGE_RW) || IS_PRIV(pg_owner) ||
+        if ( !(l1f & _PAGE_RW) ||
              !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
             return 0;
         dprintk(XENLOG_G_WARNING,

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 17:11:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 17:11:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxiO0-0007NA-Qq; Wed, 15 Feb 2012 17:11:20 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxiNz-0007Mu-UO
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 17:11:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1329325869!13510418!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28035 invoked from network); 15 Feb 2012 17:11:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 17:11:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxiNp-0004qy-2E
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 17:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxiNo-00041X-Oi
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 17:11:08 +0000
Message-Id: <E1RxiNo-00041X-Oi@xenbits.xen.org>
Date: Wed, 15 Feb 2012 17:11:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: don't allow Dom0 to map MSI-X
	table writably
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329303884 -3600
# Node ID 618cbd27bac06fe39b1c6f28ded6d4d7f444e7bd
# Parent  0ba87b95e80bae059fe70b4b117dcc409f2471ef
x86: don't allow Dom0 to map MSI-X table writably

With the traditional qemu tree fixed to not use PROT_WRITE anymore in
the mmap() call for this region, and with the upstream qemu tree not
being capable of handling passthrough, yet, there's no need to treat
Dom specially here anymore.

This continues to leave unaddressed the case where PV guests map the
MSI-X table page(s) before setting up the first MSI-X interrupt (see
the original c/s 22182:68cc3c514a0a description for options).

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


diff -r 0ba87b95e80b -r 618cbd27bac0 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c	Mon Feb 13 17:26:08 2012 +0000
+++ b/xen/arch/x86/mm.c	Wed Feb 15 12:04:44 2012 +0100
@@ -869,7 +869,7 @@
             return -EINVAL;
         }
 
-        if ( !(l1f & _PAGE_RW) || IS_PRIV(pg_owner) ||
+        if ( !(l1f & _PAGE_RW) ||
              !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
             return 0;
         dprintk(XENLOG_G_WARNING,

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 23:11:15 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0G-00010d-83; Wed, 15 Feb 2012 23:11:12 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0F-00010T-8W
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:11 +0000
Received: from [85.158.143.35:16116] by server-1.bemta-4.messagelabs.com id
	72/96-20925-E8B3C3F4; Wed, 15 Feb 2012 23:11:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1329347468!2049191!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26521 invoked from network); 15 Feb 2012 23:11:09 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0C-0000eH-Bg
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0C-0005Ei-3f
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:08 +0000
Message-Id: <E1Rxo0C-0005Ei-3f@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: Set XEN_COMPILE_ARCH correctly
	from "uname -m" on ARM
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308653 0
# Node ID cf381dadef6e33082e961735983f81530980e16d
# Parent  618cbd27bac06fe39b1c6f28ded6d4d7f444e7bd
arm: Set XEN_COMPILE_ARCH correctly from "uname -m" on ARM

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


diff -r 618cbd27bac0 -r cf381dadef6e Config.mk
--- a/Config.mk	Wed Feb 15 12:04:44 2012 +0100
+++ b/Config.mk	Wed Feb 15 12:24:13 2012 +0000
@@ -13,7 +13,7 @@
 debug ?= y
 
 XEN_COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/ \
-                         -e s/i86pc/x86_32/ -e s/amd64/x86_64/)
+                         -e s/i86pc/x86_32/ -e s/amd64/x86_64/ -e s/arm.*/arm/)
 XEN_TARGET_ARCH     ?= $(XEN_COMPILE_ARCH)
 XEN_OS              ?= $(shell uname -s)
 

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 23:11:15 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0G-00010d-83; Wed, 15 Feb 2012 23:11:12 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0F-00010T-8W
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:11 +0000
Received: from [85.158.143.35:16116] by server-1.bemta-4.messagelabs.com id
	72/96-20925-E8B3C3F4; Wed, 15 Feb 2012 23:11:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1329347468!2049191!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26521 invoked from network); 15 Feb 2012 23:11:09 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0C-0000eH-Bg
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0C-0005Ei-3f
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:08 +0000
Message-Id: <E1Rxo0C-0005Ei-3f@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: Set XEN_COMPILE_ARCH correctly
	from "uname -m" on ARM
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308653 0
# Node ID cf381dadef6e33082e961735983f81530980e16d
# Parent  618cbd27bac06fe39b1c6f28ded6d4d7f444e7bd
arm: Set XEN_COMPILE_ARCH correctly from "uname -m" on ARM

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


diff -r 618cbd27bac0 -r cf381dadef6e Config.mk
--- a/Config.mk	Wed Feb 15 12:04:44 2012 +0100
+++ b/Config.mk	Wed Feb 15 12:24:13 2012 +0000
@@ -13,7 +13,7 @@
 debug ?= y
 
 XEN_COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/ \
-                         -e s/i86pc/x86_32/ -e s/amd64/x86_64/)
+                         -e s/i86pc/x86_32/ -e s/amd64/x86_64/ -e s/arm.*/arm/)
 XEN_TARGET_ARCH     ?= $(XEN_COMPILE_ARCH)
 XEN_OS              ?= $(shell uname -s)
 

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 23:11:18 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0I-000117-D9; Wed, 15 Feb 2012 23:11:14 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0H-00010o-Hl
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1329347406!61265960!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23821 invoked from network); 15 Feb 2012 23:10:07 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:10:07 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0E-0000eW-S7
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0E-0005Gf-Qf
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:10 +0000
Message-Id: <E1Rxo0E-0005Gf-Qf@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: Add stub functions instead of
	using DUMMY
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308657 0
# Node ID dfd6928609080bfa0875c683ca99419e3538618e
# Parent  9ae21c0392ccb7470de8dfd7a9db8cd19b2bd651
arm: Add stub functions instead of using DUMMY

Adds stubs for arch domctl and sysctl plus vcpu_op and memory_op.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r 9ae21c0392cc -r dfd692860908 xen/arch/arm/Makefile
--- a/xen/arch/arm/Makefile	Wed Feb 15 12:24:16 2012 +0000
+++ b/xen/arch/arm/Makefile	Wed Feb 15 12:24:17 2012 +0000
@@ -4,6 +4,8 @@
 obj-y += early_printk.o
 obj-y += entry.o
 obj-y += domain.o
+obj-y += domctl.o
+obj-y += sysctl.o
 obj-y += domain_build.o
 obj-y += gic.o
 obj-y += io.o
diff -r 9ae21c0392cc -r dfd692860908 xen/arch/arm/domain.c
--- a/xen/arch/arm/domain.c	Wed Feb 15 12:24:16 2012 +0000
+++ b/xen/arch/arm/domain.c	Wed Feb 15 12:24:17 2012 +0000
@@ -255,6 +255,11 @@
 {
 }
 
+long arch_do_vcpu_op(int cmd, struct vcpu *v, XEN_GUEST_HANDLE(void) arg)
+{
+    return -ENOSYS;
+}
+
 void arch_dump_vcpu_info(struct vcpu *v)
 {
 }
diff -r 9ae21c0392cc -r dfd692860908 xen/arch/arm/domctl.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/domctl.c	Wed Feb 15 12:24:17 2012 +0000
@@ -0,0 +1,27 @@
+/******************************************************************************
+ * Arch-specific domctl.c
+ *
+ * Copyright (c) 2012, Citrix Systems
+ */
+
+#include <xen/config.h>
+#include <xen/types.h>
+#include <xen/lib.h>
+#include <xen/errno.h>
+#include <public/domctl.h>
+
+long arch_do_domctl(struct xen_domctl *domctl,
+                    XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
+{
+	return -ENOSYS;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 9ae21c0392cc -r dfd692860908 xen/arch/arm/dummy.S
--- a/xen/arch/arm/dummy.S	Wed Feb 15 12:24:16 2012 +0000
+++ b/xen/arch/arm/dummy.S	Wed Feb 15 12:24:17 2012 +0000
@@ -8,12 +8,8 @@
 	
 DUMMY(alloc_pirq_struct);
 DUMMY(alloc_vcpu_guest_context);
-DUMMY(arch_do_domctl);
-DUMMY(arch_do_sysctl);
-DUMMY(arch_do_vcpu_op);
 DUMMY(arch_get_info_guest);
 DUMMY(arch_get_xen_caps);
-DUMMY(arch_memory_op);
 DUMMY(arch_set_info_guest);
 DUMMY(arch_vcpu_reset);
 DUMMY(create_grant_host_mapping);
diff -r 9ae21c0392cc -r dfd692860908 xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c	Wed Feb 15 12:24:16 2012 +0000
+++ b/xen/arch/arm/mm.c	Wed Feb 15 12:24:17 2012 +0000
@@ -320,6 +320,11 @@
 {
 }
 
+long arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg)
+{
+    return -ENOSYS;
+}
+
 /*
  * Local variables:
  * mode: C
diff -r 9ae21c0392cc -r dfd692860908 xen/arch/arm/sysctl.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/sysctl.c	Wed Feb 15 12:24:17 2012 +0000
@@ -0,0 +1,29 @@
+/******************************************************************************
+ * Arch-specific sysctl.c
+ *
+ * System management operations. For use by node control stack.
+ *
+ * Copyright (c) 2012, Citrix Systems
+ */
+
+#include <xen/config.h>
+#include <xen/types.h>
+#include <xen/lib.h>
+#include <xen/errno.h>
+#include <public/sysctl.h>
+
+long arch_do_sysctl(struct xen_sysctl *sysctl,
+		    XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
+{
+	return -ENOSYS;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 23:11:18 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0I-000117-D9; Wed, 15 Feb 2012 23:11:14 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0H-00010o-Hl
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1329347406!61265960!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23821 invoked from network); 15 Feb 2012 23:10:07 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:10:07 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0E-0000eW-S7
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0E-0005Gf-Qf
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:10 +0000
Message-Id: <E1Rxo0E-0005Gf-Qf@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: Add stub functions instead of
	using DUMMY
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308657 0
# Node ID dfd6928609080bfa0875c683ca99419e3538618e
# Parent  9ae21c0392ccb7470de8dfd7a9db8cd19b2bd651
arm: Add stub functions instead of using DUMMY

Adds stubs for arch domctl and sysctl plus vcpu_op and memory_op.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r 9ae21c0392cc -r dfd692860908 xen/arch/arm/Makefile
--- a/xen/arch/arm/Makefile	Wed Feb 15 12:24:16 2012 +0000
+++ b/xen/arch/arm/Makefile	Wed Feb 15 12:24:17 2012 +0000
@@ -4,6 +4,8 @@
 obj-y += early_printk.o
 obj-y += entry.o
 obj-y += domain.o
+obj-y += domctl.o
+obj-y += sysctl.o
 obj-y += domain_build.o
 obj-y += gic.o
 obj-y += io.o
diff -r 9ae21c0392cc -r dfd692860908 xen/arch/arm/domain.c
--- a/xen/arch/arm/domain.c	Wed Feb 15 12:24:16 2012 +0000
+++ b/xen/arch/arm/domain.c	Wed Feb 15 12:24:17 2012 +0000
@@ -255,6 +255,11 @@
 {
 }
 
+long arch_do_vcpu_op(int cmd, struct vcpu *v, XEN_GUEST_HANDLE(void) arg)
+{
+    return -ENOSYS;
+}
+
 void arch_dump_vcpu_info(struct vcpu *v)
 {
 }
diff -r 9ae21c0392cc -r dfd692860908 xen/arch/arm/domctl.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/domctl.c	Wed Feb 15 12:24:17 2012 +0000
@@ -0,0 +1,27 @@
+/******************************************************************************
+ * Arch-specific domctl.c
+ *
+ * Copyright (c) 2012, Citrix Systems
+ */
+
+#include <xen/config.h>
+#include <xen/types.h>
+#include <xen/lib.h>
+#include <xen/errno.h>
+#include <public/domctl.h>
+
+long arch_do_domctl(struct xen_domctl *domctl,
+                    XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
+{
+	return -ENOSYS;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 9ae21c0392cc -r dfd692860908 xen/arch/arm/dummy.S
--- a/xen/arch/arm/dummy.S	Wed Feb 15 12:24:16 2012 +0000
+++ b/xen/arch/arm/dummy.S	Wed Feb 15 12:24:17 2012 +0000
@@ -8,12 +8,8 @@
 	
 DUMMY(alloc_pirq_struct);
 DUMMY(alloc_vcpu_guest_context);
-DUMMY(arch_do_domctl);
-DUMMY(arch_do_sysctl);
-DUMMY(arch_do_vcpu_op);
 DUMMY(arch_get_info_guest);
 DUMMY(arch_get_xen_caps);
-DUMMY(arch_memory_op);
 DUMMY(arch_set_info_guest);
 DUMMY(arch_vcpu_reset);
 DUMMY(create_grant_host_mapping);
diff -r 9ae21c0392cc -r dfd692860908 xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c	Wed Feb 15 12:24:16 2012 +0000
+++ b/xen/arch/arm/mm.c	Wed Feb 15 12:24:17 2012 +0000
@@ -320,6 +320,11 @@
 {
 }
 
+long arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg)
+{
+    return -ENOSYS;
+}
+
 /*
  * Local variables:
  * mode: C
diff -r 9ae21c0392cc -r dfd692860908 xen/arch/arm/sysctl.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/sysctl.c	Wed Feb 15 12:24:17 2012 +0000
@@ -0,0 +1,29 @@
+/******************************************************************************
+ * Arch-specific sysctl.c
+ *
+ * System management operations. For use by node control stack.
+ *
+ * Copyright (c) 2012, Citrix Systems
+ */
+
+#include <xen/config.h>
+#include <xen/types.h>
+#include <xen/lib.h>
+#include <xen/errno.h>
+#include <public/sysctl.h>
+
+long arch_do_sysctl(struct xen_sysctl *sysctl,
+		    XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
+{
+	return -ENOSYS;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 23:11:18 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0J-00011e-Fo; Wed, 15 Feb 2012 23:11:15 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0I-000110-FP
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:14 +0000
Received: from [85.158.139.83:57259] by server-4.bemta-5.messagelabs.com id
	EC/FF-10788-19B3C3F4; Wed, 15 Feb 2012 23:11:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-182.messagelabs.com!1329347472!14397911!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3564 invoked from network); 15 Feb 2012 23:11:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0F-0000ec-TJ
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0F-0005HQ-S4
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:11 +0000
Message-Id: <E1Rxo0F-0005HQ-S4@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: provide dummy version of
	steal_page for tmem.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308658 0
# Node ID 23c06434d094800346bfb6c10741a99c5daf4638
# Parent  b9b4a28dfeda5a8add507dfd5fe139dbac3060d0
arm: provide dummy version of steal_page for tmem.

This is how IA64 does it.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r b9b4a28dfeda -r 23c06434d094 xen/arch/arm/dummy.S
--- a/xen/arch/arm/dummy.S	Wed Feb 15 12:24:17 2012 +0000
+++ b/xen/arch/arm/dummy.S	Wed Feb 15 12:24:18 2012 +0000
@@ -20,7 +20,6 @@
 DUMMY(domain_relinquish_resources);
 DUMMY(domain_set_time_offset);
 DUMMY(dom_cow);
-DUMMY(donate_page);
 DUMMY(flush_tlb_mask);
 DUMMY(free_vcpu_guest_context);
 DUMMY(get_page);
diff -r b9b4a28dfeda -r 23c06434d094 xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c	Wed Feb 15 12:24:17 2012 +0000
+++ b/xen/arch/arm/mm.c	Wed Feb 15 12:24:18 2012 +0000
@@ -325,6 +325,12 @@
     return -ENOSYS;
 }
 
+int donate_page(struct domain *d, struct page_info *page, unsigned int memflags)
+{
+    ASSERT(0);
+    return -ENOSYS;
+}
+
 /*
  * 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 Wed Feb 15 23:11:18 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0J-00011e-Fo; Wed, 15 Feb 2012 23:11:15 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0I-000110-FP
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:14 +0000
Received: from [85.158.139.83:57259] by server-4.bemta-5.messagelabs.com id
	EC/FF-10788-19B3C3F4; Wed, 15 Feb 2012 23:11:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-182.messagelabs.com!1329347472!14397911!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3564 invoked from network); 15 Feb 2012 23:11:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0F-0000ec-TJ
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0F-0005HQ-S4
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:11 +0000
Message-Id: <E1Rxo0F-0005HQ-S4@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: provide dummy version of
	steal_page for tmem.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308658 0
# Node ID 23c06434d094800346bfb6c10741a99c5daf4638
# Parent  b9b4a28dfeda5a8add507dfd5fe139dbac3060d0
arm: provide dummy version of steal_page for tmem.

This is how IA64 does it.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r b9b4a28dfeda -r 23c06434d094 xen/arch/arm/dummy.S
--- a/xen/arch/arm/dummy.S	Wed Feb 15 12:24:17 2012 +0000
+++ b/xen/arch/arm/dummy.S	Wed Feb 15 12:24:18 2012 +0000
@@ -20,7 +20,6 @@
 DUMMY(domain_relinquish_resources);
 DUMMY(domain_set_time_offset);
 DUMMY(dom_cow);
-DUMMY(donate_page);
 DUMMY(flush_tlb_mask);
 DUMMY(free_vcpu_guest_context);
 DUMMY(get_page);
diff -r b9b4a28dfeda -r 23c06434d094 xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c	Wed Feb 15 12:24:17 2012 +0000
+++ b/xen/arch/arm/mm.c	Wed Feb 15 12:24:18 2012 +0000
@@ -325,6 +325,12 @@
     return -ENOSYS;
 }
 
+int donate_page(struct domain *d, struct page_info *page, unsigned int memflags)
+{
+    ASSERT(0);
+    return -ENOSYS;
+}
+
 /*
  * 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 Wed Feb 15 23:11:18 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0I-000112-Ae; Wed, 15 Feb 2012 23:11:14 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0H-00010m-AI
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:13 +0000
Received: from [85.158.139.83:23982] by server-7.bemta-5.messagelabs.com id
	8E/C5-16195-09B3C3F4; Wed, 15 Feb 2012 23:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-182.messagelabs.com!1329347470!15243269!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15020 invoked from network); 15 Feb 2012 23:11:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0E-0000eT-IA
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0E-0005GH-AP
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:10 +0000
Message-Id: <E1Rxo0E-0005GH-AP@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: remove some unnecessary symbols
	from dummy.S
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308656 0
# Node ID 9ae21c0392ccb7470de8dfd7a9db8cd19b2bd651
# Parent  f8c331975a692dbb13d535e529440c268c8f9348
arm: remove some unnecessary symbols from dummy.S

Correct the comment on the DUMMY macro.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r f8c331975a69 -r 9ae21c0392cc xen/arch/arm/dummy.S
--- a/xen/arch/arm/dummy.S	Wed Feb 15 12:24:15 2012 +0000
+++ b/xen/arch/arm/dummy.S	Wed Feb 15 12:24:16 2012 +0000
@@ -1,8 +1,6 @@
-/* Nothing is mapped at 1G, for the moment */
 #define DUMMY(x) \
 	.globl x; \
-x:	.word 0xe7f000f0
-/* x:	mov r0, #0x40000000 ; str r0, [r0]; b x */
+x:	.word 0xe7f000f0 /* Undefined instruction */
 
 #define  NOP(x) \
 	.globl x; \
@@ -35,15 +33,11 @@
 DUMMY(get_page_type);
 DUMMY(gmfn_to_mfn);
 DUMMY(gnttab_clear_flag);
-DUMMY(gnttab_host_mapping_get_page_type);
 DUMMY(gnttab_mark_dirty);
 DUMMY(hypercall_create_continuation);
 DUMMY(iommu_map_page);
 DUMMY(iommu_unmap_page);
 DUMMY(is_iomem_page);
-DUMMY(local_event_delivery_enable);
-DUMMY(local_events_need_delivery);
-DUMMY(machine_to_phys_mapping_valid);
 DUMMY(max_page);
 DUMMY(node_online_map);
 DUMMY(nr_irqs_gsi);

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 23:11:18 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0I-000112-Ae; Wed, 15 Feb 2012 23:11:14 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0H-00010m-AI
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:13 +0000
Received: from [85.158.139.83:23982] by server-7.bemta-5.messagelabs.com id
	8E/C5-16195-09B3C3F4; Wed, 15 Feb 2012 23:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-182.messagelabs.com!1329347470!15243269!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15020 invoked from network); 15 Feb 2012 23:11:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0E-0000eT-IA
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0E-0005GH-AP
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:10 +0000
Message-Id: <E1Rxo0E-0005GH-AP@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: remove some unnecessary symbols
	from dummy.S
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308656 0
# Node ID 9ae21c0392ccb7470de8dfd7a9db8cd19b2bd651
# Parent  f8c331975a692dbb13d535e529440c268c8f9348
arm: remove some unnecessary symbols from dummy.S

Correct the comment on the DUMMY macro.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r f8c331975a69 -r 9ae21c0392cc xen/arch/arm/dummy.S
--- a/xen/arch/arm/dummy.S	Wed Feb 15 12:24:15 2012 +0000
+++ b/xen/arch/arm/dummy.S	Wed Feb 15 12:24:16 2012 +0000
@@ -1,8 +1,6 @@
-/* Nothing is mapped at 1G, for the moment */
 #define DUMMY(x) \
 	.globl x; \
-x:	.word 0xe7f000f0
-/* x:	mov r0, #0x40000000 ; str r0, [r0]; b x */
+x:	.word 0xe7f000f0 /* Undefined instruction */
 
 #define  NOP(x) \
 	.globl x; \
@@ -35,15 +33,11 @@
 DUMMY(get_page_type);
 DUMMY(gmfn_to_mfn);
 DUMMY(gnttab_clear_flag);
-DUMMY(gnttab_host_mapping_get_page_type);
 DUMMY(gnttab_mark_dirty);
 DUMMY(hypercall_create_continuation);
 DUMMY(iommu_map_page);
 DUMMY(iommu_unmap_page);
 DUMMY(is_iomem_page);
-DUMMY(local_event_delivery_enable);
-DUMMY(local_events_need_delivery);
-DUMMY(machine_to_phys_mapping_valid);
 DUMMY(max_page);
 DUMMY(node_online_map);
 DUMMY(nr_irqs_gsi);

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 23:11:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0M-00012r-LT; Wed, 15 Feb 2012 23:11:18 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0L-00010i-ND
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1329347470!11581105!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3386 invoked from network); 15 Feb 2012 23:11:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0D-0000eQ-Uc
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0D-0005Fu-Q0
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:09 +0000
Message-Id: <E1Rxo0D-0005Fu-Q0@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: align some register bit
	definitions
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308655 0
# Node ID f8c331975a692dbb13d535e529440c268c8f9348
# Parent  6c6f81d3be886a12d82c544c0fdf510205961029
arm: align some register bit definitions

Probably got de-hard-tabbed at some point.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r 6c6f81d3be88 -r f8c331975a69 xen/include/asm-arm/processor.h
--- a/xen/include/asm-arm/processor.h	Wed Feb 15 12:24:14 2012 +0000
+++ b/xen/include/asm-arm/processor.h	Wed Feb 15 12:24:15 2012 +0000
@@ -17,12 +17,12 @@
 #define PSR_MODE_UND 0x1b
 #define PSR_MODE_SYS 0x1f
 
-#define PSR_THUMB        (1<<5)        /* Thumb Mode enable */
-#define PSR_FIQ_MASK        (1<<6)        /* Fast Interrupt mask */
-#define PSR_IRQ_MASK        (1<<7)        /* Interrupt mask */
-#define PSR_ABT_MASK         (1<<8)        /* Asynchronous Abort mask */
-#define PSR_BIG_ENDIAN        (1<<9)        /* Big Endian Mode */
-#define PSR_JAZELLE        (1<<24)        /* Jazelle Mode */
+#define PSR_THUMB       (1<<5)        /* Thumb Mode enable */
+#define PSR_FIQ_MASK    (1<<6)        /* Fast Interrupt mask */
+#define PSR_IRQ_MASK    (1<<7)        /* Interrupt mask */
+#define PSR_ABT_MASK    (1<<8)        /* Asynchronous Abort mask */
+#define PSR_BIG_ENDIAN  (1<<9)        /* Big Endian Mode */
+#define PSR_JAZELLE     (1<<24)       /* Jazelle Mode */
 
 /* TTBCR Translation Table Base Control Register */
 #define TTBCR_N_MASK 0x07
@@ -35,56 +35,56 @@
 /* SCTLR System Control Register. */
 /* HSCTLR is a subset of this. */
 #define SCTLR_TE        (1<<30)
-#define SCTLR_AFE        (1<<29)
-#define SCTLR_TRE        (1<<28)
-#define SCTLR_NMFI        (1<<27)
+#define SCTLR_AFE       (1<<29)
+#define SCTLR_TRE       (1<<28)
+#define SCTLR_NMFI      (1<<27)
 #define SCTLR_EE        (1<<25)
 #define SCTLR_VE        (1<<24)
-#define SCTLR_U                (1<<22)
+#define SCTLR_U         (1<<22)
 #define SCTLR_FI        (1<<21)
-#define SCTLR_WXN        (1<<19)
+#define SCTLR_WXN       (1<<19)
 #define SCTLR_HA        (1<<17)
 #define SCTLR_RR        (1<<14)
-#define SCTLR_V                (1<<13)
-#define SCTLR_I                (1<<12)
-#define SCTLR_Z                (1<<11)
+#define SCTLR_V         (1<<13)
+#define SCTLR_I         (1<<12)
+#define SCTLR_Z         (1<<11)
 #define SCTLR_SW        (1<<10)
-#define SCTLR_B                (1<<7)
-#define SCTLR_C                (1<<2)
-#define SCTLR_A                (1<<1)
-#define SCTLR_M                (1<<0)
+#define SCTLR_B         (1<<7)
+#define SCTLR_C         (1<<2)
+#define SCTLR_A         (1<<1)
+#define SCTLR_M         (1<<0)
 
 #define SCTLR_BASE        0x00c50078
-#define HSCTLR_BASE        0x30c51878
+#define HSCTLR_BASE       0x30c51878
 
 /* HCR Hyp Configuration Register */
-#define HCR_TGE                (1<<27)
-#define HCR_TVM                (1<<26)
+#define HCR_TGE         (1<<27)
+#define HCR_TVM         (1<<26)
 #define HCR_TTLB        (1<<25)
-#define HCR_TPU                (1<<24)
-#define HCR_TPC                (1<<23)
-#define HCR_TSW                (1<<22)
-#define HCR_TAC                (1<<21)
-#define HCR_TIDCP        (1<<20)
-#define HCR_TSC                (1<<19)
+#define HCR_TPU         (1<<24)
+#define HCR_TPC         (1<<23)
+#define HCR_TSW         (1<<22)
+#define HCR_TAC         (1<<21)
+#define HCR_TIDCP       (1<<20)
+#define HCR_TSC         (1<<19)
 #define HCR_TID3        (1<<18)
 #define HCR_TID2        (1<<17)
 #define HCR_TID1        (1<<16)
 #define HCR_TID0        (1<<15)
-#define HCR_TWE                (1<<14)
-#define HCR_TWI                (1<<13)
-#define HCR_DC                (1<<12)
-#define HCR_BSU_MASK        (3<<10)
-#define HCR_FB                (1<<9)
-#define HCR_VA                (1<<8)
-#define HCR_VI                (1<<7)
-#define HCR_VF                (1<<6)
-#define HCR_AMO                (1<<5)
-#define HCR_IMO                (1<<4)
-#define HCR_FMO                (1<<3)
-#define HCR_PTW                (1<<2)
+#define HCR_TWE         (1<<14)
+#define HCR_TWI         (1<<13)
+#define HCR_DC          (1<<12)
+#define HCR_BSU_MASK    (3<<10)
+#define HCR_FB          (1<<9)
+#define HCR_VA          (1<<8)
+#define HCR_VI          (1<<7)
+#define HCR_VF          (1<<6)
+#define HCR_AMO         (1<<5)
+#define HCR_IMO         (1<<4)
+#define HCR_FMO         (1<<3)
+#define HCR_PTW         (1<<2)
 #define HCR_SWIO        (1<<1)
-#define HCR_VM                (1<<0)
+#define HCR_VM          (1<<0)
 
 #define HSR_EC_WFI_WFE              0x01
 #define HSR_EC_CP15_32              0x03

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 23:11:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0M-00012r-LT; Wed, 15 Feb 2012 23:11:18 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0L-00010i-ND
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1329347470!11581105!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3386 invoked from network); 15 Feb 2012 23:11:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0D-0000eQ-Uc
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0D-0005Fu-Q0
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:09 +0000
Message-Id: <E1Rxo0D-0005Fu-Q0@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: align some register bit
	definitions
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308655 0
# Node ID f8c331975a692dbb13d535e529440c268c8f9348
# Parent  6c6f81d3be886a12d82c544c0fdf510205961029
arm: align some register bit definitions

Probably got de-hard-tabbed at some point.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r 6c6f81d3be88 -r f8c331975a69 xen/include/asm-arm/processor.h
--- a/xen/include/asm-arm/processor.h	Wed Feb 15 12:24:14 2012 +0000
+++ b/xen/include/asm-arm/processor.h	Wed Feb 15 12:24:15 2012 +0000
@@ -17,12 +17,12 @@
 #define PSR_MODE_UND 0x1b
 #define PSR_MODE_SYS 0x1f
 
-#define PSR_THUMB        (1<<5)        /* Thumb Mode enable */
-#define PSR_FIQ_MASK        (1<<6)        /* Fast Interrupt mask */
-#define PSR_IRQ_MASK        (1<<7)        /* Interrupt mask */
-#define PSR_ABT_MASK         (1<<8)        /* Asynchronous Abort mask */
-#define PSR_BIG_ENDIAN        (1<<9)        /* Big Endian Mode */
-#define PSR_JAZELLE        (1<<24)        /* Jazelle Mode */
+#define PSR_THUMB       (1<<5)        /* Thumb Mode enable */
+#define PSR_FIQ_MASK    (1<<6)        /* Fast Interrupt mask */
+#define PSR_IRQ_MASK    (1<<7)        /* Interrupt mask */
+#define PSR_ABT_MASK    (1<<8)        /* Asynchronous Abort mask */
+#define PSR_BIG_ENDIAN  (1<<9)        /* Big Endian Mode */
+#define PSR_JAZELLE     (1<<24)       /* Jazelle Mode */
 
 /* TTBCR Translation Table Base Control Register */
 #define TTBCR_N_MASK 0x07
@@ -35,56 +35,56 @@
 /* SCTLR System Control Register. */
 /* HSCTLR is a subset of this. */
 #define SCTLR_TE        (1<<30)
-#define SCTLR_AFE        (1<<29)
-#define SCTLR_TRE        (1<<28)
-#define SCTLR_NMFI        (1<<27)
+#define SCTLR_AFE       (1<<29)
+#define SCTLR_TRE       (1<<28)
+#define SCTLR_NMFI      (1<<27)
 #define SCTLR_EE        (1<<25)
 #define SCTLR_VE        (1<<24)
-#define SCTLR_U                (1<<22)
+#define SCTLR_U         (1<<22)
 #define SCTLR_FI        (1<<21)
-#define SCTLR_WXN        (1<<19)
+#define SCTLR_WXN       (1<<19)
 #define SCTLR_HA        (1<<17)
 #define SCTLR_RR        (1<<14)
-#define SCTLR_V                (1<<13)
-#define SCTLR_I                (1<<12)
-#define SCTLR_Z                (1<<11)
+#define SCTLR_V         (1<<13)
+#define SCTLR_I         (1<<12)
+#define SCTLR_Z         (1<<11)
 #define SCTLR_SW        (1<<10)
-#define SCTLR_B                (1<<7)
-#define SCTLR_C                (1<<2)
-#define SCTLR_A                (1<<1)
-#define SCTLR_M                (1<<0)
+#define SCTLR_B         (1<<7)
+#define SCTLR_C         (1<<2)
+#define SCTLR_A         (1<<1)
+#define SCTLR_M         (1<<0)
 
 #define SCTLR_BASE        0x00c50078
-#define HSCTLR_BASE        0x30c51878
+#define HSCTLR_BASE       0x30c51878
 
 /* HCR Hyp Configuration Register */
-#define HCR_TGE                (1<<27)
-#define HCR_TVM                (1<<26)
+#define HCR_TGE         (1<<27)
+#define HCR_TVM         (1<<26)
 #define HCR_TTLB        (1<<25)
-#define HCR_TPU                (1<<24)
-#define HCR_TPC                (1<<23)
-#define HCR_TSW                (1<<22)
-#define HCR_TAC                (1<<21)
-#define HCR_TIDCP        (1<<20)
-#define HCR_TSC                (1<<19)
+#define HCR_TPU         (1<<24)
+#define HCR_TPC         (1<<23)
+#define HCR_TSW         (1<<22)
+#define HCR_TAC         (1<<21)
+#define HCR_TIDCP       (1<<20)
+#define HCR_TSC         (1<<19)
 #define HCR_TID3        (1<<18)
 #define HCR_TID2        (1<<17)
 #define HCR_TID1        (1<<16)
 #define HCR_TID0        (1<<15)
-#define HCR_TWE                (1<<14)
-#define HCR_TWI                (1<<13)
-#define HCR_DC                (1<<12)
-#define HCR_BSU_MASK        (3<<10)
-#define HCR_FB                (1<<9)
-#define HCR_VA                (1<<8)
-#define HCR_VI                (1<<7)
-#define HCR_VF                (1<<6)
-#define HCR_AMO                (1<<5)
-#define HCR_IMO                (1<<4)
-#define HCR_FMO                (1<<3)
-#define HCR_PTW                (1<<2)
+#define HCR_TWE         (1<<14)
+#define HCR_TWI         (1<<13)
+#define HCR_DC          (1<<12)
+#define HCR_BSU_MASK    (3<<10)
+#define HCR_FB          (1<<9)
+#define HCR_VA          (1<<8)
+#define HCR_VI          (1<<7)
+#define HCR_VF          (1<<6)
+#define HCR_AMO         (1<<5)
+#define HCR_IMO         (1<<4)
+#define HCR_FMO         (1<<3)
+#define HCR_PTW         (1<<2)
 #define HCR_SWIO        (1<<1)
-#define HCR_VM                (1<<0)
+#define HCR_VM          (1<<0)
 
 #define HSR_EC_WFI_WFE              0x01
 #define HSR_EC_CP15_32              0x03

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 23:11:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0M-00012k-Iq; Wed, 15 Feb 2012 23:11:18 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0K-00010V-Pj
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-21.messagelabs.com!1329347469!12470554!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3067 invoked from network); 15 Feb 2012 23:11:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0D-0000eK-4t
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0C-0005F8-OO
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:08 +0000
Message-Id: <E1Rxo0C-0005F8-OO@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: add a missing local-vars comment
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308654 0
# Node ID f7bf6679fc940eae29b414ba9b9c415706914721
# Parent  cf381dadef6e33082e961735983f81530980e16d
arm: add a missing local-vars comment

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r cf381dadef6e -r f7bf6679fc94 xen/arch/arm/kernel.c
--- a/xen/arch/arm/kernel.c	Wed Feb 15 12:24:13 2012 +0000
+++ b/xen/arch/arm/kernel.c	Wed Feb 15 12:24:14 2012 +0000
@@ -194,3 +194,12 @@
 {
     info->load(info);
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 23:11:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0M-00012k-Iq; Wed, 15 Feb 2012 23:11:18 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0K-00010V-Pj
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-21.messagelabs.com!1329347469!12470554!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3067 invoked from network); 15 Feb 2012 23:11:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0D-0000eK-4t
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0C-0005F8-OO
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:08 +0000
Message-Id: <E1Rxo0C-0005F8-OO@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: add a missing local-vars comment
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308654 0
# Node ID f7bf6679fc940eae29b414ba9b9c415706914721
# Parent  cf381dadef6e33082e961735983f81530980e16d
arm: add a missing local-vars comment

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r cf381dadef6e -r f7bf6679fc94 xen/arch/arm/kernel.c
--- a/xen/arch/arm/kernel.c	Wed Feb 15 12:24:13 2012 +0000
+++ b/xen/arch/arm/kernel.c	Wed Feb 15 12:24:14 2012 +0000
@@ -194,3 +194,12 @@
 {
     info->load(info);
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 23:11:21 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0O-00014P-R6; Wed, 15 Feb 2012 23:11:20 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0N-000111-Es
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1329347471!9358542!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1146 invoked from network); 15 Feb 2012 23:11:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0F-0000eZ-D2
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0F-0005H2-Bo
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:11 +0000
Message-Id: <E1Rxo0F-0005H2-Bo@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] PM: only include
	XEN_SYSCTL_{get_pmstat, pm_op} if HAVE_ACPI
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308657 0
# Node ID b9b4a28dfeda5a8add507dfd5fe139dbac3060d0
# Parent  dfd6928609080bfa0875c683ca99419e3538618e
PM: only include XEN_SYSCTL_{get_pmstat,pm_op} if HAVE_ACPI

These hypercalls are currently ACPI specific and implemented in
xen/drivers/acpi which is not implemented on ARM.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: keir@xen.org
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r dfd692860908 -r b9b4a28dfeda xen/Rules.mk
--- a/xen/Rules.mk	Wed Feb 15 12:24:17 2012 +0000
+++ b/xen/Rules.mk	Wed Feb 15 12:24:17 2012 +0000
@@ -50,6 +50,7 @@
 CFLAGS-$(perfc)         += -DPERF_COUNTERS
 CFLAGS-$(perfc_arrays)  += -DPERF_ARRAYS
 CFLAGS-$(lock_profile)  += -DLOCK_PROFILE
+CFLAGS-$(HAS_ACPI)      += -DHAS_ACPI
 CFLAGS-$(frame_pointer) += -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER
 
 ifneq ($(max_phys_cpus),)
diff -r dfd692860908 -r b9b4a28dfeda xen/arch/arm/dummy.S
--- a/xen/arch/arm/dummy.S	Wed Feb 15 12:24:17 2012 +0000
+++ b/xen/arch/arm/dummy.S	Wed Feb 15 12:24:17 2012 +0000
@@ -16,13 +16,11 @@
 DUMMY(__cpu_die);
 DUMMY(__cpu_disable);
 DUMMY(__cpu_up);
-DUMMY(do_get_pm_info);
 DUMMY(domain_get_maximum_gpfn);
 DUMMY(domain_relinquish_resources);
 DUMMY(domain_set_time_offset);
 DUMMY(dom_cow);
 DUMMY(donate_page);
-DUMMY(do_pm_op);
 DUMMY(flush_tlb_mask);
 DUMMY(free_vcpu_guest_context);
 DUMMY(get_page);
diff -r dfd692860908 -r b9b4a28dfeda xen/common/sysctl.c
--- a/xen/common/sysctl.c	Wed Feb 15 12:24:17 2012 +0000
+++ b/xen/common/sysctl.c	Wed Feb 15 12:24:17 2012 +0000
@@ -224,6 +224,7 @@
     }
     break;
 
+#ifdef HAS_ACPI
     case XEN_SYSCTL_get_pmstat:
     {
         ret = xsm_get_pmstat();
@@ -259,6 +260,7 @@
         }
     }
     break;
+#endif
 
     case XEN_SYSCTL_page_offline_op:
     {

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 23:11:21 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0O-00014P-R6; Wed, 15 Feb 2012 23:11:20 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0N-000111-Es
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1329347471!9358542!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1146 invoked from network); 15 Feb 2012 23:11:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0F-0000eZ-D2
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0F-0005H2-Bo
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:11 +0000
Message-Id: <E1Rxo0F-0005H2-Bo@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] PM: only include
	XEN_SYSCTL_{get_pmstat, pm_op} if HAVE_ACPI
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308657 0
# Node ID b9b4a28dfeda5a8add507dfd5fe139dbac3060d0
# Parent  dfd6928609080bfa0875c683ca99419e3538618e
PM: only include XEN_SYSCTL_{get_pmstat,pm_op} if HAVE_ACPI

These hypercalls are currently ACPI specific and implemented in
xen/drivers/acpi which is not implemented on ARM.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: keir@xen.org
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r dfd692860908 -r b9b4a28dfeda xen/Rules.mk
--- a/xen/Rules.mk	Wed Feb 15 12:24:17 2012 +0000
+++ b/xen/Rules.mk	Wed Feb 15 12:24:17 2012 +0000
@@ -50,6 +50,7 @@
 CFLAGS-$(perfc)         += -DPERF_COUNTERS
 CFLAGS-$(perfc_arrays)  += -DPERF_ARRAYS
 CFLAGS-$(lock_profile)  += -DLOCK_PROFILE
+CFLAGS-$(HAS_ACPI)      += -DHAS_ACPI
 CFLAGS-$(frame_pointer) += -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER
 
 ifneq ($(max_phys_cpus),)
diff -r dfd692860908 -r b9b4a28dfeda xen/arch/arm/dummy.S
--- a/xen/arch/arm/dummy.S	Wed Feb 15 12:24:17 2012 +0000
+++ b/xen/arch/arm/dummy.S	Wed Feb 15 12:24:17 2012 +0000
@@ -16,13 +16,11 @@
 DUMMY(__cpu_die);
 DUMMY(__cpu_disable);
 DUMMY(__cpu_up);
-DUMMY(do_get_pm_info);
 DUMMY(domain_get_maximum_gpfn);
 DUMMY(domain_relinquish_resources);
 DUMMY(domain_set_time_offset);
 DUMMY(dom_cow);
 DUMMY(donate_page);
-DUMMY(do_pm_op);
 DUMMY(flush_tlb_mask);
 DUMMY(free_vcpu_guest_context);
 DUMMY(get_page);
diff -r dfd692860908 -r b9b4a28dfeda xen/common/sysctl.c
--- a/xen/common/sysctl.c	Wed Feb 15 12:24:17 2012 +0000
+++ b/xen/common/sysctl.c	Wed Feb 15 12:24:17 2012 +0000
@@ -224,6 +224,7 @@
     }
     break;
 
+#ifdef HAS_ACPI
     case XEN_SYSCTL_get_pmstat:
     {
         ret = xsm_get_pmstat();
@@ -259,6 +260,7 @@
         }
     }
     break;
+#endif
 
     case XEN_SYSCTL_page_offline_op:
     {

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 23:11:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0O-00014K-OI; Wed, 15 Feb 2012 23:11:20 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0M-00010p-Px
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1329347469!9358541!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1121 invoked from network); 15 Feb 2012 23:11:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0D-0000eN-Gt
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0D-0005FW-9F
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:09 +0000
Message-Id: <E1Rxo0D-0005FW-9F@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: define some more cp15 registers
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308654 0
# Node ID 6c6f81d3be886a12d82c544c0fdf510205961029
# Parent  f7bf6679fc940eae29b414ba9b9c415706914721
arm: define some more cp15 registers

Complete the set of cache flush and add processor feature registers. Print the
latter on boot for debug.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r f7bf6679fc94 -r 6c6f81d3be88 xen/arch/arm/setup.c
--- a/xen/arch/arm/setup.c	Wed Feb 15 12:24:14 2012 +0000
+++ b/xen/arch/arm/setup.c	Wed Feb 15 12:24:14 2012 +0000
@@ -64,6 +64,20 @@
         /* TODO: setup_idle_pagetable(); */
 }
 
+static void processor_id(void)
+{
+    printk("Processor Features: %08x %08x\n",
+           READ_CP32(ID_PFR0), READ_CP32(ID_PFR0));
+    printk("Debug Features: %08x\n", READ_CP32(ID_DFR0));
+    printk("Auxiliary Features: %08x\n", READ_CP32(ID_AFR0));
+    printk("Memory Model Features: %08x %08x %08x %08x\n",
+           READ_CP32(ID_MMFR0), READ_CP32(ID_MMFR1),
+           READ_CP32(ID_MMFR2), READ_CP32(ID_MMFR3));
+    printk("ISA Features: %08x %08x %08x %08x %08x %08x\n",
+           READ_CP32(ID_ISAR0), READ_CP32(ID_ISAR1), READ_CP32(ID_ISAR2),
+           READ_CP32(ID_ISAR3), READ_CP32(ID_ISAR4), READ_CP32(ID_ISAR5));
+}
+
 static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size)
 {
     paddr_t ram_start;
@@ -185,7 +199,10 @@
      */
     WRITE_CP32(0x80002558, VTCR); isb();
 
+    processor_id();
+
     softirq_init();
+
     tasklet_subsys_init();
 
     init_IRQ();
diff -r f7bf6679fc94 -r 6c6f81d3be88 xen/include/asm-arm/cpregs.h
--- a/xen/include/asm-arm/cpregs.h	Wed Feb 15 12:24:14 2012 +0000
+++ b/xen/include/asm-arm/cpregs.h	Wed Feb 15 12:24:14 2012 +0000
@@ -93,6 +93,18 @@
 /* CP15 CR0: CPUID and Cache Type Registers */
 #define ID_PFR0         p15,0,c0,c1,0   /* Processor Feature Register 0 */
 #define ID_PFR1         p15,0,c0,c1,1   /* Processor Feature Register 1 */
+#define ID_DFR0         p15,0,c0,c1,2   /* Debug Feature Register 0 */
+#define ID_AFR0         p15,0,c0,c1,3   /* Auxiliary Feature Register 0 */
+#define ID_MMFR0        p15,0,c0,c1,4   /* Memory Model Feature Register 0 */
+#define ID_MMFR1        p15,0,c0,c1,5   /* Memory Model Feature Register 1 */
+#define ID_MMFR2        p15,0,c0,c1,6   /* Memory Model Feature Register 2 */
+#define ID_MMFR3        p15,0,c0,c1,7   /* Memory Model Feature Register 3 */
+#define ID_ISAR0        p15,0,c0,c2,0   /* ISA Feature Register 0 */
+#define ID_ISAR1        p15,0,c0,c2,1   /* ISA Feature Register 1 */
+#define ID_ISAR2        p15,0,c0,c2,2   /* ISA Feature Register 2 */
+#define ID_ISAR3        p15,0,c0,c2,3   /* ISA Feature Register 3 */
+#define ID_ISAR4        p15,0,c0,c2,4   /* ISA Feature Register 4 */
+#define ID_ISAR5        p15,0,c0,c2,5   /* ISA Feature Register 5 */
 #define CCSIDR          p15,1,c0,c0,0   /* Cache Size ID Registers */
 #define CLIDR           p15,1,c0,c0,1   /* Cache Level ID Register */
 #define CSSELR          p15,2,c0,c0,0   /* Cache Size Selection Register */
@@ -134,7 +146,11 @@
 #define ICIALLUIS       p15,0,c7,c1,0   /* Invalidate all instruction caches to PoU inner shareable */
 #define BPIALLIS        p15,0,c7,c1,6   /* Invalidate entire branch predictor array inner shareable */
 #define ICIALLU         p15,0,c7,c5,0   /* Invalidate all instruction caches to PoU */
+#define ICIMVAU         p15,0,c7,c5,1   /* Invalidate instruction caches by MVA to PoU */
 #define BPIALL          p15,0,c7,c5,6   /* Invalidate entire branch predictor array */
+#define BPIMVA          p15,0,c7,c5,7   /* Invalidate MVA from branch predictor array */
+#define DCIMVAC         p15,0,c7,c6,1   /* Invalidate data cache line by MVA to PoC */
+#define DCISW           p15,0,c7,c2,1   /* Invalidate data cache line by set/way */
 #define ATS1CPR         p15,0,c7,c8,0   /* Address Translation Stage 1. Non-Secure Kernel Read */
 #define ATS1CPW         p15,0,c7,c8,1   /* Address Translation Stage 1. Non-Secure Kernel Write */
 #define ATS1CUR         p15,0,c7,c8,2   /* Address Translation Stage 1. Non-Secure User Read */
@@ -144,6 +160,8 @@
 #define ATS12NSOUR      p15,0,c7,c8,6   /* Address Translation Stage 1+2 Non-Secure User Read */
 #define ATS12NSOUW      p15,0,c7,c8,7   /* Address Translation Stage 1+2 Non-Secure User Write */
 #define DCCMVAC         p15,0,c7,c10,1  /* Clean data or unified cache line by MVA to PoC */
+#define DCCSW           p15,0,c7,c10,2  /* Clean data cache line by set/way */
+#define DCCMVAU         p15,0,c7,c11,1  /* Clean data cache line by MVA to PoU */
 #define DCCISW          p15,0,c7,c14,2  /* Clean and invalidate data cache line by set/way */
 #define ATS1HR          p15,4,c7,c8,0   /* Address Translation Stage 1 Hyp. Read */
 #define ATS1HW          p15,4,c7,c8,1   /* Address Translation Stage 1 Hyp. Write */

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 23:11:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0O-00014K-OI; Wed, 15 Feb 2012 23:11:20 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0M-00010p-Px
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1329347469!9358541!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1121 invoked from network); 15 Feb 2012 23:11:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0D-0000eN-Gt
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0D-0005FW-9F
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:09 +0000
Message-Id: <E1Rxo0D-0005FW-9F@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: define some more cp15 registers
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308654 0
# Node ID 6c6f81d3be886a12d82c544c0fdf510205961029
# Parent  f7bf6679fc940eae29b414ba9b9c415706914721
arm: define some more cp15 registers

Complete the set of cache flush and add processor feature registers. Print the
latter on boot for debug.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r f7bf6679fc94 -r 6c6f81d3be88 xen/arch/arm/setup.c
--- a/xen/arch/arm/setup.c	Wed Feb 15 12:24:14 2012 +0000
+++ b/xen/arch/arm/setup.c	Wed Feb 15 12:24:14 2012 +0000
@@ -64,6 +64,20 @@
         /* TODO: setup_idle_pagetable(); */
 }
 
+static void processor_id(void)
+{
+    printk("Processor Features: %08x %08x\n",
+           READ_CP32(ID_PFR0), READ_CP32(ID_PFR0));
+    printk("Debug Features: %08x\n", READ_CP32(ID_DFR0));
+    printk("Auxiliary Features: %08x\n", READ_CP32(ID_AFR0));
+    printk("Memory Model Features: %08x %08x %08x %08x\n",
+           READ_CP32(ID_MMFR0), READ_CP32(ID_MMFR1),
+           READ_CP32(ID_MMFR2), READ_CP32(ID_MMFR3));
+    printk("ISA Features: %08x %08x %08x %08x %08x %08x\n",
+           READ_CP32(ID_ISAR0), READ_CP32(ID_ISAR1), READ_CP32(ID_ISAR2),
+           READ_CP32(ID_ISAR3), READ_CP32(ID_ISAR4), READ_CP32(ID_ISAR5));
+}
+
 static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size)
 {
     paddr_t ram_start;
@@ -185,7 +199,10 @@
      */
     WRITE_CP32(0x80002558, VTCR); isb();
 
+    processor_id();
+
     softirq_init();
+
     tasklet_subsys_init();
 
     init_IRQ();
diff -r f7bf6679fc94 -r 6c6f81d3be88 xen/include/asm-arm/cpregs.h
--- a/xen/include/asm-arm/cpregs.h	Wed Feb 15 12:24:14 2012 +0000
+++ b/xen/include/asm-arm/cpregs.h	Wed Feb 15 12:24:14 2012 +0000
@@ -93,6 +93,18 @@
 /* CP15 CR0: CPUID and Cache Type Registers */
 #define ID_PFR0         p15,0,c0,c1,0   /* Processor Feature Register 0 */
 #define ID_PFR1         p15,0,c0,c1,1   /* Processor Feature Register 1 */
+#define ID_DFR0         p15,0,c0,c1,2   /* Debug Feature Register 0 */
+#define ID_AFR0         p15,0,c0,c1,3   /* Auxiliary Feature Register 0 */
+#define ID_MMFR0        p15,0,c0,c1,4   /* Memory Model Feature Register 0 */
+#define ID_MMFR1        p15,0,c0,c1,5   /* Memory Model Feature Register 1 */
+#define ID_MMFR2        p15,0,c0,c1,6   /* Memory Model Feature Register 2 */
+#define ID_MMFR3        p15,0,c0,c1,7   /* Memory Model Feature Register 3 */
+#define ID_ISAR0        p15,0,c0,c2,0   /* ISA Feature Register 0 */
+#define ID_ISAR1        p15,0,c0,c2,1   /* ISA Feature Register 1 */
+#define ID_ISAR2        p15,0,c0,c2,2   /* ISA Feature Register 2 */
+#define ID_ISAR3        p15,0,c0,c2,3   /* ISA Feature Register 3 */
+#define ID_ISAR4        p15,0,c0,c2,4   /* ISA Feature Register 4 */
+#define ID_ISAR5        p15,0,c0,c2,5   /* ISA Feature Register 5 */
 #define CCSIDR          p15,1,c0,c0,0   /* Cache Size ID Registers */
 #define CLIDR           p15,1,c0,c0,1   /* Cache Level ID Register */
 #define CSSELR          p15,2,c0,c0,0   /* Cache Size Selection Register */
@@ -134,7 +146,11 @@
 #define ICIALLUIS       p15,0,c7,c1,0   /* Invalidate all instruction caches to PoU inner shareable */
 #define BPIALLIS        p15,0,c7,c1,6   /* Invalidate entire branch predictor array inner shareable */
 #define ICIALLU         p15,0,c7,c5,0   /* Invalidate all instruction caches to PoU */
+#define ICIMVAU         p15,0,c7,c5,1   /* Invalidate instruction caches by MVA to PoU */
 #define BPIALL          p15,0,c7,c5,6   /* Invalidate entire branch predictor array */
+#define BPIMVA          p15,0,c7,c5,7   /* Invalidate MVA from branch predictor array */
+#define DCIMVAC         p15,0,c7,c6,1   /* Invalidate data cache line by MVA to PoC */
+#define DCISW           p15,0,c7,c2,1   /* Invalidate data cache line by set/way */
 #define ATS1CPR         p15,0,c7,c8,0   /* Address Translation Stage 1. Non-Secure Kernel Read */
 #define ATS1CPW         p15,0,c7,c8,1   /* Address Translation Stage 1. Non-Secure Kernel Write */
 #define ATS1CUR         p15,0,c7,c8,2   /* Address Translation Stage 1. Non-Secure User Read */
@@ -144,6 +160,8 @@
 #define ATS12NSOUR      p15,0,c7,c8,6   /* Address Translation Stage 1+2 Non-Secure User Read */
 #define ATS12NSOUW      p15,0,c7,c8,7   /* Address Translation Stage 1+2 Non-Secure User Write */
 #define DCCMVAC         p15,0,c7,c10,1  /* Clean data or unified cache line by MVA to PoC */
+#define DCCSW           p15,0,c7,c10,2  /* Clean data cache line by set/way */
+#define DCCMVAU         p15,0,c7,c11,1  /* Clean data cache line by MVA to PoU */
 #define DCCISW          p15,0,c7,c14,2  /* Clean and invalidate data cache line by set/way */
 #define ATS1HR          p15,4,c7,c8,0   /* Address Translation Stage 1 Hyp. Read */
 #define ATS1HW          p15,4,c7,c8,1   /* Address Translation Stage 1 Hyp. Write */

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 23:11:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0P-00015E-Vz; Wed, 15 Feb 2012 23:11:21 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0O-00011D-0Y
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1329347472!13539383!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18590 invoked from network); 15 Feb 2012 23:11:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0G-0000ef-HH
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0G-0005Hp-D4
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:12 +0000
Message-Id: <E1Rxo0G-0005Hp-D4@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: Implement arch_get_xen_caps
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308659 0
# Node ID 6ed7fdb587afd1fd6f724032cf7040041369f819
# Parent  23c06434d094800346bfb6c10741a99c5daf4638
arm: Implement arch_get_xen_caps

TBD: correct arch name for this string. Should be "xen-" / "hvm-" or something
else given the hybrid model we are using on ARM?

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r 23c06434d094 -r 6ed7fdb587af xen/arch/arm/dummy.S
--- a/xen/arch/arm/dummy.S	Wed Feb 15 12:24:18 2012 +0000
+++ b/xen/arch/arm/dummy.S	Wed Feb 15 12:24:19 2012 +0000
@@ -9,7 +9,6 @@
 DUMMY(alloc_pirq_struct);
 DUMMY(alloc_vcpu_guest_context);
 DUMMY(arch_get_info_guest);
-DUMMY(arch_get_xen_caps);
 DUMMY(arch_set_info_guest);
 DUMMY(arch_vcpu_reset);
 DUMMY(create_grant_host_mapping);
diff -r 23c06434d094 -r 6ed7fdb587af xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c	Wed Feb 15 12:24:18 2012 +0000
+++ b/xen/arch/arm/mm.c	Wed Feb 15 12:24:19 2012 +0000
@@ -24,6 +24,7 @@
 #include <xen/init.h>
 #include <xen/mm.h>
 #include <xen/preempt.h>
+#include <xen/errno.h>
 #include <asm/page.h>
 #include <asm/current.h>
 
diff -r 23c06434d094 -r 6ed7fdb587af xen/arch/arm/setup.c
--- a/xen/arch/arm/setup.c	Wed Feb 15 12:24:18 2012 +0000
+++ b/xen/arch/arm/setup.c	Wed Feb 15 12:24:19 2012 +0000
@@ -271,6 +271,18 @@
     reset_stack_and_jump(init_done);
 }
 
+void arch_get_xen_caps(xen_capabilities_info_t *info)
+{
+    /* Interface name is always xen-3.0-* for Xen-3.x. */
+    int major = 3, minor = 0;
+    char s[32];
+
+    (*info)[0] = '\0';
+
+    snprintf(s, sizeof(s), "xen-%d.%d-armv7l ", major, minor);
+    safe_strcat(*info, 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 Wed Feb 15 23:11:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0P-00015E-Vz; Wed, 15 Feb 2012 23:11:21 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0O-00011D-0Y
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1329347472!13539383!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18590 invoked from network); 15 Feb 2012 23:11:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0G-0000ef-HH
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0G-0005Hp-D4
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:12 +0000
Message-Id: <E1Rxo0G-0005Hp-D4@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: Implement arch_get_xen_caps
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308659 0
# Node ID 6ed7fdb587afd1fd6f724032cf7040041369f819
# Parent  23c06434d094800346bfb6c10741a99c5daf4638
arm: Implement arch_get_xen_caps

TBD: correct arch name for this string. Should be "xen-" / "hvm-" or something
else given the hybrid model we are using on ARM?

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r 23c06434d094 -r 6ed7fdb587af xen/arch/arm/dummy.S
--- a/xen/arch/arm/dummy.S	Wed Feb 15 12:24:18 2012 +0000
+++ b/xen/arch/arm/dummy.S	Wed Feb 15 12:24:19 2012 +0000
@@ -9,7 +9,6 @@
 DUMMY(alloc_pirq_struct);
 DUMMY(alloc_vcpu_guest_context);
 DUMMY(arch_get_info_guest);
-DUMMY(arch_get_xen_caps);
 DUMMY(arch_set_info_guest);
 DUMMY(arch_vcpu_reset);
 DUMMY(create_grant_host_mapping);
diff -r 23c06434d094 -r 6ed7fdb587af xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c	Wed Feb 15 12:24:18 2012 +0000
+++ b/xen/arch/arm/mm.c	Wed Feb 15 12:24:19 2012 +0000
@@ -24,6 +24,7 @@
 #include <xen/init.h>
 #include <xen/mm.h>
 #include <xen/preempt.h>
+#include <xen/errno.h>
 #include <asm/page.h>
 #include <asm/current.h>
 
diff -r 23c06434d094 -r 6ed7fdb587af xen/arch/arm/setup.c
--- a/xen/arch/arm/setup.c	Wed Feb 15 12:24:18 2012 +0000
+++ b/xen/arch/arm/setup.c	Wed Feb 15 12:24:19 2012 +0000
@@ -271,6 +271,18 @@
     reset_stack_and_jump(init_done);
 }
 
+void arch_get_xen_caps(xen_capabilities_info_t *info)
+{
+    /* Interface name is always xen-3.0-* for Xen-3.x. */
+    int major = 3, minor = 0;
+    char s[32];
+
+    (*info)[0] = '\0';
+
+    snprintf(s, sizeof(s), "xen-%d.%d-armv7l ", major, minor);
+    safe_strcat(*info, 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 Wed Feb 15 23:11:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0Q-00015K-2R; Wed, 15 Feb 2012 23:11:22 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0O-00011M-BI
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-21.messagelabs.com!1329347473!8420153!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21580 invoked from network); 15 Feb 2012 23:11:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0G-0000ei-VS
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0G-0005IE-UH
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:12 +0000
Message-Id: <E1Rxo0G-0005IE-UH@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: make need_iommu == 0 if
	!HAS_PASSTHROUGH
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308659 0
# Node ID 32e049f49b873ee7c0c1ed6c72390706f92b851c
# Parent  6ed7fdb587afd1fd6f724032cf7040041369f819
xen: make need_iommu == 0 if !HAS_PASSTHROUGH

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: keir@xen.org
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r 6ed7fdb587af -r 32e049f49b87 xen/Rules.mk
--- a/xen/Rules.mk	Wed Feb 15 12:24:19 2012 +0000
+++ b/xen/Rules.mk	Wed Feb 15 12:24:19 2012 +0000
@@ -51,6 +51,7 @@
 CFLAGS-$(perfc_arrays)  += -DPERF_ARRAYS
 CFLAGS-$(lock_profile)  += -DLOCK_PROFILE
 CFLAGS-$(HAS_ACPI)      += -DHAS_ACPI
+CFLAGS-$(HAS_PASSTHROUGH) += -DHAS_PASSTHROUGH
 CFLAGS-$(frame_pointer) += -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER
 
 ifneq ($(max_phys_cpus),)
diff -r 6ed7fdb587af -r 32e049f49b87 xen/arch/arm/dummy.S
--- a/xen/arch/arm/dummy.S	Wed Feb 15 12:24:19 2012 +0000
+++ b/xen/arch/arm/dummy.S	Wed Feb 15 12:24:19 2012 +0000
@@ -27,8 +27,6 @@
 DUMMY(gnttab_clear_flag);
 DUMMY(gnttab_mark_dirty);
 DUMMY(hypercall_create_continuation);
-DUMMY(iommu_map_page);
-DUMMY(iommu_unmap_page);
 DUMMY(is_iomem_page);
 DUMMY(max_page);
 DUMMY(node_online_map);
diff -r 6ed7fdb587af -r 32e049f49b87 xen/include/xen/sched.h
--- a/xen/include/xen/sched.h	Wed Feb 15 12:24:19 2012 +0000
+++ b/xen/include/xen/sched.h	Wed Feb 15 12:24:19 2012 +0000
@@ -266,8 +266,10 @@
 
     /* Is this an HVM guest? */
     bool_t           is_hvm;
+#ifdef HAS_PASSTHROUGH
     /* Does this guest need iommu mappings? */
     bool_t           need_iommu;
+#endif
     /* Is this guest fully privileged (aka dom0)? */
     bool_t           is_privileged;
     /* Which guest this guest has privileges on */
@@ -687,7 +689,11 @@
 #define is_hvm_vcpu(v)   (is_hvm_domain(v->domain))
 #define is_pinned_vcpu(v) ((v)->domain->is_pinned || \
                            cpumask_weight((v)->cpu_affinity) == 1)
+#ifdef HAS_PASSTHROUGH
 #define need_iommu(d)    ((d)->need_iommu)
+#else
+#define need_iommu(d)    (0)
+#endif
 
 void set_vcpu_migration_delay(unsigned int delay);
 unsigned int get_vcpu_migration_delay(void);

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 23:11:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0Q-00015K-2R; Wed, 15 Feb 2012 23:11:22 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0O-00011M-BI
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-21.messagelabs.com!1329347473!8420153!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21580 invoked from network); 15 Feb 2012 23:11:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0G-0000ei-VS
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0G-0005IE-UH
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:12 +0000
Message-Id: <E1Rxo0G-0005IE-UH@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: make need_iommu == 0 if
	!HAS_PASSTHROUGH
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308659 0
# Node ID 32e049f49b873ee7c0c1ed6c72390706f92b851c
# Parent  6ed7fdb587afd1fd6f724032cf7040041369f819
xen: make need_iommu == 0 if !HAS_PASSTHROUGH

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: keir@xen.org
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r 6ed7fdb587af -r 32e049f49b87 xen/Rules.mk
--- a/xen/Rules.mk	Wed Feb 15 12:24:19 2012 +0000
+++ b/xen/Rules.mk	Wed Feb 15 12:24:19 2012 +0000
@@ -51,6 +51,7 @@
 CFLAGS-$(perfc_arrays)  += -DPERF_ARRAYS
 CFLAGS-$(lock_profile)  += -DLOCK_PROFILE
 CFLAGS-$(HAS_ACPI)      += -DHAS_ACPI
+CFLAGS-$(HAS_PASSTHROUGH) += -DHAS_PASSTHROUGH
 CFLAGS-$(frame_pointer) += -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER
 
 ifneq ($(max_phys_cpus),)
diff -r 6ed7fdb587af -r 32e049f49b87 xen/arch/arm/dummy.S
--- a/xen/arch/arm/dummy.S	Wed Feb 15 12:24:19 2012 +0000
+++ b/xen/arch/arm/dummy.S	Wed Feb 15 12:24:19 2012 +0000
@@ -27,8 +27,6 @@
 DUMMY(gnttab_clear_flag);
 DUMMY(gnttab_mark_dirty);
 DUMMY(hypercall_create_continuation);
-DUMMY(iommu_map_page);
-DUMMY(iommu_unmap_page);
 DUMMY(is_iomem_page);
 DUMMY(max_page);
 DUMMY(node_online_map);
diff -r 6ed7fdb587af -r 32e049f49b87 xen/include/xen/sched.h
--- a/xen/include/xen/sched.h	Wed Feb 15 12:24:19 2012 +0000
+++ b/xen/include/xen/sched.h	Wed Feb 15 12:24:19 2012 +0000
@@ -266,8 +266,10 @@
 
     /* Is this an HVM guest? */
     bool_t           is_hvm;
+#ifdef HAS_PASSTHROUGH
     /* Does this guest need iommu mappings? */
     bool_t           need_iommu;
+#endif
     /* Is this guest fully privileged (aka dom0)? */
     bool_t           is_privileged;
     /* Which guest this guest has privileges on */
@@ -687,7 +689,11 @@
 #define is_hvm_vcpu(v)   (is_hvm_domain(v->domain))
 #define is_pinned_vcpu(v) ((v)->domain->is_pinned || \
                            cpumask_weight((v)->cpu_affinity) == 1)
+#ifdef HAS_PASSTHROUGH
 #define need_iommu(d)    ((d)->need_iommu)
+#else
+#define need_iommu(d)    (0)
+#endif
 
 void set_vcpu_migration_delay(unsigned int delay);
 unsigned int get_vcpu_migration_delay(void);

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 23:11:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0R-00016S-6I; Wed, 15 Feb 2012 23:11:23 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0O-00011d-TY
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1329347473!13338960!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7588 invoked from network); 15 Feb 2012 23:11:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0H-0000el-GA
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0H-0005Ic-F0
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:13 +0000
Message-Id: <E1Rxo0H-0005Ic-F0@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: stub out PoD related p2m
	functions
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308660 0
# Node ID dbd5c30ad48f103232bdfd1ed3dfd04adc876d95
# Parent  32e049f49b873ee7c0c1ed6c72390706f92b851c
arm: stub out PoD related p2m functions

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r 32e049f49b87 -r dbd5c30ad48f xen/arch/arm/dummy.S
--- a/xen/arch/arm/dummy.S	Wed Feb 15 12:24:19 2012 +0000
+++ b/xen/arch/arm/dummy.S	Wed Feb 15 12:24:20 2012 +0000
@@ -31,8 +31,6 @@
 DUMMY(max_page);
 DUMMY(node_online_map);
 DUMMY(nr_irqs_gsi);
-DUMMY(p2m_pod_decrease_reservation);
-DUMMY(guest_physmap_mark_populate_on_demand);
 DUMMY(page_get_owner_and_reference);
 DUMMY(page_is_ram_type);
 DUMMY(per_cpu__cpu_core_mask);
diff -r 32e049f49b87 -r dbd5c30ad48f xen/arch/arm/p2m.c
--- a/xen/arch/arm/p2m.c	Wed Feb 15 12:24:19 2012 +0000
+++ b/xen/arch/arm/p2m.c	Wed Feb 15 12:24:20 2012 +0000
@@ -18,6 +18,20 @@
     isb(); /* Ensure update is visible */
 }
 
+int guest_physmap_mark_populate_on_demand(struct domain *d,
+                                          unsigned long gfn,
+                                          unsigned int order)
+{
+    return -ENOSYS;
+}
+
+int p2m_pod_decrease_reservation(struct domain *d,
+                                 xen_pfn_t gpfn,
+                                 unsigned int order)
+{
+    return -ENOSYS;
+}
+
 static int p2m_create_entry(struct domain *d,
                             lpae_t *entry)
 {

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 23:11:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0R-00016S-6I; Wed, 15 Feb 2012 23:11:23 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0O-00011d-TY
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1329347473!13338960!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7588 invoked from network); 15 Feb 2012 23:11:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0H-0000el-GA
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0H-0005Ic-F0
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:13 +0000
Message-Id: <E1Rxo0H-0005Ic-F0@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: stub out PoD related p2m
	functions
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308660 0
# Node ID dbd5c30ad48f103232bdfd1ed3dfd04adc876d95
# Parent  32e049f49b873ee7c0c1ed6c72390706f92b851c
arm: stub out PoD related p2m functions

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r 32e049f49b87 -r dbd5c30ad48f xen/arch/arm/dummy.S
--- a/xen/arch/arm/dummy.S	Wed Feb 15 12:24:19 2012 +0000
+++ b/xen/arch/arm/dummy.S	Wed Feb 15 12:24:20 2012 +0000
@@ -31,8 +31,6 @@
 DUMMY(max_page);
 DUMMY(node_online_map);
 DUMMY(nr_irqs_gsi);
-DUMMY(p2m_pod_decrease_reservation);
-DUMMY(guest_physmap_mark_populate_on_demand);
 DUMMY(page_get_owner_and_reference);
 DUMMY(page_is_ram_type);
 DUMMY(per_cpu__cpu_core_mask);
diff -r 32e049f49b87 -r dbd5c30ad48f xen/arch/arm/p2m.c
--- a/xen/arch/arm/p2m.c	Wed Feb 15 12:24:19 2012 +0000
+++ b/xen/arch/arm/p2m.c	Wed Feb 15 12:24:20 2012 +0000
@@ -18,6 +18,20 @@
     isb(); /* Ensure update is visible */
 }
 
+int guest_physmap_mark_populate_on_demand(struct domain *d,
+                                          unsigned long gfn,
+                                          unsigned int order)
+{
+    return -ENOSYS;
+}
+
+int p2m_pod_decrease_reservation(struct domain *d,
+                                 xen_pfn_t gpfn,
+                                 unsigned int order)
+{
+    return -ENOSYS;
+}
+
 static int p2m_create_entry(struct domain *d,
                             lpae_t *entry)
 {

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 23:11:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0R-00016Z-9w; Wed, 15 Feb 2012 23:11:23 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0P-00011o-UE
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-21.messagelabs.com!1329347474!5216814!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29067 invoked from network); 15 Feb 2012 23:11:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0I-0000er-Na
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0I-0005JM-G9
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:14 +0000
Message-Id: <E1Rxo0I-0005JM-G9@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: Group remaining dummy symbols
	somewhat according to functionality
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308661 0
# Node ID fe427d3bb3785932e910b4951dfa6847963542a1
# Parent  a0ada591197b155248e9467b6745d839b8fc4d07
arm: Group remaining dummy symbols somewhat according to functionality

Makes it easier to see what needs to be done.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r a0ada591197b -r fe427d3bb378 xen/arch/arm/dummy.S
--- a/xen/arch/arm/dummy.S	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/arch/arm/dummy.S	Wed Feb 15 12:24:21 2012 +0000
@@ -6,48 +6,61 @@
 	.globl x; \
 x:	mov pc, lr
 	
+/* SMP support */
+DUMMY(__cpu_die);
+DUMMY(__cpu_disable);
+DUMMY(__cpu_up);
+DUMMY(per_cpu__cpu_core_mask);
+DUMMY(per_cpu__cpu_sibling_mask);
+DUMMY(node_online_map);
+DUMMY(smp_send_state_dump);
+DUMMY(__per_cpu_offset);
+
+/* PIRQ support */
 DUMMY(alloc_pirq_struct);
+DUMMY(nr_irqs_gsi);
+DUMMY(pirq_guest_bind);
+DUMMY(pirq_guest_unbind);
+DUMMY(pirq_set_affinity);
+
+/* VCPU */
 DUMMY(alloc_vcpu_guest_context);
 DUMMY(arch_get_info_guest);
 DUMMY(arch_set_info_guest);
 DUMMY(arch_vcpu_reset);
+DUMMY(free_vcpu_guest_context);
+DUMMY(sync_vcpu_execstate);
+NOP(update_vcpu_system_time);
+DUMMY(vcpu_mark_events_pending);
+DUMMY(vcpu_show_execution_state);
+
+/* Page Reference & Type Maintenance */
+DUMMY(get_page);
+DUMMY(get_page_type);
+DUMMY(page_get_owner_and_reference);
+DUMMY(put_page);
+DUMMY(put_page_type);
+
+/* Grant Tables */
 DUMMY(create_grant_host_mapping);
-DUMMY(__cpu_die);
-DUMMY(__cpu_disable);
-DUMMY(__cpu_up);
+DUMMY(gnttab_clear_flag);
+DUMMY(gnttab_mark_dirty);
+DUMMY(is_iomem_page);
+DUMMY(replace_grant_host_mapping);
+DUMMY(steal_page);
+
+/* Page Offlining */
+DUMMY(page_is_ram_type);
+
+/* Other */
 DUMMY(domain_get_maximum_gpfn);
 DUMMY(domain_relinquish_resources);
 DUMMY(domain_set_time_offset);
 DUMMY(dom_cow);
 DUMMY(flush_tlb_mask);
-DUMMY(free_vcpu_guest_context);
-DUMMY(get_page);
-DUMMY(get_page_type);
 DUMMY(gmfn_to_mfn);
-DUMMY(gnttab_clear_flag);
-DUMMY(gnttab_mark_dirty);
 DUMMY(hypercall_create_continuation);
-DUMMY(is_iomem_page);
-DUMMY(node_online_map);
-DUMMY(nr_irqs_gsi);
-DUMMY(page_get_owner_and_reference);
-DUMMY(page_is_ram_type);
-DUMMY(per_cpu__cpu_core_mask);
-DUMMY(per_cpu__cpu_sibling_mask);
-DUMMY(__per_cpu_offset);
-DUMMY(pirq_guest_bind);
-DUMMY(pirq_guest_unbind);
-DUMMY(pirq_set_affinity);
-DUMMY(put_page);
-DUMMY(put_page_type);
-DUMMY(replace_grant_host_mapping);
 DUMMY(send_timer_event);
 DUMMY(share_xen_page_with_privileged_guests);
-DUMMY(smp_send_state_dump);
-DUMMY(steal_page);
-DUMMY(sync_vcpu_execstate);
 DUMMY(__udelay);
-NOP(update_vcpu_system_time);
-DUMMY(vcpu_mark_events_pending);
-DUMMY(vcpu_show_execution_state);
 DUMMY(wallclock_time);

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 23:11:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0R-00016Z-9w; Wed, 15 Feb 2012 23:11:23 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0P-00011o-UE
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-21.messagelabs.com!1329347474!5216814!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29067 invoked from network); 15 Feb 2012 23:11:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0I-0000er-Na
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0I-0005JM-G9
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:14 +0000
Message-Id: <E1Rxo0I-0005JM-G9@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: Group remaining dummy symbols
	somewhat according to functionality
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308661 0
# Node ID fe427d3bb3785932e910b4951dfa6847963542a1
# Parent  a0ada591197b155248e9467b6745d839b8fc4d07
arm: Group remaining dummy symbols somewhat according to functionality

Makes it easier to see what needs to be done.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r a0ada591197b -r fe427d3bb378 xen/arch/arm/dummy.S
--- a/xen/arch/arm/dummy.S	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/arch/arm/dummy.S	Wed Feb 15 12:24:21 2012 +0000
@@ -6,48 +6,61 @@
 	.globl x; \
 x:	mov pc, lr
 	
+/* SMP support */
+DUMMY(__cpu_die);
+DUMMY(__cpu_disable);
+DUMMY(__cpu_up);
+DUMMY(per_cpu__cpu_core_mask);
+DUMMY(per_cpu__cpu_sibling_mask);
+DUMMY(node_online_map);
+DUMMY(smp_send_state_dump);
+DUMMY(__per_cpu_offset);
+
+/* PIRQ support */
 DUMMY(alloc_pirq_struct);
+DUMMY(nr_irqs_gsi);
+DUMMY(pirq_guest_bind);
+DUMMY(pirq_guest_unbind);
+DUMMY(pirq_set_affinity);
+
+/* VCPU */
 DUMMY(alloc_vcpu_guest_context);
 DUMMY(arch_get_info_guest);
 DUMMY(arch_set_info_guest);
 DUMMY(arch_vcpu_reset);
+DUMMY(free_vcpu_guest_context);
+DUMMY(sync_vcpu_execstate);
+NOP(update_vcpu_system_time);
+DUMMY(vcpu_mark_events_pending);
+DUMMY(vcpu_show_execution_state);
+
+/* Page Reference & Type Maintenance */
+DUMMY(get_page);
+DUMMY(get_page_type);
+DUMMY(page_get_owner_and_reference);
+DUMMY(put_page);
+DUMMY(put_page_type);
+
+/* Grant Tables */
 DUMMY(create_grant_host_mapping);
-DUMMY(__cpu_die);
-DUMMY(__cpu_disable);
-DUMMY(__cpu_up);
+DUMMY(gnttab_clear_flag);
+DUMMY(gnttab_mark_dirty);
+DUMMY(is_iomem_page);
+DUMMY(replace_grant_host_mapping);
+DUMMY(steal_page);
+
+/* Page Offlining */
+DUMMY(page_is_ram_type);
+
+/* Other */
 DUMMY(domain_get_maximum_gpfn);
 DUMMY(domain_relinquish_resources);
 DUMMY(domain_set_time_offset);
 DUMMY(dom_cow);
 DUMMY(flush_tlb_mask);
-DUMMY(free_vcpu_guest_context);
-DUMMY(get_page);
-DUMMY(get_page_type);
 DUMMY(gmfn_to_mfn);
-DUMMY(gnttab_clear_flag);
-DUMMY(gnttab_mark_dirty);
 DUMMY(hypercall_create_continuation);
-DUMMY(is_iomem_page);
-DUMMY(node_online_map);
-DUMMY(nr_irqs_gsi);
-DUMMY(page_get_owner_and_reference);
-DUMMY(page_is_ram_type);
-DUMMY(per_cpu__cpu_core_mask);
-DUMMY(per_cpu__cpu_sibling_mask);
-DUMMY(__per_cpu_offset);
-DUMMY(pirq_guest_bind);
-DUMMY(pirq_guest_unbind);
-DUMMY(pirq_set_affinity);
-DUMMY(put_page);
-DUMMY(put_page_type);
-DUMMY(replace_grant_host_mapping);
 DUMMY(send_timer_event);
 DUMMY(share_xen_page_with_privileged_guests);
-DUMMY(smp_send_state_dump);
-DUMMY(steal_page);
-DUMMY(sync_vcpu_execstate);
 DUMMY(__udelay);
-NOP(update_vcpu_system_time);
-DUMMY(vcpu_mark_events_pending);
-DUMMY(vcpu_show_execution_state);
 DUMMY(wallclock_time);

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 23:11:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0R-00016i-D5; Wed, 15 Feb 2012 23:11:23 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0Q-00011s-3V
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1329347474!8475934!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1427 invoked from network); 15 Feb 2012 23:11:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0I-0000eo-0n
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0H-0005Iz-Vc
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:13 +0000
Message-Id: <E1Rxo0H-0005Iz-Vc@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: define max_page
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308661 0
# Node ID a0ada591197b155248e9467b6745d839b8fc4d07
# Parent  dbd5c30ad48f103232bdfd1ed3dfd04adc876d95
arm: define max_page

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r dbd5c30ad48f -r a0ada591197b xen/arch/arm/dummy.S
--- a/xen/arch/arm/dummy.S	Wed Feb 15 12:24:20 2012 +0000
+++ b/xen/arch/arm/dummy.S	Wed Feb 15 12:24:21 2012 +0000
@@ -28,7 +28,6 @@
 DUMMY(gnttab_mark_dirty);
 DUMMY(hypercall_create_continuation);
 DUMMY(is_iomem_page);
-DUMMY(max_page);
 DUMMY(node_online_map);
 DUMMY(nr_irqs_gsi);
 DUMMY(page_get_owner_and_reference);
diff -r dbd5c30ad48f -r a0ada591197b xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c	Wed Feb 15 12:24:20 2012 +0000
+++ b/xen/arch/arm/mm.c	Wed Feb 15 12:24:21 2012 +0000
@@ -43,6 +43,8 @@
 unsigned long frametable_base_mfn;
 unsigned long frametable_virt_end;
 
+unsigned long max_page;
+
 /* Map a 4k page in a fixmap entry */
 void set_fixmap(unsigned map, unsigned long mfn, unsigned attributes)
 {
diff -r dbd5c30ad48f -r a0ada591197b xen/arch/arm/setup.c
--- a/xen/arch/arm/setup.c	Wed Feb 15 12:24:20 2012 +0000
+++ b/xen/arch/arm/setup.c	Wed Feb 15 12:24:21 2012 +0000
@@ -32,6 +32,7 @@
 #include <xen/softirq.h>
 #include <xen/keyhandler.h>
 #include <xen/cpu.h>
+#include <xen/pfn.h>
 #include <asm/page.h>
 #include <asm/current.h>
 #include <asm/setup.h>
@@ -141,6 +142,7 @@
                     pfn_to_paddr(xenheap_mfn_start + xenheap_pages + domheap_pages));
 
     setup_frametable_mappings(ram_start, ram_end);
+    max_page = PFN_DOWN(ram_end);
 
     /* Add xenheap memory that was not already added to the boot
        allocator. */

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

From xen-changelog-bounces@lists.xensource.com Wed Feb 15 23:11:25 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2012 23:11:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Rxo0R-00016i-D5; Wed, 15 Feb 2012 23:11:23 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0Q-00011s-3V
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1329347474!8475934!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1427 invoked from network); 15 Feb 2012 23:11:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Feb 2012 23:11:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0I-0000eo-0n
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rxo0H-0005Iz-Vc
	for xen-changelog@lists.xensource.com; Wed, 15 Feb 2012 23:11:13 +0000
Message-Id: <E1Rxo0H-0005Iz-Vc@xenbits.xen.org>
Date: Wed, 15 Feb 2012 23:11:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: define max_page
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329308661 0
# Node ID a0ada591197b155248e9467b6745d839b8fc4d07
# Parent  dbd5c30ad48f103232bdfd1ed3dfd04adc876d95
arm: define max_page

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r dbd5c30ad48f -r a0ada591197b xen/arch/arm/dummy.S
--- a/xen/arch/arm/dummy.S	Wed Feb 15 12:24:20 2012 +0000
+++ b/xen/arch/arm/dummy.S	Wed Feb 15 12:24:21 2012 +0000
@@ -28,7 +28,6 @@
 DUMMY(gnttab_mark_dirty);
 DUMMY(hypercall_create_continuation);
 DUMMY(is_iomem_page);
-DUMMY(max_page);
 DUMMY(node_online_map);
 DUMMY(nr_irqs_gsi);
 DUMMY(page_get_owner_and_reference);
diff -r dbd5c30ad48f -r a0ada591197b xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c	Wed Feb 15 12:24:20 2012 +0000
+++ b/xen/arch/arm/mm.c	Wed Feb 15 12:24:21 2012 +0000
@@ -43,6 +43,8 @@
 unsigned long frametable_base_mfn;
 unsigned long frametable_virt_end;
 
+unsigned long max_page;
+
 /* Map a 4k page in a fixmap entry */
 void set_fixmap(unsigned map, unsigned long mfn, unsigned attributes)
 {
diff -r dbd5c30ad48f -r a0ada591197b xen/arch/arm/setup.c
--- a/xen/arch/arm/setup.c	Wed Feb 15 12:24:20 2012 +0000
+++ b/xen/arch/arm/setup.c	Wed Feb 15 12:24:21 2012 +0000
@@ -32,6 +32,7 @@
 #include <xen/softirq.h>
 #include <xen/keyhandler.h>
 #include <xen/cpu.h>
+#include <xen/pfn.h>
 #include <asm/page.h>
 #include <asm/current.h>
 #include <asm/setup.h>
@@ -141,6 +142,7 @@
                     pfn_to_paddr(xenheap_mfn_start + xenheap_pages + domheap_pages));
 
     setup_frametable_mappings(ram_start, ram_end);
+    max_page = PFN_DOWN(ram_end);
 
     /* Add xenheap memory that was not already added to the boot
        allocator. */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 16 08:11:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 16 Feb 2012 08:11:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxwQu-0001Dr-6y; Thu, 16 Feb 2012 08:11:16 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxwQs-0001Dj-OY
	for xen-changelog@lists.xensource.com; Thu, 16 Feb 2012 08:11:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1329379863!8517128!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7678 invoked from network); 16 Feb 2012 08:11:07 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	16 Feb 2012 08:11:07 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxwQh-00082l-KH
	for xen-changelog@lists.xensource.com; Thu, 16 Feb 2012 08:11:03 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxwQh-0003EE-8u
	for xen-changelog@lists.xensource.com; Thu, 16 Feb 2012 08:11:03 +0000
Message-Id: <E1RxwQh-0003EE-8u@xenbits.xen.org>
Date: Thu, 16 Feb 2012 08:11:02 +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] xenoprof: cleanup
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329378726 -3600
# Node ID 98c00677dacbbcf1419eb08036077e63c4fd26d4
# Parent  dc034d0ccdd857503de483012bea9c8e549daa76
xenoprof: cleanup

- frame Xen-specific additions with CONFIG_XEN conditionals
- use per-CPU data
- fix indentation

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


diff -r dc034d0ccdd8 -r 98c00677dacb drivers/oprofile/buffer_sync.c
--- a/drivers/oprofile/buffer_sync.c	Wed Feb 15 12:09:02 2012 +0100
+++ b/drivers/oprofile/buffer_sync.c	Thu Feb 16 08:52:06 2012 +0100
@@ -42,7 +42,10 @@
 static DEFINE_SPINLOCK(task_mortuary);
 static void process_task_mortuary(void);
 
-static int cpu_current_domain[NR_CPUS];
+#ifdef CONFIG_XEN
+#include <linux/percpu.h>
+static DEFINE_PER_CPU(int, current_domain) = COORDINATOR_DOMAIN;
+#endif
 
 /* Take ownership of the task struct and place it on the
  * list for processing. Only after two full buffer syncs
@@ -151,11 +154,12 @@
 int sync_start(void)
 {
 	int err;
-	int i;
+#ifdef CONFIG_XEN
+	unsigned int cpu;
 
-	for (i = 0; i < NR_CPUS; i++) {
-		cpu_current_domain[i] = COORDINATOR_DOMAIN;
-	}
+	for_each_online_cpu(cpu)
+		per_cpu(current_domain, cpu) = COORDINATOR_DOMAIN;
+#endif
 
 	start_cpu_work();
 
@@ -303,12 +307,14 @@
 	}
 }
 
+#ifdef CONFIG_XEN
 static void add_domain_switch(unsigned long domain_id)
 {
 	add_event_entry(ESCAPE_CODE);
 	add_event_entry(DOMAIN_SWITCH_CODE);
 	add_event_entry(domain_id);
 }
+#endif
 
 static void
 add_user_ctx_switch(struct task_struct const * task, unsigned long cookie)
@@ -498,6 +504,7 @@
 	cpus_clear(marked_cpus);
 }
 
+#ifdef CONFIG_XEN
 /* Add IBS samples into event buffer */
 #define IBS_FETCH_SIZE	8
 #define IBS_OP_SIZE		14
@@ -559,6 +566,9 @@
 
 	return size;
 }
+#else
+#define add_ibs_data(cpu, mm, cpu_mode) 0
+#endif
 
 /* FIXME: this is not sufficient if we implement syscall barrier backtrace
  * traversal, the code switch to sb_sample_start at first kernel enter/exit
@@ -594,11 +604,12 @@
  
 	add_cpu_switch(cpu);
 
+#ifdef CONFIG_XEN
 	/* We need to assign the first samples in this CPU buffer to the
 	   same domain that we were processing at the last sync_buffer */
-	if (cpu_current_domain[cpu] != COORDINATOR_DOMAIN) {
-		add_domain_switch(cpu_current_domain[cpu]);
-	}
+	if (per_cpu(current_domain, cpu) != COORDINATOR_DOMAIN)
+		add_domain_switch(per_cpu(current_domain, cpu));
+#endif
 	/* Remember, only we can modify tail_pos */
 
 	available = get_slots(cpu_buf);
@@ -616,8 +627,10 @@
 			} else if (s->event == CPU_TRACE_BEGIN) {
 				state = sb_bt_start;
 				add_trace_begin();
+#ifdef CONFIG_XEN
 			} else if (s->event == CPU_DOMAIN_SWITCH) {
-					domain_switch = 1;				
+				domain_switch = 1;
+#endif
 			} else {
 				struct mm_struct * oldmm = mm;
 
@@ -633,21 +646,23 @@
 			is_ibs_sample = add_ibs_data(cpu, mm, cpu_mode);
 
 		} else {
+#ifdef CONFIG_XEN
 			if (domain_switch) {
-				cpu_current_domain[cpu] = s->eip;
+				per_cpu(current_domain, cpu) = s->eip;
 				add_domain_switch(s->eip);
 				domain_switch = 0;
-			} else if (!is_ibs_sample) {
-				if (cpu_current_domain[cpu] !=
-				    COORDINATOR_DOMAIN) {
-					add_sample_entry(s->eip, s->event);
-				}
-				else  if (state >= sb_bt_start &&
-				    !add_sample(mm, s, cpu_mode)) {
-					if (state == sb_bt_start) {
-						state = sb_bt_ignore;
-						atomic_inc(&oprofile_stats.bt_lost_no_mapping);
-					}
+			} else if (is_ibs_sample)
+				;
+			else if (per_cpu(current_domain, cpu) !=
+				 COORDINATOR_DOMAIN) {
+				add_sample_entry(s->eip, s->event);
+			} else
+#endif
+			if (state >= sb_bt_start &&
+			    !add_sample(mm, s, cpu_mode)) {
+				if (state == sb_bt_start) {
+					state = sb_bt_ignore;
+					atomic_inc(&oprofile_stats.bt_lost_no_mapping);
 				}
 			}
 		}
@@ -656,10 +671,11 @@
 	}
 	release_mm(mm);
 
+#ifdef CONFIG_XEN
 	/* We reset domain to COORDINATOR at each CPU switch */
-	if (cpu_current_domain[cpu] != COORDINATOR_DOMAIN) {
+	if (per_cpu(current_domain, cpu) != COORDINATOR_DOMAIN)
 		add_domain_switch(COORDINATOR_DOMAIN);
-	}
+#endif
 
 	mark_done(cpu);
 
diff -r dc034d0ccdd8 -r 98c00677dacb drivers/oprofile/cpu_buffer.c
--- a/drivers/oprofile/cpu_buffer.c	Wed Feb 15 12:09:02 2012 +0100
+++ b/drivers/oprofile/cpu_buffer.c	Thu Feb 16 08:52:06 2012 +0100
@@ -38,7 +38,11 @@
 #define DEFAULT_TIMER_EXPIRE (HZ / 10)
 static int work_enabled;
 
+#ifndef CONFIG_XEN
+#define current_domain COORDINATOR_DOMAIN
+#else
 static int32_t current_domain = COORDINATOR_DOMAIN;
+#endif
 
 void free_cpu_buffers(void)
 {
@@ -202,8 +206,10 @@
 		add_code(cpu_buf, (unsigned long)task);
 	}
 
+#ifdef CONFIG_XEN
 	if (pc == IBS_FETCH_CODE || pc == IBS_OP_CODE)
 		add_code(cpu_buf, cpu_mode);
+#endif
 
 	add_sample(cpu_buf, pc, event);
 	return 1;
@@ -284,6 +290,7 @@
 	add_sample(cpu_buf, pc, 0);
 }
 
+#ifdef CONFIG_XEN
 int oprofile_add_domain_switch(int32_t domain_id)
 {
 	struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()];
@@ -302,6 +309,7 @@
 
 	return 1;
 }
+#endif
 
 /*
  * This serves to avoid cpu buffer overflow, and makes sure
diff -r dc034d0ccdd8 -r 98c00677dacb drivers/oprofile/oprof.c
--- a/drivers/oprofile/oprof.c	Wed Feb 15 12:09:02 2012 +0100
+++ b/drivers/oprofile/oprof.c	Thu Feb 16 08:52:06 2012 +0100
@@ -37,6 +37,7 @@
  */
 static int timer = 0;
 
+#ifdef CONFIG_XEN
 int oprofile_set_active(int active_domains[], unsigned int adomains)
 {
 	int err;
@@ -62,6 +63,7 @@
 	mutex_unlock(&start_mutex);
 	return err;
 }
+#endif
 
 int oprofile_setup(void)
 {
diff -r dc034d0ccdd8 -r 98c00677dacb drivers/oprofile/oprofile_files.c
--- a/drivers/oprofile/oprofile_files.c	Wed Feb 15 12:09:02 2012 +0100
+++ b/drivers/oprofile/oprofile_files.c	Thu Feb 16 08:52:06 2012 +0100
@@ -21,7 +21,11 @@
 #include "oprof.h"
 
 unsigned long fs_buffer_size = 131072;
-unsigned long fs_cpu_buffer_size = 131072;
+#ifndef CONFIG_XEN
+unsigned long fs_cpu_buffer_size = 8192;
+#else
+unsigned long fs_cpu_buffer_size = 32768;
+#endif
 unsigned long fs_buffer_watershed = 32768; /* FIXME: tune */
 
 static ssize_t depth_read(struct file * file, char __user * buf, size_t count, loff_t * offset)
@@ -124,6 +128,8 @@
 	.write		= dump_write,
 };
 
+#ifdef CONFIG_XEN
+
 #define TMPBUFSIZE 512
 
 struct domain_data {
@@ -228,8 +234,8 @@
 
 static int adomain_open(struct inode *inode, struct file *filp)
 {
-    filp->private_data = &active_domains;
-    return 0;
+	filp->private_data = &active_domains;
+	return 0;
 }
 
 static const struct file_operations active_domain_ops = {
@@ -242,8 +248,8 @@
 
 static int pdomain_open(struct inode *inode, struct file *filp)
 {
-    filp->private_data = &passive_domains;
-    return 0;
+	filp->private_data = &passive_domains;
+	return 0;
 }
 
 static const struct file_operations passive_domain_ops = {
@@ -252,12 +258,16 @@
 	.write		= domain_write,
 };
 
+#endif /* CONFIG_XEN */
+
 void oprofile_create_files(struct super_block * sb, struct dentry * root)
 {
 	oprofilefs_create_file(sb, root, "enable", &enable_fops);
 	oprofilefs_create_file_perm(sb, root, "dump", &dump_fops, 0666);
+#ifdef CONFIG_XEN
 	oprofilefs_create_file(sb, root, "active_domains", &active_domain_ops);
 	oprofilefs_create_file(sb, root, "passive_domains", &passive_domain_ops);
+#endif
 	oprofilefs_create_file(sb, root, "buffer", &event_buffer_fops);
 	oprofilefs_create_ulong(sb, root, "buffer_size", &fs_buffer_size);
 	oprofilefs_create_ulong(sb, root, "buffer_watershed", &fs_buffer_watershed);
diff -r dc034d0ccdd8 -r 98c00677dacb include/linux/oprofile.h
--- a/include/linux/oprofile.h	Wed Feb 15 12:09:02 2012 +0100
+++ b/include/linux/oprofile.h	Thu Feb 16 08:52:06 2012 +0100
@@ -16,8 +16,9 @@
 #include <linux/types.h>
 #include <linux/spinlock.h>
 #include <asm/atomic.h>
-
+#ifdef CONFIG_XEN
 #include <xen/interface/xenoprof.h>
+#endif
  
 struct super_block;
 struct dentry;
@@ -29,11 +30,12 @@
 	/* create any necessary configuration files in the oprofile fs.
 	 * Optional. */
 	int (*create_files)(struct super_block * sb, struct dentry * root);
+#ifdef CONFIG_XEN
 	/* setup active domains with Xen */
 	int (*set_active)(int *active_domains, unsigned int adomains);
-        /* setup passive domains with Xen */
-        int (*set_passive)(int *passive_domains, unsigned int pdomains);
-	
+	/* setup passive domains with Xen */
+	int (*set_passive)(int *passive_domains, unsigned int pdomains);
+#endif
 	/* Do any necessary interrupt setup. Optional. */
 	int (*setup)(void);
 	/* Do any necessary interrupt shutdown. Optional. */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 16 08:11:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 16 Feb 2012 08:11:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RxwQu-0001Dr-6y; Thu, 16 Feb 2012 08:11:16 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxwQs-0001Dj-OY
	for xen-changelog@lists.xensource.com; Thu, 16 Feb 2012 08:11:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1329379863!8517128!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7678 invoked from network); 16 Feb 2012 08:11:07 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	16 Feb 2012 08:11:07 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxwQh-00082l-KH
	for xen-changelog@lists.xensource.com; Thu, 16 Feb 2012 08:11:03 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RxwQh-0003EE-8u
	for xen-changelog@lists.xensource.com; Thu, 16 Feb 2012 08:11:03 +0000
Message-Id: <E1RxwQh-0003EE-8u@xenbits.xen.org>
Date: Thu, 16 Feb 2012 08:11:02 +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] xenoprof: cleanup
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329378726 -3600
# Node ID 98c00677dacbbcf1419eb08036077e63c4fd26d4
# Parent  dc034d0ccdd857503de483012bea9c8e549daa76
xenoprof: cleanup

- frame Xen-specific additions with CONFIG_XEN conditionals
- use per-CPU data
- fix indentation

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


diff -r dc034d0ccdd8 -r 98c00677dacb drivers/oprofile/buffer_sync.c
--- a/drivers/oprofile/buffer_sync.c	Wed Feb 15 12:09:02 2012 +0100
+++ b/drivers/oprofile/buffer_sync.c	Thu Feb 16 08:52:06 2012 +0100
@@ -42,7 +42,10 @@
 static DEFINE_SPINLOCK(task_mortuary);
 static void process_task_mortuary(void);
 
-static int cpu_current_domain[NR_CPUS];
+#ifdef CONFIG_XEN
+#include <linux/percpu.h>
+static DEFINE_PER_CPU(int, current_domain) = COORDINATOR_DOMAIN;
+#endif
 
 /* Take ownership of the task struct and place it on the
  * list for processing. Only after two full buffer syncs
@@ -151,11 +154,12 @@
 int sync_start(void)
 {
 	int err;
-	int i;
+#ifdef CONFIG_XEN
+	unsigned int cpu;
 
-	for (i = 0; i < NR_CPUS; i++) {
-		cpu_current_domain[i] = COORDINATOR_DOMAIN;
-	}
+	for_each_online_cpu(cpu)
+		per_cpu(current_domain, cpu) = COORDINATOR_DOMAIN;
+#endif
 
 	start_cpu_work();
 
@@ -303,12 +307,14 @@
 	}
 }
 
+#ifdef CONFIG_XEN
 static void add_domain_switch(unsigned long domain_id)
 {
 	add_event_entry(ESCAPE_CODE);
 	add_event_entry(DOMAIN_SWITCH_CODE);
 	add_event_entry(domain_id);
 }
+#endif
 
 static void
 add_user_ctx_switch(struct task_struct const * task, unsigned long cookie)
@@ -498,6 +504,7 @@
 	cpus_clear(marked_cpus);
 }
 
+#ifdef CONFIG_XEN
 /* Add IBS samples into event buffer */
 #define IBS_FETCH_SIZE	8
 #define IBS_OP_SIZE		14
@@ -559,6 +566,9 @@
 
 	return size;
 }
+#else
+#define add_ibs_data(cpu, mm, cpu_mode) 0
+#endif
 
 /* FIXME: this is not sufficient if we implement syscall barrier backtrace
  * traversal, the code switch to sb_sample_start at first kernel enter/exit
@@ -594,11 +604,12 @@
  
 	add_cpu_switch(cpu);
 
+#ifdef CONFIG_XEN
 	/* We need to assign the first samples in this CPU buffer to the
 	   same domain that we were processing at the last sync_buffer */
-	if (cpu_current_domain[cpu] != COORDINATOR_DOMAIN) {
-		add_domain_switch(cpu_current_domain[cpu]);
-	}
+	if (per_cpu(current_domain, cpu) != COORDINATOR_DOMAIN)
+		add_domain_switch(per_cpu(current_domain, cpu));
+#endif
 	/* Remember, only we can modify tail_pos */
 
 	available = get_slots(cpu_buf);
@@ -616,8 +627,10 @@
 			} else if (s->event == CPU_TRACE_BEGIN) {
 				state = sb_bt_start;
 				add_trace_begin();
+#ifdef CONFIG_XEN
 			} else if (s->event == CPU_DOMAIN_SWITCH) {
-					domain_switch = 1;				
+				domain_switch = 1;
+#endif
 			} else {
 				struct mm_struct * oldmm = mm;
 
@@ -633,21 +646,23 @@
 			is_ibs_sample = add_ibs_data(cpu, mm, cpu_mode);
 
 		} else {
+#ifdef CONFIG_XEN
 			if (domain_switch) {
-				cpu_current_domain[cpu] = s->eip;
+				per_cpu(current_domain, cpu) = s->eip;
 				add_domain_switch(s->eip);
 				domain_switch = 0;
-			} else if (!is_ibs_sample) {
-				if (cpu_current_domain[cpu] !=
-				    COORDINATOR_DOMAIN) {
-					add_sample_entry(s->eip, s->event);
-				}
-				else  if (state >= sb_bt_start &&
-				    !add_sample(mm, s, cpu_mode)) {
-					if (state == sb_bt_start) {
-						state = sb_bt_ignore;
-						atomic_inc(&oprofile_stats.bt_lost_no_mapping);
-					}
+			} else if (is_ibs_sample)
+				;
+			else if (per_cpu(current_domain, cpu) !=
+				 COORDINATOR_DOMAIN) {
+				add_sample_entry(s->eip, s->event);
+			} else
+#endif
+			if (state >= sb_bt_start &&
+			    !add_sample(mm, s, cpu_mode)) {
+				if (state == sb_bt_start) {
+					state = sb_bt_ignore;
+					atomic_inc(&oprofile_stats.bt_lost_no_mapping);
 				}
 			}
 		}
@@ -656,10 +671,11 @@
 	}
 	release_mm(mm);
 
+#ifdef CONFIG_XEN
 	/* We reset domain to COORDINATOR at each CPU switch */
-	if (cpu_current_domain[cpu] != COORDINATOR_DOMAIN) {
+	if (per_cpu(current_domain, cpu) != COORDINATOR_DOMAIN)
 		add_domain_switch(COORDINATOR_DOMAIN);
-	}
+#endif
 
 	mark_done(cpu);
 
diff -r dc034d0ccdd8 -r 98c00677dacb drivers/oprofile/cpu_buffer.c
--- a/drivers/oprofile/cpu_buffer.c	Wed Feb 15 12:09:02 2012 +0100
+++ b/drivers/oprofile/cpu_buffer.c	Thu Feb 16 08:52:06 2012 +0100
@@ -38,7 +38,11 @@
 #define DEFAULT_TIMER_EXPIRE (HZ / 10)
 static int work_enabled;
 
+#ifndef CONFIG_XEN
+#define current_domain COORDINATOR_DOMAIN
+#else
 static int32_t current_domain = COORDINATOR_DOMAIN;
+#endif
 
 void free_cpu_buffers(void)
 {
@@ -202,8 +206,10 @@
 		add_code(cpu_buf, (unsigned long)task);
 	}
 
+#ifdef CONFIG_XEN
 	if (pc == IBS_FETCH_CODE || pc == IBS_OP_CODE)
 		add_code(cpu_buf, cpu_mode);
+#endif
 
 	add_sample(cpu_buf, pc, event);
 	return 1;
@@ -284,6 +290,7 @@
 	add_sample(cpu_buf, pc, 0);
 }
 
+#ifdef CONFIG_XEN
 int oprofile_add_domain_switch(int32_t domain_id)
 {
 	struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()];
@@ -302,6 +309,7 @@
 
 	return 1;
 }
+#endif
 
 /*
  * This serves to avoid cpu buffer overflow, and makes sure
diff -r dc034d0ccdd8 -r 98c00677dacb drivers/oprofile/oprof.c
--- a/drivers/oprofile/oprof.c	Wed Feb 15 12:09:02 2012 +0100
+++ b/drivers/oprofile/oprof.c	Thu Feb 16 08:52:06 2012 +0100
@@ -37,6 +37,7 @@
  */
 static int timer = 0;
 
+#ifdef CONFIG_XEN
 int oprofile_set_active(int active_domains[], unsigned int adomains)
 {
 	int err;
@@ -62,6 +63,7 @@
 	mutex_unlock(&start_mutex);
 	return err;
 }
+#endif
 
 int oprofile_setup(void)
 {
diff -r dc034d0ccdd8 -r 98c00677dacb drivers/oprofile/oprofile_files.c
--- a/drivers/oprofile/oprofile_files.c	Wed Feb 15 12:09:02 2012 +0100
+++ b/drivers/oprofile/oprofile_files.c	Thu Feb 16 08:52:06 2012 +0100
@@ -21,7 +21,11 @@
 #include "oprof.h"
 
 unsigned long fs_buffer_size = 131072;
-unsigned long fs_cpu_buffer_size = 131072;
+#ifndef CONFIG_XEN
+unsigned long fs_cpu_buffer_size = 8192;
+#else
+unsigned long fs_cpu_buffer_size = 32768;
+#endif
 unsigned long fs_buffer_watershed = 32768; /* FIXME: tune */
 
 static ssize_t depth_read(struct file * file, char __user * buf, size_t count, loff_t * offset)
@@ -124,6 +128,8 @@
 	.write		= dump_write,
 };
 
+#ifdef CONFIG_XEN
+
 #define TMPBUFSIZE 512
 
 struct domain_data {
@@ -228,8 +234,8 @@
 
 static int adomain_open(struct inode *inode, struct file *filp)
 {
-    filp->private_data = &active_domains;
-    return 0;
+	filp->private_data = &active_domains;
+	return 0;
 }
 
 static const struct file_operations active_domain_ops = {
@@ -242,8 +248,8 @@
 
 static int pdomain_open(struct inode *inode, struct file *filp)
 {
-    filp->private_data = &passive_domains;
-    return 0;
+	filp->private_data = &passive_domains;
+	return 0;
 }
 
 static const struct file_operations passive_domain_ops = {
@@ -252,12 +258,16 @@
 	.write		= domain_write,
 };
 
+#endif /* CONFIG_XEN */
+
 void oprofile_create_files(struct super_block * sb, struct dentry * root)
 {
 	oprofilefs_create_file(sb, root, "enable", &enable_fops);
 	oprofilefs_create_file_perm(sb, root, "dump", &dump_fops, 0666);
+#ifdef CONFIG_XEN
 	oprofilefs_create_file(sb, root, "active_domains", &active_domain_ops);
 	oprofilefs_create_file(sb, root, "passive_domains", &passive_domain_ops);
+#endif
 	oprofilefs_create_file(sb, root, "buffer", &event_buffer_fops);
 	oprofilefs_create_ulong(sb, root, "buffer_size", &fs_buffer_size);
 	oprofilefs_create_ulong(sb, root, "buffer_watershed", &fs_buffer_watershed);
diff -r dc034d0ccdd8 -r 98c00677dacb include/linux/oprofile.h
--- a/include/linux/oprofile.h	Wed Feb 15 12:09:02 2012 +0100
+++ b/include/linux/oprofile.h	Thu Feb 16 08:52:06 2012 +0100
@@ -16,8 +16,9 @@
 #include <linux/types.h>
 #include <linux/spinlock.h>
 #include <asm/atomic.h>
-
+#ifdef CONFIG_XEN
 #include <xen/interface/xenoprof.h>
+#endif
  
 struct super_block;
 struct dentry;
@@ -29,11 +30,12 @@
 	/* create any necessary configuration files in the oprofile fs.
 	 * Optional. */
 	int (*create_files)(struct super_block * sb, struct dentry * root);
+#ifdef CONFIG_XEN
 	/* setup active domains with Xen */
 	int (*set_active)(int *active_domains, unsigned int adomains);
-        /* setup passive domains with Xen */
-        int (*set_passive)(int *passive_domains, unsigned int pdomains);
-	
+	/* setup passive domains with Xen */
+	int (*set_passive)(int *passive_domains, unsigned int pdomains);
+#endif
 	/* Do any necessary interrupt setup. Optional. */
 	int (*setup)(void);
 	/* Do any necessary interrupt shutdown. Optional. */

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 16 19:44:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 16 Feb 2012 19:44:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ry7FX-0007ne-Ag; Thu, 16 Feb 2012 19:44:15 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Ry7FV-0007nV-IY
	for xen-changelog@lists.xensource.com; Thu, 16 Feb 2012 19:44:14 +0000
Received: from [85.158.139.83:47986] by server-8.bemta-5.messagelabs.com id
	0F/5B-09797-C8C5D3F4; Thu, 16 Feb 2012 19:44:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-182.messagelabs.com!1329421449!7974864!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21005 invoked from network); 16 Feb 2012 19:44:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	16 Feb 2012 19:44:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Ry7FQ-0007uD-RB
	for xen-changelog@lists.xensource.com; Thu, 16 Feb 2012 19:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Ry7FQ-0005pT-FZ
	for xen-changelog@lists.xensource.com; Thu, 16 Feb 2012 19:44:08 +0000
Message-Id: <E1Ry7FQ-0005pT-FZ@xenbits.xen.org>
Date: Thu, 16 Feb 2012 19:44:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] replace bogus gdprintk() uses with {,
	d}printk()
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329378503 -3600
# Node ID 01c1bcbc62224833304ede44187400f65e8a6b4c
# Parent  fe427d3bb3785932e910b4951dfa6847963542a1
replace bogus gdprintk() uses with {,d}printk()

When the subject domain is not the current one (e.g. during domctl or
HVM save/restore handling), use of gdprintk() is questionable at best,
as it won't give the intended information on what domain is affected.
Use plain printk() or dprintk() instead, but keep things (mostly) as
guest messages by using XENLOG_G_*.

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


diff -r fe427d3bb378 -r 01c1bcbc6222 xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/arch/x86/domctl.c	Thu Feb 16 08:48:23 2012 +0100
@@ -783,7 +783,8 @@
             spin_unlock(&pcidevs_lock);
         }
         if ( ret < 0 )
-            gdprintk(XENLOG_ERR, "pt_irq_create_bind failed!\n");
+            printk(XENLOG_G_ERR "pt_irq_create_bind failed (%ld) for dom%d\n",
+                   ret, d->domain_id);
 
     bind_out:
         rcu_unlock_domain(d);
@@ -812,7 +813,8 @@
             spin_unlock(&pcidevs_lock);
         }
         if ( ret < 0 )
-            gdprintk(XENLOG_ERR, "pt_irq_destroy_bind failed!\n");
+            printk(XENLOG_G_ERR "pt_irq_destroy_bind failed (%ld) for dom%d\n",
+                   ret, d->domain_id);
 
     unbind_out:
         rcu_unlock_domain(d);
@@ -849,9 +851,9 @@
 
         if ( add )
         {
-            gdprintk(XENLOG_INFO,
-                "memory_map:add: gfn=%lx mfn=%lx nr_mfns=%lx\n",
-                gfn, mfn, nr_mfns);
+            printk(XENLOG_G_INFO
+                   "memory_map:add: dom%d gfn=%lx mfn=%lx nr=%lx\n",
+                   d->domain_id, gfn, mfn, nr_mfns);
 
             ret = iomem_permit_access(d, mfn, mfn + nr_mfns - 1);
             for ( i = 0; i < nr_mfns; i++ )
@@ -859,9 +861,9 @@
         }
         else
         {
-            gdprintk(XENLOG_INFO,
-                "memory_map:remove: gfn=%lx mfn=%lx nr_mfns=%lx\n",
-                 gfn, mfn, nr_mfns);
+            printk(XENLOG_G_INFO
+                   "memory_map:remove: dom%d gfn=%lx mfn=%lx nr=%lx\n",
+                   d->domain_id, gfn, mfn, nr_mfns);
 
             for ( i = 0; i < nr_mfns; i++ )
                 clear_mmio_p2m_entry(d, gfn+i);
@@ -888,9 +890,9 @@
         if ( (np == 0) || (fgp > MAX_IOPORTS) || (fmp > MAX_IOPORTS) ||
             ((fgp + np) > MAX_IOPORTS) || ((fmp + np) > MAX_IOPORTS) )
         {
-            gdprintk(XENLOG_ERR,
-                "ioport_map:invalid:gport=%x mport=%x nr_ports=%x\n",
-                fgp, fmp, np);
+            printk(XENLOG_G_ERR
+                   "ioport_map:invalid:dom%d gport=%x mport=%x nr=%x\n",
+                   domctl->domain, fgp, fmp, np);
             break;
         }
 
@@ -912,9 +914,9 @@
         hd = domain_hvm_iommu(d);
         if ( add )
         {
-            gdprintk(XENLOG_INFO,
-                "ioport_map:add f_gport=%x f_mport=%x np=%x\n",
-                fgp, fmp, np);
+            printk(XENLOG_G_INFO
+                   "ioport_map:add: dom%d gport=%x mport=%x nr=%x\n",
+                   d->domain_id, fgp, fmp, np);
 
             list_for_each_entry(g2m_ioport, &hd->g2m_ioport_list, list)
                 if (g2m_ioport->mport == fmp )
@@ -936,9 +938,9 @@
         }
         else
         {
-            gdprintk(XENLOG_INFO,
-                "ioport_map:remove f_gport=%x f_mport=%x np=%x\n",
-                fgp, fmp, np);
+            printk(XENLOG_G_INFO
+                   "ioport_map:remove: dom%d gport=%x mport=%x nr=%x\n",
+                   d->domain_id, fgp, fmp, np);
             list_for_each_entry(g2m_ioport, &hd->g2m_ioport_list, list)
                 if ( g2m_ioport->mport == fmp )
                 {
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/arch/x86/hvm/hvm.c	Thu Feb 16 08:48:23 2012 +0100
@@ -681,7 +681,8 @@
     vcpuid = hvm_load_instance(h);
     if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
     {
-        gdprintk(XENLOG_ERR, "HVM restore: domain has no vcpu %u\n", vcpuid);
+        dprintk(XENLOG_G_ERR, "HVM restore: dom%u has no vcpu%u\n",
+                d->domain_id, vcpuid);
         return -EINVAL;
     }
 
@@ -693,15 +694,15 @@
          !(ctxt.cr0 & X86_CR0_ET) ||
          ((ctxt.cr0 & (X86_CR0_PE|X86_CR0_PG)) == X86_CR0_PG) )
     {
-        gdprintk(XENLOG_ERR, "HVM restore: bad CR0 0x%"PRIx64"\n",
-                 ctxt.cr0);
+        printk(XENLOG_G_ERR "HVM%d restore: bad CR0 %#" PRIx64 "\n",
+               d->domain_id, ctxt.cr0);
         return -EINVAL;
     }
 
     if ( ctxt.cr4 & HVM_CR4_GUEST_RESERVED_BITS(v) )
     {
-        gdprintk(XENLOG_ERR, "HVM restore: bad CR4 0x%"PRIx64"\n",
-                 ctxt.cr4);
+        printk(XENLOG_G_ERR "HVM%d restore: bad CR4 %#" PRIx64 "\n",
+               d->domain_id, ctxt.cr4);
         return -EINVAL;
     }
 
@@ -709,8 +710,8 @@
                    | EFER_NX | EFER_SCE;
     if ( !hvm_efer_valid(d, ctxt.msr_efer, efer_validbits) )
     {
-        gdprintk(XENLOG_ERR, "HVM restore: bad EFER 0x%"PRIx64"\n",
-                 ctxt.msr_efer);
+        printk(XENLOG_G_ERR "HVM%d restore: bad EFER %#" PRIx64 "\n",
+               d->domain_id, ctxt.msr_efer);
         return -EINVAL;
     }
 
@@ -889,7 +890,8 @@
     vcpuid = hvm_load_instance(h);
     if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
     {
-        gdprintk(XENLOG_ERR, "HVM restore: domain has no vcpu %u\n", vcpuid);
+        dprintk(XENLOG_G_ERR, "HVM restore: dom%d has no vcpu%u\n",
+                d->domain_id, vcpuid);
         return -EINVAL;
     }
 
@@ -901,25 +903,25 @@
     desc = (struct hvm_save_descriptor *)&h->data[h->cur];
     if ( sizeof (*desc) > h->size - h->cur)
     {
-        gdprintk(XENLOG_WARNING,
-                 "HVM restore: not enough data left to read descriptpr"
-                 "for type %u\n", CPU_XSAVE_CODE);
+        printk(XENLOG_G_WARNING
+               "HVM%d restore: not enough data left to read descriptor"
+               "for type %u\n", d->domain_id, CPU_XSAVE_CODE);
         return -1;
     }
     if ( desc->length + sizeof (*desc) > h->size - h->cur)
     {
-        gdprintk(XENLOG_WARNING,
-                 "HVM restore: not enough data left to read %u bytes "
-                 "for type %u\n", desc->length, CPU_XSAVE_CODE);
+        printk(XENLOG_G_WARNING
+               "HVM%d restore: not enough data left to read %u bytes "
+               "for type %u\n", d->domain_id, desc->length, CPU_XSAVE_CODE);
         return -1;
     }
     if ( CPU_XSAVE_CODE != desc->typecode || (desc->length > HVM_CPU_XSAVE_SIZE) )
     {
-        gdprintk(XENLOG_WARNING,
-                 "HVM restore mismatch: expected type %u with max length %u, "
-                 "saw type %u length %u\n", CPU_XSAVE_CODE,
-                 (uint32_t)HVM_CPU_XSAVE_SIZE,
-                 desc->typecode, desc->length);
+        printk(XENLOG_G_WARNING
+               "HVM%d restore mismatch: expected type %u with max length %u, "
+               "saw type %u length %u\n", d->domain_id, CPU_XSAVE_CODE,
+               (unsigned int)HVM_CPU_XSAVE_SIZE,
+               desc->typecode, desc->length);
         return -1;
     }
     h->cur += sizeof (*desc);
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/arch/x86/hvm/mtrr.c
--- a/xen/arch/x86/hvm/mtrr.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/arch/x86/hvm/mtrr.c	Thu Feb 16 08:48:23 2012 +0100
@@ -667,7 +667,8 @@
     vcpuid = hvm_load_instance(h);
     if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
     {
-        gdprintk(XENLOG_ERR, "HVM restore: domain has no vcpu %u\n", vcpuid);
+        dprintk(XENLOG_G_ERR, "HVM restore: dom%d has no vcpu%u\n",
+                d->domain_id, vcpuid);
         return -EINVAL;
     }
 
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/arch/x86/hvm/save.c
--- a/xen/arch/x86/hvm/save.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/arch/x86/hvm/save.c	Thu Feb 16 08:48:23 2012 +0100
@@ -42,24 +42,24 @@
 
     if ( hdr->magic != HVM_FILE_MAGIC )
     {
-        gdprintk(XENLOG_ERR, 
-                 "HVM restore: bad magic number %#"PRIx32"\n", hdr->magic);
+        printk(XENLOG_G_ERR "HVM%d restore: bad magic number %#"PRIx32"\n",
+               d->domain_id, hdr->magic);
         return -1;
     }
 
     if ( hdr->version != HVM_FILE_VERSION )
     {
-        gdprintk(XENLOG_ERR, 
-                 "HVM restore: unsupported version %u\n", hdr->version);
+        printk(XENLOG_G_ERR "HVM%d restore: unsupported version %u\n",
+               d->domain_id, hdr->version);
         return -1;
     }
 
     cpuid(1, &eax, &ebx, &ecx, &edx);
     /* CPUs ought to match but with feature-masking they might not */
     if ( (hdr->cpuid & ~0x0fUL) != (eax & ~0x0fUL) )
-        gdprintk(XENLOG_INFO, "HVM restore (%u): VM saved on one CPU "
-                 "(%#"PRIx32") and restored on another (%#"PRIx32").\n", 
-                 d->domain_id, hdr->cpuid, eax);
+        printk(XENLOG_G_INFO "HVM%d restore: VM saved on one CPU "
+               "(%#"PRIx32") and restored on another (%#"PRIx32").\n",
+               d->domain_id, hdr->cpuid, eax);
 
     /* Restore guest's preferred TSC frequency. */
     if ( hdr->gtsc_khz )
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/arch/x86/hvm/viridian.c
--- a/xen/arch/x86/hvm/viridian.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/arch/x86/hvm/viridian.c	Thu Feb 16 08:48:23 2012 +0100
@@ -448,7 +448,8 @@
     vcpuid = hvm_load_instance(h);
     if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
     {
-        gdprintk(XENLOG_ERR, "HVM restore: domain has no vcpu %u\n", vcpuid);
+        dprintk(XENLOG_G_ERR, "HVM restore: dom%d has no vcpu%u\n",
+                d->domain_id, vcpuid);
         return -EINVAL;
     }
 
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/arch/x86/hvm/vlapic.c
--- a/xen/arch/x86/hvm/vlapic.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/arch/x86/hvm/vlapic.c	Thu Feb 16 08:48:23 2012 +0100
@@ -1136,7 +1136,8 @@
     vcpuid = hvm_load_instance(h); 
     if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
     {
-        gdprintk(XENLOG_ERR, "HVM restore: domain has no vlapic %u\n", vcpuid);
+        dprintk(XENLOG_G_ERR, "HVM restore: dom%d has no apic%u\n",
+                d->domain_id, vcpuid);
         return -EINVAL;
     }
     s = vcpu_vlapic(v);
@@ -1159,7 +1160,8 @@
     vcpuid = hvm_load_instance(h); 
     if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
     {
-        gdprintk(XENLOG_ERR, "HVM restore: domain has no vlapic %u\n", vcpuid);
+        dprintk(XENLOG_G_ERR, "HVM restore: dom%d has no apic%u\n",
+                d->domain_id, vcpuid);
         return -EINVAL;
     }
     s = vcpu_vlapic(v);
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/arch/x86/irq.c	Thu Feb 16 08:48:23 2012 +0100
@@ -1517,9 +1517,9 @@
     {
         if ( desc->action != NULL )
         {
-            gdprintk(XENLOG_INFO,
-                    "Cannot bind IRQ %d to guest. In use by '%s'.\n",
-                    pirq->pirq, desc->action->name);
+            printk(XENLOG_G_INFO
+                   "Cannot bind IRQ%d to dom%d. In use by '%s'.\n",
+                   pirq->pirq, v->domain->domain_id, desc->action->name);
             rc = -EBUSY;
             goto unlock_out;
         }
@@ -1531,9 +1531,9 @@
                  zalloc_cpumask_var(&newaction->cpu_eoi_map) )
                 goto retry;
             xfree(newaction);
-            gdprintk(XENLOG_INFO,
-                     "Cannot bind IRQ %d to guest. Out of memory.\n",
-                     pirq->pirq);
+            printk(XENLOG_G_INFO
+                   "Cannot bind IRQ%d to dom%d. Out of memory.\n",
+                   pirq->pirq, v->domain->domain_id);
             rc = -ENOMEM;
             goto out;
         }
@@ -1558,11 +1558,10 @@
     }
     else if ( !will_share || !action->shareable )
     {
-        gdprintk(XENLOG_INFO, "Cannot bind IRQ %d to guest. %s.\n",
-                 pirq->pirq,
-                 will_share ?
-                 "Others do not share" :
-                 "Will not share with others");
+        printk(XENLOG_G_INFO "Cannot bind IRQ%d to dom%d. %s.\n",
+               pirq->pirq, v->domain->domain_id,
+               will_share ? "Others do not share"
+                          : "Will not share with others");
         rc = -EBUSY;
         goto unlock_out;
     }
@@ -1581,8 +1580,9 @@
 
     if ( action->nr_guests == IRQ_MAX_GUESTS )
     {
-        gdprintk(XENLOG_INFO, "Cannot bind IRQ %d to guest. "
-               "Already at max share.\n", pirq->pirq);
+        printk(XENLOG_G_INFO "Cannot bind IRQ%d to dom%d. "
+               "Already at max share.\n",
+               pirq->pirq, v->domain->domain_id);
         rc = -EBUSY;
         goto unlock_out;
     }
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/arch/x86/oprofile/op_model_ppro.c
--- a/xen/arch/x86/oprofile/op_model_ppro.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/arch/x86/oprofile/op_model_ppro.c	Thu Feb 16 08:48:23 2012 +0100
@@ -235,10 +235,10 @@
 	vpmu_set(vpmu, VPMU_PASSIVE_DOMAIN_ALLOCATED);
 	return 1;
 out:
-        gdprintk(XENLOG_WARNING, "Insufficient memory for oprofile, oprofile is "
-                 "unavailable on domain %d vcpu %d.\n",
-                 v->vcpu_id, v->domain->domain_id);
-        return 0;
+	printk(XENLOG_G_WARNING "Insufficient memory for oprofile,"
+	       " oprofile is unavailable on dom%d vcpu%d\n",
+	       v->vcpu_id, v->domain->domain_id);
+	return 0;
 }
 
 static void ppro_free_msr(struct vcpu *v)
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/arch/x86/time.c	Thu Feb 16 08:48:23 2012 +0100
@@ -945,8 +945,8 @@
     /* Sanity check: CPU frequency allegedly dropping below 1MHz? */
     if ( freq < 1000000u )
     {
-        gdprintk(XENLOG_WARNING, "Rejecting CPU frequency change "
-                 "to %"PRIu64" Hz.\n", freq);
+        printk(XENLOG_WARNING "Rejecting CPU frequency change "
+               "to %"PRIu64" Hz\n", freq);
         return -EINVAL;
     }
 
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/common/hvm/save.c
--- a/xen/common/hvm/save.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/common/hvm/save.c	Thu Feb 16 08:48:23 2012 +0100
@@ -108,8 +108,8 @@
 
     if ( hvm_sr_handlers[typecode].save(d, &ctxt) != 0 )
     {
-        gdprintk(XENLOG_ERR, 
-                 "HVM save: failed to save type %"PRIu16"\n", typecode);
+        printk(XENLOG_G_ERR "HVM%d save: failed to save type %"PRIu16"\n",
+               d->domain_id, typecode);
         rv = -EFAULT;
     }
     else if ( copy_to_guest(handle,
@@ -149,7 +149,8 @@
 
     if ( hvm_save_entry(HEADER, 0, h, &hdr) != 0 )
     {
-        gdprintk(XENLOG_ERR, "HVM save: failed to write header\n");
+        printk(XENLOG_G_ERR "HVM%d save: failed to write header\n",
+               d->domain_id);
         return -EFAULT;
     } 
 
@@ -159,11 +160,13 @@
         handler = hvm_sr_handlers[i].save;
         if ( handler != NULL ) 
         {
-            gdprintk(XENLOG_INFO, "HVM save: %s\n",  hvm_sr_handlers[i].name);
+            printk(XENLOG_G_INFO "HVM%d save: %s\n",
+                   d->domain_id, hvm_sr_handlers[i].name);
             if ( handler(d, h) != 0 ) 
             {
-                gdprintk(XENLOG_ERR, 
-                         "HVM save: failed to save type %"PRIu16"\n", i);
+                printk(XENLOG_G_ERR
+                       "HVM%d save: failed to save type %"PRIu16"\n",
+                       d->domain_id, i);
                 return -EFAULT;
             } 
         }
@@ -173,7 +176,8 @@
     if ( hvm_save_entry(END, 0, h, &end) != 0 )
     {
         /* Run out of data */
-        gdprintk(XENLOG_ERR, "HVM save: no room for end marker.\n");
+        printk(XENLOG_G_ERR "HVM%d save: no room for end marker\n",
+               d->domain_id);
         return -EFAULT;
     }
 
@@ -209,8 +213,9 @@
         if ( h->size - h->cur < sizeof(struct hvm_save_descriptor) )
         {
             /* Run out of data */
-            gdprintk(XENLOG_ERR, 
-                     "HVM restore: save did not end with a null entry\n");
+            printk(XENLOG_G_ERR
+                   "HVM%d restore: save did not end with a null entry\n",
+                   d->domain_id);
             return -1;
         }
         
@@ -223,20 +228,18 @@
         if ( (desc->typecode > HVM_SAVE_CODE_MAX) ||
              ((handler = hvm_sr_handlers[desc->typecode].load) == NULL) )
         {
-            gdprintk(XENLOG_ERR, 
-                     "HVM restore: unknown entry typecode %u\n", 
-                     desc->typecode);
+            printk(XENLOG_G_ERR "HVM%d restore: unknown entry typecode %u\n",
+                   d->domain_id, desc->typecode);
             return -1;
         }
 
         /* Load the entry */
-        gdprintk(XENLOG_INFO, "HVM restore: %s %"PRIu16"\n",  
-                 hvm_sr_handlers[desc->typecode].name, desc->instance);
+        printk(XENLOG_G_INFO "HVM%d restore: %s %"PRIu16"\n", d->domain_id,
+               hvm_sr_handlers[desc->typecode].name, desc->instance);
         if ( handler(d, h) != 0 ) 
         {
-            gdprintk(XENLOG_ERR, 
-                     "HVM restore: failed to load entry %u/%u\n", 
-                     desc->typecode, desc->instance);
+            printk(XENLOG_G_ERR "HVM%d restore: failed to load entry %u/%u\n",
+                   d->domain_id, desc->typecode, desc->instance);
             return -1;
         }
     }
@@ -251,10 +254,9 @@
         = (struct hvm_save_descriptor *)&h->data[h->cur];
     if ( h->size - h->cur < len + sizeof (*d) )
     {
-        gdprintk(XENLOG_WARNING,
-                 "HVM save: no room for %"PRIu32" + %u bytes "
-                 "for typecode %"PRIu16"\n",
-                 len, (unsigned) sizeof (*d), tc);
+        printk(XENLOG_G_WARNING "HVM save: no room for"
+               " %"PRIu32" + %zu bytes for typecode %"PRIu16"\n",
+               len, sizeof(*d), tc);
         return -1;
     }
     d->typecode = tc;
@@ -278,17 +280,17 @@
         = (struct hvm_save_descriptor *)&h->data[h->cur];
     if ( len + sizeof (*d) > h->size - h->cur)
     {
-        gdprintk(XENLOG_WARNING, 
-                 "HVM restore: not enough data left to read %u bytes "
-                 "for type %u\n", len, type);
+        printk(XENLOG_G_WARNING
+               "HVM restore: not enough data left to read %u bytes "
+               "for type %u\n", len, type);
         return -1;
     }    
     if ( (type != d->typecode) || (len < d->length) ||
          (strict_length && (len != d->length)) )
     {
-        gdprintk(XENLOG_WARNING, 
-                 "HVM restore mismatch: expected type %u length %u, "
-                 "saw type %u length %u\n", type, len, d->typecode, d->length);
+        printk(XENLOG_G_WARNING
+               "HVM restore mismatch: expected type %u length %u, "
+               "saw type %u length %u\n", type, len, d->typecode, d->length);
         return -1;
     }
     h->cur += sizeof(*d);
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/common/sysctl.c
--- a/xen/common/sysctl.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/common/sysctl.c	Thu Feb 16 08:48:23 2012 +0100
@@ -301,8 +301,6 @@
                     ret = query_page_offline(pfn, ptr++);
                     break;
                 default:
-                    gdprintk(XENLOG_WARNING, "invalid page offline op %x\n",
-                            op->u.page_offline.cmd);
                     ret = -EINVAL;
                     break;
             }
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/common/xenoprof.c
--- a/xen/common/xenoprof.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/common/xenoprof.c	Thu Feb 16 08:48:23 2012 +0100
@@ -144,8 +144,8 @@
         struct page_info *page = mfn_to_page(mfn + i);
         if ( (page->count_info & (PGC_allocated|PGC_count_mask)) != 0 )
         {
-            gdprintk(XENLOG_INFO, "mfn 0x%lx page->count_info 0x%lx\n",
-                     mfn + i, (unsigned long)page->count_info);
+            printk(XENLOG_G_INFO "dom%d mfn %#lx page->count_info %#lx\n",
+                   d->domain_id, mfn + i, page->count_info);
             return -EBUSY;
         }
         page_set_owner(page, NULL);
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/drivers/passthrough/iommu.c
--- a/xen/drivers/passthrough/iommu.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/drivers/passthrough/iommu.c	Thu Feb 16 08:48:23 2012 +0100
@@ -566,9 +566,9 @@
 
         if ( device_assigned(seg, bus, devfn) )
         {
-            gdprintk(XENLOG_ERR, "XEN_DOMCTL_test_assign_device: "
-                     "%04x:%02x:%02x.%u already assigned, or non-existent\n",
-                     seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(XENLOG_G_INFO
+                   "%04x:%02x:%02x.%u already assigned, or non-existent\n",
+                   seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
             ret = -EINVAL;
         }
         break;
@@ -576,8 +576,8 @@
     case XEN_DOMCTL_assign_device:
         if ( unlikely((d = get_domain_by_id(domctl->domain)) == NULL) )
         {
-            gdprintk(XENLOG_ERR,
-                "XEN_DOMCTL_assign_device: get_domain_by_id() failed\n");
+            printk(XENLOG_G_ERR
+                   "XEN_DOMCTL_assign_device: get_domain_by_id() failed\n");
             ret = -EINVAL;
             break;
         }
@@ -593,9 +593,9 @@
 #ifdef __ia64__ /* XXX Is this really needed? */
         if ( device_assigned(seg, bus, devfn) )
         {
-            gdprintk(XENLOG_ERR, "XEN_DOMCTL_assign_device: "
-                     "%x:%x.%x already assigned, or non-existent\n",
-                     bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(XENLOG_G_ERR "XEN_DOMCTL_assign_device: "
+                   "%04x:%02x:%02x.%u already assigned, or non-existent\n",
+                   seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
             ret = -EINVAL;
             goto assign_device_out;
         }
@@ -603,9 +603,10 @@
 
         ret = assign_device(d, seg, bus, devfn);
         if ( ret )
-            gdprintk(XENLOG_ERR, "XEN_DOMCTL_assign_device: "
-                     "assign device (%04x:%02x:%02x.%u) failed\n",
-                     seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(XENLOG_G_ERR "XEN_DOMCTL_assign_device: "
+                   "assign %04x:%02x:%02x.%u to dom%d failed (%d)\n",
+                   seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                   d->domain_id, ret);
 
     assign_device_out:
         put_domain(d);
@@ -614,8 +615,8 @@
     case XEN_DOMCTL_deassign_device:
         if ( unlikely((d = get_domain_by_id(domctl->domain)) == NULL) )
         {
-            gdprintk(XENLOG_ERR,
-                "XEN_DOMCTL_deassign_device: get_domain_by_id() failed\n");
+            printk(XENLOG_G_ERR
+                   "XEN_DOMCTL_deassign_device: get_domain_by_id() failed\n");
             ret = -EINVAL;
             break;
         }
@@ -640,9 +641,10 @@
         ret = deassign_device(d, seg, bus, devfn);
         spin_unlock(&pcidevs_lock);
         if ( ret )
-            gdprintk(XENLOG_ERR, "XEN_DOMCTL_deassign_device: "
-                     "deassign device (%04x:%02x:%02x.%u) failed\n",
-                     seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(XENLOG_G_ERR
+                   "deassign %04x:%02x:%02x.%u from dom%d failed (%d)\n",
+                   seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                   d->domain_id, ret);
 
     deassign_device_out:
         put_domain(d);

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

From xen-changelog-bounces@lists.xensource.com Thu Feb 16 19:44:20 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 16 Feb 2012 19:44:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1Ry7FX-0007ne-Ag; Thu, 16 Feb 2012 19:44:15 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Ry7FV-0007nV-IY
	for xen-changelog@lists.xensource.com; Thu, 16 Feb 2012 19:44:14 +0000
Received: from [85.158.139.83:47986] by server-8.bemta-5.messagelabs.com id
	0F/5B-09797-C8C5D3F4; Thu, 16 Feb 2012 19:44:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-182.messagelabs.com!1329421449!7974864!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21005 invoked from network); 16 Feb 2012 19:44:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	16 Feb 2012 19:44:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Ry7FQ-0007uD-RB
	for xen-changelog@lists.xensource.com; Thu, 16 Feb 2012 19:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Ry7FQ-0005pT-FZ
	for xen-changelog@lists.xensource.com; Thu, 16 Feb 2012 19:44:08 +0000
Message-Id: <E1Ry7FQ-0005pT-FZ@xenbits.xen.org>
Date: Thu, 16 Feb 2012 19:44:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] replace bogus gdprintk() uses with {,
	d}printk()
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329378503 -3600
# Node ID 01c1bcbc62224833304ede44187400f65e8a6b4c
# Parent  fe427d3bb3785932e910b4951dfa6847963542a1
replace bogus gdprintk() uses with {,d}printk()

When the subject domain is not the current one (e.g. during domctl or
HVM save/restore handling), use of gdprintk() is questionable at best,
as it won't give the intended information on what domain is affected.
Use plain printk() or dprintk() instead, but keep things (mostly) as
guest messages by using XENLOG_G_*.

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


diff -r fe427d3bb378 -r 01c1bcbc6222 xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/arch/x86/domctl.c	Thu Feb 16 08:48:23 2012 +0100
@@ -783,7 +783,8 @@
             spin_unlock(&pcidevs_lock);
         }
         if ( ret < 0 )
-            gdprintk(XENLOG_ERR, "pt_irq_create_bind failed!\n");
+            printk(XENLOG_G_ERR "pt_irq_create_bind failed (%ld) for dom%d\n",
+                   ret, d->domain_id);
 
     bind_out:
         rcu_unlock_domain(d);
@@ -812,7 +813,8 @@
             spin_unlock(&pcidevs_lock);
         }
         if ( ret < 0 )
-            gdprintk(XENLOG_ERR, "pt_irq_destroy_bind failed!\n");
+            printk(XENLOG_G_ERR "pt_irq_destroy_bind failed (%ld) for dom%d\n",
+                   ret, d->domain_id);
 
     unbind_out:
         rcu_unlock_domain(d);
@@ -849,9 +851,9 @@
 
         if ( add )
         {
-            gdprintk(XENLOG_INFO,
-                "memory_map:add: gfn=%lx mfn=%lx nr_mfns=%lx\n",
-                gfn, mfn, nr_mfns);
+            printk(XENLOG_G_INFO
+                   "memory_map:add: dom%d gfn=%lx mfn=%lx nr=%lx\n",
+                   d->domain_id, gfn, mfn, nr_mfns);
 
             ret = iomem_permit_access(d, mfn, mfn + nr_mfns - 1);
             for ( i = 0; i < nr_mfns; i++ )
@@ -859,9 +861,9 @@
         }
         else
         {
-            gdprintk(XENLOG_INFO,
-                "memory_map:remove: gfn=%lx mfn=%lx nr_mfns=%lx\n",
-                 gfn, mfn, nr_mfns);
+            printk(XENLOG_G_INFO
+                   "memory_map:remove: dom%d gfn=%lx mfn=%lx nr=%lx\n",
+                   d->domain_id, gfn, mfn, nr_mfns);
 
             for ( i = 0; i < nr_mfns; i++ )
                 clear_mmio_p2m_entry(d, gfn+i);
@@ -888,9 +890,9 @@
         if ( (np == 0) || (fgp > MAX_IOPORTS) || (fmp > MAX_IOPORTS) ||
             ((fgp + np) > MAX_IOPORTS) || ((fmp + np) > MAX_IOPORTS) )
         {
-            gdprintk(XENLOG_ERR,
-                "ioport_map:invalid:gport=%x mport=%x nr_ports=%x\n",
-                fgp, fmp, np);
+            printk(XENLOG_G_ERR
+                   "ioport_map:invalid:dom%d gport=%x mport=%x nr=%x\n",
+                   domctl->domain, fgp, fmp, np);
             break;
         }
 
@@ -912,9 +914,9 @@
         hd = domain_hvm_iommu(d);
         if ( add )
         {
-            gdprintk(XENLOG_INFO,
-                "ioport_map:add f_gport=%x f_mport=%x np=%x\n",
-                fgp, fmp, np);
+            printk(XENLOG_G_INFO
+                   "ioport_map:add: dom%d gport=%x mport=%x nr=%x\n",
+                   d->domain_id, fgp, fmp, np);
 
             list_for_each_entry(g2m_ioport, &hd->g2m_ioport_list, list)
                 if (g2m_ioport->mport == fmp )
@@ -936,9 +938,9 @@
         }
         else
         {
-            gdprintk(XENLOG_INFO,
-                "ioport_map:remove f_gport=%x f_mport=%x np=%x\n",
-                fgp, fmp, np);
+            printk(XENLOG_G_INFO
+                   "ioport_map:remove: dom%d gport=%x mport=%x nr=%x\n",
+                   d->domain_id, fgp, fmp, np);
             list_for_each_entry(g2m_ioport, &hd->g2m_ioport_list, list)
                 if ( g2m_ioport->mport == fmp )
                 {
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/arch/x86/hvm/hvm.c	Thu Feb 16 08:48:23 2012 +0100
@@ -681,7 +681,8 @@
     vcpuid = hvm_load_instance(h);
     if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
     {
-        gdprintk(XENLOG_ERR, "HVM restore: domain has no vcpu %u\n", vcpuid);
+        dprintk(XENLOG_G_ERR, "HVM restore: dom%u has no vcpu%u\n",
+                d->domain_id, vcpuid);
         return -EINVAL;
     }
 
@@ -693,15 +694,15 @@
          !(ctxt.cr0 & X86_CR0_ET) ||
          ((ctxt.cr0 & (X86_CR0_PE|X86_CR0_PG)) == X86_CR0_PG) )
     {
-        gdprintk(XENLOG_ERR, "HVM restore: bad CR0 0x%"PRIx64"\n",
-                 ctxt.cr0);
+        printk(XENLOG_G_ERR "HVM%d restore: bad CR0 %#" PRIx64 "\n",
+               d->domain_id, ctxt.cr0);
         return -EINVAL;
     }
 
     if ( ctxt.cr4 & HVM_CR4_GUEST_RESERVED_BITS(v) )
     {
-        gdprintk(XENLOG_ERR, "HVM restore: bad CR4 0x%"PRIx64"\n",
-                 ctxt.cr4);
+        printk(XENLOG_G_ERR "HVM%d restore: bad CR4 %#" PRIx64 "\n",
+               d->domain_id, ctxt.cr4);
         return -EINVAL;
     }
 
@@ -709,8 +710,8 @@
                    | EFER_NX | EFER_SCE;
     if ( !hvm_efer_valid(d, ctxt.msr_efer, efer_validbits) )
     {
-        gdprintk(XENLOG_ERR, "HVM restore: bad EFER 0x%"PRIx64"\n",
-                 ctxt.msr_efer);
+        printk(XENLOG_G_ERR "HVM%d restore: bad EFER %#" PRIx64 "\n",
+               d->domain_id, ctxt.msr_efer);
         return -EINVAL;
     }
 
@@ -889,7 +890,8 @@
     vcpuid = hvm_load_instance(h);
     if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
     {
-        gdprintk(XENLOG_ERR, "HVM restore: domain has no vcpu %u\n", vcpuid);
+        dprintk(XENLOG_G_ERR, "HVM restore: dom%d has no vcpu%u\n",
+                d->domain_id, vcpuid);
         return -EINVAL;
     }
 
@@ -901,25 +903,25 @@
     desc = (struct hvm_save_descriptor *)&h->data[h->cur];
     if ( sizeof (*desc) > h->size - h->cur)
     {
-        gdprintk(XENLOG_WARNING,
-                 "HVM restore: not enough data left to read descriptpr"
-                 "for type %u\n", CPU_XSAVE_CODE);
+        printk(XENLOG_G_WARNING
+               "HVM%d restore: not enough data left to read descriptor"
+               "for type %u\n", d->domain_id, CPU_XSAVE_CODE);
         return -1;
     }
     if ( desc->length + sizeof (*desc) > h->size - h->cur)
     {
-        gdprintk(XENLOG_WARNING,
-                 "HVM restore: not enough data left to read %u bytes "
-                 "for type %u\n", desc->length, CPU_XSAVE_CODE);
+        printk(XENLOG_G_WARNING
+               "HVM%d restore: not enough data left to read %u bytes "
+               "for type %u\n", d->domain_id, desc->length, CPU_XSAVE_CODE);
         return -1;
     }
     if ( CPU_XSAVE_CODE != desc->typecode || (desc->length > HVM_CPU_XSAVE_SIZE) )
     {
-        gdprintk(XENLOG_WARNING,
-                 "HVM restore mismatch: expected type %u with max length %u, "
-                 "saw type %u length %u\n", CPU_XSAVE_CODE,
-                 (uint32_t)HVM_CPU_XSAVE_SIZE,
-                 desc->typecode, desc->length);
+        printk(XENLOG_G_WARNING
+               "HVM%d restore mismatch: expected type %u with max length %u, "
+               "saw type %u length %u\n", d->domain_id, CPU_XSAVE_CODE,
+               (unsigned int)HVM_CPU_XSAVE_SIZE,
+               desc->typecode, desc->length);
         return -1;
     }
     h->cur += sizeof (*desc);
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/arch/x86/hvm/mtrr.c
--- a/xen/arch/x86/hvm/mtrr.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/arch/x86/hvm/mtrr.c	Thu Feb 16 08:48:23 2012 +0100
@@ -667,7 +667,8 @@
     vcpuid = hvm_load_instance(h);
     if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
     {
-        gdprintk(XENLOG_ERR, "HVM restore: domain has no vcpu %u\n", vcpuid);
+        dprintk(XENLOG_G_ERR, "HVM restore: dom%d has no vcpu%u\n",
+                d->domain_id, vcpuid);
         return -EINVAL;
     }
 
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/arch/x86/hvm/save.c
--- a/xen/arch/x86/hvm/save.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/arch/x86/hvm/save.c	Thu Feb 16 08:48:23 2012 +0100
@@ -42,24 +42,24 @@
 
     if ( hdr->magic != HVM_FILE_MAGIC )
     {
-        gdprintk(XENLOG_ERR, 
-                 "HVM restore: bad magic number %#"PRIx32"\n", hdr->magic);
+        printk(XENLOG_G_ERR "HVM%d restore: bad magic number %#"PRIx32"\n",
+               d->domain_id, hdr->magic);
         return -1;
     }
 
     if ( hdr->version != HVM_FILE_VERSION )
     {
-        gdprintk(XENLOG_ERR, 
-                 "HVM restore: unsupported version %u\n", hdr->version);
+        printk(XENLOG_G_ERR "HVM%d restore: unsupported version %u\n",
+               d->domain_id, hdr->version);
         return -1;
     }
 
     cpuid(1, &eax, &ebx, &ecx, &edx);
     /* CPUs ought to match but with feature-masking they might not */
     if ( (hdr->cpuid & ~0x0fUL) != (eax & ~0x0fUL) )
-        gdprintk(XENLOG_INFO, "HVM restore (%u): VM saved on one CPU "
-                 "(%#"PRIx32") and restored on another (%#"PRIx32").\n", 
-                 d->domain_id, hdr->cpuid, eax);
+        printk(XENLOG_G_INFO "HVM%d restore: VM saved on one CPU "
+               "(%#"PRIx32") and restored on another (%#"PRIx32").\n",
+               d->domain_id, hdr->cpuid, eax);
 
     /* Restore guest's preferred TSC frequency. */
     if ( hdr->gtsc_khz )
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/arch/x86/hvm/viridian.c
--- a/xen/arch/x86/hvm/viridian.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/arch/x86/hvm/viridian.c	Thu Feb 16 08:48:23 2012 +0100
@@ -448,7 +448,8 @@
     vcpuid = hvm_load_instance(h);
     if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
     {
-        gdprintk(XENLOG_ERR, "HVM restore: domain has no vcpu %u\n", vcpuid);
+        dprintk(XENLOG_G_ERR, "HVM restore: dom%d has no vcpu%u\n",
+                d->domain_id, vcpuid);
         return -EINVAL;
     }
 
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/arch/x86/hvm/vlapic.c
--- a/xen/arch/x86/hvm/vlapic.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/arch/x86/hvm/vlapic.c	Thu Feb 16 08:48:23 2012 +0100
@@ -1136,7 +1136,8 @@
     vcpuid = hvm_load_instance(h); 
     if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
     {
-        gdprintk(XENLOG_ERR, "HVM restore: domain has no vlapic %u\n", vcpuid);
+        dprintk(XENLOG_G_ERR, "HVM restore: dom%d has no apic%u\n",
+                d->domain_id, vcpuid);
         return -EINVAL;
     }
     s = vcpu_vlapic(v);
@@ -1159,7 +1160,8 @@
     vcpuid = hvm_load_instance(h); 
     if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
     {
-        gdprintk(XENLOG_ERR, "HVM restore: domain has no vlapic %u\n", vcpuid);
+        dprintk(XENLOG_G_ERR, "HVM restore: dom%d has no apic%u\n",
+                d->domain_id, vcpuid);
         return -EINVAL;
     }
     s = vcpu_vlapic(v);
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/arch/x86/irq.c	Thu Feb 16 08:48:23 2012 +0100
@@ -1517,9 +1517,9 @@
     {
         if ( desc->action != NULL )
         {
-            gdprintk(XENLOG_INFO,
-                    "Cannot bind IRQ %d to guest. In use by '%s'.\n",
-                    pirq->pirq, desc->action->name);
+            printk(XENLOG_G_INFO
+                   "Cannot bind IRQ%d to dom%d. In use by '%s'.\n",
+                   pirq->pirq, v->domain->domain_id, desc->action->name);
             rc = -EBUSY;
             goto unlock_out;
         }
@@ -1531,9 +1531,9 @@
                  zalloc_cpumask_var(&newaction->cpu_eoi_map) )
                 goto retry;
             xfree(newaction);
-            gdprintk(XENLOG_INFO,
-                     "Cannot bind IRQ %d to guest. Out of memory.\n",
-                     pirq->pirq);
+            printk(XENLOG_G_INFO
+                   "Cannot bind IRQ%d to dom%d. Out of memory.\n",
+                   pirq->pirq, v->domain->domain_id);
             rc = -ENOMEM;
             goto out;
         }
@@ -1558,11 +1558,10 @@
     }
     else if ( !will_share || !action->shareable )
     {
-        gdprintk(XENLOG_INFO, "Cannot bind IRQ %d to guest. %s.\n",
-                 pirq->pirq,
-                 will_share ?
-                 "Others do not share" :
-                 "Will not share with others");
+        printk(XENLOG_G_INFO "Cannot bind IRQ%d to dom%d. %s.\n",
+               pirq->pirq, v->domain->domain_id,
+               will_share ? "Others do not share"
+                          : "Will not share with others");
         rc = -EBUSY;
         goto unlock_out;
     }
@@ -1581,8 +1580,9 @@
 
     if ( action->nr_guests == IRQ_MAX_GUESTS )
     {
-        gdprintk(XENLOG_INFO, "Cannot bind IRQ %d to guest. "
-               "Already at max share.\n", pirq->pirq);
+        printk(XENLOG_G_INFO "Cannot bind IRQ%d to dom%d. "
+               "Already at max share.\n",
+               pirq->pirq, v->domain->domain_id);
         rc = -EBUSY;
         goto unlock_out;
     }
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/arch/x86/oprofile/op_model_ppro.c
--- a/xen/arch/x86/oprofile/op_model_ppro.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/arch/x86/oprofile/op_model_ppro.c	Thu Feb 16 08:48:23 2012 +0100
@@ -235,10 +235,10 @@
 	vpmu_set(vpmu, VPMU_PASSIVE_DOMAIN_ALLOCATED);
 	return 1;
 out:
-        gdprintk(XENLOG_WARNING, "Insufficient memory for oprofile, oprofile is "
-                 "unavailable on domain %d vcpu %d.\n",
-                 v->vcpu_id, v->domain->domain_id);
-        return 0;
+	printk(XENLOG_G_WARNING "Insufficient memory for oprofile,"
+	       " oprofile is unavailable on dom%d vcpu%d\n",
+	       v->vcpu_id, v->domain->domain_id);
+	return 0;
 }
 
 static void ppro_free_msr(struct vcpu *v)
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/arch/x86/time.c	Thu Feb 16 08:48:23 2012 +0100
@@ -945,8 +945,8 @@
     /* Sanity check: CPU frequency allegedly dropping below 1MHz? */
     if ( freq < 1000000u )
     {
-        gdprintk(XENLOG_WARNING, "Rejecting CPU frequency change "
-                 "to %"PRIu64" Hz.\n", freq);
+        printk(XENLOG_WARNING "Rejecting CPU frequency change "
+               "to %"PRIu64" Hz\n", freq);
         return -EINVAL;
     }
 
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/common/hvm/save.c
--- a/xen/common/hvm/save.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/common/hvm/save.c	Thu Feb 16 08:48:23 2012 +0100
@@ -108,8 +108,8 @@
 
     if ( hvm_sr_handlers[typecode].save(d, &ctxt) != 0 )
     {
-        gdprintk(XENLOG_ERR, 
-                 "HVM save: failed to save type %"PRIu16"\n", typecode);
+        printk(XENLOG_G_ERR "HVM%d save: failed to save type %"PRIu16"\n",
+               d->domain_id, typecode);
         rv = -EFAULT;
     }
     else if ( copy_to_guest(handle,
@@ -149,7 +149,8 @@
 
     if ( hvm_save_entry(HEADER, 0, h, &hdr) != 0 )
     {
-        gdprintk(XENLOG_ERR, "HVM save: failed to write header\n");
+        printk(XENLOG_G_ERR "HVM%d save: failed to write header\n",
+               d->domain_id);
         return -EFAULT;
     } 
 
@@ -159,11 +160,13 @@
         handler = hvm_sr_handlers[i].save;
         if ( handler != NULL ) 
         {
-            gdprintk(XENLOG_INFO, "HVM save: %s\n",  hvm_sr_handlers[i].name);
+            printk(XENLOG_G_INFO "HVM%d save: %s\n",
+                   d->domain_id, hvm_sr_handlers[i].name);
             if ( handler(d, h) != 0 ) 
             {
-                gdprintk(XENLOG_ERR, 
-                         "HVM save: failed to save type %"PRIu16"\n", i);
+                printk(XENLOG_G_ERR
+                       "HVM%d save: failed to save type %"PRIu16"\n",
+                       d->domain_id, i);
                 return -EFAULT;
             } 
         }
@@ -173,7 +176,8 @@
     if ( hvm_save_entry(END, 0, h, &end) != 0 )
     {
         /* Run out of data */
-        gdprintk(XENLOG_ERR, "HVM save: no room for end marker.\n");
+        printk(XENLOG_G_ERR "HVM%d save: no room for end marker\n",
+               d->domain_id);
         return -EFAULT;
     }
 
@@ -209,8 +213,9 @@
         if ( h->size - h->cur < sizeof(struct hvm_save_descriptor) )
         {
             /* Run out of data */
-            gdprintk(XENLOG_ERR, 
-                     "HVM restore: save did not end with a null entry\n");
+            printk(XENLOG_G_ERR
+                   "HVM%d restore: save did not end with a null entry\n",
+                   d->domain_id);
             return -1;
         }
         
@@ -223,20 +228,18 @@
         if ( (desc->typecode > HVM_SAVE_CODE_MAX) ||
              ((handler = hvm_sr_handlers[desc->typecode].load) == NULL) )
         {
-            gdprintk(XENLOG_ERR, 
-                     "HVM restore: unknown entry typecode %u\n", 
-                     desc->typecode);
+            printk(XENLOG_G_ERR "HVM%d restore: unknown entry typecode %u\n",
+                   d->domain_id, desc->typecode);
             return -1;
         }
 
         /* Load the entry */
-        gdprintk(XENLOG_INFO, "HVM restore: %s %"PRIu16"\n",  
-                 hvm_sr_handlers[desc->typecode].name, desc->instance);
+        printk(XENLOG_G_INFO "HVM%d restore: %s %"PRIu16"\n", d->domain_id,
+               hvm_sr_handlers[desc->typecode].name, desc->instance);
         if ( handler(d, h) != 0 ) 
         {
-            gdprintk(XENLOG_ERR, 
-                     "HVM restore: failed to load entry %u/%u\n", 
-                     desc->typecode, desc->instance);
+            printk(XENLOG_G_ERR "HVM%d restore: failed to load entry %u/%u\n",
+                   d->domain_id, desc->typecode, desc->instance);
             return -1;
         }
     }
@@ -251,10 +254,9 @@
         = (struct hvm_save_descriptor *)&h->data[h->cur];
     if ( h->size - h->cur < len + sizeof (*d) )
     {
-        gdprintk(XENLOG_WARNING,
-                 "HVM save: no room for %"PRIu32" + %u bytes "
-                 "for typecode %"PRIu16"\n",
-                 len, (unsigned) sizeof (*d), tc);
+        printk(XENLOG_G_WARNING "HVM save: no room for"
+               " %"PRIu32" + %zu bytes for typecode %"PRIu16"\n",
+               len, sizeof(*d), tc);
         return -1;
     }
     d->typecode = tc;
@@ -278,17 +280,17 @@
         = (struct hvm_save_descriptor *)&h->data[h->cur];
     if ( len + sizeof (*d) > h->size - h->cur)
     {
-        gdprintk(XENLOG_WARNING, 
-                 "HVM restore: not enough data left to read %u bytes "
-                 "for type %u\n", len, type);
+        printk(XENLOG_G_WARNING
+               "HVM restore: not enough data left to read %u bytes "
+               "for type %u\n", len, type);
         return -1;
     }    
     if ( (type != d->typecode) || (len < d->length) ||
          (strict_length && (len != d->length)) )
     {
-        gdprintk(XENLOG_WARNING, 
-                 "HVM restore mismatch: expected type %u length %u, "
-                 "saw type %u length %u\n", type, len, d->typecode, d->length);
+        printk(XENLOG_G_WARNING
+               "HVM restore mismatch: expected type %u length %u, "
+               "saw type %u length %u\n", type, len, d->typecode, d->length);
         return -1;
     }
     h->cur += sizeof(*d);
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/common/sysctl.c
--- a/xen/common/sysctl.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/common/sysctl.c	Thu Feb 16 08:48:23 2012 +0100
@@ -301,8 +301,6 @@
                     ret = query_page_offline(pfn, ptr++);
                     break;
                 default:
-                    gdprintk(XENLOG_WARNING, "invalid page offline op %x\n",
-                            op->u.page_offline.cmd);
                     ret = -EINVAL;
                     break;
             }
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/common/xenoprof.c
--- a/xen/common/xenoprof.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/common/xenoprof.c	Thu Feb 16 08:48:23 2012 +0100
@@ -144,8 +144,8 @@
         struct page_info *page = mfn_to_page(mfn + i);
         if ( (page->count_info & (PGC_allocated|PGC_count_mask)) != 0 )
         {
-            gdprintk(XENLOG_INFO, "mfn 0x%lx page->count_info 0x%lx\n",
-                     mfn + i, (unsigned long)page->count_info);
+            printk(XENLOG_G_INFO "dom%d mfn %#lx page->count_info %#lx\n",
+                   d->domain_id, mfn + i, page->count_info);
             return -EBUSY;
         }
         page_set_owner(page, NULL);
diff -r fe427d3bb378 -r 01c1bcbc6222 xen/drivers/passthrough/iommu.c
--- a/xen/drivers/passthrough/iommu.c	Wed Feb 15 12:24:21 2012 +0000
+++ b/xen/drivers/passthrough/iommu.c	Thu Feb 16 08:48:23 2012 +0100
@@ -566,9 +566,9 @@
 
         if ( device_assigned(seg, bus, devfn) )
         {
-            gdprintk(XENLOG_ERR, "XEN_DOMCTL_test_assign_device: "
-                     "%04x:%02x:%02x.%u already assigned, or non-existent\n",
-                     seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(XENLOG_G_INFO
+                   "%04x:%02x:%02x.%u already assigned, or non-existent\n",
+                   seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
             ret = -EINVAL;
         }
         break;
@@ -576,8 +576,8 @@
     case XEN_DOMCTL_assign_device:
         if ( unlikely((d = get_domain_by_id(domctl->domain)) == NULL) )
         {
-            gdprintk(XENLOG_ERR,
-                "XEN_DOMCTL_assign_device: get_domain_by_id() failed\n");
+            printk(XENLOG_G_ERR
+                   "XEN_DOMCTL_assign_device: get_domain_by_id() failed\n");
             ret = -EINVAL;
             break;
         }
@@ -593,9 +593,9 @@
 #ifdef __ia64__ /* XXX Is this really needed? */
         if ( device_assigned(seg, bus, devfn) )
         {
-            gdprintk(XENLOG_ERR, "XEN_DOMCTL_assign_device: "
-                     "%x:%x.%x already assigned, or non-existent\n",
-                     bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(XENLOG_G_ERR "XEN_DOMCTL_assign_device: "
+                   "%04x:%02x:%02x.%u already assigned, or non-existent\n",
+                   seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
             ret = -EINVAL;
             goto assign_device_out;
         }
@@ -603,9 +603,10 @@
 
         ret = assign_device(d, seg, bus, devfn);
         if ( ret )
-            gdprintk(XENLOG_ERR, "XEN_DOMCTL_assign_device: "
-                     "assign device (%04x:%02x:%02x.%u) failed\n",
-                     seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(XENLOG_G_ERR "XEN_DOMCTL_assign_device: "
+                   "assign %04x:%02x:%02x.%u to dom%d failed (%d)\n",
+                   seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                   d->domain_id, ret);
 
     assign_device_out:
         put_domain(d);
@@ -614,8 +615,8 @@
     case XEN_DOMCTL_deassign_device:
         if ( unlikely((d = get_domain_by_id(domctl->domain)) == NULL) )
         {
-            gdprintk(XENLOG_ERR,
-                "XEN_DOMCTL_deassign_device: get_domain_by_id() failed\n");
+            printk(XENLOG_G_ERR
+                   "XEN_DOMCTL_deassign_device: get_domain_by_id() failed\n");
             ret = -EINVAL;
             break;
         }
@@ -640,9 +641,10 @@
         ret = deassign_device(d, seg, bus, devfn);
         spin_unlock(&pcidevs_lock);
         if ( ret )
-            gdprintk(XENLOG_ERR, "XEN_DOMCTL_deassign_device: "
-                     "deassign device (%04x:%02x:%02x.%u) failed\n",
-                     seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(XENLOG_G_ERR
+                   "deassign %04x:%02x:%02x.%u from dom%d failed (%d)\n",
+                   seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                   d->domain_id, ret);
 
     deassign_device_out:
         put_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 Feb 17 00:55:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2012 00:55:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RyC6V-0003dU-Ld; Fri, 17 Feb 2012 00:55:15 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6U-0003dN-Bm
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1329440060!54604654!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29901 invoked from network); 17 Feb 2012 00:54:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Feb 2012 00:54:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6R-0003Oj-H4
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6Q-0002Oc-WE
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:11 +0000
Message-Id: <E1RyC6Q-0002Oc-WE@xenbits.xen.org>
Date: Fri, 17 Feb 2012 00:55:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Make asserts on types and
	counts of shared pages more accurate
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329406979 0
# Node ID 202db6f0907d06887d7bb7bbb708083f956bdce3
# Parent  01c1bcbc62224833304ede44187400f65e8a6b4c
x86/mm: Make asserts on types and counts of shared pages more accurate

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


diff -r 01c1bcbc6222 -r 202db6f0907d xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Thu Feb 16 08:48:23 2012 +0100
+++ b/xen/arch/x86/mm/mem_sharing.c	Thu Feb 16 15:42:59 2012 +0000
@@ -201,7 +201,9 @@
             /* Count has to be at least two, because we're called
              * with the mfn locked (1) and this is supposed to be 
              * a shared page (1). */
-            ASSERT((page->u.inuse.type_info & PGT_count_mask) >= 2); 
+            unsigned long t = read_atomic(&page->u.inuse.type_info);
+            ASSERT((t & PGT_type_mask) == PGT_shared_page);
+            ASSERT((t & PGT_count_mask) >= 2);
             ASSERT(get_gpfn_from_mfn(mfn) == SHARED_M2P_ENTRY); 
             return page;
         }
diff -r 01c1bcbc6222 -r 202db6f0907d xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Thu Feb 16 08:48:23 2012 +0100
+++ b/xen/arch/x86/mm/p2m.c	Thu Feb 16 15:42:59 2012 +0000
@@ -735,6 +735,7 @@
     p2m_access_t a;
     p2m_type_t ot;
     mfn_t omfn;
+    unsigned long pg_type;
 
     if ( !paging_mode_translate(p2m->domain) )
         return 0;
@@ -745,8 +746,11 @@
      * sharable first */
     ASSERT(p2m_is_shared(ot));
     ASSERT(mfn_valid(omfn));
-    if ( ((mfn_to_page(omfn)->u.inuse.type_info & PGT_type_mask) 
-                    != PGT_shared_page) )
+    /* Set the m2p entry to invalid only if there are no further type
+     * refs to this page as shared */
+    pg_type = read_atomic(&(mfn_to_page(omfn)->u.inuse.type_info));
+    if ( (pg_type & PGT_count_mask) == 0
+         || (pg_type & PGT_type_mask) != PGT_shared_page )
         set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY);
 
     P2M_DEBUG("set shared %lx %lx\n", gfn, mfn_x(mfn));

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 17 00:55:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2012 00:55:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RyC6V-0003dU-Ld; Fri, 17 Feb 2012 00:55:15 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6U-0003dN-Bm
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1329440060!54604654!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29901 invoked from network); 17 Feb 2012 00:54:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Feb 2012 00:54:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6R-0003Oj-H4
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6Q-0002Oc-WE
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:11 +0000
Message-Id: <E1RyC6Q-0002Oc-WE@xenbits.xen.org>
Date: Fri, 17 Feb 2012 00:55:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Make asserts on types and
	counts of shared pages more accurate
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329406979 0
# Node ID 202db6f0907d06887d7bb7bbb708083f956bdce3
# Parent  01c1bcbc62224833304ede44187400f65e8a6b4c
x86/mm: Make asserts on types and counts of shared pages more accurate

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


diff -r 01c1bcbc6222 -r 202db6f0907d xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Thu Feb 16 08:48:23 2012 +0100
+++ b/xen/arch/x86/mm/mem_sharing.c	Thu Feb 16 15:42:59 2012 +0000
@@ -201,7 +201,9 @@
             /* Count has to be at least two, because we're called
              * with the mfn locked (1) and this is supposed to be 
              * a shared page (1). */
-            ASSERT((page->u.inuse.type_info & PGT_count_mask) >= 2); 
+            unsigned long t = read_atomic(&page->u.inuse.type_info);
+            ASSERT((t & PGT_type_mask) == PGT_shared_page);
+            ASSERT((t & PGT_count_mask) >= 2);
             ASSERT(get_gpfn_from_mfn(mfn) == SHARED_M2P_ENTRY); 
             return page;
         }
diff -r 01c1bcbc6222 -r 202db6f0907d xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Thu Feb 16 08:48:23 2012 +0100
+++ b/xen/arch/x86/mm/p2m.c	Thu Feb 16 15:42:59 2012 +0000
@@ -735,6 +735,7 @@
     p2m_access_t a;
     p2m_type_t ot;
     mfn_t omfn;
+    unsigned long pg_type;
 
     if ( !paging_mode_translate(p2m->domain) )
         return 0;
@@ -745,8 +746,11 @@
      * sharable first */
     ASSERT(p2m_is_shared(ot));
     ASSERT(mfn_valid(omfn));
-    if ( ((mfn_to_page(omfn)->u.inuse.type_info & PGT_type_mask) 
-                    != PGT_shared_page) )
+    /* Set the m2p entry to invalid only if there are no further type
+     * refs to this page as shared */
+    pg_type = read_atomic(&(mfn_to_page(omfn)->u.inuse.type_info));
+    if ( (pg_type & PGT_count_mask) == 0
+         || (pg_type & PGT_type_mask) != PGT_shared_page )
         set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY);
 
     P2M_DEBUG("set shared %lx %lx\n", gfn, mfn_x(mfn));

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 17 00:55:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2012 00:55:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RyC6X-0003do-OC; Fri, 17 Feb 2012 00:55:17 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6W-0003dZ-M8
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:16 +0000
Received: from [85.158.139.83:33439] by server-5.bemta-5.messagelabs.com id
	D0/C4-13566-375AD3F4; Fri, 17 Feb 2012 00:55:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-182.messagelabs.com!1329440114!14570212!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14298 invoked from network); 17 Feb 2012 00:55:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Feb 2012 00:55:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6U-0003Os-0z
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6T-0002QI-VS
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:13 +0000
Message-Id: <E1RyC6T-0002QI-VS@xenbits.xen.org>
Date: Fri, 17 Feb 2012 00:55:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Fix two PAE+paging bugs
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329406982 0
# Node ID b75664e5390583c5d2075c82a14245bc941b3aaf
# Parent  de4206b6546c96ee890df144326658cb964b534e
x86/mm: Fix two PAE+paging bugs

In hap_paging_update_modes, we were getting the gpa of the cr3, rather
than the gfn.

Vmx_load_pdptrs was crashing the host if the cr3 is paged out. Now it
will only crash the guest.

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


diff -r de4206b6546c -r b75664e53905 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c	Thu Feb 16 15:43:02 2012 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c	Thu Feb 16 15:43:02 2012 +0000
@@ -1010,12 +1010,22 @@
     if ( (cr3 & 0x1fUL) && !hvm_pcid_enabled(v) )
         goto crash;
 
-    mfn = mfn_x(get_gfn(v->domain, cr3 >> PAGE_SHIFT, &p2mt));
-    if ( !p2m_is_ram(p2mt) )
+    mfn = mfn_x(get_gfn_unshare(v->domain, cr3 >> PAGE_SHIFT, &p2mt));
+    if ( !p2m_is_ram(p2mt) || !mfn_valid(mfn) || 
+         /* If we didn't succeed in unsharing, get_page will fail
+          * (page still belongs to dom_cow) */
+         !get_page(mfn_to_page(mfn), v->domain) )
     {
+        /* Ideally you don't want to crash but rather go into a wait 
+         * queue, but this is the wrong place. We're holding at least
+         * the paging lock */
+        gdprintk(XENLOG_ERR,
+                 "Bad cr3 on load pdptrs gfn %lx mfn %lx type %d\n",
+                 cr3 >> PAGE_SHIFT, mfn, (int) p2mt);
         put_gfn(v->domain, cr3 >> PAGE_SHIFT);
         goto crash;
     }
+    put_gfn(v->domain, cr3 >> PAGE_SHIFT);
 
     p = map_domain_page(mfn);
 
@@ -1043,7 +1053,7 @@
     vmx_vmcs_exit(v);
 
     unmap_domain_page(p);
-    put_gfn(v->domain, cr3 >> PAGE_SHIFT);
+    put_page(mfn_to_page(mfn));
     return;
 
  crash:
diff -r de4206b6546c -r b75664e53905 xen/arch/x86/mm/hap/hap.c
--- a/xen/arch/x86/mm/hap/hap.c	Thu Feb 16 15:43:02 2012 +0000
+++ b/xen/arch/x86/mm/hap/hap.c	Thu Feb 16 15:43:02 2012 +0000
@@ -786,7 +786,7 @@
 static void hap_update_paging_modes(struct vcpu *v)
 {
     struct domain *d = v->domain;
-    unsigned long cr3_gfn = v->arch.hvm_vcpu.guest_cr[3];
+    unsigned long cr3_gfn = v->arch.hvm_vcpu.guest_cr[3] >> PAGE_SHIFT;
     p2m_type_t t;
 
     /* We hold onto the cr3 as it may be modified later, and

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 17 00:55:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2012 00:55:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RyC6X-0003do-OC; Fri, 17 Feb 2012 00:55:17 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6W-0003dZ-M8
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:16 +0000
Received: from [85.158.139.83:33439] by server-5.bemta-5.messagelabs.com id
	D0/C4-13566-375AD3F4; Fri, 17 Feb 2012 00:55:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-182.messagelabs.com!1329440114!14570212!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14298 invoked from network); 17 Feb 2012 00:55:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Feb 2012 00:55:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6U-0003Os-0z
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6T-0002QI-VS
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:13 +0000
Message-Id: <E1RyC6T-0002QI-VS@xenbits.xen.org>
Date: Fri, 17 Feb 2012 00:55:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Fix two PAE+paging bugs
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329406982 0
# Node ID b75664e5390583c5d2075c82a14245bc941b3aaf
# Parent  de4206b6546c96ee890df144326658cb964b534e
x86/mm: Fix two PAE+paging bugs

In hap_paging_update_modes, we were getting the gpa of the cr3, rather
than the gfn.

Vmx_load_pdptrs was crashing the host if the cr3 is paged out. Now it
will only crash the guest.

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


diff -r de4206b6546c -r b75664e53905 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c	Thu Feb 16 15:43:02 2012 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c	Thu Feb 16 15:43:02 2012 +0000
@@ -1010,12 +1010,22 @@
     if ( (cr3 & 0x1fUL) && !hvm_pcid_enabled(v) )
         goto crash;
 
-    mfn = mfn_x(get_gfn(v->domain, cr3 >> PAGE_SHIFT, &p2mt));
-    if ( !p2m_is_ram(p2mt) )
+    mfn = mfn_x(get_gfn_unshare(v->domain, cr3 >> PAGE_SHIFT, &p2mt));
+    if ( !p2m_is_ram(p2mt) || !mfn_valid(mfn) || 
+         /* If we didn't succeed in unsharing, get_page will fail
+          * (page still belongs to dom_cow) */
+         !get_page(mfn_to_page(mfn), v->domain) )
     {
+        /* Ideally you don't want to crash but rather go into a wait 
+         * queue, but this is the wrong place. We're holding at least
+         * the paging lock */
+        gdprintk(XENLOG_ERR,
+                 "Bad cr3 on load pdptrs gfn %lx mfn %lx type %d\n",
+                 cr3 >> PAGE_SHIFT, mfn, (int) p2mt);
         put_gfn(v->domain, cr3 >> PAGE_SHIFT);
         goto crash;
     }
+    put_gfn(v->domain, cr3 >> PAGE_SHIFT);
 
     p = map_domain_page(mfn);
 
@@ -1043,7 +1053,7 @@
     vmx_vmcs_exit(v);
 
     unmap_domain_page(p);
-    put_gfn(v->domain, cr3 >> PAGE_SHIFT);
+    put_page(mfn_to_page(mfn));
     return;
 
  crash:
diff -r de4206b6546c -r b75664e53905 xen/arch/x86/mm/hap/hap.c
--- a/xen/arch/x86/mm/hap/hap.c	Thu Feb 16 15:43:02 2012 +0000
+++ b/xen/arch/x86/mm/hap/hap.c	Thu Feb 16 15:43:02 2012 +0000
@@ -786,7 +786,7 @@
 static void hap_update_paging_modes(struct vcpu *v)
 {
     struct domain *d = v->domain;
-    unsigned long cr3_gfn = v->arch.hvm_vcpu.guest_cr[3];
+    unsigned long cr3_gfn = v->arch.hvm_vcpu.guest_cr[3] >> PAGE_SHIFT;
     p2m_type_t t;
 
     /* We hold onto the cr3 as it may be modified later, and

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 17 00:55:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2012 00:55:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RyC6Y-0003e2-Sj; Fri, 17 Feb 2012 00:55:18 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6X-0003dc-0Q
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:17 +0000
Received: from [85.158.139.83:19155] by server-7.bemta-5.messagelabs.com id
	5B/2E-16195-475AD3F4; Fri, 17 Feb 2012 00:55:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-182.messagelabs.com!1329440112!15345572!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5862 invoked from network); 17 Feb 2012 00:55:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Feb 2012 00:55:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6S-0003Om-Go
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6S-0002PF-27
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:12 +0000
Message-Id: <E1RyC6S-0002PF-27@xenbits.xen.org>
Date: Fri, 17 Feb 2012 00:55:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Fix more ballooning+paging
	and ballooning+sharing bugs
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329406982 0
# Node ID 5a9c571ee39663929d1fe6d57326a40a46753ca2
# Parent  202db6f0907d06887d7bb7bbb708083f956bdce3
x86/mm: Fix more ballooning+paging and ballooning+sharing bugs

If the guest balloons away a page that has been nominated for paging but
not yet paged out, we fix:
 - Send EVICT_FAIL flag in the event to the pager
 - Do not leak the underlying page

If the page was shared, we were not:
 - properly refreshing the mfn to balloon after the unshare.
 - unlocking the p2m on the error exit case

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 202db6f0907d -r 5a9c571ee396 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Thu Feb 16 15:42:59 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Thu Feb 16 15:43:02 2012 +0000
@@ -929,11 +929,14 @@
     req.gfn = gfn;
     req.flags = MEM_EVENT_FLAG_DROP_PAGE;
 
-    mem_event_put_request(d, &d->mem_event->paging, &req);
-
     /* Update stats unless the page hasn't yet been evicted */
     if ( p2mt != p2m_ram_paging_out )
         atomic_dec(&d->paged_pages);
+    else
+        /* Evict will fail now, tag this request for pager */
+        req.flags |= MEM_EVENT_FLAG_EVICT_FAIL;
+
+    mem_event_put_request(d, &d->mem_event->paging, &req);
 }
 
 /**
diff -r 202db6f0907d -r 5a9c571ee396 xen/common/memory.c
--- a/xen/common/memory.c	Thu Feb 16 15:42:59 2012 +0000
+++ b/xen/common/memory.c	Thu Feb 16 15:43:02 2012 +0000
@@ -167,6 +167,15 @@
     {
         guest_physmap_remove_page(d, gmfn, mfn, 0);
         put_gfn(d, gmfn);
+        /* If the page hasn't yet been paged out, there is an
+         * actual page that needs to be released. */
+        if ( p2mt == p2m_ram_paging_out )
+        {
+            ASSERT(mfn_valid(mfn));
+            page = mfn_to_page(mfn);
+            if ( test_and_clear_bit(_PGC_allocated, &page->count_info) )
+                put_page(page);
+        }
         p2m_mem_paging_drop_page(d, gmfn, p2mt);
         return 1;
     }
@@ -181,7 +190,6 @@
         return 0;
     }
             
-    page = mfn_to_page(mfn);
 #ifdef CONFIG_X86_64
     if ( p2m_is_shared(p2mt) )
     {
@@ -190,10 +198,17 @@
          * need to trigger proper cleanup. Once done, this is 
          * like any other page. */
         if ( mem_sharing_unshare_page(d, gmfn, 0) )
+        {
+            put_gfn(d, gmfn);
             return 0;
+        }
+        /* Maybe the mfn changed */
+        mfn = mfn_x(get_gfn_query_unlocked(d, gmfn, &p2mt));
+        ASSERT(!p2m_is_shared(p2mt));
     }
 #endif /* CONFIG_X86_64 */
 
+    page = mfn_to_page(mfn);
     if ( unlikely(!get_page(page, d)) )
     {
         put_gfn(d, gmfn);

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 17 00:55:24 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2012 00:55:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RyC6Y-0003e2-Sj; Fri, 17 Feb 2012 00:55:18 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6X-0003dc-0Q
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:17 +0000
Received: from [85.158.139.83:19155] by server-7.bemta-5.messagelabs.com id
	5B/2E-16195-475AD3F4; Fri, 17 Feb 2012 00:55:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-182.messagelabs.com!1329440112!15345572!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5862 invoked from network); 17 Feb 2012 00:55:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Feb 2012 00:55:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6S-0003Om-Go
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6S-0002PF-27
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:12 +0000
Message-Id: <E1RyC6S-0002PF-27@xenbits.xen.org>
Date: Fri, 17 Feb 2012 00:55:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Fix more ballooning+paging
	and ballooning+sharing bugs
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329406982 0
# Node ID 5a9c571ee39663929d1fe6d57326a40a46753ca2
# Parent  202db6f0907d06887d7bb7bbb708083f956bdce3
x86/mm: Fix more ballooning+paging and ballooning+sharing bugs

If the guest balloons away a page that has been nominated for paging but
not yet paged out, we fix:
 - Send EVICT_FAIL flag in the event to the pager
 - Do not leak the underlying page

If the page was shared, we were not:
 - properly refreshing the mfn to balloon after the unshare.
 - unlocking the p2m on the error exit case

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 202db6f0907d -r 5a9c571ee396 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Thu Feb 16 15:42:59 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Thu Feb 16 15:43:02 2012 +0000
@@ -929,11 +929,14 @@
     req.gfn = gfn;
     req.flags = MEM_EVENT_FLAG_DROP_PAGE;
 
-    mem_event_put_request(d, &d->mem_event->paging, &req);
-
     /* Update stats unless the page hasn't yet been evicted */
     if ( p2mt != p2m_ram_paging_out )
         atomic_dec(&d->paged_pages);
+    else
+        /* Evict will fail now, tag this request for pager */
+        req.flags |= MEM_EVENT_FLAG_EVICT_FAIL;
+
+    mem_event_put_request(d, &d->mem_event->paging, &req);
 }
 
 /**
diff -r 202db6f0907d -r 5a9c571ee396 xen/common/memory.c
--- a/xen/common/memory.c	Thu Feb 16 15:42:59 2012 +0000
+++ b/xen/common/memory.c	Thu Feb 16 15:43:02 2012 +0000
@@ -167,6 +167,15 @@
     {
         guest_physmap_remove_page(d, gmfn, mfn, 0);
         put_gfn(d, gmfn);
+        /* If the page hasn't yet been paged out, there is an
+         * actual page that needs to be released. */
+        if ( p2mt == p2m_ram_paging_out )
+        {
+            ASSERT(mfn_valid(mfn));
+            page = mfn_to_page(mfn);
+            if ( test_and_clear_bit(_PGC_allocated, &page->count_info) )
+                put_page(page);
+        }
         p2m_mem_paging_drop_page(d, gmfn, p2mt);
         return 1;
     }
@@ -181,7 +190,6 @@
         return 0;
     }
             
-    page = mfn_to_page(mfn);
 #ifdef CONFIG_X86_64
     if ( p2m_is_shared(p2mt) )
     {
@@ -190,10 +198,17 @@
          * need to trigger proper cleanup. Once done, this is 
          * like any other page. */
         if ( mem_sharing_unshare_page(d, gmfn, 0) )
+        {
+            put_gfn(d, gmfn);
             return 0;
+        }
+        /* Maybe the mfn changed */
+        mfn = mfn_x(get_gfn_query_unlocked(d, gmfn, &p2mt));
+        ASSERT(!p2m_is_shared(p2mt));
     }
 #endif /* CONFIG_X86_64 */
 
+    page = mfn_to_page(mfn);
     if ( unlikely(!get_page(page, d)) )
     {
         put_gfn(d, gmfn);

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 17 00:55:26 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2012 00:55:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RyC6c-0003eo-Vn; Fri, 17 Feb 2012 00:55:22 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6a-0003dT-Vo
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-21.messagelabs.com!1329440113!5416929!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30410 invoked from network); 17 Feb 2012 00:55:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Feb 2012 00:55:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6T-0003Op-6w
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6T-0002Pl-4l
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:13 +0000
Message-Id: <E1RyC6T-0002Pl-4l@xenbits.xen.org>
Date: Fri, 17 Feb 2012 00:55:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Check sharing/paging/access
	have been enabled before processing a memop
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329406982 0
# Node ID de4206b6546c96ee890df144326658cb964b534e
# Parent  5a9c571ee39663929d1fe6d57326a40a46753ca2
x86/mm: Check sharing/paging/access have been enabled before processing a memop

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 5a9c571ee396 -r de4206b6546c xen/arch/x86/mm/mem_access.c
--- a/xen/arch/x86/mm/mem_access.c	Thu Feb 16 15:43:02 2012 +0000
+++ b/xen/arch/x86/mm/mem_access.c	Thu Feb 16 15:43:02 2012 +0000
@@ -29,6 +29,9 @@
 {
     int rc;
 
+    if ( unlikely(!d->mem_event->access.ring_page) )
+        return -ENODEV;
+
     switch( meo->op )
     {
     case XENMEM_access_op_resume:
diff -r 5a9c571ee396 -r de4206b6546c xen/arch/x86/mm/mem_event.c
--- a/xen/arch/x86/mm/mem_event.c	Thu Feb 16 15:43:02 2012 +0000
+++ b/xen/arch/x86/mm/mem_event.c	Thu Feb 16 15:43:02 2012 +0000
@@ -452,13 +452,15 @@
 /* Registered with Xen-bound event channel for incoming notifications. */
 static void mem_paging_notification(struct vcpu *v, unsigned int port)
 {
-    p2m_mem_paging_resume(v->domain);
+    if ( likely(v->domain->mem_event->paging.ring_page != NULL) )
+        p2m_mem_paging_resume(v->domain);
 }
 
 /* Registered with Xen-bound event channel for incoming notifications. */
 static void mem_access_notification(struct vcpu *v, unsigned int port)
 {
-    p2m_mem_access_resume(v->domain);
+    if ( likely(v->domain->mem_event->access.ring_page != NULL) )
+        p2m_mem_access_resume(v->domain);
 }
 
 struct domain *get_mem_event_op_target(uint32_t domain, int *rc)
diff -r 5a9c571ee396 -r de4206b6546c xen/arch/x86/mm/mem_paging.c
--- a/xen/arch/x86/mm/mem_paging.c	Thu Feb 16 15:43:02 2012 +0000
+++ b/xen/arch/x86/mm/mem_paging.c	Thu Feb 16 15:43:02 2012 +0000
@@ -27,6 +27,9 @@
 
 int mem_paging_memop(struct domain *d, xen_mem_event_op_t *mec)
 {
+    if ( unlikely(!d->mem_event->paging.ring_page) )
+        return -ENODEV;
+
     switch( mec->op )
     {
     case XENMEM_paging_op_nominate:
diff -r 5a9c571ee396 -r de4206b6546c xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Thu Feb 16 15:43:02 2012 +0000
+++ b/xen/arch/x86/mm/mem_sharing.c	Thu Feb 16 15:43:02 2012 +0000
@@ -1022,7 +1022,7 @@
     int rc = 0;
 
     /* Only HAP is supported */
-    if ( !hap_enabled(d) )
+    if ( !hap_enabled(d) || !d->arch.hvm_domain.mem_sharing_enabled )
          return -ENODEV;
 
     switch(mec->op)

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 17 00:55:26 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2012 00:55:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RyC6c-0003eo-Vn; Fri, 17 Feb 2012 00:55:22 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6a-0003dT-Vo
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-21.messagelabs.com!1329440113!5416929!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30410 invoked from network); 17 Feb 2012 00:55:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Feb 2012 00:55:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6T-0003Op-6w
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyC6T-0002Pl-4l
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 00:55:13 +0000
Message-Id: <E1RyC6T-0002Pl-4l@xenbits.xen.org>
Date: Fri, 17 Feb 2012 00:55:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Check sharing/paging/access
	have been enabled before processing a memop
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329406982 0
# Node ID de4206b6546c96ee890df144326658cb964b534e
# Parent  5a9c571ee39663929d1fe6d57326a40a46753ca2
x86/mm: Check sharing/paging/access have been enabled before processing a memop

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 5a9c571ee396 -r de4206b6546c xen/arch/x86/mm/mem_access.c
--- a/xen/arch/x86/mm/mem_access.c	Thu Feb 16 15:43:02 2012 +0000
+++ b/xen/arch/x86/mm/mem_access.c	Thu Feb 16 15:43:02 2012 +0000
@@ -29,6 +29,9 @@
 {
     int rc;
 
+    if ( unlikely(!d->mem_event->access.ring_page) )
+        return -ENODEV;
+
     switch( meo->op )
     {
     case XENMEM_access_op_resume:
diff -r 5a9c571ee396 -r de4206b6546c xen/arch/x86/mm/mem_event.c
--- a/xen/arch/x86/mm/mem_event.c	Thu Feb 16 15:43:02 2012 +0000
+++ b/xen/arch/x86/mm/mem_event.c	Thu Feb 16 15:43:02 2012 +0000
@@ -452,13 +452,15 @@
 /* Registered with Xen-bound event channel for incoming notifications. */
 static void mem_paging_notification(struct vcpu *v, unsigned int port)
 {
-    p2m_mem_paging_resume(v->domain);
+    if ( likely(v->domain->mem_event->paging.ring_page != NULL) )
+        p2m_mem_paging_resume(v->domain);
 }
 
 /* Registered with Xen-bound event channel for incoming notifications. */
 static void mem_access_notification(struct vcpu *v, unsigned int port)
 {
-    p2m_mem_access_resume(v->domain);
+    if ( likely(v->domain->mem_event->access.ring_page != NULL) )
+        p2m_mem_access_resume(v->domain);
 }
 
 struct domain *get_mem_event_op_target(uint32_t domain, int *rc)
diff -r 5a9c571ee396 -r de4206b6546c xen/arch/x86/mm/mem_paging.c
--- a/xen/arch/x86/mm/mem_paging.c	Thu Feb 16 15:43:02 2012 +0000
+++ b/xen/arch/x86/mm/mem_paging.c	Thu Feb 16 15:43:02 2012 +0000
@@ -27,6 +27,9 @@
 
 int mem_paging_memop(struct domain *d, xen_mem_event_op_t *mec)
 {
+    if ( unlikely(!d->mem_event->paging.ring_page) )
+        return -ENODEV;
+
     switch( mec->op )
     {
     case XENMEM_paging_op_nominate:
diff -r 5a9c571ee396 -r de4206b6546c xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Thu Feb 16 15:43:02 2012 +0000
+++ b/xen/arch/x86/mm/mem_sharing.c	Thu Feb 16 15:43:02 2012 +0000
@@ -1022,7 +1022,7 @@
     int rc = 0;
 
     /* Only HAP is supported */
-    if ( !hap_enabled(d) )
+    if ( !hap_enabled(d) || !d->arch.hvm_domain.mem_sharing_enabled )
          return -ENODEV;
 
     switch(mec->op)

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 17 16:55:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2012 16:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RyR5Z-0006A6-MH; Fri, 17 Feb 2012 16:55:17 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyR5Y-00069w-F5
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 16:55:16 +0000
Received: from [85.158.139.83:28832] by server-11.bemta-5.messagelabs.com id
	D1/E6-14397-3768E3F4; Fri, 17 Feb 2012 16:55:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-182.messagelabs.com!1329497713!15476397!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21282 invoked from network); 17 Feb 2012 16:55:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Feb 2012 16:55:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyR5V-0007Ho-35
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 16:55:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyR5U-0006o1-D1
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 16:55:12 +0000
Message-Id: <E1RyR5U-0006o1-D1@xenbits.xen.org>
Date: Fri, 17 Feb 2012 16:55:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Make sure the event channel
	is released accurately
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Kaixing Hong <hongkaixing@huawei.com>
# Date 1329462865 -28800
# Node ID b5ac7d99d93f061977467c0a383b993b3e5e6507
# Parent  b75664e5390583c5d2075c82a14245bc941b3aaf
x86/mm: Make sure the event channel is released accurately

    In xenpaging source code,there is an interdomain communication between dom0
and domU. In mem_event_enable(),the function alloc_unbound_xen_event_channel()
allocates a free port for domU, and then it will be bound with dom0.
When xenpaging tears down,it just frees dom0's event channel port by
xc_evtchn_unbind(), leaves domU's port still occupied.
    So we add the patch to free domU's port when xenpaging exits.
We need double free interdomain eventchannel. First free domainU port,
and leave domain 0 port unbond, Then free domain 0 port.

Signed-off-by: Kaixing Hong <hongkaixing@huawei.com>,
Signed-off-by: Zhen Shi <bicky.shi@huawei.com>
Acked-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r b75664e53905 -r b5ac7d99d93f xen/arch/x86/mm/mem_event.c
--- a/xen/arch/x86/mm/mem_event.c	Thu Feb 16 15:43:02 2012 +0000
+++ b/xen/arch/x86/mm/mem_event.c	Fri Feb 17 15:14:25 2012 +0800
@@ -243,6 +243,9 @@
             return -EBUSY;
         }
 
+        /* Free domU's event channel and leave the other one unbound */
+        free_xen_event_channel(d->vcpu[0], med->xen_port);
+        
         unmap_domain_page(med->ring_page);
         med->ring_page = NULL;
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 17 16:55:23 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2012 16:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RyR5Z-0006A6-MH; Fri, 17 Feb 2012 16:55:17 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyR5Y-00069w-F5
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 16:55:16 +0000
Received: from [85.158.139.83:28832] by server-11.bemta-5.messagelabs.com id
	D1/E6-14397-3768E3F4; Fri, 17 Feb 2012 16:55:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-182.messagelabs.com!1329497713!15476397!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21282 invoked from network); 17 Feb 2012 16:55:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Feb 2012 16:55:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyR5V-0007Ho-35
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 16:55:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyR5U-0006o1-D1
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 16:55:12 +0000
Message-Id: <E1RyR5U-0006o1-D1@xenbits.xen.org>
Date: Fri, 17 Feb 2012 16:55:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Make sure the event channel
	is released accurately
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Kaixing Hong <hongkaixing@huawei.com>
# Date 1329462865 -28800
# Node ID b5ac7d99d93f061977467c0a383b993b3e5e6507
# Parent  b75664e5390583c5d2075c82a14245bc941b3aaf
x86/mm: Make sure the event channel is released accurately

    In xenpaging source code,there is an interdomain communication between dom0
and domU. In mem_event_enable(),the function alloc_unbound_xen_event_channel()
allocates a free port for domU, and then it will be bound with dom0.
When xenpaging tears down,it just frees dom0's event channel port by
xc_evtchn_unbind(), leaves domU's port still occupied.
    So we add the patch to free domU's port when xenpaging exits.
We need double free interdomain eventchannel. First free domainU port,
and leave domain 0 port unbond, Then free domain 0 port.

Signed-off-by: Kaixing Hong <hongkaixing@huawei.com>,
Signed-off-by: Zhen Shi <bicky.shi@huawei.com>
Acked-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r b75664e53905 -r b5ac7d99d93f xen/arch/x86/mm/mem_event.c
--- a/xen/arch/x86/mm/mem_event.c	Thu Feb 16 15:43:02 2012 +0000
+++ b/xen/arch/x86/mm/mem_event.c	Fri Feb 17 15:14:25 2012 +0800
@@ -243,6 +243,9 @@
             return -EBUSY;
         }
 
+        /* Free domU's event channel and leave the other one unbound */
+        free_xen_event_channel(d->vcpu[0], med->xen_port);
+        
         unmap_domain_page(med->ring_page);
         med->ring_page = NULL;
 

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 17 21:44:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2012 21:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RyVbF-0000FD-H8; Fri, 17 Feb 2012 21:44:17 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyVbD-0000Ez-IB
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 21:44:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-216.messagelabs.com!1329515048!11945735!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31806 invoked from network); 17 Feb 2012 21:44:09 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Feb 2012 21:44:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyVb6-0002JE-8H
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 21:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyVb5-0003OQ-TU
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 21:44:07 +0000
Message-Id: <E1RyVb5-0003OQ-TU@xenbits.xen.org>
Date: Fri, 17 Feb 2012 21:44:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: fix indentation level in
	startup_cpu_idle_loop
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329481478 0
# Node ID 87218bd367befca7d3488ba1cf4feb2b10d5f14e
# Parent  b5ac7d99d93f061977467c0a383b993b3e5e6507
arm: fix indentation level in startup_cpu_idle_loop

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r b5ac7d99d93f -r 87218bd367be xen/arch/arm/domain.c
--- a/xen/arch/arm/domain.c	Fri Feb 17 15:14:25 2012 +0800
+++ b/xen/arch/arm/domain.c	Fri Feb 17 12:24:38 2012 +0000
@@ -163,15 +163,15 @@
 
 void startup_cpu_idle_loop(void)
 {
-        struct vcpu *v = current;
+    struct vcpu *v = current;
 
-        ASSERT(is_idle_vcpu(v));
-        /* TODO
-           cpumask_set_cpu(v->processor, v->domain->domain_dirty_cpumask);
-           cpumask_set_cpu(v->processor, v->vcpu_dirty_cpumask);
-        */
+    ASSERT(is_idle_vcpu(v));
+    /* TODO
+       cpumask_set_cpu(v->processor, v->domain->domain_dirty_cpumask);
+       cpumask_set_cpu(v->processor, v->vcpu_dirty_cpumask);
+    */
 
-        reset_stack_and_jump(idle_loop);
+    reset_stack_and_jump(idle_loop);
 }
 
 struct domain *alloc_domain_struct(void)

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

From xen-changelog-bounces@lists.xensource.com Fri Feb 17 21:44:22 2012
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2012 21:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xensource.com>)
	id 1RyVbF-0000FD-H8; Fri, 17 Feb 2012 21:44:17 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyVbD-0000Ez-IB
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 21:44:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-216.messagelabs.com!1329515048!11945735!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31806 invoked from network); 17 Feb 2012 21:44:09 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Feb 2012 21:44:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyVb6-0002JE-8H
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 21:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RyVb5-0003OQ-TU
	for xen-changelog@lists.xensource.com; Fri, 17 Feb 2012 21:44:07 +0000
Message-Id: <E1RyVb5-0003OQ-TU@xenbits.xen.org>
Date: Fri, 17 Feb 2012 21:44:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: fix indentation level in
	startup_cpu_idle_loop
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.13
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/options/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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 1329481478 0
# Node ID 87218bd367befca7d3488ba1cf4feb2b10d5f14e
# Parent  b5ac7d99d93f061977467c0a383b993b3e5e6507
arm: fix indentation level in startup_cpu_idle_loop

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r b5ac7d99d93f -r 87218bd367be xen/arch/arm/domain.c
--- a/xen/arch/arm/domain.c	Fri Feb 17 15:14:25 2012 +0800
+++ b/xen/arch/arm/domain.c	Fri Feb 17 12:24:38 2012 +0000
@@ -163,15 +163,15 @@
 
 void startup_cpu_idle_loop(void)
 {
-        struct vcpu *v = current;
+    struct vcpu *v = current;
 
-        ASSERT(is_idle_vcpu(v));
-        /* TODO
-           cpumask_set_cpu(v->processor, v->domain->domain_dirty_cpumask);
-           cpumask_set_cpu(v->processor, v->vcpu_dirty_cpumask);
-        */
+    ASSERT(is_idle_vcpu(v));
+    /* TODO
+       cpumask_set_cpu(v->processor, v->domain->domain_dirty_cpumask);
+       cpumask_set_cpu(v->processor, v->vcpu_dirty_cpumask);
+    */
 
-        reset_stack_and_jump(idle_loop);
+    reset_stack_and_jump(idle_loop);
 }
 
 struct domain *alloc_domain_struct(void)

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 16:33:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 16:33:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1RzWAt-0001DG-8N; Mon, 20 Feb 2012 16:33:15 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RzWAr-0001Cq-Ov
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 16:33:14 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-5.tower-21.messagelabs.com!1329755584!3655589!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15713 invoked from network); 20 Feb 2012 16:33:06 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 16:33:06 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RzWAh-0000nL-ON
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 16:33:03 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RzWAh-0002Fc-Fy
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 16:33:03 +0000
Date: Mon, 20 Feb 2012 16:33:03 +0000
Message-Id: <E1RzWAh-0002Fc-Fy@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-unstable] Intel GPU passthrough: Host
	bridge config space
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 128de2549c5f24e4a437b86bd2e46f023976d50a
Author: Jean Guyader <jean.guyader@eu.citrix.com>
Date:   Mon Feb 20 16:21:47 2012 +0000

    Intel GPU passthrough: Host bridge config space
    
    Expose more host bridge config space value to make the driver happy
    for all the different revisions of the device.
    
    Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
---
 hw/pt-graphics.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/pt-graphics.c b/hw/pt-graphics.c
index d4f11db..9c41f3e 100644
--- a/hw/pt-graphics.c
+++ b/hw/pt-graphics.c
@@ -89,6 +89,9 @@ uint32_t igd_pci_read(PCIDevice *pci_dev, uint32_t config_addr, int len)
     {
         case 0x00:        /* vendor id */
         case 0x02:        /* device id */
+        case 0x08:        /* revision id */
+        case 0x2c:        /* sybsystem vendor id */
+        case 0x2e:        /* sybsystem id */
         case 0x50:        /* SNB: processor graphics control register */
         case 0x52:        /* processor graphics control register */
         case 0xa0:        /* top of memory */
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 16:33:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 16:33:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1RzWAt-0001DG-8N; Mon, 20 Feb 2012 16:33:15 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RzWAr-0001Cq-Ov
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 16:33:14 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-5.tower-21.messagelabs.com!1329755584!3655589!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15713 invoked from network); 20 Feb 2012 16:33:06 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 16:33:06 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RzWAh-0000nL-ON
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 16:33:03 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RzWAh-0002Fc-Fy
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 16:33:03 +0000
Date: Mon, 20 Feb 2012 16:33:03 +0000
Message-Id: <E1RzWAh-0002Fc-Fy@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-unstable] Intel GPU passthrough: Host
	bridge config space
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 128de2549c5f24e4a437b86bd2e46f023976d50a
Author: Jean Guyader <jean.guyader@eu.citrix.com>
Date:   Mon Feb 20 16:21:47 2012 +0000

    Intel GPU passthrough: Host bridge config space
    
    Expose more host bridge config space value to make the driver happy
    for all the different revisions of the device.
    
    Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
---
 hw/pt-graphics.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/pt-graphics.c b/hw/pt-graphics.c
index d4f11db..9c41f3e 100644
--- a/hw/pt-graphics.c
+++ b/hw/pt-graphics.c
@@ -89,6 +89,9 @@ uint32_t igd_pci_read(PCIDevice *pci_dev, uint32_t config_addr, int len)
     {
         case 0x00:        /* vendor id */
         case 0x02:        /* device id */
+        case 0x08:        /* revision id */
+        case 0x2c:        /* sybsystem vendor id */
+        case 0x2e:        /* sybsystem id */
         case 0x50:        /* SNB: processor graphics control register */
         case 0x52:        /* processor graphics control register */
         case 0xa0:        /* top of memory */
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8g-0002cP-Oc; Mon, 20 Feb 2012 22:55:22 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8f-0002cF-Hq
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-27.messagelabs.com!1329778473!60912979!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6848 invoked from network); 20 Feb 2012 22:54:34 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:54:34 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8c-0005HC-Nn
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8c-0006iE-KN
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:18 +0000
Message-Id: <E1Rzc8c-0006iE-KN@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxc: remove tests of alloca()
	return value
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329759109 0
# Node ID 9cc7961d8f5cf04e85d659c843474ac922ff288d
# Parent  1c631e9013368560ea2a38029ab709c2885aa1b3
libxc: remove tests of alloca() return value

alloca() does not return NULL on an allocation failure on Linux so
remove the unneccessary tests from this Linux-specific code.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Cc: Santosh Jodh <santosh.jodh@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 1c631e901336 -r 9cc7961d8f5c tools/libxc/xc_linux_osdep.c
--- a/tools/libxc/xc_linux_osdep.c	Mon Feb 20 17:30:18 2012 +0000
+++ b/tools/libxc/xc_linux_osdep.c	Mon Feb 20 17:31:49 2012 +0000
@@ -243,63 +243,54 @@
          * IOCTL_PRIVCMD_MMAPBATCH_V2 is not supported - fall back to
          * IOCTL_PRIVCMD_MMAPBATCH.
          */
+        privcmd_mmapbatch_t ioctlx;
         xen_pfn_t *pfn = alloca(num * sizeof(*pfn));
 
-        if ( pfn )
+        memcpy(pfn, arr, num * sizeof(*arr));
+
+        ioctlx.num = num;
+        ioctlx.dom = dom;
+        ioctlx.addr = (unsigned long)addr;
+        ioctlx.arr = pfn;
+
+        rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH, &ioctlx);
+
+        rc = rc < 0 ? -errno : 0;
+
+        for ( i = 0; i < num; ++i )
         {
-            privcmd_mmapbatch_t ioctlx;
+            switch ( pfn[i] ^ arr[i] )
+            {
+            case 0:
+                err[i] = rc != -ENOENT ? rc : 0;
+                continue;
+            default:
+                err[i] = -EINVAL;
+                continue;
+            case XEN_DOMCTL_PFINFO_PAGEDTAB:
+                if ( rc != -ENOENT )
+                {
+                    err[i] = rc ?: -EINVAL;
+                    continue;
+                 }
+                rc = xc_map_foreign_batch_single(fd, dom, pfn + i,
+                        (unsigned long)addr + ((unsigned long)i<<XC_PAGE_SHIFT));
+                if ( rc < 0 )
+                {
+                    rc = -errno;
+                    break;
+                }
+                rc = -ENOENT;
+                continue;
+            }
+            break;
+        }
 
-            memcpy(pfn, arr, num * sizeof(*arr));
-
-            ioctlx.num = num;
-            ioctlx.dom = dom;
-            ioctlx.addr = (unsigned long)addr;
-            ioctlx.arr = pfn;
-
-            rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH, &ioctlx);
-
-            rc = rc < 0 ? -errno : 0;
-
-            for ( i = 0; i < num; ++i )
-            {
-                switch ( pfn[i] ^ arr[i] )
-                {
-                case 0:
-                    err[i] = rc != -ENOENT ? rc : 0;
-                    continue;
-                default:
-                    err[i] = -EINVAL;
-                    continue;
-                case XEN_DOMCTL_PFINFO_PAGEDTAB:
-                    if ( rc != -ENOENT )
-                    {
-                        err[i] = rc ?: -EINVAL;
-                        continue;
-                    }
-                    rc = xc_map_foreign_batch_single(fd, dom, pfn + i,
-                        (unsigned long)addr + ((unsigned long)i<<XC_PAGE_SHIFT));
-                    if ( rc < 0 )
-                    {
-                        rc = -errno;
-                        break;
-                    }
-                    rc = -ENOENT;
-                    continue;
-                }
-                break;
-            }
-
-            if ( rc == -ENOENT && i == num )
-                rc = 0;
-            else if ( rc )
-            {
-                errno = -rc;
-                rc = -1;
-            }
-        }
-        else
+        if ( rc == -ENOENT && i == num )
+            rc = 0;
+        else if ( rc )
         {
-            errno = -ENOMEM;
+            errno = -rc;
             rc = -1;
         }
     }
@@ -525,8 +516,6 @@
 
     map = alloca(sizeof(*map) +
                  (count - 1) * sizeof(struct ioctl_gntdev_map_grant_ref));
-    if ( map == NULL )
-        return NULL;
 
     for ( i = 0; i < count; i++ )
     {

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8g-0002cP-Oc; Mon, 20 Feb 2012 22:55:22 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8f-0002cF-Hq
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-27.messagelabs.com!1329778473!60912979!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6848 invoked from network); 20 Feb 2012 22:54:34 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:54:34 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8c-0005HC-Nn
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8c-0006iE-KN
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:18 +0000
Message-Id: <E1Rzc8c-0006iE-KN@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxc: remove tests of alloca()
	return value
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329759109 0
# Node ID 9cc7961d8f5cf04e85d659c843474ac922ff288d
# Parent  1c631e9013368560ea2a38029ab709c2885aa1b3
libxc: remove tests of alloca() return value

alloca() does not return NULL on an allocation failure on Linux so
remove the unneccessary tests from this Linux-specific code.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Cc: Santosh Jodh <santosh.jodh@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 1c631e901336 -r 9cc7961d8f5c tools/libxc/xc_linux_osdep.c
--- a/tools/libxc/xc_linux_osdep.c	Mon Feb 20 17:30:18 2012 +0000
+++ b/tools/libxc/xc_linux_osdep.c	Mon Feb 20 17:31:49 2012 +0000
@@ -243,63 +243,54 @@
          * IOCTL_PRIVCMD_MMAPBATCH_V2 is not supported - fall back to
          * IOCTL_PRIVCMD_MMAPBATCH.
          */
+        privcmd_mmapbatch_t ioctlx;
         xen_pfn_t *pfn = alloca(num * sizeof(*pfn));
 
-        if ( pfn )
+        memcpy(pfn, arr, num * sizeof(*arr));
+
+        ioctlx.num = num;
+        ioctlx.dom = dom;
+        ioctlx.addr = (unsigned long)addr;
+        ioctlx.arr = pfn;
+
+        rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH, &ioctlx);
+
+        rc = rc < 0 ? -errno : 0;
+
+        for ( i = 0; i < num; ++i )
         {
-            privcmd_mmapbatch_t ioctlx;
+            switch ( pfn[i] ^ arr[i] )
+            {
+            case 0:
+                err[i] = rc != -ENOENT ? rc : 0;
+                continue;
+            default:
+                err[i] = -EINVAL;
+                continue;
+            case XEN_DOMCTL_PFINFO_PAGEDTAB:
+                if ( rc != -ENOENT )
+                {
+                    err[i] = rc ?: -EINVAL;
+                    continue;
+                 }
+                rc = xc_map_foreign_batch_single(fd, dom, pfn + i,
+                        (unsigned long)addr + ((unsigned long)i<<XC_PAGE_SHIFT));
+                if ( rc < 0 )
+                {
+                    rc = -errno;
+                    break;
+                }
+                rc = -ENOENT;
+                continue;
+            }
+            break;
+        }
 
-            memcpy(pfn, arr, num * sizeof(*arr));
-
-            ioctlx.num = num;
-            ioctlx.dom = dom;
-            ioctlx.addr = (unsigned long)addr;
-            ioctlx.arr = pfn;
-
-            rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH, &ioctlx);
-
-            rc = rc < 0 ? -errno : 0;
-
-            for ( i = 0; i < num; ++i )
-            {
-                switch ( pfn[i] ^ arr[i] )
-                {
-                case 0:
-                    err[i] = rc != -ENOENT ? rc : 0;
-                    continue;
-                default:
-                    err[i] = -EINVAL;
-                    continue;
-                case XEN_DOMCTL_PFINFO_PAGEDTAB:
-                    if ( rc != -ENOENT )
-                    {
-                        err[i] = rc ?: -EINVAL;
-                        continue;
-                    }
-                    rc = xc_map_foreign_batch_single(fd, dom, pfn + i,
-                        (unsigned long)addr + ((unsigned long)i<<XC_PAGE_SHIFT));
-                    if ( rc < 0 )
-                    {
-                        rc = -errno;
-                        break;
-                    }
-                    rc = -ENOENT;
-                    continue;
-                }
-                break;
-            }
-
-            if ( rc == -ENOENT && i == num )
-                rc = 0;
-            else if ( rc )
-            {
-                errno = -rc;
-                rc = -1;
-            }
-        }
-        else
+        if ( rc == -ENOENT && i == num )
+            rc = 0;
+        else if ( rc )
         {
-            errno = -ENOMEM;
+            errno = -rc;
             rc = -1;
         }
     }
@@ -525,8 +516,6 @@
 
     map = alloca(sizeof(*map) +
                  (count - 1) * sizeof(struct ioctl_gntdev_map_grant_ref));
-    if ( map == NULL )
-        return NULL;
 
     for ( i = 0; i < count; i++ )
     {

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8j-0002d8-WF; Mon, 20 Feb 2012 22:55:26 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8i-0002c5-Pe
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1329778516!14145469!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4996 invoked from network); 20 Feb 2012 22:55:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8a-0005H3-Ex
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8a-0006gv-7d
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:16 +0000
Message-Id: <E1Rzc8a-0006gv-7d@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxc: add comment to why NetBSD
	return hypercall->retval
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1326968470 -3600
# Node ID 8a8c6e9a7c436802139eaacc5835e5d2ffe53fd8
# Parent  1f8ce25dc09897948ec8bf59f6f6d10979298413
libxc: add comment to why NetBSD return hypercall->retval

Added a comment that explains why NetBSD return hypercall->retval on
success.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Acked-by: Ian Campbell <ian.campbell.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Reported-by: Olaf Hering <olaf@aepfle.de>
---


diff -r 1f8ce25dc098 -r 8a8c6e9a7c43 tools/libxc/xc_netbsd.c
--- a/tools/libxc/xc_netbsd.c	Mon Feb 20 16:46:27 2012 +0000
+++ b/tools/libxc/xc_netbsd.c	Thu Jan 19 11:21:10 2012 +0100
@@ -96,6 +96,12 @@
     int fd = (int)h;
     int error = ioctl(fd, IOCTL_PRIVCMD_HYPERCALL, hypercall);
 
+    /*
+     * Since NetBSD ioctl can only return 0 on success or < 0 on
+     * error, if we want to return a value from ioctl we should
+     * do so by setting hypercall->retval, to mimic Linux ioctl
+     * implementation.
+     */
     if (error < 0)
         return -errno;
     else

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8j-0002d8-WF; Mon, 20 Feb 2012 22:55:26 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8i-0002c5-Pe
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1329778516!14145469!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4996 invoked from network); 20 Feb 2012 22:55:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8a-0005H3-Ex
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8a-0006gv-7d
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:16 +0000
Message-Id: <E1Rzc8a-0006gv-7d@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxc: add comment to why NetBSD
	return hypercall->retval
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1326968470 -3600
# Node ID 8a8c6e9a7c436802139eaacc5835e5d2ffe53fd8
# Parent  1f8ce25dc09897948ec8bf59f6f6d10979298413
libxc: add comment to why NetBSD return hypercall->retval

Added a comment that explains why NetBSD return hypercall->retval on
success.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Acked-by: Ian Campbell <ian.campbell.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Reported-by: Olaf Hering <olaf@aepfle.de>
---


diff -r 1f8ce25dc098 -r 8a8c6e9a7c43 tools/libxc/xc_netbsd.c
--- a/tools/libxc/xc_netbsd.c	Mon Feb 20 16:46:27 2012 +0000
+++ b/tools/libxc/xc_netbsd.c	Thu Jan 19 11:21:10 2012 +0100
@@ -96,6 +96,12 @@
     int fd = (int)h;
     int error = ioctl(fd, IOCTL_PRIVCMD_HYPERCALL, hypercall);
 
+    /*
+     * Since NetBSD ioctl can only return 0 on success or < 0 on
+     * error, if we want to return a value from ioctl we should
+     * do so by setting hypercall->retval, to mimic Linux ioctl
+     * implementation.
+     */
     if (error < 0)
         return -errno;
     else

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8h-0002ce-RD; Mon, 20 Feb 2012 22:55:23 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8g-0002bw-Fb
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1329778514!9023655!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27592 invoked from network); 20 Feb 2012 22:55:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8Y-0005Gu-1U
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8X-0006fe-GZ
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:13 +0000
Message-Id: <E1Rzc8X-0006fe-GZ@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: mmap guest pages read-only
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329754298 0
# Node ID 4173658d1af13ff2fe0f496bb6026307b1ddc167
# Parent  87218bd367befca7d3488ba1cf4feb2b10d5f14e
xenpaging: mmap guest pages read-only

xenpaging does not write to the gfn, so map the gfn to page-out in
read-only mode.

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


diff -r 87218bd367be -r 4173658d1af1 tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Fri Feb 17 12:24:38 2012 +0000
+++ b/tools/xenpaging/xenpaging.c	Mon Feb 20 16:11:38 2012 +0000
@@ -574,7 +574,7 @@
     gfn = victim->gfn;
     ret = -EFAULT;
     page = xc_map_foreign_pages(xch, paging->mem_event.domain_id,
-                                PROT_READ | PROT_WRITE, &gfn, 1);
+                                PROT_READ, &gfn, 1);
     if ( page == NULL )
     {
         PERROR("Error mapping page %lx", victim->gfn);

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8h-0002ce-RD; Mon, 20 Feb 2012 22:55:23 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8g-0002bw-Fb
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1329778514!9023655!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27592 invoked from network); 20 Feb 2012 22:55:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8Y-0005Gu-1U
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8X-0006fe-GZ
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:13 +0000
Message-Id: <E1Rzc8X-0006fe-GZ@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: mmap guest pages read-only
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329754298 0
# Node ID 4173658d1af13ff2fe0f496bb6026307b1ddc167
# Parent  87218bd367befca7d3488ba1cf4feb2b10d5f14e
xenpaging: mmap guest pages read-only

xenpaging does not write to the gfn, so map the gfn to page-out in
read-only mode.

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


diff -r 87218bd367be -r 4173658d1af1 tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Fri Feb 17 12:24:38 2012 +0000
+++ b/tools/xenpaging/xenpaging.c	Mon Feb 20 16:11:38 2012 +0000
@@ -574,7 +574,7 @@
     gfn = victim->gfn;
     ret = -EFAULT;
     page = xc_map_foreign_pages(xch, paging->mem_event.domain_id,
-                                PROT_READ | PROT_WRITE, &gfn, 1);
+                                PROT_READ, &gfn, 1);
     if ( page == NULL )
     {
         PERROR("Error mapping page %lx", victim->gfn);

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:29 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8d-0002c6-Lx; Mon, 20 Feb 2012 22:55:19 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8c-0002bx-6N
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:18 +0000
Received: from [85.158.139.83:45893] by server-4.bemta-5.messagelabs.com id
	A3/0A-10788-55FC24F4; Mon, 20 Feb 2012 22:55:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1329778515!15878582!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17954 invoked from network); 20 Feb 2012 22:55:16 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:16 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8Y-0005Gx-Qj
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8Y-0006g4-EV
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:14 +0000
Message-Id: <E1Rzc8Y-0006g4-EV@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] QEMU_TAG update
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1329755359 0
# Node ID fda048a410767f2baaf44976339bf03388b2dde0
# Parent  4173658d1af13ff2fe0f496bb6026307b1ddc167
QEMU_TAG update
---


diff -r 4173658d1af1 -r fda048a41076 Config.mk
--- a/Config.mk	Mon Feb 20 16:11:38 2012 +0000
+++ b/Config.mk	Mon Feb 20 16:29:19 2012 +0000
@@ -232,9 +232,9 @@
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= 414b878e8ea17c65cd0d7f9dfc38dba472857f74
-# Mon Feb 13 17:00:13 2012 +0000
-# qemu: Don't access /proc/bus/pci unless graphics pass-thru is enabled
+QEMU_TAG ?= 128de2549c5f24e4a437b86bd2e46f023976d50a
+# Mon Feb 20 16:21:47 2012 +0000
+# Intel GPU passthrough: Host bridge config space
 
 # 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.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:29 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8d-0002c6-Lx; Mon, 20 Feb 2012 22:55:19 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8c-0002bx-6N
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:18 +0000
Received: from [85.158.139.83:45893] by server-4.bemta-5.messagelabs.com id
	A3/0A-10788-55FC24F4; Mon, 20 Feb 2012 22:55:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1329778515!15878582!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17954 invoked from network); 20 Feb 2012 22:55:16 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:16 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8Y-0005Gx-Qj
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8Y-0006g4-EV
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:14 +0000
Message-Id: <E1Rzc8Y-0006g4-EV@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] QEMU_TAG update
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1329755359 0
# Node ID fda048a410767f2baaf44976339bf03388b2dde0
# Parent  4173658d1af13ff2fe0f496bb6026307b1ddc167
QEMU_TAG update
---


diff -r 4173658d1af1 -r fda048a41076 Config.mk
--- a/Config.mk	Mon Feb 20 16:11:38 2012 +0000
+++ b/Config.mk	Mon Feb 20 16:29:19 2012 +0000
@@ -232,9 +232,9 @@
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= 414b878e8ea17c65cd0d7f9dfc38dba472857f74
-# Mon Feb 13 17:00:13 2012 +0000
-# qemu: Don't access /proc/bus/pci unless graphics pass-thru is enabled
+QEMU_TAG ?= 128de2549c5f24e4a437b86bd2e46f023976d50a
+# Mon Feb 20 16:21:47 2012 +0000
+# Intel GPU passthrough: Host bridge config space
 
 # 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.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:29 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8i-0002cq-Tv; Mon, 20 Feb 2012 22:55:24 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8h-0002c0-G0
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1329778515!9023656!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27652 invoked from network); 20 Feb 2012 22:55:16 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:16 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8Z-0005H0-FI
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8Z-0006gU-CH
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:15 +0000
Message-Id: <E1Rzc8Z-0006gU-CH@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Fix yajl-related build error
	due to missing error value
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Allen Kay <allen.m.kay@intel.com>
# Date 1329756387 0
# Node ID 1f8ce25dc09897948ec8bf59f6f6d10979298413
# Parent  fda048a410767f2baaf44976339bf03388b2dde0
libxl: Fix yajl-related build error due to missing error value

Some versions of yajl lack yajl_gen_no_buf.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r fda048a41076 -r 1f8ce25dc098 tools/libxl/libxl_json.c
--- a/tools/libxl/libxl_json.c	Mon Feb 20 16:29:19 2012 +0000
+++ b/tools/libxl/libxl_json.c	Mon Feb 20 16:46:27 2012 +0000
@@ -793,9 +793,9 @@
             return "generation complete";
         case yajl_gen_invalid_number:
             return "invalid number";
+#if 0 /* This is in the docs but not implemented in the version I am running. */
         case yajl_gen_no_buf:
             return "no buffer";
-#if 0 /* This is in the docs but not implemented in the version I am running. */
         case yajl_gen_invalid_string:
             return "invalid string";
 #endif

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:29 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8i-0002cq-Tv; Mon, 20 Feb 2012 22:55:24 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8h-0002c0-G0
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1329778515!9023656!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27652 invoked from network); 20 Feb 2012 22:55:16 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:16 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8Z-0005H0-FI
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8Z-0006gU-CH
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:15 +0000
Message-Id: <E1Rzc8Z-0006gU-CH@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Fix yajl-related build error
	due to missing error value
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Allen Kay <allen.m.kay@intel.com>
# Date 1329756387 0
# Node ID 1f8ce25dc09897948ec8bf59f6f6d10979298413
# Parent  fda048a410767f2baaf44976339bf03388b2dde0
libxl: Fix yajl-related build error due to missing error value

Some versions of yajl lack yajl_gen_no_buf.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r fda048a41076 -r 1f8ce25dc098 tools/libxl/libxl_json.c
--- a/tools/libxl/libxl_json.c	Mon Feb 20 16:29:19 2012 +0000
+++ b/tools/libxl/libxl_json.c	Mon Feb 20 16:46:27 2012 +0000
@@ -793,9 +793,9 @@
             return "generation complete";
         case yajl_gen_invalid_number:
             return "invalid number";
+#if 0 /* This is in the docs but not implemented in the version I am running. */
         case yajl_gen_no_buf:
             return "no buffer";
-#if 0 /* This is in the docs but not implemented in the version I am running. */
         case yajl_gen_invalid_string:
             return "invalid string";
 #endif

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:29 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8l-0002dZ-2V; Mon, 20 Feb 2012 22:55:27 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8k-0002cD-3G
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1329778518!9023659!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27803 invoked from network); 20 Feb 2012 22:55:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8c-0005H9-4b
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8b-0006hj-Kl
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:18 +0000
Message-Id: <E1Rzc8b-0006hj-Kl@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] gitignore: add more files generated
	in xen/arch/x86/efi to .gitignore
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329759018 0
# Node ID 1c631e9013368560ea2a38029ab709c2885aa1b3
# Parent  db6b998af1821807070aa657c8aebda999cf3ce2
gitignore: add more files generated in xen/arch/x86/efi to .gitignore

These files were already listed in .hgignore.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r db6b998af182 -r 1c631e901336 .gitignore
--- a/.gitignore	Thu Jan 19 11:17:35 2012 +0100
+++ b/.gitignore	Mon Feb 20 17:30:18 2012 +0000
@@ -282,6 +282,9 @@
 xen/arch/x86/boot/mkelf32
 xen/arch/x86/xen.lds
 xen/arch/x86/boot/reloc.S
+xen/arch/x86/efi.lds
+xen/arch/x86/efi/disabled
+xen/arch/x86/efi/mkreloc
 xen/ddb/*
 xen/include/headers.chk
 xen/include/asm

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:29 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8l-0002dZ-2V; Mon, 20 Feb 2012 22:55:27 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8k-0002cD-3G
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1329778518!9023659!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27803 invoked from network); 20 Feb 2012 22:55:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8c-0005H9-4b
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8b-0006hj-Kl
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:18 +0000
Message-Id: <E1Rzc8b-0006hj-Kl@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] gitignore: add more files generated
	in xen/arch/x86/efi to .gitignore
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329759018 0
# Node ID 1c631e9013368560ea2a38029ab709c2885aa1b3
# Parent  db6b998af1821807070aa657c8aebda999cf3ce2
gitignore: add more files generated in xen/arch/x86/efi to .gitignore

These files were already listed in .hgignore.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r db6b998af182 -r 1c631e901336 .gitignore
--- a/.gitignore	Thu Jan 19 11:17:35 2012 +0100
+++ b/.gitignore	Mon Feb 20 17:30:18 2012 +0000
@@ -282,6 +282,9 @@
 xen/arch/x86/boot/mkelf32
 xen/arch/x86/xen.lds
 xen/arch/x86/boot/reloc.S
+xen/arch/x86/efi.lds
+xen/arch/x86/efi/disabled
+xen/arch/x86/efi/mkreloc
 xen/ddb/*
 xen/include/headers.chk
 xen/include/asm

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:30 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8n-0002fo-E8; Mon, 20 Feb 2012 22:55:29 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8l-0002dd-JK
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:27 +0000
Received: from [85.158.139.83:33717] by server-8.bemta-5.messagelabs.com id
	05/9D-09797-E5FC24F4; Mon, 20 Feb 2012 22:55:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-182.messagelabs.com!1329778524!15867836!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5868 invoked from network); 20 Feb 2012 22:55:25 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:25 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8i-0005Ha-59
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:24 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8i-0006lS-2R
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:24 +0000
Message-Id: <E1Rzc8i-0006lS-2R@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:23 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] remus: libcheckpoint - initialize
	unused callback fields to NULL
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Shriram Rajagopalan <rshriram@cs.ubc.ca>
# Date 1329762854 0
# Node ID ca80eca9cfa39d1b60d1216948dac5711d550b83
# Parent  a9b81a8014ec0749ed1d7b05a6aef3e15e30228c
remus: libcheckpoint - initialize unused callback fields to NULL

Add a memset to the save_callbacks struct instance in libcheckpoint's
initialization code. New additions to the callback struct will not
need to add an explicit initialization (to NULL), to maintain
compatibility with older xend/remus based invocation of xc_domain_save.

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r a9b81a8014ec -r ca80eca9cfa3 tools/python/xen/lowlevel/checkpoint/checkpoint.c
--- a/tools/python/xen/lowlevel/checkpoint/checkpoint.c	Mon Feb 20 18:29:31 2012 +0000
+++ b/tools/python/xen/lowlevel/checkpoint/checkpoint.c	Mon Feb 20 18:34:14 2012 +0000
@@ -155,6 +155,7 @@
   } else
     self->checkpoint_cb = NULL;
 
+  memset(&callbacks, 0, sizeof(callbacks));
   callbacks.suspend = suspend_trampoline;
   callbacks.postcopy = postcopy_trampoline;
   callbacks.checkpoint = checkpoint_trampoline;

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:30 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8n-0002fo-E8; Mon, 20 Feb 2012 22:55:29 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8l-0002dd-JK
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:27 +0000
Received: from [85.158.139.83:33717] by server-8.bemta-5.messagelabs.com id
	05/9D-09797-E5FC24F4; Mon, 20 Feb 2012 22:55:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-182.messagelabs.com!1329778524!15867836!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5868 invoked from network); 20 Feb 2012 22:55:25 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:25 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8i-0005Ha-59
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:24 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8i-0006lS-2R
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:24 +0000
Message-Id: <E1Rzc8i-0006lS-2R@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:23 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] remus: libcheckpoint - initialize
	unused callback fields to NULL
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Shriram Rajagopalan <rshriram@cs.ubc.ca>
# Date 1329762854 0
# Node ID ca80eca9cfa39d1b60d1216948dac5711d550b83
# Parent  a9b81a8014ec0749ed1d7b05a6aef3e15e30228c
remus: libcheckpoint - initialize unused callback fields to NULL

Add a memset to the save_callbacks struct instance in libcheckpoint's
initialization code. New additions to the callback struct will not
need to add an explicit initialization (to NULL), to maintain
compatibility with older xend/remus based invocation of xc_domain_save.

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r a9b81a8014ec -r ca80eca9cfa3 tools/python/xen/lowlevel/checkpoint/checkpoint.c
--- a/tools/python/xen/lowlevel/checkpoint/checkpoint.c	Mon Feb 20 18:29:31 2012 +0000
+++ b/tools/python/xen/lowlevel/checkpoint/checkpoint.c	Mon Feb 20 18:34:14 2012 +0000
@@ -155,6 +155,7 @@
   } else
     self->checkpoint_cb = NULL;
 
+  memset(&callbacks, 0, sizeof(callbacks));
   callbacks.suspend = suspend_trampoline;
   callbacks.postcopy = postcopy_trampoline;
   callbacks.checkpoint = checkpoint_trampoline;

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:30 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8n-0002g5-Ir; Mon, 20 Feb 2012 22:55:29 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8m-0002cN-7r
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:28 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-216.messagelabs.com!1329778520!12263279!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5307 invoked from network); 20 Feb 2012 22:55:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8e-0005HL-FC
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8e-0006jN-Az
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:20 +0000
Message-Id: <E1Rzc8e-0006jN-Az@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: fix xl create/cpupool-create -f
	help output
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329761343 0
# Node ID dd3b13d855047fd2d8f7a99e2073e55747306252
# Parent  70ba5a011e59f49bde8ae6e8629a203bbd5e582d
xl: fix xl create/cpupool-create -f help output

xl create -f domU.cfg does not need an equal sign.
This applies also to xl cpupool-create.

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


diff -r 70ba5a011e59 -r dd3b13d85504 tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c	Mon Feb 20 18:05:12 2012 +0000
+++ b/tools/libxl/xl_cmdtable.c	Mon Feb 20 18:09:03 2012 +0000
@@ -25,7 +25,7 @@
       "-h                      Print this help.\n"
       "-p                      Leave the domain paused after it is created.\n"
       "-c                      Connect to the console after the domain is created.\n"
-      "-f=FILE, --defconfig=FILE\n                     Use the given configuration file.\n"
+      "-f FILE, --defconfig=FILE\n                     Use the given configuration file.\n"
       "-q, --quiet             Quiet.\n"
       "-n, --dryrun            Dry run - prints the resulting configuration\n"
       "                         (deprecated in favour of global -N option).\n"
@@ -364,7 +364,7 @@
       "Create a CPU pool based an ConfigFile",
       "[options] <ConfigFile> [vars]",
       "-h, --help                   Print this help.\n"
-      "-f=FILE, --defconfig=FILE    Use the given configuration file.\n"
+      "-f FILE, --defconfig=FILE    Use the given configuration file.\n"
       "-n, --dryrun                 Dry run - prints the resulting configuration.\n"
       "                              (deprecated in favour of global -N option)."
     },

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:30 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8n-0002g5-Ir; Mon, 20 Feb 2012 22:55:29 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8m-0002cN-7r
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:28 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-216.messagelabs.com!1329778520!12263279!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5307 invoked from network); 20 Feb 2012 22:55:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8e-0005HL-FC
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8e-0006jN-Az
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:20 +0000
Message-Id: <E1Rzc8e-0006jN-Az@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: fix xl create/cpupool-create -f
	help output
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329761343 0
# Node ID dd3b13d855047fd2d8f7a99e2073e55747306252
# Parent  70ba5a011e59f49bde8ae6e8629a203bbd5e582d
xl: fix xl create/cpupool-create -f help output

xl create -f domU.cfg does not need an equal sign.
This applies also to xl cpupool-create.

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


diff -r 70ba5a011e59 -r dd3b13d85504 tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c	Mon Feb 20 18:05:12 2012 +0000
+++ b/tools/libxl/xl_cmdtable.c	Mon Feb 20 18:09:03 2012 +0000
@@ -25,7 +25,7 @@
       "-h                      Print this help.\n"
       "-p                      Leave the domain paused after it is created.\n"
       "-c                      Connect to the console after the domain is created.\n"
-      "-f=FILE, --defconfig=FILE\n                     Use the given configuration file.\n"
+      "-f FILE, --defconfig=FILE\n                     Use the given configuration file.\n"
       "-q, --quiet             Quiet.\n"
       "-n, --dryrun            Dry run - prints the resulting configuration\n"
       "                         (deprecated in favour of global -N option).\n"
@@ -364,7 +364,7 @@
       "Create a CPU pool based an ConfigFile",
       "[options] <ConfigFile> [vars]",
       "-h, --help                   Print this help.\n"
-      "-f=FILE, --defconfig=FILE    Use the given configuration file.\n"
+      "-f FILE, --defconfig=FILE    Use the given configuration file.\n"
       "-n, --dryrun                 Dry run - prints the resulting configuration.\n"
       "                              (deprecated in favour of global -N option)."
     },

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:30 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8n-0002fy-Gi; Mon, 20 Feb 2012 22:55:29 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8l-0002cM-PJ
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:28 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1329778520!14140755!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7923 invoked from network); 20 Feb 2012 22:55:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8d-0005HI-Tg
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8d-0006iz-Od
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:19 +0000
Message-Id: <E1Rzc8d-0006iz-Od@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/examples: Add the xl
	configuration examples to the makefile
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Fabio Fantoni <fabio.fantoni@heliman.it>
# Date 1329761112 0
# Node ID 70ba5a011e59f49bde8ae6e8629a203bbd5e582d
# Parent  259fac2350117ffa5743401e0d693f0f57cc04b2
tools/examples: Add the xl configuration examples to the makefile

Signed-off-by: Fabio Fantoni <fabio.fantoni@heliman.it>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 259fac235011 -r 70ba5a011e59 tools/examples/Makefile
--- a/tools/examples/Makefile	Mon Feb 20 17:53:33 2012 +0000
+++ b/tools/examples/Makefile	Mon Feb 20 18:05:12 2012 +0000
@@ -19,6 +19,8 @@
 XEN_CONFIGS += xmexample.pv-grub
 XEN_CONFIGS += xmexample.nbd
 XEN_CONFIGS += xmexample.vti
+XEN_CONFIGS += xlexample.hvm
+XEN_CONFIGS += xlexample.pvlinux
 XEN_CONFIGS += xend-pci-quirks.sxp
 XEN_CONFIGS += xend-pci-permissive.sxp
 XEN_CONFIGS += xl.conf

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:30 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8n-0002fy-Gi; Mon, 20 Feb 2012 22:55:29 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8l-0002cM-PJ
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:28 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1329778520!14140755!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7923 invoked from network); 20 Feb 2012 22:55:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8d-0005HI-Tg
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8d-0006iz-Od
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:19 +0000
Message-Id: <E1Rzc8d-0006iz-Od@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/examples: Add the xl
	configuration examples to the makefile
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Fabio Fantoni <fabio.fantoni@heliman.it>
# Date 1329761112 0
# Node ID 70ba5a011e59f49bde8ae6e8629a203bbd5e582d
# Parent  259fac2350117ffa5743401e0d693f0f57cc04b2
tools/examples: Add the xl configuration examples to the makefile

Signed-off-by: Fabio Fantoni <fabio.fantoni@heliman.it>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 259fac235011 -r 70ba5a011e59 tools/examples/Makefile
--- a/tools/examples/Makefile	Mon Feb 20 17:53:33 2012 +0000
+++ b/tools/examples/Makefile	Mon Feb 20 18:05:12 2012 +0000
@@ -19,6 +19,8 @@
 XEN_CONFIGS += xmexample.pv-grub
 XEN_CONFIGS += xmexample.nbd
 XEN_CONFIGS += xmexample.vti
+XEN_CONFIGS += xlexample.hvm
+XEN_CONFIGS += xlexample.pvlinux
 XEN_CONFIGS += xend-pci-quirks.sxp
 XEN_CONFIGS += xend-pci-permissive.sxp
 XEN_CONFIGS += xl.conf

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:30 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8n-0002fi-Bp; Mon, 20 Feb 2012 22:55:29 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8l-0002cL-Em
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:27 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-216.messagelabs.com!1329778520!15053328!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=2.0 required=7.0 tests=SUBJECT_RANDOMQ
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29540 invoked from network); 20 Feb 2012 22:55:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8d-0005HF-F3
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8d-0006ic-71
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:19 +0000
Message-Id: <E1Rzc8d-0006ic-71@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl_qmp: Handle unexpected
	end-of-socket
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1329760413 0
# Node ID 259fac2350117ffa5743401e0d693f0f57cc04b2
# Parent  9cc7961d8f5cf04e85d659c843474ac922ff288d
libxl_qmp: Handle unexpected end-of-socket

When read() return 0, the current code just tries again. But this
leads to an infinite loop if QEMU died too soon.

Also, retry select if a signal was caught.

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


diff -r 9cc7961d8f5c -r 259fac235011 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Mon Feb 20 17:31:49 2012 +0000
+++ b/tools/libxl/libxl_qmp.c	Mon Feb 20 17:53:33 2012 +0000
@@ -390,13 +390,16 @@
             LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR, "timeout");
             return -1;
         } else if (ret < 0) {
+            if (errno == EINTR)
+                continue;
             LIBXL__LOG_ERRNO(qmp->ctx, LIBXL__LOG_ERROR, "Select error");
             return -1;
         }
 
         rd = read(qmp->qmp_fd, qmp->buffer, QMP_RECEIVE_BUFFER_SIZE);
         if (rd == 0) {
-            continue;
+            LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR, "Unexpected end of socket");
+            return -1;
         } else if (rd < 0) {
             LIBXL__LOG_ERRNO(qmp->ctx, LIBXL__LOG_ERROR, "Socket read error");
             return rd;

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:30 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8n-0002fi-Bp; Mon, 20 Feb 2012 22:55:29 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8l-0002cL-Em
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:27 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-216.messagelabs.com!1329778520!15053328!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=2.0 required=7.0 tests=SUBJECT_RANDOMQ
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29540 invoked from network); 20 Feb 2012 22:55:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8d-0005HF-F3
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8d-0006ic-71
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:19 +0000
Message-Id: <E1Rzc8d-0006ic-71@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl_qmp: Handle unexpected
	end-of-socket
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1329760413 0
# Node ID 259fac2350117ffa5743401e0d693f0f57cc04b2
# Parent  9cc7961d8f5cf04e85d659c843474ac922ff288d
libxl_qmp: Handle unexpected end-of-socket

When read() return 0, the current code just tries again. But this
leads to an infinite loop if QEMU died too soon.

Also, retry select if a signal was caught.

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


diff -r 9cc7961d8f5c -r 259fac235011 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Mon Feb 20 17:31:49 2012 +0000
+++ b/tools/libxl/libxl_qmp.c	Mon Feb 20 17:53:33 2012 +0000
@@ -390,13 +390,16 @@
             LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR, "timeout");
             return -1;
         } else if (ret < 0) {
+            if (errno == EINTR)
+                continue;
             LIBXL__LOG_ERRNO(qmp->ctx, LIBXL__LOG_ERROR, "Select error");
             return -1;
         }
 
         rd = read(qmp->qmp_fd, qmp->buffer, QMP_RECEIVE_BUFFER_SIZE);
         if (rd == 0) {
-            continue;
+            LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR, "Unexpected end of socket");
+            return -1;
         } else if (rd < 0) {
             LIBXL__LOG_ERRNO(qmp->ctx, LIBXL__LOG_ERROR, "Socket read error");
             return rd;

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:31 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8m-0002eJ-7Z; Mon, 20 Feb 2012 22:55:28 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8k-0002dG-OT
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:26 +0000
Received: from [85.158.139.83:33697] by server-4.bemta-5.messagelabs.com id
	26/1A-10788-E5FC24F4; Mon, 20 Feb 2012 22:55:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-182.messagelabs.com!1329778523!15891022!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=1.7 required=7.0 tests=BODY_RANDOM_LONG,HOT_NASTY
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5171 invoked from network); 20 Feb 2012 22:55:25 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:25 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8f-0005HR-UU
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8f-0006kD-Rz
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:21 +0000
Message-Id: <E1Rzc8f-0006kD-Rz@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] man/xl.cfg: mention not yet
	documented options
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329761447 0
# Node ID a9166b2f41eadca9827221548131f6824f3e346d
# Parent  abd7f154fc1e9abe570b6e27d934c6428c267bb9
man/xl.cfg: mention not yet documented options

Add dummy entries for parsed but undocumented cfg file options to xl.cfg:

for i in `
grep -Ew 'xlu_cfg_get_(long|string|list|list_as_string_list)' tools/libxl/xl_cmdimpl.c | cut -f 2 -d '"' | sort -u
`
do
	grep -wq $i docs/man/xl.cfg.pod.5 || echo $i
done

current output:
acpi_s3
acpi_s4
cpus
device_model
gfx_passthru
maxmem
nodes
sched
vif2

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


diff -r abd7f154fc1e -r a9166b2f41ea docs/man/xl.cfg.pod.5
--- a/docs/man/xl.cfg.pod.5	Mon Feb 20 18:09:52 2012 +0000
+++ b/docs/man/xl.cfg.pod.5	Mon Feb 20 18:10:47 2012 +0000
@@ -842,6 +842,38 @@
 
 XXX
 
+=item B<acpi_s3=BOOLEAN>
+
+XXX
+
+=item B<acpi_s3=BOOLEAN>
+
+XXX
+
+=item B<cpus=XXX>
+
+XXX
+
+=item B<maxmem=NUMBER>
+
+XXX
+
+=item B<nodes=XXX>
+
+XXX
+
+=item B<sched=XXX>
+
+XXX
+
+=item B<device_model=XXX>
+
+XXX deprecated
+
+=item B<vif2=XXX>
+
+XXX deprecated
+
 =back
 
 =head2 Keymaps

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:31 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8m-0002eJ-7Z; Mon, 20 Feb 2012 22:55:28 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8k-0002dG-OT
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:26 +0000
Received: from [85.158.139.83:33697] by server-4.bemta-5.messagelabs.com id
	26/1A-10788-E5FC24F4; Mon, 20 Feb 2012 22:55:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-182.messagelabs.com!1329778523!15891022!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=1.7 required=7.0 tests=BODY_RANDOM_LONG,HOT_NASTY
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5171 invoked from network); 20 Feb 2012 22:55:25 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:25 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8f-0005HR-UU
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8f-0006kD-Rz
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:21 +0000
Message-Id: <E1Rzc8f-0006kD-Rz@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] man/xl.cfg: mention not yet
	documented options
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329761447 0
# Node ID a9166b2f41eadca9827221548131f6824f3e346d
# Parent  abd7f154fc1e9abe570b6e27d934c6428c267bb9
man/xl.cfg: mention not yet documented options

Add dummy entries for parsed but undocumented cfg file options to xl.cfg:

for i in `
grep -Ew 'xlu_cfg_get_(long|string|list|list_as_string_list)' tools/libxl/xl_cmdimpl.c | cut -f 2 -d '"' | sort -u
`
do
	grep -wq $i docs/man/xl.cfg.pod.5 || echo $i
done

current output:
acpi_s3
acpi_s4
cpus
device_model
gfx_passthru
maxmem
nodes
sched
vif2

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


diff -r abd7f154fc1e -r a9166b2f41ea docs/man/xl.cfg.pod.5
--- a/docs/man/xl.cfg.pod.5	Mon Feb 20 18:09:52 2012 +0000
+++ b/docs/man/xl.cfg.pod.5	Mon Feb 20 18:10:47 2012 +0000
@@ -842,6 +842,38 @@
 
 XXX
 
+=item B<acpi_s3=BOOLEAN>
+
+XXX
+
+=item B<acpi_s3=BOOLEAN>
+
+XXX
+
+=item B<cpus=XXX>
+
+XXX
+
+=item B<maxmem=NUMBER>
+
+XXX
+
+=item B<nodes=XXX>
+
+XXX
+
+=item B<sched=XXX>
+
+XXX
+
+=item B<device_model=XXX>
+
+XXX deprecated
+
+=item B<vif2=XXX>
+
+XXX deprecated
+
 =back
 
 =head2 Keymaps

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:32 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8m-0002eD-55; Mon, 20 Feb 2012 22:55:28 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8k-0002cE-Eu
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1329778517!3694542!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24994 invoked from network); 20 Feb 2012 22:55:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8b-0005H6-5q
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8a-0006hK-Vf
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:17 +0000
Message-Id: <E1Rzc8a-0006hK-Vf@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxc/NetBSD: return ioctl return
	value on error
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1326968255 -3600
# Node ID db6b998af1821807070aa657c8aebda999cf3ce2
# Parent  8a8c6e9a7c436802139eaacc5835e5d2ffe53fd8
libxc/NetBSD: return ioctl return value on error

NetBSD libxc hypercall implementation was returning -errno on error,
instead of the actual error value from ioctl. Returning error is
easier to understand, and the caller can always check errno.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Acked-by: Ian Campbell <ian.campbell.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Reported-by: Olaf Hering <olaf@aepfle.de>
---


diff -r 8a8c6e9a7c43 -r db6b998af182 tools/libxc/xc_netbsd.c
--- a/tools/libxc/xc_netbsd.c	Thu Jan 19 11:21:10 2012 +0100
+++ b/tools/libxc/xc_netbsd.c	Thu Jan 19 11:17:35 2012 +0100
@@ -103,7 +103,7 @@
      * implementation.
      */
     if (error < 0)
-        return -errno;
+        return error;
     else
         return hypercall->retval;
 }

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:32 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8m-0002eD-55; Mon, 20 Feb 2012 22:55:28 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8k-0002cE-Eu
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1329778517!3694542!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24994 invoked from network); 20 Feb 2012 22:55:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8b-0005H6-5q
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8a-0006hK-Vf
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:17 +0000
Message-Id: <E1Rzc8a-0006hK-Vf@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxc/NetBSD: return ioctl return
	value on error
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1326968255 -3600
# Node ID db6b998af1821807070aa657c8aebda999cf3ce2
# Parent  8a8c6e9a7c436802139eaacc5835e5d2ffe53fd8
libxc/NetBSD: return ioctl return value on error

NetBSD libxc hypercall implementation was returning -errno on error,
instead of the actual error value from ioctl. Returning error is
easier to understand, and the caller can always check errno.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Acked-by: Ian Campbell <ian.campbell.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Reported-by: Olaf Hering <olaf@aepfle.de>
---


diff -r 8a8c6e9a7c43 -r db6b998af182 tools/libxc/xc_netbsd.c
--- a/tools/libxc/xc_netbsd.c	Thu Jan 19 11:21:10 2012 +0100
+++ b/tools/libxc/xc_netbsd.c	Thu Jan 19 11:17:35 2012 +0100
@@ -103,7 +103,7 @@
      * implementation.
      */
     if (error < 0)
-        return -errno;
+        return error;
     else
         return hypercall->retval;
 }

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:33 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8q-0002jY-SU; Mon, 20 Feb 2012 22:55:32 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8p-0002dE-GD
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:31 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1329778523!4947558!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29615 invoked from network); 20 Feb 2012 22:55:24 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8g-0005HU-K7
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:22 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8g-0006kc-IC
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:22 +0000
Message-Id: <E1Rzc8g-0006kc-IC@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Add xlcpupool.cfg man page
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1329762404 0
# Node ID 79fcf8a6ab559d6cdd5ebaea0b2caa5da4931b82
# Parent  a9166b2f41eadca9827221548131f6824f3e346d
Add xlcpupool.cfg man page

Add a man page describing the configuration file for creating cpupools
via xl cpupool-create.

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


diff -r a9166b2f41ea -r 79fcf8a6ab55 docs/man/xlcpupool.cfg.pod.5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/man/xlcpupool.cfg.pod.5	Mon Feb 20 18:26:44 2012 +0000
@@ -0,0 +1,117 @@
+=head1 NAME
+
+xlcpupool.cfg - XL Cpupool Configuration File Syntax
+
+=head1 SYNOPSIS
+
+ /etc/xen/xlcpupool
+
+=head1 DESCRIPTION
+
+To create a Cpupool with xl requires the provision of a cpupool config
+file.  Typically these live in `/etc/xen/CPUPOOL.cfg` where CPUPOOL is
+the name of the cpupool.
+
+=head1 SYNTAX
+
+A cpupool config file consists of a series of C<KEY=VALUE> pairs.
+
+A value C<VALUE> is one of:
+
+=over 4
+
+=item B<"STRING">
+
+A string, surrounded by either single or double quotes.
+
+=item B<NUMBER>
+
+A number, in either decimal, octal (using a C<0> prefix) or
+hexadecimal (using an C<0x> prefix).
+
+=item B<[ VALUE, VALUE, ... ]>
+
+A list of C<VALUES> of the above types. Lists are homogeneous and are
+not nested.
+
+=back
+
+The semantics of each C<KEY> defines which form of C<VALUE> is required.
+
+=head1 OPTIONS
+
+=head2 Mandatory Configuration Items
+
+The following key is mandatory for any cpupool:
+
+=over 4
+
+=item B<name="NAME">
+
+Specifies the name of the cpupool.  Names of cpupools existing on a
+single host must be unique.
+
+=back
+
+=head2 Optional Configuration Items
+
+The following options apply to guests of any type.
+
+=over 4
+
+=item B<sched="SCHED">
+
+Specifies the scheduler which is used for the cpupool. Valid
+values for C<SCHED> are:
+
+=over 4
+
+=item B<credit>
+
+the credit scheduler
+
+=item B<credit2>
+
+the credit2 scheduler
+
+=item B<sedf>
+
+the SEDF scheduler
+
+=back
+
+The default scheduler is the one used for C<Pool-0> specified as
+boot parameter of the hypervisor.
+
+=item B<nodes="NODES">
+
+Specifies the cpus of the NUMA-nodes given in C<NODES> (an integer or
+a list of integers) to be member of the cpupool. The free cpus in the
+specified nodes are allocated in the new cpupool.
+
+=item B<cpus="CPUS">
+
+The specified C<CPUS> are allocated in the new cpupool. All cpus must
+be free. Must not be specified together with B<nodes>.
+
+If neither B<nodes> nor B<cpus> are specified only the first free cpu
+found will be allocated in the new cpupool.
+
+=back
+
+=head1 FILES
+
+F</etc/xen/CPUPOOL.cfg>
+
+=head1 BUGS
+
+This document is a work in progress and contains items which require
+further documentation and which are generally incomplete (marked with
+XXX).  However all options are included here whether or not they are
+fully documented.
+
+Patches to improve incomplete items (or any other item) would be
+greatfully received on the xen-devel@lists.xensource.com mailing
+list. Please see L<http://wiki.xen.org/wiki/SubmittingXenPatches> for
+information on how to submit a patch to Xen.
+

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:33 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8q-0002jY-SU; Mon, 20 Feb 2012 22:55:32 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8p-0002dE-GD
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:31 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1329778523!4947558!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29615 invoked from network); 20 Feb 2012 22:55:24 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8g-0005HU-K7
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:22 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8g-0006kc-IC
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:22 +0000
Message-Id: <E1Rzc8g-0006kc-IC@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Add xlcpupool.cfg man page
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1329762404 0
# Node ID 79fcf8a6ab559d6cdd5ebaea0b2caa5da4931b82
# Parent  a9166b2f41eadca9827221548131f6824f3e346d
Add xlcpupool.cfg man page

Add a man page describing the configuration file for creating cpupools
via xl cpupool-create.

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


diff -r a9166b2f41ea -r 79fcf8a6ab55 docs/man/xlcpupool.cfg.pod.5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/man/xlcpupool.cfg.pod.5	Mon Feb 20 18:26:44 2012 +0000
@@ -0,0 +1,117 @@
+=head1 NAME
+
+xlcpupool.cfg - XL Cpupool Configuration File Syntax
+
+=head1 SYNOPSIS
+
+ /etc/xen/xlcpupool
+
+=head1 DESCRIPTION
+
+To create a Cpupool with xl requires the provision of a cpupool config
+file.  Typically these live in `/etc/xen/CPUPOOL.cfg` where CPUPOOL is
+the name of the cpupool.
+
+=head1 SYNTAX
+
+A cpupool config file consists of a series of C<KEY=VALUE> pairs.
+
+A value C<VALUE> is one of:
+
+=over 4
+
+=item B<"STRING">
+
+A string, surrounded by either single or double quotes.
+
+=item B<NUMBER>
+
+A number, in either decimal, octal (using a C<0> prefix) or
+hexadecimal (using an C<0x> prefix).
+
+=item B<[ VALUE, VALUE, ... ]>
+
+A list of C<VALUES> of the above types. Lists are homogeneous and are
+not nested.
+
+=back
+
+The semantics of each C<KEY> defines which form of C<VALUE> is required.
+
+=head1 OPTIONS
+
+=head2 Mandatory Configuration Items
+
+The following key is mandatory for any cpupool:
+
+=over 4
+
+=item B<name="NAME">
+
+Specifies the name of the cpupool.  Names of cpupools existing on a
+single host must be unique.
+
+=back
+
+=head2 Optional Configuration Items
+
+The following options apply to guests of any type.
+
+=over 4
+
+=item B<sched="SCHED">
+
+Specifies the scheduler which is used for the cpupool. Valid
+values for C<SCHED> are:
+
+=over 4
+
+=item B<credit>
+
+the credit scheduler
+
+=item B<credit2>
+
+the credit2 scheduler
+
+=item B<sedf>
+
+the SEDF scheduler
+
+=back
+
+The default scheduler is the one used for C<Pool-0> specified as
+boot parameter of the hypervisor.
+
+=item B<nodes="NODES">
+
+Specifies the cpus of the NUMA-nodes given in C<NODES> (an integer or
+a list of integers) to be member of the cpupool. The free cpus in the
+specified nodes are allocated in the new cpupool.
+
+=item B<cpus="CPUS">
+
+The specified C<CPUS> are allocated in the new cpupool. All cpus must
+be free. Must not be specified together with B<nodes>.
+
+If neither B<nodes> nor B<cpus> are specified only the first free cpu
+found will be allocated in the new cpupool.
+
+=back
+
+=head1 FILES
+
+F</etc/xen/CPUPOOL.cfg>
+
+=head1 BUGS
+
+This document is a work in progress and contains items which require
+further documentation and which are generally incomplete (marked with
+XXX).  However all options are included here whether or not they are
+fully documented.
+
+Patches to improve incomplete items (or any other item) would be
+greatfully received on the xen-devel@lists.xensource.com mailing
+list. Please see L<http://wiki.xen.org/wiki/SubmittingXenPatches> for
+information on how to submit a patch to Xen.
+

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:33 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8p-0002iX-Lj; Mon, 20 Feb 2012 22:55:31 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8n-0002cj-HZ
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:29 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-216.messagelabs.com!1329778521!12032630!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20221 invoked from network); 20 Feb 2012 22:55:22 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:22 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8f-0005HO-9g
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8f-0006jo-3K
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:21 +0000
Message-Id: <E1Rzc8f-0006jo-3K@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl.cfg: fix gfx_passthru string
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329761392 0
# Node ID abd7f154fc1e9abe570b6e27d934c6428c267bb9
# Parent  dd3b13d855047fd2d8f7a99e2073e55747306252
xl.cfg: fix gfx_passthru string

Use correct string for gfx_passthru, and fix comment typo in xmexample.hvm

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


diff -r dd3b13d85504 -r abd7f154fc1e docs/man/xl.cfg.pod.5
--- a/docs/man/xl.cfg.pod.5	Mon Feb 20 18:09:03 2012 +0000
+++ b/docs/man/xl.cfg.pod.5	Mon Feb 20 18:09:52 2012 +0000
@@ -820,7 +820,7 @@
 
 =over 4
 
-=item B<gfx_passthrough=BOOLEAN>
+=item B<gfx_passthru=BOOLEAN>
 
 Enable graphics device PCI passthrough. XXX which device is passed through ?
 
diff -r dd3b13d85504 -r abd7f154fc1e tools/examples/xmexample.hvm
--- a/tools/examples/xmexample.hvm	Mon Feb 20 18:09:03 2012 +0000
+++ b/tools/examples/xmexample.hvm	Mon Feb 20 18:09:52 2012 +0000
@@ -346,7 +346,7 @@
 
 #   Enable graphics passthrough:
 #
-#   If it's set, and specify grapchis device BDF in pci passthrough option,
+#   If it's set, and specify graphics device BDF in pci passthrough option,
 # like pci=['xx:xx.x'], it enables graphics passthrough, default=0 (disabled)
 #gfx_passthru=0
 

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:33 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8p-0002iX-Lj; Mon, 20 Feb 2012 22:55:31 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8n-0002cj-HZ
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:29 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-216.messagelabs.com!1329778521!12032630!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20221 invoked from network); 20 Feb 2012 22:55:22 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:22 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8f-0005HO-9g
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8f-0006jo-3K
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:21 +0000
Message-Id: <E1Rzc8f-0006jo-3K@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl.cfg: fix gfx_passthru string
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329761392 0
# Node ID abd7f154fc1e9abe570b6e27d934c6428c267bb9
# Parent  dd3b13d855047fd2d8f7a99e2073e55747306252
xl.cfg: fix gfx_passthru string

Use correct string for gfx_passthru, and fix comment typo in xmexample.hvm

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


diff -r dd3b13d85504 -r abd7f154fc1e docs/man/xl.cfg.pod.5
--- a/docs/man/xl.cfg.pod.5	Mon Feb 20 18:09:03 2012 +0000
+++ b/docs/man/xl.cfg.pod.5	Mon Feb 20 18:09:52 2012 +0000
@@ -820,7 +820,7 @@
 
 =over 4
 
-=item B<gfx_passthrough=BOOLEAN>
+=item B<gfx_passthru=BOOLEAN>
 
 Enable graphics device PCI passthrough. XXX which device is passed through ?
 
diff -r dd3b13d85504 -r abd7f154fc1e tools/examples/xmexample.hvm
--- a/tools/examples/xmexample.hvm	Mon Feb 20 18:09:03 2012 +0000
+++ b/tools/examples/xmexample.hvm	Mon Feb 20 18:09:52 2012 +0000
@@ -346,7 +346,7 @@
 
 #   Enable graphics passthrough:
 #
-#   If it's set, and specify grapchis device BDF in pci passthrough option,
+#   If it's set, and specify graphics device BDF in pci passthrough option,
 # like pci=['xx:xx.x'], it enables graphics passthrough, default=0 (disabled)
 #gfx_passthru=0
 

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:33 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8q-0002jO-PK; Mon, 20 Feb 2012 22:55:32 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8p-0002d6-8L
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:31 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1329778523!14145479!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5401 invoked from network); 20 Feb 2012 22:55:24 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8h-0005HX-B3
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8h-0006l2-7u
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:23 +0000
Message-Id: <E1Rzc8h-0006l2-7u@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:22 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] oxenstored: Fix spelling of
	"persistent" config variable
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1329762571 0
# Node ID a9b81a8014ec0749ed1d7b05a6aef3e15e30228c
# Parent  79fcf8a6ab559d6cdd5ebaea0b2caa5da4931b82
oxenstored: Fix spelling of "persistent" config variable

Change "persistant" to "persistent", in the code and the
example/default config.

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


diff -r 79fcf8a6ab55 -r a9b81a8014ec tools/ocaml/xenstored/oxenstored.conf
--- a/tools/ocaml/xenstored/oxenstored.conf	Mon Feb 20 18:26:44 2012 +0000
+++ b/tools/ocaml/xenstored/oxenstored.conf	Mon Feb 20 18:29:31 2012 +0000
@@ -20,7 +20,7 @@
 quota-transaction = 10
 
 # Activate filed base backend
-persistant = false
+persistent = false
 
 # Xenstored logs
 # xenstored-log-file = /var/log/xenstored.log
diff -r 79fcf8a6ab55 -r a9b81a8014ec tools/ocaml/xenstored/xenstored.ml
--- a/tools/ocaml/xenstored/xenstored.ml	Mon Feb 20 18:26:44 2012 +0000
+++ b/tools/ocaml/xenstored/xenstored.ml	Mon Feb 20 18:29:31 2012 +0000
@@ -86,7 +86,7 @@
 		("quota-maxentity", Config.Set_int Quota.maxent);
 		("quota-maxsize", Config.Set_int Quota.maxsize);
 		("test-eagain", Config.Set_bool Transaction.test_eagain);
-		("persistant", Config.Set_bool Disk.enable);
+		("persistent", Config.Set_bool Disk.enable);
 		("xenstored-log-file", Config.Set_string Logging.xenstored_log_file);
 		("xenstored-log-level", Config.String
 			(fun s -> Logging.xenstored_log_level := Logging.level_of_string s));

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

From xen-changelog-bounces@lists.xen.org Mon Feb 20 22:55:33 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2012 22:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1Rzc8q-0002jO-PK; Mon, 20 Feb 2012 22:55:32 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8p-0002d6-8L
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:31 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1329778523!14145479!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5401 invoked from network); 20 Feb 2012 22:55:24 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Feb 2012 22:55:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8h-0005HX-B3
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Rzc8h-0006l2-7u
	for xen-changelog@lists.xensource.com; Mon, 20 Feb 2012 22:55:23 +0000
Message-Id: <E1Rzc8h-0006l2-7u@xenbits.xen.org>
Date: Mon, 20 Feb 2012 22:55:22 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] oxenstored: Fix spelling of
	"persistent" config variable
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1329762571 0
# Node ID a9b81a8014ec0749ed1d7b05a6aef3e15e30228c
# Parent  79fcf8a6ab559d6cdd5ebaea0b2caa5da4931b82
oxenstored: Fix spelling of "persistent" config variable

Change "persistant" to "persistent", in the code and the
example/default config.

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


diff -r 79fcf8a6ab55 -r a9b81a8014ec tools/ocaml/xenstored/oxenstored.conf
--- a/tools/ocaml/xenstored/oxenstored.conf	Mon Feb 20 18:26:44 2012 +0000
+++ b/tools/ocaml/xenstored/oxenstored.conf	Mon Feb 20 18:29:31 2012 +0000
@@ -20,7 +20,7 @@
 quota-transaction = 10
 
 # Activate filed base backend
-persistant = false
+persistent = false
 
 # Xenstored logs
 # xenstored-log-file = /var/log/xenstored.log
diff -r 79fcf8a6ab55 -r a9b81a8014ec tools/ocaml/xenstored/xenstored.ml
--- a/tools/ocaml/xenstored/xenstored.ml	Mon Feb 20 18:26:44 2012 +0000
+++ b/tools/ocaml/xenstored/xenstored.ml	Mon Feb 20 18:29:31 2012 +0000
@@ -86,7 +86,7 @@
 		("quota-maxentity", Config.Set_int Quota.maxent);
 		("quota-maxsize", Config.Set_int Quota.maxsize);
 		("test-eagain", Config.Set_bool Transaction.test_eagain);
-		("persistant", Config.Set_bool Disk.enable);
+		("persistent", Config.Set_bool Disk.enable);
 		("xenstored-log-file", Config.Set_string Logging.xenstored_log_file);
 		("xenstored-log-level", Config.String
 			(fun s -> Logging.xenstored_log_level := Logging.level_of_string s));

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05ah-0004jh-TN; Wed, 22 Feb 2012 06:22:15 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ag-0004jQ-PG
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:14 +0000
Received: from [85.158.139.83:19058] by server-1.bemta-5.messagelabs.com id
	60/E8-28458-599844F4; Wed, 22 Feb 2012 06:22:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-182.messagelabs.com!1329891732!16085443!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22138 invoked from network); 22 Feb 2012 06:22:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ae-0004RT-3y
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ad-00012e-VW
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:11 +0000
Message-Id: <E1S05ad-00012e-VW@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] minios: Remove unused variables
	warnings
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1329763712 0
# Node ID c78636d15ac53b0ba3b52da496a2abe592ffb84c
# Parent  3059bc2c14f710b50133d8fcccc985413bdd0c11
minios: Remove unused variables warnings

s/DEBUG/printk/ in test_xenbus and all associated do_*_test+xenbus_dbg_message
and always print the IRQ and MFN used by the xenbus on init.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Tested-by: John McDermott <john.mcdermott@nrl.navy.mil>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 3059bc2c14f7 -r c78636d15ac5 extras/mini-os/xenbus/xenbus.c
--- a/extras/mini-os/xenbus/xenbus.c	Mon Feb 20 18:45:29 2012 +0000
+++ b/extras/mini-os/xenbus/xenbus.c	Mon Feb 20 18:48:32 2012 +0000
@@ -328,7 +328,6 @@
 void init_xenbus(void)
 {
     int err;
-    printk("Initialising xenbus\n");
     DEBUG("init_xenbus called.\n");
     xenstore_buf = mfn_to_virt(start_info.store_mfn);
     create_thread("xenstore", xenbus_thread_func, NULL);
@@ -337,7 +336,8 @@
 		      xenbus_evtchn_handler,
               NULL);
     unmask_evtchn(start_info.store_evtchn);
-    DEBUG("xenbus on irq %d\n", err);
+    printk("xenbus initialised on irq %d mfn %#lx\n",
+	   err, start_info.store_mfn);
 }
 
 void fini_xenbus(void)
@@ -478,7 +478,7 @@
     struct xsd_sockmsg *reply;
 
     reply = xenbus_msg_reply(XS_DEBUG, 0, req, ARRAY_SIZE(req));
-    DEBUG("Got a reply, type %d, id %d, len %d.\n",
+    printk("Got a reply, type %d, id %d, len %d.\n",
             reply->type, reply->req_id, reply->len);
 }
 
@@ -752,16 +752,16 @@
     char **dirs, *msg;
     int x;
 
-    DEBUG("ls %s...\n", pre);
+    printk("ls %s...\n", pre);
     msg = xenbus_ls(XBT_NIL, pre, &dirs);
     if (msg) {
-	DEBUG("Error in xenbus ls: %s\n", msg);
+	printk("Error in xenbus ls: %s\n", msg);
 	free(msg);
 	return;
     }
     for (x = 0; dirs[x]; x++) 
     {
-        DEBUG("ls %s[%d] -> %s\n", pre, x, dirs[x]);
+        printk("ls %s[%d] -> %s\n", pre, x, dirs[x]);
         free(dirs[x]);
     }
     free(dirs);
@@ -770,68 +770,68 @@
 static void do_read_test(const char *path)
 {
     char *res, *msg;
-    DEBUG("Read %s...\n", path);
+    printk("Read %s...\n", path);
     msg = xenbus_read(XBT_NIL, path, &res);
     if (msg) {
-	DEBUG("Error in xenbus read: %s\n", msg);
+	printk("Error in xenbus read: %s\n", msg);
 	free(msg);
 	return;
     }
-    DEBUG("Read %s -> %s.\n", path, res);
+    printk("Read %s -> %s.\n", path, res);
     free(res);
 }
 
 static void do_write_test(const char *path, const char *val)
 {
     char *msg;
-    DEBUG("Write %s to %s...\n", val, path);
+    printk("Write %s to %s...\n", val, path);
     msg = xenbus_write(XBT_NIL, path, val);
     if (msg) {
-	DEBUG("Result %s\n", msg);
+	printk("Result %s\n", msg);
 	free(msg);
     } else {
-	DEBUG("Success.\n");
+	printk("Success.\n");
     }
 }
 
 static void do_rm_test(const char *path)
 {
     char *msg;
-    DEBUG("rm %s...\n", path);
+    printk("rm %s...\n", path);
     msg = xenbus_rm(XBT_NIL, path);
     if (msg) {
-	DEBUG("Result %s\n", msg);
+	printk("Result %s\n", msg);
 	free(msg);
     } else {
-	DEBUG("Success.\n");
+	printk("Success.\n");
     }
 }
 
 /* Simple testing thing */
 void test_xenbus(void)
 {
-    DEBUG("Doing xenbus test.\n");
+    printk("Doing xenbus test.\n");
     xenbus_debug_msg("Testing xenbus...\n");
 
-    DEBUG("Doing ls test.\n");
+    printk("Doing ls test.\n");
     do_ls_test("device");
     do_ls_test("device/vif");
     do_ls_test("device/vif/0");
 
-    DEBUG("Doing read test.\n");
+    printk("Doing read test.\n");
     do_read_test("device/vif/0/mac");
     do_read_test("device/vif/0/backend");
 
-    DEBUG("Doing write test.\n");
+    printk("Doing write test.\n");
     do_write_test("device/vif/0/flibble", "flobble");
     do_read_test("device/vif/0/flibble");
     do_write_test("device/vif/0/flibble", "widget");
     do_read_test("device/vif/0/flibble");
 
-    DEBUG("Doing rm test.\n");
+    printk("Doing rm test.\n");
     do_rm_test("device/vif/0/flibble");
     do_read_test("device/vif/0/flibble");
-    DEBUG("(Should have said ENOENT)\n");
+    printk("(Should have said ENOENT)\n");
 }
 
 /*

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05ah-0004jh-TN; Wed, 22 Feb 2012 06:22:15 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ag-0004jQ-PG
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:14 +0000
Received: from [85.158.139.83:19058] by server-1.bemta-5.messagelabs.com id
	60/E8-28458-599844F4; Wed, 22 Feb 2012 06:22:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-182.messagelabs.com!1329891732!16085443!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22138 invoked from network); 22 Feb 2012 06:22:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ae-0004RT-3y
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ad-00012e-VW
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:11 +0000
Message-Id: <E1S05ad-00012e-VW@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] minios: Remove unused variables
	warnings
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1329763712 0
# Node ID c78636d15ac53b0ba3b52da496a2abe592ffb84c
# Parent  3059bc2c14f710b50133d8fcccc985413bdd0c11
minios: Remove unused variables warnings

s/DEBUG/printk/ in test_xenbus and all associated do_*_test+xenbus_dbg_message
and always print the IRQ and MFN used by the xenbus on init.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Tested-by: John McDermott <john.mcdermott@nrl.navy.mil>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 3059bc2c14f7 -r c78636d15ac5 extras/mini-os/xenbus/xenbus.c
--- a/extras/mini-os/xenbus/xenbus.c	Mon Feb 20 18:45:29 2012 +0000
+++ b/extras/mini-os/xenbus/xenbus.c	Mon Feb 20 18:48:32 2012 +0000
@@ -328,7 +328,6 @@
 void init_xenbus(void)
 {
     int err;
-    printk("Initialising xenbus\n");
     DEBUG("init_xenbus called.\n");
     xenstore_buf = mfn_to_virt(start_info.store_mfn);
     create_thread("xenstore", xenbus_thread_func, NULL);
@@ -337,7 +336,8 @@
 		      xenbus_evtchn_handler,
               NULL);
     unmask_evtchn(start_info.store_evtchn);
-    DEBUG("xenbus on irq %d\n", err);
+    printk("xenbus initialised on irq %d mfn %#lx\n",
+	   err, start_info.store_mfn);
 }
 
 void fini_xenbus(void)
@@ -478,7 +478,7 @@
     struct xsd_sockmsg *reply;
 
     reply = xenbus_msg_reply(XS_DEBUG, 0, req, ARRAY_SIZE(req));
-    DEBUG("Got a reply, type %d, id %d, len %d.\n",
+    printk("Got a reply, type %d, id %d, len %d.\n",
             reply->type, reply->req_id, reply->len);
 }
 
@@ -752,16 +752,16 @@
     char **dirs, *msg;
     int x;
 
-    DEBUG("ls %s...\n", pre);
+    printk("ls %s...\n", pre);
     msg = xenbus_ls(XBT_NIL, pre, &dirs);
     if (msg) {
-	DEBUG("Error in xenbus ls: %s\n", msg);
+	printk("Error in xenbus ls: %s\n", msg);
 	free(msg);
 	return;
     }
     for (x = 0; dirs[x]; x++) 
     {
-        DEBUG("ls %s[%d] -> %s\n", pre, x, dirs[x]);
+        printk("ls %s[%d] -> %s\n", pre, x, dirs[x]);
         free(dirs[x]);
     }
     free(dirs);
@@ -770,68 +770,68 @@
 static void do_read_test(const char *path)
 {
     char *res, *msg;
-    DEBUG("Read %s...\n", path);
+    printk("Read %s...\n", path);
     msg = xenbus_read(XBT_NIL, path, &res);
     if (msg) {
-	DEBUG("Error in xenbus read: %s\n", msg);
+	printk("Error in xenbus read: %s\n", msg);
 	free(msg);
 	return;
     }
-    DEBUG("Read %s -> %s.\n", path, res);
+    printk("Read %s -> %s.\n", path, res);
     free(res);
 }
 
 static void do_write_test(const char *path, const char *val)
 {
     char *msg;
-    DEBUG("Write %s to %s...\n", val, path);
+    printk("Write %s to %s...\n", val, path);
     msg = xenbus_write(XBT_NIL, path, val);
     if (msg) {
-	DEBUG("Result %s\n", msg);
+	printk("Result %s\n", msg);
 	free(msg);
     } else {
-	DEBUG("Success.\n");
+	printk("Success.\n");
     }
 }
 
 static void do_rm_test(const char *path)
 {
     char *msg;
-    DEBUG("rm %s...\n", path);
+    printk("rm %s...\n", path);
     msg = xenbus_rm(XBT_NIL, path);
     if (msg) {
-	DEBUG("Result %s\n", msg);
+	printk("Result %s\n", msg);
 	free(msg);
     } else {
-	DEBUG("Success.\n");
+	printk("Success.\n");
     }
 }
 
 /* Simple testing thing */
 void test_xenbus(void)
 {
-    DEBUG("Doing xenbus test.\n");
+    printk("Doing xenbus test.\n");
     xenbus_debug_msg("Testing xenbus...\n");
 
-    DEBUG("Doing ls test.\n");
+    printk("Doing ls test.\n");
     do_ls_test("device");
     do_ls_test("device/vif");
     do_ls_test("device/vif/0");
 
-    DEBUG("Doing read test.\n");
+    printk("Doing read test.\n");
     do_read_test("device/vif/0/mac");
     do_read_test("device/vif/0/backend");
 
-    DEBUG("Doing write test.\n");
+    printk("Doing write test.\n");
     do_write_test("device/vif/0/flibble", "flobble");
     do_read_test("device/vif/0/flibble");
     do_write_test("device/vif/0/flibble", "widget");
     do_read_test("device/vif/0/flibble");
 
-    DEBUG("Doing rm test.\n");
+    printk("Doing rm test.\n");
     do_rm_test("device/vif/0/flibble");
     do_read_test("device/vif/0/flibble");
-    DEBUG("(Should have said ENOENT)\n");
+    printk("(Should have said ENOENT)\n");
 }
 
 /*

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05ah-0004jc-QV; Wed, 22 Feb 2012 06:22:15 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ag-0004jS-PL
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1329891679!53732587!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13815 invoked from network); 22 Feb 2012 06:21:20 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:21:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ae-0004RW-Ho
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ae-000131-GM
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:12 +0000
Message-Id: <E1S05ae-000131-GM@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs/man: correct autoballoon in
	xl.conf
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329764217 0
# Node ID 0da2e4935a7b60033b98eb77da2b9bf116d05ac2
# Parent  c78636d15ac53b0ba3b52da496a2abe592ffb84c
docs/man: correct autoballoon in xl.conf

Correct wording and default value of autoballoon= in xl.conf(5)
to match code and supplied xl.conf.

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


diff -r c78636d15ac5 -r 0da2e4935a7b docs/man/xl.conf.pod.5
--- a/docs/man/xl.conf.pod.5	Mon Feb 20 18:48:32 2012 +0000
+++ b/docs/man/xl.conf.pod.5	Mon Feb 20 18:56:57 2012 +0000
@@ -47,13 +47,13 @@
 
 =item B<autoballoon=BOOLEAN>
 
-If enabled then C<xl> will not attempt to reduce the amount of memory
+If disabled then C<xl> will not attempt to reduce the amount of memory
 assigned to domain 0 in order to create free memory when starting a
 new domain. You should set this if you use the C<dom0_mem> hypervisor
 command line to reduce the amount of memory given to domain 0 by
 default.
 
-Default: C<0>
+Default: C<1>
 
 =item B<lockfile="PATH">
 

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05ah-0004jc-QV; Wed, 22 Feb 2012 06:22:15 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ag-0004jS-PL
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1329891679!53732587!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13815 invoked from network); 22 Feb 2012 06:21:20 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:21:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ae-0004RW-Ho
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ae-000131-GM
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:12 +0000
Message-Id: <E1S05ae-000131-GM@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs/man: correct autoballoon in
	xl.conf
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329764217 0
# Node ID 0da2e4935a7b60033b98eb77da2b9bf116d05ac2
# Parent  c78636d15ac53b0ba3b52da496a2abe592ffb84c
docs/man: correct autoballoon in xl.conf

Correct wording and default value of autoballoon= in xl.conf(5)
to match code and supplied xl.conf.

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


diff -r c78636d15ac5 -r 0da2e4935a7b docs/man/xl.conf.pod.5
--- a/docs/man/xl.conf.pod.5	Mon Feb 20 18:48:32 2012 +0000
+++ b/docs/man/xl.conf.pod.5	Mon Feb 20 18:56:57 2012 +0000
@@ -47,13 +47,13 @@
 
 =item B<autoballoon=BOOLEAN>
 
-If enabled then C<xl> will not attempt to reduce the amount of memory
+If disabled then C<xl> will not attempt to reduce the amount of memory
 assigned to domain 0 in order to create free memory when starting a
 new domain. You should set this if you use the C<dom0_mem> hypervisor
 command line to reduce the amount of memory given to domain 0 by
 default.
 
-Default: C<0>
+Default: C<1>
 
 =item B<lockfile="PATH">
 

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05an-0004lY-FA; Wed, 22 Feb 2012 06:22:21 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05al-0004jT-SL
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1329891731!9041349!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25938 invoked from network); 22 Feb 2012 06:22:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ad-0004RQ-JJ
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ad-00012G-Df
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:11 +0000
Message-Id: <E1S05ad-00012G-Df@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Set VNC password through QMP
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1329763529 0
# Node ID 3059bc2c14f710b50133d8fcccc985413bdd0c11
# Parent  2c2afbd7cef7f497423fedb5ffe2af3b4df6f133
libxl: Set VNC password through QMP

This patch provide the code to set the VNC password to QEMU upstream through
VNC. The password is still stored in xenstore but will not be used by QEMU
upstream.

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


diff -r 2c2afbd7cef7 -r 3059bc2c14f7 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Mon Feb 20 18:45:29 2012 +0000
+++ b/tools/libxl/libxl_create.c	Mon Feb 20 18:45:29 2012 +0000
@@ -594,7 +594,7 @@
     if (dm_starting) {
         if (d_config->b_info.device_model_version
             == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
-            libxl__qmp_initializations(gc, domid);
+            libxl__qmp_initializations(gc, domid, d_config);
         }
         ret = libxl__confirm_device_model_startup(gc, &state, dm_starting);
         if (ret < 0) {
diff -r 2c2afbd7cef7 -r 3059bc2c14f7 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Mon Feb 20 18:45:29 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Mon Feb 20 18:45:29 2012 +0000
@@ -361,10 +361,8 @@
     if (vnc) {
         int display = 0;
         const char *listen = "127.0.0.1";
+        char *vncarg = NULL;
 
-        if (vnc->passwd && vnc->passwd[0]) {
-            assert(!"missing code for supplying vnc password to qemu");
-        }
         flexarray_append(dm_args, "-vnc");
 
         if (vnc->display) {
@@ -377,13 +375,19 @@
         }
 
         if (strchr(listen, ':') != NULL)
-            flexarray_append(dm_args,
-                    libxl__sprintf(gc, "%s%s", listen,
-                        vnc->findunused ? ",to=99" : ""));
+            vncarg = libxl__sprintf(gc, "%s", listen);
         else
-            flexarray_append(dm_args,
-                    libxl__sprintf(gc, "%s:%d%s", listen, display,
-                        vnc->findunused ? ",to=99" : ""));
+            vncarg = libxl__sprintf(gc, "%s:%d", listen, display);
+        if (vnc->passwd && vnc->passwd[0]) {
+            vncarg = libxl__sprintf(gc, "%s,password", vncarg);
+        }
+        if (vnc->findunused) {
+            /* This option asks to QEMU to try this number of port before to
+             * give up.  So QEMU will try ports between $display and $display +
+             * 99.  This option needs to be the last one of the vnc options. */
+            vncarg = libxl__sprintf(gc, "%s,to=99", vncarg);
+        }
+        flexarray_append(dm_args, vncarg);
     }
     if (sdl) {
         flexarray_append(dm_args, "-sdl");
@@ -965,6 +969,8 @@
     }
 
     if (vnc && vnc->passwd) {
+        /* This xenstore key will only be used by qemu-xen-traditionnal.
+         * The code to supply vncpasswd to qemu-xen is later. */
 retry_transaction:
         /* Find uuid and the write the vnc password to xenstore for qemu. */
         t = xs_transaction_start(ctx->xsh);
diff -r 2c2afbd7cef7 -r 3059bc2c14f7 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Mon Feb 20 18:45:29 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Mon Feb 20 18:45:29 2012 +0000
@@ -1013,7 +1013,8 @@
 _hidden void libxl__qmp_cleanup(libxl__gc *gc, uint32_t domid);
 
 /* this helper calls qmp_initialize, query_serial and qmp_close */
-_hidden int libxl__qmp_initializations(libxl__gc *gc, uint32_t domid);
+_hidden int libxl__qmp_initializations(libxl__gc *gc, uint32_t domid,
+                                       const libxl_domain_config *guest_config);
 
 /* from libxl_json */
 #include <yajl/yajl_gen.h>
diff -r 2c2afbd7cef7 -r 3059bc2c14f7 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Mon Feb 20 18:45:29 2012 +0000
+++ b/tools/libxl/libxl_qmp.c	Mon Feb 20 18:45:29 2012 +0000
@@ -880,8 +880,33 @@
     return rc;
 }
 
-int libxl__qmp_initializations(libxl__gc *gc, uint32_t domid)
+static int qmp_change(libxl__gc *gc, libxl__qmp_handler *qmp,
+                      char *device, char *target, char *arg)
 {
+    flexarray_t *parameters = NULL;
+    libxl_key_value_list args = NULL;
+    int rc = 0;
+
+    parameters = flexarray_make(6, 1);
+    flexarray_append_pair(parameters, "device", device);
+    flexarray_append_pair(parameters, "target", target);
+    if (arg)
+        flexarray_append_pair(parameters, "arg", arg);
+    args = libxl__xs_kvs_of_flexarray(gc, parameters, parameters->count);
+    if (!args)
+        return ERROR_NOMEM;
+
+    rc = qmp_synchronous_send(qmp, "change", &args,
+                              NULL, NULL, qmp->timeout);
+
+    flexarray_free(parameters);
+    return rc;
+}
+
+int libxl__qmp_initializations(libxl__gc *gc, uint32_t domid,
+                               const libxl_domain_config *guest_config)
+{
+    const libxl_vnc_info *vnc = libxl__dm_vnc(guest_config);
     libxl__qmp_handler *qmp = NULL;
     int ret = 0;
 
@@ -889,6 +914,9 @@
     if (!qmp)
         return -1;
     ret = libxl__qmp_query_serial(qmp);
+    if (!ret && vnc && vnc->passwd) {
+        ret = qmp_change(gc, qmp, "vnc", "password", vnc->passwd);
+    }
     libxl__qmp_close(qmp);
     return ret;
 }

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05am-0004kP-00; Wed, 22 Feb 2012 06:22:20 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ak-0004jv-6b
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:18 +0000
Received: from [85.158.139.83:19227] by server-6.bemta-5.messagelabs.com id
	0C/2C-27305-999844F4; Wed, 22 Feb 2012 06:22:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-182.messagelabs.com!1329891734!15221507!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 740 invoked from network); 22 Feb 2012 06:22:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ag-0004Ri-MX
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ag-00014W-LB
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:14 +0000
Message-Id: <E1S05ag-00014W-LB@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: use flat index for
	pagefile and page-in requests
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329769124 -3600
# Node ID 06cf45130725c021623f9c20b9d3ac2f925922f2
# Parent  fd0a2cff16edafbd27f821dcc4464a4e6d6404fd
xenpaging: use flat index for pagefile and page-in requests

This change is based on an idea by <hongkaixing@huawei.com> and
<bicky.shi@huawei.com>.

Scanning the victims[] array is time consuming with a large number of
target pages. Replace the loop to find the slot in the pagefile which
holds the requested gfn with an index.

Remove the victims array and replace it with a flat array. This array
holds the gfn for a given slot in the pagefile. Adjust all users of the
victims array.

Rename variable in main() from i to slot to clearify the meaning.

Update xenpaging_evict_page() to pass a pointer to xen_pfn_t to
xc_map_foreign_pages().

Update policy_choose_victim() to return either a gfn or INVALID_MFN.

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


diff -r fd0a2cff16ed -r 06cf45130725 tools/xenpaging/policy.h
--- a/tools/xenpaging/policy.h	Tue Feb 21 16:44:15 2012 +0000
+++ b/tools/xenpaging/policy.h	Mon Feb 20 21:18:44 2012 +0100
@@ -29,7 +29,7 @@
 
 
 int policy_init(struct xenpaging *paging);
-int policy_choose_victim(struct xenpaging *paging, struct victim *victim);
+unsigned long policy_choose_victim(struct xenpaging *paging);
 void policy_notify_paged_out(unsigned long gfn);
 void policy_notify_paged_in(unsigned long gfn);
 void policy_notify_paged_in_nomru(unsigned long gfn);
diff -r fd0a2cff16ed -r 06cf45130725 tools/xenpaging/policy_default.c
--- a/tools/xenpaging/policy_default.c	Tue Feb 21 16:44:15 2012 +0000
+++ b/tools/xenpaging/policy_default.c	Mon Feb 20 21:18:44 2012 +0100
@@ -77,7 +77,7 @@
     return rc;
 }
 
-int policy_choose_victim(struct xenpaging *paging, struct victim *victim)
+unsigned long policy_choose_victim(struct xenpaging *paging)
 {
     xc_interface *xch = paging->xc_handle;
     unsigned long wrap = current_gfn;
@@ -102,16 +102,13 @@
                 /* One more round before returning ENOSPC */
                 continue;
             }
-            victim->gfn = INVALID_MFN;
-            return -ENOSPC;
+            return INVALID_MFN;
         }
     }
     while ( test_bit(current_gfn, bitmap) || test_bit(current_gfn, unconsumed) );
 
     set_bit(current_gfn, unconsumed);
-    victim->gfn = current_gfn;
-
-    return 0;
+    return current_gfn;
 }
 
 void policy_notify_paged_out(unsigned long gfn)
diff -r fd0a2cff16ed -r 06cf45130725 tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Tue Feb 21 16:44:15 2012 +0000
+++ b/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
@@ -430,6 +430,12 @@
     }
     DPRINTF("max_pages = %d\n", paging->max_pages);
 
+    /* Allocate indicies for pagefile slots */
+    paging->slot_to_gfn = calloc(paging->max_pages, sizeof(*paging->slot_to_gfn));
+    paging->gfn_to_slot = calloc(paging->max_pages, sizeof(*paging->gfn_to_slot));
+    if ( !paging->slot_to_gfn || !paging->gfn_to_slot )
+        goto err;
+
     /* Initialise policy */
     rc = policy_init(paging);
     if ( rc != 0 )
@@ -468,6 +474,8 @@
 
         free(dom_path);
         free(watch_target_tot_pages);
+        free(paging->slot_to_gfn);
+        free(paging->gfn_to_slot);
         free(paging->bitmap);
         free(paging);
     }
@@ -561,31 +569,29 @@
     RING_PUSH_RESPONSES(back_ring);
 }
 
-static int xenpaging_evict_page(struct xenpaging *paging, struct victim *victim, int fd, int i)
+static int xenpaging_evict_page(struct xenpaging *paging, unsigned long gfn, int fd, int slot)
 {
     xc_interface *xch = paging->xc_handle;
     void *page;
-    unsigned long gfn;
+    xen_pfn_t victim = gfn;
     int ret;
 
     DECLARE_DOMCTL;
 
     /* Map page */
-    gfn = victim->gfn;
     ret = -EFAULT;
-    page = xc_map_foreign_pages(xch, paging->mem_event.domain_id,
-                                PROT_READ, &gfn, 1);
+    page = xc_map_foreign_pages(xch, paging->mem_event.domain_id, PROT_READ, &victim, 1);
     if ( page == NULL )
     {
-        PERROR("Error mapping page %lx", victim->gfn);
+        PERROR("Error mapping page %lx", gfn);
         goto out;
     }
 
     /* Copy page */
-    ret = write_page(fd, page, i);
+    ret = write_page(fd, page, slot);
     if ( ret != 0 )
     {
-        PERROR("Error copying page %lx", victim->gfn);
+        PERROR("Error copying page %lx", gfn);
         munmap(page, PAGE_SIZE);
         goto out;
     }
@@ -593,17 +599,20 @@
     munmap(page, PAGE_SIZE);
 
     /* Tell Xen to evict page */
-    ret = xc_mem_paging_evict(xch, paging->mem_event.domain_id,
-                              victim->gfn);
+    ret = xc_mem_paging_evict(xch, paging->mem_event.domain_id, gfn);
     if ( ret != 0 )
     {
-        PERROR("Error evicting page %lx", victim->gfn);
+        PERROR("Error evicting page %lx", gfn);
         goto out;
     }
 
-    DPRINTF("evict_page > gfn %lx pageslot %d\n", victim->gfn, i);
+    DPRINTF("evict_page > gfn %lx pageslot %d\n", gfn, slot);
     /* Notify policy of page being paged out */
-    policy_notify_paged_out(victim->gfn);
+    policy_notify_paged_out(gfn);
+
+    /* Update index */
+    paging->slot_to_gfn[slot] = gfn;
+    paging->gfn_to_slot[gfn] = slot;
 
     /* Record number of evicted pages */
     paging->num_paged_out++;
@@ -710,19 +719,19 @@
         page_in_trigger();
 }
 
-static int evict_victim(struct xenpaging *paging, struct victim *victim, int fd, int i)
+static int evict_victim(struct xenpaging *paging, int fd, int slot)
 {
     xc_interface *xch = paging->xc_handle;
+    unsigned long gfn;
     int j = 0;
     int ret;
 
     do
     {
-        ret = policy_choose_victim(paging, victim);
-        if ( ret != 0 )
+        gfn = policy_choose_victim(paging);
+        if ( gfn == INVALID_MFN )
         {
-            if ( ret != -ENOSPC )
-                ERROR("Error choosing victim");
+            ret = -ENOSPC;
             goto out;
         }
 
@@ -731,9 +740,9 @@
             ret = -EINTR;
             goto out;
         }
-        ret = xc_mem_paging_nominate(xch, paging->mem_event.domain_id, victim->gfn);
+        ret = xc_mem_paging_nominate(xch, paging->mem_event.domain_id, gfn);
         if ( ret == 0 )
-            ret = xenpaging_evict_page(paging, victim, fd, i);
+            ret = xenpaging_evict_page(paging, gfn, fd, slot);
         else
         {
             if ( j++ % 1000 == 0 )
@@ -743,7 +752,7 @@
     }
     while ( ret );
 
-    if ( test_and_set_bit(victim->gfn, paging->bitmap) )
+    if ( test_and_set_bit(gfn, paging->bitmap) )
         ERROR("Page has been evicted before");
 
     ret = 0;
@@ -753,7 +762,7 @@
 }
 
 /* Evict a batch of pages and write them to a free slot in the paging file */
-static int evict_pages(struct xenpaging *paging, int fd, struct victim *victims, int num_pages)
+static int evict_pages(struct xenpaging *paging, int fd, int num_pages)
 {
     xc_interface *xch = paging->xc_handle;
     int rc, slot, num = 0;
@@ -761,10 +770,10 @@
     for ( slot = 0; slot < paging->max_pages && num < num_pages; slot++ )
     {
         /* Slot is allocated */
-        if ( victims[slot].gfn != INVALID_MFN )
+        if ( paging->slot_to_gfn[slot] )
             continue;
 
-        rc = evict_victim(paging, &victims[slot], fd, slot);
+        rc = evict_victim(paging, fd, slot);
         if ( rc == -ENOSPC )
             break;
         if ( rc == -EINTR )
@@ -780,11 +789,10 @@
 {
     struct sigaction act;
     struct xenpaging *paging;
-    struct victim *victims;
     mem_event_request_t req;
     mem_event_response_t rsp;
     int num, prev_num = 0;
-    int i;
+    int slot;
     int tot_pages;
     int rc = -1;
     int rc1;
@@ -813,15 +821,6 @@
         return 2;
     }
 
-    /* Allocate upper limit of pages to allow growing and shrinking */
-    victims = calloc(paging->max_pages, sizeof(struct victim));
-    if ( !victims )
-        goto out;
-
-    /* Mark all slots as unallocated */
-    for ( i = 0; i < paging->max_pages; i++ )
-        victims[i].gfn = INVALID_MFN;
-
     /* ensure that if we get a signal, we'll do cleanup, then exit */
     act.sa_handler = close_handler;
     act.sa_flags = 0;
@@ -853,32 +852,35 @@
         {
             get_request(&paging->mem_event, &req);
 
+            if ( req.gfn > paging->max_pages )
+            {
+                ERROR("Requested gfn %"PRIx64" higher than max_pages %lx\n", req.gfn, paging->max_pages);
+                goto out;
+            }
+
             /* Check if the page has already been paged in */
             if ( test_and_clear_bit(req.gfn, paging->bitmap) )
             {
                 /* Find where in the paging file to read from */
-                for ( i = 0; i < paging->max_pages; i++ )
+                slot = paging->gfn_to_slot[req.gfn];
+
+                /* Sanity check */
+                if ( paging->slot_to_gfn[slot] != req.gfn )
                 {
-                    if ( victims[i].gfn == req.gfn )
-                        break;
-                }
-    
-                if ( i >= paging->max_pages )
-                {
-                    DPRINTF("Couldn't find page %"PRIx64"\n", req.gfn);
+                    ERROR("Expected gfn %"PRIx64" in slot %d, but found gfn %lx\n", req.gfn, slot, paging->slot_to_gfn[slot]);
                     goto out;
                 }
-                
+
                 if ( req.flags & MEM_EVENT_FLAG_DROP_PAGE )
                 {
-                    DPRINTF("drop_page ^ gfn %"PRIx64" pageslot %d\n", req.gfn, i);
+                    DPRINTF("drop_page ^ gfn %"PRIx64" pageslot %d\n", req.gfn, slot);
                     /* Notify policy of page being dropped */
                     policy_notify_dropped(req.gfn);
                 }
                 else
                 {
                     /* Populate the page */
-                    rc = xenpaging_populate_page(paging, req.gfn, fd, i);
+                    rc = xenpaging_populate_page(paging, req.gfn, fd, slot);
                     if ( rc != 0 )
                     {
                         PERROR("Error populating page %"PRIx64"", req.gfn);
@@ -899,7 +901,7 @@
                 }
 
                 /* Clear this pagefile slot */
-                victims[i].gfn = INVALID_MFN;
+                paging->slot_to_gfn[slot] = 0;
             }
             else
             {
@@ -969,7 +971,7 @@
             /* Limit the number of evicts to be able to process page-in requests */
             if ( num > 42 )
                 num = 42;
-            evict_pages(paging, fd, victims, num);
+            evict_pages(paging, fd, num);
         }
         /* Resume some pages if target not reached */
         else if ( tot_pages < paging->target_tot_pages && paging->num_paged_out )
@@ -989,7 +991,6 @@
  out:
     close(fd);
     unlink_pagefile();
-    free(victims);
 
     /* Tear down domain paging */
     rc1 = xenpaging_teardown(paging);
diff -r fd0a2cff16ed -r 06cf45130725 tools/xenpaging/xenpaging.h
--- a/tools/xenpaging/xenpaging.h	Tue Feb 21 16:44:15 2012 +0000
+++ b/tools/xenpaging/xenpaging.h	Mon Feb 20 21:18:44 2012 +0100
@@ -46,6 +46,9 @@
 
     unsigned long *bitmap;
 
+    unsigned long *slot_to_gfn;
+    int *gfn_to_slot;
+
     struct mem_event mem_event;
     /* number of pages for which data structures were allocated */
     int max_pages;
@@ -56,13 +59,6 @@
     unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE];
 };
 
-
-struct victim {
-    /* the gfn of the page to evict */
-    unsigned long gfn;
-};
-
-
 extern void create_page_in_thread(struct xenpaging *paging);
 extern void page_in_trigger(void);
 

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05am-0004kP-00; Wed, 22 Feb 2012 06:22:20 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ak-0004jv-6b
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:18 +0000
Received: from [85.158.139.83:19227] by server-6.bemta-5.messagelabs.com id
	0C/2C-27305-999844F4; Wed, 22 Feb 2012 06:22:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-182.messagelabs.com!1329891734!15221507!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 740 invoked from network); 22 Feb 2012 06:22:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ag-0004Ri-MX
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ag-00014W-LB
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:14 +0000
Message-Id: <E1S05ag-00014W-LB@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: use flat index for
	pagefile and page-in requests
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329769124 -3600
# Node ID 06cf45130725c021623f9c20b9d3ac2f925922f2
# Parent  fd0a2cff16edafbd27f821dcc4464a4e6d6404fd
xenpaging: use flat index for pagefile and page-in requests

This change is based on an idea by <hongkaixing@huawei.com> and
<bicky.shi@huawei.com>.

Scanning the victims[] array is time consuming with a large number of
target pages. Replace the loop to find the slot in the pagefile which
holds the requested gfn with an index.

Remove the victims array and replace it with a flat array. This array
holds the gfn for a given slot in the pagefile. Adjust all users of the
victims array.

Rename variable in main() from i to slot to clearify the meaning.

Update xenpaging_evict_page() to pass a pointer to xen_pfn_t to
xc_map_foreign_pages().

Update policy_choose_victim() to return either a gfn or INVALID_MFN.

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


diff -r fd0a2cff16ed -r 06cf45130725 tools/xenpaging/policy.h
--- a/tools/xenpaging/policy.h	Tue Feb 21 16:44:15 2012 +0000
+++ b/tools/xenpaging/policy.h	Mon Feb 20 21:18:44 2012 +0100
@@ -29,7 +29,7 @@
 
 
 int policy_init(struct xenpaging *paging);
-int policy_choose_victim(struct xenpaging *paging, struct victim *victim);
+unsigned long policy_choose_victim(struct xenpaging *paging);
 void policy_notify_paged_out(unsigned long gfn);
 void policy_notify_paged_in(unsigned long gfn);
 void policy_notify_paged_in_nomru(unsigned long gfn);
diff -r fd0a2cff16ed -r 06cf45130725 tools/xenpaging/policy_default.c
--- a/tools/xenpaging/policy_default.c	Tue Feb 21 16:44:15 2012 +0000
+++ b/tools/xenpaging/policy_default.c	Mon Feb 20 21:18:44 2012 +0100
@@ -77,7 +77,7 @@
     return rc;
 }
 
-int policy_choose_victim(struct xenpaging *paging, struct victim *victim)
+unsigned long policy_choose_victim(struct xenpaging *paging)
 {
     xc_interface *xch = paging->xc_handle;
     unsigned long wrap = current_gfn;
@@ -102,16 +102,13 @@
                 /* One more round before returning ENOSPC */
                 continue;
             }
-            victim->gfn = INVALID_MFN;
-            return -ENOSPC;
+            return INVALID_MFN;
         }
     }
     while ( test_bit(current_gfn, bitmap) || test_bit(current_gfn, unconsumed) );
 
     set_bit(current_gfn, unconsumed);
-    victim->gfn = current_gfn;
-
-    return 0;
+    return current_gfn;
 }
 
 void policy_notify_paged_out(unsigned long gfn)
diff -r fd0a2cff16ed -r 06cf45130725 tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Tue Feb 21 16:44:15 2012 +0000
+++ b/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
@@ -430,6 +430,12 @@
     }
     DPRINTF("max_pages = %d\n", paging->max_pages);
 
+    /* Allocate indicies for pagefile slots */
+    paging->slot_to_gfn = calloc(paging->max_pages, sizeof(*paging->slot_to_gfn));
+    paging->gfn_to_slot = calloc(paging->max_pages, sizeof(*paging->gfn_to_slot));
+    if ( !paging->slot_to_gfn || !paging->gfn_to_slot )
+        goto err;
+
     /* Initialise policy */
     rc = policy_init(paging);
     if ( rc != 0 )
@@ -468,6 +474,8 @@
 
         free(dom_path);
         free(watch_target_tot_pages);
+        free(paging->slot_to_gfn);
+        free(paging->gfn_to_slot);
         free(paging->bitmap);
         free(paging);
     }
@@ -561,31 +569,29 @@
     RING_PUSH_RESPONSES(back_ring);
 }
 
-static int xenpaging_evict_page(struct xenpaging *paging, struct victim *victim, int fd, int i)
+static int xenpaging_evict_page(struct xenpaging *paging, unsigned long gfn, int fd, int slot)
 {
     xc_interface *xch = paging->xc_handle;
     void *page;
-    unsigned long gfn;
+    xen_pfn_t victim = gfn;
     int ret;
 
     DECLARE_DOMCTL;
 
     /* Map page */
-    gfn = victim->gfn;
     ret = -EFAULT;
-    page = xc_map_foreign_pages(xch, paging->mem_event.domain_id,
-                                PROT_READ, &gfn, 1);
+    page = xc_map_foreign_pages(xch, paging->mem_event.domain_id, PROT_READ, &victim, 1);
     if ( page == NULL )
     {
-        PERROR("Error mapping page %lx", victim->gfn);
+        PERROR("Error mapping page %lx", gfn);
         goto out;
     }
 
     /* Copy page */
-    ret = write_page(fd, page, i);
+    ret = write_page(fd, page, slot);
     if ( ret != 0 )
     {
-        PERROR("Error copying page %lx", victim->gfn);
+        PERROR("Error copying page %lx", gfn);
         munmap(page, PAGE_SIZE);
         goto out;
     }
@@ -593,17 +599,20 @@
     munmap(page, PAGE_SIZE);
 
     /* Tell Xen to evict page */
-    ret = xc_mem_paging_evict(xch, paging->mem_event.domain_id,
-                              victim->gfn);
+    ret = xc_mem_paging_evict(xch, paging->mem_event.domain_id, gfn);
     if ( ret != 0 )
     {
-        PERROR("Error evicting page %lx", victim->gfn);
+        PERROR("Error evicting page %lx", gfn);
         goto out;
     }
 
-    DPRINTF("evict_page > gfn %lx pageslot %d\n", victim->gfn, i);
+    DPRINTF("evict_page > gfn %lx pageslot %d\n", gfn, slot);
     /* Notify policy of page being paged out */
-    policy_notify_paged_out(victim->gfn);
+    policy_notify_paged_out(gfn);
+
+    /* Update index */
+    paging->slot_to_gfn[slot] = gfn;
+    paging->gfn_to_slot[gfn] = slot;
 
     /* Record number of evicted pages */
     paging->num_paged_out++;
@@ -710,19 +719,19 @@
         page_in_trigger();
 }
 
-static int evict_victim(struct xenpaging *paging, struct victim *victim, int fd, int i)
+static int evict_victim(struct xenpaging *paging, int fd, int slot)
 {
     xc_interface *xch = paging->xc_handle;
+    unsigned long gfn;
     int j = 0;
     int ret;
 
     do
     {
-        ret = policy_choose_victim(paging, victim);
-        if ( ret != 0 )
+        gfn = policy_choose_victim(paging);
+        if ( gfn == INVALID_MFN )
         {
-            if ( ret != -ENOSPC )
-                ERROR("Error choosing victim");
+            ret = -ENOSPC;
             goto out;
         }
 
@@ -731,9 +740,9 @@
             ret = -EINTR;
             goto out;
         }
-        ret = xc_mem_paging_nominate(xch, paging->mem_event.domain_id, victim->gfn);
+        ret = xc_mem_paging_nominate(xch, paging->mem_event.domain_id, gfn);
         if ( ret == 0 )
-            ret = xenpaging_evict_page(paging, victim, fd, i);
+            ret = xenpaging_evict_page(paging, gfn, fd, slot);
         else
         {
             if ( j++ % 1000 == 0 )
@@ -743,7 +752,7 @@
     }
     while ( ret );
 
-    if ( test_and_set_bit(victim->gfn, paging->bitmap) )
+    if ( test_and_set_bit(gfn, paging->bitmap) )
         ERROR("Page has been evicted before");
 
     ret = 0;
@@ -753,7 +762,7 @@
 }
 
 /* Evict a batch of pages and write them to a free slot in the paging file */
-static int evict_pages(struct xenpaging *paging, int fd, struct victim *victims, int num_pages)
+static int evict_pages(struct xenpaging *paging, int fd, int num_pages)
 {
     xc_interface *xch = paging->xc_handle;
     int rc, slot, num = 0;
@@ -761,10 +770,10 @@
     for ( slot = 0; slot < paging->max_pages && num < num_pages; slot++ )
     {
         /* Slot is allocated */
-        if ( victims[slot].gfn != INVALID_MFN )
+        if ( paging->slot_to_gfn[slot] )
             continue;
 
-        rc = evict_victim(paging, &victims[slot], fd, slot);
+        rc = evict_victim(paging, fd, slot);
         if ( rc == -ENOSPC )
             break;
         if ( rc == -EINTR )
@@ -780,11 +789,10 @@
 {
     struct sigaction act;
     struct xenpaging *paging;
-    struct victim *victims;
     mem_event_request_t req;
     mem_event_response_t rsp;
     int num, prev_num = 0;
-    int i;
+    int slot;
     int tot_pages;
     int rc = -1;
     int rc1;
@@ -813,15 +821,6 @@
         return 2;
     }
 
-    /* Allocate upper limit of pages to allow growing and shrinking */
-    victims = calloc(paging->max_pages, sizeof(struct victim));
-    if ( !victims )
-        goto out;
-
-    /* Mark all slots as unallocated */
-    for ( i = 0; i < paging->max_pages; i++ )
-        victims[i].gfn = INVALID_MFN;
-
     /* ensure that if we get a signal, we'll do cleanup, then exit */
     act.sa_handler = close_handler;
     act.sa_flags = 0;
@@ -853,32 +852,35 @@
         {
             get_request(&paging->mem_event, &req);
 
+            if ( req.gfn > paging->max_pages )
+            {
+                ERROR("Requested gfn %"PRIx64" higher than max_pages %lx\n", req.gfn, paging->max_pages);
+                goto out;
+            }
+
             /* Check if the page has already been paged in */
             if ( test_and_clear_bit(req.gfn, paging->bitmap) )
             {
                 /* Find where in the paging file to read from */
-                for ( i = 0; i < paging->max_pages; i++ )
+                slot = paging->gfn_to_slot[req.gfn];
+
+                /* Sanity check */
+                if ( paging->slot_to_gfn[slot] != req.gfn )
                 {
-                    if ( victims[i].gfn == req.gfn )
-                        break;
-                }
-    
-                if ( i >= paging->max_pages )
-                {
-                    DPRINTF("Couldn't find page %"PRIx64"\n", req.gfn);
+                    ERROR("Expected gfn %"PRIx64" in slot %d, but found gfn %lx\n", req.gfn, slot, paging->slot_to_gfn[slot]);
                     goto out;
                 }
-                
+
                 if ( req.flags & MEM_EVENT_FLAG_DROP_PAGE )
                 {
-                    DPRINTF("drop_page ^ gfn %"PRIx64" pageslot %d\n", req.gfn, i);
+                    DPRINTF("drop_page ^ gfn %"PRIx64" pageslot %d\n", req.gfn, slot);
                     /* Notify policy of page being dropped */
                     policy_notify_dropped(req.gfn);
                 }
                 else
                 {
                     /* Populate the page */
-                    rc = xenpaging_populate_page(paging, req.gfn, fd, i);
+                    rc = xenpaging_populate_page(paging, req.gfn, fd, slot);
                     if ( rc != 0 )
                     {
                         PERROR("Error populating page %"PRIx64"", req.gfn);
@@ -899,7 +901,7 @@
                 }
 
                 /* Clear this pagefile slot */
-                victims[i].gfn = INVALID_MFN;
+                paging->slot_to_gfn[slot] = 0;
             }
             else
             {
@@ -969,7 +971,7 @@
             /* Limit the number of evicts to be able to process page-in requests */
             if ( num > 42 )
                 num = 42;
-            evict_pages(paging, fd, victims, num);
+            evict_pages(paging, fd, num);
         }
         /* Resume some pages if target not reached */
         else if ( tot_pages < paging->target_tot_pages && paging->num_paged_out )
@@ -989,7 +991,6 @@
  out:
     close(fd);
     unlink_pagefile();
-    free(victims);
 
     /* Tear down domain paging */
     rc1 = xenpaging_teardown(paging);
diff -r fd0a2cff16ed -r 06cf45130725 tools/xenpaging/xenpaging.h
--- a/tools/xenpaging/xenpaging.h	Tue Feb 21 16:44:15 2012 +0000
+++ b/tools/xenpaging/xenpaging.h	Mon Feb 20 21:18:44 2012 +0100
@@ -46,6 +46,9 @@
 
     unsigned long *bitmap;
 
+    unsigned long *slot_to_gfn;
+    int *gfn_to_slot;
+
     struct mem_event mem_event;
     /* number of pages for which data structures were allocated */
     int max_pages;
@@ -56,13 +59,6 @@
     unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE];
 };
 
-
-struct victim {
-    /* the gfn of the page to evict */
-    unsigned long gfn;
-};
-
-
 extern void create_page_in_thread(struct xenpaging *paging);
 extern void page_in_trigger(void);
 

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05an-0004lY-FA; Wed, 22 Feb 2012 06:22:21 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05al-0004jT-SL
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1329891731!9041349!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25938 invoked from network); 22 Feb 2012 06:22:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ad-0004RQ-JJ
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ad-00012G-Df
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:11 +0000
Message-Id: <E1S05ad-00012G-Df@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Set VNC password through QMP
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1329763529 0
# Node ID 3059bc2c14f710b50133d8fcccc985413bdd0c11
# Parent  2c2afbd7cef7f497423fedb5ffe2af3b4df6f133
libxl: Set VNC password through QMP

This patch provide the code to set the VNC password to QEMU upstream through
VNC. The password is still stored in xenstore but will not be used by QEMU
upstream.

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


diff -r 2c2afbd7cef7 -r 3059bc2c14f7 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Mon Feb 20 18:45:29 2012 +0000
+++ b/tools/libxl/libxl_create.c	Mon Feb 20 18:45:29 2012 +0000
@@ -594,7 +594,7 @@
     if (dm_starting) {
         if (d_config->b_info.device_model_version
             == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
-            libxl__qmp_initializations(gc, domid);
+            libxl__qmp_initializations(gc, domid, d_config);
         }
         ret = libxl__confirm_device_model_startup(gc, &state, dm_starting);
         if (ret < 0) {
diff -r 2c2afbd7cef7 -r 3059bc2c14f7 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Mon Feb 20 18:45:29 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Mon Feb 20 18:45:29 2012 +0000
@@ -361,10 +361,8 @@
     if (vnc) {
         int display = 0;
         const char *listen = "127.0.0.1";
+        char *vncarg = NULL;
 
-        if (vnc->passwd && vnc->passwd[0]) {
-            assert(!"missing code for supplying vnc password to qemu");
-        }
         flexarray_append(dm_args, "-vnc");
 
         if (vnc->display) {
@@ -377,13 +375,19 @@
         }
 
         if (strchr(listen, ':') != NULL)
-            flexarray_append(dm_args,
-                    libxl__sprintf(gc, "%s%s", listen,
-                        vnc->findunused ? ",to=99" : ""));
+            vncarg = libxl__sprintf(gc, "%s", listen);
         else
-            flexarray_append(dm_args,
-                    libxl__sprintf(gc, "%s:%d%s", listen, display,
-                        vnc->findunused ? ",to=99" : ""));
+            vncarg = libxl__sprintf(gc, "%s:%d", listen, display);
+        if (vnc->passwd && vnc->passwd[0]) {
+            vncarg = libxl__sprintf(gc, "%s,password", vncarg);
+        }
+        if (vnc->findunused) {
+            /* This option asks to QEMU to try this number of port before to
+             * give up.  So QEMU will try ports between $display and $display +
+             * 99.  This option needs to be the last one of the vnc options. */
+            vncarg = libxl__sprintf(gc, "%s,to=99", vncarg);
+        }
+        flexarray_append(dm_args, vncarg);
     }
     if (sdl) {
         flexarray_append(dm_args, "-sdl");
@@ -965,6 +969,8 @@
     }
 
     if (vnc && vnc->passwd) {
+        /* This xenstore key will only be used by qemu-xen-traditionnal.
+         * The code to supply vncpasswd to qemu-xen is later. */
 retry_transaction:
         /* Find uuid and the write the vnc password to xenstore for qemu. */
         t = xs_transaction_start(ctx->xsh);
diff -r 2c2afbd7cef7 -r 3059bc2c14f7 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Mon Feb 20 18:45:29 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Mon Feb 20 18:45:29 2012 +0000
@@ -1013,7 +1013,8 @@
 _hidden void libxl__qmp_cleanup(libxl__gc *gc, uint32_t domid);
 
 /* this helper calls qmp_initialize, query_serial and qmp_close */
-_hidden int libxl__qmp_initializations(libxl__gc *gc, uint32_t domid);
+_hidden int libxl__qmp_initializations(libxl__gc *gc, uint32_t domid,
+                                       const libxl_domain_config *guest_config);
 
 /* from libxl_json */
 #include <yajl/yajl_gen.h>
diff -r 2c2afbd7cef7 -r 3059bc2c14f7 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Mon Feb 20 18:45:29 2012 +0000
+++ b/tools/libxl/libxl_qmp.c	Mon Feb 20 18:45:29 2012 +0000
@@ -880,8 +880,33 @@
     return rc;
 }
 
-int libxl__qmp_initializations(libxl__gc *gc, uint32_t domid)
+static int qmp_change(libxl__gc *gc, libxl__qmp_handler *qmp,
+                      char *device, char *target, char *arg)
 {
+    flexarray_t *parameters = NULL;
+    libxl_key_value_list args = NULL;
+    int rc = 0;
+
+    parameters = flexarray_make(6, 1);
+    flexarray_append_pair(parameters, "device", device);
+    flexarray_append_pair(parameters, "target", target);
+    if (arg)
+        flexarray_append_pair(parameters, "arg", arg);
+    args = libxl__xs_kvs_of_flexarray(gc, parameters, parameters->count);
+    if (!args)
+        return ERROR_NOMEM;
+
+    rc = qmp_synchronous_send(qmp, "change", &args,
+                              NULL, NULL, qmp->timeout);
+
+    flexarray_free(parameters);
+    return rc;
+}
+
+int libxl__qmp_initializations(libxl__gc *gc, uint32_t domid,
+                               const libxl_domain_config *guest_config)
+{
+    const libxl_vnc_info *vnc = libxl__dm_vnc(guest_config);
     libxl__qmp_handler *qmp = NULL;
     int ret = 0;
 
@@ -889,6 +914,9 @@
     if (!qmp)
         return -1;
     ret = libxl__qmp_query_serial(qmp);
+    if (!ret && vnc && vnc->passwd) {
+        ret = qmp_change(gc, qmp, "vnc", "password", vnc->passwd);
+    }
     libxl__qmp_close(qmp);
     return ret;
 }

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05am-0004ke-5D; Wed, 22 Feb 2012 06:22:20 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05al-0004k1-8O
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:19 +0000
Received: from [85.158.139.83:19277] by server-5.bemta-5.messagelabs.com id
	74/4F-13566-A99844F4; Wed, 22 Feb 2012 06:22:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1329891736!13367809!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13180 invoked from network); 22 Feb 2012 06:22:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ai-0004Rr-DO
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ai-00015d-8C
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:16 +0000
Message-Id: <E1S05ai-00015d-8C@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: move nominate+evict into
	single function
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329769124 -3600
# Node ID 68f149bbee77b3ce12702475b27d3d5002cf4c19
# Parent  9e33293aee2abaac27962b8c7f6918f7094f2962
xenpaging: move nominate+evict into single function

Move all code to evict a single gfn into one function. This simplifies
error handling in caller. The function returns -1 on fatal error, 0 on
success and 1 if the gfn cant be paged.

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


diff -r 9e33293aee2a -r 68f149bbee77 tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
@@ -571,6 +571,11 @@
     RING_PUSH_RESPONSES(back_ring);
 }
 
+/* Evict a given gfn
+ * Returns < 0 on fatal error
+ * Returns 0 on successful evict
+ * Returns > 0 if gfn can not be evicted
+ */
 static int xenpaging_evict_page(struct xenpaging *paging, unsigned long gfn, int fd, int slot)
 {
     xc_interface *xch = paging->xc_handle;
@@ -580,31 +585,51 @@
 
     DECLARE_DOMCTL;
 
+    /* Nominate page */
+    ret = xc_mem_paging_nominate(xch, paging->mem_event.domain_id, gfn);
+    if ( ret < 0 )
+    {
+        /* unpageable gfn is indicated by EBUSY */
+        if ( errno == EBUSY )
+            ret = 1;
+        else
+            PERROR("Error nominating page %lx", gfn);
+        goto out;
+    }
+
     /* Map page */
-    ret = -EFAULT;
     page = xc_map_foreign_pages(xch, paging->mem_event.domain_id, PROT_READ, &victim, 1);
     if ( page == NULL )
     {
         PERROR("Error mapping page %lx", gfn);
+        ret = -1;
         goto out;
     }
 
     /* Copy page */
     ret = write_page(fd, page, slot);
-    if ( ret != 0 )
+    if ( ret < 0 )
     {
         PERROR("Error copying page %lx", gfn);
         munmap(page, PAGE_SIZE);
+        ret = -1;
         goto out;
     }
 
+    /* Release page */
     munmap(page, PAGE_SIZE);
 
     /* Tell Xen to evict page */
     ret = xc_mem_paging_evict(xch, paging->mem_event.domain_id, gfn);
-    if ( ret != 0 )
+    if ( ret < 0 )
     {
-        PERROR("Error evicting page %lx", gfn);
+        /* A gfn in use is indicated by EBUSY */
+        if ( errno == EBUSY )
+        {
+                ret = 1;
+                DPRINTF("Nominated page %lx busy", gfn);
+        } else
+            PERROR("Error evicting page %lx", gfn);
         goto out;
     }
 
@@ -619,6 +644,8 @@
     /* Record number of evicted pages */
     paging->num_paged_out++;
 
+    ret = 0;
+
  out:
     return ret;
 }
@@ -753,9 +780,10 @@
             ret = -EINTR;
             goto out;
         }
-        ret = xc_mem_paging_nominate(xch, paging->mem_event.domain_id, gfn);
-        if ( ret == 0 )
-            ret = xenpaging_evict_page(paging, gfn, fd, slot);
+
+        ret = xenpaging_evict_page(paging, gfn, fd, slot);
+        if ( ret < 0 )
+            goto out;
     }
     while ( ret );
 

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05am-0004ke-5D; Wed, 22 Feb 2012 06:22:20 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05al-0004k1-8O
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:19 +0000
Received: from [85.158.139.83:19277] by server-5.bemta-5.messagelabs.com id
	74/4F-13566-A99844F4; Wed, 22 Feb 2012 06:22:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1329891736!13367809!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13180 invoked from network); 22 Feb 2012 06:22:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ai-0004Rr-DO
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ai-00015d-8C
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:16 +0000
Message-Id: <E1S05ai-00015d-8C@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: move nominate+evict into
	single function
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329769124 -3600
# Node ID 68f149bbee77b3ce12702475b27d3d5002cf4c19
# Parent  9e33293aee2abaac27962b8c7f6918f7094f2962
xenpaging: move nominate+evict into single function

Move all code to evict a single gfn into one function. This simplifies
error handling in caller. The function returns -1 on fatal error, 0 on
success and 1 if the gfn cant be paged.

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


diff -r 9e33293aee2a -r 68f149bbee77 tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
@@ -571,6 +571,11 @@
     RING_PUSH_RESPONSES(back_ring);
 }
 
+/* Evict a given gfn
+ * Returns < 0 on fatal error
+ * Returns 0 on successful evict
+ * Returns > 0 if gfn can not be evicted
+ */
 static int xenpaging_evict_page(struct xenpaging *paging, unsigned long gfn, int fd, int slot)
 {
     xc_interface *xch = paging->xc_handle;
@@ -580,31 +585,51 @@
 
     DECLARE_DOMCTL;
 
+    /* Nominate page */
+    ret = xc_mem_paging_nominate(xch, paging->mem_event.domain_id, gfn);
+    if ( ret < 0 )
+    {
+        /* unpageable gfn is indicated by EBUSY */
+        if ( errno == EBUSY )
+            ret = 1;
+        else
+            PERROR("Error nominating page %lx", gfn);
+        goto out;
+    }
+
     /* Map page */
-    ret = -EFAULT;
     page = xc_map_foreign_pages(xch, paging->mem_event.domain_id, PROT_READ, &victim, 1);
     if ( page == NULL )
     {
         PERROR("Error mapping page %lx", gfn);
+        ret = -1;
         goto out;
     }
 
     /* Copy page */
     ret = write_page(fd, page, slot);
-    if ( ret != 0 )
+    if ( ret < 0 )
     {
         PERROR("Error copying page %lx", gfn);
         munmap(page, PAGE_SIZE);
+        ret = -1;
         goto out;
     }
 
+    /* Release page */
     munmap(page, PAGE_SIZE);
 
     /* Tell Xen to evict page */
     ret = xc_mem_paging_evict(xch, paging->mem_event.domain_id, gfn);
-    if ( ret != 0 )
+    if ( ret < 0 )
     {
-        PERROR("Error evicting page %lx", gfn);
+        /* A gfn in use is indicated by EBUSY */
+        if ( errno == EBUSY )
+        {
+                ret = 1;
+                DPRINTF("Nominated page %lx busy", gfn);
+        } else
+            PERROR("Error evicting page %lx", gfn);
         goto out;
     }
 
@@ -619,6 +644,8 @@
     /* Record number of evicted pages */
     paging->num_paged_out++;
 
+    ret = 0;
+
  out:
     return ret;
 }
@@ -753,9 +780,10 @@
             ret = -EINTR;
             goto out;
         }
-        ret = xc_mem_paging_nominate(xch, paging->mem_event.domain_id, gfn);
-        if ( ret == 0 )
-            ret = xenpaging_evict_page(paging, gfn, fd, slot);
+
+        ret = xenpaging_evict_page(paging, gfn, fd, slot);
+        if ( ret < 0 )
+            goto out;
     }
     while ( ret );
 

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05am-0004kV-2f; Wed, 22 Feb 2012 06:22:20 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ak-0004jJ-Vh
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1329891731!7118022!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=2.0 required=7.0 tests=SUBJECT_RANDOMQ
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14670 invoked from network); 22 Feb 2012 06:22:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ac-0004RK-KI
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ac-00011S-71
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:10 +0000
Message-Id: <E1S05ac-00011S-71@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl_qmp: Use GC instead of CTX as
	parameter for _initialize.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1329763528 0
# Node ID a2d15eaa2fe2870898391ec608ed5449c04e6ace
# Parent  ca80eca9cfa39d1b60d1216948dac5711d550b83
libxl_qmp: Use GC instead of CTX as parameter for _initialize.

This make things a bit easier.

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


diff -r ca80eca9cfa3 -r a2d15eaa2fe2 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Mon Feb 20 18:34:14 2012 +0000
+++ b/tools/libxl/libxl_create.c	Mon Feb 20 18:45:28 2012 +0000
@@ -594,7 +594,7 @@
     if (dm_starting) {
         if (d_config->b_info.device_model_version
             == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
-            libxl__qmp_initializations(ctx, domid);
+            libxl__qmp_initializations(gc, domid);
         }
         ret = libxl__confirm_device_model_startup(gc, &state, dm_starting);
         if (ret < 0) {
diff -r ca80eca9cfa3 -r a2d15eaa2fe2 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Mon Feb 20 18:34:14 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Mon Feb 20 18:45:28 2012 +0000
@@ -995,7 +995,7 @@
 /* Initialise and connect to the QMP socket.
  *   Return an handler or NULL if there is an error
  */
-_hidden libxl__qmp_handler *libxl__qmp_initialize(libxl_ctx *ctx,
+_hidden libxl__qmp_handler *libxl__qmp_initialize(libxl__gc *gc,
                                                   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);
@@ -1011,7 +1011,7 @@
 _hidden void libxl__qmp_cleanup(libxl__gc *gc, uint32_t domid);
 
 /* this helper calls qmp_initialize, query_serial and qmp_close */
-_hidden int libxl__qmp_initializations(libxl_ctx *ctx, uint32_t domid);
+_hidden int libxl__qmp_initializations(libxl__gc *gc, uint32_t domid);
 
 /* from libxl_json */
 #include <yajl/yajl_gen.h>
diff -r ca80eca9cfa3 -r a2d15eaa2fe2 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Mon Feb 20 18:34:14 2012 +0000
+++ b/tools/libxl/libxl_qmp.c	Mon Feb 20 18:45:28 2012 +0000
@@ -289,17 +289,17 @@
  * Handler functions
  */
 
-static libxl__qmp_handler *qmp_init_handler(libxl_ctx *ctx, uint32_t domid)
+static libxl__qmp_handler *qmp_init_handler(libxl__gc *gc, uint32_t domid)
 {
     libxl__qmp_handler *qmp = NULL;
 
     qmp = calloc(1, sizeof (libxl__qmp_handler));
     if (qmp == NULL) {
-        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+        LIBXL__LOG_ERRNO(libxl__gc_owner(gc), LIBXL__LOG_ERROR,
                          "Failed to allocate qmp_handler");
         return NULL;
     }
-    qmp->ctx = ctx;
+    qmp->ctx = libxl__gc_owner(gc);
     qmp->domid = domid;
     qmp->timeout = 5;
 
@@ -624,20 +624,18 @@
  * API
  */
 
-libxl__qmp_handler *libxl__qmp_initialize(libxl_ctx *ctx, uint32_t domid)
+libxl__qmp_handler *libxl__qmp_initialize(libxl__gc *gc, uint32_t domid)
 {
     int ret = 0;
     libxl__qmp_handler *qmp = NULL;
     char *qmp_socket;
-    GC_INIT(ctx);
 
-    qmp = qmp_init_handler(ctx, domid);
+    qmp = qmp_init_handler(gc, domid);
 
     qmp_socket = libxl__sprintf(gc, "%s/qmp-libxl-%d",
                                 libxl_run_dir_path(), domid);
     if ((ret = qmp_open(qmp, qmp_socket, QMP_SOCKET_CONNECT_TIMEOUT)) < 0) {
-        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Connection error");
-        GC_FREE;
+        LIBXL__LOG_ERRNO(qmp->ctx, LIBXL__LOG_ERROR, "Connection error");
         qmp_free_handler(qmp);
         return NULL;
     }
@@ -651,9 +649,8 @@
         }
     }
 
-    GC_FREE;
     if (!qmp->connected) {
-        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Failed to connect to QMP");
+        LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR, "Failed to connect to QMP");
         libxl__qmp_close(qmp);
         return NULL;
     }
@@ -747,7 +744,7 @@
     char *hostaddr = NULL;
     int rc = 0;
 
-    qmp = libxl__qmp_initialize(libxl__gc_owner(gc), domid);
+    qmp = libxl__qmp_initialize(gc, domid);
     if (!qmp)
         return -1;
 
@@ -792,7 +789,7 @@
     libxl_key_value_list args = NULL;
     int rc = 0;
 
-    qmp = libxl__qmp_initialize(libxl__gc_owner(gc), domid);
+    qmp = libxl__qmp_initialize(gc, domid);
     if (!qmp)
         return ERROR_FAIL;
 
@@ -853,7 +850,7 @@
     libxl_key_value_list args = NULL;
     int rc = 0;
 
-    qmp = libxl__qmp_initialize(libxl__gc_owner(gc), domid);
+    qmp = libxl__qmp_initialize(gc, domid);
     if (!qmp)
         return ERROR_FAIL;
 
@@ -883,12 +880,12 @@
     return rc;
 }
 
-int libxl__qmp_initializations(libxl_ctx *ctx, uint32_t domid)
+int libxl__qmp_initializations(libxl__gc *gc, uint32_t domid)
 {
     libxl__qmp_handler *qmp = NULL;
     int ret = 0;
 
-    qmp = libxl__qmp_initialize(ctx, domid);
+    qmp = libxl__qmp_initialize(gc, domid);
     if (!qmp)
         return -1;
     ret = libxl__qmp_query_serial(qmp);

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05am-0004kV-2f; Wed, 22 Feb 2012 06:22:20 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ak-0004jJ-Vh
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1329891731!7118022!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=2.0 required=7.0 tests=SUBJECT_RANDOMQ
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14670 invoked from network); 22 Feb 2012 06:22:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ac-0004RK-KI
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ac-00011S-71
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:10 +0000
Message-Id: <E1S05ac-00011S-71@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl_qmp: Use GC instead of CTX as
	parameter for _initialize.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1329763528 0
# Node ID a2d15eaa2fe2870898391ec608ed5449c04e6ace
# Parent  ca80eca9cfa39d1b60d1216948dac5711d550b83
libxl_qmp: Use GC instead of CTX as parameter for _initialize.

This make things a bit easier.

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


diff -r ca80eca9cfa3 -r a2d15eaa2fe2 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Mon Feb 20 18:34:14 2012 +0000
+++ b/tools/libxl/libxl_create.c	Mon Feb 20 18:45:28 2012 +0000
@@ -594,7 +594,7 @@
     if (dm_starting) {
         if (d_config->b_info.device_model_version
             == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
-            libxl__qmp_initializations(ctx, domid);
+            libxl__qmp_initializations(gc, domid);
         }
         ret = libxl__confirm_device_model_startup(gc, &state, dm_starting);
         if (ret < 0) {
diff -r ca80eca9cfa3 -r a2d15eaa2fe2 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Mon Feb 20 18:34:14 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Mon Feb 20 18:45:28 2012 +0000
@@ -995,7 +995,7 @@
 /* Initialise and connect to the QMP socket.
  *   Return an handler or NULL if there is an error
  */
-_hidden libxl__qmp_handler *libxl__qmp_initialize(libxl_ctx *ctx,
+_hidden libxl__qmp_handler *libxl__qmp_initialize(libxl__gc *gc,
                                                   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);
@@ -1011,7 +1011,7 @@
 _hidden void libxl__qmp_cleanup(libxl__gc *gc, uint32_t domid);
 
 /* this helper calls qmp_initialize, query_serial and qmp_close */
-_hidden int libxl__qmp_initializations(libxl_ctx *ctx, uint32_t domid);
+_hidden int libxl__qmp_initializations(libxl__gc *gc, uint32_t domid);
 
 /* from libxl_json */
 #include <yajl/yajl_gen.h>
diff -r ca80eca9cfa3 -r a2d15eaa2fe2 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Mon Feb 20 18:34:14 2012 +0000
+++ b/tools/libxl/libxl_qmp.c	Mon Feb 20 18:45:28 2012 +0000
@@ -289,17 +289,17 @@
  * Handler functions
  */
 
-static libxl__qmp_handler *qmp_init_handler(libxl_ctx *ctx, uint32_t domid)
+static libxl__qmp_handler *qmp_init_handler(libxl__gc *gc, uint32_t domid)
 {
     libxl__qmp_handler *qmp = NULL;
 
     qmp = calloc(1, sizeof (libxl__qmp_handler));
     if (qmp == NULL) {
-        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+        LIBXL__LOG_ERRNO(libxl__gc_owner(gc), LIBXL__LOG_ERROR,
                          "Failed to allocate qmp_handler");
         return NULL;
     }
-    qmp->ctx = ctx;
+    qmp->ctx = libxl__gc_owner(gc);
     qmp->domid = domid;
     qmp->timeout = 5;
 
@@ -624,20 +624,18 @@
  * API
  */
 
-libxl__qmp_handler *libxl__qmp_initialize(libxl_ctx *ctx, uint32_t domid)
+libxl__qmp_handler *libxl__qmp_initialize(libxl__gc *gc, uint32_t domid)
 {
     int ret = 0;
     libxl__qmp_handler *qmp = NULL;
     char *qmp_socket;
-    GC_INIT(ctx);
 
-    qmp = qmp_init_handler(ctx, domid);
+    qmp = qmp_init_handler(gc, domid);
 
     qmp_socket = libxl__sprintf(gc, "%s/qmp-libxl-%d",
                                 libxl_run_dir_path(), domid);
     if ((ret = qmp_open(qmp, qmp_socket, QMP_SOCKET_CONNECT_TIMEOUT)) < 0) {
-        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Connection error");
-        GC_FREE;
+        LIBXL__LOG_ERRNO(qmp->ctx, LIBXL__LOG_ERROR, "Connection error");
         qmp_free_handler(qmp);
         return NULL;
     }
@@ -651,9 +649,8 @@
         }
     }
 
-    GC_FREE;
     if (!qmp->connected) {
-        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Failed to connect to QMP");
+        LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR, "Failed to connect to QMP");
         libxl__qmp_close(qmp);
         return NULL;
     }
@@ -747,7 +744,7 @@
     char *hostaddr = NULL;
     int rc = 0;
 
-    qmp = libxl__qmp_initialize(libxl__gc_owner(gc), domid);
+    qmp = libxl__qmp_initialize(gc, domid);
     if (!qmp)
         return -1;
 
@@ -792,7 +789,7 @@
     libxl_key_value_list args = NULL;
     int rc = 0;
 
-    qmp = libxl__qmp_initialize(libxl__gc_owner(gc), domid);
+    qmp = libxl__qmp_initialize(gc, domid);
     if (!qmp)
         return ERROR_FAIL;
 
@@ -853,7 +850,7 @@
     libxl_key_value_list args = NULL;
     int rc = 0;
 
-    qmp = libxl__qmp_initialize(libxl__gc_owner(gc), domid);
+    qmp = libxl__qmp_initialize(gc, domid);
     if (!qmp)
         return ERROR_FAIL;
 
@@ -883,12 +880,12 @@
     return rc;
 }
 
-int libxl__qmp_initializations(libxl_ctx *ctx, uint32_t domid)
+int libxl__qmp_initializations(libxl__gc *gc, uint32_t domid)
 {
     libxl__qmp_handler *qmp = NULL;
     int ret = 0;
 
-    qmp = libxl__qmp_initialize(ctx, domid);
+    qmp = libxl__qmp_initialize(gc, domid);
     if (!qmp)
         return -1;
     ret = libxl__qmp_query_serial(qmp);

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05an-0004lS-AP; Wed, 22 Feb 2012 06:22:21 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05al-0004jR-Ju
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1329891731!5186144!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25280 invoked from network); 22 Feb 2012 06:22:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ad-0004RN-7S
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ac-00011t-SV
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:10 +0000
Message-Id: <E1S05ac-00011t-SV@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Provide dm_vnc() as a in libxl
	helper.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1329763529 0
# Node ID 2c2afbd7cef7f497423fedb5ffe2af3b4df6f133
# Parent  a2d15eaa2fe2870898391ec608ed5449c04e6ace
Provide dm_vnc() as a in libxl helper.

Just to use this function in more than one file.c.

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


diff -r a2d15eaa2fe2 -r 2c2afbd7cef7 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Mon Feb 20 18:45:28 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Mon Feb 20 18:45:29 2012 +0000
@@ -73,7 +73,7 @@
     }
 }
 
-static const libxl_vnc_info *dm_vnc(const libxl_domain_config *guest_config)
+const libxl_vnc_info *libxl__dm_vnc(const libxl_domain_config *guest_config)
 {
     const libxl_vnc_info *vnc = NULL;
     if (guest_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) {
@@ -113,7 +113,7 @@
     const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
     const libxl_device_nic *vifs = guest_config->vifs;
-    const libxl_vnc_info *vnc = dm_vnc(guest_config);
+    const libxl_vnc_info *vnc = libxl__dm_vnc(guest_config);
     const libxl_sdl_info *sdl = dm_sdl(guest_config);
     const int num_vifs = guest_config->num_vifs;
     const char *keymap = dm_keymap(guest_config);
@@ -328,7 +328,7 @@
     const libxl_device_nic *vifs = guest_config->vifs;
     const int num_disks = guest_config->num_disks;
     const int num_vifs = guest_config->num_vifs;
-    const libxl_vnc_info *vnc = dm_vnc(guest_config);
+    const libxl_vnc_info *vnc = libxl__dm_vnc(guest_config);
     const libxl_sdl_info *sdl = dm_sdl(guest_config);
     const char *keymap = dm_keymap(guest_config);
     flexarray_t *dm_args;
@@ -890,7 +890,7 @@
     libxl_ctx *ctx = libxl__gc_owner(gc);
     const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
-    const libxl_vnc_info *vnc = dm_vnc(guest_config);
+    const libxl_vnc_info *vnc = libxl__dm_vnc(guest_config);
     char *path, *logfile;
     int logfile_w, null;
     int rc;
diff -r a2d15eaa2fe2 -r 2c2afbd7cef7 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Mon Feb 20 18:45:28 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Mon Feb 20 18:45:29 2012 +0000
@@ -903,6 +903,8 @@
 
 _hidden int libxl__destroy_device_model(libxl__gc *gc, uint32_t domid);
 
+_hidden const libxl_vnc_info *libxl__dm_vnc(const libxl_domain_config *g_cfg);
+
 _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.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05an-0004lS-AP; Wed, 22 Feb 2012 06:22:21 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05al-0004jR-Ju
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1329891731!5186144!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25280 invoked from network); 22 Feb 2012 06:22:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ad-0004RN-7S
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ac-00011t-SV
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:10 +0000
Message-Id: <E1S05ac-00011t-SV@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Provide dm_vnc() as a in libxl
	helper.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1329763529 0
# Node ID 2c2afbd7cef7f497423fedb5ffe2af3b4df6f133
# Parent  a2d15eaa2fe2870898391ec608ed5449c04e6ace
Provide dm_vnc() as a in libxl helper.

Just to use this function in more than one file.c.

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


diff -r a2d15eaa2fe2 -r 2c2afbd7cef7 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Mon Feb 20 18:45:28 2012 +0000
+++ b/tools/libxl/libxl_dm.c	Mon Feb 20 18:45:29 2012 +0000
@@ -73,7 +73,7 @@
     }
 }
 
-static const libxl_vnc_info *dm_vnc(const libxl_domain_config *guest_config)
+const libxl_vnc_info *libxl__dm_vnc(const libxl_domain_config *guest_config)
 {
     const libxl_vnc_info *vnc = NULL;
     if (guest_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) {
@@ -113,7 +113,7 @@
     const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
     const libxl_device_nic *vifs = guest_config->vifs;
-    const libxl_vnc_info *vnc = dm_vnc(guest_config);
+    const libxl_vnc_info *vnc = libxl__dm_vnc(guest_config);
     const libxl_sdl_info *sdl = dm_sdl(guest_config);
     const int num_vifs = guest_config->num_vifs;
     const char *keymap = dm_keymap(guest_config);
@@ -328,7 +328,7 @@
     const libxl_device_nic *vifs = guest_config->vifs;
     const int num_disks = guest_config->num_disks;
     const int num_vifs = guest_config->num_vifs;
-    const libxl_vnc_info *vnc = dm_vnc(guest_config);
+    const libxl_vnc_info *vnc = libxl__dm_vnc(guest_config);
     const libxl_sdl_info *sdl = dm_sdl(guest_config);
     const char *keymap = dm_keymap(guest_config);
     flexarray_t *dm_args;
@@ -890,7 +890,7 @@
     libxl_ctx *ctx = libxl__gc_owner(gc);
     const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
-    const libxl_vnc_info *vnc = dm_vnc(guest_config);
+    const libxl_vnc_info *vnc = libxl__dm_vnc(guest_config);
     char *path, *logfile;
     int logfile_w, null;
     int rc;
diff -r a2d15eaa2fe2 -r 2c2afbd7cef7 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Mon Feb 20 18:45:28 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Mon Feb 20 18:45:29 2012 +0000
@@ -903,6 +903,8 @@
 
 _hidden int libxl__destroy_device_model(libxl__gc *gc, uint32_t domid);
 
+_hidden const libxl_vnc_info *libxl__dm_vnc(const libxl_domain_config *g_cfg);
+
 _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.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05ap-0004my-NT; Wed, 22 Feb 2012 06:22:23 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ao-0004jt-4K
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1329891733!14309087!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4493 invoked from network); 22 Feb 2012 06:22:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05af-0004RZ-Fc
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05af-00013O-1A
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:13 +0000
Message-Id: <E1S05af-00013O-1A@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/examples: mention
	output_format= in examples/xl.conf
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329764253 0
# Node ID 7060509e36e5f92ac23b572d15a3923d91eb5d3a
# Parent  0da2e4935a7b60033b98eb77da2b9bf116d05ac2
tools/examples: mention output_format= in examples/xl.conf

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


diff -r 0da2e4935a7b -r 7060509e36e5 tools/examples/xl.conf
--- a/tools/examples/xl.conf	Mon Feb 20 18:56:57 2012 +0000
+++ b/tools/examples/xl.conf	Mon Feb 20 18:57:33 2012 +0000
@@ -9,3 +9,6 @@
 
 # default vif script 
 #vifscript="vif-bridge"
+
+# default output format used by "xl list -l"
+#output_format="json"

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05ap-0004my-NT; Wed, 22 Feb 2012 06:22:23 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ao-0004jt-4K
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1329891733!14309087!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4493 invoked from network); 22 Feb 2012 06:22:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05af-0004RZ-Fc
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05af-00013O-1A
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:13 +0000
Message-Id: <E1S05af-00013O-1A@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/examples: mention
	output_format= in examples/xl.conf
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329764253 0
# Node ID 7060509e36e5f92ac23b572d15a3923d91eb5d3a
# Parent  0da2e4935a7b60033b98eb77da2b9bf116d05ac2
tools/examples: mention output_format= in examples/xl.conf

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


diff -r 0da2e4935a7b -r 7060509e36e5 tools/examples/xl.conf
--- a/tools/examples/xl.conf	Mon Feb 20 18:56:57 2012 +0000
+++ b/tools/examples/xl.conf	Mon Feb 20 18:57:33 2012 +0000
@@ -9,3 +9,6 @@
 
 # default vif script 
 #vifscript="vif-bridge"
+
+# default output format used by "xl list -l"
+#output_format="json"

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05ap-0004n6-Pz; Wed, 22 Feb 2012 06:22:23 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ao-0004ju-8Y
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-21.messagelabs.com!1329891734!12671287!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12873 invoked from network); 22 Feb 2012 06:22:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ag-0004Rf-5P
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ag-00014A-46
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:14 +0000
Message-Id: <E1S05ag-00014A-46@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: add missing includes
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Christoph Egger <Christoph.Egger@amd.com>
# Date 1329842655 0
# Node ID fd0a2cff16edafbd27f821dcc4464a4e6d6404fd
# Parent  0900b1c905f1d038aad58a2732fe2bad682149a3
libxl: add missing includes

include <poll.h> for struct pollfd
include <sys/time.h> for struct timeval

Fixes gcc complaints about implicit declaration.

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


diff -r 0900b1c905f1 -r fd0a2cff16ed tools/libxl/libxl_event.h
--- a/tools/libxl/libxl_event.h	Mon Feb 20 18:58:07 2012 +0000
+++ b/tools/libxl/libxl_event.h	Tue Feb 21 16:44:15 2012 +0000
@@ -17,6 +17,8 @@
 #define LIBXL_EVENT_H
 
 #include <libxl.h>
+#include <poll.h>
+#include <sys/time.h>
 
 /*======================================================================*/
 

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05ap-0004n6-Pz; Wed, 22 Feb 2012 06:22:23 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ao-0004ju-8Y
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-21.messagelabs.com!1329891734!12671287!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12873 invoked from network); 22 Feb 2012 06:22:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ag-0004Rf-5P
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ag-00014A-46
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:14 +0000
Message-Id: <E1S05ag-00014A-46@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: add missing includes
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Christoph Egger <Christoph.Egger@amd.com>
# Date 1329842655 0
# Node ID fd0a2cff16edafbd27f821dcc4464a4e6d6404fd
# Parent  0900b1c905f1d038aad58a2732fe2bad682149a3
libxl: add missing includes

include <poll.h> for struct pollfd
include <sys/time.h> for struct timeval

Fixes gcc complaints about implicit declaration.

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


diff -r 0900b1c905f1 -r fd0a2cff16ed tools/libxl/libxl_event.h
--- a/tools/libxl/libxl_event.h	Mon Feb 20 18:58:07 2012 +0000
+++ b/tools/libxl/libxl_event.h	Tue Feb 21 16:44:15 2012 +0000
@@ -17,6 +17,8 @@
 #define LIBXL_EVENT_H
 
 #include <libxl.h>
+#include <poll.h>
+#include <sys/time.h>
 
 /*======================================================================*/
 

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05ap-0004ml-IO; Wed, 22 Feb 2012 06:22:23 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05an-0004lR-SN
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1329891687!55228704!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8411 invoked from network); 22 Feb 2012 06:21:28 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:21:28 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05al-0004SG-GM
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05al-00017r-En
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:19 +0000
Message-Id: <E1S05al-00017r-En@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: cleanup: Remove pointless
	ERRNOVAL
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1329846359 0
# Node ID a88ba599add1526e962b89dc1a2dd97c0fc06143
# Parent  4566a48436878af248dd8693c00bd1e3221d4150
libxl: cleanup: Remove pointless ERRNOVAL

Just call LIBXL__LOG rather than passing a meaningless ERRNOVAL.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 4566a4843687 -r a88ba599add1 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/libxl/libxl.c	Tue Feb 21 17:45:59 2012 +0000
@@ -3008,13 +3008,13 @@
 
 
     if (scinfo->weight < 1 || scinfo->weight > 65535) {
-        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
             "Cpu weight out of range, valid values are within range from 1 to 65535");
         return ERROR_INVAL;
     }
 
     if (scinfo->cap < 0 || scinfo->cap > (domaininfo.max_vcpu_id + 1) * 100) {
-        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
             "Cpu cap out of range, valid range is from 0 to %d for specified number of vcpus",
             ((domaininfo.max_vcpu_id + 1) * 100));
         return ERROR_INVAL;

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05ap-0004ml-IO; Wed, 22 Feb 2012 06:22:23 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05an-0004lR-SN
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1329891687!55228704!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8411 invoked from network); 22 Feb 2012 06:21:28 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:21:28 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05al-0004SG-GM
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05al-00017r-En
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:19 +0000
Message-Id: <E1S05al-00017r-En@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: cleanup: Remove pointless
	ERRNOVAL
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1329846359 0
# Node ID a88ba599add1526e962b89dc1a2dd97c0fc06143
# Parent  4566a48436878af248dd8693c00bd1e3221d4150
libxl: cleanup: Remove pointless ERRNOVAL

Just call LIBXL__LOG rather than passing a meaningless ERRNOVAL.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 4566a4843687 -r a88ba599add1 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/libxl/libxl.c	Tue Feb 21 17:45:59 2012 +0000
@@ -3008,13 +3008,13 @@
 
 
     if (scinfo->weight < 1 || scinfo->weight > 65535) {
-        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
             "Cpu weight out of range, valid values are within range from 1 to 65535");
         return ERROR_INVAL;
     }
 
     if (scinfo->cap < 0 || scinfo->cap > (domaininfo.max_vcpu_id + 1) * 100) {
-        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
             "Cpu cap out of range, valid range is from 0 to %d for specified number of vcpus",
             ((domaininfo.max_vcpu_id + 1) * 100));
         return ERROR_INVAL;

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05aq-0004oc-Sv; Wed, 22 Feb 2012 06:22:24 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ap-0004kg-LO
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:24 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-27.messagelabs.com!1329891683!50212325!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29456 invoked from network); 22 Feb 2012 06:21:24 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:21:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05aj-0004Rx-Au
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05aj-00016M-9a
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:17 +0000
Message-Id: <E1S05aj-00016M-9a@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: unify error handling
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329769124 -3600
# Node ID 80a9d3190b7c58a5d13017f770f1a5915288ec37
# Parent  6b14211c3e7729252d00b52976d96cd80153bbef
xenpaging: unify error handling

Update functions to return -1 on error, 0 on success.
Simplify init_page() and make sure errno is assigned.
Adjust PERROR/ERROR usage, use PERROR early because it overwrites errno.
Adjust xenpaging_populate_page() to handle gfn as unsigned long.

Update xenpaging exit code handling. xenpaging_teardown cant possible
fail. Adjust mainloop to indicate possible errors to final exit.

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


diff -r 6b14211c3e77 -r 80a9d3190b7c tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
@@ -98,7 +98,7 @@
             return 0;
 
         PERROR("Poll exited with an error");
-        return -errno;
+        return -1;
     }
 
     /* First check for guest shutdown */
@@ -116,6 +116,7 @@
                 {
                     xs_unwatch(paging->xs_handle, "@releaseDomain", watch_token);
                     interrupted = SIGQUIT;
+                    /* No further poll result processing */
                     rc = 0;
                 }
             }
@@ -183,26 +184,20 @@
 static void *init_page(void)
 {
     void *buffer;
-    int ret;
 
     /* Allocated page memory */
-    ret = posix_memalign(&buffer, PAGE_SIZE, PAGE_SIZE);
-    if ( ret != 0 )
-        goto out_alloc;
+    errno = posix_memalign(&buffer, PAGE_SIZE, PAGE_SIZE);
+    if ( errno != 0 )
+        return NULL;
 
     /* Lock buffer in memory so it can't be paged out */
-    ret = mlock(buffer, PAGE_SIZE);
-    if ( ret != 0 )
-        goto out_lock;
+    if ( mlock(buffer, PAGE_SIZE) < 0 )
+    {
+        free(buffer);
+        buffer = NULL;
+    }
 
     return buffer;
-
- out_init:
-    munlock(buffer, PAGE_SIZE);
- out_lock:
-    free(buffer);
- out_alloc:
-    return NULL;
 }
 
 static void usage(void)
@@ -449,7 +444,7 @@
     paging_buffer = init_page();
     if ( !paging_buffer )
     {
-        ERROR("Creating page aligned load buffer");
+        PERROR("Creating page aligned load buffer");
         goto err;
     }
 
@@ -485,18 +480,14 @@
     return NULL;
 }
 
-static int xenpaging_teardown(struct xenpaging *paging)
+static void xenpaging_teardown(struct xenpaging *paging)
 {
     int rc;
-    xc_interface *xch;
-
-    if ( paging == NULL )
-        return 0;
+    xc_interface *xch = paging->xc_handle;
 
     xs_unwatch(paging->xs_handle, watch_target_tot_pages, "");
     xs_unwatch(paging->xs_handle, "@releaseDomain", watch_token);
 
-    xch = paging->xc_handle;
     paging->xc_handle = NULL;
     /* Tear down domain paging in Xen */
     rc = xc_mem_paging_disable(xch, paging->mem_event.domain_id);
@@ -528,13 +519,8 @@
     rc = xc_interface_close(xch);
     if ( rc != 0 )
     {
-        PERROR("Error closing connection to xen");
+        ERROR("Error closing connection to xen");
     }
-
-    return 0;
-
- err:
-    return -1;
 }
 
 static void get_request(struct mem_event *mem_event, mem_event_request_t *req)
@@ -684,21 +670,19 @@
     return ret;
 }
 
-static int xenpaging_populate_page(struct xenpaging *paging,
-    xen_pfn_t gfn, int fd, int i)
+static int xenpaging_populate_page(struct xenpaging *paging, unsigned long gfn, int fd, int i)
 {
     xc_interface *xch = paging->xc_handle;
-    void *page;
     int ret;
     unsigned char oom = 0;
 
-    DPRINTF("populate_page < gfn %"PRI_xen_pfn" pageslot %d\n", gfn, i);
+    DPRINTF("populate_page < gfn %lx pageslot %d\n", gfn, i);
 
     /* Read page */
     ret = read_page(fd, paging_buffer, i);
     if ( ret != 0 )
     {
-        ERROR("Error reading page");
+        PERROR("Error reading page");
         goto out;
     }
 
@@ -707,17 +691,18 @@
         /* Tell Xen to allocate a page for the domain */
         ret = xc_mem_paging_load(xch, paging->mem_event.domain_id, gfn,
                                     paging_buffer);
-        if ( ret != 0 )
+        if ( ret < 0 )
         {
             if ( errno == ENOMEM )
             {
                 if ( oom++ == 0 )
-                    DPRINTF("ENOMEM while preparing gfn %"PRI_xen_pfn"\n", gfn);
+                    DPRINTF("ENOMEM while preparing gfn %lx\n", gfn);
                 sleep(1);
                 continue;
             }
-            PERROR("Error loading %"PRI_xen_pfn" during page-in", gfn);
-            goto out;
+            PERROR("Error loading %lx during page-in", gfn);
+            ret = -1;
+            break;
         }
     }
     while ( ret && !interrupted );
@@ -748,6 +733,11 @@
         page_in_trigger();
 }
 
+/* Evict one gfn and write it to the given slot
+ * Returns < 0 on fatal error
+ * Returns 0 on successful evict
+ * Returns > 0 if no gfn can be evicted
+ */
 static int evict_victim(struct xenpaging *paging, int fd, int slot)
 {
     xc_interface *xch = paging->xc_handle;
@@ -771,13 +761,13 @@
                 xenpaging_mem_paging_flush_ioemu_cache(paging);
                 num_paged_out = paging->num_paged_out;
             }
-            ret = -ENOSPC;
+            ret = ENOSPC;
             goto out;
         }
 
         if ( interrupted )
         {
-            ret = -EINTR;
+            ret = EINTR;
             goto out;
         }
 
@@ -788,7 +778,7 @@
     while ( ret );
 
     if ( test_and_set_bit(gfn, paging->bitmap) )
-        ERROR("Page has been evicted before");
+        ERROR("Page %lx has been evicted before", gfn);
 
     ret = 0;
 
@@ -796,7 +786,11 @@
     return ret;
 }
 
-/* Evict a batch of pages and write them to a free slot in the paging file */
+/* Evict a batch of pages and write them to a free slot in the paging file
+ * Returns < 0 on fatal error
+ * Returns 0 if no gfn can be evicted
+ * Returns > 0 on successful evict
+ */
 static int evict_pages(struct xenpaging *paging, int fd, int num_pages)
 {
     xc_interface *xch = paging->xc_handle;
@@ -809,12 +803,12 @@
             continue;
 
         rc = evict_victim(paging, fd, slot);
-        if ( rc == -ENOSPC )
+        if ( rc )
+        {
+            num = rc < 0 ? -1 : num;
             break;
-        if ( rc == -EINTR )
-            break;
-        if ( num && num % 100 == 0 )
-            DPRINTF("%d pages evicted\n", num);
+        }
+
         num++;
     }
     return num;
@@ -829,8 +823,7 @@
     int num, prev_num = 0;
     int slot;
     int tot_pages;
-    int rc = -1;
-    int rc1;
+    int rc;
     xc_interface *xch;
 
     int open_flags = O_CREAT | O_TRUNC | O_RDWR;
@@ -875,7 +868,7 @@
         rc = xenpaging_wait_for_event_or_timeout(paging);
         if ( rc < 0 )
         {
-            PERROR("Error getting event");
+            ERROR("Error getting event");
             goto out;
         }
         else if ( rc != 0 )
@@ -885,6 +878,9 @@
 
         while ( RING_HAS_UNCONSUMED_REQUESTS(&paging->mem_event.back_ring) )
         {
+            /* Indicate possible error */
+            rc = 1;
+
             get_request(&paging->mem_event, &req);
 
             if ( req.gfn > paging->max_pages )
@@ -915,10 +911,9 @@
                 else
                 {
                     /* Populate the page */
-                    rc = xenpaging_populate_page(paging, req.gfn, fd, slot);
-                    if ( rc != 0 )
+                    if ( xenpaging_populate_page(paging, req.gfn, fd, slot) < 0 )
                     {
-                        PERROR("Error populating page %"PRIx64"", req.gfn);
+                        ERROR("Error populating page %"PRIx64"", req.gfn);
                         goto out;
                     }
                 }
@@ -928,8 +923,7 @@
                 rsp.vcpu_id = req.vcpu_id;
                 rsp.flags = req.flags;
 
-                rc = xenpaging_resume_page(paging, &rsp, 1);
-                if ( rc != 0 )
+                if ( xenpaging_resume_page(paging, &rsp, 1) < 0 )
                 {
                     PERROR("Error resuming page %"PRIx64"", req.gfn);
                     goto out;
@@ -955,8 +949,7 @@
                     rsp.vcpu_id = req.vcpu_id;
                     rsp.flags = req.flags;
 
-                    rc = xenpaging_resume_page(paging, &rsp, 0);
-                    if ( rc != 0 )
+                    if ( xenpaging_resume_page(paging, &rsp, 0) < 0 )
                     {
                         PERROR("Error resuming page %"PRIx64"", req.gfn);
                         goto out;
@@ -983,6 +976,9 @@
         if ( interrupted )
             break;
 
+        /* Indicate possible error */
+        rc = 1;
+
         /* Check if the target has been reached already */
         tot_pages = xenpaging_get_tot_pages(paging);
         if ( tot_pages < 0 )
@@ -1009,7 +1005,8 @@
                 paging->use_poll_timeout = 0;
                 num = 42;
             }
-            evict_pages(paging, fd, num);
+            if ( evict_pages(paging, fd, num) < 0 )
+                goto out;
         }
         /* Resume some pages if target not reached */
         else if ( tot_pages < paging->target_tot_pages && paging->num_paged_out )
@@ -1029,6 +1026,10 @@
         }
 
     }
+
+    /* No error */
+    rc = 0;
+
     DPRINTF("xenpaging got signal %d\n", interrupted);
 
  out:
@@ -1036,13 +1037,9 @@
     unlink_pagefile();
 
     /* Tear down domain paging */
-    rc1 = xenpaging_teardown(paging);
-    if ( rc1 != 0 )
-        fprintf(stderr, "Error tearing down paging");
+    xenpaging_teardown(paging);
 
-    if ( rc == 0 )
-        rc = rc1;
-    return rc;
+    return rc ? 2 : 0;
 }
 
 

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05aq-0004oc-Sv; Wed, 22 Feb 2012 06:22:24 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ap-0004kg-LO
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:24 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-27.messagelabs.com!1329891683!50212325!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29456 invoked from network); 22 Feb 2012 06:21:24 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:21:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05aj-0004Rx-Au
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05aj-00016M-9a
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:17 +0000
Message-Id: <E1S05aj-00016M-9a@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: unify error handling
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329769124 -3600
# Node ID 80a9d3190b7c58a5d13017f770f1a5915288ec37
# Parent  6b14211c3e7729252d00b52976d96cd80153bbef
xenpaging: unify error handling

Update functions to return -1 on error, 0 on success.
Simplify init_page() and make sure errno is assigned.
Adjust PERROR/ERROR usage, use PERROR early because it overwrites errno.
Adjust xenpaging_populate_page() to handle gfn as unsigned long.

Update xenpaging exit code handling. xenpaging_teardown cant possible
fail. Adjust mainloop to indicate possible errors to final exit.

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


diff -r 6b14211c3e77 -r 80a9d3190b7c tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
@@ -98,7 +98,7 @@
             return 0;
 
         PERROR("Poll exited with an error");
-        return -errno;
+        return -1;
     }
 
     /* First check for guest shutdown */
@@ -116,6 +116,7 @@
                 {
                     xs_unwatch(paging->xs_handle, "@releaseDomain", watch_token);
                     interrupted = SIGQUIT;
+                    /* No further poll result processing */
                     rc = 0;
                 }
             }
@@ -183,26 +184,20 @@
 static void *init_page(void)
 {
     void *buffer;
-    int ret;
 
     /* Allocated page memory */
-    ret = posix_memalign(&buffer, PAGE_SIZE, PAGE_SIZE);
-    if ( ret != 0 )
-        goto out_alloc;
+    errno = posix_memalign(&buffer, PAGE_SIZE, PAGE_SIZE);
+    if ( errno != 0 )
+        return NULL;
 
     /* Lock buffer in memory so it can't be paged out */
-    ret = mlock(buffer, PAGE_SIZE);
-    if ( ret != 0 )
-        goto out_lock;
+    if ( mlock(buffer, PAGE_SIZE) < 0 )
+    {
+        free(buffer);
+        buffer = NULL;
+    }
 
     return buffer;
-
- out_init:
-    munlock(buffer, PAGE_SIZE);
- out_lock:
-    free(buffer);
- out_alloc:
-    return NULL;
 }
 
 static void usage(void)
@@ -449,7 +444,7 @@
     paging_buffer = init_page();
     if ( !paging_buffer )
     {
-        ERROR("Creating page aligned load buffer");
+        PERROR("Creating page aligned load buffer");
         goto err;
     }
 
@@ -485,18 +480,14 @@
     return NULL;
 }
 
-static int xenpaging_teardown(struct xenpaging *paging)
+static void xenpaging_teardown(struct xenpaging *paging)
 {
     int rc;
-    xc_interface *xch;
-
-    if ( paging == NULL )
-        return 0;
+    xc_interface *xch = paging->xc_handle;
 
     xs_unwatch(paging->xs_handle, watch_target_tot_pages, "");
     xs_unwatch(paging->xs_handle, "@releaseDomain", watch_token);
 
-    xch = paging->xc_handle;
     paging->xc_handle = NULL;
     /* Tear down domain paging in Xen */
     rc = xc_mem_paging_disable(xch, paging->mem_event.domain_id);
@@ -528,13 +519,8 @@
     rc = xc_interface_close(xch);
     if ( rc != 0 )
     {
-        PERROR("Error closing connection to xen");
+        ERROR("Error closing connection to xen");
     }
-
-    return 0;
-
- err:
-    return -1;
 }
 
 static void get_request(struct mem_event *mem_event, mem_event_request_t *req)
@@ -684,21 +670,19 @@
     return ret;
 }
 
-static int xenpaging_populate_page(struct xenpaging *paging,
-    xen_pfn_t gfn, int fd, int i)
+static int xenpaging_populate_page(struct xenpaging *paging, unsigned long gfn, int fd, int i)
 {
     xc_interface *xch = paging->xc_handle;
-    void *page;
     int ret;
     unsigned char oom = 0;
 
-    DPRINTF("populate_page < gfn %"PRI_xen_pfn" pageslot %d\n", gfn, i);
+    DPRINTF("populate_page < gfn %lx pageslot %d\n", gfn, i);
 
     /* Read page */
     ret = read_page(fd, paging_buffer, i);
     if ( ret != 0 )
     {
-        ERROR("Error reading page");
+        PERROR("Error reading page");
         goto out;
     }
 
@@ -707,17 +691,18 @@
         /* Tell Xen to allocate a page for the domain */
         ret = xc_mem_paging_load(xch, paging->mem_event.domain_id, gfn,
                                     paging_buffer);
-        if ( ret != 0 )
+        if ( ret < 0 )
         {
             if ( errno == ENOMEM )
             {
                 if ( oom++ == 0 )
-                    DPRINTF("ENOMEM while preparing gfn %"PRI_xen_pfn"\n", gfn);
+                    DPRINTF("ENOMEM while preparing gfn %lx\n", gfn);
                 sleep(1);
                 continue;
             }
-            PERROR("Error loading %"PRI_xen_pfn" during page-in", gfn);
-            goto out;
+            PERROR("Error loading %lx during page-in", gfn);
+            ret = -1;
+            break;
         }
     }
     while ( ret && !interrupted );
@@ -748,6 +733,11 @@
         page_in_trigger();
 }
 
+/* Evict one gfn and write it to the given slot
+ * Returns < 0 on fatal error
+ * Returns 0 on successful evict
+ * Returns > 0 if no gfn can be evicted
+ */
 static int evict_victim(struct xenpaging *paging, int fd, int slot)
 {
     xc_interface *xch = paging->xc_handle;
@@ -771,13 +761,13 @@
                 xenpaging_mem_paging_flush_ioemu_cache(paging);
                 num_paged_out = paging->num_paged_out;
             }
-            ret = -ENOSPC;
+            ret = ENOSPC;
             goto out;
         }
 
         if ( interrupted )
         {
-            ret = -EINTR;
+            ret = EINTR;
             goto out;
         }
 
@@ -788,7 +778,7 @@
     while ( ret );
 
     if ( test_and_set_bit(gfn, paging->bitmap) )
-        ERROR("Page has been evicted before");
+        ERROR("Page %lx has been evicted before", gfn);
 
     ret = 0;
 
@@ -796,7 +786,11 @@
     return ret;
 }
 
-/* Evict a batch of pages and write them to a free slot in the paging file */
+/* Evict a batch of pages and write them to a free slot in the paging file
+ * Returns < 0 on fatal error
+ * Returns 0 if no gfn can be evicted
+ * Returns > 0 on successful evict
+ */
 static int evict_pages(struct xenpaging *paging, int fd, int num_pages)
 {
     xc_interface *xch = paging->xc_handle;
@@ -809,12 +803,12 @@
             continue;
 
         rc = evict_victim(paging, fd, slot);
-        if ( rc == -ENOSPC )
+        if ( rc )
+        {
+            num = rc < 0 ? -1 : num;
             break;
-        if ( rc == -EINTR )
-            break;
-        if ( num && num % 100 == 0 )
-            DPRINTF("%d pages evicted\n", num);
+        }
+
         num++;
     }
     return num;
@@ -829,8 +823,7 @@
     int num, prev_num = 0;
     int slot;
     int tot_pages;
-    int rc = -1;
-    int rc1;
+    int rc;
     xc_interface *xch;
 
     int open_flags = O_CREAT | O_TRUNC | O_RDWR;
@@ -875,7 +868,7 @@
         rc = xenpaging_wait_for_event_or_timeout(paging);
         if ( rc < 0 )
         {
-            PERROR("Error getting event");
+            ERROR("Error getting event");
             goto out;
         }
         else if ( rc != 0 )
@@ -885,6 +878,9 @@
 
         while ( RING_HAS_UNCONSUMED_REQUESTS(&paging->mem_event.back_ring) )
         {
+            /* Indicate possible error */
+            rc = 1;
+
             get_request(&paging->mem_event, &req);
 
             if ( req.gfn > paging->max_pages )
@@ -915,10 +911,9 @@
                 else
                 {
                     /* Populate the page */
-                    rc = xenpaging_populate_page(paging, req.gfn, fd, slot);
-                    if ( rc != 0 )
+                    if ( xenpaging_populate_page(paging, req.gfn, fd, slot) < 0 )
                     {
-                        PERROR("Error populating page %"PRIx64"", req.gfn);
+                        ERROR("Error populating page %"PRIx64"", req.gfn);
                         goto out;
                     }
                 }
@@ -928,8 +923,7 @@
                 rsp.vcpu_id = req.vcpu_id;
                 rsp.flags = req.flags;
 
-                rc = xenpaging_resume_page(paging, &rsp, 1);
-                if ( rc != 0 )
+                if ( xenpaging_resume_page(paging, &rsp, 1) < 0 )
                 {
                     PERROR("Error resuming page %"PRIx64"", req.gfn);
                     goto out;
@@ -955,8 +949,7 @@
                     rsp.vcpu_id = req.vcpu_id;
                     rsp.flags = req.flags;
 
-                    rc = xenpaging_resume_page(paging, &rsp, 0);
-                    if ( rc != 0 )
+                    if ( xenpaging_resume_page(paging, &rsp, 0) < 0 )
                     {
                         PERROR("Error resuming page %"PRIx64"", req.gfn);
                         goto out;
@@ -983,6 +976,9 @@
         if ( interrupted )
             break;
 
+        /* Indicate possible error */
+        rc = 1;
+
         /* Check if the target has been reached already */
         tot_pages = xenpaging_get_tot_pages(paging);
         if ( tot_pages < 0 )
@@ -1009,7 +1005,8 @@
                 paging->use_poll_timeout = 0;
                 num = 42;
             }
-            evict_pages(paging, fd, num);
+            if ( evict_pages(paging, fd, num) < 0 )
+                goto out;
         }
         /* Resume some pages if target not reached */
         else if ( tot_pages < paging->target_tot_pages && paging->num_paged_out )
@@ -1029,6 +1026,10 @@
         }
 
     }
+
+    /* No error */
+    rc = 0;
+
     DPRINTF("xenpaging got signal %d\n", interrupted);
 
  out:
@@ -1036,13 +1037,9 @@
     unlink_pagefile();
 
     /* Tear down domain paging */
-    rc1 = xenpaging_teardown(paging);
-    if ( rc1 != 0 )
-        fprintf(stderr, "Error tearing down paging");
+    xenpaging_teardown(paging);
 
-    if ( rc == 0 )
-        rc = rc1;
-    return rc;
+    return rc ? 2 : 0;
 }
 
 

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:26 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05ap-0004mt-L3; Wed, 22 Feb 2012 06:22:23 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ao-0004jo-1o
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1329891734!10333788!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5814 invoked from network); 22 Feb 2012 06:22:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05af-0004Rc-Nc
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05af-00013m-IX
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:13 +0000
Message-Id: <E1S05af-00013m-IX@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/hotplug: remove 4 from default
	runlevel in xencommons
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329764287 0
# Node ID 0900b1c905f1d038aad58a2732fe2bad682149a3
# Parent  7060509e36e5f92ac23b572d15a3923d91eb5d3a
tools/hotplug: remove 4 from default runlevel in xencommons

LSB defines runlevel 4 as "reserved for local use, default is
normal/full multiuser"

The current behaviour of insserv in openSuSE 11.4 and SLES11SP2 is that
xencommons gets a symlink in /etc/init.d/rc4.d/ due to the 4 in the
Default-Start: line. As a result insserv will print a warning:

insserv: warning: current stop runlevel(s) (2 3 5) of script `xencommons' overwrites defaults (2 3 4 5).

Since the local admin is responsible to create all symlinks manually in
/etc/init.d/rc4.d/ the xencommons script should not automatically enable
itself in runlevel 4.

So, remove the 4 from Default-Start: line.

Note: This change will not automatically remove old/stale xencommon
symlinks in /etc/init.d/rc4.d/ during a package upgrade.

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


diff -r 7060509e36e5 -r 0900b1c905f1 tools/hotplug/Linux/init.d/xencommons
--- a/tools/hotplug/Linux/init.d/xencommons	Mon Feb 20 18:57:33 2012 +0000
+++ b/tools/hotplug/Linux/init.d/xencommons	Mon Feb 20 18:58:07 2012 +0000
@@ -12,7 +12,7 @@
 # Should-Start:
 # Required-Stop:     $syslog $remote_fs
 # Should-Stop:
-# Default-Start:     2 3 4 5
+# Default-Start:     2 3 5
 # Default-Stop:      0 1 6
 # Short-Description: Start/stop xenstored and xenconsoled
 # Description:       Starts and stops the daemons neeeded for xl/xend

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:26 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05ap-0004mt-L3; Wed, 22 Feb 2012 06:22:23 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ao-0004jo-1o
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1329891734!10333788!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5814 invoked from network); 22 Feb 2012 06:22:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05af-0004Rc-Nc
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05af-00013m-IX
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:13 +0000
Message-Id: <E1S05af-00013m-IX@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/hotplug: remove 4 from default
	runlevel in xencommons
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329764287 0
# Node ID 0900b1c905f1d038aad58a2732fe2bad682149a3
# Parent  7060509e36e5f92ac23b572d15a3923d91eb5d3a
tools/hotplug: remove 4 from default runlevel in xencommons

LSB defines runlevel 4 as "reserved for local use, default is
normal/full multiuser"

The current behaviour of insserv in openSuSE 11.4 and SLES11SP2 is that
xencommons gets a symlink in /etc/init.d/rc4.d/ due to the 4 in the
Default-Start: line. As a result insserv will print a warning:

insserv: warning: current stop runlevel(s) (2 3 5) of script `xencommons' overwrites defaults (2 3 4 5).

Since the local admin is responsible to create all symlinks manually in
/etc/init.d/rc4.d/ the xencommons script should not automatically enable
itself in runlevel 4.

So, remove the 4 from Default-Start: line.

Note: This change will not automatically remove old/stale xencommon
symlinks in /etc/init.d/rc4.d/ during a package upgrade.

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


diff -r 7060509e36e5 -r 0900b1c905f1 tools/hotplug/Linux/init.d/xencommons
--- a/tools/hotplug/Linux/init.d/xencommons	Mon Feb 20 18:57:33 2012 +0000
+++ b/tools/hotplug/Linux/init.d/xencommons	Mon Feb 20 18:58:07 2012 +0000
@@ -12,7 +12,7 @@
 # Should-Start:
 # Required-Stop:     $syslog $remote_fs
 # Should-Stop:
-# Default-Start:     2 3 4 5
+# Default-Start:     2 3 5
 # Default-Stop:      0 1 6
 # Short-Description: Start/stop xenstored and xenconsoled
 # Description:       Starts and stops the daemons neeeded for xl/xend

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:26 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05ar-0004p8-3R; Wed, 22 Feb 2012 06:22:25 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05aq-0004k6-Ct
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:24 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-174.messagelabs.com!1329891736!14364705!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32207 invoked from network); 22 Feb 2012 06:22:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ah-0004Ro-On
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ah-00015G-N6
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:15 +0000
Message-Id: <E1S05ah-00015G-N6@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: reduce number of qemu
	cache flushes
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329769124 -3600
# Node ID 9e33293aee2abaac27962b8c7f6918f7094f2962
# Parent  da01faa3e11eb5fe5d4a6ad2beee0c802020cfaa
xenpaging: reduce number of qemu cache flushes

Currently the command to flush the qemu cache is called alot if there
are no more pages to evict. This causes churn in the logfiles, and qemu
can not release more pages anyway since the last command.

Fix this by remembering the current number of paged-out gfns, if this
number did not change since the last flush command then sending another
new flush command will not free any more gfns.

Remove return code from xenpaging_mem_paging_flush_ioemu_cache() since
errors do not matter, and will be handled elsewhere. Also failure to
send the flush command is not fatal.

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


diff -r da01faa3e11e -r 9e33293aee2a tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
@@ -61,18 +61,15 @@
     unlink_pagefile();
 }
 
-static int xenpaging_mem_paging_flush_ioemu_cache(struct xenpaging *paging)
+static void xenpaging_mem_paging_flush_ioemu_cache(struct xenpaging *paging)
 {
     struct xs_handle *xsh = paging->xs_handle;
     domid_t domain_id = paging->mem_event.domain_id;
     char path[80];
-    bool rc;
 
     sprintf(path, "/local/domain/0/device-model/%u/command", domain_id);
 
-    rc = xs_write(xsh, XBT_NULL, path, "flush-cache", strlen("flush-cache")); 
-
-    return rc == true ? 0 : -1;
+    xs_write(xsh, XBT_NULL, path, "flush-cache", strlen("flush-cache")); 
 }
 
 static int xenpaging_wait_for_event_or_timeout(struct xenpaging *paging)
@@ -728,7 +725,7 @@
 {
     xc_interface *xch = paging->xc_handle;
     unsigned long gfn;
-    int j = 0;
+    static int num_paged_out;
     int ret;
 
     do
@@ -736,6 +733,17 @@
         gfn = policy_choose_victim(paging);
         if ( gfn == INVALID_MFN )
         {
+            /* If the number did not change after last flush command then
+             * the command did not reach qemu yet, or qemu still processes
+             * the command, or qemu has nothing to release.
+             * Right now there is no need to issue the command again.
+             */
+            if ( num_paged_out != paging->num_paged_out )
+            {
+                DPRINTF("Flushing qemu cache\n");
+                xenpaging_mem_paging_flush_ioemu_cache(paging);
+                num_paged_out = paging->num_paged_out;
+            }
             ret = -ENOSPC;
             goto out;
         }
@@ -748,12 +756,6 @@
         ret = xc_mem_paging_nominate(xch, paging->mem_event.domain_id, gfn);
         if ( ret == 0 )
             ret = xenpaging_evict_page(paging, gfn, fd, slot);
-        else
-        {
-            if ( j++ % 1000 == 0 )
-                if ( xenpaging_mem_paging_flush_ioemu_cache(paging) )
-                    PERROR("Error flushing ioemu cache");
-        }
     }
     while ( ret );
 

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:26 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05ar-0004p8-3R; Wed, 22 Feb 2012 06:22:25 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05aq-0004k6-Ct
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:24 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-174.messagelabs.com!1329891736!14364705!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32207 invoked from network); 22 Feb 2012 06:22:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ah-0004Ro-On
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ah-00015G-N6
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:15 +0000
Message-Id: <E1S05ah-00015G-N6@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: reduce number of qemu
	cache flushes
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329769124 -3600
# Node ID 9e33293aee2abaac27962b8c7f6918f7094f2962
# Parent  da01faa3e11eb5fe5d4a6ad2beee0c802020cfaa
xenpaging: reduce number of qemu cache flushes

Currently the command to flush the qemu cache is called alot if there
are no more pages to evict. This causes churn in the logfiles, and qemu
can not release more pages anyway since the last command.

Fix this by remembering the current number of paged-out gfns, if this
number did not change since the last flush command then sending another
new flush command will not free any more gfns.

Remove return code from xenpaging_mem_paging_flush_ioemu_cache() since
errors do not matter, and will be handled elsewhere. Also failure to
send the flush command is not fatal.

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


diff -r da01faa3e11e -r 9e33293aee2a tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
@@ -61,18 +61,15 @@
     unlink_pagefile();
 }
 
-static int xenpaging_mem_paging_flush_ioemu_cache(struct xenpaging *paging)
+static void xenpaging_mem_paging_flush_ioemu_cache(struct xenpaging *paging)
 {
     struct xs_handle *xsh = paging->xs_handle;
     domid_t domain_id = paging->mem_event.domain_id;
     char path[80];
-    bool rc;
 
     sprintf(path, "/local/domain/0/device-model/%u/command", domain_id);
 
-    rc = xs_write(xsh, XBT_NULL, path, "flush-cache", strlen("flush-cache")); 
-
-    return rc == true ? 0 : -1;
+    xs_write(xsh, XBT_NULL, path, "flush-cache", strlen("flush-cache")); 
 }
 
 static int xenpaging_wait_for_event_or_timeout(struct xenpaging *paging)
@@ -728,7 +725,7 @@
 {
     xc_interface *xch = paging->xc_handle;
     unsigned long gfn;
-    int j = 0;
+    static int num_paged_out;
     int ret;
 
     do
@@ -736,6 +733,17 @@
         gfn = policy_choose_victim(paging);
         if ( gfn == INVALID_MFN )
         {
+            /* If the number did not change after last flush command then
+             * the command did not reach qemu yet, or qemu still processes
+             * the command, or qemu has nothing to release.
+             * Right now there is no need to issue the command again.
+             */
+            if ( num_paged_out != paging->num_paged_out )
+            {
+                DPRINTF("Flushing qemu cache\n");
+                xenpaging_mem_paging_flush_ioemu_cache(paging);
+                num_paged_out = paging->num_paged_out;
+            }
             ret = -ENOSPC;
             goto out;
         }
@@ -748,12 +756,6 @@
         ret = xc_mem_paging_nominate(xch, paging->mem_event.domain_id, gfn);
         if ( ret == 0 )
             ret = xenpaging_evict_page(paging, gfn, fd, slot);
-        else
-        {
-            if ( j++ % 1000 == 0 )
-                if ( xenpaging_mem_paging_flush_ioemu_cache(paging) )
-                    PERROR("Error flushing ioemu cache");
-        }
     }
     while ( ret );
 

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:26 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05aq-0004on-W0; Wed, 22 Feb 2012 06:22:24 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ap-0004jz-Ta
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:24 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1329891735!9224848!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14465 invoked from network); 22 Feb 2012 06:22:16 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:16 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ah-0004Rl-7T
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ah-00014t-64
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:15 +0000
Message-Id: <E1S05ah-00014t-64@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: no poll timeout while
	page-out is in progress
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329769124 -3600
# Node ID da01faa3e11eb5fe5d4a6ad2beee0c802020cfaa
# Parent  06cf45130725c021623f9c20b9d3ac2f925922f2
xenpaging: no poll timeout while page-out is in progress

The main loop calls xenpaging_wait_for_event_or_timeout() unconditionally
before doing any work. This function calls poll() with a timeout of 100ms. As
a result the page-out process is very slow due to the delay in poll().

Call poll() without timeout so that it returns immediately until the page-out
is done. Page-out is done when either the policy finds no more pages to
nominate or when the requested number of pages is reached.

The condition is cleared when a watch event arrives, so that processing the
new target is not delayed once again by poll().

v2:
- no poll timeout also when large number of evicts is pending

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


diff -r 06cf45130725 -r da01faa3e11e tools/xenpaging/policy_default.c
--- a/tools/xenpaging/policy_default.c	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/policy_default.c	Mon Feb 20 21:18:44 2012 +0100
@@ -90,6 +90,7 @@
         /* Could not nominate any gfn */
         if ( wrap == current_gfn )
         {
+            paging->use_poll_timeout = 1;
             /* Count wrap arounds */
             unconsumed_cleared++;
             /* Force retry every few seconds (depends on poll() timeout) */
diff -r 06cf45130725 -r da01faa3e11e tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
@@ -84,6 +84,7 @@
     struct pollfd fd[2];
     int port;
     int rc;
+    int timeout;
 
     /* Wait for event channel and xenstore */
     fd[0].fd = xc_evtchn_fd(xce);
@@ -91,7 +92,9 @@
     fd[1].fd = xs_fileno(paging->xs_handle);
     fd[1].events = POLLIN | POLLERR;
 
-    rc = poll(fd, 2, 100);
+    /* No timeout while page-out is still in progress */
+    timeout = paging->use_poll_timeout ? 100 : 0;
+    rc = poll(fd, 2, timeout);
     if ( rc < 0 )
     {
         if (errno == EINTR)
@@ -133,6 +136,8 @@
                         if ( target_tot_pages < 0 || target_tot_pages > paging->max_pages )
                             target_tot_pages = paging->max_pages;
                         paging->target_tot_pages = target_tot_pages;
+                        /* Disable poll() delay while new target is not yet reached */
+                        paging->use_poll_timeout = 0;
                         DPRINTF("new target_tot_pages %d\n", target_tot_pages);
                     }
                     free(val);
@@ -970,7 +975,10 @@
             }
             /* Limit the number of evicts to be able to process page-in requests */
             if ( num > 42 )
+            {
+                paging->use_poll_timeout = 0;
                 num = 42;
+            }
             evict_pages(paging, fd, num);
         }
         /* Resume some pages if target not reached */
@@ -984,6 +992,11 @@
             }
             resume_pages(paging, num);
         }
+        /* Now target was reached, enable poll() timeout */
+        else
+        {
+            paging->use_poll_timeout = 1;
+        }
 
     }
     DPRINTF("xenpaging got signal %d\n", interrupted);
diff -r 06cf45130725 -r da01faa3e11e tools/xenpaging/xenpaging.h
--- a/tools/xenpaging/xenpaging.h	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.h	Mon Feb 20 21:18:44 2012 +0100
@@ -55,6 +55,7 @@
     int num_paged_out;
     int target_tot_pages;
     int policy_mru_size;
+    int use_poll_timeout;
     int debug;
     unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE];
 };

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:26 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05aq-0004on-W0; Wed, 22 Feb 2012 06:22:24 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ap-0004jz-Ta
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:24 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1329891735!9224848!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14465 invoked from network); 22 Feb 2012 06:22:16 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:16 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ah-0004Rl-7T
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ah-00014t-64
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:15 +0000
Message-Id: <E1S05ah-00014t-64@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: no poll timeout while
	page-out is in progress
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329769124 -3600
# Node ID da01faa3e11eb5fe5d4a6ad2beee0c802020cfaa
# Parent  06cf45130725c021623f9c20b9d3ac2f925922f2
xenpaging: no poll timeout while page-out is in progress

The main loop calls xenpaging_wait_for_event_or_timeout() unconditionally
before doing any work. This function calls poll() with a timeout of 100ms. As
a result the page-out process is very slow due to the delay in poll().

Call poll() without timeout so that it returns immediately until the page-out
is done. Page-out is done when either the policy finds no more pages to
nominate or when the requested number of pages is reached.

The condition is cleared when a watch event arrives, so that processing the
new target is not delayed once again by poll().

v2:
- no poll timeout also when large number of evicts is pending

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


diff -r 06cf45130725 -r da01faa3e11e tools/xenpaging/policy_default.c
--- a/tools/xenpaging/policy_default.c	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/policy_default.c	Mon Feb 20 21:18:44 2012 +0100
@@ -90,6 +90,7 @@
         /* Could not nominate any gfn */
         if ( wrap == current_gfn )
         {
+            paging->use_poll_timeout = 1;
             /* Count wrap arounds */
             unconsumed_cleared++;
             /* Force retry every few seconds (depends on poll() timeout) */
diff -r 06cf45130725 -r da01faa3e11e tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
@@ -84,6 +84,7 @@
     struct pollfd fd[2];
     int port;
     int rc;
+    int timeout;
 
     /* Wait for event channel and xenstore */
     fd[0].fd = xc_evtchn_fd(xce);
@@ -91,7 +92,9 @@
     fd[1].fd = xs_fileno(paging->xs_handle);
     fd[1].events = POLLIN | POLLERR;
 
-    rc = poll(fd, 2, 100);
+    /* No timeout while page-out is still in progress */
+    timeout = paging->use_poll_timeout ? 100 : 0;
+    rc = poll(fd, 2, timeout);
     if ( rc < 0 )
     {
         if (errno == EINTR)
@@ -133,6 +136,8 @@
                         if ( target_tot_pages < 0 || target_tot_pages > paging->max_pages )
                             target_tot_pages = paging->max_pages;
                         paging->target_tot_pages = target_tot_pages;
+                        /* Disable poll() delay while new target is not yet reached */
+                        paging->use_poll_timeout = 0;
                         DPRINTF("new target_tot_pages %d\n", target_tot_pages);
                     }
                     free(val);
@@ -970,7 +975,10 @@
             }
             /* Limit the number of evicts to be able to process page-in requests */
             if ( num > 42 )
+            {
+                paging->use_poll_timeout = 0;
                 num = 42;
+            }
             evict_pages(paging, fd, num);
         }
         /* Resume some pages if target not reached */
@@ -984,6 +992,11 @@
             }
             resume_pages(paging, num);
         }
+        /* Now target was reached, enable poll() timeout */
+        else
+        {
+            paging->use_poll_timeout = 1;
+        }
 
     }
     DPRINTF("xenpaging got signal %d\n", interrupted);
diff -r 06cf45130725 -r da01faa3e11e tools/xenpaging/xenpaging.h
--- a/tools/xenpaging/xenpaging.h	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.h	Mon Feb 20 21:18:44 2012 +0100
@@ -55,6 +55,7 @@
     int num_paged_out;
     int target_tot_pages;
     int policy_mru_size;
+    int use_poll_timeout;
     int debug;
     unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE];
 };

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05as-0004qw-AO; Wed, 22 Feb 2012 06:22:26 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ar-0004kU-Eh
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-216.messagelabs.com!1329891738!15867354!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2497 invoked from network); 22 Feb 2012 06:22:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05aj-0004S0-SV
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05aj-00016j-RC
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:17 +0000
Message-Id: <E1S05aj-00016j-RC@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: move pagefile
	filedescriptor into struct xenpaging
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329769124 -3600
# Node ID 58c5b8c9ad8a8be43c4c5fb8020d4578a49b7199
# Parent  80a9d3190b7c58a5d13017f770f1a5915288ec37
xenpaging: move pagefile filedescriptor into struct xenpaging

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


diff -r 80a9d3190b7c -r 58c5b8c9ad8a tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
@@ -448,6 +448,14 @@
         goto err;
     }
 
+    /* Open file */
+    paging->fd = open(filename, O_CREAT | O_TRUNC | O_RDWR, S_IRUSR | S_IWUSR);
+    if ( paging->fd < 0 )
+    {
+        PERROR("failed to open file");
+        goto err;
+    }
+
     return paging;
 
  err:
@@ -562,7 +570,7 @@
  * Returns 0 on successful evict
  * Returns > 0 if gfn can not be evicted
  */
-static int xenpaging_evict_page(struct xenpaging *paging, unsigned long gfn, int fd, int slot)
+static int xenpaging_evict_page(struct xenpaging *paging, unsigned long gfn, int slot)
 {
     xc_interface *xch = paging->xc_handle;
     void *page;
@@ -593,7 +601,7 @@
     }
 
     /* Copy page */
-    ret = write_page(fd, page, slot);
+    ret = write_page(paging->fd, page, slot);
     if ( ret < 0 )
     {
         PERROR("Error copying page %lx", gfn);
@@ -670,7 +678,7 @@
     return ret;
 }
 
-static int xenpaging_populate_page(struct xenpaging *paging, unsigned long gfn, int fd, int i)
+static int xenpaging_populate_page(struct xenpaging *paging, unsigned long gfn, int i)
 {
     xc_interface *xch = paging->xc_handle;
     int ret;
@@ -679,7 +687,7 @@
     DPRINTF("populate_page < gfn %lx pageslot %d\n", gfn, i);
 
     /* Read page */
-    ret = read_page(fd, paging_buffer, i);
+    ret = read_page(paging->fd, paging_buffer, i);
     if ( ret != 0 )
     {
         PERROR("Error reading page");
@@ -738,7 +746,7 @@
  * Returns 0 on successful evict
  * Returns > 0 if no gfn can be evicted
  */
-static int evict_victim(struct xenpaging *paging, int fd, int slot)
+static int evict_victim(struct xenpaging *paging, int slot)
 {
     xc_interface *xch = paging->xc_handle;
     unsigned long gfn;
@@ -771,7 +779,7 @@
             goto out;
         }
 
-        ret = xenpaging_evict_page(paging, gfn, fd, slot);
+        ret = xenpaging_evict_page(paging, gfn, slot);
         if ( ret < 0 )
             goto out;
     }
@@ -791,7 +799,7 @@
  * Returns 0 if no gfn can be evicted
  * Returns > 0 on successful evict
  */
-static int evict_pages(struct xenpaging *paging, int fd, int num_pages)
+static int evict_pages(struct xenpaging *paging, int num_pages)
 {
     xc_interface *xch = paging->xc_handle;
     int rc, slot, num = 0;
@@ -802,7 +810,7 @@
         if ( paging->slot_to_gfn[slot] )
             continue;
 
-        rc = evict_victim(paging, fd, slot);
+        rc = evict_victim(paging, slot);
         if ( rc )
         {
             num = rc < 0 ? -1 : num;
@@ -826,10 +834,6 @@
     int rc;
     xc_interface *xch;
 
-    int open_flags = O_CREAT | O_TRUNC | O_RDWR;
-    mode_t open_mode = S_IRUSR | S_IWUSR;
-    int fd;
-
     /* Initialise domain paging */
     paging = xenpaging_init(argc, argv);
     if ( paging == NULL )
@@ -841,14 +845,6 @@
 
     DPRINTF("starting %s for domain_id %u with pagefile %s\n", argv[0], paging->mem_event.domain_id, filename);
 
-    /* Open file */
-    fd = open(filename, open_flags, open_mode);
-    if ( fd < 0 )
-    {
-        perror("failed to open file");
-        return 2;
-    }
-
     /* ensure that if we get a signal, we'll do cleanup, then exit */
     act.sa_handler = close_handler;
     act.sa_flags = 0;
@@ -911,7 +907,7 @@
                 else
                 {
                     /* Populate the page */
-                    if ( xenpaging_populate_page(paging, req.gfn, fd, slot) < 0 )
+                    if ( xenpaging_populate_page(paging, req.gfn, slot) < 0 )
                     {
                         ERROR("Error populating page %"PRIx64"", req.gfn);
                         goto out;
@@ -1005,7 +1001,7 @@
                 paging->use_poll_timeout = 0;
                 num = 42;
             }
-            if ( evict_pages(paging, fd, num) < 0 )
+            if ( evict_pages(paging, num) < 0 )
                 goto out;
         }
         /* Resume some pages if target not reached */
@@ -1033,7 +1029,7 @@
     DPRINTF("xenpaging got signal %d\n", interrupted);
 
  out:
-    close(fd);
+    close(paging->fd);
     unlink_pagefile();
 
     /* Tear down domain paging */
diff -r 80a9d3190b7c -r 58c5b8c9ad8a tools/xenpaging/xenpaging.h
--- a/tools/xenpaging/xenpaging.h	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.h	Mon Feb 20 21:18:44 2012 +0100
@@ -50,6 +50,7 @@
     int *gfn_to_slot;
 
     struct mem_event mem_event;
+    int fd;
     /* number of pages for which data structures were allocated */
     int max_pages;
     int num_paged_out;

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05as-0004qw-AO; Wed, 22 Feb 2012 06:22:26 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ar-0004kU-Eh
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-216.messagelabs.com!1329891738!15867354!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2497 invoked from network); 22 Feb 2012 06:22:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05aj-0004S0-SV
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05aj-00016j-RC
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:17 +0000
Message-Id: <E1S05aj-00016j-RC@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: move pagefile
	filedescriptor into struct xenpaging
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329769124 -3600
# Node ID 58c5b8c9ad8a8be43c4c5fb8020d4578a49b7199
# Parent  80a9d3190b7c58a5d13017f770f1a5915288ec37
xenpaging: move pagefile filedescriptor into struct xenpaging

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


diff -r 80a9d3190b7c -r 58c5b8c9ad8a tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
@@ -448,6 +448,14 @@
         goto err;
     }
 
+    /* Open file */
+    paging->fd = open(filename, O_CREAT | O_TRUNC | O_RDWR, S_IRUSR | S_IWUSR);
+    if ( paging->fd < 0 )
+    {
+        PERROR("failed to open file");
+        goto err;
+    }
+
     return paging;
 
  err:
@@ -562,7 +570,7 @@
  * Returns 0 on successful evict
  * Returns > 0 if gfn can not be evicted
  */
-static int xenpaging_evict_page(struct xenpaging *paging, unsigned long gfn, int fd, int slot)
+static int xenpaging_evict_page(struct xenpaging *paging, unsigned long gfn, int slot)
 {
     xc_interface *xch = paging->xc_handle;
     void *page;
@@ -593,7 +601,7 @@
     }
 
     /* Copy page */
-    ret = write_page(fd, page, slot);
+    ret = write_page(paging->fd, page, slot);
     if ( ret < 0 )
     {
         PERROR("Error copying page %lx", gfn);
@@ -670,7 +678,7 @@
     return ret;
 }
 
-static int xenpaging_populate_page(struct xenpaging *paging, unsigned long gfn, int fd, int i)
+static int xenpaging_populate_page(struct xenpaging *paging, unsigned long gfn, int i)
 {
     xc_interface *xch = paging->xc_handle;
     int ret;
@@ -679,7 +687,7 @@
     DPRINTF("populate_page < gfn %lx pageslot %d\n", gfn, i);
 
     /* Read page */
-    ret = read_page(fd, paging_buffer, i);
+    ret = read_page(paging->fd, paging_buffer, i);
     if ( ret != 0 )
     {
         PERROR("Error reading page");
@@ -738,7 +746,7 @@
  * Returns 0 on successful evict
  * Returns > 0 if no gfn can be evicted
  */
-static int evict_victim(struct xenpaging *paging, int fd, int slot)
+static int evict_victim(struct xenpaging *paging, int slot)
 {
     xc_interface *xch = paging->xc_handle;
     unsigned long gfn;
@@ -771,7 +779,7 @@
             goto out;
         }
 
-        ret = xenpaging_evict_page(paging, gfn, fd, slot);
+        ret = xenpaging_evict_page(paging, gfn, slot);
         if ( ret < 0 )
             goto out;
     }
@@ -791,7 +799,7 @@
  * Returns 0 if no gfn can be evicted
  * Returns > 0 on successful evict
  */
-static int evict_pages(struct xenpaging *paging, int fd, int num_pages)
+static int evict_pages(struct xenpaging *paging, int num_pages)
 {
     xc_interface *xch = paging->xc_handle;
     int rc, slot, num = 0;
@@ -802,7 +810,7 @@
         if ( paging->slot_to_gfn[slot] )
             continue;
 
-        rc = evict_victim(paging, fd, slot);
+        rc = evict_victim(paging, slot);
         if ( rc )
         {
             num = rc < 0 ? -1 : num;
@@ -826,10 +834,6 @@
     int rc;
     xc_interface *xch;
 
-    int open_flags = O_CREAT | O_TRUNC | O_RDWR;
-    mode_t open_mode = S_IRUSR | S_IWUSR;
-    int fd;
-
     /* Initialise domain paging */
     paging = xenpaging_init(argc, argv);
     if ( paging == NULL )
@@ -841,14 +845,6 @@
 
     DPRINTF("starting %s for domain_id %u with pagefile %s\n", argv[0], paging->mem_event.domain_id, filename);
 
-    /* Open file */
-    fd = open(filename, open_flags, open_mode);
-    if ( fd < 0 )
-    {
-        perror("failed to open file");
-        return 2;
-    }
-
     /* ensure that if we get a signal, we'll do cleanup, then exit */
     act.sa_handler = close_handler;
     act.sa_flags = 0;
@@ -911,7 +907,7 @@
                 else
                 {
                     /* Populate the page */
-                    if ( xenpaging_populate_page(paging, req.gfn, fd, slot) < 0 )
+                    if ( xenpaging_populate_page(paging, req.gfn, slot) < 0 )
                     {
                         ERROR("Error populating page %"PRIx64"", req.gfn);
                         goto out;
@@ -1005,7 +1001,7 @@
                 paging->use_poll_timeout = 0;
                 num = 42;
             }
-            if ( evict_pages(paging, fd, num) < 0 )
+            if ( evict_pages(paging, num) < 0 )
                 goto out;
         }
         /* Resume some pages if target not reached */
@@ -1033,7 +1029,7 @@
     DPRINTF("xenpaging got signal %d\n", interrupted);
 
  out:
-    close(fd);
+    close(paging->fd);
     unlink_pagefile();
 
     /* Tear down domain paging */
diff -r 80a9d3190b7c -r 58c5b8c9ad8a tools/xenpaging/xenpaging.h
--- a/tools/xenpaging/xenpaging.h	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.h	Mon Feb 20 21:18:44 2012 +0100
@@ -50,6 +50,7 @@
     int *gfn_to_slot;
 
     struct mem_event mem_event;
+    int fd;
     /* number of pages for which data structures were allocated */
     int max_pages;
     int num_paged_out;

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05at-0004se-De; Wed, 22 Feb 2012 06:22:27 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ar-0004kl-PB
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1329891737!15795376!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24703 invoked from network); 22 Feb 2012 06:22:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ai-0004Ru-QM
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ai-00015z-P9
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:16 +0000
Message-Id: <E1S05ai-00015z-P9@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: improve performance in
	policy_choose_victim
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329769124 -3600
# Node ID 6b14211c3e7729252d00b52976d96cd80153bbef
# Parent  68f149bbee77b3ce12702475b27d3d5002cf4c19
xenpaging: improve performance in policy_choose_victim

policy_choose_victim() is one of the bottlenecks in xenpaging. It is called
alot to find free bits in the fragmented bitmaps.

Reduce turnaround time by skipping longs with all bits set.
Adjust wrap detection in loop.

v2:
 - fix copy&paste error, bitmap was tested twice

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


diff -r 68f149bbee77 -r 6b14211c3e77 tools/xenpaging/policy_default.c
--- a/tools/xenpaging/policy_default.c	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/policy_default.c	Mon Feb 20 21:18:44 2012 +0100
@@ -80,33 +80,58 @@
 unsigned long policy_choose_victim(struct xenpaging *paging)
 {
     xc_interface *xch = paging->xc_handle;
-    unsigned long wrap = current_gfn;
+    unsigned long i;
 
-    do
+    /* One iteration over all possible gfns */
+    for ( i = 0; i < max_pages; i++ )
     {
+        /* Try next gfn */
         current_gfn++;
+
+        /* Restart on wrap */
         if ( current_gfn >= max_pages )
             current_gfn = 0;
-        /* Could not nominate any gfn */
-        if ( wrap == current_gfn )
+
+        if ( (current_gfn & (BITS_PER_LONG - 1)) == 0 )
         {
-            paging->use_poll_timeout = 1;
-            /* Count wrap arounds */
-            unconsumed_cleared++;
-            /* Force retry every few seconds (depends on poll() timeout) */
-            if ( unconsumed_cleared > 123)
+            /* All gfns busy */
+            if ( ~bitmap[current_gfn >> ORDER_LONG] == 0 || ~unconsumed[current_gfn >> ORDER_LONG] == 0 )
             {
-                /* Force retry of unconsumed gfns */
-                bitmap_clear(unconsumed, max_pages);
-                unconsumed_cleared = 0;
-                DPRINTF("clearing unconsumed, wrap %lx", wrap);
-                /* One more round before returning ENOSPC */
+                current_gfn += BITS_PER_LONG;
+                i += BITS_PER_LONG;
                 continue;
             }
-            return INVALID_MFN;
         }
+
+        /* gfn busy */
+        if ( test_bit(current_gfn, bitmap) )
+            continue;
+
+        /* gfn already tested */
+        if ( test_bit(current_gfn, unconsumed) )
+            continue;
+
+        /* gfn found */
+        break;
     }
-    while ( test_bit(current_gfn, bitmap) || test_bit(current_gfn, unconsumed) );
+
+    /* Could not nominate any gfn */
+    if ( i >= max_pages )
+    {
+        /* No more pages, wait in poll */
+        paging->use_poll_timeout = 1;
+        /* Count wrap arounds */
+        unconsumed_cleared++;
+        /* Force retry every few seconds (depends on poll() timeout) */
+        if ( unconsumed_cleared > 123)
+        {
+            /* Force retry of unconsumed gfns on next call */
+            bitmap_clear(unconsumed, max_pages);
+            unconsumed_cleared = 0;
+            DPRINTF("clearing unconsumed, current_gfn %lx", current_gfn);
+        }
+        return INVALID_MFN;
+    }
 
     set_bit(current_gfn, unconsumed);
     return current_gfn;

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05at-0004se-De; Wed, 22 Feb 2012 06:22:27 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ar-0004kl-PB
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1329891737!15795376!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24703 invoked from network); 22 Feb 2012 06:22:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ai-0004Ru-QM
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ai-00015z-P9
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:16 +0000
Message-Id: <E1S05ai-00015z-P9@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: improve performance in
	policy_choose_victim
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329769124 -3600
# Node ID 6b14211c3e7729252d00b52976d96cd80153bbef
# Parent  68f149bbee77b3ce12702475b27d3d5002cf4c19
xenpaging: improve performance in policy_choose_victim

policy_choose_victim() is one of the bottlenecks in xenpaging. It is called
alot to find free bits in the fragmented bitmaps.

Reduce turnaround time by skipping longs with all bits set.
Adjust wrap detection in loop.

v2:
 - fix copy&paste error, bitmap was tested twice

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


diff -r 68f149bbee77 -r 6b14211c3e77 tools/xenpaging/policy_default.c
--- a/tools/xenpaging/policy_default.c	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/policy_default.c	Mon Feb 20 21:18:44 2012 +0100
@@ -80,33 +80,58 @@
 unsigned long policy_choose_victim(struct xenpaging *paging)
 {
     xc_interface *xch = paging->xc_handle;
-    unsigned long wrap = current_gfn;
+    unsigned long i;
 
-    do
+    /* One iteration over all possible gfns */
+    for ( i = 0; i < max_pages; i++ )
     {
+        /* Try next gfn */
         current_gfn++;
+
+        /* Restart on wrap */
         if ( current_gfn >= max_pages )
             current_gfn = 0;
-        /* Could not nominate any gfn */
-        if ( wrap == current_gfn )
+
+        if ( (current_gfn & (BITS_PER_LONG - 1)) == 0 )
         {
-            paging->use_poll_timeout = 1;
-            /* Count wrap arounds */
-            unconsumed_cleared++;
-            /* Force retry every few seconds (depends on poll() timeout) */
-            if ( unconsumed_cleared > 123)
+            /* All gfns busy */
+            if ( ~bitmap[current_gfn >> ORDER_LONG] == 0 || ~unconsumed[current_gfn >> ORDER_LONG] == 0 )
             {
-                /* Force retry of unconsumed gfns */
-                bitmap_clear(unconsumed, max_pages);
-                unconsumed_cleared = 0;
-                DPRINTF("clearing unconsumed, wrap %lx", wrap);
-                /* One more round before returning ENOSPC */
+                current_gfn += BITS_PER_LONG;
+                i += BITS_PER_LONG;
                 continue;
             }
-            return INVALID_MFN;
         }
+
+        /* gfn busy */
+        if ( test_bit(current_gfn, bitmap) )
+            continue;
+
+        /* gfn already tested */
+        if ( test_bit(current_gfn, unconsumed) )
+            continue;
+
+        /* gfn found */
+        break;
     }
-    while ( test_bit(current_gfn, bitmap) || test_bit(current_gfn, unconsumed) );
+
+    /* Could not nominate any gfn */
+    if ( i >= max_pages )
+    {
+        /* No more pages, wait in poll */
+        paging->use_poll_timeout = 1;
+        /* Count wrap arounds */
+        unconsumed_cleared++;
+        /* Force retry every few seconds (depends on poll() timeout) */
+        if ( unconsumed_cleared > 123)
+        {
+            /* Force retry of unconsumed gfns on next call */
+            bitmap_clear(unconsumed, max_pages);
+            unconsumed_cleared = 0;
+            DPRINTF("clearing unconsumed, current_gfn %lx", current_gfn);
+        }
+        return INVALID_MFN;
+    }
 
     set_bit(current_gfn, unconsumed);
     return current_gfn;

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05at-0004sv-IU; Wed, 22 Feb 2012 06:22:27 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ar-0004kr-Qw
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-27.messagelabs.com!1329891680!57689398!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3216 invoked from network); 22 Feb 2012 06:21:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:21:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ak-0004S3-D9
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ak-000176-C0
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:18 +0000
Message-Id: <E1S05ak-000176-C0@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: move page_buffer into
	struct xenpaging
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329769124 -3600
# Node ID 97a6ccbe6a1aa363c772f979a84ab10d681c19d6
# Parent  58c5b8c9ad8a8be43c4c5fb8020d4578a49b7199
xenpaging: move page_buffer into struct xenpaging

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


diff -r 58c5b8c9ad8a -r 97a6ccbe6a1a tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
@@ -44,7 +44,6 @@
 static char watch_token[16];
 static char *filename;
 static int interrupted;
-static void *paging_buffer = NULL;
 
 static void unlink_pagefile(void)
 {
@@ -441,8 +440,8 @@
         goto err;
     }
 
-    paging_buffer = init_page();
-    if ( !paging_buffer )
+    paging->paging_buffer = init_page();
+    if ( !paging->paging_buffer )
     {
         PERROR("Creating page aligned load buffer");
         goto err;
@@ -465,6 +464,11 @@
             xs_close(paging->xs_handle);
         if ( xch )
             xc_interface_close(xch);
+        if ( paging->paging_buffer )
+        {
+            munlock(paging->paging_buffer, PAGE_SIZE);
+            free(paging->paging_buffer);
+        }
         if ( paging->mem_event.shared_page )
         {
             munlock(paging->mem_event.shared_page, PAGE_SIZE);
@@ -687,7 +691,7 @@
     DPRINTF("populate_page < gfn %lx pageslot %d\n", gfn, i);
 
     /* Read page */
-    ret = read_page(paging->fd, paging_buffer, i);
+    ret = read_page(paging->fd, paging->paging_buffer, i);
     if ( ret != 0 )
     {
         PERROR("Error reading page");
@@ -697,8 +701,7 @@
     do
     {
         /* Tell Xen to allocate a page for the domain */
-        ret = xc_mem_paging_load(xch, paging->mem_event.domain_id, gfn,
-                                    paging_buffer);
+        ret = xc_mem_paging_load(xch, paging->mem_event.domain_id, gfn, paging->paging_buffer);
         if ( ret < 0 )
         {
             if ( errno == ENOMEM )
diff -r 58c5b8c9ad8a -r 97a6ccbe6a1a tools/xenpaging/xenpaging.h
--- a/tools/xenpaging/xenpaging.h	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.h	Mon Feb 20 21:18:44 2012 +0100
@@ -49,6 +49,8 @@
     unsigned long *slot_to_gfn;
     int *gfn_to_slot;
 
+    void *paging_buffer;
+
     struct mem_event mem_event;
     int fd;
     /* number of pages for which data structures were allocated */

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05at-0004sv-IU; Wed, 22 Feb 2012 06:22:27 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ar-0004kr-Qw
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-27.messagelabs.com!1329891680!57689398!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3216 invoked from network); 22 Feb 2012 06:21:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:21:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ak-0004S3-D9
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ak-000176-C0
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:18 +0000
Message-Id: <E1S05ak-000176-C0@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: move page_buffer into
	struct xenpaging
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329769124 -3600
# Node ID 97a6ccbe6a1aa363c772f979a84ab10d681c19d6
# Parent  58c5b8c9ad8a8be43c4c5fb8020d4578a49b7199
xenpaging: move page_buffer into struct xenpaging

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


diff -r 58c5b8c9ad8a -r 97a6ccbe6a1a tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
@@ -44,7 +44,6 @@
 static char watch_token[16];
 static char *filename;
 static int interrupted;
-static void *paging_buffer = NULL;
 
 static void unlink_pagefile(void)
 {
@@ -441,8 +440,8 @@
         goto err;
     }
 
-    paging_buffer = init_page();
-    if ( !paging_buffer )
+    paging->paging_buffer = init_page();
+    if ( !paging->paging_buffer )
     {
         PERROR("Creating page aligned load buffer");
         goto err;
@@ -465,6 +464,11 @@
             xs_close(paging->xs_handle);
         if ( xch )
             xc_interface_close(xch);
+        if ( paging->paging_buffer )
+        {
+            munlock(paging->paging_buffer, PAGE_SIZE);
+            free(paging->paging_buffer);
+        }
         if ( paging->mem_event.shared_page )
         {
             munlock(paging->mem_event.shared_page, PAGE_SIZE);
@@ -687,7 +691,7 @@
     DPRINTF("populate_page < gfn %lx pageslot %d\n", gfn, i);
 
     /* Read page */
-    ret = read_page(paging->fd, paging_buffer, i);
+    ret = read_page(paging->fd, paging->paging_buffer, i);
     if ( ret != 0 )
     {
         PERROR("Error reading page");
@@ -697,8 +701,7 @@
     do
     {
         /* Tell Xen to allocate a page for the domain */
-        ret = xc_mem_paging_load(xch, paging->mem_event.domain_id, gfn,
-                                    paging_buffer);
+        ret = xc_mem_paging_load(xch, paging->mem_event.domain_id, gfn, paging->paging_buffer);
         if ( ret < 0 )
         {
             if ( errno == ENOMEM )
diff -r 58c5b8c9ad8a -r 97a6ccbe6a1a tools/xenpaging/xenpaging.h
--- a/tools/xenpaging/xenpaging.h	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.h	Mon Feb 20 21:18:44 2012 +0100
@@ -49,6 +49,8 @@
     unsigned long *slot_to_gfn;
     int *gfn_to_slot;
 
+    void *paging_buffer;
+
     struct mem_event mem_event;
     int fd;
     /* number of pages for which data structures were allocated */

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:29 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05au-0004uQ-MP; Wed, 22 Feb 2012 06:22:28 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05as-0004lD-MB
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-216.messagelabs.com!1329891739!15867355!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2522 invoked from network); 22 Feb 2012 06:22:20 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ak-0004S6-UP
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ak-00017T-TB
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:18 +0000
Message-Id: <E1S05ak-00017T-TB@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: implement stack of free
	slots in pagefile
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329769124 -3600
# Node ID 4566a48436878af248dd8693c00bd1e3221d4150
# Parent  97a6ccbe6a1aa363c772f979a84ab10d681c19d6
xenpaging: implement stack of free slots in pagefile

Scanning the slot_to_gfn[] array for a free slot is expensive because
evict_pages() always needs to scan the whole array. Remember the last
slots freed during page-in requests and reuse them in evict_pages().

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


diff -r 97a6ccbe6a1a -r 4566a4843687 tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
@@ -432,6 +432,11 @@
     if ( !paging->slot_to_gfn || !paging->gfn_to_slot )
         goto err;
 
+    /* Allocate stack for known free slots in pagefile */
+    paging->free_slot_stack = calloc(paging->max_pages, sizeof(*paging->free_slot_stack));
+    if ( !paging->free_slot_stack )
+        goto err;
+
     /* Initialise policy */
     rc = policy_init(paging);
     if ( rc != 0 )
@@ -483,6 +488,7 @@
 
         free(dom_path);
         free(watch_target_tot_pages);
+        free(paging->free_slot_stack);
         free(paging->slot_to_gfn);
         free(paging->gfn_to_slot);
         free(paging->bitmap);
@@ -807,6 +813,20 @@
     xc_interface *xch = paging->xc_handle;
     int rc, slot, num = 0;
 
+    /* Reuse known free slots */
+    while ( paging->stack_count > 0 && num < num_pages )
+    {
+        slot = paging->free_slot_stack[--paging->stack_count];
+        rc = evict_victim(paging, slot);
+        if ( rc )
+        {
+            num = rc < 0 ? -1 : num;
+            return num;
+        }
+        num++;
+    }
+
+    /* Scan all slots slots for remainders */
     for ( slot = 0; slot < paging->max_pages && num < num_pages; slot++ )
     {
         /* Slot is allocated */
@@ -930,6 +950,9 @@
 
                 /* Clear this pagefile slot */
                 paging->slot_to_gfn[slot] = 0;
+
+                /* Record this free slot */
+                paging->free_slot_stack[paging->stack_count++] = slot;
             }
             else
             {
diff -r 97a6ccbe6a1a -r 4566a4843687 tools/xenpaging/xenpaging.h
--- a/tools/xenpaging/xenpaging.h	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.h	Mon Feb 20 21:18:44 2012 +0100
@@ -60,6 +60,8 @@
     int policy_mru_size;
     int use_poll_timeout;
     int debug;
+    int stack_count;
+    int *free_slot_stack;
     unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE];
 };
 

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

From xen-changelog-bounces@lists.xen.org Wed Feb 22 06:22:29 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2012 06:22:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S05au-0004uQ-MP; Wed, 22 Feb 2012 06:22:28 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05as-0004lD-MB
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-216.messagelabs.com!1329891739!15867355!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2522 invoked from network); 22 Feb 2012 06:22:20 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Feb 2012 06:22:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ak-0004S6-UP
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S05ak-00017T-TB
	for xen-changelog@lists.xensource.com; Wed, 22 Feb 2012 06:22:18 +0000
Message-Id: <E1S05ak-00017T-TB@xenbits.xen.org>
Date: Wed, 22 Feb 2012 06:22:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: implement stack of free
	slots in pagefile
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329769124 -3600
# Node ID 4566a48436878af248dd8693c00bd1e3221d4150
# Parent  97a6ccbe6a1aa363c772f979a84ab10d681c19d6
xenpaging: implement stack of free slots in pagefile

Scanning the slot_to_gfn[] array for a free slot is expensive because
evict_pages() always needs to scan the whole array. Remember the last
slots freed during page-in requests and reuse them in evict_pages().

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


diff -r 97a6ccbe6a1a -r 4566a4843687 tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.c	Mon Feb 20 21:18:44 2012 +0100
@@ -432,6 +432,11 @@
     if ( !paging->slot_to_gfn || !paging->gfn_to_slot )
         goto err;
 
+    /* Allocate stack for known free slots in pagefile */
+    paging->free_slot_stack = calloc(paging->max_pages, sizeof(*paging->free_slot_stack));
+    if ( !paging->free_slot_stack )
+        goto err;
+
     /* Initialise policy */
     rc = policy_init(paging);
     if ( rc != 0 )
@@ -483,6 +488,7 @@
 
         free(dom_path);
         free(watch_target_tot_pages);
+        free(paging->free_slot_stack);
         free(paging->slot_to_gfn);
         free(paging->gfn_to_slot);
         free(paging->bitmap);
@@ -807,6 +813,20 @@
     xc_interface *xch = paging->xc_handle;
     int rc, slot, num = 0;
 
+    /* Reuse known free slots */
+    while ( paging->stack_count > 0 && num < num_pages )
+    {
+        slot = paging->free_slot_stack[--paging->stack_count];
+        rc = evict_victim(paging, slot);
+        if ( rc )
+        {
+            num = rc < 0 ? -1 : num;
+            return num;
+        }
+        num++;
+    }
+
+    /* Scan all slots slots for remainders */
     for ( slot = 0; slot < paging->max_pages && num < num_pages; slot++ )
     {
         /* Slot is allocated */
@@ -930,6 +950,9 @@
 
                 /* Clear this pagefile slot */
                 paging->slot_to_gfn[slot] = 0;
+
+                /* Record this free slot */
+                paging->free_slot_stack[paging->stack_count++] = slot;
             }
             else
             {
diff -r 97a6ccbe6a1a -r 4566a4843687 tools/xenpaging/xenpaging.h
--- a/tools/xenpaging/xenpaging.h	Mon Feb 20 21:18:44 2012 +0100
+++ b/tools/xenpaging/xenpaging.h	Mon Feb 20 21:18:44 2012 +0100
@@ -60,6 +60,8 @@
     int policy_mru_size;
     int use_poll_timeout;
     int debug;
+    int stack_count;
+    int *free_slot_stack;
     unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE];
 };
 

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 05:44:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 05:44:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0RTU-0006QC-On; Thu, 23 Feb 2012 05:44:16 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTT-0006Q4-ON
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-27.messagelabs.com!1329975829!64668582!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16296 invoked from network); 23 Feb 2012 05:43:50 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 05:43:50 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTR-00057E-B0
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTR-0000nN-9S
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:13 +0000
Message-Id: <E1S0RTR-0000nN-9S@xenbits.xen.org>
Date: Thu, 23 Feb 2012 05:44:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: restore ELR_hyp and SPSR_hyp on
	return from hypervisor to hypervisor.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1329921203 0
# Node ID 70aeec92bd0aaabc9fd1718e753ef2cdba5057b8
# Parent  7705f168dee3507aa3246808dd6735ae2016e602
arm: restore ELR_hyp and SPSR_hyp on return from hypervisor to hypervisor.

This is necessary to handle nested traps to the hypervisor more than one deep.

I've not seen an actually failure relating to this but I'm not quite sure how
we've managed to get away with not doing it (I suppose multiply nested traps
are uncommon).

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


diff -r 7705f168dee3 -r 70aeec92bd0a xen/arch/arm/entry.S
--- a/xen/arch/arm/entry.S	Wed Feb 22 14:33:23 2012 +0000
+++ b/xen/arch/arm/entry.S	Wed Feb 22 14:33:23 2012 +0000
@@ -102,6 +102,10 @@
 
 ENTRY(return_to_hypervisor)
 	ldr lr, [sp, #UREGS_lr]
+	ldr r11, [sp, #UREGS_pc]
+	msr ELR_hyp, r11
+	ldr r11, [sp, #UREGS_cpsr]
+	msr SPSR_hyp, r11
 	pop {r0-r12}
 	add sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */
 	eret

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 05:44:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 05:44:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0RTU-0006QC-On; Thu, 23 Feb 2012 05:44:16 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTT-0006Q4-ON
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-27.messagelabs.com!1329975829!64668582!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16296 invoked from network); 23 Feb 2012 05:43:50 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 05:43:50 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTR-00057E-B0
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTR-0000nN-9S
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:13 +0000
Message-Id: <E1S0RTR-0000nN-9S@xenbits.xen.org>
Date: Thu, 23 Feb 2012 05:44:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: restore ELR_hyp and SPSR_hyp on
	return from hypervisor to hypervisor.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1329921203 0
# Node ID 70aeec92bd0aaabc9fd1718e753ef2cdba5057b8
# Parent  7705f168dee3507aa3246808dd6735ae2016e602
arm: restore ELR_hyp and SPSR_hyp on return from hypervisor to hypervisor.

This is necessary to handle nested traps to the hypervisor more than one deep.

I've not seen an actually failure relating to this but I'm not quite sure how
we've managed to get away with not doing it (I suppose multiply nested traps
are uncommon).

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


diff -r 7705f168dee3 -r 70aeec92bd0a xen/arch/arm/entry.S
--- a/xen/arch/arm/entry.S	Wed Feb 22 14:33:23 2012 +0000
+++ b/xen/arch/arm/entry.S	Wed Feb 22 14:33:23 2012 +0000
@@ -102,6 +102,10 @@
 
 ENTRY(return_to_hypervisor)
 	ldr lr, [sp, #UREGS_lr]
+	ldr r11, [sp, #UREGS_pc]
+	msr ELR_hyp, r11
+	ldr r11, [sp, #UREGS_cpsr]
+	msr SPSR_hyp, r11
 	pop {r0-r12}
 	add sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */
 	eret

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 05:44:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 05:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0RTV-0006QS-Re; Thu, 23 Feb 2012 05:44:17 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTU-0006Q0-Lj
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1329975797!53913658!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26129 invoked from network); 23 Feb 2012 05:43:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 05:43:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTP-000572-6p
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTP-0000lq-5J
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:11 +0000
Message-Id: <E1S0RTP-0000lq-5J@xenbits.xen.org>
Date: Thu, 23 Feb 2012 05:44:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] autoconf: clean brctl options
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1329916002 0
# Node ID d370b93ba7543769702a25d7b9c99e5aa9adac6d
# Parent  4aa563f19a18c476a378e844a2d4e37a79428eea
autoconf: clean brctl options

This bit was missing, sorry.

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 4aa563f19a18 -r d370b93ba754 tools/configure.ac
--- a/tools/configure.ac	Wed Feb 22 11:56:24 2012 +0000
+++ b/tools/configure.ac	Wed Feb 22 13:06:42 2012 +0000
@@ -62,7 +62,6 @@
 
 AC_ARG_VAR([PYTHON], [Path to the Python parser])
 AC_ARG_VAR([PERL], [Path to Perl parser])
-AC_ARG_VAR([BRCTL], [Path to brctl tool])
 AC_ARG_VAR([IP], [Path to ip tool])
 AC_ARG_VAR([BISON], [Path to Bison parser generator])
 AC_ARG_VAR([FLEX], [Path to Flex lexical analyser generator])

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 05:44:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 05:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0RTV-0006QS-Re; Thu, 23 Feb 2012 05:44:17 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTU-0006Q0-Lj
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1329975797!53913658!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26129 invoked from network); 23 Feb 2012 05:43:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 05:43:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTP-000572-6p
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTP-0000lq-5J
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:11 +0000
Message-Id: <E1S0RTP-0000lq-5J@xenbits.xen.org>
Date: Thu, 23 Feb 2012 05:44:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] autoconf: clean brctl options
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1329916002 0
# Node ID d370b93ba7543769702a25d7b9c99e5aa9adac6d
# Parent  4aa563f19a18c476a378e844a2d4e37a79428eea
autoconf: clean brctl options

This bit was missing, sorry.

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 4aa563f19a18 -r d370b93ba754 tools/configure.ac
--- a/tools/configure.ac	Wed Feb 22 11:56:24 2012 +0000
+++ b/tools/configure.ac	Wed Feb 22 13:06:42 2012 +0000
@@ -62,7 +62,6 @@
 
 AC_ARG_VAR([PYTHON], [Path to the Python parser])
 AC_ARG_VAR([PERL], [Path to Perl parser])
-AC_ARG_VAR([BRCTL], [Path to brctl tool])
 AC_ARG_VAR([IP], [Path to ip tool])
 AC_ARG_VAR([BISON], [Path to Bison parser generator])
 AC_ARG_VAR([FLEX], [Path to Flex lexical analyser generator])

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 05:44:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 05:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0RTV-0006Qb-US; Thu, 23 Feb 2012 05:44:17 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTU-0006QB-UC
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:17 +0000
Received: from [85.158.139.83:29933] by server-4.bemta-5.messagelabs.com id
	6C/B6-10788-032D54F4; Thu, 23 Feb 2012 05:44:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-182.messagelabs.com!1329975854!16265342!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12717 invoked from network); 23 Feb 2012 05:44:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 05:44:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTR-00057H-Rx
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTR-0000nk-QS
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:13 +0000
Message-Id: <E1S0RTR-0000nk-QS@xenbits.xen.org>
Date: Thu, 23 Feb 2012 05:44:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: lr register in hyp mode is
	really LR_usr.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1329921204 0
# Node ID a4d93d0e0df2fafe5b3e2dab3e34799498a875e2
# Parent  70aeec92bd0aaabc9fd1718e753ef2cdba5057b8
arm: lr register in hyp mode is really LR_usr.

Save and restore it in the same way for both hypervisor and user stack frames
rather than saving both individually in the user stack frame.

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


diff -r 70aeec92bd0a -r a4d93d0e0df2 xen/arch/arm/entry.S
--- a/xen/arch/arm/entry.S	Wed Feb 22 14:33:23 2012 +0000
+++ b/xen/arch/arm/entry.S	Wed Feb 22 14:33:24 2012 +0000
@@ -29,11 +29,10 @@
 	blne save_guest_regs
 
 save_guest_regs:
-	ldr r11, [sp, #UREGS_lr]
-	str r11, [sp, #UREGS_LR_usr]
 	ldr r11, =0xffffffff  /* Clobber SP which is only valid for hypervisor frames. */
 	str r11, [sp, #UREGS_sp]
 	SAVE_ONE_BANKED(SP_usr)
+	/* LR_usr is the same physical register as lr and is saved in SAVE_ALL */
 	SAVE_BANKED(svc)
 	SAVE_BANKED(abt)
 	SAVE_BANKED(und)
@@ -78,16 +77,13 @@
 	and r11, #PSR_MODE_MASK
 	cmp r11, #PSR_MODE_HYP
 	beq return_to_hypervisor
-
+	/* Fall thru */
 ENTRY(return_to_guest)
 	mov r11, sp
 	bic sp, #7 /* Align the stack pointer */
 	bl leave_hypervisor_tail
-	ldr r11, [sp, #UREGS_pc]
-	msr ELR_hyp, r11
-	ldr r11, [sp, #UREGS_cpsr]
-	msr SPSR_hyp, r11
 	RESTORE_ONE_BANKED(SP_usr)
+	/* LR_usr is the same physical register as lr and is restored below */
 	RESTORE_BANKED(svc)
 	RESTORE_BANKED(abt)
 	RESTORE_BANKED(und)
@@ -95,11 +91,7 @@
 	RESTORE_BANKED(fiq)
 	RESTORE_ONE_BANKED(R8_fiq); RESTORE_ONE_BANKED(R9_fiq); RESTORE_ONE_BANKED(R10_fiq)
 	RESTORE_ONE_BANKED(R11_fiq); RESTORE_ONE_BANKED(R12_fiq);
-	ldr lr, [sp, #UREGS_LR_usr]
-	pop {r0-r12}
-	add sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */
-	eret
-
+	/* Fall thru */
 ENTRY(return_to_hypervisor)
 	ldr lr, [sp, #UREGS_lr]
 	ldr r11, [sp, #UREGS_pc]
diff -r 70aeec92bd0a -r a4d93d0e0df2 xen/include/public/arch-arm.h
--- a/xen/include/public/arch-arm.h	Wed Feb 22 14:33:23 2012 +0000
+++ b/xen/include/public/arch-arm.h	Wed Feb 22 14:33:24 2012 +0000
@@ -63,7 +63,12 @@
     uint32_t r12;
 
     uint32_t sp; /* r13 - SP: Valid for Hyp. frames only, o/w banked (see below) */
-    uint32_t lr; /* r14 - LR: Valid for Hyp. Same physical register as lr_usr. */
+
+    /* r14 - LR: is the same physical register as LR_usr */
+    union {
+        uint32_t lr; /* r14 - LR: Valid for Hyp. Same physical register as lr_usr. */
+        uint32_t lr_usr;
+    };
 
     uint32_t pc; /* Return IP */
     uint32_t cpsr; /* Return mode */
@@ -73,10 +78,14 @@
 
     uint32_t r8_fiq, r9_fiq, r10_fiq, r11_fiq, r12_fiq;
 
-    uint32_t sp_usr, sp_svc, sp_abt, sp_und, sp_irq, sp_fiq;
-    uint32_t lr_usr, lr_svc, lr_abt, lr_und, lr_irq, lr_fiq;
+    uint32_t sp_usr; /* LR_usr is the same register as LR, see above */
+
+    uint32_t sp_svc, sp_abt, sp_und, sp_irq, sp_fiq;
+    uint32_t lr_svc, lr_abt, lr_und, lr_irq, lr_fiq;
 
     uint32_t spsr_svc, spsr_abt, spsr_und, spsr_irq, spsr_fiq;
+
+    uint32_t pad1; /* Doubleword-align the user half of the frame */
 };
 typedef struct cpu_user_regs cpu_user_regs_t;
 DEFINE_XEN_GUEST_HANDLE(cpu_user_regs_t);

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 05:44:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 05:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0RTV-0006Qb-US; Thu, 23 Feb 2012 05:44:17 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTU-0006QB-UC
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:17 +0000
Received: from [85.158.139.83:29933] by server-4.bemta-5.messagelabs.com id
	6C/B6-10788-032D54F4; Thu, 23 Feb 2012 05:44:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-182.messagelabs.com!1329975854!16265342!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12717 invoked from network); 23 Feb 2012 05:44:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 05:44:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTR-00057H-Rx
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTR-0000nk-QS
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:13 +0000
Message-Id: <E1S0RTR-0000nk-QS@xenbits.xen.org>
Date: Thu, 23 Feb 2012 05:44:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: lr register in hyp mode is
	really LR_usr.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1329921204 0
# Node ID a4d93d0e0df2fafe5b3e2dab3e34799498a875e2
# Parent  70aeec92bd0aaabc9fd1718e753ef2cdba5057b8
arm: lr register in hyp mode is really LR_usr.

Save and restore it in the same way for both hypervisor and user stack frames
rather than saving both individually in the user stack frame.

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


diff -r 70aeec92bd0a -r a4d93d0e0df2 xen/arch/arm/entry.S
--- a/xen/arch/arm/entry.S	Wed Feb 22 14:33:23 2012 +0000
+++ b/xen/arch/arm/entry.S	Wed Feb 22 14:33:24 2012 +0000
@@ -29,11 +29,10 @@
 	blne save_guest_regs
 
 save_guest_regs:
-	ldr r11, [sp, #UREGS_lr]
-	str r11, [sp, #UREGS_LR_usr]
 	ldr r11, =0xffffffff  /* Clobber SP which is only valid for hypervisor frames. */
 	str r11, [sp, #UREGS_sp]
 	SAVE_ONE_BANKED(SP_usr)
+	/* LR_usr is the same physical register as lr and is saved in SAVE_ALL */
 	SAVE_BANKED(svc)
 	SAVE_BANKED(abt)
 	SAVE_BANKED(und)
@@ -78,16 +77,13 @@
 	and r11, #PSR_MODE_MASK
 	cmp r11, #PSR_MODE_HYP
 	beq return_to_hypervisor
-
+	/* Fall thru */
 ENTRY(return_to_guest)
 	mov r11, sp
 	bic sp, #7 /* Align the stack pointer */
 	bl leave_hypervisor_tail
-	ldr r11, [sp, #UREGS_pc]
-	msr ELR_hyp, r11
-	ldr r11, [sp, #UREGS_cpsr]
-	msr SPSR_hyp, r11
 	RESTORE_ONE_BANKED(SP_usr)
+	/* LR_usr is the same physical register as lr and is restored below */
 	RESTORE_BANKED(svc)
 	RESTORE_BANKED(abt)
 	RESTORE_BANKED(und)
@@ -95,11 +91,7 @@
 	RESTORE_BANKED(fiq)
 	RESTORE_ONE_BANKED(R8_fiq); RESTORE_ONE_BANKED(R9_fiq); RESTORE_ONE_BANKED(R10_fiq)
 	RESTORE_ONE_BANKED(R11_fiq); RESTORE_ONE_BANKED(R12_fiq);
-	ldr lr, [sp, #UREGS_LR_usr]
-	pop {r0-r12}
-	add sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */
-	eret
-
+	/* Fall thru */
 ENTRY(return_to_hypervisor)
 	ldr lr, [sp, #UREGS_lr]
 	ldr r11, [sp, #UREGS_pc]
diff -r 70aeec92bd0a -r a4d93d0e0df2 xen/include/public/arch-arm.h
--- a/xen/include/public/arch-arm.h	Wed Feb 22 14:33:23 2012 +0000
+++ b/xen/include/public/arch-arm.h	Wed Feb 22 14:33:24 2012 +0000
@@ -63,7 +63,12 @@
     uint32_t r12;
 
     uint32_t sp; /* r13 - SP: Valid for Hyp. frames only, o/w banked (see below) */
-    uint32_t lr; /* r14 - LR: Valid for Hyp. Same physical register as lr_usr. */
+
+    /* r14 - LR: is the same physical register as LR_usr */
+    union {
+        uint32_t lr; /* r14 - LR: Valid for Hyp. Same physical register as lr_usr. */
+        uint32_t lr_usr;
+    };
 
     uint32_t pc; /* Return IP */
     uint32_t cpsr; /* Return mode */
@@ -73,10 +78,14 @@
 
     uint32_t r8_fiq, r9_fiq, r10_fiq, r11_fiq, r12_fiq;
 
-    uint32_t sp_usr, sp_svc, sp_abt, sp_und, sp_irq, sp_fiq;
-    uint32_t lr_usr, lr_svc, lr_abt, lr_und, lr_irq, lr_fiq;
+    uint32_t sp_usr; /* LR_usr is the same register as LR, see above */
+
+    uint32_t sp_svc, sp_abt, sp_und, sp_irq, sp_fiq;
+    uint32_t lr_svc, lr_abt, lr_und, lr_irq, lr_fiq;
 
     uint32_t spsr_svc, spsr_abt, spsr_und, spsr_irq, spsr_fiq;
+
+    uint32_t pad1; /* Doubleword-align the user half of the frame */
 };
 typedef struct cpu_user_regs cpu_user_regs_t;
 DEFINE_XEN_GUEST_HANDLE(cpu_user_regs_t);

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 05:44:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 05:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0RTX-0006Qx-18; Thu, 23 Feb 2012 05:44:19 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTV-0006Pt-LJ
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-21.messagelabs.com!1329975850!12871452!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24415 invoked from network); 23 Feb 2012 05:44:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 05:44:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTN-00056t-Q4
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTN-0000kh-I8
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:09 +0000
Message-Id: <E1S0RTN-0000kh-I8@xenbits.xen.org>
Date: Thu, 23 Feb 2012 05:44:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] .gitignore: add autoconf-related
	files
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1329875704 0
# Node ID 8ee81ceda8c9dcf2d18bde6c983beb0b92ca2942
# Parent  a19c6d90fd41379dd2ac12576eb7b1bbe4b0444d
.gitignore: add autoconf-related files

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


diff -r a19c6d90fd41 -r 8ee81ceda8c9 .gitignore
--- a/.gitignore	Wed Feb 22 01:55:03 2012 +0000
+++ b/.gitignore	Wed Feb 22 01:55:04 2012 +0000
@@ -105,6 +105,12 @@
 stubdom/ioemu/
 stubdom/stubdompath.sh
 tools/*/build/lib*/*.py
+tools/autom4te.cache
+tools/config.h
+tools/config.log
+tools/config.status
+tools/config.cache
+config/Tools.mk
 tools/blktap2/daemon/blktapctrl
 tools/blktap2/drivers/img2qcow
 tools/blktap2/drivers/lock-util

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 05:44:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 05:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0RTX-0006Qx-18; Thu, 23 Feb 2012 05:44:19 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTV-0006Pt-LJ
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-21.messagelabs.com!1329975850!12871452!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24415 invoked from network); 23 Feb 2012 05:44:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 05:44:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTN-00056t-Q4
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTN-0000kh-I8
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:09 +0000
Message-Id: <E1S0RTN-0000kh-I8@xenbits.xen.org>
Date: Thu, 23 Feb 2012 05:44:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] .gitignore: add autoconf-related
	files
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1329875704 0
# Node ID 8ee81ceda8c9dcf2d18bde6c983beb0b92ca2942
# Parent  a19c6d90fd41379dd2ac12576eb7b1bbe4b0444d
.gitignore: add autoconf-related files

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


diff -r a19c6d90fd41 -r 8ee81ceda8c9 .gitignore
--- a/.gitignore	Wed Feb 22 01:55:03 2012 +0000
+++ b/.gitignore	Wed Feb 22 01:55:04 2012 +0000
@@ -105,6 +105,12 @@
 stubdom/ioemu/
 stubdom/stubdompath.sh
 tools/*/build/lib*/*.py
+tools/autom4te.cache
+tools/config.h
+tools/config.log
+tools/config.status
+tools/config.cache
+config/Tools.mk
 tools/blktap2/daemon/blktapctrl
 tools/blktap2/drivers/img2qcow
 tools/blktap2/drivers/lock-util

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 05:44:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 05:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0RTY-0006RB-6F; Thu, 23 Feb 2012 05:44:20 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTW-0006Px-CE
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1329975850!12684574!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9022 invoked from network); 23 Feb 2012 05:44:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 05:44:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTO-00056w-5a
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTO-0000l5-35
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:10 +0000
Message-Id: <E1S0RTO-0000l5-35@xenbits.xen.org>
Date: Thu, 23 Feb 2012 05:44:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] autoconf: remove brctl check
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1329911656 0
# Node ID 69c6e5d33f101145752dc94fee5b916f5012d4f8
# Parent  8ee81ceda8c9dcf2d18bde6c983beb0b92ca2942
autoconf: remove brctl check

Remove brctl check since it's usually only available to users with
high privileges, but Xen should be buildable by regular users.

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 8ee81ceda8c9 -r 69c6e5d33f10 tools/configure.ac
--- a/tools/configure.ac	Wed Feb 22 01:55:04 2012 +0000
+++ b/tools/configure.ac	Wed Feb 22 11:54:16 2012 +0000
@@ -79,7 +79,6 @@
 AC_PROG_MAKE_SET
 AC_PROG_INSTALL
 AX_PATH_PROG_OR_FAIL([PERL], [perl])
-AX_PATH_PROG_OR_FAIL([BRCTL], [brctl])
 AX_PATH_PROG_OR_FAIL([IP], [ip])
 AX_PATH_PROG_OR_FAIL([BISON], [bison])
 AX_PATH_PROG_OR_FAIL([FLEX], [flex])

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 05:44:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 05:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0RTb-0006Sd-IB; Thu, 23 Feb 2012 05:44:23 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTZ-0006Q6-F4
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1329975852!5382998!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1724 invoked from network); 23 Feb 2012 05:44:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 05:44:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTQ-000578-9Y
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTQ-0000mc-7p
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:12 +0000
Message-Id: <E1S0RTQ-0000mc-7p@xenbits.xen.org>
Date: Thu, 23 Feb 2012 05:44:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: use a per-VCPU stack
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <Ian.Campbell@citrix.com>
# Date 1329921202 0
# Node ID 4da12071496df60c68f0f496f58cf685e307f4f2
# Parent  40785b4790470b5180ded4e89e8c8b7919adb87c
arm: use a per-VCPU stack

We do not do any lazy state switching. Outside of context_switch() the current
stack is always that of the VCPU which current returns.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r 40785b479047 -r 4da12071496d xen/arch/arm/asm-offsets.c
--- a/xen/arch/arm/asm-offsets.c	Wed Feb 22 14:27:18 2012 +0000
+++ b/xen/arch/arm/asm-offsets.c	Wed Feb 22 14:33:22 2012 +0000
@@ -7,6 +7,7 @@
 
 #include <xen/config.h>
 #include <xen/types.h>
+#include <xen/sched.h>
 #include <public/xen.h>
 #include <asm/current.h>
 
@@ -65,7 +66,10 @@
    BLANK();
 
    DEFINE(CPUINFO_sizeof, sizeof(struct cpu_info));
+
+   OFFSET(VCPU_arch_saved_context, struct vcpu, arch.saved_context);
 }
+
 /*
  * Local variables:
  * mode: C
diff -r 40785b479047 -r 4da12071496d xen/arch/arm/domain.c
--- a/xen/arch/arm/domain.c	Wed Feb 22 14:27:18 2012 +0000
+++ b/xen/arch/arm/domain.c	Wed Feb 22 14:33:22 2012 +0000
@@ -44,7 +44,7 @@
 
 static void ctxt_switch_from(struct vcpu *p)
 {
-
+    context_saved(p);
 }
 
 static void ctxt_switch_to(struct vcpu *n)
@@ -52,52 +52,36 @@
     p2m_load_VTTBR(n->domain);
 }
 
-static void __context_switch(void)
+static void schedule_tail(struct vcpu *prev)
 {
-    struct cpu_user_regs *stack_regs = guest_cpu_user_regs();
-    unsigned int          cpu = smp_processor_id();
-    struct vcpu          *p = per_cpu(curr_vcpu, cpu);
-    struct vcpu          *n = current;
+    /* Re-enable interrupts before restoring state which may fault. */
+    local_irq_enable();
 
-    ASSERT(p != n);
-    ASSERT(cpumask_empty(n->vcpu_dirty_cpumask));
+    ctxt_switch_from(prev);
 
-    if ( !is_idle_vcpu(p) )
-    {
-        memcpy(&p->arch.user_regs, stack_regs, CTXT_SWITCH_STACK_BYTES);
-        ctxt_switch_from(p);
-    }
-
-    if ( !is_idle_vcpu(n) )
-    {
-        memcpy(stack_regs, &n->arch.user_regs, CTXT_SWITCH_STACK_BYTES);
-        ctxt_switch_to(n);
-    }
-
-    per_cpu(curr_vcpu, cpu) = n;
-
+    /* TODO
+       update_runstate_area(current);
+    */
+    ctxt_switch_to(current);
 }
 
-static void schedule_tail(struct vcpu *v)
+static void continue_new_vcpu(struct vcpu *prev)
 {
-    if ( is_idle_vcpu(v) )
-        continue_idle_domain(v);
+    schedule_tail(prev);
+
+    if ( is_idle_vcpu(current) )
+        continue_idle_domain(current);
     else
-        continue_nonidle_domain(v);
+        continue_nonidle_domain(current);
 }
 
 void context_switch(struct vcpu *prev, struct vcpu *next)
 {
-    unsigned int cpu = smp_processor_id();
-
     ASSERT(local_irq_is_enabled());
-
-    printk("context switch %d:%d%s -> %d:%d%s\n",
-           prev->domain->domain_id, prev->vcpu_id, is_idle_vcpu(prev) ? " (idle)" : "",
-           next->domain->domain_id, next->vcpu_id, is_idle_vcpu(next) ? " (idle)" : "");
+    ASSERT(prev != next);
+    ASSERT(cpumask_empty(next->vcpu_dirty_cpumask));
 
     /* TODO
-       if (prev != next)
        update_runstate_area(prev);
     */
 
@@ -105,60 +89,19 @@
 
     set_current(next);
 
-    if ( (per_cpu(curr_vcpu, cpu) == next) ||
-         (is_idle_vcpu(next) && cpu_online(cpu)) )
-    {
-        local_irq_enable();
-    }
-    else
-    {
-        __context_switch();
+    prev = __context_switch(prev, next);
 
-        /* Re-enable interrupts before restoring state which may fault. */
-        local_irq_enable();
-    }
-
-    context_saved(prev);
-
-    /* TODO
-       if (prev != next)
-       update_runstate_area(next);
-    */
-
-    schedule_tail(next);
-    BUG();
-
+    schedule_tail(prev);
 }
 
 void continue_running(struct vcpu *same)
 {
-    schedule_tail(same);
-    BUG();
-}
-
-int __sync_local_execstate(void)
-{
-    unsigned long flags;
-    int switch_required;
-
-    local_irq_save(flags);
-
-    switch_required = (this_cpu(curr_vcpu) != current);
-
-    if ( switch_required )
-    {
-        ASSERT(current == idle_vcpu[smp_processor_id()]);
-        __context_switch();
-    }
-
-    local_irq_restore(flags);
-
-    return switch_required;
+    /* Nothing to do */
 }
 
 void sync_local_execstate(void)
 {
-    (void)__sync_local_execstate();
+    /* Nothing to do -- no lazy switching */
 }
 
 void startup_cpu_idle_loop(void)
@@ -213,6 +156,18 @@
 {
     int rc = 0;
 
+    v->arch.stack = alloc_xenheap_pages(STACK_ORDER, MEMF_node(vcpu_to_node(v)));
+    if ( v->arch.stack == NULL )
+        return -ENOMEM;
+
+    v->arch.cpu_info = (struct cpu_info *)(v->arch.stack
+                                           + STACK_SIZE
+                                           - sizeof(struct cpu_info));
+
+    memset(&v->arch.saved_context, 0, sizeof(v->arch.saved_context));
+    v->arch.saved_context.sp = (uint32_t)v->arch.cpu_info;
+    v->arch.saved_context.pc = (uint32_t)continue_new_vcpu;
+
     if ( (rc = vcpu_vgic_init(v)) != 0 )
         return rc;
 
@@ -224,7 +179,7 @@
 
 void vcpu_destroy(struct vcpu *v)
 {
-
+    free_xenheap_pages(v->arch.stack, STACK_ORDER);
 }
 
 int arch_domain_create(struct domain *d, unsigned int domcr_flags)
diff -r 40785b479047 -r 4da12071496d xen/arch/arm/domain_build.c
--- a/xen/arch/arm/domain_build.c	Wed Feb 22 14:27:18 2012 +0000
+++ b/xen/arch/arm/domain_build.c	Wed Feb 22 14:33:22 2012 +0000
@@ -5,6 +5,7 @@
 #include <xen/domain_page.h>
 #include <xen/sched.h>
 #include <asm/irq.h>
+#include <asm/regs.h>
 
 #include "gic.h"
 #include "kernel.h"
@@ -71,7 +72,7 @@
     int rc;
 
     struct vcpu *v = d->vcpu[0];
-    struct cpu_user_regs *regs = &v->arch.user_regs;
+    struct cpu_user_regs *regs = &v->arch.cpu_info->guest_cpu_user_regs;
 
     /* Sanity! */
     BUG_ON(d->domain_id != 0);
diff -r 40785b479047 -r 4da12071496d xen/arch/arm/entry.S
--- a/xen/arch/arm/entry.S	Wed Feb 22 14:27:18 2012 +0000
+++ b/xen/arch/arm/entry.S	Wed Feb 22 14:33:22 2012 +0000
@@ -105,3 +105,19 @@
 	pop {r0-r12}
 	add sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */
 	eret
+
+/*
+ * struct vcpu *__context_switch(struct vcpu *prev, struct vcpu *next)
+ *
+ * r0 - prev
+ * r1 - next
+ *
+ * Returns prev in r0
+ */
+ENTRY(__context_switch)
+	add     ip, r0, #VCPU_arch_saved_context
+	stmia   ip!, {r4 - sl, fp, sp, lr}      /* Save register state */
+
+	add     r4, r1, #VCPU_arch_saved_context
+	ldmia   r4, {r4 - sl, fp, sp, pc}       /* Load registers and return */
+
diff -r 40785b479047 -r 4da12071496d xen/arch/arm/setup.c
--- a/xen/arch/arm/setup.c	Wed Feb 22 14:27:18 2012 +0000
+++ b/xen/arch/arm/setup.c	Wed Feb 22 14:33:22 2012 +0000
@@ -42,7 +42,7 @@
 static unsigned int __initdata max_cpus = NR_CPUS;
 
 /* Xen stack for bringing up the first CPU. */
-unsigned char init_stack[STACK_SIZE] __attribute__((__aligned__(STACK_SIZE)));
+unsigned char __initdata init_stack[STACK_SIZE] __attribute__((__aligned__(STACK_SIZE)));
 
 extern char __init_begin[], __init_end[], __bss_start[];
 
@@ -61,7 +61,6 @@
 {
         scheduler_init();
         set_current(idle_vcpu[0]);
-        this_cpu(curr_vcpu) = current;
         /* TODO: setup_idle_pagetable(); */
 }
 
@@ -175,7 +174,7 @@
     console_init_preirq();
 #endif
 
-    set_current((struct vcpu *)0xfffff000); /* debug sanity */
+    __set_current((struct vcpu *)0xfffff000); /* debug sanity */
     idle_vcpu[0] = current;
     set_processor_id(0); /* needed early, for smp_processor_id() */
 
diff -r 40785b479047 -r 4da12071496d xen/include/asm-arm/current.h
--- a/xen/include/asm-arm/current.h	Wed Feb 22 14:27:18 2012 +0000
+++ b/xen/include/asm-arm/current.h	Wed Feb 22 14:33:22 2012 +0000
@@ -5,50 +5,55 @@
 #include <xen/percpu.h>
 #include <public/xen.h>
 
+#include <asm/percpu.h>
+
 #ifndef __ASSEMBLY__
 
 struct vcpu;
 
+/*
+ * Which VCPU is "current" on this PCPU.
+ */
+DECLARE_PER_CPU(struct vcpu *, curr_vcpu);
+
 struct cpu_info {
     struct cpu_user_regs guest_cpu_user_regs;
     unsigned long elr;
+    /* The following are valid iff this VCPU is current */
     unsigned int processor_id;
-    struct vcpu *current_vcpu;
     unsigned long per_cpu_offset;
+    unsigned int pad;
 };
 
 static inline struct cpu_info *get_cpu_info(void)
 {
-        register unsigned long sp asm ("sp");
-        return (struct cpu_info *)((sp & ~(STACK_SIZE - 1)) + STACK_SIZE - sizeof(struct cpu_info));
+    register unsigned long sp asm ("sp");
+    return (struct cpu_info *)((sp & ~(STACK_SIZE - 1)) + STACK_SIZE - sizeof(struct cpu_info));
 }
 
-#define get_current()         (get_cpu_info()->current_vcpu)
-#define set_current(vcpu)     (get_cpu_info()->current_vcpu = (vcpu))
-#define current               (get_current())
-
 #define get_processor_id()    (get_cpu_info()->processor_id)
 #define set_processor_id(id)  do {                                      \
     struct cpu_info *ci__ = get_cpu_info();                             \
     ci__->per_cpu_offset = __per_cpu_offset[ci__->processor_id = (id)]; \
 } while (0)
 
+#define get_current()         (this_cpu(curr_vcpu))
+#define __set_current(vcpu)   (this_cpu(curr_vcpu) = (vcpu))
+#define set_current(vcpu)     do {                                      \
+    vcpu->arch.cpu_info->processor_id = get_processor_id();             \
+    __set_current(vcpu);                                                \
+} while (0)
+#define current               (get_current())
+
 #define guest_cpu_user_regs() (&get_cpu_info()->guest_cpu_user_regs)
 
 #define reset_stack_and_jump(__fn)              \
     __asm__ __volatile__ (                      \
         "mov sp,%0; b "STR(__fn)      \
         : : "r" (guest_cpu_user_regs()) : "memory" )
+
 #endif
 
-
-/*
- * Which VCPU's state is currently running on each CPU?
- * This is not necesasrily the same as 'current' as a CPU may be
- * executing a lazy state switch.
- */
-DECLARE_PER_CPU(struct vcpu *, curr_vcpu);
-
 #endif /* __ARM_CURRENT_H__ */
 /*
  * Local variables:
diff -r 40785b479047 -r 4da12071496d xen/include/asm-arm/domain.h
--- a/xen/include/asm-arm/domain.h	Wed Feb 22 14:27:18 2012 +0000
+++ b/xen/include/asm-arm/domain.h	Wed Feb 22 14:33:22 2012 +0000
@@ -47,7 +47,26 @@
 
 struct arch_vcpu
 {
-    struct cpu_user_regs user_regs;
+    struct {
+        uint32_t    r4;
+        uint32_t    r5;
+        uint32_t    r6;
+        uint32_t    r7;
+        uint32_t    r8;
+        uint32_t    r9;
+        uint32_t    sl;
+        uint32_t    fp;
+        uint32_t    sp;
+        uint32_t    pc;
+    } saved_context;
+
+    void *stack;
+
+    /*
+     * Points into ->stack, more convenient than doing pointer arith
+     * all the time.
+     */
+    struct cpu_info *cpu_info;
 
     uint32_t sctlr;
     uint32_t ttbr0, ttbr1, ttbcr;
diff -r 40785b479047 -r 4da12071496d xen/include/asm-arm/regs.h
--- a/xen/include/asm-arm/regs.h	Wed Feb 22 14:27:18 2012 +0000
+++ b/xen/include/asm-arm/regs.h	Wed Feb 22 14:33:22 2012 +0000
@@ -28,9 +28,7 @@
     (diff == 0);                                                              \
 })
 
-#define return_reg(v) ((v)->arch.user_regs.r0)
-
-#define CTXT_SWITCH_STACK_BYTES (sizeof(struct cpu_user_regs))
+#define return_reg(v) ((v)->arch.cpu_info->guest_cpu_user_regs.r0)
 
 #endif /* __ARM_REGS_H__ */
 /*
diff -r 40785b479047 -r 4da12071496d xen/include/asm-arm/system.h
--- a/xen/include/asm-arm/system.h	Wed Feb 22 14:27:18 2012 +0000
+++ b/xen/include/asm-arm/system.h	Wed Feb 22 14:33:22 2012 +0000
@@ -191,6 +191,8 @@
     return !!(flags & PSR_FIQ_MASK);
 }
 
+extern struct vcpu *__context_switch(struct vcpu *prev, struct vcpu *next);
+
 #endif
 /*
  * Local variables:

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 05:44:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 05:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0RTY-0006RB-6F; Thu, 23 Feb 2012 05:44:20 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTW-0006Px-CE
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1329975850!12684574!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9022 invoked from network); 23 Feb 2012 05:44:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 05:44:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTO-00056w-5a
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTO-0000l5-35
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:10 +0000
Message-Id: <E1S0RTO-0000l5-35@xenbits.xen.org>
Date: Thu, 23 Feb 2012 05:44:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] autoconf: remove brctl check
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1329911656 0
# Node ID 69c6e5d33f101145752dc94fee5b916f5012d4f8
# Parent  8ee81ceda8c9dcf2d18bde6c983beb0b92ca2942
autoconf: remove brctl check

Remove brctl check since it's usually only available to users with
high privileges, but Xen should be buildable by regular users.

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 8ee81ceda8c9 -r 69c6e5d33f10 tools/configure.ac
--- a/tools/configure.ac	Wed Feb 22 01:55:04 2012 +0000
+++ b/tools/configure.ac	Wed Feb 22 11:54:16 2012 +0000
@@ -79,7 +79,6 @@
 AC_PROG_MAKE_SET
 AC_PROG_INSTALL
 AX_PATH_PROG_OR_FAIL([PERL], [perl])
-AX_PATH_PROG_OR_FAIL([BRCTL], [brctl])
 AX_PATH_PROG_OR_FAIL([IP], [ip])
 AX_PATH_PROG_OR_FAIL([BISON], [bison])
 AX_PATH_PROG_OR_FAIL([FLEX], [flex])

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 05:44:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 05:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0RTb-0006Sd-IB; Thu, 23 Feb 2012 05:44:23 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTZ-0006Q6-F4
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1329975852!5382998!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1724 invoked from network); 23 Feb 2012 05:44:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 05:44:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTQ-000578-9Y
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTQ-0000mc-7p
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:12 +0000
Message-Id: <E1S0RTQ-0000mc-7p@xenbits.xen.org>
Date: Thu, 23 Feb 2012 05:44:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: use a per-VCPU stack
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <Ian.Campbell@citrix.com>
# Date 1329921202 0
# Node ID 4da12071496df60c68f0f496f58cf685e307f4f2
# Parent  40785b4790470b5180ded4e89e8c8b7919adb87c
arm: use a per-VCPU stack

We do not do any lazy state switching. Outside of context_switch() the current
stack is always that of the VCPU which current returns.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r 40785b479047 -r 4da12071496d xen/arch/arm/asm-offsets.c
--- a/xen/arch/arm/asm-offsets.c	Wed Feb 22 14:27:18 2012 +0000
+++ b/xen/arch/arm/asm-offsets.c	Wed Feb 22 14:33:22 2012 +0000
@@ -7,6 +7,7 @@
 
 #include <xen/config.h>
 #include <xen/types.h>
+#include <xen/sched.h>
 #include <public/xen.h>
 #include <asm/current.h>
 
@@ -65,7 +66,10 @@
    BLANK();
 
    DEFINE(CPUINFO_sizeof, sizeof(struct cpu_info));
+
+   OFFSET(VCPU_arch_saved_context, struct vcpu, arch.saved_context);
 }
+
 /*
  * Local variables:
  * mode: C
diff -r 40785b479047 -r 4da12071496d xen/arch/arm/domain.c
--- a/xen/arch/arm/domain.c	Wed Feb 22 14:27:18 2012 +0000
+++ b/xen/arch/arm/domain.c	Wed Feb 22 14:33:22 2012 +0000
@@ -44,7 +44,7 @@
 
 static void ctxt_switch_from(struct vcpu *p)
 {
-
+    context_saved(p);
 }
 
 static void ctxt_switch_to(struct vcpu *n)
@@ -52,52 +52,36 @@
     p2m_load_VTTBR(n->domain);
 }
 
-static void __context_switch(void)
+static void schedule_tail(struct vcpu *prev)
 {
-    struct cpu_user_regs *stack_regs = guest_cpu_user_regs();
-    unsigned int          cpu = smp_processor_id();
-    struct vcpu          *p = per_cpu(curr_vcpu, cpu);
-    struct vcpu          *n = current;
+    /* Re-enable interrupts before restoring state which may fault. */
+    local_irq_enable();
 
-    ASSERT(p != n);
-    ASSERT(cpumask_empty(n->vcpu_dirty_cpumask));
+    ctxt_switch_from(prev);
 
-    if ( !is_idle_vcpu(p) )
-    {
-        memcpy(&p->arch.user_regs, stack_regs, CTXT_SWITCH_STACK_BYTES);
-        ctxt_switch_from(p);
-    }
-
-    if ( !is_idle_vcpu(n) )
-    {
-        memcpy(stack_regs, &n->arch.user_regs, CTXT_SWITCH_STACK_BYTES);
-        ctxt_switch_to(n);
-    }
-
-    per_cpu(curr_vcpu, cpu) = n;
-
+    /* TODO
+       update_runstate_area(current);
+    */
+    ctxt_switch_to(current);
 }
 
-static void schedule_tail(struct vcpu *v)
+static void continue_new_vcpu(struct vcpu *prev)
 {
-    if ( is_idle_vcpu(v) )
-        continue_idle_domain(v);
+    schedule_tail(prev);
+
+    if ( is_idle_vcpu(current) )
+        continue_idle_domain(current);
     else
-        continue_nonidle_domain(v);
+        continue_nonidle_domain(current);
 }
 
 void context_switch(struct vcpu *prev, struct vcpu *next)
 {
-    unsigned int cpu = smp_processor_id();
-
     ASSERT(local_irq_is_enabled());
-
-    printk("context switch %d:%d%s -> %d:%d%s\n",
-           prev->domain->domain_id, prev->vcpu_id, is_idle_vcpu(prev) ? " (idle)" : "",
-           next->domain->domain_id, next->vcpu_id, is_idle_vcpu(next) ? " (idle)" : "");
+    ASSERT(prev != next);
+    ASSERT(cpumask_empty(next->vcpu_dirty_cpumask));
 
     /* TODO
-       if (prev != next)
        update_runstate_area(prev);
     */
 
@@ -105,60 +89,19 @@
 
     set_current(next);
 
-    if ( (per_cpu(curr_vcpu, cpu) == next) ||
-         (is_idle_vcpu(next) && cpu_online(cpu)) )
-    {
-        local_irq_enable();
-    }
-    else
-    {
-        __context_switch();
+    prev = __context_switch(prev, next);
 
-        /* Re-enable interrupts before restoring state which may fault. */
-        local_irq_enable();
-    }
-
-    context_saved(prev);
-
-    /* TODO
-       if (prev != next)
-       update_runstate_area(next);
-    */
-
-    schedule_tail(next);
-    BUG();
-
+    schedule_tail(prev);
 }
 
 void continue_running(struct vcpu *same)
 {
-    schedule_tail(same);
-    BUG();
-}
-
-int __sync_local_execstate(void)
-{
-    unsigned long flags;
-    int switch_required;
-
-    local_irq_save(flags);
-
-    switch_required = (this_cpu(curr_vcpu) != current);
-
-    if ( switch_required )
-    {
-        ASSERT(current == idle_vcpu[smp_processor_id()]);
-        __context_switch();
-    }
-
-    local_irq_restore(flags);
-
-    return switch_required;
+    /* Nothing to do */
 }
 
 void sync_local_execstate(void)
 {
-    (void)__sync_local_execstate();
+    /* Nothing to do -- no lazy switching */
 }
 
 void startup_cpu_idle_loop(void)
@@ -213,6 +156,18 @@
 {
     int rc = 0;
 
+    v->arch.stack = alloc_xenheap_pages(STACK_ORDER, MEMF_node(vcpu_to_node(v)));
+    if ( v->arch.stack == NULL )
+        return -ENOMEM;
+
+    v->arch.cpu_info = (struct cpu_info *)(v->arch.stack
+                                           + STACK_SIZE
+                                           - sizeof(struct cpu_info));
+
+    memset(&v->arch.saved_context, 0, sizeof(v->arch.saved_context));
+    v->arch.saved_context.sp = (uint32_t)v->arch.cpu_info;
+    v->arch.saved_context.pc = (uint32_t)continue_new_vcpu;
+
     if ( (rc = vcpu_vgic_init(v)) != 0 )
         return rc;
 
@@ -224,7 +179,7 @@
 
 void vcpu_destroy(struct vcpu *v)
 {
-
+    free_xenheap_pages(v->arch.stack, STACK_ORDER);
 }
 
 int arch_domain_create(struct domain *d, unsigned int domcr_flags)
diff -r 40785b479047 -r 4da12071496d xen/arch/arm/domain_build.c
--- a/xen/arch/arm/domain_build.c	Wed Feb 22 14:27:18 2012 +0000
+++ b/xen/arch/arm/domain_build.c	Wed Feb 22 14:33:22 2012 +0000
@@ -5,6 +5,7 @@
 #include <xen/domain_page.h>
 #include <xen/sched.h>
 #include <asm/irq.h>
+#include <asm/regs.h>
 
 #include "gic.h"
 #include "kernel.h"
@@ -71,7 +72,7 @@
     int rc;
 
     struct vcpu *v = d->vcpu[0];
-    struct cpu_user_regs *regs = &v->arch.user_regs;
+    struct cpu_user_regs *regs = &v->arch.cpu_info->guest_cpu_user_regs;
 
     /* Sanity! */
     BUG_ON(d->domain_id != 0);
diff -r 40785b479047 -r 4da12071496d xen/arch/arm/entry.S
--- a/xen/arch/arm/entry.S	Wed Feb 22 14:27:18 2012 +0000
+++ b/xen/arch/arm/entry.S	Wed Feb 22 14:33:22 2012 +0000
@@ -105,3 +105,19 @@
 	pop {r0-r12}
 	add sp, #(UREGS_R8_fiq - UREGS_sp); /* SP, LR, SPSR, PC */
 	eret
+
+/*
+ * struct vcpu *__context_switch(struct vcpu *prev, struct vcpu *next)
+ *
+ * r0 - prev
+ * r1 - next
+ *
+ * Returns prev in r0
+ */
+ENTRY(__context_switch)
+	add     ip, r0, #VCPU_arch_saved_context
+	stmia   ip!, {r4 - sl, fp, sp, lr}      /* Save register state */
+
+	add     r4, r1, #VCPU_arch_saved_context
+	ldmia   r4, {r4 - sl, fp, sp, pc}       /* Load registers and return */
+
diff -r 40785b479047 -r 4da12071496d xen/arch/arm/setup.c
--- a/xen/arch/arm/setup.c	Wed Feb 22 14:27:18 2012 +0000
+++ b/xen/arch/arm/setup.c	Wed Feb 22 14:33:22 2012 +0000
@@ -42,7 +42,7 @@
 static unsigned int __initdata max_cpus = NR_CPUS;
 
 /* Xen stack for bringing up the first CPU. */
-unsigned char init_stack[STACK_SIZE] __attribute__((__aligned__(STACK_SIZE)));
+unsigned char __initdata init_stack[STACK_SIZE] __attribute__((__aligned__(STACK_SIZE)));
 
 extern char __init_begin[], __init_end[], __bss_start[];
 
@@ -61,7 +61,6 @@
 {
         scheduler_init();
         set_current(idle_vcpu[0]);
-        this_cpu(curr_vcpu) = current;
         /* TODO: setup_idle_pagetable(); */
 }
 
@@ -175,7 +174,7 @@
     console_init_preirq();
 #endif
 
-    set_current((struct vcpu *)0xfffff000); /* debug sanity */
+    __set_current((struct vcpu *)0xfffff000); /* debug sanity */
     idle_vcpu[0] = current;
     set_processor_id(0); /* needed early, for smp_processor_id() */
 
diff -r 40785b479047 -r 4da12071496d xen/include/asm-arm/current.h
--- a/xen/include/asm-arm/current.h	Wed Feb 22 14:27:18 2012 +0000
+++ b/xen/include/asm-arm/current.h	Wed Feb 22 14:33:22 2012 +0000
@@ -5,50 +5,55 @@
 #include <xen/percpu.h>
 #include <public/xen.h>
 
+#include <asm/percpu.h>
+
 #ifndef __ASSEMBLY__
 
 struct vcpu;
 
+/*
+ * Which VCPU is "current" on this PCPU.
+ */
+DECLARE_PER_CPU(struct vcpu *, curr_vcpu);
+
 struct cpu_info {
     struct cpu_user_regs guest_cpu_user_regs;
     unsigned long elr;
+    /* The following are valid iff this VCPU is current */
     unsigned int processor_id;
-    struct vcpu *current_vcpu;
     unsigned long per_cpu_offset;
+    unsigned int pad;
 };
 
 static inline struct cpu_info *get_cpu_info(void)
 {
-        register unsigned long sp asm ("sp");
-        return (struct cpu_info *)((sp & ~(STACK_SIZE - 1)) + STACK_SIZE - sizeof(struct cpu_info));
+    register unsigned long sp asm ("sp");
+    return (struct cpu_info *)((sp & ~(STACK_SIZE - 1)) + STACK_SIZE - sizeof(struct cpu_info));
 }
 
-#define get_current()         (get_cpu_info()->current_vcpu)
-#define set_current(vcpu)     (get_cpu_info()->current_vcpu = (vcpu))
-#define current               (get_current())
-
 #define get_processor_id()    (get_cpu_info()->processor_id)
 #define set_processor_id(id)  do {                                      \
     struct cpu_info *ci__ = get_cpu_info();                             \
     ci__->per_cpu_offset = __per_cpu_offset[ci__->processor_id = (id)]; \
 } while (0)
 
+#define get_current()         (this_cpu(curr_vcpu))
+#define __set_current(vcpu)   (this_cpu(curr_vcpu) = (vcpu))
+#define set_current(vcpu)     do {                                      \
+    vcpu->arch.cpu_info->processor_id = get_processor_id();             \
+    __set_current(vcpu);                                                \
+} while (0)
+#define current               (get_current())
+
 #define guest_cpu_user_regs() (&get_cpu_info()->guest_cpu_user_regs)
 
 #define reset_stack_and_jump(__fn)              \
     __asm__ __volatile__ (                      \
         "mov sp,%0; b "STR(__fn)      \
         : : "r" (guest_cpu_user_regs()) : "memory" )
+
 #endif
 
-
-/*
- * Which VCPU's state is currently running on each CPU?
- * This is not necesasrily the same as 'current' as a CPU may be
- * executing a lazy state switch.
- */
-DECLARE_PER_CPU(struct vcpu *, curr_vcpu);
-
 #endif /* __ARM_CURRENT_H__ */
 /*
  * Local variables:
diff -r 40785b479047 -r 4da12071496d xen/include/asm-arm/domain.h
--- a/xen/include/asm-arm/domain.h	Wed Feb 22 14:27:18 2012 +0000
+++ b/xen/include/asm-arm/domain.h	Wed Feb 22 14:33:22 2012 +0000
@@ -47,7 +47,26 @@
 
 struct arch_vcpu
 {
-    struct cpu_user_regs user_regs;
+    struct {
+        uint32_t    r4;
+        uint32_t    r5;
+        uint32_t    r6;
+        uint32_t    r7;
+        uint32_t    r8;
+        uint32_t    r9;
+        uint32_t    sl;
+        uint32_t    fp;
+        uint32_t    sp;
+        uint32_t    pc;
+    } saved_context;
+
+    void *stack;
+
+    /*
+     * Points into ->stack, more convenient than doing pointer arith
+     * all the time.
+     */
+    struct cpu_info *cpu_info;
 
     uint32_t sctlr;
     uint32_t ttbr0, ttbr1, ttbcr;
diff -r 40785b479047 -r 4da12071496d xen/include/asm-arm/regs.h
--- a/xen/include/asm-arm/regs.h	Wed Feb 22 14:27:18 2012 +0000
+++ b/xen/include/asm-arm/regs.h	Wed Feb 22 14:33:22 2012 +0000
@@ -28,9 +28,7 @@
     (diff == 0);                                                              \
 })
 
-#define return_reg(v) ((v)->arch.user_regs.r0)
-
-#define CTXT_SWITCH_STACK_BYTES (sizeof(struct cpu_user_regs))
+#define return_reg(v) ((v)->arch.cpu_info->guest_cpu_user_regs.r0)
 
 #endif /* __ARM_REGS_H__ */
 /*
diff -r 40785b479047 -r 4da12071496d xen/include/asm-arm/system.h
--- a/xen/include/asm-arm/system.h	Wed Feb 22 14:27:18 2012 +0000
+++ b/xen/include/asm-arm/system.h	Wed Feb 22 14:33:22 2012 +0000
@@ -191,6 +191,8 @@
     return !!(flags & PSR_FIQ_MASK);
 }
 
+extern struct vcpu *__context_switch(struct vcpu *prev, struct vcpu *next);
+
 #endif
 /*
  * Local variables:

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 05:44:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 05:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0RTa-0006SJ-DN; Thu, 23 Feb 2012 05:44:22 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTY-0006Q3-N0
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-174.messagelabs.com!1329975853!14553257!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29075 invoked from network); 23 Feb 2012 05:44:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 05:44:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTQ-00057B-TS
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTQ-0000n0-Oj
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:12 +0000
Message-Id: <E1S0RTQ-0000n0-Oj@xenbits.xen.org>
Date: Thu, 23 Feb 2012 05:44:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: move check for CONFIG_DTB_FILE
	to xen/arch/arm/Makefile
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329921203 0
# Node ID 7705f168dee3507aa3246808dd6735ae2016e602
# Parent  4da12071496df60c68f0f496f58cf685e307f4f2
arm: move check for CONFIG_DTB_FILE to xen/arch/arm/Makefile

CONFIG_DTB_FILE only needs to be set when building Xen itself.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r 4da12071496d -r 7705f168dee3 config/arm.mk
--- a/config/arm.mk	Wed Feb 22 14:33:22 2012 +0000
+++ b/config/arm.mk	Wed Feb 22 14:33:23 2012 +0000
@@ -16,9 +16,3 @@
 LDFLAGS_DIRECT += -marmelf$(LDFLAGS_DIRECT_$(XEN_OS))_eabi
 
 CONFIG_LOAD_ADDRESS ?= 0x80000000
-
-# XXX: When running on the model there is no bootloader to provide a
-# device tree.  It must be linked into Xen.
-ifndef CONFIG_DTB_FILE
-$(error CONFIG_DTB_FILE must be set to the absolute filename of a DTB)
-endif
diff -r 4da12071496d -r 7705f168dee3 xen/arch/arm/Makefile
--- a/xen/arch/arm/Makefile	Wed Feb 22 14:33:22 2012 +0000
+++ b/xen/arch/arm/Makefile	Wed Feb 22 14:33:23 2012 +0000
@@ -28,6 +28,10 @@
 ifdef CONFIG_DTB_FILE
 obj-y += dtb.o
 AFLAGS += -DCONFIG_DTB_FILE=\"$(CONFIG_DTB_FILE)\"
+else
+# XXX: When running on the model there is no bootloader to provide a
+# device tree.  It must be linked into Xen.
+$(error CONFIG_DTB_FILE must be set to the absolute filename of a DTB)
 endif
 
 ALL_OBJS := head.o $(ALL_OBJS)

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 05:44:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 05:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0RTa-0006SJ-DN; Thu, 23 Feb 2012 05:44:22 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTY-0006Q3-N0
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-174.messagelabs.com!1329975853!14553257!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29075 invoked from network); 23 Feb 2012 05:44:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 05:44:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTQ-00057B-TS
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTQ-0000n0-Oj
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:12 +0000
Message-Id: <E1S0RTQ-0000n0-Oj@xenbits.xen.org>
Date: Thu, 23 Feb 2012 05:44:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: move check for CONFIG_DTB_FILE
	to xen/arch/arm/Makefile
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329921203 0
# Node ID 7705f168dee3507aa3246808dd6735ae2016e602
# Parent  4da12071496df60c68f0f496f58cf685e307f4f2
arm: move check for CONFIG_DTB_FILE to xen/arch/arm/Makefile

CONFIG_DTB_FILE only needs to be set when building Xen itself.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r 4da12071496d -r 7705f168dee3 config/arm.mk
--- a/config/arm.mk	Wed Feb 22 14:33:22 2012 +0000
+++ b/config/arm.mk	Wed Feb 22 14:33:23 2012 +0000
@@ -16,9 +16,3 @@
 LDFLAGS_DIRECT += -marmelf$(LDFLAGS_DIRECT_$(XEN_OS))_eabi
 
 CONFIG_LOAD_ADDRESS ?= 0x80000000
-
-# XXX: When running on the model there is no bootloader to provide a
-# device tree.  It must be linked into Xen.
-ifndef CONFIG_DTB_FILE
-$(error CONFIG_DTB_FILE must be set to the absolute filename of a DTB)
-endif
diff -r 4da12071496d -r 7705f168dee3 xen/arch/arm/Makefile
--- a/xen/arch/arm/Makefile	Wed Feb 22 14:33:22 2012 +0000
+++ b/xen/arch/arm/Makefile	Wed Feb 22 14:33:23 2012 +0000
@@ -28,6 +28,10 @@
 ifdef CONFIG_DTB_FILE
 obj-y += dtb.o
 AFLAGS += -DCONFIG_DTB_FILE=\"$(CONFIG_DTB_FILE)\"
+else
+# XXX: When running on the model there is no bootloader to provide a
+# device tree.  It must be linked into Xen.
+$(error CONFIG_DTB_FILE must be set to the absolute filename of a DTB)
 endif
 
 ALL_OBJS := head.o $(ALL_OBJS)

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 05:44:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 05:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0RTY-0006R6-3s; Thu, 23 Feb 2012 05:44:20 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTW-0006Py-AG
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-174.messagelabs.com!1329975850!14371416!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19749 invoked from network); 23 Feb 2012 05:44:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 05:44:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTM-00056n-PN
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTM-0000jv-5m
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:08 +0000
Message-Id: <E1S0RTM-0000jv-5m@xenbits.xen.org>
Date: Thu, 23 Feb 2012 05:44:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Export libxl_event.h
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Bamvor Jian Zhang <bjzhang@suse.com>
# Date 1329847264 0
# Node ID 6a34a42a2b5da33e7e5687b04dd88a4704155ec6
# Parent  a88ba599add1526e962b89dc1a2dd97c0fc06143
libxl: Export libxl_event.h

This fixes a compile error in libvirt.

Signed-off-by: Bamvor Jian Zhang <bjzhang@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r a88ba599add1 -r 6a34a42a2b5d tools/libxl/Makefile
--- a/tools/libxl/Makefile	Tue Feb 21 17:45:59 2012 +0000
+++ b/tools/libxl/Makefile	Tue Feb 21 18:01:04 2012 +0000
@@ -163,7 +163,7 @@
 	ln -sf libxlutil.so.$(XLUMAJOR).$(XLUMINOR) $(DESTDIR)$(LIBDIR)/libxlutil.so.$(XLUMAJOR)
 	ln -sf libxlutil.so.$(XLUMAJOR) $(DESTDIR)$(LIBDIR)/libxlutil.so
 	$(INSTALL_DATA) libxlutil.a $(DESTDIR)$(LIBDIR)
-	$(INSTALL_DATA) libxl.h libxl_json.h _libxl_types.h _libxl_types_json.h _libxl_list.h libxl_utils.h libxl_uuid.h $(DESTDIR)$(INCLUDEDIR)
+	$(INSTALL_DATA) libxl.h libxl_event.h libxl_json.h _libxl_types.h _libxl_types_json.h _libxl_list.h libxl_utils.h libxl_uuid.h $(DESTDIR)$(INCLUDEDIR)
 	$(INSTALL_DATA) bash-completion $(DESTDIR)$(BASH_COMPLETION_DIR)/xl.sh
 
 .PHONY: clean

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 05:44:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 05:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0RTY-0006R6-3s; Thu, 23 Feb 2012 05:44:20 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTW-0006Py-AG
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-174.messagelabs.com!1329975850!14371416!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19749 invoked from network); 23 Feb 2012 05:44:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 05:44:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTM-00056n-PN
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTM-0000jv-5m
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:08 +0000
Message-Id: <E1S0RTM-0000jv-5m@xenbits.xen.org>
Date: Thu, 23 Feb 2012 05:44:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Export libxl_event.h
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Bamvor Jian Zhang <bjzhang@suse.com>
# Date 1329847264 0
# Node ID 6a34a42a2b5da33e7e5687b04dd88a4704155ec6
# Parent  a88ba599add1526e962b89dc1a2dd97c0fc06143
libxl: Export libxl_event.h

This fixes a compile error in libvirt.

Signed-off-by: Bamvor Jian Zhang <bjzhang@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r a88ba599add1 -r 6a34a42a2b5d tools/libxl/Makefile
--- a/tools/libxl/Makefile	Tue Feb 21 17:45:59 2012 +0000
+++ b/tools/libxl/Makefile	Tue Feb 21 18:01:04 2012 +0000
@@ -163,7 +163,7 @@
 	ln -sf libxlutil.so.$(XLUMAJOR).$(XLUMINOR) $(DESTDIR)$(LIBDIR)/libxlutil.so.$(XLUMAJOR)
 	ln -sf libxlutil.so.$(XLUMAJOR) $(DESTDIR)$(LIBDIR)/libxlutil.so
 	$(INSTALL_DATA) libxlutil.a $(DESTDIR)$(LIBDIR)
-	$(INSTALL_DATA) libxl.h libxl_json.h _libxl_types.h _libxl_types_json.h _libxl_list.h libxl_utils.h libxl_uuid.h $(DESTDIR)$(INCLUDEDIR)
+	$(INSTALL_DATA) libxl.h libxl_event.h libxl_json.h _libxl_types.h _libxl_types_json.h _libxl_list.h libxl_utils.h libxl_uuid.h $(DESTDIR)$(INCLUDEDIR)
 	$(INSTALL_DATA) bash-completion $(DESTDIR)$(BASH_COMPLETION_DIR)/xl.sh
 
 .PHONY: clean

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 05:44:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 05:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0RTa-0006SE-At; Thu, 23 Feb 2012 05:44:22 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTY-0006Q2-6j
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1329975852!2159891!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31373 invoked from network); 23 Feb 2012 05:44:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 05:44:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTP-000575-SC
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTP-0000mD-Mu
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:11 +0000
Message-Id: <E1S0RTP-0000mD-Mu@xenbits.xen.org>
Date: Thu, 23 Feb 2012 05:44:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] autoconf: Rerun autogen.sh
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1329920838 0
# Node ID 40785b4790470b5180ded4e89e8c8b7919adb87c
# Parent  d370b93ba7543769702a25d7b9c99e5aa9adac6d
autoconf: Rerun autogen.sh

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


diff -r d370b93ba754 -r 40785b479047 tools/configure
--- a/tools/configure	Wed Feb 22 13:06:42 2012 +0000
+++ b/tools/configure	Wed Feb 22 14:27:18 2012 +0000
@@ -611,10 +611,6 @@
 PKG_CONFIG_LIBDIR
 PKG_CONFIG_PATH
 PKG_CONFIG
-VNCONFIG
-HOTPLUG
-UDEVINFO
-UDEVADM
 PYTHONPATH
 OCAMLBUILD
 OCAMLDOC
@@ -642,7 +638,6 @@
 FLEX
 BISON
 IP
-BRCTL
 PERL
 PYTHON
 APPEND_LIB
@@ -744,7 +739,6 @@
 APPEND_LIB
 PYTHON
 PERL
-BRCTL
 IP
 BISON
 FLEX
@@ -1400,7 +1394,6 @@
   APPEND_LIB  List of library folders to append to LDFLAGS (without -L)
   PYTHON      Path to the Python parser
   PERL        Path to Perl parser
-  BRCTL       Path to brctl tool
   IP          Path to ip tool
   BISON       Path to Bison parser generator
   FLEX        Path to Flex lexical analyser generator
@@ -3858,8 +3851,6 @@
 
 
 
-
-
 # pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
 # serial 1 (pkg-config-0.24)
 #
@@ -4168,7 +4159,6 @@
 
 
 
-
 # Checks for programs.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
 $as_echo_n "checking for a sed that does not truncate output... " >&6; }
@@ -4959,51 +4949,6 @@
 then
     as_fn_error $? "Unable to find perl, please install perl" "$LINENO" 5
 fi
-# Extract the first word of "brctl", so it can be a program name with args.
-set dummy brctl; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_BRCTL+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $BRCTL in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_BRCTL="$BRCTL" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_BRCTL="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_BRCTL" && ac_cv_path_BRCTL="no"
-  ;;
-esac
-fi
-BRCTL=$ac_cv_path_BRCTL
-if test -n "$BRCTL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BRCTL" >&5
-$as_echo "$BRCTL" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-if test x"${BRCTL}" == x"no"
-then
-    as_fn_error $? "Unable to find brctl, please install brctl" "$LINENO" 5
-fi
 # Extract the first word of "ip", so it can be a program name with args.
 set dummy ip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -6440,196 +6385,6 @@
 fi
 if test "x$host_os" == "xlinux-gnu"
 then
-    # Extract the first word of "udevadm", so it can be a program name with args.
-set dummy udevadm; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_UDEVADM+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $UDEVADM in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_UDEVADM="$UDEVADM" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_UDEVADM="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_UDEVADM" && ac_cv_path_UDEVADM="no"
-  ;;
-esac
-fi
-UDEVADM=$ac_cv_path_UDEVADM
-if test -n "$UDEVADM"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $UDEVADM" >&5
-$as_echo "$UDEVADM" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-    if test x"${UDEVADM}" == x"no"
-    then
-        # Extract the first word of "udevinfo", so it can be a program name with args.
-set dummy udevinfo; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_UDEVINFO+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $UDEVINFO in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_UDEVINFO="$UDEVINFO" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_UDEVINFO="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_UDEVINFO" && ac_cv_path_UDEVINFO="no"
-  ;;
-esac
-fi
-UDEVINFO=$ac_cv_path_UDEVINFO
-if test -n "$UDEVINFO"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $UDEVINFO" >&5
-$as_echo "$UDEVINFO" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-        if test x"${UDEVINFO}" == x"no"
-        then
-            as_fn_error $? "Unable to find udevadm or udevinfo, please install udev" "$LINENO" 5
-        fi
-        udevver=`${UDEVINFO} -V | awk '{print $NF}'`
-    else
-        udevver=`${UDEVADM} info -V | awk '{print $NF}'`
-    fi
-    if test ${udevver} -lt 59
-    then
-        # Extract the first word of "hotplug", so it can be a program name with args.
-set dummy hotplug; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_HOTPLUG+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $HOTPLUG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_HOTPLUG="$HOTPLUG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_HOTPLUG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_HOTPLUG" && ac_cv_path_HOTPLUG="no"
-  ;;
-esac
-fi
-HOTPLUG=$ac_cv_path_HOTPLUG
-if test -n "$HOTPLUG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HOTPLUG" >&5
-$as_echo "$HOTPLUG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-        if test x"${HOTPLUG}" == x"no"
-        then
-            as_fn_error $? "udev is too old, upgrade to version 59 or later" "$LINENO" 5
-        fi
-    fi
-else
-    # Extract the first word of "vnconfig", so it can be a program name with args.
-set dummy vnconfig; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_VNCONFIG+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $VNCONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_VNCONFIG="$VNCONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_VNCONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_VNCONFIG" && ac_cv_path_VNCONFIG="no"
-  ;;
-esac
-fi
-VNCONFIG=$ac_cv_path_VNCONFIG
-if test -n "$VNCONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $VNCONFIG" >&5
-$as_echo "$VNCONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-    if test x"${VNCONFIG}" == x"no"
-    then
-        as_fn_error $? "Not a Linux system and unable to find vnd" "$LINENO" 5
-    fi
-fi
-
-if test "x$host_os" == "xlinux-gnu"
-then
     ac_fn_c_check_header_mongrel "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default"
 if test "x$ac_cv_header_uuid_uuid_h" = x""yes; then :
 

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 05:44:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 05:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0RTY-0006RG-8J; Thu, 23 Feb 2012 05:44:20 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTW-0006Pz-Hd
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-216.messagelabs.com!1329975851!15418283!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12519 invoked from network); 23 Feb 2012 05:44:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 05:44:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTO-00056z-TN
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTO-0000lS-Ka
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:10 +0000
Message-Id: <E1S0RTO-0000lS-Ka@xenbits.xen.org>
Date: Thu, 23 Feb 2012 05:44:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] autoconf: remove udev checks from
	build
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1329911784 0
# Node ID 4aa563f19a18c476a378e844a2d4e37a79428eea
# Parent  69c6e5d33f101145752dc94fee5b916f5012d4f8
autoconf: remove udev checks from build

There's no need to have udev when building Xen since it's only used at
run time.

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 69c6e5d33f10 -r 4aa563f19a18 tools/configure.ac
--- a/tools/configure.ac	Wed Feb 22 11:54:16 2012 +0000
+++ b/tools/configure.ac	Wed Feb 22 11:56:24 2012 +0000
@@ -29,7 +29,6 @@
 m4_include([m4/python_xml.m4])
 m4_include([m4/python_version.m4])
 m4_include([m4/python_devel.m4])
-m4_include([m4/udev.m4])
 m4_include([m4/ocaml.m4])
 m4_include([m4/default_lib.m4])
 m4_include([m4/set_cflags_ldflags.m4])
@@ -107,7 +106,6 @@
     AX_CHECK_PYTHON_DEVEL()
 ])
 AX_PATH_PROG_OR_FAIL([XGETTEXT], [xgettext])
-AX_CHECK_UDEV([59])
 AX_CHECK_UUID
 PKG_CHECK_MODULES(glib, glib-2.0)
 
diff -r 69c6e5d33f10 -r 4aa563f19a18 tools/m4/udev.m4
--- a/tools/m4/udev.m4	Wed Feb 22 11:54:16 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-AC_DEFUN([AX_CHECK_UDEV],
-[if test "x$host_os" == "xlinux-gnu"
-then
-    AC_PATH_PROG([UDEVADM], [udevadm], [no])
-    if test x"${UDEVADM}" == x"no" 
-    then
-        AC_PATH_PROG([UDEVINFO], [udevinfo], [no])
-        if test x"${UDEVINFO}" == x"no"
-        then
-            AC_MSG_ERROR(
-                [Unable to find udevadm or udevinfo, please install udev])
-        fi
-        udevver=`${UDEVINFO} -V | awk '{print $NF}'`
-    else
-        udevver=`${UDEVADM} info -V | awk '{print $NF}'`
-    fi
-    if test ${udevver} -lt 59
-    then
-        AC_PATH_PROG([HOTPLUG], [hotplug], [no])
-        if test x"${HOTPLUG}" == x"no"
-        then
-            AC_MSG_ERROR([udev is too old, upgrade to version 59 or later])
-        fi
-    fi
-else
-    AC_PATH_PROG([VNCONFIG], [vnconfig], [no])
-    if test x"${VNCONFIG}" == x"no"
-    then
-        AC_MSG_ERROR([Not a Linux system and unable to find vnd])
-    fi
-fi
-])

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 05:44:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 05:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0RTa-0006SE-At; Thu, 23 Feb 2012 05:44:22 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTY-0006Q2-6j
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1329975852!2159891!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31373 invoked from network); 23 Feb 2012 05:44:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 05:44:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTP-000575-SC
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTP-0000mD-Mu
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:11 +0000
Message-Id: <E1S0RTP-0000mD-Mu@xenbits.xen.org>
Date: Thu, 23 Feb 2012 05:44:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] autoconf: Rerun autogen.sh
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1329920838 0
# Node ID 40785b4790470b5180ded4e89e8c8b7919adb87c
# Parent  d370b93ba7543769702a25d7b9c99e5aa9adac6d
autoconf: Rerun autogen.sh

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


diff -r d370b93ba754 -r 40785b479047 tools/configure
--- a/tools/configure	Wed Feb 22 13:06:42 2012 +0000
+++ b/tools/configure	Wed Feb 22 14:27:18 2012 +0000
@@ -611,10 +611,6 @@
 PKG_CONFIG_LIBDIR
 PKG_CONFIG_PATH
 PKG_CONFIG
-VNCONFIG
-HOTPLUG
-UDEVINFO
-UDEVADM
 PYTHONPATH
 OCAMLBUILD
 OCAMLDOC
@@ -642,7 +638,6 @@
 FLEX
 BISON
 IP
-BRCTL
 PERL
 PYTHON
 APPEND_LIB
@@ -744,7 +739,6 @@
 APPEND_LIB
 PYTHON
 PERL
-BRCTL
 IP
 BISON
 FLEX
@@ -1400,7 +1394,6 @@
   APPEND_LIB  List of library folders to append to LDFLAGS (without -L)
   PYTHON      Path to the Python parser
   PERL        Path to Perl parser
-  BRCTL       Path to brctl tool
   IP          Path to ip tool
   BISON       Path to Bison parser generator
   FLEX        Path to Flex lexical analyser generator
@@ -3858,8 +3851,6 @@
 
 
 
-
-
 # pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
 # serial 1 (pkg-config-0.24)
 #
@@ -4168,7 +4159,6 @@
 
 
 
-
 # Checks for programs.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
 $as_echo_n "checking for a sed that does not truncate output... " >&6; }
@@ -4959,51 +4949,6 @@
 then
     as_fn_error $? "Unable to find perl, please install perl" "$LINENO" 5
 fi
-# Extract the first word of "brctl", so it can be a program name with args.
-set dummy brctl; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_BRCTL+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $BRCTL in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_BRCTL="$BRCTL" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_BRCTL="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_BRCTL" && ac_cv_path_BRCTL="no"
-  ;;
-esac
-fi
-BRCTL=$ac_cv_path_BRCTL
-if test -n "$BRCTL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BRCTL" >&5
-$as_echo "$BRCTL" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-if test x"${BRCTL}" == x"no"
-then
-    as_fn_error $? "Unable to find brctl, please install brctl" "$LINENO" 5
-fi
 # Extract the first word of "ip", so it can be a program name with args.
 set dummy ip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -6440,196 +6385,6 @@
 fi
 if test "x$host_os" == "xlinux-gnu"
 then
-    # Extract the first word of "udevadm", so it can be a program name with args.
-set dummy udevadm; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_UDEVADM+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $UDEVADM in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_UDEVADM="$UDEVADM" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_UDEVADM="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_UDEVADM" && ac_cv_path_UDEVADM="no"
-  ;;
-esac
-fi
-UDEVADM=$ac_cv_path_UDEVADM
-if test -n "$UDEVADM"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $UDEVADM" >&5
-$as_echo "$UDEVADM" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-    if test x"${UDEVADM}" == x"no"
-    then
-        # Extract the first word of "udevinfo", so it can be a program name with args.
-set dummy udevinfo; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_UDEVINFO+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $UDEVINFO in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_UDEVINFO="$UDEVINFO" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_UDEVINFO="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_UDEVINFO" && ac_cv_path_UDEVINFO="no"
-  ;;
-esac
-fi
-UDEVINFO=$ac_cv_path_UDEVINFO
-if test -n "$UDEVINFO"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $UDEVINFO" >&5
-$as_echo "$UDEVINFO" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-        if test x"${UDEVINFO}" == x"no"
-        then
-            as_fn_error $? "Unable to find udevadm or udevinfo, please install udev" "$LINENO" 5
-        fi
-        udevver=`${UDEVINFO} -V | awk '{print $NF}'`
-    else
-        udevver=`${UDEVADM} info -V | awk '{print $NF}'`
-    fi
-    if test ${udevver} -lt 59
-    then
-        # Extract the first word of "hotplug", so it can be a program name with args.
-set dummy hotplug; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_HOTPLUG+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $HOTPLUG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_HOTPLUG="$HOTPLUG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_HOTPLUG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_HOTPLUG" && ac_cv_path_HOTPLUG="no"
-  ;;
-esac
-fi
-HOTPLUG=$ac_cv_path_HOTPLUG
-if test -n "$HOTPLUG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HOTPLUG" >&5
-$as_echo "$HOTPLUG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-        if test x"${HOTPLUG}" == x"no"
-        then
-            as_fn_error $? "udev is too old, upgrade to version 59 or later" "$LINENO" 5
-        fi
-    fi
-else
-    # Extract the first word of "vnconfig", so it can be a program name with args.
-set dummy vnconfig; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_VNCONFIG+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $VNCONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_VNCONFIG="$VNCONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_VNCONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_VNCONFIG" && ac_cv_path_VNCONFIG="no"
-  ;;
-esac
-fi
-VNCONFIG=$ac_cv_path_VNCONFIG
-if test -n "$VNCONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $VNCONFIG" >&5
-$as_echo "$VNCONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-    if test x"${VNCONFIG}" == x"no"
-    then
-        as_fn_error $? "Not a Linux system and unable to find vnd" "$LINENO" 5
-    fi
-fi
-
-if test "x$host_os" == "xlinux-gnu"
-then
     ac_fn_c_check_header_mongrel "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default"
 if test "x$ac_cv_header_uuid_uuid_h" = x""yes; then :
 

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 05:44:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 05:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0RTY-0006RG-8J; Thu, 23 Feb 2012 05:44:20 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTW-0006Pz-Hd
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-216.messagelabs.com!1329975851!15418283!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12519 invoked from network); 23 Feb 2012 05:44:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 05:44:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTO-00056z-TN
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTO-0000lS-Ka
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:10 +0000
Message-Id: <E1S0RTO-0000lS-Ka@xenbits.xen.org>
Date: Thu, 23 Feb 2012 05:44:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] autoconf: remove udev checks from
	build
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1329911784 0
# Node ID 4aa563f19a18c476a378e844a2d4e37a79428eea
# Parent  69c6e5d33f101145752dc94fee5b916f5012d4f8
autoconf: remove udev checks from build

There's no need to have udev when building Xen since it's only used at
run time.

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 69c6e5d33f10 -r 4aa563f19a18 tools/configure.ac
--- a/tools/configure.ac	Wed Feb 22 11:54:16 2012 +0000
+++ b/tools/configure.ac	Wed Feb 22 11:56:24 2012 +0000
@@ -29,7 +29,6 @@
 m4_include([m4/python_xml.m4])
 m4_include([m4/python_version.m4])
 m4_include([m4/python_devel.m4])
-m4_include([m4/udev.m4])
 m4_include([m4/ocaml.m4])
 m4_include([m4/default_lib.m4])
 m4_include([m4/set_cflags_ldflags.m4])
@@ -107,7 +106,6 @@
     AX_CHECK_PYTHON_DEVEL()
 ])
 AX_PATH_PROG_OR_FAIL([XGETTEXT], [xgettext])
-AX_CHECK_UDEV([59])
 AX_CHECK_UUID
 PKG_CHECK_MODULES(glib, glib-2.0)
 
diff -r 69c6e5d33f10 -r 4aa563f19a18 tools/m4/udev.m4
--- a/tools/m4/udev.m4	Wed Feb 22 11:54:16 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-AC_DEFUN([AX_CHECK_UDEV],
-[if test "x$host_os" == "xlinux-gnu"
-then
-    AC_PATH_PROG([UDEVADM], [udevadm], [no])
-    if test x"${UDEVADM}" == x"no" 
-    then
-        AC_PATH_PROG([UDEVINFO], [udevinfo], [no])
-        if test x"${UDEVINFO}" == x"no"
-        then
-            AC_MSG_ERROR(
-                [Unable to find udevadm or udevinfo, please install udev])
-        fi
-        udevver=`${UDEVINFO} -V | awk '{print $NF}'`
-    else
-        udevver=`${UDEVADM} info -V | awk '{print $NF}'`
-    fi
-    if test ${udevver} -lt 59
-    then
-        AC_PATH_PROG([HOTPLUG], [hotplug], [no])
-        if test x"${HOTPLUG}" == x"no"
-        then
-            AC_MSG_ERROR([udev is too old, upgrade to version 59 or later])
-        fi
-    fi
-else
-    AC_PATH_PROG([VNCONFIG], [vnconfig], [no])
-    if test x"${VNCONFIG}" == x"no"
-    then
-        AC_MSG_ERROR([Not a Linux system and unable to find vnd])
-    fi
-fi
-])

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 05:44:30 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 05:44:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0RTg-0006VX-MS; Thu, 23 Feb 2012 05:44:28 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTd-0006Rm-Dr
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1329975808!53600419!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8876 invoked from network); 23 Feb 2012 05:43:29 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 05:43:29 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTN-00056p-4x
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTM-0000kK-U1
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:08 +0000
Message-Id: <E1S0RTM-0000kK-U1@xenbits.xen.org>
Date: Thu, 23 Feb 2012 05:44:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] build: add autoconf to replace
	custom checks in tools/check
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============6835735191746885487=="
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

--===============6835735191746885487==
Content-Type: text/plain

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1329875703 0
# Node ID a19c6d90fd41379dd2ac12576eb7b1bbe4b0444d
# Parent  6a34a42a2b5da33e7e5687b04dd88a4704155ec6
build: add autoconf to replace custom checks in tools/check

Added autotools magic to replace custom check scripts. The previous
checks have been ported to autoconf, and some additional ones have
been added (plus the suggestions from running autoscan). Two files are
created as a result from executing configure script, config/Tools.mk
and config.h.

conf/Tools.mk is included by tools/Rules.mk, and contains most of the
options previously defined in .config, that can now be set passing
parameters or defining environment variables when executing configure
script.

config.h is only used by libxl/xl to detect yajl_version.h.

[ tools/config.sub and config.guess copied from
  autotools-dev 20100122.1 from Debian squeeze i386,
  which is GPLv2.

  tools/configure generated using the included ./autogen.sh
  which ran autoconf 2.67-2 from Debian squeeze i386.  autoconf
  is GPLv3+ but has a special exception for the autoconf output;
  this exception applies to us and exempts us from complying
  with GPLv3+ for configure, which is good as Xen is GPL2 only.

  - Ian Jackson ]

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


diff -r 6a34a42a2b5d -r a19c6d90fd41 .hgignore
--- a/.hgignore	Tue Feb 21 18:01:04 2012 +0000
+++ b/.hgignore	Wed Feb 22 01:55:03 2012 +0000
@@ -303,6 +303,12 @@
 ^tools/ocaml/libs/xl/xenlight\.ml$
 ^tools/ocaml/libs/xl/xenlight\.mli$
 ^tools/ocaml/xenstored/oxenstored$
+^tools/autom4te\.cache$
+^tools/config\.h$
+^tools/config\.log$
+^tools/config\.status$
+^tools/config\.cache$
+^config/Tools\.mk$
 ^xen/\.banner.*$
 ^xen/BLOG$
 ^xen/System.map$
diff -r 6a34a42a2b5d -r a19c6d90fd41 Config.mk
--- a/Config.mk	Tue Feb 21 18:01:04 2012 +0000
+++ b/Config.mk	Wed Feb 22 01:55:03 2012 +0000
@@ -70,9 +70,6 @@
 EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBLEAFDIR)
 endif
 
-BISON	?= bison
-FLEX	?= flex
-
 PYTHON      ?= python
 PYTHON_PREFIX_ARG ?= --prefix="$(PREFIX)"
 # The above requires that PREFIX contains *no spaces*. This variable is here
@@ -175,32 +172,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
 
-CONFIG_LIBICONV   := $(shell export OS="`uname -s`"; \
-                       export CHECK_LIB="$(CHECK_LIB)"; \
-                       . $(XEN_ROOT)/tools/check/funcs.sh; \
-                       has_lib libiconv.so && echo 'y' || echo 'n')
-
-CONFIG_YAJL_VERSION := $(shell export OS="`uname -s`"; \
-                       export CHECK_INCLUDES="$(CHECK_INCLUDES)"; \
-                       . $(XEN_ROOT)/tools/check/funcs.sh; \
-                       has_header yajl/yajl_version.h && echo 'y' || echo 'n')
-
-# Enable XSM security module (by default, Flask).
-XSM_ENABLE ?= n
-FLASK_ENABLE ?= $(XSM_ENABLE)
-
-# Download GIT repositories via HTTP or GIT's own protocol?
-# GIT's protocol is faster and more robust, when it works at all (firewalls
-# may block it). We make it the default, but if your GIT repository downloads
-# fail or hang, please specify GIT_HTTP=y in your environment.
-GIT_HTTP ?= n
-
 XEN_EXTFILES_URL=http://xenbits.xensource.com/xen-extfiles
 # All the files at that location were downloaded from elsewhere on
 # the internet.  The original download URL is preserved as a comment
@@ -239,17 +213,4 @@
 # Short answer -- do not enable this unless you know what you are
 # doing and are prepared for some pain.
 
-# Optional components
-XENSTAT_XENTOP     ?= y
-VTPM_TOOLS         ?= n
-LIBXENAPI_BINDINGS ?= n
-PYTHON_TOOLS       ?= y
-OCAML_TOOLS        ?= y
-CONFIG_MINITERM    ?= n
-CONFIG_LOMOUNT     ?= n
-CONFIG_SYSTEM_LIBAIO ?= y
 CONFIG_TESTS       ?= y
-
-ifeq ($(OCAML_TOOLS),y)
-OCAML_TOOLS := $(shell ocamlopt -v > /dev/null 2>&1 && echo "y" || echo "n")
-endif
diff -r 6a34a42a2b5d -r a19c6d90fd41 Makefile
--- a/Makefile	Tue Feb 21 18:01:04 2012 +0000
+++ b/Makefile	Wed Feb 22 01:55:03 2012 +0000
@@ -40,11 +40,10 @@
 dist: dist-xen dist-kernels dist-tools dist-stubdom dist-docs dist-misc
 
 dist-misc:
-	$(INSTALL_DIR) $(DISTDIR)/check
+	$(INSTALL_DIR) $(DISTDIR)/
 	$(INSTALL_DATA) ./COPYING $(DISTDIR)
 	$(INSTALL_DATA) ./README $(DISTDIR)
 	$(INSTALL_PROG) ./install.sh $(DISTDIR)
-	$(INSTALL_PROG) tools/check/chk tools/check/check_* tools/check/funcs.sh $(DISTDIR)/check
 dist-%: DESTDIR=$(DISTDIR)/install
 dist-%: install-%
 	@: # do nothing
diff -r 6a34a42a2b5d -r a19c6d90fd41 README
--- a/README	Tue Feb 21 18:01:04 2012 +0000
+++ b/README	Wed Feb 22 01:55:03 2012 +0000
@@ -89,9 +89,13 @@
 3. For the very first build, or if you want to destroy build trees,
    perform the following steps:
 
+    # ./configure
     # make world
     # make install
 
+   If you want, you can run ./configure --help to see the list of
+   options available options when building and installing Xen.
+
    This will create and install onto the local machine. It will build
    the xen binary (xen.gz), the tools and the documentation.
 
diff -r 6a34a42a2b5d -r a19c6d90fd41 autogen.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/autogen.sh	Wed Feb 22 01:55:03 2012 +0000
@@ -0,0 +1,3 @@
+#!/bin/sh -e
+cd tools
+autoconf
diff -r 6a34a42a2b5d -r a19c6d90fd41 config/Tools.mk.in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/config/Tools.mk.in	Wed Feb 22 01:55:03 2012 +0000
@@ -0,0 +1,50 @@
+# Prefix and install folder
+PREFIX              := @prefix@
+LIBLEAFDIR_x86_64   := @LIB_PATH@
+
+# A debug build of tools?
+debug               := @debug@
+
+# Tools path
+BISON               := @BISON@
+FLEX                := @FLEX@
+PYTHON              := @PYTHON@
+PYTHON_PATH         := @PYTHONPATH@
+PERL                := @PERL@
+BRCTL               := @BRCTL@
+IP                  := @IP@
+CURL_CONFIG         := @CURL@
+XML2_CONFIG         := @XML@
+BASH                := @BASH@
+XGETTTEXT           := @XGETTEXT@
+
+# Extra folder for libs/includes
+PREPEND_INCLUDES    := @PREPEND_INCLUDES@
+PREPEND_LIB         := @PREPEND_LIB@
+APPEND_INCLUDES     := @APPEND_INCLUDES@
+APPEND_LIB          := @APPEND_LIB@
+
+# Enable XSM security module (by default, Flask).
+XSM_ENABLE          := @xsm@
+FLASK_ENABLE        := @xsm@
+
+# Download GIT repositories via HTTP or GIT's own protocol?
+# GIT's protocol is faster and more robust, when it works at all (firewalls
+# may block it). We make it the default, but if your GIT repository downloads
+# fail or hang, please specify GIT_HTTP=y in your environment.
+GIT_HTTP            := @githttp@
+
+# Optional components
+XENSTAT_XENTOP      := @monitors@
+VTPM_TOOLS          := @vtpm@
+LIBXENAPI_BINDINGS  := @xapi@
+PYTHON_TOOLS        := @pythontools@
+OCAML_TOOLS         := @ocamltools@
+CONFIG_MINITERM     := @miniterm@
+CONFIG_LOMOUNT      := @lomount@
+
+#System options
+CONFIG_SYSTEM_LIBAIO:= @system_aio@
+CONFIG_LIBICONV     := @libiconv@
+CONFIG_GCRYPT       := @libgcrypt@
+CONFIG_EXT2FS       := @libext2fs@
diff -r 6a34a42a2b5d -r a19c6d90fd41 configure
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configure	Wed Feb 22 01:55:03 2012 +0000
@@ -0,0 +1,2 @@
+#!/bin/sh -e
+cd tools && ./configure $@
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/Makefile
--- a/tools/Makefile	Tue Feb 21 18:01:04 2012 +0000
+++ b/tools/Makefile	Wed Feb 22 01:55:03 2012 +0000
@@ -6,7 +6,6 @@
 endif
 
 SUBDIRS-y :=
-SUBDIRS-y += check
 SUBDIRS-y += include
 SUBDIRS-y += libxc
 SUBDIRS-y += flask
@@ -79,6 +78,8 @@
 distclean: subdirs-distclean
 	rm -rf qemu-xen-traditional-dir qemu-xen-traditional-dir-remote
 	rm -rf qemu-xen-dir qemu-xen-dir-remote
+	rm -rf ../config/Tools.mk config.h config.log config.status \
+		config.cache autom4te.cache
 
 ifneq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
 IOEMU_CONFIGURE_CROSS ?= --cpu=$(XEN_TARGET_ARCH) \
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/Rules.mk
--- a/tools/Rules.mk	Tue Feb 21 18:01:04 2012 +0000
+++ b/tools/Rules.mk	Wed Feb 22 01:55:03 2012 +0000
@@ -4,6 +4,7 @@
 all:
 
 include $(XEN_ROOT)/Config.mk
+include $(XEN_ROOT)/config/Tools.mk
 
 export _INSTALL := $(INSTALL)
 INSTALL = $(XEN_ROOT)/tools/cross-install
@@ -80,8 +81,6 @@
                         "Xen requires at least gcc-3.4")
 $(eval $(check-y))
 
-_PYTHON_PATH := $(shell which $(PYTHON))
-PYTHON_PATH ?= $(_PYTHON_PATH)
 INSTALL_PYTHON_PROG = \
 	$(XEN_ROOT)/tools/python/install-wrap "$(PYTHON_PATH)" $(INSTALL_PROG)
 
@@ -109,3 +108,7 @@
 
 subdir-distclean-%: .phony
 	$(MAKE) -C $* clean
+
+$(XEN_ROOT)/config/Tools.mk:
+	@echo "You have to run ./configure before building or installing the tools"
+	@exit 1
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/blktap/drivers/Makefile
--- a/tools/blktap/drivers/Makefile	Tue Feb 21 18:01:04 2012 +0000
+++ b/tools/blktap/drivers/Makefile	Wed Feb 22 01:55:03 2012 +0000
@@ -13,7 +13,7 @@
 CFLAGS   += -I $(MEMSHR_DIR)
 CFLAGS   += -D_GNU_SOURCE
 
-ifeq ($(shell . ./check_gcrypt $(CC)),yes)
+ifeq ($CONFIG_GCRYPT,y)
 CFLAGS += -DUSE_GCRYPT
 CRYPT_LIB := -lgcrypt
 else
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/blktap/drivers/check_gcrypt
--- a/tools/blktap/drivers/check_gcrypt	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-cat > .gcrypt.c << EOF
-#include <gcrypt.h>
-int main(void) { return 0; }
-EOF
-
-if $1 -o .gcrypt .gcrypt.c -lgcrypt 2>/dev/null ; then
-  echo "yes"
-else
-  echo "no"
-fi
-
-rm -f .gcrypt*
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/Makefile
--- a/tools/check/Makefile	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-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
-export CONFIG_SYSTEM_LIBAIO
-
-.PHONY: all install
-all install: check-build
-
-# Check this machine is OK for building on.
-.PHONY: check-build
-check-build:
-	./chk build
-
-# Check this machine is OK for installing on.
-.PHONY: check-install
-check-install:
-	./chk install
-
-.PHONY: clean
-clean:
-	./chk clean
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/README
--- a/tools/check/README	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-Checks for the suitability of a machine for Xen build or install.
-To check for build suitability use
-
-        ./chk build
-
-To check for install suitability use
-
-        ./chk install
-
-The chk script will run checks in this directory and print
-the ones that failed. It prints nothing if checks succeed.
-The chk script exits with 0 on success and 1 on failure.
-
-The chk script runs executable files in this directory whose
-names begin with 'check_'. Files containing CHECK-BUILD
-are run for the build check, and files containing CHECK-INSTALL
-are run for the install check.
-
-Detailed output from the check scripts is in .chkbuild for build
-and .chkinstall for install.
\ No newline at end of file
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_brctl
--- a/tools/check/check_brctl	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-#!/bin/sh
-# CHECK-INSTALL
-
-. ./funcs.sh
-
-case $OS in
-OpenBSD|NetBSD|FreeBSD)
-	has_or_fail brconfig ;;
-Linux)
-	has_or_fail brctl ;;
-*)
-	fail "unknown OS" ;;
-esac
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_crypto_lib
--- a/tools/check/check_crypto_lib	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD CHECK-INSTALL
-
-. ./funcs.sh
-
-case $OS in
-FreeBSD|NetBSD|OpenBSD)
-	exit 0 ;;
-esac
-
-has_lib libcrypto.so || fail "missing libcrypto.so"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_curl
--- a/tools/check/check_curl	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD CHECK-INSTALL
-
-. ./funcs.sh
-
-if [ "$LIBXENAPI_BINDINGS" != "y" ]; then
-	echo -n "unused, "
-	exit 0
-fi
-
-has_or_fail curl-config
-curl_libs=`curl-config --libs` || fail "curl-config --libs failed"
-test_link $curl_libs || fail "dependency libraries for curl are missing"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_iproute
--- a/tools/check/check_iproute	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-#!/bin/sh
-# CHECK-INSTALL
-
-. ./funcs.sh
-
-PATH=/sbin:$PATH
-
-case $OS in
-OpenBSD|NetBSD|FreeBSD)
-	has_or_fail ifconfig ;;
-Linux)
-	has_or_fail ip ;;
-*)
-	fail "unknown OS" ;;
-esac
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_libaio_devel
--- a/tools/check/check_libaio_devel	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD
-
-. ./funcs.sh
-
-if [ X${CONFIG_SYSTEM_LIBAIO} != X"y" ] ; then
-    exit 0
-fi
-if ! has_header libaio.h ; then
-    fail "can't find libaio headers, install libaio devel package or set CONFIG_SYSTEM_LIBAIO=n"
-fi
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_libaio_lib
--- a/tools/check/check_libaio_lib	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD CHECK-INSTALL
-
-. ./funcs.sh
-
-if [ X${CONFIG_SYSTEM_LIBAIO} != X"y" ] ; then
-    exit 0
-fi
-has_lib libaio.so || fail "can't find libaio"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_openssl_devel
--- a/tools/check/check_openssl_devel	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD
-
-. ./funcs.sh
-
-has_header openssl/md5.h || fail "missing openssl headers"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_python
--- a/tools/check/check_python	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD CHECK-INSTALL
-
-. ./funcs.sh
-
-if test -z ${PYTHON}; then
-  PYTHON=python
-fi
-
-${PYTHON} -c '
-import sys
-sys.exit(sys.version_info[0] < 2 or sys.version_info[1] < 3)
-' || fail "need python version >= 2.3"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_python_devel
--- a/tools/check/check_python_devel	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD
-
-. ./funcs.sh
-
-if test -z ${PYTHON}; then
-  PYTHON=python
-fi
-has_or_fail ${PYTHON}
-
-${PYTHON} -c '
-import os.path, sys
-for p in sys.path:
-	if os.path.exists(p + "/config/Makefile"):
-		sys.exit(0)
-sys.exit(1)
-' || fail "can't find python devel files"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_python_xml
--- a/tools/check/check_python_xml	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-#!/bin/sh
-# CHECK-INSTALL
-
-. ./funcs.sh
-
-if test -z ${PYTHON}; then
-  PYTHON=python
-fi
-has_or_fail ${PYTHON}
-
-${PYTHON} -c 'import xml.dom.minidom' 2>/dev/null || \
-fail "can't import xml.dom.minidom"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_udev
--- a/tools/check/check_udev	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-#!/bin/sh
-# CHECK-INSTALL
-
-. ./funcs.sh
-
-case $OS in
-OpenBSD|NetBSD|FreeBSD)
-	has_or_fail vnconfig
-	;;
-Linux)
-	has /sbin/udevadm && \
-		udevver=`/sbin/udevadm info -V | awk '{print $NF}'`
-	[ -z "$udevver" ] && has_or_fail udevinfo && \
-		udevver=`udevinfo -V | awk '{print $NF}'`
-	[ "$udevver" -ge 59 ] 2>/dev/null || \
-		has hotplug || \
-		fail "udev is too old, upgrade to version 59 or later"
-	;;
-*)
-	fail "unknown OS"
-	;;
-esac
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_uuid_devel
--- a/tools/check/check_uuid_devel	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD
-
-. ./funcs.sh
-
-has_header uuid.h || \
-has_header uuid/uuid.h || fail "missing uuid headers (package uuid-dev)"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_x11_devel
--- a/tools/check/check_x11_devel	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD
-
-. ./funcs.sh
-
-has_header X11/keysymdef.h || \
-has_header /usr/X11R6/include/X11/keysymdef.h || \
-has_header /usr/X11R7/include/X11/keysymdef.h || \
-warning "can't find X11 headers"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_xgettext
--- a/tools/check/check_xgettext	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD
-
-. ./funcs.sh
-
-has_or_fail xgettext
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_xml2
--- a/tools/check/check_xml2	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD CHECK-INSTALL
-
-. ./funcs.sh
-
-if [ ! "$LIBXENAPI_BINDINGS" = "y" ]
-then
-    echo -n "unused, "
-    exit 0
-fi
-
-has_or_fail xml2-config
-xml2_libs=`xml2-config --libs` || fail "xml2-config --libs failed"
-test_link $xml2_libs || fail "dependency libraries for xml2 are missing"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_yajl_devel
--- a/tools/check/check_yajl_devel	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD
-
-. ./funcs.sh
-
-has_header yajl/yajl_parse.h || fail "can't find yajl/yajl_parse.h"
-has_header yajl/yajl_gen.h || fail "can't find yajl/yajl_gen.h"
-has_lib libyajl.so || fail "can't find libyajl.so"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_zlib_devel
--- a/tools/check/check_zlib_devel	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD
-
-. ./funcs.sh
-
-has_header zlib.h || fail "can't find zlib headers"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_zlib_lib
--- a/tools/check/check_zlib_lib	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD CHECK-INSTALL
-
-. ./funcs.sh
-
-case $OS in
-FreeBSD|NetBSD|OpenBSD)
-	exit 0
-	;;
-esac
-
-has_lib libz.so || fail "can't find zlib"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/chk
--- a/tools/check/chk	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-#!/bin/sh
-
-func_usage ()
-{
-    echo "Usage:"
-    echo "	$0 [build|install|clean]"
-    echo
-    echo "Check suitability for Xen build or install."
-    echo "Exit with 0 if OK, 1 if not."
-    echo
-    echo "Calling with 'clean' removes generated files."
-    exit 1
-}
-
-PATH=$PATH:/sbin:/usr/sbin
-OS=`uname -s`
-export PATH OS
-
-if [ "$OS" = "SunOS" ]; then
-	exit 0
-fi
-
-case $1 in
-    build)
-        check="CHECK-BUILD"
-        ;;
-    install)
-        check="CHECK-INSTALL"
-        ;;
-    clean)
-        exit 0
-        ;;
-    *)
-        func_usage
-        ;;
-esac
-
-failed=0
-
-echo "Xen ${check} " `date`
-for f in check_* ; do
-    case $f in
-        *~)
-            continue
-            ;;
-        *)
-            ;;
-    esac
-    if ! [ -x $f ] ; then
-        continue
-    fi
-    if ! grep -Fq "$check" $f ; then
-        continue
-    fi
-    echo -n "Checking $f: "
-    if ./$f 2>&1 ; then
-        echo OK
-    else
-        failed=1
-    fi
-done
-
-exit ${failed}
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/funcs.sh
--- a/tools/check/funcs.sh	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-# has is the same as which, except it handles cross environments
-has() {
-	if [ -z "$CROSS_COMPILE" ]; then
-		command which "$@"
-		return $?
-	fi
-
-	check_sys_root || return 1
-
-	# subshell to prevent pollution of caller's IFS
-	(
-	IFS=:
-	for p in $PATH; do
-		if [ -x "$CROSS_SYS_ROOT/$p/$1" ]; then
-			echo "$CROSS_SYS_ROOT/$p/$1"
-			return 0
-		fi
-	done
-	return 1
-	)
-}
-
-has_or_fail() {
-	has "$1" >/dev/null || fail "can't find $1"
-}
-
-has_header() {
-	check_sys_root || return 1
-
-	case $1 in
-		/*) ;;
-		*)
-		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
-
-	return 1
-}
-
-has_lib() {
-	check_sys_root || return 1
-
-	# 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.
-	if [ "$OS" = Linux -a ! -f "$CROSS_SYS_ROOT/etc/ld.so.cache" ]; then
-	    echo "Please run ldconfig -r \"$CROSS_SYS_ROOT\" to generate ld.so.cache"
-	    # fall through; ldconfig test below should fail
-	fi
-	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
-	)
-}
-
-test_link() {
-	# subshell to trap removal of tmpfile
-	(
-	unset tmpfile
-	trap 'rm -f "$tmpfile"; exit' 0 1 2 15
-	tmpfile=`mktemp` || return 1
-	ld "$@" -o "$tmpfile" >/dev/null 2>&1
-	return $?
-	)
-}
-
-# this function is used commonly above
-check_sys_root() {
-	[ -z "$CROSS_COMPILE" ] && return 0
-	if [ -z "$CROSS_SYS_ROOT" ]; then
-		echo "please set CROSS_SYS_ROOT in the environment"
-		return 1
-	fi
-	if [ ! -d "$CROSS_SYS_ROOT" ]; then
-		echo "no sys-root found at $CROSS_SYS_ROOT"
-		return 1
-	fi
-}
-
-warning() {
-	echo
-	echo " *** `basename "$0"` FAILED${*+: $*}"
-}
-
-fail() {
-	echo
-	echo " *** `basename "$0"` FAILED${*+: $*}"
-	exit 1
-}
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/config.guess
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/config.guess	Wed Feb 22 01:55:03 2012 +0000
@@ -0,0 +1,1502 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+#   Free Software Foundation, Inc.
+
+timestamp='2009-12-30'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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
+# 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., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner.  Please send patches (context
+# diff format) to <config-patches@gnu.org> and include a ChangeLog
+# entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
+Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    sh5el) machine=sh5le-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep -q __ELF__
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+	        os=netbsd
+		;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+		;;
+	    *)
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit ;;
+    *:OpenBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	exit ;;
+    *:ekkoBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	exit ;;
+    *:SolidBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	exit ;;
+    macppc:MirBSD:*:*)
+	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    *:MirBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    alpha:OSF1:*:*)
+	case $UNAME_RELEASE in
+	*4.0)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+		;;
+	*5.*)
+	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		;;
+	esac
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE="alphaev5" ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE="alphaev56" ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE="alphapca56" ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE="alphapca57" ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE="alphaev6" ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE="alphaev67" ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE="alphaev69" ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE="alphaev7" ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE="alphaev79" ;;
+	esac
+	# A Pn.n version is a patched version.
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-unknown-sysv4
+	exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit ;;
+    *:z/VM:*:*)
+	echo s390-ibm-zvmoe
+	exit ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+	exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+	echo arm-unknown-riscos
+	exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7; exit ;;
+	esac ;;
+    s390x:SunOS:*:*)
+	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+	echo i386-pc-auroraux${UNAME_RELEASE}
+	exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+	eval $set_cc_for_build
+	SUN_ARCH="i386"
+	# If there is a compiler, see if it is configured for 64-bit objects.
+	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+	# This test works for both compilers.
+	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		grep IS_64BIT_ARCH >/dev/null
+	    then
+		SUN_ARCH="x86_64"
+	    fi
+	fi
+	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+        exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit ;;
+    m68k:machten:*:*)
+	echo m68k-apple-machten${UNAME_RELEASE}
+	exit ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c &&
+	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	    { echo "$SYSTEM_NAME"; exit; }
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+ 	exit ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		then
+			echo "$SYSTEM_NAME"
+		else
+			echo rs6000-ibm-aix3.2.5
+		fi
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit ;;
+    *:AIX:*:[456])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+              	{
+              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+              	case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+              	    switch (bits)
+              		{
+              		case 64: puts ("hppa2.0w"); break;
+              		case 32: puts ("hppa2.0n"); break;
+              		default: puts ("hppa2.0"); break;
+              		} break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+              	    puts ("hppa2.0"); break;
+              #endif
+              	default: puts ("hppa1.0"); break;
+              	}
+                  exit (0);
+              }
+EOF
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    test -z "$HP_ARCH" && HP_ARCH=hppa
+		fi ;;
+	esac
+	if [ ${HP_ARCH} = "hppa2.0w" ]
+	then
+	    eval $set_cc_for_build
+
+	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+	    # generating 64-bit code.  GNU and HP use different nomenclature:
+	    #
+	    # $ CC_FOR_BUILD=cc ./config.guess
+	    # => hppa2.0w-hp-hpux11.23
+	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+	    # => hppa64-hp-hpux11.23
+
+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+		grep -q __LP64__
+	    then
+		HP_ARCH="hppa2.0w"
+	    else
+		HP_ARCH="hppa64"
+	    fi
+	fi
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <unistd.h>
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+		{ echo "$SYSTEM_NAME"; exit; }
+	echo unknown-hitachi-hiuxwe2
+	exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+        exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+        exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+        exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+        exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+        exit ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    *:UNICOS/mp:*:*)
+	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:FreeBSD:*:*)
+	case ${UNAME_MACHINE} in
+	    pc98)
+		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    amd64)
+		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    *)
+		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	esac
+	exit ;;
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
+	exit ;;
+    *:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit ;;
+    i*:windows32*:*)
+    	# uname -m includes "-pc" on this system.
+    	echo ${UNAME_MACHINE}-mingw32
+	exit ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit ;;
+    *:Interix*:*)
+    	case ${UNAME_MACHINE} in
+	    x86)
+		echo i586-pc-interix${UNAME_RELEASE}
+		exit ;;
+	    authenticamd | genuineintel | EM64T)
+		echo x86_64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	    IA64)
+		echo ia64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	esac ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+	echo i${UNAME_MACHINE}-pc-mks
+	exit ;;
+    8664:Windows_NT:*)
+	echo x86_64-pc-mks
+	exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i586-pc-interix
+	exit ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+	echo x86_64-unknown-cygwin
+	exit ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    *:GNU:*:*)
+	# the GNU system
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit ;;
+    *:GNU/*:*:*)
+	# other systems with GNU libc and userland
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	exit ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep -q ld.so.1
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit ;;
+    arm*:Linux:*:*)
+	eval $set_cc_for_build
+	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+	    | grep -q __ARM_EABI__
+	then
+	    echo ${UNAME_MACHINE}-unknown-linux-gnu
+	else
+	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+	fi
+	exit ;;
+    avr32*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    cris:Linux:*:*)
+	echo cris-axis-linux-gnu
+	exit ;;
+    crisv32:Linux:*:*)
+	echo crisv32-axis-linux-gnu
+	exit ;;
+    frv:Linux:*:*)
+    	echo frv-unknown-linux-gnu
+	exit ;;
+    i*86:Linux:*:*)
+	LIBC=gnu
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+	exit ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m32r*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    mips:Linux:*:* | mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef ${UNAME_MACHINE}
+	#undef ${UNAME_MACHINE}el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=${UNAME_MACHINE}el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=${UNAME_MACHINE}
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    or32:Linux:*:*)
+	echo or32-unknown-linux-gnu
+	exit ;;
+    padre:Linux:*:*)
+	echo sparc-unknown-linux-gnu
+	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
+	esac
+	exit ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit ;;
+    sh64*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    vax:Linux:*:*)
+	echo ${UNAME_MACHINE}-dec-linux-gnu
+	exit ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-gnu
+	exit ;;
+    xtensa*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit ;;
+    i*86:syllable:*:*)
+	echo ${UNAME_MACHINE}-pc-syllable
+	exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit ;;
+    i*86:*:5:[678]*)
+    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i586.
+	# Note: whatever this is, it MUST be the same as what config.sub
+	# prints for the "djgpp" host, or else GDB configury will decide that
+	# this is a cross-build.
+	echo i586-pc-msdosdjgpp
+        exit ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit ;;
+    M68*:*:R3V[5678]*:*)
+	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && { echo i486-ncr-sysv4; exit; } ;;
+    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+	OS_REL='.3'
+	test -r /etc/.relid \
+	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel@ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes <hewes@openmarket.com>.
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit ;;
+    *:*:*:FTX*)
+	# From seanf@swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit ;;
+    i*86:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo ${UNAME_MACHINE}-stratus-vos
+	exit ;;
+    *:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo hppa1.1-stratus-vos
+	exit ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+	        echo mips-nec-sysv${UNAME_RELEASE}
+	else
+	        echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+        exit ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit ;;
+    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
+	echo i586-pc-haiku
+	exit ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-7:SUPER-UX:*:*)
+	echo sx7-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8:SUPER-UX:*:*)
+	echo sx8-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8R:SUPER-UX:*:*)
+	echo sx8r-nec-superux${UNAME_RELEASE}
+	exit ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Darwin:*:*)
+	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+	case $UNAME_PROCESSOR in
+	    i386)
+		eval $set_cc_for_build
+		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		      grep IS_64BIT_ARCH >/dev/null
+		  then
+		      UNAME_PROCESSOR="x86_64"
+		  fi
+		fi ;;
+	    unknown) UNAME_PROCESSOR=powerpc ;;
+	esac
+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+	echo nse-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+	exit ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit ;;
+    *:*VMS:*:*)
+    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	case "${UNAME_MACHINE}" in
+	    A*) echo alpha-dec-vms ; exit ;;
+	    I*) echo ia64-dec-vms ; exit ;;
+	    V*) echo vax-dec-vms ; exit ;;
+	esac ;;
+    *:XENIX:*:SysV)
+	echo i386-pc-xenix
+	exit ;;
+    i*86:skyos:*:*)
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	exit ;;
+    i*86:rdos:*:*)
+	echo ${UNAME_MACHINE}-pc-rdos
+	exit ;;
+    i*86:AROS:*:*)
+	echo ${UNAME_MACHINE}-pc-aros
+	exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+	  ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+	printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+	printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+	{ echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+	echo c1-convex-bsd
+	exit ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit ;;
+    c34*)
+	echo c34-convex-bsd
+	exit ;;
+    c38*)
+	echo c38-convex-bsd
+	exit ;;
+    c4*)
+	echo c4-convex-bsd
+	exit ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+and
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/config.h.in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/config.h.in	Wed Feb 22 01:55:03 2012 +0000
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2012
+ *
+ * This program 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; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program 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.
+ */
+
+/* Define to 1 if you have the <yajl/yajl_version.h> header file. */
+#undef HAVE_YAJL_YAJL_VERSION_H
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/config.sub
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/config.sub	Wed Feb 22 01:55:03 2012 +0000
@@ -0,0 +1,1714 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+#   Free Software Foundation, Inc.
+
+timestamp='2010-01-22'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 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., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted GNU ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
+Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  kopensolaris*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+	-sun*os*)
+		# Prevent following clause from handling this invalid input.
+		;;
+	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+	-apple | -axis | -knuth | -cray | -microblaze)
+		os=
+		basic_machine=$1
+		;;
+        -bluegene*)
+	        os=-cnk
+		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+ 	-chorusrdb)
+ 		os=-chorusrdb
+		basic_machine=$1
+ 		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco6)
+		os=-sco5v6
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5)
+		os=-sco3.2v5
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5v6*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-lynx*)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+	-psos*)
+		os=-psos
+		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+	# Recognize the basic CPU types without company name.
+	# Some are omitted here because they have special meanings below.
+	1750a | 580 \
+	| a29k \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| am33_2.0 \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+	| bfin \
+	| c4x | clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| fido | fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| i370 | i860 | i960 | ia64 \
+	| ip2k | iq2000 \
+	| lm32 \
+	| m32c | m32r | m32rle | m68000 | m68k | m88k \
+	| maxq | mb | microblaze | mcore | mep | metag \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64octeon | mips64octeonel \
+	| mips64orion | mips64orionel \
+	| mips64r5900 | mips64r5900el \
+	| mips64vr | mips64vrel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mips64vr5900 | mips64vr5900el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa32r2 | mipsisa32r2el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64r2 | mipsisa64r2el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| moxie \
+	| mt \
+	| msp430 \
+	| nios | nios2 \
+	| ns16k | ns32k \
+	| or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| pyramid \
+	| rx \
+	| score \
+	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+	| spu | strongarm \
+	| tahoe | thumb | tic4x | tic80 | tron \
+	| ubicom32 \
+	| v850 | v850e \
+	| we32k \
+	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| z8k | z80)
+		basic_machine=$basic_machine-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
+		# Motorola 68HC11/12.
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+	ms1)
+		basic_machine=mt-unknown
+		;;
+
+	# We use `pc' rather than `unknown'
+	# because (1) that's what they normally are, and
+	# (2) the word "unknown" tends to confuse beginning users.
+	i*86 | x86_64)
+	  basic_machine=$basic_machine-pc
+	  ;;
+	# Object if more than one company name word.
+	*-*-*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+	# Recognize the basic CPU types with company name.
+	580-* \
+	| a29k-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* | avr32-* \
+	| bfin-* | bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+	| clipper-* | craynv-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* | iq2000-* \
+	| lm32-* \
+	| m32c-* | m32r-* | m32rle-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64octeon-* | mips64octeonel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64r5900-* | mips64r5900el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mips64vr5900-* | mips64vr5900el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa32r2-* | mipsisa32r2el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64r2-* | mipsisa64r2el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipstx39-* | mipstx39el-* \
+	| mmix-* \
+	| mt-* \
+	| msp430-* \
+	| nios-* | nios2-* \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| pyramid-* \
+	| romp-* | rs6000-* | rx-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+	| sparclite-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tile-* | tilegx-* \
+	| tron-* \
+	| ubicom32-* \
+	| v850-* | v850e-* | vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| xstormy16-* | xtensa*-* \
+	| ymp-* \
+	| z8k-* | z80-*)
+		;;
+	# Recognize the basic CPU types without company name, with glob match.
+	xtensa*)
+		basic_machine=$basic_machine-unknown
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+    	abacus)
+		basic_machine=abacus-unknown
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amd64)
+		basic_machine=x86_64-pc
+		;;
+	amd64-*)
+		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-unknown
+		;;
+	amigaos | amigados)
+		basic_machine=m68k-unknown
+		os=-amigaos
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-unknown
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
+	aros)
+		basic_machine=i386-pc
+		os=-aros
+		;;
+	aux)
+		basic_machine=m68k-apple
+		os=-aux
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	blackfin)
+		basic_machine=bfin-unknown
+		os=-linux
+		;;
+	blackfin-*)
+		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	bluegene*)
+		basic_machine=powerpc-ibm
+		os=-cnk
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+        cegcc)
+		basic_machine=arm-unknown
+		os=-cegcc
+		;;
+	convex-c1)
+		basic_machine=c1-convex
+		os=-bsd
+		;;
+	convex-c2)
+		basic_machine=c2-convex
+		os=-bsd
+		;;
+	convex-c32)
+		basic_machine=c32-convex
+		os=-bsd
+		;;
+	convex-c34)
+		basic_machine=c34-convex
+		os=-bsd
+		;;
+	convex-c38)
+		basic_machine=c38-convex
+		os=-bsd
+		;;
+	cray | j90)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	craynv)
+		basic_machine=craynv-cray
+		os=-unicosmp
+		;;
+	cr16)
+		basic_machine=cr16-unknown
+		os=-elf
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	crisv32 | crisv32-* | etraxfs*)
+		basic_machine=crisv32-axis
+		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
+	crx)
+		basic_machine=crx-unknown
+		os=-elf
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	dicos)
+		basic_machine=i686-pc
+		os=-dicos
+		;;
+	djgpp)
+		basic_machine=i586-pc
+		os=-msdosdjgpp
+		;;
+	dpx20 | dpx20-*)
+		basic_machine=rs6000-bull
+		os=-bosx
+		;;
+	dpx2* | dpx2*-bull)
+		basic_machine=m68k-bull
+		os=-sysv3
+		;;
+	ebmon29k)
+		basic_machine=a29k-amd
+		os=-ebmon
+		;;
+	elxsi)
+		basic_machine=elxsi-elxsi
+		os=-bsd
+		;;
+	encore | umax | mmax)
+		basic_machine=ns32k-encore
+		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-hitachi
+		os=-hms
+		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
+	harris)
+		basic_machine=m88k-harris
+		os=-sysv3
+		;;
+	hp300-*)
+		basic_machine=m68k-hp
+		;;
+	hp300bsd)
+		basic_machine=m68k-hp
+		os=-bsd
+		;;
+	hp300hpux)
+		basic_machine=m68k-hp
+		os=-hpux
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hppa-next)
+		os=-nextstep3
+		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+	i*86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv32
+		;;
+	i*86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i*86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i*86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	m68knommu)
+		basic_machine=m68k-unknown
+		os=-linux
+		;;
+	m68knommu-*)
+		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+        microblaze)
+		basic_machine=microblaze-xilinx
+		;;
+	mingw32)
+		basic_machine=i386-pc
+		os=-mingw32
+		;;
+	mingw32ce)
+		basic_machine=arm-unknown
+		os=-mingw32ce
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
+	msdos)
+		basic_machine=i386-pc
+		os=-msdos
+		;;
+	ms1-*)
+		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-rebel
+		os=-linux
+		;;
+	news | news700 | news800 | news900)
+		basic_machine=m68k-sony
+		os=-newsos
+		;;
+	news1000)
+		basic_machine=m68030-sony
+		os=-newsos
+		;;
+	news-3600 | risc-news)
+		basic_machine=mips-sony
+		os=-newsos
+		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
+	next | m*-next )
+		basic_machine=m68k-next
+		case $os in
+		    -nextstep* )
+			;;
+		    -ns2*)
+		      os=-nextstep2
+			;;
+		    *)
+		      os=-nextstep3
+			;;
+		esac
+		;;
+	nh3000)
+		basic_machine=m68k-harris
+		os=-cxux
+		;;
+	nh[45]000)
+		basic_machine=m88k-harris
+		os=-cxux
+		;;
+	nindy960)
+		basic_machine=i960-intel
+		os=-nindy
+		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	openrisc | openrisc-*)
+		basic_machine=or32-unknown
+		;;
+	os400)
+		basic_machine=powerpc-ibm
+		os=-os400
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	parisc)
+		basic_machine=hppa-unknown
+		os=-linux
+		;;
+	parisc-*)
+		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+	pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pc98)
+		basic_machine=i386-pc
+		;;
+	pc98-*)
+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
+		basic_machine=i586-pc
+		;;
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+		basic_machine=i686-pc
+		;;
+	pentiumii | pentium2 | pentiumiii | pentium3)
+		basic_machine=i686-pc
+		;;
+	pentium4)
+		basic_machine=i786-pc
+		;;
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium4-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	power)	basic_machine=power-ibm
+		;;
+	ppc)	basic_machine=powerpc-unknown
+		;;
+	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppcle | powerpclittle | ppc-le | powerpc-little)
+		basic_machine=powerpcle-unknown
+		;;
+	ppcle-* | powerpclittle-*)
+		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rdos)
+		basic_machine=i386-pc
+		os=-rdos
+		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	rm[46]00)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sde)
+		basic_machine=mipsisa32-sde
+		os=-elf
+		;;
+	sei)
+		basic_machine=mips-sei
+		os=-seiux
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sh5el)
+		basic_machine=sh5le-unknown
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparclite-wrs | simso-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
+	sun2)
+		basic_machine=m68000-sun
+		;;
+	sun2os3)
+		basic_machine=m68000-sun
+		os=-sunos3
+		;;
+	sun2os4)
+		basic_machine=m68000-sun
+		os=-sunos4
+		;;
+	sun3os3)
+		basic_machine=m68k-sun
+		os=-sunos3
+		;;
+	sun3os4)
+		basic_machine=m68k-sun
+		os=-sunos4
+		;;
+	sun4os3)
+		basic_machine=sparc-sun
+		os=-sunos3
+		;;
+	sun4os4)
+		basic_machine=sparc-sun
+		os=-sunos4
+		;;
+	sun4sol2)
+		basic_machine=sparc-sun
+		os=-solaris2
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t3e)
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+	tic54x | c54x*)
+		basic_machine=tic54x-unknown
+		os=-coff
+		;;
+	tic55x | c55x*)
+		basic_machine=tic55x-unknown
+		os=-coff
+		;;
+	tic6x | c6x*)
+		basic_machine=tic6x-unknown
+		os=-coff
+		;;
+        # This must be matched before tile*.
+        tilegx*)
+		basic_machine=tilegx-unknown
+		os=-linux-gnu
+		;;
+	tile*)
+		basic_machine=tile-unknown
+		os=-linux-gnu
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	tpf)
+		basic_machine=s390x-ibm
+		os=-tpf
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vpp*|vx|vx-*)
+		basic_machine=f301-fujitsu
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	vxworks29k)
+		basic_machine=a29k-wrs
+		os=-vxworks
+		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	xbox)
+		basic_machine=i686-pc
+		os=-mingw32
+		;;
+	xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
+	z80-*-coff)
+		basic_machine=z80-unknown
+		os=-sim
+		;;
+	none)
+		basic_machine=none-none
+		os=-none
+		;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	mmix)
+		basic_machine=mmix-knuth
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+		basic_machine=sh-unknown
+		;;
+	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+		basic_machine=sparc-sun
+		;;
+	cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
+	*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+	*-digital*)
+		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		;;
+	*-commodore*)
+		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+	# -solaris* is a basic system type, with this one exception.
+        -auroraux)
+	        os=-auroraux
+		;;
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-svr4*)
+		os=-sysv4
+		;;
+	-unixware*)
+		os=-sysv4.2uw
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+		;;
+	# First accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST END IN A *, to match a version number.
+	# -sysv* is not here because it comes later, after sysvr4.
+	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+	      | -sym* | -kopensolaris* \
+	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+	      | -aos* | -aros* \
+	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -openbsd* | -solidbsd* \
+	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* | -cegcc* \
+	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
+	# Remember, each alternative MUST END IN *, to match a version number.
+		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto-qnx*)
+		;;
+	-nto*)
+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
+	-linux-dietlibc)
+		os=-linux-dietlibc
+		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-opened*)
+		os=-openedition
+		;;
+        -os400*)
+		os=-os400
+		;;
+	-wince*)
+		os=-wince
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-syllable*)
+		os=-syllable
+		;;
+	-386bsd)
+		os=-bsd
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
+	-ns2 )
+		os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+        -tpf*)
+		os=-tpf
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-aros*)
+		os=-aros
+		;;
+	-kaos*)
+		os=-kaos
+		;;
+	-zvmoe)
+		os=-zvmoe
+		;;
+	-dicos*)
+		os=-dicos
+		;;
+        -nacl*)
+	        ;;
+	-none)
+		;;
+	*)
+		# Get rid of the `-' at the beginning of $os.
+		os=`echo $os | sed 's/[^-]*-//'`
+		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		exit 1
+		;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+        score-*)
+		os=-elf
+		;;
+        spu-*)
+		os=-elf
+		;;
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-rebel)
+		os=-linux
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+        c4x-* | tic4x-*)
+        	os=-coff
+		;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
+		;;
+	pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	m68*-apollo)
+		os=-domain
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		# This also exists in the configure program, but was not the
+		# default.
+		# os=-sunos4
+		;;
+	m68*-cisco)
+		os=-aout
+		;;
+        mep-*)
+		os=-elf
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
+	or32-*)
+		os=-coff
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-be)
+		os=-beos
+		;;
+	*-haiku)
+		os=-haiku
+		;;
+	*-ibm)
+		os=-aix
+		;;
+    	*-knuth)
+		os=-mmixware
+		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigaos
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-next )
+		os=-nextstep
+		;;
+	*-sequent)
+		os=-ptx
+		;;
+	*-crds)
+		os=-unos
+		;;
+	*-ns)
+		os=-genix
+		;;
+	i370-*)
+		os=-mvs
+		;;
+	*-next)
+		os=-nextstep3
+		;;
+	*-gould)
+		os=-sysv
+		;;
+	*-highlevel)
+		os=-bsd
+		;;
+	*-encore)
+		os=-bsd
+		;;
+	*-sgi)
+		os=-irix
+		;;
+	*-siemens)
+		os=-sysv4
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	f30[01]-fujitsu | f700-fujitsu)
+		os=-uxpv
+		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
+	*)
+		os=-none
+		;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+	*-unknown)
+		case $os in
+			-riscix*)
+				vendor=acorn
+				;;
+			-sunos*)
+				vendor=sun
+				;;
+			-cnk*|-aix*)
+				vendor=ibm
+				;;
+			-beos*)
+				vendor=be
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-mpeix*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs* | -opened*)
+				vendor=ibm
+				;;
+			-os400*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-tpf*)
+				vendor=ibm
+				;;
+			-vxsim* | -vxworks* | -windiss*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/configure
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/configure	Wed Feb 22 01:55:03 2012 +0000
@@ -0,0 +1,10469 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.67 for Xen Hypervisor 4.2.
+#
+# Report bugs to <xen-devel@lists.xensource.com>.
+#
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
+  else
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in #(
+      *"$as_nl"*)
+	expr "X$arg" : "X\\(.*\\)$as_nl";
+	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
+  fi
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in #((
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test "x$CONFIG_SHELL" = x; then
+  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+"
+  as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+  exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1"
+  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+  if (eval "$as_required") 2>/dev/null; then :
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  as_found=:
+  case $as_dir in #(
+	 /*)
+	   for as_base in sh bash ksh sh5; do
+	     # Try only shells that exist, to save several forks.
+	     as_shell=$as_dir/$as_base
+	     if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+		    { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  CONFIG_SHELL=$as_shell as_have_required=yes
+		   if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  break 2
+fi
+fi
+	   done;;
+       esac
+  as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+	      { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+  CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+      if test "x$CONFIG_SHELL" != x; then :
+  # We cannot yet assume a decent shell, so we have to provide a
+	# neutralization value for shells without unset; and this also
+	# works around shells that cannot unset nonexistent variables.
+	BASH_ENV=/dev/null
+	ENV=/dev/null
+	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+	export CONFIG_SHELL
+	exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+    if test x$as_have_required = xno; then :
+  $as_echo "$0: This script requires a shell more modern than all"
+  $as_echo "$0: the shells that I found on your system."
+  if test x${ZSH_VERSION+set} = xset ; then
+    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+  else
+    $as_echo "$0: Please tell bug-autoconf@gnu.org and
+$0: xen-devel@lists.xensource.com about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+  fi
+  exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+  as_lineno_1=$LINENO as_lineno_1a=$LINENO
+  as_lineno_2=$LINENO as_lineno_2a=$LINENO
+  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='	';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -p'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -p'
+  fi
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+	test -d "$1/.";
+      else
+	case $1 in #(
+	-*)set "./$1";;
+	esac;
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+	???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='Xen Hypervisor'
+PACKAGE_TARNAME='xen-hypervisor'
+PACKAGE_VERSION='4.2'
+PACKAGE_STRING='Xen Hypervisor 4.2'
+PACKAGE_BUGREPORT='xen-devel@lists.xensource.com'
+PACKAGE_URL=''
+
+ac_unique_file="libxl/libxl.c"
+ac_default_prefix=/usr
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_header_list=
+ac_func_list=
+ac_subst_vars='LTLIBOBJS
+POW_LIB
+LIBOBJS
+ALLOCA
+libiconv
+libgcrypt
+libext2fs
+system_aio
+LIB_PATH
+glib_LIBS
+glib_CFLAGS
+PKG_CONFIG_LIBDIR
+PKG_CONFIG_PATH
+PKG_CONFIG
+VNCONFIG
+HOTPLUG
+UDEVINFO
+UDEVADM
+PYTHONPATH
+OCAMLBUILD
+OCAMLDOC
+OCAMLMKLIB
+OCAMLMKTOP
+OCAMLDEP
+OCAML
+OCAMLOPTDOTOPT
+OCAMLCDOTOPT
+OCAMLBEST
+OCAMLOPT
+OCAMLLIB
+OCAMLVERSION
+OCAMLC
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+SET_MAKE
+LN_S
+SED
+XGETTEXT
+BASH
+XML
+CURL
+FLEX
+BISON
+IP
+BRCTL
+PERL
+PYTHON
+APPEND_LIB
+APPEND_INCLUDES
+PREPEND_LIB
+PREPEND_INCLUDES
+debug
+lomount
+miniterm
+ocamltools
+pythontools
+xapi
+vtpm
+monitors
+githttp
+xsm
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+EGREP
+GREP
+CPP
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_xsm
+enable_githttp
+enable_monitors
+enable_vtpm
+enable_xapi
+enable_pythontools
+enable_ocamltools
+enable_miniterm
+enable_lomount
+enable_debug
+'
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP
+PREPEND_INCLUDES
+PREPEND_LIB
+APPEND_INCLUDES
+APPEND_LIB
+PYTHON
+PERL
+BRCTL
+IP
+BISON
+FLEX
+CURL
+XML
+BASH
+XGETTEXT
+PKG_CONFIG
+PKG_CONFIG_PATH
+PKG_CONFIG_LIBDIR
+glib_CFLAGS
+glib_LIBS'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval $ac_prev=\$ac_option
+    ac_prev=
+    continue
+  fi
+
+  case $ac_option in
+  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *=)   ac_optarg= ;;
+  *)    ac_optarg=yes ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_dashdash$ac_option in
+  --)
+    ac_dashdash=yes ;;
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=*)
+    datadir=$ac_optarg ;;
+
+  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+  | --dataroo | --dataro | --datar)
+    ac_prev=datarootdir ;;
+  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+    datarootdir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=no ;;
+
+  -docdir | --docdir | --docdi | --doc | --do)
+    ac_prev=docdir ;;
+  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+    docdir=$ac_optarg ;;
+
+  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+    ac_prev=dvidir ;;
+  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+    dvidir=$ac_optarg ;;
+
+  -enable-* | --enable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=\$ac_optarg ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+    ac_prev=htmldir ;;
+  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+  | --ht=*)
+    htmldir=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localedir | --localedir | --localedi | --localed | --locale)
+    ac_prev=localedir ;;
+  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+    localedir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst | --locals)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+    ac_prev=pdfdir ;;
+  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+    pdfdir=$ac_optarg ;;
+
+  -psdir | --psdir | --psdi | --psd | --ps)
+    ac_prev=psdir ;;
+  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+    psdir=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=\$ac_optarg ;;
+
+  -without-* | --without-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=no ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    case $ac_envvar in #(
+      '' | [0-9]* | *[!_$as_cr_alnum]* )
+      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+    esac
+    eval $ac_envvar=\$ac_optarg
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+  case $enable_option_checking in
+    no) ;;
+    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+  esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
+		datadir sysconfdir sharedstatedir localstatedir includedir \
+		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+		libdir localedir mandir
+do
+  eval ac_val=\$$ac_var
+  # Remove trailing slashes.
+  case $ac_val in
+    */ )
+      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+      eval $ac_var=\$ac_val;;
+  esac
+  # Be sure to have absolute directory names.
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* )  continue;;
+    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+  esac
+  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used" >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+  as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+  as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then the parent directory.
+  ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_myself" : 'X\(//\)[^/]' \| \
+	 X"$as_myself" : 'X\(//\)$' \| \
+	 X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r "$srcdir/$ac_unique_file"; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+	pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+  srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+  eval ac_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_env_${ac_var}_value=\$${ac_var}
+  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures Xen Hypervisor 4.2 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking ...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR            user executables [EPREFIX/bin]
+  --sbindir=DIR           system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR        program executables [EPREFIX/libexec]
+  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --libdir=DIR            object code libraries [EPREFIX/lib]
+  --includedir=DIR        C header files [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
+  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR           info documentation [DATAROOTDIR/info]
+  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
+  --mandir=DIR            man documentation [DATAROOTDIR/man]
+  --docdir=DIR            documentation root [DATAROOTDIR/doc/xen-hypervisor]
+  --htmldir=DIR           html documentation [DOCDIR]
+  --dvidir=DIR            dvi documentation [DOCDIR]
+  --pdfdir=DIR            pdf documentation [DOCDIR]
+  --psdir=DIR             ps documentation [DOCDIR]
+_ACEOF
+
+  cat <<\_ACEOF
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of Xen Hypervisor 4.2:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-option-checking  ignore unrecognized --enable/--with options
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-xsm            Enable XSM security module (by default, Flask)
+  --enable-githttp        Download GIT repositories via HTTP
+  --disable-monitors      Disable xenstat and xentop monitoring tools
+  --enable-vtpm           Enable Virtual Trusted Platform Module
+  --enable-xapi           Enable Xen API Bindings
+  --disable-pythontools   Disable Python tools
+  --disable-ocamltools    Disable Ocaml tools
+  --enable-miniterm       Enable miniterm
+  --enable-lomount        Enable lomount
+  --disable-debug         Disable debug build of Xen and tools
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+  PREPEND_INCLUDES
+              List of include folders to prepend to CFLAGS (without -I)
+  PREPEND_LIB List of library folders to prepend to LDFLAGS (without -L)
+  APPEND_INCLUDES
+              List of include folders to append to CFLAGS (without -I)
+  APPEND_LIB  List of library folders to append to LDFLAGS (without -L)
+  PYTHON      Path to the Python parser
+  PERL        Path to Perl parser
+  BRCTL       Path to brctl tool
+  IP          Path to ip tool
+  BISON       Path to Bison parser generator
+  FLEX        Path to Flex lexical analyser generator
+  CURL        Path to curl-config tool
+  XML         Path to xml2-config tool
+  BASH        Path to bash shell
+  XGETTEXT    Path to xgetttext tool
+  PKG_CONFIG  path to pkg-config utility
+  PKG_CONFIG_PATH
+              directories to add to pkg-config's search path
+  PKG_CONFIG_LIBDIR
+              path overriding pkg-config's built-in search path
+  glib_CFLAGS C compiler flags for glib, overriding pkg-config
+  glib_LIBS   linker flags for glib, overriding pkg-config
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <xen-devel@lists.xensource.com>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d "$ac_dir" ||
+      { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+      continue
+    ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+    cd "$ac_dir" || { ac_status=$?; continue; }
+    # Check for guested configure.
+    if test -f "$ac_srcdir/configure.gnu"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+    elif test -f "$ac_srcdir/configure"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure" --help=recursive
+    else
+      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi || ac_status=$?
+    cd "$ac_pwd" || { ac_status=$?; break; }
+  done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+  cat <<\_ACEOF
+Xen Hypervisor configure 4.2
+generated by GNU Autoconf 2.67
+
+Copyright (C) 2010 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } > conftest.i && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+    ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if eval "test \"\${$3+set}\"" = set; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_header_compiler=yes
+else
+  ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  ac_header_preproc=yes
+else
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+  yes:no: )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## -------------------------------------------- ##
+## Report this to xen-devel@lists.xensource.com ##
+## -------------------------------------------- ##"
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+       $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=$ac_status
+fi
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_test_x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $2 (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_func
+
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+	 return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+	    return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_type
+
+# ac_fn_c_find_intX_t LINENO BITS VAR
+# -----------------------------------
+# Finds a signed integer type with width BITS, setting cache variable VAR
+# accordingly.
+ac_fn_c_find_intX_t ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5
+$as_echo_n "checking for int$2_t... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+     # Order is important - never check a type that is potentially smaller
+     # than half of the expected target width.
+     for ac_type in int$2_t 'int' 'long int' \
+	 'long long int' 'short int' 'signed char'; do
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+	     enum { N = $2 / 2 - 1 };
+int
+main ()
+{
+static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+	        enum { N = $2 / 2 - 1 };
+int
+main ()
+{
+static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
+		 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  case $ac_type in #(
+  int$2_t) :
+    eval "$3=yes" ;; #(
+  *) :
+    eval "$3=\$ac_type" ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       if eval test \"x\$"$3"\" = x"no"; then :
+
+else
+  break
+fi
+     done
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_find_intX_t
+
+# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
+# ----------------------------------------------------
+# Tries to find if the field MEMBER exists in type AGGR, after including
+# INCLUDES, setting cache variable VAR accordingly.
+ac_fn_c_check_member ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
+$as_echo_n "checking for $2.$3... " >&6; }
+if eval "test \"\${$4+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$5
+int
+main ()
+{
+static $2 ac_aggr;
+if (ac_aggr.$3)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$4=yes"
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$5
+int
+main ()
+{
+static $2 ac_aggr;
+if (sizeof ac_aggr.$3)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$4=yes"
+else
+  eval "$4=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$4
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_member
+
+# ac_fn_c_find_uintX_t LINENO BITS VAR
+# ------------------------------------
+# Finds an unsigned integer type with width BITS, setting cache variable VAR
+# accordingly.
+ac_fn_c_find_uintX_t ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5
+$as_echo_n "checking for uint$2_t... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+     # Order is important - never check a type that is potentially smaller
+     # than half of the expected target width.
+     for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \
+	 'unsigned long long int' 'unsigned short int' 'unsigned char'; do
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  case $ac_type in #(
+  uint$2_t) :
+    eval "$3=yes" ;; #(
+  *) :
+    eval "$3=\$ac_type" ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       if eval test \"x\$"$3"\" = x"no"; then :
+
+else
+  break
+fi
+     done
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_find_uintX_t
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by Xen Hypervisor $as_me 4.2, which was
+generated by GNU Autoconf 2.67.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    $as_echo "PATH: $as_dir"
+  done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *\'*)
+      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+    2)
+      as_fn_append ac_configure_args1 " '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+	ac_must_keep_next=false # Got value, back to normal.
+      else
+	case $ac_arg in
+	  *=* | --config-cache | -C | -disable-* | --disable-* \
+	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+	  | -with-* | --with-* | -without-* | --without-* | --x)
+	    case "$ac_configure_args0 " in
+	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+	    esac
+	    ;;
+	  -* ) ac_must_keep_next=true ;;
+	esac
+      fi
+      as_fn_append ac_configure_args " '$ac_arg'"
+      ;;
+    esac
+  done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+(
+  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
+      esac ;;
+    esac
+  done
+  (set) 2>&1 |
+    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      sed -n \
+	"s/'\''/'\''\\\\'\'''\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
+    *)
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+)
+    echo
+
+    $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      $as_echo "$ac_var='\''$ac_val'\''"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=\$$ac_var
+	case $ac_val in
+	*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+	esac
+	$as_echo "$ac_var='\''$ac_val'\''"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+      echo
+      cat confdefs.h
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      $as_echo "$as_me: caught signal $ac_signal"
+    $as_echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core core.conftest.* &&
+    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+  # We do not want a PATH search for config.site.
+  case $CONFIG_SITE in #((
+    -*)  ac_site_file1=./$CONFIG_SITE;;
+    */*) ac_site_file1=$CONFIG_SITE;;
+    *)   ac_site_file1=./$CONFIG_SITE;;
+  esac
+elif test "x$prefix" != xNONE; then
+  ac_site_file1=$prefix/share/config.site
+  ac_site_file2=$prefix/etc/config.site
+else
+  ac_site_file1=$ac_default_prefix/share/config.site
+  ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+  test "x$ac_site_file" = xNONE && continue
+  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file" \
+      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5 ; }
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special files
+  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
+  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
+    esac
+  fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+as_fn_append ac_header_list " sys/time.h"
+as_fn_append ac_header_list " unistd.h"
+as_fn_append ac_func_list " alarm"
+as_fn_append ac_header_list " stdlib.h"
+as_fn_append ac_header_list " sys/param.h"
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val=\$ac_cv_env_${ac_var}_value
+  eval ac_new_val=\$ac_env_${ac_var}_value
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+	# differences in whitespace do not lead to failure.
+	ac_old_val_w=`echo x $ac_old_val`
+	ac_new_val_w=`echo x $ac_new_val`
+	if test "$ac_old_val_w" != "$ac_new_val_w"; then
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	  ac_cache_corrupted=:
+	else
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+	  eval $ac_var=\$ac_old_val
+	fi
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
+$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
+$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+ac_config_files="$ac_config_files ../config/Tools.mk"
+
+ac_config_headers="$ac_config_headers config.h"
+
+
+ac_aux_dir=
+for ac_dir in . "$srcdir"/.; do
+  if test -f "$ac_dir/install-sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f "$ac_dir/install.sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f "$ac_dir/shtool"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in . \"$srcdir\"/." "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+
+
+
+# Check if CFLAGS, LDFLAGS, LIBS, CPPFLAGS or CPP is set and print a warning
+
+if test -n "$CC$CFLAGS$LDFLAGS$LIBS$CPPFLAGS$CPP"; then :
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Setting CC, CFLAGS, LDFLAGS, LIBS, CPPFLAGS or CPP is not \
+recommended, use PREPEND_INCLUDES, PREPEND_LIB, \
+APPEND_INCLUDES and APPEND_LIB instead when possible." >&5
+$as_echo "$as_me: WARNING: Setting CC, CFLAGS, LDFLAGS, LIBS, CPPFLAGS or CPP is not \
+recommended, use PREPEND_INCLUDES, PREPEND_LIB, \
+APPEND_INCLUDES and APPEND_LIB instead when possible." >&2;}
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5 ; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+  esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link_default") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile.  We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+	;;
+    [ab].out )
+	# We found the default executable, but exeext='' is most
+	# certainly right.
+	break;;
+    *.* )
+	if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+	then :; else
+	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	fi
+	# We set ac_cv_exeext here because the later test for it is not
+	# safe: cross compilers may not add the suffix if given an `-o'
+	# argument, so we may need to know it at that point already.
+	# Even if this section looks crufty: it has the advantage of
+	# actually working.
+	break;;
+    * )
+	break;;
+  esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+  ac_file=''
+fi
+if test -z "$ac_file"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	  break;;
+    * ) break;;
+  esac
+done
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5 ; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+  { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+  if { ac_try='./conftest$ac_cv_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5 ; }
+    fi
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if test "${ac_cv_objext+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5 ; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+else
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5 ; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$GREP"; then
+  ac_path_GREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in grep ggrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_GREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_GREP"; then
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     if test -z "$EGREP"; then
+  ac_path_EGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in egrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_EGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_EGREP"; then
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stdc=yes
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+  ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default"
+if test "x$ac_cv_header_minix_config_h" = x""yes; then :
+  MINIX=yes
+else
+  MINIX=
+fi
+
+
+  if test "$MINIX" = yes; then
+
+$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h
+
+
+$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h
+
+
+$as_echo "#define _MINIX 1" >>confdefs.h
+
+  fi
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5
+$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
+if test "${ac_cv_safe_to_define___extensions__+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#	  define __EXTENSIONS__ 1
+	  $ac_includes_default
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_safe_to_define___extensions__=yes
+else
+  ac_cv_safe_to_define___extensions__=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5
+$as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
+  test $ac_cv_safe_to_define___extensions__ = yes &&
+    $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h
+
+  $as_echo "#define _ALL_SOURCE 1" >>confdefs.h
+
+  $as_echo "#define _GNU_SOURCE 1" >>confdefs.h
+
+  $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
+
+  $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h
+
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if test "${ac_cv_build+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if test "${ac_cv_host+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+
+# M4 Macro includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
+# serial 1 (pkg-config-0.24)
+#
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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
+# 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.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists.  Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+# only at the first occurence in configure.ac, so if the first place
+# it's called might be skipped (such as if it is within an "if", you
+# have to call PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+# PKG_CHECK_MODULES
+
+
+# Enable/disable options
+# Check whether --enable-xsm was given.
+if test "${enable_xsm+set}" = set; then :
+  enableval=$enable_xsm;
+fi
+
+
+if test "x$enable_xsm" = "xyes"; then :
+
+    ax_cv_xsm="y"
+
+elif test "x$enable_xsm" = "xno"; then :
+
+    ax_cv_xsm="n"
+
+elif test -z $ax_cv_xsm; then :
+
+    ax_cv_xsm="n"
+
+fi
+xsm=$ax_cv_xsm
+
+# Check whether --enable-githttp was given.
+if test "${enable_githttp+set}" = set; then :
+  enableval=$enable_githttp;
+fi
+
+
+if test "x$enable_githttp" = "xyes"; then :
+
+    ax_cv_githttp="y"
+
+elif test "x$enable_githttp" = "xno"; then :
+
+    ax_cv_githttp="n"
+
+elif test -z $ax_cv_githttp; then :
+
+    ax_cv_githttp="n"
+
+fi
+githttp=$ax_cv_githttp
+
+# Check whether --enable-monitors was given.
+if test "${enable_monitors+set}" = set; then :
+  enableval=$enable_monitors;
+fi
+
+
+if test "x$enable_monitors" = "xno"; then :
+
+    ax_cv_monitors="n"
+
+elif test "x$enable_monitors" = "xyes"; then :
+
+    ax_cv_monitors="y"
+
+elif test -z $ax_cv_monitors; then :
+
+    ax_cv_monitors="y"
+
+fi
+monitors=$ax_cv_monitors
+
+# Check whether --enable-vtpm was given.
+if test "${enable_vtpm+set}" = set; then :
+  enableval=$enable_vtpm;
+fi
+
+
+if test "x$enable_vtpm" = "xyes"; then :
+
+    ax_cv_vtpm="y"
+
+elif test "x$enable_vtpm" = "xno"; then :
+
+    ax_cv_vtpm="n"
+
+elif test -z $ax_cv_vtpm; then :
+
+    ax_cv_vtpm="n"
+
+fi
+vtpm=$ax_cv_vtpm
+
+# Check whether --enable-xapi was given.
+if test "${enable_xapi+set}" = set; then :
+  enableval=$enable_xapi;
+fi
+
+
+if test "x$enable_xapi" = "xyes"; then :
+
+    ax_cv_xapi="y"
+
+elif test "x$enable_xapi" = "xno"; then :
+
+    ax_cv_xapi="n"
+
+elif test -z $ax_cv_xapi; then :
+
+    ax_cv_xapi="n"
+
+fi
+xapi=$ax_cv_xapi
+
+# Check whether --enable-pythontools was given.
+if test "${enable_pythontools+set}" = set; then :
+  enableval=$enable_pythontools;
+fi
+
+
+if test "x$enable_pythontools" = "xno"; then :
+
+    ax_cv_pythontools="n"
+
+elif test "x$enable_pythontools" = "xyes"; then :
+
+    ax_cv_pythontools="y"
+
+elif test -z $ax_cv_pythontools; then :
+
+    ax_cv_pythontools="y"
+
+fi
+pythontools=$ax_cv_pythontools
+
+# Check whether --enable-ocamltools was given.
+if test "${enable_ocamltools+set}" = set; then :
+  enableval=$enable_ocamltools;
+fi
+
+
+if test "x$enable_ocamltools" = "xno"; then :
+
+    ax_cv_ocamltools="n"
+
+elif test "x$enable_ocamltools" = "xyes"; then :
+
+    ax_cv_ocamltools="y"
+
+elif test -z $ax_cv_ocamltools; then :
+
+    ax_cv_ocamltools="y"
+
+fi
+ocamltools=$ax_cv_ocamltools
+
+# Check whether --enable-miniterm was given.
+if test "${enable_miniterm+set}" = set; then :
+  enableval=$enable_miniterm;
+fi
+
+
+if test "x$enable_miniterm" = "xyes"; then :
+
+    ax_cv_miniterm="y"
+
+elif test "x$enable_miniterm" = "xno"; then :
+
+    ax_cv_miniterm="n"
+
+elif test -z $ax_cv_miniterm; then :
+
+    ax_cv_miniterm="n"
+
+fi
+miniterm=$ax_cv_miniterm
+
+# Check whether --enable-lomount was given.
+if test "${enable_lomount+set}" = set; then :
+  enableval=$enable_lomount;
+fi
+
+
+if test "x$enable_lomount" = "xyes"; then :
+
+    ax_cv_lomount="y"
+
+elif test "x$enable_lomount" = "xno"; then :
+
+    ax_cv_lomount="n"
+
+elif test -z $ax_cv_lomount; then :
+
+    ax_cv_lomount="n"
+
+fi
+lomount=$ax_cv_lomount
+
+# Check whether --enable-debug was given.
+if test "${enable_debug+set}" = set; then :
+  enableval=$enable_debug;
+fi
+
+
+if test "x$enable_debug" = "xno"; then :
+
+    ax_cv_debug="n"
+
+elif test "x$enable_debug" = "xyes"; then :
+
+    ax_cv_debug="y"
+
+elif test -z $ax_cv_debug; then :
+
+    ax_cv_debug="y"
+
+fi
+debug=$ax_cv_debug
+
+
+
+
+
+
+
+for cflag in $PREPEND_INCLUDES
+do
+    PREPEND_CFLAGS+=" -I$cflag"
+done
+for ldflag in $PREPEND_LIB
+do
+    PREPEND_LDFLAGS+=" -L$ldflag"
+done
+for cflag in $APPEND_INCLUDES
+do
+    APPEND_CFLAGS+=" -I$cflag"
+done
+for ldflag in $APPEND_LIB
+do
+    APPEND_LDFLAGS+=" -L$ldflag"
+done
+CFLAGS="$PREPEND_CFLAGS $CFLAGS $APPEND_CFLAGS"
+LDFLAGS="$PREPEND_LDFLAGS $LDFLAGS $APPEND_LDFLAGS"
+
+
+
+
+
+
+
+
+
+
+
+
+# Checks for programs.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if test "${ac_cv_path_SED+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+     for ac_i in 1 2 3 4 5 6 7; do
+       ac_script="$ac_script$as_nl$ac_script"
+     done
+     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+     { ac_script=; unset ac_script;}
+     if test -z "$SED"; then
+  ac_path_SED_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+# Check for GNU ac_path_SED and select it if it is found.
+  # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+  ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo '' >> "conftest.nl"
+    "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_SED_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_SED="$ac_path_SED"
+      ac_path_SED_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_SED_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_SED"; then
+    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+  fi
+else
+  ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+  rm -f conftest.sed
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5 ; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+else
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+	@echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  SET_MAKE=
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+  ./ | .// | /[cC]/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	  if test $ac_prog = install &&
+	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    rm -rf conftest.one conftest.two conftest.dir
+	    echo one > conftest.one
+	    echo two > conftest.two
+	    mkdir conftest.dir
+	    if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+	      test -s conftest.one && test -s conftest.two &&
+	      test -s conftest.dir/conftest.one &&
+	      test -s conftest.dir/conftest.two
+	    then
+	      ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	      break 3
+	    fi
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+
+  done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    INSTALL=$ac_install_sh
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+# Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PERL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PERL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_PERL" && ac_cv_path_PERL="no"
+  ;;
+esac
+fi
+PERL=$ac_cv_path_PERL
+if test -n "$PERL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
+$as_echo "$PERL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${PERL}" == x"no"
+then
+    as_fn_error $? "Unable to find perl, please install perl" "$LINENO" 5
+fi
+# Extract the first word of "brctl", so it can be a program name with args.
+set dummy brctl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_BRCTL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BRCTL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BRCTL="$BRCTL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_BRCTL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_BRCTL" && ac_cv_path_BRCTL="no"
+  ;;
+esac
+fi
+BRCTL=$ac_cv_path_BRCTL
+if test -n "$BRCTL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BRCTL" >&5
+$as_echo "$BRCTL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${BRCTL}" == x"no"
+then
+    as_fn_error $? "Unable to find brctl, please install brctl" "$LINENO" 5
+fi
+# Extract the first word of "ip", so it can be a program name with args.
+set dummy ip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_IP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $IP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_IP="$IP" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_IP="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_IP" && ac_cv_path_IP="no"
+  ;;
+esac
+fi
+IP=$ac_cv_path_IP
+if test -n "$IP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $IP" >&5
+$as_echo "$IP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${IP}" == x"no"
+then
+    as_fn_error $? "Unable to find ip, please install ip" "$LINENO" 5
+fi
+# Extract the first word of "bison", so it can be a program name with args.
+set dummy bison; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_BISON+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BISON in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BISON="$BISON" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_BISON="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_BISON" && ac_cv_path_BISON="no"
+  ;;
+esac
+fi
+BISON=$ac_cv_path_BISON
+if test -n "$BISON"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BISON" >&5
+$as_echo "$BISON" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${BISON}" == x"no"
+then
+    as_fn_error $? "Unable to find bison, please install bison" "$LINENO" 5
+fi
+# Extract the first word of "flex", so it can be a program name with args.
+set dummy flex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_FLEX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $FLEX in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_FLEX="$FLEX" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_FLEX="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_FLEX" && ac_cv_path_FLEX="no"
+  ;;
+esac
+fi
+FLEX=$ac_cv_path_FLEX
+if test -n "$FLEX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FLEX" >&5
+$as_echo "$FLEX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${FLEX}" == x"no"
+then
+    as_fn_error $? "Unable to find flex, please install flex" "$LINENO" 5
+fi
+if test "x$xapi" = "xy"; then :
+
+    # Extract the first word of "curl-config", so it can be a program name with args.
+set dummy curl-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_CURL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $CURL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CURL="$CURL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_CURL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_CURL" && ac_cv_path_CURL="no"
+  ;;
+esac
+fi
+CURL=$ac_cv_path_CURL
+if test -n "$CURL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CURL" >&5
+$as_echo "$CURL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${CURL}" == x"no"
+then
+    as_fn_error $? "Unable to find curl-config, please install curl-config" "$LINENO" 5
+fi
+    # Extract the first word of "xml2-config", so it can be a program name with args.
+set dummy xml2-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_XML+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $XML in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_XML="$XML" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_XML="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_XML" && ac_cv_path_XML="no"
+  ;;
+esac
+fi
+XML=$ac_cv_path_XML
+if test -n "$XML"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XML" >&5
+$as_echo "$XML" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${XML}" == x"no"
+then
+    as_fn_error $? "Unable to find xml2-config, please install xml2-config" "$LINENO" 5
+fi
+
+fi
+if test "x$ocamltools" = "xy"; then :
+
+      # checking for ocamlc
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OCAMLC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLC"; then
+  ac_cv_prog_OCAMLC="$OCAMLC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OCAMLC="${ac_tool_prefix}ocamlc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLC=$ac_cv_prog_OCAMLC
+if test -n "$OCAMLC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLC" >&5
+$as_echo "$OCAMLC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLC"; then
+  ac_ct_OCAMLC=$OCAMLC
+  # Extract the first word of "ocamlc", so it can be a program name with args.
+set dummy ocamlc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OCAMLC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLC"; then
+  ac_cv_prog_ac_ct_OCAMLC="$ac_ct_OCAMLC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OCAMLC="ocamlc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLC=$ac_cv_prog_ac_ct_OCAMLC
+if test -n "$ac_ct_OCAMLC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLC" >&5
+$as_echo "$ac_ct_OCAMLC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLC" = x; then
+    OCAMLC="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLC=$ac_ct_OCAMLC
+  fi
+else
+  OCAMLC="$ac_cv_prog_OCAMLC"
+fi
+
+
+  if test "$OCAMLC" != "no"; then
+     OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p'`
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: OCaml version is $OCAMLVERSION" >&5
+$as_echo "OCaml version is $OCAMLVERSION" >&6; }
+     # If OCAMLLIB is set, use it
+     if test "$OCAMLLIB" = ""; then
+        OCAMLLIB=`$OCAMLC -where 2>/dev/null || $OCAMLC -v|tail -1|cut -d ' ' -f 4`
+     else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: OCAMLLIB previously set; preserving it." >&5
+$as_echo "OCAMLLIB previously set; preserving it." >&6; }
+     fi
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: OCaml library path is $OCAMLLIB" >&5
+$as_echo "OCaml library path is $OCAMLLIB" >&6; }
+
+
+
+
+     # checking for ocamlopt
+     if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlopt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlopt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OCAMLOPT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLOPT"; then
+  ac_cv_prog_OCAMLOPT="$OCAMLOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OCAMLOPT="${ac_tool_prefix}ocamlopt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLOPT=$ac_cv_prog_OCAMLOPT
+if test -n "$OCAMLOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLOPT" >&5
+$as_echo "$OCAMLOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLOPT"; then
+  ac_ct_OCAMLOPT=$OCAMLOPT
+  # Extract the first word of "ocamlopt", so it can be a program name with args.
+set dummy ocamlopt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OCAMLOPT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLOPT"; then
+  ac_cv_prog_ac_ct_OCAMLOPT="$ac_ct_OCAMLOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OCAMLOPT="ocamlopt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLOPT=$ac_cv_prog_ac_ct_OCAMLOPT
+if test -n "$ac_ct_OCAMLOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLOPT" >&5
+$as_echo "$ac_ct_OCAMLOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLOPT" = x; then
+    OCAMLOPT="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLOPT=$ac_ct_OCAMLOPT
+  fi
+else
+  OCAMLOPT="$ac_cv_prog_OCAMLOPT"
+fi
+
+     OCAMLBEST=byte
+     if test "$OCAMLOPT" = "no"; then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find ocamlopt; bytecode compilation only." >&5
+$as_echo "$as_me: WARNING: Cannot find ocamlopt; bytecode compilation only." >&2;}
+     else
+	TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
+	if test "$TMPVERSION" != "$OCAMLVERSION" ; then
+	    { $as_echo "$as_me:${as_lineno-$LINENO}: result: versions differs from ocamlc; ocamlopt discarded." >&5
+$as_echo "versions differs from ocamlc; ocamlopt discarded." >&6; }
+	    OCAMLOPT=no
+	else
+	    OCAMLBEST=opt
+	fi
+     fi
+
+
+
+     # checking for ocamlc.opt
+     if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlc.opt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlc.opt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OCAMLCDOTOPT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLCDOTOPT"; then
+  ac_cv_prog_OCAMLCDOTOPT="$OCAMLCDOTOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OCAMLCDOTOPT="${ac_tool_prefix}ocamlc.opt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLCDOTOPT=$ac_cv_prog_OCAMLCDOTOPT
+if test -n "$OCAMLCDOTOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLCDOTOPT" >&5
+$as_echo "$OCAMLCDOTOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLCDOTOPT"; then
+  ac_ct_OCAMLCDOTOPT=$OCAMLCDOTOPT
+  # Extract the first word of "ocamlc.opt", so it can be a program name with args.
+set dummy ocamlc.opt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OCAMLCDOTOPT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLCDOTOPT"; then
+  ac_cv_prog_ac_ct_OCAMLCDOTOPT="$ac_ct_OCAMLCDOTOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OCAMLCDOTOPT="ocamlc.opt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLCDOTOPT=$ac_cv_prog_ac_ct_OCAMLCDOTOPT
+if test -n "$ac_ct_OCAMLCDOTOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLCDOTOPT" >&5
+$as_echo "$ac_ct_OCAMLCDOTOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLCDOTOPT" = x; then
+    OCAMLCDOTOPT="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLCDOTOPT=$ac_ct_OCAMLCDOTOPT
+  fi
+else
+  OCAMLCDOTOPT="$ac_cv_prog_OCAMLCDOTOPT"
+fi
+
+     if test "$OCAMLCDOTOPT" != "no"; then
+	TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
+	if test "$TMPVERSION" != "$OCAMLVERSION" ; then
+	    { $as_echo "$as_me:${as_lineno-$LINENO}: result: versions differs from ocamlc; ocamlc.opt discarded." >&5
+$as_echo "versions differs from ocamlc; ocamlc.opt discarded." >&6; }
+	else
+	    OCAMLC=$OCAMLCDOTOPT
+	fi
+     fi
+
+     # checking for ocamlopt.opt
+     if test "$OCAMLOPT" != "no" ; then
+	if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlopt.opt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlopt.opt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OCAMLOPTDOTOPT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLOPTDOTOPT"; then
+  ac_cv_prog_OCAMLOPTDOTOPT="$OCAMLOPTDOTOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OCAMLOPTDOTOPT="${ac_tool_prefix}ocamlopt.opt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLOPTDOTOPT=$ac_cv_prog_OCAMLOPTDOTOPT
+if test -n "$OCAMLOPTDOTOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLOPTDOTOPT" >&5
+$as_echo "$OCAMLOPTDOTOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLOPTDOTOPT"; then
+  ac_ct_OCAMLOPTDOTOPT=$OCAMLOPTDOTOPT
+  # Extract the first word of "ocamlopt.opt", so it can be a program name with args.
+set dummy ocamlopt.opt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OCAMLOPTDOTOPT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLOPTDOTOPT"; then
+  ac_cv_prog_ac_ct_OCAMLOPTDOTOPT="$ac_ct_OCAMLOPTDOTOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OCAMLOPTDOTOPT="ocamlopt.opt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLOPTDOTOPT=$ac_cv_prog_ac_ct_OCAMLOPTDOTOPT
+if test -n "$ac_ct_OCAMLOPTDOTOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLOPTDOTOPT" >&5
+$as_echo "$ac_ct_OCAMLOPTDOTOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLOPTDOTOPT" = x; then
+    OCAMLOPTDOTOPT="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLOPTDOTOPT=$ac_ct_OCAMLOPTDOTOPT
+  fi
+else
+  OCAMLOPTDOTOPT="$ac_cv_prog_OCAMLOPTDOTOPT"
+fi
+
+	if test "$OCAMLOPTDOTOPT" != "no"; then
+	   TMPVERSION=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
+	   if test "$TMPVERSION" != "$OCAMLVERSION" ; then
+	      { $as_echo "$as_me:${as_lineno-$LINENO}: result: version differs from ocamlc; ocamlopt.opt discarded." >&5
+$as_echo "version differs from ocamlc; ocamlopt.opt discarded." >&6; }
+	   else
+	      OCAMLOPT=$OCAMLOPTDOTOPT
+	   fi
+        fi
+     fi
+
+
+  fi
+
+
+
+  # checking for ocaml toplevel
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocaml", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocaml; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OCAML+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAML"; then
+  ac_cv_prog_OCAML="$OCAML" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OCAML="${ac_tool_prefix}ocaml"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAML=$ac_cv_prog_OCAML
+if test -n "$OCAML"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAML" >&5
+$as_echo "$OCAML" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAML"; then
+  ac_ct_OCAML=$OCAML
+  # Extract the first word of "ocaml", so it can be a program name with args.
+set dummy ocaml; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OCAML+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAML"; then
+  ac_cv_prog_ac_ct_OCAML="$ac_ct_OCAML" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OCAML="ocaml"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAML=$ac_cv_prog_ac_ct_OCAML
+if test -n "$ac_ct_OCAML"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAML" >&5
+$as_echo "$ac_ct_OCAML" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAML" = x; then
+    OCAML="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAML=$ac_ct_OCAML
+  fi
+else
+  OCAML="$ac_cv_prog_OCAML"
+fi
+
+
+  # checking for ocamldep
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamldep", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamldep; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OCAMLDEP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLDEP"; then
+  ac_cv_prog_OCAMLDEP="$OCAMLDEP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OCAMLDEP="${ac_tool_prefix}ocamldep"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLDEP=$ac_cv_prog_OCAMLDEP
+if test -n "$OCAMLDEP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLDEP" >&5
+$as_echo "$OCAMLDEP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLDEP"; then
+  ac_ct_OCAMLDEP=$OCAMLDEP
+  # Extract the first word of "ocamldep", so it can be a program name with args.
+set dummy ocamldep; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OCAMLDEP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLDEP"; then
+  ac_cv_prog_ac_ct_OCAMLDEP="$ac_ct_OCAMLDEP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OCAMLDEP="ocamldep"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLDEP=$ac_cv_prog_ac_ct_OCAMLDEP
+if test -n "$ac_ct_OCAMLDEP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLDEP" >&5
+$as_echo "$ac_ct_OCAMLDEP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLDEP" = x; then
+    OCAMLDEP="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLDEP=$ac_ct_OCAMLDEP
+  fi
+else
+  OCAMLDEP="$ac_cv_prog_OCAMLDEP"
+fi
+
+
+  # checking for ocamlmktop
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlmktop", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlmktop; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OCAMLMKTOP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLMKTOP"; then
+  ac_cv_prog_OCAMLMKTOP="$OCAMLMKTOP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OCAMLMKTOP="${ac_tool_prefix}ocamlmktop"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLMKTOP=$ac_cv_prog_OCAMLMKTOP
+if test -n "$OCAMLMKTOP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLMKTOP" >&5
+$as_echo "$OCAMLMKTOP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLMKTOP"; then
+  ac_ct_OCAMLMKTOP=$OCAMLMKTOP
+  # Extract the first word of "ocamlmktop", so it can be a program name with args.
+set dummy ocamlmktop; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OCAMLMKTOP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLMKTOP"; then
+  ac_cv_prog_ac_ct_OCAMLMKTOP="$ac_ct_OCAMLMKTOP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OCAMLMKTOP="ocamlmktop"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLMKTOP=$ac_cv_prog_ac_ct_OCAMLMKTOP
+if test -n "$ac_ct_OCAMLMKTOP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLMKTOP" >&5
+$as_echo "$ac_ct_OCAMLMKTOP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLMKTOP" = x; then
+    OCAMLMKTOP="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)


--===============6835735191746885487==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 05:44:30 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 05:44:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0RTg-0006VX-MS; Thu, 23 Feb 2012 05:44:28 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTd-0006Rm-Dr
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1329975808!53600419!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8876 invoked from network); 23 Feb 2012 05:43:29 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 05:43:29 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTN-00056p-4x
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0RTM-0000kK-U1
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 05:44:08 +0000
Message-Id: <E1S0RTM-0000kK-U1@xenbits.xen.org>
Date: Thu, 23 Feb 2012 05:44:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] build: add autoconf to replace
	custom checks in tools/check
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============6835735191746885487=="
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

--===============6835735191746885487==
Content-Type: text/plain

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1329875703 0
# Node ID a19c6d90fd41379dd2ac12576eb7b1bbe4b0444d
# Parent  6a34a42a2b5da33e7e5687b04dd88a4704155ec6
build: add autoconf to replace custom checks in tools/check

Added autotools magic to replace custom check scripts. The previous
checks have been ported to autoconf, and some additional ones have
been added (plus the suggestions from running autoscan). Two files are
created as a result from executing configure script, config/Tools.mk
and config.h.

conf/Tools.mk is included by tools/Rules.mk, and contains most of the
options previously defined in .config, that can now be set passing
parameters or defining environment variables when executing configure
script.

config.h is only used by libxl/xl to detect yajl_version.h.

[ tools/config.sub and config.guess copied from
  autotools-dev 20100122.1 from Debian squeeze i386,
  which is GPLv2.

  tools/configure generated using the included ./autogen.sh
  which ran autoconf 2.67-2 from Debian squeeze i386.  autoconf
  is GPLv3+ but has a special exception for the autoconf output;
  this exception applies to us and exempts us from complying
  with GPLv3+ for configure, which is good as Xen is GPL2 only.

  - Ian Jackson ]

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


diff -r 6a34a42a2b5d -r a19c6d90fd41 .hgignore
--- a/.hgignore	Tue Feb 21 18:01:04 2012 +0000
+++ b/.hgignore	Wed Feb 22 01:55:03 2012 +0000
@@ -303,6 +303,12 @@
 ^tools/ocaml/libs/xl/xenlight\.ml$
 ^tools/ocaml/libs/xl/xenlight\.mli$
 ^tools/ocaml/xenstored/oxenstored$
+^tools/autom4te\.cache$
+^tools/config\.h$
+^tools/config\.log$
+^tools/config\.status$
+^tools/config\.cache$
+^config/Tools\.mk$
 ^xen/\.banner.*$
 ^xen/BLOG$
 ^xen/System.map$
diff -r 6a34a42a2b5d -r a19c6d90fd41 Config.mk
--- a/Config.mk	Tue Feb 21 18:01:04 2012 +0000
+++ b/Config.mk	Wed Feb 22 01:55:03 2012 +0000
@@ -70,9 +70,6 @@
 EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBLEAFDIR)
 endif
 
-BISON	?= bison
-FLEX	?= flex
-
 PYTHON      ?= python
 PYTHON_PREFIX_ARG ?= --prefix="$(PREFIX)"
 # The above requires that PREFIX contains *no spaces*. This variable is here
@@ -175,32 +172,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
 
-CONFIG_LIBICONV   := $(shell export OS="`uname -s`"; \
-                       export CHECK_LIB="$(CHECK_LIB)"; \
-                       . $(XEN_ROOT)/tools/check/funcs.sh; \
-                       has_lib libiconv.so && echo 'y' || echo 'n')
-
-CONFIG_YAJL_VERSION := $(shell export OS="`uname -s`"; \
-                       export CHECK_INCLUDES="$(CHECK_INCLUDES)"; \
-                       . $(XEN_ROOT)/tools/check/funcs.sh; \
-                       has_header yajl/yajl_version.h && echo 'y' || echo 'n')
-
-# Enable XSM security module (by default, Flask).
-XSM_ENABLE ?= n
-FLASK_ENABLE ?= $(XSM_ENABLE)
-
-# Download GIT repositories via HTTP or GIT's own protocol?
-# GIT's protocol is faster and more robust, when it works at all (firewalls
-# may block it). We make it the default, but if your GIT repository downloads
-# fail or hang, please specify GIT_HTTP=y in your environment.
-GIT_HTTP ?= n
-
 XEN_EXTFILES_URL=http://xenbits.xensource.com/xen-extfiles
 # All the files at that location were downloaded from elsewhere on
 # the internet.  The original download URL is preserved as a comment
@@ -239,17 +213,4 @@
 # Short answer -- do not enable this unless you know what you are
 # doing and are prepared for some pain.
 
-# Optional components
-XENSTAT_XENTOP     ?= y
-VTPM_TOOLS         ?= n
-LIBXENAPI_BINDINGS ?= n
-PYTHON_TOOLS       ?= y
-OCAML_TOOLS        ?= y
-CONFIG_MINITERM    ?= n
-CONFIG_LOMOUNT     ?= n
-CONFIG_SYSTEM_LIBAIO ?= y
 CONFIG_TESTS       ?= y
-
-ifeq ($(OCAML_TOOLS),y)
-OCAML_TOOLS := $(shell ocamlopt -v > /dev/null 2>&1 && echo "y" || echo "n")
-endif
diff -r 6a34a42a2b5d -r a19c6d90fd41 Makefile
--- a/Makefile	Tue Feb 21 18:01:04 2012 +0000
+++ b/Makefile	Wed Feb 22 01:55:03 2012 +0000
@@ -40,11 +40,10 @@
 dist: dist-xen dist-kernels dist-tools dist-stubdom dist-docs dist-misc
 
 dist-misc:
-	$(INSTALL_DIR) $(DISTDIR)/check
+	$(INSTALL_DIR) $(DISTDIR)/
 	$(INSTALL_DATA) ./COPYING $(DISTDIR)
 	$(INSTALL_DATA) ./README $(DISTDIR)
 	$(INSTALL_PROG) ./install.sh $(DISTDIR)
-	$(INSTALL_PROG) tools/check/chk tools/check/check_* tools/check/funcs.sh $(DISTDIR)/check
 dist-%: DESTDIR=$(DISTDIR)/install
 dist-%: install-%
 	@: # do nothing
diff -r 6a34a42a2b5d -r a19c6d90fd41 README
--- a/README	Tue Feb 21 18:01:04 2012 +0000
+++ b/README	Wed Feb 22 01:55:03 2012 +0000
@@ -89,9 +89,13 @@
 3. For the very first build, or if you want to destroy build trees,
    perform the following steps:
 
+    # ./configure
     # make world
     # make install
 
+   If you want, you can run ./configure --help to see the list of
+   options available options when building and installing Xen.
+
    This will create and install onto the local machine. It will build
    the xen binary (xen.gz), the tools and the documentation.
 
diff -r 6a34a42a2b5d -r a19c6d90fd41 autogen.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/autogen.sh	Wed Feb 22 01:55:03 2012 +0000
@@ -0,0 +1,3 @@
+#!/bin/sh -e
+cd tools
+autoconf
diff -r 6a34a42a2b5d -r a19c6d90fd41 config/Tools.mk.in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/config/Tools.mk.in	Wed Feb 22 01:55:03 2012 +0000
@@ -0,0 +1,50 @@
+# Prefix and install folder
+PREFIX              := @prefix@
+LIBLEAFDIR_x86_64   := @LIB_PATH@
+
+# A debug build of tools?
+debug               := @debug@
+
+# Tools path
+BISON               := @BISON@
+FLEX                := @FLEX@
+PYTHON              := @PYTHON@
+PYTHON_PATH         := @PYTHONPATH@
+PERL                := @PERL@
+BRCTL               := @BRCTL@
+IP                  := @IP@
+CURL_CONFIG         := @CURL@
+XML2_CONFIG         := @XML@
+BASH                := @BASH@
+XGETTTEXT           := @XGETTEXT@
+
+# Extra folder for libs/includes
+PREPEND_INCLUDES    := @PREPEND_INCLUDES@
+PREPEND_LIB         := @PREPEND_LIB@
+APPEND_INCLUDES     := @APPEND_INCLUDES@
+APPEND_LIB          := @APPEND_LIB@
+
+# Enable XSM security module (by default, Flask).
+XSM_ENABLE          := @xsm@
+FLASK_ENABLE        := @xsm@
+
+# Download GIT repositories via HTTP or GIT's own protocol?
+# GIT's protocol is faster and more robust, when it works at all (firewalls
+# may block it). We make it the default, but if your GIT repository downloads
+# fail or hang, please specify GIT_HTTP=y in your environment.
+GIT_HTTP            := @githttp@
+
+# Optional components
+XENSTAT_XENTOP      := @monitors@
+VTPM_TOOLS          := @vtpm@
+LIBXENAPI_BINDINGS  := @xapi@
+PYTHON_TOOLS        := @pythontools@
+OCAML_TOOLS         := @ocamltools@
+CONFIG_MINITERM     := @miniterm@
+CONFIG_LOMOUNT      := @lomount@
+
+#System options
+CONFIG_SYSTEM_LIBAIO:= @system_aio@
+CONFIG_LIBICONV     := @libiconv@
+CONFIG_GCRYPT       := @libgcrypt@
+CONFIG_EXT2FS       := @libext2fs@
diff -r 6a34a42a2b5d -r a19c6d90fd41 configure
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configure	Wed Feb 22 01:55:03 2012 +0000
@@ -0,0 +1,2 @@
+#!/bin/sh -e
+cd tools && ./configure $@
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/Makefile
--- a/tools/Makefile	Tue Feb 21 18:01:04 2012 +0000
+++ b/tools/Makefile	Wed Feb 22 01:55:03 2012 +0000
@@ -6,7 +6,6 @@
 endif
 
 SUBDIRS-y :=
-SUBDIRS-y += check
 SUBDIRS-y += include
 SUBDIRS-y += libxc
 SUBDIRS-y += flask
@@ -79,6 +78,8 @@
 distclean: subdirs-distclean
 	rm -rf qemu-xen-traditional-dir qemu-xen-traditional-dir-remote
 	rm -rf qemu-xen-dir qemu-xen-dir-remote
+	rm -rf ../config/Tools.mk config.h config.log config.status \
+		config.cache autom4te.cache
 
 ifneq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
 IOEMU_CONFIGURE_CROSS ?= --cpu=$(XEN_TARGET_ARCH) \
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/Rules.mk
--- a/tools/Rules.mk	Tue Feb 21 18:01:04 2012 +0000
+++ b/tools/Rules.mk	Wed Feb 22 01:55:03 2012 +0000
@@ -4,6 +4,7 @@
 all:
 
 include $(XEN_ROOT)/Config.mk
+include $(XEN_ROOT)/config/Tools.mk
 
 export _INSTALL := $(INSTALL)
 INSTALL = $(XEN_ROOT)/tools/cross-install
@@ -80,8 +81,6 @@
                         "Xen requires at least gcc-3.4")
 $(eval $(check-y))
 
-_PYTHON_PATH := $(shell which $(PYTHON))
-PYTHON_PATH ?= $(_PYTHON_PATH)
 INSTALL_PYTHON_PROG = \
 	$(XEN_ROOT)/tools/python/install-wrap "$(PYTHON_PATH)" $(INSTALL_PROG)
 
@@ -109,3 +108,7 @@
 
 subdir-distclean-%: .phony
 	$(MAKE) -C $* clean
+
+$(XEN_ROOT)/config/Tools.mk:
+	@echo "You have to run ./configure before building or installing the tools"
+	@exit 1
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/blktap/drivers/Makefile
--- a/tools/blktap/drivers/Makefile	Tue Feb 21 18:01:04 2012 +0000
+++ b/tools/blktap/drivers/Makefile	Wed Feb 22 01:55:03 2012 +0000
@@ -13,7 +13,7 @@
 CFLAGS   += -I $(MEMSHR_DIR)
 CFLAGS   += -D_GNU_SOURCE
 
-ifeq ($(shell . ./check_gcrypt $(CC)),yes)
+ifeq ($CONFIG_GCRYPT,y)
 CFLAGS += -DUSE_GCRYPT
 CRYPT_LIB := -lgcrypt
 else
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/blktap/drivers/check_gcrypt
--- a/tools/blktap/drivers/check_gcrypt	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-cat > .gcrypt.c << EOF
-#include <gcrypt.h>
-int main(void) { return 0; }
-EOF
-
-if $1 -o .gcrypt .gcrypt.c -lgcrypt 2>/dev/null ; then
-  echo "yes"
-else
-  echo "no"
-fi
-
-rm -f .gcrypt*
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/Makefile
--- a/tools/check/Makefile	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-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
-export CONFIG_SYSTEM_LIBAIO
-
-.PHONY: all install
-all install: check-build
-
-# Check this machine is OK for building on.
-.PHONY: check-build
-check-build:
-	./chk build
-
-# Check this machine is OK for installing on.
-.PHONY: check-install
-check-install:
-	./chk install
-
-.PHONY: clean
-clean:
-	./chk clean
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/README
--- a/tools/check/README	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-Checks for the suitability of a machine for Xen build or install.
-To check for build suitability use
-
-        ./chk build
-
-To check for install suitability use
-
-        ./chk install
-
-The chk script will run checks in this directory and print
-the ones that failed. It prints nothing if checks succeed.
-The chk script exits with 0 on success and 1 on failure.
-
-The chk script runs executable files in this directory whose
-names begin with 'check_'. Files containing CHECK-BUILD
-are run for the build check, and files containing CHECK-INSTALL
-are run for the install check.
-
-Detailed output from the check scripts is in .chkbuild for build
-and .chkinstall for install.
\ No newline at end of file
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_brctl
--- a/tools/check/check_brctl	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-#!/bin/sh
-# CHECK-INSTALL
-
-. ./funcs.sh
-
-case $OS in
-OpenBSD|NetBSD|FreeBSD)
-	has_or_fail brconfig ;;
-Linux)
-	has_or_fail brctl ;;
-*)
-	fail "unknown OS" ;;
-esac
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_crypto_lib
--- a/tools/check/check_crypto_lib	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD CHECK-INSTALL
-
-. ./funcs.sh
-
-case $OS in
-FreeBSD|NetBSD|OpenBSD)
-	exit 0 ;;
-esac
-
-has_lib libcrypto.so || fail "missing libcrypto.so"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_curl
--- a/tools/check/check_curl	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD CHECK-INSTALL
-
-. ./funcs.sh
-
-if [ "$LIBXENAPI_BINDINGS" != "y" ]; then
-	echo -n "unused, "
-	exit 0
-fi
-
-has_or_fail curl-config
-curl_libs=`curl-config --libs` || fail "curl-config --libs failed"
-test_link $curl_libs || fail "dependency libraries for curl are missing"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_iproute
--- a/tools/check/check_iproute	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-#!/bin/sh
-# CHECK-INSTALL
-
-. ./funcs.sh
-
-PATH=/sbin:$PATH
-
-case $OS in
-OpenBSD|NetBSD|FreeBSD)
-	has_or_fail ifconfig ;;
-Linux)
-	has_or_fail ip ;;
-*)
-	fail "unknown OS" ;;
-esac
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_libaio_devel
--- a/tools/check/check_libaio_devel	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD
-
-. ./funcs.sh
-
-if [ X${CONFIG_SYSTEM_LIBAIO} != X"y" ] ; then
-    exit 0
-fi
-if ! has_header libaio.h ; then
-    fail "can't find libaio headers, install libaio devel package or set CONFIG_SYSTEM_LIBAIO=n"
-fi
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_libaio_lib
--- a/tools/check/check_libaio_lib	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD CHECK-INSTALL
-
-. ./funcs.sh
-
-if [ X${CONFIG_SYSTEM_LIBAIO} != X"y" ] ; then
-    exit 0
-fi
-has_lib libaio.so || fail "can't find libaio"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_openssl_devel
--- a/tools/check/check_openssl_devel	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD
-
-. ./funcs.sh
-
-has_header openssl/md5.h || fail "missing openssl headers"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_python
--- a/tools/check/check_python	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD CHECK-INSTALL
-
-. ./funcs.sh
-
-if test -z ${PYTHON}; then
-  PYTHON=python
-fi
-
-${PYTHON} -c '
-import sys
-sys.exit(sys.version_info[0] < 2 or sys.version_info[1] < 3)
-' || fail "need python version >= 2.3"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_python_devel
--- a/tools/check/check_python_devel	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD
-
-. ./funcs.sh
-
-if test -z ${PYTHON}; then
-  PYTHON=python
-fi
-has_or_fail ${PYTHON}
-
-${PYTHON} -c '
-import os.path, sys
-for p in sys.path:
-	if os.path.exists(p + "/config/Makefile"):
-		sys.exit(0)
-sys.exit(1)
-' || fail "can't find python devel files"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_python_xml
--- a/tools/check/check_python_xml	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-#!/bin/sh
-# CHECK-INSTALL
-
-. ./funcs.sh
-
-if test -z ${PYTHON}; then
-  PYTHON=python
-fi
-has_or_fail ${PYTHON}
-
-${PYTHON} -c 'import xml.dom.minidom' 2>/dev/null || \
-fail "can't import xml.dom.minidom"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_udev
--- a/tools/check/check_udev	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-#!/bin/sh
-# CHECK-INSTALL
-
-. ./funcs.sh
-
-case $OS in
-OpenBSD|NetBSD|FreeBSD)
-	has_or_fail vnconfig
-	;;
-Linux)
-	has /sbin/udevadm && \
-		udevver=`/sbin/udevadm info -V | awk '{print $NF}'`
-	[ -z "$udevver" ] && has_or_fail udevinfo && \
-		udevver=`udevinfo -V | awk '{print $NF}'`
-	[ "$udevver" -ge 59 ] 2>/dev/null || \
-		has hotplug || \
-		fail "udev is too old, upgrade to version 59 or later"
-	;;
-*)
-	fail "unknown OS"
-	;;
-esac
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_uuid_devel
--- a/tools/check/check_uuid_devel	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD
-
-. ./funcs.sh
-
-has_header uuid.h || \
-has_header uuid/uuid.h || fail "missing uuid headers (package uuid-dev)"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_x11_devel
--- a/tools/check/check_x11_devel	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD
-
-. ./funcs.sh
-
-has_header X11/keysymdef.h || \
-has_header /usr/X11R6/include/X11/keysymdef.h || \
-has_header /usr/X11R7/include/X11/keysymdef.h || \
-warning "can't find X11 headers"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_xgettext
--- a/tools/check/check_xgettext	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD
-
-. ./funcs.sh
-
-has_or_fail xgettext
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_xml2
--- a/tools/check/check_xml2	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD CHECK-INSTALL
-
-. ./funcs.sh
-
-if [ ! "$LIBXENAPI_BINDINGS" = "y" ]
-then
-    echo -n "unused, "
-    exit 0
-fi
-
-has_or_fail xml2-config
-xml2_libs=`xml2-config --libs` || fail "xml2-config --libs failed"
-test_link $xml2_libs || fail "dependency libraries for xml2 are missing"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_yajl_devel
--- a/tools/check/check_yajl_devel	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD
-
-. ./funcs.sh
-
-has_header yajl/yajl_parse.h || fail "can't find yajl/yajl_parse.h"
-has_header yajl/yajl_gen.h || fail "can't find yajl/yajl_gen.h"
-has_lib libyajl.so || fail "can't find libyajl.so"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_zlib_devel
--- a/tools/check/check_zlib_devel	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD
-
-. ./funcs.sh
-
-has_header zlib.h || fail "can't find zlib headers"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/check_zlib_lib
--- a/tools/check/check_zlib_lib	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-#!/bin/sh
-# CHECK-BUILD CHECK-INSTALL
-
-. ./funcs.sh
-
-case $OS in
-FreeBSD|NetBSD|OpenBSD)
-	exit 0
-	;;
-esac
-
-has_lib libz.so || fail "can't find zlib"
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/chk
--- a/tools/check/chk	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-#!/bin/sh
-
-func_usage ()
-{
-    echo "Usage:"
-    echo "	$0 [build|install|clean]"
-    echo
-    echo "Check suitability for Xen build or install."
-    echo "Exit with 0 if OK, 1 if not."
-    echo
-    echo "Calling with 'clean' removes generated files."
-    exit 1
-}
-
-PATH=$PATH:/sbin:/usr/sbin
-OS=`uname -s`
-export PATH OS
-
-if [ "$OS" = "SunOS" ]; then
-	exit 0
-fi
-
-case $1 in
-    build)
-        check="CHECK-BUILD"
-        ;;
-    install)
-        check="CHECK-INSTALL"
-        ;;
-    clean)
-        exit 0
-        ;;
-    *)
-        func_usage
-        ;;
-esac
-
-failed=0
-
-echo "Xen ${check} " `date`
-for f in check_* ; do
-    case $f in
-        *~)
-            continue
-            ;;
-        *)
-            ;;
-    esac
-    if ! [ -x $f ] ; then
-        continue
-    fi
-    if ! grep -Fq "$check" $f ; then
-        continue
-    fi
-    echo -n "Checking $f: "
-    if ./$f 2>&1 ; then
-        echo OK
-    else
-        failed=1
-    fi
-done
-
-exit ${failed}
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/check/funcs.sh
--- a/tools/check/funcs.sh	Tue Feb 21 18:01:04 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-# has is the same as which, except it handles cross environments
-has() {
-	if [ -z "$CROSS_COMPILE" ]; then
-		command which "$@"
-		return $?
-	fi
-
-	check_sys_root || return 1
-
-	# subshell to prevent pollution of caller's IFS
-	(
-	IFS=:
-	for p in $PATH; do
-		if [ -x "$CROSS_SYS_ROOT/$p/$1" ]; then
-			echo "$CROSS_SYS_ROOT/$p/$1"
-			return 0
-		fi
-	done
-	return 1
-	)
-}
-
-has_or_fail() {
-	has "$1" >/dev/null || fail "can't find $1"
-}
-
-has_header() {
-	check_sys_root || return 1
-
-	case $1 in
-		/*) ;;
-		*)
-		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
-
-	return 1
-}
-
-has_lib() {
-	check_sys_root || return 1
-
-	# 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.
-	if [ "$OS" = Linux -a ! -f "$CROSS_SYS_ROOT/etc/ld.so.cache" ]; then
-	    echo "Please run ldconfig -r \"$CROSS_SYS_ROOT\" to generate ld.so.cache"
-	    # fall through; ldconfig test below should fail
-	fi
-	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
-	)
-}
-
-test_link() {
-	# subshell to trap removal of tmpfile
-	(
-	unset tmpfile
-	trap 'rm -f "$tmpfile"; exit' 0 1 2 15
-	tmpfile=`mktemp` || return 1
-	ld "$@" -o "$tmpfile" >/dev/null 2>&1
-	return $?
-	)
-}
-
-# this function is used commonly above
-check_sys_root() {
-	[ -z "$CROSS_COMPILE" ] && return 0
-	if [ -z "$CROSS_SYS_ROOT" ]; then
-		echo "please set CROSS_SYS_ROOT in the environment"
-		return 1
-	fi
-	if [ ! -d "$CROSS_SYS_ROOT" ]; then
-		echo "no sys-root found at $CROSS_SYS_ROOT"
-		return 1
-	fi
-}
-
-warning() {
-	echo
-	echo " *** `basename "$0"` FAILED${*+: $*}"
-}
-
-fail() {
-	echo
-	echo " *** `basename "$0"` FAILED${*+: $*}"
-	exit 1
-}
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/config.guess
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/config.guess	Wed Feb 22 01:55:03 2012 +0000
@@ -0,0 +1,1502 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+#   Free Software Foundation, Inc.
+
+timestamp='2009-12-30'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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
+# 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., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner.  Please send patches (context
+# diff format) to <config-patches@gnu.org> and include a ChangeLog
+# entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
+Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    sh5el) machine=sh5le-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep -q __ELF__
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+	        os=netbsd
+		;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+		;;
+	    *)
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit ;;
+    *:OpenBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	exit ;;
+    *:ekkoBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	exit ;;
+    *:SolidBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	exit ;;
+    macppc:MirBSD:*:*)
+	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    *:MirBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    alpha:OSF1:*:*)
+	case $UNAME_RELEASE in
+	*4.0)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+		;;
+	*5.*)
+	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		;;
+	esac
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE="alphaev5" ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE="alphaev56" ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE="alphapca56" ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE="alphapca57" ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE="alphaev6" ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE="alphaev67" ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE="alphaev69" ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE="alphaev7" ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE="alphaev79" ;;
+	esac
+	# A Pn.n version is a patched version.
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-unknown-sysv4
+	exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit ;;
+    *:z/VM:*:*)
+	echo s390-ibm-zvmoe
+	exit ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+	exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+	echo arm-unknown-riscos
+	exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7; exit ;;
+	esac ;;
+    s390x:SunOS:*:*)
+	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+	echo i386-pc-auroraux${UNAME_RELEASE}
+	exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+	eval $set_cc_for_build
+	SUN_ARCH="i386"
+	# If there is a compiler, see if it is configured for 64-bit objects.
+	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+	# This test works for both compilers.
+	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		grep IS_64BIT_ARCH >/dev/null
+	    then
+		SUN_ARCH="x86_64"
+	    fi
+	fi
+	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+        exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit ;;
+    m68k:machten:*:*)
+	echo m68k-apple-machten${UNAME_RELEASE}
+	exit ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c &&
+	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	    { echo "$SYSTEM_NAME"; exit; }
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+ 	exit ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		then
+			echo "$SYSTEM_NAME"
+		else
+			echo rs6000-ibm-aix3.2.5
+		fi
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit ;;
+    *:AIX:*:[456])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+              	{
+              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+              	case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+              	    switch (bits)
+              		{
+              		case 64: puts ("hppa2.0w"); break;
+              		case 32: puts ("hppa2.0n"); break;
+              		default: puts ("hppa2.0"); break;
+              		} break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+              	    puts ("hppa2.0"); break;
+              #endif
+              	default: puts ("hppa1.0"); break;
+              	}
+                  exit (0);
+              }
+EOF
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    test -z "$HP_ARCH" && HP_ARCH=hppa
+		fi ;;
+	esac
+	if [ ${HP_ARCH} = "hppa2.0w" ]
+	then
+	    eval $set_cc_for_build
+
+	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+	    # generating 64-bit code.  GNU and HP use different nomenclature:
+	    #
+	    # $ CC_FOR_BUILD=cc ./config.guess
+	    # => hppa2.0w-hp-hpux11.23
+	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+	    # => hppa64-hp-hpux11.23
+
+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+		grep -q __LP64__
+	    then
+		HP_ARCH="hppa2.0w"
+	    else
+		HP_ARCH="hppa64"
+	    fi
+	fi
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <unistd.h>
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+		{ echo "$SYSTEM_NAME"; exit; }
+	echo unknown-hitachi-hiuxwe2
+	exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+        exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+        exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+        exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+        exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+        exit ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    *:UNICOS/mp:*:*)
+	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:FreeBSD:*:*)
+	case ${UNAME_MACHINE} in
+	    pc98)
+		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    amd64)
+		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    *)
+		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	esac
+	exit ;;
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
+	exit ;;
+    *:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit ;;
+    i*:windows32*:*)
+    	# uname -m includes "-pc" on this system.
+    	echo ${UNAME_MACHINE}-mingw32
+	exit ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit ;;
+    *:Interix*:*)
+    	case ${UNAME_MACHINE} in
+	    x86)
+		echo i586-pc-interix${UNAME_RELEASE}
+		exit ;;
+	    authenticamd | genuineintel | EM64T)
+		echo x86_64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	    IA64)
+		echo ia64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	esac ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+	echo i${UNAME_MACHINE}-pc-mks
+	exit ;;
+    8664:Windows_NT:*)
+	echo x86_64-pc-mks
+	exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i586-pc-interix
+	exit ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+	echo x86_64-unknown-cygwin
+	exit ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    *:GNU:*:*)
+	# the GNU system
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit ;;
+    *:GNU/*:*:*)
+	# other systems with GNU libc and userland
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	exit ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep -q ld.so.1
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit ;;
+    arm*:Linux:*:*)
+	eval $set_cc_for_build
+	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+	    | grep -q __ARM_EABI__
+	then
+	    echo ${UNAME_MACHINE}-unknown-linux-gnu
+	else
+	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+	fi
+	exit ;;
+    avr32*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    cris:Linux:*:*)
+	echo cris-axis-linux-gnu
+	exit ;;
+    crisv32:Linux:*:*)
+	echo crisv32-axis-linux-gnu
+	exit ;;
+    frv:Linux:*:*)
+    	echo frv-unknown-linux-gnu
+	exit ;;
+    i*86:Linux:*:*)
+	LIBC=gnu
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+	exit ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m32r*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    mips:Linux:*:* | mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef ${UNAME_MACHINE}
+	#undef ${UNAME_MACHINE}el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=${UNAME_MACHINE}el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=${UNAME_MACHINE}
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    or32:Linux:*:*)
+	echo or32-unknown-linux-gnu
+	exit ;;
+    padre:Linux:*:*)
+	echo sparc-unknown-linux-gnu
+	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
+	esac
+	exit ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit ;;
+    sh64*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    vax:Linux:*:*)
+	echo ${UNAME_MACHINE}-dec-linux-gnu
+	exit ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-gnu
+	exit ;;
+    xtensa*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit ;;
+    i*86:syllable:*:*)
+	echo ${UNAME_MACHINE}-pc-syllable
+	exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit ;;
+    i*86:*:5:[678]*)
+    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i586.
+	# Note: whatever this is, it MUST be the same as what config.sub
+	# prints for the "djgpp" host, or else GDB configury will decide that
+	# this is a cross-build.
+	echo i586-pc-msdosdjgpp
+        exit ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit ;;
+    M68*:*:R3V[5678]*:*)
+	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && { echo i486-ncr-sysv4; exit; } ;;
+    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+	OS_REL='.3'
+	test -r /etc/.relid \
+	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel@ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes <hewes@openmarket.com>.
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit ;;
+    *:*:*:FTX*)
+	# From seanf@swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit ;;
+    i*86:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo ${UNAME_MACHINE}-stratus-vos
+	exit ;;
+    *:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo hppa1.1-stratus-vos
+	exit ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+	        echo mips-nec-sysv${UNAME_RELEASE}
+	else
+	        echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+        exit ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit ;;
+    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
+	echo i586-pc-haiku
+	exit ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-7:SUPER-UX:*:*)
+	echo sx7-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8:SUPER-UX:*:*)
+	echo sx8-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8R:SUPER-UX:*:*)
+	echo sx8r-nec-superux${UNAME_RELEASE}
+	exit ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Darwin:*:*)
+	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+	case $UNAME_PROCESSOR in
+	    i386)
+		eval $set_cc_for_build
+		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		      grep IS_64BIT_ARCH >/dev/null
+		  then
+		      UNAME_PROCESSOR="x86_64"
+		  fi
+		fi ;;
+	    unknown) UNAME_PROCESSOR=powerpc ;;
+	esac
+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+	echo nse-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+	exit ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit ;;
+    *:*VMS:*:*)
+    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	case "${UNAME_MACHINE}" in
+	    A*) echo alpha-dec-vms ; exit ;;
+	    I*) echo ia64-dec-vms ; exit ;;
+	    V*) echo vax-dec-vms ; exit ;;
+	esac ;;
+    *:XENIX:*:SysV)
+	echo i386-pc-xenix
+	exit ;;
+    i*86:skyos:*:*)
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	exit ;;
+    i*86:rdos:*:*)
+	echo ${UNAME_MACHINE}-pc-rdos
+	exit ;;
+    i*86:AROS:*:*)
+	echo ${UNAME_MACHINE}-pc-aros
+	exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+	  ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+	printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+	printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+	{ echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+	echo c1-convex-bsd
+	exit ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit ;;
+    c34*)
+	echo c34-convex-bsd
+	exit ;;
+    c38*)
+	echo c38-convex-bsd
+	exit ;;
+    c4*)
+	echo c4-convex-bsd
+	exit ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+and
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/config.h.in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/config.h.in	Wed Feb 22 01:55:03 2012 +0000
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2012
+ *
+ * This program 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; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program 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.
+ */
+
+/* Define to 1 if you have the <yajl/yajl_version.h> header file. */
+#undef HAVE_YAJL_YAJL_VERSION_H
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/config.sub
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/config.sub	Wed Feb 22 01:55:03 2012 +0000
@@ -0,0 +1,1714 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+#   Free Software Foundation, Inc.
+
+timestamp='2010-01-22'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 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., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted GNU ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
+Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  kopensolaris*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+	-sun*os*)
+		# Prevent following clause from handling this invalid input.
+		;;
+	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+	-apple | -axis | -knuth | -cray | -microblaze)
+		os=
+		basic_machine=$1
+		;;
+        -bluegene*)
+	        os=-cnk
+		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+ 	-chorusrdb)
+ 		os=-chorusrdb
+		basic_machine=$1
+ 		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco6)
+		os=-sco5v6
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5)
+		os=-sco3.2v5
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5v6*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-lynx*)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+	-psos*)
+		os=-psos
+		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+	# Recognize the basic CPU types without company name.
+	# Some are omitted here because they have special meanings below.
+	1750a | 580 \
+	| a29k \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| am33_2.0 \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+	| bfin \
+	| c4x | clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| fido | fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| i370 | i860 | i960 | ia64 \
+	| ip2k | iq2000 \
+	| lm32 \
+	| m32c | m32r | m32rle | m68000 | m68k | m88k \
+	| maxq | mb | microblaze | mcore | mep | metag \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64octeon | mips64octeonel \
+	| mips64orion | mips64orionel \
+	| mips64r5900 | mips64r5900el \
+	| mips64vr | mips64vrel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mips64vr5900 | mips64vr5900el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa32r2 | mipsisa32r2el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64r2 | mipsisa64r2el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| moxie \
+	| mt \
+	| msp430 \
+	| nios | nios2 \
+	| ns16k | ns32k \
+	| or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| pyramid \
+	| rx \
+	| score \
+	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+	| spu | strongarm \
+	| tahoe | thumb | tic4x | tic80 | tron \
+	| ubicom32 \
+	| v850 | v850e \
+	| we32k \
+	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| z8k | z80)
+		basic_machine=$basic_machine-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
+		# Motorola 68HC11/12.
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+	ms1)
+		basic_machine=mt-unknown
+		;;
+
+	# We use `pc' rather than `unknown'
+	# because (1) that's what they normally are, and
+	# (2) the word "unknown" tends to confuse beginning users.
+	i*86 | x86_64)
+	  basic_machine=$basic_machine-pc
+	  ;;
+	# Object if more than one company name word.
+	*-*-*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+	# Recognize the basic CPU types with company name.
+	580-* \
+	| a29k-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* | avr32-* \
+	| bfin-* | bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+	| clipper-* | craynv-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* | iq2000-* \
+	| lm32-* \
+	| m32c-* | m32r-* | m32rle-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64octeon-* | mips64octeonel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64r5900-* | mips64r5900el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mips64vr5900-* | mips64vr5900el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa32r2-* | mipsisa32r2el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64r2-* | mipsisa64r2el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipstx39-* | mipstx39el-* \
+	| mmix-* \
+	| mt-* \
+	| msp430-* \
+	| nios-* | nios2-* \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| pyramid-* \
+	| romp-* | rs6000-* | rx-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+	| sparclite-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tile-* | tilegx-* \
+	| tron-* \
+	| ubicom32-* \
+	| v850-* | v850e-* | vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| xstormy16-* | xtensa*-* \
+	| ymp-* \
+	| z8k-* | z80-*)
+		;;
+	# Recognize the basic CPU types without company name, with glob match.
+	xtensa*)
+		basic_machine=$basic_machine-unknown
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+    	abacus)
+		basic_machine=abacus-unknown
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amd64)
+		basic_machine=x86_64-pc
+		;;
+	amd64-*)
+		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-unknown
+		;;
+	amigaos | amigados)
+		basic_machine=m68k-unknown
+		os=-amigaos
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-unknown
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
+	aros)
+		basic_machine=i386-pc
+		os=-aros
+		;;
+	aux)
+		basic_machine=m68k-apple
+		os=-aux
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	blackfin)
+		basic_machine=bfin-unknown
+		os=-linux
+		;;
+	blackfin-*)
+		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	bluegene*)
+		basic_machine=powerpc-ibm
+		os=-cnk
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+        cegcc)
+		basic_machine=arm-unknown
+		os=-cegcc
+		;;
+	convex-c1)
+		basic_machine=c1-convex
+		os=-bsd
+		;;
+	convex-c2)
+		basic_machine=c2-convex
+		os=-bsd
+		;;
+	convex-c32)
+		basic_machine=c32-convex
+		os=-bsd
+		;;
+	convex-c34)
+		basic_machine=c34-convex
+		os=-bsd
+		;;
+	convex-c38)
+		basic_machine=c38-convex
+		os=-bsd
+		;;
+	cray | j90)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	craynv)
+		basic_machine=craynv-cray
+		os=-unicosmp
+		;;
+	cr16)
+		basic_machine=cr16-unknown
+		os=-elf
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	crisv32 | crisv32-* | etraxfs*)
+		basic_machine=crisv32-axis
+		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
+	crx)
+		basic_machine=crx-unknown
+		os=-elf
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	dicos)
+		basic_machine=i686-pc
+		os=-dicos
+		;;
+	djgpp)
+		basic_machine=i586-pc
+		os=-msdosdjgpp
+		;;
+	dpx20 | dpx20-*)
+		basic_machine=rs6000-bull
+		os=-bosx
+		;;
+	dpx2* | dpx2*-bull)
+		basic_machine=m68k-bull
+		os=-sysv3
+		;;
+	ebmon29k)
+		basic_machine=a29k-amd
+		os=-ebmon
+		;;
+	elxsi)
+		basic_machine=elxsi-elxsi
+		os=-bsd
+		;;
+	encore | umax | mmax)
+		basic_machine=ns32k-encore
+		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-hitachi
+		os=-hms
+		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
+	harris)
+		basic_machine=m88k-harris
+		os=-sysv3
+		;;
+	hp300-*)
+		basic_machine=m68k-hp
+		;;
+	hp300bsd)
+		basic_machine=m68k-hp
+		os=-bsd
+		;;
+	hp300hpux)
+		basic_machine=m68k-hp
+		os=-hpux
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hppa-next)
+		os=-nextstep3
+		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+	i*86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv32
+		;;
+	i*86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i*86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i*86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	m68knommu)
+		basic_machine=m68k-unknown
+		os=-linux
+		;;
+	m68knommu-*)
+		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+        microblaze)
+		basic_machine=microblaze-xilinx
+		;;
+	mingw32)
+		basic_machine=i386-pc
+		os=-mingw32
+		;;
+	mingw32ce)
+		basic_machine=arm-unknown
+		os=-mingw32ce
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
+	msdos)
+		basic_machine=i386-pc
+		os=-msdos
+		;;
+	ms1-*)
+		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-rebel
+		os=-linux
+		;;
+	news | news700 | news800 | news900)
+		basic_machine=m68k-sony
+		os=-newsos
+		;;
+	news1000)
+		basic_machine=m68030-sony
+		os=-newsos
+		;;
+	news-3600 | risc-news)
+		basic_machine=mips-sony
+		os=-newsos
+		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
+	next | m*-next )
+		basic_machine=m68k-next
+		case $os in
+		    -nextstep* )
+			;;
+		    -ns2*)
+		      os=-nextstep2
+			;;
+		    *)
+		      os=-nextstep3
+			;;
+		esac
+		;;
+	nh3000)
+		basic_machine=m68k-harris
+		os=-cxux
+		;;
+	nh[45]000)
+		basic_machine=m88k-harris
+		os=-cxux
+		;;
+	nindy960)
+		basic_machine=i960-intel
+		os=-nindy
+		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	openrisc | openrisc-*)
+		basic_machine=or32-unknown
+		;;
+	os400)
+		basic_machine=powerpc-ibm
+		os=-os400
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	parisc)
+		basic_machine=hppa-unknown
+		os=-linux
+		;;
+	parisc-*)
+		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+	pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pc98)
+		basic_machine=i386-pc
+		;;
+	pc98-*)
+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
+		basic_machine=i586-pc
+		;;
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+		basic_machine=i686-pc
+		;;
+	pentiumii | pentium2 | pentiumiii | pentium3)
+		basic_machine=i686-pc
+		;;
+	pentium4)
+		basic_machine=i786-pc
+		;;
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium4-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	power)	basic_machine=power-ibm
+		;;
+	ppc)	basic_machine=powerpc-unknown
+		;;
+	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppcle | powerpclittle | ppc-le | powerpc-little)
+		basic_machine=powerpcle-unknown
+		;;
+	ppcle-* | powerpclittle-*)
+		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rdos)
+		basic_machine=i386-pc
+		os=-rdos
+		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	rm[46]00)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sde)
+		basic_machine=mipsisa32-sde
+		os=-elf
+		;;
+	sei)
+		basic_machine=mips-sei
+		os=-seiux
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sh5el)
+		basic_machine=sh5le-unknown
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparclite-wrs | simso-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
+	sun2)
+		basic_machine=m68000-sun
+		;;
+	sun2os3)
+		basic_machine=m68000-sun
+		os=-sunos3
+		;;
+	sun2os4)
+		basic_machine=m68000-sun
+		os=-sunos4
+		;;
+	sun3os3)
+		basic_machine=m68k-sun
+		os=-sunos3
+		;;
+	sun3os4)
+		basic_machine=m68k-sun
+		os=-sunos4
+		;;
+	sun4os3)
+		basic_machine=sparc-sun
+		os=-sunos3
+		;;
+	sun4os4)
+		basic_machine=sparc-sun
+		os=-sunos4
+		;;
+	sun4sol2)
+		basic_machine=sparc-sun
+		os=-solaris2
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t3e)
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+	tic54x | c54x*)
+		basic_machine=tic54x-unknown
+		os=-coff
+		;;
+	tic55x | c55x*)
+		basic_machine=tic55x-unknown
+		os=-coff
+		;;
+	tic6x | c6x*)
+		basic_machine=tic6x-unknown
+		os=-coff
+		;;
+        # This must be matched before tile*.
+        tilegx*)
+		basic_machine=tilegx-unknown
+		os=-linux-gnu
+		;;
+	tile*)
+		basic_machine=tile-unknown
+		os=-linux-gnu
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	tpf)
+		basic_machine=s390x-ibm
+		os=-tpf
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vpp*|vx|vx-*)
+		basic_machine=f301-fujitsu
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	vxworks29k)
+		basic_machine=a29k-wrs
+		os=-vxworks
+		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	xbox)
+		basic_machine=i686-pc
+		os=-mingw32
+		;;
+	xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
+	z80-*-coff)
+		basic_machine=z80-unknown
+		os=-sim
+		;;
+	none)
+		basic_machine=none-none
+		os=-none
+		;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	mmix)
+		basic_machine=mmix-knuth
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+		basic_machine=sh-unknown
+		;;
+	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+		basic_machine=sparc-sun
+		;;
+	cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
+	*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+	*-digital*)
+		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		;;
+	*-commodore*)
+		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+	# -solaris* is a basic system type, with this one exception.
+        -auroraux)
+	        os=-auroraux
+		;;
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-svr4*)
+		os=-sysv4
+		;;
+	-unixware*)
+		os=-sysv4.2uw
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+		;;
+	# First accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST END IN A *, to match a version number.
+	# -sysv* is not here because it comes later, after sysvr4.
+	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+	      | -sym* | -kopensolaris* \
+	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+	      | -aos* | -aros* \
+	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -openbsd* | -solidbsd* \
+	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* | -cegcc* \
+	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
+	# Remember, each alternative MUST END IN *, to match a version number.
+		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto-qnx*)
+		;;
+	-nto*)
+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
+	-linux-dietlibc)
+		os=-linux-dietlibc
+		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-opened*)
+		os=-openedition
+		;;
+        -os400*)
+		os=-os400
+		;;
+	-wince*)
+		os=-wince
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-syllable*)
+		os=-syllable
+		;;
+	-386bsd)
+		os=-bsd
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
+	-ns2 )
+		os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+        -tpf*)
+		os=-tpf
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-aros*)
+		os=-aros
+		;;
+	-kaos*)
+		os=-kaos
+		;;
+	-zvmoe)
+		os=-zvmoe
+		;;
+	-dicos*)
+		os=-dicos
+		;;
+        -nacl*)
+	        ;;
+	-none)
+		;;
+	*)
+		# Get rid of the `-' at the beginning of $os.
+		os=`echo $os | sed 's/[^-]*-//'`
+		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		exit 1
+		;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+        score-*)
+		os=-elf
+		;;
+        spu-*)
+		os=-elf
+		;;
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-rebel)
+		os=-linux
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+        c4x-* | tic4x-*)
+        	os=-coff
+		;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
+		;;
+	pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	m68*-apollo)
+		os=-domain
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		# This also exists in the configure program, but was not the
+		# default.
+		# os=-sunos4
+		;;
+	m68*-cisco)
+		os=-aout
+		;;
+        mep-*)
+		os=-elf
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
+	or32-*)
+		os=-coff
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-be)
+		os=-beos
+		;;
+	*-haiku)
+		os=-haiku
+		;;
+	*-ibm)
+		os=-aix
+		;;
+    	*-knuth)
+		os=-mmixware
+		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigaos
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-next )
+		os=-nextstep
+		;;
+	*-sequent)
+		os=-ptx
+		;;
+	*-crds)
+		os=-unos
+		;;
+	*-ns)
+		os=-genix
+		;;
+	i370-*)
+		os=-mvs
+		;;
+	*-next)
+		os=-nextstep3
+		;;
+	*-gould)
+		os=-sysv
+		;;
+	*-highlevel)
+		os=-bsd
+		;;
+	*-encore)
+		os=-bsd
+		;;
+	*-sgi)
+		os=-irix
+		;;
+	*-siemens)
+		os=-sysv4
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	f30[01]-fujitsu | f700-fujitsu)
+		os=-uxpv
+		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
+	*)
+		os=-none
+		;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+	*-unknown)
+		case $os in
+			-riscix*)
+				vendor=acorn
+				;;
+			-sunos*)
+				vendor=sun
+				;;
+			-cnk*|-aix*)
+				vendor=ibm
+				;;
+			-beos*)
+				vendor=be
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-mpeix*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs* | -opened*)
+				vendor=ibm
+				;;
+			-os400*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-tpf*)
+				vendor=ibm
+				;;
+			-vxsim* | -vxworks* | -windiss*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff -r 6a34a42a2b5d -r a19c6d90fd41 tools/configure
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/configure	Wed Feb 22 01:55:03 2012 +0000
@@ -0,0 +1,10469 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.67 for Xen Hypervisor 4.2.
+#
+# Report bugs to <xen-devel@lists.xensource.com>.
+#
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
+  else
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in #(
+      *"$as_nl"*)
+	expr "X$arg" : "X\\(.*\\)$as_nl";
+	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
+  fi
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in #((
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test "x$CONFIG_SHELL" = x; then
+  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+"
+  as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+  exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1"
+  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+  if (eval "$as_required") 2>/dev/null; then :
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  as_found=:
+  case $as_dir in #(
+	 /*)
+	   for as_base in sh bash ksh sh5; do
+	     # Try only shells that exist, to save several forks.
+	     as_shell=$as_dir/$as_base
+	     if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+		    { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  CONFIG_SHELL=$as_shell as_have_required=yes
+		   if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  break 2
+fi
+fi
+	   done;;
+       esac
+  as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+	      { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+  CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+      if test "x$CONFIG_SHELL" != x; then :
+  # We cannot yet assume a decent shell, so we have to provide a
+	# neutralization value for shells without unset; and this also
+	# works around shells that cannot unset nonexistent variables.
+	BASH_ENV=/dev/null
+	ENV=/dev/null
+	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+	export CONFIG_SHELL
+	exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+    if test x$as_have_required = xno; then :
+  $as_echo "$0: This script requires a shell more modern than all"
+  $as_echo "$0: the shells that I found on your system."
+  if test x${ZSH_VERSION+set} = xset ; then
+    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+  else
+    $as_echo "$0: Please tell bug-autoconf@gnu.org and
+$0: xen-devel@lists.xensource.com about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+  fi
+  exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+  as_lineno_1=$LINENO as_lineno_1a=$LINENO
+  as_lineno_2=$LINENO as_lineno_2a=$LINENO
+  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='	';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -p'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -p'
+  fi
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+	test -d "$1/.";
+      else
+	case $1 in #(
+	-*)set "./$1";;
+	esac;
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+	???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='Xen Hypervisor'
+PACKAGE_TARNAME='xen-hypervisor'
+PACKAGE_VERSION='4.2'
+PACKAGE_STRING='Xen Hypervisor 4.2'
+PACKAGE_BUGREPORT='xen-devel@lists.xensource.com'
+PACKAGE_URL=''
+
+ac_unique_file="libxl/libxl.c"
+ac_default_prefix=/usr
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_header_list=
+ac_func_list=
+ac_subst_vars='LTLIBOBJS
+POW_LIB
+LIBOBJS
+ALLOCA
+libiconv
+libgcrypt
+libext2fs
+system_aio
+LIB_PATH
+glib_LIBS
+glib_CFLAGS
+PKG_CONFIG_LIBDIR
+PKG_CONFIG_PATH
+PKG_CONFIG
+VNCONFIG
+HOTPLUG
+UDEVINFO
+UDEVADM
+PYTHONPATH
+OCAMLBUILD
+OCAMLDOC
+OCAMLMKLIB
+OCAMLMKTOP
+OCAMLDEP
+OCAML
+OCAMLOPTDOTOPT
+OCAMLCDOTOPT
+OCAMLBEST
+OCAMLOPT
+OCAMLLIB
+OCAMLVERSION
+OCAMLC
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+SET_MAKE
+LN_S
+SED
+XGETTEXT
+BASH
+XML
+CURL
+FLEX
+BISON
+IP
+BRCTL
+PERL
+PYTHON
+APPEND_LIB
+APPEND_INCLUDES
+PREPEND_LIB
+PREPEND_INCLUDES
+debug
+lomount
+miniterm
+ocamltools
+pythontools
+xapi
+vtpm
+monitors
+githttp
+xsm
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+EGREP
+GREP
+CPP
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_xsm
+enable_githttp
+enable_monitors
+enable_vtpm
+enable_xapi
+enable_pythontools
+enable_ocamltools
+enable_miniterm
+enable_lomount
+enable_debug
+'
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP
+PREPEND_INCLUDES
+PREPEND_LIB
+APPEND_INCLUDES
+APPEND_LIB
+PYTHON
+PERL
+BRCTL
+IP
+BISON
+FLEX
+CURL
+XML
+BASH
+XGETTEXT
+PKG_CONFIG
+PKG_CONFIG_PATH
+PKG_CONFIG_LIBDIR
+glib_CFLAGS
+glib_LIBS'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval $ac_prev=\$ac_option
+    ac_prev=
+    continue
+  fi
+
+  case $ac_option in
+  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *=)   ac_optarg= ;;
+  *)    ac_optarg=yes ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_dashdash$ac_option in
+  --)
+    ac_dashdash=yes ;;
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=*)
+    datadir=$ac_optarg ;;
+
+  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+  | --dataroo | --dataro | --datar)
+    ac_prev=datarootdir ;;
+  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+    datarootdir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=no ;;
+
+  -docdir | --docdir | --docdi | --doc | --do)
+    ac_prev=docdir ;;
+  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+    docdir=$ac_optarg ;;
+
+  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+    ac_prev=dvidir ;;
+  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+    dvidir=$ac_optarg ;;
+
+  -enable-* | --enable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=\$ac_optarg ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+    ac_prev=htmldir ;;
+  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+  | --ht=*)
+    htmldir=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localedir | --localedir | --localedi | --localed | --locale)
+    ac_prev=localedir ;;
+  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+    localedir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst | --locals)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+    ac_prev=pdfdir ;;
+  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+    pdfdir=$ac_optarg ;;
+
+  -psdir | --psdir | --psdi | --psd | --ps)
+    ac_prev=psdir ;;
+  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+    psdir=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=\$ac_optarg ;;
+
+  -without-* | --without-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=no ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    case $ac_envvar in #(
+      '' | [0-9]* | *[!_$as_cr_alnum]* )
+      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+    esac
+    eval $ac_envvar=\$ac_optarg
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+  case $enable_option_checking in
+    no) ;;
+    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+  esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
+		datadir sysconfdir sharedstatedir localstatedir includedir \
+		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+		libdir localedir mandir
+do
+  eval ac_val=\$$ac_var
+  # Remove trailing slashes.
+  case $ac_val in
+    */ )
+      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+      eval $ac_var=\$ac_val;;
+  esac
+  # Be sure to have absolute directory names.
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* )  continue;;
+    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+  esac
+  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used" >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+  as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+  as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then the parent directory.
+  ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_myself" : 'X\(//\)[^/]' \| \
+	 X"$as_myself" : 'X\(//\)$' \| \
+	 X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r "$srcdir/$ac_unique_file"; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+	pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+  srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+  eval ac_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_env_${ac_var}_value=\$${ac_var}
+  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures Xen Hypervisor 4.2 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking ...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR            user executables [EPREFIX/bin]
+  --sbindir=DIR           system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR        program executables [EPREFIX/libexec]
+  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --libdir=DIR            object code libraries [EPREFIX/lib]
+  --includedir=DIR        C header files [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
+  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR           info documentation [DATAROOTDIR/info]
+  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
+  --mandir=DIR            man documentation [DATAROOTDIR/man]
+  --docdir=DIR            documentation root [DATAROOTDIR/doc/xen-hypervisor]
+  --htmldir=DIR           html documentation [DOCDIR]
+  --dvidir=DIR            dvi documentation [DOCDIR]
+  --pdfdir=DIR            pdf documentation [DOCDIR]
+  --psdir=DIR             ps documentation [DOCDIR]
+_ACEOF
+
+  cat <<\_ACEOF
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of Xen Hypervisor 4.2:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-option-checking  ignore unrecognized --enable/--with options
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-xsm            Enable XSM security module (by default, Flask)
+  --enable-githttp        Download GIT repositories via HTTP
+  --disable-monitors      Disable xenstat and xentop monitoring tools
+  --enable-vtpm           Enable Virtual Trusted Platform Module
+  --enable-xapi           Enable Xen API Bindings
+  --disable-pythontools   Disable Python tools
+  --disable-ocamltools    Disable Ocaml tools
+  --enable-miniterm       Enable miniterm
+  --enable-lomount        Enable lomount
+  --disable-debug         Disable debug build of Xen and tools
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+  PREPEND_INCLUDES
+              List of include folders to prepend to CFLAGS (without -I)
+  PREPEND_LIB List of library folders to prepend to LDFLAGS (without -L)
+  APPEND_INCLUDES
+              List of include folders to append to CFLAGS (without -I)
+  APPEND_LIB  List of library folders to append to LDFLAGS (without -L)
+  PYTHON      Path to the Python parser
+  PERL        Path to Perl parser
+  BRCTL       Path to brctl tool
+  IP          Path to ip tool
+  BISON       Path to Bison parser generator
+  FLEX        Path to Flex lexical analyser generator
+  CURL        Path to curl-config tool
+  XML         Path to xml2-config tool
+  BASH        Path to bash shell
+  XGETTEXT    Path to xgetttext tool
+  PKG_CONFIG  path to pkg-config utility
+  PKG_CONFIG_PATH
+              directories to add to pkg-config's search path
+  PKG_CONFIG_LIBDIR
+              path overriding pkg-config's built-in search path
+  glib_CFLAGS C compiler flags for glib, overriding pkg-config
+  glib_LIBS   linker flags for glib, overriding pkg-config
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <xen-devel@lists.xensource.com>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d "$ac_dir" ||
+      { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+      continue
+    ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+    cd "$ac_dir" || { ac_status=$?; continue; }
+    # Check for guested configure.
+    if test -f "$ac_srcdir/configure.gnu"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+    elif test -f "$ac_srcdir/configure"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure" --help=recursive
+    else
+      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi || ac_status=$?
+    cd "$ac_pwd" || { ac_status=$?; break; }
+  done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+  cat <<\_ACEOF
+Xen Hypervisor configure 4.2
+generated by GNU Autoconf 2.67
+
+Copyright (C) 2010 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } > conftest.i && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+    ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if eval "test \"\${$3+set}\"" = set; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_header_compiler=yes
+else
+  ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  ac_header_preproc=yes
+else
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+  yes:no: )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## -------------------------------------------- ##
+## Report this to xen-devel@lists.xensource.com ##
+## -------------------------------------------- ##"
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+       $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=$ac_status
+fi
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_test_x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $2 (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_func
+
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+	 return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+	    return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_type
+
+# ac_fn_c_find_intX_t LINENO BITS VAR
+# -----------------------------------
+# Finds a signed integer type with width BITS, setting cache variable VAR
+# accordingly.
+ac_fn_c_find_intX_t ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5
+$as_echo_n "checking for int$2_t... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+     # Order is important - never check a type that is potentially smaller
+     # than half of the expected target width.
+     for ac_type in int$2_t 'int' 'long int' \
+	 'long long int' 'short int' 'signed char'; do
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+	     enum { N = $2 / 2 - 1 };
+int
+main ()
+{
+static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+	        enum { N = $2 / 2 - 1 };
+int
+main ()
+{
+static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
+		 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  case $ac_type in #(
+  int$2_t) :
+    eval "$3=yes" ;; #(
+  *) :
+    eval "$3=\$ac_type" ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       if eval test \"x\$"$3"\" = x"no"; then :
+
+else
+  break
+fi
+     done
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_find_intX_t
+
+# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
+# ----------------------------------------------------
+# Tries to find if the field MEMBER exists in type AGGR, after including
+# INCLUDES, setting cache variable VAR accordingly.
+ac_fn_c_check_member ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
+$as_echo_n "checking for $2.$3... " >&6; }
+if eval "test \"\${$4+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$5
+int
+main ()
+{
+static $2 ac_aggr;
+if (ac_aggr.$3)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$4=yes"
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$5
+int
+main ()
+{
+static $2 ac_aggr;
+if (sizeof ac_aggr.$3)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$4=yes"
+else
+  eval "$4=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$4
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_member
+
+# ac_fn_c_find_uintX_t LINENO BITS VAR
+# ------------------------------------
+# Finds an unsigned integer type with width BITS, setting cache variable VAR
+# accordingly.
+ac_fn_c_find_uintX_t ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5
+$as_echo_n "checking for uint$2_t... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+     # Order is important - never check a type that is potentially smaller
+     # than half of the expected target width.
+     for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \
+	 'unsigned long long int' 'unsigned short int' 'unsigned char'; do
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  case $ac_type in #(
+  uint$2_t) :
+    eval "$3=yes" ;; #(
+  *) :
+    eval "$3=\$ac_type" ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       if eval test \"x\$"$3"\" = x"no"; then :
+
+else
+  break
+fi
+     done
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_find_uintX_t
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by Xen Hypervisor $as_me 4.2, which was
+generated by GNU Autoconf 2.67.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    $as_echo "PATH: $as_dir"
+  done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *\'*)
+      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+    2)
+      as_fn_append ac_configure_args1 " '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+	ac_must_keep_next=false # Got value, back to normal.
+      else
+	case $ac_arg in
+	  *=* | --config-cache | -C | -disable-* | --disable-* \
+	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+	  | -with-* | --with-* | -without-* | --without-* | --x)
+	    case "$ac_configure_args0 " in
+	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+	    esac
+	    ;;
+	  -* ) ac_must_keep_next=true ;;
+	esac
+      fi
+      as_fn_append ac_configure_args " '$ac_arg'"
+      ;;
+    esac
+  done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+(
+  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
+      esac ;;
+    esac
+  done
+  (set) 2>&1 |
+    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      sed -n \
+	"s/'\''/'\''\\\\'\'''\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
+    *)
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+)
+    echo
+
+    $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      $as_echo "$ac_var='\''$ac_val'\''"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=\$$ac_var
+	case $ac_val in
+	*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+	esac
+	$as_echo "$ac_var='\''$ac_val'\''"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+      echo
+      cat confdefs.h
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      $as_echo "$as_me: caught signal $ac_signal"
+    $as_echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core core.conftest.* &&
+    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+  # We do not want a PATH search for config.site.
+  case $CONFIG_SITE in #((
+    -*)  ac_site_file1=./$CONFIG_SITE;;
+    */*) ac_site_file1=$CONFIG_SITE;;
+    *)   ac_site_file1=./$CONFIG_SITE;;
+  esac
+elif test "x$prefix" != xNONE; then
+  ac_site_file1=$prefix/share/config.site
+  ac_site_file2=$prefix/etc/config.site
+else
+  ac_site_file1=$ac_default_prefix/share/config.site
+  ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+  test "x$ac_site_file" = xNONE && continue
+  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file" \
+      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5 ; }
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special files
+  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
+  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
+    esac
+  fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+as_fn_append ac_header_list " sys/time.h"
+as_fn_append ac_header_list " unistd.h"
+as_fn_append ac_func_list " alarm"
+as_fn_append ac_header_list " stdlib.h"
+as_fn_append ac_header_list " sys/param.h"
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val=\$ac_cv_env_${ac_var}_value
+  eval ac_new_val=\$ac_env_${ac_var}_value
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+	# differences in whitespace do not lead to failure.
+	ac_old_val_w=`echo x $ac_old_val`
+	ac_new_val_w=`echo x $ac_new_val`
+	if test "$ac_old_val_w" != "$ac_new_val_w"; then
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	  ac_cache_corrupted=:
+	else
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+	  eval $ac_var=\$ac_old_val
+	fi
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
+$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
+$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+ac_config_files="$ac_config_files ../config/Tools.mk"
+
+ac_config_headers="$ac_config_headers config.h"
+
+
+ac_aux_dir=
+for ac_dir in . "$srcdir"/.; do
+  if test -f "$ac_dir/install-sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f "$ac_dir/install.sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f "$ac_dir/shtool"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in . \"$srcdir\"/." "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+
+
+
+# Check if CFLAGS, LDFLAGS, LIBS, CPPFLAGS or CPP is set and print a warning
+
+if test -n "$CC$CFLAGS$LDFLAGS$LIBS$CPPFLAGS$CPP"; then :
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Setting CC, CFLAGS, LDFLAGS, LIBS, CPPFLAGS or CPP is not \
+recommended, use PREPEND_INCLUDES, PREPEND_LIB, \
+APPEND_INCLUDES and APPEND_LIB instead when possible." >&5
+$as_echo "$as_me: WARNING: Setting CC, CFLAGS, LDFLAGS, LIBS, CPPFLAGS or CPP is not \
+recommended, use PREPEND_INCLUDES, PREPEND_LIB, \
+APPEND_INCLUDES and APPEND_LIB instead when possible." >&2;}
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5 ; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+  esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link_default") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile.  We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+	;;
+    [ab].out )
+	# We found the default executable, but exeext='' is most
+	# certainly right.
+	break;;
+    *.* )
+	if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+	then :; else
+	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	fi
+	# We set ac_cv_exeext here because the later test for it is not
+	# safe: cross compilers may not add the suffix if given an `-o'
+	# argument, so we may need to know it at that point already.
+	# Even if this section looks crufty: it has the advantage of
+	# actually working.
+	break;;
+    * )
+	break;;
+  esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+  ac_file=''
+fi
+if test -z "$ac_file"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	  break;;
+    * ) break;;
+  esac
+done
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5 ; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+  { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+  if { ac_try='./conftest$ac_cv_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5 ; }
+    fi
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if test "${ac_cv_objext+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5 ; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+else
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5 ; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$GREP"; then
+  ac_path_GREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in grep ggrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_GREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_GREP"; then
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     if test -z "$EGREP"; then
+  ac_path_EGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in egrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_EGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_EGREP"; then
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stdc=yes
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+  ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default"
+if test "x$ac_cv_header_minix_config_h" = x""yes; then :
+  MINIX=yes
+else
+  MINIX=
+fi
+
+
+  if test "$MINIX" = yes; then
+
+$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h
+
+
+$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h
+
+
+$as_echo "#define _MINIX 1" >>confdefs.h
+
+  fi
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5
+$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
+if test "${ac_cv_safe_to_define___extensions__+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#	  define __EXTENSIONS__ 1
+	  $ac_includes_default
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_safe_to_define___extensions__=yes
+else
+  ac_cv_safe_to_define___extensions__=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5
+$as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
+  test $ac_cv_safe_to_define___extensions__ = yes &&
+    $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h
+
+  $as_echo "#define _ALL_SOURCE 1" >>confdefs.h
+
+  $as_echo "#define _GNU_SOURCE 1" >>confdefs.h
+
+  $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
+
+  $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h
+
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if test "${ac_cv_build+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if test "${ac_cv_host+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+
+# M4 Macro includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
+# serial 1 (pkg-config-0.24)
+#
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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
+# 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.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists.  Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+# only at the first occurence in configure.ac, so if the first place
+# it's called might be skipped (such as if it is within an "if", you
+# have to call PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+# PKG_CHECK_MODULES
+
+
+# Enable/disable options
+# Check whether --enable-xsm was given.
+if test "${enable_xsm+set}" = set; then :
+  enableval=$enable_xsm;
+fi
+
+
+if test "x$enable_xsm" = "xyes"; then :
+
+    ax_cv_xsm="y"
+
+elif test "x$enable_xsm" = "xno"; then :
+
+    ax_cv_xsm="n"
+
+elif test -z $ax_cv_xsm; then :
+
+    ax_cv_xsm="n"
+
+fi
+xsm=$ax_cv_xsm
+
+# Check whether --enable-githttp was given.
+if test "${enable_githttp+set}" = set; then :
+  enableval=$enable_githttp;
+fi
+
+
+if test "x$enable_githttp" = "xyes"; then :
+
+    ax_cv_githttp="y"
+
+elif test "x$enable_githttp" = "xno"; then :
+
+    ax_cv_githttp="n"
+
+elif test -z $ax_cv_githttp; then :
+
+    ax_cv_githttp="n"
+
+fi
+githttp=$ax_cv_githttp
+
+# Check whether --enable-monitors was given.
+if test "${enable_monitors+set}" = set; then :
+  enableval=$enable_monitors;
+fi
+
+
+if test "x$enable_monitors" = "xno"; then :
+
+    ax_cv_monitors="n"
+
+elif test "x$enable_monitors" = "xyes"; then :
+
+    ax_cv_monitors="y"
+
+elif test -z $ax_cv_monitors; then :
+
+    ax_cv_monitors="y"
+
+fi
+monitors=$ax_cv_monitors
+
+# Check whether --enable-vtpm was given.
+if test "${enable_vtpm+set}" = set; then :
+  enableval=$enable_vtpm;
+fi
+
+
+if test "x$enable_vtpm" = "xyes"; then :
+
+    ax_cv_vtpm="y"
+
+elif test "x$enable_vtpm" = "xno"; then :
+
+    ax_cv_vtpm="n"
+
+elif test -z $ax_cv_vtpm; then :
+
+    ax_cv_vtpm="n"
+
+fi
+vtpm=$ax_cv_vtpm
+
+# Check whether --enable-xapi was given.
+if test "${enable_xapi+set}" = set; then :
+  enableval=$enable_xapi;
+fi
+
+
+if test "x$enable_xapi" = "xyes"; then :
+
+    ax_cv_xapi="y"
+
+elif test "x$enable_xapi" = "xno"; then :
+
+    ax_cv_xapi="n"
+
+elif test -z $ax_cv_xapi; then :
+
+    ax_cv_xapi="n"
+
+fi
+xapi=$ax_cv_xapi
+
+# Check whether --enable-pythontools was given.
+if test "${enable_pythontools+set}" = set; then :
+  enableval=$enable_pythontools;
+fi
+
+
+if test "x$enable_pythontools" = "xno"; then :
+
+    ax_cv_pythontools="n"
+
+elif test "x$enable_pythontools" = "xyes"; then :
+
+    ax_cv_pythontools="y"
+
+elif test -z $ax_cv_pythontools; then :
+
+    ax_cv_pythontools="y"
+
+fi
+pythontools=$ax_cv_pythontools
+
+# Check whether --enable-ocamltools was given.
+if test "${enable_ocamltools+set}" = set; then :
+  enableval=$enable_ocamltools;
+fi
+
+
+if test "x$enable_ocamltools" = "xno"; then :
+
+    ax_cv_ocamltools="n"
+
+elif test "x$enable_ocamltools" = "xyes"; then :
+
+    ax_cv_ocamltools="y"
+
+elif test -z $ax_cv_ocamltools; then :
+
+    ax_cv_ocamltools="y"
+
+fi
+ocamltools=$ax_cv_ocamltools
+
+# Check whether --enable-miniterm was given.
+if test "${enable_miniterm+set}" = set; then :
+  enableval=$enable_miniterm;
+fi
+
+
+if test "x$enable_miniterm" = "xyes"; then :
+
+    ax_cv_miniterm="y"
+
+elif test "x$enable_miniterm" = "xno"; then :
+
+    ax_cv_miniterm="n"
+
+elif test -z $ax_cv_miniterm; then :
+
+    ax_cv_miniterm="n"
+
+fi
+miniterm=$ax_cv_miniterm
+
+# Check whether --enable-lomount was given.
+if test "${enable_lomount+set}" = set; then :
+  enableval=$enable_lomount;
+fi
+
+
+if test "x$enable_lomount" = "xyes"; then :
+
+    ax_cv_lomount="y"
+
+elif test "x$enable_lomount" = "xno"; then :
+
+    ax_cv_lomount="n"
+
+elif test -z $ax_cv_lomount; then :
+
+    ax_cv_lomount="n"
+
+fi
+lomount=$ax_cv_lomount
+
+# Check whether --enable-debug was given.
+if test "${enable_debug+set}" = set; then :
+  enableval=$enable_debug;
+fi
+
+
+if test "x$enable_debug" = "xno"; then :
+
+    ax_cv_debug="n"
+
+elif test "x$enable_debug" = "xyes"; then :
+
+    ax_cv_debug="y"
+
+elif test -z $ax_cv_debug; then :
+
+    ax_cv_debug="y"
+
+fi
+debug=$ax_cv_debug
+
+
+
+
+
+
+
+for cflag in $PREPEND_INCLUDES
+do
+    PREPEND_CFLAGS+=" -I$cflag"
+done
+for ldflag in $PREPEND_LIB
+do
+    PREPEND_LDFLAGS+=" -L$ldflag"
+done
+for cflag in $APPEND_INCLUDES
+do
+    APPEND_CFLAGS+=" -I$cflag"
+done
+for ldflag in $APPEND_LIB
+do
+    APPEND_LDFLAGS+=" -L$ldflag"
+done
+CFLAGS="$PREPEND_CFLAGS $CFLAGS $APPEND_CFLAGS"
+LDFLAGS="$PREPEND_LDFLAGS $LDFLAGS $APPEND_LDFLAGS"
+
+
+
+
+
+
+
+
+
+
+
+
+# Checks for programs.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if test "${ac_cv_path_SED+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+     for ac_i in 1 2 3 4 5 6 7; do
+       ac_script="$ac_script$as_nl$ac_script"
+     done
+     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+     { ac_script=; unset ac_script;}
+     if test -z "$SED"; then
+  ac_path_SED_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+# Check for GNU ac_path_SED and select it if it is found.
+  # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+  ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo '' >> "conftest.nl"
+    "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_SED_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_SED="$ac_path_SED"
+      ac_path_SED_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_SED_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_SED"; then
+    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+  fi
+else
+  ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+  rm -f conftest.sed
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5 ; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+else
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+	@echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  SET_MAKE=
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+  ./ | .// | /[cC]/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	  if test $ac_prog = install &&
+	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    rm -rf conftest.one conftest.two conftest.dir
+	    echo one > conftest.one
+	    echo two > conftest.two
+	    mkdir conftest.dir
+	    if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+	      test -s conftest.one && test -s conftest.two &&
+	      test -s conftest.dir/conftest.one &&
+	      test -s conftest.dir/conftest.two
+	    then
+	      ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	      break 3
+	    fi
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+
+  done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    INSTALL=$ac_install_sh
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+# Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PERL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PERL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_PERL" && ac_cv_path_PERL="no"
+  ;;
+esac
+fi
+PERL=$ac_cv_path_PERL
+if test -n "$PERL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
+$as_echo "$PERL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${PERL}" == x"no"
+then
+    as_fn_error $? "Unable to find perl, please install perl" "$LINENO" 5
+fi
+# Extract the first word of "brctl", so it can be a program name with args.
+set dummy brctl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_BRCTL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BRCTL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BRCTL="$BRCTL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_BRCTL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_BRCTL" && ac_cv_path_BRCTL="no"
+  ;;
+esac
+fi
+BRCTL=$ac_cv_path_BRCTL
+if test -n "$BRCTL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BRCTL" >&5
+$as_echo "$BRCTL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${BRCTL}" == x"no"
+then
+    as_fn_error $? "Unable to find brctl, please install brctl" "$LINENO" 5
+fi
+# Extract the first word of "ip", so it can be a program name with args.
+set dummy ip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_IP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $IP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_IP="$IP" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_IP="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_IP" && ac_cv_path_IP="no"
+  ;;
+esac
+fi
+IP=$ac_cv_path_IP
+if test -n "$IP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $IP" >&5
+$as_echo "$IP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${IP}" == x"no"
+then
+    as_fn_error $? "Unable to find ip, please install ip" "$LINENO" 5
+fi
+# Extract the first word of "bison", so it can be a program name with args.
+set dummy bison; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_BISON+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BISON in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BISON="$BISON" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_BISON="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_BISON" && ac_cv_path_BISON="no"
+  ;;
+esac
+fi
+BISON=$ac_cv_path_BISON
+if test -n "$BISON"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BISON" >&5
+$as_echo "$BISON" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${BISON}" == x"no"
+then
+    as_fn_error $? "Unable to find bison, please install bison" "$LINENO" 5
+fi
+# Extract the first word of "flex", so it can be a program name with args.
+set dummy flex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_FLEX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $FLEX in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_FLEX="$FLEX" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_FLEX="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_FLEX" && ac_cv_path_FLEX="no"
+  ;;
+esac
+fi
+FLEX=$ac_cv_path_FLEX
+if test -n "$FLEX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FLEX" >&5
+$as_echo "$FLEX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${FLEX}" == x"no"
+then
+    as_fn_error $? "Unable to find flex, please install flex" "$LINENO" 5
+fi
+if test "x$xapi" = "xy"; then :
+
+    # Extract the first word of "curl-config", so it can be a program name with args.
+set dummy curl-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_CURL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $CURL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CURL="$CURL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_CURL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_CURL" && ac_cv_path_CURL="no"
+  ;;
+esac
+fi
+CURL=$ac_cv_path_CURL
+if test -n "$CURL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CURL" >&5
+$as_echo "$CURL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${CURL}" == x"no"
+then
+    as_fn_error $? "Unable to find curl-config, please install curl-config" "$LINENO" 5
+fi
+    # Extract the first word of "xml2-config", so it can be a program name with args.
+set dummy xml2-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_XML+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $XML in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_XML="$XML" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_XML="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_XML" && ac_cv_path_XML="no"
+  ;;
+esac
+fi
+XML=$ac_cv_path_XML
+if test -n "$XML"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XML" >&5
+$as_echo "$XML" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${XML}" == x"no"
+then
+    as_fn_error $? "Unable to find xml2-config, please install xml2-config" "$LINENO" 5
+fi
+
+fi
+if test "x$ocamltools" = "xy"; then :
+
+      # checking for ocamlc
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OCAMLC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLC"; then
+  ac_cv_prog_OCAMLC="$OCAMLC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OCAMLC="${ac_tool_prefix}ocamlc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLC=$ac_cv_prog_OCAMLC
+if test -n "$OCAMLC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLC" >&5
+$as_echo "$OCAMLC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLC"; then
+  ac_ct_OCAMLC=$OCAMLC
+  # Extract the first word of "ocamlc", so it can be a program name with args.
+set dummy ocamlc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OCAMLC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLC"; then
+  ac_cv_prog_ac_ct_OCAMLC="$ac_ct_OCAMLC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OCAMLC="ocamlc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLC=$ac_cv_prog_ac_ct_OCAMLC
+if test -n "$ac_ct_OCAMLC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLC" >&5
+$as_echo "$ac_ct_OCAMLC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLC" = x; then
+    OCAMLC="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLC=$ac_ct_OCAMLC
+  fi
+else
+  OCAMLC="$ac_cv_prog_OCAMLC"
+fi
+
+
+  if test "$OCAMLC" != "no"; then
+     OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p'`
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: OCaml version is $OCAMLVERSION" >&5
+$as_echo "OCaml version is $OCAMLVERSION" >&6; }
+     # If OCAMLLIB is set, use it
+     if test "$OCAMLLIB" = ""; then
+        OCAMLLIB=`$OCAMLC -where 2>/dev/null || $OCAMLC -v|tail -1|cut -d ' ' -f 4`
+     else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: OCAMLLIB previously set; preserving it." >&5
+$as_echo "OCAMLLIB previously set; preserving it." >&6; }
+     fi
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: OCaml library path is $OCAMLLIB" >&5
+$as_echo "OCaml library path is $OCAMLLIB" >&6; }
+
+
+
+
+     # checking for ocamlopt
+     if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlopt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlopt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OCAMLOPT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLOPT"; then
+  ac_cv_prog_OCAMLOPT="$OCAMLOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OCAMLOPT="${ac_tool_prefix}ocamlopt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLOPT=$ac_cv_prog_OCAMLOPT
+if test -n "$OCAMLOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLOPT" >&5
+$as_echo "$OCAMLOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLOPT"; then
+  ac_ct_OCAMLOPT=$OCAMLOPT
+  # Extract the first word of "ocamlopt", so it can be a program name with args.
+set dummy ocamlopt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OCAMLOPT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLOPT"; then
+  ac_cv_prog_ac_ct_OCAMLOPT="$ac_ct_OCAMLOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OCAMLOPT="ocamlopt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLOPT=$ac_cv_prog_ac_ct_OCAMLOPT
+if test -n "$ac_ct_OCAMLOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLOPT" >&5
+$as_echo "$ac_ct_OCAMLOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLOPT" = x; then
+    OCAMLOPT="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLOPT=$ac_ct_OCAMLOPT
+  fi
+else
+  OCAMLOPT="$ac_cv_prog_OCAMLOPT"
+fi
+
+     OCAMLBEST=byte
+     if test "$OCAMLOPT" = "no"; then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find ocamlopt; bytecode compilation only." >&5
+$as_echo "$as_me: WARNING: Cannot find ocamlopt; bytecode compilation only." >&2;}
+     else
+	TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
+	if test "$TMPVERSION" != "$OCAMLVERSION" ; then
+	    { $as_echo "$as_me:${as_lineno-$LINENO}: result: versions differs from ocamlc; ocamlopt discarded." >&5
+$as_echo "versions differs from ocamlc; ocamlopt discarded." >&6; }
+	    OCAMLOPT=no
+	else
+	    OCAMLBEST=opt
+	fi
+     fi
+
+
+
+     # checking for ocamlc.opt
+     if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlc.opt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlc.opt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OCAMLCDOTOPT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLCDOTOPT"; then
+  ac_cv_prog_OCAMLCDOTOPT="$OCAMLCDOTOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OCAMLCDOTOPT="${ac_tool_prefix}ocamlc.opt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLCDOTOPT=$ac_cv_prog_OCAMLCDOTOPT
+if test -n "$OCAMLCDOTOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLCDOTOPT" >&5
+$as_echo "$OCAMLCDOTOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLCDOTOPT"; then
+  ac_ct_OCAMLCDOTOPT=$OCAMLCDOTOPT
+  # Extract the first word of "ocamlc.opt", so it can be a program name with args.
+set dummy ocamlc.opt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OCAMLCDOTOPT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLCDOTOPT"; then
+  ac_cv_prog_ac_ct_OCAMLCDOTOPT="$ac_ct_OCAMLCDOTOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OCAMLCDOTOPT="ocamlc.opt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLCDOTOPT=$ac_cv_prog_ac_ct_OCAMLCDOTOPT
+if test -n "$ac_ct_OCAMLCDOTOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLCDOTOPT" >&5
+$as_echo "$ac_ct_OCAMLCDOTOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLCDOTOPT" = x; then
+    OCAMLCDOTOPT="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLCDOTOPT=$ac_ct_OCAMLCDOTOPT
+  fi
+else
+  OCAMLCDOTOPT="$ac_cv_prog_OCAMLCDOTOPT"
+fi
+
+     if test "$OCAMLCDOTOPT" != "no"; then
+	TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
+	if test "$TMPVERSION" != "$OCAMLVERSION" ; then
+	    { $as_echo "$as_me:${as_lineno-$LINENO}: result: versions differs from ocamlc; ocamlc.opt discarded." >&5
+$as_echo "versions differs from ocamlc; ocamlc.opt discarded." >&6; }
+	else
+	    OCAMLC=$OCAMLCDOTOPT
+	fi
+     fi
+
+     # checking for ocamlopt.opt
+     if test "$OCAMLOPT" != "no" ; then
+	if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlopt.opt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlopt.opt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OCAMLOPTDOTOPT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLOPTDOTOPT"; then
+  ac_cv_prog_OCAMLOPTDOTOPT="$OCAMLOPTDOTOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OCAMLOPTDOTOPT="${ac_tool_prefix}ocamlopt.opt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLOPTDOTOPT=$ac_cv_prog_OCAMLOPTDOTOPT
+if test -n "$OCAMLOPTDOTOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLOPTDOTOPT" >&5
+$as_echo "$OCAMLOPTDOTOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLOPTDOTOPT"; then
+  ac_ct_OCAMLOPTDOTOPT=$OCAMLOPTDOTOPT
+  # Extract the first word of "ocamlopt.opt", so it can be a program name with args.
+set dummy ocamlopt.opt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OCAMLOPTDOTOPT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLOPTDOTOPT"; then
+  ac_cv_prog_ac_ct_OCAMLOPTDOTOPT="$ac_ct_OCAMLOPTDOTOPT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OCAMLOPTDOTOPT="ocamlopt.opt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLOPTDOTOPT=$ac_cv_prog_ac_ct_OCAMLOPTDOTOPT
+if test -n "$ac_ct_OCAMLOPTDOTOPT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLOPTDOTOPT" >&5
+$as_echo "$ac_ct_OCAMLOPTDOTOPT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLOPTDOTOPT" = x; then
+    OCAMLOPTDOTOPT="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLOPTDOTOPT=$ac_ct_OCAMLOPTDOTOPT
+  fi
+else
+  OCAMLOPTDOTOPT="$ac_cv_prog_OCAMLOPTDOTOPT"
+fi
+
+	if test "$OCAMLOPTDOTOPT" != "no"; then
+	   TMPVERSION=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
+	   if test "$TMPVERSION" != "$OCAMLVERSION" ; then
+	      { $as_echo "$as_me:${as_lineno-$LINENO}: result: version differs from ocamlc; ocamlopt.opt discarded." >&5
+$as_echo "version differs from ocamlc; ocamlopt.opt discarded." >&6; }
+	   else
+	      OCAMLOPT=$OCAMLOPTDOTOPT
+	   fi
+        fi
+     fi
+
+
+  fi
+
+
+
+  # checking for ocaml toplevel
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocaml", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocaml; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OCAML+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAML"; then
+  ac_cv_prog_OCAML="$OCAML" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OCAML="${ac_tool_prefix}ocaml"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAML=$ac_cv_prog_OCAML
+if test -n "$OCAML"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAML" >&5
+$as_echo "$OCAML" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAML"; then
+  ac_ct_OCAML=$OCAML
+  # Extract the first word of "ocaml", so it can be a program name with args.
+set dummy ocaml; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OCAML+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAML"; then
+  ac_cv_prog_ac_ct_OCAML="$ac_ct_OCAML" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OCAML="ocaml"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAML=$ac_cv_prog_ac_ct_OCAML
+if test -n "$ac_ct_OCAML"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAML" >&5
+$as_echo "$ac_ct_OCAML" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAML" = x; then
+    OCAML="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAML=$ac_ct_OCAML
+  fi
+else
+  OCAML="$ac_cv_prog_OCAML"
+fi
+
+
+  # checking for ocamldep
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamldep", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamldep; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OCAMLDEP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLDEP"; then
+  ac_cv_prog_OCAMLDEP="$OCAMLDEP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OCAMLDEP="${ac_tool_prefix}ocamldep"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLDEP=$ac_cv_prog_OCAMLDEP
+if test -n "$OCAMLDEP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLDEP" >&5
+$as_echo "$OCAMLDEP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLDEP"; then
+  ac_ct_OCAMLDEP=$OCAMLDEP
+  # Extract the first word of "ocamldep", so it can be a program name with args.
+set dummy ocamldep; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OCAMLDEP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLDEP"; then
+  ac_cv_prog_ac_ct_OCAMLDEP="$ac_ct_OCAMLDEP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OCAMLDEP="ocamldep"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLDEP=$ac_cv_prog_ac_ct_OCAMLDEP
+if test -n "$ac_ct_OCAMLDEP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLDEP" >&5
+$as_echo "$ac_ct_OCAMLDEP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLDEP" = x; then
+    OCAMLDEP="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLDEP=$ac_ct_OCAMLDEP
+  fi
+else
+  OCAMLDEP="$ac_cv_prog_OCAMLDEP"
+fi
+
+
+  # checking for ocamlmktop
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlmktop", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlmktop; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OCAMLMKTOP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLMKTOP"; then
+  ac_cv_prog_OCAMLMKTOP="$OCAMLMKTOP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OCAMLMKTOP="${ac_tool_prefix}ocamlmktop"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLMKTOP=$ac_cv_prog_OCAMLMKTOP
+if test -n "$OCAMLMKTOP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLMKTOP" >&5
+$as_echo "$OCAMLMKTOP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLMKTOP"; then
+  ac_ct_OCAMLMKTOP=$OCAMLMKTOP
+  # Extract the first word of "ocamlmktop", so it can be a program name with args.
+set dummy ocamlmktop; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OCAMLMKTOP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLMKTOP"; then
+  ac_cv_prog_ac_ct_OCAMLMKTOP="$ac_ct_OCAMLMKTOP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OCAMLMKTOP="ocamlmktop"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLMKTOP=$ac_cv_prog_ac_ct_OCAMLMKTOP
+if test -n "$ac_ct_OCAMLMKTOP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLMKTOP" >&5
+$as_echo "$ac_ct_OCAMLMKTOP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLMKTOP" = x; then
+    OCAMLMKTOP="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)


--===============6835735191746885487==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 20:44:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 20:44:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0fWP-00083q-DZ; Thu, 23 Feb 2012 20:44:13 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWN-00083e-KT
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1330029798!61862931!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20302 invoked from network); 23 Feb 2012 20:43:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 20:43:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWL-00085c-2q
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWK-0006eD-J6
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:08 +0000
Message-Id: <E1S0fWK-0006eD-J6@xenbits.xen.org>
Date: Thu, 23 Feb 2012 20:44:08 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] xen/xsm: fix incorrect handling
	of XSM hook return
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Daniel De Graaf <dgdegra@tycho.nsa.gov>
# Date 1329993050 0
# Node ID 3b9b0d4003a3fa670e64e15a7af5a5c107bc0a37
# Parent  f2543f449a49b8979becbf6888e009973427089a
xen/xsm: fix incorrect handling of XSM hook return

If the XSM hook denied access, the execution incorrectly continued on
after an extra unlock domain.

Reported-by: John McDermott <john.mcdermott@nrl.navy.mil>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   24684:833d80d3fbe7
xen-unstable date:        Thu Feb 02 15:23:04 2012 +0000
---


diff -r f2543f449a49 -r 3b9b0d4003a3 xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c	Mon Feb 13 17:57:47 2012 +0000
+++ b/xen/arch/x86/domctl.c	Thu Feb 23 10:30:50 2012 +0000
@@ -646,7 +646,7 @@
 
         ret = xsm_machine_address_size(d, domctl->cmd);
         if ( ret )
-            rcu_unlock_domain(d);
+            goto set_machine_address_size_out;
 
         ret = -EBUSY;
         if ( d->tot_pages > 0 )

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 20:44:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 20:44:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0fWP-00083q-DZ; Thu, 23 Feb 2012 20:44:13 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWN-00083e-KT
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1330029798!61862931!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20302 invoked from network); 23 Feb 2012 20:43:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 20:43:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWL-00085c-2q
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWK-0006eD-J6
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:08 +0000
Message-Id: <E1S0fWK-0006eD-J6@xenbits.xen.org>
Date: Thu, 23 Feb 2012 20:44:08 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] xen/xsm: fix incorrect handling
	of XSM hook return
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Daniel De Graaf <dgdegra@tycho.nsa.gov>
# Date 1329993050 0
# Node ID 3b9b0d4003a3fa670e64e15a7af5a5c107bc0a37
# Parent  f2543f449a49b8979becbf6888e009973427089a
xen/xsm: fix incorrect handling of XSM hook return

If the XSM hook denied access, the execution incorrectly continued on
after an extra unlock domain.

Reported-by: John McDermott <john.mcdermott@nrl.navy.mil>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   24684:833d80d3fbe7
xen-unstable date:        Thu Feb 02 15:23:04 2012 +0000
---


diff -r f2543f449a49 -r 3b9b0d4003a3 xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c	Mon Feb 13 17:57:47 2012 +0000
+++ b/xen/arch/x86/domctl.c	Thu Feb 23 10:30:50 2012 +0000
@@ -646,7 +646,7 @@
 
         ret = xsm_machine_address_size(d, domctl->cmd);
         if ( ret )
-            rcu_unlock_domain(d);
+            goto set_machine_address_size_out;
 
         ret = -EBUSY;
         if ( d->tot_pages > 0 )

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 20:44:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 20:44:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0fWQ-00083z-GT; Thu, 23 Feb 2012 20:44:14 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWO-00083f-7s
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:12 +0000
Received: from [85.158.139.83:34304] by server-4.bemta-5.messagelabs.com id
	B6/B9-10788-B15A64F4; Thu, 23 Feb 2012 20:44:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-182.messagelabs.com!1330029849!9062816!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14257 invoked from network); 23 Feb 2012 20:44:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 20:44:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWL-00085f-Bl
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWL-0006eb-8G
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:09 +0000
Message-Id: <E1S0fWL-0006eb-8G@xenbits.xen.org>
Date: Thu, 23 Feb 2012 20:44:08 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] x86: avoid deadlock after a PCI
	SERR NMI
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329993108 0
# Node ID 4cb8d9c9d46bbb64bd9ac1d7b71b085d57fe6c96
# Parent  3b9b0d4003a3fa670e64e15a7af5a5c107bc0a37
x86: avoid deadlock after a PCI SERR NMI

If a PCI System Error (SERR) is asserted it causes an NMI. If this NMI
occurs while the CPU is in printk() then Xen may deadlock as
pci_serr_error() calls console_force_unlock() which screws up the
console lock.

printk() isn't safe to call from NMI context so defer the diagnostic
message to a softirq.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Tested-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   24690:dcc6d57e4c07
xen-unstable date:        Thu Feb 02 15:28:58 2012 +0000
---


diff -r 3b9b0d4003a3 -r 4cb8d9c9d46b xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c	Thu Feb 23 10:30:50 2012 +0000
+++ b/xen/arch/x86/traps.c	Thu Feb 23 10:31:48 2012 +0000
@@ -3049,6 +3049,11 @@
     st->vcpu = NULL;
 }
 
+static void pci_serr_softirq(void)
+{
+    printk("\n\nNMI - PCI system error (SERR)\n");
+}
+
 void async_exception_cleanup(struct vcpu *curr)
 {
     int trap;
@@ -3138,10 +3143,11 @@
 
 static void pci_serr_error(struct cpu_user_regs *regs)
 {
-    console_force_unlock();
-    printk("\n\nNMI - PCI system error (SERR)\n");
-
     outb((inb(0x61) & 0x0f) | 0x04, 0x61); /* clear-and-disable the PCI SERR error line. */
+
+    /* Would like to print a diagnostic here but can't call printk()
+       from NMI context -- raise a softirq instead. */
+    raise_softirq(PCI_SERR_SOFTIRQ);
 }
 
 static void io_check_error(struct cpu_user_regs *regs)
@@ -3444,6 +3450,7 @@
     cpu_init();
 
     open_softirq(NMI_MCE_SOFTIRQ, nmi_mce_softirq);
+    open_softirq(PCI_SERR_SOFTIRQ, pci_serr_softirq);
 }
 
 long register_guest_nmi_callback(unsigned long address)
diff -r 3b9b0d4003a3 -r 4cb8d9c9d46b xen/include/asm-x86/softirq.h
--- a/xen/include/asm-x86/softirq.h	Thu Feb 23 10:30:50 2012 +0000
+++ b/xen/include/asm-x86/softirq.h	Thu Feb 23 10:31:48 2012 +0000
@@ -6,6 +6,7 @@
 #define VCPU_KICK_SOFTIRQ      (NR_COMMON_SOFTIRQS + 2)
 
 #define MACHINE_CHECK_SOFTIRQ  (NR_COMMON_SOFTIRQS + 3)
-#define NR_ARCH_SOFTIRQS       4
+#define PCI_SERR_SOFTIRQ       (NR_COMMON_SOFTIRQS + 4)
+#define NR_ARCH_SOFTIRQS       5
 
 #endif /* __ASM_SOFTIRQ_H__ */

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 20:44:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 20:44:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0fWQ-00083z-GT; Thu, 23 Feb 2012 20:44:14 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWO-00083f-7s
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:12 +0000
Received: from [85.158.139.83:34304] by server-4.bemta-5.messagelabs.com id
	B6/B9-10788-B15A64F4; Thu, 23 Feb 2012 20:44:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-182.messagelabs.com!1330029849!9062816!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14257 invoked from network); 23 Feb 2012 20:44:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 20:44:10 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWL-00085f-Bl
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWL-0006eb-8G
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:09 +0000
Message-Id: <E1S0fWL-0006eb-8G@xenbits.xen.org>
Date: Thu, 23 Feb 2012 20:44:08 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] x86: avoid deadlock after a PCI
	SERR NMI
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1329993108 0
# Node ID 4cb8d9c9d46bbb64bd9ac1d7b71b085d57fe6c96
# Parent  3b9b0d4003a3fa670e64e15a7af5a5c107bc0a37
x86: avoid deadlock after a PCI SERR NMI

If a PCI System Error (SERR) is asserted it causes an NMI. If this NMI
occurs while the CPU is in printk() then Xen may deadlock as
pci_serr_error() calls console_force_unlock() which screws up the
console lock.

printk() isn't safe to call from NMI context so defer the diagnostic
message to a softirq.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Tested-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   24690:dcc6d57e4c07
xen-unstable date:        Thu Feb 02 15:28:58 2012 +0000
---


diff -r 3b9b0d4003a3 -r 4cb8d9c9d46b xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c	Thu Feb 23 10:30:50 2012 +0000
+++ b/xen/arch/x86/traps.c	Thu Feb 23 10:31:48 2012 +0000
@@ -3049,6 +3049,11 @@
     st->vcpu = NULL;
 }
 
+static void pci_serr_softirq(void)
+{
+    printk("\n\nNMI - PCI system error (SERR)\n");
+}
+
 void async_exception_cleanup(struct vcpu *curr)
 {
     int trap;
@@ -3138,10 +3143,11 @@
 
 static void pci_serr_error(struct cpu_user_regs *regs)
 {
-    console_force_unlock();
-    printk("\n\nNMI - PCI system error (SERR)\n");
-
     outb((inb(0x61) & 0x0f) | 0x04, 0x61); /* clear-and-disable the PCI SERR error line. */
+
+    /* Would like to print a diagnostic here but can't call printk()
+       from NMI context -- raise a softirq instead. */
+    raise_softirq(PCI_SERR_SOFTIRQ);
 }
 
 static void io_check_error(struct cpu_user_regs *regs)
@@ -3444,6 +3450,7 @@
     cpu_init();
 
     open_softirq(NMI_MCE_SOFTIRQ, nmi_mce_softirq);
+    open_softirq(PCI_SERR_SOFTIRQ, pci_serr_softirq);
 }
 
 long register_guest_nmi_callback(unsigned long address)
diff -r 3b9b0d4003a3 -r 4cb8d9c9d46b xen/include/asm-x86/softirq.h
--- a/xen/include/asm-x86/softirq.h	Thu Feb 23 10:30:50 2012 +0000
+++ b/xen/include/asm-x86/softirq.h	Thu Feb 23 10:31:48 2012 +0000
@@ -6,6 +6,7 @@
 #define VCPU_KICK_SOFTIRQ      (NR_COMMON_SOFTIRQS + 2)
 
 #define MACHINE_CHECK_SOFTIRQ  (NR_COMMON_SOFTIRQS + 3)
-#define NR_ARCH_SOFTIRQS       4
+#define PCI_SERR_SOFTIRQ       (NR_COMMON_SOFTIRQS + 4)
+#define NR_ARCH_SOFTIRQS       5
 
 #endif /* __ASM_SOFTIRQ_H__ */

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

From xen-changelog-bounces@lists.xen.org Thu Feb 23 20:44:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 20:44:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0fWT-00084a-M8; Thu, 23 Feb 2012 20:44:17 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWS-00083p-Qo
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-27.messagelabs.com!1330029776!62672971!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13882 invoked from network); 23 Feb 2012 20:42:57 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 20:42:57 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWM-00085o-Vs
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWM-0006fh-Qp
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:10 +0000
Message-Id: <E1S0fWM-0006fh-Qp@xenbits.xen.org>
Date: Thu, 23 Feb 2012 20:44:10 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] mini-os: stop compiler complaint
	about unused variables
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User John McDermott <john.mcdermott@nrl.navy.mil>
# Date 1329993341 0
# Node ID bc8f88be9e4b01d39724e568dde5644338cfde4b
# Parent  8435c27b34990831718a8f625e5addddee74d62b
mini-os: stop compiler complaint about unused variables

gcc (GCC) 4.6.2 20111027 (Red Hat 4.6.2-1) complains about unused
variables
in mini-os drivers

Signed-off-by: John McDermott <john.mcdermott@nrl.navy.mil>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
xen-unstable changeset:   24743:86f2630d62a9
xen-unstable date:        Thu Feb 09 16:03:05 2012 +0000

minios: Remove unused variables warnings

s/DEBUG/printk/ in test_xenbus and all associated
do_*_test+xenbus_dbg_message
and always print the IRQ and MFN used by the xenbus on init.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Tested-by: John McDermott <john.mcdermott@nrl.navy.mil>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
xen-unstable changeset:   24844:c78636d15ac5
xen-unstable date:        Mon Feb 20 18:48:32 2012 +0000

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


diff -r 8435c27b3499 -r bc8f88be9e4b extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c	Thu Feb 23 10:34:14 2012 +0000
+++ b/extras/mini-os/blkfront.c	Thu Feb 23 10:35:41 2012 +0000
@@ -171,6 +171,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:
diff -r 8435c27b3499 -r bc8f88be9e4b extras/mini-os/console/xencons_ring.c
--- a/extras/mini-os/console/xencons_ring.c	Thu Feb 23 10:34:14 2012 +0000
+++ b/extras/mini-os/console/xencons_ring.c	Thu Feb 23 10:35:41 2012 +0000
@@ -317,6 +317,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:
diff -r 8435c27b3499 -r bc8f88be9e4b extras/mini-os/fbfront.c
--- a/extras/mini-os/fbfront.c	Thu Feb 23 10:34:14 2012 +0000
+++ b/extras/mini-os/fbfront.c	Thu Feb 23 10:35:41 2012 +0000
@@ -142,6 +142,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:
@@ -503,6 +504,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:
diff -r 8435c27b3499 -r bc8f88be9e4b extras/mini-os/netfront.c
--- a/extras/mini-os/netfront.c	Thu Feb 23 10:34:14 2012 +0000
+++ b/extras/mini-os/netfront.c	Thu Feb 23 10:35:41 2012 +0000
@@ -421,6 +421,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:
diff -r 8435c27b3499 -r bc8f88be9e4b extras/mini-os/pcifront.c
--- a/extras/mini-os/pcifront.c	Thu Feb 23 10:34:14 2012 +0000
+++ b/extras/mini-os/pcifront.c	Thu Feb 23 10:35:41 2012 +0000
@@ -222,6 +222,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:
diff -r 8435c27b3499 -r bc8f88be9e4b extras/mini-os/xenbus/xenbus.c
--- a/extras/mini-os/xenbus/xenbus.c	Thu Feb 23 10:34:14 2012 +0000
+++ b/extras/mini-os/xenbus/xenbus.c	Thu Feb 23 10:35:41 2012 +0000
@@ -328,7 +328,6 @@
 void init_xenbus(void)
 {
     int err;
-    printk("Initialising xenbus\n");
     DEBUG("init_xenbus called.\n");
     xenstore_buf = mfn_to_virt(start_info.store_mfn);
     create_thread("xenstore", xenbus_thread_func, NULL);
@@ -337,7 +336,8 @@
 		      xenbus_evtchn_handler,
               NULL);
     unmask_evtchn(start_info.store_evtchn);
-    DEBUG("xenbus on irq %d\n", err);
+    printk("xenbus initialised on irq %d mfn %#lx\n",
+	   err, start_info.store_mfn);
 }
 
 void fini_xenbus(void)
@@ -478,7 +478,7 @@
     struct xsd_sockmsg *reply;
 
     reply = xenbus_msg_reply(XS_DEBUG, 0, req, ARRAY_SIZE(req));
-    DEBUG("Got a reply, type %d, id %d, len %d.\n",
+    printk("Got a reply, type %d, id %d, len %d.\n",
             reply->type, reply->req_id, reply->len);
 }
 
@@ -752,16 +752,16 @@
     char **dirs, *msg;
     int x;
 
-    DEBUG("ls %s...\n", pre);
+    printk("ls %s...\n", pre);
     msg = xenbus_ls(XBT_NIL, pre, &dirs);
     if (msg) {
-	DEBUG("Error in xenbus ls: %s\n", msg);
+	printk("Error in xenbus ls: %s\n", msg);
 	free(msg);
 	return;
     }
     for (x = 0; dirs[x]; x++) 
     {
-        DEBUG("ls %s[%d] -> %s\n", pre, x, dirs[x]);
+        printk("ls %s[%d] -> %s\n", pre, x, dirs[x]);
         free(dirs[x]);
     }
     free(dirs);
@@ -770,68 +770,68 @@
 static void do_read_test(const char *path)
 {
     char *res, *msg;
-    DEBUG("Read %s...\n", path);
+    printk("Read %s...\n", path);
     msg = xenbus_read(XBT_NIL, path, &res);
     if (msg) {
-	DEBUG("Error in xenbus read: %s\n", msg);
+	printk("Error in xenbus read: %s\n", msg);
 	free(msg);
 	return;
     }
-    DEBUG("Read %s -> %s.\n", path, res);
+    printk("Read %s -> %s.\n", path, res);
     free(res);
 }
 
 static void do_write_test(const char *path, const char *val)
 {
     char *msg;
-    DEBUG("Write %s to %s...\n", val, path);
+    printk("Write %s to %s...\n", val, path);
     msg = xenbus_write(XBT_NIL, path, val);
     if (msg) {
-	DEBUG("Result %s\n", msg);
+	printk("Result %s\n", msg);
 	free(msg);
     } else {
-	DEBUG("Success.\n");
+	printk("Success.\n");
     }
 }
 
 static void do_rm_test(const char *path)
 {
     char *msg;
-    DEBUG("rm %s...\n", path);
+    printk("rm %s...\n", path);
     msg = xenbus_rm(XBT_NIL, path);
     if (msg) {
-	DEBUG("Result %s\n", msg);
+	printk("Result %s\n", msg);
 	free(msg);
     } else {
-	DEBUG("Success.\n");
+	printk("Success.\n");
     }
 }
 
 /* Simple testing thing */
 void test_xenbus(void)
 {
-    DEBUG("Doing xenbus test.\n");
+    printk("Doing xenbus test.\n");
     xenbus_debug_msg("Testing xenbus...\n");
 
-    DEBUG("Doing ls test.\n");
+    printk("Doing ls test.\n");
     do_ls_test("device");
     do_ls_test("device/vif");
     do_ls_test("device/vif/0");
 
-    DEBUG("Doing read test.\n");
+    printk("Doing read test.\n");
     do_read_test("device/vif/0/mac");
     do_read_test("device/vif/0/backend");
 
-    DEBUG("Doing write test.\n");
+    printk("Doing write test.\n");
     do_write_test("device/vif/0/flibble", "flobble");
     do_read_test("device/vif/0/flibble");
     do_write_test("device/vif/0/flibble", "widget");
     do_read_test("device/vif/0/flibble");
 
-    DEBUG("Doing rm test.\n");
+    printk("Doing rm test.\n");
     do_rm_test("device/vif/0/flibble");
     do_read_test("device/vif/0/flibble");
-    DEBUG("(Should have said ENOENT)\n");
+    printk("(Should have said ENOENT)\n");
 }
 
 /*

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Thu Feb 23 20:44:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 20:44:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0fWT-00084a-M8; Thu, 23 Feb 2012 20:44:17 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWS-00083p-Qo
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-27.messagelabs.com!1330029776!62672971!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13882 invoked from network); 23 Feb 2012 20:42:57 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 20:42:57 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWM-00085o-Vs
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWM-0006fh-Qp
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:10 +0000
Message-Id: <E1S0fWM-0006fh-Qp@xenbits.xen.org>
Date: Thu, 23 Feb 2012 20:44:10 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] mini-os: stop compiler complaint
	about unused variables
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User John McDermott <john.mcdermott@nrl.navy.mil>
# Date 1329993341 0
# Node ID bc8f88be9e4b01d39724e568dde5644338cfde4b
# Parent  8435c27b34990831718a8f625e5addddee74d62b
mini-os: stop compiler complaint about unused variables

gcc (GCC) 4.6.2 20111027 (Red Hat 4.6.2-1) complains about unused
variables
in mini-os drivers

Signed-off-by: John McDermott <john.mcdermott@nrl.navy.mil>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
xen-unstable changeset:   24743:86f2630d62a9
xen-unstable date:        Thu Feb 09 16:03:05 2012 +0000

minios: Remove unused variables warnings

s/DEBUG/printk/ in test_xenbus and all associated
do_*_test+xenbus_dbg_message
and always print the IRQ and MFN used by the xenbus on init.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Tested-by: John McDermott <john.mcdermott@nrl.navy.mil>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
xen-unstable changeset:   24844:c78636d15ac5
xen-unstable date:        Mon Feb 20 18:48:32 2012 +0000

Backported-by: Keir Fraser <keir@xen.org>
---


diff -r 8435c27b3499 -r bc8f88be9e4b extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c	Thu Feb 23 10:34:14 2012 +0000
+++ b/extras/mini-os/blkfront.c	Thu Feb 23 10:35:41 2012 +0000
@@ -171,6 +171,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:
diff -r 8435c27b3499 -r bc8f88be9e4b extras/mini-os/console/xencons_ring.c
--- a/extras/mini-os/console/xencons_ring.c	Thu Feb 23 10:34:14 2012 +0000
+++ b/extras/mini-os/console/xencons_ring.c	Thu Feb 23 10:35:41 2012 +0000
@@ -317,6 +317,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:
diff -r 8435c27b3499 -r bc8f88be9e4b extras/mini-os/fbfront.c
--- a/extras/mini-os/fbfront.c	Thu Feb 23 10:34:14 2012 +0000
+++ b/extras/mini-os/fbfront.c	Thu Feb 23 10:35:41 2012 +0000
@@ -142,6 +142,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:
@@ -503,6 +504,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:
diff -r 8435c27b3499 -r bc8f88be9e4b extras/mini-os/netfront.c
--- a/extras/mini-os/netfront.c	Thu Feb 23 10:34:14 2012 +0000
+++ b/extras/mini-os/netfront.c	Thu Feb 23 10:35:41 2012 +0000
@@ -421,6 +421,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:
diff -r 8435c27b3499 -r bc8f88be9e4b extras/mini-os/pcifront.c
--- a/extras/mini-os/pcifront.c	Thu Feb 23 10:34:14 2012 +0000
+++ b/extras/mini-os/pcifront.c	Thu Feb 23 10:35:41 2012 +0000
@@ -222,6 +222,7 @@
 abort_transaction:
     free(err);
     err = xenbus_transaction_end(xbt, 1, &retry);
+    printk("Abort transaction %s\n", message);
     goto error;
 
 done:
diff -r 8435c27b3499 -r bc8f88be9e4b extras/mini-os/xenbus/xenbus.c
--- a/extras/mini-os/xenbus/xenbus.c	Thu Feb 23 10:34:14 2012 +0000
+++ b/extras/mini-os/xenbus/xenbus.c	Thu Feb 23 10:35:41 2012 +0000
@@ -328,7 +328,6 @@
 void init_xenbus(void)
 {
     int err;
-    printk("Initialising xenbus\n");
     DEBUG("init_xenbus called.\n");
     xenstore_buf = mfn_to_virt(start_info.store_mfn);
     create_thread("xenstore", xenbus_thread_func, NULL);
@@ -337,7 +336,8 @@
 		      xenbus_evtchn_handler,
               NULL);
     unmask_evtchn(start_info.store_evtchn);
-    DEBUG("xenbus on irq %d\n", err);
+    printk("xenbus initialised on irq %d mfn %#lx\n",
+	   err, start_info.store_mfn);
 }
 
 void fini_xenbus(void)
@@ -478,7 +478,7 @@
     struct xsd_sockmsg *reply;
 
     reply = xenbus_msg_reply(XS_DEBUG, 0, req, ARRAY_SIZE(req));
-    DEBUG("Got a reply, type %d, id %d, len %d.\n",
+    printk("Got a reply, type %d, id %d, len %d.\n",
             reply->type, reply->req_id, reply->len);
 }
 
@@ -752,16 +752,16 @@
     char **dirs, *msg;
     int x;
 
-    DEBUG("ls %s...\n", pre);
+    printk("ls %s...\n", pre);
     msg = xenbus_ls(XBT_NIL, pre, &dirs);
     if (msg) {
-	DEBUG("Error in xenbus ls: %s\n", msg);
+	printk("Error in xenbus ls: %s\n", msg);
 	free(msg);
 	return;
     }
     for (x = 0; dirs[x]; x++) 
     {
-        DEBUG("ls %s[%d] -> %s\n", pre, x, dirs[x]);
+        printk("ls %s[%d] -> %s\n", pre, x, dirs[x]);
         free(dirs[x]);
     }
     free(dirs);
@@ -770,68 +770,68 @@
 static void do_read_test(const char *path)
 {
     char *res, *msg;
-    DEBUG("Read %s...\n", path);
+    printk("Read %s...\n", path);
     msg = xenbus_read(XBT_NIL, path, &res);
     if (msg) {
-	DEBUG("Error in xenbus read: %s\n", msg);
+	printk("Error in xenbus read: %s\n", msg);
 	free(msg);
 	return;
     }
-    DEBUG("Read %s -> %s.\n", path, res);
+    printk("Read %s -> %s.\n", path, res);
     free(res);
 }
 
 static void do_write_test(const char *path, const char *val)
 {
     char *msg;
-    DEBUG("Write %s to %s...\n", val, path);
+    printk("Write %s to %s...\n", val, path);
     msg = xenbus_write(XBT_NIL, path, val);
     if (msg) {
-	DEBUG("Result %s\n", msg);
+	printk("Result %s\n", msg);
 	free(msg);
     } else {
-	DEBUG("Success.\n");
+	printk("Success.\n");
     }
 }
 
 static void do_rm_test(const char *path)
 {
     char *msg;
-    DEBUG("rm %s...\n", path);
+    printk("rm %s...\n", path);
     msg = xenbus_rm(XBT_NIL, path);
     if (msg) {
-	DEBUG("Result %s\n", msg);
+	printk("Result %s\n", msg);
 	free(msg);
     } else {
-	DEBUG("Success.\n");
+	printk("Success.\n");
     }
 }
 
 /* Simple testing thing */
 void test_xenbus(void)
 {
-    DEBUG("Doing xenbus test.\n");
+    printk("Doing xenbus test.\n");
     xenbus_debug_msg("Testing xenbus...\n");
 
-    DEBUG("Doing ls test.\n");
+    printk("Doing ls test.\n");
     do_ls_test("device");
     do_ls_test("device/vif");
     do_ls_test("device/vif/0");
 
-    DEBUG("Doing read test.\n");
+    printk("Doing read test.\n");
     do_read_test("device/vif/0/mac");
     do_read_test("device/vif/0/backend");
 
-    DEBUG("Doing write test.\n");
+    printk("Doing write test.\n");
     do_write_test("device/vif/0/flibble", "flobble");
     do_read_test("device/vif/0/flibble");
     do_write_test("device/vif/0/flibble", "widget");
     do_read_test("device/vif/0/flibble");
 
-    DEBUG("Doing rm test.\n");
+    printk("Doing rm test.\n");
     do_rm_test("device/vif/0/flibble");
     do_read_test("device/vif/0/flibble");
-    DEBUG("(Should have said ENOENT)\n");
+    printk("(Should have said ENOENT)\n");
 }
 
 /*

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Thu Feb 23 20:44:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 20:44:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0fWS-00084A-Jl; Thu, 23 Feb 2012 20:44:16 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWS-00083o-3C
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1330029796!54059700!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4443 invoked from network); 23 Feb 2012 20:43:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 20:43:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWM-00085l-Ej
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWM-0006fL-A0
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:10 +0000
Message-Id: <E1S0fWM-0006fL-A0@xenbits.xen.org>
Date: Thu, 23 Feb 2012 20:44:09 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] gnttab: miscellaneous fixes
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1329993254 0
# Node ID 8435c27b34990831718a8f625e5addddee74d62b
# Parent  0b0d74c970102af1ddcc4eddd9563b5a945df5e1
gnttab: miscellaneous fixes

- _GTF_* constants name bit positions, so binary arithmetic on them is
  wrong
- gnttab_clear_flag() cannot (on x86 and ia64 at least) simply use
  clear_bit(), as that may access more than the two bytes that are
  intended to be accessed

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   24742:9fc810bb8145
xen-unstable date:        Thu Feb 09 16:39:16 2012 +0100
---


diff -r 0b0d74c97010 -r 8435c27b3499 xen/common/grant_table.c
--- a/xen/common/grant_table.c	Thu Feb 23 10:32:48 2012 +0000
+++ b/xen/common/grant_table.c	Thu Feb 23 10:34:14 2012 +0000
@@ -389,7 +389,8 @@
              (id != domid) ||
              (!readonly && (flags & GTF_readonly)) )
         {
-            gnttab_clear_flag(_GTF_reading | _GTF_writing, status);
+            gnttab_clear_flag(_GTF_writing, status);
+            gnttab_clear_flag(_GTF_reading, status);
             PIN_FAIL(done, GNTST_general_error,
                      "Unstable flags (%x) or dom (%d). (expected dom %d) "
                      "(r/w: %d)\n",
@@ -1703,14 +1704,14 @@
    under the domain's grant table lock. */
 /* Only safe on transitive grants.  Even then, note that we don't
    attempt to drop any pin on the referent grant. */
-static void __fixup_status_for_pin(struct active_grant_entry *act,
+static void __fixup_status_for_pin(const struct active_grant_entry *act,
                                    uint16_t *status)
 {
     if ( !(act->pin & GNTPIN_hstw_mask) )
-        *status &= ~_GTF_writing;
+        *status &= ~GTF_writing;
 
     if ( !(act->pin & GNTPIN_hstr_mask) )
-        *status &= ~_GTF_reading;
+        *status &= ~GTF_reading;
 }
 
 /* Grab a frame number from a grant entry and update the flags and pin
diff -r 0b0d74c97010 -r 8435c27b3499 xen/include/asm-ia64/grant_table.h
--- a/xen/include/asm-ia64/grant_table.h	Thu Feb 23 10:32:48 2012 +0000
+++ b/xen/include/asm-ia64/grant_table.h	Thu Feb 23 10:34:14 2012 +0000
@@ -5,6 +5,8 @@
 #ifndef __ASM_GRANT_TABLE_H__
 #define __ASM_GRANT_TABLE_H__
 
+#include <asm/intrinsics.h>
+
 #define INITIAL_NR_GRANT_FRAMES 1
 
 // for grant map/unmap
@@ -82,9 +84,19 @@
 
 #define gnttab_mark_dirty(d, f) ((void)f)
 
-static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
+static inline void gnttab_clear_flag(unsigned int nr, volatile uint16_t *st)
 {
-	clear_bit(nr, addr);
+	/*
+	 * Note that this cannot be clear_bit(), as the access must be
+	 * confined to the specified 2 bytes.
+	 */
+	uint16_t mask = ~(1 << nr), old;
+	CMPXCHG_BUGCHECK_DECL
+
+	do {
+		CMPXCHG_BUGCHECK(st);
+		old = *st;
+	} while (cmpxchg_rel(st, old, old & mask) != old);
 }
 
 #define gnttab_host_mapping_get_page_type(op, ld, rd)   \
diff -r 0b0d74c97010 -r 8435c27b3499 xen/include/asm-x86/grant_table.h
--- a/xen/include/asm-x86/grant_table.h	Thu Feb 23 10:32:48 2012 +0000
+++ b/xen/include/asm-x86/grant_table.h	Thu Feb 23 10:34:14 2012 +0000
@@ -48,9 +48,13 @@
 
 #define gnttab_mark_dirty(d, f) paging_mark_dirty((d), (f))
 
-static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
+static inline void gnttab_clear_flag(unsigned int nr, uint16_t *st)
 {
-    clear_bit(nr, (unsigned long *)addr);
+    /*
+     * Note that this cannot be clear_bit(), as the access must be
+     * confined to the specified 2 bytes.
+     */
+    asm volatile ("lock btrw %1,%0" : "=m" (*st) : "Ir" (nr), "m" (*st));
 }
 
 /* Foreign mappings of HHVM-guest pages do not modify the type count. */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Thu Feb 23 20:44:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 20:44:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0fWS-00084A-Jl; Thu, 23 Feb 2012 20:44:16 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWS-00083o-3C
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1330029796!54059700!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4443 invoked from network); 23 Feb 2012 20:43:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 20:43:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWM-00085l-Ej
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWM-0006fL-A0
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:10 +0000
Message-Id: <E1S0fWM-0006fL-A0@xenbits.xen.org>
Date: Thu, 23 Feb 2012 20:44:09 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] gnttab: miscellaneous fixes
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1329993254 0
# Node ID 8435c27b34990831718a8f625e5addddee74d62b
# Parent  0b0d74c970102af1ddcc4eddd9563b5a945df5e1
gnttab: miscellaneous fixes

- _GTF_* constants name bit positions, so binary arithmetic on them is
  wrong
- gnttab_clear_flag() cannot (on x86 and ia64 at least) simply use
  clear_bit(), as that may access more than the two bytes that are
  intended to be accessed

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   24742:9fc810bb8145
xen-unstable date:        Thu Feb 09 16:39:16 2012 +0100
---


diff -r 0b0d74c97010 -r 8435c27b3499 xen/common/grant_table.c
--- a/xen/common/grant_table.c	Thu Feb 23 10:32:48 2012 +0000
+++ b/xen/common/grant_table.c	Thu Feb 23 10:34:14 2012 +0000
@@ -389,7 +389,8 @@
              (id != domid) ||
              (!readonly && (flags & GTF_readonly)) )
         {
-            gnttab_clear_flag(_GTF_reading | _GTF_writing, status);
+            gnttab_clear_flag(_GTF_writing, status);
+            gnttab_clear_flag(_GTF_reading, status);
             PIN_FAIL(done, GNTST_general_error,
                      "Unstable flags (%x) or dom (%d). (expected dom %d) "
                      "(r/w: %d)\n",
@@ -1703,14 +1704,14 @@
    under the domain's grant table lock. */
 /* Only safe on transitive grants.  Even then, note that we don't
    attempt to drop any pin on the referent grant. */
-static void __fixup_status_for_pin(struct active_grant_entry *act,
+static void __fixup_status_for_pin(const struct active_grant_entry *act,
                                    uint16_t *status)
 {
     if ( !(act->pin & GNTPIN_hstw_mask) )
-        *status &= ~_GTF_writing;
+        *status &= ~GTF_writing;
 
     if ( !(act->pin & GNTPIN_hstr_mask) )
-        *status &= ~_GTF_reading;
+        *status &= ~GTF_reading;
 }
 
 /* Grab a frame number from a grant entry and update the flags and pin
diff -r 0b0d74c97010 -r 8435c27b3499 xen/include/asm-ia64/grant_table.h
--- a/xen/include/asm-ia64/grant_table.h	Thu Feb 23 10:32:48 2012 +0000
+++ b/xen/include/asm-ia64/grant_table.h	Thu Feb 23 10:34:14 2012 +0000
@@ -5,6 +5,8 @@
 #ifndef __ASM_GRANT_TABLE_H__
 #define __ASM_GRANT_TABLE_H__
 
+#include <asm/intrinsics.h>
+
 #define INITIAL_NR_GRANT_FRAMES 1
 
 // for grant map/unmap
@@ -82,9 +84,19 @@
 
 #define gnttab_mark_dirty(d, f) ((void)f)
 
-static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
+static inline void gnttab_clear_flag(unsigned int nr, volatile uint16_t *st)
 {
-	clear_bit(nr, addr);
+	/*
+	 * Note that this cannot be clear_bit(), as the access must be
+	 * confined to the specified 2 bytes.
+	 */
+	uint16_t mask = ~(1 << nr), old;
+	CMPXCHG_BUGCHECK_DECL
+
+	do {
+		CMPXCHG_BUGCHECK(st);
+		old = *st;
+	} while (cmpxchg_rel(st, old, old & mask) != old);
 }
 
 #define gnttab_host_mapping_get_page_type(op, ld, rd)   \
diff -r 0b0d74c97010 -r 8435c27b3499 xen/include/asm-x86/grant_table.h
--- a/xen/include/asm-x86/grant_table.h	Thu Feb 23 10:32:48 2012 +0000
+++ b/xen/include/asm-x86/grant_table.h	Thu Feb 23 10:34:14 2012 +0000
@@ -48,9 +48,13 @@
 
 #define gnttab_mark_dirty(d, f) paging_mark_dirty((d), (f))
 
-static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
+static inline void gnttab_clear_flag(unsigned int nr, uint16_t *st)
 {
-    clear_bit(nr, (unsigned long *)addr);
+    /*
+     * Note that this cannot be clear_bit(), as the access must be
+     * confined to the specified 2 bytes.
+     */
+    asm volatile ("lock btrw %1,%0" : "=m" (*st) : "Ir" (nr), "m" (*st));
 }
 
 /* Foreign mappings of HHVM-guest pages do not modify the type count. */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Thu Feb 23 20:44:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 20:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0fWW-00085h-Rd; Thu, 23 Feb 2012 20:44:20 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWV-00083y-VR
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1330029850!9836006!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29270 invoked from network); 23 Feb 2012 20:44:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 20:44:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWM-00085i-1X
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWL-0006ey-PN
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:09 +0000
Message-Id: <E1S0fWL-0006ey-PN@xenbits.xen.org>
Date: Thu, 23 Feb 2012 20:44:09 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] IO-APIC: Reformat IO-APIC RTE
	debug info (v2)
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1329993168 0
# Node ID 0b0d74c970102af1ddcc4eddd9563b5a945df5e1
# Parent  4cb8d9c9d46bbb64bd9ac1d7b71b085d57fe6c96
IO-APIC: Reformat IO-APIC RTE debug info (v2)

Having the columns aligned makes for much easier reading.  Also remove
the commas which only add to visual clutter in combination with
spaces.

Furthermore, printing fewer characters makes it less likely that the
serial buffer will overflow resulting in loss of critical debugging
information.

Changes since v1:
 *  Format vector as hex rather than dec
 *  Contract some names
 *  destination mode uses 'L' or 'P' instead of full words
 *  trigger mode uses 'L' or 'E' instead of full words
 *  delivery mode uses short string instead of a number

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   24700:5bd5830dea13
xen-unstable date:        Mon Feb 06 13:17:46 2012 -0800
---


diff -r 4cb8d9c9d46b -r 0b0d74c97010 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Thu Feb 23 10:31:48 2012 +0000
+++ b/xen/arch/x86/io_apic.c	Thu Feb 23 10:32:48 2012 +0000
@@ -2554,6 +2554,23 @@
     return 0;
 }
 
+static const char * delivery_mode_2_str(
+    const enum ioapic_irq_destination_types mode)
+{
+    switch ( mode )
+    {
+    case dest_Fixed: return "Fixed";
+    case dest_LowestPrio: return "LoPri";
+    case dest_SMI: return "SMI";
+    case dest_NMI: return "NMI";
+    case dest_INIT: return "INIT";
+    case dest_ExtINT: return "ExINT";
+    case dest__reserved_1:
+    case dest__reserved_2: return "Resvd";
+    default: return "INVAL";
+    }
+}
+
 void dump_ioapic_irq_info(void)
 {
     struct irq_pin_list *entry;
@@ -2586,13 +2603,12 @@
             *(((int *)&rte) + 1) = io_apic_read(entry->apic, 0x11 + 2 * pin);
             spin_unlock_irqrestore(&ioapic_lock, flags);
 
-            printk("vector=%u, delivery_mode=%u, dest_mode=%s, "
-                   "delivery_status=%d, polarity=%d, irr=%d, "
-                   "trigger=%s, mask=%d, dest_id:%d\n",
-                   rte.vector, rte.delivery_mode,
-                   rte.dest_mode ? "logical" : "physical",
+            printk("vec=%02x delivery=%-5s dest=%c status=%d "
+                   "polarity=%d irr=%d trig=%c mask=%d dest_id:%d\n",
+                   rte.vector, delivery_mode_2_str(rte.delivery_mode),
+                   rte.dest_mode ? 'L' : 'P',
                    rte.delivery_status, rte.polarity, rte.irr,
-                   rte.trigger ? "level" : "edge", rte.mask,
+                   rte.trigger ? 'L' : 'E', rte.mask,
                    rte.dest.logical.logical_dest);
 
             if ( entry->next == 0 )

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Thu Feb 23 20:44:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 20:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0fWW-00085h-Rd; Thu, 23 Feb 2012 20:44:20 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWV-00083y-VR
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1330029850!9836006!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29270 invoked from network); 23 Feb 2012 20:44:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 20:44:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWM-00085i-1X
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWL-0006ey-PN
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:09 +0000
Message-Id: <E1S0fWL-0006ey-PN@xenbits.xen.org>
Date: Thu, 23 Feb 2012 20:44:09 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] IO-APIC: Reformat IO-APIC RTE
	debug info (v2)
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1329993168 0
# Node ID 0b0d74c970102af1ddcc4eddd9563b5a945df5e1
# Parent  4cb8d9c9d46bbb64bd9ac1d7b71b085d57fe6c96
IO-APIC: Reformat IO-APIC RTE debug info (v2)

Having the columns aligned makes for much easier reading.  Also remove
the commas which only add to visual clutter in combination with
spaces.

Furthermore, printing fewer characters makes it less likely that the
serial buffer will overflow resulting in loss of critical debugging
information.

Changes since v1:
 *  Format vector as hex rather than dec
 *  Contract some names
 *  destination mode uses 'L' or 'P' instead of full words
 *  trigger mode uses 'L' or 'E' instead of full words
 *  delivery mode uses short string instead of a number

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   24700:5bd5830dea13
xen-unstable date:        Mon Feb 06 13:17:46 2012 -0800
---


diff -r 4cb8d9c9d46b -r 0b0d74c97010 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Thu Feb 23 10:31:48 2012 +0000
+++ b/xen/arch/x86/io_apic.c	Thu Feb 23 10:32:48 2012 +0000
@@ -2554,6 +2554,23 @@
     return 0;
 }
 
+static const char * delivery_mode_2_str(
+    const enum ioapic_irq_destination_types mode)
+{
+    switch ( mode )
+    {
+    case dest_Fixed: return "Fixed";
+    case dest_LowestPrio: return "LoPri";
+    case dest_SMI: return "SMI";
+    case dest_NMI: return "NMI";
+    case dest_INIT: return "INIT";
+    case dest_ExtINT: return "ExINT";
+    case dest__reserved_1:
+    case dest__reserved_2: return "Resvd";
+    default: return "INVAL";
+    }
+}
+
 void dump_ioapic_irq_info(void)
 {
     struct irq_pin_list *entry;
@@ -2586,13 +2603,12 @@
             *(((int *)&rte) + 1) = io_apic_read(entry->apic, 0x11 + 2 * pin);
             spin_unlock_irqrestore(&ioapic_lock, flags);
 
-            printk("vector=%u, delivery_mode=%u, dest_mode=%s, "
-                   "delivery_status=%d, polarity=%d, irr=%d, "
-                   "trigger=%s, mask=%d, dest_id:%d\n",
-                   rte.vector, rte.delivery_mode,
-                   rte.dest_mode ? "logical" : "physical",
+            printk("vec=%02x delivery=%-5s dest=%c status=%d "
+                   "polarity=%d irr=%d trig=%c mask=%d dest_id:%d\n",
+                   rte.vector, delivery_mode_2_str(rte.delivery_mode),
+                   rte.dest_mode ? 'L' : 'P',
                    rte.delivery_status, rte.polarity, rte.irr,
-                   rte.trigger ? "level" : "edge", rte.mask,
+                   rte.trigger ? 'L' : 'E', rte.mask,
                    rte.dest.logical.logical_dest);
 
             if ( entry->next == 0 )

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Thu Feb 23 20:44:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 20:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0fWW-00085c-PA; Thu, 23 Feb 2012 20:44:20 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWV-00083x-C4
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1330029851!2365246!1
X-Originating-IP: [50.57.168.107]
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21070 invoked from network); 23 Feb 2012 20:44:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 20:44:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWN-00085r-Cb
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWN-0006g4-BI
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:11 +0000
Message-Id: <E1S0fWN-0006g4-BI@xenbits.xen.org>
Date: Thu, 23 Feb 2012 20:44:10 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] xen: add missing unlock from
	gnttab_get_version
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1329993433 0
# Node ID 04d72f81775d66d159f4f2aea7723bb1ad432564
# Parent  bc8f88be9e4b01d39724e568dde5644338cfde4b
xen: add missing unlock from gnttab_get_version

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reported-by: Francisco Rocha <f.e.liberal-rocha@newcastle.ac.uk>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   24871:66cc5b67e749
xen-unstable date:        Thu Feb 23 09:59:35 2012 +0000
---


diff -r bc8f88be9e4b -r 04d72f81775d xen/common/grant_table.c
--- a/xen/common/grant_table.c	Thu Feb 23 10:35:41 2012 +0000
+++ b/xen/common/grant_table.c	Thu Feb 23 10:37:13 2012 +0000
@@ -2241,6 +2241,8 @@
     op.version = d->grant_table->gt_version;
     spin_unlock(&d->grant_table->lock);
 
+    rcu_unlock_domain(d);
+
     if ( copy_to_guest(uop, &op, 1) )
         return -EFAULT;
     else

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Thu Feb 23 20:44:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2012 20:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0fWW-00085c-PA; Thu, 23 Feb 2012 20:44:20 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWV-00083x-C4
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1330029851!2365246!1
X-Originating-IP: [50.57.168.107]
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21070 invoked from network); 23 Feb 2012 20:44:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Feb 2012 20:44:13 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWN-00085r-Cb
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0fWN-0006g4-BI
	for xen-changelog@lists.xensource.com; Thu, 23 Feb 2012 20:44:11 +0000
Message-Id: <E1S0fWN-0006g4-BI@xenbits.xen.org>
Date: Thu, 23 Feb 2012 20:44:10 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] xen: add missing unlock from
	gnttab_get_version
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1329993433 0
# Node ID 04d72f81775d66d159f4f2aea7723bb1ad432564
# Parent  bc8f88be9e4b01d39724e568dde5644338cfde4b
xen: add missing unlock from gnttab_get_version

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reported-by: Francisco Rocha <f.e.liberal-rocha@newcastle.ac.uk>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   24871:66cc5b67e749
xen-unstable date:        Thu Feb 23 09:59:35 2012 +0000
---


diff -r bc8f88be9e4b -r 04d72f81775d xen/common/grant_table.c
--- a/xen/common/grant_table.c	Thu Feb 23 10:35:41 2012 +0000
+++ b/xen/common/grant_table.c	Thu Feb 23 10:37:13 2012 +0000
@@ -2241,6 +2241,8 @@
     op.version = d->grant_table->gt_version;
     spin_unlock(&d->grant_table->lock);
 
+    rcu_unlock_domain(d);
+
     if ( copy_to_guest(uop, &op, 1) )
         return -EFAULT;
     else

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Fri Feb 24 07:00:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 24 Feb 2012 07:00:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0p8f-0003kk-0r; Fri, 24 Feb 2012 07:00:21 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0p8d-0003kY-GU
	for xen-changelog@lists.xensource.com; Fri, 24 Feb 2012 07:00:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-27.messagelabs.com!1330066743!62719037!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2289 invoked from network); 24 Feb 2012 06:59:04 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	24 Feb 2012 06:59:04 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0p8a-0007Vr-UD
	for xen-changelog@lists.xensource.com; Fri, 24 Feb 2012 07:00:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0p8a-0001Ig-Mc
	for xen-changelog@lists.xensource.com; Fri, 24 Feb 2012 07:00:16 +0000
Message-Id: <E1S0p8a-0001Ig-Mc@xenbits.xen.org>
Date: Fri, 24 Feb 2012 07:00:15 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] xen: add missing unlock from
	gnttab_get_version
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1329993693 0
# Node ID bf902d6661e36a7bd779d7e2501fa54cd698bfd4
# Parent  2fc9ae7ee752f884ce28084ce83c214e3606b9b7
xen: add missing unlock from gnttab_get_version

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reported-by: Francisco Rocha <f.e.liberal-rocha@newcastle.ac.uk>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   24871:66cc5b67e749
xen-unstable date:        Thu Feb 23 09:59:35 2012 +0000
---


diff -r 2fc9ae7ee752 -r bf902d6661e3 xen/common/grant_table.c
--- a/xen/common/grant_table.c	Thu Feb 23 10:40:43 2012 +0000
+++ b/xen/common/grant_table.c	Thu Feb 23 10:41:33 2012 +0000
@@ -2213,6 +2213,8 @@
     op.version = d->grant_table->gt_version;
     spin_unlock(&d->grant_table->lock);
 
+    rcu_unlock_domain(d);
+
     if ( copy_to_guest(uop, &op, 1) )
         return -EFAULT;
     else

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Fri Feb 24 07:00:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 24 Feb 2012 07:00:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0p8f-0003kk-0r; Fri, 24 Feb 2012 07:00:21 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0p8d-0003kY-GU
	for xen-changelog@lists.xensource.com; Fri, 24 Feb 2012 07:00:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-27.messagelabs.com!1330066743!62719037!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2289 invoked from network); 24 Feb 2012 06:59:04 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	24 Feb 2012 06:59:04 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0p8a-0007Vr-UD
	for xen-changelog@lists.xensource.com; Fri, 24 Feb 2012 07:00:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0p8a-0001Ig-Mc
	for xen-changelog@lists.xensource.com; Fri, 24 Feb 2012 07:00:16 +0000
Message-Id: <E1S0p8a-0001Ig-Mc@xenbits.xen.org>
Date: Fri, 24 Feb 2012 07:00:15 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] xen: add missing unlock from
	gnttab_get_version
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1329993693 0
# Node ID bf902d6661e36a7bd779d7e2501fa54cd698bfd4
# Parent  2fc9ae7ee752f884ce28084ce83c214e3606b9b7
xen: add missing unlock from gnttab_get_version

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reported-by: Francisco Rocha <f.e.liberal-rocha@newcastle.ac.uk>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   24871:66cc5b67e749
xen-unstable date:        Thu Feb 23 09:59:35 2012 +0000
---


diff -r 2fc9ae7ee752 -r bf902d6661e3 xen/common/grant_table.c
--- a/xen/common/grant_table.c	Thu Feb 23 10:40:43 2012 +0000
+++ b/xen/common/grant_table.c	Thu Feb 23 10:41:33 2012 +0000
@@ -2213,6 +2213,8 @@
     op.version = d->grant_table->gt_version;
     spin_unlock(&d->grant_table->lock);
 
+    rcu_unlock_domain(d);
+
     if ( copy_to_guest(uop, &op, 1) )
         return -EFAULT;
     else

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Fri Feb 24 07:00:30 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 24 Feb 2012 07:00:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0p8j-0003lC-5U; Fri, 24 Feb 2012 07:00:25 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0p8h-0003kV-QD
	for xen-changelog@lists.xensource.com; Fri, 24 Feb 2012 07:00:24 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-216.messagelabs.com!1330066816!15664030!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19521 invoked from network); 24 Feb 2012 07:00:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	24 Feb 2012 07:00:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0p8Z-0007Vo-Td
	for xen-changelog@lists.xensource.com; Fri, 24 Feb 2012 07:00:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0p8X-0001Hu-Px
	for xen-changelog@lists.xensource.com; Fri, 24 Feb 2012 07:00:14 +0000
Message-Id: <E1S0p8X-0001Hu-Px@xenbits.xen.org>
Date: Fri, 24 Feb 2012 07:00:12 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] gnttab: miscellaneous fixes
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1329993643 0
# Node ID 2fc9ae7ee752f884ce28084ce83c214e3606b9b7
# Parent  3feb83eed6bdd515b90aca528c1ebd83dfb7a378
gnttab: miscellaneous fixes

- _GTF_* constants name bit positions, so binary arithmetic on them is
  wrong
- gnttab_clear_flag() cannot (on x86 and ia64 at least) simply use
  clear_bit(), as that may access more than the two bytes that are
  intended to be accessed

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   24742:9fc810bb8145
xen-unstable date:        Thu Feb 09 16:39:16 2012 +0100
---


diff -r 3feb83eed6bd -r 2fc9ae7ee752 xen/common/grant_table.c
--- a/xen/common/grant_table.c	Thu Feb 02 14:00:32 2012 +0000
+++ b/xen/common/grant_table.c	Thu Feb 23 10:40:43 2012 +0000
@@ -356,7 +356,8 @@
              (id != domid) ||
              (!readonly && (flags & GTF_readonly)) )
         {
-            gnttab_clear_flag(_GTF_reading | _GTF_writing, status);
+            gnttab_clear_flag(_GTF_writing, status);
+            gnttab_clear_flag(_GTF_reading, status);
             PIN_FAIL(done, GNTST_general_error,
                      "Unstable flags (%x) or dom (%d). (expected dom %d) "
                      "(r/w: %d)\n",
@@ -1668,14 +1669,14 @@
    under the domain's grant table lock. */
 /* Only safe on transitive grants.  Even then, note that we don't
    attempt to drop any pin on the referent grant. */
-static void __fixup_status_for_pin(struct active_grant_entry *act,
+static void __fixup_status_for_pin(const struct active_grant_entry *act,
                                    uint16_t *status)
 {
     if ( !(act->pin & GNTPIN_hstw_mask) )
-        *status &= ~_GTF_writing;
+        *status &= ~GTF_writing;
 
     if ( !(act->pin & GNTPIN_hstr_mask) )
-        *status &= ~_GTF_reading;
+        *status &= ~GTF_reading;
 }
 
 /* Grab a frame number from a grant entry and update the flags and pin
diff -r 3feb83eed6bd -r 2fc9ae7ee752 xen/include/asm-ia64/grant_table.h
--- a/xen/include/asm-ia64/grant_table.h	Thu Feb 02 14:00:32 2012 +0000
+++ b/xen/include/asm-ia64/grant_table.h	Thu Feb 23 10:40:43 2012 +0000
@@ -5,6 +5,8 @@
 #ifndef __ASM_GRANT_TABLE_H__
 #define __ASM_GRANT_TABLE_H__
 
+#include <asm/intrinsics.h>
+
 #define INITIAL_NR_GRANT_FRAMES 1
 
 // for grant map/unmap
@@ -82,9 +84,19 @@
 
 #define gnttab_mark_dirty(d, f) ((void)f)
 
-static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
+static inline void gnttab_clear_flag(unsigned int nr, volatile uint16_t *st)
 {
-	clear_bit(nr, addr);
+	/*
+	 * Note that this cannot be clear_bit(), as the access must be
+	 * confined to the specified 2 bytes.
+	 */
+	uint16_t mask = ~(1 << nr), old;
+	CMPXCHG_BUGCHECK_DECL
+
+	do {
+		CMPXCHG_BUGCHECK(st);
+		old = *st;
+	} while (cmpxchg_rel(st, old, old & mask) != old);
 }
 
 #define gnttab_host_mapping_get_page_type(op, ld, rd)   \
diff -r 3feb83eed6bd -r 2fc9ae7ee752 xen/include/asm-x86/grant_table.h
--- a/xen/include/asm-x86/grant_table.h	Thu Feb 02 14:00:32 2012 +0000
+++ b/xen/include/asm-x86/grant_table.h	Thu Feb 23 10:40:43 2012 +0000
@@ -48,9 +48,13 @@
 
 #define gnttab_mark_dirty(d, f) paging_mark_dirty((d), (f))
 
-static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
+static inline void gnttab_clear_flag(unsigned int nr, uint16_t *st)
 {
-    clear_bit(nr, (unsigned long *)addr);
+    /*
+     * Note that this cannot be clear_bit(), as the access must be
+     * confined to the specified 2 bytes.
+     */
+    asm volatile ("lock btrw %1,%0" : "=m" (*st) : "Ir" (nr), "m" (*st));
 }
 
 /* Foreign mappings of HHVM-guest pages do not modify the type count. */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Fri Feb 24 07:00:30 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 24 Feb 2012 07:00:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0p8j-0003lC-5U; Fri, 24 Feb 2012 07:00:25 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0p8h-0003kV-QD
	for xen-changelog@lists.xensource.com; Fri, 24 Feb 2012 07:00:24 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-216.messagelabs.com!1330066816!15664030!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19521 invoked from network); 24 Feb 2012 07:00:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	24 Feb 2012 07:00:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0p8Z-0007Vo-Td
	for xen-changelog@lists.xensource.com; Fri, 24 Feb 2012 07:00:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0p8X-0001Hu-Px
	for xen-changelog@lists.xensource.com; Fri, 24 Feb 2012 07:00:14 +0000
Message-Id: <E1S0p8X-0001Hu-Px@xenbits.xen.org>
Date: Fri, 24 Feb 2012 07:00:12 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] gnttab: miscellaneous fixes
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1329993643 0
# Node ID 2fc9ae7ee752f884ce28084ce83c214e3606b9b7
# Parent  3feb83eed6bdd515b90aca528c1ebd83dfb7a378
gnttab: miscellaneous fixes

- _GTF_* constants name bit positions, so binary arithmetic on them is
  wrong
- gnttab_clear_flag() cannot (on x86 and ia64 at least) simply use
  clear_bit(), as that may access more than the two bytes that are
  intended to be accessed

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   24742:9fc810bb8145
xen-unstable date:        Thu Feb 09 16:39:16 2012 +0100
---


diff -r 3feb83eed6bd -r 2fc9ae7ee752 xen/common/grant_table.c
--- a/xen/common/grant_table.c	Thu Feb 02 14:00:32 2012 +0000
+++ b/xen/common/grant_table.c	Thu Feb 23 10:40:43 2012 +0000
@@ -356,7 +356,8 @@
              (id != domid) ||
              (!readonly && (flags & GTF_readonly)) )
         {
-            gnttab_clear_flag(_GTF_reading | _GTF_writing, status);
+            gnttab_clear_flag(_GTF_writing, status);
+            gnttab_clear_flag(_GTF_reading, status);
             PIN_FAIL(done, GNTST_general_error,
                      "Unstable flags (%x) or dom (%d). (expected dom %d) "
                      "(r/w: %d)\n",
@@ -1668,14 +1669,14 @@
    under the domain's grant table lock. */
 /* Only safe on transitive grants.  Even then, note that we don't
    attempt to drop any pin on the referent grant. */
-static void __fixup_status_for_pin(struct active_grant_entry *act,
+static void __fixup_status_for_pin(const struct active_grant_entry *act,
                                    uint16_t *status)
 {
     if ( !(act->pin & GNTPIN_hstw_mask) )
-        *status &= ~_GTF_writing;
+        *status &= ~GTF_writing;
 
     if ( !(act->pin & GNTPIN_hstr_mask) )
-        *status &= ~_GTF_reading;
+        *status &= ~GTF_reading;
 }
 
 /* Grab a frame number from a grant entry and update the flags and pin
diff -r 3feb83eed6bd -r 2fc9ae7ee752 xen/include/asm-ia64/grant_table.h
--- a/xen/include/asm-ia64/grant_table.h	Thu Feb 02 14:00:32 2012 +0000
+++ b/xen/include/asm-ia64/grant_table.h	Thu Feb 23 10:40:43 2012 +0000
@@ -5,6 +5,8 @@
 #ifndef __ASM_GRANT_TABLE_H__
 #define __ASM_GRANT_TABLE_H__
 
+#include <asm/intrinsics.h>
+
 #define INITIAL_NR_GRANT_FRAMES 1
 
 // for grant map/unmap
@@ -82,9 +84,19 @@
 
 #define gnttab_mark_dirty(d, f) ((void)f)
 
-static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
+static inline void gnttab_clear_flag(unsigned int nr, volatile uint16_t *st)
 {
-	clear_bit(nr, addr);
+	/*
+	 * Note that this cannot be clear_bit(), as the access must be
+	 * confined to the specified 2 bytes.
+	 */
+	uint16_t mask = ~(1 << nr), old;
+	CMPXCHG_BUGCHECK_DECL
+
+	do {
+		CMPXCHG_BUGCHECK(st);
+		old = *st;
+	} while (cmpxchg_rel(st, old, old & mask) != old);
 }
 
 #define gnttab_host_mapping_get_page_type(op, ld, rd)   \
diff -r 3feb83eed6bd -r 2fc9ae7ee752 xen/include/asm-x86/grant_table.h
--- a/xen/include/asm-x86/grant_table.h	Thu Feb 02 14:00:32 2012 +0000
+++ b/xen/include/asm-x86/grant_table.h	Thu Feb 23 10:40:43 2012 +0000
@@ -48,9 +48,13 @@
 
 #define gnttab_mark_dirty(d, f) paging_mark_dirty((d), (f))
 
-static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
+static inline void gnttab_clear_flag(unsigned int nr, uint16_t *st)
 {
-    clear_bit(nr, (unsigned long *)addr);
+    /*
+     * Note that this cannot be clear_bit(), as the access must be
+     * confined to the specified 2 bytes.
+     */
+    asm volatile ("lock btrw %1,%0" : "=m" (*st) : "Ir" (nr), "m" (*st));
 }
 
 /* Foreign mappings of HHVM-guest pages do not modify the type count. */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Fri Feb 24 12:22:11 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 24 Feb 2012 12:22:11 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0uA4-0000SP-NH; Fri, 24 Feb 2012 12:22:08 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0uA3-0000SH-68
	for xen-changelog@lists.xensource.com; Fri, 24 Feb 2012 12:22:07 +0000
Received: from [85.158.139.83:42026] by server-2.bemta-5.messagelabs.com id
	81/3C-20263-EE0874F4; Fri, 24 Feb 2012 12:22:06 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-182.messagelabs.com!1330086124!15953828!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15573 invoked from network); 24 Feb 2012 12:22:05 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	24 Feb 2012 12:22:05 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0uA0-00035b-G7
	for xen-changelog@lists.xensource.com; Fri, 24 Feb 2012 12:22:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0uA0-0007gm-AN
	for xen-changelog@lists.xensource.com; Fri, 24 Feb 2012 12:22:04 +0000
Message-Id: <E1S0uA0-0007gm-AN@xenbits.xen.org>
Date: Fri, 24 Feb 2012 12:22:03 +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] drivers/xen/: constify all
	instances of "struct attribute_group"
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1330085515 -3600
# Node ID 5259389e19dcf76941c0ec57dee8ab37c5d850d5
# Parent  98c00677dacbbcf1419eb08036077e63c4fd26d4
drivers/xen/: constify all instances of "struct attribute_group"

The functions these get passed to have been taking pointers to const
since at least 2.6.16.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 98c00677dacb -r 5259389e19dc drivers/xen/balloon/sysfs.c
--- a/drivers/xen/balloon/sysfs.c	Thu Feb 16 08:52:06 2012 +0100
+++ b/drivers/xen/balloon/sysfs.c	Fri Feb 24 13:11:55 2012 +0100
@@ -97,7 +97,7 @@
 	NULL
 };
 
-static struct attribute_group balloon_info_group = {
+static const struct attribute_group balloon_info_group = {
 	.name = "info",
 	.attrs = balloon_info_attrs,
 };
diff -r 98c00677dacb -r 5259389e19dc drivers/xen/blkback/xenbus.c
--- a/drivers/xen/blkback/xenbus.c	Thu Feb 16 08:52:06 2012 +0100
+++ b/drivers/xen/blkback/xenbus.c	Fri Feb 24 13:11:55 2012 +0100
@@ -136,7 +136,7 @@
 	NULL
 };
 
-static struct attribute_group vbdstat_group = {
+static const struct attribute_group vbdstat_group = {
 	.name = "statistics",
 	.attrs = vbdstat_attrs,
 };
diff -r 98c00677dacb -r 5259389e19dc drivers/xen/blktap/xenbus.c
--- a/drivers/xen/blktap/xenbus.c	Thu Feb 16 08:52:06 2012 +0100
+++ b/drivers/xen/blktap/xenbus.c	Fri Feb 24 13:11:55 2012 +0100
@@ -152,7 +152,7 @@
 	NULL
 };
 
-static struct attribute_group tapstat_group = {
+static const struct attribute_group tapstat_group = {
 	.name = "statistics",
 	.attrs = tapstat_attrs,
 };
diff -r 98c00677dacb -r 5259389e19dc drivers/xen/core/xen_sysfs.c
--- a/drivers/xen/core/xen_sysfs.c	Thu Feb 16 08:52:06 2012 +0100
+++ b/drivers/xen/core/xen_sysfs.c	Fri Feb 24 13:11:55 2012 +0100
@@ -84,7 +84,7 @@
 	NULL
 };
 
-static struct attribute_group version_group = {
+static const struct attribute_group version_group = {
 	.name = "version",
 	.attrs = version_attrs,
 };
@@ -197,12 +197,12 @@
 	NULL
 };
 
-static struct attribute_group xen_compilation_group = {
+static const struct attribute_group xen_compilation_group = {
 	.name = "compilation",
 	.attrs = xen_compile_attrs,
 };
 
-int __init static xen_compilation_init(void)
+static int __init xen_compilation_init(void)
 {
 	return sysfs_create_group(&hypervisor_subsys.kset.kobj,
 				  &xen_compilation_group);
@@ -318,7 +318,7 @@
 	NULL
 };
 
-static struct attribute_group xen_properties_group = {
+static const struct attribute_group xen_properties_group = {
 	.name = "properties",
 	.attrs = xen_properties_attrs,
 };

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Fri Feb 24 12:22:11 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 24 Feb 2012 12:22:11 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S0uA4-0000SP-NH; Fri, 24 Feb 2012 12:22:08 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0uA3-0000SH-68
	for xen-changelog@lists.xensource.com; Fri, 24 Feb 2012 12:22:07 +0000
Received: from [85.158.139.83:42026] by server-2.bemta-5.messagelabs.com id
	81/3C-20263-EE0874F4; Fri, 24 Feb 2012 12:22:06 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-182.messagelabs.com!1330086124!15953828!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15573 invoked from network); 24 Feb 2012 12:22:05 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	24 Feb 2012 12:22:05 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0uA0-00035b-G7
	for xen-changelog@lists.xensource.com; Fri, 24 Feb 2012 12:22:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S0uA0-0007gm-AN
	for xen-changelog@lists.xensource.com; Fri, 24 Feb 2012 12:22:04 +0000
Message-Id: <E1S0uA0-0007gm-AN@xenbits.xen.org>
Date: Fri, 24 Feb 2012 12:22:03 +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] drivers/xen/: constify all
	instances of "struct attribute_group"
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1330085515 -3600
# Node ID 5259389e19dcf76941c0ec57dee8ab37c5d850d5
# Parent  98c00677dacbbcf1419eb08036077e63c4fd26d4
drivers/xen/: constify all instances of "struct attribute_group"

The functions these get passed to have been taking pointers to const
since at least 2.6.16.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 98c00677dacb -r 5259389e19dc drivers/xen/balloon/sysfs.c
--- a/drivers/xen/balloon/sysfs.c	Thu Feb 16 08:52:06 2012 +0100
+++ b/drivers/xen/balloon/sysfs.c	Fri Feb 24 13:11:55 2012 +0100
@@ -97,7 +97,7 @@
 	NULL
 };
 
-static struct attribute_group balloon_info_group = {
+static const struct attribute_group balloon_info_group = {
 	.name = "info",
 	.attrs = balloon_info_attrs,
 };
diff -r 98c00677dacb -r 5259389e19dc drivers/xen/blkback/xenbus.c
--- a/drivers/xen/blkback/xenbus.c	Thu Feb 16 08:52:06 2012 +0100
+++ b/drivers/xen/blkback/xenbus.c	Fri Feb 24 13:11:55 2012 +0100
@@ -136,7 +136,7 @@
 	NULL
 };
 
-static struct attribute_group vbdstat_group = {
+static const struct attribute_group vbdstat_group = {
 	.name = "statistics",
 	.attrs = vbdstat_attrs,
 };
diff -r 98c00677dacb -r 5259389e19dc drivers/xen/blktap/xenbus.c
--- a/drivers/xen/blktap/xenbus.c	Thu Feb 16 08:52:06 2012 +0100
+++ b/drivers/xen/blktap/xenbus.c	Fri Feb 24 13:11:55 2012 +0100
@@ -152,7 +152,7 @@
 	NULL
 };
 
-static struct attribute_group tapstat_group = {
+static const struct attribute_group tapstat_group = {
 	.name = "statistics",
 	.attrs = tapstat_attrs,
 };
diff -r 98c00677dacb -r 5259389e19dc drivers/xen/core/xen_sysfs.c
--- a/drivers/xen/core/xen_sysfs.c	Thu Feb 16 08:52:06 2012 +0100
+++ b/drivers/xen/core/xen_sysfs.c	Fri Feb 24 13:11:55 2012 +0100
@@ -84,7 +84,7 @@
 	NULL
 };
 
-static struct attribute_group version_group = {
+static const struct attribute_group version_group = {
 	.name = "version",
 	.attrs = version_attrs,
 };
@@ -197,12 +197,12 @@
 	NULL
 };
 
-static struct attribute_group xen_compilation_group = {
+static const struct attribute_group xen_compilation_group = {
 	.name = "compilation",
 	.attrs = xen_compile_attrs,
 };
 
-int __init static xen_compilation_init(void)
+static int __init xen_compilation_init(void)
 {
 	return sysfs_create_group(&hypervisor_subsys.kset.kobj,
 				  &xen_compilation_group);
@@ -318,7 +318,7 @@
 	NULL
 };
 
-static struct attribute_group xen_properties_group = {
+static const struct attribute_group xen_properties_group = {
 	.name = "properties",
 	.attrs = xen_properties_attrs,
 };

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Mon Feb 27 16:55:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 27 Feb 2012 16:55:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S23qz-0002G6-FW; Mon, 27 Feb 2012 16:55:13 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S23qy-0002Fn-QC
	for xen-changelog@lists.xensource.com; Mon, 27 Feb 2012 16:55:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1330361704!3830604!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29623 invoked from network); 27 Feb 2012 16:55:05 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	27 Feb 2012 16:55:05 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S23qq-00024l-Bj
	for xen-changelog@lists.xensource.com; Mon, 27 Feb 2012 16:55:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S23qp-00041W-VP
	for xen-changelog@lists.xensource.com; Mon, 27 Feb 2012 16:55:04 +0000
Message-Id: <E1S23qp-00041W-VP@xenbits.xen.org>
Date: Mon, 27 Feb 2012 16:55:03 +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] blkfront: make blkif_io_lock
	spinlock per-device
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Steven Noonan <snoonan@amazon.com>
# Date 1330361509 -3600
# Node ID 151972c92963e10b7943bc6b6381a79caf566b5d
# Parent  5259389e19dcf76941c0ec57dee8ab37c5d850d5
blkfront: make blkif_io_lock spinlock per-device

This patch moves the global blkif_io_lock to the per-device structure.
The spinlock seems to exists for two reasons: to disable IRQs when in
the interrupt handlers for blkfront, and to protect the blkfront VBDs
when a detachment is requested.

Having a global blkif_io_lock doesn't make sense given the use case,
and it drastically hinders performance due to contention. All VBDs
with pending IOs have to take the lock in order to get work done,
which serializes everything pretty badly.

Signed-off-by: Steven Noonan <snoonan@amazon.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 5259389e19dc -r 151972c92963 drivers/xen/blkfront/blkfront.c
--- a/drivers/xen/blkfront/blkfront.c	Fri Feb 24 13:11:55 2012 +0100
+++ b/drivers/xen/blkfront/blkfront.c	Mon Feb 27 17:51:49 2012 +0100
@@ -108,6 +108,7 @@
 		return -ENOMEM;
 	}
 
+	spin_lock_init(&info->io_lock);
 	info->xbdev = dev;
 	info->vdevice = vdevice;
 	info->connected = BLKIF_STATE_DISCONNECTED;
@@ -381,10 +382,10 @@
 	(void)xenbus_switch_state(info->xbdev, XenbusStateConnected);
 
 	/* Kick pending requests. */
-	spin_lock_irq(&blkif_io_lock);
+	spin_lock_irq(&info->io_lock);
 	info->connected = BLKIF_STATE_CONNECTED;
 	kick_pending_request_queues(info);
-	spin_unlock_irq(&blkif_io_lock);
+	spin_unlock_irq(&info->io_lock);
 
 	add_disk(info->gd);
 
@@ -406,12 +407,12 @@
 	if (info->rq == NULL)
 		goto out;
 
-	spin_lock_irqsave(&blkif_io_lock, flags);
+	spin_lock_irqsave(&info->io_lock, flags);
 	/* No more blkif_request(). */
 	blk_stop_queue(info->rq);
 	/* No more gnttab callback work. */
 	gnttab_cancel_free_callback(&info->callback);
-	spin_unlock_irqrestore(&blkif_io_lock, flags);
+	spin_unlock_irqrestore(&info->io_lock, flags);
 
 	/* Flush gnttab callback work. Must be done with no locks held. */
 	flush_scheduled_work();
@@ -484,10 +485,10 @@
 static void blkif_restart_queue(void *arg)
 {
 	struct blkfront_info *info = (struct blkfront_info *)arg;
-	spin_lock_irq(&blkif_io_lock);
+	spin_lock_irq(&info->io_lock);
 	if (info->connected == BLKIF_STATE_CONNECTED)
 		kick_pending_request_queues(info);
-	spin_unlock_irq(&blkif_io_lock);
+	spin_unlock_irq(&info->io_lock);
 }
 
 static void blkif_restart_queue_callback(void *arg)
@@ -756,10 +757,10 @@
 	struct blkfront_info *info = (struct blkfront_info *)dev_id;
 	int uptodate;
 
-	spin_lock_irqsave(&blkif_io_lock, flags);
+	spin_lock_irqsave(&info->io_lock, flags);
 
 	if (unlikely(info->connected != BLKIF_STATE_CONNECTED)) {
-		spin_unlock_irqrestore(&blkif_io_lock, flags);
+		spin_unlock_irqrestore(&info->io_lock, flags);
 		return IRQ_HANDLED;
 	}
 
@@ -818,7 +819,7 @@
 
 	kick_pending_request_queues(info);
 
-	spin_unlock_irqrestore(&blkif_io_lock, flags);
+	spin_unlock_irqrestore(&info->io_lock, flags);
 
 	return IRQ_HANDLED;
 }
@@ -826,7 +827,7 @@
 static void blkif_free(struct blkfront_info *info, int suspend)
 {
 	/* Prevent new requests being issued until we fix things up. */
-	spin_lock_irq(&blkif_io_lock);
+	spin_lock_irq(&info->io_lock);
 	info->connected = suspend ?
 		BLKIF_STATE_SUSPENDED : BLKIF_STATE_DISCONNECTED;
 	/* No more blkif_request(). */
@@ -834,7 +835,7 @@
 		blk_stop_queue(info->rq);
 	/* No more gnttab callback work. */
 	gnttab_cancel_free_callback(&info->callback);
-	spin_unlock_irq(&blkif_io_lock);
+	spin_unlock_irq(&info->io_lock);
 
 	/* Flush gnttab callback work. Must be done with no locks held. */
 	flush_scheduled_work();
@@ -909,7 +910,7 @@
 
 	(void)xenbus_switch_state(info->xbdev, XenbusStateConnected);
 
-	spin_lock_irq(&blkif_io_lock);
+	spin_lock_irq(&info->io_lock);
 
 	/* Now safe for us to use the shared ring */
 	info->connected = BLKIF_STATE_CONNECTED;
@@ -920,7 +921,7 @@
 	/* Kick any other new requests queued since we resumed */
 	kick_pending_request_queues(info);
 
-	spin_unlock_irq(&blkif_io_lock);
+	spin_unlock_irq(&info->io_lock);
 }
 
 int blkfront_is_ready(struct xenbus_device *dev)
diff -r 5259389e19dc -r 151972c92963 drivers/xen/blkfront/block.h
--- a/drivers/xen/blkfront/block.h	Fri Feb 24 13:11:55 2012 +0100
+++ b/drivers/xen/blkfront/block.h	Mon Feb 27 17:51:49 2012 +0100
@@ -104,6 +104,7 @@
 	int connected;
 	int ring_ref;
 	blkif_front_ring_t ring;
+	spinlock_t io_lock;
 	struct scatterlist sg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
 	unsigned int irq;
 	struct xlbd_major_info *mi;
@@ -122,8 +123,6 @@
 	int users;
 };
 
-extern spinlock_t blkif_io_lock;
-
 extern int blkif_open(struct inode *inode, struct file *filep);
 extern int blkif_release(struct inode *inode, struct file *filep);
 extern int blkif_ioctl(struct inode *inode, struct file *filep,
diff -r 5259389e19dc -r 151972c92963 drivers/xen/blkfront/vbd.c
--- a/drivers/xen/blkfront/vbd.c	Fri Feb 24 13:11:55 2012 +0100
+++ b/drivers/xen/blkfront/vbd.c	Mon Feb 27 17:51:49 2012 +0100
@@ -116,8 +116,6 @@
 #endif
 };
 
-DEFINE_SPINLOCK(blkif_io_lock);
-
 static struct xlbd_major_info *
 xlbd_alloc_major_info(int major, int minor, int index)
 {
@@ -296,11 +294,12 @@
 }
 
 static int
-xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size)
+xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size,
+		     struct blkfront_info *info)
 {
 	request_queue_t *rq;
 
-	rq = blk_init_queue(do_blkif_request, &blkif_io_lock);
+	rq = blk_init_queue(do_blkif_request, &info->io_lock);
 	if (rq == NULL)
 		return -1;
 
@@ -323,6 +322,7 @@
 	blk_queue_bounce_limit(rq, BLK_BOUNCE_ANY);
 
 	gd->queue = rq;
+	info->rq = rq;
 
 	return 0;
 }
@@ -394,12 +394,11 @@
 	gd->driverfs_dev = &(info->xbdev->dev);
 	set_capacity(gd, capacity);
 
-	if (xlvbd_init_blk_queue(gd, sector_size)) {
+	if (xlvbd_init_blk_queue(gd, sector_size, info)) {
 		del_gendisk(gd);
 		goto release;
 	}
 
-	info->rq = gd->queue;
 	info->gd = gd;
 
 	if (info->feature_barrier)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Mon Feb 27 16:55:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 27 Feb 2012 16:55:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S23qz-0002G6-FW; Mon, 27 Feb 2012 16:55:13 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S23qy-0002Fn-QC
	for xen-changelog@lists.xensource.com; Mon, 27 Feb 2012 16:55:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1330361704!3830604!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29623 invoked from network); 27 Feb 2012 16:55:05 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	27 Feb 2012 16:55:05 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S23qq-00024l-Bj
	for xen-changelog@lists.xensource.com; Mon, 27 Feb 2012 16:55:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S23qp-00041W-VP
	for xen-changelog@lists.xensource.com; Mon, 27 Feb 2012 16:55:04 +0000
Message-Id: <E1S23qp-00041W-VP@xenbits.xen.org>
Date: Mon, 27 Feb 2012 16:55:03 +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] blkfront: make blkif_io_lock
	spinlock per-device
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Steven Noonan <snoonan@amazon.com>
# Date 1330361509 -3600
# Node ID 151972c92963e10b7943bc6b6381a79caf566b5d
# Parent  5259389e19dcf76941c0ec57dee8ab37c5d850d5
blkfront: make blkif_io_lock spinlock per-device

This patch moves the global blkif_io_lock to the per-device structure.
The spinlock seems to exists for two reasons: to disable IRQs when in
the interrupt handlers for blkfront, and to protect the blkfront VBDs
when a detachment is requested.

Having a global blkif_io_lock doesn't make sense given the use case,
and it drastically hinders performance due to contention. All VBDs
with pending IOs have to take the lock in order to get work done,
which serializes everything pretty badly.

Signed-off-by: Steven Noonan <snoonan@amazon.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 5259389e19dc -r 151972c92963 drivers/xen/blkfront/blkfront.c
--- a/drivers/xen/blkfront/blkfront.c	Fri Feb 24 13:11:55 2012 +0100
+++ b/drivers/xen/blkfront/blkfront.c	Mon Feb 27 17:51:49 2012 +0100
@@ -108,6 +108,7 @@
 		return -ENOMEM;
 	}
 
+	spin_lock_init(&info->io_lock);
 	info->xbdev = dev;
 	info->vdevice = vdevice;
 	info->connected = BLKIF_STATE_DISCONNECTED;
@@ -381,10 +382,10 @@
 	(void)xenbus_switch_state(info->xbdev, XenbusStateConnected);
 
 	/* Kick pending requests. */
-	spin_lock_irq(&blkif_io_lock);
+	spin_lock_irq(&info->io_lock);
 	info->connected = BLKIF_STATE_CONNECTED;
 	kick_pending_request_queues(info);
-	spin_unlock_irq(&blkif_io_lock);
+	spin_unlock_irq(&info->io_lock);
 
 	add_disk(info->gd);
 
@@ -406,12 +407,12 @@
 	if (info->rq == NULL)
 		goto out;
 
-	spin_lock_irqsave(&blkif_io_lock, flags);
+	spin_lock_irqsave(&info->io_lock, flags);
 	/* No more blkif_request(). */
 	blk_stop_queue(info->rq);
 	/* No more gnttab callback work. */
 	gnttab_cancel_free_callback(&info->callback);
-	spin_unlock_irqrestore(&blkif_io_lock, flags);
+	spin_unlock_irqrestore(&info->io_lock, flags);
 
 	/* Flush gnttab callback work. Must be done with no locks held. */
 	flush_scheduled_work();
@@ -484,10 +485,10 @@
 static void blkif_restart_queue(void *arg)
 {
 	struct blkfront_info *info = (struct blkfront_info *)arg;
-	spin_lock_irq(&blkif_io_lock);
+	spin_lock_irq(&info->io_lock);
 	if (info->connected == BLKIF_STATE_CONNECTED)
 		kick_pending_request_queues(info);
-	spin_unlock_irq(&blkif_io_lock);
+	spin_unlock_irq(&info->io_lock);
 }
 
 static void blkif_restart_queue_callback(void *arg)
@@ -756,10 +757,10 @@
 	struct blkfront_info *info = (struct blkfront_info *)dev_id;
 	int uptodate;
 
-	spin_lock_irqsave(&blkif_io_lock, flags);
+	spin_lock_irqsave(&info->io_lock, flags);
 
 	if (unlikely(info->connected != BLKIF_STATE_CONNECTED)) {
-		spin_unlock_irqrestore(&blkif_io_lock, flags);
+		spin_unlock_irqrestore(&info->io_lock, flags);
 		return IRQ_HANDLED;
 	}
 
@@ -818,7 +819,7 @@
 
 	kick_pending_request_queues(info);
 
-	spin_unlock_irqrestore(&blkif_io_lock, flags);
+	spin_unlock_irqrestore(&info->io_lock, flags);
 
 	return IRQ_HANDLED;
 }
@@ -826,7 +827,7 @@
 static void blkif_free(struct blkfront_info *info, int suspend)
 {
 	/* Prevent new requests being issued until we fix things up. */
-	spin_lock_irq(&blkif_io_lock);
+	spin_lock_irq(&info->io_lock);
 	info->connected = suspend ?
 		BLKIF_STATE_SUSPENDED : BLKIF_STATE_DISCONNECTED;
 	/* No more blkif_request(). */
@@ -834,7 +835,7 @@
 		blk_stop_queue(info->rq);
 	/* No more gnttab callback work. */
 	gnttab_cancel_free_callback(&info->callback);
-	spin_unlock_irq(&blkif_io_lock);
+	spin_unlock_irq(&info->io_lock);
 
 	/* Flush gnttab callback work. Must be done with no locks held. */
 	flush_scheduled_work();
@@ -909,7 +910,7 @@
 
 	(void)xenbus_switch_state(info->xbdev, XenbusStateConnected);
 
-	spin_lock_irq(&blkif_io_lock);
+	spin_lock_irq(&info->io_lock);
 
 	/* Now safe for us to use the shared ring */
 	info->connected = BLKIF_STATE_CONNECTED;
@@ -920,7 +921,7 @@
 	/* Kick any other new requests queued since we resumed */
 	kick_pending_request_queues(info);
 
-	spin_unlock_irq(&blkif_io_lock);
+	spin_unlock_irq(&info->io_lock);
 }
 
 int blkfront_is_ready(struct xenbus_device *dev)
diff -r 5259389e19dc -r 151972c92963 drivers/xen/blkfront/block.h
--- a/drivers/xen/blkfront/block.h	Fri Feb 24 13:11:55 2012 +0100
+++ b/drivers/xen/blkfront/block.h	Mon Feb 27 17:51:49 2012 +0100
@@ -104,6 +104,7 @@
 	int connected;
 	int ring_ref;
 	blkif_front_ring_t ring;
+	spinlock_t io_lock;
 	struct scatterlist sg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
 	unsigned int irq;
 	struct xlbd_major_info *mi;
@@ -122,8 +123,6 @@
 	int users;
 };
 
-extern spinlock_t blkif_io_lock;
-
 extern int blkif_open(struct inode *inode, struct file *filep);
 extern int blkif_release(struct inode *inode, struct file *filep);
 extern int blkif_ioctl(struct inode *inode, struct file *filep,
diff -r 5259389e19dc -r 151972c92963 drivers/xen/blkfront/vbd.c
--- a/drivers/xen/blkfront/vbd.c	Fri Feb 24 13:11:55 2012 +0100
+++ b/drivers/xen/blkfront/vbd.c	Mon Feb 27 17:51:49 2012 +0100
@@ -116,8 +116,6 @@
 #endif
 };
 
-DEFINE_SPINLOCK(blkif_io_lock);
-
 static struct xlbd_major_info *
 xlbd_alloc_major_info(int major, int minor, int index)
 {
@@ -296,11 +294,12 @@
 }
 
 static int
-xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size)
+xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size,
+		     struct blkfront_info *info)
 {
 	request_queue_t *rq;
 
-	rq = blk_init_queue(do_blkif_request, &blkif_io_lock);
+	rq = blk_init_queue(do_blkif_request, &info->io_lock);
 	if (rq == NULL)
 		return -1;
 
@@ -323,6 +322,7 @@
 	blk_queue_bounce_limit(rq, BLK_BOUNCE_ANY);
 
 	gd->queue = rq;
+	info->rq = rq;
 
 	return 0;
 }
@@ -394,12 +394,11 @@
 	gd->driverfs_dev = &(info->xbdev->dev);
 	set_capacity(gd, capacity);
 
-	if (xlvbd_init_blk_queue(gd, sector_size)) {
+	if (xlvbd_init_blk_queue(gd, sector_size, info)) {
 		del_gendisk(gd);
 		goto release;
 	}
 
-	info->rq = gd->queue;
 	info->gd = gd;
 
 	if (info->feature_barrier)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnF-0002A0-5W; Tue, 28 Feb 2012 06:44:13 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnE-00029t-6K
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-27.messagelabs.com!1330411417!58592499!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11166 invoked from network); 28 Feb 2012 06:43:39 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:43:39 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnB-0004Ev-DN
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnB-0007GX-5M
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:09 +0000
Message-Id: <E1S2GnB-0007GX-5M@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: add missing unlock from
	gnttab_get_version
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1329991175 0
# Node ID 66cc5b67e7492afd3c59717e5d21d58dedfe5b34
# Parent  9bf3ec036bef2b67338bf5685423e26de69bd031
xen: add missing unlock from gnttab_get_version

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reported-by: Francisco Rocha <f.e.liberal-rocha@newcastle.ac.uk>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 9bf3ec036bef -r 66cc5b67e749 xen/common/grant_table.c
--- a/xen/common/grant_table.c	Thu Feb 23 09:58:47 2012 +0000
+++ b/xen/common/grant_table.c	Thu Feb 23 09:59:35 2012 +0000
@@ -2321,6 +2321,8 @@
     op.version = d->grant_table->gt_version;
     spin_unlock(&d->grant_table->lock);
 
+    rcu_unlock_domain(d);
+
     if ( copy_to_guest(uop, &op, 1) )
         return -EFAULT;
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnF-0002A0-5W; Tue, 28 Feb 2012 06:44:13 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnE-00029t-6K
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-27.messagelabs.com!1330411417!58592499!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11166 invoked from network); 28 Feb 2012 06:43:39 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:43:39 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnB-0004Ev-DN
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnB-0007GX-5M
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:09 +0000
Message-Id: <E1S2GnB-0007GX-5M@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: add missing unlock from
	gnttab_get_version
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1329991175 0
# Node ID 66cc5b67e7492afd3c59717e5d21d58dedfe5b34
# Parent  9bf3ec036bef2b67338bf5685423e26de69bd031
xen: add missing unlock from gnttab_get_version

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reported-by: Francisco Rocha <f.e.liberal-rocha@newcastle.ac.uk>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 9bf3ec036bef -r 66cc5b67e749 xen/common/grant_table.c
--- a/xen/common/grant_table.c	Thu Feb 23 09:58:47 2012 +0000
+++ b/xen/common/grant_table.c	Thu Feb 23 09:59:35 2012 +0000
@@ -2321,6 +2321,8 @@
     op.version = d->grant_table->gt_version;
     spin_unlock(&d->grant_table->lock);
 
+    rcu_unlock_domain(d);
+
     if ( copy_to_guest(uop, &op, 1) )
         return -EFAULT;
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnK-0002Am-B2; Tue, 28 Feb 2012 06:44:18 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnI-0002AO-Up
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:17 +0000
Received: from [85.158.139.83:51892] by server-5.bemta-5.messagelabs.com id
	EC/66-13566-0C77C4F4; Tue, 28 Feb 2012 06:44:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-182.messagelabs.com!1330411453!16973908!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18225 invoked from network); 28 Feb 2012 06:44:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnF-0004FR-FJ
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnF-0007JY-Az
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:13 +0000
Message-Id: <E1S2GnF-0007JY-Az@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] scheduler: Print ratelimit in
	scheduler debug key
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1329992170 0
# Node ID c4bddb3422ddadbc34f2925ce438ef2dcfc07f52
# Parent  8e672cd04864c481beec0fe781463debd30f1492
scheduler: Print ratelimit in scheduler debug key

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 8e672cd04864 -r c4bddb3422dd xen/common/sched_credit.c
--- a/xen/common/sched_credit.c	Thu Feb 23 10:15:40 2012 +0000
+++ b/xen/common/sched_credit.c	Thu Feb 23 10:16:10 2012 +0000
@@ -1504,6 +1504,7 @@
            "\trunq_sort          = %u\n"
            "\tdefault-weight     = %d\n"
            "\ttslice             = %dms\n"
+           "\tratelimit          = %dus\n"
            "\tcredits per msec   = %d\n"
            "\tticks per tslice   = %d\n"
            "\tmigration delay    = %uus\n",
@@ -1515,6 +1516,7 @@
            prv->runq_sort,
            CSCHED_DEFAULT_WEIGHT,
            prv->tslice_ms,
+           prv->ratelimit_us,
            CSCHED_CREDITS_PER_MSEC,
            prv->ticks_per_tslice,
            vcpu_migration_delay);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnK-0002Am-B2; Tue, 28 Feb 2012 06:44:18 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnI-0002AO-Up
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:17 +0000
Received: from [85.158.139.83:51892] by server-5.bemta-5.messagelabs.com id
	EC/66-13566-0C77C4F4; Tue, 28 Feb 2012 06:44:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-182.messagelabs.com!1330411453!16973908!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18225 invoked from network); 28 Feb 2012 06:44:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnF-0004FR-FJ
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnF-0007JY-Az
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:13 +0000
Message-Id: <E1S2GnF-0007JY-Az@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] scheduler: Print ratelimit in
	scheduler debug key
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1329992170 0
# Node ID c4bddb3422ddadbc34f2925ce438ef2dcfc07f52
# Parent  8e672cd04864c481beec0fe781463debd30f1492
scheduler: Print ratelimit in scheduler debug key

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 8e672cd04864 -r c4bddb3422dd xen/common/sched_credit.c
--- a/xen/common/sched_credit.c	Thu Feb 23 10:15:40 2012 +0000
+++ b/xen/common/sched_credit.c	Thu Feb 23 10:16:10 2012 +0000
@@ -1504,6 +1504,7 @@
            "\trunq_sort          = %u\n"
            "\tdefault-weight     = %d\n"
            "\ttslice             = %dms\n"
+           "\tratelimit          = %dus\n"
            "\tcredits per msec   = %d\n"
            "\tticks per tslice   = %d\n"
            "\tmigration delay    = %uus\n",
@@ -1515,6 +1516,7 @@
            prv->runq_sort,
            CSCHED_DEFAULT_WEIGHT,
            prv->tslice_ms,
+           prv->ratelimit_us,
            CSCHED_CREDITS_PER_MSEC,
            prv->ticks_per_tslice,
            vcpu_migration_delay);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnI-0002AJ-8B; Tue, 28 Feb 2012 06:44:16 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnH-0002A9-4E
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1330411384!58467498!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.3 required=7.0 tests=MAILTO_TO_SPAM_ADDR
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29568 invoked from network); 28 Feb 2012 06:43:05 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:43:05 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnE-0004FI-35
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnD-0007IO-Oh
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:11 +0000
Message-Id: <E1S2GnD-0007IO-Oh@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] hvmloader: Add OVMF UEFI support and
	directly use it
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Attilio Rao <attilio.rao@citrix.com>
# Date 1329991918 0
# Node ID 7cf234b198a3252b197aa08a551c7c2b19369ce9
# Parent  a59c1dcfe968ee8a28cf2cdfd5c254741c0f36d3
hvmloader: Add OVMF UEFI support and directly use it
...when specified in the guest configuration file.

This work is somewhat based on Bei Guan effort during the SoC 2011 and
relies on upstream edk2/ovmf Tianocore ROM to be built separately and
manually copied as:
Build/OvmfX64/DEBUG_GCC44/FV/OVMF.fd ->
tools/firmware/ovmf/ovmf-x64.bin
Build/OvmfIa32/DEBUG_GCC44/FV/OVMF.fd ->
toolf/firmware/ovmf/ovmf-ia32.bin

A way to integrate OVMF build directly into XEN has still be discussed
on the mailing list appropriately.

Signed-off-by: Attilio Rao <attilio.rao@citrix.com>

Disable CONFIG_OVMF by default as ovmf is not integrated into the
build.

Signed-off-by: Keir Fraser <keir@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r a59c1dcfe968 -r 7cf234b198a3 Config.mk
--- a/Config.mk	Thu Feb 23 10:03:07 2012 +0000
+++ b/Config.mk	Thu Feb 23 10:11:58 2012 +0000
@@ -198,6 +198,7 @@
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
+CONFIG_OVMF ?= n
 CONFIG_ROMBIOS ?= y
 CONFIG_SEABIOS ?= y
 
diff -r a59c1dcfe968 -r 7cf234b198a3 tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile	Thu Feb 23 10:03:07 2012 +0000
+++ b/tools/firmware/hvmloader/Makefile	Thu Feb 23 10:11:58 2012 +0000
@@ -37,6 +37,7 @@
 
 CIRRUSVGA_DEBUG ?= n
 
+OVMF_DIR := ../ovmf
 ROMBIOS_DIR := ../rombios
 SEABIOS_DIR := ../seabios-dir
 
@@ -52,6 +53,14 @@
 
 ROMS := 
 
+ifeq ($(CONFIG_OVMF),y)
+OBJS += ovmf.o
+CFLAGS += -DENABLE_OVMF32 -DENABLE_OVMF64
+OVMF32_ROM := $(OVMF_DIR)/ovmf-ia32.bin
+OVMF64_ROM := $(OVMF_DIR)/ovmf-x64.bin
+ROMS += $(OVMF32_ROM) $(OVMF64_ROM)
+endif
+
 ifeq ($(CONFIG_ROMBIOS),y)
 OBJS += optionroms.o 32bitbios_support.o rombios.o
 CFLAGS += -DENABLE_ROMBIOS
@@ -70,7 +79,7 @@
 all: subdirs-all
 	$(MAKE) hvmloader
 
-rombios.o seabios.o hvmloader.o: roms.inc
+ovmf.o rombios.o seabios.o hvmloader.o: roms.inc
 smbios.o: CFLAGS += -D__SMBIOS_DATE__="\"$(shell date +%m/%d/%Y)\""
 
 hvmloader: $(OBJS) acpi/acpi.a
@@ -93,6 +102,18 @@
 	echo "#endif" >> $@.new
 endif
 
+ifneq ($(OVMF32_ROM),)
+	echo "#ifdef ROM_INCLUDE_OVMF32" >> $@.new
+	sh ./mkhex ovmf32 $(OVMF32_ROM) >> $@.new
+	echo "#endif" >> $@.new	
+endif 
+
+ifneq ($(OVMF64_ROM),)
+	echo "#ifdef ROM_INCLUDE_OVMF64" >> $@.new
+	sh ./mkhex ovmf64 $(OVMF64_ROM) >> $@.new
+	echo "#endif" >> $@.new	
+endif 
+
 ifneq ($(STDVGA_ROM),)
 	echo "#ifdef ROM_INCLUDE_VGABIOS" >> $@.new
 	sh ./mkhex vgabios_stdvga $(STDVGA_ROM) >> $@.new
diff -r a59c1dcfe968 -r 7cf234b198a3 tools/firmware/hvmloader/config.h
--- a/tools/firmware/hvmloader/config.h	Thu Feb 23 10:03:07 2012 +0000
+++ b/tools/firmware/hvmloader/config.h	Thu Feb 23 10:11:58 2012 +0000
@@ -35,6 +35,8 @@
 
 extern struct bios_config rombios_config;
 extern struct bios_config seabios_config;
+extern struct bios_config ovmf32_config;
+extern struct bios_config ovmf64_config;
 
 #define PAGE_SHIFT 12
 #define PAGE_SIZE  (1ul << PAGE_SHIFT)
diff -r a59c1dcfe968 -r 7cf234b198a3 tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c	Thu Feb 23 10:03:07 2012 +0000
+++ b/tools/firmware/hvmloader/hvmloader.c	Thu Feb 23 10:11:58 2012 +0000
@@ -212,6 +212,12 @@
 #ifdef ENABLE_SEABIOS
     { "seabios", &seabios_config, },
 #endif
+#ifdef ENABLE_OVMF32
+    { "ovmf-ia32", &ovmf32_config, },
+#endif
+#ifdef ENABLE_OVMF64
+    { "ovmf-x64", &ovmf64_config, },
+#endif
     { NULL, NULL }
 };
 
diff -r a59c1dcfe968 -r 7cf234b198a3 tools/firmware/hvmloader/ovmf.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/firmware/hvmloader/ovmf.c	Thu Feb 23 10:11:58 2012 +0000
@@ -0,0 +1,149 @@
+/*
+ * HVM OVMF UEFI support.
+ *
+ * Bei Guan, gbtju85@gmail.com
+ * Andrei Warkentin, andreiw@motorola.com
+ * Leendert van Doorn, leendert@watson.ibm.com
+ * Copyright (c) 2005, International Business Machines Corporation.
+ * Copyright (c) 2006, Keir Fraser, XenSource Inc.
+ * Copyright (c) 2011, Citrix Inc.
+ *
+ * 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 "config.h"
+#include "smbios_types.h"
+#include "acpi/acpi2_0.h"
+#include "apic_regs.h"
+#include "../rombios/config.h"
+#include "util.h"
+#include "pci_regs.h"
+#include "hypercall.h"
+
+#include <xen/hvm/params.h>
+#include <xen/hvm/ioreq.h>
+#include <xen/memory.h>
+
+#define ROM_INCLUDE_OVMF32
+#define ROM_INCLUDE_OVMF64
+#include "roms.inc"
+
+#define OVMF_BEGIN              0xFFF00000ULL
+#define OVMF_SIZE               0x00100000ULL
+#define OVMF_MAXOFFSET          0x000FFFFFULL
+#define OVMF_END                (OVMF_BEGIN + OVMF_SIZE)
+#define LOWCHUNK_BEGIN          0x000F0000
+#define LOWCHUNK_SIZE           0x00010000
+#define LOWCHUNK_MAXOFFSET      0x0000FFFF
+#define LOWCHUNK_END            (OVMF_BEGIN + OVMF_SIZE)
+
+extern unsigned char dsdt_anycpu[], dsdt_15cpu[];
+extern int dsdt_anycpu_len, dsdt_15cpu_len;
+
+static void ovmf_load(const struct bios_config *config)
+{
+    xen_pfn_t mfn;
+    uint64_t addr = OVMF_BEGIN;
+
+    /* Copy low-reset vector portion. */
+    memcpy((void *) LOWCHUNK_BEGIN, (uint8_t *) config->image
+           + OVMF_SIZE
+           - LOWCHUNK_SIZE,
+           LOWCHUNK_SIZE);
+
+    /* Ensure we have backing page prior to moving FD. */
+    while ( (addr >> PAGE_SHIFT) != (OVMF_END >> PAGE_SHIFT) )
+    {
+        mfn = (uint32_t) (addr >> PAGE_SHIFT);
+        addr += PAGE_SIZE;
+        mem_hole_populate_ram(mfn, 1);
+    }
+
+    /* Copy FD. */
+    memcpy((void *) OVMF_BEGIN, config->image, OVMF_SIZE);
+}
+
+static void ovmf_acpi_build_tables(void)
+{
+    struct acpi_config config = {
+        .dsdt_anycpu = dsdt_anycpu,
+        .dsdt_anycpu_len = dsdt_anycpu_len,
+        .dsdt_15cpu = dsdt_15cpu,
+        .dsdt_15cpu_len = dsdt_15cpu_len,
+    };
+
+    acpi_build_tables(&config, ACPI_PHYSICAL_ADDRESS);
+}
+
+static void ovmf_create_smbios_tables(void)
+{
+    hvm_write_smbios_tables(
+        SMBIOS_PHYSICAL_ADDRESS,
+        SMBIOS_PHYSICAL_ADDRESS + sizeof(struct smbios_entry_point),
+        SMBIOS_PHYSICAL_END);
+}
+
+struct bios_config ovmf32_config =  {
+    .name = "OVMF-IA32",
+
+    .image = ovmf32,
+    .image_size = sizeof(ovmf32),
+
+    .bios_address = 0,
+    .bios_load = ovmf_load,
+
+    .load_roms = 0,
+
+    .bios_info_setup = NULL,
+    .bios_info_finish = NULL,
+
+    .e820_setup = NULL,
+
+    .acpi_build_tables = ovmf_acpi_build_tables,
+    .create_mp_tables = NULL,
+    .create_smbios_tables = ovmf_create_smbios_tables,
+    .create_pir_tables = NULL,
+};
+
+struct bios_config ovmf64_config =  {
+    .name = "OVMF-X64",
+
+    .image = ovmf64,
+    .image_size = sizeof(ovmf64),
+
+    .bios_address = 0,
+    .bios_load = ovmf_load,
+
+    .load_roms = 0,
+
+    .bios_info_setup = NULL,
+    .bios_info_finish = NULL,
+
+    .e820_setup = NULL,
+
+    .acpi_build_tables = ovmf_acpi_build_tables,
+    .create_mp_tables = NULL,
+    .create_smbios_tables = ovmf_create_smbios_tables,
+    .create_pir_tables = NULL,
+};
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnL-0002BS-GR; Tue, 28 Feb 2012 06:44:19 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnJ-00029u-Rk
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1330411449!11368711!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20113 invoked from network); 28 Feb 2012 06:44:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnB-0004Es-0U
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnA-0007GA-Kp
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:08 +0000
Message-Id: <E1S2GnA-0007GA-Kp@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] IO-APIC: Prevent using EOI broadcast
	suppression if user specified ioapic_ack=new on the command line.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1329991127 0
# Node ID 9bf3ec036bef2b67338bf5685423e26de69bd031
# Parent  a4d93d0e0df2fafe5b3e2dab3e34799498a875e2
IO-APIC: Prevent using EOI broadcast suppression if user specified ioapic_ack=new on the command line.

Currently, if EOI broadcast suppression is advertised on the BSP
LAPIC, Xen will discard any user specified option regarding IO-APIC
ack mode.

This patch introduces a check which prevents EOI Broadcast suppression
from forcing the IO-APIC ack mode to old if the user has explicitly
asked for the new ack mode on the command line.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r a4d93d0e0df2 -r 9bf3ec036bef xen/arch/x86/apic.c
--- a/xen/arch/x86/apic.c	Wed Feb 22 14:33:24 2012 +0000
+++ b/xen/arch/x86/apic.c	Thu Feb 23 09:58:47 2012 +0000
@@ -424,9 +424,15 @@
      */
     if ( reg0 & APIC_LVR_DIRECTED_EOI )
     {
-        ioapic_ack_new = 0;
-        directed_eoi_enabled = 1;
-        printk("Enabled directed EOI with ioapic_ack_old on!\n");
+        if ( ioapic_ack_new == 1 && ioapic_ack_forced == 1 )
+            printk("Not enabling directed EOI because ioapic_ack_new has been "
+                   "forced on the command line\n");
+        else
+        {
+            ioapic_ack_new = 0;
+            directed_eoi_enabled = 1;
+            printk("Enabled directed EOI with ioapic_ack_old on!\n");
+        }
     }
 
     /*
diff -r a4d93d0e0df2 -r 9bf3ec036bef xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Wed Feb 22 14:33:24 2012 +0000
+++ b/xen/arch/x86/io_apic.c	Thu Feb 23 09:58:47 2012 +0000
@@ -44,6 +44,7 @@
 
 bool_t __read_mostly skip_ioapic_setup;
 bool_t __read_mostly ioapic_ack_new = 1;
+bool_t __read_mostly ioapic_ack_forced = 0;
 
 #ifndef sis_apic_bug
 /*
@@ -1543,9 +1544,15 @@
 static void __init setup_ioapic_ack(char *s)
 {
     if ( !strcmp(s, "old") )
+    {
         ioapic_ack_new = 0;
+        ioapic_ack_forced = 1;
+    }
     else if ( !strcmp(s, "new") )
+    {
         ioapic_ack_new = 1;
+        ioapic_ack_forced = 1;
+    }
     else
         printk("Unknown ioapic_ack value specified: '%s'\n", s);
 }
diff -r a4d93d0e0df2 -r 9bf3ec036bef xen/include/asm-x86/io_apic.h
--- a/xen/include/asm-x86/io_apic.h	Wed Feb 22 14:33:24 2012 +0000
+++ b/xen/include/asm-x86/io_apic.h	Thu Feb 23 09:58:47 2012 +0000
@@ -180,6 +180,7 @@
 /* 1 if "noapic" boot option passed */
 extern bool_t skip_ioapic_setup;
 extern bool_t ioapic_ack_new;
+extern bool_t ioapic_ack_forced;
 
 #ifdef CONFIG_ACPI_BOOT
 extern int io_apic_get_unique_id (int ioapic, int apic_id);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnL-0002BS-GR; Tue, 28 Feb 2012 06:44:19 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnJ-00029u-Rk
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1330411449!11368711!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20113 invoked from network); 28 Feb 2012 06:44:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnB-0004Es-0U
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnA-0007GA-Kp
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:08 +0000
Message-Id: <E1S2GnA-0007GA-Kp@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] IO-APIC: Prevent using EOI broadcast
	suppression if user specified ioapic_ack=new on the command line.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1329991127 0
# Node ID 9bf3ec036bef2b67338bf5685423e26de69bd031
# Parent  a4d93d0e0df2fafe5b3e2dab3e34799498a875e2
IO-APIC: Prevent using EOI broadcast suppression if user specified ioapic_ack=new on the command line.

Currently, if EOI broadcast suppression is advertised on the BSP
LAPIC, Xen will discard any user specified option regarding IO-APIC
ack mode.

This patch introduces a check which prevents EOI Broadcast suppression
from forcing the IO-APIC ack mode to old if the user has explicitly
asked for the new ack mode on the command line.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r a4d93d0e0df2 -r 9bf3ec036bef xen/arch/x86/apic.c
--- a/xen/arch/x86/apic.c	Wed Feb 22 14:33:24 2012 +0000
+++ b/xen/arch/x86/apic.c	Thu Feb 23 09:58:47 2012 +0000
@@ -424,9 +424,15 @@
      */
     if ( reg0 & APIC_LVR_DIRECTED_EOI )
     {
-        ioapic_ack_new = 0;
-        directed_eoi_enabled = 1;
-        printk("Enabled directed EOI with ioapic_ack_old on!\n");
+        if ( ioapic_ack_new == 1 && ioapic_ack_forced == 1 )
+            printk("Not enabling directed EOI because ioapic_ack_new has been "
+                   "forced on the command line\n");
+        else
+        {
+            ioapic_ack_new = 0;
+            directed_eoi_enabled = 1;
+            printk("Enabled directed EOI with ioapic_ack_old on!\n");
+        }
     }
 
     /*
diff -r a4d93d0e0df2 -r 9bf3ec036bef xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Wed Feb 22 14:33:24 2012 +0000
+++ b/xen/arch/x86/io_apic.c	Thu Feb 23 09:58:47 2012 +0000
@@ -44,6 +44,7 @@
 
 bool_t __read_mostly skip_ioapic_setup;
 bool_t __read_mostly ioapic_ack_new = 1;
+bool_t __read_mostly ioapic_ack_forced = 0;
 
 #ifndef sis_apic_bug
 /*
@@ -1543,9 +1544,15 @@
 static void __init setup_ioapic_ack(char *s)
 {
     if ( !strcmp(s, "old") )
+    {
         ioapic_ack_new = 0;
+        ioapic_ack_forced = 1;
+    }
     else if ( !strcmp(s, "new") )
+    {
         ioapic_ack_new = 1;
+        ioapic_ack_forced = 1;
+    }
     else
         printk("Unknown ioapic_ack value specified: '%s'\n", s);
 }
diff -r a4d93d0e0df2 -r 9bf3ec036bef xen/include/asm-x86/io_apic.h
--- a/xen/include/asm-x86/io_apic.h	Wed Feb 22 14:33:24 2012 +0000
+++ b/xen/include/asm-x86/io_apic.h	Thu Feb 23 09:58:47 2012 +0000
@@ -180,6 +180,7 @@
 /* 1 if "noapic" boot option passed */
 extern bool_t skip_ioapic_setup;
 extern bool_t ioapic_ack_new;
+extern bool_t ioapic_ack_forced;
 
 #ifdef CONFIG_ACPI_BOOT
 extern int io_apic_get_unique_id (int ioapic, int apic_id);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnI-0002AJ-8B; Tue, 28 Feb 2012 06:44:16 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnH-0002A9-4E
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1330411384!58467498!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.3 required=7.0 tests=MAILTO_TO_SPAM_ADDR
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29568 invoked from network); 28 Feb 2012 06:43:05 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:43:05 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnE-0004FI-35
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnD-0007IO-Oh
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:11 +0000
Message-Id: <E1S2GnD-0007IO-Oh@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] hvmloader: Add OVMF UEFI support and
	directly use it
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Attilio Rao <attilio.rao@citrix.com>
# Date 1329991918 0
# Node ID 7cf234b198a3252b197aa08a551c7c2b19369ce9
# Parent  a59c1dcfe968ee8a28cf2cdfd5c254741c0f36d3
hvmloader: Add OVMF UEFI support and directly use it
...when specified in the guest configuration file.

This work is somewhat based on Bei Guan effort during the SoC 2011 and
relies on upstream edk2/ovmf Tianocore ROM to be built separately and
manually copied as:
Build/OvmfX64/DEBUG_GCC44/FV/OVMF.fd ->
tools/firmware/ovmf/ovmf-x64.bin
Build/OvmfIa32/DEBUG_GCC44/FV/OVMF.fd ->
toolf/firmware/ovmf/ovmf-ia32.bin

A way to integrate OVMF build directly into XEN has still be discussed
on the mailing list appropriately.

Signed-off-by: Attilio Rao <attilio.rao@citrix.com>

Disable CONFIG_OVMF by default as ovmf is not integrated into the
build.

Signed-off-by: Keir Fraser <keir@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r a59c1dcfe968 -r 7cf234b198a3 Config.mk
--- a/Config.mk	Thu Feb 23 10:03:07 2012 +0000
+++ b/Config.mk	Thu Feb 23 10:11:58 2012 +0000
@@ -198,6 +198,7 @@
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
+CONFIG_OVMF ?= n
 CONFIG_ROMBIOS ?= y
 CONFIG_SEABIOS ?= y
 
diff -r a59c1dcfe968 -r 7cf234b198a3 tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile	Thu Feb 23 10:03:07 2012 +0000
+++ b/tools/firmware/hvmloader/Makefile	Thu Feb 23 10:11:58 2012 +0000
@@ -37,6 +37,7 @@
 
 CIRRUSVGA_DEBUG ?= n
 
+OVMF_DIR := ../ovmf
 ROMBIOS_DIR := ../rombios
 SEABIOS_DIR := ../seabios-dir
 
@@ -52,6 +53,14 @@
 
 ROMS := 
 
+ifeq ($(CONFIG_OVMF),y)
+OBJS += ovmf.o
+CFLAGS += -DENABLE_OVMF32 -DENABLE_OVMF64
+OVMF32_ROM := $(OVMF_DIR)/ovmf-ia32.bin
+OVMF64_ROM := $(OVMF_DIR)/ovmf-x64.bin
+ROMS += $(OVMF32_ROM) $(OVMF64_ROM)
+endif
+
 ifeq ($(CONFIG_ROMBIOS),y)
 OBJS += optionroms.o 32bitbios_support.o rombios.o
 CFLAGS += -DENABLE_ROMBIOS
@@ -70,7 +79,7 @@
 all: subdirs-all
 	$(MAKE) hvmloader
 
-rombios.o seabios.o hvmloader.o: roms.inc
+ovmf.o rombios.o seabios.o hvmloader.o: roms.inc
 smbios.o: CFLAGS += -D__SMBIOS_DATE__="\"$(shell date +%m/%d/%Y)\""
 
 hvmloader: $(OBJS) acpi/acpi.a
@@ -93,6 +102,18 @@
 	echo "#endif" >> $@.new
 endif
 
+ifneq ($(OVMF32_ROM),)
+	echo "#ifdef ROM_INCLUDE_OVMF32" >> $@.new
+	sh ./mkhex ovmf32 $(OVMF32_ROM) >> $@.new
+	echo "#endif" >> $@.new	
+endif 
+
+ifneq ($(OVMF64_ROM),)
+	echo "#ifdef ROM_INCLUDE_OVMF64" >> $@.new
+	sh ./mkhex ovmf64 $(OVMF64_ROM) >> $@.new
+	echo "#endif" >> $@.new	
+endif 
+
 ifneq ($(STDVGA_ROM),)
 	echo "#ifdef ROM_INCLUDE_VGABIOS" >> $@.new
 	sh ./mkhex vgabios_stdvga $(STDVGA_ROM) >> $@.new
diff -r a59c1dcfe968 -r 7cf234b198a3 tools/firmware/hvmloader/config.h
--- a/tools/firmware/hvmloader/config.h	Thu Feb 23 10:03:07 2012 +0000
+++ b/tools/firmware/hvmloader/config.h	Thu Feb 23 10:11:58 2012 +0000
@@ -35,6 +35,8 @@
 
 extern struct bios_config rombios_config;
 extern struct bios_config seabios_config;
+extern struct bios_config ovmf32_config;
+extern struct bios_config ovmf64_config;
 
 #define PAGE_SHIFT 12
 #define PAGE_SIZE  (1ul << PAGE_SHIFT)
diff -r a59c1dcfe968 -r 7cf234b198a3 tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c	Thu Feb 23 10:03:07 2012 +0000
+++ b/tools/firmware/hvmloader/hvmloader.c	Thu Feb 23 10:11:58 2012 +0000
@@ -212,6 +212,12 @@
 #ifdef ENABLE_SEABIOS
     { "seabios", &seabios_config, },
 #endif
+#ifdef ENABLE_OVMF32
+    { "ovmf-ia32", &ovmf32_config, },
+#endif
+#ifdef ENABLE_OVMF64
+    { "ovmf-x64", &ovmf64_config, },
+#endif
     { NULL, NULL }
 };
 
diff -r a59c1dcfe968 -r 7cf234b198a3 tools/firmware/hvmloader/ovmf.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/firmware/hvmloader/ovmf.c	Thu Feb 23 10:11:58 2012 +0000
@@ -0,0 +1,149 @@
+/*
+ * HVM OVMF UEFI support.
+ *
+ * Bei Guan, gbtju85@gmail.com
+ * Andrei Warkentin, andreiw@motorola.com
+ * Leendert van Doorn, leendert@watson.ibm.com
+ * Copyright (c) 2005, International Business Machines Corporation.
+ * Copyright (c) 2006, Keir Fraser, XenSource Inc.
+ * Copyright (c) 2011, Citrix Inc.
+ *
+ * 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 "config.h"
+#include "smbios_types.h"
+#include "acpi/acpi2_0.h"
+#include "apic_regs.h"
+#include "../rombios/config.h"
+#include "util.h"
+#include "pci_regs.h"
+#include "hypercall.h"
+
+#include <xen/hvm/params.h>
+#include <xen/hvm/ioreq.h>
+#include <xen/memory.h>
+
+#define ROM_INCLUDE_OVMF32
+#define ROM_INCLUDE_OVMF64
+#include "roms.inc"
+
+#define OVMF_BEGIN              0xFFF00000ULL
+#define OVMF_SIZE               0x00100000ULL
+#define OVMF_MAXOFFSET          0x000FFFFFULL
+#define OVMF_END                (OVMF_BEGIN + OVMF_SIZE)
+#define LOWCHUNK_BEGIN          0x000F0000
+#define LOWCHUNK_SIZE           0x00010000
+#define LOWCHUNK_MAXOFFSET      0x0000FFFF
+#define LOWCHUNK_END            (OVMF_BEGIN + OVMF_SIZE)
+
+extern unsigned char dsdt_anycpu[], dsdt_15cpu[];
+extern int dsdt_anycpu_len, dsdt_15cpu_len;
+
+static void ovmf_load(const struct bios_config *config)
+{
+    xen_pfn_t mfn;
+    uint64_t addr = OVMF_BEGIN;
+
+    /* Copy low-reset vector portion. */
+    memcpy((void *) LOWCHUNK_BEGIN, (uint8_t *) config->image
+           + OVMF_SIZE
+           - LOWCHUNK_SIZE,
+           LOWCHUNK_SIZE);
+
+    /* Ensure we have backing page prior to moving FD. */
+    while ( (addr >> PAGE_SHIFT) != (OVMF_END >> PAGE_SHIFT) )
+    {
+        mfn = (uint32_t) (addr >> PAGE_SHIFT);
+        addr += PAGE_SIZE;
+        mem_hole_populate_ram(mfn, 1);
+    }
+
+    /* Copy FD. */
+    memcpy((void *) OVMF_BEGIN, config->image, OVMF_SIZE);
+}
+
+static void ovmf_acpi_build_tables(void)
+{
+    struct acpi_config config = {
+        .dsdt_anycpu = dsdt_anycpu,
+        .dsdt_anycpu_len = dsdt_anycpu_len,
+        .dsdt_15cpu = dsdt_15cpu,
+        .dsdt_15cpu_len = dsdt_15cpu_len,
+    };
+
+    acpi_build_tables(&config, ACPI_PHYSICAL_ADDRESS);
+}
+
+static void ovmf_create_smbios_tables(void)
+{
+    hvm_write_smbios_tables(
+        SMBIOS_PHYSICAL_ADDRESS,
+        SMBIOS_PHYSICAL_ADDRESS + sizeof(struct smbios_entry_point),
+        SMBIOS_PHYSICAL_END);
+}
+
+struct bios_config ovmf32_config =  {
+    .name = "OVMF-IA32",
+
+    .image = ovmf32,
+    .image_size = sizeof(ovmf32),
+
+    .bios_address = 0,
+    .bios_load = ovmf_load,
+
+    .load_roms = 0,
+
+    .bios_info_setup = NULL,
+    .bios_info_finish = NULL,
+
+    .e820_setup = NULL,
+
+    .acpi_build_tables = ovmf_acpi_build_tables,
+    .create_mp_tables = NULL,
+    .create_smbios_tables = ovmf_create_smbios_tables,
+    .create_pir_tables = NULL,
+};
+
+struct bios_config ovmf64_config =  {
+    .name = "OVMF-X64",
+
+    .image = ovmf64,
+    .image_size = sizeof(ovmf64),
+
+    .bios_address = 0,
+    .bios_load = ovmf_load,
+
+    .load_roms = 0,
+
+    .bios_info_setup = NULL,
+    .bios_info_finish = NULL,
+
+    .e820_setup = NULL,
+
+    .acpi_build_tables = ovmf_acpi_build_tables,
+    .create_mp_tables = NULL,
+    .create_smbios_tables = ovmf_create_smbios_tables,
+    .create_pir_tables = NULL,
+};
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnL-0002Bd-L9; Tue, 28 Feb 2012 06:44:19 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnK-0002Ae-5J
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1330411387!58467510!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29747 invoked from network); 28 Feb 2012 06:43:08 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:43:08 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnH-0004Fd-Gc
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnH-0007L2-FP
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:15 +0000
Message-Id: <E1S2GnH-0007L2-FP@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Don't check for invalid bits
	in non-present PTEs.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1329992967 0
# Node ID adcd6ab160fae996d53c6843da0c5728ca8a8bd3
# Parent  3d4955cbcb67a1c41e6b71af783b0921a3f7b081
x86/mm: Don't check for invalid bits in non-present PTEs.

If _PAGE_PRESENT is clean in a pagetable entry, any pattern of bits
is valid in the rest of the entry.  OSes that special-case
PFEC_invalid_bits (since it should never happen) will be confused
by our setting it in this way.

Signed-off-by: Tim Deegan <tim@xen.org>
---


diff -r 3d4955cbcb67 -r adcd6ab160fa xen/arch/x86/mm/guest_walk.c
--- a/xen/arch/x86/mm/guest_walk.c	Thu Feb 23 10:19:57 2012 +0000
+++ b/xen/arch/x86/mm/guest_walk.c	Thu Feb 23 10:29:27 2012 +0000
@@ -179,8 +179,11 @@
     l4p = (guest_l4e_t *) top_map;
     gw->l4e = l4p[guest_l4_table_offset(va)];
     gflags = guest_l4e_get_flags(gw->l4e) ^ iflags;
+    if ( !(gflags & _PAGE_PRESENT) ) {
+        rc |= _PAGE_PRESENT;
+        goto out;
+    }
     rc |= ((gflags & mflags) ^ mflags);
-    if ( rc & _PAGE_PRESENT ) goto out;
 
     /* Map the l3 table */
     l3p = map_domain_gfn(p2m, 
@@ -193,9 +196,11 @@
     /* Get the l3e and check its flags*/
     gw->l3e = l3p[guest_l3_table_offset(va)];
     gflags = guest_l3e_get_flags(gw->l3e) ^ iflags;
+    if ( !(gflags & _PAGE_PRESENT) ) {
+        rc |= _PAGE_PRESENT;
+        goto out;
+    }
     rc |= ((gflags & mflags) ^ mflags);
-    if ( rc & _PAGE_PRESENT )
-        goto out;
     
     pse1G = (gflags & _PAGE_PSE) && guest_supports_1G_superpages(v); 
 
@@ -261,9 +266,11 @@
 #endif /* All levels... */
 
     gflags = guest_l2e_get_flags(gw->l2e) ^ iflags;
+    if ( !(gflags & _PAGE_PRESENT) ) {
+        rc |= _PAGE_PRESENT;
+        goto out;
+    }
     rc |= ((gflags & mflags) ^ mflags);
-    if ( rc & _PAGE_PRESENT )
-        goto out;
 
     pse2M = (gflags & _PAGE_PSE) && guest_supports_superpages(v); 
 
@@ -321,6 +328,10 @@
             goto out;
         gw->l1e = l1p[guest_l1_table_offset(va)];
         gflags = guest_l1e_get_flags(gw->l1e) ^ iflags;
+        if ( !(gflags & _PAGE_PRESENT) ) {
+            rc |= _PAGE_PRESENT;
+            goto out;
+        }
         rc |= ((gflags & mflags) ^ mflags);
     }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnL-0002Bd-L9; Tue, 28 Feb 2012 06:44:19 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnK-0002Ae-5J
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1330411387!58467510!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29747 invoked from network); 28 Feb 2012 06:43:08 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:43:08 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnH-0004Fd-Gc
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnH-0007L2-FP
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:15 +0000
Message-Id: <E1S2GnH-0007L2-FP@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Don't check for invalid bits
	in non-present PTEs.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1329992967 0
# Node ID adcd6ab160fae996d53c6843da0c5728ca8a8bd3
# Parent  3d4955cbcb67a1c41e6b71af783b0921a3f7b081
x86/mm: Don't check for invalid bits in non-present PTEs.

If _PAGE_PRESENT is clean in a pagetable entry, any pattern of bits
is valid in the rest of the entry.  OSes that special-case
PFEC_invalid_bits (since it should never happen) will be confused
by our setting it in this way.

Signed-off-by: Tim Deegan <tim@xen.org>
---


diff -r 3d4955cbcb67 -r adcd6ab160fa xen/arch/x86/mm/guest_walk.c
--- a/xen/arch/x86/mm/guest_walk.c	Thu Feb 23 10:19:57 2012 +0000
+++ b/xen/arch/x86/mm/guest_walk.c	Thu Feb 23 10:29:27 2012 +0000
@@ -179,8 +179,11 @@
     l4p = (guest_l4e_t *) top_map;
     gw->l4e = l4p[guest_l4_table_offset(va)];
     gflags = guest_l4e_get_flags(gw->l4e) ^ iflags;
+    if ( !(gflags & _PAGE_PRESENT) ) {
+        rc |= _PAGE_PRESENT;
+        goto out;
+    }
     rc |= ((gflags & mflags) ^ mflags);
-    if ( rc & _PAGE_PRESENT ) goto out;
 
     /* Map the l3 table */
     l3p = map_domain_gfn(p2m, 
@@ -193,9 +196,11 @@
     /* Get the l3e and check its flags*/
     gw->l3e = l3p[guest_l3_table_offset(va)];
     gflags = guest_l3e_get_flags(gw->l3e) ^ iflags;
+    if ( !(gflags & _PAGE_PRESENT) ) {
+        rc |= _PAGE_PRESENT;
+        goto out;
+    }
     rc |= ((gflags & mflags) ^ mflags);
-    if ( rc & _PAGE_PRESENT )
-        goto out;
     
     pse1G = (gflags & _PAGE_PSE) && guest_supports_1G_superpages(v); 
 
@@ -261,9 +266,11 @@
 #endif /* All levels... */
 
     gflags = guest_l2e_get_flags(gw->l2e) ^ iflags;
+    if ( !(gflags & _PAGE_PRESENT) ) {
+        rc |= _PAGE_PRESENT;
+        goto out;
+    }
     rc |= ((gflags & mflags) ^ mflags);
-    if ( rc & _PAGE_PRESENT )
-        goto out;
 
     pse2M = (gflags & _PAGE_PSE) && guest_supports_superpages(v); 
 
@@ -321,6 +328,10 @@
             goto out;
         gw->l1e = l1p[guest_l1_table_offset(va)];
         gflags = guest_l1e_get_flags(gw->l1e) ^ iflags;
+        if ( !(gflags & _PAGE_PRESENT) ) {
+            rc |= _PAGE_PRESENT;
+            goto out;
+        }
         rc |= ((gflags & mflags) ^ mflags);
     }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnK-0002Ay-Dq; Tue, 28 Feb 2012 06:44:18 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnI-0002AQ-TW
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1330411402!62426013!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24138 invoked from network); 28 Feb 2012 06:43:23 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:43:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnG-0004FX-HT
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnG-0007KI-Cy
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:14 +0000
Message-Id: <E1S2GnG-0007KI-Cy@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxc: Implement SCHEDOP sysctl for
	credit scheduler
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1329992270 0
# Node ID 5b9d4bd3addf494d51259f6dde7bf2db751a341f
# Parent  dd9e8f1ebed1100fad2c01ff977ab66ff96d90b2
libxc: Implement SCHEDOP sysctl for credit scheduler

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r dd9e8f1ebed1 -r 5b9d4bd3addf tools/libxc/xc_csched.c
--- a/tools/libxc/xc_csched.c	Thu Feb 23 10:17:21 2012 +0000
+++ b/tools/libxc/xc_csched.c	Thu Feb 23 10:17:50 2012 +0000
@@ -61,3 +61,47 @@
 
     return err;
 }
+
+int
+xc_sched_credit_params_set(
+    xc_interface *xch,
+    uint32_t cpupool_id,
+    struct xen_sysctl_credit_schedule *schedule)
+{
+    int rc;
+    DECLARE_SYSCTL;
+
+    sysctl.cmd = XEN_SYSCTL_scheduler_op;
+    sysctl.u.scheduler_op.cpupool_id = cpupool_id;
+    sysctl.u.scheduler_op.sched_id = XEN_SCHEDULER_CREDIT;
+    sysctl.u.scheduler_op.cmd = XEN_SYSCTL_SCHEDOP_putinfo;
+
+    sysctl.u.scheduler_op.u.sched_credit = *schedule;
+
+    rc = do_sysctl(xch, &sysctl);
+
+    *schedule = sysctl.u.scheduler_op.u.sched_credit;
+
+    return rc;
+}
+
+int
+xc_sched_credit_params_get(
+    xc_interface *xch,
+    uint32_t cpupool_id,
+    struct xen_sysctl_credit_schedule *schedule)
+{
+    int rc;
+    DECLARE_SYSCTL;
+
+    sysctl.cmd = XEN_SYSCTL_scheduler_op;
+    sysctl.u.scheduler_op.cpupool_id = cpupool_id;
+    sysctl.u.scheduler_op.sched_id = XEN_SCHEDULER_CREDIT;
+    sysctl.u.scheduler_op.cmd = XEN_SYSCTL_SCHEDOP_getinfo;
+
+    rc = do_sysctl(xch, &sysctl);
+
+    *schedule = sysctl.u.scheduler_op.u.sched_credit;
+
+    return rc;
+}
diff -r dd9e8f1ebed1 -r 5b9d4bd3addf tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h	Thu Feb 23 10:17:21 2012 +0000
+++ b/tools/libxc/xenctrl.h	Thu Feb 23 10:17:50 2012 +0000
@@ -668,7 +668,12 @@
 int xc_sched_credit_domain_get(xc_interface *xch,
                                uint32_t domid,
                                struct xen_domctl_sched_credit *sdom);
-
+int xc_sched_credit_params_set(xc_interface *xch,
+                              uint32_t cpupool_id,
+                              struct xen_sysctl_credit_schedule *schedule);
+int xc_sched_credit_params_get(xc_interface *xch,
+                              uint32_t cpupool_id,
+                              struct xen_sysctl_credit_schedule *schedule);
 int xc_sched_credit2_domain_set(xc_interface *xch,
                                uint32_t domid,
                                struct xen_domctl_sched_credit2 *sdom);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnK-0002Ay-Dq; Tue, 28 Feb 2012 06:44:18 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnI-0002AQ-TW
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1330411402!62426013!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24138 invoked from network); 28 Feb 2012 06:43:23 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:43:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnG-0004FX-HT
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnG-0007KI-Cy
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:14 +0000
Message-Id: <E1S2GnG-0007KI-Cy@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxc: Implement SCHEDOP sysctl for
	credit scheduler
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1329992270 0
# Node ID 5b9d4bd3addf494d51259f6dde7bf2db751a341f
# Parent  dd9e8f1ebed1100fad2c01ff977ab66ff96d90b2
libxc: Implement SCHEDOP sysctl for credit scheduler

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r dd9e8f1ebed1 -r 5b9d4bd3addf tools/libxc/xc_csched.c
--- a/tools/libxc/xc_csched.c	Thu Feb 23 10:17:21 2012 +0000
+++ b/tools/libxc/xc_csched.c	Thu Feb 23 10:17:50 2012 +0000
@@ -61,3 +61,47 @@
 
     return err;
 }
+
+int
+xc_sched_credit_params_set(
+    xc_interface *xch,
+    uint32_t cpupool_id,
+    struct xen_sysctl_credit_schedule *schedule)
+{
+    int rc;
+    DECLARE_SYSCTL;
+
+    sysctl.cmd = XEN_SYSCTL_scheduler_op;
+    sysctl.u.scheduler_op.cpupool_id = cpupool_id;
+    sysctl.u.scheduler_op.sched_id = XEN_SCHEDULER_CREDIT;
+    sysctl.u.scheduler_op.cmd = XEN_SYSCTL_SCHEDOP_putinfo;
+
+    sysctl.u.scheduler_op.u.sched_credit = *schedule;
+
+    rc = do_sysctl(xch, &sysctl);
+
+    *schedule = sysctl.u.scheduler_op.u.sched_credit;
+
+    return rc;
+}
+
+int
+xc_sched_credit_params_get(
+    xc_interface *xch,
+    uint32_t cpupool_id,
+    struct xen_sysctl_credit_schedule *schedule)
+{
+    int rc;
+    DECLARE_SYSCTL;
+
+    sysctl.cmd = XEN_SYSCTL_scheduler_op;
+    sysctl.u.scheduler_op.cpupool_id = cpupool_id;
+    sysctl.u.scheduler_op.sched_id = XEN_SCHEDULER_CREDIT;
+    sysctl.u.scheduler_op.cmd = XEN_SYSCTL_SCHEDOP_getinfo;
+
+    rc = do_sysctl(xch, &sysctl);
+
+    *schedule = sysctl.u.scheduler_op.u.sched_credit;
+
+    return rc;
+}
diff -r dd9e8f1ebed1 -r 5b9d4bd3addf tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h	Thu Feb 23 10:17:21 2012 +0000
+++ b/tools/libxc/xenctrl.h	Thu Feb 23 10:17:50 2012 +0000
@@ -668,7 +668,12 @@
 int xc_sched_credit_domain_get(xc_interface *xch,
                                uint32_t domid,
                                struct xen_domctl_sched_credit *sdom);
-
+int xc_sched_credit_params_set(xc_interface *xch,
+                              uint32_t cpupool_id,
+                              struct xen_sysctl_credit_schedule *schedule);
+int xc_sched_credit_params_get(xc_interface *xch,
+                              uint32_t cpupool_id,
+                              struct xen_sysctl_credit_schedule *schedule);
 int xc_sched_credit2_domain_set(xc_interface *xch,
                                uint32_t domid,
                                struct xen_domctl_sched_credit2 *sdom);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnO-0002DC-4r; Tue, 28 Feb 2012 06:44:22 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnM-0002AA-4r
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-27.messagelabs.com!1330411322!60971530!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15173 invoked from network); 28 Feb 2012 06:42:03 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:42:03 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnE-0004FO-U2
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnE-0007J9-PY
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:12 +0000
Message-Id: <E1S2GnE-0007J9-PY@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] scheduler: Add a #define for the
	default ratelimit
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1329992140 0
# Node ID 8e672cd04864c481beec0fe781463debd30f1492
# Parent  0c91a375f480ffabfba2f87a897ff26b6f4882f7
scheduler: Add a #define for the default ratelimit

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 0c91a375f480 -r 8e672cd04864 xen/common/schedule.c
--- a/xen/common/schedule.c	Thu Feb 23 10:14:55 2012 +0000
+++ b/xen/common/schedule.c	Thu Feb 23 10:15:40 2012 +0000
@@ -50,7 +50,7 @@
 /* Default scheduling rate limit: 1ms 
  * The behavior when sched_ratelimit_us is greater than sched_credit_tslice_ms is undefined
  * */
-int sched_ratelimit_us = 1000;
+int sched_ratelimit_us = SCHED_DEFAULT_RATELIMIT_US;
 integer_param("sched_ratelimit_us", sched_ratelimit_us);
 /* Various timer handlers. */
 static void s_timer_fn(void *unused);
diff -r 0c91a375f480 -r 8e672cd04864 xen/include/xen/sched-if.h
--- a/xen/include/xen/sched-if.h	Thu Feb 23 10:14:55 2012 +0000
+++ b/xen/include/xen/sched-if.h	Thu Feb 23 10:15:40 2012 +0000
@@ -18,6 +18,7 @@
 
 /* Scheduler generic parameters
  * */
+#define SCHED_DEFAULT_RATELIMIT_US 1000
 extern int sched_ratelimit_us;
 
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnO-0002DC-4r; Tue, 28 Feb 2012 06:44:22 +0000
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnM-0002AA-4r
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-27.messagelabs.com!1330411322!60971530!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15173 invoked from network); 28 Feb 2012 06:42:03 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:42:03 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnE-0004FO-U2
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnE-0007J9-PY
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:12 +0000
Message-Id: <E1S2GnE-0007J9-PY@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] scheduler: Add a #define for the
	default ratelimit
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1329992140 0
# Node ID 8e672cd04864c481beec0fe781463debd30f1492
# Parent  0c91a375f480ffabfba2f87a897ff26b6f4882f7
scheduler: Add a #define for the default ratelimit

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 0c91a375f480 -r 8e672cd04864 xen/common/schedule.c
--- a/xen/common/schedule.c	Thu Feb 23 10:14:55 2012 +0000
+++ b/xen/common/schedule.c	Thu Feb 23 10:15:40 2012 +0000
@@ -50,7 +50,7 @@
 /* Default scheduling rate limit: 1ms 
  * The behavior when sched_ratelimit_us is greater than sched_credit_tslice_ms is undefined
  * */
-int sched_ratelimit_us = 1000;
+int sched_ratelimit_us = SCHED_DEFAULT_RATELIMIT_US;
 integer_param("sched_ratelimit_us", sched_ratelimit_us);
 /* Various timer handlers. */
 static void s_timer_fn(void *unused);
diff -r 0c91a375f480 -r 8e672cd04864 xen/include/xen/sched-if.h
--- a/xen/include/xen/sched-if.h	Thu Feb 23 10:14:55 2012 +0000
+++ b/xen/include/xen/sched-if.h	Thu Feb 23 10:15:40 2012 +0000
@@ -18,6 +18,7 @@
 
 /* Scheduler generic parameters
  * */
+#define SCHED_DEFAULT_RATELIMIT_US 1000
 extern int sched_ratelimit_us;
 
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnM-0002CQ-T0; Tue, 28 Feb 2012 06:44:20 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnL-0002BJ-BP
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:19 +0000
Received: from [85.158.139.83:52017] by server-6.bemta-5.messagelabs.com id
	7D/D6-13222-2C77C4F4; Tue, 28 Feb 2012 06:44:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-182.messagelabs.com!1330411455!16118398!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7348 invoked from network); 28 Feb 2012 06:44:16 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:16 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnH-0004Fa-09
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnG-0007Kf-Uv
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:14 +0000
Message-Id: <E1S2GnG-0007Kf-Uv@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Rename libxl_sched_* to
	include _domain
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1329992397 0
# Node ID 3d4955cbcb67a1c41e6b71af783b0921a3f7b081
# Parent  5b9d4bd3addf494d51259f6dde7bf2db751a341f
libxl: Rename libxl_sched_* to include _domain

In preparation for introducing a schedule parameter-based structure,
rename libxl_sched_{credit,credit2,sedf} to libxl_sched_{}_domain.

No functional changes.

v2: Wrap long lines while I'm at it

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 5b9d4bd3addf -r 3d4955cbcb67 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Thu Feb 23 10:17:50 2012 +0000
+++ b/tools/libxl/libxl.c	Thu Feb 23 10:19:57 2012 +0000
@@ -2975,7 +2975,8 @@
     return sched;
 }
 
-int libxl_sched_credit_domain_get(libxl_ctx *ctx, uint32_t domid, libxl_sched_credit *scinfo)
+int libxl_sched_credit_domain_get(libxl_ctx *ctx, uint32_t domid,
+                                  libxl_sched_credit_domain *scinfo)
 {
     struct xen_domctl_sched_credit sdom;
     int rc;
@@ -2992,7 +2993,8 @@
     return 0;
 }
 
-int libxl_sched_credit_domain_set(libxl_ctx *ctx, uint32_t domid, libxl_sched_credit *scinfo)
+int libxl_sched_credit_domain_set(libxl_ctx *ctx, uint32_t domid,
+                                  libxl_sched_credit_domain *scinfo)
 {
     struct xen_domctl_sched_credit sdom;
     xc_domaininfo_t domaininfo;
@@ -3033,7 +3035,7 @@
 }
 
 int libxl_sched_credit2_domain_get(libxl_ctx *ctx, uint32_t domid,
-                                   libxl_sched_credit2 *scinfo)
+                                   libxl_sched_credit2_domain *scinfo)
 {
     struct xen_domctl_sched_credit2 sdom;
     int rc;
@@ -3051,7 +3053,7 @@
 }
 
 int libxl_sched_credit2_domain_set(libxl_ctx *ctx, uint32_t domid,
-                                   libxl_sched_credit2 *scinfo)
+                                   libxl_sched_credit2_domain *scinfo)
 {
     struct xen_domctl_sched_credit2 sdom;
     xc_domaininfo_t domaininfo;
@@ -3086,7 +3088,7 @@
 }
 
 int libxl_sched_sedf_domain_get(libxl_ctx *ctx, uint32_t domid,
-                                libxl_sched_sedf *scinfo)
+                                libxl_sched_sedf_domain *scinfo)
 {
     uint64_t period;
     uint64_t slice;
@@ -3112,7 +3114,7 @@
 }
 
 int libxl_sched_sedf_domain_set(libxl_ctx *ctx, uint32_t domid,
-                                libxl_sched_sedf *scinfo)
+                                libxl_sched_sedf_domain *scinfo)
 {
     xc_domaininfo_t domaininfo;
     int rc;
diff -r 5b9d4bd3addf -r 3d4955cbcb67 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Thu Feb 23 10:17:50 2012 +0000
+++ b/tools/libxl/libxl.h	Thu Feb 23 10:19:57 2012 +0000
@@ -588,17 +588,17 @@
 
 
 int libxl_sched_credit_domain_get(libxl_ctx *ctx, uint32_t domid,
-                                  libxl_sched_credit *scinfo);
+                                  libxl_sched_credit_domain *scinfo);
 int libxl_sched_credit_domain_set(libxl_ctx *ctx, uint32_t domid,
-                                  libxl_sched_credit *scinfo);
+                                  libxl_sched_credit_domain *scinfo);
 int libxl_sched_credit2_domain_get(libxl_ctx *ctx, uint32_t domid,
-                                   libxl_sched_credit2 *scinfo);
+                                   libxl_sched_credit2_domain *scinfo);
 int libxl_sched_credit2_domain_set(libxl_ctx *ctx, uint32_t domid,
-                                   libxl_sched_credit2 *scinfo);
+                                   libxl_sched_credit2_domain *scinfo);
 int libxl_sched_sedf_domain_get(libxl_ctx *ctx, uint32_t domid,
-                                libxl_sched_sedf *scinfo);
+                                libxl_sched_sedf_domain *scinfo);
 int libxl_sched_sedf_domain_set(libxl_ctx *ctx, uint32_t domid,
-                                libxl_sched_sedf *scinfo);
+                                libxl_sched_sedf_domain *scinfo);
 int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid,
                        libxl_trigger trigger, uint32_t vcpuid);
 int libxl_send_sysrq(libxl_ctx *ctx, uint32_t domid, char sysrq);
diff -r 5b9d4bd3addf -r 3d4955cbcb67 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Thu Feb 23 10:17:50 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Thu Feb 23 10:19:57 2012 +0000
@@ -390,16 +390,16 @@
     ("node", uint32),
     ])
 
-libxl_sched_credit = Struct("sched_credit", [
+libxl_sched_credit_domain = Struct("sched_credit_domain", [
     ("weight", integer),
     ("cap", integer),
     ], dispose_fn=None)
 
-libxl_sched_credit2 = Struct("sched_credit2", [
+libxl_sched_credit2_domain = Struct("sched_credit2_domain", [
     ("weight", integer),
     ], dispose_fn=None)
 
-libxl_sched_sedf = Struct("sched_sedf", [
+libxl_sched_sedf_domain = Struct("sched_sedf_domain", [
     ("period", integer),
     ("slice", integer),
     ("latency", integer),
diff -r 5b9d4bd3addf -r 3d4955cbcb67 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Thu Feb 23 10:17:50 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Thu Feb 23 10:19:57 2012 +0000
@@ -3913,7 +3913,7 @@
 }
 
 static int sched_credit_domain_get(
-    int domid, libxl_sched_credit *scinfo)
+    int domid, libxl_sched_credit_domain *scinfo)
 {
     int rc;
 
@@ -3925,7 +3925,7 @@
 }
 
 static int sched_credit_domain_set(
-    int domid, libxl_sched_credit *scinfo)
+    int domid, libxl_sched_credit_domain *scinfo)
 {
     int rc;
 
@@ -3940,7 +3940,7 @@
     int domid)
 {
     char *domname;
-    libxl_sched_credit scinfo;
+    libxl_sched_credit_domain scinfo;
     int rc;
 
     if (domid < 0) {
@@ -3961,7 +3961,7 @@
 }
 
 static int sched_credit2_domain_get(
-    int domid, libxl_sched_credit2 *scinfo)
+    int domid, libxl_sched_credit2_domain *scinfo)
 {
     int rc;
 
@@ -3973,7 +3973,7 @@
 }
 
 static int sched_credit2_domain_set(
-    int domid, libxl_sched_credit2 *scinfo)
+    int domid, libxl_sched_credit2_domain *scinfo)
 {
     int rc;
 
@@ -3988,7 +3988,7 @@
     int domid)
 {
     char *domname;
-    libxl_sched_credit2 scinfo;
+    libxl_sched_credit2_domain scinfo;
     int rc;
 
     if (domid < 0) {
@@ -4008,7 +4008,7 @@
 }
 
 static int sched_sedf_domain_get(
-    int domid, libxl_sched_sedf *scinfo)
+    int domid, libxl_sched_sedf_domain *scinfo)
 {
     int rc;
 
@@ -4020,7 +4020,7 @@
 }
 
 static int sched_sedf_domain_set(
-    int domid, libxl_sched_sedf *scinfo)
+    int domid, libxl_sched_sedf_domain *scinfo)
 {
     int rc;
 
@@ -4035,7 +4035,7 @@
     int domid)
 {
     char *domname;
-    libxl_sched_sedf scinfo;
+    libxl_sched_sedf_domain scinfo;
     int rc;
 
     if (domid < 0) {
@@ -4116,7 +4116,7 @@
 
 int main_sched_credit(int argc, char **argv)
 {
-    libxl_sched_credit scinfo;
+    libxl_sched_credit_domain scinfo;
     const char *dom = NULL;
     const char *cpupool = NULL;
     int weight = 256, cap = 0, opt_w = 0, opt_c = 0;
@@ -4198,7 +4198,7 @@
 
 int main_sched_credit2(int argc, char **argv)
 {
-    libxl_sched_credit2 scinfo;
+    libxl_sched_credit2_domain scinfo;
     const char *dom = NULL;
     const char *cpupool = NULL;
     int weight = 256, opt_w = 0;
@@ -4272,7 +4272,7 @@
 
 int main_sched_sedf(int argc, char **argv)
 {
-    libxl_sched_sedf scinfo;
+    libxl_sched_sedf_domain scinfo;
     const char *dom = NULL;
     const char *cpupool = NULL;
     int period = 0, opt_p = 0;
diff -r 5b9d4bd3addf -r 3d4955cbcb67 tools/ocaml/libs/xl/xenlight_stubs.c
--- a/tools/ocaml/libs/xl/xenlight_stubs.c	Thu Feb 23 10:17:50 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c	Thu Feb 23 10:19:57 2012 +0000
@@ -473,7 +473,7 @@
 {
 	CAMLparam1(domid);
 	CAMLlocal1(scinfo);
-	libxl_sched_credit c_scinfo;
+	libxl_sched_credit_domain c_scinfo;
 	int ret;
 	INIT_STRUCT();
 
@@ -483,18 +483,18 @@
 		failwith_xl("sched_credit_domain_get", &lg);
 	FREE_CTX();
 
-	scinfo = Val_sched_credit(&gc, &lg, &c_scinfo);
+	scinfo = Val_sched_credit_domain(&gc, &lg, &c_scinfo);
 	CAMLreturn(scinfo);
 }
 
 value stub_xl_sched_credit_domain_set(value domid, value scinfo)
 {
 	CAMLparam2(domid, scinfo);
-	libxl_sched_credit c_scinfo;
+	libxl_sched_credit_domain c_scinfo;
 	int ret;
 	INIT_STRUCT();
 
-	sched_credit_val(&gc, &lg, &c_scinfo, scinfo);
+	sched_credit_domain_val(&gc, &lg, &c_scinfo, scinfo);
 
 	INIT_CTX();
 	ret = libxl_sched_credit_domain_set(ctx, Int_val(domid), &c_scinfo);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnM-0002CQ-T0; Tue, 28 Feb 2012 06:44:20 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnL-0002BJ-BP
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:19 +0000
Received: from [85.158.139.83:52017] by server-6.bemta-5.messagelabs.com id
	7D/D6-13222-2C77C4F4; Tue, 28 Feb 2012 06:44:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-182.messagelabs.com!1330411455!16118398!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7348 invoked from network); 28 Feb 2012 06:44:16 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:16 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnH-0004Fa-09
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnG-0007Kf-Uv
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:14 +0000
Message-Id: <E1S2GnG-0007Kf-Uv@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Rename libxl_sched_* to
	include _domain
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1329992397 0
# Node ID 3d4955cbcb67a1c41e6b71af783b0921a3f7b081
# Parent  5b9d4bd3addf494d51259f6dde7bf2db751a341f
libxl: Rename libxl_sched_* to include _domain

In preparation for introducing a schedule parameter-based structure,
rename libxl_sched_{credit,credit2,sedf} to libxl_sched_{}_domain.

No functional changes.

v2: Wrap long lines while I'm at it

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 5b9d4bd3addf -r 3d4955cbcb67 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Thu Feb 23 10:17:50 2012 +0000
+++ b/tools/libxl/libxl.c	Thu Feb 23 10:19:57 2012 +0000
@@ -2975,7 +2975,8 @@
     return sched;
 }
 
-int libxl_sched_credit_domain_get(libxl_ctx *ctx, uint32_t domid, libxl_sched_credit *scinfo)
+int libxl_sched_credit_domain_get(libxl_ctx *ctx, uint32_t domid,
+                                  libxl_sched_credit_domain *scinfo)
 {
     struct xen_domctl_sched_credit sdom;
     int rc;
@@ -2992,7 +2993,8 @@
     return 0;
 }
 
-int libxl_sched_credit_domain_set(libxl_ctx *ctx, uint32_t domid, libxl_sched_credit *scinfo)
+int libxl_sched_credit_domain_set(libxl_ctx *ctx, uint32_t domid,
+                                  libxl_sched_credit_domain *scinfo)
 {
     struct xen_domctl_sched_credit sdom;
     xc_domaininfo_t domaininfo;
@@ -3033,7 +3035,7 @@
 }
 
 int libxl_sched_credit2_domain_get(libxl_ctx *ctx, uint32_t domid,
-                                   libxl_sched_credit2 *scinfo)
+                                   libxl_sched_credit2_domain *scinfo)
 {
     struct xen_domctl_sched_credit2 sdom;
     int rc;
@@ -3051,7 +3053,7 @@
 }
 
 int libxl_sched_credit2_domain_set(libxl_ctx *ctx, uint32_t domid,
-                                   libxl_sched_credit2 *scinfo)
+                                   libxl_sched_credit2_domain *scinfo)
 {
     struct xen_domctl_sched_credit2 sdom;
     xc_domaininfo_t domaininfo;
@@ -3086,7 +3088,7 @@
 }
 
 int libxl_sched_sedf_domain_get(libxl_ctx *ctx, uint32_t domid,
-                                libxl_sched_sedf *scinfo)
+                                libxl_sched_sedf_domain *scinfo)
 {
     uint64_t period;
     uint64_t slice;
@@ -3112,7 +3114,7 @@
 }
 
 int libxl_sched_sedf_domain_set(libxl_ctx *ctx, uint32_t domid,
-                                libxl_sched_sedf *scinfo)
+                                libxl_sched_sedf_domain *scinfo)
 {
     xc_domaininfo_t domaininfo;
     int rc;
diff -r 5b9d4bd3addf -r 3d4955cbcb67 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Thu Feb 23 10:17:50 2012 +0000
+++ b/tools/libxl/libxl.h	Thu Feb 23 10:19:57 2012 +0000
@@ -588,17 +588,17 @@
 
 
 int libxl_sched_credit_domain_get(libxl_ctx *ctx, uint32_t domid,
-                                  libxl_sched_credit *scinfo);
+                                  libxl_sched_credit_domain *scinfo);
 int libxl_sched_credit_domain_set(libxl_ctx *ctx, uint32_t domid,
-                                  libxl_sched_credit *scinfo);
+                                  libxl_sched_credit_domain *scinfo);
 int libxl_sched_credit2_domain_get(libxl_ctx *ctx, uint32_t domid,
-                                   libxl_sched_credit2 *scinfo);
+                                   libxl_sched_credit2_domain *scinfo);
 int libxl_sched_credit2_domain_set(libxl_ctx *ctx, uint32_t domid,
-                                   libxl_sched_credit2 *scinfo);
+                                   libxl_sched_credit2_domain *scinfo);
 int libxl_sched_sedf_domain_get(libxl_ctx *ctx, uint32_t domid,
-                                libxl_sched_sedf *scinfo);
+                                libxl_sched_sedf_domain *scinfo);
 int libxl_sched_sedf_domain_set(libxl_ctx *ctx, uint32_t domid,
-                                libxl_sched_sedf *scinfo);
+                                libxl_sched_sedf_domain *scinfo);
 int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid,
                        libxl_trigger trigger, uint32_t vcpuid);
 int libxl_send_sysrq(libxl_ctx *ctx, uint32_t domid, char sysrq);
diff -r 5b9d4bd3addf -r 3d4955cbcb67 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Thu Feb 23 10:17:50 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Thu Feb 23 10:19:57 2012 +0000
@@ -390,16 +390,16 @@
     ("node", uint32),
     ])
 
-libxl_sched_credit = Struct("sched_credit", [
+libxl_sched_credit_domain = Struct("sched_credit_domain", [
     ("weight", integer),
     ("cap", integer),
     ], dispose_fn=None)
 
-libxl_sched_credit2 = Struct("sched_credit2", [
+libxl_sched_credit2_domain = Struct("sched_credit2_domain", [
     ("weight", integer),
     ], dispose_fn=None)
 
-libxl_sched_sedf = Struct("sched_sedf", [
+libxl_sched_sedf_domain = Struct("sched_sedf_domain", [
     ("period", integer),
     ("slice", integer),
     ("latency", integer),
diff -r 5b9d4bd3addf -r 3d4955cbcb67 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Thu Feb 23 10:17:50 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Thu Feb 23 10:19:57 2012 +0000
@@ -3913,7 +3913,7 @@
 }
 
 static int sched_credit_domain_get(
-    int domid, libxl_sched_credit *scinfo)
+    int domid, libxl_sched_credit_domain *scinfo)
 {
     int rc;
 
@@ -3925,7 +3925,7 @@
 }
 
 static int sched_credit_domain_set(
-    int domid, libxl_sched_credit *scinfo)
+    int domid, libxl_sched_credit_domain *scinfo)
 {
     int rc;
 
@@ -3940,7 +3940,7 @@
     int domid)
 {
     char *domname;
-    libxl_sched_credit scinfo;
+    libxl_sched_credit_domain scinfo;
     int rc;
 
     if (domid < 0) {
@@ -3961,7 +3961,7 @@
 }
 
 static int sched_credit2_domain_get(
-    int domid, libxl_sched_credit2 *scinfo)
+    int domid, libxl_sched_credit2_domain *scinfo)
 {
     int rc;
 
@@ -3973,7 +3973,7 @@
 }
 
 static int sched_credit2_domain_set(
-    int domid, libxl_sched_credit2 *scinfo)
+    int domid, libxl_sched_credit2_domain *scinfo)
 {
     int rc;
 
@@ -3988,7 +3988,7 @@
     int domid)
 {
     char *domname;
-    libxl_sched_credit2 scinfo;
+    libxl_sched_credit2_domain scinfo;
     int rc;
 
     if (domid < 0) {
@@ -4008,7 +4008,7 @@
 }
 
 static int sched_sedf_domain_get(
-    int domid, libxl_sched_sedf *scinfo)
+    int domid, libxl_sched_sedf_domain *scinfo)
 {
     int rc;
 
@@ -4020,7 +4020,7 @@
 }
 
 static int sched_sedf_domain_set(
-    int domid, libxl_sched_sedf *scinfo)
+    int domid, libxl_sched_sedf_domain *scinfo)
 {
     int rc;
 
@@ -4035,7 +4035,7 @@
     int domid)
 {
     char *domname;
-    libxl_sched_sedf scinfo;
+    libxl_sched_sedf_domain scinfo;
     int rc;
 
     if (domid < 0) {
@@ -4116,7 +4116,7 @@
 
 int main_sched_credit(int argc, char **argv)
 {
-    libxl_sched_credit scinfo;
+    libxl_sched_credit_domain scinfo;
     const char *dom = NULL;
     const char *cpupool = NULL;
     int weight = 256, cap = 0, opt_w = 0, opt_c = 0;
@@ -4198,7 +4198,7 @@
 
 int main_sched_credit2(int argc, char **argv)
 {
-    libxl_sched_credit2 scinfo;
+    libxl_sched_credit2_domain scinfo;
     const char *dom = NULL;
     const char *cpupool = NULL;
     int weight = 256, opt_w = 0;
@@ -4272,7 +4272,7 @@
 
 int main_sched_sedf(int argc, char **argv)
 {
-    libxl_sched_sedf scinfo;
+    libxl_sched_sedf_domain scinfo;
     const char *dom = NULL;
     const char *cpupool = NULL;
     int period = 0, opt_p = 0;
diff -r 5b9d4bd3addf -r 3d4955cbcb67 tools/ocaml/libs/xl/xenlight_stubs.c
--- a/tools/ocaml/libs/xl/xenlight_stubs.c	Thu Feb 23 10:17:50 2012 +0000
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c	Thu Feb 23 10:19:57 2012 +0000
@@ -473,7 +473,7 @@
 {
 	CAMLparam1(domid);
 	CAMLlocal1(scinfo);
-	libxl_sched_credit c_scinfo;
+	libxl_sched_credit_domain c_scinfo;
 	int ret;
 	INIT_STRUCT();
 
@@ -483,18 +483,18 @@
 		failwith_xl("sched_credit_domain_get", &lg);
 	FREE_CTX();
 
-	scinfo = Val_sched_credit(&gc, &lg, &c_scinfo);
+	scinfo = Val_sched_credit_domain(&gc, &lg, &c_scinfo);
 	CAMLreturn(scinfo);
 }
 
 value stub_xl_sched_credit_domain_set(value domid, value scinfo)
 {
 	CAMLparam2(domid, scinfo);
-	libxl_sched_credit c_scinfo;
+	libxl_sched_credit_domain c_scinfo;
 	int ret;
 	INIT_STRUCT();
 
-	sched_credit_val(&gc, &lg, &c_scinfo, scinfo);
+	sched_credit_domain_val(&gc, &lg, &c_scinfo, scinfo);
 
 	INIT_CTX();
 	ret = libxl_sched_credit_domain_set(ctx, Int_val(domid), &c_scinfo);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnO-0002Dy-Gi; Tue, 28 Feb 2012 06:44:22 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnN-0002AH-6m
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1330411453!3900868!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5347 invoked from network); 28 Feb 2012 06:44:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnD-0004FF-CA
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnD-0007I0-7r
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:11 +0000
Message-Id: <E1S2GnD-0007I0-7r@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] blkif.h: Define and document the
	request number/size/segments extension
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Justin T. Gibbs <justing@spectralogic.com>
# Date 1329991387 0
# Node ID a59c1dcfe968ee8a28cf2cdfd5c254741c0f36d3
# Parent  f9789db96c395aa0770f7ce46d3e9950d9019a5b
blkif.h: Define and document the request number/size/segments extension

Note: As of __XEN_INTERFACE_VERSION__ 0x00040201 the definition of
      BLKIF_MAX_SEGMENTS_PER_REQUEST has changed.  Drivers must be
      updated to, at minimum, use BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK,
      before being recompiled with a __XEN_INTERFACE_VERSION greater
      than or equal to this value.

This extension first appeared in the FreeBSD Operating System.

Signed-off-by: Justin T. Gibbs <justing@spectralogic.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r f9789db96c39 -r a59c1dcfe968 xen/include/public/io/blkif.h
--- a/xen/include/public/io/blkif.h	Thu Feb 23 10:02:30 2012 +0000
+++ b/xen/include/public/io/blkif.h	Thu Feb 23 10:03:07 2012 +0000
@@ -145,6 +145,32 @@
  *      The maximum supported size of the request ring buffer in units of
  *      machine pages.  The value must be a power of 2.
  *
+ * max-requests         <uint32_t>
+ *      Default Value:  BLKIF_MAX_RING_REQUESTS(PAGE_SIZE)
+ *      Maximum Value:  BLKIF_MAX_RING_REQUESTS(PAGE_SIZE * max-ring-pages)
+ *
+ *      The maximum number of concurrent, logical requests that will be
+ *      issued by the backend.
+ *
+ *      Note: A logical request may span multiple ring entries.
+ *
+ * max-request-segments
+ *      Values:         <uint8_t>
+ *      Default Value:  BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK
+ *      Maximum Value:  BLKIF_MAX_SEGMENTS_PER_REQUEST
+ *
+ *      The maximum value of blkif_request.nr_segments supported by
+ *      the backend.
+ *
+ * max-request-size
+ *      Values:         <uint32_t>
+ *      Default Value:  BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK * PAGE_SIZE
+ *      Maximum Value:  BLKIF_MAX_SEGMENTS_PER_REQUEST * PAGE_SIZE
+ *
+ *      The maximum amount of data, in bytes, that can be referenced by a
+ *      request type that accesses frontend memory (currently BLKIF_OP_READ,
+ *      BLKIF_OP_WRITE, or BLKIF_OP_WRITE_BARRIER).
+ *
  *------------------------- Backend Device Properties -------------------------
  *
  * discard-aligment
@@ -242,6 +268,33 @@
  *      The size of the frontend allocated request ring buffer in units of
  *      machine pages.  The value must be a power of 2.
  *
+ * max-requests
+ *      Values:         <uint32_t>
+ *      Default Value:  BLKIF_MAX_RING_REQUESTS(PAGE_SIZE)
+ *      Maximum Value:  BLKIF_MAX_RING_REQUESTS(PAGE_SIZE * max-ring-pages)
+ *
+ *      The maximum number of concurrent, logical requests that will be
+ *      issued by the frontend.
+ *
+ *      Note: A logical request may span multiple ring entries.
+ *
+ * max-request-segments
+ *      Values:         <uint8_t>
+ *      Default Value:  BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK
+ *      Maximum Value:  MIN(255, backend/max-request-segments)
+ *
+ *      The maximum value the frontend will set in the
+ *      blkif_request.nr_segments field.
+ *
+ * max-request-size
+ *      Values:         <uint32_t>
+ *      Default Value:  BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK * PAGE_SIZE
+ *      Maximum Value:  max-request-segments * PAGE_SIZE
+ *
+ *      The maximum amount of data, in bytes, that can be referenced by
+ *      a request type that accesses frontend memory (currently BLKIF_OP_READ,
+ *      BLKIF_OP_WRITE, or BLKIF_OP_WRITE_BARRIER).
+ *
  *------------------------- Virtual Device Properties -------------------------
  *
  * device-type
@@ -403,11 +456,28 @@
 #define BLKIF_OP_DISCARD           5
 
 /*
- * Maximum scatter/gather segments per request.
+ * Maximum scatter/gather segments associated with a request header block.
  * This is carefully chosen so that sizeof(blkif_ring_t) <= PAGE_SIZE.
  * NB. This could be 12 if the ring indexes weren't stored in the same page.
  */
-#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11
+#define BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK  11
+
+/*
+ * Maximum scatter/gather segments associated with a segment block.
+ */
+#define BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK 14
+
+#if __XEN_INTERFACE_VERSION__ >= 0x00040201
+/*
+ * Maximum scatter/gather segments per request (header + segment blocks).
+ */
+#define BLKIF_MAX_SEGMENTS_PER_REQUEST 255
+#else
+/*
+ * Maximum scatter/gather segments per request (header block only).
+ */
+#define BLKIF_MAX_SEGMENTS_PER_REQUEST BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK
+#endif
 
 /*
  * NB. first_sect and last_sect in blkif_request_segment, as well as
@@ -422,9 +492,25 @@
     /* @last_sect: last sector in frame to transfer (inclusive).     */
     uint8_t     first_sect, last_sect;
 };
+typedef struct blkif_request_segment blkif_request_segment_t;
 
 /*
  * Starting ring element for any I/O request.
+ *
+ * One or more segment blocks can be inserted into the request ring
+ * just after a blkif_request_t, allowing requests to operate on
+ * up to BLKIF_MAX_SEGMENTS_PER_REQUEST.
+ *
+ * BLKIF_SEGS_TO_BLOCKS() can be used on blkif_requst.nr_segments
+ * to determine the number of contiguous ring entries associated
+ * with this request.
+ *
+ * Note:  Due to the way Xen request rings operate, the producer and
+ *        consumer indices of the ring must be incremented by the
+ *        BLKIF_SEGS_TO_BLOCKS() value of the associated request.
+ *        (e.g. a response to a 3 ring entry request must also consume
+ *        3 entries in the ring, even though only the first ring entry
+ *        in the response has any data.)
  */
 struct blkif_request {
     uint8_t        operation;    /* BLKIF_OP_???                         */
@@ -432,11 +518,22 @@
     blkif_vdev_t   handle;       /* only for read/write requests         */
     uint64_t       id;           /* private guest value, echoed in resp  */
     blkif_sector_t sector_number;/* start sector idx on disk (r/w only)  */
-    struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
+    blkif_request_segment_t seg[BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK];
 };
 typedef struct blkif_request blkif_request_t;
 
 /*
+ * A segment block is a ring request structure that contains only
+ * segment data.
+ *
+ * sizeof(struct blkif_segment_block) <= sizeof(struct blkif_request)
+ */
+struct blkif_segment_block {
+    blkif_request_segment_t seg[BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK];
+};
+typedef struct blkif_segment_block blkif_segment_block_t;
+
+/*
  * Cast to this structure when blkif_request.operation == BLKIF_OP_DISCARD
  * sizeof(struct blkif_request_discard) <= sizeof(struct blkif_request)
  */
@@ -473,6 +570,21 @@
  */
 DEFINE_RING_TYPES(blkif, struct blkif_request, struct blkif_response);
 
+/*
+ * Index to, and treat as a segment block, an entry in the ring.
+ */
+#define BLKRING_GET_SEG_BLOCK(_r, _idx)                                 \
+    (((blkif_segment_block_t *)RING_GET_REQUEST(_r, _idx))->seg)
+
+/*
+ * The number of ring request blocks required to handle an I/O
+ * request containing _segs segments.
+ */
+#define BLKIF_SEGS_TO_BLOCKS(_segs)                                     \
+    ((((_segs - BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK)                    \
+     + (BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK - 1))                      \
+    / BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK) + /*header_block*/1)
+
 #define VDISK_CDROM        0x1
 #define VDISK_REMOVABLE    0x2
 #define VDISK_READONLY     0x4
diff -r f9789db96c39 -r a59c1dcfe968 xen/include/public/xen-compat.h
--- a/xen/include/public/xen-compat.h	Thu Feb 23 10:02:30 2012 +0000
+++ b/xen/include/public/xen-compat.h	Thu Feb 23 10:03:07 2012 +0000
@@ -27,7 +27,7 @@
 #ifndef __XEN_PUBLIC_XEN_COMPAT_H__
 #define __XEN_PUBLIC_XEN_COMPAT_H__
 
-#define __XEN_LATEST_INTERFACE_VERSION__ 0x00040200
+#define __XEN_LATEST_INTERFACE_VERSION__ 0x00040201
 
 #if defined(__XEN__) || defined(__XEN_TOOLS__)
 /* Xen is built with matching headers and implements the latest interface. */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnO-0002Dy-Gi; Tue, 28 Feb 2012 06:44:22 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnN-0002AH-6m
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1330411453!3900868!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5347 invoked from network); 28 Feb 2012 06:44:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnD-0004FF-CA
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnD-0007I0-7r
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:11 +0000
Message-Id: <E1S2GnD-0007I0-7r@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] blkif.h: Define and document the
	request number/size/segments extension
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Justin T. Gibbs <justing@spectralogic.com>
# Date 1329991387 0
# Node ID a59c1dcfe968ee8a28cf2cdfd5c254741c0f36d3
# Parent  f9789db96c395aa0770f7ce46d3e9950d9019a5b
blkif.h: Define and document the request number/size/segments extension

Note: As of __XEN_INTERFACE_VERSION__ 0x00040201 the definition of
      BLKIF_MAX_SEGMENTS_PER_REQUEST has changed.  Drivers must be
      updated to, at minimum, use BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK,
      before being recompiled with a __XEN_INTERFACE_VERSION greater
      than or equal to this value.

This extension first appeared in the FreeBSD Operating System.

Signed-off-by: Justin T. Gibbs <justing@spectralogic.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r f9789db96c39 -r a59c1dcfe968 xen/include/public/io/blkif.h
--- a/xen/include/public/io/blkif.h	Thu Feb 23 10:02:30 2012 +0000
+++ b/xen/include/public/io/blkif.h	Thu Feb 23 10:03:07 2012 +0000
@@ -145,6 +145,32 @@
  *      The maximum supported size of the request ring buffer in units of
  *      machine pages.  The value must be a power of 2.
  *
+ * max-requests         <uint32_t>
+ *      Default Value:  BLKIF_MAX_RING_REQUESTS(PAGE_SIZE)
+ *      Maximum Value:  BLKIF_MAX_RING_REQUESTS(PAGE_SIZE * max-ring-pages)
+ *
+ *      The maximum number of concurrent, logical requests that will be
+ *      issued by the backend.
+ *
+ *      Note: A logical request may span multiple ring entries.
+ *
+ * max-request-segments
+ *      Values:         <uint8_t>
+ *      Default Value:  BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK
+ *      Maximum Value:  BLKIF_MAX_SEGMENTS_PER_REQUEST
+ *
+ *      The maximum value of blkif_request.nr_segments supported by
+ *      the backend.
+ *
+ * max-request-size
+ *      Values:         <uint32_t>
+ *      Default Value:  BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK * PAGE_SIZE
+ *      Maximum Value:  BLKIF_MAX_SEGMENTS_PER_REQUEST * PAGE_SIZE
+ *
+ *      The maximum amount of data, in bytes, that can be referenced by a
+ *      request type that accesses frontend memory (currently BLKIF_OP_READ,
+ *      BLKIF_OP_WRITE, or BLKIF_OP_WRITE_BARRIER).
+ *
  *------------------------- Backend Device Properties -------------------------
  *
  * discard-aligment
@@ -242,6 +268,33 @@
  *      The size of the frontend allocated request ring buffer in units of
  *      machine pages.  The value must be a power of 2.
  *
+ * max-requests
+ *      Values:         <uint32_t>
+ *      Default Value:  BLKIF_MAX_RING_REQUESTS(PAGE_SIZE)
+ *      Maximum Value:  BLKIF_MAX_RING_REQUESTS(PAGE_SIZE * max-ring-pages)
+ *
+ *      The maximum number of concurrent, logical requests that will be
+ *      issued by the frontend.
+ *
+ *      Note: A logical request may span multiple ring entries.
+ *
+ * max-request-segments
+ *      Values:         <uint8_t>
+ *      Default Value:  BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK
+ *      Maximum Value:  MIN(255, backend/max-request-segments)
+ *
+ *      The maximum value the frontend will set in the
+ *      blkif_request.nr_segments field.
+ *
+ * max-request-size
+ *      Values:         <uint32_t>
+ *      Default Value:  BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK * PAGE_SIZE
+ *      Maximum Value:  max-request-segments * PAGE_SIZE
+ *
+ *      The maximum amount of data, in bytes, that can be referenced by
+ *      a request type that accesses frontend memory (currently BLKIF_OP_READ,
+ *      BLKIF_OP_WRITE, or BLKIF_OP_WRITE_BARRIER).
+ *
  *------------------------- Virtual Device Properties -------------------------
  *
  * device-type
@@ -403,11 +456,28 @@
 #define BLKIF_OP_DISCARD           5
 
 /*
- * Maximum scatter/gather segments per request.
+ * Maximum scatter/gather segments associated with a request header block.
  * This is carefully chosen so that sizeof(blkif_ring_t) <= PAGE_SIZE.
  * NB. This could be 12 if the ring indexes weren't stored in the same page.
  */
-#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11
+#define BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK  11
+
+/*
+ * Maximum scatter/gather segments associated with a segment block.
+ */
+#define BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK 14
+
+#if __XEN_INTERFACE_VERSION__ >= 0x00040201
+/*
+ * Maximum scatter/gather segments per request (header + segment blocks).
+ */
+#define BLKIF_MAX_SEGMENTS_PER_REQUEST 255
+#else
+/*
+ * Maximum scatter/gather segments per request (header block only).
+ */
+#define BLKIF_MAX_SEGMENTS_PER_REQUEST BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK
+#endif
 
 /*
  * NB. first_sect and last_sect in blkif_request_segment, as well as
@@ -422,9 +492,25 @@
     /* @last_sect: last sector in frame to transfer (inclusive).     */
     uint8_t     first_sect, last_sect;
 };
+typedef struct blkif_request_segment blkif_request_segment_t;
 
 /*
  * Starting ring element for any I/O request.
+ *
+ * One or more segment blocks can be inserted into the request ring
+ * just after a blkif_request_t, allowing requests to operate on
+ * up to BLKIF_MAX_SEGMENTS_PER_REQUEST.
+ *
+ * BLKIF_SEGS_TO_BLOCKS() can be used on blkif_requst.nr_segments
+ * to determine the number of contiguous ring entries associated
+ * with this request.
+ *
+ * Note:  Due to the way Xen request rings operate, the producer and
+ *        consumer indices of the ring must be incremented by the
+ *        BLKIF_SEGS_TO_BLOCKS() value of the associated request.
+ *        (e.g. a response to a 3 ring entry request must also consume
+ *        3 entries in the ring, even though only the first ring entry
+ *        in the response has any data.)
  */
 struct blkif_request {
     uint8_t        operation;    /* BLKIF_OP_???                         */
@@ -432,11 +518,22 @@
     blkif_vdev_t   handle;       /* only for read/write requests         */
     uint64_t       id;           /* private guest value, echoed in resp  */
     blkif_sector_t sector_number;/* start sector idx on disk (r/w only)  */
-    struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
+    blkif_request_segment_t seg[BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK];
 };
 typedef struct blkif_request blkif_request_t;
 
 /*
+ * A segment block is a ring request structure that contains only
+ * segment data.
+ *
+ * sizeof(struct blkif_segment_block) <= sizeof(struct blkif_request)
+ */
+struct blkif_segment_block {
+    blkif_request_segment_t seg[BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK];
+};
+typedef struct blkif_segment_block blkif_segment_block_t;
+
+/*
  * Cast to this structure when blkif_request.operation == BLKIF_OP_DISCARD
  * sizeof(struct blkif_request_discard) <= sizeof(struct blkif_request)
  */
@@ -473,6 +570,21 @@
  */
 DEFINE_RING_TYPES(blkif, struct blkif_request, struct blkif_response);
 
+/*
+ * Index to, and treat as a segment block, an entry in the ring.
+ */
+#define BLKRING_GET_SEG_BLOCK(_r, _idx)                                 \
+    (((blkif_segment_block_t *)RING_GET_REQUEST(_r, _idx))->seg)
+
+/*
+ * The number of ring request blocks required to handle an I/O
+ * request containing _segs segments.
+ */
+#define BLKIF_SEGS_TO_BLOCKS(_segs)                                     \
+    ((((_segs - BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK)                    \
+     + (BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK - 1))                      \
+    / BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK) + /*header_block*/1)
+
 #define VDISK_CDROM        0x1
 #define VDISK_REMOVABLE    0x2
 #define VDISK_READONLY     0x4
diff -r f9789db96c39 -r a59c1dcfe968 xen/include/public/xen-compat.h
--- a/xen/include/public/xen-compat.h	Thu Feb 23 10:02:30 2012 +0000
+++ b/xen/include/public/xen-compat.h	Thu Feb 23 10:03:07 2012 +0000
@@ -27,7 +27,7 @@
 #ifndef __XEN_PUBLIC_XEN_COMPAT_H__
 #define __XEN_PUBLIC_XEN_COMPAT_H__
 
-#define __XEN_LATEST_INTERFACE_VERSION__ 0x00040200
+#define __XEN_LATEST_INTERFACE_VERSION__ 0x00040201
 
 #if defined(__XEN__) || defined(__XEN_TOOLS__)
 /* Xen is built with matching headers and implements the latest interface. */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnO-0002D4-2I; Tue, 28 Feb 2012 06:44:22 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnL-0002A8-Kk
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-21.messagelabs.com!1330411451!13727816!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8116 invoked from network); 28 Feb 2012 06:44:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnC-0004F9-EC
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnC-0007HG-6a
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:10 +0000
Message-Id: <E1S2GnC-0007HG-6a@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] blkif.h: Provide more complete
	documentation of the blkif interface
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Justin T. Gibbs <justing@spectralogic.com>
# Date 1329991319 0
# Node ID 037537eff0c1a87f9c7ebc6a332405fdf4ef90fd
# Parent  4e1460cd22278aca5fff460d8a0bfad4df1e0f78
blkif.h: Provide more complete documentation of the blkif interface

  o Document the XenBus nodes used in this protocol.
  o Add a state diagram illustrating the roles and responsibilities
    of both the front and backend during startup.
  o Correct missed BLKIF_OP_TRIM => BLKIF_OP_DISCARD conversion in a
    comment.

No functional changes.

Signed-off-by: Justin T. Gibbs <justing@spectralogic.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 4e1460cd2227 -r 037537eff0c1 xen/include/public/io/blkif.h
--- a/xen/include/public/io/blkif.h	Thu Feb 23 10:01:26 2012 +0000
+++ b/xen/include/public/io/blkif.h	Thu Feb 23 10:01:59 2012 +0000
@@ -22,6 +22,7 @@
  * DEALINGS IN THE SOFTWARE.
  *
  * Copyright (c) 2003-2004, Keir Fraser
+ * Copyright (c) 2012, Spectra Logic Corporation
  */
 
 #ifndef __XEN_PUBLIC_IO_BLKIF_H__
@@ -48,32 +49,253 @@
 #define blkif_sector_t uint64_t
 
 /*
+ * Feature and Parameter Negotiation
+ * =================================
+ * The two halves of a Xen block driver utilize nodes within the XenStore to
+ * communicate capabilities and to negotiate operating parameters.  This
+ * section enumerates these nodes which reside in the respective front and
+ * backend portions of the XenStore, following the XenBus convention.
+ *
+ * All data in the XenStore is stored as strings.  Nodes specifying numeric
+ * values are encoded in decimal.  Integer value ranges listed below are
+ * expressed as fixed sized integer types capable of storing the conversion
+ * of a properly formated node string, without loss of information.
+ *
+ * Any specified default value is in effect if the corresponding XenBus node
+ * is not present in the XenStore.
+ *
+ * XenStore nodes in sections marked "PRIVATE" are solely for use by the
+ * driver side whose XenBus tree contains them.
+ *
+ * See the XenBus state transition diagram below for details on when XenBus
+ * nodes must be published and when they can be queried.
+ *
+ *****************************************************************************
+ *                            Backend XenBus Nodes
+ *****************************************************************************
+ *
+ *------------------ Backend Device Identification (PRIVATE) ------------------
+ *
+ * mode
+ *      Values:         "r" (read only), "w" (writable)
+ *
+ *      The read or write access permissions to the backing store to be
+ *      granted to the frontend.
+ *
+ * params
+ *      Values:         string
+ *
+ *      A free formatted string providing sufficient information for the
+ *      backend driver to open the backing device.  (e.g. the path to the
+ *      file or block device representing the backing store.)
+ *
+ * type
+ *      Values:         "file", "phy", "tap"
+ *
+ *      The type of the backing device/object.
+ *
+ *--------------------------------- Features ---------------------------------
+ *
+ * feature-barrier
+ *      Values:         0/1 (boolean)
+ *      Default Value:  0
+ *
+ *      A value of "1" indicates that the backend can process requests
+ *      containing the BLKIF_OP_WRITE_BARRIER request opcode.  Requests
+ *      of this type may still be returned at any time with the
+ *      BLKIF_RSP_EOPNOTSUPP result code.
+ *
+ * feature-flush-cache
+ *      Values:         0/1 (boolean)
+ *      Default Value:  0
+ *
+ *      A value of "1" indicates that the backend can process requests
+ *      containing the BLKIF_OP_FLUSH_DISKCACHE request opcode.  Requests
+ *      of this type may still be returned at any time with the
+ *      BLKIF_RSP_EOPNOTSUPP result code.
+ *
+ * feature-discard
+ *      Values:         0/1 (boolean)
+ *      Default Value:  0
+ *
+ *      A value of "1" indicates that the backend can process requests
+ *      containing the BLKIF_OP_DISCARD request opcode.  Requests
+ *      of this type may still be returned at any time with the
+ *      BLKIF_RSP_EOPNOTSUPP result code.
+ *
+ *------------------------- Backend Device Properties -------------------------
+ *
+ * discard-aligment
+ *      Values:         <uint32_t>
+ *      Default Value:  0
+ *      Notes:          1, 2
+ *
+ *      The offset, in bytes from the beginning of the virtual block device,
+ *      to the first, addressable, discard extent on the underlying device.
+ *
+ * discard-granularity
+ *      Values:         <uint32_t>
+ *      Default Value:  <"sector-size">
+ *      Notes:          1
+ *
+ *      The size, in bytes, of the individually addressable discard extents
+ *      of the underlying device.
+ *
+ * discard-secure
+ *      Values:         0/1 (boolean)
+ *      Default Value:  0
+ *
+ *      A value of "1" indicates that the backend can process BLKIF_OP_DISCARD
+ *      requests with the BLKIF_DISCARD_SECURE flag set.
+ *
+ * info
+ *      Values:         <uint32_t> (bitmap)
+ *
+ *      A collection of bit flags describing attributes of the backing
+ *      device.  The VDISK_* macros define the meaning of each bit
+ *      location.
+ *
+ * sector-size
+ *      Values:         <uint32_t>
+ *
+ *      The native sector size, in bytes, of the backend device.
+ *
+ * sectors
+ *      Values:         <uint64_t>
+ *
+ *      The size of the backend device, expressed in units of its native
+ *      sector size ("sector-size").
+ *
+ *****************************************************************************
+ *                            Frontend XenBus Nodes
+ *****************************************************************************
+ *
+ *----------------------- Request Transport Parameters -----------------------
+ *
+ * event-channel
+ *      Values:         <uint32_t>
+ *
+ *      The identifier of the Xen event channel used to signal activity
+ *      in the ring buffer.
+ *
+ * ring-ref
+ *      Values:         <uint32_t>
+ *
+ *      The Xen grant reference granting permission for the backend to map
+ *      the sole page in a single page sized ring buffer.
+ *
+ * protocol
+ *      Values:         string (XEN_IO_PROTO_ABI_*)
+ *      Default Value:  XEN_IO_PROTO_ABI_NATIVE
+ *
+ *      The machine ABI rules governing the format of all ring request and
+ *      response structures.
+ *
+ *------------------------- Virtual Device Properties -------------------------
+ *
+ * device-type
+ *      Values:         "disk", "cdrom", "floppy", etc.
+ *
+ * virtual-device
+ *      Values:         <uint32_t>
+ *
+ *      A value indicating the physical device to virtualize within the
+ *      frontend's domain.  (e.g. "The first ATA disk", "The third SCSI
+ *      disk", etc.)
+ *
+ *      See docs/misc/vbd-interface.txt for details on the format of this
+ *      value.
+ *
+ * Notes
+ * -----
+ * (1) Devices that support discard functionality may internally allocate
+ *     space (discardable extents) in units that are larger than the
+ *     exported logical block size.
+ * (2) The discard-alignment parameter allows a physical device to be
+ *     partitioned into virtual devices that do not necessarily begin or
+ *     end on a discardable extent boundary.
+ */
+
+/*
+ * STATE DIAGRAMS
+ *
+ *****************************************************************************
+ *                                   Startup                                 *
+ *****************************************************************************
+ *
+ * Tool stack creates front and back nodes with state XenbusStateInitialising.
+ *
+ * Front                                Back
+ * =================================    =====================================
+ * XenbusStateInitialising              XenbusStateInitialising
+ *  o Query virtual device               o Query backend device identification
+ *    properties.                          data.
+ *  o Setup OS device instance.          o Open and validate backend device.
+ *                                       o Publish backend features.
+ *                                                      |
+ *                                                      |
+ *                                                      V
+ *                                      XenbusStateInitWait
+ *
+ * o Query backend features.
+ * o Allocate and initialize the
+ *   request ring.
+ *              |
+ *              |
+ *              V
+ * XenbusStateInitialised
+ *
+ *                                       o Connect to the request ring and
+ *                                         event channel.
+ *                                       o Publish backend device properties.
+ *                                                      |
+ *                                                      |
+ *                                                      V
+ *                                      XenbusStateConnected
+ *
+ *  o Query backend device properties.
+ *  o Finalize OS virtual device
+ *    instance.
+ *              |
+ *              |
+ *              V
+ * XenbusStateConnected
+ *
+ * Note: Drivers that do not support any optional features can skip certain
+ *       states in the state machine:
+ *
+ *       o A frontend may transition to XenbusStateInitialised without
+ *         waiting for the backend to enter XenbusStateInitWait.
+ *
+ *       o A backend may transition to XenbusStateInitialised, bypassing
+ *         XenbusStateInitWait, without waiting for the frontend to first
+ *         enter the XenbusStateInitialised state.
+ *
+ *       Drivers that support optional features must tolerate these additional
+ *       state transition paths.  In general this means performing the work of
+ *       any skipped state transition, if it has not already been performed,
+ *       in addition to the work associated with entry into the current state.
+ */
+
+/*
  * REQUEST CODES.
  */
 #define BLKIF_OP_READ              0
 #define BLKIF_OP_WRITE             1
 /*
- * Recognised only if "feature-barrier" is present in backend xenbus info.
- * The "feature-barrier" node contains a boolean indicating whether barrier
- * requests are likely to succeed or fail. Either way, a barrier request
- * may fail at any time with BLKIF_RSP_EOPNOTSUPP if it is unsupported by
- * the underlying block-device hardware. The boolean simply indicates whether
- * or not it is worthwhile for the frontend to attempt barrier requests.
- * If a backend does not recognise BLKIF_OP_WRITE_BARRIER, it should *not*
- * create the "feature-barrier" node!
+ * All writes issued prior to a request with the BLKIF_OP_WRITE_BARRIER
+ * operation code ("barrier request") must be completed prior to the
+ * execution of the barrier request.  All writes issued after the barrier
+ * request must not execute until after the completion of the barrier request.
+ *
+ * Optional.  See "feature-barrier" XenBus node documentation above.
  */
 #define BLKIF_OP_WRITE_BARRIER     2
 /*
- * Recognised if "feature-flush-cache" is present in backend xenbus
- * info.  A flush will ask the underlying storage hardware to flush its
- * non-volatile caches as appropriate.  The "feature-flush-cache" node
- * contains a boolean indicating whether flush requests are likely to
- * succeed or fail. Either way, a flush request may fail at any time
- * with BLKIF_RSP_EOPNOTSUPP if it is unsupported by the underlying
- * block-device hardware. The boolean simply indicates whether or not it
- * is worthwhile for the frontend to attempt flushes.  If a backend does
- * not recognise BLKIF_OP_WRITE_FLUSH_CACHE, it should *not* create the
- * "feature-flush-cache" node!
+ * Commit any uncommitted contents of the backing device's volatile cache
+ * to stable storage.
+ *
+ * Optional.  See "feature-flush-cache" XenBus node documentation above.
  */
 #define BLKIF_OP_FLUSH_DISKCACHE   3
 /*
@@ -82,47 +304,24 @@
  */
 #define BLKIF_OP_RESERVED_1        4
 /*
- * 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 discard requests.
- * If a backend does not recognise BLKIF_OP_DISCARD, it should *not*
- * create the "feature-discard" node!
+ * Indicate to the backend device that a region of storage is no longer in
+ * use, and may be discarded at any time without impact to the client.  If
+ * the BLKIF_DISCARD_SECURE flag is set on the request, all copies of the
+ * discarded region on the device must be rendered unrecoverable before the
+ * command returns.
  *
- * 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:
+ * This operation is analogous to performing a trim (ATA) or unamp (SCSI),
+ * command on a native device.
+ *
+ * More information about trim/unmap operations can be found 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.
+ *
+ * Optional.  See "feature-discard", "discard-alignment",
+ * "discard-granularity", and "discard-secure" in the XenBus node
+ * documentation above.
  */
 #define BLKIF_OP_DISCARD           5
 
@@ -147,6 +346,9 @@
     uint8_t     first_sect, last_sect;
 };
 
+/*
+ * Starting ring element for any I/O request.
+ */
 struct blkif_request {
     uint8_t        operation;    /* BLKIF_OP_???                         */
     uint8_t        nr_segments;  /* number of segments                   */
@@ -158,7 +360,7 @@
 typedef struct blkif_request blkif_request_t;
 
 /*
- * Cast to this structure when blkif_request.operation == BLKIF_OP_TRIM
+ * Cast to this structure when blkif_request.operation == BLKIF_OP_DISCARD
  * sizeof(struct blkif_request_discard) <= sizeof(struct blkif_request)
  */
 struct blkif_request_discard {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnL-0002BX-Iq; Tue, 28 Feb 2012 06:44:19 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnK-00029z-27
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1330411450!11368712!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20127 invoked from network); 28 Feb 2012 06:44:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnB-0004F4-Qe
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnB-0007Gt-M8
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:09 +0000
Message-Id: <E1S2GnB-0007Gt-M8@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] blkif.h: Miscelaneous style fixes
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Justin T. Gibbs <justing@spectralogic.com>
# Date 1329991286 0
# Node ID 4e1460cd22278aca5fff460d8a0bfad4df1e0f78
# Parent  66cc5b67e7492afd3c59717e5d21d58dedfe5b34
blkif.h: Miscelaneous style fixes

  o Remove trailing whitespace.
  o Remove a blank line so that a comment block is adjacent to the
    code it documents.

No functional changes.

Signed-off-by: Justin T. Gibbs <justing@spectralogic.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 66cc5b67e749 -r 4e1460cd2227 xen/include/public/io/blkif.h
--- a/xen/include/public/io/blkif.h	Thu Feb 23 09:59:35 2012 +0000
+++ b/xen/include/public/io/blkif.h	Thu Feb 23 10:01:26 2012 +0000
@@ -1,8 +1,8 @@
 /******************************************************************************
  * blkif.h
- * 
+ *
  * Unified block-device I/O interface for Xen guest OSes.
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
  * deal in the Software without restriction, including without limitation the
@@ -35,7 +35,7 @@
  * notification can be made conditional on req_event (i.e., the generic
  * hold-off mechanism provided by the ring macros). Backends must set
  * req_event appropriately (e.g., using RING_FINAL_CHECK_FOR_REQUESTS()).
- * 
+ *
  * Back->front notifications: When enqueuing a new response, sending a
  * notification can be made conditional on rsp_event (i.e., the generic
  * hold-off mechanism provided by the ring macros). Frontends must set
@@ -133,7 +133,7 @@
  */
 #define BLKIF_MAX_SEGMENTS_PER_REQUEST 11
 
-/* 
+/*
  * NB. first_sect and last_sect in blkif_request_segment, as well as
  * sector_number in blkif_request, are always expressed in 512-byte units.
  * However they must be properly aligned to the real sector size of the
@@ -192,7 +192,6 @@
 /*
  * Generate blkif ring structures and types.
  */
-
 DEFINE_RING_TYPES(blkif, struct blkif_request, struct blkif_response);
 
 #define VDISK_CDROM        0x1

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnL-0002BX-Iq; Tue, 28 Feb 2012 06:44:19 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnK-00029z-27
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1330411450!11368712!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20127 invoked from network); 28 Feb 2012 06:44:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:11 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnB-0004F4-Qe
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnB-0007Gt-M8
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:09 +0000
Message-Id: <E1S2GnB-0007Gt-M8@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] blkif.h: Miscelaneous style fixes
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Justin T. Gibbs <justing@spectralogic.com>
# Date 1329991286 0
# Node ID 4e1460cd22278aca5fff460d8a0bfad4df1e0f78
# Parent  66cc5b67e7492afd3c59717e5d21d58dedfe5b34
blkif.h: Miscelaneous style fixes

  o Remove trailing whitespace.
  o Remove a blank line so that a comment block is adjacent to the
    code it documents.

No functional changes.

Signed-off-by: Justin T. Gibbs <justing@spectralogic.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 66cc5b67e749 -r 4e1460cd2227 xen/include/public/io/blkif.h
--- a/xen/include/public/io/blkif.h	Thu Feb 23 09:59:35 2012 +0000
+++ b/xen/include/public/io/blkif.h	Thu Feb 23 10:01:26 2012 +0000
@@ -1,8 +1,8 @@
 /******************************************************************************
  * blkif.h
- * 
+ *
  * Unified block-device I/O interface for Xen guest OSes.
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
  * deal in the Software without restriction, including without limitation the
@@ -35,7 +35,7 @@
  * notification can be made conditional on req_event (i.e., the generic
  * hold-off mechanism provided by the ring macros). Backends must set
  * req_event appropriately (e.g., using RING_FINAL_CHECK_FOR_REQUESTS()).
- * 
+ *
  * Back->front notifications: When enqueuing a new response, sending a
  * notification can be made conditional on rsp_event (i.e., the generic
  * hold-off mechanism provided by the ring macros). Frontends must set
@@ -133,7 +133,7 @@
  */
 #define BLKIF_MAX_SEGMENTS_PER_REQUEST 11
 
-/* 
+/*
  * NB. first_sect and last_sect in blkif_request_segment, as well as
  * sector_number in blkif_request, are always expressed in 512-byte units.
  * However they must be properly aligned to the real sector size of the
@@ -192,7 +192,6 @@
 /*
  * Generate blkif ring structures and types.
  */
-
 DEFINE_RING_TYPES(blkif, struct blkif_request, struct blkif_response);
 
 #define VDISK_CDROM        0x1

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnO-0002D4-2I; Tue, 28 Feb 2012 06:44:22 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnL-0002A8-Kk
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-21.messagelabs.com!1330411451!13727816!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8116 invoked from network); 28 Feb 2012 06:44:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnC-0004F9-EC
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnC-0007HG-6a
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:10 +0000
Message-Id: <E1S2GnC-0007HG-6a@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] blkif.h: Provide more complete
	documentation of the blkif interface
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Justin T. Gibbs <justing@spectralogic.com>
# Date 1329991319 0
# Node ID 037537eff0c1a87f9c7ebc6a332405fdf4ef90fd
# Parent  4e1460cd22278aca5fff460d8a0bfad4df1e0f78
blkif.h: Provide more complete documentation of the blkif interface

  o Document the XenBus nodes used in this protocol.
  o Add a state diagram illustrating the roles and responsibilities
    of both the front and backend during startup.
  o Correct missed BLKIF_OP_TRIM => BLKIF_OP_DISCARD conversion in a
    comment.

No functional changes.

Signed-off-by: Justin T. Gibbs <justing@spectralogic.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 4e1460cd2227 -r 037537eff0c1 xen/include/public/io/blkif.h
--- a/xen/include/public/io/blkif.h	Thu Feb 23 10:01:26 2012 +0000
+++ b/xen/include/public/io/blkif.h	Thu Feb 23 10:01:59 2012 +0000
@@ -22,6 +22,7 @@
  * DEALINGS IN THE SOFTWARE.
  *
  * Copyright (c) 2003-2004, Keir Fraser
+ * Copyright (c) 2012, Spectra Logic Corporation
  */
 
 #ifndef __XEN_PUBLIC_IO_BLKIF_H__
@@ -48,32 +49,253 @@
 #define blkif_sector_t uint64_t
 
 /*
+ * Feature and Parameter Negotiation
+ * =================================
+ * The two halves of a Xen block driver utilize nodes within the XenStore to
+ * communicate capabilities and to negotiate operating parameters.  This
+ * section enumerates these nodes which reside in the respective front and
+ * backend portions of the XenStore, following the XenBus convention.
+ *
+ * All data in the XenStore is stored as strings.  Nodes specifying numeric
+ * values are encoded in decimal.  Integer value ranges listed below are
+ * expressed as fixed sized integer types capable of storing the conversion
+ * of a properly formated node string, without loss of information.
+ *
+ * Any specified default value is in effect if the corresponding XenBus node
+ * is not present in the XenStore.
+ *
+ * XenStore nodes in sections marked "PRIVATE" are solely for use by the
+ * driver side whose XenBus tree contains them.
+ *
+ * See the XenBus state transition diagram below for details on when XenBus
+ * nodes must be published and when they can be queried.
+ *
+ *****************************************************************************
+ *                            Backend XenBus Nodes
+ *****************************************************************************
+ *
+ *------------------ Backend Device Identification (PRIVATE) ------------------
+ *
+ * mode
+ *      Values:         "r" (read only), "w" (writable)
+ *
+ *      The read or write access permissions to the backing store to be
+ *      granted to the frontend.
+ *
+ * params
+ *      Values:         string
+ *
+ *      A free formatted string providing sufficient information for the
+ *      backend driver to open the backing device.  (e.g. the path to the
+ *      file or block device representing the backing store.)
+ *
+ * type
+ *      Values:         "file", "phy", "tap"
+ *
+ *      The type of the backing device/object.
+ *
+ *--------------------------------- Features ---------------------------------
+ *
+ * feature-barrier
+ *      Values:         0/1 (boolean)
+ *      Default Value:  0
+ *
+ *      A value of "1" indicates that the backend can process requests
+ *      containing the BLKIF_OP_WRITE_BARRIER request opcode.  Requests
+ *      of this type may still be returned at any time with the
+ *      BLKIF_RSP_EOPNOTSUPP result code.
+ *
+ * feature-flush-cache
+ *      Values:         0/1 (boolean)
+ *      Default Value:  0
+ *
+ *      A value of "1" indicates that the backend can process requests
+ *      containing the BLKIF_OP_FLUSH_DISKCACHE request opcode.  Requests
+ *      of this type may still be returned at any time with the
+ *      BLKIF_RSP_EOPNOTSUPP result code.
+ *
+ * feature-discard
+ *      Values:         0/1 (boolean)
+ *      Default Value:  0
+ *
+ *      A value of "1" indicates that the backend can process requests
+ *      containing the BLKIF_OP_DISCARD request opcode.  Requests
+ *      of this type may still be returned at any time with the
+ *      BLKIF_RSP_EOPNOTSUPP result code.
+ *
+ *------------------------- Backend Device Properties -------------------------
+ *
+ * discard-aligment
+ *      Values:         <uint32_t>
+ *      Default Value:  0
+ *      Notes:          1, 2
+ *
+ *      The offset, in bytes from the beginning of the virtual block device,
+ *      to the first, addressable, discard extent on the underlying device.
+ *
+ * discard-granularity
+ *      Values:         <uint32_t>
+ *      Default Value:  <"sector-size">
+ *      Notes:          1
+ *
+ *      The size, in bytes, of the individually addressable discard extents
+ *      of the underlying device.
+ *
+ * discard-secure
+ *      Values:         0/1 (boolean)
+ *      Default Value:  0
+ *
+ *      A value of "1" indicates that the backend can process BLKIF_OP_DISCARD
+ *      requests with the BLKIF_DISCARD_SECURE flag set.
+ *
+ * info
+ *      Values:         <uint32_t> (bitmap)
+ *
+ *      A collection of bit flags describing attributes of the backing
+ *      device.  The VDISK_* macros define the meaning of each bit
+ *      location.
+ *
+ * sector-size
+ *      Values:         <uint32_t>
+ *
+ *      The native sector size, in bytes, of the backend device.
+ *
+ * sectors
+ *      Values:         <uint64_t>
+ *
+ *      The size of the backend device, expressed in units of its native
+ *      sector size ("sector-size").
+ *
+ *****************************************************************************
+ *                            Frontend XenBus Nodes
+ *****************************************************************************
+ *
+ *----------------------- Request Transport Parameters -----------------------
+ *
+ * event-channel
+ *      Values:         <uint32_t>
+ *
+ *      The identifier of the Xen event channel used to signal activity
+ *      in the ring buffer.
+ *
+ * ring-ref
+ *      Values:         <uint32_t>
+ *
+ *      The Xen grant reference granting permission for the backend to map
+ *      the sole page in a single page sized ring buffer.
+ *
+ * protocol
+ *      Values:         string (XEN_IO_PROTO_ABI_*)
+ *      Default Value:  XEN_IO_PROTO_ABI_NATIVE
+ *
+ *      The machine ABI rules governing the format of all ring request and
+ *      response structures.
+ *
+ *------------------------- Virtual Device Properties -------------------------
+ *
+ * device-type
+ *      Values:         "disk", "cdrom", "floppy", etc.
+ *
+ * virtual-device
+ *      Values:         <uint32_t>
+ *
+ *      A value indicating the physical device to virtualize within the
+ *      frontend's domain.  (e.g. "The first ATA disk", "The third SCSI
+ *      disk", etc.)
+ *
+ *      See docs/misc/vbd-interface.txt for details on the format of this
+ *      value.
+ *
+ * Notes
+ * -----
+ * (1) Devices that support discard functionality may internally allocate
+ *     space (discardable extents) in units that are larger than the
+ *     exported logical block size.
+ * (2) The discard-alignment parameter allows a physical device to be
+ *     partitioned into virtual devices that do not necessarily begin or
+ *     end on a discardable extent boundary.
+ */
+
+/*
+ * STATE DIAGRAMS
+ *
+ *****************************************************************************
+ *                                   Startup                                 *
+ *****************************************************************************
+ *
+ * Tool stack creates front and back nodes with state XenbusStateInitialising.
+ *
+ * Front                                Back
+ * =================================    =====================================
+ * XenbusStateInitialising              XenbusStateInitialising
+ *  o Query virtual device               o Query backend device identification
+ *    properties.                          data.
+ *  o Setup OS device instance.          o Open and validate backend device.
+ *                                       o Publish backend features.
+ *                                                      |
+ *                                                      |
+ *                                                      V
+ *                                      XenbusStateInitWait
+ *
+ * o Query backend features.
+ * o Allocate and initialize the
+ *   request ring.
+ *              |
+ *              |
+ *              V
+ * XenbusStateInitialised
+ *
+ *                                       o Connect to the request ring and
+ *                                         event channel.
+ *                                       o Publish backend device properties.
+ *                                                      |
+ *                                                      |
+ *                                                      V
+ *                                      XenbusStateConnected
+ *
+ *  o Query backend device properties.
+ *  o Finalize OS virtual device
+ *    instance.
+ *              |
+ *              |
+ *              V
+ * XenbusStateConnected
+ *
+ * Note: Drivers that do not support any optional features can skip certain
+ *       states in the state machine:
+ *
+ *       o A frontend may transition to XenbusStateInitialised without
+ *         waiting for the backend to enter XenbusStateInitWait.
+ *
+ *       o A backend may transition to XenbusStateInitialised, bypassing
+ *         XenbusStateInitWait, without waiting for the frontend to first
+ *         enter the XenbusStateInitialised state.
+ *
+ *       Drivers that support optional features must tolerate these additional
+ *       state transition paths.  In general this means performing the work of
+ *       any skipped state transition, if it has not already been performed,
+ *       in addition to the work associated with entry into the current state.
+ */
+
+/*
  * REQUEST CODES.
  */
 #define BLKIF_OP_READ              0
 #define BLKIF_OP_WRITE             1
 /*
- * Recognised only if "feature-barrier" is present in backend xenbus info.
- * The "feature-barrier" node contains a boolean indicating whether barrier
- * requests are likely to succeed or fail. Either way, a barrier request
- * may fail at any time with BLKIF_RSP_EOPNOTSUPP if it is unsupported by
- * the underlying block-device hardware. The boolean simply indicates whether
- * or not it is worthwhile for the frontend to attempt barrier requests.
- * If a backend does not recognise BLKIF_OP_WRITE_BARRIER, it should *not*
- * create the "feature-barrier" node!
+ * All writes issued prior to a request with the BLKIF_OP_WRITE_BARRIER
+ * operation code ("barrier request") must be completed prior to the
+ * execution of the barrier request.  All writes issued after the barrier
+ * request must not execute until after the completion of the barrier request.
+ *
+ * Optional.  See "feature-barrier" XenBus node documentation above.
  */
 #define BLKIF_OP_WRITE_BARRIER     2
 /*
- * Recognised if "feature-flush-cache" is present in backend xenbus
- * info.  A flush will ask the underlying storage hardware to flush its
- * non-volatile caches as appropriate.  The "feature-flush-cache" node
- * contains a boolean indicating whether flush requests are likely to
- * succeed or fail. Either way, a flush request may fail at any time
- * with BLKIF_RSP_EOPNOTSUPP if it is unsupported by the underlying
- * block-device hardware. The boolean simply indicates whether or not it
- * is worthwhile for the frontend to attempt flushes.  If a backend does
- * not recognise BLKIF_OP_WRITE_FLUSH_CACHE, it should *not* create the
- * "feature-flush-cache" node!
+ * Commit any uncommitted contents of the backing device's volatile cache
+ * to stable storage.
+ *
+ * Optional.  See "feature-flush-cache" XenBus node documentation above.
  */
 #define BLKIF_OP_FLUSH_DISKCACHE   3
 /*
@@ -82,47 +304,24 @@
  */
 #define BLKIF_OP_RESERVED_1        4
 /*
- * 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 discard requests.
- * If a backend does not recognise BLKIF_OP_DISCARD, it should *not*
- * create the "feature-discard" node!
+ * Indicate to the backend device that a region of storage is no longer in
+ * use, and may be discarded at any time without impact to the client.  If
+ * the BLKIF_DISCARD_SECURE flag is set on the request, all copies of the
+ * discarded region on the device must be rendered unrecoverable before the
+ * command returns.
  *
- * 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:
+ * This operation is analogous to performing a trim (ATA) or unamp (SCSI),
+ * command on a native device.
+ *
+ * More information about trim/unmap operations can be found 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.
+ *
+ * Optional.  See "feature-discard", "discard-alignment",
+ * "discard-granularity", and "discard-secure" in the XenBus node
+ * documentation above.
  */
 #define BLKIF_OP_DISCARD           5
 
@@ -147,6 +346,9 @@
     uint8_t     first_sect, last_sect;
 };
 
+/*
+ * Starting ring element for any I/O request.
+ */
 struct blkif_request {
     uint8_t        operation;    /* BLKIF_OP_???                         */
     uint8_t        nr_segments;  /* number of segments                   */
@@ -158,7 +360,7 @@
 typedef struct blkif_request blkif_request_t;
 
 /*
- * Cast to this structure when blkif_request.operation == BLKIF_OP_TRIM
+ * Cast to this structure when blkif_request.operation == BLKIF_OP_DISCARD
  * sizeof(struct blkif_request_discard) <= sizeof(struct blkif_request)
  */
 struct blkif_request_discard {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnM-0002CH-PP; Tue, 28 Feb 2012 06:44:20 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnK-0002A5-RP
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-216.messagelabs.com!1330411451!16745297!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23027 invoked from network); 28 Feb 2012 06:44:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnD-0004FC-1o
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnC-0007Hd-NW
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:10 +0000
Message-Id: <E1S2GnC-0007Hd-NW@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] blkif.h: Document the Red Hat and
	Citrix blkif multi-page ring extensions
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Justin T. Gibbs <justing@spectralogic.com>
# Date 1329991350 0
# Node ID f9789db96c395aa0770f7ce46d3e9950d9019a5b
# Parent  037537eff0c1a87f9c7ebc6a332405fdf4ef90fd
blkif.h: Document the Red Hat and Citrix blkif multi-page ring extensions

No functional changes.

Signed-off-by: Justin T. Gibbs <justing@spectralogic.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 037537eff0c1 -r f9789db96c39 xen/include/public/io/blkif.h
--- a/xen/include/public/io/blkif.h	Thu Feb 23 10:01:59 2012 +0000
+++ b/xen/include/public/io/blkif.h	Thu Feb 23 10:02:30 2012 +0000
@@ -67,6 +67,9 @@
  * XenStore nodes in sections marked "PRIVATE" are solely for use by the
  * driver side whose XenBus tree contains them.
  *
+ * XenStore nodes marked "DEPRECATED" in their notes section should only be
+ * used to provide interoperability with legacy implementations.
+ *
  * See the XenBus state transition diagram below for details on when XenBus
  * nodes must be published and when they can be queried.
  *
@@ -123,12 +126,31 @@
  *      of this type may still be returned at any time with the
  *      BLKIF_RSP_EOPNOTSUPP result code.
  *
+ *----------------------- Request Transport Parameters ------------------------
+ *
+ * max-ring-page-order
+ *      Values:         <uint32_t>
+ *      Default Value:  0
+ *      Notes:          1, 3
+ *
+ *      The maximum supported size of the request ring buffer in units of
+ *      lb(machine pages). (e.g. 0 == 1 page,  1 = 2 pages, 2 == 4 pages,
+ *      etc.).
+ *
+ * max-ring-pages
+ *      Values:         <uint32_t>
+ *      Default Value:  1
+ *      Notes:          DEPRECATED, 2, 3
+ *
+ *      The maximum supported size of the request ring buffer in units of
+ *      machine pages.  The value must be a power of 2.
+ *
  *------------------------- Backend Device Properties -------------------------
  *
  * discard-aligment
  *      Values:         <uint32_t>
  *      Default Value:  0
- *      Notes:          1, 2
+ *      Notes:          4, 5
  *
  *      The offset, in bytes from the beginning of the virtual block device,
  *      to the first, addressable, discard extent on the underlying device.
@@ -136,7 +158,7 @@
  * discard-granularity
  *      Values:         <uint32_t>
  *      Default Value:  <"sector-size">
- *      Notes:          1
+ *      Notes:          4
  *
  *      The size, in bytes, of the individually addressable discard extents
  *      of the underlying device.
@@ -180,10 +202,20 @@
  *
  * ring-ref
  *      Values:         <uint32_t>
+ *      Notes:          6
  *
  *      The Xen grant reference granting permission for the backend to map
  *      the sole page in a single page sized ring buffer.
  *
+ * ring-ref%u
+ *      Values:         <uint32_t>
+ *      Notes:          6
+ *
+ *      For a frontend providing a multi-page ring, a "number of ring pages"
+ *      sized list of nodes, each containing a Xen grant reference granting
+ *      permission for the backend to map the page of the ring located
+ *      at page index "%u".  Page indexes are zero based.
+ *
  * protocol
  *      Values:         string (XEN_IO_PROTO_ABI_*)
  *      Default Value:  XEN_IO_PROTO_ABI_NATIVE
@@ -191,6 +223,25 @@
  *      The machine ABI rules governing the format of all ring request and
  *      response structures.
  *
+ * ring-page-order
+ *      Values:         <uint32_t>
+ *      Default Value:  0
+ *      Maximum Value:  MAX(ffs(max-ring-pages) - 1, max-ring-page-order)
+ *      Notes:          1, 3
+ *
+ *      The size of the frontend allocated request ring buffer in units
+ *      of lb(machine pages). (e.g. 0 == 1 page, 1 = 2 pages, 2 == 4 pages,
+ *      etc.).
+ *
+ * num-ring-pages
+ *      Values:         <uint32_t>
+ *      Default Value:  1
+ *      Maximum Value:  MAX(max-ring-pages,(0x1 << max-ring-page-order))
+ *      Notes:          DEPRECATED, 2, 3
+ *
+ *      The size of the frontend allocated request ring buffer in units of
+ *      machine pages.  The value must be a power of 2.
+ *
  *------------------------- Virtual Device Properties -------------------------
  *
  * device-type
@@ -208,12 +259,26 @@
  *
  * Notes
  * -----
- * (1) Devices that support discard functionality may internally allocate
+ * (1) Multi-page ring buffer scheme first developed in the Citrix XenServer
+ *     PV drivers.
+ * (2) Multi-page ring buffer scheme first used in some RedHat distributions
+ *     including a distribution deployed on certain nodes of the Amazon
+ *     EC2 cluster.
+ * (3) Support for multi-page ring buffers was implemented independently,
+ *     in slightly different forms, by both Citrix and RedHat/Amazon.
+ *     For full interoperability, block front and backends should publish
+ *     identical ring parameters, adjusted for unit differences, to the
+ *     XenStore nodes used in both schemes.
+ * (4) Devices that support discard functionality may internally allocate
  *     space (discardable extents) in units that are larger than the
  *     exported logical block size.
- * (2) The discard-alignment parameter allows a physical device to be
+ * (5) The discard-alignment parameter allows a physical device to be
  *     partitioned into virtual devices that do not necessarily begin or
  *     end on a discardable extent boundary.
+ * (6) When there is only a single page allocated to the request ring,
+ *     'ring-ref' is used to communicate the grant reference for this
+ *     page to the backend.  When using a multi-page ring, the 'ring-ref'
+ *     node is not created.  Instead 'ring-ref0' - 'ring-refN' are used.
  */
 
 /*
@@ -231,20 +296,26 @@
  *  o Query virtual device               o Query backend device identification
  *    properties.                          data.
  *  o Setup OS device instance.          o Open and validate backend device.
- *                                       o Publish backend features.
+ *                                       o Publish backend features and
+ *                                         transport parameters.
  *                                                      |
  *                                                      |
  *                                                      V
  *                                      XenbusStateInitWait
  *
- * o Query backend features.
+ * o Query backend features and
+ *   transport parameters.
  * o Allocate and initialize the
  *   request ring.
+ * o Publish transport parameters
+ *   that will be in effect during
+ *   this connection.
  *              |
  *              |
  *              V
  * XenbusStateInitialised
  *
+ *                                       o Query frontend transport parameters.
  *                                       o Connect to the request ring and
  *                                         event channel.
  *                                       o Publish backend device properties.
@@ -261,20 +332,26 @@
  *              V
  * XenbusStateConnected
  *
- * Note: Drivers that do not support any optional features can skip certain
- *       states in the state machine:
+ * Note: Drivers that do not support any optional features, or the negotiation
+ *       of transport parameters, can skip certain states in the state machine:
  *
  *       o A frontend may transition to XenbusStateInitialised without
- *         waiting for the backend to enter XenbusStateInitWait.
+ *         waiting for the backend to enter XenbusStateInitWait.  In this
+ *         case, default transport parameters are in effect and any
+ *         transport parameters published by the frontend must contain
+ *         their default values.
  *
  *       o A backend may transition to XenbusStateInitialised, bypassing
  *         XenbusStateInitWait, without waiting for the frontend to first
- *         enter the XenbusStateInitialised state.
+ *         enter the XenbusStateInitialised state.  In this case, default
+ *         transport parameters are in effect and any transport parameters
+ *         published by the backend must contain their default values.
  *
- *       Drivers that support optional features must tolerate these additional
- *       state transition paths.  In general this means performing the work of
- *       any skipped state transition, if it has not already been performed,
- *       in addition to the work associated with entry into the current state.
+ *       Drivers that support optional features and/or transport parameter
+ *       negotiation must tolerate these additional state transition paths.
+ *       In general this means performing the work of any skipped state
+ *       transition, if it has not already been performed, in addition to the
+ *       work associated with entry into the current state.
  */
 
 /*

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnM-0002CH-PP; Tue, 28 Feb 2012 06:44:20 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnK-0002A5-RP
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-216.messagelabs.com!1330411451!16745297!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23027 invoked from network); 28 Feb 2012 06:44:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnD-0004FC-1o
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnC-0007Hd-NW
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:10 +0000
Message-Id: <E1S2GnC-0007Hd-NW@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] blkif.h: Document the Red Hat and
	Citrix blkif multi-page ring extensions
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Justin T. Gibbs <justing@spectralogic.com>
# Date 1329991350 0
# Node ID f9789db96c395aa0770f7ce46d3e9950d9019a5b
# Parent  037537eff0c1a87f9c7ebc6a332405fdf4ef90fd
blkif.h: Document the Red Hat and Citrix blkif multi-page ring extensions

No functional changes.

Signed-off-by: Justin T. Gibbs <justing@spectralogic.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 037537eff0c1 -r f9789db96c39 xen/include/public/io/blkif.h
--- a/xen/include/public/io/blkif.h	Thu Feb 23 10:01:59 2012 +0000
+++ b/xen/include/public/io/blkif.h	Thu Feb 23 10:02:30 2012 +0000
@@ -67,6 +67,9 @@
  * XenStore nodes in sections marked "PRIVATE" are solely for use by the
  * driver side whose XenBus tree contains them.
  *
+ * XenStore nodes marked "DEPRECATED" in their notes section should only be
+ * used to provide interoperability with legacy implementations.
+ *
  * See the XenBus state transition diagram below for details on when XenBus
  * nodes must be published and when they can be queried.
  *
@@ -123,12 +126,31 @@
  *      of this type may still be returned at any time with the
  *      BLKIF_RSP_EOPNOTSUPP result code.
  *
+ *----------------------- Request Transport Parameters ------------------------
+ *
+ * max-ring-page-order
+ *      Values:         <uint32_t>
+ *      Default Value:  0
+ *      Notes:          1, 3
+ *
+ *      The maximum supported size of the request ring buffer in units of
+ *      lb(machine pages). (e.g. 0 == 1 page,  1 = 2 pages, 2 == 4 pages,
+ *      etc.).
+ *
+ * max-ring-pages
+ *      Values:         <uint32_t>
+ *      Default Value:  1
+ *      Notes:          DEPRECATED, 2, 3
+ *
+ *      The maximum supported size of the request ring buffer in units of
+ *      machine pages.  The value must be a power of 2.
+ *
  *------------------------- Backend Device Properties -------------------------
  *
  * discard-aligment
  *      Values:         <uint32_t>
  *      Default Value:  0
- *      Notes:          1, 2
+ *      Notes:          4, 5
  *
  *      The offset, in bytes from the beginning of the virtual block device,
  *      to the first, addressable, discard extent on the underlying device.
@@ -136,7 +158,7 @@
  * discard-granularity
  *      Values:         <uint32_t>
  *      Default Value:  <"sector-size">
- *      Notes:          1
+ *      Notes:          4
  *
  *      The size, in bytes, of the individually addressable discard extents
  *      of the underlying device.
@@ -180,10 +202,20 @@
  *
  * ring-ref
  *      Values:         <uint32_t>
+ *      Notes:          6
  *
  *      The Xen grant reference granting permission for the backend to map
  *      the sole page in a single page sized ring buffer.
  *
+ * ring-ref%u
+ *      Values:         <uint32_t>
+ *      Notes:          6
+ *
+ *      For a frontend providing a multi-page ring, a "number of ring pages"
+ *      sized list of nodes, each containing a Xen grant reference granting
+ *      permission for the backend to map the page of the ring located
+ *      at page index "%u".  Page indexes are zero based.
+ *
  * protocol
  *      Values:         string (XEN_IO_PROTO_ABI_*)
  *      Default Value:  XEN_IO_PROTO_ABI_NATIVE
@@ -191,6 +223,25 @@
  *      The machine ABI rules governing the format of all ring request and
  *      response structures.
  *
+ * ring-page-order
+ *      Values:         <uint32_t>
+ *      Default Value:  0
+ *      Maximum Value:  MAX(ffs(max-ring-pages) - 1, max-ring-page-order)
+ *      Notes:          1, 3
+ *
+ *      The size of the frontend allocated request ring buffer in units
+ *      of lb(machine pages). (e.g. 0 == 1 page, 1 = 2 pages, 2 == 4 pages,
+ *      etc.).
+ *
+ * num-ring-pages
+ *      Values:         <uint32_t>
+ *      Default Value:  1
+ *      Maximum Value:  MAX(max-ring-pages,(0x1 << max-ring-page-order))
+ *      Notes:          DEPRECATED, 2, 3
+ *
+ *      The size of the frontend allocated request ring buffer in units of
+ *      machine pages.  The value must be a power of 2.
+ *
  *------------------------- Virtual Device Properties -------------------------
  *
  * device-type
@@ -208,12 +259,26 @@
  *
  * Notes
  * -----
- * (1) Devices that support discard functionality may internally allocate
+ * (1) Multi-page ring buffer scheme first developed in the Citrix XenServer
+ *     PV drivers.
+ * (2) Multi-page ring buffer scheme first used in some RedHat distributions
+ *     including a distribution deployed on certain nodes of the Amazon
+ *     EC2 cluster.
+ * (3) Support for multi-page ring buffers was implemented independently,
+ *     in slightly different forms, by both Citrix and RedHat/Amazon.
+ *     For full interoperability, block front and backends should publish
+ *     identical ring parameters, adjusted for unit differences, to the
+ *     XenStore nodes used in both schemes.
+ * (4) Devices that support discard functionality may internally allocate
  *     space (discardable extents) in units that are larger than the
  *     exported logical block size.
- * (2) The discard-alignment parameter allows a physical device to be
+ * (5) The discard-alignment parameter allows a physical device to be
  *     partitioned into virtual devices that do not necessarily begin or
  *     end on a discardable extent boundary.
+ * (6) When there is only a single page allocated to the request ring,
+ *     'ring-ref' is used to communicate the grant reference for this
+ *     page to the backend.  When using a multi-page ring, the 'ring-ref'
+ *     node is not created.  Instead 'ring-ref0' - 'ring-refN' are used.
  */
 
 /*
@@ -231,20 +296,26 @@
  *  o Query virtual device               o Query backend device identification
  *    properties.                          data.
  *  o Setup OS device instance.          o Open and validate backend device.
- *                                       o Publish backend features.
+ *                                       o Publish backend features and
+ *                                         transport parameters.
  *                                                      |
  *                                                      |
  *                                                      V
  *                                      XenbusStateInitWait
  *
- * o Query backend features.
+ * o Query backend features and
+ *   transport parameters.
  * o Allocate and initialize the
  *   request ring.
+ * o Publish transport parameters
+ *   that will be in effect during
+ *   this connection.
  *              |
  *              |
  *              V
  * XenbusStateInitialised
  *
+ *                                       o Query frontend transport parameters.
  *                                       o Connect to the request ring and
  *                                         event channel.
  *                                       o Publish backend device properties.
@@ -261,20 +332,26 @@
  *              V
  * XenbusStateConnected
  *
- * Note: Drivers that do not support any optional features can skip certain
- *       states in the state machine:
+ * Note: Drivers that do not support any optional features, or the negotiation
+ *       of transport parameters, can skip certain states in the state machine:
  *
  *       o A frontend may transition to XenbusStateInitialised without
- *         waiting for the backend to enter XenbusStateInitWait.
+ *         waiting for the backend to enter XenbusStateInitWait.  In this
+ *         case, default transport parameters are in effect and any
+ *         transport parameters published by the frontend must contain
+ *         their default values.
  *
  *       o A backend may transition to XenbusStateInitialised, bypassing
  *         XenbusStateInitWait, without waiting for the frontend to first
- *         enter the XenbusStateInitialised state.
+ *         enter the XenbusStateInitialised state.  In this case, default
+ *         transport parameters are in effect and any transport parameters
+ *         published by the backend must contain their default values.
  *
- *       Drivers that support optional features must tolerate these additional
- *       state transition paths.  In general this means performing the work of
- *       any skipped state transition, if it has not already been performed,
- *       in addition to the work associated with entry into the current state.
+ *       Drivers that support optional features and/or transport parameter
+ *       negotiation must tolerate these additional state transition paths.
+ *       In general this means performing the work of any skipped state
+ *       transition, if it has not already been performed, in addition to the
+ *       work associated with entry into the current state.
  */
 
 /*

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnO-0002DJ-7Y; Tue, 28 Feb 2012 06:44:22 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnM-0002AB-HB
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-174.messagelabs.com!1330411452!15205119!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2136 invoked from network); 28 Feb 2012 06:44:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnE-0004FL-B4
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnE-0007In-8y
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:12 +0000
Message-Id: <E1S2GnE-0007In-8y@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] cleanup: Remove dependency files in
	efi directory during a make clean
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1329992095 0
# Node ID 0c91a375f480ffabfba2f87a897ff26b6f4882f7
# Parent  7cf234b198a3252b197aa08a551c7c2b19369ce9
cleanup: Remove dependency files in efi directory during a make clean

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 7cf234b198a3 -r 0c91a375f480 xen/arch/x86/Makefile
--- a/xen/arch/x86/Makefile	Thu Feb 23 10:11:58 2012 +0000
+++ b/xen/arch/x86/Makefile	Thu Feb 23 10:14:55 2012 +0000
@@ -168,5 +168,5 @@
 clean::
 	rm -f asm-offsets.s xen.lds boot/*.o boot/*~ boot/core boot/mkelf32
 	rm -f $(BASEDIR)/.xen-syms.[0-9]* boot/.*.d
-	rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.o efi/mkreloc
+	rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.o efi/mkreloc efi/.*.d
 	rm -f boot/reloc.S boot/reloc.lnk boot/reloc.bin

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnO-0002DJ-7Y; Tue, 28 Feb 2012 06:44:22 +0000
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnM-0002AB-HB
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-174.messagelabs.com!1330411452!15205119!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2136 invoked from network); 28 Feb 2012 06:44:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnE-0004FL-B4
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnE-0007In-8y
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:12 +0000
Message-Id: <E1S2GnE-0007In-8y@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] cleanup: Remove dependency files in
	efi directory during a make clean
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1329992095 0
# Node ID 0c91a375f480ffabfba2f87a897ff26b6f4882f7
# Parent  7cf234b198a3252b197aa08a551c7c2b19369ce9
cleanup: Remove dependency files in efi directory during a make clean

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 7cf234b198a3 -r 0c91a375f480 xen/arch/x86/Makefile
--- a/xen/arch/x86/Makefile	Thu Feb 23 10:11:58 2012 +0000
+++ b/xen/arch/x86/Makefile	Thu Feb 23 10:14:55 2012 +0000
@@ -168,5 +168,5 @@
 clean::
 	rm -f asm-offsets.s xen.lds boot/*.o boot/*~ boot/core boot/mkelf32
 	rm -f $(BASEDIR)/.xen-syms.[0-9]* boot/.*.d
-	rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.o efi/mkreloc
+	rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.o efi/mkreloc efi/.*.d
 	rm -f boot/reloc.S boot/reloc.lnk boot/reloc.bin

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnN-0002Cz-Vo; Tue, 28 Feb 2012 06:44:21 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnM-0002BJ-2u
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:20 +0000
Received: from [85.158.139.83:52050] by server-6.bemta-5.messagelabs.com id
	DF/D6-13222-3C77C4F4; Tue, 28 Feb 2012 06:44:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1330411457!16976419!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6603 invoked from network); 28 Feb 2012 06:44:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnI-0004Fj-IM
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnI-0007Ln-HB
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:16 +0000
Message-Id: <E1S2GnI-0007Ln-HB@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mem_event: use C99 initializers for
	mem_event_request_t users
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329772592 -3600
# Node ID 0c3d19f40ab145d101de84051c3e00eef17fa1cb
# Parent  626fa29dc04d7ed77ae16cfee8a767ff6bb819ad
mem_event: use C99 initializers for mem_event_request_t users

Use C99 initializers for mem_event_request_t users to make sure req is
always cleared, even with local debug patches that shuffle code around
to have a single exit point.
The common case is to use and send req, so it does not add significant
overhead to always clear req.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 626fa29dc04d -r 0c3d19f40ab1 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Mon Feb 20 22:09:40 2012 +0100
+++ b/xen/arch/x86/hvm/hvm.c	Mon Feb 20 22:16:32 2012 +0100
@@ -4302,7 +4302,7 @@
 {
     struct vcpu* v = current;
     struct domain *d = v->domain;
-    mem_event_request_t req;
+    mem_event_request_t req = { .reason = reason };
     int rc;
 
     if ( !(p & HVMPME_MODE_MASK) ) 
@@ -4321,9 +4321,6 @@
     else if ( rc < 0 )
         return rc;
 
-    memset(&req, 0, sizeof(req));
-    req.reason = reason;
-
     if ( (p & HVMPME_MODE_MASK) == HVMPME_mode_sync ) 
     {
         req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED;    
diff -r 626fa29dc04d -r 0c3d19f40ab1 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Mon Feb 20 22:09:40 2012 +0100
+++ b/xen/arch/x86/mm/p2m.c	Mon Feb 20 22:16:32 2012 +0100
@@ -913,7 +913,7 @@
 void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn,
                                 p2m_type_t p2mt)
 {
-    mem_event_request_t req;
+    mem_event_request_t req = { .gfn = gfn };
 
     /* We allow no ring in this unique case, because it won't affect
      * correctness of the guest execution at this point.  If this is the only
@@ -924,8 +924,6 @@
         return;
 
     /* Send release notification to pager */
-    memset(&req, 0, sizeof(req));
-    req.gfn = gfn;
     req.flags = MEM_EVENT_FLAG_DROP_PAGE;
 
     /* Update stats unless the page hasn't yet been evicted */
@@ -962,7 +960,7 @@
 void p2m_mem_paging_populate(struct domain *d, unsigned long gfn)
 {
     struct vcpu *v = current;
-    mem_event_request_t req;
+    mem_event_request_t req = { .gfn = gfn };
     p2m_type_t p2mt;
     p2m_access_t a;
     mfn_t mfn;
@@ -980,8 +978,6 @@
     else if ( rc < 0 )
         return;
 
-    memset(&req, 0, sizeof(req));
-
     /* Fix p2m mapping */
     gfn_lock(p2m, gfn, 0);
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
@@ -1011,7 +1007,6 @@
     }
 
     /* Send request to pager */
-    req.gfn = gfn;
     req.p2mt = p2mt;
     req.vcpu_id = v->vcpu_id;
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnN-0002Cz-Vo; Tue, 28 Feb 2012 06:44:21 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnM-0002BJ-2u
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:20 +0000
Received: from [85.158.139.83:52050] by server-6.bemta-5.messagelabs.com id
	DF/D6-13222-3C77C4F4; Tue, 28 Feb 2012 06:44:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1330411457!16976419!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6603 invoked from network); 28 Feb 2012 06:44:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnI-0004Fj-IM
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnI-0007Ln-HB
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:16 +0000
Message-Id: <E1S2GnI-0007Ln-HB@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mem_event: use C99 initializers for
	mem_event_request_t users
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329772592 -3600
# Node ID 0c3d19f40ab145d101de84051c3e00eef17fa1cb
# Parent  626fa29dc04d7ed77ae16cfee8a767ff6bb819ad
mem_event: use C99 initializers for mem_event_request_t users

Use C99 initializers for mem_event_request_t users to make sure req is
always cleared, even with local debug patches that shuffle code around
to have a single exit point.
The common case is to use and send req, so it does not add significant
overhead to always clear req.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 626fa29dc04d -r 0c3d19f40ab1 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Mon Feb 20 22:09:40 2012 +0100
+++ b/xen/arch/x86/hvm/hvm.c	Mon Feb 20 22:16:32 2012 +0100
@@ -4302,7 +4302,7 @@
 {
     struct vcpu* v = current;
     struct domain *d = v->domain;
-    mem_event_request_t req;
+    mem_event_request_t req = { .reason = reason };
     int rc;
 
     if ( !(p & HVMPME_MODE_MASK) ) 
@@ -4321,9 +4321,6 @@
     else if ( rc < 0 )
         return rc;
 
-    memset(&req, 0, sizeof(req));
-    req.reason = reason;
-
     if ( (p & HVMPME_MODE_MASK) == HVMPME_mode_sync ) 
     {
         req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED;    
diff -r 626fa29dc04d -r 0c3d19f40ab1 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Mon Feb 20 22:09:40 2012 +0100
+++ b/xen/arch/x86/mm/p2m.c	Mon Feb 20 22:16:32 2012 +0100
@@ -913,7 +913,7 @@
 void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn,
                                 p2m_type_t p2mt)
 {
-    mem_event_request_t req;
+    mem_event_request_t req = { .gfn = gfn };
 
     /* We allow no ring in this unique case, because it won't affect
      * correctness of the guest execution at this point.  If this is the only
@@ -924,8 +924,6 @@
         return;
 
     /* Send release notification to pager */
-    memset(&req, 0, sizeof(req));
-    req.gfn = gfn;
     req.flags = MEM_EVENT_FLAG_DROP_PAGE;
 
     /* Update stats unless the page hasn't yet been evicted */
@@ -962,7 +960,7 @@
 void p2m_mem_paging_populate(struct domain *d, unsigned long gfn)
 {
     struct vcpu *v = current;
-    mem_event_request_t req;
+    mem_event_request_t req = { .gfn = gfn };
     p2m_type_t p2mt;
     p2m_access_t a;
     mfn_t mfn;
@@ -980,8 +978,6 @@
     else if ( rc < 0 )
         return;
 
-    memset(&req, 0, sizeof(req));
-
     /* Fix p2m mapping */
     gfn_lock(p2m, gfn, 0);
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
@@ -1011,7 +1007,6 @@
     }
 
     /* Send request to pager */
-    req.gfn = gfn;
     req.p2mt = p2mt;
     req.vcpu_id = v->vcpu_id;
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnP-0002HE-TH; Tue, 28 Feb 2012 06:44:23 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnO-0002DZ-SY
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:22 +0000
Received: from [85.158.139.83:62913] by server-2.bemta-5.messagelabs.com id
	DE/6A-20263-6C77C4F4; Tue, 28 Feb 2012 06:44:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-182.messagelabs.com!1330411459!9639150!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19130 invoked from network); 28 Feb 2012 06:44:20 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnL-0004Fy-9X
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnL-0007Nf-82
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:19 +0000
Message-Id: <E1S2GnL-0007Nf-82@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] SEABIOS_UPSTREAM_TAG Update
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1330359144 0
# Node ID 21c0c086119fea9514949ddbc4b1a17f994f2724
# Parent  071beb00303b9afc4027d4150f0991d9ddc8224a
SEABIOS_UPSTREAM_TAG Update

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r 071beb00303b -r 21c0c086119f Config.mk
--- a/Config.mk	Mon Feb 27 12:10:29 2012 +0000
+++ b/Config.mk	Mon Feb 27 16:12:24 2012 +0000
@@ -194,7 +194,9 @@
 SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 endif
 QEMU_UPSTREAM_REVISION ?= master
-SEABIOS_UPSTREAM_TAG ?= rel-1.6.3.1
+SEABIOS_UPSTREAM_TAG ?= 002d30b5f4f48ee203be3bad9d68dc8b538ee35b
+# Wed Feb 8 20:21:29 2012 -0500
+# Add PYTHON definition to Makefile.
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnP-0002HE-TH; Tue, 28 Feb 2012 06:44:23 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnO-0002DZ-SY
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:22 +0000
Received: from [85.158.139.83:62913] by server-2.bemta-5.messagelabs.com id
	DE/6A-20263-6C77C4F4; Tue, 28 Feb 2012 06:44:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-182.messagelabs.com!1330411459!9639150!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19130 invoked from network); 28 Feb 2012 06:44:20 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnL-0004Fy-9X
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnL-0007Nf-82
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:19 +0000
Message-Id: <E1S2GnL-0007Nf-82@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] SEABIOS_UPSTREAM_TAG Update
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1330359144 0
# Node ID 21c0c086119fea9514949ddbc4b1a17f994f2724
# Parent  071beb00303b9afc4027d4150f0991d9ddc8224a
SEABIOS_UPSTREAM_TAG Update

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r 071beb00303b -r 21c0c086119f Config.mk
--- a/Config.mk	Mon Feb 27 12:10:29 2012 +0000
+++ b/Config.mk	Mon Feb 27 16:12:24 2012 +0000
@@ -194,7 +194,9 @@
 SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 endif
 QEMU_UPSTREAM_REVISION ?= master
-SEABIOS_UPSTREAM_TAG ?= rel-1.6.3.1
+SEABIOS_UPSTREAM_TAG ?= 002d30b5f4f48ee203be3bad9d68dc8b538ee35b
+# Wed Feb 8 20:21:29 2012 -0500
+# Add PYTHON definition to Makefile.
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnP-0002H4-QM; Tue, 28 Feb 2012 06:44:23 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnN-0002Ck-T7
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:22 +0000
Received: from [85.158.139.83:52141] by server-4.bemta-5.messagelabs.com id
	3C/2E-10788-5C77C4F4; Tue, 28 Feb 2012 06:44:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1330411458!14270671!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17362 invoked from network); 28 Feb 2012 06:44:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnJ-0004Fp-NW
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnJ-0007MY-MF
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:17 +0000
Message-Id: <E1S2GnJ-0007MY-MF@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/vMCE: save/restore MCA
	capabilities
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1330070874 -3600
# Node ID 35d855e520038bf5814f53d105dc4adf58a670f2
# Parent  e80b0bb4470b944a5b52a91c0ec85a1d65d18c55
x86/vMCE: save/restore MCA capabilities

This allows migration to a host with less MCA banks than the source
host had, while without this patch accesses to the excess banks' MSRs
caused #GP-s in the guest after migration (and it depended on the guest
kernel whether this would be fatal).

A fundamental question is whether we should also save/restore MCG_CTL
and MCi_CTL, as the HVM save record would better be defined to the
complete state that needs saving from the beginning (I'm unsure whether
the save/restore logic allows for future extension of an existing
record).

Of course, this change is expected to make migration from new to older
Xen impossible (again I'm unsure what the save/restore logic does with
records it doesn't even know about).

The (trivial) tools side change may seem unrelated, but the code should
have been that way from the beginning to allow the hypervisor to look
at currently unused ext_vcpucontext fields without risking to read
garbage when those fields get a meaning assigned in the future. This
isn't being enforced here - should it be? (Obviously, for backwards
compatibility, the hypervisor must assume these fields to be clear only
when the extended context's size exceeds the old original one.)

A future addition to this change might be to allow configuration of the
number of banks and other MCA capabilities for a guest before it starts
(i.e. to not inherits the values seen on the first host it runs on).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r e80b0bb4470b -r 35d855e52003 tools/libxc/xc_domain_save.c
--- a/tools/libxc/xc_domain_save.c	Fri Feb 24 09:03:43 2012 +0100
+++ b/tools/libxc/xc_domain_save.c	Fri Feb 24 09:07:54 2012 +0100
@@ -1879,6 +1879,7 @@
 
         domctl.cmd = XEN_DOMCTL_get_ext_vcpucontext;
         domctl.domain = dom;
+        memset(&domctl.u, 0, sizeof(domctl.u));
         domctl.u.ext_vcpucontext.vcpu = i;
         if ( xc_domctl(xch, &domctl) < 0 )
         {
diff -r e80b0bb4470b -r 35d855e52003 tools/misc/xen-hvmctx.c
--- a/tools/misc/xen-hvmctx.c	Fri Feb 24 09:03:43 2012 +0100
+++ b/tools/misc/xen-hvmctx.c	Fri Feb 24 09:07:54 2012 +0100
@@ -383,6 +383,13 @@
            (unsigned long long) p.apic_assist);           
 }
 
+static void dump_vmce_vcpu(void)
+{
+    HVM_SAVE_TYPE(VMCE_VCPU) p;
+    READ(p);
+    printf("    VMCE_VCPU: caps %" PRIx64 "\n", p.caps);
+}
+
 int main(int argc, char **argv)
 {
     int entry, domid;
@@ -449,6 +456,7 @@
         case HVM_SAVE_CODE(MTRR): dump_mtrr(); break;
         case HVM_SAVE_CODE(VIRIDIAN_DOMAIN): dump_viridian_domain(); break;
         case HVM_SAVE_CODE(VIRIDIAN_VCPU): dump_viridian_vcpu(); break;
+        case HVM_SAVE_CODE(VMCE_VCPU): dump_vmce_vcpu(); break;
         case HVM_SAVE_CODE(END): break;
         default:
             printf(" ** Don't understand type %u: skipping\n",
diff -r e80b0bb4470b -r 35d855e52003 xen/arch/x86/cpu/mcheck/mce.h
--- a/xen/arch/x86/cpu/mcheck/mce.h	Fri Feb 24 09:03:43 2012 +0100
+++ b/xen/arch/x86/cpu/mcheck/mce.h	Fri Feb 24 09:07:54 2012 +0100
@@ -3,6 +3,7 @@
 #define _MCE_H
 
 #include <xen/init.h>
+#include <xen/sched.h>
 #include <xen/smp.h>
 #include <asm/types.h>
 #include <asm/traps.h>
@@ -54,8 +55,8 @@
 u64 mce_cap_init(void);
 extern unsigned int firstbank;
 
-int intel_mce_rdmsr(uint32_t msr, uint64_t *val);
-int intel_mce_wrmsr(uint32_t msr, uint64_t val);
+int intel_mce_rdmsr(const struct vcpu *, uint32_t msr, uint64_t *val);
+int intel_mce_wrmsr(struct vcpu *, uint32_t msr, uint64_t val);
 
 struct mcinfo_extended *intel_get_extended_msrs(
     struct mcinfo_global *mig, struct mc_info *mi);
@@ -171,18 +172,20 @@
 
 extern int vmce_init(struct cpuinfo_x86 *c);
 
-static inline int mce_vendor_bank_msr(uint32_t msr)
+static inline int mce_vendor_bank_msr(const struct vcpu *v, uint32_t msr)
 {
     if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
-         msr >= MSR_IA32_MC0_CTL2 && msr < (MSR_IA32_MC0_CTL2 + nr_mce_banks) )
+         msr >= MSR_IA32_MC0_CTL2 &&
+         msr < MSR_IA32_MCx_CTL2(v->arch.mcg_cap & MCG_CAP_COUNT) )
           return 1;
     return 0;
 }
 
-static inline int mce_bank_msr(uint32_t msr)
+static inline int mce_bank_msr(const struct vcpu *v, uint32_t msr)
 {
-    if ( (msr >= MSR_IA32_MC0_CTL && msr < MSR_IA32_MCx_CTL(nr_mce_banks)) ||
-        mce_vendor_bank_msr(msr) )
+    if ( (msr >= MSR_IA32_MC0_CTL &&
+          msr < MSR_IA32_MCx_CTL(v->arch.mcg_cap & MCG_CAP_COUNT)) ||
+         mce_vendor_bank_msr(v, msr) )
         return 1;
     return 0;
 }
diff -r e80b0bb4470b -r 35d855e52003 xen/arch/x86/cpu/mcheck/mce_intel.c
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c	Fri Feb 24 09:03:43 2012 +0100
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c	Fri Feb 24 09:07:54 2012 +0100
@@ -1421,11 +1421,12 @@
 }
 
 /* intel specific MCA MSR */
-int intel_mce_wrmsr(uint32_t msr, uint64_t val)
+int intel_mce_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
 {
     int ret = 0;
 
-    if (msr >= MSR_IA32_MC0_CTL2 && msr < (MSR_IA32_MC0_CTL2 + nr_mce_banks))
+    if ( msr >= MSR_IA32_MC0_CTL2 &&
+         msr < MSR_IA32_MCx_CTL2(v->arch.mcg_cap & MCG_CAP_COUNT) )
     {
         mce_printk(MCE_QUIET, "We have disabled CMCI capability, "
                  "Guest should not write this MSR!\n");
@@ -1435,11 +1436,12 @@
     return ret;
 }
 
-int intel_mce_rdmsr(uint32_t msr, uint64_t *val)
+int intel_mce_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
 {
     int ret = 0;
 
-    if (msr >= MSR_IA32_MC0_CTL2 && msr < (MSR_IA32_MC0_CTL2 + nr_mce_banks))
+    if ( msr >= MSR_IA32_MC0_CTL2 &&
+         msr < MSR_IA32_MCx_CTL2(v->arch.mcg_cap & MCG_CAP_COUNT) )
     {
         mce_printk(MCE_QUIET, "We have disabled CMCI capability, "
                  "Guest should not read this MSR!\n");
diff -r e80b0bb4470b -r 35d855e52003 xen/arch/x86/cpu/mcheck/vmce.c
--- a/xen/arch/x86/cpu/mcheck/vmce.c	Fri Feb 24 09:03:43 2012 +0100
+++ b/xen/arch/x86/cpu/mcheck/vmce.c	Fri Feb 24 09:07:54 2012 +0100
@@ -10,6 +10,7 @@
 #include <xen/delay.h>
 #include <xen/smp.h>
 #include <xen/mm.h>
+#include <xen/hvm/save.h>
 #include <asm/processor.h>
 #include <public/sysctl.h>
 #include <asm/system.h>
@@ -42,7 +43,6 @@
            nr_mce_banks * sizeof(*dom_vmce(d)->mci_ctl));
 
     dom_vmce(d)->mcg_status = 0x0;
-    dom_vmce(d)->mcg_cap = g_mcg_cap;
     dom_vmce(d)->mcg_ctl = ~(uint64_t)0x0;
     dom_vmce(d)->nr_injection = 0;
 
@@ -61,21 +61,41 @@
     dom_vmce(d) = NULL;
 }
 
-static int bank_mce_rdmsr(struct domain *d, uint32_t msr, uint64_t *val)
+void vmce_init_vcpu(struct vcpu *v)
 {
-    int bank, ret = 1;
-    struct domain_mca_msrs *vmce = dom_vmce(d);
+    v->arch.mcg_cap = g_mcg_cap;
+}
+
+int vmce_restore_vcpu(struct vcpu *v, uint64_t caps)
+{
+    if ( caps & ~g_mcg_cap & ~MCG_CAP_COUNT & ~MCG_CTL_P )
+    {
+        dprintk(XENLOG_G_ERR, "%s restore: unsupported MCA capabilities"
+                " %#" PRIx64 " for d%d:v%u (supported: %#Lx)\n",
+                is_hvm_vcpu(v) ? "HVM" : "PV", caps, v->domain->domain_id,
+                v->vcpu_id, g_mcg_cap & ~MCG_CAP_COUNT);
+        return -EPERM;
+    }
+
+    v->arch.mcg_cap = caps;
+    return 0;
+}
+
+static int bank_mce_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
+{
+    int ret = 1;
+    unsigned int bank = (msr - MSR_IA32_MC0_CTL) / 4;
+    struct domain_mca_msrs *vmce = dom_vmce(v->domain);
     struct bank_entry *entry;
 
-    bank = (msr - MSR_IA32_MC0_CTL) / 4;
-    if ( bank >= nr_mce_banks )
-        return -1;
+    *val = 0;
 
     switch ( msr & (MSR_IA32_MC0_CTL | 3) )
     {
     case MSR_IA32_MC0_CTL:
-        *val = vmce->mci_ctl[bank] &
-            (h_mci_ctrl ? h_mci_ctrl[bank] : ~0UL);
+        if ( bank < nr_mce_banks )
+            *val = vmce->mci_ctl[bank] &
+                   (h_mci_ctrl ? h_mci_ctrl[bank] : ~0UL);
         mce_printk(MCE_VERBOSE, "MCE: rdmsr MC%u_CTL 0x%"PRIx64"\n",
                    bank, *val);
         break;
@@ -126,7 +146,7 @@
         switch ( boot_cpu_data.x86_vendor )
         {
         case X86_VENDOR_INTEL:
-            ret = intel_mce_rdmsr(msr, val);
+            ret = intel_mce_rdmsr(v, msr, val);
             break;
         default:
             ret = 0;
@@ -145,13 +165,13 @@
  */
 int vmce_rdmsr(uint32_t msr, uint64_t *val)
 {
-    struct domain *d = current->domain;
-    struct domain_mca_msrs *vmce = dom_vmce(d);
+    const struct vcpu *cur = current;
+    struct domain_mca_msrs *vmce = dom_vmce(cur->domain);
     int ret = 1;
 
     *val = 0;
 
-    spin_lock(&dom_vmce(d)->lock);
+    spin_lock(&vmce->lock);
 
     switch ( msr )
     {
@@ -162,39 +182,38 @@
                        "MCE: rdmsr MCG_STATUS 0x%"PRIx64"\n", *val);
         break;
     case MSR_IA32_MCG_CAP:
-        *val = vmce->mcg_cap;
+        *val = cur->arch.mcg_cap;
         mce_printk(MCE_VERBOSE, "MCE: rdmsr MCG_CAP 0x%"PRIx64"\n",
                    *val);
         break;
     case MSR_IA32_MCG_CTL:
         /* Always 0 if no CTL support */
-        *val = vmce->mcg_ctl & h_mcg_ctl;
+        if ( cur->arch.mcg_cap & MCG_CTL_P )
+            *val = vmce->mcg_ctl & h_mcg_ctl;
         mce_printk(MCE_VERBOSE, "MCE: rdmsr MCG_CTL 0x%"PRIx64"\n",
                    *val);
         break;
     default:
-        ret = mce_bank_msr(msr) ? bank_mce_rdmsr(d, msr, val) : 0;
+        ret = mce_bank_msr(cur, msr) ? bank_mce_rdmsr(cur, msr, val) : 0;
         break;
     }
 
-    spin_unlock(&dom_vmce(d)->lock);
+    spin_unlock(&vmce->lock);
     return ret;
 }
 
-static int bank_mce_wrmsr(struct domain *d, u32 msr, u64 val)
+static int bank_mce_wrmsr(struct vcpu *v, u32 msr, u64 val)
 {
-    int bank, ret = 1;
-    struct domain_mca_msrs *vmce = dom_vmce(d);
+    int ret = 1;
+    unsigned int bank = (msr - MSR_IA32_MC0_CTL) / 4;
+    struct domain_mca_msrs *vmce = dom_vmce(v->domain);
     struct bank_entry *entry = NULL;
 
-    bank = (msr - MSR_IA32_MC0_CTL) / 4;
-    if ( bank >= nr_mce_banks )
-        return -EINVAL;
-
     switch ( msr & (MSR_IA32_MC0_CTL | 3) )
     {
     case MSR_IA32_MC0_CTL:
-        vmce->mci_ctl[bank] = val;
+        if ( bank < nr_mce_banks )
+            vmce->mci_ctl[bank] = val;
         break;
     case MSR_IA32_MC0_STATUS:
         /* Give the first entry of the list, it corresponds to current
@@ -202,9 +221,9 @@
          * the guest, this node will be deleted.
          * Only error bank is written. Non-error banks simply return.
          */
-        if ( !list_empty(&dom_vmce(d)->impact_header) )
+        if ( !list_empty(&vmce->impact_header) )
         {
-            entry = list_entry(dom_vmce(d)->impact_header.next,
+            entry = list_entry(vmce->impact_header.next,
                                struct bank_entry, list);
             if ( entry->bank == bank )
                 entry->mci_status = val;
@@ -228,7 +247,7 @@
         switch ( boot_cpu_data.x86_vendor )
         {
         case X86_VENDOR_INTEL:
-            ret = intel_mce_wrmsr(msr, val);
+            ret = intel_mce_wrmsr(v, msr, val);
             break;
         default:
             ret = 0;
@@ -247,9 +266,9 @@
  */
 int vmce_wrmsr(u32 msr, u64 val)
 {
-    struct domain *d = current->domain;
+    struct vcpu *cur = current;
     struct bank_entry *entry = NULL;
-    struct domain_mca_msrs *vmce = dom_vmce(d);
+    struct domain_mca_msrs *vmce = dom_vmce(cur->domain);
     int ret = 1;
 
     if ( !g_mcg_cap )
@@ -266,7 +285,7 @@
         vmce->mcg_status = val;
         mce_printk(MCE_VERBOSE, "MCE: wrmsr MCG_STATUS %"PRIx64"\n", val);
         /* For HVM guest, this is the point for deleting vMCE injection node */
-        if ( d->is_hvm && (vmce->nr_injection > 0) )
+        if ( is_hvm_vcpu(cur) && (vmce->nr_injection > 0) )
         {
             vmce->nr_injection--; /* Should be 0 */
             if ( !list_empty(&vmce->impact_header) )
@@ -293,7 +312,7 @@
         ret = -1;
         break;
     default:
-        ret = mce_bank_msr(msr) ? bank_mce_wrmsr(d, msr, val) : 0;
+        ret = mce_bank_msr(cur, msr) ? bank_mce_wrmsr(cur, msr, val) : 0;
         break;
     }
 
@@ -301,6 +320,46 @@
     return ret;
 }
 
+static int vmce_save_vcpu_ctxt(struct domain *d, hvm_domain_context_t *h)
+{
+    struct vcpu *v;
+    int err = 0;
+
+    for_each_vcpu( d, v ) {
+        struct hvm_vmce_vcpu ctxt = {
+            .caps = v->arch.mcg_cap
+        };
+
+        err = hvm_save_entry(VMCE_VCPU, v->vcpu_id, h, &ctxt);
+        if ( err )
+            break;
+    }
+
+    return err;
+}
+
+static int vmce_load_vcpu_ctxt(struct domain *d, hvm_domain_context_t *h)
+{
+    unsigned int vcpuid = hvm_load_instance(h);
+    struct vcpu *v;
+    struct hvm_vmce_vcpu ctxt;
+    int err;
+
+    if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
+    {
+        dprintk(XENLOG_G_ERR, "HVM restore: dom%d has no vcpu%u\n",
+                d->domain_id, vcpuid);
+        err = -EINVAL;
+    }
+    else
+        err = hvm_load_entry(VMCE_VCPU, h, &ctxt);
+
+    return err ?: vmce_restore_vcpu(v, ctxt.caps);
+}
+
+HVM_REGISTER_SAVE_RESTORE(VMCE_VCPU, vmce_save_vcpu_ctxt,
+                          vmce_load_vcpu_ctxt, 1, HVMSR_PER_VCPU);
+
 int inject_vmce(struct domain *d)
 {
     int cpu = smp_processor_id();
diff -r e80b0bb4470b -r 35d855e52003 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c	Fri Feb 24 09:03:43 2012 +0100
+++ b/xen/arch/x86/domain.c	Fri Feb 24 09:07:54 2012 +0100
@@ -422,6 +422,8 @@
     if ( (rc = vcpu_init_fpu(v)) != 0 )
         return rc;
 
+    vmce_init_vcpu(v);
+
     if ( is_hvm_domain(d) )
     {
         rc = hvm_vcpu_initialise(v);
diff -r e80b0bb4470b -r 35d855e52003 xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c	Fri Feb 24 09:03:43 2012 +0100
+++ b/xen/arch/x86/domctl.c	Fri Feb 24 09:07:54 2012 +0100
@@ -1029,11 +1029,12 @@
                 evc->syscall32_callback_eip    = 0;
                 evc->syscall32_disables_events = 0;
             }
+            evc->mcg_cap = v->arch.mcg_cap;
         }
         else
         {
             ret = -EINVAL;
-            if ( evc->size != sizeof(*evc) )
+            if ( evc->size < offsetof(typeof(*evc), mcg_cap) )
                 goto ext_vcpucontext_out;
 #ifdef __x86_64__
             if ( !is_hvm_domain(d) )
@@ -1061,6 +1062,10 @@
                  (evc->syscall32_callback_cs & ~3) ||
                  evc->syscall32_callback_eip )
                 goto ext_vcpucontext_out;
+
+            if ( evc->size >= offsetof(typeof(*evc), mcg_cap) +
+                              sizeof(evc->mcg_cap) )
+                ret = vmce_restore_vcpu(v, evc->mcg_cap);
         }
 
         ret = 0;
diff -r e80b0bb4470b -r 35d855e52003 xen/include/asm-x86/domain.h
--- a/xen/include/asm-x86/domain.h	Fri Feb 24 09:03:43 2012 +0100
+++ b/xen/include/asm-x86/domain.h	Fri Feb 24 09:07:54 2012 +0100
@@ -488,6 +488,8 @@
     /* This variable determines whether nonlazy extended state has been used,
      * and thus should be saved/restored. */
     bool_t nonlazy_xstate_used;
+
+    uint64_t mcg_cap;
     
     struct paging_vcpu paging;
 
diff -r e80b0bb4470b -r 35d855e52003 xen/include/asm-x86/mce.h
--- a/xen/include/asm-x86/mce.h	Fri Feb 24 09:03:43 2012 +0100
+++ b/xen/include/asm-x86/mce.h	Fri Feb 24 09:07:54 2012 +0100
@@ -16,7 +16,6 @@
 struct domain_mca_msrs
 {
     /* Guest should not change below values after DOM boot up */
-    uint64_t mcg_cap;
     uint64_t mcg_ctl;
     uint64_t mcg_status;
     uint64_t *mci_ctl;
@@ -28,6 +27,8 @@
 /* Guest vMCE MSRs virtualization */
 extern int vmce_init_msr(struct domain *d);
 extern void vmce_destroy_msr(struct domain *d);
+extern void vmce_init_vcpu(struct vcpu *);
+extern int vmce_restore_vcpu(struct vcpu *, uint64_t caps);
 extern int vmce_wrmsr(uint32_t msr, uint64_t val);
 extern int vmce_rdmsr(uint32_t msr, uint64_t *val);
 
diff -r e80b0bb4470b -r 35d855e52003 xen/include/public/arch-x86/hvm/save.h
--- a/xen/include/public/arch-x86/hvm/save.h	Fri Feb 24 09:03:43 2012 +0100
+++ b/xen/include/public/arch-x86/hvm/save.h	Fri Feb 24 09:07:54 2012 +0100
@@ -575,9 +575,15 @@
 
 DECLARE_HVM_SAVE_TYPE(VIRIDIAN_VCPU, 17, struct hvm_viridian_vcpu_context);
 
+struct hvm_vmce_vcpu {
+    uint64_t caps;
+};
+
+DECLARE_HVM_SAVE_TYPE(VMCE_VCPU, 18, struct hvm_vmce_vcpu);
+
 /* 
  * Largest type-code in use
  */
-#define HVM_SAVE_CODE_MAX 17
+#define HVM_SAVE_CODE_MAX 18
 
 #endif /* __XEN_PUBLIC_HVM_SAVE_X86_H__ */
diff -r e80b0bb4470b -r 35d855e52003 xen/include/public/domctl.h
--- a/xen/include/public/domctl.h	Fri Feb 24 09:03:43 2012 +0100
+++ b/xen/include/public/domctl.h	Fri Feb 24 09:07:54 2012 +0100
@@ -559,7 +559,7 @@
     uint32_t         vcpu;
     /*
      * SET: Size of struct (IN)
-     * GET: Size of struct (OUT)
+     * GET: Size of struct (OUT, up to 128 bytes)
      */
     uint32_t         size;
 #if defined(__i386__) || defined(__x86_64__)
@@ -571,6 +571,7 @@
     uint16_t         sysenter_callback_cs;
     uint8_t          syscall32_disables_events;
     uint8_t          sysenter_disables_events;
+    uint64_aligned_t mcg_cap;
 #endif
 };
 typedef struct xen_domctl_ext_vcpucontext xen_domctl_ext_vcpucontext_t;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnP-0002H4-QM; Tue, 28 Feb 2012 06:44:23 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnN-0002Ck-T7
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:22 +0000
Received: from [85.158.139.83:52141] by server-4.bemta-5.messagelabs.com id
	3C/2E-10788-5C77C4F4; Tue, 28 Feb 2012 06:44:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1330411458!14270671!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17362 invoked from network); 28 Feb 2012 06:44:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnJ-0004Fp-NW
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnJ-0007MY-MF
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:17 +0000
Message-Id: <E1S2GnJ-0007MY-MF@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/vMCE: save/restore MCA
	capabilities
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1330070874 -3600
# Node ID 35d855e520038bf5814f53d105dc4adf58a670f2
# Parent  e80b0bb4470b944a5b52a91c0ec85a1d65d18c55
x86/vMCE: save/restore MCA capabilities

This allows migration to a host with less MCA banks than the source
host had, while without this patch accesses to the excess banks' MSRs
caused #GP-s in the guest after migration (and it depended on the guest
kernel whether this would be fatal).

A fundamental question is whether we should also save/restore MCG_CTL
and MCi_CTL, as the HVM save record would better be defined to the
complete state that needs saving from the beginning (I'm unsure whether
the save/restore logic allows for future extension of an existing
record).

Of course, this change is expected to make migration from new to older
Xen impossible (again I'm unsure what the save/restore logic does with
records it doesn't even know about).

The (trivial) tools side change may seem unrelated, but the code should
have been that way from the beginning to allow the hypervisor to look
at currently unused ext_vcpucontext fields without risking to read
garbage when those fields get a meaning assigned in the future. This
isn't being enforced here - should it be? (Obviously, for backwards
compatibility, the hypervisor must assume these fields to be clear only
when the extended context's size exceeds the old original one.)

A future addition to this change might be to allow configuration of the
number of banks and other MCA capabilities for a guest before it starts
(i.e. to not inherits the values seen on the first host it runs on).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r e80b0bb4470b -r 35d855e52003 tools/libxc/xc_domain_save.c
--- a/tools/libxc/xc_domain_save.c	Fri Feb 24 09:03:43 2012 +0100
+++ b/tools/libxc/xc_domain_save.c	Fri Feb 24 09:07:54 2012 +0100
@@ -1879,6 +1879,7 @@
 
         domctl.cmd = XEN_DOMCTL_get_ext_vcpucontext;
         domctl.domain = dom;
+        memset(&domctl.u, 0, sizeof(domctl.u));
         domctl.u.ext_vcpucontext.vcpu = i;
         if ( xc_domctl(xch, &domctl) < 0 )
         {
diff -r e80b0bb4470b -r 35d855e52003 tools/misc/xen-hvmctx.c
--- a/tools/misc/xen-hvmctx.c	Fri Feb 24 09:03:43 2012 +0100
+++ b/tools/misc/xen-hvmctx.c	Fri Feb 24 09:07:54 2012 +0100
@@ -383,6 +383,13 @@
            (unsigned long long) p.apic_assist);           
 }
 
+static void dump_vmce_vcpu(void)
+{
+    HVM_SAVE_TYPE(VMCE_VCPU) p;
+    READ(p);
+    printf("    VMCE_VCPU: caps %" PRIx64 "\n", p.caps);
+}
+
 int main(int argc, char **argv)
 {
     int entry, domid;
@@ -449,6 +456,7 @@
         case HVM_SAVE_CODE(MTRR): dump_mtrr(); break;
         case HVM_SAVE_CODE(VIRIDIAN_DOMAIN): dump_viridian_domain(); break;
         case HVM_SAVE_CODE(VIRIDIAN_VCPU): dump_viridian_vcpu(); break;
+        case HVM_SAVE_CODE(VMCE_VCPU): dump_vmce_vcpu(); break;
         case HVM_SAVE_CODE(END): break;
         default:
             printf(" ** Don't understand type %u: skipping\n",
diff -r e80b0bb4470b -r 35d855e52003 xen/arch/x86/cpu/mcheck/mce.h
--- a/xen/arch/x86/cpu/mcheck/mce.h	Fri Feb 24 09:03:43 2012 +0100
+++ b/xen/arch/x86/cpu/mcheck/mce.h	Fri Feb 24 09:07:54 2012 +0100
@@ -3,6 +3,7 @@
 #define _MCE_H
 
 #include <xen/init.h>
+#include <xen/sched.h>
 #include <xen/smp.h>
 #include <asm/types.h>
 #include <asm/traps.h>
@@ -54,8 +55,8 @@
 u64 mce_cap_init(void);
 extern unsigned int firstbank;
 
-int intel_mce_rdmsr(uint32_t msr, uint64_t *val);
-int intel_mce_wrmsr(uint32_t msr, uint64_t val);
+int intel_mce_rdmsr(const struct vcpu *, uint32_t msr, uint64_t *val);
+int intel_mce_wrmsr(struct vcpu *, uint32_t msr, uint64_t val);
 
 struct mcinfo_extended *intel_get_extended_msrs(
     struct mcinfo_global *mig, struct mc_info *mi);
@@ -171,18 +172,20 @@
 
 extern int vmce_init(struct cpuinfo_x86 *c);
 
-static inline int mce_vendor_bank_msr(uint32_t msr)
+static inline int mce_vendor_bank_msr(const struct vcpu *v, uint32_t msr)
 {
     if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
-         msr >= MSR_IA32_MC0_CTL2 && msr < (MSR_IA32_MC0_CTL2 + nr_mce_banks) )
+         msr >= MSR_IA32_MC0_CTL2 &&
+         msr < MSR_IA32_MCx_CTL2(v->arch.mcg_cap & MCG_CAP_COUNT) )
           return 1;
     return 0;
 }
 
-static inline int mce_bank_msr(uint32_t msr)
+static inline int mce_bank_msr(const struct vcpu *v, uint32_t msr)
 {
-    if ( (msr >= MSR_IA32_MC0_CTL && msr < MSR_IA32_MCx_CTL(nr_mce_banks)) ||
-        mce_vendor_bank_msr(msr) )
+    if ( (msr >= MSR_IA32_MC0_CTL &&
+          msr < MSR_IA32_MCx_CTL(v->arch.mcg_cap & MCG_CAP_COUNT)) ||
+         mce_vendor_bank_msr(v, msr) )
         return 1;
     return 0;
 }
diff -r e80b0bb4470b -r 35d855e52003 xen/arch/x86/cpu/mcheck/mce_intel.c
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c	Fri Feb 24 09:03:43 2012 +0100
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c	Fri Feb 24 09:07:54 2012 +0100
@@ -1421,11 +1421,12 @@
 }
 
 /* intel specific MCA MSR */
-int intel_mce_wrmsr(uint32_t msr, uint64_t val)
+int intel_mce_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
 {
     int ret = 0;
 
-    if (msr >= MSR_IA32_MC0_CTL2 && msr < (MSR_IA32_MC0_CTL2 + nr_mce_banks))
+    if ( msr >= MSR_IA32_MC0_CTL2 &&
+         msr < MSR_IA32_MCx_CTL2(v->arch.mcg_cap & MCG_CAP_COUNT) )
     {
         mce_printk(MCE_QUIET, "We have disabled CMCI capability, "
                  "Guest should not write this MSR!\n");
@@ -1435,11 +1436,12 @@
     return ret;
 }
 
-int intel_mce_rdmsr(uint32_t msr, uint64_t *val)
+int intel_mce_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
 {
     int ret = 0;
 
-    if (msr >= MSR_IA32_MC0_CTL2 && msr < (MSR_IA32_MC0_CTL2 + nr_mce_banks))
+    if ( msr >= MSR_IA32_MC0_CTL2 &&
+         msr < MSR_IA32_MCx_CTL2(v->arch.mcg_cap & MCG_CAP_COUNT) )
     {
         mce_printk(MCE_QUIET, "We have disabled CMCI capability, "
                  "Guest should not read this MSR!\n");
diff -r e80b0bb4470b -r 35d855e52003 xen/arch/x86/cpu/mcheck/vmce.c
--- a/xen/arch/x86/cpu/mcheck/vmce.c	Fri Feb 24 09:03:43 2012 +0100
+++ b/xen/arch/x86/cpu/mcheck/vmce.c	Fri Feb 24 09:07:54 2012 +0100
@@ -10,6 +10,7 @@
 #include <xen/delay.h>
 #include <xen/smp.h>
 #include <xen/mm.h>
+#include <xen/hvm/save.h>
 #include <asm/processor.h>
 #include <public/sysctl.h>
 #include <asm/system.h>
@@ -42,7 +43,6 @@
            nr_mce_banks * sizeof(*dom_vmce(d)->mci_ctl));
 
     dom_vmce(d)->mcg_status = 0x0;
-    dom_vmce(d)->mcg_cap = g_mcg_cap;
     dom_vmce(d)->mcg_ctl = ~(uint64_t)0x0;
     dom_vmce(d)->nr_injection = 0;
 
@@ -61,21 +61,41 @@
     dom_vmce(d) = NULL;
 }
 
-static int bank_mce_rdmsr(struct domain *d, uint32_t msr, uint64_t *val)
+void vmce_init_vcpu(struct vcpu *v)
 {
-    int bank, ret = 1;
-    struct domain_mca_msrs *vmce = dom_vmce(d);
+    v->arch.mcg_cap = g_mcg_cap;
+}
+
+int vmce_restore_vcpu(struct vcpu *v, uint64_t caps)
+{
+    if ( caps & ~g_mcg_cap & ~MCG_CAP_COUNT & ~MCG_CTL_P )
+    {
+        dprintk(XENLOG_G_ERR, "%s restore: unsupported MCA capabilities"
+                " %#" PRIx64 " for d%d:v%u (supported: %#Lx)\n",
+                is_hvm_vcpu(v) ? "HVM" : "PV", caps, v->domain->domain_id,
+                v->vcpu_id, g_mcg_cap & ~MCG_CAP_COUNT);
+        return -EPERM;
+    }
+
+    v->arch.mcg_cap = caps;
+    return 0;
+}
+
+static int bank_mce_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
+{
+    int ret = 1;
+    unsigned int bank = (msr - MSR_IA32_MC0_CTL) / 4;
+    struct domain_mca_msrs *vmce = dom_vmce(v->domain);
     struct bank_entry *entry;
 
-    bank = (msr - MSR_IA32_MC0_CTL) / 4;
-    if ( bank >= nr_mce_banks )
-        return -1;
+    *val = 0;
 
     switch ( msr & (MSR_IA32_MC0_CTL | 3) )
     {
     case MSR_IA32_MC0_CTL:
-        *val = vmce->mci_ctl[bank] &
-            (h_mci_ctrl ? h_mci_ctrl[bank] : ~0UL);
+        if ( bank < nr_mce_banks )
+            *val = vmce->mci_ctl[bank] &
+                   (h_mci_ctrl ? h_mci_ctrl[bank] : ~0UL);
         mce_printk(MCE_VERBOSE, "MCE: rdmsr MC%u_CTL 0x%"PRIx64"\n",
                    bank, *val);
         break;
@@ -126,7 +146,7 @@
         switch ( boot_cpu_data.x86_vendor )
         {
         case X86_VENDOR_INTEL:
-            ret = intel_mce_rdmsr(msr, val);
+            ret = intel_mce_rdmsr(v, msr, val);
             break;
         default:
             ret = 0;
@@ -145,13 +165,13 @@
  */
 int vmce_rdmsr(uint32_t msr, uint64_t *val)
 {
-    struct domain *d = current->domain;
-    struct domain_mca_msrs *vmce = dom_vmce(d);
+    const struct vcpu *cur = current;
+    struct domain_mca_msrs *vmce = dom_vmce(cur->domain);
     int ret = 1;
 
     *val = 0;
 
-    spin_lock(&dom_vmce(d)->lock);
+    spin_lock(&vmce->lock);
 
     switch ( msr )
     {
@@ -162,39 +182,38 @@
                        "MCE: rdmsr MCG_STATUS 0x%"PRIx64"\n", *val);
         break;
     case MSR_IA32_MCG_CAP:
-        *val = vmce->mcg_cap;
+        *val = cur->arch.mcg_cap;
         mce_printk(MCE_VERBOSE, "MCE: rdmsr MCG_CAP 0x%"PRIx64"\n",
                    *val);
         break;
     case MSR_IA32_MCG_CTL:
         /* Always 0 if no CTL support */
-        *val = vmce->mcg_ctl & h_mcg_ctl;
+        if ( cur->arch.mcg_cap & MCG_CTL_P )
+            *val = vmce->mcg_ctl & h_mcg_ctl;
         mce_printk(MCE_VERBOSE, "MCE: rdmsr MCG_CTL 0x%"PRIx64"\n",
                    *val);
         break;
     default:
-        ret = mce_bank_msr(msr) ? bank_mce_rdmsr(d, msr, val) : 0;
+        ret = mce_bank_msr(cur, msr) ? bank_mce_rdmsr(cur, msr, val) : 0;
         break;
     }
 
-    spin_unlock(&dom_vmce(d)->lock);
+    spin_unlock(&vmce->lock);
     return ret;
 }
 
-static int bank_mce_wrmsr(struct domain *d, u32 msr, u64 val)
+static int bank_mce_wrmsr(struct vcpu *v, u32 msr, u64 val)
 {
-    int bank, ret = 1;
-    struct domain_mca_msrs *vmce = dom_vmce(d);
+    int ret = 1;
+    unsigned int bank = (msr - MSR_IA32_MC0_CTL) / 4;
+    struct domain_mca_msrs *vmce = dom_vmce(v->domain);
     struct bank_entry *entry = NULL;
 
-    bank = (msr - MSR_IA32_MC0_CTL) / 4;
-    if ( bank >= nr_mce_banks )
-        return -EINVAL;
-
     switch ( msr & (MSR_IA32_MC0_CTL | 3) )
     {
     case MSR_IA32_MC0_CTL:
-        vmce->mci_ctl[bank] = val;
+        if ( bank < nr_mce_banks )
+            vmce->mci_ctl[bank] = val;
         break;
     case MSR_IA32_MC0_STATUS:
         /* Give the first entry of the list, it corresponds to current
@@ -202,9 +221,9 @@
          * the guest, this node will be deleted.
          * Only error bank is written. Non-error banks simply return.
          */
-        if ( !list_empty(&dom_vmce(d)->impact_header) )
+        if ( !list_empty(&vmce->impact_header) )
         {
-            entry = list_entry(dom_vmce(d)->impact_header.next,
+            entry = list_entry(vmce->impact_header.next,
                                struct bank_entry, list);
             if ( entry->bank == bank )
                 entry->mci_status = val;
@@ -228,7 +247,7 @@
         switch ( boot_cpu_data.x86_vendor )
         {
         case X86_VENDOR_INTEL:
-            ret = intel_mce_wrmsr(msr, val);
+            ret = intel_mce_wrmsr(v, msr, val);
             break;
         default:
             ret = 0;
@@ -247,9 +266,9 @@
  */
 int vmce_wrmsr(u32 msr, u64 val)
 {
-    struct domain *d = current->domain;
+    struct vcpu *cur = current;
     struct bank_entry *entry = NULL;
-    struct domain_mca_msrs *vmce = dom_vmce(d);
+    struct domain_mca_msrs *vmce = dom_vmce(cur->domain);
     int ret = 1;
 
     if ( !g_mcg_cap )
@@ -266,7 +285,7 @@
         vmce->mcg_status = val;
         mce_printk(MCE_VERBOSE, "MCE: wrmsr MCG_STATUS %"PRIx64"\n", val);
         /* For HVM guest, this is the point for deleting vMCE injection node */
-        if ( d->is_hvm && (vmce->nr_injection > 0) )
+        if ( is_hvm_vcpu(cur) && (vmce->nr_injection > 0) )
         {
             vmce->nr_injection--; /* Should be 0 */
             if ( !list_empty(&vmce->impact_header) )
@@ -293,7 +312,7 @@
         ret = -1;
         break;
     default:
-        ret = mce_bank_msr(msr) ? bank_mce_wrmsr(d, msr, val) : 0;
+        ret = mce_bank_msr(cur, msr) ? bank_mce_wrmsr(cur, msr, val) : 0;
         break;
     }
 
@@ -301,6 +320,46 @@
     return ret;
 }
 
+static int vmce_save_vcpu_ctxt(struct domain *d, hvm_domain_context_t *h)
+{
+    struct vcpu *v;
+    int err = 0;
+
+    for_each_vcpu( d, v ) {
+        struct hvm_vmce_vcpu ctxt = {
+            .caps = v->arch.mcg_cap
+        };
+
+        err = hvm_save_entry(VMCE_VCPU, v->vcpu_id, h, &ctxt);
+        if ( err )
+            break;
+    }
+
+    return err;
+}
+
+static int vmce_load_vcpu_ctxt(struct domain *d, hvm_domain_context_t *h)
+{
+    unsigned int vcpuid = hvm_load_instance(h);
+    struct vcpu *v;
+    struct hvm_vmce_vcpu ctxt;
+    int err;
+
+    if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
+    {
+        dprintk(XENLOG_G_ERR, "HVM restore: dom%d has no vcpu%u\n",
+                d->domain_id, vcpuid);
+        err = -EINVAL;
+    }
+    else
+        err = hvm_load_entry(VMCE_VCPU, h, &ctxt);
+
+    return err ?: vmce_restore_vcpu(v, ctxt.caps);
+}
+
+HVM_REGISTER_SAVE_RESTORE(VMCE_VCPU, vmce_save_vcpu_ctxt,
+                          vmce_load_vcpu_ctxt, 1, HVMSR_PER_VCPU);
+
 int inject_vmce(struct domain *d)
 {
     int cpu = smp_processor_id();
diff -r e80b0bb4470b -r 35d855e52003 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c	Fri Feb 24 09:03:43 2012 +0100
+++ b/xen/arch/x86/domain.c	Fri Feb 24 09:07:54 2012 +0100
@@ -422,6 +422,8 @@
     if ( (rc = vcpu_init_fpu(v)) != 0 )
         return rc;
 
+    vmce_init_vcpu(v);
+
     if ( is_hvm_domain(d) )
     {
         rc = hvm_vcpu_initialise(v);
diff -r e80b0bb4470b -r 35d855e52003 xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c	Fri Feb 24 09:03:43 2012 +0100
+++ b/xen/arch/x86/domctl.c	Fri Feb 24 09:07:54 2012 +0100
@@ -1029,11 +1029,12 @@
                 evc->syscall32_callback_eip    = 0;
                 evc->syscall32_disables_events = 0;
             }
+            evc->mcg_cap = v->arch.mcg_cap;
         }
         else
         {
             ret = -EINVAL;
-            if ( evc->size != sizeof(*evc) )
+            if ( evc->size < offsetof(typeof(*evc), mcg_cap) )
                 goto ext_vcpucontext_out;
 #ifdef __x86_64__
             if ( !is_hvm_domain(d) )
@@ -1061,6 +1062,10 @@
                  (evc->syscall32_callback_cs & ~3) ||
                  evc->syscall32_callback_eip )
                 goto ext_vcpucontext_out;
+
+            if ( evc->size >= offsetof(typeof(*evc), mcg_cap) +
+                              sizeof(evc->mcg_cap) )
+                ret = vmce_restore_vcpu(v, evc->mcg_cap);
         }
 
         ret = 0;
diff -r e80b0bb4470b -r 35d855e52003 xen/include/asm-x86/domain.h
--- a/xen/include/asm-x86/domain.h	Fri Feb 24 09:03:43 2012 +0100
+++ b/xen/include/asm-x86/domain.h	Fri Feb 24 09:07:54 2012 +0100
@@ -488,6 +488,8 @@
     /* This variable determines whether nonlazy extended state has been used,
      * and thus should be saved/restored. */
     bool_t nonlazy_xstate_used;
+
+    uint64_t mcg_cap;
     
     struct paging_vcpu paging;
 
diff -r e80b0bb4470b -r 35d855e52003 xen/include/asm-x86/mce.h
--- a/xen/include/asm-x86/mce.h	Fri Feb 24 09:03:43 2012 +0100
+++ b/xen/include/asm-x86/mce.h	Fri Feb 24 09:07:54 2012 +0100
@@ -16,7 +16,6 @@
 struct domain_mca_msrs
 {
     /* Guest should not change below values after DOM boot up */
-    uint64_t mcg_cap;
     uint64_t mcg_ctl;
     uint64_t mcg_status;
     uint64_t *mci_ctl;
@@ -28,6 +27,8 @@
 /* Guest vMCE MSRs virtualization */
 extern int vmce_init_msr(struct domain *d);
 extern void vmce_destroy_msr(struct domain *d);
+extern void vmce_init_vcpu(struct vcpu *);
+extern int vmce_restore_vcpu(struct vcpu *, uint64_t caps);
 extern int vmce_wrmsr(uint32_t msr, uint64_t val);
 extern int vmce_rdmsr(uint32_t msr, uint64_t *val);
 
diff -r e80b0bb4470b -r 35d855e52003 xen/include/public/arch-x86/hvm/save.h
--- a/xen/include/public/arch-x86/hvm/save.h	Fri Feb 24 09:03:43 2012 +0100
+++ b/xen/include/public/arch-x86/hvm/save.h	Fri Feb 24 09:07:54 2012 +0100
@@ -575,9 +575,15 @@
 
 DECLARE_HVM_SAVE_TYPE(VIRIDIAN_VCPU, 17, struct hvm_viridian_vcpu_context);
 
+struct hvm_vmce_vcpu {
+    uint64_t caps;
+};
+
+DECLARE_HVM_SAVE_TYPE(VMCE_VCPU, 18, struct hvm_vmce_vcpu);
+
 /* 
  * Largest type-code in use
  */
-#define HVM_SAVE_CODE_MAX 17
+#define HVM_SAVE_CODE_MAX 18
 
 #endif /* __XEN_PUBLIC_HVM_SAVE_X86_H__ */
diff -r e80b0bb4470b -r 35d855e52003 xen/include/public/domctl.h
--- a/xen/include/public/domctl.h	Fri Feb 24 09:03:43 2012 +0100
+++ b/xen/include/public/domctl.h	Fri Feb 24 09:07:54 2012 +0100
@@ -559,7 +559,7 @@
     uint32_t         vcpu;
     /*
      * SET: Size of struct (IN)
-     * GET: Size of struct (OUT)
+     * GET: Size of struct (OUT, up to 128 bytes)
      */
     uint32_t         size;
 #if defined(__i386__) || defined(__x86_64__)
@@ -571,6 +571,7 @@
     uint16_t         sysenter_callback_cs;
     uint8_t          syscall32_disables_events;
     uint8_t          sysenter_disables_events;
+    uint64_aligned_t mcg_cap;
 #endif
 };
 typedef struct xen_domctl_ext_vcpucontext xen_domctl_ext_vcpucontext_t;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnR-0002IN-12; Tue, 28 Feb 2012 06:44:25 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnP-0002Ak-LQ
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-216.messagelabs.com!1330411456!17198525!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32337 invoked from network); 28 Feb 2012 06:44:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnI-0004Fg-4N
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnH-0007LP-WB
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:16 +0000
Message-Id: <E1S2GnH-0007LP-WB@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mem_event: remove type member
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329772180 -3600
# Node ID 626fa29dc04d7ed77ae16cfee8a767ff6bb819ad
# Parent  adcd6ab160fae996d53c6843da0c5728ca8a8bd3
mem_event: remove type member

When mem_event was added the type flag should indicate who the consumer
is. But the concept of a single ring buffer for multiple event types can
not work for two reasons. One is that no multiplexer exists which
provides individual event types to the final consumer, and second is
that even if such multiplexer can not work reliable because a request
needs to be answered with a response. The response should be sent
roughly in the order of received events. But with multiple consumers one
of them can so stall all the others.

For that reason the single mem_event buffer for all types of events was
split into individual ring buffers with commit 23842:483c5f8319ad. This
commit made the type member already obsolete because the meaning of each
buffer is now obvious.

This change removes the type member and increases the flags field.

Even though this is an ABI incompatible change, it will have no practical
impact on existing binaries because the changeset referenced above already
bumped the SONAME. So these binaries have to be recompiled anyway for the
upcoming major release.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r adcd6ab160fa -r 626fa29dc04d xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Thu Feb 23 10:29:27 2012 +0000
+++ b/xen/arch/x86/hvm/hvm.c	Mon Feb 20 22:09:40 2012 +0100
@@ -4322,7 +4322,6 @@
         return rc;
 
     memset(&req, 0, sizeof(req));
-    req.type = MEM_EVENT_TYPE_ACCESS;
     req.reason = reason;
 
     if ( (p & HVMPME_MODE_MASK) == HVMPME_mode_sync ) 
diff -r adcd6ab160fa -r 626fa29dc04d xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Thu Feb 23 10:29:27 2012 +0000
+++ b/xen/arch/x86/mm/mem_sharing.c	Mon Feb 20 22:09:40 2012 +0100
@@ -347,7 +347,7 @@
 static void mem_sharing_notify_helper(struct domain *d, unsigned long gfn)
 {
     struct vcpu *v = current;
-    mem_event_request_t req = { .type = MEM_EVENT_TYPE_SHARED };
+    mem_event_request_t req = { .gfn = gfn };
 
     if ( v->domain != d )
     {
@@ -369,7 +369,6 @@
     req.flags = MEM_EVENT_FLAG_VCPU_PAUSED;
     vcpu_pause_nosync(v);
 
-    req.gfn = gfn;
     req.p2mt = p2m_ram_shared;
     req.vcpu_id = v->vcpu_id;
     mem_event_put_request(d, &d->mem_event->share, &req);
diff -r adcd6ab160fa -r 626fa29dc04d xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Thu Feb 23 10:29:27 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Mon Feb 20 22:09:40 2012 +0100
@@ -925,7 +925,6 @@
 
     /* Send release notification to pager */
     memset(&req, 0, sizeof(req));
-    req.type = MEM_EVENT_TYPE_PAGING;
     req.gfn = gfn;
     req.flags = MEM_EVENT_FLAG_DROP_PAGE;
 
@@ -982,7 +981,6 @@
         return;
 
     memset(&req, 0, sizeof(req));
-    req.type = MEM_EVENT_TYPE_PAGING;
 
     /* Fix p2m mapping */
     gfn_lock(p2m, gfn, 0);
@@ -1221,7 +1219,6 @@
     {
         *req_ptr = req;
         memset(req, 0, sizeof(req));
-        req->type = MEM_EVENT_TYPE_ACCESS;
         req->reason = MEM_EVENT_REASON_VIOLATION;
 
         /* Pause the current VCPU */
diff -r adcd6ab160fa -r 626fa29dc04d xen/include/public/mem_event.h
--- a/xen/include/public/mem_event.h	Thu Feb 23 10:29:27 2012 +0000
+++ b/xen/include/public/mem_event.h	Mon Feb 20 22:09:40 2012 +0100
@@ -30,11 +30,6 @@
 #include "xen.h"
 #include "io/ring.h"
 
-/* Memory event type */
-#define MEM_EVENT_TYPE_SHARED   0
-#define MEM_EVENT_TYPE_PAGING   1
-#define MEM_EVENT_TYPE_ACCESS   2
-
 /* Memory event flags */
 #define MEM_EVENT_FLAG_VCPU_PAUSED  (1 << 0)
 #define MEM_EVENT_FLAG_DROP_PAGE    (1 << 1)
@@ -56,8 +51,7 @@
 } mem_event_shared_page_t;
 
 typedef struct mem_event_st {
-    uint16_t type;
-    uint16_t flags;
+    uint32_t flags;
     uint32_t vcpu_id;
 
     uint64_t gfn;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnR-0002IN-12; Tue, 28 Feb 2012 06:44:25 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnP-0002Ak-LQ
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-216.messagelabs.com!1330411456!17198525!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32337 invoked from network); 28 Feb 2012 06:44:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnI-0004Fg-4N
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnH-0007LP-WB
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:16 +0000
Message-Id: <E1S2GnH-0007LP-WB@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mem_event: remove type member
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329772180 -3600
# Node ID 626fa29dc04d7ed77ae16cfee8a767ff6bb819ad
# Parent  adcd6ab160fae996d53c6843da0c5728ca8a8bd3
mem_event: remove type member

When mem_event was added the type flag should indicate who the consumer
is. But the concept of a single ring buffer for multiple event types can
not work for two reasons. One is that no multiplexer exists which
provides individual event types to the final consumer, and second is
that even if such multiplexer can not work reliable because a request
needs to be answered with a response. The response should be sent
roughly in the order of received events. But with multiple consumers one
of them can so stall all the others.

For that reason the single mem_event buffer for all types of events was
split into individual ring buffers with commit 23842:483c5f8319ad. This
commit made the type member already obsolete because the meaning of each
buffer is now obvious.

This change removes the type member and increases the flags field.

Even though this is an ABI incompatible change, it will have no practical
impact on existing binaries because the changeset referenced above already
bumped the SONAME. So these binaries have to be recompiled anyway for the
upcoming major release.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r adcd6ab160fa -r 626fa29dc04d xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Thu Feb 23 10:29:27 2012 +0000
+++ b/xen/arch/x86/hvm/hvm.c	Mon Feb 20 22:09:40 2012 +0100
@@ -4322,7 +4322,6 @@
         return rc;
 
     memset(&req, 0, sizeof(req));
-    req.type = MEM_EVENT_TYPE_ACCESS;
     req.reason = reason;
 
     if ( (p & HVMPME_MODE_MASK) == HVMPME_mode_sync ) 
diff -r adcd6ab160fa -r 626fa29dc04d xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Thu Feb 23 10:29:27 2012 +0000
+++ b/xen/arch/x86/mm/mem_sharing.c	Mon Feb 20 22:09:40 2012 +0100
@@ -347,7 +347,7 @@
 static void mem_sharing_notify_helper(struct domain *d, unsigned long gfn)
 {
     struct vcpu *v = current;
-    mem_event_request_t req = { .type = MEM_EVENT_TYPE_SHARED };
+    mem_event_request_t req = { .gfn = gfn };
 
     if ( v->domain != d )
     {
@@ -369,7 +369,6 @@
     req.flags = MEM_EVENT_FLAG_VCPU_PAUSED;
     vcpu_pause_nosync(v);
 
-    req.gfn = gfn;
     req.p2mt = p2m_ram_shared;
     req.vcpu_id = v->vcpu_id;
     mem_event_put_request(d, &d->mem_event->share, &req);
diff -r adcd6ab160fa -r 626fa29dc04d xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Thu Feb 23 10:29:27 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Mon Feb 20 22:09:40 2012 +0100
@@ -925,7 +925,6 @@
 
     /* Send release notification to pager */
     memset(&req, 0, sizeof(req));
-    req.type = MEM_EVENT_TYPE_PAGING;
     req.gfn = gfn;
     req.flags = MEM_EVENT_FLAG_DROP_PAGE;
 
@@ -982,7 +981,6 @@
         return;
 
     memset(&req, 0, sizeof(req));
-    req.type = MEM_EVENT_TYPE_PAGING;
 
     /* Fix p2m mapping */
     gfn_lock(p2m, gfn, 0);
@@ -1221,7 +1219,6 @@
     {
         *req_ptr = req;
         memset(req, 0, sizeof(req));
-        req->type = MEM_EVENT_TYPE_ACCESS;
         req->reason = MEM_EVENT_REASON_VIOLATION;
 
         /* Pause the current VCPU */
diff -r adcd6ab160fa -r 626fa29dc04d xen/include/public/mem_event.h
--- a/xen/include/public/mem_event.h	Thu Feb 23 10:29:27 2012 +0000
+++ b/xen/include/public/mem_event.h	Mon Feb 20 22:09:40 2012 +0100
@@ -30,11 +30,6 @@
 #include "xen.h"
 #include "io/ring.h"
 
-/* Memory event type */
-#define MEM_EVENT_TYPE_SHARED   0
-#define MEM_EVENT_TYPE_PAGING   1
-#define MEM_EVENT_TYPE_ACCESS   2
-
 /* Memory event flags */
 #define MEM_EVENT_FLAG_VCPU_PAUSED  (1 << 0)
 #define MEM_EVENT_FLAG_DROP_PAGE    (1 << 1)
@@ -56,8 +51,7 @@
 } mem_event_shared_page_t;
 
 typedef struct mem_event_st {
-    uint16_t type;
-    uint16_t flags;
+    uint32_t flags;
     uint32_t vcpu_id;
 
     uint64_t gfn;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnS-0002K4-48; Tue, 28 Feb 2012 06:44:26 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnP-0002B1-V3
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:24 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1330411454!16674740!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18822 invoked from network); 28 Feb 2012 06:44:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnG-0004FU-3r
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnF-0007Jv-SN
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:13 +0000
Message-Id: <E1S2GnF-0007Jv-SN@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] scheduler: Implement SCHEDOP sysctl
	for credit scheduler
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1329992241 0
# Node ID dd9e8f1ebed1100fad2c01ff977ab66ff96d90b2
# Parent  c4bddb3422ddadbc34f2925ce438ef2dcfc07f52
scheduler: Implement SCHEDOP sysctl for credit scheduler

Allow tslice_ms and ratelimit_us to be modified.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r c4bddb3422dd -r dd9e8f1ebed1 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c	Thu Feb 23 10:16:10 2012 +0000
+++ b/xen/common/sched_credit.c	Thu Feb 23 10:17:21 2012 +0000
@@ -833,6 +833,36 @@
     return 0;
 }
 
+static int
+csched_sys_cntl(const struct scheduler *ops,
+                        struct xen_sysctl_scheduler_op *sc)
+{
+    int rc = -EINVAL;
+    xen_sysctl_credit_schedule_t *params = &sc->u.sched_credit;
+    struct csched_private *prv = CSCHED_PRIV(ops);
+
+    switch ( sc->cmd )
+    {
+    case XEN_SYSCTL_SCHEDOP_putinfo:
+        if (params->tslice_ms > XEN_SYSCTL_CSCHED_TSLICE_MAX
+            || params->tslice_ms < XEN_SYSCTL_CSCHED_TSLICE_MIN 
+            || params->ratelimit_us > XEN_SYSCTL_SCHED_RATELIMIT_MAX
+            || params->ratelimit_us < XEN_SYSCTL_SCHED_RATELIMIT_MIN 
+            || MICROSECS(params->ratelimit_us) > MILLISECS(params->tslice_ms) )
+                goto out;
+        prv->tslice_ms = params->tslice_ms;
+        prv->ratelimit_us = params->ratelimit_us;
+        /* FALLTHRU */
+    case XEN_SYSCTL_SCHEDOP_getinfo:
+        params->tslice_ms = prv->tslice_ms;
+        params->ratelimit_us = prv->ratelimit_us;
+        rc = 0;
+        break;
+    }
+    out:
+    return rc;
+}
+
 static void *
 csched_alloc_domdata(const struct scheduler *ops, struct domain *dom)
 {
@@ -1566,6 +1596,28 @@
     INIT_LIST_HEAD(&prv->active_sdom);
     prv->master = UINT_MAX;
 
+    if ( sched_credit_tslice_ms > XEN_SYSCTL_CSCHED_TSLICE_MAX
+         || sched_credit_tslice_ms < XEN_SYSCTL_CSCHED_TSLICE_MIN )
+    {
+        printk("WARNING: sched_credit_tslice_ms outside of valid range [%d,%d].\n"
+               " Resetting to default %u\n",
+               XEN_SYSCTL_CSCHED_TSLICE_MIN,
+               XEN_SYSCTL_CSCHED_TSLICE_MAX,
+               CSCHED_DEFAULT_TSLICE_MS);
+        sched_credit_tslice_ms = CSCHED_DEFAULT_TSLICE_MS;
+    }
+
+    if ( sched_ratelimit_us > XEN_SYSCTL_SCHED_RATELIMIT_MAX
+         || sched_ratelimit_us < XEN_SYSCTL_SCHED_RATELIMIT_MIN )
+    {
+        printk("WARNING: sched_ratelimit_us outside of valid range [%d,%d].\n"
+               " Resetting to default %u\n",
+               XEN_SYSCTL_SCHED_RATELIMIT_MIN,
+               XEN_SYSCTL_SCHED_RATELIMIT_MAX,
+               SCHED_DEFAULT_RATELIMIT_US);
+        sched_ratelimit_us = SCHED_DEFAULT_RATELIMIT_US;
+    }
+
     prv->tslice_ms = sched_credit_tslice_ms;
     prv->ticks_per_tslice = CSCHED_TICKS_PER_TSLICE;
     if ( prv->tslice_ms < prv->ticks_per_tslice )
@@ -1641,6 +1693,7 @@
     .yield          = csched_vcpu_yield,
 
     .adjust         = csched_dom_cntl,
+    .adjust_global  = csched_sys_cntl,
 
     .pick_cpu       = csched_cpu_pick,
     .do_schedule    = csched_schedule,
diff -r c4bddb3422dd -r dd9e8f1ebed1 xen/include/public/sysctl.h
--- a/xen/include/public/sysctl.h	Thu Feb 23 10:16:10 2012 +0000
+++ b/xen/include/public/sysctl.h	Thu Feb 23 10:17:21 2012 +0000
@@ -564,6 +564,19 @@
 typedef struct xen_sysctl_arinc653_schedule xen_sysctl_arinc653_schedule_t;
 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_arinc653_schedule_t);
 
+struct xen_sysctl_credit_schedule {
+    /* Length of timeslice in milliseconds */
+#define XEN_SYSCTL_CSCHED_TSLICE_MAX 1000
+#define XEN_SYSCTL_CSCHED_TSLICE_MIN 1
+    unsigned tslice_ms;
+    /* Rate limit (minimum timeslice) in microseconds */
+#define XEN_SYSCTL_SCHED_RATELIMIT_MAX 500000
+#define XEN_SYSCTL_SCHED_RATELIMIT_MIN 100
+    unsigned ratelimit_us;
+};
+typedef struct xen_sysctl_credit_schedule xen_sysctl_credit_schedule_t;
+DEFINE_XEN_GUEST_HANDLE(xen_sysctl_credit_schedule_t);
+
 /* XEN_SYSCTL_scheduler_op */
 /* Set or get info? */
 #define XEN_SYSCTL_SCHEDOP_putinfo 0
@@ -576,6 +589,7 @@
         struct xen_sysctl_sched_arinc653 {
             XEN_GUEST_HANDLE_64(xen_sysctl_arinc653_schedule_t) schedule;
         } sched_arinc653;
+        struct xen_sysctl_credit_schedule sched_credit;
     } u;
 };
 typedef struct xen_sysctl_scheduler_op xen_sysctl_scheduler_op_t;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnS-0002K4-48; Tue, 28 Feb 2012 06:44:26 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnP-0002B1-V3
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:24 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1330411454!16674740!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18822 invoked from network); 28 Feb 2012 06:44:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnG-0004FU-3r
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnF-0007Jv-SN
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:13 +0000
Message-Id: <E1S2GnF-0007Jv-SN@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] scheduler: Implement SCHEDOP sysctl
	for credit scheduler
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1329992241 0
# Node ID dd9e8f1ebed1100fad2c01ff977ab66ff96d90b2
# Parent  c4bddb3422ddadbc34f2925ce438ef2dcfc07f52
scheduler: Implement SCHEDOP sysctl for credit scheduler

Allow tslice_ms and ratelimit_us to be modified.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r c4bddb3422dd -r dd9e8f1ebed1 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c	Thu Feb 23 10:16:10 2012 +0000
+++ b/xen/common/sched_credit.c	Thu Feb 23 10:17:21 2012 +0000
@@ -833,6 +833,36 @@
     return 0;
 }
 
+static int
+csched_sys_cntl(const struct scheduler *ops,
+                        struct xen_sysctl_scheduler_op *sc)
+{
+    int rc = -EINVAL;
+    xen_sysctl_credit_schedule_t *params = &sc->u.sched_credit;
+    struct csched_private *prv = CSCHED_PRIV(ops);
+
+    switch ( sc->cmd )
+    {
+    case XEN_SYSCTL_SCHEDOP_putinfo:
+        if (params->tslice_ms > XEN_SYSCTL_CSCHED_TSLICE_MAX
+            || params->tslice_ms < XEN_SYSCTL_CSCHED_TSLICE_MIN 
+            || params->ratelimit_us > XEN_SYSCTL_SCHED_RATELIMIT_MAX
+            || params->ratelimit_us < XEN_SYSCTL_SCHED_RATELIMIT_MIN 
+            || MICROSECS(params->ratelimit_us) > MILLISECS(params->tslice_ms) )
+                goto out;
+        prv->tslice_ms = params->tslice_ms;
+        prv->ratelimit_us = params->ratelimit_us;
+        /* FALLTHRU */
+    case XEN_SYSCTL_SCHEDOP_getinfo:
+        params->tslice_ms = prv->tslice_ms;
+        params->ratelimit_us = prv->ratelimit_us;
+        rc = 0;
+        break;
+    }
+    out:
+    return rc;
+}
+
 static void *
 csched_alloc_domdata(const struct scheduler *ops, struct domain *dom)
 {
@@ -1566,6 +1596,28 @@
     INIT_LIST_HEAD(&prv->active_sdom);
     prv->master = UINT_MAX;
 
+    if ( sched_credit_tslice_ms > XEN_SYSCTL_CSCHED_TSLICE_MAX
+         || sched_credit_tslice_ms < XEN_SYSCTL_CSCHED_TSLICE_MIN )
+    {
+        printk("WARNING: sched_credit_tslice_ms outside of valid range [%d,%d].\n"
+               " Resetting to default %u\n",
+               XEN_SYSCTL_CSCHED_TSLICE_MIN,
+               XEN_SYSCTL_CSCHED_TSLICE_MAX,
+               CSCHED_DEFAULT_TSLICE_MS);
+        sched_credit_tslice_ms = CSCHED_DEFAULT_TSLICE_MS;
+    }
+
+    if ( sched_ratelimit_us > XEN_SYSCTL_SCHED_RATELIMIT_MAX
+         || sched_ratelimit_us < XEN_SYSCTL_SCHED_RATELIMIT_MIN )
+    {
+        printk("WARNING: sched_ratelimit_us outside of valid range [%d,%d].\n"
+               " Resetting to default %u\n",
+               XEN_SYSCTL_SCHED_RATELIMIT_MIN,
+               XEN_SYSCTL_SCHED_RATELIMIT_MAX,
+               SCHED_DEFAULT_RATELIMIT_US);
+        sched_ratelimit_us = SCHED_DEFAULT_RATELIMIT_US;
+    }
+
     prv->tslice_ms = sched_credit_tslice_ms;
     prv->ticks_per_tslice = CSCHED_TICKS_PER_TSLICE;
     if ( prv->tslice_ms < prv->ticks_per_tslice )
@@ -1641,6 +1693,7 @@
     .yield          = csched_vcpu_yield,
 
     .adjust         = csched_dom_cntl,
+    .adjust_global  = csched_sys_cntl,
 
     .pick_cpu       = csched_cpu_pick,
     .do_schedule    = csched_schedule,
diff -r c4bddb3422dd -r dd9e8f1ebed1 xen/include/public/sysctl.h
--- a/xen/include/public/sysctl.h	Thu Feb 23 10:16:10 2012 +0000
+++ b/xen/include/public/sysctl.h	Thu Feb 23 10:17:21 2012 +0000
@@ -564,6 +564,19 @@
 typedef struct xen_sysctl_arinc653_schedule xen_sysctl_arinc653_schedule_t;
 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_arinc653_schedule_t);
 
+struct xen_sysctl_credit_schedule {
+    /* Length of timeslice in milliseconds */
+#define XEN_SYSCTL_CSCHED_TSLICE_MAX 1000
+#define XEN_SYSCTL_CSCHED_TSLICE_MIN 1
+    unsigned tslice_ms;
+    /* Rate limit (minimum timeslice) in microseconds */
+#define XEN_SYSCTL_SCHED_RATELIMIT_MAX 500000
+#define XEN_SYSCTL_SCHED_RATELIMIT_MIN 100
+    unsigned ratelimit_us;
+};
+typedef struct xen_sysctl_credit_schedule xen_sysctl_credit_schedule_t;
+DEFINE_XEN_GUEST_HANDLE(xen_sysctl_credit_schedule_t);
+
 /* XEN_SYSCTL_scheduler_op */
 /* Set or get info? */
 #define XEN_SYSCTL_SCHEDOP_putinfo 0
@@ -576,6 +589,7 @@
         struct xen_sysctl_sched_arinc653 {
             XEN_GUEST_HANDLE_64(xen_sysctl_arinc653_schedule_t) schedule;
         } sched_arinc653;
+        struct xen_sysctl_credit_schedule sched_credit;
     } u;
 };
 typedef struct xen_sysctl_scheduler_op xen_sysctl_scheduler_op_t;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnT-0002Lf-Cs; Tue, 28 Feb 2012 06:44:27 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnR-0002By-Je
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1330411458!16428926!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3913 invoked from network); 28 Feb 2012 06:44:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnK-0004Fs-8X
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnK-0007Mw-7H
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:18 +0000
Message-Id: <E1S2GnK-0007Mw-7H@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] passthrough: release assigned PCI
	devices earlier during domain shutdown
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1330080392 -3600
# Node ID 71159fb049f253030c3820c260d092d4aec6b166
# Parent  35d855e520038bf5814f53d105dc4adf58a670f2
passthrough: release assigned PCI devices earlier during domain shutdown

At least with xend, where there's not even a tool stack side attempt to
de-assign devices during domain shutdown, this allows immediate re-
starts of a domain to work reliably. (There's no apparent reason why
c/s 18010:c1577f094ae4 chose to put this in the asynchronous part of
domain destruction).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 35d855e52003 -r 71159fb049f2 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c	Fri Feb 24 09:07:54 2012 +0100
+++ b/xen/arch/ia64/xen/domain.c	Fri Feb 24 11:46:32 2012 +0100
@@ -673,10 +673,8 @@
 		free_xenheap_pages(d->shared_info,
 				   get_order_from_shift(XSI_SHIFT));
 
-	if ( iommu_enabled && need_iommu(d) )	{
-		pci_release_devices(d);
+	if ( iommu_enabled && need_iommu(d) )
 		iommu_domain_destroy(d);
-	}
 
 	tlb_track_destroy(d);
 
@@ -1721,6 +1719,8 @@
 
 	switch (d->arch.relres) {
 	case RELRES_not_started:
+		pci_release_devices(d);
+
 		/* Relinquish guest resources for VT-i domain. */
 		if (is_hvm_domain(d))
 			vmx_relinquish_guest_resources(d);
diff -r 35d855e52003 -r 71159fb049f2 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c	Fri Feb 24 09:07:54 2012 +0100
+++ b/xen/arch/x86/domain.c	Fri Feb 24 11:46:32 2012 +0100
@@ -657,7 +657,6 @@
         xfree(d->arch.pv_domain.e820);
 
     vmce_destroy_msr(d);
-    pci_release_devices(d);
     free_domain_pirqs(d);
     if ( !is_idle_domain(d) )
         iommu_domain_destroy(d);
@@ -2101,6 +2100,8 @@
     switch ( d->arch.relmem )
     {
     case RELMEM_not_started:
+        pci_release_devices(d);
+
         /* Tear down paging-assistance stuff. */
         paging_teardown(d);
 
diff -r 35d855e52003 -r 71159fb049f2 xen/drivers/passthrough/iommu.c
--- a/xen/drivers/passthrough/iommu.c	Fri Feb 24 09:07:54 2012 +0100
+++ b/xen/drivers/passthrough/iommu.c	Fri Feb 24 11:46:32 2012 +0100
@@ -574,7 +574,8 @@
         break;
 
     case XEN_DOMCTL_assign_device:
-        if ( unlikely((d = get_domain_by_id(domctl->domain)) == NULL) )
+        if ( unlikely((d = get_domain_by_id(domctl->domain)) == NULL) ||
+             unlikely(d->is_dying) )
         {
             printk(XENLOG_G_ERR
                    "XEN_DOMCTL_assign_device: get_domain_by_id() failed\n");

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnT-0002Lf-Cs; Tue, 28 Feb 2012 06:44:27 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnR-0002By-Je
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1330411458!16428926!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3913 invoked from network); 28 Feb 2012 06:44:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnK-0004Fs-8X
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnK-0007Mw-7H
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:18 +0000
Message-Id: <E1S2GnK-0007Mw-7H@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] passthrough: release assigned PCI
	devices earlier during domain shutdown
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1330080392 -3600
# Node ID 71159fb049f253030c3820c260d092d4aec6b166
# Parent  35d855e520038bf5814f53d105dc4adf58a670f2
passthrough: release assigned PCI devices earlier during domain shutdown

At least with xend, where there's not even a tool stack side attempt to
de-assign devices during domain shutdown, this allows immediate re-
starts of a domain to work reliably. (There's no apparent reason why
c/s 18010:c1577f094ae4 chose to put this in the asynchronous part of
domain destruction).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 35d855e52003 -r 71159fb049f2 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c	Fri Feb 24 09:07:54 2012 +0100
+++ b/xen/arch/ia64/xen/domain.c	Fri Feb 24 11:46:32 2012 +0100
@@ -673,10 +673,8 @@
 		free_xenheap_pages(d->shared_info,
 				   get_order_from_shift(XSI_SHIFT));
 
-	if ( iommu_enabled && need_iommu(d) )	{
-		pci_release_devices(d);
+	if ( iommu_enabled && need_iommu(d) )
 		iommu_domain_destroy(d);
-	}
 
 	tlb_track_destroy(d);
 
@@ -1721,6 +1719,8 @@
 
 	switch (d->arch.relres) {
 	case RELRES_not_started:
+		pci_release_devices(d);
+
 		/* Relinquish guest resources for VT-i domain. */
 		if (is_hvm_domain(d))
 			vmx_relinquish_guest_resources(d);
diff -r 35d855e52003 -r 71159fb049f2 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c	Fri Feb 24 09:07:54 2012 +0100
+++ b/xen/arch/x86/domain.c	Fri Feb 24 11:46:32 2012 +0100
@@ -657,7 +657,6 @@
         xfree(d->arch.pv_domain.e820);
 
     vmce_destroy_msr(d);
-    pci_release_devices(d);
     free_domain_pirqs(d);
     if ( !is_idle_domain(d) )
         iommu_domain_destroy(d);
@@ -2101,6 +2100,8 @@
     switch ( d->arch.relmem )
     {
     case RELMEM_not_started:
+        pci_release_devices(d);
+
         /* Tear down paging-assistance stuff. */
         paging_teardown(d);
 
diff -r 35d855e52003 -r 71159fb049f2 xen/drivers/passthrough/iommu.c
--- a/xen/drivers/passthrough/iommu.c	Fri Feb 24 09:07:54 2012 +0100
+++ b/xen/drivers/passthrough/iommu.c	Fri Feb 24 11:46:32 2012 +0100
@@ -574,7 +574,8 @@
         break;
 
     case XEN_DOMCTL_assign_device:
-        if ( unlikely((d = get_domain_by_id(domctl->domain)) == NULL) )
+        if ( unlikely((d = get_domain_by_id(domctl->domain)) == NULL) ||
+             unlikely(d->is_dying) )
         {
             printk(XENLOG_G_ERR
                    "XEN_DOMCTL_assign_device: get_domain_by_id() failed\n");

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnT-0002LR-9r; Tue, 28 Feb 2012 06:44:27 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnR-0002Bs-BE
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-21.messagelabs.com!1330411457!8399773!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5226 invoked from network); 28 Feb 2012 06:44:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnJ-0004Fm-5T
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnJ-0007MA-1x
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:17 +0000
Message-Id: <E1S2GnJ-0007MA-1x@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/vMCE: don't advertise features
	we don't support
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1330070623 -3600
# Node ID e80b0bb4470b944a5b52a91c0ec85a1d65d18c55
# Parent  0c3d19f40ab145d101de84051c3e00eef17fa1cb
x86/vMCE: don't advertise features we don't support

... or even know of. Apart from CMCI, which was masked off already,
this now also suppresses the advertising of extended state registers
(reading of which would likely be meaningless in a guest and represent
an information leak).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 0c3d19f40ab1 -r e80b0bb4470b xen/arch/x86/cpu/mcheck/vmce.c
--- a/xen/arch/x86/cpu/mcheck/vmce.c	Mon Feb 20 22:16:32 2012 +0100
+++ b/xen/arch/x86/cpu/mcheck/vmce.c	Fri Feb 24 09:03:43 2012 +0100
@@ -457,7 +457,7 @@
 
     rdmsrl(MSR_IA32_MCG_CAP, value);
     /* For Guest vMCE usage */
-    g_mcg_cap = value & ~MCG_CMCI_P;
+    g_mcg_cap = value & (MCG_CAP_COUNT | MCG_CTL_P | MCG_TES_P | MCG_SER_P);
     if (value & MCG_CTL_P)
         rdmsrl(MSR_IA32_MCG_CTL, h_mcg_ctl);
 
diff -r 0c3d19f40ab1 -r e80b0bb4470b xen/arch/x86/cpu/mcheck/x86_mca.h
--- a/xen/arch/x86/cpu/mcheck/x86_mca.h	Mon Feb 20 22:16:32 2012 +0100
+++ b/xen/arch/x86/cpu/mcheck/x86_mca.h	Fri Feb 24 09:03:43 2012 +0100
@@ -30,12 +30,13 @@
 
 
 /* Bitfield of the MSR_IA32_MCG_CAP register */
-#define MCG_SER_P               (1UL<<24)
 #define MCG_CAP_COUNT           0x00000000000000ffULL
-#define MCG_CTL_P               0x0000000000000100ULL
-#define MCG_EXT_P		(1UL<<9)
-#define MCG_EXT_CNT		(16)
-#define MCG_CMCI_P		(1UL<<10)
+#define MCG_CTL_P               (1ULL<<8)
+#define MCG_EXT_P               (1ULL<<9)
+#define MCG_CMCI_P              (1ULL<<10)
+#define MCG_TES_P               (1ULL<<11)
+#define MCG_EXT_CNT             16
+#define MCG_SER_P               (1ULL<<24)
 /* Other bits are reserved */
 
 /* Bitfield of the MSR_IA32_MCG_STATUS register */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnT-0002LR-9r; Tue, 28 Feb 2012 06:44:27 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnR-0002Bs-BE
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-21.messagelabs.com!1330411457!8399773!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5226 invoked from network); 28 Feb 2012 06:44:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnJ-0004Fm-5T
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnJ-0007MA-1x
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:17 +0000
Message-Id: <E1S2GnJ-0007MA-1x@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/vMCE: don't advertise features
	we don't support
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1330070623 -3600
# Node ID e80b0bb4470b944a5b52a91c0ec85a1d65d18c55
# Parent  0c3d19f40ab145d101de84051c3e00eef17fa1cb
x86/vMCE: don't advertise features we don't support

... or even know of. Apart from CMCI, which was masked off already,
this now also suppresses the advertising of extended state registers
(reading of which would likely be meaningless in a guest and represent
an information leak).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 0c3d19f40ab1 -r e80b0bb4470b xen/arch/x86/cpu/mcheck/vmce.c
--- a/xen/arch/x86/cpu/mcheck/vmce.c	Mon Feb 20 22:16:32 2012 +0100
+++ b/xen/arch/x86/cpu/mcheck/vmce.c	Fri Feb 24 09:03:43 2012 +0100
@@ -457,7 +457,7 @@
 
     rdmsrl(MSR_IA32_MCG_CAP, value);
     /* For Guest vMCE usage */
-    g_mcg_cap = value & ~MCG_CMCI_P;
+    g_mcg_cap = value & (MCG_CAP_COUNT | MCG_CTL_P | MCG_TES_P | MCG_SER_P);
     if (value & MCG_CTL_P)
         rdmsrl(MSR_IA32_MCG_CTL, h_mcg_ctl);
 
diff -r 0c3d19f40ab1 -r e80b0bb4470b xen/arch/x86/cpu/mcheck/x86_mca.h
--- a/xen/arch/x86/cpu/mcheck/x86_mca.h	Mon Feb 20 22:16:32 2012 +0100
+++ b/xen/arch/x86/cpu/mcheck/x86_mca.h	Fri Feb 24 09:03:43 2012 +0100
@@ -30,12 +30,13 @@
 
 
 /* Bitfield of the MSR_IA32_MCG_CAP register */
-#define MCG_SER_P               (1UL<<24)
 #define MCG_CAP_COUNT           0x00000000000000ffULL
-#define MCG_CTL_P               0x0000000000000100ULL
-#define MCG_EXT_P		(1UL<<9)
-#define MCG_EXT_CNT		(16)
-#define MCG_CMCI_P		(1UL<<10)
+#define MCG_CTL_P               (1ULL<<8)
+#define MCG_EXT_P               (1ULL<<9)
+#define MCG_CMCI_P              (1ULL<<10)
+#define MCG_TES_P               (1ULL<<11)
+#define MCG_EXT_CNT             16
+#define MCG_SER_P               (1ULL<<24)
 /* Other bits are reserved */
 
 /* Bitfield of the MSR_IA32_MCG_STATUS register */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnU-0002Nk-Ff; Tue, 28 Feb 2012 06:44:28 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnT-0002Ct-7F
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:27 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-21.messagelabs.com!1330411459!13727833!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8305 invoked from network); 28 Feb 2012 06:44:20 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnK-0004Fv-P9
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnK-0007NI-Nt
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:18 +0000
Message-Id: <E1S2GnK-0007NI-Nt@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Revert 24875:a59c1dcfe968 "blkif.h:
	Define and document the request number/size/segments extension"
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1330344629 0
# Node ID 071beb00303b9afc4027d4150f0991d9ddc8224a
# Parent  71159fb049f253030c3820c260d092d4aec6b166
Revert 24875:a59c1dcfe968 "blkif.h: Define and document the request number/size/segments extension"

Breaks the build.

Signed-off-by: Keir Fraser <keir@xen.org>
---


diff -r 71159fb049f2 -r 071beb00303b xen/include/public/io/blkif.h
--- a/xen/include/public/io/blkif.h	Fri Feb 24 11:46:32 2012 +0100
+++ b/xen/include/public/io/blkif.h	Mon Feb 27 12:10:29 2012 +0000
@@ -145,32 +145,6 @@
  *      The maximum supported size of the request ring buffer in units of
  *      machine pages.  The value must be a power of 2.
  *
- * max-requests         <uint32_t>
- *      Default Value:  BLKIF_MAX_RING_REQUESTS(PAGE_SIZE)
- *      Maximum Value:  BLKIF_MAX_RING_REQUESTS(PAGE_SIZE * max-ring-pages)
- *
- *      The maximum number of concurrent, logical requests that will be
- *      issued by the backend.
- *
- *      Note: A logical request may span multiple ring entries.
- *
- * max-request-segments
- *      Values:         <uint8_t>
- *      Default Value:  BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK
- *      Maximum Value:  BLKIF_MAX_SEGMENTS_PER_REQUEST
- *
- *      The maximum value of blkif_request.nr_segments supported by
- *      the backend.
- *
- * max-request-size
- *      Values:         <uint32_t>
- *      Default Value:  BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK * PAGE_SIZE
- *      Maximum Value:  BLKIF_MAX_SEGMENTS_PER_REQUEST * PAGE_SIZE
- *
- *      The maximum amount of data, in bytes, that can be referenced by a
- *      request type that accesses frontend memory (currently BLKIF_OP_READ,
- *      BLKIF_OP_WRITE, or BLKIF_OP_WRITE_BARRIER).
- *
  *------------------------- Backend Device Properties -------------------------
  *
  * discard-aligment
@@ -268,33 +242,6 @@
  *      The size of the frontend allocated request ring buffer in units of
  *      machine pages.  The value must be a power of 2.
  *
- * max-requests
- *      Values:         <uint32_t>
- *      Default Value:  BLKIF_MAX_RING_REQUESTS(PAGE_SIZE)
- *      Maximum Value:  BLKIF_MAX_RING_REQUESTS(PAGE_SIZE * max-ring-pages)
- *
- *      The maximum number of concurrent, logical requests that will be
- *      issued by the frontend.
- *
- *      Note: A logical request may span multiple ring entries.
- *
- * max-request-segments
- *      Values:         <uint8_t>
- *      Default Value:  BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK
- *      Maximum Value:  MIN(255, backend/max-request-segments)
- *
- *      The maximum value the frontend will set in the
- *      blkif_request.nr_segments field.
- *
- * max-request-size
- *      Values:         <uint32_t>
- *      Default Value:  BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK * PAGE_SIZE
- *      Maximum Value:  max-request-segments * PAGE_SIZE
- *
- *      The maximum amount of data, in bytes, that can be referenced by
- *      a request type that accesses frontend memory (currently BLKIF_OP_READ,
- *      BLKIF_OP_WRITE, or BLKIF_OP_WRITE_BARRIER).
- *
  *------------------------- Virtual Device Properties -------------------------
  *
  * device-type
@@ -456,28 +403,11 @@
 #define BLKIF_OP_DISCARD           5
 
 /*
- * Maximum scatter/gather segments associated with a request header block.
+ * Maximum scatter/gather segments per request.
  * This is carefully chosen so that sizeof(blkif_ring_t) <= PAGE_SIZE.
  * NB. This could be 12 if the ring indexes weren't stored in the same page.
  */
-#define BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK  11
-
-/*
- * Maximum scatter/gather segments associated with a segment block.
- */
-#define BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK 14
-
-#if __XEN_INTERFACE_VERSION__ >= 0x00040201
-/*
- * Maximum scatter/gather segments per request (header + segment blocks).
- */
-#define BLKIF_MAX_SEGMENTS_PER_REQUEST 255
-#else
-/*
- * Maximum scatter/gather segments per request (header block only).
- */
-#define BLKIF_MAX_SEGMENTS_PER_REQUEST BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK
-#endif
+#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11
 
 /*
  * NB. first_sect and last_sect in blkif_request_segment, as well as
@@ -492,25 +422,9 @@
     /* @last_sect: last sector in frame to transfer (inclusive).     */
     uint8_t     first_sect, last_sect;
 };
-typedef struct blkif_request_segment blkif_request_segment_t;
 
 /*
  * Starting ring element for any I/O request.
- *
- * One or more segment blocks can be inserted into the request ring
- * just after a blkif_request_t, allowing requests to operate on
- * up to BLKIF_MAX_SEGMENTS_PER_REQUEST.
- *
- * BLKIF_SEGS_TO_BLOCKS() can be used on blkif_requst.nr_segments
- * to determine the number of contiguous ring entries associated
- * with this request.
- *
- * Note:  Due to the way Xen request rings operate, the producer and
- *        consumer indices of the ring must be incremented by the
- *        BLKIF_SEGS_TO_BLOCKS() value of the associated request.
- *        (e.g. a response to a 3 ring entry request must also consume
- *        3 entries in the ring, even though only the first ring entry
- *        in the response has any data.)
  */
 struct blkif_request {
     uint8_t        operation;    /* BLKIF_OP_???                         */
@@ -518,22 +432,11 @@
     blkif_vdev_t   handle;       /* only for read/write requests         */
     uint64_t       id;           /* private guest value, echoed in resp  */
     blkif_sector_t sector_number;/* start sector idx on disk (r/w only)  */
-    blkif_request_segment_t seg[BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK];
+    struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
 };
 typedef struct blkif_request blkif_request_t;
 
 /*
- * A segment block is a ring request structure that contains only
- * segment data.
- *
- * sizeof(struct blkif_segment_block) <= sizeof(struct blkif_request)
- */
-struct blkif_segment_block {
-    blkif_request_segment_t seg[BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK];
-};
-typedef struct blkif_segment_block blkif_segment_block_t;
-
-/*
  * Cast to this structure when blkif_request.operation == BLKIF_OP_DISCARD
  * sizeof(struct blkif_request_discard) <= sizeof(struct blkif_request)
  */
@@ -570,21 +473,6 @@
  */
 DEFINE_RING_TYPES(blkif, struct blkif_request, struct blkif_response);
 
-/*
- * Index to, and treat as a segment block, an entry in the ring.
- */
-#define BLKRING_GET_SEG_BLOCK(_r, _idx)                                 \
-    (((blkif_segment_block_t *)RING_GET_REQUEST(_r, _idx))->seg)
-
-/*
- * The number of ring request blocks required to handle an I/O
- * request containing _segs segments.
- */
-#define BLKIF_SEGS_TO_BLOCKS(_segs)                                     \
-    ((((_segs - BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK)                    \
-     + (BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK - 1))                      \
-    / BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK) + /*header_block*/1)
-
 #define VDISK_CDROM        0x1
 #define VDISK_REMOVABLE    0x2
 #define VDISK_READONLY     0x4
diff -r 71159fb049f2 -r 071beb00303b xen/include/public/xen-compat.h
--- a/xen/include/public/xen-compat.h	Fri Feb 24 11:46:32 2012 +0100
+++ b/xen/include/public/xen-compat.h	Mon Feb 27 12:10:29 2012 +0000
@@ -27,7 +27,7 @@
 #ifndef __XEN_PUBLIC_XEN_COMPAT_H__
 #define __XEN_PUBLIC_XEN_COMPAT_H__
 
-#define __XEN_LATEST_INTERFACE_VERSION__ 0x00040201
+#define __XEN_LATEST_INTERFACE_VERSION__ 0x00040200
 
 #if defined(__XEN__) || defined(__XEN_TOOLS__)
 /* Xen is built with matching headers and implements the latest interface. */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnU-0002Nk-Ff; Tue, 28 Feb 2012 06:44:28 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnT-0002Ct-7F
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:27 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-21.messagelabs.com!1330411459!13727833!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8305 invoked from network); 28 Feb 2012 06:44:20 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnK-0004Fv-P9
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnK-0007NI-Nt
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:18 +0000
Message-Id: <E1S2GnK-0007NI-Nt@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Revert 24875:a59c1dcfe968 "blkif.h:
	Define and document the request number/size/segments extension"
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1330344629 0
# Node ID 071beb00303b9afc4027d4150f0991d9ddc8224a
# Parent  71159fb049f253030c3820c260d092d4aec6b166
Revert 24875:a59c1dcfe968 "blkif.h: Define and document the request number/size/segments extension"

Breaks the build.

Signed-off-by: Keir Fraser <keir@xen.org>
---


diff -r 71159fb049f2 -r 071beb00303b xen/include/public/io/blkif.h
--- a/xen/include/public/io/blkif.h	Fri Feb 24 11:46:32 2012 +0100
+++ b/xen/include/public/io/blkif.h	Mon Feb 27 12:10:29 2012 +0000
@@ -145,32 +145,6 @@
  *      The maximum supported size of the request ring buffer in units of
  *      machine pages.  The value must be a power of 2.
  *
- * max-requests         <uint32_t>
- *      Default Value:  BLKIF_MAX_RING_REQUESTS(PAGE_SIZE)
- *      Maximum Value:  BLKIF_MAX_RING_REQUESTS(PAGE_SIZE * max-ring-pages)
- *
- *      The maximum number of concurrent, logical requests that will be
- *      issued by the backend.
- *
- *      Note: A logical request may span multiple ring entries.
- *
- * max-request-segments
- *      Values:         <uint8_t>
- *      Default Value:  BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK
- *      Maximum Value:  BLKIF_MAX_SEGMENTS_PER_REQUEST
- *
- *      The maximum value of blkif_request.nr_segments supported by
- *      the backend.
- *
- * max-request-size
- *      Values:         <uint32_t>
- *      Default Value:  BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK * PAGE_SIZE
- *      Maximum Value:  BLKIF_MAX_SEGMENTS_PER_REQUEST * PAGE_SIZE
- *
- *      The maximum amount of data, in bytes, that can be referenced by a
- *      request type that accesses frontend memory (currently BLKIF_OP_READ,
- *      BLKIF_OP_WRITE, or BLKIF_OP_WRITE_BARRIER).
- *
  *------------------------- Backend Device Properties -------------------------
  *
  * discard-aligment
@@ -268,33 +242,6 @@
  *      The size of the frontend allocated request ring buffer in units of
  *      machine pages.  The value must be a power of 2.
  *
- * max-requests
- *      Values:         <uint32_t>
- *      Default Value:  BLKIF_MAX_RING_REQUESTS(PAGE_SIZE)
- *      Maximum Value:  BLKIF_MAX_RING_REQUESTS(PAGE_SIZE * max-ring-pages)
- *
- *      The maximum number of concurrent, logical requests that will be
- *      issued by the frontend.
- *
- *      Note: A logical request may span multiple ring entries.
- *
- * max-request-segments
- *      Values:         <uint8_t>
- *      Default Value:  BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK
- *      Maximum Value:  MIN(255, backend/max-request-segments)
- *
- *      The maximum value the frontend will set in the
- *      blkif_request.nr_segments field.
- *
- * max-request-size
- *      Values:         <uint32_t>
- *      Default Value:  BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK * PAGE_SIZE
- *      Maximum Value:  max-request-segments * PAGE_SIZE
- *
- *      The maximum amount of data, in bytes, that can be referenced by
- *      a request type that accesses frontend memory (currently BLKIF_OP_READ,
- *      BLKIF_OP_WRITE, or BLKIF_OP_WRITE_BARRIER).
- *
  *------------------------- Virtual Device Properties -------------------------
  *
  * device-type
@@ -456,28 +403,11 @@
 #define BLKIF_OP_DISCARD           5
 
 /*
- * Maximum scatter/gather segments associated with a request header block.
+ * Maximum scatter/gather segments per request.
  * This is carefully chosen so that sizeof(blkif_ring_t) <= PAGE_SIZE.
  * NB. This could be 12 if the ring indexes weren't stored in the same page.
  */
-#define BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK  11
-
-/*
- * Maximum scatter/gather segments associated with a segment block.
- */
-#define BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK 14
-
-#if __XEN_INTERFACE_VERSION__ >= 0x00040201
-/*
- * Maximum scatter/gather segments per request (header + segment blocks).
- */
-#define BLKIF_MAX_SEGMENTS_PER_REQUEST 255
-#else
-/*
- * Maximum scatter/gather segments per request (header block only).
- */
-#define BLKIF_MAX_SEGMENTS_PER_REQUEST BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK
-#endif
+#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11
 
 /*
  * NB. first_sect and last_sect in blkif_request_segment, as well as
@@ -492,25 +422,9 @@
     /* @last_sect: last sector in frame to transfer (inclusive).     */
     uint8_t     first_sect, last_sect;
 };
-typedef struct blkif_request_segment blkif_request_segment_t;
 
 /*
  * Starting ring element for any I/O request.
- *
- * One or more segment blocks can be inserted into the request ring
- * just after a blkif_request_t, allowing requests to operate on
- * up to BLKIF_MAX_SEGMENTS_PER_REQUEST.
- *
- * BLKIF_SEGS_TO_BLOCKS() can be used on blkif_requst.nr_segments
- * to determine the number of contiguous ring entries associated
- * with this request.
- *
- * Note:  Due to the way Xen request rings operate, the producer and
- *        consumer indices of the ring must be incremented by the
- *        BLKIF_SEGS_TO_BLOCKS() value of the associated request.
- *        (e.g. a response to a 3 ring entry request must also consume
- *        3 entries in the ring, even though only the first ring entry
- *        in the response has any data.)
  */
 struct blkif_request {
     uint8_t        operation;    /* BLKIF_OP_???                         */
@@ -518,22 +432,11 @@
     blkif_vdev_t   handle;       /* only for read/write requests         */
     uint64_t       id;           /* private guest value, echoed in resp  */
     blkif_sector_t sector_number;/* start sector idx on disk (r/w only)  */
-    blkif_request_segment_t seg[BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK];
+    struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
 };
 typedef struct blkif_request blkif_request_t;
 
 /*
- * A segment block is a ring request structure that contains only
- * segment data.
- *
- * sizeof(struct blkif_segment_block) <= sizeof(struct blkif_request)
- */
-struct blkif_segment_block {
-    blkif_request_segment_t seg[BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK];
-};
-typedef struct blkif_segment_block blkif_segment_block_t;
-
-/*
  * Cast to this structure when blkif_request.operation == BLKIF_OP_DISCARD
  * sizeof(struct blkif_request_discard) <= sizeof(struct blkif_request)
  */
@@ -570,21 +473,6 @@
  */
 DEFINE_RING_TYPES(blkif, struct blkif_request, struct blkif_response);
 
-/*
- * Index to, and treat as a segment block, an entry in the ring.
- */
-#define BLKRING_GET_SEG_BLOCK(_r, _idx)                                 \
-    (((blkif_segment_block_t *)RING_GET_REQUEST(_r, _idx))->seg)
-
-/*
- * The number of ring request blocks required to handle an I/O
- * request containing _segs segments.
- */
-#define BLKIF_SEGS_TO_BLOCKS(_segs)                                     \
-    ((((_segs - BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK)                    \
-     + (BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK - 1))                      \
-    / BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK) + /*header_block*/1)
-
 #define VDISK_CDROM        0x1
 #define VDISK_REMOVABLE    0x2
 #define VDISK_READONLY     0x4
diff -r 71159fb049f2 -r 071beb00303b xen/include/public/xen-compat.h
--- a/xen/include/public/xen-compat.h	Fri Feb 24 11:46:32 2012 +0100
+++ b/xen/include/public/xen-compat.h	Mon Feb 27 12:10:29 2012 +0000
@@ -27,7 +27,7 @@
 #ifndef __XEN_PUBLIC_XEN_COMPAT_H__
 #define __XEN_PUBLIC_XEN_COMPAT_H__
 
-#define __XEN_LATEST_INTERFACE_VERSION__ 0x00040201
+#define __XEN_LATEST_INTERFACE_VERSION__ 0x00040200
 
 #if defined(__XEN__) || defined(__XEN_TOOLS__)
 /* Xen is built with matching headers and implements the latest interface. */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnU-0002Nw-J4; Tue, 28 Feb 2012 06:44:28 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnT-0002DK-NZ
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:27 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-216.messagelabs.com!1330411460!16745314!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23196 invoked from network); 28 Feb 2012 06:44:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnM-0004G4-Aa
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnM-0007OP-9L
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:20 +0000
Message-Id: <E1S2GnM-0007OP-9L@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Update SEABIOS_UPSTREAM_TAG
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1330362318 0
# Node ID a7bacdc5449a2f7bb9c35b2a1334b463fe9f29a9
# Parent  e4fc04c15cd71a4090f06cd1f0df66703824fcb8
Update SEABIOS_UPSTREAM_TAG

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r e4fc04c15cd7 -r a7bacdc5449a Config.mk
--- a/Config.mk	Mon Feb 27 17:05:18 2012 +0000
+++ b/Config.mk	Mon Feb 27 17:05:18 2012 +0000
@@ -194,9 +194,9 @@
 SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 endif
 QEMU_UPSTREAM_REVISION ?= master
-SEABIOS_UPSTREAM_TAG ?= 002d30b5f4f48ee203be3bad9d68dc8b538ee35b
-# Wed Feb 8 20:21:29 2012 -0500
-# Add PYTHON definition to Makefile.
+SEABIOS_UPSTREAM_TAG ?= c69e288adfe6c273df4b1f3d9c223d8a4fb613cd
+# Wed Feb 8 20:23:36 2012 -0500
+# Permit .rodata.__PRETTY_FUNCTION__. sections in roms.
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnU-0002Nw-J4; Tue, 28 Feb 2012 06:44:28 +0000
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnT-0002DK-NZ
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:27 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-216.messagelabs.com!1330411460!16745314!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23196 invoked from network); 28 Feb 2012 06:44:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnM-0004G4-Aa
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnM-0007OP-9L
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:20 +0000
Message-Id: <E1S2GnM-0007OP-9L@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Update SEABIOS_UPSTREAM_TAG
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1330362318 0
# Node ID a7bacdc5449a2f7bb9c35b2a1334b463fe9f29a9
# Parent  e4fc04c15cd71a4090f06cd1f0df66703824fcb8
Update SEABIOS_UPSTREAM_TAG

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r e4fc04c15cd7 -r a7bacdc5449a Config.mk
--- a/Config.mk	Mon Feb 27 17:05:18 2012 +0000
+++ b/Config.mk	Mon Feb 27 17:05:18 2012 +0000
@@ -194,9 +194,9 @@
 SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 endif
 QEMU_UPSTREAM_REVISION ?= master
-SEABIOS_UPSTREAM_TAG ?= 002d30b5f4f48ee203be3bad9d68dc8b538ee35b
-# Wed Feb 8 20:21:29 2012 -0500
-# Add PYTHON definition to Makefile.
+SEABIOS_UPSTREAM_TAG ?= c69e288adfe6c273df4b1f3d9c223d8a4fb613cd
+# Wed Feb 8 20:23:36 2012 -0500
+# Permit .rodata.__PRETTY_FUNCTION__. sections in roms.
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:31 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnV-0002PZ-M8; Tue, 28 Feb 2012 06:44:29 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnU-0002FM-He
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:28 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-21.messagelabs.com!1330411460!10539009!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17276 invoked from network); 28 Feb 2012 06:44:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnL-0004G1-QK
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnL-0007O2-P4
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:19 +0000
Message-Id: <E1S2GnL-0007O2-P4@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: fix unaligned memcpy() and
	memmove()
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1330362318 0
# Node ID e4fc04c15cd71a4090f06cd1f0df66703824fcb8
# Parent  21c0c086119fea9514949ddbc4b1a17f994f2724
arm: fix unaligned memcpy() and memmove()

If memcpy() and memmove() were used with source and destination of
different alignment then the result would be all jumbled.

When their implementations were imported from Linux some macros for
big-endian platforms were taken instead of the correct little-endian
ones (specifically, the push and pull macros in assembler.h).

Fix this by taking Linux's arch/include/asm/assembler.h as-is and
making only the minimum changes necessary for Xen.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r 21c0c086119f -r e4fc04c15cd7 xen/arch/arm/lib/assembler.h
--- a/xen/arch/arm/lib/assembler.h	Mon Feb 27 16:12:24 2012 +0000
+++ b/xen/arch/arm/lib/assembler.h	Mon Feb 27 17:05:18 2012 +0000
@@ -1,25 +1,24 @@
-#ifndef __ARCH_ARM_LIB_ASSEMBLER_H__
-#define __ARCH_ARM_LIB_ASSEMBLER_H__
-
 /* From Linux arch/arm/include/asm/assembler.h */
 /*
- * Data preload for architectures that support it
+ *  arch/arm/include/asm/assembler.h
+ *
+ *  Copyright (C) 1996-2000 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ *  This file contains arm architecture specific defines
+ *  for the different processors.
+ *
+ *  Do not include any C declarations in this file - it is included by
+ *  assembler source.
  */
-#define PLD(code...)    code
+#ifndef __ASM_ASSEMBLER_H__
+#define __ASM_ASSEMBLER_H__
 
-/*
- * This can be used to enable code to cacheline align the destination
- * pointer when bulk writing to memory.  Experiments on StrongARM and
- * XScale didn't show this a worthwhile thing to do when the cache is not
- * set to write-allocate (this would need further testing on XScale when WA
- * is used).
- *
- * On Feroceon there is much to gain however, regardless of cache mode.
- */
-#ifdef CONFIG_CPU_FEROCEON /* Not in Xen... */
-#define CALGN(code...) code
-#else
-#define CALGN(code...)
+#ifndef __ASSEMBLY__
+#error "Only include this from assembly code"
 #endif
 
 // No Thumb, hence:
@@ -33,17 +32,294 @@
 #define UNWIND(code...)
 #endif
 
+/*
+ * Endian independent macros for shifting bytes within registers.
+ */
+#ifndef __ARMEB__
+#define pull            lsr
+#define push            lsl
+#define get_byte_0      lsl #0
+#define get_byte_1	lsr #8
+#define get_byte_2	lsr #16
+#define get_byte_3	lsr #24
+#define put_byte_0      lsl #0
+#define put_byte_1	lsl #8
+#define put_byte_2	lsl #16
+#define put_byte_3	lsl #24
+#else
 #define pull            lsl
 #define push            lsr
-#define get_byte_0      lsr #24
-#define get_byte_1      lsr #16
-#define get_byte_2      lsr #8
+#define get_byte_0	lsr #24
+#define get_byte_1	lsr #16
+#define get_byte_2	lsr #8
 #define get_byte_3      lsl #0
-#define put_byte_0      lsl #24
-#define put_byte_1      lsl #16
-#define put_byte_2      lsl #8
+#define put_byte_0	lsl #24
+#define put_byte_1	lsl #16
+#define put_byte_2	lsl #8
 #define put_byte_3      lsl #0
+#endif
 
-#define smp_dmb dmb
+/*
+ * Data preload for architectures that support it
+ */
+#if __LINUX_ARM_ARCH__ >= 5
+#define PLD(code...)	code
+#else
+#define PLD(code...)
+#endif
 
-#endif /*  __ARCH_ARM_LIB_ASSEMBLER_H__ */
+/*
+ * This can be used to enable code to cacheline align the destination
+ * pointer when bulk writing to memory.  Experiments on StrongARM and
+ * XScale didn't show this a worthwhile thing to do when the cache is not
+ * set to write-allocate (this would need further testing on XScale when WA
+ * is used).
+ *
+ * On Feroceon there is much to gain however, regardless of cache mode.
+ */
+#ifdef CONFIG_CPU_FEROCEON
+#define CALGN(code...) code
+#else
+#define CALGN(code...)
+#endif
+
+/*
+ * Enable and disable interrupts
+ */
+#if __LINUX_ARM_ARCH__ >= 6
+	.macro	disable_irq_notrace
+	cpsid	i
+	.endm
+
+	.macro	enable_irq_notrace
+	cpsie	i
+	.endm
+#else
+	.macro	disable_irq_notrace
+	msr	cpsr_c, #PSR_I_BIT | SVC_MODE
+	.endm
+
+	.macro	enable_irq_notrace
+	msr	cpsr_c, #SVC_MODE
+	.endm
+#endif
+
+	.macro asm_trace_hardirqs_off
+#if defined(CONFIG_TRACE_IRQFLAGS)
+	stmdb   sp!, {r0-r3, ip, lr}
+	bl	trace_hardirqs_off
+	ldmia	sp!, {r0-r3, ip, lr}
+#endif
+	.endm
+
+	.macro asm_trace_hardirqs_on_cond, cond
+#if defined(CONFIG_TRACE_IRQFLAGS)
+	/*
+	 * actually the registers should be pushed and pop'd conditionally, but
+	 * after bl the flags are certainly clobbered
+	 */
+	stmdb   sp!, {r0-r3, ip, lr}
+	bl\cond	trace_hardirqs_on
+	ldmia	sp!, {r0-r3, ip, lr}
+#endif
+	.endm
+
+	.macro asm_trace_hardirqs_on
+	asm_trace_hardirqs_on_cond al
+	.endm
+
+	.macro disable_irq
+	disable_irq_notrace
+	asm_trace_hardirqs_off
+	.endm
+
+	.macro enable_irq
+	asm_trace_hardirqs_on
+	enable_irq_notrace
+	.endm
+/*
+ * Save the current IRQ state and disable IRQs.  Note that this macro
+ * assumes FIQs are enabled, and that the processor is in SVC mode.
+ */
+	.macro	save_and_disable_irqs, oldcpsr
+	mrs	\oldcpsr, cpsr
+	disable_irq
+	.endm
+
+/*
+ * Restore interrupt state previously stored in a register.  We don't
+ * guarantee that this will preserve the flags.
+ */
+	.macro	restore_irqs_notrace, oldcpsr
+	msr	cpsr_c, \oldcpsr
+	.endm
+
+	.macro restore_irqs, oldcpsr
+	tst	\oldcpsr, #PSR_I_BIT
+	asm_trace_hardirqs_on_cond eq
+	restore_irqs_notrace \oldcpsr
+	.endm
+
+#define USER(x...)				\
+9999:	x;					\
+	.pushsection __ex_table,"a";		\
+	.align	3;				\
+	.long	9999b,9001f;			\
+	.popsection
+
+#ifdef CONFIG_SMP
+#define ALT_SMP(instr...)					\
+9998:	instr
+/*
+ * Note: if you get assembler errors from ALT_UP() when building with
+ * CONFIG_THUMB2_KERNEL, you almost certainly need to use
+ * ALT_SMP( W(instr) ... )
+ */
+#define ALT_UP(instr...)					\
+	.pushsection ".alt.smp.init", "a"			;\
+	.long	9998b						;\
+9997:	instr							;\
+	.if . - 9997b != 4					;\
+		.error "ALT_UP() content must assemble to exactly 4 bytes";\
+	.endif							;\
+	.popsection
+#define ALT_UP_B(label)					\
+	.equ	up_b_offset, label - 9998b			;\
+	.pushsection ".alt.smp.init", "a"			;\
+	.long	9998b						;\
+	W(b)	. + up_b_offset					;\
+	.popsection
+#else
+#define ALT_SMP(instr...)
+#define ALT_UP(instr...) instr
+#define ALT_UP_B(label) b label
+#endif
+
+/*
+ * Instruction barrier
+ */
+	.macro	instr_sync
+#if __LINUX_ARM_ARCH__ >= 7
+	isb
+#elif __LINUX_ARM_ARCH__ == 6
+	mcr	p15, 0, r0, c7, c5, 4
+#endif
+	.endm
+
+/*
+ * SMP data memory barrier
+ */
+	.macro	smp_dmb mode
+#ifdef CONFIG_SMP
+#if __LINUX_ARM_ARCH__ >= 7
+	.ifeqs "\mode","arm"
+	ALT_SMP(dmb)
+	.else
+	ALT_SMP(W(dmb))
+	.endif
+#elif __LINUX_ARM_ARCH__ == 6
+	ALT_SMP(mcr	p15, 0, r0, c7, c10, 5)	@ dmb
+#else
+#error Incompatible SMP platform
+#endif
+	.ifeqs "\mode","arm"
+	ALT_UP(nop)
+	.else
+	ALT_UP(W(nop))
+	.endif
+#endif
+	.endm
+
+#ifdef CONFIG_THUMB2_KERNEL
+	.macro	setmode, mode, reg
+	mov	\reg, #\mode
+	msr	cpsr_c, \reg
+	.endm
+#else
+	.macro	setmode, mode, reg
+	msr	cpsr_c, #\mode
+	.endm
+#endif
+
+/*
+ * STRT/LDRT access macros with ARM and Thumb-2 variants
+ */
+#ifdef CONFIG_THUMB2_KERNEL
+
+	.macro	usraccoff, instr, reg, ptr, inc, off, cond, abort, t=T()
+9999:
+	.if	\inc == 1
+	\instr\cond\()b\()\t\().w \reg, [\ptr, #\off]
+	.elseif	\inc == 4
+	\instr\cond\()\t\().w \reg, [\ptr, #\off]
+	.else
+	.error	"Unsupported inc macro argument"
+	.endif
+
+	.pushsection __ex_table,"a"
+	.align	3
+	.long	9999b, \abort
+	.popsection
+	.endm
+
+	.macro	usracc, instr, reg, ptr, inc, cond, rept, abort
+	@ explicit IT instruction needed because of the label
+	@ introduced by the USER macro
+	.ifnc	\cond,al
+	.if	\rept == 1
+	itt	\cond
+	.elseif	\rept == 2
+	ittt	\cond
+	.else
+	.error	"Unsupported rept macro argument"
+	.endif
+	.endif
+
+	@ Slightly optimised to avoid incrementing the pointer twice
+	usraccoff \instr, \reg, \ptr, \inc, 0, \cond, \abort
+	.if	\rept == 2
+	usraccoff \instr, \reg, \ptr, \inc, \inc, \cond, \abort
+	.endif
+
+	add\cond \ptr, #\rept * \inc
+	.endm
+
+#else	/* !CONFIG_THUMB2_KERNEL */
+
+	.macro	usracc, instr, reg, ptr, inc, cond, rept, abort, t=T()
+	.rept	\rept
+9999:
+	.if	\inc == 1
+	\instr\cond\()b\()\t \reg, [\ptr], #\inc
+	.elseif	\inc == 4
+	\instr\cond\()\t \reg, [\ptr], #\inc
+	.else
+	.error	"Unsupported inc macro argument"
+	.endif
+
+	.pushsection __ex_table,"a"
+	.align	3
+	.long	9999b, \abort
+	.popsection
+	.endr
+	.endm
+
+#endif	/* CONFIG_THUMB2_KERNEL */
+
+	.macro	strusr, reg, ptr, inc, cond=al, rept=1, abort=9001f
+	usracc	str, \reg, \ptr, \inc, \cond, \rept, \abort
+	.endm
+
+	.macro	ldrusr, reg, ptr, inc, cond=al, rept=1, abort=9001f
+	usracc	ldr, \reg, \ptr, \inc, \cond, \rept, \abort
+	.endm
+
+/* Utility macro for declaring string literals */
+	.macro	string name:req, string
+	.type \name , #object
+\name:
+	.asciz "\string"
+	.size \name , . - \name
+	.endm
+
+#endif /* __ASM_ASSEMBLER_H__ */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Tue Feb 28 06:44:31 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Feb 2012 06:44:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1S2GnV-0002PZ-M8; Tue, 28 Feb 2012 06:44:29 +0000
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnU-0002FM-He
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:28 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-21.messagelabs.com!1330411460!10539009!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.5; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17276 invoked from network); 28 Feb 2012 06:44:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Feb 2012 06:44:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnL-0004G1-QK
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1S2GnL-0007O2-P4
	for xen-changelog@lists.xensource.com; Tue, 28 Feb 2012 06:44:19 +0000
Message-Id: <E1S2GnL-0007O2-P4@xenbits.xen.org>
Date: Tue, 28 Feb 2012 06:44:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: fix unaligned memcpy() and
	memmove()
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1330362318 0
# Node ID e4fc04c15cd71a4090f06cd1f0df66703824fcb8
# Parent  21c0c086119fea9514949ddbc4b1a17f994f2724
arm: fix unaligned memcpy() and memmove()

If memcpy() and memmove() were used with source and destination of
different alignment then the result would be all jumbled.

When their implementations were imported from Linux some macros for
big-endian platforms were taken instead of the correct little-endian
ones (specifically, the push and pull macros in assembler.h).

Fix this by taking Linux's arch/include/asm/assembler.h as-is and
making only the minimum changes necessary for Xen.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <Ian.Campbell@citrix.com>
---


diff -r 21c0c086119f -r e4fc04c15cd7 xen/arch/arm/lib/assembler.h
--- a/xen/arch/arm/lib/assembler.h	Mon Feb 27 16:12:24 2012 +0000
+++ b/xen/arch/arm/lib/assembler.h	Mon Feb 27 17:05:18 2012 +0000
@@ -1,25 +1,24 @@
-#ifndef __ARCH_ARM_LIB_ASSEMBLER_H__
-#define __ARCH_ARM_LIB_ASSEMBLER_H__
-
 /* From Linux arch/arm/include/asm/assembler.h */
 /*
- * Data preload for architectures that support it
+ *  arch/arm/include/asm/assembler.h
+ *
+ *  Copyright (C) 1996-2000 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ *  This file contains arm architecture specific defines
+ *  for the different processors.
+ *
+ *  Do not include any C declarations in this file - it is included by
+ *  assembler source.
  */
-#define PLD(code...)    code
+#ifndef __ASM_ASSEMBLER_H__
+#define __ASM_ASSEMBLER_H__
 
-/*
- * This can be used to enable code to cacheline align the destination
- * pointer when bulk writing to memory.  Experiments on StrongARM and
- * XScale didn't show this a worthwhile thing to do when the cache is not
- * set to write-allocate (this would need further testing on XScale when WA
- * is used).
- *
- * On Feroceon there is much to gain however, regardless of cache mode.
- */
-#ifdef CONFIG_CPU_FEROCEON /* Not in Xen... */
-#define CALGN(code...) code
-#else
-#define CALGN(code...)
+#ifndef __ASSEMBLY__
+#error "Only include this from assembly code"
 #endif
 
 // No Thumb, hence:
@@ -33,17 +32,294 @@
 #define UNWIND(code...)
 #endif
 
+/*
+ * Endian independent macros for shifting bytes within registers.
+ */
+#ifndef __ARMEB__
+#define pull            lsr
+#define push            lsl
+#define get_byte_0      lsl #0
+#define get_byte_1	lsr #8
+#define get_byte_2	lsr #16
+#define get_byte_3	lsr #24
+#define put_byte_0      lsl #0
+#define put_byte_1	lsl #8
+#define put_byte_2	lsl #16
+#define put_byte_3	lsl #24
+#else
 #define pull            lsl
 #define push            lsr
-#define get_byte_0      lsr #24
-#define get_byte_1      lsr #16
-#define get_byte_2      lsr #8
+#define get_byte_0	lsr #24
+#define get_byte_1	lsr #16
+#define get_byte_2	lsr #8
 #define get_byte_3      lsl #0
-#define put_byte_0      lsl #24
-#define put_byte_1      lsl #16
-#define put_byte_2      lsl #8
+#define put_byte_0	lsl #24
+#define put_byte_1	lsl #16
+#define put_byte_2	lsl #8
 #define put_byte_3      lsl #0
+#endif
 
-#define smp_dmb dmb
+/*
+ * Data preload for architectures that support it
+ */
+#if __LINUX_ARM_ARCH__ >= 5
+#define PLD(code...)	code
+#else
+#define PLD(code...)
+#endif
 
-#endif /*  __ARCH_ARM_LIB_ASSEMBLER_H__ */
+/*
+ * This can be used to enable code to cacheline align the destination
+ * pointer when bulk writing to memory.  Experiments on StrongARM and
+ * XScale didn't show this a worthwhile thing to do when the cache is not
+ * set to write-allocate (this would need further testing on XScale when WA
+ * is used).
+ *
+ * On Feroceon there is much to gain however, regardless of cache mode.
+ */
+#ifdef CONFIG_CPU_FEROCEON
+#define CALGN(code...) code
+#else
+#define CALGN(code...)
+#endif
+
+/*
+ * Enable and disable interrupts
+ */
+#if __LINUX_ARM_ARCH__ >= 6
+	.macro	disable_irq_notrace
+	cpsid	i
+	.endm
+
+	.macro	enable_irq_notrace
+	cpsie	i
+	.endm
+#else
+	.macro	disable_irq_notrace
+	msr	cpsr_c, #PSR_I_BIT | SVC_MODE
+	.endm
+
+	.macro	enable_irq_notrace
+	msr	cpsr_c, #SVC_MODE
+	.endm
+#endif
+
+	.macro asm_trace_hardirqs_off
+#if defined(CONFIG_TRACE_IRQFLAGS)
+	stmdb   sp!, {r0-r3, ip, lr}
+	bl	trace_hardirqs_off
+	ldmia	sp!, {r0-r3, ip, lr}
+#endif
+	.endm
+
+	.macro asm_trace_hardirqs_on_cond, cond
+#if defined(CONFIG_TRACE_IRQFLAGS)
+	/*
+	 * actually the registers should be pushed and pop'd conditionally, but
+	 * after bl the flags are certainly clobbered
+	 */
+	stmdb   sp!, {r0-r3, ip, lr}
+	bl\cond	trace_hardirqs_on
+	ldmia	sp!, {r0-r3, ip, lr}
+#endif
+	.endm
+
+	.macro asm_trace_hardirqs_on
+	asm_trace_hardirqs_on_cond al
+	.endm
+
+	.macro disable_irq
+	disable_irq_notrace
+	asm_trace_hardirqs_off
+	.endm
+
+	.macro enable_irq
+	asm_trace_hardirqs_on
+	enable_irq_notrace
+	.endm
+/*
+ * Save the current IRQ state and disable IRQs.  Note that this macro
+ * assumes FIQs are enabled, and that the processor is in SVC mode.
+ */
+	.macro	save_and_disable_irqs, oldcpsr
+	mrs	\oldcpsr, cpsr
+	disable_irq
+	.endm
+
+/*
+ * Restore interrupt state previously stored in a register.  We don't
+ * guarantee that this will preserve the flags.
+ */
+	.macro	restore_irqs_notrace, oldcpsr
+	msr	cpsr_c, \oldcpsr
+	.endm
+
+	.macro restore_irqs, oldcpsr
+	tst	\oldcpsr, #PSR_I_BIT
+	asm_trace_hardirqs_on_cond eq
+	restore_irqs_notrace \oldcpsr
+	.endm
+
+#define USER(x...)				\
+9999:	x;					\
+	.pushsection __ex_table,"a";		\
+	.align	3;				\
+	.long	9999b,9001f;			\
+	.popsection
+
+#ifdef CONFIG_SMP
+#define ALT_SMP(instr...)					\
+9998:	instr
+/*
+ * Note: if you get assembler errors from ALT_UP() when building with
+ * CONFIG_THUMB2_KERNEL, you almost certainly need to use
+ * ALT_SMP( W(instr) ... )
+ */
+#define ALT_UP(instr...)					\
+	.pushsection ".alt.smp.init", "a"			;\
+	.long	9998b						;\
+9997:	instr							;\
+	.if . - 9997b != 4					;\
+		.error "ALT_UP() content must assemble to exactly 4 bytes";\
+	.endif							;\
+	.popsection
+#define ALT_UP_B(label)					\
+	.equ	up_b_offset, label - 9998b			;\
+	.pushsection ".alt.smp.init", "a"			;\
+	.long	9998b						;\
+	W(b)	. + up_b_offset					;\
+	.popsection
+#else
+#define ALT_SMP(instr...)
+#define ALT_UP(instr...) instr
+#define ALT_UP_B(label) b label
+#endif
+
+/*
+ * Instruction barrier
+ */
+	.macro	instr_sync
+#if __LINUX_ARM_ARCH__ >= 7
+	isb
+#elif __LINUX_ARM_ARCH__ == 6
+	mcr	p15, 0, r0, c7, c5, 4
+#endif
+	.endm
+
+/*
+ * SMP data memory barrier
+ */
+	.macro	smp_dmb mode
+#ifdef CONFIG_SMP
+#if __LINUX_ARM_ARCH__ >= 7
+	.ifeqs "\mode","arm"
+	ALT_SMP(dmb)
+	.else
+	ALT_SMP(W(dmb))
+	.endif
+#elif __LINUX_ARM_ARCH__ == 6
+	ALT_SMP(mcr	p15, 0, r0, c7, c10, 5)	@ dmb
+#else
+#error Incompatible SMP platform
+#endif
+	.ifeqs "\mode","arm"
+	ALT_UP(nop)
+	.else
+	ALT_UP(W(nop))
+	.endif
+#endif
+	.endm
+
+#ifdef CONFIG_THUMB2_KERNEL
+	.macro	setmode, mode, reg
+	mov	\reg, #\mode
+	msr	cpsr_c, \reg
+	.endm
+#else
+	.macro	setmode, mode, reg
+	msr	cpsr_c, #\mode
+	.endm
+#endif
+
+/*
+ * STRT/LDRT access macros with ARM and Thumb-2 variants
+ */
+#ifdef CONFIG_THUMB2_KERNEL
+
+	.macro	usraccoff, instr, reg, ptr, inc, off, cond, abort, t=T()
+9999:
+	.if	\inc == 1
+	\instr\cond\()b\()\t\().w \reg, [\ptr, #\off]
+	.elseif	\inc == 4
+	\instr\cond\()\t\().w \reg, [\ptr, #\off]
+	.else
+	.error	"Unsupported inc macro argument"
+	.endif
+
+	.pushsection __ex_table,"a"
+	.align	3
+	.long	9999b, \abort
+	.popsection
+	.endm
+
+	.macro	usracc, instr, reg, ptr, inc, cond, rept, abort
+	@ explicit IT instruction needed because of the label
+	@ introduced by the USER macro
+	.ifnc	\cond,al
+	.if	\rept == 1
+	itt	\cond
+	.elseif	\rept == 2
+	ittt	\cond
+	.else
+	.error	"Unsupported rept macro argument"
+	.endif
+	.endif
+
+	@ Slightly optimised to avoid incrementing the pointer twice
+	usraccoff \instr, \reg, \ptr, \inc, 0, \cond, \abort
+	.if	\rept == 2
+	usraccoff \instr, \reg, \ptr, \inc, \inc, \cond, \abort
+	.endif
+
+	add\cond \ptr, #\rept * \inc
+	.endm
+
+#else	/* !CONFIG_THUMB2_KERNEL */
+
+	.macro	usracc, instr, reg, ptr, inc, cond, rept, abort, t=T()
+	.rept	\rept
+9999:
+	.if	\inc == 1
+	\instr\cond\()b\()\t \reg, [\ptr], #\inc
+	.elseif	\inc == 4
+	\instr\cond\()\t \reg, [\ptr], #\inc
+	.else
+	.error	"Unsupported inc macro argument"
+	.endif
+
+	.pushsection __ex_table,"a"
+	.align	3
+	.long	9999b, \abort
+	.popsection
+	.endr
+	.endm
+
+#endif	/* CONFIG_THUMB2_KERNEL */
+
+	.macro	strusr, reg, ptr, inc, cond=al, rept=1, abort=9001f
+	usracc	str, \reg, \ptr, \inc, \cond, \rept, \abort
+	.endm
+
+	.macro	ldrusr, reg, ptr, inc, cond=al, rept=1, abort=9001f
+	usracc	ldr, \reg, \ptr, \inc, \cond, \rept, \abort
+	.endm
+
+/* Utility macro for declaring string literals */
+	.macro	string name:req, string
+	.type \name , #object
+\name:
+	.asciz "\string"
+	.size \name , . - \name
+	.endm
+
+#endif /* __ASM_ASSEMBLER_H__ */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog

