From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XG-0000YB-Vt; Fri, 02 Nov 2012 05: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 1TU9XF-0000XV-MM
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:13 +0000
Received: from [85.158.139.83:58630] by server-7.bemta-5.messagelabs.com id
	FA/31-23096-0F553905; Fri, 02 Nov 2012 05:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-182.messagelabs.com!1351833070!27722454!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26450 invoked from network); 2 Nov 2012 05:11:11 -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;
	2 Nov 2012 05: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 1TU9XC-0000el-8U
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XB-0006LB-Vf
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:09 +0000
Message-Id: <E1TU9XB-0006LB-Vf@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:09 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] docs: correct formatting errors
	in xmdomain.cfg
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matt Wilson <msw@amazon.com>
# Date 1351266012 -3600
# Node ID c23d938e3e6401e75b0b11e04f9c7815208dd906
# Parent  cd0ae0ba4653ab4d35a8b06db6e0a40b65065575
docs: correct formatting errors in xmdomain.cfg

This patch corrects the following errors produced by pod2man:

Hey! The above document had some coding errors, which are explained
below:

Around line 301:
    You can't have =items (as at line 305) unless the first thing after
    the =over is an =item

Around line 311:
    '=item' outside of any '=over'

Signed-off-by: Matt Wilson <msw@amazon.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 25840:c7e4b7e64303
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r cd0ae0ba4653 -r c23d938e3e64 docs/man/xmdomain.cfg.pod.5
--- a/docs/man/xmdomain.cfg.pod.5	Fri Oct 26 16:40:05 2012 +0100
+++ b/docs/man/xmdomain.cfg.pod.5	Fri Oct 26 16:40:12 2012 +0100
@@ -298,16 +298,14 @@ it holds, so that the new one may take t
 
 =back
 
+Additionally, the "on_crash" event can also take:
+
 =over 4
 
-Additionally, the "on_crash" event can also take:
-
 =item B<coredump-destroy>
 
 Dump the crashed domain's core and then destroy it.
 
-=back
-
 =item B<coredump-restart>
 
 Dump the crashed domain's core and then restart it.

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XG-0000YB-Vt; Fri, 02 Nov 2012 05: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 1TU9XF-0000XV-MM
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:13 +0000
Received: from [85.158.139.83:58630] by server-7.bemta-5.messagelabs.com id
	FA/31-23096-0F553905; Fri, 02 Nov 2012 05:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-182.messagelabs.com!1351833070!27722454!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26450 invoked from network); 2 Nov 2012 05:11:11 -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;
	2 Nov 2012 05: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 1TU9XC-0000el-8U
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XB-0006LB-Vf
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:09 +0000
Message-Id: <E1TU9XB-0006LB-Vf@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:09 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] docs: correct formatting errors
	in xmdomain.cfg
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matt Wilson <msw@amazon.com>
# Date 1351266012 -3600
# Node ID c23d938e3e6401e75b0b11e04f9c7815208dd906
# Parent  cd0ae0ba4653ab4d35a8b06db6e0a40b65065575
docs: correct formatting errors in xmdomain.cfg

This patch corrects the following errors produced by pod2man:

Hey! The above document had some coding errors, which are explained
below:

Around line 301:
    You can't have =items (as at line 305) unless the first thing after
    the =over is an =item

Around line 311:
    '=item' outside of any '=over'

Signed-off-by: Matt Wilson <msw@amazon.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 25840:c7e4b7e64303
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r cd0ae0ba4653 -r c23d938e3e64 docs/man/xmdomain.cfg.pod.5
--- a/docs/man/xmdomain.cfg.pod.5	Fri Oct 26 16:40:05 2012 +0100
+++ b/docs/man/xmdomain.cfg.pod.5	Fri Oct 26 16:40:12 2012 +0100
@@ -298,16 +298,14 @@ it holds, so that the new one may take t
 
 =back
 
+Additionally, the "on_crash" event can also take:
+
 =over 4
 
-Additionally, the "on_crash" event can also take:
-
 =item B<coredump-destroy>
 
 Dump the crashed domain's core and then destroy it.
 
-=back
-
 =item B<coredump-restart>
 
 Dump the crashed domain's core and then restart it.

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XJ-0000ZD-CG; Fri, 02 Nov 2012 05:11:17 +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 1TU9XH-0000YN-Ml
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:15 +0000
Received: from [85.158.143.99:39711] by server-3.bemta-4.messagelabs.com id
	9E/E5-06841-2F553905; Fri, 02 Nov 2012 05:11:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-216.messagelabs.com!1351833073!24943088!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6487 invoked from network); 2 Nov 2012 05:11:14 -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 Nov 2012 05: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 1TU9XE-0000f0-VF
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XE-0006MR-Mp
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:12 +0000
Message-Id: <E1TU9XE-0006MR-Mp@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:12 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxl: Fix missing dependency in
	api check rule
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351266044 -3600
# Node ID eac5271097626731db5a97978d6cd77d7a339269
# Parent  747c216a612cedf011f641ac7290a68a61238a14
libxl: Fix missing dependency in api check rule

Without this, the api check cpp run might happen before the various
autogenerated files which are #include by libxl.h are ready.

We need to remove the api-ok file from AUTOINCS to avoid a circular
dependency.  Instead, we list it explicitly as a dependency of the
object files.  The result is that the api check is the last thing to
be done before make considers the preparation done and can start work
on compiling .c files into .o's.

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

xen-unstable changeset: 25901:c51229d1522e
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 747c216a612c -r eac527109762 tools/libxl/Makefile
--- a/tools/libxl/Makefile	Fri Oct 26 16:40:38 2012 +0100
+++ b/tools/libxl/Makefile	Fri Oct 26 16:40:44 2012 +0100
@@ -74,8 +74,7 @@ LIBXL_OBJS += _libxl_types.o libxl_flask
 $(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl) -include $(XEN_ROOT)/tools/config.h
 
 AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h _libxl_list.h _paths.h \
-	_libxl_save_msgs_callout.h _libxl_save_msgs_helper.h \
-        libxl.api-ok
+	_libxl_save_msgs_callout.h _libxl_save_msgs_helper.h
 AUTOSRCS= libxlu_cfg_y.c libxlu_cfg_l.c
 AUTOSRCS += _libxl_save_msgs_callout.c _libxl_save_msgs_helper.c
 LIBXLU_OBJS = libxlu_cfg_y.o libxlu_cfg_l.o libxlu_cfg.o \
@@ -102,7 +101,8 @@ testidl.c: libxl_types.idl gentest.py li
 all: $(CLIENTS) libxenlight.so libxenlight.a libxlutil.so libxlutil.a \
 	$(AUTOSRCS) $(AUTOINCS)
 
-$(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS) $(SAVE_HELPER_OBJS): $(AUTOINCS)
+$(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS) $(SAVE_HELPER_OBJS): \
+	$(AUTOINCS) libxl.api-ok
 
 %.c %.h:: %.y
 	@rm -f $*.[ch]
@@ -119,7 +119,7 @@ libxl.api-ok: check-libxl-api-rules _lib
 	$(PERL) $^
 	touch $@
 
-_%.api-for-check: %.h
+_%.api-for-check: %.h $(AUTOINCS)
 	$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -c -E $< $(APPEND_CFLAGS) \
 		-DLIBXL_EXTERNAL_CALLERS_ONLY=LIBXL_EXTERNAL_CALLERS_ONLY \
 		>$@.new

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XK-0000Zh-Jq; Fri, 02 Nov 2012 05:11: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 1TU9XI-0000Xo-H1
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:16 +0000
Received: from [85.158.139.211:10649] by server-6.bemta-5.messagelabs.com id
	01/CA-19321-4F553905; Fri, 02 Nov 2012 05:11:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-206.messagelabs.com!1351833074!18567537!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12962 invoked from network); 2 Nov 2012 05:11:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2012 05: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 1TU9XG-0000f9-EN
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XG-0006NA-D8
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:14 +0000
Message-Id: <E1TU9XG-0006NA-D8@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:13 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] docs: Document scheduler-related
	Xen command-line 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: "Change log for Mercurial \(receive only\)"
	<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 1351266143 -3600
# Node ID 325a4fdb7f3588b05b35475766e588bfa08c12ff
# Parent  1ecde3c0276481c371a42980b569c3fb78e108f1
docs: Document scheduler-related Xen command-line options

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

xen-unstable changeset: 25968:91e8fd3cf266
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 1ecde3c02764 -r 325a4fdb7f35 docs/misc/xen-command-line.markdown
--- a/docs/misc/xen-command-line.markdown	Fri Oct 26 16:42:10 2012 +0100
+++ b/docs/misc/xen-command-line.markdown	Fri Oct 26 16:42:23 2012 +0100
@@ -701,12 +701,34 @@ Choose the default scheduler.
 ### sched\_credit\_tslice\_ms
 > `= <integer>`
 
+Set the timeslice of the credit1 scheduler, in milliseconds.  The
+default is 30ms.  Reasonable values may include 10, 5, or even 1 for
+very latency-sensitive workloads.
+
 ### sched\_ratelimit\_us
 > `= <integer>`
 
+In order to limit the rate of context switching, set the minimum
+amount of time that a vcpu can be scheduled for before preempting it,
+in microseconds.  The default is 1000us (1ms).  Setting this to 0
+disables it altogether.
+
 ### sched\_smt\_power\_savings
 > `= <boolean>`
 
+Normally Xen will try to maximize performance and cache utilization by
+spreading out vcpus across as many different divisions as possible
+(i.e, numa nodes, sockets, cores threads, &c).  This often maximizes
+throughput, but also maximizes energy usage, since it reduces the
+depth to which a processor can sleep.
+
+This option inverts the logic, so that the scheduler in effect tries
+to keep the vcpus on the smallest amount of silicon possible; i.e.,
+first fill up sibling threads, then sibling cores, then sibling
+sockets, &c.  This will reduce performance somewhat, particularly on
+systems with hyperthreading enabled, but should reduce power by
+enabling more sockets and cores to go into deeper sleep states.
+
 ### serial\_tx\_buffer
 > `= <size>`
 

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XL-0000ag-Se; Fri, 02 Nov 2012 05:11: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 1TU9XK-0000Za-TD
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:19 +0000
Received: from [85.158.139.211:10681] by server-14.bemta-5.messagelabs.com id
	AF/FF-21768-6F553905; Fri, 02 Nov 2012 05:11:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-206.messagelabs.com!1351833076!18547885!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13633 invoked from network); 2 Nov 2012 05:11:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2012 05:11: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 1TU9XI-0000fL-Hf
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XI-0006Oe-GR
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:16 +0000
Message-Id: <E1TU9XI-0006Oe-GR@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:16 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xenballoond.init: remove 4 from
	default runlevel
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351266300 -3600
# Node ID dcd4bf8242842fe7d8390d508fc378db96aad975
# Parent  6adf0c7937bf5ca515aa27c15f7752459b03b971
xenballoond.init: remove 4 from default runlevel

Remove 4 from default runlevel in xenballoond.init.

Similar to what changeset 24847:0900b1c905f1 does in xencommons, remove
runlevel 4 from the other runlevel scripts. LSB defines runlevel 4 as
reserved for local use, the local sysadmin is responsible for symlink
creation in rc4.d.

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

xen-unstable changeset: 26007:fe756682cc7f
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 6adf0c7937bf -r dcd4bf824284 tools/xenballoon/xenballoond.init
--- a/tools/xenballoon/xenballoond.init	Fri Oct 26 16:44:47 2012 +0100
+++ b/tools/xenballoon/xenballoond.init	Fri Oct 26 16:45:00 2012 +0100
@@ -14,7 +14,7 @@
 # Should-Start:
 # Required-Stop:     $syslog $remote_fs
 # Should-Stop:
-# Default-Start:     3 4 5
+# Default-Start:     3 5
 # Default-Stop:      0 1 2 6
 # Short-Description: Start/stop xenballoond
 # Description:       Starts and stops the Xen ballooning daemon.

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XK-0000Zc-HL; Fri, 02 Nov 2012 05:11:18 +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 1TU9XI-0000Ya-CR
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:16 +0000
Received: from [85.158.143.35:46378] by server-2.bemta-4.messagelabs.com id
	E5/B1-28922-3F553905; Fri, 02 Nov 2012 05:11:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-21.messagelabs.com!1351833072!16055186!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20461 invoked from network); 2 Nov 2012 05:11:13 -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;
	2 Nov 2012 05: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 1TU9XE-0000ex-A6
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XE-0006MC-5n
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:12 +0000
Message-Id: <E1TU9XE-0006MC-5n@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:11 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xentop.c: Change curses painting
	behavior to avoid flicker
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Jason McCarver <slam@parasite.cc>
# Date 1351266038 -3600
# Node ID 747c216a612cedf011f641ac7290a68a61238a14
# Parent  27312134166b0596f5de8ce0b9e7dd7c094fad68
xentop.c: Change curses painting behavior to avoid flicker

Currently, xentop calls clear() before drawing the screen and calling
refresh().  This causes the entire screen to be repainted from scratch
on each call to refresh().  It is inefficient and causes visible flicker
when using xentop.

This patch fixes this by calling erase() instead of clear() which overwrites
the current screen with blanks instead.  The screen is then drawn as usual
in the top() function and refresh() is called.  This method allows curses
to only repaint the characters that have changed since the last call
to refresh(), thus avoiding the flicker and sending fewer characters to
the terminal.

In the event the screen becomes corrupted, this patch accepts a CTRL-L
keystroke from the user which will call clear() and force a repaint of
the entire screen.

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

xen-unstable changeset: 25899:116f5c34354b
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 27312134166b -r 747c216a612c tools/xenstat/xentop/xentop.c
--- a/tools/xenstat/xentop/xentop.c	Fri Oct 26 16:40:32 2012 +0100
+++ b/tools/xenstat/xentop/xentop.c	Fri Oct 26 16:40:38 2012 +0100
@@ -57,6 +57,7 @@
 #endif
 
 #define KEY_ESCAPE '\x1B'
+#define KEY_REPAINT '\x0C'
 
 #ifdef HOST_SunOS
 /* Old curses library on Solaris takes non-const strings. Also, ERR interferes
@@ -383,6 +384,9 @@ static int handle_key(int ch)
 		case 'd': case 'D':
 			set_prompt("Delay(sec)", set_delay);
 			break;
+		case KEY_REPAINT:
+			clear();
+			break;
 		case 'q': case 'Q': case KEY_ESCAPE:
 			return 0;
 		}
@@ -1201,7 +1205,7 @@ int main(int argc, char **argv)
 		do {
 			gettimeofday(&curtime, NULL);
 			if(ch != ERR || (curtime.tv_sec - oldtime.tv_sec) >= delay) {
-				clear();
+				erase();
 				top();
 				oldtime = curtime;
 				refresh();

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XG-0000Y6-T3; Fri, 02 Nov 2012 05:11:14 +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 1TU9XF-0000XU-GE
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:13 +0000
Received: from [85.158.138.51:37627] by server-11.bemta-3.messagelabs.com id
	DF/D7-19361-0F553905; Fri, 02 Nov 2012 05:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1351833070!28329689!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3441 invoked from network); 2 Nov 2012 05:11:11 -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;
	2 Nov 2012 05: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 1TU9XC-0000eo-MN
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XC-0006LQ-I4
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:10 +0000
Message-Id: <E1TU9XC-0006LQ-I4@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:10 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxl: handle errors from
	xc_sharing_* info functions
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351266018 -3600
# Node ID 051e2a30e3fb1f37a71905153c1dc92b844da413
# Parent  c23d938e3e6401e75b0b11e04f9c7815208dd906
libxl: handle errors from xc_sharing_* info functions

On a 32 bit hypervisor xl info currently reports:
sharing_freed_memory   : 72057594037927935
sharing_used_memory    : 72057594037927935

Eat the ENOSYS and turn it into 0. Log and propagate other errors.

I don't have a 32 bit system handy, so tested on x86_64 with a libxc
hacked to return -ENOSYS and -EINVAL.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 25894:95a971c8058f
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r c23d938e3e64 -r 051e2a30e3fb tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Oct 26 16:40:12 2012 +0100
+++ b/tools/libxl/libxl.c	Fri Oct 26 16:40:18 2012 +0100
@@ -3622,6 +3622,7 @@ int libxl_get_physinfo(libxl_ctx *ctx, l
 {
     xc_physinfo_t xcphysinfo = { 0 };
     int rc;
+    long l;
 
     rc = xc_physinfo(ctx->xch, &xcphysinfo);
     if (rc != 0) {
@@ -3636,8 +3637,24 @@ int libxl_get_physinfo(libxl_ctx *ctx, l
     physinfo->total_pages = xcphysinfo.total_pages;
     physinfo->free_pages = xcphysinfo.free_pages;
     physinfo->scrub_pages = xcphysinfo.scrub_pages;
-    physinfo->sharing_freed_pages = xc_sharing_freed_pages(ctx->xch);
-    physinfo->sharing_used_frames = xc_sharing_used_frames(ctx->xch);
+    l = xc_sharing_freed_pages(ctx->xch);
+    if (l == -ENOSYS) {
+        l = 0;
+    } else if (l < 0) {
+        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, l,
+                            "getting sharing freed pages");
+        return ERROR_FAIL;
+    }
+    physinfo->sharing_freed_pages = l;
+    l = xc_sharing_used_frames(ctx->xch);
+    if (l == -ENOSYS) {
+        l = 0;
+    } else if (l < 0) {
+        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, l,
+                            "getting sharing used frames");
+        return ERROR_FAIL;
+    }
+    physinfo->sharing_used_frames = l;
     physinfo->nr_nodes = xcphysinfo.nr_nodes;
     memcpy(physinfo->hw_cap,xcphysinfo.hw_cap, sizeof(physinfo->hw_cap));
 

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XF-0000Xc-Mn; Fri, 02 Nov 2012 05:11:13 +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 1TU9XE-0000XP-HN
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:12 +0000
Received: from [193.109.254.147:29051] by server-15.bemta-14.messagelabs.com
	id E4/C5-12105-FE553905; Fri, 02 Nov 2012 05:11:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1351833070!3670673!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23732 invoked from network); 2 Nov 2012 05:11:11 -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;
	2 Nov 2012 05: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 1TU9XB-0000ei-SE
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XB-0006Kw-Ef
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:09 +0000
Message-Id: <E1TU9XB-0006Kw-Ef@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:08 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxl: fix error message in
	device_backend_callback
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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@citrix.com>
# Date 1351266005 -3600
# Node ID cd0ae0ba4653ab4d35a8b06db6e0a40b65065575
# Parent  537776f51f79c5789d06f97b363596a197c3e71c
libxl: fix error message in device_backend_callback

device_backend_callback error path always says "unable to disconnect",
but this can also happen during the connection of a device. Fix the
error message using the information in aodev->action.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 25838:2f418851f36d
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 537776f51f79 -r cd0ae0ba4653 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Fri Oct 26 16:10:55 2012 +0100
+++ b/tools/libxl/libxl_device.c	Fri Oct 26 16:40:05 2012 +0100
@@ -854,7 +854,8 @@ static void device_backend_callback(libx
     }
 
     if (rc) {
-        LOG(ERROR, "unable to disconnect device with path %s",
+        LOG(ERROR, "unable to %s device with path %s",
+                   aodev->action == DEVICE_CONNECT ? "connect" : "disconnect",
                    libxl__device_backend_path(gc, aodev->dev));
         goto out;
     }

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XI-0000Yh-6h; Fri, 02 Nov 2012 05:11: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 1TU9XG-0000Xo-Dr
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:14 +0000
Received: from [85.158.139.211:10597] by server-6.bemta-5.messagelabs.com id
	B7/BA-19321-1F553905; Fri, 02 Nov 2012 05:11:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-206.messagelabs.com!1351833071!18567533!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12942 invoked from network); 2 Nov 2012 05:11:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2012 05: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 1TU9XD-0000eu-Pa
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XD-0006Lx-Kx
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:11 +0000
Message-Id: <E1TU9XD-0006Lx-Kx@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:11 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xl: error if vif backend!=0 is
	used with run_hotplug_scripts
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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@citrix.com>
# Date 1351266032 -3600
# Node ID 27312134166b0596f5de8ce0b9e7dd7c094fad68
# Parent  6fca80608511ca4c92975ed316a75478a0f317a8
xl: error if vif backend!=0 is used with run_hotplug_scripts

Print an error and exit if backend!=0 is used in conjunction with
run_hotplug_scripts. Currently libxl can only execute hotplug scripts
from the toolstack domain (the same domain xl is running from).

Added a description and workaround of this issue on
xl-network-configuration.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 25897:ff6d94944039
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 6fca80608511 -r 27312134166b docs/misc/xl-network-configuration.markdown
--- a/docs/misc/xl-network-configuration.markdown	Fri Oct 26 16:40:24 2012 +0100
+++ b/docs/misc/xl-network-configuration.markdown	Fri Oct 26 16:40:32 2012 +0100
@@ -122,8 +122,10 @@ specified IP address to be used by the g
 ### backend
 
 Specifies the backend domain which this device should attach to. This
-defaults to domain 0. Specifying another domain requires setting up a
-driver domain which is outside the scope of this document.
+defaults to domain 0. This option does not work if `run_hotplug_scripts`
+is not disabled in xl.conf (see xl.conf(5) man page for more information
+on this option). Specifying another domain requires setting up a driver
+domain which is outside the scope of this document.
 
 ### rate
 
diff -r 6fca80608511 -r 27312134166b tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Fri Oct 26 16:40:24 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Fri Oct 26 16:40:32 2012 +0100
@@ -1096,6 +1096,13 @@ static void parse_config_data(const char
                         fprintf(stderr, "Specified backend domain does not exist, defaulting to Dom0\n");
                         nic->backend_domid = 0;
                     }
+                    if (nic->backend_domid != 0 && run_hotplug_scripts) {
+                        fprintf(stderr, "ERROR: the vif 'backend=' option "
+                                "cannot be used in conjunction with "
+                                "run_hotplug_scripts, please set "
+                                "run_hotplug_scripts to 0 in xl.conf\n");
+                        exit(EXIT_FAILURE);
+                    }
                 } else if (!strcmp(p, "rate")) {
                     parse_vif_rate(&config, (p2 + 1), nic);
                 } else if (!strcmp(p, "accel")) {

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XJ-0000ZI-Ec; Fri, 02 Nov 2012 05:11:17 +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 1TU9XI-0000XU-5z
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:16 +0000
Received: from [85.158.138.51:39716] by server-11.bemta-3.messagelabs.com id
	29/E7-19361-3F553905; Fri, 02 Nov 2012 05:11:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1351833074!22030038!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21096 invoked from network); 2 Nov 2012 05:11:15 -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;
	2 Nov 2012 05: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 1TU9XF-0000f6-Tn
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XF-0006Mv-Pg
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:13 +0000
Message-Id: <E1TU9XF-0006Mv-Pg@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:13 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xl: resume the domain on suspend
	failure
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Bastian Blank <waldi@debian.org>
# Date 1351266130 -3600
# Node ID 1ecde3c0276481c371a42980b569c3fb78e108f1
# Parent  7e91c668bae279dc7e839ad37550e709153e6af8
xl: resume the domain on suspend failure

The MUST macro calls exit(3) on failure but we need to cleanup and
resume.

Signed-off-by: Bastian Blank <waldi@debian.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 25942:16ee1d300cfd
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 7e91c668bae2 -r 1ecde3c02764 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Fri Oct 26 16:41:57 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Fri Oct 26 16:42:10 2012 +0100
@@ -2997,15 +2997,18 @@ static int save_domain(const char *p, co
 
     save_domain_core_writeconfig(fd, filename, config_data, config_len);
 
-    MUST(libxl_domain_suspend(ctx, domid, fd, 0, NULL));
+    int rc = libxl_domain_suspend(ctx, domid, fd, 0, NULL);
     close(fd);
 
-    if (checkpoint)
+    if (rc < 0)
+        fprintf(stderr, "Failed to save domain, resuming domain\n");
+
+    if (checkpoint || rc < 0)
         libxl_domain_resume(ctx, domid, 1, 0);
     else
         libxl_domain_destroy(ctx, domid, 0);
 
-    exit(0);
+    exit(rc < 0 ? 1 : 0);
 }
 
 static pid_t create_migration_child(const char *rune, int *send_fd,

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XF-0000Xc-Mn; Fri, 02 Nov 2012 05:11:13 +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 1TU9XE-0000XP-HN
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:12 +0000
Received: from [193.109.254.147:29051] by server-15.bemta-14.messagelabs.com
	id E4/C5-12105-FE553905; Fri, 02 Nov 2012 05:11:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1351833070!3670673!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23732 invoked from network); 2 Nov 2012 05:11:11 -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;
	2 Nov 2012 05: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 1TU9XB-0000ei-SE
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XB-0006Kw-Ef
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:09 +0000
Message-Id: <E1TU9XB-0006Kw-Ef@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:08 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxl: fix error message in
	device_backend_callback
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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@citrix.com>
# Date 1351266005 -3600
# Node ID cd0ae0ba4653ab4d35a8b06db6e0a40b65065575
# Parent  537776f51f79c5789d06f97b363596a197c3e71c
libxl: fix error message in device_backend_callback

device_backend_callback error path always says "unable to disconnect",
but this can also happen during the connection of a device. Fix the
error message using the information in aodev->action.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 25838:2f418851f36d
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 537776f51f79 -r cd0ae0ba4653 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Fri Oct 26 16:10:55 2012 +0100
+++ b/tools/libxl/libxl_device.c	Fri Oct 26 16:40:05 2012 +0100
@@ -854,7 +854,8 @@ static void device_backend_callback(libx
     }
 
     if (rc) {
-        LOG(ERROR, "unable to disconnect device with path %s",
+        LOG(ERROR, "unable to %s device with path %s",
+                   aodev->action == DEVICE_CONNECT ? "connect" : "disconnect",
                    libxl__device_backend_path(gc, aodev->dev));
         goto out;
     }

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XI-0000Yh-6h; Fri, 02 Nov 2012 05:11: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 1TU9XG-0000Xo-Dr
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:14 +0000
Received: from [85.158.139.211:10597] by server-6.bemta-5.messagelabs.com id
	B7/BA-19321-1F553905; Fri, 02 Nov 2012 05:11:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-206.messagelabs.com!1351833071!18567533!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12942 invoked from network); 2 Nov 2012 05:11:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2012 05: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 1TU9XD-0000eu-Pa
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XD-0006Lx-Kx
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:11 +0000
Message-Id: <E1TU9XD-0006Lx-Kx@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:11 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xl: error if vif backend!=0 is
	used with run_hotplug_scripts
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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@citrix.com>
# Date 1351266032 -3600
# Node ID 27312134166b0596f5de8ce0b9e7dd7c094fad68
# Parent  6fca80608511ca4c92975ed316a75478a0f317a8
xl: error if vif backend!=0 is used with run_hotplug_scripts

Print an error and exit if backend!=0 is used in conjunction with
run_hotplug_scripts. Currently libxl can only execute hotplug scripts
from the toolstack domain (the same domain xl is running from).

Added a description and workaround of this issue on
xl-network-configuration.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 25897:ff6d94944039
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 6fca80608511 -r 27312134166b docs/misc/xl-network-configuration.markdown
--- a/docs/misc/xl-network-configuration.markdown	Fri Oct 26 16:40:24 2012 +0100
+++ b/docs/misc/xl-network-configuration.markdown	Fri Oct 26 16:40:32 2012 +0100
@@ -122,8 +122,10 @@ specified IP address to be used by the g
 ### backend
 
 Specifies the backend domain which this device should attach to. This
-defaults to domain 0. Specifying another domain requires setting up a
-driver domain which is outside the scope of this document.
+defaults to domain 0. This option does not work if `run_hotplug_scripts`
+is not disabled in xl.conf (see xl.conf(5) man page for more information
+on this option). Specifying another domain requires setting up a driver
+domain which is outside the scope of this document.
 
 ### rate
 
diff -r 6fca80608511 -r 27312134166b tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Fri Oct 26 16:40:24 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Fri Oct 26 16:40:32 2012 +0100
@@ -1096,6 +1096,13 @@ static void parse_config_data(const char
                         fprintf(stderr, "Specified backend domain does not exist, defaulting to Dom0\n");
                         nic->backend_domid = 0;
                     }
+                    if (nic->backend_domid != 0 && run_hotplug_scripts) {
+                        fprintf(stderr, "ERROR: the vif 'backend=' option "
+                                "cannot be used in conjunction with "
+                                "run_hotplug_scripts, please set "
+                                "run_hotplug_scripts to 0 in xl.conf\n");
+                        exit(EXIT_FAILURE);
+                    }
                 } else if (!strcmp(p, "rate")) {
                     parse_vif_rate(&config, (p2 + 1), nic);
                 } else if (!strcmp(p, "accel")) {

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XG-0000Y6-T3; Fri, 02 Nov 2012 05:11:14 +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 1TU9XF-0000XU-GE
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:13 +0000
Received: from [85.158.138.51:37627] by server-11.bemta-3.messagelabs.com id
	DF/D7-19361-0F553905; Fri, 02 Nov 2012 05:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1351833070!28329689!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3441 invoked from network); 2 Nov 2012 05:11:11 -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;
	2 Nov 2012 05: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 1TU9XC-0000eo-MN
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XC-0006LQ-I4
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:10 +0000
Message-Id: <E1TU9XC-0006LQ-I4@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:10 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxl: handle errors from
	xc_sharing_* info functions
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351266018 -3600
# Node ID 051e2a30e3fb1f37a71905153c1dc92b844da413
# Parent  c23d938e3e6401e75b0b11e04f9c7815208dd906
libxl: handle errors from xc_sharing_* info functions

On a 32 bit hypervisor xl info currently reports:
sharing_freed_memory   : 72057594037927935
sharing_used_memory    : 72057594037927935

Eat the ENOSYS and turn it into 0. Log and propagate other errors.

I don't have a 32 bit system handy, so tested on x86_64 with a libxc
hacked to return -ENOSYS and -EINVAL.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 25894:95a971c8058f
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r c23d938e3e64 -r 051e2a30e3fb tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Oct 26 16:40:12 2012 +0100
+++ b/tools/libxl/libxl.c	Fri Oct 26 16:40:18 2012 +0100
@@ -3622,6 +3622,7 @@ int libxl_get_physinfo(libxl_ctx *ctx, l
 {
     xc_physinfo_t xcphysinfo = { 0 };
     int rc;
+    long l;
 
     rc = xc_physinfo(ctx->xch, &xcphysinfo);
     if (rc != 0) {
@@ -3636,8 +3637,24 @@ int libxl_get_physinfo(libxl_ctx *ctx, l
     physinfo->total_pages = xcphysinfo.total_pages;
     physinfo->free_pages = xcphysinfo.free_pages;
     physinfo->scrub_pages = xcphysinfo.scrub_pages;
-    physinfo->sharing_freed_pages = xc_sharing_freed_pages(ctx->xch);
-    physinfo->sharing_used_frames = xc_sharing_used_frames(ctx->xch);
+    l = xc_sharing_freed_pages(ctx->xch);
+    if (l == -ENOSYS) {
+        l = 0;
+    } else if (l < 0) {
+        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, l,
+                            "getting sharing freed pages");
+        return ERROR_FAIL;
+    }
+    physinfo->sharing_freed_pages = l;
+    l = xc_sharing_used_frames(ctx->xch);
+    if (l == -ENOSYS) {
+        l = 0;
+    } else if (l < 0) {
+        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, l,
+                            "getting sharing used frames");
+        return ERROR_FAIL;
+    }
+    physinfo->sharing_used_frames = l;
     physinfo->nr_nodes = xcphysinfo.nr_nodes;
     memcpy(physinfo->hw_cap,xcphysinfo.hw_cap, sizeof(physinfo->hw_cap));
 

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XK-0000Zh-Jq; Fri, 02 Nov 2012 05:11: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 1TU9XI-0000Xo-H1
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:16 +0000
Received: from [85.158.139.211:10649] by server-6.bemta-5.messagelabs.com id
	01/CA-19321-4F553905; Fri, 02 Nov 2012 05:11:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-206.messagelabs.com!1351833074!18567537!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12962 invoked from network); 2 Nov 2012 05:11:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2012 05: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 1TU9XG-0000f9-EN
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XG-0006NA-D8
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:14 +0000
Message-Id: <E1TU9XG-0006NA-D8@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:13 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] docs: Document scheduler-related
	Xen command-line 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: "Change log for Mercurial \(receive only\)"
	<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 1351266143 -3600
# Node ID 325a4fdb7f3588b05b35475766e588bfa08c12ff
# Parent  1ecde3c0276481c371a42980b569c3fb78e108f1
docs: Document scheduler-related Xen command-line options

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

xen-unstable changeset: 25968:91e8fd3cf266
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 1ecde3c02764 -r 325a4fdb7f35 docs/misc/xen-command-line.markdown
--- a/docs/misc/xen-command-line.markdown	Fri Oct 26 16:42:10 2012 +0100
+++ b/docs/misc/xen-command-line.markdown	Fri Oct 26 16:42:23 2012 +0100
@@ -701,12 +701,34 @@ Choose the default scheduler.
 ### sched\_credit\_tslice\_ms
 > `= <integer>`
 
+Set the timeslice of the credit1 scheduler, in milliseconds.  The
+default is 30ms.  Reasonable values may include 10, 5, or even 1 for
+very latency-sensitive workloads.
+
 ### sched\_ratelimit\_us
 > `= <integer>`
 
+In order to limit the rate of context switching, set the minimum
+amount of time that a vcpu can be scheduled for before preempting it,
+in microseconds.  The default is 1000us (1ms).  Setting this to 0
+disables it altogether.
+
 ### sched\_smt\_power\_savings
 > `= <boolean>`
 
+Normally Xen will try to maximize performance and cache utilization by
+spreading out vcpus across as many different divisions as possible
+(i.e, numa nodes, sockets, cores threads, &c).  This often maximizes
+throughput, but also maximizes energy usage, since it reduces the
+depth to which a processor can sleep.
+
+This option inverts the logic, so that the scheduler in effect tries
+to keep the vcpus on the smallest amount of silicon possible; i.e.,
+first fill up sibling threads, then sibling cores, then sibling
+sockets, &c.  This will reduce performance somewhat, particularly on
+systems with hyperthreading enabled, but should reduce power by
+enabling more sockets and cores to go into deeper sleep states.
+
 ### serial\_tx\_buffer
 > `= <size>`
 

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XL-0000aR-Pl; Fri, 02 Nov 2012 05:11:19 +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 1TU9XK-0000ZW-FF
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:18 +0000
Received: from [85.158.138.51:4353] by server-7.bemta-3.messagelabs.com id
	82/C7-01713-5F553905; Fri, 02 Nov 2012 05:11:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1351833075!28329694!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=1.4 required=7.0 tests=INFO_TLD
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3486 invoked from network); 2 Nov 2012 05:11:16 -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;
	2 Nov 2012 05:11: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 1TU9XH-0000fF-Fk
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XH-0006OA-ER
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:15 +0000
Message-Id: <E1TU9XH-0006OA-ER@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:14 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxl/qemu-xen: use
	cache=writeback for IDE and SCSI
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1351266192 -3600
# Node ID 9c0101d79839656cce28928d57e95ec6b4ab5841
# Parent  87900aea9c6b5528e898ed67f621531451fb1740
libxl/qemu-xen: use cache=writeback for IDE and SCSI

Change caching mode from writethrough to writeback for upstream QEMU.

After a lengthy discussion, we came up with the conclusion that
WRITEBACK is OK for IDE.
See: http://marc.info/?l=xen-devel&m=133311527009773

Given that the same reasons apply to SCSI as well, change to writeback
for SCSI too.

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

xen-unstable changeset: 25989:0807d1f7773d
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 87900aea9c6b -r 9c0101d79839 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Fri Oct 26 16:42:57 2012 +0100
+++ b/tools/libxl/libxl_dm.c	Fri Oct 26 16:43:12 2012 +0100
@@ -549,10 +549,10 @@ static char ** libxl__build_device_model
             if (disks[i].is_cdrom) {
                 if (disks[i].format == LIBXL_DISK_FORMAT_EMPTY)
                     drive = libxl__sprintf
-                        (gc, "if=ide,index=%d,media=cdrom", disk);
+                        (gc, "if=ide,index=%d,media=cdrom,cache=writeback", disk);
                 else
                     drive = libxl__sprintf
-                        (gc, "file=%s,if=ide,index=%d,media=cdrom,format=%s",
+                        (gc, "file=%s,if=ide,index=%d,media=cdrom,format=%s,cache=writeback",
                          disks[i].pdev_path, disk, format);
             } else {
                 if (disks[i].format == LIBXL_DISK_FORMAT_EMPTY) {
@@ -575,11 +575,11 @@ static char ** libxl__build_device_model
                  */
                 if (strncmp(disks[i].vdev, "sd", 2) == 0)
                     drive = libxl__sprintf
-                        (gc, "file=%s,if=scsi,bus=0,unit=%d,format=%s",
+                        (gc, "file=%s,if=scsi,bus=0,unit=%d,format=%s,cache=writeback",
                          disks[i].pdev_path, disk, format);
                 else if (disk < 4)
                     drive = libxl__sprintf
-                        (gc, "file=%s,if=ide,index=%d,media=disk,format=%s",
+                        (gc, "file=%s,if=ide,index=%d,media=disk,format=%s,cache=writeback",
                          disks[i].pdev_path, disk, format);
                 else
                     continue; /* Do not emulate this disk */

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XH-0000YG-1z; Fri, 02 Nov 2012 05:11:15 +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 1TU9XF-0000Xa-Ui
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:14 +0000
Received: from [85.158.138.51:37645] by server-4.bemta-3.messagelabs.com id
	70/F1-30023-1F553905; Fri, 02 Nov 2012 05:11:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1351833071!28442715!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20281 invoked from network); 2 Nov 2012 05:11:12 -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;
	2 Nov 2012 05: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 1TU9XD-0000er-7T
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XD-0006Lg-3A
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:11 +0000
Message-Id: <E1TU9XD-0006Lg-3A@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:10 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxl: fix usage of backend
	parameter and run_hotplug_scripts
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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@citrix.com>
# Date 1351266024 -3600
# Node ID 6fca80608511ca4c92975ed316a75478a0f317a8
# Parent  051e2a30e3fb1f37a71905153c1dc92b844da413
libxl: fix usage of backend parameter and run_hotplug_scripts

vif interfaces allows the user to specify the domain that should run
the backend (also known as driver domain) using the 'backend'
parameter. This is not compatible with run_hotplug_scripts=1, since
libxl can only run the hotplug scripts from the Domain 0.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 25896:259c4e9d8adf
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 051e2a30e3fb -r 6fca80608511 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Oct 26 16:40:18 2012 +0100
+++ b/tools/libxl/libxl.c	Fri Oct 26 16:40:24 2012 +0100
@@ -2476,6 +2476,8 @@ out:
 int libxl__device_nic_setdefault(libxl__gc *gc, libxl_device_nic *nic,
                                  uint32_t domid)
 {
+    int run_hotplug_scripts;
+
     if (!nic->mtu)
         nic->mtu = 1492;
     if (!nic->model) {
@@ -2505,6 +2507,18 @@ int libxl__device_nic_setdefault(libxl__
                                   libxl__xen_script_dir_path()) < 0 )
         return ERROR_FAIL;
 
+    run_hotplug_scripts = libxl__hotplug_settings(gc, XBT_NULL);
+    if (run_hotplug_scripts < 0) {
+        LOG(ERROR, "unable to get current hotplug scripts execution setting");
+        return run_hotplug_scripts;
+    }
+    if (nic->backend_domid != LIBXL_TOOLSTACK_DOMID && run_hotplug_scripts) {
+        LOG(ERROR, "cannot use a backend domain different than %d if"
+                   "hotplug scripts are executed from libxl",
+                   LIBXL_TOOLSTACK_DOMID);
+        return ERROR_FAIL;
+    }
+
     switch (libxl__domain_type(gc, domid)) {
     case LIBXL_DOMAIN_TYPE_HVM:
         if (!nic->nictype)

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XF-0000Xl-PE; Fri, 02 Nov 2012 05:11:13 +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 1TU9XE-0000XO-JQ
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:13 +0000
Received: from [85.158.138.51:4240] by server-12.bemta-3.messagelabs.com id
	47/0F-22757-FE553905; Fri, 02 Nov 2012 05:11:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-174.messagelabs.com!1351833069!28423417!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2665 invoked from network); 2 Nov 2012 05:11:10 -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;
	2 Nov 2012 05: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 1TU9XB-0000ef-94
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XA-0006Kh-RP
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:08 +0000
Message-Id: <E1TU9XA-0006Kh-RP@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:08 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxc: builder: limit maximum
	size of kernel/ramdisk.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351264255 -3600
# Node ID 537776f51f79c5789d06f97b363596a197c3e71c
# Parent  40ccbee890e1fc053de3046bbc3d13b8ff6f5d63
libxc: builder: limit maximum size of kernel/ramdisk.

Allowing user supplied kernels of arbitrary sizes, especially during
decompression, can swallow up dom0 memory leading to either virtual
address space exhaustion in the builder process or allocation
failures/OOM killing of both toolstack and unrelated processes.

We disable these checks when building in a stub domain for pvgrub
since this uses the guest's own memory and is isolated.

Decompression of gzip compressed kernels and ramdisks has been safe
since 14954:58205257517d (Xen 3.1.0 onwards).

This is XSA-25 / CVE-2012-4544.

Also make explicit checks for buffer overflows in various
decompression routines. These were already ruled out due to other
properties of the code but check them as a belt-and-braces measure.

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


diff -r 40ccbee890e1 -r 537776f51f79 stubdom/grub/kexec.c
--- a/stubdom/grub/kexec.c	Thu Oct 25 15:36:32 2012 +0200
+++ b/stubdom/grub/kexec.c	Fri Oct 26 16:10:55 2012 +0100
@@ -137,6 +137,10 @@ void kexec(void *kernel, long kernel_siz
     dom = xc_dom_allocate(xc_handle, cmdline, features);
     dom->allocate = kexec_allocate;
 
+    /* We are using guest owned memory, therefore no limits. */
+    xc_dom_kernel_max_size(dom, 0);
+    xc_dom_ramdisk_max_size(dom, 0);
+
     dom->kernel_blob = kernel;
     dom->kernel_size = kernel_size;
 
diff -r 40ccbee890e1 -r 537776f51f79 tools/libxc/xc_dom.h
--- a/tools/libxc/xc_dom.h	Thu Oct 25 15:36:32 2012 +0200
+++ b/tools/libxc/xc_dom.h	Fri Oct 26 16:10:55 2012 +0100
@@ -55,6 +55,9 @@ struct xc_dom_image {
     void *ramdisk_blob;
     size_t ramdisk_size;
 
+    size_t max_kernel_size;
+    size_t max_ramdisk_size;
+
     /* arguments and parameters */
     char *cmdline;
     uint32_t f_requested[XENFEAT_NR_SUBMAPS];
@@ -180,6 +183,23 @@ void xc_dom_release_phys(struct xc_dom_i
 void xc_dom_release(struct xc_dom_image *dom);
 int xc_dom_mem_init(struct xc_dom_image *dom, unsigned int mem_mb);
 
+/* Set this larger if you have enormous ramdisks/kernels. Note that
+ * you should trust all kernels not to be maliciously large (e.g. to
+ * exhaust all dom0 memory) if you do this (see CVE-2012-4544 /
+ * XSA-25). You can also set the default independently for
+ * ramdisks/kernels in xc_dom_allocate() or call
+ * xc_dom_{kernel,ramdisk}_max_size.
+ */
+#ifndef XC_DOM_DECOMPRESS_MAX
+#define XC_DOM_DECOMPRESS_MAX (1024*1024*1024) /* 1GB */
+#endif
+
+int xc_dom_kernel_check_size(struct xc_dom_image *dom, size_t sz);
+int xc_dom_kernel_max_size(struct xc_dom_image *dom, size_t sz);
+
+int xc_dom_ramdisk_check_size(struct xc_dom_image *dom, size_t sz);
+int xc_dom_ramdisk_max_size(struct xc_dom_image *dom, size_t sz);
+
 size_t xc_dom_check_gzip(xc_interface *xch,
                      void *blob, size_t ziplen);
 int xc_dom_do_gunzip(xc_interface *xch,
@@ -240,7 +260,8 @@ void xc_dom_log_memory_footprint(struct 
 void *xc_dom_malloc(struct xc_dom_image *dom, size_t size);
 void *xc_dom_malloc_page_aligned(struct xc_dom_image *dom, size_t size);
 void *xc_dom_malloc_filemap(struct xc_dom_image *dom,
-                            const char *filename, size_t * size);
+                            const char *filename, size_t * size,
+                            const size_t max_size);
 char *xc_dom_strdup(struct xc_dom_image *dom, const char *str);
 
 /* --- alloc memory pool ------------------------------------------- */
diff -r 40ccbee890e1 -r 537776f51f79 tools/libxc/xc_dom_bzimageloader.c
--- a/tools/libxc/xc_dom_bzimageloader.c	Thu Oct 25 15:36:32 2012 +0200
+++ b/tools/libxc/xc_dom_bzimageloader.c	Fri Oct 26 16:10:55 2012 +0100
@@ -47,13 +47,19 @@ static int xc_try_bzip2_decode(
     char *out_buf;
     char *tmp_buf;
     int retval = -1;
-    int outsize;
+    unsigned int outsize;
     uint64_t total;
 
     stream.bzalloc = NULL;
     stream.bzfree = NULL;
     stream.opaque = NULL;
 
+    if ( dom->kernel_size == 0)
+    {
+        DOMPRINTF("BZIP2: Input is 0 size");
+        return -1;
+    }
+
     ret = BZ2_bzDecompressInit(&stream, 0, 0);
     if ( ret != BZ_OK )
     {
@@ -66,6 +72,17 @@ static int xc_try_bzip2_decode(
      * the input buffer to start, and we'll realloc as needed.
      */
     outsize = dom->kernel_size;
+
+    /*
+     * stream.avail_in and outsize are unsigned int, while kernel_size
+     * is a size_t. Check we aren't overflowing.
+     */
+    if ( outsize != dom->kernel_size )
+    {
+        DOMPRINTF("BZIP2: Input too large");
+        goto bzip2_cleanup;
+    }
+
     out_buf = malloc(outsize);
     if ( out_buf == NULL )
     {
@@ -98,13 +115,20 @@ static int xc_try_bzip2_decode(
         if ( stream.avail_out == 0 )
         {
             /* Protect against output buffer overflow */
-            if ( outsize > INT_MAX / 2 )
+            if ( outsize > UINT_MAX / 2 )
             {
                 DOMPRINTF("BZIP2: output buffer overflow");
                 free(out_buf);
                 goto bzip2_cleanup;
             }
 
+            if ( xc_dom_kernel_check_size(dom, outsize * 2) )
+            {
+                DOMPRINTF("BZIP2: output too large");
+                free(out_buf);
+                goto bzip2_cleanup;
+            }
+
             tmp_buf = realloc(out_buf, outsize * 2);
             if ( tmp_buf == NULL )
             {
@@ -172,9 +196,15 @@ static int _xc_try_lzma_decode(
     unsigned char *out_buf;
     unsigned char *tmp_buf;
     int retval = -1;
-    int outsize;
+    size_t outsize;
     const char *msg;
 
+    if ( dom->kernel_size == 0)
+    {
+        DOMPRINTF("%s: Input is 0 size", what);
+        return -1;
+    }
+
     /* sigh.  We don't know up-front how much memory we are going to need
      * for the output buffer.  Allocate the output buffer to be equal
      * the input buffer to start, and we'll realloc as needed.
@@ -244,13 +274,20 @@ static int _xc_try_lzma_decode(
         if ( stream->avail_out == 0 )
         {
             /* Protect against output buffer overflow */
-            if ( outsize > INT_MAX / 2 )
+            if ( outsize > SIZE_MAX / 2 )
             {
                 DOMPRINTF("%s: output buffer overflow", what);
                 free(out_buf);
                 goto lzma_cleanup;
             }
 
+            if ( xc_dom_kernel_check_size(dom, outsize * 2) )
+            {
+                DOMPRINTF("%s: output too large", what);
+                free(out_buf);
+                goto lzma_cleanup;
+            }
+
             tmp_buf = realloc(out_buf, outsize * 2);
             if ( tmp_buf == NULL )
             {
@@ -359,6 +396,12 @@ static int xc_try_lzo1x_decode(
         0x89, 0x4c, 0x5a, 0x4f, 0x00, 0x0d, 0x0a, 0x1a, 0x0a
     };
 
+    /*
+     * lzo_uint should match size_t. Check that this is the case to be
+     * sure we won't overflow various lzo_uint fields.
+     */
+    XC_BUILD_BUG_ON(sizeof(lzo_uint) != sizeof(size_t));
+
     ret = lzo_init();
     if ( ret != LZO_E_OK )
     {
@@ -438,6 +481,14 @@ static int xc_try_lzo1x_decode(
         if ( src_len <= 0 || src_len > dst_len || src_len > left )
             break;
 
+        msg = "Output buffer overflow";
+        if ( *size > SIZE_MAX - dst_len )
+            break;
+
+        msg = "Decompressed image too large";
+        if ( xc_dom_kernel_check_size(dom, *size + dst_len) )
+            break;
+
         msg = "Failed to (re)alloc memory";
         tmp_buf = realloc(out_buf, *size + dst_len);
         if ( tmp_buf == NULL )
diff -r 40ccbee890e1 -r 537776f51f79 tools/libxc/xc_dom_core.c
--- a/tools/libxc/xc_dom_core.c	Thu Oct 25 15:36:32 2012 +0200
+++ b/tools/libxc/xc_dom_core.c	Fri Oct 26 16:10:55 2012 +0100
@@ -159,7 +159,8 @@ void *xc_dom_malloc_page_aligned(struct 
 }
 
 void *xc_dom_malloc_filemap(struct xc_dom_image *dom,
-                            const char *filename, size_t * size)
+                            const char *filename, size_t * size,
+                            const size_t max_size)
 {
     struct xc_dom_mem *block = NULL;
     int fd = -1;
@@ -171,6 +172,13 @@ void *xc_dom_malloc_filemap(struct xc_do
     lseek(fd, 0, SEEK_SET);
     *size = lseek(fd, 0, SEEK_END);
 
+    if ( max_size && *size > max_size )
+    {
+        xc_dom_panic(dom->xch, XC_OUT_OF_MEMORY,
+                     "tried to map file which is too large");
+        goto err;
+    }
+
     block = malloc(sizeof(*block));
     if ( block == NULL )
         goto err;
@@ -222,6 +230,40 @@ char *xc_dom_strdup(struct xc_dom_image 
 }
 
 /* ------------------------------------------------------------------------ */
+/* decompression buffer sizing                                              */
+int xc_dom_kernel_check_size(struct xc_dom_image *dom, size_t sz)
+{
+    /* No limit */
+    if ( !dom->max_kernel_size )
+        return 0;
+
+    if ( sz > dom->max_kernel_size )
+    {
+        xc_dom_panic(dom->xch, XC_INVALID_KERNEL,
+                     "kernel image too large");
+        return 1;
+    }
+
+    return 0;
+}
+
+int xc_dom_ramdisk_check_size(struct xc_dom_image *dom, size_t sz)
+{
+    /* No limit */
+    if ( !dom->max_ramdisk_size )
+        return 0;
+
+    if ( sz > dom->max_ramdisk_size )
+    {
+        xc_dom_panic(dom->xch, XC_INVALID_KERNEL,
+                     "ramdisk image too large");
+        return 1;
+    }
+
+    return 0;
+}
+
+/* ------------------------------------------------------------------------ */
 /* read files, copy memory blocks, with transparent gunzip                  */
 
 size_t xc_dom_check_gzip(xc_interface *xch, void *blob, size_t ziplen)
@@ -235,7 +277,7 @@ size_t xc_dom_check_gzip(xc_interface *x
 
     gzlen = blob + ziplen - 4;
     unziplen = gzlen[3] << 24 | gzlen[2] << 16 | gzlen[1] << 8 | gzlen[0];
-    if ( (unziplen < 0) || (unziplen > (1024*1024*1024)) ) /* 1GB limit */
+    if ( (unziplen < 0) || (unziplen > XC_DOM_DECOMPRESS_MAX) )
     {
         xc_dom_printf
             (xch,
@@ -288,6 +330,9 @@ int xc_dom_try_gunzip(struct xc_dom_imag
     if ( unziplen == 0 )
         return 0;
 
+    if ( xc_dom_kernel_check_size(dom, unziplen) )
+        return 0;
+
     unzip = xc_dom_malloc(dom, unziplen);
     if ( unzip == NULL )
         return -1;
@@ -588,6 +633,9 @@ struct xc_dom_image *xc_dom_allocate(xc_
     memset(dom, 0, sizeof(*dom));
     dom->xch = xch;
 
+    dom->max_kernel_size = XC_DOM_DECOMPRESS_MAX;
+    dom->max_ramdisk_size = XC_DOM_DECOMPRESS_MAX;
+
     if ( cmdline )
         dom->cmdline = xc_dom_strdup(dom, cmdline);
     if ( features )
@@ -608,10 +656,25 @@ struct xc_dom_image *xc_dom_allocate(xc_
     return NULL;
 }
 
+int xc_dom_kernel_max_size(struct xc_dom_image *dom, size_t sz)
+{
+    DOMPRINTF("%s: kernel_max_size=%zx", __FUNCTION__, sz);
+    dom->max_kernel_size = sz;
+    return 0;
+}
+
+int xc_dom_ramdisk_max_size(struct xc_dom_image *dom, size_t sz)
+{
+    DOMPRINTF("%s: ramdisk_max_size=%zx", __FUNCTION__, sz);
+    dom->max_ramdisk_size = sz;
+    return 0;
+}
+
 int xc_dom_kernel_file(struct xc_dom_image *dom, const char *filename)
 {
     DOMPRINTF("%s: filename=\"%s\"", __FUNCTION__, filename);
-    dom->kernel_blob = xc_dom_malloc_filemap(dom, filename, &dom->kernel_size);
+    dom->kernel_blob = xc_dom_malloc_filemap(dom, filename, &dom->kernel_size,
+                                             dom->max_kernel_size);
     if ( dom->kernel_blob == NULL )
         return -1;
     return xc_dom_try_gunzip(dom, &dom->kernel_blob, &dom->kernel_size);
@@ -621,7 +684,9 @@ int xc_dom_ramdisk_file(struct xc_dom_im
 {
     DOMPRINTF("%s: filename=\"%s\"", __FUNCTION__, filename);
     dom->ramdisk_blob =
-        xc_dom_malloc_filemap(dom, filename, &dom->ramdisk_size);
+        xc_dom_malloc_filemap(dom, filename, &dom->ramdisk_size,
+                              dom->max_ramdisk_size);
+
     if ( dom->ramdisk_blob == NULL )
         return -1;
 //    return xc_dom_try_gunzip(dom, &dom->ramdisk_blob, &dom->ramdisk_size);
@@ -781,7 +846,11 @@ int xc_dom_build_image(struct xc_dom_ima
         void *ramdiskmap;
 
         unziplen = xc_dom_check_gzip(dom->xch, dom->ramdisk_blob, dom->ramdisk_size);
+        if ( xc_dom_ramdisk_check_size(dom, unziplen) != 0 )
+            unziplen = 0;
+
         ramdisklen = unziplen ? unziplen : dom->ramdisk_size;
+
         if ( xc_dom_alloc_segment(dom, &dom->ramdisk_seg, "ramdisk", 0,
                                   ramdisklen) != 0 )
             goto err;

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XF-0000Xl-PE; Fri, 02 Nov 2012 05:11:13 +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 1TU9XE-0000XO-JQ
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:13 +0000
Received: from [85.158.138.51:4240] by server-12.bemta-3.messagelabs.com id
	47/0F-22757-FE553905; Fri, 02 Nov 2012 05:11:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-174.messagelabs.com!1351833069!28423417!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2665 invoked from network); 2 Nov 2012 05:11:10 -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;
	2 Nov 2012 05: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 1TU9XB-0000ef-94
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XA-0006Kh-RP
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:08 +0000
Message-Id: <E1TU9XA-0006Kh-RP@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:08 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxc: builder: limit maximum
	size of kernel/ramdisk.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351264255 -3600
# Node ID 537776f51f79c5789d06f97b363596a197c3e71c
# Parent  40ccbee890e1fc053de3046bbc3d13b8ff6f5d63
libxc: builder: limit maximum size of kernel/ramdisk.

Allowing user supplied kernels of arbitrary sizes, especially during
decompression, can swallow up dom0 memory leading to either virtual
address space exhaustion in the builder process or allocation
failures/OOM killing of both toolstack and unrelated processes.

We disable these checks when building in a stub domain for pvgrub
since this uses the guest's own memory and is isolated.

Decompression of gzip compressed kernels and ramdisks has been safe
since 14954:58205257517d (Xen 3.1.0 onwards).

This is XSA-25 / CVE-2012-4544.

Also make explicit checks for buffer overflows in various
decompression routines. These were already ruled out due to other
properties of the code but check them as a belt-and-braces measure.

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


diff -r 40ccbee890e1 -r 537776f51f79 stubdom/grub/kexec.c
--- a/stubdom/grub/kexec.c	Thu Oct 25 15:36:32 2012 +0200
+++ b/stubdom/grub/kexec.c	Fri Oct 26 16:10:55 2012 +0100
@@ -137,6 +137,10 @@ void kexec(void *kernel, long kernel_siz
     dom = xc_dom_allocate(xc_handle, cmdline, features);
     dom->allocate = kexec_allocate;
 
+    /* We are using guest owned memory, therefore no limits. */
+    xc_dom_kernel_max_size(dom, 0);
+    xc_dom_ramdisk_max_size(dom, 0);
+
     dom->kernel_blob = kernel;
     dom->kernel_size = kernel_size;
 
diff -r 40ccbee890e1 -r 537776f51f79 tools/libxc/xc_dom.h
--- a/tools/libxc/xc_dom.h	Thu Oct 25 15:36:32 2012 +0200
+++ b/tools/libxc/xc_dom.h	Fri Oct 26 16:10:55 2012 +0100
@@ -55,6 +55,9 @@ struct xc_dom_image {
     void *ramdisk_blob;
     size_t ramdisk_size;
 
+    size_t max_kernel_size;
+    size_t max_ramdisk_size;
+
     /* arguments and parameters */
     char *cmdline;
     uint32_t f_requested[XENFEAT_NR_SUBMAPS];
@@ -180,6 +183,23 @@ void xc_dom_release_phys(struct xc_dom_i
 void xc_dom_release(struct xc_dom_image *dom);
 int xc_dom_mem_init(struct xc_dom_image *dom, unsigned int mem_mb);
 
+/* Set this larger if you have enormous ramdisks/kernels. Note that
+ * you should trust all kernels not to be maliciously large (e.g. to
+ * exhaust all dom0 memory) if you do this (see CVE-2012-4544 /
+ * XSA-25). You can also set the default independently for
+ * ramdisks/kernels in xc_dom_allocate() or call
+ * xc_dom_{kernel,ramdisk}_max_size.
+ */
+#ifndef XC_DOM_DECOMPRESS_MAX
+#define XC_DOM_DECOMPRESS_MAX (1024*1024*1024) /* 1GB */
+#endif
+
+int xc_dom_kernel_check_size(struct xc_dom_image *dom, size_t sz);
+int xc_dom_kernel_max_size(struct xc_dom_image *dom, size_t sz);
+
+int xc_dom_ramdisk_check_size(struct xc_dom_image *dom, size_t sz);
+int xc_dom_ramdisk_max_size(struct xc_dom_image *dom, size_t sz);
+
 size_t xc_dom_check_gzip(xc_interface *xch,
                      void *blob, size_t ziplen);
 int xc_dom_do_gunzip(xc_interface *xch,
@@ -240,7 +260,8 @@ void xc_dom_log_memory_footprint(struct 
 void *xc_dom_malloc(struct xc_dom_image *dom, size_t size);
 void *xc_dom_malloc_page_aligned(struct xc_dom_image *dom, size_t size);
 void *xc_dom_malloc_filemap(struct xc_dom_image *dom,
-                            const char *filename, size_t * size);
+                            const char *filename, size_t * size,
+                            const size_t max_size);
 char *xc_dom_strdup(struct xc_dom_image *dom, const char *str);
 
 /* --- alloc memory pool ------------------------------------------- */
diff -r 40ccbee890e1 -r 537776f51f79 tools/libxc/xc_dom_bzimageloader.c
--- a/tools/libxc/xc_dom_bzimageloader.c	Thu Oct 25 15:36:32 2012 +0200
+++ b/tools/libxc/xc_dom_bzimageloader.c	Fri Oct 26 16:10:55 2012 +0100
@@ -47,13 +47,19 @@ static int xc_try_bzip2_decode(
     char *out_buf;
     char *tmp_buf;
     int retval = -1;
-    int outsize;
+    unsigned int outsize;
     uint64_t total;
 
     stream.bzalloc = NULL;
     stream.bzfree = NULL;
     stream.opaque = NULL;
 
+    if ( dom->kernel_size == 0)
+    {
+        DOMPRINTF("BZIP2: Input is 0 size");
+        return -1;
+    }
+
     ret = BZ2_bzDecompressInit(&stream, 0, 0);
     if ( ret != BZ_OK )
     {
@@ -66,6 +72,17 @@ static int xc_try_bzip2_decode(
      * the input buffer to start, and we'll realloc as needed.
      */
     outsize = dom->kernel_size;
+
+    /*
+     * stream.avail_in and outsize are unsigned int, while kernel_size
+     * is a size_t. Check we aren't overflowing.
+     */
+    if ( outsize != dom->kernel_size )
+    {
+        DOMPRINTF("BZIP2: Input too large");
+        goto bzip2_cleanup;
+    }
+
     out_buf = malloc(outsize);
     if ( out_buf == NULL )
     {
@@ -98,13 +115,20 @@ static int xc_try_bzip2_decode(
         if ( stream.avail_out == 0 )
         {
             /* Protect against output buffer overflow */
-            if ( outsize > INT_MAX / 2 )
+            if ( outsize > UINT_MAX / 2 )
             {
                 DOMPRINTF("BZIP2: output buffer overflow");
                 free(out_buf);
                 goto bzip2_cleanup;
             }
 
+            if ( xc_dom_kernel_check_size(dom, outsize * 2) )
+            {
+                DOMPRINTF("BZIP2: output too large");
+                free(out_buf);
+                goto bzip2_cleanup;
+            }
+
             tmp_buf = realloc(out_buf, outsize * 2);
             if ( tmp_buf == NULL )
             {
@@ -172,9 +196,15 @@ static int _xc_try_lzma_decode(
     unsigned char *out_buf;
     unsigned char *tmp_buf;
     int retval = -1;
-    int outsize;
+    size_t outsize;
     const char *msg;
 
+    if ( dom->kernel_size == 0)
+    {
+        DOMPRINTF("%s: Input is 0 size", what);
+        return -1;
+    }
+
     /* sigh.  We don't know up-front how much memory we are going to need
      * for the output buffer.  Allocate the output buffer to be equal
      * the input buffer to start, and we'll realloc as needed.
@@ -244,13 +274,20 @@ static int _xc_try_lzma_decode(
         if ( stream->avail_out == 0 )
         {
             /* Protect against output buffer overflow */
-            if ( outsize > INT_MAX / 2 )
+            if ( outsize > SIZE_MAX / 2 )
             {
                 DOMPRINTF("%s: output buffer overflow", what);
                 free(out_buf);
                 goto lzma_cleanup;
             }
 
+            if ( xc_dom_kernel_check_size(dom, outsize * 2) )
+            {
+                DOMPRINTF("%s: output too large", what);
+                free(out_buf);
+                goto lzma_cleanup;
+            }
+
             tmp_buf = realloc(out_buf, outsize * 2);
             if ( tmp_buf == NULL )
             {
@@ -359,6 +396,12 @@ static int xc_try_lzo1x_decode(
         0x89, 0x4c, 0x5a, 0x4f, 0x00, 0x0d, 0x0a, 0x1a, 0x0a
     };
 
+    /*
+     * lzo_uint should match size_t. Check that this is the case to be
+     * sure we won't overflow various lzo_uint fields.
+     */
+    XC_BUILD_BUG_ON(sizeof(lzo_uint) != sizeof(size_t));
+
     ret = lzo_init();
     if ( ret != LZO_E_OK )
     {
@@ -438,6 +481,14 @@ static int xc_try_lzo1x_decode(
         if ( src_len <= 0 || src_len > dst_len || src_len > left )
             break;
 
+        msg = "Output buffer overflow";
+        if ( *size > SIZE_MAX - dst_len )
+            break;
+
+        msg = "Decompressed image too large";
+        if ( xc_dom_kernel_check_size(dom, *size + dst_len) )
+            break;
+
         msg = "Failed to (re)alloc memory";
         tmp_buf = realloc(out_buf, *size + dst_len);
         if ( tmp_buf == NULL )
diff -r 40ccbee890e1 -r 537776f51f79 tools/libxc/xc_dom_core.c
--- a/tools/libxc/xc_dom_core.c	Thu Oct 25 15:36:32 2012 +0200
+++ b/tools/libxc/xc_dom_core.c	Fri Oct 26 16:10:55 2012 +0100
@@ -159,7 +159,8 @@ void *xc_dom_malloc_page_aligned(struct 
 }
 
 void *xc_dom_malloc_filemap(struct xc_dom_image *dom,
-                            const char *filename, size_t * size)
+                            const char *filename, size_t * size,
+                            const size_t max_size)
 {
     struct xc_dom_mem *block = NULL;
     int fd = -1;
@@ -171,6 +172,13 @@ void *xc_dom_malloc_filemap(struct xc_do
     lseek(fd, 0, SEEK_SET);
     *size = lseek(fd, 0, SEEK_END);
 
+    if ( max_size && *size > max_size )
+    {
+        xc_dom_panic(dom->xch, XC_OUT_OF_MEMORY,
+                     "tried to map file which is too large");
+        goto err;
+    }
+
     block = malloc(sizeof(*block));
     if ( block == NULL )
         goto err;
@@ -222,6 +230,40 @@ char *xc_dom_strdup(struct xc_dom_image 
 }
 
 /* ------------------------------------------------------------------------ */
+/* decompression buffer sizing                                              */
+int xc_dom_kernel_check_size(struct xc_dom_image *dom, size_t sz)
+{
+    /* No limit */
+    if ( !dom->max_kernel_size )
+        return 0;
+
+    if ( sz > dom->max_kernel_size )
+    {
+        xc_dom_panic(dom->xch, XC_INVALID_KERNEL,
+                     "kernel image too large");
+        return 1;
+    }
+
+    return 0;
+}
+
+int xc_dom_ramdisk_check_size(struct xc_dom_image *dom, size_t sz)
+{
+    /* No limit */
+    if ( !dom->max_ramdisk_size )
+        return 0;
+
+    if ( sz > dom->max_ramdisk_size )
+    {
+        xc_dom_panic(dom->xch, XC_INVALID_KERNEL,
+                     "ramdisk image too large");
+        return 1;
+    }
+
+    return 0;
+}
+
+/* ------------------------------------------------------------------------ */
 /* read files, copy memory blocks, with transparent gunzip                  */
 
 size_t xc_dom_check_gzip(xc_interface *xch, void *blob, size_t ziplen)
@@ -235,7 +277,7 @@ size_t xc_dom_check_gzip(xc_interface *x
 
     gzlen = blob + ziplen - 4;
     unziplen = gzlen[3] << 24 | gzlen[2] << 16 | gzlen[1] << 8 | gzlen[0];
-    if ( (unziplen < 0) || (unziplen > (1024*1024*1024)) ) /* 1GB limit */
+    if ( (unziplen < 0) || (unziplen > XC_DOM_DECOMPRESS_MAX) )
     {
         xc_dom_printf
             (xch,
@@ -288,6 +330,9 @@ int xc_dom_try_gunzip(struct xc_dom_imag
     if ( unziplen == 0 )
         return 0;
 
+    if ( xc_dom_kernel_check_size(dom, unziplen) )
+        return 0;
+
     unzip = xc_dom_malloc(dom, unziplen);
     if ( unzip == NULL )
         return -1;
@@ -588,6 +633,9 @@ struct xc_dom_image *xc_dom_allocate(xc_
     memset(dom, 0, sizeof(*dom));
     dom->xch = xch;
 
+    dom->max_kernel_size = XC_DOM_DECOMPRESS_MAX;
+    dom->max_ramdisk_size = XC_DOM_DECOMPRESS_MAX;
+
     if ( cmdline )
         dom->cmdline = xc_dom_strdup(dom, cmdline);
     if ( features )
@@ -608,10 +656,25 @@ struct xc_dom_image *xc_dom_allocate(xc_
     return NULL;
 }
 
+int xc_dom_kernel_max_size(struct xc_dom_image *dom, size_t sz)
+{
+    DOMPRINTF("%s: kernel_max_size=%zx", __FUNCTION__, sz);
+    dom->max_kernel_size = sz;
+    return 0;
+}
+
+int xc_dom_ramdisk_max_size(struct xc_dom_image *dom, size_t sz)
+{
+    DOMPRINTF("%s: ramdisk_max_size=%zx", __FUNCTION__, sz);
+    dom->max_ramdisk_size = sz;
+    return 0;
+}
+
 int xc_dom_kernel_file(struct xc_dom_image *dom, const char *filename)
 {
     DOMPRINTF("%s: filename=\"%s\"", __FUNCTION__, filename);
-    dom->kernel_blob = xc_dom_malloc_filemap(dom, filename, &dom->kernel_size);
+    dom->kernel_blob = xc_dom_malloc_filemap(dom, filename, &dom->kernel_size,
+                                             dom->max_kernel_size);
     if ( dom->kernel_blob == NULL )
         return -1;
     return xc_dom_try_gunzip(dom, &dom->kernel_blob, &dom->kernel_size);
@@ -621,7 +684,9 @@ int xc_dom_ramdisk_file(struct xc_dom_im
 {
     DOMPRINTF("%s: filename=\"%s\"", __FUNCTION__, filename);
     dom->ramdisk_blob =
-        xc_dom_malloc_filemap(dom, filename, &dom->ramdisk_size);
+        xc_dom_malloc_filemap(dom, filename, &dom->ramdisk_size,
+                              dom->max_ramdisk_size);
+
     if ( dom->ramdisk_blob == NULL )
         return -1;
 //    return xc_dom_try_gunzip(dom, &dom->ramdisk_blob, &dom->ramdisk_size);
@@ -781,7 +846,11 @@ int xc_dom_build_image(struct xc_dom_ima
         void *ramdiskmap;
 
         unziplen = xc_dom_check_gzip(dom->xch, dom->ramdisk_blob, dom->ramdisk_size);
+        if ( xc_dom_ramdisk_check_size(dom, unziplen) != 0 )
+            unziplen = 0;
+
         ramdisklen = unziplen ? unziplen : dom->ramdisk_size;
+
         if ( xc_dom_alloc_segment(dom, &dom->ramdisk_seg, "ramdisk", 0,
                                   ramdisklen) != 0 )
             goto err;

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XH-0000YG-1z; Fri, 02 Nov 2012 05:11:15 +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 1TU9XF-0000Xa-Ui
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:14 +0000
Received: from [85.158.138.51:37645] by server-4.bemta-3.messagelabs.com id
	70/F1-30023-1F553905; Fri, 02 Nov 2012 05:11:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1351833071!28442715!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20281 invoked from network); 2 Nov 2012 05:11:12 -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;
	2 Nov 2012 05: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 1TU9XD-0000er-7T
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XD-0006Lg-3A
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:11 +0000
Message-Id: <E1TU9XD-0006Lg-3A@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:10 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxl: fix usage of backend
	parameter and run_hotplug_scripts
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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@citrix.com>
# Date 1351266024 -3600
# Node ID 6fca80608511ca4c92975ed316a75478a0f317a8
# Parent  051e2a30e3fb1f37a71905153c1dc92b844da413
libxl: fix usage of backend parameter and run_hotplug_scripts

vif interfaces allows the user to specify the domain that should run
the backend (also known as driver domain) using the 'backend'
parameter. This is not compatible with run_hotplug_scripts=1, since
libxl can only run the hotplug scripts from the Domain 0.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 25896:259c4e9d8adf
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 051e2a30e3fb -r 6fca80608511 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Oct 26 16:40:18 2012 +0100
+++ b/tools/libxl/libxl.c	Fri Oct 26 16:40:24 2012 +0100
@@ -2476,6 +2476,8 @@ out:
 int libxl__device_nic_setdefault(libxl__gc *gc, libxl_device_nic *nic,
                                  uint32_t domid)
 {
+    int run_hotplug_scripts;
+
     if (!nic->mtu)
         nic->mtu = 1492;
     if (!nic->model) {
@@ -2505,6 +2507,18 @@ int libxl__device_nic_setdefault(libxl__
                                   libxl__xen_script_dir_path()) < 0 )
         return ERROR_FAIL;
 
+    run_hotplug_scripts = libxl__hotplug_settings(gc, XBT_NULL);
+    if (run_hotplug_scripts < 0) {
+        LOG(ERROR, "unable to get current hotplug scripts execution setting");
+        return run_hotplug_scripts;
+    }
+    if (nic->backend_domid != LIBXL_TOOLSTACK_DOMID && run_hotplug_scripts) {
+        LOG(ERROR, "cannot use a backend domain different than %d if"
+                   "hotplug scripts are executed from libxl",
+                   LIBXL_TOOLSTACK_DOMID);
+        return ERROR_FAIL;
+    }
+
     switch (libxl__domain_type(gc, domid)) {
     case LIBXL_DOMAIN_TYPE_HVM:
         if (!nic->nictype)

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XJ-0000ZI-Ec; Fri, 02 Nov 2012 05:11:17 +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 1TU9XI-0000XU-5z
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:16 +0000
Received: from [85.158.138.51:39716] by server-11.bemta-3.messagelabs.com id
	29/E7-19361-3F553905; Fri, 02 Nov 2012 05:11:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1351833074!22030038!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21096 invoked from network); 2 Nov 2012 05:11:15 -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;
	2 Nov 2012 05: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 1TU9XF-0000f6-Tn
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XF-0006Mv-Pg
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:13 +0000
Message-Id: <E1TU9XF-0006Mv-Pg@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:13 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xl: resume the domain on suspend
	failure
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Bastian Blank <waldi@debian.org>
# Date 1351266130 -3600
# Node ID 1ecde3c0276481c371a42980b569c3fb78e108f1
# Parent  7e91c668bae279dc7e839ad37550e709153e6af8
xl: resume the domain on suspend failure

The MUST macro calls exit(3) on failure but we need to cleanup and
resume.

Signed-off-by: Bastian Blank <waldi@debian.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 25942:16ee1d300cfd
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 7e91c668bae2 -r 1ecde3c02764 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Fri Oct 26 16:41:57 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Fri Oct 26 16:42:10 2012 +0100
@@ -2997,15 +2997,18 @@ static int save_domain(const char *p, co
 
     save_domain_core_writeconfig(fd, filename, config_data, config_len);
 
-    MUST(libxl_domain_suspend(ctx, domid, fd, 0, NULL));
+    int rc = libxl_domain_suspend(ctx, domid, fd, 0, NULL);
     close(fd);
 
-    if (checkpoint)
+    if (rc < 0)
+        fprintf(stderr, "Failed to save domain, resuming domain\n");
+
+    if (checkpoint || rc < 0)
         libxl_domain_resume(ctx, domid, 1, 0);
     else
         libxl_domain_destroy(ctx, domid, 0);
 
-    exit(0);
+    exit(rc < 0 ? 1 : 0);
 }
 
 static pid_t create_migration_child(const char *rune, int *send_fd,

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XJ-0000ZD-CG; Fri, 02 Nov 2012 05:11:17 +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 1TU9XH-0000YN-Ml
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:15 +0000
Received: from [85.158.143.99:39711] by server-3.bemta-4.messagelabs.com id
	9E/E5-06841-2F553905; Fri, 02 Nov 2012 05:11:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-216.messagelabs.com!1351833073!24943088!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6487 invoked from network); 2 Nov 2012 05:11:14 -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 Nov 2012 05: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 1TU9XE-0000f0-VF
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XE-0006MR-Mp
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:12 +0000
Message-Id: <E1TU9XE-0006MR-Mp@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:12 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxl: Fix missing dependency in
	api check rule
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351266044 -3600
# Node ID eac5271097626731db5a97978d6cd77d7a339269
# Parent  747c216a612cedf011f641ac7290a68a61238a14
libxl: Fix missing dependency in api check rule

Without this, the api check cpp run might happen before the various
autogenerated files which are #include by libxl.h are ready.

We need to remove the api-ok file from AUTOINCS to avoid a circular
dependency.  Instead, we list it explicitly as a dependency of the
object files.  The result is that the api check is the last thing to
be done before make considers the preparation done and can start work
on compiling .c files into .o's.

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

xen-unstable changeset: 25901:c51229d1522e
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 747c216a612c -r eac527109762 tools/libxl/Makefile
--- a/tools/libxl/Makefile	Fri Oct 26 16:40:38 2012 +0100
+++ b/tools/libxl/Makefile	Fri Oct 26 16:40:44 2012 +0100
@@ -74,8 +74,7 @@ LIBXL_OBJS += _libxl_types.o libxl_flask
 $(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl) -include $(XEN_ROOT)/tools/config.h
 
 AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h _libxl_list.h _paths.h \
-	_libxl_save_msgs_callout.h _libxl_save_msgs_helper.h \
-        libxl.api-ok
+	_libxl_save_msgs_callout.h _libxl_save_msgs_helper.h
 AUTOSRCS= libxlu_cfg_y.c libxlu_cfg_l.c
 AUTOSRCS += _libxl_save_msgs_callout.c _libxl_save_msgs_helper.c
 LIBXLU_OBJS = libxlu_cfg_y.o libxlu_cfg_l.o libxlu_cfg.o \
@@ -102,7 +101,8 @@ testidl.c: libxl_types.idl gentest.py li
 all: $(CLIENTS) libxenlight.so libxenlight.a libxlutil.so libxlutil.a \
 	$(AUTOSRCS) $(AUTOINCS)
 
-$(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS) $(SAVE_HELPER_OBJS): $(AUTOINCS)
+$(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS) $(SAVE_HELPER_OBJS): \
+	$(AUTOINCS) libxl.api-ok
 
 %.c %.h:: %.y
 	@rm -f $*.[ch]
@@ -119,7 +119,7 @@ libxl.api-ok: check-libxl-api-rules _lib
 	$(PERL) $^
 	touch $@
 
-_%.api-for-check: %.h
+_%.api-for-check: %.h $(AUTOINCS)
 	$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -c -E $< $(APPEND_CFLAGS) \
 		-DLIBXL_EXTERNAL_CALLERS_ONLY=LIBXL_EXTERNAL_CALLERS_ONLY \
 		>$@.new

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XL-0000aR-Pl; Fri, 02 Nov 2012 05:11:19 +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 1TU9XK-0000ZW-FF
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:18 +0000
Received: from [85.158.138.51:4353] by server-7.bemta-3.messagelabs.com id
	82/C7-01713-5F553905; Fri, 02 Nov 2012 05:11:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1351833075!28329694!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=1.4 required=7.0 tests=INFO_TLD
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3486 invoked from network); 2 Nov 2012 05:11:16 -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;
	2 Nov 2012 05:11: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 1TU9XH-0000fF-Fk
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XH-0006OA-ER
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:15 +0000
Message-Id: <E1TU9XH-0006OA-ER@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:14 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxl/qemu-xen: use
	cache=writeback for IDE and SCSI
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1351266192 -3600
# Node ID 9c0101d79839656cce28928d57e95ec6b4ab5841
# Parent  87900aea9c6b5528e898ed67f621531451fb1740
libxl/qemu-xen: use cache=writeback for IDE and SCSI

Change caching mode from writethrough to writeback for upstream QEMU.

After a lengthy discussion, we came up with the conclusion that
WRITEBACK is OK for IDE.
See: http://marc.info/?l=xen-devel&m=133311527009773

Given that the same reasons apply to SCSI as well, change to writeback
for SCSI too.

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

xen-unstable changeset: 25989:0807d1f7773d
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 87900aea9c6b -r 9c0101d79839 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Fri Oct 26 16:42:57 2012 +0100
+++ b/tools/libxl/libxl_dm.c	Fri Oct 26 16:43:12 2012 +0100
@@ -549,10 +549,10 @@ static char ** libxl__build_device_model
             if (disks[i].is_cdrom) {
                 if (disks[i].format == LIBXL_DISK_FORMAT_EMPTY)
                     drive = libxl__sprintf
-                        (gc, "if=ide,index=%d,media=cdrom", disk);
+                        (gc, "if=ide,index=%d,media=cdrom,cache=writeback", disk);
                 else
                     drive = libxl__sprintf
-                        (gc, "file=%s,if=ide,index=%d,media=cdrom,format=%s",
+                        (gc, "file=%s,if=ide,index=%d,media=cdrom,format=%s,cache=writeback",
                          disks[i].pdev_path, disk, format);
             } else {
                 if (disks[i].format == LIBXL_DISK_FORMAT_EMPTY) {
@@ -575,11 +575,11 @@ static char ** libxl__build_device_model
                  */
                 if (strncmp(disks[i].vdev, "sd", 2) == 0)
                     drive = libxl__sprintf
-                        (gc, "file=%s,if=scsi,bus=0,unit=%d,format=%s",
+                        (gc, "file=%s,if=scsi,bus=0,unit=%d,format=%s,cache=writeback",
                          disks[i].pdev_path, disk, format);
                 else if (disk < 4)
                     drive = libxl__sprintf
-                        (gc, "file=%s,if=ide,index=%d,media=disk,format=%s",
+                        (gc, "file=%s,if=ide,index=%d,media=disk,format=%s,cache=writeback",
                          disks[i].pdev_path, disk, format);
                 else
                     continue; /* Do not emulate this disk */

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XL-0000ao-V0; Fri, 02 Nov 2012 05:11:19 +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 1TU9XK-0000XU-RQ
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:19 +0000
Received: from [85.158.138.51:4346] by server-11.bemta-3.messagelabs.com id
	4E/E7-19361-6F553905; Fri, 02 Nov 2012 05:11:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1351833075!22030041!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21115 invoked from network); 2 Nov 2012 05:11:16 -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;
	2 Nov 2012 05:11: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 1TU9XH-0000fC-2C
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XG-0006Nv-Tn
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:14 +0000
Message-Id: <E1TU9XG-0006Nv-Tn@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:14 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxl: make devid a type so it is
	initialized properly
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1351266177 -3600
# Node ID 87900aea9c6b5528e898ed67f621531451fb1740
# Parent  325a4fdb7f3588b05b35475766e588bfa08c12ff
libxl: make devid a type so it is initialized properly

Previously device ids in libxl were treated as integers meaning they
were being initialized to 0, which is a valid device id. This patch
makes devid its own type in libxl and initializes it to -1, an invalid
value.

This fixes a bug where if you try to do a xl DEV-attach multiple
time it will continuously try to reattach device 0 instead of
generating a new device id.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 25988:8a073eb1e849
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 325a4fdb7f35 -r 87900aea9c6b tools/libxl/gentest.py
--- a/tools/libxl/gentest.py	Fri Oct 26 16:42:23 2012 +0100
+++ b/tools/libxl/gentest.py	Fri Oct 26 16:42:57 2012 +0100
@@ -60,7 +60,7 @@ def gen_rand_init(ty, v, indent = "    "
                                         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, idl.Number):
+    elif ty.typename in ["libxl_domid", "libxl_devid"] 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))
diff -r 325a4fdb7f35 -r 87900aea9c6b tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Fri Oct 26 16:42:23 2012 +0100
+++ b/tools/libxl/libxl.h	Fri Oct 26 16:42:57 2012 +0100
@@ -307,6 +307,7 @@ void libxl_cpuid_dispose(libxl_cpuid_pol
 #define LIBXL_PCI_FUNC_ALL (~0U)
 
 typedef uint32_t libxl_domid;
+typedef int libxl_devid;
 
 /*
  * Formatting Enumerations.
diff -r 325a4fdb7f35 -r 87900aea9c6b tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Fri Oct 26 16:42:23 2012 +0100
+++ b/tools/libxl/libxl_types.idl	Fri Oct 26 16:42:57 2012 +0100
@@ -8,6 +8,7 @@ namespace("libxl_")
 libxl_defbool = Builtin("defbool", passby=PASS_BY_REFERENCE)
 
 libxl_domid = Builtin("domid", json_fn = "yajl_gen_integer", autogenerate_json = False)
+libxl_devid = Builtin("devid", json_fn = "yajl_gen_integer", autogenerate_json = False, signed = True, init_val="-1")
 libxl_uuid = Builtin("uuid", passby=PASS_BY_REFERENCE)
 libxl_mac = Builtin("mac", passby=PASS_BY_REFERENCE)
 libxl_bitmap = Builtin("bitmap", dispose_fn="libxl_bitmap_dispose", passby=PASS_BY_REFERENCE)
@@ -337,7 +338,7 @@ libxl_domain_build_info = Struct("domain
 
 libxl_device_vfb = Struct("device_vfb", [
     ("backend_domid", libxl_domid),
-    ("devid",         integer),
+    ("devid",         libxl_devid),
     ("vnc",           libxl_vnc_info),
     ("sdl",           libxl_sdl_info),
     # set keyboard layout, default is en-us keyboard
@@ -346,7 +347,7 @@ libxl_device_vfb = Struct("device_vfb", 
 
 libxl_device_vkb = Struct("device_vkb", [
     ("backend_domid", libxl_domid),
-    ("devid", integer),
+    ("devid", libxl_devid),
     ])
 
 libxl_device_disk = Struct("device_disk", [
@@ -363,7 +364,7 @@ libxl_device_disk = Struct("device_disk"
 
 libxl_device_nic = Struct("device_nic", [
     ("backend_domid", libxl_domid),
-    ("devid", integer),
+    ("devid", libxl_devid),
     ("mtu", integer),
     ("model", string),
     ("mac", libxl_mac),
@@ -393,7 +394,7 @@ libxl_diskinfo = Struct("diskinfo", [
     ("backend_id", uint32),
     ("frontend", string),
     ("frontend_id", uint32),
-    ("devid", integer),
+    ("devid", libxl_devid),
     ("state", integer),
     ("evtch", integer),
     ("rref", integer),
@@ -404,7 +405,7 @@ libxl_nicinfo = Struct("nicinfo", [
     ("backend_id", uint32),
     ("frontend", string),
     ("frontend_id", uint32),
-    ("devid", integer),
+    ("devid", libxl_devid),
     ("state", integer),
     ("evtch", integer),
     ("rref_tx", integer),
diff -r 325a4fdb7f35 -r 87900aea9c6b tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py	Fri Oct 26 16:42:23 2012 +0100
+++ b/tools/ocaml/libs/xl/genwrap.py	Fri Oct 26 16:42:57 2012 +0100
@@ -10,6 +10,7 @@ builtins = {
     "int":                  ("int",                    "%(c)s = Int_val(%(o)s)",            "Val_int(%(c)s)"  ),
     "char *":               ("string",                 "%(c)s = dup_String_val(gc, %(o)s)", "caml_copy_string(%(c)s)"),
     "libxl_domid":          ("domid",                  "%(c)s = Int_val(%(o)s)",            "Val_int(%(c)s)"  ),
+    "libxl_devid":          ("devid",                  "%(c)s = Int_val(%(o)s)",            "Val_int(%(c)s)"  ),
     "libxl_defbool":        ("bool option",            "%(c)s = Defbool_val(%(o)s)",        "Val_defbool(%(c)s)" ),
     "libxl_uuid":           ("int array",              "Uuid_val(gc, lg, &%(c)s, %(o)s)",   "Val_uuid(&%(c)s)"),
     "libxl_key_value_list": ("(string * string) list", None,                                None),
@@ -41,8 +42,8 @@ def stub_fn_name(ty, name):
     return "stub_xl_%s_%s" % (ty.rawname,name)
     
 def ocaml_type_of(ty):
-    if ty.rawname == "domid":
-        return "domid"
+    if ty.rawname in ["domid","devid"]:
+        return ty.rawname
     elif isinstance(ty,idl.UInt):
         if ty.width in [8, 16]:
             # handle as ints
diff -r 325a4fdb7f35 -r 87900aea9c6b tools/ocaml/libs/xl/xenlight.ml.in
--- a/tools/ocaml/libs/xl/xenlight.ml.in	Fri Oct 26 16:42:23 2012 +0100
+++ b/tools/ocaml/libs/xl/xenlight.ml.in	Fri Oct 26 16:42:57 2012 +0100
@@ -16,6 +16,7 @@
 exception Error of string
 
 type domid = int
+type devid = int
 
 (* @@LIBXL_TYPES@@ *)
 
diff -r 325a4fdb7f35 -r 87900aea9c6b tools/ocaml/libs/xl/xenlight.mli.in
--- a/tools/ocaml/libs/xl/xenlight.mli.in	Fri Oct 26 16:42:23 2012 +0100
+++ b/tools/ocaml/libs/xl/xenlight.mli.in	Fri Oct 26 16:42:57 2012 +0100
@@ -16,6 +16,7 @@
 exception Error of string
 
 type domid = int
+type devid = int
 
 (* @@LIBXL_TYPES@@ *)
 
diff -r 325a4fdb7f35 -r 87900aea9c6b tools/python/xen/lowlevel/xl/xl.c
--- a/tools/python/xen/lowlevel/xl/xl.c	Fri Oct 26 16:42:23 2012 +0100
+++ b/tools/python/xen/lowlevel/xl/xl.c	Fri Oct 26 16:42:57 2012 +0100
@@ -281,6 +281,11 @@ int attrib__libxl_domid_set(PyObject *v,
     return 0;
 }
 
+int attrib__libxl_devid_set(PyObject *v, libxl_devid *devid) {
+   *devid = PyInt_AsLong(v);
+   return 0;
+}
+
 int attrib__struct_in_addr_set(PyObject *v, struct in_addr *pptr)
 {
     PyErr_SetString(PyExc_NotImplementedError, "Setting in_addr");
@@ -342,6 +347,10 @@ PyObject *attrib__libxl_domid_get(libxl_
     return PyInt_FromLong(*domid);
 }
 
+PyObject *attrib__libxl_devid_get(libxl_devid *devid) {
+    return PyInt_FromLong(*devid);
+}
+
 PyObject *attrib__struct_in_addr_get(struct in_addr *pptr)
 {
     PyErr_SetString(PyExc_NotImplementedError, "Getting in_addr");

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XK-0000Zc-HL; Fri, 02 Nov 2012 05:11:18 +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 1TU9XI-0000Ya-CR
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:16 +0000
Received: from [85.158.143.35:46378] by server-2.bemta-4.messagelabs.com id
	E5/B1-28922-3F553905; Fri, 02 Nov 2012 05:11:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-21.messagelabs.com!1351833072!16055186!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20461 invoked from network); 2 Nov 2012 05:11:13 -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;
	2 Nov 2012 05: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 1TU9XE-0000ex-A6
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XE-0006MC-5n
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:12 +0000
Message-Id: <E1TU9XE-0006MC-5n@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:11 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xentop.c: Change curses painting
	behavior to avoid flicker
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Jason McCarver <slam@parasite.cc>
# Date 1351266038 -3600
# Node ID 747c216a612cedf011f641ac7290a68a61238a14
# Parent  27312134166b0596f5de8ce0b9e7dd7c094fad68
xentop.c: Change curses painting behavior to avoid flicker

Currently, xentop calls clear() before drawing the screen and calling
refresh().  This causes the entire screen to be repainted from scratch
on each call to refresh().  It is inefficient and causes visible flicker
when using xentop.

This patch fixes this by calling erase() instead of clear() which overwrites
the current screen with blanks instead.  The screen is then drawn as usual
in the top() function and refresh() is called.  This method allows curses
to only repaint the characters that have changed since the last call
to refresh(), thus avoiding the flicker and sending fewer characters to
the terminal.

In the event the screen becomes corrupted, this patch accepts a CTRL-L
keystroke from the user which will call clear() and force a repaint of
the entire screen.

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

xen-unstable changeset: 25899:116f5c34354b
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 27312134166b -r 747c216a612c tools/xenstat/xentop/xentop.c
--- a/tools/xenstat/xentop/xentop.c	Fri Oct 26 16:40:32 2012 +0100
+++ b/tools/xenstat/xentop/xentop.c	Fri Oct 26 16:40:38 2012 +0100
@@ -57,6 +57,7 @@
 #endif
 
 #define KEY_ESCAPE '\x1B'
+#define KEY_REPAINT '\x0C'
 
 #ifdef HOST_SunOS
 /* Old curses library on Solaris takes non-const strings. Also, ERR interferes
@@ -383,6 +384,9 @@ static int handle_key(int ch)
 		case 'd': case 'D':
 			set_prompt("Delay(sec)", set_delay);
 			break;
+		case KEY_REPAINT:
+			clear();
+			break;
 		case 'q': case 'Q': case KEY_ESCAPE:
 			return 0;
 		}
@@ -1201,7 +1205,7 @@ int main(int argc, char **argv)
 		do {
 			gettimeofday(&curtime, NULL);
 			if(ch != ERR || (curtime.tv_sec - oldtime.tv_sec) >= delay) {
-				clear();
+				erase();
 				top();
 				oldtime = curtime;
 				refresh();

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XL-0000ag-Se; Fri, 02 Nov 2012 05:11: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 1TU9XK-0000Za-TD
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:19 +0000
Received: from [85.158.139.211:10681] by server-14.bemta-5.messagelabs.com id
	AF/FF-21768-6F553905; Fri, 02 Nov 2012 05:11:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-206.messagelabs.com!1351833076!18547885!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13633 invoked from network); 2 Nov 2012 05:11:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2012 05:11: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 1TU9XI-0000fL-Hf
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XI-0006Oe-GR
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:16 +0000
Message-Id: <E1TU9XI-0006Oe-GR@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:16 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xenballoond.init: remove 4 from
	default runlevel
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351266300 -3600
# Node ID dcd4bf8242842fe7d8390d508fc378db96aad975
# Parent  6adf0c7937bf5ca515aa27c15f7752459b03b971
xenballoond.init: remove 4 from default runlevel

Remove 4 from default runlevel in xenballoond.init.

Similar to what changeset 24847:0900b1c905f1 does in xencommons, remove
runlevel 4 from the other runlevel scripts. LSB defines runlevel 4 as
reserved for local use, the local sysadmin is responsible for symlink
creation in rc4.d.

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

xen-unstable changeset: 26007:fe756682cc7f
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 6adf0c7937bf -r dcd4bf824284 tools/xenballoon/xenballoond.init
--- a/tools/xenballoon/xenballoond.init	Fri Oct 26 16:44:47 2012 +0100
+++ b/tools/xenballoon/xenballoond.init	Fri Oct 26 16:45:00 2012 +0100
@@ -14,7 +14,7 @@
 # Should-Start:
 # Required-Stop:     $syslog $remote_fs
 # Should-Stop:
-# Default-Start:     3 4 5
+# Default-Start:     3 5
 # Default-Stop:      0 1 2 6
 # Short-Description: Start/stop xenballoond
 # Description:       Starts and stops the Xen ballooning daemon.

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XL-0000ao-V0; Fri, 02 Nov 2012 05:11:19 +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 1TU9XK-0000XU-RQ
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:19 +0000
Received: from [85.158.138.51:4346] by server-11.bemta-3.messagelabs.com id
	4E/E7-19361-6F553905; Fri, 02 Nov 2012 05:11:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1351833075!22030041!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21115 invoked from network); 2 Nov 2012 05:11:16 -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;
	2 Nov 2012 05:11: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 1TU9XH-0000fC-2C
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XG-0006Nv-Tn
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:14 +0000
Message-Id: <E1TU9XG-0006Nv-Tn@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:14 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxl: make devid a type so it is
	initialized properly
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1351266177 -3600
# Node ID 87900aea9c6b5528e898ed67f621531451fb1740
# Parent  325a4fdb7f3588b05b35475766e588bfa08c12ff
libxl: make devid a type so it is initialized properly

Previously device ids in libxl were treated as integers meaning they
were being initialized to 0, which is a valid device id. This patch
makes devid its own type in libxl and initializes it to -1, an invalid
value.

This fixes a bug where if you try to do a xl DEV-attach multiple
time it will continuously try to reattach device 0 instead of
generating a new device id.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 25988:8a073eb1e849
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 325a4fdb7f35 -r 87900aea9c6b tools/libxl/gentest.py
--- a/tools/libxl/gentest.py	Fri Oct 26 16:42:23 2012 +0100
+++ b/tools/libxl/gentest.py	Fri Oct 26 16:42:57 2012 +0100
@@ -60,7 +60,7 @@ def gen_rand_init(ty, v, indent = "    "
                                         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, idl.Number):
+    elif ty.typename in ["libxl_domid", "libxl_devid"] 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))
diff -r 325a4fdb7f35 -r 87900aea9c6b tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Fri Oct 26 16:42:23 2012 +0100
+++ b/tools/libxl/libxl.h	Fri Oct 26 16:42:57 2012 +0100
@@ -307,6 +307,7 @@ void libxl_cpuid_dispose(libxl_cpuid_pol
 #define LIBXL_PCI_FUNC_ALL (~0U)
 
 typedef uint32_t libxl_domid;
+typedef int libxl_devid;
 
 /*
  * Formatting Enumerations.
diff -r 325a4fdb7f35 -r 87900aea9c6b tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Fri Oct 26 16:42:23 2012 +0100
+++ b/tools/libxl/libxl_types.idl	Fri Oct 26 16:42:57 2012 +0100
@@ -8,6 +8,7 @@ namespace("libxl_")
 libxl_defbool = Builtin("defbool", passby=PASS_BY_REFERENCE)
 
 libxl_domid = Builtin("domid", json_fn = "yajl_gen_integer", autogenerate_json = False)
+libxl_devid = Builtin("devid", json_fn = "yajl_gen_integer", autogenerate_json = False, signed = True, init_val="-1")
 libxl_uuid = Builtin("uuid", passby=PASS_BY_REFERENCE)
 libxl_mac = Builtin("mac", passby=PASS_BY_REFERENCE)
 libxl_bitmap = Builtin("bitmap", dispose_fn="libxl_bitmap_dispose", passby=PASS_BY_REFERENCE)
@@ -337,7 +338,7 @@ libxl_domain_build_info = Struct("domain
 
 libxl_device_vfb = Struct("device_vfb", [
     ("backend_domid", libxl_domid),
-    ("devid",         integer),
+    ("devid",         libxl_devid),
     ("vnc",           libxl_vnc_info),
     ("sdl",           libxl_sdl_info),
     # set keyboard layout, default is en-us keyboard
@@ -346,7 +347,7 @@ libxl_device_vfb = Struct("device_vfb", 
 
 libxl_device_vkb = Struct("device_vkb", [
     ("backend_domid", libxl_domid),
-    ("devid", integer),
+    ("devid", libxl_devid),
     ])
 
 libxl_device_disk = Struct("device_disk", [
@@ -363,7 +364,7 @@ libxl_device_disk = Struct("device_disk"
 
 libxl_device_nic = Struct("device_nic", [
     ("backend_domid", libxl_domid),
-    ("devid", integer),
+    ("devid", libxl_devid),
     ("mtu", integer),
     ("model", string),
     ("mac", libxl_mac),
@@ -393,7 +394,7 @@ libxl_diskinfo = Struct("diskinfo", [
     ("backend_id", uint32),
     ("frontend", string),
     ("frontend_id", uint32),
-    ("devid", integer),
+    ("devid", libxl_devid),
     ("state", integer),
     ("evtch", integer),
     ("rref", integer),
@@ -404,7 +405,7 @@ libxl_nicinfo = Struct("nicinfo", [
     ("backend_id", uint32),
     ("frontend", string),
     ("frontend_id", uint32),
-    ("devid", integer),
+    ("devid", libxl_devid),
     ("state", integer),
     ("evtch", integer),
     ("rref_tx", integer),
diff -r 325a4fdb7f35 -r 87900aea9c6b tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py	Fri Oct 26 16:42:23 2012 +0100
+++ b/tools/ocaml/libs/xl/genwrap.py	Fri Oct 26 16:42:57 2012 +0100
@@ -10,6 +10,7 @@ builtins = {
     "int":                  ("int",                    "%(c)s = Int_val(%(o)s)",            "Val_int(%(c)s)"  ),
     "char *":               ("string",                 "%(c)s = dup_String_val(gc, %(o)s)", "caml_copy_string(%(c)s)"),
     "libxl_domid":          ("domid",                  "%(c)s = Int_val(%(o)s)",            "Val_int(%(c)s)"  ),
+    "libxl_devid":          ("devid",                  "%(c)s = Int_val(%(o)s)",            "Val_int(%(c)s)"  ),
     "libxl_defbool":        ("bool option",            "%(c)s = Defbool_val(%(o)s)",        "Val_defbool(%(c)s)" ),
     "libxl_uuid":           ("int array",              "Uuid_val(gc, lg, &%(c)s, %(o)s)",   "Val_uuid(&%(c)s)"),
     "libxl_key_value_list": ("(string * string) list", None,                                None),
@@ -41,8 +42,8 @@ def stub_fn_name(ty, name):
     return "stub_xl_%s_%s" % (ty.rawname,name)
     
 def ocaml_type_of(ty):
-    if ty.rawname == "domid":
-        return "domid"
+    if ty.rawname in ["domid","devid"]:
+        return ty.rawname
     elif isinstance(ty,idl.UInt):
         if ty.width in [8, 16]:
             # handle as ints
diff -r 325a4fdb7f35 -r 87900aea9c6b tools/ocaml/libs/xl/xenlight.ml.in
--- a/tools/ocaml/libs/xl/xenlight.ml.in	Fri Oct 26 16:42:23 2012 +0100
+++ b/tools/ocaml/libs/xl/xenlight.ml.in	Fri Oct 26 16:42:57 2012 +0100
@@ -16,6 +16,7 @@
 exception Error of string
 
 type domid = int
+type devid = int
 
 (* @@LIBXL_TYPES@@ *)
 
diff -r 325a4fdb7f35 -r 87900aea9c6b tools/ocaml/libs/xl/xenlight.mli.in
--- a/tools/ocaml/libs/xl/xenlight.mli.in	Fri Oct 26 16:42:23 2012 +0100
+++ b/tools/ocaml/libs/xl/xenlight.mli.in	Fri Oct 26 16:42:57 2012 +0100
@@ -16,6 +16,7 @@
 exception Error of string
 
 type domid = int
+type devid = int
 
 (* @@LIBXL_TYPES@@ *)
 
diff -r 325a4fdb7f35 -r 87900aea9c6b tools/python/xen/lowlevel/xl/xl.c
--- a/tools/python/xen/lowlevel/xl/xl.c	Fri Oct 26 16:42:23 2012 +0100
+++ b/tools/python/xen/lowlevel/xl/xl.c	Fri Oct 26 16:42:57 2012 +0100
@@ -281,6 +281,11 @@ int attrib__libxl_domid_set(PyObject *v,
     return 0;
 }
 
+int attrib__libxl_devid_set(PyObject *v, libxl_devid *devid) {
+   *devid = PyInt_AsLong(v);
+   return 0;
+}
+
 int attrib__struct_in_addr_set(PyObject *v, struct in_addr *pptr)
 {
     PyErr_SetString(PyExc_NotImplementedError, "Setting in_addr");
@@ -342,6 +347,10 @@ PyObject *attrib__libxl_domid_get(libxl_
     return PyInt_FromLong(*domid);
 }
 
+PyObject *attrib__libxl_devid_get(libxl_devid *devid) {
+    return PyInt_FromLong(*devid);
+}
+
 PyObject *attrib__struct_in_addr_get(struct in_addr *pptr)
 {
     PyErr_SetString(PyExc_NotImplementedError, "Getting in_addr");

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XJ-0000Z6-9N; Fri, 02 Nov 2012 05:11:17 +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 1TU9XH-0000XO-JR
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:15 +0000
Received: from [85.158.137.99:10169] by server-12.bemta-3.messagelabs.com id
	F0/1F-22757-3F553905; Fri, 02 Nov 2012 05:11:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-217.messagelabs.com!1351833073!12343518!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24684 invoked from network); 2 Nov 2012 05:11:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2012 05: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 1TU9XF-0000f3-9I
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XF-0006Mg-7x
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:13 +0000
Message-Id: <E1TU9XF-0006Mg-7x@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:12 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] pygrub: always append --args
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351266117 -3600
# Node ID 7e91c668bae279dc7e839ad37550e709153e6af8
# Parent  eac5271097626731db5a97978d6cd77d7a339269
pygrub: always append --args

If a bootloader entry in menu.lst has no additional kernel command line
options listed and the domU.cfg has 'bootargs="--args=something"' the
additional arguments from the config file are not passed to the kernel.
The reason for that incorrect behaviour is that run_grub appends arg
only if the parsed config file has arguments listed.

Fix this by appending args from image section and the config file separatly.
To avoid adding to a NoneType initialize grubcfg['args'] to an empty string.
This does not change behaviour but simplifies the code which appends the
string.

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

xen-unstable changeset: 25941:795c493fe561
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r eac527109762 -r 7e91c668bae2 tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub	Fri Oct 26 16:40:44 2012 +0100
+++ b/tools/pygrub/src/pygrub	Fri Oct 26 16:41:57 2012 +0100
@@ -615,13 +615,15 @@ def run_grub(file, entry, fs, arg):
     except IndexError:
         img = g.cf.images[0]
 
-    grubcfg = { "kernel": None, "ramdisk": None, "args": None }
+    grubcfg = { "kernel": None, "ramdisk": None, "args": "" }
 
     grubcfg["kernel"] = img.kernel[1]
     if img.initrd:
         grubcfg["ramdisk"] = img.initrd[1]
     if img.args:
-        grubcfg["args"] = img.args + " " + arg
+        grubcfg["args"] += img.args
+    if arg:
+        grubcfg["args"] += " " + args
 
     return grubcfg
 

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XN-0000d1-3B; Fri, 02 Nov 2012 05:11: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 1TU9XL-0000Za-Ln
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:19 +0000
Received: from [85.158.139.211:25551] by server-14.bemta-5.messagelabs.com id
	29/00-21768-7F553905; Fri, 02 Nov 2012 05:11:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-206.messagelabs.com!1351833077!18613152!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24534 invoked from network); 2 Nov 2012 05:11:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2012 05:11: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 1TU9XJ-0000fa-Mf
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XJ-0006P8-IW
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:17 +0000
Message-Id: <E1TU9XJ-0006P8-IW@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:17 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] pygrub: correct typo in --args
	assignment
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351266334 -3600
# Node ID dbb1872bbb97edc26fda69e922344d88990322d2
# Parent  b8d7371bee78028e80884b25b066355dd81c0a26
pygrub: correct typo in --args assignment

If pygrub was called with --args="some thing", then this string should
be append to the kernel command line.  But the last changeset
25941:795c493fe561 contained a typo, it assigns 'args' instead of 'arg'.

Rename the local variable which holds the string from the domain config
file to avoid further confusion.

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

xen-unstable changeset: 26018:ecc7627ca6d7
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r b8d7371bee78 -r dbb1872bbb97 tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub	Fri Oct 26 16:45:17 2012 +0100
+++ b/tools/pygrub/src/pygrub	Fri Oct 26 16:45:34 2012 +0100
@@ -585,7 +585,7 @@ def get_entry_idx(cf, entry):
 
     return None
 
-def run_grub(file, entry, fs, arg):
+def run_grub(file, entry, fs, cfg_args):
     global g
     global sel
 
@@ -622,8 +622,8 @@ def run_grub(file, entry, fs, arg):
         grubcfg["ramdisk"] = img.initrd[1]
     if img.args:
         grubcfg["args"] += img.args
-    if arg:
-        grubcfg["args"] += " " + args
+    if cfg_args:
+        grubcfg["args"] += " " + cfg_args
 
     return grubcfg
 

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XJ-0000Z6-9N; Fri, 02 Nov 2012 05:11:17 +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 1TU9XH-0000XO-JR
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:15 +0000
Received: from [85.158.137.99:10169] by server-12.bemta-3.messagelabs.com id
	F0/1F-22757-3F553905; Fri, 02 Nov 2012 05:11:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-217.messagelabs.com!1351833073!12343518!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24684 invoked from network); 2 Nov 2012 05:11:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2012 05: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 1TU9XF-0000f3-9I
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XF-0006Mg-7x
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:13 +0000
Message-Id: <E1TU9XF-0006Mg-7x@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:12 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] pygrub: always append --args
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351266117 -3600
# Node ID 7e91c668bae279dc7e839ad37550e709153e6af8
# Parent  eac5271097626731db5a97978d6cd77d7a339269
pygrub: always append --args

If a bootloader entry in menu.lst has no additional kernel command line
options listed and the domU.cfg has 'bootargs="--args=something"' the
additional arguments from the config file are not passed to the kernel.
The reason for that incorrect behaviour is that run_grub appends arg
only if the parsed config file has arguments listed.

Fix this by appending args from image section and the config file separatly.
To avoid adding to a NoneType initialize grubcfg['args'] to an empty string.
This does not change behaviour but simplifies the code which appends the
string.

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

xen-unstable changeset: 25941:795c493fe561
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r eac527109762 -r 7e91c668bae2 tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub	Fri Oct 26 16:40:44 2012 +0100
+++ b/tools/pygrub/src/pygrub	Fri Oct 26 16:41:57 2012 +0100
@@ -615,13 +615,15 @@ def run_grub(file, entry, fs, arg):
     except IndexError:
         img = g.cf.images[0]
 
-    grubcfg = { "kernel": None, "ramdisk": None, "args": None }
+    grubcfg = { "kernel": None, "ramdisk": None, "args": "" }
 
     grubcfg["kernel"] = img.kernel[1]
     if img.initrd:
         grubcfg["ramdisk"] = img.initrd[1]
     if img.args:
-        grubcfg["args"] = img.args + " " + arg
+        grubcfg["args"] += img.args
+    if arg:
+        grubcfg["args"] += " " + args
 
     return grubcfg
 

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XN-0000d1-3B; Fri, 02 Nov 2012 05:11: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 1TU9XL-0000Za-Ln
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:19 +0000
Received: from [85.158.139.211:25551] by server-14.bemta-5.messagelabs.com id
	29/00-21768-7F553905; Fri, 02 Nov 2012 05:11:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-206.messagelabs.com!1351833077!18613152!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24534 invoked from network); 2 Nov 2012 05:11:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2012 05:11: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 1TU9XJ-0000fa-Mf
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XJ-0006P8-IW
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:17 +0000
Message-Id: <E1TU9XJ-0006P8-IW@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:17 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] pygrub: correct typo in --args
	assignment
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351266334 -3600
# Node ID dbb1872bbb97edc26fda69e922344d88990322d2
# Parent  b8d7371bee78028e80884b25b066355dd81c0a26
pygrub: correct typo in --args assignment

If pygrub was called with --args="some thing", then this string should
be append to the kernel command line.  But the last changeset
25941:795c493fe561 contained a typo, it assigns 'args' instead of 'arg'.

Rename the local variable which holds the string from the domain config
file to avoid further confusion.

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

xen-unstable changeset: 26018:ecc7627ca6d7
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r b8d7371bee78 -r dbb1872bbb97 tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub	Fri Oct 26 16:45:17 2012 +0100
+++ b/tools/pygrub/src/pygrub	Fri Oct 26 16:45:34 2012 +0100
@@ -585,7 +585,7 @@ def get_entry_idx(cf, entry):
 
     return None
 
-def run_grub(file, entry, fs, arg):
+def run_grub(file, entry, fs, cfg_args):
     global g
     global sel
 
@@ -622,8 +622,8 @@ def run_grub(file, entry, fs, arg):
         grubcfg["ramdisk"] = img.initrd[1]
     if img.args:
         grubcfg["args"] += img.args
-    if arg:
-        grubcfg["args"] += " " + args
+    if cfg_args:
+        grubcfg["args"] += " " + cfg_args
 
     return grubcfg
 

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XL-0000aH-MN; Fri, 02 Nov 2012 05:11: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 1TU9XK-0000ZY-J4
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:18 +0000
Received: from [85.158.139.211:22559] by server-16.bemta-5.messagelabs.com id
	4E/F6-04786-5F553905; Fri, 02 Nov 2012 05:11:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-206.messagelabs.com!1351833076!18124827!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25345 invoked from network); 2 Nov 2012 05:11:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2012 05:11: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 1TU9XI-0000fI-0v
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XH-0006OP-VQ
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:15 +0000
Message-Id: <E1TU9XH-0006OP-VQ@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:15 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] hotplug/Linux: Remove tracing
	(bash -x) from network-nat script
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351266287 -3600
# Node ID 6adf0c7937bf5ca515aa27c15f7752459b03b971
# Parent  9c0101d79839656cce28928d57e95ec6b4ab5841
hotplug/Linux: Remove tracing (bash -x) from network-nat script

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

xen-unstable changeset: 26006:8b6870d686d6
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 9c0101d79839 -r 6adf0c7937bf tools/hotplug/Linux/network-nat
--- a/tools/hotplug/Linux/network-nat	Fri Oct 26 16:43:12 2012 +0100
+++ b/tools/hotplug/Linux/network-nat	Fri Oct 26 16:44:47 2012 +0100
@@ -1,4 +1,4 @@
-#!/bin/bash -x
+#!/bin/bash
 #============================================================================
 # Default Xen network start/stop script when using NAT.
 # Xend calls a network script when it starts.

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XL-0000aH-MN; Fri, 02 Nov 2012 05:11: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 1TU9XK-0000ZY-J4
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:18 +0000
Received: from [85.158.139.211:22559] by server-16.bemta-5.messagelabs.com id
	4E/F6-04786-5F553905; Fri, 02 Nov 2012 05:11:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-206.messagelabs.com!1351833076!18124827!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25345 invoked from network); 2 Nov 2012 05:11:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2012 05:11: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 1TU9XI-0000fI-0v
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XH-0006OP-VQ
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:15 +0000
Message-Id: <E1TU9XH-0006OP-VQ@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:15 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] hotplug/Linux: Remove tracing
	(bash -x) from network-nat script
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351266287 -3600
# Node ID 6adf0c7937bf5ca515aa27c15f7752459b03b971
# Parent  9c0101d79839656cce28928d57e95ec6b4ab5841
hotplug/Linux: Remove tracing (bash -x) from network-nat script

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

xen-unstable changeset: 26006:8b6870d686d6
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 9c0101d79839 -r 6adf0c7937bf tools/hotplug/Linux/network-nat
--- a/tools/hotplug/Linux/network-nat	Fri Oct 26 16:43:12 2012 +0100
+++ b/tools/hotplug/Linux/network-nat	Fri Oct 26 16:44:47 2012 +0100
@@ -1,4 +1,4 @@
-#!/bin/bash -x
+#!/bin/bash
 #============================================================================
 # Default Xen network start/stop script when using NAT.
 # Xend calls a network script when it starts.

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XO-0000f5-GE; Fri, 02 Nov 2012 05:11:22 +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 1TU9XM-0000b2-NG
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:21 +0000
Received: from [85.158.138.51:39806] by server-4.bemta-3.messagelabs.com id
	F1/02-30023-7F553905; Fri, 02 Nov 2012 05:11:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1351833077!28390741!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29762 invoked from network); 2 Nov 2012 05:11:18 -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;
	2 Nov 2012 05:11: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 1TU9XJ-0000fX-2t
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XJ-0006Ot-1O
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:17 +0000
Message-Id: <E1TU9XJ-0006Ot-1O@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:16 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] stubdom: fix parallel build by
	expanding CROSS_MAKE
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351266317 -3600
# Node ID b8d7371bee78028e80884b25b066355dd81c0a26
# Parent  dcd4bf8242842fe7d8390d508fc378db96aad975
stubdom: fix parallel build by expanding CROSS_MAKE

Recently I changed my rpm xen.spec file from doing
'make -C tools -j N && make stubdom' to 'make -j N stubdom' because
stubdom depends on tools, so both get built.
The result was the failure below.

....
mkdir -p grub-x86_64
CPPFLAGS="-isystem /home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/../extras/mini-os/include -D__MINIOS__ -DHAVE_LIBC -isystem /home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/../extras/mini-os/include/posix -isystem /home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/../tools/xenstore  -isystem /home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/../extras/mini-os/include/x86 -isystem /home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/../extras/mini-os/include/x86/x86_64 -U __linux__ -U __FreeBSD__ -U __sun__ -nostdinc -isystem /home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/../extras/mini-os/include/posix -isystem /home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/cross-root-x86_64/x86_64-xen-elf/include -isystem /usr/lib64/gcc/x86_64-suse-linux/4.7/include -isystem /home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/lwip-x86_64/src/include -isystem /home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/lwip-x86_64/src/include/ipv4 -I/home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/include -I/home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/../xen/include" CFLAGS="-mno-red-zone -O1 -fno-omit-frame-pointer  -m64 -mno-red-zone -fno-reorder-blocks -fno-asynchronous-unwind-tables -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable   -fno-stack-protector -fno-exceptions" make DESTDIR= -C grub OBJ_DIR=/home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/grub-x86_64
make[2]: Entering directory `/home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/grub'
make[2]: warning: jobserver unavailable: using -j1.  Add `+' to parent make rule.
make[2]: *** INTERNAL: readdir: Bad file descriptor
.  Stop.
make[2]: Makefile: Field 'stem' not cached: Makefile

make[2]: Leaving directory `/home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/grub'
make[1]: *** [grub] Error 2
[ -d mini-os-x86_64-xenstore ] || \
for i in $(cd /home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/../extras/mini-os ; find . -type d) ; do \
                mkdir -p mini-os-x86_64-xenstore/$i ; \
done
....

Expanding every occurrence of CROSS_MAKE avoids this error. It also has
the nice side effect of actually enabling parallel build for stubdom.
According to the GNU make documentation $(MAKE) gets its special meaning
only if it appears directly in the recipe:

http://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html

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

xen-unstable changeset: 26011:b6fb4e63b946
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r dcd4bf824284 -r b8d7371bee78 stubdom/Makefile
--- a/stubdom/Makefile	Fri Oct 26 16:45:00 2012 +0100
+++ b/stubdom/Makefile	Fri Oct 26 16:45:17 2012 +0100
@@ -76,8 +76,6 @@ TARGET_LDFLAGS += -nostdlib -L$(CROSS_PR
 
 TARGETS=ioemu c caml grub xenstore
 
-CROSS_MAKE := $(MAKE) DESTDIR=
-
 .PHONY: all
 all: build
 ifeq ($(STUBDOM_SUPPORTED),1)
@@ -113,8 +111,8 @@ cross-newlib: $(NEWLIB_STAMPFILE)
 	mkdir -p newlib-$(XEN_TARGET_ARCH)
 	( cd newlib-$(XEN_TARGET_ARCH) && \
 	  CC_FOR_TARGET="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(NEWLIB_CFLAGS)" AR_FOR_TARGET=$(AR) LD_FOR_TARGET=$(LD) RANLIB_FOR_TARGET=$(RANLIB) ../newlib-$(NEWLIB_VERSION)/configure --prefix=$(CROSS_PREFIX) --verbose --target=$(GNU_TARGET_ARCH)-xen-elf --enable-newlib-io-long-long --disable-multilib && \
-	  $(CROSS_MAKE) && \
-	  $(CROSS_MAKE) install )
+	  $(MAKE) DESTDIR= && \
+	  $(MAKE) DESTDIR= install )
 
 ############
 # Cross-zlib
@@ -133,8 +131,8 @@ cross-zlib: $(ZLIB_STAMPFILE)
 $(ZLIB_STAMPFILE): zlib-$(XEN_TARGET_ARCH) $(NEWLIB_STAMPFILE)
 	( cd $< && \
 	  CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" CC=$(CC) ./configure --prefix=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf && \
-	  $(CROSS_MAKE) libz.a && \
-	  $(CROSS_MAKE) install )
+	  $(MAKE) DESTDIR= libz.a && \
+	  $(MAKE) DESTDIR= install )
 
 ##############
 # Cross-libpci
@@ -158,7 +156,7 @@ cross-libpci: $(LIBPCI_STAMPFILE)
 	  chmod u+w lib/config.h && \
 	  echo '#define PCILIB_VERSION "$(LIBPCI_VERSION)"' >> lib/config.h && \
 	  ln -sf ../../libpci.config.mak lib/config.mk && \
-	  $(CROSS_MAKE) CC="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -I$(call realpath,$(MINI_OS)/include)" lib/libpci.a && \
+	  $(MAKE) DESTDIR= CC="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -I$(call realpath,$(MINI_OS)/include)" lib/libpci.a && \
 	  $(INSTALL_DATA) lib/libpci.a $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib/ && \
 	  $(INSTALL_DIR) $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/pci && \
 	  $(INSTALL_DATA) lib/config.h lib/header.h lib/pci.h lib/types.h $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/pci/ \
@@ -203,8 +201,8 @@ cross-ocaml: $(OCAML_STAMPFILE)
 		-no-pthread -no-shared-libs -no-tk -no-curses \
 		-cc "$(CC) -U_FORTIFY_SOURCE -fno-stack-protector -mno-red-zone"
 	$(foreach i,$(MINIOS_HASNOT),sed -i 's,^\(#define HAS_$(i)\),//\1,' ocaml-$(XEN_TARGET_ARCH)/config/s.h ; )
-	$(CROSS_MAKE) -C ocaml-$(XEN_TARGET_ARCH) world
-	$(CROSS_MAKE) -C ocaml-$(XEN_TARGET_ARCH) opt
+	$(MAKE) DESTDIR= -C ocaml-$(XEN_TARGET_ARCH) world
+	$(MAKE) DESTDIR= -C ocaml-$(XEN_TARGET_ARCH) opt
 	$(MAKE) -C ocaml-$(XEN_TARGET_ARCH) install
 	touch $@
 
@@ -219,7 +217,7 @@ QEMU_ROOT := $(shell if [ -d "$(CONFIG_Q
 
 ifeq ($(QEMU_ROOT),.)
 $(XEN_ROOT)/tools/qemu-xen-traditional-dir:
-	$(CROSS_MAKE) -C $(XEN_ROOT)/tools qemu-xen-traditional-dir-find
+	$(MAKE) DESTDIR= -C $(XEN_ROOT)/tools qemu-xen-traditional-dir-find
 
 ioemu/linkfarm.stamp: $(XEN_ROOT)/tools/qemu-xen-traditional-dir
 	mkdir -p ioemu
@@ -250,7 +248,7 @@ mk-headers-$(XEN_TARGET_ARCH): ioemu/lin
           ( [ -h include/xen/libelf ] || ln -sf $(XEN_ROOT)/tools/include/xen/libelf include/xen/libelf ) && \
 	  mkdir -p include/xen-foreign && \
 	  ln -sf $(wildcard $(XEN_ROOT)/tools/include/xen-foreign/*) include/xen-foreign/ && \
-	  $(CROSS_MAKE) -C include/xen-foreign/ && \
+	  $(MAKE) DESTDIR= -C include/xen-foreign/ && \
 	  ( [ -h include/xen/foreign ] || ln -sf ../xen-foreign include/xen/foreign )
 	mkdir -p libxc-$(XEN_TARGET_ARCH)
 	[ -h libxc-$(XEN_TARGET_ARCH)/Makefile ] || ( cd libxc-$(XEN_TARGET_ARCH) && \
@@ -267,7 +265,7 @@ mk-headers-$(XEN_TARGET_ARCH): ioemu/lin
 	  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
+	$(MAKE) DESTDIR= -C $(MINI_OS) links
 	touch mk-headers-$(XEN_TARGET_ARCH)
 
 TARGETS_MINIOS=$(addprefix mini-os-$(XEN_TARGET_ARCH)-,$(TARGETS))
@@ -284,7 +282,7 @@ TARGETS_MINIOS=$(addprefix mini-os-$(XEN
 .PHONY: libxc
 libxc: libxc-$(XEN_TARGET_ARCH)/libxenctrl.a libxc-$(XEN_TARGET_ARCH)/libxenguest.a
 libxc-$(XEN_TARGET_ARCH)/libxenctrl.a: cross-zlib
-	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C libxc-$(XEN_TARGET_ARCH)
+	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C libxc-$(XEN_TARGET_ARCH)
 
  libxc-$(XEN_TARGET_ARCH)/libxenguest.a: libxc-$(XEN_TARGET_ARCH)/libxenctrl.a
 
@@ -302,7 +300,7 @@ ioemu: cross-zlib cross-libpci libxc
 	    TARGET_CFLAGS="$(TARGET_CFLAGS)" \
 	    TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \
 	    $(QEMU_ROOT)/xen-setup-stubdom )
-	$(CROSS_MAKE) -C ioemu -f $(QEMU_ROOT)/Makefile
+	$(MAKE) DESTDIR= -C ioemu -f $(QEMU_ROOT)/Makefile
 
 ######
 # caml
@@ -310,7 +308,7 @@ ioemu: cross-zlib cross-libpci libxc
 
 .PHONY: caml
 caml: $(CROSS_ROOT)
-	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) OCAMLC_CROSS_PREFIX=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/bin/
+	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C $@ LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) OCAMLC_CROSS_PREFIX=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/bin/
 
 ###
 # C
@@ -318,7 +316,7 @@ caml: $(CROSS_ROOT)
 
 .PHONY: c
 c: $(CROSS_ROOT)
-	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
+	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C $@ LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
 
 ######
 # Grub
@@ -337,7 +335,7 @@ grub-upstream: grub-$(GRUB_VERSION).tar.
 .PHONY: grub
 grub: grub-upstream $(CROSS_ROOT)
 	mkdir -p grub-$(XEN_TARGET_ARCH)
-	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C $@ OBJ_DIR=$(CURDIR)/grub-$(XEN_TARGET_ARCH)
+	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C $@ OBJ_DIR=$(CURDIR)/grub-$(XEN_TARGET_ARCH)
 
 ##########
 # xenstore
@@ -345,7 +343,7 @@ grub: grub-upstream $(CROSS_ROOT)
 
 .PHONY: xenstore
 xenstore: $(CROSS_ROOT)
-	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C $@ xenstored.a CONFIG_STUBDOM=y
+	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C $@ xenstored.a CONFIG_STUBDOM=y
 
 ########
 # minios
@@ -354,23 +352,23 @@ xenstore: $(CROSS_ROOT)
 .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="$(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)"
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/ioemu-minios.cfg" $(MAKE) DESTDIR= -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="$(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"
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/caml/minios.cfg" $(MAKE) DESTDIR= -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="$(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
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/c/minios.cfg" $(MAKE) DESTDIR= -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="$(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
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/grub/minios.cfg" $(MAKE) DESTDIR= -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
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstore-minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstore/xenstored.a
 
 #########
 # install
@@ -412,13 +410,13 @@ clean:
 	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
+	$(MAKE) DESTDIR= -C caml clean
+	$(MAKE) DESTDIR= -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
+	[ ! -d libxc-$(XEN_TARGET_ARCH) ] || $(MAKE) DESTDIR= -C libxc-$(XEN_TARGET_ARCH) clean
+	-[ ! -d ioemu ] || $(MAKE) DESTDIR= -C ioemu clean
+	-[ ! -d xenstore ] || $(MAKE) DESTDIR= -C xenstore clean
 
 # clean the cross-compilation result
 .PHONY: crossclean

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XO-0000f5-GE; Fri, 02 Nov 2012 05:11:22 +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 1TU9XM-0000b2-NG
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:21 +0000
Received: from [85.158.138.51:39806] by server-4.bemta-3.messagelabs.com id
	F1/02-30023-7F553905; Fri, 02 Nov 2012 05:11:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1351833077!28390741!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29762 invoked from network); 2 Nov 2012 05:11:18 -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;
	2 Nov 2012 05:11: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 1TU9XJ-0000fX-2t
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XJ-0006Ot-1O
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:17 +0000
Message-Id: <E1TU9XJ-0006Ot-1O@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:16 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] stubdom: fix parallel build by
	expanding CROSS_MAKE
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351266317 -3600
# Node ID b8d7371bee78028e80884b25b066355dd81c0a26
# Parent  dcd4bf8242842fe7d8390d508fc378db96aad975
stubdom: fix parallel build by expanding CROSS_MAKE

Recently I changed my rpm xen.spec file from doing
'make -C tools -j N && make stubdom' to 'make -j N stubdom' because
stubdom depends on tools, so both get built.
The result was the failure below.

....
mkdir -p grub-x86_64
CPPFLAGS="-isystem /home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/../extras/mini-os/include -D__MINIOS__ -DHAVE_LIBC -isystem /home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/../extras/mini-os/include/posix -isystem /home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/../tools/xenstore  -isystem /home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/../extras/mini-os/include/x86 -isystem /home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/../extras/mini-os/include/x86/x86_64 -U __linux__ -U __FreeBSD__ -U __sun__ -nostdinc -isystem /home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/../extras/mini-os/include/posix -isystem /home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/cross-root-x86_64/x86_64-xen-elf/include -isystem /usr/lib64/gcc/x86_64-suse-linux/4.7/include -isystem /home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/lwip-x86_64/src/include -isystem /home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/lwip-x86_64/src/include/ipv4 -I/home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/include -I/home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/../xen/include" CFLAGS="-mno-red-zone -O1 -fno-omit-frame-pointer  -m64 -mno-red-zone -fno-reorder-blocks -fno-asynchronous-unwind-tables -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable   -fno-stack-protector -fno-exceptions" make DESTDIR= -C grub OBJ_DIR=/home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/grub-x86_64
make[2]: Entering directory `/home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/grub'
make[2]: warning: jobserver unavailable: using -j1.  Add `+' to parent make rule.
make[2]: *** INTERNAL: readdir: Bad file descriptor
.  Stop.
make[2]: Makefile: Field 'stem' not cached: Makefile

make[2]: Leaving directory `/home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/grub'
make[1]: *** [grub] Error 2
[ -d mini-os-x86_64-xenstore ] || \
for i in $(cd /home/abuild/rpmbuild/BUILD/xen-4.2.25602/non-dbg/stubdom/../extras/mini-os ; find . -type d) ; do \
                mkdir -p mini-os-x86_64-xenstore/$i ; \
done
....

Expanding every occurrence of CROSS_MAKE avoids this error. It also has
the nice side effect of actually enabling parallel build for stubdom.
According to the GNU make documentation $(MAKE) gets its special meaning
only if it appears directly in the recipe:

http://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html

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

xen-unstable changeset: 26011:b6fb4e63b946
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r dcd4bf824284 -r b8d7371bee78 stubdom/Makefile
--- a/stubdom/Makefile	Fri Oct 26 16:45:00 2012 +0100
+++ b/stubdom/Makefile	Fri Oct 26 16:45:17 2012 +0100
@@ -76,8 +76,6 @@ TARGET_LDFLAGS += -nostdlib -L$(CROSS_PR
 
 TARGETS=ioemu c caml grub xenstore
 
-CROSS_MAKE := $(MAKE) DESTDIR=
-
 .PHONY: all
 all: build
 ifeq ($(STUBDOM_SUPPORTED),1)
@@ -113,8 +111,8 @@ cross-newlib: $(NEWLIB_STAMPFILE)
 	mkdir -p newlib-$(XEN_TARGET_ARCH)
 	( cd newlib-$(XEN_TARGET_ARCH) && \
 	  CC_FOR_TARGET="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(NEWLIB_CFLAGS)" AR_FOR_TARGET=$(AR) LD_FOR_TARGET=$(LD) RANLIB_FOR_TARGET=$(RANLIB) ../newlib-$(NEWLIB_VERSION)/configure --prefix=$(CROSS_PREFIX) --verbose --target=$(GNU_TARGET_ARCH)-xen-elf --enable-newlib-io-long-long --disable-multilib && \
-	  $(CROSS_MAKE) && \
-	  $(CROSS_MAKE) install )
+	  $(MAKE) DESTDIR= && \
+	  $(MAKE) DESTDIR= install )
 
 ############
 # Cross-zlib
@@ -133,8 +131,8 @@ cross-zlib: $(ZLIB_STAMPFILE)
 $(ZLIB_STAMPFILE): zlib-$(XEN_TARGET_ARCH) $(NEWLIB_STAMPFILE)
 	( cd $< && \
 	  CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" CC=$(CC) ./configure --prefix=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf && \
-	  $(CROSS_MAKE) libz.a && \
-	  $(CROSS_MAKE) install )
+	  $(MAKE) DESTDIR= libz.a && \
+	  $(MAKE) DESTDIR= install )
 
 ##############
 # Cross-libpci
@@ -158,7 +156,7 @@ cross-libpci: $(LIBPCI_STAMPFILE)
 	  chmod u+w lib/config.h && \
 	  echo '#define PCILIB_VERSION "$(LIBPCI_VERSION)"' >> lib/config.h && \
 	  ln -sf ../../libpci.config.mak lib/config.mk && \
-	  $(CROSS_MAKE) CC="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -I$(call realpath,$(MINI_OS)/include)" lib/libpci.a && \
+	  $(MAKE) DESTDIR= CC="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -I$(call realpath,$(MINI_OS)/include)" lib/libpci.a && \
 	  $(INSTALL_DATA) lib/libpci.a $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib/ && \
 	  $(INSTALL_DIR) $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/pci && \
 	  $(INSTALL_DATA) lib/config.h lib/header.h lib/pci.h lib/types.h $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/pci/ \
@@ -203,8 +201,8 @@ cross-ocaml: $(OCAML_STAMPFILE)
 		-no-pthread -no-shared-libs -no-tk -no-curses \
 		-cc "$(CC) -U_FORTIFY_SOURCE -fno-stack-protector -mno-red-zone"
 	$(foreach i,$(MINIOS_HASNOT),sed -i 's,^\(#define HAS_$(i)\),//\1,' ocaml-$(XEN_TARGET_ARCH)/config/s.h ; )
-	$(CROSS_MAKE) -C ocaml-$(XEN_TARGET_ARCH) world
-	$(CROSS_MAKE) -C ocaml-$(XEN_TARGET_ARCH) opt
+	$(MAKE) DESTDIR= -C ocaml-$(XEN_TARGET_ARCH) world
+	$(MAKE) DESTDIR= -C ocaml-$(XEN_TARGET_ARCH) opt
 	$(MAKE) -C ocaml-$(XEN_TARGET_ARCH) install
 	touch $@
 
@@ -219,7 +217,7 @@ QEMU_ROOT := $(shell if [ -d "$(CONFIG_Q
 
 ifeq ($(QEMU_ROOT),.)
 $(XEN_ROOT)/tools/qemu-xen-traditional-dir:
-	$(CROSS_MAKE) -C $(XEN_ROOT)/tools qemu-xen-traditional-dir-find
+	$(MAKE) DESTDIR= -C $(XEN_ROOT)/tools qemu-xen-traditional-dir-find
 
 ioemu/linkfarm.stamp: $(XEN_ROOT)/tools/qemu-xen-traditional-dir
 	mkdir -p ioemu
@@ -250,7 +248,7 @@ mk-headers-$(XEN_TARGET_ARCH): ioemu/lin
           ( [ -h include/xen/libelf ] || ln -sf $(XEN_ROOT)/tools/include/xen/libelf include/xen/libelf ) && \
 	  mkdir -p include/xen-foreign && \
 	  ln -sf $(wildcard $(XEN_ROOT)/tools/include/xen-foreign/*) include/xen-foreign/ && \
-	  $(CROSS_MAKE) -C include/xen-foreign/ && \
+	  $(MAKE) DESTDIR= -C include/xen-foreign/ && \
 	  ( [ -h include/xen/foreign ] || ln -sf ../xen-foreign include/xen/foreign )
 	mkdir -p libxc-$(XEN_TARGET_ARCH)
 	[ -h libxc-$(XEN_TARGET_ARCH)/Makefile ] || ( cd libxc-$(XEN_TARGET_ARCH) && \
@@ -267,7 +265,7 @@ mk-headers-$(XEN_TARGET_ARCH): ioemu/lin
 	  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
+	$(MAKE) DESTDIR= -C $(MINI_OS) links
 	touch mk-headers-$(XEN_TARGET_ARCH)
 
 TARGETS_MINIOS=$(addprefix mini-os-$(XEN_TARGET_ARCH)-,$(TARGETS))
@@ -284,7 +282,7 @@ TARGETS_MINIOS=$(addprefix mini-os-$(XEN
 .PHONY: libxc
 libxc: libxc-$(XEN_TARGET_ARCH)/libxenctrl.a libxc-$(XEN_TARGET_ARCH)/libxenguest.a
 libxc-$(XEN_TARGET_ARCH)/libxenctrl.a: cross-zlib
-	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C libxc-$(XEN_TARGET_ARCH)
+	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C libxc-$(XEN_TARGET_ARCH)
 
  libxc-$(XEN_TARGET_ARCH)/libxenguest.a: libxc-$(XEN_TARGET_ARCH)/libxenctrl.a
 
@@ -302,7 +300,7 @@ ioemu: cross-zlib cross-libpci libxc
 	    TARGET_CFLAGS="$(TARGET_CFLAGS)" \
 	    TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \
 	    $(QEMU_ROOT)/xen-setup-stubdom )
-	$(CROSS_MAKE) -C ioemu -f $(QEMU_ROOT)/Makefile
+	$(MAKE) DESTDIR= -C ioemu -f $(QEMU_ROOT)/Makefile
 
 ######
 # caml
@@ -310,7 +308,7 @@ ioemu: cross-zlib cross-libpci libxc
 
 .PHONY: caml
 caml: $(CROSS_ROOT)
-	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) OCAMLC_CROSS_PREFIX=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/bin/
+	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C $@ LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) OCAMLC_CROSS_PREFIX=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/bin/
 
 ###
 # C
@@ -318,7 +316,7 @@ caml: $(CROSS_ROOT)
 
 .PHONY: c
 c: $(CROSS_ROOT)
-	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
+	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C $@ LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) 
 
 ######
 # Grub
@@ -337,7 +335,7 @@ grub-upstream: grub-$(GRUB_VERSION).tar.
 .PHONY: grub
 grub: grub-upstream $(CROSS_ROOT)
 	mkdir -p grub-$(XEN_TARGET_ARCH)
-	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C $@ OBJ_DIR=$(CURDIR)/grub-$(XEN_TARGET_ARCH)
+	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C $@ OBJ_DIR=$(CURDIR)/grub-$(XEN_TARGET_ARCH)
 
 ##########
 # xenstore
@@ -345,7 +343,7 @@ grub: grub-upstream $(CROSS_ROOT)
 
 .PHONY: xenstore
 xenstore: $(CROSS_ROOT)
-	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C $@ xenstored.a CONFIG_STUBDOM=y
+	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C $@ xenstored.a CONFIG_STUBDOM=y
 
 ########
 # minios
@@ -354,23 +352,23 @@ xenstore: $(CROSS_ROOT)
 .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="$(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)"
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/ioemu-minios.cfg" $(MAKE) DESTDIR= -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="$(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"
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/caml/minios.cfg" $(MAKE) DESTDIR= -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="$(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
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/c/minios.cfg" $(MAKE) DESTDIR= -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="$(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
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/grub/minios.cfg" $(MAKE) DESTDIR= -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
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstore-minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstore/xenstored.a
 
 #########
 # install
@@ -412,13 +410,13 @@ clean:
 	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
+	$(MAKE) DESTDIR= -C caml clean
+	$(MAKE) DESTDIR= -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
+	[ ! -d libxc-$(XEN_TARGET_ARCH) ] || $(MAKE) DESTDIR= -C libxc-$(XEN_TARGET_ARCH) clean
+	-[ ! -d ioemu ] || $(MAKE) DESTDIR= -C ioemu clean
+	-[ ! -d xenstore ] || $(MAKE) DESTDIR= -C xenstore clean
 
 # clean the cross-compilation result
 .PHONY: crossclean

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XP-0000gD-2O; Fri, 02 Nov 2012 05:11:23 +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 1TU9XN-0000XU-7l
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:21 +0000
Received: from [85.158.138.51:39827] by server-11.bemta-3.messagelabs.com id
	15/F7-19361-8F553905; Fri, 02 Nov 2012 05:11:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-174.messagelabs.com!1351833079!28377917!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9121 invoked from network); 2 Nov 2012 05:11:20 -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;
	2 Nov 2012 05:11: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 1TU9XL-0000fj-5s
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XL-0006Ps-4L
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:19 +0000
Message-Id: <E1TU9XL-0006Ps-4L@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:18 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] init scripts: xendomains correct
	order of options for shutdown command
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Sander Eikelenboom <linux@eikelenboom.it>
# Date 1351266477 -3600
# Node ID fcd73195cf24175738135c144defcdb01fe74f37
# Parent  1787c24c9808c8491cb0d5365a3b347f326952c2
init scripts: xendomains correct order of options for shutdown command

Options for the shutdown command that are supplied behind the domain id are
ignored. In case of the default xendomains init script this means that it will
not wait for the domains to be actually shutdown.

Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 26044:4845b5ce90e8
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 1787c24c9808 -r fcd73195cf24 tools/hotplug/Linux/init.d/xendomains
--- a/tools/hotplug/Linux/init.d/xendomains	Fri Oct 26 16:47:33 2012 +0100
+++ b/tools/hotplug/Linux/init.d/xendomains	Fri Oct 26 16:47:57 2012 +0100
@@ -438,7 +438,7 @@ stop()
 	    echo -n "(shut)"
 	    watchdog_xencmd shutdown &
 	    WDOG_PID=$!
-	    XMR=`$CMD shutdown $id $XENDOMAINS_SHUTDOWN 2>&1 1>/dev/null`
+	    XMR=`$CMD shutdown $XENDOMAINS_SHUTDOWN $id 2>&1 1>/dev/null`
 	    if test $? -ne 0; then
 		echo -e "\nAn error occurred while shutting down domain:\n$XMR\n"
 		rc_failed $?

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XP-0000gD-2O; Fri, 02 Nov 2012 05:11:23 +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 1TU9XN-0000XU-7l
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:21 +0000
Received: from [85.158.138.51:39827] by server-11.bemta-3.messagelabs.com id
	15/F7-19361-8F553905; Fri, 02 Nov 2012 05:11:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-174.messagelabs.com!1351833079!28377917!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9121 invoked from network); 2 Nov 2012 05:11:20 -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;
	2 Nov 2012 05:11: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 1TU9XL-0000fj-5s
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XL-0006Ps-4L
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:19 +0000
Message-Id: <E1TU9XL-0006Ps-4L@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:18 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] init scripts: xendomains correct
	order of options for shutdown command
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Sander Eikelenboom <linux@eikelenboom.it>
# Date 1351266477 -3600
# Node ID fcd73195cf24175738135c144defcdb01fe74f37
# Parent  1787c24c9808c8491cb0d5365a3b347f326952c2
init scripts: xendomains correct order of options for shutdown command

Options for the shutdown command that are supplied behind the domain id are
ignored. In case of the default xendomains init script this means that it will
not wait for the domains to be actually shutdown.

Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 26044:4845b5ce90e8
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 1787c24c9808 -r fcd73195cf24 tools/hotplug/Linux/init.d/xendomains
--- a/tools/hotplug/Linux/init.d/xendomains	Fri Oct 26 16:47:33 2012 +0100
+++ b/tools/hotplug/Linux/init.d/xendomains	Fri Oct 26 16:47:57 2012 +0100
@@ -438,7 +438,7 @@ stop()
 	    echo -n "(shut)"
 	    watchdog_xencmd shutdown &
 	    WDOG_PID=$!
-	    XMR=`$CMD shutdown $id $XENDOMAINS_SHUTDOWN 2>&1 1>/dev/null`
+	    XMR=`$CMD shutdown $XENDOMAINS_SHUTDOWN $id 2>&1 1>/dev/null`
 	    if test $? -ne 0; then
 		echo -e "\nAn error occurred while shutting down domain:\n$XMR\n"
 		rc_failed $?

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XO-0000fo-Oc; Fri, 02 Nov 2012 05:11:22 +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 1TU9XN-0000bK-2e
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:21 +0000
Received: from [85.158.138.51:4383] by server-13.bemta-3.messagelabs.com id
	C0/F0-24887-8F553905; Fri, 02 Nov 2012 05:11:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-174.messagelabs.com!1351833078!20352505!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2189 invoked from network); 2 Nov 2012 05:11:19 -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;
	2 Nov 2012 05:11: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 1TU9XK-0000fd-6t
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XK-0006PN-2e
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:18 +0000
Message-Id: <E1TU9XK-0006PN-2e@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:17 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] docs,
	build: Tolerate missing pod2text
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351266441 -3600
# Node ID 76d3d1d4aca09cc2f6d839f9611857627540e5f0
# Parent  dbb1872bbb97edc26fda69e922344d88990322d2
docs, build: Tolerate missing pod2text

We gate the whole of the "txt" target on pod2text.  I think this is
better than gating only the pod-generated outputs; it avoids a partial
output tree.

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

xen-unstable changeset: 26041:f92152f52a85
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r dbb1872bbb97 -r 76d3d1d4aca0 docs/Makefile
--- a/docs/Makefile	Fri Oct 26 16:45:34 2012 +0100
+++ b/docs/Makefile	Fri Oct 26 16:47:21 2012 +0100
@@ -38,7 +38,10 @@ dev-docs: python-dev-docs
 html: $(DOC_HTML) html/index.html
 
 .PHONY: txt
-txt: $(DOC_TXT)
+txt:
+	@if which $(POD2TEXT) 1>/dev/null 2>/dev/null; then \
+	$(MAKE) $(DOC_TXT); else              \
+	echo "pod2text not installed; skipping text outputs."; fi
 
 .PHONY: python-dev-docs
 python-dev-docs:

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XO-0000fo-Oc; Fri, 02 Nov 2012 05:11:22 +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 1TU9XN-0000bK-2e
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:21 +0000
Received: from [85.158.138.51:4383] by server-13.bemta-3.messagelabs.com id
	C0/F0-24887-8F553905; Fri, 02 Nov 2012 05:11:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-174.messagelabs.com!1351833078!20352505!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2189 invoked from network); 2 Nov 2012 05:11:19 -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;
	2 Nov 2012 05:11: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 1TU9XK-0000fd-6t
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XK-0006PN-2e
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:18 +0000
Message-Id: <E1TU9XK-0006PN-2e@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:17 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] docs,
	build: Tolerate missing pod2text
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351266441 -3600
# Node ID 76d3d1d4aca09cc2f6d839f9611857627540e5f0
# Parent  dbb1872bbb97edc26fda69e922344d88990322d2
docs, build: Tolerate missing pod2text

We gate the whole of the "txt" target on pod2text.  I think this is
better than gating only the pod-generated outputs; it avoids a partial
output tree.

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

xen-unstable changeset: 26041:f92152f52a85
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r dbb1872bbb97 -r 76d3d1d4aca0 docs/Makefile
--- a/docs/Makefile	Fri Oct 26 16:45:34 2012 +0100
+++ b/docs/Makefile	Fri Oct 26 16:47:21 2012 +0100
@@ -38,7 +38,10 @@ dev-docs: python-dev-docs
 html: $(DOC_HTML) html/index.html
 
 .PHONY: txt
-txt: $(DOC_TXT)
+txt:
+	@if which $(POD2TEXT) 1>/dev/null 2>/dev/null; then \
+	$(MAKE) $(DOC_TXT); else              \
+	echo "pod2text not installed; skipping text outputs."; fi
 
 .PHONY: python-dev-docs
 python-dev-docs:

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XQ-0000iU-Jd; Fri, 02 Nov 2012 05:11: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 1TU9XP-0000g0-CA
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:23 +0000
Received: from [85.158.143.99:43862] by server-1.bemta-4.messagelabs.com id
	B0/9C-27934-AF553905; Fri, 02 Nov 2012 05:11:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1351833081!18544956!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29474 invoked from network); 2 Nov 2012 05:11:22 -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;
	2 Nov 2012 05:11: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 1TU9XM-0000fs-T4
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XM-0006Qc-RQ
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:20 +0000
Message-Id: <E1TU9XM-0006Qc-RQ@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:20 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] tools: xend: fix wrong condition
	check for xml file
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Joe Jin <joe.jin@oracle.com>
# Date 1351266573 -3600
# Node ID 82b61b99d15d92b6eeb075e30202a0afcd2f817b
# Parent  7b80ad1eab324b2aefa35ba7a5bfb8ee13790585
tools: xend: fix wrong condition check for xml file

In commit e8d40584, it intended to check xml file size and when empty will
return, the condition should be "if os.path.getsize(xml_path) == 0" rather
then "if not os.path.getsize(xml_path) == 0".

Signed-off-by: Chuang Cao <chuang.cao@oracle.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 26088:dd64a1bdbe3a
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 7b80ad1eab32 -r 82b61b99d15d tools/python/xen/xend/XendStateStore.py
--- a/tools/python/xen/xend/XendStateStore.py	Fri Oct 26 16:49:18 2012 +0100
+++ b/tools/python/xen/xend/XendStateStore.py	Fri Oct 26 16:49:33 2012 +0100
@@ -101,7 +101,7 @@ class XendStateStore:
         if not os.path.exists(xml_path):
             return {}
 
-        if not os.path.getsize(xml_path) == 0:
+        if os.path.getsize(xml_path) == 0:
             return {}
 
         dom = minidom.parse(xml_path)

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XQ-0000iU-Jd; Fri, 02 Nov 2012 05:11: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 1TU9XP-0000g0-CA
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:23 +0000
Received: from [85.158.143.99:43862] by server-1.bemta-4.messagelabs.com id
	B0/9C-27934-AF553905; Fri, 02 Nov 2012 05:11:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1351833081!18544956!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29474 invoked from network); 2 Nov 2012 05:11:22 -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;
	2 Nov 2012 05:11: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 1TU9XM-0000fs-T4
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XM-0006Qc-RQ
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:20 +0000
Message-Id: <E1TU9XM-0006Qc-RQ@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:20 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] tools: xend: fix wrong condition
	check for xml file
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Joe Jin <joe.jin@oracle.com>
# Date 1351266573 -3600
# Node ID 82b61b99d15d92b6eeb075e30202a0afcd2f817b
# Parent  7b80ad1eab324b2aefa35ba7a5bfb8ee13790585
tools: xend: fix wrong condition check for xml file

In commit e8d40584, it intended to check xml file size and when empty will
return, the condition should be "if os.path.getsize(xml_path) == 0" rather
then "if not os.path.getsize(xml_path) == 0".

Signed-off-by: Chuang Cao <chuang.cao@oracle.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 26088:dd64a1bdbe3a
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 7b80ad1eab32 -r 82b61b99d15d tools/python/xen/xend/XendStateStore.py
--- a/tools/python/xen/xend/XendStateStore.py	Fri Oct 26 16:49:18 2012 +0100
+++ b/tools/python/xen/xend/XendStateStore.py	Fri Oct 26 16:49:33 2012 +0100
@@ -101,7 +101,7 @@ class XendStateStore:
         if not os.path.exists(xml_path):
             return {}
 
-        if not os.path.getsize(xml_path) == 0:
+        if os.path.getsize(xml_path) == 0:
             return {}
 
         dom = minidom.parse(xml_path)

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XQ-0000id-ME; Fri, 02 Nov 2012 05:11: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 1TU9XP-0000f8-W7
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:24 +0000
Received: from [85.158.143.99:16989] by server-2.bemta-4.messagelabs.com id
	2C/F1-28922-BF553905; Fri, 02 Nov 2012 05:11:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-216.messagelabs.com!1351833082!28341673!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22325 invoked from network); 2 Nov 2012 05:11:23 -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;
	2 Nov 2012 05:11: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 1TU9XN-0000fy-WD
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:22 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XN-0006R6-Ul
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:21 +0000
Message-Id: <E1TU9XN-0006R6-Ul@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:21 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] hvmloader: Do not zero the
	wallclock fields in shared-info.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351497340 -3600
# Node ID 2bca7e58a3dff0c2d21993423e37bb01a942785c
# Parent  25eda7e7b4e602d2fff2792460c6be748847c683
hvmloader: Do not zero the wallclock fields in shared-info.

These fields need to be valid at all times. Hypervisor ensures this
even across 32/64-bit guest transitions.

This fixes a bug where wallclock time is incorrect for booting 32-bit
HVM guests.

This should be backported to Xen 4.1 and 4.2.

Signed-off-by: Keir Fraser <keir@xen.org>
Tested-and-Reported-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
xen-unstable changeset: 25908:12fa949b9060
xen-unstable date: Fri Sep 14 18:47:57 UTC 2012
---


diff -r 25eda7e7b4e6 -r 2bca7e58a3df tools/firmware/hvmloader/xenbus.c
--- a/tools/firmware/hvmloader/xenbus.c	Fri Oct 26 16:49:45 2012 +0100
+++ b/tools/firmware/hvmloader/xenbus.c	Mon Oct 29 08:55:40 2012 +0100
@@ -64,6 +64,8 @@ void xenbus_setup(void)
 /* Reset the xenbus connection so the next kernel can start again. */
 void xenbus_shutdown(void)
 {
+    struct shared_info *shinfo = get_shared_info();
+
     ASSERT(rings != NULL);
 
     /* We zero out the whole ring -- the backend can handle this, and it's 
@@ -72,7 +74,9 @@ void xenbus_shutdown(void)
     memset(rings, 0, sizeof *rings);
 
     /* Clear the event-channel state too. */
-    memset(get_shared_info(), 0, PAGE_SIZE);
+    memset(shinfo->vcpu_info, 0, sizeof(shinfo->vcpu_info));
+    memset(shinfo->evtchn_pending, 0, sizeof(shinfo->evtchn_pending));
+    memset(shinfo->evtchn_mask, 0, sizeof(shinfo->evtchn_mask));
 
     rings = NULL;
 }

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XQ-0000id-ME; Fri, 02 Nov 2012 05:11: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 1TU9XP-0000f8-W7
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:24 +0000
Received: from [85.158.143.99:16989] by server-2.bemta-4.messagelabs.com id
	2C/F1-28922-BF553905; Fri, 02 Nov 2012 05:11:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-216.messagelabs.com!1351833082!28341673!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22325 invoked from network); 2 Nov 2012 05:11:23 -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;
	2 Nov 2012 05:11: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 1TU9XN-0000fy-WD
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:22 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XN-0006R6-Ul
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:21 +0000
Message-Id: <E1TU9XN-0006R6-Ul@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:21 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] hvmloader: Do not zero the
	wallclock fields in shared-info.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351497340 -3600
# Node ID 2bca7e58a3dff0c2d21993423e37bb01a942785c
# Parent  25eda7e7b4e602d2fff2792460c6be748847c683
hvmloader: Do not zero the wallclock fields in shared-info.

These fields need to be valid at all times. Hypervisor ensures this
even across 32/64-bit guest transitions.

This fixes a bug where wallclock time is incorrect for booting 32-bit
HVM guests.

This should be backported to Xen 4.1 and 4.2.

Signed-off-by: Keir Fraser <keir@xen.org>
Tested-and-Reported-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
xen-unstable changeset: 25908:12fa949b9060
xen-unstable date: Fri Sep 14 18:47:57 UTC 2012
---


diff -r 25eda7e7b4e6 -r 2bca7e58a3df tools/firmware/hvmloader/xenbus.c
--- a/tools/firmware/hvmloader/xenbus.c	Fri Oct 26 16:49:45 2012 +0100
+++ b/tools/firmware/hvmloader/xenbus.c	Mon Oct 29 08:55:40 2012 +0100
@@ -64,6 +64,8 @@ void xenbus_setup(void)
 /* Reset the xenbus connection so the next kernel can start again. */
 void xenbus_shutdown(void)
 {
+    struct shared_info *shinfo = get_shared_info();
+
     ASSERT(rings != NULL);
 
     /* We zero out the whole ring -- the backend can handle this, and it's 
@@ -72,7 +74,9 @@ void xenbus_shutdown(void)
     memset(rings, 0, sizeof *rings);
 
     /* Clear the event-channel state too. */
-    memset(get_shared_info(), 0, PAGE_SIZE);
+    memset(shinfo->vcpu_info, 0, sizeof(shinfo->vcpu_info));
+    memset(shinfo->evtchn_pending, 0, sizeof(shinfo->evtchn_pending));
+    memset(shinfo->evtchn_mask, 0, sizeof(shinfo->evtchn_mask));
 
     rings = NULL;
 }

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XQ-0000iP-GB; Fri, 02 Nov 2012 05:11: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 1TU9XO-0000f8-Rq
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:23 +0000
Received: from [85.158.143.99:16936] by server-2.bemta-4.messagelabs.com id
	53/E1-28922-AF553905; Fri, 02 Nov 2012 05:11:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1351833080!27987529!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2538 invoked from network); 2 Nov 2012 05:11:21 -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;
	2 Nov 2012 05:11: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 1TU9XM-0000fp-Bz
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XM-0006QN-9n
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:20 +0000
Message-Id: <E1TU9XM-0006QN-9n@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:19 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxl: ao: cope with fast ao
	completion with progess events
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351266558 -3600
# Node ID 7b80ad1eab324b2aefa35ba7a5bfb8ee13790585
# Parent  fa38bd96d904b54df895db3cc589926b787cdb01
libxl: ao: cope with fast ao completion with progess events

There are two egcs in an ao initiator: the one in the AO_CREATE
function, and the one in libxl__ao_inprogress.  If synchronous ao
operation generates progress events and completes immediately, the
progress callbacks end up queued in the outer egc.  These callbacks
are currently only called after libxl__ao_inprogress has returned, and
keep the ao alive until they happen.  This is not good because the
principle is that a synchronous ao is not supposed to survive beyond
libxl__ao_inprogress's return.

The fix is to ensure that the callbacks queued in the outer egc are
called early enough that they don't preserve the ao.  This is
straightforward in the AO_INPROGRESS macro because AO_CREATE's egc is
not used inside that macro other than to destroy it.  All we have to
do is destroy it a bit sooner.

This involves unlocking and relocking the ctx since EGC_FREE expects
to be called with the lock released but libxl__ao_inprogress needs it
locked.  This hole in our lock tenure is fine - libxl__ao_inprogress
has such holes already.

It is still possible to use the CTX_LOCK macros for this unlock/lock
because the gc we are using is destroyed only afterwards by
libxl__ao_inprogress.

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

xen-unstable changeset: 26080:25b2f53d2583
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r fa38bd96d904 -r 7b80ad1eab32 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Oct 26 16:48:10 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Fri Oct 26 16:49:18 2012 +0100
@@ -1678,10 +1678,12 @@ _hidden void libxl__egc_cleanup(libxl__e
 
 #define AO_INPROGRESS ({                                        \
         libxl_ctx *ao__ctx = libxl__gc_owner(&ao->gc);          \
+        CTX_UNLOCK;                                             \
+        EGC_FREE;                                               \
+        CTX_LOCK;                                               \
         int ao__rc = libxl__ao_inprogress(ao,                   \
                                __FILE__, __LINE__, __func__);   \
         libxl__ctx_unlock(ao__ctx); /* gc is now invalid */     \
-        EGC_FREE;                                               \
         (ao__rc);                                               \
    })
 

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XQ-0000iP-GB; Fri, 02 Nov 2012 05:11: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 1TU9XO-0000f8-Rq
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:23 +0000
Received: from [85.158.143.99:16936] by server-2.bemta-4.messagelabs.com id
	53/E1-28922-AF553905; Fri, 02 Nov 2012 05:11:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1351833080!27987529!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2538 invoked from network); 2 Nov 2012 05:11:21 -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;
	2 Nov 2012 05:11: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 1TU9XM-0000fp-Bz
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XM-0006QN-9n
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:20 +0000
Message-Id: <E1TU9XM-0006QN-9n@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:19 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxl: ao: cope with fast ao
	completion with progess events
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351266558 -3600
# Node ID 7b80ad1eab324b2aefa35ba7a5bfb8ee13790585
# Parent  fa38bd96d904b54df895db3cc589926b787cdb01
libxl: ao: cope with fast ao completion with progess events

There are two egcs in an ao initiator: the one in the AO_CREATE
function, and the one in libxl__ao_inprogress.  If synchronous ao
operation generates progress events and completes immediately, the
progress callbacks end up queued in the outer egc.  These callbacks
are currently only called after libxl__ao_inprogress has returned, and
keep the ao alive until they happen.  This is not good because the
principle is that a synchronous ao is not supposed to survive beyond
libxl__ao_inprogress's return.

The fix is to ensure that the callbacks queued in the outer egc are
called early enough that they don't preserve the ao.  This is
straightforward in the AO_INPROGRESS macro because AO_CREATE's egc is
not used inside that macro other than to destroy it.  All we have to
do is destroy it a bit sooner.

This involves unlocking and relocking the ctx since EGC_FREE expects
to be called with the lock released but libxl__ao_inprogress needs it
locked.  This hole in our lock tenure is fine - libxl__ao_inprogress
has such holes already.

It is still possible to use the CTX_LOCK macros for this unlock/lock
because the gc we are using is destroyed only afterwards by
libxl__ao_inprogress.

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

xen-unstable changeset: 26080:25b2f53d2583
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r fa38bd96d904 -r 7b80ad1eab32 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Oct 26 16:48:10 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Fri Oct 26 16:49:18 2012 +0100
@@ -1678,10 +1678,12 @@ _hidden void libxl__egc_cleanup(libxl__e
 
 #define AO_INPROGRESS ({                                        \
         libxl_ctx *ao__ctx = libxl__gc_owner(&ao->gc);          \
+        CTX_UNLOCK;                                             \
+        EGC_FREE;                                               \
+        CTX_LOCK;                                               \
         int ao__rc = libxl__ao_inprogress(ao,                   \
                                __FILE__, __LINE__, __func__);   \
         libxl__ctx_unlock(ao__ctx); /* gc is now invalid */     \
-        EGC_FREE;                                               \
         (ao__rc);                                               \
    })
 

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XQ-0000iB-Bb; Fri, 02 Nov 2012 05:11:24 +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 1TU9XO-0000eE-MQ
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:22 +0000
Received: from [85.158.139.211:25610] by server-12.bemta-5.messagelabs.com id
	AC/ED-02886-9F553905; Fri, 02 Nov 2012 05:11:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-206.messagelabs.com!1351833080!18545961!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18196 invoked from network); 2 Nov 2012 05:11:20 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2012 05:11: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 1TU9XL-0000fm-PT
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XL-0006Q7-O4
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:19 +0000
Message-Id: <E1TU9XL-0006Q7-O4@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:19 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xl/libxl: make shutdown accept
	the long option --wait for -w
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Sander Eikelenboom <linux@eikelenboom.it>
# Date 1351266490 -3600
# Node ID fa38bd96d904b54df895db3cc589926b787cdb01
# Parent  fcd73195cf24175738135c144defcdb01fe74f37
xl/libxl: make shutdown accept the long option --wait for -w

Make xl/libxl accept the long option --wait for -w to be compatible with xm.
The long options are used in the default init and sysconfig scripts.

Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 26045:ba7198bfc679
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r fcd73195cf24 -r fa38bd96d904 docs/man/xl.pod.1
--- a/docs/man/xl.pod.1	Fri Oct 26 16:47:57 2012 +0100
+++ b/docs/man/xl.pod.1	Fri Oct 26 16:48:10 2012 +0100
@@ -550,7 +550,7 @@ B<OPTIONS>
 
 =over 4
 
-=item B<-w>
+=item B<-w>, B<--wait>
 
 Wait for the domain to complete shutdown before returning.
 
diff -r fcd73195cf24 -r fa38bd96d904 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Fri Oct 26 16:47:57 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Fri Oct 26 16:48:10 2012 +0100
@@ -3683,8 +3683,12 @@ int main_shutdown(int argc, char **argv)
     int opt;
     int wait = 0;
     int fallback_trigger = 0;
-
-    while ((opt = def_getopt(argc, argv, "wF", "shutdown", 1)) != -1) {
+    static struct option long_options[] = {
+        {"wait", 0, 0, 'w'},
+        {0, 0, 0, 0}
+    };
+
+    while ((opt = getopt_long(argc, argv, "wF", long_options, NULL)) != -1) {
         switch (opt) {
         case 0: case 2:
             return opt;
diff -r fcd73195cf24 -r fa38bd96d904 tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c	Fri Oct 26 16:47:57 2012 +0100
+++ b/tools/libxl/xl_cmdtable.c	Fri Oct 26 16:48:10 2012 +0100
@@ -64,7 +64,7 @@ struct cmd_spec cmd_table[] = {
       "-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"
+      "-w, --wait              Wait for guest to shutdown.\n"
     },
     { "reboot",
       &main_reboot, 0, 1,

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XQ-0000iB-Bb; Fri, 02 Nov 2012 05:11:24 +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 1TU9XO-0000eE-MQ
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:22 +0000
Received: from [85.158.139.211:25610] by server-12.bemta-5.messagelabs.com id
	AC/ED-02886-9F553905; Fri, 02 Nov 2012 05:11:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-206.messagelabs.com!1351833080!18545961!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18196 invoked from network); 2 Nov 2012 05:11:20 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2012 05:11: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 1TU9XL-0000fm-PT
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XL-0006Q7-O4
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:19 +0000
Message-Id: <E1TU9XL-0006Q7-O4@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:19 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xl/libxl: make shutdown accept
	the long option --wait for -w
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Sander Eikelenboom <linux@eikelenboom.it>
# Date 1351266490 -3600
# Node ID fa38bd96d904b54df895db3cc589926b787cdb01
# Parent  fcd73195cf24175738135c144defcdb01fe74f37
xl/libxl: make shutdown accept the long option --wait for -w

Make xl/libxl accept the long option --wait for -w to be compatible with xm.
The long options are used in the default init and sysconfig scripts.

Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 26045:ba7198bfc679
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r fcd73195cf24 -r fa38bd96d904 docs/man/xl.pod.1
--- a/docs/man/xl.pod.1	Fri Oct 26 16:47:57 2012 +0100
+++ b/docs/man/xl.pod.1	Fri Oct 26 16:48:10 2012 +0100
@@ -550,7 +550,7 @@ B<OPTIONS>
 
 =over 4
 
-=item B<-w>
+=item B<-w>, B<--wait>
 
 Wait for the domain to complete shutdown before returning.
 
diff -r fcd73195cf24 -r fa38bd96d904 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Fri Oct 26 16:47:57 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Fri Oct 26 16:48:10 2012 +0100
@@ -3683,8 +3683,12 @@ int main_shutdown(int argc, char **argv)
     int opt;
     int wait = 0;
     int fallback_trigger = 0;
-
-    while ((opt = def_getopt(argc, argv, "wF", "shutdown", 1)) != -1) {
+    static struct option long_options[] = {
+        {"wait", 0, 0, 'w'},
+        {0, 0, 0, 0}
+    };
+
+    while ((opt = getopt_long(argc, argv, "wF", long_options, NULL)) != -1) {
         switch (opt) {
         case 0: case 2:
             return opt;
diff -r fcd73195cf24 -r fa38bd96d904 tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c	Fri Oct 26 16:47:57 2012 +0100
+++ b/tools/libxl/xl_cmdtable.c	Fri Oct 26 16:48:10 2012 +0100
@@ -64,7 +64,7 @@ struct cmd_spec cmd_table[] = {
       "-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"
+      "-w, --wait              Wait for guest to shutdown.\n"
     },
     { "reboot",
       &main_reboot, 0, 1,

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XQ-0000iv-Ro; Fri, 02 Nov 2012 05:11:24 +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 1TU9XQ-0000eE-5f
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:24 +0000
Received: from [85.158.139.211:25699] by server-12.bemta-5.messagelabs.com id
	E6/FD-02886-BF553905; Fri, 02 Nov 2012 05:11:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-206.messagelabs.com!1351833078!18580667!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17745 invoked from network); 2 Nov 2012 05:11:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2012 05:11: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 1TU9XK-0000fg-O8
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XK-0006Pd-Ji
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:18 +0000
Message-Id: <E1TU9XK-0006Pd-Ji@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:18 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] docs,
	build: Do not ignore install-docs errors
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351266453 -3600
# Node ID 1787c24c9808c8491cb0d5365a3b347f326952c2
# Parent  76d3d1d4aca09cc2f6d839f9611857627540e5f0
docs, build: Do not ignore install-docs errors

In the toplevel Makefile "install-docs" (depended on by "install" and
hence "dist"), but not "build", ignores errors.

This was inherited from before 24563:4271634e4c86, prior to which the
||true seems intended to handle failures of check_pkgs.  Nowadays we
handle docs tools individually in the docs makefiles so there is no
need for this ||true here.

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

xen-unstable changeset: 26042:3696dd6a7836
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 76d3d1d4aca0 -r 1787c24c9808 Makefile
--- a/Makefile	Fri Oct 26 16:47:21 2012 +0100
+++ b/Makefile	Fri Oct 26 16:47:33 2012 +0100
@@ -103,7 +103,7 @@ tools/firmware/seabios-dir-force-update:
 
 .PHONY: install-docs
 install-docs:
-	$(MAKE) -C docs install || true
+	$(MAKE) -C docs install
 
 .PHONY: dev-docs
 dev-docs:

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XQ-0000iv-Ro; Fri, 02 Nov 2012 05:11:24 +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 1TU9XQ-0000eE-5f
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:24 +0000
Received: from [85.158.139.211:25699] by server-12.bemta-5.messagelabs.com id
	E6/FD-02886-BF553905; Fri, 02 Nov 2012 05:11:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-206.messagelabs.com!1351833078!18580667!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17745 invoked from network); 2 Nov 2012 05:11:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2012 05:11: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 1TU9XK-0000fg-O8
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XK-0006Pd-Ji
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:18 +0000
Message-Id: <E1TU9XK-0006Pd-Ji@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:18 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] docs,
	build: Do not ignore install-docs errors
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351266453 -3600
# Node ID 1787c24c9808c8491cb0d5365a3b347f326952c2
# Parent  76d3d1d4aca09cc2f6d839f9611857627540e5f0
docs, build: Do not ignore install-docs errors

In the toplevel Makefile "install-docs" (depended on by "install" and
hence "dist"), but not "build", ignores errors.

This was inherited from before 24563:4271634e4c86, prior to which the
||true seems intended to handle failures of check_pkgs.  Nowadays we
handle docs tools individually in the docs makefiles so there is no
need for this ||true here.

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

xen-unstable changeset: 26042:3696dd6a7836
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 76d3d1d4aca0 -r 1787c24c9808 Makefile
--- a/Makefile	Fri Oct 26 16:47:21 2012 +0100
+++ b/Makefile	Fri Oct 26 16:47:33 2012 +0100
@@ -103,7 +103,7 @@ tools/firmware/seabios-dir-force-update:
 
 .PHONY: install-docs
 install-docs:
-	$(MAKE) -C docs install || true
+	$(MAKE) -C docs install
 
 .PHONY: dev-docs
 dev-docs:

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XQ-0000ii-Ox; Fri, 02 Nov 2012 05:11: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 1TU9XQ-0000gx-2D
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:24 +0000
Received: from [85.158.143.99:16979] by server-3.bemta-4.messagelabs.com id
	A2/36-06841-BF553905; Fri, 02 Nov 2012 05:11:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-216.messagelabs.com!1351833081!27416634!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26058 invoked from network); 2 Nov 2012 05:11:22 -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;
	2 Nov 2012 05:11: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 1TU9XN-0000fv-FD
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XN-0006Qr-DZ
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:21 +0000
Message-Id: <E1TU9XN-0006Qr-DZ@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:20 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxl: propagate user supplied
	values into event for_user field.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351266585 -3600
# Node ID 25eda7e7b4e602d2fff2792460c6be748847c683
# Parent  82b61b99d15d92b6eeb075e30202a0afcd2f817b
libxl: propagate user supplied values into event for_user field.

This was ommited in the majority of cases. Add as a parameter to
libxl__event_new and the NEW_EVENT wrapper to help prevent it being
forgotten in the future.

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

xen-unstable changeset: 26089:fb5cf014b387
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 82b61b99d15d -r 25eda7e7b4e6 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Oct 26 16:49:33 2012 +0100
+++ b/tools/libxl/libxl.c	Fri Oct 26 16:49:45 2012 +0100
@@ -972,7 +972,7 @@ static void domain_death_occurred(libxl_
     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);
+    libxl_event *ev = NEW_EVENT(egc, DOMAIN_DEATH, evg->domid, evg->user);
 
     libxl__event_occurred(egc, ev);
 
@@ -1058,8 +1058,9 @@ static void domain_death_xswatch_callbac
 
             if (!evg->shutdown_reported &&
                 (got->flags & XEN_DOMINF_shutdown)) {
-                libxl_event *ev = NEW_EVENT(egc, DOMAIN_SHUTDOWN, got->domain);
-                
+                libxl_event *ev = NEW_EVENT(egc, DOMAIN_SHUTDOWN,
+                                            got->domain, evg->user);
+
                 LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, " shutdown reporting");
 
                 ev->u.domain_shutdown.shutdown_reason =
@@ -1158,7 +1159,7 @@ static void disk_eject_xswatch_callback(
         return;
     }
 
-    libxl_event *ev = NEW_EVENT(egc, DISK_EJECT, evg->domid);
+    libxl_event *ev = NEW_EVENT(egc, DISK_EJECT, evg->domid, evg->user);
     libxl_device_disk *disk = &ev->u.disk_eject.disk;
     
     backend = libxl__xs_read(gc, XBT_NULL,
diff -r 82b61b99d15d -r 25eda7e7b4e6 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Fri Oct 26 16:49:33 2012 +0100
+++ b/tools/libxl/libxl_create.c	Fri Oct 26 16:49:45 2012 +0100
@@ -705,7 +705,8 @@ static void domcreate_console_available(
                                         libxl__domain_create_state *dcs) {
     libxl__ao_progress_report(egc, dcs->ao, &dcs->aop_console_how,
                               NEW_EVENT(egc, DOMAIN_CREATE_CONSOLE_AVAILABLE,
-                                        dcs->guest_domid));
+                                        dcs->guest_domid,
+                                        dcs->aop_console_how.for_event));
 }
 
 static void domcreate_bootloader_done(libxl__egc *egc,
diff -r 82b61b99d15d -r 25eda7e7b4e6 tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c	Fri Oct 26 16:49:33 2012 +0100
+++ b/tools/libxl/libxl_event.c	Fri Oct 26 16:49:45 2012 +0100
@@ -1157,7 +1157,8 @@ void libxl_event_free(libxl_ctx *ctx, li
 }
 
 libxl_event *libxl__event_new(libxl__egc *egc,
-                              libxl_event_type type, uint32_t domid)
+                              libxl_event_type type, uint32_t domid,
+                              libxl_ev_user for_user)
 {
     EGC_GC;
     libxl_event *ev;
@@ -1168,6 +1169,7 @@ libxl_event *libxl__event_new(libxl__egc
     libxl_event_init_type(ev, type);
 
     ev->domid = domid;
+    ev->for_user = for_user;
 
     return ev;
 }
@@ -1528,9 +1530,8 @@ void libxl__ao_complete_check_progress_r
         LIBXL_TAILQ_INSERT_TAIL(&egc->aos_for_callback, ao, entry_for_callback);
     } else {
         libxl_event *ev;
-        ev = NEW_EVENT(egc, OPERATION_COMPLETE, ao->domid);
+        ev = NEW_EVENT(egc, OPERATION_COMPLETE, ao->domid, ao->how.u.for_event);
         if (ev) {
-            ev->for_user = ao->how.u.for_event;
             ev->u.operation_complete.rc = ao->rc;
             libxl__event_occurred(egc, ev);
         }
@@ -1662,7 +1663,6 @@ void libxl__ao_progress_report(libxl__eg
         const libxl_asyncprogress_how *how, libxl_event *ev)
 {
     AO_GC;
-    ev->for_user = how->for_event;
     if (how->callback == dummy_asyncprogress_callback_ignore) {
         LOG(DEBUG,"ao %p: progress report: ignored",ao);
         libxl_event_free(CTX,ev);
diff -r 82b61b99d15d -r 25eda7e7b4e6 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Oct 26 16:49:33 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Fri Oct 26 16:49:45 2012 +0100
@@ -778,13 +778,14 @@ _hidden void libxl__event_occurred(libxl
    * event should be suitable for passing to libxl_event_free. */
 
 _hidden libxl_event *libxl__event_new(libxl__egc*, libxl_event_type,
-                                      uint32_t domid);
+                                      uint32_t domid,
+                                      libxl_ev_user for_user);
   /* Convenience function.
    * Allocates a new libxl_event, fills in domid and type.
    * Cannot fail. */
 
-#define NEW_EVENT(egc, type, domid)                              \
-    libxl__event_new((egc), LIBXL_EVENT_TYPE_##type, (domid))
+#define NEW_EVENT(egc, type, domid, user)                        \
+    libxl__event_new((egc), LIBXL_EVENT_TYPE_##type, (domid), (user))
     /* Convenience macro. */
 
 /*

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05: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.xen.org>)
	id 1TU9XQ-0000ii-Ox; Fri, 02 Nov 2012 05:11: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 1TU9XQ-0000gx-2D
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:24 +0000
Received: from [85.158.143.99:16979] by server-3.bemta-4.messagelabs.com id
	A2/36-06841-BF553905; Fri, 02 Nov 2012 05:11:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-216.messagelabs.com!1351833081!27416634!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26058 invoked from network); 2 Nov 2012 05:11:22 -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;
	2 Nov 2012 05:11: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 1TU9XN-0000fv-FD
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XN-0006Qr-DZ
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:21 +0000
Message-Id: <E1TU9XN-0006Qr-DZ@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:20 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxl: propagate user supplied
	values into event for_user field.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351266585 -3600
# Node ID 25eda7e7b4e602d2fff2792460c6be748847c683
# Parent  82b61b99d15d92b6eeb075e30202a0afcd2f817b
libxl: propagate user supplied values into event for_user field.

This was ommited in the majority of cases. Add as a parameter to
libxl__event_new and the NEW_EVENT wrapper to help prevent it being
forgotten in the future.

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

xen-unstable changeset: 26089:fb5cf014b387
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 82b61b99d15d -r 25eda7e7b4e6 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Oct 26 16:49:33 2012 +0100
+++ b/tools/libxl/libxl.c	Fri Oct 26 16:49:45 2012 +0100
@@ -972,7 +972,7 @@ static void domain_death_occurred(libxl_
     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);
+    libxl_event *ev = NEW_EVENT(egc, DOMAIN_DEATH, evg->domid, evg->user);
 
     libxl__event_occurred(egc, ev);
 
@@ -1058,8 +1058,9 @@ static void domain_death_xswatch_callbac
 
             if (!evg->shutdown_reported &&
                 (got->flags & XEN_DOMINF_shutdown)) {
-                libxl_event *ev = NEW_EVENT(egc, DOMAIN_SHUTDOWN, got->domain);
-                
+                libxl_event *ev = NEW_EVENT(egc, DOMAIN_SHUTDOWN,
+                                            got->domain, evg->user);
+
                 LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, " shutdown reporting");
 
                 ev->u.domain_shutdown.shutdown_reason =
@@ -1158,7 +1159,7 @@ static void disk_eject_xswatch_callback(
         return;
     }
 
-    libxl_event *ev = NEW_EVENT(egc, DISK_EJECT, evg->domid);
+    libxl_event *ev = NEW_EVENT(egc, DISK_EJECT, evg->domid, evg->user);
     libxl_device_disk *disk = &ev->u.disk_eject.disk;
     
     backend = libxl__xs_read(gc, XBT_NULL,
diff -r 82b61b99d15d -r 25eda7e7b4e6 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Fri Oct 26 16:49:33 2012 +0100
+++ b/tools/libxl/libxl_create.c	Fri Oct 26 16:49:45 2012 +0100
@@ -705,7 +705,8 @@ static void domcreate_console_available(
                                         libxl__domain_create_state *dcs) {
     libxl__ao_progress_report(egc, dcs->ao, &dcs->aop_console_how,
                               NEW_EVENT(egc, DOMAIN_CREATE_CONSOLE_AVAILABLE,
-                                        dcs->guest_domid));
+                                        dcs->guest_domid,
+                                        dcs->aop_console_how.for_event));
 }
 
 static void domcreate_bootloader_done(libxl__egc *egc,
diff -r 82b61b99d15d -r 25eda7e7b4e6 tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c	Fri Oct 26 16:49:33 2012 +0100
+++ b/tools/libxl/libxl_event.c	Fri Oct 26 16:49:45 2012 +0100
@@ -1157,7 +1157,8 @@ void libxl_event_free(libxl_ctx *ctx, li
 }
 
 libxl_event *libxl__event_new(libxl__egc *egc,
-                              libxl_event_type type, uint32_t domid)
+                              libxl_event_type type, uint32_t domid,
+                              libxl_ev_user for_user)
 {
     EGC_GC;
     libxl_event *ev;
@@ -1168,6 +1169,7 @@ libxl_event *libxl__event_new(libxl__egc
     libxl_event_init_type(ev, type);
 
     ev->domid = domid;
+    ev->for_user = for_user;
 
     return ev;
 }
@@ -1528,9 +1530,8 @@ void libxl__ao_complete_check_progress_r
         LIBXL_TAILQ_INSERT_TAIL(&egc->aos_for_callback, ao, entry_for_callback);
     } else {
         libxl_event *ev;
-        ev = NEW_EVENT(egc, OPERATION_COMPLETE, ao->domid);
+        ev = NEW_EVENT(egc, OPERATION_COMPLETE, ao->domid, ao->how.u.for_event);
         if (ev) {
-            ev->for_user = ao->how.u.for_event;
             ev->u.operation_complete.rc = ao->rc;
             libxl__event_occurred(egc, ev);
         }
@@ -1662,7 +1663,6 @@ void libxl__ao_progress_report(libxl__eg
         const libxl_asyncprogress_how *how, libxl_event *ev)
 {
     AO_GC;
-    ev->for_user = how->for_event;
     if (how->callback == dummy_asyncprogress_callback_ignore) {
         LOG(DEBUG,"ao %p: progress report: ignored",ao);
         libxl_event_free(CTX,ev);
diff -r 82b61b99d15d -r 25eda7e7b4e6 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Oct 26 16:49:33 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Fri Oct 26 16:49:45 2012 +0100
@@ -778,13 +778,14 @@ _hidden void libxl__event_occurred(libxl
    * event should be suitable for passing to libxl_event_free. */
 
 _hidden libxl_event *libxl__event_new(libxl__egc*, libxl_event_type,
-                                      uint32_t domid);
+                                      uint32_t domid,
+                                      libxl_ev_user for_user);
   /* Convenience function.
    * Allocates a new libxl_event, fills in domid and type.
    * Cannot fail. */
 
-#define NEW_EVENT(egc, type, domid)                              \
-    libxl__event_new((egc), LIBXL_EVENT_TYPE_##type, (domid))
+#define NEW_EVENT(egc, type, domid, user)                        \
+    libxl__event_new((egc), LIBXL_EVENT_TYPE_##type, (domid), (user))
     /* Convenience macro. */
 
 /*

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05:11: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 1TU9XT-0000n9-9I; Fri, 02 Nov 2012 05:11:27 +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 1TU9XR-0000kX-SB
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:26 +0000
Received: from [85.158.139.211:22752] by server-14.bemta-5.messagelabs.com id
	A6/30-21768-DF553905; Fri, 02 Nov 2012 05:11:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-206.messagelabs.com!1351833083!18567547!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13121 invoked from network); 2 Nov 2012 05:11:24 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2012 05:11: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 1TU9XP-0000g4-36
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XP-0006Ra-1o
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:23 +0000
Message-Id: <E1TU9XP-0006Ra-1o@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:22 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libfsimage: add ext4 support for
	CentOS 5.x
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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@citrix.com>
# Date 1351267342 -3600
# Node ID 9ebebb1904fd540ddfb974647b8d97208db37c23
# Parent  9a51ab6d2d07d0e8e09085782761681ae5fcaf5e
libfsimage: add ext4 support for CentOS 5.x

CentOS 5.x forked e2fs ext4 support into a different package called
e4fs, and so headers and library names changed from ext2fs to ext4fs.
Check if ext4fs/ext2fs.h and -lext4fs work, and use that instead of
ext2fs to build libfsimage. This patch assumes that if the ext4fs
library is present it should always be used instead of ext2fs.

This patch includes a rework of the ext2fs check, a new ext4fs check
and a minor modification in libfsimage to use the correct library.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 25895:98e1ba6a672a
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 9a51ab6d2d07 -r 9ebebb1904fd config/Tools.mk.in
--- a/config/Tools.mk.in	Fri Oct 26 17:01:36 2012 +0100
+++ b/config/Tools.mk.in	Fri Oct 26 17:02:22 2012 +0100
@@ -57,5 +57,5 @@ CONFIG_SYSTEM_LIBAIO:= @system_aio@
 ZLIB                := @zlib@
 CONFIG_LIBICONV     := @libiconv@
 CONFIG_GCRYPT       := @libgcrypt@
-CONFIG_EXT2FS       := @libext2fs@
+EXTFS_LIBS          := @EXTFS_LIBS@
 CURSES_LIBS         := @CURSES_LIBS@
diff -r 9a51ab6d2d07 -r 9ebebb1904fd tools/config.h.in
--- a/tools/config.h.in	Fri Oct 26 17:01:36 2012 +0100
+++ b/tools/config.h.in	Fri Oct 26 17:02:22 2012 +0100
@@ -42,6 +42,9 @@
 /* Define curses header to use */
 #undef INCLUDE_CURSES_H
 
+/* Define extfs header to use */
+#undef INCLUDE_EXTFS_H
+
 /* libutil header file name */
 #undef INCLUDE_LIBUTIL_H
 
diff -r 9a51ab6d2d07 -r 9ebebb1904fd tools/configure
--- a/tools/configure	Fri Oct 26 17:01:36 2012 +0100
+++ b/tools/configure	Fri Oct 26 17:02:22 2012 +0100
@@ -603,7 +603,7 @@ PTHREAD_LIBS
 PTHREAD_LDFLAGS
 PTHREAD_CFLAGS
 libgcrypt
-libext2fs
+EXTFS_LIBS
 system_aio
 zlib
 glib_LIBS
@@ -2389,6 +2389,8 @@ case $host_os in *\ *) host_os=`echo "$h
 
 
 
+
+
 # Enable/disable options
 
 # Check whether --enable-githttp was given.
@@ -6325,6 +6327,10 @@ else
   as_fn_error $? "Could not find libcrypto" "$LINENO" 5
 fi
 
+
+ac_fn_c_check_header_mongrel "$LINENO" "ext2fs/ext2fs.h" "ac_cv_header_ext2fs_ext2fs_h" "$ac_includes_default"
+if test "x$ac_cv_header_ext2fs_ext2fs_h" = x""yes; then :
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ext2fs_open2 in -lext2fs" >&5
 $as_echo_n "checking for ext2fs_open2 in -lext2fs... " >&6; }
 if test "${ac_cv_lib_ext2fs_ext2fs_open2+set}" = set; then :
@@ -6362,10 +6368,70 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ext2fs_ext2fs_open2" >&5
 $as_echo "$ac_cv_lib_ext2fs_ext2fs_open2" >&6; }
 if test "x$ac_cv_lib_ext2fs_ext2fs_open2" = x""yes; then :
-  libext2fs="y"
-else
-  libext2fs="n"
-fi
+
+
+$as_echo "#define INCLUDE_EXTFS_H <ext2fs/ext2fs.h>" >>confdefs.h
+
+    EXTFS_LIBS="-lext2fs"
+
+fi
+
+
+fi
+
+
+ac_fn_c_check_header_mongrel "$LINENO" "ext4fs/ext2fs.h" "ac_cv_header_ext4fs_ext2fs_h" "$ac_includes_default"
+if test "x$ac_cv_header_ext4fs_ext2fs_h" = x""yes; then :
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ext2fs_open2 in -lext4fs" >&5
+$as_echo_n "checking for ext2fs_open2 in -lext4fs... " >&6; }
+if test "${ac_cv_lib_ext4fs_ext2fs_open2+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lext4fs  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* 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 ext2fs_open2 ();
+int
+main ()
+{
+return ext2fs_open2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_ext4fs_ext2fs_open2=yes
+else
+  ac_cv_lib_ext4fs_ext2fs_open2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ext4fs_ext2fs_open2" >&5
+$as_echo "$ac_cv_lib_ext4fs_ext2fs_open2" >&6; }
+if test "x$ac_cv_lib_ext4fs_ext2fs_open2" = x""yes; then :
+
+
+$as_echo "#define INCLUDE_EXTFS_H <ext4fs/ext2fs.h>" >>confdefs.h
+
+    EXTFS_LIBS="-lext4fs"
+
+fi
+
+
+fi
+
+
 
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcry_md_hash_buffer in -lgcrypt" >&5
diff -r 9a51ab6d2d07 -r 9ebebb1904fd tools/configure.ac
--- a/tools/configure.ac	Fri Oct 26 17:01:36 2012 +0100
+++ b/tools/configure.ac	Fri Oct 26 17:02:22 2012 +0100
@@ -34,6 +34,7 @@ m4_include([m4/pkg.m4])
 m4_include([m4/curses.m4])
 m4_include([m4/pthread.m4])
 m4_include([m4/ptyfuncs.m4])
+m4_include([m4/extfs.m4])
 
 # Enable/disable options
 AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
@@ -131,8 +132,7 @@ AC_SUBST(zlib)
 AC_CHECK_LIB([aio], [io_setup], [system_aio="y"], [system_aio="n"])
 AC_SUBST(system_aio)
 AC_CHECK_LIB([crypto], [MD5], [], [AC_MSG_ERROR([Could not find libcrypto])])
-AC_CHECK_LIB([ext2fs], [ext2fs_open2], [libext2fs="y"], [libext2fs="n"])
-AC_SUBST(libext2fs)
+AX_CHECK_EXTFS
 AC_CHECK_LIB([gcrypt], [gcry_md_hash_buffer], [libgcrypt="y"], [libgcrypt="n"])
 AC_SUBST(libgcrypt)
 AX_CHECK_PTHREAD
diff -r 9a51ab6d2d07 -r 9ebebb1904fd tools/libfsimage/Makefile
--- a/tools/libfsimage/Makefile	Fri Oct 26 17:01:36 2012 +0100
+++ b/tools/libfsimage/Makefile	Fri Oct 26 17:02:22 2012 +0100
@@ -3,7 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 SUBDIRS-y = common ufs reiserfs iso9660 fat zfs
 SUBDIRS-$(CONFIG_X86) += xfs
-ifeq ($(CONFIG_EXT2FS), y)
+ifneq ($(EXTFS_LIBS), )
     SUBDIRS-y += ext2fs-lib
 else
     SUBDIRS-y += ext2fs
diff -r 9a51ab6d2d07 -r 9ebebb1904fd tools/libfsimage/ext2fs-lib/Makefile
--- a/tools/libfsimage/ext2fs-lib/Makefile	Fri Oct 26 17:01:36 2012 +0100
+++ b/tools/libfsimage/ext2fs-lib/Makefile	Fri Oct 26 17:02:22 2012 +0100
@@ -4,7 +4,10 @@ LIB_SRCS-y = ext2fs-lib.c
 
 FS = ext2fs-lib
 
-FS_LIBDEPS = -lext2fs
+FS_LIBDEPS = $(EXTFS_LIBS)
+
+# Include configure output (config.h) to headers search path
+CFLAGS += -I$(XEN_ROOT)/tools
 
 .PHONY: all
 all: fs-all
diff -r 9a51ab6d2d07 -r 9ebebb1904fd tools/libfsimage/ext2fs-lib/ext2fs-lib.c
--- a/tools/libfsimage/ext2fs-lib/ext2fs-lib.c	Fri Oct 26 17:01:36 2012 +0100
+++ b/tools/libfsimage/ext2fs-lib/ext2fs-lib.c	Fri Oct 26 17:02:22 2012 +0100
@@ -21,8 +21,11 @@
  * Use is subject to license terms.
  */
 
+/* Include output from configure */
+#include <config.h>
+
 #include <fsimage_plugin.h>
-#include <ext2fs/ext2fs.h>
+#include INCLUDE_EXTFS_H
 #include <errno.h>
 #include <inttypes.h>
 
diff -r 9a51ab6d2d07 -r 9ebebb1904fd tools/m4/extfs.m4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/m4/extfs.m4	Fri Oct 26 17:02:22 2012 +0100
@@ -0,0 +1,20 @@
+AC_DEFUN([AX_CHECK_EXTFS], [
+AC_CHECK_HEADER([ext2fs/ext2fs.h], [
+AC_CHECK_LIB([ext2fs], [ext2fs_open2], [
+    AC_DEFINE([INCLUDE_EXTFS_H], [<ext2fs/ext2fs.h>],
+              [Define extfs header to use])
+    EXTFS_LIBS="-lext2fs"
+])
+])
+dnl This is a temporary hack for CentOS 5.x, which split the ext4 support
+dnl of ext2fs in a different package. Once CentOS 5.x is no longer supported
+dnl we can remove this.
+AC_CHECK_HEADER([ext4fs/ext2fs.h], [
+AC_CHECK_LIB([ext4fs], [ext2fs_open2], [
+    AC_DEFINE([INCLUDE_EXTFS_H], [<ext4fs/ext2fs.h>],
+              [Define extfs header to use])
+    EXTFS_LIBS="-lext4fs"
+])
+])
+AC_SUBST(EXTFS_LIBS)
+])

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05:11: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 1TU9XT-0000n9-9I; Fri, 02 Nov 2012 05:11:27 +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 1TU9XR-0000kX-SB
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:26 +0000
Received: from [85.158.139.211:22752] by server-14.bemta-5.messagelabs.com id
	A6/30-21768-DF553905; Fri, 02 Nov 2012 05:11:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-206.messagelabs.com!1351833083!18567547!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13121 invoked from network); 2 Nov 2012 05:11:24 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2012 05:11: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 1TU9XP-0000g4-36
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XP-0006Ra-1o
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:23 +0000
Message-Id: <E1TU9XP-0006Ra-1o@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:22 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libfsimage: add ext4 support for
	CentOS 5.x
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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@citrix.com>
# Date 1351267342 -3600
# Node ID 9ebebb1904fd540ddfb974647b8d97208db37c23
# Parent  9a51ab6d2d07d0e8e09085782761681ae5fcaf5e
libfsimage: add ext4 support for CentOS 5.x

CentOS 5.x forked e2fs ext4 support into a different package called
e4fs, and so headers and library names changed from ext2fs to ext4fs.
Check if ext4fs/ext2fs.h and -lext4fs work, and use that instead of
ext2fs to build libfsimage. This patch assumes that if the ext4fs
library is present it should always be used instead of ext2fs.

This patch includes a rework of the ext2fs check, a new ext4fs check
and a minor modification in libfsimage to use the correct library.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 25895:98e1ba6a672a
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 9a51ab6d2d07 -r 9ebebb1904fd config/Tools.mk.in
--- a/config/Tools.mk.in	Fri Oct 26 17:01:36 2012 +0100
+++ b/config/Tools.mk.in	Fri Oct 26 17:02:22 2012 +0100
@@ -57,5 +57,5 @@ CONFIG_SYSTEM_LIBAIO:= @system_aio@
 ZLIB                := @zlib@
 CONFIG_LIBICONV     := @libiconv@
 CONFIG_GCRYPT       := @libgcrypt@
-CONFIG_EXT2FS       := @libext2fs@
+EXTFS_LIBS          := @EXTFS_LIBS@
 CURSES_LIBS         := @CURSES_LIBS@
diff -r 9a51ab6d2d07 -r 9ebebb1904fd tools/config.h.in
--- a/tools/config.h.in	Fri Oct 26 17:01:36 2012 +0100
+++ b/tools/config.h.in	Fri Oct 26 17:02:22 2012 +0100
@@ -42,6 +42,9 @@
 /* Define curses header to use */
 #undef INCLUDE_CURSES_H
 
+/* Define extfs header to use */
+#undef INCLUDE_EXTFS_H
+
 /* libutil header file name */
 #undef INCLUDE_LIBUTIL_H
 
diff -r 9a51ab6d2d07 -r 9ebebb1904fd tools/configure
--- a/tools/configure	Fri Oct 26 17:01:36 2012 +0100
+++ b/tools/configure	Fri Oct 26 17:02:22 2012 +0100
@@ -603,7 +603,7 @@ PTHREAD_LIBS
 PTHREAD_LDFLAGS
 PTHREAD_CFLAGS
 libgcrypt
-libext2fs
+EXTFS_LIBS
 system_aio
 zlib
 glib_LIBS
@@ -2389,6 +2389,8 @@ case $host_os in *\ *) host_os=`echo "$h
 
 
 
+
+
 # Enable/disable options
 
 # Check whether --enable-githttp was given.
@@ -6325,6 +6327,10 @@ else
   as_fn_error $? "Could not find libcrypto" "$LINENO" 5
 fi
 
+
+ac_fn_c_check_header_mongrel "$LINENO" "ext2fs/ext2fs.h" "ac_cv_header_ext2fs_ext2fs_h" "$ac_includes_default"
+if test "x$ac_cv_header_ext2fs_ext2fs_h" = x""yes; then :
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ext2fs_open2 in -lext2fs" >&5
 $as_echo_n "checking for ext2fs_open2 in -lext2fs... " >&6; }
 if test "${ac_cv_lib_ext2fs_ext2fs_open2+set}" = set; then :
@@ -6362,10 +6368,70 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ext2fs_ext2fs_open2" >&5
 $as_echo "$ac_cv_lib_ext2fs_ext2fs_open2" >&6; }
 if test "x$ac_cv_lib_ext2fs_ext2fs_open2" = x""yes; then :
-  libext2fs="y"
-else
-  libext2fs="n"
-fi
+
+
+$as_echo "#define INCLUDE_EXTFS_H <ext2fs/ext2fs.h>" >>confdefs.h
+
+    EXTFS_LIBS="-lext2fs"
+
+fi
+
+
+fi
+
+
+ac_fn_c_check_header_mongrel "$LINENO" "ext4fs/ext2fs.h" "ac_cv_header_ext4fs_ext2fs_h" "$ac_includes_default"
+if test "x$ac_cv_header_ext4fs_ext2fs_h" = x""yes; then :
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ext2fs_open2 in -lext4fs" >&5
+$as_echo_n "checking for ext2fs_open2 in -lext4fs... " >&6; }
+if test "${ac_cv_lib_ext4fs_ext2fs_open2+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lext4fs  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* 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 ext2fs_open2 ();
+int
+main ()
+{
+return ext2fs_open2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_ext4fs_ext2fs_open2=yes
+else
+  ac_cv_lib_ext4fs_ext2fs_open2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ext4fs_ext2fs_open2" >&5
+$as_echo "$ac_cv_lib_ext4fs_ext2fs_open2" >&6; }
+if test "x$ac_cv_lib_ext4fs_ext2fs_open2" = x""yes; then :
+
+
+$as_echo "#define INCLUDE_EXTFS_H <ext4fs/ext2fs.h>" >>confdefs.h
+
+    EXTFS_LIBS="-lext4fs"
+
+fi
+
+
+fi
+
+
 
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcry_md_hash_buffer in -lgcrypt" >&5
diff -r 9a51ab6d2d07 -r 9ebebb1904fd tools/configure.ac
--- a/tools/configure.ac	Fri Oct 26 17:01:36 2012 +0100
+++ b/tools/configure.ac	Fri Oct 26 17:02:22 2012 +0100
@@ -34,6 +34,7 @@ m4_include([m4/pkg.m4])
 m4_include([m4/curses.m4])
 m4_include([m4/pthread.m4])
 m4_include([m4/ptyfuncs.m4])
+m4_include([m4/extfs.m4])
 
 # Enable/disable options
 AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
@@ -131,8 +132,7 @@ AC_SUBST(zlib)
 AC_CHECK_LIB([aio], [io_setup], [system_aio="y"], [system_aio="n"])
 AC_SUBST(system_aio)
 AC_CHECK_LIB([crypto], [MD5], [], [AC_MSG_ERROR([Could not find libcrypto])])
-AC_CHECK_LIB([ext2fs], [ext2fs_open2], [libext2fs="y"], [libext2fs="n"])
-AC_SUBST(libext2fs)
+AX_CHECK_EXTFS
 AC_CHECK_LIB([gcrypt], [gcry_md_hash_buffer], [libgcrypt="y"], [libgcrypt="n"])
 AC_SUBST(libgcrypt)
 AX_CHECK_PTHREAD
diff -r 9a51ab6d2d07 -r 9ebebb1904fd tools/libfsimage/Makefile
--- a/tools/libfsimage/Makefile	Fri Oct 26 17:01:36 2012 +0100
+++ b/tools/libfsimage/Makefile	Fri Oct 26 17:02:22 2012 +0100
@@ -3,7 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 SUBDIRS-y = common ufs reiserfs iso9660 fat zfs
 SUBDIRS-$(CONFIG_X86) += xfs
-ifeq ($(CONFIG_EXT2FS), y)
+ifneq ($(EXTFS_LIBS), )
     SUBDIRS-y += ext2fs-lib
 else
     SUBDIRS-y += ext2fs
diff -r 9a51ab6d2d07 -r 9ebebb1904fd tools/libfsimage/ext2fs-lib/Makefile
--- a/tools/libfsimage/ext2fs-lib/Makefile	Fri Oct 26 17:01:36 2012 +0100
+++ b/tools/libfsimage/ext2fs-lib/Makefile	Fri Oct 26 17:02:22 2012 +0100
@@ -4,7 +4,10 @@ LIB_SRCS-y = ext2fs-lib.c
 
 FS = ext2fs-lib
 
-FS_LIBDEPS = -lext2fs
+FS_LIBDEPS = $(EXTFS_LIBS)
+
+# Include configure output (config.h) to headers search path
+CFLAGS += -I$(XEN_ROOT)/tools
 
 .PHONY: all
 all: fs-all
diff -r 9a51ab6d2d07 -r 9ebebb1904fd tools/libfsimage/ext2fs-lib/ext2fs-lib.c
--- a/tools/libfsimage/ext2fs-lib/ext2fs-lib.c	Fri Oct 26 17:01:36 2012 +0100
+++ b/tools/libfsimage/ext2fs-lib/ext2fs-lib.c	Fri Oct 26 17:02:22 2012 +0100
@@ -21,8 +21,11 @@
  * Use is subject to license terms.
  */
 
+/* Include output from configure */
+#include <config.h>
+
 #include <fsimage_plugin.h>
-#include <ext2fs/ext2fs.h>
+#include INCLUDE_EXTFS_H
 #include <errno.h>
 #include <inttypes.h>
 
diff -r 9a51ab6d2d07 -r 9ebebb1904fd tools/m4/extfs.m4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/m4/extfs.m4	Fri Oct 26 17:02:22 2012 +0100
@@ -0,0 +1,20 @@
+AC_DEFUN([AX_CHECK_EXTFS], [
+AC_CHECK_HEADER([ext2fs/ext2fs.h], [
+AC_CHECK_LIB([ext2fs], [ext2fs_open2], [
+    AC_DEFINE([INCLUDE_EXTFS_H], [<ext2fs/ext2fs.h>],
+              [Define extfs header to use])
+    EXTFS_LIBS="-lext2fs"
+])
+])
+dnl This is a temporary hack for CentOS 5.x, which split the ext4 support
+dnl of ext2fs in a different package. Once CentOS 5.x is no longer supported
+dnl we can remove this.
+AC_CHECK_HEADER([ext4fs/ext2fs.h], [
+AC_CHECK_LIB([ext4fs], [ext2fs_open2], [
+    AC_DEFINE([INCLUDE_EXTFS_H], [<ext4fs/ext2fs.h>],
+              [Define extfs header to use])
+    EXTFS_LIBS="-lext4fs"
+])
+])
+AC_SUBST(EXTFS_LIBS)
+])

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05:11: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 1TU9XT-0000mq-5x; Fri, 02 Nov 2012 05:11:27 +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 1TU9XR-0000kF-TX
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:26 +0000
Received: from [85.158.138.51:4524] by server-7.bemta-3.messagelabs.com id
	3A/D7-01713-DF553905; Fri, 02 Nov 2012 05:11:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1351833082!28390747!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29833 invoked from network); 2 Nov 2012 05:11:23 -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;
	2 Nov 2012 05:11: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 1TU9XO-0000g1-HB
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:22 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XO-0006RL-Fs
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:22 +0000
Message-Id: <E1TU9XO-0006RL-Fs@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:21 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxl: Tolerate xl config files
	missing trailing newline
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351267296 -3600
# Node ID 9a51ab6d2d07d0e8e09085782761681ae5fcaf5e
# Parent  25eda7e7b4e602d2fff2792460c6be748847c683
libxl: Tolerate xl config files missing trailing newline

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

xen-unstable changeset: 25902:28bb7ba5faf6
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 25eda7e7b4e6 -r 9a51ab6d2d07 tools/libxl/libxlu_cfg_y.c
--- a/tools/libxl/libxlu_cfg_y.c	Fri Oct 26 16:49:45 2012 +0100
+++ b/tools/libxl/libxlu_cfg_y.c	Fri Oct 26 17:01:36 2012 +0100
@@ -373,18 +373,18 @@ union yyalloc
 #endif
 
 /* YYFINAL -- State number of the termination state.  */
-#define YYFINAL  2
+#define YYFINAL  3
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   23
+#define YYLAST   24
 
 /* YYNTOKENS -- Number of terminals.  */
 #define YYNTOKENS  12
 /* YYNNTS -- Number of nonterminals.  */
-#define YYNNTS  9
+#define YYNNTS  11
 /* YYNRULES -- Number of rules.  */
-#define YYNRULES  19
+#define YYNRULES  22
 /* YYNRULES -- Number of states.  */
-#define YYNSTATES  28
+#define YYNSTATES  30
 
 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 #define YYUNDEFTOK  2
@@ -430,26 +430,28 @@ static const yytype_uint8 yytranslate[] 
    YYRHS.  */
 static const yytype_uint8 yyprhs[] =
 {
-       0,     0,     3,     4,     7,    12,    14,    17,    19,    21,
-      23,    28,    30,    32,    33,    35,    39,    42,    48,    49
+       0,     0,     3,     5,     8,     9,    12,    15,    17,    20,
+      24,    26,    28,    30,    35,    37,    39,    40,    42,    46,
+      49,    55,    56
 };
 
 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
 static const yytype_int8 yyrhs[] =
 {
-      13,     0,    -1,    -1,    13,    14,    -1,     3,     7,    16,
-      15,    -1,    15,    -1,     1,     6,    -1,     6,    -1,     8,
-      -1,    17,    -1,     9,    20,    18,    10,    -1,     4,    -1,
-       5,    -1,    -1,    19,    -1,    19,    11,    20,    -1,    17,
-      20,    -1,    19,    11,    20,    17,    20,    -1,    -1,    20,
-       6,    -1
+      13,     0,    -1,    14,    -1,    14,    16,    -1,    -1,    14,
+      15,    -1,    16,    17,    -1,    17,    -1,     1,     6,    -1,
+       3,     7,    18,    -1,     6,    -1,     8,    -1,    19,    -1,
+       9,    22,    20,    10,    -1,     4,    -1,     5,    -1,    -1,
+      21,    -1,    21,    11,    22,    -1,    19,    22,    -1,    21,
+      11,    22,    19,    22,    -1,    -1,    22,     6,    -1
 };
 
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint8 yyrline[] =
 {
-       0,    47,    47,    48,    50,    52,    53,    55,    56,    58,
-      59,    61,    62,    64,    65,    66,    68,    69,    71,    73
+       0,    47,    47,    48,    50,    51,    53,    54,    55,    57,
+      59,    60,    62,    63,    65,    66,    68,    69,    70,    72,
+      73,    75,    77
 };
 #endif
 
@@ -459,8 +461,8 @@ static const yytype_uint8 yyrline[] =
 static const char *const yytname[] =
 {
   "$end", "error", "$undefined", "IDENT", "STRING", "NUMBER", "NEWLINE",
-  "'='", "';'", "'['", "']'", "','", "$accept", "file", "assignment",
-  "endstmt", "value", "atom", "valuelist", "values", "nlok", 0
+  "'='", "';'", "'['", "']'", "','", "$accept", "file", "stmts", "stmt",
+  "assignment", "endstmt", "value", "atom", "valuelist", "values", "nlok", 0
 };
 #endif
 
@@ -477,15 +479,17 @@ static const yytype_uint16 yytoknum[] =
 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 static const yytype_uint8 yyr1[] =
 {
-       0,    12,    13,    13,    14,    14,    14,    15,    15,    16,
-      16,    17,    17,    18,    18,    18,    19,    19,    20,    20
+       0,    12,    13,    13,    14,    14,    15,    15,    15,    16,
+      17,    17,    18,    18,    19,    19,    20,    20,    20,    21,
+      21,    22,    22
 };
 
 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
 static const yytype_uint8 yyr2[] =
 {
-       0,     2,     0,     2,     4,     1,     2,     1,     1,     1,
-       4,     1,     1,     0,     1,     3,     2,     5,     0,     2
+       0,     2,     1,     2,     0,     2,     2,     1,     2,     3,
+       1,     1,     1,     4,     1,     1,     0,     1,     3,     2,
+       5,     0,     2
 };
 
 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -493,59 +497,61 @@ static const yytype_uint8 yyr2[] =
    means the default is an error.  */
 static const yytype_uint8 yydefact[] =
 {
-       2,     0,     1,     0,     0,     7,     8,     3,     5,     6,
-       0,    11,    12,    18,     0,     9,    13,     4,    19,    18,
-       0,    14,    16,    10,    18,    15,    18,    17
+       4,     0,     0,     1,     0,     0,    10,    11,     5,     3,
+       7,     8,     0,     6,    14,    15,    21,     9,    12,    16,
+      22,    21,     0,    17,    19,    13,    21,    18,    21,    20
 };
 
 /* YYDEFGOTO[NTERM-NUM].  */
 static const yytype_int8 yydefgoto[] =
 {
-      -1,     1,     7,     8,    14,    15,    20,    21,    16
+      -1,     1,     2,     8,     9,    10,    17,    18,    22,    23,
+      19
 };
 
 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    STATE-NUM.  */
-#define YYPACT_NINF -17
+#define YYPACT_NINF -18
 static const yytype_int8 yypact[] =
 {
-     -17,     2,   -17,    -5,    -3,   -17,   -17,   -17,   -17,   -17,
-      10,   -17,   -17,   -17,    14,   -17,    12,   -17,   -17,   -17,
-      11,    -4,     6,   -17,   -17,    12,   -17,     6
+     -18,     4,     0,   -18,    -1,     6,   -18,   -18,   -18,     3,
+     -18,   -18,    11,   -18,   -18,   -18,   -18,   -18,   -18,    13,
+     -18,   -18,    12,    10,    17,   -18,   -18,    13,   -18,    17
 };
 
 /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int8 yypgoto[] =
 {
-     -17,   -17,   -17,     9,   -17,   -16,   -17,   -17,   -13
+     -18,   -18,   -18,   -18,   -18,    15,   -18,   -17,   -18,   -18,
+     -14
 };
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
    positive, shift that token.  If negative, reduce the rule which
    number is the opposite.  If zero, do what YYDEFACT says.
    If YYTABLE_NINF, syntax error.  */
-#define YYTABLE_NINF -1
-static const yytype_uint8 yytable[] =
+#define YYTABLE_NINF -3
+static const yytype_int8 yytable[] =
 {
-      19,     9,     2,     3,    10,     4,    22,    24,     5,    26,
-       6,    25,    18,    27,    11,    12,    11,    12,    18,    13,
-       5,    23,     6,    17
+      -2,     4,    21,     5,     3,    11,     6,    24,     7,     6,
+      28,     7,    27,    12,    29,    14,    15,    14,    15,    20,
+      16,    26,    25,    20,    13
 };
 
 static const yytype_uint8 yycheck[] =
 {
-      16,     6,     0,     1,     7,     3,    19,    11,     6,    25,
-       8,    24,     6,    26,     4,     5,     4,     5,     6,     9,
-       6,    10,     8,    14
+       0,     1,    19,     3,     0,     6,     6,    21,     8,     6,
+      27,     8,    26,     7,    28,     4,     5,     4,     5,     6,
+       9,    11,    10,     6,     9
 };
 
 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
    symbol of state STATE-NUM.  */
 static const yytype_uint8 yystos[] =
 {
-       0,    13,     0,     1,     3,     6,     8,    14,    15,     6,
-       7,     4,     5,     9,    16,    17,    20,    15,     6,    17,
-      18,    19,    20,    10,    11,    20,    17,    20
+       0,    13,    14,     0,     1,     3,     6,     8,    15,    16,
+      17,     6,     7,    17,     4,     5,     9,    18,    19,    22,
+       6,    19,    20,    21,    22,    10,    11,    22,    19,    22
 };
 
 #define yyerrok		(yyerrstatus = 0)
@@ -1077,7 +1083,7 @@ yydestruct (yymsg, yytype, yyvaluep, yyl
 	{ free((yyvaluep->string)); };
 
 /* Line 1000 of yacc.c  */
-#line 1081 "libxlu_cfg_y.c"
+#line 1087 "libxlu_cfg_y.c"
 	break;
       case 4: /* "STRING" */
 
@@ -1086,7 +1092,7 @@ yydestruct (yymsg, yytype, yyvaluep, yyl
 	{ free((yyvaluep->string)); };
 
 /* Line 1000 of yacc.c  */
-#line 1090 "libxlu_cfg_y.c"
+#line 1096 "libxlu_cfg_y.c"
 	break;
       case 5: /* "NUMBER" */
 
@@ -1095,43 +1101,43 @@ yydestruct (yymsg, yytype, yyvaluep, yyl
 	{ free((yyvaluep->string)); };
 
 /* Line 1000 of yacc.c  */
-#line 1099 "libxlu_cfg_y.c"
+#line 1105 "libxlu_cfg_y.c"
 	break;
-      case 16: /* "value" */
+      case 18: /* "value" */
 
 /* Line 1000 of yacc.c  */
 #line 43 "libxlu_cfg_y.y"
 	{ xlu__cfg_set_free((yyvaluep->setting)); };
 
 /* Line 1000 of yacc.c  */
-#line 1108 "libxlu_cfg_y.c"
+#line 1114 "libxlu_cfg_y.c"
 	break;
-      case 17: /* "atom" */
+      case 19: /* "atom" */
 
 /* Line 1000 of yacc.c  */
 #line 40 "libxlu_cfg_y.y"
 	{ free((yyvaluep->string)); };
 
 /* Line 1000 of yacc.c  */
-#line 1117 "libxlu_cfg_y.c"
+#line 1123 "libxlu_cfg_y.c"
 	break;
-      case 18: /* "valuelist" */
+      case 20: /* "valuelist" */
 
 /* Line 1000 of yacc.c  */
 #line 43 "libxlu_cfg_y.y"
 	{ xlu__cfg_set_free((yyvaluep->setting)); };
 
 /* Line 1000 of yacc.c  */
-#line 1126 "libxlu_cfg_y.c"
+#line 1132 "libxlu_cfg_y.c"
 	break;
-      case 19: /* "values" */
+      case 21: /* "values" */
 
 /* Line 1000 of yacc.c  */
 #line 43 "libxlu_cfg_y.y"
 	{ xlu__cfg_set_free((yyvaluep->setting)); };
 
 /* Line 1000 of yacc.c  */
-#line 1135 "libxlu_cfg_y.c"
+#line 1141 "libxlu_cfg_y.c"
 	break;
 
       default:
@@ -1459,80 +1465,80 @@ yyreduce:
   YY_REDUCE_PRINT (yyn);
   switch (yyn)
     {
-        case 4:
+        case 9:
 
 /* Line 1455 of yacc.c  */
-#line 51 "libxlu_cfg_y.y"
-    { xlu__cfg_set_store(ctx,(yyvsp[(1) - (4)].string),(yyvsp[(3) - (4)].setting),(yylsp[(3) - (4)]).first_line); ;}
-    break;
-
-  case 9:
-
-/* Line 1455 of yacc.c  */
-#line 58 "libxlu_cfg_y.y"
-    { (yyval.setting)= xlu__cfg_set_mk(ctx,1,(yyvsp[(1) - (1)].string)); ;}
-    break;
-
-  case 10:
-
-/* Line 1455 of yacc.c  */
-#line 59 "libxlu_cfg_y.y"
-    { (yyval.setting)= (yyvsp[(3) - (4)].setting); ;}
-    break;
-
-  case 11:
-
-/* Line 1455 of yacc.c  */
-#line 61 "libxlu_cfg_y.y"
-    { (yyval.string)= (yyvsp[(1) - (1)].string); ;}
+#line 57 "libxlu_cfg_y.y"
+    { xlu__cfg_set_store(ctx,(yyvsp[(1) - (3)].string),(yyvsp[(3) - (3)].setting),(yylsp[(3) - (3)]).first_line); ;}
     break;
 
   case 12:
 
 /* Line 1455 of yacc.c  */
 #line 62 "libxlu_cfg_y.y"
-    { (yyval.string)= (yyvsp[(1) - (1)].string); ;}
+    { (yyval.setting)= xlu__cfg_set_mk(ctx,1,(yyvsp[(1) - (1)].string)); ;}
     break;
 
   case 13:
 
 /* Line 1455 of yacc.c  */
-#line 64 "libxlu_cfg_y.y"
-    { (yyval.setting)= xlu__cfg_set_mk(ctx,0,0); ;}
+#line 63 "libxlu_cfg_y.y"
+    { (yyval.setting)= (yyvsp[(3) - (4)].setting); ;}
     break;
 
   case 14:
 
 /* Line 1455 of yacc.c  */
 #line 65 "libxlu_cfg_y.y"
-    { (yyval.setting)= (yyvsp[(1) - (1)].setting); ;}
+    { (yyval.string)= (yyvsp[(1) - (1)].string); ;}
     break;
 
   case 15:
 
 /* Line 1455 of yacc.c  */
 #line 66 "libxlu_cfg_y.y"
-    { (yyval.setting)= (yyvsp[(1) - (3)].setting); ;}
+    { (yyval.string)= (yyvsp[(1) - (1)].string); ;}
     break;
 
   case 16:
 
 /* Line 1455 of yacc.c  */
 #line 68 "libxlu_cfg_y.y"
-    { (yyval.setting)= xlu__cfg_set_mk(ctx,2,(yyvsp[(1) - (2)].string)); ;}
+    { (yyval.setting)= xlu__cfg_set_mk(ctx,0,0); ;}
     break;
 
   case 17:
 
 /* Line 1455 of yacc.c  */
 #line 69 "libxlu_cfg_y.y"
+    { (yyval.setting)= (yyvsp[(1) - (1)].setting); ;}
+    break;
+
+  case 18:
+
+/* Line 1455 of yacc.c  */
+#line 70 "libxlu_cfg_y.y"
+    { (yyval.setting)= (yyvsp[(1) - (3)].setting); ;}
+    break;
+
+  case 19:
+
+/* Line 1455 of yacc.c  */
+#line 72 "libxlu_cfg_y.y"
+    { (yyval.setting)= xlu__cfg_set_mk(ctx,2,(yyvsp[(1) - (2)].string)); ;}
+    break;
+
+  case 20:
+
+/* Line 1455 of yacc.c  */
+#line 73 "libxlu_cfg_y.y"
     { xlu__cfg_set_add(ctx,(yyvsp[(1) - (5)].setting),(yyvsp[(4) - (5)].string)); (yyval.setting)= (yyvsp[(1) - (5)].setting); ;}
     break;
 
 
 
 /* Line 1455 of yacc.c  */
-#line 1536 "libxlu_cfg_y.c"
+#line 1542 "libxlu_cfg_y.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
diff -r 25eda7e7b4e6 -r 9a51ab6d2d07 tools/libxl/libxlu_cfg_y.y
--- a/tools/libxl/libxlu_cfg_y.y	Fri Oct 26 16:49:45 2012 +0100
+++ b/tools/libxl/libxlu_cfg_y.y	Fri Oct 26 17:01:36 2012 +0100
@@ -44,14 +44,18 @@
 
 %%
 
-file: /* empty */
- |     file assignment
+file:  stmts
+ |     stmts assignment
 
-assignment: IDENT '=' value endstmt
-                            { xlu__cfg_set_store(ctx,$1,$3,@3.first_line); }
+stmts:  /* empty */
+ |      stmts stmt
+
+stmt:   assignment endstmt
  |      endstmt
  |      error NEWLINE
 
+assignment: IDENT '=' value { xlu__cfg_set_store(ctx,$1,$3,@3.first_line); }
+
 endstmt: NEWLINE
  |      ';'
 

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05:11: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 1TU9XT-0000mq-5x; Fri, 02 Nov 2012 05:11:27 +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 1TU9XR-0000kF-TX
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:26 +0000
Received: from [85.158.138.51:4524] by server-7.bemta-3.messagelabs.com id
	3A/D7-01713-DF553905; Fri, 02 Nov 2012 05:11:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1351833082!28390747!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29833 invoked from network); 2 Nov 2012 05:11:23 -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;
	2 Nov 2012 05:11: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 1TU9XO-0000g1-HB
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:22 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XO-0006RL-Fs
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:22 +0000
Message-Id: <E1TU9XO-0006RL-Fs@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:21 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxl: Tolerate xl config files
	missing trailing newline
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351267296 -3600
# Node ID 9a51ab6d2d07d0e8e09085782761681ae5fcaf5e
# Parent  25eda7e7b4e602d2fff2792460c6be748847c683
libxl: Tolerate xl config files missing trailing newline

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

xen-unstable changeset: 25902:28bb7ba5faf6
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 25eda7e7b4e6 -r 9a51ab6d2d07 tools/libxl/libxlu_cfg_y.c
--- a/tools/libxl/libxlu_cfg_y.c	Fri Oct 26 16:49:45 2012 +0100
+++ b/tools/libxl/libxlu_cfg_y.c	Fri Oct 26 17:01:36 2012 +0100
@@ -373,18 +373,18 @@ union yyalloc
 #endif
 
 /* YYFINAL -- State number of the termination state.  */
-#define YYFINAL  2
+#define YYFINAL  3
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   23
+#define YYLAST   24
 
 /* YYNTOKENS -- Number of terminals.  */
 #define YYNTOKENS  12
 /* YYNNTS -- Number of nonterminals.  */
-#define YYNNTS  9
+#define YYNNTS  11
 /* YYNRULES -- Number of rules.  */
-#define YYNRULES  19
+#define YYNRULES  22
 /* YYNRULES -- Number of states.  */
-#define YYNSTATES  28
+#define YYNSTATES  30
 
 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 #define YYUNDEFTOK  2
@@ -430,26 +430,28 @@ static const yytype_uint8 yytranslate[] 
    YYRHS.  */
 static const yytype_uint8 yyprhs[] =
 {
-       0,     0,     3,     4,     7,    12,    14,    17,    19,    21,
-      23,    28,    30,    32,    33,    35,    39,    42,    48,    49
+       0,     0,     3,     5,     8,     9,    12,    15,    17,    20,
+      24,    26,    28,    30,    35,    37,    39,    40,    42,    46,
+      49,    55,    56
 };
 
 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
 static const yytype_int8 yyrhs[] =
 {
-      13,     0,    -1,    -1,    13,    14,    -1,     3,     7,    16,
-      15,    -1,    15,    -1,     1,     6,    -1,     6,    -1,     8,
-      -1,    17,    -1,     9,    20,    18,    10,    -1,     4,    -1,
-       5,    -1,    -1,    19,    -1,    19,    11,    20,    -1,    17,
-      20,    -1,    19,    11,    20,    17,    20,    -1,    -1,    20,
-       6,    -1
+      13,     0,    -1,    14,    -1,    14,    16,    -1,    -1,    14,
+      15,    -1,    16,    17,    -1,    17,    -1,     1,     6,    -1,
+       3,     7,    18,    -1,     6,    -1,     8,    -1,    19,    -1,
+       9,    22,    20,    10,    -1,     4,    -1,     5,    -1,    -1,
+      21,    -1,    21,    11,    22,    -1,    19,    22,    -1,    21,
+      11,    22,    19,    22,    -1,    -1,    22,     6,    -1
 };
 
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint8 yyrline[] =
 {
-       0,    47,    47,    48,    50,    52,    53,    55,    56,    58,
-      59,    61,    62,    64,    65,    66,    68,    69,    71,    73
+       0,    47,    47,    48,    50,    51,    53,    54,    55,    57,
+      59,    60,    62,    63,    65,    66,    68,    69,    70,    72,
+      73,    75,    77
 };
 #endif
 
@@ -459,8 +461,8 @@ static const yytype_uint8 yyrline[] =
 static const char *const yytname[] =
 {
   "$end", "error", "$undefined", "IDENT", "STRING", "NUMBER", "NEWLINE",
-  "'='", "';'", "'['", "']'", "','", "$accept", "file", "assignment",
-  "endstmt", "value", "atom", "valuelist", "values", "nlok", 0
+  "'='", "';'", "'['", "']'", "','", "$accept", "file", "stmts", "stmt",
+  "assignment", "endstmt", "value", "atom", "valuelist", "values", "nlok", 0
 };
 #endif
 
@@ -477,15 +479,17 @@ static const yytype_uint16 yytoknum[] =
 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 static const yytype_uint8 yyr1[] =
 {
-       0,    12,    13,    13,    14,    14,    14,    15,    15,    16,
-      16,    17,    17,    18,    18,    18,    19,    19,    20,    20
+       0,    12,    13,    13,    14,    14,    15,    15,    15,    16,
+      17,    17,    18,    18,    19,    19,    20,    20,    20,    21,
+      21,    22,    22
 };
 
 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
 static const yytype_uint8 yyr2[] =
 {
-       0,     2,     0,     2,     4,     1,     2,     1,     1,     1,
-       4,     1,     1,     0,     1,     3,     2,     5,     0,     2
+       0,     2,     1,     2,     0,     2,     2,     1,     2,     3,
+       1,     1,     1,     4,     1,     1,     0,     1,     3,     2,
+       5,     0,     2
 };
 
 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -493,59 +497,61 @@ static const yytype_uint8 yyr2[] =
    means the default is an error.  */
 static const yytype_uint8 yydefact[] =
 {
-       2,     0,     1,     0,     0,     7,     8,     3,     5,     6,
-       0,    11,    12,    18,     0,     9,    13,     4,    19,    18,
-       0,    14,    16,    10,    18,    15,    18,    17
+       4,     0,     0,     1,     0,     0,    10,    11,     5,     3,
+       7,     8,     0,     6,    14,    15,    21,     9,    12,    16,
+      22,    21,     0,    17,    19,    13,    21,    18,    21,    20
 };
 
 /* YYDEFGOTO[NTERM-NUM].  */
 static const yytype_int8 yydefgoto[] =
 {
-      -1,     1,     7,     8,    14,    15,    20,    21,    16
+      -1,     1,     2,     8,     9,    10,    17,    18,    22,    23,
+      19
 };
 
 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    STATE-NUM.  */
-#define YYPACT_NINF -17
+#define YYPACT_NINF -18
 static const yytype_int8 yypact[] =
 {
-     -17,     2,   -17,    -5,    -3,   -17,   -17,   -17,   -17,   -17,
-      10,   -17,   -17,   -17,    14,   -17,    12,   -17,   -17,   -17,
-      11,    -4,     6,   -17,   -17,    12,   -17,     6
+     -18,     4,     0,   -18,    -1,     6,   -18,   -18,   -18,     3,
+     -18,   -18,    11,   -18,   -18,   -18,   -18,   -18,   -18,    13,
+     -18,   -18,    12,    10,    17,   -18,   -18,    13,   -18,    17
 };
 
 /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int8 yypgoto[] =
 {
-     -17,   -17,   -17,     9,   -17,   -16,   -17,   -17,   -13
+     -18,   -18,   -18,   -18,   -18,    15,   -18,   -17,   -18,   -18,
+     -14
 };
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
    positive, shift that token.  If negative, reduce the rule which
    number is the opposite.  If zero, do what YYDEFACT says.
    If YYTABLE_NINF, syntax error.  */
-#define YYTABLE_NINF -1
-static const yytype_uint8 yytable[] =
+#define YYTABLE_NINF -3
+static const yytype_int8 yytable[] =
 {
-      19,     9,     2,     3,    10,     4,    22,    24,     5,    26,
-       6,    25,    18,    27,    11,    12,    11,    12,    18,    13,
-       5,    23,     6,    17
+      -2,     4,    21,     5,     3,    11,     6,    24,     7,     6,
+      28,     7,    27,    12,    29,    14,    15,    14,    15,    20,
+      16,    26,    25,    20,    13
 };
 
 static const yytype_uint8 yycheck[] =
 {
-      16,     6,     0,     1,     7,     3,    19,    11,     6,    25,
-       8,    24,     6,    26,     4,     5,     4,     5,     6,     9,
-       6,    10,     8,    14
+       0,     1,    19,     3,     0,     6,     6,    21,     8,     6,
+      27,     8,    26,     7,    28,     4,     5,     4,     5,     6,
+       9,    11,    10,     6,     9
 };
 
 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
    symbol of state STATE-NUM.  */
 static const yytype_uint8 yystos[] =
 {
-       0,    13,     0,     1,     3,     6,     8,    14,    15,     6,
-       7,     4,     5,     9,    16,    17,    20,    15,     6,    17,
-      18,    19,    20,    10,    11,    20,    17,    20
+       0,    13,    14,     0,     1,     3,     6,     8,    15,    16,
+      17,     6,     7,    17,     4,     5,     9,    18,    19,    22,
+       6,    19,    20,    21,    22,    10,    11,    22,    19,    22
 };
 
 #define yyerrok		(yyerrstatus = 0)
@@ -1077,7 +1083,7 @@ yydestruct (yymsg, yytype, yyvaluep, yyl
 	{ free((yyvaluep->string)); };
 
 /* Line 1000 of yacc.c  */
-#line 1081 "libxlu_cfg_y.c"
+#line 1087 "libxlu_cfg_y.c"
 	break;
       case 4: /* "STRING" */
 
@@ -1086,7 +1092,7 @@ yydestruct (yymsg, yytype, yyvaluep, yyl
 	{ free((yyvaluep->string)); };
 
 /* Line 1000 of yacc.c  */
-#line 1090 "libxlu_cfg_y.c"
+#line 1096 "libxlu_cfg_y.c"
 	break;
       case 5: /* "NUMBER" */
 
@@ -1095,43 +1101,43 @@ yydestruct (yymsg, yytype, yyvaluep, yyl
 	{ free((yyvaluep->string)); };
 
 /* Line 1000 of yacc.c  */
-#line 1099 "libxlu_cfg_y.c"
+#line 1105 "libxlu_cfg_y.c"
 	break;
-      case 16: /* "value" */
+      case 18: /* "value" */
 
 /* Line 1000 of yacc.c  */
 #line 43 "libxlu_cfg_y.y"
 	{ xlu__cfg_set_free((yyvaluep->setting)); };
 
 /* Line 1000 of yacc.c  */
-#line 1108 "libxlu_cfg_y.c"
+#line 1114 "libxlu_cfg_y.c"
 	break;
-      case 17: /* "atom" */
+      case 19: /* "atom" */
 
 /* Line 1000 of yacc.c  */
 #line 40 "libxlu_cfg_y.y"
 	{ free((yyvaluep->string)); };
 
 /* Line 1000 of yacc.c  */
-#line 1117 "libxlu_cfg_y.c"
+#line 1123 "libxlu_cfg_y.c"
 	break;
-      case 18: /* "valuelist" */
+      case 20: /* "valuelist" */
 
 /* Line 1000 of yacc.c  */
 #line 43 "libxlu_cfg_y.y"
 	{ xlu__cfg_set_free((yyvaluep->setting)); };
 
 /* Line 1000 of yacc.c  */
-#line 1126 "libxlu_cfg_y.c"
+#line 1132 "libxlu_cfg_y.c"
 	break;
-      case 19: /* "values" */
+      case 21: /* "values" */
 
 /* Line 1000 of yacc.c  */
 #line 43 "libxlu_cfg_y.y"
 	{ xlu__cfg_set_free((yyvaluep->setting)); };
 
 /* Line 1000 of yacc.c  */
-#line 1135 "libxlu_cfg_y.c"
+#line 1141 "libxlu_cfg_y.c"
 	break;
 
       default:
@@ -1459,80 +1465,80 @@ yyreduce:
   YY_REDUCE_PRINT (yyn);
   switch (yyn)
     {
-        case 4:
+        case 9:
 
 /* Line 1455 of yacc.c  */
-#line 51 "libxlu_cfg_y.y"
-    { xlu__cfg_set_store(ctx,(yyvsp[(1) - (4)].string),(yyvsp[(3) - (4)].setting),(yylsp[(3) - (4)]).first_line); ;}
-    break;
-
-  case 9:
-
-/* Line 1455 of yacc.c  */
-#line 58 "libxlu_cfg_y.y"
-    { (yyval.setting)= xlu__cfg_set_mk(ctx,1,(yyvsp[(1) - (1)].string)); ;}
-    break;
-
-  case 10:
-
-/* Line 1455 of yacc.c  */
-#line 59 "libxlu_cfg_y.y"
-    { (yyval.setting)= (yyvsp[(3) - (4)].setting); ;}
-    break;
-
-  case 11:
-
-/* Line 1455 of yacc.c  */
-#line 61 "libxlu_cfg_y.y"
-    { (yyval.string)= (yyvsp[(1) - (1)].string); ;}
+#line 57 "libxlu_cfg_y.y"
+    { xlu__cfg_set_store(ctx,(yyvsp[(1) - (3)].string),(yyvsp[(3) - (3)].setting),(yylsp[(3) - (3)]).first_line); ;}
     break;
 
   case 12:
 
 /* Line 1455 of yacc.c  */
 #line 62 "libxlu_cfg_y.y"
-    { (yyval.string)= (yyvsp[(1) - (1)].string); ;}
+    { (yyval.setting)= xlu__cfg_set_mk(ctx,1,(yyvsp[(1) - (1)].string)); ;}
     break;
 
   case 13:
 
 /* Line 1455 of yacc.c  */
-#line 64 "libxlu_cfg_y.y"
-    { (yyval.setting)= xlu__cfg_set_mk(ctx,0,0); ;}
+#line 63 "libxlu_cfg_y.y"
+    { (yyval.setting)= (yyvsp[(3) - (4)].setting); ;}
     break;
 
   case 14:
 
 /* Line 1455 of yacc.c  */
 #line 65 "libxlu_cfg_y.y"
-    { (yyval.setting)= (yyvsp[(1) - (1)].setting); ;}
+    { (yyval.string)= (yyvsp[(1) - (1)].string); ;}
     break;
 
   case 15:
 
 /* Line 1455 of yacc.c  */
 #line 66 "libxlu_cfg_y.y"
-    { (yyval.setting)= (yyvsp[(1) - (3)].setting); ;}
+    { (yyval.string)= (yyvsp[(1) - (1)].string); ;}
     break;
 
   case 16:
 
 /* Line 1455 of yacc.c  */
 #line 68 "libxlu_cfg_y.y"
-    { (yyval.setting)= xlu__cfg_set_mk(ctx,2,(yyvsp[(1) - (2)].string)); ;}
+    { (yyval.setting)= xlu__cfg_set_mk(ctx,0,0); ;}
     break;
 
   case 17:
 
 /* Line 1455 of yacc.c  */
 #line 69 "libxlu_cfg_y.y"
+    { (yyval.setting)= (yyvsp[(1) - (1)].setting); ;}
+    break;
+
+  case 18:
+
+/* Line 1455 of yacc.c  */
+#line 70 "libxlu_cfg_y.y"
+    { (yyval.setting)= (yyvsp[(1) - (3)].setting); ;}
+    break;
+
+  case 19:
+
+/* Line 1455 of yacc.c  */
+#line 72 "libxlu_cfg_y.y"
+    { (yyval.setting)= xlu__cfg_set_mk(ctx,2,(yyvsp[(1) - (2)].string)); ;}
+    break;
+
+  case 20:
+
+/* Line 1455 of yacc.c  */
+#line 73 "libxlu_cfg_y.y"
     { xlu__cfg_set_add(ctx,(yyvsp[(1) - (5)].setting),(yyvsp[(4) - (5)].string)); (yyval.setting)= (yyvsp[(1) - (5)].setting); ;}
     break;
 
 
 
 /* Line 1455 of yacc.c  */
-#line 1536 "libxlu_cfg_y.c"
+#line 1542 "libxlu_cfg_y.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
diff -r 25eda7e7b4e6 -r 9a51ab6d2d07 tools/libxl/libxlu_cfg_y.y
--- a/tools/libxl/libxlu_cfg_y.y	Fri Oct 26 16:49:45 2012 +0100
+++ b/tools/libxl/libxlu_cfg_y.y	Fri Oct 26 17:01:36 2012 +0100
@@ -44,14 +44,18 @@
 
 %%
 
-file: /* empty */
- |     file assignment
+file:  stmts
+ |     stmts assignment
 
-assignment: IDENT '=' value endstmt
-                            { xlu__cfg_set_store(ctx,$1,$3,@3.first_line); }
+stmts:  /* empty */
+ |      stmts stmt
+
+stmt:   assignment endstmt
  |      endstmt
  |      error NEWLINE
 
+assignment: IDENT '=' value { xlu__cfg_set_store(ctx,$1,$3,@3.first_line); }
+
 endstmt: NEWLINE
  |      ';'
 

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05:11: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 1TU9XT-0000nm-FA; Fri, 02 Nov 2012 05:11:27 +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 1TU9XS-0000lD-Ea
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:26 +0000
Received: from [85.158.139.211:10901] by server-6.bemta-5.messagelabs.com id
	EF/DA-19321-DF553905; Fri, 02 Nov 2012 05:11:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-206.messagelabs.com!1351833084!18528128!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4739 invoked from network); 2 Nov 2012 05:11:25 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2012 05:11: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 1TU9XQ-0000gD-6g
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:24 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XQ-0006S4-5N
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:24 +0000
Message-Id: <E1TU9XQ-0006S4-5N@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:23 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxl: properly handle errors
	from page sharing hypercalls
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351791764 0
# Node ID 9d2ad9218dcc5a541ca09f47f60d7c3fec1039eb
# Parent  4727c234198d51fdd248c3ba92560faa147b2ac6
libxl: properly handle errors from page sharing hypercalls

25886:051e2a30e3fb (25894:95a971c8058f in xen-unstable) is wrong
because it assumes that xc_sharing_freed_pages etc. return -errnoval
on error.  However, like other libxc calls they return -1 setting
errno.

Correct this, checking for l<0 and then testing errno against ENOSYS,
and also log the correct errno value.

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


diff -r 4727c234198d -r 9d2ad9218dcc tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Oct 26 17:03:13 2012 +0100
+++ b/tools/libxl/libxl.c	Thu Nov 01 17:42:44 2012 +0000
@@ -3653,21 +3653,25 @@ int libxl_get_physinfo(libxl_ctx *ctx, l
     physinfo->free_pages = xcphysinfo.free_pages;
     physinfo->scrub_pages = xcphysinfo.scrub_pages;
     l = xc_sharing_freed_pages(ctx->xch);
-    if (l == -ENOSYS) {
-        l = 0;
-    } else if (l < 0) {
-        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, l,
-                            "getting sharing freed pages");
-        return ERROR_FAIL;
+    if (l < 0) {
+        if (errno == ENOSYS) {
+            l = 0;
+        } else {
+            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+                             "getting sharing freed pages");
+            return ERROR_FAIL;
+        }
     }
     physinfo->sharing_freed_pages = l;
     l = xc_sharing_used_frames(ctx->xch);
-    if (l == -ENOSYS) {
-        l = 0;
-    } else if (l < 0) {
-        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, l,
-                            "getting sharing used frames");
-        return ERROR_FAIL;
+    if (l < 0) {
+        if (errno == ENOSYS) {
+            l = 0;
+        } else {
+            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+                             "getting sharing used frames");
+            return ERROR_FAIL;
+        }
     }
     physinfo->sharing_used_frames = l;
     physinfo->nr_nodes = xcphysinfo.nr_nodes;

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05:11: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 1TU9XT-0000nO-Bx; Fri, 02 Nov 2012 05:11:27 +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 1TU9XS-0000kz-5H
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:26 +0000
Received: from [85.158.138.51:4533] by server-6.bemta-3.messagelabs.com id
	A2/A5-28265-DF553905; Fri, 02 Nov 2012 05:11:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-174.messagelabs.com!1351833083!28377922!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9165 invoked from network); 2 Nov 2012 05:11:24 -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;
	2 Nov 2012 05:11: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 1TU9XP-0000g7-Km
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XP-0006Rp-JV
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:23 +0000
Message-Id: <E1TU9XP-0006Rp-JV@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:23 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] autoconf: add -Werror to
	libutil.h header 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: "Change log for Mercurial \(receive only\)"
	<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@citrix.com>
# Date 1351267393 -3600
# Node ID 4727c234198d51fdd248c3ba92560faa147b2ac6
# Parent  9ebebb1904fd540ddfb974647b8d97208db37c23
autoconf: add -Werror to libutil.h header check

libutil.h is only needed on BSDs, but not in Linux. Debian package
libbsd-dev-0.3.0-1 installed a libutil.h overlay that contains a

Perform the libutil.h check with -Werror, so we don't include this
bogus header.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 26005:cdb48f1742f3
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 9ebebb1904fd -r 4727c234198d tools/configure
--- a/tools/configure	Fri Oct 26 17:02:22 2012 +0100
+++ b/tools/configure	Fri Oct 26 17:03:13 2012 +0100
@@ -6543,6 +6543,10 @@ fi
 
 
 
+
+    saved_CPPFLAGS="$CPPFLAGS"
+
+    CPPFLAGS="$CPPFLAGS -Werror"
     ac_fn_c_check_header_mongrel "$LINENO" "libutil.h" "ac_cv_header_libutil_h" "$ac_includes_default"
 if test "x$ac_cv_header_libutil_h" = x""yes; then :
 
@@ -6553,6 +6557,9 @@ if test "x$ac_cv_header_libutil_h" = x""
 fi
 
 
+
+    CPPFLAGS="$saved_CPPFLAGS"
+
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openpty et al" >&5
 $as_echo_n "checking for openpty et al... " >&6; }
 if test "${ax_cv_ptyfuncs_libs+set}" = set; then :
diff -r 9ebebb1904fd -r 4727c234198d tools/m4/ptyfuncs.m4
--- a/tools/m4/ptyfuncs.m4	Fri Oct 26 17:02:22 2012 +0100
+++ b/tools/m4/ptyfuncs.m4	Fri Oct 26 17:03:13 2012 +0100
@@ -1,7 +1,14 @@
 AC_DEFUN([AX_CHECK_PTYFUNCS], [
+    dnl This is a workaround for a bug in Debian package
+    dnl libbsd-dev-0.3.0-1. Once we no longer support that
+    dnl package we can remove the addition of -Werror to
+    dnl CPPFLAGS.
+    AX_SAVEVAR_SAVE(CPPFLAGS)
+    CPPFLAGS="$CPPFLAGS -Werror"
     AC_CHECK_HEADER([libutil.h],[
       AC_DEFINE([INCLUDE_LIBUTIL_H],[<libutil.h>],[libutil header file name])
     ])
+    AX_SAVEVAR_RESTORE(CPPFLAGS)
     AC_CACHE_CHECK([for openpty et al], [ax_cv_ptyfuncs_libs], [
         for ax_cv_ptyfuncs_libs in -lutil "" NOT_FOUND; do
             if test "x$ax_cv_ptyfuncs_libs" = "xNOT_FOUND"; then

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05:11: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 1TU9XT-0000nm-FA; Fri, 02 Nov 2012 05:11:27 +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 1TU9XS-0000lD-Ea
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:26 +0000
Received: from [85.158.139.211:10901] by server-6.bemta-5.messagelabs.com id
	EF/DA-19321-DF553905; Fri, 02 Nov 2012 05:11:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-206.messagelabs.com!1351833084!18528128!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4739 invoked from network); 2 Nov 2012 05:11:25 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2012 05:11: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 1TU9XQ-0000gD-6g
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:24 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XQ-0006S4-5N
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:24 +0000
Message-Id: <E1TU9XQ-0006S4-5N@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:23 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxl: properly handle errors
	from page sharing hypercalls
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351791764 0
# Node ID 9d2ad9218dcc5a541ca09f47f60d7c3fec1039eb
# Parent  4727c234198d51fdd248c3ba92560faa147b2ac6
libxl: properly handle errors from page sharing hypercalls

25886:051e2a30e3fb (25894:95a971c8058f in xen-unstable) is wrong
because it assumes that xc_sharing_freed_pages etc. return -errnoval
on error.  However, like other libxc calls they return -1 setting
errno.

Correct this, checking for l<0 and then testing errno against ENOSYS,
and also log the correct errno value.

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


diff -r 4727c234198d -r 9d2ad9218dcc tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Oct 26 17:03:13 2012 +0100
+++ b/tools/libxl/libxl.c	Thu Nov 01 17:42:44 2012 +0000
@@ -3653,21 +3653,25 @@ int libxl_get_physinfo(libxl_ctx *ctx, l
     physinfo->free_pages = xcphysinfo.free_pages;
     physinfo->scrub_pages = xcphysinfo.scrub_pages;
     l = xc_sharing_freed_pages(ctx->xch);
-    if (l == -ENOSYS) {
-        l = 0;
-    } else if (l < 0) {
-        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, l,
-                            "getting sharing freed pages");
-        return ERROR_FAIL;
+    if (l < 0) {
+        if (errno == ENOSYS) {
+            l = 0;
+        } else {
+            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+                             "getting sharing freed pages");
+            return ERROR_FAIL;
+        }
     }
     physinfo->sharing_freed_pages = l;
     l = xc_sharing_used_frames(ctx->xch);
-    if (l == -ENOSYS) {
-        l = 0;
-    } else if (l < 0) {
-        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, l,
-                            "getting sharing used frames");
-        return ERROR_FAIL;
+    if (l < 0) {
+        if (errno == ENOSYS) {
+            l = 0;
+        } else {
+            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+                             "getting sharing used frames");
+            return ERROR_FAIL;
+        }
     }
     physinfo->sharing_used_frames = l;
     physinfo->nr_nodes = xcphysinfo.nr_nodes;

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05:11: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 1TU9XT-0000nO-Bx; Fri, 02 Nov 2012 05:11:27 +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 1TU9XS-0000kz-5H
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:26 +0000
Received: from [85.158.138.51:4533] by server-6.bemta-3.messagelabs.com id
	A2/A5-28265-DF553905; Fri, 02 Nov 2012 05:11:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-174.messagelabs.com!1351833083!28377922!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9165 invoked from network); 2 Nov 2012 05:11:24 -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;
	2 Nov 2012 05:11: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 1TU9XP-0000g7-Km
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XP-0006Rp-JV
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:23 +0000
Message-Id: <E1TU9XP-0006Rp-JV@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:23 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] autoconf: add -Werror to
	libutil.h header 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: "Change log for Mercurial \(receive only\)"
	<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@citrix.com>
# Date 1351267393 -3600
# Node ID 4727c234198d51fdd248c3ba92560faa147b2ac6
# Parent  9ebebb1904fd540ddfb974647b8d97208db37c23
autoconf: add -Werror to libutil.h header check

libutil.h is only needed on BSDs, but not in Linux. Debian package
libbsd-dev-0.3.0-1 installed a libutil.h overlay that contains a

Perform the libutil.h check with -Werror, so we don't include this
bogus header.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 26005:cdb48f1742f3
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 9ebebb1904fd -r 4727c234198d tools/configure
--- a/tools/configure	Fri Oct 26 17:02:22 2012 +0100
+++ b/tools/configure	Fri Oct 26 17:03:13 2012 +0100
@@ -6543,6 +6543,10 @@ fi
 
 
 
+
+    saved_CPPFLAGS="$CPPFLAGS"
+
+    CPPFLAGS="$CPPFLAGS -Werror"
     ac_fn_c_check_header_mongrel "$LINENO" "libutil.h" "ac_cv_header_libutil_h" "$ac_includes_default"
 if test "x$ac_cv_header_libutil_h" = x""yes; then :
 
@@ -6553,6 +6557,9 @@ if test "x$ac_cv_header_libutil_h" = x""
 fi
 
 
+
+    CPPFLAGS="$saved_CPPFLAGS"
+
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openpty et al" >&5
 $as_echo_n "checking for openpty et al... " >&6; }
 if test "${ax_cv_ptyfuncs_libs+set}" = set; then :
diff -r 9ebebb1904fd -r 4727c234198d tools/m4/ptyfuncs.m4
--- a/tools/m4/ptyfuncs.m4	Fri Oct 26 17:02:22 2012 +0100
+++ b/tools/m4/ptyfuncs.m4	Fri Oct 26 17:03:13 2012 +0100
@@ -1,7 +1,14 @@
 AC_DEFUN([AX_CHECK_PTYFUNCS], [
+    dnl This is a workaround for a bug in Debian package
+    dnl libbsd-dev-0.3.0-1. Once we no longer support that
+    dnl package we can remove the addition of -Werror to
+    dnl CPPFLAGS.
+    AX_SAVEVAR_SAVE(CPPFLAGS)
+    CPPFLAGS="$CPPFLAGS -Werror"
     AC_CHECK_HEADER([libutil.h],[
       AC_DEFINE([INCLUDE_LIBUTIL_H],[<libutil.h>],[libutil header file name])
     ])
+    AX_SAVEVAR_RESTORE(CPPFLAGS)
     AC_CACHE_CHECK([for openpty et al], [ax_cv_ptyfuncs_libs], [
         for ax_cv_ptyfuncs_libs in -lutil "" NOT_FOUND; do
             if test "x$ax_cv_ptyfuncs_libs" = "xNOT_FOUND"; then

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:29 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05:11: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 1TU9XV-0000ra-LI; Fri, 02 Nov 2012 05:11:29 +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 1TU9XS-0000g0-Vs
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:27 +0000
Received: from [85.158.143.99:17061] by server-1.bemta-4.messagelabs.com id
	11/CC-27934-EF553905; Fri, 02 Nov 2012 05:11:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1351833084!21284263!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17952 invoked from network); 2 Nov 2012 05:11:25 -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;
	2 Nov 2012 05:11: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 1TU9XQ-0000gO-Ne
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:24 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XQ-0006SJ-MM
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:24 +0000
Message-Id: <E1TU9XQ-0006SJ-MM@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:24 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] Merge
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351791963 0
# Node ID 651d965ee2c0f3c7019ad291bfb665b4a8cd98b1
# Parent  9d2ad9218dcc5a541ca09f47f60d7c3fec1039eb
# Parent  2bca7e58a3dff0c2d21993423e37bb01a942785c
Merge
---


diff -r 9d2ad9218dcc -r 651d965ee2c0 tools/firmware/hvmloader/xenbus.c
--- a/tools/firmware/hvmloader/xenbus.c	Thu Nov 01 17:42:44 2012 +0000
+++ b/tools/firmware/hvmloader/xenbus.c	Thu Nov 01 17:46:03 2012 +0000
@@ -64,6 +64,8 @@ void xenbus_setup(void)
 /* Reset the xenbus connection so the next kernel can start again. */
 void xenbus_shutdown(void)
 {
+    struct shared_info *shinfo = get_shared_info();
+
     ASSERT(rings != NULL);
 
     /* We zero out the whole ring -- the backend can handle this, and it's 
@@ -72,7 +74,9 @@ void xenbus_shutdown(void)
     memset(rings, 0, sizeof *rings);
 
     /* Clear the event-channel state too. */
-    memset(get_shared_info(), 0, PAGE_SIZE);
+    memset(shinfo->vcpu_info, 0, sizeof(shinfo->vcpu_info));
+    memset(shinfo->evtchn_pending, 0, sizeof(shinfo->evtchn_pending));
+    memset(shinfo->evtchn_mask, 0, sizeof(shinfo->evtchn_mask));
 
     rings = NULL;
 }

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

From xen-changelog-bounces@lists.xen.org Fri Nov 02 05:11:29 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Nov 2012 05:11: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 1TU9XV-0000ra-LI; Fri, 02 Nov 2012 05:11:29 +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 1TU9XS-0000g0-Vs
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:27 +0000
Received: from [85.158.143.99:17061] by server-1.bemta-4.messagelabs.com id
	11/CC-27934-EF553905; Fri, 02 Nov 2012 05:11:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1351833084!21284263!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17952 invoked from network); 2 Nov 2012 05:11:25 -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;
	2 Nov 2012 05:11: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 1TU9XQ-0000gO-Ne
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:24 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TU9XQ-0006SJ-MM
	for xen-changelog@lists.xensource.com; Fri, 02 Nov 2012 05:11:24 +0000
Message-Id: <E1TU9XQ-0006SJ-MM@xenbits.xen.org>
Date: Fri, 02 Nov 2012 05:11:24 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] Merge
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351791963 0
# Node ID 651d965ee2c0f3c7019ad291bfb665b4a8cd98b1
# Parent  9d2ad9218dcc5a541ca09f47f60d7c3fec1039eb
# Parent  2bca7e58a3dff0c2d21993423e37bb01a942785c
Merge
---


diff -r 9d2ad9218dcc -r 651d965ee2c0 tools/firmware/hvmloader/xenbus.c
--- a/tools/firmware/hvmloader/xenbus.c	Thu Nov 01 17:42:44 2012 +0000
+++ b/tools/firmware/hvmloader/xenbus.c	Thu Nov 01 17:46:03 2012 +0000
@@ -64,6 +64,8 @@ void xenbus_setup(void)
 /* Reset the xenbus connection so the next kernel can start again. */
 void xenbus_shutdown(void)
 {
+    struct shared_info *shinfo = get_shared_info();
+
     ASSERT(rings != NULL);
 
     /* We zero out the whole ring -- the backend can handle this, and it's 
@@ -72,7 +74,9 @@ void xenbus_shutdown(void)
     memset(rings, 0, sizeof *rings);
 
     /* Clear the event-channel state too. */
-    memset(get_shared_info(), 0, PAGE_SIZE);
+    memset(shinfo->vcpu_info, 0, sizeof(shinfo->vcpu_info));
+    memset(shinfo->evtchn_pending, 0, sizeof(shinfo->evtchn_pending));
+    memset(shinfo->evtchn_mask, 0, sizeof(shinfo->evtchn_mask));
 
     rings = NULL;
 }

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

From xen-changelog-bounces@lists.xen.org Sat Nov 03 01:33:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Nov 2012 01: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.xen.org>)
	id 1TUSbp-0007ER-9D; Sat, 03 Nov 2012 01:33:13 +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 1TUSbo-0007EF-C5
	for xen-changelog@lists.xensource.com; Sat, 03 Nov 2012 01:33:12 +0000
Received: from [85.158.143.99:64146] by server-3.bemta-4.messagelabs.com id
	D8/F1-06841-75474905; Sat, 03 Nov 2012 01:33:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-216.messagelabs.com!1351906389!28466769!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4319 invoked from network); 3 Nov 2012 01:33:10 -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 Nov 2012 01: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 1TUSbl-0007FG-9E
	for xen-changelog@lists.xensource.com; Sat, 03 Nov 2012 01:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TUSbk-00049E-VQ
	for xen-changelog@lists.xensource.com; Sat, 03 Nov 2012 01:33:08 +0000
Message-Id: <E1TUSbk-00049E-VQ@xenbits.xen.org>
Date: Sat, 03 Nov 2012 01:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mwait-idle: enable Ivy Bridge
	Xeon 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: "Change log for Mercurial \(receive only\)"
	<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 1351869353 -3600
# Node ID cacdc787d11fb06a977002b8eac5cc77c303f285
# Parent  951d0444190858449274b41bcf457d9622d340e9
x86/mwait-idle: enable Ivy Bridge Xeon support

Matching a similar change in Linux 3.7-rc.

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


diff -r 951d04441908 -r cacdc787d11f xen/arch/x86/cpu/mwait-idle.c
--- a/xen/arch/x86/cpu/mwait-idle.c	Fri Nov 02 16:14:11 2012 +0100
+++ b/xen/arch/x86/cpu/mwait-idle.c	Fri Nov 02 16:15:53 2012 +0100
@@ -365,6 +365,7 @@ static struct intel_idle_id {
 	ICPU(0x2a, snb),
 	ICPU(0x2d, snb),
 	ICPU(0x3a, ivb),
+	ICPU(0x3e, ivb),
 	{}
 };
 

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

From xen-changelog-bounces@lists.xen.org Sat Nov 03 01:33:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Nov 2012 01: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.xen.org>)
	id 1TUSbp-0007EW-BK; Sat, 03 Nov 2012 01:33:13 +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 1TUSbo-0007EE-98
	for xen-changelog@lists.xensource.com; Sat, 03 Nov 2012 01:33:12 +0000
Received: from [85.158.138.51:37591] by server-14.bemta-3.messagelabs.com id
	4B/AA-12788-75474905; Sat, 03 Nov 2012 01:33:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1351906389!24467528!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27576 invoked from network); 3 Nov 2012 01:33: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;
	3 Nov 2012 01: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 1TUSbk-0007FD-Tl
	for xen-changelog@lists.xensource.com; Sat, 03 Nov 2012 01:33:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TUSbk-00048z-Ar
	for xen-changelog@lists.xensource.com; Sat, 03 Nov 2012 01:33:08 +0000
Message-Id: <E1TUSbk-00048z-Ar@xenbits.xen.org>
Date: Sat, 03 Nov 2012 01:33:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] ACPI/cpuidle: remove unused "power"
	field from Cx state data
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351869251 -3600
# Node ID 951d0444190858449274b41bcf457d9622d340e9
# Parent  bf249cd5f2c1266875acc9c33c5172d94b77a897
ACPI/cpuidle: remove unused "power" field from Cx state data

It has never been used for anything, and Linux 3.7 doesn't propagate
this information anymore.

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


diff -r bf249cd5f2c1 -r 951d04441908 xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c	Tue Oct 30 18:12:11 2012 +0000
+++ b/xen/arch/x86/acpi/cpu_idle.c	Fri Nov 02 16:14:11 2012 +0100
@@ -935,7 +935,6 @@ static void set_cx(
     }
 
     cx->latency  = xen_cx->latency;
-    cx->power    = xen_cx->power;
     
     cx->target_residency = cx->latency * latency_factor;
     if ( cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2 )
diff -r bf249cd5f2c1 -r 951d04441908 xen/arch/x86/cpu/mwait-idle.c
--- a/xen/arch/x86/cpu/mwait-idle.c	Tue Oct 30 18:12:11 2012 +0000
+++ b/xen/arch/x86/cpu/mwait-idle.c	Fri Nov 02 16:14:11 2012 +0100
@@ -96,7 +96,6 @@ static const struct cpuidle_state {
 	char		name[16];
 	unsigned int	flags;
 	unsigned int	exit_latency; /* in US */
-	int		power_usage; /* in mW */
 	unsigned int	target_residency; /* in US */
 } *cpuidle_state_table;
 
@@ -479,7 +478,6 @@ static int mwait_idle_cpu_init(struct no
 		cx->type = cstate;
 		cx->address = get_driver_data(cstate);
 		cx->entry_method = ACPI_CSTATE_EM_FFH;
-		cx->power = cpuidle_state_table[cstate].power_usage;
 		cx->latency = cpuidle_state_table[cstate].exit_latency;
 		cx->target_residency =
 			cpuidle_state_table[cstate].target_residency;
diff -r bf249cd5f2c1 -r 951d04441908 xen/include/xen/cpuidle.h
--- a/xen/include/xen/cpuidle.h	Tue Oct 30 18:12:11 2012 +0000
+++ b/xen/include/xen/cpuidle.h	Fri Nov 02 16:14:11 2012 +0100
@@ -46,7 +46,6 @@ struct acpi_processor_cx
     u32 address;
     u32 latency;
     u32 target_residency;
-    u32 power;
     u32 usage;
     u64 time;
 };

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

From xen-changelog-bounces@lists.xen.org Sat Nov 03 01:33:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Nov 2012 01: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.xen.org>)
	id 1TUSbp-0007ER-9D; Sat, 03 Nov 2012 01:33:13 +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 1TUSbo-0007EF-C5
	for xen-changelog@lists.xensource.com; Sat, 03 Nov 2012 01:33:12 +0000
Received: from [85.158.143.99:64146] by server-3.bemta-4.messagelabs.com id
	D8/F1-06841-75474905; Sat, 03 Nov 2012 01:33:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-216.messagelabs.com!1351906389!28466769!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4319 invoked from network); 3 Nov 2012 01:33:10 -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 Nov 2012 01: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 1TUSbl-0007FG-9E
	for xen-changelog@lists.xensource.com; Sat, 03 Nov 2012 01:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TUSbk-00049E-VQ
	for xen-changelog@lists.xensource.com; Sat, 03 Nov 2012 01:33:08 +0000
Message-Id: <E1TUSbk-00049E-VQ@xenbits.xen.org>
Date: Sat, 03 Nov 2012 01:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mwait-idle: enable Ivy Bridge
	Xeon 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: "Change log for Mercurial \(receive only\)"
	<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 1351869353 -3600
# Node ID cacdc787d11fb06a977002b8eac5cc77c303f285
# Parent  951d0444190858449274b41bcf457d9622d340e9
x86/mwait-idle: enable Ivy Bridge Xeon support

Matching a similar change in Linux 3.7-rc.

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


diff -r 951d04441908 -r cacdc787d11f xen/arch/x86/cpu/mwait-idle.c
--- a/xen/arch/x86/cpu/mwait-idle.c	Fri Nov 02 16:14:11 2012 +0100
+++ b/xen/arch/x86/cpu/mwait-idle.c	Fri Nov 02 16:15:53 2012 +0100
@@ -365,6 +365,7 @@ static struct intel_idle_id {
 	ICPU(0x2a, snb),
 	ICPU(0x2d, snb),
 	ICPU(0x3a, ivb),
+	ICPU(0x3e, ivb),
 	{}
 };
 

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

From xen-changelog-bounces@lists.xen.org Sat Nov 03 01:33:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Nov 2012 01: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.xen.org>)
	id 1TUSbp-0007EW-BK; Sat, 03 Nov 2012 01:33:13 +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 1TUSbo-0007EE-98
	for xen-changelog@lists.xensource.com; Sat, 03 Nov 2012 01:33:12 +0000
Received: from [85.158.138.51:37591] by server-14.bemta-3.messagelabs.com id
	4B/AA-12788-75474905; Sat, 03 Nov 2012 01:33:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1351906389!24467528!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27576 invoked from network); 3 Nov 2012 01:33: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;
	3 Nov 2012 01: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 1TUSbk-0007FD-Tl
	for xen-changelog@lists.xensource.com; Sat, 03 Nov 2012 01:33:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TUSbk-00048z-Ar
	for xen-changelog@lists.xensource.com; Sat, 03 Nov 2012 01:33:08 +0000
Message-Id: <E1TUSbk-00048z-Ar@xenbits.xen.org>
Date: Sat, 03 Nov 2012 01:33:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] ACPI/cpuidle: remove unused "power"
	field from Cx state data
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351869251 -3600
# Node ID 951d0444190858449274b41bcf457d9622d340e9
# Parent  bf249cd5f2c1266875acc9c33c5172d94b77a897
ACPI/cpuidle: remove unused "power" field from Cx state data

It has never been used for anything, and Linux 3.7 doesn't propagate
this information anymore.

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


diff -r bf249cd5f2c1 -r 951d04441908 xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c	Tue Oct 30 18:12:11 2012 +0000
+++ b/xen/arch/x86/acpi/cpu_idle.c	Fri Nov 02 16:14:11 2012 +0100
@@ -935,7 +935,6 @@ static void set_cx(
     }
 
     cx->latency  = xen_cx->latency;
-    cx->power    = xen_cx->power;
     
     cx->target_residency = cx->latency * latency_factor;
     if ( cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2 )
diff -r bf249cd5f2c1 -r 951d04441908 xen/arch/x86/cpu/mwait-idle.c
--- a/xen/arch/x86/cpu/mwait-idle.c	Tue Oct 30 18:12:11 2012 +0000
+++ b/xen/arch/x86/cpu/mwait-idle.c	Fri Nov 02 16:14:11 2012 +0100
@@ -96,7 +96,6 @@ static const struct cpuidle_state {
 	char		name[16];
 	unsigned int	flags;
 	unsigned int	exit_latency; /* in US */
-	int		power_usage; /* in mW */
 	unsigned int	target_residency; /* in US */
 } *cpuidle_state_table;
 
@@ -479,7 +478,6 @@ static int mwait_idle_cpu_init(struct no
 		cx->type = cstate;
 		cx->address = get_driver_data(cstate);
 		cx->entry_method = ACPI_CSTATE_EM_FFH;
-		cx->power = cpuidle_state_table[cstate].power_usage;
 		cx->latency = cpuidle_state_table[cstate].exit_latency;
 		cx->target_residency =
 			cpuidle_state_table[cstate].target_residency;
diff -r bf249cd5f2c1 -r 951d04441908 xen/include/xen/cpuidle.h
--- a/xen/include/xen/cpuidle.h	Tue Oct 30 18:12:11 2012 +0000
+++ b/xen/include/xen/cpuidle.h	Fri Nov 02 16:14:11 2012 +0100
@@ -46,7 +46,6 @@ struct acpi_processor_cx
     u32 address;
     u32 latency;
     u32 target_residency;
-    u32 power;
     u32 usage;
     u64 time;
 };

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

From xen-changelog-bounces@lists.xen.org Sat Nov 03 01:33:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Nov 2012 01: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.xen.org>)
	id 1TUSbq-0007El-Di; Sat, 03 Nov 2012 01:33:14 +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 1TUSbp-0007EO-5Y
	for xen-changelog@lists.xensource.com; Sat, 03 Nov 2012 01:33:13 +0000
Received: from [85.158.143.99:64163] by server-1.bemta-4.messagelabs.com id
	97/3D-27934-85474905; Sat, 03 Nov 2012 01:33:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-216.messagelabs.com!1351906390!27877730!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27230 invoked from network); 3 Nov 2012 01:33:11 -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 Nov 2012 01: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 1TUSbl-0007FJ-OD
	for xen-changelog@lists.xensource.com; Sat, 03 Nov 2012 01:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TUSbl-00049T-HE
	for xen-changelog@lists.xensource.com; Sat, 03 Nov 2012 01:33:09 +0000
Message-Id: <E1TUSbl-00049T-HE@xenbits.xen.org>
Date: Sat, 03 Nov 2012 01:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] IOMMU: keep disabled until
	iommu_setup() is called
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351872930 -3600
# Node ID bd78e5630a5be55d439eb235627d52ebe8214524
# Parent  cacdc787d11fb06a977002b8eac5cc77c303f285
IOMMU: keep disabled until iommu_setup() is called

The iommu is enabled by default when xen is booting and later disabled
in iommu_setup() when no iommu is present.

But under some circumstances iommu code can be called before
iommu_setup() is processed. If there is no iommu available xen crashes.

This can happen for example when panic(...) is called as introduced
with the patch "x86-64: detect processors subject to AMD erratum #121
and refuse to boot" since xen 4.1.3, resulting in
find_iommu_for_device() to be called in the context of
disable_IO_APIC() / __stop_this_cpu().

This patch fixes this by keeping the iommu disabled until iommu_setup()
is entered.

Originally-by: Ronny Hegewald <ronny.hegewald@online.de>

In order for iommu_enable to be off initially, iommu_supports_eim()
must not depend on it anymore, nor must acpi_parse_dmar(). The former
in turn requires that iommu_intremap gets uncoupled from iommu_enabled
(in particular, failure during IOMMU setup should no longer result in
iommu_intremap getting cleared by generic code; IOMMU specific code
can still do so provided in can live with the consequences).

This could have the nice side effect of allowing to use "iommu=off"
even when x2APIC was pre-enabled by the BIOS (in which case interrupt
remapping is a requirement, but DMA translation [obviously] isn't), but
that doesn't currently work (and hence x2apic_bsp_setup() forces the
IOMMU on rather than just interrupt remapping).

For consistency with VT-d, make the AMD IOMMU code also skip all ACPI
table parsing when neither iommu_enable nor iommu_intremap are set.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Xiantao Zhang <xiantao.zhang@intel.com>
Acked-by: "Huang2, Wei" <Wei.Huang2@amd.com>
---


diff -r cacdc787d11f -r bd78e5630a5b xen/arch/x86/apic.c
--- a/xen/arch/x86/apic.c	Fri Nov 02 16:15:53 2012 +0100
+++ b/xen/arch/x86/apic.c	Fri Nov 02 17:15:30 2012 +0100
@@ -975,6 +975,8 @@ void __init x2apic_bsp_setup(void)
         goto restore_out;
     }
 
+    force_iommu = 1;
+
     genapic = apic_x2apic_probe();
     printk("Switched to APIC driver %s.\n", genapic->name);
 
diff -r cacdc787d11f -r bd78e5630a5b xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c	Fri Nov 02 16:15:53 2012 +0100
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c	Fri Nov 02 17:15:30 2012 +0100
@@ -164,9 +164,13 @@ int __init amd_iov_detect(void)
 {
     INIT_LIST_HEAD(&amd_iommu_head);
 
+    if ( !iommu_enable && !iommu_intremap )
+        return 0;
+
     if ( (amd_iommu_detect_acpi() !=0) || (iommu_found() == 0) )
     {
         printk("AMD-Vi: IOMMU not found!\n");
+        iommu_intremap = 0;
         return -ENODEV;
     }
 
diff -r cacdc787d11f -r bd78e5630a5b xen/drivers/passthrough/iommu.c
--- a/xen/drivers/passthrough/iommu.c	Fri Nov 02 16:15:53 2012 +0100
+++ b/xen/drivers/passthrough/iommu.c	Fri Nov 02 17:15:30 2012 +0100
@@ -41,7 +41,8 @@ static void iommu_dump_p2m_table(unsigne
  *   no-intremap                Disable VT-d Interrupt Remapping
  */
 custom_param("iommu", parse_iommu_param);
-bool_t __read_mostly iommu_enabled = 1;
+bool_t __initdata iommu_enable = 1;
+bool_t __read_mostly iommu_enabled;
 bool_t __read_mostly force_iommu;
 bool_t __initdata iommu_dom0_strict;
 bool_t __read_mostly iommu_verbose;
@@ -77,7 +78,7 @@ static void __init parse_iommu_param(cha
             *ss = '\0';
 
         if ( !parse_bool(s) )
-            iommu_enabled = 0;
+            iommu_enable = 0;
         else if ( !strcmp(s, "force") || !strcmp(s, "required") )
             force_iommu = val;
         else if ( !strcmp(s, "workaround_bios_bug") )
@@ -395,7 +396,7 @@ int __init iommu_setup(void)
     if ( iommu_dom0_strict )
         iommu_passthrough = 0;
 
-    if ( iommu_enabled )
+    if ( iommu_enable )
     {
         rc = iommu_hardware_setup();
         iommu_enabled = (rc == 0);
@@ -409,8 +410,6 @@ int __init iommu_setup(void)
     if ( !iommu_enabled )
     {
         iommu_snoop = 0;
-        iommu_qinval = 0;
-        iommu_intremap = 0;
         iommu_passthrough = 0;
         iommu_dom0_strict = 0;
     }
diff -r cacdc787d11f -r bd78e5630a5b xen/drivers/passthrough/vtd/dmar.c
--- a/xen/drivers/passthrough/vtd/dmar.c	Fri Nov 02 16:15:53 2012 +0100
+++ b/xen/drivers/passthrough/vtd/dmar.c	Fri Nov 02 17:15:30 2012 +0100
@@ -744,7 +744,7 @@ static int __init acpi_parse_dmar(struct
     dmar = (struct acpi_table_dmar *)table;
     dmar_flags = dmar->flags;
 
-    if ( !iommu_enabled )
+    if ( !iommu_enable && !iommu_intremap )
     {
         ret = -EINVAL;
         goto out;
diff -r cacdc787d11f -r bd78e5630a5b xen/drivers/passthrough/vtd/intremap.c
--- a/xen/drivers/passthrough/vtd/intremap.c	Fri Nov 02 16:15:53 2012 +0100
+++ b/xen/drivers/passthrough/vtd/intremap.c	Fri Nov 02 17:15:30 2012 +0100
@@ -149,8 +149,7 @@ int iommu_supports_eim(void)
     struct acpi_drhd_unit *drhd;
     int apic;
 
-    if ( !iommu_enabled || !iommu_qinval || !iommu_intremap ||
-         list_empty(&acpi_drhd_units) )
+    if ( !iommu_qinval || !iommu_intremap || list_empty(&acpi_drhd_units) )
         return 0;
 
     /* We MUST have a DRHD unit for each IOAPIC. */
diff -r cacdc787d11f -r bd78e5630a5b xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Fri Nov 02 16:15:53 2012 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Fri Nov 02 17:15:30 2012 +0100
@@ -2086,7 +2086,10 @@ int __init intel_vtd_setup(void)
     int ret;
 
     if ( list_empty(&acpi_drhd_units) )
-        return -ENODEV;
+    {
+        ret = -ENODEV;
+        goto error;
+    }
 
     platform_quirks_init();
 
diff -r cacdc787d11f -r bd78e5630a5b xen/include/xen/iommu.h
--- a/xen/include/xen/iommu.h	Fri Nov 02 16:15:53 2012 +0100
+++ b/xen/include/xen/iommu.h	Fri Nov 02 17:15:30 2012 +0100
@@ -26,7 +26,7 @@
 #include <public/hvm/ioreq.h>
 #include <public/domctl.h>
 
-extern bool_t iommu_enabled;
+extern bool_t iommu_enable, iommu_enabled;
 extern bool_t force_iommu, iommu_verbose;
 extern bool_t iommu_workaround_bios_bug, iommu_passthrough;
 extern bool_t iommu_snoop, iommu_qinval, iommu_intremap;

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

From xen-changelog-bounces@lists.xen.org Sat Nov 03 01:33:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Nov 2012 01: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.xen.org>)
	id 1TUSbq-0007El-Di; Sat, 03 Nov 2012 01:33:14 +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 1TUSbp-0007EO-5Y
	for xen-changelog@lists.xensource.com; Sat, 03 Nov 2012 01:33:13 +0000
Received: from [85.158.143.99:64163] by server-1.bemta-4.messagelabs.com id
	97/3D-27934-85474905; Sat, 03 Nov 2012 01:33:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-216.messagelabs.com!1351906390!27877730!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27230 invoked from network); 3 Nov 2012 01:33:11 -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 Nov 2012 01: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 1TUSbl-0007FJ-OD
	for xen-changelog@lists.xensource.com; Sat, 03 Nov 2012 01:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TUSbl-00049T-HE
	for xen-changelog@lists.xensource.com; Sat, 03 Nov 2012 01:33:09 +0000
Message-Id: <E1TUSbl-00049T-HE@xenbits.xen.org>
Date: Sat, 03 Nov 2012 01:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] IOMMU: keep disabled until
	iommu_setup() is called
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1351872930 -3600
# Node ID bd78e5630a5be55d439eb235627d52ebe8214524
# Parent  cacdc787d11fb06a977002b8eac5cc77c303f285
IOMMU: keep disabled until iommu_setup() is called

The iommu is enabled by default when xen is booting and later disabled
in iommu_setup() when no iommu is present.

But under some circumstances iommu code can be called before
iommu_setup() is processed. If there is no iommu available xen crashes.

This can happen for example when panic(...) is called as introduced
with the patch "x86-64: detect processors subject to AMD erratum #121
and refuse to boot" since xen 4.1.3, resulting in
find_iommu_for_device() to be called in the context of
disable_IO_APIC() / __stop_this_cpu().

This patch fixes this by keeping the iommu disabled until iommu_setup()
is entered.

Originally-by: Ronny Hegewald <ronny.hegewald@online.de>

In order for iommu_enable to be off initially, iommu_supports_eim()
must not depend on it anymore, nor must acpi_parse_dmar(). The former
in turn requires that iommu_intremap gets uncoupled from iommu_enabled
(in particular, failure during IOMMU setup should no longer result in
iommu_intremap getting cleared by generic code; IOMMU specific code
can still do so provided in can live with the consequences).

This could have the nice side effect of allowing to use "iommu=off"
even when x2APIC was pre-enabled by the BIOS (in which case interrupt
remapping is a requirement, but DMA translation [obviously] isn't), but
that doesn't currently work (and hence x2apic_bsp_setup() forces the
IOMMU on rather than just interrupt remapping).

For consistency with VT-d, make the AMD IOMMU code also skip all ACPI
table parsing when neither iommu_enable nor iommu_intremap are set.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Xiantao Zhang <xiantao.zhang@intel.com>
Acked-by: "Huang2, Wei" <Wei.Huang2@amd.com>
---


diff -r cacdc787d11f -r bd78e5630a5b xen/arch/x86/apic.c
--- a/xen/arch/x86/apic.c	Fri Nov 02 16:15:53 2012 +0100
+++ b/xen/arch/x86/apic.c	Fri Nov 02 17:15:30 2012 +0100
@@ -975,6 +975,8 @@ void __init x2apic_bsp_setup(void)
         goto restore_out;
     }
 
+    force_iommu = 1;
+
     genapic = apic_x2apic_probe();
     printk("Switched to APIC driver %s.\n", genapic->name);
 
diff -r cacdc787d11f -r bd78e5630a5b xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c	Fri Nov 02 16:15:53 2012 +0100
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c	Fri Nov 02 17:15:30 2012 +0100
@@ -164,9 +164,13 @@ int __init amd_iov_detect(void)
 {
     INIT_LIST_HEAD(&amd_iommu_head);
 
+    if ( !iommu_enable && !iommu_intremap )
+        return 0;
+
     if ( (amd_iommu_detect_acpi() !=0) || (iommu_found() == 0) )
     {
         printk("AMD-Vi: IOMMU not found!\n");
+        iommu_intremap = 0;
         return -ENODEV;
     }
 
diff -r cacdc787d11f -r bd78e5630a5b xen/drivers/passthrough/iommu.c
--- a/xen/drivers/passthrough/iommu.c	Fri Nov 02 16:15:53 2012 +0100
+++ b/xen/drivers/passthrough/iommu.c	Fri Nov 02 17:15:30 2012 +0100
@@ -41,7 +41,8 @@ static void iommu_dump_p2m_table(unsigne
  *   no-intremap                Disable VT-d Interrupt Remapping
  */
 custom_param("iommu", parse_iommu_param);
-bool_t __read_mostly iommu_enabled = 1;
+bool_t __initdata iommu_enable = 1;
+bool_t __read_mostly iommu_enabled;
 bool_t __read_mostly force_iommu;
 bool_t __initdata iommu_dom0_strict;
 bool_t __read_mostly iommu_verbose;
@@ -77,7 +78,7 @@ static void __init parse_iommu_param(cha
             *ss = '\0';
 
         if ( !parse_bool(s) )
-            iommu_enabled = 0;
+            iommu_enable = 0;
         else if ( !strcmp(s, "force") || !strcmp(s, "required") )
             force_iommu = val;
         else if ( !strcmp(s, "workaround_bios_bug") )
@@ -395,7 +396,7 @@ int __init iommu_setup(void)
     if ( iommu_dom0_strict )
         iommu_passthrough = 0;
 
-    if ( iommu_enabled )
+    if ( iommu_enable )
     {
         rc = iommu_hardware_setup();
         iommu_enabled = (rc == 0);
@@ -409,8 +410,6 @@ int __init iommu_setup(void)
     if ( !iommu_enabled )
     {
         iommu_snoop = 0;
-        iommu_qinval = 0;
-        iommu_intremap = 0;
         iommu_passthrough = 0;
         iommu_dom0_strict = 0;
     }
diff -r cacdc787d11f -r bd78e5630a5b xen/drivers/passthrough/vtd/dmar.c
--- a/xen/drivers/passthrough/vtd/dmar.c	Fri Nov 02 16:15:53 2012 +0100
+++ b/xen/drivers/passthrough/vtd/dmar.c	Fri Nov 02 17:15:30 2012 +0100
@@ -744,7 +744,7 @@ static int __init acpi_parse_dmar(struct
     dmar = (struct acpi_table_dmar *)table;
     dmar_flags = dmar->flags;
 
-    if ( !iommu_enabled )
+    if ( !iommu_enable && !iommu_intremap )
     {
         ret = -EINVAL;
         goto out;
diff -r cacdc787d11f -r bd78e5630a5b xen/drivers/passthrough/vtd/intremap.c
--- a/xen/drivers/passthrough/vtd/intremap.c	Fri Nov 02 16:15:53 2012 +0100
+++ b/xen/drivers/passthrough/vtd/intremap.c	Fri Nov 02 17:15:30 2012 +0100
@@ -149,8 +149,7 @@ int iommu_supports_eim(void)
     struct acpi_drhd_unit *drhd;
     int apic;
 
-    if ( !iommu_enabled || !iommu_qinval || !iommu_intremap ||
-         list_empty(&acpi_drhd_units) )
+    if ( !iommu_qinval || !iommu_intremap || list_empty(&acpi_drhd_units) )
         return 0;
 
     /* We MUST have a DRHD unit for each IOAPIC. */
diff -r cacdc787d11f -r bd78e5630a5b xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Fri Nov 02 16:15:53 2012 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Fri Nov 02 17:15:30 2012 +0100
@@ -2086,7 +2086,10 @@ int __init intel_vtd_setup(void)
     int ret;
 
     if ( list_empty(&acpi_drhd_units) )
-        return -ENODEV;
+    {
+        ret = -ENODEV;
+        goto error;
+    }
 
     platform_quirks_init();
 
diff -r cacdc787d11f -r bd78e5630a5b xen/include/xen/iommu.h
--- a/xen/include/xen/iommu.h	Fri Nov 02 16:15:53 2012 +0100
+++ b/xen/include/xen/iommu.h	Fri Nov 02 17:15:30 2012 +0100
@@ -26,7 +26,7 @@
 #include <public/hvm/ioreq.h>
 #include <public/domctl.h>
 
-extern bool_t iommu_enabled;
+extern bool_t iommu_enable, iommu_enabled;
 extern bool_t force_iommu, iommu_verbose;
 extern bool_t iommu_workaround_bios_bug, iommu_passthrough;
 extern bool_t iommu_snoop, iommu_qinval, iommu_intremap;

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

From xen-changelog-bounces@lists.xen.org Thu Nov 08 16:33:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Nov 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 1TWV2Y-00042k-DR; Thu, 08 Nov 2012 16:33:14 +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 1TWV2W-00042a-Bg
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 16:33:12 +0000
Received: from [85.158.137.99:21064] by server-8.bemta-3.messagelabs.com id
	3A/C0-07786-7CEDB905; Thu, 08 Nov 2012 16:33:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-217.messagelabs.com!1352392389!13571452!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15862 invoked from network); 8 Nov 2012 16:33:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Nov 2012 16: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 1TWV2T-0003DR-E8
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 16:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TWV2S-0007LF-SM
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 16:33:08 +0000
Message-Id: <E1TWV2S-0007LF-SM@xenbits.xen.org>
Date: Thu, 08 Nov 2012 16:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/emul: only emulate possibly
	operand sizes for POPA
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352368352 -3600
# Node ID aa2074529eb0183257b6f5f29821b0cd6dfd991a
# Parent  bd78e5630a5be55d439eb235627d52ebe8214524
x86/emul: only emulate possibly operand sizes for POPA

This opcode neither supports 1-byte operands, nor does it support
8-byte ones (since the opcode is undefined in 64-bit mode). Simplify
the code accordingly.

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


diff -r bd78e5630a5b -r aa2074529eb0 xen/arch/x86/x86_emulate/x86_emulate.c
--- a/xen/arch/x86/x86_emulate/x86_emulate.c	Fri Nov 02 17:15:30 2012 +0100
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c	Thu Nov 08 10:52:32 2012 +0100
@@ -1996,13 +1996,10 @@ x86_emulate(
             if ( (rc = read_ulong(x86_seg_ss, sp_post_inc(op_bytes),
                                   &dst.val, op_bytes, ctxt, ops)) != 0 )
                 goto done;
-            switch ( op_bytes )
-            {
-            case 1: *(uint8_t  *)regs[i] = (uint8_t)dst.val; break;
-            case 2: *(uint16_t *)regs[i] = (uint16_t)dst.val; break;
-            case 4: *regs[i] = (uint32_t)dst.val; break; /* 64b: zero-ext */
-            case 8: *regs[i] = dst.val; break;
-            }
+            if ( op_bytes == 2 )
+                *(uint16_t *)regs[i] = (uint16_t)dst.val;
+            else
+                *regs[i] = dst.val; /* 64b: zero-ext done by read_ulong() */
         }
         break;
     }

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

From xen-changelog-bounces@lists.xen.org Thu Nov 08 16:33:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Nov 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 1TWV2Y-00042k-DR; Thu, 08 Nov 2012 16:33:14 +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 1TWV2W-00042a-Bg
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 16:33:12 +0000
Received: from [85.158.137.99:21064] by server-8.bemta-3.messagelabs.com id
	3A/C0-07786-7CEDB905; Thu, 08 Nov 2012 16:33:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-217.messagelabs.com!1352392389!13571452!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15862 invoked from network); 8 Nov 2012 16:33:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Nov 2012 16: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 1TWV2T-0003DR-E8
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 16:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TWV2S-0007LF-SM
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 16:33:08 +0000
Message-Id: <E1TWV2S-0007LF-SM@xenbits.xen.org>
Date: Thu, 08 Nov 2012 16:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/emul: only emulate possibly
	operand sizes for POPA
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352368352 -3600
# Node ID aa2074529eb0183257b6f5f29821b0cd6dfd991a
# Parent  bd78e5630a5be55d439eb235627d52ebe8214524
x86/emul: only emulate possibly operand sizes for POPA

This opcode neither supports 1-byte operands, nor does it support
8-byte ones (since the opcode is undefined in 64-bit mode). Simplify
the code accordingly.

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


diff -r bd78e5630a5b -r aa2074529eb0 xen/arch/x86/x86_emulate/x86_emulate.c
--- a/xen/arch/x86/x86_emulate/x86_emulate.c	Fri Nov 02 17:15:30 2012 +0100
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c	Thu Nov 08 10:52:32 2012 +0100
@@ -1996,13 +1996,10 @@ x86_emulate(
             if ( (rc = read_ulong(x86_seg_ss, sp_post_inc(op_bytes),
                                   &dst.val, op_bytes, ctxt, ops)) != 0 )
                 goto done;
-            switch ( op_bytes )
-            {
-            case 1: *(uint8_t  *)regs[i] = (uint8_t)dst.val; break;
-            case 2: *(uint16_t *)regs[i] = (uint16_t)dst.val; break;
-            case 4: *regs[i] = (uint32_t)dst.val; break; /* 64b: zero-ext */
-            case 8: *regs[i] = dst.val; break;
-            }
+            if ( op_bytes == 2 )
+                *(uint16_t *)regs[i] = (uint16_t)dst.val;
+            else
+                *regs[i] = dst.val; /* 64b: zero-ext done by read_ulong() */
         }
         break;
     }

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

From xen-changelog-bounces@lists.xen.org Thu Nov 08 16:33:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Nov 2012 16: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.xen.org>)
	id 1TWV2Z-00042p-Fo; Thu, 08 Nov 2012 16:33:15 +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 1TWV2X-00042f-M4
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 16:33:14 +0000
Received: from [193.109.254.147:20104] by server-13.bemta-14.messagelabs.com
	id A2/9E-11239-9CEDB905; Thu, 08 Nov 2012 16:33:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1352392390!3226987!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19565 invoked from network); 8 Nov 2012 16:33:11 -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;
	8 Nov 2012 16: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 1TWV2T-0003DU-VF
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 16:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TWV2T-0007LU-FM
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 16:33:09 +0000
Message-Id: <E1TWV2T-0007LU-FM@xenbits.xen.org>
Date: Thu, 08 Nov 2012 16:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/ACPI: invalidate BGRT if
	necessary
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352368421 -3600
# Node ID 92163b114076029842d0f2d1dbfaa445976c71a3
# Parent  aa2074529eb0183257b6f5f29821b0cd6dfd991a
x86/ACPI: invalidate BGRT if necessary

Since the image pointed to may live in boot services memory (which we
add to the global memory pool long before ACPI tables get looked at),
we should prevent Dom0 from trying to retrieve the image data in that
case.

The alternatives would be to
- not add boot services memory to the global pool at all, or
- defer adding boot services memory until Dom0 indicates it is safe to
  do so, or
- find and parse the BGRT table in xen/arch/x86/efi/boot.c, and avoid
  adding that specific region to the E820 table.
None of these are really attractive, and as Xen commonly prints to the
video console anyway (without trying to avoid any regions on the
screen), the invalidation would need to be done conditionally anyway.

(xen/include/acpi/actbl3.h is a verbatim copy from Linux 3.7-rc4)

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


diff -r aa2074529eb0 -r 92163b114076 xen/arch/x86/acpi/boot.c
--- a/xen/arch/x86/acpi/boot.c	Thu Nov 08 10:52:32 2012 +0100
+++ b/xen/arch/x86/acpi/boot.c	Thu Nov 08 10:53:41 2012 +0100
@@ -28,6 +28,7 @@
 #include <xen/init.h>
 #include <xen/acpi.h>
 #include <xen/irq.h>
+#include <xen/mm.h>
 #include <xen/dmi.h>
 #include <asm/fixmap.h>
 #include <asm/page.h>
@@ -286,6 +287,27 @@ static int __init acpi_parse_hpet(struct
 #define	acpi_parse_hpet	NULL
 #endif
 
+static int __init acpi_invalidate_bgrt(struct acpi_table_header *table)
+{
+	struct acpi_table_bgrt *bgrt_tbl =
+		container_of(table, struct acpi_table_bgrt, header);
+
+	if (table->length < sizeof(*bgrt_tbl))
+		return -1;
+
+	if (bgrt_tbl->version == 1 && bgrt_tbl->image_address
+	    && !page_is_ram_type(PFN_DOWN(bgrt_tbl->image_address),
+				 RAM_TYPE_CONVENTIONAL))
+		return 0;
+
+	printk(KERN_INFO PREFIX "BGRT: invalidating v%d image at %#"PRIx64"\n",
+	       bgrt_tbl->version, bgrt_tbl->image_address);
+	bgrt_tbl->image_address = 0;
+	bgrt_tbl->status &= ~1;
+
+	return 0;
+}
+
 #ifdef CONFIG_ACPI_SLEEP
 #define acpi_fadt_copy_address(dst, src, len) do {			\
 	if (fadt->header.revision >= FADT2_REVISION_ID)			\
@@ -653,5 +675,7 @@ int __init acpi_boot_init(void)
 
 	erst_init();
 
+	acpi_table_parse(ACPI_SIG_BGRT, acpi_invalidate_bgrt);
+
 	return 0;
 }
diff -r aa2074529eb0 -r 92163b114076 xen/include/acpi/actbl.h
--- a/xen/include/acpi/actbl.h	Thu Nov 08 10:52:32 2012 +0100
+++ b/xen/include/acpi/actbl.h	Thu Nov 08 10:53:41 2012 +0100
@@ -314,6 +314,7 @@ enum acpi_prefered_pm_profiles {
 
 #include <acpi/actbl1.h>
 #include <acpi/actbl2.h>
+#include <acpi/actbl3.h>
 
 /*
  * Sizes of the various flavors of FADT. We need to look closely
diff -r aa2074529eb0 -r 92163b114076 xen/include/acpi/actbl3.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/acpi/actbl3.h	Thu Nov 08 10:53:41 2012 +0100
@@ -0,0 +1,557 @@
+/******************************************************************************
+ *
+ * Name: actbl3.h - ACPI Table Definitions
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2012, Intel Corp.
+ * 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,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * 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 MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+ */
+
+#ifndef __ACTBL3_H__
+#define __ACTBL3_H__
+
+/*******************************************************************************
+ *
+ * Additional ACPI Tables (3)
+ *
+ * These tables are not consumed directly by the ACPICA subsystem, but are
+ * included here to support device drivers and the AML disassembler.
+ *
+ * The tables in this file are fully defined within the ACPI specification.
+ *
+ ******************************************************************************/
+
+/*
+ * Values for description table header signatures for tables defined in this
+ * file. Useful because they make it more difficult to inadvertently type in
+ * the wrong signature.
+ */
+#define ACPI_SIG_BGRT           "BGRT"	/* Boot Graphics Resource Table */
+#define ACPI_SIG_DRTM           "DRTM"	/* Dynamic Root of Trust for Measurement table */
+#define ACPI_SIG_FPDT           "FPDT"	/* Firmware Performance Data Table */
+#define ACPI_SIG_GTDT           "GTDT"	/* Generic Timer Description Table */
+#define ACPI_SIG_MPST           "MPST"	/* Memory Power State Table */
+#define ACPI_SIG_PCCT           "PCCT"	/* Platform Communications Channel Table */
+#define ACPI_SIG_PMTT           "PMTT"	/* Platform Memory Topology Table */
+#define ACPI_SIG_RASF           "RASF"	/* RAS Feature table */
+
+#define ACPI_SIG_S3PT           "S3PT"	/* S3 Performance (sub)Table */
+#define ACPI_SIG_PCCS           "PCC"	/* PCC Shared Memory Region */
+
+/* Reserved table signatures */
+
+#define ACPI_SIG_CSRT           "CSRT"	/* Core System Resources Table */
+#define ACPI_SIG_MATR           "MATR"	/* Memory Address Translation Table */
+#define ACPI_SIG_MSDM           "MSDM"	/* Microsoft Data Management Table */
+#define ACPI_SIG_WPBT           "WPBT"	/* Windows Platform Binary Table */
+
+/*
+ * All tables must be byte-packed to match the ACPI specification, since
+ * the tables are provided by the system BIOS.
+ */
+#pragma pack(1)
+
+/*
+ * Note: C bitfields are not used for this reason:
+ *
+ * "Bitfields are great and easy to read, but unfortunately the C language
+ * does not specify the layout of bitfields in memory, which means they are
+ * essentially useless for dealing with packed data in on-disk formats or
+ * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
+ * this decision was a design error in C. Ritchie could have picked an order
+ * and stuck with it." Norman Ramsey.
+ * See http://stackoverflow.com/a/1053662/41661
+ */
+
+/*******************************************************************************
+ *
+ * BGRT - Boot Graphics Resource Table (ACPI 5.0)
+ *        Version 1
+ *
+ ******************************************************************************/
+
+struct acpi_table_bgrt {
+	struct acpi_table_header header;	/* Common ACPI table header */
+	u16 version;
+	u8 status;
+	u8 image_type;
+	u64 image_address;
+	u32 image_offset_x;
+	u32 image_offset_y;
+};
+
+/*******************************************************************************
+ *
+ * DRTM - Dynamic Root of Trust for Measurement table
+ *
+ ******************************************************************************/
+
+struct acpi_table_drtm {
+	struct acpi_table_header header;	/* Common ACPI table header */
+	u64 entry_base_address;
+	u64 entry_length;
+	u32 entry_address32;
+	u64 entry_address64;
+	u64 exit_address;
+	u64 log_area_address;
+	u32 log_area_length;
+	u64 arch_dependent_address;
+	u32 flags;
+};
+
+/* 1) Validated Tables List */
+
+struct acpi_drtm_vtl_list {
+	u32 validated_table_list_count;
+};
+
+/* 2) Resources List */
+
+struct acpi_drtm_resource_list {
+	u32 resource_list_count;
+};
+
+/* 3) Platform-specific Identifiers List */
+
+struct acpi_drtm_id_list {
+	u32 id_list_count;
+};
+
+/*******************************************************************************
+ *
+ * FPDT - Firmware Performance Data Table (ACPI 5.0)
+ *        Version 1
+ *
+ ******************************************************************************/
+
+struct acpi_table_fpdt {
+	struct acpi_table_header header;	/* Common ACPI table header */
+};
+
+/* FPDT subtable header */
+
+struct acpi_fpdt_header {
+	u16 type;
+	u8 length;
+	u8 revision;
+};
+
+/* Values for Type field above */
+
+enum acpi_fpdt_type {
+	ACPI_FPDT_TYPE_BOOT = 0,
+	ACPI_FPDT_TYPE_S3PERF = 1,
+};
+
+/*
+ * FPDT subtables
+ */
+
+/* 0: Firmware Basic Boot Performance Record */
+
+struct acpi_fpdt_boot {
+	struct acpi_fpdt_header header;
+	u8 reserved[4];
+	u64 reset_end;
+	u64 load_start;
+	u64 startup_start;
+	u64 exit_services_entry;
+	u64 exit_services_exit;
+};
+
+/* 1: S3 Performance Table Pointer Record */
+
+struct acpi_fpdt_s3pt_ptr {
+	struct acpi_fpdt_header header;
+	u8 reserved[4];
+	u64 address;
+};
+
+/*
+ * S3PT - S3 Performance Table. This table is pointed to by the
+ * FPDT S3 Pointer Record above.
+ */
+struct acpi_table_s3pt {
+	u8 signature[4];	/* "S3PT" */
+	u32 length;
+};
+
+/*
+ * S3PT Subtables
+ */
+struct acpi_s3pt_header {
+	u16 type;
+	u8 length;
+	u8 revision;
+};
+
+/* Values for Type field above */
+
+enum acpi_s3pt_type {
+	ACPI_S3PT_TYPE_RESUME = 0,
+	ACPI_S3PT_TYPE_SUSPEND = 1,
+};
+
+struct acpi_s3pt_resume {
+	struct acpi_s3pt_header header;
+	u32 resume_count;
+	u64 full_resume;
+	u64 average_resume;
+};
+
+struct acpi_s3pt_suspend {
+	struct acpi_s3pt_header header;
+	u64 suspend_start;
+	u64 suspend_end;
+};
+
+/*******************************************************************************
+ *
+ * GTDT - Generic Timer Description Table (ACPI 5.0)
+ *        Version 1
+ *
+ ******************************************************************************/
+
+struct acpi_table_gtdt {
+	struct acpi_table_header header;	/* Common ACPI table header */
+	u64 address;
+	u32 flags;
+	u32 secure_pl1_interrupt;
+	u32 secure_pl1_flags;
+	u32 non_secure_pl1_interrupt;
+	u32 non_secure_pl1_flags;
+	u32 virtual_timer_interrupt;
+	u32 virtual_timer_flags;
+	u32 non_secure_pl2_interrupt;
+	u32 non_secure_pl2_flags;
+};
+
+/* Values for Flags field above */
+
+#define ACPI_GTDT_MAPPED_BLOCK_PRESENT      1
+
+/* Values for all "TimerFlags" fields above */
+
+#define ACPI_GTDT_INTERRUPT_MODE            1
+#define ACPI_GTDT_INTERRUPT_POLARITY        2
+
+/*******************************************************************************
+ *
+ * MPST - Memory Power State Table (ACPI 5.0)
+ *        Version 1
+ *
+ ******************************************************************************/
+
+#define ACPI_MPST_CHANNEL_INFO \
+	u16                             reserved1; \
+	u8                              channel_id; \
+	u8                              reserved2; \
+	u16                             power_node_count;
+
+/* Main table */
+
+struct acpi_table_mpst {
+	struct acpi_table_header header;	/* Common ACPI table header */
+	 ACPI_MPST_CHANNEL_INFO	/* Platform Communication Channel */
+};
+
+/* Memory Platform Communication Channel Info */
+
+struct acpi_mpst_channel {
+	ACPI_MPST_CHANNEL_INFO	/* Platform Communication Channel */
+};
+
+/* Memory Power Node Structure */
+
+struct acpi_mpst_power_node {
+	u8 flags;
+	u8 reserved1;
+	u16 node_id;
+	u32 length;
+	u64 range_address;
+	u64 range_length;
+	u8 num_power_states;
+	u8 num_physical_components;
+	u16 reserved2;
+};
+
+/* Values for Flags field above */
+
+#define ACPI_MPST_ENABLED               1
+#define ACPI_MPST_POWER_MANAGED         2
+#define ACPI_MPST_HOT_PLUG_CAPABLE      4
+
+/* Memory Power State Structure (follows POWER_NODE above) */
+
+struct acpi_mpst_power_state {
+	u8 power_state;
+	u8 info_index;
+};
+
+/* Physical Component ID Structure (follows POWER_STATE above) */
+
+struct acpi_mpst_component {
+	u16 component_id;
+};
+
+/* Memory Power State Characteristics Structure (follows all POWER_NODEs) */
+
+struct acpi_mpst_data_hdr {
+	u16 characteristics_count;
+};
+
+struct acpi_mpst_power_data {
+	u8 revision;
+	u8 flags;
+	u16 reserved1;
+	u32 average_power;
+	u32 power_saving;
+	u64 exit_latency;
+	u64 reserved2;
+};
+
+/* Values for Flags field above */
+
+#define ACPI_MPST_PRESERVE              1
+#define ACPI_MPST_AUTOENTRY             2
+#define ACPI_MPST_AUTOEXIT              4
+
+/* Shared Memory Region (not part of an ACPI table) */
+
+struct acpi_mpst_shared {
+	u32 signature;
+	u16 pcc_command;
+	u16 pcc_status;
+	u16 command_register;
+	u16 status_register;
+	u16 power_state_id;
+	u16 power_node_id;
+	u64 energy_consumed;
+	u64 average_power;
+};
+
+/*******************************************************************************
+ *
+ * PCCT - Platform Communications Channel Table (ACPI 5.0)
+ *        Version 1
+ *
+ ******************************************************************************/
+
+struct acpi_table_pcct {
+	struct acpi_table_header header;	/* Common ACPI table header */
+	u32 flags;
+	u32 latency;
+	u32 reserved;
+};
+
+/* Values for Flags field above */
+
+#define ACPI_PCCT_DOORBELL              1
+
+/*
+ * PCCT subtables
+ */
+
+/* 0: Generic Communications Subspace */
+
+struct acpi_pcct_subspace {
+	struct acpi_subtable_header header;
+	u8 reserved[6];
+	u64 base_address;
+	u64 length;
+	struct acpi_generic_address doorbell_register;
+	u64 preserve_mask;
+	u64 write_mask;
+};
+
+/*
+ * PCC memory structures (not part of the ACPI table)
+ */
+
+/* Shared Memory Region */
+
+struct acpi_pcct_shared_memory {
+	u32 signature;
+	u16 command;
+	u16 status;
+};
+
+/*******************************************************************************
+ *
+ * PMTT - Platform Memory Topology Table (ACPI 5.0)
+ *        Version 1
+ *
+ ******************************************************************************/
+
+struct acpi_table_pmtt {
+	struct acpi_table_header header;	/* Common ACPI table header */
+	u32 reserved;
+};
+
+/* Common header for PMTT subtables that follow main table */
+
+struct acpi_pmtt_header {
+	u8 type;
+	u8 reserved1;
+	u16 length;
+	u16 flags;
+	u16 reserved2;
+};
+
+/* Values for Type field above */
+
+#define ACPI_PMTT_TYPE_SOCKET           0
+#define ACPI_PMTT_TYPE_CONTROLLER       1
+#define ACPI_PMTT_TYPE_DIMM             2
+#define ACPI_PMTT_TYPE_RESERVED         3	/* 0x03-0xFF are reserved */
+
+/* Values for Flags field above */
+
+#define ACPI_PMTT_TOP_LEVEL             0x0001
+#define ACPI_PMTT_PHYSICAL              0x0002
+#define ACPI_PMTT_MEMORY_TYPE           0x000C
+
+/*
+ * PMTT subtables, correspond to Type in struct acpi_pmtt_header
+ */
+
+/* 0: Socket Structure */
+
+struct acpi_pmtt_socket {
+	struct acpi_pmtt_header header;
+	u16 socket_id;
+	u16 reserved;
+};
+
+/* 1: Memory Controller subtable */
+
+struct acpi_pmtt_controller {
+	struct acpi_pmtt_header header;
+	u32 read_latency;
+	u32 write_latency;
+	u32 read_bandwidth;
+	u32 write_bandwidth;
+	u16 access_width;
+	u16 alignment;
+	u16 reserved;
+	u16 domain_count;
+};
+
+/* 1a: Proximity Domain substructure */
+
+struct acpi_pmtt_domain {
+	u32 proximity_domain;
+};
+
+/* 2: Physical Component Identifier (DIMM) */
+
+struct acpi_pmtt_physical_component {
+	struct acpi_pmtt_header header;
+	u16 component_id;
+	u16 reserved;
+	u32 memory_size;
+	u32 bios_handle;
+};
+
+/*******************************************************************************
+ *
+ * RASF - RAS Feature Table (ACPI 5.0)
+ *        Version 1
+ *
+ ******************************************************************************/
+
+struct acpi_table_rasf {
+	struct acpi_table_header header;	/* Common ACPI table header */
+	u8 channel_id[12];
+};
+
+/* RASF Platform Communication Channel Shared Memory Region */
+
+struct acpi_rasf_shared_memory {
+	u32 signature;
+	u16 command;
+	u16 status;
+	u64 requested_address;
+	u64 requested_length;
+	u64 actual_address;
+	u64 actual_length;
+	u16 flags;
+	u8 speed;
+};
+
+/* Masks for Flags and Speed fields above */
+
+#define ACPI_RASF_SCRUBBER_RUNNING      1
+#define ACPI_RASF_SPEED                 (7<<1)
+
+/* Channel Commands */
+
+enum acpi_rasf_commands {
+	ACPI_RASF_GET_RAS_CAPABILITIES = 1,
+	ACPI_RASF_GET_PATROL_PARAMETERS = 2,
+	ACPI_RASF_START_PATROL_SCRUBBER = 3,
+	ACPI_RASF_STOP_PATROL_SCRUBBER = 4
+};
+
+/* Channel Command flags */
+
+#define ACPI_RASF_GENERATE_SCI          (1<<15)
+
+/* Status values */
+
+enum acpi_rasf_status {
+	ACPI_RASF_SUCCESS = 0,
+	ACPI_RASF_NOT_VALID = 1,
+	ACPI_RASF_NOT_SUPPORTED = 2,
+	ACPI_RASF_BUSY = 3,
+	ACPI_RASF_FAILED = 4,
+	ACPI_RASF_ABORTED = 5,
+	ACPI_RASF_INVALID_DATA = 6
+};
+
+/* Status flags */
+
+#define ACPI_RASF_COMMAND_COMPLETE      (1)
+#define ACPI_RASF_SCI_DOORBELL          (1<<1)
+#define ACPI_RASF_ERROR                 (1<<2)
+#define ACPI_RASF_STATUS                (0x1F<<3)
+
+/* Reset to default packing */
+
+#pragma pack()
+
+#endif				/* __ACTBL3_H__ */

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

From xen-changelog-bounces@lists.xen.org Thu Nov 08 16:33:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Nov 2012 16: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.xen.org>)
	id 1TWV2Z-00042p-Fo; Thu, 08 Nov 2012 16:33:15 +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 1TWV2X-00042f-M4
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 16:33:14 +0000
Received: from [193.109.254.147:20104] by server-13.bemta-14.messagelabs.com
	id A2/9E-11239-9CEDB905; Thu, 08 Nov 2012 16:33:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1352392390!3226987!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19565 invoked from network); 8 Nov 2012 16:33:11 -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;
	8 Nov 2012 16: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 1TWV2T-0003DU-VF
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 16:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TWV2T-0007LU-FM
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 16:33:09 +0000
Message-Id: <E1TWV2T-0007LU-FM@xenbits.xen.org>
Date: Thu, 08 Nov 2012 16:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/ACPI: invalidate BGRT if
	necessary
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352368421 -3600
# Node ID 92163b114076029842d0f2d1dbfaa445976c71a3
# Parent  aa2074529eb0183257b6f5f29821b0cd6dfd991a
x86/ACPI: invalidate BGRT if necessary

Since the image pointed to may live in boot services memory (which we
add to the global memory pool long before ACPI tables get looked at),
we should prevent Dom0 from trying to retrieve the image data in that
case.

The alternatives would be to
- not add boot services memory to the global pool at all, or
- defer adding boot services memory until Dom0 indicates it is safe to
  do so, or
- find and parse the BGRT table in xen/arch/x86/efi/boot.c, and avoid
  adding that specific region to the E820 table.
None of these are really attractive, and as Xen commonly prints to the
video console anyway (without trying to avoid any regions on the
screen), the invalidation would need to be done conditionally anyway.

(xen/include/acpi/actbl3.h is a verbatim copy from Linux 3.7-rc4)

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


diff -r aa2074529eb0 -r 92163b114076 xen/arch/x86/acpi/boot.c
--- a/xen/arch/x86/acpi/boot.c	Thu Nov 08 10:52:32 2012 +0100
+++ b/xen/arch/x86/acpi/boot.c	Thu Nov 08 10:53:41 2012 +0100
@@ -28,6 +28,7 @@
 #include <xen/init.h>
 #include <xen/acpi.h>
 #include <xen/irq.h>
+#include <xen/mm.h>
 #include <xen/dmi.h>
 #include <asm/fixmap.h>
 #include <asm/page.h>
@@ -286,6 +287,27 @@ static int __init acpi_parse_hpet(struct
 #define	acpi_parse_hpet	NULL
 #endif
 
+static int __init acpi_invalidate_bgrt(struct acpi_table_header *table)
+{
+	struct acpi_table_bgrt *bgrt_tbl =
+		container_of(table, struct acpi_table_bgrt, header);
+
+	if (table->length < sizeof(*bgrt_tbl))
+		return -1;
+
+	if (bgrt_tbl->version == 1 && bgrt_tbl->image_address
+	    && !page_is_ram_type(PFN_DOWN(bgrt_tbl->image_address),
+				 RAM_TYPE_CONVENTIONAL))
+		return 0;
+
+	printk(KERN_INFO PREFIX "BGRT: invalidating v%d image at %#"PRIx64"\n",
+	       bgrt_tbl->version, bgrt_tbl->image_address);
+	bgrt_tbl->image_address = 0;
+	bgrt_tbl->status &= ~1;
+
+	return 0;
+}
+
 #ifdef CONFIG_ACPI_SLEEP
 #define acpi_fadt_copy_address(dst, src, len) do {			\
 	if (fadt->header.revision >= FADT2_REVISION_ID)			\
@@ -653,5 +675,7 @@ int __init acpi_boot_init(void)
 
 	erst_init();
 
+	acpi_table_parse(ACPI_SIG_BGRT, acpi_invalidate_bgrt);
+
 	return 0;
 }
diff -r aa2074529eb0 -r 92163b114076 xen/include/acpi/actbl.h
--- a/xen/include/acpi/actbl.h	Thu Nov 08 10:52:32 2012 +0100
+++ b/xen/include/acpi/actbl.h	Thu Nov 08 10:53:41 2012 +0100
@@ -314,6 +314,7 @@ enum acpi_prefered_pm_profiles {
 
 #include <acpi/actbl1.h>
 #include <acpi/actbl2.h>
+#include <acpi/actbl3.h>
 
 /*
  * Sizes of the various flavors of FADT. We need to look closely
diff -r aa2074529eb0 -r 92163b114076 xen/include/acpi/actbl3.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/acpi/actbl3.h	Thu Nov 08 10:53:41 2012 +0100
@@ -0,0 +1,557 @@
+/******************************************************************************
+ *
+ * Name: actbl3.h - ACPI Table Definitions
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2012, Intel Corp.
+ * 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,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * 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 MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+ */
+
+#ifndef __ACTBL3_H__
+#define __ACTBL3_H__
+
+/*******************************************************************************
+ *
+ * Additional ACPI Tables (3)
+ *
+ * These tables are not consumed directly by the ACPICA subsystem, but are
+ * included here to support device drivers and the AML disassembler.
+ *
+ * The tables in this file are fully defined within the ACPI specification.
+ *
+ ******************************************************************************/
+
+/*
+ * Values for description table header signatures for tables defined in this
+ * file. Useful because they make it more difficult to inadvertently type in
+ * the wrong signature.
+ */
+#define ACPI_SIG_BGRT           "BGRT"	/* Boot Graphics Resource Table */
+#define ACPI_SIG_DRTM           "DRTM"	/* Dynamic Root of Trust for Measurement table */
+#define ACPI_SIG_FPDT           "FPDT"	/* Firmware Performance Data Table */
+#define ACPI_SIG_GTDT           "GTDT"	/* Generic Timer Description Table */
+#define ACPI_SIG_MPST           "MPST"	/* Memory Power State Table */
+#define ACPI_SIG_PCCT           "PCCT"	/* Platform Communications Channel Table */
+#define ACPI_SIG_PMTT           "PMTT"	/* Platform Memory Topology Table */
+#define ACPI_SIG_RASF           "RASF"	/* RAS Feature table */
+
+#define ACPI_SIG_S3PT           "S3PT"	/* S3 Performance (sub)Table */
+#define ACPI_SIG_PCCS           "PCC"	/* PCC Shared Memory Region */
+
+/* Reserved table signatures */
+
+#define ACPI_SIG_CSRT           "CSRT"	/* Core System Resources Table */
+#define ACPI_SIG_MATR           "MATR"	/* Memory Address Translation Table */
+#define ACPI_SIG_MSDM           "MSDM"	/* Microsoft Data Management Table */
+#define ACPI_SIG_WPBT           "WPBT"	/* Windows Platform Binary Table */
+
+/*
+ * All tables must be byte-packed to match the ACPI specification, since
+ * the tables are provided by the system BIOS.
+ */
+#pragma pack(1)
+
+/*
+ * Note: C bitfields are not used for this reason:
+ *
+ * "Bitfields are great and easy to read, but unfortunately the C language
+ * does not specify the layout of bitfields in memory, which means they are
+ * essentially useless for dealing with packed data in on-disk formats or
+ * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
+ * this decision was a design error in C. Ritchie could have picked an order
+ * and stuck with it." Norman Ramsey.
+ * See http://stackoverflow.com/a/1053662/41661
+ */
+
+/*******************************************************************************
+ *
+ * BGRT - Boot Graphics Resource Table (ACPI 5.0)
+ *        Version 1
+ *
+ ******************************************************************************/
+
+struct acpi_table_bgrt {
+	struct acpi_table_header header;	/* Common ACPI table header */
+	u16 version;
+	u8 status;
+	u8 image_type;
+	u64 image_address;
+	u32 image_offset_x;
+	u32 image_offset_y;
+};
+
+/*******************************************************************************
+ *
+ * DRTM - Dynamic Root of Trust for Measurement table
+ *
+ ******************************************************************************/
+
+struct acpi_table_drtm {
+	struct acpi_table_header header;	/* Common ACPI table header */
+	u64 entry_base_address;
+	u64 entry_length;
+	u32 entry_address32;
+	u64 entry_address64;
+	u64 exit_address;
+	u64 log_area_address;
+	u32 log_area_length;
+	u64 arch_dependent_address;
+	u32 flags;
+};
+
+/* 1) Validated Tables List */
+
+struct acpi_drtm_vtl_list {
+	u32 validated_table_list_count;
+};
+
+/* 2) Resources List */
+
+struct acpi_drtm_resource_list {
+	u32 resource_list_count;
+};
+
+/* 3) Platform-specific Identifiers List */
+
+struct acpi_drtm_id_list {
+	u32 id_list_count;
+};
+
+/*******************************************************************************
+ *
+ * FPDT - Firmware Performance Data Table (ACPI 5.0)
+ *        Version 1
+ *
+ ******************************************************************************/
+
+struct acpi_table_fpdt {
+	struct acpi_table_header header;	/* Common ACPI table header */
+};
+
+/* FPDT subtable header */
+
+struct acpi_fpdt_header {
+	u16 type;
+	u8 length;
+	u8 revision;
+};
+
+/* Values for Type field above */
+
+enum acpi_fpdt_type {
+	ACPI_FPDT_TYPE_BOOT = 0,
+	ACPI_FPDT_TYPE_S3PERF = 1,
+};
+
+/*
+ * FPDT subtables
+ */
+
+/* 0: Firmware Basic Boot Performance Record */
+
+struct acpi_fpdt_boot {
+	struct acpi_fpdt_header header;
+	u8 reserved[4];
+	u64 reset_end;
+	u64 load_start;
+	u64 startup_start;
+	u64 exit_services_entry;
+	u64 exit_services_exit;
+};
+
+/* 1: S3 Performance Table Pointer Record */
+
+struct acpi_fpdt_s3pt_ptr {
+	struct acpi_fpdt_header header;
+	u8 reserved[4];
+	u64 address;
+};
+
+/*
+ * S3PT - S3 Performance Table. This table is pointed to by the
+ * FPDT S3 Pointer Record above.
+ */
+struct acpi_table_s3pt {
+	u8 signature[4];	/* "S3PT" */
+	u32 length;
+};
+
+/*
+ * S3PT Subtables
+ */
+struct acpi_s3pt_header {
+	u16 type;
+	u8 length;
+	u8 revision;
+};
+
+/* Values for Type field above */
+
+enum acpi_s3pt_type {
+	ACPI_S3PT_TYPE_RESUME = 0,
+	ACPI_S3PT_TYPE_SUSPEND = 1,
+};
+
+struct acpi_s3pt_resume {
+	struct acpi_s3pt_header header;
+	u32 resume_count;
+	u64 full_resume;
+	u64 average_resume;
+};
+
+struct acpi_s3pt_suspend {
+	struct acpi_s3pt_header header;
+	u64 suspend_start;
+	u64 suspend_end;
+};
+
+/*******************************************************************************
+ *
+ * GTDT - Generic Timer Description Table (ACPI 5.0)
+ *        Version 1
+ *
+ ******************************************************************************/
+
+struct acpi_table_gtdt {
+	struct acpi_table_header header;	/* Common ACPI table header */
+	u64 address;
+	u32 flags;
+	u32 secure_pl1_interrupt;
+	u32 secure_pl1_flags;
+	u32 non_secure_pl1_interrupt;
+	u32 non_secure_pl1_flags;
+	u32 virtual_timer_interrupt;
+	u32 virtual_timer_flags;
+	u32 non_secure_pl2_interrupt;
+	u32 non_secure_pl2_flags;
+};
+
+/* Values for Flags field above */
+
+#define ACPI_GTDT_MAPPED_BLOCK_PRESENT      1
+
+/* Values for all "TimerFlags" fields above */
+
+#define ACPI_GTDT_INTERRUPT_MODE            1
+#define ACPI_GTDT_INTERRUPT_POLARITY        2
+
+/*******************************************************************************
+ *
+ * MPST - Memory Power State Table (ACPI 5.0)
+ *        Version 1
+ *
+ ******************************************************************************/
+
+#define ACPI_MPST_CHANNEL_INFO \
+	u16                             reserved1; \
+	u8                              channel_id; \
+	u8                              reserved2; \
+	u16                             power_node_count;
+
+/* Main table */
+
+struct acpi_table_mpst {
+	struct acpi_table_header header;	/* Common ACPI table header */
+	 ACPI_MPST_CHANNEL_INFO	/* Platform Communication Channel */
+};
+
+/* Memory Platform Communication Channel Info */
+
+struct acpi_mpst_channel {
+	ACPI_MPST_CHANNEL_INFO	/* Platform Communication Channel */
+};
+
+/* Memory Power Node Structure */
+
+struct acpi_mpst_power_node {
+	u8 flags;
+	u8 reserved1;
+	u16 node_id;
+	u32 length;
+	u64 range_address;
+	u64 range_length;
+	u8 num_power_states;
+	u8 num_physical_components;
+	u16 reserved2;
+};
+
+/* Values for Flags field above */
+
+#define ACPI_MPST_ENABLED               1
+#define ACPI_MPST_POWER_MANAGED         2
+#define ACPI_MPST_HOT_PLUG_CAPABLE      4
+
+/* Memory Power State Structure (follows POWER_NODE above) */
+
+struct acpi_mpst_power_state {
+	u8 power_state;
+	u8 info_index;
+};
+
+/* Physical Component ID Structure (follows POWER_STATE above) */
+
+struct acpi_mpst_component {
+	u16 component_id;
+};
+
+/* Memory Power State Characteristics Structure (follows all POWER_NODEs) */
+
+struct acpi_mpst_data_hdr {
+	u16 characteristics_count;
+};
+
+struct acpi_mpst_power_data {
+	u8 revision;
+	u8 flags;
+	u16 reserved1;
+	u32 average_power;
+	u32 power_saving;
+	u64 exit_latency;
+	u64 reserved2;
+};
+
+/* Values for Flags field above */
+
+#define ACPI_MPST_PRESERVE              1
+#define ACPI_MPST_AUTOENTRY             2
+#define ACPI_MPST_AUTOEXIT              4
+
+/* Shared Memory Region (not part of an ACPI table) */
+
+struct acpi_mpst_shared {
+	u32 signature;
+	u16 pcc_command;
+	u16 pcc_status;
+	u16 command_register;
+	u16 status_register;
+	u16 power_state_id;
+	u16 power_node_id;
+	u64 energy_consumed;
+	u64 average_power;
+};
+
+/*******************************************************************************
+ *
+ * PCCT - Platform Communications Channel Table (ACPI 5.0)
+ *        Version 1
+ *
+ ******************************************************************************/
+
+struct acpi_table_pcct {
+	struct acpi_table_header header;	/* Common ACPI table header */
+	u32 flags;
+	u32 latency;
+	u32 reserved;
+};
+
+/* Values for Flags field above */
+
+#define ACPI_PCCT_DOORBELL              1
+
+/*
+ * PCCT subtables
+ */
+
+/* 0: Generic Communications Subspace */
+
+struct acpi_pcct_subspace {
+	struct acpi_subtable_header header;
+	u8 reserved[6];
+	u64 base_address;
+	u64 length;
+	struct acpi_generic_address doorbell_register;
+	u64 preserve_mask;
+	u64 write_mask;
+};
+
+/*
+ * PCC memory structures (not part of the ACPI table)
+ */
+
+/* Shared Memory Region */
+
+struct acpi_pcct_shared_memory {
+	u32 signature;
+	u16 command;
+	u16 status;
+};
+
+/*******************************************************************************
+ *
+ * PMTT - Platform Memory Topology Table (ACPI 5.0)
+ *        Version 1
+ *
+ ******************************************************************************/
+
+struct acpi_table_pmtt {
+	struct acpi_table_header header;	/* Common ACPI table header */
+	u32 reserved;
+};
+
+/* Common header for PMTT subtables that follow main table */
+
+struct acpi_pmtt_header {
+	u8 type;
+	u8 reserved1;
+	u16 length;
+	u16 flags;
+	u16 reserved2;
+};
+
+/* Values for Type field above */
+
+#define ACPI_PMTT_TYPE_SOCKET           0
+#define ACPI_PMTT_TYPE_CONTROLLER       1
+#define ACPI_PMTT_TYPE_DIMM             2
+#define ACPI_PMTT_TYPE_RESERVED         3	/* 0x03-0xFF are reserved */
+
+/* Values for Flags field above */
+
+#define ACPI_PMTT_TOP_LEVEL             0x0001
+#define ACPI_PMTT_PHYSICAL              0x0002
+#define ACPI_PMTT_MEMORY_TYPE           0x000C
+
+/*
+ * PMTT subtables, correspond to Type in struct acpi_pmtt_header
+ */
+
+/* 0: Socket Structure */
+
+struct acpi_pmtt_socket {
+	struct acpi_pmtt_header header;
+	u16 socket_id;
+	u16 reserved;
+};
+
+/* 1: Memory Controller subtable */
+
+struct acpi_pmtt_controller {
+	struct acpi_pmtt_header header;
+	u32 read_latency;
+	u32 write_latency;
+	u32 read_bandwidth;
+	u32 write_bandwidth;
+	u16 access_width;
+	u16 alignment;
+	u16 reserved;
+	u16 domain_count;
+};
+
+/* 1a: Proximity Domain substructure */
+
+struct acpi_pmtt_domain {
+	u32 proximity_domain;
+};
+
+/* 2: Physical Component Identifier (DIMM) */
+
+struct acpi_pmtt_physical_component {
+	struct acpi_pmtt_header header;
+	u16 component_id;
+	u16 reserved;
+	u32 memory_size;
+	u32 bios_handle;
+};
+
+/*******************************************************************************
+ *
+ * RASF - RAS Feature Table (ACPI 5.0)
+ *        Version 1
+ *
+ ******************************************************************************/
+
+struct acpi_table_rasf {
+	struct acpi_table_header header;	/* Common ACPI table header */
+	u8 channel_id[12];
+};
+
+/* RASF Platform Communication Channel Shared Memory Region */
+
+struct acpi_rasf_shared_memory {
+	u32 signature;
+	u16 command;
+	u16 status;
+	u64 requested_address;
+	u64 requested_length;
+	u64 actual_address;
+	u64 actual_length;
+	u16 flags;
+	u8 speed;
+};
+
+/* Masks for Flags and Speed fields above */
+
+#define ACPI_RASF_SCRUBBER_RUNNING      1
+#define ACPI_RASF_SPEED                 (7<<1)
+
+/* Channel Commands */
+
+enum acpi_rasf_commands {
+	ACPI_RASF_GET_RAS_CAPABILITIES = 1,
+	ACPI_RASF_GET_PATROL_PARAMETERS = 2,
+	ACPI_RASF_START_PATROL_SCRUBBER = 3,
+	ACPI_RASF_STOP_PATROL_SCRUBBER = 4
+};
+
+/* Channel Command flags */
+
+#define ACPI_RASF_GENERATE_SCI          (1<<15)
+
+/* Status values */
+
+enum acpi_rasf_status {
+	ACPI_RASF_SUCCESS = 0,
+	ACPI_RASF_NOT_VALID = 1,
+	ACPI_RASF_NOT_SUPPORTED = 2,
+	ACPI_RASF_BUSY = 3,
+	ACPI_RASF_FAILED = 4,
+	ACPI_RASF_ABORTED = 5,
+	ACPI_RASF_INVALID_DATA = 6
+};
+
+/* Status flags */
+
+#define ACPI_RASF_COMMAND_COMPLETE      (1)
+#define ACPI_RASF_SCI_DOORBELL          (1<<1)
+#define ACPI_RASF_ERROR                 (1<<2)
+#define ACPI_RASF_STATUS                (0x1F<<3)
+
+/* Reset to default packing */
+
+#pragma pack()
+
+#endif				/* __ACTBL3_H__ */

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

From xen-changelog-bounces@lists.xen.org Thu Nov 08 21:44:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Nov 2012 21:44: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.xen.org>)
	id 1TWZtW-0008PS-E3; Thu, 08 Nov 2012 21:44:14 +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 1TWZtU-0008P8-N1
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 21:44:13 +0000
Received: from [85.158.137.99:51241] by server-15.bemta-3.messagelabs.com id
	5E/1C-09445-BA72C905; Thu, 08 Nov 2012 21:44:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-217.messagelabs.com!1352411049!18365684!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4467 invoked from network); 8 Nov 2012 21:44:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Nov 2012 21: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 1TWZtR-0006jG-Gd
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 21:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TWZtR-0006hd-4q
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 21:44:09 +0000
Message-Id: <E1TWZtR-0006hd-4q@xenbits.xen.org>
Date: Thu, 08 Nov 2012 21:44:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/x2apic: properly implement
	cluster mode
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352393899 -3600
# Node ID 62885b3c34c84354ead017703a86f0465cb58cf7
# Parent  f05a99beba73c30ea5d2439508699cf2fb50f0e5
x86/x2apic: properly implement cluster mode

So far, cluster mode was just an alternative implementation of
physical mode: Allowing only single CPU interrupt targets, and sending
IPIs to each target CPU separately. Take advantage of what cluster
mode really can do in that regard.

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


diff -r f05a99beba73 -r 62885b3c34c8 xen/arch/x86/genapic/x2apic.c
--- a/xen/arch/x86/genapic/x2apic.c	Thu Nov 08 17:56:12 2012 +0100
+++ b/xen/arch/x86/genapic/x2apic.c	Thu Nov 08 17:58:19 2012 +0100
@@ -19,6 +19,7 @@
 
 #include <xen/config.h>
 #include <xen/init.h>
+#include <xen/cpu.h>
 #include <xen/cpumask.h>
 #include <asm/apicdef.h>
 #include <asm/genapic.h>
@@ -33,6 +34,14 @@ static bool_t __initdata x2apic_phys; /*
 boolean_param("x2apic_phys", x2apic_phys);
 
 static DEFINE_PER_CPU_READ_MOSTLY(u32, cpu_2_logical_apicid);
+static DEFINE_PER_CPU_READ_MOSTLY(cpumask_t *, cluster_cpus);
+static cpumask_t *cluster_cpus_spare;
+static DEFINE_PER_CPU(cpumask_var_t, scratch_mask);
+
+static inline u32 x2apic_cluster(unsigned int cpu)
+{
+    return per_cpu(cpu_2_logical_apicid, cpu) >> 16;
+}
 
 static void init_apic_ldr_x2apic_phys(void)
 {
@@ -40,20 +49,53 @@ static void init_apic_ldr_x2apic_phys(vo
 
 static void init_apic_ldr_x2apic_cluster(void)
 {
-    this_cpu(cpu_2_logical_apicid) = apic_read(APIC_LDR);
+    unsigned int cpu, this_cpu = smp_processor_id();
+
+    per_cpu(cpu_2_logical_apicid, this_cpu) = apic_read(APIC_LDR);
+
+    if ( per_cpu(cluster_cpus, this_cpu) )
+    {
+        ASSERT(cpumask_test_cpu(this_cpu, per_cpu(cluster_cpus, this_cpu)));
+        return;
+    }
+
+    per_cpu(cluster_cpus, this_cpu) = cluster_cpus_spare;
+    for_each_online_cpu ( cpu )
+    {
+        if (this_cpu == cpu || x2apic_cluster(this_cpu) != x2apic_cluster(cpu))
+            continue;
+        per_cpu(cluster_cpus, this_cpu) = per_cpu(cluster_cpus, cpu);
+        break;
+    }
+    if ( per_cpu(cluster_cpus, this_cpu) == cluster_cpus_spare )
+        cluster_cpus_spare = NULL;
+
+    cpumask_set_cpu(this_cpu, per_cpu(cluster_cpus, this_cpu));
 }
 
 static void __init clustered_apic_check_x2apic(void)
 {
 }
 
+static const cpumask_t *vector_allocation_cpumask_x2apic_cluster(int cpu)
+{
+    return per_cpu(cluster_cpus, cpu);
+}
+
 static unsigned int cpu_mask_to_apicid_x2apic_cluster(const cpumask_t *cpumask)
 {
-    return per_cpu(cpu_2_logical_apicid, cpumask_first(cpumask));
+    unsigned int cpu = cpumask_first(cpumask);
+    unsigned int dest = per_cpu(cpu_2_logical_apicid, cpu);
+    const cpumask_t *cluster_cpus = per_cpu(cluster_cpus, cpu);
+
+    for_each_cpu ( cpu, cluster_cpus )
+        if ( cpumask_test_cpu(cpu, cpumask) )
+            dest |= per_cpu(cpu_2_logical_apicid, cpu);
+
+    return dest;
 }
 
-static void __send_IPI_mask_x2apic(
-    const cpumask_t *cpumask, int vector, unsigned int dest_mode)
+static void send_IPI_mask_x2apic_phys(const cpumask_t *cpumask, int vector)
 {
     unsigned int cpu;
     unsigned long flags;
@@ -77,23 +119,48 @@ static void __send_IPI_mask_x2apic(
     {
         if ( !cpu_online(cpu) || (cpu == smp_processor_id()) )
             continue;
-        msr_content = (dest_mode == APIC_DEST_PHYSICAL)
-            ? cpu_physical_id(cpu) : per_cpu(cpu_2_logical_apicid, cpu);
-        msr_content = (msr_content << 32) | APIC_DM_FIXED | dest_mode | vector;
+        msr_content = cpu_physical_id(cpu);
+        msr_content = (msr_content << 32) | APIC_DM_FIXED |
+                      APIC_DEST_PHYSICAL | vector;
         apic_wrmsr(APIC_ICR, msr_content);
     }
 
     local_irq_restore(flags);
 }
 
-static void send_IPI_mask_x2apic_phys(const cpumask_t *cpumask, int vector)
-{
-    __send_IPI_mask_x2apic(cpumask, vector, APIC_DEST_PHYSICAL);
-}
-
 static void send_IPI_mask_x2apic_cluster(const cpumask_t *cpumask, int vector)
 {
-    __send_IPI_mask_x2apic(cpumask, vector, APIC_DEST_LOGICAL);
+    unsigned int cpu = smp_processor_id();
+    cpumask_t *ipimask = per_cpu(scratch_mask, cpu);
+    const cpumask_t *cluster_cpus;
+    unsigned long flags;
+
+    mb(); /* See above for an explanation. */
+
+    local_irq_save(flags);
+
+    cpumask_andnot(ipimask, &cpu_online_map, cpumask_of(cpu));
+
+    for ( cpumask_and(ipimask, cpumask, ipimask); !cpumask_empty(ipimask);
+          cpumask_andnot(ipimask, ipimask, cluster_cpus) )
+    {
+        uint64_t msr_content = 0;
+
+        cluster_cpus = per_cpu(cluster_cpus, cpumask_first(ipimask));
+        for_each_cpu ( cpu, cluster_cpus )
+        {
+            if ( !cpumask_test_cpu(cpu, ipimask) )
+                continue;
+            msr_content |= per_cpu(cpu_2_logical_apicid, cpu);
+        }
+
+        BUG_ON(!msr_content);
+        msr_content = (msr_content << 32) | APIC_DM_FIXED |
+                      APIC_DEST_LOGICAL | vector;
+        apic_wrmsr(APIC_ICR, msr_content);
+    }
+
+    local_irq_restore(flags);
 }
 
 static const struct genapic apic_x2apic_phys = {
@@ -116,15 +183,60 @@ static const struct genapic apic_x2apic_
     .init_apic_ldr = init_apic_ldr_x2apic_cluster,
     .clustered_apic_check = clustered_apic_check_x2apic,
     .target_cpus = target_cpus_all,
-    .vector_allocation_cpumask = vector_allocation_cpumask_phys,
+    .vector_allocation_cpumask = vector_allocation_cpumask_x2apic_cluster,
     .cpu_mask_to_apicid = cpu_mask_to_apicid_x2apic_cluster,
     .send_IPI_mask = send_IPI_mask_x2apic_cluster,
     .send_IPI_self = send_IPI_self_x2apic
 };
 
+static int update_clusterinfo(
+    struct notifier_block *nfb, unsigned long action, void *hcpu)
+{
+    unsigned int cpu = (unsigned long)hcpu;
+    int err = 0;
+
+    switch (action) {
+    case CPU_UP_PREPARE:
+        per_cpu(cpu_2_logical_apicid, cpu) = BAD_APICID;
+        if ( !cluster_cpus_spare )
+            cluster_cpus_spare = xzalloc(cpumask_t);
+        if ( !cluster_cpus_spare ||
+             !alloc_cpumask_var(&per_cpu(scratch_mask, cpu)) )
+            err = -ENOMEM;
+        break;
+    case CPU_UP_CANCELED:
+    case CPU_DEAD:
+        if ( per_cpu(cluster_cpus, cpu) )
+        {
+            cpumask_clear_cpu(cpu, per_cpu(cluster_cpus, cpu));
+            if ( cpumask_empty(per_cpu(cluster_cpus, cpu)) )
+                xfree(per_cpu(cluster_cpus, cpu));
+        }
+        free_cpumask_var(per_cpu(scratch_mask, cpu));
+        break;
+    }
+
+    return !err ? NOTIFY_DONE : notifier_from_errno(err);
+}
+
+static struct notifier_block x2apic_cpu_nfb = {
+   .notifier_call = update_clusterinfo
+};
+
 const struct genapic *__init apic_x2apic_probe(void)
 {
-    return x2apic_phys ? &apic_x2apic_phys : &apic_x2apic_cluster;
+    if ( x2apic_phys )
+        return &apic_x2apic_phys;
+
+    if ( !this_cpu(cluster_cpus) )
+    {
+        update_clusterinfo(NULL, CPU_UP_PREPARE,
+                           (void *)(long)smp_processor_id());
+        init_apic_ldr_x2apic_cluster();
+        register_cpu_notifier(&x2apic_cpu_nfb);
+    }
+
+    return &apic_x2apic_cluster;
 }
 
 void __init check_x2apic_preenabled(void)

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

From xen-changelog-bounces@lists.xen.org Thu Nov 08 21:44:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Nov 2012 21:44: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.xen.org>)
	id 1TWZtW-0008PS-E3; Thu, 08 Nov 2012 21:44:14 +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 1TWZtU-0008P8-N1
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 21:44:13 +0000
Received: from [85.158.137.99:51241] by server-15.bemta-3.messagelabs.com id
	5E/1C-09445-BA72C905; Thu, 08 Nov 2012 21:44:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-217.messagelabs.com!1352411049!18365684!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4467 invoked from network); 8 Nov 2012 21:44:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Nov 2012 21: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 1TWZtR-0006jG-Gd
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 21:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TWZtR-0006hd-4q
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 21:44:09 +0000
Message-Id: <E1TWZtR-0006hd-4q@xenbits.xen.org>
Date: Thu, 08 Nov 2012 21:44:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/x2apic: properly implement
	cluster mode
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352393899 -3600
# Node ID 62885b3c34c84354ead017703a86f0465cb58cf7
# Parent  f05a99beba73c30ea5d2439508699cf2fb50f0e5
x86/x2apic: properly implement cluster mode

So far, cluster mode was just an alternative implementation of
physical mode: Allowing only single CPU interrupt targets, and sending
IPIs to each target CPU separately. Take advantage of what cluster
mode really can do in that regard.

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


diff -r f05a99beba73 -r 62885b3c34c8 xen/arch/x86/genapic/x2apic.c
--- a/xen/arch/x86/genapic/x2apic.c	Thu Nov 08 17:56:12 2012 +0100
+++ b/xen/arch/x86/genapic/x2apic.c	Thu Nov 08 17:58:19 2012 +0100
@@ -19,6 +19,7 @@
 
 #include <xen/config.h>
 #include <xen/init.h>
+#include <xen/cpu.h>
 #include <xen/cpumask.h>
 #include <asm/apicdef.h>
 #include <asm/genapic.h>
@@ -33,6 +34,14 @@ static bool_t __initdata x2apic_phys; /*
 boolean_param("x2apic_phys", x2apic_phys);
 
 static DEFINE_PER_CPU_READ_MOSTLY(u32, cpu_2_logical_apicid);
+static DEFINE_PER_CPU_READ_MOSTLY(cpumask_t *, cluster_cpus);
+static cpumask_t *cluster_cpus_spare;
+static DEFINE_PER_CPU(cpumask_var_t, scratch_mask);
+
+static inline u32 x2apic_cluster(unsigned int cpu)
+{
+    return per_cpu(cpu_2_logical_apicid, cpu) >> 16;
+}
 
 static void init_apic_ldr_x2apic_phys(void)
 {
@@ -40,20 +49,53 @@ static void init_apic_ldr_x2apic_phys(vo
 
 static void init_apic_ldr_x2apic_cluster(void)
 {
-    this_cpu(cpu_2_logical_apicid) = apic_read(APIC_LDR);
+    unsigned int cpu, this_cpu = smp_processor_id();
+
+    per_cpu(cpu_2_logical_apicid, this_cpu) = apic_read(APIC_LDR);
+
+    if ( per_cpu(cluster_cpus, this_cpu) )
+    {
+        ASSERT(cpumask_test_cpu(this_cpu, per_cpu(cluster_cpus, this_cpu)));
+        return;
+    }
+
+    per_cpu(cluster_cpus, this_cpu) = cluster_cpus_spare;
+    for_each_online_cpu ( cpu )
+    {
+        if (this_cpu == cpu || x2apic_cluster(this_cpu) != x2apic_cluster(cpu))
+            continue;
+        per_cpu(cluster_cpus, this_cpu) = per_cpu(cluster_cpus, cpu);
+        break;
+    }
+    if ( per_cpu(cluster_cpus, this_cpu) == cluster_cpus_spare )
+        cluster_cpus_spare = NULL;
+
+    cpumask_set_cpu(this_cpu, per_cpu(cluster_cpus, this_cpu));
 }
 
 static void __init clustered_apic_check_x2apic(void)
 {
 }
 
+static const cpumask_t *vector_allocation_cpumask_x2apic_cluster(int cpu)
+{
+    return per_cpu(cluster_cpus, cpu);
+}
+
 static unsigned int cpu_mask_to_apicid_x2apic_cluster(const cpumask_t *cpumask)
 {
-    return per_cpu(cpu_2_logical_apicid, cpumask_first(cpumask));
+    unsigned int cpu = cpumask_first(cpumask);
+    unsigned int dest = per_cpu(cpu_2_logical_apicid, cpu);
+    const cpumask_t *cluster_cpus = per_cpu(cluster_cpus, cpu);
+
+    for_each_cpu ( cpu, cluster_cpus )
+        if ( cpumask_test_cpu(cpu, cpumask) )
+            dest |= per_cpu(cpu_2_logical_apicid, cpu);
+
+    return dest;
 }
 
-static void __send_IPI_mask_x2apic(
-    const cpumask_t *cpumask, int vector, unsigned int dest_mode)
+static void send_IPI_mask_x2apic_phys(const cpumask_t *cpumask, int vector)
 {
     unsigned int cpu;
     unsigned long flags;
@@ -77,23 +119,48 @@ static void __send_IPI_mask_x2apic(
     {
         if ( !cpu_online(cpu) || (cpu == smp_processor_id()) )
             continue;
-        msr_content = (dest_mode == APIC_DEST_PHYSICAL)
-            ? cpu_physical_id(cpu) : per_cpu(cpu_2_logical_apicid, cpu);
-        msr_content = (msr_content << 32) | APIC_DM_FIXED | dest_mode | vector;
+        msr_content = cpu_physical_id(cpu);
+        msr_content = (msr_content << 32) | APIC_DM_FIXED |
+                      APIC_DEST_PHYSICAL | vector;
         apic_wrmsr(APIC_ICR, msr_content);
     }
 
     local_irq_restore(flags);
 }
 
-static void send_IPI_mask_x2apic_phys(const cpumask_t *cpumask, int vector)
-{
-    __send_IPI_mask_x2apic(cpumask, vector, APIC_DEST_PHYSICAL);
-}
-
 static void send_IPI_mask_x2apic_cluster(const cpumask_t *cpumask, int vector)
 {
-    __send_IPI_mask_x2apic(cpumask, vector, APIC_DEST_LOGICAL);
+    unsigned int cpu = smp_processor_id();
+    cpumask_t *ipimask = per_cpu(scratch_mask, cpu);
+    const cpumask_t *cluster_cpus;
+    unsigned long flags;
+
+    mb(); /* See above for an explanation. */
+
+    local_irq_save(flags);
+
+    cpumask_andnot(ipimask, &cpu_online_map, cpumask_of(cpu));
+
+    for ( cpumask_and(ipimask, cpumask, ipimask); !cpumask_empty(ipimask);
+          cpumask_andnot(ipimask, ipimask, cluster_cpus) )
+    {
+        uint64_t msr_content = 0;
+
+        cluster_cpus = per_cpu(cluster_cpus, cpumask_first(ipimask));
+        for_each_cpu ( cpu, cluster_cpus )
+        {
+            if ( !cpumask_test_cpu(cpu, ipimask) )
+                continue;
+            msr_content |= per_cpu(cpu_2_logical_apicid, cpu);
+        }
+
+        BUG_ON(!msr_content);
+        msr_content = (msr_content << 32) | APIC_DM_FIXED |
+                      APIC_DEST_LOGICAL | vector;
+        apic_wrmsr(APIC_ICR, msr_content);
+    }
+
+    local_irq_restore(flags);
 }
 
 static const struct genapic apic_x2apic_phys = {
@@ -116,15 +183,60 @@ static const struct genapic apic_x2apic_
     .init_apic_ldr = init_apic_ldr_x2apic_cluster,
     .clustered_apic_check = clustered_apic_check_x2apic,
     .target_cpus = target_cpus_all,
-    .vector_allocation_cpumask = vector_allocation_cpumask_phys,
+    .vector_allocation_cpumask = vector_allocation_cpumask_x2apic_cluster,
     .cpu_mask_to_apicid = cpu_mask_to_apicid_x2apic_cluster,
     .send_IPI_mask = send_IPI_mask_x2apic_cluster,
     .send_IPI_self = send_IPI_self_x2apic
 };
 
+static int update_clusterinfo(
+    struct notifier_block *nfb, unsigned long action, void *hcpu)
+{
+    unsigned int cpu = (unsigned long)hcpu;
+    int err = 0;
+
+    switch (action) {
+    case CPU_UP_PREPARE:
+        per_cpu(cpu_2_logical_apicid, cpu) = BAD_APICID;
+        if ( !cluster_cpus_spare )
+            cluster_cpus_spare = xzalloc(cpumask_t);
+        if ( !cluster_cpus_spare ||
+             !alloc_cpumask_var(&per_cpu(scratch_mask, cpu)) )
+            err = -ENOMEM;
+        break;
+    case CPU_UP_CANCELED:
+    case CPU_DEAD:
+        if ( per_cpu(cluster_cpus, cpu) )
+        {
+            cpumask_clear_cpu(cpu, per_cpu(cluster_cpus, cpu));
+            if ( cpumask_empty(per_cpu(cluster_cpus, cpu)) )
+                xfree(per_cpu(cluster_cpus, cpu));
+        }
+        free_cpumask_var(per_cpu(scratch_mask, cpu));
+        break;
+    }
+
+    return !err ? NOTIFY_DONE : notifier_from_errno(err);
+}
+
+static struct notifier_block x2apic_cpu_nfb = {
+   .notifier_call = update_clusterinfo
+};
+
 const struct genapic *__init apic_x2apic_probe(void)
 {
-    return x2apic_phys ? &apic_x2apic_phys : &apic_x2apic_cluster;
+    if ( x2apic_phys )
+        return &apic_x2apic_phys;
+
+    if ( !this_cpu(cluster_cpus) )
+    {
+        update_clusterinfo(NULL, CPU_UP_PREPARE,
+                           (void *)(long)smp_processor_id());
+        init_apic_ldr_x2apic_cluster();
+        register_cpu_notifier(&x2apic_cpu_nfb);
+    }
+
+    return &apic_x2apic_cluster;
 }
 
 void __init check_x2apic_preenabled(void)

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

From xen-changelog-bounces@lists.xen.org Thu Nov 08 21:44:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Nov 2012 21: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 1TWZtW-0008PN-Bh; Thu, 08 Nov 2012 21:44:14 +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 1TWZtU-0008P9-PE
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 21:44:13 +0000
Received: from [193.109.254.147:28228] by server-4.bemta-14.messagelabs.com id
	95/9B-18856-CA72C905; Thu, 08 Nov 2012 21:44:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-27.messagelabs.com!1352411049!3423123!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24239 invoked from network); 8 Nov 2012 21:44:10 -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;
	8 Nov 2012 21: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 1TWZtQ-0006jD-Tc
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 21:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TWZtQ-0006hO-IR
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 21:44:08 +0000
Message-Id: <E1TWZtQ-0006hO-IR@xenbits.xen.org>
Date: Thu, 08 Nov 2012 21:44:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: make cpu_2_logical_apicid
	private to x2apic code
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352393772 -3600
# Node ID f05a99beba73c30ea5d2439508699cf2fb50f0e5
# Parent  92163b114076029842d0f2d1dbfaa445976c71a3
x86: make cpu_2_logical_apicid private to x2apic code

... as it in fact is only being used there. While moving it, also make
it a per-CPU variable rather than a NR_CPUS-sized array.

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


diff -r 92163b114076 -r f05a99beba73 xen/arch/x86/apic.c
--- a/xen/arch/x86/apic.c	Thu Nov 08 10:53:41 2012 +0100
+++ b/xen/arch/x86/apic.c	Thu Nov 08 17:56:12 2012 +0100
@@ -1024,7 +1024,6 @@ __next:
     if (boot_cpu_physical_apicid == -1U)
         boot_cpu_physical_apicid = get_apic_id();
     x86_cpu_to_apicid[0] = get_apic_id();
-    cpu_2_logical_apicid[0] = get_logical_apic_id();
 
     init_ioapic_mappings();
 }
diff -r 92163b114076 -r f05a99beba73 xen/arch/x86/genapic/x2apic.c
--- a/xen/arch/x86/genapic/x2apic.c	Thu Nov 08 10:53:41 2012 +0100
+++ b/xen/arch/x86/genapic/x2apic.c	Thu Nov 08 17:56:12 2012 +0100
@@ -32,14 +32,15 @@
 static bool_t __initdata x2apic_phys; /* By default we use logical cluster mode. */
 boolean_param("x2apic_phys", x2apic_phys);
 
+static DEFINE_PER_CPU_READ_MOSTLY(u32, cpu_2_logical_apicid);
+
 static void init_apic_ldr_x2apic_phys(void)
 {
 }
 
 static void init_apic_ldr_x2apic_cluster(void)
 {
-    int cpu = smp_processor_id();
-    cpu_2_logical_apicid[cpu] = apic_read(APIC_LDR);
+    this_cpu(cpu_2_logical_apicid) = apic_read(APIC_LDR);
 }
 
 static void __init clustered_apic_check_x2apic(void)
@@ -48,7 +49,7 @@ static void __init clustered_apic_check_
 
 static unsigned int cpu_mask_to_apicid_x2apic_cluster(const cpumask_t *cpumask)
 {
-    return cpu_2_logical_apicid[cpumask_first(cpumask)];
+    return per_cpu(cpu_2_logical_apicid, cpumask_first(cpumask));
 }
 
 static void __send_IPI_mask_x2apic(
@@ -77,7 +78,7 @@ static void __send_IPI_mask_x2apic(
         if ( !cpu_online(cpu) || (cpu == smp_processor_id()) )
             continue;
         msr_content = (dest_mode == APIC_DEST_PHYSICAL)
-            ? cpu_physical_id(cpu) : cpu_2_logical_apicid[cpu];
+            ? cpu_physical_id(cpu) : per_cpu(cpu_2_logical_apicid, cpu);
         msr_content = (msr_content << 32) | APIC_DM_FIXED | dest_mode | vector;
         apic_wrmsr(APIC_ICR, msr_content);
     }
diff -r 92163b114076 -r f05a99beba73 xen/arch/x86/smp.c
--- a/xen/arch/x86/smp.c	Thu Nov 08 10:53:41 2012 +0100
+++ b/xen/arch/x86/smp.c	Thu Nov 08 17:56:12 2012 +0100
@@ -28,11 +28,6 @@ int hard_smp_processor_id(void)
     return get_apic_id();
 }
 
-int logical_smp_processor_id(void)
-{
-    return get_logical_apic_id();
-}
-
 /*
  * send_IPI_mask(cpumask, vector): sends @vector IPI to CPUs in @cpumask,
  * excluding the local CPU. @cpumask may be empty.
diff -r 92163b114076 -r f05a99beba73 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c	Thu Nov 08 10:53:41 2012 +0100
+++ b/xen/arch/x86/smpboot.c	Thu Nov 08 17:56:12 2012 +0100
@@ -64,8 +64,6 @@ struct cpuinfo_x86 cpu_data[NR_CPUS];
 u32 x86_cpu_to_apicid[NR_CPUS] __read_mostly =
 	{ [0 ... NR_CPUS-1] = BAD_APICID };
 
-static void map_cpu_to_logical_apicid(void);
-
 static int cpu_error;
 static enum cpu_state {
     CPU_STATE_DYING,    /* slave -> master: I am dying */
@@ -202,7 +200,6 @@ void smp_callin(void)
     Dprintk("CALLIN, before setup_local_APIC().\n");
     x2apic_ap_setup();
     setup_local_APIC();
-    map_cpu_to_logical_apicid();
 
     /* Save our processor parameters. */
     smp_store_cpu_info(cpu);
@@ -401,22 +398,6 @@ extern struct {
     unsigned short ss;
 } stack_start;
 
-u32 cpu_2_logical_apicid[NR_CPUS] __read_mostly =
-    { [0 ... NR_CPUS-1] = BAD_APICID };
-
-static void map_cpu_to_logical_apicid(void)
-{
-    int cpu = smp_processor_id();
-    int apicid = logical_smp_processor_id();
-
-    cpu_2_logical_apicid[cpu] = apicid;
-}
-
-static void unmap_cpu_to_logical_apicid(int cpu)
-{
-    cpu_2_logical_apicid[cpu] = BAD_APICID;
-}
-
 static int wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip)
 {
     unsigned long send_status = 0, accept_status = 0;
@@ -646,7 +627,6 @@ static int do_boot_cpu(int apicid, int c
 void cpu_exit_clear(unsigned int cpu)
 {
     cpu_uninit(cpu);
-    unmap_cpu_to_logical_apicid(cpu);
     set_cpu_state(CPU_STATE_DEAD);
 }
 
@@ -775,7 +755,6 @@ void __init smp_prepare_cpus(unsigned in
         if (APIC_init_uniprocessor())
             printk(KERN_NOTICE "Local APIC not detected."
                    " Using dummy APIC emulation.\n");
-        map_cpu_to_logical_apicid();
         return;
     }
 
@@ -804,7 +783,6 @@ void __init smp_prepare_cpus(unsigned in
 
     connect_bsp_APIC();
     setup_local_APIC();
-    map_cpu_to_logical_apicid();
 
     smpboot_setup_io_apic();
 
diff -r 92163b114076 -r f05a99beba73 xen/include/asm-x86/apic.h
--- a/xen/include/asm-x86/apic.h	Thu Nov 08 10:53:41 2012 +0100
+++ b/xen/include/asm-x86/apic.h	Thu Nov 08 17:56:12 2012 +0100
@@ -158,12 +158,6 @@ static __inline u32 get_apic_id(void) /*
     return x2apic_enabled ? id : GET_xAPIC_ID(id);
 }
 
-static __inline u32 get_logical_apic_id(void)
-{
-    u32 logical_id = apic_read(APIC_LDR);
-    return x2apic_enabled ? logical_id : GET_xAPIC_LOGICAL_ID(logical_id);
-}
-
 void apic_wait_icr_idle(void);
 
 int get_physical_broadcast(void);
diff -r 92163b114076 -r f05a99beba73 xen/include/asm-x86/smp.h
--- a/xen/include/asm-x86/smp.h	Thu Nov 08 10:53:41 2012 +0100
+++ b/xen/include/asm-x86/smp.h	Thu Nov 08 17:56:12 2012 +0100
@@ -37,7 +37,6 @@ extern void zap_low_mappings(void);
 
 #define MAX_APICID 256
 extern u32 x86_cpu_to_apicid[];
-extern u32 cpu_2_logical_apicid[];
 
 #define cpu_physical_id(cpu)	x86_cpu_to_apicid[cpu]
 
@@ -54,7 +53,6 @@ int cpu_add(uint32_t apic_id, uint32_t a
 #define raw_smp_processor_id() (get_processor_id())
 
 int hard_smp_processor_id(void);
-int logical_smp_processor_id(void);
 
 void __stop_this_cpu(void);
 

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

From xen-changelog-bounces@lists.xen.org Thu Nov 08 21:44:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Nov 2012 21: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 1TWZtW-0008PN-Bh; Thu, 08 Nov 2012 21:44:14 +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 1TWZtU-0008P9-PE
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 21:44:13 +0000
Received: from [193.109.254.147:28228] by server-4.bemta-14.messagelabs.com id
	95/9B-18856-CA72C905; Thu, 08 Nov 2012 21:44:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-27.messagelabs.com!1352411049!3423123!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24239 invoked from network); 8 Nov 2012 21:44:10 -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;
	8 Nov 2012 21: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 1TWZtQ-0006jD-Tc
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 21:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TWZtQ-0006hO-IR
	for xen-changelog@lists.xensource.com; Thu, 08 Nov 2012 21:44:08 +0000
Message-Id: <E1TWZtQ-0006hO-IR@xenbits.xen.org>
Date: Thu, 08 Nov 2012 21:44:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: make cpu_2_logical_apicid
	private to x2apic code
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352393772 -3600
# Node ID f05a99beba73c30ea5d2439508699cf2fb50f0e5
# Parent  92163b114076029842d0f2d1dbfaa445976c71a3
x86: make cpu_2_logical_apicid private to x2apic code

... as it in fact is only being used there. While moving it, also make
it a per-CPU variable rather than a NR_CPUS-sized array.

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


diff -r 92163b114076 -r f05a99beba73 xen/arch/x86/apic.c
--- a/xen/arch/x86/apic.c	Thu Nov 08 10:53:41 2012 +0100
+++ b/xen/arch/x86/apic.c	Thu Nov 08 17:56:12 2012 +0100
@@ -1024,7 +1024,6 @@ __next:
     if (boot_cpu_physical_apicid == -1U)
         boot_cpu_physical_apicid = get_apic_id();
     x86_cpu_to_apicid[0] = get_apic_id();
-    cpu_2_logical_apicid[0] = get_logical_apic_id();
 
     init_ioapic_mappings();
 }
diff -r 92163b114076 -r f05a99beba73 xen/arch/x86/genapic/x2apic.c
--- a/xen/arch/x86/genapic/x2apic.c	Thu Nov 08 10:53:41 2012 +0100
+++ b/xen/arch/x86/genapic/x2apic.c	Thu Nov 08 17:56:12 2012 +0100
@@ -32,14 +32,15 @@
 static bool_t __initdata x2apic_phys; /* By default we use logical cluster mode. */
 boolean_param("x2apic_phys", x2apic_phys);
 
+static DEFINE_PER_CPU_READ_MOSTLY(u32, cpu_2_logical_apicid);
+
 static void init_apic_ldr_x2apic_phys(void)
 {
 }
 
 static void init_apic_ldr_x2apic_cluster(void)
 {
-    int cpu = smp_processor_id();
-    cpu_2_logical_apicid[cpu] = apic_read(APIC_LDR);
+    this_cpu(cpu_2_logical_apicid) = apic_read(APIC_LDR);
 }
 
 static void __init clustered_apic_check_x2apic(void)
@@ -48,7 +49,7 @@ static void __init clustered_apic_check_
 
 static unsigned int cpu_mask_to_apicid_x2apic_cluster(const cpumask_t *cpumask)
 {
-    return cpu_2_logical_apicid[cpumask_first(cpumask)];
+    return per_cpu(cpu_2_logical_apicid, cpumask_first(cpumask));
 }
 
 static void __send_IPI_mask_x2apic(
@@ -77,7 +78,7 @@ static void __send_IPI_mask_x2apic(
         if ( !cpu_online(cpu) || (cpu == smp_processor_id()) )
             continue;
         msr_content = (dest_mode == APIC_DEST_PHYSICAL)
-            ? cpu_physical_id(cpu) : cpu_2_logical_apicid[cpu];
+            ? cpu_physical_id(cpu) : per_cpu(cpu_2_logical_apicid, cpu);
         msr_content = (msr_content << 32) | APIC_DM_FIXED | dest_mode | vector;
         apic_wrmsr(APIC_ICR, msr_content);
     }
diff -r 92163b114076 -r f05a99beba73 xen/arch/x86/smp.c
--- a/xen/arch/x86/smp.c	Thu Nov 08 10:53:41 2012 +0100
+++ b/xen/arch/x86/smp.c	Thu Nov 08 17:56:12 2012 +0100
@@ -28,11 +28,6 @@ int hard_smp_processor_id(void)
     return get_apic_id();
 }
 
-int logical_smp_processor_id(void)
-{
-    return get_logical_apic_id();
-}
-
 /*
  * send_IPI_mask(cpumask, vector): sends @vector IPI to CPUs in @cpumask,
  * excluding the local CPU. @cpumask may be empty.
diff -r 92163b114076 -r f05a99beba73 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c	Thu Nov 08 10:53:41 2012 +0100
+++ b/xen/arch/x86/smpboot.c	Thu Nov 08 17:56:12 2012 +0100
@@ -64,8 +64,6 @@ struct cpuinfo_x86 cpu_data[NR_CPUS];
 u32 x86_cpu_to_apicid[NR_CPUS] __read_mostly =
 	{ [0 ... NR_CPUS-1] = BAD_APICID };
 
-static void map_cpu_to_logical_apicid(void);
-
 static int cpu_error;
 static enum cpu_state {
     CPU_STATE_DYING,    /* slave -> master: I am dying */
@@ -202,7 +200,6 @@ void smp_callin(void)
     Dprintk("CALLIN, before setup_local_APIC().\n");
     x2apic_ap_setup();
     setup_local_APIC();
-    map_cpu_to_logical_apicid();
 
     /* Save our processor parameters. */
     smp_store_cpu_info(cpu);
@@ -401,22 +398,6 @@ extern struct {
     unsigned short ss;
 } stack_start;
 
-u32 cpu_2_logical_apicid[NR_CPUS] __read_mostly =
-    { [0 ... NR_CPUS-1] = BAD_APICID };
-
-static void map_cpu_to_logical_apicid(void)
-{
-    int cpu = smp_processor_id();
-    int apicid = logical_smp_processor_id();
-
-    cpu_2_logical_apicid[cpu] = apicid;
-}
-
-static void unmap_cpu_to_logical_apicid(int cpu)
-{
-    cpu_2_logical_apicid[cpu] = BAD_APICID;
-}
-
 static int wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip)
 {
     unsigned long send_status = 0, accept_status = 0;
@@ -646,7 +627,6 @@ static int do_boot_cpu(int apicid, int c
 void cpu_exit_clear(unsigned int cpu)
 {
     cpu_uninit(cpu);
-    unmap_cpu_to_logical_apicid(cpu);
     set_cpu_state(CPU_STATE_DEAD);
 }
 
@@ -775,7 +755,6 @@ void __init smp_prepare_cpus(unsigned in
         if (APIC_init_uniprocessor())
             printk(KERN_NOTICE "Local APIC not detected."
                    " Using dummy APIC emulation.\n");
-        map_cpu_to_logical_apicid();
         return;
     }
 
@@ -804,7 +783,6 @@ void __init smp_prepare_cpus(unsigned in
 
     connect_bsp_APIC();
     setup_local_APIC();
-    map_cpu_to_logical_apicid();
 
     smpboot_setup_io_apic();
 
diff -r 92163b114076 -r f05a99beba73 xen/include/asm-x86/apic.h
--- a/xen/include/asm-x86/apic.h	Thu Nov 08 10:53:41 2012 +0100
+++ b/xen/include/asm-x86/apic.h	Thu Nov 08 17:56:12 2012 +0100
@@ -158,12 +158,6 @@ static __inline u32 get_apic_id(void) /*
     return x2apic_enabled ? id : GET_xAPIC_ID(id);
 }
 
-static __inline u32 get_logical_apic_id(void)
-{
-    u32 logical_id = apic_read(APIC_LDR);
-    return x2apic_enabled ? logical_id : GET_xAPIC_LOGICAL_ID(logical_id);
-}
-
 void apic_wait_icr_idle(void);
 
 int get_physical_broadcast(void);
diff -r 92163b114076 -r f05a99beba73 xen/include/asm-x86/smp.h
--- a/xen/include/asm-x86/smp.h	Thu Nov 08 10:53:41 2012 +0100
+++ b/xen/include/asm-x86/smp.h	Thu Nov 08 17:56:12 2012 +0100
@@ -37,7 +37,6 @@ extern void zap_low_mappings(void);
 
 #define MAX_APICID 256
 extern u32 x86_cpu_to_apicid[];
-extern u32 cpu_2_logical_apicid[];
 
 #define cpu_physical_id(cpu)	x86_cpu_to_apicid[cpu]
 
@@ -54,7 +53,6 @@ int cpu_add(uint32_t apic_id, uint32_t a
 #define raw_smp_processor_id() (get_processor_id())
 
 int hard_smp_processor_id(void);
-int logical_smp_processor_id(void);
 
 void __stop_this_cpu(void);
 

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

From xen-changelog-bounces@lists.xen.org Mon Nov 12 08:44:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Nov 2012 08: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 1TXpcp-0003ZN-6r; Mon, 12 Nov 2012 08:44: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 1TXpcn-0003ZD-1X
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 08:44:09 +0000
Received: from [85.158.138.51:41585] by server-14.bemta-3.messagelabs.com id
	AB/ED-12788-8D6B0A05; Mon, 12 Nov 2012 08:44:08 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1352709845!27735880!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 806 invoked from network); 12 Nov 2012 08:44:07 -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;
	12 Nov 2012 08:44: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 1TXpci-0006du-Pg
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 08:44:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TXpci-0007Ps-CN
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 08:44:04 +0000
Message-Id: <E1TXpci-0007Ps-CN@xenbits.xen.org>
Date: Mon, 12 Nov 2012 08:44:04 +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] make gnttab_dma_map_page()
	compound page aware
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352709645 -3600
# Node ID 171f57e6ad50fb71354b5b7f2177394102ca02fe
# Parent  f695483240db110763b89c6821a2357929f2ec1e
make gnttab_dma_map_page() compound page aware

While this was found to be a problem in practice only on recent
kernels, it was nevertheless a mistake from the beginning to not take
into consideration compound pages.

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


diff -r f695483240db -r 171f57e6ad50 arch/i386/kernel/pci-dma-xen.c
--- a/arch/i386/kernel/pci-dma-xen.c	Fri Oct 19 17:57:20 2012 +0200
+++ b/arch/i386/kernel/pci-dma-xen.c	Mon Nov 12 09:40:45 2012 +0100
@@ -120,7 +120,7 @@ dma_map_sg(struct device *hwdev, struct 
 		for (i = 0; i < nents; i++ ) {
 			BUG_ON(!sg[i].page);
 			sg[i].dma_address =
-				gnttab_dma_map_page(sg[i].page) + sg[i].offset;
+				gnttab_dma_map_page(sg[i].page, sg[i].offset);
 			sg[i].dma_length  = sg[i].length;
 			IOMMU_BUG_ON(address_needs_mapping(
 				hwdev, sg[i].dma_address));
@@ -165,7 +165,7 @@ dma_map_page(struct device *dev, struct 
 		dma_addr = swiotlb_map_page(
 			dev, page, offset, size, direction);
 	} else {
-		dma_addr = gnttab_dma_map_page(page) + offset;
+		dma_addr = gnttab_dma_map_page(page, offset);
 		IOMMU_BUG_ON(address_needs_mapping(dev, dma_addr));
 	}
 
@@ -363,8 +363,8 @@ dma_map_single(struct device *dev, void 
 	if (swiotlb) {
 		dma = swiotlb_map_single(dev, ptr, size, direction);
 	} else {
-		dma = gnttab_dma_map_page(virt_to_page(ptr)) +
-		      offset_in_page(ptr);
+		dma = gnttab_dma_map_page(virt_to_page(ptr),
+					  offset_in_page(ptr));
 		IOMMU_BUG_ON(range_straddles_page_boundary(__pa(ptr), size));
 		IOMMU_BUG_ON(address_needs_mapping(dev, dma));
 	}
diff -r f695483240db -r 171f57e6ad50 arch/ia64/hp/common/sba_iommu.c
--- a/arch/ia64/hp/common/sba_iommu.c	Fri Oct 19 17:57:20 2012 +0200
+++ b/arch/ia64/hp/common/sba_iommu.c	Mon Nov 12 09:40:45 2012 +0100
@@ -1522,7 +1522,7 @@ int sba_map_sg(struct device *dev, struc
 		for (sg = sglist ; filled < nents ; filled++, sg++){
 			sg->dma_length = sg->length;
 #ifdef CONFIG_XEN
-			sg->dma_address = gnttab_dma_map_page(sg->page) + sg->offset;
+			sg->dma_address = gnttab_dma_map_page(sg->page, sg->offset);
 #else
 			sg->dma_address = virt_to_bus(sba_sg_address(sg));
 #endif
diff -r f695483240db -r 171f57e6ad50 arch/ia64/xen/xen_dma.c
--- a/arch/ia64/xen/xen_dma.c	Fri Oct 19 17:57:20 2012 +0200
+++ b/arch/ia64/xen/xen_dma.c	Mon Nov 12 09:40:45 2012 +0100
@@ -92,7 +92,7 @@ xen_map_sg(struct device *dev, struct sc
 	int i;
 
 	for (i = 0 ; i < nents ; i++) {
-		sg[i].dma_address = gnttab_dma_map_page(sg[i].page) + sg[i].offset;
+		sg[i].dma_address = gnttab_dma_map_page(sg[i].page, sg[i].offset);
 		sg[i].dma_length  = sg[i].length;
 
 		IOMMU_BUG_ON(address_needs_mapping(dev, sg[i].dma_address));
diff -r f695483240db -r 171f57e6ad50 drivers/xen/core/gnttab.c
--- a/drivers/xen/core/gnttab.c	Fri Oct 19 17:57:20 2012 +0200
+++ b/drivers/xen/core/gnttab.c	Mon Nov 12 09:40:45 2012 +0100
@@ -705,6 +705,8 @@ void __gnttab_dma_map_page(struct page *
 	if (!is_running_on_xen() || !PageForeign(page))
 		return;
 
+	BUG_ON(PageCompound(page));
+
 	do {
 		seq = read_seqbegin(&gnttab_dma_lock);
 
diff -r f695483240db -r 171f57e6ad50 include/asm-i386/mach-xen/asm/gnttab_dma.h
--- a/include/asm-i386/mach-xen/asm/gnttab_dma.h	Fri Oct 19 17:57:20 2012 +0200
+++ b/include/asm-i386/mach-xen/asm/gnttab_dma.h	Mon Nov 12 09:40:45 2012 +0100
@@ -21,16 +21,24 @@
 #ifndef _ASM_I386_GNTTAB_DMA_H
 #define _ASM_I386_GNTTAB_DMA_H
 
+#include <asm/bug.h>
+
 static inline int gnttab_dma_local_pfn(struct page *page)
 {
 	/* Has it become a local MFN? */
 	return pfn_valid(mfn_to_local_pfn(pfn_to_mfn(page_to_pfn(page))));
 }
 
-static inline maddr_t gnttab_dma_map_page(struct page *page)
+static inline maddr_t gnttab_dma_map_page(struct page *page,
+					  unsigned long offset)
 {
+	unsigned int pgnr = offset >> PAGE_SHIFT;
+	unsigned int order = PageCompound(page) ? (long)page[1].lru.prev : 0;
+
+	BUG_ON(pgnr >> order);
 	__gnttab_dma_map_page(page);
-	return ((maddr_t)pfn_to_mfn(page_to_pfn(page)) << PAGE_SHIFT);
+	return ((maddr_t)pfn_to_mfn(page_to_pfn(page) + pgnr) << PAGE_SHIFT)
+	       + (offset & ~PAGE_MASK);
 }
 
 static inline void gnttab_dma_unmap_page(maddr_t maddr)
diff -r f695483240db -r 171f57e6ad50 include/asm-ia64/gnttab_dma.h
--- a/include/asm-ia64/gnttab_dma.h	Fri Oct 19 17:57:20 2012 +0200
+++ b/include/asm-ia64/gnttab_dma.h	Mon Nov 12 09:40:45 2012 +0100
@@ -21,6 +21,8 @@
 #ifndef _ASM_IA64_GNTTAB_DMA_H
 #define _ASM_IA64_GNTTAB_DMA_H
 
+#include <asm/bug.h>
+
 static inline int gnttab_dma_local_pfn(struct page *page)
 {
 	return 0;
@@ -32,10 +34,15 @@ static inline void gnttab_dma_use_page(s
 	__gnttab_dma_map_page(page);
 }
 
-static inline dma_addr_t gnttab_dma_map_page(struct page *page)
+static inline dma_addr_t gnttab_dma_map_page(struct page *page,
+					     unsigned long offset)
 {
+	unsigned int pgnr = offset >> PAGE_SHIFT;
+	unsigned int order = PageCompound(page) ? (long)page[1].lru.prev : 0;
+
+	BUG_ON(pgnr >> order);
 	gnttab_dma_use_page(page);
-	return page_to_bus(page);
+	return page_to_bus(page + pgnr) + (offset & ~PAGE_MASK);
 }
 
 static inline dma_addr_t gnttab_dma_map_virt(void *ptr)
diff -r f695483240db -r 171f57e6ad50 lib/swiotlb-xen.c
--- a/lib/swiotlb-xen.c	Fri Oct 19 17:57:20 2012 +0200
+++ b/lib/swiotlb-xen.c	Mon Nov 12 09:40:45 2012 +0100
@@ -501,8 +501,8 @@ swiotlb_full(struct device *dev, size_t 
 dma_addr_t
 swiotlb_map_single(struct device *hwdev, void *ptr, size_t size, int dir)
 {
-	dma_addr_t dev_addr = gnttab_dma_map_page(virt_to_page(ptr)) +
-			      offset_in_page(ptr);
+	dma_addr_t dev_addr = gnttab_dma_map_page(virt_to_page(ptr),
+						  offset_in_page(ptr));
 	void *map;
 	struct phys_addr buffer;
 
@@ -613,7 +613,7 @@ swiotlb_map_sg(struct device *hwdev, str
 	BUG_ON(dir == DMA_NONE);
 
 	for (i = 0; i < nelems; i++, sg++) {
-		dev_addr = gnttab_dma_map_page(sg->page) + sg->offset;
+		dev_addr = gnttab_dma_map_page(sg->page, sg->offset);
 
 		if (range_straddles_page_boundary(page_to_pseudophys(sg->page)
 						  + sg->offset, sg->length)
@@ -705,7 +705,7 @@ swiotlb_map_page(struct device *hwdev, s
 	dma_addr_t dev_addr;
 	char *map;
 
-	dev_addr = gnttab_dma_map_page(page) + offset;
+	dev_addr = gnttab_dma_map_page(page, offset);
 	if (address_needs_mapping(hwdev, dev_addr)) {
 		gnttab_dma_unmap_page(dev_addr);
 		buffer.page   = page;

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

From xen-changelog-bounces@lists.xen.org Mon Nov 12 08:44:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Nov 2012 08: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 1TXpcp-0003ZN-6r; Mon, 12 Nov 2012 08:44: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 1TXpcn-0003ZD-1X
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 08:44:09 +0000
Received: from [85.158.138.51:41585] by server-14.bemta-3.messagelabs.com id
	AB/ED-12788-8D6B0A05; Mon, 12 Nov 2012 08:44:08 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1352709845!27735880!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 806 invoked from network); 12 Nov 2012 08:44:07 -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;
	12 Nov 2012 08:44: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 1TXpci-0006du-Pg
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 08:44:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TXpci-0007Ps-CN
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 08:44:04 +0000
Message-Id: <E1TXpci-0007Ps-CN@xenbits.xen.org>
Date: Mon, 12 Nov 2012 08:44:04 +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] make gnttab_dma_map_page()
	compound page aware
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352709645 -3600
# Node ID 171f57e6ad50fb71354b5b7f2177394102ca02fe
# Parent  f695483240db110763b89c6821a2357929f2ec1e
make gnttab_dma_map_page() compound page aware

While this was found to be a problem in practice only on recent
kernels, it was nevertheless a mistake from the beginning to not take
into consideration compound pages.

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


diff -r f695483240db -r 171f57e6ad50 arch/i386/kernel/pci-dma-xen.c
--- a/arch/i386/kernel/pci-dma-xen.c	Fri Oct 19 17:57:20 2012 +0200
+++ b/arch/i386/kernel/pci-dma-xen.c	Mon Nov 12 09:40:45 2012 +0100
@@ -120,7 +120,7 @@ dma_map_sg(struct device *hwdev, struct 
 		for (i = 0; i < nents; i++ ) {
 			BUG_ON(!sg[i].page);
 			sg[i].dma_address =
-				gnttab_dma_map_page(sg[i].page) + sg[i].offset;
+				gnttab_dma_map_page(sg[i].page, sg[i].offset);
 			sg[i].dma_length  = sg[i].length;
 			IOMMU_BUG_ON(address_needs_mapping(
 				hwdev, sg[i].dma_address));
@@ -165,7 +165,7 @@ dma_map_page(struct device *dev, struct 
 		dma_addr = swiotlb_map_page(
 			dev, page, offset, size, direction);
 	} else {
-		dma_addr = gnttab_dma_map_page(page) + offset;
+		dma_addr = gnttab_dma_map_page(page, offset);
 		IOMMU_BUG_ON(address_needs_mapping(dev, dma_addr));
 	}
 
@@ -363,8 +363,8 @@ dma_map_single(struct device *dev, void 
 	if (swiotlb) {
 		dma = swiotlb_map_single(dev, ptr, size, direction);
 	} else {
-		dma = gnttab_dma_map_page(virt_to_page(ptr)) +
-		      offset_in_page(ptr);
+		dma = gnttab_dma_map_page(virt_to_page(ptr),
+					  offset_in_page(ptr));
 		IOMMU_BUG_ON(range_straddles_page_boundary(__pa(ptr), size));
 		IOMMU_BUG_ON(address_needs_mapping(dev, dma));
 	}
diff -r f695483240db -r 171f57e6ad50 arch/ia64/hp/common/sba_iommu.c
--- a/arch/ia64/hp/common/sba_iommu.c	Fri Oct 19 17:57:20 2012 +0200
+++ b/arch/ia64/hp/common/sba_iommu.c	Mon Nov 12 09:40:45 2012 +0100
@@ -1522,7 +1522,7 @@ int sba_map_sg(struct device *dev, struc
 		for (sg = sglist ; filled < nents ; filled++, sg++){
 			sg->dma_length = sg->length;
 #ifdef CONFIG_XEN
-			sg->dma_address = gnttab_dma_map_page(sg->page) + sg->offset;
+			sg->dma_address = gnttab_dma_map_page(sg->page, sg->offset);
 #else
 			sg->dma_address = virt_to_bus(sba_sg_address(sg));
 #endif
diff -r f695483240db -r 171f57e6ad50 arch/ia64/xen/xen_dma.c
--- a/arch/ia64/xen/xen_dma.c	Fri Oct 19 17:57:20 2012 +0200
+++ b/arch/ia64/xen/xen_dma.c	Mon Nov 12 09:40:45 2012 +0100
@@ -92,7 +92,7 @@ xen_map_sg(struct device *dev, struct sc
 	int i;
 
 	for (i = 0 ; i < nents ; i++) {
-		sg[i].dma_address = gnttab_dma_map_page(sg[i].page) + sg[i].offset;
+		sg[i].dma_address = gnttab_dma_map_page(sg[i].page, sg[i].offset);
 		sg[i].dma_length  = sg[i].length;
 
 		IOMMU_BUG_ON(address_needs_mapping(dev, sg[i].dma_address));
diff -r f695483240db -r 171f57e6ad50 drivers/xen/core/gnttab.c
--- a/drivers/xen/core/gnttab.c	Fri Oct 19 17:57:20 2012 +0200
+++ b/drivers/xen/core/gnttab.c	Mon Nov 12 09:40:45 2012 +0100
@@ -705,6 +705,8 @@ void __gnttab_dma_map_page(struct page *
 	if (!is_running_on_xen() || !PageForeign(page))
 		return;
 
+	BUG_ON(PageCompound(page));
+
 	do {
 		seq = read_seqbegin(&gnttab_dma_lock);
 
diff -r f695483240db -r 171f57e6ad50 include/asm-i386/mach-xen/asm/gnttab_dma.h
--- a/include/asm-i386/mach-xen/asm/gnttab_dma.h	Fri Oct 19 17:57:20 2012 +0200
+++ b/include/asm-i386/mach-xen/asm/gnttab_dma.h	Mon Nov 12 09:40:45 2012 +0100
@@ -21,16 +21,24 @@
 #ifndef _ASM_I386_GNTTAB_DMA_H
 #define _ASM_I386_GNTTAB_DMA_H
 
+#include <asm/bug.h>
+
 static inline int gnttab_dma_local_pfn(struct page *page)
 {
 	/* Has it become a local MFN? */
 	return pfn_valid(mfn_to_local_pfn(pfn_to_mfn(page_to_pfn(page))));
 }
 
-static inline maddr_t gnttab_dma_map_page(struct page *page)
+static inline maddr_t gnttab_dma_map_page(struct page *page,
+					  unsigned long offset)
 {
+	unsigned int pgnr = offset >> PAGE_SHIFT;
+	unsigned int order = PageCompound(page) ? (long)page[1].lru.prev : 0;
+
+	BUG_ON(pgnr >> order);
 	__gnttab_dma_map_page(page);
-	return ((maddr_t)pfn_to_mfn(page_to_pfn(page)) << PAGE_SHIFT);
+	return ((maddr_t)pfn_to_mfn(page_to_pfn(page) + pgnr) << PAGE_SHIFT)
+	       + (offset & ~PAGE_MASK);
 }
 
 static inline void gnttab_dma_unmap_page(maddr_t maddr)
diff -r f695483240db -r 171f57e6ad50 include/asm-ia64/gnttab_dma.h
--- a/include/asm-ia64/gnttab_dma.h	Fri Oct 19 17:57:20 2012 +0200
+++ b/include/asm-ia64/gnttab_dma.h	Mon Nov 12 09:40:45 2012 +0100
@@ -21,6 +21,8 @@
 #ifndef _ASM_IA64_GNTTAB_DMA_H
 #define _ASM_IA64_GNTTAB_DMA_H
 
+#include <asm/bug.h>
+
 static inline int gnttab_dma_local_pfn(struct page *page)
 {
 	return 0;
@@ -32,10 +34,15 @@ static inline void gnttab_dma_use_page(s
 	__gnttab_dma_map_page(page);
 }
 
-static inline dma_addr_t gnttab_dma_map_page(struct page *page)
+static inline dma_addr_t gnttab_dma_map_page(struct page *page,
+					     unsigned long offset)
 {
+	unsigned int pgnr = offset >> PAGE_SHIFT;
+	unsigned int order = PageCompound(page) ? (long)page[1].lru.prev : 0;
+
+	BUG_ON(pgnr >> order);
 	gnttab_dma_use_page(page);
-	return page_to_bus(page);
+	return page_to_bus(page + pgnr) + (offset & ~PAGE_MASK);
 }
 
 static inline dma_addr_t gnttab_dma_map_virt(void *ptr)
diff -r f695483240db -r 171f57e6ad50 lib/swiotlb-xen.c
--- a/lib/swiotlb-xen.c	Fri Oct 19 17:57:20 2012 +0200
+++ b/lib/swiotlb-xen.c	Mon Nov 12 09:40:45 2012 +0100
@@ -501,8 +501,8 @@ swiotlb_full(struct device *dev, size_t 
 dma_addr_t
 swiotlb_map_single(struct device *hwdev, void *ptr, size_t size, int dir)
 {
-	dma_addr_t dev_addr = gnttab_dma_map_page(virt_to_page(ptr)) +
-			      offset_in_page(ptr);
+	dma_addr_t dev_addr = gnttab_dma_map_page(virt_to_page(ptr),
+						  offset_in_page(ptr));
 	void *map;
 	struct phys_addr buffer;
 
@@ -613,7 +613,7 @@ swiotlb_map_sg(struct device *hwdev, str
 	BUG_ON(dir == DMA_NONE);
 
 	for (i = 0; i < nelems; i++, sg++) {
-		dev_addr = gnttab_dma_map_page(sg->page) + sg->offset;
+		dev_addr = gnttab_dma_map_page(sg->page, sg->offset);
 
 		if (range_straddles_page_boundary(page_to_pseudophys(sg->page)
 						  + sg->offset, sg->length)
@@ -705,7 +705,7 @@ swiotlb_map_page(struct device *hwdev, s
 	dma_addr_t dev_addr;
 	char *map;
 
-	dev_addr = gnttab_dma_map_page(page) + offset;
+	dev_addr = gnttab_dma_map_page(page, offset);
 	if (address_needs_mapping(hwdev, dev_addr)) {
 		gnttab_dma_unmap_page(dev_addr);
 		buffer.page   = page;

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

From xen-changelog-bounces@lists.xen.org Mon Nov 12 21:00:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Nov 2012 21:00: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 1TY17C-0003Nr-Ho; Mon, 12 Nov 2012 21:00: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 1TY17A-0003Nk-HB
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 21:00:16 +0000
Received: from [85.158.139.211:23954] by server-10.bemta-5.messagelabs.com id
	86/15-09257-F5361A05; Mon, 12 Nov 2012 21:00:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-206.messagelabs.com!1352754013!15897393!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12309 invoked from network); 12 Nov 2012 21:00:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	12 Nov 2012 21:00: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 1TY177-0007Oc-7c
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 21:00:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TY176-0001FS-QR
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 21:00:12 +0000
Message-Id: <E1TY176-0001FS-QR@xenbits.xen.org>
Date: Mon, 12 Nov 2012 21:00:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tmem: Prevent NULL dereference on
	error case
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Daley <mattjd@gmail.com>
# Date 1352709297 -3600
# Node ID 286ef4ced2164f4e9bf52fd0c52248182e69a6e6
# Parent  62885b3c34c84354ead017703a86f0465cb58cf7
tmem: Prevent NULL dereference on error case

If the client / pool IDs given to tmemc_save_get_next_page are invalid,
the calculation of pagesize will dereference NULL.

Fix this by moving the calculation below the appropriate NULL check.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 62885b3c34c8 -r 286ef4ced216 xen/common/tmem.c
--- a/xen/common/tmem.c	Thu Nov 08 17:58:19 2012 +0100
+++ b/xen/common/tmem.c	Mon Nov 12 09:34:57 2012 +0100
@@ -2436,10 +2436,12 @@ static NOINLINE int tmemc_save_get_next_
     OID oid;
     int ret = 0;
     struct tmem_handle h;
-    unsigned int pagesize = 1 << (pool->pageshift+12);
+    unsigned int pagesize;
 
     if ( pool == NULL || is_ephemeral(pool) )
         return -1;
+
+    pagesize = 1 << (pool->pageshift + 12);
     if ( bufsize < pagesize + sizeof(struct tmem_handle) )
         return -ENOMEM;
 

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

From xen-changelog-bounces@lists.xen.org Mon Nov 12 21:00:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Nov 2012 21:00: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 1TY17C-0003Nr-Ho; Mon, 12 Nov 2012 21:00: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 1TY17A-0003Nk-HB
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 21:00:16 +0000
Received: from [85.158.139.211:23954] by server-10.bemta-5.messagelabs.com id
	86/15-09257-F5361A05; Mon, 12 Nov 2012 21:00:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-206.messagelabs.com!1352754013!15897393!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12309 invoked from network); 12 Nov 2012 21:00:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	12 Nov 2012 21:00: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 1TY177-0007Oc-7c
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 21:00:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TY176-0001FS-QR
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 21:00:12 +0000
Message-Id: <E1TY176-0001FS-QR@xenbits.xen.org>
Date: Mon, 12 Nov 2012 21:00:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tmem: Prevent NULL dereference on
	error case
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Daley <mattjd@gmail.com>
# Date 1352709297 -3600
# Node ID 286ef4ced2164f4e9bf52fd0c52248182e69a6e6
# Parent  62885b3c34c84354ead017703a86f0465cb58cf7
tmem: Prevent NULL dereference on error case

If the client / pool IDs given to tmemc_save_get_next_page are invalid,
the calculation of pagesize will dereference NULL.

Fix this by moving the calculation below the appropriate NULL check.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 62885b3c34c8 -r 286ef4ced216 xen/common/tmem.c
--- a/xen/common/tmem.c	Thu Nov 08 17:58:19 2012 +0100
+++ b/xen/common/tmem.c	Mon Nov 12 09:34:57 2012 +0100
@@ -2436,10 +2436,12 @@ static NOINLINE int tmemc_save_get_next_
     OID oid;
     int ret = 0;
     struct tmem_handle h;
-    unsigned int pagesize = 1 << (pool->pageshift+12);
+    unsigned int pagesize;
 
     if ( pool == NULL || is_ephemeral(pool) )
         return -1;
+
+    pagesize = 1 << (pool->pageshift + 12);
     if ( bufsize < pagesize + sizeof(struct tmem_handle) )
         return -ENOMEM;
 

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

From xen-changelog-bounces@lists.xen.org Mon Nov 12 21:00:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Nov 2012 21:00: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 1TY17D-0003O1-KX; Mon, 12 Nov 2012 21:00:19 +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 1TY17C-0003Np-7w
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 21:00:18 +0000
Received: from [85.158.143.99:21840] by server-1.bemta-4.messagelabs.com id
	D1/25-27934-16361A05; Mon, 12 Nov 2012 21:00:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1352754015!24388445!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9443 invoked from network); 12 Nov 2012 21:00:16 -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;
	12 Nov 2012 21:00: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 1TY178-0007Of-KC
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 21:00:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TY177-0001Fn-UJ
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 21:00:14 +0000
Message-Id: <E1TY177-0001Fn-UJ@xenbits.xen.org>
Date: Mon, 12 Nov 2012 21:00:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] IOMMU: don't immediately disable bus
	mastering on faults
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352709367 -3600
# Node ID fdb69dd527cd01a46f87efb380050559dcf12d37
# Parent  286ef4ced2164f4e9bf52fd0c52248182e69a6e6
IOMMU: don't immediately disable bus mastering on faults

Instead, give the owning domain at least a small opportunity of fixing
things up, and allow for rare faults to not bring down the device at
all.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Dario Faggioli <dario.faggioli@citrix.com>
---


diff -r 286ef4ced216 -r fdb69dd527cd xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c	Mon Nov 12 09:34:57 2012 +0100
+++ b/xen/drivers/passthrough/amd/iommu_init.c	Mon Nov 12 09:36:07 2012 +0100
@@ -566,7 +566,7 @@ static hw_irq_controller iommu_maskable_
 
 static void parse_event_log_entry(struct amd_iommu *iommu, u32 entry[])
 {
-    u16 domain_id, device_id, bdf, cword, flags;
+    u16 domain_id, device_id, bdf, flags;
     u32 code;
     u64 *addr;
     int count = 0;
@@ -620,18 +620,10 @@ static void parse_event_log_entry(struct
                "fault address = %#"PRIx64", flags = %#x\n",
                event_str[code-1], domain_id, device_id, *addr, flags);
 
-        /* Tell the device to stop DMAing; we can't rely on the guest to
-         * control it for us. */
         for ( bdf = 0; bdf < ivrs_bdf_entries; bdf++ )
             if ( get_dma_requestor_id(iommu->seg, bdf) == device_id )
-            {
-                cword = pci_conf_read16(iommu->seg, PCI_BUS(bdf),
-                                        PCI_SLOT(bdf), PCI_FUNC(bdf),
-                                        PCI_COMMAND);
-                pci_conf_write16(iommu->seg, PCI_BUS(bdf), PCI_SLOT(bdf),
-                                 PCI_FUNC(bdf), PCI_COMMAND, 
-                                 cword & ~PCI_COMMAND_MASTER);
-            }
+                pci_check_disable_device(iommu->seg, PCI_BUS(bdf),
+                                         PCI_DEVFN2(bdf));
     }
     else
     {
diff -r 286ef4ced216 -r fdb69dd527cd xen/drivers/passthrough/iommu.c
--- a/xen/drivers/passthrough/iommu.c	Mon Nov 12 09:34:57 2012 +0100
+++ b/xen/drivers/passthrough/iommu.c	Mon Nov 12 09:36:07 2012 +0100
@@ -215,6 +215,7 @@ static int device_assigned(u16 seg, u8 b
 static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn)
 {
     struct hvm_iommu *hd = domain_hvm_iommu(d);
+    struct pci_dev *pdev;
     int rc = 0;
 
     if ( !iommu_enabled || !hd->platform_ops )
@@ -228,6 +229,10 @@ static int assign_device(struct domain *
         return -EXDEV;
 
     spin_lock(&pcidevs_lock);
+    pdev = pci_get_pdev(seg, bus, devfn);
+    if ( pdev )
+        pdev->fault.count = 0;
+
     if ( (rc = hd->platform_ops->assign_device(d, seg, bus, devfn)) )
         goto done;
 
@@ -379,6 +384,8 @@ int deassign_device(struct domain *d, u1
         return ret;
     }
 
+    pdev->fault.count = 0;
+
     if ( !has_arch_pdevs(d) && need_iommu(d) )
     {
         d->need_iommu = 0;
diff -r 286ef4ced216 -r fdb69dd527cd xen/drivers/passthrough/pci.c
--- a/xen/drivers/passthrough/pci.c	Mon Nov 12 09:34:57 2012 +0100
+++ b/xen/drivers/passthrough/pci.c	Mon Nov 12 09:36:07 2012 +0100
@@ -672,6 +672,36 @@ int __init pci_device_detect(u16 seg, u8
     return 1;
 }
 
+void pci_check_disable_device(u16 seg, u8 bus, u8 devfn)
+{
+    struct pci_dev *pdev;
+    s_time_t now = NOW();
+    u16 cword;
+
+    spin_lock(&pcidevs_lock);
+    pdev = pci_get_pdev(seg, bus, devfn);
+    if ( pdev )
+    {
+        if ( now < pdev->fault.time ||
+             now - pdev->fault.time > MILLISECS(10) )
+            pdev->fault.count >>= 1;
+        pdev->fault.time = now;
+        if ( ++pdev->fault.count < PT_FAULT_THRESHOLD )
+            pdev = NULL;
+    }
+    spin_unlock(&pcidevs_lock);
+
+    if ( !pdev )
+        return;
+
+    /* Tell the device to stop DMAing; we can't rely on the guest to
+     * control it for us. */
+    cword = pci_conf_read16(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                            PCI_COMMAND);
+    pci_conf_write16(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                     PCI_COMMAND, cword & ~PCI_COMMAND_MASTER);
+}
+
 /*
  * scan pci devices to add all existed PCI devices to alldevs_list,
  * and setup pci hierarchy in array bus2bridge.
diff -r 286ef4ced216 -r fdb69dd527cd xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Mon Nov 12 09:34:57 2012 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Mon Nov 12 09:36:07 2012 +0100
@@ -917,7 +917,7 @@ static void __do_iommu_page_fault(struct
     while (1)
     {
         u8 fault_reason;
-        u16 source_id, cword;
+        u16 source_id;
         u32 data;
         u64 guest_addr;
         int type;
@@ -950,14 +950,8 @@ static void __do_iommu_page_fault(struct
         iommu_page_fault_do_one(iommu, type, fault_reason,
                                 source_id, guest_addr);
 
-        /* Tell the device to stop DMAing; we can't rely on the guest to
-         * control it for us. */
-        cword = pci_conf_read16(iommu->intel->drhd->segment,
-                                PCI_BUS(source_id), PCI_SLOT(source_id),
-                                PCI_FUNC(source_id), PCI_COMMAND);
-        pci_conf_write16(iommu->intel->drhd->segment, PCI_BUS(source_id),
-                         PCI_SLOT(source_id), PCI_FUNC(source_id),
-                         PCI_COMMAND, cword & ~PCI_COMMAND_MASTER);
+        pci_check_disable_device(iommu->intel->drhd->segment,
+                                 PCI_BUS(source_id), PCI_DEVFN2(source_id));
 
         fault_index++;
         if ( fault_index > cap_num_fault_regs(iommu->cap) )
diff -r 286ef4ced216 -r fdb69dd527cd xen/include/xen/pci.h
--- a/xen/include/xen/pci.h	Mon Nov 12 09:34:57 2012 +0100
+++ b/xen/include/xen/pci.h	Mon Nov 12 09:36:07 2012 +0100
@@ -64,6 +64,11 @@ struct pci_dev {
     const u8 devfn;
     struct pci_dev_info info;
     struct arch_pci_dev arch;
+    struct {
+        s_time_t time;
+        unsigned int count;
+#define PT_FAULT_THRESHOLD 10
+    } fault;
     u64 vf_rlen[6];
 };
 
@@ -107,6 +112,7 @@ int pci_hide_device(int bus, int devfn);
 struct pci_dev *pci_get_pdev(int seg, int bus, int devfn);
 struct pci_dev *pci_get_pdev_by_domain(
     struct domain *, int seg, int bus, int devfn);
+void pci_check_disable_device(u16 seg, u8 bus, u8 devfn);
 
 uint8_t pci_conf_read8(
     unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,

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

From xen-changelog-bounces@lists.xen.org Mon Nov 12 21:00:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Nov 2012 21:00: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 1TY17D-0003O1-KX; Mon, 12 Nov 2012 21:00:19 +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 1TY17C-0003Np-7w
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 21:00:18 +0000
Received: from [85.158.143.99:21840] by server-1.bemta-4.messagelabs.com id
	D1/25-27934-16361A05; Mon, 12 Nov 2012 21:00:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1352754015!24388445!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9443 invoked from network); 12 Nov 2012 21:00:16 -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;
	12 Nov 2012 21:00: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 1TY178-0007Of-KC
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 21:00:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TY177-0001Fn-UJ
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 21:00:14 +0000
Message-Id: <E1TY177-0001Fn-UJ@xenbits.xen.org>
Date: Mon, 12 Nov 2012 21:00:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] IOMMU: don't immediately disable bus
	mastering on faults
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352709367 -3600
# Node ID fdb69dd527cd01a46f87efb380050559dcf12d37
# Parent  286ef4ced2164f4e9bf52fd0c52248182e69a6e6
IOMMU: don't immediately disable bus mastering on faults

Instead, give the owning domain at least a small opportunity of fixing
things up, and allow for rare faults to not bring down the device at
all.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Dario Faggioli <dario.faggioli@citrix.com>
---


diff -r 286ef4ced216 -r fdb69dd527cd xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c	Mon Nov 12 09:34:57 2012 +0100
+++ b/xen/drivers/passthrough/amd/iommu_init.c	Mon Nov 12 09:36:07 2012 +0100
@@ -566,7 +566,7 @@ static hw_irq_controller iommu_maskable_
 
 static void parse_event_log_entry(struct amd_iommu *iommu, u32 entry[])
 {
-    u16 domain_id, device_id, bdf, cword, flags;
+    u16 domain_id, device_id, bdf, flags;
     u32 code;
     u64 *addr;
     int count = 0;
@@ -620,18 +620,10 @@ static void parse_event_log_entry(struct
                "fault address = %#"PRIx64", flags = %#x\n",
                event_str[code-1], domain_id, device_id, *addr, flags);
 
-        /* Tell the device to stop DMAing; we can't rely on the guest to
-         * control it for us. */
         for ( bdf = 0; bdf < ivrs_bdf_entries; bdf++ )
             if ( get_dma_requestor_id(iommu->seg, bdf) == device_id )
-            {
-                cword = pci_conf_read16(iommu->seg, PCI_BUS(bdf),
-                                        PCI_SLOT(bdf), PCI_FUNC(bdf),
-                                        PCI_COMMAND);
-                pci_conf_write16(iommu->seg, PCI_BUS(bdf), PCI_SLOT(bdf),
-                                 PCI_FUNC(bdf), PCI_COMMAND, 
-                                 cword & ~PCI_COMMAND_MASTER);
-            }
+                pci_check_disable_device(iommu->seg, PCI_BUS(bdf),
+                                         PCI_DEVFN2(bdf));
     }
     else
     {
diff -r 286ef4ced216 -r fdb69dd527cd xen/drivers/passthrough/iommu.c
--- a/xen/drivers/passthrough/iommu.c	Mon Nov 12 09:34:57 2012 +0100
+++ b/xen/drivers/passthrough/iommu.c	Mon Nov 12 09:36:07 2012 +0100
@@ -215,6 +215,7 @@ static int device_assigned(u16 seg, u8 b
 static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn)
 {
     struct hvm_iommu *hd = domain_hvm_iommu(d);
+    struct pci_dev *pdev;
     int rc = 0;
 
     if ( !iommu_enabled || !hd->platform_ops )
@@ -228,6 +229,10 @@ static int assign_device(struct domain *
         return -EXDEV;
 
     spin_lock(&pcidevs_lock);
+    pdev = pci_get_pdev(seg, bus, devfn);
+    if ( pdev )
+        pdev->fault.count = 0;
+
     if ( (rc = hd->platform_ops->assign_device(d, seg, bus, devfn)) )
         goto done;
 
@@ -379,6 +384,8 @@ int deassign_device(struct domain *d, u1
         return ret;
     }
 
+    pdev->fault.count = 0;
+
     if ( !has_arch_pdevs(d) && need_iommu(d) )
     {
         d->need_iommu = 0;
diff -r 286ef4ced216 -r fdb69dd527cd xen/drivers/passthrough/pci.c
--- a/xen/drivers/passthrough/pci.c	Mon Nov 12 09:34:57 2012 +0100
+++ b/xen/drivers/passthrough/pci.c	Mon Nov 12 09:36:07 2012 +0100
@@ -672,6 +672,36 @@ int __init pci_device_detect(u16 seg, u8
     return 1;
 }
 
+void pci_check_disable_device(u16 seg, u8 bus, u8 devfn)
+{
+    struct pci_dev *pdev;
+    s_time_t now = NOW();
+    u16 cword;
+
+    spin_lock(&pcidevs_lock);
+    pdev = pci_get_pdev(seg, bus, devfn);
+    if ( pdev )
+    {
+        if ( now < pdev->fault.time ||
+             now - pdev->fault.time > MILLISECS(10) )
+            pdev->fault.count >>= 1;
+        pdev->fault.time = now;
+        if ( ++pdev->fault.count < PT_FAULT_THRESHOLD )
+            pdev = NULL;
+    }
+    spin_unlock(&pcidevs_lock);
+
+    if ( !pdev )
+        return;
+
+    /* Tell the device to stop DMAing; we can't rely on the guest to
+     * control it for us. */
+    cword = pci_conf_read16(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                            PCI_COMMAND);
+    pci_conf_write16(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                     PCI_COMMAND, cword & ~PCI_COMMAND_MASTER);
+}
+
 /*
  * scan pci devices to add all existed PCI devices to alldevs_list,
  * and setup pci hierarchy in array bus2bridge.
diff -r 286ef4ced216 -r fdb69dd527cd xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Mon Nov 12 09:34:57 2012 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Mon Nov 12 09:36:07 2012 +0100
@@ -917,7 +917,7 @@ static void __do_iommu_page_fault(struct
     while (1)
     {
         u8 fault_reason;
-        u16 source_id, cword;
+        u16 source_id;
         u32 data;
         u64 guest_addr;
         int type;
@@ -950,14 +950,8 @@ static void __do_iommu_page_fault(struct
         iommu_page_fault_do_one(iommu, type, fault_reason,
                                 source_id, guest_addr);
 
-        /* Tell the device to stop DMAing; we can't rely on the guest to
-         * control it for us. */
-        cword = pci_conf_read16(iommu->intel->drhd->segment,
-                                PCI_BUS(source_id), PCI_SLOT(source_id),
-                                PCI_FUNC(source_id), PCI_COMMAND);
-        pci_conf_write16(iommu->intel->drhd->segment, PCI_BUS(source_id),
-                         PCI_SLOT(source_id), PCI_FUNC(source_id),
-                         PCI_COMMAND, cword & ~PCI_COMMAND_MASTER);
+        pci_check_disable_device(iommu->intel->drhd->segment,
+                                 PCI_BUS(source_id), PCI_DEVFN2(source_id));
 
         fault_index++;
         if ( fault_index > cap_num_fault_regs(iommu->cap) )
diff -r 286ef4ced216 -r fdb69dd527cd xen/include/xen/pci.h
--- a/xen/include/xen/pci.h	Mon Nov 12 09:34:57 2012 +0100
+++ b/xen/include/xen/pci.h	Mon Nov 12 09:36:07 2012 +0100
@@ -64,6 +64,11 @@ struct pci_dev {
     const u8 devfn;
     struct pci_dev_info info;
     struct arch_pci_dev arch;
+    struct {
+        s_time_t time;
+        unsigned int count;
+#define PT_FAULT_THRESHOLD 10
+    } fault;
     u64 vf_rlen[6];
 };
 
@@ -107,6 +112,7 @@ int pci_hide_device(int bus, int devfn);
 struct pci_dev *pci_get_pdev(int seg, int bus, int devfn);
 struct pci_dev *pci_get_pdev_by_domain(
     struct domain *, int seg, int bus, int devfn);
+void pci_check_disable_device(u16 seg, u8 bus, u8 devfn);
 
 uint8_t pci_conf_read8(
     unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,

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

From xen-changelog-bounces@lists.xen.org Mon Nov 12 21:00:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Nov 2012 21: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 1TY17F-0003OC-NA; Mon, 12 Nov 2012 21:00:21 +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 1TY17E-0003O6-Cv
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 21:00:20 +0000
Received: from [193.109.254.147:29211] by server-12.bemta-14.messagelabs.com
	id E1/AC-00510-36361A05; Mon, 12 Nov 2012 21:00:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1352754017!3732274!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5678 invoked from network); 12 Nov 2012 21:00:18 -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;
	12 Nov 2012 21:00: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 1TY17B-0007Oi-9k
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 21:00:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TY179-0001G5-31
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 21:00:16 +0000
Message-Id: <E1TY179-0001G5-31@xenbits.xen.org>
Date: Mon, 12 Nov 2012 21:00:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm x86 shadow: Fix typo in
	sh_invlpg sl3 page presence 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: "Change log for Mercurial \(receive only\)"
	<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 Matthew Daley <mattjd@gmail.com>
# Date 1352715420 0
# Node ID 279bbf2a0b485fce18af26473eca5e60d794c17b
# Parent  fdb69dd527cd01a46f87efb380050559dcf12d37
x86/mm x86 shadow: Fix typo in sh_invlpg sl3 page presence check

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r fdb69dd527cd -r 279bbf2a0b48 xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c	Mon Nov 12 09:36:07 2012 +0100
+++ b/xen/arch/x86/mm/shadow/multi.c	Mon Nov 12 10:17:00 2012 +0000
@@ -3505,7 +3505,7 @@ sh_invlpg(struct vcpu *v, unsigned long 
             perfc_incr(shadow_invlpg_fault);
             return 0;
         }
-        if ( (!shadow_l3e_get_flags(sl3e) & _PAGE_PRESENT) )
+        if ( !(shadow_l3e_get_flags(sl3e) & _PAGE_PRESENT) )
             return 0;
     }
 #else /* SHADOW_PAGING_LEVELS == 3 */

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

From xen-changelog-bounces@lists.xen.org Mon Nov 12 21:00:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Nov 2012 21: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 1TY17F-0003OC-NA; Mon, 12 Nov 2012 21:00:21 +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 1TY17E-0003O6-Cv
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 21:00:20 +0000
Received: from [193.109.254.147:29211] by server-12.bemta-14.messagelabs.com
	id E1/AC-00510-36361A05; Mon, 12 Nov 2012 21:00:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1352754017!3732274!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5678 invoked from network); 12 Nov 2012 21:00:18 -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;
	12 Nov 2012 21:00: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 1TY17B-0007Oi-9k
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 21:00:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TY179-0001G5-31
	for xen-changelog@lists.xensource.com; Mon, 12 Nov 2012 21:00:16 +0000
Message-Id: <E1TY179-0001G5-31@xenbits.xen.org>
Date: Mon, 12 Nov 2012 21:00:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm x86 shadow: Fix typo in
	sh_invlpg sl3 page presence 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: "Change log for Mercurial \(receive only\)"
	<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 Matthew Daley <mattjd@gmail.com>
# Date 1352715420 0
# Node ID 279bbf2a0b485fce18af26473eca5e60d794c17b
# Parent  fdb69dd527cd01a46f87efb380050559dcf12d37
x86/mm x86 shadow: Fix typo in sh_invlpg sl3 page presence check

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r fdb69dd527cd -r 279bbf2a0b48 xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c	Mon Nov 12 09:36:07 2012 +0100
+++ b/xen/arch/x86/mm/shadow/multi.c	Mon Nov 12 10:17:00 2012 +0000
@@ -3505,7 +3505,7 @@ sh_invlpg(struct vcpu *v, unsigned long 
             perfc_incr(shadow_invlpg_fault);
             return 0;
         }
-        if ( (!shadow_l3e_get_flags(sl3e) & _PAGE_PRESENT) )
+        if ( !(shadow_l3e_get_flags(sl3e) & _PAGE_PRESENT) )
             return 0;
     }
 #else /* SHADOW_PAGING_LEVELS == 3 */

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 00:55:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 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.xen.org>)
	id 1TY4md-0006wz-KL; Tue, 13 Nov 2012 00: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 1TY4mb-0006wV-9g
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:17 +0000
Received: from [85.158.139.211:14136] by server-7.bemta-5.messagelabs.com id
	B0/B6-23096-47A91A05; Tue, 13 Nov 2012 00:55:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-206.messagelabs.com!1352768113!19861076!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4203 invoked from network); 13 Nov 2012 00:55:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Nov 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 1TY4mX-0001rQ-AA
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TY4mW-0007GX-It
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:12 +0000
Message-Id: <E1TY4mW-0007GX-It@xenbits.xen.org>
Date: Tue, 13 Nov 2012 00:55:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: Make restore work properly
	with PV superpage flag
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Dave McCracken <dcm@mccr.org>
# Date 1352739799 0
# Node ID 139f059cb0b38f54faa1b04ec5c513706ba0d6db
# Parent  279bbf2a0b485fce18af26473eca5e60d794c17b
tools: Make restore work properly with PV superpage flag

For PV guests, the superpage flag means to unconditionally allocate all
pages as superpages, which is required for Linux hugepages to work.  Support
for this on restore was not supported.  This patch adds proper support for
the superpage flag on restore.

For HVM guests, the superpage flag has been used to mean attempt to allocate
superpages if possible on restore.  This functionality has been preserved.

Signed-off-by: Dave McCracken <dave.mccracken@oracle.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 279bbf2a0b48 -r 139f059cb0b3 tools/libxc/xc_domain_restore.c
--- a/tools/libxc/xc_domain_restore.c	Mon Nov 12 10:17:00 2012 +0000
+++ b/tools/libxc/xc_domain_restore.c	Mon Nov 12 17:03:19 2012 +0000
@@ -23,6 +23,19 @@
  *
  */
 
+/*
+ * The superpages flag in restore has two different meanings depending on
+ * the type of domain.
+ *
+ * For an HVM domain, the flag means to look for properly aligned contiguous
+ * pages and try to allocate a superpage to satisfy it.  If that fails,
+ * fall back to small pages.
+ *
+ * For a PV domain, the flag means allocate all memory as superpages.  If that
+ * fails, the restore fails.  This behavior is required for PV guests who
+ * want to use superpages.
+ */
+
 #include <stdlib.h>
 #include <unistd.h>
 
@@ -41,6 +54,9 @@ struct restore_ctx {
     xen_pfn_t *live_p2m; /* Live mapping of the table mapping each PFN to its current MFN. */
     xen_pfn_t *p2m; /* A table mapping each PFN to its new MFN. */
     xen_pfn_t *p2m_batch; /* A table of P2M mappings in the current region.  */
+    xen_pfn_t *p2m_saved_batch; /* Copy of p2m_batch array for pv superpage alloc */
+    int superpages; /* Superpage allocation has been requested */
+    int hvm;    /* This is an hvm domain */
     int completed; /* Set when a consistent image is available */
     int last_checkpoint; /* Set when we should commit to the current checkpoint when it completes. */
     int compressing; /* Set when sender signals that pages would be sent compressed (for Remus) */
@@ -49,11 +65,6 @@ struct restore_ctx {
 
 #define HEARTBEAT_MS 1000
 
-#define SUPERPAGE_PFN_SHIFT  9
-#define SUPERPAGE_NR_PFNS    (1UL << SUPERPAGE_PFN_SHIFT)
-
-#define SUPER_PAGE_START(pfn)    (((pfn) & (SUPERPAGE_NR_PFNS-1)) == 0 )
-
 #ifndef __MINIOS__
 static ssize_t rdexact(xc_interface *xch, struct restore_ctx *ctx,
                        int fd, void* buf, size_t size)
@@ -103,6 +114,49 @@ static ssize_t rdexact(xc_interface *xch
 #else
 #define RDEXACT read_exact
 #endif
+
+#define SUPERPAGE_PFN_SHIFT  9
+#define SUPERPAGE_NR_PFNS    (1UL << SUPERPAGE_PFN_SHIFT)
+#define SUPERPAGE(_pfn) ((_pfn) & (~(SUPERPAGE_NR_PFNS-1)))
+#define SUPER_PAGE_START(pfn)    (((pfn) & (SUPERPAGE_NR_PFNS-1)) == 0 )
+
+/*
+** When we're restoring into a pv superpage-allocated guest, we take
+** a copy of the p2m_batch array to preserve the pfn, then allocate the
+** corresponding superpages.  We then fill in the p2m array using the saved
+** pfns.
+*/
+static int alloc_superpage_mfns(
+    xc_interface *xch, uint32_t dom, struct restore_ctx *ctx, int nr_mfns)
+{
+    int i, j, max = 0;
+    unsigned long pfn, base_pfn, mfn;
+
+    for (i = 0; i < nr_mfns; i++)
+    {
+        pfn = ctx->p2m_batch[i];
+        base_pfn = SUPERPAGE(pfn);
+        if (ctx->p2m[base_pfn] != (INVALID_P2M_ENTRY-2))
+        {
+            ctx->p2m_saved_batch[max] = base_pfn;
+            ctx->p2m_batch[max] = base_pfn;
+            max++;
+            ctx->p2m[base_pfn] = INVALID_P2M_ENTRY-2;
+        }
+    }
+    if (xc_domain_populate_physmap_exact(xch, dom, max, SUPERPAGE_PFN_SHIFT,
+                                         0, ctx->p2m_batch) != 0)
+        return 1;
+
+    for (i = 0; i < max; i++)
+    {
+        mfn = ctx->p2m_batch[i];
+        pfn = ctx->p2m_saved_batch[i];
+        for (j = 0; j < SUPERPAGE_NR_PFNS; j++)
+            ctx->p2m[pfn++] = mfn++;
+    }
+    return 0;
+}
 /*
 ** In the state file (or during transfer), all page-table pages are
 ** converted into a 'canonical' form where references to actual mfns
@@ -113,7 +167,7 @@ static ssize_t rdexact(xc_interface *xch
 static int uncanonicalize_pagetable(
     xc_interface *xch, uint32_t dom, struct restore_ctx *ctx, void *page)
 {
-    int i, pte_last, nr_mfns = 0;
+    int i, rc, pte_last, nr_mfns = 0;
     unsigned long pfn;
     uint64_t pte;
     struct domain_info_context *dinfo = &ctx->dinfo;
@@ -152,13 +206,20 @@ static int uncanonicalize_pagetable(
     }
 
     /* Allocate the requisite number of mfns. */
-    if ( nr_mfns &&
-         (xc_domain_populate_physmap_exact(xch, dom, nr_mfns, 0, 0,
-                                            ctx->p2m_batch) != 0) )
-    { 
-        ERROR("Failed to allocate memory for batch.!\n"); 
-        errno = ENOMEM;
-        return 0; 
+    if (nr_mfns)
+    {
+        if (!ctx->hvm && ctx->superpages)
+            rc = alloc_superpage_mfns(xch, dom, ctx, nr_mfns);
+        else
+            rc = xc_domain_populate_physmap_exact(xch, dom, nr_mfns, 0, 0,
+                                                  ctx->p2m_batch);
+
+        if (rc)
+        {
+            ERROR("Failed to allocate memory for batch.!\n");
+            errno = ENOMEM;
+            return 0;
+        }
     }
     
     /* Second pass: uncanonicalize each present PTE */
@@ -1018,8 +1079,8 @@ static int pagebuf_get(xc_interface *xch
 
 static int apply_batch(xc_interface *xch, uint32_t dom, struct restore_ctx *ctx,
                        xen_pfn_t* region_mfn, unsigned long* pfn_type, int pae_extended_cr3,
-                       unsigned int hvm, struct xc_mmu* mmu,
-                       pagebuf_t* pagebuf, int curbatch, int superpages)
+                       struct xc_mmu* mmu,
+                       pagebuf_t* pagebuf, int curbatch)
 {
     int i, j, curpage, nr_mfns;
     int k, scount;
@@ -1061,7 +1122,7 @@ static int apply_batch(xc_interface *xch
                 /* Is this the next expected continuation? */
                 if ( pfn == superpage_start + scount )
                 {
-                    if ( !superpages )
+                    if ( !ctx->superpages )
                     {
                         ERROR("Unexpexted codepath with no superpages");
                         return -1;
@@ -1114,16 +1175,17 @@ static int apply_batch(xc_interface *xch
             }
 
             /* Are we ready to start a new superpage candidate? */
-            if ( superpages && SUPER_PAGE_START(pfn) )
+            if ( ctx->hvm && ctx->superpages && SUPER_PAGE_START(pfn) )
             {
                 superpage_start=pfn;
                 scount++;
-                continue;
             }
-            
-            /* Add the current pfn to pfn_batch */
-            ctx->p2m_batch[nr_mfns++] = pfn; 
-            ctx->p2m[pfn]--;
+            else
+            {
+                /* Add the current pfn to pfn_batch */
+                ctx->p2m_batch[nr_mfns++] = pfn;
+                ctx->p2m[pfn]--;
+            }
         }
     }
 
@@ -1144,9 +1206,14 @@ static int apply_batch(xc_interface *xch
     {
         DPRINTF("Mapping order 0,  %d; first pfn %lx\n", nr_mfns, ctx->p2m_batch[0]);
     
-        if(xc_domain_populate_physmap_exact(xch, dom, nr_mfns, 0,
-                                            0, ctx->p2m_batch) != 0) 
-        { 
+        if (!ctx->hvm && ctx->superpages)
+            rc = alloc_superpage_mfns(xch, dom, ctx, nr_mfns);
+        else
+            rc = xc_domain_populate_physmap_exact(xch, dom, nr_mfns, 0, 0,
+                                                  ctx->p2m_batch);
+
+        if (rc)
+        {
             ERROR("Failed to allocate memory for batch.!\n"); 
             errno = ENOMEM;
             return -1;
@@ -1175,7 +1242,7 @@ static int apply_batch(xc_interface *xch
              || pagetype == XEN_DOMCTL_PFINFO_XALLOC )
             region_mfn[i] = ~0UL; /* map will fail but we don't care */
         else
-            region_mfn[i] = hvm ? pfn : ctx->p2m[pfn]; 
+            region_mfn[i] = ctx->hvm ? pfn : ctx->p2m[pfn];
     }
 
     /* Map relevant mfns */
@@ -1298,7 +1365,7 @@ static int apply_batch(xc_interface *xch
             }
         }
 
-        if ( !hvm &&
+        if ( !ctx->hvm &&
              xc_add_mmu_update(xch, mmu,
                                (((unsigned long long)mfn) << PAGE_SHIFT)
                                | MMU_MACHPHYS_UPDATE, pfn) )
@@ -1389,6 +1456,9 @@ int xc_domain_restore(xc_interface *xch,
 
     memset(ctx, 0, sizeof(*ctx));
 
+    ctx->superpages = superpages;
+    ctx->hvm = hvm;
+
     ctxt = xc_hypercall_buffer_alloc(xch, ctxt, sizeof(*ctxt));
 
     if ( ctxt == NULL )
@@ -1452,6 +1522,9 @@ int xc_domain_restore(xc_interface *xch,
 
     region_mfn = malloc(ROUNDUP(MAX_BATCH_SIZE * sizeof(xen_pfn_t), PAGE_SHIFT));
     ctx->p2m_batch = malloc(ROUNDUP(MAX_BATCH_SIZE * sizeof(xen_pfn_t), PAGE_SHIFT));
+    if (!ctx->hvm && ctx->superpages)
+        ctx->p2m_saved_batch =
+            malloc(ROUNDUP(MAX_BATCH_SIZE * sizeof(xen_pfn_t), PAGE_SHIFT));
 
     if ( (ctx->p2m == NULL) || (pfn_type == NULL) ||
          (region_mfn == NULL) || (ctx->p2m_batch == NULL) )
@@ -1575,8 +1648,7 @@ int xc_domain_restore(xc_interface *xch,
             int brc;
 
             brc = apply_batch(xch, dom, ctx, region_mfn, pfn_type,
-                              pae_extended_cr3, hvm, mmu, &pagebuf, curbatch,
-                              superpages);
+                              pae_extended_cr3, mmu, &pagebuf, curbatch);
             if ( brc < 0 )
                 goto out;
 

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 00:55:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 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.xen.org>)
	id 1TY4md-0006wz-KL; Tue, 13 Nov 2012 00: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 1TY4mb-0006wV-9g
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:17 +0000
Received: from [85.158.139.211:14136] by server-7.bemta-5.messagelabs.com id
	B0/B6-23096-47A91A05; Tue, 13 Nov 2012 00:55:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-206.messagelabs.com!1352768113!19861076!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4203 invoked from network); 13 Nov 2012 00:55:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Nov 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 1TY4mX-0001rQ-AA
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TY4mW-0007GX-It
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:12 +0000
Message-Id: <E1TY4mW-0007GX-It@xenbits.xen.org>
Date: Tue, 13 Nov 2012 00:55:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: Make restore work properly
	with PV superpage flag
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Dave McCracken <dcm@mccr.org>
# Date 1352739799 0
# Node ID 139f059cb0b38f54faa1b04ec5c513706ba0d6db
# Parent  279bbf2a0b485fce18af26473eca5e60d794c17b
tools: Make restore work properly with PV superpage flag

For PV guests, the superpage flag means to unconditionally allocate all
pages as superpages, which is required for Linux hugepages to work.  Support
for this on restore was not supported.  This patch adds proper support for
the superpage flag on restore.

For HVM guests, the superpage flag has been used to mean attempt to allocate
superpages if possible on restore.  This functionality has been preserved.

Signed-off-by: Dave McCracken <dave.mccracken@oracle.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 279bbf2a0b48 -r 139f059cb0b3 tools/libxc/xc_domain_restore.c
--- a/tools/libxc/xc_domain_restore.c	Mon Nov 12 10:17:00 2012 +0000
+++ b/tools/libxc/xc_domain_restore.c	Mon Nov 12 17:03:19 2012 +0000
@@ -23,6 +23,19 @@
  *
  */
 
+/*
+ * The superpages flag in restore has two different meanings depending on
+ * the type of domain.
+ *
+ * For an HVM domain, the flag means to look for properly aligned contiguous
+ * pages and try to allocate a superpage to satisfy it.  If that fails,
+ * fall back to small pages.
+ *
+ * For a PV domain, the flag means allocate all memory as superpages.  If that
+ * fails, the restore fails.  This behavior is required for PV guests who
+ * want to use superpages.
+ */
+
 #include <stdlib.h>
 #include <unistd.h>
 
@@ -41,6 +54,9 @@ struct restore_ctx {
     xen_pfn_t *live_p2m; /* Live mapping of the table mapping each PFN to its current MFN. */
     xen_pfn_t *p2m; /* A table mapping each PFN to its new MFN. */
     xen_pfn_t *p2m_batch; /* A table of P2M mappings in the current region.  */
+    xen_pfn_t *p2m_saved_batch; /* Copy of p2m_batch array for pv superpage alloc */
+    int superpages; /* Superpage allocation has been requested */
+    int hvm;    /* This is an hvm domain */
     int completed; /* Set when a consistent image is available */
     int last_checkpoint; /* Set when we should commit to the current checkpoint when it completes. */
     int compressing; /* Set when sender signals that pages would be sent compressed (for Remus) */
@@ -49,11 +65,6 @@ struct restore_ctx {
 
 #define HEARTBEAT_MS 1000
 
-#define SUPERPAGE_PFN_SHIFT  9
-#define SUPERPAGE_NR_PFNS    (1UL << SUPERPAGE_PFN_SHIFT)
-
-#define SUPER_PAGE_START(pfn)    (((pfn) & (SUPERPAGE_NR_PFNS-1)) == 0 )
-
 #ifndef __MINIOS__
 static ssize_t rdexact(xc_interface *xch, struct restore_ctx *ctx,
                        int fd, void* buf, size_t size)
@@ -103,6 +114,49 @@ static ssize_t rdexact(xc_interface *xch
 #else
 #define RDEXACT read_exact
 #endif
+
+#define SUPERPAGE_PFN_SHIFT  9
+#define SUPERPAGE_NR_PFNS    (1UL << SUPERPAGE_PFN_SHIFT)
+#define SUPERPAGE(_pfn) ((_pfn) & (~(SUPERPAGE_NR_PFNS-1)))
+#define SUPER_PAGE_START(pfn)    (((pfn) & (SUPERPAGE_NR_PFNS-1)) == 0 )
+
+/*
+** When we're restoring into a pv superpage-allocated guest, we take
+** a copy of the p2m_batch array to preserve the pfn, then allocate the
+** corresponding superpages.  We then fill in the p2m array using the saved
+** pfns.
+*/
+static int alloc_superpage_mfns(
+    xc_interface *xch, uint32_t dom, struct restore_ctx *ctx, int nr_mfns)
+{
+    int i, j, max = 0;
+    unsigned long pfn, base_pfn, mfn;
+
+    for (i = 0; i < nr_mfns; i++)
+    {
+        pfn = ctx->p2m_batch[i];
+        base_pfn = SUPERPAGE(pfn);
+        if (ctx->p2m[base_pfn] != (INVALID_P2M_ENTRY-2))
+        {
+            ctx->p2m_saved_batch[max] = base_pfn;
+            ctx->p2m_batch[max] = base_pfn;
+            max++;
+            ctx->p2m[base_pfn] = INVALID_P2M_ENTRY-2;
+        }
+    }
+    if (xc_domain_populate_physmap_exact(xch, dom, max, SUPERPAGE_PFN_SHIFT,
+                                         0, ctx->p2m_batch) != 0)
+        return 1;
+
+    for (i = 0; i < max; i++)
+    {
+        mfn = ctx->p2m_batch[i];
+        pfn = ctx->p2m_saved_batch[i];
+        for (j = 0; j < SUPERPAGE_NR_PFNS; j++)
+            ctx->p2m[pfn++] = mfn++;
+    }
+    return 0;
+}
 /*
 ** In the state file (or during transfer), all page-table pages are
 ** converted into a 'canonical' form where references to actual mfns
@@ -113,7 +167,7 @@ static ssize_t rdexact(xc_interface *xch
 static int uncanonicalize_pagetable(
     xc_interface *xch, uint32_t dom, struct restore_ctx *ctx, void *page)
 {
-    int i, pte_last, nr_mfns = 0;
+    int i, rc, pte_last, nr_mfns = 0;
     unsigned long pfn;
     uint64_t pte;
     struct domain_info_context *dinfo = &ctx->dinfo;
@@ -152,13 +206,20 @@ static int uncanonicalize_pagetable(
     }
 
     /* Allocate the requisite number of mfns. */
-    if ( nr_mfns &&
-         (xc_domain_populate_physmap_exact(xch, dom, nr_mfns, 0, 0,
-                                            ctx->p2m_batch) != 0) )
-    { 
-        ERROR("Failed to allocate memory for batch.!\n"); 
-        errno = ENOMEM;
-        return 0; 
+    if (nr_mfns)
+    {
+        if (!ctx->hvm && ctx->superpages)
+            rc = alloc_superpage_mfns(xch, dom, ctx, nr_mfns);
+        else
+            rc = xc_domain_populate_physmap_exact(xch, dom, nr_mfns, 0, 0,
+                                                  ctx->p2m_batch);
+
+        if (rc)
+        {
+            ERROR("Failed to allocate memory for batch.!\n");
+            errno = ENOMEM;
+            return 0;
+        }
     }
     
     /* Second pass: uncanonicalize each present PTE */
@@ -1018,8 +1079,8 @@ static int pagebuf_get(xc_interface *xch
 
 static int apply_batch(xc_interface *xch, uint32_t dom, struct restore_ctx *ctx,
                        xen_pfn_t* region_mfn, unsigned long* pfn_type, int pae_extended_cr3,
-                       unsigned int hvm, struct xc_mmu* mmu,
-                       pagebuf_t* pagebuf, int curbatch, int superpages)
+                       struct xc_mmu* mmu,
+                       pagebuf_t* pagebuf, int curbatch)
 {
     int i, j, curpage, nr_mfns;
     int k, scount;
@@ -1061,7 +1122,7 @@ static int apply_batch(xc_interface *xch
                 /* Is this the next expected continuation? */
                 if ( pfn == superpage_start + scount )
                 {
-                    if ( !superpages )
+                    if ( !ctx->superpages )
                     {
                         ERROR("Unexpexted codepath with no superpages");
                         return -1;
@@ -1114,16 +1175,17 @@ static int apply_batch(xc_interface *xch
             }
 
             /* Are we ready to start a new superpage candidate? */
-            if ( superpages && SUPER_PAGE_START(pfn) )
+            if ( ctx->hvm && ctx->superpages && SUPER_PAGE_START(pfn) )
             {
                 superpage_start=pfn;
                 scount++;
-                continue;
             }
-            
-            /* Add the current pfn to pfn_batch */
-            ctx->p2m_batch[nr_mfns++] = pfn; 
-            ctx->p2m[pfn]--;
+            else
+            {
+                /* Add the current pfn to pfn_batch */
+                ctx->p2m_batch[nr_mfns++] = pfn;
+                ctx->p2m[pfn]--;
+            }
         }
     }
 
@@ -1144,9 +1206,14 @@ static int apply_batch(xc_interface *xch
     {
         DPRINTF("Mapping order 0,  %d; first pfn %lx\n", nr_mfns, ctx->p2m_batch[0]);
     
-        if(xc_domain_populate_physmap_exact(xch, dom, nr_mfns, 0,
-                                            0, ctx->p2m_batch) != 0) 
-        { 
+        if (!ctx->hvm && ctx->superpages)
+            rc = alloc_superpage_mfns(xch, dom, ctx, nr_mfns);
+        else
+            rc = xc_domain_populate_physmap_exact(xch, dom, nr_mfns, 0, 0,
+                                                  ctx->p2m_batch);
+
+        if (rc)
+        {
             ERROR("Failed to allocate memory for batch.!\n"); 
             errno = ENOMEM;
             return -1;
@@ -1175,7 +1242,7 @@ static int apply_batch(xc_interface *xch
              || pagetype == XEN_DOMCTL_PFINFO_XALLOC )
             region_mfn[i] = ~0UL; /* map will fail but we don't care */
         else
-            region_mfn[i] = hvm ? pfn : ctx->p2m[pfn]; 
+            region_mfn[i] = ctx->hvm ? pfn : ctx->p2m[pfn];
     }
 
     /* Map relevant mfns */
@@ -1298,7 +1365,7 @@ static int apply_batch(xc_interface *xch
             }
         }
 
-        if ( !hvm &&
+        if ( !ctx->hvm &&
              xc_add_mmu_update(xch, mmu,
                                (((unsigned long long)mfn) << PAGE_SHIFT)
                                | MMU_MACHPHYS_UPDATE, pfn) )
@@ -1389,6 +1456,9 @@ int xc_domain_restore(xc_interface *xch,
 
     memset(ctx, 0, sizeof(*ctx));
 
+    ctx->superpages = superpages;
+    ctx->hvm = hvm;
+
     ctxt = xc_hypercall_buffer_alloc(xch, ctxt, sizeof(*ctxt));
 
     if ( ctxt == NULL )
@@ -1452,6 +1522,9 @@ int xc_domain_restore(xc_interface *xch,
 
     region_mfn = malloc(ROUNDUP(MAX_BATCH_SIZE * sizeof(xen_pfn_t), PAGE_SHIFT));
     ctx->p2m_batch = malloc(ROUNDUP(MAX_BATCH_SIZE * sizeof(xen_pfn_t), PAGE_SHIFT));
+    if (!ctx->hvm && ctx->superpages)
+        ctx->p2m_saved_batch =
+            malloc(ROUNDUP(MAX_BATCH_SIZE * sizeof(xen_pfn_t), PAGE_SHIFT));
 
     if ( (ctx->p2m == NULL) || (pfn_type == NULL) ||
          (region_mfn == NULL) || (ctx->p2m_batch == NULL) )
@@ -1575,8 +1648,7 @@ int xc_domain_restore(xc_interface *xch,
             int brc;
 
             brc = apply_batch(xch, dom, ctx, region_mfn, pfn_type,
-                              pae_extended_cr3, hvm, mmu, &pagebuf, curbatch,
-                              superpages);
+                              pae_extended_cr3, mmu, &pagebuf, curbatch);
             if ( brc < 0 )
                 goto out;
 

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 00:55:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 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.xen.org>)
	id 1TY4me-0006xP-UK; Tue, 13 Nov 2012 00:55:20 +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 1TY4mc-0006wj-Ev
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:19 +0000
Received: from [85.158.138.51:17798] by server-3.bemta-3.messagelabs.com id
	BE/AC-31566-57A91A05; Tue, 13 Nov 2012 00:55:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1352768114!23412917!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23350 invoked from network); 13 Nov 2012 00:55:16 -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;
	13 Nov 2012 00: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 1TY4mX-0001rT-Vf
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TY4mX-0007Gm-KU
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:13 +0000
Message-Id: <E1TY4mX-0007Gm-KU@xenbits.xen.org>
Date: Tue, 13 Nov 2012 00:55:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: Synchronize privcmd header
	constants
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Andres Lagar-Cavilla <andres@lagarcavilla.org>
# Date 1352739800 0
# Node ID ff9750a630d8c742c630e7bb6c1b3fe2aeda0a37
# Parent  139f059cb0b38f54faa1b04ec5c513706ba0d6db
tools: Synchronize privcmd header constants

Since Linux's git commit ceb90fa0a8008059ecbbf9114cb89dc71a730bb6,
the privcmd.h interface between Linux and libxc specifies two new
constants, PRIVCMD_MMAPBATCH_MFN_ERROR and
PRIVCMD_MMAPBATCH_PAGED_ERROR. These constants represent the error
codes encoded in the top nibble of an mfn slot passed to the legacy
MMAPBATCH ioctl.

In particular, libxenctrl checks for the equivalent of the latter
constant when dealing with paged out frames that might be the target
of a foreign map.

Previously, the relevant constant was defined in the domctl hypervisor
interface header (XEN_DOMCTL_PFINFO_PAGEDTAB). Because this
top-nibble encoding is a contract between the dom0 kernel and libxc,
a domctl.h definition is misplaced.

- Sync the privcmd.h header to that now available in upstream Linux
- Update libxc appropriately
- Remove the unnecessary constant in domctl.h

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Ian Campbell <ian.campbelL@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 139f059cb0b3 -r ff9750a630d8 tools/include/xen-sys/Linux/privcmd.h
--- a/tools/include/xen-sys/Linux/privcmd.h	Mon Nov 12 17:03:19 2012 +0000
+++ b/tools/include/xen-sys/Linux/privcmd.h	Mon Nov 12 17:03:20 2012 +0000
@@ -64,6 +64,9 @@ typedef struct privcmd_mmapbatch {
 	xen_pfn_t __user *arr; /* array of mfns - top nibble set on err */
 } privcmd_mmapbatch_t; 
 
+#define PRIVCMD_MMAPBATCH_MFN_ERROR     0xf0000000U
+#define PRIVCMD_MMAPBATCH_PAGED_ERROR   0x80000000U
+
 typedef struct privcmd_mmapbatch_v2 {
 	unsigned int num; /* number of pages to populate */
 	domid_t dom;      /* target domain */
diff -r 139f059cb0b3 -r ff9750a630d8 tools/libxc/xc_linux_osdep.c
--- a/tools/libxc/xc_linux_osdep.c	Mon Nov 12 17:03:19 2012 +0000
+++ b/tools/libxc/xc_linux_osdep.c	Mon Nov 12 17:03:20 2012 +0000
@@ -129,7 +129,7 @@ static int xc_map_foreign_batch_single(i
 
     do
     {
-        *mfn ^= XEN_DOMCTL_PFINFO_PAGEDTAB;
+        *mfn ^= PRIVCMD_MMAPBATCH_PAGED_ERROR;
         usleep(100);
         rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH, &ioctlx);
     }
@@ -166,8 +166,8 @@ static void *linux_privcmd_map_foreign_b
 
         for ( i = 0; i < num; i++ )
         {
-            if ( (arr[i] & XEN_DOMCTL_PFINFO_LTAB_MASK) ==
-                 XEN_DOMCTL_PFINFO_PAGEDTAB )
+            if ( (arr[i] & PRIVCMD_MMAPBATCH_MFN_ERROR) ==
+                           PRIVCMD_MMAPBATCH_PAGED_ERROR )
             {
                 unsigned long paged_addr = (unsigned long)addr + (i << XC_PAGE_SHIFT);
                 rc = xc_map_foreign_batch_single(fd, dom, &arr[i],
@@ -323,12 +323,12 @@ static void *linux_privcmd_map_foreign_b
             default:
                 err[i] = -EINVAL;
                 continue;
-            case XEN_DOMCTL_PFINFO_PAGEDTAB:
+            case PRIVCMD_MMAPBATCH_PAGED_ERROR:
                 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 )
diff -r 139f059cb0b3 -r ff9750a630d8 xen/include/public/domctl.h
--- a/xen/include/public/domctl.h	Mon Nov 12 17:03:19 2012 +0000
+++ b/xen/include/public/domctl.h	Mon Nov 12 17:03:20 2012 +0000
@@ -136,7 +136,6 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_getme
 #define XEN_DOMCTL_PFINFO_LPINTAB (0x1U<<31)
 #define XEN_DOMCTL_PFINFO_XTAB    (0xfU<<28) /* invalid page */
 #define XEN_DOMCTL_PFINFO_XALLOC  (0xeU<<28) /* allocate-only page */
-#define XEN_DOMCTL_PFINFO_PAGEDTAB (0x8U<<28)
 #define XEN_DOMCTL_PFINFO_LTAB_MASK (0xfU<<28)
 
 struct xen_domctl_getpageframeinfo {

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 00:55:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 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.xen.org>)
	id 1TY4me-0006xP-UK; Tue, 13 Nov 2012 00:55:20 +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 1TY4mc-0006wj-Ev
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:19 +0000
Received: from [85.158.138.51:17798] by server-3.bemta-3.messagelabs.com id
	BE/AC-31566-57A91A05; Tue, 13 Nov 2012 00:55:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1352768114!23412917!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23350 invoked from network); 13 Nov 2012 00:55:16 -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;
	13 Nov 2012 00: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 1TY4mX-0001rT-Vf
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TY4mX-0007Gm-KU
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:13 +0000
Message-Id: <E1TY4mX-0007Gm-KU@xenbits.xen.org>
Date: Tue, 13 Nov 2012 00:55:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: Synchronize privcmd header
	constants
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Andres Lagar-Cavilla <andres@lagarcavilla.org>
# Date 1352739800 0
# Node ID ff9750a630d8c742c630e7bb6c1b3fe2aeda0a37
# Parent  139f059cb0b38f54faa1b04ec5c513706ba0d6db
tools: Synchronize privcmd header constants

Since Linux's git commit ceb90fa0a8008059ecbbf9114cb89dc71a730bb6,
the privcmd.h interface between Linux and libxc specifies two new
constants, PRIVCMD_MMAPBATCH_MFN_ERROR and
PRIVCMD_MMAPBATCH_PAGED_ERROR. These constants represent the error
codes encoded in the top nibble of an mfn slot passed to the legacy
MMAPBATCH ioctl.

In particular, libxenctrl checks for the equivalent of the latter
constant when dealing with paged out frames that might be the target
of a foreign map.

Previously, the relevant constant was defined in the domctl hypervisor
interface header (XEN_DOMCTL_PFINFO_PAGEDTAB). Because this
top-nibble encoding is a contract between the dom0 kernel and libxc,
a domctl.h definition is misplaced.

- Sync the privcmd.h header to that now available in upstream Linux
- Update libxc appropriately
- Remove the unnecessary constant in domctl.h

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Ian Campbell <ian.campbelL@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 139f059cb0b3 -r ff9750a630d8 tools/include/xen-sys/Linux/privcmd.h
--- a/tools/include/xen-sys/Linux/privcmd.h	Mon Nov 12 17:03:19 2012 +0000
+++ b/tools/include/xen-sys/Linux/privcmd.h	Mon Nov 12 17:03:20 2012 +0000
@@ -64,6 +64,9 @@ typedef struct privcmd_mmapbatch {
 	xen_pfn_t __user *arr; /* array of mfns - top nibble set on err */
 } privcmd_mmapbatch_t; 
 
+#define PRIVCMD_MMAPBATCH_MFN_ERROR     0xf0000000U
+#define PRIVCMD_MMAPBATCH_PAGED_ERROR   0x80000000U
+
 typedef struct privcmd_mmapbatch_v2 {
 	unsigned int num; /* number of pages to populate */
 	domid_t dom;      /* target domain */
diff -r 139f059cb0b3 -r ff9750a630d8 tools/libxc/xc_linux_osdep.c
--- a/tools/libxc/xc_linux_osdep.c	Mon Nov 12 17:03:19 2012 +0000
+++ b/tools/libxc/xc_linux_osdep.c	Mon Nov 12 17:03:20 2012 +0000
@@ -129,7 +129,7 @@ static int xc_map_foreign_batch_single(i
 
     do
     {
-        *mfn ^= XEN_DOMCTL_PFINFO_PAGEDTAB;
+        *mfn ^= PRIVCMD_MMAPBATCH_PAGED_ERROR;
         usleep(100);
         rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH, &ioctlx);
     }
@@ -166,8 +166,8 @@ static void *linux_privcmd_map_foreign_b
 
         for ( i = 0; i < num; i++ )
         {
-            if ( (arr[i] & XEN_DOMCTL_PFINFO_LTAB_MASK) ==
-                 XEN_DOMCTL_PFINFO_PAGEDTAB )
+            if ( (arr[i] & PRIVCMD_MMAPBATCH_MFN_ERROR) ==
+                           PRIVCMD_MMAPBATCH_PAGED_ERROR )
             {
                 unsigned long paged_addr = (unsigned long)addr + (i << XC_PAGE_SHIFT);
                 rc = xc_map_foreign_batch_single(fd, dom, &arr[i],
@@ -323,12 +323,12 @@ static void *linux_privcmd_map_foreign_b
             default:
                 err[i] = -EINVAL;
                 continue;
-            case XEN_DOMCTL_PFINFO_PAGEDTAB:
+            case PRIVCMD_MMAPBATCH_PAGED_ERROR:
                 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 )
diff -r 139f059cb0b3 -r ff9750a630d8 xen/include/public/domctl.h
--- a/xen/include/public/domctl.h	Mon Nov 12 17:03:19 2012 +0000
+++ b/xen/include/public/domctl.h	Mon Nov 12 17:03:20 2012 +0000
@@ -136,7 +136,6 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_getme
 #define XEN_DOMCTL_PFINFO_LPINTAB (0x1U<<31)
 #define XEN_DOMCTL_PFINFO_XTAB    (0xfU<<28) /* invalid page */
 #define XEN_DOMCTL_PFINFO_XALLOC  (0xeU<<28) /* allocate-only page */
-#define XEN_DOMCTL_PFINFO_PAGEDTAB (0x8U<<28)
 #define XEN_DOMCTL_PFINFO_LTAB_MASK (0xfU<<28)
 
 struct xen_domctl_getpageframeinfo {

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 00:55:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 00: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.xen.org>)
	id 1TY4md-0006x5-NC; Tue, 13 Nov 2012 00: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 1TY4mc-0006wY-8A
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:18 +0000
Received: from [85.158.139.211:14152] by server-11.bemta-5.messagelabs.com id
	4A/02-03409-57A91A05; Tue, 13 Nov 2012 00:55:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-206.messagelabs.com!1352768115!19859676!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7954 invoked from network); 13 Nov 2012 00:55:16 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Nov 2012 00: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 1TY4mY-0001rZ-Te
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TY4mY-0007HG-OW
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:14 +0000
Message-Id: <E1TY4mY-0007HG-OW@xenbits.xen.org>
Date: Tue, 13 Nov 2012 00:55:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] pygrub: Fix command line argument
	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: "Change log for Mercurial \(receive only\)"
	<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 Matthew Daley <mattjd@gmail.com>
# Date 1352739801 0
# Node ID a3cde70320ada4a5424c37f65b8fe3753fc95205
# Parent  1678c7db9b0da1c9de04d0044107251c080b6da4
pygrub: Fix command line argument error handling

pygrub's individual config file parsers do not correctly check the
amount of command line arguments given to them. In addition, the LILO
config parser would report an incorrect message.

Use len() to correctly check the amount of arguments, and fix the LILO
error message.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 1678c7db9b0d -r a3cde70320ad tools/pygrub/src/ExtLinuxConf.py
--- a/tools/pygrub/src/ExtLinuxConf.py	Mon Nov 12 17:03:20 2012 +0000
+++ b/tools/pygrub/src/ExtLinuxConf.py	Mon Nov 12 17:03:21 2012 +0000
@@ -207,7 +207,7 @@ class ExtLinuxConfigFile(object):
                  }
         
 if __name__ == "__main__":
-    if sys.argv < 2:
+    if len(sys.argv) < 2:
         raise RuntimeError, "Need a configuration file to read"
     g = ExtLinuxConfigFile(sys.argv[1])
     for i in g.images:
diff -r 1678c7db9b0d -r a3cde70320ad tools/pygrub/src/GrubConf.py
--- a/tools/pygrub/src/GrubConf.py	Mon Nov 12 17:03:20 2012 +0000
+++ b/tools/pygrub/src/GrubConf.py	Mon Nov 12 17:03:21 2012 +0000
@@ -454,7 +454,7 @@ class Grub2ConfigFile(_GrubConfigFile):
                 }
         
 if __name__ == "__main__":
-    if sys.argv < 3:
+    if len(sys.argv) < 3:
         raise RuntimeError, "Need a grub version (\"grub\" or \"grub2\") and a grub.conf or grub.cfg to read"
     if sys.argv[1] == "grub":
         g = GrubConfigFile(sys.argv[2])
diff -r 1678c7db9b0d -r a3cde70320ad tools/pygrub/src/LiloConf.py
--- a/tools/pygrub/src/LiloConf.py	Mon Nov 12 17:03:20 2012 +0000
+++ b/tools/pygrub/src/LiloConf.py	Mon Nov 12 17:03:21 2012 +0000
@@ -169,8 +169,8 @@ class LiloConfigFile(object):
                  }
 
 if __name__ == "__main__":
-    if sys.argv < 2:
-        raise RuntimeError, "Need a grub.conf to read"
+    if len(sys.argv) < 2:
+        raise RuntimeError, "Need a lilo.conf to read"
     g = LiloConfigFile(sys.argv[1])
     for i in g.images:
         print i #, i.title, i.root, i.kernel, i.args, i.initrd

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 00:55:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 00: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.xen.org>)
	id 1TY4md-0006x5-NC; Tue, 13 Nov 2012 00: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 1TY4mc-0006wY-8A
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:18 +0000
Received: from [85.158.139.211:14152] by server-11.bemta-5.messagelabs.com id
	4A/02-03409-57A91A05; Tue, 13 Nov 2012 00:55:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-206.messagelabs.com!1352768115!19859676!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7954 invoked from network); 13 Nov 2012 00:55:16 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Nov 2012 00: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 1TY4mY-0001rZ-Te
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TY4mY-0007HG-OW
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:14 +0000
Message-Id: <E1TY4mY-0007HG-OW@xenbits.xen.org>
Date: Tue, 13 Nov 2012 00:55:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] pygrub: Fix command line argument
	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: "Change log for Mercurial \(receive only\)"
	<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 Matthew Daley <mattjd@gmail.com>
# Date 1352739801 0
# Node ID a3cde70320ada4a5424c37f65b8fe3753fc95205
# Parent  1678c7db9b0da1c9de04d0044107251c080b6da4
pygrub: Fix command line argument error handling

pygrub's individual config file parsers do not correctly check the
amount of command line arguments given to them. In addition, the LILO
config parser would report an incorrect message.

Use len() to correctly check the amount of arguments, and fix the LILO
error message.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 1678c7db9b0d -r a3cde70320ad tools/pygrub/src/ExtLinuxConf.py
--- a/tools/pygrub/src/ExtLinuxConf.py	Mon Nov 12 17:03:20 2012 +0000
+++ b/tools/pygrub/src/ExtLinuxConf.py	Mon Nov 12 17:03:21 2012 +0000
@@ -207,7 +207,7 @@ class ExtLinuxConfigFile(object):
                  }
         
 if __name__ == "__main__":
-    if sys.argv < 2:
+    if len(sys.argv) < 2:
         raise RuntimeError, "Need a configuration file to read"
     g = ExtLinuxConfigFile(sys.argv[1])
     for i in g.images:
diff -r 1678c7db9b0d -r a3cde70320ad tools/pygrub/src/GrubConf.py
--- a/tools/pygrub/src/GrubConf.py	Mon Nov 12 17:03:20 2012 +0000
+++ b/tools/pygrub/src/GrubConf.py	Mon Nov 12 17:03:21 2012 +0000
@@ -454,7 +454,7 @@ class Grub2ConfigFile(_GrubConfigFile):
                 }
         
 if __name__ == "__main__":
-    if sys.argv < 3:
+    if len(sys.argv) < 3:
         raise RuntimeError, "Need a grub version (\"grub\" or \"grub2\") and a grub.conf or grub.cfg to read"
     if sys.argv[1] == "grub":
         g = GrubConfigFile(sys.argv[2])
diff -r 1678c7db9b0d -r a3cde70320ad tools/pygrub/src/LiloConf.py
--- a/tools/pygrub/src/LiloConf.py	Mon Nov 12 17:03:20 2012 +0000
+++ b/tools/pygrub/src/LiloConf.py	Mon Nov 12 17:03:21 2012 +0000
@@ -169,8 +169,8 @@ class LiloConfigFile(object):
                  }
 
 if __name__ == "__main__":
-    if sys.argv < 2:
-        raise RuntimeError, "Need a grub.conf to read"
+    if len(sys.argv) < 2:
+        raise RuntimeError, "Need a lilo.conf to read"
     g = LiloConfigFile(sys.argv[1])
     for i in g.images:
         print i #, i.title, i.root, i.kernel, i.args, i.initrd

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 00:55:26 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 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.xen.org>)
	id 1TY4mc-0006wq-H6; Tue, 13 Nov 2012 00:55:18 +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 1TY4mb-0006wW-G7
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:17 +0000
Received: from [85.158.143.35:17614] by server-2.bemta-4.messagelabs.com id
	D1/DB-28922-47A91A05; Tue, 13 Nov 2012 00:55:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1352768114!14973529!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30658 invoked from network); 13 Nov 2012 00:55: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;
	13 Nov 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 1TY4mY-0001rW-EH
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TY4mY-0007H1-6N
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:14 +0000
Message-Id: <E1TY4mY-0007H1-6N@xenbits.xen.org>
Date: Tue, 13 Nov 2012 00:55:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: fix reboot failure of
	migrated 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: "Change log for Mercurial \(receive only\)"
	<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 Kouya Shimura <kouya@jp.fujitsu.com>
# Date 1352739800 0
# Node ID 1678c7db9b0da1c9de04d0044107251c080b6da4
# Parent  ff9750a630d8c742c630e7bb6c1b3fe2aeda0a37
libxl: fix reboot failure of migrated domain

The same problem was once fixed by c/s 23878:59c7213b5949
but c/s 25344:0f3b1e13d6af broke it.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r ff9750a630d8 -r 1678c7db9b0d tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Mon Nov 12 17:03:20 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Mon Nov 12 17:03:20 2012 +0000
@@ -1927,7 +1927,7 @@ start:
          * On subsequent reboot etc we should create the domain, not
          * restore/migrate-receive it again.
          */
-        restore_file = NULL;
+        restoring = 0;
     }else{
         ret = libxl_domain_create_new(ctx, &d_config, &domid,
                                       0, autoconnect_console_how);

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 00:55:26 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 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.xen.org>)
	id 1TY4mc-0006wq-H6; Tue, 13 Nov 2012 00:55:18 +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 1TY4mb-0006wW-G7
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:17 +0000
Received: from [85.158.143.35:17614] by server-2.bemta-4.messagelabs.com id
	D1/DB-28922-47A91A05; Tue, 13 Nov 2012 00:55:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1352768114!14973529!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30658 invoked from network); 13 Nov 2012 00:55: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;
	13 Nov 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 1TY4mY-0001rW-EH
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TY4mY-0007H1-6N
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 00:55:14 +0000
Message-Id: <E1TY4mY-0007H1-6N@xenbits.xen.org>
Date: Tue, 13 Nov 2012 00:55:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: fix reboot failure of
	migrated 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: "Change log for Mercurial \(receive only\)"
	<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 Kouya Shimura <kouya@jp.fujitsu.com>
# Date 1352739800 0
# Node ID 1678c7db9b0da1c9de04d0044107251c080b6da4
# Parent  ff9750a630d8c742c630e7bb6c1b3fe2aeda0a37
libxl: fix reboot failure of migrated domain

The same problem was once fixed by c/s 23878:59c7213b5949
but c/s 25344:0f3b1e13d6af broke it.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r ff9750a630d8 -r 1678c7db9b0d tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Mon Nov 12 17:03:20 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Mon Nov 12 17:03:20 2012 +0000
@@ -1927,7 +1927,7 @@ start:
          * On subsequent reboot etc we should create the domain, not
          * restore/migrate-receive it again.
          */
-        restore_file = NULL;
+        restoring = 0;
     }else{
         ret = libxl_domain_create_new(ctx, &d_config, &domid,
                                       0, autoconnect_console_how);

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 16:22:15 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 16:22: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.xen.org>)
	id 1TYJFc-0004Dz-RJ; Tue, 13 Nov 2012 16:22:12 +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 1TYJFc-0004Dk-3L
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:12 +0000
Received: from [85.158.139.83:20278] by server-15.bemta-5.messagelabs.com id
	27/66-26920-3B372A05; Tue, 13 Nov 2012 16:22:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-182.messagelabs.com!1352823729!25810546!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18038 invoked from network); 13 Nov 2012 16:22:10 -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;
	13 Nov 2012 16: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 1TYJFZ-00037i-BY
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYJFZ-0006hb-70
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:09 +0000
Message-Id: <E1TYJFZ-0006hb-70@xenbits.xen.org>
Date: Tue, 13 Nov 2012 16:22:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] minios: Disable -DGNT_DEBUG and
	-DGNTMAP_DEBUG
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1352803616 0
# Node ID 14669ca1e53de199cf821ad5ccb47dafec2fc9e6
# Parent  56400658f0962099988678487e525d12f869a96a
minios: Disable -DGNT_DEBUG and -DGNTMAP_DEBUG

Disabling the above flags in default mini-os build. They generate a
lot of spam.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 56400658f096 -r 14669ca1e53d extras/mini-os/minios.mk
--- a/extras/mini-os/minios.mk	Tue Nov 13 11:28:10 2012 +0100
+++ b/extras/mini-os/minios.mk	Tue Nov 13 10:46:56 2012 +0000
@@ -20,8 +20,8 @@ DEF_CFLAGS += -g
 #DEF_CFLAGS += -DMM_DEBUG
 #DEF_CFLAGS += -DFS_DEBUG
 #DEF_CFLAGS += -DLIBC_DEBUG
-DEF_CFLAGS += -DGNT_DEBUG
-DEF_CFLAGS += -DGNTMAP_DEBUG
+#DEF_CFLAGS += -DGNT_DEBUG
+#DEF_CFLAGS += -DGNTMAP_DEBUG
 else
 DEF_CFLAGS += -O3
 endif

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 16:22:15 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 16:22: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.xen.org>)
	id 1TYJFc-0004Dz-RJ; Tue, 13 Nov 2012 16:22:12 +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 1TYJFc-0004Dk-3L
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:12 +0000
Received: from [85.158.139.83:20278] by server-15.bemta-5.messagelabs.com id
	27/66-26920-3B372A05; Tue, 13 Nov 2012 16:22:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-182.messagelabs.com!1352823729!25810546!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18038 invoked from network); 13 Nov 2012 16:22:10 -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;
	13 Nov 2012 16: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 1TYJFZ-00037i-BY
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYJFZ-0006hb-70
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:09 +0000
Message-Id: <E1TYJFZ-0006hb-70@xenbits.xen.org>
Date: Tue, 13 Nov 2012 16:22:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] minios: Disable -DGNT_DEBUG and
	-DGNTMAP_DEBUG
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1352803616 0
# Node ID 14669ca1e53de199cf821ad5ccb47dafec2fc9e6
# Parent  56400658f0962099988678487e525d12f869a96a
minios: Disable -DGNT_DEBUG and -DGNTMAP_DEBUG

Disabling the above flags in default mini-os build. They generate a
lot of spam.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 56400658f096 -r 14669ca1e53d extras/mini-os/minios.mk
--- a/extras/mini-os/minios.mk	Tue Nov 13 11:28:10 2012 +0100
+++ b/extras/mini-os/minios.mk	Tue Nov 13 10:46:56 2012 +0000
@@ -20,8 +20,8 @@ DEF_CFLAGS += -g
 #DEF_CFLAGS += -DMM_DEBUG
 #DEF_CFLAGS += -DFS_DEBUG
 #DEF_CFLAGS += -DLIBC_DEBUG
-DEF_CFLAGS += -DGNT_DEBUG
-DEF_CFLAGS += -DGNTMAP_DEBUG
+#DEF_CFLAGS += -DGNT_DEBUG
+#DEF_CFLAGS += -DGNTMAP_DEBUG
 else
 DEF_CFLAGS += -O3
 endif

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 16:22:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 16: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.xen.org>)
	id 1TYJFd-0004EB-U4; Tue, 13 Nov 2012 16:22:13 +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 1TYJFc-0004Dp-IQ
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:12 +0000
Received: from [85.158.138.51:42610] by server-14.bemta-3.messagelabs.com id
	63/46-12788-3B372A05; Tue, 13 Nov 2012 16:22:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1352823730!21786465!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30249 invoked from network); 13 Nov 2012 16:22: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;
	13 Nov 2012 16:22: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 1TYJFZ-00037l-TS
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYJFZ-0006hq-P5
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:09 +0000
Message-Id: <E1TYJFZ-0006hq-P5@xenbits.xen.org>
Date: Tue, 13 Nov 2012 16:22:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] minios: add xenbus_read_uuid
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1352803617 0
# Node ID 3015f8c6174b579ee62ff01cfa177ca33d6dd531
# Parent  14669ca1e53de199cf821ad5ccb47dafec2fc9e6
minios: add xenbus_read_uuid

Similar to xenbus_read_integer, this function reads a xenstore path
and parses it as a uuid. See include/xenbus.h for details.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 14669ca1e53d -r 3015f8c6174b extras/mini-os/include/xenbus.h
--- a/extras/mini-os/include/xenbus.h	Tue Nov 13 10:46:56 2012 +0000
+++ b/extras/mini-os/include/xenbus.h	Tue Nov 13 10:46:57 2012 +0000
@@ -95,6 +95,10 @@ char *xenbus_transaction_end(xenbus_tran
 /* Read path and parse it as an integer.  Returns -1 on error. */
 int xenbus_read_integer(const char *path);
 
+/* Read path and parse it as 16 byte uuid. Returns 1 if
+ * read and parsing were successful, 0 if not */
+int xenbus_read_uuid(const char* path, unsigned char uuid[16]);
+
 /* Contraction of snprintf and xenbus_write(path/node). */
 char* xenbus_printf(xenbus_transaction_t xbt,
                                   const char* node, const char* path,
diff -r 14669ca1e53d -r 3015f8c6174b extras/mini-os/xenbus/xenbus.c
--- a/extras/mini-os/xenbus/xenbus.c	Tue Nov 13 10:46:56 2012 +0000
+++ b/extras/mini-os/xenbus/xenbus.c	Tue Nov 13 10:46:57 2012 +0000
@@ -719,6 +719,33 @@ int xenbus_read_integer(const char *path
     return t;
 }
 
+int xenbus_read_uuid(const char* path, unsigned char uuid[16]) {
+   char * res, *buf;
+   res = xenbus_read(XBT_NIL, path, &buf);
+   if(res) {
+      printk("Failed to read %s.\n", path);
+      free(res);
+      return 0;
+   }
+   if(strlen(buf) != ((2*16)+4) /* 16 hex bytes and 4 hyphens */
+         || sscanf(buf,
+            "%2hhx%2hhx%2hhx%2hhx-"
+            "%2hhx%2hhx-"
+            "%2hhx%2hhx-"
+            "%2hhx%2hhx-"
+            "%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx",
+            uuid, uuid + 1, uuid + 2, uuid + 3,
+            uuid + 4, uuid + 5, uuid + 6, uuid + 7,
+            uuid + 8, uuid + 9, uuid + 10, uuid + 11,
+            uuid + 12, uuid + 13, uuid + 14, uuid + 15) != 16) {
+      printk("Xenbus path %s value %s is not a uuid!\n", path, buf);
+      free(buf);
+      return 0;
+   }
+   free(buf);
+   return 1;
+}
+
 char* xenbus_printf(xenbus_transaction_t xbt,
                                   const char* node, const char* path,
                                   const char* fmt, ...)

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 16:22:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 16: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.xen.org>)
	id 1TYJFd-0004EB-U4; Tue, 13 Nov 2012 16:22:13 +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 1TYJFc-0004Dp-IQ
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:12 +0000
Received: from [85.158.138.51:42610] by server-14.bemta-3.messagelabs.com id
	63/46-12788-3B372A05; Tue, 13 Nov 2012 16:22:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1352823730!21786465!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30249 invoked from network); 13 Nov 2012 16:22: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;
	13 Nov 2012 16:22: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 1TYJFZ-00037l-TS
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYJFZ-0006hq-P5
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:09 +0000
Message-Id: <E1TYJFZ-0006hq-P5@xenbits.xen.org>
Date: Tue, 13 Nov 2012 16:22:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] minios: add xenbus_read_uuid
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1352803617 0
# Node ID 3015f8c6174b579ee62ff01cfa177ca33d6dd531
# Parent  14669ca1e53de199cf821ad5ccb47dafec2fc9e6
minios: add xenbus_read_uuid

Similar to xenbus_read_integer, this function reads a xenstore path
and parses it as a uuid. See include/xenbus.h for details.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 14669ca1e53d -r 3015f8c6174b extras/mini-os/include/xenbus.h
--- a/extras/mini-os/include/xenbus.h	Tue Nov 13 10:46:56 2012 +0000
+++ b/extras/mini-os/include/xenbus.h	Tue Nov 13 10:46:57 2012 +0000
@@ -95,6 +95,10 @@ char *xenbus_transaction_end(xenbus_tran
 /* Read path and parse it as an integer.  Returns -1 on error. */
 int xenbus_read_integer(const char *path);
 
+/* Read path and parse it as 16 byte uuid. Returns 1 if
+ * read and parsing were successful, 0 if not */
+int xenbus_read_uuid(const char* path, unsigned char uuid[16]);
+
 /* Contraction of snprintf and xenbus_write(path/node). */
 char* xenbus_printf(xenbus_transaction_t xbt,
                                   const char* node, const char* path,
diff -r 14669ca1e53d -r 3015f8c6174b extras/mini-os/xenbus/xenbus.c
--- a/extras/mini-os/xenbus/xenbus.c	Tue Nov 13 10:46:56 2012 +0000
+++ b/extras/mini-os/xenbus/xenbus.c	Tue Nov 13 10:46:57 2012 +0000
@@ -719,6 +719,33 @@ int xenbus_read_integer(const char *path
     return t;
 }
 
+int xenbus_read_uuid(const char* path, unsigned char uuid[16]) {
+   char * res, *buf;
+   res = xenbus_read(XBT_NIL, path, &buf);
+   if(res) {
+      printk("Failed to read %s.\n", path);
+      free(res);
+      return 0;
+   }
+   if(strlen(buf) != ((2*16)+4) /* 16 hex bytes and 4 hyphens */
+         || sscanf(buf,
+            "%2hhx%2hhx%2hhx%2hhx-"
+            "%2hhx%2hhx-"
+            "%2hhx%2hhx-"
+            "%2hhx%2hhx-"
+            "%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx",
+            uuid, uuid + 1, uuid + 2, uuid + 3,
+            uuid + 4, uuid + 5, uuid + 6, uuid + 7,
+            uuid + 8, uuid + 9, uuid + 10, uuid + 11,
+            uuid + 12, uuid + 13, uuid + 14, uuid + 15) != 16) {
+      printk("Xenbus path %s value %s is not a uuid!\n", path, buf);
+      free(buf);
+      return 0;
+   }
+   free(buf);
+   return 1;
+}
+
 char* xenbus_printf(xenbus_transaction_t xbt,
                                   const char* node, const char* path,
                                   const char* fmt, ...)

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 16:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 16:22: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 1TYJFg-0004Es-0W; Tue, 13 Nov 2012 16:22: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 1TYJFf-0004EP-9i
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:15 +0000
Received: from [85.158.139.211:48054] by server-14.bemta-5.messagelabs.com id
	45/55-21768-6B372A05; Tue, 13 Nov 2012 16:22:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-206.messagelabs.com!1352823732!19973121!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19688 invoked from network); 13 Nov 2012 16:22:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Nov 2012 16: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 1TYJFc-00037x-8F
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYJFc-0006ir-6u
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:12 +0000
Message-Id: <E1TYJFc-0006ir-6u@xenbits.xen.org>
Date: Tue, 13 Nov 2012 16:22:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: fix vfb related assertion
	problem when starting pv-domU
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Ronny Hegewald <ronny.hegewald@online.de>
# Date 1352805557 0
# Node ID 8b93ac0c93f3fb8a140b4688ba71841ac927d4e3
# Parent  170d45f7a2ebde462743d98c77a1d10ee0f51a29
libxl: fix vfb related assertion problem when starting pv-domU

When a config-file for a pv-domU has a vfb section with a vnc=0
option then a "xl create" for that domU crashes with the message

xl: libxl.c:252: libxl_defbool_val: Assertion `!libxl_defbool_is_default(db)'
failed.

and the domU hangs early in the start.

This patch fixes the cause of the assertion and let the domU start
normally.

This problem exists since xen 4.2.

Signed-off-by: Ronny Hegewald <Ronny.Hegewald@online.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 170d45f7a2eb -r 8b93ac0c93f3 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Nov 13 10:47:00 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Nov 13 11:19:17 2012 +0000
@@ -3186,6 +3186,8 @@ int libxl__device_vfb_setdefault(libxl__
         }
 
         libxl_defbool_setdefault(&vfb->vnc.findunused, true);
+    } else {
+        libxl_defbool_setdefault(&vfb->vnc.findunused, false);
     }
 
     libxl_defbool_setdefault(&vfb->sdl.enable, false);

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 16:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 16:22: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 1TYJFg-0004Es-0W; Tue, 13 Nov 2012 16:22: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 1TYJFf-0004EP-9i
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:15 +0000
Received: from [85.158.139.211:48054] by server-14.bemta-5.messagelabs.com id
	45/55-21768-6B372A05; Tue, 13 Nov 2012 16:22:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-206.messagelabs.com!1352823732!19973121!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19688 invoked from network); 13 Nov 2012 16:22:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Nov 2012 16: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 1TYJFc-00037x-8F
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYJFc-0006ir-6u
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:12 +0000
Message-Id: <E1TYJFc-0006ir-6u@xenbits.xen.org>
Date: Tue, 13 Nov 2012 16:22:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: fix vfb related assertion
	problem when starting pv-domU
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Ronny Hegewald <ronny.hegewald@online.de>
# Date 1352805557 0
# Node ID 8b93ac0c93f3fb8a140b4688ba71841ac927d4e3
# Parent  170d45f7a2ebde462743d98c77a1d10ee0f51a29
libxl: fix vfb related assertion problem when starting pv-domU

When a config-file for a pv-domU has a vfb section with a vnc=0
option then a "xl create" for that domU crashes with the message

xl: libxl.c:252: libxl_defbool_val: Assertion `!libxl_defbool_is_default(db)'
failed.

and the domU hangs early in the start.

This patch fixes the cause of the assertion and let the domU start
normally.

This problem exists since xen 4.2.

Signed-off-by: Ronny Hegewald <Ronny.Hegewald@online.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 170d45f7a2eb -r 8b93ac0c93f3 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Nov 13 10:47:00 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Nov 13 11:19:17 2012 +0000
@@ -3186,6 +3186,8 @@ int libxl__device_vfb_setdefault(libxl__
         }
 
         libxl_defbool_setdefault(&vfb->vnc.findunused, true);
+    } else {
+        libxl_defbool_setdefault(&vfb->vnc.findunused, false);
     }
 
     libxl_defbool_setdefault(&vfb->sdl.enable, false);

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 16:22:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 16:22: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 1TYJFi-0004Fi-3h; Tue, 13 Nov 2012 16:22:18 +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 1TYJFg-0004F2-VL
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:17 +0000
Received: from [85.158.143.35:65214] by server-3.bemta-4.messagelabs.com id
	02/EA-06841-8B372A05; Tue, 13 Nov 2012 16:22:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1352823729!5350224!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32626 invoked from network); 13 Nov 2012 16:22:13 -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;
	13 Nov 2012 16: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 1TYJFY-00037f-VF
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYJFY-0006hM-Fm
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:08 +0000
Message-Id: <E1TYJFY-0006hM-Fm@xenbits.xen.org>
Date: Tue, 13 Nov 2012 16:22:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] fix xenctl_cpumap_to_cpumask()
	buffer size 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: "Change log for Mercurial \(receive only\)"
	<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 Matthew Daley <mattjd@gmail.com>
# Date 1352802490 -3600
# Node ID 56400658f0962099988678487e525d12f869a96a
# Parent  a3cde70320ada4a5424c37f65b8fe3753fc95205
fix xenctl_cpumap_to_cpumask() buffer size check

xenctl_cpumap_to_cpumask incorrectly uses sizeof when checking whether
bits should be masked off from the input cpumap bitmap or not.

Fix by using the correct cpumask buffer size in place of sizeof.

Signed-off-by: Matthew Daley <mattjd@gmail.com>

Compare against copy_bytes instead, and use equality rather than less-
or-equal.

Further, this issue (introduced with c/s 23991:a7ccbc79fc17) is not
security relevant (i.e. the bug could not cause memory corruption):
_xmalloc() never returns chunks of data smaller than the size of a
pointer, i.e. even if sizeof(void*) > guest_bytes > copy_bytes, the
piece of memory erroneously written to would still be inside the
allocation done at the top of the function.

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


diff -r a3cde70320ad -r 56400658f096 xen/common/domctl.c
--- a/xen/common/domctl.c	Mon Nov 12 17:03:21 2012 +0000
+++ b/xen/common/domctl.c	Tue Nov 13 11:28:10 2012 +0100
@@ -78,7 +78,7 @@ int xenctl_cpumap_to_cpumask(
     {
         if ( copy_from_guest(bytemap, xenctl_cpumap->bitmap, copy_bytes) )
             err = -EFAULT;
-        if ( (xenctl_cpumap->nr_cpus & 7) && (guest_bytes <= sizeof(bytemap)) )
+        if ( (xenctl_cpumap->nr_cpus & 7) && (guest_bytes == copy_bytes) )
             bytemap[guest_bytes-1] &= ~(0xff << (xenctl_cpumap->nr_cpus & 7));
     }
 

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 16:22:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 16:22: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 1TYJFi-0004Fi-3h; Tue, 13 Nov 2012 16:22:18 +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 1TYJFg-0004F2-VL
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:17 +0000
Received: from [85.158.143.35:65214] by server-3.bemta-4.messagelabs.com id
	02/EA-06841-8B372A05; Tue, 13 Nov 2012 16:22:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1352823729!5350224!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32626 invoked from network); 13 Nov 2012 16:22:13 -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;
	13 Nov 2012 16: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 1TYJFY-00037f-VF
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYJFY-0006hM-Fm
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:08 +0000
Message-Id: <E1TYJFY-0006hM-Fm@xenbits.xen.org>
Date: Tue, 13 Nov 2012 16:22:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] fix xenctl_cpumap_to_cpumask()
	buffer size 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: "Change log for Mercurial \(receive only\)"
	<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 Matthew Daley <mattjd@gmail.com>
# Date 1352802490 -3600
# Node ID 56400658f0962099988678487e525d12f869a96a
# Parent  a3cde70320ada4a5424c37f65b8fe3753fc95205
fix xenctl_cpumap_to_cpumask() buffer size check

xenctl_cpumap_to_cpumask incorrectly uses sizeof when checking whether
bits should be masked off from the input cpumap bitmap or not.

Fix by using the correct cpumask buffer size in place of sizeof.

Signed-off-by: Matthew Daley <mattjd@gmail.com>

Compare against copy_bytes instead, and use equality rather than less-
or-equal.

Further, this issue (introduced with c/s 23991:a7ccbc79fc17) is not
security relevant (i.e. the bug could not cause memory corruption):
_xmalloc() never returns chunks of data smaller than the size of a
pointer, i.e. even if sizeof(void*) > guest_bytes > copy_bytes, the
piece of memory erroneously written to would still be inside the
allocation done at the top of the function.

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


diff -r a3cde70320ad -r 56400658f096 xen/common/domctl.c
--- a/xen/common/domctl.c	Mon Nov 12 17:03:21 2012 +0000
+++ b/xen/common/domctl.c	Tue Nov 13 11:28:10 2012 +0100
@@ -78,7 +78,7 @@ int xenctl_cpumap_to_cpumask(
     {
         if ( copy_from_guest(bytemap, xenctl_cpumap->bitmap, copy_bytes) )
             err = -EFAULT;
-        if ( (xenctl_cpumap->nr_cpus & 7) && (guest_bytes <= sizeof(bytemap)) )
+        if ( (xenctl_cpumap->nr_cpus & 7) && (guest_bytes == copy_bytes) )
             bytemap[guest_bytes-1] &= ~(0xff << (xenctl_cpumap->nr_cpus & 7));
     }
 

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 16:22:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 16:22: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 1TYJFj-0004GJ-Ad; Tue, 13 Nov 2012 16:22: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 1TYJFh-0004F1-3T
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:17 +0000
Received: from [85.158.139.83:19313] by server-16.bemta-5.messagelabs.com id
	B2/67-04786-8B372A05; Tue, 13 Nov 2012 16:22:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-182.messagelabs.com!1352823731!30087608!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17806 invoked from network); 13 Nov 2012 16:22:12 -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;
	13 Nov 2012 16: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 1TYJFb-00037r-0J
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYJFa-0006iK-V4
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:10 +0000
Message-Id: <E1TYJFa-0006iK-V4@xenbits.xen.org>
Date: Tue, 13 Nov 2012 16:22:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: add vtpm 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: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1352803619 0
# Node ID 2a4c1d3a080e7d3b20354155b6ac09e53d812cc6
# Parent  34d52300f5d22102d38e8d18067671f0b7ef656e
libxl: add vtpm support

This patch adds vtpm support to libxl. It adds vtpm parsing to config
files and 3 new xl commands:
vtpm-attach
vtpm-detach
vtpm-list

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 34d52300f5d2 -r 2a4c1d3a080e docs/man/xl.cfg.pod.5
--- a/docs/man/xl.cfg.pod.5	Tue Nov 13 10:46:58 2012 +0000
+++ b/docs/man/xl.cfg.pod.5	Tue Nov 13 10:46:59 2012 +0000
@@ -298,6 +298,35 @@ Specifies the networking provision (both
 and Xen virtual interfaces) to provided to the guest.  See
 F<docs/misc/xl-network-configuration.markdown>.
 
+=item B<vtpm=[ "VTPM_SPEC_STRING", "VTPM_SPEC_STRING", ...]>
+
+Specifies the virtual trusted platform module to be
+provided to the guest. Please see F<docs/misc/vtpm.txt>
+for more details.
+
+Each B<VTPM_SPEC_STRING> is a comma-separated list of C<KEY=VALUE>
+settings, from the following list:
+
+=over 4
+
+=item C<backend=DOMAIN>
+
+Specify the backend domain name of id. This value is required!
+If this domain is a guest, the backend should be set to the
+vtpm domain name. If this domain is a vtpm, the
+backend should be set to the vtpm manager domain name.
+
+=item C<uuid=UUID>
+
+Specify the uuid of this vtpm device. The uuid is used to uniquely
+identify the vtpm device. You can create one using the uuidgen
+program on unix systems. If left unspecified, a new uuid
+will be randomly generated every time the domain boots.
+If this is a vtpm domain, you should specify a value. The
+value is optional if this is a guest domain.
+
+=back
+
 =item B<vfb=[ "VFB_SPEC_STRING", "VFB_SPEC_STRING", ...]>
 
 Specifies the paravirtual framebuffer devices which should be supplied
diff -r 34d52300f5d2 -r 2a4c1d3a080e docs/man/xl.pod.1
--- a/docs/man/xl.pod.1	Tue Nov 13 10:46:58 2012 +0000
+++ b/docs/man/xl.pod.1	Tue Nov 13 10:46:59 2012 +0000
@@ -1106,6 +1106,31 @@ List virtual network interfaces for a do
 
 =back
 
+=head2 VTPM DEVICES
+
+=over 4
+
+=item B<vtpm-attach> I<domain-id> I<vtpm-device>
+
+Creates a new vtpm device in the domain specified by I<domain-id>.
+I<vtpm-device> describes the device to attach, using the same format as the
+B<vtpm> string in the domain config file. See L<xl.cfg> for
+more information.
+
+=item B<vtpm-detach> I<domain-id> I<devid|uuid>
+
+Removes the vtpm device from the domain specified by I<domain-id>.
+I<devid> is the numeric device id given to the virtual trusted
+platform module device. You will need to run B<xl vtpm-list> to determine that number.
+Alternatively the I<uuid> of the vtpm can be used to
+select the virtual device to detach.
+
+=item B<vtpm-list> I<domain-id>
+
+List virtual trusted platform modules for a domain.
+
+=back
+
 =head1 PCI PASS-THROUGH
 
 =over 4
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Nov 13 10:46:59 2012 +0000
@@ -1710,6 +1710,243 @@ out:
 }
 
 /******************************************************************************/
+int libxl__device_vtpm_setdefault(libxl__gc *gc, libxl_device_vtpm *vtpm)
+{
+   if(libxl_uuid_is_nil(&vtpm->uuid)) {
+      libxl_uuid_generate(&vtpm->uuid);
+   }
+   return 0;
+}
+
+static int libxl__device_from_vtpm(libxl__gc *gc, uint32_t domid,
+                                   libxl_device_vtpm *vtpm,
+                                   libxl__device *device)
+{
+   device->backend_devid   = vtpm->devid;
+   device->backend_domid   = vtpm->backend_domid;
+   device->backend_kind    = LIBXL__DEVICE_KIND_VTPM;
+   device->devid           = vtpm->devid;
+   device->domid           = domid;
+   device->kind            = LIBXL__DEVICE_KIND_VTPM;
+
+   return 0;
+}
+
+void libxl__device_vtpm_add(libxl__egc *egc, uint32_t domid,
+                           libxl_device_vtpm *vtpm,
+                           libxl__ao_device *aodev)
+{
+    STATE_AO_GC(aodev->ao);
+    flexarray_t *front;
+    flexarray_t *back;
+    libxl__device *device;
+    char *dompath, **l;
+    unsigned int nb, rc;
+
+    rc = libxl__device_vtpm_setdefault(gc, vtpm);
+    if (rc) goto out;
+
+    front = flexarray_make(gc, 16, 1);
+    back = flexarray_make(gc, 16, 1);
+
+    if(vtpm->devid == -1) {
+        if (!(dompath = libxl__xs_get_dompath(gc, domid))) {
+            rc = ERROR_FAIL;
+            goto out;
+        }
+        l = libxl__xs_directory(gc, XBT_NULL,
+              GCSPRINTF("%s/device/vtpm", dompath), &nb);
+        if(l == NULL || nb == 0) {
+            vtpm->devid = 0;
+        } else {
+            vtpm->devid = strtoul(l[nb - 1], NULL, 10) + 1;
+        }
+    }
+
+    GCNEW(device);
+    rc = libxl__device_from_vtpm(gc, domid, vtpm, device);
+    if ( rc != 0 ) goto out;
+
+    flexarray_append(back, "frontend-id");
+    flexarray_append(back, GCSPRINTF("%d", domid));
+    flexarray_append(back, "online");
+    flexarray_append(back, "1");
+    flexarray_append(back, "state");
+    flexarray_append(back, GCSPRINTF("%d", 1));
+    flexarray_append(back, "handle");
+    flexarray_append(back, GCSPRINTF("%d", vtpm->devid));
+
+    flexarray_append(back, "uuid");
+    flexarray_append(back, GCSPRINTF(LIBXL_UUID_FMT, LIBXL_UUID_BYTES(vtpm->uuid)));
+    flexarray_append(back, "resume");
+    flexarray_append(back, "False");
+
+    flexarray_append(front, "backend-id");
+    flexarray_append(front, GCSPRINTF("%d", vtpm->backend_domid));
+    flexarray_append(front, "state");
+    flexarray_append(front, GCSPRINTF("%d", 1));
+    flexarray_append(front, "handle");
+    flexarray_append(front, GCSPRINTF("%d", vtpm->devid));
+
+    libxl__device_generic_add(gc, XBT_NULL, device,
+                             libxl__xs_kvs_of_flexarray(gc, back, back->count),
+                             libxl__xs_kvs_of_flexarray(gc, front, front->count));
+
+    aodev->dev = device;
+    aodev->action = DEVICE_CONNECT;
+    libxl__wait_device_connection(egc, aodev);
+
+    rc = 0;
+out:
+    aodev->rc = rc;
+    if(rc) aodev->callback(egc, aodev);
+    return;
+}
+
+libxl_device_vtpm *libxl_device_vtpm_list(libxl_ctx *ctx, uint32_t domid, int *num)
+{
+    GC_INIT(ctx);
+
+    libxl_device_vtpm* vtpms = NULL;
+    char* fe_path = NULL;
+    char** dir = NULL;
+    unsigned int ndirs = 0;
+
+    *num = 0;
+
+    fe_path = libxl__sprintf(gc, "%s/device/vtpm", libxl__xs_get_dompath(gc, domid));
+    dir = libxl__xs_directory(gc, XBT_NULL, fe_path, &ndirs);
+    if(dir) {
+       vtpms = malloc(sizeof(*vtpms) * ndirs);
+       libxl_device_vtpm* vtpm;
+       libxl_device_vtpm* end = vtpms + ndirs;
+       for(vtpm = vtpms; vtpm < end; ++vtpm, ++dir) {
+          char* tmp;
+          const char* be_path = libxl__xs_read(gc, XBT_NULL,
+                GCSPRINTF("%s/%s/backend",
+                   fe_path, *dir));
+
+          vtpm->devid = atoi(*dir);
+
+          tmp = libxl__xs_read(gc, XBT_NULL,
+                GCSPRINTF("%s/%s/backend_id",
+                   fe_path, *dir));
+          vtpm->backend_domid = atoi(tmp);
+
+          tmp = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/uuid", be_path));
+          if(tmp) {
+             if(libxl_uuid_from_string(&(vtpm->uuid), tmp)) {
+                LOG(ERROR, "%s/uuid is a malformed uuid?? (%s) Probably a bug!!\n", be_path, tmp);
+                exit(1);
+             }
+          }
+       }
+    }
+    *num = ndirs;
+
+    GC_FREE;
+    return vtpms;
+}
+
+int libxl_device_vtpm_getinfo(libxl_ctx *ctx,
+                              uint32_t domid,
+                              libxl_device_vtpm *vtpm,
+                              libxl_vtpminfo *vtpminfo)
+{
+    GC_INIT(ctx);
+    char *dompath, *vtpmpath;
+    char *val;
+    int rc = 0;
+
+    libxl_vtpminfo_init(vtpminfo);
+    dompath = libxl__xs_get_dompath(gc, domid);
+    vtpminfo->devid = vtpm->devid;
+
+    vtpmpath = GCSPRINTF("%s/device/vtpm/%d", dompath, vtpminfo->devid);
+    vtpminfo->backend = xs_read(ctx->xsh, XBT_NULL,
+          GCSPRINTF("%s/backend", vtpmpath), NULL);
+    if (!vtpminfo->backend) {
+        goto err;
+    }
+    if(!libxl__xs_read(gc, XBT_NULL, vtpminfo->backend)) {
+       goto err;
+    }
+
+    val = libxl__xs_read(gc, XBT_NULL,
+          GCSPRINTF("%s/backend-id", vtpmpath));
+    vtpminfo->backend_id = val ? strtoul(val, NULL, 10) : -1;
+
+    val = libxl__xs_read(gc, XBT_NULL,
+          GCSPRINTF("%s/state", vtpmpath));
+    vtpminfo->state = val ? strtoul(val, NULL, 10) : -1;
+
+    val = libxl__xs_read(gc, XBT_NULL,
+          GCSPRINTF("%s/event-channel", vtpmpath));
+    vtpminfo->evtch = val ? strtoul(val, NULL, 10) : -1;
+
+    val = libxl__xs_read(gc, XBT_NULL,
+          GCSPRINTF("%s/ring-ref", vtpmpath));
+    vtpminfo->rref = val ? strtoul(val, NULL, 10) : -1;
+
+    vtpminfo->frontend = xs_read(ctx->xsh, XBT_NULL,
+          GCSPRINTF("%s/frontend", vtpminfo->backend), NULL);
+
+    val = libxl__xs_read(gc, XBT_NULL,
+          GCSPRINTF("%s/frontend-id", vtpminfo->backend));
+    vtpminfo->frontend_id = val ? strtoul(val, NULL, 10) : -1;
+
+    val = libxl__xs_read(gc, XBT_NULL,
+          GCSPRINTF("%s/uuid", vtpminfo->backend));
+    if(val == NULL) {
+       LOG(ERROR, "%s/uuid does not exist!\n", vtpminfo->backend);
+       goto err;
+    }
+    if(libxl_uuid_from_string(&(vtpminfo->uuid), val)) {
+       LOG(ERROR,
+             "%s/uuid is a malformed uuid?? (%s) Probably a bug!\n",
+             vtpminfo->backend, val);
+       goto err;
+    }
+
+    goto exit;
+err:
+    rc = ERROR_FAIL;
+exit:
+    GC_FREE;
+    return rc;
+}
+
+int libxl_devid_to_device_vtpm(libxl_ctx *ctx,
+                               uint32_t domid,
+                               int devid,
+                               libxl_device_vtpm *vtpm)
+{
+    libxl_device_vtpm *vtpms;
+    int nb, i;
+    int rc;
+
+    vtpms = libxl_device_vtpm_list(ctx, domid, &nb);
+    if (!vtpms)
+        return ERROR_FAIL;
+
+    memset(vtpm, 0, sizeof (libxl_device_vtpm));
+    rc = 1;
+    for (i = 0; i < nb; ++i) {
+        if(devid == vtpms[i].devid) {
+            vtpm->backend_domid = vtpms[i].backend_domid;
+            vtpm->devid = vtpms[i].devid;
+            libxl_uuid_copy(&vtpm->uuid, &vtpms[i].uuid);
+            rc = 0;
+            break;
+        }
+    }
+
+    libxl_device_vtpm_list_free(vtpms, nb);
+    return rc;
+}
+
+
+/******************************************************************************/
 
 int libxl__device_disk_setdefault(libxl__gc *gc, libxl_device_disk *disk)
 {
@@ -3046,6 +3283,8 @@ out:
  * libxl_device_disk_destroy
  * libxl_device_nic_remove
  * libxl_device_nic_destroy
+ * libxl_device_vtpm_remove
+ * libxl_device_vtpm_destroy
  * libxl_device_vkb_remove
  * libxl_device_vkb_destroy
  * libxl_device_vfb_remove
@@ -3097,6 +3336,10 @@ DEFINE_DEVICE_REMOVE(vkb, destroy, 1)
 DEFINE_DEVICE_REMOVE(vfb, remove, 0)
 DEFINE_DEVICE_REMOVE(vfb, destroy, 1)
 
+/* vtpm */
+DEFINE_DEVICE_REMOVE(vtpm, remove, 0)
+DEFINE_DEVICE_REMOVE(vtpm, destroy, 1)
+
 #undef DEFINE_DEVICE_REMOVE
 
 /******************************************************************************/
@@ -3105,6 +3348,7 @@ DEFINE_DEVICE_REMOVE(vfb, destroy, 1)
 /* The following functions are defined:
  * libxl_device_disk_add
  * libxl_device_nic_add
+ * libxl_device_vtpm_add
  */
 
 #define DEFINE_DEVICE_ADD(type)                                         \
@@ -3131,6 +3375,9 @@ DEFINE_DEVICE_ADD(disk)
 /* nic */
 DEFINE_DEVICE_ADD(nic)
 
+/* vtpm */
+DEFINE_DEVICE_ADD(vtpm)
+
 #undef DEFINE_DEVICE_ADD
 
 /******************************************************************************/
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/libxl.h	Tue Nov 13 10:46:59 2012 +0000
@@ -478,13 +478,14 @@ typedef struct {
     libxl_domain_create_info c_info;
     libxl_domain_build_info b_info;
 
-    int num_disks, num_nics, num_pcidevs, num_vfbs, num_vkbs;
+    int num_disks, num_nics, num_pcidevs, num_vfbs, num_vkbs, num_vtpms;
 
     libxl_device_disk *disks;
     libxl_device_nic *nics;
     libxl_device_pci *pcidevs;
     libxl_device_vfb *vfbs;
     libxl_device_vkb *vkbs;
+    libxl_device_vtpm *vtpms;
 
     libxl_action_on_shutdown on_poweroff;
     libxl_action_on_shutdown on_reboot;
@@ -645,6 +646,9 @@ libxl_vcpuinfo *libxl_list_vcpu(libxl_ct
                                 int *nb_vcpu, int *nr_vcpus_out);
 void libxl_vcpuinfo_list_free(libxl_vcpuinfo *, int nr_vcpus);
 
+void libxl_device_vtpm_list_free(libxl_device_vtpm*, int nr_vtpms);
+void libxl_vtpminfo_list_free(libxl_vtpminfo *, int nr_vtpms);
+
 /*
  * Devices
  * =======
@@ -745,6 +749,23 @@ libxl_device_nic *libxl_device_nic_list(
 int libxl_device_nic_getinfo(libxl_ctx *ctx, uint32_t domid,
                               libxl_device_nic *nic, libxl_nicinfo *nicinfo);
 
+/* Virtual TPMs */
+int libxl_device_vtpm_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vtpm *vtpm,
+                          const libxl_asyncop_how *ao_how)
+                          LIBXL_EXTERNAL_CALLERS_ONLY;
+int libxl_device_vtpm_remove(libxl_ctx *ctx, uint32_t domid,
+                            libxl_device_vtpm *vtpm,
+                            const libxl_asyncop_how *ao_how)
+                            LIBXL_EXTERNAL_CALLERS_ONLY;
+int libxl_device_vtpm_destroy(libxl_ctx *ctx, uint32_t domid,
+                              libxl_device_vtpm *vtpm,
+                              const libxl_asyncop_how *ao_how)
+                              LIBXL_EXTERNAL_CALLERS_ONLY;
+
+libxl_device_vtpm *libxl_device_vtpm_list(libxl_ctx *ctx, uint32_t domid, int *num);
+int libxl_device_vtpm_getinfo(libxl_ctx *ctx, uint32_t domid,
+                               libxl_device_vtpm *vtpm, libxl_vtpminfo *vtpminfo);
+
 /* Keyboard */
 int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb,
                          const libxl_asyncop_how *ao_how)
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Nov 13 10:46:59 2012 +0000
@@ -55,6 +55,8 @@ void libxl_domain_config_dispose(libxl_d
         libxl_device_vkb_dispose(&d_config->vkbs[i]);
     free(d_config->vkbs);
 
+    libxl_device_vtpm_list_free(d_config->vtpms, d_config->num_vtpms);
+
     libxl_domain_create_info_dispose(&d_config->c_info);
     libxl_domain_build_info_dispose(&d_config->b_info);
 }
@@ -601,6 +603,8 @@ static void domcreate_bootloader_done(li
 static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *aodevs,
                                 int ret);
 
+static void domcreate_attach_vtpms(libxl__egc *egc, libxl__multidev *multidev,
+                                   int ret);
 static void domcreate_attach_pci(libxl__egc *egc, libxl__multidev *aodevs,
                                  int ret);
 
@@ -1085,13 +1089,13 @@ static void domcreate_devmodel_started(l
     if (d_config->num_nics > 0) {
         /* Attach nics */
         libxl__multidev_begin(ao, &dcs->multidev);
-        dcs->multidev.callback = domcreate_attach_pci;
+        dcs->multidev.callback = domcreate_attach_vtpms;
         libxl__add_nics(egc, ao, domid, d_config, &dcs->multidev);
         libxl__multidev_prepared(egc, &dcs->multidev, 0);
         return;
     }
 
-    domcreate_attach_pci(egc, &dcs->multidev, 0);
+    domcreate_attach_vtpms(egc, &dcs->multidev, 0);
     return;
 
 error_out:
@@ -1099,6 +1103,39 @@ error_out:
     domcreate_complete(egc, dcs, ret);
 }
 
+static void domcreate_attach_vtpms(libxl__egc *egc,
+                                   libxl__multidev *multidev,
+                                   int ret)
+{
+   libxl__domain_create_state *dcs = CONTAINER_OF(multidev, *dcs, multidev);
+   STATE_AO_GC(dcs->ao);
+   int domid = dcs->guest_domid;
+
+   libxl_domain_config* const d_config = dcs->guest_config;
+
+   if(ret) {
+       LOG(ERROR, "unable to add nic devices");
+       goto error_out;
+   }
+
+    /* Plug vtpm devices */
+   if (d_config->num_vtpms > 0) {
+       /* Attach vtpms */
+       libxl__multidev_begin(ao, &dcs->multidev);
+       dcs->multidev.callback = domcreate_attach_pci;
+       libxl__add_vtpms(egc, ao, domid, d_config, &dcs->multidev);
+       libxl__multidev_prepared(egc, &dcs->multidev, 0);
+       return;
+   }
+
+   domcreate_attach_pci(egc, multidev, 0);
+   return;
+
+error_out:
+   assert(ret);
+   domcreate_complete(egc, dcs, ret);
+}
+
 static void domcreate_attach_pci(libxl__egc *egc, libxl__multidev *multidev,
                                  int ret)
 {
@@ -1112,7 +1149,7 @@ static void domcreate_attach_pci(libxl__
     libxl_domain_config *const d_config = dcs->guest_config;
 
     if (ret) {
-        LOG(ERROR, "unable to add nic devices");
+        LOG(ERROR, "unable to add vtpm devices");
         goto error_out;
     }
 
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/libxl_device.c	Tue Nov 13 10:46:59 2012 +0000
@@ -497,6 +497,7 @@ void libxl__multidev_prepared(libxl__egc
  * The following functions are defined:
  * libxl__add_disks
  * libxl__add_nics
+ * libxl__add_vtpms
  */
 
 #define DEFINE_DEVICES_ADD(type)                                        \
@@ -515,6 +516,7 @@ void libxl__multidev_prepared(libxl__egc
 
 DEFINE_DEVICES_ADD(disk)
 DEFINE_DEVICES_ADD(nic)
+DEFINE_DEVICES_ADD(vtpm)
 
 #undef DEFINE_DEVICES_ADD
 
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Tue Nov 13 10:46:59 2012 +0000
@@ -958,6 +958,7 @@ _hidden int libxl__device_disk_setdefaul
                                           libxl_device_disk *disk);
 _hidden int libxl__device_nic_setdefault(libxl__gc *gc, libxl_device_nic *nic,
                                          uint32_t domid);
+_hidden int libxl__device_vtpm_setdefault(libxl__gc *gc, libxl_device_vtpm *vtpm);
 _hidden int libxl__device_vfb_setdefault(libxl__gc *gc, libxl_device_vfb *vfb);
 _hidden int libxl__device_vkb_setdefault(libxl__gc *gc, libxl_device_vkb *vkb);
 _hidden int libxl__device_pci_setdefault(libxl__gc *gc, libxl_device_pci *pci);
@@ -2007,6 +2008,10 @@ _hidden void libxl__device_nic_add(libxl
                                    libxl_device_nic *nic,
                                    libxl__ao_device *aodev);
 
+_hidden void libxl__device_vtpm_add(libxl__egc *egc, uint32_t domid,
+                                   libxl_device_vtpm *vtpm,
+                                   libxl__ao_device *aodev);
+
 /* Internal function to connect a vkb device */
 _hidden int libxl__device_vkb_add(libxl__gc *gc, uint32_t domid,
                                   libxl_device_vkb *vkb);
@@ -2439,6 +2444,10 @@ _hidden void libxl__add_nics(libxl__egc 
                              libxl_domain_config *d_config,
                              libxl__multidev *multidev);
 
+_hidden void libxl__add_vtpms(libxl__egc *egc, libxl__ao *ao, uint32_t domid,
+                             libxl_domain_config *d_config,
+                             libxl__multidev *multidev);
+
 /*----- device model creation -----*/
 
 /* First layer; wraps libxl__spawn_spawn. */
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Nov 13 10:46:59 2012 +0000
@@ -395,6 +395,12 @@ libxl_device_pci = Struct("device_pci", 
     ("permissive", bool),
     ])
 
+libxl_device_vtpm = Struct("device_vtpm", [
+    ("backend_domid",    libxl_domid),
+    ("devid",            libxl_devid),
+    ("uuid",             libxl_uuid),
+])
+
 libxl_diskinfo = Struct("diskinfo", [
     ("backend", string),
     ("backend_id", uint32),
@@ -418,6 +424,18 @@ libxl_nicinfo = Struct("nicinfo", [
     ("rref_rx", integer),
     ], dir=DIR_OUT)
 
+libxl_vtpminfo = Struct("vtpminfo", [
+    ("backend", string),
+    ("backend_id", uint32),
+    ("frontend", string),
+    ("frontend_id", uint32),
+    ("devid", libxl_devid),
+    ("state", integer),
+    ("evtch", integer),
+    ("rref", integer),
+    ("uuid", libxl_uuid),
+    ], dir=DIR_OUT)
+
 libxl_vcpuinfo = Struct("vcpuinfo", [
     ("vcpuid", uint32),
     ("cpu", uint32),
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/libxl_types_internal.idl
--- a/tools/libxl/libxl_types_internal.idl	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/libxl_types_internal.idl	Tue Nov 13 10:46:59 2012 +0000
@@ -19,6 +19,7 @@ libxl__device_kind = Enumeration("device
     (5, "VFB"),
     (6, "VKBD"),
     (7, "CONSOLE"),
+    (8, "VTPM"),
     ])
 
 libxl__console_backend = Enumeration("console_backend", [
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/libxl_utils.c	Tue Nov 13 10:46:59 2012 +0000
@@ -463,6 +463,33 @@ int libxl_pipe(libxl_ctx *ctx, int pipes
     return 0;
 }
 
+int libxl_uuid_to_device_vtpm(libxl_ctx *ctx, uint32_t domid,
+                            libxl_uuid* uuid, libxl_device_vtpm *vtpm)
+{
+    libxl_device_vtpm *vtpms;
+    int nb, i;
+    int rc;
+
+    vtpms = libxl_device_vtpm_list(ctx, domid, &nb);
+    if (!vtpms)
+        return ERROR_FAIL;
+
+    memset(vtpm, 0, sizeof (libxl_device_vtpm));
+    rc = 1;
+    for (i = 0; i < nb; ++i) {
+        if(!libxl_uuid_compare(uuid, &vtpms[i].uuid)) {
+            vtpm->backend_domid = vtpms[i].backend_domid;
+            vtpm->devid = vtpms[i].devid;
+            libxl_uuid_copy(&vtpm->uuid, &vtpms[i].uuid);
+            rc = 0;
+            break;
+        }
+    }
+
+    libxl_device_vtpm_list_free(vtpms, nb);
+    return rc;
+}
+
 int libxl_mac_to_device_nic(libxl_ctx *ctx, uint32_t domid,
                             const char *mac, libxl_device_nic *nic)
 {
@@ -819,6 +846,22 @@ void libxl_cpupoolinfo_list_free(libxl_c
     free(list);
 }
 
+void libxl_vtpminfo_list_free(libxl_vtpminfo* list, int nr)
+{
+   int i;
+   for (i = 0; i < nr; i++)
+      libxl_vtpminfo_dispose(&list[i]);
+   free(list);
+}
+
+void libxl_device_vtpm_list_free(libxl_device_vtpm* list, int nr)
+{
+   int i;
+   for (i = 0; i < nr; i++)
+      libxl_device_vtpm_dispose(&list[i]);
+   free(list);
+}
+
 int libxl_domid_valid_guest(uint32_t domid)
 {
     /* returns 1 if the value _could_ be a valid guest domid, 0 otherwise
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/libxl_utils.h
--- a/tools/libxl/libxl_utils.h	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/libxl_utils.h	Tue Nov 13 10:46:59 2012 +0000
@@ -64,6 +64,11 @@ int libxl_devid_to_device_nic(libxl_ctx 
 int libxl_vdev_to_device_disk(libxl_ctx *ctx, uint32_t domid, const char *vdev,
                                libxl_device_disk *disk);
 
+int libxl_uuid_to_device_vtpm(libxl_ctx *ctx, uint32_t domid,
+                               libxl_uuid *uuid, libxl_device_vtpm *vtpm);
+int libxl_devid_to_device_vtpm(libxl_ctx *ctx, uint32_t domid,
+                               int devid, libxl_device_vtpm *vtpm);
+
 int libxl_bitmap_alloc(libxl_ctx *ctx, libxl_bitmap *bitmap, int n_bits);
     /* Allocated bimap is from malloc, libxl_bitmap_dispose() to be
      * called by the application when done. */
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/xl.h
--- a/tools/libxl/xl.h	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/xl.h	Tue Nov 13 10:46:59 2012 +0000
@@ -79,6 +79,9 @@ int main_networkdetach(int argc, char **
 int main_blockattach(int argc, char **argv);
 int main_blocklist(int argc, char **argv);
 int main_blockdetach(int argc, char **argv);
+int main_vtpmattach(int argc, char **argv);
+int main_vtpmlist(int argc, char **argv);
+int main_vtpmdetach(int argc, char **argv);
 int main_uptime(int argc, char **argv);
 int main_tmem_list(int argc, char **argv);
 int main_tmem_freeze(int argc, char **argv);
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Nov 13 10:46:59 2012 +0000
@@ -573,7 +573,7 @@ static void parse_config_data(const char
     const char *buf;
     long l;
     XLU_Config *config;
-    XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids;
+    XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids, *vtpms;
     XLU_ConfigList *ioports, *irqs, *iomem;
     int num_ioports, num_irqs, num_iomem;
     int pci_power_mgmt = 0;
@@ -1048,6 +1048,58 @@ static void parse_config_data(const char
         }
     }
 
+    if (!xlu_cfg_get_list(config, "vtpm", &vtpms, 0, 0)) {
+        d_config->num_vtpms = 0;
+        d_config->vtpms = NULL;
+        while ((buf = xlu_cfg_get_listitem (vtpms, d_config->num_vtpms)) != NULL) {
+            libxl_device_vtpm *vtpm;
+            char * buf2 = strdup(buf);
+            char *p, *p2;
+            bool got_backend = false;
+
+            d_config->vtpms = (libxl_device_vtpm *) realloc(d_config->vtpms,
+                  sizeof(libxl_device_vtpm) * (d_config->num_vtpms+1));
+            vtpm = d_config->vtpms + d_config->num_vtpms;
+            libxl_device_vtpm_init(vtpm);
+            vtpm->devid = d_config->num_vtpms;
+
+            p = strtok(buf2, ",");
+            if(p) {
+               do {
+                  while(*p == ' ')
+                     ++p;
+                  if ((p2 = strchr(p, '=')) == NULL)
+                     break;
+                  *p2 = '\0';
+                  if (!strcmp(p, "backend")) {
+                     if(domain_qualifier_to_domid(p2 + 1, &(vtpm->backend_domid), 0))
+                     {
+                        fprintf(stderr,
+                              "Specified vtpm backend domain `%s' does not exist!\n", p2 + 1);
+                        exit(1);
+                     }
+                     got_backend = true;
+                  } else if(!strcmp(p, "uuid")) {
+                     if( libxl_uuid_from_string(&vtpm->uuid, p2 + 1) ) {
+                        fprintf(stderr,
+                              "Failed to parse vtpm UUID: %s\n", p2 + 1);
+                        exit(1);
+                    }
+                  } else {
+                     fprintf(stderr, "Unknown string `%s' in vtpm spec\n", p);
+                     exit(1);
+                  }
+               } while ((p = strtok(NULL, ",")) != NULL);
+            }
+            if(!got_backend) {
+               fprintf(stderr, "vtpm spec missing required backend field!\n");
+               exit(1);
+            }
+            free(buf2);
+            d_config->num_vtpms++;
+        }
+    }
+
     if (!xlu_cfg_get_list (config, "vif", &nics, 0, 0)) {
         d_config->num_nics = 0;
         d_config->nics = NULL;
@@ -1073,7 +1125,7 @@ static void parse_config_data(const char
 
             p = strtok(buf2, ",");
             if (!p)
-                goto skip;
+                goto skip_nic;
             do {
                 while (*p == ' ')
                     p++;
@@ -1137,7 +1189,7 @@ static void parse_config_data(const char
                     fprintf(stderr, "the accel parameter for vifs is currently not supported\n");
                 }
             } while ((p = strtok(NULL, ",")) != NULL);
-skip:
+skip_nic:
             free(buf2);
             d_config->num_nics++;
         }
@@ -5634,6 +5686,132 @@ int main_blockdetach(int argc, char **ar
     return rc;
 }
 
+int main_vtpmattach(int argc, char **argv)
+{
+    int opt;
+    libxl_device_vtpm vtpm;
+    char *oparg;
+    unsigned int val;
+    uint32_t domid;
+
+    if ((opt = def_getopt(argc, argv, "", "vtpm-attach", 1)) != -1)
+        return opt;
+
+    if (domain_qualifier_to_domid(argv[optind], &domid, 0) < 0) {
+        fprintf(stderr, "%s is an invalid domain identifier\n", argv[optind]);
+        return 1;
+    }
+    ++optind;
+
+    libxl_device_vtpm_init(&vtpm);
+    for (argv += optind, argc -= optind; argc > 0; ++argv, --argc) {
+        if (MATCH_OPTION("uuid", *argv, oparg)) {
+            if(libxl_uuid_from_string(&(vtpm.uuid), oparg)) {
+                fprintf(stderr, "Invalid uuid specified (%s)\n", oparg);
+                return 1;
+            }
+        } else if (MATCH_OPTION("backend", *argv, oparg)) {
+            if(domain_qualifier_to_domid(oparg, &val, 0)) {
+                fprintf(stderr,
+                      "Specified backend domain does not exist, defaulting to Dom0\n");
+                val = 0;
+            }
+            vtpm.backend_domid = val;
+        } else {
+            fprintf(stderr, "unrecognized argument `%s'\n", *argv);
+            return 1;
+        }
+    }
+
+    if(dryrun_only) {
+       char* json = libxl_device_vtpm_to_json(ctx, &vtpm);
+       printf("vtpm: %s\n", json);
+       free(json);
+       libxl_device_vtpm_dispose(&vtpm);
+       if (ferror(stdout) || fflush(stdout)) { perror("stdout"); exit(-1); }
+       return 0;
+    }
+
+    if (libxl_device_vtpm_add(ctx, domid, &vtpm, 0)) {
+        fprintf(stderr, "libxl_device_vtpm_add failed.\n");
+        return 1;
+    }
+    libxl_device_vtpm_dispose(&vtpm);
+    return 0;
+}
+
+int main_vtpmlist(int argc, char **argv)
+{
+    int opt;
+    libxl_device_vtpm *vtpms;
+    libxl_vtpminfo vtpminfo;
+    int nb, i;
+
+    if ((opt = def_getopt(argc, argv, "", "vtpm-list", 1)) != -1)
+        return opt;
+
+    /*      Idx  BE   UUID   Hdl  Sta  evch rref  BE-path */
+    printf("%-3s %-2s %-36s %-6s %-5s %-6s %-5s %-10s\n",
+           "Idx", "BE", "Uuid", "handle", "state", "evt-ch", "ring-ref", "BE-path");
+    for (argv += optind, argc -= optind; argc > 0; --argc, ++argv) {
+        uint32_t domid;
+        if (domain_qualifier_to_domid(*argv, &domid, 0) < 0) {
+            fprintf(stderr, "%s is an invalid domain identifier\n", *argv);
+            continue;
+        }
+        if (!(vtpms = libxl_device_vtpm_list(ctx, domid, &nb))) {
+            continue;
+        }
+        for (i = 0; i < nb; ++i) {
+           if(!libxl_device_vtpm_getinfo(ctx, domid, &vtpms[i], &vtpminfo)) {
+              /*      Idx  BE     UUID             Hdl Sta evch rref BE-path*/
+              printf("%-3d %-2d " LIBXL_UUID_FMT " %6d %5d %6d %8d %-30s\n",
+                    vtpminfo.devid, vtpminfo.backend_id,
+                    LIBXL_UUID_BYTES(vtpminfo.uuid),
+                    vtpminfo.devid, vtpminfo.state, vtpminfo.evtch,
+                    vtpminfo.rref, vtpminfo.backend);
+
+              libxl_vtpminfo_dispose(&vtpminfo);
+           }
+           libxl_device_vtpm_dispose(&vtpms[i]);
+        }
+        free(vtpms);
+    }
+    return 0;
+}
+
+int main_vtpmdetach(int argc, char **argv)
+{
+    uint32_t domid;
+    int opt, rc=0;
+    libxl_device_vtpm vtpm;
+    libxl_uuid uuid;
+
+    if ((opt = def_getopt(argc, argv, "", "vtpm-detach", 2)) != -1)
+        return opt;
+
+    domid = find_domain(argv[optind]);
+
+    if ( libxl_uuid_from_string(&uuid, argv[optind+1])) {
+        if (libxl_devid_to_device_vtpm(ctx, domid, atoi(argv[optind+1]), &vtpm)) {
+            fprintf(stderr, "Unknown device %s.\n", argv[optind+1]);
+            return 1;
+        }
+    } else {
+        if (libxl_uuid_to_device_vtpm(ctx, domid, &uuid, &vtpm)) {
+            fprintf(stderr, "Unknown device %s.\n", argv[optind+1]);
+            return 1;
+        }
+    }
+    rc = libxl_device_vtpm_remove(ctx, domid, &vtpm, 0);
+    if (rc) {
+        fprintf(stderr, "libxl_device_vtpm_remove failed.\n");
+    }
+    libxl_device_vtpm_dispose(&vtpm);
+    return rc;
+}
+
+
 static char *uptime_to_string(unsigned long uptime, int short_mode)
 {
     int sec, min, hour, day;
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/xl_cmdtable.c	Tue Nov 13 10:46:59 2012 +0000
@@ -341,6 +341,21 @@ struct cmd_spec cmd_table[] = {
       "Destroy a domain's virtual block device",
       "<Domain> <DevId>",
     },
+    { "vtpm-attach",
+      &main_vtpmattach, 1, 1,
+      "Create a new virtual TPM device",
+      "<Domain> [uuid=<uuid>] [backend=<BackDomain>]",
+    },
+    { "vtpm-list",
+      &main_vtpmlist, 0, 0,
+      "List virtual TPM devices for a domain",
+      "<Domain(s)>",
+    },
+    { "vtpm-detach",
+      &main_vtpmdetach, 0, 1,
+      "Destroy a domain's virtual TPM device",
+      "<Domain> <DevId|uuid>",
+    },
     { "uptime",
       &main_uptime, 0, 0,
       "Print uptime for all/some domains",

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 16:22:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 16:22: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 1TYJFj-0004GJ-Ad; Tue, 13 Nov 2012 16:22: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 1TYJFh-0004F1-3T
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:17 +0000
Received: from [85.158.139.83:19313] by server-16.bemta-5.messagelabs.com id
	B2/67-04786-8B372A05; Tue, 13 Nov 2012 16:22:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-182.messagelabs.com!1352823731!30087608!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17806 invoked from network); 13 Nov 2012 16:22:12 -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;
	13 Nov 2012 16: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 1TYJFb-00037r-0J
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYJFa-0006iK-V4
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:10 +0000
Message-Id: <E1TYJFa-0006iK-V4@xenbits.xen.org>
Date: Tue, 13 Nov 2012 16:22:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: add vtpm 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: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1352803619 0
# Node ID 2a4c1d3a080e7d3b20354155b6ac09e53d812cc6
# Parent  34d52300f5d22102d38e8d18067671f0b7ef656e
libxl: add vtpm support

This patch adds vtpm support to libxl. It adds vtpm parsing to config
files and 3 new xl commands:
vtpm-attach
vtpm-detach
vtpm-list

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 34d52300f5d2 -r 2a4c1d3a080e docs/man/xl.cfg.pod.5
--- a/docs/man/xl.cfg.pod.5	Tue Nov 13 10:46:58 2012 +0000
+++ b/docs/man/xl.cfg.pod.5	Tue Nov 13 10:46:59 2012 +0000
@@ -298,6 +298,35 @@ Specifies the networking provision (both
 and Xen virtual interfaces) to provided to the guest.  See
 F<docs/misc/xl-network-configuration.markdown>.
 
+=item B<vtpm=[ "VTPM_SPEC_STRING", "VTPM_SPEC_STRING", ...]>
+
+Specifies the virtual trusted platform module to be
+provided to the guest. Please see F<docs/misc/vtpm.txt>
+for more details.
+
+Each B<VTPM_SPEC_STRING> is a comma-separated list of C<KEY=VALUE>
+settings, from the following list:
+
+=over 4
+
+=item C<backend=DOMAIN>
+
+Specify the backend domain name of id. This value is required!
+If this domain is a guest, the backend should be set to the
+vtpm domain name. If this domain is a vtpm, the
+backend should be set to the vtpm manager domain name.
+
+=item C<uuid=UUID>
+
+Specify the uuid of this vtpm device. The uuid is used to uniquely
+identify the vtpm device. You can create one using the uuidgen
+program on unix systems. If left unspecified, a new uuid
+will be randomly generated every time the domain boots.
+If this is a vtpm domain, you should specify a value. The
+value is optional if this is a guest domain.
+
+=back
+
 =item B<vfb=[ "VFB_SPEC_STRING", "VFB_SPEC_STRING", ...]>
 
 Specifies the paravirtual framebuffer devices which should be supplied
diff -r 34d52300f5d2 -r 2a4c1d3a080e docs/man/xl.pod.1
--- a/docs/man/xl.pod.1	Tue Nov 13 10:46:58 2012 +0000
+++ b/docs/man/xl.pod.1	Tue Nov 13 10:46:59 2012 +0000
@@ -1106,6 +1106,31 @@ List virtual network interfaces for a do
 
 =back
 
+=head2 VTPM DEVICES
+
+=over 4
+
+=item B<vtpm-attach> I<domain-id> I<vtpm-device>
+
+Creates a new vtpm device in the domain specified by I<domain-id>.
+I<vtpm-device> describes the device to attach, using the same format as the
+B<vtpm> string in the domain config file. See L<xl.cfg> for
+more information.
+
+=item B<vtpm-detach> I<domain-id> I<devid|uuid>
+
+Removes the vtpm device from the domain specified by I<domain-id>.
+I<devid> is the numeric device id given to the virtual trusted
+platform module device. You will need to run B<xl vtpm-list> to determine that number.
+Alternatively the I<uuid> of the vtpm can be used to
+select the virtual device to detach.
+
+=item B<vtpm-list> I<domain-id>
+
+List virtual trusted platform modules for a domain.
+
+=back
+
 =head1 PCI PASS-THROUGH
 
 =over 4
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Nov 13 10:46:59 2012 +0000
@@ -1710,6 +1710,243 @@ out:
 }
 
 /******************************************************************************/
+int libxl__device_vtpm_setdefault(libxl__gc *gc, libxl_device_vtpm *vtpm)
+{
+   if(libxl_uuid_is_nil(&vtpm->uuid)) {
+      libxl_uuid_generate(&vtpm->uuid);
+   }
+   return 0;
+}
+
+static int libxl__device_from_vtpm(libxl__gc *gc, uint32_t domid,
+                                   libxl_device_vtpm *vtpm,
+                                   libxl__device *device)
+{
+   device->backend_devid   = vtpm->devid;
+   device->backend_domid   = vtpm->backend_domid;
+   device->backend_kind    = LIBXL__DEVICE_KIND_VTPM;
+   device->devid           = vtpm->devid;
+   device->domid           = domid;
+   device->kind            = LIBXL__DEVICE_KIND_VTPM;
+
+   return 0;
+}
+
+void libxl__device_vtpm_add(libxl__egc *egc, uint32_t domid,
+                           libxl_device_vtpm *vtpm,
+                           libxl__ao_device *aodev)
+{
+    STATE_AO_GC(aodev->ao);
+    flexarray_t *front;
+    flexarray_t *back;
+    libxl__device *device;
+    char *dompath, **l;
+    unsigned int nb, rc;
+
+    rc = libxl__device_vtpm_setdefault(gc, vtpm);
+    if (rc) goto out;
+
+    front = flexarray_make(gc, 16, 1);
+    back = flexarray_make(gc, 16, 1);
+
+    if(vtpm->devid == -1) {
+        if (!(dompath = libxl__xs_get_dompath(gc, domid))) {
+            rc = ERROR_FAIL;
+            goto out;
+        }
+        l = libxl__xs_directory(gc, XBT_NULL,
+              GCSPRINTF("%s/device/vtpm", dompath), &nb);
+        if(l == NULL || nb == 0) {
+            vtpm->devid = 0;
+        } else {
+            vtpm->devid = strtoul(l[nb - 1], NULL, 10) + 1;
+        }
+    }
+
+    GCNEW(device);
+    rc = libxl__device_from_vtpm(gc, domid, vtpm, device);
+    if ( rc != 0 ) goto out;
+
+    flexarray_append(back, "frontend-id");
+    flexarray_append(back, GCSPRINTF("%d", domid));
+    flexarray_append(back, "online");
+    flexarray_append(back, "1");
+    flexarray_append(back, "state");
+    flexarray_append(back, GCSPRINTF("%d", 1));
+    flexarray_append(back, "handle");
+    flexarray_append(back, GCSPRINTF("%d", vtpm->devid));
+
+    flexarray_append(back, "uuid");
+    flexarray_append(back, GCSPRINTF(LIBXL_UUID_FMT, LIBXL_UUID_BYTES(vtpm->uuid)));
+    flexarray_append(back, "resume");
+    flexarray_append(back, "False");
+
+    flexarray_append(front, "backend-id");
+    flexarray_append(front, GCSPRINTF("%d", vtpm->backend_domid));
+    flexarray_append(front, "state");
+    flexarray_append(front, GCSPRINTF("%d", 1));
+    flexarray_append(front, "handle");
+    flexarray_append(front, GCSPRINTF("%d", vtpm->devid));
+
+    libxl__device_generic_add(gc, XBT_NULL, device,
+                             libxl__xs_kvs_of_flexarray(gc, back, back->count),
+                             libxl__xs_kvs_of_flexarray(gc, front, front->count));
+
+    aodev->dev = device;
+    aodev->action = DEVICE_CONNECT;
+    libxl__wait_device_connection(egc, aodev);
+
+    rc = 0;
+out:
+    aodev->rc = rc;
+    if(rc) aodev->callback(egc, aodev);
+    return;
+}
+
+libxl_device_vtpm *libxl_device_vtpm_list(libxl_ctx *ctx, uint32_t domid, int *num)
+{
+    GC_INIT(ctx);
+
+    libxl_device_vtpm* vtpms = NULL;
+    char* fe_path = NULL;
+    char** dir = NULL;
+    unsigned int ndirs = 0;
+
+    *num = 0;
+
+    fe_path = libxl__sprintf(gc, "%s/device/vtpm", libxl__xs_get_dompath(gc, domid));
+    dir = libxl__xs_directory(gc, XBT_NULL, fe_path, &ndirs);
+    if(dir) {
+       vtpms = malloc(sizeof(*vtpms) * ndirs);
+       libxl_device_vtpm* vtpm;
+       libxl_device_vtpm* end = vtpms + ndirs;
+       for(vtpm = vtpms; vtpm < end; ++vtpm, ++dir) {
+          char* tmp;
+          const char* be_path = libxl__xs_read(gc, XBT_NULL,
+                GCSPRINTF("%s/%s/backend",
+                   fe_path, *dir));
+
+          vtpm->devid = atoi(*dir);
+
+          tmp = libxl__xs_read(gc, XBT_NULL,
+                GCSPRINTF("%s/%s/backend_id",
+                   fe_path, *dir));
+          vtpm->backend_domid = atoi(tmp);
+
+          tmp = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/uuid", be_path));
+          if(tmp) {
+             if(libxl_uuid_from_string(&(vtpm->uuid), tmp)) {
+                LOG(ERROR, "%s/uuid is a malformed uuid?? (%s) Probably a bug!!\n", be_path, tmp);
+                exit(1);
+             }
+          }
+       }
+    }
+    *num = ndirs;
+
+    GC_FREE;
+    return vtpms;
+}
+
+int libxl_device_vtpm_getinfo(libxl_ctx *ctx,
+                              uint32_t domid,
+                              libxl_device_vtpm *vtpm,
+                              libxl_vtpminfo *vtpminfo)
+{
+    GC_INIT(ctx);
+    char *dompath, *vtpmpath;
+    char *val;
+    int rc = 0;
+
+    libxl_vtpminfo_init(vtpminfo);
+    dompath = libxl__xs_get_dompath(gc, domid);
+    vtpminfo->devid = vtpm->devid;
+
+    vtpmpath = GCSPRINTF("%s/device/vtpm/%d", dompath, vtpminfo->devid);
+    vtpminfo->backend = xs_read(ctx->xsh, XBT_NULL,
+          GCSPRINTF("%s/backend", vtpmpath), NULL);
+    if (!vtpminfo->backend) {
+        goto err;
+    }
+    if(!libxl__xs_read(gc, XBT_NULL, vtpminfo->backend)) {
+       goto err;
+    }
+
+    val = libxl__xs_read(gc, XBT_NULL,
+          GCSPRINTF("%s/backend-id", vtpmpath));
+    vtpminfo->backend_id = val ? strtoul(val, NULL, 10) : -1;
+
+    val = libxl__xs_read(gc, XBT_NULL,
+          GCSPRINTF("%s/state", vtpmpath));
+    vtpminfo->state = val ? strtoul(val, NULL, 10) : -1;
+
+    val = libxl__xs_read(gc, XBT_NULL,
+          GCSPRINTF("%s/event-channel", vtpmpath));
+    vtpminfo->evtch = val ? strtoul(val, NULL, 10) : -1;
+
+    val = libxl__xs_read(gc, XBT_NULL,
+          GCSPRINTF("%s/ring-ref", vtpmpath));
+    vtpminfo->rref = val ? strtoul(val, NULL, 10) : -1;
+
+    vtpminfo->frontend = xs_read(ctx->xsh, XBT_NULL,
+          GCSPRINTF("%s/frontend", vtpminfo->backend), NULL);
+
+    val = libxl__xs_read(gc, XBT_NULL,
+          GCSPRINTF("%s/frontend-id", vtpminfo->backend));
+    vtpminfo->frontend_id = val ? strtoul(val, NULL, 10) : -1;
+
+    val = libxl__xs_read(gc, XBT_NULL,
+          GCSPRINTF("%s/uuid", vtpminfo->backend));
+    if(val == NULL) {
+       LOG(ERROR, "%s/uuid does not exist!\n", vtpminfo->backend);
+       goto err;
+    }
+    if(libxl_uuid_from_string(&(vtpminfo->uuid), val)) {
+       LOG(ERROR,
+             "%s/uuid is a malformed uuid?? (%s) Probably a bug!\n",
+             vtpminfo->backend, val);
+       goto err;
+    }
+
+    goto exit;
+err:
+    rc = ERROR_FAIL;
+exit:
+    GC_FREE;
+    return rc;
+}
+
+int libxl_devid_to_device_vtpm(libxl_ctx *ctx,
+                               uint32_t domid,
+                               int devid,
+                               libxl_device_vtpm *vtpm)
+{
+    libxl_device_vtpm *vtpms;
+    int nb, i;
+    int rc;
+
+    vtpms = libxl_device_vtpm_list(ctx, domid, &nb);
+    if (!vtpms)
+        return ERROR_FAIL;
+
+    memset(vtpm, 0, sizeof (libxl_device_vtpm));
+    rc = 1;
+    for (i = 0; i < nb; ++i) {
+        if(devid == vtpms[i].devid) {
+            vtpm->backend_domid = vtpms[i].backend_domid;
+            vtpm->devid = vtpms[i].devid;
+            libxl_uuid_copy(&vtpm->uuid, &vtpms[i].uuid);
+            rc = 0;
+            break;
+        }
+    }
+
+    libxl_device_vtpm_list_free(vtpms, nb);
+    return rc;
+}
+
+
+/******************************************************************************/
 
 int libxl__device_disk_setdefault(libxl__gc *gc, libxl_device_disk *disk)
 {
@@ -3046,6 +3283,8 @@ out:
  * libxl_device_disk_destroy
  * libxl_device_nic_remove
  * libxl_device_nic_destroy
+ * libxl_device_vtpm_remove
+ * libxl_device_vtpm_destroy
  * libxl_device_vkb_remove
  * libxl_device_vkb_destroy
  * libxl_device_vfb_remove
@@ -3097,6 +3336,10 @@ DEFINE_DEVICE_REMOVE(vkb, destroy, 1)
 DEFINE_DEVICE_REMOVE(vfb, remove, 0)
 DEFINE_DEVICE_REMOVE(vfb, destroy, 1)
 
+/* vtpm */
+DEFINE_DEVICE_REMOVE(vtpm, remove, 0)
+DEFINE_DEVICE_REMOVE(vtpm, destroy, 1)
+
 #undef DEFINE_DEVICE_REMOVE
 
 /******************************************************************************/
@@ -3105,6 +3348,7 @@ DEFINE_DEVICE_REMOVE(vfb, destroy, 1)
 /* The following functions are defined:
  * libxl_device_disk_add
  * libxl_device_nic_add
+ * libxl_device_vtpm_add
  */
 
 #define DEFINE_DEVICE_ADD(type)                                         \
@@ -3131,6 +3375,9 @@ DEFINE_DEVICE_ADD(disk)
 /* nic */
 DEFINE_DEVICE_ADD(nic)
 
+/* vtpm */
+DEFINE_DEVICE_ADD(vtpm)
+
 #undef DEFINE_DEVICE_ADD
 
 /******************************************************************************/
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/libxl.h	Tue Nov 13 10:46:59 2012 +0000
@@ -478,13 +478,14 @@ typedef struct {
     libxl_domain_create_info c_info;
     libxl_domain_build_info b_info;
 
-    int num_disks, num_nics, num_pcidevs, num_vfbs, num_vkbs;
+    int num_disks, num_nics, num_pcidevs, num_vfbs, num_vkbs, num_vtpms;
 
     libxl_device_disk *disks;
     libxl_device_nic *nics;
     libxl_device_pci *pcidevs;
     libxl_device_vfb *vfbs;
     libxl_device_vkb *vkbs;
+    libxl_device_vtpm *vtpms;
 
     libxl_action_on_shutdown on_poweroff;
     libxl_action_on_shutdown on_reboot;
@@ -645,6 +646,9 @@ libxl_vcpuinfo *libxl_list_vcpu(libxl_ct
                                 int *nb_vcpu, int *nr_vcpus_out);
 void libxl_vcpuinfo_list_free(libxl_vcpuinfo *, int nr_vcpus);
 
+void libxl_device_vtpm_list_free(libxl_device_vtpm*, int nr_vtpms);
+void libxl_vtpminfo_list_free(libxl_vtpminfo *, int nr_vtpms);
+
 /*
  * Devices
  * =======
@@ -745,6 +749,23 @@ libxl_device_nic *libxl_device_nic_list(
 int libxl_device_nic_getinfo(libxl_ctx *ctx, uint32_t domid,
                               libxl_device_nic *nic, libxl_nicinfo *nicinfo);
 
+/* Virtual TPMs */
+int libxl_device_vtpm_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vtpm *vtpm,
+                          const libxl_asyncop_how *ao_how)
+                          LIBXL_EXTERNAL_CALLERS_ONLY;
+int libxl_device_vtpm_remove(libxl_ctx *ctx, uint32_t domid,
+                            libxl_device_vtpm *vtpm,
+                            const libxl_asyncop_how *ao_how)
+                            LIBXL_EXTERNAL_CALLERS_ONLY;
+int libxl_device_vtpm_destroy(libxl_ctx *ctx, uint32_t domid,
+                              libxl_device_vtpm *vtpm,
+                              const libxl_asyncop_how *ao_how)
+                              LIBXL_EXTERNAL_CALLERS_ONLY;
+
+libxl_device_vtpm *libxl_device_vtpm_list(libxl_ctx *ctx, uint32_t domid, int *num);
+int libxl_device_vtpm_getinfo(libxl_ctx *ctx, uint32_t domid,
+                               libxl_device_vtpm *vtpm, libxl_vtpminfo *vtpminfo);
+
 /* Keyboard */
 int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb,
                          const libxl_asyncop_how *ao_how)
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/libxl_create.c	Tue Nov 13 10:46:59 2012 +0000
@@ -55,6 +55,8 @@ void libxl_domain_config_dispose(libxl_d
         libxl_device_vkb_dispose(&d_config->vkbs[i]);
     free(d_config->vkbs);
 
+    libxl_device_vtpm_list_free(d_config->vtpms, d_config->num_vtpms);
+
     libxl_domain_create_info_dispose(&d_config->c_info);
     libxl_domain_build_info_dispose(&d_config->b_info);
 }
@@ -601,6 +603,8 @@ static void domcreate_bootloader_done(li
 static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *aodevs,
                                 int ret);
 
+static void domcreate_attach_vtpms(libxl__egc *egc, libxl__multidev *multidev,
+                                   int ret);
 static void domcreate_attach_pci(libxl__egc *egc, libxl__multidev *aodevs,
                                  int ret);
 
@@ -1085,13 +1089,13 @@ static void domcreate_devmodel_started(l
     if (d_config->num_nics > 0) {
         /* Attach nics */
         libxl__multidev_begin(ao, &dcs->multidev);
-        dcs->multidev.callback = domcreate_attach_pci;
+        dcs->multidev.callback = domcreate_attach_vtpms;
         libxl__add_nics(egc, ao, domid, d_config, &dcs->multidev);
         libxl__multidev_prepared(egc, &dcs->multidev, 0);
         return;
     }
 
-    domcreate_attach_pci(egc, &dcs->multidev, 0);
+    domcreate_attach_vtpms(egc, &dcs->multidev, 0);
     return;
 
 error_out:
@@ -1099,6 +1103,39 @@ error_out:
     domcreate_complete(egc, dcs, ret);
 }
 
+static void domcreate_attach_vtpms(libxl__egc *egc,
+                                   libxl__multidev *multidev,
+                                   int ret)
+{
+   libxl__domain_create_state *dcs = CONTAINER_OF(multidev, *dcs, multidev);
+   STATE_AO_GC(dcs->ao);
+   int domid = dcs->guest_domid;
+
+   libxl_domain_config* const d_config = dcs->guest_config;
+
+   if(ret) {
+       LOG(ERROR, "unable to add nic devices");
+       goto error_out;
+   }
+
+    /* Plug vtpm devices */
+   if (d_config->num_vtpms > 0) {
+       /* Attach vtpms */
+       libxl__multidev_begin(ao, &dcs->multidev);
+       dcs->multidev.callback = domcreate_attach_pci;
+       libxl__add_vtpms(egc, ao, domid, d_config, &dcs->multidev);
+       libxl__multidev_prepared(egc, &dcs->multidev, 0);
+       return;
+   }
+
+   domcreate_attach_pci(egc, multidev, 0);
+   return;
+
+error_out:
+   assert(ret);
+   domcreate_complete(egc, dcs, ret);
+}
+
 static void domcreate_attach_pci(libxl__egc *egc, libxl__multidev *multidev,
                                  int ret)
 {
@@ -1112,7 +1149,7 @@ static void domcreate_attach_pci(libxl__
     libxl_domain_config *const d_config = dcs->guest_config;
 
     if (ret) {
-        LOG(ERROR, "unable to add nic devices");
+        LOG(ERROR, "unable to add vtpm devices");
         goto error_out;
     }
 
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/libxl_device.c	Tue Nov 13 10:46:59 2012 +0000
@@ -497,6 +497,7 @@ void libxl__multidev_prepared(libxl__egc
  * The following functions are defined:
  * libxl__add_disks
  * libxl__add_nics
+ * libxl__add_vtpms
  */
 
 #define DEFINE_DEVICES_ADD(type)                                        \
@@ -515,6 +516,7 @@ void libxl__multidev_prepared(libxl__egc
 
 DEFINE_DEVICES_ADD(disk)
 DEFINE_DEVICES_ADD(nic)
+DEFINE_DEVICES_ADD(vtpm)
 
 #undef DEFINE_DEVICES_ADD
 
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/libxl_internal.h	Tue Nov 13 10:46:59 2012 +0000
@@ -958,6 +958,7 @@ _hidden int libxl__device_disk_setdefaul
                                           libxl_device_disk *disk);
 _hidden int libxl__device_nic_setdefault(libxl__gc *gc, libxl_device_nic *nic,
                                          uint32_t domid);
+_hidden int libxl__device_vtpm_setdefault(libxl__gc *gc, libxl_device_vtpm *vtpm);
 _hidden int libxl__device_vfb_setdefault(libxl__gc *gc, libxl_device_vfb *vfb);
 _hidden int libxl__device_vkb_setdefault(libxl__gc *gc, libxl_device_vkb *vkb);
 _hidden int libxl__device_pci_setdefault(libxl__gc *gc, libxl_device_pci *pci);
@@ -2007,6 +2008,10 @@ _hidden void libxl__device_nic_add(libxl
                                    libxl_device_nic *nic,
                                    libxl__ao_device *aodev);
 
+_hidden void libxl__device_vtpm_add(libxl__egc *egc, uint32_t domid,
+                                   libxl_device_vtpm *vtpm,
+                                   libxl__ao_device *aodev);
+
 /* Internal function to connect a vkb device */
 _hidden int libxl__device_vkb_add(libxl__gc *gc, uint32_t domid,
                                   libxl_device_vkb *vkb);
@@ -2439,6 +2444,10 @@ _hidden void libxl__add_nics(libxl__egc 
                              libxl_domain_config *d_config,
                              libxl__multidev *multidev);
 
+_hidden void libxl__add_vtpms(libxl__egc *egc, libxl__ao *ao, uint32_t domid,
+                             libxl_domain_config *d_config,
+                             libxl__multidev *multidev);
+
 /*----- device model creation -----*/
 
 /* First layer; wraps libxl__spawn_spawn. */
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/libxl_types.idl	Tue Nov 13 10:46:59 2012 +0000
@@ -395,6 +395,12 @@ libxl_device_pci = Struct("device_pci", 
     ("permissive", bool),
     ])
 
+libxl_device_vtpm = Struct("device_vtpm", [
+    ("backend_domid",    libxl_domid),
+    ("devid",            libxl_devid),
+    ("uuid",             libxl_uuid),
+])
+
 libxl_diskinfo = Struct("diskinfo", [
     ("backend", string),
     ("backend_id", uint32),
@@ -418,6 +424,18 @@ libxl_nicinfo = Struct("nicinfo", [
     ("rref_rx", integer),
     ], dir=DIR_OUT)
 
+libxl_vtpminfo = Struct("vtpminfo", [
+    ("backend", string),
+    ("backend_id", uint32),
+    ("frontend", string),
+    ("frontend_id", uint32),
+    ("devid", libxl_devid),
+    ("state", integer),
+    ("evtch", integer),
+    ("rref", integer),
+    ("uuid", libxl_uuid),
+    ], dir=DIR_OUT)
+
 libxl_vcpuinfo = Struct("vcpuinfo", [
     ("vcpuid", uint32),
     ("cpu", uint32),
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/libxl_types_internal.idl
--- a/tools/libxl/libxl_types_internal.idl	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/libxl_types_internal.idl	Tue Nov 13 10:46:59 2012 +0000
@@ -19,6 +19,7 @@ libxl__device_kind = Enumeration("device
     (5, "VFB"),
     (6, "VKBD"),
     (7, "CONSOLE"),
+    (8, "VTPM"),
     ])
 
 libxl__console_backend = Enumeration("console_backend", [
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/libxl_utils.c	Tue Nov 13 10:46:59 2012 +0000
@@ -463,6 +463,33 @@ int libxl_pipe(libxl_ctx *ctx, int pipes
     return 0;
 }
 
+int libxl_uuid_to_device_vtpm(libxl_ctx *ctx, uint32_t domid,
+                            libxl_uuid* uuid, libxl_device_vtpm *vtpm)
+{
+    libxl_device_vtpm *vtpms;
+    int nb, i;
+    int rc;
+
+    vtpms = libxl_device_vtpm_list(ctx, domid, &nb);
+    if (!vtpms)
+        return ERROR_FAIL;
+
+    memset(vtpm, 0, sizeof (libxl_device_vtpm));
+    rc = 1;
+    for (i = 0; i < nb; ++i) {
+        if(!libxl_uuid_compare(uuid, &vtpms[i].uuid)) {
+            vtpm->backend_domid = vtpms[i].backend_domid;
+            vtpm->devid = vtpms[i].devid;
+            libxl_uuid_copy(&vtpm->uuid, &vtpms[i].uuid);
+            rc = 0;
+            break;
+        }
+    }
+
+    libxl_device_vtpm_list_free(vtpms, nb);
+    return rc;
+}
+
 int libxl_mac_to_device_nic(libxl_ctx *ctx, uint32_t domid,
                             const char *mac, libxl_device_nic *nic)
 {
@@ -819,6 +846,22 @@ void libxl_cpupoolinfo_list_free(libxl_c
     free(list);
 }
 
+void libxl_vtpminfo_list_free(libxl_vtpminfo* list, int nr)
+{
+   int i;
+   for (i = 0; i < nr; i++)
+      libxl_vtpminfo_dispose(&list[i]);
+   free(list);
+}
+
+void libxl_device_vtpm_list_free(libxl_device_vtpm* list, int nr)
+{
+   int i;
+   for (i = 0; i < nr; i++)
+      libxl_device_vtpm_dispose(&list[i]);
+   free(list);
+}
+
 int libxl_domid_valid_guest(uint32_t domid)
 {
     /* returns 1 if the value _could_ be a valid guest domid, 0 otherwise
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/libxl_utils.h
--- a/tools/libxl/libxl_utils.h	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/libxl_utils.h	Tue Nov 13 10:46:59 2012 +0000
@@ -64,6 +64,11 @@ int libxl_devid_to_device_nic(libxl_ctx 
 int libxl_vdev_to_device_disk(libxl_ctx *ctx, uint32_t domid, const char *vdev,
                                libxl_device_disk *disk);
 
+int libxl_uuid_to_device_vtpm(libxl_ctx *ctx, uint32_t domid,
+                               libxl_uuid *uuid, libxl_device_vtpm *vtpm);
+int libxl_devid_to_device_vtpm(libxl_ctx *ctx, uint32_t domid,
+                               int devid, libxl_device_vtpm *vtpm);
+
 int libxl_bitmap_alloc(libxl_ctx *ctx, libxl_bitmap *bitmap, int n_bits);
     /* Allocated bimap is from malloc, libxl_bitmap_dispose() to be
      * called by the application when done. */
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/xl.h
--- a/tools/libxl/xl.h	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/xl.h	Tue Nov 13 10:46:59 2012 +0000
@@ -79,6 +79,9 @@ int main_networkdetach(int argc, char **
 int main_blockattach(int argc, char **argv);
 int main_blocklist(int argc, char **argv);
 int main_blockdetach(int argc, char **argv);
+int main_vtpmattach(int argc, char **argv);
+int main_vtpmlist(int argc, char **argv);
+int main_vtpmdetach(int argc, char **argv);
 int main_uptime(int argc, char **argv);
 int main_tmem_list(int argc, char **argv);
 int main_tmem_freeze(int argc, char **argv);
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Tue Nov 13 10:46:59 2012 +0000
@@ -573,7 +573,7 @@ static void parse_config_data(const char
     const char *buf;
     long l;
     XLU_Config *config;
-    XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids;
+    XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids, *vtpms;
     XLU_ConfigList *ioports, *irqs, *iomem;
     int num_ioports, num_irqs, num_iomem;
     int pci_power_mgmt = 0;
@@ -1048,6 +1048,58 @@ static void parse_config_data(const char
         }
     }
 
+    if (!xlu_cfg_get_list(config, "vtpm", &vtpms, 0, 0)) {
+        d_config->num_vtpms = 0;
+        d_config->vtpms = NULL;
+        while ((buf = xlu_cfg_get_listitem (vtpms, d_config->num_vtpms)) != NULL) {
+            libxl_device_vtpm *vtpm;
+            char * buf2 = strdup(buf);
+            char *p, *p2;
+            bool got_backend = false;
+
+            d_config->vtpms = (libxl_device_vtpm *) realloc(d_config->vtpms,
+                  sizeof(libxl_device_vtpm) * (d_config->num_vtpms+1));
+            vtpm = d_config->vtpms + d_config->num_vtpms;
+            libxl_device_vtpm_init(vtpm);
+            vtpm->devid = d_config->num_vtpms;
+
+            p = strtok(buf2, ",");
+            if(p) {
+               do {
+                  while(*p == ' ')
+                     ++p;
+                  if ((p2 = strchr(p, '=')) == NULL)
+                     break;
+                  *p2 = '\0';
+                  if (!strcmp(p, "backend")) {
+                     if(domain_qualifier_to_domid(p2 + 1, &(vtpm->backend_domid), 0))
+                     {
+                        fprintf(stderr,
+                              "Specified vtpm backend domain `%s' does not exist!\n", p2 + 1);
+                        exit(1);
+                     }
+                     got_backend = true;
+                  } else if(!strcmp(p, "uuid")) {
+                     if( libxl_uuid_from_string(&vtpm->uuid, p2 + 1) ) {
+                        fprintf(stderr,
+                              "Failed to parse vtpm UUID: %s\n", p2 + 1);
+                        exit(1);
+                    }
+                  } else {
+                     fprintf(stderr, "Unknown string `%s' in vtpm spec\n", p);
+                     exit(1);
+                  }
+               } while ((p = strtok(NULL, ",")) != NULL);
+            }
+            if(!got_backend) {
+               fprintf(stderr, "vtpm spec missing required backend field!\n");
+               exit(1);
+            }
+            free(buf2);
+            d_config->num_vtpms++;
+        }
+    }
+
     if (!xlu_cfg_get_list (config, "vif", &nics, 0, 0)) {
         d_config->num_nics = 0;
         d_config->nics = NULL;
@@ -1073,7 +1125,7 @@ static void parse_config_data(const char
 
             p = strtok(buf2, ",");
             if (!p)
-                goto skip;
+                goto skip_nic;
             do {
                 while (*p == ' ')
                     p++;
@@ -1137,7 +1189,7 @@ static void parse_config_data(const char
                     fprintf(stderr, "the accel parameter for vifs is currently not supported\n");
                 }
             } while ((p = strtok(NULL, ",")) != NULL);
-skip:
+skip_nic:
             free(buf2);
             d_config->num_nics++;
         }
@@ -5634,6 +5686,132 @@ int main_blockdetach(int argc, char **ar
     return rc;
 }
 
+int main_vtpmattach(int argc, char **argv)
+{
+    int opt;
+    libxl_device_vtpm vtpm;
+    char *oparg;
+    unsigned int val;
+    uint32_t domid;
+
+    if ((opt = def_getopt(argc, argv, "", "vtpm-attach", 1)) != -1)
+        return opt;
+
+    if (domain_qualifier_to_domid(argv[optind], &domid, 0) < 0) {
+        fprintf(stderr, "%s is an invalid domain identifier\n", argv[optind]);
+        return 1;
+    }
+    ++optind;
+
+    libxl_device_vtpm_init(&vtpm);
+    for (argv += optind, argc -= optind; argc > 0; ++argv, --argc) {
+        if (MATCH_OPTION("uuid", *argv, oparg)) {
+            if(libxl_uuid_from_string(&(vtpm.uuid), oparg)) {
+                fprintf(stderr, "Invalid uuid specified (%s)\n", oparg);
+                return 1;
+            }
+        } else if (MATCH_OPTION("backend", *argv, oparg)) {
+            if(domain_qualifier_to_domid(oparg, &val, 0)) {
+                fprintf(stderr,
+                      "Specified backend domain does not exist, defaulting to Dom0\n");
+                val = 0;
+            }
+            vtpm.backend_domid = val;
+        } else {
+            fprintf(stderr, "unrecognized argument `%s'\n", *argv);
+            return 1;
+        }
+    }
+
+    if(dryrun_only) {
+       char* json = libxl_device_vtpm_to_json(ctx, &vtpm);
+       printf("vtpm: %s\n", json);
+       free(json);
+       libxl_device_vtpm_dispose(&vtpm);
+       if (ferror(stdout) || fflush(stdout)) { perror("stdout"); exit(-1); }
+       return 0;
+    }
+
+    if (libxl_device_vtpm_add(ctx, domid, &vtpm, 0)) {
+        fprintf(stderr, "libxl_device_vtpm_add failed.\n");
+        return 1;
+    }
+    libxl_device_vtpm_dispose(&vtpm);
+    return 0;
+}
+
+int main_vtpmlist(int argc, char **argv)
+{
+    int opt;
+    libxl_device_vtpm *vtpms;
+    libxl_vtpminfo vtpminfo;
+    int nb, i;
+
+    if ((opt = def_getopt(argc, argv, "", "vtpm-list", 1)) != -1)
+        return opt;
+
+    /*      Idx  BE   UUID   Hdl  Sta  evch rref  BE-path */
+    printf("%-3s %-2s %-36s %-6s %-5s %-6s %-5s %-10s\n",
+           "Idx", "BE", "Uuid", "handle", "state", "evt-ch", "ring-ref", "BE-path");
+    for (argv += optind, argc -= optind; argc > 0; --argc, ++argv) {
+        uint32_t domid;
+        if (domain_qualifier_to_domid(*argv, &domid, 0) < 0) {
+            fprintf(stderr, "%s is an invalid domain identifier\n", *argv);
+            continue;
+        }
+        if (!(vtpms = libxl_device_vtpm_list(ctx, domid, &nb))) {
+            continue;
+        }
+        for (i = 0; i < nb; ++i) {
+           if(!libxl_device_vtpm_getinfo(ctx, domid, &vtpms[i], &vtpminfo)) {
+              /*      Idx  BE     UUID             Hdl Sta evch rref BE-path*/
+              printf("%-3d %-2d " LIBXL_UUID_FMT " %6d %5d %6d %8d %-30s\n",
+                    vtpminfo.devid, vtpminfo.backend_id,
+                    LIBXL_UUID_BYTES(vtpminfo.uuid),
+                    vtpminfo.devid, vtpminfo.state, vtpminfo.evtch,
+                    vtpminfo.rref, vtpminfo.backend);
+
+              libxl_vtpminfo_dispose(&vtpminfo);
+           }
+           libxl_device_vtpm_dispose(&vtpms[i]);
+        }
+        free(vtpms);
+    }
+    return 0;
+}
+
+int main_vtpmdetach(int argc, char **argv)
+{
+    uint32_t domid;
+    int opt, rc=0;
+    libxl_device_vtpm vtpm;
+    libxl_uuid uuid;
+
+    if ((opt = def_getopt(argc, argv, "", "vtpm-detach", 2)) != -1)
+        return opt;
+
+    domid = find_domain(argv[optind]);
+
+    if ( libxl_uuid_from_string(&uuid, argv[optind+1])) {
+        if (libxl_devid_to_device_vtpm(ctx, domid, atoi(argv[optind+1]), &vtpm)) {
+            fprintf(stderr, "Unknown device %s.\n", argv[optind+1]);
+            return 1;
+        }
+    } else {
+        if (libxl_uuid_to_device_vtpm(ctx, domid, &uuid, &vtpm)) {
+            fprintf(stderr, "Unknown device %s.\n", argv[optind+1]);
+            return 1;
+        }
+    }
+    rc = libxl_device_vtpm_remove(ctx, domid, &vtpm, 0);
+    if (rc) {
+        fprintf(stderr, "libxl_device_vtpm_remove failed.\n");
+    }
+    libxl_device_vtpm_dispose(&vtpm);
+    return rc;
+}
+
+
 static char *uptime_to_string(unsigned long uptime, int short_mode)
 {
     int sec, min, hour, day;
diff -r 34d52300f5d2 -r 2a4c1d3a080e tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c	Tue Nov 13 10:46:58 2012 +0000
+++ b/tools/libxl/xl_cmdtable.c	Tue Nov 13 10:46:59 2012 +0000
@@ -341,6 +341,21 @@ struct cmd_spec cmd_table[] = {
       "Destroy a domain's virtual block device",
       "<Domain> <DevId>",
     },
+    { "vtpm-attach",
+      &main_vtpmattach, 1, 1,
+      "Create a new virtual TPM device",
+      "<Domain> [uuid=<uuid>] [backend=<BackDomain>]",
+    },
+    { "vtpm-list",
+      &main_vtpmlist, 0, 0,
+      "List virtual TPM devices for a domain",
+      "<Domain(s)>",
+    },
+    { "vtpm-detach",
+      &main_vtpmdetach, 0, 1,
+      "Destroy a domain's virtual TPM device",
+      "<Domain> <DevId|uuid>",
+    },
     { "uptime",
       &main_uptime, 0, 0,
       "Print uptime for all/some domains",

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 16:22:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 16: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 1TYJFj-0004GD-6d; Tue, 13 Nov 2012 16:22:19 +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 1TYJFg-0004Dp-Tm
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:17 +0000
Received: from [85.158.137.99:24206] by server-14.bemta-3.messagelabs.com id
	19/66-12788-8B372A05; Tue, 13 Nov 2012 16:22:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-217.messagelabs.com!1352823730!18827904!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19355 invoked from network); 13 Nov 2012 16:22:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Nov 2012 16:22: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 1TYJFa-00037o-Dv
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYJFa-0006i5-9t
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:10 +0000
Message-Id: <E1TYJFa-0006i5-9t@xenbits.xen.org>
Date: Tue, 13 Nov 2012 16:22:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] minios: add tpmfront, tpm_tis,
	and tpmback drivers
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1352803618 0
# Node ID 34d52300f5d22102d38e8d18067671f0b7ef656e
# Parent  3015f8c6174b579ee62ff01cfa177ca33d6dd531
minios: add tpmfront, tpm_tis, and tpmback drivers

This patch adds 3 new drivers to mini-os.

tpmfront - paravirtualized tpm frontend driver
tpmback - paravirtualized tpm backend driver
tpm_tis - hardware tpm driver

Unfortunately these drivers were derived from GPL
licensed linux kernel drivers so they must carry
the GPL license. However, since mini-os now
supports conditional compilation, hopefully these
drivers can be included into the xen tree and
conditionally removed from non-gpl projects.
By default they are disabled in the makefile.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 3015f8c6174b -r 34d52300f5d2 extras/mini-os/Makefile
--- a/extras/mini-os/Makefile	Tue Nov 13 10:46:57 2012 +0000
+++ b/extras/mini-os/Makefile	Tue Nov 13 10:46:58 2012 +0000
@@ -22,6 +22,9 @@ CONFIG_QEMU_XS_ARGS ?= n
 CONFIG_TEST ?= n
 CONFIG_PCIFRONT ?= n
 CONFIG_BLKFRONT ?= y
+CONFIG_TPMFRONT ?= n
+CONFIG_TPM_TIS ?= n
+CONFIG_TPMBACK ?= n
 CONFIG_NETFRONT ?= y
 CONFIG_FBFRONT ?= y
 CONFIG_KBDFRONT ?= y
@@ -36,6 +39,9 @@ flags-$(CONFIG_SPARSE_BSS) += -DCONFIG_S
 flags-$(CONFIG_QEMU_XS_ARGS) += -DCONFIG_QEMU_XS_ARGS
 flags-$(CONFIG_PCIFRONT) += -DCONFIG_PCIFRONT
 flags-$(CONFIG_BLKFRONT) += -DCONFIG_BLKFRONT
+flags-$(CONFIG_TPMFRONT) += -DCONFIG_TPMFRONT
+flags-$(CONFIG_TPM_TIS) += -DCONFIG_TPM_TIS
+flags-$(CONFIG_TPMBACK) += -DCONFIG_TPMBACK
 flags-$(CONFIG_NETFRONT) += -DCONFIG_NETFRONT
 flags-$(CONFIG_KBDFRONT) += -DCONFIG_KBDFRONT
 flags-$(CONFIG_FBFRONT) += -DCONFIG_FBFRONT
@@ -67,6 +73,9 @@ TARGET := mini-os
 SUBDIRS := lib xenbus console
 
 src-$(CONFIG_BLKFRONT) += blkfront.c
+src-$(CONFIG_TPMFRONT) += tpmfront.c
+src-$(CONFIG_TPM_TIS) += tpm_tis.c
+src-$(CONFIG_TPMBACK) += tpmback.c
 src-y += daytime.c
 src-y += events.c
 src-$(CONFIG_FBFRONT) += fbfront.c
diff -r 3015f8c6174b -r 34d52300f5d2 extras/mini-os/include/lib.h
--- a/extras/mini-os/include/lib.h	Tue Nov 13 10:46:57 2012 +0000
+++ b/extras/mini-os/include/lib.h	Tue Nov 13 10:46:58 2012 +0000
@@ -142,6 +142,8 @@ enum fd_type {
     FTYPE_FB,
     FTYPE_MEM,
     FTYPE_SAVEFILE,
+    FTYPE_TPMFRONT,
+    FTYPE_TPM_TIS,
 };
 
 LIST_HEAD(evtchn_port_list, evtchn_port_info);
@@ -185,6 +187,20 @@ extern struct file {
 	struct {
 	    struct consfront_dev *dev;
 	} cons;
+#ifdef CONFIG_TPMFRONT
+	struct {
+	   struct tpmfront_dev *dev;
+	   int respgot;
+	   off_t offset;
+	} tpmfront;
+#endif
+#ifdef CONFIG_TPM_TIS
+	struct {
+	   struct tpm_chip *dev;
+	   int respgot;
+	   off_t offset;
+	} tpm_tis;
+#endif
 #ifdef CONFIG_XENBUS
         struct {
             /* To each xenbus FD is associated a queue of watch events for this
diff -r 3015f8c6174b -r 34d52300f5d2 extras/mini-os/include/tpm_tis.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/include/tpm_tis.h	Tue Nov 13 10:46:58 2012 +0000
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2010-2012 United States Government, as represented by
+ * the Secretary of Defense.  All rights reserved.
+ *
+ * This code has been derived from drivers/char/tpm.c
+ * from the linux kernel
+ *
+ * Copyright (C) 2004 IBM Corporation
+ *
+ * This code has also been derived from drivers/char/tpm/tpm_tis.c
+ * from the linux kernel
+ *
+ * Copyright (C) 2005, 2006 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, version 2
+ * of the License
+ */
+#ifndef TPM_TIS_H
+#define TPM_TIS_H
+
+#include <mini-os/types.h>
+#include <mini-os/byteorder.h>
+
+#define TPM_TIS_EN_LOCL0 1
+#define TPM_TIS_EN_LOCL1 (1 << 1)
+#define TPM_TIS_EN_LOCL2 (1 << 2)
+#define TPM_TIS_EN_LOCL3 (1 << 3)
+#define TPM_TIS_EN_LOCL4 (1 << 4)
+#define TPM_TIS_EN_LOCLALL (TPM_TIS_EN_LOCL0 | TPM_TIS_EN_LOCL1  | TPM_TIS_EN_LOCL2 | TPM_TIS_EN_LOCL3 | TPM_TIS_EN_LOCL4)
+#define TPM_TIS_LOCL_INT_TO_FLAG(x) (1 << x)
+#define TPM_BASEADDR 0xFED40000
+#define TPM_PROBE_IRQ 0xFFFF
+
+struct tpm_chip;
+
+struct tpm_chip* init_tpm_tis(unsigned long baseaddr, int localities, unsigned int irq);
+void shutdown_tpm_tis(struct tpm_chip* tpm);
+
+int tpm_tis_request_locality(struct tpm_chip* tpm, int locality);
+int tpm_tis_cmd(struct tpm_chip* tpm, uint8_t* req, size_t reqlen, uint8_t** resp, size_t* resplen);
+
+#ifdef HAVE_LIBC
+#include <sys/stat.h>
+#include <fcntl.h>
+/* POSIX IO functions:
+ * use tpm_tis_open() to get a file descriptor to the tpm device
+ * use write() on the fd to send a command to the backend. You must
+ * include the entire command in a single call to write().
+ * use read() on the fd to read the response. You can use
+ * fstat() to get the size of the response and lseek() to seek on it.
+ */
+int tpm_tis_open(struct tpm_chip* tpm);
+int tpm_tis_posix_read(int fd, uint8_t* buf, size_t count);
+int tpm_tis_posix_write(int fd, const uint8_t* buf, size_t count);
+int tpm_tis_posix_fstat(int fd, struct stat* buf);
+#endif
+
+#endif
diff -r 3015f8c6174b -r 34d52300f5d2 extras/mini-os/include/tpmback.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/include/tpmback.h	Tue Nov 13 10:46:58 2012 +0000
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2010-2012 United States Government, as represented by
+ * the Secretary of Defense.  All rights reserved.
+ *
+ * This code has been derived from drivers/xen/tpmback/tpmback.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (c) 2005, IBM Corporation
+ *
+ * which was itself derived from drivers/xen/netback/netback.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (c) 2002-2004, K A Fraser
+ *
+ * This code has also been derived from drivers/xen/tpmback/xenbus.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (C) 2005 IBM Corporation
+ * Copyright (C) 2005 Rusty Russell <rusty@rustcorp.com.au>
+ *
+ * This code has also been derived from drivers/xen/tpmback/interface.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (c) 2005, IBM Corporation
+ *
+ * which was itself also derived from drvivers/xen/netback/interface.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (c) 2004, Keir Fraser
+ *
+ * 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, version 2
+ * of the License
+ */
+
+#include <xen/io/tpmif.h>
+#include <xen/io/xenbus.h>
+#include <mini-os/types.h>
+#include <xen/xen.h>
+#ifndef TPMBACK_H
+#define TPMBACK_H
+
+struct tpmcmd {
+   domid_t domid;		/* Domid of the frontend */
+   unsigned int handle;	/* Handle of the frontend */
+   unsigned char uuid[16];			/* uuid of the tpm interface */
+
+   unsigned int req_len;		/* Size of the command in buf - set by tpmback driver */
+   uint8_t* req;			/* tpm command bits, allocated by driver, DON'T FREE IT */
+   unsigned int resp_len;	/* Size of the outgoing command,
+				   you set this before passing the cmd object to tpmback_resp */
+   uint8_t* resp;		/* Buffer for response - YOU MUST ALLOCATE IT, YOU MUST ALSO FREE IT */
+};
+typedef struct tpmcmd tpmcmd_t;
+
+/* Initialize the tpm backend driver */
+void init_tpmback(void);
+
+/* Shutdown tpm backend driver */
+void shutdown_tpmback(void);
+
+/* Blocks until a tpm command is sent from any front end.
+ * Returns a pointer to the tpm command to handle.
+ * Do not try to free this pointer or the req buffer
+ * This function will return NULL if the tpm backend driver
+ * is shutdown or any other error occurs */
+tpmcmd_t* tpmback_req_any(void);
+
+/* Blocks until a tpm command from the frontend at domid/handle
+ * is sent.
+ * Returns NULL if domid/handle is not connected, tpmback is
+ * shutdown or shutting down, or if there is an error
+ */
+tpmcmd_t* tpmback_req(domid_t domid, unsigned int handle);
+
+/* Send the response to the tpm command back to the frontend
+ * This function will free the tpmcmd object, but you must free the resp
+ * buffer yourself */
+void tpmback_resp(tpmcmd_t* tpmcmd);
+
+/* Waits for the first frontend to connect and then sets domid and handle appropriately.
+ * If one or more frontends are already connected, this will set domid and handle to one
+ * of them arbitrarily. The main use for this function is to wait until a single
+ * frontend connection has occured.
+ * returns 0 on success, non-zero on failure */
+int tpmback_wait_for_frontend_connect(domid_t *domid, unsigned int *handle);
+
+/* returns the number of frontends connected */
+int tpmback_num_frontends(void);
+
+/* Returns the uuid of the specified frontend, NULL on error.
+ * The return value is internally allocated, so don't free it */
+unsigned char* tpmback_get_uuid(domid_t domid, unsigned int handle);
+
+/* Specify a function to call when a new tpm device connects */
+void tpmback_set_open_callback(void (*cb)(domid_t, unsigned int));
+
+/* Specify a function to call when a tpm device disconnects */
+void tpmback_set_close_callback(void (*cb)(domid_t, unsigned int));
+
+//Not Implemented
+void tpmback_set_suspend_callback(void (*cb)(domid_t, unsigned int));
+void tpmback_set_resume_callback(void (*cb)(domid_t, unsigned int));
+
+#endif
diff -r 3015f8c6174b -r 34d52300f5d2 extras/mini-os/include/tpmfront.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/include/tpmfront.h	Tue Nov 13 10:46:58 2012 +0000
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2010-2012 United States Government, as represented by
+ * the Secretary of Defense.  All rights reserved.
+ *
+ * This code has been derived from drivers/char/tpm_vtpm.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (C) 2006 IBM Corporation
+ *
+ * This code has also been derived from drivers/char/tpm_xen.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (c) 2005, IBM Corporation
+ *
+ * which was itself derived from drivers/xen/netfront/netfront.c
+ * from the linux kernel
+ *
+ * Copyright (c) 2002-2004, K A Fraser
+ *
+ * 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, version 2 of the
+ * License.
+ */
+#ifndef TPMFRONT_H
+#define TPMFRONT_H
+
+#include <mini-os/types.h>
+#include <mini-os/os.h>
+#include <mini-os/events.h>
+#include <mini-os/wait.h>
+#include <xen/xen.h>
+#include <xen/io/xenbus.h>
+#include <xen/io/tpmif.h>
+
+struct tpmfront_dev {
+   grant_ref_t ring_ref;
+   evtchn_port_t evtchn;
+
+   tpmif_tx_interface_t* tx;
+
+   void** pages;
+
+   domid_t bedomid;
+   char* nodename;
+   char* bepath;
+
+   XenbusState state;
+
+   uint8_t waiting;
+   struct wait_queue_head waitq;
+
+   uint8_t* respbuf;
+   size_t resplen;
+
+#ifdef HAVE_LIBC
+   int fd;
+#endif
+
+};
+
+
+/*Initialize frontend */
+struct tpmfront_dev* init_tpmfront(const char* nodename);
+/*Shutdown frontend */
+void shutdown_tpmfront(struct tpmfront_dev* dev);
+
+/* Send a tpm command to the backend and wait for the response
+ *
+ * @dev - frontend device
+ * @req - request buffer
+ * @reqlen - length of request buffer
+ * @resp - *resp will be set to internal response buffer, don't free it! Value is undefined on error
+ * @resplen - *resplen will be set to the length of the response. Value is undefined on error
+ *
+ * returns 0 on success, non zero on failure.
+ * */
+int tpmfront_cmd(struct tpmfront_dev* dev, uint8_t* req, size_t reqlen, uint8_t** resp, size_t* resplen);
+
+#ifdef HAVE_LIBC
+#include <sys/stat.h>
+/* POSIX IO functions:
+ * use tpmfront_open() to get a file descriptor to the tpm device
+ * use write() on the fd to send a command to the backend. You must
+ * include the entire command in a single call to write().
+ * use read() on the fd to read the response. You can use
+ * fstat() to get the size of the response and lseek() to seek on it.
+ */
+int tpmfront_open(struct tpmfront_dev* dev);
+int tpmfront_posix_read(int fd, uint8_t* buf, size_t count);
+int tpmfront_posix_write(int fd, const uint8_t* buf, size_t count);
+int tpmfront_posix_fstat(int fd, struct stat* buf);
+#endif
+
+
+#endif
diff -r 3015f8c6174b -r 34d52300f5d2 extras/mini-os/lib/sys.c
--- a/extras/mini-os/lib/sys.c	Tue Nov 13 10:46:57 2012 +0000
+++ b/extras/mini-os/lib/sys.c	Tue Nov 13 10:46:58 2012 +0000
@@ -27,6 +27,8 @@
 #include <netfront.h>
 #include <blkfront.h>
 #include <fbfront.h>
+#include <tpmfront.h>
+#include <tpm_tis.h>
 #include <xenbus.h>
 #include <xenstore.h>
 
@@ -294,6 +296,16 @@ int read(int fd, void *buf, size_t nbyte
 	    return blkfront_posix_read(fd, buf, nbytes);
         }
 #endif
+#ifdef CONFIG_TPMFRONT
+        case FTYPE_TPMFRONT: {
+	    return tpmfront_posix_read(fd, buf, nbytes);
+        }
+#endif
+#ifdef CONFIG_TPM_TIS
+        case FTYPE_TPM_TIS: {
+	    return tpm_tis_posix_read(fd, buf, nbytes);
+        }
+#endif
 	default:
 	    break;
     }
@@ -330,6 +342,14 @@ int write(int fd, const void *buf, size_
 	case FTYPE_BLK:
 	    return blkfront_posix_write(fd, buf, nbytes);
 #endif
+#ifdef CONFIG_TPMFRONT
+	case FTYPE_TPMFRONT:
+	    return tpmfront_posix_write(fd, buf, nbytes);
+#endif
+#ifdef CONFIG_TPM_TIS
+	case FTYPE_TPM_TIS:
+	    return tpm_tis_posix_write(fd, buf, nbytes);
+#endif
 	default:
 	    break;
     }
@@ -341,8 +361,16 @@ int write(int fd, const void *buf, size_
 off_t lseek(int fd, off_t offset, int whence)
 {
     switch(files[fd].type) {
+#if defined(CONFIG_BLKFRONT) || defined(CONFIG_TPMFRONT) || defined(CONFIG_TPM_TIS)
 #ifdef CONFIG_BLKFRONT
        case FTYPE_BLK:
+#endif
+#ifdef CONFIG_TPMFRNT
+       case FTYPE_TPMFRONT:
+#endif
+#ifdef CONFIG_TPM_TIS
+       case FTYPE_TPM_TIS:
+#endif
 	  switch (whence) {
 	     case SEEK_SET:
 		files[fd].file.offset = offset;
@@ -420,6 +448,18 @@ int close(int fd)
 	    files[fd].type = FTYPE_NONE;
 	    return 0;
 #endif
+#ifdef CONFIG_TPMFRONT
+	case FTYPE_TPMFRONT:
+            shutdown_tpmfront(files[fd].tpmfront.dev);
+	    files[fd].type = FTYPE_NONE;
+	    return 0;
+#endif
+#ifdef CONFIG_TPM_TIS
+	case FTYPE_TPM_TIS:
+            shutdown_tpm_tis(files[fd].tpm_tis.dev);
+	    files[fd].type = FTYPE_NONE;
+	    return 0;
+#endif
 #ifdef CONFIG_KBDFRONT
 	case FTYPE_KBD:
             shutdown_kbdfront(files[fd].kbd.dev);
@@ -489,6 +529,14 @@ int fstat(int fd, struct stat *buf)
 	case FTYPE_BLK:
 	   return blkfront_posix_fstat(fd, buf);
 #endif
+#ifdef CONFIG_TPMFRONT
+	case FTYPE_TPMFRONT:
+	   return tpmfront_posix_fstat(fd, buf);
+#endif
+#ifdef CONFIG_TPM_TIS
+	case FTYPE_TPM_TIS:
+	   return tpm_tis_posix_fstat(fd, buf);
+#endif
 	default:
 	    break;
     }
diff -r 3015f8c6174b -r 34d52300f5d2 extras/mini-os/tpm_tis.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/tpm_tis.c	Tue Nov 13 10:46:58 2012 +0000
@@ -0,0 +1,1354 @@
+/*
+ * Copyright (c) 2010-2012 United States Government, as represented by
+ * the Secretary of Defense.  All rights reserved.
+ *
+ * This code has been derived from drivers/char/tpm.c
+ * from the linux kernel
+ *
+ * Copyright (C) 2004 IBM Corporation
+ *
+ * This code has also been derived from drivers/char/tpm/tpm_tis.c
+ * from the linux kernel
+ *
+ * Copyright (C) 2005, 2006 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, version 2
+ * of the License
+ */
+#include <mini-os/ioremap.h>
+#include <mini-os/iorw.h>
+#include <mini-os/tpm_tis.h>
+#include <mini-os/os.h>
+#include <mini-os/sched.h>
+#include <mini-os/byteorder.h>
+#include <mini-os/events.h>
+#include <mini-os/wait.h>
+#include <mini-os/xmalloc.h>
+#include <errno.h>
+#include <stdbool.h>
+
+#ifndef min
+	#define min( a, b ) ( ((a) < (b)) ? (a) : (b) )
+#endif
+
+#define TPM_HEADER_SIZE 10
+
+#define TPM_BUFSIZE 2048
+
+struct tpm_input_header {
+        uint16_t  tag;
+        uint32_t  length;
+        uint32_t  ordinal;
+}__attribute__((packed));
+
+struct tpm_output_header {
+        uint16_t  tag;
+        uint32_t  length;
+        uint32_t  return_code;
+}__attribute__((packed));
+
+struct  stclear_flags_t {
+        uint16_t  tag;
+        uint8_t      deactivated;
+        uint8_t      disableForceClear;
+        uint8_t      physicalPresence;
+        uint8_t      physicalPresenceLock;
+        uint8_t      bGlobalLock;
+}__attribute__((packed));
+
+struct  tpm_version_t {
+        uint8_t      Major;
+        uint8_t      Minor;
+        uint8_t      revMajor;
+        uint8_t      revMinor;
+}__attribute__((packed));
+
+struct  tpm_version_1_2_t {
+        uint16_t  tag;
+        uint8_t      Major;
+        uint8_t      Minor;
+        uint8_t      revMajor;
+        uint8_t      revMinor;
+}__attribute__((packed));
+
+struct  timeout_t {
+        uint32_t  a;
+        uint32_t  b;
+        uint32_t  c;
+        uint32_t  d;
+}__attribute__((packed));
+
+struct duration_t {
+        uint32_t  tpm_short;
+        uint32_t  tpm_medium;
+        uint32_t  tpm_long;
+}__attribute__((packed));
+
+struct permanent_flags_t {
+        uint16_t  tag;
+        uint8_t      disable;
+        uint8_t      ownership;
+        uint8_t      deactivated;
+        uint8_t      readPubek;
+        uint8_t      disableOwnerClear;
+        uint8_t      allowMaintenance;
+        uint8_t      physicalPresenceLifetimeLock;
+        uint8_t      physicalPresenceHWEnable;
+        uint8_t      physicalPresenceCMDEnable;
+        uint8_t      CEKPUsed;
+        uint8_t      TPMpost;
+        uint8_t      TPMpostLock;
+        uint8_t      FIPS;
+        uint8_t      operator;
+        uint8_t      enableRevokeEK;
+        uint8_t      nvLocked;
+        uint8_t      readSRKPub;
+        uint8_t      tpmEstablished;
+        uint8_t      maintenanceDone;
+        uint8_t      disableFullDALogicInfo;
+}__attribute__((packed));
+
+typedef union {
+        struct  permanent_flags_t perm_flags;
+        struct  stclear_flags_t stclear_flags;
+        bool    owned;
+        uint32_t  num_pcrs;
+        struct  tpm_version_t   tpm_version;
+        struct  tpm_version_1_2_t tpm_version_1_2;
+        uint32_t  manufacturer_id;
+        struct timeout_t  timeout;
+        struct duration_t duration;
+} cap_t;
+
+struct  tpm_getcap_params_in {
+        uint32_t  cap;
+        uint32_t  subcap_size;
+        uint32_t  subcap;
+}__attribute__((packed));
+
+struct  tpm_getcap_params_out {
+        uint32_t  cap_size;
+        cap_t   cap;
+}__attribute__((packed));
+
+struct  tpm_readpubek_params_out {
+        uint8_t      algorithm[4];
+        uint8_t      encscheme[2];
+        uint8_t      sigscheme[2];
+        uint32_t  paramsize;
+        uint8_t      parameters[12]; /*assuming RSA*/
+        uint32_t  keysize;
+        uint8_t      modulus[256];
+        uint8_t      checksum[20];
+}__attribute__((packed));
+
+typedef union {
+        struct  tpm_input_header in;
+        struct  tpm_output_header out;
+} tpm_cmd_header;
+
+#define TPM_DIGEST_SIZE 20
+struct tpm_pcrread_out {
+        uint8_t      pcr_result[TPM_DIGEST_SIZE];
+}__attribute__((packed));
+
+struct tpm_pcrread_in {
+        uint32_t  pcr_idx;
+}__attribute__((packed));
+
+struct tpm_pcrextend_in {
+        uint32_t  pcr_idx;
+        uint8_t      hash[TPM_DIGEST_SIZE];
+}__attribute__((packed));
+
+typedef union {
+        struct  tpm_getcap_params_out getcap_out;
+        struct  tpm_readpubek_params_out readpubek_out;
+        uint8_t      readpubek_out_buffer[sizeof(struct tpm_readpubek_params_out)];
+        struct  tpm_getcap_params_in getcap_in;
+        struct  tpm_pcrread_in  pcrread_in;
+        struct  tpm_pcrread_out pcrread_out;
+        struct  tpm_pcrextend_in pcrextend_in;
+} tpm_cmd_params;
+
+struct tpm_cmd_t {
+        tpm_cmd_header  header;
+        tpm_cmd_params  params;
+}__attribute__((packed));
+
+
+enum tpm_duration {
+   TPM_SHORT = 0,
+   TPM_MEDIUM = 1,
+   TPM_LONG = 2,
+   TPM_UNDEFINED,
+};
+
+#define TPM_MAX_ORDINAL 243
+#define TPM_MAX_PROTECTED_ORDINAL 12
+#define TPM_PROTECTED_ORDINAL_MASK 0xFF
+
+extern const uint8_t tpm_protected_ordinal_duration[TPM_MAX_PROTECTED_ORDINAL];
+extern const uint8_t tpm_ordinal_duration[TPM_MAX_ORDINAL];
+
+#define TPM_DIGEST_SIZE 20
+#define TPM_ERROR_SIZE 10
+#define TPM_RET_CODE_IDX 6
+
+/* tpm_capabilities */
+#define TPM_CAP_FLAG cpu_to_be32(4)
+#define TPM_CAP_PROP cpu_to_be32(5)
+#define CAP_VERSION_1_1 cpu_to_be32(0x06)
+#define CAP_VERSION_1_2 cpu_to_be32(0x1A)
+
+/* tpm_sub_capabilities */
+#define TPM_CAP_PROP_PCR cpu_to_be32(0x101)
+#define TPM_CAP_PROP_MANUFACTURER cpu_to_be32(0x103)
+#define TPM_CAP_FLAG_PERM cpu_to_be32(0x108)
+#define TPM_CAP_FLAG_VOL cpu_to_be32(0x109)
+#define TPM_CAP_PROP_OWNER cpu_to_be32(0x111)
+#define TPM_CAP_PROP_TIS_TIMEOUT cpu_to_be32(0x115)
+#define TPM_CAP_PROP_TIS_DURATION cpu_to_be32(0x120)
+
+
+#define TPM_INTERNAL_RESULT_SIZE 200
+#define TPM_TAG_RQU_COMMAND cpu_to_be16(193)
+#define TPM_ORD_GET_CAP cpu_to_be32(101)
+
+extern const struct tpm_input_header tpm_getcap_header;
+
+
+
+const uint8_t tpm_protected_ordinal_duration[TPM_MAX_PROTECTED_ORDINAL] = {
+   TPM_UNDEFINED,          /* 0 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,          /* 5 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,              /* 10 */
+   TPM_SHORT,
+};
+
+const uint8_t tpm_ordinal_duration[TPM_MAX_ORDINAL] = {
+   TPM_UNDEFINED,          /* 0 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,          /* 5 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,              /* 10 */
+   TPM_SHORT,
+   TPM_MEDIUM,
+   TPM_LONG,
+   TPM_LONG,
+   TPM_MEDIUM,             /* 15 */
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_MEDIUM,
+   TPM_LONG,
+   TPM_SHORT,              /* 20 */
+   TPM_SHORT,
+   TPM_MEDIUM,
+   TPM_MEDIUM,
+   TPM_MEDIUM,
+   TPM_SHORT,              /* 25 */
+   TPM_SHORT,
+   TPM_MEDIUM,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_MEDIUM,             /* 30 */
+   TPM_LONG,
+   TPM_MEDIUM,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,              /* 35 */
+   TPM_MEDIUM,
+   TPM_MEDIUM,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_MEDIUM,             /* 40 */
+   TPM_LONG,
+   TPM_MEDIUM,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,              /* 45 */
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_LONG,
+   TPM_MEDIUM,             /* 50 */
+   TPM_MEDIUM,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,          /* 55 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_MEDIUM,             /* 60 */
+   TPM_MEDIUM,
+   TPM_MEDIUM,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_MEDIUM,             /* 65 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,              /* 70 */
+   TPM_SHORT,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,          /* 75 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_LONG,               /* 80 */
+   TPM_UNDEFINED,
+   TPM_MEDIUM,
+   TPM_LONG,
+   TPM_SHORT,
+   TPM_UNDEFINED,          /* 85 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,              /* 90 */
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_UNDEFINED,          /* 95 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_MEDIUM,             /* 100 */
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,          /* 105 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,              /* 110 */
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,              /* 115 */
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_LONG,               /* 120 */
+   TPM_LONG,
+   TPM_MEDIUM,
+   TPM_UNDEFINED,
+   TPM_SHORT,
+   TPM_SHORT,              /* 125 */
+   TPM_SHORT,
+   TPM_LONG,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,              /* 130 */
+   TPM_MEDIUM,
+   TPM_UNDEFINED,
+   TPM_SHORT,
+   TPM_MEDIUM,
+   TPM_UNDEFINED,          /* 135 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,              /* 140 */
+   TPM_SHORT,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,          /* 145 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,              /* 150 */
+   TPM_MEDIUM,
+   TPM_MEDIUM,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_UNDEFINED,          /* 155 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,              /* 160 */
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,          /* 165 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_LONG,               /* 170 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,          /* 175 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_MEDIUM,             /* 180 */
+   TPM_SHORT,
+   TPM_MEDIUM,
+   TPM_MEDIUM,
+   TPM_MEDIUM,
+   TPM_MEDIUM,             /* 185 */
+   TPM_SHORT,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,          /* 190 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,          /* 195 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,              /* 200 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,
+   TPM_SHORT,              /* 205 */
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_MEDIUM,             /* 210 */
+   TPM_UNDEFINED,
+   TPM_MEDIUM,
+   TPM_MEDIUM,
+   TPM_MEDIUM,
+   TPM_UNDEFINED,          /* 215 */
+   TPM_MEDIUM,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,
+   TPM_SHORT,              /* 220 */
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_UNDEFINED,          /* 225 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,              /* 230 */
+   TPM_LONG,
+   TPM_MEDIUM,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,          /* 235 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,              /* 240 */
+   TPM_UNDEFINED,
+   TPM_MEDIUM,
+};
+
+const struct tpm_input_header tpm_getcap_header = {
+        .tag = TPM_TAG_RQU_COMMAND,
+        .length = cpu_to_be32(22),
+        .ordinal = TPM_ORD_GET_CAP
+};
+
+
+enum tis_access {
+   TPM_ACCESS_VALID = 0x80,
+   TPM_ACCESS_ACTIVE_LOCALITY = 0x20,	/* (R) */
+   TPM_ACCESS_RELINQUISH_LOCALITY = 0x20,/* (W) */
+   TPM_ACCESS_REQUEST_PENDING = 0x04,	/* (W) */
+   TPM_ACCESS_REQUEST_USE = 0x02,	/* (W) */
+};
+
+enum tis_status {
+   TPM_STS_VALID = 0x80,		/* (R) */
+   TPM_STS_COMMAND_READY = 0x40,	/* (R) */
+   TPM_STS_DATA_AVAIL = 0x10,		/* (R) */
+   TPM_STS_DATA_EXPECT = 0x08,		/* (R) */
+   TPM_STS_GO = 0x20,			/* (W) */
+};
+
+enum tis_int_flags {
+   TPM_GLOBAL_INT_ENABLE = 0x80000000,
+   TPM_INTF_BURST_COUNT_STATIC = 0x100,
+   TPM_INTF_CMD_READY_INT = 0x080,
+   TPM_INTF_INT_EDGE_FALLING = 0x040,
+   TPM_INTF_INT_EDGE_RISING = 0x020,
+   TPM_INTF_INT_LEVEL_LOW = 0x010,
+   TPM_INTF_INT_LEVEL_HIGH = 0x008,
+   TPM_INTF_LOCALITY_CHANGE_INT = 0x004,
+   TPM_INTF_STS_VALID_INT = 0x002,
+   TPM_INTF_DATA_AVAIL_INT = 0x001,
+};
+
+enum tis_defaults {
+   TIS_MEM_BASE = 0xFED40000,
+   TIS_MEM_LEN  = 0x5000,
+   TIS_SHORT_TIMEOUT = 750, /*ms*/
+   TIS_LONG_TIMEOUT = 2000, /*2 sec */
+};
+
+#define TPM_TIMEOUT 5
+
+#define TPM_ACCESS(t, l)                   (((uint8_t*)t->pages[l]) + 0x0000)
+#define TPM_INT_ENABLE(t, l)               ((uint32_t*)(((uint8_t*)t->pages[l]) + 0x0008))
+#define TPM_INT_VECTOR(t, l)               (((uint8_t*)t->pages[l]) + 0x000C)
+#define TPM_INT_STATUS(t, l)               (((uint8_t*)t->pages[l]) + 0x0010)
+#define TPM_INTF_CAPS(t, l)                ((uint32_t*)(((uint8_t*)t->pages[l]) + 0x0014))
+#define TPM_STS(t, l)                      ((uint8_t*)(((uint8_t*)t->pages[l]) + 0x0018))
+#define TPM_DATA_FIFO(t, l)                (((uint8_t*)t->pages[l]) + 0x0024)
+
+#define TPM_DID_VID(t, l)                  ((uint32_t*)(((uint8_t*)t->pages[l]) + 0x0F00))
+#define TPM_RID(t, l)                      (((uint8_t*)t->pages[l]) + 0x0F04)
+
+struct tpm_chip {
+   int enabled_localities;
+   int locality;
+   unsigned long baseaddr;
+   uint8_t* pages[5];
+   int did, vid, rid;
+
+   uint8_t data_buffer[TPM_BUFSIZE];
+   int data_len;
+
+   s_time_t timeout_a, timeout_b, timeout_c, timeout_d;
+   s_time_t duration[3];
+
+#ifdef HAVE_LIBC
+   int fd;
+#endif
+
+   unsigned int irq;
+   struct wait_queue_head read_queue;
+   struct wait_queue_head int_queue;
+};
+
+
+static void __init_tpm_chip(struct tpm_chip* tpm) {
+   tpm->enabled_localities = TPM_TIS_EN_LOCLALL;
+   tpm->locality = -1;
+   tpm->baseaddr = 0;
+   tpm->pages[0] = tpm->pages[1] = tpm->pages[2] = tpm->pages[3] = tpm->pages[4] = NULL;
+   tpm->vid = 0;
+   tpm->did = 0;
+   tpm->irq = 0;
+   init_waitqueue_head(&tpm->read_queue);
+   init_waitqueue_head(&tpm->int_queue);
+
+   tpm->data_len = -1;
+
+#ifdef HAVE_LIBC
+   tpm->fd = -1;
+#endif
+}
+
+/*
+ * Returns max number of nsecs to wait
+ */
+s_time_t tpm_calc_ordinal_duration(struct tpm_chip *chip,
+      uint32_t ordinal)
+{
+   int duration_idx = TPM_UNDEFINED;
+   s_time_t duration = 0;
+
+   if (ordinal < TPM_MAX_ORDINAL)
+      duration_idx = tpm_ordinal_duration[ordinal];
+   else if ((ordinal & TPM_PROTECTED_ORDINAL_MASK) <
+	 TPM_MAX_PROTECTED_ORDINAL)
+      duration_idx =
+	 tpm_protected_ordinal_duration[ordinal &
+	 TPM_PROTECTED_ORDINAL_MASK];
+
+   if (duration_idx != TPM_UNDEFINED) {
+      duration = chip->duration[duration_idx];
+   }
+
+   if (duration <= 0) {
+      return SECONDS(120);
+   }
+   else
+   {
+      return duration;
+   }
+}
+
+
+static int locality_enabled(struct tpm_chip* tpm, int l) {
+   return tpm->enabled_localities & (1 << l);
+}
+
+static int check_locality(struct tpm_chip* tpm, int l) {
+   if(locality_enabled(tpm, l) && (ioread8(TPM_ACCESS(tpm, l)) &
+	    (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) ==
+	 (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) {
+      return l;
+   }
+   return -1;
+}
+
+void release_locality(struct tpm_chip* tpm, int l, int force)
+{
+   if (locality_enabled(tpm, l) && (force || (ioread8(TPM_ACCESS(tpm, l)) &
+	       (TPM_ACCESS_REQUEST_PENDING | TPM_ACCESS_VALID)) ==
+	    (TPM_ACCESS_REQUEST_PENDING | TPM_ACCESS_VALID))) {
+      iowrite8(TPM_ACCESS(tpm, l), TPM_ACCESS_RELINQUISH_LOCALITY);
+   }
+}
+
+int tpm_tis_request_locality(struct tpm_chip* tpm, int l) {
+
+   s_time_t stop;
+   /*Make sure locality is valid */
+   if(!locality_enabled(tpm, l)) {
+      printk("tpm_tis_change_locality() Tried to change to locality %d, but it is disabled or invalid!\n", l);
+      return -1;
+   }
+   /* Check if we already have the current locality */
+   if(check_locality(tpm, l) >= 0) {
+      return tpm->locality = l;
+   }
+   /* Set the new locality*/
+   iowrite8(TPM_ACCESS(tpm, l), TPM_ACCESS_REQUEST_USE);
+
+   if(tpm->irq) {
+      /* Wait for interrupt */
+      wait_event_deadline(tpm->int_queue, (check_locality(tpm, l) >= 0), NOW() + tpm->timeout_a);
+
+      /* FIXME: Handle timeout event, should return error in that case */
+      return l;
+   } else {
+      /* Wait for burstcount */
+      stop = NOW() + tpm->timeout_a;
+      do {
+	 if(check_locality(tpm, l) >= 0) {
+	    return tpm->locality = l;
+	 }
+	 msleep(TPM_TIMEOUT);
+      } while(NOW() < stop);
+   }
+
+   printk("REQ LOCALITY FAILURE\n");
+   return -1;
+}
+
+static uint8_t tpm_tis_status(struct tpm_chip* tpm) {
+   return ioread8(TPM_STS(tpm, tpm->locality));
+}
+
+/* This causes the current command to be aborted */
+static void tpm_tis_ready(struct tpm_chip* tpm) {
+   iowrite8(TPM_STS(tpm, tpm->locality), TPM_STS_COMMAND_READY);
+}
+#define tpm_tis_cancel_cmd(v) tpm_tis_ready(v)
+
+static int get_burstcount(struct tpm_chip* tpm) {
+   s_time_t stop;
+   int burstcnt;
+
+   stop = NOW() + tpm->timeout_d;
+   do {
+      burstcnt = ioread8((TPM_STS(tpm, tpm->locality) + 1));
+      burstcnt += ioread8(TPM_STS(tpm, tpm->locality) + 2) << 8;
+
+      if (burstcnt) {
+	 return burstcnt;
+      }
+      msleep(TPM_TIMEOUT);
+   } while(NOW() < stop);
+   return -EBUSY;
+}
+
+static int wait_for_stat(struct tpm_chip* tpm, uint8_t mask,
+      unsigned long timeout, struct wait_queue_head* queue) {
+   s_time_t stop;
+   uint8_t status;
+
+   status = tpm_tis_status(tpm);
+   if((status & mask) == mask) {
+      return 0;
+   }
+
+   if(tpm->irq) {
+      wait_event_deadline(*queue, ((tpm_tis_status(tpm) & mask) == mask), timeout);
+      /* FIXME: Check for timeout and return -ETIME */
+      return 0;
+   } else {
+      stop = NOW() + timeout;
+      do {
+	 msleep(TPM_TIMEOUT);
+	 status = tpm_tis_status(tpm);
+	 if((status & mask) == mask)
+	    return 0;
+      } while( NOW() < stop);
+   }
+   return -ETIME;
+}
+
+static int recv_data(struct tpm_chip* tpm, uint8_t* buf, size_t count) {
+   int size = 0;
+   int burstcnt;
+   while( size < count &&
+	 wait_for_stat(tpm,
+	    TPM_STS_DATA_AVAIL | TPM_STS_VALID,
+	    tpm->timeout_c,
+	    &tpm->read_queue)
+	 == 0) {
+      burstcnt = get_burstcount(tpm);
+      for(; burstcnt > 0 && size < count; --burstcnt)
+      {
+	 buf[size++] = ioread8(TPM_DATA_FIFO(tpm, tpm->locality));
+      }
+   }
+   return size;
+}
+
+int tpm_tis_recv(struct tpm_chip* tpm, uint8_t* buf, size_t count) {
+   int size = 0;
+   int expected, status;
+
+   if (count < TPM_HEADER_SIZE) {
+      size = -EIO;
+      goto out;
+   }
+
+   /* read first 10 bytes, including tag, paramsize, and result */
+   if((size =
+	    recv_data(tpm, buf, TPM_HEADER_SIZE)) < TPM_HEADER_SIZE) {
+      printk("Error reading tpm cmd header\n");
+      goto out;
+   }
+
+   expected = be32_to_cpu(*((uint32_t*)(buf + 2)));
+   if(expected > count) {
+      size = -EIO;
+      goto out;
+   }
+
+   if((size += recv_data(tpm, & buf[TPM_HEADER_SIZE],
+	       expected - TPM_HEADER_SIZE)) < expected) {
+      printk("Unable to read rest of tpm command size=%d expected=%d\n", size, expected);
+      size = -ETIME;
+      goto out;
+   }
+
+   wait_for_stat(tpm, TPM_STS_VALID, tpm->timeout_c, &tpm->int_queue);
+   status = tpm_tis_status(tpm);
+   if(status & TPM_STS_DATA_AVAIL) {
+      printk("Error: left over data\n");
+      size = -EIO;
+      goto out;
+   }
+
+out:
+   tpm_tis_ready(tpm);
+   release_locality(tpm, tpm->locality, 0);
+   return size;
+}
+int tpm_tis_send(struct tpm_chip* tpm, uint8_t* buf, size_t len) {
+   int rc;
+   int status, burstcnt = 0;
+   int count = 0;
+   uint32_t ordinal;
+
+   if(tpm_tis_request_locality(tpm, tpm->locality) < 0) {
+      return -EBUSY;
+   }
+
+   status = tpm_tis_status(tpm);
+   if((status & TPM_STS_COMMAND_READY) == 0) {
+      tpm_tis_ready(tpm);
+      if(wait_for_stat(tpm, TPM_STS_COMMAND_READY, tpm->timeout_b, &tpm->int_queue) < 0) {
+	 rc = -ETIME;
+	 goto out_err;
+      }
+   }
+
+   while(count < len - 1) {
+      burstcnt = get_burstcount(tpm);
+      for(;burstcnt > 0 && count < len -1; --burstcnt) {
+	 iowrite8(TPM_DATA_FIFO(tpm, tpm->locality), buf[count++]);
+      }
+
+      wait_for_stat(tpm, TPM_STS_VALID, tpm->timeout_c, &tpm->int_queue);
+      status = tpm_tis_status(tpm);
+      if((status & TPM_STS_DATA_EXPECT) == 0) {
+	 rc = -EIO;
+	 goto out_err;
+      }
+   }
+
+   /*Write last byte*/
+   iowrite8(TPM_DATA_FIFO(tpm, tpm->locality), buf[count]);
+   wait_for_stat(tpm, TPM_STS_VALID, tpm->timeout_c, &tpm->read_queue);
+   status = tpm_tis_status(tpm);
+   if((status & TPM_STS_DATA_EXPECT) != 0) {
+      rc = -EIO;
+      goto out_err;
+   }
+
+   /*go and do it*/
+   iowrite8(TPM_STS(tpm, tpm->locality), TPM_STS_GO);
+
+   if(tpm->irq) {
+      /*Wait for interrupt */
+      ordinal = be32_to_cpu(*(buf + 6));
+      if(wait_for_stat(tpm,
+	       TPM_STS_DATA_AVAIL | TPM_STS_VALID,
+	       tpm_calc_ordinal_duration(tpm, ordinal),
+	       &tpm->read_queue) < 0) {
+	 rc = -ETIME;
+	 goto out_err;
+      }
+   }
+#ifdef HAVE_LIBC
+   if(tpm->fd >= 0) {
+      files[tpm->fd].read = 0;
+      files[tpm->fd].tpm_tis.respgot = 0;
+      files[tpm->fd].tpm_tis.offset = 0;
+   }
+#endif
+   return len;
+
+out_err:
+   tpm_tis_ready(tpm);
+   release_locality(tpm, tpm->locality, 0);
+   return rc;
+}
+
+static void tpm_tis_irq_handler(evtchn_port_t port, struct pt_regs *regs, void* data)
+{
+   struct tpm_chip* tpm = data;
+   uint32_t interrupt;
+   int i;
+
+   interrupt = ioread32(TPM_INT_STATUS(tpm, tpm->locality));
+   if(interrupt == 0) {
+      return;
+   }
+
+   if(interrupt & TPM_INTF_DATA_AVAIL_INT) {
+      wake_up(&tpm->read_queue);
+   }
+   if(interrupt & TPM_INTF_LOCALITY_CHANGE_INT) {
+      for(i = 0; i < 5; ++i) {
+	 if(check_locality(tpm, i) >= 0) {
+	    break;
+	 }
+      }
+   }
+   if(interrupt & (TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_STS_VALID_INT |
+	    TPM_INTF_CMD_READY_INT)) {
+      wake_up(&tpm->int_queue);
+   }
+
+   /* Clear interrupts handled with TPM_EOI */
+   iowrite32(TPM_INT_STATUS(tpm, tpm->locality), interrupt);
+   ioread32(TPM_INT_STATUS(tpm, tpm->locality));
+   return;
+}
+
+/*
+ * Internal kernel interface to transmit TPM commands
+ */
+static ssize_t tpm_transmit(struct tpm_chip *chip, const uint8_t *buf,
+      size_t bufsiz)
+{
+   ssize_t rc;
+   uint32_t count, ordinal;
+   s_time_t stop;
+
+   count = be32_to_cpu(*((uint32_t *) (buf + 2)));
+   ordinal = be32_to_cpu(*((uint32_t *) (buf + 6)));
+   if (count == 0)
+      return -ENODATA;
+   if (count > bufsiz) {
+      printk("Error: invalid count value %x %zx \n", count, bufsiz);
+      return -E2BIG;
+   }
+
+   //down(&chip->tpm_mutex);
+
+   if ((rc = tpm_tis_send(chip, (uint8_t *) buf, count)) < 0) {
+      printk("tpm_transmit: tpm_send: error %ld\n", rc);
+      goto out;
+   }
+
+   if (chip->irq)
+      goto out_recv;
+
+   stop = NOW() + tpm_calc_ordinal_duration(chip, ordinal);
+   do {
+      uint8_t status = tpm_tis_status(chip);
+      if ((status & (TPM_STS_DATA_AVAIL | TPM_STS_VALID)) ==
+	    (TPM_STS_DATA_AVAIL | TPM_STS_VALID))
+	 goto out_recv;
+
+      if ((status == TPM_STS_COMMAND_READY)) {
+	 printk("TPM Error: Operation Canceled\n");
+	 rc = -ECANCELED;
+	 goto out;
+      }
+
+      msleep(TPM_TIMEOUT);    /* CHECK */
+      rmb();
+   } while (NOW() < stop);
+
+   /* Cancel the command */
+   tpm_tis_cancel_cmd(chip);
+   printk("TPM Operation Timed out\n");
+   rc = -ETIME;
+   goto out;
+
+out_recv:
+   if((rc = tpm_tis_recv(chip, (uint8_t *) buf, bufsiz)) < 0) {
+      printk("tpm_transmit: tpm_recv: error %d\n", rc);
+   }
+out:
+   //up(&chip->tpm_mutex);
+   return rc;
+}
+
+static ssize_t transmit_cmd(struct tpm_chip *chip, struct tpm_cmd_t *cmd,
+                            int len, const char *desc)
+{
+        int err;
+
+        len = tpm_transmit(chip,(uint8_t *) cmd, len);
+        if (len <  0)
+                return len;
+        if (len == TPM_ERROR_SIZE) {
+                err = be32_to_cpu(cmd->header.out.return_code);
+                printk("A TPM error (%d) occurred %s\n", err, desc);
+                return err;
+        }
+        return 0;
+}
+
+int tpm_get_timeouts(struct tpm_chip *chip)
+{
+   struct tpm_cmd_t tpm_cmd;
+   struct timeout_t *timeout_cap;
+   struct duration_t *duration_cap;
+   ssize_t rc;
+   uint32_t timeout;
+   unsigned int scale = 1;
+
+   tpm_cmd.header.in = tpm_getcap_header;
+   tpm_cmd.params.getcap_in.cap = TPM_CAP_PROP;
+   tpm_cmd.params.getcap_in.subcap_size = cpu_to_be32(4);
+   tpm_cmd.params.getcap_in.subcap = TPM_CAP_PROP_TIS_TIMEOUT;
+
+   if((rc = transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE,
+	 "attempting to determine the timeouts")) != 0) {
+      printk("transmit failed %d\n", rc);
+      goto duration;
+   }
+
+   if(be32_to_cpu(tpm_cmd.header.out.return_code) != 0 ||
+         be32_to_cpu(tpm_cmd.header.out.length) !=
+         sizeof(tpm_cmd.header.out) + sizeof(uint32_t) + 4 * sizeof(uint32_t)) {
+      return -EINVAL;
+   }
+
+   timeout_cap = &tpm_cmd.params.getcap_out.cap.timeout;
+   /* Don't overwrite default if value is 0 */
+   timeout = be32_to_cpu(timeout_cap->a);
+   if(timeout && timeout < 1000) {
+      /* timeouts in msc rather usec */
+      scale = 1000;
+   }
+   if (timeout)
+      chip->timeout_a = MICROSECS(timeout * scale); /*Convert to msec */
+   timeout = be32_to_cpu(timeout_cap->b);
+   if (timeout)
+      chip->timeout_b = MICROSECS(timeout * scale); /*Convert to msec */
+   timeout = be32_to_cpu(timeout_cap->c);
+   if (timeout)
+      chip->timeout_c = MICROSECS(timeout * scale); /*Convert to msec */
+   timeout = be32_to_cpu(timeout_cap->d);
+   if (timeout)
+      chip->timeout_d = MICROSECS(timeout * scale); /*Convert to msec */
+
+duration:
+   tpm_cmd.header.in = tpm_getcap_header;
+   tpm_cmd.params.getcap_in.cap = TPM_CAP_PROP;
+   tpm_cmd.params.getcap_in.subcap_size = cpu_to_be32(4);
+   tpm_cmd.params.getcap_in.subcap = TPM_CAP_PROP_TIS_DURATION;
+
+   if((rc = transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE,
+	 "attempting to determine the durations")) < 0) {
+      return rc;
+   }
+
+   if(be32_to_cpu(tpm_cmd.header.out.return_code) != 0 ||
+         be32_to_cpu(tpm_cmd.header.out.length) !=
+         sizeof(tpm_cmd.header.out) + sizeof(uint32_t) + 3 * sizeof(uint32_t)) {
+      return -EINVAL;
+   }
+
+   duration_cap = &tpm_cmd.params.getcap_out.cap.duration;
+   chip->duration[TPM_SHORT] = MICROSECS(be32_to_cpu(duration_cap->tpm_short));
+   chip->duration[TPM_MEDIUM] = MICROSECS(be32_to_cpu(duration_cap->tpm_medium));
+   chip->duration[TPM_LONG] = MICROSECS(be32_to_cpu(duration_cap->tpm_long));
+
+   /* The Broadcom BCM0102 chipset in a Dell Latitude D820 gets the above
+    * value wrong and apparently reports msecs rather than usecs. So we
+    * fix up the resulting too-small TPM_SHORT value to make things work.
+    */
+   if (chip->duration[TPM_SHORT] < MILLISECS(10)) {
+      chip->duration[TPM_SHORT] = SECONDS(1);
+      chip->duration[TPM_MEDIUM] *= 1000;
+      chip->duration[TPM_LONG] *= 1000;
+      printk("Adjusting TPM timeout parameters\n");
+   }
+
+   return 0;
+}
+
+
+
+void tpm_continue_selftest(struct tpm_chip* chip) {
+   uint8_t data[] = {
+      0, 193,                 /* TPM_TAG_RQU_COMMAND */
+      0, 0, 0, 10,            /* length */
+      0, 0, 0, 83,            /* TPM_ORD_GetCapability */
+   };
+
+   tpm_transmit(chip, data, sizeof(data));
+}
+
+ssize_t tpm_getcap(struct tpm_chip *chip, uint32_t subcap_id, cap_t *cap,
+                   const char *desc)
+{
+        struct tpm_cmd_t tpm_cmd;
+        int rc;
+
+        tpm_cmd.header.in = tpm_getcap_header;
+        if (subcap_id == CAP_VERSION_1_1 || subcap_id == CAP_VERSION_1_2) {
+                tpm_cmd.params.getcap_in.cap = subcap_id;
+                /*subcap field not necessary */
+                tpm_cmd.params.getcap_in.subcap_size = cpu_to_be32(0);
+                tpm_cmd.header.in.length -= cpu_to_be32(sizeof(uint32_t));
+        } else {
+                if (subcap_id == TPM_CAP_FLAG_PERM ||
+                    subcap_id == TPM_CAP_FLAG_VOL)
+                        tpm_cmd.params.getcap_in.cap = TPM_CAP_FLAG;
+                else
+                        tpm_cmd.params.getcap_in.cap = TPM_CAP_PROP;
+                tpm_cmd.params.getcap_in.subcap_size = cpu_to_be32(4);
+                tpm_cmd.params.getcap_in.subcap = subcap_id;
+        }
+        rc = transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE, desc);
+        if (!rc)
+                *cap = tpm_cmd.params.getcap_out.cap;
+        return rc;
+}
+
+
+struct tpm_chip* init_tpm_tis(unsigned long baseaddr, int localities, unsigned int irq)
+{
+   int i;
+   unsigned long addr;
+   struct tpm_chip* tpm = NULL;
+   uint32_t didvid;
+   uint32_t intfcaps;
+   uint32_t intmask;
+
+   printk("============= Init TPM TIS Driver ==============\n");
+
+   /*Sanity check the localities input */
+   if(localities & ~TPM_TIS_EN_LOCLALL) {
+      printk("init_tpm_tis() Invalid locality specification! %X\n", localities);
+      goto abort_egress;
+   }
+
+   printk("IOMEM Machine Base Address: %lX\n", baseaddr);
+
+   /* Create the tpm data structure */
+   tpm = malloc(sizeof(struct tpm_chip));
+   __init_tpm_chip(tpm);
+
+   /* Set the enabled localities - if 0 we leave default as all enabled */
+   if(localities != 0) {
+      tpm->enabled_localities = localities;
+   }
+   printk("Enabled Localities: ");
+   for(i = 0; i < 5; ++i) {
+      if(locality_enabled(tpm, i)) {
+	 printk("%d ", i);
+      }
+   }
+   printk("\n");
+
+   /* Set the base machine address */
+   tpm->baseaddr = baseaddr;
+
+   /* Set default timeouts */
+   tpm->timeout_a = MILLISECS(TIS_SHORT_TIMEOUT);
+   tpm->timeout_b = MILLISECS(TIS_LONG_TIMEOUT);
+   tpm->timeout_c = MILLISECS(TIS_SHORT_TIMEOUT);
+   tpm->timeout_d = MILLISECS(TIS_SHORT_TIMEOUT);
+
+   /*Map the mmio pages */
+   addr = tpm->baseaddr;
+   for(i = 0; i < 5; ++i) {
+      if(locality_enabled(tpm, i)) {
+	 /* Map the page in now */
+	 if((tpm->pages[i] = ioremap_nocache(addr, PAGE_SIZE)) == NULL) {
+	    printk("Unable to map iomem page a address %p\n", addr);
+	    goto abort_egress;
+	 }
+
+	 /* Set default locality to the first enabled one */
+	 if (tpm->locality < 0) {
+	    if(tpm_tis_request_locality(tpm, i) < 0) {
+	       printk("Unable to request locality %d??\n", i);
+	       goto abort_egress;
+	    }
+	 }
+      }
+      addr += PAGE_SIZE;
+   }
+
+
+   /* Get the vendor and device ids */
+   didvid = ioread32(TPM_DID_VID(tpm, tpm->locality));
+   tpm->did = didvid >> 16;
+   tpm->vid = didvid & 0xFFFF;
+
+
+   /* Get the revision id */
+   tpm->rid = ioread8(TPM_RID(tpm, tpm->locality));
+
+   printk("1.2 TPM (device-id=0x%X vendor-id = %X rev-id = %X)\n", tpm->did, tpm->vid, tpm->rid);
+
+   intfcaps = ioread32(TPM_INTF_CAPS(tpm, tpm->locality));
+   printk("TPM interface capabilities (0x%x):\n", intfcaps);
+   if (intfcaps & TPM_INTF_BURST_COUNT_STATIC)
+      printk("\tBurst Count Static\n");
+   if (intfcaps & TPM_INTF_CMD_READY_INT)
+      printk("\tCommand Ready Int Support\n");
+   if (intfcaps & TPM_INTF_INT_EDGE_FALLING)
+      printk("\tInterrupt Edge Falling\n");
+   if (intfcaps & TPM_INTF_INT_EDGE_RISING)
+      printk("\tInterrupt Edge Rising\n");
+   if (intfcaps & TPM_INTF_INT_LEVEL_LOW)
+      printk("\tInterrupt Level Low\n");
+   if (intfcaps & TPM_INTF_INT_LEVEL_HIGH)
+      printk("\tInterrupt Level High\n");
+   if (intfcaps & TPM_INTF_LOCALITY_CHANGE_INT)
+      printk("\tLocality Change Int Support\n");
+   if (intfcaps & TPM_INTF_STS_VALID_INT)
+      printk("\tSts Valid Int Support\n");
+   if (intfcaps & TPM_INTF_DATA_AVAIL_INT)
+      printk("\tData Avail Int Support\n");
+
+   /*Interupt setup */
+   intmask = ioread32(TPM_INT_ENABLE(tpm, tpm->locality));
+
+   intmask |= TPM_INTF_CMD_READY_INT
+      | TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_DATA_AVAIL_INT
+      | TPM_INTF_STS_VALID_INT;
+
+   iowrite32(TPM_INT_ENABLE(tpm, tpm->locality), intmask);
+
+   /*If interupts are enabled, handle it */
+   if(irq) {
+      if(irq != TPM_PROBE_IRQ) {
+	 tpm->irq = irq;
+      } else {
+	 /*FIXME add irq probing feature later */
+	 printk("IRQ probing not implemented\n");
+      }
+   }
+
+   if(tpm->irq) {
+      iowrite8(TPM_INT_VECTOR(tpm, tpm->locality), tpm->irq);
+
+      if(bind_pirq(tpm->irq, 1, tpm_tis_irq_handler, tpm) != 0) {
+	 printk("Unabled to request irq: %u for use\n", tpm->irq);
+	 printk("Will use polling mode\n");
+	 tpm->irq = 0;
+      } else {
+	 /* Clear all existing */
+	 iowrite32(TPM_INT_STATUS(tpm, tpm->locality), ioread32(TPM_INT_STATUS(tpm, tpm->locality)));
+
+	 /* Turn on interrupts */
+	 iowrite32(TPM_INT_ENABLE(tpm, tpm->locality), intmask | TPM_GLOBAL_INT_ENABLE);
+      }
+   }
+
+   if(tpm_get_timeouts(tpm)) {
+      printk("Could not get TPM timeouts and durations\n");
+      goto abort_egress;
+   }
+   tpm_continue_selftest(tpm);
+
+
+   return tpm;
+abort_egress:
+   if(tpm != NULL) {
+      shutdown_tpm_tis(tpm);
+   }
+   return NULL;
+}
+
+void shutdown_tpm_tis(struct tpm_chip* tpm){
+   int i;
+
+   printk("Shutting down tpm_tis device\n");
+
+   iowrite32(TPM_INT_ENABLE(tpm, tpm->locality), ~TPM_GLOBAL_INT_ENABLE);
+
+   /*Unmap all of the mmio pages */
+   for(i = 0; i < 5; ++i) {
+      if(tpm->pages[i] != NULL) {
+	 iounmap(tpm->pages[i], PAGE_SIZE);
+	 tpm->pages[i] = NULL;
+      }
+   }
+   free(tpm);
+   return;
+}
+
+
+int tpm_tis_cmd(struct tpm_chip* tpm, uint8_t* req, size_t reqlen, uint8_t** resp, size_t* resplen)
+{
+   if(tpm->locality < 0) {
+      printk("tpm_tis_cmd() failed! locality not set!\n");
+      return -1;
+   }
+   if(reqlen > TPM_BUFSIZE) {
+      reqlen = TPM_BUFSIZE;
+   }
+   memcpy(tpm->data_buffer, req, reqlen);
+   *resplen = tpm_transmit(tpm, tpm->data_buffer, TPM_BUFSIZE);
+
+   *resp = malloc(*resplen);
+   memcpy(*resp, tpm->data_buffer, *resplen);
+   return 0;
+}
+
+#ifdef HAVE_LIBC
+int tpm_tis_open(struct tpm_chip* tpm)
+{
+   /* Silently prevent multiple opens */
+   if(tpm->fd != -1) {
+      return tpm->fd;
+   }
+
+   tpm->fd = alloc_fd(FTYPE_TPM_TIS);
+   printk("tpm_tis_open() -> %d\n", tpm->fd);
+   files[tpm->fd].tpm_tis.dev = tpm;
+   files[tpm->fd].tpm_tis.offset = 0;
+   files[tpm->fd].tpm_tis.respgot = 0;
+   return tpm->fd;
+}
+
+int tpm_tis_posix_write(int fd, const uint8_t* buf, size_t count)
+{
+   struct tpm_chip* tpm;
+   tpm = files[fd].tpm_tis.dev;
+
+   if(tpm->locality < 0) {
+      printk("tpm_tis_posix_write() failed! locality not set!\n");
+      errno = EINPROGRESS;
+      return -1;
+   }
+   if(count == 0) {
+      return 0;
+   }
+
+   /* Return an error if we are already processing a command */
+   if(count > TPM_BUFSIZE) {
+      count = TPM_BUFSIZE;
+   }
+   /* Send the command now */
+   memcpy(tpm->data_buffer, buf, count);
+   if((tpm->data_len = tpm_transmit(tpm, tpm->data_buffer, TPM_BUFSIZE)) < 0) {
+      errno = EIO;
+      return -1;
+   }
+   return count;
+}
+
+int tpm_tis_posix_read(int fd, uint8_t* buf, size_t count)
+{
+   int rc;
+   struct tpm_chip* tpm;
+   tpm = files[fd].tpm_tis.dev;
+
+   if(count == 0) {
+      return 0;
+   }
+
+   /* If there is no tpm resp to read, return EIO */
+   if(tpm->data_len < 0) {
+      errno = EIO;
+      return -1;
+   }
+
+
+   /* Handle EOF case */
+   if(files[fd].tpm_tis.offset >= tpm->data_len) {
+      rc = 0;
+   } else {
+      rc = min(tpm->data_len - files[fd].tpm_tis.offset, count);
+      memcpy(buf, tpm->data_buffer + files[fd].tpm_tis.offset, rc);
+   }
+   files[fd].tpm_tis.offset += rc;
+   /* Reset the data pending flag */
+   return rc;
+}
+int tpm_tis_posix_fstat(int fd, struct stat* buf)
+{
+   struct tpm_chip* tpm;
+   tpm = files[fd].tpm_tis.dev;
+
+   buf->st_mode = O_RDWR;
+   buf->st_uid = 0;
+   buf->st_gid = 0;
+   buf->st_size = be32_to_cpu(*((uint32_t*)(tpm->data_buffer + 2)));
+   buf->st_atime = buf->st_mtime = buf->st_ctime = time(NULL);
+   return 0;
+}
+
+
+#endif
diff -r 3015f8c6174b -r 34d52300f5d2 extras/mini-os/tpmback.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/tpmback.c	Tue Nov 13 10:46:58 2012 +0000
@@ -0,0 +1,1102 @@
+/*
+ * Copyright (c) 2010-2012 United States Government, as represented by
+ * the Secretary of Defense.  All rights reserved.
+ *
+ * This code has been derived from drivers/xen/tpmback/tpmback.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (c) 2005, IBM Corporation
+ *
+ * which was itself derived from drivers/xen/netback/netback.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (c) 2002-2004, K A Fraser
+ *
+ * This code has also been derived from drivers/xen/tpmback/xenbus.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (C) 2005 IBM Corporation
+ * Copyright (C) 2005 Rusty Russell <rusty@rustcorp.com.au>
+ *
+ * This code has also been derived from drivers/xen/tpmback/interface.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (c) 2005, IBM Corporation
+ *
+ * which was itself also derived from drvivers/xen/netback/interface.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (c) 2004, Keir Fraser
+ *
+ * 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, version 2
+ * of the License
+ */
+#include <mini-os/os.h>
+#include <mini-os/xenbus.h>
+#include <mini-os/events.h>
+#include <errno.h>
+#include <mini-os/gnttab.h>
+#include <xen/io/xenbus.h>
+#include <xen/io/tpmif.h>
+#include <xen/io/protocols.h>
+#include <mini-os/xmalloc.h>
+#include <time.h>
+#include <mini-os/tpmback.h>
+#include <mini-os/lib.h>
+#include <fcntl.h>
+#include <mini-os/mm.h>
+#include <mini-os/posix/sys/mman.h>
+#include <mini-os/semaphore.h>
+#include <mini-os/wait.h>
+
+
+#ifndef HAVE_LIBC
+#define strtoul simple_strtoul
+#endif
+
+//#define TPMBACK_PRINT_DEBUG
+#ifdef TPMBACK_PRINT_DEBUG
+#define TPMBACK_DEBUG(fmt,...) printk("Tpmback:Debug("__FILE__":%d) " fmt, __LINE__, ##__VA_ARGS__)
+#define TPMBACK_DEBUG_MORE(fmt,...) printk(fmt, ##__VA_ARGS__)
+#else
+#define TPMBACK_DEBUG(fmt,...)
+#endif
+#define TPMBACK_ERR(fmt,...) printk("Tpmback:Error " fmt, ##__VA_ARGS__)
+#define TPMBACK_LOG(fmt,...) printk("Tpmback:Info " fmt, ##__VA_ARGS__)
+
+#define min(a,b) (((a) < (b)) ? (a) : (b))
+
+/* Default size of the tpmif array at initialization */
+#define DEF_ARRAY_SIZE 1
+
+/* tpmif and tpmdev flags */
+#define TPMIF_CLOSED 1
+#define TPMIF_REQ_READY 2
+
+struct tpmif {
+   domid_t domid;
+   unsigned int handle;
+
+   char* fe_path;
+   char* fe_state_path;
+
+   /* Locally bound event channel*/
+   evtchn_port_t evtchn;
+
+   /* Shared page */
+   tpmif_tx_interface_t* tx;
+
+   /* pointer to TPMIF_RX_RING_SIZE pages */
+   void** pages;
+
+   enum xenbus_state state;
+   enum { DISCONNECTED, DISCONNECTING, CONNECTED } status;
+
+   unsigned char uuid[16];
+
+   /* state flags */
+   int flags;
+};
+typedef struct tpmif tpmif_t;
+
+struct tpmback_dev {
+
+   tpmif_t** tpmlist;
+   unsigned long num_tpms;
+   unsigned long num_alloc;
+
+   struct gntmap map;
+
+   /* True if at least one tpmif has a request to be handled */
+   int flags;
+
+   xenbus_event_queue events;
+
+   /* Callbacks */
+   void (*open_callback)(domid_t, unsigned int);
+   void (*close_callback)(domid_t, unsigned int);
+   void (*suspend_callback)(domid_t, unsigned int);
+   void (*resume_callback)(domid_t, unsigned int);
+};
+typedef struct tpmback_dev tpmback_dev_t;
+
+enum { EV_NONE, EV_NEWFE, EV_STCHNG } tpm_ev_enum;
+
+/* Global objects */
+static struct thread* eventthread = NULL;
+static tpmback_dev_t gtpmdev = {
+   .tpmlist = NULL,
+   .num_tpms = 0,
+   .num_alloc = 0,
+   .flags = TPMIF_CLOSED,
+   .events = NULL,
+   .open_callback = NULL,
+   .close_callback = NULL,
+   .suspend_callback = NULL,
+   .resume_callback = NULL,
+};
+struct wait_queue_head waitq;
+int globalinit = 0;
+
+/************************************
+ * TPMIF SORTED ARRAY FUNCTIONS
+ * tpmback_dev_t.tpmlist is a sorted array, sorted by domid and then handle number
+ * Duplicates are not allowed
+ * **********************************/
+
+inline void tpmif_req_ready(tpmif_t* tpmif) {
+   tpmif->flags |= TPMIF_REQ_READY;
+   gtpmdev.flags |= TPMIF_REQ_READY;
+}
+
+inline void tpmdev_check_req(void) {
+   int i;
+   int flags;
+   local_irq_save(flags);
+   for(i = 0; i < gtpmdev.num_tpms; ++i) {
+      if(gtpmdev.tpmlist[i]->flags & TPMIF_REQ_READY) {
+	 gtpmdev.flags |= TPMIF_REQ_READY;
+	 local_irq_restore(flags);
+	 return;
+      }
+   }
+   gtpmdev.flags &= ~TPMIF_REQ_READY;
+   local_irq_restore(flags);
+}
+
+inline void tpmif_req_finished(tpmif_t* tpmif) {
+   tpmif->flags &= ~TPMIF_REQ_READY;
+   tpmdev_check_req();
+}
+
+int __get_tpmif_index(int st, int n, domid_t domid, unsigned int handle)
+{
+   int i = st + n /2;
+   tpmif_t* tmp;
+
+   if( n <= 0 )
+      return -1;
+
+   tmp = gtpmdev.tpmlist[i];
+   if(domid == tmp->domid && tmp->handle == handle) {
+      return i;
+   } else if ( (domid < tmp->domid) ||
+	 (domid == tmp->domid && handle < tmp->handle)) {
+      return __get_tpmif_index(st, n/2, domid, handle);
+   } else {
+      return __get_tpmif_index(i + 1, n/2 - ((n +1) % 2), domid, handle);
+   }
+}
+
+/* Returns the array index of the tpmif domid/handle. Returns -1 if no such tpmif exists */
+int get_tpmif_index(domid_t domid, unsigned int handle)
+{
+   int flags;
+   int index;
+   local_irq_save(flags);
+   index = __get_tpmif_index(0, gtpmdev.num_tpms, domid, handle);
+   local_irq_restore(flags);
+   return index;
+}
+
+/* Returns the tpmif domid/handle or NULL if none exists */
+tpmif_t* get_tpmif(domid_t domid, unsigned int handle)
+{
+   int flags;
+   int i;
+   tpmif_t* ret;
+   local_irq_save(flags);
+   i = get_tpmif_index(domid, handle);
+   if (i < 0) {
+      ret = NULL;
+   } else {
+      ret = gtpmdev.tpmlist[i];
+   }
+   local_irq_restore(flags);
+   return ret;
+}
+
+/* Remove the given tpmif. Returns 0 if it was removed, -1 if it was not removed */
+int remove_tpmif(tpmif_t* tpmif)
+{
+   int i, j;
+   char* err;
+   int flags;
+   local_irq_save(flags);
+
+   /* Find the index in the array if it exists */
+   i = get_tpmif_index(tpmif->domid, tpmif->handle);
+   if (i < 0) {
+      goto error;
+   }
+
+   /* Remove the interface from the list */
+   for(j = i; j < gtpmdev.num_tpms - 1; ++j) {
+      gtpmdev.tpmlist[j] = gtpmdev.tpmlist[j+1];
+   }
+   gtpmdev.tpmlist[j] = NULL;
+   --gtpmdev.num_tpms;
+
+   /* If removed tpm was the only ready tpm, then we need to check and turn off the ready flag */
+   tpmdev_check_req();
+
+   local_irq_restore(flags);
+
+   /* Stop listening for events on this tpm interface */
+   if((err = xenbus_unwatch_path_token(XBT_NIL, tpmif->fe_state_path, tpmif->fe_state_path))) {
+      TPMBACK_ERR("Unable to unwatch path token `%s' Error was %s Ignoring..\n", tpmif->fe_state_path, err);
+      free(err);
+   }
+
+   return 0;
+error:
+   local_irq_restore(flags);
+   return -1;
+}
+
+/* Insert tpmif into dev->tpmlist. Returns 0 on success and non zero on error.
+ * It is an error to insert a tpmif with the same domid and handle
+ * number
+ * as something already in the list */
+int insert_tpmif(tpmif_t* tpmif)
+{
+   int flags;
+   unsigned int i, j;
+   tpmif_t* tmp;
+   char* err;
+
+   local_irq_save(flags);
+
+   /*Check if we need to allocate more space */
+   if (gtpmdev.num_tpms == gtpmdev.num_alloc) {
+      gtpmdev.num_alloc *= 2;
+      gtpmdev.tpmlist = realloc(gtpmdev.tpmlist, gtpmdev.num_alloc);
+   }
+
+   /*Find where to put the new interface */
+   for(i = 0; i < gtpmdev.num_tpms; ++i)
+   {
+      tmp = gtpmdev.tpmlist[i];
+      if(tpmif->domid == tmp->domid && tpmif->handle == tmp->handle) {
+	 TPMBACK_ERR("Tried to insert duplicate tpm interface %u/%u\n", (unsigned int) tpmif->domid, tpmif->handle);
+	 goto error;
+      }
+      if((tpmif->domid < tmp->domid) ||
+	    (tpmif->domid == tmp->domid && tpmif->handle < tmp->handle)) {
+	 break;
+      }
+   }
+
+   /*Shift all the tpm pointers past i down one */
+   for(j = gtpmdev.num_tpms; j > i; --j) {
+      gtpmdev.tpmlist[j] = gtpmdev.tpmlist[j-1];
+   }
+
+   /*Add the new interface */
+   gtpmdev.tpmlist[i] = tpmif;
+   ++gtpmdev.num_tpms;
+
+   /*Should not be needed, anything inserted with ready flag is probably an error */
+   tpmdev_check_req();
+
+   local_irq_restore(flags);
+
+   /*Listen for state changes on the new interface */
+   if((err = xenbus_watch_path_token(XBT_NIL, tpmif->fe_state_path, tpmif->fe_state_path, &gtpmdev.events)))
+   {
+      /* if we got an error here we should carefully remove the interface and then return */
+      TPMBACK_ERR("Unable to watch path token `%s' Error was %s\n", tpmif->fe_state_path, err);
+      free(err);
+      remove_tpmif(tpmif);
+      goto error_post_irq;
+   }
+
+   return 0;
+error:
+   local_irq_restore(flags);
+error_post_irq:
+   return -1;
+}
+
+
+/*****************
+ * CHANGE BACKEND STATE
+ * *****************/
+/*Attempts to change the backend state in xenstore
+ * returns 0 on success and non-zero on error */
+int tpmif_change_state(tpmif_t* tpmif, enum xenbus_state state)
+{
+   char path[512];
+   char *value;
+   char *err;
+   enum xenbus_state readst;
+   TPMBACK_DEBUG("Backend state change %u/%u from=%d to=%d\n", (unsigned int) tpmif->domid, tpmif->handle, tpmif->state, state);
+   if (tpmif->state == state)
+      return 0;
+
+   snprintf(path, 512, "backend/vtpm/%u/%u/state", (unsigned int) tpmif->domid, tpmif->handle);
+
+   if((err = xenbus_read(XBT_NIL, path, &value))) {
+      TPMBACK_ERR("Unable to read backend state %s, error was %s\n", path, err);
+      free(err);
+      return -1;
+   }
+   if(sscanf(value, "%d", &readst) != 1) {
+      TPMBACK_ERR("Non integer value (%s) in %s ??\n", value, path);
+      free(value);
+      return -1;
+   }
+   free(value);
+
+   /* It's possible that the backend state got updated by hotplug or something else behind our back */
+   if(readst != tpmif->state) {
+      TPMBACK_DEBUG("tpm interface state was %d but xenstore state was %d!\n", tpmif->state, readst);
+      tpmif->state = readst;
+   }
+
+   /*If if the state isnt changing, then we dont update xenstore b/c we dont want to fire extraneous events */
+   if(tpmif->state == state) {
+      return 0;
+   }
+
+   /*update xenstore*/
+   snprintf(path, 512, "backend/vtpm/%u/%u", (unsigned int) tpmif->domid, tpmif->handle);
+   if((err = xenbus_printf(XBT_NIL, path, "state", "%u", state))) {
+      TPMBACK_ERR("Error writing to xenstore %s, error was %s new state=%d\n", path, err, state);
+      free(err);
+      return -1;
+   }
+
+   tpmif->state = state;
+
+   return 0;
+}
+/**********************************
+ * TPMIF CREATION AND DELETION
+ * *******************************/
+inline tpmif_t* __init_tpmif(domid_t domid, unsigned int handle)
+{
+   tpmif_t* tpmif;
+   tpmif = malloc(sizeof(*tpmif));
+   tpmif->domid = domid;
+   tpmif->handle = handle;
+   tpmif->fe_path = NULL;
+   tpmif->fe_state_path = NULL;
+   tpmif->state = XenbusStateInitialising;
+   tpmif->status = DISCONNECTED;
+   tpmif->tx = NULL;
+   tpmif->pages = NULL;
+   tpmif->flags = 0;
+   memset(tpmif->uuid, 0, sizeof(tpmif->uuid));
+   return tpmif;
+}
+
+void __free_tpmif(tpmif_t* tpmif)
+{
+   if(tpmif->pages) {
+      free(tpmif->pages);
+   }
+   if(tpmif->fe_path) {
+      free(tpmif->fe_path);
+   }
+   if(tpmif->fe_state_path) {
+      free(tpmif->fe_state_path);
+   }
+   free(tpmif);
+}
+/* Creates a new tpm interface, adds it to the sorted array and returns it.
+ * returns NULL on error
+ * If the tpm interface already exists, it is returned*/
+tpmif_t* new_tpmif(domid_t domid, unsigned int handle)
+{
+   tpmif_t* tpmif;
+   char* err;
+   char path[512];
+
+   /* Make sure we haven't already created this tpm
+    * Double events can occur */
+   if((tpmif = get_tpmif(domid, handle)) != NULL) {
+      return tpmif;
+   }
+
+   tpmif = __init_tpmif(domid, handle);
+
+   /* Get the uuid from xenstore */
+   snprintf(path, 512, "backend/vtpm/%u/%u/uuid", (unsigned int) domid, handle);
+   if((!xenbus_read_uuid(path, tpmif->uuid))) {
+      TPMBACK_ERR("Error reading %s\n", path);
+      goto error;
+   }
+
+   /* allocate pages to be used for shared mapping */
+   if((tpmif->pages = malloc(sizeof(void*) * TPMIF_TX_RING_SIZE)) == NULL) {
+      goto error;
+   }
+   memset(tpmif->pages, 0, sizeof(void*) * TPMIF_TX_RING_SIZE);
+
+   if(tpmif_change_state(tpmif, XenbusStateInitWait)) {
+      goto error;
+   }
+
+   snprintf(path, 512, "backend/vtpm/%u/%u/frontend", (unsigned int) domid, handle);
+   if((err = xenbus_read(XBT_NIL, path, &tpmif->fe_path))) {
+      TPMBACK_ERR("Error creating new tpm instance xenbus_read(%s), Error = %s", path, err);
+      free(err);
+      goto error;
+   }
+
+   /*Set the state path */
+   tpmif->fe_state_path = malloc(strlen(tpmif->fe_path) + 7);
+   strcpy(tpmif->fe_state_path, tpmif->fe_path);
+   strcat(tpmif->fe_state_path, "/state");
+
+   if(insert_tpmif(tpmif)) {
+      goto error;
+   }
+   TPMBACK_DEBUG("New tpmif %u/%u\n", (unsigned int) tpmif->domid, tpmif->handle);
+   /* Do the callback now */
+   if(gtpmdev.open_callback) {
+      gtpmdev.open_callback(tpmif->domid, tpmif->handle);
+   }
+   return tpmif;
+error:
+   __free_tpmif(tpmif);
+   return NULL;
+
+}
+
+/* Removes tpmif from dev->tpmlist and frees it's memory usage */
+void free_tpmif(tpmif_t* tpmif)
+{
+   char* err;
+   char path[512];
+   TPMBACK_DEBUG("Free tpmif %u/%u\n", (unsigned int) tpmif->domid, tpmif->handle);
+   if(tpmif->flags & TPMIF_CLOSED) {
+      TPMBACK_ERR("Tried to free an instance twice! Theres a bug somewhere!\n");
+      BUG();
+   }
+   tpmif->flags = TPMIF_CLOSED;
+
+   tpmif_change_state(tpmif, XenbusStateClosing);
+
+   /* Unmap share page and unbind event channel */
+   if(tpmif->status == CONNECTED) {
+      tpmif->status = DISCONNECTING;
+      mask_evtchn(tpmif->evtchn);
+
+      if(gntmap_munmap(&gtpmdev.map, (unsigned long)tpmif->tx, 1)) {
+	 TPMBACK_ERR("%u/%u Error occured while trying to unmap shared page\n", (unsigned int) tpmif->domid, tpmif->handle);
+      }
+
+      unbind_evtchn(tpmif->evtchn);
+   }
+   tpmif->status = DISCONNECTED;
+   tpmif_change_state(tpmif, XenbusStateClosed);
+
+   /* Do the callback now */
+   if(gtpmdev.close_callback) {
+      gtpmdev.close_callback(tpmif->domid, tpmif->handle);
+   }
+
+   /* remove from array */
+   remove_tpmif(tpmif);
+
+   /* Wake up anyone possibly waiting on this interface and let them exit */
+   wake_up(&waitq);
+   schedule();
+
+   /* Remove the old xenbus entries */
+   snprintf(path, 512, "backend/vtpm/%u/%u", (unsigned int) tpmif->domid, tpmif->handle);
+   if((err = xenbus_rm(XBT_NIL, path))) {
+      TPMBACK_ERR("Error cleaning up xenbus entries path=%s error=%s\n", path, err);
+      free(err);
+   }
+
+   TPMBACK_LOG("Frontend %u/%u disconnected\n", (unsigned int) tpmif->domid, tpmif->handle);
+
+   /* free memory */
+   __free_tpmif(tpmif);
+
+}
+
+/**********************
+ * REMAINING TPMBACK FUNCTIONS
+ * ********************/
+
+/*Event channel handler */
+void tpmback_handler(evtchn_port_t port, struct pt_regs *regs, void *data)
+{
+   tpmif_t* tpmif = (tpmif_t*) data;
+   tpmif_tx_request_t* tx = &tpmif->tx->ring[0].req;
+   /* Throw away 0 size events, these can trigger from event channel unmasking */
+   if(tx->size == 0)
+      return;
+
+   TPMBACK_DEBUG("EVENT CHANNEL FIRE %u/%u\n", (unsigned int) tpmif->domid, tpmif->handle);
+   tpmif_req_ready(tpmif);
+   wake_up(&waitq);
+
+}
+
+/* Connect to frontend */
+int connect_fe(tpmif_t* tpmif)
+{
+   char path[512];
+   char* err, *value;
+   uint32_t domid;
+   grant_ref_t ringref;
+   evtchn_port_t evtchn;
+
+   /* If already connected then quit */
+   if (tpmif->status == CONNECTED) {
+      TPMBACK_DEBUG("%u/%u tried to connect while it was already connected?\n", (unsigned int) tpmif->domid, tpmif->handle);
+      return 0;
+   }
+
+   /* Fetch the grant reference */
+   snprintf(path, 512, "%s/ring-ref", tpmif->fe_path);
+   if((err = xenbus_read(XBT_NIL, path, &value))) {
+      TPMBACK_ERR("Error creating new tpm instance xenbus_read(%s) Error = %s", path, err);
+      free(err);
+      return -1;
+   }
+   if(sscanf(value, "%d", &ringref) != 1) {
+      TPMBACK_ERR("Non integer value (%s) in %s ??\n", value, path);
+      free(value);
+      return -1;
+   }
+   free(value);
+
+
+   /* Fetch the event channel*/
+   snprintf(path, 512, "%s/event-channel", tpmif->fe_path);
+   if((err = xenbus_read(XBT_NIL, path, &value))) {
+      TPMBACK_ERR("Error creating new tpm instance xenbus_read(%s) Error = %s", path, err);
+      free(err);
+      return -1;
+   }
+   if(sscanf(value, "%d", &evtchn) != 1) {
+      TPMBACK_ERR("Non integer value (%s) in %s ??\n", value, path);
+      free(value);
+      return -1;
+   }
+   free(value);
+
+   domid = tpmif->domid;
+   if((tpmif->tx = gntmap_map_grant_refs(&gtpmdev.map, 1, &domid, 0, &ringref, PROT_READ | PROT_WRITE)) == NULL) {
+      TPMBACK_ERR("Failed to map grant reference %u/%u\n", (unsigned int) tpmif->domid, tpmif->handle);
+      return -1;
+   }
+   memset(tpmif->tx, 0, PAGE_SIZE);
+
+   /*Bind the event channel */
+   if((evtchn_bind_interdomain(tpmif->domid, evtchn, tpmback_handler, tpmif, &tpmif->evtchn)))
+   {
+      TPMBACK_ERR("%u/%u Unable to bind to interdomain event channel!\n", (unsigned int) tpmif->domid, tpmif->handle);
+      goto error_post_map;
+   }
+   unmask_evtchn(tpmif->evtchn);
+
+   /* Write the ready flag and change status to connected */
+   snprintf(path, 512, "backend/vtpm/%u/%u", (unsigned int) tpmif->domid, tpmif->handle);
+   if((err = xenbus_printf(XBT_NIL, path, "ready", "%u", 1))) {
+      TPMBACK_ERR("%u/%u Unable to write ready flag on connect_fe()\n", (unsigned int) tpmif->domid, tpmif->handle);
+      free(err);
+      goto error_post_evtchn;
+   }
+   tpmif->status = CONNECTED;
+   if((tpmif_change_state(tpmif, XenbusStateConnected))){
+      goto error_post_evtchn;
+   }
+
+   TPMBACK_LOG("Frontend %u/%u connected\n", (unsigned int) tpmif->domid, tpmif->handle);
+
+   return 0;
+error_post_evtchn:
+   mask_evtchn(tpmif->evtchn);
+   unbind_evtchn(tpmif->evtchn);
+error_post_map:
+   gntmap_munmap(&gtpmdev.map, (unsigned long)tpmif->tx, 1);
+   return -1;
+}
+
+static int frontend_changed(tpmif_t* tpmif)
+{
+   int state = xenbus_read_integer(tpmif->fe_state_path);
+   if(state < 0) {
+      state = XenbusStateUnknown;
+   }
+
+   TPMBACK_DEBUG("Frontend %u/%u state changed to %d\n", (unsigned int) tpmif->domid, tpmif->handle, state);
+
+   switch (state) {
+      case XenbusStateInitialising:
+      case XenbusStateInitialised:
+	 break;
+
+      case XenbusStateConnected:
+	 if(connect_fe(tpmif)) {
+	    TPMBACK_ERR("Failed to connect to front end %u/%u\n", (unsigned int) tpmif->domid, tpmif->handle);
+	    tpmif_change_state(tpmif, XenbusStateClosed);
+	    return -1;
+	 }
+	 break;
+
+      case XenbusStateClosing:
+	 tpmif_change_state(tpmif, XenbusStateClosing);
+	 break;
+
+      case XenbusStateUnknown: /* keep it here */
+      case XenbusStateClosed:
+	 free_tpmif(tpmif);
+	 break;
+
+      default:
+	 TPMBACK_DEBUG("BAD STATE CHANGE %u/%u state = %d for tpmif\n", (unsigned int) tpmif->domid, tpmif->handle, state);
+	 return -1;
+   }
+   return 0;
+}
+
+
+/* parses the string that comes out of xenbus_watch_wait_return. */
+static int parse_eventstr(const char* evstr, domid_t* domid, unsigned int* handle)
+{
+   int ret;
+   char cmd[40];
+   char* err;
+   char* value;
+   unsigned int udomid = 0;
+   tpmif_t* tpmif;
+   /* First check for new frontends, this occurs when /backend/vtpm/<domid>/<handle> gets created. Note we what the sscanf to fail on the last %s */
+   if (sscanf(evstr, "backend/vtpm/%u/%u/%40s", &udomid, handle, cmd) == 2) {
+      *domid = udomid;
+      /* Make sure the entry exists, if this event triggers because the entry dissapeared then ignore it */
+      if((err = xenbus_read(XBT_NIL, evstr, &value))) {
+	 free(err);
+	 return EV_NONE;
+      }
+      free(value);
+      /* Make sure the tpmif entry does not already exist, this should not happen */
+      if((tpmif = get_tpmif(*domid, *handle)) != NULL) {
+	 TPMBACK_DEBUG("Duplicate tpm entries! %u %u\n", tpmif->domid, tpmif->handle);
+	 return EV_NONE;
+      }
+      return EV_NEWFE;
+   } else if((ret = sscanf(evstr, "/local/domain/%u/device/vtpm/%u/%40s", &udomid, handle, cmd)) == 3) {
+      *domid = udomid;
+      if (!strcmp(cmd, "state"))
+	 return EV_STCHNG;
+   }
+   return EV_NONE;
+}
+
+void handle_backend_event(char* evstr) {
+   tpmif_t* tpmif;
+   domid_t domid;
+   unsigned int handle;
+   int event;
+
+   TPMBACK_DEBUG("Xenbus Event: %s\n", evstr);
+
+   event = parse_eventstr(evstr, &domid, &handle);
+
+   switch(event) {
+      case EV_NEWFE:
+	 if(new_tpmif(domid, handle) == NULL) {
+	    TPMBACK_ERR("Failed to create new tpm instance %u/%u\n", (unsigned int) domid, handle);
+	 }
+	 wake_up(&waitq);
+	 break;
+      case EV_STCHNG:
+	 if((tpmif = get_tpmif(domid, handle))) {
+	    frontend_changed(tpmif);
+	 } else {
+	    TPMBACK_DEBUG("Event Received for non-existant tpm! instance=%u/%u xenbus_event=%s\n", (unsigned int) domid, handle, evstr);
+	 }
+	 break;
+   }
+}
+
+/* Runs through the given path and creates events recursively
+ * for all of its children.
+ * @path - xenstore path to scan */
+static void generate_backend_events(const char* path)
+{
+   char* err;
+   int i, len;
+   char **dirs;
+   char *entry;
+
+   if((err = xenbus_ls(XBT_NIL, path, &dirs)) != NULL) {
+      free(err);
+      return;
+   }
+
+   for(i = 0; dirs[i] != NULL; ++i) {
+      len = strlen(path) + strlen(dirs[i]) + 2;
+      entry = malloc(len);
+      snprintf(entry, len, "%s/%s", path, dirs[i]);
+
+      /* Generate and handle event for the entry itself */
+      handle_backend_event(entry);
+
+      /* Do children */
+      generate_backend_events(entry);
+
+      /* Cleanup */
+      free(entry);
+      free(dirs[i]);
+   }
+   free(dirs);
+   return;
+}
+
+unsigned char* tpmback_get_uuid(domid_t domid, unsigned int handle)
+{
+   tpmif_t* tpmif;
+   if((tpmif = get_tpmif(domid, handle)) == NULL) {
+      TPMBACK_DEBUG("get_uuid() failed, %u/%u is an invalid frontend\n", (unsigned int) domid, handle);
+      return NULL;
+   }
+
+   return tpmif->uuid;
+}
+
+void tpmback_set_open_callback(void (*cb)(domid_t, unsigned int))
+{
+   gtpmdev.open_callback = cb;
+}
+void tpmback_set_close_callback(void (*cb)(domid_t, unsigned int))
+{
+   gtpmdev.close_callback = cb;
+}
+void tpmback_set_suspend_callback(void (*cb)(domid_t, unsigned int))
+{
+   gtpmdev.suspend_callback = cb;
+}
+void tpmback_set_resume_callback(void (*cb)(domid_t, unsigned int))
+{
+   gtpmdev.resume_callback = cb;
+}
+
+static void event_listener(void)
+{
+   const char* bepath = "backend/vtpm";
+   char **path;
+   char* err;
+
+   /* Setup the backend device watch */
+   if((err = xenbus_watch_path_token(XBT_NIL, bepath, bepath, &gtpmdev.events)) != NULL) {
+      TPMBACK_ERR("xenbus_watch_path_token(%s) failed with error %s!\n", bepath, err);
+      free(err);
+      goto egress;
+   }
+
+   /* Check for any frontends that connected before we set the watch.
+    * This is almost guaranteed to happen if both domains are started
+    * immediatly one after the other.
+    * We do this by manually generating events on everything in the backend
+    * path */
+   generate_backend_events(bepath);
+
+   /* Wait and listen for changes in frontend connections */
+   while(1) {
+      path = xenbus_wait_for_watch_return(&gtpmdev.events);
+
+      /*If quit flag was set then exit */
+      if(gtpmdev.flags & TPMIF_CLOSED) {
+	 TPMBACK_DEBUG("listener thread got quit event. Exiting..\n");
+	 free(path);
+	 break;
+      }
+      handle_backend_event(*path);
+      free(path);
+
+   }
+
+   if((err = xenbus_unwatch_path_token(XBT_NIL, bepath, bepath)) != NULL) {
+      free(err);
+   }
+egress:
+   return;
+}
+
+void event_thread(void* p) {
+   event_listener();
+}
+
+void init_tpmback(void)
+{
+   if(!globalinit) {
+      init_waitqueue_head(&waitq);
+      globalinit = 1;
+   }
+   printk("============= Init TPM BACK ================\n");
+   gtpmdev.tpmlist = malloc(sizeof(tpmif_t*) * DEF_ARRAY_SIZE);
+   gtpmdev.num_alloc = DEF_ARRAY_SIZE;
+   gtpmdev.num_tpms = 0;
+   gtpmdev.flags = 0;
+
+   gtpmdev.open_callback = gtpmdev.close_callback = NULL;
+   gtpmdev.suspend_callback = gtpmdev.resume_callback = NULL;
+
+   eventthread = create_thread("tpmback-listener", event_thread, NULL);
+
+}
+
+void shutdown_tpmback(void)
+{
+   /* Disable callbacks */
+   gtpmdev.open_callback = gtpmdev.close_callback = NULL;
+   gtpmdev.suspend_callback = gtpmdev.resume_callback = NULL;
+
+   TPMBACK_LOG("Shutting down tpm backend\n");
+   /* Set the quit flag */
+   gtpmdev.flags = TPMIF_CLOSED;
+
+   //printk("num tpms is %d\n", gtpmdev.num_tpms);
+   /*Free all backend instances */
+   while(gtpmdev.num_tpms) {
+      free_tpmif(gtpmdev.tpmlist[0]);
+   }
+   free(gtpmdev.tpmlist);
+   gtpmdev.tpmlist = NULL;
+   gtpmdev.num_alloc = 0;
+
+   /* Wake up anyone possibly waiting on the device and let them exit */
+   wake_up(&waitq);
+   schedule();
+}
+
+inline void init_tpmcmd(tpmcmd_t* tpmcmd, domid_t domid, unsigned int handle, unsigned char uuid[16])
+{
+   tpmcmd->domid = domid;
+   tpmcmd->handle = handle;
+   memcpy(tpmcmd->uuid, uuid, sizeof(tpmcmd->uuid));
+   tpmcmd->req = NULL;
+   tpmcmd->req_len = 0;
+   tpmcmd->resp = NULL;
+   tpmcmd->resp_len = 0;
+}
+
+tpmcmd_t* get_request(tpmif_t* tpmif) {
+   tpmcmd_t* cmd;
+   tpmif_tx_request_t* tx;
+   int offset;
+   int tocopy;
+   int i;
+   uint32_t domid;
+   int flags;
+
+   local_irq_save(flags);
+
+   /* Allocate the cmd object to hold the data */
+   if((cmd = malloc(sizeof(*cmd))) == NULL) {
+      goto error;
+   }
+   init_tpmcmd(cmd, tpmif->domid, tpmif->handle, tpmif->uuid);
+
+   tx = &tpmif->tx->ring[0].req;
+   cmd->req_len = tx->size;
+   /* Allocate the buffer */
+   if(cmd->req_len) {
+      if((cmd->req = malloc(cmd->req_len)) == NULL) {
+	 goto error;
+      }
+   }
+   /* Copy the bits from the shared pages */
+   offset = 0;
+   for(i = 0; i < TPMIF_TX_RING_SIZE && offset < cmd->req_len; ++i) {
+      tx = &tpmif->tx->ring[i].req;
+
+      /* Map the page with the data */
+      domid = (uint32_t)tpmif->domid;
+      if((tpmif->pages[i] = gntmap_map_grant_refs(&gtpmdev.map, 1, &domid, 0, &tx->ref, PROT_READ)) == NULL) {
+	 TPMBACK_ERR("%u/%u Unable to map shared page during read!\n", (unsigned int) tpmif->domid, tpmif->handle);
+	 goto error;
+      }
+
+      /* do the copy now */
+      tocopy = min(cmd->req_len - offset, PAGE_SIZE);
+      memcpy(&cmd->req[offset], tpmif->pages[i], tocopy);
+      offset += tocopy;
+
+      /* release the page */
+      gntmap_munmap(&gtpmdev.map, (unsigned long)tpmif->pages[i], 1);
+
+   }
+
+#ifdef TPMBACK_PRINT_DEBUG
+   TPMBACK_DEBUG("Received Tpm Command from %u/%u of size %u", (unsigned int) tpmif->domid, tpmif->handle, cmd->req_len);
+   for(i = 0; i < cmd->req_len; ++i) {
+      if (!(i % 30)) {
+	 TPMBACK_DEBUG_MORE("\n");
+      }
+      TPMBACK_DEBUG_MORE("%02hhX ", cmd->req[i]);
+   }
+   TPMBACK_DEBUG_MORE("\n\n");
+#endif
+
+   local_irq_restore(flags);
+   return cmd;
+error:
+   if(cmd != NULL) {
+      if (cmd->req != NULL) {
+	 free(cmd->req);
+	 cmd->req = NULL;
+      }
+      free(cmd);
+      cmd = NULL;
+   }
+   local_irq_restore(flags);
+   return NULL;
+
+}
+
+void send_response(tpmcmd_t* cmd, tpmif_t* tpmif)
+{
+   tpmif_tx_request_t* tx;
+   int offset;
+   int i;
+   uint32_t domid;
+   int tocopy;
+   int flags;
+
+   local_irq_save(flags);
+
+   tx = &tpmif->tx->ring[0].req;
+   tx->size = cmd->resp_len;
+
+   offset = 0;
+   for(i = 0; i < TPMIF_TX_RING_SIZE && offset < cmd->resp_len; ++i) {
+      tx = &tpmif->tx->ring[i].req;
+
+      /* Map the page with the data */
+      domid = (uint32_t)tpmif->domid;
+      if((tpmif->pages[i] = gntmap_map_grant_refs(&gtpmdev.map, 1, &domid, 0, &tx->ref, PROT_WRITE)) == NULL) {
+	 TPMBACK_ERR("%u/%u Unable to map shared page during write!\n", (unsigned int) tpmif->domid, tpmif->handle);
+	 goto error;
+      }
+
+      /* do the copy now */
+      tocopy = min(cmd->resp_len - offset, PAGE_SIZE);
+      memcpy(tpmif->pages[i], &cmd->resp[offset], tocopy);
+      offset += tocopy;
+
+      /* release the page */
+      gntmap_munmap(&gtpmdev.map, (unsigned long)tpmif->pages[i], 1);
+
+   }
+
+#ifdef TPMBACK_PRINT_DEBUG
+   TPMBACK_DEBUG("Sent response to %u/%u of size %u", (unsigned int) tpmif->domid, tpmif->handle, cmd->resp_len);
+   for(i = 0; i < cmd->resp_len; ++i) {
+      if (!(i % 30)) {
+	 TPMBACK_DEBUG_MORE("\n");
+      }
+      TPMBACK_DEBUG_MORE("%02hhX ", cmd->resp[i]);
+   }
+   TPMBACK_DEBUG_MORE("\n\n");
+#endif
+   /* clear the ready flag and send the event channel notice to the frontend */
+   tpmif_req_finished(tpmif);
+   notify_remote_via_evtchn(tpmif->evtchn);
+error:
+   local_irq_restore(flags);
+   return;
+}
+
+tpmcmd_t* tpmback_req_any(void)
+{
+   int i;
+   /* Block until something has a request */
+   wait_event(waitq, (gtpmdev.flags & (TPMIF_REQ_READY | TPMIF_CLOSED)));
+
+   /* Check if were shutting down */
+   if(gtpmdev.flags & TPMIF_CLOSED) {
+      /* if something was waiting for us to give up the queue so it can shutdown, let it finish */
+      schedule();
+      return NULL;
+   }
+
+   for(i = 0; i < gtpmdev.num_tpms; ++i) {
+      if(gtpmdev.tpmlist[i]->flags & TPMIF_REQ_READY) {
+	 return get_request(gtpmdev.tpmlist[i]);
+      }
+   }
+
+   TPMBACK_ERR("backend request ready flag was set but no interfaces were actually ready\n");
+   return NULL;
+}
+
+tpmcmd_t* tpmback_req(domid_t domid, unsigned int handle)
+{
+   tpmif_t* tpmif;
+   tpmif = get_tpmif(domid, handle);
+   if(tpmif == NULL) {
+      return NULL;
+   }
+
+   wait_event(waitq, (tpmif->flags & (TPMIF_REQ_READY | TPMIF_CLOSED) || gtpmdev.flags & TPMIF_CLOSED));
+
+   /* Check if were shutting down */
+   if(tpmif->flags & TPMIF_CLOSED || gtpmdev.flags & TPMIF_CLOSED) {
+      /* if something was waiting for us to give up the queue so it can free this instance, let it finish */
+      schedule();
+      return NULL;
+   }
+
+   return get_request(tpmif);
+}
+
+void tpmback_resp(tpmcmd_t* tpmcmd)
+{
+   tpmif_t* tpmif;
+
+   /* Get the associated interface, if it doesnt exist then just quit */
+   tpmif = get_tpmif(tpmcmd->domid, tpmcmd->handle);
+   if(tpmif == NULL) {
+      TPMBACK_ERR("Tried to send a reponse to non existant frontend %u/%u\n", (unsigned int) tpmcmd->domid, tpmcmd->handle);
+      goto end;
+   }
+
+   if(!(tpmif->flags & TPMIF_REQ_READY)) {
+      TPMBACK_ERR("Tried to send response to a frontend that was not waiting for one %u/%u\n", (unsigned int) tpmcmd->domid, tpmcmd->handle);
+      goto end;
+   }
+
+   /* Send response to frontend */
+   send_response(tpmcmd, tpmif);
+
+end:
+   if(tpmcmd->req != NULL) {
+      free(tpmcmd->req);
+   }
+   free(tpmcmd);
+   return;
+}
+
+int tpmback_wait_for_frontend_connect(domid_t *domid, unsigned int *handle)
+{
+   tpmif_t* tpmif;
+   int flags;
+   wait_event(waitq, ((gtpmdev.num_tpms > 0) || gtpmdev.flags & TPMIF_CLOSED));
+   if(gtpmdev.flags & TPMIF_CLOSED) {
+      return -1;
+   }
+   local_irq_save(flags);
+   tpmif = gtpmdev.tpmlist[0];
+   *domid = tpmif->domid;
+   *handle = tpmif->handle;
+   local_irq_restore(flags);
+
+   return 0;
+}
+
+int tpmback_num_frontends(void)
+{
+   return gtpmdev.num_tpms;
+}
diff -r 3015f8c6174b -r 34d52300f5d2 extras/mini-os/tpmfront.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/tpmfront.c	Tue Nov 13 10:46:58 2012 +0000
@@ -0,0 +1,608 @@
+/*
+ * Copyright (c) 2010-2012 United States Government, as represented by
+ * the Secretary of Defense.  All rights reserved.
+ *
+ * This code has been derived from drivers/char/tpm_vtpm.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (C) 2006 IBM Corporation
+ *
+ * This code has also been derived from drivers/char/tpm_xen.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (c) 2005, IBM Corporation
+ *
+ * which was itself derived from drivers/xen/netfront/netfront.c
+ * from the linux kernel
+ *
+ * Copyright (c) 2002-2004, K A Fraser
+ *
+ * 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, version 2 of the
+ * License.
+ */
+#include <mini-os/os.h>
+#include <mini-os/xenbus.h>
+#include <mini-os/xmalloc.h>
+#include <mini-os/events.h>
+#include <mini-os/wait.h>
+#include <mini-os/gnttab.h>
+#include <xen/io/xenbus.h>
+#include <xen/io/tpmif.h>
+#include <mini-os/tpmfront.h>
+#include <fcntl.h>
+
+//#define TPMFRONT_PRINT_DEBUG
+#ifdef TPMFRONT_PRINT_DEBUG
+#define TPMFRONT_DEBUG(fmt,...) printk("Tpmfront:Debug("__FILE__":%d) " fmt, __LINE__, ##__VA_ARGS__)
+#define TPMFRONT_DEBUG_MORE(fmt,...) printk(fmt, ##__VA_ARGS__)
+#else
+#define TPMFRONT_DEBUG(fmt,...)
+#endif
+#define TPMFRONT_ERR(fmt,...) printk("Tpmfront:Error " fmt, ##__VA_ARGS__)
+#define TPMFRONT_LOG(fmt,...) printk("Tpmfront:Info " fmt, ##__VA_ARGS__)
+
+#define min(a,b) (((a) < (b)) ? (a) : (b))
+
+void tpmfront_handler(evtchn_port_t port, struct pt_regs *regs, void *data) {
+   struct tpmfront_dev* dev = (struct tpmfront_dev*) data;
+   /*If we get a response when we didnt make a request, just ignore it */
+   if(!dev->waiting) {
+      return;
+   }
+
+   dev->waiting = 0;
+#ifdef HAVE_LIBC
+   if(dev->fd >= 0) {
+      files[dev->fd].read = 1;
+   }
+#endif
+   wake_up(&dev->waitq);
+}
+
+static int publish_xenbus(struct tpmfront_dev* dev) {
+   xenbus_transaction_t xbt;
+   int retry;
+   char* err;
+   /* Write the grant reference and event channel to xenstore */
+again:
+   if((err = xenbus_transaction_start(&xbt))) {
+      TPMFRONT_ERR("Unable to start xenbus transaction, error was %s\n", err);
+      free(err);
+      return -1;
+   }
+
+   if((err = xenbus_printf(xbt, dev->nodename, "ring-ref", "%u", (unsigned int) dev->ring_ref))) {
+      TPMFRONT_ERR("Unable to write %s/ring-ref, error was %s\n", dev->nodename, err);
+      free(err);
+      goto abort_transaction;
+   }
+
+   if((err = xenbus_printf(xbt, dev->nodename, "event-channel", "%u", (unsigned int) dev->evtchn))) {
+      TPMFRONT_ERR("Unable to write %s/event-channel, error was %s\n", dev->nodename, err);
+      free(err);
+      goto abort_transaction;
+   }
+
+   if((err = xenbus_transaction_end(xbt, 0, &retry))) {
+      TPMFRONT_ERR("Unable to complete xenbus transaction, error was %s\n", err);
+      free(err);
+      return -1;
+   }
+   if(retry) {
+      goto again;
+   }
+
+   return 0;
+abort_transaction:
+   if((err = xenbus_transaction_end(xbt, 1, &retry))) {
+      free(err);
+   }
+   return -1;
+}
+
+static int wait_for_backend_connect(xenbus_event_queue* events, char* path)
+{
+   int state;
+
+   TPMFRONT_LOG("Waiting for backend connection..\n");
+   /* Wait for the backend to connect */
+   while(1) {
+      state = xenbus_read_integer(path);
+      if ( state < 0)
+	 state = XenbusStateUnknown;
+      switch(state) {
+	 /* Bad states, we quit with error */
+	 case XenbusStateUnknown:
+	 case XenbusStateClosing:
+	 case XenbusStateClosed:
+	    TPMFRONT_ERR("Unable to connect to backend\n");
+	    return -1;
+	 /* If backend is connected then break out of loop */
+	 case XenbusStateConnected:
+	    TPMFRONT_LOG("Backend Connected\n");
+	    return 0;
+	 default:
+	    xenbus_wait_for_watch(events);
+      }
+   }
+
+}
+
+static int wait_for_backend_closed(xenbus_event_queue* events, char* path)
+{
+   int state;
+
+   TPMFRONT_LOG("Waiting for backend to close..\n");
+   while(1) {
+      state = xenbus_read_integer(path);
+      if ( state < 0)
+	 state = XenbusStateUnknown;
+      switch(state) {
+	 case XenbusStateUnknown:
+	    TPMFRONT_ERR("Backend Unknown state, forcing shutdown\n");
+	    return -1;
+	 case XenbusStateClosed:
+	    TPMFRONT_LOG("Backend Closed\n");
+	    return 0;
+	 default:
+	    xenbus_wait_for_watch(events);
+      }
+   }
+
+}
+
+static int wait_for_backend_state_changed(struct tpmfront_dev* dev, XenbusState state) {
+   char* err;
+   int ret = 0;
+   xenbus_event_queue events = NULL;
+   char path[512];
+
+   snprintf(path, 512, "%s/state", dev->bepath);
+   /*Setup the watch to wait for the backend */
+   if((err = xenbus_watch_path_token(XBT_NIL, path, path, &events))) {
+      TPMFRONT_ERR("Could not set a watch on %s, error was %s\n", path, err);
+      free(err);
+      return -1;
+   }
+
+   /* Do the actual wait loop now */
+   switch(state) {
+      case XenbusStateConnected:
+	 ret = wait_for_backend_connect(&events, path);
+	 break;
+      case XenbusStateClosed:
+	 ret = wait_for_backend_closed(&events, path);
+	 break;
+      default:
+	 break;
+   }
+
+   if((err = xenbus_unwatch_path_token(XBT_NIL, path, path))) {
+      TPMFRONT_ERR("Unable to unwatch %s, error was %s, ignoring..\n", path, err);
+      free(err);
+   }
+   return ret;
+}
+
+static int tpmfront_connect(struct tpmfront_dev* dev)
+{
+   char* err;
+   /* Create shared page */
+   dev->tx = (tpmif_tx_interface_t*) alloc_page();
+   if(dev->tx == NULL) {
+      TPMFRONT_ERR("Unable to allocate page for shared memory\n");
+      goto error;
+   }
+   memset(dev->tx, 0, PAGE_SIZE);
+   dev->ring_ref = gnttab_grant_access(dev->bedomid, virt_to_mfn(dev->tx), 0);
+   TPMFRONT_DEBUG("grant ref is %lu\n", (unsigned long) dev->ring_ref);
+
+   /*Create event channel */
+   if(evtchn_alloc_unbound(dev->bedomid, tpmfront_handler, dev, &dev->evtchn)) {
+      TPMFRONT_ERR("Unable to allocate event channel\n");
+      goto error_postmap;
+   }
+   unmask_evtchn(dev->evtchn);
+   TPMFRONT_DEBUG("event channel is %lu\n", (unsigned long) dev->evtchn);
+
+   /* Write the entries to xenstore */
+   if(publish_xenbus(dev)) {
+      goto error_postevtchn;
+   }
+
+   /* Change state to connected */
+   dev->state = XenbusStateConnected;
+
+   /* Tell the backend that we are ready */
+   if((err = xenbus_printf(XBT_NIL, dev->nodename, "state", "%u", dev->state))) {
+      TPMFRONT_ERR("Unable to write to xenstore %s/state, value=%u", dev->nodename, XenbusStateConnected);
+      free(err);
+      goto error;
+   }
+
+   return 0;
+error_postevtchn:
+      mask_evtchn(dev->evtchn);
+      unbind_evtchn(dev->evtchn);
+error_postmap:
+      gnttab_end_access(dev->ring_ref);
+      free_page(dev->tx);
+error:
+   return -1;
+}
+
+struct tpmfront_dev* init_tpmfront(const char* _nodename)
+{
+   struct tpmfront_dev* dev;
+   const char* nodename;
+   char path[512];
+   char* value, *err;
+   unsigned long long ival;
+   int i;
+
+   printk("============= Init TPM Front ================\n");
+
+   dev = malloc(sizeof(struct tpmfront_dev));
+   memset(dev, 0, sizeof(struct tpmfront_dev));
+
+#ifdef HAVE_LIBC
+   dev->fd = -1;
+#endif
+
+   nodename = _nodename ? _nodename : "device/vtpm/0";
+   dev->nodename = strdup(nodename);
+
+   init_waitqueue_head(&dev->waitq);
+
+   /* Get backend domid */
+   snprintf(path, 512, "%s/backend-id", dev->nodename);
+   if((err = xenbus_read(XBT_NIL, path, &value))) {
+      TPMFRONT_ERR("Unable to read %s during tpmfront initialization! error = %s\n", path, err);
+      free(err);
+      goto error;
+   }
+   if(sscanf(value, "%llu", &ival) != 1) {
+      TPMFRONT_ERR("%s has non-integer value (%s)\n", path, value);
+      free(value);
+      goto error;
+   }
+   free(value);
+   dev->bedomid = ival;
+
+   /* Get backend xenstore path */
+   snprintf(path, 512, "%s/backend", dev->nodename);
+   if((err = xenbus_read(XBT_NIL, path, &dev->bepath))) {
+      TPMFRONT_ERR("Unable to read %s during tpmfront initialization! error = %s\n", path, err);
+      free(err);
+      goto error;
+   }
+
+   /* Create and publish grant reference and event channel */
+   if (tpmfront_connect(dev)) {
+      goto error;
+   }
+
+   /* Wait for backend to connect */
+   if( wait_for_backend_state_changed(dev, XenbusStateConnected)) {
+      goto error;
+   }
+
+   /* Allocate pages that will contain the messages */
+   dev->pages = malloc(sizeof(void*) * TPMIF_TX_RING_SIZE);
+   if(dev->pages == NULL) {
+      goto error;
+   }
+   memset(dev->pages, 0, sizeof(void*) * TPMIF_TX_RING_SIZE);
+   for(i = 0; i < TPMIF_TX_RING_SIZE; ++i) {
+      dev->pages[i] = (void*)alloc_page();
+      if(dev->pages[i] == NULL) {
+	 goto error;
+      }
+   }
+
+   TPMFRONT_LOG("Initialization Completed successfully\n");
+
+   return dev;
+
+error:
+   shutdown_tpmfront(dev);
+   return NULL;
+}
+void shutdown_tpmfront(struct tpmfront_dev* dev)
+{
+   char* err;
+   char path[512];
+   int i;
+   tpmif_tx_request_t* tx;
+   if(dev == NULL) {
+      return;
+   }
+   TPMFRONT_LOG("Shutting down tpmfront\n");
+   /* disconnect */
+   if(dev->state == XenbusStateConnected) {
+      dev->state = XenbusStateClosing;
+      //FIXME: Transaction for this?
+      /* Tell backend we are closing */
+      if((err = xenbus_printf(XBT_NIL, dev->nodename, "state", "%u", (unsigned int) dev->state))) {
+	 free(err);
+      }
+
+      /* Clean up xenstore entries */
+      snprintf(path, 512, "%s/event-channel", dev->nodename);
+      if((err = xenbus_rm(XBT_NIL, path))) {
+	 free(err);
+      }
+      snprintf(path, 512, "%s/ring-ref", dev->nodename);
+      if((err = xenbus_rm(XBT_NIL, path))) {
+	 free(err);
+      }
+
+      /* Tell backend we are closed */
+      dev->state = XenbusStateClosed;
+      if((err = xenbus_printf(XBT_NIL, dev->nodename, "state", "%u", (unsigned int) dev->state))) {
+	 TPMFRONT_ERR("Unable to write to %s, error was %s", dev->nodename, err);
+	 free(err);
+      }
+
+      /* Wait for the backend to close and unmap shared pages, ignore any errors */
+      wait_for_backend_state_changed(dev, XenbusStateClosed);
+
+      /* Cleanup any shared pages */
+      if(dev->pages) {
+	 for(i = 0; i < TPMIF_TX_RING_SIZE; ++i) {
+	    if(dev->pages[i]) {
+	       tx = &dev->tx->ring[i].req;
+	       if(tx->ref != 0) {
+		  gnttab_end_access(tx->ref);
+	       }
+	       free_page(dev->pages[i]);
+	    }
+	 }
+	 free(dev->pages);
+      }
+
+      /* Close event channel and unmap shared page */
+      mask_evtchn(dev->evtchn);
+      unbind_evtchn(dev->evtchn);
+      gnttab_end_access(dev->ring_ref);
+
+      free_page(dev->tx);
+
+   }
+
+   /* Cleanup memory usage */
+   if(dev->respbuf) {
+      free(dev->respbuf);
+   }
+   if(dev->bepath) {
+      free(dev->bepath);
+   }
+   if(dev->nodename) {
+      free(dev->nodename);
+   }
+   free(dev);
+}
+
+int tpmfront_send(struct tpmfront_dev* dev, const uint8_t* msg, size_t length)
+{
+   int i;
+   tpmif_tx_request_t* tx = NULL;
+   /* Error Checking */
+   if(dev == NULL || dev->state != XenbusStateConnected) {
+      TPMFRONT_ERR("Tried to send message through disconnected frontend\n");
+      return -1;
+   }
+
+#ifdef TPMFRONT_PRINT_DEBUG
+   TPMFRONT_DEBUG("Sending Msg to backend size=%u", (unsigned int) length);
+   for(i = 0; i < length; ++i) {
+      if(!(i % 30)) {
+	 TPMFRONT_DEBUG_MORE("\n");
+      }
+      TPMFRONT_DEBUG_MORE("%02X ", msg[i]);
+   }
+   TPMFRONT_DEBUG_MORE("\n");
+#endif
+
+   /* Copy to shared pages now */
+   for(i = 0; length > 0 && i < TPMIF_TX_RING_SIZE; ++i) {
+      /* Share the page */
+      tx = &dev->tx->ring[i].req;
+      tx->unused = 0;
+      tx->addr = virt_to_mach(dev->pages[i]);
+      tx->ref = gnttab_grant_access(dev->bedomid, virt_to_mfn(dev->pages[i]), 0);
+      /* Copy the bits to the page */
+      tx->size = length > PAGE_SIZE ? PAGE_SIZE : length;
+      memcpy(dev->pages[i], &msg[i * PAGE_SIZE], tx->size);
+
+      /* Update counters */
+      length -= tx->size;
+   }
+   dev->waiting = 1;
+   dev->resplen = 0;
+#ifdef HAVE_LIBC
+   if(dev->fd >= 0) {
+      files[dev->fd].read = 0;
+      files[dev->fd].tpmfront.respgot = 0;
+      files[dev->fd].tpmfront.offset = 0;
+   }
+#endif
+   notify_remote_via_evtchn(dev->evtchn);
+   return 0;
+}
+int tpmfront_recv(struct tpmfront_dev* dev, uint8_t** msg, size_t *length)
+{
+   tpmif_tx_request_t* tx;
+   int i;
+   if(dev == NULL || dev->state != XenbusStateConnected) {
+      TPMFRONT_ERR("Tried to receive message from disconnected frontend\n");
+      return -1;
+   }
+   /*Wait for the response */
+   wait_event(dev->waitq, (!dev->waiting));
+
+   /* Initialize */
+   *msg = NULL;
+   *length = 0;
+
+   /* special case, just quit */
+   tx = &dev->tx->ring[0].req;
+   if(tx->size == 0 ) {
+       goto quit;
+   }
+   /* Get the total size */
+   tx = &dev->tx->ring[0].req;
+   for(i = 0; i < TPMIF_TX_RING_SIZE && tx->size > 0; ++i) {
+      tx = &dev->tx->ring[i].req;
+      *length += tx->size;
+   }
+   /* Alloc the buffer */
+   if(dev->respbuf) {
+      free(dev->respbuf);
+   }
+   *msg = dev->respbuf = malloc(*length);
+   dev->resplen = *length;
+   /* Copy the bits */
+   tx = &dev->tx->ring[0].req;
+   for(i = 0; i < TPMIF_TX_RING_SIZE && tx->size > 0; ++i) {
+      tx = &dev->tx->ring[i].req;
+      memcpy(&(*msg)[i * PAGE_SIZE], dev->pages[i], tx->size);
+      gnttab_end_access(tx->ref);
+      tx->ref = 0;
+   }
+#ifdef TPMFRONT_PRINT_DEBUG
+   TPMFRONT_DEBUG("Received response from backend size=%u", (unsigned int) *length);
+   for(i = 0; i < *length; ++i) {
+      if(!(i % 30)) {
+	 TPMFRONT_DEBUG_MORE("\n");
+      }
+      TPMFRONT_DEBUG_MORE("%02X ", (*msg)[i]);
+   }
+   TPMFRONT_DEBUG_MORE("\n");
+#endif
+#ifdef HAVE_LIBC
+   if(dev->fd >= 0) {
+      files[dev->fd].tpmfront.respgot = 1;
+   }
+#endif
+quit:
+   return 0;
+}
+
+int tpmfront_cmd(struct tpmfront_dev* dev, uint8_t* req, size_t reqlen, uint8_t** resp, size_t* resplen)
+{
+   int rc;
+   if((rc = tpmfront_send(dev, req, reqlen))) {
+      return rc;
+   }
+   if((rc = tpmfront_recv(dev, resp, resplen))) {
+      return rc;
+   }
+
+   return 0;
+}
+
+#ifdef HAVE_LIBC
+#include <errno.h>
+int tpmfront_open(struct tpmfront_dev* dev)
+{
+   /* Silently prevent multiple opens */
+   if(dev->fd != -1) {
+      return dev->fd;
+   }
+
+   dev->fd = alloc_fd(FTYPE_TPMFRONT);
+   printk("tpmfront_open(%s) -> %d\n", dev->nodename, dev->fd);
+   files[dev->fd].tpmfront.dev = dev;
+   files[dev->fd].tpmfront.offset = 0;
+   files[dev->fd].tpmfront.respgot = 0;
+   return dev->fd;
+}
+
+int tpmfront_posix_write(int fd, const uint8_t* buf, size_t count)
+{
+   int rc;
+   struct tpmfront_dev* dev;
+   dev = files[fd].tpmfront.dev;
+
+   if(count == 0) {
+      return 0;
+   }
+
+   /* Return an error if we are already processing a command */
+   if(dev->waiting) {
+      errno = EINPROGRESS;
+      return -1;
+   }
+   /* Send the command now */
+   if((rc = tpmfront_send(dev, buf, count)) != 0) {
+      errno = EIO;
+      return -1;
+   }
+   return count;
+}
+
+int tpmfront_posix_read(int fd, uint8_t* buf, size_t count)
+{
+   int rc;
+   uint8_t* dummybuf;
+   size_t dummysz;
+   struct tpmfront_dev* dev;
+
+   dev = files[fd].tpmfront.dev;
+
+   if(count == 0) {
+      return 0;
+   }
+
+   /* get the response if we haven't already */
+   if(files[dev->fd].tpmfront.respgot == 0) {
+      if ((rc = tpmfront_recv(dev, &dummybuf, &dummysz)) != 0) {
+	 errno = EIO;
+	 return -1;
+      }
+   }
+
+   /* handle EOF case */
+   if(files[dev->fd].tpmfront.offset >= dev->resplen) {
+      return 0;
+   }
+
+   /* Compute the number of bytes and do the copy operation */
+   if((rc = min(count, dev->resplen - files[dev->fd].tpmfront.offset)) != 0) {
+      memcpy(buf, dev->respbuf + files[dev->fd].tpmfront.offset, rc);
+      files[dev->fd].tpmfront.offset += rc;
+   }
+
+   return rc;
+}
+
+int tpmfront_posix_fstat(int fd, struct stat* buf)
+{
+   uint8_t* dummybuf;
+   size_t dummysz;
+   int rc;
+   struct tpmfront_dev* dev = files[fd].tpmfront.dev;
+
+   /* If we have a response waiting, then read it now from the backend
+    * so we can get its length*/
+   if(dev->waiting || (files[dev->fd].read == 1 && !files[dev->fd].tpmfront.respgot)) {
+      if ((rc = tpmfront_recv(dev, &dummybuf, &dummysz)) != 0) {
+	 errno = EIO;
+	 return -1;
+      }
+   }
+
+   buf->st_mode = O_RDWR;
+   buf->st_uid = 0;
+   buf->st_gid = 0;
+   buf->st_size = dev->resplen;
+   buf->st_atime = buf->st_mtime = buf->st_ctime = time(NULL);
+
+   return 0;
+}
+
+
+#endif

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 16:22:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 16: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 1TYJFj-0004GD-6d; Tue, 13 Nov 2012 16:22:19 +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 1TYJFg-0004Dp-Tm
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:17 +0000
Received: from [85.158.137.99:24206] by server-14.bemta-3.messagelabs.com id
	19/66-12788-8B372A05; Tue, 13 Nov 2012 16:22:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-217.messagelabs.com!1352823730!18827904!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19355 invoked from network); 13 Nov 2012 16:22:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Nov 2012 16:22: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 1TYJFa-00037o-Dv
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYJFa-0006i5-9t
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:10 +0000
Message-Id: <E1TYJFa-0006i5-9t@xenbits.xen.org>
Date: Tue, 13 Nov 2012 16:22:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] minios: add tpmfront, tpm_tis,
	and tpmback drivers
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1352803618 0
# Node ID 34d52300f5d22102d38e8d18067671f0b7ef656e
# Parent  3015f8c6174b579ee62ff01cfa177ca33d6dd531
minios: add tpmfront, tpm_tis, and tpmback drivers

This patch adds 3 new drivers to mini-os.

tpmfront - paravirtualized tpm frontend driver
tpmback - paravirtualized tpm backend driver
tpm_tis - hardware tpm driver

Unfortunately these drivers were derived from GPL
licensed linux kernel drivers so they must carry
the GPL license. However, since mini-os now
supports conditional compilation, hopefully these
drivers can be included into the xen tree and
conditionally removed from non-gpl projects.
By default they are disabled in the makefile.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 3015f8c6174b -r 34d52300f5d2 extras/mini-os/Makefile
--- a/extras/mini-os/Makefile	Tue Nov 13 10:46:57 2012 +0000
+++ b/extras/mini-os/Makefile	Tue Nov 13 10:46:58 2012 +0000
@@ -22,6 +22,9 @@ CONFIG_QEMU_XS_ARGS ?= n
 CONFIG_TEST ?= n
 CONFIG_PCIFRONT ?= n
 CONFIG_BLKFRONT ?= y
+CONFIG_TPMFRONT ?= n
+CONFIG_TPM_TIS ?= n
+CONFIG_TPMBACK ?= n
 CONFIG_NETFRONT ?= y
 CONFIG_FBFRONT ?= y
 CONFIG_KBDFRONT ?= y
@@ -36,6 +39,9 @@ flags-$(CONFIG_SPARSE_BSS) += -DCONFIG_S
 flags-$(CONFIG_QEMU_XS_ARGS) += -DCONFIG_QEMU_XS_ARGS
 flags-$(CONFIG_PCIFRONT) += -DCONFIG_PCIFRONT
 flags-$(CONFIG_BLKFRONT) += -DCONFIG_BLKFRONT
+flags-$(CONFIG_TPMFRONT) += -DCONFIG_TPMFRONT
+flags-$(CONFIG_TPM_TIS) += -DCONFIG_TPM_TIS
+flags-$(CONFIG_TPMBACK) += -DCONFIG_TPMBACK
 flags-$(CONFIG_NETFRONT) += -DCONFIG_NETFRONT
 flags-$(CONFIG_KBDFRONT) += -DCONFIG_KBDFRONT
 flags-$(CONFIG_FBFRONT) += -DCONFIG_FBFRONT
@@ -67,6 +73,9 @@ TARGET := mini-os
 SUBDIRS := lib xenbus console
 
 src-$(CONFIG_BLKFRONT) += blkfront.c
+src-$(CONFIG_TPMFRONT) += tpmfront.c
+src-$(CONFIG_TPM_TIS) += tpm_tis.c
+src-$(CONFIG_TPMBACK) += tpmback.c
 src-y += daytime.c
 src-y += events.c
 src-$(CONFIG_FBFRONT) += fbfront.c
diff -r 3015f8c6174b -r 34d52300f5d2 extras/mini-os/include/lib.h
--- a/extras/mini-os/include/lib.h	Tue Nov 13 10:46:57 2012 +0000
+++ b/extras/mini-os/include/lib.h	Tue Nov 13 10:46:58 2012 +0000
@@ -142,6 +142,8 @@ enum fd_type {
     FTYPE_FB,
     FTYPE_MEM,
     FTYPE_SAVEFILE,
+    FTYPE_TPMFRONT,
+    FTYPE_TPM_TIS,
 };
 
 LIST_HEAD(evtchn_port_list, evtchn_port_info);
@@ -185,6 +187,20 @@ extern struct file {
 	struct {
 	    struct consfront_dev *dev;
 	} cons;
+#ifdef CONFIG_TPMFRONT
+	struct {
+	   struct tpmfront_dev *dev;
+	   int respgot;
+	   off_t offset;
+	} tpmfront;
+#endif
+#ifdef CONFIG_TPM_TIS
+	struct {
+	   struct tpm_chip *dev;
+	   int respgot;
+	   off_t offset;
+	} tpm_tis;
+#endif
 #ifdef CONFIG_XENBUS
         struct {
             /* To each xenbus FD is associated a queue of watch events for this
diff -r 3015f8c6174b -r 34d52300f5d2 extras/mini-os/include/tpm_tis.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/include/tpm_tis.h	Tue Nov 13 10:46:58 2012 +0000
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2010-2012 United States Government, as represented by
+ * the Secretary of Defense.  All rights reserved.
+ *
+ * This code has been derived from drivers/char/tpm.c
+ * from the linux kernel
+ *
+ * Copyright (C) 2004 IBM Corporation
+ *
+ * This code has also been derived from drivers/char/tpm/tpm_tis.c
+ * from the linux kernel
+ *
+ * Copyright (C) 2005, 2006 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, version 2
+ * of the License
+ */
+#ifndef TPM_TIS_H
+#define TPM_TIS_H
+
+#include <mini-os/types.h>
+#include <mini-os/byteorder.h>
+
+#define TPM_TIS_EN_LOCL0 1
+#define TPM_TIS_EN_LOCL1 (1 << 1)
+#define TPM_TIS_EN_LOCL2 (1 << 2)
+#define TPM_TIS_EN_LOCL3 (1 << 3)
+#define TPM_TIS_EN_LOCL4 (1 << 4)
+#define TPM_TIS_EN_LOCLALL (TPM_TIS_EN_LOCL0 | TPM_TIS_EN_LOCL1  | TPM_TIS_EN_LOCL2 | TPM_TIS_EN_LOCL3 | TPM_TIS_EN_LOCL4)
+#define TPM_TIS_LOCL_INT_TO_FLAG(x) (1 << x)
+#define TPM_BASEADDR 0xFED40000
+#define TPM_PROBE_IRQ 0xFFFF
+
+struct tpm_chip;
+
+struct tpm_chip* init_tpm_tis(unsigned long baseaddr, int localities, unsigned int irq);
+void shutdown_tpm_tis(struct tpm_chip* tpm);
+
+int tpm_tis_request_locality(struct tpm_chip* tpm, int locality);
+int tpm_tis_cmd(struct tpm_chip* tpm, uint8_t* req, size_t reqlen, uint8_t** resp, size_t* resplen);
+
+#ifdef HAVE_LIBC
+#include <sys/stat.h>
+#include <fcntl.h>
+/* POSIX IO functions:
+ * use tpm_tis_open() to get a file descriptor to the tpm device
+ * use write() on the fd to send a command to the backend. You must
+ * include the entire command in a single call to write().
+ * use read() on the fd to read the response. You can use
+ * fstat() to get the size of the response and lseek() to seek on it.
+ */
+int tpm_tis_open(struct tpm_chip* tpm);
+int tpm_tis_posix_read(int fd, uint8_t* buf, size_t count);
+int tpm_tis_posix_write(int fd, const uint8_t* buf, size_t count);
+int tpm_tis_posix_fstat(int fd, struct stat* buf);
+#endif
+
+#endif
diff -r 3015f8c6174b -r 34d52300f5d2 extras/mini-os/include/tpmback.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/include/tpmback.h	Tue Nov 13 10:46:58 2012 +0000
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2010-2012 United States Government, as represented by
+ * the Secretary of Defense.  All rights reserved.
+ *
+ * This code has been derived from drivers/xen/tpmback/tpmback.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (c) 2005, IBM Corporation
+ *
+ * which was itself derived from drivers/xen/netback/netback.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (c) 2002-2004, K A Fraser
+ *
+ * This code has also been derived from drivers/xen/tpmback/xenbus.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (C) 2005 IBM Corporation
+ * Copyright (C) 2005 Rusty Russell <rusty@rustcorp.com.au>
+ *
+ * This code has also been derived from drivers/xen/tpmback/interface.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (c) 2005, IBM Corporation
+ *
+ * which was itself also derived from drvivers/xen/netback/interface.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (c) 2004, Keir Fraser
+ *
+ * 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, version 2
+ * of the License
+ */
+
+#include <xen/io/tpmif.h>
+#include <xen/io/xenbus.h>
+#include <mini-os/types.h>
+#include <xen/xen.h>
+#ifndef TPMBACK_H
+#define TPMBACK_H
+
+struct tpmcmd {
+   domid_t domid;		/* Domid of the frontend */
+   unsigned int handle;	/* Handle of the frontend */
+   unsigned char uuid[16];			/* uuid of the tpm interface */
+
+   unsigned int req_len;		/* Size of the command in buf - set by tpmback driver */
+   uint8_t* req;			/* tpm command bits, allocated by driver, DON'T FREE IT */
+   unsigned int resp_len;	/* Size of the outgoing command,
+				   you set this before passing the cmd object to tpmback_resp */
+   uint8_t* resp;		/* Buffer for response - YOU MUST ALLOCATE IT, YOU MUST ALSO FREE IT */
+};
+typedef struct tpmcmd tpmcmd_t;
+
+/* Initialize the tpm backend driver */
+void init_tpmback(void);
+
+/* Shutdown tpm backend driver */
+void shutdown_tpmback(void);
+
+/* Blocks until a tpm command is sent from any front end.
+ * Returns a pointer to the tpm command to handle.
+ * Do not try to free this pointer or the req buffer
+ * This function will return NULL if the tpm backend driver
+ * is shutdown or any other error occurs */
+tpmcmd_t* tpmback_req_any(void);
+
+/* Blocks until a tpm command from the frontend at domid/handle
+ * is sent.
+ * Returns NULL if domid/handle is not connected, tpmback is
+ * shutdown or shutting down, or if there is an error
+ */
+tpmcmd_t* tpmback_req(domid_t domid, unsigned int handle);
+
+/* Send the response to the tpm command back to the frontend
+ * This function will free the tpmcmd object, but you must free the resp
+ * buffer yourself */
+void tpmback_resp(tpmcmd_t* tpmcmd);
+
+/* Waits for the first frontend to connect and then sets domid and handle appropriately.
+ * If one or more frontends are already connected, this will set domid and handle to one
+ * of them arbitrarily. The main use for this function is to wait until a single
+ * frontend connection has occured.
+ * returns 0 on success, non-zero on failure */
+int tpmback_wait_for_frontend_connect(domid_t *domid, unsigned int *handle);
+
+/* returns the number of frontends connected */
+int tpmback_num_frontends(void);
+
+/* Returns the uuid of the specified frontend, NULL on error.
+ * The return value is internally allocated, so don't free it */
+unsigned char* tpmback_get_uuid(domid_t domid, unsigned int handle);
+
+/* Specify a function to call when a new tpm device connects */
+void tpmback_set_open_callback(void (*cb)(domid_t, unsigned int));
+
+/* Specify a function to call when a tpm device disconnects */
+void tpmback_set_close_callback(void (*cb)(domid_t, unsigned int));
+
+//Not Implemented
+void tpmback_set_suspend_callback(void (*cb)(domid_t, unsigned int));
+void tpmback_set_resume_callback(void (*cb)(domid_t, unsigned int));
+
+#endif
diff -r 3015f8c6174b -r 34d52300f5d2 extras/mini-os/include/tpmfront.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/include/tpmfront.h	Tue Nov 13 10:46:58 2012 +0000
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2010-2012 United States Government, as represented by
+ * the Secretary of Defense.  All rights reserved.
+ *
+ * This code has been derived from drivers/char/tpm_vtpm.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (C) 2006 IBM Corporation
+ *
+ * This code has also been derived from drivers/char/tpm_xen.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (c) 2005, IBM Corporation
+ *
+ * which was itself derived from drivers/xen/netfront/netfront.c
+ * from the linux kernel
+ *
+ * Copyright (c) 2002-2004, K A Fraser
+ *
+ * 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, version 2 of the
+ * License.
+ */
+#ifndef TPMFRONT_H
+#define TPMFRONT_H
+
+#include <mini-os/types.h>
+#include <mini-os/os.h>
+#include <mini-os/events.h>
+#include <mini-os/wait.h>
+#include <xen/xen.h>
+#include <xen/io/xenbus.h>
+#include <xen/io/tpmif.h>
+
+struct tpmfront_dev {
+   grant_ref_t ring_ref;
+   evtchn_port_t evtchn;
+
+   tpmif_tx_interface_t* tx;
+
+   void** pages;
+
+   domid_t bedomid;
+   char* nodename;
+   char* bepath;
+
+   XenbusState state;
+
+   uint8_t waiting;
+   struct wait_queue_head waitq;
+
+   uint8_t* respbuf;
+   size_t resplen;
+
+#ifdef HAVE_LIBC
+   int fd;
+#endif
+
+};
+
+
+/*Initialize frontend */
+struct tpmfront_dev* init_tpmfront(const char* nodename);
+/*Shutdown frontend */
+void shutdown_tpmfront(struct tpmfront_dev* dev);
+
+/* Send a tpm command to the backend and wait for the response
+ *
+ * @dev - frontend device
+ * @req - request buffer
+ * @reqlen - length of request buffer
+ * @resp - *resp will be set to internal response buffer, don't free it! Value is undefined on error
+ * @resplen - *resplen will be set to the length of the response. Value is undefined on error
+ *
+ * returns 0 on success, non zero on failure.
+ * */
+int tpmfront_cmd(struct tpmfront_dev* dev, uint8_t* req, size_t reqlen, uint8_t** resp, size_t* resplen);
+
+#ifdef HAVE_LIBC
+#include <sys/stat.h>
+/* POSIX IO functions:
+ * use tpmfront_open() to get a file descriptor to the tpm device
+ * use write() on the fd to send a command to the backend. You must
+ * include the entire command in a single call to write().
+ * use read() on the fd to read the response. You can use
+ * fstat() to get the size of the response and lseek() to seek on it.
+ */
+int tpmfront_open(struct tpmfront_dev* dev);
+int tpmfront_posix_read(int fd, uint8_t* buf, size_t count);
+int tpmfront_posix_write(int fd, const uint8_t* buf, size_t count);
+int tpmfront_posix_fstat(int fd, struct stat* buf);
+#endif
+
+
+#endif
diff -r 3015f8c6174b -r 34d52300f5d2 extras/mini-os/lib/sys.c
--- a/extras/mini-os/lib/sys.c	Tue Nov 13 10:46:57 2012 +0000
+++ b/extras/mini-os/lib/sys.c	Tue Nov 13 10:46:58 2012 +0000
@@ -27,6 +27,8 @@
 #include <netfront.h>
 #include <blkfront.h>
 #include <fbfront.h>
+#include <tpmfront.h>
+#include <tpm_tis.h>
 #include <xenbus.h>
 #include <xenstore.h>
 
@@ -294,6 +296,16 @@ int read(int fd, void *buf, size_t nbyte
 	    return blkfront_posix_read(fd, buf, nbytes);
         }
 #endif
+#ifdef CONFIG_TPMFRONT
+        case FTYPE_TPMFRONT: {
+	    return tpmfront_posix_read(fd, buf, nbytes);
+        }
+#endif
+#ifdef CONFIG_TPM_TIS
+        case FTYPE_TPM_TIS: {
+	    return tpm_tis_posix_read(fd, buf, nbytes);
+        }
+#endif
 	default:
 	    break;
     }
@@ -330,6 +342,14 @@ int write(int fd, const void *buf, size_
 	case FTYPE_BLK:
 	    return blkfront_posix_write(fd, buf, nbytes);
 #endif
+#ifdef CONFIG_TPMFRONT
+	case FTYPE_TPMFRONT:
+	    return tpmfront_posix_write(fd, buf, nbytes);
+#endif
+#ifdef CONFIG_TPM_TIS
+	case FTYPE_TPM_TIS:
+	    return tpm_tis_posix_write(fd, buf, nbytes);
+#endif
 	default:
 	    break;
     }
@@ -341,8 +361,16 @@ int write(int fd, const void *buf, size_
 off_t lseek(int fd, off_t offset, int whence)
 {
     switch(files[fd].type) {
+#if defined(CONFIG_BLKFRONT) || defined(CONFIG_TPMFRONT) || defined(CONFIG_TPM_TIS)
 #ifdef CONFIG_BLKFRONT
        case FTYPE_BLK:
+#endif
+#ifdef CONFIG_TPMFRNT
+       case FTYPE_TPMFRONT:
+#endif
+#ifdef CONFIG_TPM_TIS
+       case FTYPE_TPM_TIS:
+#endif
 	  switch (whence) {
 	     case SEEK_SET:
 		files[fd].file.offset = offset;
@@ -420,6 +448,18 @@ int close(int fd)
 	    files[fd].type = FTYPE_NONE;
 	    return 0;
 #endif
+#ifdef CONFIG_TPMFRONT
+	case FTYPE_TPMFRONT:
+            shutdown_tpmfront(files[fd].tpmfront.dev);
+	    files[fd].type = FTYPE_NONE;
+	    return 0;
+#endif
+#ifdef CONFIG_TPM_TIS
+	case FTYPE_TPM_TIS:
+            shutdown_tpm_tis(files[fd].tpm_tis.dev);
+	    files[fd].type = FTYPE_NONE;
+	    return 0;
+#endif
 #ifdef CONFIG_KBDFRONT
 	case FTYPE_KBD:
             shutdown_kbdfront(files[fd].kbd.dev);
@@ -489,6 +529,14 @@ int fstat(int fd, struct stat *buf)
 	case FTYPE_BLK:
 	   return blkfront_posix_fstat(fd, buf);
 #endif
+#ifdef CONFIG_TPMFRONT
+	case FTYPE_TPMFRONT:
+	   return tpmfront_posix_fstat(fd, buf);
+#endif
+#ifdef CONFIG_TPM_TIS
+	case FTYPE_TPM_TIS:
+	   return tpm_tis_posix_fstat(fd, buf);
+#endif
 	default:
 	    break;
     }
diff -r 3015f8c6174b -r 34d52300f5d2 extras/mini-os/tpm_tis.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/tpm_tis.c	Tue Nov 13 10:46:58 2012 +0000
@@ -0,0 +1,1354 @@
+/*
+ * Copyright (c) 2010-2012 United States Government, as represented by
+ * the Secretary of Defense.  All rights reserved.
+ *
+ * This code has been derived from drivers/char/tpm.c
+ * from the linux kernel
+ *
+ * Copyright (C) 2004 IBM Corporation
+ *
+ * This code has also been derived from drivers/char/tpm/tpm_tis.c
+ * from the linux kernel
+ *
+ * Copyright (C) 2005, 2006 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, version 2
+ * of the License
+ */
+#include <mini-os/ioremap.h>
+#include <mini-os/iorw.h>
+#include <mini-os/tpm_tis.h>
+#include <mini-os/os.h>
+#include <mini-os/sched.h>
+#include <mini-os/byteorder.h>
+#include <mini-os/events.h>
+#include <mini-os/wait.h>
+#include <mini-os/xmalloc.h>
+#include <errno.h>
+#include <stdbool.h>
+
+#ifndef min
+	#define min( a, b ) ( ((a) < (b)) ? (a) : (b) )
+#endif
+
+#define TPM_HEADER_SIZE 10
+
+#define TPM_BUFSIZE 2048
+
+struct tpm_input_header {
+        uint16_t  tag;
+        uint32_t  length;
+        uint32_t  ordinal;
+}__attribute__((packed));
+
+struct tpm_output_header {
+        uint16_t  tag;
+        uint32_t  length;
+        uint32_t  return_code;
+}__attribute__((packed));
+
+struct  stclear_flags_t {
+        uint16_t  tag;
+        uint8_t      deactivated;
+        uint8_t      disableForceClear;
+        uint8_t      physicalPresence;
+        uint8_t      physicalPresenceLock;
+        uint8_t      bGlobalLock;
+}__attribute__((packed));
+
+struct  tpm_version_t {
+        uint8_t      Major;
+        uint8_t      Minor;
+        uint8_t      revMajor;
+        uint8_t      revMinor;
+}__attribute__((packed));
+
+struct  tpm_version_1_2_t {
+        uint16_t  tag;
+        uint8_t      Major;
+        uint8_t      Minor;
+        uint8_t      revMajor;
+        uint8_t      revMinor;
+}__attribute__((packed));
+
+struct  timeout_t {
+        uint32_t  a;
+        uint32_t  b;
+        uint32_t  c;
+        uint32_t  d;
+}__attribute__((packed));
+
+struct duration_t {
+        uint32_t  tpm_short;
+        uint32_t  tpm_medium;
+        uint32_t  tpm_long;
+}__attribute__((packed));
+
+struct permanent_flags_t {
+        uint16_t  tag;
+        uint8_t      disable;
+        uint8_t      ownership;
+        uint8_t      deactivated;
+        uint8_t      readPubek;
+        uint8_t      disableOwnerClear;
+        uint8_t      allowMaintenance;
+        uint8_t      physicalPresenceLifetimeLock;
+        uint8_t      physicalPresenceHWEnable;
+        uint8_t      physicalPresenceCMDEnable;
+        uint8_t      CEKPUsed;
+        uint8_t      TPMpost;
+        uint8_t      TPMpostLock;
+        uint8_t      FIPS;
+        uint8_t      operator;
+        uint8_t      enableRevokeEK;
+        uint8_t      nvLocked;
+        uint8_t      readSRKPub;
+        uint8_t      tpmEstablished;
+        uint8_t      maintenanceDone;
+        uint8_t      disableFullDALogicInfo;
+}__attribute__((packed));
+
+typedef union {
+        struct  permanent_flags_t perm_flags;
+        struct  stclear_flags_t stclear_flags;
+        bool    owned;
+        uint32_t  num_pcrs;
+        struct  tpm_version_t   tpm_version;
+        struct  tpm_version_1_2_t tpm_version_1_2;
+        uint32_t  manufacturer_id;
+        struct timeout_t  timeout;
+        struct duration_t duration;
+} cap_t;
+
+struct  tpm_getcap_params_in {
+        uint32_t  cap;
+        uint32_t  subcap_size;
+        uint32_t  subcap;
+}__attribute__((packed));
+
+struct  tpm_getcap_params_out {
+        uint32_t  cap_size;
+        cap_t   cap;
+}__attribute__((packed));
+
+struct  tpm_readpubek_params_out {
+        uint8_t      algorithm[4];
+        uint8_t      encscheme[2];
+        uint8_t      sigscheme[2];
+        uint32_t  paramsize;
+        uint8_t      parameters[12]; /*assuming RSA*/
+        uint32_t  keysize;
+        uint8_t      modulus[256];
+        uint8_t      checksum[20];
+}__attribute__((packed));
+
+typedef union {
+        struct  tpm_input_header in;
+        struct  tpm_output_header out;
+} tpm_cmd_header;
+
+#define TPM_DIGEST_SIZE 20
+struct tpm_pcrread_out {
+        uint8_t      pcr_result[TPM_DIGEST_SIZE];
+}__attribute__((packed));
+
+struct tpm_pcrread_in {
+        uint32_t  pcr_idx;
+}__attribute__((packed));
+
+struct tpm_pcrextend_in {
+        uint32_t  pcr_idx;
+        uint8_t      hash[TPM_DIGEST_SIZE];
+}__attribute__((packed));
+
+typedef union {
+        struct  tpm_getcap_params_out getcap_out;
+        struct  tpm_readpubek_params_out readpubek_out;
+        uint8_t      readpubek_out_buffer[sizeof(struct tpm_readpubek_params_out)];
+        struct  tpm_getcap_params_in getcap_in;
+        struct  tpm_pcrread_in  pcrread_in;
+        struct  tpm_pcrread_out pcrread_out;
+        struct  tpm_pcrextend_in pcrextend_in;
+} tpm_cmd_params;
+
+struct tpm_cmd_t {
+        tpm_cmd_header  header;
+        tpm_cmd_params  params;
+}__attribute__((packed));
+
+
+enum tpm_duration {
+   TPM_SHORT = 0,
+   TPM_MEDIUM = 1,
+   TPM_LONG = 2,
+   TPM_UNDEFINED,
+};
+
+#define TPM_MAX_ORDINAL 243
+#define TPM_MAX_PROTECTED_ORDINAL 12
+#define TPM_PROTECTED_ORDINAL_MASK 0xFF
+
+extern const uint8_t tpm_protected_ordinal_duration[TPM_MAX_PROTECTED_ORDINAL];
+extern const uint8_t tpm_ordinal_duration[TPM_MAX_ORDINAL];
+
+#define TPM_DIGEST_SIZE 20
+#define TPM_ERROR_SIZE 10
+#define TPM_RET_CODE_IDX 6
+
+/* tpm_capabilities */
+#define TPM_CAP_FLAG cpu_to_be32(4)
+#define TPM_CAP_PROP cpu_to_be32(5)
+#define CAP_VERSION_1_1 cpu_to_be32(0x06)
+#define CAP_VERSION_1_2 cpu_to_be32(0x1A)
+
+/* tpm_sub_capabilities */
+#define TPM_CAP_PROP_PCR cpu_to_be32(0x101)
+#define TPM_CAP_PROP_MANUFACTURER cpu_to_be32(0x103)
+#define TPM_CAP_FLAG_PERM cpu_to_be32(0x108)
+#define TPM_CAP_FLAG_VOL cpu_to_be32(0x109)
+#define TPM_CAP_PROP_OWNER cpu_to_be32(0x111)
+#define TPM_CAP_PROP_TIS_TIMEOUT cpu_to_be32(0x115)
+#define TPM_CAP_PROP_TIS_DURATION cpu_to_be32(0x120)
+
+
+#define TPM_INTERNAL_RESULT_SIZE 200
+#define TPM_TAG_RQU_COMMAND cpu_to_be16(193)
+#define TPM_ORD_GET_CAP cpu_to_be32(101)
+
+extern const struct tpm_input_header tpm_getcap_header;
+
+
+
+const uint8_t tpm_protected_ordinal_duration[TPM_MAX_PROTECTED_ORDINAL] = {
+   TPM_UNDEFINED,          /* 0 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,          /* 5 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,              /* 10 */
+   TPM_SHORT,
+};
+
+const uint8_t tpm_ordinal_duration[TPM_MAX_ORDINAL] = {
+   TPM_UNDEFINED,          /* 0 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,          /* 5 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,              /* 10 */
+   TPM_SHORT,
+   TPM_MEDIUM,
+   TPM_LONG,
+   TPM_LONG,
+   TPM_MEDIUM,             /* 15 */
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_MEDIUM,
+   TPM_LONG,
+   TPM_SHORT,              /* 20 */
+   TPM_SHORT,
+   TPM_MEDIUM,
+   TPM_MEDIUM,
+   TPM_MEDIUM,
+   TPM_SHORT,              /* 25 */
+   TPM_SHORT,
+   TPM_MEDIUM,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_MEDIUM,             /* 30 */
+   TPM_LONG,
+   TPM_MEDIUM,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,              /* 35 */
+   TPM_MEDIUM,
+   TPM_MEDIUM,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_MEDIUM,             /* 40 */
+   TPM_LONG,
+   TPM_MEDIUM,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,              /* 45 */
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_LONG,
+   TPM_MEDIUM,             /* 50 */
+   TPM_MEDIUM,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,          /* 55 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_MEDIUM,             /* 60 */
+   TPM_MEDIUM,
+   TPM_MEDIUM,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_MEDIUM,             /* 65 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,              /* 70 */
+   TPM_SHORT,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,          /* 75 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_LONG,               /* 80 */
+   TPM_UNDEFINED,
+   TPM_MEDIUM,
+   TPM_LONG,
+   TPM_SHORT,
+   TPM_UNDEFINED,          /* 85 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,              /* 90 */
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_UNDEFINED,          /* 95 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_MEDIUM,             /* 100 */
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,          /* 105 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,              /* 110 */
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,              /* 115 */
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_LONG,               /* 120 */
+   TPM_LONG,
+   TPM_MEDIUM,
+   TPM_UNDEFINED,
+   TPM_SHORT,
+   TPM_SHORT,              /* 125 */
+   TPM_SHORT,
+   TPM_LONG,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,              /* 130 */
+   TPM_MEDIUM,
+   TPM_UNDEFINED,
+   TPM_SHORT,
+   TPM_MEDIUM,
+   TPM_UNDEFINED,          /* 135 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,              /* 140 */
+   TPM_SHORT,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,          /* 145 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,              /* 150 */
+   TPM_MEDIUM,
+   TPM_MEDIUM,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_UNDEFINED,          /* 155 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,              /* 160 */
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,          /* 165 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_LONG,               /* 170 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,          /* 175 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_MEDIUM,             /* 180 */
+   TPM_SHORT,
+   TPM_MEDIUM,
+   TPM_MEDIUM,
+   TPM_MEDIUM,
+   TPM_MEDIUM,             /* 185 */
+   TPM_SHORT,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,          /* 190 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,          /* 195 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,              /* 200 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,
+   TPM_SHORT,              /* 205 */
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_MEDIUM,             /* 210 */
+   TPM_UNDEFINED,
+   TPM_MEDIUM,
+   TPM_MEDIUM,
+   TPM_MEDIUM,
+   TPM_UNDEFINED,          /* 215 */
+   TPM_MEDIUM,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,
+   TPM_SHORT,              /* 220 */
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_SHORT,
+   TPM_UNDEFINED,          /* 225 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,              /* 230 */
+   TPM_LONG,
+   TPM_MEDIUM,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,          /* 235 */
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_UNDEFINED,
+   TPM_SHORT,              /* 240 */
+   TPM_UNDEFINED,
+   TPM_MEDIUM,
+};
+
+const struct tpm_input_header tpm_getcap_header = {
+        .tag = TPM_TAG_RQU_COMMAND,
+        .length = cpu_to_be32(22),
+        .ordinal = TPM_ORD_GET_CAP
+};
+
+
+enum tis_access {
+   TPM_ACCESS_VALID = 0x80,
+   TPM_ACCESS_ACTIVE_LOCALITY = 0x20,	/* (R) */
+   TPM_ACCESS_RELINQUISH_LOCALITY = 0x20,/* (W) */
+   TPM_ACCESS_REQUEST_PENDING = 0x04,	/* (W) */
+   TPM_ACCESS_REQUEST_USE = 0x02,	/* (W) */
+};
+
+enum tis_status {
+   TPM_STS_VALID = 0x80,		/* (R) */
+   TPM_STS_COMMAND_READY = 0x40,	/* (R) */
+   TPM_STS_DATA_AVAIL = 0x10,		/* (R) */
+   TPM_STS_DATA_EXPECT = 0x08,		/* (R) */
+   TPM_STS_GO = 0x20,			/* (W) */
+};
+
+enum tis_int_flags {
+   TPM_GLOBAL_INT_ENABLE = 0x80000000,
+   TPM_INTF_BURST_COUNT_STATIC = 0x100,
+   TPM_INTF_CMD_READY_INT = 0x080,
+   TPM_INTF_INT_EDGE_FALLING = 0x040,
+   TPM_INTF_INT_EDGE_RISING = 0x020,
+   TPM_INTF_INT_LEVEL_LOW = 0x010,
+   TPM_INTF_INT_LEVEL_HIGH = 0x008,
+   TPM_INTF_LOCALITY_CHANGE_INT = 0x004,
+   TPM_INTF_STS_VALID_INT = 0x002,
+   TPM_INTF_DATA_AVAIL_INT = 0x001,
+};
+
+enum tis_defaults {
+   TIS_MEM_BASE = 0xFED40000,
+   TIS_MEM_LEN  = 0x5000,
+   TIS_SHORT_TIMEOUT = 750, /*ms*/
+   TIS_LONG_TIMEOUT = 2000, /*2 sec */
+};
+
+#define TPM_TIMEOUT 5
+
+#define TPM_ACCESS(t, l)                   (((uint8_t*)t->pages[l]) + 0x0000)
+#define TPM_INT_ENABLE(t, l)               ((uint32_t*)(((uint8_t*)t->pages[l]) + 0x0008))
+#define TPM_INT_VECTOR(t, l)               (((uint8_t*)t->pages[l]) + 0x000C)
+#define TPM_INT_STATUS(t, l)               (((uint8_t*)t->pages[l]) + 0x0010)
+#define TPM_INTF_CAPS(t, l)                ((uint32_t*)(((uint8_t*)t->pages[l]) + 0x0014))
+#define TPM_STS(t, l)                      ((uint8_t*)(((uint8_t*)t->pages[l]) + 0x0018))
+#define TPM_DATA_FIFO(t, l)                (((uint8_t*)t->pages[l]) + 0x0024)
+
+#define TPM_DID_VID(t, l)                  ((uint32_t*)(((uint8_t*)t->pages[l]) + 0x0F00))
+#define TPM_RID(t, l)                      (((uint8_t*)t->pages[l]) + 0x0F04)
+
+struct tpm_chip {
+   int enabled_localities;
+   int locality;
+   unsigned long baseaddr;
+   uint8_t* pages[5];
+   int did, vid, rid;
+
+   uint8_t data_buffer[TPM_BUFSIZE];
+   int data_len;
+
+   s_time_t timeout_a, timeout_b, timeout_c, timeout_d;
+   s_time_t duration[3];
+
+#ifdef HAVE_LIBC
+   int fd;
+#endif
+
+   unsigned int irq;
+   struct wait_queue_head read_queue;
+   struct wait_queue_head int_queue;
+};
+
+
+static void __init_tpm_chip(struct tpm_chip* tpm) {
+   tpm->enabled_localities = TPM_TIS_EN_LOCLALL;
+   tpm->locality = -1;
+   tpm->baseaddr = 0;
+   tpm->pages[0] = tpm->pages[1] = tpm->pages[2] = tpm->pages[3] = tpm->pages[4] = NULL;
+   tpm->vid = 0;
+   tpm->did = 0;
+   tpm->irq = 0;
+   init_waitqueue_head(&tpm->read_queue);
+   init_waitqueue_head(&tpm->int_queue);
+
+   tpm->data_len = -1;
+
+#ifdef HAVE_LIBC
+   tpm->fd = -1;
+#endif
+}
+
+/*
+ * Returns max number of nsecs to wait
+ */
+s_time_t tpm_calc_ordinal_duration(struct tpm_chip *chip,
+      uint32_t ordinal)
+{
+   int duration_idx = TPM_UNDEFINED;
+   s_time_t duration = 0;
+
+   if (ordinal < TPM_MAX_ORDINAL)
+      duration_idx = tpm_ordinal_duration[ordinal];
+   else if ((ordinal & TPM_PROTECTED_ORDINAL_MASK) <
+	 TPM_MAX_PROTECTED_ORDINAL)
+      duration_idx =
+	 tpm_protected_ordinal_duration[ordinal &
+	 TPM_PROTECTED_ORDINAL_MASK];
+
+   if (duration_idx != TPM_UNDEFINED) {
+      duration = chip->duration[duration_idx];
+   }
+
+   if (duration <= 0) {
+      return SECONDS(120);
+   }
+   else
+   {
+      return duration;
+   }
+}
+
+
+static int locality_enabled(struct tpm_chip* tpm, int l) {
+   return tpm->enabled_localities & (1 << l);
+}
+
+static int check_locality(struct tpm_chip* tpm, int l) {
+   if(locality_enabled(tpm, l) && (ioread8(TPM_ACCESS(tpm, l)) &
+	    (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) ==
+	 (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) {
+      return l;
+   }
+   return -1;
+}
+
+void release_locality(struct tpm_chip* tpm, int l, int force)
+{
+   if (locality_enabled(tpm, l) && (force || (ioread8(TPM_ACCESS(tpm, l)) &
+	       (TPM_ACCESS_REQUEST_PENDING | TPM_ACCESS_VALID)) ==
+	    (TPM_ACCESS_REQUEST_PENDING | TPM_ACCESS_VALID))) {
+      iowrite8(TPM_ACCESS(tpm, l), TPM_ACCESS_RELINQUISH_LOCALITY);
+   }
+}
+
+int tpm_tis_request_locality(struct tpm_chip* tpm, int l) {
+
+   s_time_t stop;
+   /*Make sure locality is valid */
+   if(!locality_enabled(tpm, l)) {
+      printk("tpm_tis_change_locality() Tried to change to locality %d, but it is disabled or invalid!\n", l);
+      return -1;
+   }
+   /* Check if we already have the current locality */
+   if(check_locality(tpm, l) >= 0) {
+      return tpm->locality = l;
+   }
+   /* Set the new locality*/
+   iowrite8(TPM_ACCESS(tpm, l), TPM_ACCESS_REQUEST_USE);
+
+   if(tpm->irq) {
+      /* Wait for interrupt */
+      wait_event_deadline(tpm->int_queue, (check_locality(tpm, l) >= 0), NOW() + tpm->timeout_a);
+
+      /* FIXME: Handle timeout event, should return error in that case */
+      return l;
+   } else {
+      /* Wait for burstcount */
+      stop = NOW() + tpm->timeout_a;
+      do {
+	 if(check_locality(tpm, l) >= 0) {
+	    return tpm->locality = l;
+	 }
+	 msleep(TPM_TIMEOUT);
+      } while(NOW() < stop);
+   }
+
+   printk("REQ LOCALITY FAILURE\n");
+   return -1;
+}
+
+static uint8_t tpm_tis_status(struct tpm_chip* tpm) {
+   return ioread8(TPM_STS(tpm, tpm->locality));
+}
+
+/* This causes the current command to be aborted */
+static void tpm_tis_ready(struct tpm_chip* tpm) {
+   iowrite8(TPM_STS(tpm, tpm->locality), TPM_STS_COMMAND_READY);
+}
+#define tpm_tis_cancel_cmd(v) tpm_tis_ready(v)
+
+static int get_burstcount(struct tpm_chip* tpm) {
+   s_time_t stop;
+   int burstcnt;
+
+   stop = NOW() + tpm->timeout_d;
+   do {
+      burstcnt = ioread8((TPM_STS(tpm, tpm->locality) + 1));
+      burstcnt += ioread8(TPM_STS(tpm, tpm->locality) + 2) << 8;
+
+      if (burstcnt) {
+	 return burstcnt;
+      }
+      msleep(TPM_TIMEOUT);
+   } while(NOW() < stop);
+   return -EBUSY;
+}
+
+static int wait_for_stat(struct tpm_chip* tpm, uint8_t mask,
+      unsigned long timeout, struct wait_queue_head* queue) {
+   s_time_t stop;
+   uint8_t status;
+
+   status = tpm_tis_status(tpm);
+   if((status & mask) == mask) {
+      return 0;
+   }
+
+   if(tpm->irq) {
+      wait_event_deadline(*queue, ((tpm_tis_status(tpm) & mask) == mask), timeout);
+      /* FIXME: Check for timeout and return -ETIME */
+      return 0;
+   } else {
+      stop = NOW() + timeout;
+      do {
+	 msleep(TPM_TIMEOUT);
+	 status = tpm_tis_status(tpm);
+	 if((status & mask) == mask)
+	    return 0;
+      } while( NOW() < stop);
+   }
+   return -ETIME;
+}
+
+static int recv_data(struct tpm_chip* tpm, uint8_t* buf, size_t count) {
+   int size = 0;
+   int burstcnt;
+   while( size < count &&
+	 wait_for_stat(tpm,
+	    TPM_STS_DATA_AVAIL | TPM_STS_VALID,
+	    tpm->timeout_c,
+	    &tpm->read_queue)
+	 == 0) {
+      burstcnt = get_burstcount(tpm);
+      for(; burstcnt > 0 && size < count; --burstcnt)
+      {
+	 buf[size++] = ioread8(TPM_DATA_FIFO(tpm, tpm->locality));
+      }
+   }
+   return size;
+}
+
+int tpm_tis_recv(struct tpm_chip* tpm, uint8_t* buf, size_t count) {
+   int size = 0;
+   int expected, status;
+
+   if (count < TPM_HEADER_SIZE) {
+      size = -EIO;
+      goto out;
+   }
+
+   /* read first 10 bytes, including tag, paramsize, and result */
+   if((size =
+	    recv_data(tpm, buf, TPM_HEADER_SIZE)) < TPM_HEADER_SIZE) {
+      printk("Error reading tpm cmd header\n");
+      goto out;
+   }
+
+   expected = be32_to_cpu(*((uint32_t*)(buf + 2)));
+   if(expected > count) {
+      size = -EIO;
+      goto out;
+   }
+
+   if((size += recv_data(tpm, & buf[TPM_HEADER_SIZE],
+	       expected - TPM_HEADER_SIZE)) < expected) {
+      printk("Unable to read rest of tpm command size=%d expected=%d\n", size, expected);
+      size = -ETIME;
+      goto out;
+   }
+
+   wait_for_stat(tpm, TPM_STS_VALID, tpm->timeout_c, &tpm->int_queue);
+   status = tpm_tis_status(tpm);
+   if(status & TPM_STS_DATA_AVAIL) {
+      printk("Error: left over data\n");
+      size = -EIO;
+      goto out;
+   }
+
+out:
+   tpm_tis_ready(tpm);
+   release_locality(tpm, tpm->locality, 0);
+   return size;
+}
+int tpm_tis_send(struct tpm_chip* tpm, uint8_t* buf, size_t len) {
+   int rc;
+   int status, burstcnt = 0;
+   int count = 0;
+   uint32_t ordinal;
+
+   if(tpm_tis_request_locality(tpm, tpm->locality) < 0) {
+      return -EBUSY;
+   }
+
+   status = tpm_tis_status(tpm);
+   if((status & TPM_STS_COMMAND_READY) == 0) {
+      tpm_tis_ready(tpm);
+      if(wait_for_stat(tpm, TPM_STS_COMMAND_READY, tpm->timeout_b, &tpm->int_queue) < 0) {
+	 rc = -ETIME;
+	 goto out_err;
+      }
+   }
+
+   while(count < len - 1) {
+      burstcnt = get_burstcount(tpm);
+      for(;burstcnt > 0 && count < len -1; --burstcnt) {
+	 iowrite8(TPM_DATA_FIFO(tpm, tpm->locality), buf[count++]);
+      }
+
+      wait_for_stat(tpm, TPM_STS_VALID, tpm->timeout_c, &tpm->int_queue);
+      status = tpm_tis_status(tpm);
+      if((status & TPM_STS_DATA_EXPECT) == 0) {
+	 rc = -EIO;
+	 goto out_err;
+      }
+   }
+
+   /*Write last byte*/
+   iowrite8(TPM_DATA_FIFO(tpm, tpm->locality), buf[count]);
+   wait_for_stat(tpm, TPM_STS_VALID, tpm->timeout_c, &tpm->read_queue);
+   status = tpm_tis_status(tpm);
+   if((status & TPM_STS_DATA_EXPECT) != 0) {
+      rc = -EIO;
+      goto out_err;
+   }
+
+   /*go and do it*/
+   iowrite8(TPM_STS(tpm, tpm->locality), TPM_STS_GO);
+
+   if(tpm->irq) {
+      /*Wait for interrupt */
+      ordinal = be32_to_cpu(*(buf + 6));
+      if(wait_for_stat(tpm,
+	       TPM_STS_DATA_AVAIL | TPM_STS_VALID,
+	       tpm_calc_ordinal_duration(tpm, ordinal),
+	       &tpm->read_queue) < 0) {
+	 rc = -ETIME;
+	 goto out_err;
+      }
+   }
+#ifdef HAVE_LIBC
+   if(tpm->fd >= 0) {
+      files[tpm->fd].read = 0;
+      files[tpm->fd].tpm_tis.respgot = 0;
+      files[tpm->fd].tpm_tis.offset = 0;
+   }
+#endif
+   return len;
+
+out_err:
+   tpm_tis_ready(tpm);
+   release_locality(tpm, tpm->locality, 0);
+   return rc;
+}
+
+static void tpm_tis_irq_handler(evtchn_port_t port, struct pt_regs *regs, void* data)
+{
+   struct tpm_chip* tpm = data;
+   uint32_t interrupt;
+   int i;
+
+   interrupt = ioread32(TPM_INT_STATUS(tpm, tpm->locality));
+   if(interrupt == 0) {
+      return;
+   }
+
+   if(interrupt & TPM_INTF_DATA_AVAIL_INT) {
+      wake_up(&tpm->read_queue);
+   }
+   if(interrupt & TPM_INTF_LOCALITY_CHANGE_INT) {
+      for(i = 0; i < 5; ++i) {
+	 if(check_locality(tpm, i) >= 0) {
+	    break;
+	 }
+      }
+   }
+   if(interrupt & (TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_STS_VALID_INT |
+	    TPM_INTF_CMD_READY_INT)) {
+      wake_up(&tpm->int_queue);
+   }
+
+   /* Clear interrupts handled with TPM_EOI */
+   iowrite32(TPM_INT_STATUS(tpm, tpm->locality), interrupt);
+   ioread32(TPM_INT_STATUS(tpm, tpm->locality));
+   return;
+}
+
+/*
+ * Internal kernel interface to transmit TPM commands
+ */
+static ssize_t tpm_transmit(struct tpm_chip *chip, const uint8_t *buf,
+      size_t bufsiz)
+{
+   ssize_t rc;
+   uint32_t count, ordinal;
+   s_time_t stop;
+
+   count = be32_to_cpu(*((uint32_t *) (buf + 2)));
+   ordinal = be32_to_cpu(*((uint32_t *) (buf + 6)));
+   if (count == 0)
+      return -ENODATA;
+   if (count > bufsiz) {
+      printk("Error: invalid count value %x %zx \n", count, bufsiz);
+      return -E2BIG;
+   }
+
+   //down(&chip->tpm_mutex);
+
+   if ((rc = tpm_tis_send(chip, (uint8_t *) buf, count)) < 0) {
+      printk("tpm_transmit: tpm_send: error %ld\n", rc);
+      goto out;
+   }
+
+   if (chip->irq)
+      goto out_recv;
+
+   stop = NOW() + tpm_calc_ordinal_duration(chip, ordinal);
+   do {
+      uint8_t status = tpm_tis_status(chip);
+      if ((status & (TPM_STS_DATA_AVAIL | TPM_STS_VALID)) ==
+	    (TPM_STS_DATA_AVAIL | TPM_STS_VALID))
+	 goto out_recv;
+
+      if ((status == TPM_STS_COMMAND_READY)) {
+	 printk("TPM Error: Operation Canceled\n");
+	 rc = -ECANCELED;
+	 goto out;
+      }
+
+      msleep(TPM_TIMEOUT);    /* CHECK */
+      rmb();
+   } while (NOW() < stop);
+
+   /* Cancel the command */
+   tpm_tis_cancel_cmd(chip);
+   printk("TPM Operation Timed out\n");
+   rc = -ETIME;
+   goto out;
+
+out_recv:
+   if((rc = tpm_tis_recv(chip, (uint8_t *) buf, bufsiz)) < 0) {
+      printk("tpm_transmit: tpm_recv: error %d\n", rc);
+   }
+out:
+   //up(&chip->tpm_mutex);
+   return rc;
+}
+
+static ssize_t transmit_cmd(struct tpm_chip *chip, struct tpm_cmd_t *cmd,
+                            int len, const char *desc)
+{
+        int err;
+
+        len = tpm_transmit(chip,(uint8_t *) cmd, len);
+        if (len <  0)
+                return len;
+        if (len == TPM_ERROR_SIZE) {
+                err = be32_to_cpu(cmd->header.out.return_code);
+                printk("A TPM error (%d) occurred %s\n", err, desc);
+                return err;
+        }
+        return 0;
+}
+
+int tpm_get_timeouts(struct tpm_chip *chip)
+{
+   struct tpm_cmd_t tpm_cmd;
+   struct timeout_t *timeout_cap;
+   struct duration_t *duration_cap;
+   ssize_t rc;
+   uint32_t timeout;
+   unsigned int scale = 1;
+
+   tpm_cmd.header.in = tpm_getcap_header;
+   tpm_cmd.params.getcap_in.cap = TPM_CAP_PROP;
+   tpm_cmd.params.getcap_in.subcap_size = cpu_to_be32(4);
+   tpm_cmd.params.getcap_in.subcap = TPM_CAP_PROP_TIS_TIMEOUT;
+
+   if((rc = transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE,
+	 "attempting to determine the timeouts")) != 0) {
+      printk("transmit failed %d\n", rc);
+      goto duration;
+   }
+
+   if(be32_to_cpu(tpm_cmd.header.out.return_code) != 0 ||
+         be32_to_cpu(tpm_cmd.header.out.length) !=
+         sizeof(tpm_cmd.header.out) + sizeof(uint32_t) + 4 * sizeof(uint32_t)) {
+      return -EINVAL;
+   }
+
+   timeout_cap = &tpm_cmd.params.getcap_out.cap.timeout;
+   /* Don't overwrite default if value is 0 */
+   timeout = be32_to_cpu(timeout_cap->a);
+   if(timeout && timeout < 1000) {
+      /* timeouts in msc rather usec */
+      scale = 1000;
+   }
+   if (timeout)
+      chip->timeout_a = MICROSECS(timeout * scale); /*Convert to msec */
+   timeout = be32_to_cpu(timeout_cap->b);
+   if (timeout)
+      chip->timeout_b = MICROSECS(timeout * scale); /*Convert to msec */
+   timeout = be32_to_cpu(timeout_cap->c);
+   if (timeout)
+      chip->timeout_c = MICROSECS(timeout * scale); /*Convert to msec */
+   timeout = be32_to_cpu(timeout_cap->d);
+   if (timeout)
+      chip->timeout_d = MICROSECS(timeout * scale); /*Convert to msec */
+
+duration:
+   tpm_cmd.header.in = tpm_getcap_header;
+   tpm_cmd.params.getcap_in.cap = TPM_CAP_PROP;
+   tpm_cmd.params.getcap_in.subcap_size = cpu_to_be32(4);
+   tpm_cmd.params.getcap_in.subcap = TPM_CAP_PROP_TIS_DURATION;
+
+   if((rc = transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE,
+	 "attempting to determine the durations")) < 0) {
+      return rc;
+   }
+
+   if(be32_to_cpu(tpm_cmd.header.out.return_code) != 0 ||
+         be32_to_cpu(tpm_cmd.header.out.length) !=
+         sizeof(tpm_cmd.header.out) + sizeof(uint32_t) + 3 * sizeof(uint32_t)) {
+      return -EINVAL;
+   }
+
+   duration_cap = &tpm_cmd.params.getcap_out.cap.duration;
+   chip->duration[TPM_SHORT] = MICROSECS(be32_to_cpu(duration_cap->tpm_short));
+   chip->duration[TPM_MEDIUM] = MICROSECS(be32_to_cpu(duration_cap->tpm_medium));
+   chip->duration[TPM_LONG] = MICROSECS(be32_to_cpu(duration_cap->tpm_long));
+
+   /* The Broadcom BCM0102 chipset in a Dell Latitude D820 gets the above
+    * value wrong and apparently reports msecs rather than usecs. So we
+    * fix up the resulting too-small TPM_SHORT value to make things work.
+    */
+   if (chip->duration[TPM_SHORT] < MILLISECS(10)) {
+      chip->duration[TPM_SHORT] = SECONDS(1);
+      chip->duration[TPM_MEDIUM] *= 1000;
+      chip->duration[TPM_LONG] *= 1000;
+      printk("Adjusting TPM timeout parameters\n");
+   }
+
+   return 0;
+}
+
+
+
+void tpm_continue_selftest(struct tpm_chip* chip) {
+   uint8_t data[] = {
+      0, 193,                 /* TPM_TAG_RQU_COMMAND */
+      0, 0, 0, 10,            /* length */
+      0, 0, 0, 83,            /* TPM_ORD_GetCapability */
+   };
+
+   tpm_transmit(chip, data, sizeof(data));
+}
+
+ssize_t tpm_getcap(struct tpm_chip *chip, uint32_t subcap_id, cap_t *cap,
+                   const char *desc)
+{
+        struct tpm_cmd_t tpm_cmd;
+        int rc;
+
+        tpm_cmd.header.in = tpm_getcap_header;
+        if (subcap_id == CAP_VERSION_1_1 || subcap_id == CAP_VERSION_1_2) {
+                tpm_cmd.params.getcap_in.cap = subcap_id;
+                /*subcap field not necessary */
+                tpm_cmd.params.getcap_in.subcap_size = cpu_to_be32(0);
+                tpm_cmd.header.in.length -= cpu_to_be32(sizeof(uint32_t));
+        } else {
+                if (subcap_id == TPM_CAP_FLAG_PERM ||
+                    subcap_id == TPM_CAP_FLAG_VOL)
+                        tpm_cmd.params.getcap_in.cap = TPM_CAP_FLAG;
+                else
+                        tpm_cmd.params.getcap_in.cap = TPM_CAP_PROP;
+                tpm_cmd.params.getcap_in.subcap_size = cpu_to_be32(4);
+                tpm_cmd.params.getcap_in.subcap = subcap_id;
+        }
+        rc = transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE, desc);
+        if (!rc)
+                *cap = tpm_cmd.params.getcap_out.cap;
+        return rc;
+}
+
+
+struct tpm_chip* init_tpm_tis(unsigned long baseaddr, int localities, unsigned int irq)
+{
+   int i;
+   unsigned long addr;
+   struct tpm_chip* tpm = NULL;
+   uint32_t didvid;
+   uint32_t intfcaps;
+   uint32_t intmask;
+
+   printk("============= Init TPM TIS Driver ==============\n");
+
+   /*Sanity check the localities input */
+   if(localities & ~TPM_TIS_EN_LOCLALL) {
+      printk("init_tpm_tis() Invalid locality specification! %X\n", localities);
+      goto abort_egress;
+   }
+
+   printk("IOMEM Machine Base Address: %lX\n", baseaddr);
+
+   /* Create the tpm data structure */
+   tpm = malloc(sizeof(struct tpm_chip));
+   __init_tpm_chip(tpm);
+
+   /* Set the enabled localities - if 0 we leave default as all enabled */
+   if(localities != 0) {
+      tpm->enabled_localities = localities;
+   }
+   printk("Enabled Localities: ");
+   for(i = 0; i < 5; ++i) {
+      if(locality_enabled(tpm, i)) {
+	 printk("%d ", i);
+      }
+   }
+   printk("\n");
+
+   /* Set the base machine address */
+   tpm->baseaddr = baseaddr;
+
+   /* Set default timeouts */
+   tpm->timeout_a = MILLISECS(TIS_SHORT_TIMEOUT);
+   tpm->timeout_b = MILLISECS(TIS_LONG_TIMEOUT);
+   tpm->timeout_c = MILLISECS(TIS_SHORT_TIMEOUT);
+   tpm->timeout_d = MILLISECS(TIS_SHORT_TIMEOUT);
+
+   /*Map the mmio pages */
+   addr = tpm->baseaddr;
+   for(i = 0; i < 5; ++i) {
+      if(locality_enabled(tpm, i)) {
+	 /* Map the page in now */
+	 if((tpm->pages[i] = ioremap_nocache(addr, PAGE_SIZE)) == NULL) {
+	    printk("Unable to map iomem page a address %p\n", addr);
+	    goto abort_egress;
+	 }
+
+	 /* Set default locality to the first enabled one */
+	 if (tpm->locality < 0) {
+	    if(tpm_tis_request_locality(tpm, i) < 0) {
+	       printk("Unable to request locality %d??\n", i);
+	       goto abort_egress;
+	    }
+	 }
+      }
+      addr += PAGE_SIZE;
+   }
+
+
+   /* Get the vendor and device ids */
+   didvid = ioread32(TPM_DID_VID(tpm, tpm->locality));
+   tpm->did = didvid >> 16;
+   tpm->vid = didvid & 0xFFFF;
+
+
+   /* Get the revision id */
+   tpm->rid = ioread8(TPM_RID(tpm, tpm->locality));
+
+   printk("1.2 TPM (device-id=0x%X vendor-id = %X rev-id = %X)\n", tpm->did, tpm->vid, tpm->rid);
+
+   intfcaps = ioread32(TPM_INTF_CAPS(tpm, tpm->locality));
+   printk("TPM interface capabilities (0x%x):\n", intfcaps);
+   if (intfcaps & TPM_INTF_BURST_COUNT_STATIC)
+      printk("\tBurst Count Static\n");
+   if (intfcaps & TPM_INTF_CMD_READY_INT)
+      printk("\tCommand Ready Int Support\n");
+   if (intfcaps & TPM_INTF_INT_EDGE_FALLING)
+      printk("\tInterrupt Edge Falling\n");
+   if (intfcaps & TPM_INTF_INT_EDGE_RISING)
+      printk("\tInterrupt Edge Rising\n");
+   if (intfcaps & TPM_INTF_INT_LEVEL_LOW)
+      printk("\tInterrupt Level Low\n");
+   if (intfcaps & TPM_INTF_INT_LEVEL_HIGH)
+      printk("\tInterrupt Level High\n");
+   if (intfcaps & TPM_INTF_LOCALITY_CHANGE_INT)
+      printk("\tLocality Change Int Support\n");
+   if (intfcaps & TPM_INTF_STS_VALID_INT)
+      printk("\tSts Valid Int Support\n");
+   if (intfcaps & TPM_INTF_DATA_AVAIL_INT)
+      printk("\tData Avail Int Support\n");
+
+   /*Interupt setup */
+   intmask = ioread32(TPM_INT_ENABLE(tpm, tpm->locality));
+
+   intmask |= TPM_INTF_CMD_READY_INT
+      | TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_DATA_AVAIL_INT
+      | TPM_INTF_STS_VALID_INT;
+
+   iowrite32(TPM_INT_ENABLE(tpm, tpm->locality), intmask);
+
+   /*If interupts are enabled, handle it */
+   if(irq) {
+      if(irq != TPM_PROBE_IRQ) {
+	 tpm->irq = irq;
+      } else {
+	 /*FIXME add irq probing feature later */
+	 printk("IRQ probing not implemented\n");
+      }
+   }
+
+   if(tpm->irq) {
+      iowrite8(TPM_INT_VECTOR(tpm, tpm->locality), tpm->irq);
+
+      if(bind_pirq(tpm->irq, 1, tpm_tis_irq_handler, tpm) != 0) {
+	 printk("Unabled to request irq: %u for use\n", tpm->irq);
+	 printk("Will use polling mode\n");
+	 tpm->irq = 0;
+      } else {
+	 /* Clear all existing */
+	 iowrite32(TPM_INT_STATUS(tpm, tpm->locality), ioread32(TPM_INT_STATUS(tpm, tpm->locality)));
+
+	 /* Turn on interrupts */
+	 iowrite32(TPM_INT_ENABLE(tpm, tpm->locality), intmask | TPM_GLOBAL_INT_ENABLE);
+      }
+   }
+
+   if(tpm_get_timeouts(tpm)) {
+      printk("Could not get TPM timeouts and durations\n");
+      goto abort_egress;
+   }
+   tpm_continue_selftest(tpm);
+
+
+   return tpm;
+abort_egress:
+   if(tpm != NULL) {
+      shutdown_tpm_tis(tpm);
+   }
+   return NULL;
+}
+
+void shutdown_tpm_tis(struct tpm_chip* tpm){
+   int i;
+
+   printk("Shutting down tpm_tis device\n");
+
+   iowrite32(TPM_INT_ENABLE(tpm, tpm->locality), ~TPM_GLOBAL_INT_ENABLE);
+
+   /*Unmap all of the mmio pages */
+   for(i = 0; i < 5; ++i) {
+      if(tpm->pages[i] != NULL) {
+	 iounmap(tpm->pages[i], PAGE_SIZE);
+	 tpm->pages[i] = NULL;
+      }
+   }
+   free(tpm);
+   return;
+}
+
+
+int tpm_tis_cmd(struct tpm_chip* tpm, uint8_t* req, size_t reqlen, uint8_t** resp, size_t* resplen)
+{
+   if(tpm->locality < 0) {
+      printk("tpm_tis_cmd() failed! locality not set!\n");
+      return -1;
+   }
+   if(reqlen > TPM_BUFSIZE) {
+      reqlen = TPM_BUFSIZE;
+   }
+   memcpy(tpm->data_buffer, req, reqlen);
+   *resplen = tpm_transmit(tpm, tpm->data_buffer, TPM_BUFSIZE);
+
+   *resp = malloc(*resplen);
+   memcpy(*resp, tpm->data_buffer, *resplen);
+   return 0;
+}
+
+#ifdef HAVE_LIBC
+int tpm_tis_open(struct tpm_chip* tpm)
+{
+   /* Silently prevent multiple opens */
+   if(tpm->fd != -1) {
+      return tpm->fd;
+   }
+
+   tpm->fd = alloc_fd(FTYPE_TPM_TIS);
+   printk("tpm_tis_open() -> %d\n", tpm->fd);
+   files[tpm->fd].tpm_tis.dev = tpm;
+   files[tpm->fd].tpm_tis.offset = 0;
+   files[tpm->fd].tpm_tis.respgot = 0;
+   return tpm->fd;
+}
+
+int tpm_tis_posix_write(int fd, const uint8_t* buf, size_t count)
+{
+   struct tpm_chip* tpm;
+   tpm = files[fd].tpm_tis.dev;
+
+   if(tpm->locality < 0) {
+      printk("tpm_tis_posix_write() failed! locality not set!\n");
+      errno = EINPROGRESS;
+      return -1;
+   }
+   if(count == 0) {
+      return 0;
+   }
+
+   /* Return an error if we are already processing a command */
+   if(count > TPM_BUFSIZE) {
+      count = TPM_BUFSIZE;
+   }
+   /* Send the command now */
+   memcpy(tpm->data_buffer, buf, count);
+   if((tpm->data_len = tpm_transmit(tpm, tpm->data_buffer, TPM_BUFSIZE)) < 0) {
+      errno = EIO;
+      return -1;
+   }
+   return count;
+}
+
+int tpm_tis_posix_read(int fd, uint8_t* buf, size_t count)
+{
+   int rc;
+   struct tpm_chip* tpm;
+   tpm = files[fd].tpm_tis.dev;
+
+   if(count == 0) {
+      return 0;
+   }
+
+   /* If there is no tpm resp to read, return EIO */
+   if(tpm->data_len < 0) {
+      errno = EIO;
+      return -1;
+   }
+
+
+   /* Handle EOF case */
+   if(files[fd].tpm_tis.offset >= tpm->data_len) {
+      rc = 0;
+   } else {
+      rc = min(tpm->data_len - files[fd].tpm_tis.offset, count);
+      memcpy(buf, tpm->data_buffer + files[fd].tpm_tis.offset, rc);
+   }
+   files[fd].tpm_tis.offset += rc;
+   /* Reset the data pending flag */
+   return rc;
+}
+int tpm_tis_posix_fstat(int fd, struct stat* buf)
+{
+   struct tpm_chip* tpm;
+   tpm = files[fd].tpm_tis.dev;
+
+   buf->st_mode = O_RDWR;
+   buf->st_uid = 0;
+   buf->st_gid = 0;
+   buf->st_size = be32_to_cpu(*((uint32_t*)(tpm->data_buffer + 2)));
+   buf->st_atime = buf->st_mtime = buf->st_ctime = time(NULL);
+   return 0;
+}
+
+
+#endif
diff -r 3015f8c6174b -r 34d52300f5d2 extras/mini-os/tpmback.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/tpmback.c	Tue Nov 13 10:46:58 2012 +0000
@@ -0,0 +1,1102 @@
+/*
+ * Copyright (c) 2010-2012 United States Government, as represented by
+ * the Secretary of Defense.  All rights reserved.
+ *
+ * This code has been derived from drivers/xen/tpmback/tpmback.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (c) 2005, IBM Corporation
+ *
+ * which was itself derived from drivers/xen/netback/netback.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (c) 2002-2004, K A Fraser
+ *
+ * This code has also been derived from drivers/xen/tpmback/xenbus.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (C) 2005 IBM Corporation
+ * Copyright (C) 2005 Rusty Russell <rusty@rustcorp.com.au>
+ *
+ * This code has also been derived from drivers/xen/tpmback/interface.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (c) 2005, IBM Corporation
+ *
+ * which was itself also derived from drvivers/xen/netback/interface.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (c) 2004, Keir Fraser
+ *
+ * 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, version 2
+ * of the License
+ */
+#include <mini-os/os.h>
+#include <mini-os/xenbus.h>
+#include <mini-os/events.h>
+#include <errno.h>
+#include <mini-os/gnttab.h>
+#include <xen/io/xenbus.h>
+#include <xen/io/tpmif.h>
+#include <xen/io/protocols.h>
+#include <mini-os/xmalloc.h>
+#include <time.h>
+#include <mini-os/tpmback.h>
+#include <mini-os/lib.h>
+#include <fcntl.h>
+#include <mini-os/mm.h>
+#include <mini-os/posix/sys/mman.h>
+#include <mini-os/semaphore.h>
+#include <mini-os/wait.h>
+
+
+#ifndef HAVE_LIBC
+#define strtoul simple_strtoul
+#endif
+
+//#define TPMBACK_PRINT_DEBUG
+#ifdef TPMBACK_PRINT_DEBUG
+#define TPMBACK_DEBUG(fmt,...) printk("Tpmback:Debug("__FILE__":%d) " fmt, __LINE__, ##__VA_ARGS__)
+#define TPMBACK_DEBUG_MORE(fmt,...) printk(fmt, ##__VA_ARGS__)
+#else
+#define TPMBACK_DEBUG(fmt,...)
+#endif
+#define TPMBACK_ERR(fmt,...) printk("Tpmback:Error " fmt, ##__VA_ARGS__)
+#define TPMBACK_LOG(fmt,...) printk("Tpmback:Info " fmt, ##__VA_ARGS__)
+
+#define min(a,b) (((a) < (b)) ? (a) : (b))
+
+/* Default size of the tpmif array at initialization */
+#define DEF_ARRAY_SIZE 1
+
+/* tpmif and tpmdev flags */
+#define TPMIF_CLOSED 1
+#define TPMIF_REQ_READY 2
+
+struct tpmif {
+   domid_t domid;
+   unsigned int handle;
+
+   char* fe_path;
+   char* fe_state_path;
+
+   /* Locally bound event channel*/
+   evtchn_port_t evtchn;
+
+   /* Shared page */
+   tpmif_tx_interface_t* tx;
+
+   /* pointer to TPMIF_RX_RING_SIZE pages */
+   void** pages;
+
+   enum xenbus_state state;
+   enum { DISCONNECTED, DISCONNECTING, CONNECTED } status;
+
+   unsigned char uuid[16];
+
+   /* state flags */
+   int flags;
+};
+typedef struct tpmif tpmif_t;
+
+struct tpmback_dev {
+
+   tpmif_t** tpmlist;
+   unsigned long num_tpms;
+   unsigned long num_alloc;
+
+   struct gntmap map;
+
+   /* True if at least one tpmif has a request to be handled */
+   int flags;
+
+   xenbus_event_queue events;
+
+   /* Callbacks */
+   void (*open_callback)(domid_t, unsigned int);
+   void (*close_callback)(domid_t, unsigned int);
+   void (*suspend_callback)(domid_t, unsigned int);
+   void (*resume_callback)(domid_t, unsigned int);
+};
+typedef struct tpmback_dev tpmback_dev_t;
+
+enum { EV_NONE, EV_NEWFE, EV_STCHNG } tpm_ev_enum;
+
+/* Global objects */
+static struct thread* eventthread = NULL;
+static tpmback_dev_t gtpmdev = {
+   .tpmlist = NULL,
+   .num_tpms = 0,
+   .num_alloc = 0,
+   .flags = TPMIF_CLOSED,
+   .events = NULL,
+   .open_callback = NULL,
+   .close_callback = NULL,
+   .suspend_callback = NULL,
+   .resume_callback = NULL,
+};
+struct wait_queue_head waitq;
+int globalinit = 0;
+
+/************************************
+ * TPMIF SORTED ARRAY FUNCTIONS
+ * tpmback_dev_t.tpmlist is a sorted array, sorted by domid and then handle number
+ * Duplicates are not allowed
+ * **********************************/
+
+inline void tpmif_req_ready(tpmif_t* tpmif) {
+   tpmif->flags |= TPMIF_REQ_READY;
+   gtpmdev.flags |= TPMIF_REQ_READY;
+}
+
+inline void tpmdev_check_req(void) {
+   int i;
+   int flags;
+   local_irq_save(flags);
+   for(i = 0; i < gtpmdev.num_tpms; ++i) {
+      if(gtpmdev.tpmlist[i]->flags & TPMIF_REQ_READY) {
+	 gtpmdev.flags |= TPMIF_REQ_READY;
+	 local_irq_restore(flags);
+	 return;
+      }
+   }
+   gtpmdev.flags &= ~TPMIF_REQ_READY;
+   local_irq_restore(flags);
+}
+
+inline void tpmif_req_finished(tpmif_t* tpmif) {
+   tpmif->flags &= ~TPMIF_REQ_READY;
+   tpmdev_check_req();
+}
+
+int __get_tpmif_index(int st, int n, domid_t domid, unsigned int handle)
+{
+   int i = st + n /2;
+   tpmif_t* tmp;
+
+   if( n <= 0 )
+      return -1;
+
+   tmp = gtpmdev.tpmlist[i];
+   if(domid == tmp->domid && tmp->handle == handle) {
+      return i;
+   } else if ( (domid < tmp->domid) ||
+	 (domid == tmp->domid && handle < tmp->handle)) {
+      return __get_tpmif_index(st, n/2, domid, handle);
+   } else {
+      return __get_tpmif_index(i + 1, n/2 - ((n +1) % 2), domid, handle);
+   }
+}
+
+/* Returns the array index of the tpmif domid/handle. Returns -1 if no such tpmif exists */
+int get_tpmif_index(domid_t domid, unsigned int handle)
+{
+   int flags;
+   int index;
+   local_irq_save(flags);
+   index = __get_tpmif_index(0, gtpmdev.num_tpms, domid, handle);
+   local_irq_restore(flags);
+   return index;
+}
+
+/* Returns the tpmif domid/handle or NULL if none exists */
+tpmif_t* get_tpmif(domid_t domid, unsigned int handle)
+{
+   int flags;
+   int i;
+   tpmif_t* ret;
+   local_irq_save(flags);
+   i = get_tpmif_index(domid, handle);
+   if (i < 0) {
+      ret = NULL;
+   } else {
+      ret = gtpmdev.tpmlist[i];
+   }
+   local_irq_restore(flags);
+   return ret;
+}
+
+/* Remove the given tpmif. Returns 0 if it was removed, -1 if it was not removed */
+int remove_tpmif(tpmif_t* tpmif)
+{
+   int i, j;
+   char* err;
+   int flags;
+   local_irq_save(flags);
+
+   /* Find the index in the array if it exists */
+   i = get_tpmif_index(tpmif->domid, tpmif->handle);
+   if (i < 0) {
+      goto error;
+   }
+
+   /* Remove the interface from the list */
+   for(j = i; j < gtpmdev.num_tpms - 1; ++j) {
+      gtpmdev.tpmlist[j] = gtpmdev.tpmlist[j+1];
+   }
+   gtpmdev.tpmlist[j] = NULL;
+   --gtpmdev.num_tpms;
+
+   /* If removed tpm was the only ready tpm, then we need to check and turn off the ready flag */
+   tpmdev_check_req();
+
+   local_irq_restore(flags);
+
+   /* Stop listening for events on this tpm interface */
+   if((err = xenbus_unwatch_path_token(XBT_NIL, tpmif->fe_state_path, tpmif->fe_state_path))) {
+      TPMBACK_ERR("Unable to unwatch path token `%s' Error was %s Ignoring..\n", tpmif->fe_state_path, err);
+      free(err);
+   }
+
+   return 0;
+error:
+   local_irq_restore(flags);
+   return -1;
+}
+
+/* Insert tpmif into dev->tpmlist. Returns 0 on success and non zero on error.
+ * It is an error to insert a tpmif with the same domid and handle
+ * number
+ * as something already in the list */
+int insert_tpmif(tpmif_t* tpmif)
+{
+   int flags;
+   unsigned int i, j;
+   tpmif_t* tmp;
+   char* err;
+
+   local_irq_save(flags);
+
+   /*Check if we need to allocate more space */
+   if (gtpmdev.num_tpms == gtpmdev.num_alloc) {
+      gtpmdev.num_alloc *= 2;
+      gtpmdev.tpmlist = realloc(gtpmdev.tpmlist, gtpmdev.num_alloc);
+   }
+
+   /*Find where to put the new interface */
+   for(i = 0; i < gtpmdev.num_tpms; ++i)
+   {
+      tmp = gtpmdev.tpmlist[i];
+      if(tpmif->domid == tmp->domid && tpmif->handle == tmp->handle) {
+	 TPMBACK_ERR("Tried to insert duplicate tpm interface %u/%u\n", (unsigned int) tpmif->domid, tpmif->handle);
+	 goto error;
+      }
+      if((tpmif->domid < tmp->domid) ||
+	    (tpmif->domid == tmp->domid && tpmif->handle < tmp->handle)) {
+	 break;
+      }
+   }
+
+   /*Shift all the tpm pointers past i down one */
+   for(j = gtpmdev.num_tpms; j > i; --j) {
+      gtpmdev.tpmlist[j] = gtpmdev.tpmlist[j-1];
+   }
+
+   /*Add the new interface */
+   gtpmdev.tpmlist[i] = tpmif;
+   ++gtpmdev.num_tpms;
+
+   /*Should not be needed, anything inserted with ready flag is probably an error */
+   tpmdev_check_req();
+
+   local_irq_restore(flags);
+
+   /*Listen for state changes on the new interface */
+   if((err = xenbus_watch_path_token(XBT_NIL, tpmif->fe_state_path, tpmif->fe_state_path, &gtpmdev.events)))
+   {
+      /* if we got an error here we should carefully remove the interface and then return */
+      TPMBACK_ERR("Unable to watch path token `%s' Error was %s\n", tpmif->fe_state_path, err);
+      free(err);
+      remove_tpmif(tpmif);
+      goto error_post_irq;
+   }
+
+   return 0;
+error:
+   local_irq_restore(flags);
+error_post_irq:
+   return -1;
+}
+
+
+/*****************
+ * CHANGE BACKEND STATE
+ * *****************/
+/*Attempts to change the backend state in xenstore
+ * returns 0 on success and non-zero on error */
+int tpmif_change_state(tpmif_t* tpmif, enum xenbus_state state)
+{
+   char path[512];
+   char *value;
+   char *err;
+   enum xenbus_state readst;
+   TPMBACK_DEBUG("Backend state change %u/%u from=%d to=%d\n", (unsigned int) tpmif->domid, tpmif->handle, tpmif->state, state);
+   if (tpmif->state == state)
+      return 0;
+
+   snprintf(path, 512, "backend/vtpm/%u/%u/state", (unsigned int) tpmif->domid, tpmif->handle);
+
+   if((err = xenbus_read(XBT_NIL, path, &value))) {
+      TPMBACK_ERR("Unable to read backend state %s, error was %s\n", path, err);
+      free(err);
+      return -1;
+   }
+   if(sscanf(value, "%d", &readst) != 1) {
+      TPMBACK_ERR("Non integer value (%s) in %s ??\n", value, path);
+      free(value);
+      return -1;
+   }
+   free(value);
+
+   /* It's possible that the backend state got updated by hotplug or something else behind our back */
+   if(readst != tpmif->state) {
+      TPMBACK_DEBUG("tpm interface state was %d but xenstore state was %d!\n", tpmif->state, readst);
+      tpmif->state = readst;
+   }
+
+   /*If if the state isnt changing, then we dont update xenstore b/c we dont want to fire extraneous events */
+   if(tpmif->state == state) {
+      return 0;
+   }
+
+   /*update xenstore*/
+   snprintf(path, 512, "backend/vtpm/%u/%u", (unsigned int) tpmif->domid, tpmif->handle);
+   if((err = xenbus_printf(XBT_NIL, path, "state", "%u", state))) {
+      TPMBACK_ERR("Error writing to xenstore %s, error was %s new state=%d\n", path, err, state);
+      free(err);
+      return -1;
+   }
+
+   tpmif->state = state;
+
+   return 0;
+}
+/**********************************
+ * TPMIF CREATION AND DELETION
+ * *******************************/
+inline tpmif_t* __init_tpmif(domid_t domid, unsigned int handle)
+{
+   tpmif_t* tpmif;
+   tpmif = malloc(sizeof(*tpmif));
+   tpmif->domid = domid;
+   tpmif->handle = handle;
+   tpmif->fe_path = NULL;
+   tpmif->fe_state_path = NULL;
+   tpmif->state = XenbusStateInitialising;
+   tpmif->status = DISCONNECTED;
+   tpmif->tx = NULL;
+   tpmif->pages = NULL;
+   tpmif->flags = 0;
+   memset(tpmif->uuid, 0, sizeof(tpmif->uuid));
+   return tpmif;
+}
+
+void __free_tpmif(tpmif_t* tpmif)
+{
+   if(tpmif->pages) {
+      free(tpmif->pages);
+   }
+   if(tpmif->fe_path) {
+      free(tpmif->fe_path);
+   }
+   if(tpmif->fe_state_path) {
+      free(tpmif->fe_state_path);
+   }
+   free(tpmif);
+}
+/* Creates a new tpm interface, adds it to the sorted array and returns it.
+ * returns NULL on error
+ * If the tpm interface already exists, it is returned*/
+tpmif_t* new_tpmif(domid_t domid, unsigned int handle)
+{
+   tpmif_t* tpmif;
+   char* err;
+   char path[512];
+
+   /* Make sure we haven't already created this tpm
+    * Double events can occur */
+   if((tpmif = get_tpmif(domid, handle)) != NULL) {
+      return tpmif;
+   }
+
+   tpmif = __init_tpmif(domid, handle);
+
+   /* Get the uuid from xenstore */
+   snprintf(path, 512, "backend/vtpm/%u/%u/uuid", (unsigned int) domid, handle);
+   if((!xenbus_read_uuid(path, tpmif->uuid))) {
+      TPMBACK_ERR("Error reading %s\n", path);
+      goto error;
+   }
+
+   /* allocate pages to be used for shared mapping */
+   if((tpmif->pages = malloc(sizeof(void*) * TPMIF_TX_RING_SIZE)) == NULL) {
+      goto error;
+   }
+   memset(tpmif->pages, 0, sizeof(void*) * TPMIF_TX_RING_SIZE);
+
+   if(tpmif_change_state(tpmif, XenbusStateInitWait)) {
+      goto error;
+   }
+
+   snprintf(path, 512, "backend/vtpm/%u/%u/frontend", (unsigned int) domid, handle);
+   if((err = xenbus_read(XBT_NIL, path, &tpmif->fe_path))) {
+      TPMBACK_ERR("Error creating new tpm instance xenbus_read(%s), Error = %s", path, err);
+      free(err);
+      goto error;
+   }
+
+   /*Set the state path */
+   tpmif->fe_state_path = malloc(strlen(tpmif->fe_path) + 7);
+   strcpy(tpmif->fe_state_path, tpmif->fe_path);
+   strcat(tpmif->fe_state_path, "/state");
+
+   if(insert_tpmif(tpmif)) {
+      goto error;
+   }
+   TPMBACK_DEBUG("New tpmif %u/%u\n", (unsigned int) tpmif->domid, tpmif->handle);
+   /* Do the callback now */
+   if(gtpmdev.open_callback) {
+      gtpmdev.open_callback(tpmif->domid, tpmif->handle);
+   }
+   return tpmif;
+error:
+   __free_tpmif(tpmif);
+   return NULL;
+
+}
+
+/* Removes tpmif from dev->tpmlist and frees it's memory usage */
+void free_tpmif(tpmif_t* tpmif)
+{
+   char* err;
+   char path[512];
+   TPMBACK_DEBUG("Free tpmif %u/%u\n", (unsigned int) tpmif->domid, tpmif->handle);
+   if(tpmif->flags & TPMIF_CLOSED) {
+      TPMBACK_ERR("Tried to free an instance twice! Theres a bug somewhere!\n");
+      BUG();
+   }
+   tpmif->flags = TPMIF_CLOSED;
+
+   tpmif_change_state(tpmif, XenbusStateClosing);
+
+   /* Unmap share page and unbind event channel */
+   if(tpmif->status == CONNECTED) {
+      tpmif->status = DISCONNECTING;
+      mask_evtchn(tpmif->evtchn);
+
+      if(gntmap_munmap(&gtpmdev.map, (unsigned long)tpmif->tx, 1)) {
+	 TPMBACK_ERR("%u/%u Error occured while trying to unmap shared page\n", (unsigned int) tpmif->domid, tpmif->handle);
+      }
+
+      unbind_evtchn(tpmif->evtchn);
+   }
+   tpmif->status = DISCONNECTED;
+   tpmif_change_state(tpmif, XenbusStateClosed);
+
+   /* Do the callback now */
+   if(gtpmdev.close_callback) {
+      gtpmdev.close_callback(tpmif->domid, tpmif->handle);
+   }
+
+   /* remove from array */
+   remove_tpmif(tpmif);
+
+   /* Wake up anyone possibly waiting on this interface and let them exit */
+   wake_up(&waitq);
+   schedule();
+
+   /* Remove the old xenbus entries */
+   snprintf(path, 512, "backend/vtpm/%u/%u", (unsigned int) tpmif->domid, tpmif->handle);
+   if((err = xenbus_rm(XBT_NIL, path))) {
+      TPMBACK_ERR("Error cleaning up xenbus entries path=%s error=%s\n", path, err);
+      free(err);
+   }
+
+   TPMBACK_LOG("Frontend %u/%u disconnected\n", (unsigned int) tpmif->domid, tpmif->handle);
+
+   /* free memory */
+   __free_tpmif(tpmif);
+
+}
+
+/**********************
+ * REMAINING TPMBACK FUNCTIONS
+ * ********************/
+
+/*Event channel handler */
+void tpmback_handler(evtchn_port_t port, struct pt_regs *regs, void *data)
+{
+   tpmif_t* tpmif = (tpmif_t*) data;
+   tpmif_tx_request_t* tx = &tpmif->tx->ring[0].req;
+   /* Throw away 0 size events, these can trigger from event channel unmasking */
+   if(tx->size == 0)
+      return;
+
+   TPMBACK_DEBUG("EVENT CHANNEL FIRE %u/%u\n", (unsigned int) tpmif->domid, tpmif->handle);
+   tpmif_req_ready(tpmif);
+   wake_up(&waitq);
+
+}
+
+/* Connect to frontend */
+int connect_fe(tpmif_t* tpmif)
+{
+   char path[512];
+   char* err, *value;
+   uint32_t domid;
+   grant_ref_t ringref;
+   evtchn_port_t evtchn;
+
+   /* If already connected then quit */
+   if (tpmif->status == CONNECTED) {
+      TPMBACK_DEBUG("%u/%u tried to connect while it was already connected?\n", (unsigned int) tpmif->domid, tpmif->handle);
+      return 0;
+   }
+
+   /* Fetch the grant reference */
+   snprintf(path, 512, "%s/ring-ref", tpmif->fe_path);
+   if((err = xenbus_read(XBT_NIL, path, &value))) {
+      TPMBACK_ERR("Error creating new tpm instance xenbus_read(%s) Error = %s", path, err);
+      free(err);
+      return -1;
+   }
+   if(sscanf(value, "%d", &ringref) != 1) {
+      TPMBACK_ERR("Non integer value (%s) in %s ??\n", value, path);
+      free(value);
+      return -1;
+   }
+   free(value);
+
+
+   /* Fetch the event channel*/
+   snprintf(path, 512, "%s/event-channel", tpmif->fe_path);
+   if((err = xenbus_read(XBT_NIL, path, &value))) {
+      TPMBACK_ERR("Error creating new tpm instance xenbus_read(%s) Error = %s", path, err);
+      free(err);
+      return -1;
+   }
+   if(sscanf(value, "%d", &evtchn) != 1) {
+      TPMBACK_ERR("Non integer value (%s) in %s ??\n", value, path);
+      free(value);
+      return -1;
+   }
+   free(value);
+
+   domid = tpmif->domid;
+   if((tpmif->tx = gntmap_map_grant_refs(&gtpmdev.map, 1, &domid, 0, &ringref, PROT_READ | PROT_WRITE)) == NULL) {
+      TPMBACK_ERR("Failed to map grant reference %u/%u\n", (unsigned int) tpmif->domid, tpmif->handle);
+      return -1;
+   }
+   memset(tpmif->tx, 0, PAGE_SIZE);
+
+   /*Bind the event channel */
+   if((evtchn_bind_interdomain(tpmif->domid, evtchn, tpmback_handler, tpmif, &tpmif->evtchn)))
+   {
+      TPMBACK_ERR("%u/%u Unable to bind to interdomain event channel!\n", (unsigned int) tpmif->domid, tpmif->handle);
+      goto error_post_map;
+   }
+   unmask_evtchn(tpmif->evtchn);
+
+   /* Write the ready flag and change status to connected */
+   snprintf(path, 512, "backend/vtpm/%u/%u", (unsigned int) tpmif->domid, tpmif->handle);
+   if((err = xenbus_printf(XBT_NIL, path, "ready", "%u", 1))) {
+      TPMBACK_ERR("%u/%u Unable to write ready flag on connect_fe()\n", (unsigned int) tpmif->domid, tpmif->handle);
+      free(err);
+      goto error_post_evtchn;
+   }
+   tpmif->status = CONNECTED;
+   if((tpmif_change_state(tpmif, XenbusStateConnected))){
+      goto error_post_evtchn;
+   }
+
+   TPMBACK_LOG("Frontend %u/%u connected\n", (unsigned int) tpmif->domid, tpmif->handle);
+
+   return 0;
+error_post_evtchn:
+   mask_evtchn(tpmif->evtchn);
+   unbind_evtchn(tpmif->evtchn);
+error_post_map:
+   gntmap_munmap(&gtpmdev.map, (unsigned long)tpmif->tx, 1);
+   return -1;
+}
+
+static int frontend_changed(tpmif_t* tpmif)
+{
+   int state = xenbus_read_integer(tpmif->fe_state_path);
+   if(state < 0) {
+      state = XenbusStateUnknown;
+   }
+
+   TPMBACK_DEBUG("Frontend %u/%u state changed to %d\n", (unsigned int) tpmif->domid, tpmif->handle, state);
+
+   switch (state) {
+      case XenbusStateInitialising:
+      case XenbusStateInitialised:
+	 break;
+
+      case XenbusStateConnected:
+	 if(connect_fe(tpmif)) {
+	    TPMBACK_ERR("Failed to connect to front end %u/%u\n", (unsigned int) tpmif->domid, tpmif->handle);
+	    tpmif_change_state(tpmif, XenbusStateClosed);
+	    return -1;
+	 }
+	 break;
+
+      case XenbusStateClosing:
+	 tpmif_change_state(tpmif, XenbusStateClosing);
+	 break;
+
+      case XenbusStateUnknown: /* keep it here */
+      case XenbusStateClosed:
+	 free_tpmif(tpmif);
+	 break;
+
+      default:
+	 TPMBACK_DEBUG("BAD STATE CHANGE %u/%u state = %d for tpmif\n", (unsigned int) tpmif->domid, tpmif->handle, state);
+	 return -1;
+   }
+   return 0;
+}
+
+
+/* parses the string that comes out of xenbus_watch_wait_return. */
+static int parse_eventstr(const char* evstr, domid_t* domid, unsigned int* handle)
+{
+   int ret;
+   char cmd[40];
+   char* err;
+   char* value;
+   unsigned int udomid = 0;
+   tpmif_t* tpmif;
+   /* First check for new frontends, this occurs when /backend/vtpm/<domid>/<handle> gets created. Note we what the sscanf to fail on the last %s */
+   if (sscanf(evstr, "backend/vtpm/%u/%u/%40s", &udomid, handle, cmd) == 2) {
+      *domid = udomid;
+      /* Make sure the entry exists, if this event triggers because the entry dissapeared then ignore it */
+      if((err = xenbus_read(XBT_NIL, evstr, &value))) {
+	 free(err);
+	 return EV_NONE;
+      }
+      free(value);
+      /* Make sure the tpmif entry does not already exist, this should not happen */
+      if((tpmif = get_tpmif(*domid, *handle)) != NULL) {
+	 TPMBACK_DEBUG("Duplicate tpm entries! %u %u\n", tpmif->domid, tpmif->handle);
+	 return EV_NONE;
+      }
+      return EV_NEWFE;
+   } else if((ret = sscanf(evstr, "/local/domain/%u/device/vtpm/%u/%40s", &udomid, handle, cmd)) == 3) {
+      *domid = udomid;
+      if (!strcmp(cmd, "state"))
+	 return EV_STCHNG;
+   }
+   return EV_NONE;
+}
+
+void handle_backend_event(char* evstr) {
+   tpmif_t* tpmif;
+   domid_t domid;
+   unsigned int handle;
+   int event;
+
+   TPMBACK_DEBUG("Xenbus Event: %s\n", evstr);
+
+   event = parse_eventstr(evstr, &domid, &handle);
+
+   switch(event) {
+      case EV_NEWFE:
+	 if(new_tpmif(domid, handle) == NULL) {
+	    TPMBACK_ERR("Failed to create new tpm instance %u/%u\n", (unsigned int) domid, handle);
+	 }
+	 wake_up(&waitq);
+	 break;
+      case EV_STCHNG:
+	 if((tpmif = get_tpmif(domid, handle))) {
+	    frontend_changed(tpmif);
+	 } else {
+	    TPMBACK_DEBUG("Event Received for non-existant tpm! instance=%u/%u xenbus_event=%s\n", (unsigned int) domid, handle, evstr);
+	 }
+	 break;
+   }
+}
+
+/* Runs through the given path and creates events recursively
+ * for all of its children.
+ * @path - xenstore path to scan */
+static void generate_backend_events(const char* path)
+{
+   char* err;
+   int i, len;
+   char **dirs;
+   char *entry;
+
+   if((err = xenbus_ls(XBT_NIL, path, &dirs)) != NULL) {
+      free(err);
+      return;
+   }
+
+   for(i = 0; dirs[i] != NULL; ++i) {
+      len = strlen(path) + strlen(dirs[i]) + 2;
+      entry = malloc(len);
+      snprintf(entry, len, "%s/%s", path, dirs[i]);
+
+      /* Generate and handle event for the entry itself */
+      handle_backend_event(entry);
+
+      /* Do children */
+      generate_backend_events(entry);
+
+      /* Cleanup */
+      free(entry);
+      free(dirs[i]);
+   }
+   free(dirs);
+   return;
+}
+
+unsigned char* tpmback_get_uuid(domid_t domid, unsigned int handle)
+{
+   tpmif_t* tpmif;
+   if((tpmif = get_tpmif(domid, handle)) == NULL) {
+      TPMBACK_DEBUG("get_uuid() failed, %u/%u is an invalid frontend\n", (unsigned int) domid, handle);
+      return NULL;
+   }
+
+   return tpmif->uuid;
+}
+
+void tpmback_set_open_callback(void (*cb)(domid_t, unsigned int))
+{
+   gtpmdev.open_callback = cb;
+}
+void tpmback_set_close_callback(void (*cb)(domid_t, unsigned int))
+{
+   gtpmdev.close_callback = cb;
+}
+void tpmback_set_suspend_callback(void (*cb)(domid_t, unsigned int))
+{
+   gtpmdev.suspend_callback = cb;
+}
+void tpmback_set_resume_callback(void (*cb)(domid_t, unsigned int))
+{
+   gtpmdev.resume_callback = cb;
+}
+
+static void event_listener(void)
+{
+   const char* bepath = "backend/vtpm";
+   char **path;
+   char* err;
+
+   /* Setup the backend device watch */
+   if((err = xenbus_watch_path_token(XBT_NIL, bepath, bepath, &gtpmdev.events)) != NULL) {
+      TPMBACK_ERR("xenbus_watch_path_token(%s) failed with error %s!\n", bepath, err);
+      free(err);
+      goto egress;
+   }
+
+   /* Check for any frontends that connected before we set the watch.
+    * This is almost guaranteed to happen if both domains are started
+    * immediatly one after the other.
+    * We do this by manually generating events on everything in the backend
+    * path */
+   generate_backend_events(bepath);
+
+   /* Wait and listen for changes in frontend connections */
+   while(1) {
+      path = xenbus_wait_for_watch_return(&gtpmdev.events);
+
+      /*If quit flag was set then exit */
+      if(gtpmdev.flags & TPMIF_CLOSED) {
+	 TPMBACK_DEBUG("listener thread got quit event. Exiting..\n");
+	 free(path);
+	 break;
+      }
+      handle_backend_event(*path);
+      free(path);
+
+   }
+
+   if((err = xenbus_unwatch_path_token(XBT_NIL, bepath, bepath)) != NULL) {
+      free(err);
+   }
+egress:
+   return;
+}
+
+void event_thread(void* p) {
+   event_listener();
+}
+
+void init_tpmback(void)
+{
+   if(!globalinit) {
+      init_waitqueue_head(&waitq);
+      globalinit = 1;
+   }
+   printk("============= Init TPM BACK ================\n");
+   gtpmdev.tpmlist = malloc(sizeof(tpmif_t*) * DEF_ARRAY_SIZE);
+   gtpmdev.num_alloc = DEF_ARRAY_SIZE;
+   gtpmdev.num_tpms = 0;
+   gtpmdev.flags = 0;
+
+   gtpmdev.open_callback = gtpmdev.close_callback = NULL;
+   gtpmdev.suspend_callback = gtpmdev.resume_callback = NULL;
+
+   eventthread = create_thread("tpmback-listener", event_thread, NULL);
+
+}
+
+void shutdown_tpmback(void)
+{
+   /* Disable callbacks */
+   gtpmdev.open_callback = gtpmdev.close_callback = NULL;
+   gtpmdev.suspend_callback = gtpmdev.resume_callback = NULL;
+
+   TPMBACK_LOG("Shutting down tpm backend\n");
+   /* Set the quit flag */
+   gtpmdev.flags = TPMIF_CLOSED;
+
+   //printk("num tpms is %d\n", gtpmdev.num_tpms);
+   /*Free all backend instances */
+   while(gtpmdev.num_tpms) {
+      free_tpmif(gtpmdev.tpmlist[0]);
+   }
+   free(gtpmdev.tpmlist);
+   gtpmdev.tpmlist = NULL;
+   gtpmdev.num_alloc = 0;
+
+   /* Wake up anyone possibly waiting on the device and let them exit */
+   wake_up(&waitq);
+   schedule();
+}
+
+inline void init_tpmcmd(tpmcmd_t* tpmcmd, domid_t domid, unsigned int handle, unsigned char uuid[16])
+{
+   tpmcmd->domid = domid;
+   tpmcmd->handle = handle;
+   memcpy(tpmcmd->uuid, uuid, sizeof(tpmcmd->uuid));
+   tpmcmd->req = NULL;
+   tpmcmd->req_len = 0;
+   tpmcmd->resp = NULL;
+   tpmcmd->resp_len = 0;
+}
+
+tpmcmd_t* get_request(tpmif_t* tpmif) {
+   tpmcmd_t* cmd;
+   tpmif_tx_request_t* tx;
+   int offset;
+   int tocopy;
+   int i;
+   uint32_t domid;
+   int flags;
+
+   local_irq_save(flags);
+
+   /* Allocate the cmd object to hold the data */
+   if((cmd = malloc(sizeof(*cmd))) == NULL) {
+      goto error;
+   }
+   init_tpmcmd(cmd, tpmif->domid, tpmif->handle, tpmif->uuid);
+
+   tx = &tpmif->tx->ring[0].req;
+   cmd->req_len = tx->size;
+   /* Allocate the buffer */
+   if(cmd->req_len) {
+      if((cmd->req = malloc(cmd->req_len)) == NULL) {
+	 goto error;
+      }
+   }
+   /* Copy the bits from the shared pages */
+   offset = 0;
+   for(i = 0; i < TPMIF_TX_RING_SIZE && offset < cmd->req_len; ++i) {
+      tx = &tpmif->tx->ring[i].req;
+
+      /* Map the page with the data */
+      domid = (uint32_t)tpmif->domid;
+      if((tpmif->pages[i] = gntmap_map_grant_refs(&gtpmdev.map, 1, &domid, 0, &tx->ref, PROT_READ)) == NULL) {
+	 TPMBACK_ERR("%u/%u Unable to map shared page during read!\n", (unsigned int) tpmif->domid, tpmif->handle);
+	 goto error;
+      }
+
+      /* do the copy now */
+      tocopy = min(cmd->req_len - offset, PAGE_SIZE);
+      memcpy(&cmd->req[offset], tpmif->pages[i], tocopy);
+      offset += tocopy;
+
+      /* release the page */
+      gntmap_munmap(&gtpmdev.map, (unsigned long)tpmif->pages[i], 1);
+
+   }
+
+#ifdef TPMBACK_PRINT_DEBUG
+   TPMBACK_DEBUG("Received Tpm Command from %u/%u of size %u", (unsigned int) tpmif->domid, tpmif->handle, cmd->req_len);
+   for(i = 0; i < cmd->req_len; ++i) {
+      if (!(i % 30)) {
+	 TPMBACK_DEBUG_MORE("\n");
+      }
+      TPMBACK_DEBUG_MORE("%02hhX ", cmd->req[i]);
+   }
+   TPMBACK_DEBUG_MORE("\n\n");
+#endif
+
+   local_irq_restore(flags);
+   return cmd;
+error:
+   if(cmd != NULL) {
+      if (cmd->req != NULL) {
+	 free(cmd->req);
+	 cmd->req = NULL;
+      }
+      free(cmd);
+      cmd = NULL;
+   }
+   local_irq_restore(flags);
+   return NULL;
+
+}
+
+void send_response(tpmcmd_t* cmd, tpmif_t* tpmif)
+{
+   tpmif_tx_request_t* tx;
+   int offset;
+   int i;
+   uint32_t domid;
+   int tocopy;
+   int flags;
+
+   local_irq_save(flags);
+
+   tx = &tpmif->tx->ring[0].req;
+   tx->size = cmd->resp_len;
+
+   offset = 0;
+   for(i = 0; i < TPMIF_TX_RING_SIZE && offset < cmd->resp_len; ++i) {
+      tx = &tpmif->tx->ring[i].req;
+
+      /* Map the page with the data */
+      domid = (uint32_t)tpmif->domid;
+      if((tpmif->pages[i] = gntmap_map_grant_refs(&gtpmdev.map, 1, &domid, 0, &tx->ref, PROT_WRITE)) == NULL) {
+	 TPMBACK_ERR("%u/%u Unable to map shared page during write!\n", (unsigned int) tpmif->domid, tpmif->handle);
+	 goto error;
+      }
+
+      /* do the copy now */
+      tocopy = min(cmd->resp_len - offset, PAGE_SIZE);
+      memcpy(tpmif->pages[i], &cmd->resp[offset], tocopy);
+      offset += tocopy;
+
+      /* release the page */
+      gntmap_munmap(&gtpmdev.map, (unsigned long)tpmif->pages[i], 1);
+
+   }
+
+#ifdef TPMBACK_PRINT_DEBUG
+   TPMBACK_DEBUG("Sent response to %u/%u of size %u", (unsigned int) tpmif->domid, tpmif->handle, cmd->resp_len);
+   for(i = 0; i < cmd->resp_len; ++i) {
+      if (!(i % 30)) {
+	 TPMBACK_DEBUG_MORE("\n");
+      }
+      TPMBACK_DEBUG_MORE("%02hhX ", cmd->resp[i]);
+   }
+   TPMBACK_DEBUG_MORE("\n\n");
+#endif
+   /* clear the ready flag and send the event channel notice to the frontend */
+   tpmif_req_finished(tpmif);
+   notify_remote_via_evtchn(tpmif->evtchn);
+error:
+   local_irq_restore(flags);
+   return;
+}
+
+tpmcmd_t* tpmback_req_any(void)
+{
+   int i;
+   /* Block until something has a request */
+   wait_event(waitq, (gtpmdev.flags & (TPMIF_REQ_READY | TPMIF_CLOSED)));
+
+   /* Check if were shutting down */
+   if(gtpmdev.flags & TPMIF_CLOSED) {
+      /* if something was waiting for us to give up the queue so it can shutdown, let it finish */
+      schedule();
+      return NULL;
+   }
+
+   for(i = 0; i < gtpmdev.num_tpms; ++i) {
+      if(gtpmdev.tpmlist[i]->flags & TPMIF_REQ_READY) {
+	 return get_request(gtpmdev.tpmlist[i]);
+      }
+   }
+
+   TPMBACK_ERR("backend request ready flag was set but no interfaces were actually ready\n");
+   return NULL;
+}
+
+tpmcmd_t* tpmback_req(domid_t domid, unsigned int handle)
+{
+   tpmif_t* tpmif;
+   tpmif = get_tpmif(domid, handle);
+   if(tpmif == NULL) {
+      return NULL;
+   }
+
+   wait_event(waitq, (tpmif->flags & (TPMIF_REQ_READY | TPMIF_CLOSED) || gtpmdev.flags & TPMIF_CLOSED));
+
+   /* Check if were shutting down */
+   if(tpmif->flags & TPMIF_CLOSED || gtpmdev.flags & TPMIF_CLOSED) {
+      /* if something was waiting for us to give up the queue so it can free this instance, let it finish */
+      schedule();
+      return NULL;
+   }
+
+   return get_request(tpmif);
+}
+
+void tpmback_resp(tpmcmd_t* tpmcmd)
+{
+   tpmif_t* tpmif;
+
+   /* Get the associated interface, if it doesnt exist then just quit */
+   tpmif = get_tpmif(tpmcmd->domid, tpmcmd->handle);
+   if(tpmif == NULL) {
+      TPMBACK_ERR("Tried to send a reponse to non existant frontend %u/%u\n", (unsigned int) tpmcmd->domid, tpmcmd->handle);
+      goto end;
+   }
+
+   if(!(tpmif->flags & TPMIF_REQ_READY)) {
+      TPMBACK_ERR("Tried to send response to a frontend that was not waiting for one %u/%u\n", (unsigned int) tpmcmd->domid, tpmcmd->handle);
+      goto end;
+   }
+
+   /* Send response to frontend */
+   send_response(tpmcmd, tpmif);
+
+end:
+   if(tpmcmd->req != NULL) {
+      free(tpmcmd->req);
+   }
+   free(tpmcmd);
+   return;
+}
+
+int tpmback_wait_for_frontend_connect(domid_t *domid, unsigned int *handle)
+{
+   tpmif_t* tpmif;
+   int flags;
+   wait_event(waitq, ((gtpmdev.num_tpms > 0) || gtpmdev.flags & TPMIF_CLOSED));
+   if(gtpmdev.flags & TPMIF_CLOSED) {
+      return -1;
+   }
+   local_irq_save(flags);
+   tpmif = gtpmdev.tpmlist[0];
+   *domid = tpmif->domid;
+   *handle = tpmif->handle;
+   local_irq_restore(flags);
+
+   return 0;
+}
+
+int tpmback_num_frontends(void)
+{
+   return gtpmdev.num_tpms;
+}
diff -r 3015f8c6174b -r 34d52300f5d2 extras/mini-os/tpmfront.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/tpmfront.c	Tue Nov 13 10:46:58 2012 +0000
@@ -0,0 +1,608 @@
+/*
+ * Copyright (c) 2010-2012 United States Government, as represented by
+ * the Secretary of Defense.  All rights reserved.
+ *
+ * This code has been derived from drivers/char/tpm_vtpm.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (C) 2006 IBM Corporation
+ *
+ * This code has also been derived from drivers/char/tpm_xen.c
+ * from the xen 2.6.18 linux kernel
+ *
+ * Copyright (c) 2005, IBM Corporation
+ *
+ * which was itself derived from drivers/xen/netfront/netfront.c
+ * from the linux kernel
+ *
+ * Copyright (c) 2002-2004, K A Fraser
+ *
+ * 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, version 2 of the
+ * License.
+ */
+#include <mini-os/os.h>
+#include <mini-os/xenbus.h>
+#include <mini-os/xmalloc.h>
+#include <mini-os/events.h>
+#include <mini-os/wait.h>
+#include <mini-os/gnttab.h>
+#include <xen/io/xenbus.h>
+#include <xen/io/tpmif.h>
+#include <mini-os/tpmfront.h>
+#include <fcntl.h>
+
+//#define TPMFRONT_PRINT_DEBUG
+#ifdef TPMFRONT_PRINT_DEBUG
+#define TPMFRONT_DEBUG(fmt,...) printk("Tpmfront:Debug("__FILE__":%d) " fmt, __LINE__, ##__VA_ARGS__)
+#define TPMFRONT_DEBUG_MORE(fmt,...) printk(fmt, ##__VA_ARGS__)
+#else
+#define TPMFRONT_DEBUG(fmt,...)
+#endif
+#define TPMFRONT_ERR(fmt,...) printk("Tpmfront:Error " fmt, ##__VA_ARGS__)
+#define TPMFRONT_LOG(fmt,...) printk("Tpmfront:Info " fmt, ##__VA_ARGS__)
+
+#define min(a,b) (((a) < (b)) ? (a) : (b))
+
+void tpmfront_handler(evtchn_port_t port, struct pt_regs *regs, void *data) {
+   struct tpmfront_dev* dev = (struct tpmfront_dev*) data;
+   /*If we get a response when we didnt make a request, just ignore it */
+   if(!dev->waiting) {
+      return;
+   }
+
+   dev->waiting = 0;
+#ifdef HAVE_LIBC
+   if(dev->fd >= 0) {
+      files[dev->fd].read = 1;
+   }
+#endif
+   wake_up(&dev->waitq);
+}
+
+static int publish_xenbus(struct tpmfront_dev* dev) {
+   xenbus_transaction_t xbt;
+   int retry;
+   char* err;
+   /* Write the grant reference and event channel to xenstore */
+again:
+   if((err = xenbus_transaction_start(&xbt))) {
+      TPMFRONT_ERR("Unable to start xenbus transaction, error was %s\n", err);
+      free(err);
+      return -1;
+   }
+
+   if((err = xenbus_printf(xbt, dev->nodename, "ring-ref", "%u", (unsigned int) dev->ring_ref))) {
+      TPMFRONT_ERR("Unable to write %s/ring-ref, error was %s\n", dev->nodename, err);
+      free(err);
+      goto abort_transaction;
+   }
+
+   if((err = xenbus_printf(xbt, dev->nodename, "event-channel", "%u", (unsigned int) dev->evtchn))) {
+      TPMFRONT_ERR("Unable to write %s/event-channel, error was %s\n", dev->nodename, err);
+      free(err);
+      goto abort_transaction;
+   }
+
+   if((err = xenbus_transaction_end(xbt, 0, &retry))) {
+      TPMFRONT_ERR("Unable to complete xenbus transaction, error was %s\n", err);
+      free(err);
+      return -1;
+   }
+   if(retry) {
+      goto again;
+   }
+
+   return 0;
+abort_transaction:
+   if((err = xenbus_transaction_end(xbt, 1, &retry))) {
+      free(err);
+   }
+   return -1;
+}
+
+static int wait_for_backend_connect(xenbus_event_queue* events, char* path)
+{
+   int state;
+
+   TPMFRONT_LOG("Waiting for backend connection..\n");
+   /* Wait for the backend to connect */
+   while(1) {
+      state = xenbus_read_integer(path);
+      if ( state < 0)
+	 state = XenbusStateUnknown;
+      switch(state) {
+	 /* Bad states, we quit with error */
+	 case XenbusStateUnknown:
+	 case XenbusStateClosing:
+	 case XenbusStateClosed:
+	    TPMFRONT_ERR("Unable to connect to backend\n");
+	    return -1;
+	 /* If backend is connected then break out of loop */
+	 case XenbusStateConnected:
+	    TPMFRONT_LOG("Backend Connected\n");
+	    return 0;
+	 default:
+	    xenbus_wait_for_watch(events);
+      }
+   }
+
+}
+
+static int wait_for_backend_closed(xenbus_event_queue* events, char* path)
+{
+   int state;
+
+   TPMFRONT_LOG("Waiting for backend to close..\n");
+   while(1) {
+      state = xenbus_read_integer(path);
+      if ( state < 0)
+	 state = XenbusStateUnknown;
+      switch(state) {
+	 case XenbusStateUnknown:
+	    TPMFRONT_ERR("Backend Unknown state, forcing shutdown\n");
+	    return -1;
+	 case XenbusStateClosed:
+	    TPMFRONT_LOG("Backend Closed\n");
+	    return 0;
+	 default:
+	    xenbus_wait_for_watch(events);
+      }
+   }
+
+}
+
+static int wait_for_backend_state_changed(struct tpmfront_dev* dev, XenbusState state) {
+   char* err;
+   int ret = 0;
+   xenbus_event_queue events = NULL;
+   char path[512];
+
+   snprintf(path, 512, "%s/state", dev->bepath);
+   /*Setup the watch to wait for the backend */
+   if((err = xenbus_watch_path_token(XBT_NIL, path, path, &events))) {
+      TPMFRONT_ERR("Could not set a watch on %s, error was %s\n", path, err);
+      free(err);
+      return -1;
+   }
+
+   /* Do the actual wait loop now */
+   switch(state) {
+      case XenbusStateConnected:
+	 ret = wait_for_backend_connect(&events, path);
+	 break;
+      case XenbusStateClosed:
+	 ret = wait_for_backend_closed(&events, path);
+	 break;
+      default:
+	 break;
+   }
+
+   if((err = xenbus_unwatch_path_token(XBT_NIL, path, path))) {
+      TPMFRONT_ERR("Unable to unwatch %s, error was %s, ignoring..\n", path, err);
+      free(err);
+   }
+   return ret;
+}
+
+static int tpmfront_connect(struct tpmfront_dev* dev)
+{
+   char* err;
+   /* Create shared page */
+   dev->tx = (tpmif_tx_interface_t*) alloc_page();
+   if(dev->tx == NULL) {
+      TPMFRONT_ERR("Unable to allocate page for shared memory\n");
+      goto error;
+   }
+   memset(dev->tx, 0, PAGE_SIZE);
+   dev->ring_ref = gnttab_grant_access(dev->bedomid, virt_to_mfn(dev->tx), 0);
+   TPMFRONT_DEBUG("grant ref is %lu\n", (unsigned long) dev->ring_ref);
+
+   /*Create event channel */
+   if(evtchn_alloc_unbound(dev->bedomid, tpmfront_handler, dev, &dev->evtchn)) {
+      TPMFRONT_ERR("Unable to allocate event channel\n");
+      goto error_postmap;
+   }
+   unmask_evtchn(dev->evtchn);
+   TPMFRONT_DEBUG("event channel is %lu\n", (unsigned long) dev->evtchn);
+
+   /* Write the entries to xenstore */
+   if(publish_xenbus(dev)) {
+      goto error_postevtchn;
+   }
+
+   /* Change state to connected */
+   dev->state = XenbusStateConnected;
+
+   /* Tell the backend that we are ready */
+   if((err = xenbus_printf(XBT_NIL, dev->nodename, "state", "%u", dev->state))) {
+      TPMFRONT_ERR("Unable to write to xenstore %s/state, value=%u", dev->nodename, XenbusStateConnected);
+      free(err);
+      goto error;
+   }
+
+   return 0;
+error_postevtchn:
+      mask_evtchn(dev->evtchn);
+      unbind_evtchn(dev->evtchn);
+error_postmap:
+      gnttab_end_access(dev->ring_ref);
+      free_page(dev->tx);
+error:
+   return -1;
+}
+
+struct tpmfront_dev* init_tpmfront(const char* _nodename)
+{
+   struct tpmfront_dev* dev;
+   const char* nodename;
+   char path[512];
+   char* value, *err;
+   unsigned long long ival;
+   int i;
+
+   printk("============= Init TPM Front ================\n");
+
+   dev = malloc(sizeof(struct tpmfront_dev));
+   memset(dev, 0, sizeof(struct tpmfront_dev));
+
+#ifdef HAVE_LIBC
+   dev->fd = -1;
+#endif
+
+   nodename = _nodename ? _nodename : "device/vtpm/0";
+   dev->nodename = strdup(nodename);
+
+   init_waitqueue_head(&dev->waitq);
+
+   /* Get backend domid */
+   snprintf(path, 512, "%s/backend-id", dev->nodename);
+   if((err = xenbus_read(XBT_NIL, path, &value))) {
+      TPMFRONT_ERR("Unable to read %s during tpmfront initialization! error = %s\n", path, err);
+      free(err);
+      goto error;
+   }
+   if(sscanf(value, "%llu", &ival) != 1) {
+      TPMFRONT_ERR("%s has non-integer value (%s)\n", path, value);
+      free(value);
+      goto error;
+   }
+   free(value);
+   dev->bedomid = ival;
+
+   /* Get backend xenstore path */
+   snprintf(path, 512, "%s/backend", dev->nodename);
+   if((err = xenbus_read(XBT_NIL, path, &dev->bepath))) {
+      TPMFRONT_ERR("Unable to read %s during tpmfront initialization! error = %s\n", path, err);
+      free(err);
+      goto error;
+   }
+
+   /* Create and publish grant reference and event channel */
+   if (tpmfront_connect(dev)) {
+      goto error;
+   }
+
+   /* Wait for backend to connect */
+   if( wait_for_backend_state_changed(dev, XenbusStateConnected)) {
+      goto error;
+   }
+
+   /* Allocate pages that will contain the messages */
+   dev->pages = malloc(sizeof(void*) * TPMIF_TX_RING_SIZE);
+   if(dev->pages == NULL) {
+      goto error;
+   }
+   memset(dev->pages, 0, sizeof(void*) * TPMIF_TX_RING_SIZE);
+   for(i = 0; i < TPMIF_TX_RING_SIZE; ++i) {
+      dev->pages[i] = (void*)alloc_page();
+      if(dev->pages[i] == NULL) {
+	 goto error;
+      }
+   }
+
+   TPMFRONT_LOG("Initialization Completed successfully\n");
+
+   return dev;
+
+error:
+   shutdown_tpmfront(dev);
+   return NULL;
+}
+void shutdown_tpmfront(struct tpmfront_dev* dev)
+{
+   char* err;
+   char path[512];
+   int i;
+   tpmif_tx_request_t* tx;
+   if(dev == NULL) {
+      return;
+   }
+   TPMFRONT_LOG("Shutting down tpmfront\n");
+   /* disconnect */
+   if(dev->state == XenbusStateConnected) {
+      dev->state = XenbusStateClosing;
+      //FIXME: Transaction for this?
+      /* Tell backend we are closing */
+      if((err = xenbus_printf(XBT_NIL, dev->nodename, "state", "%u", (unsigned int) dev->state))) {
+	 free(err);
+      }
+
+      /* Clean up xenstore entries */
+      snprintf(path, 512, "%s/event-channel", dev->nodename);
+      if((err = xenbus_rm(XBT_NIL, path))) {
+	 free(err);
+      }
+      snprintf(path, 512, "%s/ring-ref", dev->nodename);
+      if((err = xenbus_rm(XBT_NIL, path))) {
+	 free(err);
+      }
+
+      /* Tell backend we are closed */
+      dev->state = XenbusStateClosed;
+      if((err = xenbus_printf(XBT_NIL, dev->nodename, "state", "%u", (unsigned int) dev->state))) {
+	 TPMFRONT_ERR("Unable to write to %s, error was %s", dev->nodename, err);
+	 free(err);
+      }
+
+      /* Wait for the backend to close and unmap shared pages, ignore any errors */
+      wait_for_backend_state_changed(dev, XenbusStateClosed);
+
+      /* Cleanup any shared pages */
+      if(dev->pages) {
+	 for(i = 0; i < TPMIF_TX_RING_SIZE; ++i) {
+	    if(dev->pages[i]) {
+	       tx = &dev->tx->ring[i].req;
+	       if(tx->ref != 0) {
+		  gnttab_end_access(tx->ref);
+	       }
+	       free_page(dev->pages[i]);
+	    }
+	 }
+	 free(dev->pages);
+      }
+
+      /* Close event channel and unmap shared page */
+      mask_evtchn(dev->evtchn);
+      unbind_evtchn(dev->evtchn);
+      gnttab_end_access(dev->ring_ref);
+
+      free_page(dev->tx);
+
+   }
+
+   /* Cleanup memory usage */
+   if(dev->respbuf) {
+      free(dev->respbuf);
+   }
+   if(dev->bepath) {
+      free(dev->bepath);
+   }
+   if(dev->nodename) {
+      free(dev->nodename);
+   }
+   free(dev);
+}
+
+int tpmfront_send(struct tpmfront_dev* dev, const uint8_t* msg, size_t length)
+{
+   int i;
+   tpmif_tx_request_t* tx = NULL;
+   /* Error Checking */
+   if(dev == NULL || dev->state != XenbusStateConnected) {
+      TPMFRONT_ERR("Tried to send message through disconnected frontend\n");
+      return -1;
+   }
+
+#ifdef TPMFRONT_PRINT_DEBUG
+   TPMFRONT_DEBUG("Sending Msg to backend size=%u", (unsigned int) length);
+   for(i = 0; i < length; ++i) {
+      if(!(i % 30)) {
+	 TPMFRONT_DEBUG_MORE("\n");
+      }
+      TPMFRONT_DEBUG_MORE("%02X ", msg[i]);
+   }
+   TPMFRONT_DEBUG_MORE("\n");
+#endif
+
+   /* Copy to shared pages now */
+   for(i = 0; length > 0 && i < TPMIF_TX_RING_SIZE; ++i) {
+      /* Share the page */
+      tx = &dev->tx->ring[i].req;
+      tx->unused = 0;
+      tx->addr = virt_to_mach(dev->pages[i]);
+      tx->ref = gnttab_grant_access(dev->bedomid, virt_to_mfn(dev->pages[i]), 0);
+      /* Copy the bits to the page */
+      tx->size = length > PAGE_SIZE ? PAGE_SIZE : length;
+      memcpy(dev->pages[i], &msg[i * PAGE_SIZE], tx->size);
+
+      /* Update counters */
+      length -= tx->size;
+   }
+   dev->waiting = 1;
+   dev->resplen = 0;
+#ifdef HAVE_LIBC
+   if(dev->fd >= 0) {
+      files[dev->fd].read = 0;
+      files[dev->fd].tpmfront.respgot = 0;
+      files[dev->fd].tpmfront.offset = 0;
+   }
+#endif
+   notify_remote_via_evtchn(dev->evtchn);
+   return 0;
+}
+int tpmfront_recv(struct tpmfront_dev* dev, uint8_t** msg, size_t *length)
+{
+   tpmif_tx_request_t* tx;
+   int i;
+   if(dev == NULL || dev->state != XenbusStateConnected) {
+      TPMFRONT_ERR("Tried to receive message from disconnected frontend\n");
+      return -1;
+   }
+   /*Wait for the response */
+   wait_event(dev->waitq, (!dev->waiting));
+
+   /* Initialize */
+   *msg = NULL;
+   *length = 0;
+
+   /* special case, just quit */
+   tx = &dev->tx->ring[0].req;
+   if(tx->size == 0 ) {
+       goto quit;
+   }
+   /* Get the total size */
+   tx = &dev->tx->ring[0].req;
+   for(i = 0; i < TPMIF_TX_RING_SIZE && tx->size > 0; ++i) {
+      tx = &dev->tx->ring[i].req;
+      *length += tx->size;
+   }
+   /* Alloc the buffer */
+   if(dev->respbuf) {
+      free(dev->respbuf);
+   }
+   *msg = dev->respbuf = malloc(*length);
+   dev->resplen = *length;
+   /* Copy the bits */
+   tx = &dev->tx->ring[0].req;
+   for(i = 0; i < TPMIF_TX_RING_SIZE && tx->size > 0; ++i) {
+      tx = &dev->tx->ring[i].req;
+      memcpy(&(*msg)[i * PAGE_SIZE], dev->pages[i], tx->size);
+      gnttab_end_access(tx->ref);
+      tx->ref = 0;
+   }
+#ifdef TPMFRONT_PRINT_DEBUG
+   TPMFRONT_DEBUG("Received response from backend size=%u", (unsigned int) *length);
+   for(i = 0; i < *length; ++i) {
+      if(!(i % 30)) {
+	 TPMFRONT_DEBUG_MORE("\n");
+      }
+      TPMFRONT_DEBUG_MORE("%02X ", (*msg)[i]);
+   }
+   TPMFRONT_DEBUG_MORE("\n");
+#endif
+#ifdef HAVE_LIBC
+   if(dev->fd >= 0) {
+      files[dev->fd].tpmfront.respgot = 1;
+   }
+#endif
+quit:
+   return 0;
+}
+
+int tpmfront_cmd(struct tpmfront_dev* dev, uint8_t* req, size_t reqlen, uint8_t** resp, size_t* resplen)
+{
+   int rc;
+   if((rc = tpmfront_send(dev, req, reqlen))) {
+      return rc;
+   }
+   if((rc = tpmfront_recv(dev, resp, resplen))) {
+      return rc;
+   }
+
+   return 0;
+}
+
+#ifdef HAVE_LIBC
+#include <errno.h>
+int tpmfront_open(struct tpmfront_dev* dev)
+{
+   /* Silently prevent multiple opens */
+   if(dev->fd != -1) {
+      return dev->fd;
+   }
+
+   dev->fd = alloc_fd(FTYPE_TPMFRONT);
+   printk("tpmfront_open(%s) -> %d\n", dev->nodename, dev->fd);
+   files[dev->fd].tpmfront.dev = dev;
+   files[dev->fd].tpmfront.offset = 0;
+   files[dev->fd].tpmfront.respgot = 0;
+   return dev->fd;
+}
+
+int tpmfront_posix_write(int fd, const uint8_t* buf, size_t count)
+{
+   int rc;
+   struct tpmfront_dev* dev;
+   dev = files[fd].tpmfront.dev;
+
+   if(count == 0) {
+      return 0;
+   }
+
+   /* Return an error if we are already processing a command */
+   if(dev->waiting) {
+      errno = EINPROGRESS;
+      return -1;
+   }
+   /* Send the command now */
+   if((rc = tpmfront_send(dev, buf, count)) != 0) {
+      errno = EIO;
+      return -1;
+   }
+   return count;
+}
+
+int tpmfront_posix_read(int fd, uint8_t* buf, size_t count)
+{
+   int rc;
+   uint8_t* dummybuf;
+   size_t dummysz;
+   struct tpmfront_dev* dev;
+
+   dev = files[fd].tpmfront.dev;
+
+   if(count == 0) {
+      return 0;
+   }
+
+   /* get the response if we haven't already */
+   if(files[dev->fd].tpmfront.respgot == 0) {
+      if ((rc = tpmfront_recv(dev, &dummybuf, &dummysz)) != 0) {
+	 errno = EIO;
+	 return -1;
+      }
+   }
+
+   /* handle EOF case */
+   if(files[dev->fd].tpmfront.offset >= dev->resplen) {
+      return 0;
+   }
+
+   /* Compute the number of bytes and do the copy operation */
+   if((rc = min(count, dev->resplen - files[dev->fd].tpmfront.offset)) != 0) {
+      memcpy(buf, dev->respbuf + files[dev->fd].tpmfront.offset, rc);
+      files[dev->fd].tpmfront.offset += rc;
+   }
+
+   return rc;
+}
+
+int tpmfront_posix_fstat(int fd, struct stat* buf)
+{
+   uint8_t* dummybuf;
+   size_t dummysz;
+   int rc;
+   struct tpmfront_dev* dev = files[fd].tpmfront.dev;
+
+   /* If we have a response waiting, then read it now from the backend
+    * so we can get its length*/
+   if(dev->waiting || (files[dev->fd].read == 1 && !files[dev->fd].tpmfront.respgot)) {
+      if ((rc = tpmfront_recv(dev, &dummybuf, &dummysz)) != 0) {
+	 errno = EIO;
+	 return -1;
+      }
+   }
+
+   buf->st_mode = O_RDWR;
+   buf->st_uid = 0;
+   buf->st_gid = 0;
+   buf->st_size = dev->resplen;
+   buf->st_atime = buf->st_mtime = buf->st_ctime = time(NULL);
+
+   return 0;
+}
+
+
+#endif

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 16:22:33 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 16:22: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 1TYJFw-0004Kt-LB; Tue, 13 Nov 2012 16:22:32 +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 1TYJFt-0004JX-1Y
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:30 +0000
Received: from [193.109.254.147:63011] by server-14.bemta-14.messagelabs.com
	id 8B/1F-14517-4C372A05; Tue, 13 Nov 2012 16:22:28 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-27.messagelabs.com!1352823732!10806758!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-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8563 invoked from network); 13 Nov 2012 16:22:13 -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;
	13 Nov 2012 16: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 1TYJFb-00037u-QR
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYJFb-0006ia-L6
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:11 +0000
Message-Id: <E1TYJFb-0006ia-L6@xenbits.xen.org>
Date: Tue, 13 Nov 2012 16:22:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: Remove the vtpm process model
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1352803620 0
# Node ID 170d45f7a2ebde462743d98c77a1d10ee0f51a29
# Parent  2a4c1d3a080e7d3b20354155b6ac09e53d812cc6
tools: Remove the vtpm process model

Remove the old vtpm process model. It doesn't work very
well and is no longer supported.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/Makefile
--- a/tools/Makefile	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/Makefile	Tue Nov 13 10:47:00 2012 +0000
@@ -18,8 +18,6 @@ SUBDIRS-$(CONFIG_XCUTILS) += xcutils
 SUBDIRS-$(CONFIG_X86) += firmware
 SUBDIRS-y += console
 SUBDIRS-y += xenmon
-SUBDIRS-$(VTPM_TOOLS) += vtpm_manager
-SUBDIRS-$(VTPM_TOOLS) += vtpm
 SUBDIRS-y += xenstat
 SUBDIRS-$(CONFIG_Linux) += $(SUBDIRS-libaio)
 SUBDIRS-$(CONFIG_Linux) += memshr 
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/blktap2/drivers/hashtable.c
--- a/tools/blktap2/drivers/hashtable.c	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/blktap2/drivers/hashtable.c	Tue Nov 13 10:47:00 2012 +0000
@@ -3,7 +3,6 @@
 /*
  * There are duplicates of this code in:
  *  - tools/xenstore/hashtable.c
- *  - tools/vtpm_manager/util/hashtable.c
  */
 
 #include "hashtable.h"
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/blktap2/drivers/hashtable.h
--- a/tools/blktap2/drivers/hashtable.h	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/blktap2/drivers/hashtable.h	Tue Nov 13 10:47:00 2012 +0000
@@ -3,7 +3,6 @@
 /*
  * There are duplicates of this code in:
  *  - tools/xenstore/hashtable.h
- *  - tools/vtpm_manager/util/hashtable.h
  */
 
 #ifndef __HASHTABLE_CWC22_H__
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/blktap2/drivers/hashtable_itr.c
--- a/tools/blktap2/drivers/hashtable_itr.c	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/blktap2/drivers/hashtable_itr.c	Tue Nov 13 10:47:00 2012 +0000
@@ -1,10 +1,5 @@
 /* Copyright (C) 2002, 2004 Christopher Clark  <firstname.lastname@cl.cam.ac.uk> */
 
-/*
- * There are duplicates of this code in:
- *  - tools/vtpm_manager/util/hashtable_itr.c
- */
-
 #include "hashtable.h"
 #include "hashtable_private.h"
 #include "hashtable_itr.h"
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/blktap2/drivers/hashtable_itr.h
--- a/tools/blktap2/drivers/hashtable_itr.h	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/blktap2/drivers/hashtable_itr.h	Tue Nov 13 10:47:00 2012 +0000
@@ -1,10 +1,5 @@
 /* Copyright (C) 2002, 2004 Christopher Clark <firstname.lastname@cl.cam.ac.uk> */
 
-/*
- * There are duplicates of this code in:
- *  - tools/vtpm_manager/util/hashtable_itr.h
- */
-
 #ifndef __HASHTABLE_ITR_CWC22__
 #define __HASHTABLE_ITR_CWC22__
 #include "hashtable.h"
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/blktap2/drivers/hashtable_private.h
--- a/tools/blktap2/drivers/hashtable_private.h	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/blktap2/drivers/hashtable_private.h	Tue Nov 13 10:47:00 2012 +0000
@@ -3,7 +3,6 @@
 /*
  * There are duplicates of this code in:
  *  - tools/xenstore/hashtable_private.h
- *  - tools/vtpm_manager/util/hashtable_private.h
  */
 
 #ifndef __HASHTABLE_PRIVATE_CWC22_H__
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/configure.ac
--- a/tools/configure.ac	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/configure.ac	Tue Nov 13 10:47:00 2012 +0000
@@ -40,7 +40,6 @@ m4_include([m4/fetcher.m4])
 # Enable/disable options
 AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
 AX_ARG_DEFAULT_ENABLE([monitors], [Disable xenstat and xentop monitoring tools])
-AX_ARG_DEFAULT_DISABLE([vtpm], [Enable Virtual Trusted Platform Module])
 AX_ARG_DEFAULT_DISABLE([xenapi], [Enable Xen API Bindings])
 AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools])
 AX_ARG_DEFAULT_DISABLE([miniterm], [Enable miniterm])
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/examples/README
--- a/tools/examples/README	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/examples/README	Tue Nov 13 10:47:00 2012 +0000
@@ -25,13 +25,7 @@ vif-bridge          - virtual network st
 vif-common.sh       - sourced by vif-bridge 
 vif-nat             - xen virtual network start/stop script in NAT mode 
 vif-route           - xen virtual network start/stop script in routed mode
-vtpm                - called by xen-backend.agent to bind/unbind vTPM devices
-vtpm-common.sh      - common code for vTPM handling
-vtpm-delete         - remove an entry from the vTPM table given the
-                      domain's name
-vtpm-hotplug-common.sh - sourced by vtpm
-vtpm-migration.sh   - sourced by external-device-migrate
-xen-backend.agent   - calls block, vif-*, vtpm scripts to add, remove, hotplug
+xen-backend.agent   - calls block, vif-* scripts to add, remove, hotplug
                       devices  
 xen-backend.rules   - hotplug script rules
 xend-config.sxp     - default xend configuration file
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/examples/xmexample.pv-grub
--- a/tools/examples/xmexample.pv-grub	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/examples/xmexample.pv-grub	Tue Nov 13 10:47:00 2012 +0000
@@ -105,20 +105,6 @@ disk = [ 'phy:hda1,hda1,w' ]
 # configured in xend-config.sxp.
 
 #----------------------------------------------------------------------------
-# Define to which TPM instance the user domain should communicate.
-# The vtpm entry is of the form 'instance=INSTANCE,backend=DOM'
-# where INSTANCE indicates the instance number of the TPM the VM
-# should be talking to and DOM provides the domain where the backend
-# is located.
-# Note that no two virtual machines should try to connect to the same
-# TPM instance. The handling of all TPM instances does require
-# some management effort in so far that VM configration files (and thus
-# a VM) should be associated with a TPM instance throughout the lifetime
-# of the VM / VM configuration file. The instance number must be
-# greater or equal to 1.
-#vtpm = [ 'instance=1,backend=0' ]
-
-#----------------------------------------------------------------------------
 # Configure the behaviour when a domain exits.  There are three 'reasons'
 # for a domain to stop: poweroff, reboot, and crash.  For each of these you
 # may specify:
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/examples/xmexample1
--- a/tools/examples/xmexample1	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/examples/xmexample1	Tue Nov 13 10:47:00 2012 +0000
@@ -101,20 +101,6 @@ disk = [ 'phy:hda1,hda1,w' ]
 # configured in xend-config.sxp.
 
 #----------------------------------------------------------------------------
-# Define to which TPM instance the user domain should communicate.
-# The vtpm entry is of the form 'instance=INSTANCE,backend=DOM'
-# where INSTANCE indicates the instance number of the TPM the VM
-# should be talking to and DOM provides the domain where the backend
-# is located.
-# Note that no two virtual machines should try to connect to the same
-# TPM instance. The handling of all TPM instances does require
-# some management effort in so far that VM configration files (and thus
-# a VM) should be associated with a TPM instance throughout the lifetime
-# of the VM / VM configuration file. The instance number must be
-# greater or equal to 1.
-#vtpm = [ 'instance=1,backend=0' ]
-
-#----------------------------------------------------------------------------
 # Set the kernel command line for the new domain.
 # You only need to define the IP parameters and hostname if the domain's
 # IP config doesn't, e.g. in ifcfg-eth0 or via DHCP.
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/examples/xmexample2
--- a/tools/examples/xmexample2	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/examples/xmexample2	Tue Nov 13 10:47:00 2012 +0000
@@ -137,20 +137,6 @@ disk = [ 'phy:sda%d,sda1,w' % (7+vmid),
 # configured in xend-config.sxp.
 
 #----------------------------------------------------------------------------
-# Define to which TPM instance the user domain should communicate.
-# The vtpm entry is of the form 'instance=INSTANCE,backend=DOM'
-# where INSTANCE indicates the instance number of the TPM the VM
-# should be talking to and DOM provides the domain where the backend
-# is located.
-# Note that no two virtual machines should try to connect to the same
-# TPM instance. The handling of all TPM instances does require
-# some management effort in so far that VM configration files (and thus
-# a VM) should be associated with a TPM instance throughout the lifetime
-# of the VM / VM configuration file. The instance number must be
-# greater or equal to 1.
-#vtpm = ['instance=%d,backend=0' % (vmid) ]
-
-#----------------------------------------------------------------------------
 # Set the kernel command line for the new domain.
 # You only need to define the IP parameters and hostname if the domain's
 # IP config doesn't, e.g. in ifcfg-eth0 or via DHCP.
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/examples/xmexample3
--- a/tools/examples/xmexample3	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/examples/xmexample3	Tue Nov 13 10:47:00 2012 +0000
@@ -122,20 +122,6 @@ disk = [ 'phy:hda%d,hda1,w' % (vmid)]
 # configured in xend-config.sxp.
 
 #----------------------------------------------------------------------------
-# Define to which TPM instance the user domain should communicate.
-# The vtpm entry is of the form 'instance=INSTANCE,backend=DOM'
-# where INSTANCE indicates the instance number of the TPM the VM
-# should be talking to and DOM provides the domain where the backend
-# is located.
-# Note that no two virtual machines should try to connect to the same
-# TPM instance. The handling of all TPM instances does require
-# some management effort in so far that VM configration files (and thus
-# a VM) should be associated with a TPM instance throughout the lifetime
-# of the VM / VM configuration file. The instance number must be
-# greater or equal to 1.
-#vtpm = ['instance=%d,backend=0' % (vmid) ]
-
-#----------------------------------------------------------------------------
 # Set the kernel command line for the new domain.
 # You only need to define the IP parameters and hostname if the domain's
 # IP config doesn't, e.g. in ifcfg-eth0 or via DHCP.
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/hotplug/Linux/Makefile
--- a/tools/hotplug/Linux/Makefile	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/hotplug/Linux/Makefile	Tue Nov 13 10:47:00 2012 +0000
@@ -18,14 +18,12 @@ XEN_SCRIPTS += vif-setup
 XEN_SCRIPTS += block
 XEN_SCRIPTS += block-enbd block-nbd
 XEN_SCRIPTS += blktap
-XEN_SCRIPTS += vtpm vtpm-delete
 XEN_SCRIPTS += xen-hotplug-cleanup
 XEN_SCRIPTS += external-device-migrate
 XEN_SCRIPTS += vscsi
 XEN_SCRIPT_DATA = xen-script-common.sh locking.sh logging.sh
 XEN_SCRIPT_DATA += xen-hotplug-common.sh xen-network-common.sh vif-common.sh
-XEN_SCRIPT_DATA += block-common.sh vtpm-common.sh vtpm-hotplug-common.sh
-XEN_SCRIPT_DATA += vtpm-migration.sh vtpm-impl
+XEN_SCRIPT_DATA += block-common.sh
 
 UDEV_RULES_DIR = $(CONFIG_DIR)/udev
 UDEV_RULES = xen-backend.rules xend.rules
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/hotplug/Linux/vtpm
--- a/tools/hotplug/Linux/vtpm	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-#!/bin/bash
-
-dir=$(dirname "$0")
-. "$dir/vtpm-hotplug-common.sh"
-
-vtpm_fatal_error=0
-
-case "$command" in
-  add)
-    vtpm_create_instance
-  ;;
-  remove)
-    vtpm_remove_instance
-  ;;
-esac
-
-if [ $vtpm_fatal_error -eq 0 ]; then
-	log debug "Successful vTPM operation '$command'."
-	success
-else
-	fatal "Error while executing vTPM operation '$command'."
-fi
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/hotplug/Linux/vtpm-common.sh
--- a/tools/hotplug/Linux/vtpm-common.sh	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,448 +0,0 @@
-#
-# Copyright (c) 2005 IBM Corporation
-# Copyright (c) 2005 XenSource Ltd.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of version 2.1 of the GNU Lesser General Public
-# License as published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-#
-
-dir=$(dirname "$0")
-. "$dir/logging.sh"
-. "$dir/locking.sh"
-
-VTPMDB="/var/vtpm/vtpm.db"
-
-#In the vtpm-impl file some commands should be defined:
-#      vtpm_create, vtpm_setup, vtpm_start, etc. (see below)
-if [ -r "$dir/vtpm-impl.alt" ]; then
-	. "$dir/vtpm-impl.alt"
-elif [ -r "$dir/vtpm-impl" ]; then
-	. "$dir/vtpm-impl"
-else
-	function vtpm_create () {
-		true
-	}
-	function vtpm_setup() {
-		true
-	}
-	function vtpm_start() {
-		true
-	}
-	function vtpm_suspend() {
-		true
-	}
-	function vtpm_resume() {
-		true
-	}
-	function vtpm_delete() {
-		true
-	}
-	function vtpm_migrate() {
-		echo "Error: vTPM migration accross machines not implemented."
-	}
-	function vtpm_migrate_local() {
-		echo "Error: local vTPM migration not supported"
-	}
-	function vtpm_migrate_recover() {
-		true
-	}
-fi
-
-
-#Find the instance number for the vtpm given the name of the domain
-# Parameters
-# - vmname : the name of the vm
-# Return value
-#  Returns '0' if instance number could not be found, otherwise
-#  it returns the instance number in the variable 'instance'
-function vtpmdb_find_instance () {
-	local vmname ret instance
-	vmname=$1
-	ret=0
-
-	instance=$(cat $VTPMDB |                   \
-	          awk -vvmname=$vmname             \
-	          '{                               \
-	             if ( 1 != index($1,"#")) {    \
-	               if ( $1 == vmname ) {       \
-	                 print $2;                 \
-	                 exit;                     \
-	               }                           \
-	             }                             \
-	           }')
-	if [ "$instance" != "" ]; then
-		ret=$instance
-	fi
-	echo "$ret"
-}
-
-
-# Check whether a particular instance number is still available
-# returns "0" if it is not available, "1" otherwise.
-function vtpmdb_is_free_instancenum () {
-	local instance instances avail i
-	instance=$1
-	avail=1
-	#Allowed instance number range: 1-255
-	if [ $instance -eq 0 -o $instance -gt 255 ]; then
-		avail=0
-	else
-		instances=$(cat $VTPMDB |                \
-		           awk                          \
-		           '{                            \
-		               if (1 != index($1,"#")) { \
-		                 printf("%s ",$2);       \
-		               }                         \
-		            }')
-		for i in $instances; do
-			if [ $i -eq $instance ]; then
-				avail=0
-				break
-			fi
-		done
-	fi
-	echo "$avail"
-}
-
-
-# Get an available instance number given the database
-# Returns an unused instance number
-function vtpmdb_get_free_instancenum () {
-	local ctr instances don found
-	instances=$(cat $VTPMDB |                \
-	           awk                          \
-	           '{                            \
-	               if (1 != index($1,"#")) { \
-	                 printf("%s ",$2);       \
-	               }                         \
-	            }')
-	ctr=1
-	don=0
-	while [ $don -eq 0 ]; do
-		found=0
-		for i in $instances; do
-			if [ $i -eq $ctr ]; then
-				found=1;
-				break;
-			fi
-		done
-
-		if [ $found -eq 0 ]; then
-			don=1
-			break
-		fi
-		let ctr=ctr+1
-	done
-	echo "$ctr"
-}
-
-
-# Add a domain name and instance number to the DB file
-function vtpmdb_add_instance () {
-	local res vmname inst
-	vmname=$1
-	inst=$2
-
-	if [ ! -f $VTPMDB ]; then
-		echo "#Database for VM to vTPM association" > $VTPMDB
-		echo "#1st column: domain name" >> $VTPMDB
-		echo "#2nd column: TPM instance number" >> $VTPMDB
-	fi
-	res=$(vtpmdb_validate_entry $vmname $inst)
-	if [ $res -eq 0 ]; then
-		echo "$vmname $inst" >> $VTPMDB
-	fi
-}
-
-
-#Validate whether an entry is the same as passed to this
-#function
-function vtpmdb_validate_entry () {
-	local res rc vmname inst
-	rc=0
-	vmname=$1
-	inst=$2
-
-	res=$(cat $VTPMDB |            \
-	     awk -vvmname=$vmname     \
-	          -vinst=$inst         \
-	     '{                        \
-	         if ( 1 == index($1,"#")) {\
-	         } else                \
-	         if ( $1 == vmname &&  \
-	              $2 == inst) {    \
-	            printf("1");       \
-	            exit;              \
-	         } else                \
-	         if ( $1 == vmname ||  \
-	              $2 == inst) {    \
-	            printf("2");       \
-	            exit;              \
-	         }                     \
-	     }')
-
-	if [ "$res" == "1" ]; then
-		rc=1
-	elif [ "$res" == "2" ]; then
-		rc=2
-	fi
-	echo "$rc"
-}
-
-
-#Remove an entry from the vTPM database given its domain name
-#and instance number
-function vtpmdb_remove_entry () {
-	local vmname instance VTPMDB_TMP
-	vmname=$1
-	instance=$2
-	VTPMDB_TMP="$VTPMDB".tmp
-
-	$(cat $VTPMDB |            \
-	 awk -vvmname=$vmname     \
-	 '{                        \
-	    if ( $1 != vmname ) {  \
-	      print $0;            \
-	    }                      \
-	 '} > $VTPMDB_TMP)
-	if [ -e $VTPMDB_TMP ]; then
-		mv -f $VTPMDB_TMP $VTPMDB
-		vtpm_delete $instance
-	else
-		log err "Error creating temporary file '$VTPMDB_TMP'."
-	fi
-}
-
-
-# Find the reason for the creation of this device:
-# Returns 'resume' or 'create'
-function vtpm_get_create_reason () {
-	local resume
-	resume=$(xenstore_read $XENBUS_PATH/resume)
-	if [ "$resume" == "True" ]; then
-		echo "resume"
-	else
-		echo "create"
-	fi
-}
-
-
-#Create a vTPM instance
-# If no entry in the TPM database is found, the instance is
-# created and an entry added to the database.
-function vtpm_create_instance () {
-	local res instance domname reason uuid
-	uuid=$(xenstore_read "$XENBUS_PATH"/uuid)
-	reason=$(vtpm_get_create_reason)
-
-	claim_lock vtpmdb
-
-	instance="0"
-
-	if [ "$uuid" != "" ]; then
-		instance=$(vtpmdb_find_instance $uuid)
-	fi
-	if [ "$instance" == "0" ]; then
-		domname=$(xenstore_read "$XENBUS_PATH"/domain)
-		instance=$(vtpmdb_find_instance $domname)
-	fi
-
-	if [ "$instance" == "0" -a "$reason" != "create" ]; then
-		release_lock vtpmdb
-		return
-	fi
-
-	if [ "$instance" == "0" ]; then
-		#Try to give the preferred instance to the domain
-		instance=$(xenstore_read "$XENBUS_PATH"/pref_instance)
-		if [ "$instance" != "" ]; then
-			res=$(vtpmdb_is_free_instancenum $instance)
-			if [ $res -eq 0 ]; then
-				instance=$(vtpmdb_get_free_instancenum)
-			fi
-		else
-			instance=$(vtpmdb_get_free_instancenum)
-		fi
-
-		vtpm_create $instance
-
-		if [ $vtpm_fatal_error -eq 0 ]; then
-			if [ "$uuid" != "" ]; then
-				vtpmdb_add_instance $uuid $instance
-			else
-				vtpmdb_add_instance $domname $instance
-			fi
-		fi
-	else
-		if [ "$reason" == "resume" ]; then
-			vtpm_resume $instance
-		else
-			vtpm_start $instance
-		fi
-	fi
-
-	release_lock vtpmdb
-
-	xenstore_write $XENBUS_PATH/instance $instance
-}
-
-
-#Remove an instance when a VM is terminating or suspending.
-#Since it is assumed that the VM will appear again, the
-#entry is kept in the VTPMDB file.
-function vtpm_remove_instance () {
-	local instance reason domname uuid
-	#Stop script execution quietly if path does not exist (anymore)
-	xenstore-exists "$XENBUS_PATH"/domain
-	uuid=$(xenstore_read "$XENBUS_PATH"/uuid)
-
-	claim_lock vtpmdb
-
-	instance="0"
-
-	if [ "$uuid" != "" ]; then
-		instance=$(vtpmdb_find_instance $uuid)
-	fi
-
-	if [ "$instance" == "0" ]; then
-		domname=$(xenstore_read "$XENBUS_PATH"/domain)
-		instance=$(vtpmdb_find_instance $domname)
-	fi
-
-	if [ "$instance" != "0" ]; then
-		vtpm_suspend $instance
-	fi
-
-	release_lock vtpmdb
-}
-
-
-#Remove an entry in the VTPMDB file given the domain's name
-#1st parameter: The name of the domain
-function vtpm_delete_instance () {
-	local instance
-
-	claim_lock vtpmdb
-
-	instance=$(vtpmdb_find_instance $1)
-	if [ "$instance" != "0" ]; then
-		vtpmdb_remove_entry $1 $instance
-	fi
-
-	release_lock vtpmdb
-}
-
-# Determine whether the given address is local to this machine
-# Return values:
-#  "-1" : the given machine name is invalid
-#  "0"  : this is not an address of this machine
-#  "1"  : this is an address local to this machine
-function vtpm_isLocalAddress() {
-	local addr res
-	addr=$(ping $1 -c 1 |  \
-	       awk '{ print substr($3,2,length($3)-2); exit }')
-	if [ "$addr" == "" ]; then
-		echo "-1"
-		return
-	fi
-	res=$(ifconfig | grep "inet addr" |  \
-	     awk -vaddr=$addr               \
-	     '{                              \
-	        if ( addr == substr($2, 6)) {\
-	          print "1";                 \
-	        }                            \
-	     }'                              \
-	    )
-	if [ "$res" == "" ]; then
-		echo "0"
-		return
-	fi
-	echo "1"
-}
-
-# Perform a migration step. This function differentiates between migration
-# to the local host or to a remote machine.
-# Parameters:
-# 1st: destination host to migrate to
-# 2nd: name of the domain to migrate
-# 3rd: the migration step to perform
-function vtpm_migration_step() {
-	local res=$(vtpm_isLocalAddress $1)
-	if [ "$res" == "0" ]; then
-		vtpm_migrate $1 $2 $3
-	else
-		vtpm_migrate_local
-	fi
-}
-
-# Recover from migration due to an error. This function differentiates
-# between migration to the local host or to a remote machine.
-# Parameters:
-# 1st: destination host the migration was going to
-# 2nd: name of the domain that was to be migrated
-# 3rd: the last successful migration step that was done
-function vtpm_recover() {
-	local res
-	res=$(vtpm_isLocalAddress $1)
-	if [ "$res" == "0" ]; then
-		vtpm_migrate_recover $1 $2 $3
-	fi
-}
-
-
-#Determine the domain id given a domain's name.
-#1st parameter: name of the domain
-#return value: domain id  or -1 if domain id could not be determined
-function vtpm_domid_from_name () {
-	local id name ids
-	ids=$(xenstore-list /local/domain)
-	for id in $ids; do
-		name=$(xenstore-read /local/domain/$id/name)
-		if [ "$name" == "$1" ]; then
-			echo "$id"
-			return
-		fi
-	done
-	echo "-1"
-}
-
-#Determine the virtual TPM's instance number using the domain ID.
-#1st parm: domain ID
-function vtpm_uuid_by_domid() {
-	echo $(xenstore-read /local/domain/0/backend/vtpm/$1/0/uuid)
-}
-
-
-# Determine the vTPM's UUID by the name of the VM
-function vtpm_uuid_from_vmname() {
-	local domid=$(vtpm_domid_from_name $1)
-	if [ "$domid" != "-1" ]; then
-		echo $(vtpm_uuid_by_domid $domid)
-		return
-	fi
-	echo ""
-}
-
-#Add a virtual TPM instance number and its associated domain name
-#to the VTPMDB file and activate usage of this virtual TPM instance
-#by writing the instance number into the xenstore
-#1st parm: name of virtual machine
-#2nd parm: instance of associated virtual TPM
-function vtpm_add_and_activate() {
-	local domid=$(vtpm_domid_from_name $1)
-	local vtpm_uuid=$(vtpm_uuid_from_vmname $1)
-	if [ "$vtpm_uuid" != "" -a "$domid" != "-1" ]; then
-		vtpmdb_add_instance $vtpm_uuid $2
-		xenstore-write backend/vtpm/$domid/0/instance $2
-	fi
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/hotplug/Linux/vtpm-delete
--- a/tools/hotplug/Linux/vtpm-delete	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-# This scripts must be called the following way:
-# vtpm-delete <vtpm uuid>
-# or
-# vtpm-delete --vmname <vm name>
-
-dir=$(dirname "$0")
-. "$dir/vtpm-common.sh"
-
-if [ "$1" == "--vmname" ]; then
-	vtpm_uuid=$(vtpm_uuid_from_vmname $2)
-	if [ "$vtpm_uuid" != "" ];then
-		vtpm_delete_instance $vtpm_uuid
-	fi
-else
-	vtpm_delete_instance $1
-fi
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/hotplug/Linux/vtpm-hotplug-common.sh
--- a/tools/hotplug/Linux/vtpm-hotplug-common.sh	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-#
-# Copyright (c) 2005 IBM Corporation
-# Copyright (c) 2005 XenSource Ltd.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of version 2.1 of the GNU Lesser General Public
-# License as published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-#
-
-dir=$(dirname "$0")
-. "$dir/xen-hotplug-common.sh"
-
-findCommand "$@"
-if [ "$command" != "online" ]  &&
-   [ "$command" != "offline" ] &&
-   [ "$command" != "add" ]     &&
-   [ "$command" != "remove" ]
-then
-	log err "Invalid command: $command"
-	exit 1
-fi
-
-
-XENBUS_PATH="${XENBUS_PATH:?}"
-
-. "$dir/vtpm-common.sh"
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/hotplug/Linux/vtpm-impl
--- a/tools/hotplug/Linux/vtpm-impl	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-#!/bin/bash
-# ===================================================================
-# 
-# Copyright (c) 2005, Intel Corp.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-#   * Redistributions of source code must retain the above copyright 
-#     notice, this list of conditions and the following disclaimer.
-#   * 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.
-#   * Neither the name of Intel Corporation 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 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.
-# ===================================================================
-
-#            |        SRC        |    TAG  |      CMD SIZE     |        ORD       |mtype|strt
-TPM_CMD_OPEN=\\x00\\x00\\x00\\x00\\x01\\xc1\\x00\\x00\\x00\\x11\\x01\\x00\\x00\\x01\\x01\\x01
-TPM_CMD_RESM=\\x00\\x00\\x00\\x00\\x01\\xc1\\x00\\x00\\x00\\x11\\x01\\x00\\x00\\x01\\x01\\x02
-TPM_CMD_CLOS=\\x00\\x00\\x00\\x00\\x01\\xc1\\x00\\x00\\x00\\x0e\\x01\\x00\\x00\\x02
-TPM_CMD_DELE=\\x00\\x00\\x00\\x00\\x01\\xc1\\x00\\x00\\x00\\x0e\\x01\\x00\\x00\\x03
-
-TPM_TYPE_PVM=\\x01
-TPM_TYPE_HVM=\\x02
-
-TPM_SUCCESS=00000000
-
-TX_VTPM_MANAGER=/var/vtpm/fifos/from_console.fifo
-RX_VTPM_MANAGER=/var/vtpm/fifos/to_console.fifo
-
-VTPM_MIG=/usr/bin/vtpm_migrator
-
-# -------------------- Helpers for binary streams -----------
-
-function str_to_hex32() {
- printf "%0.8x" $1
-}
-
-function hex32_to_bin() {
- local inst=$(str_to_hex32 $1);
- 
- local n1=`echo $inst | sed 's/\(..\)....../\\\\x\1/'`
- local n2=`echo $inst | sed 's/..\(..\)..../\\\\x\1/'`
- local n3=`echo $inst | sed 's/....\(..\)../\\\\x\1/'`
- local n4=`echo $inst | sed 's/......\(..\)/\\\\x\1/'`
-
- echo "$n1$n2$n3$n4"
-}
-
-function vtpm_manager_cmd() {
- local cmd=$1;
- local inst=$2;
- local inst_bin=$(hex32_to_bin $inst);
-
- claim_lock vtpm_mgr
-
- #send cmd to vtpm_manager
- printf "$cmd$inst_bin" > $TX_VTPM_MANAGER
-
- #recv response
- set +e
- local resp_hex=`dd skip=10 bs=1 count=4 if=$RX_VTPM_MANAGER 2> /dev/null | xxd -ps`
- set -e
-
- release_lock vtpm_mgr
-
- #return whether the command was successful
- if [ $resp_hex -ne $TPM_SUCCESS ]; then
-   vtpm_fatal_error=1
-   false
-  else
-   true
- fi
-}
-
-# Helper to get vm type to pass to vtpm_manager open/resume
-function vtpm_get_type() {
- local inst=$(xenstore_read $XENBUS_PATH/frontend-id)
- local vm=$(xenstore_read /local/domain/$inst/vm)
- if [ "$vm" != "" ]; then
-  local ostype=$(xenstore-read $vm/image/ostype)
-  if [ "$ostype" == "hvm" ]; then
-   echo $TPM_TYPE_HVM;
-  else
-   echo $TPM_TYPE_PVM;
-  fi
- fi
-}
-
-# ------------------ Command handlers -----------------
-
-# Create new vtpm instance & set it up for use
-function vtpm_create () {
- # Creation is handled implicitly by the manager on first setup
- # so just set it up for use
- $(vtpm_start $1)
-}
-
-# Setup vtpm instance for use.
-function vtpm_start() {
- local vmtype=$(vtpm_get_type);
- $(vtpm_manager_cmd $TPM_CMD_OPEN$vmtype $1)
-}
-
-function vtpm_resume() {
- local vmtype=$(vtpm_get_type);
- $(vtpm_manager_cmd $TPM_CMD_RESM$vmtype $1)
-}
-
-# Reset the vtpm AKA clear PCRs
-function vtpm_reset() {
- #not used by current implemenation
- true
-}
-
-# Shutdown the vtpm while the vm is down
-# This could be a suspend of shutdown
-# we cannot distinquish, so save the state
-# and decide on startup if we should keep is
-function vtpm_suspend() {
- $(vtpm_manager_cmd $TPM_CMD_CLOS $1)
-}
-
-
-function vtpm_delete() {
- local inst=$1
- if $(vtpm_manager_cmd $TPM_CMD_DELE $inst); then
-   rm -f /var/vtpm/vtpm_dm_$1.data
-   true
- else 
-   vtpm_fatal_error=1
-   false
- fi
-}
-
-# Perform a migration step. This function differentiates between migration
-# to the local host or to a remote machine.
-# Parameters:
-# 1st: destination host to migrate to
-# 2nd: name of the domain to migrate
-# 3rd: the migration step to perform
-function vtpm_migrate() {
- local instance res
-
- instance=$(vtpmdb_find_instance $2)
- if [ "$instance" == "" ]; then
-  log err "VTPM Migratoin failed. Unable to translation of domain name"
-  echo "Error: VTPM Migration failed while looking up instance number"
- fi
-
- case "$3" in
-  0)
-   #Incicate migration supported
-   echo "0" 
-  ;;
-
-  1)
-   # Get Public Key from Destination
-   # Call vtpm_manager's migration part 1
-   claim_lock vtpm_mgr
-   $VTPM_MIG $1 $2 $instance $3
-   release_lock vtpm_mgr
-  ;;
-
-  2)
-   # Call manager's migration step 2 and send result to destination
-   # If successful remove from db
-   claim_lock vtpm_mgr
-   $VTPM_MIG $1 $2 $instance $3
-   release_lock vtpm_mgr
-  ;;
-
-  3)
-   if `ps x | grep "$VTPM_MIG $1"`; then
-    log err "VTPM Migration failed to complete."
-    echo "Error: VTPM Migration failed to complete."
-   fi
-  ;;
- esac
- 
-}
-
-
-function vtpm_migrate_recover() {
- echo "Error: Recovery not supported yet" 
-}
-
-function vtpm_migrate_local() {
- echo "Error: local vTPM migration not supported"
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/hotplug/Linux/vtpm-migration.sh
--- a/tools/hotplug/Linux/vtpm-migration.sh	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-#
-# Copyright (c) 2005 IBM Corporation
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of version 2.1 of the GNU Lesser General Public
-# License as published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-#
-
-dir=$(dirname "$0")
-. "$dir/vtpm-common.sh"
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/hotplug/Linux/xen-backend.rules
--- a/tools/hotplug/Linux/xen-backend.rules	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/hotplug/Linux/xen-backend.rules	Tue Nov 13 10:47:00 2012 +0000
@@ -1,6 +1,5 @@
 SUBSYSTEM=="xen-backend", KERNEL=="tap*", ENV{UDEV_CALL}="1", RUN+="/etc/xen/scripts/blktap $env{ACTION}"
 SUBSYSTEM=="xen-backend", KERNEL=="vbd*", ENV{UDEV_CALL}="1", RUN+="/etc/xen/scripts/block $env{ACTION}"
-SUBSYSTEM=="xen-backend", KERNEL=="vtpm*", RUN+="/etc/xen/scripts/vtpm $env{ACTION}"
 SUBSYSTEM=="xen-backend", KERNEL=="vif2-*", RUN+="/etc/xen/scripts/vif2 $env{ACTION}"
 SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ENV{UDEV_CALL}="1", ACTION=="online", RUN+="/etc/xen/scripts/vif-setup online type_if=vif"
 SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ENV{UDEV_CALL}="1", ACTION=="offline", RUN+="/etc/xen/scripts/vif-setup offline type_if=vif"
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm/Makefile
--- a/tools/vtpm/Makefile	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-XEN_ROOT = $(CURDIR)/../..
-
-# Base definitions and rules
-include $(XEN_ROOT)/tools/vtpm/Rules.mk
-
-# Dir name for emulator (as dom0 tpm driver)
-TPM_EMULATOR_DIR = tpm_emulator
-# Dir name for vtpm instance
-VTPM_DIR = vtpm
-ORIG_DIR = orig
-
-# Emulator tarball name
-TPM_EMULATOR_NAME = tpm_emulator-0.5.1
-TPM_EMULATOR_TARFILE = $(TPM_EMULATOR_NAME).tar.gz
-
-GMP_HEADER = /usr/include/gmp.h
-
-.PHONY: all
-all: build
-
-.PHONY: build
-build: build_sub
-
-.PHONY: install
-install: build
-	$(MAKE) -C $(VTPM_DIR) install-recursive
-
-.PHONY: clean
-clean:
-	@if [ -d $(TPM_EMULATOR_DIR) ]; \
-		then $(MAKE) -C $(TPM_EMULATOR_DIR) clean; \
-	fi
-	@if [ -d $(VTPM_DIR) ]; \
-		then $(MAKE) -C $(VTPM_DIR) clean; \
-	fi
-
-.PHONY: mrproper
-mrproper:
-	rm -f $(TPM_EMULATOR_TARFILE) tpm_emulator.patch.old vtpm.patch.old
-	rm -rf $(TPM_EMULATOR_DIR) $(VTPM_DIR) $(ORIG_DIR)
-
-# Download Swiss emulator
-$(TPM_EMULATOR_TARFILE):
-	wget http://download.berlios.de/tpm-emulator/$(TPM_EMULATOR_TARFILE)
-
-# Create vtpm dirs
-$(VTPM_DIR)/tpmd/tpmd: $(TPM_EMULATOR_TARFILE) vtpm-0.5.1.patch
-	rm -rf $(VTPM_DIR)
-	tar -xzf $(TPM_EMULATOR_TARFILE)
-	mv $(TPM_EMULATOR_NAME) $(VTPM_DIR)
-
-	set -e; cd $(VTPM_DIR); \
-	patch -p1 < ../vtpm-0.5.1.patch; \
-	patch -p1 < ../vtpm-0.5.1-LDLIBS.patch
-
-orig: $(TPM_EMULATOR_TARFILE)
-	mkdir $(ORIG_DIR);
-	set -e; cd $(ORIG_DIR); \
-	tar -xzf ../$(TPM_EMULATOR_TARFILE);
-
-updatepatches: clean orig
-	find $(VTPM_DIR) -name "*.orig" -print | xargs rm -f; 
-	mv vtpm.patch vtpm.patch.old; 
-	diff -uprN $(TPM_EMULATOR_DIR) $(VTPM_DIR) > vtpm.patch || true;
-
-.PHONY: build_sub
-build_sub: $(VTPM_DIR)/tpmd/tpmd
-	set -e; if [ -e $(GMP_HEADER) ]; then \
-		$(MAKE) -C $(VTPM_DIR) version; \
-		$(MAKE) -C $(VTPM_DIR) all-recursive; \
-	else \
-		echo "=== Unable to build VTPMs. libgmp could not be found."; \
-	fi
-
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm/README
--- a/tools/vtpm/README	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-
-Directory Structure
-===================
-tools/vtpm/tpm_emulator-0.2b.tar.gz    -> TPM Emulator downloaded at build time that will
-                                          be patched and used for our vtpms
-tools/vtpm/vtpm.patch                  -> patch applied to tpm_emulator to make vtpm
-tools/vtpm/vtpm/                       -> (created on build) tpm_emulator moved to ring 3,
-                                          listens on a pair of fifos for TPM commands,
-                                          persistent state is sent via named fifo to vtpm
-                                            manager, which encrypts it and protects it.
-tools/vtpm/tpm_emulator.patch          -> To allow for debugging and testing on non-TPM
-                                          platforms, this patches the emulator to allow
-                                          it to be inserted into the dom0 kernel
-tools/vtpm/tpm_emulator-0.2            -> (created on build) directory containing patched emulator
-
-Compile Flags
-===================
-VTPM_MULTI_VM                -> Defined (not finished): VTPMs run in their own VMs
-                                Not Defined (default): VTPMs are processes
-
-Requirements
-============
-- xen-unstable 
-- IBM frontend/backend vtpm driver patch
-- vtpm_managerd
-- GNU MP Big number library (GMP)
-
-vtpmd Flow (for vtpm_manager. vtpmd never run by default)
-============================
-- Launch the VTPM manager (vtpm_managerd) which which begins listening to the BE with one thread
-  and listens to a named fifo that is shared by the vtpms to commuincate with the manager.
-- VTPM Manager listens to TPM BE.
-- When xend launches a tpm frontend equipped VM it contacts the manager over the vtpm backend. 
-- When the manager receives the open message from the BE, it launches a vtpm
-- Xend allows the VM to continue booting. 
-- When a TPM request is issued to the front end, the front end transmits the TPM request to the backend.
-- The manager receives the TPM requests and uses a named fifo to forward the request to the vtpm.
-- The fifo listener begins listening for the reply from vtpm for the request.
-- Vtpm processes request and replies to manager over shared named fifo.
-- If needed, the vtpm may send a request to the vtpm_manager at any time to save it's secrets to disk.
-- Manager receives response from vtpm and passes it back to backend for forwarding to guest.
-
-tpm_emulator flow
-==================
-Read documentation in tpm_emulator-0.2 directory
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm/Rules.mk
--- a/tools/vtpm/Rules.mk	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-# Base definitions and rules (XEN_ROOT must be defined in including Makefile)
-include $(XEN_ROOT)/tools/Rules.mk
-
-#
-# Tool definitions
-#
-
-# General compiler flags
-CFLAGS   = -Werror -g3
-
-# Generic project files
-HDRS	= $(wildcard *.h)
-SRCS	= $(wildcard *.c)
-OBJS	= $(patsubst %.c,%.o,$(SRCS))
-
-# Generic (non-header) dependencies
-$(SRCS): Makefile $(XEN_ROOT)/tools/Rules.mk $(XEN_ROOT)/tools/vtpm/Rules.mk
-
-$(OBJS): $(SRCS)
-
--include $(DEPS)
-
-BUILD_EMULATOR = y
-
-# Make sure these are just rules
-.PHONY : all build install clean
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm/tpm_emulator.patch
--- a/tools/vtpm/tpm_emulator.patch	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1919 +0,0 @@
-diff -uprN orig/tpm_emulator-0.4/AUTHORS tpm_emulator/AUTHORS
---- orig/tpm_emulator-0.4/AUTHORS	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/AUTHORS	2006-07-24 14:35:35.000000000 -0700
-@@ -1,2 +1,3 @@
- Mario Strasser <mast@gmx.net>
- Heiko Stamer <stamer@gaos.org> [DAA]
-+INTEL Corp <> [Dropped to Ring3]
-diff -uprN orig/tpm_emulator-0.4/ChangeLog tpm_emulator/ChangeLog
---- orig/tpm_emulator-0.4/ChangeLog	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/ChangeLog	2006-07-24 14:35:35.000000000 -0700
-@@ -1,3 +1,6 @@
-+????-??-?? Intel Corp
-+	* Moved module out of kernel to run as a ring 3 app
-+
- 2006-06-23  Mario Strasser <mast@gmx.net>
- 	* tpm_startup.c: behaviour of ST_CLEAR and storage of
- 		persistent data adapted
-diff -uprN orig/tpm_emulator-0.4/crypto/gmp_kernel_wrapper.c tpm_emulator/crypto/gmp_kernel_wrapper.c
---- orig/tpm_emulator-0.4/crypto/gmp_kernel_wrapper.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/crypto/gmp_kernel_wrapper.c	2006-07-24 14:35:35.000000000 -0700
-@@ -1,5 +1,6 @@
- /* Software-Based Trusted Platform Module (TPM) Emulator for Linux
-  * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
-+ * Copyright (C) 2005 INTEL Corp
-  *
-  * This module is free software; you can redistribute it and/or modify
-  * it under the terms of the GNU General Public License as published
-@@ -24,15 +25,10 @@ int __gmp_junk;
- void __attribute__ ((regparm(0))) __gmp_assert_fail(const char *filename, 
-   int linenum, const char *expr) 
- {
--  panic(KERN_CRIT TPM_MODULE_NAME "%s:%d: GNU MP assertion failed: %s\n", 
-+  error("%s:%d: GNU MP assertion failed: %s\n", 
-     filename, linenum, expr);
- }
- 
--void __attribute__ ((regparm(0))) abort(void)
--{
--  panic(KERN_CRIT TPM_MODULE_NAME "GNU MP abort() was called\n");
--}
--
- /* overwrite GNU MP random functions (used by mpz/millerrabin.c) */ 
- 
- void __attribute__ ((regparm(0))) gmp_randinit(gmp_randstate_t rstate, 
-@@ -77,20 +73,19 @@ void __attribute__ ((regparm(0))) mpz_ur
- 
- void __attribute__ ((regparm(0))) *kernel_allocate(size_t size)
- {
--  void *ret  = (void*)kmalloc(size, GFP_KERNEL);
--  if (!ret) panic(KERN_CRIT TPM_MODULE_NAME 
--    "GMP: cannot allocate memory (size=%u)\n", size);
-+  void *ret  = (void*)malloc(size);
-+  if (!ret) error("GMP: cannot allocate memory (size=%Zu)\n", size);
-   return ret;
- }
- 
- void __attribute__ ((regparm(0))) *kernel_reallocate(void *oldptr, 
-   size_t old_size, size_t new_size)
- {
--  void *ret = (void*)kmalloc(new_size, GFP_KERNEL);
--  if (!ret) panic(KERN_CRIT TPM_MODULE_NAME "GMP: Cannot reallocate memory "
--    "(old_size=%u new_size=%u)\n", old_size, new_size);
-+  void *ret = (void*)malloc(new_size);
-+  if (!ret) error("GMP: Cannot reallocate memory "
-+    "(old_size=%Zu new_size=%Zu)\n", old_size, new_size);
-   memcpy(ret, oldptr, old_size);
--  kfree(oldptr);
-+  free(oldptr);
-   return ret;
- }
- 
-@@ -99,7 +94,7 @@ void __attribute__ ((regparm(0))) kernel
-   /* overwrite used memory */
-   if (blk_ptr != NULL) { 
-     memset(blk_ptr, 0, blk_size);
--    kfree(blk_ptr);
-+    free(blk_ptr);
-   }
- }
- 
-diff -uprN orig/tpm_emulator-0.4/crypto/rsa.c tpm_emulator/crypto/rsa.c
---- orig/tpm_emulator-0.4/crypto/rsa.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/crypto/rsa.c	2006-07-24 14:35:35.000000000 -0700
-@@ -1,5 +1,6 @@
- /* Software-Based Trusted Platform Module (TPM) Emulator for Linux
-  * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
-+ * Copyright (C) 2005 INTEL Corp
-  *
-  * This module is free software; you can redistribute it and/or modify
-  * it under the terms of the GNU General Public License as published
-@@ -381,7 +382,7 @@ static int encode_message(int type, uint
-       msg[0] = 0x00;
-       get_random_bytes(&msg[1], SHA1_DIGEST_LENGTH);
-       sha1_init(&ctx);
--      sha1_update(&ctx, "TCPA", 4);
-+      sha1_update(&ctx, (uint8_t *) "TCPA", 4);
-       sha1_final(&ctx, &msg[1 + SHA1_DIGEST_LENGTH]);
-       memset(&msg[1 + 2 * SHA1_DIGEST_LENGTH], 0x00, 
-         msg_len - data_len - 2 * SHA1_DIGEST_LENGTH - 2);
-@@ -429,7 +430,7 @@ static int decode_message(int type, uint
-       mask_generation(&msg[1], SHA1_DIGEST_LENGTH,
-         &msg[1 + SHA1_DIGEST_LENGTH], msg_len - SHA1_DIGEST_LENGTH - 1);
-       sha1_init(&ctx);
--      sha1_update(&ctx, "TCPA", 4);
-+      sha1_update(&ctx, (uint8_t *) "TCPA", 4);
-       sha1_final(&ctx, &msg[1]);
-       if (memcmp(&msg[1], &msg[1 + SHA1_DIGEST_LENGTH], 
-           SHA1_DIGEST_LENGTH) != 0) return -1;
-diff -uprN orig/tpm_emulator-0.4/linux_module.c tpm_emulator/linux_module.c
---- orig/tpm_emulator-0.4/linux_module.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/linux_module.c	1969-12-31 16:00:00.000000000 -0800
-@@ -1,195 +0,0 @@
--/* Software-Based Trusted Platform Module (TPM) Emulator for Linux 
-- * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
-- *
-- * This module 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 module 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.
-- *
-- * $Id: linux_module.c 91 2006-03-13 13:51:41Z mast $
-- */
--
--#include <linux/module.h>
--#include <linux/kernel.h>
--#include <linux/init.h>
--#include <linux/miscdevice.h>
--#include <linux/poll.h>
--#include "linux_module.h"
--#include "tpm/tpm_emulator.h"
--
--MODULE_LICENSE("GPL");
--MODULE_AUTHOR("Mario Strasser <mast@gmx.net>");
--MODULE_DESCRIPTION("Trusted Platform Module (TPM) Emulator");
--MODULE_SUPPORTED_DEVICE(TPM_DEVICE_NAME);
--
--/* module startup parameters */
--char *startup = "save";
--module_param(startup, charp, 0444);
--MODULE_PARM_DESC(startup, " Sets the startup mode of the TPM. "
--  "Possible values are 'clear', 'save' (default) and 'deactivated.");
--char *storage_file = "/var/tpm/tpm_emulator-1.2.0.2";
--module_param(storage_file, charp, 0644);
--MODULE_PARM_DESC(storage_file, " Sets the persistent-data storage " 
--  "file of the TPM.");
--
--/* TPM lock */
--static struct semaphore tpm_mutex;
--
--/* TPM command response */
--static struct {
--  uint8_t *data;
--  uint32_t size;
--} tpm_response;
--
--/* module state */
--#define STATE_IS_OPEN 0
--static uint32_t module_state;
--static struct timespec old_time;
--
--static int tpm_open(struct inode *inode, struct file *file)
--{
--  debug("%s()", __FUNCTION__);
--  if (test_and_set_bit(STATE_IS_OPEN, (void*)&module_state)) return -EBUSY;
--  return 0;
--}
--
--static int tpm_release(struct inode *inode, struct file *file)
--{
--  debug("%s()", __FUNCTION__);
--  clear_bit(STATE_IS_OPEN, (void*)&module_state);
--  down(&tpm_mutex);
--  if (tpm_response.data != NULL) {
--    kfree(tpm_response.data);
--    tpm_response.data = NULL;
--  }
--  up(&tpm_mutex);
--  return 0;
--}
--
--static ssize_t tpm_read(struct file *file, char *buf, size_t count, loff_t *ppos)
--{
--  debug("%s(%d)", __FUNCTION__, count);
--  down(&tpm_mutex);
--  if (tpm_response.data != NULL) {
--    count = min(count, (size_t)tpm_response.size - (size_t)*ppos);
--    count -= copy_to_user(buf, &tpm_response.data[*ppos], count);
--    *ppos += count;
--    if ((size_t)tpm_response.size == (size_t)*ppos) {
--      kfree(tpm_response.data);
--      tpm_response.data = NULL;
--    }
--  } else {
--    count = 0;
--  }
--  up(&tpm_mutex);
--  return count;
--}
--
--static ssize_t tpm_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
--{
--  debug("%s(%d)", __FUNCTION__, count);
--  down(&tpm_mutex);
--  *ppos = 0;
--  if (tpm_response.data != NULL) kfree(tpm_response.data);
--  if (tpm_handle_command(buf, count, &tpm_response.data, 
--                         &tpm_response.size) != 0) { 
--    count = -EILSEQ;
--    tpm_response.data = NULL;
--  }
--  up(&tpm_mutex);
--  return count;
--}
--
--#define TPMIOC_CANCEL   _IO('T', 0x00)
--#define TPMIOC_TRANSMIT _IO('T', 0x01)
--
--static int tpm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
--{
--  debug("%s(%d, %p)", __FUNCTION__, cmd, (char*)arg);
--  if (cmd == TPMIOC_TRANSMIT) {
--    uint32_t count = ntohl(*(uint32_t*)(arg + 2));
--    down(&tpm_mutex);
--    if (tpm_response.data != NULL) kfree(tpm_response.data);
--    if (tpm_handle_command((char*)arg, count, &tpm_response.data,
--                           &tpm_response.size) == 0) {
--      tpm_response.size -= copy_to_user((char*)arg, tpm_response.data,
--                            tpm_response.size);
--      kfree(tpm_response.data);
--      tpm_response.data = NULL;
--    } else {
--      tpm_response.size = 0;
--      tpm_response.data = NULL;
--    }
--    up(&tpm_mutex);
--    return tpm_response.size;
--  }
--  return -1;
--}
--
--struct file_operations fops = {
--  .owner   = THIS_MODULE,
--  .open    = tpm_open,
--  .release = tpm_release,
--  .read    = tpm_read,
--  .write   = tpm_write,
--  .ioctl   = tpm_ioctl,
--};
--
--static struct miscdevice tpm_dev = {
--  .minor      = TPM_DEVICE_MINOR, 
--  .name       = TPM_DEVICE_NAME, 
--  .fops       = &fops,
--};
--
--int __init init_tpm_module(void)
--{
--  int res = misc_register(&tpm_dev);
--  if (res != 0) {
--    error("misc_register() failed for minor %d\n", TPM_DEVICE_MINOR);
--    return res;
--  }
--  /* initialize variables */
--  sema_init(&tpm_mutex, 1);
--  module_state = 0;
--  tpm_response.data = NULL;
--  old_time = current_kernel_time();
--  /* initialize TPM emulator */
--  if (!strcmp(startup, "clear")) {
--    tpm_emulator_init(1);
--  } else if (!strcmp(startup, "save")) {
--    tpm_emulator_init(2);
--  } else if (!strcmp(startup, "deactivated")) {
--    tpm_emulator_init(3);
--  } else {
--    error("invalid startup mode '%s'; must be 'clear', "
--      "'save' (default) or 'deactivated", startup);
--    misc_deregister(&tpm_dev);
--    return -EINVAL;
--  }
--  return 0;
--}
--
--void __exit cleanup_tpm_module(void)
--{
--  tpm_emulator_shutdown();
--  misc_deregister(&tpm_dev);
--  if (tpm_response.data != NULL) kfree(tpm_response.data);
--}
--
--module_init(init_tpm_module);
--module_exit(cleanup_tpm_module);
--
--uint64_t tpm_get_ticks(void)
--{
--  struct timespec new_time = current_kernel_time();
--  uint64_t ticks = (uint64_t)(new_time.tv_sec - old_time.tv_sec) * 1000000
--                   + (new_time.tv_nsec - old_time.tv_nsec) / 1000;
--  old_time = new_time;
--  return (ticks > 0) ? ticks : 1;
--}
--
-diff -uprN orig/tpm_emulator-0.4/linux_module.h tpm_emulator/linux_module.h
---- orig/tpm_emulator-0.4/linux_module.h	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/linux_module.h	2006-07-24 14:35:35.000000000 -0700
-@@ -1,5 +1,6 @@
- /* Software-Based Trusted Platform Module (TPM) Emulator for Linux
-  * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
-+ * Copyright (C) 2005 INTEL Corp
-  *
-  * This module is free software; you can redistribute it and/or modify
-  * it under the terms of the GNU General Public License as published
-@@ -17,54 +18,62 @@
- #ifndef _LINUX_MODULE_H_
- #define _LINUX_MODULE_H_
- 
--#include <linux/version.h>
--#include <linux/kernel.h>
--#include <linux/slab.h>
-+#include <malloc.h>
-+#include <stdint.h>
-+#include <stdio.h>
-+#include <string.h>
- #include <linux/types.h>
--#include <linux/string.h>
--#include <linux/random.h>
--#include <linux/time.h>
--#include <asm/byteorder.h>
- 
--/* module settings */
-+#include <endian.h>
-+#define __BYTEORDER_HAS_U64__
-+#ifdef LITTLE_ENDIAN
-+ #include <linux/byteorder/little_endian.h>
-+#else
-+ #include <linux/byteorder/big_endian.h>
-+#endif
- 
-+/* module settings */
-+#define min(A,B) ((A)<(B)?(A):(B))
-+#ifndef STR
- #define STR(s) __STR__(s)
- #define __STR__(s) #s
-+#endif
- #include "tpm_version.h"
- 
- #define TPM_DEVICE_MINOR  224
- #define TPM_DEVICE_NAME   "tpm"
- #define TPM_MODULE_NAME   "tpm_emulator"
- 
--/* debug and log output functions */
--
- #ifdef DEBUG
--#define debug(fmt, ...) printk(KERN_DEBUG "%s %s:%d: Debug: " fmt "\n", \
--                        TPM_MODULE_NAME, __FILE__, __LINE__, ## __VA_ARGS__)
-+#define debug(fmt, ...) printf("TPMD: %s:%d: Debug: " fmt "\n", \
-+                        __FILE__, __LINE__, ## __VA_ARGS__)
- #else
- #define debug(fmt, ...) 
- #endif
--#define info(fmt, ...)  printk(KERN_INFO "%s %s:%d: Info: " fmt "\n", \
--                        TPM_MODULE_NAME, __FILE__, __LINE__, ## __VA_ARGS__)
--#define error(fmt, ...) printk(KERN_ERR "%s %s:%d: Error: " fmt "\n", \
--                        TPM_MODULE_NAME, __FILE__, __LINE__, ## __VA_ARGS__)
--#define alert(fmt, ...) printk(KERN_ALERT "%s %s:%d: Alert: " fmt "\n", \
--                        TPM_MODULE_NAME, __FILE__, __LINE__, ## __VA_ARGS__)
-+#define info(fmt, ...)  printf("TPMD: %s:%d: Info: " fmt "\n", \
-+                        __FILE__, __LINE__, ## __VA_ARGS__)
-+#define error(fmt, ...) printf("TPMD: %s:%d: Error: " fmt "\n", \
-+                        __FILE__, __LINE__, ## __VA_ARGS__)
-+#define alert(fmt, ...) printf("TPMD: %s:%d: Alert: " fmt "\n", \
-+                        __FILE__, __LINE__, ## __VA_ARGS__)
- 
- /* memory allocation */
- 
- static inline void *tpm_malloc(size_t size) 
- {
--  return kmalloc(size, GFP_KERNEL);  
-+  return malloc(size);  
- }
- 
- static inline void tpm_free(const void *ptr)
- {
--  if (ptr != NULL) kfree(ptr);
-+  if (ptr != NULL) free( (void *) ptr);
- }
- 
- /* random numbers */
- 
-+//FIXME;
-+void get_random_bytes(void *buf, int nbytes);
-+
- static inline void tpm_get_random_bytes(void *buf, int nbytes)
- {
-   get_random_bytes(buf, nbytes);
-@@ -84,9 +93,9 @@ uint64_t tpm_get_ticks(void);
- #define CPU_TO_LE16(x) __cpu_to_le16(x)
- 
- #define BE64_TO_CPU(x) __be64_to_cpu(x)
--#define LE64_TO_CPU(x) __be64_to_cpu(x)
-+#define LE64_TO_CPU(x) __le64_to_cpu(x)
- #define BE32_TO_CPU(x) __be32_to_cpu(x)
--#define LE32_TO_CPU(x) __be32_to_cpu(x)
-+#define LE32_TO_CPU(x) __le32_to_cpu(x)
- #define BE16_TO_CPU(x) __be16_to_cpu(x)
- #define LE16_TO_CPU(x) __le16_to_cpu(x)
- 
-diff -uprN orig/tpm_emulator-0.4/Makefile tpm_emulator/Makefile
---- orig/tpm_emulator-0.4/Makefile	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/Makefile	2006-07-24 14:35:35.000000000 -0700
-@@ -1,24 +1,40 @@
- # Software-Based Trusted Platform Module (TPM) Emulator for Linux
- # Copyright (C) 2004 Mario Strasser <mast@gmx.net>
-+# Copyright (C) 2006 INTEL Corp.
- #
- # $Id: Makefile 115 2006-06-23 10:36:44Z mast $
- 
--# kernel settings
--KERNEL_RELEASE := $(shell uname -r)
--KERNEL_BUILD   := /lib/modules/$(KERNEL_RELEASE)/build
--MOD_SUBDIR     := misc
-+COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/)
- 
- # module settings
--MODULE_NAME    := tpm_emulator
-+BIN            := tpm_emulator
- VERSION_MAJOR  := 0
- VERSION_MINOR  := 4
- VERSION_BUILD  := $(shell date +"%s")
- 
--# enable/disable DEBUG messages
--EXTRA_CFLAGS   += -Wall -DDEBUG -g  
-+# Installation program and options
-+INSTALL         = install
-+INSTALL_PROG    = $(INSTALL) -m0755
-+INSTALL_DIR     = $(INSTALL) -d -m0755
-+
-+# Xen tools installation directory
-+TOOLS_INSTALL_DIR = $(DESTDIR)/usr/bin
-+
-+CC      := gcc
-+CFLAGS  += -g -Wall $(INCLUDE) -DDEBUG
-+CFLAGS  += -I. -Itpm
-+
-+# Is the simulator running in it's own vm?
-+#CFLAGS += -DVTPM_MULTI_VM
-+
-+ifeq ($(COMPILE_ARCH),x86_64)
-+LIBDIR = lib64
-+else
-+LIBDIR = lib
-+endif
- 
- # GNU MP configuration
--GMP_LIB        := /usr/lib/libgmp.a
-+GMP_LIB        := /usr/$(LIBDIR)/libgmp.a
- GMP_HEADER     := /usr/include/gmp.h
- 
- # sources and objects
-@@ -27,38 +43,32 @@ DIRS           := . crypto tpm 
- SRCS           := $(foreach dir, $(DIRS), $(wildcard $(src)/$(dir)/*.c))
- OBJS           := $(patsubst %.c, %.o, $(SRCS))
- SRCS           += $(foreach dir, $(DIRS), $(wildcard $(src)/$(dir)/*.h))
--DISTSRC        := ./README ./AUTHORS ./ChangeLog ./Makefile $(SRCS)
--DISTDIR        := tpm_emulator-$(VERSION_MAJOR).$(VERSION_MINOR)
- 
--obj-m               := $(MODULE_NAME).o
--$(MODULE_NAME)-objs := $(patsubst $(src)/%.o, %.o, $(OBJS)) crypto/libgmp.a
-+obj-m               := $(BIN)
-+$(BIN)-objs := $(patsubst $(src)/%.o, %.o, $(OBJS)) crypto/libgmp.a
- 
- EXTRA_CFLAGS   += -I$(src) -I$(src)/crypto -I$(src)/tpm 
- 
- # do not print "Entering directory ..."
- MAKEFLAGS      += --no-print-directory
- 
--all:	$(src)/crypto/gmp.h $(src)/crypto/libgmp.a version
--	@$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) modules
-+all: $(BIN)
- 
--install:
--	@$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) modules_install
--	test -d /var/tpm || mkdir /var/tpm
--	test -c /dev/tpm || mknod /dev/tpm c 10 224
--	chmod 666 /dev/tpm
--	depmod -a
-+$(BIN):	$(src)/crypto/gmp.h $(src)/crypto/libgmp.a version $(SRCS) $(OBJS)
-+	$(CC) $(CFLAGS) $(OBJS) $(src)/crypto/libgmp.a -o $(BIN)
-+
-+%.o: %.c
-+	$(CC) $(CFLAGS) -c $< -o $@
-+
-+install: $(BIN)
-+	$(INSTALL_PROG) $(BIN) $(TOOLS_INSTALL_DIR)
-+	@if [ ! -d "/var/tpm" ]; then mkdir /var/tpm; fi
- 
- clean:
--	@$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) clean
--	rm -f $(src)/crypto/gmp.h $(src)/crypto/libgmp.a
-+	rm -f $(src)/crypto/gmp.h $(src)/crypto/libgmp.a $(OBJS)
- 
--dist:	$(DISTSRC)
--	rm -rf $(DISTDIR)
--	mkdir $(DISTDIR)
--	cp --parents $(DISTSRC) $(DISTDIR)/
--	rm -f $(DISTDIR)/crypto/gmp.h 
--	tar -chzf $(DISTDIR).tar.gz $(DISTDIR)
--	rm -rf $(DISTDIR)
-+mrproper: clean
-+	rm -f $(BIN) tpm_version.h
- 
- $(src)/crypto/libgmp.a:
- 	test -f $(src)/crypto/libgmp.a || ln -s $(GMP_LIB) $(src)/crypto/libgmp.a
-@@ -88,4 +98,3 @@ version:
- 	@echo "#endif /* _TPM_VERSION_H_ */" >> $(src)/tpm_version.h
- 
- .PHONY: all install clean dist gmp version
--
-diff -uprN orig/tpm_emulator-0.4/README tpm_emulator/README
---- orig/tpm_emulator-0.4/README	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/README	2006-07-24 14:35:35.000000000 -0700
-@@ -13,7 +13,8 @@ $Id: README 113 2006-06-18 12:38:13Z hst
- Copyright
- --------------------------------------------------------------------------
- Copyright (C) 2004 Mario Strasser <mast@gmx.net> and Swiss Federal 
--Institute of Technology (ETH) Zurich.
-+                   Institute of Technology (ETH) Zurich.
-+Copyright (C) 2005 INTEL Corp 
-               
- 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
-@@ -43,6 +44,12 @@ Example:
- GMP_LIB        := /usr/lib/libgmp.a
- GMP_HEADER     := /usr/include/gmp.h
- 
-+GNU MP Library on 64 bit Systems
-+--------------------------------------------------------------------------
-+Some 64-bit kernels have problems with importing the user-space gmp 
-+library (/usr/lib*/libgmp.a) into kernel space.  These kernels will require
-+that the gmp library be recompiled for kernel space with -mcmodel=kernel.
-+
- Installation
- --------------------------------------------------------------------------
- The compilation and installation process uses the build environment for 
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_capability.c tpm_emulator/tpm/tpm_capability.c
---- orig/tpm_emulator-0.4/tpm/tpm_capability.c	2006-06-23 19:37:07.000000000 +0900
-+++ tpm_emulator/tpm/tpm_capability.c	2007-12-28 22:50:19.000000000 +0900
-@@ -701,7 +701,10 @@ TPM_RESULT TPM_GetCapabilityOwner(TPM_VE
-   TPM_RESULT res;
-   
-   info("TPM_GetCapabilityOwner()");
--  
-+ 
-+  if (!tpmData.permanent.flags.owned) {
-+    return TPM_NOSRK;
-+  } 
-   /* Verify owner authorization */
-   res = tpm_verify_auth(auth1, tpmData.permanent.data.ownerAuth, TPM_KH_OWNER);
-   if (res != TPM_SUCCESS) return res;
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_cmd_handler.c tpm_emulator/tpm/tpm_cmd_handler.c
---- orig/tpm_emulator-0.4/tpm/tpm_cmd_handler.c	2006-06-23 19:37:07.000000000 +0900
-+++ tpm_emulator/tpm/tpm_cmd_handler.c	2007-09-12 20:23:00.000000000 +0900
-@@ -565,7 +565,7 @@ static TPM_RESULT execute_TPM_Seal(TPM_R
-   if (tpm_unmarshal_TPM_KEY_HANDLE(&ptr, &len, &keyHandle)
-       || tpm_unmarshal_TPM_ENCAUTH(&ptr, &len, &encAuth)
-       || tpm_unmarshal_UINT32(&ptr, &len, &pcrInfoSize)
--      || tpm_unmarshal_TPM_PCR_INFO(&ptr, &len, &pcrInfo)
-+      || (pcrInfoSize >0 && tpm_unmarshal_TPM_PCR_INFO(&ptr, &len, &pcrInfo))
-       || tpm_unmarshal_UINT32(&ptr, &len, &inDataSize)
-       || tpm_unmarshal_BLOB(&ptr, &len, &inData, inDataSize)
-       || len != 0) return TPM_BAD_PARAMETER;
-@@ -798,7 +798,7 @@ static TPM_RESULT execute_TPM_Sealx(TPM_
-   if (tpm_unmarshal_TPM_KEY_HANDLE(&ptr, &len, &keyHandle)
-       || tpm_unmarshal_TPM_ENCAUTH(&ptr, &len, &encAuth)
-       || tpm_unmarshal_UINT32(&ptr, &len, &pcrInfoSize)
--      || tpm_unmarshal_TPM_PCR_INFO(&ptr, &len, &pcrInfo)
-+      || (pcrInfoSize > 0 && tpm_unmarshal_TPM_PCR_INFO(&ptr, &len, &pcrInfo))
-       || tpm_unmarshal_UINT32(&ptr, &len, &inDataSize)
-       || tpm_unmarshal_BLOB(&ptr, &len, &inData, inDataSize)
-       || len != 0) return TPM_BAD_PARAMETER;
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_credentials.c tpm_emulator/tpm/tpm_credentials.c
---- orig/tpm_emulator-0.4/tpm/tpm_credentials.c	2006-06-23 19:37:07.000000000 +0900
-+++ tpm_emulator/tpm/tpm_credentials.c	2007-09-12 20:23:30.000000000 +0900
-@@ -47,20 +47,20 @@ int tpm_compute_pubkey_checksum(TPM_NONC
- 
- TPM_RESULT tpm_get_pubek(TPM_PUBKEY *pubEndorsementKey)
- {
--  UINT32 key_length;
-+  size_t key_length;
-   if (!tpmData.permanent.data.endorsementKey.size) return TPM_NO_ENDORSEMENT;
-   /* setup TPM_PUBKEY structure */
--  key_length = tpmData.permanent.data.endorsementKey.size;
--  pubEndorsementKey->pubKey.keyLength = key_length >> 3;
-+  pubEndorsementKey->pubKey.keyLength = tpmData.permanent.data.endorsementKey.size >> 3;
-   pubEndorsementKey->pubKey.key = tpm_malloc(pubEndorsementKey->pubKey.keyLength);
-   if (pubEndorsementKey->pubKey.key == NULL) return TPM_FAIL;
-   rsa_export_modulus(&tpmData.permanent.data.endorsementKey,
--    pubEndorsementKey->pubKey.key,
--    &pubEndorsementKey->pubKey.keyLength);
-+		     pubEndorsementKey->pubKey.key,
-+		     &key_length);
-+  pubEndorsementKey->pubKey.keyLength = key_length;
-   pubEndorsementKey->algorithmParms.algorithmID = TPM_ALG_RSA;
-   pubEndorsementKey->algorithmParms.encScheme = TPM_ES_RSAESOAEP_SHA1_MGF1;
-   pubEndorsementKey->algorithmParms.sigScheme = TPM_SS_NONE;
--  pubEndorsementKey->algorithmParms.parms.rsa.keyLength = key_length;
-+  pubEndorsementKey->algorithmParms.parms.rsa.keyLength = key_length << 3;
-   pubEndorsementKey->algorithmParms.parms.rsa.numPrimes = 2;
-   pubEndorsementKey->algorithmParms.parms.rsa.exponentSize = 0;
-   pubEndorsementKey->algorithmParms.parms.rsa.exponent = NULL;
-@@ -175,6 +175,7 @@ TPM_RESULT TPM_OwnerReadInternalPub(TPM_
- {
-   TPM_RESULT res;
-   TPM_KEY_DATA *srk = &tpmData.permanent.data.srk;
-+  size_t key_length;
-   info("TPM_OwnerReadInternalPub()");
-   /* verify authorization */
-   res = tpm_verify_auth(auth1, tpmData.permanent.data.ownerAuth, TPM_KH_OWNER);
-@@ -186,7 +187,8 @@ TPM_RESULT TPM_OwnerReadInternalPub(TPM_
-     publicPortion->pubKey.key = tpm_malloc(publicPortion->pubKey.keyLength);
-     if (publicPortion->pubKey.key == NULL) return TPM_FAIL;
-     rsa_export_modulus(&srk->key, publicPortion->pubKey.key, 
--      &publicPortion->pubKey.keyLength);
-+      &key_length);
-+    publicPortion->pubKey.keyLength = key_length;
-     publicPortion->algorithmParms.algorithmID = TPM_ALG_RSA;
-     publicPortion->algorithmParms.encScheme = srk->encScheme;
-     publicPortion->algorithmParms.sigScheme = srk->sigScheme;
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_crypto.c tpm_emulator/tpm/tpm_crypto.c
---- orig/tpm_emulator-0.4/tpm/tpm_crypto.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_crypto.c	2006-07-24 14:35:35.000000000 -0700
-@@ -182,7 +182,8 @@ TPM_RESULT TPM_CertifyKey(TPM_KEY_HANDLE
-   TPM_KEY_DATA *cert, *key;
-   sha1_ctx_t sha1_ctx;
-   BYTE *buf, *p;
--  UINT32 length;
-+  UINT32 length32;
-+  size_t length;
-   info("TPM_CertifyKey()");
-   /* get keys */
-   cert = tpm_get_key(certHandle);
-@@ -264,14 +265,15 @@ TPM_RESULT TPM_CertifyKey(TPM_KEY_HANDLE
-   /* compute the digest of the CERTIFY_INFO[2] structure and sign it */
-   length = sizeof_TPM_CERTIFY_INFO((*certifyInfo));
-   p = buf = tpm_malloc(length);
-+  length32=(UINT32) length;
-   if (buf == NULL
--      || tpm_marshal_TPM_CERTIFY_INFO(&p, &length, certifyInfo)) {
-+      || tpm_marshal_TPM_CERTIFY_INFO(&p, &length32, certifyInfo)) {
-     free_TPM_KEY_PARMS(certifyInfo->algorithmParms);
-     return TPM_FAIL;
-   }
-   length = sizeof_TPM_CERTIFY_INFO((*certifyInfo));
-   sha1_init(&sha1_ctx);
--  sha1_update(&sha1_ctx, buf, length);
-+  sha1_update(&sha1_ctx, buf, (size_t) length);
-   sha1_final(&sha1_ctx, buf);
-   res = tpm_sign(cert, auth1, FALSE, buf, SHA1_DIGEST_LENGTH, outData, outDataSize);
-   tpm_free(buf);
-@@ -292,7 +294,8 @@ TPM_RESULT TPM_CertifyKey2(TPM_KEY_HANDL
-   TPM_KEY_DATA *cert, *key;
-   sha1_ctx_t sha1_ctx;
-   BYTE *buf, *p;
--  UINT32 length;
-+  size_t length;
-+  UINT32 length32;
-   info("TPM_CertifyKey2()");
-   /* get keys */
-   cert = tpm_get_key(certHandle);
-@@ -362,8 +365,9 @@ TPM_RESULT TPM_CertifyKey2(TPM_KEY_HANDL
-   /* compute the digest of the CERTIFY_INFO[2] structure and sign it */
-   length = sizeof_TPM_CERTIFY_INFO((*certifyInfo));
-   p = buf = tpm_malloc(length);
-+  length32 = (UINT32) length;
-   if (buf == NULL
--      || tpm_marshal_TPM_CERTIFY_INFO(&p, &length, certifyInfo)) {
-+      || tpm_marshal_TPM_CERTIFY_INFO(&p, &length32, certifyInfo)) {
-     free_TPM_KEY_PARMS(certifyInfo->algorithmParms);
-     return TPM_FAIL;
-   }
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_daa.c tpm_emulator/tpm/tpm_daa.c
---- orig/tpm_emulator-0.4/tpm/tpm_daa.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_daa.c	2006-07-24 14:35:35.000000000 -0700
-@@ -716,14 +716,14 @@ TPM_RESULT TPM_DAA_Join(TPM_HANDLE handl
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x00", 1);
-+      sha1_update(&sha1, (BYTE *) "\x00", 1);
-       sha1_final(&sha1, scratch);
-       sha1_init(&sha1);
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey, 
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x01", 1);
-+      sha1_update(&sha1, (BYTE *) "\x01", 1);
-       sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
-       mpz_init(f), mpz_init(q);
-       mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
-@@ -805,14 +805,14 @@ TPM_RESULT TPM_DAA_Join(TPM_HANDLE handl
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x00", 1);
-+      sha1_update(&sha1, (BYTE *) "\x00", 1);
-       sha1_final(&sha1, scratch);
-       sha1_init(&sha1);
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey, 
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x01", 1);
-+      sha1_update(&sha1, (BYTE *) "\x01", 1);
-       sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
-       mpz_init(f), mpz_init(q);
-       mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
-@@ -1489,14 +1489,14 @@ TPM_RESULT TPM_DAA_Join(TPM_HANDLE handl
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x00", 1);
-+      sha1_update(&sha1, (BYTE *) "\x00", 1);
-       sha1_final(&sha1, scratch);
-       sha1_init(&sha1);
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey, 
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x01", 1);
-+      sha1_update(&sha1, (BYTE *) "\x01", 1);
-       sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
-       mpz_init(f), mpz_init(q);
-       mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
-@@ -1712,14 +1712,14 @@ TPM_RESULT TPM_DAA_Join(TPM_HANDLE handl
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x00", 1);
-+      sha1_update(&sha1, (BYTE *) "\x00", 1);
-       sha1_final(&sha1, scratch);
-       sha1_init(&sha1);
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey, 
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x01", 1);
-+      sha1_update(&sha1, (BYTE *) "\x01", 1);
-       sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
-       mpz_init(f), mpz_init(q);
-       mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
-@@ -1793,14 +1793,14 @@ TPM_RESULT TPM_DAA_Join(TPM_HANDLE handl
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x00", 1);
-+      sha1_update(&sha1, (BYTE *) "\x00", 1);
-       sha1_final(&sha1, scratch);
-       sha1_init(&sha1);
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey, 
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x01", 1);
-+      sha1_update(&sha1, (BYTE *) "\x01", 1);
-       sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
-       mpz_init(f), mpz_init(q);
-       mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
-@@ -2918,14 +2918,14 @@ TPM_RESULT TPM_DAA_Sign(TPM_HANDLE handl
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x00", 1);
-+      sha1_update(&sha1, (BYTE *) "\x00", 1);
-       sha1_final(&sha1, scratch);
-       sha1_init(&sha1);
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey, 
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x01", 1);
-+      sha1_update(&sha1, (BYTE *) "\x01", 1);
-       sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
-       mpz_init(f), mpz_init(q);
-       mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
-@@ -3143,7 +3143,7 @@ TPM_RESULT TPM_DAA_Sign(TPM_HANDLE handl
-         sha1_init(&sha1);
-         sha1_update(&sha1, (BYTE*) &session->DAA_session.DAA_digest, 
-           sizeof(session->DAA_session.DAA_digest));
--        sha1_update(&sha1, "\x01", 1);
-+        sha1_update(&sha1, (BYTE *) "\x01", 1);
-         sha1_update(&sha1, inputData1, inputSize1);
-         sha1_final(&sha1, (BYTE*) &session->DAA_session.DAA_digest);
-       }
-@@ -3172,7 +3172,7 @@ TPM_RESULT TPM_DAA_Sign(TPM_HANDLE handl
-         sha1_init(&sha1);
-         sha1_update(&sha1, (BYTE*) &session->DAA_session.DAA_digest, 
-           sizeof(session->DAA_session.DAA_digest));
--        sha1_update(&sha1, "\x00", 1);
-+        sha1_update(&sha1, (BYTE*) "\x00", 1);
-         rsa_export_modulus(&aikData->key, scratch, &size);
-         sha1_update(&sha1, scratch, size);
-         sha1_final(&sha1, (BYTE*) &session->DAA_session.DAA_digest);
-@@ -3229,14 +3229,14 @@ TPM_RESULT TPM_DAA_Sign(TPM_HANDLE handl
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x00", 1);
-+      sha1_update(&sha1, (BYTE *) "\x00", 1);
-       sha1_final(&sha1, scratch);
-       sha1_init(&sha1);
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey, 
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x01", 1);
-+      sha1_update(&sha1, (BYTE *) "\x01", 1);
-       sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
-       mpz_init(f), mpz_init(q);
-       mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
-@@ -3309,14 +3309,14 @@ TPM_RESULT TPM_DAA_Sign(TPM_HANDLE handl
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x00", 1);
-+      sha1_update(&sha1, (BYTE *) "\x00", 1);
-       sha1_final(&sha1, scratch);
-       sha1_init(&sha1);
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey, 
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x01", 1);
-+      sha1_update(&sha1, (BYTE *) "\x01", 1);
-       sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
-       mpz_init(f), mpz_init(q);
-       mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_data.c tpm_emulator/tpm/tpm_data.c
---- orig/tpm_emulator-0.4/tpm/tpm_data.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_data.c	2006-07-24 14:35:35.000000000 -0700
-@@ -40,6 +40,7 @@ static inline void init_pcr_attr(int pcr
- void tpm_init_data(void)
- {
-   /* endorsement key */
-+#ifndef TPM_GENERATE_EK
-   uint8_t ek_n[] =  "\xa8\xdb\xa9\x42\xa8\xf3\xb8\x06\x85\x90\x76\x93\xad\xf7"
-     "\x74\xec\x3f\xd3\x3d\x9d\xe8\x2e\xff\x15\xed\x0e\xce\x5f\x93"
-     "\x92\xeb\xd1\x96\x2b\x72\x18\x81\x79\x12\x9d\x9c\x40\xd7\x1a"
-@@ -77,6 +78,8 @@ void tpm_init_data(void)
-     "\xd1\xc0\x8b\x5b\xa2\x2e\xa7\x15\xca\x50\x75\x10\x48\x9c\x2b"
-     "\x18\xb9\x67\x8f\x5d\x64\xc3\x28\x9f\x2f\x16\x2f\x08\xda\x47"
-     "\xec\x86\x43\x0c\x80\x99\x07\x34\x0f";
-+#endif
-+
-   int i;
-   /* reset all data to NULL, FALSE or 0 */
-   memset(&tpmData, 0, sizeof(tpmData));
-@@ -152,44 +155,43 @@ void tpm_release_data(void)
- 
- #ifdef TPM_STORE_TO_FILE
- 
--#include <linux/fs.h>
--#include <linux/unistd.h>
--#include <asm/uaccess.h>
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include <fcntl.h>
-+#include <unistd.h>
- 
- #define TPM_STORAGE_FILE "/var/tpm/tpm_emulator-1.2." STR(VERSION_MAJOR) "." STR(VERSION_MINOR) 
- 
- static int write_to_file(uint8_t *data, size_t data_length)
- {
-   int res;
--  struct file *fp;
--  mm_segment_t old_fs = get_fs();
--  fp = filp_open(TPM_STORAGE_FILE, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR);
--  if (IS_ERR(fp)) return -1;
--  set_fs(get_ds());
--  res = fp->f_op->write(fp, data, data_length, &fp->f_pos);
--  set_fs(old_fs);
--  filp_close(fp, NULL);
-+  int fp;
-+  fp = open(TPM_STORAGE_FILE, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR);
-+  res = write(fp, data, data_length);
-+  close(fp);
-   return (res == data_length) ? 0 : -1;
- }
- 
- static int read_from_file(uint8_t **data, size_t *data_length)
- {
-   int res;
--  struct file *fp;
--  mm_segment_t old_fs = get_fs();
--  fp = filp_open(TPM_STORAGE_FILE, O_RDONLY, 0);
--  if (IS_ERR(fp)) return -1;
--  *data_length = (size_t)fp->f_dentry->d_inode->i_size;
--  /* *data_length = i_size_read(fp->f_dentry->d_inode); */
-+  int fp, file_status;
-+  struct stat file_info;
-+  fp = open(TPM_STORAGE_FILE, O_RDONLY, 0);
-+  file_status = fstat(fp, &file_info);
-+  if (file_status < 0) {
-+    close(fp);
-+    return -1;
-+  } 
-+
-+  *data_length = file_info.st_size; 
-   *data = tpm_malloc(*data_length);
-   if (*data == NULL) {
--    filp_close(fp, NULL);
-+    close(fp);
-     return -1;
-   }
--  set_fs(get_ds());
--  res = fp->f_op->read(fp, *data, *data_length, &fp->f_pos);
--  set_fs(old_fs);
--  filp_close(fp, NULL);
-+  res = read(fp, *data, *data_length);
-+  close(fp);
-   if (res != *data_length) {
-     tpm_free(*data);
-     return -1;
-@@ -216,23 +218,30 @@ static int read_from_file(uint8_t **data
- int tpm_store_permanent_data(void)
- {
-   uint8_t *buf, *ptr;
--  size_t buf_length, len;
-+  UINT32 buf_length, len;
- 
-   /* marshal data */
--  buf_length = len = sizeof_TPM_STCLEAR_FLAGS(tpmData.stclear.flags)
--    + sizeof_TPM_PERMANENT_FLAGS(tpmData.permanent.flags) + 2
--    + sizeof_TPM_PERMANENT_DATA(tpmData.permanent.data);
-+  buf_length = len = 4 + sizeof_TPM_STCLEAR_FLAGS(tpmData.stclear.flags)
-+    + sizeof_TPM_PERMANENT_FLAGS(tpmData.permanent.flags) 
-+    + sizeof_TPM_STANY_FLAGS(tpmData.stany.flags) + 2
-+    + sizeof_TPM_STCLEAR_DATA(tpmData.stclear.data) 
-+    + sizeof_TPM_PERMANENT_DATA(tpmData.permanent.data)
-+    + sizeof_TPM_STANY_DATA(tpmData.stany.data);
-   buf = ptr = tpm_malloc(buf_length);
-   if (buf == NULL
-       || tpm_marshal_TPM_VERSION(&ptr, &len, &tpmData.permanent.data.version)
-       || tpm_marshal_TPM_STCLEAR_FLAGS(&ptr, &len, &tpmData.stclear.flags)
-       || tpm_marshal_TPM_PERMANENT_FLAGS(&ptr, &len, &tpmData.permanent.flags)
-+      || tpm_marshal_TPM_STANY_FLAGS(&ptr, &len, &tpmData.stany.flags)
-       || tpm_marshal_BOOL(&ptr, &len, tpmData.permanent.flags.selfTestSucceeded)
-       || tpm_marshal_BOOL(&ptr, &len, tpmData.permanent.flags.owned)
--      || tpm_marshal_TPM_PERMANENT_DATA(&ptr, &len, &tpmData.permanent.data)) {
-+      || tpm_marshal_TPM_STCLEAR_DATA(&ptr, &len, &tpmData.stclear.data)
-+      || tpm_marshal_TPM_PERMANENT_DATA(&ptr, &len, &tpmData.permanent.data)
-+      || tpm_marshal_TPM_STANY_DATA(&ptr, &len, &tpmData.stany.data)) {
-     tpm_free(buf);
-     return -1;
-   }
-+
-   if (write_to_file(buf, buf_length - len)) {
-     tpm_free(buf);
-     return -1; 
-@@ -244,31 +253,36 @@ int tpm_store_permanent_data(void)
- int tpm_restore_permanent_data(void)
- {
-   uint8_t *buf, *ptr;
--  size_t buf_length, len;
-+  size_t buf_length;
-+  UINT32 len;
-   TPM_VERSION ver;
- 
-   /* read data */
-   if (read_from_file(&buf, &buf_length)) return -1;
-   ptr = buf;
--  len = buf_length;
-+  len = (uint32_t) buf_length;
-   /* unmarshal data */
-   if (tpm_unmarshal_TPM_VERSION(&ptr, &len, &ver)
-       || memcmp(&ver, &tpmData.permanent.data.version, sizeof(TPM_VERSION))
-       || tpm_unmarshal_TPM_STCLEAR_FLAGS(&ptr, &len, &tpmData.stclear.flags)
-       || tpm_unmarshal_TPM_PERMANENT_FLAGS(&ptr, &len, &tpmData.permanent.flags)
-+      || tpm_unmarshal_TPM_STANY_FLAGS(&ptr, &len, &tpmData.stany.flags)
-       || tpm_unmarshal_BOOL(&ptr, &len, &tpmData.permanent.flags.selfTestSucceeded)
-       || tpm_unmarshal_BOOL(&ptr, &len, &tpmData.permanent.flags.owned)
--      || tpm_unmarshal_TPM_PERMANENT_DATA(&ptr, &len, &tpmData.permanent.data)) {
-+      || tpm_unmarshal_TPM_STCLEAR_DATA(&ptr, &len, &tpmData.stclear.data)
-+      || tpm_unmarshal_TPM_PERMANENT_DATA(&ptr, &len, &tpmData.permanent.data)
-+      || tpm_unmarshal_TPM_STANY_DATA(&ptr, &len, &tpmData.stany.data)) {
-     tpm_free(buf);
-     return -1;
-   }
-+
-   tpm_free(buf);
-   return 0;
- }
- 
- int tpm_erase_permanent_data(void)
- {
--  int res = write_to_file("", 0);
-+  int res = write_to_file((uint8_t *) "", 0);
-   return res;
- }
- 
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_deprecated.c tpm_emulator/tpm/tpm_deprecated.c
---- orig/tpm_emulator-0.4/tpm/tpm_deprecated.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_deprecated.c	2006-07-24 14:35:35.000000000 -0700
-@@ -1,6 +1,7 @@
- /* Software-Based Trusted Platform Module (TPM) Emulator for Linux
-  * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
-  *                    Swiss Federal Institute of Technology (ETH) Zurich
-+ * Copyright (C) 2005 INTEL Corp
-  *
-  * This module is free software; you can redistribute it and/or modify
-  * it under the terms of the GNU General Public License as published
-@@ -50,7 +51,7 @@ TPM_RESULT TPM_SaveKeyContext(TPM_KEY_HA
-   BYTE *ptr;
-   UINT32 len;
-   info("TPM_SaveKeyContext()");
--  res = TPM_SaveContext(keyHandle, TPM_RT_KEY, "SaveKeyContext..", 
-+  res = TPM_SaveContext(keyHandle, TPM_RT_KEY, (BYTE*)"SaveKeyContext..", 
-                         keyContextSize, &contextBlob);
-   if (res != TPM_SUCCESS) return res;
-   len = *keyContextSize;
-@@ -82,7 +83,7 @@ TPM_RESULT TPM_SaveAuthContext(TPM_AUTHH
-   BYTE *ptr;
-   UINT32 len;
-   info("TPM_SaveAuthContext()");
--  res = TPM_SaveContext(authHandle, TPM_RT_KEY, "SaveAuthContext.", 
-+  res = TPM_SaveContext(authHandle, TPM_RT_KEY, (BYTE*)"SaveAuthContext.", 
-                         authContextSize, &contextBlob);
-   if (res != TPM_SUCCESS) return res;
-   len = *authContextSize;
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_emulator.h tpm_emulator/tpm/tpm_emulator.h
---- orig/tpm_emulator-0.4/tpm/tpm_emulator.h	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_emulator.h	2006-07-24 14:35:35.000000000 -0700
-@@ -1,5 +1,6 @@
- /* Software-Based Trusted Platform Module (TPM) Emulator for Linux
-  * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
-+ * Copyright (C) 2005 INTEL Corp
-  *
-  * This module is free software; you can redistribute it and/or modify
-  * it under the terms of the GNU General Public License as published
-@@ -22,7 +23,8 @@
- /* TPM configuration */
- #define TPM_STORE_TO_FILE       1
- #undef  TPM_STRONG_PERSISTENCE
--#undef  TPM_GENERATE_EK
-+//#undef  TPM_GENERATE_EK
-+#define  TPM_GENERATE_EK
- #undef  TPM_GENERATE_SEED_DAA
- 
- #define TPM_MANUFACTURER 0x4554485A /* 'ETHZ' */        
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_marshalling.c tpm_emulator/tpm/tpm_marshalling.c
---- orig/tpm_emulator-0.4/tpm/tpm_marshalling.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_marshalling.c	2006-07-24 14:35:35.000000000 -0700
-@@ -1312,7 +1312,7 @@ int tpm_unmarshal_TPM_STANY_FLAGS(BYTE *
- 
- int tpm_marshal_RSA(BYTE **ptr, UINT32 *length, rsa_private_key_t *v)
- {
--  UINT32 m_len, e_len, q_len;
-+  size_t m_len, e_len, q_len;
-   if (*length < sizeof_RSA((*v))) return -1;
-   if (v->size > 0) {
-     rsa_export_modulus(v, &(*ptr)[6], &m_len);
-@@ -1460,6 +1460,66 @@ int tpm_unmarshal_TPM_PERMANENT_DATA(BYT
-   return 0;
- }
- 
-+int tpm_marshal_TPM_STCLEAR_DATA(BYTE **ptr, UINT32 *length, TPM_STCLEAR_DATA *v)
-+{
-+  if (tpm_marshal_TPM_STRUCTURE_TAG(ptr, length, v->tag)
-+    || tpm_marshal_TPM_NONCE(ptr, length, &v->contextNonceKey)
-+    || tpm_marshal_TPM_COUNT_ID(ptr, length, v->countID) ) return -1;
-+
-+  return 0;
-+}
-+
-+int tpm_unmarshal_TPM_STCLEAR_DATA(BYTE **ptr, UINT32 *length, TPM_STCLEAR_DATA *v)
-+{
-+  if (tpm_unmarshal_TPM_STRUCTURE_TAG(ptr, length, &v->tag)
-+    || tpm_unmarshal_TPM_NONCE(ptr, length, &v->contextNonceKey)
-+    || tpm_unmarshal_TPM_COUNT_ID(ptr, length, &v->countID) ) return -1;
-+
-+  return 0;
-+}
-+
-+int tpm_marshal_TPM_STANY_DATA(BYTE **ptr, UINT32 *length, TPM_STANY_DATA *v)
-+{
-+  UINT32 i;
-+  if (tpm_marshal_TPM_STRUCTURE_TAG(ptr, length, v->tag)
-+    || tpm_marshal_TPM_NONCE(ptr, length, &v->contextNonceSession)
-+    || tpm_marshal_TPM_DIGEST(ptr, length, &v->auditDigest)
-+    || tpm_marshal_BOOL(ptr, length, v->auditSession)
-+    || tpm_marshal_TPM_CURRENT_TICKS(ptr, length, &v->currentTicks)
-+    || tpm_marshal_UINT32(ptr, length, v->contextCount)
-+    || tpm_marshal_UINT32_ARRAY(ptr, length, v->contextList, TPM_MAX_SESSION_LIST)) return -1;
-+  for (i = 0; i < TPM_MAX_SESSIONS; i++) {
-+    if (tpm_marshal_TPM_SESSION_DATA(ptr, length, &v->sessions[i])) return -1;
-+  }
-+  for (i = 0; i < TPM_MAX_SESSIONS_DAA; i++) {
-+    if (tpm_marshal_TPM_DAA_SESSION_DATA(ptr, length, &v->sessionsDAA[i])) return -1;
-+  }
-+  if (tpm_marshal_TPM_TRANSHANDLE(ptr, length, v->transExclusive)) return -1;
-+
-+  return 0;
-+}
-+
-+int tpm_unmarshal_TPM_STANY_DATA(BYTE **ptr, UINT32 *length, TPM_STANY_DATA *v)
-+{
-+  UINT32 i;
-+  if (tpm_unmarshal_TPM_STRUCTURE_TAG(ptr, length, &v->tag)
-+    || tpm_unmarshal_TPM_NONCE(ptr, length, &v->contextNonceSession)
-+    || tpm_unmarshal_TPM_DIGEST(ptr, length, &v->auditDigest)
-+    || tpm_unmarshal_BOOL(ptr, length, &v->auditSession)
-+    || tpm_unmarshal_TPM_CURRENT_TICKS(ptr, length, &v->currentTicks)
-+    || tpm_unmarshal_UINT32(ptr, length, &v->contextCount)
-+    || tpm_unmarshal_UINT32_ARRAY(ptr, length, v->contextList, TPM_MAX_SESSION_LIST)) return -1;
-+  for (i = 0; i < TPM_MAX_SESSIONS; i++) {
-+    if (tpm_unmarshal_TPM_SESSION_DATA(ptr, length, &v->sessions[i])) return -1;
-+  }
-+  for (i = 0; i < TPM_MAX_SESSIONS_DAA; i++) {
-+    if (tpm_unmarshal_TPM_DAA_SESSION_DATA(ptr, length, &v->sessionsDAA[i])) return -1;
-+  }
-+  if (tpm_unmarshal_TPM_TRANSHANDLE(ptr, length, &v->transExclusive)) return -1;
-+
-+  return 0;
-+}
-+
- int tpm_marshal_TPM_SESSION_DATA(BYTE **ptr, UINT32 *length, TPM_SESSION_DATA *v)
- {
-   if (tpm_marshal_BYTE(ptr, length, v->type)
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_marshalling.h tpm_emulator/tpm/tpm_marshalling.h
---- orig/tpm_emulator-0.4/tpm/tpm_marshalling.h	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_marshalling.h	2006-07-24 14:35:35.000000000 -0700
-@@ -432,6 +432,12 @@ int tpm_unmarshal_TPM_KEY_DATA(BYTE **pt
- int tpm_marshal_TPM_PERMANENT_DATA(BYTE **ptr, UINT32 *length, TPM_PERMANENT_DATA *);
- int tpm_unmarshal_TPM_PERMANENT_DATA(BYTE **ptr, UINT32 *length, TPM_PERMANENT_DATA *);
- 
-+int tpm_marshal_TPM_STCLEAR_DATA(BYTE **ptr, UINT32 *length, TPM_STCLEAR_DATA *v);
-+int tpm_unmarshal_TPM_STCLEAR_DATA(BYTE **ptr, UINT32 *length, TPM_STCLEAR_DATA *v);
-+
-+int tpm_marshal_TPM_STANY_DATA(BYTE **ptr, UINT32 *length, TPM_STANY_DATA *v);
-+int tpm_unmarshal_TPM_STANY_DATA(BYTE **ptr, UINT32 *length, TPM_STANY_DATA *v);
-+
- int tpm_marshal_TPM_SESSION_DATA(BYTE **ptr, UINT32 *length, TPM_SESSION_DATA *v);
- int tpm_unmarshal_TPM_SESSION_DATA(BYTE **ptr, UINT32 *length, TPM_SESSION_DATA *v);
- 
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_owner.c tpm_emulator/tpm/tpm_owner.c
---- orig/tpm_emulator-0.4/tpm/tpm_owner.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_owner.c	2006-07-24 14:35:35.000000000 -0700
-@@ -108,7 +108,7 @@ TPM_RESULT TPM_TakeOwnership(TPM_PROTOCO
-   TPM_RESULT res;
-   rsa_private_key_t *ek = &tpmData.permanent.data.endorsementKey;
-   TPM_KEY_DATA *srk = &tpmData.permanent.data.srk;
--  UINT32 buf_size = ek->size >> 3;
-+  size_t buf_size = ek->size >> 3, key_length; 
-   BYTE buf[buf_size];
- 
-   info("TPM_TakeOwnership()");
-@@ -173,7 +173,8 @@ TPM_RESULT TPM_TakeOwnership(TPM_PROTOCO
-     return TPM_FAIL;
-   }
-   rsa_export_modulus(&srk->key, srkPub->pubKey.key,
--    &srkPub->pubKey.keyLength);
-+		     &key_length);
-+  srkPub->pubKey.keyLength = (UINT32) key_length;
-   /* setup tpmProof and set state to owned */
-   tpm_get_random_bytes(tpmData.permanent.data.tpmProof.nonce, 
-     sizeof(tpmData.permanent.data.tpmProof.nonce));
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_startup.c tpm_emulator/tpm/tpm_startup.c
---- orig/tpm_emulator-0.4/tpm/tpm_startup.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_startup.c	2006-07-24 14:35:35.000000000 -0700
-@@ -41,26 +41,29 @@ void TPM_Init(TPM_STARTUP_TYPE startupTy
- TPM_RESULT TPM_Startup(TPM_STARTUP_TYPE startupType)
- {
-   int i;
-+  int restore_fail;
-   info("TPM_Startup(%d)", startupType);
-   if (tpmData.stany.flags.postInitialise == FALSE) return TPM_INVALID_POSTINIT;
--  /* reset STANY_FLAGS */
--  SET_TO_ZERO(&tpmData.stany.flags);
--  tpmData.stany.flags.tag = TPM_TAG_STANY_FLAGS;
--  /* reset STANY_DATA (invalidates ALL sessions) */
--  SET_TO_ZERO(&tpmData.stany.data);
--  tpmData.stany.data.tag = TPM_TAG_STANY_DATA;
--  /* init session-context nonce */
--  SET_TO_RAND(&tpmData.stany.data.contextNonceSession);
-+
-+  /* try and restore state to get EK, SRK, etc */
-+  restore_fail = tpm_restore_permanent_data();
-+
-   /* set data and flags according to the given startup type */
-   if (startupType == TPM_ST_CLEAR) {
--    /* if available, restore permanent data */
--    tpm_restore_permanent_data();
-+    /* reset STANY_FLAGS */
-+    SET_TO_ZERO(&tpmData.stany.flags);
-+    tpmData.stany.flags.tag = TPM_TAG_STANY_FLAGS;
-+    /* reset STANY_DATA (invalidates ALL sessions) */
-+    SET_TO_ZERO(&tpmData.stany.data);
-+    tpmData.stany.data.tag = TPM_TAG_STANY_DATA;
-+    /* init session-context nonce */
-+    SET_TO_RAND(&tpmData.stany.data.contextNonceSession);
-     /* reset PCR values */
-     for (i = 0; i < TPM_NUM_PCR; i++) {
--      if (tpmData.permanent.data.pcrAttrib[i].pcrReset)
--        SET_TO_ZERO(tpmData.permanent.data.pcrValue[i].digest);
-+      if (!tpmData.permanent.data.pcrAttrib[i].pcrReset)
-+        SET_TO_ZERO(&tpmData.permanent.data.pcrValue[i].digest);
-       else
--        SET_TO_0xFF(tpmData.permanent.data.pcrValue[i].digest);
-+        SET_TO_0xFF(&tpmData.permanent.data.pcrValue[i].digest);
-     }
-     /* reset STCLEAR_FLAGS */
-     SET_TO_ZERO(&tpmData.stclear.flags);
-@@ -79,7 +82,8 @@ TPM_RESULT TPM_Startup(TPM_STARTUP_TYPE 
-     /* init key-context nonce */
-     SET_TO_RAND(&tpmData.stclear.data.contextNonceKey);
-   } else if (startupType == TPM_ST_STATE) {
--    if (tpm_restore_permanent_data()) {
-+    /* restore must have been successful for TPM_ST_STATE */
-+    if (restore_fail) {
-       error("restoring permanent data failed");
-       tpmData.permanent.data.testResult = "tpm_restore_permanent_data() failed";
-       tpmData.permanent.flags.selfTestSucceeded = FALSE;
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_storage.c tpm_emulator/tpm/tpm_storage.c
---- orig/tpm_emulator-0.4/tpm/tpm_storage.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_storage.c	2006-07-24 14:35:35.000000000 -0700
-@@ -58,6 +58,7 @@ int encrypt_sealed_data(TPM_KEY_DATA *ke
-                         BYTE *enc, UINT32 *enc_size)
- {
-   UINT32 len;
-+  size_t enc_size32 = *enc_size;
-   BYTE *buf, *ptr;
-   rsa_public_key_t pub_key;
-   int scheme;
-@@ -72,7 +73,7 @@ int encrypt_sealed_data(TPM_KEY_DATA *ke
-   if (buf == NULL
-       || tpm_marshal_TPM_SEALED_DATA(&ptr, &len, seal)
-       || rsa_encrypt(&pub_key, scheme, buf, sizeof_TPM_SEALED_DATA((*seal)),
--                     enc, enc_size)) {
-+                     enc, &enc_size32)) {
-     tpm_free(buf);
-     rsa_release_public_key(&pub_key);
-     return -1;
-@@ -85,7 +86,8 @@ int encrypt_sealed_data(TPM_KEY_DATA *ke
- int decrypt_sealed_data(TPM_KEY_DATA *key, BYTE *enc, UINT32 enc_size,
-                         TPM_SEALED_DATA *seal, BYTE **buf) 
- {
--  UINT32 len;
-+  size_t len;
-+  UINT32 len32;
-   BYTE *ptr;
-   int scheme;
-   switch (key->encScheme) {
-@@ -96,8 +98,12 @@ int decrypt_sealed_data(TPM_KEY_DATA *ke
-   len = enc_size;
-   *buf = ptr = tpm_malloc(len);
-   if (*buf == NULL
--      || rsa_decrypt(&key->key, scheme, enc, enc_size, *buf, &len)
--      || tpm_unmarshal_TPM_SEALED_DATA(&ptr, &len, seal)) {
-+      || rsa_decrypt(&key->key, scheme, enc, enc_size, *buf, &len) ){
-+    tpm_free(*buf);
-+    return -1;
-+  }
-+  len32 = len;
-+  if (tpm_unmarshal_TPM_SEALED_DATA(&ptr, &len32, seal)) {
-     tpm_free(*buf);
-     return -1;
-   }
-@@ -240,11 +246,12 @@ TPM_RESULT TPM_Unseal(TPM_KEY_HANDLE par
- 
- TPM_RESULT TPM_UnBind(TPM_KEY_HANDLE keyHandle, UINT32 inDataSize,
-                       BYTE *inData, TPM_AUTH *auth1, 
--                      UINT32 *outDataSize, BYTE **outData)
-+                      UINT32 *outDataSize32, BYTE **outData)
- {
-   TPM_RESULT res;
-   TPM_KEY_DATA *key;
-   int scheme;
-+  size_t outDataSize;
-   
-   info("TPM_UnBind()");
-   /* get key */
-@@ -262,8 +269,8 @@ TPM_RESULT TPM_UnBind(TPM_KEY_HANDLE key
-   /* the size of the input data muss be greater than zero */
-   if (inDataSize == 0) return TPM_BAD_PARAMETER;
-   /* decrypt data */
--  *outDataSize = inDataSize;
--  *outData = tpm_malloc(*outDataSize);
-+  outDataSize = inDataSize;
-+  *outData = tpm_malloc(outDataSize);
-   if (*outData == NULL) return TPM_NOSPACE;
-   switch (key->encScheme) {
-     case TPM_ES_RSAESOAEP_SHA1_MGF1: scheme = RSA_ES_OAEP_SHA1; break;
-@@ -271,20 +278,21 @@ TPM_RESULT TPM_UnBind(TPM_KEY_HANDLE key
-     default: tpm_free(*outData); return TPM_DECRYPT_ERROR;
-   }
-   if (rsa_decrypt(&key->key, scheme, inData, inDataSize, 
--      *outData, outDataSize)) {
-+      *outData, &outDataSize)) {
-     tpm_free(*outData);
-     return TPM_DECRYPT_ERROR;
-   }
-   /* verify data if it is of type TPM_BOUND_DATA */
-   if (key->encScheme == TPM_ES_RSAESOAEP_SHA1_MGF1 
-       || key->keyUsage != TPM_KEY_LEGACY) {
--    if (*outDataSize < 5 || memcmp(*outData, "\x01\x01\00\x00\x02", 5) != 0) {
-+    if (outDataSize < 5 || memcmp(*outData, "\x01\x01\00\x00\x02", 5) != 0) {
-       tpm_free(*outData);
-       return TPM_DECRYPT_ERROR;
-     }
--    *outDataSize -= 5;
--    memmove(*outData, &(*outData)[5], *outDataSize);
-+    outDataSize -= 5;
-+    memmove(*outData, &(*outData)[5], outDataSize);
-   }
-+  *outDataSize32 = (UINT32) outDataSize;
-   return TPM_SUCCESS;
- }
- 
-@@ -334,12 +342,13 @@ int compute_pubkey_digest(TPM_PUBKEY *ke
- }
- 
- int encrypt_private_key(TPM_KEY_DATA *key, TPM_STORE_ASYMKEY *store,
--                        BYTE *enc, UINT32 *enc_size)
-+                        BYTE *enc, UINT32 *enc_size32)
- {
-   UINT32 len;
-   BYTE *buf, *ptr;
-   rsa_public_key_t pub_key;
-   int scheme;
-+  size_t enc_size;
-   switch (key->encScheme) {
-     case TPM_ES_RSAESOAEP_SHA1_MGF1: scheme = RSA_ES_OAEP_SHA1; break;
-     case TPM_ES_RSAESPKCSv15: scheme = RSA_ES_PKCSV15; break;
-@@ -351,11 +360,12 @@ int encrypt_private_key(TPM_KEY_DATA *ke
-   if (buf == NULL
-       || tpm_marshal_TPM_STORE_ASYMKEY(&ptr, &len, store)
-       || rsa_encrypt(&pub_key, scheme, buf, sizeof_TPM_STORE_ASYMKEY((*store)),
--                     enc, enc_size)) {
-+                     enc, &enc_size)) {
-     tpm_free(buf);
-     rsa_release_public_key(&pub_key);
-     return -1;
-   }
-+  *enc_size32 = (UINT32) enc_size;
-   tpm_free(buf);
-   rsa_release_public_key(&pub_key);
-   return 0;
-@@ -364,7 +374,8 @@ int encrypt_private_key(TPM_KEY_DATA *ke
- int decrypt_private_key(TPM_KEY_DATA *key, BYTE *enc, UINT32 enc_size, 
-                         TPM_STORE_ASYMKEY *store, BYTE **buf) 
- {
--  UINT32 len;
-+  UINT32 len32;
-+  size_t len;
-   BYTE *ptr;
-   int scheme;
-   switch (key->encScheme) {
-@@ -375,8 +386,12 @@ int decrypt_private_key(TPM_KEY_DATA *ke
-   len = enc_size;
-   *buf = ptr = tpm_malloc(len);
-   if (*buf == NULL
--      || rsa_decrypt(&key->key, scheme, enc, enc_size, *buf, &len)
--      || tpm_unmarshal_TPM_STORE_ASYMKEY(&ptr, &len, store)) {
-+      || rsa_decrypt(&key->key, scheme, enc, enc_size, *buf, &len) ) {
-+    tpm_free(*buf);
-+    return -1;
-+  }
-+  len32 = (UINT32) len;
-+  if (tpm_unmarshal_TPM_STORE_ASYMKEY(&ptr, &len32, store)) {  
-     tpm_free(*buf);
-     return -1;
-   }
-@@ -394,7 +409,7 @@ TPM_RESULT TPM_CreateWrapKey(TPM_KEY_HAN
-   TPM_SESSION_DATA *session;
-   TPM_STORE_ASYMKEY store;
-   rsa_private_key_t rsa;
--  UINT32 key_length;
-+  size_t key_length;
- 
-   info("TPM_CreateWrapKey()");
-   /* get parent key */
-@@ -450,11 +465,11 @@ TPM_RESULT TPM_CreateWrapKey(TPM_KEY_HAN
-     }
-   }
-   /* generate key and store it */
--  key_length = keyInfo->algorithmParms.parms.rsa.keyLength;
--  if (rsa_generate_key(&rsa, key_length)) return TPM_FAIL;
--  wrappedKey->pubKey.keyLength = key_length >> 3;
-+  if (rsa_generate_key(&rsa, keyInfo->algorithmParms.parms.rsa.keyLength)) 
-+    return TPM_FAIL;
-+  wrappedKey->pubKey.keyLength = keyInfo->algorithmParms.parms.rsa.keyLength >> 3;
-   wrappedKey->pubKey.key = tpm_malloc(wrappedKey->pubKey.keyLength);
--  store.privKey.keyLength = key_length >> 4;
-+  store.privKey.keyLength = keyInfo->algorithmParms.parms.rsa.keyLength >> 4;
-   store.privKey.key = tpm_malloc(store.privKey.keyLength);
-   wrappedKey->encDataSize = parent->key.size >> 3;
-   wrappedKey->encData = tpm_malloc(wrappedKey->encDataSize);
-@@ -466,9 +481,11 @@ TPM_RESULT TPM_CreateWrapKey(TPM_KEY_HAN
-     tpm_free(wrappedKey->encData);
-     return TPM_NOSPACE;
-   }
--  rsa_export_modulus(&rsa, wrappedKey->pubKey.key, 
--    &wrappedKey->pubKey.keyLength);
--  rsa_export_prime1(&rsa, store.privKey.key, &store.privKey.keyLength);
-+  rsa_export_modulus(&rsa, wrappedKey->pubKey.key,
-+		     &key_length);
-+  wrappedKey->pubKey.keyLength = (UINT32) key_length;
-+  rsa_export_prime1(&rsa, store.privKey.key, &key_length);
-+  store.privKey.keyLength = (UINT32) key_length;
-   rsa_release_private_key(&rsa);
-   /* compute the digest of the wrapped key (without encData) */
-   if (compute_key_digest(wrappedKey, &store.pubDataDigest)) {
-@@ -602,6 +619,7 @@ TPM_RESULT TPM_LoadKey2(TPM_KEY_HANDLE p
- 
- int tpm_setup_key_parms(TPM_KEY_DATA *key, TPM_KEY_PARMS *parms)
- {
-+  size_t key_length;
-   parms->algorithmID = TPM_ALG_RSA;
-   parms->encScheme = key->encScheme;
-   parms->sigScheme = key->sigScheme;
-@@ -611,7 +629,8 @@ int tpm_setup_key_parms(TPM_KEY_DATA *ke
-   parms->parms.rsa.exponent = tpm_malloc(parms->parms.rsa.exponentSize);
-   if (parms->parms.rsa.exponent == NULL) return -1;
-   rsa_export_exponent(&key->key, parms->parms.rsa.exponent,
--    &parms->parms.rsa.exponentSize);
-+    &key_length);
-+  parms->parms.rsa.exponentSize = (UINT32) key_length;
-   parms->parmSize = 12 + parms->parms.rsa.exponentSize;
-   return 0;
- }
-@@ -622,6 +641,7 @@ TPM_RESULT TPM_GetPubKey(TPM_KEY_HANDLE 
-   TPM_RESULT res;
-   TPM_KEY_DATA *key;
-   TPM_DIGEST digest;
-+  size_t key_length;
-   info("TPM_GetPubKey()");
-   /* get key */
-   if (keyHandle == TPM_KH_SRK
-@@ -650,8 +670,8 @@ TPM_RESULT TPM_GetPubKey(TPM_KEY_HANDLE 
-   pubKey->pubKey.keyLength = key->key.size >> 3;
-   pubKey->pubKey.key = tpm_malloc(pubKey->pubKey.keyLength);
-   if (pubKey->pubKey.key == NULL) return TPM_NOSPACE;
--  rsa_export_modulus(&key->key, pubKey->pubKey.key, 
--    &pubKey->pubKey.keyLength);
-+  rsa_export_modulus(&key->key, pubKey->pubKey.key, &key_length);
-+  pubKey->pubKey.keyLength = (UINT32) key_length;
-   if (tpm_setup_key_parms(key, &pubKey->algorithmParms) != 0) {
-     error("TPM_GetPubKey(): tpm_setup_key_parms() failed.");
-     tpm_free(pubKey->pubKey.key);
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_structures.h tpm_emulator/tpm/tpm_structures.h
---- orig/tpm_emulator-0.4/tpm/tpm_structures.h	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_structures.h	2006-07-24 14:35:35.000000000 -0700
-@@ -1958,6 +1958,7 @@ typedef struct tdTPM_DAA_ISSUER {
-   TPM_DIGEST DAA_digest_gamma;
-   BYTE DAA_generic_q[26];
- } TPM_DAA_ISSUER;
-+#define sizeof_TPM_DAA_ISSUER(s) (2 + (20 * 6) + 26 )
- 
- /*
-  * TPM_DAA_TPM ([TPM_Part2], Section 22.4)
-@@ -1973,6 +1974,7 @@ typedef struct tdTPM_DAA_TPM {
-   TPM_DIGEST DAA_rekey;
-   UINT32 DAA_count;
- } TPM_DAA_TPM;
-+#define sizeof_TPM_DAA_TPM(s) (2 + (4 * 20) + 4)
- 
- /*
-  * TPM_DAA_CONTEXT ([TPM_Part2], Section 22.5)
-@@ -1987,6 +1989,7 @@ typedef struct tdTPM_DAA_CONTEXT {
-   BYTE DAA_scratch[256];
-   BYTE DAA_stage;
- } TPM_DAA_CONTEXT;
-+#define sizeof_TPM_DAA_CONTEXT(s) (2 + (3 * 20) + 256 + 1)
- 
- /*
-  * TPM_DAA_JOINDATA ([TPM_Part2], Section 22.6)
-@@ -1998,6 +2001,7 @@ typedef struct tdTPM_DAA_JOINDATA {
-   BYTE DAA_join_u1[138];
-   TPM_DIGEST DAA_digest_n0;
- } TPM_DAA_JOINDATA;
-+#define sizeof_TPM_DAA_JOINDATA(s) (1 + 1 + 20)
- 
- /*
-  * TPM_DAA_BLOB ([TPM_Part2], Section 22.8)
-@@ -2202,6 +2206,7 @@ typedef struct tdTPM_STCLEAR_DATA {
-   //UINT32 ownerReference;
-   //BOOL disableResetLock;
- } TPM_STCLEAR_DATA;
-+#define sizeof_TPM_STCLEAR_DATA(s) (2 + 20 + 4)
- 
- /*
-  * TPM_SESSION_DATA
-@@ -2238,6 +2243,11 @@ typedef struct tdTPM_DAA_SESSION_DATA {
-   TPM_DAA_JOINDATA DAA_joinSession;
-   TPM_HANDLE handle;
- } TPM_DAA_SESSION_DATA;
-+#define sizeof_TPM_DAA_SESSION_DATA(s) ( 1 \
-+  + sizeof_TPM_DAA_ISSUER(s.DAA_issuerSettings) \
-+  + sizeof_TPM_DAA_TPM(s.DAA_tpmSpecific) \
-+  + sizeof_TPM_DAA_CONTEXT(s.DAA_session) \
-+  + sizeof_TPM_DAA_JOINDATA(s.DAA_joinSession) + 4)
- 
- /*
-  * TPM_STANY_DATA ([TPM_Part2], Section 7.6)
-@@ -2262,6 +2272,11 @@ typedef struct tdTPM_STANY_DATA {
-   TPM_DAAHANDLE currentDAA;
-   TPM_TRANSHANDLE transExclusive;
- } TPM_STANY_DATA;
-+#define sizeof_TPM_STANY_DATA(s) (2 + 20 + 20 + 1 \
-+  + sizeof_TPM_CURRENT_TICKS(s.currentTicks) \
-+  + 4 + (4 * TPM_MAX_SESSION_LIST) \
-+  + (sizeof_TPM_SESSION_DATA(s.sessions[0]) * TPM_MAX_SESSION_LIST) \
-+  + (sizeof_TPM_DAA_SESSION_DATA(s.sessionsDAA[0]) * TPM_MAX_SESSIONS_DAA) + 4)
- 
- /*
-  * TPM_DATA
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_testing.c tpm_emulator/tpm/tpm_testing.c
---- orig/tpm_emulator-0.4/tpm/tpm_testing.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_testing.c	2006-07-24 14:35:35.000000000 -0700
-@@ -1,6 +1,7 @@
- /* Software-Based Trusted Platform Module (TPM) Emulator for Linux
-  * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
-  *                    Swiss Federal Institute of Technology (ETH) Zurich
-+ * Copyright (C) 2005 INTEL Corp
-  *
-  * This module is free software; you can redistribute it and/or modify
-  * it under the terms of the GNU General Public License as published
-@@ -95,24 +96,24 @@ static int tpm_test_sha1(void)
-   struct {
-     uint8_t *data; uint32_t repetitions; uint8_t *digest;
-   } test_cases[] =  {{
--    "abc", 1,
--    "\xA9\x99\x3E\x36\x47\x06\x81\x6A\xBA\x3E\x25\x71\x78\x50\xC2\x6C\x9C\xD0\xD8\x9D"
-+	(uint8_t*)"abc", 1,
-+    (uint8_t*)"\xA9\x99\x3E\x36\x47\x06\x81\x6A\xBA\x3E\x25\x71\x78\x50\xC2\x6C\x9C\xD0\xD8\x9D"
-   }, {
--    "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 1,
--    "\x84\x98\x3E\x44\x1C\x3B\xD2\x6E\xBA\xAE\x4A\xA1\xF9\x51\x29\xE5\xE5\x46\x70\xF1"
-+    (uint8_t*)"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 1,
-+    (uint8_t*)"\x84\x98\x3E\x44\x1C\x3B\xD2\x6E\xBA\xAE\x4A\xA1\xF9\x51\x29\xE5\xE5\x46\x70\xF1"
-   }, {
--    "a", 1000000,
--    "\x34\xAA\x97\x3C\xD4\xC4\xDA\xA4\xF6\x1E\xEB\x2B\xDB\xAD\x27\x31\x65\x34\x01\x6F"
-+    (uint8_t*)"a", 1000000,
-+    (uint8_t*)"\x34\xAA\x97\x3C\xD4\xC4\xDA\xA4\xF6\x1E\xEB\x2B\xDB\xAD\x27\x31\x65\x34\x01\x6F"
-   }, {
--    "0123456701234567012345670123456701234567012345670123456701234567", 10,
--    "\xDE\xA3\x56\xA2\xCD\xDD\x90\xC7\xA7\xEC\xED\xC5\xEB\xB5\x63\x93\x4F\x46\x04\x52"
-+    (uint8_t*)"0123456701234567012345670123456701234567012345670123456701234567", 10,
-+    (uint8_t*)"\xDE\xA3\x56\xA2\xCD\xDD\x90\xC7\xA7\xEC\xED\xC5\xEB\xB5\x63\x93\x4F\x46\x04\x52"
-   }};
- 
-   debug("tpm_test_sha1()");
-   for (i = 0; i < sizeof(test_cases) / sizeof(test_cases[0]); i++) {
-     sha1_init(&ctx);
-     for (j = 0; j < test_cases[i].repetitions; j++)
--      sha1_update(&ctx, test_cases[i].data, strlen(test_cases[i].data));
-+      sha1_update(&ctx, test_cases[i].data, strlen((char*)test_cases[i].data));
-     sha1_final(&ctx, digest);
-     if (memcmp(digest, test_cases[i].digest, SHA1_DIGEST_LENGTH) != 0) return -1;
-   }
-@@ -128,41 +129,41 @@ static int tpm_test_hmac(void)
-   struct {
-     uint8_t *key, key_len, *data, data_len, *digest;
-   } test_cases[] = {{
--    "\x0b", 20, "Hi There", 8,
--    "\xb6\x17\x31\x86\x55\x05\x72\x64\xe2\x8b\xc0\xb6\xfb\x37\x8c\x8e\xf1\x46\xbe\x00"
-+    (uint8_t*)"\x0b", 20, (uint8_t*)"Hi There", 8,
-+    (uint8_t*)"\xb6\x17\x31\x86\x55\x05\x72\x64\xe2\x8b\xc0\xb6\xfb\x37\x8c\x8e\xf1\x46\xbe\x00"
-   }, {
--    "Jefe", 4, "what do ya want for nothing?", 28,
--    "\xef\xfc\xdf\x6a\xe5\xeb\x2f\xa2\xd2\x74\x16\xd5\xf1\x84\xdf\x9c\x25\x9a\x7c\x79"
-+    (uint8_t*)"Jefe", 4, (uint8_t*)"what do ya want for nothing?", 28,
-+    (uint8_t*)"\xef\xfc\xdf\x6a\xe5\xeb\x2f\xa2\xd2\x74\x16\xd5\xf1\x84\xdf\x9c\x25\x9a\x7c\x79"
-   }, {
--    "\xaa", 20, "\xdd", 50,
--    "\x12\x5d\x73\x42\xb9\xac\x11\xcd\x91\xa3\x9a\xf4\x8a\xa1\x7b\x4f\x63\xf1\x75\xd3"
-+    (uint8_t*)"\xaa", 20, (uint8_t*)"\xdd", 50,
-+    (uint8_t*)"\x12\x5d\x73\x42\xb9\xac\x11\xcd\x91\xa3\x9a\xf4\x8a\xa1\x7b\x4f\x63\xf1\x75\xd3"
-   }, {
--    "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14"
--    "\x15\x16\x17\x18\x19", 25, "\xcd", 50,
--    "\x4c\x90\x07\xf4\x02\x62\x50\xc6\xbc\x84\x14\xf9\xbf\x50\xc8\x6c\x2d\x72\x35\xda"
-+    (uint8_t*)"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14"
-+    "\x15\x16\x17\x18\x19", 25, (uint8_t*)"\xcd", 50,
-+    (uint8_t*)"\x4c\x90\x07\xf4\x02\x62\x50\xc6\xbc\x84\x14\xf9\xbf\x50\xc8\x6c\x2d\x72\x35\xda"
-   }, {
--    "\x0c", 20, "Test With Truncation", 20,
--    "\x4c\x1a\x03\x42\x4b\x55\xe0\x7f\xe7\xf2\x7b\xe1\xd5\x8b\xb9\x32\x4a\x9a\x5a\x04"
-+    (uint8_t*)"\x0c", 20, (uint8_t*)"Test With Truncation", 20,
-+    (uint8_t*)"\x4c\x1a\x03\x42\x4b\x55\xe0\x7f\xe7\xf2\x7b\xe1\xd5\x8b\xb9\x32\x4a\x9a\x5a\x04"
-   }, {
--    "\xaa", 80, "Test Using Larger Than Block-Size Key - Hash Key First", 54,
--    "\xaa\x4a\xe5\xe1\x52\x72\xd0\x0e\x95\x70\x56\x37\xce\x8a\x3b\x55\xed\x40\x21\x12"
-+    (uint8_t*)"\xaa", 80, (uint8_t*)"Test Using Larger Than Block-Size Key - Hash Key First", 54,
-+    (uint8_t*)"\xaa\x4a\xe5\xe1\x52\x72\xd0\x0e\x95\x70\x56\x37\xce\x8a\x3b\x55\xed\x40\x21\x12"
-   }, {
--    "\xaa", 80,
--    "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data", 73,
--    "\xe8\xe9\x9d\x0f\x45\x23\x7d\x78\x6d\x6b\xba\xa7\x96\x5c\x78\x08\xbb\xff\x1a\x91"
-+    (uint8_t*)"\xaa", 80,
-+    (uint8_t*)"Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data", 73,
-+    (uint8_t*)"\xe8\xe9\x9d\x0f\x45\x23\x7d\x78\x6d\x6b\xba\xa7\x96\x5c\x78\x08\xbb\xff\x1a\x91"
-   }};
- 
-   debug("tpm_test_hmac()");
-   for (i = 0; i < sizeof(test_cases) / sizeof(test_cases[0]); i++) {
--    if (strlen(test_cases[i].key) < test_cases[i].key_len) {
-+    if (strlen((char*)test_cases[i].key) < test_cases[i].key_len) {
-       uint8_t key[test_cases[i].key_len];
-       memset(key, test_cases[i].key[0], test_cases[i].key_len);
-       hmac_init(&ctx, key, test_cases[i].key_len);
-     } else {
-       hmac_init(&ctx, test_cases[i].key, test_cases[i].key_len);
-     }
--    for (j = 0; j < test_cases[i].data_len; j += strlen(test_cases[i].data)) {
--      hmac_update(&ctx, test_cases[i].data, strlen(test_cases[i].data));
-+    for (j = 0; j < test_cases[i].data_len; j += strlen((char*)test_cases[i].data)) {
-+      hmac_update(&ctx, test_cases[i].data, strlen((char*)test_cases[i].data));
-     }
-     hmac_final(&ctx, digest);
-     if (memcmp(digest, test_cases[i].digest, SHA1_DIGEST_LENGTH) != 0) return -1;
-@@ -173,9 +174,9 @@ static int tpm_test_hmac(void)
- static int tpm_test_rsa_EK(void)
- {
-   int res = 0;
--  char *data = "RSA PKCS #1 v1.5 Test-String";
-+  uint8_t *data = (uint8_t*)"RSA PKCS #1 v1.5 Test-String";
-   uint8_t buf[256];
--  size_t buf_len, data_len = strlen(data);
-+  size_t buf_len, data_len = strlen((char*)data);
-   rsa_private_key_t priv_key;
-   rsa_public_key_t pub_key;
- 
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_ticks.c tpm_emulator/tpm/tpm_ticks.c
---- orig/tpm_emulator-0.4/tpm/tpm_ticks.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_ticks.c	2006-07-24 14:35:35.000000000 -0700
-@@ -1,6 +1,7 @@
- /* Software-Based Trusted Platform Module (TPM) Emulator for Linux
-  * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
-  *                    Swiss Federal Institute of Technology (ETH) Zurich
-+ * Copyright (C) 2005 INTEL Corp
-  *
-  * This module is free software; you can redistribute it and/or modify
-  * it under the terms of the GNU General Public License as published
-@@ -39,9 +40,7 @@ TPM_RESULT TPM_SetTickType(TPM_TICKTYPE 
- TPM_RESULT TPM_GetTicks(TPM_CURRENT_TICKS *currentTime)
- {
-   info("TPM_GetTicks()");
--  memcpy(currentTime, &tpmData.stany.data.currentTicks, 
--    sizeof(TPM_CURRENT_TICKS));
--  return TPM_SUCCESS;
-+  return TPM_DISABLED_CMD;
- }
- 
- TPM_RESULT TPM_TickStampBlob(TPM_KEY_HANDLE keyHandle, TPM_NONCE *antiReplay,
-@@ -49,64 +48,11 @@ TPM_RESULT TPM_TickStampBlob(TPM_KEY_HAN
-                              TPM_CURRENT_TICKS *currentTicks, 
-                              UINT32 *sigSize, BYTE **sig)
- {
--  TPM_RESULT res;
--  TPM_KEY_DATA *key;
--  BYTE *info, *p;
--  UINT32 info_length, length;
-   info("TPM_TickStampBlob()");
--  /* get key */
--  key = tpm_get_key(keyHandle);
--  if (key == NULL) return TPM_INVALID_KEYHANDLE;
--  /* verify authorization */ 
--  res = tpm_verify_auth(auth1, key->usageAuth, keyHandle);
--  if (res != TPM_SUCCESS) return res;
--  if (key->keyUsage != TPM_KEY_SIGNING && key->keyUsage != TPM_KEY_LEGACY
--      && key->keyUsage != TPM_KEY_IDENTITY) return TPM_INVALID_KEYUSAGE;
--  /* get current ticks */
--  TPM_GetTicks(currentTicks);
--  /* sign data using signature scheme PKCS1_SHA1 and TPM_SIGN_INFO container */
--  *sigSize = key->key.size >> 3;
--  *sig = tpm_malloc(*sigSize);
--  if (*sig == NULL) return TPM_FAIL; 
--  /* setup TPM_SIGN_INFO structure */
--  info_length = 30 + sizeof(TPM_DIGEST) + sizeof_TPM_CURRENT_TICKS(currentTicks);
--  info = tpm_malloc(info_length);
--  if (info == NULL) {
--    tpm_free(*sig);
--    return TPM_FAIL;
--  }
--  memcpy(&info[0], "\x05\x00TSTP", 6);
--  memcpy(&info[6], antiReplay->nonce, 20);
--  *(UINT32*)&info[26] = CPU_TO_BE32(20
--                        + sizeof_TPM_CURRENT_TICKS(currentTicks));
--  memcpy(&info[30], digestToStamp->digest, sizeof(TPM_DIGEST));
--  p = &info[30 + sizeof(TPM_DIGEST)]; 
--  length = sizeof_TPM_CURRENT_TICKS(currentTicks);
--  if (tpm_marshal_TPM_CURRENT_TICKS(&p, &length, currentTicks)
--      || rsa_sign(&key->key, RSA_SSA_PKCS1_SHA1, info, info_length, *sig)) {   
--    tpm_free(*sig);
--    tpm_free(info);
--    return TPM_FAIL;
--  } 
--  return TPM_SUCCESS;
-+  return TPM_DISABLED_CMD;
- }
- 
- void tpm_update_ticks(void)
- {
--  if (tpmData.stany.data.currentTicks.tag == 0) {
--    tpmData.stany.data.currentTicks.tag = TPM_TAG_CURRENT_TICKS;
--    tpmData.stany.data.currentTicks.currentTicks += tpm_get_ticks();
--/* removed since v1.2 rev 94
--    tpmData.stany.data.currentTicks.tickType = tpmData.permanent.data.tickType;
--*/
--    tpm_get_random_bytes(tpmData.stany.data.currentTicks.tickNonce.nonce, 
--      sizeof(TPM_NONCE));
--    tpmData.stany.data.currentTicks.tickRate = 1;
--/* removed since v1.2 rev 94
--    tpmData.stany.data.currentTicks.tickSecurity = TICK_SEC_NO_CHECK;
--*/
--  } else {
--    tpmData.stany.data.currentTicks.currentTicks += tpm_get_ticks();   
--  }
- }
- 
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_transport.c tpm_emulator/tpm/tpm_transport.c
---- orig/tpm_emulator-0.4/tpm/tpm_transport.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_transport.c	2006-07-24 14:35:35.000000000 -0700
-@@ -189,7 +189,7 @@ static void decrypt_wrapped_command(BYTE
-     sha1_init(&sha1);
-     sha1_update(&sha1, auth->nonceEven.nonce, sizeof(auth->nonceEven.nonce));
-     sha1_update(&sha1, auth->nonceOdd.nonce, sizeof(auth->nonceOdd.nonce));
--    sha1_update(&sha1, "in", 2);
-+    sha1_update(&sha1, (BYTE*)"in", 2);
-     sha1_update(&sha1, secret, sizeof(TPM_SECRET));
-     j = CPU_TO_BE32(i);
-     sha1_update(&sha1, (BYTE*)&j, 4);
-@@ -211,7 +211,7 @@ static void encrypt_wrapped_command(BYTE
-     sha1_init(&sha1);
-     sha1_update(&sha1, auth->nonceEven.nonce, sizeof(auth->nonceEven.nonce));
-     sha1_update(&sha1, auth->nonceOdd.nonce, sizeof(auth->nonceOdd.nonce));
--    sha1_update(&sha1, "out", 3);
-+    sha1_update(&sha1, (BYTE*)"out", 3);
-     sha1_update(&sha1, secret, sizeof(TPM_SECRET));
-     j = CPU_TO_BE32(i);
-     sha1_update(&sha1, (BYTE*)&j, 4);
-diff -uprN orig/tpm_emulator-0.4/tpmd.c tpm_emulator/tpmd.c
---- orig/tpm_emulator-0.4/tpmd.c	1969-12-31 16:00:00.000000000 -0800
-+++ tpm_emulator/tpmd.c	2006-07-24 14:35:35.000000000 -0700
-@@ -0,0 +1,156 @@
-+/* Software-Based Trusted Platform Module (TPM) Emulator for Linux
-+ * Copyright (C) 2005 INTEL Corp
-+ *
-+ * This module 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 module 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 <stdio.h>
-+#include <stdlib.h>
-+#include <unistd.h>
-+#include <string.h>
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include <fcntl.h>
-+#include <sys/time.h>
-+
-+#include "tpm_emulator.h"
-+
-+#define TPM_RX_FNAME "/var/tpm/tpm_in.fifo"
-+#define TPM_TX_FNAME "/var/tpm/tpm_out.fifo"
-+
-+#define BUFFER_SIZE 2048
-+
-+static int devurandom=0;
-+	  
-+void get_random_bytes(void *buf, int nbytes) {
-+  
-+  if (devurandom == 0) {
-+    devurandom = open("/dev/urandom", O_RDONLY);
-+  }
-+
-+  if (read(devurandom, buf, nbytes) != nbytes) {
-+      printf("Can't get random number.\n");
-+      exit(-1);
-+  }
-+}
-+
-+uint64_t tpm_get_ticks(void)
-+{
-+  //struct timeval tv;
-+  //int gettimeofday(&tv, struct timezone *tz);
-+  return 0;
-+}
-+
-+int main(int argc, char **argv)
-+{
-+  uint8_t in[BUFFER_SIZE], *out;
-+  uint32_t out_size;
-+  int in_size, written;
-+  int i;
-+  struct stat file_info;
-+
-+  int tpm_tx_fh=-1, tpm_rx_fh=-1;
-+  if (argc < 2) {
-+    printf("Usage: tpmd clear|save|deactivated\n" );
-+	  return -1;
-+  }
-+
-+  /* initialize TPM emulator */
-+  if (!strcmp(argv[1], "clear")) {
-+    printf("Initializing tpm: %s\n", argv[1]);
-+    tpm_emulator_init(1);
-+  } else if (!strcmp(argv[1], "save")) { 
-+    printf("Initializing tpm: %s\n", argv[1]);
-+    tpm_emulator_init(2);
-+  } else if (!strcmp(argv[1], "deactivated")) {
-+    printf("Initializing tpm: %s\n", argv[1]);
-+    tpm_emulator_init(3);
-+  } else {
-+    printf("invalid startup mode '%s'; must be 'clear', "
-+      "'save' (default) or 'deactivated", argv[1]);
-+    return -1;
-+  }
-+
-+  if ( stat(TPM_RX_FNAME, &file_info) == -1) {
-+    if ( mkfifo(TPM_RX_FNAME, S_IWUSR | S_IRUSR ) ) {
-+      printf("Failed to create fifo %s.\n", TPM_RX_FNAME);
-+      return -1;
-+    }
-+  }
-+
-+  if ( stat(TPM_TX_FNAME, &file_info) == -1) {
-+    if ( mkfifo(TPM_TX_FNAME, S_IWUSR | S_IRUSR ) ) {
-+      printf("Failed to create fifo %s.\n", TPM_TX_FNAME);
-+      return -1;
-+    }
-+  }
-+
-+  while (1) {
-+abort_command:
-+    if (tpm_rx_fh < 0) {
-+      tpm_rx_fh = open(TPM_RX_FNAME, O_RDONLY);
-+    }
-+    
-+    if (tpm_rx_fh < 0) {
-+      printf("ERROR: failed to open devices to listen to guest.\n");
-+      return -1;
-+    }
-+    
-+    if (tpm_tx_fh < 0) {
-+      tpm_tx_fh = open(TPM_TX_FNAME, O_WRONLY);
-+    }
-+
-+    if (tpm_tx_fh < 0) {
-+      printf("ERROR: failed to open devices to respond to guest.\n");
-+      return -1;
-+    }
-+
-+    in_size = read(tpm_rx_fh, in, BUFFER_SIZE);
-+    if (in_size < 6) { // Magic size of minium TPM command
-+      printf("Recv[%d] to small: 0x", in_size);
-+      if (in_size <= 0) {
-+          close(tpm_rx_fh);
-+          tpm_rx_fh = -1;
-+          goto abort_command;
-+      }
-+    } else { 
-+      printf("Recv[%d]: 0x", in_size);
-+      for (i=0; i< in_size; i++) 
-+        printf("%x ", in[i]);
-+      printf("\n");
-+    }
-+
-+    
-+    if (tpm_handle_command(in, in_size, &out, &out_size) != 0) { 
-+        printf("ERROR: Handler Failed.\n");
-+    }
-+
-+    written = write(tpm_tx_fh, out, out_size);
-+
-+    if (written != out_size ) {
-+      printf("ERROR: Part of response not written %d/%d.\nAttempt: ", written, out_size);
-+    } else {
-+      printf("Sent[%Zu]: ", out_size);
-+    }
-+    for (i=0; i< out_size; i++)
-+      printf("%x ", out[i]);
-+    printf("\n");
-+    tpm_free(out);
-+
-+  } // loop
-+
-+  tpm_emulator_shutdown();
-+
-+  close(tpm_tx_fh);
-+  close(tpm_rx_fh);
-+
-+}
-Binary files orig/tpm_emulator-0.4/tpm_emulator and tpm_emulator/tpm_emulator differ
-diff -uprN orig/tpm_emulator-0.4/tpm_version.h tpm_emulator/tpm_version.h
---- orig/tpm_emulator-0.4/tpm_version.h	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm_version.h	2006-07-24 14:35:41.000000000 -0700
-@@ -2,5 +2,5 @@
- #define _TPM_VERSION_H_
- #define VERSION_MAJOR 0
- #define VERSION_MINOR 4
--#define VERSION_BUILD 1151058734
-+#define VERSION_BUILD 1153776940
- #endif /* _TPM_VERSION_H_ */
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm/vtpm-0.5.1-LDLIBS.patch
--- a/tools/vtpm/vtpm-0.5.1-LDLIBS.patch	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-diff -Naurp tpm_emulator-0.5.1/tpmd/Makefile tpm_emulator-0.5.1/tpmd/Makefile
---- tpm_emulator-0.5.1/tpmd/Makefile
-+++ tpm_emulator-0.5.1/tpmd/Makefile
-@@ -8,7 +8,7 @@ WFLAGS  := -Wall -Wno-unused -Wpointer-a
-            #WFLAGS  += -Wextra -Wcast-qual -Wmissing-prototypes -Wmissing-declarations -Wstrict-aliasing
- CFLAGS  += $(WFLAGS) -g -I.. -I. -O2 -fno-strict-aliasing
- CFLAGS  += -I../../../../tools/vtpm_manager/manager
--LDFLAGS += -lgmp
-+LDLIBS  += -lgmp
- 
- BINDIR  := /usr/bin/
- 
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm/vtpm-0.5.1.patch
--- a/tools/vtpm/vtpm-0.5.1.patch	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,766 +0,0 @@
-diff -Naurp tpm_emulator-0.5.1/Makefile tpm5-test/Makefile
---- tpm_emulator-0.5.1/Makefile	2008-02-14 03:22:48.000000000 -0500
-+++ tpm5-test/Makefile	2009-07-15 09:45:28.000000000 -0400
-@@ -10,7 +10,7 @@ VERSION_MINOR  := 5
- VERSION_BUILD  := $(shell date +"%s")
- VERSION_SUFFIX := .1
- 
--SUBDIRS := tpmd tpmd_dev tddl
-+SUBDIRS := tpmd 
- 
- all: version all-recursive
- 
-@@ -48,12 +48,12 @@ user_install: user
- modules_install: modules
- 	@$(MAKE) -C tpmd_dev install || exit -1
- 
--DIRS    := . tpm crypto tpmd tpmd_dev tddl tpmd_dev_openbsd
-+DIRS    := . tpm crypto tpmd 
- DISTSRC := $(foreach dir, $(DIRS), $(wildcard $(dir)/*.c))
- DISTSRC += $(foreach dir, $(DIRS), $(wildcard $(dir)/*.h))
--DIRS    := . tpmd tpmd_dev tddl tpmd_dev_openbsd
-+DIRS    := . tpmd 
- DISTSRC += $(foreach dir, $(DIRS), $(dir)/Makefile)
--DISTSRC += ./README ./AUTHORS ./ChangeLog tpmd_dev/tpmd_dev.rules.in
-+DISTSRC += ./README ./AUTHORS ./ChangeLog 
- DISTDIR := tpm_emulator-$(VERSION_MAJOR).$(VERSION_MINOR)$(VERSION_SUFFIX)
- 
- dist: $(DISTSRC)
-diff -Naurp tpm_emulator-0.5.1/tpm/tpm_capability.c tpm5-test/tpm/tpm_capability.c
---- tpm_emulator-0.5.1/tpm/tpm_capability.c	2008-02-14 03:22:48.000000000 -0500
-+++ tpm5-test/tpm/tpm_capability.c	2009-07-16 12:04:20.000000000 -0400
-@@ -136,8 +136,19 @@ static TPM_RESULT cap_property(UINT32 su
- 
-     case TPM_CAP_PROP_TIS_TIMEOUT:
-       debug("[TPM_CAP_PROP_TIS_TIMEOUT]");
--      /* TODO: TPM_CAP_PROP_TIS_TIMEOUT */
--      return TPM_FAIL;
-+      /* TODO: TPM_CAP_PROP_TIS_TIMEOUT: Measure these values and determine correct ones */
-+      UINT32 len = *respSize = 16;
-+      BYTE *ptr = *resp = tpm_malloc(*respSize);
-+      if (ptr == NULL || 
-+          tpm_marshal_UINT32(&ptr, &len, 200000) ||
-+          tpm_marshal_UINT32(&ptr, &len, 200000) ||
-+          tpm_marshal_UINT32(&ptr, &len, 200000) ||
-+          tpm_marshal_UINT32(&ptr, &len, 200000)) {
-+        tpm_free(*resp);
-+        return TPM_FAIL;
-+      }
-+      return TPM_SUCCESS;
-+
- 
-     case TPM_CAP_PROP_STARTUP_EFFECT:
-       debug("[TPM_CAP_PROP_STARTUP_EFFECT]");
-@@ -189,8 +200,12 @@ static TPM_RESULT cap_property(UINT32 su
- 
-     case TPM_CAP_PROP_DURATION:
-       debug("[TPM_CAP_PROP_DURATION]");
--      /* TODO: TPM_CAP_PROP_DURATION */
--      return TPM_FAIL;
-+      /* TODO: TPM_CAP_PROP_DURATION: Measure these values and return accurate ones */
-+      BYTE dur[]= {0x0,0x0,0x0,0xc,0x0,0x7,0xa1,0x20,0x0,0x1e,0x84,0x80,0x11,0xe1,0xa3,0x0}; 
-+      *respSize = 16;
-+      *resp = tpm_malloc(*respSize);
-+      memcpy(*resp,dur,16); 
-+
- 
-     case TPM_CAP_PROP_ACTIVE_COUNTER:
-       debug("[TPM_CAP_PROP_ACTIVE_COUNTER]");
-diff -Naurp tpm_emulator-0.5.1/tpmd/Makefile tpm5-test/tpmd/Makefile
---- tpm_emulator-0.5.1/tpmd/Makefile	2008-02-14 03:22:48.000000000 -0500
-+++ tpm5-test/tpmd/Makefile	2009-07-16 12:08:26.000000000 -0400
-@@ -8,9 +8,10 @@ WFLAGS  := -Wall -Wno-unused -Wpointer-a
-            -Wwrite-strings -Wsign-compare -Wno-multichar
-            #WFLAGS  += -Wextra -Wcast-qual -Wmissing-prototypes -Wmissing-declarations -Wstrict-aliasing
- CFLAGS  += $(WFLAGS) -g -I.. -I. -O2 -fno-strict-aliasing
-+CFLAGS  += -I../../../../tools/vtpm_manager/manager
- LDFLAGS += -lgmp
- 
--BINDIR  := /usr/sbin/
-+BINDIR  := /usr/bin/
- 
- TPMD    := tpmd
- DIRS    := ../tpm ../crypto
-@@ -18,6 +19,8 @@ SRCS    := $(foreach dir, $(DIRS), $(wil
- OBJS    := $(patsubst %.c, %.o, $(SRCS))
- OBJS    := $(foreach dir, $(DIRS), $(patsubst $(dir)/%.o, %.o, $(filter $(dir)/%.o, $(OBJS))))
- 
-+VTPM_BIN := vtpmd
-+
- vpath %.c $(strip $(DIRS))
- 
- all: $(TPMD)
-@@ -32,10 +35,8 @@ TPMD_GROUP ?= tss
- INSTALL    ?= install
- 
- install: $(TPMD)
--	$(INSTALL) -m 755 -o $(TPMD_USER) -g $(TPMD_GROUP) -d $(DESTDIR)/var/lib/tpm
--	$(INSTALL) -m 755 -o $(TPMD_USER) -g $(TPMD_GROUP) -d $(DESTDIR)/var/run/tpm
- 	$(INSTALL) -D -d $(DESTDIR)/$(BINDIR)
--	$(INSTALL) -m 755 $(TPMD) $(DESTDIR)/$(BINDIR)
-+	$(INSTALL) -m 755 $(TPMD) $(DESTDIR)/$(BINDIR)/$(VTPM_BIN)
- 
- .PHONY: all clean install
- 
-diff -Naurp tpm_emulator-0.5.1/tpmd/tpmd.c tpm5-test/tpmd/tpmd.c
---- tpm_emulator-0.5.1/tpmd/tpmd.c	2008-02-14 03:22:48.000000000 -0500
-+++ tpm5-test/tpmd/tpmd.c	2009-07-16 11:19:05.000000000 -0400
-@@ -32,6 +32,9 @@
- #include <grp.h>
- #include "tpm_emulator_config.h"
- #include "tpm/tpm_emulator.h"
-+#include "tpm/tpm_structures.h"
-+#include "tpm/tpm_marshalling.h"
-+#include "vtpm_manager.h"
- 
- #define TPM_DAEMON_NAME     "tpmd"
- #define TPM_CMD_BUF_SIZE    4096
-@@ -39,6 +42,24 @@
- #define TPM_RANDOM_DEVICE   "/dev/urandom"
- #undef  TPM_MKDIRS
- 
-+#ifdef VTPM_MULTI_VM
-+ #define DEV_BE "/dev/vtpm"
-+ #define DEV_FE "/dev/tpm"
-+#else
-+ #define PVM_RX_FIFO_D "/var/vtpm/fifos/tpm_cmd_to_%d.fifo"
-+ #define PVM_TX_FIFO "/var/vtpm/fifos/tpm_rsp_from_all.fifo"
-+ #define HVM_RX_FIFO_D "/var/vtpm/socks/%d.socket"
-+
-+ #define VTPM_RX_FIFO_D "/var/vtpm/fifos/vtpm_rsp_to_%d.fifo"
-+ #define VTPM_TX_FIFO "/var/vtpm/fifos/vtpm_cmd_from_all.fifo"
-+
-+ static char *vtpm_rx_name=NULL;
-+#endif
-+
-+ static int vtpm_tx_fh=-1, vtpm_rx_fh=-1;
-+
-+#define BUFFER_SIZE 2048
-+
- static volatile int stopflag = 0;
- static int is_daemon = 0;
- static int opt_debug = 0;
-@@ -49,6 +70,8 @@ static const char *opt_storage_file = "/
- static uid_t opt_uid = 0;
- static gid_t opt_gid = 0;
- static int tpm_startup = 2;
-+static int vtpm_type = VTPM_TYPE_PVM;
-+int dmi_id = 0;
- static int rand_fh;
- 
- void tpm_log(int priority, const char *fmt, ...)
-@@ -90,56 +113,241 @@ uint64_t tpm_get_ticks(void)
- 
- int tpm_write_to_file(uint8_t *data, size_t data_length)
- {
--    int fh;
--    ssize_t res;
--    fh = open(opt_storage_file, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR);
--    if (fh < 0) return -1;
--    while (data_length > 0) {
--        res = write(fh, data, data_length);
--	if (res < 0) {
--	    close(fh);
--	    return -1;
--	}
--	data_length -= res; 
--	data += res;
-+  int res, out_data_size, in_header_size;
-+  BYTE *ptr, *out_data, *in_header;
-+  UINT32 result, len, in_rsp_size;
-+  UINT16 tag = VTPM_TAG_REQ;
-+	
-+  printf("Saving NVM\n");
-+  if (vtpm_tx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+    vtpm_tx_fh = open(DEV_FE, O_RDWR);
-+#else
-+	vtpm_tx_fh = open(VTPM_TX_FIFO, O_WRONLY);
-+#endif
-+  }
-+
-+  if (vtpm_tx_fh < 0) {
-+		return -1;
-+  }
-+ 
-+  // Send request to VTPM Manager to encrypt data
-+#ifdef VTPM_MUTLI_VM
-+  out_data_size = len = VTPM_COMMAND_HEADER_SIZE_CLT + data_length;
-+#else
-+  out_data_size = len = VTPM_COMMAND_HEADER_SIZE_SRV + data_length;
-+#endif
-+  
-+  out_data = ptr = (BYTE *) malloc(len);
-+
-+  if (ptr == NULL
-+#ifndef VTPM_MUTLI_VM
-+      || tpm_marshal_UINT32(&ptr, &len, dmi_id)
-+#endif
-+	  || tpm_marshal_UINT16(&ptr, &len, tag)
-+#ifdef VTPM_MUTLI_VM
-+	  || tpm_marshal_UINT32(&ptr, &len, out_data_size)
-+#else
-+	  || tpm_marshal_UINT32(&ptr, &len, out_data_size - sizeof(uint32_t))
-+#endif  
-+	  || tpm_marshal_UINT32(&ptr, &len, VTPM_ORD_SAVENVM)
-+	  || tpm_marshal_BYTE_ARRAY(&ptr, &len, data, data_length)) {
-+	free(out_data);
-+	return -1;
-+  }
-+  
-+  printf("\tSending SaveNVM Command.\n");
-+  res = write(vtpm_tx_fh, out_data, out_data_size);
-+  free(out_data);
-+  if (res != out_data_size) return -1;
-+
-+  if (vtpm_rx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+    vtpm_rx_fh = vtpm_tx_fh
-+#else
-+    if (vtpm_rx_name == NULL) {
-+      vtpm_rx_name = malloc(10 + strlen(VTPM_RX_FIFO_D));
-+      sprintf(vtpm_rx_name, VTPM_RX_FIFO_D, (uint32_t) dmi_id);
-     }
--    close(fh);
--    return 0;
-+	vtpm_rx_fh = open(vtpm_rx_name, O_RDONLY);
-+#endif
-+  }
-+
-+  if (vtpm_rx_fh < 0) {
-+		return -1;
-+  }
-+  
-+  // Read Header of response so we can get the size & status
-+#ifdef VTPM_MUTLI_VM
-+  in_header_size = len = VTPM_COMMAND_HEADER_SIZE_CLT;
-+#else
-+  in_header_size = len = VTPM_COMMAND_HEADER_SIZE_SRV;
-+#endif
-+  in_header = ptr = malloc(in_header_size);
-+  
-+  printf("\tReading SaveNVM header.\n");
-+  res = read(vtpm_rx_fh, in_header, in_header_size);
-+
-+  if ( (res != in_header_size)
-+#ifndef VTPM_MUTLI_VM
-+       || tpm_unmarshal_UINT32(&ptr, &len, (UINT32*)&dmi_id)
-+#endif
-+	   || tpm_unmarshal_UINT16(&ptr, &len, &tag)
-+	   || tpm_unmarshal_UINT32(&ptr, &len, &in_rsp_size)
-+	   || tpm_unmarshal_UINT32(&ptr, &len, &result) ) {
-+	  free(in_header);
-+	  return -1;
-+  }
-+  free(in_header);
-+  
-+  if (result != VTPM_SUCCESS) {
-+      return -1;  
-+  }
-+
-+#ifdef VTPM_MUTLI_VM
-+  close(vtpm_tx_fh); close(vtpm_rx_fh);
-+#endif
-+	  
-+  printf("\tFinishing up SaveNVM\n");
-+  return (0);
- }
- 
- int tpm_read_from_file(uint8_t **data, size_t *data_length)
- {
--    int fh;
--    ssize_t res;
--    size_t total_length;
--    fh = open(opt_storage_file, O_RDONLY);
--    if (fh < 0) return -1;
--    total_length = lseek(fh, 0, SEEK_END);
--    lseek(fh, 0, SEEK_SET);
--    *data = tpm_malloc(total_length);
--    if (*data == NULL) {
--        close(fh);
--        return -1;
--    }
--    *data_length = 0;
--    while (total_length > 0) {
--        res = read(fh, &(*data)[*data_length], total_length);
--	if (res < 0) {
--	    close(fh);
--	    tpm_free(*data);
--	    return -1;
--	}
--        *data_length += res;
--	total_length -= res;
-+  int res, out_data_size, in_header_size;
-+  uint8_t *ptr, *out_data, *in_header;
-+  UINT16 tag = VTPM_TAG_REQ;
-+  UINT32 len, in_rsp_size, result;
-+#ifdef VTPM_MUTLI_VM
-+	int vtpm_rx_fh, vtpm_tx_fh;
-+#endif
-+	
-+  printf("Loading NVM.\n");
-+  if (vtpm_tx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+    vtpm_tx_fh = open(DEV_FE, O_RDWR);
-+#else
-+	vtpm_tx_fh = open(VTPM_TX_FIFO, O_WRONLY);
-+#endif
-+  }
-+
-+  if (vtpm_tx_fh < 0) {
-+	printf("Error in read_from_file:301\n");
-+		return -1;
-+  }
-+ 
-+  // Send request to VTPM Manager to encrypt data
-+#ifdef VTPM_MUTLI_VM
-+  out_data_size = len = VTPM_COMMAND_HEADER_SIZE_CLT;
-+#else
-+  out_data_size = len = VTPM_COMMAND_HEADER_SIZE_SRV;
-+#endif
-+  out_data = ptr = (BYTE *) malloc(len);
-+
-+  if (ptr == NULL
-+#ifndef VTPM_MUTLI_VM
-+      || tpm_marshal_UINT32(&ptr, &len, dmi_id)
-+#endif  
-+      || tpm_marshal_UINT16(&ptr, &len, tag)
-+#ifdef VTPM_MUTLI_VM
-+      || tpm_marshal_UINT32(&ptr, &len, out_data_size)
-+#else
-+      || tpm_marshal_UINT32(&ptr, &len, out_data_size - sizeof(uint32_t))
-+#endif
-+      || tpm_marshal_UINT32(&ptr, &len, VTPM_ORD_LOADNVM)) {
-+    free(out_data);
-+    printf("Error in read_from_file:325\n");
-+
-+    return -1;
-+  }
-+
-+  printf("\tSending LoadNVM command\n");
-+  res = write(vtpm_tx_fh, out_data, out_data_size);
-+  free(out_data);
-+  if (res != out_data_size) 
-+    {
-+	printf("Error in read_from_file:335\n");
-+	return -1;
-+    }
-+
-+    if (vtpm_rx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+    vtpm_rx_fh = vtpm_tx_fh;
-+#else
-+    if (vtpm_rx_name == NULL) {
-+      vtpm_rx_name = malloc(10 + strlen(VTPM_RX_FIFO_D));
-+      sprintf(vtpm_rx_name, VTPM_RX_FIFO_D, (uint32_t) dmi_id);
-     }
--    close(fh);
--    return 0;
-+	vtpm_rx_fh = open(vtpm_rx_name, O_RDONLY);
-+#endif
-+  }
-+
-+  if (vtpm_rx_fh < 0) {
-+	printf("Error in read_from_file:352\n");	
-+	return -1;
-+  }
-+  
-+  // Read Header of response so we can get the size & status
-+#ifdef VTPM_MUTLI_VM
-+  in_header_size = len = VTPM_COMMAND_HEADER_SIZE_CLT;
-+#else
-+  in_header_size = len = VTPM_COMMAND_HEADER_SIZE_SRV;
-+#endif
-+  in_header = ptr = malloc(in_header_size);
-+  
-+  printf("\tReading LoadNVM header\n");
-+  res = read(vtpm_rx_fh, in_header, in_header_size);
-+
-+  if ( (res != in_header_size)
-+#ifndef VTPM_MUTLI_VM
-+       || tpm_unmarshal_UINT32(&ptr, &len, (UINT32*)&dmi_id)
-+#endif
-+       || tpm_unmarshal_UINT16(&ptr, &len, &tag)
-+       || tpm_unmarshal_UINT32(&ptr, &len, &in_rsp_size)
-+       || tpm_unmarshal_UINT32(&ptr, &len, &result) ) {
-+      free(in_header);
-+      printf("Error in read_from_file:375\n");     
-+      return -1;
-+  }
-+  free(in_header);
-+  
-+  if (result != VTPM_SUCCESS) {
-+    printf("Error in read_from_file:381\n");
-+    return -1;  
-+  }
-+
-+  // Read Encrypted data from VTPM Manager
-+  *data_length = in_rsp_size - VTPM_COMMAND_HEADER_SIZE_CLT;
-+  *data = (uint8_t *) malloc(*data_length);
-+
-+  printf("\tReading clear data from LoadNVM.\n");
-+  res = read(vtpm_rx_fh, *data, *data_length);
-+#ifdef VTPM_MUTLI_VM
-+  close(vtpm_rx_fh);close(vtpm_tx_fh);
-+#endif 
-+	
-+  printf("\tReturing from loading NVM\n");
-+  if (res != (int)*data_length) {
-+      free(*data);
-+      printf("Error in read_from_file:398\n");
-+      return -1;
-+  } else {
-+      return 0;
-+  }
-+
-+
-+    
- }
- 
- static void print_usage(char *name)
- {
-     printf("usage: %s [-d] [-f] [-s storage file] [-u unix socket name] "
--           "[-o user name] [-g group name] [-h] [startup mode]\n", name);
-+           "[-o user name] [-g group name] [-h]"
-+#ifdef VTPM_MULTI_VM
-+	   "clear|save|deactivated\n", name);
-+#else
-+	   "clear|save|deactivated pvm|hvm vtpmid\n", name);
-+#endif
-     printf("  d : enable debug mode\n");
-     printf("  f : forces the application to run in the foreground\n");
-     printf("  s : storage file to use (default: %s)\n", opt_storage_file);
-@@ -205,7 +413,13 @@ static void parse_options(int argc, char
-                 exit(EXIT_SUCCESS);
-         }
-     }
--    if (optind < argc) {
-+    /*Make sure we have all required options*/
-+#ifdef VTPM_MULTI_VM
-+#define EXTRA_OPTS 0
-+#else
-+#define EXTRA_OPTS 2
-+#endif
-+    if (optind < argc - EXTRA_OPTS ) {
-         debug("startup mode = '%s'", argv[optind]);
-         if (!strcmp(argv[optind], "clear")) {
-             tpm_startup = 1;
-@@ -219,6 +433,25 @@ static void parse_options(int argc, char
-             print_usage(argv[0]);
-             exit(EXIT_SUCCESS);
-         }
-+#ifndef VTPM_MULTI_VM
-+        ++optind;
-+	if(!strcmp(argv[optind], "pvm")) {
-+		vtpm_type = VTPM_TYPE_PVM;	// Get commands from vTPM Manager through fifo
-+	} else if (!strcmp(argv[optind], "hvm")) {
-+		vtpm_type = VTPM_TYPE_HVM;	// Get commands from qemu via socket
-+        } else {
-+		error("Invalid vm mode '%s'; must be 'pvm', "
-+			"or 'hvm' ", argv[optind]);
-+		print_usage(argv[0]);
-+		exit(EXIT_SUCCESS);
-+	}
-+        ++optind;
-+	dmi_id = atoi(argv[optind]);
-+#endif
-+    } else {
-+	error("Invalid number of arguments");
-+	print_usage(argv[0]);
-+	exit(EXIT_SUCCESS);
-     }
- }
- 
-@@ -348,93 +581,180 @@ static int init_socket(const char *name)
- 
- static void main_loop(void)
- {
--    int sock, fh, res;
--    int32_t in_len;
-+    int32_t in_len, written;
-     uint32_t out_len;
--    uint8_t in[TPM_CMD_BUF_SIZE], *out;
-+    uint8_t in[TPM_CMD_BUF_SIZE], *out, *addressed_out;
-+    int guest_id=-1;
-+    int i;
-+    char *vtpm_rx_file=NULL;
-+    int res;
-+
-+#ifndef VTPM_MULTI_VM
-+    int sockfd = -1;
-     struct sockaddr_un addr;
--    socklen_t addr_len;
--    fd_set rfds;
--    struct timeval tv;
-+    struct sockaddr_un client_addr;
-+    unsigned int client_length;
-+#endif
-+
-+    int vtpm_tx_fh=-1, vtpm_rx_fh=-1;
-+
-+#ifndef VTPM_MULTI_VM
-+  if (vtpm_type == VTPM_TYPE_PVM) {
-+    vtpm_rx_file = malloc(10 + strlen(PVM_RX_FIFO_D));
-+    sprintf(vtpm_rx_file, PVM_RX_FIFO_D, (uint32_t) dmi_id);
-+  } else {
-+    vtpm_rx_file = malloc(10 + strlen(HVM_RX_FIFO_D));
-+    sprintf(vtpm_rx_file, HVM_RX_FIFO_D, (uint32_t) dmi_id);
-+
-+    if ( (sockfd = socket(PF_UNIX,SOCK_STREAM,0)) < 0) {
-+          error("Unable to create socket. errno = %d\n", errno);
-+      exit (-1);
-+    }
-+
-+    memset(&addr, 0, sizeof(addr));
-+    addr.sun_family = AF_UNIX;
-+    strcpy(addr.sun_path,vtpm_rx_file );
-+    unlink(addr.sun_path);
-+  }
-+#endif
- 
-     info("staring main loop");
--    /* open UNIX socket */
--    sock = init_socket(opt_socket_name);
--    if (sock < 0) exit(EXIT_FAILURE);
-     /* init tpm emulator */
--    debug("initializing TPM emulator: %d", tpm_startup);
-+#ifdef VTPM_MULTI_VM
-+    debug("initializing TPM emulator: state=%d", tpm_startup);
-+#else
-+    debug("initializing TPM emulator: state=%d, type=%d, id=%d", tpm_startup, vtpm_type, dmi_id);
-+#endif
-     tpm_emulator_init(tpm_startup);
-     /* start command processing */
-     while (!stopflag) {
-         /* wait for incomming connections */
-         debug("waiting for connections...");
--        FD_ZERO(&rfds);
--        FD_SET(sock, &rfds);
--        tv.tv_sec = 10;
--        tv.tv_usec = 0;
--        res = select(sock + 1, &rfds, NULL, NULL, &tv);
--        if (res < 0) {
--            error("select(sock) failed: %s", strerror(errno));
--            break;
--        } else if (res == 0) {
--            continue;
--        }
--        addr_len = sizeof(addr);
--        fh = accept(sock, (struct sockaddr*)&addr, &addr_len);
--        if (fh < 0) {
--            error("accept() failed: %s", strerror(errno));
--            continue;
--        }
-+	if (vtpm_rx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+	    vtpm_rx_fh = open(DEV_BE, O_RDWR);
-+#else
-+	    if (vtpm_type == VTPM_TYPE_PVM)
-+	    {
-+		vtpm_rx_fh = open(vtpm_rx_file, O_RDONLY);
-+	    } else {
-+		if (bind(sockfd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-+		    error("Unable to bind(). errno = %d\n", errno);
-+		    exit (-1);
-+		}
-+
-+		if (listen(sockfd, 10) <0) {
-+		    error("Unable to listen(). errno = %d\n", errno);
-+		    exit (-1);
-+		} 
-+
-+		 memset(&client_addr, 0, sizeof(client_addr));
-+		 client_length = sizeof(client_addr);
-+
-+		 vtpm_rx_fh = vtpm_tx_fh = accept(sockfd, (struct sockaddr *)&client_addr, &client_length);
-+	    }
-+#endif
-+	}
-+	
-+	/*Error Checking*/
-+	if (vtpm_rx_fh < 0) {
-+	  error("Failed to open devices to listen to guest.\n");
-+	  exit(-1);
-+	}
-+
-         /* receive and handle commands */
-         in_len = 0;
-         do {
-             debug("waiting for commands...");
--            FD_ZERO(&rfds);
--            FD_SET(fh, &rfds);
--            tv.tv_sec = TPM_COMMAND_TIMEOUT;
--            tv.tv_usec = 0;
--            res = select(fh + 1, &rfds, NULL, NULL, &tv);
--            if (res < 0) {
--                error("select(fh) failed: %s", strerror(errno));
--                close(fh);
--                break;
--            } else if (res == 0) {
--#ifdef TPMD_DISCONNECT_IDLE_CLIENTS	    
--                info("connection closed due to inactivity");
--                close(fh);
--                break;
--#else		
--                continue;
--#endif		
--            }
--            in_len = read(fh, in, sizeof(in));
--            if (in_len > 0) {
-+
-+            in_len = read(vtpm_rx_fh, in, sizeof(in));
-+	    /*Magic size of minimum TPM command is 6*/
-+		//FIXME Magic size check may not be required anymore
-+            if (in_len < 6) {
-+		info("Recv incomplete command of %d bytes.", in_len);
-+		if (in_len <= 0) {
-+		    close(vtpm_rx_fh);
-+		    vtpm_rx_fh = -1;
-+		    continue;
-+                 }
-+	    } else {
-+		/*Debug Printouts*/
-                 debug("received %d bytes", in_len);
-+		debug_nostop("Recv[%d]: 0x", in_len);
-+		for (i=0; i< in_len; i++) 
-+		    debug_more("%x ", in[i]);
-+		debug_more("\n");
-+		/*Multiple Guest check*/
-+		if (guest_id == -1) {
-+		    guest_id = *((int32_t *) in);
-+		} else {
-+		    if (guest_id != *((int32_t *) in) ) {
-+			error("WARNING: More than one guest attached\n");
-+		    }
-+		}
-+
-+		/*Open tx handle now*/
-+		if (vtpm_tx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+		    vtpm_tx_fh = open(DEV_BE, O_RDWR);
-+		    vtpm_rx_fh = vtpm_tx_fh;
-+#else
-+		    if (vtpm_type == VTPM_TYPE_PVM) {
-+			vtpm_tx_fh = open(PVM_TX_FIFO, O_WRONLY);
-+     		    } // No need to open the other direction for HVM
-+#endif
-+		}
-+		if (vtpm_tx_fh < 0) {
-+		  error("Failed to open devices to respond to guest.\n");
-+		  exit(-1);
-+		}
-+
-+		/*Handle the TPM command now*/
-                 out = NULL;
--                res = tpm_handle_command(in, in_len, &out, &out_len);
-+                res = tpm_handle_command(in + sizeof(uint32_t), in_len - sizeof(uint32_t), &out, &out_len);
-                 if (res < 0) {
-                     error("tpm_handle_command() failed");
-                 } else {
-                     debug("sending %d bytes", out_len);
-+		    //FIXME this prepending may or may not be needed
-+		    /*Prepend the first 4 bytes of the in buffer.. why?*/
-+		    addressed_out = (uint8_t *) tpm_malloc(sizeof(uint32_t) + out_len);
-+		    *(uint32_t *) addressed_out = *(uint32_t *) in;
-+		    memcpy(addressed_out + sizeof(uint32_t), out, out_len);
-+		    out_len += sizeof(uint32_t);
-+		    /*End Prepend*/
-+
-+		    /*Perform write operation now*/
-                     while (out_len > 0) {
--                        res = write(fh, out, out_len);
-+                        res = write(vtpm_tx_fh, addressed_out, out_len);
-+
-                         if (res < 0) {
-                             error("write(%d) failed: %s", out_len, strerror(errno));
-                             break;
--                        }
-+                        } else {
-+			  debug_nostop("Sent[%Zu]: ", out_len);
-+			  for (i=0; (unsigned int)i< out_len; i++)
-+			    debug_more("%x ", addressed_out[i]);
-+			  debug_more("\n");
-+			}
-                         out_len	-= res;
-                     }
-                     tpm_free(out);
-+		    tpm_free(addressed_out);
-                 }
-             }
-         } while (in_len > 0);
--        close(fh);
-+        //close(fh);
-     }
-+    
-     /* shutdown tpm emulator */
-     tpm_emulator_shutdown();
--    /* close socket */
--    close(sock);
--    unlink(opt_socket_name);
-+    /* Close handles */
-+    close(vtpm_tx_fh);
-+#ifndef VTPM_MULTI_VM
-+    close(vtpm_rx_fh);
-+    free(vtpm_rx_file);
-+#endif
-     info("main loop stopped");
- }
- 
-@@ -450,12 +770,13 @@ int main(int argc, char **argv)
-     /* open random device */
-     init_random();
-     /* init signal handlers */
--    init_signal_handler();
-+    //init_signal_handler();
-     /* unless requested otherwiese, fork and daemonize process */
--    if (!opt_foreground) daemonize();
-+    //if (!opt_foreground) daemonize();
-     /* start main processing loop */
-     main_loop();
-     info("stopping TPM Emulator daemon");
-     closelog();
-     return 0;
- }
-+
-diff -Naurp tpm_emulator-0.5.1/tpmd/tpm_emulator_config.h tpm5-test/tpmd/tpm_emulator_config.h
---- tpm_emulator-0.5.1/tpmd/tpm_emulator_config.h	2008-02-14 03:22:48.000000000 -0500
-+++ tpm5-test/tpmd/tpm_emulator_config.h	2009-07-16 11:25:26.000000000 -0400
-@@ -29,23 +29,28 @@
- 
- /* TPM emulator configuration */
- 
--#undef  TPM_STRONG_PERSISTENCE
--#undef  TPM_GENERATE_EK
-+#define  TPM_STRONG_PERSISTENCE
-+#define  TPM_GENERATE_EK
- #undef  TPM_GENERATE_SEED_DAA
- #undef  TPM_MEMORY_ALIGNMENT_MANDATORY
- 
-+extern int dmi_id;
-+
- /* log macros */
- 
- void tpm_log(int priority, const char *fmt, ...);
- 
--#define debug(fmt, ...) tpm_log(LOG_DEBUG, "%s:%d: Debug: " fmt "\n", \
--                                __FILE__, __LINE__, ## __VA_ARGS__)
--#define info(fmt, ...)  tpm_log(LOG_INFO, "%s:%d: Info: " fmt "\n", \
--                                __FILE__, __LINE__, ## __VA_ARGS__)
--#define error(fmt, ...) tpm_log(LOG_ERR, "%s:%d: Error: " fmt "\n", \
--                                __FILE__, __LINE__, ## __VA_ARGS__)
--#define alert(fmt, ...) tpm_log(LOG_ALERT, "%s:%d: Alert: " fmt "\n", \
--                                __FILE__, __LINE__, ## __VA_ARGS__)
-+#define debug(fmt, ...) tpm_log(LOG_DEBUG, "VTPMD[%d]: %s:%d: Debug: " fmt "\n", \
-+                                dmi_id, __FILE__, __LINE__, ## __VA_ARGS__)
-+#define info(fmt, ...)  tpm_log(LOG_INFO, "VTPMD[%d]: %s:%d: Info: " fmt "\n", \
-+                                dmi_id, __FILE__, __LINE__, ## __VA_ARGS__)
-+#define error(fmt, ...) tpm_log(LOG_ERR, "VTPMD[%d]: %s:%d: Error: " fmt "\n", \
-+                                dmi_id, __FILE__, __LINE__, ## __VA_ARGS__)
-+#define alert(fmt, ...) tpm_log(LOG_ALERT, "VTPMD[%d]: %s:%d: Alert: " fmt "\n", \
-+                                dmi_id, __FILE__, __LINE__, ## __VA_ARGS__)
-+#define debug_nostop(fmt, ...) tpm_log(LOG_DEBUG, "VTPMD[%d]: %s:%d: Debug: " fmt, \
-+                                dmi_id, __FILE__, __LINE__, ## __VA_ARGS__)
-+#define debug_more(fmt, ...) tpm_log(LOG_DEBUG, fmt, ## __VA_ARGS__)
- 
- /*  min/max macros that also do strict type-checking */
- 
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm/vtpm.patch
--- a/tools/vtpm/vtpm.patch	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,716 +0,0 @@
-diff -uprN tpm_emulator/AUTHORS vtpm/AUTHORS
---- tpm_emulator/AUTHORS	2006-12-08 12:51:29.000000000 -0800
-+++ vtpm/AUTHORS	2006-12-13 16:38:52.000000000 -0800
-@@ -1,3 +1,3 @@
- Mario Strasser <mast@gmx.net>
- Heiko Stamer <stamer@gaos.org> [DAA]
--INTEL Corp <> [Dropped to Ring3]
-+INTEL Corp <> [VTPM Extensions]
-diff -uprN tpm_emulator/ChangeLog vtpm/ChangeLog
---- tpm_emulator/ChangeLog	2006-12-08 12:51:29.000000000 -0800
-+++ vtpm/ChangeLog	2006-12-13 16:38:52.000000000 -0800
-@@ -1,5 +1,6 @@
- ????-??-?? Intel Corp
- 	* Moved module out of kernel to run as a ring 3 app
-+	* Modified save_to_file and load_from_file to call xen VTPM manager
- 
- 2006-06-23  Mario Strasser <mast@gmx.net>
- 	* tpm_startup.c: behaviour of ST_CLEAR and storage of
-diff -uprN tpm_emulator/linux_module.h vtpm/linux_module.h
---- tpm_emulator/linux_module.h	2006-12-08 12:51:29.000000000 -0800
-+++ vtpm/linux_module.h	2007-01-09 14:49:06.000000000 -0800
-@@ -44,18 +44,26 @@
- #define TPM_DEVICE_NAME   "tpm"
- #define TPM_MODULE_NAME   "tpm_emulator"
- 
-+/* debug and log output functions */
-+extern int dmi_id; 
-+
- #ifdef DEBUG
--#define debug(fmt, ...) printf("TPMD: %s:%d: Debug: " fmt "\n", \
--                        __FILE__, __LINE__, ## __VA_ARGS__)
-+#define debug(fmt, ...) printf("TPMD[%d]: %s:%d: Debug: " fmt "\n", \
-+                        dmi_id, __FILE__, __LINE__, ## __VA_ARGS__)
-+#define debug_nostop(fmt, ...) printf("TPMD[%d]: %s:%d: Debug: " fmt, \
-+                        dmi_id, __FILE__, __LINE__, ## __VA_ARGS__)
-+#define debug_more(fmt, ...) printf( fmt, ## __VA_ARGS__ )
- #else
- #define debug(fmt, ...) 
-+#define debug_nostop(fmt, ...) 
-+#define debug_more(fmt, ...)
- #endif
--#define info(fmt, ...)  printf("TPMD: %s:%d: Info: " fmt "\n", \
--                        __FILE__, __LINE__, ## __VA_ARGS__)
--#define error(fmt, ...) printf("TPMD: %s:%d: Error: " fmt "\n", \
--                        __FILE__, __LINE__, ## __VA_ARGS__)
--#define alert(fmt, ...) printf("TPMD: %s:%d: Alert: " fmt "\n", \
--                        __FILE__, __LINE__, ## __VA_ARGS__)
-+#define info(fmt, ...)  printf("TPMD[%d]: %s:%d: Info: " fmt "\n", \
-+                        dmi_id, __FILE__, __LINE__, ## __VA_ARGS__)
-+#define error(fmt, ...) printf("TPMD[%d]: %s:%d: Error: " fmt "\n", \
-+                        dmi_id, __FILE__, __LINE__, ## __VA_ARGS__)
-+#define alert(fmt, ...) printf("TPMD[%d]: %s:%d: Alert: " fmt "\n", \
-+                        dmi_id, __FILE__, __LINE__, ## __VA_ARGS__)
- 
- /* memory allocation */
- 
-diff -uprN tpm_emulator/Makefile vtpm/Makefile
---- tpm_emulator/Makefile	2006-12-08 12:51:29.000000000 -0800
-+++ vtpm/Makefile	2006-12-13 16:38:52.000000000 -0800
-@@ -7,7 +7,7 @@
- COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/)
- 
- # module settings
--BIN            := tpm_emulator
-+BIN            := vtpmd
- VERSION_MAJOR  := 0
- VERSION_MINOR  := 4
- VERSION_BUILD  := $(shell date +"%s")
-@@ -22,7 +22,7 @@ TOOLS_INSTALL_DIR = $(DESTDIR)/usr/bin
- 
- CC      := gcc
- CFLAGS  += -g -Wall $(INCLUDE) -DDEBUG
--CFLAGS  += -I. -Itpm
-+CFLAGS  += -I. -Itpm -I../../vtpm_manager/manager
- 
- # Is the simulator running in it's own vm?
- #CFLAGS += -DVTPM_MULTI_VM
-@@ -62,7 +62,6 @@ $(BIN):	$(src)/crypto/gmp.h $(src)/crypt
- 
- install: $(BIN)
- 	$(INSTALL_PROG) $(BIN) $(TOOLS_INSTALL_DIR)
--	@if [ ! -d "/var/tpm" ]; then mkdir /var/tpm; fi
- 
- clean:
- 	rm -f $(src)/crypto/gmp.h $(src)/crypto/libgmp.a $(OBJS)
-@@ -98,3 +97,4 @@ version:
- 	@echo "#endif /* _TPM_VERSION_H_ */" >> $(src)/tpm_version.h
- 
- .PHONY: all install clean dist gmp version
-+
-diff -uprN tpm_emulator/tpm/tpm_capability.c vtpm/tpm/tpm_capability.c
---- tpm_emulator/tpm/tpm_capability.c	2006-06-23 03:37:07.000000000 -0700
-+++ vtpm/tpm/tpm_capability.c	2007-01-10 10:00:49.000000000 -0800
-@@ -136,8 +136,18 @@ static TPM_RESULT cap_property(UINT32 su
- 
-     case TPM_CAP_PROP_TIS_TIMEOUT:
-       debug("[TPM_CAP_PROP_TIS_TIMEOUT]");
--      /* TODO: TPM_CAP_PROP_TIS_TIMEOUT */
--      return TPM_FAIL;
-+      /* TODO: TPM_CAP_PROP_TIS_TIMEOUT: Measure these values and determine correct ones */
-+      UINT32 len = *respSize = 16;
-+      BYTE *ptr = *resp = tpm_malloc(*respSize);
-+      if (ptr == NULL || 
-+          tpm_marshal_UINT32(&ptr, &len, 200000) ||
-+          tpm_marshal_UINT32(&ptr, &len, 200000) ||
-+          tpm_marshal_UINT32(&ptr, &len, 200000) ||
-+          tpm_marshal_UINT32(&ptr, &len, 200000)) {
-+        tpm_free(*resp);
-+        return TPM_FAIL;
-+      }
-+      return TPM_SUCCESS;
- 
-     case TPM_CAP_PROP_STARTUP_EFFECT:
-       debug("[TPM_CAP_PROP_STARTUP_EFFECT]");
-@@ -190,7 +200,11 @@ static TPM_RESULT cap_property(UINT32 su
- 
-     case TPM_CAP_PROP_DURATION:
-       debug("[TPM_CAP_PROP_DURATION]");
--      /* TODO: TPM_CAP_PROP_DURATION */
-+      /* TODO: TPM_CAP_PROP_DURATION: Measure these values and return accurate ones */
-+      BYTE dur[]= {0x0,0x0,0x0,0xc,0x0,0x7,0xa1,0x20,0x0,0x1e,0x84,0x80,0x11,0xe1,0xa3,0x0}; 
-+      *respSize = 16;
-+      *resp = tpm_malloc(*respSize);
-+      memcpy(*resp,dur,16); 
-       return TPM_FAIL;
- 
-     case TPM_CAP_PROP_ACTIVE_COUNTER:
-diff -uprN tpm_emulator/tpm/tpm_cmd_handler.c vtpm/tpm/tpm_cmd_handler.c
---- tpm_emulator/tpm/tpm_cmd_handler.c	2008-02-27 16:35:41.000000000 -0500
-+++ vtpm/tpm/tpm_cmd_handler.c	2008-02-28 14:43:28.000000000 -0500
-@@ -94,12 +94,18 @@ void tpm_compute_out_param_digest(TPM_CO
-   sha1_ctx_t sha1;
-   UINT32 res = CPU_TO_BE32(rsp->result);
-   UINT32 ord = CPU_TO_BE32(ordinal);
-+  UINT32 offset = 0;
- 
-   /* compute SHA1 hash */
-   sha1_init(&sha1);
-   sha1_update(&sha1, (BYTE*)&res, 4);
-   sha1_update(&sha1, (BYTE*)&ord, 4);
--  sha1_update(&sha1, rsp->param, rsp->paramSize);
-+  if (ordinal == TPM_ORD_LoadKey2) {
-+      offset = 4;
-+  }
-+  if (rsp->paramSize - offset > 0) {
-+      sha1_update(&sha1, rsp->param + offset, rsp->paramSize - offset);
-+  }
-   sha1_final(&sha1, rsp->auth1->digest);
-   if (rsp->auth2 != NULL) memcpy(rsp->auth2->digest, 
-     rsp->auth1->digest, sizeof(rsp->auth1->digest));
-diff -uprN tpm_emulator/tpm/tpm_data.c vtpm/tpm/tpm_data.c
---- tpm_emulator/tpm/tpm_data.c	2008-02-27 16:35:41.000000000 -0500
-+++ vtpm/tpm/tpm_data.c	2008-02-27 16:35:40.000000000 -0500
-@@ -1,6 +1,7 @@
- /* Software-Based Trusted Platform Module (TPM) Emulator for Linux
-  * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
-  *                    Swiss Federal Institute of Technology (ETH) Zurich
-+ * Copyright (C) 2005 INTEL Corp
-  *
-  * This module is free software; you can redistribute it and/or modify
-  * it under the terms of the GNU General Public License as published
-@@ -15,10 +16,15 @@
-  * $Id: tpm_data.c 98 2006-05-07 14:16:29Z hstamer $
-  */
- 
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include <fcntl.h>
-+#include <unistd.h>
-+
- #include "tpm_emulator.h"
- #include "tpm_structures.h"
- #include "tpm_marshalling.h"
--#include "linux_module.h"
-+#include "vtpm_manager.h"
- 
- TPM_DATA tpmData;
- 
-@@ -158,45 +164,232 @@ void tpm_release_data(void)
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
--#include <unistd.h>
- 
--#define TPM_STORAGE_FILE "/var/tpm/tpm_emulator-1.2." STR(VERSION_MAJOR) "." STR(VERSION_MINOR) 
-+ static int vtpm_tx_fh=-1, vtpm_rx_fh=-1;
-+
-+#ifdef VTPM_MUTLI_VM
-+ #define DEV_FE "/dev/tpm"
-+#else
-+ #define VTPM_RX_FIFO_D  "/var/vtpm/fifos/vtpm_rsp_to_%d.fifo"
-+ #define VTPM_TX_FIFO  "/var/vtpm/fifos/vtpm_cmd_from_all.fifo"
-+
-+ extern int dmi_id;
-+ static char *vtpm_rx_name=NULL; 
-+#endif
- 
- static int write_to_file(uint8_t *data, size_t data_length)
- {
--  int res;
--  int fp;
--  fp = open(TPM_STORAGE_FILE, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR);
--  res = write(fp, data, data_length);
--  close(fp);
--  return (res == data_length) ? 0 : -1;
-+  int res, out_data_size, in_header_size;
-+  BYTE *ptr, *out_data, *in_header;
-+  UINT32 result, len, in_rsp_size;
-+  UINT16 tag = VTPM_TAG_REQ;
-+	
-+  printf("Saving NVM\n");
-+  if (vtpm_tx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+    vtpm_tx_fh = open(DEV_FE, O_RDWR);
-+#else
-+	vtpm_tx_fh = open(VTPM_TX_FIFO, O_WRONLY);
-+#endif
-+  }
-+
-+  if (vtpm_tx_fh < 0) {
-+		return -1;
-+  }
-+ 
-+  // Send request to VTPM Manager to encrypt data
-+#ifdef VTPM_MUTLI_VM
-+  out_data_size = len = VTPM_COMMAND_HEADER_SIZE_CLT + data_length;
-+#else
-+  out_data_size = len = VTPM_COMMAND_HEADER_SIZE_SRV + data_length;
-+#endif
-+  
-+  out_data = ptr = (BYTE *) malloc(len);
-+
-+  if (ptr == NULL
-+#ifndef VTPM_MUTLI_VM
-+      || tpm_marshal_UINT32(&ptr, &len, dmi_id)
-+#endif
-+	  || tpm_marshal_UINT16(&ptr, &len, tag)
-+#ifdef VTPM_MUTLI_VM
-+	  || tpm_marshal_UINT32(&ptr, &len, out_data_size)
-+#else
-+	  || tpm_marshal_UINT32(&ptr, &len, out_data_size - sizeof(uint32_t))
-+#endif  
-+	  || tpm_marshal_UINT32(&ptr, &len, VTPM_ORD_SAVENVM)
-+	  || tpm_marshal_BYTE_ARRAY(&ptr, &len, data, data_length)) {
-+	free(out_data);
-+	return -1;
-+  }
-+  
-+  printf("\tSending SaveNVM Command.\n");
-+  res = write(vtpm_tx_fh, out_data, out_data_size);
-+  free(out_data);
-+  if (res != out_data_size) return -1;
-+
-+  if (vtpm_rx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+    vtpm_rx_fh = vtpm_tx_fh
-+#else
-+    if (vtpm_rx_name == NULL) {
-+      vtpm_rx_name = malloc(10 + strlen(VTPM_RX_FIFO_D));
-+      sprintf(vtpm_rx_name, VTPM_RX_FIFO_D, (uint32_t) dmi_id);
-+    }
-+	vtpm_rx_fh = open(vtpm_rx_name, O_RDONLY);
-+#endif
-+  }
-+
-+  if (vtpm_rx_fh < 0) {
-+		return -1;
-+  }
-+  
-+  // Read Header of response so we can get the size & status
-+#ifdef VTPM_MUTLI_VM
-+  in_header_size = len = VTPM_COMMAND_HEADER_SIZE_CLT;
-+#else
-+  in_header_size = len = VTPM_COMMAND_HEADER_SIZE_SRV;
-+#endif
-+  in_header = ptr = malloc(in_header_size);
-+  
-+  printf("\tReading SaveNVM header.\n");
-+  res = read(vtpm_rx_fh, in_header, in_header_size);
-+
-+  if ( (res != in_header_size)
-+#ifndef VTPM_MUTLI_VM
-+       || tpm_unmarshal_UINT32(&ptr, &len, (UINT32*)&dmi_id)
-+#endif
-+	   || tpm_unmarshal_UINT16(&ptr, &len, &tag)
-+	   || tpm_unmarshal_UINT32(&ptr, &len, &in_rsp_size)
-+	   || tpm_unmarshal_UINT32(&ptr, &len, &result) ) {
-+	  free(in_header);
-+	  return -1;
-+  }
-+  free(in_header);
-+  
-+  if (result != VTPM_SUCCESS) {
-+      return -1;  
-+  }
-+
-+#ifdef VTPM_MUTLI_VM
-+  close(vtpm_tx_fh); close(vtpm_rx_fh);
-+#endif
-+	  
-+  printf("\tFinishing up SaveNVM\n");
-+  return (0);
- }
- 
- static int read_from_file(uint8_t **data, size_t *data_length)
- {
--  int res;
--  int fp, file_status;
--  struct stat file_info;
--  fp = open(TPM_STORAGE_FILE, O_RDONLY, 0);
--  file_status = fstat(fp, &file_info);
--  if (file_status < 0) {
--    close(fp);
--    return -1;
--  } 
-+  int res, out_data_size, in_header_size;
-+  uint8_t *ptr, *out_data, *in_header;
-+  UINT16 tag = VTPM_TAG_REQ;
-+  UINT32 len, in_rsp_size, result;
-+#ifdef VTPM_MUTLI_VM
-+	int vtpm_rx_fh, vtpm_tx_fh;
-+#endif
-+	
-+  printf("Loading NVM.\n");
-+  if (vtpm_tx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+    vtpm_tx_fh = open(DEV_FE, O_RDWR);
-+#else
-+	vtpm_tx_fh = open(VTPM_TX_FIFO, O_WRONLY);
-+#endif
-+  }
- 
--  *data_length = file_info.st_size; 
--  *data = tpm_malloc(*data_length);
--  if (*data == NULL) {
--    close(fp);
-+  if (vtpm_tx_fh < 0) {
-+		return -1;
-+  }
-+ 
-+  // Send request to VTPM Manager to encrypt data
-+#ifdef VTPM_MUTLI_VM
-+  out_data_size = len = VTPM_COMMAND_HEADER_SIZE_CLT;
-+#else
-+  out_data_size = len = VTPM_COMMAND_HEADER_SIZE_SRV;
-+#endif
-+  out_data = ptr = (BYTE *) malloc(len);
-+
-+  if (ptr == NULL
-+#ifndef VTPM_MUTLI_VM
-+      || tpm_marshal_UINT32(&ptr, &len, dmi_id)
-+#endif  
-+      || tpm_marshal_UINT16(&ptr, &len, tag)
-+#ifdef VTPM_MUTLI_VM
-+      || tpm_marshal_UINT32(&ptr, &len, out_data_size)
-+#else
-+      || tpm_marshal_UINT32(&ptr, &len, out_data_size - sizeof(uint32_t))
-+#endif
-+      || tpm_marshal_UINT32(&ptr, &len, VTPM_ORD_LOADNVM)) {
-+    free(out_data);
-     return -1;
-   }
--  res = read(fp, *data, *data_length);
--  close(fp);
-+
-+  printf("\tSending LoadNVM command\n");
-+  res = write(vtpm_tx_fh, out_data, out_data_size);
-+  free(out_data);
-+  if (res != out_data_size) return -1;
-+
-+    if (vtpm_rx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+    vtpm_rx_fh = vtpm_tx_fh;
-+#else
-+    if (vtpm_rx_name == NULL) {
-+      vtpm_rx_name = malloc(10 + strlen(VTPM_RX_FIFO_D));
-+      sprintf(vtpm_rx_name, VTPM_RX_FIFO_D, (uint32_t) dmi_id);
-+    }
-+	vtpm_rx_fh = open(vtpm_rx_name, O_RDONLY);
-+#endif
-+  }
-+
-+  if (vtpm_rx_fh < 0) {
-+		return -1;
-+  }
-+  
-+  // Read Header of response so we can get the size & status
-+#ifdef VTPM_MUTLI_VM
-+  in_header_size = len = VTPM_COMMAND_HEADER_SIZE_CLT;
-+#else
-+  in_header_size = len = VTPM_COMMAND_HEADER_SIZE_SRV;
-+#endif
-+  in_header = ptr = malloc(in_header_size);
-+  
-+  printf("\tReading LoadNVM header\n");
-+  res = read(vtpm_rx_fh, in_header, in_header_size);
-+
-+  if ( (res != in_header_size)
-+#ifndef VTPM_MUTLI_VM
-+       || tpm_unmarshal_UINT32(&ptr, &len, (UINT32*)&dmi_id)
-+#endif
-+       || tpm_unmarshal_UINT16(&ptr, &len, &tag)
-+       || tpm_unmarshal_UINT32(&ptr, &len, &in_rsp_size)
-+       || tpm_unmarshal_UINT32(&ptr, &len, &result) ) {
-+      free(in_header);
-+      return -1;
-+  }
-+  free(in_header);
-+  
-+  if (result != VTPM_SUCCESS) {
-+      return -1;  
-+  }
-+
-+  // Read Encrypted data from VTPM Manager
-+  *data_length = in_rsp_size - VTPM_COMMAND_HEADER_SIZE_CLT;
-+  *data = (uint8_t *) malloc(*data_length);
-+
-+  printf("\tReading clear data from LoadNVM.\n");
-+  res = read(vtpm_rx_fh, *data, *data_length);
-+#ifdef VTPM_MUTLI_VM
-+  close(vtpm_rx_fh);close(vtpm_tx_fh);
-+#endif 
-+	
-+  printf("\tReturing from loading NVM\n");
-   if (res != *data_length) {
--    tpm_free(*data);
--    return -1;
-+      free(*data);
-+      return -1;
-+  } else {
-+      return 0;
-   }
--  return 0;
-+
- }
- 
- #else
-diff -uprN tpm_emulator/tpmd.c vtpm/tpmd.c
---- tpm_emulator/tpmd.c	2006-12-08 12:51:29.000000000 -0800
-+++ vtpm/tpmd.c	2007-01-09 14:48:56.000000000 -0800
-@@ -21,12 +21,24 @@
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <sys/time.h>
-+#include <sys/socket.h>
-+#include <sys/un.h>
-+#include <errno.h>
- 
- #include "tpm_emulator.h"
-+#include "vtpm_manager.h"
- 
--#define TPM_RX_FNAME "/var/tpm/tpm_in.fifo"
--#define TPM_TX_FNAME "/var/tpm/tpm_out.fifo"
-+#ifdef VTPM_MULTI_VM
-+ #define DEV_BE "/dev/vtpm"
-+#else
-+ #define PVM_RX_FIFO_D "/var/vtpm/fifos/tpm_cmd_to_%d.fifo"
-+ #define PVM_TX_FIFO "/var/vtpm/fifos/tpm_rsp_from_all.fifo"
- 
-+ #define HVM_RX_FIFO_D "/var/vtpm/socks/%d.socket"
-+#endif
-+
-+ int dmi_id;
-+						
- #define BUFFER_SIZE 2048
- 
- static int devurandom=0;
-@@ -38,7 +50,7 @@ void get_random_bytes(void *buf, int nby
-   }
- 
-   if (read(devurandom, buf, nbytes) != nbytes) {
--      printf("Can't get random number.\n");
-+      error("Can't get random number.\n");
-       exit(-1);
-   }
- }
-@@ -52,105 +64,182 @@ uint64_t tpm_get_ticks(void)
- 
- int main(int argc, char **argv)
- {
--  uint8_t in[BUFFER_SIZE], *out;
-+  uint8_t type, in[BUFFER_SIZE], *out, *addressed_out;
-+  char *vtpm_rx_file=NULL;
-   uint32_t out_size;
-   int in_size, written;
--  int i;
--  struct stat file_info;
-+  int i, guest_id=-1;
- 
--  int tpm_tx_fh=-1, tpm_rx_fh=-1;
-+#ifndef VTPM_MULTI_VM
-+  int sockfd = -1;
-+  struct sockaddr_un addr;
-+  struct sockaddr_un client_addr;
-+  unsigned int client_length;
-+
-+#endif
-+ 
-+  int vtpm_tx_fh=-1, vtpm_rx_fh=-1;
-+#ifdef VTPM_MULTI_VM
-   if (argc < 2) {
--    printf("Usage: tpmd clear|save|deactivated\n" );
-+    error("Usage: tpmd clear|save|deactivated\n" );
-+#else
-+  if (argc < 4) {
-+    error("Usage: tpmd clear|save|deactivated pvm|hvm vtpmid\n" );
-+#endif
- 	  return -1;
-   }
- 
-+#ifndef VTPM_MULTI_VM
-+  /* setup type of vm */
-+  if (!strcmp(argv[2], "pvm")) {
-+    type = VTPM_TYPE_PVM; // Get commands from vTPM Manager through fifo
-+  } else if (!strcmp(argv[2], "hvm")) {
-+    type = VTPM_TYPE_HVM; // Get commands from qemu via socket
-+  } else {
-+    error("invalid vTPM type '%s'.\n", argv[2]);
-+  }
-+
-+  dmi_id = atoi(argv[3]);
-+
-+  if (type == VTPM_TYPE_PVM) {
-+    vtpm_rx_file = malloc(10 + strlen(PVM_RX_FIFO_D));
-+    sprintf(vtpm_rx_file, PVM_RX_FIFO_D, (uint32_t) dmi_id);
-+  } else {
-+    vtpm_rx_file = malloc(10 + strlen(HVM_RX_FIFO_D));
-+    sprintf(vtpm_rx_file, HVM_RX_FIFO_D, (uint32_t) dmi_id);
-+
-+    if ( (sockfd = socket(PF_UNIX,SOCK_STREAM,0)) < 0) {
-+          error("Unable to create socket. errno = %d\n", errno);
-+      exit (-1);
-+    }
-+
-+    memset(&addr, 0, sizeof(addr));
-+    addr.sun_family = AF_UNIX;
-+    strcpy(addr.sun_path,vtpm_rx_file );
-+    unlink(addr.sun_path);
-+  }
-+#endif
-+
-+#ifdef VTPM_MULTI_VM
-+  info("Initializing tpm state: %s\n", argv[1]);
-+#else
-+  info("Initializing tpm state: %s, type: %s, id: %d\n", argv[1], argv[2], dmi_id);
-+#endif
-+
-   /* initialize TPM emulator */
-   if (!strcmp(argv[1], "clear")) {
--    printf("Initializing tpm: %s\n", argv[1]);
-     tpm_emulator_init(1);
--  } else if (!strcmp(argv[1], "save")) { 
--    printf("Initializing tpm: %s\n", argv[1]);
-+  } else if (!strcmp(argv[1], "save")) {
-     tpm_emulator_init(2);
-   } else if (!strcmp(argv[1], "deactivated")) {
--    printf("Initializing tpm: %s\n", argv[1]);
-     tpm_emulator_init(3);
-   } else {
--    printf("invalid startup mode '%s'; must be 'clear', "
-+    error("invalid startup mode '%s'; must be 'clear', "
-       "'save' (default) or 'deactivated", argv[1]);
-     return -1;
-   }
--
--  if ( stat(TPM_RX_FNAME, &file_info) == -1) {
--    if ( mkfifo(TPM_RX_FNAME, S_IWUSR | S_IRUSR ) ) {
--      printf("Failed to create fifo %s.\n", TPM_RX_FNAME);
--      return -1;
--    }
--  }
--
--  if ( stat(TPM_TX_FNAME, &file_info) == -1) {
--    if ( mkfifo(TPM_TX_FNAME, S_IWUSR | S_IRUSR ) ) {
--      printf("Failed to create fifo %s.\n", TPM_TX_FNAME);
--      return -1;
--    }
--  }
--
-+  
-   while (1) {
- abort_command:
--    if (tpm_rx_fh < 0) {
--      tpm_rx_fh = open(TPM_RX_FNAME, O_RDONLY);
-+    if (vtpm_rx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+      vtpm_rx_fh = open(DEV_BE, O_RDWR);
-+#else
-+      if (type == VTPM_TYPE_PVM) {
-+        vtpm_rx_fh = open(vtpm_rx_file, O_RDONLY);
-+      } else {
-+        if (bind(sockfd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-+          error("Unable to bind(). errno = %d\n", errno);
-+          exit (-1);
-+        }
-+
-+        if (listen(sockfd, 10) <0) {
-+          error("Unable to listen(). errno = %d\n", errno);
-+          exit (-1);
-+        }
-+
-+        memset(&client_addr, 0, sizeof(client_addr));
-+        client_length = sizeof(client_addr);
-+
-+        vtpm_rx_fh = vtpm_tx_fh = accept(sockfd, (struct sockaddr *)&client_addr, &client_length);
-+      }
-+#endif
-     }
-     
--    if (tpm_rx_fh < 0) {
--      printf("ERROR: failed to open devices to listen to guest.\n");
-+    if (vtpm_rx_fh < 0) {
-+      error("Failed to open devices to listen to guest.\n");
-       return -1;
-     }
-     
--    if (tpm_tx_fh < 0) {
--      tpm_tx_fh = open(TPM_TX_FNAME, O_WRONLY);
--    }
--
--    if (tpm_tx_fh < 0) {
--      printf("ERROR: failed to open devices to respond to guest.\n");
--      return -1;
--    }
--
--    in_size = read(tpm_rx_fh, in, BUFFER_SIZE);
-+    in_size = read(vtpm_rx_fh, in, BUFFER_SIZE);
-     if (in_size < 6) { // Magic size of minium TPM command
--      printf("Recv[%d] to small: 0x", in_size);
-+      info("Recv incomplete command of %d bytes.", in_size);
-       if (in_size <= 0) {
--          close(tpm_rx_fh);
--          tpm_rx_fh = -1;
-+          close(vtpm_rx_fh);
-+          vtpm_rx_fh = -1;
-           goto abort_command;
-       }
-     } else { 
--      printf("Recv[%d]: 0x", in_size);
-+      debug_nostop("Recv[%d]: 0x", in_size);
-       for (i=0; i< in_size; i++) 
--        printf("%x ", in[i]);
--      printf("\n");
-+        debug_more("%x ", in[i]);
-+      debug_more("\n");
-     }
- 
--    
--    if (tpm_handle_command(in, in_size, &out, &out_size) != 0) { 
--        printf("ERROR: Handler Failed.\n");
-+    if (guest_id == -1) {
-+        guest_id = *((uint32_t *) in);
-+    } else {
-+        if (guest_id != *((uint32_t *) in) ) {
-+            error("WARNING: More than one guest attached\n");
-+        }
-+    }
-+
-+    if (vtpm_tx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+      vtpm_tx_fh = open(DEV_BE, O_RDWR);
-+      vtpm_rx_fh = vtpm_tx_fh;
-+#else
-+      if (type == VTPM_TYPE_PVM) {
-+        vtpm_tx_fh = open(PVM_TX_FIFO, O_WRONLY);
-+      } // No need to open the other direction for HVM
-+#endif
-+    }
-+
-+    if (vtpm_tx_fh < 0) {
-+      error("Failed to open devices to respond to guest.\n");
-+      return -1;
-+    }
-+
-+    // Handle the command, but skip the domain id header    
-+    if (tpm_handle_command(in + sizeof(uint32_t), in_size - sizeof(uint32_t), &out, &out_size) != 0) { 
-+      error("Handler Failed.\n");
-     }
- 
--    written = write(tpm_tx_fh, out, out_size);
-+    addressed_out = (uint8_t *) tpm_malloc(sizeof(uint32_t) + out_size);
-+    *(uint32_t *) addressed_out = *(uint32_t *) in;
-+    memcpy(addressed_out + sizeof(uint32_t), out, out_size);
-+
-+    written = write(vtpm_tx_fh, addressed_out, out_size + sizeof(uint32_t));
- 
--    if (written != out_size ) {
--      printf("ERROR: Part of response not written %d/%d.\nAttempt: ", written, out_size);
-+    if (written != out_size + sizeof(uint32_t)) {
-+      error("Part of response not written %d/%d.\n", written, out_size);
-     } else {
--      printf("Sent[%Zu]: ", out_size);
-+      debug_nostop("Sent[%Zu]: ", out_size + sizeof(uint32_t));
-+      for (i=0; i< out_size+ sizeof(uint32_t); i++)
-+        debug_more("%x ", addressed_out[i]);
-+      debug_more("\n");
-     }
--    for (i=0; i< out_size; i++)
--      printf("%x ", out[i]);
--    printf("\n");
-     tpm_free(out);
-+    tpm_free(addressed_out);
- 
-   } // loop
- 
-   tpm_emulator_shutdown();
- 
--  close(tpm_tx_fh);
--  close(tpm_rx_fh);
-+  close(vtpm_tx_fh);
-+#ifndef VTPM_MUTLI_VM
-+  close(vtpm_rx_fh);
-+  free (vtpm_rx_file);
-+#endif
- 
- }
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/COPYING
--- a/tools/vtpm_manager/COPYING	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/Makefile
--- a/tools/vtpm_manager/Makefile	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-XEN_ROOT = $(CURDIR)/../..
-
-# Base definitions and rules
-include $(XEN_ROOT)/tools/vtpm_manager/Rules.mk
-
-SUBDIRS		= crypto tcs util manager migration
-OPENSSL_HEADER	= /usr/include/openssl/crypto.h
-
-.PHONY: all clean install
-all clean install: %: subdirs-%
-
-.PHONY: mrproper
-mrproper:
-	@set -e; for subdir in $(SUBDIRS); do \
-		$(MAKE) -C $$subdir $@; \
-	done
-
-
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/README
--- a/tools/vtpm_manager/README	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-// ===================================================================
-//
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-
-Directory Structure
-===================
-tools/vtpm_manager/crypto    -> crypto files
-tools/vtpm_manager/TCS       -> TCS implementation
-tools/vtpm_manager/util      -> Utility Library. Include disk-io and buffers.
-tools/vtpm_manager/manager   -> VTPM Manager
-
-Compile Flags
-===================
-LOGGING_MODULES              -> How extensive logging happens
-                                see util/log.h for more info
-
-VTPM_MULTI_VM                -> Defined: VTPMs run in their own VMs
-                                Not Defined (default): VTPMs are processes
-
-# Debugging flags that may disappear without notice in the future
-
-DUMMY_BACKEND                -> vtpm_manager listens on /tmp/in.fifo and 
-                                /tmp/out.fifo rather than backend
-
-MANUAL_DM_LAUNCH             -> Must manually launch & kill VTPMs
-
-WELL_KNOWN_OWNER_AUTH        -> Rather than randomly generating the password for the owner,
-                                use a well known value. This is useful for debugging and for
-                                poor bios which do not support clearing TPM if OwnerAuth is
-                                lost. However this has no protection from malicious app
-                                issuing a TPM_OwnerClear to wipe the TPM 
-
-Requirements
-============
-- xen-unstable 
-- vtpm frontend/backend driver patch
-- OpenSSL Library
-
-Single-VM Flow
-============================
-- Launch the VTPM manager (vtpm_managerd) which which begins listening to the BE with one thread
-  and listens to a named fifo that is shared by the vtpms to commuincate with the manager.
-- VTPM Manager listens to TPM BE.
-- When xend launches a tpm frontend equipped VM it contacts the manager over the vtpm backend. 
-- When the manager receives the open message from the BE, it launches a vtpm
-- Xend allows the VM to continue booting. 
-- When a TPM request is issued to the front end, the front end transmits the TPM request to the backend.
-- The manager receives the TPM requests and uses a named fifo to forward the request to the vtpm.
-- The fifo listener begins listening for the reply from vtpm for the request.
-- Vtpm processes request and replies to manager over shared named fifo.
-- If needed, the vtpm may send a request to the vtpm_manager at any time to save it's secrets to disk.
-- Manager receives response from vtpm and passes it back to backend for forwarding to guest.
-
-NOTES:
-* SaveService SHOULD seal it's table before saving it to disk. However,
-  the current Xen infrastructure does not provide a mechanism for this to be
-  unsealed later. Specifically, the auth and wrapped key must be available ONLY
-  to the service, or it's not even worth encrypting
-
-  In the future the vtpm manager will be protected by an early boot mechanism
-  that will allow for better protection of it's data.
-
-TODO:
-- Timeout on crashed vtpms
-- create lock for shared fifo for talking to vtpms.
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/Rules.mk
--- a/tools/vtpm_manager/Rules.mk	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-# Base definitions and rules (XEN_ROOT must be defined in including Makefile)
-include $(XEN_ROOT)/tools/Rules.mk
-
-#
-# Tool definitions
-#
-
-# General compiler flags
-CFLAGS	= -Werror -g3
-
-# Generic project files
-HDRS	= $(wildcard *.h)
-SRCS	= $(wildcard *.c)
-OBJS	= $(patsubst %.c,%.o,$(SRCS))
-
-# Generic (non-header) dependencies
-$(SRCS): Makefile $(XEN_ROOT)/tools/Rules.mk $(XEN_ROOT)/tools/vtpm_manager/Rules.mk
-
-$(OBJS): $(SRCS)
-
--include $(FILES)
-
-# Make sure these are just rules
-.PHONY : all build install clean
-
-#
-# Project-specific definitions
-#
-
-# Need UNIX98 spec for pthread rwlocks
-CFLAGS += -D_GNU_SOURCE
-
-# Logging Level. See utils/tools.h for usage
-CFLAGS += -DLOGGING_MODULES="(BITMASK(VTPM_LOG_TCS)|BITMASK(VTPM_LOG_VTSP)|BITMASK(VTPM_LOG_VTPM))"
-
-# Silent Mode
-#CFLAGS += -DLOGGING_MODULES=0x0
-#CFLAGS += -DLOGGING_MODULES=0xff
-
-# Use frontend/backend pairs between manager & DMs?
-#CFLAGS += -DVTPM_MULTI_VM
-
-# vtpm_manager listens on fifo's rather than backend
-#CFLAGS += -DDUMMY_BACKEND
-
-# TCS talks to fifo's rather than /dev/tpm. TPM Emulator assumed on fifos
-#CFLAGS += -DDUMMY_TPM
-
-# Do not have manager launch DMs.
-#CFLAGS += -DMANUAL_DM_LAUNCH
-
-# Fixed OwnerAuth
-#CFLAGS += -DWELL_KNOWN_OWNER_AUTH
-
-# Include
-CFLAGS += -I$(XEN_ROOT)/tools/vtpm_manager/crypto
-CFLAGS += -I$(XEN_ROOT)/tools/vtpm_manager/util
-CFLAGS += -I$(XEN_ROOT)/tools/vtpm_manager/tcs
-CFLAGS += -I$(XEN_ROOT)/tools/vtpm_manager/manager
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/crypto/Makefile
--- a/tools/vtpm_manager/crypto/Makefile	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/vtpm_manager/Rules.mk
-
-BIN		= libtcpaCrypto.a
-
-.PHONY: all
-all: build
-
-.PHONY: build
-build: $(BIN)
-
-.PHONY: install
-install: build
-
-.PHONY: clean
-clean:
-	rm -f *.a *.so *.o *.rpm $(DEP_FILES)
-
-.PHONY: mrproper
-mrproper: clean
-	rm -f *~
-
-$(BIN): $(OBJS)
-	$(AR) rcs $(BIN) $(OBJS)
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/crypto/crypto.c
--- a/tools/vtpm_manager/crypto/crypto.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// crypto.c
-// 
-//  This file will handle all the TPM Crypto functionality
-// 
-// ==================================================================
-
-#include <string.h>
-#include <openssl/crypto.h>
-#include <openssl/err.h>
-#include <openssl/evp.h>
-#include <openssl/rand.h>
-#include "crypto.h"
-#include "log.h"
-
-/**
- * Initialize cryptography library
- * @rand: random seed
- * @size: size of @rand
- */
-void Crypto_Init(const BYTE* rand, int size) {
-	ERR_load_crypto_strings();
-  CRYPTO_malloc_init();
-  OpenSSL_add_all_algorithms();
-  SYM_CIPHER = EVP_aes_128_cbc();
-  RAND_poll();
-  if (rand == NULL)
-    return;
-
-  RAND_add(rand, size, size);
-}
-
-/**
- * Shutdown cryptography library
- */
-void Crypto_Exit() {
-  ERR_free_strings();
-  ERR_remove_state(0);
-  EVP_cleanup();
-}
-
-
-/**
- * Get random data
- * @data: (OUT) Random data
- * @size: Size of @data
- */
-void Crypto_GetRandom(void* data, int size) {
-  int result;
-  
-  result = RAND_pseudo_bytes((BYTE*) data, size);
-  
-  if (result <= 0) 
-    vtpmlogerror (VTPM_LOG_CRYPTO, "RAND_pseudo_bytes failed: %s\n",
-	     ERR_error_string (ERR_get_error(), NULL));
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/crypto/crypto.h
--- a/tools/vtpm_manager/crypto/crypto.h	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,175 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// crypto.h
-// 
-//  This file defines the TPM Crypto API
-//
-// ==================================================================
-
-#ifndef __CRYPTO_H__
-#define __CRYPTO_H__
-
-#include <stddef.h>
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "tcg.h"
-#include "sym_crypto.h"
-
-#define CRYPTO_MAX_SIG_SIZE (2048 / 8)
-#define CRYPTO_MAX_RSA_KEY_SIZE (4096 / 8) //in bytes
-
-#define OAEP_P "TCPA"
-#define OAEP_P_SIZE 4
-
-// Algorithms supported by crypto. Stored in CRYPTO_INFO.algorithmID
-#define CRYPTO_ALGORITH_RSA 0x01
-
-// Supported Encryption Schemes CRYPTO_INFO.encScheme
-#define CRYPTO_ES_NONE 0x0001
-#define CRYPTO_ES_RSAESPKCSv15 0x0002
-#define CRYPTO_ES_RSAESOAEP_SHA1_MGF1 0x0003
-
-// Supported Signature schemes CRYPTO_INFO.sigScheme
-#define CRYPTO_SS_NONE 0x0001
-#define CRYPTO_SS_RSASSAPKCS1v15_SHA1 0x0002
-#define CRYPTO_SS_RSASSAPKCS1v15_DER 0x0003
-
-typedef struct CRYPTO_INFO {
-  void *keyInfo;
-  UINT32 algorithmID;
-  UINT32 encScheme;
-  UINT32 sigScheme;
-} CRYPTO_INFO;
-
-
-void Crypto_Init(const BYTE* rand, int size);
-
-void Crypto_Exit();
-
-void Crypto_GetRandom(void* data, int size);
-
-void Crypto_HMAC(   const BYTE* text, 
-                    int text_len, 
-                    const BYTE* key, 
-                    int key_len,
-                    BYTE* digest);
-
-TPM_RESULT Crypto_HMAC_buf (const buffer_t * text,
-                            const buffer_t * key,
-                            BYTE * o_digest); /* presumably of 20 bytes */
-    
-void Crypto_SHA1Full(   const BYTE* text, 
-                        UINT32 size,
-                        BYTE* hash); //Complete 3part SHA1
-
-// o_hash needs to be large enough to hold the digest, ie 20 bytes
-TPM_RESULT Crypto_SHA1Full_buf (const buffer_t * buf,
-                                BYTE * o_hash);
-    
-void Crypto_SHA1Start(UINT32* maxNumBytes);
-void Crypto_SHA1Update(int numBytes, const BYTE* hashData);
-void Crypto_SHA1Complete(   int hashDataSize, 
-                            const BYTE* hashData, 
-                            BYTE* hashValue);
-
-void Crypto_RSACreateKey(   /*in*/ UINT32 keySize,
-                            /*in*/ UINT32 pubExpSize, 
-                            /*in*/ BYTE *pubExp,
-                            /*out*/ UINT32 *privExpSize, 
-                            /*out*/ BYTE *privExp,
-                            /*out*/ UINT32 *modulusSize,
-                            /*out*/ BYTE *modulus,
-                            /*out*/ CRYPTO_INFO *keys);
-                            
-void Crypto_RSABuildCryptoInfo( /*[IN]*/ UINT32 pubExpSize, 
-                                /*[IN]*/ BYTE *pubExp,
-                                /*[IN]*/ UINT32 privExpSize, 
-                                /*[IN]*/ BYTE *privExp,
-                                /*[IN]*/ UINT32 modulusSize, 
-                                /*[IN]*/ BYTE *modulus, 
-                                /*[OUT]*/ CRYPTO_INFO* cryptoInfo);
-                                
-void Crypto_RSABuildCryptoInfoPublic(   /*[IN]*/ UINT32 pubExpSize, 
-                                        /*[IN]*/ BYTE *pubExp,
-                                        /*[IN]*/ UINT32 modulusSize, 
-                                        /*[IN]*/ BYTE *modulus, 
-                                        CRYPTO_INFO* cryptoInfo);
-
-//
-// symmetric pack and unpack operations
-//
-TPM_RESULT Crypto_RSAPackCryptoInfo (const CRYPTO_INFO* cryptoInfo,
-                                     BYTE ** io_buf, UINT32 * io_buflen);
-
-TPM_RESULT Crypto_RSAUnpackCryptoInfo (CRYPTO_INFO * ci,
-                                       BYTE * in, UINT32 len,
-                                       UINT32 * o_lenread);
-
-                             
-// return 0 on success, -1 on error
-int Crypto_RSAEnc(  CRYPTO_INFO *keys,
-                    UINT32 inDataSize,
-                    BYTE *inData,
-                    /*out*/ UINT32 *outDataSize,
-                    /*out*/ BYTE *outData);
-
-// return 0 on success, -1 on error
-int Crypto_RSADec(  CRYPTO_INFO *keys,
-                    UINT32 inDataSize,
-                    BYTE *inData,
-                    /*out*/ UINT32 *outDataSize,
-                    /*out*/ BYTE *outData);
-
-// return 0 on success, -1 on error
-int Crypto_RSASign( CRYPTO_INFO *keys,
-                    UINT32 inDataSize,
-                    BYTE *inData,
-                    /*out*/ UINT32 *sigSize,
-                    /*out*/ BYTE *sig);
-
-bool Crypto_RSAVerify(  CRYPTO_INFO *keys,
-                        UINT32 inDataSize,
-                        BYTE *inData,
-                        UINT32 sigSize,
-                        BYTE *sig);
-
-//private:
-int RSA_verify_DER(int dtype, unsigned char *m, unsigned int m_len,
-                   unsigned char *sigbuf, unsigned int siglen, CRYPTO_INFO *key);
-
-int RSA_sign_DER(int type, unsigned char *m, unsigned int m_len,
-              unsigned char *sigret, unsigned int *siglen, CRYPTO_INFO *key);
-
-#endif // __CRYPTO_H__
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/crypto/hash.c
--- a/tools/vtpm_manager/crypto/hash.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// hash.c
-// 
-//  This file will handle all the TPM Hash functionality
-//
-// ==================================================================
-
-#include <string.h>
-#include <openssl/crypto.h>
-#include <openssl/err.h>
-#include <openssl/evp.h>
-#include <openssl/rand.h>
-#include <openssl/hmac.h>
-#include <openssl/sha.h>
-#include <openssl/bn.h>
-#include <openssl/rsa.h>
-
-#include "tcg.h"         // for TPM_SUCCESS
-#include "crypto.h"
-
-static SHA_CTX g_shaContext;
-
-void Crypto_HMAC(   const BYTE* text, 
-                    int text_len, 
-                    const BYTE* key, 
-                    int key_len, 
-                    BYTE* digest) {
-  if (text == NULL || key == NULL || text_len == 0 || key_len == 0) 
-    return;
-  
-  HMAC(EVP_sha1(), key, key_len, text, text_len, digest, NULL);
-}
-
-TPM_RESULT Crypto_HMAC_buf (const buffer_t * text,
-			    const buffer_t * key,
-			    BYTE * o_digest) { /* presumably of 20 bytes */
-  
-  Crypto_HMAC (text->bytes, text->size, 
-	       key->bytes, key->size,
-	       o_digest);
-  
-  return TPM_SUCCESS;
-}
-
-
-/*
- * SHA1
- * (OUT) Create a SHA1 hash of text. Calls all three SHA1 steps internally
- */
-void Crypto_SHA1Full( const BYTE* text, 
-      uint32_t size, 
-      BYTE* hash) {
-
-  if (text == NULL || size == 0) 
-    return;
-  
-  // Run SHA1Start + SHAUpdate (if necessary) + SHAComplete
-  uint32_t maxBytes; // Not used for anything
-  Crypto_SHA1Start(&maxBytes);
-  
-  while (size > 64){
-    Crypto_SHA1Update(64, text); 
-    size -= 64;
-    text += 64;
-  }
-  
-  Crypto_SHA1Complete(size, text, hash);
-}
-
-// same thing using buffer_t
-TPM_RESULT Crypto_SHA1Full_buf (const buffer_t * buf,
-                                 BYTE * o_digest) {
-
-  if (buf->bytes == NULL || buf->size == 0) 
-    return TPM_BAD_PARAMETER;
-  
-  Crypto_SHA1Full (buf->bytes, buf->size, o_digest);
-  
-  return TPM_SUCCESS;
-}
-
-
-/*
- * Initialize SHA1
- * (OUT) Maximum number of bytes that can be sent to SHA1Update. 
- *   Must be a multiple of 64 bytes.
- */
-void Crypto_SHA1Start(uint32_t* maxNumBytes) {
-  int max = SHA_CBLOCK;
-  // Initialize the crypto library
-  SHA1_Init(&g_shaContext);
-  *maxNumBytes = max;
-}
-
-/*
- * Process SHA1
- * @numBytes: (IN) The number of bytes in hashData. 
- *       Must be a multiple of 64 bytes.
- * @hashData: (IN) Bytes to be hashed.
- */
-void Crypto_SHA1Update(int numBytes, const BYTE* hashData) {
-
-  if (hashData == NULL || numBytes == 0 || numBytes%64 != 0) 
-    return;
-  
-  SHA1_Update(&g_shaContext, hashData, numBytes); 
-}
-
-/*
- * Complete the SHA1 process
- * @hashDataSize: (IN) Number of bytes in hashData.
- *       Must be a multiple of 64 bytes.
- * @hashData: (IN) Final bytes to be hashed.
- * @hashValue: (OUT) The output of the SHA-1 hash.
- */
-void Crypto_SHA1Complete(int hashDataSize, 
-			 const BYTE* hashData, 
-			 BYTE* hashValue) {
-  SHA1_Update(&g_shaContext, hashData, hashDataSize);
-  SHA1_Final(hashValue, &g_shaContext);
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/crypto/rsa.c
--- a/tools/vtpm_manager/crypto/rsa.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,434 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// rsa.c
-// 
-//  This file will handle all the TPM RSA crypto functionality
-// 
-// ==================================================================
-
-#include <string.h>
-#include <openssl/crypto.h>
-#include <openssl/evp.h>
-#include <openssl/bn.h>
-#include <openssl/rsa.h>
-#include <openssl/rand.h>
-#include <openssl/x509.h>
-
-#include <openssl/err.h>
-#include <stdio.h>
-
-#include "tcg.h"
-#include "buffer.h"
-#include "crypto.h"
-#include "log.h"
-
-void Crypto_RSACreateKey(   /*in*/ UINT32 keySize,
-                            /*in*/ UINT32 pubExpSize, 
-                            /*in*/ BYTE *pubExp,
-                            /*out*/ UINT32 *privExpSize, 
-                            /*out*/ BYTE *privExp,
-                            /*out*/ UINT32 *modulusSize,        
-                            /*out*/ BYTE *modulus,
-                            /*out*/ CRYPTO_INFO *keys) {
-  unsigned long e_value;
-  
-  if (pubExpSize == 0) // Default e = 2^16+1
-    e_value = (0x01 << 16) + 1;
-  else {
-    // This is not supported, but the following line MIGHT work
-    // under then assumption that the format is BigNum compatable
-    // Though it's not in the spec, so who knows what it is.
-    // Forcing the default.
-    //BN_bin2bn(pubExp, pubExpSize, NULL);
-    e_value = (0x01 << 16) + 1;
-  }
-
-  RSA *rsa = RSA_generate_key(keySize, e_value, NULL, NULL);
-  
-  if (keys) {
-    keys->keyInfo = rsa;
-    keys->algorithmID = CRYPTO_ALGORITH_RSA;
-  }
-  
-  if (modulus)   *modulusSize   = BN_bn2bin(rsa->n, modulus);
-  if (privExp)   *privExpSize   = BN_bn2bin(rsa->d, privExp);
-}
-
-// Create a CRYPTO_INFO struct from the BYTE * key parts. 
-// If pubExp info is NULL, use TCG default.
-// If there is a remainder while calculating the privExp, return FALSE.
-
-void Crypto_RSABuildCryptoInfo( /*[IN]*/ UINT32 pubExpSize, 
-                                /*[IN]*/ BYTE *pubExp,
-                                /*[IN]*/ UINT32 privExpSize, 
-                                /*[IN]*/ BYTE *privExp,
-                                /*[IN]*/ UINT32 modulusSize, 
-                                /*[IN]*/ BYTE *modulus, 
-                                CRYPTO_INFO* cryptoInfo) {
-  cryptoInfo->keyInfo = RSA_new();
-  RSA *rsa = (RSA *) cryptoInfo->keyInfo;
-  
-  rsa->e = BN_new();
-  
-  if (pubExpSize == 0) { // Default e = 2^16+1
-    BN_set_bit(rsa->e, 16);
-    BN_set_bit(rsa->e, 0);
-  } else {
-    // This is not supported, but the following line MIGHT work
-    // under then assumption that the format is BigNum compatable
-    // Though it's not in the spec, so who knows what it is.
-    // Forcing the default.
-    //BN_bin2bn(pubExp, pubExpSize, NULL);
-    BN_set_bit(rsa->e, 16);
-    BN_set_bit(rsa->e, 0);
-  }
-  
-  rsa->n = BN_bin2bn(modulus, modulusSize, NULL);
-  rsa->d = BN_bin2bn(privExp, privExpSize, NULL);
-}
-
-// Create a CRYPTO_INFO struct from the BYTE * key parts. 
-// If pubExp info is NULL, use TCG default.
-// If there is a remainder while calculating the privExp, return FALSE.
-
-void Crypto_RSABuildCryptoInfoPublic(   /*[IN]*/ UINT32 pubExpSize, 
-                                        /*[IN]*/ BYTE *pubExp,
-                                        /*[IN]*/ UINT32 modulusSize, 
-                                        /*[IN]*/ BYTE *modulus, 
-                                        CRYPTO_INFO* cryptoInfo) {
-  cryptoInfo->keyInfo = RSA_new();
-  RSA *rsa = (RSA *) cryptoInfo->keyInfo;
-  
-  rsa->e = BN_new();
-  
-  if (pubExpSize == 0) { // Default e = 2^16+1
-    BN_set_bit(rsa->e, 16);
-    BN_set_bit(rsa->e, 0);
-  } else {
-    // This is not supported, but the following line MIGHT work
-    // under then assumption that the format is BigNum compatable
-    // Though it's not in the spec, so who knows what it is.
-    // Forcing the default.
-    //BN_bin2bn(pubExp, pubExpSize, NULL);
-    BN_set_bit(rsa->e, 16);
-    BN_set_bit(rsa->e, 0);
-  }
-  
-  rsa->n = BN_bin2bn(modulus, modulusSize, NULL);
-  
-}
-
-int Crypto_RSAEnc(  CRYPTO_INFO *key,
-		    UINT32 inDataSize,
-		    BYTE *inData,
-		    /*out*/ UINT32 *outDataSize,
-		    /*out*/ BYTE *outData) {
-  RSA *rsa = (RSA *) key->keyInfo;
-  UINT32 paddedDataSize = RSA_size (rsa);
-  BYTE *paddedData = (BYTE *)malloc(sizeof(BYTE) * paddedDataSize);
-  int rc;
-    
-  if (paddedData == NULL) 
-    return -1;
-
-  *outDataSize = 0;
-  
-  switch (key->encScheme) {
-  case CRYPTO_ES_RSAESPKCSv15:
-    if (RSA_padding_add_PKCS1_type_2(paddedData, paddedDataSize, inData, inDataSize) <= 0) {
-      rc = -1; 
-      goto abort_egress;
-    }
-    break;
-  case CRYPTO_ES_RSAESOAEP_SHA1_MGF1:
-    if (RSA_padding_add_PKCS1_OAEP(paddedData,paddedDataSize,inData,inDataSize, (BYTE *) OAEP_P,OAEP_P_SIZE) <= 0 ) {
-      rc = -1; 
-      goto abort_egress;
-    }
-    break;
-  default:
-    rc = -1; 
-    goto abort_egress;
-  }
-  
-  rc = RSA_public_encrypt(paddedDataSize, paddedData, outData, rsa, RSA_NO_PADDING);
-  if (rc == -1)
-    goto abort_egress; 
-   
-  *outDataSize = rc;
-  
-  if (rc > 0) rc = 0;
-  
-  goto egress;
-  
- abort_egress:
- egress:
-  
-  if (paddedData) 
-    free (paddedData);
-  return rc;
-  
-}
-
-int Crypto_RSADec(  CRYPTO_INFO *key,
-                    UINT32 inDataSize,
-                    BYTE *inData,
-                    /*out*/ UINT32 *outDataSize,
-                    /*out*/ BYTE *outData) {
-  
-  RSA *rsa = (RSA *) key->keyInfo;
-  UINT32 paddedDataSize = RSA_size (rsa);
-  BYTE *paddedData = (BYTE *)malloc(sizeof(BYTE) * paddedDataSize);
-  int rc;
-  
-  if (paddedData == NULL)
-    goto abort_egress;
-  
-  rc = RSA_private_decrypt(inDataSize, inData, paddedData, rsa, RSA_NO_PADDING);
-  if (rc == -1) {
-    vtpmlogerror(VTPM_LOG_CRYPTO, "RSA_private_decrypt: %s\n", ERR_error_string(ERR_get_error(), NULL));
-    goto abort_egress;
-  }
-  
-  paddedDataSize = rc;
-  
-  switch (key->encScheme) {
-  case CRYPTO_ES_RSAESPKCSv15:
-    rc = RSA_padding_check_PKCS1_type_2 (outData, paddedDataSize,
-					 paddedData + 1, paddedDataSize - 1,
-					 RSA_size(rsa));
-    if (rc == -1) {
-      vtpmlogerror(VTPM_LOG_CRYPTO, "RSA_padding_check_PKCS1_type_2: %s\n", 
-	      ERR_error_string(ERR_get_error(), NULL));
-      goto abort_egress;
-    }
-    *outDataSize = rc;
-    break;
-  case CRYPTO_ES_RSAESOAEP_SHA1_MGF1:
-    rc = RSA_padding_check_PKCS1_OAEP(outData, paddedDataSize,
-				      paddedData + 1, paddedDataSize - 1,
-				      RSA_size(rsa),
-				      (BYTE *) OAEP_P, OAEP_P_SIZE);
-    if (rc == -1) {
-      vtpmlogerror(VTPM_LOG_CRYPTO, "RSA_padding_check_PKCS1_OAEP: %s\n",
-	      ERR_error_string(ERR_get_error(), NULL));
-      goto abort_egress;
-    }
-    *outDataSize = rc;
-    break;
-  default:
-    *outDataSize = 0;
-  }
-  
-  free(paddedData); paddedData = NULL;
-  goto egress;
-  
- abort_egress:
-  
-  if (paddedData) 
-    free (paddedData);
-  return -1;
-  
- egress:
-  return 0;
-}
-
-// Signs either a SHA1 digest of a message or a DER encoding of a message
-// Textual messages MUST be encoded or Hashed before sending into this function
-// It will NOT SHA the message.
-int Crypto_RSASign( CRYPTO_INFO *key,
-                    UINT32 inDataSize,
-                    BYTE *inData,
-                    /*out*/ UINT32 *sigSize,
-                    /*out*/ BYTE *sig) {
-  int status;
-  unsigned int intSigSize;
-  
-  switch(key->sigScheme) {
-  case CRYPTO_SS_RSASSAPKCS1v15_SHA1: 
-    status = RSA_sign(NID_sha1, inData, inDataSize, sig, &intSigSize, (RSA *) key->keyInfo);
-    break;
-  case CRYPTO_SS_RSASSAPKCS1v15_DER:
-    //        status = Crypto_RSA_sign_DER(NID_md5_sha1, inData, inDataSize, sig, &intSigSize, key);
-    vtpmlogerror(VTPM_LOG_CRYPTO, "Crypto: Unimplemented sign type (%d)\n", key->sigScheme);
-    status = 0;
-    break;
-  default:
-    status = 0;
-  }
-  
-  if (status == 0) {
-    *sigSize = 0;
-    vtpmlogerror(VTPM_LOG_CRYPTO, "%s\n", ERR_error_string(ERR_get_error(), NULL));
-    return -1;
-  }
-  
-  *sigSize = (UINT32) intSigSize;
-  return 0;
-}
-
-bool Crypto_RSAVerify(  CRYPTO_INFO *key,
-                        UINT32 inDataSize,
-                        BYTE *inData,
-                        UINT32 sigSize,
-                        BYTE *sig) {
-  int status;
-  
-  switch(key->sigScheme){
-  case CRYPTO_SS_RSASSAPKCS1v15_SHA1: 
-    status = RSA_verify(NID_sha1, inData, inDataSize, sig, sigSize, (RSA *) key->keyInfo);
-    break;
-  case CRYPTO_SS_RSASSAPKCS1v15_DER:
-    //status = Crypto_RSA_verify_DER(NID_md5_sha1, inData, inDataSize, sig, sigSize, key);
-    vtpmlogerror(VTPM_LOG_CRYPTO, "Crypto: Unimplemented sign type (%d)\n", key->sigScheme);
-    status = 0;
-    break;
-  default:
-    status = 0;
-  }
-  
-  if (status) 
-    return(1);
-  else {
-    vtpmlogerror(VTPM_LOG_CRYPTO, "RSA verify: %s\n", ERR_error_string(ERR_get_error(), NULL));
-    return(0);
-  }
-  
-}
-
-// helper which packs everything into a BIO!
-
-// packs the parameters first, then the private key, then the public key
-// if *io_buf is NULL, allocate it here as needed. otherwise its size is in
-// *io_buflen
-TPM_RESULT Crypto_RSAPackCryptoInfo (const CRYPTO_INFO* cryptoInfo,
-                                      BYTE ** io_buf, UINT32 * io_buflen) {
-  TPM_RESULT status = TPM_SUCCESS;
-  BYTE * buf;
-  long len, outlen = *io_buflen;
-  
-  const long PARAMSLEN = 3*sizeof(UINT32);
-  
-  RSA *rsa = (RSA *) cryptoInfo->keyInfo;
-  
-  BIO *mem = BIO_new(BIO_s_mem());
-  
-  
-  // write the openssl keys to the BIO
-  if ( i2d_RSAPrivateKey_bio (mem, rsa) == 0 ) {
-    ERR_print_errors_fp (stderr);
-    ERRORDIE (TPM_SIZE);
-  }
-  if ( i2d_RSAPublicKey_bio (mem, rsa) == 0 ) {
-    ERR_print_errors_fp (stderr);
-    ERRORDIE (TPM_SIZE);
-  }
-  
-  // get the buffer out
-  len = BIO_get_mem_data (mem, &buf);
-  
-  // see if we need to allocate a return buffer
-  if (*io_buf == NULL) {
-    *io_buf = (BYTE*) malloc (PARAMSLEN + len);
-    if (*io_buf == NULL) 
-      ERRORDIE (TPM_SIZE);
-  } else {                      // *io_buf is already allocated
-    if (outlen < len + PARAMSLEN) 
-      ERRORDIE (TPM_SIZE); // but not large enough!  
-  }
-  
-  // copy over the parameters (three UINT32's starting at algorithmID)
-  memcpy (*io_buf, &cryptoInfo->algorithmID, PARAMSLEN);
-  
-  // copy over the DER keys
-  memcpy (*io_buf + PARAMSLEN, buf, len);
-  
-  *io_buflen = len + PARAMSLEN;
-  
-  goto egress;
-  
-  
- abort_egress:
- egress:
-  
-  BIO_free (mem);
-  
-  return status;
-}
-
-
-
-// sets up ci, and returns the number of bytes read in o_lenread
-TPM_RESULT Crypto_RSAUnpackCryptoInfo (CRYPTO_INFO * ci,
-                                        BYTE * in, UINT32 len,
-                                        UINT32 * o_lenread) {
-  
-  TPM_RESULT status = TPM_SUCCESS;
-  long l;
-  BIO *mem;
-  RSA *rsa;
-  
-  // first load up the params
-  l = 3 * sizeof(UINT32);
-  memcpy (&ci->algorithmID, in, l);
-  len -= l;
-  in += l;
-  
-  // and now the openssl keys, private first
-  mem = BIO_new_mem_buf (in, len);
-  
-  if ( (rsa = d2i_RSAPrivateKey_bio (mem, NULL)) == NULL ) {
-    ERR_print_errors_fp (stderr);
-    ERRORDIE (TPM_BAD_PARAMETER);
-  }
-  // now use the same RSA object and fill in the private key
-  if ( d2i_RSAPublicKey_bio (mem, &rsa) == NULL ) {
-    ERR_print_errors_fp (stderr);
-    ERRORDIE (TPM_BAD_PARAMETER);
-  }
-  
-  ci->keyInfo = rsa;          // needs to be freed somehow later
-  
-  // FIXME: havent figured out yet how to tell how many bytes were read in the
-  // above oprations! so o_lenread is not set
-  
-  goto egress;
-  
- abort_egress:
- egress:
-  
-  BIO_free (mem);
- 
-  return status;  
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/crypto/sym_crypto.c
--- a/tools/vtpm_manager/crypto/sym_crypto.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,237 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// sym_crypto.c
-// 
-//     Symmetric crypto portion of crypto 
-// 
-// ==================================================================
-
-#include <openssl/evp.h>
-#include <openssl/rand.h>
-
-#include "tcg.h"
-#include "sym_crypto.h"
-
-typedef enum crypt_op_type_t {
-  CRYPT_ENCRYPT,
-  CRYPT_DECRYPT
-} crypt_op_type_t;
-
-TPM_RESULT ossl_symcrypto_op (symkey_t* key,
-                              const buffer_t* in,
-                              const buffer_t* iv,
-                              buffer_t * out,
-                              crypt_op_type_t optype);
-
-
-// this is initialized in Crypto_Init()
-const EVP_CIPHER * SYM_CIPHER = NULL;
-
-const BYTE ZERO_IV[EVP_MAX_IV_LENGTH] = {0};
-
-
-TPM_RESULT Crypto_symcrypto_initkey (symkey_t * key, const buffer_t* keybits) {
-  TPM_RESULT status = TPM_SUCCESS;
-  
-  EVP_CIPHER_CTX_init (&key->context);
-  
-  key->cipher = SYM_CIPHER;
-  
-  TPMTRYRETURN( buffer_init_copy (&key->key, keybits));
-    
-  goto egress;
-  
- abort_egress:
-  EVP_CIPHER_CTX_cleanup (&key->context);
-  
- egress:
-  
-  return status;
-}
-
-
-
-TPM_RESULT Crypto_symcrypto_genkey (symkey_t * key) {
-  int res;
-  TPM_RESULT status = TPM_SUCCESS;
-  
-  // hmm, EVP_CIPHER_CTX_init does not return a value
-  EVP_CIPHER_CTX_init (&key->context);
-  
-  key->cipher = SYM_CIPHER;
-  
-  TPMTRYRETURN( buffer_init (&key->key, EVP_CIPHER_key_length(key->cipher), NULL)) ;
-  
-  // and generate the key material
-  res = RAND_pseudo_bytes (key->key.bytes, key->key.size);
-  if (res < 0) 
-    ERRORDIE (TPM_SHORTRANDOM);
-  
-  
-  goto egress;
-  
- abort_egress:
-  EVP_CIPHER_CTX_cleanup (&key->context);
-  buffer_free (&key->key);
-  
- egress:
-  return status;  
-}
-
-
-TPM_RESULT Crypto_symcrypto_encrypt (symkey_t* key,
-                              const buffer_t* clear,
-                              buffer_t* o_cipher) {
-  TPM_RESULT status = TPM_SUCCESS;
-  
-  buffer_t iv, cipher_alias;
-  
-  buffer_init_const (&iv, EVP_MAX_IV_LENGTH, ZERO_IV);
-  
-  buffer_init (o_cipher,
-	       clear->size +
-	       EVP_CIPHER_iv_length(key->cipher) +
-	       EVP_CIPHER_block_size (key->cipher),
-				 0);
-  
-  // copy the IV into the front
-  buffer_copy (o_cipher, &iv);
-  
-  // make an alias into which we'll put the ciphertext
-  buffer_init_alias (&cipher_alias, o_cipher, EVP_CIPHER_iv_length(key->cipher), 0);
-  
-  TPMTRYRETURN( ossl_symcrypto_op (key, clear, &iv, &cipher_alias, CRYPT_ENCRYPT) );
-
-  // set the output size correctly
-  o_cipher->size += cipher_alias.size;
-  
-  goto egress;
-  
- abort_egress:
-  
- egress:
-  
-  return status;
-  
-}
-
-
-
-TPM_RESULT Crypto_symcrypto_decrypt (symkey_t* key,
-                              const buffer_t* cipher,
-                              buffer_t* o_clear) {
-  TPM_RESULT status = TPM_SUCCESS;
-  
-  buffer_t iv, cipher_alias;
-  
-  // alias for the IV
-  buffer_init_alias (&iv, cipher, 0, EVP_CIPHER_iv_length(key->cipher));
-  
-  // make an alias to where the ciphertext is, after the IV
-  buffer_init_alias (&cipher_alias, cipher, EVP_CIPHER_iv_length(key->cipher), 0);
-  
-  // prepare the output buffer
-  TPMTRYRETURN( buffer_init (o_clear,
-			cipher->size
-			- EVP_CIPHER_iv_length(key->cipher)
-			+ EVP_CIPHER_block_size(key->cipher), 
-			0) );
-  
-  // and decrypt
-  TPMTRYRETURN ( ossl_symcrypto_op (key, &cipher_alias, &iv, o_clear, CRYPT_DECRYPT) );
-  
-  goto egress;
-  
- abort_egress:
-  buffer_free (o_clear);
-  
- egress:
-  
-  return status;
-}
-
-
-
-TPM_RESULT Crypto_symcrypto_freekey (symkey_t * key) {
-  buffer_memset (&key->key, 0);
-  buffer_free (&key->key);
-  
-  EVP_CIPHER_CTX_cleanup (&key->context);
-  
-  return TPM_SUCCESS;
-}
-
-
-TPM_RESULT ossl_symcrypto_op (symkey_t* key,
-                              const buffer_t* in,
-                              const buffer_t* iv,
-                              buffer_t * out,
-                              crypt_op_type_t optype) {
-  TPM_RESULT status = TPM_SUCCESS;
-  
-  int inlen, outlen;
-  tpm_size_t running;
-  
-  if ( ! EVP_CipherInit_ex (&key->context,
-			    key->cipher, NULL, key->key.bytes, iv->bytes,
-			    optype == CRYPT_ENCRYPT ? 1 : 0) ) 
-    ERRORDIE (TPM_FAIL);
-  
-  
-  
-  inlen = in->size;
-  
-  outlen  = 0;
-  running = 0;
-  
-  
-  if ( ! EVP_CipherUpdate (&key->context, out->bytes, &outlen, in->bytes, inlen) )
-    ERRORDIE (TPM_FAIL);
-
-  running += outlen;
-  
-  if ( ! EVP_CipherFinal_ex (&key->context, out->bytes + running, &outlen) )
-    ERRORDIE (TPM_FAIL);
-  
-  running += outlen;
-  
-  out->size = running;
-  
-  goto egress;
-  
- abort_egress:
- egress:
-  
-  return status;
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/crypto/sym_crypto.h
--- a/tools/vtpm_manager/crypto/sym_crypto.h	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// sym_crypto.h
-// 
-//     Symmetric Crypto 
-// 
-// ==================================================================
-
-#ifndef _SYM_CRYPTO_H
-#define _SYM_CRYPTO_H
-
-#include <openssl/evp.h>
-#include "buffer.h"
-
-typedef struct symkey_t {
-  buffer_t key;
-  
-  EVP_CIPHER_CTX context;
-  const EVP_CIPHER * cipher;
-} symkey_t;
-
-extern const EVP_CIPHER * SYM_CIPHER;
-
-TPM_RESULT Crypto_symcrypto_genkey (symkey_t * key);
-
-TPM_RESULT Crypto_symcrypto_initkey (symkey_t * key, const buffer_t* keybits);
-
-
-// these functions will allocate their output buffers
-TPM_RESULT Crypto_symcrypto_encrypt (symkey_t* key,
-                              const buffer_t* clear,
-                              buffer_t* o_cipher);
-
-TPM_RESULT Crypto_symcrypto_decrypt (symkey_t* key,
-                              const buffer_t* cipher,
-                              buffer_t* o_clear);
-
-// only free the internal parts, not the 'key' ptr
-TPM_RESULT Crypto_symcrypto_freekey (symkey_t * key);
-
-#endif /* _SYM_CRYPTO_H */
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/Makefile
--- a/tools/vtpm_manager/manager/Makefile	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/vtpm_manager/Rules.mk
-
-BIN		= vtpm_managerd
-
-.PHONY: all
-all: build
-
-.PHONY: build
-build: $(BIN)
-
-.PHONY: install
-install: build
-	if [ ! -d "$(DESTDIR)/var/vtpm/fifos" ]; \
-		then mkdir -p $(DESTDIR)/var/vtpm/fifos; \
-	fi
-	if [ ! -d "$(DESTDIR)/var/vtpm/socks" ]; \
-		then mkdir -p $(DESTDIR)/var/vtpm/socks; \
-	fi
-	$(INSTALL_PROG) $(BIN) $(DESTDIR)$(BINDIR)
-
-.PHONY: clean
-clean:
-	rm -f $(BIN)
-	rm -f *.a *.so *.o *.rpm $(DEP_FILES)
-
-.PHONY: mrproper
-mrproper: clean
-	rm -f *~
-
-$(BIN): $(OBJS)
-	$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
-
-# libraries
-LIBS += ../tcs/libTCS.a ../util/libTCGUtils.a ../crypto/libtcpaCrypto.a
-LIBS += -lcrypto $(PTHREAD_LIBS) -lm
-CFLAGS += $(PTHREAD_CFLAGS)
-LDFLAGS += $(PTHREAD_LDFLAGS)
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/dmictl.c
--- a/tools/vtpm_manager/manager/dmictl.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,266 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-//   dmictl.c
-// 
-//     Functions for creating and destroying DMIs
-//
-// ==================================================================
-
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "vtpmpriv.h"
-#include "bsg.h"
-#include "buffer.h"
-#include "log.h"
-#include "hashtable.h"
-#include "hashtable_itr.h"
-#include "vtpm_ipc.h"
-
-#define TPM_EMULATOR_PATH "/usr/bin/vtpmd"
-
-// if dmi_res is non-null, then return a pointer to new object.
-// Also, this does not fill in the measurements. They should be filled by
-// design dependent code or saveNVM
-TPM_RESULT init_dmi(UINT32 dmi_id, BYTE dmi_type, VTPM_DMI_RESOURCE **dmi_res) {
-
-  TPM_RESULT status=TPM_SUCCESS;
-  VTPM_DMI_RESOURCE *new_dmi=NULL;
-  UINT32 *dmi_id_key=NULL;
-
-  if ((new_dmi = (VTPM_DMI_RESOURCE *) malloc (sizeof(VTPM_DMI_RESOURCE))) == NULL) {
-      status = TPM_RESOURCES;
-      goto abort_egress;
-  }
-  memset(new_dmi, 0, sizeof(VTPM_DMI_RESOURCE));
-  new_dmi->dmi_id = dmi_id;
-  new_dmi->dmi_type = dmi_type;
-  new_dmi->connected = FALSE;
-  new_dmi->TCSContext = 0;
-
-  new_dmi->NVMLocation = (char *) malloc(11 + strlen(DMI_NVM_FILE));
-  sprintf(new_dmi->NVMLocation, DMI_NVM_FILE, (uint32_t) new_dmi->dmi_id);
-
-  if ((dmi_id_key = (UINT32 *) malloc (sizeof(UINT32))) == NULL) {
-    status = TPM_RESOURCES;
-    goto abort_egress;
-  }
-  *dmi_id_key = new_dmi->dmi_id;
-
-  // install into map
-  if (!hashtable_insert(vtpm_globals->dmi_map, dmi_id_key, new_dmi)){
-    vtpmlogerror(VTPM_LOG_VTPM, "Failed to insert instance into table. Aborting.\n", dmi_id);
-    status = TPM_FAIL;
-    goto abort_egress;
-  }
-
-  if (dmi_res)
-    *dmi_res = new_dmi;
-
-  goto egress;
-
- abort_egress:
-  if (new_dmi) {
-    free(new_dmi->NVMLocation);
-    free(new_dmi);
-  }
-  free(dmi_id_key);
-
- egress:
-  return status;
-}
-
-TPM_RESULT close_dmi(VTPM_DMI_RESOURCE *dmi_res) {
-  if (dmi_res == NULL) 
-    return TPM_SUCCESS;
-
-  if (dmi_res->dmi_id == VTPM_CTL_DM) 
-    return(TPM_BAD_PARAMETER);
-
-  TCS_CloseContext(dmi_res->TCSContext);
-  dmi_res->connected = FALSE;
-
-  vtpm_globals->connected_dmis--;
-
-  return (VTPM_Close_DMI_Extra(dmi_res) );
-}
-	
-TPM_RESULT VTPM_Handle_New_DMI(const buffer_t *param_buf) {
-  
-  VTPM_DMI_RESOURCE *new_dmi=NULL;
-  TPM_RESULT status=TPM_FAIL;
-  BYTE dmi_type, vm_type, startup_mode;
-  UINT32 dmi_id; 
-
-  if (param_buf == NULL) { // Assume creation of Dom 0 control
-    dmi_type = VTPM_TYPE_NON_MIGRATABLE;
-    dmi_id = VTPM_CTL_DM;
-  } else if (buffer_len(param_buf) != sizeof(BYTE) * 3  + sizeof(UINT32)) {
-    vtpmloginfo(VTPM_LOG_VTPM, "New DMI command wrong length: %d.\n", buffer_len(param_buf));
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  } else {
-    vtpm_globals->connected_dmis++; // Put this here so we don't count Dom0
-    BSG_UnpackList( param_buf->bytes, 4,
-		    BSG_TYPE_BYTE, &dmi_type,
-		    BSG_TYPE_BYTE, &startup_mode,
-		    BSG_TYPE_BYTE, &vm_type,
-		    BSG_TYPE_UINT32,  &dmi_id);
-  }
-
-  if ((dmi_type != VTPM_TYPE_NON_MIGRATABLE) && (dmi_type != VTPM_TYPE_MIGRATABLE)) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Creation of VTPM with illegal type.\n");
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-
-  new_dmi = (VTPM_DMI_RESOURCE *) hashtable_search(vtpm_globals->dmi_map, &dmi_id);
-  if (new_dmi == NULL) { 
-    vtpmloginfo(VTPM_LOG_VTPM, "Creating new DMI instance %d attached.\n", dmi_id );
-    // Brand New DMI. Initialize the persistent pieces
-    TPMTRYRETURN(init_dmi(dmi_id, dmi_type, &new_dmi) );  
-  } else 
-    vtpmloginfo(VTPM_LOG_VTPM, "Re-attaching DMI instance %d.\n", dmi_id);
-
-  if (new_dmi->connected) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Attempt to re-attach, currently attached instance %d. Ignoring\n", dmi_id);
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-  
-  if (new_dmi->dmi_type == VTPM_TYPE_MIGRATED) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Attempt to re-attach previously migrated instance %d without recovering first. Ignoring\n", dmi_id);
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-
-  // Initialize the Non-persistent pieces
-  TPMTRYRETURN( TCS_OpenContext(&new_dmi->TCSContext) );
-  
-  new_dmi->connected = TRUE;  
-
-  // Design specific new DMI code. 
-  // Includes: create IPCs, Measuring DMI, and maybe launching DMI
-  TPMTRYRETURN(VTPM_New_DMI_Extra(new_dmi, vm_type, startup_mode) );
-  goto egress;
-  
- abort_egress:
-  vtpmlogerror(VTPM_LOG_VTPM, "Failed to create DMI id=%d due to status=%s. Cleaning.\n", dmi_id, tpm_get_error_name(status));
-  close_dmi(new_dmi );
-	
- egress:
-  return status;
-}
-
-TPM_RESULT VTPM_Handle_Close_DMI( const buffer_t *param_buf) {
-  
-  TPM_RESULT status=TPM_FAIL;
-  VTPM_DMI_RESOURCE *dmi_res=NULL;
-  UINT32 dmi_id;
-  
-  if ((param_buf == NULL) || (buffer_len(param_buf) != sizeof(UINT32)) ) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Closing DMI has bad size.");
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-  
-  BSG_UnpackList( param_buf->bytes, 1,
-		  BSG_TYPE_UINT32, &dmi_id);
-  
-  vtpmloginfo(VTPM_LOG_VTPM, "Closing DMI %d.\n", dmi_id);
-  
-  dmi_res = (VTPM_DMI_RESOURCE *) hashtable_search(vtpm_globals->dmi_map, &dmi_id);
-  if (dmi_res == NULL ) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Trying to close nonexistent DMI.\n");
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-	
-  if (!dmi_res->connected) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Closing non-connected DMI.\n");
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-  
-  // Close Dmi
-	TPMTRYRETURN(close_dmi( dmi_res ));
-  
-  status=TPM_SUCCESS;    
-  goto egress;
-  
- abort_egress:
- egress:
-  
-  return status;
-}
-
-TPM_RESULT VTPM_Handle_Delete_DMI( const buffer_t *param_buf) {
-  
-  TPM_RESULT status=TPM_FAIL;
-  VTPM_DMI_RESOURCE *dmi_res=NULL;
-  UINT32 dmi_id;
-    
-  if ((param_buf == NULL) || (buffer_len(param_buf) != sizeof(UINT32)) ) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Closing DMI has bad size.\n");
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-  
-  BSG_UnpackList( param_buf->bytes, 1,
-		  BSG_TYPE_UINT32, &dmi_id);
-  
-  vtpmloginfo(VTPM_LOG_VTPM, "Deleting DMI %d.\n", dmi_id);    
-  
-  dmi_res = (VTPM_DMI_RESOURCE *) hashtable_remove(vtpm_globals->dmi_map, &dmi_id);
-  if (dmi_res == NULL) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Closing non-existent DMI.\n");
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-  
-  //vtpm scripts delete file dmi_res->NVMLocation for us
-  
-  // Close DMI first
-  TPMTRYRETURN(close_dmi( dmi_res ));
-  free ( dmi_res );
-	
-  status=TPM_SUCCESS;    
-  goto egress;
-  
- abort_egress:
- egress:
-  
-  return status;
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/migration.c
--- a/tools/vtpm_manager/manager/migration.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,307 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-//   dmictl.c
-// 
-//     Functions for creating and destroying DMIs
-//
-// ==================================================================
-
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "vtpmpriv.h"
-#include "bsg.h"
-#include "buffer.h"
-#include "log.h"
-#include "hashtable.h"
-
-TPM_RESULT VTPM_Handle_Migrate_In( const buffer_t *param_buf,
-                                   buffer_t *result_buf) {
-
-  TPM_RESULT status=TPM_FAIL;
-  VTPM_DMI_RESOURCE *mig_dmi=NULL;
-  UINT32 dmi_id;
-  buffer_t dmi_state_abuf = NULL_BUF, enc_dmi_abuf = NULL_BUF, clear_dmi_blob = NULL_BUF;
-
-  if (param_buf == NULL) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Migration Out Failed due to bad parameter.\n");
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-
-  struct pack_buf_t enc_dmi_state_pack;
-
-  BSG_UnpackList(param_buf->bytes, 2, 
-                 BSG_TYPE_UINT32, &dmi_id,
-                 BSG_TPM_SIZE32_DATA, &enc_dmi_state_pack) ;
-
-  vtpmloginfo(VTPM_LOG_VTPM, "Migrating VTPM in dmi %d.\n", dmi_id);
-
-  mig_dmi = (VTPM_DMI_RESOURCE *) hashtable_search(vtpm_globals->dmi_map, &dmi_id);
-  if (mig_dmi) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Incoming VTPM claims unavailable id: %d.\n", dmi_id);
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }    
-
-  /** UnBind Blob **/
-  TPMTRYRETURN( buffer_init_alias_convert( &enc_dmi_abuf, 
-                                           enc_dmi_state_pack.size, 
-                                           enc_dmi_state_pack.data) );
-
-  TPMTRYRETURN( envelope_decrypt( &enc_dmi_abuf,
-                                   vtpm_globals->manager_tcs_handle,
-                                   vtpm_globals->storageKeyHandle,
-                                   (const TPM_AUTHDATA*)&vtpm_globals->storage_key_usage_auth,
-                                   &clear_dmi_blob) );
-
-  // Create new dmi
-  TPMTRYRETURN( init_dmi(dmi_id, VTPM_TYPE_MIGRATABLE, &mig_dmi ) ); 
-
-  /** Open Blob **/
-  struct pack_buf_t dmi_state_pack;
-
-  BSG_UnpackList(clear_dmi_blob.bytes, 2, 
-                 BSG_TPM_DIGEST, &mig_dmi->DMI_measurement,
-                 BSG_TPM_SIZE32_DATA, &dmi_state_pack);
-
-  TPMTRYRETURN( buffer_init_alias_convert(&dmi_state_abuf, 
-                                          dmi_state_pack.size, 
-                                          dmi_state_pack.data) ); 
-
-  TPMTRYRETURN( VTPM_Handle_Save_NVM(mig_dmi, &dmi_state_abuf, NULL ) );
-
-  status=TPM_SUCCESS;
-  goto egress;
-
- abort_egress:
-    vtpmlogerror(VTPM_LOG_VTPM, "VTPM Migration IN of instance %d failed because of %s.\n", dmi_id, tpm_get_error_name(status) );
-
- egress:
-  buffer_free(&clear_dmi_blob);
-  buffer_free(&dmi_state_abuf);
- 
-  return status;
-}
-
-TPM_RESULT VTPM_Handle_Migrate_Out( const buffer_t *param_buf,
-                                    buffer_t *result_buf) {
-
-  TPM_RESULT status=TPM_FAIL;
-  VTPM_DMI_RESOURCE *mig_dmi;
-  UINT32 dmi_id;
-  VTPM_MIGKEY_LIST *last_mig, *mig_key;
-  buffer_t dmi_state=NULL_BUF, clear_dmi_blob=NULL_BUF;
-
-  if (param_buf == NULL) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Migration Out Failed due to bad parameter.\n");
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-
-  struct pack_buf_t name_pack;
-
-  BSG_UnpackList( param_buf->bytes, 2,
-                  BSG_TYPE_UINT32, &dmi_id,
-                  BSG_TPM_SIZE32_DATA, &name_pack);
-
-  vtpmloginfo(VTPM_LOG_VTPM, "Migrating out dmi %d.\n", dmi_id);
-
-  mig_dmi = (VTPM_DMI_RESOURCE *) hashtable_search(vtpm_globals->dmi_map, &dmi_id);
-  if (mig_dmi == NULL) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Non-existent VTPM instance (%d) in migration.\n", dmi_id );
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-
-  if (mig_dmi->dmi_type != VTPM_TYPE_MIGRATABLE) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Bad VTPM type (%d) in migration of instance (%d).\n", mig_dmi->dmi_type, dmi_id );
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-
-  /** Find migration key for dest **/
-  last_mig = NULL;
-  mig_key = vtpm_globals->mig_keys;
-  while (mig_key != NULL) {
-    if (mig_key->name_size == name_pack.size)
-      if (memcmp(mig_key->name, name_pack.data, name_pack.size) == 0) {
-        break;
-      }
-    
-    last_mig = mig_key;
-    mig_key = mig_key->next;
-  }
-     
-  if (!mig_key) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Unknown Migration target host.\n");
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-
-  /** Mark vtpm as migrated **/
-  mig_dmi->dmi_type = VTPM_TYPE_MIGRATED;
-
-  /** Build Blob **/
-  TPMTRYRETURN( VTPM_Handle_Load_NVM(mig_dmi, NULL, &dmi_state) );
-
-  TPMTRYRETURN( buffer_init(&clear_dmi_blob, sizeof(TPM_DIGEST) + sizeof(UINT32) + buffer_len(&dmi_state), NULL ) ); 
-
-  struct pack_constbuf_t dmi_state_pack;
-
-  dmi_state_pack.size = buffer_len(&dmi_state);
-  dmi_state_pack.data = dmi_state.bytes;
-
-  BSG_PackList(clear_dmi_blob.bytes, 2, 
-               BSG_TPM_DIGEST, &mig_dmi->DMI_measurement,
-               BSG_TPM_SIZE32_DATA, &dmi_state_pack);
-
-  /** Bind Blob **/
-  TPMTRYRETURN( envelope_encrypt( &clear_dmi_blob,
-                                  &mig_key->key,
-                                  result_buf) );
-
-  if (last_mig)
-    last_mig->next = mig_key->next;
-  else 
-    vtpm_globals->mig_keys = mig_key->next;
-  
-  free(mig_key->name);
-  free(mig_key);
-
-  status=TPM_SUCCESS;
-  goto egress;
-
- abort_egress:
-    vtpmlogerror(VTPM_LOG_VTPM, "VTPM Migration OUT of instance %d failed because of %s. Migratoin recovery may be needed.\n", dmi_id, tpm_get_error_name(status) );
-
-    //TODO: Create and implement a policy for what happens to mig_key on failed migrations.
-
- egress:
-
-  buffer_free(&clear_dmi_blob);
-  buffer_free(&dmi_state);
-
-  return status;
-}
-
-
-TPM_RESULT VTPM_Handle_Get_Migration_key( const buffer_t *param_buf,
-                                          buffer_t *result_buf) {
-
-  TPM_RESULT status=TPM_FAIL;
-
-  vtpmloginfo(VTPM_LOG_VTPM, "Getting Migration Public Key.\n");
-
-  struct pack_buf_t pubkey_exp_pack, pubkey_mod_pack;
-  TPM_KEY mig_key;
-
-  // Unpack/return key structure
-  BSG_Unpack(BSG_TPM_KEY, vtpm_globals->storageKeyWrap.bytes , &mig_key);
-  TPM_RSA_KEY_PARMS rsaKeyParms;
-
-  BSG_Unpack(BSG_TPM_RSA_KEY_PARMS,
-               mig_key.algorithmParms.parms,
-               &rsaKeyParms);
-
-  pubkey_exp_pack.size = rsaKeyParms.exponentSize;
-  pubkey_exp_pack.data = rsaKeyParms.exponent;
-  pubkey_mod_pack.size = mig_key.pubKey.keyLength;
-  pubkey_mod_pack.data = mig_key.pubKey.key;
-
-  TPMTRYRETURN( buffer_init( result_buf, 2*sizeof(UINT32) + 
-                                         pubkey_exp_pack.size + 
-                                         pubkey_mod_pack.size, NULL ) );
-
-  BSG_PackList( result_buf->bytes, 2,
-                  BSG_TPM_SIZE32_DATA, &pubkey_exp_pack,
-                  BSG_TPM_SIZE32_DATA, &pubkey_mod_pack);
-
-
-  status=TPM_SUCCESS;
-  goto egress;
-
- abort_egress:
-    vtpmlogerror(VTPM_LOG_VTPM, "VTPM Get Migration Key failed because of %s.\n", tpm_get_error_name(status) );
- egress:
-
-  return status;
-}
-
-TPM_RESULT VTPM_Handle_Load_Migration_key( const buffer_t *param_buf,
-                                           buffer_t *result_buf) {
-
-  TPM_RESULT status=TPM_FAIL;
-  VTPM_MIGKEY_LIST *mig_key;
-
-  vtpmloginfo(VTPM_LOG_VTPM, "Loading Migration Public Key.\n");
-
-  //FIXME: Review all uses of unpacking pack_buf_t and ensure free.
-  //FIXME: Review all declarations/initializations of buffer_t that could have a goto that skips them and then tries to free them
-
-  struct pack_buf_t name_pack, pubkey_exp_pack, pubkey_mod_pack;
-
-  //FIXME: scan list and verify name is not already in the list
-
-  BSG_UnpackList( param_buf->bytes, 3,
-                  BSG_TPM_SIZE32_DATA, &name_pack,
-                  BSG_TPM_SIZE32_DATA, &pubkey_exp_pack,
-                  BSG_TPM_SIZE32_DATA, &pubkey_mod_pack);
-
-  //TODO: Maintain a persistent list for pub_keys.
-  //TODO: Verify pub_key is trusted
-
-  mig_key = (VTPM_MIGKEY_LIST *) malloc(sizeof(VTPM_MIGKEY_LIST));
-  memset(mig_key, 0, sizeof(VTPM_MIGKEY_LIST) );
-  mig_key->name_size = name_pack.size;
-  mig_key->name = name_pack.data;
-
-  mig_key->key.encScheme = CRYPTO_ES_RSAESOAEP_SHA1_MGF1;
-  Crypto_RSABuildCryptoInfoPublic( pubkey_exp_pack.size,
-                                   pubkey_exp_pack.data,
-                                   pubkey_mod_pack.size,
-                                   pubkey_mod_pack.data,
-                                   &mig_key->key);
-
-
-  mig_key->next = vtpm_globals->mig_keys;
-  vtpm_globals->mig_keys = mig_key;
-
-  // free(name_pack.data); Do not free. data is now part of mig_key.
-  free(pubkey_exp_pack.data);
-  free(pubkey_mod_pack.data);
-
-  return TPM_SUCCESS;
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/securestorage.c
--- a/tools/vtpm_manager/manager/securestorage.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,512 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// securestorage.c
-// 
-//  Functions regarding securely storing DMI secrets.
-//
-// ==================================================================
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "tcg.h"
-#include "vtpm_manager.h"
-#include "vtpmpriv.h"
-#include "vtsp.h"
-#include "bsg.h"
-#include "crypto.h"
-#include "hashtable.h"
-#include "hashtable_itr.h"
-#include "buffer.h"
-#include "log.h"
-
-TPM_RESULT envelope_encrypt(const buffer_t     *inbuf,
-                            CRYPTO_INFO        *asymkey,
-                            buffer_t           *sealed_data) {
-  TPM_RESULT status = TPM_SUCCESS;
-  symkey_t    symkey;
-  buffer_t    data_cipher = NULL_BUF,
-              symkey_cipher = NULL_BUF;
-  
-  UINT32 i;
-  struct pack_constbuf_t symkey_cipher32, data_cipher32;
-  
-  vtpmloginfo(VTPM_LOG_VTPM_DEEP, "Enveloping Input[%d]: 0x", buffer_len(inbuf));
-  for (i=0; i< buffer_len(inbuf); i++)
-    vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", inbuf->bytes[i]);
-  vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-  
-  // Generate a sym key and encrypt state with it
-  TPMTRY(TPM_ENCRYPT_ERROR, Crypto_symcrypto_genkey (&symkey) );
-  TPMTRY(TPM_ENCRYPT_ERROR, Crypto_symcrypto_encrypt (&symkey, inbuf, &data_cipher) );
-  
-  // Encrypt symmetric key
-  TPMTRYRETURN( VTSP_Bind(    asymkey, 
-			      &symkey.key, 
-			      &symkey_cipher) );
-  
-  // Create output blob: symkey_size + symkey_cipher + state_cipher_size + state_cipher
-  
-  symkey_cipher32.size = buffer_len(&symkey_cipher);
-  symkey_cipher32.data = symkey_cipher.bytes;
-  
-  data_cipher32.size = buffer_len(&data_cipher);
-  data_cipher32.data = data_cipher.bytes;
-  
-  TPMTRYRETURN( buffer_init(sealed_data, 2 * sizeof(UINT32) + symkey_cipher32.size + data_cipher32.size, NULL));
-  
-  BSG_PackList(sealed_data->bytes, 2,
-	       BSG_TPM_SIZE32_DATA, &symkey_cipher32,
-	       BSG_TPM_SIZE32_DATA, &data_cipher32);
-
-  vtpmloginfo(VTPM_LOG_VTPM, "Saved %d bytes of E(symkey) + %d bytes of E(data)\n", buffer_len(&symkey_cipher), buffer_len(&data_cipher));
-
-  vtpmloginfo(VTPM_LOG_VTPM_DEEP, "Enveloping Output[%d]: 0x", buffer_len(sealed_data));
-  for (i=0; i< buffer_len(sealed_data); i++)
-    vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", sealed_data->bytes[i]);
-  vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-
-  goto egress;
-
- abort_egress:
-  vtpmlogerror(VTPM_LOG_VTPM, "Failed to envelope encrypt\n.");
-  
- egress:
-  
-  buffer_free ( &data_cipher);
-  buffer_free ( &symkey_cipher);
-  Crypto_symcrypto_freekey (&symkey);
-  
-  return status;
-}
-
-TPM_RESULT envelope_decrypt(const buffer_t     *cipher,
-                            TCS_CONTEXT_HANDLE TCSContext,
-			    TPM_HANDLE         keyHandle,
-			    const TPM_AUTHDATA *key_usage_auth,
-                            buffer_t           *unsealed_data) {
-
-  TPM_RESULT status = TPM_SUCCESS;
-  symkey_t    symkey;
-  buffer_t    data_cipher = NULL_BUF, 
-              symkey_clear = NULL_BUF, 
-              symkey_cipher = NULL_BUF;
-  struct pack_buf_t symkey_cipher32, data_cipher32;
-  int i;
-
-  memset(&symkey, 0, sizeof(symkey_t));
-
-  vtpmloginfo(VTPM_LOG_VTPM_DEEP, "Envelope Decrypt Input[%d]: 0x", buffer_len(cipher) );
-  for (i=0; i< buffer_len(cipher); i++)
-    vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", cipher->bytes[i]);
-  vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-  
-  BSG_UnpackList(cipher->bytes, 2,
-		 BSG_TPM_SIZE32_DATA, &symkey_cipher32,
-		 BSG_TPM_SIZE32_DATA, &data_cipher32);
-  
-  TPMTRYRETURN( buffer_init_alias_convert (&symkey_cipher, 
-				           symkey_cipher32.size, 
-				           symkey_cipher32.data) );
-  
-  TPMTRYRETURN( buffer_init_alias_convert (&data_cipher, 
-				           data_cipher32.size, 
-				           data_cipher32.data) );
-
-  // Decrypt Symmetric Key
-  TPMTRYRETURN( VTSP_Unbind(  TCSContext,
-			      keyHandle,
-			      &symkey_cipher,
-			      key_usage_auth,
-			      &symkey_clear,
-			      &(vtpm_globals->keyAuth) ) );
-  
-  // create symmetric key using saved bits
-  Crypto_symcrypto_initkey (&symkey, &symkey_clear);
-  
-  // Decrypt State
-  TPMTRY(TPM_DECRYPT_ERROR, Crypto_symcrypto_decrypt (&symkey, &data_cipher, unsealed_data) );
-
-  vtpmloginfo(VTPM_LOG_VTPM_DEEP, "Envelope Decrypte Output[%d]: 0x", buffer_len(unsealed_data));
-  for (i=0; i< buffer_len(unsealed_data); i++)
-    vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", unsealed_data->bytes[i]);
-  vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-  
-  goto egress;
-  
- abort_egress:
-  vtpmlogerror(VTPM_LOG_VTPM, "Failed to envelope decrypt data\n.");
-  
- egress:
-  buffer_free ( &data_cipher);
-  buffer_free ( &symkey_clear);
-  buffer_free ( &symkey_cipher);
-  Crypto_symcrypto_freekey (&symkey);
-  
-  return status;
-}
-
-TPM_RESULT VTPM_Handle_Save_NVM(VTPM_DMI_RESOURCE *myDMI, 
-				const buffer_t *inbuf, 
-				buffer_t *outbuf) {
-  
-  TPM_RESULT status = TPM_SUCCESS;
-  int fh;
-  long bytes_written;
-  buffer_t sealed_NVM = NULL_BUF;
-  
-  vtpmloginfo(VTPM_LOG_VTPM_DEEP, "Saving %d bytes of NVM.\n", buffer_len(inbuf));
-
-  TPMTRYRETURN( envelope_encrypt(inbuf,
-                                 &vtpm_globals->storageKey,
-                                 &sealed_NVM) );
-				  
-  // Write sealed blob off disk from NVMLocation
-  // TODO: How to properly return from these. Do we care if we return failure
-  //       after writing the file? We can't get the old one back.
-  // TODO: Backup old file and try and recover that way.
-  fh = open(myDMI->NVMLocation, O_WRONLY | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE);
-  if ( (bytes_written = write(fh, sealed_NVM.bytes, buffer_len(&sealed_NVM) ) != (long) buffer_len(&sealed_NVM))) {
-    vtpmlogerror(VTPM_LOG_VTPM, "We just overwrote a DMI_NVM and failed to finish. %ld/%ld bytes.\n", bytes_written, (long)buffer_len(&sealed_NVM));
-    status = TPM_IOERROR;
-    goto abort_egress;
-  }
-  close(fh);
-  
-  Crypto_SHA1Full (sealed_NVM.bytes, buffer_len(&sealed_NVM), (BYTE *) &myDMI->NVM_measurement);   
-  
-  goto egress;
-  
- abort_egress:
-  vtpmlogerror(VTPM_LOG_VTPM, "Failed to save NVM\n.");
-  
- egress:
-  buffer_free(&sealed_NVM);
-  return status;
-}
-
-
-/* Expected Params: inbuf = null, outbuf = sealed blob size, sealed blob.*/
-TPM_RESULT VTPM_Handle_Load_NVM(VTPM_DMI_RESOURCE *myDMI, 
-				const buffer_t    *inbuf, 
-				buffer_t          *outbuf) {
-  
-  TPM_RESULT status = TPM_SUCCESS;
-
-  buffer_t sealed_NVM = NULL_BUF;
-  long fh_size;
-  int fh, stat_ret, i;
-  struct stat file_stat;
-  TPM_DIGEST sealedNVMHash;
-   
-  if (myDMI->NVMLocation == NULL) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Unable to load NVM because the file name NULL.\n");
-    status = TPM_AUTHFAIL;
-    goto abort_egress;
-  }
-  
-  //Read sealed blob off disk from NVMLocation
-  fh = open(myDMI->NVMLocation, O_RDONLY);
-  stat_ret = fstat(fh, &file_stat);
-  if (stat_ret == 0) 
-    fh_size = file_stat.st_size;
-  else {
-    status = TPM_IOERROR;
-    goto abort_egress;
-  }
-  
-  TPMTRYRETURN( buffer_init( &sealed_NVM, fh_size, NULL) );
-  if (read(fh, sealed_NVM.bytes, buffer_len(&sealed_NVM)) != fh_size) {
-    status = TPM_IOERROR;
-    goto abort_egress;
-  }
-  close(fh);
-  
-  vtpmloginfo(VTPM_LOG_VTPM_DEEP, "Load_NVMing[%d],\n", buffer_len(&sealed_NVM));
-  
-  Crypto_SHA1Full(sealed_NVM.bytes, buffer_len(&sealed_NVM), (BYTE *) &sealedNVMHash);    
-  
-  // Verify measurement of sealed blob.
-  if (memcmp(&sealedNVMHash, &myDMI->NVM_measurement, sizeof(TPM_DIGEST)) ) {
-    vtpmlogerror(VTPM_LOG_VTPM, "VTPM LoadNVM NVM measurement check failed.\n");
-    vtpmloginfo(VTPM_LOG_VTPM_DEEP, "Correct hash: ");
-    for (i=0; i< sizeof(TPM_DIGEST); i++)
-      vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", ((BYTE*)&myDMI->NVM_measurement)[i]);
-    vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-
-    vtpmloginfo(VTPM_LOG_VTPM_DEEP, "Measured hash: ");
-    for (i=0; i< sizeof(TPM_DIGEST); i++)
-      vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", ((BYTE*)&sealedNVMHash)[i]);
-    vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-    
-    status = TPM_AUTHFAIL;
-    goto abort_egress;
-  }
-  
-  TPMTRYRETURN( envelope_decrypt(&sealed_NVM,
-                                 myDMI->TCSContext,
-		        	 vtpm_globals->storageKeyHandle,
-			         (const TPM_AUTHDATA*)&vtpm_globals->storage_key_usage_auth,
-                                 outbuf) );  
-  goto egress;
-  
- abort_egress:
-  vtpmlogerror(VTPM_LOG_VTPM, "Failed to load NVM\n.");
-  
- egress:
-  buffer_free( &sealed_NVM );
-  
-  return status;
-}
-
-
-TPM_RESULT VTPM_SaveManagerData(void) {
-  TPM_RESULT status=TPM_SUCCESS;
-  int fh, dmis=-1;
-
-  BYTE *flat_boot_key=NULL, *flat_dmis=NULL, *flat_enc=NULL;
-  buffer_t clear_flat_global=NULL_BUF, enc_flat_global=NULL_BUF;
-  UINT32 storageKeySize = buffer_len(&vtpm_globals->storageKeyWrap);
-  UINT32 bootKeySize = buffer_len(&vtpm_globals->bootKeyWrap);
-  struct pack_buf_t storage_key_pack = {storageKeySize, vtpm_globals->storageKeyWrap.bytes};
-  struct pack_buf_t boot_key_pack = {bootKeySize, vtpm_globals->bootKeyWrap.bytes};
-  BYTE vtpm_manager_gen = VTPM_MANAGER_GEN;
-
-  struct hashtable_itr *dmi_itr;
-  VTPM_DMI_RESOURCE *dmi_res;
-
-  UINT32 boot_key_size = 0, flat_dmis_size = 0;
-
-  // Initially fill these with buffer sizes for each data type. Later fill
-  // in actual size, once flattened.
-  boot_key_size =  sizeof(UINT32) +       // bootkeysize
-                   bootKeySize;           // boot key
-
-  TPMTRYRETURN(buffer_init(&clear_flat_global,sizeof(BYTE) + // manager version
-                                              3*sizeof(TPM_DIGEST) + // Auths
-                                              sizeof(UINT32) +// storagekeysize
-                                              storageKeySize, NULL) ); // storage key
-
-
-  flat_boot_key = (BYTE *) malloc( boot_key_size );
-  flat_enc = (BYTE *) malloc( sizeof(UINT32) );
-
-  boot_key_size = BSG_PackList(flat_boot_key, 1,
-                               BSG_TPM_SIZE32_DATA, &boot_key_pack);
-
-  BSG_PackList(clear_flat_global.bytes, 4,
-                BSG_TYPE_BYTE,    &vtpm_manager_gen,
-                BSG_TPM_AUTHDATA, &vtpm_globals->owner_usage_auth,
-                BSG_TPM_SECRET,   &vtpm_globals->storage_key_usage_auth,
-                BSG_TPM_SIZE32_DATA, &storage_key_pack);
-
-  TPMTRYRETURN(envelope_encrypt(&clear_flat_global,
-                                &vtpm_globals->bootKey,
-                                &enc_flat_global) );
-
-  BSG_PackConst(buffer_len(&enc_flat_global), 4, flat_enc);
-
-  // Per DMI values to be saved (if any exit)
-  if (hashtable_count(vtpm_globals->dmi_map) > 1) {
-
-    flat_dmis = (BYTE *) malloc( 
-                     (hashtable_count(vtpm_globals->dmi_map) - 1) * // num DMIS (-1 for Dom0)
-                     (sizeof(UINT32) +sizeof(BYTE) + 2*sizeof(TPM_DIGEST)) ); // Per DMI info
-
-    dmi_itr = hashtable_iterator(vtpm_globals->dmi_map);
-    do {
-      dmi_res = (VTPM_DMI_RESOURCE *) hashtable_iterator_value(dmi_itr);
-      dmis++;
-
-      // No need to save dmi0.
-      if (dmi_res->dmi_id == 0)
-        continue;
-
-
-      flat_dmis_size += BSG_PackList( flat_dmis + flat_dmis_size, 4,
-                                        BSG_TYPE_UINT32, &dmi_res->dmi_id,
-                                        BSG_TYPE_BYTE, &dmi_res->dmi_type,
-                                        BSG_TPM_DIGEST, &dmi_res->NVM_measurement,
-                                        BSG_TPM_DIGEST, &dmi_res->DMI_measurement);
-
-    } while (hashtable_iterator_advance(dmi_itr));
-  }
-
-  fh = open(STATE_FILE, O_WRONLY | O_CREAT, S_IREAD | S_IWRITE);
-  if (fh == -1) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Unable to open %s file for write.\n", STATE_FILE);
-    status = TPM_IOERROR;
-    goto abort_egress;
-  }
-
-  if ( ( write(fh, flat_boot_key, boot_key_size) != boot_key_size ) ||
-       ( write(fh, flat_enc, sizeof(UINT32)) != sizeof(UINT32) ) ||
-       ( write(fh, enc_flat_global.bytes, buffer_len(&enc_flat_global)) != buffer_len(&enc_flat_global) ) ||
-       ( write(fh, flat_dmis, flat_dmis_size) != flat_dmis_size ) ) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Failed to completely write service data.\n");
-    status = TPM_IOERROR;
-    goto abort_egress;
- }
-
-  goto egress;
-
- abort_egress:
- egress:
-
-  free(flat_boot_key);
-  free(flat_enc);
-  buffer_free(&enc_flat_global);
-  free(flat_dmis);
-  close(fh);
-
-  vtpmloginfo(VTPM_LOG_VTPM, "Saved VTPM Manager state (status = %d, dmis = %d)\n", (int) status, dmis);
-  return status;
-}
-
-TPM_RESULT VTPM_LoadManagerData(void) {
-
-  TPM_RESULT status=TPM_SUCCESS;
-  int fh, stat_ret, dmis=0;
-  long fh_size = 0, step_size;
-  BYTE *flat_table=NULL;
-  buffer_t  unsealed_data, enc_table_abuf;
-  struct pack_buf_t storage_key_pack, boot_key_pack;
-  UINT32 *dmi_id_key, enc_size;
-  BYTE vtpm_manager_gen;
-
-  VTPM_DMI_RESOURCE *dmi_res;
-  UINT32 dmi_id;
-  BYTE dmi_type;
-  struct stat file_stat;
-
-  TPM_HANDLE boot_key_handle;
-  TPM_AUTHDATA boot_usage_auth;
-  memset(&boot_usage_auth, 0, sizeof(TPM_AUTHDATA));
-
-  fh = open(STATE_FILE, O_RDONLY );
-  stat_ret = fstat(fh, &file_stat);
-  if (stat_ret == 0)
-    fh_size = file_stat.st_size;
-  else {
-    status = TPM_IOERROR;
-    goto abort_egress;
-  }
-
-  flat_table = (BYTE *) malloc(fh_size);
-
-  if ((long) read(fh, flat_table, fh_size) != fh_size ) {
-    status = TPM_IOERROR;
-    goto abort_egress;
-  }
-
-  // Read Boot Key
-  step_size = BSG_UnpackList( flat_table, 2,
-                              BSG_TPM_SIZE32_DATA, &boot_key_pack,
-                              BSG_TYPE_UINT32, &enc_size);
-
-  TPMTRYRETURN(buffer_init(&vtpm_globals->bootKeyWrap, 0, 0) );
-  TPMTRYRETURN(buffer_init_alias_convert(&enc_table_abuf, enc_size, flat_table + step_size) );
-  TPMTRYRETURN(buffer_append_raw(&vtpm_globals->bootKeyWrap, boot_key_pack.size, boot_key_pack.data) );
-
-  //Load Boot Key
-  TPMTRYRETURN( VTSP_LoadKey( vtpm_globals->manager_tcs_handle,
-                              TPM_SRK_KEYHANDLE,
-                              &vtpm_globals->bootKeyWrap,
-                              &SRK_AUTH,
-                              &boot_key_handle,
-                              &vtpm_globals->keyAuth,
-                              &vtpm_globals->bootKey,
-                              FALSE) );
-
-  TPMTRYRETURN( envelope_decrypt(&enc_table_abuf,
-                                 vtpm_globals->manager_tcs_handle,
-                                 boot_key_handle,
-                                 (const TPM_AUTHDATA*) &boot_usage_auth,
-                                 &unsealed_data) );
-  step_size += enc_size;
-
-  if (*unsealed_data.bytes != VTPM_MANAGER_GEN) {
-      // Once there is more than one gen, this will include some compatability stuff
-      vtpmlogerror(VTPM_LOG_VTPM, "Warning: Manager Data file is gen %d, which this manager is gen %d.\n", vtpm_manager_gen, VTPM_MANAGER_GEN);
-  }
-
-  // Global Values needing to be saved
-  BSG_UnpackList( unsealed_data.bytes, 4,
-                  BSG_TYPE_BYTE,    &vtpm_manager_gen, 
-                  BSG_TPM_AUTHDATA, &vtpm_globals->owner_usage_auth,
-                  BSG_TPM_SECRET,   &vtpm_globals->storage_key_usage_auth,
-                  BSG_TPM_SIZE32_DATA, &storage_key_pack);
-
-  TPMTRYRETURN(buffer_init(&vtpm_globals->storageKeyWrap, 0, 0) );
-  TPMTRYRETURN(buffer_append_raw(&vtpm_globals->storageKeyWrap, storage_key_pack.size, storage_key_pack.data) );
-
-  // Per DMI values to be saved
-  while ( step_size < fh_size ){
-    if (fh_size - step_size < (long) (sizeof(UINT32) + sizeof(BYTE) + 2*sizeof(TPM_DIGEST))) {
-      vtpmlogerror(VTPM_LOG_VTPM, "Encountered %ld extra bytes at end of manager state.\n", fh_size-step_size);
-      step_size = fh_size;
-    } else {
-      step_size += BSG_UnpackList(flat_table + step_size, 2,
-                                 BSG_TYPE_UINT32, &dmi_id,
-                                 BSG_TYPE_BYTE, &dmi_type);
-
-      //TODO: Try and gracefully recover from problems.
-      TPMTRYRETURN(init_dmi(dmi_id, dmi_type, &dmi_res) );
-      dmis++;
-
-      step_size += BSG_UnpackList(flat_table + step_size, 2,
-                                 BSG_TPM_DIGEST, &dmi_res->NVM_measurement,
-                                 BSG_TPM_DIGEST, &dmi_res->DMI_measurement);
-    }
-
-  }
-
-  vtpmloginfo(VTPM_LOG_VTPM, "Loaded saved state (dmis = %d).\n", dmis);
-  goto egress;
-
- abort_egress:
-  vtpmlogerror(VTPM_LOG_VTPM, "Failed to load service data with error = %s\n", tpm_get_error_name(status));
- egress:
-
-  free(flat_table);
-  close(fh);
-
-  // TODO: Could be nice and evict BootKey. (Need to add EvictKey to VTSP.
-
-  return status;
-}
-
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/tpmpassthrough.c
--- a/tools/vtpm_manager/manager/tpmpassthrough.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// tpmpassthrough.c
-// 
-//  Functions regarding passing DMI requests to HWTPM
-//
-// ==================================================================
-
-#include "tcg.h"
-#include "vtpm_manager.h"
-#include "vtpmpriv.h"
-#include "vtsp.h"
-#include "log.h"
-
-TPM_RESULT VTPM_Handle_TPM_Command( VTPM_DMI_RESOURCE *dmi,
-				    buffer_t *inbuf,  
-				    buffer_t *outbuf) {
-  
-  TPM_RESULT status = TPM_SUCCESS;
-  TPM_COMMAND_CODE *ord;               
-  
-  ord = (TPM_COMMAND_CODE *) (inbuf->bytes + sizeof(TPM_TAG) + sizeof(UINT32));
-  
-  switch (*ord) {
-    
-    // Forbidden for DMI use
-  case TPM_ORD_TakeOwnership:
-  case TPM_ORD_ChangeAuthOwner:
-  case TPM_ORD_DirWriteAuth:
-  case TPM_ORD_DirRead:
-  case TPM_ORD_AuthorizeMigrationKey:
-  case TPM_ORD_CreateMaintenanceArchive:
-  case TPM_ORD_LoadMaintenanceArchive:
-  case TPM_ORD_KillMaintenanceFeature:
-  case TPM_ORD_LoadManuMaintPub:
-  case TPM_ORD_ReadManuMaintPub:
-  case TPM_ORD_SelfTestFull:
-  case TPM_ORD_SelfTestStartup:
-  case TPM_ORD_CertifySelfTest:
-  case TPM_ORD_ContinueSelfTest:
-  case TPM_ORD_GetTestResult:
-  case TPM_ORD_Reset:
-  case TPM_ORD_OwnerClear:
-  case TPM_ORD_DisableOwnerClear:
-  case TPM_ORD_ForceClear:
-  case TPM_ORD_DisableForceClear:
-  case TPM_ORD_GetCapabilityOwner:
-  case TPM_ORD_OwnerSetDisable:
-  case TPM_ORD_PhysicalEnable:
-  case TPM_ORD_PhysicalDisable:
-  case TPM_ORD_SetOwnerInstall:
-  case TPM_ORD_PhysicalSetDeactivated:
-  case TPM_ORD_SetTempDeactivated:
-  case TPM_ORD_CreateEndorsementKeyPair:
-  case TPM_ORD_GetAuditEvent:
-  case TPM_ORD_GetAuditEventSigned:
-  case TPM_ORD_GetOrdinalAuditStatus:
-  case TPM_ORD_SetOrdinalAuditStatus:
-  case TPM_ORD_SetRedirection:
-  case TPM_ORD_FieldUpgrade:
-  case TSC_ORD_PhysicalPresence:
-    status = TPM_DISABLED_CMD;
-    goto abort_egress;
-    break;
-    
-  } // End ORD Switch
-  
-  // Call TCS with command
-  
-  TPMTRY(TPM_IOERROR, VTSP_RawTransmit( dmi->TCSContext,inbuf, outbuf) );
-  
-  goto egress;
-  
- abort_egress:
-  vtpmloginfo(VTPM_LOG_VTPM, "TPM Command Failed in tpmpassthrough.\n");
- egress:
-  
-  return status;
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/vtpm_ipc.c
--- a/tools/vtpm_manager/manager/vtpm_ipc.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-//
-// vtpm_ipc.c Implements ipc routines using file io. This file can
-// be replaced with other ipc types.
-//
-// ===================================================================
-
-#include <sys/stat.h>
-#include "vtpm_ipc.h"
-#include "vtpmpriv.h"
-#include "log.h"
-
-int vtpm_ipc_init(vtpm_ipc_handle_t *ipc_h, char* name, int flags, BOOL create) {
-  ipc_h->name = name;
-  ipc_h->flags = flags;
-  ipc_h->fh = VTPM_IPC_CLOSED;
-
-  if (create)
-    return(vtpm_ipc_create(ipc_h));
-  else
-    return 0;
-}
-
-// Create the file that needs opening. Used only for FIFOs
-// FYI: This may cause problems in other file IO schemes. We'll see.
-int vtpm_ipc_create(vtpm_ipc_handle_t *ipc_h) {
-  int fh;
-  struct stat file_info;
-
-  if ((!ipc_h) || (!ipc_h->name))
-    return -1;
-
-  if ( stat(ipc_h->name, &file_info) == -1) {
-    if ( mkfifo(ipc_h->name, S_IWUSR | S_IRUSR ) ) {
-      vtpmlogerror(VTPM_LOG_VTPM, "Failed to create fifo %s.\n", ipc_h->name);
-      return -1;
-    }
-  }
-
-  ipc_h->fh = VTPM_IPC_CLOSED;
-
-  return 0;
-}
-
-
-// Read size bytes. If FH isn't open, open it.
-int vtpm_ipc_read(vtpm_ipc_handle_t *ipc_h, vtpm_ipc_handle_t *alt_ipc_h, BYTE *bytes, UINT32 size){
-  vtpm_ipc_handle_t *my_ipc_h;
-  int result;
-  
-  if (ipc_h) {
-    my_ipc_h = ipc_h;
-  } else {
-    my_ipc_h = alt_ipc_h;
-  }
-  
-  if (my_ipc_h->fh == VTPM_IPC_CLOSED) {   
-    my_ipc_h->fh = open(my_ipc_h->name, my_ipc_h->flags);
-  }
-
-  if ( my_ipc_h->fh == VTPM_IPC_CLOSED ) {
-    vtpmlogerror(VTPM_LOG_VTPM, "VTPM ERROR: Can't open %s for reading.\n", my_ipc_h->name);
-    return -1;
-  }
-
-  result = read(my_ipc_h->fh, bytes, size);
-  if (result < 0) {
-    my_ipc_h->fh = VTPM_IPC_CLOSED;
-  }
-
-  return (result);
-}
-
-// Write size bytes. If FH isn't open, open it.
-int vtpm_ipc_write(vtpm_ipc_handle_t *ipc_h, vtpm_ipc_handle_t *alt_ipc_h, BYTE *bytes, UINT32 size) {
-  vtpm_ipc_handle_t *my_ipc_h;
-  int result;
-
-  if (ipc_h) {
-    my_ipc_h = ipc_h;
-  } else {
-    my_ipc_h = alt_ipc_h;
-  }
-
-  if (my_ipc_h->fh == VTPM_IPC_CLOSED) {
-    my_ipc_h->fh = open(my_ipc_h->name, my_ipc_h->flags);
-  }
-
-  if ( my_ipc_h->fh == VTPM_IPC_CLOSED ) {
-    vtpmlogerror(VTPM_LOG_VTPM, "VTPM ERROR: Can't open %s for writing.\n", my_ipc_h->name);
-    return -1;
-  }
-
-  result = write(my_ipc_h->fh, bytes, size);
-  if (result < 0) {
-    my_ipc_h->fh = VTPM_IPC_CLOSED;
-  }
-
-  return (result);
-}
-
-// Mark file as closed and try and close it. Errors not reported.
-void vtpm_ipc_close(vtpm_ipc_handle_t *ipc_h) {
-
-  if (ipc_h) {
-    close(ipc_h->fh);
-    ipc_h->fh = VTPM_IPC_CLOSED;
-  }
-
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/vtpm_ipc.h
--- a/tools/vtpm_manager/manager/vtpm_ipc.h	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-// ===================================================================
-//
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-//
-// vtpm_ipc.h Header for interprocess communication between VTPM manager
-// and Guests or VTPMs
-//
-// ===================================================================
-
-#ifndef __VTPM_IO_H__
-#define __VTPM_IO_H__
-
-#include "tcg.h"
-
-#define VTPM_IPC_CLOSED -1
-
-// Represents an (somewhat) abstracted io handle.
-typedef struct vtpm_ipc_handle_t {
-  int fh;              // IO handle.
-  int flags;           // Flags for opening. This may need to become
-                       // a void *, but for now files use an int.
-  char *name;          // Names for debugging as well as filenames
-                       // for file-based io.
-} vtpm_ipc_handle_t;
-
-
-int vtpm_ipc_init(vtpm_ipc_handle_t *ioh, char* name, int flags, BOOL create);
-
-// Create the file that needs opening. Used only for FIFOs
-// FYI: This may cause problems in other file IO schemes. We'll see.
-int vtpm_ipc_create(vtpm_ipc_handle_t *ioh);
-
-// Read size bytes. If FH isn't open, open it.
-int vtpm_ipc_read(vtpm_ipc_handle_t *ioh, vtpm_ipc_handle_t *alt_ioh, BYTE *bytes, UINT32 size);
-
-// Write size bytes. If FH isn't open, open it.
-int vtpm_ipc_write(vtpm_ipc_handle_t *ioh, vtpm_ipc_handle_t *alt_ioh, BYTE *bytes, UINT32 size);
-
-// Mark file as closed and try and close it. Errors not reported.
-void vtpm_ipc_close(vtpm_ipc_handle_t *ioh);
-
-#endif
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/vtpm_lock.c
--- a/tools/vtpm_manager/manager/vtpm_lock.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-// ===================================================================
-//
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-//
-// vtpm_lock.c Provided controlled sync around access to vtpm structures
-//
-// ===================================================================
-
-#include <pthread.h>
-#include "vtpm_lock.h"
-
-static pthread_rwlock_t vtpm_lock;
-
-void vtpm_lock_init() {
-
-  pthread_rwlock_init( &vtpm_lock, NULL);
-}
-
-void vtpm_lock_destroy(){
-  pthread_rwlock_destroy(&vtpm_lock);
-}
-
-void vtpm_lock_rdlock(){
-  pthread_rwlock_rdlock(&vtpm_lock);
-}
-
-void vtpm_lock_wrlock(){
-  pthread_rwlock_wrlock(&vtpm_lock);
-}
-
-void vtpm_lock_unlock(){
-  pthread_rwlock_unlock(&vtpm_lock);
-}
-
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/vtpm_lock.h
--- a/tools/vtpm_manager/manager/vtpm_lock.h	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-// ===================================================================
-//
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-//
-// vtpm_lock.h Provided controlled sync around access to vtpm structures
-//
-// ===================================================================
-
-#ifndef __VTPM_LOCK_H__
-#define __VTPM_LOCK_H__
-
-void vtpm_lock_init();
-void vtpm_lock_destroy();
-
-void vtpm_lock_rdlock();
-void vtpm_lock_wrlock();
-void vtpm_lock_unlock();
-
-#endif
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/vtpm_manager.c
--- a/tools/vtpm_manager/manager/vtpm_manager.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,285 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// vtpm_manager.c
-// 
-//  This file will house the main logic of the VTPM Manager
-//
-// ==================================================================
-
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "vtpm_manager.h"
-#include "vtpmpriv.h"
-#include "vtsp.h"
-#include "bsg.h"
-#include "hashtable.h"
-#include "hashtable_itr.h"
-
-#include "log.h"
-#include "buffer.h"
-
-VTPM_GLOBALS *vtpm_globals=NULL;
-
-// --------------------------- Well Known Auths --------------------------
-const TPM_AUTHDATA SRK_AUTH = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-                                  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-
-#ifdef WELL_KNOWN_OWNER_AUTH
-static BYTE FIXED_OWNER_AUTH[20] =  {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-                                  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-#endif
-
-
-// -------------------------- Hash table functions --------------------
-
-static unsigned int hashfunc32(void *ky) {
-  return (* (UINT32 *) ky);
-}
-
-static int equals32(void *k1, void *k2) {
-  return (*(UINT32 *) k1 == *(UINT32 *) k2);
-}
-
-// --------------------------- Functions ------------------------------
-
-TPM_RESULT VTPM_Create_Manager(){
-  
-  TPM_RESULT status = TPM_SUCCESS;
-  
-  // Generate Auth for Owner
-#ifdef WELL_KNOWN_OWNER_AUTH 
-  memcpy(vtpm_globals->owner_usage_auth, FIXED_OWNER_AUTH, sizeof(TPM_AUTHDATA));
-#else    
-  Crypto_GetRandom(vtpm_globals->owner_usage_auth, sizeof(TPM_AUTHDATA) );
-#endif
-
-  // Take Owership of TPM
-  CRYPTO_INFO ek_cryptoInfo;
-  
-  status = VTSP_ReadPubek(vtpm_globals->manager_tcs_handle, &ek_cryptoInfo);
-  
-  // If we can read PubEK then there is no owner and we should take it.
-  // We use the abilty to read the pubEK to flag that the TPM is owned.
-  // FIXME: Change to just trying to take ownership and react to the status
-  if (status == TPM_SUCCESS) { 
-    TPMTRYRETURN(VTSP_TakeOwnership(vtpm_globals->manager_tcs_handle,
-				    (const TPM_AUTHDATA*)&vtpm_globals->owner_usage_auth, 
-				    &SRK_AUTH,
-				    &ek_cryptoInfo,
-				    &vtpm_globals->keyAuth)); 
-  
-    TPMTRYRETURN(VTSP_DisablePubekRead(vtpm_globals->manager_tcs_handle,
-                                       (const TPM_AUTHDATA*)&vtpm_globals->owner_usage_auth,  
-                                       &vtpm_globals->keyAuth));     
-  } else {
-    vtpmloginfo(VTPM_LOG_VTPM, "Failed to readEK meaning TPM has an owner. Creating Keys off existing SRK.\n");
-  }
-  
-  // Generate storage key's auth
-  Crypto_GetRandom(  &vtpm_globals->storage_key_usage_auth, 
-		     sizeof(TPM_AUTHDATA) );
-  
-  TCS_AUTH osap;
-  TPM_AUTHDATA sharedsecret;
-  
-  TPMTRYRETURN( VTSP_OSAP(vtpm_globals->manager_tcs_handle,
-			  TPM_ET_KEYHANDLE,
-			  TPM_SRK_KEYHANDLE, 
-			  &SRK_AUTH,
-			  &sharedsecret, 
-			  &osap) ); 
-
-  osap.fContinueAuthSession = FALSE;
- 
- 
-  TPMTRYRETURN( VTSP_CreateWrapKey( vtpm_globals->manager_tcs_handle,
-				    TPM_KEY_BIND,
-				    (const TPM_AUTHDATA*)&vtpm_globals->storage_key_usage_auth,
-				    TPM_SRK_KEYHANDLE, 
-				    (const TPM_AUTHDATA*)&sharedsecret,
-				    &vtpm_globals->storageKeyWrap,
-				    &osap) );
-  
-  // Generate boot key's auth
-  TPM_AUTHDATA bootKeyWrapAuth;
-  memset(&bootKeyWrapAuth, 0, sizeof(bootKeyWrapAuth));
-  
-  TPMTRYRETURN( VTSP_OSAP(vtpm_globals->manager_tcs_handle,
-			  TPM_ET_KEYHANDLE,
-			  TPM_SRK_KEYHANDLE, 
-			  &SRK_AUTH,
-			  &sharedsecret, 
-			  &osap) ); 
-
-  osap.fContinueAuthSession = FALSE;
- 
-  // FIXME: This key protects the global secrets on disk. It should use TPM
-  //        PCR bindings to limit its use to legit configurations.
-  //        Current binds are open, implying a Trusted VM contains this code.
-  //        If this VM is not Trusted, use measurement and PCR bindings.
-  TPMTRYRETURN( VTSP_CreateWrapKey( vtpm_globals->manager_tcs_handle,
-				    TPM_KEY_BIND,
-				    (const TPM_AUTHDATA*)&bootKeyWrapAuth,
-				    TPM_SRK_KEYHANDLE, 
-				    (const TPM_AUTHDATA*)&sharedsecret,
-				    &vtpm_globals->bootKeyWrap,
-				    &osap) );
-
-  // Populate CRYPTO_INFO vtpm_globals->bootKey. This does not load it into the TPM
-  TPMTRYRETURN( VTSP_LoadKey( vtpm_globals->manager_tcs_handle,
-                              TPM_SRK_KEYHANDLE,
-                              &vtpm_globals->bootKeyWrap,
-                              NULL,
-                              NULL,
-                              NULL,
-                              &vtpm_globals->bootKey,
-                              TRUE ) );
-
-  TPMTRYRETURN( VTSP_SaveState(vtpm_globals->manager_tcs_handle) );
-  goto egress;
-  
- abort_egress:
-  exit(1);
-  
- egress:
-  vtpmloginfo(VTPM_LOG_VTPM, "Finished initialized new VTPM manager (Status = %d).\n", status);
-  return status;
-  
-}
-
-///////////////////////////////////////////////////////////////////////////////
-TPM_RESULT VTPM_Init_Manager() {
-  TPM_RESULT status = TPM_FAIL, serviceStatus;   
-  BYTE *randomsead;
-  UINT32 randomsize=256;
-
-  if ((vtpm_globals = (VTPM_GLOBALS *) malloc(sizeof(VTPM_GLOBALS))) == NULL){
-    status = TPM_FAIL;
-    goto abort_egress;
-  }
-  memset(vtpm_globals, 0, sizeof(VTPM_GLOBALS));
-
-  vtpm_globals->connected_dmis = 0;
-
-  if ((vtpm_globals->dmi_map = create_hashtable(10, hashfunc32, equals32)) == NULL){
-    status = TPM_FAIL;
-    goto abort_egress;
-  }
-  
-  // Create new TCS Object
-  vtpm_globals->manager_tcs_handle = 0;
- 
-  TPMTRYRETURN(TCS_create());
-  
-  // Create TCS Context for service
-  TPMTRYRETURN( TCS_OpenContext(&vtpm_globals->manager_tcs_handle ) );
-
-  TPMTRYRETURN( TCSP_GetRandom(vtpm_globals->manager_tcs_handle, 
-			       &randomsize, 
-			       &randomsead));
-  
-  Crypto_Init(randomsead, randomsize);
-  TPMTRYRETURN( TCS_FreeMemory (vtpm_globals->manager_tcs_handle, randomsead)); 
-	
-  // Create OIAP session for service's authorized commands
-  TPMTRYRETURN( VTSP_OIAP( vtpm_globals->manager_tcs_handle, 
-			   &vtpm_globals->keyAuth) );
-  vtpm_globals->keyAuth.fContinueAuthSession = TRUE;
-
-  vtpm_globals->mig_keys = NULL;
-
-  // If fails, create new Manager.
-  serviceStatus = VTPM_LoadManagerData();
-  if (serviceStatus == TPM_IOERROR) {
-    vtpmloginfo(VTPM_LOG_VTPM, "Failed to read manager file. Assuming first time initialization.\n");
-    TPMTRYRETURN( VTPM_Create_Manager() );    
-    TPMTRYRETURN( VTPM_SaveManagerData() );
-  } else if (serviceStatus != TPM_SUCCESS) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Failed to read existing manager file");
-    exit(1);
-  }
-
-  //Load Storage Key 
-  TPMTRYRETURN( VTSP_LoadKey( vtpm_globals->manager_tcs_handle,
-			      TPM_SRK_KEYHANDLE,
-			      &vtpm_globals->storageKeyWrap,
-			      &SRK_AUTH,
-			      &vtpm_globals->storageKeyHandle,
-			      &vtpm_globals->keyAuth,
-			      &vtpm_globals->storageKey,
-                              FALSE ) );
-
-  // Create entry for Dom0 for control messages
-  TPMTRYRETURN( VTPM_Handle_New_DMI(NULL) );
-  
-  goto egress;
-  
- abort_egress:
- egress:
-  
-  return(status);
-}
-
-/////////////////////////////////////////////////////////////////////////////// 
-void VTPM_Stop_Manager() {
-  VTPM_DMI_RESOURCE *dmi_res;
-  struct hashtable_itr *dmi_itr;
-  
-  // Close all the TCS contexts. TCS should evict keys based on this
-  if (hashtable_count(vtpm_globals->dmi_map) > 0) {
-    dmi_itr = hashtable_iterator(vtpm_globals->dmi_map);
-    do {
-      dmi_res = (VTPM_DMI_RESOURCE *) hashtable_iterator_value(dmi_itr);
-      if (dmi_res->connected) 
-	close_dmi( dmi_res ); // Not really interested in return code
-      
-    } while (hashtable_iterator_advance(dmi_itr));
-		free (dmi_itr);
-  }
-  
-  if ( VTPM_SaveManagerData() != TPM_SUCCESS ) 
-    vtpmlogerror(VTPM_LOG_VTPM, "Unable to save manager data.\n");
-
-  TCS_CloseContext(vtpm_globals->manager_tcs_handle);
-  TCS_destroy();
-  
-  hashtable_destroy(vtpm_globals->dmi_map, 1);
-  free(vtpm_globals);
-  
-  Crypto_Exit();
-	
-  vtpmloginfo(VTPM_LOG_VTPM, "VTPM Manager stopped.\n");
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/vtpm_manager.h
--- a/tools/vtpm_manager/manager/vtpm_manager.h	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// vtpm_manager.h
-// 
-//  Public Interface header for VTPM Manager
-//
-// ==================================================================
-
-#ifndef __VTPM_MANAGER_H__
-#define __VTPM_MANAGER_H__
-
-#define VTPM_TAG_REQ 0x01c1
-#define VTPM_TAG_RSP 0x01c4
-#define COMMAND_BUFFER_SIZE 4096
-
-// Header sizes. Note Header MAY include the DMI
-#define VTPM_COMMAND_HEADER_SIZE_CLT ( 2 + 4 + 4)
-//                    sizeof(TPM_TAG + UINT32 + TPM_COMMAND_CODE)
-#define VTPM_COMMAND_HEADER_SIZE_SRV ( 4 + VTPM_COMMAND_HEADER_SIZE_CLT )
-//                    sizeof( UINT32 + VTPM_COMMAND_HEADER_SIZE_CLT)
-
-//************************ Command Codes ****************************
-#define VTPM_ORD_BASE       0x0000
-#define VTPM_PRIV_MASK      0x01000000 // Priviledged VTPM Command
-#define VTPM_PRIV_BASE      (VTPM_ORD_BASE | VTPM_PRIV_MASK)
-
-// Non-priviledged VTPM Commands (From DMI's)
-#define VTPM_ORD_SAVENVM      (VTPM_ORD_BASE + 1) // DMI Saves Secrets
-#define VTPM_ORD_LOADNVM      (VTPM_ORD_BASE + 2) // DMI Loads Secrets
-#define VTPM_ORD_TPMCOMMAND   (VTPM_ORD_BASE + 3) // DMI issues HW TPM Command
-#define VTPM_ORD_GET_MIG_KEY  (VTPM_ORD_BASE + 4) // Get manager's migration key
-#define VTPM_ORD_LOAD_MIG_KEY (VTPM_ORD_BASE + 5) // load dest migration key 
-
-// Priviledged VTPM Commands (From management console)
-#define VTPM_ORD_OPEN         (VTPM_PRIV_BASE + 1) // Creates/reopens DMI
-#define VTPM_ORD_CLOSE        (VTPM_PRIV_BASE + 2) // Closes a DMI
-#define VTPM_ORD_DELETE       (VTPM_PRIV_BASE + 3) // Permemently Deletes DMI
-#define VTPM_ORD_MIGRATE_IN   (VTPM_PRIV_BASE + 4) // Load migrated VTPM
-#define VTPM_ORD_MIGRATE_OUT  (VTPM_PRIV_BASE + 5) // migrate VTPM to dest 
-
-//************************ Return Codes ****************************
-#define VTPM_TYPE_PVM 1 // Paravirtualized Domain
-#define VTPM_TYPE_HVM 2 // HVM Domain
-
-//************************ Return Codes ****************************
-#define VTPM_SUCCESS               0
-#define VTPM_FAIL                  1
-#define VTPM_UNSUPPORTED           2
-#define VTPM_FORBIDDEN             3
-#define VTPM_RESTORE_CONTEXT_FAILED    4
-#define VTPM_INVALID_REQUEST       5
-
-//*********************** Parameter Values *************************
-#define VTPM_TYPE_NON_MIGRATABLE  0x00
-#define VTPM_TYPE_MIGRATABLE      0x01
-#define VTPM_TYPE_MIGRATED        0xFF // VTPM has been migrated.
-                                       // VTPM can be recovered or deleted only
-
-/******************* Command Parameter API *************************
-
-VTPM Command Format
-  dmi: 4 bytes                  // Source of message. 
-                                // WARNING: This is prepended by the channel. 
-                                // Thus it is received by VTPM Manager, 
-                                // but not sent by DMI
-  tpm tag: 2 bytes
-  command size: 4 bytes         // Size of command including header but not DMI
-  ord: 4 bytes                  // Command ordinal above
-  parameters: size - 10 bytes   // Command Parameter
-
-VTPM Response Format
-  tpm tag: 2 bytes
-  response_size: 4 bytes
-  status: 4 bytes         
-  parameters: size - 10 bytes
-
-
-VTPM_Open:
-  Input Parameters:
-    mig_type: 1 byte 
-    startup_mode: 1 byte // Cold Boot = 1, resume = 2, deactive = 3
-    domain type: 1 byte
-    instance_id: 4 bytes
-  Output Parameters:
-    None
-    
-VTPM_Close
-  Input Parameters:
-    instance_id: 4 bytes
-  Output Parameters:
-    None
-
-VTPM_Delete
-  Input Parameters:
-    instance_id: 4 bytes
-  Output Parameters:
-    None
-
-VTPM_SaveNVM
-  Input Parameters:
-    data: n bytes (Header indicates size of data)
-  Output Parameters:
-    None
-
-VTPM_LoadNVM
-  Input Parameters:
-    None
-  Output Parameters:
-    data: n bytes (Header indicates size of data)
-
-VTPM_TPMCommand
-  Input Parameters:
-    TPM Command Byte Stream: n bytes 
-  Output Parameters:
-    TPM Reponse Byte Stream: n bytes 
-
-*********************************************************************/
-
-#endif //_VTPM_MANAGER_H_
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/vtpm_manager_handler.c
--- a/tools/vtpm_manager/manager/vtpm_manager_handler.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,488 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// vtpm_manager_handler.c
-// 
-//  This file will house the main logic of the VTPM Manager
-//
-// ==================================================================
-
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-
-#include "vtpm_manager.h"
-#include "vtpmpriv.h"
-#include "vtsp.h"
-#include "bsg.h"
-#include "hashtable.h"
-#include "hashtable_itr.h"
-#include "log.h"
-#include "buffer.h"
-
-#define vtpmhandlerloginfo(module,fmt,args...) vtpmloginfo (module, "[%s]: " fmt, thread_name, ##args );
-#define vtpmhandlerloginfomore(module,fmt,args...) vtpmloginfomore (module, fmt, ##args );
-#define vtpmhandlerlogerror(module,fmt,args...) vtpmlogerror (module, "[%s]: " fmt, thread_name, ##args );
-
-// ---------------------- Prototypes -------------------
-TPM_RESULT vtpm_manager_handle_vtpm_cmd(VTPM_DMI_RESOURCE *dmi_res,
-					TPM_COMMAND_CODE ord,
-					buffer_t *command_buf,
-					buffer_t *result_buf,
-                                        BOOL is_priv,
-                                        char *thread_name);
-
-TPM_RESULT vtpm_manager_handle_tpm_cmd(vtpm_ipc_handle_t *tx_ipc_h,
-                                       vtpm_ipc_handle_t *rx_ipc_h,
-                                       VTPM_DMI_RESOURCE *dmi_res,
-                                       BYTE *cmd_header,
-                                       buffer_t *param_buf,
-                                       buffer_t *result_buf,
-                                       char *thread_name);
-
-TPM_RESULT VTPM_Manager_Handler( vtpm_ipc_handle_t *tx_ipc_h, 
-                                 vtpm_ipc_handle_t *rx_ipc_h,
-                                 BOOL fw_tpm,   // Forward TPM cmds?
-                                 vtpm_ipc_handle_t *fw_tx_ipc_h, 
-                                 vtpm_ipc_handle_t *fw_rx_ipc_h,
-                                 BOOL is_priv,
-                                 char *thread_name) {
-  TPM_RESULT      status =  TPM_FAIL; // Should never return
-  UINT32          dmi, in_param_size, cmd_size, out_param_size, out_message_size, reply_size;
-  BYTE            *cmd_header=NULL, *in_param=NULL, *out_message=NULL, *reply;
-  buffer_t        *command_buf=NULL, *result_buf=NULL;
-  TPM_TAG         tag;
-  TPM_COMMAND_CODE ord;
-  VTPM_DMI_RESOURCE *dmi_res;
-  int  size_read, size_write, i;
-  BOOL add_header=TRUE; // This indicates to prepend a header on result_buf before sending
-  
-  cmd_header = (BYTE *) malloc(VTPM_COMMAND_HEADER_SIZE_SRV);
-  command_buf = (buffer_t *) malloc(sizeof(buffer_t));
-  result_buf = (buffer_t *) malloc(sizeof(buffer_t));
- 
-  // ------------------------ Main Loop --------------------------------
-  while(1) {
-    
-    vtpmhandlerloginfo(VTPM_LOG_VTPM, "%s waiting for messages.\n", thread_name);
-
-    // --------------------- Read Cmd from Sender ----------------
-    
-    // Read command header 
-    size_read = vtpm_ipc_read(rx_ipc_h, NULL, cmd_header, VTPM_COMMAND_HEADER_SIZE_SRV);
-    if (size_read > 0) {
-      vtpmhandlerloginfo(VTPM_LOG_VTPM_DEEP, "RECV[%d]: 0x", size_read);
-      for (i=0; i<size_read; i++) 
-	vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", cmd_header[i]);
-    } else {
-      vtpmhandlerlogerror(VTPM_LOG_VTPM, "%s can't read from ipc. Errono = %d. Aborting... \n", thread_name, errno);
-      goto abort_command;
-    }
-
-    if (size_read < (int) VTPM_COMMAND_HEADER_SIZE_SRV) {
-      vtpmhandlerloginfo(VTPM_LOG_VTPM_DEEP, "\n");
-      vtpmhandlerlogerror(VTPM_LOG_VTPM, "Command shorter than normal header (%d bytes). Aborting...\n", size_read);
-      goto abort_command;
-    }
-    
-    // Unpack header
-    BSG_UnpackList(cmd_header, 4,
-    		   BSG_TYPE_UINT32, &dmi,
-    		   BSG_TPM_TAG, &tag,
-    		   BSG_TYPE_UINT32, &in_param_size,
-    		   BSG_TPM_COMMAND_CODE, &ord );
-    
-    // Using the header info, read the parameters of the command
-    // Note that in_param_size is in the client's context
-    cmd_size = in_param_size - VTPM_COMMAND_HEADER_SIZE_CLT;
-    if (cmd_size > 0) {
-      in_param = (BYTE *) malloc(cmd_size);
-      size_read = vtpm_ipc_read( rx_ipc_h, NULL, in_param, cmd_size);
-      if (size_read > 0) {
-	for (i=0; i<size_read; i++) 
-	  vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", in_param[i]);
-	
-      } else {
-        vtpmhandlerlogerror(VTPM_LOG_VTPM, "%s had error reading cmd from ipc. Aborting... \n", thread_name);
-	goto abort_command;
-      }
-      vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-      
-      if (size_read < (int) cmd_size) {
-	vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-	vtpmhandlerlogerror(VTPM_LOG_VTPM, "Command read(%d) is shorter than header indicates(%d). Aborting...\n", size_read, cmd_size);
-	goto abort_command;
-      }
-    } else {
-      in_param = NULL;
-      vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-    }
-
-    // Init the buffers used to handle the command and the response
-    if ( (buffer_init_convert(command_buf, cmd_size, in_param) != TPM_SUCCESS) || 
-	 (buffer_init(result_buf, 0, 0) != TPM_SUCCESS) ) {
-      vtpmhandlerlogerror(VTPM_LOG_VTPM, "Failed to setup buffers. Aborting...\n");
-      goto abort_command;
-    }
-    
-    // -------------- Dispatch Commands to Handlers -----------
-    if ((tag == VTPM_TAG_REQ) && (ord & VTPM_PRIV_MASK)) {
-      vtpm_lock_wrlock();
-    } else {
-      vtpm_lock_rdlock();
-    }
-
-    if ( !(dmi_res = (VTPM_DMI_RESOURCE *) hashtable_search(vtpm_globals->dmi_map, &dmi)) ||
-         (!dmi_res->connected) ) {
-      vtpmhandlerlogerror(VTPM_LOG_VTPM, "Attempted access to non-existent or disconnected DMI %d. Aborting...\n", dmi);
-      status = TPM_BAD_PARAMETER;
-      // We have no one to reply to, they don't exist.
-      goto abort_command;
-    }
-
-    if (tag == VTPM_TAG_REQ) { 
-    
-      status = vtpm_manager_handle_vtpm_cmd(dmi_res, ord, command_buf, result_buf, is_priv, thread_name);
-
-    } else { // This is not a VTPM Command at all.
-      if (fw_tpm) { 
-        status = vtpm_manager_handle_tpm_cmd(fw_tx_ipc_h, fw_rx_ipc_h, dmi_res, cmd_header, command_buf, result_buf, thread_name);
-
-        // This means calling the DMI failed, not that the cmd failed in the DMI
-        // Since the return will be interpretted by a TPM app, all errors are IO_ERRORs to the app
-        if (status != TPM_SUCCESS) { 
-          status = TPM_IOERROR;
-	  goto abort_with_error;
-        }
-        // Unlike all other commands, forwarded commands yield a result_buf that includes the DMI's status. This
-        // should be forwarded to the caller VM
-        add_header = FALSE;
-      } else {
-        // We are not supposed to forward TPM commands at all.
-        int i;
-        vtpmhandlerlogerror(VTPM_LOG_VTPM, "Attempt to use unsupported direct access to TPM.\n");
-        vtpmhandlerloginfo(VTPM_LOG_VTPM_DEEP, "Bad Command. dmi:%d, tag:%d, size:%d, ord:%d, Params: ", dmi, tag, in_param_size, ord);
-        for (i=0; i<cmd_size; i++)
-          vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", in_param[i]);
-
-        vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-
-        status = TPM_FAIL;
-        goto abort_with_error;
-     }
-
-    } // end else for is VTPM Command
-
-    // ------------------- Respond to Sender ------------------
-
-    // Errors while handling responses jump here to reply with error messages
-    // NOTE: Currently there are no recoverable errors in multi-VM mode. If one
-    //       is added to the code, this ifdef should be removed.
-    //       Also note this is NOT referring to errors in commands, but rather
-    //       this is about I/O errors and such.
-#ifndef VTPM_MULTI_VM
- abort_with_error:
-#endif
-   
-    if (add_header) { 
-      // Prepend VTPM header with destination DM stamped
-      out_param_size = buffer_len(result_buf);
-      out_message_size = VTPM_COMMAND_HEADER_SIZE_CLT + out_param_size;
-      reply_size = VTPM_COMMAND_HEADER_SIZE_SRV + out_param_size;
-      out_message = (BYTE *) malloc (reply_size);
-      reply = out_message;
-    
-      BSG_PackList(out_message, 4,
-		   BSG_TYPE_UINT32, (BYTE *) &dmi,
-		   BSG_TPM_TAG, (BYTE *) &tag,
-		   BSG_TYPE_UINT32, (BYTE *) &out_message_size,
-		   BSG_TPM_RESULT, (BYTE *) &status);
-    
-      if (buffer_len(result_buf) > 0) 
-        memcpy(out_message + VTPM_COMMAND_HEADER_SIZE_SRV, result_buf->bytes, out_param_size);
-      //Note: Send message + dmi_id
-    } else {
-      reply = result_buf->bytes;
-      reply_size = buffer_len(result_buf);
-    }  
-    size_write = vtpm_ipc_write(tx_ipc_h, (dmi_res ? dmi_res->tx_vtpm_ipc_h : NULL), reply, reply_size );
-    if (size_write > 0) {
-      vtpmhandlerloginfo(VTPM_LOG_VTPM_DEEP, "SENT: 0x");
-      for (i=0; i < reply_size; i++) 
-	vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", reply[i]);
-      
-      vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "\n");            
-    } else {
-      vtpmhandlerlogerror(VTPM_LOG_VTPM, "%s had error writing to ipc. Aborting... \n", thread_name);
-      goto abort_command;
-    }
-    free(out_message); out_message=NULL;
-    
-    if (size_write < (int)reply_size) {
-      vtpmhandlerlogerror(VTPM_LOG_VTPM, "%s unable to write full command to ipc (%d/%d)\n", thread_name, size_write, reply_size);
-      goto abort_command;
-    }
-    
-    // On certain failures an error message cannot be sent. 
-    // This marks the beginning of cleanup in preperation for the next command.
-  abort_command:
-    //free buffers
-    bzero(cmd_header, VTPM_COMMAND_HEADER_SIZE_SRV);
-    //free(in_param); // This was converted to command_buf. No need to free 
-    buffer_free(result_buf);
-    buffer_free(command_buf);
-
-    // If we have a write lock, save the manager table
-    if ((tag == VTPM_TAG_REQ) && (ord & VTPM_PRIV_MASK) &&
-        (VTPM_SaveManagerData() != TPM_SUCCESS) ) {
-       vtpmhandlerlogerror(VTPM_LOG_VTPM, "ERROR: Unable to save manager data.\n");
-    }
-
-    vtpm_lock_unlock();
-    add_header = TRUE; // Reset to the default
-  } // End while(1)
-  
-}
-
-/////////////////////////////////////////////////////////////////////////
-TPM_RESULT vtpm_manager_handle_vtpm_cmd(VTPM_DMI_RESOURCE *dmi_res, 
-					TPM_COMMAND_CODE ord,
-					buffer_t *command_buf,
-					buffer_t *result_buf,
-                                        BOOL is_priv,
-                                        char *thread_name) {
-
-  TPM_RESULT status = TPM_FAIL;
-
-  switch (ord) {                
-  case VTPM_ORD_SAVENVM:
-    status= VTPM_Handle_Save_NVM(dmi_res,
-                                 command_buf, 
-                                 result_buf);
-    break;
-
-  case VTPM_ORD_LOADNVM:
-    status= VTPM_Handle_Load_NVM(dmi_res, 
-                                 command_buf, 
-                                 result_buf);
-    break;
-
-  case VTPM_ORD_TPMCOMMAND:
-    status= VTPM_Handle_TPM_Command(dmi_res, 
-                                    command_buf, 
-                                    result_buf);
-    break;
-
-  case VTPM_ORD_GET_MIG_KEY:
-    status = VTPM_Handle_Get_Migration_key(command_buf, 
-                                           result_buf);
-    break;
-
-  case VTPM_ORD_LOAD_MIG_KEY:
-    status = VTPM_Handle_Load_Migration_key(command_buf, 
-                                           result_buf);
-    break;
-   
-  default:
-    // Privileged handlers can do maintanance
-    if (is_priv) {
-      switch (ord) {
-      case VTPM_ORD_OPEN:
-        status = VTPM_Handle_New_DMI(command_buf);
-        break;
-
-      case VTPM_ORD_CLOSE:
-        status = VTPM_Handle_Close_DMI(command_buf);
-        break;
-
-      case VTPM_ORD_DELETE:
-        status = VTPM_Handle_Delete_DMI(command_buf);
-        break;
-
-      case VTPM_ORD_MIGRATE_IN:
-        status = VTPM_Handle_Migrate_In(command_buf, result_buf);
-        break;
-
-      case VTPM_ORD_MIGRATE_OUT:
-        status = VTPM_Handle_Migrate_Out(command_buf, result_buf);
-        break;
-
-      default:
-        status = TPM_BAD_ORDINAL;
-      } // switch
-    } else { // is priv command
-
-        status = TPM_BAD_ORDINAL;
-    } // inner switch
-  } // outer switch
-
-  return(status);
-}
-      
-/////////////////////////////////////////////////////////////////////
-TPM_RESULT vtpm_manager_handle_tpm_cmd(vtpm_ipc_handle_t *tx_ipc_h,
-                                       vtpm_ipc_handle_t *rx_ipc_h,
-				       VTPM_DMI_RESOURCE *dmi_res, 
-				       BYTE *cmd_header,
-				       buffer_t *param_buf,
-				       buffer_t *result_buf,
-                                       char *thread_name) {
-
-  TPM_RESULT status = TPM_FAIL;
-  UINT32 dmi_dst;
-  TPM_COMMAND_CODE ord;
-  TPM_TAG tag_out;
-  UINT32 dmi_cmd_size, in_param_size, adj_param_size;
-  BYTE *dmi_cmd, *in_param;
-  int  size_read, size_write, i;
-
-  //// Dom0 can't talk to the BE, so this must be a broken FE/BE or badness
-  if (dmi_res->dmi_id == VTPM_CTL_DM) {
-    vtpmhandlerlogerror(VTPM_LOG_VTPM, "Illegal use of TPM command from dom0\n");
-    status = TPM_FAIL;
-    goto abort_with_error;
-  } 
-
-  vtpmhandlerloginfo(VTPM_LOG_VTPM, "Forwarding command to DMI.\n");
-   
-  //Forward TPM CMD stamped with dmi_id to DMI for handling
-  if (buffer_len(param_buf)) {
-    dmi_cmd = (BYTE *) malloc(VTPM_COMMAND_HEADER_SIZE_SRV + buffer_len(param_buf));
-    dmi_cmd_size = VTPM_COMMAND_HEADER_SIZE_SRV + buffer_len(param_buf);
-    memcpy(dmi_cmd, cmd_header, VTPM_COMMAND_HEADER_SIZE_SRV);
-    memcpy(dmi_cmd + VTPM_COMMAND_HEADER_SIZE_SRV, param_buf->bytes, buffer_len(param_buf));
-    size_write = vtpm_ipc_write(tx_ipc_h, dmi_res->tx_tpm_ipc_h, dmi_cmd, dmi_cmd_size);
-
-    if (size_write > 0) {
-      vtpmhandlerloginfo(VTPM_LOG_VTPM_DEEP, "SENT (DMI): 0x");
-      for (i=0; i<VTPM_COMMAND_HEADER_SIZE_SRV + buffer_len(param_buf); i++) {
-        vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", dmi_cmd[i]);
-      }
-      vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-    } else {
-      vtpmhandlerlogerror(VTPM_LOG_VTPM, "Error writing to DMI. Aborting... \n");
-      status = TPM_IOERROR;
-      goto abort_with_error;
-    }
-    free(dmi_cmd);
-  } else {
-    dmi_cmd_size = VTPM_COMMAND_HEADER_SIZE_SRV;
-    size_write = vtpm_ipc_write(tx_ipc_h, dmi_res->tx_tpm_ipc_h, cmd_header, VTPM_COMMAND_HEADER_SIZE_SRV );
-    if (size_write > 0) {
-      vtpmhandlerloginfo(VTPM_LOG_VTPM_DEEP, "SENT (DMI): 0x");
-      for (i=0; i<VTPM_COMMAND_HEADER_SIZE_SRV; i++) 
-        vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", cmd_header[i]);
-
-      vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-    } else {
-      vtpmhandlerlogerror(VTPM_LOG_VTPM, "Error writing to DMI. Aborting... \n");
-      status = TPM_IOERROR;
-      goto abort_with_error;
-    }
-  }
-    
-  if (size_write != (int) dmi_cmd_size) 
-    vtpmhandlerlogerror(VTPM_LOG_VTPM, "Could not write entire command to DMI (%d/%d)\n", size_write, dmi_cmd_size);
-
-  buffer_free(param_buf);
-  
-  // Read header for response to TPM command from DMI
-  size_read = vtpm_ipc_read( rx_ipc_h, dmi_res->rx_tpm_ipc_h, cmd_header, VTPM_COMMAND_HEADER_SIZE_SRV);
-  if (size_read > 0) {
-    vtpmhandlerloginfo(VTPM_LOG_VTPM_DEEP, "RECV (DMI): 0x");
-    for (i=0; i<size_read; i++) 
-      vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", cmd_header[i]);
-
-  } else {
-    vtpmhandlerlogerror(VTPM_LOG_VTPM, "Error reading from DMI. Aborting... \n");
-    status = TPM_IOERROR;
-    goto abort_with_error;
-  }
-  
-  if (size_read < (int) VTPM_COMMAND_HEADER_SIZE_SRV) {
-    vtpmhandlerlogerror(VTPM_LOG_VTPM, "Command from DMI shorter than normal header. Aborting...\n");
-    status = TPM_IOERROR;
-    goto abort_with_error;
-  }
-
-  // Unpack response from DMI for TPM command
-  BSG_UnpackList(cmd_header, 4,
-                 BSG_TYPE_UINT32, &dmi_dst,
-                 BSG_TPM_TAG, &tag_out,
-                 BSG_TYPE_UINT32, &in_param_size,
-                 BSG_TPM_COMMAND_CODE, &status );
-  
-  // If response has parameters, read them.
-  // Note that in_param_size is in the client's context
-  adj_param_size = in_param_size - VTPM_COMMAND_HEADER_SIZE_CLT;
-  if (adj_param_size > 0) {
-    in_param = (BYTE *) malloc(adj_param_size);
-    size_read = vtpm_ipc_read(rx_ipc_h, dmi_res->rx_tpm_ipc_h, in_param, adj_param_size);
-    if (size_read > 0) {
-      for (i=0; i<size_read; i++) 
-        vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", in_param[i]);
-
-    } else {
-      vtpmhandlerlogerror(VTPM_LOG_VTPM, "Error reading from BE. Aborting... \n");
-      goto abort_with_error;
-    }
-    vtpmhandlerloginfomore(VTPM_LOG_VTPM, "\n");
-   
-    if (size_read < (int)adj_param_size) {
-      vtpmhandlerloginfomore(VTPM_LOG_VTPM, "\n");
-      vtpmhandlerlogerror(VTPM_LOG_VTPM, "Command read(%d) from DMI is shorter than header indicates(%d). Aborting...\n", size_read, adj_param_size);
-      status = TPM_IOERROR;
-      goto abort_with_error;
-    }
-  } else {
-    in_param = NULL;
-    vtpmhandlerloginfomore(VTPM_LOG_VTPM, "\n");
-  }
-   
-  if ( (buffer_init(result_buf, VTPM_COMMAND_HEADER_SIZE_SRV, cmd_header) != TPM_SUCCESS) || 
-       (buffer_append_raw(result_buf, adj_param_size, in_param) != TPM_SUCCESS) ) {
-    vtpmhandlerlogerror(VTPM_LOG_VTPM, "Failed to setup buffers. Aborting...\n");
-    status = TPM_FAIL;
-    goto abort_with_error;
-  }
- 
-  vtpmhandlerloginfo(VTPM_LOG_VTPM, "Sending DMI's response to guest.\n");
-
-  status = TPM_SUCCESS;
-
- abort_with_error:
-
-  return status;
-}
-
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/vtpmd.c
--- a/tools/vtpm_manager/manager/vtpmd.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,371 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// vtpmd.c
-// 
-//  Application
-//
-// ===================================================================
-
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <string.h>
-#include <pthread.h>
-#include "vtpm_manager.h"
-#include "vtpmpriv.h"
-#include "tcg.h"
-#include "log.h"
-#include "vtpm_ipc.h"
-
-#define TPM_EMULATOR_PATH "/usr/bin/vtpmd"
-
-#define VTPM_BE_FNAME          "/dev/vtpm"
-#define VTPM_DUMMY_TX_BE_FNAME "/var/vtpm/fifos/dummy_out.fifo"
-#define VTPM_DUMMY_RX_BE_FNAME "/var/vtpm/fifos/dummy_in.fifo"
-#define VTPM_TX_TPM_FNAME      "/var/vtpm/fifos/tpm_cmd_to_%d.fifo"
-#define VTPM_RX_TPM_FNAME      "/var/vtpm/fifos/tpm_rsp_from_all.fifo"
-#define VTPM_TX_VTPM_FNAME     "/var/vtpm/fifos/vtpm_rsp_to_%d.fifo"
-#define VTPM_RX_VTPM_FNAME     "/var/vtpm/fifos/vtpm_cmd_from_all.fifo"
-#define VTPM_TX_HP_FNAME       "/var/vtpm/fifos/to_console.fifo"
-#define VTPM_RX_HP_FNAME       "/var/vtpm/fifos/from_console.fifo"
-
-#define VTPM_TYPE_PVM_STRING "pvm"
-#define VTPM_TYPE_HVM_STRING "hvm"
-
-struct vtpm_thread_params_s {
-  vtpm_ipc_handle_t *tx_ipc_h;
-  vtpm_ipc_handle_t *rx_ipc_h;
-  BOOL fw_tpm;
-  vtpm_ipc_handle_t *fw_tx_ipc_h;
-  vtpm_ipc_handle_t *fw_rx_ipc_h;
-  BOOL is_priv;
-  char *thread_name;
-};
-
-// This is needed to all extra_close_dmi to close this to prevent a
-// broken pipe when no DMIs are left.
-static vtpm_ipc_handle_t *g_rx_tpm_ipc_h;
-
-void *vtpm_manager_thread(void *arg_void) {
-  TPM_RESULT *status = (TPM_RESULT *) malloc(sizeof(TPM_RESULT) );
-  struct vtpm_thread_params_s *arg = (struct vtpm_thread_params_s *) arg_void;
-
-  *status = VTPM_Manager_Handler(arg->tx_ipc_h, arg->rx_ipc_h,
-                                 arg->fw_tpm, arg->fw_tx_ipc_h, arg->fw_rx_ipc_h,
-                                 arg->is_priv, arg->thread_name);
-
-  return (status);
-}
-
-
-void signal_handler(int reason) {
-  if (pthread_equal(pthread_self(), vtpm_globals->master_pid)) {
-    vtpmloginfo(VTPM_LOG_VTPM, "VTPM Manager shutting down for signal %d.\n", reason);
-  } else {
-    // For old Linux Thread machines, signals are delivered to each thread. Deal with them.
-    vtpmloginfo(VTPM_LOG_VTPM, "Child shutting down\n");
-    pthread_exit(NULL);
-  }
-
-  VTPM_Stop_Manager();
-  exit(-1);
-}
-
-struct sigaction ctl_c_handler;
-
-TPM_RESULT VTPM_New_DMI_Extra(VTPM_DMI_RESOURCE *dmi_res, BYTE vm_type, BYTE startup_mode) {
-
-  TPM_RESULT status = TPM_SUCCESS;
-  int fh;
-  char dmi_id_str[11]; // UINT32s are up to 10 digits + NULL
-  char *tx_vtpm_name, *tx_tpm_name, *vm_type_string;
-  struct stat file_info;
-
-  if (dmi_res->dmi_id == VTPM_CTL_DM) {
-    dmi_res->tx_tpm_ipc_h = NULL;
-    dmi_res->rx_tpm_ipc_h = NULL;
-    dmi_res->tx_vtpm_ipc_h = NULL;
-    dmi_res->rx_vtpm_ipc_h = NULL;
-  } else {
-    // Create a pair of fifo pipes
-    dmi_res->rx_tpm_ipc_h = NULL;
-    dmi_res->rx_vtpm_ipc_h = NULL;
-
-    if ( ((dmi_res->tx_tpm_ipc_h = (vtpm_ipc_handle_t *) malloc (sizeof(vtpm_ipc_handle_t))) == NULL ) ||
-         ((dmi_res->tx_vtpm_ipc_h =(vtpm_ipc_handle_t *) malloc (sizeof(vtpm_ipc_handle_t))) == NULL ) ||
-         ((tx_tpm_name = (char *) malloc(11 + strlen(VTPM_TX_TPM_FNAME))) == NULL ) ||
-         ((tx_vtpm_name =(char *) malloc(11 + strlen(VTPM_TX_VTPM_FNAME))) == NULL) ) {
-      status =TPM_RESOURCES;
-      goto abort_egress;
-    }
-
-    sprintf(tx_tpm_name, VTPM_TX_TPM_FNAME, (uint32_t) dmi_res->dmi_id);
-    sprintf(tx_vtpm_name, VTPM_TX_VTPM_FNAME, (uint32_t) dmi_res->dmi_id);
-
-    if ( (vtpm_ipc_init(dmi_res->tx_tpm_ipc_h, tx_tpm_name, O_WRONLY | O_NONBLOCK, TRUE) != 0) ||
-         (vtpm_ipc_init(dmi_res->tx_vtpm_ipc_h, tx_vtpm_name, O_WRONLY, TRUE) != 0) ) { //FIXME: O_NONBLOCK?
-      status = TPM_IOERROR;
-      goto abort_egress;
-    }
-
-    // Measure DMI
-    // FIXME: This will measure DMI. Until then use a fixed DMI_Measurement value
-    // Also, this mechanism is specific to 1 VM architecture.
-    /*
-    fh = open(TPM_EMULATOR_PATH, O_RDONLY);
-    stat_ret = fstat(fh, &file_stat);
-    if (stat_ret == 0)
-      dmi_size = file_stat.st_size;
-    else {
-      vtpmlogerror(VTPM_LOG_VTPM, "Could not open vtpmd!!\n");
-      status = TPM_IOERROR;
-      goto abort_egress;
-    }
-    dmi_buffer
-    */
-    memset(&dmi_res->DMI_measurement, 0xcc, sizeof(TPM_DIGEST));
-
-    if (vm_type == VTPM_TYPE_PVM)
-      vm_type_string = (BYTE *)&VTPM_TYPE_PVM_STRING;
-    else
-      vm_type_string = (BYTE *)&VTPM_TYPE_HVM_STRING;
-
-    // Launch DMI
-    sprintf(dmi_id_str, "%d", (int) dmi_res->dmi_id);
-#ifdef MANUAL_DM_LAUNCH
-    vtpmlogerror(VTPM_LOG_VTPM, "Manually start VTPM with dmi=%s now.\n", dmi_id_str);
-    dmi_res->dmi_pid = 0;
-#else
-    pid_t pid = fork();
-
-    if (pid == -1) {
-      vtpmlogerror(VTPM_LOG_VTPM, "Could not fork to launch vtpm\n");
-      status = TPM_RESOURCES;
-      goto abort_egress;
-    } else if (pid == 0) {
-      switch (startup_mode) {
-      case TPM_ST_CLEAR:
-        execl (TPM_EMULATOR_PATH, "vtpmd", "clear", vm_type_string, dmi_id_str, NULL);
-        break;
-      case TPM_ST_STATE:
-        execl (TPM_EMULATOR_PATH, "vtpmd", "save", vm_type_string, dmi_id_str, NULL);
-        break;
-      case TPM_ST_DEACTIVATED:
-        execl (TPM_EMULATOR_PATH, "vtpmd", "deactivated", vm_type_string, dmi_id_str, NULL);
-        break;
-      default:
-        status = TPM_BAD_PARAMETER;
-        goto abort_egress;
-      }
-
-      // Returning from these at all is an error.
-      vtpmlogerror(VTPM_LOG_VTPM, "Could not exec to launch vtpm\n");
-    } else {
-      dmi_res->dmi_pid = pid;
-      vtpmloginfo(VTPM_LOG_VTPM, "Launching DMI on PID = %d\n", pid);
-    }
-#endif // MANUAL_DM_LAUNCH
-
-  } // If DMI = VTPM_CTL_DM
-    status = TPM_SUCCESS;
-
-abort_egress:
-  return (status);
-}
-
-TPM_RESULT VTPM_Close_DMI_Extra(VTPM_DMI_RESOURCE *dmi_res) {
-  TPM_RESULT status = TPM_SUCCESS;
-
-  if (vtpm_globals->connected_dmis == 0) {
-    // No more DMI's connected. Close fifo to prevent a broken pipe.
-    // This is hackish. Need to think of another way.
-    vtpm_ipc_close(g_rx_tpm_ipc_h);
-  }
-
-  
-  if (dmi_res->dmi_id != VTPM_CTL_DM) {
-    vtpm_ipc_close(dmi_res->tx_tpm_ipc_h);
-    vtpm_ipc_close(dmi_res->tx_vtpm_ipc_h);
-
-    free(dmi_res->tx_tpm_ipc_h->name);
-    free(dmi_res->tx_vtpm_ipc_h->name);
-
-#ifndef MANUAL_DM_LAUNCH
-    if (dmi_res->dmi_id != VTPM_CTL_DM) {
-      if (dmi_res->dmi_pid != 0) {
-        vtpmloginfo(VTPM_LOG_VTPM, "Killing dmi on pid %d.\n", dmi_res->dmi_pid);
-        if (kill(dmi_res->dmi_pid, SIGKILL) !=0) {
-          vtpmloginfo(VTPM_LOG_VTPM, "DMI on pid %d is already dead.\n", dmi_res->dmi_pid);
-        } else if (waitpid(dmi_res->dmi_pid, NULL, 0) != dmi_res->dmi_pid) {
-          vtpmlogerror(VTPM_LOG_VTPM, "DMI on pid %d failed to stop.\n", dmi_res->dmi_pid);
-          status = TPM_FAIL;
-        }
-      } else {
-        vtpmlogerror(VTPM_LOG_VTPM, "Could not kill dmi because it's pid was 0.\n");
-        status = TPM_FAIL;
-      }
-    }
-#endif
-
-  } //endif ! dom0
-  return status;
-}
-
-
-int main(int argc, char **argv) {
-  vtpm_ipc_handle_t *tx_be_ipc_h, *rx_be_ipc_h, rx_tpm_ipc_h, rx_vtpm_ipc_h, tx_hp_ipc_h, rx_hp_ipc_h; 
-  struct vtpm_thread_params_s be_thread_params, dmi_thread_params, hp_thread_params;
-  pthread_t be_thread, dmi_thread, hp_thread;
-
-#ifdef DUMMY_BACKEND
-  vtpm_ipc_handle_t tx_dummy_ipc_h, rx_dummy_ipc_h;
-#else
-  vtpm_ipc_handle_t real_be_ipc_h;
-#endif
-
-  vtpmloginfo(VTPM_LOG_VTPM, "Starting VTPM.\n");
- 
-  // -------------------- Initialize Manager ----------------- 
-  if (VTPM_Init_Manager() != TPM_SUCCESS) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Closing vtpmd due to error during startup.\n");
-    return -1;
-  }
-  
-  // -------------------- Setup Ctrl+C Handlers --------------
-  ctl_c_handler.sa_handler = signal_handler;
-  sigemptyset(&ctl_c_handler.sa_mask);
-  ctl_c_handler.sa_flags = 0;    
-  
-  if (sigaction(SIGINT, &ctl_c_handler, NULL) == -1) 
-    vtpmlogerror(VTPM_LOG_VTPM, "Could not install SIGINT handler. Ctl+break will not stop manager gently.\n");
-  
-  // For easier debuggin with gdb
-  if (sigaction(SIGHUP, &ctl_c_handler, NULL) == -1) 
-    vtpmlogerror(VTPM_LOG_VTPM, "Could not install SIGHUP handler. Ctl+break will not stop manager gently.\n");    
-  
-  sigset_t sig_mask;
-  sigemptyset(&sig_mask);
-  sigaddset(&sig_mask, SIGPIPE);
-  sigprocmask(SIG_BLOCK, &sig_mask, NULL);
-  
-  // ------------------- Set up file ipc structures ----------
-#ifdef DUMMY_BACKEND
-  if ( (vtpm_ipc_init(&tx_dummy_ipc_h, VTPM_DUMMY_TX_BE_FNAME, O_RDWR, TRUE) != 0) ||
-       (vtpm_ipc_init(&rx_dummy_ipc_h, VTPM_DUMMY_RX_BE_FNAME, O_RDWR, TRUE) != 0) ) {
-
-    vtpmlogerror(VTPM_LOG_VTPM, "Unable to create Dummy BE FIFOs.\n");
-    exit(-1);
-  }
-
-  tx_be_ipc_h = &tx_dummy_ipc_h;
-  rx_be_ipc_h = &rx_dummy_ipc_h;
-#else
-  vtpm_ipc_init(&real_be_ipc_h, VTPM_BE_FNAME, O_RDWR, FALSE);
-
-  tx_be_ipc_h = &real_be_ipc_h;
-  rx_be_ipc_h = &real_be_ipc_h;
-#endif
-
-  if ( (vtpm_ipc_init(&rx_tpm_ipc_h, VTPM_RX_TPM_FNAME, O_RDONLY, TRUE) != 0) ||
-       (vtpm_ipc_init(&rx_vtpm_ipc_h, VTPM_RX_VTPM_FNAME, O_RDWR, TRUE) != 0) || //FIXME: O_RDONLY?
-       (vtpm_ipc_init(&tx_hp_ipc_h,  VTPM_TX_HP_FNAME, O_RDWR, TRUE) != 0)    ||
-       (vtpm_ipc_init(&rx_hp_ipc_h,  VTPM_RX_HP_FNAME, O_RDWR, TRUE) != 0) ) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Unable to create initial FIFOs.\n");
-    exit(-1);
-  }
-
-  g_rx_tpm_ipc_h = &rx_tpm_ipc_h;
-
-  // -------------------- Set up thread params ------------- 
-
-  be_thread_params.tx_ipc_h = tx_be_ipc_h;
-  be_thread_params.rx_ipc_h = rx_be_ipc_h;
-  be_thread_params.fw_tpm = TRUE;
-  be_thread_params.fw_tx_ipc_h = NULL;
-  be_thread_params.fw_rx_ipc_h = &rx_tpm_ipc_h;
-  be_thread_params.is_priv = FALSE;
-  be_thread_params.thread_name = "Backend Listener";
-
-  dmi_thread_params.tx_ipc_h = NULL;
-  dmi_thread_params.rx_ipc_h = &rx_vtpm_ipc_h;
-  dmi_thread_params.fw_tpm = FALSE; 
-  dmi_thread_params.fw_tx_ipc_h = NULL;
-  dmi_thread_params.fw_rx_ipc_h = NULL;
-  dmi_thread_params.is_priv = FALSE; 
-  dmi_thread_params.thread_name = "VTPM Listener";
-
-  hp_thread_params.tx_ipc_h = &tx_hp_ipc_h;
-  hp_thread_params.rx_ipc_h = &rx_hp_ipc_h;
-  hp_thread_params.fw_tpm = FALSE;
-  hp_thread_params.fw_tx_ipc_h = NULL;
-  hp_thread_params.fw_rx_ipc_h = NULL;
-  hp_thread_params.is_priv = TRUE;
-  hp_thread_params.thread_name = "Hotplug Listener";
-
-  // --------------------- Launch Threads -----------------
-
-  vtpm_lock_init();
-
-  vtpm_globals->master_pid = pthread_self();
-  
-  if (pthread_create(&be_thread, NULL, vtpm_manager_thread, &be_thread_params) != 0) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Failed to launch BE Thread.\n");
-    exit(-1);
-  }
-  
-  if (pthread_create(&dmi_thread, NULL, vtpm_manager_thread, &dmi_thread_params) != 0) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Failed to launch DMI Thread.\n");
-    exit(-1);
-  }
-
- 
-  if (pthread_create(&hp_thread, NULL, vtpm_manager_thread, &hp_thread_params) != 0) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Failed to launch HP Thread.\n");
-    exit(-1);
-  }
- 
-  //Join the other threads until exit time.
-  pthread_join(be_thread, NULL);
-  pthread_join(dmi_thread, NULL);
-  pthread_join(hp_thread, NULL);
- 
-  vtpmlogerror(VTPM_LOG_VTPM, "VTPM Manager shut down unexpectedly.\n");
- 
-  VTPM_Stop_Manager();
-  vtpm_lock_destroy();
-  return 0;
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/vtpmpriv.h
--- a/tools/vtpm_manager/manager/vtpmpriv.h	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// vtpmpriv.h
-// 
-//  Structures and functions private to the manager
-//
-// ==================================================================
-
-#ifndef __VTPMPRIV_H__
-#define __VTPMPRIV_H__
-
-#include "vtpm_manager.h"
-#include "tcg.h"
-#include "tcs.h"
-#include "buffer.h"
-#include "crypto.h"
-#include "vtpm_ipc.h"
-
-#define VTPM_MANAGER_GEN   2     // This is incremented when the manager's table
-                                 // is changed. It's used for backwards compatability
-
-#define STATE_FILE         "/var/vtpm/VTPM"
-#define DMI_NVM_FILE       "/var/vtpm/vtpm_dm_%d.data"
-#define VTPM_CTL_DM        0
-
-// ------------------------ Private Structures -----------------------
-typedef struct VTPM_DMI_RESOURCE_T {
-  // I/O info for Manager to talk to DMI's and controllers
-  vtpm_ipc_handle_t      *tx_vtpm_ipc_h;    // TX VTPM Results to DMI
-  vtpm_ipc_handle_t      *rx_vtpm_ipc_h;    // RX VTPM Commands from DMI
-  vtpm_ipc_handle_t      *tx_tpm_ipc_h;     // TX TPM Commands to DMI
-  vtpm_ipc_handle_t      *rx_tpm_ipc_h;     // RX TPM Results from DMI
- 
-#ifndef VTPM_MULTI_VM 
-  pid_t                 dmi_pid;
-#endif
-
-  // Non-persistent Information
-  bool                  connected;
-  UINT32                dmi_domain_id;
-  TCS_CONTEXT_HANDLE    TCSContext;     // TCS Handle
-  char                  *NVMLocation;   // NULL term string indicating location
-                                        // of NVM.
-  // Persistent Information about DMI
-  UINT32                dmi_id;
-  BYTE                  dmi_type;
-  TPM_DIGEST            NVM_measurement;  // Equal to the SHA1 of the blob
-  TPM_DIGEST            DMI_measurement;  // Correct measurement of the owning DMI
-} VTPM_DMI_RESOURCE;
-
-typedef struct tdVTPM_MIGKEY_LIST {
-  UINT32                name_size;
-  BYTE                  *name; // Name of destination (IP addr, domain name, etc)
-  CRYPTO_INFO           key;
-  struct tdVTPM_MIGKEY_LIST *next;
-} VTPM_MIGKEY_LIST;
-
-
-typedef struct tdVTPM_GLOBALS {
-  // Non-persistent data
-#ifndef VTPM_MULTI_VM
-  pid_t               master_pid;
-#endif
-
-  int                 connected_dmis;     // To close guest_rx when no dmis are connected
-
-  struct hashtable    *dmi_map;               // Table of all DMI's known indexed by persistent instance #
-  VTPM_MIGKEY_LIST    *mig_keys;              // Table of migration keys
-                      // Currently keys are loaded at migration time,
-                      // TODO: Make VTPM man store a keys persistently
-                      //       and update script to check if key is needed
-                      //       before fetching it.
-
-  TCS_CONTEXT_HANDLE  manager_tcs_handle;     // TCS Handle used by manager
-  TPM_HANDLE          storageKeyHandle;       // Key used by persistent store
-  CRYPTO_INFO         storageKey;             // For software encryption
-  CRYPTO_INFO         bootKey;                // For saving table
-  TCS_AUTH            keyAuth;                // OIAP session for storageKey 
-    
-  // Persistent Data
-  TPM_AUTHDATA        owner_usage_auth;       // OwnerAuth of real TPM
-  buffer_t            storageKeyWrap;         // Wrapped copy of storageKey
-  TPM_AUTHDATA        srk_usage_auth;
-  TPM_AUTHDATA        storage_key_usage_auth; 
-
-  buffer_t            bootKeyWrap;            // Wrapped copy of boot key 
-
-}VTPM_GLOBALS;
-
-// --------------------------- Global Values --------------------------
-extern VTPM_GLOBALS *vtpm_globals;   // Key info and DMI states
-extern const TPM_AUTHDATA SRK_AUTH;  // SRK Well Known Auth Value
-
-// ********************** VTPM Functions *************************
-TPM_RESULT VTPM_Init_Manager(); // Start VTPM Service
-void VTPM_Stop_Manager();  // Stop VTPM Service
-TPM_RESULT VTPM_Manager_Handler(vtpm_ipc_handle_t *tx_ipc_h,
-                                vtpm_ipc_handle_t *rx_ipc_h,
-                                BOOL fw_tpm,   // Should forward TPM cmds
-                                vtpm_ipc_handle_t *fw_tx_ipc_h,
-                                vtpm_ipc_handle_t *fw_rx_ipc_h,
-                                BOOL is_priv,
-                                char *client_name);
-
-// ********************** Command Handler Prototypes ***********************
-
-TPM_RESULT VTPM_Handle_Load_NVM(       VTPM_DMI_RESOURCE *myDMI, 
-                                        const buffer_t *inbuf, 
-                                        buffer_t *outbuf);
-
-TPM_RESULT VTPM_Handle_Save_NVM(       VTPM_DMI_RESOURCE *myDMI, 
-                                        const buffer_t *inbuf, 
-                                        buffer_t *outbuf);
-
-TPM_RESULT VTPM_Handle_TPM_Command(    VTPM_DMI_RESOURCE *dmi, 
-                                        buffer_t *inbuf, 
-                                        buffer_t *outbuf);
-
-TPM_RESULT VTPM_Handle_New_DMI(const buffer_t *param_buf);
-                                
-TPM_RESULT VTPM_Handle_Close_DMI(const buffer_t *param_buf);
-                                   
-TPM_RESULT VTPM_Handle_Delete_DMI(const buffer_t *param_buf);
-
-TPM_RESULT VTPM_Handle_Migrate_In( const buffer_t *param_buf,
-                                   buffer_t *result_buf);
-
-TPM_RESULT VTPM_Handle_Migrate_Out ( const buffer_t *param_buf,
-                                     buffer_t *result_buf);
-
-TPM_RESULT VTPM_Handle_Get_Migration_key( const buffer_t *param_buf,
-                                          buffer_t *result_buf);
-
-TPM_RESULT VTPM_SaveManagerData(void);
-TPM_RESULT VTPM_LoadManagerData(void);
-
-TPM_RESULT VTPM_New_DMI_Extra(VTPM_DMI_RESOURCE *dmi_res, BYTE vm_type, BYTE startup_mode);
-
-TPM_RESULT VTPM_Close_DMI_Extra(VTPM_DMI_RESOURCE *dmi_res);
-
-// Helper functions
-TPM_RESULT close_dmi(VTPM_DMI_RESOURCE *dmi_res);
-TPM_RESULT init_dmi(UINT32 dmi_id, BYTE type,  VTPM_DMI_RESOURCE **dmi_res);
-
-TPM_RESULT envelope_encrypt(const buffer_t     *inbuf,
-                             CRYPTO_INFO        *asymkey,
-                             buffer_t           *sealed_data);
-
-TPM_RESULT envelope_decrypt(const buffer_t     *cipher,
-                            TCS_CONTEXT_HANDLE TCSContext,
-                            TPM_HANDLE         keyHandle,
-                            const TPM_AUTHDATA *key_usage_auth,
-                            buffer_t           *unsealed_data);
-
-#endif // __VTPMPRIV_H__
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/vtsp.c
--- a/tools/vtpm_manager/manager/vtsp.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1042 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// vtsp.c
-// 
-//  Higher level interface to TCS for use in service.
-//
-// ==================================================================
-
-#include <string.h>
-#include "tcg.h"
-#include "tcs.h"
-#include "bsg.h"
-#include "log.h"
-#include "crypto.h"
-#include "vtsp.h"
-#include "buffer.h"
-
-#define  RSA_KEY_SIZE 0x0800
-
-/***********************************************************************************
- * GenerateAuth: Generate authorization info to be sent back to application
- *
- * Parameters: outParamDigestText  The concatenation of output parameters to be SHA1ed
- *    outParamDigestTextSize Size of inParamDigestText
- *    HMACkey     Key to be used for HMACing
- *          For OIAP use key.authUsage or PersistStore.ownerAuth
- *          For OSAP use shared secret
- *    pAuth     Authorization information from the application
- *
- * Return:  TPM_SUCCESS   Authorization data created
- *    TPM_AUTHFAIL   Invalid (NULL) HMACkey presented for OSAP
- *************************************************************************************/
-TPM_RESULT GenerateAuth( /*[IN]*/ const BYTE *inParamDigestText,
-			 /*[IN]*/ UINT32 inParamDigestTextSize,
-			 /*[IN]*/ const TPM_SECRET *HMACkey,  
-			 /*[IN,OUT]*/ TCS_AUTH *auth) {
-    
-  if (inParamDigestText == NULL || auth == NULL) 
-    return (TPM_AUTHFAIL);
-  else {
-    
-    //Generate new OddNonce
-    Crypto_GetRandom(auth->NonceOdd.nonce, sizeof(TPM_NONCE));
-    
-    // Create SHA1 inParamDigest
-    TPM_DIGEST inParamDigest;
-    Crypto_SHA1Full(inParamDigestText, inParamDigestTextSize, (BYTE *) &inParamDigest);
-    
-    // Create HMAC text. (Concat inParamsDigest with inAuthSetupParams).
-    BYTE hmacText[sizeof(TPM_DIGEST) + (2 * sizeof(TPM_NONCE)) + sizeof(BOOL)];
-    
-    BSG_PackList(   hmacText, 4, 
-		    BSG_TPM_DIGEST, &inParamDigest,
-		    BSG_TPM_NONCE, &(auth->NonceEven),
-		    BSG_TPM_NONCE, &(auth->NonceOdd), 
-		    BSG_TYPE_BOOL, &(auth->fContinueAuthSession) );
-    
-    Crypto_HMAC((BYTE *) hmacText, sizeof(hmacText), (BYTE *) HMACkey, sizeof(TPM_DIGEST), (BYTE *) &(auth->HMAC));
-    
-    return(TPM_SUCCESS);
-    
-  }
-}
-
-/***********************************************************************************
- * VerifyAuth: Verify the authdata for a command requiring authorization
- *
- * Parameters: inParamDigestText  The concatenation of parameters to be SHA1ed
- *    inParamDigestTextSize Size of inParamDigestText
- *    authDataUsage   AuthDataUsage for the Entity being used
- *          Key->authDataUsage or TPM_AUTH_OWNER
- *    HMACkey     Key to be used for HMACing
- *          For OIAP use key.authUsage or PersistStore.ownerAuth
- *          For OSAP use NULL (It will be aquired from the Auth Session)
- *          If unknown (default), assume OIAP
- *    sessionAuth    A TCS_AUTH info for the session
- *    pAuth     Authorization information from the application
- *              hContext        If specified, on failed Auth, VerifyAuth will
- *                                      generate a new OIAP session in place of themselves
- *                                      destroyed session.
- *
- * Return:  TPM_SUCCESS   Authorization Verified
- *    TPM_AUTHFAIL   Authorization Failed
- *    TPM_FAIL    Failure during SHA1 routines
- *************************************************************************************/
-TPM_RESULT VerifyAuth( /*[IN]*/ const BYTE *outParamDigestText,
-		       /*[IN]*/ UINT32 outParamDigestTextSize,
-		       /*[IN]*/ const TPM_SECRET *HMACkey,  
-		       /*[IN,OUT]*/ TCS_AUTH *auth,
-		       /*[IN]*/  TCS_CONTEXT_HANDLE hContext) {
-  if (outParamDigestText == NULL || auth == NULL) 
-    return (TPM_AUTHFAIL);
-  
-  
-  // Create SHA1 inParamDigest
-  TPM_DIGEST outParamDigest;
-  Crypto_SHA1Full(outParamDigestText, outParamDigestTextSize, (BYTE *) &outParamDigest);
-  
-  // Create HMAC text. (Concat inParamsDigest with inAuthSetupParams).
-  TPM_DIGEST hm;
-  BYTE hmacText[sizeof(TPM_DIGEST) + (2 * sizeof(TPM_NONCE)) + sizeof(BOOL)];
-  
-  BSG_PackList(   hmacText, 4, 
-		  BSG_TPM_DIGEST, &outParamDigest,
-		  BSG_TPM_NONCE, &(auth->NonceEven),
-		  BSG_TPM_NONCE, &(auth->NonceOdd), 
-		  BSG_TYPE_BOOL, &(auth->fContinueAuthSession) );
-  
-  Crypto_HMAC((BYTE *) hmacText, sizeof(hmacText),
-	      (BYTE *) HMACkey, sizeof(TPM_DIGEST), (BYTE *) &hm);
-    
-  // Compare correct HMAC with provided one.
-  if (memcmp (&hm, &(auth->HMAC), sizeof(TPM_DIGEST)) == 0) { // 0 indicates equality
-    if (!auth->fContinueAuthSession) 
-      vtpmloginfo(VTPM_LOG_VTSP_DEEP, "Auth Session: 0x%x closed by TPM by fContinue=0.\n", auth->AuthHandle);
-    
-    return (TPM_SUCCESS);
-  } else {
-    // If specified, reconnect the OIAP session.
-    // NOTE: This only works for TCS's that never have a 0 context. 
-    if (hContext) {
-      vtpmloginfo(VTPM_LOG_VTSP_DEEP, "Auth Session: 0x%x closed by TPM due to failure.\n", auth->AuthHandle);
-      VTSP_OIAP( hContext, auth);
-    }
-    return (TPM_AUTHFAIL);
-  }
-}
-
-TPM_RESULT VTSP_OIAP(const TCS_CONTEXT_HANDLE hContext,
-		     TCS_AUTH *auth) {
-  
-  vtpmloginfo(VTPM_LOG_VTSP, "OIAP.\n");
-  TPM_RESULT status = TPM_SUCCESS;                           
-  TPMTRYRETURN( TCSP_OIAP(hContext,
-			  &auth->AuthHandle,
-			  &auth->NonceEven) );
-
-  memset(&auth->HMAC, 0, sizeof(TPM_DIGEST));
-  auth->fContinueAuthSession = FALSE;
-
-  vtpmloginfo(VTPM_LOG_VTSP_DEEP, "Auth Session: 0x%x opened by TPM_OIAP.\n", auth->AuthHandle);
-  goto egress;
-  
- abort_egress:
-  
- egress:
-  
-  return status;
-}
-
-TPM_RESULT VTSP_OSAP(const TCS_CONTEXT_HANDLE hContext,
-		     const TPM_ENTITY_TYPE entityType,
-		     const UINT32 entityValue,
-		     const TPM_AUTHDATA *usageAuth,
-		     TPM_SECRET *sharedSecret, 
-		     TCS_AUTH *auth) {
-  
-  vtpmloginfo(VTPM_LOG_VTSP, "OSAP.\n");
-  TPM_RESULT status = TPM_SUCCESS;
-  TPM_NONCE nonceEvenOSAP, nonceOddOSAP;
-  
-  Crypto_GetRandom((BYTE *) &nonceOddOSAP, sizeof(TPM_NONCE) ); 
-  
-  TPMTRYRETURN( TCSP_OSAP(    hContext,
-			      entityType,
-			      entityValue, 
-			      nonceOddOSAP,
-			      &auth->AuthHandle, 
-			      &auth->NonceEven, 
-			      &nonceEvenOSAP) );
-  
-  // Calculating Session Secret
-  BYTE sharedSecretText[TPM_DIGEST_SIZE * 2];
-  
-  BSG_PackList(  sharedSecretText, 2,
-		 BSG_TPM_NONCE, &nonceEvenOSAP,
-		 BSG_TPM_NONCE, &nonceOddOSAP);
-  
-  Crypto_HMAC(sharedSecretText, sizeof(sharedSecretText), (BYTE *) usageAuth, TPM_DIGEST_SIZE, (BYTE *) sharedSecret);       
-
-  memset(&auth->HMAC, 0, sizeof(TPM_DIGEST));
-  auth->fContinueAuthSession = FALSE;
-   
-  vtpmloginfo(VTPM_LOG_VTSP_DEEP, "Auth Session: 0x%x opened by TPM_OSAP.\n", auth->AuthHandle);
-
-  goto egress;
-  
- abort_egress:
-  
- egress:
-  
-  return status;
-}
-
-
-TPM_RESULT VTSP_TerminateHandle(const TCS_CONTEXT_HANDLE hContext,
-                                const TCS_AUTH *auth) {
-
-  vtpmloginfo(VTPM_LOG_VTSP, "Terminate Handle.\n");
-  TPM_RESULT status = TPM_SUCCESS;
-  TPMTRYRETURN( TCSP_TerminateHandle(hContext, auth->AuthHandle) );
-
-  vtpmloginfo(VTPM_LOG_VTSP_DEEP, "Auth Session: 0x%x closed by TPM_TerminateHandle.\n", auth->AuthHandle);
-  goto egress;
-
- abort_egress:
-
- egress:
-
-  return status;
-}
-
-
-TPM_RESULT VTSP_ReadPubek(   const TCS_CONTEXT_HANDLE hContext,
-                             CRYPTO_INFO *crypto_info) {
-  
-  TPM_RESULT status;
-  TPM_NONCE antiReplay;
-  TPM_DIGEST   checksum;
-  BYTE *pubEKtext;
-  UINT32 pubEKtextsize;
-  
-  vtpmloginfo(VTPM_LOG_VTSP, "Reading Public EK.\n");
-  
-  // GenerateAuth new nonceOdd    
-  Crypto_GetRandom(&antiReplay, sizeof(TPM_NONCE) );
-  
-  
-  TPMTRYRETURN( TCSP_ReadPubek(  hContext,
-				 antiReplay,
-				 &pubEKtextsize,
-				 &pubEKtext,
-				 &checksum) );
-  
-  
-  // Extract the remaining output parameters
-  TPM_PUBKEY pubEK;
-  
-  BSG_Unpack(BSG_TPM_PUBKEY, pubEKtext, (BYTE *) &pubEK);
-  
-  // Build CryptoInfo for the bindingKey
-  TPM_RSA_KEY_PARMS rsaKeyParms;
-  
-  BSG_Unpack(BSG_TPM_RSA_KEY_PARMS, 
-	     pubEK.algorithmParms.parms, 
-	     &rsaKeyParms);
-  
-  Crypto_RSABuildCryptoInfoPublic(rsaKeyParms.exponentSize, 
-				  rsaKeyParms.exponent, 
-				  pubEK.pubKey.keyLength, 
-				  pubEK.pubKey.key, 
-				  crypto_info);
-    
-  // Destroy rsaKeyParms
-  BSG_Destroy(BSG_TPM_RSA_KEY_PARMS, &rsaKeyParms);
-
-  // Set encryption scheme
-  crypto_info->encScheme = CRYPTO_ES_RSAESOAEP_SHA1_MGF1;
-  //crypto_info->encScheme = pubEK.algorithmParms.encScheme;
-  crypto_info->algorithmID = pubEK.algorithmParms.algorithmID;
-  
-  goto egress;
-  
- abort_egress:
-  
- egress:
-  
-  return status;
-}
-
-TPM_RESULT VTSP_TakeOwnership(   const TCS_CONTEXT_HANDLE hContext,
-                                 const TPM_AUTHDATA *ownerAuth, 
-                                 const TPM_AUTHDATA *srkAuth,
-                                 CRYPTO_INFO *ek_cryptoInfo,
-                                 TCS_AUTH *auth) {
-  
-  vtpmloginfo(VTPM_LOG_VTSP, "Taking Ownership of TPM.\n");
-  
-  TPM_RESULT status = TPM_SUCCESS;
-  TPM_COMMAND_CODE command = TPM_ORD_TakeOwnership;
-  TPM_PROTOCOL_ID proto_id = TPM_PID_OWNER;
-  BYTE *new_srk;
-  
-  BYTE *paramText;        // Digest to make Auth.
-  UINT32 paramTextSize;
-  
-  // vars for srkpubkey parameter
-  TPM_KEY srkPub;
-  TPM_KEY_PARMS srkKeyInfo = {TPM_ALG_RSA, TPM_ES_RSAESOAEP_SHA1_MGF1, TPM_SS_NONE, 12, 0};
-  BYTE srkRSAkeyInfo[12] = { 0x00, 0x00, (RSA_KEY_SIZE >> 8), 0x00,   0x00, 0x00, 0x00, 0x02,   0x00, 0x00, 0x00, 0x00};
-  srkKeyInfo.parms = (BYTE *) &srkRSAkeyInfo;
-  
-  struct pack_buf_t srkText;
-  
-  //These values are accurate for an enc(AuthData).
-  struct pack_buf_t encOwnerAuth, encSrkAuth;
-  
-  encOwnerAuth.data = (BYTE *)malloc(sizeof(BYTE) * 256);
-  encSrkAuth.data = (BYTE *)malloc(sizeof(BYTE) * 256);
-  
-  if (encOwnerAuth.data == NULL || encSrkAuth.data == NULL) {
-    vtpmloginfo(VTPM_LOG_VTSP, "Could not malloc encrypted auths.\n");
-    status = TPM_RESOURCES;
-    goto abort_egress;
-  }
-  
-  Crypto_RSAEnc(ek_cryptoInfo, sizeof(TPM_SECRET), (BYTE *) ownerAuth, &encOwnerAuth.size, encOwnerAuth.data);
-  Crypto_RSAEnc(ek_cryptoInfo, sizeof(TPM_SECRET), (BYTE *) srkAuth, &encSrkAuth.size, encSrkAuth.data);
-  
-  
-  // Build srk public key struct
-  srkPub.ver = TPM_STRUCT_VER_1_1;
-  srkPub.keyUsage = TPM_KEY_STORAGE;
-  srkPub.keyFlags = 0x00;
-  srkPub.authDataUsage = TPM_AUTH_ALWAYS;
-  memcpy(&srkPub.algorithmParms, &srkKeyInfo, sizeof(TPM_KEY_PARMS));
-  srkPub.PCRInfoSize = 0;
-  srkPub.PCRInfo = 0;
-  srkPub.pubKey.keyLength= 0;
-  srkPub.encDataSize = 0;
-  
-  srkText.data = (BYTE *) malloc(sizeof(BYTE) * TCPA_MAX_BUFFER_LENGTH);
-  srkText.size = BSG_Pack(BSG_TPM_KEY, (BYTE *) &srkPub, srkText.data);
-  
-  paramText = (BYTE *) malloc(sizeof(BYTE) *  TCPA_MAX_BUFFER_LENGTH);
-  
-  paramTextSize = BSG_PackList(paramText, 5,
-			       BSG_TPM_COMMAND_CODE,&command,
-			       BSG_TPM_PROTOCOL_ID, &proto_id,
-			       BSG_TPM_SIZE32_DATA, &encOwnerAuth,
-			       BSG_TPM_SIZE32_DATA, &encSrkAuth,
-			       BSG_TPM_KEY, &srkPub);
-  
-  TPMTRYRETURN( GenerateAuth( paramText, paramTextSize, ownerAuth, auth) );
-  
-  new_srk = srkText.data;
-  TPMTRYRETURN( TCSP_TakeOwnership ( hContext,
-				     proto_id,
-				     encOwnerAuth.size, 
-				     encOwnerAuth.data,
-				     encSrkAuth.size,
-				     encSrkAuth.data,
-				     &srkText.size,
-				     &new_srk, 
-				     auth ) );
-  
-  
-  paramTextSize = BSG_PackList(paramText, 2, 
-			       BSG_TPM_RESULT, &status,
-			       BSG_TPM_COMMAND_CODE, &command);
-  memcpy(paramText + paramTextSize, new_srk, srkText.size);
-  paramTextSize += srkText.size;
-  
-  
-  TPMTRYRETURN( VerifyAuth(  paramText, paramTextSize,
-			     ownerAuth, auth, 
-			     hContext) );
-  
-  goto egress;
-  
- abort_egress:
-  
- egress:
-  
-  free(srkText.data);
-  free(encSrkAuth.data);
-  free(encOwnerAuth.data);
-  free(paramText);
-  
-  TCS_FreeMemory(hContext, new_srk);
-  
-  return status;
-}
-
-TPM_RESULT VTSP_DisablePubekRead( const TCS_CONTEXT_HANDLE    hContext,
-                                  const TPM_AUTHDATA          *ownerAuth, 
-                                  TCS_AUTH                    *auth) {
-  
-  vtpmloginfo(VTPM_LOG_VTSP, "Disabling Pubek Read.\n");
-  
-  TPM_RESULT status = TPM_SUCCESS;
-  TPM_COMMAND_CODE command = TPM_ORD_DisablePubekRead;
-  
-  BYTE *paramText;        // Digest to make Auth.
-  UINT32 paramTextSize;
-    
-  paramText = (BYTE *) malloc(sizeof(BYTE) * TCPA_MAX_BUFFER_LENGTH);
-  
-  paramTextSize = BSG_PackList(paramText, 1,
-			       BSG_TPM_COMMAND_CODE, &command);
-  
-  TPMTRYRETURN( GenerateAuth( paramText, paramTextSize,
-			      ownerAuth, auth) );
-  
-  // Call TCS
-  TPMTRYRETURN( TCSP_DisablePubekRead ( hContext, // in
-                                        auth) );
-  
-  // Verify Auth
-  paramTextSize = BSG_PackList(paramText, 2,
-			       BSG_TPM_RESULT, &status,
-			       BSG_TPM_COMMAND_CODE, &command);
-  
-  TPMTRYRETURN( VerifyAuth( paramText, paramTextSize,
-			    ownerAuth, auth, 
-			    hContext) );
-  goto egress;
-  
- abort_egress:
- egress:
-  free(paramText);
-  return status;
-}
-
-TPM_RESULT VTSP_CreateWrapKey(  const TCS_CONTEXT_HANDLE hContext,
-                                const TPM_KEY_USAGE      usage,
-                                const TPM_AUTHDATA       *newKeyAuth,
-                                const TCS_KEY_HANDLE     parentHandle, 
-                                const TPM_AUTHDATA       *osapSharedSecret,
-                                buffer_t                 *pubKeyBuf,
-                                TCS_AUTH                 *auth) {
-  
-  int i;
-  TPM_RESULT status = TPM_SUCCESS;
-  TPM_COMMAND_CODE command = TPM_ORD_CreateWrapKey;
-  
-  vtpmloginfo(VTPM_LOG_VTSP, "Creating new key of type %d.\n", usage);
-  
-  // vars for Calculate encUsageAuth
-  BYTE *paramText;      
-  UINT32 paramTextSize;
-  
-  // vars for Calculate encUsageAuth
-  BYTE XORbuffer[sizeof(TPM_SECRET) + sizeof(TPM_NONCE)];
-  TPM_DIGEST XORKey1;
-  UINT32 XORbufferSize;
-  TPM_SECRET encUsageAuth, encMigrationAuth;
-  
-  // vars for Flatten newKey prototype
-  BYTE *flatKey = (BYTE *) malloc(sizeof(BYTE) *  TCPA_MAX_BUFFER_LENGTH);
-  UINT32 flatKeySize = TCPA_MAX_BUFFER_LENGTH;                                    
-  struct pack_buf_t newKeyText;
-  
-  // Fill in newKey
-  TPM_KEY newKey;
-  
-  BYTE RSAkeyInfo[12] = { 0x00, 0x00, (RSA_KEY_SIZE >> 8), 0x00,   0x00, 0x00, 0x00, 0x02,   0x00, 0x00, 0x00, 0x00};
-  newKey.algorithmParms.algorithmID = TPM_ALG_RSA;
-  newKey.algorithmParms.parms = (BYTE *) &RSAkeyInfo;
-  newKey.algorithmParms.parmSize = 12;
-  
-  switch (usage) {
-  case TPM_KEY_SIGNING:
-    vtpmloginfo(VTPM_LOG_VTSP, "Creating Signing Key...\n");
-    newKey.keyUsage = TPM_KEY_SIGNING;
-    newKey.algorithmParms.encScheme = TPM_ES_NONE;
-    newKey.algorithmParms.sigScheme = TPM_SS_RSASSAPKCS1v15_SHA1;
-    break;
-  case TPM_KEY_STORAGE:
-    vtpmloginfo(VTPM_LOG_VTSP, "Creating Storage Key...\n");
-    newKey.keyUsage = TPM_KEY_STORAGE;
-    newKey.algorithmParms.encScheme = TPM_ES_RSAESOAEP_SHA1_MGF1;
-    newKey.algorithmParms.sigScheme = TPM_SS_NONE;
-    break;
-  case TPM_KEY_BIND:
-    vtpmloginfo(VTPM_LOG_VTSP, "Creating Binding Key...\n");
-    newKey.keyUsage = TPM_KEY_BIND;
-    newKey.algorithmParms.encScheme = TPM_ES_RSAESOAEP_SHA1_MGF1;
-    newKey.algorithmParms.sigScheme = TPM_SS_NONE;
-    break;
-  default:
-    vtpmloginfo(VTPM_LOG_VTSP, "Cannot create key. Invalid Key Type.\n");
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-  
-  
-  newKey.ver = TPM_STRUCT_VER_1_1;
-  
-  newKey.keyFlags = 0;
-  newKey.authDataUsage = TPM_AUTH_ALWAYS;
-  newKey.pubKey.keyLength= 0;
-  newKey.encDataSize = 0;
-  newKey.encData = NULL;
-  
-  // FIXME: Support PCR bindings
-  newKey.PCRInfoSize = 0;
-  newKey.PCRInfo = NULL;
-  
-  // Calculate encUsageAuth                                    
-  XORbufferSize = BSG_PackList(  XORbuffer, 2, 
-				 BSG_TPM_SECRET, osapSharedSecret,
-				 BSG_TPM_NONCE, &auth->NonceEven);
-  Crypto_SHA1Full(XORbuffer, XORbufferSize, (BYTE *) &XORKey1);
-  
-  // FIXME: No support for migratable keys.
-  for (i=0; i < TPM_DIGEST_SIZE; i++) 
-    ((BYTE *) &encUsageAuth)[i] = ((BYTE *) &XORKey1)[i] ^ ((BYTE *) newKeyAuth)[i];
-  
-  // Flatten newKey prototype
-  flatKeySize = BSG_Pack(BSG_TPM_KEY, (BYTE *) &newKey, flatKey);
-  newKeyText.data = flatKey;
-  newKeyText.size = flatKeySize;
-  
-  // Generate HMAC
-  paramText = (BYTE *) malloc(sizeof(BYTE) * TCPA_MAX_BUFFER_LENGTH);
-  
-  paramTextSize = BSG_PackList(paramText, 3,
-			       BSG_TPM_COMMAND_CODE, &command,
-			       BSG_TPM_AUTHDATA, &encUsageAuth,
-			       BSG_TPM_AUTHDATA, &encMigrationAuth);
-  memcpy(paramText + paramTextSize, newKeyText.data, newKeyText.size);
-  paramTextSize += newKeyText.size;
-  
-  
-  TPMTRYRETURN( GenerateAuth( paramText, paramTextSize,
-			      osapSharedSecret, auth) );
-  
-  // Call TCS
-  TPMTRYRETURN( TCSP_CreateWrapKey(  hContext, 
-				     parentHandle,
-				     encUsageAuth,
-				     encMigrationAuth,
-				     &newKeyText.size,
-				     &newKeyText.data,
-				     auth) );
-  
-  // Verify Auth
-  paramTextSize = BSG_PackList(paramText, 2,
-			       BSG_TPM_RESULT, &status,
-			       BSG_TPM_COMMAND_CODE, &command);
-  memcpy(paramText + paramTextSize, newKeyText.data, newKeyText.size);
-  paramTextSize += newKeyText.size;
-  
-  TPMTRYRETURN( VerifyAuth( paramText, paramTextSize,
-			    osapSharedSecret, auth, 0) );
-  
-  // Unpack/return key structure
-  TPMTRYRETURN(buffer_init(pubKeyBuf, 0, 0) );
-  TPMTRYRETURN(buffer_append_raw(pubKeyBuf, newKeyText.size, newKeyText.data) );
-  
-  goto egress;
-  
- abort_egress:
-  
- egress:
-  
-  free(flatKey);
-  free(paramText);
-  TCS_FreeMemory(hContext, newKeyText.data);
-  
-  return status;
-}
-
-TPM_RESULT VTSP_LoadKey(const TCS_CONTEXT_HANDLE    hContext,
-                        const TCS_KEY_HANDLE        hUnwrappingKey,
-                        const buffer_t              *rgbWrappedKeyBlob,
-                        const TPM_AUTHDATA          *parentAuth,
-                        TPM_HANDLE                  *newKeyHandle,
-                        TCS_AUTH                    *auth,
-                        CRYPTO_INFO                 *cryptoinfo,
-                        const BOOL                  skipTPMLoad) { 
-  
-  
-  vtpmloginfo(VTPM_LOG_VTSP, "Loading Key %s.\n", (!skipTPMLoad ? "into TPM" : "only into memory"));
-  
-  TPM_RESULT status = TPM_SUCCESS;
-  TPM_COMMAND_CODE command = TPM_ORD_LoadKey;
-
-  BYTE *paramText=NULL;        // Digest to make Auth.
-  UINT32 paramTextSize;
-
-  // SkipTPMLoad stops key from being loaded into TPM, but still generates CRYPTO_INFO for it
-  if (! skipTPMLoad) { 
-  
-    if ((rgbWrappedKeyBlob == NULL) || (parentAuth == NULL) || 
-        (newKeyHandle==NULL) || (auth==NULL)) {
-      status = TPM_BAD_PARAMETER;
-      goto abort_egress;
-    }
-  
-    // Generate Extra TCS Parameters
-    TPM_HANDLE phKeyHMAC;
-  
-    paramText = (BYTE *) malloc(sizeof(BYTE) *  TCPA_MAX_BUFFER_LENGTH);
-  
-    paramTextSize = BSG_PackList(paramText, 1,
-  			         BSG_TPM_COMMAND_CODE, &command);
-  
-    memcpy(paramText + paramTextSize, rgbWrappedKeyBlob->bytes, buffer_len(rgbWrappedKeyBlob));
-    paramTextSize += buffer_len(rgbWrappedKeyBlob);
-  
-    TPMTRYRETURN( GenerateAuth( paramText, paramTextSize,
-			      parentAuth, auth) );
-  
-    // Call TCS
-    TPMTRYRETURN( TCSP_LoadKeyByBlob(  hContext,
-				       hUnwrappingKey,
-				       buffer_len(rgbWrappedKeyBlob),
-				       rgbWrappedKeyBlob->bytes,
-				       auth,
-				       newKeyHandle,
-				       &phKeyHMAC) );
-  
-    // Verify Auth
-    paramTextSize = BSG_PackList(paramText, 3,
-			         BSG_TPM_RESULT, &status,
-			         BSG_TPM_COMMAND_CODE, &command,
-			         BSG_TPM_HANDLE, newKeyHandle);
-  
-    TPMTRYRETURN( VerifyAuth( paramText, paramTextSize,
-			      parentAuth, auth, 
-			      hContext) );
-  } 
-  
-  // Build cryptoinfo structure for software crypto function. 
-  if (cryptoinfo != NULL) {
-    TPM_KEY newKey;
-    
-    // Unpack/return key structure
-    BSG_Unpack(BSG_TPM_KEY, rgbWrappedKeyBlob->bytes , &newKey);
-    TPM_RSA_KEY_PARMS rsaKeyParms;
-    
-    BSG_Unpack(BSG_TPM_RSA_KEY_PARMS, 
-	       newKey.algorithmParms.parms, 
-	       &rsaKeyParms);
-    
-    Crypto_RSABuildCryptoInfoPublic(rsaKeyParms.exponentSize, 
-				    rsaKeyParms.exponent, 
-				    newKey.pubKey.keyLength, 
-				    newKey.pubKey.key, 
-				    cryptoinfo);
-    
-    // Destroy rsaKeyParms
-    BSG_Destroy(BSG_TPM_RSA_KEY_PARMS, &rsaKeyParms);
-    
-    // Set encryption scheme
-    cryptoinfo->encScheme = CRYPTO_ES_RSAESOAEP_SHA1_MGF1;
-  }
-  
-  goto egress;
-  
- abort_egress:
-  
- egress:
-  
-  free(paramText);
-  return status;
-}
-
-TPM_RESULT VTSP_Unbind( const TCS_CONTEXT_HANDLE    hContext,
-                        const TPM_KEY_HANDLE        key_handle,
-                        const buffer_t              *bound_data,
-                        const TPM_AUTHDATA          *usage_auth,
-                        buffer_t                    *clear_data,
-                        TCS_AUTH                    *auth) {
-  
-  vtpmloginfo(VTPM_LOG_VTSP, "Unbinding %d bytes of data.\n", buffer_len(bound_data));
-  
-  TPM_RESULT status = TPM_SUCCESS;
-  TPM_COMMAND_CODE command = TPM_ORD_UnBind;
-  
-  BYTE *paramText;        // Digest to make Auth.
-  UINT32 paramTextSize;
-  
-  // Generate Extra TCS Parameters
-  struct pack_buf_t clear_data32;
-  BYTE *clear_data_text;
-  UINT32 clear_data_size;
-  
-  struct pack_buf_t bound_data32 = {bound_data->size, bound_data->bytes};
-  
-  paramText = (BYTE *) malloc(sizeof(BYTE) * TCPA_MAX_BUFFER_LENGTH);
-  
-  paramTextSize = BSG_PackList(paramText, 2,
-			       BSG_TPM_COMMAND_CODE, &command,
-			       BSG_TPM_SIZE32_DATA, &bound_data32);
-  
-  TPMTRYRETURN( GenerateAuth( paramText, paramTextSize,
-			      usage_auth, auth) );
-  
-  // Call TCS
-  TPMTRYRETURN( TCSP_UnBind( hContext,
-			     key_handle,
-			     buffer_len(bound_data),
-			     bound_data->bytes,
-			     auth,
-			     &clear_data_size,
-			     &clear_data_text) );
-  
-  
-  // Verify Auth
-  clear_data32.size = clear_data_size;
-  clear_data32.data = clear_data_text;
-  paramTextSize = BSG_PackList(paramText, 3,
-			       BSG_TPM_RESULT, &status,
-			       BSG_TPM_COMMAND_CODE, &command,
-			       BSG_TPM_SIZE32_DATA, &clear_data32);
-  
-  TPMTRYRETURN( VerifyAuth( paramText, paramTextSize,
-			    usage_auth, auth, 
-			    hContext) );
-  
-  // Unpack/return key structure
-  TPMTRYRETURN(buffer_init(clear_data, 0, 0));
-  TPMTRYRETURN(buffer_append_raw (clear_data, clear_data_size, clear_data_text) );
-  
-  goto egress;
-  
- abort_egress:
-  
- egress:
-  
-  free(paramText);
-  TCS_FreeMemory(hContext, clear_data_text);
-  
-  return status;
-}
-
-TPM_RESULT VTSP_Bind(   CRYPTO_INFO *cryptoInfo, 
-			const buffer_t *inData, 
-			buffer_t *outData)               
-{
-  vtpmloginfo(VTPM_LOG_VTSP, "Binding %d bytes of data.\n", buffer_len(inData));
-  TPM_RESULT status = TPM_SUCCESS;
-  TPM_BOUND_DATA boundData;
-  UINT32 i;
-  
-  // Fill boundData's accessory information
-  boundData.ver = TPM_STRUCT_VER_1_1;
-  boundData.payload = TPM_PT_BIND;
-  boundData.payloadData = inData->bytes;
-  
-  // Pack boundData before encryption
-  BYTE* flatBoundData = (BYTE *)malloc(sizeof(BYTE) * 
-				       (sizeof(TPM_VERSION) +
-					sizeof(TPM_PAYLOAD_TYPE) +
-					buffer_len(inData)));
-  if (flatBoundData == NULL) {
-    return TPM_NOSPACE;
-  }
-  UINT32 flatBoundDataSize = 0;
-  flatBoundDataSize = BSG_PackList(  flatBoundData, 2, 
-				     BSG_TPM_VERSION, &boundData.ver, 
-				     BSG_TYPE_BYTE, &boundData.payload);
-  
-  memcpy(flatBoundData+flatBoundDataSize, inData->bytes, buffer_len(inData));
-  flatBoundDataSize += buffer_len(inData);
-  
-  BYTE out_tmp[RSA_KEY_SIZE/8]; // RSAEnc does not do blocking, So this is what will come out.
-  UINT32 out_tmp_size;
-  
-  // Encrypt flatBoundData
-  TPMTRY(TPM_ENCRYPT_ERROR, Crypto_RSAEnc( cryptoInfo, 
-                                           flatBoundDataSize, 
-                                           flatBoundData, 
-                                           &out_tmp_size, 
-                                           out_tmp) );
-  
-  if (out_tmp_size > RSA_KEY_SIZE/8) {
-    // The result of RSAEnc should be a fixed size based on key size.
-    vtpmlogerror(VTPM_LOG_VTSP, "Enc buffer just overflowed.\n");
-  }
-  
-  buffer_init(outData, 0, NULL);
-  buffer_append_raw(outData, out_tmp_size, out_tmp);
-  
-  vtpmloginfo(VTPM_LOG_TXDATA, "Bind Generated[%d] = 0x", out_tmp_size);
-  for(i = 0 ; i < out_tmp_size ; i++) {
-    vtpmloginfomore(VTPM_LOG_TXDATA, "%2.2x ", out_tmp[i]);
-  }
-  vtpmloginfomore(VTPM_LOG_TXDATA, "\n");
-
-  goto egress;
-  abort_egress: 
-  egress:
- 
-  // Free flatBoundData
-  free(flatBoundData);
-  
-  return TPM_SUCCESS;
-}
-
-TPM_RESULT VTSP_Seal(const TCS_CONTEXT_HANDLE    hContext,
-                     const TPM_KEY_HANDLE        keyHandle,
-                     const TPM_AUTHDATA          *sealDataAuth,
-                     const TPM_PCR_COMPOSITE     *pcrComp,
-                     const buffer_t              *inData,
-                     TPM_STORED_DATA             *sealedData,                                   
-                     const TPM_SECRET            *osapSharedSecret,
-                     TCS_AUTH                    *auth) {
-
-  TPM_RESULT status = TPM_SUCCESS;
-  TPM_COMMAND_CODE command = TPM_ORD_Seal;
-
-  BYTE *paramText;        // Digest to make Auth.
-  UINT32 paramTextSize;
-
-  // Generate PCR_Info Struct from Comp
-  TPM_PCR_INFO pcrInfo;
-  UINT32 pcrInfoSize, flatpcrSize;
-  BYTE flatpcr[3 +                          // PCR_Select = 3 1 byte banks
-               sizeof(UINT16) +             //              2 byte UINT16
-               sizeof(UINT32) +             // PCR_Comp   = 4 byte UINT32
-               24 * sizeof(TPM_PCRVALUE) ]; //              up to 24 PCRs
-
-  if (pcrComp != NULL) {
-      //printf("\n\tBinding to PCRs: ");
-      //for(int i = 0 ; i < pcrComp->select.sizeOfSelect ; i++)
-      //printf("%2.2x", pcrComp->select.pcrSelect[i]);
-
-      memcpy(&pcrInfo.pcrSelection, &pcrComp->select, sizeof(TPM_PCR_SELECTION));
-
-      flatpcrSize = BSG_Pack(BSG_TPM_PCR_COMPOSITE, (BYTE *) pcrComp, flatpcr);
-      Crypto_SHA1Full((BYTE *) flatpcr, flatpcrSize, (BYTE *) &(pcrInfo.digestAtRelease));
-      memset(&(pcrInfo.digestAtCreation), 0, sizeof(TPM_DIGEST));
-      pcrInfoSize = BSG_Pack(BSG_TPM_PCR_INFO, (BYTE *) &pcrInfo, flatpcr);
-  } else {
-      //printf("\n\tBinding to no PCRS.");
-      pcrInfoSize = 0;
-  }
-
-  // Calculate encUsageAuth
-  BYTE XORbuffer[sizeof(TPM_SECRET) + sizeof(TPM_NONCE)];
-  UINT32 XORbufferSize = sizeof(XORbuffer);
-  TPM_DIGEST XORKey;
-  TPM_ENCAUTH encAuth;
-
-  BSG_PackList( XORbuffer, 2,
-                BSG_TPM_SECRET, osapSharedSecret,
-                BSG_TPM_NONCE, &auth->NonceEven );
-
-  Crypto_SHA1Full(XORbuffer, XORbufferSize, (BYTE *) &XORKey);
-

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 16:22:33 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 16:22: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 1TYJFw-0004Kt-LB; Tue, 13 Nov 2012 16:22:32 +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 1TYJFt-0004JX-1Y
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:30 +0000
Received: from [193.109.254.147:63011] by server-14.bemta-14.messagelabs.com
	id 8B/1F-14517-4C372A05; Tue, 13 Nov 2012 16:22:28 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-27.messagelabs.com!1352823732!10806758!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-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8563 invoked from network); 13 Nov 2012 16:22:13 -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;
	13 Nov 2012 16: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 1TYJFb-00037u-QR
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYJFb-0006ia-L6
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 16:22:11 +0000
Message-Id: <E1TYJFb-0006ia-L6@xenbits.xen.org>
Date: Tue, 13 Nov 2012 16:22:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: Remove the vtpm process model
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1352803620 0
# Node ID 170d45f7a2ebde462743d98c77a1d10ee0f51a29
# Parent  2a4c1d3a080e7d3b20354155b6ac09e53d812cc6
tools: Remove the vtpm process model

Remove the old vtpm process model. It doesn't work very
well and is no longer supported.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/Makefile
--- a/tools/Makefile	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/Makefile	Tue Nov 13 10:47:00 2012 +0000
@@ -18,8 +18,6 @@ SUBDIRS-$(CONFIG_XCUTILS) += xcutils
 SUBDIRS-$(CONFIG_X86) += firmware
 SUBDIRS-y += console
 SUBDIRS-y += xenmon
-SUBDIRS-$(VTPM_TOOLS) += vtpm_manager
-SUBDIRS-$(VTPM_TOOLS) += vtpm
 SUBDIRS-y += xenstat
 SUBDIRS-$(CONFIG_Linux) += $(SUBDIRS-libaio)
 SUBDIRS-$(CONFIG_Linux) += memshr 
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/blktap2/drivers/hashtable.c
--- a/tools/blktap2/drivers/hashtable.c	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/blktap2/drivers/hashtable.c	Tue Nov 13 10:47:00 2012 +0000
@@ -3,7 +3,6 @@
 /*
  * There are duplicates of this code in:
  *  - tools/xenstore/hashtable.c
- *  - tools/vtpm_manager/util/hashtable.c
  */
 
 #include "hashtable.h"
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/blktap2/drivers/hashtable.h
--- a/tools/blktap2/drivers/hashtable.h	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/blktap2/drivers/hashtable.h	Tue Nov 13 10:47:00 2012 +0000
@@ -3,7 +3,6 @@
 /*
  * There are duplicates of this code in:
  *  - tools/xenstore/hashtable.h
- *  - tools/vtpm_manager/util/hashtable.h
  */
 
 #ifndef __HASHTABLE_CWC22_H__
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/blktap2/drivers/hashtable_itr.c
--- a/tools/blktap2/drivers/hashtable_itr.c	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/blktap2/drivers/hashtable_itr.c	Tue Nov 13 10:47:00 2012 +0000
@@ -1,10 +1,5 @@
 /* Copyright (C) 2002, 2004 Christopher Clark  <firstname.lastname@cl.cam.ac.uk> */
 
-/*
- * There are duplicates of this code in:
- *  - tools/vtpm_manager/util/hashtable_itr.c
- */
-
 #include "hashtable.h"
 #include "hashtable_private.h"
 #include "hashtable_itr.h"
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/blktap2/drivers/hashtable_itr.h
--- a/tools/blktap2/drivers/hashtable_itr.h	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/blktap2/drivers/hashtable_itr.h	Tue Nov 13 10:47:00 2012 +0000
@@ -1,10 +1,5 @@
 /* Copyright (C) 2002, 2004 Christopher Clark <firstname.lastname@cl.cam.ac.uk> */
 
-/*
- * There are duplicates of this code in:
- *  - tools/vtpm_manager/util/hashtable_itr.h
- */
-
 #ifndef __HASHTABLE_ITR_CWC22__
 #define __HASHTABLE_ITR_CWC22__
 #include "hashtable.h"
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/blktap2/drivers/hashtable_private.h
--- a/tools/blktap2/drivers/hashtable_private.h	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/blktap2/drivers/hashtable_private.h	Tue Nov 13 10:47:00 2012 +0000
@@ -3,7 +3,6 @@
 /*
  * There are duplicates of this code in:
  *  - tools/xenstore/hashtable_private.h
- *  - tools/vtpm_manager/util/hashtable_private.h
  */
 
 #ifndef __HASHTABLE_PRIVATE_CWC22_H__
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/configure.ac
--- a/tools/configure.ac	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/configure.ac	Tue Nov 13 10:47:00 2012 +0000
@@ -40,7 +40,6 @@ m4_include([m4/fetcher.m4])
 # Enable/disable options
 AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
 AX_ARG_DEFAULT_ENABLE([monitors], [Disable xenstat and xentop monitoring tools])
-AX_ARG_DEFAULT_DISABLE([vtpm], [Enable Virtual Trusted Platform Module])
 AX_ARG_DEFAULT_DISABLE([xenapi], [Enable Xen API Bindings])
 AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools])
 AX_ARG_DEFAULT_DISABLE([miniterm], [Enable miniterm])
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/examples/README
--- a/tools/examples/README	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/examples/README	Tue Nov 13 10:47:00 2012 +0000
@@ -25,13 +25,7 @@ vif-bridge          - virtual network st
 vif-common.sh       - sourced by vif-bridge 
 vif-nat             - xen virtual network start/stop script in NAT mode 
 vif-route           - xen virtual network start/stop script in routed mode
-vtpm                - called by xen-backend.agent to bind/unbind vTPM devices
-vtpm-common.sh      - common code for vTPM handling
-vtpm-delete         - remove an entry from the vTPM table given the
-                      domain's name
-vtpm-hotplug-common.sh - sourced by vtpm
-vtpm-migration.sh   - sourced by external-device-migrate
-xen-backend.agent   - calls block, vif-*, vtpm scripts to add, remove, hotplug
+xen-backend.agent   - calls block, vif-* scripts to add, remove, hotplug
                       devices  
 xen-backend.rules   - hotplug script rules
 xend-config.sxp     - default xend configuration file
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/examples/xmexample.pv-grub
--- a/tools/examples/xmexample.pv-grub	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/examples/xmexample.pv-grub	Tue Nov 13 10:47:00 2012 +0000
@@ -105,20 +105,6 @@ disk = [ 'phy:hda1,hda1,w' ]
 # configured in xend-config.sxp.
 
 #----------------------------------------------------------------------------
-# Define to which TPM instance the user domain should communicate.
-# The vtpm entry is of the form 'instance=INSTANCE,backend=DOM'
-# where INSTANCE indicates the instance number of the TPM the VM
-# should be talking to and DOM provides the domain where the backend
-# is located.
-# Note that no two virtual machines should try to connect to the same
-# TPM instance. The handling of all TPM instances does require
-# some management effort in so far that VM configration files (and thus
-# a VM) should be associated with a TPM instance throughout the lifetime
-# of the VM / VM configuration file. The instance number must be
-# greater or equal to 1.
-#vtpm = [ 'instance=1,backend=0' ]
-
-#----------------------------------------------------------------------------
 # Configure the behaviour when a domain exits.  There are three 'reasons'
 # for a domain to stop: poweroff, reboot, and crash.  For each of these you
 # may specify:
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/examples/xmexample1
--- a/tools/examples/xmexample1	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/examples/xmexample1	Tue Nov 13 10:47:00 2012 +0000
@@ -101,20 +101,6 @@ disk = [ 'phy:hda1,hda1,w' ]
 # configured in xend-config.sxp.
 
 #----------------------------------------------------------------------------
-# Define to which TPM instance the user domain should communicate.
-# The vtpm entry is of the form 'instance=INSTANCE,backend=DOM'
-# where INSTANCE indicates the instance number of the TPM the VM
-# should be talking to and DOM provides the domain where the backend
-# is located.
-# Note that no two virtual machines should try to connect to the same
-# TPM instance. The handling of all TPM instances does require
-# some management effort in so far that VM configration files (and thus
-# a VM) should be associated with a TPM instance throughout the lifetime
-# of the VM / VM configuration file. The instance number must be
-# greater or equal to 1.
-#vtpm = [ 'instance=1,backend=0' ]
-
-#----------------------------------------------------------------------------
 # Set the kernel command line for the new domain.
 # You only need to define the IP parameters and hostname if the domain's
 # IP config doesn't, e.g. in ifcfg-eth0 or via DHCP.
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/examples/xmexample2
--- a/tools/examples/xmexample2	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/examples/xmexample2	Tue Nov 13 10:47:00 2012 +0000
@@ -137,20 +137,6 @@ disk = [ 'phy:sda%d,sda1,w' % (7+vmid),
 # configured in xend-config.sxp.
 
 #----------------------------------------------------------------------------
-# Define to which TPM instance the user domain should communicate.
-# The vtpm entry is of the form 'instance=INSTANCE,backend=DOM'
-# where INSTANCE indicates the instance number of the TPM the VM
-# should be talking to and DOM provides the domain where the backend
-# is located.
-# Note that no two virtual machines should try to connect to the same
-# TPM instance. The handling of all TPM instances does require
-# some management effort in so far that VM configration files (and thus
-# a VM) should be associated with a TPM instance throughout the lifetime
-# of the VM / VM configuration file. The instance number must be
-# greater or equal to 1.
-#vtpm = ['instance=%d,backend=0' % (vmid) ]
-
-#----------------------------------------------------------------------------
 # Set the kernel command line for the new domain.
 # You only need to define the IP parameters and hostname if the domain's
 # IP config doesn't, e.g. in ifcfg-eth0 or via DHCP.
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/examples/xmexample3
--- a/tools/examples/xmexample3	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/examples/xmexample3	Tue Nov 13 10:47:00 2012 +0000
@@ -122,20 +122,6 @@ disk = [ 'phy:hda%d,hda1,w' % (vmid)]
 # configured in xend-config.sxp.
 
 #----------------------------------------------------------------------------
-# Define to which TPM instance the user domain should communicate.
-# The vtpm entry is of the form 'instance=INSTANCE,backend=DOM'
-# where INSTANCE indicates the instance number of the TPM the VM
-# should be talking to and DOM provides the domain where the backend
-# is located.
-# Note that no two virtual machines should try to connect to the same
-# TPM instance. The handling of all TPM instances does require
-# some management effort in so far that VM configration files (and thus
-# a VM) should be associated with a TPM instance throughout the lifetime
-# of the VM / VM configuration file. The instance number must be
-# greater or equal to 1.
-#vtpm = ['instance=%d,backend=0' % (vmid) ]
-
-#----------------------------------------------------------------------------
 # Set the kernel command line for the new domain.
 # You only need to define the IP parameters and hostname if the domain's
 # IP config doesn't, e.g. in ifcfg-eth0 or via DHCP.
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/hotplug/Linux/Makefile
--- a/tools/hotplug/Linux/Makefile	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/hotplug/Linux/Makefile	Tue Nov 13 10:47:00 2012 +0000
@@ -18,14 +18,12 @@ XEN_SCRIPTS += vif-setup
 XEN_SCRIPTS += block
 XEN_SCRIPTS += block-enbd block-nbd
 XEN_SCRIPTS += blktap
-XEN_SCRIPTS += vtpm vtpm-delete
 XEN_SCRIPTS += xen-hotplug-cleanup
 XEN_SCRIPTS += external-device-migrate
 XEN_SCRIPTS += vscsi
 XEN_SCRIPT_DATA = xen-script-common.sh locking.sh logging.sh
 XEN_SCRIPT_DATA += xen-hotplug-common.sh xen-network-common.sh vif-common.sh
-XEN_SCRIPT_DATA += block-common.sh vtpm-common.sh vtpm-hotplug-common.sh
-XEN_SCRIPT_DATA += vtpm-migration.sh vtpm-impl
+XEN_SCRIPT_DATA += block-common.sh
 
 UDEV_RULES_DIR = $(CONFIG_DIR)/udev
 UDEV_RULES = xen-backend.rules xend.rules
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/hotplug/Linux/vtpm
--- a/tools/hotplug/Linux/vtpm	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-#!/bin/bash
-
-dir=$(dirname "$0")
-. "$dir/vtpm-hotplug-common.sh"
-
-vtpm_fatal_error=0
-
-case "$command" in
-  add)
-    vtpm_create_instance
-  ;;
-  remove)
-    vtpm_remove_instance
-  ;;
-esac
-
-if [ $vtpm_fatal_error -eq 0 ]; then
-	log debug "Successful vTPM operation '$command'."
-	success
-else
-	fatal "Error while executing vTPM operation '$command'."
-fi
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/hotplug/Linux/vtpm-common.sh
--- a/tools/hotplug/Linux/vtpm-common.sh	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,448 +0,0 @@
-#
-# Copyright (c) 2005 IBM Corporation
-# Copyright (c) 2005 XenSource Ltd.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of version 2.1 of the GNU Lesser General Public
-# License as published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-#
-
-dir=$(dirname "$0")
-. "$dir/logging.sh"
-. "$dir/locking.sh"
-
-VTPMDB="/var/vtpm/vtpm.db"
-
-#In the vtpm-impl file some commands should be defined:
-#      vtpm_create, vtpm_setup, vtpm_start, etc. (see below)
-if [ -r "$dir/vtpm-impl.alt" ]; then
-	. "$dir/vtpm-impl.alt"
-elif [ -r "$dir/vtpm-impl" ]; then
-	. "$dir/vtpm-impl"
-else
-	function vtpm_create () {
-		true
-	}
-	function vtpm_setup() {
-		true
-	}
-	function vtpm_start() {
-		true
-	}
-	function vtpm_suspend() {
-		true
-	}
-	function vtpm_resume() {
-		true
-	}
-	function vtpm_delete() {
-		true
-	}
-	function vtpm_migrate() {
-		echo "Error: vTPM migration accross machines not implemented."
-	}
-	function vtpm_migrate_local() {
-		echo "Error: local vTPM migration not supported"
-	}
-	function vtpm_migrate_recover() {
-		true
-	}
-fi
-
-
-#Find the instance number for the vtpm given the name of the domain
-# Parameters
-# - vmname : the name of the vm
-# Return value
-#  Returns '0' if instance number could not be found, otherwise
-#  it returns the instance number in the variable 'instance'
-function vtpmdb_find_instance () {
-	local vmname ret instance
-	vmname=$1
-	ret=0
-
-	instance=$(cat $VTPMDB |                   \
-	          awk -vvmname=$vmname             \
-	          '{                               \
-	             if ( 1 != index($1,"#")) {    \
-	               if ( $1 == vmname ) {       \
-	                 print $2;                 \
-	                 exit;                     \
-	               }                           \
-	             }                             \
-	           }')
-	if [ "$instance" != "" ]; then
-		ret=$instance
-	fi
-	echo "$ret"
-}
-
-
-# Check whether a particular instance number is still available
-# returns "0" if it is not available, "1" otherwise.
-function vtpmdb_is_free_instancenum () {
-	local instance instances avail i
-	instance=$1
-	avail=1
-	#Allowed instance number range: 1-255
-	if [ $instance -eq 0 -o $instance -gt 255 ]; then
-		avail=0
-	else
-		instances=$(cat $VTPMDB |                \
-		           awk                          \
-		           '{                            \
-		               if (1 != index($1,"#")) { \
-		                 printf("%s ",$2);       \
-		               }                         \
-		            }')
-		for i in $instances; do
-			if [ $i -eq $instance ]; then
-				avail=0
-				break
-			fi
-		done
-	fi
-	echo "$avail"
-}
-
-
-# Get an available instance number given the database
-# Returns an unused instance number
-function vtpmdb_get_free_instancenum () {
-	local ctr instances don found
-	instances=$(cat $VTPMDB |                \
-	           awk                          \
-	           '{                            \
-	               if (1 != index($1,"#")) { \
-	                 printf("%s ",$2);       \
-	               }                         \
-	            }')
-	ctr=1
-	don=0
-	while [ $don -eq 0 ]; do
-		found=0
-		for i in $instances; do
-			if [ $i -eq $ctr ]; then
-				found=1;
-				break;
-			fi
-		done
-
-		if [ $found -eq 0 ]; then
-			don=1
-			break
-		fi
-		let ctr=ctr+1
-	done
-	echo "$ctr"
-}
-
-
-# Add a domain name and instance number to the DB file
-function vtpmdb_add_instance () {
-	local res vmname inst
-	vmname=$1
-	inst=$2
-
-	if [ ! -f $VTPMDB ]; then
-		echo "#Database for VM to vTPM association" > $VTPMDB
-		echo "#1st column: domain name" >> $VTPMDB
-		echo "#2nd column: TPM instance number" >> $VTPMDB
-	fi
-	res=$(vtpmdb_validate_entry $vmname $inst)
-	if [ $res -eq 0 ]; then
-		echo "$vmname $inst" >> $VTPMDB
-	fi
-}
-
-
-#Validate whether an entry is the same as passed to this
-#function
-function vtpmdb_validate_entry () {
-	local res rc vmname inst
-	rc=0
-	vmname=$1
-	inst=$2
-
-	res=$(cat $VTPMDB |            \
-	     awk -vvmname=$vmname     \
-	          -vinst=$inst         \
-	     '{                        \
-	         if ( 1 == index($1,"#")) {\
-	         } else                \
-	         if ( $1 == vmname &&  \
-	              $2 == inst) {    \
-	            printf("1");       \
-	            exit;              \
-	         } else                \
-	         if ( $1 == vmname ||  \
-	              $2 == inst) {    \
-	            printf("2");       \
-	            exit;              \
-	         }                     \
-	     }')
-
-	if [ "$res" == "1" ]; then
-		rc=1
-	elif [ "$res" == "2" ]; then
-		rc=2
-	fi
-	echo "$rc"
-}
-
-
-#Remove an entry from the vTPM database given its domain name
-#and instance number
-function vtpmdb_remove_entry () {
-	local vmname instance VTPMDB_TMP
-	vmname=$1
-	instance=$2
-	VTPMDB_TMP="$VTPMDB".tmp
-
-	$(cat $VTPMDB |            \
-	 awk -vvmname=$vmname     \
-	 '{                        \
-	    if ( $1 != vmname ) {  \
-	      print $0;            \
-	    }                      \
-	 '} > $VTPMDB_TMP)
-	if [ -e $VTPMDB_TMP ]; then
-		mv -f $VTPMDB_TMP $VTPMDB
-		vtpm_delete $instance
-	else
-		log err "Error creating temporary file '$VTPMDB_TMP'."
-	fi
-}
-
-
-# Find the reason for the creation of this device:
-# Returns 'resume' or 'create'
-function vtpm_get_create_reason () {
-	local resume
-	resume=$(xenstore_read $XENBUS_PATH/resume)
-	if [ "$resume" == "True" ]; then
-		echo "resume"
-	else
-		echo "create"
-	fi
-}
-
-
-#Create a vTPM instance
-# If no entry in the TPM database is found, the instance is
-# created and an entry added to the database.
-function vtpm_create_instance () {
-	local res instance domname reason uuid
-	uuid=$(xenstore_read "$XENBUS_PATH"/uuid)
-	reason=$(vtpm_get_create_reason)
-
-	claim_lock vtpmdb
-
-	instance="0"
-
-	if [ "$uuid" != "" ]; then
-		instance=$(vtpmdb_find_instance $uuid)
-	fi
-	if [ "$instance" == "0" ]; then
-		domname=$(xenstore_read "$XENBUS_PATH"/domain)
-		instance=$(vtpmdb_find_instance $domname)
-	fi
-
-	if [ "$instance" == "0" -a "$reason" != "create" ]; then
-		release_lock vtpmdb
-		return
-	fi
-
-	if [ "$instance" == "0" ]; then
-		#Try to give the preferred instance to the domain
-		instance=$(xenstore_read "$XENBUS_PATH"/pref_instance)
-		if [ "$instance" != "" ]; then
-			res=$(vtpmdb_is_free_instancenum $instance)
-			if [ $res -eq 0 ]; then
-				instance=$(vtpmdb_get_free_instancenum)
-			fi
-		else
-			instance=$(vtpmdb_get_free_instancenum)
-		fi
-
-		vtpm_create $instance
-
-		if [ $vtpm_fatal_error -eq 0 ]; then
-			if [ "$uuid" != "" ]; then
-				vtpmdb_add_instance $uuid $instance
-			else
-				vtpmdb_add_instance $domname $instance
-			fi
-		fi
-	else
-		if [ "$reason" == "resume" ]; then
-			vtpm_resume $instance
-		else
-			vtpm_start $instance
-		fi
-	fi
-
-	release_lock vtpmdb
-
-	xenstore_write $XENBUS_PATH/instance $instance
-}
-
-
-#Remove an instance when a VM is terminating or suspending.
-#Since it is assumed that the VM will appear again, the
-#entry is kept in the VTPMDB file.
-function vtpm_remove_instance () {
-	local instance reason domname uuid
-	#Stop script execution quietly if path does not exist (anymore)
-	xenstore-exists "$XENBUS_PATH"/domain
-	uuid=$(xenstore_read "$XENBUS_PATH"/uuid)
-
-	claim_lock vtpmdb
-
-	instance="0"
-
-	if [ "$uuid" != "" ]; then
-		instance=$(vtpmdb_find_instance $uuid)
-	fi
-
-	if [ "$instance" == "0" ]; then
-		domname=$(xenstore_read "$XENBUS_PATH"/domain)
-		instance=$(vtpmdb_find_instance $domname)
-	fi
-
-	if [ "$instance" != "0" ]; then
-		vtpm_suspend $instance
-	fi
-
-	release_lock vtpmdb
-}
-
-
-#Remove an entry in the VTPMDB file given the domain's name
-#1st parameter: The name of the domain
-function vtpm_delete_instance () {
-	local instance
-
-	claim_lock vtpmdb
-
-	instance=$(vtpmdb_find_instance $1)
-	if [ "$instance" != "0" ]; then
-		vtpmdb_remove_entry $1 $instance
-	fi
-
-	release_lock vtpmdb
-}
-
-# Determine whether the given address is local to this machine
-# Return values:
-#  "-1" : the given machine name is invalid
-#  "0"  : this is not an address of this machine
-#  "1"  : this is an address local to this machine
-function vtpm_isLocalAddress() {
-	local addr res
-	addr=$(ping $1 -c 1 |  \
-	       awk '{ print substr($3,2,length($3)-2); exit }')
-	if [ "$addr" == "" ]; then
-		echo "-1"
-		return
-	fi
-	res=$(ifconfig | grep "inet addr" |  \
-	     awk -vaddr=$addr               \
-	     '{                              \
-	        if ( addr == substr($2, 6)) {\
-	          print "1";                 \
-	        }                            \
-	     }'                              \
-	    )
-	if [ "$res" == "" ]; then
-		echo "0"
-		return
-	fi
-	echo "1"
-}
-
-# Perform a migration step. This function differentiates between migration
-# to the local host or to a remote machine.
-# Parameters:
-# 1st: destination host to migrate to
-# 2nd: name of the domain to migrate
-# 3rd: the migration step to perform
-function vtpm_migration_step() {
-	local res=$(vtpm_isLocalAddress $1)
-	if [ "$res" == "0" ]; then
-		vtpm_migrate $1 $2 $3
-	else
-		vtpm_migrate_local
-	fi
-}
-
-# Recover from migration due to an error. This function differentiates
-# between migration to the local host or to a remote machine.
-# Parameters:
-# 1st: destination host the migration was going to
-# 2nd: name of the domain that was to be migrated
-# 3rd: the last successful migration step that was done
-function vtpm_recover() {
-	local res
-	res=$(vtpm_isLocalAddress $1)
-	if [ "$res" == "0" ]; then
-		vtpm_migrate_recover $1 $2 $3
-	fi
-}
-
-
-#Determine the domain id given a domain's name.
-#1st parameter: name of the domain
-#return value: domain id  or -1 if domain id could not be determined
-function vtpm_domid_from_name () {
-	local id name ids
-	ids=$(xenstore-list /local/domain)
-	for id in $ids; do
-		name=$(xenstore-read /local/domain/$id/name)
-		if [ "$name" == "$1" ]; then
-			echo "$id"
-			return
-		fi
-	done
-	echo "-1"
-}
-
-#Determine the virtual TPM's instance number using the domain ID.
-#1st parm: domain ID
-function vtpm_uuid_by_domid() {
-	echo $(xenstore-read /local/domain/0/backend/vtpm/$1/0/uuid)
-}
-
-
-# Determine the vTPM's UUID by the name of the VM
-function vtpm_uuid_from_vmname() {
-	local domid=$(vtpm_domid_from_name $1)
-	if [ "$domid" != "-1" ]; then
-		echo $(vtpm_uuid_by_domid $domid)
-		return
-	fi
-	echo ""
-}
-
-#Add a virtual TPM instance number and its associated domain name
-#to the VTPMDB file and activate usage of this virtual TPM instance
-#by writing the instance number into the xenstore
-#1st parm: name of virtual machine
-#2nd parm: instance of associated virtual TPM
-function vtpm_add_and_activate() {
-	local domid=$(vtpm_domid_from_name $1)
-	local vtpm_uuid=$(vtpm_uuid_from_vmname $1)
-	if [ "$vtpm_uuid" != "" -a "$domid" != "-1" ]; then
-		vtpmdb_add_instance $vtpm_uuid $2
-		xenstore-write backend/vtpm/$domid/0/instance $2
-	fi
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/hotplug/Linux/vtpm-delete
--- a/tools/hotplug/Linux/vtpm-delete	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-# This scripts must be called the following way:
-# vtpm-delete <vtpm uuid>
-# or
-# vtpm-delete --vmname <vm name>
-
-dir=$(dirname "$0")
-. "$dir/vtpm-common.sh"
-
-if [ "$1" == "--vmname" ]; then
-	vtpm_uuid=$(vtpm_uuid_from_vmname $2)
-	if [ "$vtpm_uuid" != "" ];then
-		vtpm_delete_instance $vtpm_uuid
-	fi
-else
-	vtpm_delete_instance $1
-fi
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/hotplug/Linux/vtpm-hotplug-common.sh
--- a/tools/hotplug/Linux/vtpm-hotplug-common.sh	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-#
-# Copyright (c) 2005 IBM Corporation
-# Copyright (c) 2005 XenSource Ltd.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of version 2.1 of the GNU Lesser General Public
-# License as published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-#
-
-dir=$(dirname "$0")
-. "$dir/xen-hotplug-common.sh"
-
-findCommand "$@"
-if [ "$command" != "online" ]  &&
-   [ "$command" != "offline" ] &&
-   [ "$command" != "add" ]     &&
-   [ "$command" != "remove" ]
-then
-	log err "Invalid command: $command"
-	exit 1
-fi
-
-
-XENBUS_PATH="${XENBUS_PATH:?}"
-
-. "$dir/vtpm-common.sh"
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/hotplug/Linux/vtpm-impl
--- a/tools/hotplug/Linux/vtpm-impl	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-#!/bin/bash
-# ===================================================================
-# 
-# Copyright (c) 2005, Intel Corp.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-#   * Redistributions of source code must retain the above copyright 
-#     notice, this list of conditions and the following disclaimer.
-#   * 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.
-#   * Neither the name of Intel Corporation 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 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.
-# ===================================================================
-
-#            |        SRC        |    TAG  |      CMD SIZE     |        ORD       |mtype|strt
-TPM_CMD_OPEN=\\x00\\x00\\x00\\x00\\x01\\xc1\\x00\\x00\\x00\\x11\\x01\\x00\\x00\\x01\\x01\\x01
-TPM_CMD_RESM=\\x00\\x00\\x00\\x00\\x01\\xc1\\x00\\x00\\x00\\x11\\x01\\x00\\x00\\x01\\x01\\x02
-TPM_CMD_CLOS=\\x00\\x00\\x00\\x00\\x01\\xc1\\x00\\x00\\x00\\x0e\\x01\\x00\\x00\\x02
-TPM_CMD_DELE=\\x00\\x00\\x00\\x00\\x01\\xc1\\x00\\x00\\x00\\x0e\\x01\\x00\\x00\\x03
-
-TPM_TYPE_PVM=\\x01
-TPM_TYPE_HVM=\\x02
-
-TPM_SUCCESS=00000000
-
-TX_VTPM_MANAGER=/var/vtpm/fifos/from_console.fifo
-RX_VTPM_MANAGER=/var/vtpm/fifos/to_console.fifo
-
-VTPM_MIG=/usr/bin/vtpm_migrator
-
-# -------------------- Helpers for binary streams -----------
-
-function str_to_hex32() {
- printf "%0.8x" $1
-}
-
-function hex32_to_bin() {
- local inst=$(str_to_hex32 $1);
- 
- local n1=`echo $inst | sed 's/\(..\)....../\\\\x\1/'`
- local n2=`echo $inst | sed 's/..\(..\)..../\\\\x\1/'`
- local n3=`echo $inst | sed 's/....\(..\)../\\\\x\1/'`
- local n4=`echo $inst | sed 's/......\(..\)/\\\\x\1/'`
-
- echo "$n1$n2$n3$n4"
-}
-
-function vtpm_manager_cmd() {
- local cmd=$1;
- local inst=$2;
- local inst_bin=$(hex32_to_bin $inst);
-
- claim_lock vtpm_mgr
-
- #send cmd to vtpm_manager
- printf "$cmd$inst_bin" > $TX_VTPM_MANAGER
-
- #recv response
- set +e
- local resp_hex=`dd skip=10 bs=1 count=4 if=$RX_VTPM_MANAGER 2> /dev/null | xxd -ps`
- set -e
-
- release_lock vtpm_mgr
-
- #return whether the command was successful
- if [ $resp_hex -ne $TPM_SUCCESS ]; then
-   vtpm_fatal_error=1
-   false
-  else
-   true
- fi
-}
-
-# Helper to get vm type to pass to vtpm_manager open/resume
-function vtpm_get_type() {
- local inst=$(xenstore_read $XENBUS_PATH/frontend-id)
- local vm=$(xenstore_read /local/domain/$inst/vm)
- if [ "$vm" != "" ]; then
-  local ostype=$(xenstore-read $vm/image/ostype)
-  if [ "$ostype" == "hvm" ]; then
-   echo $TPM_TYPE_HVM;
-  else
-   echo $TPM_TYPE_PVM;
-  fi
- fi
-}
-
-# ------------------ Command handlers -----------------
-
-# Create new vtpm instance & set it up for use
-function vtpm_create () {
- # Creation is handled implicitly by the manager on first setup
- # so just set it up for use
- $(vtpm_start $1)
-}
-
-# Setup vtpm instance for use.
-function vtpm_start() {
- local vmtype=$(vtpm_get_type);
- $(vtpm_manager_cmd $TPM_CMD_OPEN$vmtype $1)
-}
-
-function vtpm_resume() {
- local vmtype=$(vtpm_get_type);
- $(vtpm_manager_cmd $TPM_CMD_RESM$vmtype $1)
-}
-
-# Reset the vtpm AKA clear PCRs
-function vtpm_reset() {
- #not used by current implemenation
- true
-}
-
-# Shutdown the vtpm while the vm is down
-# This could be a suspend of shutdown
-# we cannot distinquish, so save the state
-# and decide on startup if we should keep is
-function vtpm_suspend() {
- $(vtpm_manager_cmd $TPM_CMD_CLOS $1)
-}
-
-
-function vtpm_delete() {
- local inst=$1
- if $(vtpm_manager_cmd $TPM_CMD_DELE $inst); then
-   rm -f /var/vtpm/vtpm_dm_$1.data
-   true
- else 
-   vtpm_fatal_error=1
-   false
- fi
-}
-
-# Perform a migration step. This function differentiates between migration
-# to the local host or to a remote machine.
-# Parameters:
-# 1st: destination host to migrate to
-# 2nd: name of the domain to migrate
-# 3rd: the migration step to perform
-function vtpm_migrate() {
- local instance res
-
- instance=$(vtpmdb_find_instance $2)
- if [ "$instance" == "" ]; then
-  log err "VTPM Migratoin failed. Unable to translation of domain name"
-  echo "Error: VTPM Migration failed while looking up instance number"
- fi
-
- case "$3" in
-  0)
-   #Incicate migration supported
-   echo "0" 
-  ;;
-
-  1)
-   # Get Public Key from Destination
-   # Call vtpm_manager's migration part 1
-   claim_lock vtpm_mgr
-   $VTPM_MIG $1 $2 $instance $3
-   release_lock vtpm_mgr
-  ;;
-
-  2)
-   # Call manager's migration step 2 and send result to destination
-   # If successful remove from db
-   claim_lock vtpm_mgr
-   $VTPM_MIG $1 $2 $instance $3
-   release_lock vtpm_mgr
-  ;;
-
-  3)
-   if `ps x | grep "$VTPM_MIG $1"`; then
-    log err "VTPM Migration failed to complete."
-    echo "Error: VTPM Migration failed to complete."
-   fi
-  ;;
- esac
- 
-}
-
-
-function vtpm_migrate_recover() {
- echo "Error: Recovery not supported yet" 
-}
-
-function vtpm_migrate_local() {
- echo "Error: local vTPM migration not supported"
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/hotplug/Linux/vtpm-migration.sh
--- a/tools/hotplug/Linux/vtpm-migration.sh	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-#
-# Copyright (c) 2005 IBM Corporation
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of version 2.1 of the GNU Lesser General Public
-# License as published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-#
-
-dir=$(dirname "$0")
-. "$dir/vtpm-common.sh"
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/hotplug/Linux/xen-backend.rules
--- a/tools/hotplug/Linux/xen-backend.rules	Tue Nov 13 10:46:59 2012 +0000
+++ b/tools/hotplug/Linux/xen-backend.rules	Tue Nov 13 10:47:00 2012 +0000
@@ -1,6 +1,5 @@
 SUBSYSTEM=="xen-backend", KERNEL=="tap*", ENV{UDEV_CALL}="1", RUN+="/etc/xen/scripts/blktap $env{ACTION}"
 SUBSYSTEM=="xen-backend", KERNEL=="vbd*", ENV{UDEV_CALL}="1", RUN+="/etc/xen/scripts/block $env{ACTION}"
-SUBSYSTEM=="xen-backend", KERNEL=="vtpm*", RUN+="/etc/xen/scripts/vtpm $env{ACTION}"
 SUBSYSTEM=="xen-backend", KERNEL=="vif2-*", RUN+="/etc/xen/scripts/vif2 $env{ACTION}"
 SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ENV{UDEV_CALL}="1", ACTION=="online", RUN+="/etc/xen/scripts/vif-setup online type_if=vif"
 SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ENV{UDEV_CALL}="1", ACTION=="offline", RUN+="/etc/xen/scripts/vif-setup offline type_if=vif"
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm/Makefile
--- a/tools/vtpm/Makefile	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-XEN_ROOT = $(CURDIR)/../..
-
-# Base definitions and rules
-include $(XEN_ROOT)/tools/vtpm/Rules.mk
-
-# Dir name for emulator (as dom0 tpm driver)
-TPM_EMULATOR_DIR = tpm_emulator
-# Dir name for vtpm instance
-VTPM_DIR = vtpm
-ORIG_DIR = orig
-
-# Emulator tarball name
-TPM_EMULATOR_NAME = tpm_emulator-0.5.1
-TPM_EMULATOR_TARFILE = $(TPM_EMULATOR_NAME).tar.gz
-
-GMP_HEADER = /usr/include/gmp.h
-
-.PHONY: all
-all: build
-
-.PHONY: build
-build: build_sub
-
-.PHONY: install
-install: build
-	$(MAKE) -C $(VTPM_DIR) install-recursive
-
-.PHONY: clean
-clean:
-	@if [ -d $(TPM_EMULATOR_DIR) ]; \
-		then $(MAKE) -C $(TPM_EMULATOR_DIR) clean; \
-	fi
-	@if [ -d $(VTPM_DIR) ]; \
-		then $(MAKE) -C $(VTPM_DIR) clean; \
-	fi
-
-.PHONY: mrproper
-mrproper:
-	rm -f $(TPM_EMULATOR_TARFILE) tpm_emulator.patch.old vtpm.patch.old
-	rm -rf $(TPM_EMULATOR_DIR) $(VTPM_DIR) $(ORIG_DIR)
-
-# Download Swiss emulator
-$(TPM_EMULATOR_TARFILE):
-	wget http://download.berlios.de/tpm-emulator/$(TPM_EMULATOR_TARFILE)
-
-# Create vtpm dirs
-$(VTPM_DIR)/tpmd/tpmd: $(TPM_EMULATOR_TARFILE) vtpm-0.5.1.patch
-	rm -rf $(VTPM_DIR)
-	tar -xzf $(TPM_EMULATOR_TARFILE)
-	mv $(TPM_EMULATOR_NAME) $(VTPM_DIR)
-
-	set -e; cd $(VTPM_DIR); \
-	patch -p1 < ../vtpm-0.5.1.patch; \
-	patch -p1 < ../vtpm-0.5.1-LDLIBS.patch
-
-orig: $(TPM_EMULATOR_TARFILE)
-	mkdir $(ORIG_DIR);
-	set -e; cd $(ORIG_DIR); \
-	tar -xzf ../$(TPM_EMULATOR_TARFILE);
-
-updatepatches: clean orig
-	find $(VTPM_DIR) -name "*.orig" -print | xargs rm -f; 
-	mv vtpm.patch vtpm.patch.old; 
-	diff -uprN $(TPM_EMULATOR_DIR) $(VTPM_DIR) > vtpm.patch || true;
-
-.PHONY: build_sub
-build_sub: $(VTPM_DIR)/tpmd/tpmd
-	set -e; if [ -e $(GMP_HEADER) ]; then \
-		$(MAKE) -C $(VTPM_DIR) version; \
-		$(MAKE) -C $(VTPM_DIR) all-recursive; \
-	else \
-		echo "=== Unable to build VTPMs. libgmp could not be found."; \
-	fi
-
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm/README
--- a/tools/vtpm/README	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-
-Directory Structure
-===================
-tools/vtpm/tpm_emulator-0.2b.tar.gz    -> TPM Emulator downloaded at build time that will
-                                          be patched and used for our vtpms
-tools/vtpm/vtpm.patch                  -> patch applied to tpm_emulator to make vtpm
-tools/vtpm/vtpm/                       -> (created on build) tpm_emulator moved to ring 3,
-                                          listens on a pair of fifos for TPM commands,
-                                          persistent state is sent via named fifo to vtpm
-                                            manager, which encrypts it and protects it.
-tools/vtpm/tpm_emulator.patch          -> To allow for debugging and testing on non-TPM
-                                          platforms, this patches the emulator to allow
-                                          it to be inserted into the dom0 kernel
-tools/vtpm/tpm_emulator-0.2            -> (created on build) directory containing patched emulator
-
-Compile Flags
-===================
-VTPM_MULTI_VM                -> Defined (not finished): VTPMs run in their own VMs
-                                Not Defined (default): VTPMs are processes
-
-Requirements
-============
-- xen-unstable 
-- IBM frontend/backend vtpm driver patch
-- vtpm_managerd
-- GNU MP Big number library (GMP)
-
-vtpmd Flow (for vtpm_manager. vtpmd never run by default)
-============================
-- Launch the VTPM manager (vtpm_managerd) which which begins listening to the BE with one thread
-  and listens to a named fifo that is shared by the vtpms to commuincate with the manager.
-- VTPM Manager listens to TPM BE.
-- When xend launches a tpm frontend equipped VM it contacts the manager over the vtpm backend. 
-- When the manager receives the open message from the BE, it launches a vtpm
-- Xend allows the VM to continue booting. 
-- When a TPM request is issued to the front end, the front end transmits the TPM request to the backend.
-- The manager receives the TPM requests and uses a named fifo to forward the request to the vtpm.
-- The fifo listener begins listening for the reply from vtpm for the request.
-- Vtpm processes request and replies to manager over shared named fifo.
-- If needed, the vtpm may send a request to the vtpm_manager at any time to save it's secrets to disk.
-- Manager receives response from vtpm and passes it back to backend for forwarding to guest.
-
-tpm_emulator flow
-==================
-Read documentation in tpm_emulator-0.2 directory
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm/Rules.mk
--- a/tools/vtpm/Rules.mk	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-# Base definitions and rules (XEN_ROOT must be defined in including Makefile)
-include $(XEN_ROOT)/tools/Rules.mk
-
-#
-# Tool definitions
-#
-
-# General compiler flags
-CFLAGS   = -Werror -g3
-
-# Generic project files
-HDRS	= $(wildcard *.h)
-SRCS	= $(wildcard *.c)
-OBJS	= $(patsubst %.c,%.o,$(SRCS))
-
-# Generic (non-header) dependencies
-$(SRCS): Makefile $(XEN_ROOT)/tools/Rules.mk $(XEN_ROOT)/tools/vtpm/Rules.mk
-
-$(OBJS): $(SRCS)
-
--include $(DEPS)
-
-BUILD_EMULATOR = y
-
-# Make sure these are just rules
-.PHONY : all build install clean
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm/tpm_emulator.patch
--- a/tools/vtpm/tpm_emulator.patch	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1919 +0,0 @@
-diff -uprN orig/tpm_emulator-0.4/AUTHORS tpm_emulator/AUTHORS
---- orig/tpm_emulator-0.4/AUTHORS	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/AUTHORS	2006-07-24 14:35:35.000000000 -0700
-@@ -1,2 +1,3 @@
- Mario Strasser <mast@gmx.net>
- Heiko Stamer <stamer@gaos.org> [DAA]
-+INTEL Corp <> [Dropped to Ring3]
-diff -uprN orig/tpm_emulator-0.4/ChangeLog tpm_emulator/ChangeLog
---- orig/tpm_emulator-0.4/ChangeLog	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/ChangeLog	2006-07-24 14:35:35.000000000 -0700
-@@ -1,3 +1,6 @@
-+????-??-?? Intel Corp
-+	* Moved module out of kernel to run as a ring 3 app
-+
- 2006-06-23  Mario Strasser <mast@gmx.net>
- 	* tpm_startup.c: behaviour of ST_CLEAR and storage of
- 		persistent data adapted
-diff -uprN orig/tpm_emulator-0.4/crypto/gmp_kernel_wrapper.c tpm_emulator/crypto/gmp_kernel_wrapper.c
---- orig/tpm_emulator-0.4/crypto/gmp_kernel_wrapper.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/crypto/gmp_kernel_wrapper.c	2006-07-24 14:35:35.000000000 -0700
-@@ -1,5 +1,6 @@
- /* Software-Based Trusted Platform Module (TPM) Emulator for Linux
-  * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
-+ * Copyright (C) 2005 INTEL Corp
-  *
-  * This module is free software; you can redistribute it and/or modify
-  * it under the terms of the GNU General Public License as published
-@@ -24,15 +25,10 @@ int __gmp_junk;
- void __attribute__ ((regparm(0))) __gmp_assert_fail(const char *filename, 
-   int linenum, const char *expr) 
- {
--  panic(KERN_CRIT TPM_MODULE_NAME "%s:%d: GNU MP assertion failed: %s\n", 
-+  error("%s:%d: GNU MP assertion failed: %s\n", 
-     filename, linenum, expr);
- }
- 
--void __attribute__ ((regparm(0))) abort(void)
--{
--  panic(KERN_CRIT TPM_MODULE_NAME "GNU MP abort() was called\n");
--}
--
- /* overwrite GNU MP random functions (used by mpz/millerrabin.c) */ 
- 
- void __attribute__ ((regparm(0))) gmp_randinit(gmp_randstate_t rstate, 
-@@ -77,20 +73,19 @@ void __attribute__ ((regparm(0))) mpz_ur
- 
- void __attribute__ ((regparm(0))) *kernel_allocate(size_t size)
- {
--  void *ret  = (void*)kmalloc(size, GFP_KERNEL);
--  if (!ret) panic(KERN_CRIT TPM_MODULE_NAME 
--    "GMP: cannot allocate memory (size=%u)\n", size);
-+  void *ret  = (void*)malloc(size);
-+  if (!ret) error("GMP: cannot allocate memory (size=%Zu)\n", size);
-   return ret;
- }
- 
- void __attribute__ ((regparm(0))) *kernel_reallocate(void *oldptr, 
-   size_t old_size, size_t new_size)
- {
--  void *ret = (void*)kmalloc(new_size, GFP_KERNEL);
--  if (!ret) panic(KERN_CRIT TPM_MODULE_NAME "GMP: Cannot reallocate memory "
--    "(old_size=%u new_size=%u)\n", old_size, new_size);
-+  void *ret = (void*)malloc(new_size);
-+  if (!ret) error("GMP: Cannot reallocate memory "
-+    "(old_size=%Zu new_size=%Zu)\n", old_size, new_size);
-   memcpy(ret, oldptr, old_size);
--  kfree(oldptr);
-+  free(oldptr);
-   return ret;
- }
- 
-@@ -99,7 +94,7 @@ void __attribute__ ((regparm(0))) kernel
-   /* overwrite used memory */
-   if (blk_ptr != NULL) { 
-     memset(blk_ptr, 0, blk_size);
--    kfree(blk_ptr);
-+    free(blk_ptr);
-   }
- }
- 
-diff -uprN orig/tpm_emulator-0.4/crypto/rsa.c tpm_emulator/crypto/rsa.c
---- orig/tpm_emulator-0.4/crypto/rsa.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/crypto/rsa.c	2006-07-24 14:35:35.000000000 -0700
-@@ -1,5 +1,6 @@
- /* Software-Based Trusted Platform Module (TPM) Emulator for Linux
-  * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
-+ * Copyright (C) 2005 INTEL Corp
-  *
-  * This module is free software; you can redistribute it and/or modify
-  * it under the terms of the GNU General Public License as published
-@@ -381,7 +382,7 @@ static int encode_message(int type, uint
-       msg[0] = 0x00;
-       get_random_bytes(&msg[1], SHA1_DIGEST_LENGTH);
-       sha1_init(&ctx);
--      sha1_update(&ctx, "TCPA", 4);
-+      sha1_update(&ctx, (uint8_t *) "TCPA", 4);
-       sha1_final(&ctx, &msg[1 + SHA1_DIGEST_LENGTH]);
-       memset(&msg[1 + 2 * SHA1_DIGEST_LENGTH], 0x00, 
-         msg_len - data_len - 2 * SHA1_DIGEST_LENGTH - 2);
-@@ -429,7 +430,7 @@ static int decode_message(int type, uint
-       mask_generation(&msg[1], SHA1_DIGEST_LENGTH,
-         &msg[1 + SHA1_DIGEST_LENGTH], msg_len - SHA1_DIGEST_LENGTH - 1);
-       sha1_init(&ctx);
--      sha1_update(&ctx, "TCPA", 4);
-+      sha1_update(&ctx, (uint8_t *) "TCPA", 4);
-       sha1_final(&ctx, &msg[1]);
-       if (memcmp(&msg[1], &msg[1 + SHA1_DIGEST_LENGTH], 
-           SHA1_DIGEST_LENGTH) != 0) return -1;
-diff -uprN orig/tpm_emulator-0.4/linux_module.c tpm_emulator/linux_module.c
---- orig/tpm_emulator-0.4/linux_module.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/linux_module.c	1969-12-31 16:00:00.000000000 -0800
-@@ -1,195 +0,0 @@
--/* Software-Based Trusted Platform Module (TPM) Emulator for Linux 
-- * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
-- *
-- * This module 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 module 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.
-- *
-- * $Id: linux_module.c 91 2006-03-13 13:51:41Z mast $
-- */
--
--#include <linux/module.h>
--#include <linux/kernel.h>
--#include <linux/init.h>
--#include <linux/miscdevice.h>
--#include <linux/poll.h>
--#include "linux_module.h"
--#include "tpm/tpm_emulator.h"
--
--MODULE_LICENSE("GPL");
--MODULE_AUTHOR("Mario Strasser <mast@gmx.net>");
--MODULE_DESCRIPTION("Trusted Platform Module (TPM) Emulator");
--MODULE_SUPPORTED_DEVICE(TPM_DEVICE_NAME);
--
--/* module startup parameters */
--char *startup = "save";
--module_param(startup, charp, 0444);
--MODULE_PARM_DESC(startup, " Sets the startup mode of the TPM. "
--  "Possible values are 'clear', 'save' (default) and 'deactivated.");
--char *storage_file = "/var/tpm/tpm_emulator-1.2.0.2";
--module_param(storage_file, charp, 0644);
--MODULE_PARM_DESC(storage_file, " Sets the persistent-data storage " 
--  "file of the TPM.");
--
--/* TPM lock */
--static struct semaphore tpm_mutex;
--
--/* TPM command response */
--static struct {
--  uint8_t *data;
--  uint32_t size;
--} tpm_response;
--
--/* module state */
--#define STATE_IS_OPEN 0
--static uint32_t module_state;
--static struct timespec old_time;
--
--static int tpm_open(struct inode *inode, struct file *file)
--{
--  debug("%s()", __FUNCTION__);
--  if (test_and_set_bit(STATE_IS_OPEN, (void*)&module_state)) return -EBUSY;
--  return 0;
--}
--
--static int tpm_release(struct inode *inode, struct file *file)
--{
--  debug("%s()", __FUNCTION__);
--  clear_bit(STATE_IS_OPEN, (void*)&module_state);
--  down(&tpm_mutex);
--  if (tpm_response.data != NULL) {
--    kfree(tpm_response.data);
--    tpm_response.data = NULL;
--  }
--  up(&tpm_mutex);
--  return 0;
--}
--
--static ssize_t tpm_read(struct file *file, char *buf, size_t count, loff_t *ppos)
--{
--  debug("%s(%d)", __FUNCTION__, count);
--  down(&tpm_mutex);
--  if (tpm_response.data != NULL) {
--    count = min(count, (size_t)tpm_response.size - (size_t)*ppos);
--    count -= copy_to_user(buf, &tpm_response.data[*ppos], count);
--    *ppos += count;
--    if ((size_t)tpm_response.size == (size_t)*ppos) {
--      kfree(tpm_response.data);
--      tpm_response.data = NULL;
--    }
--  } else {
--    count = 0;
--  }
--  up(&tpm_mutex);
--  return count;
--}
--
--static ssize_t tpm_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
--{
--  debug("%s(%d)", __FUNCTION__, count);
--  down(&tpm_mutex);
--  *ppos = 0;
--  if (tpm_response.data != NULL) kfree(tpm_response.data);
--  if (tpm_handle_command(buf, count, &tpm_response.data, 
--                         &tpm_response.size) != 0) { 
--    count = -EILSEQ;
--    tpm_response.data = NULL;
--  }
--  up(&tpm_mutex);
--  return count;
--}
--
--#define TPMIOC_CANCEL   _IO('T', 0x00)
--#define TPMIOC_TRANSMIT _IO('T', 0x01)
--
--static int tpm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
--{
--  debug("%s(%d, %p)", __FUNCTION__, cmd, (char*)arg);
--  if (cmd == TPMIOC_TRANSMIT) {
--    uint32_t count = ntohl(*(uint32_t*)(arg + 2));
--    down(&tpm_mutex);
--    if (tpm_response.data != NULL) kfree(tpm_response.data);
--    if (tpm_handle_command((char*)arg, count, &tpm_response.data,
--                           &tpm_response.size) == 0) {
--      tpm_response.size -= copy_to_user((char*)arg, tpm_response.data,
--                            tpm_response.size);
--      kfree(tpm_response.data);
--      tpm_response.data = NULL;
--    } else {
--      tpm_response.size = 0;
--      tpm_response.data = NULL;
--    }
--    up(&tpm_mutex);
--    return tpm_response.size;
--  }
--  return -1;
--}
--
--struct file_operations fops = {
--  .owner   = THIS_MODULE,
--  .open    = tpm_open,
--  .release = tpm_release,
--  .read    = tpm_read,
--  .write   = tpm_write,
--  .ioctl   = tpm_ioctl,
--};
--
--static struct miscdevice tpm_dev = {
--  .minor      = TPM_DEVICE_MINOR, 
--  .name       = TPM_DEVICE_NAME, 
--  .fops       = &fops,
--};
--
--int __init init_tpm_module(void)
--{
--  int res = misc_register(&tpm_dev);
--  if (res != 0) {
--    error("misc_register() failed for minor %d\n", TPM_DEVICE_MINOR);
--    return res;
--  }
--  /* initialize variables */
--  sema_init(&tpm_mutex, 1);
--  module_state = 0;
--  tpm_response.data = NULL;
--  old_time = current_kernel_time();
--  /* initialize TPM emulator */
--  if (!strcmp(startup, "clear")) {
--    tpm_emulator_init(1);
--  } else if (!strcmp(startup, "save")) {
--    tpm_emulator_init(2);
--  } else if (!strcmp(startup, "deactivated")) {
--    tpm_emulator_init(3);
--  } else {
--    error("invalid startup mode '%s'; must be 'clear', "
--      "'save' (default) or 'deactivated", startup);
--    misc_deregister(&tpm_dev);
--    return -EINVAL;
--  }
--  return 0;
--}
--
--void __exit cleanup_tpm_module(void)
--{
--  tpm_emulator_shutdown();
--  misc_deregister(&tpm_dev);
--  if (tpm_response.data != NULL) kfree(tpm_response.data);
--}
--
--module_init(init_tpm_module);
--module_exit(cleanup_tpm_module);
--
--uint64_t tpm_get_ticks(void)
--{
--  struct timespec new_time = current_kernel_time();
--  uint64_t ticks = (uint64_t)(new_time.tv_sec - old_time.tv_sec) * 1000000
--                   + (new_time.tv_nsec - old_time.tv_nsec) / 1000;
--  old_time = new_time;
--  return (ticks > 0) ? ticks : 1;
--}
--
-diff -uprN orig/tpm_emulator-0.4/linux_module.h tpm_emulator/linux_module.h
---- orig/tpm_emulator-0.4/linux_module.h	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/linux_module.h	2006-07-24 14:35:35.000000000 -0700
-@@ -1,5 +1,6 @@
- /* Software-Based Trusted Platform Module (TPM) Emulator for Linux
-  * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
-+ * Copyright (C) 2005 INTEL Corp
-  *
-  * This module is free software; you can redistribute it and/or modify
-  * it under the terms of the GNU General Public License as published
-@@ -17,54 +18,62 @@
- #ifndef _LINUX_MODULE_H_
- #define _LINUX_MODULE_H_
- 
--#include <linux/version.h>
--#include <linux/kernel.h>
--#include <linux/slab.h>
-+#include <malloc.h>
-+#include <stdint.h>
-+#include <stdio.h>
-+#include <string.h>
- #include <linux/types.h>
--#include <linux/string.h>
--#include <linux/random.h>
--#include <linux/time.h>
--#include <asm/byteorder.h>
- 
--/* module settings */
-+#include <endian.h>
-+#define __BYTEORDER_HAS_U64__
-+#ifdef LITTLE_ENDIAN
-+ #include <linux/byteorder/little_endian.h>
-+#else
-+ #include <linux/byteorder/big_endian.h>
-+#endif
- 
-+/* module settings */
-+#define min(A,B) ((A)<(B)?(A):(B))
-+#ifndef STR
- #define STR(s) __STR__(s)
- #define __STR__(s) #s
-+#endif
- #include "tpm_version.h"
- 
- #define TPM_DEVICE_MINOR  224
- #define TPM_DEVICE_NAME   "tpm"
- #define TPM_MODULE_NAME   "tpm_emulator"
- 
--/* debug and log output functions */
--
- #ifdef DEBUG
--#define debug(fmt, ...) printk(KERN_DEBUG "%s %s:%d: Debug: " fmt "\n", \
--                        TPM_MODULE_NAME, __FILE__, __LINE__, ## __VA_ARGS__)
-+#define debug(fmt, ...) printf("TPMD: %s:%d: Debug: " fmt "\n", \
-+                        __FILE__, __LINE__, ## __VA_ARGS__)
- #else
- #define debug(fmt, ...) 
- #endif
--#define info(fmt, ...)  printk(KERN_INFO "%s %s:%d: Info: " fmt "\n", \
--                        TPM_MODULE_NAME, __FILE__, __LINE__, ## __VA_ARGS__)
--#define error(fmt, ...) printk(KERN_ERR "%s %s:%d: Error: " fmt "\n", \
--                        TPM_MODULE_NAME, __FILE__, __LINE__, ## __VA_ARGS__)
--#define alert(fmt, ...) printk(KERN_ALERT "%s %s:%d: Alert: " fmt "\n", \
--                        TPM_MODULE_NAME, __FILE__, __LINE__, ## __VA_ARGS__)
-+#define info(fmt, ...)  printf("TPMD: %s:%d: Info: " fmt "\n", \
-+                        __FILE__, __LINE__, ## __VA_ARGS__)
-+#define error(fmt, ...) printf("TPMD: %s:%d: Error: " fmt "\n", \
-+                        __FILE__, __LINE__, ## __VA_ARGS__)
-+#define alert(fmt, ...) printf("TPMD: %s:%d: Alert: " fmt "\n", \
-+                        __FILE__, __LINE__, ## __VA_ARGS__)
- 
- /* memory allocation */
- 
- static inline void *tpm_malloc(size_t size) 
- {
--  return kmalloc(size, GFP_KERNEL);  
-+  return malloc(size);  
- }
- 
- static inline void tpm_free(const void *ptr)
- {
--  if (ptr != NULL) kfree(ptr);
-+  if (ptr != NULL) free( (void *) ptr);
- }
- 
- /* random numbers */
- 
-+//FIXME;
-+void get_random_bytes(void *buf, int nbytes);
-+
- static inline void tpm_get_random_bytes(void *buf, int nbytes)
- {
-   get_random_bytes(buf, nbytes);
-@@ -84,9 +93,9 @@ uint64_t tpm_get_ticks(void);
- #define CPU_TO_LE16(x) __cpu_to_le16(x)
- 
- #define BE64_TO_CPU(x) __be64_to_cpu(x)
--#define LE64_TO_CPU(x) __be64_to_cpu(x)
-+#define LE64_TO_CPU(x) __le64_to_cpu(x)
- #define BE32_TO_CPU(x) __be32_to_cpu(x)
--#define LE32_TO_CPU(x) __be32_to_cpu(x)
-+#define LE32_TO_CPU(x) __le32_to_cpu(x)
- #define BE16_TO_CPU(x) __be16_to_cpu(x)
- #define LE16_TO_CPU(x) __le16_to_cpu(x)
- 
-diff -uprN orig/tpm_emulator-0.4/Makefile tpm_emulator/Makefile
---- orig/tpm_emulator-0.4/Makefile	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/Makefile	2006-07-24 14:35:35.000000000 -0700
-@@ -1,24 +1,40 @@
- # Software-Based Trusted Platform Module (TPM) Emulator for Linux
- # Copyright (C) 2004 Mario Strasser <mast@gmx.net>
-+# Copyright (C) 2006 INTEL Corp.
- #
- # $Id: Makefile 115 2006-06-23 10:36:44Z mast $
- 
--# kernel settings
--KERNEL_RELEASE := $(shell uname -r)
--KERNEL_BUILD   := /lib/modules/$(KERNEL_RELEASE)/build
--MOD_SUBDIR     := misc
-+COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/)
- 
- # module settings
--MODULE_NAME    := tpm_emulator
-+BIN            := tpm_emulator
- VERSION_MAJOR  := 0
- VERSION_MINOR  := 4
- VERSION_BUILD  := $(shell date +"%s")
- 
--# enable/disable DEBUG messages
--EXTRA_CFLAGS   += -Wall -DDEBUG -g  
-+# Installation program and options
-+INSTALL         = install
-+INSTALL_PROG    = $(INSTALL) -m0755
-+INSTALL_DIR     = $(INSTALL) -d -m0755
-+
-+# Xen tools installation directory
-+TOOLS_INSTALL_DIR = $(DESTDIR)/usr/bin
-+
-+CC      := gcc
-+CFLAGS  += -g -Wall $(INCLUDE) -DDEBUG
-+CFLAGS  += -I. -Itpm
-+
-+# Is the simulator running in it's own vm?
-+#CFLAGS += -DVTPM_MULTI_VM
-+
-+ifeq ($(COMPILE_ARCH),x86_64)
-+LIBDIR = lib64
-+else
-+LIBDIR = lib
-+endif
- 
- # GNU MP configuration
--GMP_LIB        := /usr/lib/libgmp.a
-+GMP_LIB        := /usr/$(LIBDIR)/libgmp.a
- GMP_HEADER     := /usr/include/gmp.h
- 
- # sources and objects
-@@ -27,38 +43,32 @@ DIRS           := . crypto tpm 
- SRCS           := $(foreach dir, $(DIRS), $(wildcard $(src)/$(dir)/*.c))
- OBJS           := $(patsubst %.c, %.o, $(SRCS))
- SRCS           += $(foreach dir, $(DIRS), $(wildcard $(src)/$(dir)/*.h))
--DISTSRC        := ./README ./AUTHORS ./ChangeLog ./Makefile $(SRCS)
--DISTDIR        := tpm_emulator-$(VERSION_MAJOR).$(VERSION_MINOR)
- 
--obj-m               := $(MODULE_NAME).o
--$(MODULE_NAME)-objs := $(patsubst $(src)/%.o, %.o, $(OBJS)) crypto/libgmp.a
-+obj-m               := $(BIN)
-+$(BIN)-objs := $(patsubst $(src)/%.o, %.o, $(OBJS)) crypto/libgmp.a
- 
- EXTRA_CFLAGS   += -I$(src) -I$(src)/crypto -I$(src)/tpm 
- 
- # do not print "Entering directory ..."
- MAKEFLAGS      += --no-print-directory
- 
--all:	$(src)/crypto/gmp.h $(src)/crypto/libgmp.a version
--	@$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) modules
-+all: $(BIN)
- 
--install:
--	@$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) modules_install
--	test -d /var/tpm || mkdir /var/tpm
--	test -c /dev/tpm || mknod /dev/tpm c 10 224
--	chmod 666 /dev/tpm
--	depmod -a
-+$(BIN):	$(src)/crypto/gmp.h $(src)/crypto/libgmp.a version $(SRCS) $(OBJS)
-+	$(CC) $(CFLAGS) $(OBJS) $(src)/crypto/libgmp.a -o $(BIN)
-+
-+%.o: %.c
-+	$(CC) $(CFLAGS) -c $< -o $@
-+
-+install: $(BIN)
-+	$(INSTALL_PROG) $(BIN) $(TOOLS_INSTALL_DIR)
-+	@if [ ! -d "/var/tpm" ]; then mkdir /var/tpm; fi
- 
- clean:
--	@$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) clean
--	rm -f $(src)/crypto/gmp.h $(src)/crypto/libgmp.a
-+	rm -f $(src)/crypto/gmp.h $(src)/crypto/libgmp.a $(OBJS)
- 
--dist:	$(DISTSRC)
--	rm -rf $(DISTDIR)
--	mkdir $(DISTDIR)
--	cp --parents $(DISTSRC) $(DISTDIR)/
--	rm -f $(DISTDIR)/crypto/gmp.h 
--	tar -chzf $(DISTDIR).tar.gz $(DISTDIR)
--	rm -rf $(DISTDIR)
-+mrproper: clean
-+	rm -f $(BIN) tpm_version.h
- 
- $(src)/crypto/libgmp.a:
- 	test -f $(src)/crypto/libgmp.a || ln -s $(GMP_LIB) $(src)/crypto/libgmp.a
-@@ -88,4 +98,3 @@ version:
- 	@echo "#endif /* _TPM_VERSION_H_ */" >> $(src)/tpm_version.h
- 
- .PHONY: all install clean dist gmp version
--
-diff -uprN orig/tpm_emulator-0.4/README tpm_emulator/README
---- orig/tpm_emulator-0.4/README	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/README	2006-07-24 14:35:35.000000000 -0700
-@@ -13,7 +13,8 @@ $Id: README 113 2006-06-18 12:38:13Z hst
- Copyright
- --------------------------------------------------------------------------
- Copyright (C) 2004 Mario Strasser <mast@gmx.net> and Swiss Federal 
--Institute of Technology (ETH) Zurich.
-+                   Institute of Technology (ETH) Zurich.
-+Copyright (C) 2005 INTEL Corp 
-               
- 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
-@@ -43,6 +44,12 @@ Example:
- GMP_LIB        := /usr/lib/libgmp.a
- GMP_HEADER     := /usr/include/gmp.h
- 
-+GNU MP Library on 64 bit Systems
-+--------------------------------------------------------------------------
-+Some 64-bit kernels have problems with importing the user-space gmp 
-+library (/usr/lib*/libgmp.a) into kernel space.  These kernels will require
-+that the gmp library be recompiled for kernel space with -mcmodel=kernel.
-+
- Installation
- --------------------------------------------------------------------------
- The compilation and installation process uses the build environment for 
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_capability.c tpm_emulator/tpm/tpm_capability.c
---- orig/tpm_emulator-0.4/tpm/tpm_capability.c	2006-06-23 19:37:07.000000000 +0900
-+++ tpm_emulator/tpm/tpm_capability.c	2007-12-28 22:50:19.000000000 +0900
-@@ -701,7 +701,10 @@ TPM_RESULT TPM_GetCapabilityOwner(TPM_VE
-   TPM_RESULT res;
-   
-   info("TPM_GetCapabilityOwner()");
--  
-+ 
-+  if (!tpmData.permanent.flags.owned) {
-+    return TPM_NOSRK;
-+  } 
-   /* Verify owner authorization */
-   res = tpm_verify_auth(auth1, tpmData.permanent.data.ownerAuth, TPM_KH_OWNER);
-   if (res != TPM_SUCCESS) return res;
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_cmd_handler.c tpm_emulator/tpm/tpm_cmd_handler.c
---- orig/tpm_emulator-0.4/tpm/tpm_cmd_handler.c	2006-06-23 19:37:07.000000000 +0900
-+++ tpm_emulator/tpm/tpm_cmd_handler.c	2007-09-12 20:23:00.000000000 +0900
-@@ -565,7 +565,7 @@ static TPM_RESULT execute_TPM_Seal(TPM_R
-   if (tpm_unmarshal_TPM_KEY_HANDLE(&ptr, &len, &keyHandle)
-       || tpm_unmarshal_TPM_ENCAUTH(&ptr, &len, &encAuth)
-       || tpm_unmarshal_UINT32(&ptr, &len, &pcrInfoSize)
--      || tpm_unmarshal_TPM_PCR_INFO(&ptr, &len, &pcrInfo)
-+      || (pcrInfoSize >0 && tpm_unmarshal_TPM_PCR_INFO(&ptr, &len, &pcrInfo))
-       || tpm_unmarshal_UINT32(&ptr, &len, &inDataSize)
-       || tpm_unmarshal_BLOB(&ptr, &len, &inData, inDataSize)
-       || len != 0) return TPM_BAD_PARAMETER;
-@@ -798,7 +798,7 @@ static TPM_RESULT execute_TPM_Sealx(TPM_
-   if (tpm_unmarshal_TPM_KEY_HANDLE(&ptr, &len, &keyHandle)
-       || tpm_unmarshal_TPM_ENCAUTH(&ptr, &len, &encAuth)
-       || tpm_unmarshal_UINT32(&ptr, &len, &pcrInfoSize)
--      || tpm_unmarshal_TPM_PCR_INFO(&ptr, &len, &pcrInfo)
-+      || (pcrInfoSize > 0 && tpm_unmarshal_TPM_PCR_INFO(&ptr, &len, &pcrInfo))
-       || tpm_unmarshal_UINT32(&ptr, &len, &inDataSize)
-       || tpm_unmarshal_BLOB(&ptr, &len, &inData, inDataSize)
-       || len != 0) return TPM_BAD_PARAMETER;
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_credentials.c tpm_emulator/tpm/tpm_credentials.c
---- orig/tpm_emulator-0.4/tpm/tpm_credentials.c	2006-06-23 19:37:07.000000000 +0900
-+++ tpm_emulator/tpm/tpm_credentials.c	2007-09-12 20:23:30.000000000 +0900
-@@ -47,20 +47,20 @@ int tpm_compute_pubkey_checksum(TPM_NONC
- 
- TPM_RESULT tpm_get_pubek(TPM_PUBKEY *pubEndorsementKey)
- {
--  UINT32 key_length;
-+  size_t key_length;
-   if (!tpmData.permanent.data.endorsementKey.size) return TPM_NO_ENDORSEMENT;
-   /* setup TPM_PUBKEY structure */
--  key_length = tpmData.permanent.data.endorsementKey.size;
--  pubEndorsementKey->pubKey.keyLength = key_length >> 3;
-+  pubEndorsementKey->pubKey.keyLength = tpmData.permanent.data.endorsementKey.size >> 3;
-   pubEndorsementKey->pubKey.key = tpm_malloc(pubEndorsementKey->pubKey.keyLength);
-   if (pubEndorsementKey->pubKey.key == NULL) return TPM_FAIL;
-   rsa_export_modulus(&tpmData.permanent.data.endorsementKey,
--    pubEndorsementKey->pubKey.key,
--    &pubEndorsementKey->pubKey.keyLength);
-+		     pubEndorsementKey->pubKey.key,
-+		     &key_length);
-+  pubEndorsementKey->pubKey.keyLength = key_length;
-   pubEndorsementKey->algorithmParms.algorithmID = TPM_ALG_RSA;
-   pubEndorsementKey->algorithmParms.encScheme = TPM_ES_RSAESOAEP_SHA1_MGF1;
-   pubEndorsementKey->algorithmParms.sigScheme = TPM_SS_NONE;
--  pubEndorsementKey->algorithmParms.parms.rsa.keyLength = key_length;
-+  pubEndorsementKey->algorithmParms.parms.rsa.keyLength = key_length << 3;
-   pubEndorsementKey->algorithmParms.parms.rsa.numPrimes = 2;
-   pubEndorsementKey->algorithmParms.parms.rsa.exponentSize = 0;
-   pubEndorsementKey->algorithmParms.parms.rsa.exponent = NULL;
-@@ -175,6 +175,7 @@ TPM_RESULT TPM_OwnerReadInternalPub(TPM_
- {
-   TPM_RESULT res;
-   TPM_KEY_DATA *srk = &tpmData.permanent.data.srk;
-+  size_t key_length;
-   info("TPM_OwnerReadInternalPub()");
-   /* verify authorization */
-   res = tpm_verify_auth(auth1, tpmData.permanent.data.ownerAuth, TPM_KH_OWNER);
-@@ -186,7 +187,8 @@ TPM_RESULT TPM_OwnerReadInternalPub(TPM_
-     publicPortion->pubKey.key = tpm_malloc(publicPortion->pubKey.keyLength);
-     if (publicPortion->pubKey.key == NULL) return TPM_FAIL;
-     rsa_export_modulus(&srk->key, publicPortion->pubKey.key, 
--      &publicPortion->pubKey.keyLength);
-+      &key_length);
-+    publicPortion->pubKey.keyLength = key_length;
-     publicPortion->algorithmParms.algorithmID = TPM_ALG_RSA;
-     publicPortion->algorithmParms.encScheme = srk->encScheme;
-     publicPortion->algorithmParms.sigScheme = srk->sigScheme;
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_crypto.c tpm_emulator/tpm/tpm_crypto.c
---- orig/tpm_emulator-0.4/tpm/tpm_crypto.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_crypto.c	2006-07-24 14:35:35.000000000 -0700
-@@ -182,7 +182,8 @@ TPM_RESULT TPM_CertifyKey(TPM_KEY_HANDLE
-   TPM_KEY_DATA *cert, *key;
-   sha1_ctx_t sha1_ctx;
-   BYTE *buf, *p;
--  UINT32 length;
-+  UINT32 length32;
-+  size_t length;
-   info("TPM_CertifyKey()");
-   /* get keys */
-   cert = tpm_get_key(certHandle);
-@@ -264,14 +265,15 @@ TPM_RESULT TPM_CertifyKey(TPM_KEY_HANDLE
-   /* compute the digest of the CERTIFY_INFO[2] structure and sign it */
-   length = sizeof_TPM_CERTIFY_INFO((*certifyInfo));
-   p = buf = tpm_malloc(length);
-+  length32=(UINT32) length;
-   if (buf == NULL
--      || tpm_marshal_TPM_CERTIFY_INFO(&p, &length, certifyInfo)) {
-+      || tpm_marshal_TPM_CERTIFY_INFO(&p, &length32, certifyInfo)) {
-     free_TPM_KEY_PARMS(certifyInfo->algorithmParms);
-     return TPM_FAIL;
-   }
-   length = sizeof_TPM_CERTIFY_INFO((*certifyInfo));
-   sha1_init(&sha1_ctx);
--  sha1_update(&sha1_ctx, buf, length);
-+  sha1_update(&sha1_ctx, buf, (size_t) length);
-   sha1_final(&sha1_ctx, buf);
-   res = tpm_sign(cert, auth1, FALSE, buf, SHA1_DIGEST_LENGTH, outData, outDataSize);
-   tpm_free(buf);
-@@ -292,7 +294,8 @@ TPM_RESULT TPM_CertifyKey2(TPM_KEY_HANDL
-   TPM_KEY_DATA *cert, *key;
-   sha1_ctx_t sha1_ctx;
-   BYTE *buf, *p;
--  UINT32 length;
-+  size_t length;
-+  UINT32 length32;
-   info("TPM_CertifyKey2()");
-   /* get keys */
-   cert = tpm_get_key(certHandle);
-@@ -362,8 +365,9 @@ TPM_RESULT TPM_CertifyKey2(TPM_KEY_HANDL
-   /* compute the digest of the CERTIFY_INFO[2] structure and sign it */
-   length = sizeof_TPM_CERTIFY_INFO((*certifyInfo));
-   p = buf = tpm_malloc(length);
-+  length32 = (UINT32) length;
-   if (buf == NULL
--      || tpm_marshal_TPM_CERTIFY_INFO(&p, &length, certifyInfo)) {
-+      || tpm_marshal_TPM_CERTIFY_INFO(&p, &length32, certifyInfo)) {
-     free_TPM_KEY_PARMS(certifyInfo->algorithmParms);
-     return TPM_FAIL;
-   }
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_daa.c tpm_emulator/tpm/tpm_daa.c
---- orig/tpm_emulator-0.4/tpm/tpm_daa.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_daa.c	2006-07-24 14:35:35.000000000 -0700
-@@ -716,14 +716,14 @@ TPM_RESULT TPM_DAA_Join(TPM_HANDLE handl
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x00", 1);
-+      sha1_update(&sha1, (BYTE *) "\x00", 1);
-       sha1_final(&sha1, scratch);
-       sha1_init(&sha1);
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey, 
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x01", 1);
-+      sha1_update(&sha1, (BYTE *) "\x01", 1);
-       sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
-       mpz_init(f), mpz_init(q);
-       mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
-@@ -805,14 +805,14 @@ TPM_RESULT TPM_DAA_Join(TPM_HANDLE handl
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x00", 1);
-+      sha1_update(&sha1, (BYTE *) "\x00", 1);
-       sha1_final(&sha1, scratch);
-       sha1_init(&sha1);
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey, 
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x01", 1);
-+      sha1_update(&sha1, (BYTE *) "\x01", 1);
-       sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
-       mpz_init(f), mpz_init(q);
-       mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
-@@ -1489,14 +1489,14 @@ TPM_RESULT TPM_DAA_Join(TPM_HANDLE handl
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x00", 1);
-+      sha1_update(&sha1, (BYTE *) "\x00", 1);
-       sha1_final(&sha1, scratch);
-       sha1_init(&sha1);
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey, 
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x01", 1);
-+      sha1_update(&sha1, (BYTE *) "\x01", 1);
-       sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
-       mpz_init(f), mpz_init(q);
-       mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
-@@ -1712,14 +1712,14 @@ TPM_RESULT TPM_DAA_Join(TPM_HANDLE handl
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x00", 1);
-+      sha1_update(&sha1, (BYTE *) "\x00", 1);
-       sha1_final(&sha1, scratch);
-       sha1_init(&sha1);
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey, 
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x01", 1);
-+      sha1_update(&sha1, (BYTE *) "\x01", 1);
-       sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
-       mpz_init(f), mpz_init(q);
-       mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
-@@ -1793,14 +1793,14 @@ TPM_RESULT TPM_DAA_Join(TPM_HANDLE handl
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x00", 1);
-+      sha1_update(&sha1, (BYTE *) "\x00", 1);
-       sha1_final(&sha1, scratch);
-       sha1_init(&sha1);
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey, 
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x01", 1);
-+      sha1_update(&sha1, (BYTE *) "\x01", 1);
-       sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
-       mpz_init(f), mpz_init(q);
-       mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
-@@ -2918,14 +2918,14 @@ TPM_RESULT TPM_DAA_Sign(TPM_HANDLE handl
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x00", 1);
-+      sha1_update(&sha1, (BYTE *) "\x00", 1);
-       sha1_final(&sha1, scratch);
-       sha1_init(&sha1);
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey, 
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x01", 1);
-+      sha1_update(&sha1, (BYTE *) "\x01", 1);
-       sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
-       mpz_init(f), mpz_init(q);
-       mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
-@@ -3143,7 +3143,7 @@ TPM_RESULT TPM_DAA_Sign(TPM_HANDLE handl
-         sha1_init(&sha1);
-         sha1_update(&sha1, (BYTE*) &session->DAA_session.DAA_digest, 
-           sizeof(session->DAA_session.DAA_digest));
--        sha1_update(&sha1, "\x01", 1);
-+        sha1_update(&sha1, (BYTE *) "\x01", 1);
-         sha1_update(&sha1, inputData1, inputSize1);
-         sha1_final(&sha1, (BYTE*) &session->DAA_session.DAA_digest);
-       }
-@@ -3172,7 +3172,7 @@ TPM_RESULT TPM_DAA_Sign(TPM_HANDLE handl
-         sha1_init(&sha1);
-         sha1_update(&sha1, (BYTE*) &session->DAA_session.DAA_digest, 
-           sizeof(session->DAA_session.DAA_digest));
--        sha1_update(&sha1, "\x00", 1);
-+        sha1_update(&sha1, (BYTE*) "\x00", 1);
-         rsa_export_modulus(&aikData->key, scratch, &size);
-         sha1_update(&sha1, scratch, size);
-         sha1_final(&sha1, (BYTE*) &session->DAA_session.DAA_digest);
-@@ -3229,14 +3229,14 @@ TPM_RESULT TPM_DAA_Sign(TPM_HANDLE handl
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x00", 1);
-+      sha1_update(&sha1, (BYTE *) "\x00", 1);
-       sha1_final(&sha1, scratch);
-       sha1_init(&sha1);
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey, 
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x01", 1);
-+      sha1_update(&sha1, (BYTE *) "\x01", 1);
-       sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
-       mpz_init(f), mpz_init(q);
-       mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
-@@ -3309,14 +3309,14 @@ TPM_RESULT TPM_DAA_Sign(TPM_HANDLE handl
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x00", 1);
-+      sha1_update(&sha1, (BYTE *) "\x00", 1);
-       sha1_final(&sha1, scratch);
-       sha1_init(&sha1);
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_rekey, 
-           sizeof(session->DAA_tpmSpecific.DAA_rekey));
-       sha1_update(&sha1, (BYTE*) &session->DAA_tpmSpecific.DAA_count, 
-           sizeof(session->DAA_tpmSpecific.DAA_count));
--      sha1_update(&sha1, "\x01", 1);
-+      sha1_update(&sha1, (BYTE *) "\x01", 1);
-       sha1_final(&sha1, scratch + SHA1_DIGEST_LENGTH);
-       mpz_init(f), mpz_init(q);
-       mpz_import(f, 2 * SHA1_DIGEST_LENGTH, 1, 1, 0, 0, scratch);
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_data.c tpm_emulator/tpm/tpm_data.c
---- orig/tpm_emulator-0.4/tpm/tpm_data.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_data.c	2006-07-24 14:35:35.000000000 -0700
-@@ -40,6 +40,7 @@ static inline void init_pcr_attr(int pcr
- void tpm_init_data(void)
- {
-   /* endorsement key */
-+#ifndef TPM_GENERATE_EK
-   uint8_t ek_n[] =  "\xa8\xdb\xa9\x42\xa8\xf3\xb8\x06\x85\x90\x76\x93\xad\xf7"
-     "\x74\xec\x3f\xd3\x3d\x9d\xe8\x2e\xff\x15\xed\x0e\xce\x5f\x93"
-     "\x92\xeb\xd1\x96\x2b\x72\x18\x81\x79\x12\x9d\x9c\x40\xd7\x1a"
-@@ -77,6 +78,8 @@ void tpm_init_data(void)
-     "\xd1\xc0\x8b\x5b\xa2\x2e\xa7\x15\xca\x50\x75\x10\x48\x9c\x2b"
-     "\x18\xb9\x67\x8f\x5d\x64\xc3\x28\x9f\x2f\x16\x2f\x08\xda\x47"
-     "\xec\x86\x43\x0c\x80\x99\x07\x34\x0f";
-+#endif
-+
-   int i;
-   /* reset all data to NULL, FALSE or 0 */
-   memset(&tpmData, 0, sizeof(tpmData));
-@@ -152,44 +155,43 @@ void tpm_release_data(void)
- 
- #ifdef TPM_STORE_TO_FILE
- 
--#include <linux/fs.h>
--#include <linux/unistd.h>
--#include <asm/uaccess.h>
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include <fcntl.h>
-+#include <unistd.h>
- 
- #define TPM_STORAGE_FILE "/var/tpm/tpm_emulator-1.2." STR(VERSION_MAJOR) "." STR(VERSION_MINOR) 
- 
- static int write_to_file(uint8_t *data, size_t data_length)
- {
-   int res;
--  struct file *fp;
--  mm_segment_t old_fs = get_fs();
--  fp = filp_open(TPM_STORAGE_FILE, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR);
--  if (IS_ERR(fp)) return -1;
--  set_fs(get_ds());
--  res = fp->f_op->write(fp, data, data_length, &fp->f_pos);
--  set_fs(old_fs);
--  filp_close(fp, NULL);
-+  int fp;
-+  fp = open(TPM_STORAGE_FILE, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR);
-+  res = write(fp, data, data_length);
-+  close(fp);
-   return (res == data_length) ? 0 : -1;
- }
- 
- static int read_from_file(uint8_t **data, size_t *data_length)
- {
-   int res;
--  struct file *fp;
--  mm_segment_t old_fs = get_fs();
--  fp = filp_open(TPM_STORAGE_FILE, O_RDONLY, 0);
--  if (IS_ERR(fp)) return -1;
--  *data_length = (size_t)fp->f_dentry->d_inode->i_size;
--  /* *data_length = i_size_read(fp->f_dentry->d_inode); */
-+  int fp, file_status;
-+  struct stat file_info;
-+  fp = open(TPM_STORAGE_FILE, O_RDONLY, 0);
-+  file_status = fstat(fp, &file_info);
-+  if (file_status < 0) {
-+    close(fp);
-+    return -1;
-+  } 
-+
-+  *data_length = file_info.st_size; 
-   *data = tpm_malloc(*data_length);
-   if (*data == NULL) {
--    filp_close(fp, NULL);
-+    close(fp);
-     return -1;
-   }
--  set_fs(get_ds());
--  res = fp->f_op->read(fp, *data, *data_length, &fp->f_pos);
--  set_fs(old_fs);
--  filp_close(fp, NULL);
-+  res = read(fp, *data, *data_length);
-+  close(fp);
-   if (res != *data_length) {
-     tpm_free(*data);
-     return -1;
-@@ -216,23 +218,30 @@ static int read_from_file(uint8_t **data
- int tpm_store_permanent_data(void)
- {
-   uint8_t *buf, *ptr;
--  size_t buf_length, len;
-+  UINT32 buf_length, len;
- 
-   /* marshal data */
--  buf_length = len = sizeof_TPM_STCLEAR_FLAGS(tpmData.stclear.flags)
--    + sizeof_TPM_PERMANENT_FLAGS(tpmData.permanent.flags) + 2
--    + sizeof_TPM_PERMANENT_DATA(tpmData.permanent.data);
-+  buf_length = len = 4 + sizeof_TPM_STCLEAR_FLAGS(tpmData.stclear.flags)
-+    + sizeof_TPM_PERMANENT_FLAGS(tpmData.permanent.flags) 
-+    + sizeof_TPM_STANY_FLAGS(tpmData.stany.flags) + 2
-+    + sizeof_TPM_STCLEAR_DATA(tpmData.stclear.data) 
-+    + sizeof_TPM_PERMANENT_DATA(tpmData.permanent.data)
-+    + sizeof_TPM_STANY_DATA(tpmData.stany.data);
-   buf = ptr = tpm_malloc(buf_length);
-   if (buf == NULL
-       || tpm_marshal_TPM_VERSION(&ptr, &len, &tpmData.permanent.data.version)
-       || tpm_marshal_TPM_STCLEAR_FLAGS(&ptr, &len, &tpmData.stclear.flags)
-       || tpm_marshal_TPM_PERMANENT_FLAGS(&ptr, &len, &tpmData.permanent.flags)
-+      || tpm_marshal_TPM_STANY_FLAGS(&ptr, &len, &tpmData.stany.flags)
-       || tpm_marshal_BOOL(&ptr, &len, tpmData.permanent.flags.selfTestSucceeded)
-       || tpm_marshal_BOOL(&ptr, &len, tpmData.permanent.flags.owned)
--      || tpm_marshal_TPM_PERMANENT_DATA(&ptr, &len, &tpmData.permanent.data)) {
-+      || tpm_marshal_TPM_STCLEAR_DATA(&ptr, &len, &tpmData.stclear.data)
-+      || tpm_marshal_TPM_PERMANENT_DATA(&ptr, &len, &tpmData.permanent.data)
-+      || tpm_marshal_TPM_STANY_DATA(&ptr, &len, &tpmData.stany.data)) {
-     tpm_free(buf);
-     return -1;
-   }
-+
-   if (write_to_file(buf, buf_length - len)) {
-     tpm_free(buf);
-     return -1; 
-@@ -244,31 +253,36 @@ int tpm_store_permanent_data(void)
- int tpm_restore_permanent_data(void)
- {
-   uint8_t *buf, *ptr;
--  size_t buf_length, len;
-+  size_t buf_length;
-+  UINT32 len;
-   TPM_VERSION ver;
- 
-   /* read data */
-   if (read_from_file(&buf, &buf_length)) return -1;
-   ptr = buf;
--  len = buf_length;
-+  len = (uint32_t) buf_length;
-   /* unmarshal data */
-   if (tpm_unmarshal_TPM_VERSION(&ptr, &len, &ver)
-       || memcmp(&ver, &tpmData.permanent.data.version, sizeof(TPM_VERSION))
-       || tpm_unmarshal_TPM_STCLEAR_FLAGS(&ptr, &len, &tpmData.stclear.flags)
-       || tpm_unmarshal_TPM_PERMANENT_FLAGS(&ptr, &len, &tpmData.permanent.flags)
-+      || tpm_unmarshal_TPM_STANY_FLAGS(&ptr, &len, &tpmData.stany.flags)
-       || tpm_unmarshal_BOOL(&ptr, &len, &tpmData.permanent.flags.selfTestSucceeded)
-       || tpm_unmarshal_BOOL(&ptr, &len, &tpmData.permanent.flags.owned)
--      || tpm_unmarshal_TPM_PERMANENT_DATA(&ptr, &len, &tpmData.permanent.data)) {
-+      || tpm_unmarshal_TPM_STCLEAR_DATA(&ptr, &len, &tpmData.stclear.data)
-+      || tpm_unmarshal_TPM_PERMANENT_DATA(&ptr, &len, &tpmData.permanent.data)
-+      || tpm_unmarshal_TPM_STANY_DATA(&ptr, &len, &tpmData.stany.data)) {
-     tpm_free(buf);
-     return -1;
-   }
-+
-   tpm_free(buf);
-   return 0;
- }
- 
- int tpm_erase_permanent_data(void)
- {
--  int res = write_to_file("", 0);
-+  int res = write_to_file((uint8_t *) "", 0);
-   return res;
- }
- 
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_deprecated.c tpm_emulator/tpm/tpm_deprecated.c
---- orig/tpm_emulator-0.4/tpm/tpm_deprecated.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_deprecated.c	2006-07-24 14:35:35.000000000 -0700
-@@ -1,6 +1,7 @@
- /* Software-Based Trusted Platform Module (TPM) Emulator for Linux
-  * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
-  *                    Swiss Federal Institute of Technology (ETH) Zurich
-+ * Copyright (C) 2005 INTEL Corp
-  *
-  * This module is free software; you can redistribute it and/or modify
-  * it under the terms of the GNU General Public License as published
-@@ -50,7 +51,7 @@ TPM_RESULT TPM_SaveKeyContext(TPM_KEY_HA
-   BYTE *ptr;
-   UINT32 len;
-   info("TPM_SaveKeyContext()");
--  res = TPM_SaveContext(keyHandle, TPM_RT_KEY, "SaveKeyContext..", 
-+  res = TPM_SaveContext(keyHandle, TPM_RT_KEY, (BYTE*)"SaveKeyContext..", 
-                         keyContextSize, &contextBlob);
-   if (res != TPM_SUCCESS) return res;
-   len = *keyContextSize;
-@@ -82,7 +83,7 @@ TPM_RESULT TPM_SaveAuthContext(TPM_AUTHH
-   BYTE *ptr;
-   UINT32 len;
-   info("TPM_SaveAuthContext()");
--  res = TPM_SaveContext(authHandle, TPM_RT_KEY, "SaveAuthContext.", 
-+  res = TPM_SaveContext(authHandle, TPM_RT_KEY, (BYTE*)"SaveAuthContext.", 
-                         authContextSize, &contextBlob);
-   if (res != TPM_SUCCESS) return res;
-   len = *authContextSize;
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_emulator.h tpm_emulator/tpm/tpm_emulator.h
---- orig/tpm_emulator-0.4/tpm/tpm_emulator.h	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_emulator.h	2006-07-24 14:35:35.000000000 -0700
-@@ -1,5 +1,6 @@
- /* Software-Based Trusted Platform Module (TPM) Emulator for Linux
-  * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
-+ * Copyright (C) 2005 INTEL Corp
-  *
-  * This module is free software; you can redistribute it and/or modify
-  * it under the terms of the GNU General Public License as published
-@@ -22,7 +23,8 @@
- /* TPM configuration */
- #define TPM_STORE_TO_FILE       1
- #undef  TPM_STRONG_PERSISTENCE
--#undef  TPM_GENERATE_EK
-+//#undef  TPM_GENERATE_EK
-+#define  TPM_GENERATE_EK
- #undef  TPM_GENERATE_SEED_DAA
- 
- #define TPM_MANUFACTURER 0x4554485A /* 'ETHZ' */        
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_marshalling.c tpm_emulator/tpm/tpm_marshalling.c
---- orig/tpm_emulator-0.4/tpm/tpm_marshalling.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_marshalling.c	2006-07-24 14:35:35.000000000 -0700
-@@ -1312,7 +1312,7 @@ int tpm_unmarshal_TPM_STANY_FLAGS(BYTE *
- 
- int tpm_marshal_RSA(BYTE **ptr, UINT32 *length, rsa_private_key_t *v)
- {
--  UINT32 m_len, e_len, q_len;
-+  size_t m_len, e_len, q_len;
-   if (*length < sizeof_RSA((*v))) return -1;
-   if (v->size > 0) {
-     rsa_export_modulus(v, &(*ptr)[6], &m_len);
-@@ -1460,6 +1460,66 @@ int tpm_unmarshal_TPM_PERMANENT_DATA(BYT
-   return 0;
- }
- 
-+int tpm_marshal_TPM_STCLEAR_DATA(BYTE **ptr, UINT32 *length, TPM_STCLEAR_DATA *v)
-+{
-+  if (tpm_marshal_TPM_STRUCTURE_TAG(ptr, length, v->tag)
-+    || tpm_marshal_TPM_NONCE(ptr, length, &v->contextNonceKey)
-+    || tpm_marshal_TPM_COUNT_ID(ptr, length, v->countID) ) return -1;
-+
-+  return 0;
-+}
-+
-+int tpm_unmarshal_TPM_STCLEAR_DATA(BYTE **ptr, UINT32 *length, TPM_STCLEAR_DATA *v)
-+{
-+  if (tpm_unmarshal_TPM_STRUCTURE_TAG(ptr, length, &v->tag)
-+    || tpm_unmarshal_TPM_NONCE(ptr, length, &v->contextNonceKey)
-+    || tpm_unmarshal_TPM_COUNT_ID(ptr, length, &v->countID) ) return -1;
-+
-+  return 0;
-+}
-+
-+int tpm_marshal_TPM_STANY_DATA(BYTE **ptr, UINT32 *length, TPM_STANY_DATA *v)
-+{
-+  UINT32 i;
-+  if (tpm_marshal_TPM_STRUCTURE_TAG(ptr, length, v->tag)
-+    || tpm_marshal_TPM_NONCE(ptr, length, &v->contextNonceSession)
-+    || tpm_marshal_TPM_DIGEST(ptr, length, &v->auditDigest)
-+    || tpm_marshal_BOOL(ptr, length, v->auditSession)
-+    || tpm_marshal_TPM_CURRENT_TICKS(ptr, length, &v->currentTicks)
-+    || tpm_marshal_UINT32(ptr, length, v->contextCount)
-+    || tpm_marshal_UINT32_ARRAY(ptr, length, v->contextList, TPM_MAX_SESSION_LIST)) return -1;
-+  for (i = 0; i < TPM_MAX_SESSIONS; i++) {
-+    if (tpm_marshal_TPM_SESSION_DATA(ptr, length, &v->sessions[i])) return -1;
-+  }
-+  for (i = 0; i < TPM_MAX_SESSIONS_DAA; i++) {
-+    if (tpm_marshal_TPM_DAA_SESSION_DATA(ptr, length, &v->sessionsDAA[i])) return -1;
-+  }
-+  if (tpm_marshal_TPM_TRANSHANDLE(ptr, length, v->transExclusive)) return -1;
-+
-+  return 0;
-+}
-+
-+int tpm_unmarshal_TPM_STANY_DATA(BYTE **ptr, UINT32 *length, TPM_STANY_DATA *v)
-+{
-+  UINT32 i;
-+  if (tpm_unmarshal_TPM_STRUCTURE_TAG(ptr, length, &v->tag)
-+    || tpm_unmarshal_TPM_NONCE(ptr, length, &v->contextNonceSession)
-+    || tpm_unmarshal_TPM_DIGEST(ptr, length, &v->auditDigest)
-+    || tpm_unmarshal_BOOL(ptr, length, &v->auditSession)
-+    || tpm_unmarshal_TPM_CURRENT_TICKS(ptr, length, &v->currentTicks)
-+    || tpm_unmarshal_UINT32(ptr, length, &v->contextCount)
-+    || tpm_unmarshal_UINT32_ARRAY(ptr, length, v->contextList, TPM_MAX_SESSION_LIST)) return -1;
-+  for (i = 0; i < TPM_MAX_SESSIONS; i++) {
-+    if (tpm_unmarshal_TPM_SESSION_DATA(ptr, length, &v->sessions[i])) return -1;
-+  }
-+  for (i = 0; i < TPM_MAX_SESSIONS_DAA; i++) {
-+    if (tpm_unmarshal_TPM_DAA_SESSION_DATA(ptr, length, &v->sessionsDAA[i])) return -1;
-+  }
-+  if (tpm_unmarshal_TPM_TRANSHANDLE(ptr, length, &v->transExclusive)) return -1;
-+
-+  return 0;
-+}
-+
- int tpm_marshal_TPM_SESSION_DATA(BYTE **ptr, UINT32 *length, TPM_SESSION_DATA *v)
- {
-   if (tpm_marshal_BYTE(ptr, length, v->type)
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_marshalling.h tpm_emulator/tpm/tpm_marshalling.h
---- orig/tpm_emulator-0.4/tpm/tpm_marshalling.h	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_marshalling.h	2006-07-24 14:35:35.000000000 -0700
-@@ -432,6 +432,12 @@ int tpm_unmarshal_TPM_KEY_DATA(BYTE **pt
- int tpm_marshal_TPM_PERMANENT_DATA(BYTE **ptr, UINT32 *length, TPM_PERMANENT_DATA *);
- int tpm_unmarshal_TPM_PERMANENT_DATA(BYTE **ptr, UINT32 *length, TPM_PERMANENT_DATA *);
- 
-+int tpm_marshal_TPM_STCLEAR_DATA(BYTE **ptr, UINT32 *length, TPM_STCLEAR_DATA *v);
-+int tpm_unmarshal_TPM_STCLEAR_DATA(BYTE **ptr, UINT32 *length, TPM_STCLEAR_DATA *v);
-+
-+int tpm_marshal_TPM_STANY_DATA(BYTE **ptr, UINT32 *length, TPM_STANY_DATA *v);
-+int tpm_unmarshal_TPM_STANY_DATA(BYTE **ptr, UINT32 *length, TPM_STANY_DATA *v);
-+
- int tpm_marshal_TPM_SESSION_DATA(BYTE **ptr, UINT32 *length, TPM_SESSION_DATA *v);
- int tpm_unmarshal_TPM_SESSION_DATA(BYTE **ptr, UINT32 *length, TPM_SESSION_DATA *v);
- 
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_owner.c tpm_emulator/tpm/tpm_owner.c
---- orig/tpm_emulator-0.4/tpm/tpm_owner.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_owner.c	2006-07-24 14:35:35.000000000 -0700
-@@ -108,7 +108,7 @@ TPM_RESULT TPM_TakeOwnership(TPM_PROTOCO
-   TPM_RESULT res;
-   rsa_private_key_t *ek = &tpmData.permanent.data.endorsementKey;
-   TPM_KEY_DATA *srk = &tpmData.permanent.data.srk;
--  UINT32 buf_size = ek->size >> 3;
-+  size_t buf_size = ek->size >> 3, key_length; 
-   BYTE buf[buf_size];
- 
-   info("TPM_TakeOwnership()");
-@@ -173,7 +173,8 @@ TPM_RESULT TPM_TakeOwnership(TPM_PROTOCO
-     return TPM_FAIL;
-   }
-   rsa_export_modulus(&srk->key, srkPub->pubKey.key,
--    &srkPub->pubKey.keyLength);
-+		     &key_length);
-+  srkPub->pubKey.keyLength = (UINT32) key_length;
-   /* setup tpmProof and set state to owned */
-   tpm_get_random_bytes(tpmData.permanent.data.tpmProof.nonce, 
-     sizeof(tpmData.permanent.data.tpmProof.nonce));
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_startup.c tpm_emulator/tpm/tpm_startup.c
---- orig/tpm_emulator-0.4/tpm/tpm_startup.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_startup.c	2006-07-24 14:35:35.000000000 -0700
-@@ -41,26 +41,29 @@ void TPM_Init(TPM_STARTUP_TYPE startupTy
- TPM_RESULT TPM_Startup(TPM_STARTUP_TYPE startupType)
- {
-   int i;
-+  int restore_fail;
-   info("TPM_Startup(%d)", startupType);
-   if (tpmData.stany.flags.postInitialise == FALSE) return TPM_INVALID_POSTINIT;
--  /* reset STANY_FLAGS */
--  SET_TO_ZERO(&tpmData.stany.flags);
--  tpmData.stany.flags.tag = TPM_TAG_STANY_FLAGS;
--  /* reset STANY_DATA (invalidates ALL sessions) */
--  SET_TO_ZERO(&tpmData.stany.data);
--  tpmData.stany.data.tag = TPM_TAG_STANY_DATA;
--  /* init session-context nonce */
--  SET_TO_RAND(&tpmData.stany.data.contextNonceSession);
-+
-+  /* try and restore state to get EK, SRK, etc */
-+  restore_fail = tpm_restore_permanent_data();
-+
-   /* set data and flags according to the given startup type */
-   if (startupType == TPM_ST_CLEAR) {
--    /* if available, restore permanent data */
--    tpm_restore_permanent_data();
-+    /* reset STANY_FLAGS */
-+    SET_TO_ZERO(&tpmData.stany.flags);
-+    tpmData.stany.flags.tag = TPM_TAG_STANY_FLAGS;
-+    /* reset STANY_DATA (invalidates ALL sessions) */
-+    SET_TO_ZERO(&tpmData.stany.data);
-+    tpmData.stany.data.tag = TPM_TAG_STANY_DATA;
-+    /* init session-context nonce */
-+    SET_TO_RAND(&tpmData.stany.data.contextNonceSession);
-     /* reset PCR values */
-     for (i = 0; i < TPM_NUM_PCR; i++) {
--      if (tpmData.permanent.data.pcrAttrib[i].pcrReset)
--        SET_TO_ZERO(tpmData.permanent.data.pcrValue[i].digest);
-+      if (!tpmData.permanent.data.pcrAttrib[i].pcrReset)
-+        SET_TO_ZERO(&tpmData.permanent.data.pcrValue[i].digest);
-       else
--        SET_TO_0xFF(tpmData.permanent.data.pcrValue[i].digest);
-+        SET_TO_0xFF(&tpmData.permanent.data.pcrValue[i].digest);
-     }
-     /* reset STCLEAR_FLAGS */
-     SET_TO_ZERO(&tpmData.stclear.flags);
-@@ -79,7 +82,8 @@ TPM_RESULT TPM_Startup(TPM_STARTUP_TYPE 
-     /* init key-context nonce */
-     SET_TO_RAND(&tpmData.stclear.data.contextNonceKey);
-   } else if (startupType == TPM_ST_STATE) {
--    if (tpm_restore_permanent_data()) {
-+    /* restore must have been successful for TPM_ST_STATE */
-+    if (restore_fail) {
-       error("restoring permanent data failed");
-       tpmData.permanent.data.testResult = "tpm_restore_permanent_data() failed";
-       tpmData.permanent.flags.selfTestSucceeded = FALSE;
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_storage.c tpm_emulator/tpm/tpm_storage.c
---- orig/tpm_emulator-0.4/tpm/tpm_storage.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_storage.c	2006-07-24 14:35:35.000000000 -0700
-@@ -58,6 +58,7 @@ int encrypt_sealed_data(TPM_KEY_DATA *ke
-                         BYTE *enc, UINT32 *enc_size)
- {
-   UINT32 len;
-+  size_t enc_size32 = *enc_size;
-   BYTE *buf, *ptr;
-   rsa_public_key_t pub_key;
-   int scheme;
-@@ -72,7 +73,7 @@ int encrypt_sealed_data(TPM_KEY_DATA *ke
-   if (buf == NULL
-       || tpm_marshal_TPM_SEALED_DATA(&ptr, &len, seal)
-       || rsa_encrypt(&pub_key, scheme, buf, sizeof_TPM_SEALED_DATA((*seal)),
--                     enc, enc_size)) {
-+                     enc, &enc_size32)) {
-     tpm_free(buf);
-     rsa_release_public_key(&pub_key);
-     return -1;
-@@ -85,7 +86,8 @@ int encrypt_sealed_data(TPM_KEY_DATA *ke
- int decrypt_sealed_data(TPM_KEY_DATA *key, BYTE *enc, UINT32 enc_size,
-                         TPM_SEALED_DATA *seal, BYTE **buf) 
- {
--  UINT32 len;
-+  size_t len;
-+  UINT32 len32;
-   BYTE *ptr;
-   int scheme;
-   switch (key->encScheme) {
-@@ -96,8 +98,12 @@ int decrypt_sealed_data(TPM_KEY_DATA *ke
-   len = enc_size;
-   *buf = ptr = tpm_malloc(len);
-   if (*buf == NULL
--      || rsa_decrypt(&key->key, scheme, enc, enc_size, *buf, &len)
--      || tpm_unmarshal_TPM_SEALED_DATA(&ptr, &len, seal)) {
-+      || rsa_decrypt(&key->key, scheme, enc, enc_size, *buf, &len) ){
-+    tpm_free(*buf);
-+    return -1;
-+  }
-+  len32 = len;
-+  if (tpm_unmarshal_TPM_SEALED_DATA(&ptr, &len32, seal)) {
-     tpm_free(*buf);
-     return -1;
-   }
-@@ -240,11 +246,12 @@ TPM_RESULT TPM_Unseal(TPM_KEY_HANDLE par
- 
- TPM_RESULT TPM_UnBind(TPM_KEY_HANDLE keyHandle, UINT32 inDataSize,
-                       BYTE *inData, TPM_AUTH *auth1, 
--                      UINT32 *outDataSize, BYTE **outData)
-+                      UINT32 *outDataSize32, BYTE **outData)
- {
-   TPM_RESULT res;
-   TPM_KEY_DATA *key;
-   int scheme;
-+  size_t outDataSize;
-   
-   info("TPM_UnBind()");
-   /* get key */
-@@ -262,8 +269,8 @@ TPM_RESULT TPM_UnBind(TPM_KEY_HANDLE key
-   /* the size of the input data muss be greater than zero */
-   if (inDataSize == 0) return TPM_BAD_PARAMETER;
-   /* decrypt data */
--  *outDataSize = inDataSize;
--  *outData = tpm_malloc(*outDataSize);
-+  outDataSize = inDataSize;
-+  *outData = tpm_malloc(outDataSize);
-   if (*outData == NULL) return TPM_NOSPACE;
-   switch (key->encScheme) {
-     case TPM_ES_RSAESOAEP_SHA1_MGF1: scheme = RSA_ES_OAEP_SHA1; break;
-@@ -271,20 +278,21 @@ TPM_RESULT TPM_UnBind(TPM_KEY_HANDLE key
-     default: tpm_free(*outData); return TPM_DECRYPT_ERROR;
-   }
-   if (rsa_decrypt(&key->key, scheme, inData, inDataSize, 
--      *outData, outDataSize)) {
-+      *outData, &outDataSize)) {
-     tpm_free(*outData);
-     return TPM_DECRYPT_ERROR;
-   }
-   /* verify data if it is of type TPM_BOUND_DATA */
-   if (key->encScheme == TPM_ES_RSAESOAEP_SHA1_MGF1 
-       || key->keyUsage != TPM_KEY_LEGACY) {
--    if (*outDataSize < 5 || memcmp(*outData, "\x01\x01\00\x00\x02", 5) != 0) {
-+    if (outDataSize < 5 || memcmp(*outData, "\x01\x01\00\x00\x02", 5) != 0) {
-       tpm_free(*outData);
-       return TPM_DECRYPT_ERROR;
-     }
--    *outDataSize -= 5;
--    memmove(*outData, &(*outData)[5], *outDataSize);
-+    outDataSize -= 5;
-+    memmove(*outData, &(*outData)[5], outDataSize);
-   }
-+  *outDataSize32 = (UINT32) outDataSize;
-   return TPM_SUCCESS;
- }
- 
-@@ -334,12 +342,13 @@ int compute_pubkey_digest(TPM_PUBKEY *ke
- }
- 
- int encrypt_private_key(TPM_KEY_DATA *key, TPM_STORE_ASYMKEY *store,
--                        BYTE *enc, UINT32 *enc_size)
-+                        BYTE *enc, UINT32 *enc_size32)
- {
-   UINT32 len;
-   BYTE *buf, *ptr;
-   rsa_public_key_t pub_key;
-   int scheme;
-+  size_t enc_size;
-   switch (key->encScheme) {
-     case TPM_ES_RSAESOAEP_SHA1_MGF1: scheme = RSA_ES_OAEP_SHA1; break;
-     case TPM_ES_RSAESPKCSv15: scheme = RSA_ES_PKCSV15; break;
-@@ -351,11 +360,12 @@ int encrypt_private_key(TPM_KEY_DATA *ke
-   if (buf == NULL
-       || tpm_marshal_TPM_STORE_ASYMKEY(&ptr, &len, store)
-       || rsa_encrypt(&pub_key, scheme, buf, sizeof_TPM_STORE_ASYMKEY((*store)),
--                     enc, enc_size)) {
-+                     enc, &enc_size)) {
-     tpm_free(buf);
-     rsa_release_public_key(&pub_key);
-     return -1;
-   }
-+  *enc_size32 = (UINT32) enc_size;
-   tpm_free(buf);
-   rsa_release_public_key(&pub_key);
-   return 0;
-@@ -364,7 +374,8 @@ int encrypt_private_key(TPM_KEY_DATA *ke
- int decrypt_private_key(TPM_KEY_DATA *key, BYTE *enc, UINT32 enc_size, 
-                         TPM_STORE_ASYMKEY *store, BYTE **buf) 
- {
--  UINT32 len;
-+  UINT32 len32;
-+  size_t len;
-   BYTE *ptr;
-   int scheme;
-   switch (key->encScheme) {
-@@ -375,8 +386,12 @@ int decrypt_private_key(TPM_KEY_DATA *ke
-   len = enc_size;
-   *buf = ptr = tpm_malloc(len);
-   if (*buf == NULL
--      || rsa_decrypt(&key->key, scheme, enc, enc_size, *buf, &len)
--      || tpm_unmarshal_TPM_STORE_ASYMKEY(&ptr, &len, store)) {
-+      || rsa_decrypt(&key->key, scheme, enc, enc_size, *buf, &len) ) {
-+    tpm_free(*buf);
-+    return -1;
-+  }
-+  len32 = (UINT32) len;
-+  if (tpm_unmarshal_TPM_STORE_ASYMKEY(&ptr, &len32, store)) {  
-     tpm_free(*buf);
-     return -1;
-   }
-@@ -394,7 +409,7 @@ TPM_RESULT TPM_CreateWrapKey(TPM_KEY_HAN
-   TPM_SESSION_DATA *session;
-   TPM_STORE_ASYMKEY store;
-   rsa_private_key_t rsa;
--  UINT32 key_length;
-+  size_t key_length;
- 
-   info("TPM_CreateWrapKey()");
-   /* get parent key */
-@@ -450,11 +465,11 @@ TPM_RESULT TPM_CreateWrapKey(TPM_KEY_HAN
-     }
-   }
-   /* generate key and store it */
--  key_length = keyInfo->algorithmParms.parms.rsa.keyLength;
--  if (rsa_generate_key(&rsa, key_length)) return TPM_FAIL;
--  wrappedKey->pubKey.keyLength = key_length >> 3;
-+  if (rsa_generate_key(&rsa, keyInfo->algorithmParms.parms.rsa.keyLength)) 
-+    return TPM_FAIL;
-+  wrappedKey->pubKey.keyLength = keyInfo->algorithmParms.parms.rsa.keyLength >> 3;
-   wrappedKey->pubKey.key = tpm_malloc(wrappedKey->pubKey.keyLength);
--  store.privKey.keyLength = key_length >> 4;
-+  store.privKey.keyLength = keyInfo->algorithmParms.parms.rsa.keyLength >> 4;
-   store.privKey.key = tpm_malloc(store.privKey.keyLength);
-   wrappedKey->encDataSize = parent->key.size >> 3;
-   wrappedKey->encData = tpm_malloc(wrappedKey->encDataSize);
-@@ -466,9 +481,11 @@ TPM_RESULT TPM_CreateWrapKey(TPM_KEY_HAN
-     tpm_free(wrappedKey->encData);
-     return TPM_NOSPACE;
-   }
--  rsa_export_modulus(&rsa, wrappedKey->pubKey.key, 
--    &wrappedKey->pubKey.keyLength);
--  rsa_export_prime1(&rsa, store.privKey.key, &store.privKey.keyLength);
-+  rsa_export_modulus(&rsa, wrappedKey->pubKey.key,
-+		     &key_length);
-+  wrappedKey->pubKey.keyLength = (UINT32) key_length;
-+  rsa_export_prime1(&rsa, store.privKey.key, &key_length);
-+  store.privKey.keyLength = (UINT32) key_length;
-   rsa_release_private_key(&rsa);
-   /* compute the digest of the wrapped key (without encData) */
-   if (compute_key_digest(wrappedKey, &store.pubDataDigest)) {
-@@ -602,6 +619,7 @@ TPM_RESULT TPM_LoadKey2(TPM_KEY_HANDLE p
- 
- int tpm_setup_key_parms(TPM_KEY_DATA *key, TPM_KEY_PARMS *parms)
- {
-+  size_t key_length;
-   parms->algorithmID = TPM_ALG_RSA;
-   parms->encScheme = key->encScheme;
-   parms->sigScheme = key->sigScheme;
-@@ -611,7 +629,8 @@ int tpm_setup_key_parms(TPM_KEY_DATA *ke
-   parms->parms.rsa.exponent = tpm_malloc(parms->parms.rsa.exponentSize);
-   if (parms->parms.rsa.exponent == NULL) return -1;
-   rsa_export_exponent(&key->key, parms->parms.rsa.exponent,
--    &parms->parms.rsa.exponentSize);
-+    &key_length);
-+  parms->parms.rsa.exponentSize = (UINT32) key_length;
-   parms->parmSize = 12 + parms->parms.rsa.exponentSize;
-   return 0;
- }
-@@ -622,6 +641,7 @@ TPM_RESULT TPM_GetPubKey(TPM_KEY_HANDLE 
-   TPM_RESULT res;
-   TPM_KEY_DATA *key;
-   TPM_DIGEST digest;
-+  size_t key_length;
-   info("TPM_GetPubKey()");
-   /* get key */
-   if (keyHandle == TPM_KH_SRK
-@@ -650,8 +670,8 @@ TPM_RESULT TPM_GetPubKey(TPM_KEY_HANDLE 
-   pubKey->pubKey.keyLength = key->key.size >> 3;
-   pubKey->pubKey.key = tpm_malloc(pubKey->pubKey.keyLength);
-   if (pubKey->pubKey.key == NULL) return TPM_NOSPACE;
--  rsa_export_modulus(&key->key, pubKey->pubKey.key, 
--    &pubKey->pubKey.keyLength);
-+  rsa_export_modulus(&key->key, pubKey->pubKey.key, &key_length);
-+  pubKey->pubKey.keyLength = (UINT32) key_length;
-   if (tpm_setup_key_parms(key, &pubKey->algorithmParms) != 0) {
-     error("TPM_GetPubKey(): tpm_setup_key_parms() failed.");
-     tpm_free(pubKey->pubKey.key);
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_structures.h tpm_emulator/tpm/tpm_structures.h
---- orig/tpm_emulator-0.4/tpm/tpm_structures.h	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_structures.h	2006-07-24 14:35:35.000000000 -0700
-@@ -1958,6 +1958,7 @@ typedef struct tdTPM_DAA_ISSUER {
-   TPM_DIGEST DAA_digest_gamma;
-   BYTE DAA_generic_q[26];
- } TPM_DAA_ISSUER;
-+#define sizeof_TPM_DAA_ISSUER(s) (2 + (20 * 6) + 26 )
- 
- /*
-  * TPM_DAA_TPM ([TPM_Part2], Section 22.4)
-@@ -1973,6 +1974,7 @@ typedef struct tdTPM_DAA_TPM {
-   TPM_DIGEST DAA_rekey;
-   UINT32 DAA_count;
- } TPM_DAA_TPM;
-+#define sizeof_TPM_DAA_TPM(s) (2 + (4 * 20) + 4)
- 
- /*
-  * TPM_DAA_CONTEXT ([TPM_Part2], Section 22.5)
-@@ -1987,6 +1989,7 @@ typedef struct tdTPM_DAA_CONTEXT {
-   BYTE DAA_scratch[256];
-   BYTE DAA_stage;
- } TPM_DAA_CONTEXT;
-+#define sizeof_TPM_DAA_CONTEXT(s) (2 + (3 * 20) + 256 + 1)
- 
- /*
-  * TPM_DAA_JOINDATA ([TPM_Part2], Section 22.6)
-@@ -1998,6 +2001,7 @@ typedef struct tdTPM_DAA_JOINDATA {
-   BYTE DAA_join_u1[138];
-   TPM_DIGEST DAA_digest_n0;
- } TPM_DAA_JOINDATA;
-+#define sizeof_TPM_DAA_JOINDATA(s) (1 + 1 + 20)
- 
- /*
-  * TPM_DAA_BLOB ([TPM_Part2], Section 22.8)
-@@ -2202,6 +2206,7 @@ typedef struct tdTPM_STCLEAR_DATA {
-   //UINT32 ownerReference;
-   //BOOL disableResetLock;
- } TPM_STCLEAR_DATA;
-+#define sizeof_TPM_STCLEAR_DATA(s) (2 + 20 + 4)
- 
- /*
-  * TPM_SESSION_DATA
-@@ -2238,6 +2243,11 @@ typedef struct tdTPM_DAA_SESSION_DATA {
-   TPM_DAA_JOINDATA DAA_joinSession;
-   TPM_HANDLE handle;
- } TPM_DAA_SESSION_DATA;
-+#define sizeof_TPM_DAA_SESSION_DATA(s) ( 1 \
-+  + sizeof_TPM_DAA_ISSUER(s.DAA_issuerSettings) \
-+  + sizeof_TPM_DAA_TPM(s.DAA_tpmSpecific) \
-+  + sizeof_TPM_DAA_CONTEXT(s.DAA_session) \
-+  + sizeof_TPM_DAA_JOINDATA(s.DAA_joinSession) + 4)
- 
- /*
-  * TPM_STANY_DATA ([TPM_Part2], Section 7.6)
-@@ -2262,6 +2272,11 @@ typedef struct tdTPM_STANY_DATA {
-   TPM_DAAHANDLE currentDAA;
-   TPM_TRANSHANDLE transExclusive;
- } TPM_STANY_DATA;
-+#define sizeof_TPM_STANY_DATA(s) (2 + 20 + 20 + 1 \
-+  + sizeof_TPM_CURRENT_TICKS(s.currentTicks) \
-+  + 4 + (4 * TPM_MAX_SESSION_LIST) \
-+  + (sizeof_TPM_SESSION_DATA(s.sessions[0]) * TPM_MAX_SESSION_LIST) \
-+  + (sizeof_TPM_DAA_SESSION_DATA(s.sessionsDAA[0]) * TPM_MAX_SESSIONS_DAA) + 4)
- 
- /*
-  * TPM_DATA
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_testing.c tpm_emulator/tpm/tpm_testing.c
---- orig/tpm_emulator-0.4/tpm/tpm_testing.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_testing.c	2006-07-24 14:35:35.000000000 -0700
-@@ -1,6 +1,7 @@
- /* Software-Based Trusted Platform Module (TPM) Emulator for Linux
-  * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
-  *                    Swiss Federal Institute of Technology (ETH) Zurich
-+ * Copyright (C) 2005 INTEL Corp
-  *
-  * This module is free software; you can redistribute it and/or modify
-  * it under the terms of the GNU General Public License as published
-@@ -95,24 +96,24 @@ static int tpm_test_sha1(void)
-   struct {
-     uint8_t *data; uint32_t repetitions; uint8_t *digest;
-   } test_cases[] =  {{
--    "abc", 1,
--    "\xA9\x99\x3E\x36\x47\x06\x81\x6A\xBA\x3E\x25\x71\x78\x50\xC2\x6C\x9C\xD0\xD8\x9D"
-+	(uint8_t*)"abc", 1,
-+    (uint8_t*)"\xA9\x99\x3E\x36\x47\x06\x81\x6A\xBA\x3E\x25\x71\x78\x50\xC2\x6C\x9C\xD0\xD8\x9D"
-   }, {
--    "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 1,
--    "\x84\x98\x3E\x44\x1C\x3B\xD2\x6E\xBA\xAE\x4A\xA1\xF9\x51\x29\xE5\xE5\x46\x70\xF1"
-+    (uint8_t*)"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 1,
-+    (uint8_t*)"\x84\x98\x3E\x44\x1C\x3B\xD2\x6E\xBA\xAE\x4A\xA1\xF9\x51\x29\xE5\xE5\x46\x70\xF1"
-   }, {
--    "a", 1000000,
--    "\x34\xAA\x97\x3C\xD4\xC4\xDA\xA4\xF6\x1E\xEB\x2B\xDB\xAD\x27\x31\x65\x34\x01\x6F"
-+    (uint8_t*)"a", 1000000,
-+    (uint8_t*)"\x34\xAA\x97\x3C\xD4\xC4\xDA\xA4\xF6\x1E\xEB\x2B\xDB\xAD\x27\x31\x65\x34\x01\x6F"
-   }, {
--    "0123456701234567012345670123456701234567012345670123456701234567", 10,
--    "\xDE\xA3\x56\xA2\xCD\xDD\x90\xC7\xA7\xEC\xED\xC5\xEB\xB5\x63\x93\x4F\x46\x04\x52"
-+    (uint8_t*)"0123456701234567012345670123456701234567012345670123456701234567", 10,
-+    (uint8_t*)"\xDE\xA3\x56\xA2\xCD\xDD\x90\xC7\xA7\xEC\xED\xC5\xEB\xB5\x63\x93\x4F\x46\x04\x52"
-   }};
- 
-   debug("tpm_test_sha1()");
-   for (i = 0; i < sizeof(test_cases) / sizeof(test_cases[0]); i++) {
-     sha1_init(&ctx);
-     for (j = 0; j < test_cases[i].repetitions; j++)
--      sha1_update(&ctx, test_cases[i].data, strlen(test_cases[i].data));
-+      sha1_update(&ctx, test_cases[i].data, strlen((char*)test_cases[i].data));
-     sha1_final(&ctx, digest);
-     if (memcmp(digest, test_cases[i].digest, SHA1_DIGEST_LENGTH) != 0) return -1;
-   }
-@@ -128,41 +129,41 @@ static int tpm_test_hmac(void)
-   struct {
-     uint8_t *key, key_len, *data, data_len, *digest;
-   } test_cases[] = {{
--    "\x0b", 20, "Hi There", 8,
--    "\xb6\x17\x31\x86\x55\x05\x72\x64\xe2\x8b\xc0\xb6\xfb\x37\x8c\x8e\xf1\x46\xbe\x00"
-+    (uint8_t*)"\x0b", 20, (uint8_t*)"Hi There", 8,
-+    (uint8_t*)"\xb6\x17\x31\x86\x55\x05\x72\x64\xe2\x8b\xc0\xb6\xfb\x37\x8c\x8e\xf1\x46\xbe\x00"
-   }, {
--    "Jefe", 4, "what do ya want for nothing?", 28,
--    "\xef\xfc\xdf\x6a\xe5\xeb\x2f\xa2\xd2\x74\x16\xd5\xf1\x84\xdf\x9c\x25\x9a\x7c\x79"
-+    (uint8_t*)"Jefe", 4, (uint8_t*)"what do ya want for nothing?", 28,
-+    (uint8_t*)"\xef\xfc\xdf\x6a\xe5\xeb\x2f\xa2\xd2\x74\x16\xd5\xf1\x84\xdf\x9c\x25\x9a\x7c\x79"
-   }, {
--    "\xaa", 20, "\xdd", 50,
--    "\x12\x5d\x73\x42\xb9\xac\x11\xcd\x91\xa3\x9a\xf4\x8a\xa1\x7b\x4f\x63\xf1\x75\xd3"
-+    (uint8_t*)"\xaa", 20, (uint8_t*)"\xdd", 50,
-+    (uint8_t*)"\x12\x5d\x73\x42\xb9\xac\x11\xcd\x91\xa3\x9a\xf4\x8a\xa1\x7b\x4f\x63\xf1\x75\xd3"
-   }, {
--    "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14"
--    "\x15\x16\x17\x18\x19", 25, "\xcd", 50,
--    "\x4c\x90\x07\xf4\x02\x62\x50\xc6\xbc\x84\x14\xf9\xbf\x50\xc8\x6c\x2d\x72\x35\xda"
-+    (uint8_t*)"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14"
-+    "\x15\x16\x17\x18\x19", 25, (uint8_t*)"\xcd", 50,
-+    (uint8_t*)"\x4c\x90\x07\xf4\x02\x62\x50\xc6\xbc\x84\x14\xf9\xbf\x50\xc8\x6c\x2d\x72\x35\xda"
-   }, {
--    "\x0c", 20, "Test With Truncation", 20,
--    "\x4c\x1a\x03\x42\x4b\x55\xe0\x7f\xe7\xf2\x7b\xe1\xd5\x8b\xb9\x32\x4a\x9a\x5a\x04"
-+    (uint8_t*)"\x0c", 20, (uint8_t*)"Test With Truncation", 20,
-+    (uint8_t*)"\x4c\x1a\x03\x42\x4b\x55\xe0\x7f\xe7\xf2\x7b\xe1\xd5\x8b\xb9\x32\x4a\x9a\x5a\x04"
-   }, {
--    "\xaa", 80, "Test Using Larger Than Block-Size Key - Hash Key First", 54,
--    "\xaa\x4a\xe5\xe1\x52\x72\xd0\x0e\x95\x70\x56\x37\xce\x8a\x3b\x55\xed\x40\x21\x12"
-+    (uint8_t*)"\xaa", 80, (uint8_t*)"Test Using Larger Than Block-Size Key - Hash Key First", 54,
-+    (uint8_t*)"\xaa\x4a\xe5\xe1\x52\x72\xd0\x0e\x95\x70\x56\x37\xce\x8a\x3b\x55\xed\x40\x21\x12"
-   }, {
--    "\xaa", 80,
--    "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data", 73,
--    "\xe8\xe9\x9d\x0f\x45\x23\x7d\x78\x6d\x6b\xba\xa7\x96\x5c\x78\x08\xbb\xff\x1a\x91"
-+    (uint8_t*)"\xaa", 80,
-+    (uint8_t*)"Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data", 73,
-+    (uint8_t*)"\xe8\xe9\x9d\x0f\x45\x23\x7d\x78\x6d\x6b\xba\xa7\x96\x5c\x78\x08\xbb\xff\x1a\x91"
-   }};
- 
-   debug("tpm_test_hmac()");
-   for (i = 0; i < sizeof(test_cases) / sizeof(test_cases[0]); i++) {
--    if (strlen(test_cases[i].key) < test_cases[i].key_len) {
-+    if (strlen((char*)test_cases[i].key) < test_cases[i].key_len) {
-       uint8_t key[test_cases[i].key_len];
-       memset(key, test_cases[i].key[0], test_cases[i].key_len);
-       hmac_init(&ctx, key, test_cases[i].key_len);
-     } else {
-       hmac_init(&ctx, test_cases[i].key, test_cases[i].key_len);
-     }
--    for (j = 0; j < test_cases[i].data_len; j += strlen(test_cases[i].data)) {
--      hmac_update(&ctx, test_cases[i].data, strlen(test_cases[i].data));
-+    for (j = 0; j < test_cases[i].data_len; j += strlen((char*)test_cases[i].data)) {
-+      hmac_update(&ctx, test_cases[i].data, strlen((char*)test_cases[i].data));
-     }
-     hmac_final(&ctx, digest);
-     if (memcmp(digest, test_cases[i].digest, SHA1_DIGEST_LENGTH) != 0) return -1;
-@@ -173,9 +174,9 @@ static int tpm_test_hmac(void)
- static int tpm_test_rsa_EK(void)
- {
-   int res = 0;
--  char *data = "RSA PKCS #1 v1.5 Test-String";
-+  uint8_t *data = (uint8_t*)"RSA PKCS #1 v1.5 Test-String";
-   uint8_t buf[256];
--  size_t buf_len, data_len = strlen(data);
-+  size_t buf_len, data_len = strlen((char*)data);
-   rsa_private_key_t priv_key;
-   rsa_public_key_t pub_key;
- 
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_ticks.c tpm_emulator/tpm/tpm_ticks.c
---- orig/tpm_emulator-0.4/tpm/tpm_ticks.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_ticks.c	2006-07-24 14:35:35.000000000 -0700
-@@ -1,6 +1,7 @@
- /* Software-Based Trusted Platform Module (TPM) Emulator for Linux
-  * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
-  *                    Swiss Federal Institute of Technology (ETH) Zurich
-+ * Copyright (C) 2005 INTEL Corp
-  *
-  * This module is free software; you can redistribute it and/or modify
-  * it under the terms of the GNU General Public License as published
-@@ -39,9 +40,7 @@ TPM_RESULT TPM_SetTickType(TPM_TICKTYPE 
- TPM_RESULT TPM_GetTicks(TPM_CURRENT_TICKS *currentTime)
- {
-   info("TPM_GetTicks()");
--  memcpy(currentTime, &tpmData.stany.data.currentTicks, 
--    sizeof(TPM_CURRENT_TICKS));
--  return TPM_SUCCESS;
-+  return TPM_DISABLED_CMD;
- }
- 
- TPM_RESULT TPM_TickStampBlob(TPM_KEY_HANDLE keyHandle, TPM_NONCE *antiReplay,
-@@ -49,64 +48,11 @@ TPM_RESULT TPM_TickStampBlob(TPM_KEY_HAN
-                              TPM_CURRENT_TICKS *currentTicks, 
-                              UINT32 *sigSize, BYTE **sig)
- {
--  TPM_RESULT res;
--  TPM_KEY_DATA *key;
--  BYTE *info, *p;
--  UINT32 info_length, length;
-   info("TPM_TickStampBlob()");
--  /* get key */
--  key = tpm_get_key(keyHandle);
--  if (key == NULL) return TPM_INVALID_KEYHANDLE;
--  /* verify authorization */ 
--  res = tpm_verify_auth(auth1, key->usageAuth, keyHandle);
--  if (res != TPM_SUCCESS) return res;
--  if (key->keyUsage != TPM_KEY_SIGNING && key->keyUsage != TPM_KEY_LEGACY
--      && key->keyUsage != TPM_KEY_IDENTITY) return TPM_INVALID_KEYUSAGE;
--  /* get current ticks */
--  TPM_GetTicks(currentTicks);
--  /* sign data using signature scheme PKCS1_SHA1 and TPM_SIGN_INFO container */
--  *sigSize = key->key.size >> 3;
--  *sig = tpm_malloc(*sigSize);
--  if (*sig == NULL) return TPM_FAIL; 
--  /* setup TPM_SIGN_INFO structure */
--  info_length = 30 + sizeof(TPM_DIGEST) + sizeof_TPM_CURRENT_TICKS(currentTicks);
--  info = tpm_malloc(info_length);
--  if (info == NULL) {
--    tpm_free(*sig);
--    return TPM_FAIL;
--  }
--  memcpy(&info[0], "\x05\x00TSTP", 6);
--  memcpy(&info[6], antiReplay->nonce, 20);
--  *(UINT32*)&info[26] = CPU_TO_BE32(20
--                        + sizeof_TPM_CURRENT_TICKS(currentTicks));
--  memcpy(&info[30], digestToStamp->digest, sizeof(TPM_DIGEST));
--  p = &info[30 + sizeof(TPM_DIGEST)]; 
--  length = sizeof_TPM_CURRENT_TICKS(currentTicks);
--  if (tpm_marshal_TPM_CURRENT_TICKS(&p, &length, currentTicks)
--      || rsa_sign(&key->key, RSA_SSA_PKCS1_SHA1, info, info_length, *sig)) {   
--    tpm_free(*sig);
--    tpm_free(info);
--    return TPM_FAIL;
--  } 
--  return TPM_SUCCESS;
-+  return TPM_DISABLED_CMD;
- }
- 
- void tpm_update_ticks(void)
- {
--  if (tpmData.stany.data.currentTicks.tag == 0) {
--    tpmData.stany.data.currentTicks.tag = TPM_TAG_CURRENT_TICKS;
--    tpmData.stany.data.currentTicks.currentTicks += tpm_get_ticks();
--/* removed since v1.2 rev 94
--    tpmData.stany.data.currentTicks.tickType = tpmData.permanent.data.tickType;
--*/
--    tpm_get_random_bytes(tpmData.stany.data.currentTicks.tickNonce.nonce, 
--      sizeof(TPM_NONCE));
--    tpmData.stany.data.currentTicks.tickRate = 1;
--/* removed since v1.2 rev 94
--    tpmData.stany.data.currentTicks.tickSecurity = TICK_SEC_NO_CHECK;
--*/
--  } else {
--    tpmData.stany.data.currentTicks.currentTicks += tpm_get_ticks();   
--  }
- }
- 
-diff -uprN orig/tpm_emulator-0.4/tpm/tpm_transport.c tpm_emulator/tpm/tpm_transport.c
---- orig/tpm_emulator-0.4/tpm/tpm_transport.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_transport.c	2006-07-24 14:35:35.000000000 -0700
-@@ -189,7 +189,7 @@ static void decrypt_wrapped_command(BYTE
-     sha1_init(&sha1);
-     sha1_update(&sha1, auth->nonceEven.nonce, sizeof(auth->nonceEven.nonce));
-     sha1_update(&sha1, auth->nonceOdd.nonce, sizeof(auth->nonceOdd.nonce));
--    sha1_update(&sha1, "in", 2);
-+    sha1_update(&sha1, (BYTE*)"in", 2);
-     sha1_update(&sha1, secret, sizeof(TPM_SECRET));
-     j = CPU_TO_BE32(i);
-     sha1_update(&sha1, (BYTE*)&j, 4);
-@@ -211,7 +211,7 @@ static void encrypt_wrapped_command(BYTE
-     sha1_init(&sha1);
-     sha1_update(&sha1, auth->nonceEven.nonce, sizeof(auth->nonceEven.nonce));
-     sha1_update(&sha1, auth->nonceOdd.nonce, sizeof(auth->nonceOdd.nonce));
--    sha1_update(&sha1, "out", 3);
-+    sha1_update(&sha1, (BYTE*)"out", 3);
-     sha1_update(&sha1, secret, sizeof(TPM_SECRET));
-     j = CPU_TO_BE32(i);
-     sha1_update(&sha1, (BYTE*)&j, 4);
-diff -uprN orig/tpm_emulator-0.4/tpmd.c tpm_emulator/tpmd.c
---- orig/tpm_emulator-0.4/tpmd.c	1969-12-31 16:00:00.000000000 -0800
-+++ tpm_emulator/tpmd.c	2006-07-24 14:35:35.000000000 -0700
-@@ -0,0 +1,156 @@
-+/* Software-Based Trusted Platform Module (TPM) Emulator for Linux
-+ * Copyright (C) 2005 INTEL Corp
-+ *
-+ * This module 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 module 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 <stdio.h>
-+#include <stdlib.h>
-+#include <unistd.h>
-+#include <string.h>
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include <fcntl.h>
-+#include <sys/time.h>
-+
-+#include "tpm_emulator.h"
-+
-+#define TPM_RX_FNAME "/var/tpm/tpm_in.fifo"
-+#define TPM_TX_FNAME "/var/tpm/tpm_out.fifo"
-+
-+#define BUFFER_SIZE 2048
-+
-+static int devurandom=0;
-+	  
-+void get_random_bytes(void *buf, int nbytes) {
-+  
-+  if (devurandom == 0) {
-+    devurandom = open("/dev/urandom", O_RDONLY);
-+  }
-+
-+  if (read(devurandom, buf, nbytes) != nbytes) {
-+      printf("Can't get random number.\n");
-+      exit(-1);
-+  }
-+}
-+
-+uint64_t tpm_get_ticks(void)
-+{
-+  //struct timeval tv;
-+  //int gettimeofday(&tv, struct timezone *tz);
-+  return 0;
-+}
-+
-+int main(int argc, char **argv)
-+{
-+  uint8_t in[BUFFER_SIZE], *out;
-+  uint32_t out_size;
-+  int in_size, written;
-+  int i;
-+  struct stat file_info;
-+
-+  int tpm_tx_fh=-1, tpm_rx_fh=-1;
-+  if (argc < 2) {
-+    printf("Usage: tpmd clear|save|deactivated\n" );
-+	  return -1;
-+  }
-+
-+  /* initialize TPM emulator */
-+  if (!strcmp(argv[1], "clear")) {
-+    printf("Initializing tpm: %s\n", argv[1]);
-+    tpm_emulator_init(1);
-+  } else if (!strcmp(argv[1], "save")) { 
-+    printf("Initializing tpm: %s\n", argv[1]);
-+    tpm_emulator_init(2);
-+  } else if (!strcmp(argv[1], "deactivated")) {
-+    printf("Initializing tpm: %s\n", argv[1]);
-+    tpm_emulator_init(3);
-+  } else {
-+    printf("invalid startup mode '%s'; must be 'clear', "
-+      "'save' (default) or 'deactivated", argv[1]);
-+    return -1;
-+  }
-+
-+  if ( stat(TPM_RX_FNAME, &file_info) == -1) {
-+    if ( mkfifo(TPM_RX_FNAME, S_IWUSR | S_IRUSR ) ) {
-+      printf("Failed to create fifo %s.\n", TPM_RX_FNAME);
-+      return -1;
-+    }
-+  }
-+
-+  if ( stat(TPM_TX_FNAME, &file_info) == -1) {
-+    if ( mkfifo(TPM_TX_FNAME, S_IWUSR | S_IRUSR ) ) {
-+      printf("Failed to create fifo %s.\n", TPM_TX_FNAME);
-+      return -1;
-+    }
-+  }
-+
-+  while (1) {
-+abort_command:
-+    if (tpm_rx_fh < 0) {
-+      tpm_rx_fh = open(TPM_RX_FNAME, O_RDONLY);
-+    }
-+    
-+    if (tpm_rx_fh < 0) {
-+      printf("ERROR: failed to open devices to listen to guest.\n");
-+      return -1;
-+    }
-+    
-+    if (tpm_tx_fh < 0) {
-+      tpm_tx_fh = open(TPM_TX_FNAME, O_WRONLY);
-+    }
-+
-+    if (tpm_tx_fh < 0) {
-+      printf("ERROR: failed to open devices to respond to guest.\n");
-+      return -1;
-+    }
-+
-+    in_size = read(tpm_rx_fh, in, BUFFER_SIZE);
-+    if (in_size < 6) { // Magic size of minium TPM command
-+      printf("Recv[%d] to small: 0x", in_size);
-+      if (in_size <= 0) {
-+          close(tpm_rx_fh);
-+          tpm_rx_fh = -1;
-+          goto abort_command;
-+      }
-+    } else { 
-+      printf("Recv[%d]: 0x", in_size);
-+      for (i=0; i< in_size; i++) 
-+        printf("%x ", in[i]);
-+      printf("\n");
-+    }
-+
-+    
-+    if (tpm_handle_command(in, in_size, &out, &out_size) != 0) { 
-+        printf("ERROR: Handler Failed.\n");
-+    }
-+
-+    written = write(tpm_tx_fh, out, out_size);
-+
-+    if (written != out_size ) {
-+      printf("ERROR: Part of response not written %d/%d.\nAttempt: ", written, out_size);
-+    } else {
-+      printf("Sent[%Zu]: ", out_size);
-+    }
-+    for (i=0; i< out_size; i++)
-+      printf("%x ", out[i]);
-+    printf("\n");
-+    tpm_free(out);
-+
-+  } // loop
-+
-+  tpm_emulator_shutdown();
-+
-+  close(tpm_tx_fh);
-+  close(tpm_rx_fh);
-+
-+}
-Binary files orig/tpm_emulator-0.4/tpm_emulator and tpm_emulator/tpm_emulator differ
-diff -uprN orig/tpm_emulator-0.4/tpm_version.h tpm_emulator/tpm_version.h
---- orig/tpm_emulator-0.4/tpm_version.h	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm_version.h	2006-07-24 14:35:41.000000000 -0700
-@@ -2,5 +2,5 @@
- #define _TPM_VERSION_H_
- #define VERSION_MAJOR 0
- #define VERSION_MINOR 4
--#define VERSION_BUILD 1151058734
-+#define VERSION_BUILD 1153776940
- #endif /* _TPM_VERSION_H_ */
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm/vtpm-0.5.1-LDLIBS.patch
--- a/tools/vtpm/vtpm-0.5.1-LDLIBS.patch	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-diff -Naurp tpm_emulator-0.5.1/tpmd/Makefile tpm_emulator-0.5.1/tpmd/Makefile
---- tpm_emulator-0.5.1/tpmd/Makefile
-+++ tpm_emulator-0.5.1/tpmd/Makefile
-@@ -8,7 +8,7 @@ WFLAGS  := -Wall -Wno-unused -Wpointer-a
-            #WFLAGS  += -Wextra -Wcast-qual -Wmissing-prototypes -Wmissing-declarations -Wstrict-aliasing
- CFLAGS  += $(WFLAGS) -g -I.. -I. -O2 -fno-strict-aliasing
- CFLAGS  += -I../../../../tools/vtpm_manager/manager
--LDFLAGS += -lgmp
-+LDLIBS  += -lgmp
- 
- BINDIR  := /usr/bin/
- 
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm/vtpm-0.5.1.patch
--- a/tools/vtpm/vtpm-0.5.1.patch	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,766 +0,0 @@
-diff -Naurp tpm_emulator-0.5.1/Makefile tpm5-test/Makefile
---- tpm_emulator-0.5.1/Makefile	2008-02-14 03:22:48.000000000 -0500
-+++ tpm5-test/Makefile	2009-07-15 09:45:28.000000000 -0400
-@@ -10,7 +10,7 @@ VERSION_MINOR  := 5
- VERSION_BUILD  := $(shell date +"%s")
- VERSION_SUFFIX := .1
- 
--SUBDIRS := tpmd tpmd_dev tddl
-+SUBDIRS := tpmd 
- 
- all: version all-recursive
- 
-@@ -48,12 +48,12 @@ user_install: user
- modules_install: modules
- 	@$(MAKE) -C tpmd_dev install || exit -1
- 
--DIRS    := . tpm crypto tpmd tpmd_dev tddl tpmd_dev_openbsd
-+DIRS    := . tpm crypto tpmd 
- DISTSRC := $(foreach dir, $(DIRS), $(wildcard $(dir)/*.c))
- DISTSRC += $(foreach dir, $(DIRS), $(wildcard $(dir)/*.h))
--DIRS    := . tpmd tpmd_dev tddl tpmd_dev_openbsd
-+DIRS    := . tpmd 
- DISTSRC += $(foreach dir, $(DIRS), $(dir)/Makefile)
--DISTSRC += ./README ./AUTHORS ./ChangeLog tpmd_dev/tpmd_dev.rules.in
-+DISTSRC += ./README ./AUTHORS ./ChangeLog 
- DISTDIR := tpm_emulator-$(VERSION_MAJOR).$(VERSION_MINOR)$(VERSION_SUFFIX)
- 
- dist: $(DISTSRC)
-diff -Naurp tpm_emulator-0.5.1/tpm/tpm_capability.c tpm5-test/tpm/tpm_capability.c
---- tpm_emulator-0.5.1/tpm/tpm_capability.c	2008-02-14 03:22:48.000000000 -0500
-+++ tpm5-test/tpm/tpm_capability.c	2009-07-16 12:04:20.000000000 -0400
-@@ -136,8 +136,19 @@ static TPM_RESULT cap_property(UINT32 su
- 
-     case TPM_CAP_PROP_TIS_TIMEOUT:
-       debug("[TPM_CAP_PROP_TIS_TIMEOUT]");
--      /* TODO: TPM_CAP_PROP_TIS_TIMEOUT */
--      return TPM_FAIL;
-+      /* TODO: TPM_CAP_PROP_TIS_TIMEOUT: Measure these values and determine correct ones */
-+      UINT32 len = *respSize = 16;
-+      BYTE *ptr = *resp = tpm_malloc(*respSize);
-+      if (ptr == NULL || 
-+          tpm_marshal_UINT32(&ptr, &len, 200000) ||
-+          tpm_marshal_UINT32(&ptr, &len, 200000) ||
-+          tpm_marshal_UINT32(&ptr, &len, 200000) ||
-+          tpm_marshal_UINT32(&ptr, &len, 200000)) {
-+        tpm_free(*resp);
-+        return TPM_FAIL;
-+      }
-+      return TPM_SUCCESS;
-+
- 
-     case TPM_CAP_PROP_STARTUP_EFFECT:
-       debug("[TPM_CAP_PROP_STARTUP_EFFECT]");
-@@ -189,8 +200,12 @@ static TPM_RESULT cap_property(UINT32 su
- 
-     case TPM_CAP_PROP_DURATION:
-       debug("[TPM_CAP_PROP_DURATION]");
--      /* TODO: TPM_CAP_PROP_DURATION */
--      return TPM_FAIL;
-+      /* TODO: TPM_CAP_PROP_DURATION: Measure these values and return accurate ones */
-+      BYTE dur[]= {0x0,0x0,0x0,0xc,0x0,0x7,0xa1,0x20,0x0,0x1e,0x84,0x80,0x11,0xe1,0xa3,0x0}; 
-+      *respSize = 16;
-+      *resp = tpm_malloc(*respSize);
-+      memcpy(*resp,dur,16); 
-+
- 
-     case TPM_CAP_PROP_ACTIVE_COUNTER:
-       debug("[TPM_CAP_PROP_ACTIVE_COUNTER]");
-diff -Naurp tpm_emulator-0.5.1/tpmd/Makefile tpm5-test/tpmd/Makefile
---- tpm_emulator-0.5.1/tpmd/Makefile	2008-02-14 03:22:48.000000000 -0500
-+++ tpm5-test/tpmd/Makefile	2009-07-16 12:08:26.000000000 -0400
-@@ -8,9 +8,10 @@ WFLAGS  := -Wall -Wno-unused -Wpointer-a
-            -Wwrite-strings -Wsign-compare -Wno-multichar
-            #WFLAGS  += -Wextra -Wcast-qual -Wmissing-prototypes -Wmissing-declarations -Wstrict-aliasing
- CFLAGS  += $(WFLAGS) -g -I.. -I. -O2 -fno-strict-aliasing
-+CFLAGS  += -I../../../../tools/vtpm_manager/manager
- LDFLAGS += -lgmp
- 
--BINDIR  := /usr/sbin/
-+BINDIR  := /usr/bin/
- 
- TPMD    := tpmd
- DIRS    := ../tpm ../crypto
-@@ -18,6 +19,8 @@ SRCS    := $(foreach dir, $(DIRS), $(wil
- OBJS    := $(patsubst %.c, %.o, $(SRCS))
- OBJS    := $(foreach dir, $(DIRS), $(patsubst $(dir)/%.o, %.o, $(filter $(dir)/%.o, $(OBJS))))
- 
-+VTPM_BIN := vtpmd
-+
- vpath %.c $(strip $(DIRS))
- 
- all: $(TPMD)
-@@ -32,10 +35,8 @@ TPMD_GROUP ?= tss
- INSTALL    ?= install
- 
- install: $(TPMD)
--	$(INSTALL) -m 755 -o $(TPMD_USER) -g $(TPMD_GROUP) -d $(DESTDIR)/var/lib/tpm
--	$(INSTALL) -m 755 -o $(TPMD_USER) -g $(TPMD_GROUP) -d $(DESTDIR)/var/run/tpm
- 	$(INSTALL) -D -d $(DESTDIR)/$(BINDIR)
--	$(INSTALL) -m 755 $(TPMD) $(DESTDIR)/$(BINDIR)
-+	$(INSTALL) -m 755 $(TPMD) $(DESTDIR)/$(BINDIR)/$(VTPM_BIN)
- 
- .PHONY: all clean install
- 
-diff -Naurp tpm_emulator-0.5.1/tpmd/tpmd.c tpm5-test/tpmd/tpmd.c
---- tpm_emulator-0.5.1/tpmd/tpmd.c	2008-02-14 03:22:48.000000000 -0500
-+++ tpm5-test/tpmd/tpmd.c	2009-07-16 11:19:05.000000000 -0400
-@@ -32,6 +32,9 @@
- #include <grp.h>
- #include "tpm_emulator_config.h"
- #include "tpm/tpm_emulator.h"
-+#include "tpm/tpm_structures.h"
-+#include "tpm/tpm_marshalling.h"
-+#include "vtpm_manager.h"
- 
- #define TPM_DAEMON_NAME     "tpmd"
- #define TPM_CMD_BUF_SIZE    4096
-@@ -39,6 +42,24 @@
- #define TPM_RANDOM_DEVICE   "/dev/urandom"
- #undef  TPM_MKDIRS
- 
-+#ifdef VTPM_MULTI_VM
-+ #define DEV_BE "/dev/vtpm"
-+ #define DEV_FE "/dev/tpm"
-+#else
-+ #define PVM_RX_FIFO_D "/var/vtpm/fifos/tpm_cmd_to_%d.fifo"
-+ #define PVM_TX_FIFO "/var/vtpm/fifos/tpm_rsp_from_all.fifo"
-+ #define HVM_RX_FIFO_D "/var/vtpm/socks/%d.socket"
-+
-+ #define VTPM_RX_FIFO_D "/var/vtpm/fifos/vtpm_rsp_to_%d.fifo"
-+ #define VTPM_TX_FIFO "/var/vtpm/fifos/vtpm_cmd_from_all.fifo"
-+
-+ static char *vtpm_rx_name=NULL;
-+#endif
-+
-+ static int vtpm_tx_fh=-1, vtpm_rx_fh=-1;
-+
-+#define BUFFER_SIZE 2048
-+
- static volatile int stopflag = 0;
- static int is_daemon = 0;
- static int opt_debug = 0;
-@@ -49,6 +70,8 @@ static const char *opt_storage_file = "/
- static uid_t opt_uid = 0;
- static gid_t opt_gid = 0;
- static int tpm_startup = 2;
-+static int vtpm_type = VTPM_TYPE_PVM;
-+int dmi_id = 0;
- static int rand_fh;
- 
- void tpm_log(int priority, const char *fmt, ...)
-@@ -90,56 +113,241 @@ uint64_t tpm_get_ticks(void)
- 
- int tpm_write_to_file(uint8_t *data, size_t data_length)
- {
--    int fh;
--    ssize_t res;
--    fh = open(opt_storage_file, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR);
--    if (fh < 0) return -1;
--    while (data_length > 0) {
--        res = write(fh, data, data_length);
--	if (res < 0) {
--	    close(fh);
--	    return -1;
--	}
--	data_length -= res; 
--	data += res;
-+  int res, out_data_size, in_header_size;
-+  BYTE *ptr, *out_data, *in_header;
-+  UINT32 result, len, in_rsp_size;
-+  UINT16 tag = VTPM_TAG_REQ;
-+	
-+  printf("Saving NVM\n");
-+  if (vtpm_tx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+    vtpm_tx_fh = open(DEV_FE, O_RDWR);
-+#else
-+	vtpm_tx_fh = open(VTPM_TX_FIFO, O_WRONLY);
-+#endif
-+  }
-+
-+  if (vtpm_tx_fh < 0) {
-+		return -1;
-+  }
-+ 
-+  // Send request to VTPM Manager to encrypt data
-+#ifdef VTPM_MUTLI_VM
-+  out_data_size = len = VTPM_COMMAND_HEADER_SIZE_CLT + data_length;
-+#else
-+  out_data_size = len = VTPM_COMMAND_HEADER_SIZE_SRV + data_length;
-+#endif
-+  
-+  out_data = ptr = (BYTE *) malloc(len);
-+
-+  if (ptr == NULL
-+#ifndef VTPM_MUTLI_VM
-+      || tpm_marshal_UINT32(&ptr, &len, dmi_id)
-+#endif
-+	  || tpm_marshal_UINT16(&ptr, &len, tag)
-+#ifdef VTPM_MUTLI_VM
-+	  || tpm_marshal_UINT32(&ptr, &len, out_data_size)
-+#else
-+	  || tpm_marshal_UINT32(&ptr, &len, out_data_size - sizeof(uint32_t))
-+#endif  
-+	  || tpm_marshal_UINT32(&ptr, &len, VTPM_ORD_SAVENVM)
-+	  || tpm_marshal_BYTE_ARRAY(&ptr, &len, data, data_length)) {
-+	free(out_data);
-+	return -1;
-+  }
-+  
-+  printf("\tSending SaveNVM Command.\n");
-+  res = write(vtpm_tx_fh, out_data, out_data_size);
-+  free(out_data);
-+  if (res != out_data_size) return -1;
-+
-+  if (vtpm_rx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+    vtpm_rx_fh = vtpm_tx_fh
-+#else
-+    if (vtpm_rx_name == NULL) {
-+      vtpm_rx_name = malloc(10 + strlen(VTPM_RX_FIFO_D));
-+      sprintf(vtpm_rx_name, VTPM_RX_FIFO_D, (uint32_t) dmi_id);
-     }
--    close(fh);
--    return 0;
-+	vtpm_rx_fh = open(vtpm_rx_name, O_RDONLY);
-+#endif
-+  }
-+
-+  if (vtpm_rx_fh < 0) {
-+		return -1;
-+  }
-+  
-+  // Read Header of response so we can get the size & status
-+#ifdef VTPM_MUTLI_VM
-+  in_header_size = len = VTPM_COMMAND_HEADER_SIZE_CLT;
-+#else
-+  in_header_size = len = VTPM_COMMAND_HEADER_SIZE_SRV;
-+#endif
-+  in_header = ptr = malloc(in_header_size);
-+  
-+  printf("\tReading SaveNVM header.\n");
-+  res = read(vtpm_rx_fh, in_header, in_header_size);
-+
-+  if ( (res != in_header_size)
-+#ifndef VTPM_MUTLI_VM
-+       || tpm_unmarshal_UINT32(&ptr, &len, (UINT32*)&dmi_id)
-+#endif
-+	   || tpm_unmarshal_UINT16(&ptr, &len, &tag)
-+	   || tpm_unmarshal_UINT32(&ptr, &len, &in_rsp_size)
-+	   || tpm_unmarshal_UINT32(&ptr, &len, &result) ) {
-+	  free(in_header);
-+	  return -1;
-+  }
-+  free(in_header);
-+  
-+  if (result != VTPM_SUCCESS) {
-+      return -1;  
-+  }
-+
-+#ifdef VTPM_MUTLI_VM
-+  close(vtpm_tx_fh); close(vtpm_rx_fh);
-+#endif
-+	  
-+  printf("\tFinishing up SaveNVM\n");
-+  return (0);
- }
- 
- int tpm_read_from_file(uint8_t **data, size_t *data_length)
- {
--    int fh;
--    ssize_t res;
--    size_t total_length;
--    fh = open(opt_storage_file, O_RDONLY);
--    if (fh < 0) return -1;
--    total_length = lseek(fh, 0, SEEK_END);
--    lseek(fh, 0, SEEK_SET);
--    *data = tpm_malloc(total_length);
--    if (*data == NULL) {
--        close(fh);
--        return -1;
--    }
--    *data_length = 0;
--    while (total_length > 0) {
--        res = read(fh, &(*data)[*data_length], total_length);
--	if (res < 0) {
--	    close(fh);
--	    tpm_free(*data);
--	    return -1;
--	}
--        *data_length += res;
--	total_length -= res;
-+  int res, out_data_size, in_header_size;
-+  uint8_t *ptr, *out_data, *in_header;
-+  UINT16 tag = VTPM_TAG_REQ;
-+  UINT32 len, in_rsp_size, result;
-+#ifdef VTPM_MUTLI_VM
-+	int vtpm_rx_fh, vtpm_tx_fh;
-+#endif
-+	
-+  printf("Loading NVM.\n");
-+  if (vtpm_tx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+    vtpm_tx_fh = open(DEV_FE, O_RDWR);
-+#else
-+	vtpm_tx_fh = open(VTPM_TX_FIFO, O_WRONLY);
-+#endif
-+  }
-+
-+  if (vtpm_tx_fh < 0) {
-+	printf("Error in read_from_file:301\n");
-+		return -1;
-+  }
-+ 
-+  // Send request to VTPM Manager to encrypt data
-+#ifdef VTPM_MUTLI_VM
-+  out_data_size = len = VTPM_COMMAND_HEADER_SIZE_CLT;
-+#else
-+  out_data_size = len = VTPM_COMMAND_HEADER_SIZE_SRV;
-+#endif
-+  out_data = ptr = (BYTE *) malloc(len);
-+
-+  if (ptr == NULL
-+#ifndef VTPM_MUTLI_VM
-+      || tpm_marshal_UINT32(&ptr, &len, dmi_id)
-+#endif  
-+      || tpm_marshal_UINT16(&ptr, &len, tag)
-+#ifdef VTPM_MUTLI_VM
-+      || tpm_marshal_UINT32(&ptr, &len, out_data_size)
-+#else
-+      || tpm_marshal_UINT32(&ptr, &len, out_data_size - sizeof(uint32_t))
-+#endif
-+      || tpm_marshal_UINT32(&ptr, &len, VTPM_ORD_LOADNVM)) {
-+    free(out_data);
-+    printf("Error in read_from_file:325\n");
-+
-+    return -1;
-+  }
-+
-+  printf("\tSending LoadNVM command\n");
-+  res = write(vtpm_tx_fh, out_data, out_data_size);
-+  free(out_data);
-+  if (res != out_data_size) 
-+    {
-+	printf("Error in read_from_file:335\n");
-+	return -1;
-+    }
-+
-+    if (vtpm_rx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+    vtpm_rx_fh = vtpm_tx_fh;
-+#else
-+    if (vtpm_rx_name == NULL) {
-+      vtpm_rx_name = malloc(10 + strlen(VTPM_RX_FIFO_D));
-+      sprintf(vtpm_rx_name, VTPM_RX_FIFO_D, (uint32_t) dmi_id);
-     }
--    close(fh);
--    return 0;
-+	vtpm_rx_fh = open(vtpm_rx_name, O_RDONLY);
-+#endif
-+  }
-+
-+  if (vtpm_rx_fh < 0) {
-+	printf("Error in read_from_file:352\n");	
-+	return -1;
-+  }
-+  
-+  // Read Header of response so we can get the size & status
-+#ifdef VTPM_MUTLI_VM
-+  in_header_size = len = VTPM_COMMAND_HEADER_SIZE_CLT;
-+#else
-+  in_header_size = len = VTPM_COMMAND_HEADER_SIZE_SRV;
-+#endif
-+  in_header = ptr = malloc(in_header_size);
-+  
-+  printf("\tReading LoadNVM header\n");
-+  res = read(vtpm_rx_fh, in_header, in_header_size);
-+
-+  if ( (res != in_header_size)
-+#ifndef VTPM_MUTLI_VM
-+       || tpm_unmarshal_UINT32(&ptr, &len, (UINT32*)&dmi_id)
-+#endif
-+       || tpm_unmarshal_UINT16(&ptr, &len, &tag)
-+       || tpm_unmarshal_UINT32(&ptr, &len, &in_rsp_size)
-+       || tpm_unmarshal_UINT32(&ptr, &len, &result) ) {
-+      free(in_header);
-+      printf("Error in read_from_file:375\n");     
-+      return -1;
-+  }
-+  free(in_header);
-+  
-+  if (result != VTPM_SUCCESS) {
-+    printf("Error in read_from_file:381\n");
-+    return -1;  
-+  }
-+
-+  // Read Encrypted data from VTPM Manager
-+  *data_length = in_rsp_size - VTPM_COMMAND_HEADER_SIZE_CLT;
-+  *data = (uint8_t *) malloc(*data_length);
-+
-+  printf("\tReading clear data from LoadNVM.\n");
-+  res = read(vtpm_rx_fh, *data, *data_length);
-+#ifdef VTPM_MUTLI_VM
-+  close(vtpm_rx_fh);close(vtpm_tx_fh);
-+#endif 
-+	
-+  printf("\tReturing from loading NVM\n");
-+  if (res != (int)*data_length) {
-+      free(*data);
-+      printf("Error in read_from_file:398\n");
-+      return -1;
-+  } else {
-+      return 0;
-+  }
-+
-+
-+    
- }
- 
- static void print_usage(char *name)
- {
-     printf("usage: %s [-d] [-f] [-s storage file] [-u unix socket name] "
--           "[-o user name] [-g group name] [-h] [startup mode]\n", name);
-+           "[-o user name] [-g group name] [-h]"
-+#ifdef VTPM_MULTI_VM
-+	   "clear|save|deactivated\n", name);
-+#else
-+	   "clear|save|deactivated pvm|hvm vtpmid\n", name);
-+#endif
-     printf("  d : enable debug mode\n");
-     printf("  f : forces the application to run in the foreground\n");
-     printf("  s : storage file to use (default: %s)\n", opt_storage_file);
-@@ -205,7 +413,13 @@ static void parse_options(int argc, char
-                 exit(EXIT_SUCCESS);
-         }
-     }
--    if (optind < argc) {
-+    /*Make sure we have all required options*/
-+#ifdef VTPM_MULTI_VM
-+#define EXTRA_OPTS 0
-+#else
-+#define EXTRA_OPTS 2
-+#endif
-+    if (optind < argc - EXTRA_OPTS ) {
-         debug("startup mode = '%s'", argv[optind]);
-         if (!strcmp(argv[optind], "clear")) {
-             tpm_startup = 1;
-@@ -219,6 +433,25 @@ static void parse_options(int argc, char
-             print_usage(argv[0]);
-             exit(EXIT_SUCCESS);
-         }
-+#ifndef VTPM_MULTI_VM
-+        ++optind;
-+	if(!strcmp(argv[optind], "pvm")) {
-+		vtpm_type = VTPM_TYPE_PVM;	// Get commands from vTPM Manager through fifo
-+	} else if (!strcmp(argv[optind], "hvm")) {
-+		vtpm_type = VTPM_TYPE_HVM;	// Get commands from qemu via socket
-+        } else {
-+		error("Invalid vm mode '%s'; must be 'pvm', "
-+			"or 'hvm' ", argv[optind]);
-+		print_usage(argv[0]);
-+		exit(EXIT_SUCCESS);
-+	}
-+        ++optind;
-+	dmi_id = atoi(argv[optind]);
-+#endif
-+    } else {
-+	error("Invalid number of arguments");
-+	print_usage(argv[0]);
-+	exit(EXIT_SUCCESS);
-     }
- }
- 
-@@ -348,93 +581,180 @@ static int init_socket(const char *name)
- 
- static void main_loop(void)
- {
--    int sock, fh, res;
--    int32_t in_len;
-+    int32_t in_len, written;
-     uint32_t out_len;
--    uint8_t in[TPM_CMD_BUF_SIZE], *out;
-+    uint8_t in[TPM_CMD_BUF_SIZE], *out, *addressed_out;
-+    int guest_id=-1;
-+    int i;
-+    char *vtpm_rx_file=NULL;
-+    int res;
-+
-+#ifndef VTPM_MULTI_VM
-+    int sockfd = -1;
-     struct sockaddr_un addr;
--    socklen_t addr_len;
--    fd_set rfds;
--    struct timeval tv;
-+    struct sockaddr_un client_addr;
-+    unsigned int client_length;
-+#endif
-+
-+    int vtpm_tx_fh=-1, vtpm_rx_fh=-1;
-+
-+#ifndef VTPM_MULTI_VM
-+  if (vtpm_type == VTPM_TYPE_PVM) {
-+    vtpm_rx_file = malloc(10 + strlen(PVM_RX_FIFO_D));
-+    sprintf(vtpm_rx_file, PVM_RX_FIFO_D, (uint32_t) dmi_id);
-+  } else {
-+    vtpm_rx_file = malloc(10 + strlen(HVM_RX_FIFO_D));
-+    sprintf(vtpm_rx_file, HVM_RX_FIFO_D, (uint32_t) dmi_id);
-+
-+    if ( (sockfd = socket(PF_UNIX,SOCK_STREAM,0)) < 0) {
-+          error("Unable to create socket. errno = %d\n", errno);
-+      exit (-1);
-+    }
-+
-+    memset(&addr, 0, sizeof(addr));
-+    addr.sun_family = AF_UNIX;
-+    strcpy(addr.sun_path,vtpm_rx_file );
-+    unlink(addr.sun_path);
-+  }
-+#endif
- 
-     info("staring main loop");
--    /* open UNIX socket */
--    sock = init_socket(opt_socket_name);
--    if (sock < 0) exit(EXIT_FAILURE);
-     /* init tpm emulator */
--    debug("initializing TPM emulator: %d", tpm_startup);
-+#ifdef VTPM_MULTI_VM
-+    debug("initializing TPM emulator: state=%d", tpm_startup);
-+#else
-+    debug("initializing TPM emulator: state=%d, type=%d, id=%d", tpm_startup, vtpm_type, dmi_id);
-+#endif
-     tpm_emulator_init(tpm_startup);
-     /* start command processing */
-     while (!stopflag) {
-         /* wait for incomming connections */
-         debug("waiting for connections...");
--        FD_ZERO(&rfds);
--        FD_SET(sock, &rfds);
--        tv.tv_sec = 10;
--        tv.tv_usec = 0;
--        res = select(sock + 1, &rfds, NULL, NULL, &tv);
--        if (res < 0) {
--            error("select(sock) failed: %s", strerror(errno));
--            break;
--        } else if (res == 0) {
--            continue;
--        }
--        addr_len = sizeof(addr);
--        fh = accept(sock, (struct sockaddr*)&addr, &addr_len);
--        if (fh < 0) {
--            error("accept() failed: %s", strerror(errno));
--            continue;
--        }
-+	if (vtpm_rx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+	    vtpm_rx_fh = open(DEV_BE, O_RDWR);
-+#else
-+	    if (vtpm_type == VTPM_TYPE_PVM)
-+	    {
-+		vtpm_rx_fh = open(vtpm_rx_file, O_RDONLY);
-+	    } else {
-+		if (bind(sockfd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-+		    error("Unable to bind(). errno = %d\n", errno);
-+		    exit (-1);
-+		}
-+
-+		if (listen(sockfd, 10) <0) {
-+		    error("Unable to listen(). errno = %d\n", errno);
-+		    exit (-1);
-+		} 
-+
-+		 memset(&client_addr, 0, sizeof(client_addr));
-+		 client_length = sizeof(client_addr);
-+
-+		 vtpm_rx_fh = vtpm_tx_fh = accept(sockfd, (struct sockaddr *)&client_addr, &client_length);
-+	    }
-+#endif
-+	}
-+	
-+	/*Error Checking*/
-+	if (vtpm_rx_fh < 0) {
-+	  error("Failed to open devices to listen to guest.\n");
-+	  exit(-1);
-+	}
-+
-         /* receive and handle commands */
-         in_len = 0;
-         do {
-             debug("waiting for commands...");
--            FD_ZERO(&rfds);
--            FD_SET(fh, &rfds);
--            tv.tv_sec = TPM_COMMAND_TIMEOUT;
--            tv.tv_usec = 0;
--            res = select(fh + 1, &rfds, NULL, NULL, &tv);
--            if (res < 0) {
--                error("select(fh) failed: %s", strerror(errno));
--                close(fh);
--                break;
--            } else if (res == 0) {
--#ifdef TPMD_DISCONNECT_IDLE_CLIENTS	    
--                info("connection closed due to inactivity");
--                close(fh);
--                break;
--#else		
--                continue;
--#endif		
--            }
--            in_len = read(fh, in, sizeof(in));
--            if (in_len > 0) {
-+
-+            in_len = read(vtpm_rx_fh, in, sizeof(in));
-+	    /*Magic size of minimum TPM command is 6*/
-+		//FIXME Magic size check may not be required anymore
-+            if (in_len < 6) {
-+		info("Recv incomplete command of %d bytes.", in_len);
-+		if (in_len <= 0) {
-+		    close(vtpm_rx_fh);
-+		    vtpm_rx_fh = -1;
-+		    continue;
-+                 }
-+	    } else {
-+		/*Debug Printouts*/
-                 debug("received %d bytes", in_len);
-+		debug_nostop("Recv[%d]: 0x", in_len);
-+		for (i=0; i< in_len; i++) 
-+		    debug_more("%x ", in[i]);
-+		debug_more("\n");
-+		/*Multiple Guest check*/
-+		if (guest_id == -1) {
-+		    guest_id = *((int32_t *) in);
-+		} else {
-+		    if (guest_id != *((int32_t *) in) ) {
-+			error("WARNING: More than one guest attached\n");
-+		    }
-+		}
-+
-+		/*Open tx handle now*/
-+		if (vtpm_tx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+		    vtpm_tx_fh = open(DEV_BE, O_RDWR);
-+		    vtpm_rx_fh = vtpm_tx_fh;
-+#else
-+		    if (vtpm_type == VTPM_TYPE_PVM) {
-+			vtpm_tx_fh = open(PVM_TX_FIFO, O_WRONLY);
-+     		    } // No need to open the other direction for HVM
-+#endif
-+		}
-+		if (vtpm_tx_fh < 0) {
-+		  error("Failed to open devices to respond to guest.\n");
-+		  exit(-1);
-+		}
-+
-+		/*Handle the TPM command now*/
-                 out = NULL;
--                res = tpm_handle_command(in, in_len, &out, &out_len);
-+                res = tpm_handle_command(in + sizeof(uint32_t), in_len - sizeof(uint32_t), &out, &out_len);
-                 if (res < 0) {
-                     error("tpm_handle_command() failed");
-                 } else {
-                     debug("sending %d bytes", out_len);
-+		    //FIXME this prepending may or may not be needed
-+		    /*Prepend the first 4 bytes of the in buffer.. why?*/
-+		    addressed_out = (uint8_t *) tpm_malloc(sizeof(uint32_t) + out_len);
-+		    *(uint32_t *) addressed_out = *(uint32_t *) in;
-+		    memcpy(addressed_out + sizeof(uint32_t), out, out_len);
-+		    out_len += sizeof(uint32_t);
-+		    /*End Prepend*/
-+
-+		    /*Perform write operation now*/
-                     while (out_len > 0) {
--                        res = write(fh, out, out_len);
-+                        res = write(vtpm_tx_fh, addressed_out, out_len);
-+
-                         if (res < 0) {
-                             error("write(%d) failed: %s", out_len, strerror(errno));
-                             break;
--                        }
-+                        } else {
-+			  debug_nostop("Sent[%Zu]: ", out_len);
-+			  for (i=0; (unsigned int)i< out_len; i++)
-+			    debug_more("%x ", addressed_out[i]);
-+			  debug_more("\n");
-+			}
-                         out_len	-= res;
-                     }
-                     tpm_free(out);
-+		    tpm_free(addressed_out);
-                 }
-             }
-         } while (in_len > 0);
--        close(fh);
-+        //close(fh);
-     }
-+    
-     /* shutdown tpm emulator */
-     tpm_emulator_shutdown();
--    /* close socket */
--    close(sock);
--    unlink(opt_socket_name);
-+    /* Close handles */
-+    close(vtpm_tx_fh);
-+#ifndef VTPM_MULTI_VM
-+    close(vtpm_rx_fh);
-+    free(vtpm_rx_file);
-+#endif
-     info("main loop stopped");
- }
- 
-@@ -450,12 +770,13 @@ int main(int argc, char **argv)
-     /* open random device */
-     init_random();
-     /* init signal handlers */
--    init_signal_handler();
-+    //init_signal_handler();
-     /* unless requested otherwiese, fork and daemonize process */
--    if (!opt_foreground) daemonize();
-+    //if (!opt_foreground) daemonize();
-     /* start main processing loop */
-     main_loop();
-     info("stopping TPM Emulator daemon");
-     closelog();
-     return 0;
- }
-+
-diff -Naurp tpm_emulator-0.5.1/tpmd/tpm_emulator_config.h tpm5-test/tpmd/tpm_emulator_config.h
---- tpm_emulator-0.5.1/tpmd/tpm_emulator_config.h	2008-02-14 03:22:48.000000000 -0500
-+++ tpm5-test/tpmd/tpm_emulator_config.h	2009-07-16 11:25:26.000000000 -0400
-@@ -29,23 +29,28 @@
- 
- /* TPM emulator configuration */
- 
--#undef  TPM_STRONG_PERSISTENCE
--#undef  TPM_GENERATE_EK
-+#define  TPM_STRONG_PERSISTENCE
-+#define  TPM_GENERATE_EK
- #undef  TPM_GENERATE_SEED_DAA
- #undef  TPM_MEMORY_ALIGNMENT_MANDATORY
- 
-+extern int dmi_id;
-+
- /* log macros */
- 
- void tpm_log(int priority, const char *fmt, ...);
- 
--#define debug(fmt, ...) tpm_log(LOG_DEBUG, "%s:%d: Debug: " fmt "\n", \
--                                __FILE__, __LINE__, ## __VA_ARGS__)
--#define info(fmt, ...)  tpm_log(LOG_INFO, "%s:%d: Info: " fmt "\n", \
--                                __FILE__, __LINE__, ## __VA_ARGS__)
--#define error(fmt, ...) tpm_log(LOG_ERR, "%s:%d: Error: " fmt "\n", \
--                                __FILE__, __LINE__, ## __VA_ARGS__)
--#define alert(fmt, ...) tpm_log(LOG_ALERT, "%s:%d: Alert: " fmt "\n", \
--                                __FILE__, __LINE__, ## __VA_ARGS__)
-+#define debug(fmt, ...) tpm_log(LOG_DEBUG, "VTPMD[%d]: %s:%d: Debug: " fmt "\n", \
-+                                dmi_id, __FILE__, __LINE__, ## __VA_ARGS__)
-+#define info(fmt, ...)  tpm_log(LOG_INFO, "VTPMD[%d]: %s:%d: Info: " fmt "\n", \
-+                                dmi_id, __FILE__, __LINE__, ## __VA_ARGS__)
-+#define error(fmt, ...) tpm_log(LOG_ERR, "VTPMD[%d]: %s:%d: Error: " fmt "\n", \
-+                                dmi_id, __FILE__, __LINE__, ## __VA_ARGS__)
-+#define alert(fmt, ...) tpm_log(LOG_ALERT, "VTPMD[%d]: %s:%d: Alert: " fmt "\n", \
-+                                dmi_id, __FILE__, __LINE__, ## __VA_ARGS__)
-+#define debug_nostop(fmt, ...) tpm_log(LOG_DEBUG, "VTPMD[%d]: %s:%d: Debug: " fmt, \
-+                                dmi_id, __FILE__, __LINE__, ## __VA_ARGS__)
-+#define debug_more(fmt, ...) tpm_log(LOG_DEBUG, fmt, ## __VA_ARGS__)
- 
- /*  min/max macros that also do strict type-checking */
- 
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm/vtpm.patch
--- a/tools/vtpm/vtpm.patch	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,716 +0,0 @@
-diff -uprN tpm_emulator/AUTHORS vtpm/AUTHORS
---- tpm_emulator/AUTHORS	2006-12-08 12:51:29.000000000 -0800
-+++ vtpm/AUTHORS	2006-12-13 16:38:52.000000000 -0800
-@@ -1,3 +1,3 @@
- Mario Strasser <mast@gmx.net>
- Heiko Stamer <stamer@gaos.org> [DAA]
--INTEL Corp <> [Dropped to Ring3]
-+INTEL Corp <> [VTPM Extensions]
-diff -uprN tpm_emulator/ChangeLog vtpm/ChangeLog
---- tpm_emulator/ChangeLog	2006-12-08 12:51:29.000000000 -0800
-+++ vtpm/ChangeLog	2006-12-13 16:38:52.000000000 -0800
-@@ -1,5 +1,6 @@
- ????-??-?? Intel Corp
- 	* Moved module out of kernel to run as a ring 3 app
-+	* Modified save_to_file and load_from_file to call xen VTPM manager
- 
- 2006-06-23  Mario Strasser <mast@gmx.net>
- 	* tpm_startup.c: behaviour of ST_CLEAR and storage of
-diff -uprN tpm_emulator/linux_module.h vtpm/linux_module.h
---- tpm_emulator/linux_module.h	2006-12-08 12:51:29.000000000 -0800
-+++ vtpm/linux_module.h	2007-01-09 14:49:06.000000000 -0800
-@@ -44,18 +44,26 @@
- #define TPM_DEVICE_NAME   "tpm"
- #define TPM_MODULE_NAME   "tpm_emulator"
- 
-+/* debug and log output functions */
-+extern int dmi_id; 
-+
- #ifdef DEBUG
--#define debug(fmt, ...) printf("TPMD: %s:%d: Debug: " fmt "\n", \
--                        __FILE__, __LINE__, ## __VA_ARGS__)
-+#define debug(fmt, ...) printf("TPMD[%d]: %s:%d: Debug: " fmt "\n", \
-+                        dmi_id, __FILE__, __LINE__, ## __VA_ARGS__)
-+#define debug_nostop(fmt, ...) printf("TPMD[%d]: %s:%d: Debug: " fmt, \
-+                        dmi_id, __FILE__, __LINE__, ## __VA_ARGS__)
-+#define debug_more(fmt, ...) printf( fmt, ## __VA_ARGS__ )
- #else
- #define debug(fmt, ...) 
-+#define debug_nostop(fmt, ...) 
-+#define debug_more(fmt, ...)
- #endif
--#define info(fmt, ...)  printf("TPMD: %s:%d: Info: " fmt "\n", \
--                        __FILE__, __LINE__, ## __VA_ARGS__)
--#define error(fmt, ...) printf("TPMD: %s:%d: Error: " fmt "\n", \
--                        __FILE__, __LINE__, ## __VA_ARGS__)
--#define alert(fmt, ...) printf("TPMD: %s:%d: Alert: " fmt "\n", \
--                        __FILE__, __LINE__, ## __VA_ARGS__)
-+#define info(fmt, ...)  printf("TPMD[%d]: %s:%d: Info: " fmt "\n", \
-+                        dmi_id, __FILE__, __LINE__, ## __VA_ARGS__)
-+#define error(fmt, ...) printf("TPMD[%d]: %s:%d: Error: " fmt "\n", \
-+                        dmi_id, __FILE__, __LINE__, ## __VA_ARGS__)
-+#define alert(fmt, ...) printf("TPMD[%d]: %s:%d: Alert: " fmt "\n", \
-+                        dmi_id, __FILE__, __LINE__, ## __VA_ARGS__)
- 
- /* memory allocation */
- 
-diff -uprN tpm_emulator/Makefile vtpm/Makefile
---- tpm_emulator/Makefile	2006-12-08 12:51:29.000000000 -0800
-+++ vtpm/Makefile	2006-12-13 16:38:52.000000000 -0800
-@@ -7,7 +7,7 @@
- COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/)
- 
- # module settings
--BIN            := tpm_emulator
-+BIN            := vtpmd
- VERSION_MAJOR  := 0
- VERSION_MINOR  := 4
- VERSION_BUILD  := $(shell date +"%s")
-@@ -22,7 +22,7 @@ TOOLS_INSTALL_DIR = $(DESTDIR)/usr/bin
- 
- CC      := gcc
- CFLAGS  += -g -Wall $(INCLUDE) -DDEBUG
--CFLAGS  += -I. -Itpm
-+CFLAGS  += -I. -Itpm -I../../vtpm_manager/manager
- 
- # Is the simulator running in it's own vm?
- #CFLAGS += -DVTPM_MULTI_VM
-@@ -62,7 +62,6 @@ $(BIN):	$(src)/crypto/gmp.h $(src)/crypt
- 
- install: $(BIN)
- 	$(INSTALL_PROG) $(BIN) $(TOOLS_INSTALL_DIR)
--	@if [ ! -d "/var/tpm" ]; then mkdir /var/tpm; fi
- 
- clean:
- 	rm -f $(src)/crypto/gmp.h $(src)/crypto/libgmp.a $(OBJS)
-@@ -98,3 +97,4 @@ version:
- 	@echo "#endif /* _TPM_VERSION_H_ */" >> $(src)/tpm_version.h
- 
- .PHONY: all install clean dist gmp version
-+
-diff -uprN tpm_emulator/tpm/tpm_capability.c vtpm/tpm/tpm_capability.c
---- tpm_emulator/tpm/tpm_capability.c	2006-06-23 03:37:07.000000000 -0700
-+++ vtpm/tpm/tpm_capability.c	2007-01-10 10:00:49.000000000 -0800
-@@ -136,8 +136,18 @@ static TPM_RESULT cap_property(UINT32 su
- 
-     case TPM_CAP_PROP_TIS_TIMEOUT:
-       debug("[TPM_CAP_PROP_TIS_TIMEOUT]");
--      /* TODO: TPM_CAP_PROP_TIS_TIMEOUT */
--      return TPM_FAIL;
-+      /* TODO: TPM_CAP_PROP_TIS_TIMEOUT: Measure these values and determine correct ones */
-+      UINT32 len = *respSize = 16;
-+      BYTE *ptr = *resp = tpm_malloc(*respSize);
-+      if (ptr == NULL || 
-+          tpm_marshal_UINT32(&ptr, &len, 200000) ||
-+          tpm_marshal_UINT32(&ptr, &len, 200000) ||
-+          tpm_marshal_UINT32(&ptr, &len, 200000) ||
-+          tpm_marshal_UINT32(&ptr, &len, 200000)) {
-+        tpm_free(*resp);
-+        return TPM_FAIL;
-+      }
-+      return TPM_SUCCESS;
- 
-     case TPM_CAP_PROP_STARTUP_EFFECT:
-       debug("[TPM_CAP_PROP_STARTUP_EFFECT]");
-@@ -190,7 +200,11 @@ static TPM_RESULT cap_property(UINT32 su
- 
-     case TPM_CAP_PROP_DURATION:
-       debug("[TPM_CAP_PROP_DURATION]");
--      /* TODO: TPM_CAP_PROP_DURATION */
-+      /* TODO: TPM_CAP_PROP_DURATION: Measure these values and return accurate ones */
-+      BYTE dur[]= {0x0,0x0,0x0,0xc,0x0,0x7,0xa1,0x20,0x0,0x1e,0x84,0x80,0x11,0xe1,0xa3,0x0}; 
-+      *respSize = 16;
-+      *resp = tpm_malloc(*respSize);
-+      memcpy(*resp,dur,16); 
-       return TPM_FAIL;
- 
-     case TPM_CAP_PROP_ACTIVE_COUNTER:
-diff -uprN tpm_emulator/tpm/tpm_cmd_handler.c vtpm/tpm/tpm_cmd_handler.c
---- tpm_emulator/tpm/tpm_cmd_handler.c	2008-02-27 16:35:41.000000000 -0500
-+++ vtpm/tpm/tpm_cmd_handler.c	2008-02-28 14:43:28.000000000 -0500
-@@ -94,12 +94,18 @@ void tpm_compute_out_param_digest(TPM_CO
-   sha1_ctx_t sha1;
-   UINT32 res = CPU_TO_BE32(rsp->result);
-   UINT32 ord = CPU_TO_BE32(ordinal);
-+  UINT32 offset = 0;
- 
-   /* compute SHA1 hash */
-   sha1_init(&sha1);
-   sha1_update(&sha1, (BYTE*)&res, 4);
-   sha1_update(&sha1, (BYTE*)&ord, 4);
--  sha1_update(&sha1, rsp->param, rsp->paramSize);
-+  if (ordinal == TPM_ORD_LoadKey2) {
-+      offset = 4;
-+  }
-+  if (rsp->paramSize - offset > 0) {
-+      sha1_update(&sha1, rsp->param + offset, rsp->paramSize - offset);
-+  }
-   sha1_final(&sha1, rsp->auth1->digest);
-   if (rsp->auth2 != NULL) memcpy(rsp->auth2->digest, 
-     rsp->auth1->digest, sizeof(rsp->auth1->digest));
-diff -uprN tpm_emulator/tpm/tpm_data.c vtpm/tpm/tpm_data.c
---- tpm_emulator/tpm/tpm_data.c	2008-02-27 16:35:41.000000000 -0500
-+++ vtpm/tpm/tpm_data.c	2008-02-27 16:35:40.000000000 -0500
-@@ -1,6 +1,7 @@
- /* Software-Based Trusted Platform Module (TPM) Emulator for Linux
-  * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,
-  *                    Swiss Federal Institute of Technology (ETH) Zurich
-+ * Copyright (C) 2005 INTEL Corp
-  *
-  * This module is free software; you can redistribute it and/or modify
-  * it under the terms of the GNU General Public License as published
-@@ -15,10 +16,15 @@
-  * $Id: tpm_data.c 98 2006-05-07 14:16:29Z hstamer $
-  */
- 
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include <fcntl.h>
-+#include <unistd.h>
-+
- #include "tpm_emulator.h"
- #include "tpm_structures.h"
- #include "tpm_marshalling.h"
--#include "linux_module.h"
-+#include "vtpm_manager.h"
- 
- TPM_DATA tpmData;
- 
-@@ -158,45 +164,232 @@ void tpm_release_data(void)
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
--#include <unistd.h>
- 
--#define TPM_STORAGE_FILE "/var/tpm/tpm_emulator-1.2." STR(VERSION_MAJOR) "." STR(VERSION_MINOR) 
-+ static int vtpm_tx_fh=-1, vtpm_rx_fh=-1;
-+
-+#ifdef VTPM_MUTLI_VM
-+ #define DEV_FE "/dev/tpm"
-+#else
-+ #define VTPM_RX_FIFO_D  "/var/vtpm/fifos/vtpm_rsp_to_%d.fifo"
-+ #define VTPM_TX_FIFO  "/var/vtpm/fifos/vtpm_cmd_from_all.fifo"
-+
-+ extern int dmi_id;
-+ static char *vtpm_rx_name=NULL; 
-+#endif
- 
- static int write_to_file(uint8_t *data, size_t data_length)
- {
--  int res;
--  int fp;
--  fp = open(TPM_STORAGE_FILE, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR);
--  res = write(fp, data, data_length);
--  close(fp);
--  return (res == data_length) ? 0 : -1;
-+  int res, out_data_size, in_header_size;
-+  BYTE *ptr, *out_data, *in_header;
-+  UINT32 result, len, in_rsp_size;
-+  UINT16 tag = VTPM_TAG_REQ;
-+	
-+  printf("Saving NVM\n");
-+  if (vtpm_tx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+    vtpm_tx_fh = open(DEV_FE, O_RDWR);
-+#else
-+	vtpm_tx_fh = open(VTPM_TX_FIFO, O_WRONLY);
-+#endif
-+  }
-+
-+  if (vtpm_tx_fh < 0) {
-+		return -1;
-+  }
-+ 
-+  // Send request to VTPM Manager to encrypt data
-+#ifdef VTPM_MUTLI_VM
-+  out_data_size = len = VTPM_COMMAND_HEADER_SIZE_CLT + data_length;
-+#else
-+  out_data_size = len = VTPM_COMMAND_HEADER_SIZE_SRV + data_length;
-+#endif
-+  
-+  out_data = ptr = (BYTE *) malloc(len);
-+
-+  if (ptr == NULL
-+#ifndef VTPM_MUTLI_VM
-+      || tpm_marshal_UINT32(&ptr, &len, dmi_id)
-+#endif
-+	  || tpm_marshal_UINT16(&ptr, &len, tag)
-+#ifdef VTPM_MUTLI_VM
-+	  || tpm_marshal_UINT32(&ptr, &len, out_data_size)
-+#else
-+	  || tpm_marshal_UINT32(&ptr, &len, out_data_size - sizeof(uint32_t))
-+#endif  
-+	  || tpm_marshal_UINT32(&ptr, &len, VTPM_ORD_SAVENVM)
-+	  || tpm_marshal_BYTE_ARRAY(&ptr, &len, data, data_length)) {
-+	free(out_data);
-+	return -1;
-+  }
-+  
-+  printf("\tSending SaveNVM Command.\n");
-+  res = write(vtpm_tx_fh, out_data, out_data_size);
-+  free(out_data);
-+  if (res != out_data_size) return -1;
-+
-+  if (vtpm_rx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+    vtpm_rx_fh = vtpm_tx_fh
-+#else
-+    if (vtpm_rx_name == NULL) {
-+      vtpm_rx_name = malloc(10 + strlen(VTPM_RX_FIFO_D));
-+      sprintf(vtpm_rx_name, VTPM_RX_FIFO_D, (uint32_t) dmi_id);
-+    }
-+	vtpm_rx_fh = open(vtpm_rx_name, O_RDONLY);
-+#endif
-+  }
-+
-+  if (vtpm_rx_fh < 0) {
-+		return -1;
-+  }
-+  
-+  // Read Header of response so we can get the size & status
-+#ifdef VTPM_MUTLI_VM
-+  in_header_size = len = VTPM_COMMAND_HEADER_SIZE_CLT;
-+#else
-+  in_header_size = len = VTPM_COMMAND_HEADER_SIZE_SRV;
-+#endif
-+  in_header = ptr = malloc(in_header_size);
-+  
-+  printf("\tReading SaveNVM header.\n");
-+  res = read(vtpm_rx_fh, in_header, in_header_size);
-+
-+  if ( (res != in_header_size)
-+#ifndef VTPM_MUTLI_VM
-+       || tpm_unmarshal_UINT32(&ptr, &len, (UINT32*)&dmi_id)
-+#endif
-+	   || tpm_unmarshal_UINT16(&ptr, &len, &tag)
-+	   || tpm_unmarshal_UINT32(&ptr, &len, &in_rsp_size)
-+	   || tpm_unmarshal_UINT32(&ptr, &len, &result) ) {
-+	  free(in_header);
-+	  return -1;
-+  }
-+  free(in_header);
-+  
-+  if (result != VTPM_SUCCESS) {
-+      return -1;  
-+  }
-+
-+#ifdef VTPM_MUTLI_VM
-+  close(vtpm_tx_fh); close(vtpm_rx_fh);
-+#endif
-+	  
-+  printf("\tFinishing up SaveNVM\n");
-+  return (0);
- }
- 
- static int read_from_file(uint8_t **data, size_t *data_length)
- {
--  int res;
--  int fp, file_status;
--  struct stat file_info;
--  fp = open(TPM_STORAGE_FILE, O_RDONLY, 0);
--  file_status = fstat(fp, &file_info);
--  if (file_status < 0) {
--    close(fp);
--    return -1;
--  } 
-+  int res, out_data_size, in_header_size;
-+  uint8_t *ptr, *out_data, *in_header;
-+  UINT16 tag = VTPM_TAG_REQ;
-+  UINT32 len, in_rsp_size, result;
-+#ifdef VTPM_MUTLI_VM
-+	int vtpm_rx_fh, vtpm_tx_fh;
-+#endif
-+	
-+  printf("Loading NVM.\n");
-+  if (vtpm_tx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+    vtpm_tx_fh = open(DEV_FE, O_RDWR);
-+#else
-+	vtpm_tx_fh = open(VTPM_TX_FIFO, O_WRONLY);
-+#endif
-+  }
- 
--  *data_length = file_info.st_size; 
--  *data = tpm_malloc(*data_length);
--  if (*data == NULL) {
--    close(fp);
-+  if (vtpm_tx_fh < 0) {
-+		return -1;
-+  }
-+ 
-+  // Send request to VTPM Manager to encrypt data
-+#ifdef VTPM_MUTLI_VM
-+  out_data_size = len = VTPM_COMMAND_HEADER_SIZE_CLT;
-+#else
-+  out_data_size = len = VTPM_COMMAND_HEADER_SIZE_SRV;
-+#endif
-+  out_data = ptr = (BYTE *) malloc(len);
-+
-+  if (ptr == NULL
-+#ifndef VTPM_MUTLI_VM
-+      || tpm_marshal_UINT32(&ptr, &len, dmi_id)
-+#endif  
-+      || tpm_marshal_UINT16(&ptr, &len, tag)
-+#ifdef VTPM_MUTLI_VM
-+      || tpm_marshal_UINT32(&ptr, &len, out_data_size)
-+#else
-+      || tpm_marshal_UINT32(&ptr, &len, out_data_size - sizeof(uint32_t))
-+#endif
-+      || tpm_marshal_UINT32(&ptr, &len, VTPM_ORD_LOADNVM)) {
-+    free(out_data);
-     return -1;
-   }
--  res = read(fp, *data, *data_length);
--  close(fp);
-+
-+  printf("\tSending LoadNVM command\n");
-+  res = write(vtpm_tx_fh, out_data, out_data_size);
-+  free(out_data);
-+  if (res != out_data_size) return -1;
-+
-+    if (vtpm_rx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+    vtpm_rx_fh = vtpm_tx_fh;
-+#else
-+    if (vtpm_rx_name == NULL) {
-+      vtpm_rx_name = malloc(10 + strlen(VTPM_RX_FIFO_D));
-+      sprintf(vtpm_rx_name, VTPM_RX_FIFO_D, (uint32_t) dmi_id);
-+    }
-+	vtpm_rx_fh = open(vtpm_rx_name, O_RDONLY);
-+#endif
-+  }
-+
-+  if (vtpm_rx_fh < 0) {
-+		return -1;
-+  }
-+  
-+  // Read Header of response so we can get the size & status
-+#ifdef VTPM_MUTLI_VM
-+  in_header_size = len = VTPM_COMMAND_HEADER_SIZE_CLT;
-+#else
-+  in_header_size = len = VTPM_COMMAND_HEADER_SIZE_SRV;
-+#endif
-+  in_header = ptr = malloc(in_header_size);
-+  
-+  printf("\tReading LoadNVM header\n");
-+  res = read(vtpm_rx_fh, in_header, in_header_size);
-+
-+  if ( (res != in_header_size)
-+#ifndef VTPM_MUTLI_VM
-+       || tpm_unmarshal_UINT32(&ptr, &len, (UINT32*)&dmi_id)
-+#endif
-+       || tpm_unmarshal_UINT16(&ptr, &len, &tag)
-+       || tpm_unmarshal_UINT32(&ptr, &len, &in_rsp_size)
-+       || tpm_unmarshal_UINT32(&ptr, &len, &result) ) {
-+      free(in_header);
-+      return -1;
-+  }
-+  free(in_header);
-+  
-+  if (result != VTPM_SUCCESS) {
-+      return -1;  
-+  }
-+
-+  // Read Encrypted data from VTPM Manager
-+  *data_length = in_rsp_size - VTPM_COMMAND_HEADER_SIZE_CLT;
-+  *data = (uint8_t *) malloc(*data_length);
-+
-+  printf("\tReading clear data from LoadNVM.\n");
-+  res = read(vtpm_rx_fh, *data, *data_length);
-+#ifdef VTPM_MUTLI_VM
-+  close(vtpm_rx_fh);close(vtpm_tx_fh);
-+#endif 
-+	
-+  printf("\tReturing from loading NVM\n");
-   if (res != *data_length) {
--    tpm_free(*data);
--    return -1;
-+      free(*data);
-+      return -1;
-+  } else {
-+      return 0;
-   }
--  return 0;
-+
- }
- 
- #else
-diff -uprN tpm_emulator/tpmd.c vtpm/tpmd.c
---- tpm_emulator/tpmd.c	2006-12-08 12:51:29.000000000 -0800
-+++ vtpm/tpmd.c	2007-01-09 14:48:56.000000000 -0800
-@@ -21,12 +21,24 @@
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <sys/time.h>
-+#include <sys/socket.h>
-+#include <sys/un.h>
-+#include <errno.h>
- 
- #include "tpm_emulator.h"
-+#include "vtpm_manager.h"
- 
--#define TPM_RX_FNAME "/var/tpm/tpm_in.fifo"
--#define TPM_TX_FNAME "/var/tpm/tpm_out.fifo"
-+#ifdef VTPM_MULTI_VM
-+ #define DEV_BE "/dev/vtpm"
-+#else
-+ #define PVM_RX_FIFO_D "/var/vtpm/fifos/tpm_cmd_to_%d.fifo"
-+ #define PVM_TX_FIFO "/var/vtpm/fifos/tpm_rsp_from_all.fifo"
- 
-+ #define HVM_RX_FIFO_D "/var/vtpm/socks/%d.socket"
-+#endif
-+
-+ int dmi_id;
-+						
- #define BUFFER_SIZE 2048
- 
- static int devurandom=0;
-@@ -38,7 +50,7 @@ void get_random_bytes(void *buf, int nby
-   }
- 
-   if (read(devurandom, buf, nbytes) != nbytes) {
--      printf("Can't get random number.\n");
-+      error("Can't get random number.\n");
-       exit(-1);
-   }
- }
-@@ -52,105 +64,182 @@ uint64_t tpm_get_ticks(void)
- 
- int main(int argc, char **argv)
- {
--  uint8_t in[BUFFER_SIZE], *out;
-+  uint8_t type, in[BUFFER_SIZE], *out, *addressed_out;
-+  char *vtpm_rx_file=NULL;
-   uint32_t out_size;
-   int in_size, written;
--  int i;
--  struct stat file_info;
-+  int i, guest_id=-1;
- 
--  int tpm_tx_fh=-1, tpm_rx_fh=-1;
-+#ifndef VTPM_MULTI_VM
-+  int sockfd = -1;
-+  struct sockaddr_un addr;
-+  struct sockaddr_un client_addr;
-+  unsigned int client_length;
-+
-+#endif
-+ 
-+  int vtpm_tx_fh=-1, vtpm_rx_fh=-1;
-+#ifdef VTPM_MULTI_VM
-   if (argc < 2) {
--    printf("Usage: tpmd clear|save|deactivated\n" );
-+    error("Usage: tpmd clear|save|deactivated\n" );
-+#else
-+  if (argc < 4) {
-+    error("Usage: tpmd clear|save|deactivated pvm|hvm vtpmid\n" );
-+#endif
- 	  return -1;
-   }
- 
-+#ifndef VTPM_MULTI_VM
-+  /* setup type of vm */
-+  if (!strcmp(argv[2], "pvm")) {
-+    type = VTPM_TYPE_PVM; // Get commands from vTPM Manager through fifo
-+  } else if (!strcmp(argv[2], "hvm")) {
-+    type = VTPM_TYPE_HVM; // Get commands from qemu via socket
-+  } else {
-+    error("invalid vTPM type '%s'.\n", argv[2]);
-+  }
-+
-+  dmi_id = atoi(argv[3]);
-+
-+  if (type == VTPM_TYPE_PVM) {
-+    vtpm_rx_file = malloc(10 + strlen(PVM_RX_FIFO_D));
-+    sprintf(vtpm_rx_file, PVM_RX_FIFO_D, (uint32_t) dmi_id);
-+  } else {
-+    vtpm_rx_file = malloc(10 + strlen(HVM_RX_FIFO_D));
-+    sprintf(vtpm_rx_file, HVM_RX_FIFO_D, (uint32_t) dmi_id);
-+
-+    if ( (sockfd = socket(PF_UNIX,SOCK_STREAM,0)) < 0) {
-+          error("Unable to create socket. errno = %d\n", errno);
-+      exit (-1);
-+    }
-+
-+    memset(&addr, 0, sizeof(addr));
-+    addr.sun_family = AF_UNIX;
-+    strcpy(addr.sun_path,vtpm_rx_file );
-+    unlink(addr.sun_path);
-+  }
-+#endif
-+
-+#ifdef VTPM_MULTI_VM
-+  info("Initializing tpm state: %s\n", argv[1]);
-+#else
-+  info("Initializing tpm state: %s, type: %s, id: %d\n", argv[1], argv[2], dmi_id);
-+#endif
-+
-   /* initialize TPM emulator */
-   if (!strcmp(argv[1], "clear")) {
--    printf("Initializing tpm: %s\n", argv[1]);
-     tpm_emulator_init(1);
--  } else if (!strcmp(argv[1], "save")) { 
--    printf("Initializing tpm: %s\n", argv[1]);
-+  } else if (!strcmp(argv[1], "save")) {
-     tpm_emulator_init(2);
-   } else if (!strcmp(argv[1], "deactivated")) {
--    printf("Initializing tpm: %s\n", argv[1]);
-     tpm_emulator_init(3);
-   } else {
--    printf("invalid startup mode '%s'; must be 'clear', "
-+    error("invalid startup mode '%s'; must be 'clear', "
-       "'save' (default) or 'deactivated", argv[1]);
-     return -1;
-   }
--
--  if ( stat(TPM_RX_FNAME, &file_info) == -1) {
--    if ( mkfifo(TPM_RX_FNAME, S_IWUSR | S_IRUSR ) ) {
--      printf("Failed to create fifo %s.\n", TPM_RX_FNAME);
--      return -1;
--    }
--  }
--
--  if ( stat(TPM_TX_FNAME, &file_info) == -1) {
--    if ( mkfifo(TPM_TX_FNAME, S_IWUSR | S_IRUSR ) ) {
--      printf("Failed to create fifo %s.\n", TPM_TX_FNAME);
--      return -1;
--    }
--  }
--
-+  
-   while (1) {
- abort_command:
--    if (tpm_rx_fh < 0) {
--      tpm_rx_fh = open(TPM_RX_FNAME, O_RDONLY);
-+    if (vtpm_rx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+      vtpm_rx_fh = open(DEV_BE, O_RDWR);
-+#else
-+      if (type == VTPM_TYPE_PVM) {
-+        vtpm_rx_fh = open(vtpm_rx_file, O_RDONLY);
-+      } else {
-+        if (bind(sockfd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-+          error("Unable to bind(). errno = %d\n", errno);
-+          exit (-1);
-+        }
-+
-+        if (listen(sockfd, 10) <0) {
-+          error("Unable to listen(). errno = %d\n", errno);
-+          exit (-1);
-+        }
-+
-+        memset(&client_addr, 0, sizeof(client_addr));
-+        client_length = sizeof(client_addr);
-+
-+        vtpm_rx_fh = vtpm_tx_fh = accept(sockfd, (struct sockaddr *)&client_addr, &client_length);
-+      }
-+#endif
-     }
-     
--    if (tpm_rx_fh < 0) {
--      printf("ERROR: failed to open devices to listen to guest.\n");
-+    if (vtpm_rx_fh < 0) {
-+      error("Failed to open devices to listen to guest.\n");
-       return -1;
-     }
-     
--    if (tpm_tx_fh < 0) {
--      tpm_tx_fh = open(TPM_TX_FNAME, O_WRONLY);
--    }
--
--    if (tpm_tx_fh < 0) {
--      printf("ERROR: failed to open devices to respond to guest.\n");
--      return -1;
--    }
--
--    in_size = read(tpm_rx_fh, in, BUFFER_SIZE);
-+    in_size = read(vtpm_rx_fh, in, BUFFER_SIZE);
-     if (in_size < 6) { // Magic size of minium TPM command
--      printf("Recv[%d] to small: 0x", in_size);
-+      info("Recv incomplete command of %d bytes.", in_size);
-       if (in_size <= 0) {
--          close(tpm_rx_fh);
--          tpm_rx_fh = -1;
-+          close(vtpm_rx_fh);
-+          vtpm_rx_fh = -1;
-           goto abort_command;
-       }
-     } else { 
--      printf("Recv[%d]: 0x", in_size);
-+      debug_nostop("Recv[%d]: 0x", in_size);
-       for (i=0; i< in_size; i++) 
--        printf("%x ", in[i]);
--      printf("\n");
-+        debug_more("%x ", in[i]);
-+      debug_more("\n");
-     }
- 
--    
--    if (tpm_handle_command(in, in_size, &out, &out_size) != 0) { 
--        printf("ERROR: Handler Failed.\n");
-+    if (guest_id == -1) {
-+        guest_id = *((uint32_t *) in);
-+    } else {
-+        if (guest_id != *((uint32_t *) in) ) {
-+            error("WARNING: More than one guest attached\n");
-+        }
-+    }
-+
-+    if (vtpm_tx_fh < 0) {
-+#ifdef VTPM_MUTLI_VM
-+      vtpm_tx_fh = open(DEV_BE, O_RDWR);
-+      vtpm_rx_fh = vtpm_tx_fh;
-+#else
-+      if (type == VTPM_TYPE_PVM) {
-+        vtpm_tx_fh = open(PVM_TX_FIFO, O_WRONLY);
-+      } // No need to open the other direction for HVM
-+#endif
-+    }
-+
-+    if (vtpm_tx_fh < 0) {
-+      error("Failed to open devices to respond to guest.\n");
-+      return -1;
-+    }
-+
-+    // Handle the command, but skip the domain id header    
-+    if (tpm_handle_command(in + sizeof(uint32_t), in_size - sizeof(uint32_t), &out, &out_size) != 0) { 
-+      error("Handler Failed.\n");
-     }
- 
--    written = write(tpm_tx_fh, out, out_size);
-+    addressed_out = (uint8_t *) tpm_malloc(sizeof(uint32_t) + out_size);
-+    *(uint32_t *) addressed_out = *(uint32_t *) in;
-+    memcpy(addressed_out + sizeof(uint32_t), out, out_size);
-+
-+    written = write(vtpm_tx_fh, addressed_out, out_size + sizeof(uint32_t));
- 
--    if (written != out_size ) {
--      printf("ERROR: Part of response not written %d/%d.\nAttempt: ", written, out_size);
-+    if (written != out_size + sizeof(uint32_t)) {
-+      error("Part of response not written %d/%d.\n", written, out_size);
-     } else {
--      printf("Sent[%Zu]: ", out_size);
-+      debug_nostop("Sent[%Zu]: ", out_size + sizeof(uint32_t));
-+      for (i=0; i< out_size+ sizeof(uint32_t); i++)
-+        debug_more("%x ", addressed_out[i]);
-+      debug_more("\n");
-     }
--    for (i=0; i< out_size; i++)
--      printf("%x ", out[i]);
--    printf("\n");
-     tpm_free(out);
-+    tpm_free(addressed_out);
- 
-   } // loop
- 
-   tpm_emulator_shutdown();
- 
--  close(tpm_tx_fh);
--  close(tpm_rx_fh);
-+  close(vtpm_tx_fh);
-+#ifndef VTPM_MUTLI_VM
-+  close(vtpm_rx_fh);
-+  free (vtpm_rx_file);
-+#endif
- 
- }
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/COPYING
--- a/tools/vtpm_manager/COPYING	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/Makefile
--- a/tools/vtpm_manager/Makefile	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-XEN_ROOT = $(CURDIR)/../..
-
-# Base definitions and rules
-include $(XEN_ROOT)/tools/vtpm_manager/Rules.mk
-
-SUBDIRS		= crypto tcs util manager migration
-OPENSSL_HEADER	= /usr/include/openssl/crypto.h
-
-.PHONY: all clean install
-all clean install: %: subdirs-%
-
-.PHONY: mrproper
-mrproper:
-	@set -e; for subdir in $(SUBDIRS); do \
-		$(MAKE) -C $$subdir $@; \
-	done
-
-
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/README
--- a/tools/vtpm_manager/README	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-// ===================================================================
-//
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-
-Directory Structure
-===================
-tools/vtpm_manager/crypto    -> crypto files
-tools/vtpm_manager/TCS       -> TCS implementation
-tools/vtpm_manager/util      -> Utility Library. Include disk-io and buffers.
-tools/vtpm_manager/manager   -> VTPM Manager
-
-Compile Flags
-===================
-LOGGING_MODULES              -> How extensive logging happens
-                                see util/log.h for more info
-
-VTPM_MULTI_VM                -> Defined: VTPMs run in their own VMs
-                                Not Defined (default): VTPMs are processes
-
-# Debugging flags that may disappear without notice in the future
-
-DUMMY_BACKEND                -> vtpm_manager listens on /tmp/in.fifo and 
-                                /tmp/out.fifo rather than backend
-
-MANUAL_DM_LAUNCH             -> Must manually launch & kill VTPMs
-
-WELL_KNOWN_OWNER_AUTH        -> Rather than randomly generating the password for the owner,
-                                use a well known value. This is useful for debugging and for
-                                poor bios which do not support clearing TPM if OwnerAuth is
-                                lost. However this has no protection from malicious app
-                                issuing a TPM_OwnerClear to wipe the TPM 
-
-Requirements
-============
-- xen-unstable 
-- vtpm frontend/backend driver patch
-- OpenSSL Library
-
-Single-VM Flow
-============================
-- Launch the VTPM manager (vtpm_managerd) which which begins listening to the BE with one thread
-  and listens to a named fifo that is shared by the vtpms to commuincate with the manager.
-- VTPM Manager listens to TPM BE.
-- When xend launches a tpm frontend equipped VM it contacts the manager over the vtpm backend. 
-- When the manager receives the open message from the BE, it launches a vtpm
-- Xend allows the VM to continue booting. 
-- When a TPM request is issued to the front end, the front end transmits the TPM request to the backend.
-- The manager receives the TPM requests and uses a named fifo to forward the request to the vtpm.
-- The fifo listener begins listening for the reply from vtpm for the request.
-- Vtpm processes request and replies to manager over shared named fifo.
-- If needed, the vtpm may send a request to the vtpm_manager at any time to save it's secrets to disk.
-- Manager receives response from vtpm and passes it back to backend for forwarding to guest.
-
-NOTES:
-* SaveService SHOULD seal it's table before saving it to disk. However,
-  the current Xen infrastructure does not provide a mechanism for this to be
-  unsealed later. Specifically, the auth and wrapped key must be available ONLY
-  to the service, or it's not even worth encrypting
-
-  In the future the vtpm manager will be protected by an early boot mechanism
-  that will allow for better protection of it's data.
-
-TODO:
-- Timeout on crashed vtpms
-- create lock for shared fifo for talking to vtpms.
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/Rules.mk
--- a/tools/vtpm_manager/Rules.mk	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-# Base definitions and rules (XEN_ROOT must be defined in including Makefile)
-include $(XEN_ROOT)/tools/Rules.mk
-
-#
-# Tool definitions
-#
-
-# General compiler flags
-CFLAGS	= -Werror -g3
-
-# Generic project files
-HDRS	= $(wildcard *.h)
-SRCS	= $(wildcard *.c)
-OBJS	= $(patsubst %.c,%.o,$(SRCS))
-
-# Generic (non-header) dependencies
-$(SRCS): Makefile $(XEN_ROOT)/tools/Rules.mk $(XEN_ROOT)/tools/vtpm_manager/Rules.mk
-
-$(OBJS): $(SRCS)
-
--include $(FILES)
-
-# Make sure these are just rules
-.PHONY : all build install clean
-
-#
-# Project-specific definitions
-#
-
-# Need UNIX98 spec for pthread rwlocks
-CFLAGS += -D_GNU_SOURCE
-
-# Logging Level. See utils/tools.h for usage
-CFLAGS += -DLOGGING_MODULES="(BITMASK(VTPM_LOG_TCS)|BITMASK(VTPM_LOG_VTSP)|BITMASK(VTPM_LOG_VTPM))"
-
-# Silent Mode
-#CFLAGS += -DLOGGING_MODULES=0x0
-#CFLAGS += -DLOGGING_MODULES=0xff
-
-# Use frontend/backend pairs between manager & DMs?
-#CFLAGS += -DVTPM_MULTI_VM
-
-# vtpm_manager listens on fifo's rather than backend
-#CFLAGS += -DDUMMY_BACKEND
-
-# TCS talks to fifo's rather than /dev/tpm. TPM Emulator assumed on fifos
-#CFLAGS += -DDUMMY_TPM
-
-# Do not have manager launch DMs.
-#CFLAGS += -DMANUAL_DM_LAUNCH
-
-# Fixed OwnerAuth
-#CFLAGS += -DWELL_KNOWN_OWNER_AUTH
-
-# Include
-CFLAGS += -I$(XEN_ROOT)/tools/vtpm_manager/crypto
-CFLAGS += -I$(XEN_ROOT)/tools/vtpm_manager/util
-CFLAGS += -I$(XEN_ROOT)/tools/vtpm_manager/tcs
-CFLAGS += -I$(XEN_ROOT)/tools/vtpm_manager/manager
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/crypto/Makefile
--- a/tools/vtpm_manager/crypto/Makefile	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/vtpm_manager/Rules.mk
-
-BIN		= libtcpaCrypto.a
-
-.PHONY: all
-all: build
-
-.PHONY: build
-build: $(BIN)
-
-.PHONY: install
-install: build
-
-.PHONY: clean
-clean:
-	rm -f *.a *.so *.o *.rpm $(DEP_FILES)
-
-.PHONY: mrproper
-mrproper: clean
-	rm -f *~
-
-$(BIN): $(OBJS)
-	$(AR) rcs $(BIN) $(OBJS)
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/crypto/crypto.c
--- a/tools/vtpm_manager/crypto/crypto.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// crypto.c
-// 
-//  This file will handle all the TPM Crypto functionality
-// 
-// ==================================================================
-
-#include <string.h>
-#include <openssl/crypto.h>
-#include <openssl/err.h>
-#include <openssl/evp.h>
-#include <openssl/rand.h>
-#include "crypto.h"
-#include "log.h"
-
-/**
- * Initialize cryptography library
- * @rand: random seed
- * @size: size of @rand
- */
-void Crypto_Init(const BYTE* rand, int size) {
-	ERR_load_crypto_strings();
-  CRYPTO_malloc_init();
-  OpenSSL_add_all_algorithms();
-  SYM_CIPHER = EVP_aes_128_cbc();
-  RAND_poll();
-  if (rand == NULL)
-    return;
-
-  RAND_add(rand, size, size);
-}
-
-/**
- * Shutdown cryptography library
- */
-void Crypto_Exit() {
-  ERR_free_strings();
-  ERR_remove_state(0);
-  EVP_cleanup();
-}
-
-
-/**
- * Get random data
- * @data: (OUT) Random data
- * @size: Size of @data
- */
-void Crypto_GetRandom(void* data, int size) {
-  int result;
-  
-  result = RAND_pseudo_bytes((BYTE*) data, size);
-  
-  if (result <= 0) 
-    vtpmlogerror (VTPM_LOG_CRYPTO, "RAND_pseudo_bytes failed: %s\n",
-	     ERR_error_string (ERR_get_error(), NULL));
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/crypto/crypto.h
--- a/tools/vtpm_manager/crypto/crypto.h	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,175 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// crypto.h
-// 
-//  This file defines the TPM Crypto API
-//
-// ==================================================================
-
-#ifndef __CRYPTO_H__
-#define __CRYPTO_H__
-
-#include <stddef.h>
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "tcg.h"
-#include "sym_crypto.h"
-
-#define CRYPTO_MAX_SIG_SIZE (2048 / 8)
-#define CRYPTO_MAX_RSA_KEY_SIZE (4096 / 8) //in bytes
-
-#define OAEP_P "TCPA"
-#define OAEP_P_SIZE 4
-
-// Algorithms supported by crypto. Stored in CRYPTO_INFO.algorithmID
-#define CRYPTO_ALGORITH_RSA 0x01
-
-// Supported Encryption Schemes CRYPTO_INFO.encScheme
-#define CRYPTO_ES_NONE 0x0001
-#define CRYPTO_ES_RSAESPKCSv15 0x0002
-#define CRYPTO_ES_RSAESOAEP_SHA1_MGF1 0x0003
-
-// Supported Signature schemes CRYPTO_INFO.sigScheme
-#define CRYPTO_SS_NONE 0x0001
-#define CRYPTO_SS_RSASSAPKCS1v15_SHA1 0x0002
-#define CRYPTO_SS_RSASSAPKCS1v15_DER 0x0003
-
-typedef struct CRYPTO_INFO {
-  void *keyInfo;
-  UINT32 algorithmID;
-  UINT32 encScheme;
-  UINT32 sigScheme;
-} CRYPTO_INFO;
-
-
-void Crypto_Init(const BYTE* rand, int size);
-
-void Crypto_Exit();
-
-void Crypto_GetRandom(void* data, int size);
-
-void Crypto_HMAC(   const BYTE* text, 
-                    int text_len, 
-                    const BYTE* key, 
-                    int key_len,
-                    BYTE* digest);
-
-TPM_RESULT Crypto_HMAC_buf (const buffer_t * text,
-                            const buffer_t * key,
-                            BYTE * o_digest); /* presumably of 20 bytes */
-    
-void Crypto_SHA1Full(   const BYTE* text, 
-                        UINT32 size,
-                        BYTE* hash); //Complete 3part SHA1
-
-// o_hash needs to be large enough to hold the digest, ie 20 bytes
-TPM_RESULT Crypto_SHA1Full_buf (const buffer_t * buf,
-                                BYTE * o_hash);
-    
-void Crypto_SHA1Start(UINT32* maxNumBytes);
-void Crypto_SHA1Update(int numBytes, const BYTE* hashData);
-void Crypto_SHA1Complete(   int hashDataSize, 
-                            const BYTE* hashData, 
-                            BYTE* hashValue);
-
-void Crypto_RSACreateKey(   /*in*/ UINT32 keySize,
-                            /*in*/ UINT32 pubExpSize, 
-                            /*in*/ BYTE *pubExp,
-                            /*out*/ UINT32 *privExpSize, 
-                            /*out*/ BYTE *privExp,
-                            /*out*/ UINT32 *modulusSize,
-                            /*out*/ BYTE *modulus,
-                            /*out*/ CRYPTO_INFO *keys);
-                            
-void Crypto_RSABuildCryptoInfo( /*[IN]*/ UINT32 pubExpSize, 
-                                /*[IN]*/ BYTE *pubExp,
-                                /*[IN]*/ UINT32 privExpSize, 
-                                /*[IN]*/ BYTE *privExp,
-                                /*[IN]*/ UINT32 modulusSize, 
-                                /*[IN]*/ BYTE *modulus, 
-                                /*[OUT]*/ CRYPTO_INFO* cryptoInfo);
-                                
-void Crypto_RSABuildCryptoInfoPublic(   /*[IN]*/ UINT32 pubExpSize, 
-                                        /*[IN]*/ BYTE *pubExp,
-                                        /*[IN]*/ UINT32 modulusSize, 
-                                        /*[IN]*/ BYTE *modulus, 
-                                        CRYPTO_INFO* cryptoInfo);
-
-//
-// symmetric pack and unpack operations
-//
-TPM_RESULT Crypto_RSAPackCryptoInfo (const CRYPTO_INFO* cryptoInfo,
-                                     BYTE ** io_buf, UINT32 * io_buflen);
-
-TPM_RESULT Crypto_RSAUnpackCryptoInfo (CRYPTO_INFO * ci,
-                                       BYTE * in, UINT32 len,
-                                       UINT32 * o_lenread);
-
-                             
-// return 0 on success, -1 on error
-int Crypto_RSAEnc(  CRYPTO_INFO *keys,
-                    UINT32 inDataSize,
-                    BYTE *inData,
-                    /*out*/ UINT32 *outDataSize,
-                    /*out*/ BYTE *outData);
-
-// return 0 on success, -1 on error
-int Crypto_RSADec(  CRYPTO_INFO *keys,
-                    UINT32 inDataSize,
-                    BYTE *inData,
-                    /*out*/ UINT32 *outDataSize,
-                    /*out*/ BYTE *outData);
-
-// return 0 on success, -1 on error
-int Crypto_RSASign( CRYPTO_INFO *keys,
-                    UINT32 inDataSize,
-                    BYTE *inData,
-                    /*out*/ UINT32 *sigSize,
-                    /*out*/ BYTE *sig);
-
-bool Crypto_RSAVerify(  CRYPTO_INFO *keys,
-                        UINT32 inDataSize,
-                        BYTE *inData,
-                        UINT32 sigSize,
-                        BYTE *sig);
-
-//private:
-int RSA_verify_DER(int dtype, unsigned char *m, unsigned int m_len,
-                   unsigned char *sigbuf, unsigned int siglen, CRYPTO_INFO *key);
-
-int RSA_sign_DER(int type, unsigned char *m, unsigned int m_len,
-              unsigned char *sigret, unsigned int *siglen, CRYPTO_INFO *key);
-
-#endif // __CRYPTO_H__
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/crypto/hash.c
--- a/tools/vtpm_manager/crypto/hash.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// hash.c
-// 
-//  This file will handle all the TPM Hash functionality
-//
-// ==================================================================
-
-#include <string.h>
-#include <openssl/crypto.h>
-#include <openssl/err.h>
-#include <openssl/evp.h>
-#include <openssl/rand.h>
-#include <openssl/hmac.h>
-#include <openssl/sha.h>
-#include <openssl/bn.h>
-#include <openssl/rsa.h>
-
-#include "tcg.h"         // for TPM_SUCCESS
-#include "crypto.h"
-
-static SHA_CTX g_shaContext;
-
-void Crypto_HMAC(   const BYTE* text, 
-                    int text_len, 
-                    const BYTE* key, 
-                    int key_len, 
-                    BYTE* digest) {
-  if (text == NULL || key == NULL || text_len == 0 || key_len == 0) 
-    return;
-  
-  HMAC(EVP_sha1(), key, key_len, text, text_len, digest, NULL);
-}
-
-TPM_RESULT Crypto_HMAC_buf (const buffer_t * text,
-			    const buffer_t * key,
-			    BYTE * o_digest) { /* presumably of 20 bytes */
-  
-  Crypto_HMAC (text->bytes, text->size, 
-	       key->bytes, key->size,
-	       o_digest);
-  
-  return TPM_SUCCESS;
-}
-
-
-/*
- * SHA1
- * (OUT) Create a SHA1 hash of text. Calls all three SHA1 steps internally
- */
-void Crypto_SHA1Full( const BYTE* text, 
-      uint32_t size, 
-      BYTE* hash) {
-
-  if (text == NULL || size == 0) 
-    return;
-  
-  // Run SHA1Start + SHAUpdate (if necessary) + SHAComplete
-  uint32_t maxBytes; // Not used for anything
-  Crypto_SHA1Start(&maxBytes);
-  
-  while (size > 64){
-    Crypto_SHA1Update(64, text); 
-    size -= 64;
-    text += 64;
-  }
-  
-  Crypto_SHA1Complete(size, text, hash);
-}
-
-// same thing using buffer_t
-TPM_RESULT Crypto_SHA1Full_buf (const buffer_t * buf,
-                                 BYTE * o_digest) {
-
-  if (buf->bytes == NULL || buf->size == 0) 
-    return TPM_BAD_PARAMETER;
-  
-  Crypto_SHA1Full (buf->bytes, buf->size, o_digest);
-  
-  return TPM_SUCCESS;
-}
-
-
-/*
- * Initialize SHA1
- * (OUT) Maximum number of bytes that can be sent to SHA1Update. 
- *   Must be a multiple of 64 bytes.
- */
-void Crypto_SHA1Start(uint32_t* maxNumBytes) {
-  int max = SHA_CBLOCK;
-  // Initialize the crypto library
-  SHA1_Init(&g_shaContext);
-  *maxNumBytes = max;
-}
-
-/*
- * Process SHA1
- * @numBytes: (IN) The number of bytes in hashData. 
- *       Must be a multiple of 64 bytes.
- * @hashData: (IN) Bytes to be hashed.
- */
-void Crypto_SHA1Update(int numBytes, const BYTE* hashData) {
-
-  if (hashData == NULL || numBytes == 0 || numBytes%64 != 0) 
-    return;
-  
-  SHA1_Update(&g_shaContext, hashData, numBytes); 
-}
-
-/*
- * Complete the SHA1 process
- * @hashDataSize: (IN) Number of bytes in hashData.
- *       Must be a multiple of 64 bytes.
- * @hashData: (IN) Final bytes to be hashed.
- * @hashValue: (OUT) The output of the SHA-1 hash.
- */
-void Crypto_SHA1Complete(int hashDataSize, 
-			 const BYTE* hashData, 
-			 BYTE* hashValue) {
-  SHA1_Update(&g_shaContext, hashData, hashDataSize);
-  SHA1_Final(hashValue, &g_shaContext);
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/crypto/rsa.c
--- a/tools/vtpm_manager/crypto/rsa.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,434 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// rsa.c
-// 
-//  This file will handle all the TPM RSA crypto functionality
-// 
-// ==================================================================
-
-#include <string.h>
-#include <openssl/crypto.h>
-#include <openssl/evp.h>
-#include <openssl/bn.h>
-#include <openssl/rsa.h>
-#include <openssl/rand.h>
-#include <openssl/x509.h>
-
-#include <openssl/err.h>
-#include <stdio.h>
-
-#include "tcg.h"
-#include "buffer.h"
-#include "crypto.h"
-#include "log.h"
-
-void Crypto_RSACreateKey(   /*in*/ UINT32 keySize,
-                            /*in*/ UINT32 pubExpSize, 
-                            /*in*/ BYTE *pubExp,
-                            /*out*/ UINT32 *privExpSize, 
-                            /*out*/ BYTE *privExp,
-                            /*out*/ UINT32 *modulusSize,        
-                            /*out*/ BYTE *modulus,
-                            /*out*/ CRYPTO_INFO *keys) {
-  unsigned long e_value;
-  
-  if (pubExpSize == 0) // Default e = 2^16+1
-    e_value = (0x01 << 16) + 1;
-  else {
-    // This is not supported, but the following line MIGHT work
-    // under then assumption that the format is BigNum compatable
-    // Though it's not in the spec, so who knows what it is.
-    // Forcing the default.
-    //BN_bin2bn(pubExp, pubExpSize, NULL);
-    e_value = (0x01 << 16) + 1;
-  }
-
-  RSA *rsa = RSA_generate_key(keySize, e_value, NULL, NULL);
-  
-  if (keys) {
-    keys->keyInfo = rsa;
-    keys->algorithmID = CRYPTO_ALGORITH_RSA;
-  }
-  
-  if (modulus)   *modulusSize   = BN_bn2bin(rsa->n, modulus);
-  if (privExp)   *privExpSize   = BN_bn2bin(rsa->d, privExp);
-}
-
-// Create a CRYPTO_INFO struct from the BYTE * key parts. 
-// If pubExp info is NULL, use TCG default.
-// If there is a remainder while calculating the privExp, return FALSE.
-
-void Crypto_RSABuildCryptoInfo( /*[IN]*/ UINT32 pubExpSize, 
-                                /*[IN]*/ BYTE *pubExp,
-                                /*[IN]*/ UINT32 privExpSize, 
-                                /*[IN]*/ BYTE *privExp,
-                                /*[IN]*/ UINT32 modulusSize, 
-                                /*[IN]*/ BYTE *modulus, 
-                                CRYPTO_INFO* cryptoInfo) {
-  cryptoInfo->keyInfo = RSA_new();
-  RSA *rsa = (RSA *) cryptoInfo->keyInfo;
-  
-  rsa->e = BN_new();
-  
-  if (pubExpSize == 0) { // Default e = 2^16+1
-    BN_set_bit(rsa->e, 16);
-    BN_set_bit(rsa->e, 0);
-  } else {
-    // This is not supported, but the following line MIGHT work
-    // under then assumption that the format is BigNum compatable
-    // Though it's not in the spec, so who knows what it is.
-    // Forcing the default.
-    //BN_bin2bn(pubExp, pubExpSize, NULL);
-    BN_set_bit(rsa->e, 16);
-    BN_set_bit(rsa->e, 0);
-  }
-  
-  rsa->n = BN_bin2bn(modulus, modulusSize, NULL);
-  rsa->d = BN_bin2bn(privExp, privExpSize, NULL);
-}
-
-// Create a CRYPTO_INFO struct from the BYTE * key parts. 
-// If pubExp info is NULL, use TCG default.
-// If there is a remainder while calculating the privExp, return FALSE.
-
-void Crypto_RSABuildCryptoInfoPublic(   /*[IN]*/ UINT32 pubExpSize, 
-                                        /*[IN]*/ BYTE *pubExp,
-                                        /*[IN]*/ UINT32 modulusSize, 
-                                        /*[IN]*/ BYTE *modulus, 
-                                        CRYPTO_INFO* cryptoInfo) {
-  cryptoInfo->keyInfo = RSA_new();
-  RSA *rsa = (RSA *) cryptoInfo->keyInfo;
-  
-  rsa->e = BN_new();
-  
-  if (pubExpSize == 0) { // Default e = 2^16+1
-    BN_set_bit(rsa->e, 16);
-    BN_set_bit(rsa->e, 0);
-  } else {
-    // This is not supported, but the following line MIGHT work
-    // under then assumption that the format is BigNum compatable
-    // Though it's not in the spec, so who knows what it is.
-    // Forcing the default.
-    //BN_bin2bn(pubExp, pubExpSize, NULL);
-    BN_set_bit(rsa->e, 16);
-    BN_set_bit(rsa->e, 0);
-  }
-  
-  rsa->n = BN_bin2bn(modulus, modulusSize, NULL);
-  
-}
-
-int Crypto_RSAEnc(  CRYPTO_INFO *key,
-		    UINT32 inDataSize,
-		    BYTE *inData,
-		    /*out*/ UINT32 *outDataSize,
-		    /*out*/ BYTE *outData) {
-  RSA *rsa = (RSA *) key->keyInfo;
-  UINT32 paddedDataSize = RSA_size (rsa);
-  BYTE *paddedData = (BYTE *)malloc(sizeof(BYTE) * paddedDataSize);
-  int rc;
-    
-  if (paddedData == NULL) 
-    return -1;
-
-  *outDataSize = 0;
-  
-  switch (key->encScheme) {
-  case CRYPTO_ES_RSAESPKCSv15:
-    if (RSA_padding_add_PKCS1_type_2(paddedData, paddedDataSize, inData, inDataSize) <= 0) {
-      rc = -1; 
-      goto abort_egress;
-    }
-    break;
-  case CRYPTO_ES_RSAESOAEP_SHA1_MGF1:
-    if (RSA_padding_add_PKCS1_OAEP(paddedData,paddedDataSize,inData,inDataSize, (BYTE *) OAEP_P,OAEP_P_SIZE) <= 0 ) {
-      rc = -1; 
-      goto abort_egress;
-    }
-    break;
-  default:
-    rc = -1; 
-    goto abort_egress;
-  }
-  
-  rc = RSA_public_encrypt(paddedDataSize, paddedData, outData, rsa, RSA_NO_PADDING);
-  if (rc == -1)
-    goto abort_egress; 
-   
-  *outDataSize = rc;
-  
-  if (rc > 0) rc = 0;
-  
-  goto egress;
-  
- abort_egress:
- egress:
-  
-  if (paddedData) 
-    free (paddedData);
-  return rc;
-  
-}
-
-int Crypto_RSADec(  CRYPTO_INFO *key,
-                    UINT32 inDataSize,
-                    BYTE *inData,
-                    /*out*/ UINT32 *outDataSize,
-                    /*out*/ BYTE *outData) {
-  
-  RSA *rsa = (RSA *) key->keyInfo;
-  UINT32 paddedDataSize = RSA_size (rsa);
-  BYTE *paddedData = (BYTE *)malloc(sizeof(BYTE) * paddedDataSize);
-  int rc;
-  
-  if (paddedData == NULL)
-    goto abort_egress;
-  
-  rc = RSA_private_decrypt(inDataSize, inData, paddedData, rsa, RSA_NO_PADDING);
-  if (rc == -1) {
-    vtpmlogerror(VTPM_LOG_CRYPTO, "RSA_private_decrypt: %s\n", ERR_error_string(ERR_get_error(), NULL));
-    goto abort_egress;
-  }
-  
-  paddedDataSize = rc;
-  
-  switch (key->encScheme) {
-  case CRYPTO_ES_RSAESPKCSv15:
-    rc = RSA_padding_check_PKCS1_type_2 (outData, paddedDataSize,
-					 paddedData + 1, paddedDataSize - 1,
-					 RSA_size(rsa));
-    if (rc == -1) {
-      vtpmlogerror(VTPM_LOG_CRYPTO, "RSA_padding_check_PKCS1_type_2: %s\n", 
-	      ERR_error_string(ERR_get_error(), NULL));
-      goto abort_egress;
-    }
-    *outDataSize = rc;
-    break;
-  case CRYPTO_ES_RSAESOAEP_SHA1_MGF1:
-    rc = RSA_padding_check_PKCS1_OAEP(outData, paddedDataSize,
-				      paddedData + 1, paddedDataSize - 1,
-				      RSA_size(rsa),
-				      (BYTE *) OAEP_P, OAEP_P_SIZE);
-    if (rc == -1) {
-      vtpmlogerror(VTPM_LOG_CRYPTO, "RSA_padding_check_PKCS1_OAEP: %s\n",
-	      ERR_error_string(ERR_get_error(), NULL));
-      goto abort_egress;
-    }
-    *outDataSize = rc;
-    break;
-  default:
-    *outDataSize = 0;
-  }
-  
-  free(paddedData); paddedData = NULL;
-  goto egress;
-  
- abort_egress:
-  
-  if (paddedData) 
-    free (paddedData);
-  return -1;
-  
- egress:
-  return 0;
-}
-
-// Signs either a SHA1 digest of a message or a DER encoding of a message
-// Textual messages MUST be encoded or Hashed before sending into this function
-// It will NOT SHA the message.
-int Crypto_RSASign( CRYPTO_INFO *key,
-                    UINT32 inDataSize,
-                    BYTE *inData,
-                    /*out*/ UINT32 *sigSize,
-                    /*out*/ BYTE *sig) {
-  int status;
-  unsigned int intSigSize;
-  
-  switch(key->sigScheme) {
-  case CRYPTO_SS_RSASSAPKCS1v15_SHA1: 
-    status = RSA_sign(NID_sha1, inData, inDataSize, sig, &intSigSize, (RSA *) key->keyInfo);
-    break;
-  case CRYPTO_SS_RSASSAPKCS1v15_DER:
-    //        status = Crypto_RSA_sign_DER(NID_md5_sha1, inData, inDataSize, sig, &intSigSize, key);
-    vtpmlogerror(VTPM_LOG_CRYPTO, "Crypto: Unimplemented sign type (%d)\n", key->sigScheme);
-    status = 0;
-    break;
-  default:
-    status = 0;
-  }
-  
-  if (status == 0) {
-    *sigSize = 0;
-    vtpmlogerror(VTPM_LOG_CRYPTO, "%s\n", ERR_error_string(ERR_get_error(), NULL));
-    return -1;
-  }
-  
-  *sigSize = (UINT32) intSigSize;
-  return 0;
-}
-
-bool Crypto_RSAVerify(  CRYPTO_INFO *key,
-                        UINT32 inDataSize,
-                        BYTE *inData,
-                        UINT32 sigSize,
-                        BYTE *sig) {
-  int status;
-  
-  switch(key->sigScheme){
-  case CRYPTO_SS_RSASSAPKCS1v15_SHA1: 
-    status = RSA_verify(NID_sha1, inData, inDataSize, sig, sigSize, (RSA *) key->keyInfo);
-    break;
-  case CRYPTO_SS_RSASSAPKCS1v15_DER:
-    //status = Crypto_RSA_verify_DER(NID_md5_sha1, inData, inDataSize, sig, sigSize, key);
-    vtpmlogerror(VTPM_LOG_CRYPTO, "Crypto: Unimplemented sign type (%d)\n", key->sigScheme);
-    status = 0;
-    break;
-  default:
-    status = 0;
-  }
-  
-  if (status) 
-    return(1);
-  else {
-    vtpmlogerror(VTPM_LOG_CRYPTO, "RSA verify: %s\n", ERR_error_string(ERR_get_error(), NULL));
-    return(0);
-  }
-  
-}
-
-// helper which packs everything into a BIO!
-
-// packs the parameters first, then the private key, then the public key
-// if *io_buf is NULL, allocate it here as needed. otherwise its size is in
-// *io_buflen
-TPM_RESULT Crypto_RSAPackCryptoInfo (const CRYPTO_INFO* cryptoInfo,
-                                      BYTE ** io_buf, UINT32 * io_buflen) {
-  TPM_RESULT status = TPM_SUCCESS;
-  BYTE * buf;
-  long len, outlen = *io_buflen;
-  
-  const long PARAMSLEN = 3*sizeof(UINT32);
-  
-  RSA *rsa = (RSA *) cryptoInfo->keyInfo;
-  
-  BIO *mem = BIO_new(BIO_s_mem());
-  
-  
-  // write the openssl keys to the BIO
-  if ( i2d_RSAPrivateKey_bio (mem, rsa) == 0 ) {
-    ERR_print_errors_fp (stderr);
-    ERRORDIE (TPM_SIZE);
-  }
-  if ( i2d_RSAPublicKey_bio (mem, rsa) == 0 ) {
-    ERR_print_errors_fp (stderr);
-    ERRORDIE (TPM_SIZE);
-  }
-  
-  // get the buffer out
-  len = BIO_get_mem_data (mem, &buf);
-  
-  // see if we need to allocate a return buffer
-  if (*io_buf == NULL) {
-    *io_buf = (BYTE*) malloc (PARAMSLEN + len);
-    if (*io_buf == NULL) 
-      ERRORDIE (TPM_SIZE);
-  } else {                      // *io_buf is already allocated
-    if (outlen < len + PARAMSLEN) 
-      ERRORDIE (TPM_SIZE); // but not large enough!  
-  }
-  
-  // copy over the parameters (three UINT32's starting at algorithmID)
-  memcpy (*io_buf, &cryptoInfo->algorithmID, PARAMSLEN);
-  
-  // copy over the DER keys
-  memcpy (*io_buf + PARAMSLEN, buf, len);
-  
-  *io_buflen = len + PARAMSLEN;
-  
-  goto egress;
-  
-  
- abort_egress:
- egress:
-  
-  BIO_free (mem);
-  
-  return status;
-}
-
-
-
-// sets up ci, and returns the number of bytes read in o_lenread
-TPM_RESULT Crypto_RSAUnpackCryptoInfo (CRYPTO_INFO * ci,
-                                        BYTE * in, UINT32 len,
-                                        UINT32 * o_lenread) {
-  
-  TPM_RESULT status = TPM_SUCCESS;
-  long l;
-  BIO *mem;
-  RSA *rsa;
-  
-  // first load up the params
-  l = 3 * sizeof(UINT32);
-  memcpy (&ci->algorithmID, in, l);
-  len -= l;
-  in += l;
-  
-  // and now the openssl keys, private first
-  mem = BIO_new_mem_buf (in, len);
-  
-  if ( (rsa = d2i_RSAPrivateKey_bio (mem, NULL)) == NULL ) {
-    ERR_print_errors_fp (stderr);
-    ERRORDIE (TPM_BAD_PARAMETER);
-  }
-  // now use the same RSA object and fill in the private key
-  if ( d2i_RSAPublicKey_bio (mem, &rsa) == NULL ) {
-    ERR_print_errors_fp (stderr);
-    ERRORDIE (TPM_BAD_PARAMETER);
-  }
-  
-  ci->keyInfo = rsa;          // needs to be freed somehow later
-  
-  // FIXME: havent figured out yet how to tell how many bytes were read in the
-  // above oprations! so o_lenread is not set
-  
-  goto egress;
-  
- abort_egress:
- egress:
-  
-  BIO_free (mem);
- 
-  return status;  
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/crypto/sym_crypto.c
--- a/tools/vtpm_manager/crypto/sym_crypto.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,237 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// sym_crypto.c
-// 
-//     Symmetric crypto portion of crypto 
-// 
-// ==================================================================
-
-#include <openssl/evp.h>
-#include <openssl/rand.h>
-
-#include "tcg.h"
-#include "sym_crypto.h"
-
-typedef enum crypt_op_type_t {
-  CRYPT_ENCRYPT,
-  CRYPT_DECRYPT
-} crypt_op_type_t;
-
-TPM_RESULT ossl_symcrypto_op (symkey_t* key,
-                              const buffer_t* in,
-                              const buffer_t* iv,
-                              buffer_t * out,
-                              crypt_op_type_t optype);
-
-
-// this is initialized in Crypto_Init()
-const EVP_CIPHER * SYM_CIPHER = NULL;
-
-const BYTE ZERO_IV[EVP_MAX_IV_LENGTH] = {0};
-
-
-TPM_RESULT Crypto_symcrypto_initkey (symkey_t * key, const buffer_t* keybits) {
-  TPM_RESULT status = TPM_SUCCESS;
-  
-  EVP_CIPHER_CTX_init (&key->context);
-  
-  key->cipher = SYM_CIPHER;
-  
-  TPMTRYRETURN( buffer_init_copy (&key->key, keybits));
-    
-  goto egress;
-  
- abort_egress:
-  EVP_CIPHER_CTX_cleanup (&key->context);
-  
- egress:
-  
-  return status;
-}
-
-
-
-TPM_RESULT Crypto_symcrypto_genkey (symkey_t * key) {
-  int res;
-  TPM_RESULT status = TPM_SUCCESS;
-  
-  // hmm, EVP_CIPHER_CTX_init does not return a value
-  EVP_CIPHER_CTX_init (&key->context);
-  
-  key->cipher = SYM_CIPHER;
-  
-  TPMTRYRETURN( buffer_init (&key->key, EVP_CIPHER_key_length(key->cipher), NULL)) ;
-  
-  // and generate the key material
-  res = RAND_pseudo_bytes (key->key.bytes, key->key.size);
-  if (res < 0) 
-    ERRORDIE (TPM_SHORTRANDOM);
-  
-  
-  goto egress;
-  
- abort_egress:
-  EVP_CIPHER_CTX_cleanup (&key->context);
-  buffer_free (&key->key);
-  
- egress:
-  return status;  
-}
-
-
-TPM_RESULT Crypto_symcrypto_encrypt (symkey_t* key,
-                              const buffer_t* clear,
-                              buffer_t* o_cipher) {
-  TPM_RESULT status = TPM_SUCCESS;
-  
-  buffer_t iv, cipher_alias;
-  
-  buffer_init_const (&iv, EVP_MAX_IV_LENGTH, ZERO_IV);
-  
-  buffer_init (o_cipher,
-	       clear->size +
-	       EVP_CIPHER_iv_length(key->cipher) +
-	       EVP_CIPHER_block_size (key->cipher),
-				 0);
-  
-  // copy the IV into the front
-  buffer_copy (o_cipher, &iv);
-  
-  // make an alias into which we'll put the ciphertext
-  buffer_init_alias (&cipher_alias, o_cipher, EVP_CIPHER_iv_length(key->cipher), 0);
-  
-  TPMTRYRETURN( ossl_symcrypto_op (key, clear, &iv, &cipher_alias, CRYPT_ENCRYPT) );
-
-  // set the output size correctly
-  o_cipher->size += cipher_alias.size;
-  
-  goto egress;
-  
- abort_egress:
-  
- egress:
-  
-  return status;
-  
-}
-
-
-
-TPM_RESULT Crypto_symcrypto_decrypt (symkey_t* key,
-                              const buffer_t* cipher,
-                              buffer_t* o_clear) {
-  TPM_RESULT status = TPM_SUCCESS;
-  
-  buffer_t iv, cipher_alias;
-  
-  // alias for the IV
-  buffer_init_alias (&iv, cipher, 0, EVP_CIPHER_iv_length(key->cipher));
-  
-  // make an alias to where the ciphertext is, after the IV
-  buffer_init_alias (&cipher_alias, cipher, EVP_CIPHER_iv_length(key->cipher), 0);
-  
-  // prepare the output buffer
-  TPMTRYRETURN( buffer_init (o_clear,
-			cipher->size
-			- EVP_CIPHER_iv_length(key->cipher)
-			+ EVP_CIPHER_block_size(key->cipher), 
-			0) );
-  
-  // and decrypt
-  TPMTRYRETURN ( ossl_symcrypto_op (key, &cipher_alias, &iv, o_clear, CRYPT_DECRYPT) );
-  
-  goto egress;
-  
- abort_egress:
-  buffer_free (o_clear);
-  
- egress:
-  
-  return status;
-}
-
-
-
-TPM_RESULT Crypto_symcrypto_freekey (symkey_t * key) {
-  buffer_memset (&key->key, 0);
-  buffer_free (&key->key);
-  
-  EVP_CIPHER_CTX_cleanup (&key->context);
-  
-  return TPM_SUCCESS;
-}
-
-
-TPM_RESULT ossl_symcrypto_op (symkey_t* key,
-                              const buffer_t* in,
-                              const buffer_t* iv,
-                              buffer_t * out,
-                              crypt_op_type_t optype) {
-  TPM_RESULT status = TPM_SUCCESS;
-  
-  int inlen, outlen;
-  tpm_size_t running;
-  
-  if ( ! EVP_CipherInit_ex (&key->context,
-			    key->cipher, NULL, key->key.bytes, iv->bytes,
-			    optype == CRYPT_ENCRYPT ? 1 : 0) ) 
-    ERRORDIE (TPM_FAIL);
-  
-  
-  
-  inlen = in->size;
-  
-  outlen  = 0;
-  running = 0;
-  
-  
-  if ( ! EVP_CipherUpdate (&key->context, out->bytes, &outlen, in->bytes, inlen) )
-    ERRORDIE (TPM_FAIL);
-
-  running += outlen;
-  
-  if ( ! EVP_CipherFinal_ex (&key->context, out->bytes + running, &outlen) )
-    ERRORDIE (TPM_FAIL);
-  
-  running += outlen;
-  
-  out->size = running;
-  
-  goto egress;
-  
- abort_egress:
- egress:
-  
-  return status;
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/crypto/sym_crypto.h
--- a/tools/vtpm_manager/crypto/sym_crypto.h	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// sym_crypto.h
-// 
-//     Symmetric Crypto 
-// 
-// ==================================================================
-
-#ifndef _SYM_CRYPTO_H
-#define _SYM_CRYPTO_H
-
-#include <openssl/evp.h>
-#include "buffer.h"
-
-typedef struct symkey_t {
-  buffer_t key;
-  
-  EVP_CIPHER_CTX context;
-  const EVP_CIPHER * cipher;
-} symkey_t;
-
-extern const EVP_CIPHER * SYM_CIPHER;
-
-TPM_RESULT Crypto_symcrypto_genkey (symkey_t * key);
-
-TPM_RESULT Crypto_symcrypto_initkey (symkey_t * key, const buffer_t* keybits);
-
-
-// these functions will allocate their output buffers
-TPM_RESULT Crypto_symcrypto_encrypt (symkey_t* key,
-                              const buffer_t* clear,
-                              buffer_t* o_cipher);
-
-TPM_RESULT Crypto_symcrypto_decrypt (symkey_t* key,
-                              const buffer_t* cipher,
-                              buffer_t* o_clear);
-
-// only free the internal parts, not the 'key' ptr
-TPM_RESULT Crypto_symcrypto_freekey (symkey_t * key);
-
-#endif /* _SYM_CRYPTO_H */
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/Makefile
--- a/tools/vtpm_manager/manager/Makefile	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/vtpm_manager/Rules.mk
-
-BIN		= vtpm_managerd
-
-.PHONY: all
-all: build
-
-.PHONY: build
-build: $(BIN)
-
-.PHONY: install
-install: build
-	if [ ! -d "$(DESTDIR)/var/vtpm/fifos" ]; \
-		then mkdir -p $(DESTDIR)/var/vtpm/fifos; \
-	fi
-	if [ ! -d "$(DESTDIR)/var/vtpm/socks" ]; \
-		then mkdir -p $(DESTDIR)/var/vtpm/socks; \
-	fi
-	$(INSTALL_PROG) $(BIN) $(DESTDIR)$(BINDIR)
-
-.PHONY: clean
-clean:
-	rm -f $(BIN)
-	rm -f *.a *.so *.o *.rpm $(DEP_FILES)
-
-.PHONY: mrproper
-mrproper: clean
-	rm -f *~
-
-$(BIN): $(OBJS)
-	$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
-
-# libraries
-LIBS += ../tcs/libTCS.a ../util/libTCGUtils.a ../crypto/libtcpaCrypto.a
-LIBS += -lcrypto $(PTHREAD_LIBS) -lm
-CFLAGS += $(PTHREAD_CFLAGS)
-LDFLAGS += $(PTHREAD_LDFLAGS)
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/dmictl.c
--- a/tools/vtpm_manager/manager/dmictl.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,266 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-//   dmictl.c
-// 
-//     Functions for creating and destroying DMIs
-//
-// ==================================================================
-
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "vtpmpriv.h"
-#include "bsg.h"
-#include "buffer.h"
-#include "log.h"
-#include "hashtable.h"
-#include "hashtable_itr.h"
-#include "vtpm_ipc.h"
-
-#define TPM_EMULATOR_PATH "/usr/bin/vtpmd"
-
-// if dmi_res is non-null, then return a pointer to new object.
-// Also, this does not fill in the measurements. They should be filled by
-// design dependent code or saveNVM
-TPM_RESULT init_dmi(UINT32 dmi_id, BYTE dmi_type, VTPM_DMI_RESOURCE **dmi_res) {
-
-  TPM_RESULT status=TPM_SUCCESS;
-  VTPM_DMI_RESOURCE *new_dmi=NULL;
-  UINT32 *dmi_id_key=NULL;
-
-  if ((new_dmi = (VTPM_DMI_RESOURCE *) malloc (sizeof(VTPM_DMI_RESOURCE))) == NULL) {
-      status = TPM_RESOURCES;
-      goto abort_egress;
-  }
-  memset(new_dmi, 0, sizeof(VTPM_DMI_RESOURCE));
-  new_dmi->dmi_id = dmi_id;
-  new_dmi->dmi_type = dmi_type;
-  new_dmi->connected = FALSE;
-  new_dmi->TCSContext = 0;
-
-  new_dmi->NVMLocation = (char *) malloc(11 + strlen(DMI_NVM_FILE));
-  sprintf(new_dmi->NVMLocation, DMI_NVM_FILE, (uint32_t) new_dmi->dmi_id);
-
-  if ((dmi_id_key = (UINT32 *) malloc (sizeof(UINT32))) == NULL) {
-    status = TPM_RESOURCES;
-    goto abort_egress;
-  }
-  *dmi_id_key = new_dmi->dmi_id;
-
-  // install into map
-  if (!hashtable_insert(vtpm_globals->dmi_map, dmi_id_key, new_dmi)){
-    vtpmlogerror(VTPM_LOG_VTPM, "Failed to insert instance into table. Aborting.\n", dmi_id);
-    status = TPM_FAIL;
-    goto abort_egress;
-  }
-
-  if (dmi_res)
-    *dmi_res = new_dmi;
-
-  goto egress;
-
- abort_egress:
-  if (new_dmi) {
-    free(new_dmi->NVMLocation);
-    free(new_dmi);
-  }
-  free(dmi_id_key);
-
- egress:
-  return status;
-}
-
-TPM_RESULT close_dmi(VTPM_DMI_RESOURCE *dmi_res) {
-  if (dmi_res == NULL) 
-    return TPM_SUCCESS;
-
-  if (dmi_res->dmi_id == VTPM_CTL_DM) 
-    return(TPM_BAD_PARAMETER);
-
-  TCS_CloseContext(dmi_res->TCSContext);
-  dmi_res->connected = FALSE;
-
-  vtpm_globals->connected_dmis--;
-
-  return (VTPM_Close_DMI_Extra(dmi_res) );
-}
-	
-TPM_RESULT VTPM_Handle_New_DMI(const buffer_t *param_buf) {
-  
-  VTPM_DMI_RESOURCE *new_dmi=NULL;
-  TPM_RESULT status=TPM_FAIL;
-  BYTE dmi_type, vm_type, startup_mode;
-  UINT32 dmi_id; 
-
-  if (param_buf == NULL) { // Assume creation of Dom 0 control
-    dmi_type = VTPM_TYPE_NON_MIGRATABLE;
-    dmi_id = VTPM_CTL_DM;
-  } else if (buffer_len(param_buf) != sizeof(BYTE) * 3  + sizeof(UINT32)) {
-    vtpmloginfo(VTPM_LOG_VTPM, "New DMI command wrong length: %d.\n", buffer_len(param_buf));
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  } else {
-    vtpm_globals->connected_dmis++; // Put this here so we don't count Dom0
-    BSG_UnpackList( param_buf->bytes, 4,
-		    BSG_TYPE_BYTE, &dmi_type,
-		    BSG_TYPE_BYTE, &startup_mode,
-		    BSG_TYPE_BYTE, &vm_type,
-		    BSG_TYPE_UINT32,  &dmi_id);
-  }
-
-  if ((dmi_type != VTPM_TYPE_NON_MIGRATABLE) && (dmi_type != VTPM_TYPE_MIGRATABLE)) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Creation of VTPM with illegal type.\n");
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-
-  new_dmi = (VTPM_DMI_RESOURCE *) hashtable_search(vtpm_globals->dmi_map, &dmi_id);
-  if (new_dmi == NULL) { 
-    vtpmloginfo(VTPM_LOG_VTPM, "Creating new DMI instance %d attached.\n", dmi_id );
-    // Brand New DMI. Initialize the persistent pieces
-    TPMTRYRETURN(init_dmi(dmi_id, dmi_type, &new_dmi) );  
-  } else 
-    vtpmloginfo(VTPM_LOG_VTPM, "Re-attaching DMI instance %d.\n", dmi_id);
-
-  if (new_dmi->connected) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Attempt to re-attach, currently attached instance %d. Ignoring\n", dmi_id);
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-  
-  if (new_dmi->dmi_type == VTPM_TYPE_MIGRATED) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Attempt to re-attach previously migrated instance %d without recovering first. Ignoring\n", dmi_id);
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-
-  // Initialize the Non-persistent pieces
-  TPMTRYRETURN( TCS_OpenContext(&new_dmi->TCSContext) );
-  
-  new_dmi->connected = TRUE;  
-
-  // Design specific new DMI code. 
-  // Includes: create IPCs, Measuring DMI, and maybe launching DMI
-  TPMTRYRETURN(VTPM_New_DMI_Extra(new_dmi, vm_type, startup_mode) );
-  goto egress;
-  
- abort_egress:
-  vtpmlogerror(VTPM_LOG_VTPM, "Failed to create DMI id=%d due to status=%s. Cleaning.\n", dmi_id, tpm_get_error_name(status));
-  close_dmi(new_dmi );
-	
- egress:
-  return status;
-}
-
-TPM_RESULT VTPM_Handle_Close_DMI( const buffer_t *param_buf) {
-  
-  TPM_RESULT status=TPM_FAIL;
-  VTPM_DMI_RESOURCE *dmi_res=NULL;
-  UINT32 dmi_id;
-  
-  if ((param_buf == NULL) || (buffer_len(param_buf) != sizeof(UINT32)) ) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Closing DMI has bad size.");
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-  
-  BSG_UnpackList( param_buf->bytes, 1,
-		  BSG_TYPE_UINT32, &dmi_id);
-  
-  vtpmloginfo(VTPM_LOG_VTPM, "Closing DMI %d.\n", dmi_id);
-  
-  dmi_res = (VTPM_DMI_RESOURCE *) hashtable_search(vtpm_globals->dmi_map, &dmi_id);
-  if (dmi_res == NULL ) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Trying to close nonexistent DMI.\n");
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-	
-  if (!dmi_res->connected) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Closing non-connected DMI.\n");
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-  
-  // Close Dmi
-	TPMTRYRETURN(close_dmi( dmi_res ));
-  
-  status=TPM_SUCCESS;    
-  goto egress;
-  
- abort_egress:
- egress:
-  
-  return status;
-}
-
-TPM_RESULT VTPM_Handle_Delete_DMI( const buffer_t *param_buf) {
-  
-  TPM_RESULT status=TPM_FAIL;
-  VTPM_DMI_RESOURCE *dmi_res=NULL;
-  UINT32 dmi_id;
-    
-  if ((param_buf == NULL) || (buffer_len(param_buf) != sizeof(UINT32)) ) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Closing DMI has bad size.\n");
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-  
-  BSG_UnpackList( param_buf->bytes, 1,
-		  BSG_TYPE_UINT32, &dmi_id);
-  
-  vtpmloginfo(VTPM_LOG_VTPM, "Deleting DMI %d.\n", dmi_id);    
-  
-  dmi_res = (VTPM_DMI_RESOURCE *) hashtable_remove(vtpm_globals->dmi_map, &dmi_id);
-  if (dmi_res == NULL) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Closing non-existent DMI.\n");
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-  
-  //vtpm scripts delete file dmi_res->NVMLocation for us
-  
-  // Close DMI first
-  TPMTRYRETURN(close_dmi( dmi_res ));
-  free ( dmi_res );
-	
-  status=TPM_SUCCESS;    
-  goto egress;
-  
- abort_egress:
- egress:
-  
-  return status;
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/migration.c
--- a/tools/vtpm_manager/manager/migration.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,307 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-//   dmictl.c
-// 
-//     Functions for creating and destroying DMIs
-//
-// ==================================================================
-
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "vtpmpriv.h"
-#include "bsg.h"
-#include "buffer.h"
-#include "log.h"
-#include "hashtable.h"
-
-TPM_RESULT VTPM_Handle_Migrate_In( const buffer_t *param_buf,
-                                   buffer_t *result_buf) {
-
-  TPM_RESULT status=TPM_FAIL;
-  VTPM_DMI_RESOURCE *mig_dmi=NULL;
-  UINT32 dmi_id;
-  buffer_t dmi_state_abuf = NULL_BUF, enc_dmi_abuf = NULL_BUF, clear_dmi_blob = NULL_BUF;
-
-  if (param_buf == NULL) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Migration Out Failed due to bad parameter.\n");
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-
-  struct pack_buf_t enc_dmi_state_pack;
-
-  BSG_UnpackList(param_buf->bytes, 2, 
-                 BSG_TYPE_UINT32, &dmi_id,
-                 BSG_TPM_SIZE32_DATA, &enc_dmi_state_pack) ;
-
-  vtpmloginfo(VTPM_LOG_VTPM, "Migrating VTPM in dmi %d.\n", dmi_id);
-
-  mig_dmi = (VTPM_DMI_RESOURCE *) hashtable_search(vtpm_globals->dmi_map, &dmi_id);
-  if (mig_dmi) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Incoming VTPM claims unavailable id: %d.\n", dmi_id);
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }    
-
-  /** UnBind Blob **/
-  TPMTRYRETURN( buffer_init_alias_convert( &enc_dmi_abuf, 
-                                           enc_dmi_state_pack.size, 
-                                           enc_dmi_state_pack.data) );
-
-  TPMTRYRETURN( envelope_decrypt( &enc_dmi_abuf,
-                                   vtpm_globals->manager_tcs_handle,
-                                   vtpm_globals->storageKeyHandle,
-                                   (const TPM_AUTHDATA*)&vtpm_globals->storage_key_usage_auth,
-                                   &clear_dmi_blob) );
-
-  // Create new dmi
-  TPMTRYRETURN( init_dmi(dmi_id, VTPM_TYPE_MIGRATABLE, &mig_dmi ) ); 
-
-  /** Open Blob **/
-  struct pack_buf_t dmi_state_pack;
-
-  BSG_UnpackList(clear_dmi_blob.bytes, 2, 
-                 BSG_TPM_DIGEST, &mig_dmi->DMI_measurement,
-                 BSG_TPM_SIZE32_DATA, &dmi_state_pack);
-
-  TPMTRYRETURN( buffer_init_alias_convert(&dmi_state_abuf, 
-                                          dmi_state_pack.size, 
-                                          dmi_state_pack.data) ); 
-
-  TPMTRYRETURN( VTPM_Handle_Save_NVM(mig_dmi, &dmi_state_abuf, NULL ) );
-
-  status=TPM_SUCCESS;
-  goto egress;
-
- abort_egress:
-    vtpmlogerror(VTPM_LOG_VTPM, "VTPM Migration IN of instance %d failed because of %s.\n", dmi_id, tpm_get_error_name(status) );
-
- egress:
-  buffer_free(&clear_dmi_blob);
-  buffer_free(&dmi_state_abuf);
- 
-  return status;
-}
-
-TPM_RESULT VTPM_Handle_Migrate_Out( const buffer_t *param_buf,
-                                    buffer_t *result_buf) {
-
-  TPM_RESULT status=TPM_FAIL;
-  VTPM_DMI_RESOURCE *mig_dmi;
-  UINT32 dmi_id;
-  VTPM_MIGKEY_LIST *last_mig, *mig_key;
-  buffer_t dmi_state=NULL_BUF, clear_dmi_blob=NULL_BUF;
-
-  if (param_buf == NULL) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Migration Out Failed due to bad parameter.\n");
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-
-  struct pack_buf_t name_pack;
-
-  BSG_UnpackList( param_buf->bytes, 2,
-                  BSG_TYPE_UINT32, &dmi_id,
-                  BSG_TPM_SIZE32_DATA, &name_pack);
-
-  vtpmloginfo(VTPM_LOG_VTPM, "Migrating out dmi %d.\n", dmi_id);
-
-  mig_dmi = (VTPM_DMI_RESOURCE *) hashtable_search(vtpm_globals->dmi_map, &dmi_id);
-  if (mig_dmi == NULL) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Non-existent VTPM instance (%d) in migration.\n", dmi_id );
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-
-  if (mig_dmi->dmi_type != VTPM_TYPE_MIGRATABLE) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Bad VTPM type (%d) in migration of instance (%d).\n", mig_dmi->dmi_type, dmi_id );
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-
-  /** Find migration key for dest **/
-  last_mig = NULL;
-  mig_key = vtpm_globals->mig_keys;
-  while (mig_key != NULL) {
-    if (mig_key->name_size == name_pack.size)
-      if (memcmp(mig_key->name, name_pack.data, name_pack.size) == 0) {
-        break;
-      }
-    
-    last_mig = mig_key;
-    mig_key = mig_key->next;
-  }
-     
-  if (!mig_key) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Unknown Migration target host.\n");
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-
-  /** Mark vtpm as migrated **/
-  mig_dmi->dmi_type = VTPM_TYPE_MIGRATED;
-
-  /** Build Blob **/
-  TPMTRYRETURN( VTPM_Handle_Load_NVM(mig_dmi, NULL, &dmi_state) );
-
-  TPMTRYRETURN( buffer_init(&clear_dmi_blob, sizeof(TPM_DIGEST) + sizeof(UINT32) + buffer_len(&dmi_state), NULL ) ); 
-
-  struct pack_constbuf_t dmi_state_pack;
-
-  dmi_state_pack.size = buffer_len(&dmi_state);
-  dmi_state_pack.data = dmi_state.bytes;
-
-  BSG_PackList(clear_dmi_blob.bytes, 2, 
-               BSG_TPM_DIGEST, &mig_dmi->DMI_measurement,
-               BSG_TPM_SIZE32_DATA, &dmi_state_pack);
-
-  /** Bind Blob **/
-  TPMTRYRETURN( envelope_encrypt( &clear_dmi_blob,
-                                  &mig_key->key,
-                                  result_buf) );
-
-  if (last_mig)
-    last_mig->next = mig_key->next;
-  else 
-    vtpm_globals->mig_keys = mig_key->next;
-  
-  free(mig_key->name);
-  free(mig_key);
-
-  status=TPM_SUCCESS;
-  goto egress;
-
- abort_egress:
-    vtpmlogerror(VTPM_LOG_VTPM, "VTPM Migration OUT of instance %d failed because of %s. Migratoin recovery may be needed.\n", dmi_id, tpm_get_error_name(status) );
-
-    //TODO: Create and implement a policy for what happens to mig_key on failed migrations.
-
- egress:
-
-  buffer_free(&clear_dmi_blob);
-  buffer_free(&dmi_state);
-
-  return status;
-}
-
-
-TPM_RESULT VTPM_Handle_Get_Migration_key( const buffer_t *param_buf,
-                                          buffer_t *result_buf) {
-
-  TPM_RESULT status=TPM_FAIL;
-
-  vtpmloginfo(VTPM_LOG_VTPM, "Getting Migration Public Key.\n");
-
-  struct pack_buf_t pubkey_exp_pack, pubkey_mod_pack;
-  TPM_KEY mig_key;
-
-  // Unpack/return key structure
-  BSG_Unpack(BSG_TPM_KEY, vtpm_globals->storageKeyWrap.bytes , &mig_key);
-  TPM_RSA_KEY_PARMS rsaKeyParms;
-
-  BSG_Unpack(BSG_TPM_RSA_KEY_PARMS,
-               mig_key.algorithmParms.parms,
-               &rsaKeyParms);
-
-  pubkey_exp_pack.size = rsaKeyParms.exponentSize;
-  pubkey_exp_pack.data = rsaKeyParms.exponent;
-  pubkey_mod_pack.size = mig_key.pubKey.keyLength;
-  pubkey_mod_pack.data = mig_key.pubKey.key;
-
-  TPMTRYRETURN( buffer_init( result_buf, 2*sizeof(UINT32) + 
-                                         pubkey_exp_pack.size + 
-                                         pubkey_mod_pack.size, NULL ) );
-
-  BSG_PackList( result_buf->bytes, 2,
-                  BSG_TPM_SIZE32_DATA, &pubkey_exp_pack,
-                  BSG_TPM_SIZE32_DATA, &pubkey_mod_pack);
-
-
-  status=TPM_SUCCESS;
-  goto egress;
-
- abort_egress:
-    vtpmlogerror(VTPM_LOG_VTPM, "VTPM Get Migration Key failed because of %s.\n", tpm_get_error_name(status) );
- egress:
-
-  return status;
-}
-
-TPM_RESULT VTPM_Handle_Load_Migration_key( const buffer_t *param_buf,
-                                           buffer_t *result_buf) {
-
-  TPM_RESULT status=TPM_FAIL;
-  VTPM_MIGKEY_LIST *mig_key;
-
-  vtpmloginfo(VTPM_LOG_VTPM, "Loading Migration Public Key.\n");
-
-  //FIXME: Review all uses of unpacking pack_buf_t and ensure free.
-  //FIXME: Review all declarations/initializations of buffer_t that could have a goto that skips them and then tries to free them
-
-  struct pack_buf_t name_pack, pubkey_exp_pack, pubkey_mod_pack;
-
-  //FIXME: scan list and verify name is not already in the list
-
-  BSG_UnpackList( param_buf->bytes, 3,
-                  BSG_TPM_SIZE32_DATA, &name_pack,
-                  BSG_TPM_SIZE32_DATA, &pubkey_exp_pack,
-                  BSG_TPM_SIZE32_DATA, &pubkey_mod_pack);
-
-  //TODO: Maintain a persistent list for pub_keys.
-  //TODO: Verify pub_key is trusted
-
-  mig_key = (VTPM_MIGKEY_LIST *) malloc(sizeof(VTPM_MIGKEY_LIST));
-  memset(mig_key, 0, sizeof(VTPM_MIGKEY_LIST) );
-  mig_key->name_size = name_pack.size;
-  mig_key->name = name_pack.data;
-
-  mig_key->key.encScheme = CRYPTO_ES_RSAESOAEP_SHA1_MGF1;
-  Crypto_RSABuildCryptoInfoPublic( pubkey_exp_pack.size,
-                                   pubkey_exp_pack.data,
-                                   pubkey_mod_pack.size,
-                                   pubkey_mod_pack.data,
-                                   &mig_key->key);
-
-
-  mig_key->next = vtpm_globals->mig_keys;
-  vtpm_globals->mig_keys = mig_key;
-
-  // free(name_pack.data); Do not free. data is now part of mig_key.
-  free(pubkey_exp_pack.data);
-  free(pubkey_mod_pack.data);
-
-  return TPM_SUCCESS;
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/securestorage.c
--- a/tools/vtpm_manager/manager/securestorage.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,512 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// securestorage.c
-// 
-//  Functions regarding securely storing DMI secrets.
-//
-// ==================================================================
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "tcg.h"
-#include "vtpm_manager.h"
-#include "vtpmpriv.h"
-#include "vtsp.h"
-#include "bsg.h"
-#include "crypto.h"
-#include "hashtable.h"
-#include "hashtable_itr.h"
-#include "buffer.h"
-#include "log.h"
-
-TPM_RESULT envelope_encrypt(const buffer_t     *inbuf,
-                            CRYPTO_INFO        *asymkey,
-                            buffer_t           *sealed_data) {
-  TPM_RESULT status = TPM_SUCCESS;
-  symkey_t    symkey;
-  buffer_t    data_cipher = NULL_BUF,
-              symkey_cipher = NULL_BUF;
-  
-  UINT32 i;
-  struct pack_constbuf_t symkey_cipher32, data_cipher32;
-  
-  vtpmloginfo(VTPM_LOG_VTPM_DEEP, "Enveloping Input[%d]: 0x", buffer_len(inbuf));
-  for (i=0; i< buffer_len(inbuf); i++)
-    vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", inbuf->bytes[i]);
-  vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-  
-  // Generate a sym key and encrypt state with it
-  TPMTRY(TPM_ENCRYPT_ERROR, Crypto_symcrypto_genkey (&symkey) );
-  TPMTRY(TPM_ENCRYPT_ERROR, Crypto_symcrypto_encrypt (&symkey, inbuf, &data_cipher) );
-  
-  // Encrypt symmetric key
-  TPMTRYRETURN( VTSP_Bind(    asymkey, 
-			      &symkey.key, 
-			      &symkey_cipher) );
-  
-  // Create output blob: symkey_size + symkey_cipher + state_cipher_size + state_cipher
-  
-  symkey_cipher32.size = buffer_len(&symkey_cipher);
-  symkey_cipher32.data = symkey_cipher.bytes;
-  
-  data_cipher32.size = buffer_len(&data_cipher);
-  data_cipher32.data = data_cipher.bytes;
-  
-  TPMTRYRETURN( buffer_init(sealed_data, 2 * sizeof(UINT32) + symkey_cipher32.size + data_cipher32.size, NULL));
-  
-  BSG_PackList(sealed_data->bytes, 2,
-	       BSG_TPM_SIZE32_DATA, &symkey_cipher32,
-	       BSG_TPM_SIZE32_DATA, &data_cipher32);
-
-  vtpmloginfo(VTPM_LOG_VTPM, "Saved %d bytes of E(symkey) + %d bytes of E(data)\n", buffer_len(&symkey_cipher), buffer_len(&data_cipher));
-
-  vtpmloginfo(VTPM_LOG_VTPM_DEEP, "Enveloping Output[%d]: 0x", buffer_len(sealed_data));
-  for (i=0; i< buffer_len(sealed_data); i++)
-    vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", sealed_data->bytes[i]);
-  vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-
-  goto egress;
-
- abort_egress:
-  vtpmlogerror(VTPM_LOG_VTPM, "Failed to envelope encrypt\n.");
-  
- egress:
-  
-  buffer_free ( &data_cipher);
-  buffer_free ( &symkey_cipher);
-  Crypto_symcrypto_freekey (&symkey);
-  
-  return status;
-}
-
-TPM_RESULT envelope_decrypt(const buffer_t     *cipher,
-                            TCS_CONTEXT_HANDLE TCSContext,
-			    TPM_HANDLE         keyHandle,
-			    const TPM_AUTHDATA *key_usage_auth,
-                            buffer_t           *unsealed_data) {
-
-  TPM_RESULT status = TPM_SUCCESS;
-  symkey_t    symkey;
-  buffer_t    data_cipher = NULL_BUF, 
-              symkey_clear = NULL_BUF, 
-              symkey_cipher = NULL_BUF;
-  struct pack_buf_t symkey_cipher32, data_cipher32;
-  int i;
-
-  memset(&symkey, 0, sizeof(symkey_t));
-
-  vtpmloginfo(VTPM_LOG_VTPM_DEEP, "Envelope Decrypt Input[%d]: 0x", buffer_len(cipher) );
-  for (i=0; i< buffer_len(cipher); i++)
-    vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", cipher->bytes[i]);
-  vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-  
-  BSG_UnpackList(cipher->bytes, 2,
-		 BSG_TPM_SIZE32_DATA, &symkey_cipher32,
-		 BSG_TPM_SIZE32_DATA, &data_cipher32);
-  
-  TPMTRYRETURN( buffer_init_alias_convert (&symkey_cipher, 
-				           symkey_cipher32.size, 
-				           symkey_cipher32.data) );
-  
-  TPMTRYRETURN( buffer_init_alias_convert (&data_cipher, 
-				           data_cipher32.size, 
-				           data_cipher32.data) );
-
-  // Decrypt Symmetric Key
-  TPMTRYRETURN( VTSP_Unbind(  TCSContext,
-			      keyHandle,
-			      &symkey_cipher,
-			      key_usage_auth,
-			      &symkey_clear,
-			      &(vtpm_globals->keyAuth) ) );
-  
-  // create symmetric key using saved bits
-  Crypto_symcrypto_initkey (&symkey, &symkey_clear);
-  
-  // Decrypt State
-  TPMTRY(TPM_DECRYPT_ERROR, Crypto_symcrypto_decrypt (&symkey, &data_cipher, unsealed_data) );
-
-  vtpmloginfo(VTPM_LOG_VTPM_DEEP, "Envelope Decrypte Output[%d]: 0x", buffer_len(unsealed_data));
-  for (i=0; i< buffer_len(unsealed_data); i++)
-    vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", unsealed_data->bytes[i]);
-  vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-  
-  goto egress;
-  
- abort_egress:
-  vtpmlogerror(VTPM_LOG_VTPM, "Failed to envelope decrypt data\n.");
-  
- egress:
-  buffer_free ( &data_cipher);
-  buffer_free ( &symkey_clear);
-  buffer_free ( &symkey_cipher);
-  Crypto_symcrypto_freekey (&symkey);
-  
-  return status;
-}
-
-TPM_RESULT VTPM_Handle_Save_NVM(VTPM_DMI_RESOURCE *myDMI, 
-				const buffer_t *inbuf, 
-				buffer_t *outbuf) {
-  
-  TPM_RESULT status = TPM_SUCCESS;
-  int fh;
-  long bytes_written;
-  buffer_t sealed_NVM = NULL_BUF;
-  
-  vtpmloginfo(VTPM_LOG_VTPM_DEEP, "Saving %d bytes of NVM.\n", buffer_len(inbuf));
-
-  TPMTRYRETURN( envelope_encrypt(inbuf,
-                                 &vtpm_globals->storageKey,
-                                 &sealed_NVM) );
-				  
-  // Write sealed blob off disk from NVMLocation
-  // TODO: How to properly return from these. Do we care if we return failure
-  //       after writing the file? We can't get the old one back.
-  // TODO: Backup old file and try and recover that way.
-  fh = open(myDMI->NVMLocation, O_WRONLY | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE);
-  if ( (bytes_written = write(fh, sealed_NVM.bytes, buffer_len(&sealed_NVM) ) != (long) buffer_len(&sealed_NVM))) {
-    vtpmlogerror(VTPM_LOG_VTPM, "We just overwrote a DMI_NVM and failed to finish. %ld/%ld bytes.\n", bytes_written, (long)buffer_len(&sealed_NVM));
-    status = TPM_IOERROR;
-    goto abort_egress;
-  }
-  close(fh);
-  
-  Crypto_SHA1Full (sealed_NVM.bytes, buffer_len(&sealed_NVM), (BYTE *) &myDMI->NVM_measurement);   
-  
-  goto egress;
-  
- abort_egress:
-  vtpmlogerror(VTPM_LOG_VTPM, "Failed to save NVM\n.");
-  
- egress:
-  buffer_free(&sealed_NVM);
-  return status;
-}
-
-
-/* Expected Params: inbuf = null, outbuf = sealed blob size, sealed blob.*/
-TPM_RESULT VTPM_Handle_Load_NVM(VTPM_DMI_RESOURCE *myDMI, 
-				const buffer_t    *inbuf, 
-				buffer_t          *outbuf) {
-  
-  TPM_RESULT status = TPM_SUCCESS;
-
-  buffer_t sealed_NVM = NULL_BUF;
-  long fh_size;
-  int fh, stat_ret, i;
-  struct stat file_stat;
-  TPM_DIGEST sealedNVMHash;
-   
-  if (myDMI->NVMLocation == NULL) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Unable to load NVM because the file name NULL.\n");
-    status = TPM_AUTHFAIL;
-    goto abort_egress;
-  }
-  
-  //Read sealed blob off disk from NVMLocation
-  fh = open(myDMI->NVMLocation, O_RDONLY);
-  stat_ret = fstat(fh, &file_stat);
-  if (stat_ret == 0) 
-    fh_size = file_stat.st_size;
-  else {
-    status = TPM_IOERROR;
-    goto abort_egress;
-  }
-  
-  TPMTRYRETURN( buffer_init( &sealed_NVM, fh_size, NULL) );
-  if (read(fh, sealed_NVM.bytes, buffer_len(&sealed_NVM)) != fh_size) {
-    status = TPM_IOERROR;
-    goto abort_egress;
-  }
-  close(fh);
-  
-  vtpmloginfo(VTPM_LOG_VTPM_DEEP, "Load_NVMing[%d],\n", buffer_len(&sealed_NVM));
-  
-  Crypto_SHA1Full(sealed_NVM.bytes, buffer_len(&sealed_NVM), (BYTE *) &sealedNVMHash);    
-  
-  // Verify measurement of sealed blob.
-  if (memcmp(&sealedNVMHash, &myDMI->NVM_measurement, sizeof(TPM_DIGEST)) ) {
-    vtpmlogerror(VTPM_LOG_VTPM, "VTPM LoadNVM NVM measurement check failed.\n");
-    vtpmloginfo(VTPM_LOG_VTPM_DEEP, "Correct hash: ");
-    for (i=0; i< sizeof(TPM_DIGEST); i++)
-      vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", ((BYTE*)&myDMI->NVM_measurement)[i]);
-    vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-
-    vtpmloginfo(VTPM_LOG_VTPM_DEEP, "Measured hash: ");
-    for (i=0; i< sizeof(TPM_DIGEST); i++)
-      vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", ((BYTE*)&sealedNVMHash)[i]);
-    vtpmloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-    
-    status = TPM_AUTHFAIL;
-    goto abort_egress;
-  }
-  
-  TPMTRYRETURN( envelope_decrypt(&sealed_NVM,
-                                 myDMI->TCSContext,
-		        	 vtpm_globals->storageKeyHandle,
-			         (const TPM_AUTHDATA*)&vtpm_globals->storage_key_usage_auth,
-                                 outbuf) );  
-  goto egress;
-  
- abort_egress:
-  vtpmlogerror(VTPM_LOG_VTPM, "Failed to load NVM\n.");
-  
- egress:
-  buffer_free( &sealed_NVM );
-  
-  return status;
-}
-
-
-TPM_RESULT VTPM_SaveManagerData(void) {
-  TPM_RESULT status=TPM_SUCCESS;
-  int fh, dmis=-1;
-
-  BYTE *flat_boot_key=NULL, *flat_dmis=NULL, *flat_enc=NULL;
-  buffer_t clear_flat_global=NULL_BUF, enc_flat_global=NULL_BUF;
-  UINT32 storageKeySize = buffer_len(&vtpm_globals->storageKeyWrap);
-  UINT32 bootKeySize = buffer_len(&vtpm_globals->bootKeyWrap);
-  struct pack_buf_t storage_key_pack = {storageKeySize, vtpm_globals->storageKeyWrap.bytes};
-  struct pack_buf_t boot_key_pack = {bootKeySize, vtpm_globals->bootKeyWrap.bytes};
-  BYTE vtpm_manager_gen = VTPM_MANAGER_GEN;
-
-  struct hashtable_itr *dmi_itr;
-  VTPM_DMI_RESOURCE *dmi_res;
-
-  UINT32 boot_key_size = 0, flat_dmis_size = 0;
-
-  // Initially fill these with buffer sizes for each data type. Later fill
-  // in actual size, once flattened.
-  boot_key_size =  sizeof(UINT32) +       // bootkeysize
-                   bootKeySize;           // boot key
-
-  TPMTRYRETURN(buffer_init(&clear_flat_global,sizeof(BYTE) + // manager version
-                                              3*sizeof(TPM_DIGEST) + // Auths
-                                              sizeof(UINT32) +// storagekeysize
-                                              storageKeySize, NULL) ); // storage key
-
-
-  flat_boot_key = (BYTE *) malloc( boot_key_size );
-  flat_enc = (BYTE *) malloc( sizeof(UINT32) );
-
-  boot_key_size = BSG_PackList(flat_boot_key, 1,
-                               BSG_TPM_SIZE32_DATA, &boot_key_pack);
-
-  BSG_PackList(clear_flat_global.bytes, 4,
-                BSG_TYPE_BYTE,    &vtpm_manager_gen,
-                BSG_TPM_AUTHDATA, &vtpm_globals->owner_usage_auth,
-                BSG_TPM_SECRET,   &vtpm_globals->storage_key_usage_auth,
-                BSG_TPM_SIZE32_DATA, &storage_key_pack);
-
-  TPMTRYRETURN(envelope_encrypt(&clear_flat_global,
-                                &vtpm_globals->bootKey,
-                                &enc_flat_global) );
-
-  BSG_PackConst(buffer_len(&enc_flat_global), 4, flat_enc);
-
-  // Per DMI values to be saved (if any exit)
-  if (hashtable_count(vtpm_globals->dmi_map) > 1) {
-
-    flat_dmis = (BYTE *) malloc( 
-                     (hashtable_count(vtpm_globals->dmi_map) - 1) * // num DMIS (-1 for Dom0)
-                     (sizeof(UINT32) +sizeof(BYTE) + 2*sizeof(TPM_DIGEST)) ); // Per DMI info
-
-    dmi_itr = hashtable_iterator(vtpm_globals->dmi_map);
-    do {
-      dmi_res = (VTPM_DMI_RESOURCE *) hashtable_iterator_value(dmi_itr);
-      dmis++;
-
-      // No need to save dmi0.
-      if (dmi_res->dmi_id == 0)
-        continue;
-
-
-      flat_dmis_size += BSG_PackList( flat_dmis + flat_dmis_size, 4,
-                                        BSG_TYPE_UINT32, &dmi_res->dmi_id,
-                                        BSG_TYPE_BYTE, &dmi_res->dmi_type,
-                                        BSG_TPM_DIGEST, &dmi_res->NVM_measurement,
-                                        BSG_TPM_DIGEST, &dmi_res->DMI_measurement);
-
-    } while (hashtable_iterator_advance(dmi_itr));
-  }
-
-  fh = open(STATE_FILE, O_WRONLY | O_CREAT, S_IREAD | S_IWRITE);
-  if (fh == -1) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Unable to open %s file for write.\n", STATE_FILE);
-    status = TPM_IOERROR;
-    goto abort_egress;
-  }
-
-  if ( ( write(fh, flat_boot_key, boot_key_size) != boot_key_size ) ||
-       ( write(fh, flat_enc, sizeof(UINT32)) != sizeof(UINT32) ) ||
-       ( write(fh, enc_flat_global.bytes, buffer_len(&enc_flat_global)) != buffer_len(&enc_flat_global) ) ||
-       ( write(fh, flat_dmis, flat_dmis_size) != flat_dmis_size ) ) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Failed to completely write service data.\n");
-    status = TPM_IOERROR;
-    goto abort_egress;
- }
-
-  goto egress;
-
- abort_egress:
- egress:
-
-  free(flat_boot_key);
-  free(flat_enc);
-  buffer_free(&enc_flat_global);
-  free(flat_dmis);
-  close(fh);
-
-  vtpmloginfo(VTPM_LOG_VTPM, "Saved VTPM Manager state (status = %d, dmis = %d)\n", (int) status, dmis);
-  return status;
-}
-
-TPM_RESULT VTPM_LoadManagerData(void) {
-
-  TPM_RESULT status=TPM_SUCCESS;
-  int fh, stat_ret, dmis=0;
-  long fh_size = 0, step_size;
-  BYTE *flat_table=NULL;
-  buffer_t  unsealed_data, enc_table_abuf;
-  struct pack_buf_t storage_key_pack, boot_key_pack;
-  UINT32 *dmi_id_key, enc_size;
-  BYTE vtpm_manager_gen;
-
-  VTPM_DMI_RESOURCE *dmi_res;
-  UINT32 dmi_id;
-  BYTE dmi_type;
-  struct stat file_stat;
-
-  TPM_HANDLE boot_key_handle;
-  TPM_AUTHDATA boot_usage_auth;
-  memset(&boot_usage_auth, 0, sizeof(TPM_AUTHDATA));
-
-  fh = open(STATE_FILE, O_RDONLY );
-  stat_ret = fstat(fh, &file_stat);
-  if (stat_ret == 0)
-    fh_size = file_stat.st_size;
-  else {
-    status = TPM_IOERROR;
-    goto abort_egress;
-  }
-
-  flat_table = (BYTE *) malloc(fh_size);
-
-  if ((long) read(fh, flat_table, fh_size) != fh_size ) {
-    status = TPM_IOERROR;
-    goto abort_egress;
-  }
-
-  // Read Boot Key
-  step_size = BSG_UnpackList( flat_table, 2,
-                              BSG_TPM_SIZE32_DATA, &boot_key_pack,
-                              BSG_TYPE_UINT32, &enc_size);
-
-  TPMTRYRETURN(buffer_init(&vtpm_globals->bootKeyWrap, 0, 0) );
-  TPMTRYRETURN(buffer_init_alias_convert(&enc_table_abuf, enc_size, flat_table + step_size) );
-  TPMTRYRETURN(buffer_append_raw(&vtpm_globals->bootKeyWrap, boot_key_pack.size, boot_key_pack.data) );
-
-  //Load Boot Key
-  TPMTRYRETURN( VTSP_LoadKey( vtpm_globals->manager_tcs_handle,
-                              TPM_SRK_KEYHANDLE,
-                              &vtpm_globals->bootKeyWrap,
-                              &SRK_AUTH,
-                              &boot_key_handle,
-                              &vtpm_globals->keyAuth,
-                              &vtpm_globals->bootKey,
-                              FALSE) );
-
-  TPMTRYRETURN( envelope_decrypt(&enc_table_abuf,
-                                 vtpm_globals->manager_tcs_handle,
-                                 boot_key_handle,
-                                 (const TPM_AUTHDATA*) &boot_usage_auth,
-                                 &unsealed_data) );
-  step_size += enc_size;
-
-  if (*unsealed_data.bytes != VTPM_MANAGER_GEN) {
-      // Once there is more than one gen, this will include some compatability stuff
-      vtpmlogerror(VTPM_LOG_VTPM, "Warning: Manager Data file is gen %d, which this manager is gen %d.\n", vtpm_manager_gen, VTPM_MANAGER_GEN);
-  }
-
-  // Global Values needing to be saved
-  BSG_UnpackList( unsealed_data.bytes, 4,
-                  BSG_TYPE_BYTE,    &vtpm_manager_gen, 
-                  BSG_TPM_AUTHDATA, &vtpm_globals->owner_usage_auth,
-                  BSG_TPM_SECRET,   &vtpm_globals->storage_key_usage_auth,
-                  BSG_TPM_SIZE32_DATA, &storage_key_pack);
-
-  TPMTRYRETURN(buffer_init(&vtpm_globals->storageKeyWrap, 0, 0) );
-  TPMTRYRETURN(buffer_append_raw(&vtpm_globals->storageKeyWrap, storage_key_pack.size, storage_key_pack.data) );
-
-  // Per DMI values to be saved
-  while ( step_size < fh_size ){
-    if (fh_size - step_size < (long) (sizeof(UINT32) + sizeof(BYTE) + 2*sizeof(TPM_DIGEST))) {
-      vtpmlogerror(VTPM_LOG_VTPM, "Encountered %ld extra bytes at end of manager state.\n", fh_size-step_size);
-      step_size = fh_size;
-    } else {
-      step_size += BSG_UnpackList(flat_table + step_size, 2,
-                                 BSG_TYPE_UINT32, &dmi_id,
-                                 BSG_TYPE_BYTE, &dmi_type);
-
-      //TODO: Try and gracefully recover from problems.
-      TPMTRYRETURN(init_dmi(dmi_id, dmi_type, &dmi_res) );
-      dmis++;
-
-      step_size += BSG_UnpackList(flat_table + step_size, 2,
-                                 BSG_TPM_DIGEST, &dmi_res->NVM_measurement,
-                                 BSG_TPM_DIGEST, &dmi_res->DMI_measurement);
-    }
-
-  }
-
-  vtpmloginfo(VTPM_LOG_VTPM, "Loaded saved state (dmis = %d).\n", dmis);
-  goto egress;
-
- abort_egress:
-  vtpmlogerror(VTPM_LOG_VTPM, "Failed to load service data with error = %s\n", tpm_get_error_name(status));
- egress:
-
-  free(flat_table);
-  close(fh);
-
-  // TODO: Could be nice and evict BootKey. (Need to add EvictKey to VTSP.
-
-  return status;
-}
-
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/tpmpassthrough.c
--- a/tools/vtpm_manager/manager/tpmpassthrough.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// tpmpassthrough.c
-// 
-//  Functions regarding passing DMI requests to HWTPM
-//
-// ==================================================================
-
-#include "tcg.h"
-#include "vtpm_manager.h"
-#include "vtpmpriv.h"
-#include "vtsp.h"
-#include "log.h"
-
-TPM_RESULT VTPM_Handle_TPM_Command( VTPM_DMI_RESOURCE *dmi,
-				    buffer_t *inbuf,  
-				    buffer_t *outbuf) {
-  
-  TPM_RESULT status = TPM_SUCCESS;
-  TPM_COMMAND_CODE *ord;               
-  
-  ord = (TPM_COMMAND_CODE *) (inbuf->bytes + sizeof(TPM_TAG) + sizeof(UINT32));
-  
-  switch (*ord) {
-    
-    // Forbidden for DMI use
-  case TPM_ORD_TakeOwnership:
-  case TPM_ORD_ChangeAuthOwner:
-  case TPM_ORD_DirWriteAuth:
-  case TPM_ORD_DirRead:
-  case TPM_ORD_AuthorizeMigrationKey:
-  case TPM_ORD_CreateMaintenanceArchive:
-  case TPM_ORD_LoadMaintenanceArchive:
-  case TPM_ORD_KillMaintenanceFeature:
-  case TPM_ORD_LoadManuMaintPub:
-  case TPM_ORD_ReadManuMaintPub:
-  case TPM_ORD_SelfTestFull:
-  case TPM_ORD_SelfTestStartup:
-  case TPM_ORD_CertifySelfTest:
-  case TPM_ORD_ContinueSelfTest:
-  case TPM_ORD_GetTestResult:
-  case TPM_ORD_Reset:
-  case TPM_ORD_OwnerClear:
-  case TPM_ORD_DisableOwnerClear:
-  case TPM_ORD_ForceClear:
-  case TPM_ORD_DisableForceClear:
-  case TPM_ORD_GetCapabilityOwner:
-  case TPM_ORD_OwnerSetDisable:
-  case TPM_ORD_PhysicalEnable:
-  case TPM_ORD_PhysicalDisable:
-  case TPM_ORD_SetOwnerInstall:
-  case TPM_ORD_PhysicalSetDeactivated:
-  case TPM_ORD_SetTempDeactivated:
-  case TPM_ORD_CreateEndorsementKeyPair:
-  case TPM_ORD_GetAuditEvent:
-  case TPM_ORD_GetAuditEventSigned:
-  case TPM_ORD_GetOrdinalAuditStatus:
-  case TPM_ORD_SetOrdinalAuditStatus:
-  case TPM_ORD_SetRedirection:
-  case TPM_ORD_FieldUpgrade:
-  case TSC_ORD_PhysicalPresence:
-    status = TPM_DISABLED_CMD;
-    goto abort_egress;
-    break;
-    
-  } // End ORD Switch
-  
-  // Call TCS with command
-  
-  TPMTRY(TPM_IOERROR, VTSP_RawTransmit( dmi->TCSContext,inbuf, outbuf) );
-  
-  goto egress;
-  
- abort_egress:
-  vtpmloginfo(VTPM_LOG_VTPM, "TPM Command Failed in tpmpassthrough.\n");
- egress:
-  
-  return status;
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/vtpm_ipc.c
--- a/tools/vtpm_manager/manager/vtpm_ipc.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-//
-// vtpm_ipc.c Implements ipc routines using file io. This file can
-// be replaced with other ipc types.
-//
-// ===================================================================
-
-#include <sys/stat.h>
-#include "vtpm_ipc.h"
-#include "vtpmpriv.h"
-#include "log.h"
-
-int vtpm_ipc_init(vtpm_ipc_handle_t *ipc_h, char* name, int flags, BOOL create) {
-  ipc_h->name = name;
-  ipc_h->flags = flags;
-  ipc_h->fh = VTPM_IPC_CLOSED;
-
-  if (create)
-    return(vtpm_ipc_create(ipc_h));
-  else
-    return 0;
-}
-
-// Create the file that needs opening. Used only for FIFOs
-// FYI: This may cause problems in other file IO schemes. We'll see.
-int vtpm_ipc_create(vtpm_ipc_handle_t *ipc_h) {
-  int fh;
-  struct stat file_info;
-
-  if ((!ipc_h) || (!ipc_h->name))
-    return -1;
-
-  if ( stat(ipc_h->name, &file_info) == -1) {
-    if ( mkfifo(ipc_h->name, S_IWUSR | S_IRUSR ) ) {
-      vtpmlogerror(VTPM_LOG_VTPM, "Failed to create fifo %s.\n", ipc_h->name);
-      return -1;
-    }
-  }
-
-  ipc_h->fh = VTPM_IPC_CLOSED;
-
-  return 0;
-}
-
-
-// Read size bytes. If FH isn't open, open it.
-int vtpm_ipc_read(vtpm_ipc_handle_t *ipc_h, vtpm_ipc_handle_t *alt_ipc_h, BYTE *bytes, UINT32 size){
-  vtpm_ipc_handle_t *my_ipc_h;
-  int result;
-  
-  if (ipc_h) {
-    my_ipc_h = ipc_h;
-  } else {
-    my_ipc_h = alt_ipc_h;
-  }
-  
-  if (my_ipc_h->fh == VTPM_IPC_CLOSED) {   
-    my_ipc_h->fh = open(my_ipc_h->name, my_ipc_h->flags);
-  }
-
-  if ( my_ipc_h->fh == VTPM_IPC_CLOSED ) {
-    vtpmlogerror(VTPM_LOG_VTPM, "VTPM ERROR: Can't open %s for reading.\n", my_ipc_h->name);
-    return -1;
-  }
-
-  result = read(my_ipc_h->fh, bytes, size);
-  if (result < 0) {
-    my_ipc_h->fh = VTPM_IPC_CLOSED;
-  }
-
-  return (result);
-}
-
-// Write size bytes. If FH isn't open, open it.
-int vtpm_ipc_write(vtpm_ipc_handle_t *ipc_h, vtpm_ipc_handle_t *alt_ipc_h, BYTE *bytes, UINT32 size) {
-  vtpm_ipc_handle_t *my_ipc_h;
-  int result;
-
-  if (ipc_h) {
-    my_ipc_h = ipc_h;
-  } else {
-    my_ipc_h = alt_ipc_h;
-  }
-
-  if (my_ipc_h->fh == VTPM_IPC_CLOSED) {
-    my_ipc_h->fh = open(my_ipc_h->name, my_ipc_h->flags);
-  }
-
-  if ( my_ipc_h->fh == VTPM_IPC_CLOSED ) {
-    vtpmlogerror(VTPM_LOG_VTPM, "VTPM ERROR: Can't open %s for writing.\n", my_ipc_h->name);
-    return -1;
-  }
-
-  result = write(my_ipc_h->fh, bytes, size);
-  if (result < 0) {
-    my_ipc_h->fh = VTPM_IPC_CLOSED;
-  }
-
-  return (result);
-}
-
-// Mark file as closed and try and close it. Errors not reported.
-void vtpm_ipc_close(vtpm_ipc_handle_t *ipc_h) {
-
-  if (ipc_h) {
-    close(ipc_h->fh);
-    ipc_h->fh = VTPM_IPC_CLOSED;
-  }
-
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/vtpm_ipc.h
--- a/tools/vtpm_manager/manager/vtpm_ipc.h	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-// ===================================================================
-//
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-//
-// vtpm_ipc.h Header for interprocess communication between VTPM manager
-// and Guests or VTPMs
-//
-// ===================================================================
-
-#ifndef __VTPM_IO_H__
-#define __VTPM_IO_H__
-
-#include "tcg.h"
-
-#define VTPM_IPC_CLOSED -1
-
-// Represents an (somewhat) abstracted io handle.
-typedef struct vtpm_ipc_handle_t {
-  int fh;              // IO handle.
-  int flags;           // Flags for opening. This may need to become
-                       // a void *, but for now files use an int.
-  char *name;          // Names for debugging as well as filenames
-                       // for file-based io.
-} vtpm_ipc_handle_t;
-
-
-int vtpm_ipc_init(vtpm_ipc_handle_t *ioh, char* name, int flags, BOOL create);
-
-// Create the file that needs opening. Used only for FIFOs
-// FYI: This may cause problems in other file IO schemes. We'll see.
-int vtpm_ipc_create(vtpm_ipc_handle_t *ioh);
-
-// Read size bytes. If FH isn't open, open it.
-int vtpm_ipc_read(vtpm_ipc_handle_t *ioh, vtpm_ipc_handle_t *alt_ioh, BYTE *bytes, UINT32 size);
-
-// Write size bytes. If FH isn't open, open it.
-int vtpm_ipc_write(vtpm_ipc_handle_t *ioh, vtpm_ipc_handle_t *alt_ioh, BYTE *bytes, UINT32 size);
-
-// Mark file as closed and try and close it. Errors not reported.
-void vtpm_ipc_close(vtpm_ipc_handle_t *ioh);
-
-#endif
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/vtpm_lock.c
--- a/tools/vtpm_manager/manager/vtpm_lock.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-// ===================================================================
-//
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-//
-// vtpm_lock.c Provided controlled sync around access to vtpm structures
-//
-// ===================================================================
-
-#include <pthread.h>
-#include "vtpm_lock.h"
-
-static pthread_rwlock_t vtpm_lock;
-
-void vtpm_lock_init() {
-
-  pthread_rwlock_init( &vtpm_lock, NULL);
-}
-
-void vtpm_lock_destroy(){
-  pthread_rwlock_destroy(&vtpm_lock);
-}
-
-void vtpm_lock_rdlock(){
-  pthread_rwlock_rdlock(&vtpm_lock);
-}
-
-void vtpm_lock_wrlock(){
-  pthread_rwlock_wrlock(&vtpm_lock);
-}
-
-void vtpm_lock_unlock(){
-  pthread_rwlock_unlock(&vtpm_lock);
-}
-
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/vtpm_lock.h
--- a/tools/vtpm_manager/manager/vtpm_lock.h	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-// ===================================================================
-//
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-//
-// vtpm_lock.h Provided controlled sync around access to vtpm structures
-//
-// ===================================================================
-
-#ifndef __VTPM_LOCK_H__
-#define __VTPM_LOCK_H__
-
-void vtpm_lock_init();
-void vtpm_lock_destroy();
-
-void vtpm_lock_rdlock();
-void vtpm_lock_wrlock();
-void vtpm_lock_unlock();
-
-#endif
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/vtpm_manager.c
--- a/tools/vtpm_manager/manager/vtpm_manager.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,285 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// vtpm_manager.c
-// 
-//  This file will house the main logic of the VTPM Manager
-//
-// ==================================================================
-
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "vtpm_manager.h"
-#include "vtpmpriv.h"
-#include "vtsp.h"
-#include "bsg.h"
-#include "hashtable.h"
-#include "hashtable_itr.h"
-
-#include "log.h"
-#include "buffer.h"
-
-VTPM_GLOBALS *vtpm_globals=NULL;
-
-// --------------------------- Well Known Auths --------------------------
-const TPM_AUTHDATA SRK_AUTH = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-                                  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-
-#ifdef WELL_KNOWN_OWNER_AUTH
-static BYTE FIXED_OWNER_AUTH[20] =  {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-                                  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-#endif
-
-
-// -------------------------- Hash table functions --------------------
-
-static unsigned int hashfunc32(void *ky) {
-  return (* (UINT32 *) ky);
-}
-
-static int equals32(void *k1, void *k2) {
-  return (*(UINT32 *) k1 == *(UINT32 *) k2);
-}
-
-// --------------------------- Functions ------------------------------
-
-TPM_RESULT VTPM_Create_Manager(){
-  
-  TPM_RESULT status = TPM_SUCCESS;
-  
-  // Generate Auth for Owner
-#ifdef WELL_KNOWN_OWNER_AUTH 
-  memcpy(vtpm_globals->owner_usage_auth, FIXED_OWNER_AUTH, sizeof(TPM_AUTHDATA));
-#else    
-  Crypto_GetRandom(vtpm_globals->owner_usage_auth, sizeof(TPM_AUTHDATA) );
-#endif
-
-  // Take Owership of TPM
-  CRYPTO_INFO ek_cryptoInfo;
-  
-  status = VTSP_ReadPubek(vtpm_globals->manager_tcs_handle, &ek_cryptoInfo);
-  
-  // If we can read PubEK then there is no owner and we should take it.
-  // We use the abilty to read the pubEK to flag that the TPM is owned.
-  // FIXME: Change to just trying to take ownership and react to the status
-  if (status == TPM_SUCCESS) { 
-    TPMTRYRETURN(VTSP_TakeOwnership(vtpm_globals->manager_tcs_handle,
-				    (const TPM_AUTHDATA*)&vtpm_globals->owner_usage_auth, 
-				    &SRK_AUTH,
-				    &ek_cryptoInfo,
-				    &vtpm_globals->keyAuth)); 
-  
-    TPMTRYRETURN(VTSP_DisablePubekRead(vtpm_globals->manager_tcs_handle,
-                                       (const TPM_AUTHDATA*)&vtpm_globals->owner_usage_auth,  
-                                       &vtpm_globals->keyAuth));     
-  } else {
-    vtpmloginfo(VTPM_LOG_VTPM, "Failed to readEK meaning TPM has an owner. Creating Keys off existing SRK.\n");
-  }
-  
-  // Generate storage key's auth
-  Crypto_GetRandom(  &vtpm_globals->storage_key_usage_auth, 
-		     sizeof(TPM_AUTHDATA) );
-  
-  TCS_AUTH osap;
-  TPM_AUTHDATA sharedsecret;
-  
-  TPMTRYRETURN( VTSP_OSAP(vtpm_globals->manager_tcs_handle,
-			  TPM_ET_KEYHANDLE,
-			  TPM_SRK_KEYHANDLE, 
-			  &SRK_AUTH,
-			  &sharedsecret, 
-			  &osap) ); 
-
-  osap.fContinueAuthSession = FALSE;
- 
- 
-  TPMTRYRETURN( VTSP_CreateWrapKey( vtpm_globals->manager_tcs_handle,
-				    TPM_KEY_BIND,
-				    (const TPM_AUTHDATA*)&vtpm_globals->storage_key_usage_auth,
-				    TPM_SRK_KEYHANDLE, 
-				    (const TPM_AUTHDATA*)&sharedsecret,
-				    &vtpm_globals->storageKeyWrap,
-				    &osap) );
-  
-  // Generate boot key's auth
-  TPM_AUTHDATA bootKeyWrapAuth;
-  memset(&bootKeyWrapAuth, 0, sizeof(bootKeyWrapAuth));
-  
-  TPMTRYRETURN( VTSP_OSAP(vtpm_globals->manager_tcs_handle,
-			  TPM_ET_KEYHANDLE,
-			  TPM_SRK_KEYHANDLE, 
-			  &SRK_AUTH,
-			  &sharedsecret, 
-			  &osap) ); 
-
-  osap.fContinueAuthSession = FALSE;
- 
-  // FIXME: This key protects the global secrets on disk. It should use TPM
-  //        PCR bindings to limit its use to legit configurations.
-  //        Current binds are open, implying a Trusted VM contains this code.
-  //        If this VM is not Trusted, use measurement and PCR bindings.
-  TPMTRYRETURN( VTSP_CreateWrapKey( vtpm_globals->manager_tcs_handle,
-				    TPM_KEY_BIND,
-				    (const TPM_AUTHDATA*)&bootKeyWrapAuth,
-				    TPM_SRK_KEYHANDLE, 
-				    (const TPM_AUTHDATA*)&sharedsecret,
-				    &vtpm_globals->bootKeyWrap,
-				    &osap) );
-
-  // Populate CRYPTO_INFO vtpm_globals->bootKey. This does not load it into the TPM
-  TPMTRYRETURN( VTSP_LoadKey( vtpm_globals->manager_tcs_handle,
-                              TPM_SRK_KEYHANDLE,
-                              &vtpm_globals->bootKeyWrap,
-                              NULL,
-                              NULL,
-                              NULL,
-                              &vtpm_globals->bootKey,
-                              TRUE ) );
-
-  TPMTRYRETURN( VTSP_SaveState(vtpm_globals->manager_tcs_handle) );
-  goto egress;
-  
- abort_egress:
-  exit(1);
-  
- egress:
-  vtpmloginfo(VTPM_LOG_VTPM, "Finished initialized new VTPM manager (Status = %d).\n", status);
-  return status;
-  
-}
-
-///////////////////////////////////////////////////////////////////////////////
-TPM_RESULT VTPM_Init_Manager() {
-  TPM_RESULT status = TPM_FAIL, serviceStatus;   
-  BYTE *randomsead;
-  UINT32 randomsize=256;
-
-  if ((vtpm_globals = (VTPM_GLOBALS *) malloc(sizeof(VTPM_GLOBALS))) == NULL){
-    status = TPM_FAIL;
-    goto abort_egress;
-  }
-  memset(vtpm_globals, 0, sizeof(VTPM_GLOBALS));
-
-  vtpm_globals->connected_dmis = 0;
-
-  if ((vtpm_globals->dmi_map = create_hashtable(10, hashfunc32, equals32)) == NULL){
-    status = TPM_FAIL;
-    goto abort_egress;
-  }
-  
-  // Create new TCS Object
-  vtpm_globals->manager_tcs_handle = 0;
- 
-  TPMTRYRETURN(TCS_create());
-  
-  // Create TCS Context for service
-  TPMTRYRETURN( TCS_OpenContext(&vtpm_globals->manager_tcs_handle ) );
-
-  TPMTRYRETURN( TCSP_GetRandom(vtpm_globals->manager_tcs_handle, 
-			       &randomsize, 
-			       &randomsead));
-  
-  Crypto_Init(randomsead, randomsize);
-  TPMTRYRETURN( TCS_FreeMemory (vtpm_globals->manager_tcs_handle, randomsead)); 
-	
-  // Create OIAP session for service's authorized commands
-  TPMTRYRETURN( VTSP_OIAP( vtpm_globals->manager_tcs_handle, 
-			   &vtpm_globals->keyAuth) );
-  vtpm_globals->keyAuth.fContinueAuthSession = TRUE;
-
-  vtpm_globals->mig_keys = NULL;
-
-  // If fails, create new Manager.
-  serviceStatus = VTPM_LoadManagerData();
-  if (serviceStatus == TPM_IOERROR) {
-    vtpmloginfo(VTPM_LOG_VTPM, "Failed to read manager file. Assuming first time initialization.\n");
-    TPMTRYRETURN( VTPM_Create_Manager() );    
-    TPMTRYRETURN( VTPM_SaveManagerData() );
-  } else if (serviceStatus != TPM_SUCCESS) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Failed to read existing manager file");
-    exit(1);
-  }
-
-  //Load Storage Key 
-  TPMTRYRETURN( VTSP_LoadKey( vtpm_globals->manager_tcs_handle,
-			      TPM_SRK_KEYHANDLE,
-			      &vtpm_globals->storageKeyWrap,
-			      &SRK_AUTH,
-			      &vtpm_globals->storageKeyHandle,
-			      &vtpm_globals->keyAuth,
-			      &vtpm_globals->storageKey,
-                              FALSE ) );
-
-  // Create entry for Dom0 for control messages
-  TPMTRYRETURN( VTPM_Handle_New_DMI(NULL) );
-  
-  goto egress;
-  
- abort_egress:
- egress:
-  
-  return(status);
-}
-
-/////////////////////////////////////////////////////////////////////////////// 
-void VTPM_Stop_Manager() {
-  VTPM_DMI_RESOURCE *dmi_res;
-  struct hashtable_itr *dmi_itr;
-  
-  // Close all the TCS contexts. TCS should evict keys based on this
-  if (hashtable_count(vtpm_globals->dmi_map) > 0) {
-    dmi_itr = hashtable_iterator(vtpm_globals->dmi_map);
-    do {
-      dmi_res = (VTPM_DMI_RESOURCE *) hashtable_iterator_value(dmi_itr);
-      if (dmi_res->connected) 
-	close_dmi( dmi_res ); // Not really interested in return code
-      
-    } while (hashtable_iterator_advance(dmi_itr));
-		free (dmi_itr);
-  }
-  
-  if ( VTPM_SaveManagerData() != TPM_SUCCESS ) 
-    vtpmlogerror(VTPM_LOG_VTPM, "Unable to save manager data.\n");
-
-  TCS_CloseContext(vtpm_globals->manager_tcs_handle);
-  TCS_destroy();
-  
-  hashtable_destroy(vtpm_globals->dmi_map, 1);
-  free(vtpm_globals);
-  
-  Crypto_Exit();
-	
-  vtpmloginfo(VTPM_LOG_VTPM, "VTPM Manager stopped.\n");
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/vtpm_manager.h
--- a/tools/vtpm_manager/manager/vtpm_manager.h	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// vtpm_manager.h
-// 
-//  Public Interface header for VTPM Manager
-//
-// ==================================================================
-
-#ifndef __VTPM_MANAGER_H__
-#define __VTPM_MANAGER_H__
-
-#define VTPM_TAG_REQ 0x01c1
-#define VTPM_TAG_RSP 0x01c4
-#define COMMAND_BUFFER_SIZE 4096
-
-// Header sizes. Note Header MAY include the DMI
-#define VTPM_COMMAND_HEADER_SIZE_CLT ( 2 + 4 + 4)
-//                    sizeof(TPM_TAG + UINT32 + TPM_COMMAND_CODE)
-#define VTPM_COMMAND_HEADER_SIZE_SRV ( 4 + VTPM_COMMAND_HEADER_SIZE_CLT )
-//                    sizeof( UINT32 + VTPM_COMMAND_HEADER_SIZE_CLT)
-
-//************************ Command Codes ****************************
-#define VTPM_ORD_BASE       0x0000
-#define VTPM_PRIV_MASK      0x01000000 // Priviledged VTPM Command
-#define VTPM_PRIV_BASE      (VTPM_ORD_BASE | VTPM_PRIV_MASK)
-
-// Non-priviledged VTPM Commands (From DMI's)
-#define VTPM_ORD_SAVENVM      (VTPM_ORD_BASE + 1) // DMI Saves Secrets
-#define VTPM_ORD_LOADNVM      (VTPM_ORD_BASE + 2) // DMI Loads Secrets
-#define VTPM_ORD_TPMCOMMAND   (VTPM_ORD_BASE + 3) // DMI issues HW TPM Command
-#define VTPM_ORD_GET_MIG_KEY  (VTPM_ORD_BASE + 4) // Get manager's migration key
-#define VTPM_ORD_LOAD_MIG_KEY (VTPM_ORD_BASE + 5) // load dest migration key 
-
-// Priviledged VTPM Commands (From management console)
-#define VTPM_ORD_OPEN         (VTPM_PRIV_BASE + 1) // Creates/reopens DMI
-#define VTPM_ORD_CLOSE        (VTPM_PRIV_BASE + 2) // Closes a DMI
-#define VTPM_ORD_DELETE       (VTPM_PRIV_BASE + 3) // Permemently Deletes DMI
-#define VTPM_ORD_MIGRATE_IN   (VTPM_PRIV_BASE + 4) // Load migrated VTPM
-#define VTPM_ORD_MIGRATE_OUT  (VTPM_PRIV_BASE + 5) // migrate VTPM to dest 
-
-//************************ Return Codes ****************************
-#define VTPM_TYPE_PVM 1 // Paravirtualized Domain
-#define VTPM_TYPE_HVM 2 // HVM Domain
-
-//************************ Return Codes ****************************
-#define VTPM_SUCCESS               0
-#define VTPM_FAIL                  1
-#define VTPM_UNSUPPORTED           2
-#define VTPM_FORBIDDEN             3
-#define VTPM_RESTORE_CONTEXT_FAILED    4
-#define VTPM_INVALID_REQUEST       5
-
-//*********************** Parameter Values *************************
-#define VTPM_TYPE_NON_MIGRATABLE  0x00
-#define VTPM_TYPE_MIGRATABLE      0x01
-#define VTPM_TYPE_MIGRATED        0xFF // VTPM has been migrated.
-                                       // VTPM can be recovered or deleted only
-
-/******************* Command Parameter API *************************
-
-VTPM Command Format
-  dmi: 4 bytes                  // Source of message. 
-                                // WARNING: This is prepended by the channel. 
-                                // Thus it is received by VTPM Manager, 
-                                // but not sent by DMI
-  tpm tag: 2 bytes
-  command size: 4 bytes         // Size of command including header but not DMI
-  ord: 4 bytes                  // Command ordinal above
-  parameters: size - 10 bytes   // Command Parameter
-
-VTPM Response Format
-  tpm tag: 2 bytes
-  response_size: 4 bytes
-  status: 4 bytes         
-  parameters: size - 10 bytes
-
-
-VTPM_Open:
-  Input Parameters:
-    mig_type: 1 byte 
-    startup_mode: 1 byte // Cold Boot = 1, resume = 2, deactive = 3
-    domain type: 1 byte
-    instance_id: 4 bytes
-  Output Parameters:
-    None
-    
-VTPM_Close
-  Input Parameters:
-    instance_id: 4 bytes
-  Output Parameters:
-    None
-
-VTPM_Delete
-  Input Parameters:
-    instance_id: 4 bytes
-  Output Parameters:
-    None
-
-VTPM_SaveNVM
-  Input Parameters:
-    data: n bytes (Header indicates size of data)
-  Output Parameters:
-    None
-
-VTPM_LoadNVM
-  Input Parameters:
-    None
-  Output Parameters:
-    data: n bytes (Header indicates size of data)
-
-VTPM_TPMCommand
-  Input Parameters:
-    TPM Command Byte Stream: n bytes 
-  Output Parameters:
-    TPM Reponse Byte Stream: n bytes 
-
-*********************************************************************/
-
-#endif //_VTPM_MANAGER_H_
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/vtpm_manager_handler.c
--- a/tools/vtpm_manager/manager/vtpm_manager_handler.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,488 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// vtpm_manager_handler.c
-// 
-//  This file will house the main logic of the VTPM Manager
-//
-// ==================================================================
-
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-
-#include "vtpm_manager.h"
-#include "vtpmpriv.h"
-#include "vtsp.h"
-#include "bsg.h"
-#include "hashtable.h"
-#include "hashtable_itr.h"
-#include "log.h"
-#include "buffer.h"
-
-#define vtpmhandlerloginfo(module,fmt,args...) vtpmloginfo (module, "[%s]: " fmt, thread_name, ##args );
-#define vtpmhandlerloginfomore(module,fmt,args...) vtpmloginfomore (module, fmt, ##args );
-#define vtpmhandlerlogerror(module,fmt,args...) vtpmlogerror (module, "[%s]: " fmt, thread_name, ##args );
-
-// ---------------------- Prototypes -------------------
-TPM_RESULT vtpm_manager_handle_vtpm_cmd(VTPM_DMI_RESOURCE *dmi_res,
-					TPM_COMMAND_CODE ord,
-					buffer_t *command_buf,
-					buffer_t *result_buf,
-                                        BOOL is_priv,
-                                        char *thread_name);
-
-TPM_RESULT vtpm_manager_handle_tpm_cmd(vtpm_ipc_handle_t *tx_ipc_h,
-                                       vtpm_ipc_handle_t *rx_ipc_h,
-                                       VTPM_DMI_RESOURCE *dmi_res,
-                                       BYTE *cmd_header,
-                                       buffer_t *param_buf,
-                                       buffer_t *result_buf,
-                                       char *thread_name);
-
-TPM_RESULT VTPM_Manager_Handler( vtpm_ipc_handle_t *tx_ipc_h, 
-                                 vtpm_ipc_handle_t *rx_ipc_h,
-                                 BOOL fw_tpm,   // Forward TPM cmds?
-                                 vtpm_ipc_handle_t *fw_tx_ipc_h, 
-                                 vtpm_ipc_handle_t *fw_rx_ipc_h,
-                                 BOOL is_priv,
-                                 char *thread_name) {
-  TPM_RESULT      status =  TPM_FAIL; // Should never return
-  UINT32          dmi, in_param_size, cmd_size, out_param_size, out_message_size, reply_size;
-  BYTE            *cmd_header=NULL, *in_param=NULL, *out_message=NULL, *reply;
-  buffer_t        *command_buf=NULL, *result_buf=NULL;
-  TPM_TAG         tag;
-  TPM_COMMAND_CODE ord;
-  VTPM_DMI_RESOURCE *dmi_res;
-  int  size_read, size_write, i;
-  BOOL add_header=TRUE; // This indicates to prepend a header on result_buf before sending
-  
-  cmd_header = (BYTE *) malloc(VTPM_COMMAND_HEADER_SIZE_SRV);
-  command_buf = (buffer_t *) malloc(sizeof(buffer_t));
-  result_buf = (buffer_t *) malloc(sizeof(buffer_t));
- 
-  // ------------------------ Main Loop --------------------------------
-  while(1) {
-    
-    vtpmhandlerloginfo(VTPM_LOG_VTPM, "%s waiting for messages.\n", thread_name);
-
-    // --------------------- Read Cmd from Sender ----------------
-    
-    // Read command header 
-    size_read = vtpm_ipc_read(rx_ipc_h, NULL, cmd_header, VTPM_COMMAND_HEADER_SIZE_SRV);
-    if (size_read > 0) {
-      vtpmhandlerloginfo(VTPM_LOG_VTPM_DEEP, "RECV[%d]: 0x", size_read);
-      for (i=0; i<size_read; i++) 
-	vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", cmd_header[i]);
-    } else {
-      vtpmhandlerlogerror(VTPM_LOG_VTPM, "%s can't read from ipc. Errono = %d. Aborting... \n", thread_name, errno);
-      goto abort_command;
-    }
-
-    if (size_read < (int) VTPM_COMMAND_HEADER_SIZE_SRV) {
-      vtpmhandlerloginfo(VTPM_LOG_VTPM_DEEP, "\n");
-      vtpmhandlerlogerror(VTPM_LOG_VTPM, "Command shorter than normal header (%d bytes). Aborting...\n", size_read);
-      goto abort_command;
-    }
-    
-    // Unpack header
-    BSG_UnpackList(cmd_header, 4,
-    		   BSG_TYPE_UINT32, &dmi,
-    		   BSG_TPM_TAG, &tag,
-    		   BSG_TYPE_UINT32, &in_param_size,
-    		   BSG_TPM_COMMAND_CODE, &ord );
-    
-    // Using the header info, read the parameters of the command
-    // Note that in_param_size is in the client's context
-    cmd_size = in_param_size - VTPM_COMMAND_HEADER_SIZE_CLT;
-    if (cmd_size > 0) {
-      in_param = (BYTE *) malloc(cmd_size);
-      size_read = vtpm_ipc_read( rx_ipc_h, NULL, in_param, cmd_size);
-      if (size_read > 0) {
-	for (i=0; i<size_read; i++) 
-	  vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", in_param[i]);
-	
-      } else {
-        vtpmhandlerlogerror(VTPM_LOG_VTPM, "%s had error reading cmd from ipc. Aborting... \n", thread_name);
-	goto abort_command;
-      }
-      vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-      
-      if (size_read < (int) cmd_size) {
-	vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-	vtpmhandlerlogerror(VTPM_LOG_VTPM, "Command read(%d) is shorter than header indicates(%d). Aborting...\n", size_read, cmd_size);
-	goto abort_command;
-      }
-    } else {
-      in_param = NULL;
-      vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-    }
-
-    // Init the buffers used to handle the command and the response
-    if ( (buffer_init_convert(command_buf, cmd_size, in_param) != TPM_SUCCESS) || 
-	 (buffer_init(result_buf, 0, 0) != TPM_SUCCESS) ) {
-      vtpmhandlerlogerror(VTPM_LOG_VTPM, "Failed to setup buffers. Aborting...\n");
-      goto abort_command;
-    }
-    
-    // -------------- Dispatch Commands to Handlers -----------
-    if ((tag == VTPM_TAG_REQ) && (ord & VTPM_PRIV_MASK)) {
-      vtpm_lock_wrlock();
-    } else {
-      vtpm_lock_rdlock();
-    }
-
-    if ( !(dmi_res = (VTPM_DMI_RESOURCE *) hashtable_search(vtpm_globals->dmi_map, &dmi)) ||
-         (!dmi_res->connected) ) {
-      vtpmhandlerlogerror(VTPM_LOG_VTPM, "Attempted access to non-existent or disconnected DMI %d. Aborting...\n", dmi);
-      status = TPM_BAD_PARAMETER;
-      // We have no one to reply to, they don't exist.
-      goto abort_command;
-    }
-
-    if (tag == VTPM_TAG_REQ) { 
-    
-      status = vtpm_manager_handle_vtpm_cmd(dmi_res, ord, command_buf, result_buf, is_priv, thread_name);
-
-    } else { // This is not a VTPM Command at all.
-      if (fw_tpm) { 
-        status = vtpm_manager_handle_tpm_cmd(fw_tx_ipc_h, fw_rx_ipc_h, dmi_res, cmd_header, command_buf, result_buf, thread_name);
-
-        // This means calling the DMI failed, not that the cmd failed in the DMI
-        // Since the return will be interpretted by a TPM app, all errors are IO_ERRORs to the app
-        if (status != TPM_SUCCESS) { 
-          status = TPM_IOERROR;
-	  goto abort_with_error;
-        }
-        // Unlike all other commands, forwarded commands yield a result_buf that includes the DMI's status. This
-        // should be forwarded to the caller VM
-        add_header = FALSE;
-      } else {
-        // We are not supposed to forward TPM commands at all.
-        int i;
-        vtpmhandlerlogerror(VTPM_LOG_VTPM, "Attempt to use unsupported direct access to TPM.\n");
-        vtpmhandlerloginfo(VTPM_LOG_VTPM_DEEP, "Bad Command. dmi:%d, tag:%d, size:%d, ord:%d, Params: ", dmi, tag, in_param_size, ord);
-        for (i=0; i<cmd_size; i++)
-          vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", in_param[i]);
-
-        vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-
-        status = TPM_FAIL;
-        goto abort_with_error;
-     }
-
-    } // end else for is VTPM Command
-
-    // ------------------- Respond to Sender ------------------
-
-    // Errors while handling responses jump here to reply with error messages
-    // NOTE: Currently there are no recoverable errors in multi-VM mode. If one
-    //       is added to the code, this ifdef should be removed.
-    //       Also note this is NOT referring to errors in commands, but rather
-    //       this is about I/O errors and such.
-#ifndef VTPM_MULTI_VM
- abort_with_error:
-#endif
-   
-    if (add_header) { 
-      // Prepend VTPM header with destination DM stamped
-      out_param_size = buffer_len(result_buf);
-      out_message_size = VTPM_COMMAND_HEADER_SIZE_CLT + out_param_size;
-      reply_size = VTPM_COMMAND_HEADER_SIZE_SRV + out_param_size;
-      out_message = (BYTE *) malloc (reply_size);
-      reply = out_message;
-    
-      BSG_PackList(out_message, 4,
-		   BSG_TYPE_UINT32, (BYTE *) &dmi,
-		   BSG_TPM_TAG, (BYTE *) &tag,
-		   BSG_TYPE_UINT32, (BYTE *) &out_message_size,
-		   BSG_TPM_RESULT, (BYTE *) &status);
-    
-      if (buffer_len(result_buf) > 0) 
-        memcpy(out_message + VTPM_COMMAND_HEADER_SIZE_SRV, result_buf->bytes, out_param_size);
-      //Note: Send message + dmi_id
-    } else {
-      reply = result_buf->bytes;
-      reply_size = buffer_len(result_buf);
-    }  
-    size_write = vtpm_ipc_write(tx_ipc_h, (dmi_res ? dmi_res->tx_vtpm_ipc_h : NULL), reply, reply_size );
-    if (size_write > 0) {
-      vtpmhandlerloginfo(VTPM_LOG_VTPM_DEEP, "SENT: 0x");
-      for (i=0; i < reply_size; i++) 
-	vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", reply[i]);
-      
-      vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "\n");            
-    } else {
-      vtpmhandlerlogerror(VTPM_LOG_VTPM, "%s had error writing to ipc. Aborting... \n", thread_name);
-      goto abort_command;
-    }
-    free(out_message); out_message=NULL;
-    
-    if (size_write < (int)reply_size) {
-      vtpmhandlerlogerror(VTPM_LOG_VTPM, "%s unable to write full command to ipc (%d/%d)\n", thread_name, size_write, reply_size);
-      goto abort_command;
-    }
-    
-    // On certain failures an error message cannot be sent. 
-    // This marks the beginning of cleanup in preperation for the next command.
-  abort_command:
-    //free buffers
-    bzero(cmd_header, VTPM_COMMAND_HEADER_SIZE_SRV);
-    //free(in_param); // This was converted to command_buf. No need to free 
-    buffer_free(result_buf);
-    buffer_free(command_buf);
-
-    // If we have a write lock, save the manager table
-    if ((tag == VTPM_TAG_REQ) && (ord & VTPM_PRIV_MASK) &&
-        (VTPM_SaveManagerData() != TPM_SUCCESS) ) {
-       vtpmhandlerlogerror(VTPM_LOG_VTPM, "ERROR: Unable to save manager data.\n");
-    }
-
-    vtpm_lock_unlock();
-    add_header = TRUE; // Reset to the default
-  } // End while(1)
-  
-}
-
-/////////////////////////////////////////////////////////////////////////
-TPM_RESULT vtpm_manager_handle_vtpm_cmd(VTPM_DMI_RESOURCE *dmi_res, 
-					TPM_COMMAND_CODE ord,
-					buffer_t *command_buf,
-					buffer_t *result_buf,
-                                        BOOL is_priv,
-                                        char *thread_name) {
-
-  TPM_RESULT status = TPM_FAIL;
-
-  switch (ord) {                
-  case VTPM_ORD_SAVENVM:
-    status= VTPM_Handle_Save_NVM(dmi_res,
-                                 command_buf, 
-                                 result_buf);
-    break;
-
-  case VTPM_ORD_LOADNVM:
-    status= VTPM_Handle_Load_NVM(dmi_res, 
-                                 command_buf, 
-                                 result_buf);
-    break;
-
-  case VTPM_ORD_TPMCOMMAND:
-    status= VTPM_Handle_TPM_Command(dmi_res, 
-                                    command_buf, 
-                                    result_buf);
-    break;
-
-  case VTPM_ORD_GET_MIG_KEY:
-    status = VTPM_Handle_Get_Migration_key(command_buf, 
-                                           result_buf);
-    break;
-
-  case VTPM_ORD_LOAD_MIG_KEY:
-    status = VTPM_Handle_Load_Migration_key(command_buf, 
-                                           result_buf);
-    break;
-   
-  default:
-    // Privileged handlers can do maintanance
-    if (is_priv) {
-      switch (ord) {
-      case VTPM_ORD_OPEN:
-        status = VTPM_Handle_New_DMI(command_buf);
-        break;
-
-      case VTPM_ORD_CLOSE:
-        status = VTPM_Handle_Close_DMI(command_buf);
-        break;
-
-      case VTPM_ORD_DELETE:
-        status = VTPM_Handle_Delete_DMI(command_buf);
-        break;
-
-      case VTPM_ORD_MIGRATE_IN:
-        status = VTPM_Handle_Migrate_In(command_buf, result_buf);
-        break;
-
-      case VTPM_ORD_MIGRATE_OUT:
-        status = VTPM_Handle_Migrate_Out(command_buf, result_buf);
-        break;
-
-      default:
-        status = TPM_BAD_ORDINAL;
-      } // switch
-    } else { // is priv command
-
-        status = TPM_BAD_ORDINAL;
-    } // inner switch
-  } // outer switch
-
-  return(status);
-}
-      
-/////////////////////////////////////////////////////////////////////
-TPM_RESULT vtpm_manager_handle_tpm_cmd(vtpm_ipc_handle_t *tx_ipc_h,
-                                       vtpm_ipc_handle_t *rx_ipc_h,
-				       VTPM_DMI_RESOURCE *dmi_res, 
-				       BYTE *cmd_header,
-				       buffer_t *param_buf,
-				       buffer_t *result_buf,
-                                       char *thread_name) {
-
-  TPM_RESULT status = TPM_FAIL;
-  UINT32 dmi_dst;
-  TPM_COMMAND_CODE ord;
-  TPM_TAG tag_out;
-  UINT32 dmi_cmd_size, in_param_size, adj_param_size;
-  BYTE *dmi_cmd, *in_param;
-  int  size_read, size_write, i;
-
-  //// Dom0 can't talk to the BE, so this must be a broken FE/BE or badness
-  if (dmi_res->dmi_id == VTPM_CTL_DM) {
-    vtpmhandlerlogerror(VTPM_LOG_VTPM, "Illegal use of TPM command from dom0\n");
-    status = TPM_FAIL;
-    goto abort_with_error;
-  } 
-
-  vtpmhandlerloginfo(VTPM_LOG_VTPM, "Forwarding command to DMI.\n");
-   
-  //Forward TPM CMD stamped with dmi_id to DMI for handling
-  if (buffer_len(param_buf)) {
-    dmi_cmd = (BYTE *) malloc(VTPM_COMMAND_HEADER_SIZE_SRV + buffer_len(param_buf));
-    dmi_cmd_size = VTPM_COMMAND_HEADER_SIZE_SRV + buffer_len(param_buf);
-    memcpy(dmi_cmd, cmd_header, VTPM_COMMAND_HEADER_SIZE_SRV);
-    memcpy(dmi_cmd + VTPM_COMMAND_HEADER_SIZE_SRV, param_buf->bytes, buffer_len(param_buf));
-    size_write = vtpm_ipc_write(tx_ipc_h, dmi_res->tx_tpm_ipc_h, dmi_cmd, dmi_cmd_size);
-
-    if (size_write > 0) {
-      vtpmhandlerloginfo(VTPM_LOG_VTPM_DEEP, "SENT (DMI): 0x");
-      for (i=0; i<VTPM_COMMAND_HEADER_SIZE_SRV + buffer_len(param_buf); i++) {
-        vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", dmi_cmd[i]);
-      }
-      vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-    } else {
-      vtpmhandlerlogerror(VTPM_LOG_VTPM, "Error writing to DMI. Aborting... \n");
-      status = TPM_IOERROR;
-      goto abort_with_error;
-    }
-    free(dmi_cmd);
-  } else {
-    dmi_cmd_size = VTPM_COMMAND_HEADER_SIZE_SRV;
-    size_write = vtpm_ipc_write(tx_ipc_h, dmi_res->tx_tpm_ipc_h, cmd_header, VTPM_COMMAND_HEADER_SIZE_SRV );
-    if (size_write > 0) {
-      vtpmhandlerloginfo(VTPM_LOG_VTPM_DEEP, "SENT (DMI): 0x");
-      for (i=0; i<VTPM_COMMAND_HEADER_SIZE_SRV; i++) 
-        vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", cmd_header[i]);
-
-      vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "\n");
-    } else {
-      vtpmhandlerlogerror(VTPM_LOG_VTPM, "Error writing to DMI. Aborting... \n");
-      status = TPM_IOERROR;
-      goto abort_with_error;
-    }
-  }
-    
-  if (size_write != (int) dmi_cmd_size) 
-    vtpmhandlerlogerror(VTPM_LOG_VTPM, "Could not write entire command to DMI (%d/%d)\n", size_write, dmi_cmd_size);
-
-  buffer_free(param_buf);
-  
-  // Read header for response to TPM command from DMI
-  size_read = vtpm_ipc_read( rx_ipc_h, dmi_res->rx_tpm_ipc_h, cmd_header, VTPM_COMMAND_HEADER_SIZE_SRV);
-  if (size_read > 0) {
-    vtpmhandlerloginfo(VTPM_LOG_VTPM_DEEP, "RECV (DMI): 0x");
-    for (i=0; i<size_read; i++) 
-      vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", cmd_header[i]);
-
-  } else {
-    vtpmhandlerlogerror(VTPM_LOG_VTPM, "Error reading from DMI. Aborting... \n");
-    status = TPM_IOERROR;
-    goto abort_with_error;
-  }
-  
-  if (size_read < (int) VTPM_COMMAND_HEADER_SIZE_SRV) {
-    vtpmhandlerlogerror(VTPM_LOG_VTPM, "Command from DMI shorter than normal header. Aborting...\n");
-    status = TPM_IOERROR;
-    goto abort_with_error;
-  }
-
-  // Unpack response from DMI for TPM command
-  BSG_UnpackList(cmd_header, 4,
-                 BSG_TYPE_UINT32, &dmi_dst,
-                 BSG_TPM_TAG, &tag_out,
-                 BSG_TYPE_UINT32, &in_param_size,
-                 BSG_TPM_COMMAND_CODE, &status );
-  
-  // If response has parameters, read them.
-  // Note that in_param_size is in the client's context
-  adj_param_size = in_param_size - VTPM_COMMAND_HEADER_SIZE_CLT;
-  if (adj_param_size > 0) {
-    in_param = (BYTE *) malloc(adj_param_size);
-    size_read = vtpm_ipc_read(rx_ipc_h, dmi_res->rx_tpm_ipc_h, in_param, adj_param_size);
-    if (size_read > 0) {
-      for (i=0; i<size_read; i++) 
-        vtpmhandlerloginfomore(VTPM_LOG_VTPM_DEEP, "%x ", in_param[i]);
-
-    } else {
-      vtpmhandlerlogerror(VTPM_LOG_VTPM, "Error reading from BE. Aborting... \n");
-      goto abort_with_error;
-    }
-    vtpmhandlerloginfomore(VTPM_LOG_VTPM, "\n");
-   
-    if (size_read < (int)adj_param_size) {
-      vtpmhandlerloginfomore(VTPM_LOG_VTPM, "\n");
-      vtpmhandlerlogerror(VTPM_LOG_VTPM, "Command read(%d) from DMI is shorter than header indicates(%d). Aborting...\n", size_read, adj_param_size);
-      status = TPM_IOERROR;
-      goto abort_with_error;
-    }
-  } else {
-    in_param = NULL;
-    vtpmhandlerloginfomore(VTPM_LOG_VTPM, "\n");
-  }
-   
-  if ( (buffer_init(result_buf, VTPM_COMMAND_HEADER_SIZE_SRV, cmd_header) != TPM_SUCCESS) || 
-       (buffer_append_raw(result_buf, adj_param_size, in_param) != TPM_SUCCESS) ) {
-    vtpmhandlerlogerror(VTPM_LOG_VTPM, "Failed to setup buffers. Aborting...\n");
-    status = TPM_FAIL;
-    goto abort_with_error;
-  }
- 
-  vtpmhandlerloginfo(VTPM_LOG_VTPM, "Sending DMI's response to guest.\n");
-
-  status = TPM_SUCCESS;
-
- abort_with_error:
-
-  return status;
-}
-
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/vtpmd.c
--- a/tools/vtpm_manager/manager/vtpmd.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,371 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// vtpmd.c
-// 
-//  Application
-//
-// ===================================================================
-
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <string.h>
-#include <pthread.h>
-#include "vtpm_manager.h"
-#include "vtpmpriv.h"
-#include "tcg.h"
-#include "log.h"
-#include "vtpm_ipc.h"
-
-#define TPM_EMULATOR_PATH "/usr/bin/vtpmd"
-
-#define VTPM_BE_FNAME          "/dev/vtpm"
-#define VTPM_DUMMY_TX_BE_FNAME "/var/vtpm/fifos/dummy_out.fifo"
-#define VTPM_DUMMY_RX_BE_FNAME "/var/vtpm/fifos/dummy_in.fifo"
-#define VTPM_TX_TPM_FNAME      "/var/vtpm/fifos/tpm_cmd_to_%d.fifo"
-#define VTPM_RX_TPM_FNAME      "/var/vtpm/fifos/tpm_rsp_from_all.fifo"
-#define VTPM_TX_VTPM_FNAME     "/var/vtpm/fifos/vtpm_rsp_to_%d.fifo"
-#define VTPM_RX_VTPM_FNAME     "/var/vtpm/fifos/vtpm_cmd_from_all.fifo"
-#define VTPM_TX_HP_FNAME       "/var/vtpm/fifos/to_console.fifo"
-#define VTPM_RX_HP_FNAME       "/var/vtpm/fifos/from_console.fifo"
-
-#define VTPM_TYPE_PVM_STRING "pvm"
-#define VTPM_TYPE_HVM_STRING "hvm"
-
-struct vtpm_thread_params_s {
-  vtpm_ipc_handle_t *tx_ipc_h;
-  vtpm_ipc_handle_t *rx_ipc_h;
-  BOOL fw_tpm;
-  vtpm_ipc_handle_t *fw_tx_ipc_h;
-  vtpm_ipc_handle_t *fw_rx_ipc_h;
-  BOOL is_priv;
-  char *thread_name;
-};
-
-// This is needed to all extra_close_dmi to close this to prevent a
-// broken pipe when no DMIs are left.
-static vtpm_ipc_handle_t *g_rx_tpm_ipc_h;
-
-void *vtpm_manager_thread(void *arg_void) {
-  TPM_RESULT *status = (TPM_RESULT *) malloc(sizeof(TPM_RESULT) );
-  struct vtpm_thread_params_s *arg = (struct vtpm_thread_params_s *) arg_void;
-
-  *status = VTPM_Manager_Handler(arg->tx_ipc_h, arg->rx_ipc_h,
-                                 arg->fw_tpm, arg->fw_tx_ipc_h, arg->fw_rx_ipc_h,
-                                 arg->is_priv, arg->thread_name);
-
-  return (status);
-}
-
-
-void signal_handler(int reason) {
-  if (pthread_equal(pthread_self(), vtpm_globals->master_pid)) {
-    vtpmloginfo(VTPM_LOG_VTPM, "VTPM Manager shutting down for signal %d.\n", reason);
-  } else {
-    // For old Linux Thread machines, signals are delivered to each thread. Deal with them.
-    vtpmloginfo(VTPM_LOG_VTPM, "Child shutting down\n");
-    pthread_exit(NULL);
-  }
-
-  VTPM_Stop_Manager();
-  exit(-1);
-}
-
-struct sigaction ctl_c_handler;
-
-TPM_RESULT VTPM_New_DMI_Extra(VTPM_DMI_RESOURCE *dmi_res, BYTE vm_type, BYTE startup_mode) {
-
-  TPM_RESULT status = TPM_SUCCESS;
-  int fh;
-  char dmi_id_str[11]; // UINT32s are up to 10 digits + NULL
-  char *tx_vtpm_name, *tx_tpm_name, *vm_type_string;
-  struct stat file_info;
-
-  if (dmi_res->dmi_id == VTPM_CTL_DM) {
-    dmi_res->tx_tpm_ipc_h = NULL;
-    dmi_res->rx_tpm_ipc_h = NULL;
-    dmi_res->tx_vtpm_ipc_h = NULL;
-    dmi_res->rx_vtpm_ipc_h = NULL;
-  } else {
-    // Create a pair of fifo pipes
-    dmi_res->rx_tpm_ipc_h = NULL;
-    dmi_res->rx_vtpm_ipc_h = NULL;
-
-    if ( ((dmi_res->tx_tpm_ipc_h = (vtpm_ipc_handle_t *) malloc (sizeof(vtpm_ipc_handle_t))) == NULL ) ||
-         ((dmi_res->tx_vtpm_ipc_h =(vtpm_ipc_handle_t *) malloc (sizeof(vtpm_ipc_handle_t))) == NULL ) ||
-         ((tx_tpm_name = (char *) malloc(11 + strlen(VTPM_TX_TPM_FNAME))) == NULL ) ||
-         ((tx_vtpm_name =(char *) malloc(11 + strlen(VTPM_TX_VTPM_FNAME))) == NULL) ) {
-      status =TPM_RESOURCES;
-      goto abort_egress;
-    }
-
-    sprintf(tx_tpm_name, VTPM_TX_TPM_FNAME, (uint32_t) dmi_res->dmi_id);
-    sprintf(tx_vtpm_name, VTPM_TX_VTPM_FNAME, (uint32_t) dmi_res->dmi_id);
-
-    if ( (vtpm_ipc_init(dmi_res->tx_tpm_ipc_h, tx_tpm_name, O_WRONLY | O_NONBLOCK, TRUE) != 0) ||
-         (vtpm_ipc_init(dmi_res->tx_vtpm_ipc_h, tx_vtpm_name, O_WRONLY, TRUE) != 0) ) { //FIXME: O_NONBLOCK?
-      status = TPM_IOERROR;
-      goto abort_egress;
-    }
-
-    // Measure DMI
-    // FIXME: This will measure DMI. Until then use a fixed DMI_Measurement value
-    // Also, this mechanism is specific to 1 VM architecture.
-    /*
-    fh = open(TPM_EMULATOR_PATH, O_RDONLY);
-    stat_ret = fstat(fh, &file_stat);
-    if (stat_ret == 0)
-      dmi_size = file_stat.st_size;
-    else {
-      vtpmlogerror(VTPM_LOG_VTPM, "Could not open vtpmd!!\n");
-      status = TPM_IOERROR;
-      goto abort_egress;
-    }
-    dmi_buffer
-    */
-    memset(&dmi_res->DMI_measurement, 0xcc, sizeof(TPM_DIGEST));
-
-    if (vm_type == VTPM_TYPE_PVM)
-      vm_type_string = (BYTE *)&VTPM_TYPE_PVM_STRING;
-    else
-      vm_type_string = (BYTE *)&VTPM_TYPE_HVM_STRING;
-
-    // Launch DMI
-    sprintf(dmi_id_str, "%d", (int) dmi_res->dmi_id);
-#ifdef MANUAL_DM_LAUNCH
-    vtpmlogerror(VTPM_LOG_VTPM, "Manually start VTPM with dmi=%s now.\n", dmi_id_str);
-    dmi_res->dmi_pid = 0;
-#else
-    pid_t pid = fork();
-
-    if (pid == -1) {
-      vtpmlogerror(VTPM_LOG_VTPM, "Could not fork to launch vtpm\n");
-      status = TPM_RESOURCES;
-      goto abort_egress;
-    } else if (pid == 0) {
-      switch (startup_mode) {
-      case TPM_ST_CLEAR:
-        execl (TPM_EMULATOR_PATH, "vtpmd", "clear", vm_type_string, dmi_id_str, NULL);
-        break;
-      case TPM_ST_STATE:
-        execl (TPM_EMULATOR_PATH, "vtpmd", "save", vm_type_string, dmi_id_str, NULL);
-        break;
-      case TPM_ST_DEACTIVATED:
-        execl (TPM_EMULATOR_PATH, "vtpmd", "deactivated", vm_type_string, dmi_id_str, NULL);
-        break;
-      default:
-        status = TPM_BAD_PARAMETER;
-        goto abort_egress;
-      }
-
-      // Returning from these at all is an error.
-      vtpmlogerror(VTPM_LOG_VTPM, "Could not exec to launch vtpm\n");
-    } else {
-      dmi_res->dmi_pid = pid;
-      vtpmloginfo(VTPM_LOG_VTPM, "Launching DMI on PID = %d\n", pid);
-    }
-#endif // MANUAL_DM_LAUNCH
-
-  } // If DMI = VTPM_CTL_DM
-    status = TPM_SUCCESS;
-
-abort_egress:
-  return (status);
-}
-
-TPM_RESULT VTPM_Close_DMI_Extra(VTPM_DMI_RESOURCE *dmi_res) {
-  TPM_RESULT status = TPM_SUCCESS;
-
-  if (vtpm_globals->connected_dmis == 0) {
-    // No more DMI's connected. Close fifo to prevent a broken pipe.
-    // This is hackish. Need to think of another way.
-    vtpm_ipc_close(g_rx_tpm_ipc_h);
-  }
-
-  
-  if (dmi_res->dmi_id != VTPM_CTL_DM) {
-    vtpm_ipc_close(dmi_res->tx_tpm_ipc_h);
-    vtpm_ipc_close(dmi_res->tx_vtpm_ipc_h);
-
-    free(dmi_res->tx_tpm_ipc_h->name);
-    free(dmi_res->tx_vtpm_ipc_h->name);
-
-#ifndef MANUAL_DM_LAUNCH
-    if (dmi_res->dmi_id != VTPM_CTL_DM) {
-      if (dmi_res->dmi_pid != 0) {
-        vtpmloginfo(VTPM_LOG_VTPM, "Killing dmi on pid %d.\n", dmi_res->dmi_pid);
-        if (kill(dmi_res->dmi_pid, SIGKILL) !=0) {
-          vtpmloginfo(VTPM_LOG_VTPM, "DMI on pid %d is already dead.\n", dmi_res->dmi_pid);
-        } else if (waitpid(dmi_res->dmi_pid, NULL, 0) != dmi_res->dmi_pid) {
-          vtpmlogerror(VTPM_LOG_VTPM, "DMI on pid %d failed to stop.\n", dmi_res->dmi_pid);
-          status = TPM_FAIL;
-        }
-      } else {
-        vtpmlogerror(VTPM_LOG_VTPM, "Could not kill dmi because it's pid was 0.\n");
-        status = TPM_FAIL;
-      }
-    }
-#endif
-
-  } //endif ! dom0
-  return status;
-}
-
-
-int main(int argc, char **argv) {
-  vtpm_ipc_handle_t *tx_be_ipc_h, *rx_be_ipc_h, rx_tpm_ipc_h, rx_vtpm_ipc_h, tx_hp_ipc_h, rx_hp_ipc_h; 
-  struct vtpm_thread_params_s be_thread_params, dmi_thread_params, hp_thread_params;
-  pthread_t be_thread, dmi_thread, hp_thread;
-
-#ifdef DUMMY_BACKEND
-  vtpm_ipc_handle_t tx_dummy_ipc_h, rx_dummy_ipc_h;
-#else
-  vtpm_ipc_handle_t real_be_ipc_h;
-#endif
-
-  vtpmloginfo(VTPM_LOG_VTPM, "Starting VTPM.\n");
- 
-  // -------------------- Initialize Manager ----------------- 
-  if (VTPM_Init_Manager() != TPM_SUCCESS) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Closing vtpmd due to error during startup.\n");
-    return -1;
-  }
-  
-  // -------------------- Setup Ctrl+C Handlers --------------
-  ctl_c_handler.sa_handler = signal_handler;
-  sigemptyset(&ctl_c_handler.sa_mask);
-  ctl_c_handler.sa_flags = 0;    
-  
-  if (sigaction(SIGINT, &ctl_c_handler, NULL) == -1) 
-    vtpmlogerror(VTPM_LOG_VTPM, "Could not install SIGINT handler. Ctl+break will not stop manager gently.\n");
-  
-  // For easier debuggin with gdb
-  if (sigaction(SIGHUP, &ctl_c_handler, NULL) == -1) 
-    vtpmlogerror(VTPM_LOG_VTPM, "Could not install SIGHUP handler. Ctl+break will not stop manager gently.\n");    
-  
-  sigset_t sig_mask;
-  sigemptyset(&sig_mask);
-  sigaddset(&sig_mask, SIGPIPE);
-  sigprocmask(SIG_BLOCK, &sig_mask, NULL);
-  
-  // ------------------- Set up file ipc structures ----------
-#ifdef DUMMY_BACKEND
-  if ( (vtpm_ipc_init(&tx_dummy_ipc_h, VTPM_DUMMY_TX_BE_FNAME, O_RDWR, TRUE) != 0) ||
-       (vtpm_ipc_init(&rx_dummy_ipc_h, VTPM_DUMMY_RX_BE_FNAME, O_RDWR, TRUE) != 0) ) {
-
-    vtpmlogerror(VTPM_LOG_VTPM, "Unable to create Dummy BE FIFOs.\n");
-    exit(-1);
-  }
-
-  tx_be_ipc_h = &tx_dummy_ipc_h;
-  rx_be_ipc_h = &rx_dummy_ipc_h;
-#else
-  vtpm_ipc_init(&real_be_ipc_h, VTPM_BE_FNAME, O_RDWR, FALSE);
-
-  tx_be_ipc_h = &real_be_ipc_h;
-  rx_be_ipc_h = &real_be_ipc_h;
-#endif
-
-  if ( (vtpm_ipc_init(&rx_tpm_ipc_h, VTPM_RX_TPM_FNAME, O_RDONLY, TRUE) != 0) ||
-       (vtpm_ipc_init(&rx_vtpm_ipc_h, VTPM_RX_VTPM_FNAME, O_RDWR, TRUE) != 0) || //FIXME: O_RDONLY?
-       (vtpm_ipc_init(&tx_hp_ipc_h,  VTPM_TX_HP_FNAME, O_RDWR, TRUE) != 0)    ||
-       (vtpm_ipc_init(&rx_hp_ipc_h,  VTPM_RX_HP_FNAME, O_RDWR, TRUE) != 0) ) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Unable to create initial FIFOs.\n");
-    exit(-1);
-  }
-
-  g_rx_tpm_ipc_h = &rx_tpm_ipc_h;
-
-  // -------------------- Set up thread params ------------- 
-
-  be_thread_params.tx_ipc_h = tx_be_ipc_h;
-  be_thread_params.rx_ipc_h = rx_be_ipc_h;
-  be_thread_params.fw_tpm = TRUE;
-  be_thread_params.fw_tx_ipc_h = NULL;
-  be_thread_params.fw_rx_ipc_h = &rx_tpm_ipc_h;
-  be_thread_params.is_priv = FALSE;
-  be_thread_params.thread_name = "Backend Listener";
-
-  dmi_thread_params.tx_ipc_h = NULL;
-  dmi_thread_params.rx_ipc_h = &rx_vtpm_ipc_h;
-  dmi_thread_params.fw_tpm = FALSE; 
-  dmi_thread_params.fw_tx_ipc_h = NULL;
-  dmi_thread_params.fw_rx_ipc_h = NULL;
-  dmi_thread_params.is_priv = FALSE; 
-  dmi_thread_params.thread_name = "VTPM Listener";
-
-  hp_thread_params.tx_ipc_h = &tx_hp_ipc_h;
-  hp_thread_params.rx_ipc_h = &rx_hp_ipc_h;
-  hp_thread_params.fw_tpm = FALSE;
-  hp_thread_params.fw_tx_ipc_h = NULL;
-  hp_thread_params.fw_rx_ipc_h = NULL;
-  hp_thread_params.is_priv = TRUE;
-  hp_thread_params.thread_name = "Hotplug Listener";
-
-  // --------------------- Launch Threads -----------------
-
-  vtpm_lock_init();
-
-  vtpm_globals->master_pid = pthread_self();
-  
-  if (pthread_create(&be_thread, NULL, vtpm_manager_thread, &be_thread_params) != 0) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Failed to launch BE Thread.\n");
-    exit(-1);
-  }
-  
-  if (pthread_create(&dmi_thread, NULL, vtpm_manager_thread, &dmi_thread_params) != 0) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Failed to launch DMI Thread.\n");
-    exit(-1);
-  }
-
- 
-  if (pthread_create(&hp_thread, NULL, vtpm_manager_thread, &hp_thread_params) != 0) {
-    vtpmlogerror(VTPM_LOG_VTPM, "Failed to launch HP Thread.\n");
-    exit(-1);
-  }
- 
-  //Join the other threads until exit time.
-  pthread_join(be_thread, NULL);
-  pthread_join(dmi_thread, NULL);
-  pthread_join(hp_thread, NULL);
- 
-  vtpmlogerror(VTPM_LOG_VTPM, "VTPM Manager shut down unexpectedly.\n");
- 
-  VTPM_Stop_Manager();
-  vtpm_lock_destroy();
-  return 0;
-}
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/vtpmpriv.h
--- a/tools/vtpm_manager/manager/vtpmpriv.h	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// vtpmpriv.h
-// 
-//  Structures and functions private to the manager
-//
-// ==================================================================
-
-#ifndef __VTPMPRIV_H__
-#define __VTPMPRIV_H__
-
-#include "vtpm_manager.h"
-#include "tcg.h"
-#include "tcs.h"
-#include "buffer.h"
-#include "crypto.h"
-#include "vtpm_ipc.h"
-
-#define VTPM_MANAGER_GEN   2     // This is incremented when the manager's table
-                                 // is changed. It's used for backwards compatability
-
-#define STATE_FILE         "/var/vtpm/VTPM"
-#define DMI_NVM_FILE       "/var/vtpm/vtpm_dm_%d.data"
-#define VTPM_CTL_DM        0
-
-// ------------------------ Private Structures -----------------------
-typedef struct VTPM_DMI_RESOURCE_T {
-  // I/O info for Manager to talk to DMI's and controllers
-  vtpm_ipc_handle_t      *tx_vtpm_ipc_h;    // TX VTPM Results to DMI
-  vtpm_ipc_handle_t      *rx_vtpm_ipc_h;    // RX VTPM Commands from DMI
-  vtpm_ipc_handle_t      *tx_tpm_ipc_h;     // TX TPM Commands to DMI
-  vtpm_ipc_handle_t      *rx_tpm_ipc_h;     // RX TPM Results from DMI
- 
-#ifndef VTPM_MULTI_VM 
-  pid_t                 dmi_pid;
-#endif
-
-  // Non-persistent Information
-  bool                  connected;
-  UINT32                dmi_domain_id;
-  TCS_CONTEXT_HANDLE    TCSContext;     // TCS Handle
-  char                  *NVMLocation;   // NULL term string indicating location
-                                        // of NVM.
-  // Persistent Information about DMI
-  UINT32                dmi_id;
-  BYTE                  dmi_type;
-  TPM_DIGEST            NVM_measurement;  // Equal to the SHA1 of the blob
-  TPM_DIGEST            DMI_measurement;  // Correct measurement of the owning DMI
-} VTPM_DMI_RESOURCE;
-
-typedef struct tdVTPM_MIGKEY_LIST {
-  UINT32                name_size;
-  BYTE                  *name; // Name of destination (IP addr, domain name, etc)
-  CRYPTO_INFO           key;
-  struct tdVTPM_MIGKEY_LIST *next;
-} VTPM_MIGKEY_LIST;
-
-
-typedef struct tdVTPM_GLOBALS {
-  // Non-persistent data
-#ifndef VTPM_MULTI_VM
-  pid_t               master_pid;
-#endif
-
-  int                 connected_dmis;     // To close guest_rx when no dmis are connected
-
-  struct hashtable    *dmi_map;               // Table of all DMI's known indexed by persistent instance #
-  VTPM_MIGKEY_LIST    *mig_keys;              // Table of migration keys
-                      // Currently keys are loaded at migration time,
-                      // TODO: Make VTPM man store a keys persistently
-                      //       and update script to check if key is needed
-                      //       before fetching it.
-
-  TCS_CONTEXT_HANDLE  manager_tcs_handle;     // TCS Handle used by manager
-  TPM_HANDLE          storageKeyHandle;       // Key used by persistent store
-  CRYPTO_INFO         storageKey;             // For software encryption
-  CRYPTO_INFO         bootKey;                // For saving table
-  TCS_AUTH            keyAuth;                // OIAP session for storageKey 
-    
-  // Persistent Data
-  TPM_AUTHDATA        owner_usage_auth;       // OwnerAuth of real TPM
-  buffer_t            storageKeyWrap;         // Wrapped copy of storageKey
-  TPM_AUTHDATA        srk_usage_auth;
-  TPM_AUTHDATA        storage_key_usage_auth; 
-
-  buffer_t            bootKeyWrap;            // Wrapped copy of boot key 
-
-}VTPM_GLOBALS;
-
-// --------------------------- Global Values --------------------------
-extern VTPM_GLOBALS *vtpm_globals;   // Key info and DMI states
-extern const TPM_AUTHDATA SRK_AUTH;  // SRK Well Known Auth Value
-
-// ********************** VTPM Functions *************************
-TPM_RESULT VTPM_Init_Manager(); // Start VTPM Service
-void VTPM_Stop_Manager();  // Stop VTPM Service
-TPM_RESULT VTPM_Manager_Handler(vtpm_ipc_handle_t *tx_ipc_h,
-                                vtpm_ipc_handle_t *rx_ipc_h,
-                                BOOL fw_tpm,   // Should forward TPM cmds
-                                vtpm_ipc_handle_t *fw_tx_ipc_h,
-                                vtpm_ipc_handle_t *fw_rx_ipc_h,
-                                BOOL is_priv,
-                                char *client_name);
-
-// ********************** Command Handler Prototypes ***********************
-
-TPM_RESULT VTPM_Handle_Load_NVM(       VTPM_DMI_RESOURCE *myDMI, 
-                                        const buffer_t *inbuf, 
-                                        buffer_t *outbuf);
-
-TPM_RESULT VTPM_Handle_Save_NVM(       VTPM_DMI_RESOURCE *myDMI, 
-                                        const buffer_t *inbuf, 
-                                        buffer_t *outbuf);
-
-TPM_RESULT VTPM_Handle_TPM_Command(    VTPM_DMI_RESOURCE *dmi, 
-                                        buffer_t *inbuf, 
-                                        buffer_t *outbuf);
-
-TPM_RESULT VTPM_Handle_New_DMI(const buffer_t *param_buf);
-                                
-TPM_RESULT VTPM_Handle_Close_DMI(const buffer_t *param_buf);
-                                   
-TPM_RESULT VTPM_Handle_Delete_DMI(const buffer_t *param_buf);
-
-TPM_RESULT VTPM_Handle_Migrate_In( const buffer_t *param_buf,
-                                   buffer_t *result_buf);
-
-TPM_RESULT VTPM_Handle_Migrate_Out ( const buffer_t *param_buf,
-                                     buffer_t *result_buf);
-
-TPM_RESULT VTPM_Handle_Get_Migration_key( const buffer_t *param_buf,
-                                          buffer_t *result_buf);
-
-TPM_RESULT VTPM_SaveManagerData(void);
-TPM_RESULT VTPM_LoadManagerData(void);
-
-TPM_RESULT VTPM_New_DMI_Extra(VTPM_DMI_RESOURCE *dmi_res, BYTE vm_type, BYTE startup_mode);
-
-TPM_RESULT VTPM_Close_DMI_Extra(VTPM_DMI_RESOURCE *dmi_res);
-
-// Helper functions
-TPM_RESULT close_dmi(VTPM_DMI_RESOURCE *dmi_res);
-TPM_RESULT init_dmi(UINT32 dmi_id, BYTE type,  VTPM_DMI_RESOURCE **dmi_res);
-
-TPM_RESULT envelope_encrypt(const buffer_t     *inbuf,
-                             CRYPTO_INFO        *asymkey,
-                             buffer_t           *sealed_data);
-
-TPM_RESULT envelope_decrypt(const buffer_t     *cipher,
-                            TCS_CONTEXT_HANDLE TCSContext,
-                            TPM_HANDLE         keyHandle,
-                            const TPM_AUTHDATA *key_usage_auth,
-                            buffer_t           *unsealed_data);
-
-#endif // __VTPMPRIV_H__
diff -r 2a4c1d3a080e -r 170d45f7a2eb tools/vtpm_manager/manager/vtsp.c
--- a/tools/vtpm_manager/manager/vtsp.c	Tue Nov 13 10:46:59 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1042 +0,0 @@
-// ===================================================================
-// 
-// Copyright (c) 2005, Intel Corp.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without 
-// modification, are permitted provided that the following conditions 
-// are met:
-//
-//   * Redistributions of source code must retain the above copyright 
-//     notice, this list of conditions and the following disclaimer.
-//   * 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.
-//   * Neither the name of Intel Corporation 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 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.
-// ===================================================================
-// 
-// vtsp.c
-// 
-//  Higher level interface to TCS for use in service.
-//
-// ==================================================================
-
-#include <string.h>
-#include "tcg.h"
-#include "tcs.h"
-#include "bsg.h"
-#include "log.h"
-#include "crypto.h"
-#include "vtsp.h"
-#include "buffer.h"
-
-#define  RSA_KEY_SIZE 0x0800
-
-/***********************************************************************************
- * GenerateAuth: Generate authorization info to be sent back to application
- *
- * Parameters: outParamDigestText  The concatenation of output parameters to be SHA1ed
- *    outParamDigestTextSize Size of inParamDigestText
- *    HMACkey     Key to be used for HMACing
- *          For OIAP use key.authUsage or PersistStore.ownerAuth
- *          For OSAP use shared secret
- *    pAuth     Authorization information from the application
- *
- * Return:  TPM_SUCCESS   Authorization data created
- *    TPM_AUTHFAIL   Invalid (NULL) HMACkey presented for OSAP
- *************************************************************************************/
-TPM_RESULT GenerateAuth( /*[IN]*/ const BYTE *inParamDigestText,
-			 /*[IN]*/ UINT32 inParamDigestTextSize,
-			 /*[IN]*/ const TPM_SECRET *HMACkey,  
-			 /*[IN,OUT]*/ TCS_AUTH *auth) {
-    
-  if (inParamDigestText == NULL || auth == NULL) 
-    return (TPM_AUTHFAIL);
-  else {
-    
-    //Generate new OddNonce
-    Crypto_GetRandom(auth->NonceOdd.nonce, sizeof(TPM_NONCE));
-    
-    // Create SHA1 inParamDigest
-    TPM_DIGEST inParamDigest;
-    Crypto_SHA1Full(inParamDigestText, inParamDigestTextSize, (BYTE *) &inParamDigest);
-    
-    // Create HMAC text. (Concat inParamsDigest with inAuthSetupParams).
-    BYTE hmacText[sizeof(TPM_DIGEST) + (2 * sizeof(TPM_NONCE)) + sizeof(BOOL)];
-    
-    BSG_PackList(   hmacText, 4, 
-		    BSG_TPM_DIGEST, &inParamDigest,
-		    BSG_TPM_NONCE, &(auth->NonceEven),
-		    BSG_TPM_NONCE, &(auth->NonceOdd), 
-		    BSG_TYPE_BOOL, &(auth->fContinueAuthSession) );
-    
-    Crypto_HMAC((BYTE *) hmacText, sizeof(hmacText), (BYTE *) HMACkey, sizeof(TPM_DIGEST), (BYTE *) &(auth->HMAC));
-    
-    return(TPM_SUCCESS);
-    
-  }
-}
-
-/***********************************************************************************
- * VerifyAuth: Verify the authdata for a command requiring authorization
- *
- * Parameters: inParamDigestText  The concatenation of parameters to be SHA1ed
- *    inParamDigestTextSize Size of inParamDigestText
- *    authDataUsage   AuthDataUsage for the Entity being used
- *          Key->authDataUsage or TPM_AUTH_OWNER
- *    HMACkey     Key to be used for HMACing
- *          For OIAP use key.authUsage or PersistStore.ownerAuth
- *          For OSAP use NULL (It will be aquired from the Auth Session)
- *          If unknown (default), assume OIAP
- *    sessionAuth    A TCS_AUTH info for the session
- *    pAuth     Authorization information from the application
- *              hContext        If specified, on failed Auth, VerifyAuth will
- *                                      generate a new OIAP session in place of themselves
- *                                      destroyed session.
- *
- * Return:  TPM_SUCCESS   Authorization Verified
- *    TPM_AUTHFAIL   Authorization Failed
- *    TPM_FAIL    Failure during SHA1 routines
- *************************************************************************************/
-TPM_RESULT VerifyAuth( /*[IN]*/ const BYTE *outParamDigestText,
-		       /*[IN]*/ UINT32 outParamDigestTextSize,
-		       /*[IN]*/ const TPM_SECRET *HMACkey,  
-		       /*[IN,OUT]*/ TCS_AUTH *auth,
-		       /*[IN]*/  TCS_CONTEXT_HANDLE hContext) {
-  if (outParamDigestText == NULL || auth == NULL) 
-    return (TPM_AUTHFAIL);
-  
-  
-  // Create SHA1 inParamDigest
-  TPM_DIGEST outParamDigest;
-  Crypto_SHA1Full(outParamDigestText, outParamDigestTextSize, (BYTE *) &outParamDigest);
-  
-  // Create HMAC text. (Concat inParamsDigest with inAuthSetupParams).
-  TPM_DIGEST hm;
-  BYTE hmacText[sizeof(TPM_DIGEST) + (2 * sizeof(TPM_NONCE)) + sizeof(BOOL)];
-  
-  BSG_PackList(   hmacText, 4, 
-		  BSG_TPM_DIGEST, &outParamDigest,
-		  BSG_TPM_NONCE, &(auth->NonceEven),
-		  BSG_TPM_NONCE, &(auth->NonceOdd), 
-		  BSG_TYPE_BOOL, &(auth->fContinueAuthSession) );
-  
-  Crypto_HMAC((BYTE *) hmacText, sizeof(hmacText),
-	      (BYTE *) HMACkey, sizeof(TPM_DIGEST), (BYTE *) &hm);
-    
-  // Compare correct HMAC with provided one.
-  if (memcmp (&hm, &(auth->HMAC), sizeof(TPM_DIGEST)) == 0) { // 0 indicates equality
-    if (!auth->fContinueAuthSession) 
-      vtpmloginfo(VTPM_LOG_VTSP_DEEP, "Auth Session: 0x%x closed by TPM by fContinue=0.\n", auth->AuthHandle);
-    
-    return (TPM_SUCCESS);
-  } else {
-    // If specified, reconnect the OIAP session.
-    // NOTE: This only works for TCS's that never have a 0 context. 
-    if (hContext) {
-      vtpmloginfo(VTPM_LOG_VTSP_DEEP, "Auth Session: 0x%x closed by TPM due to failure.\n", auth->AuthHandle);
-      VTSP_OIAP( hContext, auth);
-    }
-    return (TPM_AUTHFAIL);
-  }
-}
-
-TPM_RESULT VTSP_OIAP(const TCS_CONTEXT_HANDLE hContext,
-		     TCS_AUTH *auth) {
-  
-  vtpmloginfo(VTPM_LOG_VTSP, "OIAP.\n");
-  TPM_RESULT status = TPM_SUCCESS;                           
-  TPMTRYRETURN( TCSP_OIAP(hContext,
-			  &auth->AuthHandle,
-			  &auth->NonceEven) );
-
-  memset(&auth->HMAC, 0, sizeof(TPM_DIGEST));
-  auth->fContinueAuthSession = FALSE;
-
-  vtpmloginfo(VTPM_LOG_VTSP_DEEP, "Auth Session: 0x%x opened by TPM_OIAP.\n", auth->AuthHandle);
-  goto egress;
-  
- abort_egress:
-  
- egress:
-  
-  return status;
-}
-
-TPM_RESULT VTSP_OSAP(const TCS_CONTEXT_HANDLE hContext,
-		     const TPM_ENTITY_TYPE entityType,
-		     const UINT32 entityValue,
-		     const TPM_AUTHDATA *usageAuth,
-		     TPM_SECRET *sharedSecret, 
-		     TCS_AUTH *auth) {
-  
-  vtpmloginfo(VTPM_LOG_VTSP, "OSAP.\n");
-  TPM_RESULT status = TPM_SUCCESS;
-  TPM_NONCE nonceEvenOSAP, nonceOddOSAP;
-  
-  Crypto_GetRandom((BYTE *) &nonceOddOSAP, sizeof(TPM_NONCE) ); 
-  
-  TPMTRYRETURN( TCSP_OSAP(    hContext,
-			      entityType,
-			      entityValue, 
-			      nonceOddOSAP,
-			      &auth->AuthHandle, 
-			      &auth->NonceEven, 
-			      &nonceEvenOSAP) );
-  
-  // Calculating Session Secret
-  BYTE sharedSecretText[TPM_DIGEST_SIZE * 2];
-  
-  BSG_PackList(  sharedSecretText, 2,
-		 BSG_TPM_NONCE, &nonceEvenOSAP,
-		 BSG_TPM_NONCE, &nonceOddOSAP);
-  
-  Crypto_HMAC(sharedSecretText, sizeof(sharedSecretText), (BYTE *) usageAuth, TPM_DIGEST_SIZE, (BYTE *) sharedSecret);       
-
-  memset(&auth->HMAC, 0, sizeof(TPM_DIGEST));
-  auth->fContinueAuthSession = FALSE;
-   
-  vtpmloginfo(VTPM_LOG_VTSP_DEEP, "Auth Session: 0x%x opened by TPM_OSAP.\n", auth->AuthHandle);
-
-  goto egress;
-  
- abort_egress:
-  
- egress:
-  
-  return status;
-}
-
-
-TPM_RESULT VTSP_TerminateHandle(const TCS_CONTEXT_HANDLE hContext,
-                                const TCS_AUTH *auth) {
-
-  vtpmloginfo(VTPM_LOG_VTSP, "Terminate Handle.\n");
-  TPM_RESULT status = TPM_SUCCESS;
-  TPMTRYRETURN( TCSP_TerminateHandle(hContext, auth->AuthHandle) );
-
-  vtpmloginfo(VTPM_LOG_VTSP_DEEP, "Auth Session: 0x%x closed by TPM_TerminateHandle.\n", auth->AuthHandle);
-  goto egress;
-
- abort_egress:
-
- egress:
-
-  return status;
-}
-
-
-TPM_RESULT VTSP_ReadPubek(   const TCS_CONTEXT_HANDLE hContext,
-                             CRYPTO_INFO *crypto_info) {
-  
-  TPM_RESULT status;
-  TPM_NONCE antiReplay;
-  TPM_DIGEST   checksum;
-  BYTE *pubEKtext;
-  UINT32 pubEKtextsize;
-  
-  vtpmloginfo(VTPM_LOG_VTSP, "Reading Public EK.\n");
-  
-  // GenerateAuth new nonceOdd    
-  Crypto_GetRandom(&antiReplay, sizeof(TPM_NONCE) );
-  
-  
-  TPMTRYRETURN( TCSP_ReadPubek(  hContext,
-				 antiReplay,
-				 &pubEKtextsize,
-				 &pubEKtext,
-				 &checksum) );
-  
-  
-  // Extract the remaining output parameters
-  TPM_PUBKEY pubEK;
-  
-  BSG_Unpack(BSG_TPM_PUBKEY, pubEKtext, (BYTE *) &pubEK);
-  
-  // Build CryptoInfo for the bindingKey
-  TPM_RSA_KEY_PARMS rsaKeyParms;
-  
-  BSG_Unpack(BSG_TPM_RSA_KEY_PARMS, 
-	     pubEK.algorithmParms.parms, 
-	     &rsaKeyParms);
-  
-  Crypto_RSABuildCryptoInfoPublic(rsaKeyParms.exponentSize, 
-				  rsaKeyParms.exponent, 
-				  pubEK.pubKey.keyLength, 
-				  pubEK.pubKey.key, 
-				  crypto_info);
-    
-  // Destroy rsaKeyParms
-  BSG_Destroy(BSG_TPM_RSA_KEY_PARMS, &rsaKeyParms);
-
-  // Set encryption scheme
-  crypto_info->encScheme = CRYPTO_ES_RSAESOAEP_SHA1_MGF1;
-  //crypto_info->encScheme = pubEK.algorithmParms.encScheme;
-  crypto_info->algorithmID = pubEK.algorithmParms.algorithmID;
-  
-  goto egress;
-  
- abort_egress:
-  
- egress:
-  
-  return status;
-}
-
-TPM_RESULT VTSP_TakeOwnership(   const TCS_CONTEXT_HANDLE hContext,
-                                 const TPM_AUTHDATA *ownerAuth, 
-                                 const TPM_AUTHDATA *srkAuth,
-                                 CRYPTO_INFO *ek_cryptoInfo,
-                                 TCS_AUTH *auth) {
-  
-  vtpmloginfo(VTPM_LOG_VTSP, "Taking Ownership of TPM.\n");
-  
-  TPM_RESULT status = TPM_SUCCESS;
-  TPM_COMMAND_CODE command = TPM_ORD_TakeOwnership;
-  TPM_PROTOCOL_ID proto_id = TPM_PID_OWNER;
-  BYTE *new_srk;
-  
-  BYTE *paramText;        // Digest to make Auth.
-  UINT32 paramTextSize;
-  
-  // vars for srkpubkey parameter
-  TPM_KEY srkPub;
-  TPM_KEY_PARMS srkKeyInfo = {TPM_ALG_RSA, TPM_ES_RSAESOAEP_SHA1_MGF1, TPM_SS_NONE, 12, 0};
-  BYTE srkRSAkeyInfo[12] = { 0x00, 0x00, (RSA_KEY_SIZE >> 8), 0x00,   0x00, 0x00, 0x00, 0x02,   0x00, 0x00, 0x00, 0x00};
-  srkKeyInfo.parms = (BYTE *) &srkRSAkeyInfo;
-  
-  struct pack_buf_t srkText;
-  
-  //These values are accurate for an enc(AuthData).
-  struct pack_buf_t encOwnerAuth, encSrkAuth;
-  
-  encOwnerAuth.data = (BYTE *)malloc(sizeof(BYTE) * 256);
-  encSrkAuth.data = (BYTE *)malloc(sizeof(BYTE) * 256);
-  
-  if (encOwnerAuth.data == NULL || encSrkAuth.data == NULL) {
-    vtpmloginfo(VTPM_LOG_VTSP, "Could not malloc encrypted auths.\n");
-    status = TPM_RESOURCES;
-    goto abort_egress;
-  }
-  
-  Crypto_RSAEnc(ek_cryptoInfo, sizeof(TPM_SECRET), (BYTE *) ownerAuth, &encOwnerAuth.size, encOwnerAuth.data);
-  Crypto_RSAEnc(ek_cryptoInfo, sizeof(TPM_SECRET), (BYTE *) srkAuth, &encSrkAuth.size, encSrkAuth.data);
-  
-  
-  // Build srk public key struct
-  srkPub.ver = TPM_STRUCT_VER_1_1;
-  srkPub.keyUsage = TPM_KEY_STORAGE;
-  srkPub.keyFlags = 0x00;
-  srkPub.authDataUsage = TPM_AUTH_ALWAYS;
-  memcpy(&srkPub.algorithmParms, &srkKeyInfo, sizeof(TPM_KEY_PARMS));
-  srkPub.PCRInfoSize = 0;
-  srkPub.PCRInfo = 0;
-  srkPub.pubKey.keyLength= 0;
-  srkPub.encDataSize = 0;
-  
-  srkText.data = (BYTE *) malloc(sizeof(BYTE) * TCPA_MAX_BUFFER_LENGTH);
-  srkText.size = BSG_Pack(BSG_TPM_KEY, (BYTE *) &srkPub, srkText.data);
-  
-  paramText = (BYTE *) malloc(sizeof(BYTE) *  TCPA_MAX_BUFFER_LENGTH);
-  
-  paramTextSize = BSG_PackList(paramText, 5,
-			       BSG_TPM_COMMAND_CODE,&command,
-			       BSG_TPM_PROTOCOL_ID, &proto_id,
-			       BSG_TPM_SIZE32_DATA, &encOwnerAuth,
-			       BSG_TPM_SIZE32_DATA, &encSrkAuth,
-			       BSG_TPM_KEY, &srkPub);
-  
-  TPMTRYRETURN( GenerateAuth( paramText, paramTextSize, ownerAuth, auth) );
-  
-  new_srk = srkText.data;
-  TPMTRYRETURN( TCSP_TakeOwnership ( hContext,
-				     proto_id,
-				     encOwnerAuth.size, 
-				     encOwnerAuth.data,
-				     encSrkAuth.size,
-				     encSrkAuth.data,
-				     &srkText.size,
-				     &new_srk, 
-				     auth ) );
-  
-  
-  paramTextSize = BSG_PackList(paramText, 2, 
-			       BSG_TPM_RESULT, &status,
-			       BSG_TPM_COMMAND_CODE, &command);
-  memcpy(paramText + paramTextSize, new_srk, srkText.size);
-  paramTextSize += srkText.size;
-  
-  
-  TPMTRYRETURN( VerifyAuth(  paramText, paramTextSize,
-			     ownerAuth, auth, 
-			     hContext) );
-  
-  goto egress;
-  
- abort_egress:
-  
- egress:
-  
-  free(srkText.data);
-  free(encSrkAuth.data);
-  free(encOwnerAuth.data);
-  free(paramText);
-  
-  TCS_FreeMemory(hContext, new_srk);
-  
-  return status;
-}
-
-TPM_RESULT VTSP_DisablePubekRead( const TCS_CONTEXT_HANDLE    hContext,
-                                  const TPM_AUTHDATA          *ownerAuth, 
-                                  TCS_AUTH                    *auth) {
-  
-  vtpmloginfo(VTPM_LOG_VTSP, "Disabling Pubek Read.\n");
-  
-  TPM_RESULT status = TPM_SUCCESS;
-  TPM_COMMAND_CODE command = TPM_ORD_DisablePubekRead;
-  
-  BYTE *paramText;        // Digest to make Auth.
-  UINT32 paramTextSize;
-    
-  paramText = (BYTE *) malloc(sizeof(BYTE) * TCPA_MAX_BUFFER_LENGTH);
-  
-  paramTextSize = BSG_PackList(paramText, 1,
-			       BSG_TPM_COMMAND_CODE, &command);
-  
-  TPMTRYRETURN( GenerateAuth( paramText, paramTextSize,
-			      ownerAuth, auth) );
-  
-  // Call TCS
-  TPMTRYRETURN( TCSP_DisablePubekRead ( hContext, // in
-                                        auth) );
-  
-  // Verify Auth
-  paramTextSize = BSG_PackList(paramText, 2,
-			       BSG_TPM_RESULT, &status,
-			       BSG_TPM_COMMAND_CODE, &command);
-  
-  TPMTRYRETURN( VerifyAuth( paramText, paramTextSize,
-			    ownerAuth, auth, 
-			    hContext) );
-  goto egress;
-  
- abort_egress:
- egress:
-  free(paramText);
-  return status;
-}
-
-TPM_RESULT VTSP_CreateWrapKey(  const TCS_CONTEXT_HANDLE hContext,
-                                const TPM_KEY_USAGE      usage,
-                                const TPM_AUTHDATA       *newKeyAuth,
-                                const TCS_KEY_HANDLE     parentHandle, 
-                                const TPM_AUTHDATA       *osapSharedSecret,
-                                buffer_t                 *pubKeyBuf,
-                                TCS_AUTH                 *auth) {
-  
-  int i;
-  TPM_RESULT status = TPM_SUCCESS;
-  TPM_COMMAND_CODE command = TPM_ORD_CreateWrapKey;
-  
-  vtpmloginfo(VTPM_LOG_VTSP, "Creating new key of type %d.\n", usage);
-  
-  // vars for Calculate encUsageAuth
-  BYTE *paramText;      
-  UINT32 paramTextSize;
-  
-  // vars for Calculate encUsageAuth
-  BYTE XORbuffer[sizeof(TPM_SECRET) + sizeof(TPM_NONCE)];
-  TPM_DIGEST XORKey1;
-  UINT32 XORbufferSize;
-  TPM_SECRET encUsageAuth, encMigrationAuth;
-  
-  // vars for Flatten newKey prototype
-  BYTE *flatKey = (BYTE *) malloc(sizeof(BYTE) *  TCPA_MAX_BUFFER_LENGTH);
-  UINT32 flatKeySize = TCPA_MAX_BUFFER_LENGTH;                                    
-  struct pack_buf_t newKeyText;
-  
-  // Fill in newKey
-  TPM_KEY newKey;
-  
-  BYTE RSAkeyInfo[12] = { 0x00, 0x00, (RSA_KEY_SIZE >> 8), 0x00,   0x00, 0x00, 0x00, 0x02,   0x00, 0x00, 0x00, 0x00};
-  newKey.algorithmParms.algorithmID = TPM_ALG_RSA;
-  newKey.algorithmParms.parms = (BYTE *) &RSAkeyInfo;
-  newKey.algorithmParms.parmSize = 12;
-  
-  switch (usage) {
-  case TPM_KEY_SIGNING:
-    vtpmloginfo(VTPM_LOG_VTSP, "Creating Signing Key...\n");
-    newKey.keyUsage = TPM_KEY_SIGNING;
-    newKey.algorithmParms.encScheme = TPM_ES_NONE;
-    newKey.algorithmParms.sigScheme = TPM_SS_RSASSAPKCS1v15_SHA1;
-    break;
-  case TPM_KEY_STORAGE:
-    vtpmloginfo(VTPM_LOG_VTSP, "Creating Storage Key...\n");
-    newKey.keyUsage = TPM_KEY_STORAGE;
-    newKey.algorithmParms.encScheme = TPM_ES_RSAESOAEP_SHA1_MGF1;
-    newKey.algorithmParms.sigScheme = TPM_SS_NONE;
-    break;
-  case TPM_KEY_BIND:
-    vtpmloginfo(VTPM_LOG_VTSP, "Creating Binding Key...\n");
-    newKey.keyUsage = TPM_KEY_BIND;
-    newKey.algorithmParms.encScheme = TPM_ES_RSAESOAEP_SHA1_MGF1;
-    newKey.algorithmParms.sigScheme = TPM_SS_NONE;
-    break;
-  default:
-    vtpmloginfo(VTPM_LOG_VTSP, "Cannot create key. Invalid Key Type.\n");
-    status = TPM_BAD_PARAMETER;
-    goto abort_egress;
-  }
-  
-  
-  newKey.ver = TPM_STRUCT_VER_1_1;
-  
-  newKey.keyFlags = 0;
-  newKey.authDataUsage = TPM_AUTH_ALWAYS;
-  newKey.pubKey.keyLength= 0;
-  newKey.encDataSize = 0;
-  newKey.encData = NULL;
-  
-  // FIXME: Support PCR bindings
-  newKey.PCRInfoSize = 0;
-  newKey.PCRInfo = NULL;
-  
-  // Calculate encUsageAuth                                    
-  XORbufferSize = BSG_PackList(  XORbuffer, 2, 
-				 BSG_TPM_SECRET, osapSharedSecret,
-				 BSG_TPM_NONCE, &auth->NonceEven);
-  Crypto_SHA1Full(XORbuffer, XORbufferSize, (BYTE *) &XORKey1);
-  
-  // FIXME: No support for migratable keys.
-  for (i=0; i < TPM_DIGEST_SIZE; i++) 
-    ((BYTE *) &encUsageAuth)[i] = ((BYTE *) &XORKey1)[i] ^ ((BYTE *) newKeyAuth)[i];
-  
-  // Flatten newKey prototype
-  flatKeySize = BSG_Pack(BSG_TPM_KEY, (BYTE *) &newKey, flatKey);
-  newKeyText.data = flatKey;
-  newKeyText.size = flatKeySize;
-  
-  // Generate HMAC
-  paramText = (BYTE *) malloc(sizeof(BYTE) * TCPA_MAX_BUFFER_LENGTH);
-  
-  paramTextSize = BSG_PackList(paramText, 3,
-			       BSG_TPM_COMMAND_CODE, &command,
-			       BSG_TPM_AUTHDATA, &encUsageAuth,
-			       BSG_TPM_AUTHDATA, &encMigrationAuth);
-  memcpy(paramText + paramTextSize, newKeyText.data, newKeyText.size);
-  paramTextSize += newKeyText.size;
-  
-  
-  TPMTRYRETURN( GenerateAuth( paramText, paramTextSize,
-			      osapSharedSecret, auth) );
-  
-  // Call TCS
-  TPMTRYRETURN( TCSP_CreateWrapKey(  hContext, 
-				     parentHandle,
-				     encUsageAuth,
-				     encMigrationAuth,
-				     &newKeyText.size,
-				     &newKeyText.data,
-				     auth) );
-  
-  // Verify Auth
-  paramTextSize = BSG_PackList(paramText, 2,
-			       BSG_TPM_RESULT, &status,
-			       BSG_TPM_COMMAND_CODE, &command);
-  memcpy(paramText + paramTextSize, newKeyText.data, newKeyText.size);
-  paramTextSize += newKeyText.size;
-  
-  TPMTRYRETURN( VerifyAuth( paramText, paramTextSize,
-			    osapSharedSecret, auth, 0) );
-  
-  // Unpack/return key structure
-  TPMTRYRETURN(buffer_init(pubKeyBuf, 0, 0) );
-  TPMTRYRETURN(buffer_append_raw(pubKeyBuf, newKeyText.size, newKeyText.data) );
-  
-  goto egress;
-  
- abort_egress:
-  
- egress:
-  
-  free(flatKey);
-  free(paramText);
-  TCS_FreeMemory(hContext, newKeyText.data);
-  
-  return status;
-}
-
-TPM_RESULT VTSP_LoadKey(const TCS_CONTEXT_HANDLE    hContext,
-                        const TCS_KEY_HANDLE        hUnwrappingKey,
-                        const buffer_t              *rgbWrappedKeyBlob,
-                        const TPM_AUTHDATA          *parentAuth,
-                        TPM_HANDLE                  *newKeyHandle,
-                        TCS_AUTH                    *auth,
-                        CRYPTO_INFO                 *cryptoinfo,
-                        const BOOL                  skipTPMLoad) { 
-  
-  
-  vtpmloginfo(VTPM_LOG_VTSP, "Loading Key %s.\n", (!skipTPMLoad ? "into TPM" : "only into memory"));
-  
-  TPM_RESULT status = TPM_SUCCESS;
-  TPM_COMMAND_CODE command = TPM_ORD_LoadKey;
-
-  BYTE *paramText=NULL;        // Digest to make Auth.
-  UINT32 paramTextSize;
-
-  // SkipTPMLoad stops key from being loaded into TPM, but still generates CRYPTO_INFO for it
-  if (! skipTPMLoad) { 
-  
-    if ((rgbWrappedKeyBlob == NULL) || (parentAuth == NULL) || 
-        (newKeyHandle==NULL) || (auth==NULL)) {
-      status = TPM_BAD_PARAMETER;
-      goto abort_egress;
-    }
-  
-    // Generate Extra TCS Parameters
-    TPM_HANDLE phKeyHMAC;
-  
-    paramText = (BYTE *) malloc(sizeof(BYTE) *  TCPA_MAX_BUFFER_LENGTH);
-  
-    paramTextSize = BSG_PackList(paramText, 1,
-  			         BSG_TPM_COMMAND_CODE, &command);
-  
-    memcpy(paramText + paramTextSize, rgbWrappedKeyBlob->bytes, buffer_len(rgbWrappedKeyBlob));
-    paramTextSize += buffer_len(rgbWrappedKeyBlob);
-  
-    TPMTRYRETURN( GenerateAuth( paramText, paramTextSize,
-			      parentAuth, auth) );
-  
-    // Call TCS
-    TPMTRYRETURN( TCSP_LoadKeyByBlob(  hContext,
-				       hUnwrappingKey,
-				       buffer_len(rgbWrappedKeyBlob),
-				       rgbWrappedKeyBlob->bytes,
-				       auth,
-				       newKeyHandle,
-				       &phKeyHMAC) );
-  
-    // Verify Auth
-    paramTextSize = BSG_PackList(paramText, 3,
-			         BSG_TPM_RESULT, &status,
-			         BSG_TPM_COMMAND_CODE, &command,
-			         BSG_TPM_HANDLE, newKeyHandle);
-  
-    TPMTRYRETURN( VerifyAuth( paramText, paramTextSize,
-			      parentAuth, auth, 
-			      hContext) );
-  } 
-  
-  // Build cryptoinfo structure for software crypto function. 
-  if (cryptoinfo != NULL) {
-    TPM_KEY newKey;
-    
-    // Unpack/return key structure
-    BSG_Unpack(BSG_TPM_KEY, rgbWrappedKeyBlob->bytes , &newKey);
-    TPM_RSA_KEY_PARMS rsaKeyParms;
-    
-    BSG_Unpack(BSG_TPM_RSA_KEY_PARMS, 
-	       newKey.algorithmParms.parms, 
-	       &rsaKeyParms);
-    
-    Crypto_RSABuildCryptoInfoPublic(rsaKeyParms.exponentSize, 
-				    rsaKeyParms.exponent, 
-				    newKey.pubKey.keyLength, 
-				    newKey.pubKey.key, 
-				    cryptoinfo);
-    
-    // Destroy rsaKeyParms
-    BSG_Destroy(BSG_TPM_RSA_KEY_PARMS, &rsaKeyParms);
-    
-    // Set encryption scheme
-    cryptoinfo->encScheme = CRYPTO_ES_RSAESOAEP_SHA1_MGF1;
-  }
-  
-  goto egress;
-  
- abort_egress:
-  
- egress:
-  
-  free(paramText);
-  return status;
-}
-
-TPM_RESULT VTSP_Unbind( const TCS_CONTEXT_HANDLE    hContext,
-                        const TPM_KEY_HANDLE        key_handle,
-                        const buffer_t              *bound_data,
-                        const TPM_AUTHDATA          *usage_auth,
-                        buffer_t                    *clear_data,
-                        TCS_AUTH                    *auth) {
-  
-  vtpmloginfo(VTPM_LOG_VTSP, "Unbinding %d bytes of data.\n", buffer_len(bound_data));
-  
-  TPM_RESULT status = TPM_SUCCESS;
-  TPM_COMMAND_CODE command = TPM_ORD_UnBind;
-  
-  BYTE *paramText;        // Digest to make Auth.
-  UINT32 paramTextSize;
-  
-  // Generate Extra TCS Parameters
-  struct pack_buf_t clear_data32;
-  BYTE *clear_data_text;
-  UINT32 clear_data_size;
-  
-  struct pack_buf_t bound_data32 = {bound_data->size, bound_data->bytes};
-  
-  paramText = (BYTE *) malloc(sizeof(BYTE) * TCPA_MAX_BUFFER_LENGTH);
-  
-  paramTextSize = BSG_PackList(paramText, 2,
-			       BSG_TPM_COMMAND_CODE, &command,
-			       BSG_TPM_SIZE32_DATA, &bound_data32);
-  
-  TPMTRYRETURN( GenerateAuth( paramText, paramTextSize,
-			      usage_auth, auth) );
-  
-  // Call TCS
-  TPMTRYRETURN( TCSP_UnBind( hContext,
-			     key_handle,
-			     buffer_len(bound_data),
-			     bound_data->bytes,
-			     auth,
-			     &clear_data_size,
-			     &clear_data_text) );
-  
-  
-  // Verify Auth
-  clear_data32.size = clear_data_size;
-  clear_data32.data = clear_data_text;
-  paramTextSize = BSG_PackList(paramText, 3,
-			       BSG_TPM_RESULT, &status,
-			       BSG_TPM_COMMAND_CODE, &command,
-			       BSG_TPM_SIZE32_DATA, &clear_data32);
-  
-  TPMTRYRETURN( VerifyAuth( paramText, paramTextSize,
-			    usage_auth, auth, 
-			    hContext) );
-  
-  // Unpack/return key structure
-  TPMTRYRETURN(buffer_init(clear_data, 0, 0));
-  TPMTRYRETURN(buffer_append_raw (clear_data, clear_data_size, clear_data_text) );
-  
-  goto egress;
-  
- abort_egress:
-  
- egress:
-  
-  free(paramText);
-  TCS_FreeMemory(hContext, clear_data_text);
-  
-  return status;
-}
-
-TPM_RESULT VTSP_Bind(   CRYPTO_INFO *cryptoInfo, 
-			const buffer_t *inData, 
-			buffer_t *outData)               
-{
-  vtpmloginfo(VTPM_LOG_VTSP, "Binding %d bytes of data.\n", buffer_len(inData));
-  TPM_RESULT status = TPM_SUCCESS;
-  TPM_BOUND_DATA boundData;
-  UINT32 i;
-  
-  // Fill boundData's accessory information
-  boundData.ver = TPM_STRUCT_VER_1_1;
-  boundData.payload = TPM_PT_BIND;
-  boundData.payloadData = inData->bytes;
-  
-  // Pack boundData before encryption
-  BYTE* flatBoundData = (BYTE *)malloc(sizeof(BYTE) * 
-				       (sizeof(TPM_VERSION) +
-					sizeof(TPM_PAYLOAD_TYPE) +
-					buffer_len(inData)));
-  if (flatBoundData == NULL) {
-    return TPM_NOSPACE;
-  }
-  UINT32 flatBoundDataSize = 0;
-  flatBoundDataSize = BSG_PackList(  flatBoundData, 2, 
-				     BSG_TPM_VERSION, &boundData.ver, 
-				     BSG_TYPE_BYTE, &boundData.payload);
-  
-  memcpy(flatBoundData+flatBoundDataSize, inData->bytes, buffer_len(inData));
-  flatBoundDataSize += buffer_len(inData);
-  
-  BYTE out_tmp[RSA_KEY_SIZE/8]; // RSAEnc does not do blocking, So this is what will come out.
-  UINT32 out_tmp_size;
-  
-  // Encrypt flatBoundData
-  TPMTRY(TPM_ENCRYPT_ERROR, Crypto_RSAEnc( cryptoInfo, 
-                                           flatBoundDataSize, 
-                                           flatBoundData, 
-                                           &out_tmp_size, 
-                                           out_tmp) );
-  
-  if (out_tmp_size > RSA_KEY_SIZE/8) {
-    // The result of RSAEnc should be a fixed size based on key size.
-    vtpmlogerror(VTPM_LOG_VTSP, "Enc buffer just overflowed.\n");
-  }
-  
-  buffer_init(outData, 0, NULL);
-  buffer_append_raw(outData, out_tmp_size, out_tmp);
-  
-  vtpmloginfo(VTPM_LOG_TXDATA, "Bind Generated[%d] = 0x", out_tmp_size);
-  for(i = 0 ; i < out_tmp_size ; i++) {
-    vtpmloginfomore(VTPM_LOG_TXDATA, "%2.2x ", out_tmp[i]);
-  }
-  vtpmloginfomore(VTPM_LOG_TXDATA, "\n");
-
-  goto egress;
-  abort_egress: 
-  egress:
- 
-  // Free flatBoundData
-  free(flatBoundData);
-  
-  return TPM_SUCCESS;
-}
-
-TPM_RESULT VTSP_Seal(const TCS_CONTEXT_HANDLE    hContext,
-                     const TPM_KEY_HANDLE        keyHandle,
-                     const TPM_AUTHDATA          *sealDataAuth,
-                     const TPM_PCR_COMPOSITE     *pcrComp,
-                     const buffer_t              *inData,
-                     TPM_STORED_DATA             *sealedData,                                   
-                     const TPM_SECRET            *osapSharedSecret,
-                     TCS_AUTH                    *auth) {
-
-  TPM_RESULT status = TPM_SUCCESS;
-  TPM_COMMAND_CODE command = TPM_ORD_Seal;
-
-  BYTE *paramText;        // Digest to make Auth.
-  UINT32 paramTextSize;
-
-  // Generate PCR_Info Struct from Comp
-  TPM_PCR_INFO pcrInfo;
-  UINT32 pcrInfoSize, flatpcrSize;
-  BYTE flatpcr[3 +                          // PCR_Select = 3 1 byte banks
-               sizeof(UINT16) +             //              2 byte UINT16
-               sizeof(UINT32) +             // PCR_Comp   = 4 byte UINT32
-               24 * sizeof(TPM_PCRVALUE) ]; //              up to 24 PCRs
-
-  if (pcrComp != NULL) {
-      //printf("\n\tBinding to PCRs: ");
-      //for(int i = 0 ; i < pcrComp->select.sizeOfSelect ; i++)
-      //printf("%2.2x", pcrComp->select.pcrSelect[i]);
-
-      memcpy(&pcrInfo.pcrSelection, &pcrComp->select, sizeof(TPM_PCR_SELECTION));
-
-      flatpcrSize = BSG_Pack(BSG_TPM_PCR_COMPOSITE, (BYTE *) pcrComp, flatpcr);
-      Crypto_SHA1Full((BYTE *) flatpcr, flatpcrSize, (BYTE *) &(pcrInfo.digestAtRelease));
-      memset(&(pcrInfo.digestAtCreation), 0, sizeof(TPM_DIGEST));
-      pcrInfoSize = BSG_Pack(BSG_TPM_PCR_INFO, (BYTE *) &pcrInfo, flatpcr);
-  } else {
-      //printf("\n\tBinding to no PCRS.");
-      pcrInfoSize = 0;
-  }
-
-  // Calculate encUsageAuth
-  BYTE XORbuffer[sizeof(TPM_SECRET) + sizeof(TPM_NONCE)];
-  UINT32 XORbufferSize = sizeof(XORbuffer);
-  TPM_DIGEST XORKey;
-  TPM_ENCAUTH encAuth;
-
-  BSG_PackList( XORbuffer, 2,
-                BSG_TPM_SECRET, osapSharedSecret,
-                BSG_TPM_NONCE, &auth->NonceEven );
-
-  Crypto_SHA1Full(XORbuffer, XORbufferSize, (BYTE *) &XORKey);
-

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 18:44:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 18: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 1TYLT5-0003uf-1u; Tue, 13 Nov 2012 18:44:15 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1TYLT4-0003uY-BC
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 18:44:14 +0000
Received: from [85.158.143.35:5767] by server-2.bemta-4.messagelabs.com id
	8A/8D-28922-DF492A05; Tue, 13 Nov 2012 18:44:13 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-11.tower-21.messagelabs.com!1352832251!12018845!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=1.4 required=7.0 tests=INFO_TLD
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31289 invoked from network); 13 Nov 2012 18:44:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Nov 2012 18:44:12 -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 1TYLT1-0004kN-Aj
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 18:44:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1TYLT1-000254-79
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 18:44:11 +0000
Date: Tue, 13 Nov 2012 18:44:11 +0000
Message-Id: <E1TYLT1-000254-79@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-4.1-testing] Revert
	"qemu-xen-traditional: use O_DIRECT to open disk images for IDE"
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 dbd79be2d3d47c6a73f6292ffb8de9860cd80ad8
Author: Ian Jackson <ian.jackson@eu.citrix.com>
Date:   Tue Aug 14 15:57:49 2012 +0100

    Revert "qemu-xen-traditional: use O_DIRECT to open disk images for IDE"
    
    This reverts commit 1307e42a4b3c1102d75401bc0cffb4eb6c9b7a38.
    
    In fact after a lengthy discussion, we came up with the conclusion
    that WRITEBACK is OK for IDE.
    See: http://marc.info/?l=xen-devel&m=133311527009773
    
    Therefore revert this which was committed in error.
    (cherry picked from commit effd5676225761abdab90becac519716515c3be4)
---
 xenstore.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/xenstore.c b/xenstore.c
index ac90366..4c483e2 100644
--- a/xenstore.c
+++ b/xenstore.c
@@ -643,7 +643,7 @@ void xenstore_parse_domain_config(int hvm_domid)
 	    }
             pstrcpy(bs->filename, sizeof(bs->filename), params);
 
-            flags = BDRV_O_NOCACHE;
+            flags = BDRV_O_CACHE_WB; /* snapshot and write-back */
             is_readonly = 0;
             if (pasprintf(&buf, "%s/mode", bpath) == -1)
                 continue;
--
generated by git-patchbot for /home/xen/git/qemu-xen-4.1-testing.git

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 18:44:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 18: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 1TYLT5-0003uf-1u; Tue, 13 Nov 2012 18:44:15 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1TYLT4-0003uY-BC
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 18:44:14 +0000
Received: from [85.158.143.35:5767] by server-2.bemta-4.messagelabs.com id
	8A/8D-28922-DF492A05; Tue, 13 Nov 2012 18:44:13 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-11.tower-21.messagelabs.com!1352832251!12018845!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=1.4 required=7.0 tests=INFO_TLD
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31289 invoked from network); 13 Nov 2012 18:44:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Nov 2012 18:44:12 -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 1TYLT1-0004kN-Aj
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 18:44:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1TYLT1-000254-79
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 18:44:11 +0000
Date: Tue, 13 Nov 2012 18:44:11 +0000
Message-Id: <E1TYLT1-000254-79@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-4.1-testing] Revert
	"qemu-xen-traditional: use O_DIRECT to open disk images for IDE"
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 dbd79be2d3d47c6a73f6292ffb8de9860cd80ad8
Author: Ian Jackson <ian.jackson@eu.citrix.com>
Date:   Tue Aug 14 15:57:49 2012 +0100

    Revert "qemu-xen-traditional: use O_DIRECT to open disk images for IDE"
    
    This reverts commit 1307e42a4b3c1102d75401bc0cffb4eb6c9b7a38.
    
    In fact after a lengthy discussion, we came up with the conclusion
    that WRITEBACK is OK for IDE.
    See: http://marc.info/?l=xen-devel&m=133311527009773
    
    Therefore revert this which was committed in error.
    (cherry picked from commit effd5676225761abdab90becac519716515c3be4)
---
 xenstore.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/xenstore.c b/xenstore.c
index ac90366..4c483e2 100644
--- a/xenstore.c
+++ b/xenstore.c
@@ -643,7 +643,7 @@ void xenstore_parse_domain_config(int hvm_domid)
 	    }
             pstrcpy(bs->filename, sizeof(bs->filename), params);
 
-            flags = BDRV_O_NOCACHE;
+            flags = BDRV_O_CACHE_WB; /* snapshot and write-back */
             is_readonly = 0;
             if (pasprintf(&buf, "%s/mode", bpath) == -1)
                 continue;
--
generated by git-patchbot for /home/xen/git/qemu-xen-4.1-testing.git

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 18:44:32 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 18:44: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 1TYLTI-0003vR-4w; Tue, 13 Nov 2012 18:44:28 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1TYLTH-0003vK-2m
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 18:44:27 +0000
Received: from [85.158.139.211:59257] by server-15.bemta-5.messagelabs.com id
	79/FF-26920-A0592A05; Tue, 13 Nov 2012 18:44:26 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-14.tower-206.messagelabs.com!1352832261!19989778!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21772 invoked from network); 13 Nov 2012 18:44:22 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Nov 2012 18:44:22 -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 1TYLTB-0004kQ-Kz
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 18:44:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1TYLTB-00026G-F1
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 18:44:21 +0000
Date: Tue, 13 Nov 2012 18:44:21 +0000
Message-Id: <E1TYLTB-00026G-F1@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-4.1-testing] qemu-xen-trad: fix
	msi_translate with PV event delivery
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 bdbf5a6aba74658b95756c8d7d26d664fbd9c83d
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Thu Aug 30 16:11:32 2012 +0100

    qemu-xen-trad: fix msi_translate with PV event delivery
    
    When switching from msitranslate to straight msi we need to make sure
    that we respect PV event delivery for the msi if the guest asked for it:
    
    - completely disable MSI on the device in pt_disable_msi_translate;
    - then enable MSI again (pt_msi_setup), mapping the correct pirq to it.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
    Tested-by: Rolu <rolu@roce.org>
    (cherry picked from commit 3e66da7266c84638c0e22a09c9d2b07529802576)
---
 hw/pass-through.c |   25 +++++++++++--------------
 hw/pt-msi.c       |   14 ++------------
 2 files changed, 13 insertions(+), 26 deletions(-)

diff --git a/hw/pass-through.c b/hw/pass-through.c
index 9c5620d..41926c6 100644
--- a/hw/pass-through.c
+++ b/hw/pass-through.c
@@ -3803,21 +3803,18 @@ static int pt_msgctrl_reg_write(struct pt_dev *ptdev,
                 PT_LOG("guest enabling MSI, disable MSI-INTx translation\n");
                 pt_disable_msi_translate(ptdev);
             }
-            else
+            /* Init physical one */
+            PT_LOG("setup msi for dev %x\n", pd->devfn);
+            if (pt_msi_setup(ptdev))
             {
-                /* Init physical one */
-                PT_LOG("setup msi for dev %x\n", pd->devfn);
-                if (pt_msi_setup(ptdev))
-                {
-		    /* We do not broadcast the error to the framework code, so
-		     * that MSI errors are contained in MSI emulation code and
-		     * QEMU can go on running.
-		     * Guest MSI would be actually not working.
-		     */
-		    *value &= ~PCI_MSI_FLAGS_ENABLE;
-		    PT_LOG("Warning: Can not map MSI for dev %x\n", pd->devfn);
-		    return 0;
-                }
+                /* We do not broadcast the error to the framework code, so
+                 * that MSI errors are contained in MSI emulation code and
+                 * QEMU can go on running.
+                 * Guest MSI would be actually not working.
+                 */
+                *value &= ~PCI_MSI_FLAGS_ENABLE;
+                PT_LOG("Warning: Can not map MSI for dev %x\n", pd->devfn);
+                return 0;
             }
             if (pt_msi_update(ptdev))
             {
diff --git a/hw/pt-msi.c b/hw/pt-msi.c
index 71fa6f0..fcec36a 100644
--- a/hw/pt-msi.c
+++ b/hw/pt-msi.c
@@ -263,16 +263,8 @@ void pt_disable_msi_translate(struct pt_dev *dev)
     uint8_t e_device = 0;
     uint8_t e_intx = 0;
 
-    /* MSI_ENABLE bit should be disabed until the new handler is set */
-    msi_set_enable(dev, 0);
-
-    e_device = PCI_SLOT(dev->dev.devfn);
-    e_intx = pci_intx(dev);
-
-    if (xc_domain_unbind_pt_irq(xc_handle, domid, dev->msi->pirq,
-                                 PT_IRQ_TYPE_MSI_TRANSLATE, 0,
-                                 e_device, e_intx, 0))
-        PT_LOG("Error: Unbinding pt irq for MSI-INTx failed!\n");
+    pt_msi_disable(dev);
+    dev->msi->flags |= MSI_FLAG_UNINIT;
 
     if (dev->machine_irq)
     {
@@ -280,8 +272,6 @@ void pt_disable_msi_translate(struct pt_dev *dev)
                                        0, e_device, e_intx))
             PT_LOG("Error: Rebinding of interrupt failed!\n");
     }
-
-    dev->msi_trans_en = 0;
 }
 
 /* MSI-X virtulization functions */
--
generated by git-patchbot for /home/xen/git/qemu-xen-4.1-testing.git

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 18:44:32 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 18:44: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 1TYLTI-0003vR-4w; Tue, 13 Nov 2012 18:44:28 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1TYLTH-0003vK-2m
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 18:44:27 +0000
Received: from [85.158.139.211:59257] by server-15.bemta-5.messagelabs.com id
	79/FF-26920-A0592A05; Tue, 13 Nov 2012 18:44:26 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-14.tower-206.messagelabs.com!1352832261!19989778!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21772 invoked from network); 13 Nov 2012 18:44:22 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Nov 2012 18:44:22 -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 1TYLTB-0004kQ-Kz
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 18:44:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1TYLTB-00026G-F1
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 18:44:21 +0000
Date: Tue, 13 Nov 2012 18:44:21 +0000
Message-Id: <E1TYLTB-00026G-F1@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-4.1-testing] qemu-xen-trad: fix
	msi_translate with PV event delivery
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 bdbf5a6aba74658b95756c8d7d26d664fbd9c83d
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Thu Aug 30 16:11:32 2012 +0100

    qemu-xen-trad: fix msi_translate with PV event delivery
    
    When switching from msitranslate to straight msi we need to make sure
    that we respect PV event delivery for the msi if the guest asked for it:
    
    - completely disable MSI on the device in pt_disable_msi_translate;
    - then enable MSI again (pt_msi_setup), mapping the correct pirq to it.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
    Tested-by: Rolu <rolu@roce.org>
    (cherry picked from commit 3e66da7266c84638c0e22a09c9d2b07529802576)
---
 hw/pass-through.c |   25 +++++++++++--------------
 hw/pt-msi.c       |   14 ++------------
 2 files changed, 13 insertions(+), 26 deletions(-)

diff --git a/hw/pass-through.c b/hw/pass-through.c
index 9c5620d..41926c6 100644
--- a/hw/pass-through.c
+++ b/hw/pass-through.c
@@ -3803,21 +3803,18 @@ static int pt_msgctrl_reg_write(struct pt_dev *ptdev,
                 PT_LOG("guest enabling MSI, disable MSI-INTx translation\n");
                 pt_disable_msi_translate(ptdev);
             }
-            else
+            /* Init physical one */
+            PT_LOG("setup msi for dev %x\n", pd->devfn);
+            if (pt_msi_setup(ptdev))
             {
-                /* Init physical one */
-                PT_LOG("setup msi for dev %x\n", pd->devfn);
-                if (pt_msi_setup(ptdev))
-                {
-		    /* We do not broadcast the error to the framework code, so
-		     * that MSI errors are contained in MSI emulation code and
-		     * QEMU can go on running.
-		     * Guest MSI would be actually not working.
-		     */
-		    *value &= ~PCI_MSI_FLAGS_ENABLE;
-		    PT_LOG("Warning: Can not map MSI for dev %x\n", pd->devfn);
-		    return 0;
-                }
+                /* We do not broadcast the error to the framework code, so
+                 * that MSI errors are contained in MSI emulation code and
+                 * QEMU can go on running.
+                 * Guest MSI would be actually not working.
+                 */
+                *value &= ~PCI_MSI_FLAGS_ENABLE;
+                PT_LOG("Warning: Can not map MSI for dev %x\n", pd->devfn);
+                return 0;
             }
             if (pt_msi_update(ptdev))
             {
diff --git a/hw/pt-msi.c b/hw/pt-msi.c
index 71fa6f0..fcec36a 100644
--- a/hw/pt-msi.c
+++ b/hw/pt-msi.c
@@ -263,16 +263,8 @@ void pt_disable_msi_translate(struct pt_dev *dev)
     uint8_t e_device = 0;
     uint8_t e_intx = 0;
 
-    /* MSI_ENABLE bit should be disabed until the new handler is set */
-    msi_set_enable(dev, 0);
-
-    e_device = PCI_SLOT(dev->dev.devfn);
-    e_intx = pci_intx(dev);
-
-    if (xc_domain_unbind_pt_irq(xc_handle, domid, dev->msi->pirq,
-                                 PT_IRQ_TYPE_MSI_TRANSLATE, 0,
-                                 e_device, e_intx, 0))
-        PT_LOG("Error: Unbinding pt irq for MSI-INTx failed!\n");
+    pt_msi_disable(dev);
+    dev->msi->flags |= MSI_FLAG_UNINIT;
 
     if (dev->machine_irq)
     {
@@ -280,8 +272,6 @@ void pt_disable_msi_translate(struct pt_dev *dev)
                                        0, e_device, e_intx))
             PT_LOG("Error: Rebinding of interrupt failed!\n");
     }
-
-    dev->msi_trans_en = 0;
 }
 
 /* MSI-X virtulization functions */
--
generated by git-patchbot for /home/xen/git/qemu-xen-4.1-testing.git

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 18:44:40 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 18:44: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.xen.org>)
	id 1TYLTQ-0003wC-7z; Tue, 13 Nov 2012 18:44:36 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1TYLTO-0003w3-VE
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 18:44:35 +0000
Received: from [85.158.143.99:52960] by server-3.bemta-4.messagelabs.com id
	B9/D4-06841-21592A05; Tue, 13 Nov 2012 18:44:34 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-14.tower-216.messagelabs.com!1352832272!18998465!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20108 invoked from network); 13 Nov 2012 18:44:33 -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;
	13 Nov 2012 18:44:33 -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 1TYLTL-0004kY-Vs
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 18:44:31 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1TYLTL-00026d-Op
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 18:44:31 +0000
Date: Tue, 13 Nov 2012 18:44:31 +0000
Message-Id: <E1TYLTL-00026d-Op@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-4.1-testing] mapcache: Fix invalidate if
	memory requested was not bucket aligned
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 b36c42985575cd6d761d39e5770e57a1f52832ae
Author: Ian Jackson <ian.jackson@eu.citrix.com>
Date:   Tue Nov 13 18:25:17 2012 +0000

    mapcache: Fix invalidate if memory requested was not bucket aligned
    
    When memory is mapped in qemu_map_cache with lock != 0 a reverse mapping
    is created pointing to the virtual address of location requested.
    The cached mapped entry is saved in last_address_vaddr with the memory
    location of the base virtual address (without bucket offset).
    However when this entry is invalidated the virtual address saved in the
    reverse mapping is used. This cause that the mapping is freed but the
    last_address_vaddr is not reset.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit d94efd9aa814f17f3243dae91476dc42b5ad052e)
    
    Conflicts:
    	hw/xen_machine_fv.c
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 hw/xen_machine_fv.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/xen_machine_fv.c b/hw/xen_machine_fv.c
index a353ee6..786a8fb 100644
--- a/hw/xen_machine_fv.c
+++ b/hw/xen_machine_fv.c
@@ -181,9 +181,6 @@ void qemu_invalidate_entry(uint8_t *buffer)
     unsigned long paddr_index;
     int found = 0;
     
-    if (last_address_vaddr == buffer)
-        last_address_index =  ~0UL;
-
     TAILQ_FOREACH(reventry, &locked_entries, next) {
         if (reventry->vaddr_req == buffer) {
             paddr_index = reventry->paddr_index;
@@ -201,6 +198,10 @@ void qemu_invalidate_entry(uint8_t *buffer)
     TAILQ_REMOVE(&locked_entries, reventry, next);
     qemu_free(reventry);
 
+    if (last_address_index == paddr_index) {
+        last_address_index =  ~0UL;
+    }
+
     entry = &mapcache_entry[paddr_index % nr_buckets];
     while (entry && entry->paddr_index != paddr_index) {
         pentry = entry;
--
generated by git-patchbot for /home/xen/git/qemu-xen-4.1-testing.git

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 18:44:40 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 18:44: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.xen.org>)
	id 1TYLTQ-0003wC-7z; Tue, 13 Nov 2012 18:44:36 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1TYLTO-0003w3-VE
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 18:44:35 +0000
Received: from [85.158.143.99:52960] by server-3.bemta-4.messagelabs.com id
	B9/D4-06841-21592A05; Tue, 13 Nov 2012 18:44:34 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-14.tower-216.messagelabs.com!1352832272!18998465!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20108 invoked from network); 13 Nov 2012 18:44:33 -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;
	13 Nov 2012 18:44:33 -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 1TYLTL-0004kY-Vs
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 18:44:31 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1TYLTL-00026d-Op
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 18:44:31 +0000
Date: Tue, 13 Nov 2012 18:44:31 +0000
Message-Id: <E1TYLTL-00026d-Op@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-4.1-testing] mapcache: Fix invalidate if
	memory requested was not bucket aligned
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 b36c42985575cd6d761d39e5770e57a1f52832ae
Author: Ian Jackson <ian.jackson@eu.citrix.com>
Date:   Tue Nov 13 18:25:17 2012 +0000

    mapcache: Fix invalidate if memory requested was not bucket aligned
    
    When memory is mapped in qemu_map_cache with lock != 0 a reverse mapping
    is created pointing to the virtual address of location requested.
    The cached mapped entry is saved in last_address_vaddr with the memory
    location of the base virtual address (without bucket offset).
    However when this entry is invalidated the virtual address saved in the
    reverse mapping is used. This cause that the mapping is freed but the
    last_address_vaddr is not reset.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit d94efd9aa814f17f3243dae91476dc42b5ad052e)
    
    Conflicts:
    	hw/xen_machine_fv.c
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 hw/xen_machine_fv.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/xen_machine_fv.c b/hw/xen_machine_fv.c
index a353ee6..786a8fb 100644
--- a/hw/xen_machine_fv.c
+++ b/hw/xen_machine_fv.c
@@ -181,9 +181,6 @@ void qemu_invalidate_entry(uint8_t *buffer)
     unsigned long paddr_index;
     int found = 0;
     
-    if (last_address_vaddr == buffer)
-        last_address_index =  ~0UL;
-
     TAILQ_FOREACH(reventry, &locked_entries, next) {
         if (reventry->vaddr_req == buffer) {
             paddr_index = reventry->paddr_index;
@@ -201,6 +198,10 @@ void qemu_invalidate_entry(uint8_t *buffer)
     TAILQ_REMOVE(&locked_entries, reventry, next);
     qemu_free(reventry);
 
+    if (last_address_index == paddr_index) {
+        last_address_index =  ~0UL;
+    }
+
     entry = &mapcache_entry[paddr_index % nr_buckets];
     while (entry && entry->paddr_index != paddr_index) {
         pentry = entry;
--
generated by git-patchbot for /home/xen/git/qemu-xen-4.1-testing.git

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 23:44:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 23: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 1TYQ9O-0002Cj-Dp; Tue, 13 Nov 2012 23:44:14 +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 1TYQ9N-0002CE-7y
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:13 +0000
Received: from [85.158.143.35:6003] by server-2.bemta-4.messagelabs.com id
	73/BB-28922-C4BD2A05; Tue, 13 Nov 2012 23:44:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1352850250!10232204!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6438 invoked from network); 13 Nov 2012 23: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;
	13 Nov 2012 23: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 1TYQ9K-00087J-IT
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYQ9K-0001E9-AL
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:10 +0000
Message-Id: <E1TYQ9K-0001E9-AL@xenbits.xen.org>
Date: Tue, 13 Nov 2012 23: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] hotplug/Linux: Remove tracing
	(bash -x) from network-nat script
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352830198 0
# Node ID 30a7232b184dbd22f0ea978f64f52bb9d36468f4
# Parent  8931942405ea650e466944f8f183866d3b3b9bf0
hotplug/Linux: Remove tracing (bash -x) from network-nat script

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

xen-unstable changeset: 26006:8b6870d686d6
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-4.2-testing changeset: 25896:6adf0c7937bf
Backport-requested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 8931942405ea -r 30a7232b184d tools/hotplug/Linux/network-nat
--- a/tools/hotplug/Linux/network-nat	Tue Nov 13 18:09:07 2012 +0000
+++ b/tools/hotplug/Linux/network-nat	Tue Nov 13 18:09:58 2012 +0000
@@ -1,4 +1,4 @@
-#!/bin/bash -x
+#!/bin/bash
 #============================================================================
 # Default Xen network start/stop script when using NAT.
 # Xend calls a network script when it starts.

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 23:44:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 23: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 1TYQ9O-0002Cj-Dp; Tue, 13 Nov 2012 23:44:14 +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 1TYQ9N-0002CE-7y
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:13 +0000
Received: from [85.158.143.35:6003] by server-2.bemta-4.messagelabs.com id
	73/BB-28922-C4BD2A05; Tue, 13 Nov 2012 23:44:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1352850250!10232204!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6438 invoked from network); 13 Nov 2012 23: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;
	13 Nov 2012 23: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 1TYQ9K-00087J-IT
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYQ9K-0001E9-AL
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:10 +0000
Message-Id: <E1TYQ9K-0001E9-AL@xenbits.xen.org>
Date: Tue, 13 Nov 2012 23: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] hotplug/Linux: Remove tracing
	(bash -x) from network-nat script
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352830198 0
# Node ID 30a7232b184dbd22f0ea978f64f52bb9d36468f4
# Parent  8931942405ea650e466944f8f183866d3b3b9bf0
hotplug/Linux: Remove tracing (bash -x) from network-nat script

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

xen-unstable changeset: 26006:8b6870d686d6
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-4.2-testing changeset: 25896:6adf0c7937bf
Backport-requested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 8931942405ea -r 30a7232b184d tools/hotplug/Linux/network-nat
--- a/tools/hotplug/Linux/network-nat	Tue Nov 13 18:09:07 2012 +0000
+++ b/tools/hotplug/Linux/network-nat	Tue Nov 13 18:09:58 2012 +0000
@@ -1,4 +1,4 @@
-#!/bin/bash -x
+#!/bin/bash
 #============================================================================
 # Default Xen network start/stop script when using NAT.
 # Xend calls a network script when it starts.

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 23:44:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 23: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 1TYQ9O-0002Cd-BQ; Tue, 13 Nov 2012 23:44:14 +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 1TYQ9N-0002CD-0U
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:13 +0000
Received: from [85.158.137.99:28676] by server-4.bemta-3.messagelabs.com id
	FA/B1-30023-C4BD2A05; Tue, 13 Nov 2012 23:44:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-217.messagelabs.com!1352850250!18980886!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16867 invoked from network); 13 Nov 2012 23:44:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Nov 2012 23: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 1TYQ9K-00087G-2B
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYQ9J-0001Du-Pw
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:09 +0000
Message-Id: <E1TYQ9J-0001Du-Pw@xenbits.xen.org>
Date: Tue, 13 Nov 2012 23: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] pygrub: always append --args
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352830147 0
# Node ID 8931942405ea650e466944f8f183866d3b3b9bf0
# Parent  8cd220183845b3428ad8e1cd0c3f4530312ea146
pygrub: always append --args

If a bootloader entry in menu.lst has no additional kernel command line
options listed and the domU.cfg has 'bootargs="--args=something"' the
additional arguments from the config file are not passed to the kernel.
The reason for that incorrect behaviour is that run_grub appends arg
only if the parsed config file has arguments listed.

Fix this by appending args from image section and the config file separatly.
To avoid adding to a NoneType initialize grubcfg['args'] to an empty string.
This does not change behaviour but simplifies the code which appends the
string.

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

xen-unstable changeset: 25941:795c493fe561
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-4.2-testing changeset: 25891:7e91c668bae2
Backport-requested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 8cd220183845 -r 8931942405ea tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub	Tue Nov 13 18:08:16 2012 +0000
+++ b/tools/pygrub/src/pygrub	Tue Nov 13 18:09:07 2012 +0000
@@ -585,13 +585,15 @@ def run_grub(file, entry, fs, arg):
     except IndexError:
         img = g.cf.images[0]
 
-    grubcfg = { "kernel": None, "ramdisk": None, "args": None }
+    grubcfg = { "kernel": None, "ramdisk": None, "args": "" }
 
     grubcfg["kernel"] = img.kernel[1]
     if img.initrd:
         grubcfg["ramdisk"] = img.initrd[1]
     if img.args:
-        grubcfg["args"] = img.args + " " + arg
+        grubcfg["args"] += img.args
+    if arg:
+        grubcfg["args"] += " " + args
 
     return grubcfg
 

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 23:44:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 23: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 1TYQ9O-0002Cd-BQ; Tue, 13 Nov 2012 23:44:14 +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 1TYQ9N-0002CD-0U
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:13 +0000
Received: from [85.158.137.99:28676] by server-4.bemta-3.messagelabs.com id
	FA/B1-30023-C4BD2A05; Tue, 13 Nov 2012 23:44:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-217.messagelabs.com!1352850250!18980886!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16867 invoked from network); 13 Nov 2012 23:44:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Nov 2012 23: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 1TYQ9K-00087G-2B
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYQ9J-0001Du-Pw
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:09 +0000
Message-Id: <E1TYQ9J-0001Du-Pw@xenbits.xen.org>
Date: Tue, 13 Nov 2012 23: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] pygrub: always append --args
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352830147 0
# Node ID 8931942405ea650e466944f8f183866d3b3b9bf0
# Parent  8cd220183845b3428ad8e1cd0c3f4530312ea146
pygrub: always append --args

If a bootloader entry in menu.lst has no additional kernel command line
options listed and the domU.cfg has 'bootargs="--args=something"' the
additional arguments from the config file are not passed to the kernel.
The reason for that incorrect behaviour is that run_grub appends arg
only if the parsed config file has arguments listed.

Fix this by appending args from image section and the config file separatly.
To avoid adding to a NoneType initialize grubcfg['args'] to an empty string.
This does not change behaviour but simplifies the code which appends the
string.

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

xen-unstable changeset: 25941:795c493fe561
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-4.2-testing changeset: 25891:7e91c668bae2
Backport-requested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 8cd220183845 -r 8931942405ea tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub	Tue Nov 13 18:08:16 2012 +0000
+++ b/tools/pygrub/src/pygrub	Tue Nov 13 18:09:07 2012 +0000
@@ -585,13 +585,15 @@ def run_grub(file, entry, fs, arg):
     except IndexError:
         img = g.cf.images[0]
 
-    grubcfg = { "kernel": None, "ramdisk": None, "args": None }
+    grubcfg = { "kernel": None, "ramdisk": None, "args": "" }
 
     grubcfg["kernel"] = img.kernel[1]
     if img.initrd:
         grubcfg["ramdisk"] = img.initrd[1]
     if img.args:
-        grubcfg["args"] = img.args + " " + arg
+        grubcfg["args"] += img.args
+    if arg:
+        grubcfg["args"] += " " + args
 
     return grubcfg
 

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 23:44:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 23: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 1TYQ9N-0002CK-8V; Tue, 13 Nov 2012 23:44:13 +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 1TYQ9M-0002CB-IZ
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:12 +0000
Received: from [85.158.138.51:3137] by server-6.bemta-3.messagelabs.com id
	EF/8C-28265-B4BD2A05; Tue, 13 Nov 2012 23:44:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-174.messagelabs.com!1352850250!21020685!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16231 invoked from network); 13 Nov 2012 23:44:11 -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;
	13 Nov 2012 23: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 1TYQ9J-00087D-LA
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYQ9J-0001Df-1z
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:09 +0000
Message-Id: <E1TYQ9J-0001Df-1z@xenbits.xen.org>
Date: Tue, 13 Nov 2012 23: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] docs: correct formatting errors
	in xmdomain.cfg
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matt Wilson <msw@amazon.com>
# Date 1352830096 0
# Node ID 8cd220183845b3428ad8e1cd0c3f4530312ea146
# Parent  700d0f03d50aa6619d313c1ff6aea7fd429d28a7
docs: correct formatting errors in xmdomain.cfg

This patch corrects the following errors produced by pod2man:

Hey! The above document had some coding errors, which are explained
below:

Around line 301:
    You can't have =items (as at line 305) unless the first thing after
    the =over is an =item

Around line 311:
    '=item' outside of any '=over'

Signed-off-by: Matt Wilson <msw@amazon.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 25840:c7e4b7e64303
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-4.2-testing changeset: 25885:c23d938e3e64
Backport-requested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 700d0f03d50a -r 8cd220183845 docs/man/xmdomain.cfg.pod.5
--- a/docs/man/xmdomain.cfg.pod.5	Mon Oct 29 09:04:48 2012 +0100
+++ b/docs/man/xmdomain.cfg.pod.5	Tue Nov 13 18:08:16 2012 +0000
@@ -298,16 +298,14 @@ it holds, so that the new one may take t
 
 =back
 
+Additionally, the "on_crash" event can also take:
+
 =over 4
 
-Additionally, the "on_crash" event can also take:
-
 =item B<coredump-destroy>
 
 Dump the crashed domain's core and then destroy it.
 
-=back
-
 =item B<coredump-restart>
 
 Dump the crashed domain's core and then restart it.

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 23:44:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 23: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 1TYQ9P-0002DX-Jb; Tue, 13 Nov 2012 23:44:15 +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 1TYQ9O-0002CX-77
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:14 +0000
Received: from [193.109.254.147:39066] by server-4.bemta-14.messagelabs.com id
	99/FA-18856-D4BD2A05; Tue, 13 Nov 2012 23:44:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-27.messagelabs.com!1352850251!8571516!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13163 invoked from network); 13 Nov 2012 23:44:12 -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;
	13 Nov 2012 23: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 1TYQ9L-00087M-A6
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYQ9K-0001EO-SF
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:10 +0000
Message-Id: <E1TYQ9K-0001EO-SF@xenbits.xen.org>
Date: Tue, 13 Nov 2012 23: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] xenballoond.init: remove 4 from
	default runlevel
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352830206 0
# Node ID e9f906ff6539dd3d7206ba228cd1d8dbfde869b0
# Parent  30a7232b184dbd22f0ea978f64f52bb9d36468f4
xenballoond.init: remove 4 from default runlevel

Remove 4 from default runlevel in xenballoond.init.

Similar to what changeset 24847:0900b1c905f1 does in xencommons, remove
runlevel 4 from the other runlevel scripts. LSB defines runlevel 4 as
reserved for local use, the local sysadmin is responsible for symlink
creation in rc4.d.

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

xen-unstable changeset: 26007:fe756682cc7f
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-4.2-testing changeset: 25897:dcd4bf824284
Backport-requested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 30a7232b184d -r e9f906ff6539 tools/xenballoon/xenballoond.init
--- a/tools/xenballoon/xenballoond.init	Tue Nov 13 18:09:58 2012 +0000
+++ b/tools/xenballoon/xenballoond.init	Tue Nov 13 18:10:06 2012 +0000
@@ -14,7 +14,7 @@
 # Should-Start:
 # Required-Stop:     $syslog $remote_fs
 # Should-Stop:
-# Default-Start:     3 4 5
+# Default-Start:     3 5
 # Default-Stop:      0 1 2 6
 # Short-Description: Start/stop xenballoond
 # Description:       Starts and stops the Xen ballooning daemon.

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 23:44:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 23: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 1TYQ9P-0002DX-Jb; Tue, 13 Nov 2012 23:44:15 +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 1TYQ9O-0002CX-77
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:14 +0000
Received: from [193.109.254.147:39066] by server-4.bemta-14.messagelabs.com id
	99/FA-18856-D4BD2A05; Tue, 13 Nov 2012 23:44:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-27.messagelabs.com!1352850251!8571516!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13163 invoked from network); 13 Nov 2012 23:44:12 -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;
	13 Nov 2012 23: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 1TYQ9L-00087M-A6
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYQ9K-0001EO-SF
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:10 +0000
Message-Id: <E1TYQ9K-0001EO-SF@xenbits.xen.org>
Date: Tue, 13 Nov 2012 23: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] xenballoond.init: remove 4 from
	default runlevel
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352830206 0
# Node ID e9f906ff6539dd3d7206ba228cd1d8dbfde869b0
# Parent  30a7232b184dbd22f0ea978f64f52bb9d36468f4
xenballoond.init: remove 4 from default runlevel

Remove 4 from default runlevel in xenballoond.init.

Similar to what changeset 24847:0900b1c905f1 does in xencommons, remove
runlevel 4 from the other runlevel scripts. LSB defines runlevel 4 as
reserved for local use, the local sysadmin is responsible for symlink
creation in rc4.d.

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

xen-unstable changeset: 26007:fe756682cc7f
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-4.2-testing changeset: 25897:dcd4bf824284
Backport-requested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 30a7232b184d -r e9f906ff6539 tools/xenballoon/xenballoond.init
--- a/tools/xenballoon/xenballoond.init	Tue Nov 13 18:09:58 2012 +0000
+++ b/tools/xenballoon/xenballoond.init	Tue Nov 13 18:10:06 2012 +0000
@@ -14,7 +14,7 @@
 # Should-Start:
 # Required-Stop:     $syslog $remote_fs
 # Should-Stop:
-# Default-Start:     3 4 5
+# Default-Start:     3 5
 # Default-Stop:      0 1 2 6
 # Short-Description: Start/stop xenballoond
 # Description:       Starts and stops the Xen ballooning daemon.

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 23:44:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 23: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 1TYQ9N-0002CK-8V; Tue, 13 Nov 2012 23:44:13 +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 1TYQ9M-0002CB-IZ
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:12 +0000
Received: from [85.158.138.51:3137] by server-6.bemta-3.messagelabs.com id
	EF/8C-28265-B4BD2A05; Tue, 13 Nov 2012 23:44:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-174.messagelabs.com!1352850250!21020685!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16231 invoked from network); 13 Nov 2012 23:44:11 -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;
	13 Nov 2012 23: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 1TYQ9J-00087D-LA
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYQ9J-0001Df-1z
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:09 +0000
Message-Id: <E1TYQ9J-0001Df-1z@xenbits.xen.org>
Date: Tue, 13 Nov 2012 23: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] docs: correct formatting errors
	in xmdomain.cfg
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matt Wilson <msw@amazon.com>
# Date 1352830096 0
# Node ID 8cd220183845b3428ad8e1cd0c3f4530312ea146
# Parent  700d0f03d50aa6619d313c1ff6aea7fd429d28a7
docs: correct formatting errors in xmdomain.cfg

This patch corrects the following errors produced by pod2man:

Hey! The above document had some coding errors, which are explained
below:

Around line 301:
    You can't have =items (as at line 305) unless the first thing after
    the =over is an =item

Around line 311:
    '=item' outside of any '=over'

Signed-off-by: Matt Wilson <msw@amazon.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 25840:c7e4b7e64303
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-4.2-testing changeset: 25885:c23d938e3e64
Backport-requested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 700d0f03d50a -r 8cd220183845 docs/man/xmdomain.cfg.pod.5
--- a/docs/man/xmdomain.cfg.pod.5	Mon Oct 29 09:04:48 2012 +0100
+++ b/docs/man/xmdomain.cfg.pod.5	Tue Nov 13 18:08:16 2012 +0000
@@ -298,16 +298,14 @@ it holds, so that the new one may take t
 
 =back
 
+Additionally, the "on_crash" event can also take:
+
 =over 4
 
-Additionally, the "on_crash" event can also take:
-
 =item B<coredump-destroy>
 
 Dump the crashed domain's core and then destroy it.
 
-=back
-
 =item B<coredump-restart>
 
 Dump the crashed domain's core and then restart it.

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 23:44:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 23:44: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.xen.org>)
	id 1TYQ9O-0002Cr-Gp; Tue, 13 Nov 2012 23:44:14 +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 1TYQ9N-0002CB-PW
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:13 +0000
Received: from [85.158.137.99:51229] by server-6.bemta-3.messagelabs.com id
	23/9C-28265-D4BD2A05; Tue, 13 Nov 2012 23:44:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-217.messagelabs.com!1352850251!18105812!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1493 invoked from network); 13 Nov 2012 23:44:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Nov 2012 23: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 1TYQ9L-00087P-I6
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYQ9L-0001Eg-DM
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:11 +0000
Message-Id: <E1TYQ9L-0001Eg-DM@xenbits.xen.org>
Date: Tue, 13 Nov 2012 23: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] pygrub: correct typo in --args
	assignment
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352830215 0
# Node ID 0ac3938a6ceed3dbe737136a8addd9a66f4dc8e1
# Parent  e9f906ff6539dd3d7206ba228cd1d8dbfde869b0
pygrub: correct typo in --args assignment

If pygrub was called with --args="some thing", then this string should
be append to the kernel command line.  But the last changeset
25941:795c493fe561 contained a typo, it assigns 'args' instead of 'arg'.

Rename the local variable which holds the string from the domain config
file to avoid further confusion.

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

xen-unstable changeset: 26018:ecc7627ca6d7
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-4.2-testing changeset: 25899:dbb1872bbb97
Backport-requested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r e9f906ff6539 -r 0ac3938a6cee tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub	Tue Nov 13 18:10:06 2012 +0000
+++ b/tools/pygrub/src/pygrub	Tue Nov 13 18:10:15 2012 +0000
@@ -555,7 +555,7 @@ def get_entry_idx(cf, entry):
 
     return None
 
-def run_grub(file, entry, fs, arg):
+def run_grub(file, entry, fs, cfg_args):
     global g
     global sel
 
@@ -592,8 +592,8 @@ def run_grub(file, entry, fs, arg):
         grubcfg["ramdisk"] = img.initrd[1]
     if img.args:
         grubcfg["args"] += img.args
-    if arg:
-        grubcfg["args"] += " " + args
+    if cfg_args:
+        grubcfg["args"] += " " + cfg_args
 
     return grubcfg
 

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 23:44:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 23:44: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.xen.org>)
	id 1TYQ9Q-0002EO-Oc; Tue, 13 Nov 2012 23:44:16 +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 1TYQ9O-0002Cc-Ql
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:15 +0000
Received: from [193.109.254.147:53288] by server-7.bemta-14.messagelabs.com id
	2C/D8-02272-E4BD2A05; Tue, 13 Nov 2012 23:44:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1352850252!3859200!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 753 invoked from network); 13 Nov 2012 23:44:13 -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;
	13 Nov 2012 23: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 1TYQ9M-00087S-2w
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYQ9L-0001Ev-Tx
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:11 +0000
Message-Id: <E1TYQ9L-0001Ev-Tx@xenbits.xen.org>
Date: Tue, 13 Nov 2012 23:44:11 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] tools: xend: fix wrong condition
	check for xml file
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Joe Jin <joe.jin@oracle.com>
# Date 1352830269 0
# Node ID bfe09091c0c50211f9f8240be5ee2bc39b4e49aa
# Parent  0ac3938a6ceed3dbe737136a8addd9a66f4dc8e1
tools: xend: fix wrong condition check for xml file

In commit e8d40584, it intended to check xml file size and when empty will
return, the condition should be "if os.path.getsize(xml_path) == 0" rather
then "if not os.path.getsize(xml_path) == 0".

Signed-off-by: Chuang Cao <chuang.cao@oracle.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 26088:dd64a1bdbe3a
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-4.2-testing changeset: 25905:82b61b99d15d
Backport-requested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 0ac3938a6cee -r bfe09091c0c5 tools/python/xen/xend/XendStateStore.py
--- a/tools/python/xen/xend/XendStateStore.py	Tue Nov 13 18:10:15 2012 +0000
+++ b/tools/python/xen/xend/XendStateStore.py	Tue Nov 13 18:11:09 2012 +0000
@@ -101,7 +101,7 @@ class XendStateStore:
         if not os.path.exists(xml_path):
             return {}
 
-        if not os.path.getsize(xml_path) == 0:
+        if os.path.getsize(xml_path) == 0:
             return {}
 
         dom = minidom.parse(xml_path)

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 23:44:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 23:44: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.xen.org>)
	id 1TYQ9O-0002Cr-Gp; Tue, 13 Nov 2012 23:44:14 +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 1TYQ9N-0002CB-PW
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:13 +0000
Received: from [85.158.137.99:51229] by server-6.bemta-3.messagelabs.com id
	23/9C-28265-D4BD2A05; Tue, 13 Nov 2012 23:44:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-217.messagelabs.com!1352850251!18105812!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1493 invoked from network); 13 Nov 2012 23:44:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Nov 2012 23: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 1TYQ9L-00087P-I6
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYQ9L-0001Eg-DM
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:11 +0000
Message-Id: <E1TYQ9L-0001Eg-DM@xenbits.xen.org>
Date: Tue, 13 Nov 2012 23: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] pygrub: correct typo in --args
	assignment
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352830215 0
# Node ID 0ac3938a6ceed3dbe737136a8addd9a66f4dc8e1
# Parent  e9f906ff6539dd3d7206ba228cd1d8dbfde869b0
pygrub: correct typo in --args assignment

If pygrub was called with --args="some thing", then this string should
be append to the kernel command line.  But the last changeset
25941:795c493fe561 contained a typo, it assigns 'args' instead of 'arg'.

Rename the local variable which holds the string from the domain config
file to avoid further confusion.

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

xen-unstable changeset: 26018:ecc7627ca6d7
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-4.2-testing changeset: 25899:dbb1872bbb97
Backport-requested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r e9f906ff6539 -r 0ac3938a6cee tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub	Tue Nov 13 18:10:06 2012 +0000
+++ b/tools/pygrub/src/pygrub	Tue Nov 13 18:10:15 2012 +0000
@@ -555,7 +555,7 @@ def get_entry_idx(cf, entry):
 
     return None
 
-def run_grub(file, entry, fs, arg):
+def run_grub(file, entry, fs, cfg_args):
     global g
     global sel
 
@@ -592,8 +592,8 @@ def run_grub(file, entry, fs, arg):
         grubcfg["ramdisk"] = img.initrd[1]
     if img.args:
         grubcfg["args"] += img.args
-    if arg:
-        grubcfg["args"] += " " + args
+    if cfg_args:
+        grubcfg["args"] += " " + cfg_args
 
     return grubcfg
 

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 23:44:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 23:44: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.xen.org>)
	id 1TYQ9Q-0002EO-Oc; Tue, 13 Nov 2012 23:44:16 +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 1TYQ9O-0002Cc-Ql
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:15 +0000
Received: from [193.109.254.147:53288] by server-7.bemta-14.messagelabs.com id
	2C/D8-02272-E4BD2A05; Tue, 13 Nov 2012 23:44:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1352850252!3859200!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 753 invoked from network); 13 Nov 2012 23:44:13 -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;
	13 Nov 2012 23: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 1TYQ9M-00087S-2w
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYQ9L-0001Ev-Tx
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:11 +0000
Message-Id: <E1TYQ9L-0001Ev-Tx@xenbits.xen.org>
Date: Tue, 13 Nov 2012 23:44:11 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] tools: xend: fix wrong condition
	check for xml file
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Joe Jin <joe.jin@oracle.com>
# Date 1352830269 0
# Node ID bfe09091c0c50211f9f8240be5ee2bc39b4e49aa
# Parent  0ac3938a6ceed3dbe737136a8addd9a66f4dc8e1
tools: xend: fix wrong condition check for xml file

In commit e8d40584, it intended to check xml file size and when empty will
return, the condition should be "if os.path.getsize(xml_path) == 0" rather
then "if not os.path.getsize(xml_path) == 0".

Signed-off-by: Chuang Cao <chuang.cao@oracle.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 26088:dd64a1bdbe3a
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-4.2-testing changeset: 25905:82b61b99d15d
Backport-requested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 0ac3938a6cee -r bfe09091c0c5 tools/python/xen/xend/XendStateStore.py
--- a/tools/python/xen/xend/XendStateStore.py	Tue Nov 13 18:10:15 2012 +0000
+++ b/tools/python/xen/xend/XendStateStore.py	Tue Nov 13 18:11:09 2012 +0000
@@ -101,7 +101,7 @@ class XendStateStore:
         if not os.path.exists(xml_path):
             return {}
 
-        if not os.path.getsize(xml_path) == 0:
+        if os.path.getsize(xml_path) == 0:
             return {}
 
         dom = minidom.parse(xml_path)

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 23:44:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 23:44: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.xen.org>)
	id 1TYQ9Q-0002ET-RD; Tue, 13 Nov 2012 23:44: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 1TYQ9P-0002Ct-5x
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:15 +0000
Received: from [85.158.139.83:44991] by server-15.bemta-5.messagelabs.com id
	DC/46-26920-E4BD2A05; Tue, 13 Nov 2012 23:44:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1352850252!27760675!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13476 invoked from network); 13 Nov 2012 23:44:13 -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;
	13 Nov 2012 23: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 1TYQ9M-00087V-ID
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYQ9M-0001FA-FE
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:12 +0000
Message-Id: <E1TYQ9M-0001FA-FE@xenbits.xen.org>
Date: Tue, 13 Nov 2012 23:44:11 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] xend/pvscsi: fix passing of SCSI
	control LUNs
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352830391 0
# Node ID 0f01a15628daf48f953a0de063a5695603c2a7e2
# Parent  bfe09091c0c50211f9f8240be5ee2bc39b4e49aa
xend/pvscsi: fix passing of SCSI control LUNs

Currently pvscsi can not pass SCSI devices that have just a scsi_generic node.
In the following example sg3 is a control LUN for the disk sdd.
But vscsi=['4:0:2:0,0:0:0:0'] does not work because the internal 'devname'
variable remains None. Later writing p-devname to xenstore fails because None
is not a valid string variable.

Since devname is used for just informational purpose use sg also as devname.

carron:~ $ lsscsi -g
[0:0:0:0]    disk    ATA      FK0032CAAZP      HPF2  /dev/sda   /dev/sg0
[4:0:0:0]    disk    HP       P2000G3 FC/iSCSI T100  /dev/sdb   /dev/sg1
[4:0:1:0]    disk    HP       P2000G3 FC/iSCSI T100  /dev/sdc   /dev/sg2
[4:0:2:0]    storage HP       HSV400           0950  -         /dev/sg3
[4:0:2:1]    disk    HP       HSV400           0950  /dev/sdd   /dev/sg4
[4:0:3:0]    storage HP       HSV400           0950  -         /dev/sg5
[4:0:3:1]    disk    HP       HSV400           0950  /dev/sde   /dev/sg6

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

xen-unstable changeset: 26008:eecb528583d7
Backport-requested-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-4.2-testing changeset: 25913:16ced2f387b9
Backport-requested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r bfe09091c0c5 -r 0f01a15628da tools/python/xen/util/vscsi_util.py
--- a/tools/python/xen/util/vscsi_util.py	Tue Nov 13 18:11:09 2012 +0000
+++ b/tools/python/xen/util/vscsi_util.py	Tue Nov 13 18:13:11 2012 +0000
@@ -105,6 +105,8 @@ def _vscsi_get_scsidevices_by_lsscsi(opt
             devname = None
         try:
             sg = s[-1].split('/dev/')[1]
+            if devname is None:
+                devname = sg
             scsi_id = _vscsi_get_scsiid(sg)
         except IndexError:
             sg = None

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 23:44:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 23:44: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.xen.org>)
	id 1TYQ9Q-0002ET-RD; Tue, 13 Nov 2012 23:44: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 1TYQ9P-0002Ct-5x
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:15 +0000
Received: from [85.158.139.83:44991] by server-15.bemta-5.messagelabs.com id
	DC/46-26920-E4BD2A05; Tue, 13 Nov 2012 23:44:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1352850252!27760675!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13476 invoked from network); 13 Nov 2012 23:44:13 -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;
	13 Nov 2012 23: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 1TYQ9M-00087V-ID
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYQ9M-0001FA-FE
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:12 +0000
Message-Id: <E1TYQ9M-0001FA-FE@xenbits.xen.org>
Date: Tue, 13 Nov 2012 23:44:11 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] xend/pvscsi: fix passing of SCSI
	control LUNs
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352830391 0
# Node ID 0f01a15628daf48f953a0de063a5695603c2a7e2
# Parent  bfe09091c0c50211f9f8240be5ee2bc39b4e49aa
xend/pvscsi: fix passing of SCSI control LUNs

Currently pvscsi can not pass SCSI devices that have just a scsi_generic node.
In the following example sg3 is a control LUN for the disk sdd.
But vscsi=['4:0:2:0,0:0:0:0'] does not work because the internal 'devname'
variable remains None. Later writing p-devname to xenstore fails because None
is not a valid string variable.

Since devname is used for just informational purpose use sg also as devname.

carron:~ $ lsscsi -g
[0:0:0:0]    disk    ATA      FK0032CAAZP      HPF2  /dev/sda   /dev/sg0
[4:0:0:0]    disk    HP       P2000G3 FC/iSCSI T100  /dev/sdb   /dev/sg1
[4:0:1:0]    disk    HP       P2000G3 FC/iSCSI T100  /dev/sdc   /dev/sg2
[4:0:2:0]    storage HP       HSV400           0950  -         /dev/sg3
[4:0:2:1]    disk    HP       HSV400           0950  /dev/sdd   /dev/sg4
[4:0:3:0]    storage HP       HSV400           0950  -         /dev/sg5
[4:0:3:1]    disk    HP       HSV400           0950  /dev/sde   /dev/sg6

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

xen-unstable changeset: 26008:eecb528583d7
Backport-requested-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-4.2-testing changeset: 25913:16ced2f387b9
Backport-requested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r bfe09091c0c5 -r 0f01a15628da tools/python/xen/util/vscsi_util.py
--- a/tools/python/xen/util/vscsi_util.py	Tue Nov 13 18:11:09 2012 +0000
+++ b/tools/python/xen/util/vscsi_util.py	Tue Nov 13 18:13:11 2012 +0000
@@ -105,6 +105,8 @@ def _vscsi_get_scsidevices_by_lsscsi(opt
             devname = None
         try:
             sg = s[-1].split('/dev/')[1]
+            if devname is None:
+                devname = sg
             scsi_id = _vscsi_get_scsiid(sg)
         except IndexError:
             sg = None

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 23:44:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 23:44: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.xen.org>)
	id 1TYQ9Q-0002EY-U6; Tue, 13 Nov 2012 23:44:16 +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 1TYQ9P-0002CB-7l
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:15 +0000
Received: from [85.158.138.51:6203] by server-6.bemta-3.messagelabs.com id
	16/9C-28265-E4BD2A05; Tue, 13 Nov 2012 23:44:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1352850253!10188118!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8441 invoked from network); 13 Nov 2012 23:44:14 -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;
	13 Nov 2012 23: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 1TYQ9N-00087Y-1s
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYQ9N-0001FP-0N
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:13 +0000
Message-Id: <E1TYQ9N-0001FP-0N@xenbits.xen.org>
Date: Tue, 13 Nov 2012 23:44:12 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] xend/pvscsi: fix usage of
	persistant device names for SCSI devices
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352830397 0
# Node ID c14e373357752748ce8371b5ffefaea09bd50b3c
# Parent  0f01a15628daf48f953a0de063a5695603c2a7e2
xend/pvscsi: fix usage of persistant device names for SCSI devices

Currently the callers of vscsi_get_scsidevices() do not pass a mask
string.  This will call "lsscsi -g '[]'", which causes a lsscsi syntax
error. As a result the sysfs parser _vscsi_get_scsidevices() is used.
But this parser is broken and the specified names in the config file are
not found.

Using a mask '*' if no mask was given will call lsscsi correctly and the
following config is parsed correctly:

vscsi=[
	'/dev/sg3, 0:0:0:0',
	'/dev/disk/by-id/wwn-0x600508b4000cf1c30000800000410000, 0:0:0:1'
]

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

xen-unstable changeset: 26009:2dbfa4d2e107
Backport-requested-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-4.2-testing changeset: 25914:b8916af165b9
Backport-requested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 0f01a15628da -r c14e37335775 tools/python/xen/util/vscsi_util.py
--- a/tools/python/xen/util/vscsi_util.py	Tue Nov 13 18:13:11 2012 +0000
+++ b/tools/python/xen/util/vscsi_util.py	Tue Nov 13 18:13:17 2012 +0000
@@ -150,7 +150,7 @@ def _vscsi_get_scsidevices_by_sysfs():
     return devices
 
 
-def vscsi_get_scsidevices(mask=""):
+def vscsi_get_scsidevices(mask="*"):
     """ get all scsi devices information """
 
     devices = _vscsi_get_scsidevices_by_lsscsi("[%s]" % mask)
@@ -279,7 +279,7 @@ def get_scsi_device(pHCTL):
             return _make_scsi_record(scsi_info)
     return None
 
-def get_all_scsi_devices(mask=""):
+def get_all_scsi_devices(mask="*"):
     scsi_records = []
     for scsi_info in vscsi_get_scsidevices(mask):
         scsi_record = _make_scsi_record(scsi_info)

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 23:44:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 23:44: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.xen.org>)
	id 1TYQ9Q-0002EY-U6; Tue, 13 Nov 2012 23:44:16 +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 1TYQ9P-0002CB-7l
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:15 +0000
Received: from [85.158.138.51:6203] by server-6.bemta-3.messagelabs.com id
	16/9C-28265-E4BD2A05; Tue, 13 Nov 2012 23:44:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1352850253!10188118!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8441 invoked from network); 13 Nov 2012 23:44:14 -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;
	13 Nov 2012 23: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 1TYQ9N-00087Y-1s
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYQ9N-0001FP-0N
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:13 +0000
Message-Id: <E1TYQ9N-0001FP-0N@xenbits.xen.org>
Date: Tue, 13 Nov 2012 23:44:12 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] xend/pvscsi: fix usage of
	persistant device names for SCSI devices
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352830397 0
# Node ID c14e373357752748ce8371b5ffefaea09bd50b3c
# Parent  0f01a15628daf48f953a0de063a5695603c2a7e2
xend/pvscsi: fix usage of persistant device names for SCSI devices

Currently the callers of vscsi_get_scsidevices() do not pass a mask
string.  This will call "lsscsi -g '[]'", which causes a lsscsi syntax
error. As a result the sysfs parser _vscsi_get_scsidevices() is used.
But this parser is broken and the specified names in the config file are
not found.

Using a mask '*' if no mask was given will call lsscsi correctly and the
following config is parsed correctly:

vscsi=[
	'/dev/sg3, 0:0:0:0',
	'/dev/disk/by-id/wwn-0x600508b4000cf1c30000800000410000, 0:0:0:1'
]

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

xen-unstable changeset: 26009:2dbfa4d2e107
Backport-requested-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-4.2-testing changeset: 25914:b8916af165b9
Backport-requested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 0f01a15628da -r c14e37335775 tools/python/xen/util/vscsi_util.py
--- a/tools/python/xen/util/vscsi_util.py	Tue Nov 13 18:13:11 2012 +0000
+++ b/tools/python/xen/util/vscsi_util.py	Tue Nov 13 18:13:17 2012 +0000
@@ -150,7 +150,7 @@ def _vscsi_get_scsidevices_by_sysfs():
     return devices
 
 
-def vscsi_get_scsidevices(mask=""):
+def vscsi_get_scsidevices(mask="*"):
     """ get all scsi devices information """
 
     devices = _vscsi_get_scsidevices_by_lsscsi("[%s]" % mask)
@@ -279,7 +279,7 @@ def get_scsi_device(pHCTL):
             return _make_scsi_record(scsi_info)
     return None
 
-def get_all_scsi_devices(mask=""):
+def get_all_scsi_devices(mask="*"):
     scsi_records = []
     for scsi_info in vscsi_get_scsidevices(mask):
         scsi_record = _make_scsi_record(scsi_info)

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 23:44:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 23: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 1TYQ9S-0002Ew-1G; Tue, 13 Nov 2012 23:44:18 +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 1TYQ9Q-0002Dg-7Z
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:16 +0000
Received: from [193.109.254.147:39106] by server-15.bemta-14.messagelabs.com
	id DD/E6-12105-F4BD2A05; Tue, 13 Nov 2012 23:44:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1352850253!8180628!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23403 invoked from network); 13 Nov 2012 23:44:14 -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;
	13 Nov 2012 23: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 1TYQ9N-00087b-LT
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYQ9N-0001Fe-GW
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:13 +0000
Message-Id: <E1TYQ9N-0001Fe-GW@xenbits.xen.org>
Date: Tue, 13 Nov 2012 23:44:13 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] xend/pvscsi: update sysfs parser
	for Linux 3.0
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352830404 0
# Node ID 1104badf41514e6314d1aac9faecb8007e460313
# Parent  c14e373357752748ce8371b5ffefaea09bd50b3c
xend/pvscsi: update sysfs parser for Linux 3.0

The sysfs parser for /sys/bus/scsi/devices understands only the layout
of kernel version 2.6.16. This looks as follows:

/sys/bus/scsi/devices/1:0:0:0/block:sda is a symlink to /sys/block/sda/
/sys/bus/scsi/devices/1:0:0:0/scsi_generic:sg1 is a symlink to /sys/class/scsi_generic/sg1

Both directories contain a 'dev' file with the major:minor information.
This patch updates the used regex strings to match also the colon to
make it more robust against possible future changes.

In kernel version 3.0 the layout changed:
/sys/bus/scsi/devices/ contains now additional symlinks to directories
such as host1 and target1:0:0. This patch ignores these as they do not
point to the desired scsi devices. They just clutter the devices array.

The directory layout in '1:0:0:0' changed as well, the 'type:name'
notation was replaced with 'type/name' directories:

/sys/bus/scsi/devices/1:0:0:0/block/sda/
/sys/bus/scsi/devices/1:0:0:0/scsi_generic/sg1/

Both directories contain a 'dev' file with the major:minor information.
This patch adds additional code to walk the subdir to find the 'dev'
file to make sure the given subdirectory is really the kernel name.

In addition this patch makes sure devname is not None.

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

xen-unstable changeset: 26010:cff10030c6ea
Backport-requested-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-4.2-testing changeset: 25915:839e5d95d483
Backport-requested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r c14e37335775 -r 1104badf4151 tools/python/xen/util/vscsi_util.py
--- a/tools/python/xen/util/vscsi_util.py	Tue Nov 13 18:13:17 2012 +0000
+++ b/tools/python/xen/util/vscsi_util.py	Tue Nov 13 18:13:24 2012 +0000
@@ -130,20 +130,36 @@ def _vscsi_get_scsidevices_by_sysfs():
 
     for dirpath, dirnames, files in os.walk(sysfs_mnt + SYSFS_SCSI_PATH):
         for hctl in dirnames:
+            if len(hctl.split(':')) != 4:
+                continue
             paths = os.path.join(dirpath, hctl)
             devname = None
             sg = None
             scsi_id = None
             for f in os.listdir(paths):
                 realpath = os.path.realpath(os.path.join(paths, f))
-                if  re.match('^block', f) or \
-                    re.match('^tape', f) or \
-                    re.match('^scsi_changer', f) or \
-                    re.match('^onstream_tape', f):
+                if  re.match('^block:', f) or \
+                    re.match('^tape:', f) or \
+                    re.match('^scsi_changer:', f) or \
+                    re.match('^onstream_tape:', f):
                     devname = os.path.basename(realpath)
+                elif f == "block" or \
+                     f == "tape" or \
+                     f == "scsi_changer" or \
+                     f == "onstream_tape":
+                    for dir in os.listdir(os.path.join(paths, f)):
+                        if os.path.exists(os.path.join(paths, f, dir, "dev")):
+                            devname = os.path.basename(dir)
 
-                if re.match('^scsi_generic', f):
+                if re.match('^scsi_generic:', f):
                     sg = os.path.basename(realpath)
+                elif f == "scsi_generic":
+                    for dir in os.listdir(os.path.join(paths, f)):
+                        if os.path.exists(os.path.join(paths, f, dir, "dev")):
+                            sg = os.path.basename(dir)
+                if sg:
+                    if devname is None:
+                        devname = sg
                     scsi_id = _vscsi_get_scsiid(sg)
             devices.append([hctl, devname, sg, scsi_id])
 

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 23:44:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 23: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 1TYQ9S-0002Ew-1G; Tue, 13 Nov 2012 23:44:18 +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 1TYQ9Q-0002Dg-7Z
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:16 +0000
Received: from [193.109.254.147:39106] by server-15.bemta-14.messagelabs.com
	id DD/E6-12105-F4BD2A05; Tue, 13 Nov 2012 23:44:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1352850253!8180628!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23403 invoked from network); 13 Nov 2012 23:44:14 -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;
	13 Nov 2012 23: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 1TYQ9N-00087b-LT
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYQ9N-0001Fe-GW
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:13 +0000
Message-Id: <E1TYQ9N-0001Fe-GW@xenbits.xen.org>
Date: Tue, 13 Nov 2012 23:44:13 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] xend/pvscsi: update sysfs parser
	for Linux 3.0
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352830404 0
# Node ID 1104badf41514e6314d1aac9faecb8007e460313
# Parent  c14e373357752748ce8371b5ffefaea09bd50b3c
xend/pvscsi: update sysfs parser for Linux 3.0

The sysfs parser for /sys/bus/scsi/devices understands only the layout
of kernel version 2.6.16. This looks as follows:

/sys/bus/scsi/devices/1:0:0:0/block:sda is a symlink to /sys/block/sda/
/sys/bus/scsi/devices/1:0:0:0/scsi_generic:sg1 is a symlink to /sys/class/scsi_generic/sg1

Both directories contain a 'dev' file with the major:minor information.
This patch updates the used regex strings to match also the colon to
make it more robust against possible future changes.

In kernel version 3.0 the layout changed:
/sys/bus/scsi/devices/ contains now additional symlinks to directories
such as host1 and target1:0:0. This patch ignores these as they do not
point to the desired scsi devices. They just clutter the devices array.

The directory layout in '1:0:0:0' changed as well, the 'type:name'
notation was replaced with 'type/name' directories:

/sys/bus/scsi/devices/1:0:0:0/block/sda/
/sys/bus/scsi/devices/1:0:0:0/scsi_generic/sg1/

Both directories contain a 'dev' file with the major:minor information.
This patch adds additional code to walk the subdir to find the 'dev'
file to make sure the given subdirectory is really the kernel name.

In addition this patch makes sure devname is not None.

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

xen-unstable changeset: 26010:cff10030c6ea
Backport-requested-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-4.2-testing changeset: 25915:839e5d95d483
Backport-requested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r c14e37335775 -r 1104badf4151 tools/python/xen/util/vscsi_util.py
--- a/tools/python/xen/util/vscsi_util.py	Tue Nov 13 18:13:17 2012 +0000
+++ b/tools/python/xen/util/vscsi_util.py	Tue Nov 13 18:13:24 2012 +0000
@@ -130,20 +130,36 @@ def _vscsi_get_scsidevices_by_sysfs():
 
     for dirpath, dirnames, files in os.walk(sysfs_mnt + SYSFS_SCSI_PATH):
         for hctl in dirnames:
+            if len(hctl.split(':')) != 4:
+                continue
             paths = os.path.join(dirpath, hctl)
             devname = None
             sg = None
             scsi_id = None
             for f in os.listdir(paths):
                 realpath = os.path.realpath(os.path.join(paths, f))
-                if  re.match('^block', f) or \
-                    re.match('^tape', f) or \
-                    re.match('^scsi_changer', f) or \
-                    re.match('^onstream_tape', f):
+                if  re.match('^block:', f) or \
+                    re.match('^tape:', f) or \
+                    re.match('^scsi_changer:', f) or \
+                    re.match('^onstream_tape:', f):
                     devname = os.path.basename(realpath)
+                elif f == "block" or \
+                     f == "tape" or \
+                     f == "scsi_changer" or \
+                     f == "onstream_tape":
+                    for dir in os.listdir(os.path.join(paths, f)):
+                        if os.path.exists(os.path.join(paths, f, dir, "dev")):
+                            devname = os.path.basename(dir)
 
-                if re.match('^scsi_generic', f):
+                if re.match('^scsi_generic:', f):
                     sg = os.path.basename(realpath)
+                elif f == "scsi_generic":
+                    for dir in os.listdir(os.path.join(paths, f)):
+                        if os.path.exists(os.path.join(paths, f, dir, "dev")):
+                            sg = os.path.basename(dir)
+                if sg:
+                    if devname is None:
+                        devname = sg
                     scsi_id = _vscsi_get_scsiid(sg)
             devices.append([hctl, devname, sg, scsi_id])
 

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 23:44:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 23: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 1TYQ9T-0002GO-56; Tue, 13 Nov 2012 23:44: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 1TYQ9R-0002Ea-II
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:17 +0000
Received: from [193.109.254.147:10281] by server-5.bemta-14.messagelabs.com id
	6A/72-10257-05BD2A05; Tue, 13 Nov 2012 23:44:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1352850254!8995021!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29157 invoked from network); 13 Nov 2012 23:44:15 -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;
	13 Nov 2012 23: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 1TYQ9O-00087e-69
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYQ9O-0001Ft-1S
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:14 +0000
Message-Id: <E1TYQ9O-0001Ft-1S@xenbits.xen.org>
Date: Tue, 13 Nov 2012 23:44:13 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] 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: "Change log for Mercurial \(receive only\)"
	<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 1352831683 0
# Node ID 26281a1650dcdf3878f4cab992995b8fce97a96e
# Parent  1104badf41514e6314d1aac9faecb8007e460313
QEMU_TAG update
---


diff -r 1104badf4151 -r 26281a1650dc Config.mk
--- a/Config.mk	Tue Nov 13 18:13:24 2012 +0000
+++ b/Config.mk	Tue Nov 13 18:34:43 2012 +0000
@@ -179,9 +179,9 @@ endif
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= d7d453f51459b591faa96d1c123b5bfff7c5b6b6
-# Thu Sep 6 17:05:30 2012 +0100
-# Disable qemu monitor by default.  The qemu monitor is an overly
+QEMU_TAG ?= b36c42985575cd6d761d39e5770e57a1f52832ae
+# Tue Nov 13 18:25:17 2012 +0000
+# mapcache: Fix invalidate if memory requested was not bucket aligned
 
 # Optional components
 XENSTAT_XENTOP     ?= y

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

From xen-changelog-bounces@lists.xen.org Tue Nov 13 23:44:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Nov 2012 23: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 1TYQ9T-0002GO-56; Tue, 13 Nov 2012 23:44: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 1TYQ9R-0002Ea-II
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:17 +0000
Received: from [193.109.254.147:10281] by server-5.bemta-14.messagelabs.com id
	6A/72-10257-05BD2A05; Tue, 13 Nov 2012 23:44:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1352850254!8995021!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29157 invoked from network); 13 Nov 2012 23:44:15 -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;
	13 Nov 2012 23: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 1TYQ9O-00087e-69
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYQ9O-0001Ft-1S
	for xen-changelog@lists.xensource.com; Tue, 13 Nov 2012 23:44:14 +0000
Message-Id: <E1TYQ9O-0001Ft-1S@xenbits.xen.org>
Date: Tue, 13 Nov 2012 23:44:13 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] 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: "Change log for Mercurial \(receive only\)"
	<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 1352831683 0
# Node ID 26281a1650dcdf3878f4cab992995b8fce97a96e
# Parent  1104badf41514e6314d1aac9faecb8007e460313
QEMU_TAG update
---


diff -r 1104badf4151 -r 26281a1650dc Config.mk
--- a/Config.mk	Tue Nov 13 18:13:24 2012 +0000
+++ b/Config.mk	Tue Nov 13 18:34:43 2012 +0000
@@ -179,9 +179,9 @@ endif
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= d7d453f51459b591faa96d1c123b5bfff7c5b6b6
-# Thu Sep 6 17:05:30 2012 +0100
-# Disable qemu monitor by default.  The qemu monitor is an overly
+QEMU_TAG ?= b36c42985575cd6d761d39e5770e57a1f52832ae
+# Tue Nov 13 18:25:17 2012 +0000
+# mapcache: Fix invalidate if memory requested was not bucket aligned
 
 # Optional components
 XENSTAT_XENTOP     ?= y

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 04:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 04: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.xen.org>)
	id 1TYUJn-0004LR-2U; Wed, 14 Nov 2012 04:11: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 1TYUJl-0004L7-SD
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 04:11:14 +0000
Received: from [85.158.143.35:56255] by server-1.bemta-4.messagelabs.com id
	5E/6F-27934-1E913A05; Wed, 14 Nov 2012 04:11:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-21.messagelabs.com!1352866270!12692248!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27897 invoked from network); 14 Nov 2012 04:11: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;
	14 Nov 2012 04: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 1TYUJi-0000tG-3Q
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 04:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYUJh-0008MI-PF
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 04:11:09 +0000
Message-Id: <E1TYUJh-0008MI-PF@xenbits.xen.org>
Date: Wed, 14 Nov 2012 04:11:09 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xend/pvscsi: fix usage of
	persistant device names for SCSI devices
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352829651 0
# Node ID b8916af165b9e900af428acc9332355144303578
# Parent  16ced2f387b980abdf74d8e7b94308d3f27f1329
xend/pvscsi: fix usage of persistant device names for SCSI devices

Currently the callers of vscsi_get_scsidevices() do not pass a mask
string.  This will call "lsscsi -g '[]'", which causes a lsscsi syntax
error. As a result the sysfs parser _vscsi_get_scsidevices() is used.
But this parser is broken and the specified names in the config file are
not found.

Using a mask '*' if no mask was given will call lsscsi correctly and the
following config is parsed correctly:

vscsi=[
	'/dev/sg3, 0:0:0:0',
	'/dev/disk/by-id/wwn-0x600508b4000cf1c30000800000410000, 0:0:0:1'
]

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

xen-unstable changeset: 26009:2dbfa4d2e107
Backport-requested-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 16ced2f387b9 -r b8916af165b9 tools/python/xen/util/vscsi_util.py
--- a/tools/python/xen/util/vscsi_util.py	Tue Nov 13 18:00:42 2012 +0000
+++ b/tools/python/xen/util/vscsi_util.py	Tue Nov 13 18:00:51 2012 +0000
@@ -150,7 +150,7 @@ def _vscsi_get_scsidevices_by_sysfs():
     return devices
 
 
-def vscsi_get_scsidevices(mask=""):
+def vscsi_get_scsidevices(mask="*"):
     """ get all scsi devices information """
 
     devices = _vscsi_get_scsidevices_by_lsscsi("[%s]" % mask)
@@ -279,7 +279,7 @@ def get_scsi_device(pHCTL):
             return _make_scsi_record(scsi_info)
     return None
 
-def get_all_scsi_devices(mask=""):
+def get_all_scsi_devices(mask="*"):
     scsi_records = []
     for scsi_info in vscsi_get_scsidevices(mask):
         scsi_record = _make_scsi_record(scsi_info)

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 04:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 04: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.xen.org>)
	id 1TYUJn-0004LR-2U; Wed, 14 Nov 2012 04:11: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 1TYUJl-0004L7-SD
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 04:11:14 +0000
Received: from [85.158.143.35:56255] by server-1.bemta-4.messagelabs.com id
	5E/6F-27934-1E913A05; Wed, 14 Nov 2012 04:11:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-21.messagelabs.com!1352866270!12692248!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27897 invoked from network); 14 Nov 2012 04:11: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;
	14 Nov 2012 04: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 1TYUJi-0000tG-3Q
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 04:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYUJh-0008MI-PF
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 04:11:09 +0000
Message-Id: <E1TYUJh-0008MI-PF@xenbits.xen.org>
Date: Wed, 14 Nov 2012 04:11:09 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xend/pvscsi: fix usage of
	persistant device names for SCSI devices
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352829651 0
# Node ID b8916af165b9e900af428acc9332355144303578
# Parent  16ced2f387b980abdf74d8e7b94308d3f27f1329
xend/pvscsi: fix usage of persistant device names for SCSI devices

Currently the callers of vscsi_get_scsidevices() do not pass a mask
string.  This will call "lsscsi -g '[]'", which causes a lsscsi syntax
error. As a result the sysfs parser _vscsi_get_scsidevices() is used.
But this parser is broken and the specified names in the config file are
not found.

Using a mask '*' if no mask was given will call lsscsi correctly and the
following config is parsed correctly:

vscsi=[
	'/dev/sg3, 0:0:0:0',
	'/dev/disk/by-id/wwn-0x600508b4000cf1c30000800000410000, 0:0:0:1'
]

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

xen-unstable changeset: 26009:2dbfa4d2e107
Backport-requested-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 16ced2f387b9 -r b8916af165b9 tools/python/xen/util/vscsi_util.py
--- a/tools/python/xen/util/vscsi_util.py	Tue Nov 13 18:00:42 2012 +0000
+++ b/tools/python/xen/util/vscsi_util.py	Tue Nov 13 18:00:51 2012 +0000
@@ -150,7 +150,7 @@ def _vscsi_get_scsidevices_by_sysfs():
     return devices
 
 
-def vscsi_get_scsidevices(mask=""):
+def vscsi_get_scsidevices(mask="*"):
     """ get all scsi devices information """
 
     devices = _vscsi_get_scsidevices_by_lsscsi("[%s]" % mask)
@@ -279,7 +279,7 @@ def get_scsi_device(pHCTL):
             return _make_scsi_record(scsi_info)
     return None
 
-def get_all_scsi_devices(mask=""):
+def get_all_scsi_devices(mask="*"):
     scsi_records = []
     for scsi_info in vscsi_get_scsidevices(mask):
         scsi_record = _make_scsi_record(scsi_info)

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 04:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 04: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.xen.org>)
	id 1TYUJm-0004LM-Vi; Wed, 14 Nov 2012 04: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 1TYUJl-0004L2-Bt
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 04:11:13 +0000
Received: from [85.158.139.83:26070] by server-9.bemta-5.messagelabs.com id
	F1/D5-29295-0E913A05; Wed, 14 Nov 2012 04:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-182.messagelabs.com!1352866270!21557743!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28197 invoked from network); 14 Nov 2012 04:11: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;
	14 Nov 2012 04: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 1TYUJi-0000tK-I0
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 04:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYUJi-0008MX-AZ
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 04:11:10 +0000
Message-Id: <E1TYUJi-0008MX-AZ@xenbits.xen.org>
Date: Wed, 14 Nov 2012 04:11:09 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xend/pvscsi: update sysfs parser
	for Linux 3.0
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352829657 0
# Node ID 839e5d95d483586dac5073cb59f845910588b000
# Parent  b8916af165b9e900af428acc9332355144303578
xend/pvscsi: update sysfs parser for Linux 3.0

The sysfs parser for /sys/bus/scsi/devices understands only the layout
of kernel version 2.6.16. This looks as follows:

/sys/bus/scsi/devices/1:0:0:0/block:sda is a symlink to /sys/block/sda/
/sys/bus/scsi/devices/1:0:0:0/scsi_generic:sg1 is a symlink to /sys/class/scsi_generic/sg1

Both directories contain a 'dev' file with the major:minor information.
This patch updates the used regex strings to match also the colon to
make it more robust against possible future changes.

In kernel version 3.0 the layout changed:
/sys/bus/scsi/devices/ contains now additional symlinks to directories
such as host1 and target1:0:0. This patch ignores these as they do not
point to the desired scsi devices. They just clutter the devices array.

The directory layout in '1:0:0:0' changed as well, the 'type:name'
notation was replaced with 'type/name' directories:

/sys/bus/scsi/devices/1:0:0:0/block/sda/
/sys/bus/scsi/devices/1:0:0:0/scsi_generic/sg1/

Both directories contain a 'dev' file with the major:minor information.
This patch adds additional code to walk the subdir to find the 'dev'
file to make sure the given subdirectory is really the kernel name.

In addition this patch makes sure devname is not None.

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

xen-unstable changeset: 26010:cff10030c6ea
Backport-requested-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r b8916af165b9 -r 839e5d95d483 tools/python/xen/util/vscsi_util.py
--- a/tools/python/xen/util/vscsi_util.py	Tue Nov 13 18:00:51 2012 +0000
+++ b/tools/python/xen/util/vscsi_util.py	Tue Nov 13 18:00:57 2012 +0000
@@ -130,20 +130,36 @@ def _vscsi_get_scsidevices_by_sysfs():
 
     for dirpath, dirnames, files in os.walk(sysfs_mnt + SYSFS_SCSI_PATH):
         for hctl in dirnames:
+            if len(hctl.split(':')) != 4:
+                continue
             paths = os.path.join(dirpath, hctl)
             devname = None
             sg = None
             scsi_id = None
             for f in os.listdir(paths):
                 realpath = os.path.realpath(os.path.join(paths, f))
-                if  re.match('^block', f) or \
-                    re.match('^tape', f) or \
-                    re.match('^scsi_changer', f) or \
-                    re.match('^onstream_tape', f):
+                if  re.match('^block:', f) or \
+                    re.match('^tape:', f) or \
+                    re.match('^scsi_changer:', f) or \
+                    re.match('^onstream_tape:', f):
                     devname = os.path.basename(realpath)
+                elif f == "block" or \
+                     f == "tape" or \
+                     f == "scsi_changer" or \
+                     f == "onstream_tape":
+                    for dir in os.listdir(os.path.join(paths, f)):
+                        if os.path.exists(os.path.join(paths, f, dir, "dev")):
+                            devname = os.path.basename(dir)
 
-                if re.match('^scsi_generic', f):
+                if re.match('^scsi_generic:', f):
                     sg = os.path.basename(realpath)
+                elif f == "scsi_generic":
+                    for dir in os.listdir(os.path.join(paths, f)):
+                        if os.path.exists(os.path.join(paths, f, dir, "dev")):
+                            sg = os.path.basename(dir)
+                if sg:
+                    if devname is None:
+                        devname = sg
                     scsi_id = _vscsi_get_scsiid(sg)
             devices.append([hctl, devname, sg, scsi_id])
 

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 04:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 04: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.xen.org>)
	id 1TYUJm-0004LM-Vi; Wed, 14 Nov 2012 04: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 1TYUJl-0004L2-Bt
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 04:11:13 +0000
Received: from [85.158.139.83:26070] by server-9.bemta-5.messagelabs.com id
	F1/D5-29295-0E913A05; Wed, 14 Nov 2012 04:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-182.messagelabs.com!1352866270!21557743!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28197 invoked from network); 14 Nov 2012 04:11: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;
	14 Nov 2012 04: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 1TYUJi-0000tK-I0
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 04:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYUJi-0008MX-AZ
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 04:11:10 +0000
Message-Id: <E1TYUJi-0008MX-AZ@xenbits.xen.org>
Date: Wed, 14 Nov 2012 04:11:09 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xend/pvscsi: update sysfs parser
	for Linux 3.0
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352829657 0
# Node ID 839e5d95d483586dac5073cb59f845910588b000
# Parent  b8916af165b9e900af428acc9332355144303578
xend/pvscsi: update sysfs parser for Linux 3.0

The sysfs parser for /sys/bus/scsi/devices understands only the layout
of kernel version 2.6.16. This looks as follows:

/sys/bus/scsi/devices/1:0:0:0/block:sda is a symlink to /sys/block/sda/
/sys/bus/scsi/devices/1:0:0:0/scsi_generic:sg1 is a symlink to /sys/class/scsi_generic/sg1

Both directories contain a 'dev' file with the major:minor information.
This patch updates the used regex strings to match also the colon to
make it more robust against possible future changes.

In kernel version 3.0 the layout changed:
/sys/bus/scsi/devices/ contains now additional symlinks to directories
such as host1 and target1:0:0. This patch ignores these as they do not
point to the desired scsi devices. They just clutter the devices array.

The directory layout in '1:0:0:0' changed as well, the 'type:name'
notation was replaced with 'type/name' directories:

/sys/bus/scsi/devices/1:0:0:0/block/sda/
/sys/bus/scsi/devices/1:0:0:0/scsi_generic/sg1/

Both directories contain a 'dev' file with the major:minor information.
This patch adds additional code to walk the subdir to find the 'dev'
file to make sure the given subdirectory is really the kernel name.

In addition this patch makes sure devname is not None.

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

xen-unstable changeset: 26010:cff10030c6ea
Backport-requested-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r b8916af165b9 -r 839e5d95d483 tools/python/xen/util/vscsi_util.py
--- a/tools/python/xen/util/vscsi_util.py	Tue Nov 13 18:00:51 2012 +0000
+++ b/tools/python/xen/util/vscsi_util.py	Tue Nov 13 18:00:57 2012 +0000
@@ -130,20 +130,36 @@ def _vscsi_get_scsidevices_by_sysfs():
 
     for dirpath, dirnames, files in os.walk(sysfs_mnt + SYSFS_SCSI_PATH):
         for hctl in dirnames:
+            if len(hctl.split(':')) != 4:
+                continue
             paths = os.path.join(dirpath, hctl)
             devname = None
             sg = None
             scsi_id = None
             for f in os.listdir(paths):
                 realpath = os.path.realpath(os.path.join(paths, f))
-                if  re.match('^block', f) or \
-                    re.match('^tape', f) or \
-                    re.match('^scsi_changer', f) or \
-                    re.match('^onstream_tape', f):
+                if  re.match('^block:', f) or \
+                    re.match('^tape:', f) or \
+                    re.match('^scsi_changer:', f) or \
+                    re.match('^onstream_tape:', f):
                     devname = os.path.basename(realpath)
+                elif f == "block" or \
+                     f == "tape" or \
+                     f == "scsi_changer" or \
+                     f == "onstream_tape":
+                    for dir in os.listdir(os.path.join(paths, f)):
+                        if os.path.exists(os.path.join(paths, f, dir, "dev")):
+                            devname = os.path.basename(dir)
 
-                if re.match('^scsi_generic', f):
+                if re.match('^scsi_generic:', f):
                     sg = os.path.basename(realpath)
+                elif f == "scsi_generic":
+                    for dir in os.listdir(os.path.join(paths, f)):
+                        if os.path.exists(os.path.join(paths, f, dir, "dev")):
+                            sg = os.path.basename(dir)
+                if sg:
+                    if devname is None:
+                        devname = sg
                     scsi_id = _vscsi_get_scsiid(sg)
             devices.append([hctl, devname, sg, scsi_id])
 

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 04:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 04: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.xen.org>)
	id 1TYUJm-0004LH-T7; Wed, 14 Nov 2012 04:11:14 +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 1TYUJk-0004L1-U6
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 04:11:13 +0000
Received: from [85.158.138.51:11878] by server-7.bemta-3.messagelabs.com id
	84/B8-01713-0E913A05; Wed, 14 Nov 2012 04:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-174.messagelabs.com!1352866270!29917037!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5498 invoked from network); 14 Nov 2012 04:11:11 -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 Nov 2012 04: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 1TYUJh-0000tE-Sc
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 04:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYUJh-0008M3-4w
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 04:11:09 +0000
Message-Id: <E1TYUJh-0008M3-4w@xenbits.xen.org>
Date: Wed, 14 Nov 2012 04:11:08 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xend/pvscsi: fix passing of SCSI
	control LUNs
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352829642 0
# Node ID 16ced2f387b980abdf74d8e7b94308d3f27f1329
# Parent  651d965ee2c0f3c7019ad291bfb665b4a8cd98b1
xend/pvscsi: fix passing of SCSI control LUNs

Currently pvscsi can not pass SCSI devices that have just a scsi_generic node.
In the following example sg3 is a control LUN for the disk sdd.
But vscsi=['4:0:2:0,0:0:0:0'] does not work because the internal 'devname'
variable remains None. Later writing p-devname to xenstore fails because None
is not a valid string variable.

Since devname is used for just informational purpose use sg also as devname.

carron:~ $ lsscsi -g
[0:0:0:0]    disk    ATA      FK0032CAAZP      HPF2  /dev/sda   /dev/sg0
[4:0:0:0]    disk    HP       P2000G3 FC/iSCSI T100  /dev/sdb   /dev/sg1
[4:0:1:0]    disk    HP       P2000G3 FC/iSCSI T100  /dev/sdc   /dev/sg2
[4:0:2:0]    storage HP       HSV400           0950  -         /dev/sg3
[4:0:2:1]    disk    HP       HSV400           0950  /dev/sdd   /dev/sg4
[4:0:3:0]    storage HP       HSV400           0950  -         /dev/sg5
[4:0:3:1]    disk    HP       HSV400           0950  /dev/sde   /dev/sg6

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

xen-unstable changeset: 26008:eecb528583d7
Backport-requested-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 651d965ee2c0 -r 16ced2f387b9 tools/python/xen/util/vscsi_util.py
--- a/tools/python/xen/util/vscsi_util.py	Thu Nov 01 17:46:03 2012 +0000
+++ b/tools/python/xen/util/vscsi_util.py	Tue Nov 13 18:00:42 2012 +0000
@@ -105,6 +105,8 @@ def _vscsi_get_scsidevices_by_lsscsi(opt
             devname = None
         try:
             sg = s[-1].split('/dev/')[1]
+            if devname is None:
+                devname = sg
             scsi_id = _vscsi_get_scsiid(sg)
         except IndexError:
             sg = None

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 04:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 04: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.xen.org>)
	id 1TYUJm-0004LH-T7; Wed, 14 Nov 2012 04:11:14 +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 1TYUJk-0004L1-U6
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 04:11:13 +0000
Received: from [85.158.138.51:11878] by server-7.bemta-3.messagelabs.com id
	84/B8-01713-0E913A05; Wed, 14 Nov 2012 04:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-174.messagelabs.com!1352866270!29917037!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5498 invoked from network); 14 Nov 2012 04:11:11 -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 Nov 2012 04: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 1TYUJh-0000tE-Sc
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 04:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYUJh-0008M3-4w
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 04:11:09 +0000
Message-Id: <E1TYUJh-0008M3-4w@xenbits.xen.org>
Date: Wed, 14 Nov 2012 04:11:08 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xend/pvscsi: fix passing of SCSI
	control LUNs
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352829642 0
# Node ID 16ced2f387b980abdf74d8e7b94308d3f27f1329
# Parent  651d965ee2c0f3c7019ad291bfb665b4a8cd98b1
xend/pvscsi: fix passing of SCSI control LUNs

Currently pvscsi can not pass SCSI devices that have just a scsi_generic node.
In the following example sg3 is a control LUN for the disk sdd.
But vscsi=['4:0:2:0,0:0:0:0'] does not work because the internal 'devname'
variable remains None. Later writing p-devname to xenstore fails because None
is not a valid string variable.

Since devname is used for just informational purpose use sg also as devname.

carron:~ $ lsscsi -g
[0:0:0:0]    disk    ATA      FK0032CAAZP      HPF2  /dev/sda   /dev/sg0
[4:0:0:0]    disk    HP       P2000G3 FC/iSCSI T100  /dev/sdb   /dev/sg1
[4:0:1:0]    disk    HP       P2000G3 FC/iSCSI T100  /dev/sdc   /dev/sg2
[4:0:2:0]    storage HP       HSV400           0950  -         /dev/sg3
[4:0:2:1]    disk    HP       HSV400           0950  /dev/sdd   /dev/sg4
[4:0:3:0]    storage HP       HSV400           0950  -         /dev/sg5
[4:0:3:1]    disk    HP       HSV400           0950  /dev/sde   /dev/sg6

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

xen-unstable changeset: 26008:eecb528583d7
Backport-requested-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 651d965ee2c0 -r 16ced2f387b9 tools/python/xen/util/vscsi_util.py
--- a/tools/python/xen/util/vscsi_util.py	Thu Nov 01 17:46:03 2012 +0000
+++ b/tools/python/xen/util/vscsi_util.py	Tue Nov 13 18:00:42 2012 +0000
@@ -105,6 +105,8 @@ def _vscsi_get_scsidevices_by_lsscsi(opt
             devname = None
         try:
             sg = s[-1].split('/dev/')[1]
+            if devname is None:
+                devname = sg
             scsi_id = _vscsi_get_scsiid(sg)
         except IndexError:
             sg = None

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 11:23:42 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 11:23: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.xen.org>)
	id 1TYb4E-0000or-Vb; Wed, 14 Nov 2012 11:23:38 +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 1TYb4E-0000ok-9X
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 11:23:38 +0000
Received: from [85.158.143.35:20120] by server-2.bemta-4.messagelabs.com id
	C7/6D-28922-93F73A05; Wed, 14 Nov 2012 11:23:37 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1352892124!7253188!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28194 invoked from network); 14 Nov 2012 11:22:05 -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 Nov 2012 11: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 1TYb2i-00068R-50
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 11:22:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYb2h-0003Rb-Pw
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 11:22:03 +0000
Message-Id: <E1TYb2h-0003Rb-Pw@xenbits.xen.org>
Date: Wed, 14 Nov 2012 11: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] scsifront: cleanup
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352891404 -3600
# Node ID f09889eaf6527f4ea0cc922e7d02da3bb7f919b5
# Parent  171f57e6ad50fb71354b5b7f2177394102ca02fe
scsifront: cleanup

- properly type the shadow field tracking the active command
- as a result, there's no need to also track the data direction
- in turn, re-arranging shadow fields reduces the size of the structure
  on 64-bit architectures
- there's no point in map_data_for_request() failing if there are no
  grant references available when none are needed anyway
- don't redundantly include linux/version.h

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


diff -r 171f57e6ad50 -r f09889eaf652 drivers/xen/scsifront/common.h
--- a/drivers/xen/scsifront/common.h	Mon Nov 12 09:40:45 2012 +0100
+++ b/drivers/xen/scsifront/common.h	Wed Nov 14 12:10:04 2012 +0100
@@ -80,21 +80,17 @@ struct vscsifrnt_shadow {
 	 * VSCSIIF_ACT_SCSI_CDB or VSCSIIF_ACT_SCSI_RESET */
 	unsigned char act;
 	
+	/* Number of pieces of scatter-gather */
+	unsigned int nr_segments;
+
 	/* do reset function */
 	wait_queue_head_t wq_reset;	/* reset work queue           */
 	int wait_reset;			/* reset work queue condition */
 	int32_t rslt_reset;		/* reset response status      */
 					/* (SUCESS or FAILED)         */
 
-	/* for DMA_TO_DEVICE(1), DMA_FROM_DEVICE(2), DMA_NONE(3) 
-	   requests */
-	unsigned int sc_data_direction;
-	
-	/* Number of pieces of scatter-gather */
-	unsigned int nr_segments;
-
 	/* requested struct scsi_cmnd is stored from kernel */
-	unsigned long req_scsi_cmnd;
+	struct scsi_cmnd *sc;
 	int gref[VSCSIIF_SG_TABLESIZE];
 };
 
diff -r 171f57e6ad50 -r f09889eaf652 drivers/xen/scsifront/scsifront.c
--- a/drivers/xen/scsifront/scsifront.c	Mon Nov 12 09:40:45 2012 +0100
+++ b/drivers/xen/scsifront/scsifront.c	Wed Nov 14 12:10:04 2012 +0100
@@ -28,8 +28,6 @@
  * IN THE SOFTWARE.
  */
  
-
-#include <linux/version.h>
 #include "common.h"
 
 static int get_id_from_freelist(struct vscsifrnt_info *info)
@@ -57,8 +55,8 @@ static void add_id_to_freelist(struct vs
 
 	spin_lock_irqsave(&info->shadow_lock, flags);
 
-	info->shadow[id].next_free  = info->shadow_free;
-	info->shadow[id].req_scsi_cmnd = 0;
+	info->shadow[id].next_free = info->shadow_free;
+	info->shadow[id].sc = NULL;
 	info->shadow_free = id;
 
 	spin_unlock_irqrestore(&info->shadow_lock, flags);
@@ -111,7 +109,7 @@ static void scsifront_gnttab_done(struct
 {
 	int i;
 
-	if (s->sc_data_direction == DMA_NONE)
+	if (s->sc->sc_data_direction == DMA_NONE)
 		return;
 
 	if (s->nr_segments) {
@@ -138,7 +136,7 @@ static void scsifront_cdb_cmd_done(struc
 	uint8_t sense_len;
 
 	id = ring_res->rqid;
-	sc = (struct scsi_cmnd *)info->shadow[id].req_scsi_cmnd;
+	sc = info->shadow[id].sc;
 
 	if (sc == NULL)
 		BUG();
@@ -252,7 +250,7 @@ static int map_data_for_request(struct v
 	unsigned long buffer_pfn;
 	unsigned int data_len = 0;
 
-	if (sc->sc_data_direction == DMA_NONE)
+	if (sc->sc_data_direction == DMA_NONE || !sc->request_bufflen)
 		return 0;
 
 	err = gnttab_alloc_grant_references(VSCSIIF_SG_TABLESIZE, &gref_head);
@@ -300,7 +298,7 @@ static int map_data_for_request(struct v
 				ref_cnt++;
 			}
 		}
-	} else if (sc->request_bufflen) {
+	} else {
 		unsigned long end   = ((unsigned long)sc->request_buffer
 					+ sc->request_bufflen + PAGE_SIZE - 1) >> PAGE_SHIFT;
 		unsigned long start = (unsigned long)sc->request_buffer >> PAGE_SHIFT;
@@ -388,9 +386,8 @@ static int scsifront_queuecommand(struct
 	ring_req->sc_data_direction   = (uint8_t)sc->sc_data_direction;
 	ring_req->timeout_per_command = (sc->timeout_per_command / HZ);
 
-	info->shadow[rqid].req_scsi_cmnd     = (unsigned long)sc;
-	info->shadow[rqid].sc_data_direction = sc->sc_data_direction;
-	info->shadow[rqid].act               = ring_req->act;
+	info->shadow[rqid].sc  = sc;
+	info->shadow[rqid].act = VSCSIIF_ACT_SCSI_CDB;
 
 	ref_cnt = map_data_for_request(info, sc, ring_req, rqid);
 	if (ref_cnt < 0) {
diff -r 171f57e6ad50 -r f09889eaf652 drivers/xen/scsifront/xenbus.c
--- a/drivers/xen/scsifront/xenbus.c	Mon Nov 12 09:40:45 2012 +0100
+++ b/drivers/xen/scsifront/xenbus.c	Wed Nov 14 12:10:04 2012 +0100
@@ -33,7 +33,6 @@
 * 2010, Samuel Kvasnica, IMS Nanofabrication AG
 */
 
-#include <linux/version.h>
 #include "common.h"
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 11:23:42 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 11:23: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.xen.org>)
	id 1TYb4E-0000or-Vb; Wed, 14 Nov 2012 11:23:38 +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 1TYb4E-0000ok-9X
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 11:23:38 +0000
Received: from [85.158.143.35:20120] by server-2.bemta-4.messagelabs.com id
	C7/6D-28922-93F73A05; Wed, 14 Nov 2012 11:23:37 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1352892124!7253188!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28194 invoked from network); 14 Nov 2012 11:22:05 -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 Nov 2012 11: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 1TYb2i-00068R-50
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 11:22:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYb2h-0003Rb-Pw
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 11:22:03 +0000
Message-Id: <E1TYb2h-0003Rb-Pw@xenbits.xen.org>
Date: Wed, 14 Nov 2012 11: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] scsifront: cleanup
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352891404 -3600
# Node ID f09889eaf6527f4ea0cc922e7d02da3bb7f919b5
# Parent  171f57e6ad50fb71354b5b7f2177394102ca02fe
scsifront: cleanup

- properly type the shadow field tracking the active command
- as a result, there's no need to also track the data direction
- in turn, re-arranging shadow fields reduces the size of the structure
  on 64-bit architectures
- there's no point in map_data_for_request() failing if there are no
  grant references available when none are needed anyway
- don't redundantly include linux/version.h

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


diff -r 171f57e6ad50 -r f09889eaf652 drivers/xen/scsifront/common.h
--- a/drivers/xen/scsifront/common.h	Mon Nov 12 09:40:45 2012 +0100
+++ b/drivers/xen/scsifront/common.h	Wed Nov 14 12:10:04 2012 +0100
@@ -80,21 +80,17 @@ struct vscsifrnt_shadow {
 	 * VSCSIIF_ACT_SCSI_CDB or VSCSIIF_ACT_SCSI_RESET */
 	unsigned char act;
 	
+	/* Number of pieces of scatter-gather */
+	unsigned int nr_segments;
+
 	/* do reset function */
 	wait_queue_head_t wq_reset;	/* reset work queue           */
 	int wait_reset;			/* reset work queue condition */
 	int32_t rslt_reset;		/* reset response status      */
 					/* (SUCESS or FAILED)         */
 
-	/* for DMA_TO_DEVICE(1), DMA_FROM_DEVICE(2), DMA_NONE(3) 
-	   requests */
-	unsigned int sc_data_direction;
-	
-	/* Number of pieces of scatter-gather */
-	unsigned int nr_segments;
-
 	/* requested struct scsi_cmnd is stored from kernel */
-	unsigned long req_scsi_cmnd;
+	struct scsi_cmnd *sc;
 	int gref[VSCSIIF_SG_TABLESIZE];
 };
 
diff -r 171f57e6ad50 -r f09889eaf652 drivers/xen/scsifront/scsifront.c
--- a/drivers/xen/scsifront/scsifront.c	Mon Nov 12 09:40:45 2012 +0100
+++ b/drivers/xen/scsifront/scsifront.c	Wed Nov 14 12:10:04 2012 +0100
@@ -28,8 +28,6 @@
  * IN THE SOFTWARE.
  */
  
-
-#include <linux/version.h>
 #include "common.h"
 
 static int get_id_from_freelist(struct vscsifrnt_info *info)
@@ -57,8 +55,8 @@ static void add_id_to_freelist(struct vs
 
 	spin_lock_irqsave(&info->shadow_lock, flags);
 
-	info->shadow[id].next_free  = info->shadow_free;
-	info->shadow[id].req_scsi_cmnd = 0;
+	info->shadow[id].next_free = info->shadow_free;
+	info->shadow[id].sc = NULL;
 	info->shadow_free = id;
 
 	spin_unlock_irqrestore(&info->shadow_lock, flags);
@@ -111,7 +109,7 @@ static void scsifront_gnttab_done(struct
 {
 	int i;
 
-	if (s->sc_data_direction == DMA_NONE)
+	if (s->sc->sc_data_direction == DMA_NONE)
 		return;
 
 	if (s->nr_segments) {
@@ -138,7 +136,7 @@ static void scsifront_cdb_cmd_done(struc
 	uint8_t sense_len;
 
 	id = ring_res->rqid;
-	sc = (struct scsi_cmnd *)info->shadow[id].req_scsi_cmnd;
+	sc = info->shadow[id].sc;
 
 	if (sc == NULL)
 		BUG();
@@ -252,7 +250,7 @@ static int map_data_for_request(struct v
 	unsigned long buffer_pfn;
 	unsigned int data_len = 0;
 
-	if (sc->sc_data_direction == DMA_NONE)
+	if (sc->sc_data_direction == DMA_NONE || !sc->request_bufflen)
 		return 0;
 
 	err = gnttab_alloc_grant_references(VSCSIIF_SG_TABLESIZE, &gref_head);
@@ -300,7 +298,7 @@ static int map_data_for_request(struct v
 				ref_cnt++;
 			}
 		}
-	} else if (sc->request_bufflen) {
+	} else {
 		unsigned long end   = ((unsigned long)sc->request_buffer
 					+ sc->request_bufflen + PAGE_SIZE - 1) >> PAGE_SHIFT;
 		unsigned long start = (unsigned long)sc->request_buffer >> PAGE_SHIFT;
@@ -388,9 +386,8 @@ static int scsifront_queuecommand(struct
 	ring_req->sc_data_direction   = (uint8_t)sc->sc_data_direction;
 	ring_req->timeout_per_command = (sc->timeout_per_command / HZ);
 
-	info->shadow[rqid].req_scsi_cmnd     = (unsigned long)sc;
-	info->shadow[rqid].sc_data_direction = sc->sc_data_direction;
-	info->shadow[rqid].act               = ring_req->act;
+	info->shadow[rqid].sc  = sc;
+	info->shadow[rqid].act = VSCSIIF_ACT_SCSI_CDB;
 
 	ref_cnt = map_data_for_request(info, sc, ring_req, rqid);
 	if (ref_cnt < 0) {
diff -r 171f57e6ad50 -r f09889eaf652 drivers/xen/scsifront/xenbus.c
--- a/drivers/xen/scsifront/xenbus.c	Mon Nov 12 09:40:45 2012 +0100
+++ b/drivers/xen/scsifront/xenbus.c	Wed Nov 14 12:10:04 2012 +0100
@@ -33,7 +33,6 @@
 * 2010, Samuel Kvasnica, IMS Nanofabrication AG
 */
 
-#include <linux/version.h>
 #include "common.h"
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 11:44:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 11: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 1TYbOA-0001mM-9T; Wed, 14 Nov 2012 11:44:14 +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 1TYbO8-0001mG-S3
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 11:44:13 +0000
Received: from [193.109.254.147:61615] by server-15.bemta-14.messagelabs.com
	id F2/6B-12105-C0483A05; Wed, 14 Nov 2012 11:44:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-27.messagelabs.com!1352893450!9653197!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2187 invoked from network); 14 Nov 2012 11:44:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Nov 2012 11: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 1TYbO6-0006Mb-81
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 11:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYbO6-00041q-2F
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 11:44:10 +0000
Message-Id: <E1TYbO6-00041q-2F@xenbits.xen.org>
Date: Wed, 14 Nov 2012 11:44:09 +0000
From: Xen patchbot-3.4-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-3.4-testing] x86/physmap: Prevent incorrect
	updates of m2p mappings
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893271 0
# Node ID b42c35f6369af19f414f29b71159c662b3b094be
# Parent  97f0909e11ad25985dcbac49bdfba02a29ad8c63
x86/physmap: Prevent incorrect updates of m2p mappings

In certain conditions, such as low memory, set_p2m_entry() can fail.
Currently, the p2m and m2p tables will get out of sync because we still
update the m2p table after the p2m update has failed.

If that happens, subsequent guest-invoked memory operations can cause
BUG()s and ASSERT()s to kill Xen.

This is fixed by only updating the m2p table iff the p2m was
successfully updated.

This is a security problem, XSA-22 / CVE-2012-4537.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

[ Add backport of 20516:c4e620a2e65c to correct
  error return from set_p2m_entry ]

Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 97f0909e11ad -r b42c35f6369a xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Wed Nov 14 11:38:25 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Wed Nov 14 11:41:11 2012 +0000
@@ -1500,14 +1500,15 @@ int set_p2m_entry(struct domain *d, unsi
 {
     unsigned long todo = 1ul << page_order;
     unsigned int order;
-    int rc = 0;
+    int rc = 1;
 
     while ( todo )
     {
         order = ((((gfn | mfn_x(mfn) | todo) & (SUPERPAGE_PAGES - 1)) == 0) &&
                  hvm_hap_has_2mb(d)) ? 9 : 0;
 
-        rc = d->arch.p2m->set_entry(d, gfn, mfn, order, p2mt);
+        if ( !d->arch.p2m->set_entry(d, gfn, mfn, order, p2mt) )
+            rc = 0;
         gfn += 1ul << order;
         if ( mfn_x(mfn) != INVALID_MFN )
             mfn = _mfn(mfn_x(mfn) + (1ul << order));
@@ -2054,7 +2055,10 @@ guest_physmap_add_entry(struct domain *d
     if ( mfn_valid(_mfn(mfn)) ) 
     {
         if ( !set_p2m_entry(d, gfn, _mfn(mfn), page_order, t) )
+        {
             rc = -EINVAL;
+            goto out; /* Failed to update p2m, bail without updating m2p. */
+        }
         for ( i = 0; i < (1UL << page_order); i++ )
             set_gpfn_from_mfn(mfn+i, gfn+i);
     }
@@ -2072,6 +2076,7 @@ guest_physmap_add_entry(struct domain *d
         }
     }
 
+out:
     audit_p2m(d);
     p2m_unlock(d->arch.p2m);
 

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 11:44:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 11: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 1TYbOA-0001mM-9T; Wed, 14 Nov 2012 11:44:14 +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 1TYbO8-0001mG-S3
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 11:44:13 +0000
Received: from [193.109.254.147:61615] by server-15.bemta-14.messagelabs.com
	id F2/6B-12105-C0483A05; Wed, 14 Nov 2012 11:44:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-27.messagelabs.com!1352893450!9653197!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2187 invoked from network); 14 Nov 2012 11:44:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Nov 2012 11: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 1TYbO6-0006Mb-81
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 11:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYbO6-00041q-2F
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 11:44:10 +0000
Message-Id: <E1TYbO6-00041q-2F@xenbits.xen.org>
Date: Wed, 14 Nov 2012 11:44:09 +0000
From: Xen patchbot-3.4-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-3.4-testing] x86/physmap: Prevent incorrect
	updates of m2p mappings
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893271 0
# Node ID b42c35f6369af19f414f29b71159c662b3b094be
# Parent  97f0909e11ad25985dcbac49bdfba02a29ad8c63
x86/physmap: Prevent incorrect updates of m2p mappings

In certain conditions, such as low memory, set_p2m_entry() can fail.
Currently, the p2m and m2p tables will get out of sync because we still
update the m2p table after the p2m update has failed.

If that happens, subsequent guest-invoked memory operations can cause
BUG()s and ASSERT()s to kill Xen.

This is fixed by only updating the m2p table iff the p2m was
successfully updated.

This is a security problem, XSA-22 / CVE-2012-4537.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

[ Add backport of 20516:c4e620a2e65c to correct
  error return from set_p2m_entry ]

Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 97f0909e11ad -r b42c35f6369a xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Wed Nov 14 11:38:25 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Wed Nov 14 11:41:11 2012 +0000
@@ -1500,14 +1500,15 @@ int set_p2m_entry(struct domain *d, unsi
 {
     unsigned long todo = 1ul << page_order;
     unsigned int order;
-    int rc = 0;
+    int rc = 1;
 
     while ( todo )
     {
         order = ((((gfn | mfn_x(mfn) | todo) & (SUPERPAGE_PAGES - 1)) == 0) &&
                  hvm_hap_has_2mb(d)) ? 9 : 0;
 
-        rc = d->arch.p2m->set_entry(d, gfn, mfn, order, p2mt);
+        if ( !d->arch.p2m->set_entry(d, gfn, mfn, order, p2mt) )
+            rc = 0;
         gfn += 1ul << order;
         if ( mfn_x(mfn) != INVALID_MFN )
             mfn = _mfn(mfn_x(mfn) + (1ul << order));
@@ -2054,7 +2055,10 @@ guest_physmap_add_entry(struct domain *d
     if ( mfn_valid(_mfn(mfn)) ) 
     {
         if ( !set_p2m_entry(d, gfn, _mfn(mfn), page_order, t) )
+        {
             rc = -EINVAL;
+            goto out; /* Failed to update p2m, bail without updating m2p. */
+        }
         for ( i = 0; i < (1UL << page_order); i++ )
             set_gpfn_from_mfn(mfn+i, gfn+i);
     }
@@ -2072,6 +2076,7 @@ guest_physmap_add_entry(struct domain *d
         }
     }
 
+out:
     audit_p2m(d);
     p2m_unlock(d->arch.p2m);
 

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 11:44:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 11: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 1TYbOD-0001mX-CE; Wed, 14 Nov 2012 11:44:17 +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 1TYbOB-0001mL-Ji
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 11:44:15 +0000
Received: from [85.158.143.35:5452] by server-2.bemta-4.messagelabs.com id
	17/5E-28922-D0483A05; Wed, 14 Nov 2012 11:44:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1352893450!5456858!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2693 invoked from network); 14 Nov 2012 11:44:10 -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;
	14 Nov 2012 11: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 1TYbO5-0006MY-Ox
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 11:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYbO5-00041b-HY
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 11:44:09 +0000
Message-Id: <E1TYbO5-00041b-HY@xenbits.xen.org>
Date: Wed, 14 Nov 2012 11:44:09 +0000
From: Xen patchbot-3.4-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-3.4-testing] VCPU/timers: Prevent overflow in
	calculations, leading to DoS vulnerability
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893105 0
# Node ID 97f0909e11ad25985dcbac49bdfba02a29ad8c63
# Parent  e3a406b7e7ab37f47423cf056cc59defcb3584d6
VCPU/timers: Prevent overflow in calculations, leading to DoS vulnerability

The timer action for a vcpu periodic timer is to calculate the next
expiry time, and to reinsert itself into the timer queue.  If the
deadline ends up in the past, Xen never leaves __do_softirq().  The
affected PCPU will stay in an infinite loop until Xen is killed by the
watchdog (if enabled).

This is a security problem, XSA-20 / CVE-2012-4535.

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

xen-unstable changeset: 26148:bf58b94b3cef
Backport-requested-by: security@xen.org
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r e3a406b7e7ab -r 97f0909e11ad xen/common/domain.c
--- a/xen/common/domain.c	Thu Jun 14 08:15:41 2012 -0400
+++ b/xen/common/domain.c	Wed Nov 14 11:38:25 2012 +0000
@@ -773,6 +773,9 @@ long do_vcpu_op(int cmd, int vcpuid, XEN
         if ( set.period_ns < MILLISECS(1) )
             return -EINVAL;
 
+        if ( set.period_ns > STIME_DELTA_MAX )
+            return -EINVAL;
+
         v->periodic_period = set.period_ns;
         vcpu_force_reschedule(v);
 
diff -r e3a406b7e7ab -r 97f0909e11ad xen/include/xen/time.h
--- a/xen/include/xen/time.h	Thu Jun 14 08:15:41 2012 -0400
+++ b/xen/include/xen/time.h	Wed Nov 14 11:38:25 2012 +0000
@@ -52,6 +52,8 @@ struct tm gmtime(unsigned long t);
 #define MILLISECS(_ms)  ((s_time_t)((_ms) * 1000000ULL))
 #define MICROSECS(_us)  ((s_time_t)((_us) * 1000ULL))
 #define STIME_MAX ((s_time_t)((uint64_t)~0ull>>1))
+/* Chosen so (NOW() + delta) wont overflow without an uptime of 200 years */
+#define STIME_DELTA_MAX ((s_time_t)((uint64_t)~0ull>>2))
 
 extern void update_vcpu_system_time(struct vcpu *v);
 extern void update_domain_wallclock_time(struct domain *d);

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 11:44:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 11: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 1TYbOD-0001mX-CE; Wed, 14 Nov 2012 11:44:17 +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 1TYbOB-0001mL-Ji
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 11:44:15 +0000
Received: from [85.158.143.35:5452] by server-2.bemta-4.messagelabs.com id
	17/5E-28922-D0483A05; Wed, 14 Nov 2012 11:44:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1352893450!5456858!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2693 invoked from network); 14 Nov 2012 11:44:10 -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;
	14 Nov 2012 11: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 1TYbO5-0006MY-Ox
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 11:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYbO5-00041b-HY
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 11:44:09 +0000
Message-Id: <E1TYbO5-00041b-HY@xenbits.xen.org>
Date: Wed, 14 Nov 2012 11:44:09 +0000
From: Xen patchbot-3.4-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-3.4-testing] VCPU/timers: Prevent overflow in
	calculations, leading to DoS vulnerability
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893105 0
# Node ID 97f0909e11ad25985dcbac49bdfba02a29ad8c63
# Parent  e3a406b7e7ab37f47423cf056cc59defcb3584d6
VCPU/timers: Prevent overflow in calculations, leading to DoS vulnerability

The timer action for a vcpu periodic timer is to calculate the next
expiry time, and to reinsert itself into the timer queue.  If the
deadline ends up in the past, Xen never leaves __do_softirq().  The
affected PCPU will stay in an infinite loop until Xen is killed by the
watchdog (if enabled).

This is a security problem, XSA-20 / CVE-2012-4535.

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

xen-unstable changeset: 26148:bf58b94b3cef
Backport-requested-by: security@xen.org
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r e3a406b7e7ab -r 97f0909e11ad xen/common/domain.c
--- a/xen/common/domain.c	Thu Jun 14 08:15:41 2012 -0400
+++ b/xen/common/domain.c	Wed Nov 14 11:38:25 2012 +0000
@@ -773,6 +773,9 @@ long do_vcpu_op(int cmd, int vcpuid, XEN
         if ( set.period_ns < MILLISECS(1) )
             return -EINVAL;
 
+        if ( set.period_ns > STIME_DELTA_MAX )
+            return -EINVAL;
+
         v->periodic_period = set.period_ns;
         vcpu_force_reschedule(v);
 
diff -r e3a406b7e7ab -r 97f0909e11ad xen/include/xen/time.h
--- a/xen/include/xen/time.h	Thu Jun 14 08:15:41 2012 -0400
+++ b/xen/include/xen/time.h	Wed Nov 14 11:38:25 2012 +0000
@@ -52,6 +52,8 @@ struct tm gmtime(unsigned long t);
 #define MILLISECS(_ms)  ((s_time_t)((_ms) * 1000000ULL))
 #define MICROSECS(_us)  ((s_time_t)((_us) * 1000ULL))
 #define STIME_MAX ((s_time_t)((uint64_t)~0ull>>1))
+/* Chosen so (NOW() + delta) wont overflow without an uptime of 200 years */
+#define STIME_DELTA_MAX ((s_time_t)((uint64_t)~0ull>>2))
 
 extern void update_vcpu_system_time(struct vcpu *v);
 extern void update_domain_wallclock_time(struct domain *d);

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 18:00:53 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 18: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.xen.org>)
	id 1TYhGb-0002SV-B5; Wed, 14 Nov 2012 18:00:49 +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 1TYhGZ-0002Rk-Iw
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:47 +0000
Received: from [85.158.143.35:57965] by server-3.bemta-4.messagelabs.com id
	89/CB-06841-E4CD3A05; Wed, 14 Nov 2012 18:00:46 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1352916044!6607226!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23304 invoked from network); 14 Nov 2012 18:00:45 -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;
	14 Nov 2012 18:00: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 1TYhGV-0002ai-VH
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:43 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYhG5-0005eF-H8
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:43 +0000
Message-Id: <E1TYhG5-0005eF-H8@xenbits.xen.org>
Date: Wed, 14 Nov 2012 18: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] tmem: Prevent NULL dereference on
	error case
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Daley <mattjd@gmail.com>
# Date 1352886194 -3600
# Node ID c8bf0d870e36acd8a9c045725067c7e14bb7469e
# Parent  26281a1650dcdf3878f4cab992995b8fce97a96e
tmem: Prevent NULL dereference on error case

If the client / pool IDs given to tmemc_save_get_next_page are invalid,
the calculation of pagesize will dereference NULL.

Fix this by moving the calculation below the appropriate NULL check.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
xen-unstable changeset: 26132:286ef4ced216
xen-unstable date: Mon Nov 12 08:34:57 UTC 2012
---


diff -r 26281a1650dc -r c8bf0d870e36 xen/common/tmem.c
--- a/xen/common/tmem.c	Tue Nov 13 18:34:43 2012 +0000
+++ b/xen/common/tmem.c	Wed Nov 14 10:43:14 2012 +0100
@@ -2449,10 +2449,12 @@ static NOINLINE int tmemc_save_get_next_
     OID oid;
     int ret = 0;
     struct tmem_handle h;
-    unsigned int pagesize = 1 << (pool->pageshift+12);
+    unsigned int pagesize;
 
     if ( pool == NULL || is_ephemeral(pool) )
         return -1;
+
+    pagesize = 1 << (pool->pageshift + 12);
     if ( bufsize < pagesize + sizeof(struct tmem_handle) )
         return -ENOMEM;
 

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 18:00:53 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 18: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.xen.org>)
	id 1TYhGb-0002SV-B5; Wed, 14 Nov 2012 18:00:49 +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 1TYhGZ-0002Rk-Iw
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:47 +0000
Received: from [85.158.143.35:57965] by server-3.bemta-4.messagelabs.com id
	89/CB-06841-E4CD3A05; Wed, 14 Nov 2012 18:00:46 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1352916044!6607226!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23304 invoked from network); 14 Nov 2012 18:00:45 -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;
	14 Nov 2012 18:00: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 1TYhGV-0002ai-VH
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:43 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYhG5-0005eF-H8
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:43 +0000
Message-Id: <E1TYhG5-0005eF-H8@xenbits.xen.org>
Date: Wed, 14 Nov 2012 18: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] tmem: Prevent NULL dereference on
	error case
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Daley <mattjd@gmail.com>
# Date 1352886194 -3600
# Node ID c8bf0d870e36acd8a9c045725067c7e14bb7469e
# Parent  26281a1650dcdf3878f4cab992995b8fce97a96e
tmem: Prevent NULL dereference on error case

If the client / pool IDs given to tmemc_save_get_next_page are invalid,
the calculation of pagesize will dereference NULL.

Fix this by moving the calculation below the appropriate NULL check.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
xen-unstable changeset: 26132:286ef4ced216
xen-unstable date: Mon Nov 12 08:34:57 UTC 2012
---


diff -r 26281a1650dc -r c8bf0d870e36 xen/common/tmem.c
--- a/xen/common/tmem.c	Tue Nov 13 18:34:43 2012 +0000
+++ b/xen/common/tmem.c	Wed Nov 14 10:43:14 2012 +0100
@@ -2449,10 +2449,12 @@ static NOINLINE int tmemc_save_get_next_
     OID oid;
     int ret = 0;
     struct tmem_handle h;
-    unsigned int pagesize = 1 << (pool->pageshift+12);
+    unsigned int pagesize;
 
     if ( pool == NULL || is_ephemeral(pool) )
         return -1;
+
+    pagesize = 1 << (pool->pageshift + 12);
     if ( bufsize < pagesize + sizeof(struct tmem_handle) )
         return -ENOMEM;
 

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 18:00:53 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 18: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.xen.org>)
	id 1TYhGc-0002T1-0V; Wed, 14 Nov 2012 18:00:50 +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 1TYhGb-0002Ri-IY
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:49 +0000
Received: from [85.158.143.99:7811] by server-1.bemta-4.messagelabs.com id
	38/C6-27934-15CD3A05; Wed, 14 Nov 2012 18:00:49 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-216.messagelabs.com!1352916047!29376377!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15973 invoked from network); 14 Nov 2012 18:00:48 -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;
	14 Nov 2012 18:00: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 1TYhGY-0002ax-RQ
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:46 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYhGY-0005go-OM
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:46 +0000
Message-Id: <E1TYhGY-0005go-OM@xenbits.xen.org>
Date: Wed, 14 Nov 2012 18:00:46 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] xen/mm/shadow: check toplevel
	pagetables are present before unhooking them.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893409 0
# Node ID 61eb3d030f52b3785ed0935090821f4d48d65dc9
# Parent  f635b1447d7e35fb10cf5373ee365111f892c932
xen/mm/shadow: check toplevel pagetables are present before unhooking them.

If the guest has not fully populated its top-level PAE entries when it calls
HVMOP_pagetable_dying, the shadow code could try to unhook entries from
MFN 0.  Add a check to avoid that case.

This issue was introduced by c/s 21239:b9d2db109cf5.

This is a security problem, XSA-23 / CVE-2012-4538.

Signed-off-by: Tim Deegan <tim@xen.org>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r f635b1447d7e -r 61eb3d030f52 xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 11:40:45 2012 +0000
+++ b/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 11:43:29 2012 +0000
@@ -4737,8 +4737,12 @@ static void sh_pagetable_dying(struct vc
     }
     for ( i = 0; i < 4; i++ )
     {
-        if ( fast_path )
-            smfn = _mfn(pagetable_get_pfn(v->arch.shadow_table[i]));
+        if ( fast_path ) {
+            if ( pagetable_is_null(v->arch.shadow_table[i]) )
+                smfn = _mfn(INVALID_MFN);
+            else
+                smfn = _mfn(pagetable_get_pfn(v->arch.shadow_table[i]));
+        }
         else
         {
             /* retrieving the l2s */

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 18:00:53 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 18: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.xen.org>)
	id 1TYhGa-0002S2-8V; Wed, 14 Nov 2012 18:00:48 +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 1TYhGZ-0002Ri-1i
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:47 +0000
Received: from [85.158.143.35:61855] by server-1.bemta-4.messagelabs.com id
	5A/B6-27934-E4CD3A05; Wed, 14 Nov 2012 18:00:46 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1352916044!5508010!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17807 invoked from network); 14 Nov 2012 18:00:45 -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;
	14 Nov 2012 18:00: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 1TYhGW-0002al-Dz
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:44 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYhGW-0005fq-4Q
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:44 +0000
Message-Id: <E1TYhGW-0005fq-4Q@xenbits.xen.org>
Date: Wed, 14 Nov 2012 18:00:43 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] x86/mm x86 shadow: Fix typo in
	sh_invlpg sl3 page presence 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: "Change log for Mercurial \(receive only\)"
	<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 Matthew Daley <mattjd@gmail.com>
# Date 1352886249 -3600
# Node ID 448ffa4bcf63835ea2511613913967e63818e50f
# Parent  c8bf0d870e36acd8a9c045725067c7e14bb7469e
x86/mm x86 shadow: Fix typo in sh_invlpg sl3 page presence check

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Tim Deegan <tim@xen.org>
xen-unstable changeset: 26134:279bbf2a0b48
xen-unstable date: Mon Nov 12 10:17:00 UTC 2012
---


diff -r c8bf0d870e36 -r 448ffa4bcf63 xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 10:43:14 2012 +0100
+++ b/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 10:44:09 2012 +0100
@@ -3674,7 +3674,7 @@ sh_invlpg(struct vcpu *v, unsigned long 
             perfc_incr(shadow_invlpg_fault);
             return 0;
         }
-        if ( (!shadow_l3e_get_flags(sl3e) & _PAGE_PRESENT) )
+        if ( !(shadow_l3e_get_flags(sl3e) & _PAGE_PRESENT) )
             return 0;
     }
 #else /* SHADOW_PAGING_LEVELS == 3 */

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 18:00:53 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 18: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.xen.org>)
	id 1TYhGc-0002T1-0V; Wed, 14 Nov 2012 18:00:50 +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 1TYhGb-0002Ri-IY
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:49 +0000
Received: from [85.158.143.99:7811] by server-1.bemta-4.messagelabs.com id
	38/C6-27934-15CD3A05; Wed, 14 Nov 2012 18:00:49 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-216.messagelabs.com!1352916047!29376377!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15973 invoked from network); 14 Nov 2012 18:00:48 -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;
	14 Nov 2012 18:00: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 1TYhGY-0002ax-RQ
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:46 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYhGY-0005go-OM
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:46 +0000
Message-Id: <E1TYhGY-0005go-OM@xenbits.xen.org>
Date: Wed, 14 Nov 2012 18:00:46 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] xen/mm/shadow: check toplevel
	pagetables are present before unhooking them.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893409 0
# Node ID 61eb3d030f52b3785ed0935090821f4d48d65dc9
# Parent  f635b1447d7e35fb10cf5373ee365111f892c932
xen/mm/shadow: check toplevel pagetables are present before unhooking them.

If the guest has not fully populated its top-level PAE entries when it calls
HVMOP_pagetable_dying, the shadow code could try to unhook entries from
MFN 0.  Add a check to avoid that case.

This issue was introduced by c/s 21239:b9d2db109cf5.

This is a security problem, XSA-23 / CVE-2012-4538.

Signed-off-by: Tim Deegan <tim@xen.org>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r f635b1447d7e -r 61eb3d030f52 xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 11:40:45 2012 +0000
+++ b/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 11:43:29 2012 +0000
@@ -4737,8 +4737,12 @@ static void sh_pagetable_dying(struct vc
     }
     for ( i = 0; i < 4; i++ )
     {
-        if ( fast_path )
-            smfn = _mfn(pagetable_get_pfn(v->arch.shadow_table[i]));
+        if ( fast_path ) {
+            if ( pagetable_is_null(v->arch.shadow_table[i]) )
+                smfn = _mfn(INVALID_MFN);
+            else
+                smfn = _mfn(pagetable_get_pfn(v->arch.shadow_table[i]));
+        }
         else
         {
             /* retrieving the l2s */

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 18:00:53 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 18: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.xen.org>)
	id 1TYhGb-0002Sw-U4; Wed, 14 Nov 2012 18:00:49 +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 1TYhGb-0002SF-BY
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:49 +0000
Received: from [85.158.139.83:3896] by server-7.bemta-5.messagelabs.com id
	0B/24-23096-05CD3A05; Wed, 14 Nov 2012 18:00:48 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-182.messagelabs.com!1352916045!21691653!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18699 invoked from network); 14 Nov 2012 18:00:46 -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 Nov 2012 18:00: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 1TYhGX-0002ar-Ge
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:45 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYhGX-0005gK-Ax
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:45 +0000
Message-Id: <E1TYhGX-0005gK-Ax@xenbits.xen.org>
Date: Wed, 14 Nov 2012 18:00:44 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] x86/physdev: Range check pirq
	parameter from guests
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352892906 0
# Node ID 210f16b6509b7462481da2e64e4fe20efcdb899d
# Parent  701f5e3321c13e2b07708dcdc224472051038ca4
x86/physdev: Range check pirq parameter from guests

Otherwise Xen will read beyond either end of the struct
domain.arch.pirq_emuirq array, usually resulting in a fatal page fault.

This vulnerability was introduced by c/s 23241:d21100f1d00e, which adds
a call to domain_pirq_to_emuirq() which uses the guest provided pirq
value before range checking it, and was fixed by c/s 23573:584c2e5e03d9
which changed the behaviour of the domain_pirq_to_emuirq() macro to use
radix trees instead of a flat array.

This is XSA-21 / CVE-2012-4536.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 701f5e3321c1 -r 210f16b6509b xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c	Wed Nov 14 11:33:36 2012 +0000
+++ b/xen/arch/x86/physdev.c	Wed Nov 14 11:35:06 2012 +0000
@@ -234,6 +234,10 @@ static int physdev_unmap_pirq(struct phy
     if ( ret )
         return ret;
 
+    ret = -EINVAL;
+    if ( unmap->pirq < 0 || unmap->pirq >= d->nr_pirqs )
+        goto free_domain;
+
     if ( is_hvm_domain(d) )
     {
         spin_lock(&d->event_lock);

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 18:00:53 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 18: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.xen.org>)
	id 1TYhGb-0002Sw-U4; Wed, 14 Nov 2012 18:00:49 +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 1TYhGb-0002SF-BY
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:49 +0000
Received: from [85.158.139.83:3896] by server-7.bemta-5.messagelabs.com id
	0B/24-23096-05CD3A05; Wed, 14 Nov 2012 18:00:48 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-182.messagelabs.com!1352916045!21691653!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18699 invoked from network); 14 Nov 2012 18:00:46 -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 Nov 2012 18:00: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 1TYhGX-0002ar-Ge
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:45 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYhGX-0005gK-Ax
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:45 +0000
Message-Id: <E1TYhGX-0005gK-Ax@xenbits.xen.org>
Date: Wed, 14 Nov 2012 18:00:44 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] x86/physdev: Range check pirq
	parameter from guests
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352892906 0
# Node ID 210f16b6509b7462481da2e64e4fe20efcdb899d
# Parent  701f5e3321c13e2b07708dcdc224472051038ca4
x86/physdev: Range check pirq parameter from guests

Otherwise Xen will read beyond either end of the struct
domain.arch.pirq_emuirq array, usually resulting in a fatal page fault.

This vulnerability was introduced by c/s 23241:d21100f1d00e, which adds
a call to domain_pirq_to_emuirq() which uses the guest provided pirq
value before range checking it, and was fixed by c/s 23573:584c2e5e03d9
which changed the behaviour of the domain_pirq_to_emuirq() macro to use
radix trees instead of a flat array.

This is XSA-21 / CVE-2012-4536.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 701f5e3321c1 -r 210f16b6509b xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c	Wed Nov 14 11:33:36 2012 +0000
+++ b/xen/arch/x86/physdev.c	Wed Nov 14 11:35:06 2012 +0000
@@ -234,6 +234,10 @@ static int physdev_unmap_pirq(struct phy
     if ( ret )
         return ret;
 
+    ret = -EINVAL;
+    if ( unmap->pirq < 0 || unmap->pirq >= d->nr_pirqs )
+        goto free_domain;
+
     if ( is_hvm_domain(d) )
     {
         spin_lock(&d->event_lock);

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 18:00:53 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 18: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.xen.org>)
	id 1TYhGa-0002S2-8V; Wed, 14 Nov 2012 18:00:48 +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 1TYhGZ-0002Ri-1i
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:47 +0000
Received: from [85.158.143.35:61855] by server-1.bemta-4.messagelabs.com id
	5A/B6-27934-E4CD3A05; Wed, 14 Nov 2012 18:00:46 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1352916044!5508010!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17807 invoked from network); 14 Nov 2012 18:00:45 -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;
	14 Nov 2012 18:00: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 1TYhGW-0002al-Dz
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:44 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYhGW-0005fq-4Q
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:44 +0000
Message-Id: <E1TYhGW-0005fq-4Q@xenbits.xen.org>
Date: Wed, 14 Nov 2012 18:00:43 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] x86/mm x86 shadow: Fix typo in
	sh_invlpg sl3 page presence 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: "Change log for Mercurial \(receive only\)"
	<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 Matthew Daley <mattjd@gmail.com>
# Date 1352886249 -3600
# Node ID 448ffa4bcf63835ea2511613913967e63818e50f
# Parent  c8bf0d870e36acd8a9c045725067c7e14bb7469e
x86/mm x86 shadow: Fix typo in sh_invlpg sl3 page presence check

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Tim Deegan <tim@xen.org>
xen-unstable changeset: 26134:279bbf2a0b48
xen-unstable date: Mon Nov 12 10:17:00 UTC 2012
---


diff -r c8bf0d870e36 -r 448ffa4bcf63 xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 10:43:14 2012 +0100
+++ b/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 10:44:09 2012 +0100
@@ -3674,7 +3674,7 @@ sh_invlpg(struct vcpu *v, unsigned long 
             perfc_incr(shadow_invlpg_fault);
             return 0;
         }
-        if ( (!shadow_l3e_get_flags(sl3e) & _PAGE_PRESENT) )
+        if ( !(shadow_l3e_get_flags(sl3e) & _PAGE_PRESENT) )
             return 0;
     }
 #else /* SHADOW_PAGING_LEVELS == 3 */

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 18:00:53 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 18: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.xen.org>)
	id 1TYhGb-0002Sr-RW; Wed, 14 Nov 2012 18:00:49 +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 1TYhGZ-0002Rp-TF
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:48 +0000
Received: from [85.158.143.99:7725] by server-2.bemta-4.messagelabs.com id
	D3/03-28922-F4CD3A05; Wed, 14 Nov 2012 18:00:47 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1352916045!22908106!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28568 invoked from network); 14 Nov 2012 18:00:46 -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;
	14 Nov 2012 18:00: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 1TYhGW-0002ao-UX
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:44 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYhGW-0005g5-Oq
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:44 +0000
Message-Id: <E1TYhGW-0005g5-Oq@xenbits.xen.org>
Date: Wed, 14 Nov 2012 18:00:44 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] VCPU/timers: Prevent overflow in
	calculations, leading to DoS vulnerability
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352892816 0
# Node ID 701f5e3321c13e2b07708dcdc224472051038ca4
# Parent  448ffa4bcf63835ea2511613913967e63818e50f
VCPU/timers: Prevent overflow in calculations, leading to DoS vulnerability

The timer action for a vcpu periodic timer is to calculate the next
expiry time, and to reinsert itself into the timer queue.  If the
deadline ends up in the past, Xen never leaves __do_softirq().  The
affected PCPU will stay in an infinite loop until Xen is killed by the
watchdog (if enabled).

This is a security problem, XSA-20 / CVE-2012-4535.

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

xen-unstable changeset: 26148:bf58b94b3cef
Backport-requested-by: security@xen.org
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 448ffa4bcf63 -r 701f5e3321c1 xen/common/domain.c
--- a/xen/common/domain.c	Wed Nov 14 10:44:09 2012 +0100
+++ b/xen/common/domain.c	Wed Nov 14 11:33:36 2012 +0000
@@ -873,6 +873,9 @@ long do_vcpu_op(int cmd, int vcpuid, XEN
         if ( set.period_ns < MILLISECS(1) )
             return -EINVAL;
 
+        if ( set.period_ns > STIME_DELTA_MAX )
+            return -EINVAL;
+
         v->periodic_period = set.period_ns;
         vcpu_force_reschedule(v);
 
diff -r 448ffa4bcf63 -r 701f5e3321c1 xen/include/xen/time.h
--- a/xen/include/xen/time.h	Wed Nov 14 10:44:09 2012 +0100
+++ b/xen/include/xen/time.h	Wed Nov 14 11:33:36 2012 +0000
@@ -53,6 +53,8 @@ struct tm gmtime(unsigned long t);
 #define MILLISECS(_ms)  ((s_time_t)((_ms) * 1000000ULL))
 #define MICROSECS(_us)  ((s_time_t)((_us) * 1000ULL))
 #define STIME_MAX ((s_time_t)((uint64_t)~0ull>>1))
+/* Chosen so (NOW() + delta) wont overflow without an uptime of 200 years */
+#define STIME_DELTA_MAX ((s_time_t)((uint64_t)~0ull>>2))
 
 extern void update_vcpu_system_time(struct vcpu *v);
 extern void update_domain_wallclock_time(struct domain *d);

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 18:00:53 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 18: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.xen.org>)
	id 1TYhGb-0002Sr-RW; Wed, 14 Nov 2012 18:00:49 +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 1TYhGZ-0002Rp-TF
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:48 +0000
Received: from [85.158.143.99:7725] by server-2.bemta-4.messagelabs.com id
	D3/03-28922-F4CD3A05; Wed, 14 Nov 2012 18:00:47 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1352916045!22908106!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28568 invoked from network); 14 Nov 2012 18:00:46 -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;
	14 Nov 2012 18:00: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 1TYhGW-0002ao-UX
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:44 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYhGW-0005g5-Oq
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:44 +0000
Message-Id: <E1TYhGW-0005g5-Oq@xenbits.xen.org>
Date: Wed, 14 Nov 2012 18:00:44 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] VCPU/timers: Prevent overflow in
	calculations, leading to DoS vulnerability
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352892816 0
# Node ID 701f5e3321c13e2b07708dcdc224472051038ca4
# Parent  448ffa4bcf63835ea2511613913967e63818e50f
VCPU/timers: Prevent overflow in calculations, leading to DoS vulnerability

The timer action for a vcpu periodic timer is to calculate the next
expiry time, and to reinsert itself into the timer queue.  If the
deadline ends up in the past, Xen never leaves __do_softirq().  The
affected PCPU will stay in an infinite loop until Xen is killed by the
watchdog (if enabled).

This is a security problem, XSA-20 / CVE-2012-4535.

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

xen-unstable changeset: 26148:bf58b94b3cef
Backport-requested-by: security@xen.org
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 448ffa4bcf63 -r 701f5e3321c1 xen/common/domain.c
--- a/xen/common/domain.c	Wed Nov 14 10:44:09 2012 +0100
+++ b/xen/common/domain.c	Wed Nov 14 11:33:36 2012 +0000
@@ -873,6 +873,9 @@ long do_vcpu_op(int cmd, int vcpuid, XEN
         if ( set.period_ns < MILLISECS(1) )
             return -EINVAL;
 
+        if ( set.period_ns > STIME_DELTA_MAX )
+            return -EINVAL;
+
         v->periodic_period = set.period_ns;
         vcpu_force_reschedule(v);
 
diff -r 448ffa4bcf63 -r 701f5e3321c1 xen/include/xen/time.h
--- a/xen/include/xen/time.h	Wed Nov 14 10:44:09 2012 +0100
+++ b/xen/include/xen/time.h	Wed Nov 14 11:33:36 2012 +0000
@@ -53,6 +53,8 @@ struct tm gmtime(unsigned long t);
 #define MILLISECS(_ms)  ((s_time_t)((_ms) * 1000000ULL))
 #define MICROSECS(_us)  ((s_time_t)((_us) * 1000ULL))
 #define STIME_MAX ((s_time_t)((uint64_t)~0ull>>1))
+/* Chosen so (NOW() + delta) wont overflow without an uptime of 200 years */
+#define STIME_DELTA_MAX ((s_time_t)((uint64_t)~0ull>>2))
 
 extern void update_vcpu_system_time(struct vcpu *v);
 extern void update_domain_wallclock_time(struct domain *d);

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 18:00:54 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 18:00:54 +0000
Received: from 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 1TYhGf-0002Tz-85; Wed, 14 Nov 2012 18:00:53 +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 1TYhGe-0002Ri-1E
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:52 +0000
Received: from [85.158.143.99:7913] by server-1.bemta-4.messagelabs.com id
	B2/D6-27934-35CD3A05; Wed, 14 Nov 2012 18:00:51 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1352916049!27278994!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26558 invoked from network); 14 Nov 2012 18:00:50 -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;
	14 Nov 2012 18:00: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 1TYhGb-0002b0-Dm
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:49 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYhGZ-0005h4-B8
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:49 +0000
Message-Id: <E1TYhGZ-0005h4-B8@xenbits.xen.org>
Date: Wed, 14 Nov 2012 18:00:46 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] compat/gnttab: Prevent infinite
	loop in compat code
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893572 0
# Node ID 178f63286b02b22ce856ca76af639d39aa5c6172
# Parent  61eb3d030f52b3785ed0935090821f4d48d65dc9
compat/gnttab: Prevent infinite loop in compat code

c/s 20281:95ea2052b41b, which introduces Grant Table version 2
hypercalls introduces a vulnerability whereby the compat hypercall
handler can fall into an infinite loop.

If the watchdog is enabled, Xen will die after the timeout.

This is a security problem, XSA-24 / CVE-2012-4539.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-unstable changeset: 26151:b64a7d868f06
Backport-requested-by: security@xen.org
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 61eb3d030f52 -r 178f63286b02 xen/common/compat/grant_table.c
--- a/xen/common/compat/grant_table.c	Wed Nov 14 11:43:29 2012 +0000
+++ b/xen/common/compat/grant_table.c	Wed Nov 14 11:46:12 2012 +0000
@@ -310,6 +310,8 @@ int compat_grant_table_op(unsigned int c
 #undef XLAT_gnttab_get_status_frames_HNDL_frame_list
                 if ( unlikely(__copy_to_guest(cmp_uop, &cmp.get_status, 1)) )
                     rc = -EFAULT;
+                else
+                    i = 1;
             }
             break;
         }

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 18:00:54 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 18:00:54 +0000
Received: from 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 1TYhGf-0002Tz-85; Wed, 14 Nov 2012 18:00:53 +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 1TYhGe-0002Ri-1E
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:52 +0000
Received: from [85.158.143.99:7913] by server-1.bemta-4.messagelabs.com id
	B2/D6-27934-35CD3A05; Wed, 14 Nov 2012 18:00:51 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1352916049!27278994!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26558 invoked from network); 14 Nov 2012 18:00:50 -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;
	14 Nov 2012 18:00: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 1TYhGb-0002b0-Dm
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:49 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYhGZ-0005h4-B8
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:49 +0000
Message-Id: <E1TYhGZ-0005h4-B8@xenbits.xen.org>
Date: Wed, 14 Nov 2012 18:00:46 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] compat/gnttab: Prevent infinite
	loop in compat code
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893572 0
# Node ID 178f63286b02b22ce856ca76af639d39aa5c6172
# Parent  61eb3d030f52b3785ed0935090821f4d48d65dc9
compat/gnttab: Prevent infinite loop in compat code

c/s 20281:95ea2052b41b, which introduces Grant Table version 2
hypercalls introduces a vulnerability whereby the compat hypercall
handler can fall into an infinite loop.

If the watchdog is enabled, Xen will die after the timeout.

This is a security problem, XSA-24 / CVE-2012-4539.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-unstable changeset: 26151:b64a7d868f06
Backport-requested-by: security@xen.org
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 61eb3d030f52 -r 178f63286b02 xen/common/compat/grant_table.c
--- a/xen/common/compat/grant_table.c	Wed Nov 14 11:43:29 2012 +0000
+++ b/xen/common/compat/grant_table.c	Wed Nov 14 11:46:12 2012 +0000
@@ -310,6 +310,8 @@ int compat_grant_table_op(unsigned int c
 #undef XLAT_gnttab_get_status_frames_HNDL_frame_list
                 if ( unlikely(__copy_to_guest(cmp_uop, &cmp.get_status, 1)) )
                     rc = -EFAULT;
+                else
+                    i = 1;
             }
             break;
         }

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 18:02:29 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 18:02: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 1TYhIC-0002tk-0A; Wed, 14 Nov 2012 18:02:28 +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 1TYhIA-0002tO-0I
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:02:26 +0000
Received: from [85.158.143.35:4054] by server-3.bemta-4.messagelabs.com id
	59/4D-06841-1BCD3A05; Wed, 14 Nov 2012 18:02:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1352916046!10353288!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17104 invoked from network); 14 Nov 2012 18:00:47 -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 Nov 2012 18:00: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 1TYhGY-0002au-Gq
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:46 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYhGY-0005gZ-3r
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:46 +0000
Message-Id: <E1TYhGY-0005gZ-3r@xenbits.xen.org>
Date: Wed, 14 Nov 2012 18:00:45 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] x86/physmap: Prevent incorrect
	updates of m2p mappings
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893245 0
# Node ID f635b1447d7e35fb10cf5373ee365111f892c932
# Parent  210f16b6509b7462481da2e64e4fe20efcdb899d
x86/physmap: Prevent incorrect updates of m2p mappings

In certain conditions, such as low memory, set_p2m_entry() can fail.
Currently, the p2m and m2p tables will get out of sync because we still
update the m2p table after the p2m update has failed.

If that happens, subsequent guest-invoked memory operations can cause
BUG()s and ASSERT()s to kill Xen.

This is fixed by only updating the m2p table iff the p2m was
successfully updated.

This is a security problem, XSA-22 / CVE-2012-4537.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
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 210f16b6509b -r f635b1447d7e xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Wed Nov 14 11:35:06 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Wed Nov 14 11:40:45 2012 +0000
@@ -2558,7 +2558,10 @@ guest_physmap_add_entry(struct p2m_domai
     if ( mfn_valid(_mfn(mfn)) ) 
     {
         if ( !set_p2m_entry(p2m, gfn, _mfn(mfn), page_order, t, p2m->default_access) )
+        {
             rc = -EINVAL;
+            goto out; /* Failed to update p2m, bail without updating m2p. */
+        }
         if ( !p2m_is_grant(t) )
         {
             for ( i = 0; i < (1UL << page_order); i++ )
@@ -2579,6 +2582,7 @@ guest_physmap_add_entry(struct p2m_domai
         }
     }
 
+out:
     audit_p2m(p2m, 1);
     p2m_unlock(p2m);
 

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

From xen-changelog-bounces@lists.xen.org Wed Nov 14 18:02:29 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Nov 2012 18:02: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 1TYhIC-0002tk-0A; Wed, 14 Nov 2012 18:02:28 +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 1TYhIA-0002tO-0I
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:02:26 +0000
Received: from [85.158.143.35:4054] by server-3.bemta-4.messagelabs.com id
	59/4D-06841-1BCD3A05; Wed, 14 Nov 2012 18:02:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1352916046!10353288!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17104 invoked from network); 14 Nov 2012 18:00:47 -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 Nov 2012 18:00: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 1TYhGY-0002au-Gq
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:46 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYhGY-0005gZ-3r
	for xen-changelog@lists.xensource.com; Wed, 14 Nov 2012 18:00:46 +0000
Message-Id: <E1TYhGY-0005gZ-3r@xenbits.xen.org>
Date: Wed, 14 Nov 2012 18:00:45 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] x86/physmap: Prevent incorrect
	updates of m2p mappings
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893245 0
# Node ID f635b1447d7e35fb10cf5373ee365111f892c932
# Parent  210f16b6509b7462481da2e64e4fe20efcdb899d
x86/physmap: Prevent incorrect updates of m2p mappings

In certain conditions, such as low memory, set_p2m_entry() can fail.
Currently, the p2m and m2p tables will get out of sync because we still
update the m2p table after the p2m update has failed.

If that happens, subsequent guest-invoked memory operations can cause
BUG()s and ASSERT()s to kill Xen.

This is fixed by only updating the m2p table iff the p2m was
successfully updated.

This is a security problem, XSA-22 / CVE-2012-4537.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
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 210f16b6509b -r f635b1447d7e xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Wed Nov 14 11:35:06 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Wed Nov 14 11:40:45 2012 +0000
@@ -2558,7 +2558,10 @@ guest_physmap_add_entry(struct p2m_domai
     if ( mfn_valid(_mfn(mfn)) ) 
     {
         if ( !set_p2m_entry(p2m, gfn, _mfn(mfn), page_order, t, p2m->default_access) )
+        {
             rc = -EINVAL;
+            goto out; /* Failed to update p2m, bail without updating m2p. */
+        }
         if ( !p2m_is_grant(t) )
         {
             for ( i = 0; i < (1UL << page_order); i++ )
@@ -2579,6 +2582,7 @@ guest_physmap_add_entry(struct p2m_domai
         }
     }
 
+out:
     audit_p2m(p2m, 1);
     p2m_unlock(p2m);
 

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 00:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 00: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.xen.org>)
	id 1TYn33-0004Ch-WC; Thu, 15 Nov 2012 00:11:13 +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 1TYn33-0004CO-DJ
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:13 +0000
Received: from [85.158.139.83:36260] by server-3.bemta-5.messagelabs.com id
	6E/CC-18736-02334A05; Thu, 15 Nov 2012 00:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-182.messagelabs.com!1352938271!30359356!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9307 invoked from network); 15 Nov 2012 00:11:12 -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;
	15 Nov 2012 00: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 1TYn30-0007Fr-T6
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYn30-00075W-Lk
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:10 +0000
Message-Id: <E1TYn30-00075W-Lk@xenbits.xen.org>
Date: Thu, 15 Nov 2012 00:11:10 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] fix xenctl_cpumap_to_cpumask()
	buffer size 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: "Change log for Mercurial \(receive only\)"
	<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 Matthew Daley <mattjd@gmail.com>
# Date 1352886041 -3600
# Node ID bdb5cde7f79d77f8578bcd8e24d74d09a2c7caa6
# Parent  63159cebdbaab679a77905f03d186ba9e963638b
fix xenctl_cpumap_to_cpumask() buffer size check

xenctl_cpumap_to_cpumask incorrectly uses sizeof when checking whether
bits should be masked off from the input cpumap bitmap or not.

Fix by using the correct cpumask buffer size in place of sizeof.

Signed-off-by: Matthew Daley <mattjd@gmail.com>

Compare against copy_bytes instead, and use equality rather than less-
or-equal.

Further, this issue (introduced with c/s 23991:a7ccbc79fc17) is not
security relevant (i.e. the bug could not cause memory corruption):
_xmalloc() never returns chunks of data smaller than the size of a
pointer, i.e. even if sizeof(void*) > guest_bytes > copy_bytes, the
piece of memory erroneously written to would still be inside the
allocation done at the top of the function.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen-unstable changeset: 26139:56400658f096
xen-unstable date: Tue Nov 13 10:28:10 UTC 2012
---


diff -r 63159cebdbaa -r bdb5cde7f79d xen/common/domctl.c
--- a/xen/common/domctl.c	Wed Nov 14 10:39:55 2012 +0100
+++ b/xen/common/domctl.c	Wed Nov 14 10:40:41 2012 +0100
@@ -78,7 +78,7 @@ int xenctl_cpumap_to_cpumask(
     {
         if ( copy_from_guest(bytemap, xenctl_cpumap->bitmap, copy_bytes) )
             err = -EFAULT;
-        if ( (xenctl_cpumap->nr_cpus & 7) && (guest_bytes <= sizeof(bytemap)) )
+        if ( (xenctl_cpumap->nr_cpus & 7) && (guest_bytes == copy_bytes) )
             bytemap[guest_bytes-1] &= ~(0xff << (xenctl_cpumap->nr_cpus & 7));
     }
 

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 00:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 00: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.xen.org>)
	id 1TYn33-0004Ch-WC; Thu, 15 Nov 2012 00:11:13 +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 1TYn33-0004CO-DJ
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:13 +0000
Received: from [85.158.139.83:36260] by server-3.bemta-5.messagelabs.com id
	6E/CC-18736-02334A05; Thu, 15 Nov 2012 00:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-182.messagelabs.com!1352938271!30359356!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9307 invoked from network); 15 Nov 2012 00:11:12 -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;
	15 Nov 2012 00: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 1TYn30-0007Fr-T6
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYn30-00075W-Lk
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:10 +0000
Message-Id: <E1TYn30-00075W-Lk@xenbits.xen.org>
Date: Thu, 15 Nov 2012 00:11:10 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] fix xenctl_cpumap_to_cpumask()
	buffer size 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: "Change log for Mercurial \(receive only\)"
	<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 Matthew Daley <mattjd@gmail.com>
# Date 1352886041 -3600
# Node ID bdb5cde7f79d77f8578bcd8e24d74d09a2c7caa6
# Parent  63159cebdbaab679a77905f03d186ba9e963638b
fix xenctl_cpumap_to_cpumask() buffer size check

xenctl_cpumap_to_cpumask incorrectly uses sizeof when checking whether
bits should be masked off from the input cpumap bitmap or not.

Fix by using the correct cpumask buffer size in place of sizeof.

Signed-off-by: Matthew Daley <mattjd@gmail.com>

Compare against copy_bytes instead, and use equality rather than less-
or-equal.

Further, this issue (introduced with c/s 23991:a7ccbc79fc17) is not
security relevant (i.e. the bug could not cause memory corruption):
_xmalloc() never returns chunks of data smaller than the size of a
pointer, i.e. even if sizeof(void*) > guest_bytes > copy_bytes, the
piece of memory erroneously written to would still be inside the
allocation done at the top of the function.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen-unstable changeset: 26139:56400658f096
xen-unstable date: Tue Nov 13 10:28:10 UTC 2012
---


diff -r 63159cebdbaa -r bdb5cde7f79d xen/common/domctl.c
--- a/xen/common/domctl.c	Wed Nov 14 10:39:55 2012 +0100
+++ b/xen/common/domctl.c	Wed Nov 14 10:40:41 2012 +0100
@@ -78,7 +78,7 @@ int xenctl_cpumap_to_cpumask(
     {
         if ( copy_from_guest(bytemap, xenctl_cpumap->bitmap, copy_bytes) )
             err = -EFAULT;
-        if ( (xenctl_cpumap->nr_cpus & 7) && (guest_bytes <= sizeof(bytemap)) )
+        if ( (xenctl_cpumap->nr_cpus & 7) && (guest_bytes == copy_bytes) )
             bytemap[guest_bytes-1] &= ~(0xff << (xenctl_cpumap->nr_cpus & 7));
     }
 

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 00:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 00: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.xen.org>)
	id 1TYn34-0004Cm-2h; Thu, 15 Nov 2012 00: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 1TYn33-0004CP-FK
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:13 +0000
Received: from [85.158.139.211:25155] by server-10.bemta-5.messagelabs.com id
	66/66-09257-02334A05; Thu, 15 Nov 2012 00:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-206.messagelabs.com!1352938270!19780783!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29813 invoked from network); 15 Nov 2012 00:11:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Nov 2012 00: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 1TYn30-0007Fo-E2
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYn30-00075G-4E
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:10 +0000
Message-Id: <E1TYn30-00075G-4E@xenbits.xen.org>
Date: Thu, 15 Nov 2012 00:11:09 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] x86/mm x86 shadow: Fix typo in
	sh_invlpg sl3 page presence 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: "Change log for Mercurial \(receive only\)"
	<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 Matthew Daley <mattjd@gmail.com>
# Date 1352885995 -3600
# Node ID 63159cebdbaab679a77905f03d186ba9e963638b
# Parent  ea0380b7611691b352bce509bcf18e5dd7e1e4f0
x86/mm x86 shadow: Fix typo in sh_invlpg sl3 page presence check

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Tim Deegan <tim@xen.org>
xen-unstable changeset: 26134:279bbf2a0b48
xen-unstable date: Mon Nov 12 10:17:00 UTC 2012
---


diff -r ea0380b76116 -r 63159cebdbaa xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 10:37:51 2012 +0100
+++ b/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 10:39:55 2012 +0100
@@ -3665,7 +3665,7 @@ sh_invlpg(struct vcpu *v, unsigned long 
             perfc_incr(shadow_invlpg_fault);
             return 0;
         }
-        if ( (!shadow_l3e_get_flags(sl3e) & _PAGE_PRESENT) )
+        if ( !(shadow_l3e_get_flags(sl3e) & _PAGE_PRESENT) )
             return 0;
     }
 #else /* SHADOW_PAGING_LEVELS == 3 */

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 00:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 00: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.xen.org>)
	id 1TYn34-0004Cm-2h; Thu, 15 Nov 2012 00: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 1TYn33-0004CP-FK
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:13 +0000
Received: from [85.158.139.211:25155] by server-10.bemta-5.messagelabs.com id
	66/66-09257-02334A05; Thu, 15 Nov 2012 00:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-206.messagelabs.com!1352938270!19780783!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29813 invoked from network); 15 Nov 2012 00:11:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Nov 2012 00: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 1TYn30-0007Fo-E2
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYn30-00075G-4E
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:10 +0000
Message-Id: <E1TYn30-00075G-4E@xenbits.xen.org>
Date: Thu, 15 Nov 2012 00:11:09 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] x86/mm x86 shadow: Fix typo in
	sh_invlpg sl3 page presence 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: "Change log for Mercurial \(receive only\)"
	<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 Matthew Daley <mattjd@gmail.com>
# Date 1352885995 -3600
# Node ID 63159cebdbaab679a77905f03d186ba9e963638b
# Parent  ea0380b7611691b352bce509bcf18e5dd7e1e4f0
x86/mm x86 shadow: Fix typo in sh_invlpg sl3 page presence check

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Tim Deegan <tim@xen.org>
xen-unstable changeset: 26134:279bbf2a0b48
xen-unstable date: Mon Nov 12 10:17:00 UTC 2012
---


diff -r ea0380b76116 -r 63159cebdbaa xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 10:37:51 2012 +0100
+++ b/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 10:39:55 2012 +0100
@@ -3665,7 +3665,7 @@ sh_invlpg(struct vcpu *v, unsigned long 
             perfc_incr(shadow_invlpg_fault);
             return 0;
         }
-        if ( (!shadow_l3e_get_flags(sl3e) & _PAGE_PRESENT) )
+        if ( !(shadow_l3e_get_flags(sl3e) & _PAGE_PRESENT) )
             return 0;
     }
 #else /* SHADOW_PAGING_LEVELS == 3 */

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 00:11:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 00:11: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.xen.org>)
	id 1TYn33-0004Cc-Tl; Thu, 15 Nov 2012 00:11:13 +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 1TYn32-0004CO-WD
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:13 +0000
Received: from [85.158.139.83:36243] by server-3.bemta-5.messagelabs.com id
	DC/CC-18736-02334A05; Thu, 15 Nov 2012 00:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-182.messagelabs.com!1352938270!19055475!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11437 invoked from network); 15 Nov 2012 00:11:11 -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;
	15 Nov 2012 00: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 1TYn30-0007Fl-0K
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYn2z-000751-Eu
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:09 +0000
Message-Id: <E1TYn2z-000751-Eu@xenbits.xen.org>
Date: Thu, 15 Nov 2012 00:11:08 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] tmem: Prevent NULL dereference on
	error case
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Daley <mattjd@gmail.com>
# Date 1352885871 -3600
# Node ID ea0380b7611691b352bce509bcf18e5dd7e1e4f0
# Parent  839e5d95d483586dac5073cb59f845910588b000
tmem: Prevent NULL dereference on error case

If the client / pool IDs given to tmemc_save_get_next_page are invalid,
the calculation of pagesize will dereference NULL.

Fix this by moving the calculation below the appropriate NULL check.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
xen-unstable changeset: 26132:286ef4ced216
xen-unstable date: Mon Nov 12 08:34:57 UTC 2012
---


diff -r 839e5d95d483 -r ea0380b76116 xen/common/tmem.c
--- a/xen/common/tmem.c	Tue Nov 13 18:00:57 2012 +0000
+++ b/xen/common/tmem.c	Wed Nov 14 10:37:51 2012 +0100
@@ -2446,10 +2446,12 @@ static NOINLINE int tmemc_save_get_next_
     OID oid;
     int ret = 0;
     struct tmem_handle h;
-    unsigned int pagesize = 1 << (pool->pageshift+12);
+    unsigned int pagesize;
 
     if ( pool == NULL || is_ephemeral(pool) )
         return -1;
+
+    pagesize = 1 << (pool->pageshift + 12);
     if ( bufsize < pagesize + sizeof(struct tmem_handle) )
         return -ENOMEM;
 

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 00:11:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 00:11: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.xen.org>)
	id 1TYn33-0004Cc-Tl; Thu, 15 Nov 2012 00:11:13 +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 1TYn32-0004CO-WD
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:13 +0000
Received: from [85.158.139.83:36243] by server-3.bemta-5.messagelabs.com id
	DC/CC-18736-02334A05; Thu, 15 Nov 2012 00:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-182.messagelabs.com!1352938270!19055475!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11437 invoked from network); 15 Nov 2012 00:11:11 -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;
	15 Nov 2012 00: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 1TYn30-0007Fl-0K
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYn2z-000751-Eu
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:09 +0000
Message-Id: <E1TYn2z-000751-Eu@xenbits.xen.org>
Date: Thu, 15 Nov 2012 00:11:08 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] tmem: Prevent NULL dereference on
	error case
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Daley <mattjd@gmail.com>
# Date 1352885871 -3600
# Node ID ea0380b7611691b352bce509bcf18e5dd7e1e4f0
# Parent  839e5d95d483586dac5073cb59f845910588b000
tmem: Prevent NULL dereference on error case

If the client / pool IDs given to tmemc_save_get_next_page are invalid,
the calculation of pagesize will dereference NULL.

Fix this by moving the calculation below the appropriate NULL check.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
xen-unstable changeset: 26132:286ef4ced216
xen-unstable date: Mon Nov 12 08:34:57 UTC 2012
---


diff -r 839e5d95d483 -r ea0380b76116 xen/common/tmem.c
--- a/xen/common/tmem.c	Tue Nov 13 18:00:57 2012 +0000
+++ b/xen/common/tmem.c	Wed Nov 14 10:37:51 2012 +0100
@@ -2446,10 +2446,12 @@ static NOINLINE int tmemc_save_get_next_
     OID oid;
     int ret = 0;
     struct tmem_handle h;
-    unsigned int pagesize = 1 << (pool->pageshift+12);
+    unsigned int pagesize;
 
     if ( pool == NULL || is_ephemeral(pool) )
         return -1;
+
+    pagesize = 1 << (pool->pageshift + 12);
     if ( bufsize < pagesize + sizeof(struct tmem_handle) )
         return -ENOMEM;
 

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 00:11:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 00: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.xen.org>)
	id 1TYn37-0004DU-7t; Thu, 15 Nov 2012 00:11:17 +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 1TYn36-0004DB-HJ
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:16 +0000
Received: from [85.158.143.99:60384] by server-2.bemta-4.messagelabs.com id
	D8/DC-28922-32334A05; Thu, 15 Nov 2012 00:11:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1352938273!27306181!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25733 invoked from network); 15 Nov 2012 00:11:14 -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;
	15 Nov 2012 00: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 1TYn33-0007G3-5B
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYn32-00076U-Qj
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:12 +0000
Message-Id: <E1TYn32-00076U-Qj@xenbits.xen.org>
Date: Thu, 15 Nov 2012 00:11:12 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] compat/gnttab: Prevent infinite
	loop in compat code
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893567 0
# Node ID 8ca6372315f826881f9de141ac1227ef962100cf
# Parent  159080b58dda9d19a5d3be42359e667bdb3e61ca
compat/gnttab: Prevent infinite loop in compat code

c/s 20281:95ea2052b41b, which introduces Grant Table version 2
hypercalls introduces a vulnerability whereby the compat hypercall
handler can fall into an infinite loop.

If the watchdog is enabled, Xen will die after the timeout.

This is a security problem, XSA-24 / CVE-2012-4539.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-unstable changeset: 26151:b64a7d868f06
Backport-requested-by: security@xen.org
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 159080b58dda -r 8ca6372315f8 xen/common/compat/grant_table.c
--- a/xen/common/compat/grant_table.c	Wed Nov 14 11:42:45 2012 +0000
+++ b/xen/common/compat/grant_table.c	Wed Nov 14 11:46:07 2012 +0000
@@ -318,6 +318,8 @@ int compat_grant_table_op(unsigned int c
 #undef XLAT_gnttab_get_status_frames_HNDL_frame_list
                 if ( unlikely(__copy_to_guest(cmp_uop, &cmp.get_status, 1)) )
                     rc = -EFAULT;
+                else
+                    i = 1;
             }
             break;
         }

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 00:11:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 00: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.xen.org>)
	id 1TYn37-0004DU-7t; Thu, 15 Nov 2012 00:11:17 +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 1TYn36-0004DB-HJ
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:16 +0000
Received: from [85.158.143.99:60384] by server-2.bemta-4.messagelabs.com id
	D8/DC-28922-32334A05; Thu, 15 Nov 2012 00:11:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1352938273!27306181!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25733 invoked from network); 15 Nov 2012 00:11:14 -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;
	15 Nov 2012 00: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 1TYn33-0007G3-5B
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYn32-00076U-Qj
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:12 +0000
Message-Id: <E1TYn32-00076U-Qj@xenbits.xen.org>
Date: Thu, 15 Nov 2012 00:11:12 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] compat/gnttab: Prevent infinite
	loop in compat code
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893567 0
# Node ID 8ca6372315f826881f9de141ac1227ef962100cf
# Parent  159080b58dda9d19a5d3be42359e667bdb3e61ca
compat/gnttab: Prevent infinite loop in compat code

c/s 20281:95ea2052b41b, which introduces Grant Table version 2
hypercalls introduces a vulnerability whereby the compat hypercall
handler can fall into an infinite loop.

If the watchdog is enabled, Xen will die after the timeout.

This is a security problem, XSA-24 / CVE-2012-4539.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-unstable changeset: 26151:b64a7d868f06
Backport-requested-by: security@xen.org
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 159080b58dda -r 8ca6372315f8 xen/common/compat/grant_table.c
--- a/xen/common/compat/grant_table.c	Wed Nov 14 11:42:45 2012 +0000
+++ b/xen/common/compat/grant_table.c	Wed Nov 14 11:46:07 2012 +0000
@@ -318,6 +318,8 @@ int compat_grant_table_op(unsigned int c
 #undef XLAT_gnttab_get_status_frames_HNDL_frame_list
                 if ( unlikely(__copy_to_guest(cmp_uop, &cmp.get_status, 1)) )
                     rc = -EFAULT;
+                else
+                    i = 1;
             }
             break;
         }

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 00:11:33 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 00:11: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 1TYn3K-0004Fe-F2; Thu, 15 Nov 2012 00:11:30 +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 1TYn3J-0004FJ-2L
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:29 +0000
Received: from [85.158.137.99:62622] by server-16.bemta-3.messagelabs.com id
	20/82-07461-F2334A05; Thu, 15 Nov 2012 00:11:27 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-217.messagelabs.com!1352938285!19155156!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5606 invoked from network); 15 Nov 2012 00:11:26 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Nov 2012 00:11: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 1TYn31-0007Fu-BT
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYn31-00075l-6x
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:11 +0000
Message-Id: <E1TYn31-00075l-6x@xenbits.xen.org>
Date: Thu, 15 Nov 2012 00:11:10 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] VCPU/timers: Prevent overflow in
	calculations, leading to DoS vulnerability
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352892795 0
# Node ID 788af5959f692ca16942937055afb09b760f2166
# Parent  bdb5cde7f79d77f8578bcd8e24d74d09a2c7caa6
VCPU/timers: Prevent overflow in calculations, leading to DoS vulnerability

The timer action for a vcpu periodic timer is to calculate the next
expiry time, and to reinsert itself into the timer queue.  If the
deadline ends up in the past, Xen never leaves __do_softirq().  The
affected PCPU will stay in an infinite loop until Xen is killed by the
watchdog (if enabled).

This is a security problem, XSA-20 / CVE-2012-4535.

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

xen-unstable changeset: 26148:bf58b94b3cef
Backport-requested-by: security@xen.org
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r bdb5cde7f79d -r 788af5959f69 xen/common/domain.c
--- a/xen/common/domain.c	Wed Nov 14 10:40:41 2012 +0100
+++ b/xen/common/domain.c	Wed Nov 14 11:33:15 2012 +0000
@@ -882,6 +882,9 @@ long do_vcpu_op(int cmd, int vcpuid, XEN
         if ( set.period_ns < MILLISECS(1) )
             return -EINVAL;
 
+        if ( set.period_ns > STIME_DELTA_MAX )
+            return -EINVAL;
+
         v->periodic_period = set.period_ns;
         vcpu_force_reschedule(v);
 
diff -r bdb5cde7f79d -r 788af5959f69 xen/include/xen/time.h
--- a/xen/include/xen/time.h	Wed Nov 14 10:40:41 2012 +0100
+++ b/xen/include/xen/time.h	Wed Nov 14 11:33:15 2012 +0000
@@ -55,6 +55,8 @@ struct tm gmtime(unsigned long t);
 #define MILLISECS(_ms)  ((s_time_t)((_ms) * 1000000ULL))
 #define MICROSECS(_us)  ((s_time_t)((_us) * 1000ULL))
 #define STIME_MAX ((s_time_t)((uint64_t)~0ull>>1))
+/* Chosen so (NOW() + delta) wont overflow without an uptime of 200 years */
+#define STIME_DELTA_MAX ((s_time_t)((uint64_t)~0ull>>2))
 
 extern void update_vcpu_system_time(struct vcpu *v);
 extern void update_domain_wallclock_time(struct domain *d);

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 00:11:33 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 00:11: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 1TYn3K-0004Fe-F2; Thu, 15 Nov 2012 00:11:30 +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 1TYn3J-0004FJ-2L
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:29 +0000
Received: from [85.158.137.99:62622] by server-16.bemta-3.messagelabs.com id
	20/82-07461-F2334A05; Thu, 15 Nov 2012 00:11:27 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-217.messagelabs.com!1352938285!19155156!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5606 invoked from network); 15 Nov 2012 00:11:26 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Nov 2012 00:11: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 1TYn31-0007Fu-BT
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYn31-00075l-6x
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:11 +0000
Message-Id: <E1TYn31-00075l-6x@xenbits.xen.org>
Date: Thu, 15 Nov 2012 00:11:10 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] VCPU/timers: Prevent overflow in
	calculations, leading to DoS vulnerability
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352892795 0
# Node ID 788af5959f692ca16942937055afb09b760f2166
# Parent  bdb5cde7f79d77f8578bcd8e24d74d09a2c7caa6
VCPU/timers: Prevent overflow in calculations, leading to DoS vulnerability

The timer action for a vcpu periodic timer is to calculate the next
expiry time, and to reinsert itself into the timer queue.  If the
deadline ends up in the past, Xen never leaves __do_softirq().  The
affected PCPU will stay in an infinite loop until Xen is killed by the
watchdog (if enabled).

This is a security problem, XSA-20 / CVE-2012-4535.

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

xen-unstable changeset: 26148:bf58b94b3cef
Backport-requested-by: security@xen.org
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r bdb5cde7f79d -r 788af5959f69 xen/common/domain.c
--- a/xen/common/domain.c	Wed Nov 14 10:40:41 2012 +0100
+++ b/xen/common/domain.c	Wed Nov 14 11:33:15 2012 +0000
@@ -882,6 +882,9 @@ long do_vcpu_op(int cmd, int vcpuid, XEN
         if ( set.period_ns < MILLISECS(1) )
             return -EINVAL;
 
+        if ( set.period_ns > STIME_DELTA_MAX )
+            return -EINVAL;
+
         v->periodic_period = set.period_ns;
         vcpu_force_reschedule(v);
 
diff -r bdb5cde7f79d -r 788af5959f69 xen/include/xen/time.h
--- a/xen/include/xen/time.h	Wed Nov 14 10:40:41 2012 +0100
+++ b/xen/include/xen/time.h	Wed Nov 14 11:33:15 2012 +0000
@@ -55,6 +55,8 @@ struct tm gmtime(unsigned long t);
 #define MILLISECS(_ms)  ((s_time_t)((_ms) * 1000000ULL))
 #define MICROSECS(_us)  ((s_time_t)((_us) * 1000ULL))
 #define STIME_MAX ((s_time_t)((uint64_t)~0ull>>1))
+/* Chosen so (NOW() + delta) wont overflow without an uptime of 200 years */
+#define STIME_DELTA_MAX ((s_time_t)((uint64_t)~0ull>>2))
 
 extern void update_vcpu_system_time(struct vcpu *v);
 extern void update_domain_wallclock_time(struct domain *d);

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 00:11:33 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 00:11: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 1TYn3K-0004FY-BY; Thu, 15 Nov 2012 00:11:30 +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 1TYn3I-0004FL-Lt
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:28 +0000
Received: from [85.158.137.99:29592] by server-3.bemta-3.messagelabs.com id
	81/12-31566-F2334A05; Thu, 15 Nov 2012 00:11:27 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-217.messagelabs.com!1352938286!19159711!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8747 invoked from network); 15 Nov 2012 00:11:27 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Nov 2012 00:11: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 1TYn31-0007Fx-Sf
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYn31-000760-Nq
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:11 +0000
Message-Id: <E1TYn31-000760-Nq@xenbits.xen.org>
Date: Thu, 15 Nov 2012 00:11:11 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] x86/physmap: Prevent incorrect
	updates of m2p mappings
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893017 0
# Node ID 4cffe28427e0c7dbeaa7c109ed393dde0fe026ba
# Parent  788af5959f692ca16942937055afb09b760f2166
x86/physmap: Prevent incorrect updates of m2p mappings

In certain conditions, such as low memory, set_p2m_entry() can fail.
Currently, the p2m and m2p tables will get out of sync because we still
update the m2p table after the p2m update has failed.

If that happens, subsequent guest-invoked memory operations can cause
BUG()s and ASSERT()s to kill Xen.

This is fixed by only updating the m2p table iff the p2m was
successfully updated.

This is a security problem, XSA-22 / CVE-2012-4537.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
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>

xen-unstable changeset: 26149:6b6a4007a609
Backport-requested-by: security@xen.org
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 788af5959f69 -r 4cffe28427e0 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Wed Nov 14 11:33:15 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Wed Nov 14 11:36:57 2012 +0000
@@ -654,7 +654,10 @@ guest_physmap_add_entry(struct domain *d
     if ( mfn_valid(_mfn(mfn)) ) 
     {
         if ( !set_p2m_entry(p2m, gfn, _mfn(mfn), page_order, t, p2m->default_access) )
+        {
             rc = -EINVAL;
+            goto out; /* Failed to update p2m, bail without updating m2p. */
+        }
         if ( !p2m_is_grant(t) )
         {
             for ( i = 0; i < (1UL << page_order); i++ )
@@ -677,6 +680,7 @@ guest_physmap_add_entry(struct domain *d
         }
     }
 
+out:
     p2m_unlock(p2m);
 
     return rc;

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 00:11:33 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 00:11: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 1TYn3K-0004FY-BY; Thu, 15 Nov 2012 00:11:30 +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 1TYn3I-0004FL-Lt
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:28 +0000
Received: from [85.158.137.99:29592] by server-3.bemta-3.messagelabs.com id
	81/12-31566-F2334A05; Thu, 15 Nov 2012 00:11:27 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-217.messagelabs.com!1352938286!19159711!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8747 invoked from network); 15 Nov 2012 00:11:27 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Nov 2012 00:11: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 1TYn31-0007Fx-Sf
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYn31-000760-Nq
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:11 +0000
Message-Id: <E1TYn31-000760-Nq@xenbits.xen.org>
Date: Thu, 15 Nov 2012 00:11:11 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] x86/physmap: Prevent incorrect
	updates of m2p mappings
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893017 0
# Node ID 4cffe28427e0c7dbeaa7c109ed393dde0fe026ba
# Parent  788af5959f692ca16942937055afb09b760f2166
x86/physmap: Prevent incorrect updates of m2p mappings

In certain conditions, such as low memory, set_p2m_entry() can fail.
Currently, the p2m and m2p tables will get out of sync because we still
update the m2p table after the p2m update has failed.

If that happens, subsequent guest-invoked memory operations can cause
BUG()s and ASSERT()s to kill Xen.

This is fixed by only updating the m2p table iff the p2m was
successfully updated.

This is a security problem, XSA-22 / CVE-2012-4537.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
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>

xen-unstable changeset: 26149:6b6a4007a609
Backport-requested-by: security@xen.org
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 788af5959f69 -r 4cffe28427e0 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Wed Nov 14 11:33:15 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Wed Nov 14 11:36:57 2012 +0000
@@ -654,7 +654,10 @@ guest_physmap_add_entry(struct domain *d
     if ( mfn_valid(_mfn(mfn)) ) 
     {
         if ( !set_p2m_entry(p2m, gfn, _mfn(mfn), page_order, t, p2m->default_access) )
+        {
             rc = -EINVAL;
+            goto out; /* Failed to update p2m, bail without updating m2p. */
+        }
         if ( !p2m_is_grant(t) )
         {
             for ( i = 0; i < (1UL << page_order); i++ )
@@ -677,6 +680,7 @@ guest_physmap_add_entry(struct domain *d
         }
     }
 
+out:
     p2m_unlock(p2m);
 
     return rc;

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 00:12:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 00:12: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 1TYn4A-0004OZ-W8; Thu, 15 Nov 2012 00:12: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 1TYn49-0004OA-7R
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:12:21 +0000
Received: from [193.109.254.147:36240] by server-5.bemta-14.messagelabs.com id
	02/78-10257-46334A05; Thu, 15 Nov 2012 00:12:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1352938334!8870295!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18388 invoked from network); 15 Nov 2012 00:12:19 -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;
	15 Nov 2012 00:12: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 1TYn32-0007G0-Gj
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYn32-00076F-9N
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:12 +0000
Message-Id: <E1TYn32-00076F-9N@xenbits.xen.org>
Date: Thu, 15 Nov 2012 00:11:11 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xen/mm/shadow: check toplevel
	pagetables are present before unhooking them.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893365 0
# Node ID 159080b58dda9d19a5d3be42359e667bdb3e61ca
# Parent  4cffe28427e0c7dbeaa7c109ed393dde0fe026ba
xen/mm/shadow: check toplevel pagetables are present before unhooking them.

If the guest has not fully populated its top-level PAE entries when it calls
HVMOP_pagetable_dying, the shadow code could try to unhook entries from
MFN 0.  Add a check to avoid that case.

This issue was introduced by c/s 21239:b9d2db109cf5.

This is a security problem, XSA-23 / CVE-2012-4538.

Signed-off-by: Tim Deegan <tim@xen.org>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-unstable changeset: 26150:c7a01b6450e4
Backport-requested-by: security@xen.org
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 4cffe28427e0 -r 159080b58dda xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 11:36:57 2012 +0000
+++ b/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 11:42:45 2012 +0000
@@ -4734,8 +4734,12 @@ static void sh_pagetable_dying(struct vc
         unsigned long gfn;
         mfn_t smfn, gmfn;
 
-        if ( fast_path )
-            smfn = _mfn(pagetable_get_pfn(v->arch.shadow_table[i]));
+        if ( fast_path ) {
+            if ( pagetable_is_null(v->arch.shadow_table[i]) )
+                smfn = _mfn(INVALID_MFN);
+            else
+                smfn = _mfn(pagetable_get_pfn(v->arch.shadow_table[i]));
+        }
         else
         {
             /* retrieving the l2s */

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 00:12:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 00:12: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 1TYn4A-0004OZ-W8; Thu, 15 Nov 2012 00:12: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 1TYn49-0004OA-7R
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:12:21 +0000
Received: from [193.109.254.147:36240] by server-5.bemta-14.messagelabs.com id
	02/78-10257-46334A05; Thu, 15 Nov 2012 00:12:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1352938334!8870295!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18388 invoked from network); 15 Nov 2012 00:12:19 -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;
	15 Nov 2012 00:12: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 1TYn32-0007G0-Gj
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYn32-00076F-9N
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 00:11:12 +0000
Message-Id: <E1TYn32-00076F-9N@xenbits.xen.org>
Date: Thu, 15 Nov 2012 00:11:11 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xen/mm/shadow: check toplevel
	pagetables are present before unhooking them.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893365 0
# Node ID 159080b58dda9d19a5d3be42359e667bdb3e61ca
# Parent  4cffe28427e0c7dbeaa7c109ed393dde0fe026ba
xen/mm/shadow: check toplevel pagetables are present before unhooking them.

If the guest has not fully populated its top-level PAE entries when it calls
HVMOP_pagetable_dying, the shadow code could try to unhook entries from
MFN 0.  Add a check to avoid that case.

This issue was introduced by c/s 21239:b9d2db109cf5.

This is a security problem, XSA-23 / CVE-2012-4538.

Signed-off-by: Tim Deegan <tim@xen.org>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-unstable changeset: 26150:c7a01b6450e4
Backport-requested-by: security@xen.org
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 4cffe28427e0 -r 159080b58dda xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 11:36:57 2012 +0000
+++ b/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 11:42:45 2012 +0000
@@ -4734,8 +4734,12 @@ static void sh_pagetable_dying(struct vc
         unsigned long gfn;
         mfn_t smfn, gmfn;
 
-        if ( fast_path )
-            smfn = _mfn(pagetable_get_pfn(v->arch.shadow_table[i]));
+        if ( fast_path ) {
+            if ( pagetable_is_null(v->arch.shadow_table[i]) )
+                smfn = _mfn(INVALID_MFN);
+            else
+                smfn = _mfn(pagetable_get_pfn(v->arch.shadow_table[i]));
+        }
         else
         {
             /* retrieving the l2s */

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 02:44:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 02: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 1TYpR8-0004R1-A6; Thu, 15 Nov 2012 02:44:14 +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 1TYpR7-0004QV-27
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:13 +0000
Received: from [85.158.138.51:35872] by server-12.bemta-3.messagelabs.com id
	04/A8-22757-CF654A05; Thu, 15 Nov 2012 02:44:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1352947450!21988207!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15960 invoked from network); 15 Nov 2012 02:44: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;
	15 Nov 2012 02: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 1TYpR4-0006o2-3P
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYpR3-0002gZ-Ru
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:09 +0000
Message-Id: <E1TYpR3-0002gZ-Ru@xenbits.xen.org>
Date: Thu, 15 Nov 2012 02:44:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] VCPU/timers: Prevent overflow in
	calculations, leading to DoS vulnerability
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352892634 0
# Node ID bf58b94b3cef4db8d9ad9c8686bf10910ccc0644
# Parent  3186c04af5829a242059ffe4f6427853b7bfc408
VCPU/timers: Prevent overflow in calculations, leading to DoS vulnerability

The timer action for a vcpu periodic timer is to calculate the next
expiry time, and to reinsert itself into the timer queue.  If the
deadline ends up in the past, Xen never leaves __do_softirq().  The
affected PCPU will stay in an infinite loop until Xen is killed by the
watchdog (if enabled).

This is a security problem, XSA-20 / CVE-2012-4535.

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


diff -r 3186c04af582 -r bf58b94b3cef xen/common/domain.c
--- a/xen/common/domain.c	Wed Nov 14 10:24:28 2012 +0000
+++ b/xen/common/domain.c	Wed Nov 14 11:30:34 2012 +0000
@@ -903,6 +903,9 @@ long do_vcpu_op(int cmd, int vcpuid, XEN
         if ( set.period_ns < MILLISECS(1) )
             return -EINVAL;
 
+        if ( set.period_ns > STIME_DELTA_MAX )
+            return -EINVAL;
+
         v->periodic_period = set.period_ns;
         vcpu_force_reschedule(v);
 
diff -r 3186c04af582 -r bf58b94b3cef xen/include/xen/time.h
--- a/xen/include/xen/time.h	Wed Nov 14 10:24:28 2012 +0000
+++ b/xen/include/xen/time.h	Wed Nov 14 11:30:34 2012 +0000
@@ -55,6 +55,8 @@ struct tm gmtime(unsigned long t);
 #define MILLISECS(_ms)  ((s_time_t)((_ms) * 1000000ULL))
 #define MICROSECS(_us)  ((s_time_t)((_us) * 1000ULL))
 #define STIME_MAX ((s_time_t)((uint64_t)~0ull>>1))
+/* Chosen so (NOW() + delta) wont overflow without an uptime of 200 years */
+#define STIME_DELTA_MAX ((s_time_t)((uint64_t)~0ull>>2))
 
 extern void update_vcpu_system_time(struct vcpu *v);
 extern void update_domain_wallclock_time(struct domain *d);

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 02:44:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 02: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 1TYpR8-0004R1-A6; Thu, 15 Nov 2012 02:44:14 +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 1TYpR7-0004QV-27
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:13 +0000
Received: from [85.158.138.51:35872] by server-12.bemta-3.messagelabs.com id
	04/A8-22757-CF654A05; Thu, 15 Nov 2012 02:44:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1352947450!21988207!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15960 invoked from network); 15 Nov 2012 02:44: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;
	15 Nov 2012 02: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 1TYpR4-0006o2-3P
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYpR3-0002gZ-Ru
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:09 +0000
Message-Id: <E1TYpR3-0002gZ-Ru@xenbits.xen.org>
Date: Thu, 15 Nov 2012 02:44:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] VCPU/timers: Prevent overflow in
	calculations, leading to DoS vulnerability
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352892634 0
# Node ID bf58b94b3cef4db8d9ad9c8686bf10910ccc0644
# Parent  3186c04af5829a242059ffe4f6427853b7bfc408
VCPU/timers: Prevent overflow in calculations, leading to DoS vulnerability

The timer action for a vcpu periodic timer is to calculate the next
expiry time, and to reinsert itself into the timer queue.  If the
deadline ends up in the past, Xen never leaves __do_softirq().  The
affected PCPU will stay in an infinite loop until Xen is killed by the
watchdog (if enabled).

This is a security problem, XSA-20 / CVE-2012-4535.

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


diff -r 3186c04af582 -r bf58b94b3cef xen/common/domain.c
--- a/xen/common/domain.c	Wed Nov 14 10:24:28 2012 +0000
+++ b/xen/common/domain.c	Wed Nov 14 11:30:34 2012 +0000
@@ -903,6 +903,9 @@ long do_vcpu_op(int cmd, int vcpuid, XEN
         if ( set.period_ns < MILLISECS(1) )
             return -EINVAL;
 
+        if ( set.period_ns > STIME_DELTA_MAX )
+            return -EINVAL;
+
         v->periodic_period = set.period_ns;
         vcpu_force_reschedule(v);
 
diff -r 3186c04af582 -r bf58b94b3cef xen/include/xen/time.h
--- a/xen/include/xen/time.h	Wed Nov 14 10:24:28 2012 +0000
+++ b/xen/include/xen/time.h	Wed Nov 14 11:30:34 2012 +0000
@@ -55,6 +55,8 @@ struct tm gmtime(unsigned long t);
 #define MILLISECS(_ms)  ((s_time_t)((_ms) * 1000000ULL))
 #define MICROSECS(_us)  ((s_time_t)((_us) * 1000ULL))
 #define STIME_MAX ((s_time_t)((uint64_t)~0ull>>1))
+/* Chosen so (NOW() + delta) wont overflow without an uptime of 200 years */
+#define STIME_DELTA_MAX ((s_time_t)((uint64_t)~0ull>>2))
 
 extern void update_vcpu_system_time(struct vcpu *v);
 extern void update_domain_wallclock_time(struct domain *d);

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 02:44:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 02: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 1TYpR8-0004RB-FZ; Thu, 15 Nov 2012 02: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 1TYpR7-0004QW-6i
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:13 +0000
Received: from [85.158.139.211:57202] by server-16.bemta-5.messagelabs.com id
	E3/9A-04786-CF654A05; Thu, 15 Nov 2012 02:44:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-206.messagelabs.com!1352947450!16227941!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24058 invoked from network); 15 Nov 2012 02:44:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Nov 2012 02: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 1TYpR4-0006o5-JY
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYpR4-0002gq-C1
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:10 +0000
Message-Id: <E1TYpR4-0002gq-C1@xenbits.xen.org>
Date: Thu, 15 Nov 2012 02:44:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/physmap: Prevent incorrect
	updates of m2p mappings
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352892962 0
# Node ID 6b6a4007a6091610a29b71cc32908c74113b852b
# Parent  bf58b94b3cef4db8d9ad9c8686bf10910ccc0644
x86/physmap: Prevent incorrect updates of m2p mappings

In certain conditions, such as low memory, set_p2m_entry() can fail.
Currently, the p2m and m2p tables will get out of sync because we still
update the m2p table after the p2m update has failed.

If that happens, subsequent guest-invoked memory operations can cause
BUG()s and ASSERT()s to kill Xen.

This is fixed by only updating the m2p table iff the p2m was
successfully updated.

This is a security problem, XSA-22 / CVE-2012-4537.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
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 bf58b94b3cef -r 6b6a4007a609 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Wed Nov 14 11:30:34 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Wed Nov 14 11:36:02 2012 +0000
@@ -633,7 +633,10 @@ guest_physmap_add_entry(struct domain *d
     if ( mfn_valid(_mfn(mfn)) ) 
     {
         if ( !set_p2m_entry(p2m, gfn, _mfn(mfn), page_order, t, p2m->default_access) )
+        {
             rc = -EINVAL;
+            goto out; /* Failed to update p2m, bail without updating m2p. */
+        }
         if ( !p2m_is_grant(t) )
         {
             for ( i = 0; i < (1UL << page_order); i++ )
@@ -656,6 +659,7 @@ guest_physmap_add_entry(struct domain *d
         }
     }
 
+out:
     p2m_unlock(p2m);
 
     return rc;

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 02:44:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 02: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 1TYpR8-0004RB-FZ; Thu, 15 Nov 2012 02: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 1TYpR7-0004QW-6i
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:13 +0000
Received: from [85.158.139.211:57202] by server-16.bemta-5.messagelabs.com id
	E3/9A-04786-CF654A05; Thu, 15 Nov 2012 02:44:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-206.messagelabs.com!1352947450!16227941!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24058 invoked from network); 15 Nov 2012 02:44:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Nov 2012 02: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 1TYpR4-0006o5-JY
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYpR4-0002gq-C1
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:10 +0000
Message-Id: <E1TYpR4-0002gq-C1@xenbits.xen.org>
Date: Thu, 15 Nov 2012 02:44:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/physmap: Prevent incorrect
	updates of m2p mappings
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352892962 0
# Node ID 6b6a4007a6091610a29b71cc32908c74113b852b
# Parent  bf58b94b3cef4db8d9ad9c8686bf10910ccc0644
x86/physmap: Prevent incorrect updates of m2p mappings

In certain conditions, such as low memory, set_p2m_entry() can fail.
Currently, the p2m and m2p tables will get out of sync because we still
update the m2p table after the p2m update has failed.

If that happens, subsequent guest-invoked memory operations can cause
BUG()s and ASSERT()s to kill Xen.

This is fixed by only updating the m2p table iff the p2m was
successfully updated.

This is a security problem, XSA-22 / CVE-2012-4537.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
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 bf58b94b3cef -r 6b6a4007a609 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Wed Nov 14 11:30:34 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Wed Nov 14 11:36:02 2012 +0000
@@ -633,7 +633,10 @@ guest_physmap_add_entry(struct domain *d
     if ( mfn_valid(_mfn(mfn)) ) 
     {
         if ( !set_p2m_entry(p2m, gfn, _mfn(mfn), page_order, t, p2m->default_access) )
+        {
             rc = -EINVAL;
+            goto out; /* Failed to update p2m, bail without updating m2p. */
+        }
         if ( !p2m_is_grant(t) )
         {
             for ( i = 0; i < (1UL << page_order); i++ )
@@ -656,6 +659,7 @@ guest_physmap_add_entry(struct domain *d
         }
     }
 
+out:
     p2m_unlock(p2m);
 
     return rc;

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 02:44:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 02: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 1TYpR9-0004Rb-N0; Thu, 15 Nov 2012 02:44:15 +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 1TYpR7-0004Qh-Rw
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:13 +0000
Received: from [193.109.254.147:39862] by server-15.bemta-14.messagelabs.com
	id 9D/61-12105-DF654A05; Thu, 15 Nov 2012 02:44:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-27.messagelabs.com!1352947451!4162755!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32500 invoked from network); 15 Nov 2012 02:44:12 -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;
	15 Nov 2012 02: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 1TYpR5-0006oB-Fw
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYpR5-0002hM-EN
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:11 +0000
Message-Id: <E1TYpR5-0002hM-EN@xenbits.xen.org>
Date: Thu, 15 Nov 2012 02:44:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] compat/gnttab: Prevent infinite loop
	in compat code
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893537 0
# Node ID b64a7d868f06c730a444e990da1a4d816ce3f5dc
# Parent  c7a01b6450e483ca839228bf1e1e44de692e3458
compat/gnttab: Prevent infinite loop in compat code

c/s 20281:95ea2052b41b, which introduces Grant Table version 2
hypercalls introduces a vulnerability whereby the compat hypercall
handler can fall into an infinite loop.

If the watchdog is enabled, Xen will die after the timeout.

This is a security problem, XSA-24 / CVE-2012-4539.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r c7a01b6450e4 -r b64a7d868f06 xen/common/compat/grant_table.c
--- a/xen/common/compat/grant_table.c	Wed Nov 14 11:42:21 2012 +0000
+++ b/xen/common/compat/grant_table.c	Wed Nov 14 11:45:37 2012 +0000
@@ -318,6 +318,8 @@ int compat_grant_table_op(unsigned int c
 #undef XLAT_gnttab_get_status_frames_HNDL_frame_list
                 if ( unlikely(__copy_to_guest(cmp_uop, &cmp.get_status, 1)) )
                     rc = -EFAULT;
+                else
+                    i = 1;
             }
             break;
         }

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 02:44:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 02: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 1TYpR7-0004QY-6z; Thu, 15 Nov 2012 02:44:13 +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 1TYpR5-0004QQ-Tu
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:12 +0000
Received: from [85.158.143.99:38977] by server-2.bemta-4.messagelabs.com id
	36/49-28922-BF654A05; Thu, 15 Nov 2012 02:44:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-216.messagelabs.com!1352947449!22455044!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14613 invoked from network); 15 Nov 2012 02:44:10 -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;
	15 Nov 2012 02: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 1TYpR3-0006nw-8A
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYpR2-0002g5-HV
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:08 +0000
Message-Id: <E1TYpR2-0002g5-HV@xenbits.xen.org>
Date: Thu, 15 Nov 2012 02:44:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] hotplug/Linux: Fix locking in
	tools/hotplug/Linux/locking.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: "Change log for Mercurial \(receive only\)"
	<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 Jacek Konieczny <jajcus@jajcus.net>
# Date 1352888668 0
# Node ID 92c52eb4b2703e265c4a7898cf6166b6517848c7
# Parent  8b93ac0c93f3fb8a140b4688ba71841ac927d4e3
hotplug/Linux: Fix locking in tools/hotplug/Linux/locking.sh

The claim_lock() function would fail in the perl code with:

  Invalid argument at -e line 2.

because the Perl snippet opens for reading the file descriptor, which
was earlier opened for write (append).

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


diff -r 8b93ac0c93f3 -r 92c52eb4b270 tools/hotplug/Linux/locking.sh
--- a/tools/hotplug/Linux/locking.sh	Tue Nov 13 11:19:17 2012 +0000
+++ b/tools/hotplug/Linux/locking.sh	Wed Nov 14 10:24:28 2012 +0000
@@ -44,7 +44,7 @@ claim_lock()
     # See below for a correctness proof.
     local rightfile
     while true; do
-        eval "exec $_lockfd>>$_lockfile"
+        eval "exec $_lockfd<>$_lockfile"
         flock -x $_lockfd || return $?
         # We can't just stat /dev/stdin or /proc/self/fd/$_lockfd or
         # use bash's test -ef because those all go through what is

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 02:44:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 02: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 1TYpR9-0004Rb-N0; Thu, 15 Nov 2012 02:44:15 +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 1TYpR7-0004Qh-Rw
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:13 +0000
Received: from [193.109.254.147:39862] by server-15.bemta-14.messagelabs.com
	id 9D/61-12105-DF654A05; Thu, 15 Nov 2012 02:44:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-27.messagelabs.com!1352947451!4162755!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32500 invoked from network); 15 Nov 2012 02:44:12 -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;
	15 Nov 2012 02: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 1TYpR5-0006oB-Fw
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYpR5-0002hM-EN
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:11 +0000
Message-Id: <E1TYpR5-0002hM-EN@xenbits.xen.org>
Date: Thu, 15 Nov 2012 02:44:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] compat/gnttab: Prevent infinite loop
	in compat code
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893537 0
# Node ID b64a7d868f06c730a444e990da1a4d816ce3f5dc
# Parent  c7a01b6450e483ca839228bf1e1e44de692e3458
compat/gnttab: Prevent infinite loop in compat code

c/s 20281:95ea2052b41b, which introduces Grant Table version 2
hypercalls introduces a vulnerability whereby the compat hypercall
handler can fall into an infinite loop.

If the watchdog is enabled, Xen will die after the timeout.

This is a security problem, XSA-24 / CVE-2012-4539.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r c7a01b6450e4 -r b64a7d868f06 xen/common/compat/grant_table.c
--- a/xen/common/compat/grant_table.c	Wed Nov 14 11:42:21 2012 +0000
+++ b/xen/common/compat/grant_table.c	Wed Nov 14 11:45:37 2012 +0000
@@ -318,6 +318,8 @@ int compat_grant_table_op(unsigned int c
 #undef XLAT_gnttab_get_status_frames_HNDL_frame_list
                 if ( unlikely(__copy_to_guest(cmp_uop, &cmp.get_status, 1)) )
                     rc = -EFAULT;
+                else
+                    i = 1;
             }
             break;
         }

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 02:44:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 02: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 1TYpR8-0004R6-Ca; Thu, 15 Nov 2012 02:44:14 +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 1TYpR7-0004QX-9F
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:13 +0000
Received: from [193.109.254.147:30496] by server-16.bemta-14.messagelabs.com
	id D1/44-09215-CF654A05; Thu, 15 Nov 2012 02:44:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1352947449!9421418!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3411 invoked from network); 15 Nov 2012 02:44:11 -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 Nov 2012 02: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 1TYpR3-0006nz-MH
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYpR3-0002gK-6U
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:09 +0000
Message-Id: <E1TYpR3-0002gK-6U@xenbits.xen.org>
Date: Thu, 15 Nov 2012 02:44:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen-tmem-list-parse: fix ugly parse
	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: "Change log for Mercurial \(receive only\)"
	<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 Dan Magenheimer <dan.magenheimer@oracle.com>
# Date 1352888668 0
# Node ID 3186c04af5829a242059ffe4f6427853b7bfc408
# Parent  92c52eb4b2703e265c4a7898cf6166b6517848c7
xen-tmem-list-parse: fix ugly parse output

The program xen-tmem-list-parse parses the output of xm/xl tmem-list
into human-readable format.  A missing NULL terminator sometimes
causes garbage to be spewed where the two-letter pool type
should be output.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 92c52eb4b270 -r 3186c04af582 tools/misc/xen-tmem-list-parse.c
--- a/tools/misc/xen-tmem-list-parse.c	Wed Nov 14 10:24:28 2012 +0000
+++ b/tools/misc/xen-tmem-list-parse.c	Wed Nov 14 10:24:28 2012 +0000
@@ -243,6 +243,7 @@ void parse_pool(char *s)
     unsigned long long flush_objs = parse(s,"ot");
 
     parse_string(s,"PT",pool_type,2);
+    pool_type[2] = '\0';
     if (pool_type[1] == 'S')
         return; /* no need to repeat print data for shared pools */
     printf("domid%lu,id%lu[%s]:pgp=%llu(max=%llu) obj=%llu(%llu) "
@@ -286,6 +287,7 @@ void parse_shared_pool(char *s)
     unsigned long long flush_objs = parse(s,"ot");
 
     parse_string(s,"PT",pool_type,2);
+    pool_type[2] = '\0';
     parse_sharers(s,"SC",buf,BUFSIZE);
     printf("poolid=%lu[%s] uuid=%llx.%llx, shared-by:%s: "
            "pgp=%llu(max=%llu) obj=%llu(%llu) "

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 02:44:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 02: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 1TYpR7-0004QY-6z; Thu, 15 Nov 2012 02:44:13 +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 1TYpR5-0004QQ-Tu
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:12 +0000
Received: from [85.158.143.99:38977] by server-2.bemta-4.messagelabs.com id
	36/49-28922-BF654A05; Thu, 15 Nov 2012 02:44:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-216.messagelabs.com!1352947449!22455044!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14613 invoked from network); 15 Nov 2012 02:44:10 -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;
	15 Nov 2012 02: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 1TYpR3-0006nw-8A
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYpR2-0002g5-HV
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:08 +0000
Message-Id: <E1TYpR2-0002g5-HV@xenbits.xen.org>
Date: Thu, 15 Nov 2012 02:44:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] hotplug/Linux: Fix locking in
	tools/hotplug/Linux/locking.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: "Change log for Mercurial \(receive only\)"
	<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 Jacek Konieczny <jajcus@jajcus.net>
# Date 1352888668 0
# Node ID 92c52eb4b2703e265c4a7898cf6166b6517848c7
# Parent  8b93ac0c93f3fb8a140b4688ba71841ac927d4e3
hotplug/Linux: Fix locking in tools/hotplug/Linux/locking.sh

The claim_lock() function would fail in the perl code with:

  Invalid argument at -e line 2.

because the Perl snippet opens for reading the file descriptor, which
was earlier opened for write (append).

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


diff -r 8b93ac0c93f3 -r 92c52eb4b270 tools/hotplug/Linux/locking.sh
--- a/tools/hotplug/Linux/locking.sh	Tue Nov 13 11:19:17 2012 +0000
+++ b/tools/hotplug/Linux/locking.sh	Wed Nov 14 10:24:28 2012 +0000
@@ -44,7 +44,7 @@ claim_lock()
     # See below for a correctness proof.
     local rightfile
     while true; do
-        eval "exec $_lockfd>>$_lockfile"
+        eval "exec $_lockfd<>$_lockfile"
         flock -x $_lockfd || return $?
         # We can't just stat /dev/stdin or /proc/self/fd/$_lockfd or
         # use bash's test -ef because those all go through what is

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 02:44:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 02: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 1TYpR8-0004R6-Ca; Thu, 15 Nov 2012 02:44:14 +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 1TYpR7-0004QX-9F
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:13 +0000
Received: from [193.109.254.147:30496] by server-16.bemta-14.messagelabs.com
	id D1/44-09215-CF654A05; Thu, 15 Nov 2012 02:44:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1352947449!9421418!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3411 invoked from network); 15 Nov 2012 02:44:11 -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 Nov 2012 02: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 1TYpR3-0006nz-MH
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYpR3-0002gK-6U
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:09 +0000
Message-Id: <E1TYpR3-0002gK-6U@xenbits.xen.org>
Date: Thu, 15 Nov 2012 02:44:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen-tmem-list-parse: fix ugly parse
	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: "Change log for Mercurial \(receive only\)"
	<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 Dan Magenheimer <dan.magenheimer@oracle.com>
# Date 1352888668 0
# Node ID 3186c04af5829a242059ffe4f6427853b7bfc408
# Parent  92c52eb4b2703e265c4a7898cf6166b6517848c7
xen-tmem-list-parse: fix ugly parse output

The program xen-tmem-list-parse parses the output of xm/xl tmem-list
into human-readable format.  A missing NULL terminator sometimes
causes garbage to be spewed where the two-letter pool type
should be output.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 92c52eb4b270 -r 3186c04af582 tools/misc/xen-tmem-list-parse.c
--- a/tools/misc/xen-tmem-list-parse.c	Wed Nov 14 10:24:28 2012 +0000
+++ b/tools/misc/xen-tmem-list-parse.c	Wed Nov 14 10:24:28 2012 +0000
@@ -243,6 +243,7 @@ void parse_pool(char *s)
     unsigned long long flush_objs = parse(s,"ot");
 
     parse_string(s,"PT",pool_type,2);
+    pool_type[2] = '\0';
     if (pool_type[1] == 'S')
         return; /* no need to repeat print data for shared pools */
     printf("domid%lu,id%lu[%s]:pgp=%llu(max=%llu) obj=%llu(%llu) "
@@ -286,6 +287,7 @@ void parse_shared_pool(char *s)
     unsigned long long flush_objs = parse(s,"ot");
 
     parse_string(s,"PT",pool_type,2);
+    pool_type[2] = '\0';
     parse_sharers(s,"SC",buf,BUFSIZE);
     printf("poolid=%lu[%s] uuid=%llx.%llx, shared-by:%s: "
            "pgp=%llu(max=%llu) obj=%llu(%llu) "

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 02:44:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 02: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 1TYpR9-0004Rg-Pc; Thu, 15 Nov 2012 02:44:15 +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 1TYpR8-0004R0-Um
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:15 +0000
Received: from [85.158.137.99:16098] by server-3.bemta-3.messagelabs.com id
	AC/98-31566-EF654A05; Thu, 15 Nov 2012 02:44:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-217.messagelabs.com!1352947452!18278273!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2991 invoked from network); 15 Nov 2012 02:44:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Nov 2012 02: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 1TYpR6-0006oE-3S
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYpR5-0002hb-Uv
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:11 +0000
Message-Id: <E1TYpR5-0002hb-Uv@xenbits.xen.org>
Date: Thu, 15 Nov 2012 02:44:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: rerun autoconf after
	26144:170d45f7a2eb
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352910478 0
# Node ID d1d05cb59a76f5206aa2404e08801f227ac38cea
# Parent  b64a7d868f06c730a444e990da1a4d816ce3f5dc
tools: rerun autoconf after 26144:170d45f7a2eb

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


diff -r b64a7d868f06 -r d1d05cb59a76 tools/configure
--- a/tools/configure	Wed Nov 14 11:45:37 2012 +0000
+++ b/tools/configure	Wed Nov 14 16:27:58 2012 +0000
@@ -668,7 +668,6 @@ lomount
 miniterm
 ocamltools
 xenapi
-vtpm
 monitors
 githttp
 host_os
@@ -722,7 +721,6 @@ ac_user_opts='
 enable_option_checking
 enable_githttp
 enable_monitors
-enable_vtpm
 enable_xenapi
 enable_ocamltools
 enable_miniterm
@@ -1381,8 +1379,6 @@ Optional Features:
                           DISABLED)
   --disable-monitors      Disable xenstat and xentop monitoring tools (default
                           is ENABLED)
-  --enable-vtpm           Enable Virtual Trusted Platform Module (default is
-                          DISABLED)
   --enable-xenapi         Enable Xen API Bindings (default is DISABLED)
   --disable-ocamltools    Disable Ocaml tools (default is ENABLED)
   --enable-miniterm       Enable miniterm (default is DISABLED)
@@ -2445,29 +2441,6 @@ 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" = "xno"; then :
-
-    ax_cv_vtpm="n"
-
-elif test "x$enable_vtpm" = "xyes"; then :
-
-    ax_cv_vtpm="y"
-
-elif test -z $ax_cv_vtpm; then :
-
-    ax_cv_vtpm="n"
-
-fi
-vtpm=$ax_cv_vtpm
-
-
-
 # Check whether --enable-xenapi was given.
 if test "${enable_xenapi+set}" = set; then :
   enableval=$enable_xenapi;

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 02:44:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 02: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 1TYpR9-0004Rg-Pc; Thu, 15 Nov 2012 02:44:15 +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 1TYpR8-0004R0-Um
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:15 +0000
Received: from [85.158.137.99:16098] by server-3.bemta-3.messagelabs.com id
	AC/98-31566-EF654A05; Thu, 15 Nov 2012 02:44:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-217.messagelabs.com!1352947452!18278273!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2991 invoked from network); 15 Nov 2012 02:44:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Nov 2012 02: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 1TYpR6-0006oE-3S
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYpR5-0002hb-Uv
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:11 +0000
Message-Id: <E1TYpR5-0002hb-Uv@xenbits.xen.org>
Date: Thu, 15 Nov 2012 02:44:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: rerun autoconf after
	26144:170d45f7a2eb
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352910478 0
# Node ID d1d05cb59a76f5206aa2404e08801f227ac38cea
# Parent  b64a7d868f06c730a444e990da1a4d816ce3f5dc
tools: rerun autoconf after 26144:170d45f7a2eb

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


diff -r b64a7d868f06 -r d1d05cb59a76 tools/configure
--- a/tools/configure	Wed Nov 14 11:45:37 2012 +0000
+++ b/tools/configure	Wed Nov 14 16:27:58 2012 +0000
@@ -668,7 +668,6 @@ lomount
 miniterm
 ocamltools
 xenapi
-vtpm
 monitors
 githttp
 host_os
@@ -722,7 +721,6 @@ ac_user_opts='
 enable_option_checking
 enable_githttp
 enable_monitors
-enable_vtpm
 enable_xenapi
 enable_ocamltools
 enable_miniterm
@@ -1381,8 +1379,6 @@ Optional Features:
                           DISABLED)
   --disable-monitors      Disable xenstat and xentop monitoring tools (default
                           is ENABLED)
-  --enable-vtpm           Enable Virtual Trusted Platform Module (default is
-                          DISABLED)
   --enable-xenapi         Enable Xen API Bindings (default is DISABLED)
   --disable-ocamltools    Disable Ocaml tools (default is ENABLED)
   --enable-miniterm       Enable miniterm (default is DISABLED)
@@ -2445,29 +2441,6 @@ 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" = "xno"; then :
-
-    ax_cv_vtpm="n"
-
-elif test "x$enable_vtpm" = "xyes"; then :
-
-    ax_cv_vtpm="y"
-
-elif test -z $ax_cv_vtpm; then :
-
-    ax_cv_vtpm="n"
-
-fi
-vtpm=$ax_cv_vtpm
-
-
-
 # Check whether --enable-xenapi was given.
 if test "${enable_xenapi+set}" = set; then :
   enableval=$enable_xenapi;

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 02:44:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 02: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 1TYpR9-0004RW-K5; Thu, 15 Nov 2012 02:44:15 +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 1TYpR7-0004QV-JO
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:13 +0000
Received: from [85.158.138.51:35902] by server-12.bemta-3.messagelabs.com id
	16/A8-22757-DF654A05; Thu, 15 Nov 2012 02:44:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1352947451!21988208!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15985 invoked from network); 15 Nov 2012 02:44:12 -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;
	15 Nov 2012 02: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 1TYpR5-0006o8-2i
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYpR4-0002h5-T5
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:10 +0000
Message-Id: <E1TYpR4-0002h5-T5@xenbits.xen.org>
Date: Thu, 15 Nov 2012 02:44:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen/mm/shadow: check toplevel
	pagetables are present before unhooking them.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893341 0
# Node ID c7a01b6450e483ca839228bf1e1e44de692e3458
# Parent  6b6a4007a6091610a29b71cc32908c74113b852b
xen/mm/shadow: check toplevel pagetables are present before unhooking them.

If the guest has not fully populated its top-level PAE entries when it calls
HVMOP_pagetable_dying, the shadow code could try to unhook entries from
MFN 0.  Add a check to avoid that case.

This issue was introduced by c/s 21239:b9d2db109cf5.

This is a security problem, XSA-23 / CVE-2012-4538.

Signed-off-by: Tim Deegan <tim@xen.org>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 6b6a4007a609 -r c7a01b6450e4 xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 11:36:02 2012 +0000
+++ b/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 11:42:21 2012 +0000
@@ -4478,8 +4478,12 @@ static void sh_pagetable_dying(struct vc
         unsigned long gfn;
         mfn_t smfn, gmfn;
 
-        if ( fast_path )
-            smfn = _mfn(pagetable_get_pfn(v->arch.shadow_table[i]));
+        if ( fast_path ) {
+            if ( pagetable_is_null(v->arch.shadow_table[i]) )
+                smfn = _mfn(INVALID_MFN);
+            else
+                smfn = _mfn(pagetable_get_pfn(v->arch.shadow_table[i]));
+        }
         else
         {
             /* retrieving the l2s */

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 02:44:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 02: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 1TYpR9-0004RW-K5; Thu, 15 Nov 2012 02:44:15 +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 1TYpR7-0004QV-JO
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:13 +0000
Received: from [85.158.138.51:35902] by server-12.bemta-3.messagelabs.com id
	16/A8-22757-DF654A05; Thu, 15 Nov 2012 02:44:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1352947451!21988208!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15985 invoked from network); 15 Nov 2012 02:44:12 -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;
	15 Nov 2012 02: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 1TYpR5-0006o8-2i
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYpR4-0002h5-T5
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 02:44:10 +0000
Message-Id: <E1TYpR4-0002h5-T5@xenbits.xen.org>
Date: Thu, 15 Nov 2012 02:44:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen/mm/shadow: check toplevel
	pagetables are present before unhooking them.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893341 0
# Node ID c7a01b6450e483ca839228bf1e1e44de692e3458
# Parent  6b6a4007a6091610a29b71cc32908c74113b852b
xen/mm/shadow: check toplevel pagetables are present before unhooking them.

If the guest has not fully populated its top-level PAE entries when it calls
HVMOP_pagetable_dying, the shadow code could try to unhook entries from
MFN 0.  Add a check to avoid that case.

This issue was introduced by c/s 21239:b9d2db109cf5.

This is a security problem, XSA-23 / CVE-2012-4538.

Signed-off-by: Tim Deegan <tim@xen.org>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 6b6a4007a609 -r c7a01b6450e4 xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 11:36:02 2012 +0000
+++ b/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 11:42:21 2012 +0000
@@ -4478,8 +4478,12 @@ static void sh_pagetable_dying(struct vc
         unsigned long gfn;
         mfn_t smfn, gmfn;
 
-        if ( fast_path )
-            smfn = _mfn(pagetable_get_pfn(v->arch.shadow_table[i]));
+        if ( fast_path ) {
+            if ( pagetable_is_null(v->arch.shadow_table[i]) )
+                smfn = _mfn(INVALID_MFN);
+            else
+                smfn = _mfn(pagetable_get_pfn(v->arch.shadow_table[i]));
+        }
         else
         {
             /* retrieving the l2s */

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 08:00:26 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 08:00: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 1TYuN3-0002ZH-VM; Thu, 15 Nov 2012 08:00:21 +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 1TYuN2-0002Z3-9A
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:00:20 +0000
Received: from [193.109.254.147:12379] by server-9.bemta-14.messagelabs.com id
	B3/60-30773-311A4A05; Thu, 15 Nov 2012 08:00:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1352966417!4074802!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20077 invoked from network); 15 Nov 2012 08:00:18 -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;
	15 Nov 2012 08:00: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 1TYuMz-0002Mv-4b
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:00:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYuMy-0002bO-OS
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:00:16 +0000
Message-Id: <E1TYuMy-0002bO-OS@xenbits.xen.org>
Date: Thu, 15 Nov 2012 08:00:16 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] x86/physmap: Prevent incorrect
	updates of m2p mappings
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893251 0
# Node ID 04462a8c79661c3cb939756fb03345901e703493
# Parent  6b9809dc1e860b73d644d7b89435df14f0723657
x86/physmap: Prevent incorrect updates of m2p mappings

In certain conditions, such as low memory, set_p2m_entry() can fail.
Currently, the p2m and m2p tables will get out of sync because we still
update the m2p table after the p2m update has failed.

If that happens, subsequent guest-invoked memory operations can cause
BUG()s and ASSERT()s to kill Xen.

This is fixed by only updating the m2p table iff the p2m was
successfully updated.

This is a security problem, XSA-22 / CVE-2012-4537.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
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 6b9809dc1e86 -r 04462a8c7966 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Wed Nov 14 11:37:55 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Wed Nov 14 11:40:51 2012 +0000
@@ -2207,7 +2207,10 @@ guest_physmap_add_entry(struct domain *d
     if ( mfn_valid(_mfn(mfn)) ) 
     {
         if ( !set_p2m_entry(d, gfn, _mfn(mfn), page_order, t) )
+        {
             rc = -EINVAL;
+            goto out; /* Failed to update p2m, bail without updating m2p. */
+        }
         if ( !p2m_is_grant(t) )
         {
             for ( i = 0; i < (1UL << page_order); i++ )
@@ -2228,6 +2231,7 @@ guest_physmap_add_entry(struct domain *d
         }
     }
 
+out:
     audit_p2m(d);
     p2m_unlock(d->arch.p2m);
 

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 08:00:26 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 08:00: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 1TYuN3-0002ZH-VM; Thu, 15 Nov 2012 08:00:21 +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 1TYuN2-0002Z3-9A
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:00:20 +0000
Received: from [193.109.254.147:12379] by server-9.bemta-14.messagelabs.com id
	B3/60-30773-311A4A05; Thu, 15 Nov 2012 08:00:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1352966417!4074802!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20077 invoked from network); 15 Nov 2012 08:00:18 -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;
	15 Nov 2012 08:00: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 1TYuMz-0002Mv-4b
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:00:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYuMy-0002bO-OS
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:00:16 +0000
Message-Id: <E1TYuMy-0002bO-OS@xenbits.xen.org>
Date: Thu, 15 Nov 2012 08:00:16 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] x86/physmap: Prevent incorrect
	updates of m2p mappings
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893251 0
# Node ID 04462a8c79661c3cb939756fb03345901e703493
# Parent  6b9809dc1e860b73d644d7b89435df14f0723657
x86/physmap: Prevent incorrect updates of m2p mappings

In certain conditions, such as low memory, set_p2m_entry() can fail.
Currently, the p2m and m2p tables will get out of sync because we still
update the m2p table after the p2m update has failed.

If that happens, subsequent guest-invoked memory operations can cause
BUG()s and ASSERT()s to kill Xen.

This is fixed by only updating the m2p table iff the p2m was
successfully updated.

This is a security problem, XSA-22 / CVE-2012-4537.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
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 6b9809dc1e86 -r 04462a8c7966 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Wed Nov 14 11:37:55 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c	Wed Nov 14 11:40:51 2012 +0000
@@ -2207,7 +2207,10 @@ guest_physmap_add_entry(struct domain *d
     if ( mfn_valid(_mfn(mfn)) ) 
     {
         if ( !set_p2m_entry(d, gfn, _mfn(mfn), page_order, t) )
+        {
             rc = -EINVAL;
+            goto out; /* Failed to update p2m, bail without updating m2p. */
+        }
         if ( !p2m_is_grant(t) )
         {
             for ( i = 0; i < (1UL << page_order); i++ )
@@ -2228,6 +2231,7 @@ guest_physmap_add_entry(struct domain *d
         }
     }
 
+out:
     audit_p2m(d);
     p2m_unlock(d->arch.p2m);
 

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 08:00:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 08: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.xen.org>)
	id 1TYuN4-0002ZM-38; Thu, 15 Nov 2012 08:00: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 1TYuN2-0002Z5-Uw
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:00:21 +0000
Received: from [85.158.139.211:11497] by server-5.bemta-5.messagelabs.com id
	E6/6C-11353-411A4A05; Thu, 15 Nov 2012 08:00:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-206.messagelabs.com!1352966418!20262782!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6684 invoked from network); 15 Nov 2012 08:00:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Nov 2012 08: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 1TYuN0-0002N1-6r
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:00:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYuMz-0002bx-UC
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:00:17 +0000
Message-Id: <E1TYuMz-0002bx-UC@xenbits.xen.org>
Date: Thu, 15 Nov 2012 08:00:17 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] compat/gnttab: Prevent infinite
	loop in compat code
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893595 0
# Node ID 68d7b9cc8259799d3c0d4075157578d5c704f72c
# Parent  c52d74b254dc38a0aeb1516bf1170158069e9442
compat/gnttab: Prevent infinite loop in compat code

c/s 20281:95ea2052b41b, which introduces Grant Table version 2
hypercalls introduces a vulnerability whereby the compat hypercall
handler can fall into an infinite loop.

If the watchdog is enabled, Xen will die after the timeout.

This is a security problem, XSA-24 / CVE-2012-4539.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-unstable changeset: 26151:b64a7d868f06
Backport-requested-by: security@xen.org
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r c52d74b254dc -r 68d7b9cc8259 xen/common/compat/grant_table.c
--- a/xen/common/compat/grant_table.c	Wed Nov 14 11:44:46 2012 +0000
+++ b/xen/common/compat/grant_table.c	Wed Nov 14 11:46:35 2012 +0000
@@ -310,6 +310,8 @@ int compat_grant_table_op(unsigned int c
 #undef XLAT_gnttab_get_status_frames_HNDL_frame_list
                 if ( unlikely(__copy_to_guest(cmp_uop, &cmp.get_status, 1)) )
                     rc = -EFAULT;
+                else
+                    i = 1;
             }
             break;
         }

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 08:00:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 08: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.xen.org>)
	id 1TYuN4-0002ZM-38; Thu, 15 Nov 2012 08:00: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 1TYuN2-0002Z5-Uw
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:00:21 +0000
Received: from [85.158.139.211:11497] by server-5.bemta-5.messagelabs.com id
	E6/6C-11353-411A4A05; Thu, 15 Nov 2012 08:00:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-206.messagelabs.com!1352966418!20262782!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6684 invoked from network); 15 Nov 2012 08:00:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Nov 2012 08: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 1TYuN0-0002N1-6r
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:00:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYuMz-0002bx-UC
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:00:17 +0000
Message-Id: <E1TYuMz-0002bx-UC@xenbits.xen.org>
Date: Thu, 15 Nov 2012 08:00:17 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] compat/gnttab: Prevent infinite
	loop in compat code
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893595 0
# Node ID 68d7b9cc8259799d3c0d4075157578d5c704f72c
# Parent  c52d74b254dc38a0aeb1516bf1170158069e9442
compat/gnttab: Prevent infinite loop in compat code

c/s 20281:95ea2052b41b, which introduces Grant Table version 2
hypercalls introduces a vulnerability whereby the compat hypercall
handler can fall into an infinite loop.

If the watchdog is enabled, Xen will die after the timeout.

This is a security problem, XSA-24 / CVE-2012-4539.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-unstable changeset: 26151:b64a7d868f06
Backport-requested-by: security@xen.org
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r c52d74b254dc -r 68d7b9cc8259 xen/common/compat/grant_table.c
--- a/xen/common/compat/grant_table.c	Wed Nov 14 11:44:46 2012 +0000
+++ b/xen/common/compat/grant_table.c	Wed Nov 14 11:46:35 2012 +0000
@@ -310,6 +310,8 @@ int compat_grant_table_op(unsigned int c
 #undef XLAT_gnttab_get_status_frames_HNDL_frame_list
                 if ( unlikely(__copy_to_guest(cmp_uop, &cmp.get_status, 1)) )
                     rc = -EFAULT;
+                else
+                    i = 1;
             }
             break;
         }

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 08:00:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 08: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.xen.org>)
	id 1TYuN6-0002cJ-8K; Thu, 15 Nov 2012 08:00: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 1TYuN5-0002ZS-1X
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:00:23 +0000
Received: from [85.158.143.35:53167] by server-3.bemta-4.messagelabs.com id
	0B/C0-06841-611A4A05; Thu, 15 Nov 2012 08:00:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1352966417!15318734!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24122 invoked from network); 15 Nov 2012 08:00:19 -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 Nov 2012 08: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 1TYuMz-0002My-LO
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:00:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYuMz-0002bg-Dm
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:00:17 +0000
Message-Id: <E1TYuMz-0002bg-Dm@xenbits.xen.org>
Date: Thu, 15 Nov 2012 08:00:16 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] xen/mm/shadow: check toplevel
	pagetables are present before unhooking them.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893486 0
# Node ID c52d74b254dc38a0aeb1516bf1170158069e9442
# Parent  04462a8c79661c3cb939756fb03345901e703493
xen/mm/shadow: check toplevel pagetables are present before unhooking them.

If the guest has not fully populated its top-level PAE entries when it calls
HVMOP_pagetable_dying, the shadow code could try to unhook entries from
MFN 0.  Add a check to avoid that case.

This issue was introduced by c/s 21239:b9d2db109cf5.

This is a security problem, XSA-23 / CVE-2012-4538.

Signed-off-by: Tim Deegan <tim@xen.org>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-4.1-testing changeset: 23409:61eb3d030f52
Backport-requested-by: security@xen.org
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 04462a8c7966 -r c52d74b254dc xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 11:40:51 2012 +0000
+++ b/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 11:44:46 2012 +0000
@@ -4698,8 +4698,12 @@ static void sh_pagetable_dying(struct vc
     }
     for ( i = 0; i < 4; i++ )
     {
-        if ( fast_path )
-            smfn = _mfn(pagetable_get_pfn(v->arch.shadow_table[i]));
+        if ( fast_path ) {
+            if ( pagetable_is_null(v->arch.shadow_table[i]) )
+                smfn = _mfn(INVALID_MFN);
+            else
+                smfn = _mfn(pagetable_get_pfn(v->arch.shadow_table[i]));
+        }
         else
         {
             /* retrieving the l2s */

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 08:00:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 08: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.xen.org>)
	id 1TYuN6-0002cJ-8K; Thu, 15 Nov 2012 08:00: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 1TYuN5-0002ZS-1X
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:00:23 +0000
Received: from [85.158.143.35:53167] by server-3.bemta-4.messagelabs.com id
	0B/C0-06841-611A4A05; Thu, 15 Nov 2012 08:00:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1352966417!15318734!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24122 invoked from network); 15 Nov 2012 08:00:19 -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 Nov 2012 08: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 1TYuMz-0002My-LO
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:00:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYuMz-0002bg-Dm
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:00:17 +0000
Message-Id: <E1TYuMz-0002bg-Dm@xenbits.xen.org>
Date: Thu, 15 Nov 2012 08:00:16 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] xen/mm/shadow: check toplevel
	pagetables are present before unhooking them.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893486 0
# Node ID c52d74b254dc38a0aeb1516bf1170158069e9442
# Parent  04462a8c79661c3cb939756fb03345901e703493
xen/mm/shadow: check toplevel pagetables are present before unhooking them.

If the guest has not fully populated its top-level PAE entries when it calls
HVMOP_pagetable_dying, the shadow code could try to unhook entries from
MFN 0.  Add a check to avoid that case.

This issue was introduced by c/s 21239:b9d2db109cf5.

This is a security problem, XSA-23 / CVE-2012-4538.

Signed-off-by: Tim Deegan <tim@xen.org>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-4.1-testing changeset: 23409:61eb3d030f52
Backport-requested-by: security@xen.org
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 04462a8c7966 -r c52d74b254dc xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 11:40:51 2012 +0000
+++ b/xen/arch/x86/mm/shadow/multi.c	Wed Nov 14 11:44:46 2012 +0000
@@ -4698,8 +4698,12 @@ static void sh_pagetable_dying(struct vc
     }
     for ( i = 0; i < 4; i++ )
     {
-        if ( fast_path )
-            smfn = _mfn(pagetable_get_pfn(v->arch.shadow_table[i]));
+        if ( fast_path ) {
+            if ( pagetable_is_null(v->arch.shadow_table[i]) )
+                smfn = _mfn(INVALID_MFN);
+            else
+                smfn = _mfn(pagetable_get_pfn(v->arch.shadow_table[i]));
+        }
         else
         {
             /* retrieving the l2s */

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 08:01:15 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 08:01: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.xen.org>)
	id 1TYuNs-0002re-Di; Thu, 15 Nov 2012 08:01: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 1TYuNr-0002qz-0c
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:01:11 +0000
Received: from [85.158.143.35:44715] by server-3.bemta-4.messagelabs.com id
	77/D1-06841-641A4A05; Thu, 15 Nov 2012 08:01:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-21.messagelabs.com!1352966416!14083472!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3732 invoked from network); 15 Nov 2012 08:00:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Nov 2012 08:00: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 1TYuMy-0002Ms-FU
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:00:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYuMt-0002ah-HI
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:00:15 +0000
Message-Id: <E1TYuMt-0002ah-HI@xenbits.xen.org>
Date: Thu, 15 Nov 2012 08:00:10 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] VCPU/timers: Prevent overflow in
	calculations, leading to DoS vulnerability
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893075 0
# Node ID 6b9809dc1e860b73d644d7b89435df14f0723657
# Parent  1d1538beeadadebc0665bae56cfce6d58c51dc09
VCPU/timers: Prevent overflow in calculations, leading to DoS vulnerability

The timer action for a vcpu periodic timer is to calculate the next
expiry time, and to reinsert itself into the timer queue.  If the
deadline ends up in the past, Xen never leaves __do_softirq().  The
affected PCPU will stay in an infinite loop until Xen is killed by the
watchdog (if enabled).

This is a security problem, XSA-20 / CVE-2012-4535.

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

xen-unstable changeset: 26148:bf58b94b3cef
Backport-requested-by: security@xen.org
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 1d1538beeada -r 6b9809dc1e86 xen/common/domain.c
--- a/xen/common/domain.c	Wed Sep 12 11:18:03 2012 +0100
+++ b/xen/common/domain.c	Wed Nov 14 11:37:55 2012 +0000
@@ -823,6 +823,9 @@ long do_vcpu_op(int cmd, int vcpuid, XEN
         if ( set.period_ns < MILLISECS(1) )
             return -EINVAL;
 
+        if ( set.period_ns > STIME_DELTA_MAX )
+            return -EINVAL;
+
         v->periodic_period = set.period_ns;
         vcpu_force_reschedule(v);
 
diff -r 1d1538beeada -r 6b9809dc1e86 xen/include/xen/time.h
--- a/xen/include/xen/time.h	Wed Sep 12 11:18:03 2012 +0100
+++ b/xen/include/xen/time.h	Wed Nov 14 11:37:55 2012 +0000
@@ -52,6 +52,8 @@ struct tm gmtime(unsigned long t);
 #define MILLISECS(_ms)  ((s_time_t)((_ms) * 1000000ULL))
 #define MICROSECS(_us)  ((s_time_t)((_us) * 1000ULL))
 #define STIME_MAX ((s_time_t)((uint64_t)~0ull>>1))
+/* Chosen so (NOW() + delta) wont overflow without an uptime of 200 years */
+#define STIME_DELTA_MAX ((s_time_t)((uint64_t)~0ull>>2))
 
 extern void update_vcpu_system_time(struct vcpu *v);
 extern void update_domain_wallclock_time(struct domain *d);

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 08:01:15 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 08:01: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.xen.org>)
	id 1TYuNs-0002re-Di; Thu, 15 Nov 2012 08:01: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 1TYuNr-0002qz-0c
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:01:11 +0000
Received: from [85.158.143.35:44715] by server-3.bemta-4.messagelabs.com id
	77/D1-06841-641A4A05; Thu, 15 Nov 2012 08:01:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-21.messagelabs.com!1352966416!14083472!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3732 invoked from network); 15 Nov 2012 08:00:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Nov 2012 08:00: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 1TYuMy-0002Ms-FU
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:00:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TYuMt-0002ah-HI
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 08:00:15 +0000
Message-Id: <E1TYuMt-0002ah-HI@xenbits.xen.org>
Date: Thu, 15 Nov 2012 08:00:10 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] VCPU/timers: Prevent overflow in
	calculations, leading to DoS vulnerability
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352893075 0
# Node ID 6b9809dc1e860b73d644d7b89435df14f0723657
# Parent  1d1538beeadadebc0665bae56cfce6d58c51dc09
VCPU/timers: Prevent overflow in calculations, leading to DoS vulnerability

The timer action for a vcpu periodic timer is to calculate the next
expiry time, and to reinsert itself into the timer queue.  If the
deadline ends up in the past, Xen never leaves __do_softirq().  The
affected PCPU will stay in an infinite loop until Xen is killed by the
watchdog (if enabled).

This is a security problem, XSA-20 / CVE-2012-4535.

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

xen-unstable changeset: 26148:bf58b94b3cef
Backport-requested-by: security@xen.org
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 1d1538beeada -r 6b9809dc1e86 xen/common/domain.c
--- a/xen/common/domain.c	Wed Sep 12 11:18:03 2012 +0100
+++ b/xen/common/domain.c	Wed Nov 14 11:37:55 2012 +0000
@@ -823,6 +823,9 @@ long do_vcpu_op(int cmd, int vcpuid, XEN
         if ( set.period_ns < MILLISECS(1) )
             return -EINVAL;
 
+        if ( set.period_ns > STIME_DELTA_MAX )
+            return -EINVAL;
+
         v->periodic_period = set.period_ns;
         vcpu_force_reschedule(v);
 
diff -r 1d1538beeada -r 6b9809dc1e86 xen/include/xen/time.h
--- a/xen/include/xen/time.h	Wed Sep 12 11:18:03 2012 +0100
+++ b/xen/include/xen/time.h	Wed Nov 14 11:37:55 2012 +0000
@@ -52,6 +52,8 @@ struct tm gmtime(unsigned long t);
 #define MILLISECS(_ms)  ((s_time_t)((_ms) * 1000000ULL))
 #define MICROSECS(_us)  ((s_time_t)((_us) * 1000ULL))
 #define STIME_MAX ((s_time_t)((uint64_t)~0ull>>1))
+/* Chosen so (NOW() + delta) wont overflow without an uptime of 200 years */
+#define STIME_DELTA_MAX ((s_time_t)((uint64_t)~0ull>>2))
 
 extern void update_vcpu_system_time(struct vcpu *v);
 extern void update_domain_wallclock_time(struct domain *d);

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 17:44:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 17: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 1TZ3U8-0000l0-IJ; Thu, 15 Nov 2012 17:44:16 +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 1TZ3U7-0000kk-LP
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 17:44:15 +0000
Received: from [85.158.137.99:24602] by server-10.bemta-3.messagelabs.com id
	6C/0F-19806-DE925A05; Thu, 15 Nov 2012 17:44:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-217.messagelabs.com!1353001451!12435518!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20155 invoked from network); 15 Nov 2012 17:44:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Nov 2012 17: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 1TZ3U3-000121-CF
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 17:44:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZ3U3-0000ky-0A
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 17:44:11 +0000
Message-Id: <E1TZ3U3-0000ky-0A@xenbits.xen.org>
Date: Thu, 15 Nov 2012 17: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] Added tag 4.1.4-rc1 for changeset
	500194a883bd
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352969909 -3600
# Node ID 254aeb18f817224160b607d2830bad4f68813708
# Parent  500194a883bdcf77b2a0fc87de291b0c27435207
Added tag 4.1.4-rc1 for changeset 500194a883bd
---


diff -r 500194a883bd -r 254aeb18f817 .hgtags
--- a/.hgtags	Thu Nov 15 09:57:44 2012 +0100
+++ b/.hgtags	Thu Nov 15 09:58:29 2012 +0100
@@ -66,3 +66,4 @@ da64f68730cf1c42c06919578e70d8bc01041051
 acbd3617691397911f34e4574d03385c08aec900 4.1.3-rc2
 5cdcfed7b5b129843e1602b5d43c7651de337092 4.1.3-rc3
 ce7195d2b80e4df9857e434fa29689fd678a2341 RELEASE-4.1.3
+500194a883bdcf77b2a0fc87de291b0c27435207 4.1.4-rc1

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 17:44:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 17: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 1TZ3U8-0000l0-IJ; Thu, 15 Nov 2012 17:44:16 +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 1TZ3U7-0000kk-LP
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 17:44:15 +0000
Received: from [85.158.137.99:24602] by server-10.bemta-3.messagelabs.com id
	6C/0F-19806-DE925A05; Thu, 15 Nov 2012 17:44:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-217.messagelabs.com!1353001451!12435518!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20155 invoked from network); 15 Nov 2012 17:44:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Nov 2012 17: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 1TZ3U3-000121-CF
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 17:44:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZ3U3-0000ky-0A
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 17:44:11 +0000
Message-Id: <E1TZ3U3-0000ky-0A@xenbits.xen.org>
Date: Thu, 15 Nov 2012 17: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] Added tag 4.1.4-rc1 for changeset
	500194a883bd
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352969909 -3600
# Node ID 254aeb18f817224160b607d2830bad4f68813708
# Parent  500194a883bdcf77b2a0fc87de291b0c27435207
Added tag 4.1.4-rc1 for changeset 500194a883bd
---


diff -r 500194a883bd -r 254aeb18f817 .hgtags
--- a/.hgtags	Thu Nov 15 09:57:44 2012 +0100
+++ b/.hgtags	Thu Nov 15 09:58:29 2012 +0100
@@ -66,3 +66,4 @@ da64f68730cf1c42c06919578e70d8bc01041051
 acbd3617691397911f34e4574d03385c08aec900 4.1.3-rc2
 5cdcfed7b5b129843e1602b5d43c7651de337092 4.1.3-rc3
 ce7195d2b80e4df9857e434fa29689fd678a2341 RELEASE-4.1.3
+500194a883bdcf77b2a0fc87de291b0c27435207 4.1.4-rc1

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 17:44:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 17: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 1TZ3U9-0000lD-N0; Thu, 15 Nov 2012 17:44:17 +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 1TZ3U8-0000kq-AP
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 17:44:16 +0000
Received: from [85.158.143.35:55511] by server-1.bemta-4.messagelabs.com id
	7E/50-27934-FE925A05; Thu, 15 Nov 2012 17:44:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-21.messagelabs.com!1353001452!17868859!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22009 invoked from network); 15 Nov 2012 17:44:13 -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 Nov 2012 17: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 1TZ3U4-000124-E1
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 17:44:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZ3U3-0000lF-L5
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 17:44:12 +0000
Message-Id: <E1TZ3U3-0000lF-L5@xenbits.xen.org>
Date: Thu, 15 Nov 2012 17:44:11 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] Added signature for changeset
	500194a883bd
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352972511 0
# Node ID ce405f5fd5ee75e5241afece9b41c114891fc20d
# Parent  254aeb18f817224160b607d2830bad4f68813708
Added signature for changeset 500194a883bd
---


diff -r 254aeb18f817 -r ce405f5fd5ee .hgsigs
--- a/.hgsigs	Thu Nov 15 09:58:29 2012 +0100
+++ b/.hgsigs	Thu Nov 15 09:41:51 2012 +0000
@@ -19,3 +19,4 @@ da64f68730cf1c42c06919578e70d8bc01041051
 acbd3617691397911f34e4574d03385c08aec900 0 iQEcBAABAgAGBQJP3zbaAAoJEIP+FMlX6CvZoMUH/1TQcdw+e/7BmxtXBnMIrpiTJ7/tffSBYurcoQFq1cTaJJgz5in8iq1JWHgru/ToYQ9PaWY0wVQcb1Yj40rCGNnASlSzQqgRQbYMmZpKd0+TESDtMkl6q1FXECrs8ag/HMHwkVYsgdAEmQ/7IouRK4kBOXXzSWhMRU24YkHdJAnQCcXD9L99Yjmrr5oxF/fgVG7WnhfTGlhpu7FaUeWlDjBRlIuw6HeNnXMwubAn569dGXyPdwJnbU0nCLRrQGjQn7DsmeN25gL4R5Pz+uhp4eeGB7ORYT/mj5+xeS2Cjb3XfptV3qAW2FJVYRLit7lp5cmsKvtBnr8mAO8GS0R+8Pg=
 5cdcfed7b5b129843e1602b5d43c7651de337092 0 iQEcBAABAgAGBQJQDB6TAAoJEIP+FMlX6CvZ+H8IAJbWR4PrKOt3gMpgEYdADts96vtduD3oet5C+l8FSlo0pDPtF32wPQ5tQz+Ll8OtCFckSIzobsw+9IMrZ38nRwP1UM2LgLUuo6WVVwYZ4DKVIntDrC1DV6Us1CmGiHiTHqPNDypBB2NponJ21rlD8zRY4Q661BgdKXVwqq5H6SDtxNRSn7RPDYnsIvavabr0fvcR38YOHVG4TvfXP+uge0UfEvIurGEBnTn25E0vadLG9la9SGKeEm8HuTDnzuxQmSic7tPdodQ0oQYQ5AAj+/mdW2B9uaCDsmOeP4udDNcV4yXxdLxNA2GkeSSJ/+U0hj2HBaHZvd+hvAeHBZGdMAU=
 ce7195d2b80e4df9857e434fa29689fd678a2341 0 iQEcBAABAgAGBQJQI9u1AAoJEIP+FMlX6CvZU88IAKKz8mw53zvvdEFaV39669d+SFATRyatb9OF6L1O6RQczsdxI7koyGyLL64V6NvpMB3RLFrh3dD+1ZIy4W13AWuDSnby45oIijHpcQqZ+Zt1ijxDj/wuViSC+4S+sdkgCDfmMyGb5a8XwnoKIWb6EOJVT8FFjuVJ3UsTXfujCyDdDeKoFH7ZGfq+r7k0DoANqkNi2AIhxUrw/h/9ydNffd4Gh/BUsHHcx5DEfXUplbT3pPUvq6o38rsqM80xZNR7lgL7chxFHjs94OOqX71gEZw0sR1hi+gbL8eJTIsep4kM4Z0aOYJJCqUFYv5C31Nn54GWECKJSNSWtBo8hIqLpI0=
+500194a883bdcf77b2a0fc87de291b0c27435207 0 iQEcBAABAgAGBQJQpLjeAAoJEIP+FMlX6CvZaUUIAKXHEVEfhnGEUAnm0gA0Mao1W8yo7BrsIhgZ/TyTYmhaOBzF3ez9+oUDQ6XWAJ9zbyq4ZWBsDbKFJCSwF8nvPL2OLG2DGyqoi7UckPZshQi71h91cT8v/snsp4A2161NEh9Tyti7YrygCzZldgjYy0vVAyFGmML+swvcBI9Zufb2Vk+Lm4R6EgmmTSO+EHEPg0QDtjLcUICSPcQgzRBe2QB/xzn/h8yWJ8FoOCyNDu3zQU1RKoP3lVMT0vK6Pr/l6NC7sy2Npfhe44ysvKHCpzQD3kZMhvzLujVnm1xJs0iKifUgHLsAO7RP55i7AfUgXqEMHaMxwlRSNWBmOsLSeho=

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 17:44:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 17: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 1TZ3U9-0000lD-N0; Thu, 15 Nov 2012 17:44:17 +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 1TZ3U8-0000kq-AP
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 17:44:16 +0000
Received: from [85.158.143.35:55511] by server-1.bemta-4.messagelabs.com id
	7E/50-27934-FE925A05; Thu, 15 Nov 2012 17:44:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-21.messagelabs.com!1353001452!17868859!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22009 invoked from network); 15 Nov 2012 17:44:13 -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 Nov 2012 17: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 1TZ3U4-000124-E1
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 17:44:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZ3U3-0000lF-L5
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 17:44:12 +0000
Message-Id: <E1TZ3U3-0000lF-L5@xenbits.xen.org>
Date: Thu, 15 Nov 2012 17:44:11 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] Added signature for changeset
	500194a883bd
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352972511 0
# Node ID ce405f5fd5ee75e5241afece9b41c114891fc20d
# Parent  254aeb18f817224160b607d2830bad4f68813708
Added signature for changeset 500194a883bd
---


diff -r 254aeb18f817 -r ce405f5fd5ee .hgsigs
--- a/.hgsigs	Thu Nov 15 09:58:29 2012 +0100
+++ b/.hgsigs	Thu Nov 15 09:41:51 2012 +0000
@@ -19,3 +19,4 @@ da64f68730cf1c42c06919578e70d8bc01041051
 acbd3617691397911f34e4574d03385c08aec900 0 iQEcBAABAgAGBQJP3zbaAAoJEIP+FMlX6CvZoMUH/1TQcdw+e/7BmxtXBnMIrpiTJ7/tffSBYurcoQFq1cTaJJgz5in8iq1JWHgru/ToYQ9PaWY0wVQcb1Yj40rCGNnASlSzQqgRQbYMmZpKd0+TESDtMkl6q1FXECrs8ag/HMHwkVYsgdAEmQ/7IouRK4kBOXXzSWhMRU24YkHdJAnQCcXD9L99Yjmrr5oxF/fgVG7WnhfTGlhpu7FaUeWlDjBRlIuw6HeNnXMwubAn569dGXyPdwJnbU0nCLRrQGjQn7DsmeN25gL4R5Pz+uhp4eeGB7ORYT/mj5+xeS2Cjb3XfptV3qAW2FJVYRLit7lp5cmsKvtBnr8mAO8GS0R+8Pg=
 5cdcfed7b5b129843e1602b5d43c7651de337092 0 iQEcBAABAgAGBQJQDB6TAAoJEIP+FMlX6CvZ+H8IAJbWR4PrKOt3gMpgEYdADts96vtduD3oet5C+l8FSlo0pDPtF32wPQ5tQz+Ll8OtCFckSIzobsw+9IMrZ38nRwP1UM2LgLUuo6WVVwYZ4DKVIntDrC1DV6Us1CmGiHiTHqPNDypBB2NponJ21rlD8zRY4Q661BgdKXVwqq5H6SDtxNRSn7RPDYnsIvavabr0fvcR38YOHVG4TvfXP+uge0UfEvIurGEBnTn25E0vadLG9la9SGKeEm8HuTDnzuxQmSic7tPdodQ0oQYQ5AAj+/mdW2B9uaCDsmOeP4udDNcV4yXxdLxNA2GkeSSJ/+U0hj2HBaHZvd+hvAeHBZGdMAU=
 ce7195d2b80e4df9857e434fa29689fd678a2341 0 iQEcBAABAgAGBQJQI9u1AAoJEIP+FMlX6CvZU88IAKKz8mw53zvvdEFaV39669d+SFATRyatb9OF6L1O6RQczsdxI7koyGyLL64V6NvpMB3RLFrh3dD+1ZIy4W13AWuDSnby45oIijHpcQqZ+Zt1ijxDj/wuViSC+4S+sdkgCDfmMyGb5a8XwnoKIWb6EOJVT8FFjuVJ3UsTXfujCyDdDeKoFH7ZGfq+r7k0DoANqkNi2AIhxUrw/h/9ydNffd4Gh/BUsHHcx5DEfXUplbT3pPUvq6o38rsqM80xZNR7lgL7chxFHjs94OOqX71gEZw0sR1hi+gbL8eJTIsep4kM4Z0aOYJJCqUFYv5C31Nn54GWECKJSNSWtBo8hIqLpI0=
+500194a883bdcf77b2a0fc87de291b0c27435207 0 iQEcBAABAgAGBQJQpLjeAAoJEIP+FMlX6CvZaUUIAKXHEVEfhnGEUAnm0gA0Mao1W8yo7BrsIhgZ/TyTYmhaOBzF3ez9+oUDQ6XWAJ9zbyq4ZWBsDbKFJCSwF8nvPL2OLG2DGyqoi7UckPZshQi71h91cT8v/snsp4A2161NEh9Tyti7YrygCzZldgjYy0vVAyFGmML+swvcBI9Zufb2Vk+Lm4R6EgmmTSO+EHEPg0QDtjLcUICSPcQgzRBe2QB/xzn/h8yWJ8FoOCyNDu3zQU1RKoP3lVMT0vK6Pr/l6NC7sy2Npfhe44ysvKHCpzQD3kZMhvzLujVnm1xJs0iKifUgHLsAO7RP55i7AfUgXqEMHaMxwlRSNWBmOsLSeho=

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 17:44:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 17: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 1TZ3U8-0000l5-Ke; Thu, 15 Nov 2012 17:44:16 +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 1TZ3U7-0000kl-Rv
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 17:44:15 +0000
Received: from [85.158.143.99:3600] by server-2.bemta-4.messagelabs.com id
	AF/08-28922-FE925A05; Thu, 15 Nov 2012 17:44:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1353001450!23060764!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5633 invoked from network); 15 Nov 2012 17:44:11 -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;
	15 Nov 2012 17: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 1TZ3U2-00011y-Ip
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 17:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZ3U1-0000ki-BW
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 17:44:10 +0000
Message-Id: <E1TZ3U1-0000ki-BW@xenbits.xen.org>
Date: Thu, 15 Nov 2012 17: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] update Xen version to 4.1.4-rc1
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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
# Date 1352969864 -3600
# Node ID 500194a883bdcf77b2a0fc87de291b0c27435207
# Parent  178f63286b02b22ce856ca76af639d39aa5c6172
update Xen version to 4.1.4-rc1
---


diff -r 178f63286b02 -r 500194a883bd Config.mk
--- a/Config.mk	Wed Nov 14 11:46:12 2012 +0000
+++ b/Config.mk	Thu Nov 15 09:57:44 2012 +0100
@@ -179,7 +179,7 @@ endif
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= b36c42985575cd6d761d39e5770e57a1f52832ae
+QEMU_TAG ?= xen-4.1.4-rc1
 # Tue Nov 13 18:25:17 2012 +0000
 # mapcache: Fix invalidate if memory requested was not bucket aligned
 
diff -r 178f63286b02 -r 500194a883bd xen/Makefile
--- a/xen/Makefile	Wed Nov 14 11:46:12 2012 +0000
+++ b/xen/Makefile	Thu Nov 15 09:57:44 2012 +0100
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 1
-export XEN_EXTRAVERSION ?= .4-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .4-rc1$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 17:44:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 17: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 1TZ3U8-0000l5-Ke; Thu, 15 Nov 2012 17:44:16 +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 1TZ3U7-0000kl-Rv
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 17:44:15 +0000
Received: from [85.158.143.99:3600] by server-2.bemta-4.messagelabs.com id
	AF/08-28922-FE925A05; Thu, 15 Nov 2012 17:44:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1353001450!23060764!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5633 invoked from network); 15 Nov 2012 17:44:11 -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;
	15 Nov 2012 17: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 1TZ3U2-00011y-Ip
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 17:44:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZ3U1-0000ki-BW
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 17:44:10 +0000
Message-Id: <E1TZ3U1-0000ki-BW@xenbits.xen.org>
Date: Thu, 15 Nov 2012 17: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] update Xen version to 4.1.4-rc1
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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
# Date 1352969864 -3600
# Node ID 500194a883bdcf77b2a0fc87de291b0c27435207
# Parent  178f63286b02b22ce856ca76af639d39aa5c6172
update Xen version to 4.1.4-rc1
---


diff -r 178f63286b02 -r 500194a883bd Config.mk
--- a/Config.mk	Wed Nov 14 11:46:12 2012 +0000
+++ b/Config.mk	Thu Nov 15 09:57:44 2012 +0100
@@ -179,7 +179,7 @@ endif
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= b36c42985575cd6d761d39e5770e57a1f52832ae
+QEMU_TAG ?= xen-4.1.4-rc1
 # Tue Nov 13 18:25:17 2012 +0000
 # mapcache: Fix invalidate if memory requested was not bucket aligned
 
diff -r 178f63286b02 -r 500194a883bd xen/Makefile
--- a/xen/Makefile	Wed Nov 14 11:46:12 2012 +0000
+++ b/xen/Makefile	Thu Nov 15 09:57:44 2012 +0100
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 1
-export XEN_EXTRAVERSION ?= .4-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .4-rc1$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 21:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 21: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.xen.org>)
	id 1TZ6iR-00084c-IN; Thu, 15 Nov 2012 21:11:15 +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 1TZ6iQ-00083Y-2N
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:11:14 +0000
Received: from [193.109.254.147:38938] by server-12.bemta-14.messagelabs.com
	id 3B/F6-00510-17A55A05; Thu, 15 Nov 2012 21:11:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1353013870!4178419!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30316 invoked from network); 15 Nov 2012 21:11: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;
	15 Nov 2012 21: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 1TZ6iM-0003Vh-0r
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZ6iL-0006Q5-Sh
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:11:09 +0000
Message-Id: <E1TZ6iL-0006Q5-Sh@xenbits.xen.org>
Date: Thu, 15 Nov 2012 21:11:09 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] update Xen version to 4.2.1-rc1
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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
# Date 1352969731 -3600
# Node ID b6f071324f5ed076bfd28c71b51521cdd38639ab
# Parent  4f349508611f329de2a1a687f9cea0545294f944
update Xen version to 4.2.1-rc1
---


diff -r 4f349508611f -r b6f071324f5e Config.mk
--- a/Config.mk	Wed Nov 14 12:06:00 2012 +0000
+++ b/Config.mk	Thu Nov 15 09:55:31 2012 +0100
@@ -214,7 +214,7 @@ ETHERBOOT_NICS ?= rtl8139 8086100e
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= xen-4.2.0
+QEMU_TAG ?= xen-4.2.1-rc1
 
 # Short answer -- do not enable this unless you know what you are
 # doing and are prepared for some pain.
diff -r 4f349508611f -r b6f071324f5e xen/Makefile
--- a/xen/Makefile	Wed Nov 14 12:06:00 2012 +0000
+++ b/xen/Makefile	Thu Nov 15 09:55:31 2012 +0100
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 2
-export XEN_EXTRAVERSION ?= .1-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .1-rc1$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 21:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 21: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.xen.org>)
	id 1TZ6iR-00084c-IN; Thu, 15 Nov 2012 21:11:15 +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 1TZ6iQ-00083Y-2N
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:11:14 +0000
Received: from [193.109.254.147:38938] by server-12.bemta-14.messagelabs.com
	id 3B/F6-00510-17A55A05; Thu, 15 Nov 2012 21:11:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1353013870!4178419!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30316 invoked from network); 15 Nov 2012 21:11: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;
	15 Nov 2012 21: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 1TZ6iM-0003Vh-0r
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZ6iL-0006Q5-Sh
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:11:09 +0000
Message-Id: <E1TZ6iL-0006Q5-Sh@xenbits.xen.org>
Date: Thu, 15 Nov 2012 21:11:09 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] update Xen version to 4.2.1-rc1
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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
# Date 1352969731 -3600
# Node ID b6f071324f5ed076bfd28c71b51521cdd38639ab
# Parent  4f349508611f329de2a1a687f9cea0545294f944
update Xen version to 4.2.1-rc1
---


diff -r 4f349508611f -r b6f071324f5e Config.mk
--- a/Config.mk	Wed Nov 14 12:06:00 2012 +0000
+++ b/Config.mk	Thu Nov 15 09:55:31 2012 +0100
@@ -214,7 +214,7 @@ ETHERBOOT_NICS ?= rtl8139 8086100e
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= xen-4.2.0
+QEMU_TAG ?= xen-4.2.1-rc1
 
 # Short answer -- do not enable this unless you know what you are
 # doing and are prepared for some pain.
diff -r 4f349508611f -r b6f071324f5e xen/Makefile
--- a/xen/Makefile	Wed Nov 14 12:06:00 2012 +0000
+++ b/xen/Makefile	Thu Nov 15 09:55:31 2012 +0100
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 2
-export XEN_EXTRAVERSION ?= .1-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .1-rc1$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 21:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 21: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.xen.org>)
	id 1TZ6iP-00083M-Bq; Thu, 15 Nov 2012 21:11:13 +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 1TZ6iO-00082O-LO
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:11:12 +0000
Received: from [85.158.139.211:28408] by server-8.bemta-5.messagelabs.com id
	85/37-06050-F6A55A05; Thu, 15 Nov 2012 21:11:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-206.messagelabs.com!1353013869!20350823!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21726 invoked from network); 15 Nov 2012 21:11:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Nov 2012 21: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 1TZ6iL-0003Ve-Ig
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZ6iL-0006Pq-8v
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:11:09 +0000
Message-Id: <E1TZ6iL-0006Pq-8v@xenbits.xen.org>
Date: Thu, 15 Nov 2012 21:11:08 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xen-tmem-list-parse: fix ugly
	parse 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: "Change log for Mercurial \(receive only\)"
	<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 Dan Magenheimer <dan.magenheimer@oracle.com>
# Date 1352894760 0
# Node ID 4f349508611f329de2a1a687f9cea0545294f944
# Parent  8ca6372315f826881f9de141ac1227ef962100cf
xen-tmem-list-parse: fix ugly parse output

The program xen-tmem-list-parse parses the output of xm/xl tmem-list
into human-readable format.  A missing NULL terminator sometimes
causes garbage to be spewed where the two-letter pool type
should be output.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 26147:3186c04af582
Backport-requested-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 8ca6372315f8 -r 4f349508611f tools/misc/xen-tmem-list-parse.c
--- a/tools/misc/xen-tmem-list-parse.c	Wed Nov 14 11:46:07 2012 +0000
+++ b/tools/misc/xen-tmem-list-parse.c	Wed Nov 14 12:06:00 2012 +0000
@@ -243,6 +243,7 @@ void parse_pool(char *s)
     unsigned long long flush_objs = parse(s,"ot");
 
     parse_string(s,"PT",pool_type,2);
+    pool_type[2] = '\0';
     if (pool_type[1] == 'S')
         return; /* no need to repeat print data for shared pools */
     printf("domid%lu,id%lu[%s]:pgp=%llu(max=%llu) obj=%llu(%llu) "
@@ -286,6 +287,7 @@ void parse_shared_pool(char *s)
     unsigned long long flush_objs = parse(s,"ot");
 
     parse_string(s,"PT",pool_type,2);
+    pool_type[2] = '\0';
     parse_sharers(s,"SC",buf,BUFSIZE);
     printf("poolid=%lu[%s] uuid=%llx.%llx, shared-by:%s: "
            "pgp=%llu(max=%llu) obj=%llu(%llu) "

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 21:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 21: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.xen.org>)
	id 1TZ6iP-00083M-Bq; Thu, 15 Nov 2012 21:11:13 +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 1TZ6iO-00082O-LO
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:11:12 +0000
Received: from [85.158.139.211:28408] by server-8.bemta-5.messagelabs.com id
	85/37-06050-F6A55A05; Thu, 15 Nov 2012 21:11:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-206.messagelabs.com!1353013869!20350823!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21726 invoked from network); 15 Nov 2012 21:11:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Nov 2012 21: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 1TZ6iL-0003Ve-Ig
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZ6iL-0006Pq-8v
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:11:09 +0000
Message-Id: <E1TZ6iL-0006Pq-8v@xenbits.xen.org>
Date: Thu, 15 Nov 2012 21:11:08 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xen-tmem-list-parse: fix ugly
	parse 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: "Change log for Mercurial \(receive only\)"
	<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 Dan Magenheimer <dan.magenheimer@oracle.com>
# Date 1352894760 0
# Node ID 4f349508611f329de2a1a687f9cea0545294f944
# Parent  8ca6372315f826881f9de141ac1227ef962100cf
xen-tmem-list-parse: fix ugly parse output

The program xen-tmem-list-parse parses the output of xm/xl tmem-list
into human-readable format.  A missing NULL terminator sometimes
causes garbage to be spewed where the two-letter pool type
should be output.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 26147:3186c04af582
Backport-requested-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 8ca6372315f8 -r 4f349508611f tools/misc/xen-tmem-list-parse.c
--- a/tools/misc/xen-tmem-list-parse.c	Wed Nov 14 11:46:07 2012 +0000
+++ b/tools/misc/xen-tmem-list-parse.c	Wed Nov 14 12:06:00 2012 +0000
@@ -243,6 +243,7 @@ void parse_pool(char *s)
     unsigned long long flush_objs = parse(s,"ot");
 
     parse_string(s,"PT",pool_type,2);
+    pool_type[2] = '\0';
     if (pool_type[1] == 'S')
         return; /* no need to repeat print data for shared pools */
     printf("domid%lu,id%lu[%s]:pgp=%llu(max=%llu) obj=%llu(%llu) "
@@ -286,6 +287,7 @@ void parse_shared_pool(char *s)
     unsigned long long flush_objs = parse(s,"ot");
 
     parse_string(s,"PT",pool_type,2);
+    pool_type[2] = '\0';
     parse_sharers(s,"SC",buf,BUFSIZE);
     printf("poolid=%lu[%s] uuid=%llx.%llx, shared-by:%s: "
            "pgp=%llu(max=%llu) obj=%llu(%llu) "

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 21:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 21: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.xen.org>)
	id 1TZ6iQ-000845-Fc; Thu, 15 Nov 2012 21:11:14 +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 1TZ6iP-00083L-LS
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:11:13 +0000
Received: from [193.109.254.147:45540] by server-2.bemta-14.messagelabs.com id
	A8/3E-20829-07A55A05; Thu, 15 Nov 2012 21:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1353013870!4125712!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26942 invoked from network); 15 Nov 2012 21:11:11 -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;
	15 Nov 2012 21: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 1TZ6iM-0003Vk-Ir
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZ6iM-0006QK-Da
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:11:10 +0000
Message-Id: <E1TZ6iM-0006QK-Da@xenbits.xen.org>
Date: Thu, 15 Nov 2012 21:11:09 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] Added tag 4.2.1-rc1 for changeset
	b6f071324f5e
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352969746 -3600
# Node ID e30bd1a88c4e80c6e9acc883119139c7dbe6e42a
# Parent  b6f071324f5ed076bfd28c71b51521cdd38639ab
Added tag 4.2.1-rc1 for changeset b6f071324f5e
---


diff -r b6f071324f5e -r e30bd1a88c4e .hgtags
--- a/.hgtags	Thu Nov 15 09:55:31 2012 +0100
+++ b/.hgtags	Thu Nov 15 09:55:46 2012 +0100
@@ -59,3 +59,4 @@ 68640a3c99cefa86ae70fc49871025864e5671f2
 528f0708b6db392e10303b7ed2ab529bb8b512b7 4.2.0-branched
 14164c5f22c88a9dc1cfd7178f84a7fab2b82aa8 4.2.0-rc5
 af176624c3ae86141a4ad8617b5ec2a834a6c626 RELEASE-4.2.0
+b6f071324f5ed076bfd28c71b51521cdd38639ab 4.2.1-rc1

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 21:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 21: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.xen.org>)
	id 1TZ6iQ-000845-Fc; Thu, 15 Nov 2012 21:11:14 +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 1TZ6iP-00083L-LS
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:11:13 +0000
Received: from [193.109.254.147:45540] by server-2.bemta-14.messagelabs.com id
	A8/3E-20829-07A55A05; Thu, 15 Nov 2012 21:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1353013870!4125712!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26942 invoked from network); 15 Nov 2012 21:11:11 -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;
	15 Nov 2012 21: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 1TZ6iM-0003Vk-Ir
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZ6iM-0006QK-Da
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:11:10 +0000
Message-Id: <E1TZ6iM-0006QK-Da@xenbits.xen.org>
Date: Thu, 15 Nov 2012 21:11:09 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] Added tag 4.2.1-rc1 for changeset
	b6f071324f5e
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352969746 -3600
# Node ID e30bd1a88c4e80c6e9acc883119139c7dbe6e42a
# Parent  b6f071324f5ed076bfd28c71b51521cdd38639ab
Added tag 4.2.1-rc1 for changeset b6f071324f5e
---


diff -r b6f071324f5e -r e30bd1a88c4e .hgtags
--- a/.hgtags	Thu Nov 15 09:55:31 2012 +0100
+++ b/.hgtags	Thu Nov 15 09:55:46 2012 +0100
@@ -59,3 +59,4 @@ 68640a3c99cefa86ae70fc49871025864e5671f2
 528f0708b6db392e10303b7ed2ab529bb8b512b7 4.2.0-branched
 14164c5f22c88a9dc1cfd7178f84a7fab2b82aa8 4.2.0-rc5
 af176624c3ae86141a4ad8617b5ec2a834a6c626 RELEASE-4.2.0
+b6f071324f5ed076bfd28c71b51521cdd38639ab 4.2.1-rc1

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 21:12:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 21:12: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 1TZ6jN-0008Ad-SC; Thu, 15 Nov 2012 21:12:13 +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 1TZ6jM-0008AV-QM
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:12:12 +0000
Received: from [85.158.143.35:45934] by server-3.bemta-4.messagelabs.com id
	BA/FC-06841-CAA55A05; Thu, 15 Nov 2012 21:12:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1353013930!5677935!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16782 invoked from network); 15 Nov 2012 21:12:11 -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;
	15 Nov 2012 21:12: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 1TZ6iN-0003Vn-6D
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:11:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZ6iM-0006Qc-V1
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:11:10 +0000
Message-Id: <E1TZ6iM-0006Qc-V1@xenbits.xen.org>
Date: Thu, 15 Nov 2012 21:11:10 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] Added signature for changeset
	b6f071324f5e
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352972523 0
# Node ID 003ac445eae605356ee741a7de7cf98008be89c1
# Parent  e30bd1a88c4e80c6e9acc883119139c7dbe6e42a
Added signature for changeset b6f071324f5e
---


diff -r e30bd1a88c4e -r 003ac445eae6 .hgsigs
--- a/.hgsigs	Thu Nov 15 09:55:46 2012 +0100
+++ b/.hgsigs	Thu Nov 15 09:42:03 2012 +0000
@@ -11,3 +11,4 @@ d44f290e81df5f78f0e3545742e3c4ff5415b0a7
 68640a3c99cefa86ae70fc49871025864e5671f2 0 iQEcBAABAgAGBQJQSdgUAAoJEIP+FMlX6CvZeWUH/1SeYnKXtkt7n+WuMyF2LvCzZQApmOo+hqVB7m0Pe4Yh9bEq1PAE+sJOAoQIBklCpY3WFsNGQN8yIbYyWRzbIM7oavknwoUoSn50zMk12HczqHigXvhL/eOghRKNsK9BrQnRV+byNHRjzSHPReNxpzueKBOTrCMlXtYMDb94swc+hatEDItT4TwZcaNPri3kiWND0DPmOk58Ke96ml9rpomS1ff976hYAZl+N1Q3Pt998SXiaglZ9EeL0Y8cY759XqZII4D4o6/oQW8MzWrQZr4woHHU7MfK3OWslelzP486esHyyjotEWeelhgl/RjIl0crNBbmCWU15BOAw7wSZh4=
 14164c5f22c88a9dc1cfd7178f84a7fab2b82aa8 0 iQEcBAABAgAGBQJQUcGjAAoJEIP+FMlX6CvZvX4H/1QV1VSW//dsv8IVCHPnHO4njlqYNUgIRycS4EuCJ8SrFLgfR77y3DwJg1D+JrYIT80QfzNeU3g/bcqz+0koD/P7joV4ONFkrB7pHSfACmMY7nfQ1Z2qHePAfBQ+cVdx6rXEYkFAbPjOz6kAP3LmpRLPasU46H+oG1zKHRgc0uhNN3Vit7eIhx/hDvY2YZDjuIWCQpmJylRlJsvMbpk2CjLiy4nXMNTKd1nlTNPTuRISsVBLx/ToquWtiO2a2EVRE4E+JhRGHNdFwXBRfV1XDDVNNRj+SvDvyWs29WKEOfVyGpgAKd29j/5YPzuHqmCcCfNxuN6lDHL6NxtwjZdDJao=
 af176624c3ae86141a4ad8617b5ec2a834a6c626 0 iQEcBAABAgAGBQJQVt5zAAoJEIP+FMlX6CvZ2q4H/2eEMxgwzflIPj88Y/jE1z8dTJ8E2l2FTBziMlmFYkmsiqx+BlGz9kk610DQo4mJoHrRSZOcZX0/NNUuCZntRizEorBQUcBEOBJQgTLzaxatPR49W5N7gOgqwNuWplKV0Aor7X0qX+wFZ4kZdBuqOimV7Mw43L1LsskcuDmqi8Ipvbf+JjnRPXpeTlxBOD+52ZhAirxvpA+LZfLIIYV9lx3SB7z7okxlBS+rlyL+h9cuwthWO3545QPlwXcSBY9r9m9/5ZtAiID5935JDdZGd7Dt/ZmikVs9xE6QHrHmWZFDfqgGPOmYFmVhJxk1xwwUbor3qaiUjTwfjM+zAIqtNv4=
+b6f071324f5ed076bfd28c71b51521cdd38639ab 0 iQEcBAABAgAGBQJQpLjpAAoJEIP+FMlX6CvZs2EIAM1HO25BnOPvo3fVjDErNnLo6miyentoLWJpXiDrJb+QRwuNVNGAQN0vlfd2iHcuvC9ipR1iFUizFcO1TI/wYoIOYOxs/r9Yk9cnBRThC7+yoBhCZY/LAbbd6SazEzI/86ZrMPbT4kfL8BD652UP1o9HCHgbFYDLzRMZTtep4+mA1OXCUWto4QjAJn+/SCQKI5kJXdLaj6JDS40kQoDXMlcTKu0NlftFT3zSA+U/SnOrRFwxW7uTxM09yyRLs/a/LbRcmYjeCnKUlvh8uapi5878Gxf5Bpo3XINKFsxC6p7nKF0wHzAqm63sB+o7C4fIvNY0nnWi5e7FDir+CO2yIKE=

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

From xen-changelog-bounces@lists.xen.org Thu Nov 15 21:12:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Nov 2012 21:12: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 1TZ6jN-0008Ad-SC; Thu, 15 Nov 2012 21:12:13 +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 1TZ6jM-0008AV-QM
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:12:12 +0000
Received: from [85.158.143.35:45934] by server-3.bemta-4.messagelabs.com id
	BA/FC-06841-CAA55A05; Thu, 15 Nov 2012 21:12:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1353013930!5677935!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16782 invoked from network); 15 Nov 2012 21:12:11 -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;
	15 Nov 2012 21:12: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 1TZ6iN-0003Vn-6D
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:11:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZ6iM-0006Qc-V1
	for xen-changelog@lists.xensource.com; Thu, 15 Nov 2012 21:11:10 +0000
Message-Id: <E1TZ6iM-0006Qc-V1@xenbits.xen.org>
Date: Thu, 15 Nov 2012 21:11:10 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] Added signature for changeset
	b6f071324f5e
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352972523 0
# Node ID 003ac445eae605356ee741a7de7cf98008be89c1
# Parent  e30bd1a88c4e80c6e9acc883119139c7dbe6e42a
Added signature for changeset b6f071324f5e
---


diff -r e30bd1a88c4e -r 003ac445eae6 .hgsigs
--- a/.hgsigs	Thu Nov 15 09:55:46 2012 +0100
+++ b/.hgsigs	Thu Nov 15 09:42:03 2012 +0000
@@ -11,3 +11,4 @@ d44f290e81df5f78f0e3545742e3c4ff5415b0a7
 68640a3c99cefa86ae70fc49871025864e5671f2 0 iQEcBAABAgAGBQJQSdgUAAoJEIP+FMlX6CvZeWUH/1SeYnKXtkt7n+WuMyF2LvCzZQApmOo+hqVB7m0Pe4Yh9bEq1PAE+sJOAoQIBklCpY3WFsNGQN8yIbYyWRzbIM7oavknwoUoSn50zMk12HczqHigXvhL/eOghRKNsK9BrQnRV+byNHRjzSHPReNxpzueKBOTrCMlXtYMDb94swc+hatEDItT4TwZcaNPri3kiWND0DPmOk58Ke96ml9rpomS1ff976hYAZl+N1Q3Pt998SXiaglZ9EeL0Y8cY759XqZII4D4o6/oQW8MzWrQZr4woHHU7MfK3OWslelzP486esHyyjotEWeelhgl/RjIl0crNBbmCWU15BOAw7wSZh4=
 14164c5f22c88a9dc1cfd7178f84a7fab2b82aa8 0 iQEcBAABAgAGBQJQUcGjAAoJEIP+FMlX6CvZvX4H/1QV1VSW//dsv8IVCHPnHO4njlqYNUgIRycS4EuCJ8SrFLgfR77y3DwJg1D+JrYIT80QfzNeU3g/bcqz+0koD/P7joV4ONFkrB7pHSfACmMY7nfQ1Z2qHePAfBQ+cVdx6rXEYkFAbPjOz6kAP3LmpRLPasU46H+oG1zKHRgc0uhNN3Vit7eIhx/hDvY2YZDjuIWCQpmJylRlJsvMbpk2CjLiy4nXMNTKd1nlTNPTuRISsVBLx/ToquWtiO2a2EVRE4E+JhRGHNdFwXBRfV1XDDVNNRj+SvDvyWs29WKEOfVyGpgAKd29j/5YPzuHqmCcCfNxuN6lDHL6NxtwjZdDJao=
 af176624c3ae86141a4ad8617b5ec2a834a6c626 0 iQEcBAABAgAGBQJQVt5zAAoJEIP+FMlX6CvZ2q4H/2eEMxgwzflIPj88Y/jE1z8dTJ8E2l2FTBziMlmFYkmsiqx+BlGz9kk610DQo4mJoHrRSZOcZX0/NNUuCZntRizEorBQUcBEOBJQgTLzaxatPR49W5N7gOgqwNuWplKV0Aor7X0qX+wFZ4kZdBuqOimV7Mw43L1LsskcuDmqi8Ipvbf+JjnRPXpeTlxBOD+52ZhAirxvpA+LZfLIIYV9lx3SB7z7okxlBS+rlyL+h9cuwthWO3545QPlwXcSBY9r9m9/5ZtAiID5935JDdZGd7Dt/ZmikVs9xE6QHrHmWZFDfqgGPOmYFmVhJxk1xwwUbor3qaiUjTwfjM+zAIqtNv4=
+b6f071324f5ed076bfd28c71b51521cdd38639ab 0 iQEcBAABAgAGBQJQpLjpAAoJEIP+FMlX6CvZs2EIAM1HO25BnOPvo3fVjDErNnLo6miyentoLWJpXiDrJb+QRwuNVNGAQN0vlfd2iHcuvC9ipR1iFUizFcO1TI/wYoIOYOxs/r9Yk9cnBRThC7+yoBhCZY/LAbbd6SazEzI/86ZrMPbT4kfL8BD652UP1o9HCHgbFYDLzRMZTtep4+mA1OXCUWto4QjAJn+/SCQKI5kJXdLaj6JDS40kQoDXMlcTKu0NlftFT3zSA+U/SnOrRFwxW7uTxM09yyRLs/a/LbRcmYjeCnKUlvh8uapi5878Gxf5Bpo3XINKFsxC6p7nKF0wHzAqm63sB+o7C4fIvNY0nnWi5e7FDir+CO2yIKE=

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

From xen-changelog-bounces@lists.xen.org Fri Nov 16 03:33:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Nov 2012 03: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.xen.org>)
	id 1TZCg6-0002vH-3k; Fri, 16 Nov 2012 03: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 1TZCg4-0002uz-BO
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:12 +0000
Received: from [85.158.139.83:42139] by server-6.bemta-5.messagelabs.com id
	83/4E-19321-7F3B5A05; Fri, 16 Nov 2012 03:33:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1353036789!27809183!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15658 invoked from network); 16 Nov 2012 03:33:10 -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;
	16 Nov 2012 03: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 1TZCg1-0005uM-Ie
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZCg1-0007kd-Am
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:09 +0000
Message-Id: <E1TZCg1-0007kd-Am@xenbits.xen.org>
Date: Fri, 16 Nov 2012 03:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Fix passing of application
	data to timeout_deregister hook
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Jim Fehlig <jfehlig@suse.com>
# Date 1352975125 0
# Node ID babb84d9a82efb0a59d26853323fc4af93afcd1f
# Parent  b9b4456e12d1e207a12ee70562334708f7ea3ab2
libxl: Fix passing of application data to timeout_deregister hook

When deregistering a timeout, the address of application data was
being passed to the timeout_deregister hook instead of the data
itself.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r b9b4456e12d1 -r babb84d9a82e tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c	Thu Nov 15 09:54:38 2012 +0000
+++ b/tools/libxl/libxl_event.c	Thu Nov 15 10:25:25 2012 +0000
@@ -184,7 +184,7 @@ static int time_register_finite(libxl__g
 static void time_deregister(libxl__gc *gc, libxl__ev_time *ev)
 {
     if (!ev->infinite) {
-        OSEVENT_HOOK_VOID(timeout_deregister, &ev->for_app_reg);
+        OSEVENT_HOOK_VOID(timeout_deregister, ev->for_app_reg);
         LIBXL_TAILQ_REMOVE(&CTX->etimes, ev, entry);
     }
 }

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

From xen-changelog-bounces@lists.xen.org Fri Nov 16 03:33:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Nov 2012 03: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.xen.org>)
	id 1TZCg6-0002vH-3k; Fri, 16 Nov 2012 03: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 1TZCg4-0002uz-BO
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:12 +0000
Received: from [85.158.139.83:42139] by server-6.bemta-5.messagelabs.com id
	83/4E-19321-7F3B5A05; Fri, 16 Nov 2012 03:33:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1353036789!27809183!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15658 invoked from network); 16 Nov 2012 03:33:10 -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;
	16 Nov 2012 03: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 1TZCg1-0005uM-Ie
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZCg1-0007kd-Am
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:09 +0000
Message-Id: <E1TZCg1-0007kd-Am@xenbits.xen.org>
Date: Fri, 16 Nov 2012 03:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Fix passing of application
	data to timeout_deregister hook
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Jim Fehlig <jfehlig@suse.com>
# Date 1352975125 0
# Node ID babb84d9a82efb0a59d26853323fc4af93afcd1f
# Parent  b9b4456e12d1e207a12ee70562334708f7ea3ab2
libxl: Fix passing of application data to timeout_deregister hook

When deregistering a timeout, the address of application data was
being passed to the timeout_deregister hook instead of the data
itself.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r b9b4456e12d1 -r babb84d9a82e tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c	Thu Nov 15 09:54:38 2012 +0000
+++ b/tools/libxl/libxl_event.c	Thu Nov 15 10:25:25 2012 +0000
@@ -184,7 +184,7 @@ static int time_register_finite(libxl__g
 static void time_deregister(libxl__gc *gc, libxl__ev_time *ev)
 {
     if (!ev->infinite) {
-        OSEVENT_HOOK_VOID(timeout_deregister, &ev->for_app_reg);
+        OSEVENT_HOOK_VOID(timeout_deregister, ev->for_app_reg);
         LIBXL_TAILQ_REMOVE(&CTX->etimes, ev, entry);
     }
 }

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

From xen-changelog-bounces@lists.xen.org Fri Nov 16 03:33:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Nov 2012 03: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.xen.org>)
	id 1TZCg5-0002v8-0s; Fri, 16 Nov 2012 03:33:13 +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 1TZCg3-0002ux-BX
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:11 +0000
Received: from [85.158.139.211:40630] by server-5.bemta-5.messagelabs.com id
	92/B5-11353-6F3B5A05; Fri, 16 Nov 2012 03:33:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-206.messagelabs.com!1353036788!20324400!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12428 invoked from network); 16 Nov 2012 03:33:09 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	16 Nov 2012 03:33: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 1TZCg0-0005uG-Kj
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZCg0-0007k6-5W
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:08 +0000
Message-Id: <E1TZCg0-0007k6-5W@xenbits.xen.org>
Date: Fri, 16 Nov 2012 03:33:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] update MAINTAINERS file
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Andre Przywara <osp@andrep.de>
# Date 1352973132 0
# Node ID f50e2f4278ab45e2b2c2650dd10c694ffda68ba0
# Parent  d1d05cb59a76f5206aa2404e08801f227ac38cea
update MAINTAINERS file

There have been some "organizational changes" within AMD.
Update the MAINTAINERS file accordingly.
Please also feel free to use the new email addresses if there are
any inquires related to code authored by Wei Wang, Christoph Egger
or Andre Przywara.

Signed-off-by: Andre Przywara <osp@andrep.de>
Acked-by: Wei Wang <weiwang.dd@gmail.com>
Acked-by: Boris Ostrovsky <boris.ostrovsky@amd.com>
Acked-by: Wei Huang <wei.huang2@amd.com>
Acked-by: Christoph Egger <Christoph_Egger@gmx.de>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r d1d05cb59a76 -r f50e2f4278ab MAINTAINERS
--- a/MAINTAINERS	Wed Nov 14 16:27:58 2012 +0000
+++ b/MAINTAINERS	Thu Nov 15 09:52:12 2012 +0000
@@ -78,7 +78,6 @@ Maintainers List (try to look for most p
 ACPI & POWER MANAGEMENT
 M:	Winston Wang <winston.l.wang@intel.com>
 M:	Gang Wei <gang.wei@intel.com>
-M:	Mark Langsdorf <mark.langsdorf@amd.com>
 M:	Jan Beulich <jbeulich@suse.com>
 S:	Supported
 F:	xen/arch/x86/acpi/
@@ -86,13 +85,15 @@ F:	xen/drivers/acpi/
 F:	xen/drivers/cpufreq/
 
 AMD IOMMU
-M:	Wei Wang <wei.wang2@amd.com>
-S:	Supported
+M:	Wei Wang <weiwang.dd@gmail.com>
+M:	Wei Huang <wei.huang2@amd.com>
+S:	Maintained
 F:	xen/drivers/passthrough/amd/
 
 AMD SVM
-M:	Andre Przywara <andre.przywara@amd.com>
-M:	Christoph Egger <christoph.egger@amd.com>
+M:	Andre Przywara <osp@andrep.de>
+M:	Christoph Egger <Christoph_Egger@gmx.de>
+M:	Boris Ostrovsky <boris.ostrovsky@amd.com>
 M:	Wei Huang <wei.huang2@amd.com>
 S:	Supported
 F:	xen/arch/x86/hvm/svm/
@@ -170,7 +171,7 @@ S:	Supported
 T:	hg http://xenbits.xen.org/XCP/linux-2.6.*.pq.hg
 
 MACHINE CHECK (MCA) & RAS
-M:	Christoph Egger <christoph.egger@amd.com>
+M:	Christoph Egger <Christoph_Egger@gmx.de>
 M:	Yunhong Jiang <yunhong.jiang@intel.com>
 S:	Supported
 F:	xen/arch/x86/cpu/mcheck/

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

From xen-changelog-bounces@lists.xen.org Fri Nov 16 03:33:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Nov 2012 03: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.xen.org>)
	id 1TZCg5-0002v8-0s; Fri, 16 Nov 2012 03:33:13 +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 1TZCg3-0002ux-BX
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:11 +0000
Received: from [85.158.139.211:40630] by server-5.bemta-5.messagelabs.com id
	92/B5-11353-6F3B5A05; Fri, 16 Nov 2012 03:33:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-206.messagelabs.com!1353036788!20324400!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12428 invoked from network); 16 Nov 2012 03:33:09 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	16 Nov 2012 03:33: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 1TZCg0-0005uG-Kj
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZCg0-0007k6-5W
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:08 +0000
Message-Id: <E1TZCg0-0007k6-5W@xenbits.xen.org>
Date: Fri, 16 Nov 2012 03:33:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] update MAINTAINERS file
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Andre Przywara <osp@andrep.de>
# Date 1352973132 0
# Node ID f50e2f4278ab45e2b2c2650dd10c694ffda68ba0
# Parent  d1d05cb59a76f5206aa2404e08801f227ac38cea
update MAINTAINERS file

There have been some "organizational changes" within AMD.
Update the MAINTAINERS file accordingly.
Please also feel free to use the new email addresses if there are
any inquires related to code authored by Wei Wang, Christoph Egger
or Andre Przywara.

Signed-off-by: Andre Przywara <osp@andrep.de>
Acked-by: Wei Wang <weiwang.dd@gmail.com>
Acked-by: Boris Ostrovsky <boris.ostrovsky@amd.com>
Acked-by: Wei Huang <wei.huang2@amd.com>
Acked-by: Christoph Egger <Christoph_Egger@gmx.de>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r d1d05cb59a76 -r f50e2f4278ab MAINTAINERS
--- a/MAINTAINERS	Wed Nov 14 16:27:58 2012 +0000
+++ b/MAINTAINERS	Thu Nov 15 09:52:12 2012 +0000
@@ -78,7 +78,6 @@ Maintainers List (try to look for most p
 ACPI & POWER MANAGEMENT
 M:	Winston Wang <winston.l.wang@intel.com>
 M:	Gang Wei <gang.wei@intel.com>
-M:	Mark Langsdorf <mark.langsdorf@amd.com>
 M:	Jan Beulich <jbeulich@suse.com>
 S:	Supported
 F:	xen/arch/x86/acpi/
@@ -86,13 +85,15 @@ F:	xen/drivers/acpi/
 F:	xen/drivers/cpufreq/
 
 AMD IOMMU
-M:	Wei Wang <wei.wang2@amd.com>
-S:	Supported
+M:	Wei Wang <weiwang.dd@gmail.com>
+M:	Wei Huang <wei.huang2@amd.com>
+S:	Maintained
 F:	xen/drivers/passthrough/amd/
 
 AMD SVM
-M:	Andre Przywara <andre.przywara@amd.com>
-M:	Christoph Egger <christoph.egger@amd.com>
+M:	Andre Przywara <osp@andrep.de>
+M:	Christoph Egger <Christoph_Egger@gmx.de>
+M:	Boris Ostrovsky <boris.ostrovsky@amd.com>
 M:	Wei Huang <wei.huang2@amd.com>
 S:	Supported
 F:	xen/arch/x86/hvm/svm/
@@ -170,7 +171,7 @@ S:	Supported
 T:	hg http://xenbits.xen.org/XCP/linux-2.6.*.pq.hg
 
 MACHINE CHECK (MCA) & RAS
-M:	Christoph Egger <christoph.egger@amd.com>
+M:	Christoph Egger <Christoph_Egger@gmx.de>
 M:	Yunhong Jiang <yunhong.jiang@intel.com>
 S:	Supported
 F:	xen/arch/x86/cpu/mcheck/

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

From xen-changelog-bounces@lists.xen.org Fri Nov 16 03:33:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Nov 2012 03: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.xen.org>)
	id 1TZCg6-0002vM-6J; Fri, 16 Nov 2012 03: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 1TZCg4-0002uy-V0
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:13 +0000
Received: from [85.158.139.211:18969] by server-11.bemta-5.messagelabs.com id
	52/C4-03409-7F3B5A05; Fri, 16 Nov 2012 03:33:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-206.messagelabs.com!1353036789!18884310!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26684 invoked from network); 16 Nov 2012 03:33:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	16 Nov 2012 03: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 1TZCg1-0005uJ-6H
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZCg0-0007kO-QK
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:08 +0000
Message-Id: <E1TZCg0-0007kO-QK@xenbits.xen.org>
Date: Fri, 16 Nov 2012 03:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/nmi: self_nmi() should not
	unconditionally enable interrupts
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352973278 0
# Node ID b9b4456e12d1e207a12ee70562334708f7ea3ab2
# Parent  f50e2f4278ab45e2b2c2650dd10c694ffda68ba0
x86/nmi: self_nmi() should not unconditionally enable interrupts

It seems that all current callers have interrupts enabled, making the
code currently safe but dangerous.  Also, fix a trailing whitespace
issue.

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


diff -r f50e2f4278ab -r b9b4456e12d1 xen/arch/x86/nmi.c
--- a/xen/arch/x86/nmi.c	Thu Nov 15 09:52:12 2012 +0000
+++ b/xen/arch/x86/nmi.c	Thu Nov 15 09:54:38 2012 +0000
@@ -482,13 +482,14 @@ void nmi_watchdog_tick(struct cpu_user_r
  * 8-3 and 8-4 in IA32 Reference Manual Volume 3. We send the IPI to
  * our own APIC ID explicitly which is valid.
  */
-void self_nmi(void) 
+void self_nmi(void)
 {
+    unsigned long flags;
     u32 id = get_apic_id();
-    local_irq_disable();
+    local_irq_save(flags);
     apic_wait_icr_idle();
     apic_icr_write(APIC_DM_NMI | APIC_DEST_PHYSICAL, id);
-    local_irq_enable();
+    local_irq_restore(flags);
 }
 
 static void do_nmi_trigger(unsigned char key)

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

From xen-changelog-bounces@lists.xen.org Fri Nov 16 03:33:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Nov 2012 03: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.xen.org>)
	id 1TZCg6-0002vM-6J; Fri, 16 Nov 2012 03: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 1TZCg4-0002uy-V0
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:13 +0000
Received: from [85.158.139.211:18969] by server-11.bemta-5.messagelabs.com id
	52/C4-03409-7F3B5A05; Fri, 16 Nov 2012 03:33:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-206.messagelabs.com!1353036789!18884310!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26684 invoked from network); 16 Nov 2012 03:33:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	16 Nov 2012 03: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 1TZCg1-0005uJ-6H
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZCg0-0007kO-QK
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:08 +0000
Message-Id: <E1TZCg0-0007kO-QK@xenbits.xen.org>
Date: Fri, 16 Nov 2012 03:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/nmi: self_nmi() should not
	unconditionally enable interrupts
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1352973278 0
# Node ID b9b4456e12d1e207a12ee70562334708f7ea3ab2
# Parent  f50e2f4278ab45e2b2c2650dd10c694ffda68ba0
x86/nmi: self_nmi() should not unconditionally enable interrupts

It seems that all current callers have interrupts enabled, making the
code currently safe but dangerous.  Also, fix a trailing whitespace
issue.

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


diff -r f50e2f4278ab -r b9b4456e12d1 xen/arch/x86/nmi.c
--- a/xen/arch/x86/nmi.c	Thu Nov 15 09:52:12 2012 +0000
+++ b/xen/arch/x86/nmi.c	Thu Nov 15 09:54:38 2012 +0000
@@ -482,13 +482,14 @@ void nmi_watchdog_tick(struct cpu_user_r
  * 8-3 and 8-4 in IA32 Reference Manual Volume 3. We send the IPI to
  * our own APIC ID explicitly which is valid.
  */
-void self_nmi(void) 
+void self_nmi(void)
 {
+    unsigned long flags;
     u32 id = get_apic_id();
-    local_irq_disable();
+    local_irq_save(flags);
     apic_wait_icr_idle();
     apic_icr_write(APIC_DM_NMI | APIC_DEST_PHYSICAL, id);
-    local_irq_enable();
+    local_irq_restore(flags);
 }
 
 static void do_nmi_trigger(unsigned char key)

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

From xen-changelog-bounces@lists.xen.org Fri Nov 16 03:33:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Nov 2012 03: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.xen.org>)
	id 1TZCg8-0002vt-Aq; Fri, 16 Nov 2012 03: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 1TZCg6-0002ux-QA
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:15 +0000
Received: from [85.158.139.83:42235] by server-5.bemta-5.messagelabs.com id
	4B/B5-11353-AF3B5A05; Fri, 16 Nov 2012 03:33:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-182.messagelabs.com!1353036792!23289942!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14135 invoked from network); 16 Nov 2012 03:33:13 -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;
	16 Nov 2012 03: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 1TZCg4-0005ub-74
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZCg3-0007mg-TM
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:11 +0000
Message-Id: <E1TZCg3-0007mg-TM@xenbits.xen.org>
Date: Fri, 16 Nov 2012 03:33:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen/arm: wake up secondary cpus
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1352975129 0
# Node ID 321f8487379bd6ca157fe11b4b518436d8b31e7e
# Parent  5718bbed558b524b3f2e431ba01ea2a99910f173
xen/arm: wake up secondary cpus

Secondary cpus are held by the firmware until we send an IPI to them.

Reordered non-boot cpu wait loop to perform the check before waiting
for an event, to handled the case where the event has already
happened when we reach the loop.

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 5718bbed558b -r 321f8487379b xen/arch/arm/gic.h
--- a/xen/arch/arm/gic.h	Thu Nov 15 10:25:28 2012 +0000
+++ b/xen/arch/arm/gic.h	Thu Nov 15 10:25:29 2012 +0000
@@ -124,6 +124,7 @@
 /* XXX: write this into the DT */
 #define VGIC_IRQ_EVTCHN_CALLBACK 31
 
+#ifndef __ASSEMBLY__
 extern int domain_vgic_init(struct domain *d);
 extern void domain_vgic_free(struct domain *d);
 
@@ -158,6 +159,7 @@ extern int gicv_setup(struct domain *d);
 extern void gic_save_state(struct vcpu *v);
 extern void gic_restore_state(struct vcpu *v);
 
+#endif /* __ASSEMBLY__ */
 #endif
 
 /*
diff -r 5718bbed558b -r 321f8487379b xen/arch/arm/head.S
--- a/xen/arch/arm/head.S	Thu Nov 15 10:25:28 2012 +0000
+++ b/xen/arch/arm/head.S	Thu Nov 15 10:25:29 2012 +0000
@@ -80,12 +80,12 @@ start:
 	beq   boot_cpu               /* If we're CPU 0, boot now */
 
 	/* Non-boot CPUs wait here to be woken up one at a time. */
-1:	wfe
-	dsb
+1:	dsb
 	ldr   r0, =smp_up_cpu        /* VA of gate */
 	add   r0, r0, r10            /* PA of gate */
 	ldr   r1, [r0]               /* Which CPU is being booted? */
 	teq   r1, r12                /* Is it us? */
+	wfene
 	bne   1b
 
 boot_cpu:
@@ -99,6 +99,10 @@ boot_cpu:
 	PRINT(" booting -\r\n")
 #endif
 
+	/* Wake up secondary cpus */
+	teq   r12, #0
+	bleq  kick_cpus
+
 	/* Check that this CPU has Hyp mode */
 	mrc   CP32(r0, ID_PFR1)
 	and   r0, r0, #0xf000        /* Bits 12-15 define virt extensions */
diff -r 5718bbed558b -r 321f8487379b xen/arch/arm/mode_switch.S
--- a/xen/arch/arm/mode_switch.S	Thu Nov 15 10:25:28 2012 +0000
+++ b/xen/arch/arm/mode_switch.S	Thu Nov 15 10:25:29 2012 +0000
@@ -19,7 +19,35 @@
 
 #include <asm/config.h>
 #include <asm/page.h>
+#include <asm/platform_vexpress.h>
 #include <asm/asm_defns.h>
+#include "gic.h"
+
+
+/* XXX: Versatile Express specific code */
+/* wake up secondary cpus */
+.globl kick_cpus
+kick_cpus:
+	/* write start paddr to v2m sysreg FLAGSSET register */
+	ldr   r0, =(V2M_SYS_MMIO_BASE)        /* base V2M sysreg MMIO address */
+	dsb
+	mov   r2, #0xffffffff
+	str   r2, [r0, #(V2M_SYS_FLAGSCLR)]
+	dsb
+	ldr   r2, =start
+	add   r2, r2, r10
+	str   r2, [r0, #(V2M_SYS_FLAGSSET)]
+	dsb
+	/* send an interrupt */
+	ldr   r0, =(GIC_BASE_ADDRESS + GIC_DR_OFFSET) /* base GICD MMIO address */
+	mov   r2, #0x1
+	str   r2, [r0, #(GICD_CTLR * 4)]      /* enable distributor */
+	mov   r2, #0xfe0000
+	str   r2, [r0, #(GICD_SGIR * 4)]      /* send IPI to everybody */
+	dsb
+	str   r2, [r0, #(GICD_CTLR * 4)]      /* disable distributor */
+	mov   pc, lr
+
 
 /* Get up a CPU into Hyp mode.  Clobbers r0-r3.
  *
diff -r 5718bbed558b -r 321f8487379b xen/include/asm-arm/platform_vexpress.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/platform_vexpress.h	Thu Nov 15 10:25:29 2012 +0000
@@ -0,0 +1,17 @@
+#ifndef __ASM_ARM_PLATFORM_H
+#define __ASM_ARM_PLATFORM_H
+
+/* V2M */
+#define V2M_SYS_MMIO_BASE     (0x1c010000)
+#define V2M_SYS_FLAGSSET      (0x30)
+#define V2M_SYS_FLAGSCLR      (0x34)
+
+#endif /* __ASM_ARM_PLATFORM_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.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Fri Nov 16 03:33:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Nov 2012 03: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.xen.org>)
	id 1TZCg8-0002vt-Aq; Fri, 16 Nov 2012 03: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 1TZCg6-0002ux-QA
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:15 +0000
Received: from [85.158.139.83:42235] by server-5.bemta-5.messagelabs.com id
	4B/B5-11353-AF3B5A05; Fri, 16 Nov 2012 03:33:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-182.messagelabs.com!1353036792!23289942!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14135 invoked from network); 16 Nov 2012 03:33:13 -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;
	16 Nov 2012 03: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 1TZCg4-0005ub-74
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZCg3-0007mg-TM
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:11 +0000
Message-Id: <E1TZCg3-0007mg-TM@xenbits.xen.org>
Date: Fri, 16 Nov 2012 03:33:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen/arm: wake up secondary cpus
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1352975129 0
# Node ID 321f8487379bd6ca157fe11b4b518436d8b31e7e
# Parent  5718bbed558b524b3f2e431ba01ea2a99910f173
xen/arm: wake up secondary cpus

Secondary cpus are held by the firmware until we send an IPI to them.

Reordered non-boot cpu wait loop to perform the check before waiting
for an event, to handled the case where the event has already
happened when we reach the loop.

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 5718bbed558b -r 321f8487379b xen/arch/arm/gic.h
--- a/xen/arch/arm/gic.h	Thu Nov 15 10:25:28 2012 +0000
+++ b/xen/arch/arm/gic.h	Thu Nov 15 10:25:29 2012 +0000
@@ -124,6 +124,7 @@
 /* XXX: write this into the DT */
 #define VGIC_IRQ_EVTCHN_CALLBACK 31
 
+#ifndef __ASSEMBLY__
 extern int domain_vgic_init(struct domain *d);
 extern void domain_vgic_free(struct domain *d);
 
@@ -158,6 +159,7 @@ extern int gicv_setup(struct domain *d);
 extern void gic_save_state(struct vcpu *v);
 extern void gic_restore_state(struct vcpu *v);
 
+#endif /* __ASSEMBLY__ */
 #endif
 
 /*
diff -r 5718bbed558b -r 321f8487379b xen/arch/arm/head.S
--- a/xen/arch/arm/head.S	Thu Nov 15 10:25:28 2012 +0000
+++ b/xen/arch/arm/head.S	Thu Nov 15 10:25:29 2012 +0000
@@ -80,12 +80,12 @@ start:
 	beq   boot_cpu               /* If we're CPU 0, boot now */
 
 	/* Non-boot CPUs wait here to be woken up one at a time. */
-1:	wfe
-	dsb
+1:	dsb
 	ldr   r0, =smp_up_cpu        /* VA of gate */
 	add   r0, r0, r10            /* PA of gate */
 	ldr   r1, [r0]               /* Which CPU is being booted? */
 	teq   r1, r12                /* Is it us? */
+	wfene
 	bne   1b
 
 boot_cpu:
@@ -99,6 +99,10 @@ boot_cpu:
 	PRINT(" booting -\r\n")
 #endif
 
+	/* Wake up secondary cpus */
+	teq   r12, #0
+	bleq  kick_cpus
+
 	/* Check that this CPU has Hyp mode */
 	mrc   CP32(r0, ID_PFR1)
 	and   r0, r0, #0xf000        /* Bits 12-15 define virt extensions */
diff -r 5718bbed558b -r 321f8487379b xen/arch/arm/mode_switch.S
--- a/xen/arch/arm/mode_switch.S	Thu Nov 15 10:25:28 2012 +0000
+++ b/xen/arch/arm/mode_switch.S	Thu Nov 15 10:25:29 2012 +0000
@@ -19,7 +19,35 @@
 
 #include <asm/config.h>
 #include <asm/page.h>
+#include <asm/platform_vexpress.h>
 #include <asm/asm_defns.h>
+#include "gic.h"
+
+
+/* XXX: Versatile Express specific code */
+/* wake up secondary cpus */
+.globl kick_cpus
+kick_cpus:
+	/* write start paddr to v2m sysreg FLAGSSET register */
+	ldr   r0, =(V2M_SYS_MMIO_BASE)        /* base V2M sysreg MMIO address */
+	dsb
+	mov   r2, #0xffffffff
+	str   r2, [r0, #(V2M_SYS_FLAGSCLR)]
+	dsb
+	ldr   r2, =start
+	add   r2, r2, r10
+	str   r2, [r0, #(V2M_SYS_FLAGSSET)]
+	dsb
+	/* send an interrupt */
+	ldr   r0, =(GIC_BASE_ADDRESS + GIC_DR_OFFSET) /* base GICD MMIO address */
+	mov   r2, #0x1
+	str   r2, [r0, #(GICD_CTLR * 4)]      /* enable distributor */
+	mov   r2, #0xfe0000
+	str   r2, [r0, #(GICD_SGIR * 4)]      /* send IPI to everybody */
+	dsb
+	str   r2, [r0, #(GICD_CTLR * 4)]      /* disable distributor */
+	mov   pc, lr
+
 
 /* Get up a CPU into Hyp mode.  Clobbers r0-r3.
  *
diff -r 5718bbed558b -r 321f8487379b xen/include/asm-arm/platform_vexpress.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/platform_vexpress.h	Thu Nov 15 10:25:29 2012 +0000
@@ -0,0 +1,17 @@
+#ifndef __ASM_ARM_PLATFORM_H
+#define __ASM_ARM_PLATFORM_H
+
+/* V2M */
+#define V2M_SYS_MMIO_BASE     (0x1c010000)
+#define V2M_SYS_FLAGSSET      (0x30)
+#define V2M_SYS_FLAGSCLR      (0x34)
+
+#endif /* __ASM_ARM_PLATFORM_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.xen.org
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xen.org Fri Nov 16 03:33:42 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Nov 2012 03:33: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.xen.org>)
	id 1TZCgU-0002zr-Ec; Fri, 16 Nov 2012 03:33:38 +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 1TZCgS-0002zO-34
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:36 +0000
Received: from [85.158.143.99:50539] by server-3.bemta-4.messagelabs.com id
	C9/9A-06841-F04B5A05; Fri, 16 Nov 2012 03:33:35 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-216.messagelabs.com!1353036813!29568473!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30478 invoked from network); 16 Nov 2012 03:33:34 -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;
	16 Nov 2012 03:33: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 1TZCg3-0005uY-Ie
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZCg3-0007mO-Ca
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:11 +0000
Message-Id: <E1TZCg3-0007mO-Ca@xenbits.xen.org>
Date: Fri, 16 Nov 2012 03:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen/arm: set the SMP bit in the
	ACTLR register
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1352975128 0
# Node ID 5718bbed558b524b3f2e431ba01ea2a99910f173
# Parent  999fae11df23f6304025c2adf17d46c1d9842976
xen/arm: set the SMP bit in the ACTLR register

"Enables the processor to receive instruction cache, BTB, and TLB maintenance
operations from other processors"

...

"You must set this bit before enabling the caches and MMU, or
performing any cache and TLB maintenance operations. The only time
you must clear this bit is during a processor power-down sequence"

Signed-off-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 999fae11df23 -r 5718bbed558b xen/arch/arm/Makefile
--- a/xen/arch/arm/Makefile	Thu Nov 15 10:25:27 2012 +0000
+++ b/xen/arch/arm/Makefile	Thu Nov 15 10:25:28 2012 +0000
@@ -13,6 +13,7 @@ obj-y += irq.o
 obj-y += kernel.o
 obj-y += mm.o
 obj-y += mode_switch.o
+obj-y += proc-ca15.o
 obj-y += p2m.o
 obj-y += percpu.o
 obj-y += guestcopy.o
diff -r 999fae11df23 -r 5718bbed558b xen/arch/arm/head.S
--- a/xen/arch/arm/head.S	Thu Nov 15 10:25:27 2012 +0000
+++ b/xen/arch/arm/head.S	Thu Nov 15 10:25:28 2012 +0000
@@ -19,6 +19,7 @@
 
 #include <asm/config.h>
 #include <asm/page.h>
+#include <asm/processor-ca15.h>
 #include <asm/asm_defns.h>
 
 #define PT_PT  0xe7f /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=1, P=1 */
@@ -148,6 +149,15 @@ skip_bss:
 
 	PRINT("- Setting up control registers -\r\n")
 	
+	/* Read CPU ID */
+	mrc   CP32(r0, MIDR)
+	ldr   r1, =(MIDR_MASK)
+	and   r0, r0, r1
+	/* Is this a Cortex A15? */
+	ldr   r1, =(CORTEX_A15_ID)
+	teq   r0, r1
+	bleq  cortex_a15_init
+
 	/* Set up memory attribute type tables */
 	ldr   r0, =MAIR0VAL
 	ldr   r1, =MAIR1VAL
diff -r 999fae11df23 -r 5718bbed558b xen/arch/arm/proc-ca15.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/proc-ca15.S	Thu Nov 15 10:25:28 2012 +0000
@@ -0,0 +1,28 @@
+/*
+ * xen/arch/arm/proc-ca15.S
+ *
+ * Cortex A15 specific initializations
+ *
+ * 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/asm_defns.h>
+#include <asm/processor-ca15.h>
+
+.globl cortex_a15_init
+cortex_a15_init:
+	/* Set up the SMP bit in ACTLR */
+	mrc   CP32(r0, ACTLR)
+	orr   r0, r0, #(ACTLR_CA15_SMP) /* enable SMP bit*/
+	mcr   CP32(r0, ACTLR)
+	mov   pc, lr
diff -r 999fae11df23 -r 5718bbed558b xen/include/asm-arm/cpregs.h
--- a/xen/include/asm-arm/cpregs.h	Thu Nov 15 10:25:27 2012 +0000
+++ b/xen/include/asm-arm/cpregs.h	Thu Nov 15 10:25:28 2012 +0000
@@ -104,6 +104,7 @@
 /* Coprocessor 15 */
 
 /* CP15 CR0: CPUID and Cache Type Registers */
+#define MIDR            p15,0,c0,c0,0   /* Main ID Register */
 #define MPIDR           p15,0,c0,c0,5   /* Multiprocessor Affinity Register */
 #define ID_PFR0         p15,0,c0,c1,0   /* Processor Feature Register 0 */
 #define ID_PFR1         p15,0,c0,c1,1   /* Processor Feature Register 1 */
diff -r 999fae11df23 -r 5718bbed558b xen/include/asm-arm/processor-ca15.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/processor-ca15.h	Thu Nov 15 10:25:28 2012 +0000
@@ -0,0 +1,45 @@
+#ifndef __ASM_ARM_PROCESSOR_CA15_H
+#define __ASM_ARM_PROCESSOR_CA15_H
+
+
+#define CORTEX_A15_ID     (0x410FC0F0)
+
+/* ACTLR Auxiliary Control Register, Cortex A15 */
+#define ACTLR_CA15_SNOOP_DELAYED      (1<<31)
+#define ACTLR_CA15_MAIN_CLOCK         (1<<30)
+#define ACTLR_CA15_NEON_CLOCK         (1<<29)
+#define ACTLR_CA15_NONCACHE           (1<<24)
+#define ACTLR_CA15_INORDER_REQ        (1<<23)
+#define ACTLR_CA15_INORDER_LOAD       (1<<22)
+#define ACTLR_CA15_L2_TLB_PREFETCH    (1<<21)
+#define ACTLR_CA15_L2_IPA_PA_CACHE    (1<<20)
+#define ACTLR_CA15_L2_CACHE           (1<<19)
+#define ACTLR_CA15_L2_PA_CACHE        (1<<18)
+#define ACTLR_CA15_TLB                (1<<17)
+#define ACTLR_CA15_STRONGY_ORDERED    (1<<16)
+#define ACTLR_CA15_INORDER            (1<<15)
+#define ACTLR_CA15_FORCE_LIM          (1<<14)
+#define ACTLR_CA15_CP_FLUSH           (1<<13)
+#define ACTLR_CA15_CP_PUSH            (1<<12)
+#define ACTLR_CA15_LIM                (1<<11)
+#define ACTLR_CA15_SER                (1<<10)
+#define ACTLR_CA15_OPT                (1<<9)
+#define ACTLR_CA15_WFI                (1<<8)
+#define ACTLR_CA15_WFE                (1<<7)
+#define ACTLR_CA15_SMP                (1<<6)
+#define ACTLR_CA15_PLD                (1<<5)
+#define ACTLR_CA15_IP                 (1<<4)
+#define ACTLR_CA15_MICRO_BTB          (1<<3)
+#define ACTLR_CA15_LOOP_ONE           (1<<2)
+#define ACTLR_CA15_LOOP_DISABLE       (1<<1)
+#define ACTLR_CA15_BTB                (1<<0)
+
+#endif /* __ASM_ARM_PROCESSOR_CA15_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 999fae11df23 -r 5718bbed558b xen/include/asm-arm/processor.h
--- a/xen/include/asm-arm/processor.h	Thu Nov 15 10:25:27 2012 +0000
+++ b/xen/include/asm-arm/processor.h	Thu Nov 15 10:25:28 2012 +0000
@@ -3,6 +3,9 @@
 
 #include <asm/cpregs.h>
 
+/* MIDR Main ID Register */
+#define MIDR_MASK    0xff0ffff0
+
 /* TTBCR Translation Table Base Control Register */
 #define TTBCR_EAE    0x80000000
 #define TTBCR_N_MASK 0x07

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

From xen-changelog-bounces@lists.xen.org Fri Nov 16 03:33:42 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Nov 2012 03:33: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.xen.org>)
	id 1TZCgU-0002zr-Ec; Fri, 16 Nov 2012 03:33:38 +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 1TZCgS-0002zO-34
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:36 +0000
Received: from [85.158.143.99:50539] by server-3.bemta-4.messagelabs.com id
	C9/9A-06841-F04B5A05; Fri, 16 Nov 2012 03:33:35 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-216.messagelabs.com!1353036813!29568473!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30478 invoked from network); 16 Nov 2012 03:33:34 -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;
	16 Nov 2012 03:33: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 1TZCg3-0005uY-Ie
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZCg3-0007mO-Ca
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:11 +0000
Message-Id: <E1TZCg3-0007mO-Ca@xenbits.xen.org>
Date: Fri, 16 Nov 2012 03:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen/arm: set the SMP bit in the
	ACTLR register
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1352975128 0
# Node ID 5718bbed558b524b3f2e431ba01ea2a99910f173
# Parent  999fae11df23f6304025c2adf17d46c1d9842976
xen/arm: set the SMP bit in the ACTLR register

"Enables the processor to receive instruction cache, BTB, and TLB maintenance
operations from other processors"

...

"You must set this bit before enabling the caches and MMU, or
performing any cache and TLB maintenance operations. The only time
you must clear this bit is during a processor power-down sequence"

Signed-off-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 999fae11df23 -r 5718bbed558b xen/arch/arm/Makefile
--- a/xen/arch/arm/Makefile	Thu Nov 15 10:25:27 2012 +0000
+++ b/xen/arch/arm/Makefile	Thu Nov 15 10:25:28 2012 +0000
@@ -13,6 +13,7 @@ obj-y += irq.o
 obj-y += kernel.o
 obj-y += mm.o
 obj-y += mode_switch.o
+obj-y += proc-ca15.o
 obj-y += p2m.o
 obj-y += percpu.o
 obj-y += guestcopy.o
diff -r 999fae11df23 -r 5718bbed558b xen/arch/arm/head.S
--- a/xen/arch/arm/head.S	Thu Nov 15 10:25:27 2012 +0000
+++ b/xen/arch/arm/head.S	Thu Nov 15 10:25:28 2012 +0000
@@ -19,6 +19,7 @@
 
 #include <asm/config.h>
 #include <asm/page.h>
+#include <asm/processor-ca15.h>
 #include <asm/asm_defns.h>
 
 #define PT_PT  0xe7f /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=1, P=1 */
@@ -148,6 +149,15 @@ skip_bss:
 
 	PRINT("- Setting up control registers -\r\n")
 	
+	/* Read CPU ID */
+	mrc   CP32(r0, MIDR)
+	ldr   r1, =(MIDR_MASK)
+	and   r0, r0, r1
+	/* Is this a Cortex A15? */
+	ldr   r1, =(CORTEX_A15_ID)
+	teq   r0, r1
+	bleq  cortex_a15_init
+
 	/* Set up memory attribute type tables */
 	ldr   r0, =MAIR0VAL
 	ldr   r1, =MAIR1VAL
diff -r 999fae11df23 -r 5718bbed558b xen/arch/arm/proc-ca15.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/proc-ca15.S	Thu Nov 15 10:25:28 2012 +0000
@@ -0,0 +1,28 @@
+/*
+ * xen/arch/arm/proc-ca15.S
+ *
+ * Cortex A15 specific initializations
+ *
+ * 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/asm_defns.h>
+#include <asm/processor-ca15.h>
+
+.globl cortex_a15_init
+cortex_a15_init:
+	/* Set up the SMP bit in ACTLR */
+	mrc   CP32(r0, ACTLR)
+	orr   r0, r0, #(ACTLR_CA15_SMP) /* enable SMP bit*/
+	mcr   CP32(r0, ACTLR)
+	mov   pc, lr
diff -r 999fae11df23 -r 5718bbed558b xen/include/asm-arm/cpregs.h
--- a/xen/include/asm-arm/cpregs.h	Thu Nov 15 10:25:27 2012 +0000
+++ b/xen/include/asm-arm/cpregs.h	Thu Nov 15 10:25:28 2012 +0000
@@ -104,6 +104,7 @@
 /* Coprocessor 15 */
 
 /* CP15 CR0: CPUID and Cache Type Registers */
+#define MIDR            p15,0,c0,c0,0   /* Main ID Register */
 #define MPIDR           p15,0,c0,c0,5   /* Multiprocessor Affinity Register */
 #define ID_PFR0         p15,0,c0,c1,0   /* Processor Feature Register 0 */
 #define ID_PFR1         p15,0,c0,c1,1   /* Processor Feature Register 1 */
diff -r 999fae11df23 -r 5718bbed558b xen/include/asm-arm/processor-ca15.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/processor-ca15.h	Thu Nov 15 10:25:28 2012 +0000
@@ -0,0 +1,45 @@
+#ifndef __ASM_ARM_PROCESSOR_CA15_H
+#define __ASM_ARM_PROCESSOR_CA15_H
+
+
+#define CORTEX_A15_ID     (0x410FC0F0)
+
+/* ACTLR Auxiliary Control Register, Cortex A15 */
+#define ACTLR_CA15_SNOOP_DELAYED      (1<<31)
+#define ACTLR_CA15_MAIN_CLOCK         (1<<30)
+#define ACTLR_CA15_NEON_CLOCK         (1<<29)
+#define ACTLR_CA15_NONCACHE           (1<<24)
+#define ACTLR_CA15_INORDER_REQ        (1<<23)
+#define ACTLR_CA15_INORDER_LOAD       (1<<22)
+#define ACTLR_CA15_L2_TLB_PREFETCH    (1<<21)
+#define ACTLR_CA15_L2_IPA_PA_CACHE    (1<<20)
+#define ACTLR_CA15_L2_CACHE           (1<<19)
+#define ACTLR_CA15_L2_PA_CACHE        (1<<18)
+#define ACTLR_CA15_TLB                (1<<17)
+#define ACTLR_CA15_STRONGY_ORDERED    (1<<16)
+#define ACTLR_CA15_INORDER            (1<<15)
+#define ACTLR_CA15_FORCE_LIM          (1<<14)
+#define ACTLR_CA15_CP_FLUSH           (1<<13)
+#define ACTLR_CA15_CP_PUSH            (1<<12)
+#define ACTLR_CA15_LIM                (1<<11)
+#define ACTLR_CA15_SER                (1<<10)
+#define ACTLR_CA15_OPT                (1<<9)
+#define ACTLR_CA15_WFI                (1<<8)
+#define ACTLR_CA15_WFE                (1<<7)
+#define ACTLR_CA15_SMP                (1<<6)
+#define ACTLR_CA15_PLD                (1<<5)
+#define ACTLR_CA15_IP                 (1<<4)
+#define ACTLR_CA15_MICRO_BTB          (1<<3)
+#define ACTLR_CA15_LOOP_ONE           (1<<2)
+#define ACTLR_CA15_LOOP_DISABLE       (1<<1)
+#define ACTLR_CA15_BTB                (1<<0)
+
+#endif /* __ASM_ARM_PROCESSOR_CA15_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 999fae11df23 -r 5718bbed558b xen/include/asm-arm/processor.h
--- a/xen/include/asm-arm/processor.h	Thu Nov 15 10:25:27 2012 +0000
+++ b/xen/include/asm-arm/processor.h	Thu Nov 15 10:25:28 2012 +0000
@@ -3,6 +3,9 @@
 
 #include <asm/cpregs.h>
 
+/* MIDR Main ID Register */
+#define MIDR_MASK    0xff0ffff0
+
 /* TTBCR Translation Table Base Control Register */
 #define TTBCR_EAE    0x80000000
 #define TTBCR_N_MASK 0x07

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

From xen-changelog-bounces@lists.xen.org Fri Nov 16 03:33:47 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Nov 2012 03:33: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.xen.org>)
	id 1TZCgb-00031M-Hl; Fri, 16 Nov 2012 03:33:45 +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 1TZCgZ-00030e-R1
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:44 +0000
Received: from [85.158.143.35:14795] by server-3.bemta-4.messagelabs.com id
	29/AA-06841-614B5A05; Fri, 16 Nov 2012 03:33:42 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1353036819!11730066!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12887 invoked from network); 16 Nov 2012 03:33:41 -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;
	16 Nov 2012 03:33: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 1TZCg2-0005uP-2k
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZCg1-0007le-RO
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:09 +0000
Message-Id: <E1TZCg1-0007le-RO@xenbits.xen.org>
Date: Fri, 16 Nov 2012 03:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen/arm: pass the correct
	bit-per-interrupt argument to vgic_irq_rank
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1352975126 0
# Node ID 008726e63e7df24a4c9fdb06fc7ee1a2c5c1cf81
# Parent  babb84d9a82efb0a59d26853323fc4af93afcd1f
xen/arm: pass the correct bit-per-interrupt argument to vgic_irq_rank

Use 1 for registers that have 1 bit per irq.

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 babb84d9a82e -r 008726e63e7d xen/arch/arm/vgic.c
--- a/xen/arch/arm/vgic.c	Thu Nov 15 10:25:25 2012 +0000
+++ b/xen/arch/arm/vgic.c	Thu Nov 15 10:25:26 2012 +0000
@@ -47,6 +47,7 @@ static inline int REG_RANK_NR(int b, uin
     case 8: return n >> 3;
     case 4: return n >> 2;
     case 2: return n >> 1;
+    case 1: return n;
     default: BUG();
     }
 }
@@ -199,7 +200,7 @@ static int vgic_distr_mmio_read(struct v
 
     case GICD_ISENABLER ... GICD_ISENABLERN:
         if ( dabt.size != 2 ) goto bad_width;
-        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ISENABLER);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ISENABLER);
         if ( rank == NULL) goto read_as_zero;
         vgic_lock_rank(v, rank);
         *r = rank->ienable;
@@ -208,7 +209,7 @@ static int vgic_distr_mmio_read(struct v
 
     case GICD_ICENABLER ... GICD_ICENABLERN:
         if ( dabt.size != 2 ) goto bad_width;
-        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ICENABLER);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ICENABLER);
         if ( rank == NULL) goto read_as_zero;
         vgic_lock_rank(v, rank);
         *r = rank->ienable;
@@ -217,7 +218,7 @@ static int vgic_distr_mmio_read(struct v
 
     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);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ISPENDR);
         if ( rank == NULL) goto read_as_zero;
         vgic_lock_rank(v, rank);
         *r = byte_read(rank->ipend, dabt.sign, offset);
@@ -226,7 +227,7 @@ static int vgic_distr_mmio_read(struct v
 
     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);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ICPENDR);
         if ( rank == NULL) goto read_as_zero;
         vgic_lock_rank(v, rank);
         *r = byte_read(rank->ipend, dabt.sign, offset);
@@ -235,7 +236,7 @@ static int vgic_distr_mmio_read(struct v
 
     case GICD_ISACTIVER ... GICD_ISACTIVERN:
         if ( dabt.size != 2 ) goto bad_width;
-        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ISACTIVER);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ISACTIVER);
         if ( rank == NULL) goto read_as_zero;
         vgic_lock_rank(v, rank);
         *r = rank->iactive;
@@ -244,7 +245,7 @@ static int vgic_distr_mmio_read(struct v
 
     case GICD_ICACTIVER ... GICD_ICACTIVERN:
         if ( dabt.size != 2 ) goto bad_width;
-        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ICACTIVER);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ICACTIVER);
         if ( rank == NULL) goto read_as_zero;
         vgic_lock_rank(v, rank);
         *r = rank->iactive;
@@ -296,7 +297,7 @@ static int vgic_distr_mmio_read(struct v
 
     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);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_CPENDSGIR);
         if ( rank == NULL) goto read_as_zero;
         vgic_lock_rank(v, rank);
         *r = byte_read(rank->pendsgi, dabt.sign, offset);
@@ -305,7 +306,7 @@ static int vgic_distr_mmio_read(struct v
 
     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);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_SPENDSGIR);
         if ( rank == NULL) goto read_as_zero;
         vgic_lock_rank(v, rank);
         *r = byte_read(rank->pendsgi, dabt.sign, offset);
@@ -400,7 +401,7 @@ static int vgic_distr_mmio_write(struct 
 
     case GICD_ISENABLER ... GICD_ISENABLERN:
         if ( dabt.size != 2 ) goto bad_width;
-        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ISENABLER);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ISENABLER);
         if ( rank == NULL) goto write_ignore;
         vgic_lock_rank(v, rank);
         tr = rank->ienable;
@@ -411,7 +412,7 @@ static int vgic_distr_mmio_write(struct 
 
     case GICD_ICENABLER ... GICD_ICENABLERN:
         if ( dabt.size != 2 ) goto bad_width;
-        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ICENABLER);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ICENABLER);
         if ( rank == NULL) goto write_ignore;
         vgic_lock_rank(v, rank);
         rank->ienable &= ~*r;
@@ -432,7 +433,7 @@ static int vgic_distr_mmio_write(struct 
 
     case GICD_ISACTIVER ... GICD_ISACTIVERN:
         if ( dabt.size != 2 ) goto bad_width;
-        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ISACTIVER);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ISACTIVER);
         if ( rank == NULL) goto write_ignore;
         vgic_lock_rank(v, rank);
         rank->iactive &= ~*r;
@@ -441,7 +442,7 @@ static int vgic_distr_mmio_write(struct 
 
     case GICD_ICACTIVER ... GICD_ICACTIVERN:
         if ( dabt.size != 2 ) goto bad_width;
-        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ICACTIVER);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ICACTIVER);
         if ( rank == NULL) goto write_ignore;
         vgic_lock_rank(v, rank);
         rank->iactive &= ~*r;

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

From xen-changelog-bounces@lists.xen.org Fri Nov 16 03:33:47 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Nov 2012 03:33: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.xen.org>)
	id 1TZCgb-00031M-Hl; Fri, 16 Nov 2012 03:33:45 +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 1TZCgZ-00030e-R1
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:44 +0000
Received: from [85.158.143.35:14795] by server-3.bemta-4.messagelabs.com id
	29/AA-06841-614B5A05; Fri, 16 Nov 2012 03:33:42 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1353036819!11730066!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12887 invoked from network); 16 Nov 2012 03:33:41 -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;
	16 Nov 2012 03:33: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 1TZCg2-0005uP-2k
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZCg1-0007le-RO
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:09 +0000
Message-Id: <E1TZCg1-0007le-RO@xenbits.xen.org>
Date: Fri, 16 Nov 2012 03:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen/arm: pass the correct
	bit-per-interrupt argument to vgic_irq_rank
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1352975126 0
# Node ID 008726e63e7df24a4c9fdb06fc7ee1a2c5c1cf81
# Parent  babb84d9a82efb0a59d26853323fc4af93afcd1f
xen/arm: pass the correct bit-per-interrupt argument to vgic_irq_rank

Use 1 for registers that have 1 bit per irq.

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 babb84d9a82e -r 008726e63e7d xen/arch/arm/vgic.c
--- a/xen/arch/arm/vgic.c	Thu Nov 15 10:25:25 2012 +0000
+++ b/xen/arch/arm/vgic.c	Thu Nov 15 10:25:26 2012 +0000
@@ -47,6 +47,7 @@ static inline int REG_RANK_NR(int b, uin
     case 8: return n >> 3;
     case 4: return n >> 2;
     case 2: return n >> 1;
+    case 1: return n;
     default: BUG();
     }
 }
@@ -199,7 +200,7 @@ static int vgic_distr_mmio_read(struct v
 
     case GICD_ISENABLER ... GICD_ISENABLERN:
         if ( dabt.size != 2 ) goto bad_width;
-        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ISENABLER);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ISENABLER);
         if ( rank == NULL) goto read_as_zero;
         vgic_lock_rank(v, rank);
         *r = rank->ienable;
@@ -208,7 +209,7 @@ static int vgic_distr_mmio_read(struct v
 
     case GICD_ICENABLER ... GICD_ICENABLERN:
         if ( dabt.size != 2 ) goto bad_width;
-        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ICENABLER);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ICENABLER);
         if ( rank == NULL) goto read_as_zero;
         vgic_lock_rank(v, rank);
         *r = rank->ienable;
@@ -217,7 +218,7 @@ static int vgic_distr_mmio_read(struct v
 
     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);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ISPENDR);
         if ( rank == NULL) goto read_as_zero;
         vgic_lock_rank(v, rank);
         *r = byte_read(rank->ipend, dabt.sign, offset);
@@ -226,7 +227,7 @@ static int vgic_distr_mmio_read(struct v
 
     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);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ICPENDR);
         if ( rank == NULL) goto read_as_zero;
         vgic_lock_rank(v, rank);
         *r = byte_read(rank->ipend, dabt.sign, offset);
@@ -235,7 +236,7 @@ static int vgic_distr_mmio_read(struct v
 
     case GICD_ISACTIVER ... GICD_ISACTIVERN:
         if ( dabt.size != 2 ) goto bad_width;
-        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ISACTIVER);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ISACTIVER);
         if ( rank == NULL) goto read_as_zero;
         vgic_lock_rank(v, rank);
         *r = rank->iactive;
@@ -244,7 +245,7 @@ static int vgic_distr_mmio_read(struct v
 
     case GICD_ICACTIVER ... GICD_ICACTIVERN:
         if ( dabt.size != 2 ) goto bad_width;
-        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ICACTIVER);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ICACTIVER);
         if ( rank == NULL) goto read_as_zero;
         vgic_lock_rank(v, rank);
         *r = rank->iactive;
@@ -296,7 +297,7 @@ static int vgic_distr_mmio_read(struct v
 
     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);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_CPENDSGIR);
         if ( rank == NULL) goto read_as_zero;
         vgic_lock_rank(v, rank);
         *r = byte_read(rank->pendsgi, dabt.sign, offset);
@@ -305,7 +306,7 @@ static int vgic_distr_mmio_read(struct v
 
     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);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_SPENDSGIR);
         if ( rank == NULL) goto read_as_zero;
         vgic_lock_rank(v, rank);
         *r = byte_read(rank->pendsgi, dabt.sign, offset);
@@ -400,7 +401,7 @@ static int vgic_distr_mmio_write(struct 
 
     case GICD_ISENABLER ... GICD_ISENABLERN:
         if ( dabt.size != 2 ) goto bad_width;
-        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ISENABLER);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ISENABLER);
         if ( rank == NULL) goto write_ignore;
         vgic_lock_rank(v, rank);
         tr = rank->ienable;
@@ -411,7 +412,7 @@ static int vgic_distr_mmio_write(struct 
 
     case GICD_ICENABLER ... GICD_ICENABLERN:
         if ( dabt.size != 2 ) goto bad_width;
-        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ICENABLER);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ICENABLER);
         if ( rank == NULL) goto write_ignore;
         vgic_lock_rank(v, rank);
         rank->ienable &= ~*r;
@@ -432,7 +433,7 @@ static int vgic_distr_mmio_write(struct 
 
     case GICD_ISACTIVER ... GICD_ISACTIVERN:
         if ( dabt.size != 2 ) goto bad_width;
-        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ISACTIVER);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ISACTIVER);
         if ( rank == NULL) goto write_ignore;
         vgic_lock_rank(v, rank);
         rank->iactive &= ~*r;
@@ -441,7 +442,7 @@ static int vgic_distr_mmio_write(struct 
 
     case GICD_ICACTIVER ... GICD_ICACTIVERN:
         if ( dabt.size != 2 ) goto bad_width;
-        rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ICACTIVER);
+        rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ICACTIVER);
         if ( rank == NULL) goto write_ignore;
         vgic_lock_rank(v, rank);
         rank->iactive &= ~*r;

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

From xen-changelog-bounces@lists.xen.org Fri Nov 16 03:34:14 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Nov 2012 03:34: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.xen.org>)
	id 1TZCh3-00035o-N9; Fri, 16 Nov 2012 03:34:13 +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 1TZCh3-00035c-0O
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:34:13 +0000
Received: from [85.158.138.51:13243] by server-13.bemta-3.messagelabs.com id
	DD/BC-24887-434B5A05; Fri, 16 Nov 2012 03:34:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-174.messagelabs.com!1353036850!22202771!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14816 invoked from network); 16 Nov 2012 03:34:11 -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;
	16 Nov 2012 03:34: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 1TZCg3-0005uV-7K
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZCg2-0007m9-S8
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:10 +0000
Message-Id: <E1TZCg2-0007m9-S8@xenbits.xen.org>
Date: Fri, 16 Nov 2012 03:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] pl011: set baud and clock_hz to the
	right defaults for Versatile Express
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1352975127 0
# Node ID 999fae11df23f6304025c2adf17d46c1d9842976
# Parent  2312d29744e35bf8693456d1ab27cf1e4117b827
pl011: set baud and clock_hz to the right defaults for Versatile Express

Signed-off-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 2312d29744e3 -r 999fae11df23 xen/drivers/char/pl011.c
--- a/xen/drivers/char/pl011.c	Thu Nov 15 10:25:26 2012 +0000
+++ b/xen/drivers/char/pl011.c	Thu Nov 15 10:25:27 2012 +0000
@@ -241,8 +241,8 @@ void __init pl011_init(int index, unsign
 
     uart = &pl011_com[index];
 
-    uart->clock_hz  = 7372800;
-    uart->baud      = 115200;
+    uart->clock_hz  = 0x16e3600;
+    uart->baud      = 38400;
     uart->data_bits = 8;
     uart->parity    = PARITY_NONE;
     uart->stop_bits = 1;

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

From xen-changelog-bounces@lists.xen.org Fri Nov 16 03:34:14 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Nov 2012 03:34: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.xen.org>)
	id 1TZCh3-00035o-N9; Fri, 16 Nov 2012 03:34:13 +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 1TZCh3-00035c-0O
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:34:13 +0000
Received: from [85.158.138.51:13243] by server-13.bemta-3.messagelabs.com id
	DD/BC-24887-434B5A05; Fri, 16 Nov 2012 03:34:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-174.messagelabs.com!1353036850!22202771!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14816 invoked from network); 16 Nov 2012 03:34:11 -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;
	16 Nov 2012 03:34: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 1TZCg3-0005uV-7K
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZCg2-0007m9-S8
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:10 +0000
Message-Id: <E1TZCg2-0007m9-S8@xenbits.xen.org>
Date: Fri, 16 Nov 2012 03:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] pl011: set baud and clock_hz to the
	right defaults for Versatile Express
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1352975127 0
# Node ID 999fae11df23f6304025c2adf17d46c1d9842976
# Parent  2312d29744e35bf8693456d1ab27cf1e4117b827
pl011: set baud and clock_hz to the right defaults for Versatile Express

Signed-off-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 2312d29744e3 -r 999fae11df23 xen/drivers/char/pl011.c
--- a/xen/drivers/char/pl011.c	Thu Nov 15 10:25:26 2012 +0000
+++ b/xen/drivers/char/pl011.c	Thu Nov 15 10:25:27 2012 +0000
@@ -241,8 +241,8 @@ void __init pl011_init(int index, unsign
 
     uart = &pl011_com[index];
 
-    uart->clock_hz  = 7372800;
-    uart->baud      = 115200;
+    uart->clock_hz  = 0x16e3600;
+    uart->baud      = 38400;
     uart->data_bits = 8;
     uart->parity    = PARITY_NONE;
     uart->stop_bits = 1;

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

From xen-changelog-bounces@lists.xen.org Fri Nov 16 03:34:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Nov 2012 03:34: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 1TZCh6-00036W-Q4; Fri, 16 Nov 2012 03:34:16 +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 1TZCh5-00036G-E3
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:34:15 +0000
Received: from [85.158.143.35:40739] by server-1.bemta-4.messagelabs.com id
	E8/22-27934-634B5A05; Fri, 16 Nov 2012 03:34:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1353036849!7513552!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10842 invoked from network); 16 Nov 2012 03:34:10 -0000
Received: from unknown (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	16 Nov 2012 03:34: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 1TZCg2-0005uS-GK
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZCg2-0007lt-Bh
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:10 +0000
Message-Id: <E1TZCg2-0007lt-Bh@xenbits.xen.org>
Date: Fri, 16 Nov 2012 03:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen/arm: setup the fixmap in head.S
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1352975126 0
# Node ID 2312d29744e35bf8693456d1ab27cf1e4117b827
# Parent  008726e63e7df24a4c9fdb06fc7ee1a2c5c1cf81
xen/arm: setup the fixmap in head.S

Setup the fixmap mapping directly in head.S rather than having a
temporary mapping only to re-do it later in C.

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 008726e63e7d -r 2312d29744e3 xen/arch/arm/early_printk.c
--- a/xen/arch/arm/early_printk.c	Thu Nov 15 10:25:26 2012 +0000
+++ b/xen/arch/arm/early_printk.c	Thu Nov 15 10:25:26 2012 +0000
@@ -17,12 +17,11 @@
 
 #ifdef EARLY_UART_ADDRESS
 
-static void __init early_putch(char c)
+void __init early_putch(char c)
 {
     volatile uint32_t *r;
 
-    r = (uint32_t *)((EARLY_UART_ADDRESS & 0x001fffff)
-                     + XEN_VIRT_START + (1 << 21));
+    r = (uint32_t *)(XEN_VIRT_START + (1 << 21));
 
     /* XXX: assuming a PL011 UART. */
     while(*(r + 0x6) & 0x8)
diff -r 008726e63e7d -r 2312d29744e3 xen/arch/arm/head.S
--- a/xen/arch/arm/head.S	Thu Nov 15 10:25:26 2012 +0000
+++ b/xen/arch/arm/head.S	Thu Nov 15 10:25:26 2012 +0000
@@ -24,6 +24,7 @@
 #define PT_PT  0xe7f /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=1, P=1 */
 #define PT_MEM 0xe7d /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=0, P=1 */
 #define PT_DEV 0xe71 /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=100, T=0, P=1 */
+#define PT_DEV_L3 0xe73 /* lev3: nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=100, T=1, P=1 */
 
 #define PT_UPPER(x) (PT_##x & 0xf00)
 #define PT_LOWER(x) (PT_##x & 0x0ff)
@@ -183,6 +184,18 @@ skip_bss:
 	teq   r12, #0
 	bne   pt_ready
 	
+	/* console fixmap */
+#ifdef EARLY_UART_ADDRESS
+	ldr   r1, =xen_fixmap
+	add   r1, r1, r10            /* r1 := paddr (xen_fixmap) */
+	mov   r3, #0
+	lsr   r2, r11, #12
+	lsl   r2, r2, #12            /* 4K aligned paddr of UART */
+	orr   r2, r2, #PT_UPPER(DEV_L3)
+	orr   r2, r2, #PT_LOWER(DEV_L3) /* r2:r3 := 4K dev map including UART */
+	strd  r2, r3, [r1, #(FIXMAP_CONSOLE*8)] /* Map it in the first fixmap's slot */
+#endif
+
 	/* Build the baseline idle pagetable's first-level entries */
 	ldr   r1, =xen_second
 	add   r1, r1, r10            /* r1 := paddr (xen_second) */
@@ -205,17 +218,15 @@ skip_bss:
 	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, #PT_UPPER(DEV)
-	orr   r2, r2, #PT_LOWER(DEV) /* r2:r3 := 2MB dev map including UART */
+
+	/* xen_fixmap pagetable */
+	ldr   r2, =xen_fixmap
+	add   r2, r2, r10            /* r2 := paddr (xen_fixmap) */
+	orr   r2, r2, #PT_UPPER(PT)
+	orr   r2, r2, #PT_LOWER(PT)  /* r2:r3 := table map of xen_fixmap */
 	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 */
@@ -236,13 +247,10 @@ pt_ready:
 	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) */
+	/* Use a virtual address to access the UART. */
+	ldr   r11, =FIXMAP_ADDR(FIXMAP_CONSOLE)
 #endif
 
 	PRINT("- Ready -\r\n")
@@ -261,8 +269,6 @@ paging:
 	mcr   CP32(r0, BPIALL)       /* Flush branch predictor */
 	dsb                          /* Ensure completion of TLB+BP flush */
 	isb
- 	/* Now, the UART is in its proper fixmap address */
-	ldrne r11, =FIXMAP_ADDR(FIXMAP_CONSOLE)
 
 	/* Non-boot CPUs report that they've got this far */
 	ldr   r0, =ready_cpus
diff -r 008726e63e7d -r 2312d29744e3 xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c	Thu Nov 15 10:25:26 2012 +0000
+++ b/xen/arch/arm/mm.c	Thu Nov 15 10:25:26 2012 +0000
@@ -40,7 +40,7 @@ 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)));
+lpae_t xen_fixmap[LPAE_ENTRIES] __attribute__((__aligned__(4096)));
 static lpae_t xen_xenmap[LPAE_ENTRIES] __attribute__((__aligned__(4096)));
 
 /* Non-boot CPUs use this to find the correct pagetables. */
diff -r 008726e63e7d -r 2312d29744e3 xen/arch/arm/setup.c
--- a/xen/arch/arm/setup.c	Thu Nov 15 10:25:26 2012 +0000
+++ b/xen/arch/arm/setup.c	Thu Nov 15 10:25:26 2012 +0000
@@ -194,9 +194,7 @@ void __init start_xen(unsigned long boot
     setup_pagetables(boot_phys_offset, get_xen_paddr());
 
 #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

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

From xen-changelog-bounces@lists.xen.org Fri Nov 16 03:34:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Nov 2012 03:34: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 1TZCh6-00036W-Q4; Fri, 16 Nov 2012 03:34:16 +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 1TZCh5-00036G-E3
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:34:15 +0000
Received: from [85.158.143.35:40739] by server-1.bemta-4.messagelabs.com id
	E8/22-27934-634B5A05; Fri, 16 Nov 2012 03:34:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1353036849!7513552!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10842 invoked from network); 16 Nov 2012 03:34:10 -0000
Received: from unknown (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	16 Nov 2012 03:34: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 1TZCg2-0005uS-GK
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZCg2-0007lt-Bh
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 03:33:10 +0000
Message-Id: <E1TZCg2-0007lt-Bh@xenbits.xen.org>
Date: Fri, 16 Nov 2012 03:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen/arm: setup the fixmap in head.S
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1352975126 0
# Node ID 2312d29744e35bf8693456d1ab27cf1e4117b827
# Parent  008726e63e7df24a4c9fdb06fc7ee1a2c5c1cf81
xen/arm: setup the fixmap in head.S

Setup the fixmap mapping directly in head.S rather than having a
temporary mapping only to re-do it later in C.

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 008726e63e7d -r 2312d29744e3 xen/arch/arm/early_printk.c
--- a/xen/arch/arm/early_printk.c	Thu Nov 15 10:25:26 2012 +0000
+++ b/xen/arch/arm/early_printk.c	Thu Nov 15 10:25:26 2012 +0000
@@ -17,12 +17,11 @@
 
 #ifdef EARLY_UART_ADDRESS
 
-static void __init early_putch(char c)
+void __init early_putch(char c)
 {
     volatile uint32_t *r;
 
-    r = (uint32_t *)((EARLY_UART_ADDRESS & 0x001fffff)
-                     + XEN_VIRT_START + (1 << 21));
+    r = (uint32_t *)(XEN_VIRT_START + (1 << 21));
 
     /* XXX: assuming a PL011 UART. */
     while(*(r + 0x6) & 0x8)
diff -r 008726e63e7d -r 2312d29744e3 xen/arch/arm/head.S
--- a/xen/arch/arm/head.S	Thu Nov 15 10:25:26 2012 +0000
+++ b/xen/arch/arm/head.S	Thu Nov 15 10:25:26 2012 +0000
@@ -24,6 +24,7 @@
 #define PT_PT  0xe7f /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=1, P=1 */
 #define PT_MEM 0xe7d /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=0, P=1 */
 #define PT_DEV 0xe71 /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=100, T=0, P=1 */
+#define PT_DEV_L3 0xe73 /* lev3: nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=100, T=1, P=1 */
 
 #define PT_UPPER(x) (PT_##x & 0xf00)
 #define PT_LOWER(x) (PT_##x & 0x0ff)
@@ -183,6 +184,18 @@ skip_bss:
 	teq   r12, #0
 	bne   pt_ready
 	
+	/* console fixmap */
+#ifdef EARLY_UART_ADDRESS
+	ldr   r1, =xen_fixmap
+	add   r1, r1, r10            /* r1 := paddr (xen_fixmap) */
+	mov   r3, #0
+	lsr   r2, r11, #12
+	lsl   r2, r2, #12            /* 4K aligned paddr of UART */
+	orr   r2, r2, #PT_UPPER(DEV_L3)
+	orr   r2, r2, #PT_LOWER(DEV_L3) /* r2:r3 := 4K dev map including UART */
+	strd  r2, r3, [r1, #(FIXMAP_CONSOLE*8)] /* Map it in the first fixmap's slot */
+#endif
+
 	/* Build the baseline idle pagetable's first-level entries */
 	ldr   r1, =xen_second
 	add   r1, r1, r10            /* r1 := paddr (xen_second) */
@@ -205,17 +218,15 @@ skip_bss:
 	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, #PT_UPPER(DEV)
-	orr   r2, r2, #PT_LOWER(DEV) /* r2:r3 := 2MB dev map including UART */
+
+	/* xen_fixmap pagetable */
+	ldr   r2, =xen_fixmap
+	add   r2, r2, r10            /* r2 := paddr (xen_fixmap) */
+	orr   r2, r2, #PT_UPPER(PT)
+	orr   r2, r2, #PT_LOWER(PT)  /* r2:r3 := table map of xen_fixmap */
 	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 */
@@ -236,13 +247,10 @@ pt_ready:
 	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) */
+	/* Use a virtual address to access the UART. */
+	ldr   r11, =FIXMAP_ADDR(FIXMAP_CONSOLE)
 #endif
 
 	PRINT("- Ready -\r\n")
@@ -261,8 +269,6 @@ paging:
 	mcr   CP32(r0, BPIALL)       /* Flush branch predictor */
 	dsb                          /* Ensure completion of TLB+BP flush */
 	isb
- 	/* Now, the UART is in its proper fixmap address */
-	ldrne r11, =FIXMAP_ADDR(FIXMAP_CONSOLE)
 
 	/* Non-boot CPUs report that they've got this far */
 	ldr   r0, =ready_cpus
diff -r 008726e63e7d -r 2312d29744e3 xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c	Thu Nov 15 10:25:26 2012 +0000
+++ b/xen/arch/arm/mm.c	Thu Nov 15 10:25:26 2012 +0000
@@ -40,7 +40,7 @@ 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)));
+lpae_t xen_fixmap[LPAE_ENTRIES] __attribute__((__aligned__(4096)));
 static lpae_t xen_xenmap[LPAE_ENTRIES] __attribute__((__aligned__(4096)));
 
 /* Non-boot CPUs use this to find the correct pagetables. */
diff -r 008726e63e7d -r 2312d29744e3 xen/arch/arm/setup.c
--- a/xen/arch/arm/setup.c	Thu Nov 15 10:25:26 2012 +0000
+++ b/xen/arch/arm/setup.c	Thu Nov 15 10:25:26 2012 +0000
@@ -194,9 +194,7 @@ void __init start_xen(unsigned long boot
     setup_pagetables(boot_phys_offset, get_xen_paddr());
 
 #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

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

From xen-changelog-bounces@lists.xen.org Fri Nov 16 22:55:29 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Nov 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 1TZUoj-0006gx-2D; Fri, 16 Nov 2012 22:55:21 +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 1TZUoi-0006gs-0H
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 22:55:20 +0000
Received: from [193.109.254.147:20051] by server-15.bemta-14.messagelabs.com
	id 1F/0B-12105-754C6A05; Fri, 16 Nov 2012 22:55:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-27.messagelabs.com!1353106512!8544383!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19435 invoked from network); 16 Nov 2012 22:55:17 -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;
	16 Nov 2012 22: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 1TZUoa-0002lV-Hz
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 22:55:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZUoZ-00038P-VK
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 22:55:12 +0000
Message-Id: <E1TZUoZ-00038P-VK@xenbits.xen.org>
Date: Fri, 16 Nov 2012 22:55:11 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxl: Fix passing of application
	data to timeout_deregister hook
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Jim Fehlig <jfehlig@suse.com>
# Date 1353081374 0
# Node ID 7c4d806b3753ccf9ca70989bb8e92717007405b7
# Parent  003ac445eae605356ee741a7de7cf98008be89c1
libxl: Fix passing of application data to timeout_deregister hook

When deregistering a timeout, the address of application data was
being passed to the timeout_deregister hook instead of the data
itself.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 26155:babb84d9a82e
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 003ac445eae6 -r 7c4d806b3753 tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c	Thu Nov 15 09:42:03 2012 +0000
+++ b/tools/libxl/libxl_event.c	Fri Nov 16 15:56:14 2012 +0000
@@ -184,7 +184,7 @@ static int time_register_finite(libxl__g
 static void time_deregister(libxl__gc *gc, libxl__ev_time *ev)
 {
     if (!ev->infinite) {
-        OSEVENT_HOOK_VOID(timeout_deregister, &ev->for_app_reg);
+        OSEVENT_HOOK_VOID(timeout_deregister, ev->for_app_reg);
         LIBXL_TAILQ_REMOVE(&CTX->etimes, ev, entry);
     }
 }

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

From xen-changelog-bounces@lists.xen.org Fri Nov 16 22:55:29 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Nov 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 1TZUoj-0006gx-2D; Fri, 16 Nov 2012 22:55:21 +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 1TZUoi-0006gs-0H
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 22:55:20 +0000
Received: from [193.109.254.147:20051] by server-15.bemta-14.messagelabs.com
	id 1F/0B-12105-754C6A05; Fri, 16 Nov 2012 22:55:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-27.messagelabs.com!1353106512!8544383!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19435 invoked from network); 16 Nov 2012 22:55:17 -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;
	16 Nov 2012 22: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 1TZUoa-0002lV-Hz
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 22:55:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TZUoZ-00038P-VK
	for xen-changelog@lists.xensource.com; Fri, 16 Nov 2012 22:55:12 +0000
Message-Id: <E1TZUoZ-00038P-VK@xenbits.xen.org>
Date: Fri, 16 Nov 2012 22:55:11 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] libxl: Fix passing of application
	data to timeout_deregister hook
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Jim Fehlig <jfehlig@suse.com>
# Date 1353081374 0
# Node ID 7c4d806b3753ccf9ca70989bb8e92717007405b7
# Parent  003ac445eae605356ee741a7de7cf98008be89c1
libxl: Fix passing of application data to timeout_deregister hook

When deregistering a timeout, the address of application data was
being passed to the timeout_deregister hook instead of the data
itself.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 26155:babb84d9a82e
Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 003ac445eae6 -r 7c4d806b3753 tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c	Thu Nov 15 09:42:03 2012 +0000
+++ b/tools/libxl/libxl_event.c	Fri Nov 16 15:56:14 2012 +0000
@@ -184,7 +184,7 @@ static int time_register_finite(libxl__g
 static void time_deregister(libxl__gc *gc, libxl__ev_time *ev)
 {
     if (!ev->infinite) {
-        OSEVENT_HOOK_VOID(timeout_deregister, &ev->for_app_reg);
+        OSEVENT_HOOK_VOID(timeout_deregister, ev->for_app_reg);
         LIBXL_TAILQ_REMOVE(&CTX->etimes, ev, entry);
     }
 }

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

From xen-changelog-bounces@lists.xen.org Mon Nov 19 21:55:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 19 Nov 2012 21: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.xen.org>)
	id 1TaZJG-0007Gy-Sd; Mon, 19 Nov 2012 21: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 1TaZJG-0007Gt-4w
	for xen-changelog@lists.xensource.com; Mon, 19 Nov 2012 21:55:18 +0000
Received: from [85.158.139.83:57452] by server-14.bemta-5.messagelabs.com id
	33/E1-21768-5CAAAA05; Mon, 19 Nov 2012 21:55:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-182.messagelabs.com!1353362115!26714422!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16579 invoked from network); 19 Nov 2012 21:55: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;
	19 Nov 2012 21: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 1TaZJC-0007dz-Tp
	for xen-changelog@lists.xensource.com; Mon, 19 Nov 2012 21:55:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TaZJC-0002dY-Et
	for xen-changelog@lists.xensource.com; Mon, 19 Nov 2012 21:55:14 +0000
Message-Id: <E1TaZJC-0002dY-Et@xenbits.xen.org>
Date: Mon, 19 Nov 2012 21:55:13 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] fix backport oversight in
	23383:addf106cc90f
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353314628 -3600
# Node ID 5639047d6c9fafa3b2d455cb60cf1d17be4035e0
# Parent  ce405f5fd5ee75e5241afece9b41c114891fc20d
fix backport oversight in 23383:addf106cc90f

This fixes an omission in said backport (of -unstable
25931:149805919569): While the XEN_DOMCTL_memory_mapping code
pointlessly sets "ret" to zero, the XEN_DOMCTL_ioport_mapping code
needs to because of an XSM call (leaving ret set to zero when reaching
the code in question) present in -unstable, but absent in 4.1-testing.

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


diff -r ce405f5fd5ee -r 5639047d6c9f xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c	Thu Nov 15 09:41:51 2012 +0000
+++ b/xen/arch/x86/domctl.c	Mon Nov 19 09:43:48 2012 +0100
@@ -979,7 +979,6 @@ long arch_do_domctl(
         if ( unlikely((d = rcu_lock_domain_by_id(domctl->domain)) == NULL) )
             break;
 
-        ret=0;
         if ( domctl->u.memory_mapping.add_mapping )
         {
             gdprintk(XENLOG_INFO,
@@ -1079,6 +1078,7 @@ long arch_do_domctl(
                     found = 1;
                     break;
                 }
+            ret = 0;
             if ( !found )
             {
                 g2m_ioport = xmalloc(struct g2m_ioport);

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

From xen-changelog-bounces@lists.xen.org Mon Nov 19 21:55:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 19 Nov 2012 21: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.xen.org>)
	id 1TaZJG-0007Gy-Sd; Mon, 19 Nov 2012 21: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 1TaZJG-0007Gt-4w
	for xen-changelog@lists.xensource.com; Mon, 19 Nov 2012 21:55:18 +0000
Received: from [85.158.139.83:57452] by server-14.bemta-5.messagelabs.com id
	33/E1-21768-5CAAAA05; Mon, 19 Nov 2012 21:55:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-182.messagelabs.com!1353362115!26714422!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16579 invoked from network); 19 Nov 2012 21:55: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;
	19 Nov 2012 21: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 1TaZJC-0007dz-Tp
	for xen-changelog@lists.xensource.com; Mon, 19 Nov 2012 21:55:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TaZJC-0002dY-Et
	for xen-changelog@lists.xensource.com; Mon, 19 Nov 2012 21:55:14 +0000
Message-Id: <E1TaZJC-0002dY-Et@xenbits.xen.org>
Date: Mon, 19 Nov 2012 21:55:13 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] fix backport oversight in
	23383:addf106cc90f
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353314628 -3600
# Node ID 5639047d6c9fafa3b2d455cb60cf1d17be4035e0
# Parent  ce405f5fd5ee75e5241afece9b41c114891fc20d
fix backport oversight in 23383:addf106cc90f

This fixes an omission in said backport (of -unstable
25931:149805919569): While the XEN_DOMCTL_memory_mapping code
pointlessly sets "ret" to zero, the XEN_DOMCTL_ioport_mapping code
needs to because of an XSM call (leaving ret set to zero when reaching
the code in question) present in -unstable, but absent in 4.1-testing.

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


diff -r ce405f5fd5ee -r 5639047d6c9f xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c	Thu Nov 15 09:41:51 2012 +0000
+++ b/xen/arch/x86/domctl.c	Mon Nov 19 09:43:48 2012 +0100
@@ -979,7 +979,6 @@ long arch_do_domctl(
         if ( unlikely((d = rcu_lock_domain_by_id(domctl->domain)) == NULL) )
             break;
 
-        ret=0;
         if ( domctl->u.memory_mapping.add_mapping )
         {
             gdprintk(XENLOG_INFO,
@@ -1079,6 +1078,7 @@ long arch_do_domctl(
                     found = 1;
                     break;
                 }
+            ret = 0;
             if ( !found )
             {
                 g2m_ioport = xmalloc(struct g2m_ioport);

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0iZ-0002XZ-05; Wed, 21 Nov 2012 03: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 1Tb0iW-0002Ws-L5
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:12 +0000
Received: from [85.158.139.211:64067] by server-2.bemta-5.messagelabs.com id
	05/70-04892-F464CA05; Wed, 21 Nov 2012 03:11:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-206.messagelabs.com!1353467469!20913994!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24807 invoked from network); 21 Nov 2012 03:11:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Nov 2012 03: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 1Tb0iT-0007d1-KF
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iT-0005XW-9o
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:09 +0000
Message-Id: <E1Tb0iT-0005XW-9o@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen/arm: flush D-cache and I-cache
	when appropriate
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1353329986 0
# Node ID ddb109120dbd67a166dc0fa512cb0ef54dc799ca
# Parent  9da9781cc3fb820b0aba0023c4cd29c8af223ea6
xen/arm: flush D-cache and I-cache when appropriate

- invalidate tlb after setting WXN
- flush D-cache and I-cache after relocation;
- invalidate D-cache after writing to smp_up_cpu;
- flush I-cache after changing HTTBR;
- flush I-cache and branch predictor after writing Xen text ptes.

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 9da9781cc3fb -r ddb109120dbd xen/arch/arm/head.S
--- a/xen/arch/arm/head.S	Mon Nov 19 09:48:22 2012 +0100
+++ b/xen/arch/arm/head.S	Mon Nov 19 12:59:46 2012 +0000
@@ -278,8 +278,12 @@ paging:
 	ldr   r4, =boot_httbr        /* VA of HTTBR value stashed by CPU 0 */
 	add   r4, r4, r10            /* PA of it */
 	ldrd  r4, r5, [r4]           /* Actual value */
+	dsb
 	mcrr  CP64(r4, r5, HTTBR)
+	dsb
+	isb
 	mcr   CP32(r0, TLBIALLH)     /* Flush hypervisor TLB */
+	mcr   CP32(r0, ICIALLU)      /* Flush I-cache */
 	mcr   CP32(r0, BPIALL)       /* Flush branch predictor */
 	dsb                          /* Ensure completion of TLB+BP flush */
 	isb
@@ -292,6 +296,8 @@ 1:	ldrex r1, [r0]               /*      
 	teq   r2, #0
 	bne   1b
 	dsb
+	mcr   CP32(r0, DCCMVAC)      /* flush D-Cache */
+	dsb
 
 	/* Here, the non-boot CPUs must wait again -- they're now running on
 	 * the boot CPU's pagetables so it's safe for the boot CPU to
diff -r 9da9781cc3fb -r ddb109120dbd xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c	Mon Nov 19 09:48:22 2012 +0100
+++ b/xen/arch/arm/mm.c	Mon Nov 19 12:59:46 2012 +0000
@@ -247,14 +247,13 @@ void __init setup_pagetables(unsigned lo
 
     /* Change pagetables to the copy in the relocated Xen */
     boot_httbr = (unsigned long) xen_pgtable + phys_offset;
-    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" (boot_httbr) : "memory");
+    flush_xen_dcache_va(&boot_httbr);
+    flush_xen_dcache_va_range((void*)dest_va, _end - _start);
+    flush_xen_text_tlb();
+
+    WRITE_CP64(boot_httbr, HTTBR); /* Change translation base */
+    dsb();                         /* Ensure visibility of HTTBR update */
+    flush_xen_text_tlb();
 
     /* Undo the temporary map */
     pte.bits = 0;
@@ -294,11 +293,12 @@ void __init setup_pagetables(unsigned lo
                            >> 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. */
-    flush_xen_text_tlb();
+    /* TLBFLUSH and ISB would be needed here, but wait until we set WXN */
 
     /* From now on, no mapping may be both writable and executable. */
     WRITE_CP32(READ_CP32(HSCTLR) | SCTLR_WXN, HSCTLR);
+    /* Flush everything after setting WXN bit. */
+    flush_xen_text_tlb();
 }
 
 /* MMU setup for secondary CPUS (which already have paging enabled) */
@@ -306,6 +306,7 @@ void __cpuinit mmu_init_secondary_cpu(vo
 {
     /* From now on, no mapping may be both writable and executable. */
     WRITE_CP32(READ_CP32(HSCTLR) | SCTLR_WXN, HSCTLR);
+    flush_xen_text_tlb();
 }
 
 /* Create Xen's mappings of memory.
diff -r 9da9781cc3fb -r ddb109120dbd xen/arch/arm/smpboot.c
--- a/xen/arch/arm/smpboot.c	Mon Nov 19 09:48:22 2012 +0100
+++ b/xen/arch/arm/smpboot.c	Mon Nov 19 12:59:46 2012 +0000
@@ -105,6 +105,7 @@ make_cpus_ready(unsigned int max_cpus, u
         /* Tell the next CPU to get ready */
         /* TODO: handle boards where CPUIDs are not contiguous */
         *gate = i;
+        flush_xen_dcache_va(gate);
         asm volatile("dsb; isb; sev");
         /* And wait for it to respond */
         while ( ready_cpus < i )
@@ -201,6 +202,9 @@ int __cpu_up(unsigned int cpu)
     /* Unblock the CPU.  It should be waiting in the loop in head.S
      * for an event to arrive when smp_up_cpu matches its cpuid. */
     smp_up_cpu = cpu;
+    /* we need to make sure that the change to smp_up_cpu is visible to
+     * secondary cpus with D-cache off */
+    flush_xen_dcache_va(&smp_up_cpu);
     asm volatile("dsb; isb; sev");
 
     while ( !cpu_online(cpu) )
diff -r 9da9781cc3fb -r ddb109120dbd xen/include/asm-arm/page.h
--- a/xen/include/asm-arm/page.h	Mon Nov 19 09:48:22 2012 +0100
+++ b/xen/include/asm-arm/page.h	Mon Nov 19 12:59:46 2012 +0000
@@ -228,27 +228,74 @@ static inline lpae_t mfn_to_p2m_entry(un
     return e;
 }
 
-/* Write a pagetable entry */
+/* Write a pagetable entry.
+ *
+ * If the table entry is changing a text mapping, it is responsibility
+ * of the caller to issue an ISB after write_pte.
+ */
 static inline void write_pte(lpae_t *p, lpae_t pte)
 {
     asm volatile (
+        /* Ensure any writes have completed with the old mappings. */
+        "dsb;"
         /* Safely write the entry (STRD is atomic on CPUs that support LPAE) */
         "strd %0, %H0, [%1];"
+        "dsb;"
         /* Push this cacheline to the PoC so the rest of the system sees it. */
         STORE_CP32(1, DCCMVAC)
+        /* Ensure that the data flush is completed before proceeding */
+        "dsb;"
         : : "r" (pte.bits), "r" (p) : "memory");
 }
 
+
+/* Function for flushing medium-sized areas.
+ * if 'range' is large enough we might want to use model-specific
+ * full-cache flushes. */
+static inline void flush_xen_dcache_va_range(void *p, unsigned long size)
+{
+    int cacheline_bytes  = READ_CP32(CCSIDR);
+    void *end;
+    dsb();           /* So the CPU issues all writes to the range */
+    for ( end = p + size; p < end; p += cacheline_bytes )
+        WRITE_CP32((uint32_t) p, DCCMVAC);
+    dsb();           /* So we know the flushes happen before continuing */
+}
+
+
+/* Macro for flushing a single small item.  The predicate is always
+ * compile-time constant so this will compile down to 3 instructions in
+ * the common case.  Make sure to call it with the correct type of
+ * pointer! */
+#define flush_xen_dcache_va(p) do {                                     \
+    int cacheline_bytes  = READ_CP32(CCSIDR);                           \
+    typeof(p) _p = (p);                                                 \
+    if ( ((unsigned long)_p & ~(cacheline_bytes - 1)) !=                \
+        (((unsigned long)_p + (sizeof *_p)) & ~(cacheline_bytes - 1)) ) \
+        flush_xen_dcache_va_range(_p, sizeof *_p);                      \
+    else                                                                \
+        asm volatile (                                                  \
+            "dsb;"   /* Finish all earlier writes */                    \
+            STORE_CP32(0, DCCMVAC)                                      \
+            "dsb;"   /* Finish flush before continuing */               \
+            : : "r" (_p), "m" (*_p));                                   \
+} while (0)
+
+
 /*
  * Flush all hypervisor mappings from the TLB and branch predictor.
- * This is needed after changing Xen code mappings. 
+ * This is needed after changing Xen code mappings.
+ *
+ * The caller needs to issue the necessary DSB and D-cache flushes
+ * before calling flush_xen_text_tlb.
  */
 static inline void flush_xen_text_tlb(void)
 {
     register unsigned long r0 asm ("r0");
     asm volatile (
-        "dsb;"                        /* Ensure visibility of PTE writes */
+        "isb;"                        /* Ensure synchronization with previous changes to text */
         STORE_CP32(0, TLBIALLH)       /* Flush hypervisor TLB */
+        STORE_CP32(0, ICIALLU)        /* Flush I-cache */
         STORE_CP32(0, BPIALL)         /* Flush branch predictor */
         "dsb;"                        /* Ensure completion of TLB+BP flush */
         "isb;"

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0iZ-0002XZ-05; Wed, 21 Nov 2012 03: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 1Tb0iW-0002Ws-L5
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:12 +0000
Received: from [85.158.139.211:64067] by server-2.bemta-5.messagelabs.com id
	05/70-04892-F464CA05; Wed, 21 Nov 2012 03:11:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-206.messagelabs.com!1353467469!20913994!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24807 invoked from network); 21 Nov 2012 03:11:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Nov 2012 03: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 1Tb0iT-0007d1-KF
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iT-0005XW-9o
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:09 +0000
Message-Id: <E1Tb0iT-0005XW-9o@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen/arm: flush D-cache and I-cache
	when appropriate
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1353329986 0
# Node ID ddb109120dbd67a166dc0fa512cb0ef54dc799ca
# Parent  9da9781cc3fb820b0aba0023c4cd29c8af223ea6
xen/arm: flush D-cache and I-cache when appropriate

- invalidate tlb after setting WXN
- flush D-cache and I-cache after relocation;
- invalidate D-cache after writing to smp_up_cpu;
- flush I-cache after changing HTTBR;
- flush I-cache and branch predictor after writing Xen text ptes.

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 9da9781cc3fb -r ddb109120dbd xen/arch/arm/head.S
--- a/xen/arch/arm/head.S	Mon Nov 19 09:48:22 2012 +0100
+++ b/xen/arch/arm/head.S	Mon Nov 19 12:59:46 2012 +0000
@@ -278,8 +278,12 @@ paging:
 	ldr   r4, =boot_httbr        /* VA of HTTBR value stashed by CPU 0 */
 	add   r4, r4, r10            /* PA of it */
 	ldrd  r4, r5, [r4]           /* Actual value */
+	dsb
 	mcrr  CP64(r4, r5, HTTBR)
+	dsb
+	isb
 	mcr   CP32(r0, TLBIALLH)     /* Flush hypervisor TLB */
+	mcr   CP32(r0, ICIALLU)      /* Flush I-cache */
 	mcr   CP32(r0, BPIALL)       /* Flush branch predictor */
 	dsb                          /* Ensure completion of TLB+BP flush */
 	isb
@@ -292,6 +296,8 @@ 1:	ldrex r1, [r0]               /*      
 	teq   r2, #0
 	bne   1b
 	dsb
+	mcr   CP32(r0, DCCMVAC)      /* flush D-Cache */
+	dsb
 
 	/* Here, the non-boot CPUs must wait again -- they're now running on
 	 * the boot CPU's pagetables so it's safe for the boot CPU to
diff -r 9da9781cc3fb -r ddb109120dbd xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c	Mon Nov 19 09:48:22 2012 +0100
+++ b/xen/arch/arm/mm.c	Mon Nov 19 12:59:46 2012 +0000
@@ -247,14 +247,13 @@ void __init setup_pagetables(unsigned lo
 
     /* Change pagetables to the copy in the relocated Xen */
     boot_httbr = (unsigned long) xen_pgtable + phys_offset;
-    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" (boot_httbr) : "memory");
+    flush_xen_dcache_va(&boot_httbr);
+    flush_xen_dcache_va_range((void*)dest_va, _end - _start);
+    flush_xen_text_tlb();
+
+    WRITE_CP64(boot_httbr, HTTBR); /* Change translation base */
+    dsb();                         /* Ensure visibility of HTTBR update */
+    flush_xen_text_tlb();
 
     /* Undo the temporary map */
     pte.bits = 0;
@@ -294,11 +293,12 @@ void __init setup_pagetables(unsigned lo
                            >> 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. */
-    flush_xen_text_tlb();
+    /* TLBFLUSH and ISB would be needed here, but wait until we set WXN */
 
     /* From now on, no mapping may be both writable and executable. */
     WRITE_CP32(READ_CP32(HSCTLR) | SCTLR_WXN, HSCTLR);
+    /* Flush everything after setting WXN bit. */
+    flush_xen_text_tlb();
 }
 
 /* MMU setup for secondary CPUS (which already have paging enabled) */
@@ -306,6 +306,7 @@ void __cpuinit mmu_init_secondary_cpu(vo
 {
     /* From now on, no mapping may be both writable and executable. */
     WRITE_CP32(READ_CP32(HSCTLR) | SCTLR_WXN, HSCTLR);
+    flush_xen_text_tlb();
 }
 
 /* Create Xen's mappings of memory.
diff -r 9da9781cc3fb -r ddb109120dbd xen/arch/arm/smpboot.c
--- a/xen/arch/arm/smpboot.c	Mon Nov 19 09:48:22 2012 +0100
+++ b/xen/arch/arm/smpboot.c	Mon Nov 19 12:59:46 2012 +0000
@@ -105,6 +105,7 @@ make_cpus_ready(unsigned int max_cpus, u
         /* Tell the next CPU to get ready */
         /* TODO: handle boards where CPUIDs are not contiguous */
         *gate = i;
+        flush_xen_dcache_va(gate);
         asm volatile("dsb; isb; sev");
         /* And wait for it to respond */
         while ( ready_cpus < i )
@@ -201,6 +202,9 @@ int __cpu_up(unsigned int cpu)
     /* Unblock the CPU.  It should be waiting in the loop in head.S
      * for an event to arrive when smp_up_cpu matches its cpuid. */
     smp_up_cpu = cpu;
+    /* we need to make sure that the change to smp_up_cpu is visible to
+     * secondary cpus with D-cache off */
+    flush_xen_dcache_va(&smp_up_cpu);
     asm volatile("dsb; isb; sev");
 
     while ( !cpu_online(cpu) )
diff -r 9da9781cc3fb -r ddb109120dbd xen/include/asm-arm/page.h
--- a/xen/include/asm-arm/page.h	Mon Nov 19 09:48:22 2012 +0100
+++ b/xen/include/asm-arm/page.h	Mon Nov 19 12:59:46 2012 +0000
@@ -228,27 +228,74 @@ static inline lpae_t mfn_to_p2m_entry(un
     return e;
 }
 
-/* Write a pagetable entry */
+/* Write a pagetable entry.
+ *
+ * If the table entry is changing a text mapping, it is responsibility
+ * of the caller to issue an ISB after write_pte.
+ */
 static inline void write_pte(lpae_t *p, lpae_t pte)
 {
     asm volatile (
+        /* Ensure any writes have completed with the old mappings. */
+        "dsb;"
         /* Safely write the entry (STRD is atomic on CPUs that support LPAE) */
         "strd %0, %H0, [%1];"
+        "dsb;"
         /* Push this cacheline to the PoC so the rest of the system sees it. */
         STORE_CP32(1, DCCMVAC)
+        /* Ensure that the data flush is completed before proceeding */
+        "dsb;"
         : : "r" (pte.bits), "r" (p) : "memory");
 }
 
+
+/* Function for flushing medium-sized areas.
+ * if 'range' is large enough we might want to use model-specific
+ * full-cache flushes. */
+static inline void flush_xen_dcache_va_range(void *p, unsigned long size)
+{
+    int cacheline_bytes  = READ_CP32(CCSIDR);
+    void *end;
+    dsb();           /* So the CPU issues all writes to the range */
+    for ( end = p + size; p < end; p += cacheline_bytes )
+        WRITE_CP32((uint32_t) p, DCCMVAC);
+    dsb();           /* So we know the flushes happen before continuing */
+}
+
+
+/* Macro for flushing a single small item.  The predicate is always
+ * compile-time constant so this will compile down to 3 instructions in
+ * the common case.  Make sure to call it with the correct type of
+ * pointer! */
+#define flush_xen_dcache_va(p) do {                                     \
+    int cacheline_bytes  = READ_CP32(CCSIDR);                           \
+    typeof(p) _p = (p);                                                 \
+    if ( ((unsigned long)_p & ~(cacheline_bytes - 1)) !=                \
+        (((unsigned long)_p + (sizeof *_p)) & ~(cacheline_bytes - 1)) ) \
+        flush_xen_dcache_va_range(_p, sizeof *_p);                      \
+    else                                                                \
+        asm volatile (                                                  \
+            "dsb;"   /* Finish all earlier writes */                    \
+            STORE_CP32(0, DCCMVAC)                                      \
+            "dsb;"   /* Finish flush before continuing */               \
+            : : "r" (_p), "m" (*_p));                                   \
+} while (0)
+
+
 /*
  * Flush all hypervisor mappings from the TLB and branch predictor.
- * This is needed after changing Xen code mappings. 
+ * This is needed after changing Xen code mappings.
+ *
+ * The caller needs to issue the necessary DSB and D-cache flushes
+ * before calling flush_xen_text_tlb.
  */
 static inline void flush_xen_text_tlb(void)
 {
     register unsigned long r0 asm ("r0");
     asm volatile (
-        "dsb;"                        /* Ensure visibility of PTE writes */
+        "isb;"                        /* Ensure synchronization with previous changes to text */
         STORE_CP32(0, TLBIALLH)       /* Flush hypervisor TLB */
+        STORE_CP32(0, ICIALLU)        /* Flush I-cache */
         STORE_CP32(0, BPIALL)         /* Flush branch predictor */
         "dsb;"                        /* Ensure completion of TLB+BP flush */
         "isb;"

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0iX-0002XI-TV; Wed, 21 Nov 2012 03:11:13 +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 1Tb0iV-0002Wr-Uk
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:12 +0000
Received: from [85.158.138.51:51066] by server-5.bemta-3.messagelabs.com id
	3A/C4-26311-F464CA05; Wed, 21 Nov 2012 03:11:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1353467469!24486759!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4897 invoked from network); 21 Nov 2012 03:11:10 -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;
	21 Nov 2012 03: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 1Tb0iT-0007cy-2R
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iS-0005XH-OS
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:08 +0000
Message-Id: <E1Tb0iS-0005XH-OS@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] vscsiif: minor cleanup
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353314902 -3600
# Node ID 9da9781cc3fb820b0aba0023c4cd29c8af223ea6
# Parent  9025a10c056174671c6c0d87816732a2ec6eaf0e
vscsiif: minor cleanup

Remove a definition not belonging into the interface, and correct a
few typos in comments.

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


diff -r 9025a10c0561 -r 9da9781cc3fb xen/include/public/io/vscsiif.h
--- a/xen/include/public/io/vscsiif.h	Mon Nov 19 09:46:46 2012 +0100
+++ b/xen/include/public/io/vscsiif.h	Mon Nov 19 09:48:22 2012 +0100
@@ -30,25 +30,22 @@
 #include "ring.h"
 #include "../grant_table.h"
 
-/* command between backend and frontend */
+/* commands between backend and frontend */
 #define VSCSIIF_ACT_SCSI_CDB         1    /* SCSI CDB command */
 #define VSCSIIF_ACT_SCSI_ABORT       2    /* SCSI Device(Lun) Abort*/
 #define VSCSIIF_ACT_SCSI_RESET       3    /* SCSI Device(Lun) Reset*/
 
-
-#define VSCSIIF_BACK_MAX_PENDING_REQS    128
-
 /*
  * Maximum scatter/gather segments per request.
  *
- * Considering balance between allocating al least 16 "vscsiif_request"
- * structures on one page (4096bytes) and number of scatter gather 
- * needed, we decided to use 26 as a magic number.
+ * Considering balance between allocating at least 16 "vscsiif_request"
+ * structures on one page (4096 bytes) and the number of scatter/gather
+ * elements needed, we decided to use 26 as a magic number.
  */
 #define VSCSIIF_SG_TABLESIZE             26
 
 /*
- * base on linux kernel 2.6.18
+ * based on Linux kernel 2.6.18
  */
 #define VSCSIIF_MAX_COMMAND_SIZE         16
 #define VSCSIIF_SENSE_BUFFERSIZE         96

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0iX-0002XI-TV; Wed, 21 Nov 2012 03:11:13 +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 1Tb0iV-0002Wr-Uk
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:12 +0000
Received: from [85.158.138.51:51066] by server-5.bemta-3.messagelabs.com id
	3A/C4-26311-F464CA05; Wed, 21 Nov 2012 03:11:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1353467469!24486759!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4897 invoked from network); 21 Nov 2012 03:11:10 -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;
	21 Nov 2012 03: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 1Tb0iT-0007cy-2R
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iS-0005XH-OS
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:08 +0000
Message-Id: <E1Tb0iS-0005XH-OS@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] vscsiif: minor cleanup
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353314902 -3600
# Node ID 9da9781cc3fb820b0aba0023c4cd29c8af223ea6
# Parent  9025a10c056174671c6c0d87816732a2ec6eaf0e
vscsiif: minor cleanup

Remove a definition not belonging into the interface, and correct a
few typos in comments.

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


diff -r 9025a10c0561 -r 9da9781cc3fb xen/include/public/io/vscsiif.h
--- a/xen/include/public/io/vscsiif.h	Mon Nov 19 09:46:46 2012 +0100
+++ b/xen/include/public/io/vscsiif.h	Mon Nov 19 09:48:22 2012 +0100
@@ -30,25 +30,22 @@
 #include "ring.h"
 #include "../grant_table.h"
 
-/* command between backend and frontend */
+/* commands between backend and frontend */
 #define VSCSIIF_ACT_SCSI_CDB         1    /* SCSI CDB command */
 #define VSCSIIF_ACT_SCSI_ABORT       2    /* SCSI Device(Lun) Abort*/
 #define VSCSIIF_ACT_SCSI_RESET       3    /* SCSI Device(Lun) Reset*/
 
-
-#define VSCSIIF_BACK_MAX_PENDING_REQS    128
-
 /*
  * Maximum scatter/gather segments per request.
  *
- * Considering balance between allocating al least 16 "vscsiif_request"
- * structures on one page (4096bytes) and number of scatter gather 
- * needed, we decided to use 26 as a magic number.
+ * Considering balance between allocating at least 16 "vscsiif_request"
+ * structures on one page (4096 bytes) and the number of scatter/gather
+ * elements needed, we decided to use 26 as a magic number.
  */
 #define VSCSIIF_SG_TABLESIZE             26
 
 /*
- * base on linux kernel 2.6.18
+ * based on Linux kernel 2.6.18
  */
 #define VSCSIIF_MAX_COMMAND_SIZE         16
 #define VSCSIIF_SENSE_BUFFERSIZE         96

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0iZ-0002YE-Gx; Wed, 21 Nov 2012 03:11: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 1Tb0iY-0002X3-F3
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:14 +0000
Received: from [85.158.143.99:18185] by server-1.bemta-4.messagelabs.com id
	97/FB-27934-2564CA05; Wed, 21 Nov 2012 03:11:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1353467472!25476019!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7568 invoked from network); 21 Nov 2012 03:11:13 -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;
	21 Nov 2012 03: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 1Tb0iW-0007dG-6Q
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iW-0005Ym-57
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:12 +0000
Message-Id: <E1Tb0iW-0005Ym-57@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Remove VTPM_TOOLS from
	config/Tools.mk.in
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1353329989 0
# Node ID 3dc18d679d04bc7cfbfbb3fae06f121f8632dff5
# Parent  31dcc0e087541504589124b5ede456afc603d8b5
Remove VTPM_TOOLS from config/Tools.mk.in

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 31dcc0e08754 -r 3dc18d679d04 config/Tools.mk.in
--- a/config/Tools.mk.in	Mon Nov 19 12:59:48 2012 +0000
+++ b/config/Tools.mk.in	Mon Nov 19 12:59:49 2012 +0000
@@ -44,7 +44,6 @@ GIT_HTTP            := @githttp@
 
 # Optional components
 XENSTAT_XENTOP      := @monitors@
-VTPM_TOOLS          := @vtpm@
 LIBXENAPI_BINDINGS  := @xenapi@
 OCAML_TOOLS         := @ocamltools@
 CONFIG_MINITERM     := @miniterm@

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0iZ-0002Xo-8H; Wed, 21 Nov 2012 03:11:15 +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 1Tb0iX-0002Wx-Ba
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:13 +0000
Received: from [85.158.137.99:60632] by server-7.bemta-3.messagelabs.com id
	FC/38-01713-0564CA05; Wed, 21 Nov 2012 03:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-217.messagelabs.com!1353467470!17599814!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5078 invoked from network); 21 Nov 2012 03:11:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Nov 2012 03: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 1Tb0iT-0007d4-Sv
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iT-0005Xl-Qy
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:09 +0000
Message-Id: <E1Tb0iT-0005Xl-Qy@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen/arm: get the number of cpus from
	device tree
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1353329986 0
# Node ID 17539cec2b9d0f1500d76f43178f57ab0a4160a8
# Parent  ddb109120dbd67a166dc0fa512cb0ef54dc799ca
xen/arm: get the number of cpus from device tree

The system might have fewer cpus than the GIC supports.

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 ddb109120dbd -r 17539cec2b9d xen/arch/arm/gic.c
--- a/xen/arch/arm/gic.c	Mon Nov 19 12:59:46 2012 +0000
+++ b/xen/arch/arm/gic.c	Mon Nov 19 12:59:46 2012 +0000
@@ -304,7 +304,7 @@ static void __cpuinit gic_hyp_disable(vo
 }
 
 /* Set up the GIC */
-int __init gic_init(void)
+void __init gic_init(void)
 {
     /* XXX FIXME get this from devicetree */
     gic.dbase = GIC_BASE_ADDRESS + GIC_DR_OFFSET;
@@ -328,8 +328,6 @@ int __init gic_init(void)
     gic.lr_mask = 0ULL;
 
     spin_unlock(&gic.lock);
-
-    return gic.cpus;
 }
 
 /* Set up the per-CPU parts of the GIC for a secondary CPU */
diff -r ddb109120dbd -r 17539cec2b9d xen/arch/arm/gic.h
--- a/xen/arch/arm/gic.h	Mon Nov 19 12:59:46 2012 +0000
+++ b/xen/arch/arm/gic.h	Mon Nov 19 12:59:46 2012 +0000
@@ -147,7 +147,7 @@ extern int gic_route_irq_to_guest(struct
 /* 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, and report # cpus attached */
-extern int gic_init(void);
+extern void gic_init(void);
 /* Bring up a secondary CPU's per-CPU GIC interface */
 extern void gic_init_secondary_cpu(void);
 /* Take down a CPU's per-CPU GIC interface */
diff -r ddb109120dbd -r 17539cec2b9d xen/arch/arm/setup.c
--- a/xen/arch/arm/setup.c	Mon Nov 19 12:59:46 2012 +0000
+++ b/xen/arch/arm/setup.c	Mon Nov 19 12:59:46 2012 +0000
@@ -185,10 +185,13 @@ void __init start_xen(unsigned long boot
     size_t fdt_size;
     int cpus, i;
 
+    smp_clear_cpu_maps();
+
     fdt = (void *)BOOT_MISC_VIRT_START
         + (atag_paddr & ((1 << SECOND_SHIFT) - 1));
     fdt_size = device_tree_early_init(fdt);
 
+    cpus = smp_get_max_cpus();
     cmdline_parse(device_tree_bootargs(fdt));
 
     setup_pagetables(boot_phys_offset, get_xen_paddr());
@@ -199,7 +202,7 @@ void __init start_xen(unsigned long boot
     console_init_preirq();
 #endif
 
-    cpus = gic_init();
+    gic_init();
     make_cpus_ready(cpus, boot_phys_offset);
 
     percpu_init_areas();
diff -r ddb109120dbd -r 17539cec2b9d xen/arch/arm/smpboot.c
--- a/xen/arch/arm/smpboot.c	Mon Nov 19 12:59:46 2012 +0000
+++ b/xen/arch/arm/smpboot.c	Mon Nov 19 12:59:46 2012 +0000
@@ -71,18 +71,31 @@ static void setup_cpu_sibling_map(int cp
     cpumask_set_cpu(cpu, per_cpu(cpu_core_mask, cpu));
 }
 
+void __init
+smp_clear_cpu_maps (void)
+{
+    cpumask_clear(&cpu_possible_map);
+    cpumask_clear(&cpu_online_map);
+    cpumask_set_cpu(0, &cpu_online_map);
+    cpumask_set_cpu(0, &cpu_possible_map);
+}
+
+int __init
+smp_get_max_cpus (void)
+{
+    int i, max_cpus = 0;
+
+    for ( i = 0; i < nr_cpu_ids; i++ )
+        if ( cpu_possible(i) )
+            max_cpus++;
+
+    return max_cpus;
+}
+
 
 void __init
 smp_prepare_cpus (unsigned int max_cpus)
 {
-    int i;
-
-    cpumask_clear(&cpu_online_map);
-    cpumask_set_cpu(0, &cpu_online_map);
-
-    cpumask_clear(&cpu_possible_map);
-    for ( i = 0; i < max_cpus; i++ )
-        cpumask_set_cpu(i, &cpu_possible_map);
     cpumask_copy(&cpu_present_map, &cpu_possible_map);
 
     setup_cpu_sibling_map(0);
diff -r ddb109120dbd -r 17539cec2b9d xen/common/device_tree.c
--- a/xen/common/device_tree.c	Mon Nov 19 12:59:46 2012 +0000
+++ b/xen/common/device_tree.c	Mon Nov 19 12:59:46 2012 +0000
@@ -18,6 +18,7 @@
 #include <xen/mm.h>
 #include <xen/stdarg.h>
 #include <xen/string.h>
+#include <xen/cpumask.h>
 #include <asm/early_printk.h>
 
 struct dt_early_info __initdata early_info;
@@ -41,6 +42,18 @@ bool_t device_tree_node_matches(const vo
         && (name[match_len] == '@' || name[match_len] == '\0');
 }
 
+bool_t device_tree_type_matches(const void *fdt, int node, const char *match)
+{
+    int len;
+    const void *prop;
+
+    prop = fdt_getprop(fdt, node, "device_type", &len);
+    if ( prop == NULL )
+        return 0;
+
+    return !strncmp(prop, match, len);
+}
+
 static void __init get_val(const u32 **cell, u32 cells, u64 *val)
 {
     *val = 0;
@@ -229,6 +242,34 @@ static void __init process_memory_node(c
     }
 }
 
+static void __init process_cpu_node(const void *fdt, int node,
+                                    const char *name,
+                                    u32 address_cells, u32 size_cells)
+{
+    const struct fdt_property *prop;
+    const u32 *cell;
+    paddr_t start, size;
+
+    if ( address_cells != 1 || size_cells != 0 )
+    {
+        early_printk("fdt: node `%s': invalid #address-cells or #size-cells",
+                     name);
+        return;
+    }
+
+    prop = fdt_get_property(fdt, node, "reg", NULL);
+    if ( !prop )
+    {
+        early_printk("fdt: node `%s': missing `reg' property\n", name);
+        return;
+    }
+
+    cell = (const u32 *)prop->data;
+    device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
+
+    cpumask_set_cpu(start, &cpu_possible_map);
+}
+
 static int __init early_scan_node(const void *fdt,
                                   int node, const char *name, int depth,
                                   u32 address_cells, u32 size_cells,
@@ -236,6 +277,8 @@ static int __init early_scan_node(const 
 {
     if ( device_tree_node_matches(fdt, node, "memory") )
         process_memory_node(fdt, node, name, address_cells, size_cells);
+    else if ( device_tree_type_matches(fdt, node, "cpu") )
+        process_cpu_node(fdt, node, name, address_cells, size_cells);
 
     return 0;
 }
diff -r ddb109120dbd -r 17539cec2b9d xen/include/asm-arm/smp.h
--- a/xen/include/asm-arm/smp.h	Mon Nov 19 12:59:46 2012 +0000
+++ b/xen/include/asm-arm/smp.h	Mon Nov 19 12:59:46 2012 +0000
@@ -22,6 +22,8 @@ extern void stop_cpu(void);
 extern void
 make_cpus_ready(unsigned int max_cpus, unsigned long boot_phys_offset);
 
+extern void smp_clear_cpu_maps (void);
+extern int smp_get_max_cpus (void);
 #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 Wed Nov 21 03:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0iZ-0002YE-Gx; Wed, 21 Nov 2012 03:11: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 1Tb0iY-0002X3-F3
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:14 +0000
Received: from [85.158.143.99:18185] by server-1.bemta-4.messagelabs.com id
	97/FB-27934-2564CA05; Wed, 21 Nov 2012 03:11:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1353467472!25476019!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7568 invoked from network); 21 Nov 2012 03:11:13 -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;
	21 Nov 2012 03: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 1Tb0iW-0007dG-6Q
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iW-0005Ym-57
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:12 +0000
Message-Id: <E1Tb0iW-0005Ym-57@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Remove VTPM_TOOLS from
	config/Tools.mk.in
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1353329989 0
# Node ID 3dc18d679d04bc7cfbfbb3fae06f121f8632dff5
# Parent  31dcc0e087541504589124b5ede456afc603d8b5
Remove VTPM_TOOLS from config/Tools.mk.in

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 31dcc0e08754 -r 3dc18d679d04 config/Tools.mk.in
--- a/config/Tools.mk.in	Mon Nov 19 12:59:48 2012 +0000
+++ b/config/Tools.mk.in	Mon Nov 19 12:59:49 2012 +0000
@@ -44,7 +44,6 @@ GIT_HTTP            := @githttp@
 
 # Optional components
 XENSTAT_XENTOP      := @monitors@
-VTPM_TOOLS          := @vtpm@
 LIBXENAPI_BINDINGS  := @xenapi@
 OCAML_TOOLS         := @ocamltools@
 CONFIG_MINITERM     := @miniterm@

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0iZ-0002Xo-8H; Wed, 21 Nov 2012 03:11:15 +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 1Tb0iX-0002Wx-Ba
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:13 +0000
Received: from [85.158.137.99:60632] by server-7.bemta-3.messagelabs.com id
	FC/38-01713-0564CA05; Wed, 21 Nov 2012 03:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-217.messagelabs.com!1353467470!17599814!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5078 invoked from network); 21 Nov 2012 03:11:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Nov 2012 03: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 1Tb0iT-0007d4-Sv
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iT-0005Xl-Qy
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:09 +0000
Message-Id: <E1Tb0iT-0005Xl-Qy@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen/arm: get the number of cpus from
	device tree
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1353329986 0
# Node ID 17539cec2b9d0f1500d76f43178f57ab0a4160a8
# Parent  ddb109120dbd67a166dc0fa512cb0ef54dc799ca
xen/arm: get the number of cpus from device tree

The system might have fewer cpus than the GIC supports.

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 ddb109120dbd -r 17539cec2b9d xen/arch/arm/gic.c
--- a/xen/arch/arm/gic.c	Mon Nov 19 12:59:46 2012 +0000
+++ b/xen/arch/arm/gic.c	Mon Nov 19 12:59:46 2012 +0000
@@ -304,7 +304,7 @@ static void __cpuinit gic_hyp_disable(vo
 }
 
 /* Set up the GIC */
-int __init gic_init(void)
+void __init gic_init(void)
 {
     /* XXX FIXME get this from devicetree */
     gic.dbase = GIC_BASE_ADDRESS + GIC_DR_OFFSET;
@@ -328,8 +328,6 @@ int __init gic_init(void)
     gic.lr_mask = 0ULL;
 
     spin_unlock(&gic.lock);
-
-    return gic.cpus;
 }
 
 /* Set up the per-CPU parts of the GIC for a secondary CPU */
diff -r ddb109120dbd -r 17539cec2b9d xen/arch/arm/gic.h
--- a/xen/arch/arm/gic.h	Mon Nov 19 12:59:46 2012 +0000
+++ b/xen/arch/arm/gic.h	Mon Nov 19 12:59:46 2012 +0000
@@ -147,7 +147,7 @@ extern int gic_route_irq_to_guest(struct
 /* 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, and report # cpus attached */
-extern int gic_init(void);
+extern void gic_init(void);
 /* Bring up a secondary CPU's per-CPU GIC interface */
 extern void gic_init_secondary_cpu(void);
 /* Take down a CPU's per-CPU GIC interface */
diff -r ddb109120dbd -r 17539cec2b9d xen/arch/arm/setup.c
--- a/xen/arch/arm/setup.c	Mon Nov 19 12:59:46 2012 +0000
+++ b/xen/arch/arm/setup.c	Mon Nov 19 12:59:46 2012 +0000
@@ -185,10 +185,13 @@ void __init start_xen(unsigned long boot
     size_t fdt_size;
     int cpus, i;
 
+    smp_clear_cpu_maps();
+
     fdt = (void *)BOOT_MISC_VIRT_START
         + (atag_paddr & ((1 << SECOND_SHIFT) - 1));
     fdt_size = device_tree_early_init(fdt);
 
+    cpus = smp_get_max_cpus();
     cmdline_parse(device_tree_bootargs(fdt));
 
     setup_pagetables(boot_phys_offset, get_xen_paddr());
@@ -199,7 +202,7 @@ void __init start_xen(unsigned long boot
     console_init_preirq();
 #endif
 
-    cpus = gic_init();
+    gic_init();
     make_cpus_ready(cpus, boot_phys_offset);
 
     percpu_init_areas();
diff -r ddb109120dbd -r 17539cec2b9d xen/arch/arm/smpboot.c
--- a/xen/arch/arm/smpboot.c	Mon Nov 19 12:59:46 2012 +0000
+++ b/xen/arch/arm/smpboot.c	Mon Nov 19 12:59:46 2012 +0000
@@ -71,18 +71,31 @@ static void setup_cpu_sibling_map(int cp
     cpumask_set_cpu(cpu, per_cpu(cpu_core_mask, cpu));
 }
 
+void __init
+smp_clear_cpu_maps (void)
+{
+    cpumask_clear(&cpu_possible_map);
+    cpumask_clear(&cpu_online_map);
+    cpumask_set_cpu(0, &cpu_online_map);
+    cpumask_set_cpu(0, &cpu_possible_map);
+}
+
+int __init
+smp_get_max_cpus (void)
+{
+    int i, max_cpus = 0;
+
+    for ( i = 0; i < nr_cpu_ids; i++ )
+        if ( cpu_possible(i) )
+            max_cpus++;
+
+    return max_cpus;
+}
+
 
 void __init
 smp_prepare_cpus (unsigned int max_cpus)
 {
-    int i;
-
-    cpumask_clear(&cpu_online_map);
-    cpumask_set_cpu(0, &cpu_online_map);
-
-    cpumask_clear(&cpu_possible_map);
-    for ( i = 0; i < max_cpus; i++ )
-        cpumask_set_cpu(i, &cpu_possible_map);
     cpumask_copy(&cpu_present_map, &cpu_possible_map);
 
     setup_cpu_sibling_map(0);
diff -r ddb109120dbd -r 17539cec2b9d xen/common/device_tree.c
--- a/xen/common/device_tree.c	Mon Nov 19 12:59:46 2012 +0000
+++ b/xen/common/device_tree.c	Mon Nov 19 12:59:46 2012 +0000
@@ -18,6 +18,7 @@
 #include <xen/mm.h>
 #include <xen/stdarg.h>
 #include <xen/string.h>
+#include <xen/cpumask.h>
 #include <asm/early_printk.h>
 
 struct dt_early_info __initdata early_info;
@@ -41,6 +42,18 @@ bool_t device_tree_node_matches(const vo
         && (name[match_len] == '@' || name[match_len] == '\0');
 }
 
+bool_t device_tree_type_matches(const void *fdt, int node, const char *match)
+{
+    int len;
+    const void *prop;
+
+    prop = fdt_getprop(fdt, node, "device_type", &len);
+    if ( prop == NULL )
+        return 0;
+
+    return !strncmp(prop, match, len);
+}
+
 static void __init get_val(const u32 **cell, u32 cells, u64 *val)
 {
     *val = 0;
@@ -229,6 +242,34 @@ static void __init process_memory_node(c
     }
 }
 
+static void __init process_cpu_node(const void *fdt, int node,
+                                    const char *name,
+                                    u32 address_cells, u32 size_cells)
+{
+    const struct fdt_property *prop;
+    const u32 *cell;
+    paddr_t start, size;
+
+    if ( address_cells != 1 || size_cells != 0 )
+    {
+        early_printk("fdt: node `%s': invalid #address-cells or #size-cells",
+                     name);
+        return;
+    }
+
+    prop = fdt_get_property(fdt, node, "reg", NULL);
+    if ( !prop )
+    {
+        early_printk("fdt: node `%s': missing `reg' property\n", name);
+        return;
+    }
+
+    cell = (const u32 *)prop->data;
+    device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
+
+    cpumask_set_cpu(start, &cpu_possible_map);
+}
+
 static int __init early_scan_node(const void *fdt,
                                   int node, const char *name, int depth,
                                   u32 address_cells, u32 size_cells,
@@ -236,6 +277,8 @@ static int __init early_scan_node(const 
 {
     if ( device_tree_node_matches(fdt, node, "memory") )
         process_memory_node(fdt, node, name, address_cells, size_cells);
+    else if ( device_tree_type_matches(fdt, node, "cpu") )
+        process_cpu_node(fdt, node, name, address_cells, size_cells);
 
     return 0;
 }
diff -r ddb109120dbd -r 17539cec2b9d xen/include/asm-arm/smp.h
--- a/xen/include/asm-arm/smp.h	Mon Nov 19 12:59:46 2012 +0000
+++ b/xen/include/asm-arm/smp.h	Mon Nov 19 12:59:46 2012 +0000
@@ -22,6 +22,8 @@ extern void stop_cpu(void);
 extern void
 make_cpus_ready(unsigned int max_cpus, unsigned long boot_phys_offset);
 
+extern void smp_clear_cpu_maps (void);
+extern int smp_get_max_cpus (void);
 #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 Wed Nov 21 03:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0ib-0002ZI-Vu; Wed, 21 Nov 2012 03:11:17 +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 1Tb0ia-0002Xs-4h
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:16 +0000
Received: from [85.158.143.99:18218] by server-3.bemta-4.messagelabs.com id
	06/72-06841-3564CA05; Wed, 21 Nov 2012 03:11:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-216.messagelabs.com!1353467474!23220266!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16460 invoked from network); 21 Nov 2012 03:11:14 -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;
	21 Nov 2012 03: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 1Tb0iX-0007dP-Rg
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iX-0005ZV-NQ
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:13 +0000
Message-Id: <E1Tb0iX-0005ZV-NQ@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] AMD IOMMU: fix type of "bdf"
	parameter of update_intremap_entry_from_msi_msg()
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353334512 -3600
# Node ID 31668da0c4d31d32ec27e229422d57ccc5ee0b77
# Parent  380ad94f2adc3a9e77a181d13ccf8454776d85ba
AMD IOMMU: fix type of "bdf" parameter of update_intremap_entry_from_msi_msg()

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 380ad94f2adc -r 31668da0c4d3 xen/drivers/passthrough/amd/iommu_intr.c
--- a/xen/drivers/passthrough/amd/iommu_intr.c	Mon Nov 19 12:59:51 2012 +0000
+++ b/xen/drivers/passthrough/amd/iommu_intr.c	Mon Nov 19 15:15:12 2012 +0100
@@ -263,7 +263,7 @@ void amd_iommu_ioapic_update_ire(
 }
 
 static void update_intremap_entry_from_msi_msg(
-    struct amd_iommu *iommu, u8 bdf,
+    struct amd_iommu *iommu, u16 bdf,
     struct msi_desc *msi_desc, struct msi_msg *msg)
 {
     unsigned long flags;

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0iZ-0002Xj-5F; Wed, 21 Nov 2012 03:11: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 1Tb0iX-0002X3-He
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:13 +0000
Received: from [85.158.143.99:18172] by server-1.bemta-4.messagelabs.com id
	D5/FB-27934-0564CA05; Wed, 21 Nov 2012 03:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-216.messagelabs.com!1353467471!30770953!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20873 invoked from network); 21 Nov 2012 03:11:12 -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;
	21 Nov 2012 03: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 1Tb0iV-0007dA-4G
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iU-0005YG-TR
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:10 +0000
Message-Id: <E1Tb0iU-0005YG-TR@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] minios: Update mini-os license to
	support GPL features
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1353329988 0
# Node ID d026f8abca518d41151d5ba5bd88c5b6871b584d
# Parent  42a7c393c3901e3ecb734cd8a5f28894a0364b7e
minios: Update mini-os license to support GPL features

This patch updates extras/mini-os/COPYING to explain
which optional features are GPL and what the implications
of enabling them are.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 42a7c393c390 -r d026f8abca51 extras/mini-os/COPYING
--- a/extras/mini-os/COPYING	Mon Nov 19 12:59:47 2012 +0000
+++ b/extras/mini-os/COPYING	Mon Nov 19 12:59:48 2012 +0000
@@ -1,3 +1,16 @@
+Certain files in this directory are licensed by the GNU
+General Public License version 2 (GPLv2). By default these
+files are not built and linked into MiniOs. Enabling them
+will cause the whole work to become covered by the GPLv2.
+
+The current set of GPLv2 features are:
+CONFIG_TPMFRONT
+CONFIG_TPMBACK
+CONFIG_TPM_TIS
+
+Do not use these if you do not want your MiniOS build to become
+GPL licensed!
+
 Copyright (c) 2009 Citrix Systems, Inc. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0ib-0002ZI-Vu; Wed, 21 Nov 2012 03:11:17 +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 1Tb0ia-0002Xs-4h
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:16 +0000
Received: from [85.158.143.99:18218] by server-3.bemta-4.messagelabs.com id
	06/72-06841-3564CA05; Wed, 21 Nov 2012 03:11:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-216.messagelabs.com!1353467474!23220266!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16460 invoked from network); 21 Nov 2012 03:11:14 -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;
	21 Nov 2012 03: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 1Tb0iX-0007dP-Rg
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iX-0005ZV-NQ
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:13 +0000
Message-Id: <E1Tb0iX-0005ZV-NQ@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] AMD IOMMU: fix type of "bdf"
	parameter of update_intremap_entry_from_msi_msg()
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353334512 -3600
# Node ID 31668da0c4d31d32ec27e229422d57ccc5ee0b77
# Parent  380ad94f2adc3a9e77a181d13ccf8454776d85ba
AMD IOMMU: fix type of "bdf" parameter of update_intremap_entry_from_msi_msg()

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 380ad94f2adc -r 31668da0c4d3 xen/drivers/passthrough/amd/iommu_intr.c
--- a/xen/drivers/passthrough/amd/iommu_intr.c	Mon Nov 19 12:59:51 2012 +0000
+++ b/xen/drivers/passthrough/amd/iommu_intr.c	Mon Nov 19 15:15:12 2012 +0100
@@ -263,7 +263,7 @@ void amd_iommu_ioapic_update_ire(
 }
 
 static void update_intremap_entry_from_msi_msg(
-    struct amd_iommu *iommu, u8 bdf,
+    struct amd_iommu *iommu, u16 bdf,
     struct msi_desc *msi_desc, struct msi_msg *msg)
 {
     unsigned long flags;

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03:11: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.xen.org>)
	id 1Tb0iZ-0002Xe-2O; Wed, 21 Nov 2012 03: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 1Tb0iX-0002Wy-B0
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:13 +0000
Received: from [85.158.139.211:22116] by server-13.bemta-5.messagelabs.com id
	30/7C-27809-0564CA05; Wed, 21 Nov 2012 03:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-206.messagelabs.com!1353467470!20958895!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5198 invoked from network); 21 Nov 2012 03:11:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Nov 2012 03: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 1Tb0iU-0007d7-H8
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iU-0005Y1-C5
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:10 +0000
Message-Id: <E1Tb0iU-0005Y1-C5@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] minios: fix bug in lseek for mini-os
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1353329987 0
# Node ID 42a7c393c3901e3ecb734cd8a5f28894a0364b7e
# Parent  17539cec2b9d0f1500d76f43178f57ab0a4160a8
minios: fix bug in lseek for mini-os

lseek always used files[fd].file.offset. It should
use the offset of whatever union member is actually
being used.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 17539cec2b9d -r 42a7c393c390 extras/mini-os/lib/sys.c
--- a/extras/mini-os/lib/sys.c	Mon Nov 19 12:59:46 2012 +0000
+++ b/extras/mini-os/lib/sys.c	Mon Nov 19 12:59:47 2012 +0000
@@ -360,45 +360,54 @@ int write(int fd, const void *buf, size_
 
 off_t lseek(int fd, off_t offset, int whence)
 {
+    off_t* target = NULL;
     switch(files[fd].type) {
-#if defined(CONFIG_BLKFRONT) || defined(CONFIG_TPMFRONT) || defined(CONFIG_TPM_TIS)
 #ifdef CONFIG_BLKFRONT
        case FTYPE_BLK:
+          target = &files[fd].blk.offset;
+          break;
 #endif
-#ifdef CONFIG_TPMFRNT
+#ifdef CONFIG_TPMFRONT
        case FTYPE_TPMFRONT:
+          target = &files[fd].tpmfront.offset;
+          break;
 #endif
 #ifdef CONFIG_TPM_TIS
        case FTYPE_TPM_TIS:
+          target = &files[fd].tpm_tis.offset;
+          break;
 #endif
-	  switch (whence) {
-	     case SEEK_SET:
-		files[fd].file.offset = offset;
-		break;
-	     case SEEK_CUR:
-		files[fd].file.offset += offset;
-		break;
-	     case SEEK_END:
-		{
-		   struct stat st;
-		   int ret;
-		   ret = fstat(fd, &st);
-		   if (ret)
-		      return -1;
-		   files[fd].file.offset = st.st_size + offset;
-		   break;
-		}
-	     default:
-		errno = EINVAL;
-		return -1;
-	  }
-	  return files[fd].file.offset;
-	  break;
-#endif
-       default: /* Not implemented on this FTYPE */
-	  errno = ESPIPE;
-	  return (off_t) -1;
+       case FTYPE_FILE:
+          target = &files[fd].file.offset;
+          break;
+       default:
+          /* Not implemented for this filetype */
+          errno = ESPIPE;
+          return (off_t) -1;
     }
+
+    switch (whence) {
+       case SEEK_SET:
+          *target = offset;
+          break;
+       case SEEK_CUR:
+          *target += offset;
+          break;
+       case SEEK_END:
+          {
+             struct stat st;
+             int ret;
+             ret = fstat(fd, &st);
+             if (ret)
+                return -1;
+             *target = st.st_size + offset;
+             break;
+          }
+       default:
+          errno = EINVAL;
+          return -1;
+    }
+    return *target;
 }
 
 int fsync(int fd) {

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0iZ-0002Xj-5F; Wed, 21 Nov 2012 03:11: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 1Tb0iX-0002X3-He
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:13 +0000
Received: from [85.158.143.99:18172] by server-1.bemta-4.messagelabs.com id
	D5/FB-27934-0564CA05; Wed, 21 Nov 2012 03:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-216.messagelabs.com!1353467471!30770953!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20873 invoked from network); 21 Nov 2012 03:11:12 -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;
	21 Nov 2012 03: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 1Tb0iV-0007dA-4G
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iU-0005YG-TR
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:10 +0000
Message-Id: <E1Tb0iU-0005YG-TR@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] minios: Update mini-os license to
	support GPL features
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1353329988 0
# Node ID d026f8abca518d41151d5ba5bd88c5b6871b584d
# Parent  42a7c393c3901e3ecb734cd8a5f28894a0364b7e
minios: Update mini-os license to support GPL features

This patch updates extras/mini-os/COPYING to explain
which optional features are GPL and what the implications
of enabling them are.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 42a7c393c390 -r d026f8abca51 extras/mini-os/COPYING
--- a/extras/mini-os/COPYING	Mon Nov 19 12:59:47 2012 +0000
+++ b/extras/mini-os/COPYING	Mon Nov 19 12:59:48 2012 +0000
@@ -1,3 +1,16 @@
+Certain files in this directory are licensed by the GNU
+General Public License version 2 (GPLv2). By default these
+files are not built and linked into MiniOs. Enabling them
+will cause the whole work to become covered by the GPLv2.
+
+The current set of GPLv2 features are:
+CONFIG_TPMFRONT
+CONFIG_TPMBACK
+CONFIG_TPM_TIS
+
+Do not use these if you do not want your MiniOS build to become
+GPL licensed!
+
 Copyright (c) 2009 Citrix Systems, Inc. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03:11: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.xen.org>)
	id 1Tb0iZ-0002Y7-EN; Wed, 21 Nov 2012 03:11: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 1Tb0iX-0002X4-Vn
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:14 +0000
Received: from [85.158.143.35:57614] by server-2.bemta-4.messagelabs.com id
	CE/2C-28922-1564CA05; Wed, 21 Nov 2012 03:11:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1353467469!5664601!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27705 invoked from network); 21 Nov 2012 03:11: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;
	21 Nov 2012 03: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 1Tb0iS-0007cv-JP
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iS-0005X2-4w
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:08 +0000
Message-Id: <E1Tb0iS-0005X2-4w@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] AMD IOMMU: Enable HPET broadcast msi
	remapping
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Wei Wang <wei.wang2@amd.com>
# Date 1353314806 -3600
# Node ID 9025a10c056174671c6c0d87816732a2ec6eaf0e
# Parent  321f8487379bd6ca157fe11b4b518436d8b31e7e
AMD IOMMU: Enable HPET broadcast msi remapping

This patch enables hpet msi remapping for amd iommu.

Signed-off-by: Wei Wang <wei.wang2@amd.com>

- use the existing ACPI_IVHD_* #define-s
- warn on finding more than one IVHD HPET entry
- consolidate parameters of update_intremap_entry_from_msi_msg()

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


diff -r 321f8487379b -r 9025a10c0561 xen/drivers/passthrough/amd/iommu_acpi.c
--- a/xen/drivers/passthrough/amd/iommu_acpi.c	Thu Nov 15 10:25:29 2012 +0000
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c	Mon Nov 19 09:46:46 2012 +0100
@@ -653,9 +653,32 @@ static u16 __init parse_ivhd_device_spec
     }
 
     add_ivrs_mapping_entry(bdf, bdf, special->header.data_setting, iommu);
+
+    switch ( special->variety )
+    {
+    case ACPI_IVHD_IOAPIC:
     /* set device id of ioapic */
-    ioapic_sbdf[special->handle].bdf = bdf;
-    ioapic_sbdf[special->handle].seg = seg;
+        ioapic_sbdf[special->handle].bdf = bdf;
+        ioapic_sbdf[special->handle].seg = seg;
+        break;
+    case ACPI_IVHD_HPET:
+        /* set device id of hpet */
+        if ( hpet_sbdf.iommu )
+        {
+            printk(XENLOG_WARNING "Only one IVHD HPET entry is supported\n");
+            break;
+        }
+        hpet_sbdf.id = special->handle;
+        hpet_sbdf.bdf = bdf;
+        hpet_sbdf.seg = seg;
+        hpet_sbdf.iommu = iommu;
+        break;
+    default:
+        printk(XENLOG_ERR "Unrecognized IVHD special variety %#x\n",
+               special->variety);
+        return 0;
+    }
+
     return dev_length;
 }
 
diff -r 321f8487379b -r 9025a10c0561 xen/drivers/passthrough/amd/iommu_intr.c
--- a/xen/drivers/passthrough/amd/iommu_intr.c	Thu Nov 15 10:25:29 2012 +0000
+++ b/xen/drivers/passthrough/amd/iommu_intr.c	Mon Nov 19 09:46:46 2012 +0100
@@ -28,6 +28,7 @@
 #define INTREMAP_ENTRIES (1 << INTREMAP_LENGTH)
 
 struct ioapic_sbdf ioapic_sbdf[MAX_IO_APICS];
+struct hpet_sbdf hpet_sbdf;
 void *shared_intremap_table;
 static DEFINE_SPINLOCK(shared_intremap_lock);
 
@@ -262,19 +263,18 @@ void amd_iommu_ioapic_update_ire(
 }
 
 static void update_intremap_entry_from_msi_msg(
-    struct amd_iommu *iommu, struct pci_dev *pdev,
+    struct amd_iommu *iommu, u8 bdf,
     struct msi_desc *msi_desc, struct msi_msg *msg)
 {
     unsigned long flags;
     u32* entry;
-    u16 bdf, req_id, alias_id;
+    u16 req_id, alias_id;
     u8 delivery_mode, dest, vector, dest_mode;
     spinlock_t *lock;
     int offset;
 
-    bdf = PCI_BDF2(pdev->bus, pdev->devfn);
-    req_id = get_dma_requestor_id(pdev->seg, bdf);
-    alias_id = get_intremap_requestor_id(pdev->seg, bdf);
+    req_id = get_dma_requestor_id(iommu->seg, bdf);
+    alias_id = get_intremap_requestor_id(iommu->seg, bdf);
 
     if ( msg == NULL )
     {
@@ -284,7 +284,7 @@ static void update_intremap_entry_from_m
         spin_unlock_irqrestore(lock, flags);
 
         if ( ( req_id != alias_id ) &&
-             get_ivrs_mappings(pdev->seg)[alias_id].intremap_table != NULL )
+             get_ivrs_mappings(iommu->seg)[alias_id].intremap_table != NULL )
         {
             lock = get_intremap_lock(iommu->seg, alias_id);
             spin_lock_irqsave(lock, flags);
@@ -317,7 +317,7 @@ static void update_intremap_entry_from_m
 
     lock = get_intremap_lock(iommu->seg, alias_id);
     if ( ( req_id != alias_id ) &&
-         get_ivrs_mappings(pdev->seg)[alias_id].intremap_table != NULL )
+         get_ivrs_mappings(iommu->seg)[alias_id].intremap_table != NULL )
     {
         spin_lock_irqsave(lock, flags);
         entry = (u32*)get_intremap_entry(iommu->seg, alias_id, offset);
@@ -340,20 +340,23 @@ void amd_iommu_msi_msg_update_ire(
     struct msi_desc *msi_desc, struct msi_msg *msg)
 {
     struct pci_dev *pdev = msi_desc->dev;
-    int bdf = PCI_BDF2(pdev->bus, pdev->devfn);
+    int bdf, seg;
     struct amd_iommu *iommu;
 
     if ( !iommu_intremap )
         return;
 
-    iommu = find_iommu_for_device(pdev->seg, bdf);
+    bdf = pdev ? PCI_BDF2(pdev->bus, pdev->devfn) : hpet_sbdf.bdf;
+    seg = pdev ? pdev->seg : hpet_sbdf.seg;
+
+    iommu = find_iommu_for_device(seg, bdf);
     if ( !iommu )
     {
         AMD_IOMMU_DEBUG("Fail to find iommu for MSI device id = %#x\n", bdf);
         return;
     }
 
-    update_intremap_entry_from_msi_msg(iommu, pdev, msi_desc, msg);
+    update_intremap_entry_from_msi_msg(iommu, bdf, msi_desc, msg);
 }
 
 void amd_iommu_read_msi_from_ire(
@@ -383,3 +386,15 @@ void* __init amd_iommu_alloc_intremap_ta
     memset(tb, 0, PAGE_SIZE * (1UL << INTREMAP_TABLE_ORDER));
     return tb;
 }
+
+int __init amd_setup_hpet_msi(struct msi_desc *msi_desc)
+{
+    if ( (!msi_desc->hpet_id != hpet_sbdf.id) ||
+         (hpet_sbdf.iommu == NULL) )
+    {
+        AMD_IOMMU_DEBUG("Fail to setup HPET MSI remapping\n");
+        return 1;
+    }
+
+    return 0;
+}
diff -r 321f8487379b -r 9025a10c0561 xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c	Thu Nov 15 10:25:29 2012 +0000
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c	Mon Nov 19 09:46:46 2012 +0100
@@ -599,6 +599,7 @@ const struct iommu_ops amd_iommu_ops = {
     .update_ire_from_msi = amd_iommu_msi_msg_update_ire,
     .read_apic_from_ire = __io_apic_read,
     .read_msi_from_ire = amd_iommu_read_msi_from_ire,
+    .setup_hpet_msi = amd_setup_hpet_msi,
     .suspend = amd_iommu_suspend,
     .resume = amd_iommu_resume,
     .share_p2m = amd_iommu_share_p2m,
diff -r 321f8487379b -r 9025a10c0561 xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h	Thu Nov 15 10:25:29 2012 +0000
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h	Mon Nov 19 09:46:46 2012 +0100
@@ -97,12 +97,18 @@ void amd_iommu_msi_msg_update_ire(
     struct msi_desc *msi_desc, struct msi_msg *msg);
 void amd_iommu_read_msi_from_ire(
     struct msi_desc *msi_desc, struct msi_msg *msg);
+int amd_setup_hpet_msi(struct msi_desc *msi_desc);
 
 extern struct ioapic_sbdf {
     u16 bdf, seg;
 } ioapic_sbdf[MAX_IO_APICS];
 extern void *shared_intremap_table;
 
+extern struct hpet_sbdf {
+    u16 bdf, seg, id;
+    struct amd_iommu *iommu;
+} hpet_sbdf;
+
 /* power management support */
 void amd_iommu_resume(void);
 void amd_iommu_suspend(void);

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03:11: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.xen.org>)
	id 1Tb0iZ-0002Xe-2O; Wed, 21 Nov 2012 03: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 1Tb0iX-0002Wy-B0
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:13 +0000
Received: from [85.158.139.211:22116] by server-13.bemta-5.messagelabs.com id
	30/7C-27809-0564CA05; Wed, 21 Nov 2012 03:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-206.messagelabs.com!1353467470!20958895!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5198 invoked from network); 21 Nov 2012 03:11:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Nov 2012 03: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 1Tb0iU-0007d7-H8
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iU-0005Y1-C5
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:10 +0000
Message-Id: <E1Tb0iU-0005Y1-C5@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] minios: fix bug in lseek for mini-os
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1353329987 0
# Node ID 42a7c393c3901e3ecb734cd8a5f28894a0364b7e
# Parent  17539cec2b9d0f1500d76f43178f57ab0a4160a8
minios: fix bug in lseek for mini-os

lseek always used files[fd].file.offset. It should
use the offset of whatever union member is actually
being used.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 17539cec2b9d -r 42a7c393c390 extras/mini-os/lib/sys.c
--- a/extras/mini-os/lib/sys.c	Mon Nov 19 12:59:46 2012 +0000
+++ b/extras/mini-os/lib/sys.c	Mon Nov 19 12:59:47 2012 +0000
@@ -360,45 +360,54 @@ int write(int fd, const void *buf, size_
 
 off_t lseek(int fd, off_t offset, int whence)
 {
+    off_t* target = NULL;
     switch(files[fd].type) {
-#if defined(CONFIG_BLKFRONT) || defined(CONFIG_TPMFRONT) || defined(CONFIG_TPM_TIS)
 #ifdef CONFIG_BLKFRONT
        case FTYPE_BLK:
+          target = &files[fd].blk.offset;
+          break;
 #endif
-#ifdef CONFIG_TPMFRNT
+#ifdef CONFIG_TPMFRONT
        case FTYPE_TPMFRONT:
+          target = &files[fd].tpmfront.offset;
+          break;
 #endif
 #ifdef CONFIG_TPM_TIS
        case FTYPE_TPM_TIS:
+          target = &files[fd].tpm_tis.offset;
+          break;
 #endif
-	  switch (whence) {
-	     case SEEK_SET:
-		files[fd].file.offset = offset;
-		break;
-	     case SEEK_CUR:
-		files[fd].file.offset += offset;
-		break;
-	     case SEEK_END:
-		{
-		   struct stat st;
-		   int ret;
-		   ret = fstat(fd, &st);
-		   if (ret)
-		      return -1;
-		   files[fd].file.offset = st.st_size + offset;
-		   break;
-		}
-	     default:
-		errno = EINVAL;
-		return -1;
-	  }
-	  return files[fd].file.offset;
-	  break;
-#endif
-       default: /* Not implemented on this FTYPE */
-	  errno = ESPIPE;
-	  return (off_t) -1;
+       case FTYPE_FILE:
+          target = &files[fd].file.offset;
+          break;
+       default:
+          /* Not implemented for this filetype */
+          errno = ESPIPE;
+          return (off_t) -1;
     }
+
+    switch (whence) {
+       case SEEK_SET:
+          *target = offset;
+          break;
+       case SEEK_CUR:
+          *target += offset;
+          break;
+       case SEEK_END:
+          {
+             struct stat st;
+             int ret;
+             ret = fstat(fd, &st);
+             if (ret)
+                return -1;
+             *target = st.st_size + offset;
+             break;
+          }
+       default:
+          errno = EINVAL;
+          return -1;
+    }
+    return *target;
 }
 
 int fsync(int fd) {

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03:11: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.xen.org>)
	id 1Tb0ib-0002ZA-TH; Wed, 21 Nov 2012 03:11:17 +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 1Tb0iZ-0002X4-Q2
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:16 +0000
Received: from [85.158.143.99:18211] by server-2.bemta-4.messagelabs.com id
	12/3C-28922-3564CA05; Wed, 21 Nov 2012 03:11:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-216.messagelabs.com!1353467473!19535877!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1625 invoked from network); 21 Nov 2012 03:11:14 -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;
	21 Nov 2012 03: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 1Tb0iW-0007dJ-Qk
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iW-0005Z1-Lq
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:12 +0000
Message-Id: <E1Tb0iW-0005Z1-Lq@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: Remove old vtpm stuff from
	tools/libxen
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1353329990 0
# Node ID 5a6225e403883d096cbf2ccf54dd72afaeaf7f9a
# Parent  3dc18d679d04bc7cfbfbb3fae06f121f8632dff5
tools: Remove old vtpm stuff from tools/libxen

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 3dc18d679d04 -r 5a6225e40388 tools/libxen/include/xen/api/xen_all.h
--- a/tools/libxen/include/xen/api/xen_all.h	Mon Nov 19 12:59:49 2012 +0000
+++ b/tools/libxen/include/xen/api/xen_all.h	Mon Nov 19 12:59:50 2012 +0000
@@ -35,7 +35,6 @@
 #include <xen/api/xen_vm.h>
 #include <xen/api/xen_vm_metrics.h>
 #include <xen/api/xen_vm_power_state.h>
-#include <xen/api/xen_vtpm.h>
 #include <xen/api/xen_xspolicy.h>
 #include <xen/api/xen_cpu_pool.h>
 #endif
diff -r 3dc18d679d04 -r 5a6225e40388 tools/libxen/include/xen/api/xen_vm.h
--- a/tools/libxen/include/xen/api/xen_vm.h	Mon Nov 19 12:59:49 2012 +0000
+++ b/tools/libxen/include/xen/api/xen_vm.h	Mon Nov 19 12:59:50 2012 +0000
@@ -33,7 +33,6 @@
 #include <xen/api/xen_vm_guest_metrics_decl.h>
 #include <xen/api/xen_vm_metrics_decl.h>
 #include <xen/api/xen_vm_power_state.h>
-#include <xen/api/xen_vtpm_decl.h>
 #include <xen/api/xen_cpu_pool_decl.h>
 
 
@@ -98,7 +97,6 @@ typedef struct xen_vm_record
     struct xen_vif_record_opt_set *vifs;
     struct xen_vbd_record_opt_set *vbds;
     struct xen_crashdump_record_opt_set *crash_dumps;
-    struct xen_vtpm_record_opt_set *vtpms;
     char *pv_bootloader;
     char *pv_kernel;
     char *pv_ramdisk;
@@ -396,13 +394,6 @@ xen_vm_get_crash_dumps(xen_session *sess
 
 
 /**
- * Get the VTPMs field of the given VM.
- */
-extern bool
-xen_vm_get_vtpms(xen_session *session, struct xen_vtpm_set **result, xen_vm vm);
-
-
-/**
  * Get the PV/bootloader field of the given VM.
  */
 extern bool
diff -r 3dc18d679d04 -r 5a6225e40388 tools/libxen/include/xen/api/xen_vtpm.h
--- a/tools/libxen/include/xen/api/xen_vtpm.h	Mon Nov 19 12:59:49 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,218 +0,0 @@
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- * Copyright (c) 2006, IBM Corp.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
- */
-
-#ifndef XEN_VTPM_H
-#define XEN_VTPM_H
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_vm_decl.h>
-#include <xen/api/xen_vtpm_decl.h>
-
-
-/*
- * The VTPM class.
- * 
- * A virtual TPM device.
- */
-
-
-/**
- * Free the given xen_vtpm.  The given handle must have been allocated
- * by this library.
- */
-extern void
-xen_vtpm_free(xen_vtpm vtpm);
-
-
-typedef struct xen_vtpm_set
-{
-    size_t size;
-    xen_vtpm *contents[];
-} xen_vtpm_set;
-
-/**
- * Allocate a xen_vtpm_set of the given size.
- */
-extern xen_vtpm_set *
-xen_vtpm_set_alloc(size_t size);
-
-/**
- * Free the given xen_vtpm_set.  The given set must have been allocated
- * by this library.
- */
-extern void
-xen_vtpm_set_free(xen_vtpm_set *set);
-
-
-typedef struct xen_vtpm_record
-{
-    xen_vtpm handle;
-    char *uuid;
-    struct xen_vm_record_opt *vm;
-    struct xen_vm_record_opt *backend;
-    xen_string_string_map *other_config;
-} xen_vtpm_record;
-
-/**
- * Allocate a xen_vtpm_record.
- */
-extern xen_vtpm_record *
-xen_vtpm_record_alloc(void);
-
-/**
- * Free the given xen_vtpm_record, and all referenced values.  The
- * given record must have been allocated by this library.
- */
-extern void
-xen_vtpm_record_free(xen_vtpm_record *record);
-
-
-typedef struct xen_vtpm_record_opt
-{
-    bool is_record;
-    union
-    {
-        xen_vtpm handle;
-        xen_vtpm_record *record;
-    } u;
-} xen_vtpm_record_opt;
-
-/**
- * Allocate a xen_vtpm_record_opt.
- */
-extern xen_vtpm_record_opt *
-xen_vtpm_record_opt_alloc(void);
-
-/**
- * Free the given xen_vtpm_record_opt, and all referenced values.  The
- * given record_opt must have been allocated by this library.
- */
-extern void
-xen_vtpm_record_opt_free(xen_vtpm_record_opt *record_opt);
-
-
-typedef struct xen_vtpm_record_set
-{
-    size_t size;
-    xen_vtpm_record *contents[];
-} xen_vtpm_record_set;
-
-/**
- * Allocate a xen_vtpm_record_set of the given size.
- */
-extern xen_vtpm_record_set *
-xen_vtpm_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_vtpm_record_set, and all referenced values.  The
- * given set must have been allocated by this library.
- */
-extern void
-xen_vtpm_record_set_free(xen_vtpm_record_set *set);
-
-
-
-typedef struct xen_vtpm_record_opt_set
-{
-    size_t size;
-    xen_vtpm_record_opt *contents[];
-} xen_vtpm_record_opt_set;
-
-/**
- * Allocate a xen_vtpm_record_opt_set of the given size.
- */
-extern xen_vtpm_record_opt_set *
-xen_vtpm_record_opt_set_alloc(size_t size);
-
-/**
- * Free the given xen_vtpm_record_opt_set, and all referenced values. 
- * The given set must have been allocated by this library.
- */
-extern void
-xen_vtpm_record_opt_set_free(xen_vtpm_record_opt_set *set);
-
-
-/**
- * Get a record containing the current state of the given VTPM.
- */
-extern bool
-xen_vtpm_get_record(xen_session *session, xen_vtpm_record **result, xen_vtpm vtpm);
-
-
-/**
- * Get a reference to the VTPM instance with the specified UUID.
- */
-extern bool
-xen_vtpm_get_by_uuid(xen_session *session, xen_vtpm *result, char *uuid);
-
-
-/**
- * Create a new VTPM instance, and return its handle.
- */
-extern bool
-xen_vtpm_create(xen_session *session, xen_vtpm *result, xen_vtpm_record *record);
-
-
-/**
- * Destroy the specified VTPM instance.
- */
-extern bool
-xen_vtpm_destroy(xen_session *session, xen_vtpm vtpm);
-
-
-/**
- * Get the uuid field of the given VTPM.
- */
-extern bool
-xen_vtpm_get_uuid(xen_session *session, char **result, xen_vtpm vtpm);
-
-
-/**
- * Get the VM field of the given VTPM.
- */
-extern bool
-xen_vtpm_get_vm(xen_session *session, xen_vm *result, xen_vtpm vtpm);
-
-
-/**
- * Get the backend field of the given VTPM.
- */
-extern bool
-xen_vtpm_get_backend(xen_session *session, xen_vm *result, xen_vtpm vtpm);
-
-
-/**
- * Get the other_config field of the given VTPM.
- */
-extern bool
-xen_vtpm_get_other_config(xen_session *session,
-                          xen_string_string_map **result,
-                          xen_vtpm vtpm);
-
-
-/**
- * Set the other_config field of the given VTPM.
- */
-extern bool
-xen_vtpm_set_other_config(xen_session *session,
-                          xen_vtpm vtpm,
-                          xen_string_string_map *other_config);
-
-
-#endif
diff -r 3dc18d679d04 -r 5a6225e40388 tools/libxen/include/xen/api/xen_vtpm_decl.h
--- a/tools/libxen/include/xen/api/xen_vtpm_decl.h	Mon Nov 19 12:59:49 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2006, XenSource Inc.
- * Copyright (c) 2006, IBM Corp.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
- */
-
-#ifndef XEN_VTPM_DECL_H
-#define XEN_VTPM_DECL_H
-
-typedef void *xen_vtpm;
-
-struct xen_vtpm_set;
-struct xen_vtpm_record;
-struct xen_vtpm_record_set;
-struct xen_vtpm_record_opt;
-struct xen_vtpm_record_opt_set;
-
-#endif
diff -r 3dc18d679d04 -r 5a6225e40388 tools/libxen/src/xen_vm.c
--- a/tools/libxen/src/xen_vm.c	Mon Nov 19 12:59:49 2012 +0000
+++ b/tools/libxen/src/xen_vm.c	Mon Nov 19 12:59:50 2012 +0000
@@ -35,7 +35,6 @@
 #include <xen/api/xen_vm.h>
 #include <xen/api/xen_vm_guest_metrics.h>
 #include <xen/api/xen_vm_metrics.h>
-#include <xen/api/xen_vtpm.h>
 #include <xen/api/xen_cpu_pool.h>
 
 
@@ -119,9 +118,6 @@ static const struct_member xen_vm_record
         { .key = "crash_dumps",
           .type = &abstract_type_ref_set,
           .offset = offsetof(xen_vm_record, crash_dumps) },
-        { .key = "VTPMs",
-          .type = &abstract_type_ref_set,
-          .offset = offsetof(xen_vm_record, vtpms) },
         { .key = "PV_bootloader",
           .type = &abstract_type_string,
           .offset = offsetof(xen_vm_record, pv_bootloader) },
@@ -203,7 +199,6 @@ xen_vm_record_free(xen_vm_record *record
     xen_vif_record_opt_set_free(record->vifs);
     xen_vbd_record_opt_set_free(record->vbds);
     xen_crashdump_record_opt_set_free(record->crash_dumps);
-    xen_vtpm_record_opt_set_free(record->vtpms);
     free(record->pv_bootloader);
     free(record->pv_kernel);
     free(record->pv_ramdisk);
@@ -668,23 +663,6 @@ xen_vm_get_crash_dumps(xen_session *sess
 
 
 bool
-xen_vm_get_vtpms(xen_session *session, struct xen_vtpm_set **result, xen_vm vm)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vm }
-        };
-
-    abstract_type result_type = abstract_type_string_set;
-
-    *result = NULL;
-    XEN_CALL_("VM.get_VTPMs");
-    return session->ok;
-}
-
-
-bool
 xen_vm_get_pv_bootloader(xen_session *session, char **result, xen_vm vm)
 {
     abstract_value param_values[] =
diff -r 3dc18d679d04 -r 5a6225e40388 tools/libxen/src/xen_vtpm.c
--- a/tools/libxen/src/xen_vtpm.c	Mon Nov 19 12:59:49 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,235 +0,0 @@
-/*
- * Copyright (c) 2006, XenSource Inc.
- * Copyright (c) 2006, IBM Corp.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_vm.h>
-#include <xen/api/xen_vtpm.h>
-
-
-XEN_FREE(xen_vtpm)
-XEN_SET_ALLOC_FREE(xen_vtpm)
-XEN_ALLOC(xen_vtpm_record)
-XEN_SET_ALLOC_FREE(xen_vtpm_record)
-XEN_ALLOC(xen_vtpm_record_opt)
-XEN_RECORD_OPT_FREE(xen_vtpm)
-XEN_SET_ALLOC_FREE(xen_vtpm_record_opt)
-
-
-static const struct_member xen_vtpm_record_struct_members[] =
-    {
-        { .key = "uuid",
-          .type = &abstract_type_string,
-          .offset = offsetof(xen_vtpm_record, uuid) },
-        { .key = "VM",
-          .type = &abstract_type_ref,
-          .offset = offsetof(xen_vtpm_record, vm) },
-        { .key = "backend",
-          .type = &abstract_type_ref,
-          .offset = offsetof(xen_vtpm_record, backend) },
-        { .key = "other_config",
-          .type = &abstract_type_string_string_map,
-          .offset = offsetof(xen_vtpm_record, other_config) }
-    };
-
-const abstract_type xen_vtpm_record_abstract_type_ =
-    {
-       .typename = STRUCT,
-       .struct_size = sizeof(xen_vtpm_record),
-       .member_count =
-           sizeof(xen_vtpm_record_struct_members) / sizeof(struct_member),
-       .members = xen_vtpm_record_struct_members
-    };
-
-
-void
-xen_vtpm_record_free(xen_vtpm_record *record)
-{
-    if (record == NULL)
-    {
-        return;
-    }
-    free(record->handle);
-    free(record->uuid);
-    xen_vm_record_opt_free(record->vm);
-    xen_vm_record_opt_free(record->backend);
-    xen_string_string_map_free(record->other_config);
-    free(record);
-}
-
-
-bool
-xen_vtpm_get_record(xen_session *session, xen_vtpm_record **result, xen_vtpm vtpm)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vtpm }
-        };
-
-    abstract_type result_type = xen_vtpm_record_abstract_type_;
-
-    *result = NULL;
-    XEN_CALL_("VTPM.get_record");
-
-    if (session->ok)
-    {
-       (*result)->handle = xen_strdup_((*result)->uuid);
-    }
-
-    return session->ok;
-}
-
-
-bool
-xen_vtpm_get_by_uuid(xen_session *session, xen_vtpm *result, char *uuid)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = uuid }
-        };
-
-    abstract_type result_type = abstract_type_string;
-
-    *result = NULL;
-    XEN_CALL_("VTPM.get_by_uuid");
-    return session->ok;
-}
-
-
-bool
-xen_vtpm_create(xen_session *session, xen_vtpm *result, xen_vtpm_record *record)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &xen_vtpm_record_abstract_type_,
-              .u.struct_val = record }
-        };
-
-    abstract_type result_type = abstract_type_string;
-
-    *result = NULL;
-    XEN_CALL_("VTPM.create");
-    return session->ok;
-}
-
-
-bool
-xen_vtpm_destroy(xen_session *session, xen_vtpm vtpm)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vtpm }
-        };
-
-    xen_call_(session, "VTPM.destroy", param_values, 1, NULL, NULL);
-    return session->ok;
-}
-
-
-bool
-xen_vtpm_get_vm(xen_session *session, xen_vm *result, xen_vtpm vtpm)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vtpm }
-        };
-
-    abstract_type result_type = abstract_type_string;
-
-    *result = NULL;
-    XEN_CALL_("VTPM.get_VM");
-    return session->ok;
-}
-
-
-bool
-xen_vtpm_get_backend(xen_session *session, xen_vm *result, xen_vtpm vtpm)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vtpm }
-        };
-
-    abstract_type result_type = abstract_type_string;
-
-    *result = NULL;
-    XEN_CALL_("VTPM.get_backend");
-    return session->ok;
-}
-
-
-bool
-xen_vtpm_get_uuid(xen_session *session, char **result, xen_vtpm vtpm)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vtpm }
-        };
-
-    abstract_type result_type = abstract_type_string;
-
-    *result = NULL;
-    XEN_CALL_("VTPM.get_uuid");
-    return session->ok;
-}
-
-
-bool
-xen_vtpm_get_other_config(xen_session *session, xen_string_string_map **result,
-                          xen_vtpm vtpm)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vtpm }
-        };
-
-    abstract_type result_type = abstract_type_string_string_map;
-
-    *result = NULL;
-    XEN_CALL_("VTPM.get_other_config");
-    return session->ok;
-}
-
-
-bool
-xen_vtpm_set_other_config(xen_session *session, xen_vtpm vtpm,
-                          xen_string_string_map *other_config)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vtpm },
-            { .type = &abstract_type_string_string_map,
-              .u.set_val = (arbitrary_set *)other_config }
-        };
-
-    xen_call_(session, "VTPM.set_other_config", param_values, 2, NULL, NULL);
-    return session->ok;
-}

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03:11: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.xen.org>)
	id 1Tb0iZ-0002Y7-EN; Wed, 21 Nov 2012 03:11: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 1Tb0iX-0002X4-Vn
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:14 +0000
Received: from [85.158.143.35:57614] by server-2.bemta-4.messagelabs.com id
	CE/2C-28922-1564CA05; Wed, 21 Nov 2012 03:11:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1353467469!5664601!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27705 invoked from network); 21 Nov 2012 03:11: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;
	21 Nov 2012 03: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 1Tb0iS-0007cv-JP
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iS-0005X2-4w
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:08 +0000
Message-Id: <E1Tb0iS-0005X2-4w@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] AMD IOMMU: Enable HPET broadcast msi
	remapping
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Wei Wang <wei.wang2@amd.com>
# Date 1353314806 -3600
# Node ID 9025a10c056174671c6c0d87816732a2ec6eaf0e
# Parent  321f8487379bd6ca157fe11b4b518436d8b31e7e
AMD IOMMU: Enable HPET broadcast msi remapping

This patch enables hpet msi remapping for amd iommu.

Signed-off-by: Wei Wang <wei.wang2@amd.com>

- use the existing ACPI_IVHD_* #define-s
- warn on finding more than one IVHD HPET entry
- consolidate parameters of update_intremap_entry_from_msi_msg()

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


diff -r 321f8487379b -r 9025a10c0561 xen/drivers/passthrough/amd/iommu_acpi.c
--- a/xen/drivers/passthrough/amd/iommu_acpi.c	Thu Nov 15 10:25:29 2012 +0000
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c	Mon Nov 19 09:46:46 2012 +0100
@@ -653,9 +653,32 @@ static u16 __init parse_ivhd_device_spec
     }
 
     add_ivrs_mapping_entry(bdf, bdf, special->header.data_setting, iommu);
+
+    switch ( special->variety )
+    {
+    case ACPI_IVHD_IOAPIC:
     /* set device id of ioapic */
-    ioapic_sbdf[special->handle].bdf = bdf;
-    ioapic_sbdf[special->handle].seg = seg;
+        ioapic_sbdf[special->handle].bdf = bdf;
+        ioapic_sbdf[special->handle].seg = seg;
+        break;
+    case ACPI_IVHD_HPET:
+        /* set device id of hpet */
+        if ( hpet_sbdf.iommu )
+        {
+            printk(XENLOG_WARNING "Only one IVHD HPET entry is supported\n");
+            break;
+        }
+        hpet_sbdf.id = special->handle;
+        hpet_sbdf.bdf = bdf;
+        hpet_sbdf.seg = seg;
+        hpet_sbdf.iommu = iommu;
+        break;
+    default:
+        printk(XENLOG_ERR "Unrecognized IVHD special variety %#x\n",
+               special->variety);
+        return 0;
+    }
+
     return dev_length;
 }
 
diff -r 321f8487379b -r 9025a10c0561 xen/drivers/passthrough/amd/iommu_intr.c
--- a/xen/drivers/passthrough/amd/iommu_intr.c	Thu Nov 15 10:25:29 2012 +0000
+++ b/xen/drivers/passthrough/amd/iommu_intr.c	Mon Nov 19 09:46:46 2012 +0100
@@ -28,6 +28,7 @@
 #define INTREMAP_ENTRIES (1 << INTREMAP_LENGTH)
 
 struct ioapic_sbdf ioapic_sbdf[MAX_IO_APICS];
+struct hpet_sbdf hpet_sbdf;
 void *shared_intremap_table;
 static DEFINE_SPINLOCK(shared_intremap_lock);
 
@@ -262,19 +263,18 @@ void amd_iommu_ioapic_update_ire(
 }
 
 static void update_intremap_entry_from_msi_msg(
-    struct amd_iommu *iommu, struct pci_dev *pdev,
+    struct amd_iommu *iommu, u8 bdf,
     struct msi_desc *msi_desc, struct msi_msg *msg)
 {
     unsigned long flags;
     u32* entry;
-    u16 bdf, req_id, alias_id;
+    u16 req_id, alias_id;
     u8 delivery_mode, dest, vector, dest_mode;
     spinlock_t *lock;
     int offset;
 
-    bdf = PCI_BDF2(pdev->bus, pdev->devfn);
-    req_id = get_dma_requestor_id(pdev->seg, bdf);
-    alias_id = get_intremap_requestor_id(pdev->seg, bdf);
+    req_id = get_dma_requestor_id(iommu->seg, bdf);
+    alias_id = get_intremap_requestor_id(iommu->seg, bdf);
 
     if ( msg == NULL )
     {
@@ -284,7 +284,7 @@ static void update_intremap_entry_from_m
         spin_unlock_irqrestore(lock, flags);
 
         if ( ( req_id != alias_id ) &&
-             get_ivrs_mappings(pdev->seg)[alias_id].intremap_table != NULL )
+             get_ivrs_mappings(iommu->seg)[alias_id].intremap_table != NULL )
         {
             lock = get_intremap_lock(iommu->seg, alias_id);
             spin_lock_irqsave(lock, flags);
@@ -317,7 +317,7 @@ static void update_intremap_entry_from_m
 
     lock = get_intremap_lock(iommu->seg, alias_id);
     if ( ( req_id != alias_id ) &&
-         get_ivrs_mappings(pdev->seg)[alias_id].intremap_table != NULL )
+         get_ivrs_mappings(iommu->seg)[alias_id].intremap_table != NULL )
     {
         spin_lock_irqsave(lock, flags);
         entry = (u32*)get_intremap_entry(iommu->seg, alias_id, offset);
@@ -340,20 +340,23 @@ void amd_iommu_msi_msg_update_ire(
     struct msi_desc *msi_desc, struct msi_msg *msg)
 {
     struct pci_dev *pdev = msi_desc->dev;
-    int bdf = PCI_BDF2(pdev->bus, pdev->devfn);
+    int bdf, seg;
     struct amd_iommu *iommu;
 
     if ( !iommu_intremap )
         return;
 
-    iommu = find_iommu_for_device(pdev->seg, bdf);
+    bdf = pdev ? PCI_BDF2(pdev->bus, pdev->devfn) : hpet_sbdf.bdf;
+    seg = pdev ? pdev->seg : hpet_sbdf.seg;
+
+    iommu = find_iommu_for_device(seg, bdf);
     if ( !iommu )
     {
         AMD_IOMMU_DEBUG("Fail to find iommu for MSI device id = %#x\n", bdf);
         return;
     }
 
-    update_intremap_entry_from_msi_msg(iommu, pdev, msi_desc, msg);
+    update_intremap_entry_from_msi_msg(iommu, bdf, msi_desc, msg);
 }
 
 void amd_iommu_read_msi_from_ire(
@@ -383,3 +386,15 @@ void* __init amd_iommu_alloc_intremap_ta
     memset(tb, 0, PAGE_SIZE * (1UL << INTREMAP_TABLE_ORDER));
     return tb;
 }
+
+int __init amd_setup_hpet_msi(struct msi_desc *msi_desc)
+{
+    if ( (!msi_desc->hpet_id != hpet_sbdf.id) ||
+         (hpet_sbdf.iommu == NULL) )
+    {
+        AMD_IOMMU_DEBUG("Fail to setup HPET MSI remapping\n");
+        return 1;
+    }
+
+    return 0;
+}
diff -r 321f8487379b -r 9025a10c0561 xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c	Thu Nov 15 10:25:29 2012 +0000
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c	Mon Nov 19 09:46:46 2012 +0100
@@ -599,6 +599,7 @@ const struct iommu_ops amd_iommu_ops = {
     .update_ire_from_msi = amd_iommu_msi_msg_update_ire,
     .read_apic_from_ire = __io_apic_read,
     .read_msi_from_ire = amd_iommu_read_msi_from_ire,
+    .setup_hpet_msi = amd_setup_hpet_msi,
     .suspend = amd_iommu_suspend,
     .resume = amd_iommu_resume,
     .share_p2m = amd_iommu_share_p2m,
diff -r 321f8487379b -r 9025a10c0561 xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h	Thu Nov 15 10:25:29 2012 +0000
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h	Mon Nov 19 09:46:46 2012 +0100
@@ -97,12 +97,18 @@ void amd_iommu_msi_msg_update_ire(
     struct msi_desc *msi_desc, struct msi_msg *msg);
 void amd_iommu_read_msi_from_ire(
     struct msi_desc *msi_desc, struct msi_msg *msg);
+int amd_setup_hpet_msi(struct msi_desc *msi_desc);
 
 extern struct ioapic_sbdf {
     u16 bdf, seg;
 } ioapic_sbdf[MAX_IO_APICS];
 extern void *shared_intremap_table;
 
+extern struct hpet_sbdf {
+    u16 bdf, seg, id;
+    struct amd_iommu *iommu;
+} hpet_sbdf;
+
 /* power management support */
 void amd_iommu_resume(void);
 void amd_iommu_suspend(void);

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03:11: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.xen.org>)
	id 1Tb0ib-0002ZA-TH; Wed, 21 Nov 2012 03:11:17 +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 1Tb0iZ-0002X4-Q2
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:16 +0000
Received: from [85.158.143.99:18211] by server-2.bemta-4.messagelabs.com id
	12/3C-28922-3564CA05; Wed, 21 Nov 2012 03:11:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-216.messagelabs.com!1353467473!19535877!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1625 invoked from network); 21 Nov 2012 03:11:14 -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;
	21 Nov 2012 03: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 1Tb0iW-0007dJ-Qk
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iW-0005Z1-Lq
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:12 +0000
Message-Id: <E1Tb0iW-0005Z1-Lq@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: Remove old vtpm stuff from
	tools/libxen
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1353329990 0
# Node ID 5a6225e403883d096cbf2ccf54dd72afaeaf7f9a
# Parent  3dc18d679d04bc7cfbfbb3fae06f121f8632dff5
tools: Remove old vtpm stuff from tools/libxen

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 3dc18d679d04 -r 5a6225e40388 tools/libxen/include/xen/api/xen_all.h
--- a/tools/libxen/include/xen/api/xen_all.h	Mon Nov 19 12:59:49 2012 +0000
+++ b/tools/libxen/include/xen/api/xen_all.h	Mon Nov 19 12:59:50 2012 +0000
@@ -35,7 +35,6 @@
 #include <xen/api/xen_vm.h>
 #include <xen/api/xen_vm_metrics.h>
 #include <xen/api/xen_vm_power_state.h>
-#include <xen/api/xen_vtpm.h>
 #include <xen/api/xen_xspolicy.h>
 #include <xen/api/xen_cpu_pool.h>
 #endif
diff -r 3dc18d679d04 -r 5a6225e40388 tools/libxen/include/xen/api/xen_vm.h
--- a/tools/libxen/include/xen/api/xen_vm.h	Mon Nov 19 12:59:49 2012 +0000
+++ b/tools/libxen/include/xen/api/xen_vm.h	Mon Nov 19 12:59:50 2012 +0000
@@ -33,7 +33,6 @@
 #include <xen/api/xen_vm_guest_metrics_decl.h>
 #include <xen/api/xen_vm_metrics_decl.h>
 #include <xen/api/xen_vm_power_state.h>
-#include <xen/api/xen_vtpm_decl.h>
 #include <xen/api/xen_cpu_pool_decl.h>
 
 
@@ -98,7 +97,6 @@ typedef struct xen_vm_record
     struct xen_vif_record_opt_set *vifs;
     struct xen_vbd_record_opt_set *vbds;
     struct xen_crashdump_record_opt_set *crash_dumps;
-    struct xen_vtpm_record_opt_set *vtpms;
     char *pv_bootloader;
     char *pv_kernel;
     char *pv_ramdisk;
@@ -396,13 +394,6 @@ xen_vm_get_crash_dumps(xen_session *sess
 
 
 /**
- * Get the VTPMs field of the given VM.
- */
-extern bool
-xen_vm_get_vtpms(xen_session *session, struct xen_vtpm_set **result, xen_vm vm);
-
-
-/**
  * Get the PV/bootloader field of the given VM.
  */
 extern bool
diff -r 3dc18d679d04 -r 5a6225e40388 tools/libxen/include/xen/api/xen_vtpm.h
--- a/tools/libxen/include/xen/api/xen_vtpm.h	Mon Nov 19 12:59:49 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,218 +0,0 @@
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- * Copyright (c) 2006, IBM Corp.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
- */
-
-#ifndef XEN_VTPM_H
-#define XEN_VTPM_H
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_vm_decl.h>
-#include <xen/api/xen_vtpm_decl.h>
-
-
-/*
- * The VTPM class.
- * 
- * A virtual TPM device.
- */
-
-
-/**
- * Free the given xen_vtpm.  The given handle must have been allocated
- * by this library.
- */
-extern void
-xen_vtpm_free(xen_vtpm vtpm);
-
-
-typedef struct xen_vtpm_set
-{
-    size_t size;
-    xen_vtpm *contents[];
-} xen_vtpm_set;
-
-/**
- * Allocate a xen_vtpm_set of the given size.
- */
-extern xen_vtpm_set *
-xen_vtpm_set_alloc(size_t size);
-
-/**
- * Free the given xen_vtpm_set.  The given set must have been allocated
- * by this library.
- */
-extern void
-xen_vtpm_set_free(xen_vtpm_set *set);
-
-
-typedef struct xen_vtpm_record
-{
-    xen_vtpm handle;
-    char *uuid;
-    struct xen_vm_record_opt *vm;
-    struct xen_vm_record_opt *backend;
-    xen_string_string_map *other_config;
-} xen_vtpm_record;
-
-/**
- * Allocate a xen_vtpm_record.
- */
-extern xen_vtpm_record *
-xen_vtpm_record_alloc(void);
-
-/**
- * Free the given xen_vtpm_record, and all referenced values.  The
- * given record must have been allocated by this library.
- */
-extern void
-xen_vtpm_record_free(xen_vtpm_record *record);
-
-
-typedef struct xen_vtpm_record_opt
-{
-    bool is_record;
-    union
-    {
-        xen_vtpm handle;
-        xen_vtpm_record *record;
-    } u;
-} xen_vtpm_record_opt;
-
-/**
- * Allocate a xen_vtpm_record_opt.
- */
-extern xen_vtpm_record_opt *
-xen_vtpm_record_opt_alloc(void);
-
-/**
- * Free the given xen_vtpm_record_opt, and all referenced values.  The
- * given record_opt must have been allocated by this library.
- */
-extern void
-xen_vtpm_record_opt_free(xen_vtpm_record_opt *record_opt);
-
-
-typedef struct xen_vtpm_record_set
-{
-    size_t size;
-    xen_vtpm_record *contents[];
-} xen_vtpm_record_set;
-
-/**
- * Allocate a xen_vtpm_record_set of the given size.
- */
-extern xen_vtpm_record_set *
-xen_vtpm_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_vtpm_record_set, and all referenced values.  The
- * given set must have been allocated by this library.
- */
-extern void
-xen_vtpm_record_set_free(xen_vtpm_record_set *set);
-
-
-
-typedef struct xen_vtpm_record_opt_set
-{
-    size_t size;
-    xen_vtpm_record_opt *contents[];
-} xen_vtpm_record_opt_set;
-
-/**
- * Allocate a xen_vtpm_record_opt_set of the given size.
- */
-extern xen_vtpm_record_opt_set *
-xen_vtpm_record_opt_set_alloc(size_t size);
-
-/**
- * Free the given xen_vtpm_record_opt_set, and all referenced values. 
- * The given set must have been allocated by this library.
- */
-extern void
-xen_vtpm_record_opt_set_free(xen_vtpm_record_opt_set *set);
-
-
-/**
- * Get a record containing the current state of the given VTPM.
- */
-extern bool
-xen_vtpm_get_record(xen_session *session, xen_vtpm_record **result, xen_vtpm vtpm);
-
-
-/**
- * Get a reference to the VTPM instance with the specified UUID.
- */
-extern bool
-xen_vtpm_get_by_uuid(xen_session *session, xen_vtpm *result, char *uuid);
-
-
-/**
- * Create a new VTPM instance, and return its handle.
- */
-extern bool
-xen_vtpm_create(xen_session *session, xen_vtpm *result, xen_vtpm_record *record);
-
-
-/**
- * Destroy the specified VTPM instance.
- */
-extern bool
-xen_vtpm_destroy(xen_session *session, xen_vtpm vtpm);
-
-
-/**
- * Get the uuid field of the given VTPM.
- */
-extern bool
-xen_vtpm_get_uuid(xen_session *session, char **result, xen_vtpm vtpm);
-
-
-/**
- * Get the VM field of the given VTPM.
- */
-extern bool
-xen_vtpm_get_vm(xen_session *session, xen_vm *result, xen_vtpm vtpm);
-
-
-/**
- * Get the backend field of the given VTPM.
- */
-extern bool
-xen_vtpm_get_backend(xen_session *session, xen_vm *result, xen_vtpm vtpm);
-
-
-/**
- * Get the other_config field of the given VTPM.
- */
-extern bool
-xen_vtpm_get_other_config(xen_session *session,
-                          xen_string_string_map **result,
-                          xen_vtpm vtpm);
-
-
-/**
- * Set the other_config field of the given VTPM.
- */
-extern bool
-xen_vtpm_set_other_config(xen_session *session,
-                          xen_vtpm vtpm,
-                          xen_string_string_map *other_config);
-
-
-#endif
diff -r 3dc18d679d04 -r 5a6225e40388 tools/libxen/include/xen/api/xen_vtpm_decl.h
--- a/tools/libxen/include/xen/api/xen_vtpm_decl.h	Mon Nov 19 12:59:49 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2006, XenSource Inc.
- * Copyright (c) 2006, IBM Corp.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
- */
-
-#ifndef XEN_VTPM_DECL_H
-#define XEN_VTPM_DECL_H
-
-typedef void *xen_vtpm;
-
-struct xen_vtpm_set;
-struct xen_vtpm_record;
-struct xen_vtpm_record_set;
-struct xen_vtpm_record_opt;
-struct xen_vtpm_record_opt_set;
-
-#endif
diff -r 3dc18d679d04 -r 5a6225e40388 tools/libxen/src/xen_vm.c
--- a/tools/libxen/src/xen_vm.c	Mon Nov 19 12:59:49 2012 +0000
+++ b/tools/libxen/src/xen_vm.c	Mon Nov 19 12:59:50 2012 +0000
@@ -35,7 +35,6 @@
 #include <xen/api/xen_vm.h>
 #include <xen/api/xen_vm_guest_metrics.h>
 #include <xen/api/xen_vm_metrics.h>
-#include <xen/api/xen_vtpm.h>
 #include <xen/api/xen_cpu_pool.h>
 
 
@@ -119,9 +118,6 @@ static const struct_member xen_vm_record
         { .key = "crash_dumps",
           .type = &abstract_type_ref_set,
           .offset = offsetof(xen_vm_record, crash_dumps) },
-        { .key = "VTPMs",
-          .type = &abstract_type_ref_set,
-          .offset = offsetof(xen_vm_record, vtpms) },
         { .key = "PV_bootloader",
           .type = &abstract_type_string,
           .offset = offsetof(xen_vm_record, pv_bootloader) },
@@ -203,7 +199,6 @@ xen_vm_record_free(xen_vm_record *record
     xen_vif_record_opt_set_free(record->vifs);
     xen_vbd_record_opt_set_free(record->vbds);
     xen_crashdump_record_opt_set_free(record->crash_dumps);
-    xen_vtpm_record_opt_set_free(record->vtpms);
     free(record->pv_bootloader);
     free(record->pv_kernel);
     free(record->pv_ramdisk);
@@ -668,23 +663,6 @@ xen_vm_get_crash_dumps(xen_session *sess
 
 
 bool
-xen_vm_get_vtpms(xen_session *session, struct xen_vtpm_set **result, xen_vm vm)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vm }
-        };
-
-    abstract_type result_type = abstract_type_string_set;
-
-    *result = NULL;
-    XEN_CALL_("VM.get_VTPMs");
-    return session->ok;
-}
-
-
-bool
 xen_vm_get_pv_bootloader(xen_session *session, char **result, xen_vm vm)
 {
     abstract_value param_values[] =
diff -r 3dc18d679d04 -r 5a6225e40388 tools/libxen/src/xen_vtpm.c
--- a/tools/libxen/src/xen_vtpm.c	Mon Nov 19 12:59:49 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,235 +0,0 @@
-/*
- * Copyright (c) 2006, XenSource Inc.
- * Copyright (c) 2006, IBM Corp.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_vm.h>
-#include <xen/api/xen_vtpm.h>
-
-
-XEN_FREE(xen_vtpm)
-XEN_SET_ALLOC_FREE(xen_vtpm)
-XEN_ALLOC(xen_vtpm_record)
-XEN_SET_ALLOC_FREE(xen_vtpm_record)
-XEN_ALLOC(xen_vtpm_record_opt)
-XEN_RECORD_OPT_FREE(xen_vtpm)
-XEN_SET_ALLOC_FREE(xen_vtpm_record_opt)
-
-
-static const struct_member xen_vtpm_record_struct_members[] =
-    {
-        { .key = "uuid",
-          .type = &abstract_type_string,
-          .offset = offsetof(xen_vtpm_record, uuid) },
-        { .key = "VM",
-          .type = &abstract_type_ref,
-          .offset = offsetof(xen_vtpm_record, vm) },
-        { .key = "backend",
-          .type = &abstract_type_ref,
-          .offset = offsetof(xen_vtpm_record, backend) },
-        { .key = "other_config",
-          .type = &abstract_type_string_string_map,
-          .offset = offsetof(xen_vtpm_record, other_config) }
-    };
-
-const abstract_type xen_vtpm_record_abstract_type_ =
-    {
-       .typename = STRUCT,
-       .struct_size = sizeof(xen_vtpm_record),
-       .member_count =
-           sizeof(xen_vtpm_record_struct_members) / sizeof(struct_member),
-       .members = xen_vtpm_record_struct_members
-    };
-
-
-void
-xen_vtpm_record_free(xen_vtpm_record *record)
-{
-    if (record == NULL)
-    {
-        return;
-    }
-    free(record->handle);
-    free(record->uuid);
-    xen_vm_record_opt_free(record->vm);
-    xen_vm_record_opt_free(record->backend);
-    xen_string_string_map_free(record->other_config);
-    free(record);
-}
-
-
-bool
-xen_vtpm_get_record(xen_session *session, xen_vtpm_record **result, xen_vtpm vtpm)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vtpm }
-        };
-
-    abstract_type result_type = xen_vtpm_record_abstract_type_;
-
-    *result = NULL;
-    XEN_CALL_("VTPM.get_record");
-
-    if (session->ok)
-    {
-       (*result)->handle = xen_strdup_((*result)->uuid);
-    }
-
-    return session->ok;
-}
-
-
-bool
-xen_vtpm_get_by_uuid(xen_session *session, xen_vtpm *result, char *uuid)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = uuid }
-        };
-
-    abstract_type result_type = abstract_type_string;
-
-    *result = NULL;
-    XEN_CALL_("VTPM.get_by_uuid");
-    return session->ok;
-}
-
-
-bool
-xen_vtpm_create(xen_session *session, xen_vtpm *result, xen_vtpm_record *record)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &xen_vtpm_record_abstract_type_,
-              .u.struct_val = record }
-        };
-
-    abstract_type result_type = abstract_type_string;
-
-    *result = NULL;
-    XEN_CALL_("VTPM.create");
-    return session->ok;
-}
-
-
-bool
-xen_vtpm_destroy(xen_session *session, xen_vtpm vtpm)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vtpm }
-        };
-
-    xen_call_(session, "VTPM.destroy", param_values, 1, NULL, NULL);
-    return session->ok;
-}
-
-
-bool
-xen_vtpm_get_vm(xen_session *session, xen_vm *result, xen_vtpm vtpm)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vtpm }
-        };
-
-    abstract_type result_type = abstract_type_string;
-
-    *result = NULL;
-    XEN_CALL_("VTPM.get_VM");
-    return session->ok;
-}
-
-
-bool
-xen_vtpm_get_backend(xen_session *session, xen_vm *result, xen_vtpm vtpm)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vtpm }
-        };
-
-    abstract_type result_type = abstract_type_string;
-
-    *result = NULL;
-    XEN_CALL_("VTPM.get_backend");
-    return session->ok;
-}
-
-
-bool
-xen_vtpm_get_uuid(xen_session *session, char **result, xen_vtpm vtpm)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vtpm }
-        };
-
-    abstract_type result_type = abstract_type_string;
-
-    *result = NULL;
-    XEN_CALL_("VTPM.get_uuid");
-    return session->ok;
-}
-
-
-bool
-xen_vtpm_get_other_config(xen_session *session, xen_string_string_map **result,
-                          xen_vtpm vtpm)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vtpm }
-        };
-
-    abstract_type result_type = abstract_type_string_string_map;
-
-    *result = NULL;
-    XEN_CALL_("VTPM.get_other_config");
-    return session->ok;
-}
-
-
-bool
-xen_vtpm_set_other_config(xen_session *session, xen_vtpm vtpm,
-                          xen_string_string_map *other_config)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vtpm },
-            { .type = &abstract_type_string_string_map,
-              .u.set_val = (arbitrary_set *)other_config }
-        };
-
-    xen_call_(session, "VTPM.set_other_config", param_values, 2, NULL, NULL);
-    return session->ok;
-}

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03:11: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.xen.org>)
	id 1Tb0ia-0002Yc-Kc; Wed, 21 Nov 2012 03:11:16 +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 1Tb0iZ-0002Xs-Nl
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:15 +0000
Received: from [85.158.143.99:14059] by server-3.bemta-4.messagelabs.com id
	A5/72-06841-2564CA05; Wed, 21 Nov 2012 03:11:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-216.messagelabs.com!1353467473!25466414!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6936 invoked from network); 21 Nov 2012 03:11:14 -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;
	21 Nov 2012 03: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 1Tb0iX-0007dM-85
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iX-0005ZG-6v
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:13 +0000
Message-Id: <E1Tb0iX-0005ZG-6v@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Remove tools/vtpm* from MAINTAINERS
	file
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1353329991 0
# Node ID 380ad94f2adc3a9e77a181d13ccf8454776d85ba
# Parent  5a6225e403883d096cbf2ccf54dd72afaeaf7f9a
Remove tools/vtpm* from MAINTAINERS file

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 5a6225e40388 -r 380ad94f2adc MAINTAINERS
--- a/MAINTAINERS	Mon Nov 19 12:59:50 2012 +0000
+++ b/MAINTAINERS	Mon Nov 19 12:59:51 2012 +0000
@@ -252,8 +252,6 @@ F:	extras/minios-os/tpm-tis.c
 F:	extras/minios-os/include/tpmfront.h
 F:	extras/minios-os/include/tpmback.h
 F:	extras/minios-os/include/tpm-tis.h
-F:	tools/vtpm/
-F:	tools/vtpm_manager/
 F:	stubdom/vtpm/
 F:	stubdom/vtpmmgr/
 F:	docs/misc/vtpm.txt

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03:11: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.xen.org>)
	id 1Tb0ia-0002Yc-Kc; Wed, 21 Nov 2012 03:11:16 +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 1Tb0iZ-0002Xs-Nl
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:15 +0000
Received: from [85.158.143.99:14059] by server-3.bemta-4.messagelabs.com id
	A5/72-06841-2564CA05; Wed, 21 Nov 2012 03:11:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-216.messagelabs.com!1353467473!25466414!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6936 invoked from network); 21 Nov 2012 03:11:14 -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;
	21 Nov 2012 03: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 1Tb0iX-0007dM-85
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iX-0005ZG-6v
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:13 +0000
Message-Id: <E1Tb0iX-0005ZG-6v@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Remove tools/vtpm* from MAINTAINERS
	file
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1353329991 0
# Node ID 380ad94f2adc3a9e77a181d13ccf8454776d85ba
# Parent  5a6225e403883d096cbf2ccf54dd72afaeaf7f9a
Remove tools/vtpm* from MAINTAINERS file

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 5a6225e40388 -r 380ad94f2adc MAINTAINERS
--- a/MAINTAINERS	Mon Nov 19 12:59:50 2012 +0000
+++ b/MAINTAINERS	Mon Nov 19 12:59:51 2012 +0000
@@ -252,8 +252,6 @@ F:	extras/minios-os/tpm-tis.c
 F:	extras/minios-os/include/tpmfront.h
 F:	extras/minios-os/include/tpmback.h
 F:	extras/minios-os/include/tpm-tis.h
-F:	tools/vtpm/
-F:	tools/vtpm_manager/
 F:	stubdom/vtpm/
 F:	stubdom/vtpmmgr/
 F:	docs/misc/vtpm.txt

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0id-0002bF-9B; Wed, 21 Nov 2012 03:11: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 1Tb0ib-0002Yf-3G
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:17 +0000
Received: from [193.109.254.147:42113] by server-9.bemta-14.messagelabs.com id
	49/AC-30773-4564CA05; Wed, 21 Nov 2012 03:11:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1353467472!10152346!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=1.4 required=7.0 tests=INFO_TLD
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 703 invoked from network); 21 Nov 2012 03:11:13 -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;
	21 Nov 2012 03: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 1Tb0iV-0007dD-VC
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iV-0005YX-Hm
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:11 +0000
Message-Id: <E1Tb0iV-0005YX-Hm@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xend: Remove old vtpm support from xm
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1353329988 0
# Node ID 31dcc0e087541504589124b5ede456afc603d8b5
# Parent  d026f8abca518d41151d5ba5bd88c5b6871b584d
xend: Remove old vtpm support from xm

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r d026f8abca51 -r 31dcc0e08754 docs/man/xm.pod.1
--- a/docs/man/xm.pod.1	Mon Nov 19 12:59:48 2012 +0000
+++ b/docs/man/xm.pod.1	Mon Nov 19 12:59:48 2012 +0000
@@ -977,17 +977,6 @@ formatted as a list or as an S-Expressio
 
 =back
 
-=head2 VIRTUAL TPM DEVICES
-
-=over 4
-
-=item B<vtpm-list> [B<-l>|B<--long>] I<domain-id>
-
-Show the virtual TPM device for a domain.  The returned output is
-formatted as a list or as an S-Expression if the B<--long> option was given.
-
-=back
-
 =head1 SEE ALSO
 
 B<xmdomain.cfg>(5), B<xentop>(1)
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/README.XendConfig
--- a/tools/python/README.XendConfig	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/README.XendConfig	Mon Nov 19 12:59:48 2012 +0000
@@ -71,8 +71,6 @@ vbds                            !(device
  - io_read_kbs
  - io_write_kbs
 
-tpm_instance                    tpm.instance
-tpm_backend                     tpm.backend
 bios_boot                       image.boot?
 platform_std_VGA                image.stdvga
 platform_serial                 image.serial
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/README.sxpcfg
--- a/tools/python/README.sxpcfg	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/README.sxpcfg	Mon Nov 19 12:59:48 2012 +0000
@@ -105,10 +105,6 @@ io
   - from
   - to
 
-tpm
-  - pref_instance
-  - instance
-
 pciquirk
   - pci_ids
   - pci_config_space_fields
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/scripts/xapi.py
--- a/tools/python/scripts/xapi.py	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/scripts/xapi.py	Mon Nov 19 12:59:48 2012 +0000
@@ -58,7 +58,6 @@ COMMANDS = {
     'vdi-rename': ('<vdi_uuid> <new_name>', 'Rename VDI'),
     'vdi-destroy': ('<vdi_uuid>', 'Delete VDI'),
     'vif-create': ('<domname> <pycfg>', 'Create VIF attached to domname'),
-    'vtpm-create' : ('<domname> <pycfg>', 'Create VTPM attached to domname'),
 
     'vm-create': ('<pycfg>', 'Create VM with python config'),
     'vm-destroy': ('<domname>', 'Delete VM'),
@@ -284,22 +283,16 @@ def xapi_vm_list(args, async = False):
         if is_long:
             vbds = vm_info['VBDs']
             vifs = vm_info['VIFs']
-            vtpms = vm_info['VTPMs']
             vif_infos = []
             vbd_infos = []
-            vtpm_infos = []
             for vbd in vbds:
                 vbd_info = execute(server, 'VBD.get_record', (session, vbd))
                 vbd_infos.append(vbd_info)
             for vif in vifs:
                 vif_info = execute(server, 'VIF.get_record', (session, vif))
                 vif_infos.append(vif_info)
-            for vtpm in vtpms:
-                vtpm_info = execute(server, 'VTPM.get_record', (session, vtpm))
-                vtpm_infos.append(vtpm_info)
             vm_info['VBDs'] = vbd_infos
             vm_info['VIFs'] = vif_infos
-            vm_info['VTPMs'] = vtpm_infos
             pprint(vm_info)
         else:
             print VM_LIST_FORMAT % _stringify(vm_info)
@@ -661,19 +654,6 @@ def xapi_vdi_rename(args, async = False)
         print 'Done.'
 
 
-
-def xapi_vtpm_create(args, async = False):
-    server, session = connect()
-    domname = args[0]
-    cfg = _read_python_cfg(args[1])
-
-    vm_uuid = resolve_vm(server, session, domname)
-    cfg['VM'] = vm_uuid
-    print "Creating vTPM with cfg = %s" % cfg
-    vtpm_uuid = execute(server, 'VTPM.create', (session, cfg))
-    print "Done. (%s)" % vtpm_uuid
-
-
 def xapi_pif_list(args, async = False):
     server, session = connect()
     pif_uuids = execute(server, 'PIF.get_all', (session,))
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xend/XendAPI.py	Mon Nov 19 12:59:48 2012 +0000
@@ -377,17 +377,6 @@ def valid_vdi(func):
            _check_ref(XendNode.instance().is_valid_vdi,
                       'VDI', func, *args, **kwargs)
 
-def valid_vtpm(func):
-    """Decorator to verify if vtpm_ref is valid before calling method.
-
-    @param func: function with params: (self, session, vtpm_ref, ...)
-    @rtype: callable object
-    """
-    return lambda *args, **kwargs: \
-           _check_ref(lambda r: XendDomain.instance().is_valid_dev('vtpm', r),
-                      'VTPM', func, *args, **kwargs)
-
-
 def valid_console(func):
     """Decorator to verify if console_ref is valid before calling method.
 
@@ -481,7 +470,6 @@ classes = {
     'VIF'          : valid_vif,
     'VIF_metrics'  : valid_vif_metrics,
     'VDI'          : valid_vdi,
-    'VTPM'         : valid_vtpm,
     'console'      : valid_console,
     'SR'           : valid_sr,
     'task'         : valid_task,
@@ -1293,7 +1281,6 @@ class XendAPI(object):
                   'consoles',
                   'VIFs',
                   'VBDs',
-                  'VTPMs',
                   'DPCIs',
                   'DSCSIs',
                   'DSCSI_HBAs',
@@ -1436,10 +1423,6 @@ class XendAPI(object):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
         return xen_api_success(dom.get_vbds())
     
-    def VM_get_VTPMs(self, session, vm_ref):
-        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
-        return xen_api_success(dom.get_vtpms())
-
     def VM_get_consoles(self, session, vm_ref):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
         return xen_api_success(dom.get_consoles())
@@ -1851,7 +1834,6 @@ class XendAPI(object):
             'consoles': xeninfo.get_consoles(),
             'VIFs': xeninfo.get_vifs(),
             'VBDs': xeninfo.get_vbds(),
-            'VTPMs': xeninfo.get_vtpms(),
             'DPCIs': xeninfo.get_dpcis(),
             'DSCSIs': xeninfo.get_dscsis(),
             'DSCSI_HBAs': xeninfo.get_dscsi_HBAs(),
@@ -2537,116 +2519,6 @@ class XendAPI(object):
         vdi = XendNode.instance().get_vdi_by_uuid(vdi_ref)
         return xen_api_success(vdi.get_security_label())
 
-    # Xen API: Class VTPM
-    # ----------------------------------------------------------------
-
-    VTPM_attr_rw = ['other_config']
-    VTPM_attr_ro = ['VM',
-                    'backend',
-                    'runtime_properties' ]
-
-    VTPM_attr_inst = VTPM_attr_rw
-
-    VTPM_methods = [('destroy', None)]
-    VTPM_funcs = [('create', 'VTPM')]
-
-    def VTPM_get_other_config(self, session, vtpm_ref):
-        xendom = XendDomain.instance()
-        return xen_api_success(xendom.get_dev_property_by_uuid('vtpm',
-                                                               vtpm_ref,
-                                                               'other_config'))
-
-    def VTPM_set_other_config(self, session, vtpm_ref, other_config):
-        xendom = XendDomain.instance()
-        xendom.set_dev_property_by_uuid('vtpm',
-                                        vtpm_ref,
-                                        'other_config',
-                                        other_config)
-        return xen_api_success_void()
-    
-    # object methods
-    def VTPM_get_record(self, session, vtpm_ref):
-        xendom = XendDomain.instance()
-        vm = xendom.get_vm_with_dev_uuid('vtpm', vtpm_ref)
-        if not vm:
-            return xen_api_error(['HANDLE_INVALID', 'VTPM', vtpm_ref])
-        cfg = vm.get_dev_xenapi_config('vtpm', vtpm_ref)
-        if not cfg:
-            return xen_api_error(['HANDLE_INVALID', 'VTPM', vtpm_ref])
-        valid_vtpm_keys = self.VTPM_attr_ro + self.VTPM_attr_rw + \
-                          self.Base_attr_ro + self.Base_attr_rw
-        return_cfg = {}
-        for k in cfg.keys():
-            if k in valid_vtpm_keys:
-                return_cfg[k] = cfg[k]
-
-        return xen_api_success(return_cfg)
-
-    # Class Functions
-    def VTPM_get_backend(self, session, vtpm_ref):
-        xendom = XendDomain.instance()
-        vm = xendom.get_vm_with_dev_uuid('vtpm', vtpm_ref)
-        if not vm:
-            return xen_api_error(['HANDLE_INVALID', 'VTPM', vtpm_ref])
-        cfg = vm.get_dev_xenapi_config('vtpm', vtpm_ref)
-        if not cfg:
-            return xen_api_error(['HANDLE_INVALID', 'VTPM', vtpm_ref])
-        if not cfg.has_key('backend'):
-            return xen_api_error(['INTERNAL_ERROR', 'VTPM backend not set'])
-        return xen_api_success(cfg['backend'])
-
-    def VTPM_get_VM(self, session, vtpm_ref):
-        xendom = XendDomain.instance()
-        return xen_api_success(xendom.get_dev_property_by_uuid('vtpm',
-                                                              vtpm_ref, 'VM'))
-
-    def VTPM_destroy(self, session, vtpm_ref):
-        xendom = XendDomain.instance()
-        dom = xendom.get_vm_with_dev_uuid('vtpm', vtpm_ref)
-        if dom:
-            if dom.state != XEN_API_VM_POWER_STATE_HALTED:
-                vm_ref = dom.get_dev_property('vtpm', vtpm_ref, 'VM')
-                return xen_api_error(['VM_BAD_POWER_STATE', vm_ref,
-                 XendDomain.POWER_STATE_NAMES[XEN_API_VM_POWER_STATE_HALTED],
-                 XendDomain.POWER_STATE_NAMES[dom.state]])
-            from xen.xend.server import tpmif
-            tpmif.destroy_vtpmstate(dom.getName())
-            return xen_api_success_void()
-        else:
-            return xen_api_error(['HANDLE_INVALID', 'VTPM', vtpm_ref])
-
-    # class methods
-    def VTPM_create(self, session, vtpm_struct):
-        xendom = XendDomain.instance()
-        if xendom.is_valid_vm(vtpm_struct['VM']):
-            dom = xendom.get_vm_by_uuid(vtpm_struct['VM'])
-            try:
-                vtpm_ref = dom.create_vtpm(vtpm_struct)
-                xendom.managed_config_save(dom)
-                return xen_api_success(vtpm_ref)
-            except XendError, exn:
-                return xen_api_error(['INTERNAL_ERROR', str(exn)])
-        else:
-            return xen_api_error(['HANDLE_INVALID', 'VM', vtpm_struct['VM']])
-
-    def VTPM_get_all(self, session):
-        xendom = XendDomain.instance()
-        vtpms = [d.get_vtpms() for d in XendDomain.instance().list('all')]
-        vtpms = reduce(lambda x, y: x + y, vtpms)
-        return xen_api_success(vtpms)
-
-    def VTPM_get_runtime_properties(self, _, vtpm_ref):
-        xendom = XendDomain.instance()
-        dominfo = xendom.get_vm_with_dev_uuid('vtpm', vtpm_ref)
-        device = dominfo.get_dev_config_by_uuid('vtpm', vtpm_ref)
-
-        try:
-            device_sxps = dominfo.getDeviceSxprs('vtpm')
-            device_dict = dict(device_sxps[0][1])
-            return xen_api_success(device_dict)
-        except:
-            return xen_api_success({})
-
     # Xen API: Class console
     # ----------------------------------------------------------------
 
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xend/XendConfig.py	Mon Nov 19 12:59:48 2012 +0000
@@ -417,7 +417,6 @@ class XendConfig(dict):
             'console_refs': [],
             'vif_refs': [],
             'vbd_refs': [],
-            'vtpm_refs': [],
             'other_config': {},
             'platform': {},
             'target': 0,
@@ -937,7 +936,6 @@ class XendConfig(dict):
         self['console_refs'] = cfg.get('console_refs', [])
         self['vif_refs'] = cfg.get('vif_refs', [])
         self['vbd_refs'] = cfg.get('vbd_refs', [])
-        self['vtpm_refs'] = cfg.get('vtpm_refs', [])
 
         # coalesce hvm vnc frame buffer with vfb config
         if self.is_hvm() and int(self['platform'].get('vnc', 0)) != 0:
@@ -1488,7 +1486,7 @@ class XendConfig(dict):
 
             # store dev references by uuid for certain device types
             target['devices'][dev_uuid] = (dev_type, dev_info)
-            if dev_type in ('vif', 'vbd', 'vtpm'):
+            if dev_type in ('vif', 'vbd'):
                 param = '%s_refs' % dev_type
                 if param not in target:
                     target[param] = []
@@ -1630,18 +1628,6 @@ class XendConfig(dict):
                 target['devices'][dev_uuid] = (dev_type, dev_info)
                 target['vbd_refs'].append(dev_uuid)                
 
-            elif dev_type == 'vtpm':
-                if cfg_xenapi.get('type'):
-                    dev_info['type'] = cfg_xenapi.get('type')
-
-                dev_uuid = cfg_xenapi.get('uuid', None)
-                if not dev_uuid:
-                    dev_uuid = uuid.createString()
-                dev_info['uuid'] = dev_uuid
-                dev_info['other_config'] = cfg_xenapi.get('other_config', {})
-                target['devices'][dev_uuid] = (dev_type, dev_info)
-                target['vtpm_refs'].append(dev_uuid)
-
             elif dev_type == 'console':
                 dev_uuid = cfg_xenapi.get('uuid', None)
                 if not dev_uuid:
@@ -2078,8 +2064,7 @@ class XendConfig(dict):
 
         result.extend(target.get('console_refs', []) +
                       target.get('vbd_refs', []) +
-                      target.get('vif_refs', []) +
-                      target.get('vtpm_refs', []))
+                      target.get('vif_refs', []))
 
         result.extend([u for u in target['devices'].keys() if u not in result])
         return result
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xend/XendConstants.py
--- a/tools/python/xen/xend/XendConstants.py	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xend/XendConstants.py	Mon Nov 19 12:59:48 2012 +0000
@@ -115,7 +115,7 @@ TRIGGER_TYPE = {
 }
 
 #
-# Device migration stages (eg. XendDomainInfo, XendCheckpoint, server.tpmif)
+# Device migration stages (eg. XendDomainInfo, XendCheckpoint)
 #
 
 DEV_MIGRATE_TEST  = 0
@@ -124,12 +124,6 @@ DEV_MIGRATE_STEP2 = 2
 DEV_MIGRATE_STEP3 = 3
 
 #
-# VTPM-related constants
-#
-
-VTPM_DELETE_SCRIPT = auxbin.scripts_dir() + '/vtpm-delete'
-
-#
 # Xenstore Constants
 #
 
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xend/XendDevices.py
--- a/tools/python/xen/xend/XendDevices.py	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xend/XendDevices.py	Mon Nov 19 12:59:48 2012 +0000
@@ -19,7 +19,7 @@
 # A collection of DevControllers 
 #
 
-from xen.xend.server import blkif, netif, tpmif, pciif, iopif, irqif, vfbif, vscsiif, netif2, vusbif
+from xen.xend.server import blkif, netif, pciif, iopif, irqif, vfbif, vscsiif, netif2, vusbif
 from xen.xend.server.BlktapController import BlktapController, Blktap2Controller
 from xen.xend.server.ConsoleController import ConsoleController
 
@@ -38,7 +38,6 @@ class XendDevices:
         'vbd': blkif.BlkifController,
         'vif': netif.NetifController,
         'vif2': netif2.NetifController2,
-        'vtpm': tpmif.TPMifController,
         'pci': pciif.PciController,
         'ioports': iopif.IOPortsController,
         'irq': irqif.IRQController,
@@ -82,6 +81,5 @@ class XendDevices:
         @type domain: XendDomainInfo
         """
         from xen.xend.XendLogging import log
-        tpmif.destroy_vtpmstate(domain.info.get('vtpm_refs'))
 
     destroy_device_state = classmethod(destroy_device_state)
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py	Mon Nov 19 12:59:48 2012 +0000
@@ -3908,12 +3908,6 @@ class XendDomainInfo:
             else:
                 config['mode'] = 'RW'
 
-        if dev_class == 'vtpm':
-            if not config.has_key('type'):
-                config['type'] = 'paravirtualised' # TODO
-            if not config.has_key('backend'):
-                config['backend'] = "00000000-0000-0000-0000-000000000000"
-
         return config
 
     def get_dev_property(self, dev_class, dev_uuid, field):
@@ -3945,9 +3939,6 @@ class XendDomainInfo:
     def get_vbds(self):
         return self.info.get('vbd_refs', [])
 
-    def get_vtpms(self):
-        return self.info.get('vtpm_refs', [])
-
     def get_dpcis(self):
         return XendDPCI.get_by_VM(self.info.get('uuid'))
 
@@ -4046,23 +4037,6 @@ class XendDomainInfo:
  
         return dev_uuid
 
-    def create_vtpm(self, xenapi_vtpm):
-        """Create a VTPM device from the passed struct in Xen API format.
-
-        @return: uuid of the device
-        @rtype: string
-        """
-
-        if self._stateGet() not in (DOM_STATE_HALTED,):
-            raise VmError("Can only add vTPM to a halted domain.")
-        if self.get_vtpms() != []:
-            raise VmError('Domain already has a vTPM.')
-        dev_uuid = self.info.device_add('vtpm', cfg_xenapi = xenapi_vtpm)
-        if not dev_uuid:
-            raise XendError('Failed to create device')
-
-        return dev_uuid
-
     def create_console(self, xenapi_console):
         """ Create a console device from a Xen API struct.
 
@@ -4301,9 +4275,6 @@ class XendDomainInfo:
     def destroy_vif(self, dev_uuid):
         self.destroy_device_by_uuid('vif', dev_uuid)
 
-    def destroy_vtpm(self, dev_uuid):
-        self.destroy_device_by_uuid('vtpm', dev_uuid)
-
     def destroy_dpci(self, dev_uuid):
 
         dpci = XendAPIStore.get(dev_uuid, 'DPCI')
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xend/XendError.py
--- a/tools/python/xen/xend/XendError.py	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xend/XendError.py	Mon Nov 19 12:59:48 2012 +0000
@@ -246,7 +246,6 @@ XEND_ERROR_UNSUPPORTED           = ('EUN
 XEND_ERROR_VM_INVALID            = ('EVMINVALID', 'VM Invalid')
 XEND_ERROR_VBD_INVALID           = ('EVBDINVALID', 'VBD Invalid')
 XEND_ERROR_VIF_INVALID           = ('EVIFINVALID', 'VIF Invalid')
-XEND_ERROR_VTPM_INVALID          = ('EVTPMINVALID', 'VTPM Invalid')
 XEND_ERROR_VDI_INVALID           = ('EVDIINVALID', 'VDI Invalid')
 XEND_ERROR_SR_INVALID           = ('ESRINVALID', 'SR Invalid')
 XEND_ERROR_XSPOLICY_INVALID      = ('EXSPOLICYINVALID', 'XS Invalid')
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xend/XendOptions.py
--- a/tools/python/xen/xend/XendOptions.py	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xend/XendOptions.py	Mon Nov 19 12:59:48 2012 +0000
@@ -349,10 +349,6 @@ class XendOptions:
         else:
             return None
 
-    def get_external_migration_tool(self):
-        """@return the name of the tool to handle virtual TPM migration."""
-        return self.get_config_string('external-migration-tool', self.external_migration_tool_default)
-
     def get_enable_dump(self):
         return self.get_config_bool('enable-dump', 'no')
 
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xend/server/tpmif.py
--- a/tools/python/xen/xend/server/tpmif.py	Mon Nov 19 12:59:48 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-#============================================================================
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of version 2.1 of the GNU Lesser General Public
-# License as published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-#============================================================================
-# Copyright (C) 2004 Mike Wray <mike.wray@hp.com>
-# Copyright (C) 2005 IBM Corporation
-#   Author: Stefan Berger, stefanb@us.ibm.com
-# Copyright (C) 2005 XenSource Ltd
-#============================================================================
-
-"""Support for virtual TPM interfaces."""
-
-from xen.xend import XendOptions
-from xen.xend.XendLogging import log
-from xen.xend.XendError import XendError
-from xen.xend.XendConstants import DEV_MIGRATE_TEST, VTPM_DELETE_SCRIPT
-from xen.xend.server.DevController import DevController
-
-import os
-import re
-
-xoptions = XendOptions.instance()
-
-def destroy_vtpmstate(uuids):
-    if os.path.exists(VTPM_DELETE_SCRIPT):
-        for uuid in uuids:
-            os.system(VTPM_DELETE_SCRIPT + " " + uuid)
-
-class TPMifController(DevController):
-    """TPM interface controller. Handles all TPM devices for a domain.
-    """
-
-    def __init__(self, vm):
-        DevController.__init__(self, vm)
-
-
-    def getDeviceDetails(self, config):
-        """@see DevController.getDeviceDetails"""
-
-        devid = self.allocateDeviceID()
-        inst = int(config.get('pref_instance', -1))
-        if inst == -1:
-            inst = int(config.get('instance', 0))
-
-        typ    = config.get('type')
-        uuid   = config.get('uuid')
-
-        log.info("The domain has a TPM with pref. instance %d and devid %d.",
-                 inst, devid)
-        back  = { 'pref_instance' : "%i" % inst,
-                  'resume'        : "%s" % (self.vm.getResume()) }
-        if typ:
-            back['type'] = typ
-        if uuid:
-            back['uuid'] = uuid
-
-            data = self.vm.info['devices'].get(uuid)
-            if data:
-                other = data[1].get('other_config')
-                if type(other) == dict:
-                    for key, item in other.items():
-                        back['oc_' + key] = item
-
-        front = { 'handle' : "%i" % devid }
-
-        return (devid, back, front)
-
-    def getDeviceConfiguration(self, devid, transaction = None):
-        """Returns the configuration of a device"""
-        result = DevController.getDeviceConfiguration(self, devid, transaction)
-
-        (instance, uuid, type) = \
-                           self.readBackend(devid, 'instance',
-                                                   'uuid',
-                                                   'type')
-
-        if instance:
-            result['instance'] = instance
-        if uuid:
-            result['uuid'] = uuid
-        if type:
-            result['type'] = type
-
-        if uuid:
-            data = self.vm.info['devices'].get(uuid)
-            if data:
-                other = data[1].get('other_config')
-                if other:
-                    result['other_config'] = other
-
-        return result
-
-    def migrate(self, deviceConfig, network, dst, step, domName):
-        """@see DevContoller.migrate"""
-        if network:
-            tool = xoptions.get_external_migration_tool()
-            if tool != '':
-                log.info("Request to network-migrate device to %s. step=%d.",
-                         dst, step)
-
-                if step == DEV_MIGRATE_TEST:
-                    """Assuming for now that everything is ok and migration
-                       with the given tool can proceed.
-                    """
-                    return 0
-                else:
-                    fd = os.popen("%s -type vtpm -step %d -host %s -domname %s" %
-                                  (tool, step, dst, domName),
-                                  'r')
-                    for line in fd.readlines():
-                        mo = re.search('Error', line)
-                        if mo:
-                            raise XendError("vtpm: Fatal error in migration step %d: %s" %
-                                            (step, line))
-                    return 0
-            else:
-                log.debug("External migration tool not in configuration.")
-                return -1
-        return 0
-
-    def recover_migrate(self, deviceConfig, network, dst, step, domName):
-        """@see DevContoller.recover_migrate"""
-        if network:
-            tool = xoptions.get_external_migration_tool()
-            if tool != '':
-                log.info("Request to recover network-migrated device. last good step=%d.",
-                         step)
-                fd = os.popen("%s -type vtpm -step %d -host %s -domname %s -recover" %
-                              (tool, step, dst, domName),
-                              'r')
-        return 0
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xend/tests/xend-config.sxp
--- a/tools/python/xen/xend/tests/xend-config.sxp	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xend/tests/xend-config.sxp	Mon Nov 19 12:59:48 2012 +0000
@@ -127,5 +127,3 @@
 # Whether to enable core-dumps when domains crash.
 #(enable-dump no)
 
-# The tool used for initiating virtual TPM migration
-#(external-migration-tool '')
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xm/create.dtd
--- a/tools/python/xen/xm/create.dtd	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xm/create.dtd	Mon Nov 19 12:59:48 2012 +0000
@@ -38,7 +38,6 @@
                  memory,
                  vbd*,
                  vif*,
-                 vtpm*,
                  pci*,
                  vscsi*,
                  console*,
@@ -82,9 +81,6 @@
                  network         CDATA       #IMPLIED
                  security_label  CDATA       #IMPLIED>
 
-<!ELEMENT vtpm   (name*)>
-<!ATTLIST vtpm   backend         CDATA #REQUIRED>
-
 <!ELEMENT pci    (pci_opt*)>
 <!ATTLIST pci    domain          CDATA #REQUIRED
                  bus             CDATA #REQUIRED
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xm/create.py	Mon Nov 19 12:59:48 2012 +0000
@@ -324,10 +324,6 @@ gopts.var('netif', val='no|yes',
           fn=set_bool, default=0,
           use="Make the domain a network interface backend.")
 
-gopts.var('tpmif', val='no|yes',
-          fn=append_value, default=0,
-          use="Make the domain a TPM interface backend.")
-
 gopts.var('disk', val='phy:DEV,VDEV,MODE[,DOM]',
           fn=append_value, default=[],
           use="""Add a disk device to a domain. The physical device is DEV,
@@ -419,20 +415,6 @@ gopts.var('vif2', val="front_mac=MAC,bac
           and backend MAC addresses.  Randomly generated
           addresses will be used if either address is missing.""")
 
-gopts.var('vtpm', val="instance=INSTANCE,backend=DOM,type=TYPE",
-          fn=append_value, default=[],
-          use="""Add a TPM interface. On the backend side use the given
-          instance as virtual TPM instance. The given number is merely the
-          preferred instance number. The hotplug script will determine
-          which instance number will actually be assigned to the domain.
-          The associtation between virtual machine and the TPM instance
-          number can be found in /etc/xen/vtpm.db. Use the backend in the
-          given domain.
-          The type parameter can be used to select a specific driver type
-          that the VM can use. To prevent a fully virtualized domain (HVM)
-          from being able to access an emulated device model, you may specify
-          'paravirtualized' here.""")
-
 gopts.var('access_control', val="policy=POLICY,label=LABEL",
           fn=append_value, default=[],
           use="""Add a security label and the security policy reference that defines it.
@@ -997,37 +979,6 @@ def configure_mem_prot(config_image, val
     """
     config_image.append(['s3_integrity', vals.s3_integrity])
 
-def configure_vtpm(config_devs, vals):
-    """Create the config for virtual TPM interfaces.
-    """
-    vtpm = vals.vtpm
-    if len(vtpm) > 0:
-        d = vtpm[0]
-        instance = d.get('instance')
-        uuid = d.get('uuid')
-        if instance == "VTPMD":
-            instance = "0"
-        else:
-            if instance != None:
-                try:
-                    if int(instance) == 0:
-                        err('VM config error: vTPM instance must not be 0.')
-                except ValueError:
-                    err('Vm config error: could not parse instance number.')
-        backend = d.get('backend')
-        typ = d.get('type')
-        config_vtpm = ['vtpm']
-        if instance:
-            config_vtpm.append(['pref_instance', instance])
-        if backend:
-            config_vtpm.append(['backend', backend])
-        if typ:
-            config_vtpm.append(['type', typ])
-        if uuid:
-            config_vtpm.append(['uuid', uuid])
-        config_devs.append(['device', config_vtpm])
-
-
 def configure_vifs(config_devs, vals):
     """Create the config for virtual network interfaces.
     """
@@ -1160,8 +1111,6 @@ def make_config(vals):
         config.append(['backend', ['blkif']])
     if vals.netif:
         config.append(['backend', ['netif']])
-    if vals.tpmif:
-        config.append(['backend', ['tpmif']])
     if vals.localtime:
         config.append(['localtime', vals.localtime])
     if vals.oos:
@@ -1193,7 +1142,6 @@ def make_config(vals):
     configure_ioports(config_devs, vals)
     configure_irq(config_devs, vals)
     configure_vifs(config_devs, vals)
-    configure_vtpm(config_devs, vals)
     configure_vfbs(config_devs, vals)
     configure_security(config, vals)
     config += config_devs
@@ -1307,22 +1255,6 @@ def preprocess_irq(vals):
         irq.append(d)
     vals.irq = irq
 
-def preprocess_vtpm(vals):
-    if not vals.vtpm: return
-    vtpms = []
-    for vtpm in vals.vtpm:
-        d = {}
-        a = vtpm.split(',')
-        for b in a:
-            (k, v) = b.strip().split('=', 1)
-            k = k.strip()
-            v = v.strip()
-            if k not in ['backend', 'instance', 'uuid']:
-                err('Invalid vtpm specifier: ' + vtpm)
-            d[k] = v
-        vtpms.append(d)
-    vals.vtpm = vtpms
-
 def preprocess_access_control(vals):
     if not vals.access_control:
         return
@@ -1401,7 +1333,6 @@ def preprocess(vals):
     preprocess_ip(vals)
     preprocess_irq(vals)
     preprocess_nfs(vals)
-    preprocess_vtpm(vals)
     preprocess_access_control(vals)
     preprocess_cpuid(vals, 'cpuid')
     preprocess_cpuid(vals, 'cpuid_check')
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xm/main.py	Mon Nov 19 12:59:48 2012 +0000
@@ -204,7 +204,6 @@ SUBCOMMAND_HELP = {
     'vnet-create'   :  ('<ConfigFile>','Create a vnet from ConfigFile.'),
     'vnet-delete'   :  ('<VnetId>', 'Delete a Vnet.'),
     'vnet-list'     :  ('[-l|--long]', 'List Vnets.'),
-    'vtpm-list'     :  ('<Domain> [--long]', 'List virtual TPM devices.'),
     'pci-attach'    :  ('[-o|--options=<opt>] <Domain> <domain:bus:slot.func> [virtual slot]',
                         'Insert a new pass-through pci device.'),
     'pci-detach'    :  ('<Domain> <domain:bus:slot.func>',
@@ -469,7 +468,6 @@ device_commands = [
     "network2-attach",
     "network2-detach",
     "network2-list",
-    "vtpm-list",
     "pci-attach",
     "pci-detach",
     "pci-list",
@@ -2392,39 +2390,6 @@ def xm_block_list(args):
                    "%(be-path)-30s  "
                    % ni)
 
-def xm_vtpm_list(args):
-    (use_long, params) = arg_check_for_resource_list(args, "vtpm-list")
-
-    dom = params[0]
-
-    if serverType == SERVER_XEN_API:
-        vtpm_refs = server.xenapi.VM.get_VTPMs(get_single_vm(dom))
-        vtpm_properties = \
-            map(server.xenapi.VTPM.get_runtime_properties, vtpm_refs)
-        devs = map(lambda (handle, properties): [handle, map2sxp(properties)],
-                   zip(range(len(vtpm_properties)), vtpm_properties))
-    else:
-        devs = server.xend.domain.getDeviceSxprs(dom, 'vtpm')
-
-    if use_long:
-        map(PrettyPrint.prettyprint, devs)
-    else:
-        hdr = 0
-        for x in devs:
-            if hdr == 0:
-                print 'Idx  BE handle state evt-ch ring-ref BE-path'
-                hdr = 1
-            ni = parse_dev_info(x[1])
-            ni['idx'] = int(x[0])
-            print ("%(idx)-3d   "
-                   "%(backend-id)-3d  "
-                   "%(handle)-3d   "
-                   "%(state)-3d    "
-                   "%(event-ch)-3d    "
-                   "%(ring-ref)-5d "
-                   "%(be-path)-30s  "
-                   % ni)
-
 def attached_pci_dict_bin(dom):
     devs = []
     if serverType == SERVER_XEN_API:
@@ -3854,8 +3819,6 @@ commands = {
     "vnet-list": xm_vnet_list,
     "vnet-create": xm_vnet_create,
     "vnet-delete": xm_vnet_delete,
-    # vtpm
-    "vtpm-list": xm_vtpm_list,
     #pci
     "pci-attach": xm_pci_attach,
     "pci-detach": xm_pci_detach,
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xm/xenapi_create.py
--- a/tools/python/xen/xm/xenapi_create.py	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xm/xenapi_create.py	Mon Nov 19 12:59:48 2012 +0000
@@ -375,12 +375,6 @@ class xenapi_create:
 
             self.create_vifs(vm_ref, vifs, networks)
 
-            # Now create vtpms
-
-            vtpms = vm.getElementsByTagName("vtpm")
-
-            self.create_vtpms(vm_ref, vtpms)
-
             # Now create consoles
 
             consoles = vm.getElementsByTagName("console")
@@ -488,21 +482,6 @@ class xenapi_create:
             self._network_refs = server.xenapi.network.get_all()
             return self._network_refs.pop(0)
 
-    def create_vtpms(self, vm_ref, vtpms):
-        if len(vtpms) > 1:
-            vtpms = [ vtpms[0] ]
-        log(DEBUG, "create_vtpms")
-        return map(lambda vtpm: self.create_vtpm(vm_ref, vtpm), vtpms)
-
-    def create_vtpm(self, vm_ref, vtpm):
-        vtpm_record = {
-            "VM":
-                vm_ref,
-            "backend":
-                vtpm.attributes["backend"].value
-        }
-        return server.xenapi.VTPM.create(vtpm_record)
-
     def create_consoles(self, vm_ref, consoles):
         log(DEBUG, "create_consoles")
         return map(lambda console: self.create_console(vm_ref, console),
@@ -633,9 +612,6 @@ class sxp2xml:
         vifs_sxp = map(lambda x: x[1], [device for device in devices
                                         if device[1][0] == "vif"])
 
-        vtpms_sxp = map(lambda x: x[1], [device for device in devices
-                                         if device[1][0] == "vtpm"])
-
         vfbs_sxp = map(lambda x: x[1], [device for device in devices
                                         if device[1][0] == "vfb"])
 
@@ -780,12 +756,6 @@ class sxp2xml:
 
         map(vm.appendChild, vifs)
 
-        # And now the vTPMs
-
-        vtpms = map(lambda vtpm: self.extract_vtpm(vtpm, document), vtpms_sxp)
-
-        map(vm.appendChild, vtpms)
-
         # And now the pcis
 
         pcis = self.extract_pcis(pcis_sxp, document)
@@ -923,15 +893,6 @@ class sxp2xml:
         
         return vif
 
-    def extract_vtpm(self, vtpm_sxp, document):
-
-        vtpm = document.createElement("vtpm")
-
-        vtpm.attributes["backend"] \
-             = get_child_by_name(vtpm_sxp, "backend", "0")
-
-        return vtpm
-
     def extract_vfb(self, vfb_sxp, document):
 
         vfb = document.createElement("console")

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0id-0002bF-9B; Wed, 21 Nov 2012 03:11: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 1Tb0ib-0002Yf-3G
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:17 +0000
Received: from [193.109.254.147:42113] by server-9.bemta-14.messagelabs.com id
	49/AC-30773-4564CA05; Wed, 21 Nov 2012 03:11:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1353467472!10152346!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=1.4 required=7.0 tests=INFO_TLD
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 703 invoked from network); 21 Nov 2012 03:11:13 -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;
	21 Nov 2012 03: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 1Tb0iV-0007dD-VC
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iV-0005YX-Hm
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:11 +0000
Message-Id: <E1Tb0iV-0005YX-Hm@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xend: Remove old vtpm support from xm
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Matthew Fioravante <matthew.fioravante@jhuapl.edu>
# Date 1353329988 0
# Node ID 31dcc0e087541504589124b5ede456afc603d8b5
# Parent  d026f8abca518d41151d5ba5bd88c5b6871b584d
xend: Remove old vtpm support from xm

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r d026f8abca51 -r 31dcc0e08754 docs/man/xm.pod.1
--- a/docs/man/xm.pod.1	Mon Nov 19 12:59:48 2012 +0000
+++ b/docs/man/xm.pod.1	Mon Nov 19 12:59:48 2012 +0000
@@ -977,17 +977,6 @@ formatted as a list or as an S-Expressio
 
 =back
 
-=head2 VIRTUAL TPM DEVICES
-
-=over 4
-
-=item B<vtpm-list> [B<-l>|B<--long>] I<domain-id>
-
-Show the virtual TPM device for a domain.  The returned output is
-formatted as a list or as an S-Expression if the B<--long> option was given.
-
-=back
-
 =head1 SEE ALSO
 
 B<xmdomain.cfg>(5), B<xentop>(1)
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/README.XendConfig
--- a/tools/python/README.XendConfig	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/README.XendConfig	Mon Nov 19 12:59:48 2012 +0000
@@ -71,8 +71,6 @@ vbds                            !(device
  - io_read_kbs
  - io_write_kbs
 
-tpm_instance                    tpm.instance
-tpm_backend                     tpm.backend
 bios_boot                       image.boot?
 platform_std_VGA                image.stdvga
 platform_serial                 image.serial
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/README.sxpcfg
--- a/tools/python/README.sxpcfg	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/README.sxpcfg	Mon Nov 19 12:59:48 2012 +0000
@@ -105,10 +105,6 @@ io
   - from
   - to
 
-tpm
-  - pref_instance
-  - instance
-
 pciquirk
   - pci_ids
   - pci_config_space_fields
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/scripts/xapi.py
--- a/tools/python/scripts/xapi.py	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/scripts/xapi.py	Mon Nov 19 12:59:48 2012 +0000
@@ -58,7 +58,6 @@ COMMANDS = {
     'vdi-rename': ('<vdi_uuid> <new_name>', 'Rename VDI'),
     'vdi-destroy': ('<vdi_uuid>', 'Delete VDI'),
     'vif-create': ('<domname> <pycfg>', 'Create VIF attached to domname'),
-    'vtpm-create' : ('<domname> <pycfg>', 'Create VTPM attached to domname'),
 
     'vm-create': ('<pycfg>', 'Create VM with python config'),
     'vm-destroy': ('<domname>', 'Delete VM'),
@@ -284,22 +283,16 @@ def xapi_vm_list(args, async = False):
         if is_long:
             vbds = vm_info['VBDs']
             vifs = vm_info['VIFs']
-            vtpms = vm_info['VTPMs']
             vif_infos = []
             vbd_infos = []
-            vtpm_infos = []
             for vbd in vbds:
                 vbd_info = execute(server, 'VBD.get_record', (session, vbd))
                 vbd_infos.append(vbd_info)
             for vif in vifs:
                 vif_info = execute(server, 'VIF.get_record', (session, vif))
                 vif_infos.append(vif_info)
-            for vtpm in vtpms:
-                vtpm_info = execute(server, 'VTPM.get_record', (session, vtpm))
-                vtpm_infos.append(vtpm_info)
             vm_info['VBDs'] = vbd_infos
             vm_info['VIFs'] = vif_infos
-            vm_info['VTPMs'] = vtpm_infos
             pprint(vm_info)
         else:
             print VM_LIST_FORMAT % _stringify(vm_info)
@@ -661,19 +654,6 @@ def xapi_vdi_rename(args, async = False)
         print 'Done.'
 
 
-
-def xapi_vtpm_create(args, async = False):
-    server, session = connect()
-    domname = args[0]
-    cfg = _read_python_cfg(args[1])
-
-    vm_uuid = resolve_vm(server, session, domname)
-    cfg['VM'] = vm_uuid
-    print "Creating vTPM with cfg = %s" % cfg
-    vtpm_uuid = execute(server, 'VTPM.create', (session, cfg))
-    print "Done. (%s)" % vtpm_uuid
-
-
 def xapi_pif_list(args, async = False):
     server, session = connect()
     pif_uuids = execute(server, 'PIF.get_all', (session,))
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xend/XendAPI.py	Mon Nov 19 12:59:48 2012 +0000
@@ -377,17 +377,6 @@ def valid_vdi(func):
            _check_ref(XendNode.instance().is_valid_vdi,
                       'VDI', func, *args, **kwargs)
 
-def valid_vtpm(func):
-    """Decorator to verify if vtpm_ref is valid before calling method.
-
-    @param func: function with params: (self, session, vtpm_ref, ...)
-    @rtype: callable object
-    """
-    return lambda *args, **kwargs: \
-           _check_ref(lambda r: XendDomain.instance().is_valid_dev('vtpm', r),
-                      'VTPM', func, *args, **kwargs)
-
-
 def valid_console(func):
     """Decorator to verify if console_ref is valid before calling method.
 
@@ -481,7 +470,6 @@ classes = {
     'VIF'          : valid_vif,
     'VIF_metrics'  : valid_vif_metrics,
     'VDI'          : valid_vdi,
-    'VTPM'         : valid_vtpm,
     'console'      : valid_console,
     'SR'           : valid_sr,
     'task'         : valid_task,
@@ -1293,7 +1281,6 @@ class XendAPI(object):
                   'consoles',
                   'VIFs',
                   'VBDs',
-                  'VTPMs',
                   'DPCIs',
                   'DSCSIs',
                   'DSCSI_HBAs',
@@ -1436,10 +1423,6 @@ class XendAPI(object):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
         return xen_api_success(dom.get_vbds())
     
-    def VM_get_VTPMs(self, session, vm_ref):
-        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
-        return xen_api_success(dom.get_vtpms())
-
     def VM_get_consoles(self, session, vm_ref):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
         return xen_api_success(dom.get_consoles())
@@ -1851,7 +1834,6 @@ class XendAPI(object):
             'consoles': xeninfo.get_consoles(),
             'VIFs': xeninfo.get_vifs(),
             'VBDs': xeninfo.get_vbds(),
-            'VTPMs': xeninfo.get_vtpms(),
             'DPCIs': xeninfo.get_dpcis(),
             'DSCSIs': xeninfo.get_dscsis(),
             'DSCSI_HBAs': xeninfo.get_dscsi_HBAs(),
@@ -2537,116 +2519,6 @@ class XendAPI(object):
         vdi = XendNode.instance().get_vdi_by_uuid(vdi_ref)
         return xen_api_success(vdi.get_security_label())
 
-    # Xen API: Class VTPM
-    # ----------------------------------------------------------------
-
-    VTPM_attr_rw = ['other_config']
-    VTPM_attr_ro = ['VM',
-                    'backend',
-                    'runtime_properties' ]
-
-    VTPM_attr_inst = VTPM_attr_rw
-
-    VTPM_methods = [('destroy', None)]
-    VTPM_funcs = [('create', 'VTPM')]
-
-    def VTPM_get_other_config(self, session, vtpm_ref):
-        xendom = XendDomain.instance()
-        return xen_api_success(xendom.get_dev_property_by_uuid('vtpm',
-                                                               vtpm_ref,
-                                                               'other_config'))
-
-    def VTPM_set_other_config(self, session, vtpm_ref, other_config):
-        xendom = XendDomain.instance()
-        xendom.set_dev_property_by_uuid('vtpm',
-                                        vtpm_ref,
-                                        'other_config',
-                                        other_config)
-        return xen_api_success_void()
-    
-    # object methods
-    def VTPM_get_record(self, session, vtpm_ref):
-        xendom = XendDomain.instance()
-        vm = xendom.get_vm_with_dev_uuid('vtpm', vtpm_ref)
-        if not vm:
-            return xen_api_error(['HANDLE_INVALID', 'VTPM', vtpm_ref])
-        cfg = vm.get_dev_xenapi_config('vtpm', vtpm_ref)
-        if not cfg:
-            return xen_api_error(['HANDLE_INVALID', 'VTPM', vtpm_ref])
-        valid_vtpm_keys = self.VTPM_attr_ro + self.VTPM_attr_rw + \
-                          self.Base_attr_ro + self.Base_attr_rw
-        return_cfg = {}
-        for k in cfg.keys():
-            if k in valid_vtpm_keys:
-                return_cfg[k] = cfg[k]
-
-        return xen_api_success(return_cfg)
-
-    # Class Functions
-    def VTPM_get_backend(self, session, vtpm_ref):
-        xendom = XendDomain.instance()
-        vm = xendom.get_vm_with_dev_uuid('vtpm', vtpm_ref)
-        if not vm:
-            return xen_api_error(['HANDLE_INVALID', 'VTPM', vtpm_ref])
-        cfg = vm.get_dev_xenapi_config('vtpm', vtpm_ref)
-        if not cfg:
-            return xen_api_error(['HANDLE_INVALID', 'VTPM', vtpm_ref])
-        if not cfg.has_key('backend'):
-            return xen_api_error(['INTERNAL_ERROR', 'VTPM backend not set'])
-        return xen_api_success(cfg['backend'])
-
-    def VTPM_get_VM(self, session, vtpm_ref):
-        xendom = XendDomain.instance()
-        return xen_api_success(xendom.get_dev_property_by_uuid('vtpm',
-                                                              vtpm_ref, 'VM'))
-
-    def VTPM_destroy(self, session, vtpm_ref):
-        xendom = XendDomain.instance()
-        dom = xendom.get_vm_with_dev_uuid('vtpm', vtpm_ref)
-        if dom:
-            if dom.state != XEN_API_VM_POWER_STATE_HALTED:
-                vm_ref = dom.get_dev_property('vtpm', vtpm_ref, 'VM')
-                return xen_api_error(['VM_BAD_POWER_STATE', vm_ref,
-                 XendDomain.POWER_STATE_NAMES[XEN_API_VM_POWER_STATE_HALTED],
-                 XendDomain.POWER_STATE_NAMES[dom.state]])
-            from xen.xend.server import tpmif
-            tpmif.destroy_vtpmstate(dom.getName())
-            return xen_api_success_void()
-        else:
-            return xen_api_error(['HANDLE_INVALID', 'VTPM', vtpm_ref])
-
-    # class methods
-    def VTPM_create(self, session, vtpm_struct):
-        xendom = XendDomain.instance()
-        if xendom.is_valid_vm(vtpm_struct['VM']):
-            dom = xendom.get_vm_by_uuid(vtpm_struct['VM'])
-            try:
-                vtpm_ref = dom.create_vtpm(vtpm_struct)
-                xendom.managed_config_save(dom)
-                return xen_api_success(vtpm_ref)
-            except XendError, exn:
-                return xen_api_error(['INTERNAL_ERROR', str(exn)])
-        else:
-            return xen_api_error(['HANDLE_INVALID', 'VM', vtpm_struct['VM']])
-
-    def VTPM_get_all(self, session):
-        xendom = XendDomain.instance()
-        vtpms = [d.get_vtpms() for d in XendDomain.instance().list('all')]
-        vtpms = reduce(lambda x, y: x + y, vtpms)
-        return xen_api_success(vtpms)
-
-    def VTPM_get_runtime_properties(self, _, vtpm_ref):
-        xendom = XendDomain.instance()
-        dominfo = xendom.get_vm_with_dev_uuid('vtpm', vtpm_ref)
-        device = dominfo.get_dev_config_by_uuid('vtpm', vtpm_ref)
-
-        try:
-            device_sxps = dominfo.getDeviceSxprs('vtpm')
-            device_dict = dict(device_sxps[0][1])
-            return xen_api_success(device_dict)
-        except:
-            return xen_api_success({})
-
     # Xen API: Class console
     # ----------------------------------------------------------------
 
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xend/XendConfig.py	Mon Nov 19 12:59:48 2012 +0000
@@ -417,7 +417,6 @@ class XendConfig(dict):
             'console_refs': [],
             'vif_refs': [],
             'vbd_refs': [],
-            'vtpm_refs': [],
             'other_config': {},
             'platform': {},
             'target': 0,
@@ -937,7 +936,6 @@ class XendConfig(dict):
         self['console_refs'] = cfg.get('console_refs', [])
         self['vif_refs'] = cfg.get('vif_refs', [])
         self['vbd_refs'] = cfg.get('vbd_refs', [])
-        self['vtpm_refs'] = cfg.get('vtpm_refs', [])
 
         # coalesce hvm vnc frame buffer with vfb config
         if self.is_hvm() and int(self['platform'].get('vnc', 0)) != 0:
@@ -1488,7 +1486,7 @@ class XendConfig(dict):
 
             # store dev references by uuid for certain device types
             target['devices'][dev_uuid] = (dev_type, dev_info)
-            if dev_type in ('vif', 'vbd', 'vtpm'):
+            if dev_type in ('vif', 'vbd'):
                 param = '%s_refs' % dev_type
                 if param not in target:
                     target[param] = []
@@ -1630,18 +1628,6 @@ class XendConfig(dict):
                 target['devices'][dev_uuid] = (dev_type, dev_info)
                 target['vbd_refs'].append(dev_uuid)                
 
-            elif dev_type == 'vtpm':
-                if cfg_xenapi.get('type'):
-                    dev_info['type'] = cfg_xenapi.get('type')
-
-                dev_uuid = cfg_xenapi.get('uuid', None)
-                if not dev_uuid:
-                    dev_uuid = uuid.createString()
-                dev_info['uuid'] = dev_uuid
-                dev_info['other_config'] = cfg_xenapi.get('other_config', {})
-                target['devices'][dev_uuid] = (dev_type, dev_info)
-                target['vtpm_refs'].append(dev_uuid)
-
             elif dev_type == 'console':
                 dev_uuid = cfg_xenapi.get('uuid', None)
                 if not dev_uuid:
@@ -2078,8 +2064,7 @@ class XendConfig(dict):
 
         result.extend(target.get('console_refs', []) +
                       target.get('vbd_refs', []) +
-                      target.get('vif_refs', []) +
-                      target.get('vtpm_refs', []))
+                      target.get('vif_refs', []))
 
         result.extend([u for u in target['devices'].keys() if u not in result])
         return result
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xend/XendConstants.py
--- a/tools/python/xen/xend/XendConstants.py	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xend/XendConstants.py	Mon Nov 19 12:59:48 2012 +0000
@@ -115,7 +115,7 @@ TRIGGER_TYPE = {
 }
 
 #
-# Device migration stages (eg. XendDomainInfo, XendCheckpoint, server.tpmif)
+# Device migration stages (eg. XendDomainInfo, XendCheckpoint)
 #
 
 DEV_MIGRATE_TEST  = 0
@@ -124,12 +124,6 @@ DEV_MIGRATE_STEP2 = 2
 DEV_MIGRATE_STEP3 = 3
 
 #
-# VTPM-related constants
-#
-
-VTPM_DELETE_SCRIPT = auxbin.scripts_dir() + '/vtpm-delete'
-
-#
 # Xenstore Constants
 #
 
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xend/XendDevices.py
--- a/tools/python/xen/xend/XendDevices.py	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xend/XendDevices.py	Mon Nov 19 12:59:48 2012 +0000
@@ -19,7 +19,7 @@
 # A collection of DevControllers 
 #
 
-from xen.xend.server import blkif, netif, tpmif, pciif, iopif, irqif, vfbif, vscsiif, netif2, vusbif
+from xen.xend.server import blkif, netif, pciif, iopif, irqif, vfbif, vscsiif, netif2, vusbif
 from xen.xend.server.BlktapController import BlktapController, Blktap2Controller
 from xen.xend.server.ConsoleController import ConsoleController
 
@@ -38,7 +38,6 @@ class XendDevices:
         'vbd': blkif.BlkifController,
         'vif': netif.NetifController,
         'vif2': netif2.NetifController2,
-        'vtpm': tpmif.TPMifController,
         'pci': pciif.PciController,
         'ioports': iopif.IOPortsController,
         'irq': irqif.IRQController,
@@ -82,6 +81,5 @@ class XendDevices:
         @type domain: XendDomainInfo
         """
         from xen.xend.XendLogging import log
-        tpmif.destroy_vtpmstate(domain.info.get('vtpm_refs'))
 
     destroy_device_state = classmethod(destroy_device_state)
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py	Mon Nov 19 12:59:48 2012 +0000
@@ -3908,12 +3908,6 @@ class XendDomainInfo:
             else:
                 config['mode'] = 'RW'
 
-        if dev_class == 'vtpm':
-            if not config.has_key('type'):
-                config['type'] = 'paravirtualised' # TODO
-            if not config.has_key('backend'):
-                config['backend'] = "00000000-0000-0000-0000-000000000000"
-
         return config
 
     def get_dev_property(self, dev_class, dev_uuid, field):
@@ -3945,9 +3939,6 @@ class XendDomainInfo:
     def get_vbds(self):
         return self.info.get('vbd_refs', [])
 
-    def get_vtpms(self):
-        return self.info.get('vtpm_refs', [])
-
     def get_dpcis(self):
         return XendDPCI.get_by_VM(self.info.get('uuid'))
 
@@ -4046,23 +4037,6 @@ class XendDomainInfo:
  
         return dev_uuid
 
-    def create_vtpm(self, xenapi_vtpm):
-        """Create a VTPM device from the passed struct in Xen API format.
-
-        @return: uuid of the device
-        @rtype: string
-        """
-
-        if self._stateGet() not in (DOM_STATE_HALTED,):
-            raise VmError("Can only add vTPM to a halted domain.")
-        if self.get_vtpms() != []:
-            raise VmError('Domain already has a vTPM.')
-        dev_uuid = self.info.device_add('vtpm', cfg_xenapi = xenapi_vtpm)
-        if not dev_uuid:
-            raise XendError('Failed to create device')
-
-        return dev_uuid
-
     def create_console(self, xenapi_console):
         """ Create a console device from a Xen API struct.
 
@@ -4301,9 +4275,6 @@ class XendDomainInfo:
     def destroy_vif(self, dev_uuid):
         self.destroy_device_by_uuid('vif', dev_uuid)
 
-    def destroy_vtpm(self, dev_uuid):
-        self.destroy_device_by_uuid('vtpm', dev_uuid)
-
     def destroy_dpci(self, dev_uuid):
 
         dpci = XendAPIStore.get(dev_uuid, 'DPCI')
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xend/XendError.py
--- a/tools/python/xen/xend/XendError.py	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xend/XendError.py	Mon Nov 19 12:59:48 2012 +0000
@@ -246,7 +246,6 @@ XEND_ERROR_UNSUPPORTED           = ('EUN
 XEND_ERROR_VM_INVALID            = ('EVMINVALID', 'VM Invalid')
 XEND_ERROR_VBD_INVALID           = ('EVBDINVALID', 'VBD Invalid')
 XEND_ERROR_VIF_INVALID           = ('EVIFINVALID', 'VIF Invalid')
-XEND_ERROR_VTPM_INVALID          = ('EVTPMINVALID', 'VTPM Invalid')
 XEND_ERROR_VDI_INVALID           = ('EVDIINVALID', 'VDI Invalid')
 XEND_ERROR_SR_INVALID           = ('ESRINVALID', 'SR Invalid')
 XEND_ERROR_XSPOLICY_INVALID      = ('EXSPOLICYINVALID', 'XS Invalid')
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xend/XendOptions.py
--- a/tools/python/xen/xend/XendOptions.py	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xend/XendOptions.py	Mon Nov 19 12:59:48 2012 +0000
@@ -349,10 +349,6 @@ class XendOptions:
         else:
             return None
 
-    def get_external_migration_tool(self):
-        """@return the name of the tool to handle virtual TPM migration."""
-        return self.get_config_string('external-migration-tool', self.external_migration_tool_default)
-
     def get_enable_dump(self):
         return self.get_config_bool('enable-dump', 'no')
 
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xend/server/tpmif.py
--- a/tools/python/xen/xend/server/tpmif.py	Mon Nov 19 12:59:48 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-#============================================================================
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of version 2.1 of the GNU Lesser General Public
-# License as published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-#============================================================================
-# Copyright (C) 2004 Mike Wray <mike.wray@hp.com>
-# Copyright (C) 2005 IBM Corporation
-#   Author: Stefan Berger, stefanb@us.ibm.com
-# Copyright (C) 2005 XenSource Ltd
-#============================================================================
-
-"""Support for virtual TPM interfaces."""
-
-from xen.xend import XendOptions
-from xen.xend.XendLogging import log
-from xen.xend.XendError import XendError
-from xen.xend.XendConstants import DEV_MIGRATE_TEST, VTPM_DELETE_SCRIPT
-from xen.xend.server.DevController import DevController
-
-import os
-import re
-
-xoptions = XendOptions.instance()
-
-def destroy_vtpmstate(uuids):
-    if os.path.exists(VTPM_DELETE_SCRIPT):
-        for uuid in uuids:
-            os.system(VTPM_DELETE_SCRIPT + " " + uuid)
-
-class TPMifController(DevController):
-    """TPM interface controller. Handles all TPM devices for a domain.
-    """
-
-    def __init__(self, vm):
-        DevController.__init__(self, vm)
-
-
-    def getDeviceDetails(self, config):
-        """@see DevController.getDeviceDetails"""
-
-        devid = self.allocateDeviceID()
-        inst = int(config.get('pref_instance', -1))
-        if inst == -1:
-            inst = int(config.get('instance', 0))
-
-        typ    = config.get('type')
-        uuid   = config.get('uuid')
-
-        log.info("The domain has a TPM with pref. instance %d and devid %d.",
-                 inst, devid)
-        back  = { 'pref_instance' : "%i" % inst,
-                  'resume'        : "%s" % (self.vm.getResume()) }
-        if typ:
-            back['type'] = typ
-        if uuid:
-            back['uuid'] = uuid
-
-            data = self.vm.info['devices'].get(uuid)
-            if data:
-                other = data[1].get('other_config')
-                if type(other) == dict:
-                    for key, item in other.items():
-                        back['oc_' + key] = item
-
-        front = { 'handle' : "%i" % devid }
-
-        return (devid, back, front)
-
-    def getDeviceConfiguration(self, devid, transaction = None):
-        """Returns the configuration of a device"""
-        result = DevController.getDeviceConfiguration(self, devid, transaction)
-
-        (instance, uuid, type) = \
-                           self.readBackend(devid, 'instance',
-                                                   'uuid',
-                                                   'type')
-
-        if instance:
-            result['instance'] = instance
-        if uuid:
-            result['uuid'] = uuid
-        if type:
-            result['type'] = type
-
-        if uuid:
-            data = self.vm.info['devices'].get(uuid)
-            if data:
-                other = data[1].get('other_config')
-                if other:
-                    result['other_config'] = other
-
-        return result
-
-    def migrate(self, deviceConfig, network, dst, step, domName):
-        """@see DevContoller.migrate"""
-        if network:
-            tool = xoptions.get_external_migration_tool()
-            if tool != '':
-                log.info("Request to network-migrate device to %s. step=%d.",
-                         dst, step)
-
-                if step == DEV_MIGRATE_TEST:
-                    """Assuming for now that everything is ok and migration
-                       with the given tool can proceed.
-                    """
-                    return 0
-                else:
-                    fd = os.popen("%s -type vtpm -step %d -host %s -domname %s" %
-                                  (tool, step, dst, domName),
-                                  'r')
-                    for line in fd.readlines():
-                        mo = re.search('Error', line)
-                        if mo:
-                            raise XendError("vtpm: Fatal error in migration step %d: %s" %
-                                            (step, line))
-                    return 0
-            else:
-                log.debug("External migration tool not in configuration.")
-                return -1
-        return 0
-
-    def recover_migrate(self, deviceConfig, network, dst, step, domName):
-        """@see DevContoller.recover_migrate"""
-        if network:
-            tool = xoptions.get_external_migration_tool()
-            if tool != '':
-                log.info("Request to recover network-migrated device. last good step=%d.",
-                         step)
-                fd = os.popen("%s -type vtpm -step %d -host %s -domname %s -recover" %
-                              (tool, step, dst, domName),
-                              'r')
-        return 0
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xend/tests/xend-config.sxp
--- a/tools/python/xen/xend/tests/xend-config.sxp	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xend/tests/xend-config.sxp	Mon Nov 19 12:59:48 2012 +0000
@@ -127,5 +127,3 @@
 # Whether to enable core-dumps when domains crash.
 #(enable-dump no)
 
-# The tool used for initiating virtual TPM migration
-#(external-migration-tool '')
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xm/create.dtd
--- a/tools/python/xen/xm/create.dtd	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xm/create.dtd	Mon Nov 19 12:59:48 2012 +0000
@@ -38,7 +38,6 @@
                  memory,
                  vbd*,
                  vif*,
-                 vtpm*,
                  pci*,
                  vscsi*,
                  console*,
@@ -82,9 +81,6 @@
                  network         CDATA       #IMPLIED
                  security_label  CDATA       #IMPLIED>
 
-<!ELEMENT vtpm   (name*)>
-<!ATTLIST vtpm   backend         CDATA #REQUIRED>
-
 <!ELEMENT pci    (pci_opt*)>
 <!ATTLIST pci    domain          CDATA #REQUIRED
                  bus             CDATA #REQUIRED
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xm/create.py	Mon Nov 19 12:59:48 2012 +0000
@@ -324,10 +324,6 @@ gopts.var('netif', val='no|yes',
           fn=set_bool, default=0,
           use="Make the domain a network interface backend.")
 
-gopts.var('tpmif', val='no|yes',
-          fn=append_value, default=0,
-          use="Make the domain a TPM interface backend.")
-
 gopts.var('disk', val='phy:DEV,VDEV,MODE[,DOM]',
           fn=append_value, default=[],
           use="""Add a disk device to a domain. The physical device is DEV,
@@ -419,20 +415,6 @@ gopts.var('vif2', val="front_mac=MAC,bac
           and backend MAC addresses.  Randomly generated
           addresses will be used if either address is missing.""")
 
-gopts.var('vtpm', val="instance=INSTANCE,backend=DOM,type=TYPE",
-          fn=append_value, default=[],
-          use="""Add a TPM interface. On the backend side use the given
-          instance as virtual TPM instance. The given number is merely the
-          preferred instance number. The hotplug script will determine
-          which instance number will actually be assigned to the domain.
-          The associtation between virtual machine and the TPM instance
-          number can be found in /etc/xen/vtpm.db. Use the backend in the
-          given domain.
-          The type parameter can be used to select a specific driver type
-          that the VM can use. To prevent a fully virtualized domain (HVM)
-          from being able to access an emulated device model, you may specify
-          'paravirtualized' here.""")
-
 gopts.var('access_control', val="policy=POLICY,label=LABEL",
           fn=append_value, default=[],
           use="""Add a security label and the security policy reference that defines it.
@@ -997,37 +979,6 @@ def configure_mem_prot(config_image, val
     """
     config_image.append(['s3_integrity', vals.s3_integrity])
 
-def configure_vtpm(config_devs, vals):
-    """Create the config for virtual TPM interfaces.
-    """
-    vtpm = vals.vtpm
-    if len(vtpm) > 0:
-        d = vtpm[0]
-        instance = d.get('instance')
-        uuid = d.get('uuid')
-        if instance == "VTPMD":
-            instance = "0"
-        else:
-            if instance != None:
-                try:
-                    if int(instance) == 0:
-                        err('VM config error: vTPM instance must not be 0.')
-                except ValueError:
-                    err('Vm config error: could not parse instance number.')
-        backend = d.get('backend')
-        typ = d.get('type')
-        config_vtpm = ['vtpm']
-        if instance:
-            config_vtpm.append(['pref_instance', instance])
-        if backend:
-            config_vtpm.append(['backend', backend])
-        if typ:
-            config_vtpm.append(['type', typ])
-        if uuid:
-            config_vtpm.append(['uuid', uuid])
-        config_devs.append(['device', config_vtpm])
-
-
 def configure_vifs(config_devs, vals):
     """Create the config for virtual network interfaces.
     """
@@ -1160,8 +1111,6 @@ def make_config(vals):
         config.append(['backend', ['blkif']])
     if vals.netif:
         config.append(['backend', ['netif']])
-    if vals.tpmif:
-        config.append(['backend', ['tpmif']])
     if vals.localtime:
         config.append(['localtime', vals.localtime])
     if vals.oos:
@@ -1193,7 +1142,6 @@ def make_config(vals):
     configure_ioports(config_devs, vals)
     configure_irq(config_devs, vals)
     configure_vifs(config_devs, vals)
-    configure_vtpm(config_devs, vals)
     configure_vfbs(config_devs, vals)
     configure_security(config, vals)
     config += config_devs
@@ -1307,22 +1255,6 @@ def preprocess_irq(vals):
         irq.append(d)
     vals.irq = irq
 
-def preprocess_vtpm(vals):
-    if not vals.vtpm: return
-    vtpms = []
-    for vtpm in vals.vtpm:
-        d = {}
-        a = vtpm.split(',')
-        for b in a:
-            (k, v) = b.strip().split('=', 1)
-            k = k.strip()
-            v = v.strip()
-            if k not in ['backend', 'instance', 'uuid']:
-                err('Invalid vtpm specifier: ' + vtpm)
-            d[k] = v
-        vtpms.append(d)
-    vals.vtpm = vtpms
-
 def preprocess_access_control(vals):
     if not vals.access_control:
         return
@@ -1401,7 +1333,6 @@ def preprocess(vals):
     preprocess_ip(vals)
     preprocess_irq(vals)
     preprocess_nfs(vals)
-    preprocess_vtpm(vals)
     preprocess_access_control(vals)
     preprocess_cpuid(vals, 'cpuid')
     preprocess_cpuid(vals, 'cpuid_check')
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xm/main.py	Mon Nov 19 12:59:48 2012 +0000
@@ -204,7 +204,6 @@ SUBCOMMAND_HELP = {
     'vnet-create'   :  ('<ConfigFile>','Create a vnet from ConfigFile.'),
     'vnet-delete'   :  ('<VnetId>', 'Delete a Vnet.'),
     'vnet-list'     :  ('[-l|--long]', 'List Vnets.'),
-    'vtpm-list'     :  ('<Domain> [--long]', 'List virtual TPM devices.'),
     'pci-attach'    :  ('[-o|--options=<opt>] <Domain> <domain:bus:slot.func> [virtual slot]',
                         'Insert a new pass-through pci device.'),
     'pci-detach'    :  ('<Domain> <domain:bus:slot.func>',
@@ -469,7 +468,6 @@ device_commands = [
     "network2-attach",
     "network2-detach",
     "network2-list",
-    "vtpm-list",
     "pci-attach",
     "pci-detach",
     "pci-list",
@@ -2392,39 +2390,6 @@ def xm_block_list(args):
                    "%(be-path)-30s  "
                    % ni)
 
-def xm_vtpm_list(args):
-    (use_long, params) = arg_check_for_resource_list(args, "vtpm-list")
-
-    dom = params[0]
-
-    if serverType == SERVER_XEN_API:
-        vtpm_refs = server.xenapi.VM.get_VTPMs(get_single_vm(dom))
-        vtpm_properties = \
-            map(server.xenapi.VTPM.get_runtime_properties, vtpm_refs)
-        devs = map(lambda (handle, properties): [handle, map2sxp(properties)],
-                   zip(range(len(vtpm_properties)), vtpm_properties))
-    else:
-        devs = server.xend.domain.getDeviceSxprs(dom, 'vtpm')
-
-    if use_long:
-        map(PrettyPrint.prettyprint, devs)
-    else:
-        hdr = 0
-        for x in devs:
-            if hdr == 0:
-                print 'Idx  BE handle state evt-ch ring-ref BE-path'
-                hdr = 1
-            ni = parse_dev_info(x[1])
-            ni['idx'] = int(x[0])
-            print ("%(idx)-3d   "
-                   "%(backend-id)-3d  "
-                   "%(handle)-3d   "
-                   "%(state)-3d    "
-                   "%(event-ch)-3d    "
-                   "%(ring-ref)-5d "
-                   "%(be-path)-30s  "
-                   % ni)
-
 def attached_pci_dict_bin(dom):
     devs = []
     if serverType == SERVER_XEN_API:
@@ -3854,8 +3819,6 @@ commands = {
     "vnet-list": xm_vnet_list,
     "vnet-create": xm_vnet_create,
     "vnet-delete": xm_vnet_delete,
-    # vtpm
-    "vtpm-list": xm_vtpm_list,
     #pci
     "pci-attach": xm_pci_attach,
     "pci-detach": xm_pci_detach,
diff -r d026f8abca51 -r 31dcc0e08754 tools/python/xen/xm/xenapi_create.py
--- a/tools/python/xen/xm/xenapi_create.py	Mon Nov 19 12:59:48 2012 +0000
+++ b/tools/python/xen/xm/xenapi_create.py	Mon Nov 19 12:59:48 2012 +0000
@@ -375,12 +375,6 @@ class xenapi_create:
 
             self.create_vifs(vm_ref, vifs, networks)
 
-            # Now create vtpms
-
-            vtpms = vm.getElementsByTagName("vtpm")
-
-            self.create_vtpms(vm_ref, vtpms)
-
             # Now create consoles
 
             consoles = vm.getElementsByTagName("console")
@@ -488,21 +482,6 @@ class xenapi_create:
             self._network_refs = server.xenapi.network.get_all()
             return self._network_refs.pop(0)
 
-    def create_vtpms(self, vm_ref, vtpms):
-        if len(vtpms) > 1:
-            vtpms = [ vtpms[0] ]
-        log(DEBUG, "create_vtpms")
-        return map(lambda vtpm: self.create_vtpm(vm_ref, vtpm), vtpms)
-
-    def create_vtpm(self, vm_ref, vtpm):
-        vtpm_record = {
-            "VM":
-                vm_ref,
-            "backend":
-                vtpm.attributes["backend"].value
-        }
-        return server.xenapi.VTPM.create(vtpm_record)
-
     def create_consoles(self, vm_ref, consoles):
         log(DEBUG, "create_consoles")
         return map(lambda console: self.create_console(vm_ref, console),
@@ -633,9 +612,6 @@ class sxp2xml:
         vifs_sxp = map(lambda x: x[1], [device for device in devices
                                         if device[1][0] == "vif"])
 
-        vtpms_sxp = map(lambda x: x[1], [device for device in devices
-                                         if device[1][0] == "vtpm"])
-
         vfbs_sxp = map(lambda x: x[1], [device for device in devices
                                         if device[1][0] == "vfb"])
 
@@ -780,12 +756,6 @@ class sxp2xml:
 
         map(vm.appendChild, vifs)
 
-        # And now the vTPMs
-
-        vtpms = map(lambda vtpm: self.extract_vtpm(vtpm, document), vtpms_sxp)
-
-        map(vm.appendChild, vtpms)
-
         # And now the pcis
 
         pcis = self.extract_pcis(pcis_sxp, document)
@@ -923,15 +893,6 @@ class sxp2xml:
         
         return vif
 
-    def extract_vtpm(self, vtpm_sxp, document):
-
-        vtpm = document.createElement("vtpm")
-
-        vtpm.attributes["backend"] \
-             = get_child_by_name(vtpm_sxp, "backend", "0")
-
-        return vtpm
-
     def extract_vfb(self, vfb_sxp, document):
 
         vfb = document.createElement("console")

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0id-0002cm-Vo; Wed, 21 Nov 2012 03:11: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 1Tb0ib-0002Yn-D4
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:17 +0000
Received: from [85.158.139.83:22033] by server-10.bemta-5.messagelabs.com id
	A2/72-09257-4564CA05; Wed, 21 Nov 2012 03:11:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-182.messagelabs.com!1353467474!31229326!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6456 invoked from network); 21 Nov 2012 03:11: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;
	21 Nov 2012 03: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 1Tb0iY-0007dS-9Q
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iY-0005Zk-7s
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:14 +0000
Message-Id: <E1Tb0iY-0005Zk-7s@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: document/mark-up SCHEDOP_*
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353335131 0
# Node ID cfd2772cc7175c09b2da52bba80583b6ca55bacf
# Parent  31668da0c4d31d32ec27e229422d57ccc5ee0b77
docs: document/mark-up SCHEDOP_*

The biggest subtlety here is there additional argument when op ==
SCHEDOP_shutdown and reason == SHUTDOWN_suspend and its interpretation by
xc_domain_{save,restore}. Add some clarifying comments to libxc as well.

This patch moves some structs around but there is no functional change
other than improved documentation.

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


diff -r 31668da0c4d3 -r cfd2772cc717 tools/libxc/xc_domain_restore.c
--- a/tools/libxc/xc_domain_restore.c	Mon Nov 19 15:15:12 2012 +0100
+++ b/tools/libxc/xc_domain_restore.c	Mon Nov 19 14:25:31 2012 +0000
@@ -1967,8 +1967,14 @@ int xc_domain_restore(xc_interface *xch,
         if ( i == 0 )
         {
             /*
-             * Uncanonicalise the suspend-record frame number and poke
-             * resume record.
+             * Uncanonicalise the start info frame number and poke in
+             * updated values into the start info itself.
+             *
+             * The start info MFN is the 3rd argument to the
+             * HYPERVISOR_sched_op hypercall when op==SCHEDOP_shutdown
+             * and reason==SHUTDOWN_suspend, it is canonicalised in
+             * xc_domain_save and therefore the PFN is found in the
+             * edx register.
              */
             pfn = GET_FIELD(ctxt, user_regs.edx);
             if ( (pfn >= dinfo->p2m_size) ||
diff -r 31668da0c4d3 -r cfd2772cc717 tools/libxc/xc_domain_save.c
--- a/tools/libxc/xc_domain_save.c	Mon Nov 19 15:15:12 2012 +0100
+++ b/tools/libxc/xc_domain_save.c	Mon Nov 19 14:25:31 2012 +0000
@@ -1868,7 +1868,14 @@ int xc_domain_save(xc_interface *xch, in
         goto out;
     }
 
-    /* Canonicalise the suspend-record frame number. */
+    /*
+     * Canonicalise the start info frame number.
+     *
+     * The start info MFN is the 3rd argument to the
+     * HYPERVISOR_sched_op hypercall when op==SCHEDOP_shutdown and
+     * reason==SHUTDOWN_suspend and is therefore found in the edx
+     * register.
+     */
     mfn = GET_FIELD(&ctxt, user_regs.edx);
     if ( !MFN_IS_IN_PSEUDOPHYS_MAP(mfn) )
     {
diff -r 31668da0c4d3 -r cfd2772cc717 xen/include/public/sched.h
--- a/xen/include/public/sched.h	Mon Nov 19 15:15:12 2012 +0100
+++ b/xen/include/public/sched.h	Mon Nov 19 14:25:31 2012 +0000
@@ -1,8 +1,8 @@
 /******************************************************************************
  * sched.h
- * 
+ *
  * Scheduler state interactions
- * 
+ *
  * 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
@@ -30,20 +30,33 @@
 #include "event_channel.h"
 
 /*
+ * `incontents 150 sched Guest Scheduler Operations
+ *
+ * The SCHEDOP interface provides mechanisms for a guest to interact
+ * with the scheduler, including yield, blocking and shutting itself
+ * down.
+ */
+
+/*
  * The prototype for this hypercall is:
- *  long sched_op(int cmd, void *arg)
+ * ` long HYPERVISOR_sched_op(enum sched_op cmd, void *arg, ...)
+ *
  * @cmd == SCHEDOP_??? (scheduler operation).
  * @arg == Operation-specific extra argument(s), as described below.
- * 
+ * ...  == Additional Operation-specific extra arguments, described below.
+ *
  * Versions of Xen prior to 3.0.2 provided only the following legacy version
  * of this hypercall, supporting only the commands yield, block and shutdown:
  *  long sched_op(int cmd, unsigned long arg)
  * @cmd == SCHEDOP_??? (scheduler operation).
  * @arg == 0               (SCHEDOP_yield and SCHEDOP_block)
  *      == SHUTDOWN_* code (SCHEDOP_shutdown)
- * This legacy version is available to new guests as sched_op_compat().
+ *
+ * This legacy version is available to new guests as:
+ * ` long HYPERVISOR_sched_op_compat(enum sched_op cmd, unsigned long arg)
  */
 
+/* ` enum sched_op { // SCHEDOP_* => struct sched_* */
 /*
  * Voluntarily yield the CPU.
  * @arg == NULL.
@@ -61,21 +74,57 @@
 
 /*
  * Halt execution of this domain (all VCPUs) and notify the system controller.
- * @arg == pointer to sched_shutdown structure.
+ * @arg == pointer to sched_shutdown_t structure.
+ *
+ * If the sched_shutdown_t reason is SHUTDOWN_suspend then this
+ * hypercall takes an additional extra argument which should be the
+ * MFN of the guest's start_info_t.
+ *
+ * In addition, which reason is SHUTDOWN_suspend this hypercall
+ * returns 1 if suspend was cancelled or the domain was merely
+ * checkpointed, and 0 if it is resuming in a new domain.
  */
 #define SCHEDOP_shutdown    2
+
+/*
+ * Poll a set of event-channel ports. Return when one or more are pending. An
+ * optional timeout may be specified.
+ * @arg == pointer to sched_poll_t structure.
+ */
+#define SCHEDOP_poll        3
+
+/*
+ * Declare a shutdown for another domain. The main use of this function is
+ * in interpreting shutdown requests and reasons for fully-virtualized
+ * domains.  A para-virtualized domain may use SCHEDOP_shutdown directly.
+ * @arg == pointer to sched_remote_shutdown_t structure.
+ */
+#define SCHEDOP_remote_shutdown        4
+
+/*
+ * Latch a shutdown code, so that when the domain later shuts down it
+ * reports this code to the control tools.
+ * @arg == sched_shutdown_t, as for SCHEDOP_shutdown.
+ */
+#define SCHEDOP_shutdown_code 5
+
+/*
+ * Setup, poke and destroy a domain watchdog timer.
+ * @arg == pointer to sched_watchdog_t structure.
+ * With id == 0, setup a domain watchdog timer to cause domain shutdown
+ *               after timeout, returns watchdog id.
+ * With id != 0 and timeout == 0, destroy domain watchdog timer.
+ * With id != 0 and timeout != 0, poke watchdog timer and set new timeout.
+ */
+#define SCHEDOP_watchdog    6
+/* ` } */
+
 struct sched_shutdown {
-    unsigned int reason; /* SHUTDOWN_* */
+    unsigned int reason; /* SHUTDOWN_* => enum sched_shutdown_reason */
 };
 typedef struct sched_shutdown sched_shutdown_t;
 DEFINE_XEN_GUEST_HANDLE(sched_shutdown_t);
 
-/*
- * Poll a set of event-channel ports. Return when one or more are pending. An
- * optional timeout may be specified.
- * @arg == pointer to sched_poll structure.
- */
-#define SCHEDOP_poll        3
 struct sched_poll {
     XEN_GUEST_HANDLE(evtchn_port_t) ports;
     unsigned int nr_ports;
@@ -84,36 +133,13 @@ struct sched_poll {
 typedef struct sched_poll sched_poll_t;
 DEFINE_XEN_GUEST_HANDLE(sched_poll_t);
 
-/*
- * Declare a shutdown for another domain. The main use of this function is
- * in interpreting shutdown requests and reasons for fully-virtualized
- * domains.  A para-virtualized domain may use SCHEDOP_shutdown directly.
- * @arg == pointer to sched_remote_shutdown structure.
- */
-#define SCHEDOP_remote_shutdown        4
 struct sched_remote_shutdown {
     domid_t domain_id;         /* Remote domain ID */
-    unsigned int reason;       /* SHUTDOWN_xxx reason */
+    unsigned int reason;       /* SHUTDOWN_* => enum sched_shutdown_reason */
 };
 typedef struct sched_remote_shutdown sched_remote_shutdown_t;
 DEFINE_XEN_GUEST_HANDLE(sched_remote_shutdown_t);
 
-/*
- * Latch a shutdown code, so that when the domain later shuts down it
- * reports this code to the control tools.
- * @arg == as for SCHEDOP_shutdown.
- */
-#define SCHEDOP_shutdown_code 5
-
-/*
- * Setup, poke and destroy a domain watchdog timer.
- * @arg == pointer to sched_watchdog structure.
- * With id == 0, setup a domain watchdog timer to cause domain shutdown
- *               after timeout, returns watchdog id.
- * With id != 0 and timeout == 0, destroy domain watchdog timer.
- * With id != 0 and timeout != 0, poke watchdog timer and set new timeout.
- */
-#define SCHEDOP_watchdog    6
 struct sched_watchdog {
     uint32_t id;                /* watchdog ID */
     uint32_t timeout;           /* timeout */
@@ -126,11 +152,13 @@ DEFINE_XEN_GUEST_HANDLE(sched_watchdog_t
  * software to determine the appropriate action. For the most part, Xen does
  * not care about the shutdown code.
  */
+/* ` enum sched_shutdown_reason { */
 #define SHUTDOWN_poweroff   0  /* Domain exited normally. Clean up and kill. */
 #define SHUTDOWN_reboot     1  /* Clean up, kill, and then restart.          */
 #define SHUTDOWN_suspend    2  /* Clean up, save suspend info, kill.         */
 #define SHUTDOWN_crash      3  /* Tell controller we've crashed.             */
 #define SHUTDOWN_watchdog   4  /* Restart because watchdog time expired.     */
+/* ` } */
 
 #endif /* __XEN_PUBLIC_SCHED_H__ */
 

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0id-0002cm-Vo; Wed, 21 Nov 2012 03:11: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 1Tb0ib-0002Yn-D4
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:17 +0000
Received: from [85.158.139.83:22033] by server-10.bemta-5.messagelabs.com id
	A2/72-09257-4564CA05; Wed, 21 Nov 2012 03:11:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-182.messagelabs.com!1353467474!31229326!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6456 invoked from network); 21 Nov 2012 03:11: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;
	21 Nov 2012 03: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 1Tb0iY-0007dS-9Q
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iY-0005Zk-7s
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:14 +0000
Message-Id: <E1Tb0iY-0005Zk-7s@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: document/mark-up SCHEDOP_*
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353335131 0
# Node ID cfd2772cc7175c09b2da52bba80583b6ca55bacf
# Parent  31668da0c4d31d32ec27e229422d57ccc5ee0b77
docs: document/mark-up SCHEDOP_*

The biggest subtlety here is there additional argument when op ==
SCHEDOP_shutdown and reason == SHUTDOWN_suspend and its interpretation by
xc_domain_{save,restore}. Add some clarifying comments to libxc as well.

This patch moves some structs around but there is no functional change
other than improved documentation.

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


diff -r 31668da0c4d3 -r cfd2772cc717 tools/libxc/xc_domain_restore.c
--- a/tools/libxc/xc_domain_restore.c	Mon Nov 19 15:15:12 2012 +0100
+++ b/tools/libxc/xc_domain_restore.c	Mon Nov 19 14:25:31 2012 +0000
@@ -1967,8 +1967,14 @@ int xc_domain_restore(xc_interface *xch,
         if ( i == 0 )
         {
             /*
-             * Uncanonicalise the suspend-record frame number and poke
-             * resume record.
+             * Uncanonicalise the start info frame number and poke in
+             * updated values into the start info itself.
+             *
+             * The start info MFN is the 3rd argument to the
+             * HYPERVISOR_sched_op hypercall when op==SCHEDOP_shutdown
+             * and reason==SHUTDOWN_suspend, it is canonicalised in
+             * xc_domain_save and therefore the PFN is found in the
+             * edx register.
              */
             pfn = GET_FIELD(ctxt, user_regs.edx);
             if ( (pfn >= dinfo->p2m_size) ||
diff -r 31668da0c4d3 -r cfd2772cc717 tools/libxc/xc_domain_save.c
--- a/tools/libxc/xc_domain_save.c	Mon Nov 19 15:15:12 2012 +0100
+++ b/tools/libxc/xc_domain_save.c	Mon Nov 19 14:25:31 2012 +0000
@@ -1868,7 +1868,14 @@ int xc_domain_save(xc_interface *xch, in
         goto out;
     }
 
-    /* Canonicalise the suspend-record frame number. */
+    /*
+     * Canonicalise the start info frame number.
+     *
+     * The start info MFN is the 3rd argument to the
+     * HYPERVISOR_sched_op hypercall when op==SCHEDOP_shutdown and
+     * reason==SHUTDOWN_suspend and is therefore found in the edx
+     * register.
+     */
     mfn = GET_FIELD(&ctxt, user_regs.edx);
     if ( !MFN_IS_IN_PSEUDOPHYS_MAP(mfn) )
     {
diff -r 31668da0c4d3 -r cfd2772cc717 xen/include/public/sched.h
--- a/xen/include/public/sched.h	Mon Nov 19 15:15:12 2012 +0100
+++ b/xen/include/public/sched.h	Mon Nov 19 14:25:31 2012 +0000
@@ -1,8 +1,8 @@
 /******************************************************************************
  * sched.h
- * 
+ *
  * Scheduler state interactions
- * 
+ *
  * 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
@@ -30,20 +30,33 @@
 #include "event_channel.h"
 
 /*
+ * `incontents 150 sched Guest Scheduler Operations
+ *
+ * The SCHEDOP interface provides mechanisms for a guest to interact
+ * with the scheduler, including yield, blocking and shutting itself
+ * down.
+ */
+
+/*
  * The prototype for this hypercall is:
- *  long sched_op(int cmd, void *arg)
+ * ` long HYPERVISOR_sched_op(enum sched_op cmd, void *arg, ...)
+ *
  * @cmd == SCHEDOP_??? (scheduler operation).
  * @arg == Operation-specific extra argument(s), as described below.
- * 
+ * ...  == Additional Operation-specific extra arguments, described below.
+ *
  * Versions of Xen prior to 3.0.2 provided only the following legacy version
  * of this hypercall, supporting only the commands yield, block and shutdown:
  *  long sched_op(int cmd, unsigned long arg)
  * @cmd == SCHEDOP_??? (scheduler operation).
  * @arg == 0               (SCHEDOP_yield and SCHEDOP_block)
  *      == SHUTDOWN_* code (SCHEDOP_shutdown)
- * This legacy version is available to new guests as sched_op_compat().
+ *
+ * This legacy version is available to new guests as:
+ * ` long HYPERVISOR_sched_op_compat(enum sched_op cmd, unsigned long arg)
  */
 
+/* ` enum sched_op { // SCHEDOP_* => struct sched_* */
 /*
  * Voluntarily yield the CPU.
  * @arg == NULL.
@@ -61,21 +74,57 @@
 
 /*
  * Halt execution of this domain (all VCPUs) and notify the system controller.
- * @arg == pointer to sched_shutdown structure.
+ * @arg == pointer to sched_shutdown_t structure.
+ *
+ * If the sched_shutdown_t reason is SHUTDOWN_suspend then this
+ * hypercall takes an additional extra argument which should be the
+ * MFN of the guest's start_info_t.
+ *
+ * In addition, which reason is SHUTDOWN_suspend this hypercall
+ * returns 1 if suspend was cancelled or the domain was merely
+ * checkpointed, and 0 if it is resuming in a new domain.
  */
 #define SCHEDOP_shutdown    2
+
+/*
+ * Poll a set of event-channel ports. Return when one or more are pending. An
+ * optional timeout may be specified.
+ * @arg == pointer to sched_poll_t structure.
+ */
+#define SCHEDOP_poll        3
+
+/*
+ * Declare a shutdown for another domain. The main use of this function is
+ * in interpreting shutdown requests and reasons for fully-virtualized
+ * domains.  A para-virtualized domain may use SCHEDOP_shutdown directly.
+ * @arg == pointer to sched_remote_shutdown_t structure.
+ */
+#define SCHEDOP_remote_shutdown        4
+
+/*
+ * Latch a shutdown code, so that when the domain later shuts down it
+ * reports this code to the control tools.
+ * @arg == sched_shutdown_t, as for SCHEDOP_shutdown.
+ */
+#define SCHEDOP_shutdown_code 5
+
+/*
+ * Setup, poke and destroy a domain watchdog timer.
+ * @arg == pointer to sched_watchdog_t structure.
+ * With id == 0, setup a domain watchdog timer to cause domain shutdown
+ *               after timeout, returns watchdog id.
+ * With id != 0 and timeout == 0, destroy domain watchdog timer.
+ * With id != 0 and timeout != 0, poke watchdog timer and set new timeout.
+ */
+#define SCHEDOP_watchdog    6
+/* ` } */
+
 struct sched_shutdown {
-    unsigned int reason; /* SHUTDOWN_* */
+    unsigned int reason; /* SHUTDOWN_* => enum sched_shutdown_reason */
 };
 typedef struct sched_shutdown sched_shutdown_t;
 DEFINE_XEN_GUEST_HANDLE(sched_shutdown_t);
 
-/*
- * Poll a set of event-channel ports. Return when one or more are pending. An
- * optional timeout may be specified.
- * @arg == pointer to sched_poll structure.
- */
-#define SCHEDOP_poll        3
 struct sched_poll {
     XEN_GUEST_HANDLE(evtchn_port_t) ports;
     unsigned int nr_ports;
@@ -84,36 +133,13 @@ struct sched_poll {
 typedef struct sched_poll sched_poll_t;
 DEFINE_XEN_GUEST_HANDLE(sched_poll_t);
 
-/*
- * Declare a shutdown for another domain. The main use of this function is
- * in interpreting shutdown requests and reasons for fully-virtualized
- * domains.  A para-virtualized domain may use SCHEDOP_shutdown directly.
- * @arg == pointer to sched_remote_shutdown structure.
- */
-#define SCHEDOP_remote_shutdown        4
 struct sched_remote_shutdown {
     domid_t domain_id;         /* Remote domain ID */
-    unsigned int reason;       /* SHUTDOWN_xxx reason */
+    unsigned int reason;       /* SHUTDOWN_* => enum sched_shutdown_reason */
 };
 typedef struct sched_remote_shutdown sched_remote_shutdown_t;
 DEFINE_XEN_GUEST_HANDLE(sched_remote_shutdown_t);
 
-/*
- * Latch a shutdown code, so that when the domain later shuts down it
- * reports this code to the control tools.
- * @arg == as for SCHEDOP_shutdown.
- */
-#define SCHEDOP_shutdown_code 5
-
-/*
- * Setup, poke and destroy a domain watchdog timer.
- * @arg == pointer to sched_watchdog structure.
- * With id == 0, setup a domain watchdog timer to cause domain shutdown
- *               after timeout, returns watchdog id.
- * With id != 0 and timeout == 0, destroy domain watchdog timer.
- * With id != 0 and timeout != 0, poke watchdog timer and set new timeout.
- */
-#define SCHEDOP_watchdog    6
 struct sched_watchdog {
     uint32_t id;                /* watchdog ID */
     uint32_t timeout;           /* timeout */
@@ -126,11 +152,13 @@ DEFINE_XEN_GUEST_HANDLE(sched_watchdog_t
  * software to determine the appropriate action. For the most part, Xen does
  * not care about the shutdown code.
  */
+/* ` enum sched_shutdown_reason { */
 #define SHUTDOWN_poweroff   0  /* Domain exited normally. Clean up and kill. */
 #define SHUTDOWN_reboot     1  /* Clean up, kill, and then restart.          */
 #define SHUTDOWN_suspend    2  /* Clean up, save suspend info, kill.         */
 #define SHUTDOWN_crash      3  /* Tell controller we've crashed.             */
 #define SHUTDOWN_watchdog   4  /* Restart because watchdog time expired.     */
+/* ` } */
 
 #endif /* __XEN_PUBLIC_SCHED_H__ */
 

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0ie-0002d1-2s; Wed, 21 Nov 2012 03:11:20 +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 1Tb0ib-0002Xs-UM
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:18 +0000
Received: from [85.158.143.99:14106] by server-3.bemta-4.messagelabs.com id
	D7/72-06841-5564CA05; Wed, 21 Nov 2012 03:11:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1353467476!19806528!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30148 invoked from network); 21 Nov 2012 03:11:16 -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;
	21 Nov 2012 03:11: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 1Tb0iZ-0007db-Qu
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iZ-0005aT-Pi
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:15 +0000
Message-Id: <E1Tb0iZ-0005aT-Pi@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: Add ToC entry for start of day
	memory layout.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353335133 0
# Node ID b1d36147ac96113547984c9cfc90a48e54e88365
# Parent  dbb8d24bb5ad63351cfe6c3a77868151df5776cb
docs: Add ToC entry for start of day memory layout.

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


diff -r dbb8d24bb5ad -r b1d36147ac96 xen/include/public/xen.h
--- a/xen/include/public/xen.h	Mon Nov 19 14:25:33 2012 +0000
+++ b/xen/include/public/xen.h	Mon Nov 19 14:25:33 2012 +0000
@@ -680,7 +680,8 @@ typedef struct shared_info shared_info_t
 #endif
 
 /*
- * Start-of-day memory layout:
+ * `incontents 200 startofday Start-of-day memory layout
+ *
  *  1. The domain is started within contiguous virtual-memory region.
  *  2. The contiguous region ends on an aligned 4MB boundary.
  *  3. This the order of bootstrap elements in the initial virtual region:

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0ie-0002dF-81; Wed, 21 Nov 2012 03:11:20 +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 1Tb0ic-0002Xs-O1
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:18 +0000
Received: from [85.158.143.99:14128] by server-3.bemta-4.messagelabs.com id
	A8/72-06841-6564CA05; Wed, 21 Nov 2012 03:11:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-216.messagelabs.com!1353467477!27371651!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16803 invoked from network); 21 Nov 2012 03:11:17 -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;
	21 Nov 2012 03:11: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 1Tb0ia-0007dh-RV
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0ia-0005ax-QO
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:16 +0000
Message-Id: <E1Tb0ia-0005ax-QO@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: Include prototype for
	HYPERVISOR_multicall
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353335135 0
# Node ID fe8034159ac237d6661174c7b3cff8e822e8e5e1
# Parent  edad24bfa561c1a3187edf11720ad9c182075472
docs: Include prototype for HYPERVISOR_multicall

Mark-up for inclusion of generated docs.

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


diff -r edad24bfa561 -r fe8034159ac2 xen/include/public/xen.h
--- a/xen/include/public/xen.h	Mon Nov 19 14:25:34 2012 +0000
+++ b/xen/include/public/xen.h	Mon Nov 19 14:25:35 2012 +0000
@@ -540,7 +540,10 @@ typedef struct mmu_update mmu_update_t;
 DEFINE_XEN_GUEST_HANDLE(mmu_update_t);
 
 /*
- * Send an array of these to HYPERVISOR_multicall().
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_multicall(multicall_entry_t call_list[],
+ * `                      unsigned int nr_calls);
+ *
  * NB. The fields are natural register size for this architecture.
  */
 struct multicall_entry {

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0ie-0002d1-2s; Wed, 21 Nov 2012 03:11:20 +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 1Tb0ib-0002Xs-UM
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:18 +0000
Received: from [85.158.143.99:14106] by server-3.bemta-4.messagelabs.com id
	D7/72-06841-5564CA05; Wed, 21 Nov 2012 03:11:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1353467476!19806528!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30148 invoked from network); 21 Nov 2012 03:11:16 -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;
	21 Nov 2012 03:11: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 1Tb0iZ-0007db-Qu
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iZ-0005aT-Pi
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:15 +0000
Message-Id: <E1Tb0iZ-0005aT-Pi@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: Add ToC entry for start of day
	memory layout.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353335133 0
# Node ID b1d36147ac96113547984c9cfc90a48e54e88365
# Parent  dbb8d24bb5ad63351cfe6c3a77868151df5776cb
docs: Add ToC entry for start of day memory layout.

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


diff -r dbb8d24bb5ad -r b1d36147ac96 xen/include/public/xen.h
--- a/xen/include/public/xen.h	Mon Nov 19 14:25:33 2012 +0000
+++ b/xen/include/public/xen.h	Mon Nov 19 14:25:33 2012 +0000
@@ -680,7 +680,8 @@ typedef struct shared_info shared_info_t
 #endif
 
 /*
- * Start-of-day memory layout:
+ * `incontents 200 startofday Start-of-day memory layout
+ *
  *  1. The domain is started within contiguous virtual-memory region.
  *  2. The contiguous region ends on an aligned 4MB boundary.
  *  3. This the order of bootstrap elements in the initial virtual region:

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0id-0002cT-RN; Wed, 21 Nov 2012 03:11: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 1Tb0ib-0002Ym-GH
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:17 +0000
Received: from [85.158.139.211:42657] by server-12.bemta-5.messagelabs.com id
	C5/F3-02886-4564CA05; Wed, 21 Nov 2012 03:11:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-206.messagelabs.com!1353467474!18972392!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 546 invoked from network); 21 Nov 2012 03:11:16 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Nov 2012 03:11: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 1Tb0iY-0007dV-Q9
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iY-0005Zz-Oz
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:14 +0000
Message-Id: <E1Tb0iY-0005Zz-Oz@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: document
	HYPERVISOR_update_va_mapping(_other_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: "Change log for Mercurial \(receive only\)"
	<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 1353335132 0
# Node ID 26facad2f1a19f7dd76cc2de0b95734b8ab5d0c5
# Parent  cfd2772cc7175c09b2da52bba80583b6ca55bacf
docs: document HYPERVISOR_update_va_mapping(_other_domain)

Mark-up for inclusion of generated docs.

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


diff -r cfd2772cc717 -r 26facad2f1a1 xen/include/public/xen.h
--- a/xen/include/public/xen.h	Mon Nov 19 14:25:31 2012 +0000
+++ b/xen/include/public/xen.h	Mon Nov 19 14:25:32 2012 +0000
@@ -423,9 +423,25 @@ typedef struct mmuext_op mmuext_op_t;
 DEFINE_XEN_GUEST_HANDLE(mmuext_op_t);
 #endif
 
+/*
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_update_va_mapping(unsigned long va, u64 val,
+ * `                              enum uvm_flags flags)
+ * `
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_update_va_mapping_otherdomain(unsigned long va, u64 val,
+ * `                                          enum uvm_flags flags,
+ * `                                          domid_t domid)
+ * `
+ * ` @va: The virtual address whose mapping we want to change
+ * ` @val: The new page table entry, must contain a machine address
+ * ` @flags: Control TLB flushes
+ */
+*/
 /* These are passed as 'flags' to update_va_mapping. They can be ORed. */
 /* When specifying UVMF_MULTI, also OR in a pointer to a CPU bitmap.   */
 /* UVMF_LOCAL is merely UVMF_MULTI with a NULL bitmap pointer.         */
+/* ` enum uvm_flags { */
 #define UVMF_NONE               (0UL<<0) /* No flushing at all.   */
 #define UVMF_TLB_FLUSH          (1UL<<0) /* Flush entire TLB(s).  */
 #define UVMF_INVLPG             (2UL<<0) /* Flush only one entry. */
@@ -433,6 +449,7 @@ DEFINE_XEN_GUEST_HANDLE(mmuext_op_t);
 #define UVMF_MULTI              (0UL<<2) /* Flush subset of TLBs. */
 #define UVMF_LOCAL              (0UL<<2) /* Flush local TLB.      */
 #define UVMF_ALL                (1UL<<2) /* Flush all TLBs.       */
+/* ` } */
 
 /*
  * Commands to HYPERVISOR_console_io().

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0ie-0002dF-81; Wed, 21 Nov 2012 03:11:20 +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 1Tb0ic-0002Xs-O1
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:18 +0000
Received: from [85.158.143.99:14128] by server-3.bemta-4.messagelabs.com id
	A8/72-06841-6564CA05; Wed, 21 Nov 2012 03:11:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-216.messagelabs.com!1353467477!27371651!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16803 invoked from network); 21 Nov 2012 03:11:17 -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;
	21 Nov 2012 03:11: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 1Tb0ia-0007dh-RV
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0ia-0005ax-QO
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:16 +0000
Message-Id: <E1Tb0ia-0005ax-QO@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: Include prototype for
	HYPERVISOR_multicall
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353335135 0
# Node ID fe8034159ac237d6661174c7b3cff8e822e8e5e1
# Parent  edad24bfa561c1a3187edf11720ad9c182075472
docs: Include prototype for HYPERVISOR_multicall

Mark-up for inclusion of generated docs.

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


diff -r edad24bfa561 -r fe8034159ac2 xen/include/public/xen.h
--- a/xen/include/public/xen.h	Mon Nov 19 14:25:34 2012 +0000
+++ b/xen/include/public/xen.h	Mon Nov 19 14:25:35 2012 +0000
@@ -540,7 +540,10 @@ typedef struct mmu_update mmu_update_t;
 DEFINE_XEN_GUEST_HANDLE(mmu_update_t);
 
 /*
- * Send an array of these to HYPERVISOR_multicall().
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_multicall(multicall_entry_t call_list[],
+ * `                      unsigned int nr_calls);
+ *
  * NB. The fields are natural register size for this architecture.
  */
 struct multicall_entry {

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0id-0002cT-RN; Wed, 21 Nov 2012 03:11: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 1Tb0ib-0002Ym-GH
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:17 +0000
Received: from [85.158.139.211:42657] by server-12.bemta-5.messagelabs.com id
	C5/F3-02886-4564CA05; Wed, 21 Nov 2012 03:11:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-206.messagelabs.com!1353467474!18972392!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 546 invoked from network); 21 Nov 2012 03:11:16 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Nov 2012 03:11: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 1Tb0iY-0007dV-Q9
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iY-0005Zz-Oz
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:14 +0000
Message-Id: <E1Tb0iY-0005Zz-Oz@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: document
	HYPERVISOR_update_va_mapping(_other_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: "Change log for Mercurial \(receive only\)"
	<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 1353335132 0
# Node ID 26facad2f1a19f7dd76cc2de0b95734b8ab5d0c5
# Parent  cfd2772cc7175c09b2da52bba80583b6ca55bacf
docs: document HYPERVISOR_update_va_mapping(_other_domain)

Mark-up for inclusion of generated docs.

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


diff -r cfd2772cc717 -r 26facad2f1a1 xen/include/public/xen.h
--- a/xen/include/public/xen.h	Mon Nov 19 14:25:31 2012 +0000
+++ b/xen/include/public/xen.h	Mon Nov 19 14:25:32 2012 +0000
@@ -423,9 +423,25 @@ typedef struct mmuext_op mmuext_op_t;
 DEFINE_XEN_GUEST_HANDLE(mmuext_op_t);
 #endif
 
+/*
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_update_va_mapping(unsigned long va, u64 val,
+ * `                              enum uvm_flags flags)
+ * `
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_update_va_mapping_otherdomain(unsigned long va, u64 val,
+ * `                                          enum uvm_flags flags,
+ * `                                          domid_t domid)
+ * `
+ * ` @va: The virtual address whose mapping we want to change
+ * ` @val: The new page table entry, must contain a machine address
+ * ` @flags: Control TLB flushes
+ */
+*/
 /* These are passed as 'flags' to update_va_mapping. They can be ORed. */
 /* When specifying UVMF_MULTI, also OR in a pointer to a CPU bitmap.   */
 /* UVMF_LOCAL is merely UVMF_MULTI with a NULL bitmap pointer.         */
+/* ` enum uvm_flags { */
 #define UVMF_NONE               (0UL<<0) /* No flushing at all.   */
 #define UVMF_TLB_FLUSH          (1UL<<0) /* Flush entire TLB(s).  */
 #define UVMF_INVLPG             (2UL<<0) /* Flush only one entry. */
@@ -433,6 +449,7 @@ DEFINE_XEN_GUEST_HANDLE(mmuext_op_t);
 #define UVMF_MULTI              (0UL<<2) /* Flush subset of TLBs. */
 #define UVMF_LOCAL              (0UL<<2) /* Flush local TLB.      */
 #define UVMF_ALL                (1UL<<2) /* Flush all TLBs.       */
+/* ` } */
 
 /*
  * Commands to HYPERVISOR_console_io().

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0id-0002c3-JA; Wed, 21 Nov 2012 03:11:19 +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 1Tb0ib-0002Xs-FS
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:17 +0000
Received: from [85.158.143.99:14102] by server-3.bemta-4.messagelabs.com id
	A7/72-06841-5564CA05; Wed, 21 Nov 2012 03:11:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-216.messagelabs.com!1353467475!30708915!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30999 invoked from network); 21 Nov 2012 03:11:16 -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;
	21 Nov 2012 03:11: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 1Tb0iZ-0007dY-ED
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iZ-0005aE-9Q
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:15 +0000
Message-Id: <E1Tb0iZ-0005aE-9Q@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: Document HYPERVISOR_mmuext_op
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353335133 0
# Node ID dbb8d24bb5ad63351cfe6c3a77868151df5776cb
# Parent  26facad2f1a19f7dd76cc2de0b95734b8ab5d0c5
docs: Document HYPERVISOR_mmuext_op

Mark-up for inclusion of generated docs.

Remove some trailing whitespace.

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


diff -r 26facad2f1a1 -r dbb8d24bb5ad xen/include/public/xen.h
--- a/xen/include/public/xen.h	Mon Nov 19 14:25:32 2012 +0000
+++ b/xen/include/public/xen.h	Mon Nov 19 14:25:33 2012 +0000
@@ -319,48 +319,54 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t);
 
 /*
  * MMU EXTENDED OPERATIONS
- * 
- * HYPERVISOR_mmuext_op() accepts a list of mmuext_op structures.
+ *
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_mmuext_op(mmuext_op_t uops[],
+ * `                      unsigned int count,
+ * `                      unsigned int *pdone,
+ * `                      unsigned int foreigndom)
+ */
+/* HYPERVISOR_mmuext_op() accepts a list of mmuext_op structures.
  * A foreigndom (FD) can be specified (or DOMID_SELF for none).
  * Where the FD has some effect, it is described below.
- * 
+ *
  * cmd: MMUEXT_(UN)PIN_*_TABLE
  * mfn: Machine frame number to be (un)pinned as a p.t. page.
  *      The frame must belong to the FD, if one is specified.
- * 
+ *
  * cmd: MMUEXT_NEW_BASEPTR
  * mfn: Machine frame number of new page-table base to install in MMU.
- * 
+ *
  * cmd: MMUEXT_NEW_USER_BASEPTR [x86/64 only]
  * mfn: Machine frame number of new page-table base to install in MMU
  *      when in user space.
- * 
+ *
  * cmd: MMUEXT_TLB_FLUSH_LOCAL
  * No additional arguments. Flushes local TLB.
- * 
+ *
  * cmd: MMUEXT_INVLPG_LOCAL
  * linear_addr: Linear address to be flushed from the local TLB.
- * 
+ *
  * cmd: MMUEXT_TLB_FLUSH_MULTI
  * vcpumask: Pointer to bitmap of VCPUs to be flushed.
- * 
+ *
  * cmd: MMUEXT_INVLPG_MULTI
  * linear_addr: Linear address to be flushed.
  * vcpumask: Pointer to bitmap of VCPUs to be flushed.
- * 
+ *
  * cmd: MMUEXT_TLB_FLUSH_ALL
  * No additional arguments. Flushes all VCPUs' TLBs.
- * 
+ *
  * cmd: MMUEXT_INVLPG_ALL
  * linear_addr: Linear address to be flushed from all VCPUs' TLBs.
- * 
+ *
  * cmd: MMUEXT_FLUSH_CACHE
  * No additional arguments. Writes back and flushes cache contents.
  *
  * cmd: MMUEXT_FLUSH_CACHE_GLOBAL
  * No additional arguments. Writes back and flushes cache contents
  * on all CPUs in the system.
- * 
+ *
  * cmd: MMUEXT_SET_LDT
  * linear_addr: Linear address of LDT base (NB. must be page-aligned).
  * nr_ents: Number of entries in LDT.
@@ -375,6 +381,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t);
  * cmd: MMUEXT_[UN]MARK_SUPER
  * mfn: Machine frame number of head of superpage to be [un]marked.
  */
+/* ` enum mmuext_cmd { */
 #define MMUEXT_PIN_L1_TABLE      0
 #define MMUEXT_PIN_L2_TABLE      1
 #define MMUEXT_PIN_L3_TABLE      2
@@ -395,10 +402,11 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t);
 #define MMUEXT_FLUSH_CACHE_GLOBAL 18
 #define MMUEXT_MARK_SUPER       19
 #define MMUEXT_UNMARK_SUPER     20
+/* ` } */
 
 #ifndef __ASSEMBLY__
 struct mmuext_op {
-    unsigned int cmd;
+    unsigned int cmd; /* => enum mmuext_cmd */
     union {
         /* [UN]PIN_TABLE, NEW_BASEPTR, NEW_USER_BASEPTR
          * CLEAR_PAGE, COPY_PAGE, [UN]MARK_SUPER */

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0id-0002c3-JA; Wed, 21 Nov 2012 03:11:19 +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 1Tb0ib-0002Xs-FS
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:17 +0000
Received: from [85.158.143.99:14102] by server-3.bemta-4.messagelabs.com id
	A7/72-06841-5564CA05; Wed, 21 Nov 2012 03:11:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-216.messagelabs.com!1353467475!30708915!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30999 invoked from network); 21 Nov 2012 03:11:16 -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;
	21 Nov 2012 03:11: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 1Tb0iZ-0007dY-ED
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0iZ-0005aE-9Q
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:15 +0000
Message-Id: <E1Tb0iZ-0005aE-9Q@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: Document HYPERVISOR_mmuext_op
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353335133 0
# Node ID dbb8d24bb5ad63351cfe6c3a77868151df5776cb
# Parent  26facad2f1a19f7dd76cc2de0b95734b8ab5d0c5
docs: Document HYPERVISOR_mmuext_op

Mark-up for inclusion of generated docs.

Remove some trailing whitespace.

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


diff -r 26facad2f1a1 -r dbb8d24bb5ad xen/include/public/xen.h
--- a/xen/include/public/xen.h	Mon Nov 19 14:25:32 2012 +0000
+++ b/xen/include/public/xen.h	Mon Nov 19 14:25:33 2012 +0000
@@ -319,48 +319,54 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t);
 
 /*
  * MMU EXTENDED OPERATIONS
- * 
- * HYPERVISOR_mmuext_op() accepts a list of mmuext_op structures.
+ *
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_mmuext_op(mmuext_op_t uops[],
+ * `                      unsigned int count,
+ * `                      unsigned int *pdone,
+ * `                      unsigned int foreigndom)
+ */
+/* HYPERVISOR_mmuext_op() accepts a list of mmuext_op structures.
  * A foreigndom (FD) can be specified (or DOMID_SELF for none).
  * Where the FD has some effect, it is described below.
- * 
+ *
  * cmd: MMUEXT_(UN)PIN_*_TABLE
  * mfn: Machine frame number to be (un)pinned as a p.t. page.
  *      The frame must belong to the FD, if one is specified.
- * 
+ *
  * cmd: MMUEXT_NEW_BASEPTR
  * mfn: Machine frame number of new page-table base to install in MMU.
- * 
+ *
  * cmd: MMUEXT_NEW_USER_BASEPTR [x86/64 only]
  * mfn: Machine frame number of new page-table base to install in MMU
  *      when in user space.
- * 
+ *
  * cmd: MMUEXT_TLB_FLUSH_LOCAL
  * No additional arguments. Flushes local TLB.
- * 
+ *
  * cmd: MMUEXT_INVLPG_LOCAL
  * linear_addr: Linear address to be flushed from the local TLB.
- * 
+ *
  * cmd: MMUEXT_TLB_FLUSH_MULTI
  * vcpumask: Pointer to bitmap of VCPUs to be flushed.
- * 
+ *
  * cmd: MMUEXT_INVLPG_MULTI
  * linear_addr: Linear address to be flushed.
  * vcpumask: Pointer to bitmap of VCPUs to be flushed.
- * 
+ *
  * cmd: MMUEXT_TLB_FLUSH_ALL
  * No additional arguments. Flushes all VCPUs' TLBs.
- * 
+ *
  * cmd: MMUEXT_INVLPG_ALL
  * linear_addr: Linear address to be flushed from all VCPUs' TLBs.
- * 
+ *
  * cmd: MMUEXT_FLUSH_CACHE
  * No additional arguments. Writes back and flushes cache contents.
  *
  * cmd: MMUEXT_FLUSH_CACHE_GLOBAL
  * No additional arguments. Writes back and flushes cache contents
  * on all CPUs in the system.
- * 
+ *
  * cmd: MMUEXT_SET_LDT
  * linear_addr: Linear address of LDT base (NB. must be page-aligned).
  * nr_ents: Number of entries in LDT.
@@ -375,6 +381,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t);
  * cmd: MMUEXT_[UN]MARK_SUPER
  * mfn: Machine frame number of head of superpage to be [un]marked.
  */
+/* ` enum mmuext_cmd { */
 #define MMUEXT_PIN_L1_TABLE      0
 #define MMUEXT_PIN_L2_TABLE      1
 #define MMUEXT_PIN_L3_TABLE      2
@@ -395,10 +402,11 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t);
 #define MMUEXT_FLUSH_CACHE_GLOBAL 18
 #define MMUEXT_MARK_SUPER       19
 #define MMUEXT_UNMARK_SUPER     20
+/* ` } */
 
 #ifndef __ASSEMBLY__
 struct mmuext_op {
-    unsigned int cmd;
+    unsigned int cmd; /* => enum mmuext_cmd */
     union {
         /* [UN]PIN_TABLE, NEW_BASEPTR, NEW_USER_BASEPTR
          * CLEAR_PAGE, COPY_PAGE, [UN]MARK_SUPER */

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0if-0002ev-Cy; Wed, 21 Nov 2012 03:11: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 1Tb0ic-0002Ze-T3
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:19 +0000
Received: from [85.158.139.211:64146] by server-15.bemta-5.messagelabs.com id
	6F/3A-26920-6564CA05; Wed, 21 Nov 2012 03:11:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-206.messagelabs.com!1353467476!20914001!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25147 invoked from network); 21 Nov 2012 03:11:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Nov 2012 03:11: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 1Tb0ia-0007de-Ds
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0ia-0005ai-9p
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:16 +0000
Message-Id: <E1Tb0ia-0005ai-9p@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: Document
	HYPERVISOR_update_descriptor
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353335134 0
# Node ID edad24bfa561c1a3187edf11720ad9c182075472
# Parent  b1d36147ac96113547984c9cfc90a48e54e88365
docs: Document HYPERVISOR_update_descriptor

Mark-up for inclusion of generated docs.

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


diff -r b1d36147ac96 -r edad24bfa561 xen/include/public/arch-x86/xen.h
--- a/xen/include/public/arch-x86/xen.h	Mon Nov 19 14:25:33 2012 +0000
+++ b/xen/include/public/arch-x86/xen.h	Mon Nov 19 14:25:34 2012 +0000
@@ -71,7 +71,7 @@ typedef unsigned long xen_pfn_t;
 #endif
 
 /*
- * SEGMENT DESCRIPTOR TABLES
+ * `incontents 200 segdesc Segment Descriptor Tables
  */
 /*
  * ` enum neg_errnoval
@@ -83,11 +83,24 @@ typedef unsigned long xen_pfn_t;
  * start of the GDT because some stupid OSes export hard-coded selector values
  * in their ABI. These hard-coded values are always near the start of the GDT,
  * so Xen places itself out of the way, at the far end of the GDT.
+ *
+ * NB The LDT is set using the MMUEXT_SET_LDT op of HYPERVISOR_mmuext_op
  */
 #define FIRST_RESERVED_GDT_PAGE  14
 #define FIRST_RESERVED_GDT_BYTE  (FIRST_RESERVED_GDT_PAGE * 4096)
 #define FIRST_RESERVED_GDT_ENTRY (FIRST_RESERVED_GDT_BYTE / 8)
 
+
+/*
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_update_descriptor(u64 pa, u64 desc);
+ * `
+ * ` @pa   The machine physical address of the descriptor to
+ * `       update. Must be either a descriptor page or writable.
+ * ` @desc The descriptor value to update, in the same format as a
+ * `       native descriptor table entry.
+ */
+
 /* Maximum number of virtual CPUs in legacy multi-processor guests. */
 #define XEN_LEGACY_MAX_VCPUS 32
 

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0if-0002fd-OC; Wed, 21 Nov 2012 03:11:21 +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 1Tb0id-0002Xs-Kk
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:19 +0000
Received: from [85.158.143.99:14155] by server-3.bemta-4.messagelabs.com id
	DA/72-06841-7564CA05; Wed, 21 Nov 2012 03:11:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-216.messagelabs.com!1353467478!23220272!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16545 invoked from network); 21 Nov 2012 03:11:18 -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;
	21 Nov 2012 03:11: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 1Tb0ib-0007dw-Rq
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0ib-0005bR-Qj
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:17 +0000
Message-Id: <E1Tb0ib-0005bR-Qj@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] passthrough/PCI: replace improper
	uses of pci_find_next_cap()
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353398311 -3600
# Node ID ae6fb202b233af815466055d9f1a635802a50855
# Parent  02b9d9a25feecd76d56143afa9bbb853fd01f602
passthrough/PCI: replace improper uses of pci_find_next_cap()

Using pci_find_next_cap() without prior pci_find_cap_offset() is bogus
(and possibly wrong, given that the latter doesn't check the
PCI_STATUS_CAP_LIST flag, which so far was checked in an open-coded way
only for the non-bridge case).

Once at it, fold the two calls into one, as we need its result in any
case.

Question is whether, without any caller left, pci_find_next_cap()
should be purged as well.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Xiantao Zhang <xiantao.zhang@intel.com>
---


diff -r 02b9d9a25fee -r ae6fb202b233 xen/drivers/passthrough/pci.c
--- a/xen/drivers/passthrough/pci.c	Mon Nov 19 19:56:56 2012 +0000
+++ b/xen/drivers/passthrough/pci.c	Tue Nov 20 08:58:31 2012 +0100
@@ -589,16 +589,13 @@ void pci_release_devices(struct domain *
 
 int pdev_type(u16 seg, u8 bus, u8 devfn)
 {
-    u16 class_device;
-    u16 status, creg;
-    int pos;
+    u16 class_device, creg;
     u8 d = PCI_SLOT(devfn), f = PCI_FUNC(devfn);
+    int pos = pci_find_cap_offset(seg, bus, d, f, PCI_CAP_ID_EXP);
 
     class_device = pci_conf_read16(seg, bus, d, f, PCI_CLASS_DEVICE);
     if ( class_device == PCI_CLASS_BRIDGE_PCI )
     {
-        pos = pci_find_next_cap(seg, bus, devfn,
-                                PCI_CAPABILITY_LIST, PCI_CAP_ID_EXP);
         if ( !pos )
             return DEV_TYPE_LEGACY_PCI_BRIDGE;
         creg = pci_conf_read16(seg, bus, d, f, pos + PCI_EXP_FLAGS);
@@ -606,15 +603,7 @@ int pdev_type(u16 seg, u8 bus, u8 devfn)
             DEV_TYPE_PCIe2PCI_BRIDGE : DEV_TYPE_PCIe_BRIDGE;
     }
 
-    status = pci_conf_read16(seg, bus, d, f, PCI_STATUS);
-    if ( !(status & PCI_STATUS_CAP_LIST) )
-        return DEV_TYPE_PCI;
-
-    if ( pci_find_next_cap(seg, bus, devfn, PCI_CAPABILITY_LIST,
-                           PCI_CAP_ID_EXP) )
-        return DEV_TYPE_PCIe_ENDPOINT;
-
-    return DEV_TYPE_PCI;
+    return pos ? DEV_TYPE_PCIe_ENDPOINT : DEV_TYPE_PCI;
 }
 
 /*

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0if-0002ev-Cy; Wed, 21 Nov 2012 03:11: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 1Tb0ic-0002Ze-T3
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:19 +0000
Received: from [85.158.139.211:64146] by server-15.bemta-5.messagelabs.com id
	6F/3A-26920-6564CA05; Wed, 21 Nov 2012 03:11:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-206.messagelabs.com!1353467476!20914001!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25147 invoked from network); 21 Nov 2012 03:11:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Nov 2012 03:11: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 1Tb0ia-0007de-Ds
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0ia-0005ai-9p
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:16 +0000
Message-Id: <E1Tb0ia-0005ai-9p@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: Document
	HYPERVISOR_update_descriptor
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353335134 0
# Node ID edad24bfa561c1a3187edf11720ad9c182075472
# Parent  b1d36147ac96113547984c9cfc90a48e54e88365
docs: Document HYPERVISOR_update_descriptor

Mark-up for inclusion of generated docs.

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


diff -r b1d36147ac96 -r edad24bfa561 xen/include/public/arch-x86/xen.h
--- a/xen/include/public/arch-x86/xen.h	Mon Nov 19 14:25:33 2012 +0000
+++ b/xen/include/public/arch-x86/xen.h	Mon Nov 19 14:25:34 2012 +0000
@@ -71,7 +71,7 @@ typedef unsigned long xen_pfn_t;
 #endif
 
 /*
- * SEGMENT DESCRIPTOR TABLES
+ * `incontents 200 segdesc Segment Descriptor Tables
  */
 /*
  * ` enum neg_errnoval
@@ -83,11 +83,24 @@ typedef unsigned long xen_pfn_t;
  * start of the GDT because some stupid OSes export hard-coded selector values
  * in their ABI. These hard-coded values are always near the start of the GDT,
  * so Xen places itself out of the way, at the far end of the GDT.
+ *
+ * NB The LDT is set using the MMUEXT_SET_LDT op of HYPERVISOR_mmuext_op
  */
 #define FIRST_RESERVED_GDT_PAGE  14
 #define FIRST_RESERVED_GDT_BYTE  (FIRST_RESERVED_GDT_PAGE * 4096)
 #define FIRST_RESERVED_GDT_ENTRY (FIRST_RESERVED_GDT_BYTE / 8)
 
+
+/*
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_update_descriptor(u64 pa, u64 desc);
+ * `
+ * ` @pa   The machine physical address of the descriptor to
+ * `       update. Must be either a descriptor page or writable.
+ * ` @desc The descriptor value to update, in the same format as a
+ * `       native descriptor table entry.
+ */
+
 /* Maximum number of virtual CPUs in legacy multi-processor guests. */
 #define XEN_LEGACY_MAX_VCPUS 32
 

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0if-0002fd-OC; Wed, 21 Nov 2012 03:11:21 +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 1Tb0id-0002Xs-Kk
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:19 +0000
Received: from [85.158.143.99:14155] by server-3.bemta-4.messagelabs.com id
	DA/72-06841-7564CA05; Wed, 21 Nov 2012 03:11:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-216.messagelabs.com!1353467478!23220272!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16545 invoked from network); 21 Nov 2012 03:11:18 -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;
	21 Nov 2012 03:11: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 1Tb0ib-0007dw-Rq
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0ib-0005bR-Qj
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:17 +0000
Message-Id: <E1Tb0ib-0005bR-Qj@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] passthrough/PCI: replace improper
	uses of pci_find_next_cap()
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353398311 -3600
# Node ID ae6fb202b233af815466055d9f1a635802a50855
# Parent  02b9d9a25feecd76d56143afa9bbb853fd01f602
passthrough/PCI: replace improper uses of pci_find_next_cap()

Using pci_find_next_cap() without prior pci_find_cap_offset() is bogus
(and possibly wrong, given that the latter doesn't check the
PCI_STATUS_CAP_LIST flag, which so far was checked in an open-coded way
only for the non-bridge case).

Once at it, fold the two calls into one, as we need its result in any
case.

Question is whether, without any caller left, pci_find_next_cap()
should be purged as well.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Xiantao Zhang <xiantao.zhang@intel.com>
---


diff -r 02b9d9a25fee -r ae6fb202b233 xen/drivers/passthrough/pci.c
--- a/xen/drivers/passthrough/pci.c	Mon Nov 19 19:56:56 2012 +0000
+++ b/xen/drivers/passthrough/pci.c	Tue Nov 20 08:58:31 2012 +0100
@@ -589,16 +589,13 @@ void pci_release_devices(struct domain *
 
 int pdev_type(u16 seg, u8 bus, u8 devfn)
 {
-    u16 class_device;
-    u16 status, creg;
-    int pos;
+    u16 class_device, creg;
     u8 d = PCI_SLOT(devfn), f = PCI_FUNC(devfn);
+    int pos = pci_find_cap_offset(seg, bus, d, f, PCI_CAP_ID_EXP);
 
     class_device = pci_conf_read16(seg, bus, d, f, PCI_CLASS_DEVICE);
     if ( class_device == PCI_CLASS_BRIDGE_PCI )
     {
-        pos = pci_find_next_cap(seg, bus, devfn,
-                                PCI_CAPABILITY_LIST, PCI_CAP_ID_EXP);
         if ( !pos )
             return DEV_TYPE_LEGACY_PCI_BRIDGE;
         creg = pci_conf_read16(seg, bus, d, f, pos + PCI_EXP_FLAGS);
@@ -606,15 +603,7 @@ int pdev_type(u16 seg, u8 bus, u8 devfn)
             DEV_TYPE_PCIe2PCI_BRIDGE : DEV_TYPE_PCIe_BRIDGE;
     }
 
-    status = pci_conf_read16(seg, bus, d, f, PCI_STATUS);
-    if ( !(status & PCI_STATUS_CAP_LIST) )
-        return DEV_TYPE_PCI;
-
-    if ( pci_find_next_cap(seg, bus, devfn, PCI_CAPABILITY_LIST,
-                           PCI_CAP_ID_EXP) )
-        return DEV_TYPE_PCIe_ENDPOINT;
-
-    return DEV_TYPE_PCI;
+    return pos ? DEV_TYPE_PCIe_ENDPOINT : DEV_TYPE_PCI;
 }
 
 /*

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0ig-0002g3-23; Wed, 21 Nov 2012 03:11: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 1Tb0if-0002db-1p
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:21 +0000
Received: from [85.158.139.211:42733] by server-8.bemta-5.messagelabs.com id
	6F/F0-06050-8564CA05; Wed, 21 Nov 2012 03:11:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-206.messagelabs.com!1353467478!18972396!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 602 invoked from network); 21 Nov 2012 03:11:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Nov 2012 03:11: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 1Tb0ic-0007dz-FH
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0ic-0005bg-Aw
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:18 +0000
Message-Id: <E1Tb0ic-0005bg-Aw@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xend: reinstate
	XendOptionsFile.get_external_migration_tool
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353431860 0
# Node ID 2489c29266982175b5b4e945c97b4549360e947f
# Parent  ae6fb202b233af815466055d9f1a635802a50855
xend: reinstate XendOptionsFile.get_external_migration_tool

This was removed by 26167:31dcc0e08754 "xend: Remove old vtpm support
from xm" but at least one caller was left. Reinstate with
s/TPM/device/ since it appears that this functionality could apply
elsewhere.

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


diff -r ae6fb202b233 -r 2489c2926698 tools/python/xen/xend/XendOptions.py
--- a/tools/python/xen/xend/XendOptions.py	Tue Nov 20 08:58:31 2012 +0100
+++ b/tools/python/xen/xend/XendOptions.py	Tue Nov 20 17:17:40 2012 +0000
@@ -349,6 +349,10 @@ class XendOptions:
         else:
             return None
 
+    def get_external_migration_tool(self):
+        """@return the name of the tool to handle virtual device migration."""
+        return self.get_config_string('external-migration-tool', self.external_migration_tool_default)
+
     def get_enable_dump(self):
         return self.get_config_bool('enable-dump', 'no')
 
diff -r ae6fb202b233 -r 2489c2926698 tools/python/xen/xend/tests/xend-config.sxp
--- a/tools/python/xen/xend/tests/xend-config.sxp	Tue Nov 20 08:58:31 2012 +0100
+++ b/tools/python/xen/xend/tests/xend-config.sxp	Tue Nov 20 17:17:40 2012 +0000
@@ -127,3 +127,5 @@
 # Whether to enable core-dumps when domains crash.
 #(enable-dump no)
 
+# The tool used for initiating virtual device migration
+#(external-migration-tool '')

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0ig-0002g3-23; Wed, 21 Nov 2012 03:11: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 1Tb0if-0002db-1p
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:21 +0000
Received: from [85.158.139.211:42733] by server-8.bemta-5.messagelabs.com id
	6F/F0-06050-8564CA05; Wed, 21 Nov 2012 03:11:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-206.messagelabs.com!1353467478!18972396!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 602 invoked from network); 21 Nov 2012 03:11:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Nov 2012 03:11: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 1Tb0ic-0007dz-FH
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0ic-0005bg-Aw
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:18 +0000
Message-Id: <E1Tb0ic-0005bg-Aw@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xend: reinstate
	XendOptionsFile.get_external_migration_tool
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353431860 0
# Node ID 2489c29266982175b5b4e945c97b4549360e947f
# Parent  ae6fb202b233af815466055d9f1a635802a50855
xend: reinstate XendOptionsFile.get_external_migration_tool

This was removed by 26167:31dcc0e08754 "xend: Remove old vtpm support
from xm" but at least one caller was left. Reinstate with
s/TPM/device/ since it appears that this functionality could apply
elsewhere.

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


diff -r ae6fb202b233 -r 2489c2926698 tools/python/xen/xend/XendOptions.py
--- a/tools/python/xen/xend/XendOptions.py	Tue Nov 20 08:58:31 2012 +0100
+++ b/tools/python/xen/xend/XendOptions.py	Tue Nov 20 17:17:40 2012 +0000
@@ -349,6 +349,10 @@ class XendOptions:
         else:
             return None
 
+    def get_external_migration_tool(self):
+        """@return the name of the tool to handle virtual device migration."""
+        return self.get_config_string('external-migration-tool', self.external_migration_tool_default)
+
     def get_enable_dump(self):
         return self.get_config_bool('enable-dump', 'no')
 
diff -r ae6fb202b233 -r 2489c2926698 tools/python/xen/xend/tests/xend-config.sxp
--- a/tools/python/xen/xend/tests/xend-config.sxp	Tue Nov 20 08:58:31 2012 +0100
+++ b/tools/python/xen/xend/tests/xend-config.sxp	Tue Nov 20 17:17:40 2012 +0000
@@ -127,3 +127,5 @@
 # Whether to enable core-dumps when domains crash.
 #(enable-dump no)
 
+# The tool used for initiating virtual device migration
+#(external-migration-tool '')

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0if-0002fL-Hn; Wed, 21 Nov 2012 03:11:21 +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 1Tb0id-0002X3-9T
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:19 +0000
Received: from [85.158.143.99:18309] by server-1.bemta-4.messagelabs.com id
	AD/FB-27934-6564CA05; Wed, 21 Nov 2012 03:11:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-216.messagelabs.com!1353467477!30708918!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31297 invoked from network); 21 Nov 2012 03:11:18 -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;
	21 Nov 2012 03:11: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 1Tb0ib-0007dt-BU
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0ib-0005bC-AM
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:17 +0000
Message-Id: <E1Tb0ib-0005bC-AM@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: fix build failure due to extra
	closing comment
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353355016 0
# Node ID 02b9d9a25feecd76d56143afa9bbb853fd01f602
# Parent  fe8034159ac237d6661174c7b3cff8e822e8e5e1
xen: fix build failure due to extra closing comment

Added by 26173:26facad2f1a1

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


diff -r fe8034159ac2 -r 02b9d9a25fee xen/include/public/xen.h
--- a/xen/include/public/xen.h	Mon Nov 19 14:25:35 2012 +0000
+++ b/xen/include/public/xen.h	Mon Nov 19 19:56:56 2012 +0000
@@ -445,7 +445,6 @@ DEFINE_XEN_GUEST_HANDLE(mmuext_op_t);
  * ` @val: The new page table entry, must contain a machine address
  * ` @flags: Control TLB flushes
  */
-*/
 /* These are passed as 'flags' to update_va_mapping. They can be ORed. */
 /* When specifying UVMF_MULTI, also OR in a pointer to a CPU bitmap.   */
 /* UVMF_LOCAL is merely UVMF_MULTI with a NULL bitmap pointer.         */

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

From xen-changelog-bounces@lists.xen.org Wed Nov 21 03:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Nov 2012 03: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.xen.org>)
	id 1Tb0if-0002fL-Hn; Wed, 21 Nov 2012 03:11:21 +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 1Tb0id-0002X3-9T
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:19 +0000
Received: from [85.158.143.99:18309] by server-1.bemta-4.messagelabs.com id
	AD/FB-27934-6564CA05; Wed, 21 Nov 2012 03:11:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-216.messagelabs.com!1353467477!30708918!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31297 invoked from network); 21 Nov 2012 03:11:18 -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;
	21 Nov 2012 03:11: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 1Tb0ib-0007dt-BU
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tb0ib-0005bC-AM
	for xen-changelog@lists.xensource.com; Wed, 21 Nov 2012 03:11:17 +0000
Message-Id: <E1Tb0ib-0005bC-AM@xenbits.xen.org>
Date: Wed, 21 Nov 2012 03:11:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: fix build failure due to extra
	closing comment
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353355016 0
# Node ID 02b9d9a25feecd76d56143afa9bbb853fd01f602
# Parent  fe8034159ac237d6661174c7b3cff8e822e8e5e1
xen: fix build failure due to extra closing comment

Added by 26173:26facad2f1a1

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


diff -r fe8034159ac2 -r 02b9d9a25fee xen/include/public/xen.h
--- a/xen/include/public/xen.h	Mon Nov 19 14:25:35 2012 +0000
+++ b/xen/include/public/xen.h	Mon Nov 19 19:56:56 2012 +0000
@@ -445,7 +445,6 @@ DEFINE_XEN_GUEST_HANDLE(mmuext_op_t);
  * ` @val: The new page table entry, must contain a machine address
  * ` @flags: Control TLB flushes
  */
-*/
 /* These are passed as 'flags' to update_va_mapping. They can be ORed. */
 /* When specifying UVMF_MULTI, also OR in a pointer to a CPU bitmap.   */
 /* UVMF_LOCAL is merely UVMF_MULTI with a NULL bitmap pointer.         */

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

From xen-changelog-bounces@lists.xen.org Thu Nov 22 16:55:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Nov 2012 16:55: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 1Tba3W-0000ga-05; Thu, 22 Nov 2012 16:55: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 1Tba3U-0000gM-PU
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 16:55:12 +0000
Received: from [85.158.139.211:58897] by server-11.bemta-5.messagelabs.com id
	DA/BD-03409-0F85EA05; Thu, 22 Nov 2012 16:55:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-206.messagelabs.com!1353603309!17207998!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31422 invoked from network); 22 Nov 2012 16:55:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Nov 2012 16:55: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 1Tba3Q-000772-SU
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 16:55:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tba3M-0004e8-Fy
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 16:55:08 +0000
Message-Id: <E1Tba3M-0004e8-Fy@xenbits.xen.org>
Date: Thu, 22 Nov 2012 16:55:04 +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] scsifront: more cleanup
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353602880 -3600
# Node ID 1f1b30566a42de417a2f2d1111376266e6464a51
# Parent  55dc1c7f8290fdbc33f77410ce470a636d65fc48
scsifront: more cleanup

- make scsifront_cmd_done() static
- properly annotate XenBus setup/cleanup functions

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


diff -r 55dc1c7f8290 -r 1f1b30566a42 drivers/xen/scsifront/common.h
--- a/drivers/xen/scsifront/common.h	Thu Nov 22 17:42:10 2012 +0100
+++ b/drivers/xen/scsifront/common.h	Thu Nov 22 17:48:00 2012 +0100
@@ -125,7 +125,6 @@ int scsifront_xenbus_init(void);
 void scsifront_xenbus_unregister(void);
 int scsifront_schedule(void *data);
 irqreturn_t scsifront_intr(int irq, void *dev_id, struct pt_regs *ptregs);
-int scsifront_cmd_done(struct vscsifrnt_info *info);
 
 
 #endif /* __XEN_DRIVERS_SCSIFRONT_H__  */
diff -r 55dc1c7f8290 -r 1f1b30566a42 drivers/xen/scsifront/scsifront.c
--- a/drivers/xen/scsifront/scsifront.c	Thu Nov 22 17:42:10 2012 +0100
+++ b/drivers/xen/scsifront/scsifront.c	Thu Nov 22 17:48:00 2012 +0100
@@ -176,7 +176,7 @@ static void scsifront_sync_cmd_done(stru
 }
 
 
-int scsifront_cmd_done(struct vscsifrnt_info *info)
+static int scsifront_cmd_done(struct vscsifrnt_info *info)
 {
 	vscsiif_response_t *ring_res;
 
diff -r 55dc1c7f8290 -r 1f1b30566a42 drivers/xen/scsifront/xenbus.c
--- a/drivers/xen/scsifront/xenbus.c	Thu Nov 22 17:42:10 2012 +0100
+++ b/drivers/xen/scsifront/xenbus.c	Thu Nov 22 17:48:00 2012 +0100
@@ -411,12 +411,12 @@ static DEFINE_XENBUS_DRIVER(scsifront, ,
 	.otherend_changed	= scsifront_backend_changed,
 );
 
-int scsifront_xenbus_init(void)
+int __init scsifront_xenbus_init(void)
 {
 	return xenbus_register_frontend(&scsifront_driver);
 }
 
-void scsifront_xenbus_unregister(void)
+void __exit scsifront_xenbus_unregister(void)
 {
 	xenbus_unregister_driver(&scsifront_driver);
 }

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

From xen-changelog-bounces@lists.xen.org Thu Nov 22 16:55:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Nov 2012 16:55: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 1Tba3W-0000ga-05; Thu, 22 Nov 2012 16:55: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 1Tba3U-0000gM-PU
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 16:55:12 +0000
Received: from [85.158.139.211:58897] by server-11.bemta-5.messagelabs.com id
	DA/BD-03409-0F85EA05; Thu, 22 Nov 2012 16:55:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-206.messagelabs.com!1353603309!17207998!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31422 invoked from network); 22 Nov 2012 16:55:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Nov 2012 16:55: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 1Tba3Q-000772-SU
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 16:55:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tba3M-0004e8-Fy
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 16:55:08 +0000
Message-Id: <E1Tba3M-0004e8-Fy@xenbits.xen.org>
Date: Thu, 22 Nov 2012 16:55:04 +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] scsifront: more cleanup
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353602880 -3600
# Node ID 1f1b30566a42de417a2f2d1111376266e6464a51
# Parent  55dc1c7f8290fdbc33f77410ce470a636d65fc48
scsifront: more cleanup

- make scsifront_cmd_done() static
- properly annotate XenBus setup/cleanup functions

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


diff -r 55dc1c7f8290 -r 1f1b30566a42 drivers/xen/scsifront/common.h
--- a/drivers/xen/scsifront/common.h	Thu Nov 22 17:42:10 2012 +0100
+++ b/drivers/xen/scsifront/common.h	Thu Nov 22 17:48:00 2012 +0100
@@ -125,7 +125,6 @@ int scsifront_xenbus_init(void);
 void scsifront_xenbus_unregister(void);
 int scsifront_schedule(void *data);
 irqreturn_t scsifront_intr(int irq, void *dev_id, struct pt_regs *ptregs);
-int scsifront_cmd_done(struct vscsifrnt_info *info);
 
 
 #endif /* __XEN_DRIVERS_SCSIFRONT_H__  */
diff -r 55dc1c7f8290 -r 1f1b30566a42 drivers/xen/scsifront/scsifront.c
--- a/drivers/xen/scsifront/scsifront.c	Thu Nov 22 17:42:10 2012 +0100
+++ b/drivers/xen/scsifront/scsifront.c	Thu Nov 22 17:48:00 2012 +0100
@@ -176,7 +176,7 @@ static void scsifront_sync_cmd_done(stru
 }
 
 
-int scsifront_cmd_done(struct vscsifrnt_info *info)
+static int scsifront_cmd_done(struct vscsifrnt_info *info)
 {
 	vscsiif_response_t *ring_res;
 
diff -r 55dc1c7f8290 -r 1f1b30566a42 drivers/xen/scsifront/xenbus.c
--- a/drivers/xen/scsifront/xenbus.c	Thu Nov 22 17:42:10 2012 +0100
+++ b/drivers/xen/scsifront/xenbus.c	Thu Nov 22 17:48:00 2012 +0100
@@ -411,12 +411,12 @@ static DEFINE_XENBUS_DRIVER(scsifront, ,
 	.otherend_changed	= scsifront_backend_changed,
 );
 
-int scsifront_xenbus_init(void)
+int __init scsifront_xenbus_init(void)
 {
 	return xenbus_register_frontend(&scsifront_driver);
 }
 
-void scsifront_xenbus_unregister(void)
+void __exit scsifront_xenbus_unregister(void)
 {
 	xenbus_unregister_driver(&scsifront_driver);
 }

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

From xen-changelog-bounces@lists.xen.org Thu Nov 22 16:55:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Nov 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.xen.org>)
	id 1Tba3V-0000gV-Th; Thu, 22 Nov 2012 16:55:13 +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 1Tba3U-0000gL-E4
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 16:55:12 +0000
Received: from [85.158.137.99:33167] by server-4.bemta-3.messagelabs.com id
	06/71-30023-FE85EA05; Thu, 22 Nov 2012 16:55:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-217.messagelabs.com!1353603305!15469634!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27967 invoked from network); 22 Nov 2012 16:55:06 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Nov 2012 16:55: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 1Tba3M-00076z-Me
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 16:55:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tba3M-0004dt-0G
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 16:55:04 +0000
Message-Id: <E1Tba3M-0004dt-0G@xenbits.xen.org>
Date: Thu, 22 Nov 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] scsifront: fix address arithmetic
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353602530 -3600
# Node ID 55dc1c7f8290fdbc33f77410ce470a636d65fc48
# Parent  f09889eaf6527f4ea0cc922e7d02da3bb7f919b5
scsifront: fix address arithmetic

Incrementing the result of page_to_phys() is not the same as invoking
it on the incremented page pointer.

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


diff -r f09889eaf652 -r 55dc1c7f8290 drivers/xen/scsifront/scsifront.c
--- a/drivers/xen/scsifront/scsifront.c	Wed Nov 14 12:10:04 2012 +0100
+++ b/drivers/xen/scsifront/scsifront.c	Thu Nov 22 17:42:10 2012 +0100
@@ -247,7 +247,6 @@ static int map_data_for_request(struct v
 	int err, i, ref, ref_cnt = 0;
 	int write = (sc->sc_data_direction == DMA_TO_DEVICE);
 	int nr_pages, off, len, bytes;
-	unsigned long buffer_pfn;
 	unsigned int data_len = 0;
 
 	if (sc->sc_data_direction == DMA_NONE || !sc->request_bufflen)
@@ -276,8 +275,6 @@ static int map_data_for_request(struct v
 			len = sg[i].length;
 			data_len += len;
 
-			buffer_pfn = page_to_phys(page) >> PAGE_SHIFT;
-
 			while (len > 0) {
 				bytes = min_t(unsigned int, len, PAGE_SIZE - off);
 				
@@ -285,14 +282,14 @@ static int map_data_for_request(struct v
 				BUG_ON(ref == -ENOSPC);
 
 				gnttab_grant_foreign_access_ref(ref, info->dev->otherend_id,
-					buffer_pfn, write);
+					page_to_phys(page) >> PAGE_SHIFT, write);
 
 				info->shadow[id].gref[ref_cnt]  = ref;
 				ring_req->seg[ref_cnt].gref     = ref;
 				ring_req->seg[ref_cnt].offset   = (uint16_t)off;
 				ring_req->seg[ref_cnt].length   = (uint16_t)bytes;
 
-				buffer_pfn++;
+				page++;
 				len -= bytes;
 				off = 0;
 				ref_cnt++;
@@ -312,8 +309,6 @@ static int map_data_for_request(struct v
 			goto big_to_sg;
 		}
 
-		buffer_pfn = page_to_phys(page) >> PAGE_SHIFT;
-
 		off = offset_in_page((unsigned long)sc->request_buffer);
 		for (i = 0; i < nr_pages; i++) {
 			bytes = PAGE_SIZE - off;
@@ -325,14 +320,14 @@ static int map_data_for_request(struct v
 			BUG_ON(ref == -ENOSPC);
 
 			gnttab_grant_foreign_access_ref(ref, info->dev->otherend_id,
-				buffer_pfn, write);
+				page_to_phys(page) >> PAGE_SHIFT, write);
 
 			info->shadow[id].gref[i] = ref;
 			ring_req->seg[i].gref     = ref;
 			ring_req->seg[i].offset   = (uint16_t)off;
 			ring_req->seg[i].length   = (uint16_t)bytes;
 
-			buffer_pfn++;
+			page++;
 			len -= bytes;
 			off = 0;
 			ref_cnt++;

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

From xen-changelog-bounces@lists.xen.org Thu Nov 22 16:55:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Nov 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.xen.org>)
	id 1Tba3V-0000gV-Th; Thu, 22 Nov 2012 16:55:13 +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 1Tba3U-0000gL-E4
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 16:55:12 +0000
Received: from [85.158.137.99:33167] by server-4.bemta-3.messagelabs.com id
	06/71-30023-FE85EA05; Thu, 22 Nov 2012 16:55:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-217.messagelabs.com!1353603305!15469634!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27967 invoked from network); 22 Nov 2012 16:55:06 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Nov 2012 16:55: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 1Tba3M-00076z-Me
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 16:55:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tba3M-0004dt-0G
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 16:55:04 +0000
Message-Id: <E1Tba3M-0004dt-0G@xenbits.xen.org>
Date: Thu, 22 Nov 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] scsifront: fix address arithmetic
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353602530 -3600
# Node ID 55dc1c7f8290fdbc33f77410ce470a636d65fc48
# Parent  f09889eaf6527f4ea0cc922e7d02da3bb7f919b5
scsifront: fix address arithmetic

Incrementing the result of page_to_phys() is not the same as invoking
it on the incremented page pointer.

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


diff -r f09889eaf652 -r 55dc1c7f8290 drivers/xen/scsifront/scsifront.c
--- a/drivers/xen/scsifront/scsifront.c	Wed Nov 14 12:10:04 2012 +0100
+++ b/drivers/xen/scsifront/scsifront.c	Thu Nov 22 17:42:10 2012 +0100
@@ -247,7 +247,6 @@ static int map_data_for_request(struct v
 	int err, i, ref, ref_cnt = 0;
 	int write = (sc->sc_data_direction == DMA_TO_DEVICE);
 	int nr_pages, off, len, bytes;
-	unsigned long buffer_pfn;
 	unsigned int data_len = 0;
 
 	if (sc->sc_data_direction == DMA_NONE || !sc->request_bufflen)
@@ -276,8 +275,6 @@ static int map_data_for_request(struct v
 			len = sg[i].length;
 			data_len += len;
 
-			buffer_pfn = page_to_phys(page) >> PAGE_SHIFT;
-
 			while (len > 0) {
 				bytes = min_t(unsigned int, len, PAGE_SIZE - off);
 				
@@ -285,14 +282,14 @@ static int map_data_for_request(struct v
 				BUG_ON(ref == -ENOSPC);
 
 				gnttab_grant_foreign_access_ref(ref, info->dev->otherend_id,
-					buffer_pfn, write);
+					page_to_phys(page) >> PAGE_SHIFT, write);
 
 				info->shadow[id].gref[ref_cnt]  = ref;
 				ring_req->seg[ref_cnt].gref     = ref;
 				ring_req->seg[ref_cnt].offset   = (uint16_t)off;
 				ring_req->seg[ref_cnt].length   = (uint16_t)bytes;
 
-				buffer_pfn++;
+				page++;
 				len -= bytes;
 				off = 0;
 				ref_cnt++;
@@ -312,8 +309,6 @@ static int map_data_for_request(struct v
 			goto big_to_sg;
 		}
 
-		buffer_pfn = page_to_phys(page) >> PAGE_SHIFT;
-
 		off = offset_in_page((unsigned long)sc->request_buffer);
 		for (i = 0; i < nr_pages; i++) {
 			bytes = PAGE_SIZE - off;
@@ -325,14 +320,14 @@ static int map_data_for_request(struct v
 			BUG_ON(ref == -ENOSPC);
 
 			gnttab_grant_foreign_access_ref(ref, info->dev->otherend_id,
-				buffer_pfn, write);
+				page_to_phys(page) >> PAGE_SHIFT, write);
 
 			info->shadow[id].gref[i] = ref;
 			ring_req->seg[i].gref     = ref;
 			ring_req->seg[i].offset   = (uint16_t)off;
 			ring_req->seg[i].length   = (uint16_t)bytes;
 
-			buffer_pfn++;
+			page++;
 			len -= bytes;
 			off = 0;
 			ref_cnt++;

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

From xen-changelog-bounces@lists.xen.org Thu Nov 22 20:11:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Nov 2012 20:11: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 1Tbd7B-0006oI-C9; Thu, 22 Nov 2012 20:11:13 +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 1Tbd7A-0006nu-Dz
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:12 +0000
Received: from [85.158.137.99:3245] by server-12.bemta-3.messagelabs.com id
	3E/0F-22757-FD68EA05; Thu, 22 Nov 2012 20:11:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-217.messagelabs.com!1353615069!15486941!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31871 invoked from network); 22 Nov 2012 20:11:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Nov 2012 20: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 1Tbd77-0000r6-8Z
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tbd77-0001Dj-17
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:09 +0000
Message-Id: <E1Tbd77-0001Dj-17@xenbits.xen.org>
Date: Thu, 22 Nov 2012 20:11:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/HPET: fix FSB interrupt masking
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353575003 -3600
# Node ID c139ca92edca2fab8ec95deb7fd9e4246c3fe28d
# Parent  af6b72a224e99a4a516fbc2eecc06ada569304e8
x86/HPET: fix FSB interrupt masking

HPET_TN_FSB is not really suitable for masking interrupts - it merely
switches between the two delivery methods. The right way of masking is
through the HPET_TN_ENABLE bit (which really is an interrupt enable,
not a counter enable or some such). This is even more so with certain
chip sets not even allowing HPET_TN_FSB to be cleared on some of the
channels.

Further, all the setup of the channel should happen before actually
enabling the interrupt, which requires splitting legacy and FSB logic.

Finally this also fixes an S3 resume problem (HPET_TN_FSB did not get
set in hpet_broadcast_resume(), and hpet_msi_unmask() doesn't get
called from the general resume code either afaict).

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


diff -r af6b72a224e9 -r c139ca92edca xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Thu Nov 22 10:02:18 2012 +0100
+++ b/xen/arch/x86/hpet.c	Thu Nov 22 10:03:23 2012 +0100
@@ -237,7 +237,7 @@ static void hpet_msi_unmask(struct irq_d
     struct hpet_event_channel *ch = desc->action->dev_id;
 
     cfg = hpet_read32(HPET_Tn_CFG(ch->idx));
-    cfg |= HPET_TN_FSB;
+    cfg |= HPET_TN_ENABLE;
     hpet_write32(cfg, HPET_Tn_CFG(ch->idx));
     ch->msi.msi_attrib.masked = 0;
 }
@@ -248,7 +248,7 @@ static void hpet_msi_mask(struct irq_des
     struct hpet_event_channel *ch = desc->action->dev_id;
 
     cfg = hpet_read32(HPET_Tn_CFG(ch->idx));
-    cfg &= ~HPET_TN_FSB;
+    cfg &= ~HPET_TN_ENABLE;
     hpet_write32(cfg, HPET_Tn_CFG(ch->idx));
     ch->msi.msi_attrib.masked = 1;
 }
@@ -328,6 +328,7 @@ static void __hpet_setup_msi_irq(struct 
 static int __init hpet_setup_msi_irq(struct hpet_event_channel *ch)
 {
     int ret;
+    u32 cfg = hpet_read32(HPET_Tn_CFG(ch->idx));
     irq_desc_t *desc = irq_to_desc(ch->msi.irq);
 
     if ( iommu_intremap )
@@ -338,6 +339,11 @@ static int __init hpet_setup_msi_irq(str
             return ret;
     }
 
+    /* set HPET Tn as oneshot */
+    cfg &= ~(HPET_TN_LEVEL | HPET_TN_PERIODIC);
+    cfg |= HPET_TN_FSB | HPET_TN_32BIT;
+    hpet_write32(cfg, HPET_Tn_CFG(ch->idx));
+
     desc->handler = &hpet_msi_type;
     ret = request_irq(ch->msi.irq, hpet_interrupt_handler, 0, "HPET", ch);
     if ( ret < 0 )
@@ -393,17 +399,6 @@ static void __init hpet_fsb_cap_lookup(v
         if ( !(cfg & HPET_TN_FSB_CAP) )
             continue;
 
-        /* hpet_setup(), via hpet_resume(), attempted to clear HPET_TN_FSB, so
-         * if it is still set... */
-        if ( !(cfg & HPET_TN_FSB) )
-            ch->msi.msi_attrib.maskbit = 1;
-        else
-        {
-            ch->msi.msi_attrib.maskbit = 0;
-            printk(XENLOG_WARNING "HPET: channel %u is not maskable (%04x)\n",
-                   i, cfg);
-        }
-
         if ( !zalloc_cpumask_var(&ch->cpumask) )
         {
             if ( !num_hpets_used )
@@ -570,11 +565,14 @@ void __init hpet_broadcast_init(void)
 
     for ( i = 0; i < n; i++ )
     {
-        /* set HPET Tn as oneshot */
-        cfg = hpet_read32(HPET_Tn_CFG(hpet_events[i].idx));
-        cfg &= ~(HPET_TN_LEVEL | HPET_TN_PERIODIC);
-        cfg |= HPET_TN_ENABLE | HPET_TN_32BIT;
-        hpet_write32(cfg, HPET_Tn_CFG(hpet_events[i].idx));
+        if ( i == 0 && (cfg & HPET_CFG_LEGACY) )
+        {
+            /* set HPET T0 as oneshot */
+            cfg = hpet_read32(HPET_Tn_CFG(0));
+            cfg &= ~(HPET_TN_LEVEL | HPET_TN_PERIODIC);
+            cfg |= HPET_TN_ENABLE | HPET_TN_32BIT;
+            hpet_write32(cfg, HPET_Tn_CFG(0));
+        }
 
         /*
          * The period is a femto seconds value. We need to calculate the scaled
@@ -588,6 +586,7 @@ void __init hpet_broadcast_init(void)
         wmb();
         hpet_events[i].event_handler = handle_hpet_broadcast;
 
+        hpet_events[i].msi.msi_attrib.maskbit = 1;
         hpet_events[i].msi.msi_attrib.pos = MSI_TYPE_HPET;
     }
 
@@ -633,6 +632,8 @@ void hpet_broadcast_resume(void)
         cfg = hpet_read32(HPET_Tn_CFG(hpet_events[i].idx));
         cfg &= ~(HPET_TN_LEVEL | HPET_TN_PERIODIC);
         cfg |= HPET_TN_ENABLE | HPET_TN_32BIT;
+        if ( !(hpet_events[i].flags & HPET_EVT_LEGACY) )
+            cfg |= HPET_TN_FSB;
         hpet_write32(cfg, HPET_Tn_CFG(hpet_events[i].idx));
 
         hpet_events[i].next_event = STIME_MAX;
@@ -811,10 +812,7 @@ void hpet_resume(u32 *boot_cfg)
     {
         cfg = hpet_read32(HPET_Tn_CFG(i));
         if ( boot_cfg )
-        {
             boot_cfg[i + 1] = cfg;
-            cfg &= ~HPET_TN_FSB;
-        }
         cfg &= ~HPET_TN_ENABLE;
         if ( cfg & HPET_TN_RESERVED )
         {

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

From xen-changelog-bounces@lists.xen.org Thu Nov 22 20:11:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Nov 2012 20:11: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 1Tbd7B-0006oI-C9; Thu, 22 Nov 2012 20:11:13 +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 1Tbd7A-0006nu-Dz
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:12 +0000
Received: from [85.158.137.99:3245] by server-12.bemta-3.messagelabs.com id
	3E/0F-22757-FD68EA05; Thu, 22 Nov 2012 20:11:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-217.messagelabs.com!1353615069!15486941!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31871 invoked from network); 22 Nov 2012 20:11:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Nov 2012 20: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 1Tbd77-0000r6-8Z
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tbd77-0001Dj-17
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:09 +0000
Message-Id: <E1Tbd77-0001Dj-17@xenbits.xen.org>
Date: Thu, 22 Nov 2012 20:11:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/HPET: fix FSB interrupt masking
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353575003 -3600
# Node ID c139ca92edca2fab8ec95deb7fd9e4246c3fe28d
# Parent  af6b72a224e99a4a516fbc2eecc06ada569304e8
x86/HPET: fix FSB interrupt masking

HPET_TN_FSB is not really suitable for masking interrupts - it merely
switches between the two delivery methods. The right way of masking is
through the HPET_TN_ENABLE bit (which really is an interrupt enable,
not a counter enable or some such). This is even more so with certain
chip sets not even allowing HPET_TN_FSB to be cleared on some of the
channels.

Further, all the setup of the channel should happen before actually
enabling the interrupt, which requires splitting legacy and FSB logic.

Finally this also fixes an S3 resume problem (HPET_TN_FSB did not get
set in hpet_broadcast_resume(), and hpet_msi_unmask() doesn't get
called from the general resume code either afaict).

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


diff -r af6b72a224e9 -r c139ca92edca xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Thu Nov 22 10:02:18 2012 +0100
+++ b/xen/arch/x86/hpet.c	Thu Nov 22 10:03:23 2012 +0100
@@ -237,7 +237,7 @@ static void hpet_msi_unmask(struct irq_d
     struct hpet_event_channel *ch = desc->action->dev_id;
 
     cfg = hpet_read32(HPET_Tn_CFG(ch->idx));
-    cfg |= HPET_TN_FSB;
+    cfg |= HPET_TN_ENABLE;
     hpet_write32(cfg, HPET_Tn_CFG(ch->idx));
     ch->msi.msi_attrib.masked = 0;
 }
@@ -248,7 +248,7 @@ static void hpet_msi_mask(struct irq_des
     struct hpet_event_channel *ch = desc->action->dev_id;
 
     cfg = hpet_read32(HPET_Tn_CFG(ch->idx));
-    cfg &= ~HPET_TN_FSB;
+    cfg &= ~HPET_TN_ENABLE;
     hpet_write32(cfg, HPET_Tn_CFG(ch->idx));
     ch->msi.msi_attrib.masked = 1;
 }
@@ -328,6 +328,7 @@ static void __hpet_setup_msi_irq(struct 
 static int __init hpet_setup_msi_irq(struct hpet_event_channel *ch)
 {
     int ret;
+    u32 cfg = hpet_read32(HPET_Tn_CFG(ch->idx));
     irq_desc_t *desc = irq_to_desc(ch->msi.irq);
 
     if ( iommu_intremap )
@@ -338,6 +339,11 @@ static int __init hpet_setup_msi_irq(str
             return ret;
     }
 
+    /* set HPET Tn as oneshot */
+    cfg &= ~(HPET_TN_LEVEL | HPET_TN_PERIODIC);
+    cfg |= HPET_TN_FSB | HPET_TN_32BIT;
+    hpet_write32(cfg, HPET_Tn_CFG(ch->idx));
+
     desc->handler = &hpet_msi_type;
     ret = request_irq(ch->msi.irq, hpet_interrupt_handler, 0, "HPET", ch);
     if ( ret < 0 )
@@ -393,17 +399,6 @@ static void __init hpet_fsb_cap_lookup(v
         if ( !(cfg & HPET_TN_FSB_CAP) )
             continue;
 
-        /* hpet_setup(), via hpet_resume(), attempted to clear HPET_TN_FSB, so
-         * if it is still set... */
-        if ( !(cfg & HPET_TN_FSB) )
-            ch->msi.msi_attrib.maskbit = 1;
-        else
-        {
-            ch->msi.msi_attrib.maskbit = 0;
-            printk(XENLOG_WARNING "HPET: channel %u is not maskable (%04x)\n",
-                   i, cfg);
-        }
-
         if ( !zalloc_cpumask_var(&ch->cpumask) )
         {
             if ( !num_hpets_used )
@@ -570,11 +565,14 @@ void __init hpet_broadcast_init(void)
 
     for ( i = 0; i < n; i++ )
     {
-        /* set HPET Tn as oneshot */
-        cfg = hpet_read32(HPET_Tn_CFG(hpet_events[i].idx));
-        cfg &= ~(HPET_TN_LEVEL | HPET_TN_PERIODIC);
-        cfg |= HPET_TN_ENABLE | HPET_TN_32BIT;
-        hpet_write32(cfg, HPET_Tn_CFG(hpet_events[i].idx));
+        if ( i == 0 && (cfg & HPET_CFG_LEGACY) )
+        {
+            /* set HPET T0 as oneshot */
+            cfg = hpet_read32(HPET_Tn_CFG(0));
+            cfg &= ~(HPET_TN_LEVEL | HPET_TN_PERIODIC);
+            cfg |= HPET_TN_ENABLE | HPET_TN_32BIT;
+            hpet_write32(cfg, HPET_Tn_CFG(0));
+        }
 
         /*
          * The period is a femto seconds value. We need to calculate the scaled
@@ -588,6 +586,7 @@ void __init hpet_broadcast_init(void)
         wmb();
         hpet_events[i].event_handler = handle_hpet_broadcast;
 
+        hpet_events[i].msi.msi_attrib.maskbit = 1;
         hpet_events[i].msi.msi_attrib.pos = MSI_TYPE_HPET;
     }
 
@@ -633,6 +632,8 @@ void hpet_broadcast_resume(void)
         cfg = hpet_read32(HPET_Tn_CFG(hpet_events[i].idx));
         cfg &= ~(HPET_TN_LEVEL | HPET_TN_PERIODIC);
         cfg |= HPET_TN_ENABLE | HPET_TN_32BIT;
+        if ( !(hpet_events[i].flags & HPET_EVT_LEGACY) )
+            cfg |= HPET_TN_FSB;
         hpet_write32(cfg, HPET_Tn_CFG(hpet_events[i].idx));
 
         hpet_events[i].next_event = STIME_MAX;
@@ -811,10 +812,7 @@ void hpet_resume(u32 *boot_cfg)
     {
         cfg = hpet_read32(HPET_Tn_CFG(i));
         if ( boot_cfg )
-        {
             boot_cfg[i + 1] = cfg;
-            cfg &= ~HPET_TN_FSB;
-        }
         cfg &= ~HPET_TN_ENABLE;
         if ( cfg & HPET_TN_RESERVED )
         {

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

From xen-changelog-bounces@lists.xen.org Thu Nov 22 20:11:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Nov 2012 20:11: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 1Tbd7B-0006oD-9m; Thu, 22 Nov 2012 20:11:13 +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 1Tbd7A-0006np-5G
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:12 +0000
Received: from [85.158.139.211:22492] by server-5.bemta-5.messagelabs.com id
	A5/25-11353-FD68EA05; Thu, 22 Nov 2012 20:11:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-206.messagelabs.com!1353615069!21244539!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23270 invoked from network); 22 Nov 2012 20:11:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Nov 2012 20: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 1Tbd76-0000r3-RM
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tbd76-0001DU-CQ
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:08 +0000
Message-Id: <E1Tbd76-0001DU-CQ@xenbits.xen.org>
Date: Thu, 22 Nov 2012 20:11:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/HPET: include FSB interrupt
	information in 'M' debug key 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: "Change log for Mercurial \(receive only\)"
	<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 1353574938 -3600
# Node ID af6b72a224e99a4a516fbc2eecc06ada569304e8
# Parent  f004f611bf538e993be1a32fbe2b45ce903e1875
x86/HPET: include FSB interrupt information in 'M' debug key output

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


diff -r f004f611bf53 -r af6b72a224e9 xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Thu Nov 22 09:59:50 2012 +0100
+++ b/xen/arch/x86/hpet.c	Thu Nov 22 10:02:18 2012 +0100
@@ -239,6 +239,7 @@ static void hpet_msi_unmask(struct irq_d
     cfg = hpet_read32(HPET_Tn_CFG(ch->idx));
     cfg |= HPET_TN_FSB;
     hpet_write32(cfg, HPET_Tn_CFG(ch->idx));
+    ch->msi.msi_attrib.masked = 0;
 }
 
 static void hpet_msi_mask(struct irq_desc *desc)
@@ -249,6 +250,7 @@ static void hpet_msi_mask(struct irq_des
     cfg = hpet_read32(HPET_Tn_CFG(ch->idx));
     cfg &= ~HPET_TN_FSB;
     hpet_write32(cfg, HPET_Tn_CFG(ch->idx));
+    ch->msi.msi_attrib.masked = 1;
 }
 
 static void hpet_msi_write(struct hpet_event_channel *ch, struct msi_msg *msg)
@@ -346,6 +348,7 @@ static int __init hpet_setup_msi_irq(str
     }
 
     __hpet_setup_msi_irq(desc);
+    desc->msi_desc = &ch->msi;
 
     return 0;
 }
@@ -390,6 +393,17 @@ static void __init hpet_fsb_cap_lookup(v
         if ( !(cfg & HPET_TN_FSB_CAP) )
             continue;
 
+        /* hpet_setup(), via hpet_resume(), attempted to clear HPET_TN_FSB, so
+         * if it is still set... */
+        if ( !(cfg & HPET_TN_FSB) )
+            ch->msi.msi_attrib.maskbit = 1;
+        else
+        {
+            ch->msi.msi_attrib.maskbit = 0;
+            printk(XENLOG_WARNING "HPET: channel %u is not maskable (%04x)\n",
+                   i, cfg);
+        }
+
         if ( !zalloc_cpumask_var(&ch->cpumask) )
         {
             if ( !num_hpets_used )
@@ -573,6 +587,8 @@ void __init hpet_broadcast_init(void)
         spin_lock_init(&hpet_events[i].lock);
         wmb();
         hpet_events[i].event_handler = handle_hpet_broadcast;
+
+        hpet_events[i].msi.msi_attrib.pos = MSI_TYPE_HPET;
     }
 
     if ( !num_hpets_used )
@@ -795,7 +811,10 @@ void hpet_resume(u32 *boot_cfg)
     {
         cfg = hpet_read32(HPET_Tn_CFG(i));
         if ( boot_cfg )
+        {
             boot_cfg[i + 1] = cfg;
+            cfg &= ~HPET_TN_FSB;
+        }
         cfg &= ~HPET_TN_ENABLE;
         if ( cfg & HPET_TN_RESERVED )
         {
diff -r f004f611bf53 -r af6b72a224e9 xen/arch/x86/msi.c
--- a/xen/arch/x86/msi.c	Thu Nov 22 09:59:50 2012 +0100
+++ b/xen/arch/x86/msi.c	Thu Nov 22 10:02:18 2012 +0100
@@ -1119,17 +1119,17 @@ static void dump_msi(unsigned char key)
 {
     unsigned int irq;
 
-    printk("PCI-MSI interrupt information:\n");
+    printk("MSI information:\n");
 
     for ( irq = 0; irq < nr_irqs; irq++ )
     {
         struct irq_desc *desc = irq_to_desc(irq);
         const struct msi_desc *entry;
         u32 addr, data, dest32;
-        int mask;
+        char mask;
         struct msi_attrib attr;
         unsigned long flags;
-        char type;
+        const char *type = "???";
 
         if ( !irq_desc_initialized(desc) )
             continue;
@@ -1145,21 +1145,30 @@ static void dump_msi(unsigned char key)
 
         switch ( entry->msi_attrib.type )
         {
-        case PCI_CAP_ID_MSI: type = ' '; break;
-        case PCI_CAP_ID_MSIX: type = 'X'; break;
-        default: type = '?'; break;
+        case PCI_CAP_ID_MSI: type = "MSI"; break;
+        case PCI_CAP_ID_MSIX: type = "MSI-X"; break;
+        case 0:
+            switch ( entry->msi_attrib.pos )
+            {
+            case MSI_TYPE_HPET: type = "HPET"; break;
+            case MSI_TYPE_IOMMU: type = "IOMMU"; break;
+            }
+            break;
         }
 
         data = entry->msg.data;
         addr = entry->msg.address_lo;
         dest32 = entry->msg.dest32;
         attr = entry->msi_attrib;
-        mask = msi_get_mask_bit(entry);
+        if ( entry->msi_attrib.type )
+            mask = msi_get_mask_bit(entry) ? '1' : '0';
+        else
+            mask = '?';
 
         spin_unlock_irqrestore(&desc->lock, flags);
 
-        printk(" MSI%c %4u vec=%02x%7s%6s%3sassert%5s%7s"
-               " dest=%08x mask=%d/%d/%d\n",
+        printk(" %-6s%4u vec=%02x%7s%6s%3sassert%5s%7s"
+               " dest=%08x mask=%d/%d/%c\n",
                type, irq,
                (data & MSI_DATA_VECTOR_MASK) >> MSI_DATA_VECTOR_SHIFT,
                data & MSI_DATA_DELIVERY_LOWPRI ? "lowest" : "fixed",
diff -r f004f611bf53 -r af6b72a224e9 xen/include/asm-x86/msi.h
--- a/xen/include/asm-x86/msi.h	Thu Nov 22 09:59:50 2012 +0100
+++ b/xen/include/asm-x86/msi.h	Thu Nov 22 10:02:18 2012 +0100
@@ -109,6 +109,14 @@ struct msi_desc {
 	int remap_index;		/* index in interrupt remapping table */
 };
 
+/*
+ * Values stored into msi_desc.msi_attrib.pos for non-PCI devices
+ * (msi_desc.msi_attrib.type is zero):
+ */
+#define MSI_TYPE_UNKNOWN 0
+#define MSI_TYPE_HPET    1
+#define MSI_TYPE_IOMMU   2
+
 int msi_maskable_irq(const struct msi_desc *);
 int msi_free_irq(struct msi_desc *entry);
 

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

From xen-changelog-bounces@lists.xen.org Thu Nov 22 20:11:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Nov 2012 20:11: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 1Tbd7A-0006nv-70; Thu, 22 Nov 2012 20:11:12 +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 1Tbd79-0006no-Ai
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:11 +0000
Received: from [85.158.137.99:3225] by server-13.bemta-3.messagelabs.com id
	BF/0E-24887-ED68EA05; Thu, 22 Nov 2012 20:11:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-217.messagelabs.com!1353615068!13394584!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7873 invoked from network); 22 Nov 2012 20:11:09 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Nov 2012 20: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 1Tbd76-0000r0-EI
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tbd75-0001DF-R8
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:07 +0000
Message-Id: <E1Tbd75-0001DF-R8@xenbits.xen.org>
Date: Thu, 22 Nov 2012 20:11:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] VT-d: clean up map/unmap log messages
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353574790 -3600
# Node ID f004f611bf538e993be1a32fbe2b45ce903e1875
# Parent  2489c29266982175b5b4e945c97b4549360e947f
VT-d: clean up map/unmap log messages

- printing file name and line number here is pointless
- they are guest related, so should get their log level filter
  accordingly
- include segment numbers and canonicalize number widths

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


diff -r 2489c2926698 -r f004f611bf53 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Tue Nov 20 17:17:40 2012 +0000
+++ b/xen/drivers/passthrough/vtd/iommu.c	Thu Nov 22 09:59:50 2012 +0100
@@ -1289,11 +1289,11 @@ int domain_context_mapping_one(
         {
             if ( pdev->domain != domain )
             {
-                dprintk(XENLOG_INFO VTDPREFIX, "d%d: bdf = %x:%x.%x owned by d%d!",
-                        domain->domain_id, 
-                        bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
-                        (pdev->domain)
-                        ? pdev->domain->domain_id : -1);
+                printk(XENLOG_G_INFO VTDPREFIX
+                       "d%d: %04x:%02x:%02x.%u owned by d%d!",
+                       domain->domain_id,
+                       seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                       pdev->domain ? pdev->domain->domain_id : -1);
                 res = -EINVAL;
             }
         }
@@ -1304,17 +1304,19 @@ int domain_context_mapping_one(
             
             if ( cdomain < 0 )
             {
-                dprintk(VTDPREFIX, "d%d: bdf = %x:%x.%x mapped, but can't find owner!\n",
-                        domain->domain_id, 
-                        bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+                printk(XENLOG_G_WARNING VTDPREFIX
+                       "d%d: %04x:%02x:%02x.%u mapped, but can't find owner!\n",
+                       domain->domain_id,
+                       seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
                 res = -EINVAL;
             }
             else if ( cdomain != domain->domain_id )
             {
-                dprintk(XENLOG_INFO VTDPREFIX, "d%d: bdf = %x:%x.%x already mapped to d%d!",
-                        domain->domain_id, 
-                        bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
-                        cdomain);
+                printk(XENLOG_G_INFO VTDPREFIX
+                       "d%d: %04x:%02x:%02x.%u already mapped to d%d!",
+                       domain->domain_id,
+                       seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                       cdomain);
                 res = -EINVAL;
             }
         }

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

From xen-changelog-bounces@lists.xen.org Thu Nov 22 20:11:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Nov 2012 20:11: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 1Tbd7B-0006oD-9m; Thu, 22 Nov 2012 20:11:13 +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 1Tbd7A-0006np-5G
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:12 +0000
Received: from [85.158.139.211:22492] by server-5.bemta-5.messagelabs.com id
	A5/25-11353-FD68EA05; Thu, 22 Nov 2012 20:11:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-206.messagelabs.com!1353615069!21244539!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23270 invoked from network); 22 Nov 2012 20:11:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Nov 2012 20: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 1Tbd76-0000r3-RM
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tbd76-0001DU-CQ
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:08 +0000
Message-Id: <E1Tbd76-0001DU-CQ@xenbits.xen.org>
Date: Thu, 22 Nov 2012 20:11:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/HPET: include FSB interrupt
	information in 'M' debug key 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: "Change log for Mercurial \(receive only\)"
	<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 1353574938 -3600
# Node ID af6b72a224e99a4a516fbc2eecc06ada569304e8
# Parent  f004f611bf538e993be1a32fbe2b45ce903e1875
x86/HPET: include FSB interrupt information in 'M' debug key output

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


diff -r f004f611bf53 -r af6b72a224e9 xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Thu Nov 22 09:59:50 2012 +0100
+++ b/xen/arch/x86/hpet.c	Thu Nov 22 10:02:18 2012 +0100
@@ -239,6 +239,7 @@ static void hpet_msi_unmask(struct irq_d
     cfg = hpet_read32(HPET_Tn_CFG(ch->idx));
     cfg |= HPET_TN_FSB;
     hpet_write32(cfg, HPET_Tn_CFG(ch->idx));
+    ch->msi.msi_attrib.masked = 0;
 }
 
 static void hpet_msi_mask(struct irq_desc *desc)
@@ -249,6 +250,7 @@ static void hpet_msi_mask(struct irq_des
     cfg = hpet_read32(HPET_Tn_CFG(ch->idx));
     cfg &= ~HPET_TN_FSB;
     hpet_write32(cfg, HPET_Tn_CFG(ch->idx));
+    ch->msi.msi_attrib.masked = 1;
 }
 
 static void hpet_msi_write(struct hpet_event_channel *ch, struct msi_msg *msg)
@@ -346,6 +348,7 @@ static int __init hpet_setup_msi_irq(str
     }
 
     __hpet_setup_msi_irq(desc);
+    desc->msi_desc = &ch->msi;
 
     return 0;
 }
@@ -390,6 +393,17 @@ static void __init hpet_fsb_cap_lookup(v
         if ( !(cfg & HPET_TN_FSB_CAP) )
             continue;
 
+        /* hpet_setup(), via hpet_resume(), attempted to clear HPET_TN_FSB, so
+         * if it is still set... */
+        if ( !(cfg & HPET_TN_FSB) )
+            ch->msi.msi_attrib.maskbit = 1;
+        else
+        {
+            ch->msi.msi_attrib.maskbit = 0;
+            printk(XENLOG_WARNING "HPET: channel %u is not maskable (%04x)\n",
+                   i, cfg);
+        }
+
         if ( !zalloc_cpumask_var(&ch->cpumask) )
         {
             if ( !num_hpets_used )
@@ -573,6 +587,8 @@ void __init hpet_broadcast_init(void)
         spin_lock_init(&hpet_events[i].lock);
         wmb();
         hpet_events[i].event_handler = handle_hpet_broadcast;
+
+        hpet_events[i].msi.msi_attrib.pos = MSI_TYPE_HPET;
     }
 
     if ( !num_hpets_used )
@@ -795,7 +811,10 @@ void hpet_resume(u32 *boot_cfg)
     {
         cfg = hpet_read32(HPET_Tn_CFG(i));
         if ( boot_cfg )
+        {
             boot_cfg[i + 1] = cfg;
+            cfg &= ~HPET_TN_FSB;
+        }
         cfg &= ~HPET_TN_ENABLE;
         if ( cfg & HPET_TN_RESERVED )
         {
diff -r f004f611bf53 -r af6b72a224e9 xen/arch/x86/msi.c
--- a/xen/arch/x86/msi.c	Thu Nov 22 09:59:50 2012 +0100
+++ b/xen/arch/x86/msi.c	Thu Nov 22 10:02:18 2012 +0100
@@ -1119,17 +1119,17 @@ static void dump_msi(unsigned char key)
 {
     unsigned int irq;
 
-    printk("PCI-MSI interrupt information:\n");
+    printk("MSI information:\n");
 
     for ( irq = 0; irq < nr_irqs; irq++ )
     {
         struct irq_desc *desc = irq_to_desc(irq);
         const struct msi_desc *entry;
         u32 addr, data, dest32;
-        int mask;
+        char mask;
         struct msi_attrib attr;
         unsigned long flags;
-        char type;
+        const char *type = "???";
 
         if ( !irq_desc_initialized(desc) )
             continue;
@@ -1145,21 +1145,30 @@ static void dump_msi(unsigned char key)
 
         switch ( entry->msi_attrib.type )
         {
-        case PCI_CAP_ID_MSI: type = ' '; break;
-        case PCI_CAP_ID_MSIX: type = 'X'; break;
-        default: type = '?'; break;
+        case PCI_CAP_ID_MSI: type = "MSI"; break;
+        case PCI_CAP_ID_MSIX: type = "MSI-X"; break;
+        case 0:
+            switch ( entry->msi_attrib.pos )
+            {
+            case MSI_TYPE_HPET: type = "HPET"; break;
+            case MSI_TYPE_IOMMU: type = "IOMMU"; break;
+            }
+            break;
         }
 
         data = entry->msg.data;
         addr = entry->msg.address_lo;
         dest32 = entry->msg.dest32;
         attr = entry->msi_attrib;
-        mask = msi_get_mask_bit(entry);
+        if ( entry->msi_attrib.type )
+            mask = msi_get_mask_bit(entry) ? '1' : '0';
+        else
+            mask = '?';
 
         spin_unlock_irqrestore(&desc->lock, flags);
 
-        printk(" MSI%c %4u vec=%02x%7s%6s%3sassert%5s%7s"
-               " dest=%08x mask=%d/%d/%d\n",
+        printk(" %-6s%4u vec=%02x%7s%6s%3sassert%5s%7s"
+               " dest=%08x mask=%d/%d/%c\n",
                type, irq,
                (data & MSI_DATA_VECTOR_MASK) >> MSI_DATA_VECTOR_SHIFT,
                data & MSI_DATA_DELIVERY_LOWPRI ? "lowest" : "fixed",
diff -r f004f611bf53 -r af6b72a224e9 xen/include/asm-x86/msi.h
--- a/xen/include/asm-x86/msi.h	Thu Nov 22 09:59:50 2012 +0100
+++ b/xen/include/asm-x86/msi.h	Thu Nov 22 10:02:18 2012 +0100
@@ -109,6 +109,14 @@ struct msi_desc {
 	int remap_index;		/* index in interrupt remapping table */
 };
 
+/*
+ * Values stored into msi_desc.msi_attrib.pos for non-PCI devices
+ * (msi_desc.msi_attrib.type is zero):
+ */
+#define MSI_TYPE_UNKNOWN 0
+#define MSI_TYPE_HPET    1
+#define MSI_TYPE_IOMMU   2
+
 int msi_maskable_irq(const struct msi_desc *);
 int msi_free_irq(struct msi_desc *entry);
 

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

From xen-changelog-bounces@lists.xen.org Thu Nov 22 20:11:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Nov 2012 20:11: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 1Tbd7A-0006nv-70; Thu, 22 Nov 2012 20:11:12 +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 1Tbd79-0006no-Ai
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:11 +0000
Received: from [85.158.137.99:3225] by server-13.bemta-3.messagelabs.com id
	BF/0E-24887-ED68EA05; Thu, 22 Nov 2012 20:11:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-217.messagelabs.com!1353615068!13394584!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7873 invoked from network); 22 Nov 2012 20:11:09 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Nov 2012 20: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 1Tbd76-0000r0-EI
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tbd75-0001DF-R8
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:07 +0000
Message-Id: <E1Tbd75-0001DF-R8@xenbits.xen.org>
Date: Thu, 22 Nov 2012 20:11:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] VT-d: clean up map/unmap log messages
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353574790 -3600
# Node ID f004f611bf538e993be1a32fbe2b45ce903e1875
# Parent  2489c29266982175b5b4e945c97b4549360e947f
VT-d: clean up map/unmap log messages

- printing file name and line number here is pointless
- they are guest related, so should get their log level filter
  accordingly
- include segment numbers and canonicalize number widths

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


diff -r 2489c2926698 -r f004f611bf53 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Tue Nov 20 17:17:40 2012 +0000
+++ b/xen/drivers/passthrough/vtd/iommu.c	Thu Nov 22 09:59:50 2012 +0100
@@ -1289,11 +1289,11 @@ int domain_context_mapping_one(
         {
             if ( pdev->domain != domain )
             {
-                dprintk(XENLOG_INFO VTDPREFIX, "d%d: bdf = %x:%x.%x owned by d%d!",
-                        domain->domain_id, 
-                        bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
-                        (pdev->domain)
-                        ? pdev->domain->domain_id : -1);
+                printk(XENLOG_G_INFO VTDPREFIX
+                       "d%d: %04x:%02x:%02x.%u owned by d%d!",
+                       domain->domain_id,
+                       seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                       pdev->domain ? pdev->domain->domain_id : -1);
                 res = -EINVAL;
             }
         }
@@ -1304,17 +1304,19 @@ int domain_context_mapping_one(
             
             if ( cdomain < 0 )
             {
-                dprintk(VTDPREFIX, "d%d: bdf = %x:%x.%x mapped, but can't find owner!\n",
-                        domain->domain_id, 
-                        bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+                printk(XENLOG_G_WARNING VTDPREFIX
+                       "d%d: %04x:%02x:%02x.%u mapped, but can't find owner!\n",
+                       domain->domain_id,
+                       seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
                 res = -EINVAL;
             }
             else if ( cdomain != domain->domain_id )
             {
-                dprintk(XENLOG_INFO VTDPREFIX, "d%d: bdf = %x:%x.%x already mapped to d%d!",
-                        domain->domain_id, 
-                        bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
-                        cdomain);
+                printk(XENLOG_G_INFO VTDPREFIX
+                       "d%d: %04x:%02x:%02x.%u already mapped to d%d!",
+                       domain->domain_id,
+                       seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                       cdomain);
                 res = -EINVAL;
             }
         }

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

From xen-changelog-bounces@lists.xen.org Thu Nov 22 20:11:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Nov 2012 20:11: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 1Tbd7C-0006oT-F3; Thu, 22 Nov 2012 20:11:14 +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 1Tbd7B-0006o5-6h
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:13 +0000
Received: from [85.158.138.51:35667] by server-16.bemta-3.messagelabs.com id
	87/3F-07461-0E68EA05; Thu, 22 Nov 2012 20:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1353615070!24761520!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18469 invoked from network); 22 Nov 2012 20:11:11 -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;
	22 Nov 2012 20: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 1Tbd77-0000r9-OI
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tbd77-0001Dy-Ix
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:09 +0000
Message-Id: <E1Tbd77-0001Dy-Ix@xenbits.xen.org>
Date: Thu, 22 Nov 2012 20:11:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] implement vmap()
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353577678 -3600
# Node ID 7b4449bdb980caee8efc498d5ea48f772331df2f
# Parent  c139ca92edca2fab8ec95deb7fd9e4246c3fe28d
implement vmap()

... and use it as basis for a proper ioremap() on x86.

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


diff -r c139ca92edca -r 7b4449bdb980 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c	Thu Nov 22 10:03:23 2012 +0100
+++ b/xen/arch/x86/mm.c	Thu Nov 22 10:47:58 2012 +0100
@@ -100,6 +100,7 @@
 #include <xen/iocap.h>
 #include <xen/guest_access.h>
 #include <xen/pfn.h>
+#include <xen/vmap.h>
 #include <xen/xmalloc.h>
 #include <xen/efi.h>
 #include <xen/grant_table.h>
@@ -5460,6 +5461,32 @@ void __set_fixmap(
     map_pages_to_xen(fix_to_virt(idx), mfn, 1, flags);
 }
 
+void *__init arch_vmap_virt_end(void)
+{
+    return (void *)fix_to_virt(__end_of_fixed_addresses);
+}
+
+void __iomem *ioremap(paddr_t pa, size_t len)
+{
+    unsigned long pfn = PFN_DOWN(pa);
+    void *va;
+
+    WARN_ON(page_is_ram_type(pfn, RAM_TYPE_CONVENTIONAL));
+
+    /* The low first Mb is always mapped. */
+    if ( !((pa + len - 1) >> 20) )
+        va = __va(pa);
+    else
+    {
+        unsigned int offs = pa & (PAGE_SIZE - 1);
+        unsigned int nr = PFN_UP(offs + len);
+
+        va = __vmap(&pfn, nr, 1, 1, PAGE_HYPERVISOR_NOCACHE) + offs;
+    }
+
+    return (void __force __iomem *)va;
+}
+
 #ifdef MEMORY_GUARD
 
 void memguard_init(void)
diff -r c139ca92edca -r 7b4449bdb980 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c	Thu Nov 22 10:03:23 2012 +0100
+++ b/xen/arch/x86/setup.c	Thu Nov 22 10:47:58 2012 +0100
@@ -1104,6 +1104,7 @@ void __init __start_xen(unsigned long mb
     end_boot_allocator();
     system_state = SYS_STATE_boot;
 
+    vm_init();
     vesa_init();
 
     softirq_init();
diff -r c139ca92edca -r 7b4449bdb980 xen/common/Makefile
--- a/xen/common/Makefile	Thu Nov 22 10:03:23 2012 +0100
+++ b/xen/common/Makefile	Thu Nov 22 10:47:58 2012 +0100
@@ -36,6 +36,7 @@ obj-y += time.o
 obj-y += timer.o
 obj-y += trace.o
 obj-y += version.o
+obj-y += vmap.o
 obj-y += vsprintf.o
 obj-y += wait.o
 obj-y += xmalloc_tlsf.o
diff -r c139ca92edca -r 7b4449bdb980 xen/common/vmap.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/vmap.c	Thu Nov 22 10:47:58 2012 +0100
@@ -0,0 +1,204 @@
+#ifdef VMAP_VIRT_START
+#include <xen/bitmap.h>
+#include <xen/cache.h>
+#include <xen/init.h>
+#include <xen/mm.h>
+#include <xen/pfn.h>
+#include <xen/spinlock.h>
+#include <xen/types.h>
+#include <xen/vmap.h>
+#include <asm/page.h>
+
+static DEFINE_SPINLOCK(vm_lock);
+static void *__read_mostly vm_base;
+#define vm_bitmap ((unsigned long *)vm_base)
+/* highest allocated bit in the bitmap */
+static unsigned int __read_mostly vm_top;
+/* total number of bits in the bitmap */
+static unsigned int __read_mostly vm_end;
+/* lowest known clear bit in the bitmap */
+static unsigned int vm_low;
+
+void __init vm_init(void)
+{
+    unsigned int i, nr;
+    unsigned long va;
+
+    vm_base = (void *)VMAP_VIRT_START;
+    vm_end = PFN_DOWN(arch_vmap_virt_end() - vm_base);
+    vm_low = PFN_UP((vm_end + 7) / 8);
+    nr = PFN_UP((vm_low + 7) / 8);
+    vm_top = nr * PAGE_SIZE * 8;
+
+    for ( i = 0, va = (unsigned long)vm_bitmap; i < nr; ++i, va += PAGE_SIZE )
+    {
+        struct page_info *pg = alloc_domheap_page(NULL, 0);
+
+        map_pages_to_xen(va, page_to_mfn(pg), 1, PAGE_HYPERVISOR);
+        clear_page((void *)va);
+    }
+    bitmap_fill(vm_bitmap, vm_low);
+
+    /* Populate page tables for the bitmap if necessary. */
+    map_pages_to_xen(va, 0, vm_low - nr, MAP_SMALL_PAGES);
+}
+
+void *vm_alloc(unsigned int nr, unsigned int align)
+{
+    unsigned int start, bit;
+
+    if ( !align )
+        align = 1;
+    else if ( align & (align - 1) )
+        align &= -align;
+
+    spin_lock(&vm_lock);
+    for ( ; ; )
+    {
+        struct page_info *pg;
+
+        ASSERT(!test_bit(vm_low, vm_bitmap));
+        for ( start = vm_low; ; )
+        {
+            bit = find_next_bit(vm_bitmap, vm_top, start + 1);
+            if ( bit > vm_top )
+                bit = vm_top;
+            /*
+             * Note that this skips the first bit, making the
+             * corresponding page a guard one.
+             */
+            start = (start + align) & ~(align - 1);
+            if ( start + nr <= bit )
+                break;
+            start = bit < vm_top ?
+                    find_next_zero_bit(vm_bitmap, vm_top, bit + 1) : bit;
+            if ( start >= vm_top )
+                break;
+        }
+
+        if ( start < vm_top )
+            break;
+
+        spin_unlock(&vm_lock);
+
+        if ( vm_top >= vm_end )
+            return NULL;
+
+        pg = alloc_domheap_page(NULL, 0);
+        if ( !pg )
+            return NULL;
+
+        spin_lock(&vm_lock);
+
+        if ( start >= vm_top )
+        {
+            unsigned long va = (unsigned long)vm_bitmap + vm_top / 8;
+
+            if ( !map_pages_to_xen(va, page_to_mfn(pg), 1, PAGE_HYPERVISOR) )
+            {
+                clear_page((void *)va);
+                vm_top += PAGE_SIZE * 8;
+                if ( vm_top > vm_end )
+                    vm_top = vm_end;
+                continue;
+            }
+        }
+
+        free_domheap_page(pg);
+
+        if ( start >= vm_top )
+        {
+            spin_unlock(&vm_lock);
+            return NULL;
+        }
+    }
+
+    for ( bit = start; bit < start + nr; ++bit )
+        __set_bit(bit, vm_bitmap);
+    if ( start <= vm_low + 2 )
+        vm_low = bit;
+    spin_unlock(&vm_lock);
+
+    return vm_base + start * PAGE_SIZE;
+}
+
+static unsigned int vm_index(const void *va)
+{
+    unsigned long addr = (unsigned long)va & ~(PAGE_SIZE - 1);
+    unsigned int idx;
+
+    if ( addr < VMAP_VIRT_START + (vm_end / 8) ||
+         addr >= VMAP_VIRT_START + vm_top * PAGE_SIZE )
+        return 0;
+
+    idx = PFN_DOWN(va - vm_base);
+    return !test_bit(idx - 1, vm_bitmap) &&
+           test_bit(idx, vm_bitmap) ? idx : 0;
+}
+
+static unsigned int vm_size(const void *va)
+{
+    unsigned int start = vm_index(va), end;
+
+    if ( !start )
+        return 0;
+
+    end = find_next_zero_bit(vm_bitmap, vm_top, start + 1);
+
+    return min(end, vm_top) - start;
+}
+
+void vm_free(const void *va)
+{
+    unsigned int bit = vm_index(va);
+
+    if ( !bit )
+    {
+        WARN_ON(va != NULL);
+        return;
+    }
+
+    spin_lock(&vm_lock);
+    if ( bit < vm_low )
+    {
+        vm_low = bit - 1;
+        while ( !test_bit(vm_low - 1, vm_bitmap) )
+            --vm_low;
+    }
+    while ( __test_and_clear_bit(bit, vm_bitmap) )
+        if ( ++bit == vm_top )
+            break;
+    spin_unlock(&vm_lock);
+}
+
+void *__vmap(const unsigned long *mfn, unsigned int granularity,
+             unsigned int nr, unsigned int align, unsigned int flags)
+{
+    void *va = vm_alloc(nr * granularity, align);
+    unsigned long cur = (unsigned long)va;
+
+    for ( ; va && nr--; ++mfn, cur += PAGE_SIZE * granularity )
+    {
+        if ( map_pages_to_xen(cur, *mfn, granularity, flags) )
+        {
+            vunmap(va);
+            va = NULL;
+        }
+    }
+
+    return va;
+}
+
+void *vmap(const unsigned long *mfn, unsigned int nr)
+{
+    return __vmap(mfn, 1, nr, 1, PAGE_HYPERVISOR);
+}
+
+void vunmap(const void *va)
+{
+    unsigned long addr = (unsigned long)va;
+
+    destroy_xen_mappings(addr, addr + PAGE_SIZE * vm_size(va));
+    vm_free(va);
+}
+#endif
diff -r c139ca92edca -r 7b4449bdb980 xen/drivers/acpi/apei/erst.c
--- a/xen/drivers/acpi/apei/erst.c	Thu Nov 22 10:03:23 2012 +0100
+++ b/xen/drivers/acpi/apei/erst.c	Thu Nov 22 10:47:58 2012 +0100
@@ -247,9 +247,6 @@ static int erst_exec_move_data(struct ap
 {
 	int rc;
 	u64 offset;
-#ifdef CONFIG_X86
-	enum fixed_addresses idx;
-#endif
 	void *src, *dst;
 
 	/* ioremap does not work in interrupt context */
@@ -263,39 +260,11 @@ static int erst_exec_move_data(struct ap
 	if (rc)
 		return rc;
 
-#ifdef CONFIG_X86
-	switch (ctx->var2) {
-	case 0:
-		return 0;
-	case 1 ... PAGE_SIZE:
-		break;
-	default:
-		printk(KERN_WARNING
-		       "MOVE_DATA cannot be used for %#"PRIx64" bytes of data\n",
-		       ctx->var2);
-		return -EOPNOTSUPP;
-	}
-
-	src = __acpi_map_table(ctx->src_base + offset, ctx->var2);
-#else
 	src = ioremap(ctx->src_base + offset, ctx->var2);
-#endif
 	if (!src)
 		return -ENOMEM;
 
-#ifdef CONFIG_X86
-	BUILD_BUG_ON(FIX_ACPI_PAGES < 4);
-	idx = virt_to_fix((unsigned long)src + 2 * PAGE_SIZE);
-	offset += ctx->dst_base;
-	dst = (void *)fix_to_virt(idx) + (offset & ~PAGE_MASK);
-	set_fixmap(idx, offset);
-	if (PFN_DOWN(offset) != PFN_DOWN(offset + ctx->var2 - 1)) {
-		idx = virt_to_fix((unsigned long)dst + PAGE_SIZE);
-		set_fixmap(idx, offset + PAGE_SIZE);
-	}
-#else
 	dst = ioremap(ctx->dst_base + offset, ctx->var2);
-#endif
 	if (dst) {
 		memmove(dst, src, ctx->var2);
 		iounmap(dst);
diff -r c139ca92edca -r 7b4449bdb980 xen/drivers/video/vesa.c
--- a/xen/drivers/video/vesa.c	Thu Nov 22 10:03:23 2012 +0100
+++ b/xen/drivers/video/vesa.c	Thu Nov 22 10:47:58 2012 +0100
@@ -10,6 +10,7 @@
 #include <xen/xmalloc.h>
 #include <xen/kernel.h>
 #include <xen/vga.h>
+#include <asm/io.h>
 #include <asm/page.h>
 #include "font.h"
 
@@ -101,13 +102,11 @@ void __init vesa_init(void)
     if ( !line_len )
         goto fail;
 
-    if ( map_pages_to_xen(IOREMAP_VIRT_START,
-                          vlfb_info.lfb_base >> PAGE_SHIFT,
-                          vram_remap >> PAGE_SHIFT,
-                          PAGE_HYPERVISOR_NOCACHE) )
+    lfb = ioremap(vlfb_info.lfb_base, vram_remap);
+    if ( !lfb )
         goto fail;
 
-    lfb = memset((void *)IOREMAP_VIRT_START, 0, vram_remap);
+    memset(lfb, 0, vram_remap);
 
     vga_puts = vesa_redraw_puts;
 
diff -r c139ca92edca -r 7b4449bdb980 xen/include/asm-x86/config.h
--- a/xen/include/asm-x86/config.h	Thu Nov 22 10:03:23 2012 +0100
+++ b/xen/include/asm-x86/config.h	Thu Nov 22 10:47:58 2012 +0100
@@ -144,7 +144,7 @@ extern unsigned char boot_edid_info[128]
  *  0xffff828000000000 - 0xffff82bfffffffff [256GB, 2^38 bytes, PML4:261]
  *    Machine-to-phys translation table.
  *  0xffff82c000000000 - 0xffff82c3ffffffff [16GB,  2^34 bytes, PML4:261]
- *    ioremap()/fixmap area.
+ *    vmap()/ioremap()/fixmap area.
  *  0xffff82c400000000 - 0xffff82c43fffffff [1GB,   2^30 bytes, PML4:261]
  *    Compatibility machine-to-phys translation table.
  *  0xffff82c440000000 - 0xffff82c47fffffff [1GB,   2^30 bytes, PML4:261]
@@ -205,11 +205,11 @@ extern unsigned char boot_edid_info[128]
 /* Slot 261: machine-to-phys conversion table (256GB). */
 #define RDWR_MPT_VIRT_START     (PML4_ADDR(261))
 #define RDWR_MPT_VIRT_END       (RDWR_MPT_VIRT_START + MPT_VIRT_SIZE)
-/* Slot 261: ioremap()/fixmap area (16GB). */
-#define IOREMAP_VIRT_START      RDWR_MPT_VIRT_END
-#define IOREMAP_VIRT_END        (IOREMAP_VIRT_START + GB(16))
+/* Slot 261: vmap()/ioremap()/fixmap area (16GB). */
+#define VMAP_VIRT_START         RDWR_MPT_VIRT_END
+#define VMAP_VIRT_END           (VMAP_VIRT_START + GB(16))
 /* Slot 261: compatibility machine-to-phys conversion table (1GB). */
-#define RDWR_COMPAT_MPT_VIRT_START IOREMAP_VIRT_END
+#define RDWR_COMPAT_MPT_VIRT_START VMAP_VIRT_END
 #define RDWR_COMPAT_MPT_VIRT_END (RDWR_COMPAT_MPT_VIRT_START + GB(1))
 /* Slot 261: high read-only compat machine-to-phys conversion table (1GB). */
 #define HIRO_COMPAT_MPT_VIRT_START RDWR_COMPAT_MPT_VIRT_END
diff -r c139ca92edca -r 7b4449bdb980 xen/include/asm-x86/fixmap.h
--- a/xen/include/asm-x86/fixmap.h	Thu Nov 22 10:03:23 2012 +0100
+++ b/xen/include/asm-x86/fixmap.h	Thu Nov 22 10:47:58 2012 +0100
@@ -15,7 +15,7 @@
 #include <xen/config.h>
 #include <asm/page.h>
 
-#define FIXADDR_TOP (IOREMAP_VIRT_END - PAGE_SIZE)
+#define FIXADDR_TOP (VMAP_VIRT_END - PAGE_SIZE)
 
 #ifndef __ASSEMBLY__
 
diff -r c139ca92edca -r 7b4449bdb980 xen/include/asm-x86/io.h
--- a/xen/include/asm-x86/io.h	Thu Nov 22 10:03:23 2012 +0100
+++ b/xen/include/asm-x86/io.h	Thu Nov 22 10:47:58 2012 +0100
@@ -1,14 +1,10 @@
 #ifndef _ASM_IO_H
 #define _ASM_IO_H
 
-#include <xen/config.h>
+#include <xen/vmap.h>
 #include <xen/types.h>
 #include <asm/page.h>
 
-/* We don't need real ioremap() on Xen/x86. */
-#define ioremap(x,l) (__va(x))
-#define iounmap(p)   ((void)0)
-
 #define readb(x) (*(volatile char *)(x))
 #define readw(x) (*(volatile short *)(x))
 #define readl(x) (*(volatile int *)(x))
diff -r c139ca92edca -r 7b4449bdb980 xen/include/xen/vmap.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/xen/vmap.h	Thu Nov 22 10:47:58 2012 +0100
@@ -0,0 +1,24 @@
+#if !defined(__XEN_VMAP_H__) && defined(VMAP_VIRT_START)
+#define __XEN_VMAP_H__
+
+#include <xen/types.h>
+
+void *vm_alloc(unsigned int nr, unsigned int align);
+void vm_free(const void *);
+
+void *__vmap(const unsigned long *mfn, unsigned int granularity,
+             unsigned int nr, unsigned int align, unsigned int flags);
+void *vmap(const unsigned long *mfn, unsigned int nr);
+void vunmap(const void *);
+
+void __iomem *ioremap(paddr_t, size_t);
+
+static inline void iounmap(void __iomem *va)
+{
+    vunmap((void __force *)va);
+}
+
+void vm_init(void);
+void *arch_vmap_virt_end(void);
+
+#endif /* __XEN_VMAP_H__ */

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

From xen-changelog-bounces@lists.xen.org Thu Nov 22 20:11:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Nov 2012 20:11: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 1Tbd7C-0006oT-F3; Thu, 22 Nov 2012 20:11:14 +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 1Tbd7B-0006o5-6h
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:13 +0000
Received: from [85.158.138.51:35667] by server-16.bemta-3.messagelabs.com id
	87/3F-07461-0E68EA05; Thu, 22 Nov 2012 20:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1353615070!24761520!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18469 invoked from network); 22 Nov 2012 20:11:11 -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;
	22 Nov 2012 20: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 1Tbd77-0000r9-OI
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tbd77-0001Dy-Ix
	for xen-changelog@lists.xensource.com; Thu, 22 Nov 2012 20:11:09 +0000
Message-Id: <E1Tbd77-0001Dy-Ix@xenbits.xen.org>
Date: Thu, 22 Nov 2012 20:11:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] implement vmap()
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353577678 -3600
# Node ID 7b4449bdb980caee8efc498d5ea48f772331df2f
# Parent  c139ca92edca2fab8ec95deb7fd9e4246c3fe28d
implement vmap()

... and use it as basis for a proper ioremap() on x86.

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


diff -r c139ca92edca -r 7b4449bdb980 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c	Thu Nov 22 10:03:23 2012 +0100
+++ b/xen/arch/x86/mm.c	Thu Nov 22 10:47:58 2012 +0100
@@ -100,6 +100,7 @@
 #include <xen/iocap.h>
 #include <xen/guest_access.h>
 #include <xen/pfn.h>
+#include <xen/vmap.h>
 #include <xen/xmalloc.h>
 #include <xen/efi.h>
 #include <xen/grant_table.h>
@@ -5460,6 +5461,32 @@ void __set_fixmap(
     map_pages_to_xen(fix_to_virt(idx), mfn, 1, flags);
 }
 
+void *__init arch_vmap_virt_end(void)
+{
+    return (void *)fix_to_virt(__end_of_fixed_addresses);
+}
+
+void __iomem *ioremap(paddr_t pa, size_t len)
+{
+    unsigned long pfn = PFN_DOWN(pa);
+    void *va;
+
+    WARN_ON(page_is_ram_type(pfn, RAM_TYPE_CONVENTIONAL));
+
+    /* The low first Mb is always mapped. */
+    if ( !((pa + len - 1) >> 20) )
+        va = __va(pa);
+    else
+    {
+        unsigned int offs = pa & (PAGE_SIZE - 1);
+        unsigned int nr = PFN_UP(offs + len);
+
+        va = __vmap(&pfn, nr, 1, 1, PAGE_HYPERVISOR_NOCACHE) + offs;
+    }
+
+    return (void __force __iomem *)va;
+}
+
 #ifdef MEMORY_GUARD
 
 void memguard_init(void)
diff -r c139ca92edca -r 7b4449bdb980 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c	Thu Nov 22 10:03:23 2012 +0100
+++ b/xen/arch/x86/setup.c	Thu Nov 22 10:47:58 2012 +0100
@@ -1104,6 +1104,7 @@ void __init __start_xen(unsigned long mb
     end_boot_allocator();
     system_state = SYS_STATE_boot;
 
+    vm_init();
     vesa_init();
 
     softirq_init();
diff -r c139ca92edca -r 7b4449bdb980 xen/common/Makefile
--- a/xen/common/Makefile	Thu Nov 22 10:03:23 2012 +0100
+++ b/xen/common/Makefile	Thu Nov 22 10:47:58 2012 +0100
@@ -36,6 +36,7 @@ obj-y += time.o
 obj-y += timer.o
 obj-y += trace.o
 obj-y += version.o
+obj-y += vmap.o
 obj-y += vsprintf.o
 obj-y += wait.o
 obj-y += xmalloc_tlsf.o
diff -r c139ca92edca -r 7b4449bdb980 xen/common/vmap.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/vmap.c	Thu Nov 22 10:47:58 2012 +0100
@@ -0,0 +1,204 @@
+#ifdef VMAP_VIRT_START
+#include <xen/bitmap.h>
+#include <xen/cache.h>
+#include <xen/init.h>
+#include <xen/mm.h>
+#include <xen/pfn.h>
+#include <xen/spinlock.h>
+#include <xen/types.h>
+#include <xen/vmap.h>
+#include <asm/page.h>
+
+static DEFINE_SPINLOCK(vm_lock);
+static void *__read_mostly vm_base;
+#define vm_bitmap ((unsigned long *)vm_base)
+/* highest allocated bit in the bitmap */
+static unsigned int __read_mostly vm_top;
+/* total number of bits in the bitmap */
+static unsigned int __read_mostly vm_end;
+/* lowest known clear bit in the bitmap */
+static unsigned int vm_low;
+
+void __init vm_init(void)
+{
+    unsigned int i, nr;
+    unsigned long va;
+
+    vm_base = (void *)VMAP_VIRT_START;
+    vm_end = PFN_DOWN(arch_vmap_virt_end() - vm_base);
+    vm_low = PFN_UP((vm_end + 7) / 8);
+    nr = PFN_UP((vm_low + 7) / 8);
+    vm_top = nr * PAGE_SIZE * 8;
+
+    for ( i = 0, va = (unsigned long)vm_bitmap; i < nr; ++i, va += PAGE_SIZE )
+    {
+        struct page_info *pg = alloc_domheap_page(NULL, 0);
+
+        map_pages_to_xen(va, page_to_mfn(pg), 1, PAGE_HYPERVISOR);
+        clear_page((void *)va);
+    }
+    bitmap_fill(vm_bitmap, vm_low);
+
+    /* Populate page tables for the bitmap if necessary. */
+    map_pages_to_xen(va, 0, vm_low - nr, MAP_SMALL_PAGES);
+}
+
+void *vm_alloc(unsigned int nr, unsigned int align)
+{
+    unsigned int start, bit;
+
+    if ( !align )
+        align = 1;
+    else if ( align & (align - 1) )
+        align &= -align;
+
+    spin_lock(&vm_lock);
+    for ( ; ; )
+    {
+        struct page_info *pg;
+
+        ASSERT(!test_bit(vm_low, vm_bitmap));
+        for ( start = vm_low; ; )
+        {
+            bit = find_next_bit(vm_bitmap, vm_top, start + 1);
+            if ( bit > vm_top )
+                bit = vm_top;
+            /*
+             * Note that this skips the first bit, making the
+             * corresponding page a guard one.
+             */
+            start = (start + align) & ~(align - 1);
+            if ( start + nr <= bit )
+                break;
+            start = bit < vm_top ?
+                    find_next_zero_bit(vm_bitmap, vm_top, bit + 1) : bit;
+            if ( start >= vm_top )
+                break;
+        }
+
+        if ( start < vm_top )
+            break;
+
+        spin_unlock(&vm_lock);
+
+        if ( vm_top >= vm_end )
+            return NULL;
+
+        pg = alloc_domheap_page(NULL, 0);
+        if ( !pg )
+            return NULL;
+
+        spin_lock(&vm_lock);
+
+        if ( start >= vm_top )
+        {
+            unsigned long va = (unsigned long)vm_bitmap + vm_top / 8;
+
+            if ( !map_pages_to_xen(va, page_to_mfn(pg), 1, PAGE_HYPERVISOR) )
+            {
+                clear_page((void *)va);
+                vm_top += PAGE_SIZE * 8;
+                if ( vm_top > vm_end )
+                    vm_top = vm_end;
+                continue;
+            }
+        }
+
+        free_domheap_page(pg);
+
+        if ( start >= vm_top )
+        {
+            spin_unlock(&vm_lock);
+            return NULL;
+        }
+    }
+
+    for ( bit = start; bit < start + nr; ++bit )
+        __set_bit(bit, vm_bitmap);
+    if ( start <= vm_low + 2 )
+        vm_low = bit;
+    spin_unlock(&vm_lock);
+
+    return vm_base + start * PAGE_SIZE;
+}
+
+static unsigned int vm_index(const void *va)
+{
+    unsigned long addr = (unsigned long)va & ~(PAGE_SIZE - 1);
+    unsigned int idx;
+
+    if ( addr < VMAP_VIRT_START + (vm_end / 8) ||
+         addr >= VMAP_VIRT_START + vm_top * PAGE_SIZE )
+        return 0;
+
+    idx = PFN_DOWN(va - vm_base);
+    return !test_bit(idx - 1, vm_bitmap) &&
+           test_bit(idx, vm_bitmap) ? idx : 0;
+}
+
+static unsigned int vm_size(const void *va)
+{
+    unsigned int start = vm_index(va), end;
+
+    if ( !start )
+        return 0;
+
+    end = find_next_zero_bit(vm_bitmap, vm_top, start + 1);
+
+    return min(end, vm_top) - start;
+}
+
+void vm_free(const void *va)
+{
+    unsigned int bit = vm_index(va);
+
+    if ( !bit )
+    {
+        WARN_ON(va != NULL);
+        return;
+    }
+
+    spin_lock(&vm_lock);
+    if ( bit < vm_low )
+    {
+        vm_low = bit - 1;
+        while ( !test_bit(vm_low - 1, vm_bitmap) )
+            --vm_low;
+    }
+    while ( __test_and_clear_bit(bit, vm_bitmap) )
+        if ( ++bit == vm_top )
+            break;
+    spin_unlock(&vm_lock);
+}
+
+void *__vmap(const unsigned long *mfn, unsigned int granularity,
+             unsigned int nr, unsigned int align, unsigned int flags)
+{
+    void *va = vm_alloc(nr * granularity, align);
+    unsigned long cur = (unsigned long)va;
+
+    for ( ; va && nr--; ++mfn, cur += PAGE_SIZE * granularity )
+    {
+        if ( map_pages_to_xen(cur, *mfn, granularity, flags) )
+        {
+            vunmap(va);
+            va = NULL;
+        }
+    }
+
+    return va;
+}
+
+void *vmap(const unsigned long *mfn, unsigned int nr)
+{
+    return __vmap(mfn, 1, nr, 1, PAGE_HYPERVISOR);
+}
+
+void vunmap(const void *va)
+{
+    unsigned long addr = (unsigned long)va;
+
+    destroy_xen_mappings(addr, addr + PAGE_SIZE * vm_size(va));
+    vm_free(va);
+}
+#endif
diff -r c139ca92edca -r 7b4449bdb980 xen/drivers/acpi/apei/erst.c
--- a/xen/drivers/acpi/apei/erst.c	Thu Nov 22 10:03:23 2012 +0100
+++ b/xen/drivers/acpi/apei/erst.c	Thu Nov 22 10:47:58 2012 +0100
@@ -247,9 +247,6 @@ static int erst_exec_move_data(struct ap
 {
 	int rc;
 	u64 offset;
-#ifdef CONFIG_X86
-	enum fixed_addresses idx;
-#endif
 	void *src, *dst;
 
 	/* ioremap does not work in interrupt context */
@@ -263,39 +260,11 @@ static int erst_exec_move_data(struct ap
 	if (rc)
 		return rc;
 
-#ifdef CONFIG_X86
-	switch (ctx->var2) {
-	case 0:
-		return 0;
-	case 1 ... PAGE_SIZE:
-		break;
-	default:
-		printk(KERN_WARNING
-		       "MOVE_DATA cannot be used for %#"PRIx64" bytes of data\n",
-		       ctx->var2);
-		return -EOPNOTSUPP;
-	}
-
-	src = __acpi_map_table(ctx->src_base + offset, ctx->var2);
-#else
 	src = ioremap(ctx->src_base + offset, ctx->var2);
-#endif
 	if (!src)
 		return -ENOMEM;
 
-#ifdef CONFIG_X86
-	BUILD_BUG_ON(FIX_ACPI_PAGES < 4);
-	idx = virt_to_fix((unsigned long)src + 2 * PAGE_SIZE);
-	offset += ctx->dst_base;
-	dst = (void *)fix_to_virt(idx) + (offset & ~PAGE_MASK);
-	set_fixmap(idx, offset);
-	if (PFN_DOWN(offset) != PFN_DOWN(offset + ctx->var2 - 1)) {
-		idx = virt_to_fix((unsigned long)dst + PAGE_SIZE);
-		set_fixmap(idx, offset + PAGE_SIZE);
-	}
-#else
 	dst = ioremap(ctx->dst_base + offset, ctx->var2);
-#endif
 	if (dst) {
 		memmove(dst, src, ctx->var2);
 		iounmap(dst);
diff -r c139ca92edca -r 7b4449bdb980 xen/drivers/video/vesa.c
--- a/xen/drivers/video/vesa.c	Thu Nov 22 10:03:23 2012 +0100
+++ b/xen/drivers/video/vesa.c	Thu Nov 22 10:47:58 2012 +0100
@@ -10,6 +10,7 @@
 #include <xen/xmalloc.h>
 #include <xen/kernel.h>
 #include <xen/vga.h>
+#include <asm/io.h>
 #include <asm/page.h>
 #include "font.h"
 
@@ -101,13 +102,11 @@ void __init vesa_init(void)
     if ( !line_len )
         goto fail;
 
-    if ( map_pages_to_xen(IOREMAP_VIRT_START,
-                          vlfb_info.lfb_base >> PAGE_SHIFT,
-                          vram_remap >> PAGE_SHIFT,
-                          PAGE_HYPERVISOR_NOCACHE) )
+    lfb = ioremap(vlfb_info.lfb_base, vram_remap);
+    if ( !lfb )
         goto fail;
 
-    lfb = memset((void *)IOREMAP_VIRT_START, 0, vram_remap);
+    memset(lfb, 0, vram_remap);
 
     vga_puts = vesa_redraw_puts;
 
diff -r c139ca92edca -r 7b4449bdb980 xen/include/asm-x86/config.h
--- a/xen/include/asm-x86/config.h	Thu Nov 22 10:03:23 2012 +0100
+++ b/xen/include/asm-x86/config.h	Thu Nov 22 10:47:58 2012 +0100
@@ -144,7 +144,7 @@ extern unsigned char boot_edid_info[128]
  *  0xffff828000000000 - 0xffff82bfffffffff [256GB, 2^38 bytes, PML4:261]
  *    Machine-to-phys translation table.
  *  0xffff82c000000000 - 0xffff82c3ffffffff [16GB,  2^34 bytes, PML4:261]
- *    ioremap()/fixmap area.
+ *    vmap()/ioremap()/fixmap area.
  *  0xffff82c400000000 - 0xffff82c43fffffff [1GB,   2^30 bytes, PML4:261]
  *    Compatibility machine-to-phys translation table.
  *  0xffff82c440000000 - 0xffff82c47fffffff [1GB,   2^30 bytes, PML4:261]
@@ -205,11 +205,11 @@ extern unsigned char boot_edid_info[128]
 /* Slot 261: machine-to-phys conversion table (256GB). */
 #define RDWR_MPT_VIRT_START     (PML4_ADDR(261))
 #define RDWR_MPT_VIRT_END       (RDWR_MPT_VIRT_START + MPT_VIRT_SIZE)
-/* Slot 261: ioremap()/fixmap area (16GB). */
-#define IOREMAP_VIRT_START      RDWR_MPT_VIRT_END
-#define IOREMAP_VIRT_END        (IOREMAP_VIRT_START + GB(16))
+/* Slot 261: vmap()/ioremap()/fixmap area (16GB). */
+#define VMAP_VIRT_START         RDWR_MPT_VIRT_END
+#define VMAP_VIRT_END           (VMAP_VIRT_START + GB(16))
 /* Slot 261: compatibility machine-to-phys conversion table (1GB). */
-#define RDWR_COMPAT_MPT_VIRT_START IOREMAP_VIRT_END
+#define RDWR_COMPAT_MPT_VIRT_START VMAP_VIRT_END
 #define RDWR_COMPAT_MPT_VIRT_END (RDWR_COMPAT_MPT_VIRT_START + GB(1))
 /* Slot 261: high read-only compat machine-to-phys conversion table (1GB). */
 #define HIRO_COMPAT_MPT_VIRT_START RDWR_COMPAT_MPT_VIRT_END
diff -r c139ca92edca -r 7b4449bdb980 xen/include/asm-x86/fixmap.h
--- a/xen/include/asm-x86/fixmap.h	Thu Nov 22 10:03:23 2012 +0100
+++ b/xen/include/asm-x86/fixmap.h	Thu Nov 22 10:47:58 2012 +0100
@@ -15,7 +15,7 @@
 #include <xen/config.h>
 #include <asm/page.h>
 
-#define FIXADDR_TOP (IOREMAP_VIRT_END - PAGE_SIZE)
+#define FIXADDR_TOP (VMAP_VIRT_END - PAGE_SIZE)
 
 #ifndef __ASSEMBLY__
 
diff -r c139ca92edca -r 7b4449bdb980 xen/include/asm-x86/io.h
--- a/xen/include/asm-x86/io.h	Thu Nov 22 10:03:23 2012 +0100
+++ b/xen/include/asm-x86/io.h	Thu Nov 22 10:47:58 2012 +0100
@@ -1,14 +1,10 @@
 #ifndef _ASM_IO_H
 #define _ASM_IO_H
 
-#include <xen/config.h>
+#include <xen/vmap.h>
 #include <xen/types.h>
 #include <asm/page.h>
 
-/* We don't need real ioremap() on Xen/x86. */
-#define ioremap(x,l) (__va(x))
-#define iounmap(p)   ((void)0)
-
 #define readb(x) (*(volatile char *)(x))
 #define readw(x) (*(volatile short *)(x))
 #define readl(x) (*(volatile int *)(x))
diff -r c139ca92edca -r 7b4449bdb980 xen/include/xen/vmap.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/xen/vmap.h	Thu Nov 22 10:47:58 2012 +0100
@@ -0,0 +1,24 @@
+#if !defined(__XEN_VMAP_H__) && defined(VMAP_VIRT_START)
+#define __XEN_VMAP_H__
+
+#include <xen/types.h>
+
+void *vm_alloc(unsigned int nr, unsigned int align);
+void vm_free(const void *);
+
+void *__vmap(const unsigned long *mfn, unsigned int granularity,
+             unsigned int nr, unsigned int align, unsigned int flags);
+void *vmap(const unsigned long *mfn, unsigned int nr);
+void vunmap(const void *);
+
+void __iomem *ioremap(paddr_t, size_t);
+
+static inline void iounmap(void __iomem *va)
+{
+    vunmap((void __force *)va);
+}
+
+void vm_init(void);
+void *arch_vmap_virt_end(void);
+
+#endif /* __XEN_VMAP_H__ */

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

From xen-changelog-bounces@lists.xen.org Fri Nov 23 11:00:13 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Nov 2012 11:00:13 +0000
Received: from 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 1TbqzR-0006l7-Ip; Fri, 23 Nov 2012 11:00:09 +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 1TbqzQ-0006kz-Gt
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 11:00:08 +0000
Received: from [85.158.143.99:22942] by server-3.bemta-4.messagelabs.com id
	B0/49-06841-7375FA05; Fri, 23 Nov 2012 11:00:07 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-216.messagelabs.com!1353668405!19880491!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17116 invoked from network); 23 Nov 2012 11:00:06 -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;
	23 Nov 2012 11:00: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 1TbqzN-0000io-06
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 11:00:05 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TbqzM-0007hy-G2
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 11:00:04 +0000
Message-Id: <E1TbqzM-0007hy-G2@xenbits.xen.org>
Date: Fri, 23 Nov 2012 11:00:04 +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] blktap: don't let in-flight
	requests defer pending ones
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353667969 -3600
# Node ID ab5ce0b7fc2b5ee64ce96b0e1aa225a95a49d25b
# Parent  1f1b30566a42de417a2f2d1111376266e6464a51
blktap: don't let in-flight requests defer pending ones

Running RING_FINAL_CHECK_FOR_REQUESTS from make_response is a bad
idea. It means that in-flight I/O is essentially blocking continued
batches. This essentially kills throughput on frontends which unplug
(or even just notify) early and rightfully assume additional requests
will be picked up on time, not synchronously.

Derived from a similar blkback patch by Daniel Stodden (see c/s
1118:c7c14595c18b).

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


diff -r 1f1b30566a42 -r ab5ce0b7fc2b drivers/xen/blktap/blktap.c
--- a/drivers/xen/blktap/blktap.c	Thu Nov 22 17:48:00 2012 +0100
+++ b/drivers/xen/blktap/blktap.c	Fri Nov 23 11:52:49 2012 +0100
@@ -1285,7 +1285,7 @@ irqreturn_t tap_blkif_be_int(int irq, vo
  * DOWNWARD CALLS -- These interface with the block-device layer proper.
  */
 static int print_dbug = 1;
-static int do_block_io_op(blkif_t *blkif)
+static int _do_block_io_op(blkif_t *blkif)
 {
 	blkif_back_rings_t *blk_rings = &blkif->blk_rings;
 	blkif_request_t req;
@@ -1397,6 +1397,22 @@ static int do_block_io_op(blkif_t *blkif
 	return more_to_do;
 }
 
+static int do_block_io_op(blkif_t *blkif)
+{
+	blkif_back_rings_t *blk_rings = &blkif->blk_rings;
+	int more_to_do;
+
+	do {
+		more_to_do = _do_block_io_op(blkif);
+		if (more_to_do)
+			break;
+
+		RING_FINAL_CHECK_FOR_REQUESTS(&blk_rings->common, more_to_do);
+	} while (more_to_do);
+
+	return more_to_do;
+}
+
 static void dispatch_rw_block_io(blkif_t *blkif,
 				 blkif_request_t *req,
 				 pending_req_t *pending_req)
@@ -1647,7 +1663,6 @@ static void make_response(blkif_t *blkif
 	blkif_response_t  resp;
 	unsigned long     flags;
 	blkif_back_rings_t *blk_rings = &blkif->blk_rings;
-	int more_to_do = 0;
 	int notify;
 
 	resp.id        = id;
@@ -1678,20 +1693,7 @@ static void make_response(blkif_t *blkif
 	blk_rings->common.rsp_prod_pvt++;
 	RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&blk_rings->common, notify);
 
-	if (blk_rings->common.rsp_prod_pvt == blk_rings->common.req_cons) {
-		/*
-		 * Tail check for pending requests. Allows frontend to avoid
-		 * notifications if requests are already in flight (lower
-		 * overheads and promotes batching).
-		 */
-		RING_FINAL_CHECK_FOR_REQUESTS(&blk_rings->common, more_to_do);
-	} else if (RING_HAS_UNCONSUMED_REQUESTS(&blk_rings->common)) {
-		more_to_do = 1;
-	}
-
 	spin_unlock_irqrestore(&blkif->blk_ring_lock, flags);
-	if (more_to_do)
-		blkif_notify_work(blkif);
 	if (notify)
 		notify_remote_via_irq(blkif->irq);
 }

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

From xen-changelog-bounces@lists.xen.org Fri Nov 23 11:00:13 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Nov 2012 11:00:13 +0000
Received: from 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 1TbqzR-0006l7-Ip; Fri, 23 Nov 2012 11:00:09 +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 1TbqzQ-0006kz-Gt
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 11:00:08 +0000
Received: from [85.158.143.99:22942] by server-3.bemta-4.messagelabs.com id
	B0/49-06841-7375FA05; Fri, 23 Nov 2012 11:00:07 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-216.messagelabs.com!1353668405!19880491!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17116 invoked from network); 23 Nov 2012 11:00:06 -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;
	23 Nov 2012 11:00: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 1TbqzN-0000io-06
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 11:00:05 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TbqzM-0007hy-G2
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 11:00:04 +0000
Message-Id: <E1TbqzM-0007hy-G2@xenbits.xen.org>
Date: Fri, 23 Nov 2012 11:00:04 +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] blktap: don't let in-flight
	requests defer pending ones
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353667969 -3600
# Node ID ab5ce0b7fc2b5ee64ce96b0e1aa225a95a49d25b
# Parent  1f1b30566a42de417a2f2d1111376266e6464a51
blktap: don't let in-flight requests defer pending ones

Running RING_FINAL_CHECK_FOR_REQUESTS from make_response is a bad
idea. It means that in-flight I/O is essentially blocking continued
batches. This essentially kills throughput on frontends which unplug
(or even just notify) early and rightfully assume additional requests
will be picked up on time, not synchronously.

Derived from a similar blkback patch by Daniel Stodden (see c/s
1118:c7c14595c18b).

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


diff -r 1f1b30566a42 -r ab5ce0b7fc2b drivers/xen/blktap/blktap.c
--- a/drivers/xen/blktap/blktap.c	Thu Nov 22 17:48:00 2012 +0100
+++ b/drivers/xen/blktap/blktap.c	Fri Nov 23 11:52:49 2012 +0100
@@ -1285,7 +1285,7 @@ irqreturn_t tap_blkif_be_int(int irq, vo
  * DOWNWARD CALLS -- These interface with the block-device layer proper.
  */
 static int print_dbug = 1;
-static int do_block_io_op(blkif_t *blkif)
+static int _do_block_io_op(blkif_t *blkif)
 {
 	blkif_back_rings_t *blk_rings = &blkif->blk_rings;
 	blkif_request_t req;
@@ -1397,6 +1397,22 @@ static int do_block_io_op(blkif_t *blkif
 	return more_to_do;
 }
 
+static int do_block_io_op(blkif_t *blkif)
+{
+	blkif_back_rings_t *blk_rings = &blkif->blk_rings;
+	int more_to_do;
+
+	do {
+		more_to_do = _do_block_io_op(blkif);
+		if (more_to_do)
+			break;
+
+		RING_FINAL_CHECK_FOR_REQUESTS(&blk_rings->common, more_to_do);
+	} while (more_to_do);
+
+	return more_to_do;
+}
+
 static void dispatch_rw_block_io(blkif_t *blkif,
 				 blkif_request_t *req,
 				 pending_req_t *pending_req)
@@ -1647,7 +1663,6 @@ static void make_response(blkif_t *blkif
 	blkif_response_t  resp;
 	unsigned long     flags;
 	blkif_back_rings_t *blk_rings = &blkif->blk_rings;
-	int more_to_do = 0;
 	int notify;
 
 	resp.id        = id;
@@ -1678,20 +1693,7 @@ static void make_response(blkif_t *blkif
 	blk_rings->common.rsp_prod_pvt++;
 	RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&blk_rings->common, notify);
 
-	if (blk_rings->common.rsp_prod_pvt == blk_rings->common.req_cons) {
-		/*
-		 * Tail check for pending requests. Allows frontend to avoid
-		 * notifications if requests are already in flight (lower
-		 * overheads and promotes batching).
-		 */
-		RING_FINAL_CHECK_FOR_REQUESTS(&blk_rings->common, more_to_do);
-	} else if (RING_HAS_UNCONSUMED_REQUESTS(&blk_rings->common)) {
-		more_to_do = 1;
-	}
-
 	spin_unlock_irqrestore(&blkif->blk_ring_lock, flags);
-	if (more_to_do)
-		blkif_notify_work(blkif);
 	if (notify)
 		notify_remote_via_irq(blkif->irq);
 }

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

From xen-changelog-bounces@lists.xen.org Fri Nov 23 11:00:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Nov 2012 11:00: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 1Tbqze-0006m7-M8; Fri, 23 Nov 2012 11:00: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 1Tbqzd-0006lz-DC
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 11:00:21 +0000
Received: from [193.109.254.147:16638] by server-8.bemta-14.messagelabs.com id
	3A/C8-05026-4475FA05; Fri, 23 Nov 2012 11:00:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1353668405!5081390!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19070 invoked from network); 23 Nov 2012 11:00:07 -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;
	23 Nov 2012 11:00: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 1TbqzN-0000ir-Ja
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 11:00:05 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TbqzN-0007iG-8f
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 11:00:05 +0000
Message-Id: <E1TbqzN-0007iG-8f@xenbits.xen.org>
Date: Fri, 23 Nov 2012 11:00:04 +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] scsiback: don't let in-flight
	requests defer pending ones
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353668030 -3600
# Node ID 39a26cb5fb0eb16bbfca425084b345c7130b6ad1
# Parent  ab5ce0b7fc2b5ee64ce96b0e1aa225a95a49d25b
scsiback: don't let in-flight requests defer pending ones

Running RING_FINAL_CHECK_FOR_REQUESTS from make_response is a bad
idea. It means that in-flight I/O is essentially blocking continued
batches. This essentially kills throughput on frontends which unplug
(or even just notify) early and rightfully assume additional requests
will be picked up on time, not synchronously.

Derived from a similar blkback patch by Daniel Stodden (see c/s
1118:c7c14595c18b).

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


diff -r ab5ce0b7fc2b -r 39a26cb5fb0e drivers/xen/scsiback/scsiback.c
--- a/drivers/xen/scsiback/scsiback.c	Fri Nov 23 11:52:49 2012 +0100
+++ b/drivers/xen/scsiback/scsiback.c	Fri Nov 23 11:53:50 2012 +0100
@@ -149,7 +149,6 @@ void scsiback_do_resp_with_sense(char *s
 	vscsiif_response_t *ring_res;
 	struct vscsibk_info *info = pending_req->info;
 	int notify;
-	int more_to_do = 1;
 	struct scsi_sense_hdr sshdr;
 	unsigned long flags;
 
@@ -182,17 +181,8 @@ void scsiback_do_resp_with_sense(char *s
 	ring_res->residual_len = resid;
 
 	RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&info->ring, notify);
-	if (info->ring.rsp_prod_pvt == info->ring.req_cons) {
-		RING_FINAL_CHECK_FOR_REQUESTS(&info->ring, more_to_do);
-	} else if (RING_HAS_UNCONSUMED_REQUESTS(&info->ring)) {
-		more_to_do = 1;
-	}
-	
 	spin_unlock_irqrestore(&info->ring_lock, flags);
 
-	if (more_to_do)
-		scsiback_notify_work(info);
-
 	if (notify)
 		notify_remote_via_irq(info->irq);
 
@@ -586,7 +576,7 @@ invalid_value:
 }
 
 
-static int scsiback_do_cmd_fn(struct vscsibk_info *info)
+static int _scsiback_do_cmd_fn(struct vscsibk_info *info)
 {
 	struct vscsiif_back_ring *ring = &info->ring;
 	vscsiif_request_t  *ring_req;
@@ -652,6 +642,21 @@ static int scsiback_do_cmd_fn(struct vsc
 	return more_to_do;
 }
 
+static int scsiback_do_cmd_fn(struct vscsibk_info *info)
+{
+	int more_to_do;
+
+	do {
+		more_to_do = _scsiback_do_cmd_fn(info);
+		if (more_to_do)
+			break;
+
+		RING_FINAL_CHECK_FOR_REQUESTS(&info->ring, more_to_do);
+	} while (more_to_do);
+
+	return more_to_do;
+}
+
 
 int scsiback_schedule(void *data)
 {

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

From xen-changelog-bounces@lists.xen.org Fri Nov 23 11:00:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Nov 2012 11:00: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 1Tbqze-0006m7-M8; Fri, 23 Nov 2012 11:00: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 1Tbqzd-0006lz-DC
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 11:00:21 +0000
Received: from [193.109.254.147:16638] by server-8.bemta-14.messagelabs.com id
	3A/C8-05026-4475FA05; Fri, 23 Nov 2012 11:00:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1353668405!5081390!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19070 invoked from network); 23 Nov 2012 11:00:07 -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;
	23 Nov 2012 11:00: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 1TbqzN-0000ir-Ja
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 11:00:05 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TbqzN-0007iG-8f
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 11:00:05 +0000
Message-Id: <E1TbqzN-0007iG-8f@xenbits.xen.org>
Date: Fri, 23 Nov 2012 11:00:04 +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] scsiback: don't let in-flight
	requests defer pending ones
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353668030 -3600
# Node ID 39a26cb5fb0eb16bbfca425084b345c7130b6ad1
# Parent  ab5ce0b7fc2b5ee64ce96b0e1aa225a95a49d25b
scsiback: don't let in-flight requests defer pending ones

Running RING_FINAL_CHECK_FOR_REQUESTS from make_response is a bad
idea. It means that in-flight I/O is essentially blocking continued
batches. This essentially kills throughput on frontends which unplug
(or even just notify) early and rightfully assume additional requests
will be picked up on time, not synchronously.

Derived from a similar blkback patch by Daniel Stodden (see c/s
1118:c7c14595c18b).

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


diff -r ab5ce0b7fc2b -r 39a26cb5fb0e drivers/xen/scsiback/scsiback.c
--- a/drivers/xen/scsiback/scsiback.c	Fri Nov 23 11:52:49 2012 +0100
+++ b/drivers/xen/scsiback/scsiback.c	Fri Nov 23 11:53:50 2012 +0100
@@ -149,7 +149,6 @@ void scsiback_do_resp_with_sense(char *s
 	vscsiif_response_t *ring_res;
 	struct vscsibk_info *info = pending_req->info;
 	int notify;
-	int more_to_do = 1;
 	struct scsi_sense_hdr sshdr;
 	unsigned long flags;
 
@@ -182,17 +181,8 @@ void scsiback_do_resp_with_sense(char *s
 	ring_res->residual_len = resid;
 
 	RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&info->ring, notify);
-	if (info->ring.rsp_prod_pvt == info->ring.req_cons) {
-		RING_FINAL_CHECK_FOR_REQUESTS(&info->ring, more_to_do);
-	} else if (RING_HAS_UNCONSUMED_REQUESTS(&info->ring)) {
-		more_to_do = 1;
-	}
-	
 	spin_unlock_irqrestore(&info->ring_lock, flags);
 
-	if (more_to_do)
-		scsiback_notify_work(info);
-
 	if (notify)
 		notify_remote_via_irq(info->irq);
 
@@ -586,7 +576,7 @@ invalid_value:
 }
 
 
-static int scsiback_do_cmd_fn(struct vscsibk_info *info)
+static int _scsiback_do_cmd_fn(struct vscsibk_info *info)
 {
 	struct vscsiif_back_ring *ring = &info->ring;
 	vscsiif_request_t  *ring_req;
@@ -652,6 +642,21 @@ static int scsiback_do_cmd_fn(struct vsc
 	return more_to_do;
 }
 
+static int scsiback_do_cmd_fn(struct vscsibk_info *info)
+{
+	int more_to_do;
+
+	do {
+		more_to_do = _scsiback_do_cmd_fn(info);
+		if (more_to_do)
+			break;
+
+		RING_FINAL_CHECK_FOR_REQUESTS(&info->ring, more_to_do);
+	} while (more_to_do);
+
+	return more_to_do;
+}
+
 
 int scsiback_schedule(void *data)
 {

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

From xen-changelog-bounces@lists.xen.org Fri Nov 23 16:44:16 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Nov 2012 16: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.xen.org>)
	id 1TbwMP-0004FS-Au; Fri, 23 Nov 2012 16:44:13 +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 1TbwMN-0004FF-Rg
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 16:44:12 +0000
Received: from [85.158.139.211:42669] by server-16.bemta-5.messagelabs.com id
	43/E1-04786-BD7AFA05; Fri, 23 Nov 2012 16:44:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-206.messagelabs.com!1353689049!19331829!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26571 invoked from network); 23 Nov 2012 16:44:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Nov 2012 16: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 1TbwMK-0004pD-TT
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 16:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TbwMK-0000Wn-Ig
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 16:44:08 +0000
Message-Id: <E1TbwMK-0000Wn-Ig@xenbits.xen.org>
Date: Fri, 23 Nov 2012 16:44:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: Suppress spurious warning
	message for cpupool-list
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353668774 0
# Node ID d66987697fe3eea05b51773db7e9f43572be2db9
# Parent  7b4449bdb980caee8efc498d5ea48f772331df2f
xl: Suppress spurious warning message for cpupool-list

libxl_cpupool_list() enumerates the cpupools by "probing": calling
cpupool_info, starting at 0 and stopping when it gets an error. However,
cpupool_info will print an error when the call to xc_cpupool_getinfo() fails,
resulting in every xl command that uses libxl_list_cpupool (such as
cpupool-list) printing that error message spuriously.

Since at the moment the times we want to print the message correspond
with the use of the existing "exact" parameter, use it to decide
whether to print the message or not.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 7b4449bdb980 -r d66987697fe3 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Thu Nov 22 10:47:58 2012 +0100
+++ b/tools/libxl/libxl.c	Fri Nov 23 11:06:14 2012 +0000
@@ -593,7 +593,8 @@ static int cpupool_info(libxl__gc *gc,
     xcinfo = xc_cpupool_getinfo(CTX->xch, poolid);
     if (xcinfo == NULL)
     {
-        LOGE(ERROR, "failed to get info for cpupool%d\n", poolid);
+        if (exact || errno != ENOENT)
+            LOGE(ERROR, "failed to get info for cpupool%d\n", poolid);
         return ERROR_FAIL;
     }
 

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

From xen-changelog-bounces@lists.xen.org Fri Nov 23 16:44:16 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Nov 2012 16: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.xen.org>)
	id 1TbwMP-0004FS-Au; Fri, 23 Nov 2012 16:44:13 +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 1TbwMN-0004FF-Rg
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 16:44:12 +0000
Received: from [85.158.139.211:42669] by server-16.bemta-5.messagelabs.com id
	43/E1-04786-BD7AFA05; Fri, 23 Nov 2012 16:44:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-206.messagelabs.com!1353689049!19331829!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26571 invoked from network); 23 Nov 2012 16:44:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Nov 2012 16: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 1TbwMK-0004pD-TT
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 16:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TbwMK-0000Wn-Ig
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 16:44:08 +0000
Message-Id: <E1TbwMK-0000Wn-Ig@xenbits.xen.org>
Date: Fri, 23 Nov 2012 16:44:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: Suppress spurious warning
	message for cpupool-list
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353668774 0
# Node ID d66987697fe3eea05b51773db7e9f43572be2db9
# Parent  7b4449bdb980caee8efc498d5ea48f772331df2f
xl: Suppress spurious warning message for cpupool-list

libxl_cpupool_list() enumerates the cpupools by "probing": calling
cpupool_info, starting at 0 and stopping when it gets an error. However,
cpupool_info will print an error when the call to xc_cpupool_getinfo() fails,
resulting in every xl command that uses libxl_list_cpupool (such as
cpupool-list) printing that error message spuriously.

Since at the moment the times we want to print the message correspond
with the use of the existing "exact" parameter, use it to decide
whether to print the message or not.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 7b4449bdb980 -r d66987697fe3 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Thu Nov 22 10:47:58 2012 +0100
+++ b/tools/libxl/libxl.c	Fri Nov 23 11:06:14 2012 +0000
@@ -593,7 +593,8 @@ static int cpupool_info(libxl__gc *gc,
     xcinfo = xc_cpupool_getinfo(CTX->xch, poolid);
     if (xcinfo == NULL)
     {
-        LOGE(ERROR, "failed to get info for cpupool%d\n", poolid);
+        if (exact || errno != ENOENT)
+            LOGE(ERROR, "failed to get info for cpupool%d\n", poolid);
         return ERROR_FAIL;
     }
 

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

From xen-changelog-bounces@lists.xen.org Fri Nov 23 16:44:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Nov 2012 16: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 1TbwMR-0004Fk-GD; Fri, 23 Nov 2012 16:44:15 +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 1TbwMP-0004FR-NN
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 16:44:13 +0000
Received: from [85.158.137.99:15748] by server-8.bemta-3.messagelabs.com id
	72/E3-07786-DD7AFA05; Fri, 23 Nov 2012 16:44:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-217.messagelabs.com!1353689050!15293645!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27367 invoked from network); 23 Nov 2012 16:44:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Nov 2012 16: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 1TbwML-0004pJ-Rx
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 16:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TbwML-0000XH-M3
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 16:44:09 +0000
Message-Id: <E1TbwML-0000XH-M3@xenbits.xen.org>
Date: Fri, 23 Nov 2012 16:44:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xend: enable environment passing in
	xPopen3
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353668775 0
# Node ID 0049de3827bcfe3488dc6c7b7a60327a562aee5c
# Parent  d76b7afc36afa2d92610b19a43696afe54c67224
xend: enable environment passing in xPopen3

In changeset 19990:38dd208e1d95 a new parameter 'env' was added to
xPopen3, but no code was added to actually pass the environment down to
execvpe. Also, the new code was unreachable.

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


diff -r d76b7afc36af -r 0049de3827bc tools/python/xen/util/xpopen.py
--- a/tools/python/xen/util/xpopen.py	Fri Nov 23 11:06:14 2012 +0000
+++ b/tools/python/xen/util/xpopen.py	Fri Nov 23 11:06:15 2012 +0000
@@ -104,7 +104,7 @@ class xPopen3:
             os.dup2(c2pwrite, 1)
             if capturestderr:
                 os.dup2(errin, 2)
-            self._run_child(cmd)
+            self._run_child(cmd, env)
         os.close(p2cread)
         self.tochild = os.fdopen(p2cwrite, 'w', bufsize)
         os.close(c2pwrite)
@@ -116,7 +116,7 @@ class xPopen3:
             self.childerr = None
         _active.append(self)
 
-    def _run_child(self, cmd):
+    def _run_child(self, cmd, env):
         if isinstance(cmd, basestring):
             cmd = ['/bin/sh', '-c', cmd]
         for i in range(3, MAXFD):
@@ -127,7 +127,6 @@ class xPopen3:
             except OSError:
                 pass
         try:
-            os.execvp(cmd[0], cmd)
             if env is None:
                 os.execvp(cmd[0], cmd)
             else:

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

From xen-changelog-bounces@lists.xen.org Fri Nov 23 16:44:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Nov 2012 16: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 1TbwMR-0004Fk-GD; Fri, 23 Nov 2012 16:44:15 +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 1TbwMP-0004FR-NN
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 16:44:13 +0000
Received: from [85.158.137.99:15748] by server-8.bemta-3.messagelabs.com id
	72/E3-07786-DD7AFA05; Fri, 23 Nov 2012 16:44:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-217.messagelabs.com!1353689050!15293645!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27367 invoked from network); 23 Nov 2012 16:44:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Nov 2012 16: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 1TbwML-0004pJ-Rx
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 16:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TbwML-0000XH-M3
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 16:44:09 +0000
Message-Id: <E1TbwML-0000XH-M3@xenbits.xen.org>
Date: Fri, 23 Nov 2012 16:44:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xend: enable environment passing in
	xPopen3
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353668775 0
# Node ID 0049de3827bcfe3488dc6c7b7a60327a562aee5c
# Parent  d76b7afc36afa2d92610b19a43696afe54c67224
xend: enable environment passing in xPopen3

In changeset 19990:38dd208e1d95 a new parameter 'env' was added to
xPopen3, but no code was added to actually pass the environment down to
execvpe. Also, the new code was unreachable.

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


diff -r d76b7afc36af -r 0049de3827bc tools/python/xen/util/xpopen.py
--- a/tools/python/xen/util/xpopen.py	Fri Nov 23 11:06:14 2012 +0000
+++ b/tools/python/xen/util/xpopen.py	Fri Nov 23 11:06:15 2012 +0000
@@ -104,7 +104,7 @@ class xPopen3:
             os.dup2(c2pwrite, 1)
             if capturestderr:
                 os.dup2(errin, 2)
-            self._run_child(cmd)
+            self._run_child(cmd, env)
         os.close(p2cread)
         self.tochild = os.fdopen(p2cwrite, 'w', bufsize)
         os.close(c2pwrite)
@@ -116,7 +116,7 @@ class xPopen3:
             self.childerr = None
         _active.append(self)
 
-    def _run_child(self, cmd):
+    def _run_child(self, cmd, env):
         if isinstance(cmd, basestring):
             cmd = ['/bin/sh', '-c', cmd]
         for i in range(3, MAXFD):
@@ -127,7 +127,6 @@ class xPopen3:
             except OSError:
                 pass
         try:
-            os.execvp(cmd[0], cmd)
             if env is None:
                 os.execvp(cmd[0], cmd)
             else:

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

From xen-changelog-bounces@lists.xen.org Fri Nov 23 16:44:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Nov 2012 16: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 1TbwMQ-0004Fd-DS; Fri, 23 Nov 2012 16: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 1TbwMO-0004FL-On
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 16:44:13 +0000
Received: from [85.158.139.211:42717] by server-12.bemta-5.messagelabs.com id
	D6/23-02886-CD7AFA05; Fri, 23 Nov 2012 16:44:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-206.messagelabs.com!1353689049!21339768!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10913 invoked from network); 23 Nov 2012 16:44:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Nov 2012 16: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 1TbwML-0004pG-9v
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 16:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TbwML-0000X2-5T
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 16:44:09 +0000
Message-Id: <E1TbwML-0000X2-5T@xenbits.xen.org>
Date: Fri, 23 Nov 2012 16:44:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: Tidy up flush_xen_dcache().
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353668774 0
# Node ID d76b7afc36afa2d92610b19a43696afe54c67224
# Parent  d66987697fe3eea05b51773db7e9f43572be2db9
arm: Tidy up flush_xen_dcache().

 - Use a compile-time-constant check for whether we can safely flush
   just one cacheline.  This reduces the common case from 28
   instructions to three.
 - Pass an object to the macro, not a pointer, so we can detect
   attempts to flush arrays.
 - Decode CCSIDR correctly to get cacheline size.
 - Remove some redundant DSBs at the call sites.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r d66987697fe3 -r d76b7afc36af xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c	Fri Nov 23 11:06:14 2012 +0000
+++ b/xen/arch/arm/mm.c	Fri Nov 23 11:06:14 2012 +0000
@@ -247,7 +247,7 @@ void __init setup_pagetables(unsigned lo
 
     /* Change pagetables to the copy in the relocated Xen */
     boot_httbr = (unsigned long) xen_pgtable + phys_offset;
-    flush_xen_dcache_va(&boot_httbr);
+    flush_xen_dcache(boot_httbr);
     flush_xen_dcache_va_range((void*)dest_va, _end - _start);
     flush_xen_text_tlb();
 
diff -r d66987697fe3 -r d76b7afc36af xen/arch/arm/setup.c
--- a/xen/arch/arm/setup.c	Fri Nov 23 11:06:14 2012 +0000
+++ b/xen/arch/arm/setup.c	Fri Nov 23 11:06:14 2012 +0000
@@ -175,6 +175,21 @@ static void __init setup_mm(unsigned lon
     end_boot_allocator();
 }
 
+size_t __read_mostly cacheline_bytes;
+
+/* Very early check of the CPU cache properties */
+void __init setup_cache(void)
+{
+    uint32_t ccsid;
+
+    /* Read the cache size ID register for the level-0 data cache */
+    WRITE_CP32(0, CSSELR);
+    ccsid = READ_CP32(CCSIDR);
+
+    /* Low 3 bits are log2(cacheline size in words) - 2. */
+    cacheline_bytes = 1U << (4 + (ccsid & 0x7));
+}
+
 /* C entry point for boot CPU */
 void __init start_xen(unsigned long boot_phys_offset,
                       unsigned long arm_type,
@@ -185,6 +200,8 @@ void __init start_xen(unsigned long boot
     size_t fdt_size;
     int cpus, i;
 
+    setup_cache();
+
     smp_clear_cpu_maps();
 
     fdt = (void *)BOOT_MISC_VIRT_START
diff -r d66987697fe3 -r d76b7afc36af xen/arch/arm/smpboot.c
--- a/xen/arch/arm/smpboot.c	Fri Nov 23 11:06:14 2012 +0000
+++ b/xen/arch/arm/smpboot.c	Fri Nov 23 11:06:14 2012 +0000
@@ -118,8 +118,8 @@ make_cpus_ready(unsigned int max_cpus, u
         /* Tell the next CPU to get ready */
         /* TODO: handle boards where CPUIDs are not contiguous */
         *gate = i;
-        flush_xen_dcache_va(gate);
-        asm volatile("dsb; isb; sev");
+        flush_xen_dcache(*gate);
+        asm volatile("isb; sev");
         /* And wait for it to respond */
         while ( ready_cpus < i )
             smp_rmb();
@@ -217,8 +217,8 @@ int __cpu_up(unsigned int cpu)
     smp_up_cpu = cpu;
     /* we need to make sure that the change to smp_up_cpu is visible to
      * secondary cpus with D-cache off */
-    flush_xen_dcache_va(&smp_up_cpu);
-    asm volatile("dsb; isb; sev");
+    flush_xen_dcache(smp_up_cpu);
+    asm volatile("isb; sev");
 
     while ( !cpu_online(cpu) )
     {
diff -r d66987697fe3 -r d76b7afc36af xen/include/asm-arm/page.h
--- a/xen/include/asm-arm/page.h	Fri Nov 23 11:06:14 2012 +0000
+++ b/xen/include/asm-arm/page.h	Fri Nov 23 11:06:14 2012 +0000
@@ -248,13 +248,16 @@ static inline void write_pte(lpae_t *p, 
         : : "r" (pte.bits), "r" (p) : "memory");
 }
 
+/* Architectural minimum cacheline size is 4 32-bit words. */
+#define MIN_CACHELINE_BYTES 16
+/* Actual cacheline size on the boot CPU. */
+extern size_t cacheline_bytes;
 
 /* Function for flushing medium-sized areas.
  * if 'range' is large enough we might want to use model-specific
  * full-cache flushes. */
 static inline void flush_xen_dcache_va_range(void *p, unsigned long size)
 {
-    int cacheline_bytes  = READ_CP32(CCSIDR);
     void *end;
     dsb();           /* So the CPU issues all writes to the range */
     for ( end = p + size; p < end; p += cacheline_bytes )
@@ -262,17 +265,13 @@ static inline void flush_xen_dcache_va_r
     dsb();           /* So we know the flushes happen before continuing */
 }
 
-
 /* Macro for flushing a single small item.  The predicate is always
  * compile-time constant so this will compile down to 3 instructions in
- * the common case.  Make sure to call it with the correct type of
- * pointer! */
-#define flush_xen_dcache_va(p) do {                                     \
-    int cacheline_bytes  = READ_CP32(CCSIDR);                           \
-    typeof(p) _p = (p);                                                 \
-    if ( ((unsigned long)_p & ~(cacheline_bytes - 1)) !=                \
-        (((unsigned long)_p + (sizeof *_p)) & ~(cacheline_bytes - 1)) ) \
-        flush_xen_dcache_va_range(_p, sizeof *_p);                      \
+ * the common case. */
+#define flush_xen_dcache(x) do {                                        \
+    typeof(x) *_p = &(x);                                               \
+    if ( sizeof(x) > MIN_CACHELINE_BYTES || sizeof(x) > alignof(x) )    \
+        flush_xen_dcache_va_range(_p, sizeof(x));                       \
     else                                                                \
         asm volatile (                                                  \
             "dsb;"   /* Finish all earlier writes */                    \
diff -r d66987697fe3 -r d76b7afc36af xen/include/xen/compiler.h
--- a/xen/include/xen/compiler.h	Fri Nov 23 11:06:14 2012 +0000
+++ b/xen/include/xen/compiler.h	Fri Nov 23 11:06:14 2012 +0000
@@ -54,6 +54,10 @@
 
 #define offsetof(a,b) __builtin_offsetof(a,b)
 
+#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L
+#define alignof __alignof__
+#endif
+
 /* &a[0] degrades to a pointer: a different type from an array */
 #define __must_be_array(a) \
   BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))

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

From xen-changelog-bounces@lists.xen.org Fri Nov 23 16:44:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Nov 2012 16: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 1TbwMQ-0004Fd-DS; Fri, 23 Nov 2012 16: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 1TbwMO-0004FL-On
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 16:44:13 +0000
Received: from [85.158.139.211:42717] by server-12.bemta-5.messagelabs.com id
	D6/23-02886-CD7AFA05; Fri, 23 Nov 2012 16:44:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-206.messagelabs.com!1353689049!21339768!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10913 invoked from network); 23 Nov 2012 16:44:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	23 Nov 2012 16: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 1TbwML-0004pG-9v
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 16:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TbwML-0000X2-5T
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 16:44:09 +0000
Message-Id: <E1TbwML-0000X2-5T@xenbits.xen.org>
Date: Fri, 23 Nov 2012 16:44:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: Tidy up flush_xen_dcache().
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353668774 0
# Node ID d76b7afc36afa2d92610b19a43696afe54c67224
# Parent  d66987697fe3eea05b51773db7e9f43572be2db9
arm: Tidy up flush_xen_dcache().

 - Use a compile-time-constant check for whether we can safely flush
   just one cacheline.  This reduces the common case from 28
   instructions to three.
 - Pass an object to the macro, not a pointer, so we can detect
   attempts to flush arrays.
 - Decode CCSIDR correctly to get cacheline size.
 - Remove some redundant DSBs at the call sites.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r d66987697fe3 -r d76b7afc36af xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c	Fri Nov 23 11:06:14 2012 +0000
+++ b/xen/arch/arm/mm.c	Fri Nov 23 11:06:14 2012 +0000
@@ -247,7 +247,7 @@ void __init setup_pagetables(unsigned lo
 
     /* Change pagetables to the copy in the relocated Xen */
     boot_httbr = (unsigned long) xen_pgtable + phys_offset;
-    flush_xen_dcache_va(&boot_httbr);
+    flush_xen_dcache(boot_httbr);
     flush_xen_dcache_va_range((void*)dest_va, _end - _start);
     flush_xen_text_tlb();
 
diff -r d66987697fe3 -r d76b7afc36af xen/arch/arm/setup.c
--- a/xen/arch/arm/setup.c	Fri Nov 23 11:06:14 2012 +0000
+++ b/xen/arch/arm/setup.c	Fri Nov 23 11:06:14 2012 +0000
@@ -175,6 +175,21 @@ static void __init setup_mm(unsigned lon
     end_boot_allocator();
 }
 
+size_t __read_mostly cacheline_bytes;
+
+/* Very early check of the CPU cache properties */
+void __init setup_cache(void)
+{
+    uint32_t ccsid;
+
+    /* Read the cache size ID register for the level-0 data cache */
+    WRITE_CP32(0, CSSELR);
+    ccsid = READ_CP32(CCSIDR);
+
+    /* Low 3 bits are log2(cacheline size in words) - 2. */
+    cacheline_bytes = 1U << (4 + (ccsid & 0x7));
+}
+
 /* C entry point for boot CPU */
 void __init start_xen(unsigned long boot_phys_offset,
                       unsigned long arm_type,
@@ -185,6 +200,8 @@ void __init start_xen(unsigned long boot
     size_t fdt_size;
     int cpus, i;
 
+    setup_cache();
+
     smp_clear_cpu_maps();
 
     fdt = (void *)BOOT_MISC_VIRT_START
diff -r d66987697fe3 -r d76b7afc36af xen/arch/arm/smpboot.c
--- a/xen/arch/arm/smpboot.c	Fri Nov 23 11:06:14 2012 +0000
+++ b/xen/arch/arm/smpboot.c	Fri Nov 23 11:06:14 2012 +0000
@@ -118,8 +118,8 @@ make_cpus_ready(unsigned int max_cpus, u
         /* Tell the next CPU to get ready */
         /* TODO: handle boards where CPUIDs are not contiguous */
         *gate = i;
-        flush_xen_dcache_va(gate);
-        asm volatile("dsb; isb; sev");
+        flush_xen_dcache(*gate);
+        asm volatile("isb; sev");
         /* And wait for it to respond */
         while ( ready_cpus < i )
             smp_rmb();
@@ -217,8 +217,8 @@ int __cpu_up(unsigned int cpu)
     smp_up_cpu = cpu;
     /* we need to make sure that the change to smp_up_cpu is visible to
      * secondary cpus with D-cache off */
-    flush_xen_dcache_va(&smp_up_cpu);
-    asm volatile("dsb; isb; sev");
+    flush_xen_dcache(smp_up_cpu);
+    asm volatile("isb; sev");
 
     while ( !cpu_online(cpu) )
     {
diff -r d66987697fe3 -r d76b7afc36af xen/include/asm-arm/page.h
--- a/xen/include/asm-arm/page.h	Fri Nov 23 11:06:14 2012 +0000
+++ b/xen/include/asm-arm/page.h	Fri Nov 23 11:06:14 2012 +0000
@@ -248,13 +248,16 @@ static inline void write_pte(lpae_t *p, 
         : : "r" (pte.bits), "r" (p) : "memory");
 }
 
+/* Architectural minimum cacheline size is 4 32-bit words. */
+#define MIN_CACHELINE_BYTES 16
+/* Actual cacheline size on the boot CPU. */
+extern size_t cacheline_bytes;
 
 /* Function for flushing medium-sized areas.
  * if 'range' is large enough we might want to use model-specific
  * full-cache flushes. */
 static inline void flush_xen_dcache_va_range(void *p, unsigned long size)
 {
-    int cacheline_bytes  = READ_CP32(CCSIDR);
     void *end;
     dsb();           /* So the CPU issues all writes to the range */
     for ( end = p + size; p < end; p += cacheline_bytes )
@@ -262,17 +265,13 @@ static inline void flush_xen_dcache_va_r
     dsb();           /* So we know the flushes happen before continuing */
 }
 
-
 /* Macro for flushing a single small item.  The predicate is always
  * compile-time constant so this will compile down to 3 instructions in
- * the common case.  Make sure to call it with the correct type of
- * pointer! */
-#define flush_xen_dcache_va(p) do {                                     \
-    int cacheline_bytes  = READ_CP32(CCSIDR);                           \
-    typeof(p) _p = (p);                                                 \
-    if ( ((unsigned long)_p & ~(cacheline_bytes - 1)) !=                \
-        (((unsigned long)_p + (sizeof *_p)) & ~(cacheline_bytes - 1)) ) \
-        flush_xen_dcache_va_range(_p, sizeof *_p);                      \
+ * the common case. */
+#define flush_xen_dcache(x) do {                                        \
+    typeof(x) *_p = &(x);                                               \
+    if ( sizeof(x) > MIN_CACHELINE_BYTES || sizeof(x) > alignof(x) )    \
+        flush_xen_dcache_va_range(_p, sizeof(x));                       \
     else                                                                \
         asm volatile (                                                  \
             "dsb;"   /* Finish all earlier writes */                    \
diff -r d66987697fe3 -r d76b7afc36af xen/include/xen/compiler.h
--- a/xen/include/xen/compiler.h	Fri Nov 23 11:06:14 2012 +0000
+++ b/xen/include/xen/compiler.h	Fri Nov 23 11:06:14 2012 +0000
@@ -54,6 +54,10 @@
 
 #define offsetof(a,b) __builtin_offsetof(a,b)
 
+#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L
+#define alignof __alignof__
+#endif
+
 /* &a[0] degrades to a pointer: a different type from an array */
 #define __must_be_array(a) \
   BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))

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

From xen-changelog-bounces@lists.xen.org Fri Nov 23 20:58:32 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Nov 2012 20:58: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 1Tc0KQ-0002oU-HM; Fri, 23 Nov 2012 20:58:26 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Tc0KO-0002oJ-BI
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 20:58:25 +0000
Received: from [85.158.139.83:53197] by server-3.bemta-5.messagelabs.com id
	B1/AB-18736-F63EFA05; Fri, 23 Nov 2012 20:58:23 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-8.tower-182.messagelabs.com!1353704297!20405954!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.8 required=7.0 tests=BODY_RANDOM_LONG,
	MAILTO_TO_SPAM_ADDR
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23196 invoked from network); 23 Nov 2012 20:58:18 -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;
	23 Nov 2012 20:58:18 -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 1Tc0KH-0007f9-Fq
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 20:58:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Tc0KG-0007c3-KK
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 20:58:17 +0000
Date: Fri, 23 Nov 2012 20:58:16 +0000
Message-Id: <E1Tc0KG-0007c3-KK@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] Merge remote branch
	'xen-staging/master' into temp
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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

=== This changeset includes merge from high-traffic branch ===
Commits on that branch are not reported individually.

commit 1e6f3bf92c84d9ba8fdc61f4deb1777e737c7a2c
Merge: a8abf479276d54acbad4c3eade232897443e1189 cdf4d2bb4006805f209712fbb8ed1f83127e9984
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Commit: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

    Merge remote branch 'xen-staging/master' into temp

 .exrc                                          |    7 +
 .gitignore                                     |   21 +-
 .gitmodules                                    |    3 +
 .mailmap                                       |   16 +
 CODING_STYLE                                   |    5 +-
 Changelog                                      |    6 +-
 HACKING                                        |   21 +-
 LICENSE                                        |    4 +-
 MAINTAINERS                                    |  243 +-
 Makefile                                       |  276 +-
 Makefile.dis                                   |    3 -
 Makefile.hw                                    |   25 -
 Makefile.objs                                  |  397 +-
 Makefile.target                                |  398 +-
 Makefile.user                                  |    5 +-
 QMP/qemu-ga-client                             |  299 +
 QMP/qmp                                        |  126 +
 QMP/qmp-events.txt                             |  282 +-
 QMP/qmp-shell                                  |   46 +-
 QMP/qmp-spec.txt                               |   28 +-
 QMP/qmp.py                                     |   39 +-
 QMP/qom-fuse                                   |  138 +
 QMP/qom-get                                    |   67 +
 QMP/qom-list                                   |   64 +
 QMP/qom-set                                    |   64 +
 README                                         |    4 +-
 VERSION                                        |    2 +-
 aio-posix.c                                    |  268 +
 aio-win32.c                                    |  215 +
 aio.c                                          |  230 -
 arch_init.c                                    |  707 +-
 arch_init.h                                    |    8 +-
 arm-dis.c                                      |    6 +-
 arm-semi.c                                     |  509 -
 async.c                                        |  124 +-
 audio/Makefile.objs                            |   14 +
 audio/audio.c                                  |   39 +-
 audio/audio_int.h                              |    6 +
 audio/audio_pt_int.c                           |    1 +
 audio/audio_template.h                         |    8 +-
 audio/esdaudio.c                               |    2 +-
 audio/paaudio.c                                |  503 +-
 audio/spiceaudio.c                             |   41 +
 audio/wavcapture.c                             |    1 +
 audio/winwaveaudio.c                           |   14 +-
 backends/Makefile.objs                         |    2 +
 backends/rng-egd.c                             |  224 +
 backends/rng-random.c                          |  161 +
 backends/rng.c                                 |   93 +
 balloon.c                                      |   44 +-
 balloon.h                                      |    3 +-
 bitops.h                                       |  116 +-
 block-migration.c                              |  240 +-
 block.c                                        | 2448 +-
 block.h                                        |  184 +-
 block/Makefile.objs                            |   20 +
 block/blkdebug.c                               |  124 +-
 block/blkverify.c                              |   32 +-
 block/commit.c                                 |  259 +
 block/cow.c                                    |   98 +-
 block/curl.c                                   |   29 +-
 block/gluster.c                                |  624 +
 block/iscsi.c                                  |  740 +-
 block/linux-aio.c                              |  216 +
 block/mirror.c                                 |  322 +
 block/nbd.c                                    |  463 +-
 block/qcow.c                                   |  136 +-
 block/qcow2-cache.c                            |   43 +-
 block/qcow2-cluster.c                          |  655 +-
 block/qcow2-refcount.c                         |  266 +-
 block/qcow2-snapshot.c                         |  382 +-
 block/qcow2.c                                  |  661 +-
 block/qcow2.h                                  |  102 +-
 block/qed-check.c                              |   37 +
 block/qed-l2-cache.c                           |   22 +-
 block/qed-table.c                              |   25 +-
 block/qed.c                                    |  286 +-
 block/qed.h                                    |   14 +-
 block/raw-aio.h                                |   48 +
 block/raw-posix-aio.h                          |   43 -
 block/raw-posix.c                              |  696 +-
 block/raw-win32.c                              |  265 +-
 block/raw.c                                    |   22 +-
 block/rbd.c                                    |  142 +-
 block/sheepdog.c                               |  775 +-
 block/stream.c                                 |  236 +
 block/vdi.c                                    |  505 +-
 block/vmdk.c                                   |  145 +-
 block/vpc.c                                    |  300 +-
 block/vvfat.c                                  |   89 +-
 block/win32-aio.c                              |  226 +
 block_int.h                                    |  201 +-
 blockdev-nbd.c                                 |  133 +
 blockdev.c                                     |  954 +-
 blockdev.h                                     |   15 +-
 blockjob.c                                     |  283 +
 blockjob.h                                     |  278 +
 bsd-user/Makefile.objs                         |    2 +
 bsd-user/bsdload.c                             |    2 +-
 bsd-user/elfload.c                             |   16 +-
 bsd-user/main.c                                |   21 +-
 bsd-user/qemu.h                                |   12 +-
 bsd-user/signal.c                              |    2 +-
 bsd-user/x86_64/syscall.h                      |    2 +-
 bt-host.c                                      |    1 +
 buffered_file.c                                |  154 +-
 buffered_file.h                                |   12 +-
 cache-utils.h                                  |    5 +-
 check-qdict.c                                  |  402 -
 check-qfloat.c                                 |   76 -
 check-qint.c                                   |  113 -
 check-qjson.c                                  |  795 -
 check-qlist.c                                  |  153 -
 check-qstring.c                                |  134 -
 cmd.c                                          |   50 +-
 compatfd.c                                     |    2 +
 compiler.h                                     |    9 +-
 configure                                      | 1350 +-
 console.c                                      |  337 +-
 console.h                                      |  274 +-
 coroutine-gthread.c                            |  101 +-
 coroutine-sigaltstack.c                        |  334 +
 coroutine-ucontext.c                           |   42 +-
 cpu-all.h                                      |  217 +-
 cpu-common.h                                   |  159 +-
 cpu-defs.h                                     |   30 +-
 cpu-exec.c                                     |  112 +-
 cpus.c                                         |  530 +-
 cpus.h                                         |    2 +
 cputlb.c                                       |  361 +
 cputlb.h                                       |   46 +
 cris-dis.c                                     |   34 +-
 cursor.c                                       |    3 +-
 cutils.c                                       |  242 +-
 darwin-user/commpage.c                         |  357 -
 darwin-user/ioctls.h                           |    4 -
 darwin-user/ioctls_types.h                     |    1 -
 darwin-user/machload.c                         |  902 -
 darwin-user/main.c                             | 1024 -
 darwin-user/mmap.c                             |  409 -
 darwin-user/qemu.h                             |  178 -
 darwin-user/signal.c                           |  453 -
 darwin-user/syscall.c                          | 1566 -
 darwin-user/syscalls.h                         |  384 -
 def-helper.h                                   |   37 +-
 default-configs/alpha-softmmu.mak              |    2 +
 default-configs/arm-softmmu.mak                |   20 +
 default-configs/i386-darwin-user.mak           |    1 -
 default-configs/i386-softmmu.mak               |    3 +
 default-configs/microblaze-softmmu.mak         |    4 +
 default-configs/microblazeel-softmmu.mak       |    4 +
 default-configs/mips-softmmu.mak               |    3 +
 default-configs/mips64-linux-user.mak          |    1 +
 default-configs/mips64-softmmu.mak             |    3 +
 default-configs/mips64el-linux-user.mak        |    1 +
 default-configs/mips64el-softmmu.mak           |    3 +
 default-configs/mipsel-softmmu.mak             |    3 +
 default-configs/mipsn32-linux-user.mak         |    1 +
 default-configs/mipsn32el-linux-user.mak       |    1 +
 default-configs/or32-linux-user.mak            |    1 +
 default-configs/or32-softmmu.mak               |    4 +
 default-configs/pci.mak                        |    6 +
 default-configs/ppc-darwin-user.mak            |    3 -
 default-configs/ppc-softmmu.mak                |    5 +
 default-configs/ppc64-softmmu.mak              |    2 +
 default-configs/ppcemb-softmmu.mak             |    2 +
 default-configs/sparc64-softmmu.mak            |    1 +
 default-configs/unicore32-softmmu.mak          |    4 +
 default-configs/x86_64-softmmu.mak             |    3 +
 device_tree.c                                  |  153 +-
 device_tree.h                                  |   28 +-
 dis-asm.h                                      |    3 +
 disas.c                                        |  190 +-
 disas.h                                        |    7 +-
 dma-helpers.c                                  |  270 +-
 dma.h                                          |  249 +-
 docs/bootindex.txt                             |    2 +-
 docs/ccid.txt                                  |    2 +-
 docs/libcacard.txt                             |   26 +-
 docs/live-block-ops.txt                        |   58 +
 docs/memory.txt                                |    6 +-
 docs/migration.txt                             |   12 +
 docs/qapi-code-gen.txt                         |    6 +-
 docs/qemupciserial.inf                         |  109 +
 docs/specs/acpi_pci_hotplug.txt                |   18 +-
 docs/specs/ivshmem_device_spec.txt             |    2 +-
 docs/specs/pci-serial.txt                      |   34 +
 docs/specs/ppc-spapr-hcalls.txt                |   78 +
 docs/specs/qcow2.txt                           |  140 +-
 docs/specs/standard-vga.txt                    |   65 +
 docs/tracing.txt                               |   61 +-
 docs/usb-storage.txt                           |   38 +
 docs/usb2.txt                                  |   15 +
 docs/writing-qmp-commands.txt                  |  649 +
 docs/xbzrle.txt                                |  128 +
 dump-stub.c                                    |   64 +
 dump.c                                         |  865 +
 dump.h                                         |   35 +
 dyngen-exec.h                                  |   70 -
 elf.h                                          |   44 +
 error.c                                        |  121 +-
 error.h                                        |   50 +-
 error_int.h                                    |   29 -
 event_notifier-posix.c                         |  120 +
 event_notifier-win32.c                         |   59 +
 event_notifier.c                               |   61 -
 event_notifier.h                               |   36 +-
 exec-all.h                                     |  184 +-
 exec-memory.h                                  |    9 +-
 exec.c                                         | 2788 +-
 fpu/softfloat-macros.h                         |   18 +-
 fpu/softfloat-specialize.h                     |  107 +-
 fpu/softfloat.c                                |  144 +-
 fpu/softfloat.h                                |   22 +-
 fsdev/Makefile.objs                            |    9 +
 fsdev/file-op-9p.h                             |   25 +-
 fsdev/qemu-fsdev-dummy.c                       |    1 +
 fsdev/qemu-fsdev.c                             |   45 +-
 fsdev/qemu-fsdev.h                             |   11 +-
 fsdev/virtfs-proxy-helper.c                    | 1115 +
 fsdev/virtfs-proxy-helper.texi                 |   63 +
 fsdev/virtio-9p-marshal.c                      |  323 +
 fsdev/virtio-9p-marshal.h                      |   90 +
 gdbstub.c                                      |  384 +-
 gdbstub.h                                      |   25 +-
 gen-icount.h                                   |   10 +-
 hmp-commands.hx                                |  349 +-
 hmp.c                                          |  834 +-
 hmp.h                                          |   43 +
 hppa-dis.c                                     |    2 +-
 hw/9pfs/Makefile.objs                          |    9 +
 hw/9pfs/codir.c                                |    6 +-
 hw/9pfs/cofile.c                               |   14 +
 hw/9pfs/virtio-9p-coth.h                       |    2 +-
 hw/9pfs/virtio-9p-device.c                     |   74 +-
 hw/9pfs/virtio-9p-handle.c                     |   28 +-
 hw/9pfs/virtio-9p-local.c                      |  387 +-
 hw/9pfs/virtio-9p-posix-acl.c                  |    6 +-
 hw/9pfs/virtio-9p-proxy.c                      | 1210 +
 hw/9pfs/virtio-9p-proxy.h                      |   95 +
 hw/9pfs/virtio-9p-synth.c                      |    4 +-
 hw/9pfs/virtio-9p-xattr-user.c                 |    3 +-
 hw/9pfs/virtio-9p-xattr.c                      |    3 +-
 hw/9pfs/virtio-9p.c                            |  790 +-
 hw/9pfs/virtio-9p.h                            |   83 +-
 hw/Makefile.objs                               |  209 +
 hw/a15mpcore.c                                 |  108 +
 hw/a9mpcore.c                                  |  243 +-
 hw/ac97.c                                      |  392 +-
 hw/acpi.c                                      |  206 +-
 hw/acpi.h                                      |   93 +-
 hw/acpi_piix4.c                                |  355 +-
 hw/adb.c                                       |    8 +-
 hw/adb.h                                       |    4 -
 hw/adlib.c                                     |    4 +-
 hw/ads7846.c                                   |   34 +-
 hw/alpha/Makefile.objs                         |    4 +
 hw/alpha_dp264.c                               |   32 +-
 hw/alpha_pci.c                                 |   37 +-
 hw/alpha_sys.h                                 |    6 +-
 hw/alpha_typhoon.c                             |   84 +-
 hw/an5206.c                                    |   20 +-
 hw/apb_pci.c                                   |  179 +-
 hw/apb_pci.h                                   |    7 +-
 hw/apic-msidef.h                               |   30 +
 hw/apic.c                                      |  564 +-
 hw/apic.h                                      |    9 +-
 hw/apic_common.c                               |  402 +
 hw/apic_internal.h                             |  149 +
 hw/apm.c                                       |    3 +
 hw/applesmc.c                                  |   38 +-
 hw/arm-misc.h                                  |   37 +-
 hw/arm/Makefile.objs                           |   35 +
 hw/arm11mpcore.c                               |  214 +-
 hw/arm_boot.c                                  |  275 +-
 hw/arm_gic.c                                   |  552 +-
 hw/arm_gic_common.c                            |  184 +
 hw/arm_gic_internal.h                          |  136 +
 hw/arm_l2x0.c                                  |  194 +
 hw/arm_mptimer.c                               |  344 +
 hw/arm_pic.c                                   |    8 +-
 hw/arm_sysctl.c                                |   59 +-
 hw/arm_timer.c                                 |  127 +-
 hw/armv7m.c                                    |   80 +-
 hw/armv7m_nvic.c                               |  271 +-
 hw/audiodev.h                                  |    8 +-
 hw/axis_dev88.c                                |   86 +-
 hw/baum.c                                      |    7 +-
 hw/baum.h                                      |    2 +-
 hw/bitbang_i2c.c                               |   32 +-
 hw/blizzard.c                                  |   12 +-
 hw/block-common.c                              |   64 +
 hw/block-common.h                              |   79 +
 hw/boards.h                                    |   22 +-
 hw/bonito.c                                    |  420 +-
 hw/bt-hci-csr.c                                |    2 +-
 hw/bt-hci.c                                    |    8 +-
 hw/bt-l2cap.c                                  |   11 +-
 hw/bt-sdp.c                                    |    6 +-
 hw/bt.h                                        |    2 +
 hw/cadence_gem.c                               | 1233 +
 hw/cadence_ttc.c                               |  489 +
 hw/cadence_uart.c                              |  516 +
 hw/ccid-card-emulated.c                        |   77 +-
 hw/ccid-card-passthru.c                        |   45 +-
 hw/ccid.h                                      |   27 +-
 hw/cirrus_vga.c                                |  209 +-
 hw/cirrus_vga_template.h                       |  102 +
 hw/collie.c                                    |   14 +-
 hw/cris-boot.c                                 |   10 +-
 hw/cris-boot.h                                 |    4 +-
 hw/cris/Makefile.objs                          |   13 +
 hw/cris_pic_cpu.c                              |    4 +-
 hw/cs4231.c                                    |   62 +-
 hw/cs4231a.c                                   |   63 +-
 hw/cuda.c                                      |   14 +-
 hw/debugcon.c                                  |   36 +-
 hw/dec_pci.c                                   |  107 +-
 hw/dec_pci.h                                   |    2 +
 hw/device-hotplug.c                            |   46 +
 hw/devices.h                                   |    2 +
 hw/dma.c                                       |    4 +-
 hw/dp8393x.c                                   |   59 +-
 hw/ds1225y.c                                   |  101 +-
 hw/ds1338.c                                    |  165 +-
 hw/dummy_m68k.c                                |   15 +-
 hw/e1000.c                                     |  284 +-
 hw/e1000_hw.h                                  |   14 +-
 hw/ecc.c                                       |    3 +
 hw/eccmemctl.c                                 |  100 +-
 hw/eepro100.c                                  |  265 +-
 hw/elf_ops.h                                   |   25 +-
 hw/empty_slot.c                                |   56 +-
 hw/empty_slot.h                                |    2 +-
 hw/es1370.c                                    |  149 +-
 hw/escc.c                                      |   60 +-
 hw/escc.h                                      |    4 +-
 hw/esp-pci.c                                   |  518 +
 hw/esp.c                                       |  356 +-
 hw/esp.h                                       |  121 +-
 hw/etraxfs.h                                   |    4 +-
 hw/etraxfs_dma.c                               |   52 +-
 hw/etraxfs_dma.h                               |   15 +-
 hw/etraxfs_eth.c                               |   62 +-
 hw/etraxfs_pic.c                               |   41 +-
 hw/etraxfs_ser.c                               |   37 +-
 hw/etraxfs_timer.c                             |   28 +-
 hw/exynos4210.c                                |  338 +
 hw/exynos4210.h                                |  137 +
 hw/exynos4210_combiner.c                       |  455 +
 hw/exynos4210_fimd.c                           | 1928 +
 hw/exynos4210_gic.c                            |  462 +
 hw/exynos4210_i2c.c                            |  334 +
 hw/exynos4210_mct.c                            | 1482 +
 hw/exynos4210_pmu.c                            |  499 +
 hw/exynos4210_pwm.c                            |  422 +
 hw/exynos4210_rtc.c                            |  592 +
 hw/exynos4210_uart.c                           |  676 +
 hw/exynos4_boards.c                            |  168 +
 hw/fdc.c                                       |  747 +-
 hw/fdc.h                                       |   36 +-
 hw/fifo.c                                      |   78 +
 hw/fifo.h                                      |   99 +
 hw/flash.h                                     |    8 +-
 hw/fmopl.c                                     |   44 +-
 hw/fmopl.h                                     |    4 +-
 hw/framebuffer.c                               |   49 +-
 hw/framebuffer.h                               |    5 +-
 hw/fw_cfg.c                                    |  178 +-
 hw/fw_cfg.h                                    |    2 +-
 hw/g364fb.c                                    |  128 +-
 hw/grackle_pci.c                               |  108 +-
 hw/grlib.h                                     |    8 +-
 hw/grlib_apbuart.c                             |  150 +-
 hw/grlib_gptimer.c                             |   78 +-
 hw/grlib_irqmp.c                               |   71 +-
 hw/gt64xxx.c                                   |  126 +-
 hw/gumstix.c                                   |   14 +-
 hw/gus.c                                       |   67 +-
 hw/gusemu.h                                    |    4 +-
 hw/gusemu_hal.c                                |    4 +-
 hw/hd-geometry.c                               |  157 +
 hw/hda-audio.c                                 |  308 +-
 hw/heathrow_pic.c                              |    4 +-
 hw/hid.h                                       |   23 +
 hw/highbank.c                                  |  338 +
 hw/hpet.c                                      |  175 +-
 hw/hpet_emul.h                                 |    3 +
 hw/hw.h                                        |  886 +-
 hw/i2c.c                                       |  142 +-
 hw/i2c.h                                       |   57 +-
 hw/i386/Makefile.objs                          |   15 +
 hw/i82374.c                                    |  168 +
 hw/i82378.c                                    |  277 +
 hw/i8254.c                                     |  374 +-
 hw/i8254.h                                     |   68 +
 hw/i8254_common.c                              |  311 +
 hw/i8254_internal.h                            |   85 +
 hw/i8259.c                                     |  189 +-
 hw/i8259_common.c                              |  161 +
 hw/i8259_internal.h                            |   82 +
 hw/ide.h                                       |   10 +-
 hw/ide/Makefile.objs                           |   10 +
 hw/ide/ahci.c                                  |  256 +-
 hw/ide/ahci.h                                  |    5 +-
 hw/ide/atapi.c                                 |   52 +-
 hw/ide/cmd646.c                                |   76 +-
 hw/ide/core.c                                  |  363 +-
 hw/ide/ich.c                                   |   60 +-
 hw/ide/internal.h                              |   40 +-
 hw/ide/isa.c                                   |   44 +-
 hw/ide/macio.c                                 |   38 +-
 hw/ide/mmio.c                                  |   59 +-
 hw/ide/pci.c                                   |   16 +-
 hw/ide/piix.c                                  |  124 +-
 hw/ide/qdev.c                                  |  219 +-
 hw/ide/via.c                                   |   53 +-
 hw/imx.h                                       |   34 +
 hw/imx_avic.c                                  |  408 +
 hw/imx_ccm.c                                   |  321 +
 hw/imx_serial.c                                |  467 +
 hw/imx_timer.c                                 |  689 +
 hw/integratorcp.c                              |  203 +-
 hw/intel-hda.c                                 |  193 +-
 hw/intel-hda.h                                 |   28 +-
 hw/ioapic.c                                    |  181 +-
 hw/ioapic_common.c                             |  120 +
 hw/ioapic_internal.h                           |  102 +
 hw/ioh3420.c                                   |   79 +-
 hw/irq.c                                       |   44 +-
 hw/irq.h                                       |   18 +-
 hw/isa-bus.c                                   |  145 +-
 hw/isa.h                                       |   54 +-
 hw/isa_mmio.c                                  |   16 +-
 hw/ivshmem.c                                   |  230 +-
 hw/jazz_led.c                                  |  203 +-
 hw/kvm/Makefile.objs                           |    1 +
 hw/kvm/apic.c                                  |  209 +
 hw/kvm/clock.c                                 |  143 +
 hw/kvm/clock.h                                 |   24 +
 hw/kvm/i8254.c                                 |  317 +
 hw/kvm/i8259.c                                 |  138 +
 hw/kvm/ioapic.c                                |  125 +
 hw/kvm/pci-assign.c                            | 1905 +
 hw/kvmclock.c                                  |  118 -
 hw/kvmclock.h                                  |   24 -
 hw/kvmvapic.c                                  |  821 +
 hw/kzm.c                                       |  156 +
 hw/lan9118.c                                   |  315 +-
 hw/lance.c                                     |   52 +-
 hw/leon3.c                                     |   37 +-
 hw/lm32/Makefile.objs                          |   23 +
 hw/lm32_boards.c                               |   86 +-
 hw/lm32_hwsetup.h                              |    4 +-
 hw/lm32_juart.c                                |   29 +-
 hw/lm32_pic.c                                  |   27 +-
 hw/lm32_sys.c                                  |   65 +-
 hw/lm32_timer.c                                |   70 +-
 hw/lm32_uart.c                                 |   60 +-
 hw/lm4549.c                                    |    8 +-
 hw/lm4549.h                                    |    6 +-
 hw/lm832x.c                                    |   41 +-
 hw/loader.c                                    |   49 +-
 hw/loader.h                                    |   23 +-
 hw/lsi53c895a.c                                |  119 +-
 hw/m25p80.c                                    |  651 +
 hw/m48t59.c                                    |  192 +-
 hw/m68k/Makefile.objs                          |    4 +
 hw/mac_dbdma.c                                 |    4 +-
 hw/mac_dbdma.h                                 |    2 +-
 hw/mac_nvram.c                                 |    8 +-
 hw/macio.c                                     |   51 +-
 hw/mainstone.c                                 |   45 +-
 hw/marvell_88w8618_audio.c                     |   76 +-
 hw/max111x.c                                   |   54 +-
 hw/max7310.c                                   |   43 +-
 hw/mc146818rtc.c                               |  721 +-
 hw/mc146818rtc.h                               |    5 +-
 hw/mc146818rtc_regs.h                          |   67 +
 hw/mcf.h                                       |   23 +-
 hw/mcf5206.c                                   |   97 +-
 hw/mcf5208.c                                   |   40 +-
 hw/mcf_fec.c                                   |   47 +-
 hw/mcf_intc.c                                  |   35 +-
 hw/mcf_uart.c                                  |   34 +-
 hw/megasas.c                                   | 2213 +
 hw/mfi.h                                       | 1249 +
 hw/microblaze/Makefile.objs                    |   10 +
 hw/microblaze_boot.c                           |  177 +
 hw/microblaze_boot.h                           |   10 +
 hw/microblaze_pic_cpu.c                        |    4 +-
 hw/microblaze_pic_cpu.h                        |    2 +-
 hw/milkymist-ac97.c                            |   33 +-
 hw/milkymist-hpdmc.c                           |   33 +-
 hw/milkymist-hw.h                              |   24 +-
 hw/milkymist-memcard.c                         |   33 +-
 hw/milkymist-minimac2.c                        |   64 +-
 hw/milkymist-pfpu.c                            |   37 +-
 hw/milkymist-softusb.c                         |   63 +-
 hw/milkymist-sysctl.c                          |   84 +-
 hw/milkymist-tmu2.c                            |   37 +-
 hw/milkymist-uart.c                            |   35 +-
 hw/milkymist-vgafb.c                           |   54 +-
 hw/milkymist-vgafb_template.h                  |    2 +-
 hw/milkymist.c                                 |   45 +-
 hw/mips.h                                      |   15 +-
 hw/mips/Makefile.objs                          |    6 +
 hw/mips_cpudevs.h                              |    4 +-
 hw/mips_fulong2e.c                             |   71 +-
 hw/mips_int.c                                  |    6 +-
 hw/mips_jazz.c                                 |   78 +-
 hw/mips_malta.c                                |  196 +-
 hw/mips_mipssim.c                              |   37 +-
 hw/mips_r4k.c                                  |   62 +-
 hw/mips_timer.c                                |   20 +-
 hw/mipsnet.c                                   |   57 +-
 hw/mpc8544_guts.c                              |   60 +-
 hw/mpcore.c                                    |  283 -
 hw/msi.c                                       |   81 +-
 hw/msi.h                                       |    9 +
 hw/msix.c                                      |  436 +-
 hw/msix.h                                      |   27 +-
 hw/msmouse.c                                   |    5 +-
 hw/msmouse.h                                   |    2 +-
 hw/mst_fpga.c                                  |   60 +-
 hw/multiboot.c                                 |   28 +-
 hw/musicpal.c                                  |  281 +-
 hw/nand.c                                      |   78 +-
 hw/ne2000-isa.c                                |   42 +-
 hw/ne2000.c                                    |  103 +-
 hw/ne2000.h                                    |    4 +-
 hw/nseries.c                                   |  139 +-
 hw/null-machine.c                              |   35 +
 hw/nvram.h                                     |   16 +-
 hw/omap.h                                      |  228 +-
 hw/omap1.c                                     |  352 +-
 hw/omap2.c                                     |  278 +-
 hw/omap_dma.c                                  |   91 +-
 hw/omap_dss.c                                  |  199 +-
 hw/omap_gpio.c                                 |  189 +-
 hw/omap_gpmc.c                                 |   46 +-
 hw/omap_gptimer.c                              |   40 +-
 hw/omap_i2c.c                                  |  140 +-
 hw/omap_intc.c                                 |   86 +-
 hw/omap_l4.c                                   |  190 +-
 hw/omap_lcdc.c                                 |  111 +-
 hw/omap_mmc.c                                  |   48 +-
 hw/omap_sdrc.c                                 |   41 +-
 hw/omap_spi.c                                  |   39 +-
 hw/omap_sx1.c                                  |  141 +-
 hw/omap_synctimer.c                            |   36 +-
 hw/omap_tap.c                                  |   34 +-
 hw/omap_uart.c                                 |   50 +-
 hw/onenand.c                                   |   58 +-
 hw/opencores_eth.c                             |   90 +-
 hw/openpic.c                                   |  111 +-
 hw/openpic.h                                   |    4 +-
 hw/openrisc/Makefile.objs                      |    3 +
 hw/openrisc_pic.c                              |   60 +
 hw/openrisc_sim.c                              |  149 +
 hw/openrisc_timer.c                            |  101 +
 hw/palm.c                                      |   34 +-
 hw/parallel.c                                  |   77 +-
 hw/pc.c                                        |  458 +-
 hw/pc.h                                        |  132 +-
 hw/pc_piix.c                                   |  534 +-
 hw/pc_sysfw.c                                  |  266 +
 hw/pci-hotplug.c                               |   52 +-
 hw/pci-stub.c                                  |    2 +-
 hw/pci.c                                       |  440 +-
 hw/pci.h                                       |  247 +-
 hw/pci_bridge.c                                |   87 +-
 hw/pci_bridge.h                                |    2 +-
 hw/pci_bridge_dev.c                            |  171 +
 hw/pci_host.c                                  |   23 +-
 hw/pci_host.h                                  |    6 +
 hw/pci_ids.h                                   |   11 +
 hw/pci_internals.h                             |   30 +-
 hw/pci_regs.h                                  |    3 +-
 hw/pcie.c                                      |    2 +-
 hw/pcie.h                                      |   10 +
 hw/pcie_aer.c                                  |    9 +-
 hw/pcie_host.c                                 |   41 +-
 hw/pcie_host.h                                 |   15 +-
 hw/pcie_port.c                                 |   12 +-
 hw/pckbd.c                                     |   83 +-
 hw/pcnet-pci.c                                 |   85 +-
 hw/pcnet.c                                     |   59 +-
 hw/pcnet.h                                     |   11 +-
 hw/pcspk.c                                     |   86 +-
 hw/pcspk.h                                     |   45 +
 hw/petalogix_ml605_mmu.c                       |  211 +-
 hw/petalogix_s3adsp1800_mmu.c                  |  169 +-
 hw/pflash_cfi01.c                              |  277 +-
 hw/pflash_cfi02.c                              |  317 +-
 hw/piix4.c                                     |   45 +-
 hw/piix_pci.c                                  |  292 +-
 hw/pl011.c                                     |   88 +-
 hw/pl022.c                                     |   60 +-
 hw/pl031.c                                     |  154 +-
 hw/pl041.c                                     |   57 +-
 hw/pl041.h                                     |    2 +-
 hw/pl041.hx                                    |    2 +-
 hw/pl050.c                                     |   81 +-
 hw/pl061.c                                     |   81 +-
 hw/pl080.c                                     |   90 +-
 hw/pl110.c                                     |  155 +-
 hw/pl110_template.h                            |   22 +-
 hw/pl181.c                                     |  112 +-
 hw/pl190.c                                     |   83 +-
 hw/ppc.c                                       |  178 +-
 hw/ppc.h                                       |   28 +-
 hw/ppc/Makefile.objs                           |   31 +
 hw/ppc/e500.c                                  |  580 +
 hw/ppc/e500.h                                  |   21 +
 hw/ppc/e500plat.c                              |   61 +
 hw/ppc/mpc8544ds.c                             |   62 +
 hw/ppc405.h                                    |   20 +-
 hw/ppc405_boards.c                             |   71 +-
 hw/ppc405_uc.c                                 |  137 +-
 hw/ppc440.c                                    |  106 -
 hw/ppc440.h                                    |   21 -
 hw/ppc440_bamboo.c                             |  184 +-
 hw/ppc4xx.h                                    |   26 +-
 hw/ppc4xx_devs.c                               |   55 +-
 hw/ppc4xx_pci.c                                |  205 +-
 hw/ppc_booke.c                                 |   20 +-
 hw/ppc_mac.h                                   |    5 +-
 hw/ppc_newworld.c                              |   70 +-
 hw/ppc_oldworld.c                              |   45 +-
 hw/ppc_prep.c                                  |  207 +-
 hw/ppce500_mpc8544ds.c                         |  409 -
 hw/ppce500_pci.c                               |  133 +-
 hw/ppce500_spin.c                              |   65 +-
 hw/prep_pci.c                                  |  221 +-
 hw/prep_pci.h                                  |   11 -
 hw/primecell.h                                 |    6 -
 hw/ps2.c                                       |    8 +-
 hw/ps2.h                                       |   29 +
 hw/ptimer.c                                    |   14 +
 hw/ptimer.h                                    |   39 +
 hw/puv3.c                                      |  133 +
 hw/puv3.h                                      |   49 +
 hw/puv3_dma.c                                  |  109 +
 hw/puv3_gpio.c                                 |  141 +
 hw/puv3_intc.c                                 |  135 +
 hw/puv3_ost.c                                  |  151 +
 hw/puv3_pm.c                                   |  149 +
 hw/pxa.h                                       |   35 +-
 hw/pxa2xx.c                                    |  528 +-
 hw/pxa2xx_dma.c                                |  110 +-
 hw/pxa2xx_gpio.c                               |   80 +-
 hw/pxa2xx_keypad.c                             |  110 +-
 hw/pxa2xx_lcd.c                                |  150 +-
 hw/pxa2xx_mmci.c                               |   50 +-
 hw/pxa2xx_pcmcia.c                             |   98 +-
 hw/pxa2xx_pic.c                                |  138 +-
 hw/pxa2xx_timer.c                              |  108 +-
 hw/qdev-addr.c                                 |   59 +-
 hw/qdev-addr.h                                 |    4 +-
 hw/qdev-core.h                                 |  238 +
 hw/qdev-dma.h                                  |   10 +
 hw/qdev-monitor.c                              |  617 +
 hw/qdev-monitor.h                              |   16 +
 hw/qdev-properties.c                           | 1124 +-
 hw/qdev-properties.h                           |  130 +
 hw/qdev.c                                      |  984 +-
 hw/qdev.h                                      |  331 +-
 hw/qxl-logger.c                                |   51 +-
 hw/qxl-render.c                                |  180 +-
 hw/qxl.c                                       | 1085 +-
 hw/qxl.h                                       |   56 +-
 hw/r2d.c                                       |   58 +-
 hw/rc4030.c                                    |   85 +-
 hw/realview.c                                  |  177 +-
 hw/realview_gic.c                              |   87 +-
 hw/rtl8139.c                                   |  298 +-
 hw/s390-virtio-bus.c                           |  323 +-
 hw/s390-virtio-bus.h                           |   40 +-
 hw/s390-virtio.c                               |   88 +-
 hw/s390x/Makefile.objs                         |    6 +
 hw/s390x/event-facility.c                      |  398 +
 hw/s390x/event-facility.h                      |   96 +
 hw/s390x/sclp.c                                |  163 +
 hw/s390x/sclp.h                                |  118 +
 hw/s390x/sclpconsole.c                         |  306 +
 hw/s390x/sclpquiesce.c                         |  123 +
 hw/sb16.c                                      |  150 +-
 hw/sbi.c                                       |   60 +-
 hw/scsi-bus.c                                  |  746 +-
 hw/scsi-defs.h                                 |   21 +-
 hw/scsi-disk.c                                 | 1610 +-
 hw/scsi-generic.c                              |   99 +-
 hw/scsi.h                                      |   70 +-
 hw/sd.c                                        |  308 +-
 hw/sd.h                                        |    7 +-
 hw/serial-isa.c                                |  130 +
 hw/serial-pci.c                                |  252 +
 hw/serial.c                                    |  182 +-
 hw/serial.h                                    |   99 +
 hw/sga.c                                       |   25 +-
 hw/sh.h                                        |    9 +-
 hw/sh4/Makefile.objs                           |    5 +
 hw/sh7750.c                                    |  173 +-
 hw/sh7750_regs.h                               |    2 +-
 hw/sh_intc.c                                   |   87 +-
 hw/sh_intc.h                                   |    7 +-
 hw/sh_pci.c                                    |   80 +-
 hw/sh_serial.c                                 |   61 +-
 hw/sh_timer.c                                  |   50 +-
 hw/sharpsl.h                                   |    2 +-
 hw/shix.c                                      |   27 +-
 hw/shpc.c                                      |  681 +
 hw/shpc.h                                      |   48 +
 hw/slavio_intctl.c                             |   98 +-
 hw/slavio_misc.c                               |  309 +-
 hw/slavio_timer.c                              |   81 +-
 hw/slotid_cap.c                                |   44 +
 hw/slotid_cap.h                                |   11 +
 hw/sm501.c                                     |   40 +-
 hw/smbios.c                                    |    2 +
 hw/smbus.c                                     |   85 +-
 hw/smbus.h                                     |   40 +-
 hw/smbus_eeprom.c                              |   43 +-
 hw/smc91c111.c                                 |   63 +-
 hw/soc_dma.c                                   |    8 +-
 hw/soc_dma.h                                   |   11 +-
 hw/spapr.c                                     |  632 +-
 hw/spapr.h                                     |   68 +-
 hw/spapr_events.c                              |  321 +
 hw/spapr_hcall.c                               |  206 +-
 hw/spapr_iommu.c                               |  287 +
 hw/spapr_llan.c                                |  163 +-
 hw/spapr_pci.c                                 |  783 +-
 hw/spapr_pci.h                                 |   49 +-
 hw/spapr_rtas.c                                |   49 +-
 hw/spapr_vio.c                                 |  547 +-
 hw/spapr_vio.h                                 |  131 +-
 hw/spapr_vscsi.c                               |   94 +-
 hw/spapr_vty.c                                 |   66 +-
 hw/sparc/Makefile.objs                         |    8 +
 hw/sparc32_dma.c                               |   74 +-
 hw/sparc32_dma.h                               |    4 +-
 hw/sparc64/Makefile.objs                       |    4 +
 hw/spitz.c                                     |  203 +-
 hw/srp.h                                       |    8 +-
 hw/ssd0303.c                                   |   45 +-
 hw/ssd0323.c                                   |   37 +-
 hw/ssi-sd.c                                    |   34 +-
 hw/ssi.c                                       |  156 +-
 hw/ssi.h                                       |   58 +-
 hw/stellaris.c                                 |  270 +-
 hw/stellaris_enet.c                            |   49 +-
 hw/stream.c                                    |   23 +
 hw/stream.h                                    |   31 +
 hw/strongarm.c                                 |  215 +-
 hw/strongarm.h                                 |    2 +-
 hw/sun4c_intctl.c                              |   86 +-
 hw/sun4m.c                                     |  415 +-
 hw/sun4m.h                                     |   10 +-
 hw/sun4m_iommu.c                               |   92 +-
 hw/sun4u.c                                     |  347 +-
 hw/syborg.c                                    |  113 -
 hw/syborg.h                                    |   18 -
 hw/syborg_fb.c                                 |  560 -
 hw/syborg_interrupt.c                          |  238 -
 hw/syborg_keyboard.c                           |  221 -
 hw/syborg_pointer.c                            |  226 -
 hw/syborg_rtc.c                                |  140 -
 hw/syborg_serial.c                             |  335 -
 hw/syborg_timer.c                              |  231 -
 hw/syborg_virtio.c                             |  313 -
 hw/sysbus.c                                    |  173 +-
 hw/sysbus.h                                    |   58 +-
 hw/tc6393xb.c                                  |   26 +-
 hw/tc6393xb_template.h                         |    2 +-
 hw/tcx.c                                       |  219 +-
 hw/tmp105.c                                    |   45 +-
 hw/tosa.c                                      |   91 +-
 hw/tusb6010.c                                  |   41 +-
 hw/twl92230.c                                  |   73 +-
 hw/unicore32/Makefile.objs                     |    6 +
 hw/unin_pci.c                                  |  343 +-
 hw/usb-bt.c                                    |  570 -
 hw/usb-bus.c                                   |  482 -
 hw/usb-ccid.c                                  | 1321 -
 hw/usb-desc.c                                  |  466 -
 hw/usb-desc.h                                  |  112 -
 hw/usb-ehci.c                                  | 2370 -
 hw/usb-hid.c                                   |  612 -
 hw/usb-hub.c                                   |  562 -
 hw/usb-libhw.c                                 |   63 -
 hw/usb-msd.c                                   |  677 -
 hw/usb-musb.c                                  | 1543 -
 hw/usb-net.c                                   | 1426 -
 hw/usb-ohci.c                                  | 1870 -
 hw/usb-ohci.h                                  |    9 -
 hw/usb-serial.c                                |  625 -
 hw/usb-uhci.c                                  | 1285 -
 hw/usb-uhci.h                                  |   10 -
 hw/usb-wacom.c                                 |  379 -
 hw/usb.c                                       |  416 -
 hw/usb.h                                       |  249 +-
 hw/usb/Makefile.objs                           |   14 +
 hw/usb/bus.c                                   |  628 +
 hw/usb/combined-packet.c                       |  186 +
 hw/usb/core.c                                  |  767 +
 hw/usb/desc.c                                  |  790 +
 hw/usb/desc.h                                  |  224 +
 hw/usb/dev-audio.c                             |  700 +
 hw/usb/dev-bluetooth.c                         |  553 +
 hw/usb/dev-hid.c                               |  634 +
 hw/usb/dev-hub.c                               |  581 +
 hw/usb/dev-network.c                           | 1441 +
 hw/usb/dev-serial.c                            |  646 +
 hw/usb/dev-smartcard-reader.c                  | 1356 +
 hw/usb/dev-storage.c                           |  732 +
 hw/usb/dev-uas.c                               |  772 +
 hw/usb/dev-wacom.c                             |  378 +
 hw/usb/hcd-ehci-pci.c                          |  218 +
 hw/usb/hcd-ehci-sysbus.c                       |   77 +
 hw/usb/hcd-ehci.c                              | 2437 +
 hw/usb/hcd-ehci.h                              |  319 +
 hw/usb/hcd-musb.c                              | 1546 +
 hw/usb/hcd-ohci.c                              | 1925 +
 hw/usb/hcd-uhci.c                              | 1411 +
 hw/usb/hcd-xhci.c                              | 3184 ++
 hw/usb/host-bsd.c                              |  644 +
 hw/usb/host-linux.c                            | 2022 +
 hw/usb/host-stub.c                             |   52 +
 hw/usb/libhw.c                                 |   70 +
 hw/usb/redirect.c                              | 2000 +
 hw/versatile_i2c.c                             |  107 +
 hw/versatile_pci.c                             |   74 +-
 hw/versatilepb.c                               |  154 +-
 hw/vexpress.c                                  |  457 +-
 hw/vfio_pci.c                                  | 2115 +
 hw/vga-isa-mm.c                                |   26 +-
 hw/vga-isa.c                                   |   37 +-
 hw/vga-pci.c                                   |  184 +-
 hw/vga.c                                       |  684 +-
 hw/vga.h                                       |  159 +
 hw/vga_int.h                                   |   67 +-
 hw/vga_template.h                              |   74 +-
 hw/vhost.c                                     |  226 +-
 hw/vhost.h                                     |    8 +-
 hw/vhost_net.c                                 |   36 +-
 hw/vhost_net.h                                 |    2 +-
 hw/virtex_ml507.c                              |   67 +-
 hw/virtio-balloon.c                            |   28 +-
 hw/virtio-blk.c                                |  191 +-
 hw/virtio-blk.h                                |   22 +-
 hw/virtio-console.c                            |  102 +-
 hw/virtio-net.c                                |  225 +-
 hw/virtio-net.h                                |    1 +
 hw/virtio-pci.c                                |  709 +-
 hw/virtio-pci.h                                |   15 +-
 hw/virtio-rng.c                                |  258 +
 hw/virtio-rng.h                                |   28 +
 hw/virtio-scsi.c                               |  742 +
 hw/virtio-scsi.h                               |   43 +
 hw/virtio-serial-bus.c                         |  268 +-
 hw/virtio-serial.h                             |   85 +-
 hw/virtio.c                                    |  190 +-
 hw/virtio.h                                    |   49 +-
 hw/vmmouse.c                                   |   41 +-
 hw/vmport.c                                    |   60 +-
 hw/vmware_vga.c                                |  550 +-
 hw/vmware_vga.h                                |   19 -
 hw/vt82c686.c                                  |  192 +-
 hw/vt82c686.h                                  |    2 +-
 hw/watchdog.c                                  |    4 +-
 hw/wdt_i6300esb.c                              |   57 +-
 hw/wdt_ib700.c                                 |   28 +-
 hw/wm8750.c                                    |   51 +-
 hw/xen-host-pci-device.c                       |  396 +
 hw/xen-host-pci-device.h                       |   55 +
 hw/xen.h                                       |   10 +-
 hw/xen_apic.c                                  |   95 +
 hw/xen_backend.c                               |    3 +
 hw/xen_backend.h                               |    1 +
 hw/xen_common.h                                |   18 +
 hw/xen_devconfig.c                             |   23 +-
 hw/xen_disk.c                                  |    6 +-
 hw/xen_domainbuild.c                           |    1 -
 hw/xen_machine_pv.c                            |   17 +-
 hw/xen_nic.c                                   |   13 +-
 hw/xen_platform.c                              |  116 +-
 hw/xen_pt.c                                    |  843 +
 hw/xen_pt.h                                    |  302 +
 hw/xen_pt_config_init.c                        | 1882 +
 hw/xen_pt_msi.c                                |  620 +
 hw/xenfb.c                                     |    6 +-
 hw/xgmac.c                                     |  433 +
 hw/xics.c                                      |  220 +-
 hw/xics.h                                      |    3 +-
 hw/xilinx.h                                    |   62 +-
 hw/xilinx_axidma.c                             |  139 +-
 hw/xilinx_axidma.h                             |   39 -
 hw/xilinx_axienet.c                            |  110 +-
 hw/xilinx_ethlite.c                            |   56 +-
 hw/xilinx_intc.c                               |   41 +-
 hw/xilinx_spi.c                                |  385 +
 hw/xilinx_spips.c                              |  575 +
 hw/xilinx_timer.c                              |   74 +-
 hw/xilinx_uartlite.c                           |   32 +-
 hw/xilinx_zynq.c                               |  213 +
 hw/xio3130_downstream.c                        |   78 +-
 hw/xio3130_upstream.c                          |   72 +-
 hw/xtensa/Makefile.objs                        |    5 +
 hw/xtensa_lx60.c                               |   78 +-
 hw/xtensa_pic.c                                |   23 +-
 hw/xtensa_sim.c                                |   52 +-
 hw/z2.c                                        |  105 +-
 hw/zaurus.c                                    |   64 +-
 hw/zynq_slcr.c                                 |  535 +
 hwaddr.h                                       |   24 +
 include/qemu/cpu.h                             |  140 +
 include/qemu/object.h                          |  992 +
 include/qemu/page_cache.h                      |   79 +
 include/qemu/qom-qobject.h                     |   42 +
 include/qemu/ratelimit.h                       |   48 +
 include/qemu/rng-random.h                      |   22 +
 include/qemu/rng.h                             |   93 +
 input.c                                        |  260 +-
 iohandler.c                                    |    8 +-
 ioport-user.c                                  |   60 -
 ioport.c                                       |   43 +-
 ioport.h                                       |    2 +
 iorange.h                                      |    1 +
 iov.c                                          |  331 +-
 iov.h                                          |   88 +-
 json-lexer.c                                   |    1 +
 json-parser.c                                  |  230 +-
 kvm-all.c                                      |  910 +-
 kvm-stub.c                                     |   75 +-
 kvm.h                                          |  167 +-
 libcacard/Makefile                             |   29 +-
 libcacard/card_7816.c                          |    4 +-
 libcacard/card_7816.h                          |    2 +-
 libcacard/vcard.c                              |    1 -
 libcacard/vcard_emul_nss.c                     |   44 +-
 libcacard/vcardt.h                             |    2 +-
 libcacard/vreader.c                            |    1 -
 libcacard/vscard_common.h                      |    2 +-
 libcacard/vscclient.c                          |   22 +-
 linux-aio.c                                    |  229 -
 linux-headers/asm-powerpc/kvm.h                |   12 +-
 linux-headers/asm-powerpc/kvm_para.h           |   47 +-
 linux-headers/asm-s390/kvm.h                   |   18 +-
 linux-headers/asm-s390/kvm_para.h              |    8 +-
 linux-headers/asm-x86/hyperv.h                 |    1 +
 linux-headers/asm-x86/kvm.h                    |   22 +
 linux-headers/asm-x86/kvm_para.h               |    7 +
 linux-headers/linux/kvm.h                      |  154 +-
 linux-headers/linux/kvm_para.h                 |    7 +-
 linux-headers/linux/vfio.h                     |  368 +
 linux-headers/linux/virtio_config.h            |    6 +-
 linux-headers/linux/virtio_ring.h              |   12 +-
 linux-user/Makefile.objs                       |    7 +
 linux-user/alpha/syscall_nr.h                  |    2 +-
 linux-user/alpha/target_signal.h               |    7 +-
 linux-user/arm/nwfpe/Makefile.objs             |    2 +
 linux-user/arm/nwfpe/fpopcode.h                |   34 +-
 linux-user/arm/syscall_nr.h                    |    2 +-
 linux-user/cpu-uname.c                         |    7 +-
 linux-user/elfload.c                           |  312 +-
 linux-user/flatload.c                          |    4 +-
 linux-user/ioctls.h                            |   38 +-
 linux-user/linuxload.c                         |    8 +-
 linux-user/m68k/syscall.h                      |    2 +-
 linux-user/main.c                              |  314 +-
 linux-user/mips64/syscall.h                    |    3 +
 linux-user/mipsn32/syscall.h                   |    3 +
 linux-user/mmap.c                              |   71 +-
 linux-user/openrisc/syscall.h                  |   24 +
 linux-user/openrisc/syscall_nr.h               |  506 +
 linux-user/openrisc/target_signal.h            |   26 +
 linux-user/openrisc/termbits.h                 |  294 +
 linux-user/qemu.h                              |   84 +-
 linux-user/signal.c                            |  549 +-
 linux-user/strace.c                            |   31 +-
 linux-user/strace.list                         |    3 +
 linux-user/syscall.c                           | 1079 +-
 linux-user/syscall_defs.h                      |  325 +-
 linux-user/syscall_types.h                     |   43 +-
 linux-user/x86_64/syscall.h                    |    2 +-
 lm32-dis.c                                     |  361 +
 m68k-dis.c                                     |    2 +-
 m68k-semi.c                                    |  408 -
 main-loop.c                                    |  306 +-
 main-loop.h                                    |   71 +-
 memory-internal.h                              |  141 +
 memory.c                                       | 1005 +-
 memory.h                                       |  509 +-
 memory_mapping-stub.c                          |   33 +
 memory_mapping.c                               |  246 +
 memory_mapping.h                               |   64 +
 migration-exec.c                               |   50 +-
 migration-fd.c                                 |   65 +-
 migration-tcp.c                                |  117 +-
 migration-unix.c                               |  115 +-
 migration.c                                    |  349 +-
 migration.h                                    |   72 +-
 module.c                                       |    3 +-
 module.h                                       |    4 +-
 monitor.c                                      | 2107 +-
 monitor.h                                      |   37 +-
 nbd.c                                          | 1000 +-
 nbd.h                                          |   33 +-
 net.c                                          | 1198 +-
 net.h                                          |  126 +-
 net/Makefile.objs                              |   12 +
 net/checksum.c                                 |    2 +-
 net/clients.h                                  |   55 +
 net/dump.c                                     |   60 +-
 net/dump.h                                     |   33 -
 net/hub.c                                      |  340 +
 net/hub.h                                      |   27 +
 net/queue.c                                    |   68 +-
 net/queue.h                                    |   27 +-
 net/slirp.c                                    |  228 +-
 net/slirp.h                                    |    6 +-
 net/socket.c                                   |  477 +-
 net/socket.h                                   |   33 -
 net/tap-aix.c                                  |    2 +-
 net/tap-bsd.c                                  |    8 +-
 net/tap-haiku.c                                |    2 +-
 net/tap-linux.c                                |    9 +-
 net/tap-solaris.c                              |    4 +-
 net/tap-win32.c                                |   49 +-
 net/tap.c                                      |  349 +-
 net/tap.h                                      |   22 +-
 net/vde.c                                      |   35 +-
 net/vde.h                                      |   36 -
 notify.c                                       |   12 +-
 notify.h                                       |    8 +-
 os-posix.c                                     |   52 +-
 os-win32.c                                     |   20 +-
 osdep.c                                        |  234 +
 osdep.h                                        |   44 +-
 oslib-posix.c                                  |   18 +
 oslib-win32.c                                  |   32 +
 page_cache.c                                   |  218 +
 pc-bios/README                                 |    4 +-
 pc-bios/bamboo.dtb                             |  Bin 3179 -> 3211 bytes
 pc-bios/bamboo.dts                             |  128 +-
 pc-bios/bios.bin                               |  Bin 131072 -> 131072 bytes
 pc-bios/keymaps/fi                             |    2 -
 pc-bios/keymaps/is                             |    2 +-
 pc-bios/kvmvapic.bin                           |  Bin 0 -> 9216 bytes
 pc-bios/mpc8544ds.dtb                          |  Bin 2028 -> 0 bytes
 pc-bios/mpc8544ds.dts                          |  119 -
 pc-bios/ohw.diff                               |    2 +-
 pc-bios/openbios-ppc                           |  Bin 729876 -> 729908 bytes
 pc-bios/openbios-sparc32                       |  Bin 381484 -> 381764 bytes
 pc-bios/openbios-sparc64                       |  Bin 1598328 -> 1598648 bytes
 pc-bios/optionrom/Makefile                     |    7 +-
 pc-bios/optionrom/kvmvapic.S                   |  335 +
 pc-bios/optionrom/multiboot.S                  |    2 +-
 pc-bios/optionrom/optionrom.h                  |    3 +-
 pc-bios/qemu-icon.bmp                          |  Bin 0 -> 630 bytes
 pc-bios/slof.bin                               |  Bin 738744 -> 878640 bytes
 pflib.c                                        |  213 -
 pflib.h                                        |   20 -
 pixman                                         |    1 +
 poison.h                                       |    3 +-
 posix-aio-compat.c                             |  696 -
 ppc-dis.c                                      |    2 +-
 qapi-schema-guest.json                         |  360 +-
 qapi-schema-test.json                          |   18 +-
 qapi-schema.json                               | 2180 +-
 qapi/Makefile.objs                             |    5 +
 qapi/opts-visitor.c                            |  427 +
 qapi/opts-visitor.h                            |   31 +
 qapi/qapi-types-core.h                         |    4 +-
 qapi/qapi-visit-core.c                         |  207 +-
 qapi/qapi-visit-core.h                         |   19 +
 qapi/qapi-visit-impl.h                         |   23 +
 qapi/qmp-core.h                                |   16 +-
 qapi/qmp-dispatch.c                            |   23 +-
 qapi/qmp-input-visitor.c                       |  187 +-
 qapi/qmp-input-visitor.h                       |    2 +
 qapi/qmp-output-visitor.c                      |   30 +-
 qapi/qmp-registry.c                            |   70 +-
 qapi/string-input-visitor.c                    |  138 +
 qapi/string-input-visitor.h                    |   25 +
 qapi/string-output-visitor.c                   |   89 +
 qapi/string-output-visitor.h                   |   26 +
 qemu-aio.h                                     |  232 +-
 qemu-barrier.h                                 |   37 +-
 qemu-bridge-helper.c                           |  428 +
 qemu-char.c                                    |  232 +-
 qemu-char.h                                    |    5 +-
 qemu-common.h                                  |  173 +-
 qemu-config.c                                  |  216 +-
 qemu-config.h                                  |   10 +
 qemu-coroutine-int.h                           |    2 +-
 qemu-coroutine-io.c                            |   65 +
 qemu-coroutine-lock.c                          |   25 +-
 qemu-coroutine-sleep.c                         |   39 +
 qemu-coroutine.h                               |   20 +
 qemu-doc.texi                                  |  335 +-
 qemu-error.c                                   |    5 +
 qemu-error.h                                   |    1 +
 qemu-file.h                                    |  241 +
 qemu-ga.c                                      |  830 +-
 qemu-img-cmds.hx                               |    8 +-
 qemu-img.c                                     |  575 +-
 qemu-img.texi                                  |   86 +-
 qemu-io.c                                      |  228 +-
 qemu-log.c                                     |  167 +
 qemu-log.h                                     |  157 +-
 qemu-nbd.c                                     |  300 +-
 qemu-nbd.texi                                  |    2 +-
 qemu-option-internal.h                         |   53 +
 qemu-option.c                                  |  268 +-
 qemu-option.h                                  |   26 +-
 qemu-options-wrapper.h                         |   41 +
 qemu-options.h                                 |    9 +-
 qemu-options.hx                                |  655 +-
 qemu-os-posix.h                                |    2 +
 qemu-os-win32.h                                |   47 +-
 qemu-pixman.c                                  |   78 +
 qemu-pixman.h                                  |   39 +
 qemu-queue.h                                   |  194 +-
 qemu-seccomp.c                                 |  141 +
 qemu-seccomp.h                                 |   22 +
 qemu-sockets.c                                 |  692 +-
 qemu-tech.texi                                 |   15 +-
 qemu-thread-posix.c                            |  187 +-
 qemu-thread-posix.h                            |   11 +
 qemu-thread-win32.c                            |  162 +-
 qemu-thread-win32.h                            |   12 +-
 qemu-thread.h                                  |   18 +-
 qemu-timer.c                                   |  233 +-
 qemu-timer.h                                   |   35 +-
 qemu-tls.h                                     |    4 +-
 qemu-tool.c                                    |   54 +-
 qemu-user.c                                    |   37 +
 qemu_socket.h                                  |   45 +-
 qerror.c                                       |  447 +-
 qerror.h                                       |  222 +-
 qga/Makefile.objs                              |    5 +
 qga/channel-posix.c                            |  264 +
 qga/channel-win32.c                            |  344 +
 qga/channel.h                                  |   33 +
 qga/commands-posix.c                           | 1001 +
 qga/commands-win32.c                           |  284 +
 qga/commands.c                                 |   79 +
 qga/guest-agent-commands.c                     |  561 -
 qga/guest-agent-core.h                         |   13 +-
 qga/service-win32.c                            |  114 +
 qga/service-win32.h                            |   30 +
 qjson.h                                        |    1 +
 qlist.c                                        |   13 +
 qlist.h                                        |    1 +
 qmp-commands.hx                                |  858 +-
 qmp.c                                          |  404 +-
 qobject.h                                      |    2 +-
 qom/Makefile.objs                              |    4 +
 qom/container.c                                |   52 +
 qom/cpu.c                                      |   58 +
 qom/object.c                                   | 1271 +
 qom/qom-qobject.c                              |   44 +
 qtest.c                                        |  444 +
 qtest.h                                        |   53 +
 readline.c                                     |    3 +
 roms/Makefile                                  |   27 +
 roms/SLOF                                      |    2 +-
 roms/config.seabios                            |    1 +
 roms/config.vga.cirrus                         |    3 +
 roms/config.vga.isavga                         |    3 +
 roms/config.vga.qxl                            |    6 +
 roms/config.vga.stdvga                         |    3 +
 roms/config.vga.vmware                         |    6 +
 roms/configure-seabios.sh                      |    5 +
 roms/openbios                                  |    2 +-
 roms/seabios                                   |    2 +-
 rules.mak                                      |   51 +-
 savevm.c                                       |  674 +-
 scripts/analyse-9p-simpletrace.py              |   75 +-
 scripts/check-qerror.sh                        |   22 +
 scripts/checkpatch.pl                          |   79 +-
 scripts/create_config                          |   14 +-
 scripts/gtester-cat                            |   26 +
 scripts/hxtool                                 |    3 +
 scripts/kvm/kvm_flightrecorder                 |  126 +
 scripts/kvm/kvm_stat                           |   37 +-
 scripts/kvm/vmxcap                             |   13 +
 scripts/make-release                           |   24 +
 scripts/qapi-commands.py                       |   56 +-
 scripts/qapi-types.py                          |   68 +-
 scripts/qapi-visit.py                          |  180 +-
 scripts/qapi.py                                |   62 +-
 scripts/qemu-binfmt-conf.sh                    |    1 +
 scripts/qemu-gdb.py                            |   89 +
 scripts/qtest                                  |    5 +
 scripts/signrom.py                             |   40 +
 scripts/signrom.sh                             |   45 -
 scripts/simpletrace.py                         |  116 +-
 scripts/texi2pod.pl                            |    9 +
 scripts/tracetool                              |  643 -
 scripts/tracetool.py                           |  138 +
 scripts/tracetool/__init__.py                  |  274 +
 scripts/tracetool/backend/__init__.py          |  115 +
 scripts/tracetool/backend/dtrace.py            |  106 +
 scripts/tracetool/backend/simple.py            |  107 +
 scripts/tracetool/backend/stderr.py            |   56 +
 scripts/tracetool/backend/ust.py               |   90 +
 scripts/tracetool/format/__init__.py           |  103 +
 scripts/tracetool/format/c.py                  |   20 +
 scripts/tracetool/format/d.py                  |   20 +
 scripts/tracetool/format/h.py                  |   45 +
 scripts/tracetool/format/stap.py               |   20 +
 scripts/update-linux-headers.sh                |   24 +-
 slirp/Makefile.objs                            |    3 +
 slirp/arp_table.c                              |    4 +-
 slirp/bootp.c                                  |   15 +-
 slirp/cksum.c                                  |    2 +-
 slirp/dnssearch.c                              |  314 +
 slirp/if.c                                     |  144 +-
 slirp/if.h                                     |    2 -
 slirp/ip.h                                     |   20 +-
 slirp/ip_icmp.c                                |   12 +
 slirp/ip_icmp.h                                |    5 +-
 slirp/ip_input.c                               |    8 +-
 slirp/libslirp.h                               |    4 +-
 slirp/main.h                                   |    1 +
 slirp/mbuf.c                                   |   21 +
 slirp/mbuf.h                                   |    6 +
 slirp/misc.c                                   |  148 +-
 slirp/misc.h                                   |    1 -
 slirp/sbuf.c                                   |    6 +
 slirp/slirp.c                                  |   21 +-
 slirp/slirp.h                                  |   23 +-
 slirp/tcp.h                                    |   34 +-
 slirp/tcp_input.c                              |    2 -
 slirp/tcp_output.c                             |    1 +
 slirp/tcp_subr.c                               |   26 +-
 slirp/tftp.c                                   |  104 +-
 slirp/tftp.h                                   |    2 +
 slirp/udp.c                                    |    9 +-
 slirp/udp.h                                    |    1 +
 softmmu-semi.h                                 |   17 +-
 softmmu_defs.h                                 |   41 +-
 softmmu_header.h                               |   52 +-
 softmmu_template.h                             |  169 +-
 sparc-dis.c                                    |    2 +-
 spice-qemu-char.c                              |   11 +-
 stubs/Makefile.objs                            |    8 +
 stubs/arch-query-cpu-def.c                     |    9 +
 stubs/fd-register.c                            |    6 +
 stubs/fdset-add-fd.c                           |    7 +
 stubs/fdset-find-fd.c                          |    7 +
 stubs/fdset-get-fd.c                           |    7 +
 stubs/fdset-remove-fd.c                        |    7 +
 stubs/get-fd.c                                 |    8 +
 stubs/set-fd-handler.c                         |   11 +
 sysconfigs/target/target-x86_64.conf           |   86 -
 sysemu.h                                       |   51 +-
 target-alpha/Makefile.objs                     |    3 +
 target-alpha/STATUS                            |    4 +-
 target-alpha/cpu-qom.h                         |   71 +
 target-alpha/cpu.c                             |   58 +
 target-alpha/cpu.h                             |   53 +-
 target-alpha/fpu_helper.c                      |  822 +
 target-alpha/helper.c                          |   76 +-
 target-alpha/helper.h                          |  213 +-
 target-alpha/int_helper.c                      |  319 +
 target-alpha/machine.c                         |   44 +-
 target-alpha/mem_helper.c                      |  151 +
 target-alpha/op_helper.c                       | 1379 -
 target-alpha/sys_helper.c                      |   87 +
 target-alpha/translate.c                       |  408 +-
 target-arm/Makefile.objs                       |    4 +
 target-arm/arm-semi.c                          |  555 +
 target-arm/cpu-qom.h                           |  113 +
 target-arm/cpu.c                               |  805 +
 target-arm/cpu.h                               |  338 +-
 target-arm/helper.c                            | 3032 +-
 target-arm/helper.h                            |   83 +-
 target-arm/iwmmxt_helper.c                     |   66 +-
 target-arm/machine.c                           |   20 +-
 target-arm/neon_helper.c                       |  123 +-
 target-arm/op_helper.c                         |  170 +-
 target-arm/translate.c                         | 1085 +-
 target-cris/Makefile.objs                      |    2 +
 target-cris/cpu-qom.h                          |   70 +
 target-cris/cpu.c                              |   90 +
 target-cris/cpu.h                              |   37 +-
 target-cris/helper.c                           |   30 +-
 target-cris/helper.h                           |   39 +-
 target-cris/mmu.c                              |   19 +-
 target-cris/mmu.h                              |    6 +-
 target-cris/op_helper.c                        |  107 +-
 target-cris/translate.c                        | 5688 ++--
 target-cris/translate_v10.c                    |  126 +-
 target-i386/Makefile.objs                      |    8 +
 target-i386/TODO                               |    1 -
 target-i386/arch_dump.c                        |  449 +
 target-i386/arch_memory_mapping.c              |  272 +
 target-i386/cc_helper.c                        |  390 +
 target-i386/cc_helper_template.h               |  277 +
 target-i386/cpu-qom.h                          |   79 +
 target-i386/cpu.c                              | 2137 +
 target-i386/cpu.h                              |  227 +-
 target-i386/cpuid.c                            | 1322 -
 target-i386/excp_helper.c                      |  129 +
 target-i386/fpu_helper.c                       | 1289 +
 target-i386/helper.c                           |  369 +-
 target-i386/helper.h                           |  357 +-
 target-i386/helper_template.h                  |  334 -
 target-i386/hyperv.c                           |   64 +
 target-i386/hyperv.h                           |   45 +
 target-i386/int_helper.c                       |  500 +
 target-i386/ioport-user.c                      |   60 +
 target-i386/kvm-stub.c                         |   18 +
 target-i386/kvm.c                              |  646 +-
 target-i386/kvm_i386.h                         |   38 +
 target-i386/machine.c                          |  201 +-
 target-i386/mem_helper.c                       |  155 +
 target-i386/misc_helper.c                      |  602 +
 target-i386/op_helper.c                        | 5881 ---
 target-i386/ops_sse.h                          | 1274 +-
 target-i386/ops_sse_header.h                   |  334 +-
 target-i386/seg_helper.c                       | 2471 +
 target-i386/shift_helper_template.h            |  112 +
 target-i386/smm_helper.c                       |  301 +
 target-i386/svm_helper.c                       |  715 +
 target-i386/translate.c                        | 1449 +-
 target-lm32/Makefile.objs                      |    2 +
 target-lm32/cpu-qom.h                          |   71 +
 target-lm32/cpu.c                              |   81 +
 target-lm32/cpu.h                              |   49 +-
 target-lm32/helper.c                           |   42 +-
 target-lm32/helper.h                           |   20 +-
 target-lm32/machine.c                          |   22 +-
 target-lm32/op_helper.c                        |   37 +-
 target-lm32/translate.c                        |   91 +-
 target-m68k/Makefile.objs                      |    3 +
 target-m68k/cpu-qom.h                          |   70 +
 target-m68k/cpu.c                              |  170 +
 target-m68k/cpu.h                              |   24 +-
 target-m68k/helper.c                           |  245 +-
 target-m68k/helpers.h                          |    2 +-
 target-m68k/m68k-semi.c                        |  465 +
 target-m68k/op_helper.c                        |   83 +-
 target-m68k/translate.c                        |  322 +-
 target-microblaze/Makefile.objs                |    2 +
 target-microblaze/cpu-qom.h                    |   70 +
 target-microblaze/cpu.c                        |  120 +
 target-microblaze/cpu.h                        |   62 +-
 target-microblaze/helper.c                     |   18 +-
 target-microblaze/helper.h                     |   56 +-
 target-microblaze/mmu.c                        |   13 +-
 target-microblaze/mmu.h                        |    6 +-
 target-microblaze/op_helper.c                  |  136 +-
 target-microblaze/translate.c                  |  331 +-
 target-mips/Makefile.objs                      |    2 +
 target-mips/TODO                               |    7 +-
 target-mips/cpu-qom.h                          |   74 +
 target-mips/cpu.c                              |   69 +
 target-mips/cpu.h                              |  176 +-
 target-mips/dsp_helper.c                       | 4033 ++
 target-mips/helper.c                           |   38 +-
 target-mips/helper.h                           |  838 +-
 target-mips/lmi_helper.c                       |  744 +
 target-mips/machine.c                          |    6 +-
 target-mips/op_helper.c                        | 1759 +-
 target-mips/translate.c                        | 5123 ++-
 target-mips/translate_init.c                   |   52 +
 target-openrisc/Makefile.objs                  |    4 +
 target-openrisc/cpu.c                          |  220 +
 target-openrisc/cpu.h                          |  460 +
 target-openrisc/exception.c                    |   27 +
 target-openrisc/exception.h                    |   28 +
 target-openrisc/exception_helper.c             |   29 +
 target-openrisc/fpu_helper.c                   |  300 +
 target-openrisc/helper.h                       |   70 +
 target-openrisc/int_helper.c                   |   79 +
 target-openrisc/interrupt.c                    |   74 +
 target-openrisc/interrupt_helper.c             |   57 +
 target-openrisc/machine.c                      |   47 +
 target-openrisc/mmu.c                          |  243 +
 target-openrisc/mmu_helper.c                   |   63 +
 target-openrisc/sys_helper.c                   |  287 +
 target-openrisc/translate.c                    | 1836 +
 target-ppc/Makefile.objs                       |   12 +
 target-ppc/cpu-qom.h                           |   77 +
 target-ppc/cpu.h                               |  244 +-
 target-ppc/excp_helper.c                       |  973 +
 target-ppc/fpu_helper.c                        | 1740 +
 target-ppc/helper.c                            | 3183 +--
 target-ppc/helper.h                            |  592 +-
 target-ppc/int_helper.c                        | 1483 +
 target-ppc/kvm.c                               |  420 +-
 target-ppc/kvm_ppc.c                           |    2 +-
 target-ppc/kvm_ppc.h                           |   41 +-
 target-ppc/machine.c                           |   24 +-
 target-ppc/mem_helper.c                        |  295 +
 target-ppc/mfrom_table_gen.c                   |    2 +-
 target-ppc/misc_helper.c                       |  124 +
 target-ppc/mmu_helper.c                        | 3323 ++
 target-ppc/mpic_helper.c                       |   35 +
 target-ppc/op_helper.c                         | 4413 --
 target-ppc/timebase_helper.c                   |  159 +
 target-ppc/translate.c                         |  712 +-
 target-ppc/translate_init.c                    |  627 +-
 target-s390x/Makefile.objs                     |    4 +
 target-s390x/cc_helper.c                       |  550 +
 target-s390x/cpu-qom.h                         |   71 +
 target-s390x/cpu.c                             |   96 +
 target-s390x/cpu.h                             |   95 +-
 target-s390x/fpu_helper.c                      |  843 +
 target-s390x/helper.c                          |  182 +-
 target-s390x/helper.h                          |  152 +
 target-s390x/helpers.h                         |  152 -
 target-s390x/int_helper.c                      |  201 +
 target-s390x/interrupt.c                       |   29 +
 target-s390x/kvm.c                             |  241 +-
 target-s390x/mem_helper.c                      | 1203 +
 target-s390x/misc_helper.c                     |  387 +
 target-s390x/op_helper.c                       | 3026 --
 target-s390x/translate.c                       |  691 +-
 target-sh4/Makefile.objs                       |    2 +
 target-sh4/cpu-qom.h                           |   70 +
 target-sh4/cpu.c                               |   90 +
 target-sh4/cpu.h                               |   44 +-
 target-sh4/helper.c                            |   49 +-
 target-sh4/helper.h                            |   86 +-
 target-sh4/op_helper.c                         |  285 +-
 target-sh4/translate.c                         |  392 +-
 target-sparc/Makefile.objs                     |    6 +
 target-sparc/TODO                              |    2 +-
 target-sparc/cc_helper.c                       |   66 +-
 target-sparc/cpu-qom.h                         |   75 +
 target-sparc/cpu.c                             |  895 +
 target-sparc/cpu.h                             |   92 +-
 target-sparc/cpu_init.c                        |  848 -
 target-sparc/fop_helper.c                      |  131 +-
 target-sparc/helper.c                          |  102 +-
 target-sparc/helper.h                          |   78 +-
 target-sparc/int32_helper.c                    |   18 +-
 target-sparc/int64_helper.c                    |   25 +-
 target-sparc/ldst_helper.c                     |  559 +-
 target-sparc/machine.c                         |    4 +-
 target-sparc/mmu_helper.c                      |   80 +-
 target-sparc/op_helper.c                       |   74 -
 target-sparc/translate.c                       | 2516 +-
 target-sparc/vis_helper.c                      |    2 +-
 target-sparc/win_helper.c                      |   58 +-
 target-unicore32/Makefile.objs                 |    4 +
 target-unicore32/cpu-qom.h                     |   59 +
 target-unicore32/cpu.c                         |  113 +
 target-unicore32/cpu.h                         |   58 +-
 target-unicore32/helper.c                      |  580 +-
 target-unicore32/helper.h                      |   46 +-
 target-unicore32/machine.c                     |   23 +
 target-unicore32/op_helper.c                   |  100 +-
 target-unicore32/softmmu.c                     |  267 +
 target-unicore32/translate.c                   |  274 +-
 target-unicore32/ucf64_helper.c                |  345 +
 target-xtensa/Makefile.objs                    |    6 +
 target-xtensa/core-dc232b.c                    |   29 +-
 target-xtensa/core-dc233c.c                    |   55 +
 target-xtensa/core-dc233c/core-isa.h           |  474 +
 target-xtensa/core-dc233c/gdb-config.c         |  145 +
 target-xtensa/core-fsf.c                       |   29 +-
 target-xtensa/cpu-qom.h                        |   80 +
 target-xtensa/cpu.c                            |   88 +
 target-xtensa/cpu.h                            |  120 +-
 target-xtensa/helper.c                         |  211 +-
 target-xtensa/helper.h                         |   60 +
 target-xtensa/helpers.h                        |   32 -
 target-xtensa/op_helper.c                      |  453 +-
 target-xtensa/overlay_tool.h                   |   24 +-
 target-xtensa/translate.c                      |  612 +-
 target-xtensa/xtensa-semi.c                    |  321 +
 targphys.h                                     |   21 -
 tcg/README                                     |   46 +-
 tcg/arm/tcg-target.c                           |  370 +-
 tcg/arm/tcg-target.h                           |    9 +-
 tcg/hppa/tcg-target.c                          |  334 +-
 tcg/hppa/tcg-target.h                          |    8 +-
 tcg/i386/tcg-target.c                          |  914 +-
 tcg/i386/tcg-target.h                          |   22 +-
 tcg/ia64/tcg-target.c                          |  238 +-
 tcg/ia64/tcg-target.h                          |   16 +-
 tcg/mips/tcg-target.c                          |  517 +-
 tcg/mips/tcg-target.h                          |   31 +-
 tcg/optimize.c                                 |  688 +-
 tcg/ppc/tcg-target.c                           |  625 +-
 tcg/ppc/tcg-target.h                           |    5 +-
 tcg/ppc64/tcg-target.c                         |   77 +-
 tcg/ppc64/tcg-target.h                         |    3 +-
 tcg/s390/tcg-target.c                          |   65 +-
 tcg/s390/tcg-target.h                          |    8 +-
 tcg/sparc/tcg-target.c                         | 1621 +-
 tcg/sparc/tcg-target.h                         |   42 +-
 tcg/tcg-op.h                                   |  689 +-
 tcg/tcg-opc.h                                  |   34 +-
 tcg/tcg.c                                      | 1073 +-
 tcg/tcg.h                                      |  175 +-
 tcg/tci/tcg-target.c                           |   48 +-
 tcg/tci/tcg-target.h                           |   14 +-
 tci.c                                          |   74 +-
 test-coroutine.c                               |  192 -
 test-qmp-commands.c                            |  142 -
 test-visitor.c                                 |  338 -
 tests/.gitignore                               |   13 +
 tests/Makefile                                 |  302 +-
 tests/alpha/Makefile                           |   35 -
 tests/alpha/crt.s                              |   26 -
 tests/alpha/hello-alpha.c                      |    5 -
 tests/alpha/test-cond.c                        |   87 -
 tests/alpha/test-ovf.c                         |   29 -
 tests/check-block.sh                           |   21 +
 tests/check-qdict.c                            |  378 +
 tests/check-qfloat.c                           |   53 +
 tests/check-qint.c                             |   87 +
 tests/check-qjson.c                            |  781 +
 tests/check-qlist.c                            |  127 +
 tests/check-qstring.c                          |  107 +
 tests/cris/.gdbinit                            |   11 -
 tests/cris/Makefile                            |  155 -
 tests/cris/README                              |    1 -
 tests/cris/check_abs.c                         |   40 -
 tests/cris/check_addc.c                        |   58 -
 tests/cris/check_addcm.c                       |   85 -
 tests/cris/check_addi.s                        |   57 -
 tests/cris/check_addiv32.s                     |   62 -
 tests/cris/check_addm.s                        |   96 -
 tests/cris/check_addo.c                        |  125 -
 tests/cris/check_addoq.c                       |   44 -
 tests/cris/check_addq.s                        |   47 -
 tests/cris/check_addr.s                        |   96 -
 tests/cris/check_addxc.s                       |   91 -
 tests/cris/check_addxm.s                       |  106 -
 tests/cris/check_addxr.s                       |   96 -
 tests/cris/check_andc.s                        |   80 -
 tests/cris/check_andm.s                        |   90 -
 tests/cris/check_andq.s                        |   46 -
 tests/cris/check_andr.s                        |   95 -
 tests/cris/check_asr.s                         |  230 -
 tests/cris/check_ba.s                          |   93 -
 tests/cris/check_bas.s                         |  102 -
 tests/cris/check_bcc.s                         |  197 -
 tests/cris/check_bound.c                       |  142 -
 tests/cris/check_boundc.s                      |  101 -
 tests/cris/check_boundr.s                      |  125 -
 tests/cris/check_btst.s                        |   96 -
 tests/cris/check_clearfv32.s                   |   19 -
 tests/cris/check_clrjmp1.s                     |   36 -
 tests/cris/check_cmp-2.s                       |   15 -
 tests/cris/check_cmpc.s                        |   86 -
 tests/cris/check_cmpm.s                        |   96 -
 tests/cris/check_cmpq.s                        |   75 -
 tests/cris/check_cmpr.s                        |  102 -
 tests/cris/check_cmpxc.s                       |   92 -
 tests/cris/check_cmpxm.s                       |  106 -
 tests/cris/check_dstep.s                       |   42 -
 tests/cris/check_ftag.c                        |   37 -
 tests/cris/check_gcctorture_pr28634-1.c        |   15 -
 tests/cris/check_gcctorture_pr28634.c          |   15 -
 tests/cris/check_glibc_kernelversion.c         |  116 -
 tests/cris/check_hello.c                       |    7 -
 tests/cris/check_int64.c                       |   47 -
 tests/cris/check_jsr.s                         |   85 -
 tests/cris/check_lapc.s                        |   78 -
 tests/cris/check_lsl.s                         |  217 -
 tests/cris/check_lsr.s                         |  218 -
 tests/cris/check_lz.c                          |   49 -
 tests/cris/check_mapbrk.c                      |   39 -
 tests/cris/check_mcp.s                         |   49 -
 tests/cris/check_mmap1.c                       |   48 -
 tests/cris/check_mmap2.c                       |   48 -
 tests/cris/check_mmap3.c                       |   33 -
 tests/cris/check_movdelsr1.s                   |   33 -
 tests/cris/check_movecr.s                      |   37 -
 tests/cris/check_movei.s                       |   50 -
 tests/cris/check_movemr.s                      |   78 -
 tests/cris/check_movemrv32.s                   |   96 -
 tests/cris/check_moveq.c                       |   51 -
 tests/cris/check_mover.s                       |   28 -
 tests/cris/check_moverm.s                      |   45 -
 tests/cris/check_movmp.s                       |  131 -
 tests/cris/check_movpmv32.s                    |   35 -
 tests/cris/check_movpr.s                       |   28 -
 tests/cris/check_movprv32.s                    |   21 -
 tests/cris/check_movscr.s                      |   29 -
 tests/cris/check_movsm.s                       |   44 -
 tests/cris/check_movsr.s                       |   46 -
 tests/cris/check_movucr.s                      |   33 -
 tests/cris/check_movum.s                       |   40 -
 tests/cris/check_movur.s                       |   45 -
 tests/cris/check_mulv32.s                      |   51 -
 tests/cris/check_mulx.s                        |  246 -
 tests/cris/check_neg.s                         |  104 -
 tests/cris/check_not.s                         |   31 -
 tests/cris/check_openpf1.c                     |   38 -
 tests/cris/check_openpf2.c                     |   16 -
 tests/cris/check_openpf3.c                     |   49 -
 tests/cris/check_openpf4.c                     |    5 -
 tests/cris/check_openpf5.c                     |   56 -
 tests/cris/check_orc.s                         |   71 -
 tests/cris/check_orm.s                         |   75 -
 tests/cris/check_orq.s                         |   41 -
 tests/cris/check_orr.s                         |   84 -
 tests/cris/check_ret.s                         |   25 -
 tests/cris/check_scc.s                         |   95 -
 tests/cris/check_settls1.c                     |   45 -
 tests/cris/check_sigalrm.c                     |   26 -
 tests/cris/check_stat1.c                       |   16 -
 tests/cris/check_stat2.c                       |   20 -
 tests/cris/check_stat3.c                       |   25 -
 tests/cris/check_stat4.c                       |   27 -
 tests/cris/check_subc.s                        |   87 -
 tests/cris/check_subm.s                        |   96 -
 tests/cris/check_subq.s                        |   52 -
 tests/cris/check_subr.s                        |  102 -
 tests/cris/check_swap.c                        |   76 -
 tests/cris/check_time1.c                       |   46 -
 tests/cris/check_time2.c                       |   18 -
 tests/cris/check_xarith.s                      |   72 -
 tests/cris/crisutils.h                         |   71 -
 tests/cris/crt.s                               |   13 -
 tests/cris/sys.c                               |   51 -
 tests/cris/sys.h                               |   16 -
 tests/cris/testutils.inc                       |  117 -
 tests/fdc-test.c                               |  563 +
 tests/hd-geo-test.c                            |  428 +
 tests/hello-arm.c                              |  113 -
 tests/hello-i386.c                             |   26 -
 tests/hello-mips.c                             |   64 -
 tests/libqtest.c                               |  478 +
 tests/libqtest.h                               |  352 +
 tests/linux-test.c                             |  537 -
 tests/lm32/Makefile                            |  102 -
 tests/lm32/crt.S                               |   84 -
 tests/lm32/linker.ld                           |   55 -
 tests/lm32/macros.inc                          |   79 -
 tests/lm32/test_add.S                          |   75 -
 tests/lm32/test_addi.S                         |   56 -
 tests/lm32/test_and.S                          |   45 -
 tests/lm32/test_andhi.S                        |   35 -
 tests/lm32/test_andi.S                         |   35 -
 tests/lm32/test_b.S                            |   13 -
 tests/lm32/test_be.S                           |   48 -
 tests/lm32/test_bg.S                           |   78 -
 tests/lm32/test_bge.S                          |   78 -
 tests/lm32/test_bgeu.S                         |   78 -
 tests/lm32/test_bgu.S                          |   78 -
 tests/lm32/test_bi.S                           |   23 -
 tests/lm32/test_bne.S                          |   48 -
 tests/lm32/test_break.S                        |   20 -
 tests/lm32/test_bret.S                         |   38 -
 tests/lm32/test_call.S                         |   16 -
 tests/lm32/test_calli.S                        |   15 -
 tests/lm32/test_cmpe.S                         |   40 -
 tests/lm32/test_cmpei.S                        |   35 -
 tests/lm32/test_cmpg.S                         |   64 -
 tests/lm32/test_cmpge.S                        |   64 -
 tests/lm32/test_cmpgei.S                       |   55 -
 tests/lm32/test_cmpgeu.S                       |   64 -
 tests/lm32/test_cmpgeui.S                      |   55 -
 tests/lm32/test_cmpgi.S                        |   55 -
 tests/lm32/test_cmpgu.S                        |   64 -
 tests/lm32/test_cmpgui.S                       |   55 -
 tests/lm32/test_cmpne.S                        |   40 -
 tests/lm32/test_cmpnei.S                       |   35 -
 tests/lm32/test_divu.S                         |   29 -
 tests/lm32/test_eret.S                         |   38 -
 tests/lm32/test_lb.S                           |   45 -
 tests/lm32/test_lbu.S                          |   45 -
 tests/lm32/test_lh.S                           |   45 -
 tests/lm32/test_lhu.S                          |   45 -
 tests/lm32/test_lw.S                           |   30 -
 tests/lm32/test_modu.S                         |   35 -
 tests/lm32/test_mul.S                          |   70 -
 tests/lm32/test_muli.S                         |   45 -
 tests/lm32/test_nor.S                          |   51 -
 tests/lm32/test_nori.S                         |   35 -
 tests/lm32/test_or.S                           |   51 -
 tests/lm32/test_orhi.S                         |   35 -
 tests/lm32/test_ori.S                          |   35 -
 tests/lm32/test_ret.S                          |   14 -
 tests/lm32/test_sb.S                           |   30 -
 tests/lm32/test_scall.S                        |   20 -
 tests/lm32/test_sextb.S                        |   20 -
 tests/lm32/test_sexth.S                        |   20 -
 tests/lm32/test_sh.S                           |   30 -
 tests/lm32/test_sl.S                           |   45 -
 tests/lm32/test_sli.S                          |   30 -
 tests/lm32/test_sr.S                           |   57 -
 tests/lm32/test_sri.S                          |   40 -
 tests/lm32/test_sru.S                          |   57 -
 tests/lm32/test_srui.S                         |   40 -
 tests/lm32/test_sub.S                          |   75 -
 tests/lm32/test_sw.S                           |   35 -
 tests/lm32/test_xnor.S                         |   51 -
 tests/lm32/test_xnori.S                        |   35 -
 tests/lm32/test_xor.S                          |   51 -
 tests/lm32/test_xori.S                         |   35 -
 tests/m48t59-test.c                            |  259 +
 tests/pi_10.com                                |  Bin 54 -> 0 bytes
 tests/qemu-iotests-quick.sh                    |   17 +
 tests/qemu-iotests/.gitignore                  |    7 +
 tests/qemu-iotests/001                         |   65 +
 tests/qemu-iotests/001.out                     |   15 +
 tests/qemu-iotests/002                         |   72 +
 tests/qemu-iotests/002.out                     |   23 +
 tests/qemu-iotests/003                         |   78 +
 tests/qemu-iotests/003.out                     |   23 +
 tests/qemu-iotests/004                         |  104 +
 tests/qemu-iotests/004.out                     |   41 +
 tests/qemu-iotests/005                         |   73 +
 tests/qemu-iotests/005.out                     |   13 +
 tests/qemu-iotests/006                         |   54 +
 tests/qemu-iotests/006.out                     |    6 +
 tests/qemu-iotests/007                         |   67 +
 tests/qemu-iotests/007.out                     |   18 +
 tests/qemu-iotests/008                         |   65 +
 tests/qemu-iotests/008.out                     |   15 +
 tests/qemu-iotests/009                         |   69 +
 tests/qemu-iotests/009.out                     |   18 +
 tests/qemu-iotests/010                         |   71 +
 tests/qemu-iotests/010.out                     |   22 +
 tests/qemu-iotests/011                         |   75 +
 tests/qemu-iotests/011.out                     |   50 +
 tests/qemu-iotests/012                         |   62 +
 tests/qemu-iotests/012.out                     |    9 +
 tests/qemu-iotests/013                         |   98 +
 tests/qemu-iotests/013.out                     |43983 ++++++++++++++++
 tests/qemu-iotests/014                         |   77 +
 tests/qemu-iotests/014.out                     |64074 ++++++++++++++++++++++++
 tests/qemu-iotests/015                         |   85 +
 tests/qemu-iotests/015.out                     |   20 +
 tests/qemu-iotests/016                         |   70 +
 tests/qemu-iotests/016.out                     |   23 +
 tests/qemu-iotests/017                         |  101 +
 tests/qemu-iotests/017.out                     | 1077 +
 tests/qemu-iotests/018                         |  104 +
 tests/qemu-iotests/018.out                     | 1077 +
 tests/qemu-iotests/019                         |  129 +
 tests/qemu-iotests/019.out                     | 1628 +
 tests/qemu-iotests/020                         |  106 +
 tests/qemu-iotests/020.out                     | 1078 +
 tests/qemu-iotests/021                         |   63 +
 tests/qemu-iotests/021.out                     |   93 +
 tests/qemu-iotests/022                         |   67 +
 tests/qemu-iotests/022.out                     | 8801 ++++
 tests/qemu-iotests/023                         |  120 +
 tests/qemu-iotests/023.out                     |25706 ++++++++++
 tests/qemu-iotests/024                         |  125 +
 tests/qemu-iotests/024.out                     |  144 +
 tests/qemu-iotests/025                         |   78 +
 tests/qemu-iotests/025.out                     |   27 +
 tests/qemu-iotests/026                         |  199 +
 tests/qemu-iotests/026.out                     |  618 +
 tests/qemu-iotests/027                         |   78 +
 tests/qemu-iotests/027.out                     |   23 +
 tests/qemu-iotests/028                         |  107 +
 tests/qemu-iotests/028.out                     |  469 +
 tests/qemu-iotests/029                         |   65 +
 tests/qemu-iotests/029.out                     |   10 +
 tests/qemu-iotests/030                         |  530 +
 tests/qemu-iotests/030.out                     |    5 +
 tests/qemu-iotests/031                         |   80 +
 tests/qemu-iotests/031.out                     |  204 +
 tests/qemu-iotests/032                         |   69 +
 tests/qemu-iotests/032.out                     |   78 +
 tests/qemu-iotests/033                         |   73 +
 tests/qemu-iotests/033.out                     |   29 +
 tests/qemu-iotests/034                         |  113 +
 tests/qemu-iotests/034.out                     |   81 +
 tests/qemu-iotests/035                         |   72 +
 tests/qemu-iotests/035.out                     |  392 +
 tests/qemu-iotests/036                         |   68 +
 tests/qemu-iotests/036.out                     |   52 +
 tests/qemu-iotests/037                         |  119 +
 tests/qemu-iotests/037.out                     |  645 +
 tests/qemu-iotests/038                         |  133 +
 tests/qemu-iotests/038.out                     |  909 +
 tests/qemu-iotests/039                         |  137 +
 tests/qemu-iotests/039.out                     |   59 +
 tests/qemu-iotests/040                         |  280 +
 tests/qemu-iotests/040.out                     |    5 +
 tests/qemu-iotests/041                         |  615 +
 tests/qemu-iotests/041.out                     |    5 +
 tests/qemu-iotests/042                         |   78 +
 tests/qemu-iotests/042.out                     |   15 +
 tests/qemu-iotests/043                         |   95 +
 tests/qemu-iotests/043.out                     |   66 +
 tests/qemu-iotests/044                         |  117 +
 tests/qemu-iotests/044.out                     |    6 +
 tests/qemu-iotests/COPYING                     |  339 +
 tests/qemu-iotests/Makefile                    |    9 +
 tests/qemu-iotests/README                      |   20 +
 tests/qemu-iotests/check                       |  281 +
 tests/qemu-iotests/common                      |  365 +
 tests/qemu-iotests/common.config               |  147 +
 tests/qemu-iotests/common.filter               |  156 +
 tests/qemu-iotests/common.pattern              |  140 +
 tests/qemu-iotests/common.rc                   |  399 +
 tests/qemu-iotests/group                       |   53 +
 tests/qemu-iotests/iotests.py                  |  189 +
 tests/qemu-iotests/qcow2.py                    |  241 +
 tests/qemu-iotests/qed.py                      |  235 +
 tests/qruncom.c                                |  284 -
 tests/rtc-test.c                               |  353 +
 tests/runcom.c                                 |  192 -
 tests/sha1.c                                   |  240 -
 tests/tcg/Makefile                             |  158 +
 tests/tcg/alpha/Makefile                       |   35 +
 tests/tcg/alpha/crt.s                          |   26 +
 tests/tcg/alpha/hello-alpha.c                  |    5 +
 tests/tcg/alpha/test-cond.c                    |   87 +
 tests/tcg/alpha/test-ovf.c                     |   29 +
 tests/tcg/cris/.gdbinit                        |   11 +
 tests/tcg/cris/Makefile                        |  155 +
 tests/tcg/cris/README                          |    1 +
 tests/tcg/cris/check_abs.c                     |   40 +
 tests/tcg/cris/check_addc.c                    |   58 +
 tests/tcg/cris/check_addcm.c                   |   85 +
 tests/tcg/cris/check_addi.s                    |   57 +
 tests/tcg/cris/check_addiv32.s                 |   62 +
 tests/tcg/cris/check_addm.s                    |   96 +
 tests/tcg/cris/check_addo.c                    |  125 +
 tests/tcg/cris/check_addoq.c                   |   44 +
 tests/tcg/cris/check_addq.s                    |   47 +
 tests/tcg/cris/check_addr.s                    |   96 +
 tests/tcg/cris/check_addxc.s                   |   91 +
 tests/tcg/cris/check_addxm.s                   |  106 +
 tests/tcg/cris/check_addxr.s                   |   96 +
 tests/tcg/cris/check_andc.s                    |   80 +
 tests/tcg/cris/check_andm.s                    |   90 +
 tests/tcg/cris/check_andq.s                    |   46 +
 tests/tcg/cris/check_andr.s                    |   95 +
 tests/tcg/cris/check_asr.s                     |  230 +
 tests/tcg/cris/check_ba.s                      |   93 +
 tests/tcg/cris/check_bas.s                     |  102 +
 tests/tcg/cris/check_bcc.s                     |  197 +
 tests/tcg/cris/check_bound.c                   |  142 +
 tests/tcg/cris/check_boundc.s                  |  101 +
 tests/tcg/cris/check_boundr.s                  |  125 +
 tests/tcg/cris/check_btst.s                    |   96 +
 tests/tcg/cris/check_clearfv32.s               |   19 +
 tests/tcg/cris/check_clrjmp1.s                 |   36 +
 tests/tcg/cris/check_cmp-2.s                   |   15 +
 tests/tcg/cris/check_cmpc.s                    |   86 +
 tests/tcg/cris/check_cmpm.s                    |   96 +
 tests/tcg/cris/check_cmpq.s                    |   75 +
 tests/tcg/cris/check_cmpr.s                    |  102 +
 tests/tcg/cris/check_cmpxc.s                   |   92 +
 tests/tcg/cris/check_cmpxm.s                   |  106 +
 tests/tcg/cris/check_dstep.s                   |   42 +
 tests/tcg/cris/check_ftag.c                    |   37 +
 tests/tcg/cris/check_gcctorture_pr28634-1.c    |   15 +
 tests/tcg/cris/check_gcctorture_pr28634.c      |   15 +
 tests/tcg/cris/check_glibc_kernelversion.c     |  116 +
 tests/tcg/cris/check_hello.c                   |    7 +
 tests/tcg/cris/check_int64.c                   |   47 +
 tests/tcg/cris/check_jsr.s                     |   85 +
 tests/tcg/cris/check_lapc.s                    |   78 +
 tests/tcg/cris/check_lsl.s                     |  217 +
 tests/tcg/cris/check_lsr.s                     |  218 +
 tests/tcg/cris/check_lz.c                      |   49 +
 tests/tcg/cris/check_mapbrk.c                  |   39 +
 tests/tcg/cris/check_mcp.s                     |   49 +
 tests/tcg/cris/check_mmap1.c                   |   48 +
 tests/tcg/cris/check_mmap2.c                   |   48 +
 tests/tcg/cris/check_mmap3.c                   |   33 +
 tests/tcg/cris/check_movdelsr1.s               |   33 +
 tests/tcg/cris/check_movecr.s                  |   37 +
 tests/tcg/cris/check_movei.s                   |   50 +
 tests/tcg/cris/check_movemr.s                  |   78 +
 tests/tcg/cris/check_movemrv32.s               |   96 +
 tests/tcg/cris/check_moveq.c                   |   51 +
 tests/tcg/cris/check_mover.s                   |   28 +
 tests/tcg/cris/check_moverm.s                  |   45 +
 tests/tcg/cris/check_movmp.s                   |  131 +
 tests/tcg/cris/check_movpmv32.s                |   35 +
 tests/tcg/cris/check_movpr.s                   |   28 +
 tests/tcg/cris/check_movprv32.s                |   21 +
 tests/tcg/cris/check_movscr.s                  |   29 +
 tests/tcg/cris/check_movsm.s                   |   44 +
 tests/tcg/cris/check_movsr.s                   |   46 +
 tests/tcg/cris/check_movucr.s                  |   33 +
 tests/tcg/cris/check_movum.s                   |   40 +
 tests/tcg/cris/check_movur.s                   |   45 +
 tests/tcg/cris/check_mulv32.s                  |   51 +
 tests/tcg/cris/check_mulx.s                    |  246 +
 tests/tcg/cris/check_neg.s                     |  104 +
 tests/tcg/cris/check_not.s                     |   31 +
 tests/tcg/cris/check_openpf1.c                 |   38 +
 tests/tcg/cris/check_openpf2.c                 |   16 +
 tests/tcg/cris/check_openpf3.c                 |   49 +
 tests/tcg/cris/check_openpf4.c                 |    5 +
 tests/tcg/cris/check_openpf5.c                 |   56 +
 tests/tcg/cris/check_orc.s                     |   71 +
 tests/tcg/cris/check_orm.s                     |   75 +
 tests/tcg/cris/check_orq.s                     |   41 +
 tests/tcg/cris/check_orr.s                     |   84 +
 tests/tcg/cris/check_ret.s                     |   25 +
 tests/tcg/cris/check_scc.s                     |   95 +
 tests/tcg/cris/check_settls1.c                 |   45 +
 tests/tcg/cris/check_sigalrm.c                 |   26 +
 tests/tcg/cris/check_stat1.c                   |   16 +
 tests/tcg/cris/check_stat2.c                   |   20 +
 tests/tcg/cris/check_stat3.c                   |   25 +
 tests/tcg/cris/check_stat4.c                   |   27 +
 tests/tcg/cris/check_subc.s                    |   87 +
 tests/tcg/cris/check_subm.s                    |   96 +
 tests/tcg/cris/check_subq.s                    |   52 +
 tests/tcg/cris/check_subr.s                    |  102 +
 tests/tcg/cris/check_swap.c                    |   76 +
 tests/tcg/cris/check_time1.c                   |   46 +
 tests/tcg/cris/check_time2.c                   |   18 +
 tests/tcg/cris/check_xarith.s                  |   72 +
 tests/tcg/cris/crisutils.h                     |   71 +
 tests/tcg/cris/crt.s                           |   13 +
 tests/tcg/cris/sys.c                           |   51 +
 tests/tcg/cris/sys.h                           |   16 +
 tests/tcg/cris/testutils.inc                   |  117 +
 tests/tcg/hello-arm.c                          |  113 +
 tests/tcg/hello-i386.c                         |   27 +
 tests/tcg/hello-mips.c                         |   64 +
 tests/tcg/linux-test.c                         |  539 +
 tests/tcg/lm32/Makefile                        |  105 +
 tests/tcg/lm32/crt.S                           |   84 +
 tests/tcg/lm32/linker.ld                       |   55 +
 tests/tcg/lm32/macros.inc                      |   79 +
 tests/tcg/lm32/test_add.S                      |   75 +
 tests/tcg/lm32/test_addi.S                     |   56 +
 tests/tcg/lm32/test_and.S                      |   45 +
 tests/tcg/lm32/test_andhi.S                    |   35 +
 tests/tcg/lm32/test_andi.S                     |   35 +
 tests/tcg/lm32/test_b.S                        |   13 +
 tests/tcg/lm32/test_be.S                       |   48 +
 tests/tcg/lm32/test_bg.S                       |   78 +
 tests/tcg/lm32/test_bge.S                      |   78 +
 tests/tcg/lm32/test_bgeu.S                     |   78 +
 tests/tcg/lm32/test_bgu.S                      |   78 +
 tests/tcg/lm32/test_bi.S                       |   23 +
 tests/tcg/lm32/test_bne.S                      |   48 +
 tests/tcg/lm32/test_break.S                    |   20 +
 tests/tcg/lm32/test_bret.S                     |   38 +
 tests/tcg/lm32/test_call.S                     |   16 +
 tests/tcg/lm32/test_calli.S                    |   15 +
 tests/tcg/lm32/test_cmpe.S                     |   40 +
 tests/tcg/lm32/test_cmpei.S                    |   35 +
 tests/tcg/lm32/test_cmpg.S                     |   64 +
 tests/tcg/lm32/test_cmpge.S                    |   64 +
 tests/tcg/lm32/test_cmpgei.S                   |   55 +
 tests/tcg/lm32/test_cmpgeu.S                   |   64 +
 tests/tcg/lm32/test_cmpgeui.S                  |   55 +
 tests/tcg/lm32/test_cmpgi.S                    |   55 +
 tests/tcg/lm32/test_cmpgu.S                    |   64 +
 tests/tcg/lm32/test_cmpgui.S                   |   55 +
 tests/tcg/lm32/test_cmpne.S                    |   40 +
 tests/tcg/lm32/test_cmpnei.S                   |   35 +
 tests/tcg/lm32/test_divu.S                     |   29 +
 tests/tcg/lm32/test_eret.S                     |   38 +
 tests/tcg/lm32/test_lb.S                       |   45 +
 tests/tcg/lm32/test_lbu.S                      |   45 +
 tests/tcg/lm32/test_lh.S                       |   45 +
 tests/tcg/lm32/test_lhu.S                      |   45 +
 tests/tcg/lm32/test_lw.S                       |   30 +
 tests/tcg/lm32/test_modu.S                     |   35 +
 tests/tcg/lm32/test_mul.S                      |   70 +
 tests/tcg/lm32/test_muli.S                     |   45 +
 tests/tcg/lm32/test_nor.S                      |   51 +
 tests/tcg/lm32/test_nori.S                     |   35 +
 tests/tcg/lm32/test_or.S                       |   51 +
 tests/tcg/lm32/test_orhi.S                     |   35 +
 tests/tcg/lm32/test_ori.S                      |   35 +
 tests/tcg/lm32/test_ret.S                      |   14 +
 tests/tcg/lm32/test_sb.S                       |   30 +
 tests/tcg/lm32/test_scall.S                    |   20 +
 tests/tcg/lm32/test_sextb.S                    |   20 +
 tests/tcg/lm32/test_sexth.S                    |   20 +
 tests/tcg/lm32/test_sh.S                       |   30 +
 tests/tcg/lm32/test_sl.S                       |   45 +
 tests/tcg/lm32/test_sli.S                      |   30 +
 tests/tcg/lm32/test_sr.S                       |   57 +
 tests/tcg/lm32/test_sri.S                      |   40 +
 tests/tcg/lm32/test_sru.S                      |   57 +
 tests/tcg/lm32/test_srui.S                     |   40 +
 tests/tcg/lm32/test_sub.S                      |   75 +
 tests/tcg/lm32/test_sw.S                       |   35 +
 tests/tcg/lm32/test_xnor.S                     |   51 +
 tests/tcg/lm32/test_xnori.S                    |   35 +
 tests/tcg/lm32/test_xor.S                      |   51 +
 tests/tcg/lm32/test_xori.S                     |   35 +
 tests/tcg/mips/mips32-dsp/Makefile             |  136 +
 tests/tcg/mips/mips32-dsp/absq_s_ph.c          |   31 +
 tests/tcg/mips/mips32-dsp/absq_s_w.c           |   37 +
 tests/tcg/mips/mips32-dsp/addq_ph.c            |   46 +
 tests/tcg/mips/mips32-dsp/addq_s_ph.c          |   69 +
 tests/tcg/mips/mips32-dsp/addq_s_w.c           |   44 +
 tests/tcg/mips/mips32-dsp/addsc.c              |   33 +
 tests/tcg/mips/mips32-dsp/addu_qb.c            |   35 +
 tests/tcg/mips/mips32-dsp/addu_s_qb.c          |   35 +
 tests/tcg/mips/mips32-dsp/addwc.c              |   49 +
 tests/tcg/mips/mips32-dsp/bitrev.c             |   20 +
 tests/tcg/mips/mips32-dsp/bposge32.c           |   44 +
 tests/tcg/mips/mips32-dsp/cmp_eq_ph.c          |   35 +
 tests/tcg/mips/mips32-dsp/cmp_le_ph.c          |   35 +
 tests/tcg/mips/mips32-dsp/cmp_lt_ph.c          |   35 +
 tests/tcg/mips/mips32-dsp/cmpgu_eq_qb.c        |   31 +
 tests/tcg/mips/mips32-dsp/cmpgu_le_qb.c        |   31 +
 tests/tcg/mips/mips32-dsp/cmpgu_lt_qb.c        |   31 +
 tests/tcg/mips/mips32-dsp/cmpu_eq_qb.c         |   35 +
 tests/tcg/mips/mips32-dsp/cmpu_le_qb.c         |   35 +
 tests/tcg/mips/mips32-dsp/cmpu_lt_qb.c         |   35 +
 tests/tcg/mips/mips32-dsp/dpaq_s_w_ph.c        |   31 +
 tests/tcg/mips/mips32-dsp/dpaq_sa_l_w.c        |   77 +
 tests/tcg/mips/mips32-dsp/dpau_h_qbl.c         |   27 +
 tests/tcg/mips/mips32-dsp/dpau_h_qbr.c         |   27 +
 tests/tcg/mips/mips32-dsp/dpsq_s_w_ph.c        |   45 +
 tests/tcg/mips/mips32-dsp/dpsq_sa_l_w.c        |   55 +
 tests/tcg/mips/mips32-dsp/dpsu_h_qbl.c         |   27 +
 tests/tcg/mips/mips32-dsp/dpsu_h_qbr.c         |   27 +
 tests/tcg/mips/mips32-dsp/extp.c               |   44 +
 tests/tcg/mips/mips32-dsp/extpdp.c             |   46 +
 tests/tcg/mips/mips32-dsp/extpdpv.c            |   47 +
 tests/tcg/mips/mips32-dsp/extpv.c              |   45 +
 tests/tcg/mips/mips32-dsp/extr_r_w.c           |   48 +
 tests/tcg/mips/mips32-dsp/extr_rs_w.c          |   48 +
 tests/tcg/mips/mips32-dsp/extr_s_h.c           |   63 +
 tests/tcg/mips/mips32-dsp/extr_w.c             |   48 +
 tests/tcg/mips/mips32-dsp/extrv_r_w.c          |   54 +
 tests/tcg/mips/mips32-dsp/extrv_rs_w.c         |   52 +
 tests/tcg/mips/mips32-dsp/extrv_s_h.c          |   71 +
 tests/tcg/mips/mips32-dsp/extrv_w.c            |   54 +
 tests/tcg/mips/mips32-dsp/insv.c               |   23 +
 tests/tcg/mips/mips32-dsp/lbux.c               |   25 +
 tests/tcg/mips/mips32-dsp/lhx.c                |   25 +
 tests/tcg/mips/mips32-dsp/lwx.c                |   25 +
 tests/tcg/mips/mips32-dsp/madd.c               |   31 +
 tests/tcg/mips/mips32-dsp/maddu.c              |   31 +
 tests/tcg/mips/mips32-dsp/main.c               |    6 +
 tests/tcg/mips/mips32-dsp/maq_s_w_phl.c        |   55 +
 tests/tcg/mips/mips32-dsp/maq_s_w_phr.c        |   55 +
 tests/tcg/mips/mips32-dsp/maq_sa_w_phl.c       |   55 +
 tests/tcg/mips/mips32-dsp/maq_sa_w_phr.c       |   55 +
 tests/tcg/mips/mips32-dsp/mfhi.c               |   21 +
 tests/tcg/mips/mips32-dsp/mflo.c               |   21 +
 tests/tcg/mips/mips32-dsp/modsub.c             |   30 +
 tests/tcg/mips/mips32-dsp/msub.c               |   30 +
 tests/tcg/mips/mips32-dsp/msubu.c              |   30 +
 tests/tcg/mips/mips32-dsp/mthi.c               |   21 +
 tests/tcg/mips/mips32-dsp/mthlip.c             |   58 +
 tests/tcg/mips/mips32-dsp/mtlo.c               |   21 +
 tests/tcg/mips/mips32-dsp/muleq_s_w_phl.c      |   41 +
 tests/tcg/mips/mips32-dsp/muleq_s_w_phr.c      |   40 +
 tests/tcg/mips/mips32-dsp/muleu_s_ph_qbl.c     |   25 +
 tests/tcg/mips/mips32-dsp/muleu_s_ph_qbr.c     |   25 +
 tests/tcg/mips/mips32-dsp/mulq_rs_ph.c         |   25 +
 tests/tcg/mips/mips32-dsp/mult.c               |   24 +
 tests/tcg/mips/mips32-dsp/multu.c              |   24 +
 tests/tcg/mips/mips32-dsp/packrl_ph.c          |   21 +
 tests/tcg/mips/mips32-dsp/pick_ph.c            |   49 +
 tests/tcg/mips/mips32-dsp/pick_qb.c            |   36 +
 tests/tcg/mips/mips32-dsp/preceq_w_phl.c       |   20 +
 tests/tcg/mips/mips32-dsp/preceq_w_phr.c       |   20 +
 tests/tcg/mips/mips32-dsp/precequ_ph_qbl.c     |   20 +
 tests/tcg/mips/mips32-dsp/precequ_ph_qbla.c    |   20 +
 tests/tcg/mips/mips32-dsp/precequ_ph_qbr.c     |   20 +
 tests/tcg/mips/mips32-dsp/precequ_ph_qbra.c    |   20 +
 tests/tcg/mips/mips32-dsp/preceu_ph_qbl.c      |   20 +
 tests/tcg/mips/mips32-dsp/preceu_ph_qbla.c     |   20 +
 tests/tcg/mips/mips32-dsp/preceu_ph_qbr.c      |   20 +
 tests/tcg/mips/mips32-dsp/preceu_ph_qbra.c     |   20 +
 tests/tcg/mips/mips32-dsp/precrq_ph_w.c        |   21 +
 tests/tcg/mips/mips32-dsp/precrq_qb_ph.c       |   21 +
 tests/tcg/mips/mips32-dsp/precrq_rs_ph_w.c     |   35 +
 tests/tcg/mips/mips32-dsp/precrqu_s_qb_ph.c    |   24 +
 tests/tcg/mips/mips32-dsp/raddu_w_qb.c         |   20 +
 tests/tcg/mips/mips32-dsp/rddsp.c              |   54 +
 tests/tcg/mips/mips32-dsp/repl_ph.c            |   23 +
 tests/tcg/mips/mips32-dsp/repl_qb.c            |   16 +
 tests/tcg/mips/mips32-dsp/replv_ph.c           |   19 +
 tests/tcg/mips/mips32-dsp/replv_qb.c           |   19 +
 tests/tcg/mips/mips32-dsp/shilo.c              |   27 +
 tests/tcg/mips/mips32-dsp/shilov.c             |   29 +
 tests/tcg/mips/mips32-dsp/shll_ph.c            |   24 +
 tests/tcg/mips/mips32-dsp/shll_qb.c            |   36 +
 tests/tcg/mips/mips32-dsp/shll_s_ph.c          |   24 +
 tests/tcg/mips/mips32-dsp/shll_s_w.c           |   52 +
 tests/tcg/mips/mips32-dsp/shllv_ph.c           |   40 +
 tests/tcg/mips/mips32-dsp/shllv_qb.c           |   38 +
 tests/tcg/mips/mips32-dsp/shllv_s_ph.c         |   40 +
 tests/tcg/mips/mips32-dsp/shllv_s_w.c          |   40 +
 tests/tcg/mips/mips32-dsp/shra_ph.c            |   30 +
 tests/tcg/mips/mips32-dsp/shra_r_ph.c          |   30 +
 tests/tcg/mips/mips32-dsp/shra_r_w.c           |   30 +
 tests/tcg/mips/mips32-dsp/shrav_ph.c           |   32 +
 tests/tcg/mips/mips32-dsp/shrav_r_ph.c         |   32 +
 tests/tcg/mips/mips32-dsp/shrav_r_w.c          |   32 +
 tests/tcg/mips/mips32-dsp/shrl_qb.c            |   31 +
 tests/tcg/mips/mips32-dsp/shrlv_qb.c           |   32 +
 tests/tcg/mips/mips32-dsp/subq_ph.c            |   40 +
 tests/tcg/mips/mips32-dsp/subq_s_ph.c          |   40 +
 tests/tcg/mips/mips32-dsp/subq_s_w.c           |   58 +
 tests/tcg/mips/mips32-dsp/subu_qb.c            |   25 +
 tests/tcg/mips/mips32-dsp/subu_s_qb.c          |   25 +
 tests/tcg/mips/mips32-dsp/wrdsp.c              |   54 +
 tests/tcg/mips/mips32-dspr2/Makefile           |   71 +
 tests/tcg/mips/mips32-dspr2/absq_s_qb.c        |   35 +
 tests/tcg/mips/mips32-dspr2/addqh_ph.c         |   30 +
 tests/tcg/mips/mips32-dspr2/addqh_r_ph.c       |   30 +
 tests/tcg/mips/mips32-dspr2/addqh_r_w.c        |   34 +
 tests/tcg/mips/mips32-dspr2/addqh_w.c          |   34 +
 tests/tcg/mips/mips32-dspr2/addu_ph.c          |   33 +
 tests/tcg/mips/mips32-dspr2/addu_s_ph.c        |   33 +
 tests/tcg/mips/mips32-dspr2/adduh_qb.c         |   30 +
 tests/tcg/mips/mips32-dspr2/adduh_r_qb.c       |   30 +
 tests/tcg/mips/mips32-dspr2/append.c           |   30 +
 tests/tcg/mips/mips32-dspr2/balign.c           |   30 +
 tests/tcg/mips/mips32-dspr2/cmpgdu_eq_qb.c     |   37 +
 tests/tcg/mips/mips32-dspr2/cmpgdu_le_qb.c     |   37 +
 tests/tcg/mips/mips32-dspr2/cmpgdu_lt_qb.c     |   37 +
 tests/tcg/mips/mips32-dspr2/dpa_w_ph.c         |   44 +
 tests/tcg/mips/mips32-dspr2/dpaqx_s_w_ph.c     |   79 +
 tests/tcg/mips/mips32-dspr2/dpaqx_sa_w_ph.c    |   53 +
 tests/tcg/mips/mips32-dspr2/dpax_w_ph.c        |   27 +
 tests/tcg/mips/mips32-dspr2/dps_w_ph.c         |   27 +
 tests/tcg/mips/mips32-dspr2/dpsqx_s_w_ph.c     |   54 +
 tests/tcg/mips/mips32-dspr2/dpsqx_sa_w_ph.c    |   53 +
 tests/tcg/mips/mips32-dspr2/dpsx_w_ph.c        |   27 +
 tests/tcg/mips/mips32-dspr2/mul_ph.c           |   47 +
 tests/tcg/mips/mips32-dspr2/mul_s_ph.c         |   62 +
 tests/tcg/mips/mips32-dspr2/mulq_rs_w.c        |   36 +
 tests/tcg/mips/mips32-dspr2/mulq_s_ph.c        |   25 +
 tests/tcg/mips/mips32-dspr2/mulq_s_w.c         |   36 +
 tests/tcg/mips/mips32-dspr2/mulsa_w_ph.c       |   29 +
 tests/tcg/mips/mips32-dspr2/mulsaq_s_w_ph.c    |   29 +
 tests/tcg/mips/mips32-dspr2/precr_qb_ph.c      |   21 +
 tests/tcg/mips/mips32-dspr2/precr_sra_ph_w.c   |   32 +
 tests/tcg/mips/mips32-dspr2/precr_sra_r_ph_w.c |   32 +
 tests/tcg/mips/mips32-dspr2/prepend.c          |   30 +
 tests/tcg/mips/mips32-dspr2/shra_qb.c          |   30 +
 tests/tcg/mips/mips32-dspr2/shra_r_qb.c        |   30 +
 tests/tcg/mips/mips32-dspr2/shrav_qb.c         |   32 +
 tests/tcg/mips/mips32-dspr2/shrav_r_qb.c       |   32 +
 tests/tcg/mips/mips32-dspr2/shrl_ph.c          |   20 +
 tests/tcg/mips/mips32-dspr2/shrlv_ph.c         |   21 +
 tests/tcg/mips/mips32-dspr2/subqh_ph.c         |   21 +
 tests/tcg/mips/mips32-dspr2/subqh_r_ph.c       |   21 +
 tests/tcg/mips/mips32-dspr2/subqh_r_w.c        |   21 +
 tests/tcg/mips/mips32-dspr2/subqh_w.c          |   21 +
 tests/tcg/mips/mips32-dspr2/subu_ph.c          |   40 +
 tests/tcg/mips/mips32-dspr2/subu_s_ph.c        |   25 +
 tests/tcg/mips/mips32-dspr2/subuh_qb.c         |   21 +
 tests/tcg/mips/mips32-dspr2/subuh_r_qb.c       |   32 +
 tests/tcg/mips/mips64-dsp/Makefile             |  306 +
 tests/tcg/mips/mips64-dsp/absq_s_ob.c          |   63 +
 tests/tcg/mips/mips64-dsp/absq_s_ph.c          |   37 +
 tests/tcg/mips/mips64-dsp/absq_s_pw.c          |   66 +
 tests/tcg/mips/mips64-dsp/absq_s_qh.c          |   40 +
 tests/tcg/mips/mips64-dsp/absq_s_w.c           |   48 +
 tests/tcg/mips/mips64-dsp/addq_ph.c            |   57 +
 tests/tcg/mips/mips64-dsp/addq_pw.c            |   46 +
 tests/tcg/mips/mips64-dsp/addq_qh.c            |   28 +
 tests/tcg/mips/mips64-dsp/addq_s_ph.c          |   84 +
 tests/tcg/mips/mips64-dsp/addq_s_pw.c          |   45 +
 tests/tcg/mips/mips64-dsp/addq_s_qh.c          |   26 +
 tests/tcg/mips/mips64-dsp/addq_s_w.c           |   48 +
 tests/tcg/mips/mips64-dsp/addsc.c              |   39 +
 tests/tcg/mips/mips64-dsp/addu_ob.c            |   28 +
 tests/tcg/mips/mips64-dsp/addu_qb.c            |   40 +
 tests/tcg/mips/mips64-dsp/addu_s_ob.c          |   27 +
 tests/tcg/mips/mips64-dsp/addu_s_qb.c          |   40 +
 tests/tcg/mips/mips64-dsp/addwc.c              |   59 +
 tests/tcg/mips/mips64-dsp/bitrev.c             |   23 +
 tests/tcg/mips/mips64-dsp/bposge32.c           |   50 +
 tests/tcg/mips/mips64-dsp/bposge64.c           |   50 +
 tests/tcg/mips/mips64-dsp/cmp_eq_ph.c          |   42 +
 tests/tcg/mips/mips64-dsp/cmp_eq_pw.c          |   46 +
 tests/tcg/mips/mips64-dsp/cmp_eq_qh.c          |   46 +
 tests/tcg/mips/mips64-dsp/cmp_le_ph.c          |   40 +
 tests/tcg/mips/mips64-dsp/cmp_le_pw.c          |   46 +
 tests/tcg/mips/mips64-dsp/cmp_le_qh.c          |   46 +
 tests/tcg/mips/mips64-dsp/cmp_lt_ph.c          |   41 +
 tests/tcg/mips/mips64-dsp/cmp_lt_pw.c          |   46 +
 tests/tcg/mips/mips64-dsp/cmp_lt_qh.c          |   46 +
 tests/tcg/mips/mips64-dsp/cmpgu_eq_ob.c        |   40 +
 tests/tcg/mips/mips64-dsp/cmpgu_eq_qb.c        |   38 +
 tests/tcg/mips/mips64-dsp/cmpgu_le_ob.c        |   40 +
 tests/tcg/mips/mips64-dsp/cmpgu_le_qb.c        |   37 +
 tests/tcg/mips/mips64-dsp/cmpgu_lt_ob.c        |   40 +
 tests/tcg/mips/mips64-dsp/cmpgu_lt_qb.c        |   38 +
 tests/tcg/mips/mips64-dsp/cmpu_eq_ob.c         |   46 +
 tests/tcg/mips/mips64-dsp/cmpu_eq_qb.c         |   42 +
 tests/tcg/mips/mips64-dsp/cmpu_le_ob.c         |   44 +
 tests/tcg/mips/mips64-dsp/cmpu_le_qb.c         |   41 +
 tests/tcg/mips/mips64-dsp/cmpu_lt_ob.c         |   44 +
 tests/tcg/mips/mips64-dsp/cmpu_lt_qb.c         |   42 +
 tests/tcg/mips/mips64-dsp/dappend.c            |   37 +
 tests/tcg/mips/mips64-dsp/dextp.c              |   54 +
 tests/tcg/mips/mips64-dsp/dextpdp.c            |   59 +
 tests/tcg/mips/mips64-dsp/dextpdpv.c           |   63 +
 tests/tcg/mips/mips64-dsp/dextpv.c             |   58 +
 tests/tcg/mips/mips64-dsp/dextr_l.c            |   44 +
 tests/tcg/mips/mips64-dsp/dextr_r_l.c          |   54 +
 tests/tcg/mips/mips64-dsp/dextr_r_w.c          |   54 +
 tests/tcg/mips/mips64-dsp/dextr_rs_l.c         |   52 +
 tests/tcg/mips/mips64-dsp/dextr_rs_w.c         |   52 +
 tests/tcg/mips/mips64-dsp/dextr_s_h.c          |   73 +
 tests/tcg/mips/mips64-dsp/dextr_w.c            |   44 +
 tests/tcg/mips/mips64-dsp/dextrv_l.c           |   46 +
 tests/tcg/mips/mips64-dsp/dextrv_r_l.c         |   56 +
 tests/tcg/mips/mips64-dsp/dextrv_r_w.c         |   56 +
 tests/tcg/mips/mips64-dsp/dextrv_rs_l.c        |   54 +
 tests/tcg/mips/mips64-dsp/dextrv_rs_w.c        |   54 +
 tests/tcg/mips/mips64-dsp/dextrv_s_h.c         |   32 +
 tests/tcg/mips/mips64-dsp/dextrv_w.c           |   46 +
 tests/tcg/mips/mips64-dsp/dinsv.c              |   26 +
 tests/tcg/mips/mips64-dsp/dmadd.c              |   57 +
 tests/tcg/mips/mips64-dsp/dmaddu.c             |   56 +
 tests/tcg/mips/mips64-dsp/dmsub.c              |   59 +
 tests/tcg/mips/mips64-dsp/dmsubu.c             |   59 +
 tests/tcg/mips/mips64-dsp/dmthlip.c            |   41 +
 tests/tcg/mips/mips64-dsp/dpaq_s_w_ph.c        |   32 +
 tests/tcg/mips/mips64-dsp/dpaq_s_w_qh.c        |   57 +
 tests/tcg/mips/mips64-dsp/dpaq_sa_l_pw.c       |   88 +
 tests/tcg/mips/mips64-dsp/dpaq_sa_l_w.c        |   82 +
 tests/tcg/mips/mips64-dsp/dpau_h_obl.c         |   59 +
 tests/tcg/mips/mips64-dsp/dpau_h_obr.c         |   59 +
 tests/tcg/mips/mips64-dsp/dpau_h_qbl.c         |   29 +
 tests/tcg/mips/mips64-dsp/dpau_h_qbr.c         |   29 +
 tests/tcg/mips/mips64-dsp/dpsq_s_w_ph.c        |   51 +
 tests/tcg/mips/mips64-dsp/dpsq_s_w_qh.c        |   56 +
 tests/tcg/mips/mips64-dsp/dpsq_sa_l_pw.c       |   76 +
 tests/tcg/mips/mips64-dsp/dpsq_sa_l_w.c        |   59 +
 tests/tcg/mips/mips64-dsp/dpsu_h_obl.c         |   32 +
 tests/tcg/mips/mips64-dsp/dpsu_h_obr.c         |   32 +
 tests/tcg/mips/mips64-dsp/dpsu_h_qbl.c         |   29 +
 tests/tcg/mips/mips64-dsp/dpsu_h_qbr.c         |   29 +
 tests/tcg/mips/mips64-dsp/dshilo.c             |   52 +
 tests/tcg/mips/mips64-dsp/dshilov.c            |   54 +
 tests/tcg/mips/mips64-dsp/extp.c               |   50 +
 tests/tcg/mips/mips64-dsp/extpdp.c             |   51 +
 tests/tcg/mips/mips64-dsp/extpdpv.c            |   52 +
 tests/tcg/mips/mips64-dsp/extpv.c              |   51 +
 tests/tcg/mips/mips64-dsp/extr_r_w.c           |   53 +
 tests/tcg/mips/mips64-dsp/extr_rs_w.c          |   53 +
 tests/tcg/mips/mips64-dsp/extr_s_h.c           |   71 +
 tests/tcg/mips/mips64-dsp/extr_w.c             |   53 +
 tests/tcg/mips/mips64-dsp/extrv_r_w.c          |   59 +
 tests/tcg/mips/mips64-dsp/extrv_rs_w.c         |   59 +
 tests/tcg/mips/mips64-dsp/extrv_s_h.c          |   79 +
 tests/tcg/mips/mips64-dsp/extrv_w.c            |   59 +
 tests/tcg/mips/mips64-dsp/head.S               |   16 +
 tests/tcg/mips/mips64-dsp/insv.c               |   26 +
 tests/tcg/mips/mips64-dsp/io.h                 |   22 +
 tests/tcg/mips/mips64-dsp/lbux.c               |   27 +
 tests/tcg/mips/mips64-dsp/ldx.c                |   27 +
 tests/tcg/mips/mips64-dsp/lhx.c                |   27 +
 tests/tcg/mips/mips64-dsp/lwx.c                |   27 +
 tests/tcg/mips/mips64-dsp/madd.c               |   33 +
 tests/tcg/mips/mips64-dsp/maddu.c              |   33 +
 tests/tcg/mips/mips64-dsp/maq_s_l_pwl.c        |   56 +
 tests/tcg/mips/mips64-dsp/maq_s_l_pwr.c        |   56 +
 tests/tcg/mips/mips64-dsp/maq_s_w_phl.c        |   60 +
 tests/tcg/mips/mips64-dsp/maq_s_w_phr.c        |   60 +
 tests/tcg/mips/mips64-dsp/maq_s_w_qhll.c       |   62 +
 tests/tcg/mips/mips64-dsp/maq_s_w_qhlr.c       |   62 +
 tests/tcg/mips/mips64-dsp/maq_s_w_qhrl.c       |   63 +
 tests/tcg/mips/mips64-dsp/maq_s_w_qhrr.c       |   63 +
 tests/tcg/mips/mips64-dsp/maq_sa_w_phl.c       |   60 +
 tests/tcg/mips/mips64-dsp/maq_sa_w_phr.c       |   60 +
 tests/tcg/mips/mips64-dsp/maq_sa_w_qhll.c      |   62 +
 tests/tcg/mips/mips64-dsp/maq_sa_w_qhlr.c      |   64 +
 tests/tcg/mips/mips64-dsp/maq_sa_w_qhrl.c      |   64 +
 tests/tcg/mips/mips64-dsp/maq_sa_w_qhrr.c      |   64 +
 tests/tcg/mips/mips64-dsp/mfhi.c               |   24 +
 tests/tcg/mips/mips64-dsp/mflo.c               |   24 +
 tests/tcg/mips/mips64-dsp/mips_boot.lds        |   31 +
 tests/tcg/mips/mips64-dsp/modsub.c             |   37 +
 tests/tcg/mips/mips64-dsp/msub.c               |   32 +
 tests/tcg/mips/mips64-dsp/msubu.c              |   32 +
 tests/tcg/mips/mips64-dsp/mthi.c               |   24 +
 tests/tcg/mips/mips64-dsp/mthlip.c             |   61 +
 tests/tcg/mips/mips64-dsp/mtlo.c               |   22 +
 tests/tcg/mips/mips64-dsp/muleq_s_pw_qhl.c     |   56 +
 tests/tcg/mips/mips64-dsp/muleq_s_pw_qhr.c     |   57 +
 tests/tcg/mips/mips64-dsp/muleq_s_w_phl.c      |   46 +
 tests/tcg/mips/mips64-dsp/muleq_s_w_phr.c      |   45 +
 tests/tcg/mips/mips64-dsp/muleu_s_ph_qbl.c     |   27 +
 tests/tcg/mips/mips64-dsp/muleu_s_ph_qbr.c     |   27 +
 tests/tcg/mips/mips64-dsp/muleu_s_qh_obl.c     |   30 +
 tests/tcg/mips/mips64-dsp/muleu_s_qh_obr.c     |   31 +
 tests/tcg/mips/mips64-dsp/mulq_rs_ph.c         |   27 +
 tests/tcg/mips/mips64-dsp/mulq_rs_qh.c         |   33 +
 tests/tcg/mips/mips64-dsp/mulsaq_s_l_pw.c      |   59 +
 tests/tcg/mips/mips64-dsp/mulsaq_s_w_qh.c      |   57 +
 tests/tcg/mips/mips64-dsp/mult.c               |   26 +
 tests/tcg/mips/mips64-dsp/multu.c              |   26 +
 tests/tcg/mips/mips64-dsp/packrl_ph.c          |   24 +
 tests/tcg/mips/mips64-dsp/packrl_pw.c          |   24 +
 tests/tcg/mips/mips64-dsp/pick_ob.c            |   66 +
 tests/tcg/mips/mips64-dsp/pick_ph.c            |   60 +
 tests/tcg/mips/mips64-dsp/pick_pw.c            |   48 +
 tests/tcg/mips/mips64-dsp/pick_qb.c            |   43 +
 tests/tcg/mips/mips64-dsp/pick_qh.c            |   48 +
 tests/tcg/mips/mips64-dsp/preceq_l_pwl.c       |   24 +
 tests/tcg/mips/mips64-dsp/preceq_l_pwr.c       |   24 +
 tests/tcg/mips/mips64-dsp/preceq_pw_qhl.c      |   21 +
 tests/tcg/mips/mips64-dsp/preceq_pw_qhla.c     |   23 +
 tests/tcg/mips/mips64-dsp/preceq_pw_qhr.c      |   21 +
 tests/tcg/mips/mips64-dsp/preceq_pw_qhra.c     |   23 +
 tests/tcg/mips/mips64-dsp/preceq_w_phl.c       |   23 +
 tests/tcg/mips/mips64-dsp/preceq_w_phr.c       |   23 +
 tests/tcg/mips/mips64-dsp/precequ_ph_qbl.c     |   23 +
 tests/tcg/mips/mips64-dsp/precequ_ph_qbla.c    |   23 +
 tests/tcg/mips/mips64-dsp/precequ_ph_qbr.c     |   23 +
 tests/tcg/mips/mips64-dsp/precequ_ph_qbra.c    |   23 +
 tests/tcg/mips/mips64-dsp/precequ_qh_obl.c     |   22 +
 tests/tcg/mips/mips64-dsp/precequ_qh_obla.c    |   22 +
 tests/tcg/mips/mips64-dsp/precequ_qh_obr.c     |   24 +
 tests/tcg/mips/mips64-dsp/precequ_qh_obra.c    |   24 +
 tests/tcg/mips/mips64-dsp/preceu_ph_qbl.c      |   23 +
 tests/tcg/mips/mips64-dsp/preceu_ph_qbla.c     |   23 +
 tests/tcg/mips/mips64-dsp/preceu_ph_qbr.c      |   23 +
 tests/tcg/mips/mips64-dsp/preceu_ph_qbra.c     |   23 +
 tests/tcg/mips/mips64-dsp/preceu_qh_obl.c      |   22 +
 tests/tcg/mips/mips64-dsp/preceu_qh_obla.c     |   22 +
 tests/tcg/mips/mips64-dsp/preceu_qh_obr.c      |   23 +
 tests/tcg/mips/mips64-dsp/preceu_qh_obra.c     |   23 +
 tests/tcg/mips/mips64-dsp/precr_ob_qh.c        |   25 +
 tests/tcg/mips/mips64-dsp/precr_sra_qh_pw.c    |   40 +
 tests/tcg/mips/mips64-dsp/precr_sra_r_qh_pw.c  |   40 +
 tests/tcg/mips/mips64-dsp/precrq_ob_qh.c       |   25 +
 tests/tcg/mips/mips64-dsp/precrq_ph_w.c        |   24 +
 tests/tcg/mips/mips64-dsp/precrq_pw_l.c        |   25 +
 tests/tcg/mips/mips64-dsp/precrq_qb_ph.c       |   24 +
 tests/tcg/mips/mips64-dsp/precrq_qh_pw.c       |   25 +
 tests/tcg/mips/mips64-dsp/precrq_rs_ph_w.c     |   41 +
 tests/tcg/mips/mips64-dsp/precrq_rs_qh_pw.c    |   43 +
 tests/tcg/mips/mips64-dsp/precrqu_s_ob_qh.c    |   27 +
 tests/tcg/mips/mips64-dsp/precrqu_s_qb_ph.c    |   26 +
 tests/tcg/mips/mips64-dsp/prependd.c           |   37 +
 tests/tcg/mips/mips64-dsp/prependw.c           |   37 +
 tests/tcg/mips/mips64-dsp/printf.c             |  266 +
 tests/tcg/mips/mips64-dsp/raddu_l_ob.c         |   22 +
 tests/tcg/mips/mips64-dsp/raddu_w_qb.c         |   23 +
 tests/tcg/mips/mips64-dsp/rddsp.c              |   53 +
 tests/tcg/mips/mips64-dsp/repl_ob.c            |   21 +
 tests/tcg/mips/mips64-dsp/repl_ph.c            |   30 +
 tests/tcg/mips/mips64-dsp/repl_pw.c            |   34 +
 tests/tcg/mips/mips64-dsp/repl_qb.c            |   19 +
 tests/tcg/mips/mips64-dsp/repl_qh.c            |   34 +
 tests/tcg/mips/mips64-dsp/replv_ob.c           |   23 +
 tests/tcg/mips/mips64-dsp/replv_ph.c           |   22 +
 tests/tcg/mips/mips64-dsp/replv_pw.c           |   23 +
 tests/tcg/mips/mips64-dsp/replv_qb.c           |   22 +
 tests/tcg/mips/mips64-dsp/shilo.c              |   29 +
 tests/tcg/mips/mips64-dsp/shilov.c             |   31 +
 tests/tcg/mips/mips64-dsp/shll_ob.c            |   43 +
 tests/tcg/mips/mips64-dsp/shll_ph.c            |   43 +
 tests/tcg/mips/mips64-dsp/shll_pw.c            |   43 +
 tests/tcg/mips/mips64-dsp/shll_qb.c            |   26 +
 tests/tcg/mips/mips64-dsp/shll_qh.c            |   42 +
 tests/tcg/mips/mips64-dsp/shll_s_ph.c          |   43 +
 tests/tcg/mips/mips64-dsp/shll_s_pw.c          |   43 +
 tests/tcg/mips/mips64-dsp/shll_s_qh.c          |   43 +
 tests/tcg/mips/mips64-dsp/shll_s_w.c           |   26 +
 tests/tcg/mips/mips64-dsp/shllv_ob.c           |   45 +
 tests/tcg/mips/mips64-dsp/shllv_ph.c           |   27 +
 tests/tcg/mips/mips64-dsp/shllv_pw.c           |   45 +
 tests/tcg/mips/mips64-dsp/shllv_qb.c           |   27 +
 tests/tcg/mips/mips64-dsp/shllv_qh.c           |   45 +
 tests/tcg/mips/mips64-dsp/shllv_s_ph.c         |   27 +
 tests/tcg/mips/mips64-dsp/shllv_s_pw.c         |   45 +
 tests/tcg/mips/mips64-dsp/shllv_s_qh.c         |   45 +
 tests/tcg/mips/mips64-dsp/shllv_s_w.c          |   27 +
 tests/tcg/mips/mips64-dsp/shra_ob.c            |   23 +
 tests/tcg/mips/mips64-dsp/shra_ph.c            |   23 +
 tests/tcg/mips/mips64-dsp/shra_pw.c            |   36 +
 tests/tcg/mips/mips64-dsp/shra_qh.c            |   37 +
 tests/tcg/mips/mips64-dsp/shra_r_ob.c          |   22 +
 tests/tcg/mips/mips64-dsp/shra_r_ph.c          |   23 +
 tests/tcg/mips/mips64-dsp/shra_r_pw.c          |   36 +
 tests/tcg/mips/mips64-dsp/shra_r_qh.c          |   37 +
 tests/tcg/mips/mips64-dsp/shra_r_w.c           |   23 +
 tests/tcg/mips/mips64-dsp/shrav_ph.c           |   24 +
 tests/tcg/mips/mips64-dsp/shrav_pw.c           |   38 +
 tests/tcg/mips/mips64-dsp/shrav_qh.c           |   39 +
 tests/tcg/mips/mips64-dsp/shrav_r_ph.c         |   24 +
 tests/tcg/mips/mips64-dsp/shrav_r_pw.c         |   37 +
 tests/tcg/mips/mips64-dsp/shrav_r_qh.c         |   39 +
 tests/tcg/mips/mips64-dsp/shrav_r_w.c          |   24 +
 tests/tcg/mips/mips64-dsp/shrl_ob.c            |   38 +
 tests/tcg/mips/mips64-dsp/shrl_qb.c            |   23 +
 tests/tcg/mips/mips64-dsp/shrl_qh.c            |   22 +
 tests/tcg/mips/mips64-dsp/shrlv_ob.c           |   39 +
 tests/tcg/mips/mips64-dsp/shrlv_qb.c           |   24 +
 tests/tcg/mips/mips64-dsp/shrlv_qh.c           |   23 +
 tests/tcg/mips/mips64-dsp/subq_ph.c            |   27 +
 tests/tcg/mips/mips64-dsp/subq_pw.c            |   44 +
 tests/tcg/mips/mips64-dsp/subq_qh.c            |   26 +
 tests/tcg/mips/mips64-dsp/subq_s_ph.c          |   27 +
 tests/tcg/mips/mips64-dsp/subq_s_pw.c          |   63 +
 tests/tcg/mips/mips64-dsp/subq_s_qh.c          |   61 +
 tests/tcg/mips/mips64-dsp/subq_s_w.c           |   27 +
 tests/tcg/mips/mips64-dsp/subu_ob.c            |   26 +
 tests/tcg/mips/mips64-dsp/subu_qb.c            |   27 +
 tests/tcg/mips/mips64-dsp/subu_s_ob.c          |   26 +
 tests/tcg/mips/mips64-dsp/subu_s_qb.c          |   27 +
 tests/tcg/mips/mips64-dsp/wrdsp.c              |   48 +
 tests/tcg/mips/mips64-dspr2/.directory         |    2 +
 tests/tcg/mips/mips64-dspr2/Makefile           |  116 +
 tests/tcg/mips/mips64-dspr2/absq_s_qb.c        |   42 +
 tests/tcg/mips/mips64-dspr2/addqh_ph.c         |   35 +
 tests/tcg/mips/mips64-dspr2/addqh_r_ph.c       |   35 +
 tests/tcg/mips/mips64-dspr2/addqh_r_w.c        |   38 +
 tests/tcg/mips/mips64-dspr2/addqh_w.c          |   39 +
 tests/tcg/mips/mips64-dspr2/addu_ph.c          |   37 +
 tests/tcg/mips/mips64-dspr2/addu_qh.c          |   43 +
 tests/tcg/mips/mips64-dspr2/addu_s_ph.c        |   37 +
 tests/tcg/mips/mips64-dspr2/addu_s_qh.c        |   43 +
 tests/tcg/mips/mips64-dspr2/adduh_ob.c         |   35 +
 tests/tcg/mips/mips64-dspr2/adduh_qb.c         |   35 +
 tests/tcg/mips/mips64-dspr2/adduh_r_ob.c       |   35 +
 tests/tcg/mips/mips64-dspr2/adduh_r_qb.c       |   35 +
 tests/tcg/mips/mips64-dspr2/append.c           |   35 +
 tests/tcg/mips/mips64-dspr2/balign.c           |   35 +
 tests/tcg/mips/mips64-dspr2/cmpgdu_eq_ob.c     |   44 +
 tests/tcg/mips/mips64-dspr2/cmpgdu_eq_qb.c     |   41 +
 tests/tcg/mips/mips64-dspr2/cmpgdu_le_ob.c     |   44 +
 tests/tcg/mips/mips64-dspr2/cmpgdu_le_qb.c     |   48 +
 tests/tcg/mips/mips64-dspr2/cmpgdu_lt_ob.c     |   44 +
 tests/tcg/mips/mips64-dspr2/cmpgdu_lt_qb.c     |   48 +
 tests/tcg/mips/mips64-dspr2/dbalign.c          |   39 +
 tests/tcg/mips/mips64-dspr2/dpa_w_ph.c         |   47 +
 tests/tcg/mips/mips64-dspr2/dpa_w_qh.c         |   56 +
 tests/tcg/mips/mips64-dspr2/dpaqx_s_w_ph.c     |   97 +
 tests/tcg/mips/mips64-dspr2/dpaqx_sa_w_ph.c    |   54 +
 tests/tcg/mips/mips64-dspr2/dpax_w_ph.c        |   32 +
 tests/tcg/mips/mips64-dspr2/dps_w_ph.c         |   28 +
 tests/tcg/mips/mips64-dspr2/dps_w_qh.c         |   55 +
 tests/tcg/mips/mips64-dspr2/dpsqx_s_w_ph.c     |   55 +
 tests/tcg/mips/mips64-dspr2/dpsqx_sa_w_ph.c    |   53 +
 tests/tcg/mips/mips64-dspr2/dpsx_w_ph.c        |   28 +
 tests/tcg/mips/mips64-dspr2/head.S             |   16 +
 tests/tcg/mips/mips64-dspr2/io.h               |   22 +
 tests/tcg/mips/mips64-dspr2/mips_boot.lds      |   31 +
 tests/tcg/mips/mips64-dspr2/mul_ph.c           |   50 +
 tests/tcg/mips/mips64-dspr2/mul_s_ph.c         |   67 +
 tests/tcg/mips/mips64-dspr2/mulq_rs_w.c        |   40 +
 tests/tcg/mips/mips64-dspr2/mulq_s_ph.c        |   26 +
 tests/tcg/mips/mips64-dspr2/mulq_s_w.c         |   40 +
 tests/tcg/mips/mips64-dspr2/mulsa_w_ph.c       |   30 +
 tests/tcg/mips/mips64-dspr2/mulsaq_s_w_ph.c    |   30 +
 tests/tcg/mips/mips64-dspr2/precr_qb_ph.c      |   23 +
 tests/tcg/mips/mips64-dspr2/precr_sra_ph_w.c   |   37 +
 tests/tcg/mips/mips64-dspr2/precr_sra_r_ph_w.c |   37 +
 tests/tcg/mips/mips64-dspr2/prepend.c          |   35 +
 tests/tcg/mips/mips64-dspr2/printf.c           |  266 +
 tests/tcg/mips/mips64-dspr2/shra_qb.c          |   35 +
 tests/tcg/mips/mips64-dspr2/shra_r_qb.c        |   35 +
 tests/tcg/mips/mips64-dspr2/shrav_ob.c         |   22 +
 tests/tcg/mips/mips64-dspr2/shrav_qb.c         |   37 +
 tests/tcg/mips/mips64-dspr2/shrav_r_ob.c       |   22 +
 tests/tcg/mips/mips64-dspr2/shrav_r_qb.c       |   37 +
 tests/tcg/mips/mips64-dspr2/shrl_ph.c          |   22 +
 tests/tcg/mips/mips64-dspr2/shrlv_ph.c         |   23 +
 tests/tcg/mips/mips64-dspr2/subqh_ph.c         |   23 +
 tests/tcg/mips/mips64-dspr2/subqh_r_ph.c       |   23 +
 tests/tcg/mips/mips64-dspr2/subqh_r_w.c        |   23 +
 tests/tcg/mips/mips64-dspr2/subqh_w.c          |   23 +
 tests/tcg/mips/mips64-dspr2/subu_ph.c          |   26 +
 tests/tcg/mips/mips64-dspr2/subu_qh.c          |   24 +
 tests/tcg/mips/mips64-dspr2/subu_s_ph.c        |   25 +
 tests/tcg/mips/mips64-dspr2/subu_s_qh.c        |   42 +
 tests/tcg/mips/mips64-dspr2/subuh_ob.c         |   36 +
 tests/tcg/mips/mips64-dspr2/subuh_qb.c         |   23 +
 tests/tcg/mips/mips64-dspr2/subuh_r_ob.c       |   23 +
 tests/tcg/mips/mips64-dspr2/subuh_r_qb.c       |   37 +
 tests/tcg/openrisc/Makefile                    |   71 +
 tests/tcg/openrisc/test_add.c                  |   43 +
 tests/tcg/openrisc/test_addc.c                 |   38 +
 tests/tcg/openrisc/test_addi.c                 |   33 +
 tests/tcg/openrisc/test_addic.c                |   33 +
 tests/tcg/openrisc/test_and_or.c               |   65 +
 tests/tcg/openrisc/test_bf.c                   |   47 +
 tests/tcg/openrisc/test_bnf.c                  |   51 +
 tests/tcg/openrisc/test_div.c                  |   54 +
 tests/tcg/openrisc/test_divu.c                 |   34 +
 tests/tcg/openrisc/test_extx.c                 |   78 +
 tests/tcg/openrisc/test_fx.c                   |   57 +
 tests/tcg/openrisc/test_j.c                    |   26 +
 tests/tcg/openrisc/test_jal.c                  |   26 +
 tests/tcg/openrisc/test_lf_add.c               |   39 +
 tests/tcg/openrisc/test_lf_div.c               |   37 +
 tests/tcg/openrisc/test_lf_eqs.c               |   88 +
 tests/tcg/openrisc/test_lf_ges.c               |   88 +
 tests/tcg/openrisc/test_lf_gts.c               |   86 +
 tests/tcg/openrisc/test_lf_les.c               |   88 +
 tests/tcg/openrisc/test_lf_lts.c               |   92 +
 tests/tcg/openrisc/test_lf_mul.c               |   22 +
 tests/tcg/openrisc/test_lf_nes.c               |   89 +
 tests/tcg/openrisc/test_lf_rem.c               |   32 +
 tests/tcg/openrisc/test_lf_sub.c               |   35 +
 tests/tcg/openrisc/test_logic.c                |  105 +
 tests/tcg/openrisc/test_lx.c                   |   84 +
 tests/tcg/openrisc/test_movhi.c                |   31 +
 tests/tcg/openrisc/test_mul.c                  |   61 +
 tests/tcg/openrisc/test_muli.c                 |   48 +
 tests/tcg/openrisc/test_mulu.c                 |   48 +
 tests/tcg/openrisc/test_sfeq.c                 |   43 +
 tests/tcg/openrisc/test_sfeqi.c                |   39 +
 tests/tcg/openrisc/test_sfges.c                |   44 +
 tests/tcg/openrisc/test_sfgesi.c               |   40 +
 tests/tcg/openrisc/test_sfgeu.c                |   44 +
 tests/tcg/openrisc/test_sfgeui.c               |   41 +
 tests/tcg/openrisc/test_sfgts.c                |   45 +
 tests/tcg/openrisc/test_sfgtsi.c               |   41 +
 tests/tcg/openrisc/test_sfgtu.c                |   43 +
 tests/tcg/openrisc/test_sfgtui.c               |   42 +
 tests/tcg/openrisc/test_sfles.c                |   26 +
 tests/tcg/openrisc/test_sflesi.c               |   39 +
 tests/tcg/openrisc/test_sfleu.c                |   43 +
 tests/tcg/openrisc/test_sfleui.c               |   39 +
 tests/tcg/openrisc/test_sflts.c                |   43 +
 tests/tcg/openrisc/test_sfltsi.c               |   39 +
 tests/tcg/openrisc/test_sfltu.c                |   43 +
 tests/tcg/openrisc/test_sfltui.c               |   39 +
 tests/tcg/openrisc/test_sfne.c                 |   43 +
 tests/tcg/openrisc/test_sfnei.c                |   39 +
 tests/tcg/openrisc/test_sub.c                  |   35 +
 tests/tcg/pi_10.com                            |  Bin 0 -> 54 bytes
 tests/tcg/runcom.c                             |  192 +
 tests/tcg/sha1.c                               |  240 +
 tests/tcg/test-arm-iwmmxt.s                    |   49 +
 tests/tcg/test-i386-code16.S                   |   79 +
 tests/tcg/test-i386-fprem.c                    |  353 +
 tests/tcg/test-i386-muldiv.h                   |   76 +
 tests/tcg/test-i386-shift.h                    |  185 +
 tests/tcg/test-i386-ssse3.c                    |   57 +
 tests/tcg/test-i386-vm86.S                     |  103 +
 tests/tcg/test-i386.c                          | 2765 +
 tests/tcg/test-i386.h                          |  152 +
 tests/tcg/test-mmap.c                          |  484 +
 tests/tcg/test_path.c                          |  161 +
 tests/tcg/testthread.c                         |   58 +
 tests/tcg/xtensa/Makefile                      |   79 +
 tests/tcg/xtensa/crt.S                         |   24 +
 tests/tcg/xtensa/linker.ld                     |  112 +
 tests/tcg/xtensa/macros.inc                    |   85 +
 tests/tcg/xtensa/test_b.S                      |  221 +
 tests/tcg/xtensa/test_bi.S                     |  103 +
 tests/tcg/xtensa/test_boolean.S                |   23 +
 tests/tcg/xtensa/test_break.S                  |  257 +
 tests/tcg/xtensa/test_bz.S                     |   57 +
 tests/tcg/xtensa/test_clamps.S                 |   42 +
 tests/tcg/xtensa/test_fail.S                   |    9 +
 tests/tcg/xtensa/test_interrupt.S              |  194 +
 tests/tcg/xtensa/test_loop.S                   |  163 +
 tests/tcg/xtensa/test_mac16.S                  |  243 +
 tests/tcg/xtensa/test_max.S                    |   81 +
 tests/tcg/xtensa/test_min.S                    |   81 +
 tests/tcg/xtensa/test_mmu.S                    |  511 +
 tests/tcg/xtensa/test_mul16.S                  |   83 +
 tests/tcg/xtensa/test_mul32.S                  |   20 +
 tests/tcg/xtensa/test_nsa.S                    |   59 +
 tests/tcg/xtensa/test_pipeline.S               |  157 +
 tests/tcg/xtensa/test_quo.S                    |  147 +
 tests/tcg/xtensa/test_rem.S                    |  147 +
 tests/tcg/xtensa/test_rst0.S                   |  148 +
 tests/tcg/xtensa/test_sar.S                    |  111 +
 tests/tcg/xtensa/test_sext.S                   |   69 +
 tests/tcg/xtensa/test_shift.S                  |  206 +
 tests/tcg/xtensa/test_timer.S                  |  178 +
 tests/tcg/xtensa/test_windowed.S               |  302 +
 tests/tcg/xtensa/vectors.S                     |   39 +
 tests/test-arm-iwmmxt.s                        |   49 -
 tests/test-coroutine.c                         |  219 +
 tests/test-i386-code16.S                       |   79 -
 tests/test-i386-muldiv.h                       |   76 -
 tests/test-i386-shift.h                        |  185 -
 tests/test-i386-ssse3.c                        |   57 -
 tests/test-i386-vm86.S                         |  103 -
 tests/test-i386.c                              | 2764 -
 tests/test-i386.h                              |  152 -
 tests/test-iov.c                               |  260 +
 tests/test-mmap.c                              |  476 -
 tests/test-qmp-commands.c                      |  181 +
 tests/test-qmp-input-strict.c                  |  234 +
 tests/test-qmp-input-visitor.c                 |  316 +
 tests/test-qmp-output-visitor.c                |  477 +
 tests/test-string-input-visitor.c              |  195 +
 tests/test-string-output-visitor.c             |  188 +
 tests/test-visitor-serialization.c             |  784 +
 tests/test_path.c                              |  160 -
 tests/testthread.c                             |   51 -
 tests/xtensa/Makefile                          |   75 -
 tests/xtensa/crt.S                             |   24 -
 tests/xtensa/linker.ld                         |  112 -
 tests/xtensa/macros.inc                        |   68 -
 tests/xtensa/test_b.S                          |  221 -
 tests/xtensa/test_bi.S                         |  103 -
 tests/xtensa/test_boolean.S                    |   23 -
 tests/xtensa/test_bz.S                         |   57 -
 tests/xtensa/test_clamps.S                     |   42 -
 tests/xtensa/test_fail.S                       |    9 -
 tests/xtensa/test_interrupt.S                  |  194 -
 tests/xtensa/test_loop.S                       |   77 -
 tests/xtensa/test_mac16.S                      |  243 -
 tests/xtensa/test_max.S                        |   81 -
 tests/xtensa/test_min.S                        |   81 -
 tests/xtensa/test_mmu.S                        |  318 -
 tests/xtensa/test_mul16.S                      |   83 -
 tests/xtensa/test_mul32.S                      |   20 -
 tests/xtensa/test_nsa.S                        |   59 -
 tests/xtensa/test_pipeline.S                   |  157 -
 tests/xtensa/test_quo.S                        |  147 -
 tests/xtensa/test_rem.S                        |  147 -
 tests/xtensa/test_rst0.S                       |  148 -
 tests/xtensa/test_sar.S                        |  111 -
 tests/xtensa/test_sext.S                       |   69 -
 tests/xtensa/test_shift.S                      |  206 -
 tests/xtensa/test_timer.S                      |  178 -
 tests/xtensa/test_windowed.S                   |  302 -
 tests/xtensa/vectors.S                         |   39 -
 thread-pool.c                                  |  289 +
 thread-pool.h                                  |   34 +
 thunk.c                                        |   28 +
 thunk.h                                        |   32 +-
 trace-events                                   |  437 +-
 trace/control.c                                |   12 +-
 trace/simple.c                                 |  286 +-
 trace/simple.h                                 |   39 +-
 translate-all.c                                |   11 +-
 ui/Makefile.objs                               |   14 +
 ui/cocoa.m                                     |    9 +-
 ui/curses.c                                    |   21 +-
 ui/qemu-spice.h                                |    9 +-
 ui/sdl.c                                       |  204 +-
 ui/spice-core.c                                |  148 +-
 ui/spice-display.c                             |  265 +-
 ui/spice-display.h                             |   40 +-
 ui/vnc-auth-sasl.c                             |    9 +-
 ui/vnc-auth-sasl.h                             |    4 +-
 ui/vnc-auth-vencrypt.c                         |    3 +-
 ui/vnc-enc-hextile-template.h                  |   24 +-
 ui/vnc-enc-hextile.c                           |   53 +-
 ui/vnc-enc-tight.c                             |  280 +-
 ui/vnc-enc-zrle.c                              |   18 +-
 ui/vnc-enc-zywrle-template.c                   |    2 +-
 ui/vnc-enc-zywrle.h                            |    2 +-
 ui/vnc-jobs-async.c                            |  341 -
 ui/vnc-jobs-sync.c                             |   73 -
 ui/vnc-jobs.c                                  |  352 +
 ui/vnc-jobs.h                                  |   18 +-
 ui/vnc-palette.h                               |    1 +
 ui/vnc-tls.c                                   |    2 +-
 ui/vnc.c                                       |  551 +-
 ui/vnc.h                                       |   59 +-
 uri.c                                          | 2249 +
 uri.h                                          |  113 +
 usb-bsd.c                                      |  639 -
 usb-linux.c                                    | 2152 -
 usb-redir.c                                    | 1252 -
 usb-stub.c                                     |   52 -
 user-exec.c                                    |   32 +-
 vl.c                                           |  984 +-
 vmstate.h                                      |  639 +
 xen-all.c                                      |  314 +-
 xen-mapcache.c                                 |   36 +-
 xen-mapcache.h                                 |    8 +-
 xen-stub.c                                     |   22 +-
 xtensa-semi.c                                  |  224 -
 2676 files changed, 436970 insertions(+), 133260 deletions(-)

diff --git a/.exrc b/.exrc
new file mode 100644
index 0000000..37755ed
--- /dev/null
+++ b/.exrc
@@ -0,0 +1,7 @@
+"VIM settings to match QEMU coding style.  They are activated by adding the
+"following settings (without the " symbol) as last two lines in $HOME/.vimrc:
+"set secure
+"set exrc
+set expandtab
+set shiftwidth=4
+set smarttab
diff --git a/.gitignore b/.gitignore
index 406f75f..bd6ba1c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,8 +12,6 @@ trace-dtrace.dtrace
 *-linux-user
 *-bsd-user
 libdis*
-libhw32
-libhw64
 libuser
 linux-headers/asm
 qapi-generated
@@ -39,9 +37,18 @@ qemu-img-cmds.texi
 qemu-img-cmds.h
 qemu-io
 qemu-ga
+qemu-bridge-helper
 qemu-monitor.texi
+vscclient
 QMP/qmp-commands.txt
 test-coroutine
+test-qmp-input-visitor
+test-qmp-output-visitor
+test-string-input-visitor
+test-string-output-visitor
+test-visitor-serialization
+fsdev/virtfs-proxy-helper.1
+fsdev/virtfs-proxy-helper.pod
 .gdbinit
 *.a
 *.aux
@@ -62,6 +69,10 @@ test-coroutine
 *.vr
 *.d
 *.o
+*.lo
+*.la
+*.pc
+.libs
 *.swp
 *.orig
 .pc
@@ -69,8 +80,14 @@ patches
 pc-bios/bios-pq/status
 pc-bios/vgabios-pq/status
 pc-bios/optionrom/linuxboot.bin
+pc-bios/optionrom/linuxboot.raw
+pc-bios/optionrom/linuxboot.img
 pc-bios/optionrom/multiboot.bin
 pc-bios/optionrom/multiboot.raw
+pc-bios/optionrom/multiboot.img
+pc-bios/optionrom/kvmvapic.bin
+pc-bios/optionrom/kvmvapic.raw
+pc-bios/optionrom/kvmvapic.img
 .stgit-*
 cscope.*
 tags
diff --git a/.gitmodules b/.gitmodules
index eca876f..cfa2af9 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -19,3 +19,6 @@
 [submodule "roms/sgabios"]
 	path = roms/sgabios
 	url = git://git.qemu.org/sgabios.git
+[submodule "pixman"]
+	path = pixman
+	url = git://anongit.freedesktop.org/pixman
diff --git a/.mailmap b/.mailmap
new file mode 100644
index 0000000..9797802
--- /dev/null
+++ b/.mailmap
@@ -0,0 +1,16 @@
+# This mailmap just translates the weird addresses from the original import into git
+# into proper addresses so that they are counted properly in git shortlog output.
+#
+Andrzej Zaborowski <balrogg@gmail.com> balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>
+Anthony Liguori <aliguori@us.ibm.com> aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
+Aurelien Jarno <aurelien@aurel32.net> aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>
+Blue Swirl <blauwirbel@gmail.com> blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>
+Edgar E. Iglesias <edgar.iglesias@gmail.com> edgar_igl <edgar_igl@c046a42c-6fe2-441c-8c8c-71466251a162>
+Fabrice Bellard <fabrice@bellard.org> bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
+Jocelyn Mayer <l_indien@magic.fr> j_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162>
+Paul Brook <paul@codesourcery.com> pbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>
+Thiemo Seufer <ths@networkno.de> ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>
+malc <av1474@comtv.ru> malc <malc@c046a42c-6fe2-441c-8c8c-71466251a162>
+# There is also a:
+#    (no author) <(no author)@c046a42c-6fe2-441c-8c8c-71466251a162>
+# for the cvs2svn initialization commit e63c3dc74bf.
diff --git a/CODING_STYLE b/CODING_STYLE
index 6e61c49..dcbce28 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -1,4 +1,4 @@
-Qemu Coding Style
+QEMU Coding Style
 =================
 
 Please use the script checkpatch.pl in the scripts directory to check
@@ -44,7 +44,8 @@ Rationale:
 3. Naming
 
 Variables are lower_case_with_underscores; easy to type and read.  Structured
-type names are in CamelCase; harder to type but standing out.  Scalar type
+type names are in CamelCase; harder to type but standing out.  Enum type
+names and function type names should also be in CamelCase.  Scalar type
 names are lower_case_with_underscores_ending_with_a_t, like the POSIX
 uint64_t and family.  Note that this last convention contradicts POSIX
 and is therefore likely to be changed.
diff --git a/Changelog b/Changelog
index 28a69af..13eebef 100644
--- a/Changelog
+++ b/Changelog
@@ -78,7 +78,7 @@ version 0.10.2:
 
   - fix savevm/loadvm (Anthony Liguori)
   - live migration: fix dirty tracking windows (Glauber Costa)
-  - live migration: improve error propogation (Glauber Costa)
+  - live migration: improve error propagation (Glauber Costa)
   - qcow2: fix image creation for > ~2TB images (Chris Wright)
   - hotplug: fix error handling for if= parameter (Eduardo Habkost)
   - qcow2: fix data corruption (Nolan Leake)
@@ -386,7 +386,7 @@ version 0.5.3:
   - support of CD-ROM change
   - multiple network interface support
   - initial x86-64 host support (Gwenole Beauchesne)
-  - lret to outer priviledge fix (OS/2 install fix)
+  - lret to outer privilege fix (OS/2 install fix)
   - task switch fixes (SkyOS boot)
   - VM save/restore commands
   - new timer API
@@ -447,7 +447,7 @@ version 0.5.0:
   - multi-target build
   - fixed: no error code in hardware interrupts
   - fixed: pop ss, mov ss, x and sti disable hardware irqs for the next insn
-  - correct single stepping thru string operations
+  - correct single stepping through string operations
   - preliminary SPARC target support (Thomas M. Ogrisegg)
   - tun-fd option (Rusty Russell)
   - automatic IDE geometry detection
diff --git a/HACKING b/HACKING
index 733eab2..89a6b3a 100644
--- a/HACKING
+++ b/HACKING
@@ -32,7 +32,7 @@ mandatory for VMState fields.
 
 Don't use Linux kernel internal types like u32, __u32 or __le32.
 
-Use target_phys_addr_t for guest physical addresses except pcibus_t
+Use hwaddr for guest physical addresses except pcibus_t
 for PCI addresses.  In addition, ram_addr_t is a QEMU internal address
 space that maps guest RAM physical addresses into an intermediate
 address space that can map to host virtual address spaces.  Generally
@@ -77,11 +77,13 @@ avoided.
 
 Use of the malloc/free/realloc/calloc/valloc/memalign/posix_memalign
 APIs is not allowed in the QEMU codebase. Instead of these routines,
-use the replacement g_malloc/g_malloc0/g_realloc/g_free or
-qemu_vmalloc/qemu_memalign/qemu_vfree APIs.
+use the GLib memory allocation routines g_malloc/g_malloc0/g_new/
+g_new0/g_realloc/g_free or QEMU's qemu_vmalloc/qemu_memalign/qemu_vfree
+APIs.
 
-Please note that NULL check for the g_malloc result is redundant and
-that g_malloc() call with zero size is not allowed.
+Please note that g_malloc will exit on allocation failure, so there
+is no need to test for failure (as you would have to with malloc).
+Calling g_malloc with a zero size is valid and will return NULL.
 
 Memory allocated by qemu_vmalloc or qemu_memalign must be freed with
 qemu_vfree, since breaking this will cause problems on Win32 and user
@@ -89,10 +91,11 @@ emulators.
 
 4. String manipulation
 
-Do not use the strncpy function.  According to the man page, it does
-*not* guarantee a NULL-terminated buffer, which makes it extremely dangerous
-to use.  Instead, use functionally equivalent function:
-void pstrcpy(char *buf, int buf_size, const char *str)
+Do not use the strncpy function.  As mentioned in the man page, it does *not*
+guarantee a NULL-terminated buffer, which makes it extremely dangerous to use.
+It also zeros trailing destination bytes out to the specified length.  Instead,
+use this similar function when possible, but note its different signature:
+void pstrcpy(char *dest, int dest_buf_size, const char *src)
 
 Don't use strcat because it can't check for buffer overflows, but:
 char *pstrcat(char *buf, int buf_size, const char *s)
diff --git a/LICENSE b/LICENSE
index cbd92c0..acae9a3 100644
--- a/LICENSE
+++ b/LICENSE
@@ -6,9 +6,7 @@ The following points clarify the QEMU license:
 GNU General Public License. Hence each source file contains its own
 licensing information.
 
-In particular, the QEMU virtual CPU core library (libqemu.a) is
-released under the GNU Lesser General Public License. Many hardware
-device emulation sources are released under the BSD license.
+Many hardware device emulation sources are released under the BSD license.
 
 3) The Tiny Code Generator (TCG) is released under the BSD license
    (see license headers in files).
diff --git a/MAINTAINERS b/MAINTAINERS
index 06df70c..2ede20d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -20,7 +20,7 @@ Descriptions of section entries:
 	   Supported:	Someone is actually paid to look after this.
 	   Maintained:	Someone actually looks after it.
 	   Odd Fixes:	It has a maintainer but they don't have time to do
-			much other than throw the odd patch in. See below..
+			much other than throw the odd patch in. See below.
 	   Orphan:	No current maintainer [but maybe you could take the
 			role as you write your new code].
 	   Obsolete:	Old code. Something tagged obsolete generally means
@@ -78,7 +78,7 @@ F: target-lm32/
 
 M68K
 M: Paul Brook <paul@codesourcery.com>
-S: Maintained
+S: Odd Fixes
 F: target-m68k/
 
 MicroBlaze
@@ -88,11 +88,12 @@ F: target-microblaze/
 
 MIPS
 M: Aurelien Jarno <aurelien@aurel32.net>
-S: Maintained
+S: Odd Fixes
 F: target-mips/
 
 PowerPC
 M: Alexander Graf <agraf@suse.de>
+L: qemu-ppc@nongnu.org
 S: Maintained
 F: target-ppc/
 
@@ -103,7 +104,7 @@ F: target-s390x/
 
 SH4
 M: Aurelien Jarno <aurelien@aurel32.net>
-S: Maintained
+S: Odd Fixes
 F: target-sh4/
 
 SPARC
@@ -111,6 +112,11 @@ M: Blue Swirl <blauwirbel@gmail.com>
 S: Maintained
 F: target-sparc/
 
+UniCore32
+M: Guan Xuetao <gxt@mprc.pku.edu.cn>
+S: Maintained
+F: target-unicore32/
+
 X86
 M: qemu-devel@nongnu.org
 S: Odd Fixes
@@ -160,13 +166,53 @@ S: Supported
 F: xen-*
 F: */xen*
 
+Hosts:
+------
+
+LINUX
+L: qemu-devel@nongnu.org
+S: Maintained
+F: linux-*
+F: linux-headers/
+
+POSIX
+L: qemu-devel@nongnu.org
+S: Maintained
+F: *posix*
+
+W32, W64
+L: qemu-devel@nongnu.org
+M: Stefan Weil <sw@weilnetz.de>
+S: Maintained
+F: *win32*
+
 ARM Machines
 ------------
+Exynos
+M: Evgeny Voevodin <e.voevodin@samsung.com>
+M: Maksim Kozlov <m.kozlov@samsung.com>
+M: Igor Mitsyanko <i.mitsyanko@samsung.com>
+M: Dmitry Solodkiy <d.solodkiy@samsung.com>
+S: Maintained
+F: hw/exynos*

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

From xen-changelog-bounces@lists.xen.org Fri Nov 23 20:58:32 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Nov 2012 20:58: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 1Tc0KQ-0002oU-HM; Fri, 23 Nov 2012 20:58:26 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Tc0KO-0002oJ-BI
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 20:58:25 +0000
Received: from [85.158.139.83:53197] by server-3.bemta-5.messagelabs.com id
	B1/AB-18736-F63EFA05; Fri, 23 Nov 2012 20:58:23 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-8.tower-182.messagelabs.com!1353704297!20405954!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.8 required=7.0 tests=BODY_RANDOM_LONG,
	MAILTO_TO_SPAM_ADDR
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23196 invoked from network); 23 Nov 2012 20:58:18 -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;
	23 Nov 2012 20:58:18 -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 1Tc0KH-0007f9-Fq
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 20:58:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1Tc0KG-0007c3-KK
	for xen-changelog@lists.xensource.com; Fri, 23 Nov 2012 20:58:17 +0000
Date: Fri, 23 Nov 2012 20:58:16 +0000
Message-Id: <E1Tc0KG-0007c3-KK@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] Merge remote branch
	'xen-staging/master' into temp
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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

=== This changeset includes merge from high-traffic branch ===
Commits on that branch are not reported individually.

commit 1e6f3bf92c84d9ba8fdc61f4deb1777e737c7a2c
Merge: a8abf479276d54acbad4c3eade232897443e1189 cdf4d2bb4006805f209712fbb8ed1f83127e9984
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Commit: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

    Merge remote branch 'xen-staging/master' into temp

 .exrc                                          |    7 +
 .gitignore                                     |   21 +-
 .gitmodules                                    |    3 +
 .mailmap                                       |   16 +
 CODING_STYLE                                   |    5 +-
 Changelog                                      |    6 +-
 HACKING                                        |   21 +-
 LICENSE                                        |    4 +-
 MAINTAINERS                                    |  243 +-
 Makefile                                       |  276 +-
 Makefile.dis                                   |    3 -
 Makefile.hw                                    |   25 -
 Makefile.objs                                  |  397 +-
 Makefile.target                                |  398 +-
 Makefile.user                                  |    5 +-
 QMP/qemu-ga-client                             |  299 +
 QMP/qmp                                        |  126 +
 QMP/qmp-events.txt                             |  282 +-
 QMP/qmp-shell                                  |   46 +-
 QMP/qmp-spec.txt                               |   28 +-
 QMP/qmp.py                                     |   39 +-
 QMP/qom-fuse                                   |  138 +
 QMP/qom-get                                    |   67 +
 QMP/qom-list                                   |   64 +
 QMP/qom-set                                    |   64 +
 README                                         |    4 +-
 VERSION                                        |    2 +-
 aio-posix.c                                    |  268 +
 aio-win32.c                                    |  215 +
 aio.c                                          |  230 -
 arch_init.c                                    |  707 +-
 arch_init.h                                    |    8 +-
 arm-dis.c                                      |    6 +-
 arm-semi.c                                     |  509 -
 async.c                                        |  124 +-
 audio/Makefile.objs                            |   14 +
 audio/audio.c                                  |   39 +-
 audio/audio_int.h                              |    6 +
 audio/audio_pt_int.c                           |    1 +
 audio/audio_template.h                         |    8 +-
 audio/esdaudio.c                               |    2 +-
 audio/paaudio.c                                |  503 +-
 audio/spiceaudio.c                             |   41 +
 audio/wavcapture.c                             |    1 +
 audio/winwaveaudio.c                           |   14 +-
 backends/Makefile.objs                         |    2 +
 backends/rng-egd.c                             |  224 +
 backends/rng-random.c                          |  161 +
 backends/rng.c                                 |   93 +
 balloon.c                                      |   44 +-
 balloon.h                                      |    3 +-
 bitops.h                                       |  116 +-
 block-migration.c                              |  240 +-
 block.c                                        | 2448 +-
 block.h                                        |  184 +-
 block/Makefile.objs                            |   20 +
 block/blkdebug.c                               |  124 +-
 block/blkverify.c                              |   32 +-
 block/commit.c                                 |  259 +
 block/cow.c                                    |   98 +-
 block/curl.c                                   |   29 +-
 block/gluster.c                                |  624 +
 block/iscsi.c                                  |  740 +-
 block/linux-aio.c                              |  216 +
 block/mirror.c                                 |  322 +
 block/nbd.c                                    |  463 +-
 block/qcow.c                                   |  136 +-
 block/qcow2-cache.c                            |   43 +-
 block/qcow2-cluster.c                          |  655 +-
 block/qcow2-refcount.c                         |  266 +-
 block/qcow2-snapshot.c                         |  382 +-
 block/qcow2.c                                  |  661 +-
 block/qcow2.h                                  |  102 +-
 block/qed-check.c                              |   37 +
 block/qed-l2-cache.c                           |   22 +-
 block/qed-table.c                              |   25 +-
 block/qed.c                                    |  286 +-
 block/qed.h                                    |   14 +-
 block/raw-aio.h                                |   48 +
 block/raw-posix-aio.h                          |   43 -
 block/raw-posix.c                              |  696 +-
 block/raw-win32.c                              |  265 +-
 block/raw.c                                    |   22 +-
 block/rbd.c                                    |  142 +-
 block/sheepdog.c                               |  775 +-
 block/stream.c                                 |  236 +
 block/vdi.c                                    |  505 +-
 block/vmdk.c                                   |  145 +-
 block/vpc.c                                    |  300 +-
 block/vvfat.c                                  |   89 +-
 block/win32-aio.c                              |  226 +
 block_int.h                                    |  201 +-
 blockdev-nbd.c                                 |  133 +
 blockdev.c                                     |  954 +-
 blockdev.h                                     |   15 +-
 blockjob.c                                     |  283 +
 blockjob.h                                     |  278 +
 bsd-user/Makefile.objs                         |    2 +
 bsd-user/bsdload.c                             |    2 +-
 bsd-user/elfload.c                             |   16 +-
 bsd-user/main.c                                |   21 +-
 bsd-user/qemu.h                                |   12 +-
 bsd-user/signal.c                              |    2 +-
 bsd-user/x86_64/syscall.h                      |    2 +-
 bt-host.c                                      |    1 +
 buffered_file.c                                |  154 +-
 buffered_file.h                                |   12 +-
 cache-utils.h                                  |    5 +-
 check-qdict.c                                  |  402 -
 check-qfloat.c                                 |   76 -
 check-qint.c                                   |  113 -
 check-qjson.c                                  |  795 -
 check-qlist.c                                  |  153 -
 check-qstring.c                                |  134 -
 cmd.c                                          |   50 +-
 compatfd.c                                     |    2 +
 compiler.h                                     |    9 +-
 configure                                      | 1350 +-
 console.c                                      |  337 +-
 console.h                                      |  274 +-
 coroutine-gthread.c                            |  101 +-
 coroutine-sigaltstack.c                        |  334 +
 coroutine-ucontext.c                           |   42 +-
 cpu-all.h                                      |  217 +-
 cpu-common.h                                   |  159 +-
 cpu-defs.h                                     |   30 +-
 cpu-exec.c                                     |  112 +-
 cpus.c                                         |  530 +-
 cpus.h                                         |    2 +
 cputlb.c                                       |  361 +
 cputlb.h                                       |   46 +
 cris-dis.c                                     |   34 +-
 cursor.c                                       |    3 +-
 cutils.c                                       |  242 +-
 darwin-user/commpage.c                         |  357 -
 darwin-user/ioctls.h                           |    4 -
 darwin-user/ioctls_types.h                     |    1 -
 darwin-user/machload.c                         |  902 -
 darwin-user/main.c                             | 1024 -
 darwin-user/mmap.c                             |  409 -
 darwin-user/qemu.h                             |  178 -
 darwin-user/signal.c                           |  453 -
 darwin-user/syscall.c                          | 1566 -
 darwin-user/syscalls.h                         |  384 -
 def-helper.h                                   |   37 +-
 default-configs/alpha-softmmu.mak              |    2 +
 default-configs/arm-softmmu.mak                |   20 +
 default-configs/i386-darwin-user.mak           |    1 -
 default-configs/i386-softmmu.mak               |    3 +
 default-configs/microblaze-softmmu.mak         |    4 +
 default-configs/microblazeel-softmmu.mak       |    4 +
 default-configs/mips-softmmu.mak               |    3 +
 default-configs/mips64-linux-user.mak          |    1 +
 default-configs/mips64-softmmu.mak             |    3 +
 default-configs/mips64el-linux-user.mak        |    1 +
 default-configs/mips64el-softmmu.mak           |    3 +
 default-configs/mipsel-softmmu.mak             |    3 +
 default-configs/mipsn32-linux-user.mak         |    1 +
 default-configs/mipsn32el-linux-user.mak       |    1 +
 default-configs/or32-linux-user.mak            |    1 +
 default-configs/or32-softmmu.mak               |    4 +
 default-configs/pci.mak                        |    6 +
 default-configs/ppc-darwin-user.mak            |    3 -
 default-configs/ppc-softmmu.mak                |    5 +
 default-configs/ppc64-softmmu.mak              |    2 +
 default-configs/ppcemb-softmmu.mak             |    2 +
 default-configs/sparc64-softmmu.mak            |    1 +
 default-configs/unicore32-softmmu.mak          |    4 +
 default-configs/x86_64-softmmu.mak             |    3 +
 device_tree.c                                  |  153 +-
 device_tree.h                                  |   28 +-
 dis-asm.h                                      |    3 +
 disas.c                                        |  190 +-
 disas.h                                        |    7 +-
 dma-helpers.c                                  |  270 +-
 dma.h                                          |  249 +-
 docs/bootindex.txt                             |    2 +-
 docs/ccid.txt                                  |    2 +-
 docs/libcacard.txt                             |   26 +-
 docs/live-block-ops.txt                        |   58 +
 docs/memory.txt                                |    6 +-
 docs/migration.txt                             |   12 +
 docs/qapi-code-gen.txt                         |    6 +-
 docs/qemupciserial.inf                         |  109 +
 docs/specs/acpi_pci_hotplug.txt                |   18 +-
 docs/specs/ivshmem_device_spec.txt             |    2 +-
 docs/specs/pci-serial.txt                      |   34 +
 docs/specs/ppc-spapr-hcalls.txt                |   78 +
 docs/specs/qcow2.txt                           |  140 +-
 docs/specs/standard-vga.txt                    |   65 +
 docs/tracing.txt                               |   61 +-
 docs/usb-storage.txt                           |   38 +
 docs/usb2.txt                                  |   15 +
 docs/writing-qmp-commands.txt                  |  649 +
 docs/xbzrle.txt                                |  128 +
 dump-stub.c                                    |   64 +
 dump.c                                         |  865 +
 dump.h                                         |   35 +
 dyngen-exec.h                                  |   70 -
 elf.h                                          |   44 +
 error.c                                        |  121 +-
 error.h                                        |   50 +-
 error_int.h                                    |   29 -
 event_notifier-posix.c                         |  120 +
 event_notifier-win32.c                         |   59 +
 event_notifier.c                               |   61 -
 event_notifier.h                               |   36 +-
 exec-all.h                                     |  184 +-
 exec-memory.h                                  |    9 +-
 exec.c                                         | 2788 +-
 fpu/softfloat-macros.h                         |   18 +-
 fpu/softfloat-specialize.h                     |  107 +-
 fpu/softfloat.c                                |  144 +-
 fpu/softfloat.h                                |   22 +-
 fsdev/Makefile.objs                            |    9 +
 fsdev/file-op-9p.h                             |   25 +-
 fsdev/qemu-fsdev-dummy.c                       |    1 +
 fsdev/qemu-fsdev.c                             |   45 +-
 fsdev/qemu-fsdev.h                             |   11 +-
 fsdev/virtfs-proxy-helper.c                    | 1115 +
 fsdev/virtfs-proxy-helper.texi                 |   63 +
 fsdev/virtio-9p-marshal.c                      |  323 +
 fsdev/virtio-9p-marshal.h                      |   90 +
 gdbstub.c                                      |  384 +-
 gdbstub.h                                      |   25 +-
 gen-icount.h                                   |   10 +-
 hmp-commands.hx                                |  349 +-
 hmp.c                                          |  834 +-
 hmp.h                                          |   43 +
 hppa-dis.c                                     |    2 +-
 hw/9pfs/Makefile.objs                          |    9 +
 hw/9pfs/codir.c                                |    6 +-
 hw/9pfs/cofile.c                               |   14 +
 hw/9pfs/virtio-9p-coth.h                       |    2 +-
 hw/9pfs/virtio-9p-device.c                     |   74 +-
 hw/9pfs/virtio-9p-handle.c                     |   28 +-
 hw/9pfs/virtio-9p-local.c                      |  387 +-
 hw/9pfs/virtio-9p-posix-acl.c                  |    6 +-
 hw/9pfs/virtio-9p-proxy.c                      | 1210 +
 hw/9pfs/virtio-9p-proxy.h                      |   95 +
 hw/9pfs/virtio-9p-synth.c                      |    4 +-
 hw/9pfs/virtio-9p-xattr-user.c                 |    3 +-
 hw/9pfs/virtio-9p-xattr.c                      |    3 +-
 hw/9pfs/virtio-9p.c                            |  790 +-
 hw/9pfs/virtio-9p.h                            |   83 +-
 hw/Makefile.objs                               |  209 +
 hw/a15mpcore.c                                 |  108 +
 hw/a9mpcore.c                                  |  243 +-
 hw/ac97.c                                      |  392 +-
 hw/acpi.c                                      |  206 +-
 hw/acpi.h                                      |   93 +-
 hw/acpi_piix4.c                                |  355 +-
 hw/adb.c                                       |    8 +-
 hw/adb.h                                       |    4 -
 hw/adlib.c                                     |    4 +-
 hw/ads7846.c                                   |   34 +-
 hw/alpha/Makefile.objs                         |    4 +
 hw/alpha_dp264.c                               |   32 +-
 hw/alpha_pci.c                                 |   37 +-
 hw/alpha_sys.h                                 |    6 +-
 hw/alpha_typhoon.c                             |   84 +-
 hw/an5206.c                                    |   20 +-
 hw/apb_pci.c                                   |  179 +-
 hw/apb_pci.h                                   |    7 +-
 hw/apic-msidef.h                               |   30 +
 hw/apic.c                                      |  564 +-
 hw/apic.h                                      |    9 +-
 hw/apic_common.c                               |  402 +
 hw/apic_internal.h                             |  149 +
 hw/apm.c                                       |    3 +
 hw/applesmc.c                                  |   38 +-
 hw/arm-misc.h                                  |   37 +-
 hw/arm/Makefile.objs                           |   35 +
 hw/arm11mpcore.c                               |  214 +-
 hw/arm_boot.c                                  |  275 +-
 hw/arm_gic.c                                   |  552 +-
 hw/arm_gic_common.c                            |  184 +
 hw/arm_gic_internal.h                          |  136 +
 hw/arm_l2x0.c                                  |  194 +
 hw/arm_mptimer.c                               |  344 +
 hw/arm_pic.c                                   |    8 +-
 hw/arm_sysctl.c                                |   59 +-
 hw/arm_timer.c                                 |  127 +-
 hw/armv7m.c                                    |   80 +-
 hw/armv7m_nvic.c                               |  271 +-
 hw/audiodev.h                                  |    8 +-
 hw/axis_dev88.c                                |   86 +-
 hw/baum.c                                      |    7 +-
 hw/baum.h                                      |    2 +-
 hw/bitbang_i2c.c                               |   32 +-
 hw/blizzard.c                                  |   12 +-
 hw/block-common.c                              |   64 +
 hw/block-common.h                              |   79 +
 hw/boards.h                                    |   22 +-
 hw/bonito.c                                    |  420 +-
 hw/bt-hci-csr.c                                |    2 +-
 hw/bt-hci.c                                    |    8 +-
 hw/bt-l2cap.c                                  |   11 +-
 hw/bt-sdp.c                                    |    6 +-
 hw/bt.h                                        |    2 +
 hw/cadence_gem.c                               | 1233 +
 hw/cadence_ttc.c                               |  489 +
 hw/cadence_uart.c                              |  516 +
 hw/ccid-card-emulated.c                        |   77 +-
 hw/ccid-card-passthru.c                        |   45 +-
 hw/ccid.h                                      |   27 +-
 hw/cirrus_vga.c                                |  209 +-
 hw/cirrus_vga_template.h                       |  102 +
 hw/collie.c                                    |   14 +-
 hw/cris-boot.c                                 |   10 +-
 hw/cris-boot.h                                 |    4 +-
 hw/cris/Makefile.objs                          |   13 +
 hw/cris_pic_cpu.c                              |    4 +-
 hw/cs4231.c                                    |   62 +-
 hw/cs4231a.c                                   |   63 +-
 hw/cuda.c                                      |   14 +-
 hw/debugcon.c                                  |   36 +-
 hw/dec_pci.c                                   |  107 +-
 hw/dec_pci.h                                   |    2 +
 hw/device-hotplug.c                            |   46 +
 hw/devices.h                                   |    2 +
 hw/dma.c                                       |    4 +-
 hw/dp8393x.c                                   |   59 +-
 hw/ds1225y.c                                   |  101 +-
 hw/ds1338.c                                    |  165 +-
 hw/dummy_m68k.c                                |   15 +-
 hw/e1000.c                                     |  284 +-
 hw/e1000_hw.h                                  |   14 +-
 hw/ecc.c                                       |    3 +
 hw/eccmemctl.c                                 |  100 +-
 hw/eepro100.c                                  |  265 +-
 hw/elf_ops.h                                   |   25 +-
 hw/empty_slot.c                                |   56 +-
 hw/empty_slot.h                                |    2 +-
 hw/es1370.c                                    |  149 +-
 hw/escc.c                                      |   60 +-
 hw/escc.h                                      |    4 +-
 hw/esp-pci.c                                   |  518 +
 hw/esp.c                                       |  356 +-
 hw/esp.h                                       |  121 +-
 hw/etraxfs.h                                   |    4 +-
 hw/etraxfs_dma.c                               |   52 +-
 hw/etraxfs_dma.h                               |   15 +-
 hw/etraxfs_eth.c                               |   62 +-
 hw/etraxfs_pic.c                               |   41 +-
 hw/etraxfs_ser.c                               |   37 +-
 hw/etraxfs_timer.c                             |   28 +-
 hw/exynos4210.c                                |  338 +
 hw/exynos4210.h                                |  137 +
 hw/exynos4210_combiner.c                       |  455 +
 hw/exynos4210_fimd.c                           | 1928 +
 hw/exynos4210_gic.c                            |  462 +
 hw/exynos4210_i2c.c                            |  334 +
 hw/exynos4210_mct.c                            | 1482 +
 hw/exynos4210_pmu.c                            |  499 +
 hw/exynos4210_pwm.c                            |  422 +
 hw/exynos4210_rtc.c                            |  592 +
 hw/exynos4210_uart.c                           |  676 +
 hw/exynos4_boards.c                            |  168 +
 hw/fdc.c                                       |  747 +-
 hw/fdc.h                                       |   36 +-
 hw/fifo.c                                      |   78 +
 hw/fifo.h                                      |   99 +
 hw/flash.h                                     |    8 +-
 hw/fmopl.c                                     |   44 +-
 hw/fmopl.h                                     |    4 +-
 hw/framebuffer.c                               |   49 +-
 hw/framebuffer.h                               |    5 +-
 hw/fw_cfg.c                                    |  178 +-
 hw/fw_cfg.h                                    |    2 +-
 hw/g364fb.c                                    |  128 +-
 hw/grackle_pci.c                               |  108 +-
 hw/grlib.h                                     |    8 +-
 hw/grlib_apbuart.c                             |  150 +-
 hw/grlib_gptimer.c                             |   78 +-
 hw/grlib_irqmp.c                               |   71 +-
 hw/gt64xxx.c                                   |  126 +-
 hw/gumstix.c                                   |   14 +-
 hw/gus.c                                       |   67 +-
 hw/gusemu.h                                    |    4 +-
 hw/gusemu_hal.c                                |    4 +-
 hw/hd-geometry.c                               |  157 +
 hw/hda-audio.c                                 |  308 +-
 hw/heathrow_pic.c                              |    4 +-
 hw/hid.h                                       |   23 +
 hw/highbank.c                                  |  338 +
 hw/hpet.c                                      |  175 +-
 hw/hpet_emul.h                                 |    3 +
 hw/hw.h                                        |  886 +-
 hw/i2c.c                                       |  142 +-
 hw/i2c.h                                       |   57 +-
 hw/i386/Makefile.objs                          |   15 +
 hw/i82374.c                                    |  168 +
 hw/i82378.c                                    |  277 +
 hw/i8254.c                                     |  374 +-
 hw/i8254.h                                     |   68 +
 hw/i8254_common.c                              |  311 +
 hw/i8254_internal.h                            |   85 +
 hw/i8259.c                                     |  189 +-
 hw/i8259_common.c                              |  161 +
 hw/i8259_internal.h                            |   82 +
 hw/ide.h                                       |   10 +-
 hw/ide/Makefile.objs                           |   10 +
 hw/ide/ahci.c                                  |  256 +-
 hw/ide/ahci.h                                  |    5 +-
 hw/ide/atapi.c                                 |   52 +-
 hw/ide/cmd646.c                                |   76 +-
 hw/ide/core.c                                  |  363 +-
 hw/ide/ich.c                                   |   60 +-
 hw/ide/internal.h                              |   40 +-
 hw/ide/isa.c                                   |   44 +-
 hw/ide/macio.c                                 |   38 +-
 hw/ide/mmio.c                                  |   59 +-
 hw/ide/pci.c                                   |   16 +-
 hw/ide/piix.c                                  |  124 +-
 hw/ide/qdev.c                                  |  219 +-
 hw/ide/via.c                                   |   53 +-
 hw/imx.h                                       |   34 +
 hw/imx_avic.c                                  |  408 +
 hw/imx_ccm.c                                   |  321 +
 hw/imx_serial.c                                |  467 +
 hw/imx_timer.c                                 |  689 +
 hw/integratorcp.c                              |  203 +-
 hw/intel-hda.c                                 |  193 +-
 hw/intel-hda.h                                 |   28 +-
 hw/ioapic.c                                    |  181 +-
 hw/ioapic_common.c                             |  120 +
 hw/ioapic_internal.h                           |  102 +
 hw/ioh3420.c                                   |   79 +-
 hw/irq.c                                       |   44 +-
 hw/irq.h                                       |   18 +-
 hw/isa-bus.c                                   |  145 +-
 hw/isa.h                                       |   54 +-
 hw/isa_mmio.c                                  |   16 +-
 hw/ivshmem.c                                   |  230 +-
 hw/jazz_led.c                                  |  203 +-
 hw/kvm/Makefile.objs                           |    1 +
 hw/kvm/apic.c                                  |  209 +
 hw/kvm/clock.c                                 |  143 +
 hw/kvm/clock.h                                 |   24 +
 hw/kvm/i8254.c                                 |  317 +
 hw/kvm/i8259.c                                 |  138 +
 hw/kvm/ioapic.c                                |  125 +
 hw/kvm/pci-assign.c                            | 1905 +
 hw/kvmclock.c                                  |  118 -
 hw/kvmclock.h                                  |   24 -
 hw/kvmvapic.c                                  |  821 +
 hw/kzm.c                                       |  156 +
 hw/lan9118.c                                   |  315 +-
 hw/lance.c                                     |   52 +-
 hw/leon3.c                                     |   37 +-
 hw/lm32/Makefile.objs                          |   23 +
 hw/lm32_boards.c                               |   86 +-
 hw/lm32_hwsetup.h                              |    4 +-
 hw/lm32_juart.c                                |   29 +-
 hw/lm32_pic.c                                  |   27 +-
 hw/lm32_sys.c                                  |   65 +-
 hw/lm32_timer.c                                |   70 +-
 hw/lm32_uart.c                                 |   60 +-
 hw/lm4549.c                                    |    8 +-
 hw/lm4549.h                                    |    6 +-
 hw/lm832x.c                                    |   41 +-
 hw/loader.c                                    |   49 +-
 hw/loader.h                                    |   23 +-
 hw/lsi53c895a.c                                |  119 +-
 hw/m25p80.c                                    |  651 +
 hw/m48t59.c                                    |  192 +-
 hw/m68k/Makefile.objs                          |    4 +
 hw/mac_dbdma.c                                 |    4 +-
 hw/mac_dbdma.h                                 |    2 +-
 hw/mac_nvram.c                                 |    8 +-
 hw/macio.c                                     |   51 +-
 hw/mainstone.c                                 |   45 +-
 hw/marvell_88w8618_audio.c                     |   76 +-
 hw/max111x.c                                   |   54 +-
 hw/max7310.c                                   |   43 +-
 hw/mc146818rtc.c                               |  721 +-
 hw/mc146818rtc.h                               |    5 +-
 hw/mc146818rtc_regs.h                          |   67 +
 hw/mcf.h                                       |   23 +-
 hw/mcf5206.c                                   |   97 +-
 hw/mcf5208.c                                   |   40 +-
 hw/mcf_fec.c                                   |   47 +-
 hw/mcf_intc.c                                  |   35 +-
 hw/mcf_uart.c                                  |   34 +-
 hw/megasas.c                                   | 2213 +
 hw/mfi.h                                       | 1249 +
 hw/microblaze/Makefile.objs                    |   10 +
 hw/microblaze_boot.c                           |  177 +
 hw/microblaze_boot.h                           |   10 +
 hw/microblaze_pic_cpu.c                        |    4 +-
 hw/microblaze_pic_cpu.h                        |    2 +-
 hw/milkymist-ac97.c                            |   33 +-
 hw/milkymist-hpdmc.c                           |   33 +-
 hw/milkymist-hw.h                              |   24 +-
 hw/milkymist-memcard.c                         |   33 +-
 hw/milkymist-minimac2.c                        |   64 +-
 hw/milkymist-pfpu.c                            |   37 +-
 hw/milkymist-softusb.c                         |   63 +-
 hw/milkymist-sysctl.c                          |   84 +-
 hw/milkymist-tmu2.c                            |   37 +-
 hw/milkymist-uart.c                            |   35 +-
 hw/milkymist-vgafb.c                           |   54 +-
 hw/milkymist-vgafb_template.h                  |    2 +-
 hw/milkymist.c                                 |   45 +-
 hw/mips.h                                      |   15 +-
 hw/mips/Makefile.objs                          |    6 +
 hw/mips_cpudevs.h                              |    4 +-
 hw/mips_fulong2e.c                             |   71 +-
 hw/mips_int.c                                  |    6 +-
 hw/mips_jazz.c                                 |   78 +-
 hw/mips_malta.c                                |  196 +-
 hw/mips_mipssim.c                              |   37 +-
 hw/mips_r4k.c                                  |   62 +-
 hw/mips_timer.c                                |   20 +-
 hw/mipsnet.c                                   |   57 +-
 hw/mpc8544_guts.c                              |   60 +-
 hw/mpcore.c                                    |  283 -
 hw/msi.c                                       |   81 +-
 hw/msi.h                                       |    9 +
 hw/msix.c                                      |  436 +-
 hw/msix.h                                      |   27 +-
 hw/msmouse.c                                   |    5 +-
 hw/msmouse.h                                   |    2 +-
 hw/mst_fpga.c                                  |   60 +-
 hw/multiboot.c                                 |   28 +-
 hw/musicpal.c                                  |  281 +-
 hw/nand.c                                      |   78 +-
 hw/ne2000-isa.c                                |   42 +-
 hw/ne2000.c                                    |  103 +-
 hw/ne2000.h                                    |    4 +-
 hw/nseries.c                                   |  139 +-
 hw/null-machine.c                              |   35 +
 hw/nvram.h                                     |   16 +-
 hw/omap.h                                      |  228 +-
 hw/omap1.c                                     |  352 +-
 hw/omap2.c                                     |  278 +-
 hw/omap_dma.c                                  |   91 +-
 hw/omap_dss.c                                  |  199 +-
 hw/omap_gpio.c                                 |  189 +-
 hw/omap_gpmc.c                                 |   46 +-
 hw/omap_gptimer.c                              |   40 +-
 hw/omap_i2c.c                                  |  140 +-
 hw/omap_intc.c                                 |   86 +-
 hw/omap_l4.c                                   |  190 +-
 hw/omap_lcdc.c                                 |  111 +-
 hw/omap_mmc.c                                  |   48 +-
 hw/omap_sdrc.c                                 |   41 +-
 hw/omap_spi.c                                  |   39 +-
 hw/omap_sx1.c                                  |  141 +-
 hw/omap_synctimer.c                            |   36 +-
 hw/omap_tap.c                                  |   34 +-
 hw/omap_uart.c                                 |   50 +-
 hw/onenand.c                                   |   58 +-
 hw/opencores_eth.c                             |   90 +-
 hw/openpic.c                                   |  111 +-
 hw/openpic.h                                   |    4 +-
 hw/openrisc/Makefile.objs                      |    3 +
 hw/openrisc_pic.c                              |   60 +
 hw/openrisc_sim.c                              |  149 +
 hw/openrisc_timer.c                            |  101 +
 hw/palm.c                                      |   34 +-
 hw/parallel.c                                  |   77 +-
 hw/pc.c                                        |  458 +-
 hw/pc.h                                        |  132 +-
 hw/pc_piix.c                                   |  534 +-
 hw/pc_sysfw.c                                  |  266 +
 hw/pci-hotplug.c                               |   52 +-
 hw/pci-stub.c                                  |    2 +-
 hw/pci.c                                       |  440 +-
 hw/pci.h                                       |  247 +-
 hw/pci_bridge.c                                |   87 +-
 hw/pci_bridge.h                                |    2 +-
 hw/pci_bridge_dev.c                            |  171 +
 hw/pci_host.c                                  |   23 +-
 hw/pci_host.h                                  |    6 +
 hw/pci_ids.h                                   |   11 +
 hw/pci_internals.h                             |   30 +-
 hw/pci_regs.h                                  |    3 +-
 hw/pcie.c                                      |    2 +-
 hw/pcie.h                                      |   10 +
 hw/pcie_aer.c                                  |    9 +-
 hw/pcie_host.c                                 |   41 +-
 hw/pcie_host.h                                 |   15 +-
 hw/pcie_port.c                                 |   12 +-
 hw/pckbd.c                                     |   83 +-
 hw/pcnet-pci.c                                 |   85 +-
 hw/pcnet.c                                     |   59 +-
 hw/pcnet.h                                     |   11 +-
 hw/pcspk.c                                     |   86 +-
 hw/pcspk.h                                     |   45 +
 hw/petalogix_ml605_mmu.c                       |  211 +-
 hw/petalogix_s3adsp1800_mmu.c                  |  169 +-
 hw/pflash_cfi01.c                              |  277 +-
 hw/pflash_cfi02.c                              |  317 +-
 hw/piix4.c                                     |   45 +-
 hw/piix_pci.c                                  |  292 +-
 hw/pl011.c                                     |   88 +-
 hw/pl022.c                                     |   60 +-
 hw/pl031.c                                     |  154 +-
 hw/pl041.c                                     |   57 +-
 hw/pl041.h                                     |    2 +-
 hw/pl041.hx                                    |    2 +-
 hw/pl050.c                                     |   81 +-
 hw/pl061.c                                     |   81 +-
 hw/pl080.c                                     |   90 +-
 hw/pl110.c                                     |  155 +-
 hw/pl110_template.h                            |   22 +-
 hw/pl181.c                                     |  112 +-
 hw/pl190.c                                     |   83 +-
 hw/ppc.c                                       |  178 +-
 hw/ppc.h                                       |   28 +-
 hw/ppc/Makefile.objs                           |   31 +
 hw/ppc/e500.c                                  |  580 +
 hw/ppc/e500.h                                  |   21 +
 hw/ppc/e500plat.c                              |   61 +
 hw/ppc/mpc8544ds.c                             |   62 +
 hw/ppc405.h                                    |   20 +-
 hw/ppc405_boards.c                             |   71 +-
 hw/ppc405_uc.c                                 |  137 +-
 hw/ppc440.c                                    |  106 -
 hw/ppc440.h                                    |   21 -
 hw/ppc440_bamboo.c                             |  184 +-
 hw/ppc4xx.h                                    |   26 +-
 hw/ppc4xx_devs.c                               |   55 +-
 hw/ppc4xx_pci.c                                |  205 +-
 hw/ppc_booke.c                                 |   20 +-
 hw/ppc_mac.h                                   |    5 +-
 hw/ppc_newworld.c                              |   70 +-
 hw/ppc_oldworld.c                              |   45 +-
 hw/ppc_prep.c                                  |  207 +-
 hw/ppce500_mpc8544ds.c                         |  409 -
 hw/ppce500_pci.c                               |  133 +-
 hw/ppce500_spin.c                              |   65 +-
 hw/prep_pci.c                                  |  221 +-
 hw/prep_pci.h                                  |   11 -
 hw/primecell.h                                 |    6 -
 hw/ps2.c                                       |    8 +-
 hw/ps2.h                                       |   29 +
 hw/ptimer.c                                    |   14 +
 hw/ptimer.h                                    |   39 +
 hw/puv3.c                                      |  133 +
 hw/puv3.h                                      |   49 +
 hw/puv3_dma.c                                  |  109 +
 hw/puv3_gpio.c                                 |  141 +
 hw/puv3_intc.c                                 |  135 +
 hw/puv3_ost.c                                  |  151 +
 hw/puv3_pm.c                                   |  149 +
 hw/pxa.h                                       |   35 +-
 hw/pxa2xx.c                                    |  528 +-
 hw/pxa2xx_dma.c                                |  110 +-
 hw/pxa2xx_gpio.c                               |   80 +-
 hw/pxa2xx_keypad.c                             |  110 +-
 hw/pxa2xx_lcd.c                                |  150 +-
 hw/pxa2xx_mmci.c                               |   50 +-
 hw/pxa2xx_pcmcia.c                             |   98 +-
 hw/pxa2xx_pic.c                                |  138 +-
 hw/pxa2xx_timer.c                              |  108 +-
 hw/qdev-addr.c                                 |   59 +-
 hw/qdev-addr.h                                 |    4 +-
 hw/qdev-core.h                                 |  238 +
 hw/qdev-dma.h                                  |   10 +
 hw/qdev-monitor.c                              |  617 +
 hw/qdev-monitor.h                              |   16 +
 hw/qdev-properties.c                           | 1124 +-
 hw/qdev-properties.h                           |  130 +
 hw/qdev.c                                      |  984 +-
 hw/qdev.h                                      |  331 +-
 hw/qxl-logger.c                                |   51 +-
 hw/qxl-render.c                                |  180 +-
 hw/qxl.c                                       | 1085 +-
 hw/qxl.h                                       |   56 +-
 hw/r2d.c                                       |   58 +-
 hw/rc4030.c                                    |   85 +-
 hw/realview.c                                  |  177 +-
 hw/realview_gic.c                              |   87 +-
 hw/rtl8139.c                                   |  298 +-
 hw/s390-virtio-bus.c                           |  323 +-
 hw/s390-virtio-bus.h                           |   40 +-
 hw/s390-virtio.c                               |   88 +-
 hw/s390x/Makefile.objs                         |    6 +
 hw/s390x/event-facility.c                      |  398 +
 hw/s390x/event-facility.h                      |   96 +
 hw/s390x/sclp.c                                |  163 +
 hw/s390x/sclp.h                                |  118 +
 hw/s390x/sclpconsole.c                         |  306 +
 hw/s390x/sclpquiesce.c                         |  123 +
 hw/sb16.c                                      |  150 +-
 hw/sbi.c                                       |   60 +-
 hw/scsi-bus.c                                  |  746 +-
 hw/scsi-defs.h                                 |   21 +-
 hw/scsi-disk.c                                 | 1610 +-
 hw/scsi-generic.c                              |   99 +-
 hw/scsi.h                                      |   70 +-
 hw/sd.c                                        |  308 +-
 hw/sd.h                                        |    7 +-
 hw/serial-isa.c                                |  130 +
 hw/serial-pci.c                                |  252 +
 hw/serial.c                                    |  182 +-
 hw/serial.h                                    |   99 +
 hw/sga.c                                       |   25 +-
 hw/sh.h                                        |    9 +-
 hw/sh4/Makefile.objs                           |    5 +
 hw/sh7750.c                                    |  173 +-
 hw/sh7750_regs.h                               |    2 +-
 hw/sh_intc.c                                   |   87 +-
 hw/sh_intc.h                                   |    7 +-
 hw/sh_pci.c                                    |   80 +-
 hw/sh_serial.c                                 |   61 +-
 hw/sh_timer.c                                  |   50 +-
 hw/sharpsl.h                                   |    2 +-
 hw/shix.c                                      |   27 +-
 hw/shpc.c                                      |  681 +
 hw/shpc.h                                      |   48 +
 hw/slavio_intctl.c                             |   98 +-
 hw/slavio_misc.c                               |  309 +-
 hw/slavio_timer.c                              |   81 +-
 hw/slotid_cap.c                                |   44 +
 hw/slotid_cap.h                                |   11 +
 hw/sm501.c                                     |   40 +-
 hw/smbios.c                                    |    2 +
 hw/smbus.c                                     |   85 +-
 hw/smbus.h                                     |   40 +-
 hw/smbus_eeprom.c                              |   43 +-
 hw/smc91c111.c                                 |   63 +-
 hw/soc_dma.c                                   |    8 +-
 hw/soc_dma.h                                   |   11 +-
 hw/spapr.c                                     |  632 +-
 hw/spapr.h                                     |   68 +-
 hw/spapr_events.c                              |  321 +
 hw/spapr_hcall.c                               |  206 +-
 hw/spapr_iommu.c                               |  287 +
 hw/spapr_llan.c                                |  163 +-
 hw/spapr_pci.c                                 |  783 +-
 hw/spapr_pci.h                                 |   49 +-
 hw/spapr_rtas.c                                |   49 +-
 hw/spapr_vio.c                                 |  547 +-
 hw/spapr_vio.h                                 |  131 +-
 hw/spapr_vscsi.c                               |   94 +-
 hw/spapr_vty.c                                 |   66 +-
 hw/sparc/Makefile.objs                         |    8 +
 hw/sparc32_dma.c                               |   74 +-
 hw/sparc32_dma.h                               |    4 +-
 hw/sparc64/Makefile.objs                       |    4 +
 hw/spitz.c                                     |  203 +-
 hw/srp.h                                       |    8 +-
 hw/ssd0303.c                                   |   45 +-
 hw/ssd0323.c                                   |   37 +-
 hw/ssi-sd.c                                    |   34 +-
 hw/ssi.c                                       |  156 +-
 hw/ssi.h                                       |   58 +-
 hw/stellaris.c                                 |  270 +-
 hw/stellaris_enet.c                            |   49 +-
 hw/stream.c                                    |   23 +
 hw/stream.h                                    |   31 +
 hw/strongarm.c                                 |  215 +-
 hw/strongarm.h                                 |    2 +-
 hw/sun4c_intctl.c                              |   86 +-
 hw/sun4m.c                                     |  415 +-
 hw/sun4m.h                                     |   10 +-
 hw/sun4m_iommu.c                               |   92 +-
 hw/sun4u.c                                     |  347 +-
 hw/syborg.c                                    |  113 -
 hw/syborg.h                                    |   18 -
 hw/syborg_fb.c                                 |  560 -
 hw/syborg_interrupt.c                          |  238 -
 hw/syborg_keyboard.c                           |  221 -
 hw/syborg_pointer.c                            |  226 -
 hw/syborg_rtc.c                                |  140 -
 hw/syborg_serial.c                             |  335 -
 hw/syborg_timer.c                              |  231 -
 hw/syborg_virtio.c                             |  313 -
 hw/sysbus.c                                    |  173 +-
 hw/sysbus.h                                    |   58 +-
 hw/tc6393xb.c                                  |   26 +-
 hw/tc6393xb_template.h                         |    2 +-
 hw/tcx.c                                       |  219 +-
 hw/tmp105.c                                    |   45 +-
 hw/tosa.c                                      |   91 +-
 hw/tusb6010.c                                  |   41 +-
 hw/twl92230.c                                  |   73 +-
 hw/unicore32/Makefile.objs                     |    6 +
 hw/unin_pci.c                                  |  343 +-
 hw/usb-bt.c                                    |  570 -
 hw/usb-bus.c                                   |  482 -
 hw/usb-ccid.c                                  | 1321 -
 hw/usb-desc.c                                  |  466 -
 hw/usb-desc.h                                  |  112 -
 hw/usb-ehci.c                                  | 2370 -
 hw/usb-hid.c                                   |  612 -
 hw/usb-hub.c                                   |  562 -
 hw/usb-libhw.c                                 |   63 -
 hw/usb-msd.c                                   |  677 -
 hw/usb-musb.c                                  | 1543 -
 hw/usb-net.c                                   | 1426 -
 hw/usb-ohci.c                                  | 1870 -
 hw/usb-ohci.h                                  |    9 -
 hw/usb-serial.c                                |  625 -
 hw/usb-uhci.c                                  | 1285 -
 hw/usb-uhci.h                                  |   10 -
 hw/usb-wacom.c                                 |  379 -
 hw/usb.c                                       |  416 -
 hw/usb.h                                       |  249 +-
 hw/usb/Makefile.objs                           |   14 +
 hw/usb/bus.c                                   |  628 +
 hw/usb/combined-packet.c                       |  186 +
 hw/usb/core.c                                  |  767 +
 hw/usb/desc.c                                  |  790 +
 hw/usb/desc.h                                  |  224 +
 hw/usb/dev-audio.c                             |  700 +
 hw/usb/dev-bluetooth.c                         |  553 +
 hw/usb/dev-hid.c                               |  634 +
 hw/usb/dev-hub.c                               |  581 +
 hw/usb/dev-network.c                           | 1441 +
 hw/usb/dev-serial.c                            |  646 +
 hw/usb/dev-smartcard-reader.c                  | 1356 +
 hw/usb/dev-storage.c                           |  732 +
 hw/usb/dev-uas.c                               |  772 +
 hw/usb/dev-wacom.c                             |  378 +
 hw/usb/hcd-ehci-pci.c                          |  218 +
 hw/usb/hcd-ehci-sysbus.c                       |   77 +
 hw/usb/hcd-ehci.c                              | 2437 +
 hw/usb/hcd-ehci.h                              |  319 +
 hw/usb/hcd-musb.c                              | 1546 +
 hw/usb/hcd-ohci.c                              | 1925 +
 hw/usb/hcd-uhci.c                              | 1411 +
 hw/usb/hcd-xhci.c                              | 3184 ++
 hw/usb/host-bsd.c                              |  644 +
 hw/usb/host-linux.c                            | 2022 +
 hw/usb/host-stub.c                             |   52 +
 hw/usb/libhw.c                                 |   70 +
 hw/usb/redirect.c                              | 2000 +
 hw/versatile_i2c.c                             |  107 +
 hw/versatile_pci.c                             |   74 +-
 hw/versatilepb.c                               |  154 +-
 hw/vexpress.c                                  |  457 +-
 hw/vfio_pci.c                                  | 2115 +
 hw/vga-isa-mm.c                                |   26 +-
 hw/vga-isa.c                                   |   37 +-
 hw/vga-pci.c                                   |  184 +-
 hw/vga.c                                       |  684 +-
 hw/vga.h                                       |  159 +
 hw/vga_int.h                                   |   67 +-
 hw/vga_template.h                              |   74 +-
 hw/vhost.c                                     |  226 +-
 hw/vhost.h                                     |    8 +-
 hw/vhost_net.c                                 |   36 +-
 hw/vhost_net.h                                 |    2 +-
 hw/virtex_ml507.c                              |   67 +-
 hw/virtio-balloon.c                            |   28 +-
 hw/virtio-blk.c                                |  191 +-
 hw/virtio-blk.h                                |   22 +-
 hw/virtio-console.c                            |  102 +-
 hw/virtio-net.c                                |  225 +-
 hw/virtio-net.h                                |    1 +
 hw/virtio-pci.c                                |  709 +-
 hw/virtio-pci.h                                |   15 +-
 hw/virtio-rng.c                                |  258 +
 hw/virtio-rng.h                                |   28 +
 hw/virtio-scsi.c                               |  742 +
 hw/virtio-scsi.h                               |   43 +
 hw/virtio-serial-bus.c                         |  268 +-
 hw/virtio-serial.h                             |   85 +-
 hw/virtio.c                                    |  190 +-
 hw/virtio.h                                    |   49 +-
 hw/vmmouse.c                                   |   41 +-
 hw/vmport.c                                    |   60 +-
 hw/vmware_vga.c                                |  550 +-
 hw/vmware_vga.h                                |   19 -
 hw/vt82c686.c                                  |  192 +-
 hw/vt82c686.h                                  |    2 +-
 hw/watchdog.c                                  |    4 +-
 hw/wdt_i6300esb.c                              |   57 +-
 hw/wdt_ib700.c                                 |   28 +-
 hw/wm8750.c                                    |   51 +-
 hw/xen-host-pci-device.c                       |  396 +
 hw/xen-host-pci-device.h                       |   55 +
 hw/xen.h                                       |   10 +-
 hw/xen_apic.c                                  |   95 +
 hw/xen_backend.c                               |    3 +
 hw/xen_backend.h                               |    1 +
 hw/xen_common.h                                |   18 +
 hw/xen_devconfig.c                             |   23 +-
 hw/xen_disk.c                                  |    6 +-
 hw/xen_domainbuild.c                           |    1 -
 hw/xen_machine_pv.c                            |   17 +-
 hw/xen_nic.c                                   |   13 +-
 hw/xen_platform.c                              |  116 +-
 hw/xen_pt.c                                    |  843 +
 hw/xen_pt.h                                    |  302 +
 hw/xen_pt_config_init.c                        | 1882 +
 hw/xen_pt_msi.c                                |  620 +
 hw/xenfb.c                                     |    6 +-
 hw/xgmac.c                                     |  433 +
 hw/xics.c                                      |  220 +-
 hw/xics.h                                      |    3 +-
 hw/xilinx.h                                    |   62 +-
 hw/xilinx_axidma.c                             |  139 +-
 hw/xilinx_axidma.h                             |   39 -
 hw/xilinx_axienet.c                            |  110 +-
 hw/xilinx_ethlite.c                            |   56 +-
 hw/xilinx_intc.c                               |   41 +-
 hw/xilinx_spi.c                                |  385 +
 hw/xilinx_spips.c                              |  575 +
 hw/xilinx_timer.c                              |   74 +-
 hw/xilinx_uartlite.c                           |   32 +-
 hw/xilinx_zynq.c                               |  213 +
 hw/xio3130_downstream.c                        |   78 +-
 hw/xio3130_upstream.c                          |   72 +-
 hw/xtensa/Makefile.objs                        |    5 +
 hw/xtensa_lx60.c                               |   78 +-
 hw/xtensa_pic.c                                |   23 +-
 hw/xtensa_sim.c                                |   52 +-
 hw/z2.c                                        |  105 +-
 hw/zaurus.c                                    |   64 +-
 hw/zynq_slcr.c                                 |  535 +
 hwaddr.h                                       |   24 +
 include/qemu/cpu.h                             |  140 +
 include/qemu/object.h                          |  992 +
 include/qemu/page_cache.h                      |   79 +
 include/qemu/qom-qobject.h                     |   42 +
 include/qemu/ratelimit.h                       |   48 +
 include/qemu/rng-random.h                      |   22 +
 include/qemu/rng.h                             |   93 +
 input.c                                        |  260 +-
 iohandler.c                                    |    8 +-
 ioport-user.c                                  |   60 -
 ioport.c                                       |   43 +-
 ioport.h                                       |    2 +
 iorange.h                                      |    1 +
 iov.c                                          |  331 +-
 iov.h                                          |   88 +-
 json-lexer.c                                   |    1 +
 json-parser.c                                  |  230 +-
 kvm-all.c                                      |  910 +-
 kvm-stub.c                                     |   75 +-
 kvm.h                                          |  167 +-
 libcacard/Makefile                             |   29 +-
 libcacard/card_7816.c                          |    4 +-
 libcacard/card_7816.h                          |    2 +-
 libcacard/vcard.c                              |    1 -
 libcacard/vcard_emul_nss.c                     |   44 +-
 libcacard/vcardt.h                             |    2 +-
 libcacard/vreader.c                            |    1 -
 libcacard/vscard_common.h                      |    2 +-
 libcacard/vscclient.c                          |   22 +-
 linux-aio.c                                    |  229 -
 linux-headers/asm-powerpc/kvm.h                |   12 +-
 linux-headers/asm-powerpc/kvm_para.h           |   47 +-
 linux-headers/asm-s390/kvm.h                   |   18 +-
 linux-headers/asm-s390/kvm_para.h              |    8 +-
 linux-headers/asm-x86/hyperv.h                 |    1 +
 linux-headers/asm-x86/kvm.h                    |   22 +
 linux-headers/asm-x86/kvm_para.h               |    7 +
 linux-headers/linux/kvm.h                      |  154 +-
 linux-headers/linux/kvm_para.h                 |    7 +-
 linux-headers/linux/vfio.h                     |  368 +
 linux-headers/linux/virtio_config.h            |    6 +-
 linux-headers/linux/virtio_ring.h              |   12 +-
 linux-user/Makefile.objs                       |    7 +
 linux-user/alpha/syscall_nr.h                  |    2 +-
 linux-user/alpha/target_signal.h               |    7 +-
 linux-user/arm/nwfpe/Makefile.objs             |    2 +
 linux-user/arm/nwfpe/fpopcode.h                |   34 +-
 linux-user/arm/syscall_nr.h                    |    2 +-
 linux-user/cpu-uname.c                         |    7 +-
 linux-user/elfload.c                           |  312 +-
 linux-user/flatload.c                          |    4 +-
 linux-user/ioctls.h                            |   38 +-
 linux-user/linuxload.c                         |    8 +-
 linux-user/m68k/syscall.h                      |    2 +-
 linux-user/main.c                              |  314 +-
 linux-user/mips64/syscall.h                    |    3 +
 linux-user/mipsn32/syscall.h                   |    3 +
 linux-user/mmap.c                              |   71 +-
 linux-user/openrisc/syscall.h                  |   24 +
 linux-user/openrisc/syscall_nr.h               |  506 +
 linux-user/openrisc/target_signal.h            |   26 +
 linux-user/openrisc/termbits.h                 |  294 +
 linux-user/qemu.h                              |   84 +-
 linux-user/signal.c                            |  549 +-
 linux-user/strace.c                            |   31 +-
 linux-user/strace.list                         |    3 +
 linux-user/syscall.c                           | 1079 +-
 linux-user/syscall_defs.h                      |  325 +-
 linux-user/syscall_types.h                     |   43 +-
 linux-user/x86_64/syscall.h                    |    2 +-
 lm32-dis.c                                     |  361 +
 m68k-dis.c                                     |    2 +-
 m68k-semi.c                                    |  408 -
 main-loop.c                                    |  306 +-
 main-loop.h                                    |   71 +-
 memory-internal.h                              |  141 +
 memory.c                                       | 1005 +-
 memory.h                                       |  509 +-
 memory_mapping-stub.c                          |   33 +
 memory_mapping.c                               |  246 +
 memory_mapping.h                               |   64 +
 migration-exec.c                               |   50 +-
 migration-fd.c                                 |   65 +-
 migration-tcp.c                                |  117 +-
 migration-unix.c                               |  115 +-
 migration.c                                    |  349 +-
 migration.h                                    |   72 +-
 module.c                                       |    3 +-
 module.h                                       |    4 +-
 monitor.c                                      | 2107 +-
 monitor.h                                      |   37 +-
 nbd.c                                          | 1000 +-
 nbd.h                                          |   33 +-
 net.c                                          | 1198 +-
 net.h                                          |  126 +-
 net/Makefile.objs                              |   12 +
 net/checksum.c                                 |    2 +-
 net/clients.h                                  |   55 +
 net/dump.c                                     |   60 +-
 net/dump.h                                     |   33 -
 net/hub.c                                      |  340 +
 net/hub.h                                      |   27 +
 net/queue.c                                    |   68 +-
 net/queue.h                                    |   27 +-
 net/slirp.c                                    |  228 +-
 net/slirp.h                                    |    6 +-
 net/socket.c                                   |  477 +-
 net/socket.h                                   |   33 -
 net/tap-aix.c                                  |    2 +-
 net/tap-bsd.c                                  |    8 +-
 net/tap-haiku.c                                |    2 +-
 net/tap-linux.c                                |    9 +-
 net/tap-solaris.c                              |    4 +-
 net/tap-win32.c                                |   49 +-
 net/tap.c                                      |  349 +-
 net/tap.h                                      |   22 +-
 net/vde.c                                      |   35 +-
 net/vde.h                                      |   36 -
 notify.c                                       |   12 +-
 notify.h                                       |    8 +-
 os-posix.c                                     |   52 +-
 os-win32.c                                     |   20 +-
 osdep.c                                        |  234 +
 osdep.h                                        |   44 +-
 oslib-posix.c                                  |   18 +
 oslib-win32.c                                  |   32 +
 page_cache.c                                   |  218 +
 pc-bios/README                                 |    4 +-
 pc-bios/bamboo.dtb                             |  Bin 3179 -> 3211 bytes
 pc-bios/bamboo.dts                             |  128 +-
 pc-bios/bios.bin                               |  Bin 131072 -> 131072 bytes
 pc-bios/keymaps/fi                             |    2 -
 pc-bios/keymaps/is                             |    2 +-
 pc-bios/kvmvapic.bin                           |  Bin 0 -> 9216 bytes
 pc-bios/mpc8544ds.dtb                          |  Bin 2028 -> 0 bytes
 pc-bios/mpc8544ds.dts                          |  119 -
 pc-bios/ohw.diff                               |    2 +-
 pc-bios/openbios-ppc                           |  Bin 729876 -> 729908 bytes
 pc-bios/openbios-sparc32                       |  Bin 381484 -> 381764 bytes
 pc-bios/openbios-sparc64                       |  Bin 1598328 -> 1598648 bytes
 pc-bios/optionrom/Makefile                     |    7 +-
 pc-bios/optionrom/kvmvapic.S                   |  335 +
 pc-bios/optionrom/multiboot.S                  |    2 +-
 pc-bios/optionrom/optionrom.h                  |    3 +-
 pc-bios/qemu-icon.bmp                          |  Bin 0 -> 630 bytes
 pc-bios/slof.bin                               |  Bin 738744 -> 878640 bytes
 pflib.c                                        |  213 -
 pflib.h                                        |   20 -
 pixman                                         |    1 +
 poison.h                                       |    3 +-
 posix-aio-compat.c                             |  696 -
 ppc-dis.c                                      |    2 +-
 qapi-schema-guest.json                         |  360 +-
 qapi-schema-test.json                          |   18 +-
 qapi-schema.json                               | 2180 +-
 qapi/Makefile.objs                             |    5 +
 qapi/opts-visitor.c                            |  427 +
 qapi/opts-visitor.h                            |   31 +
 qapi/qapi-types-core.h                         |    4 +-
 qapi/qapi-visit-core.c                         |  207 +-
 qapi/qapi-visit-core.h                         |   19 +
 qapi/qapi-visit-impl.h                         |   23 +
 qapi/qmp-core.h                                |   16 +-
 qapi/qmp-dispatch.c                            |   23 +-
 qapi/qmp-input-visitor.c                       |  187 +-
 qapi/qmp-input-visitor.h                       |    2 +
 qapi/qmp-output-visitor.c                      |   30 +-
 qapi/qmp-registry.c                            |   70 +-
 qapi/string-input-visitor.c                    |  138 +
 qapi/string-input-visitor.h                    |   25 +
 qapi/string-output-visitor.c                   |   89 +
 qapi/string-output-visitor.h                   |   26 +
 qemu-aio.h                                     |  232 +-
 qemu-barrier.h                                 |   37 +-
 qemu-bridge-helper.c                           |  428 +
 qemu-char.c                                    |  232 +-
 qemu-char.h                                    |    5 +-
 qemu-common.h                                  |  173 +-
 qemu-config.c                                  |  216 +-
 qemu-config.h                                  |   10 +
 qemu-coroutine-int.h                           |    2 +-
 qemu-coroutine-io.c                            |   65 +
 qemu-coroutine-lock.c                          |   25 +-
 qemu-coroutine-sleep.c                         |   39 +
 qemu-coroutine.h                               |   20 +
 qemu-doc.texi                                  |  335 +-
 qemu-error.c                                   |    5 +
 qemu-error.h                                   |    1 +
 qemu-file.h                                    |  241 +
 qemu-ga.c                                      |  830 +-
 qemu-img-cmds.hx                               |    8 +-
 qemu-img.c                                     |  575 +-
 qemu-img.texi                                  |   86 +-
 qemu-io.c                                      |  228 +-
 qemu-log.c                                     |  167 +
 qemu-log.h                                     |  157 +-
 qemu-nbd.c                                     |  300 +-
 qemu-nbd.texi                                  |    2 +-
 qemu-option-internal.h                         |   53 +
 qemu-option.c                                  |  268 +-
 qemu-option.h                                  |   26 +-
 qemu-options-wrapper.h                         |   41 +
 qemu-options.h                                 |    9 +-
 qemu-options.hx                                |  655 +-
 qemu-os-posix.h                                |    2 +
 qemu-os-win32.h                                |   47 +-
 qemu-pixman.c                                  |   78 +
 qemu-pixman.h                                  |   39 +
 qemu-queue.h                                   |  194 +-
 qemu-seccomp.c                                 |  141 +
 qemu-seccomp.h                                 |   22 +
 qemu-sockets.c                                 |  692 +-
 qemu-tech.texi                                 |   15 +-
 qemu-thread-posix.c                            |  187 +-
 qemu-thread-posix.h                            |   11 +
 qemu-thread-win32.c                            |  162 +-
 qemu-thread-win32.h                            |   12 +-
 qemu-thread.h                                  |   18 +-
 qemu-timer.c                                   |  233 +-
 qemu-timer.h                                   |   35 +-
 qemu-tls.h                                     |    4 +-
 qemu-tool.c                                    |   54 +-
 qemu-user.c                                    |   37 +
 qemu_socket.h                                  |   45 +-
 qerror.c                                       |  447 +-
 qerror.h                                       |  222 +-
 qga/Makefile.objs                              |    5 +
 qga/channel-posix.c                            |  264 +
 qga/channel-win32.c                            |  344 +
 qga/channel.h                                  |   33 +
 qga/commands-posix.c                           | 1001 +
 qga/commands-win32.c                           |  284 +
 qga/commands.c                                 |   79 +
 qga/guest-agent-commands.c                     |  561 -
 qga/guest-agent-core.h                         |   13 +-
 qga/service-win32.c                            |  114 +
 qga/service-win32.h                            |   30 +
 qjson.h                                        |    1 +
 qlist.c                                        |   13 +
 qlist.h                                        |    1 +
 qmp-commands.hx                                |  858 +-
 qmp.c                                          |  404 +-
 qobject.h                                      |    2 +-
 qom/Makefile.objs                              |    4 +
 qom/container.c                                |   52 +
 qom/cpu.c                                      |   58 +
 qom/object.c                                   | 1271 +
 qom/qom-qobject.c                              |   44 +
 qtest.c                                        |  444 +
 qtest.h                                        |   53 +
 readline.c                                     |    3 +
 roms/Makefile                                  |   27 +
 roms/SLOF                                      |    2 +-
 roms/config.seabios                            |    1 +
 roms/config.vga.cirrus                         |    3 +
 roms/config.vga.isavga                         |    3 +
 roms/config.vga.qxl                            |    6 +
 roms/config.vga.stdvga                         |    3 +
 roms/config.vga.vmware                         |    6 +
 roms/configure-seabios.sh                      |    5 +
 roms/openbios                                  |    2 +-
 roms/seabios                                   |    2 +-
 rules.mak                                      |   51 +-
 savevm.c                                       |  674 +-
 scripts/analyse-9p-simpletrace.py              |   75 +-
 scripts/check-qerror.sh                        |   22 +
 scripts/checkpatch.pl                          |   79 +-
 scripts/create_config                          |   14 +-
 scripts/gtester-cat                            |   26 +
 scripts/hxtool                                 |    3 +
 scripts/kvm/kvm_flightrecorder                 |  126 +
 scripts/kvm/kvm_stat                           |   37 +-
 scripts/kvm/vmxcap                             |   13 +
 scripts/make-release                           |   24 +
 scripts/qapi-commands.py                       |   56 +-
 scripts/qapi-types.py                          |   68 +-
 scripts/qapi-visit.py                          |  180 +-
 scripts/qapi.py                                |   62 +-
 scripts/qemu-binfmt-conf.sh                    |    1 +
 scripts/qemu-gdb.py                            |   89 +
 scripts/qtest                                  |    5 +
 scripts/signrom.py                             |   40 +
 scripts/signrom.sh                             |   45 -
 scripts/simpletrace.py                         |  116 +-
 scripts/texi2pod.pl                            |    9 +
 scripts/tracetool                              |  643 -
 scripts/tracetool.py                           |  138 +
 scripts/tracetool/__init__.py                  |  274 +
 scripts/tracetool/backend/__init__.py          |  115 +
 scripts/tracetool/backend/dtrace.py            |  106 +
 scripts/tracetool/backend/simple.py            |  107 +
 scripts/tracetool/backend/stderr.py            |   56 +
 scripts/tracetool/backend/ust.py               |   90 +
 scripts/tracetool/format/__init__.py           |  103 +
 scripts/tracetool/format/c.py                  |   20 +
 scripts/tracetool/format/d.py                  |   20 +
 scripts/tracetool/format/h.py                  |   45 +
 scripts/tracetool/format/stap.py               |   20 +
 scripts/update-linux-headers.sh                |   24 +-
 slirp/Makefile.objs                            |    3 +
 slirp/arp_table.c                              |    4 +-
 slirp/bootp.c                                  |   15 +-
 slirp/cksum.c                                  |    2 +-
 slirp/dnssearch.c                              |  314 +
 slirp/if.c                                     |  144 +-
 slirp/if.h                                     |    2 -
 slirp/ip.h                                     |   20 +-
 slirp/ip_icmp.c                                |   12 +
 slirp/ip_icmp.h                                |    5 +-
 slirp/ip_input.c                               |    8 +-
 slirp/libslirp.h                               |    4 +-
 slirp/main.h                                   |    1 +
 slirp/mbuf.c                                   |   21 +
 slirp/mbuf.h                                   |    6 +
 slirp/misc.c                                   |  148 +-
 slirp/misc.h                                   |    1 -
 slirp/sbuf.c                                   |    6 +
 slirp/slirp.c                                  |   21 +-
 slirp/slirp.h                                  |   23 +-
 slirp/tcp.h                                    |   34 +-
 slirp/tcp_input.c                              |    2 -
 slirp/tcp_output.c                             |    1 +
 slirp/tcp_subr.c                               |   26 +-
 slirp/tftp.c                                   |  104 +-
 slirp/tftp.h                                   |    2 +
 slirp/udp.c                                    |    9 +-
 slirp/udp.h                                    |    1 +
 softmmu-semi.h                                 |   17 +-
 softmmu_defs.h                                 |   41 +-
 softmmu_header.h                               |   52 +-
 softmmu_template.h                             |  169 +-
 sparc-dis.c                                    |    2 +-
 spice-qemu-char.c                              |   11 +-
 stubs/Makefile.objs                            |    8 +
 stubs/arch-query-cpu-def.c                     |    9 +
 stubs/fd-register.c                            |    6 +
 stubs/fdset-add-fd.c                           |    7 +
 stubs/fdset-find-fd.c                          |    7 +
 stubs/fdset-get-fd.c                           |    7 +
 stubs/fdset-remove-fd.c                        |    7 +
 stubs/get-fd.c                                 |    8 +
 stubs/set-fd-handler.c                         |   11 +
 sysconfigs/target/target-x86_64.conf           |   86 -
 sysemu.h                                       |   51 +-
 target-alpha/Makefile.objs                     |    3 +
 target-alpha/STATUS                            |    4 +-
 target-alpha/cpu-qom.h                         |   71 +
 target-alpha/cpu.c                             |   58 +
 target-alpha/cpu.h                             |   53 +-
 target-alpha/fpu_helper.c                      |  822 +
 target-alpha/helper.c                          |   76 +-
 target-alpha/helper.h                          |  213 +-
 target-alpha/int_helper.c                      |  319 +
 target-alpha/machine.c                         |   44 +-
 target-alpha/mem_helper.c                      |  151 +
 target-alpha/op_helper.c                       | 1379 -
 target-alpha/sys_helper.c                      |   87 +
 target-alpha/translate.c                       |  408 +-
 target-arm/Makefile.objs                       |    4 +
 target-arm/arm-semi.c                          |  555 +
 target-arm/cpu-qom.h                           |  113 +
 target-arm/cpu.c                               |  805 +
 target-arm/cpu.h                               |  338 +-
 target-arm/helper.c                            | 3032 +-
 target-arm/helper.h                            |   83 +-
 target-arm/iwmmxt_helper.c                     |   66 +-
 target-arm/machine.c                           |   20 +-
 target-arm/neon_helper.c                       |  123 +-
 target-arm/op_helper.c                         |  170 +-
 target-arm/translate.c                         | 1085 +-
 target-cris/Makefile.objs                      |    2 +
 target-cris/cpu-qom.h                          |   70 +
 target-cris/cpu.c                              |   90 +
 target-cris/cpu.h                              |   37 +-
 target-cris/helper.c                           |   30 +-
 target-cris/helper.h                           |   39 +-
 target-cris/mmu.c                              |   19 +-
 target-cris/mmu.h                              |    6 +-
 target-cris/op_helper.c                        |  107 +-
 target-cris/translate.c                        | 5688 ++--
 target-cris/translate_v10.c                    |  126 +-
 target-i386/Makefile.objs                      |    8 +
 target-i386/TODO                               |    1 -
 target-i386/arch_dump.c                        |  449 +
 target-i386/arch_memory_mapping.c              |  272 +
 target-i386/cc_helper.c                        |  390 +
 target-i386/cc_helper_template.h               |  277 +
 target-i386/cpu-qom.h                          |   79 +
 target-i386/cpu.c                              | 2137 +
 target-i386/cpu.h                              |  227 +-
 target-i386/cpuid.c                            | 1322 -
 target-i386/excp_helper.c                      |  129 +
 target-i386/fpu_helper.c                       | 1289 +
 target-i386/helper.c                           |  369 +-
 target-i386/helper.h                           |  357 +-
 target-i386/helper_template.h                  |  334 -
 target-i386/hyperv.c                           |   64 +
 target-i386/hyperv.h                           |   45 +
 target-i386/int_helper.c                       |  500 +
 target-i386/ioport-user.c                      |   60 +
 target-i386/kvm-stub.c                         |   18 +
 target-i386/kvm.c                              |  646 +-
 target-i386/kvm_i386.h                         |   38 +
 target-i386/machine.c                          |  201 +-
 target-i386/mem_helper.c                       |  155 +
 target-i386/misc_helper.c                      |  602 +
 target-i386/op_helper.c                        | 5881 ---
 target-i386/ops_sse.h                          | 1274 +-
 target-i386/ops_sse_header.h                   |  334 +-
 target-i386/seg_helper.c                       | 2471 +
 target-i386/shift_helper_template.h            |  112 +
 target-i386/smm_helper.c                       |  301 +
 target-i386/svm_helper.c                       |  715 +
 target-i386/translate.c                        | 1449 +-
 target-lm32/Makefile.objs                      |    2 +
 target-lm32/cpu-qom.h                          |   71 +
 target-lm32/cpu.c                              |   81 +
 target-lm32/cpu.h                              |   49 +-
 target-lm32/helper.c                           |   42 +-
 target-lm32/helper.h                           |   20 +-
 target-lm32/machine.c                          |   22 +-
 target-lm32/op_helper.c                        |   37 +-
 target-lm32/translate.c                        |   91 +-
 target-m68k/Makefile.objs                      |    3 +
 target-m68k/cpu-qom.h                          |   70 +
 target-m68k/cpu.c                              |  170 +
 target-m68k/cpu.h                              |   24 +-
 target-m68k/helper.c                           |  245 +-
 target-m68k/helpers.h                          |    2 +-
 target-m68k/m68k-semi.c                        |  465 +
 target-m68k/op_helper.c                        |   83 +-
 target-m68k/translate.c                        |  322 +-
 target-microblaze/Makefile.objs                |    2 +
 target-microblaze/cpu-qom.h                    |   70 +
 target-microblaze/cpu.c                        |  120 +
 target-microblaze/cpu.h                        |   62 +-
 target-microblaze/helper.c                     |   18 +-
 target-microblaze/helper.h                     |   56 +-
 target-microblaze/mmu.c                        |   13 +-
 target-microblaze/mmu.h                        |    6 +-
 target-microblaze/op_helper.c                  |  136 +-
 target-microblaze/translate.c                  |  331 +-
 target-mips/Makefile.objs                      |    2 +
 target-mips/TODO                               |    7 +-
 target-mips/cpu-qom.h                          |   74 +
 target-mips/cpu.c                              |   69 +
 target-mips/cpu.h                              |  176 +-
 target-mips/dsp_helper.c                       | 4033 ++
 target-mips/helper.c                           |   38 +-
 target-mips/helper.h                           |  838 +-
 target-mips/lmi_helper.c                       |  744 +
 target-mips/machine.c                          |    6 +-
 target-mips/op_helper.c                        | 1759 +-
 target-mips/translate.c                        | 5123 ++-
 target-mips/translate_init.c                   |   52 +
 target-openrisc/Makefile.objs                  |    4 +
 target-openrisc/cpu.c                          |  220 +
 target-openrisc/cpu.h                          |  460 +
 target-openrisc/exception.c                    |   27 +
 target-openrisc/exception.h                    |   28 +
 target-openrisc/exception_helper.c             |   29 +
 target-openrisc/fpu_helper.c                   |  300 +
 target-openrisc/helper.h                       |   70 +
 target-openrisc/int_helper.c                   |   79 +
 target-openrisc/interrupt.c                    |   74 +
 target-openrisc/interrupt_helper.c             |   57 +
 target-openrisc/machine.c                      |   47 +
 target-openrisc/mmu.c                          |  243 +
 target-openrisc/mmu_helper.c                   |   63 +
 target-openrisc/sys_helper.c                   |  287 +
 target-openrisc/translate.c                    | 1836 +
 target-ppc/Makefile.objs                       |   12 +
 target-ppc/cpu-qom.h                           |   77 +
 target-ppc/cpu.h                               |  244 +-
 target-ppc/excp_helper.c                       |  973 +
 target-ppc/fpu_helper.c                        | 1740 +
 target-ppc/helper.c                            | 3183 +--
 target-ppc/helper.h                            |  592 +-
 target-ppc/int_helper.c                        | 1483 +
 target-ppc/kvm.c                               |  420 +-
 target-ppc/kvm_ppc.c                           |    2 +-
 target-ppc/kvm_ppc.h                           |   41 +-
 target-ppc/machine.c                           |   24 +-
 target-ppc/mem_helper.c                        |  295 +
 target-ppc/mfrom_table_gen.c                   |    2 +-
 target-ppc/misc_helper.c                       |  124 +
 target-ppc/mmu_helper.c                        | 3323 ++
 target-ppc/mpic_helper.c                       |   35 +
 target-ppc/op_helper.c                         | 4413 --
 target-ppc/timebase_helper.c                   |  159 +
 target-ppc/translate.c                         |  712 +-
 target-ppc/translate_init.c                    |  627 +-
 target-s390x/Makefile.objs                     |    4 +
 target-s390x/cc_helper.c                       |  550 +
 target-s390x/cpu-qom.h                         |   71 +
 target-s390x/cpu.c                             |   96 +
 target-s390x/cpu.h                             |   95 +-
 target-s390x/fpu_helper.c                      |  843 +
 target-s390x/helper.c                          |  182 +-
 target-s390x/helper.h                          |  152 +
 target-s390x/helpers.h                         |  152 -
 target-s390x/int_helper.c                      |  201 +
 target-s390x/interrupt.c                       |   29 +
 target-s390x/kvm.c                             |  241 +-
 target-s390x/mem_helper.c                      | 1203 +
 target-s390x/misc_helper.c                     |  387 +
 target-s390x/op_helper.c                       | 3026 --
 target-s390x/translate.c                       |  691 +-
 target-sh4/Makefile.objs                       |    2 +
 target-sh4/cpu-qom.h                           |   70 +
 target-sh4/cpu.c                               |   90 +
 target-sh4/cpu.h                               |   44 +-
 target-sh4/helper.c                            |   49 +-
 target-sh4/helper.h                            |   86 +-
 target-sh4/op_helper.c                         |  285 +-
 target-sh4/translate.c                         |  392 +-
 target-sparc/Makefile.objs                     |    6 +
 target-sparc/TODO                              |    2 +-
 target-sparc/cc_helper.c                       |   66 +-
 target-sparc/cpu-qom.h                         |   75 +
 target-sparc/cpu.c                             |  895 +
 target-sparc/cpu.h                             |   92 +-
 target-sparc/cpu_init.c                        |  848 -
 target-sparc/fop_helper.c                      |  131 +-
 target-sparc/helper.c                          |  102 +-
 target-sparc/helper.h                          |   78 +-
 target-sparc/int32_helper.c                    |   18 +-
 target-sparc/int64_helper.c                    |   25 +-
 target-sparc/ldst_helper.c                     |  559 +-
 target-sparc/machine.c                         |    4 +-
 target-sparc/mmu_helper.c                      |   80 +-
 target-sparc/op_helper.c                       |   74 -
 target-sparc/translate.c                       | 2516 +-
 target-sparc/vis_helper.c                      |    2 +-
 target-sparc/win_helper.c                      |   58 +-
 target-unicore32/Makefile.objs                 |    4 +
 target-unicore32/cpu-qom.h                     |   59 +
 target-unicore32/cpu.c                         |  113 +
 target-unicore32/cpu.h                         |   58 +-
 target-unicore32/helper.c                      |  580 +-
 target-unicore32/helper.h                      |   46 +-
 target-unicore32/machine.c                     |   23 +
 target-unicore32/op_helper.c                   |  100 +-
 target-unicore32/softmmu.c                     |  267 +
 target-unicore32/translate.c                   |  274 +-
 target-unicore32/ucf64_helper.c                |  345 +
 target-xtensa/Makefile.objs                    |    6 +
 target-xtensa/core-dc232b.c                    |   29 +-
 target-xtensa/core-dc233c.c                    |   55 +
 target-xtensa/core-dc233c/core-isa.h           |  474 +
 target-xtensa/core-dc233c/gdb-config.c         |  145 +
 target-xtensa/core-fsf.c                       |   29 +-
 target-xtensa/cpu-qom.h                        |   80 +
 target-xtensa/cpu.c                            |   88 +
 target-xtensa/cpu.h                            |  120 +-
 target-xtensa/helper.c                         |  211 +-
 target-xtensa/helper.h                         |   60 +
 target-xtensa/helpers.h                        |   32 -
 target-xtensa/op_helper.c                      |  453 +-
 target-xtensa/overlay_tool.h                   |   24 +-
 target-xtensa/translate.c                      |  612 +-
 target-xtensa/xtensa-semi.c                    |  321 +
 targphys.h                                     |   21 -
 tcg/README                                     |   46 +-
 tcg/arm/tcg-target.c                           |  370 +-
 tcg/arm/tcg-target.h                           |    9 +-
 tcg/hppa/tcg-target.c                          |  334 +-
 tcg/hppa/tcg-target.h                          |    8 +-
 tcg/i386/tcg-target.c                          |  914 +-
 tcg/i386/tcg-target.h                          |   22 +-
 tcg/ia64/tcg-target.c                          |  238 +-
 tcg/ia64/tcg-target.h                          |   16 +-
 tcg/mips/tcg-target.c                          |  517 +-
 tcg/mips/tcg-target.h                          |   31 +-
 tcg/optimize.c                                 |  688 +-
 tcg/ppc/tcg-target.c                           |  625 +-
 tcg/ppc/tcg-target.h                           |    5 +-
 tcg/ppc64/tcg-target.c                         |   77 +-
 tcg/ppc64/tcg-target.h                         |    3 +-
 tcg/s390/tcg-target.c                          |   65 +-
 tcg/s390/tcg-target.h                          |    8 +-
 tcg/sparc/tcg-target.c                         | 1621 +-
 tcg/sparc/tcg-target.h                         |   42 +-
 tcg/tcg-op.h                                   |  689 +-
 tcg/tcg-opc.h                                  |   34 +-
 tcg/tcg.c                                      | 1073 +-
 tcg/tcg.h                                      |  175 +-
 tcg/tci/tcg-target.c                           |   48 +-
 tcg/tci/tcg-target.h                           |   14 +-
 tci.c                                          |   74 +-
 test-coroutine.c                               |  192 -
 test-qmp-commands.c                            |  142 -
 test-visitor.c                                 |  338 -
 tests/.gitignore                               |   13 +
 tests/Makefile                                 |  302 +-
 tests/alpha/Makefile                           |   35 -
 tests/alpha/crt.s                              |   26 -
 tests/alpha/hello-alpha.c                      |    5 -
 tests/alpha/test-cond.c                        |   87 -
 tests/alpha/test-ovf.c                         |   29 -
 tests/check-block.sh                           |   21 +
 tests/check-qdict.c                            |  378 +
 tests/check-qfloat.c                           |   53 +
 tests/check-qint.c                             |   87 +
 tests/check-qjson.c                            |  781 +
 tests/check-qlist.c                            |  127 +
 tests/check-qstring.c                          |  107 +
 tests/cris/.gdbinit                            |   11 -
 tests/cris/Makefile                            |  155 -
 tests/cris/README                              |    1 -
 tests/cris/check_abs.c                         |   40 -
 tests/cris/check_addc.c                        |   58 -
 tests/cris/check_addcm.c                       |   85 -
 tests/cris/check_addi.s                        |   57 -
 tests/cris/check_addiv32.s                     |   62 -
 tests/cris/check_addm.s                        |   96 -
 tests/cris/check_addo.c                        |  125 -
 tests/cris/check_addoq.c                       |   44 -
 tests/cris/check_addq.s                        |   47 -
 tests/cris/check_addr.s                        |   96 -
 tests/cris/check_addxc.s                       |   91 -
 tests/cris/check_addxm.s                       |  106 -
 tests/cris/check_addxr.s                       |   96 -
 tests/cris/check_andc.s                        |   80 -
 tests/cris/check_andm.s                        |   90 -
 tests/cris/check_andq.s                        |   46 -
 tests/cris/check_andr.s                        |   95 -
 tests/cris/check_asr.s                         |  230 -
 tests/cris/check_ba.s                          |   93 -
 tests/cris/check_bas.s                         |  102 -
 tests/cris/check_bcc.s                         |  197 -
 tests/cris/check_bound.c                       |  142 -
 tests/cris/check_boundc.s                      |  101 -
 tests/cris/check_boundr.s                      |  125 -
 tests/cris/check_btst.s                        |   96 -
 tests/cris/check_clearfv32.s                   |   19 -
 tests/cris/check_clrjmp1.s                     |   36 -
 tests/cris/check_cmp-2.s                       |   15 -
 tests/cris/check_cmpc.s                        |   86 -
 tests/cris/check_cmpm.s                        |   96 -
 tests/cris/check_cmpq.s                        |   75 -
 tests/cris/check_cmpr.s                        |  102 -
 tests/cris/check_cmpxc.s                       |   92 -
 tests/cris/check_cmpxm.s                       |  106 -
 tests/cris/check_dstep.s                       |   42 -
 tests/cris/check_ftag.c                        |   37 -
 tests/cris/check_gcctorture_pr28634-1.c        |   15 -
 tests/cris/check_gcctorture_pr28634.c          |   15 -
 tests/cris/check_glibc_kernelversion.c         |  116 -
 tests/cris/check_hello.c                       |    7 -
 tests/cris/check_int64.c                       |   47 -
 tests/cris/check_jsr.s                         |   85 -
 tests/cris/check_lapc.s                        |   78 -
 tests/cris/check_lsl.s                         |  217 -
 tests/cris/check_lsr.s                         |  218 -
 tests/cris/check_lz.c                          |   49 -
 tests/cris/check_mapbrk.c                      |   39 -
 tests/cris/check_mcp.s                         |   49 -
 tests/cris/check_mmap1.c                       |   48 -
 tests/cris/check_mmap2.c                       |   48 -
 tests/cris/check_mmap3.c                       |   33 -
 tests/cris/check_movdelsr1.s                   |   33 -
 tests/cris/check_movecr.s                      |   37 -
 tests/cris/check_movei.s                       |   50 -
 tests/cris/check_movemr.s                      |   78 -
 tests/cris/check_movemrv32.s                   |   96 -
 tests/cris/check_moveq.c                       |   51 -
 tests/cris/check_mover.s                       |   28 -
 tests/cris/check_moverm.s                      |   45 -
 tests/cris/check_movmp.s                       |  131 -
 tests/cris/check_movpmv32.s                    |   35 -
 tests/cris/check_movpr.s                       |   28 -
 tests/cris/check_movprv32.s                    |   21 -
 tests/cris/check_movscr.s                      |   29 -
 tests/cris/check_movsm.s                       |   44 -
 tests/cris/check_movsr.s                       |   46 -
 tests/cris/check_movucr.s                      |   33 -
 tests/cris/check_movum.s                       |   40 -
 tests/cris/check_movur.s                       |   45 -
 tests/cris/check_mulv32.s                      |   51 -
 tests/cris/check_mulx.s                        |  246 -
 tests/cris/check_neg.s                         |  104 -
 tests/cris/check_not.s                         |   31 -
 tests/cris/check_openpf1.c                     |   38 -
 tests/cris/check_openpf2.c                     |   16 -
 tests/cris/check_openpf3.c                     |   49 -
 tests/cris/check_openpf4.c                     |    5 -
 tests/cris/check_openpf5.c                     |   56 -
 tests/cris/check_orc.s                         |   71 -
 tests/cris/check_orm.s                         |   75 -
 tests/cris/check_orq.s                         |   41 -
 tests/cris/check_orr.s                         |   84 -
 tests/cris/check_ret.s                         |   25 -
 tests/cris/check_scc.s                         |   95 -
 tests/cris/check_settls1.c                     |   45 -
 tests/cris/check_sigalrm.c                     |   26 -
 tests/cris/check_stat1.c                       |   16 -
 tests/cris/check_stat2.c                       |   20 -
 tests/cris/check_stat3.c                       |   25 -
 tests/cris/check_stat4.c                       |   27 -
 tests/cris/check_subc.s                        |   87 -
 tests/cris/check_subm.s                        |   96 -
 tests/cris/check_subq.s                        |   52 -
 tests/cris/check_subr.s                        |  102 -
 tests/cris/check_swap.c                        |   76 -
 tests/cris/check_time1.c                       |   46 -
 tests/cris/check_time2.c                       |   18 -
 tests/cris/check_xarith.s                      |   72 -
 tests/cris/crisutils.h                         |   71 -
 tests/cris/crt.s                               |   13 -
 tests/cris/sys.c                               |   51 -
 tests/cris/sys.h                               |   16 -
 tests/cris/testutils.inc                       |  117 -
 tests/fdc-test.c                               |  563 +
 tests/hd-geo-test.c                            |  428 +
 tests/hello-arm.c                              |  113 -
 tests/hello-i386.c                             |   26 -
 tests/hello-mips.c                             |   64 -
 tests/libqtest.c                               |  478 +
 tests/libqtest.h                               |  352 +
 tests/linux-test.c                             |  537 -
 tests/lm32/Makefile                            |  102 -
 tests/lm32/crt.S                               |   84 -
 tests/lm32/linker.ld                           |   55 -
 tests/lm32/macros.inc                          |   79 -
 tests/lm32/test_add.S                          |   75 -
 tests/lm32/test_addi.S                         |   56 -
 tests/lm32/test_and.S                          |   45 -
 tests/lm32/test_andhi.S                        |   35 -
 tests/lm32/test_andi.S                         |   35 -
 tests/lm32/test_b.S                            |   13 -
 tests/lm32/test_be.S                           |   48 -
 tests/lm32/test_bg.S                           |   78 -
 tests/lm32/test_bge.S                          |   78 -
 tests/lm32/test_bgeu.S                         |   78 -
 tests/lm32/test_bgu.S                          |   78 -
 tests/lm32/test_bi.S                           |   23 -
 tests/lm32/test_bne.S                          |   48 -
 tests/lm32/test_break.S                        |   20 -
 tests/lm32/test_bret.S                         |   38 -
 tests/lm32/test_call.S                         |   16 -
 tests/lm32/test_calli.S                        |   15 -
 tests/lm32/test_cmpe.S                         |   40 -
 tests/lm32/test_cmpei.S                        |   35 -
 tests/lm32/test_cmpg.S                         |   64 -
 tests/lm32/test_cmpge.S                        |   64 -
 tests/lm32/test_cmpgei.S                       |   55 -
 tests/lm32/test_cmpgeu.S                       |   64 -
 tests/lm32/test_cmpgeui.S                      |   55 -
 tests/lm32/test_cmpgi.S                        |   55 -
 tests/lm32/test_cmpgu.S                        |   64 -
 tests/lm32/test_cmpgui.S                       |   55 -
 tests/lm32/test_cmpne.S                        |   40 -
 tests/lm32/test_cmpnei.S                       |   35 -
 tests/lm32/test_divu.S                         |   29 -
 tests/lm32/test_eret.S                         |   38 -
 tests/lm32/test_lb.S                           |   45 -
 tests/lm32/test_lbu.S                          |   45 -
 tests/lm32/test_lh.S                           |   45 -
 tests/lm32/test_lhu.S                          |   45 -
 tests/lm32/test_lw.S                           |   30 -
 tests/lm32/test_modu.S                         |   35 -
 tests/lm32/test_mul.S                          |   70 -
 tests/lm32/test_muli.S                         |   45 -
 tests/lm32/test_nor.S                          |   51 -
 tests/lm32/test_nori.S                         |   35 -
 tests/lm32/test_or.S                           |   51 -
 tests/lm32/test_orhi.S                         |   35 -
 tests/lm32/test_ori.S                          |   35 -
 tests/lm32/test_ret.S                          |   14 -
 tests/lm32/test_sb.S                           |   30 -
 tests/lm32/test_scall.S                        |   20 -
 tests/lm32/test_sextb.S                        |   20 -
 tests/lm32/test_sexth.S                        |   20 -
 tests/lm32/test_sh.S                           |   30 -
 tests/lm32/test_sl.S                           |   45 -
 tests/lm32/test_sli.S                          |   30 -
 tests/lm32/test_sr.S                           |   57 -
 tests/lm32/test_sri.S                          |   40 -
 tests/lm32/test_sru.S                          |   57 -
 tests/lm32/test_srui.S                         |   40 -
 tests/lm32/test_sub.S                          |   75 -
 tests/lm32/test_sw.S                           |   35 -
 tests/lm32/test_xnor.S                         |   51 -
 tests/lm32/test_xnori.S                        |   35 -
 tests/lm32/test_xor.S                          |   51 -
 tests/lm32/test_xori.S                         |   35 -
 tests/m48t59-test.c                            |  259 +
 tests/pi_10.com                                |  Bin 54 -> 0 bytes
 tests/qemu-iotests-quick.sh                    |   17 +
 tests/qemu-iotests/.gitignore                  |    7 +
 tests/qemu-iotests/001                         |   65 +
 tests/qemu-iotests/001.out                     |   15 +
 tests/qemu-iotests/002                         |   72 +
 tests/qemu-iotests/002.out                     |   23 +
 tests/qemu-iotests/003                         |   78 +
 tests/qemu-iotests/003.out                     |   23 +
 tests/qemu-iotests/004                         |  104 +
 tests/qemu-iotests/004.out                     |   41 +
 tests/qemu-iotests/005                         |   73 +
 tests/qemu-iotests/005.out                     |   13 +
 tests/qemu-iotests/006                         |   54 +
 tests/qemu-iotests/006.out                     |    6 +
 tests/qemu-iotests/007                         |   67 +
 tests/qemu-iotests/007.out                     |   18 +
 tests/qemu-iotests/008                         |   65 +
 tests/qemu-iotests/008.out                     |   15 +
 tests/qemu-iotests/009                         |   69 +
 tests/qemu-iotests/009.out                     |   18 +
 tests/qemu-iotests/010                         |   71 +
 tests/qemu-iotests/010.out                     |   22 +
 tests/qemu-iotests/011                         |   75 +
 tests/qemu-iotests/011.out                     |   50 +
 tests/qemu-iotests/012                         |   62 +
 tests/qemu-iotests/012.out                     |    9 +
 tests/qemu-iotests/013                         |   98 +
 tests/qemu-iotests/013.out                     |43983 ++++++++++++++++
 tests/qemu-iotests/014                         |   77 +
 tests/qemu-iotests/014.out                     |64074 ++++++++++++++++++++++++
 tests/qemu-iotests/015                         |   85 +
 tests/qemu-iotests/015.out                     |   20 +
 tests/qemu-iotests/016                         |   70 +
 tests/qemu-iotests/016.out                     |   23 +
 tests/qemu-iotests/017                         |  101 +
 tests/qemu-iotests/017.out                     | 1077 +
 tests/qemu-iotests/018                         |  104 +
 tests/qemu-iotests/018.out                     | 1077 +
 tests/qemu-iotests/019                         |  129 +
 tests/qemu-iotests/019.out                     | 1628 +
 tests/qemu-iotests/020                         |  106 +
 tests/qemu-iotests/020.out                     | 1078 +
 tests/qemu-iotests/021                         |   63 +
 tests/qemu-iotests/021.out                     |   93 +
 tests/qemu-iotests/022                         |   67 +
 tests/qemu-iotests/022.out                     | 8801 ++++
 tests/qemu-iotests/023                         |  120 +
 tests/qemu-iotests/023.out                     |25706 ++++++++++
 tests/qemu-iotests/024                         |  125 +
 tests/qemu-iotests/024.out                     |  144 +
 tests/qemu-iotests/025                         |   78 +
 tests/qemu-iotests/025.out                     |   27 +
 tests/qemu-iotests/026                         |  199 +
 tests/qemu-iotests/026.out                     |  618 +
 tests/qemu-iotests/027                         |   78 +
 tests/qemu-iotests/027.out                     |   23 +
 tests/qemu-iotests/028                         |  107 +
 tests/qemu-iotests/028.out                     |  469 +
 tests/qemu-iotests/029                         |   65 +
 tests/qemu-iotests/029.out                     |   10 +
 tests/qemu-iotests/030                         |  530 +
 tests/qemu-iotests/030.out                     |    5 +
 tests/qemu-iotests/031                         |   80 +
 tests/qemu-iotests/031.out                     |  204 +
 tests/qemu-iotests/032                         |   69 +
 tests/qemu-iotests/032.out                     |   78 +
 tests/qemu-iotests/033                         |   73 +
 tests/qemu-iotests/033.out                     |   29 +
 tests/qemu-iotests/034                         |  113 +
 tests/qemu-iotests/034.out                     |   81 +
 tests/qemu-iotests/035                         |   72 +
 tests/qemu-iotests/035.out                     |  392 +
 tests/qemu-iotests/036                         |   68 +
 tests/qemu-iotests/036.out                     |   52 +
 tests/qemu-iotests/037                         |  119 +
 tests/qemu-iotests/037.out                     |  645 +
 tests/qemu-iotests/038                         |  133 +
 tests/qemu-iotests/038.out                     |  909 +
 tests/qemu-iotests/039                         |  137 +
 tests/qemu-iotests/039.out                     |   59 +
 tests/qemu-iotests/040                         |  280 +
 tests/qemu-iotests/040.out                     |    5 +
 tests/qemu-iotests/041                         |  615 +
 tests/qemu-iotests/041.out                     |    5 +
 tests/qemu-iotests/042                         |   78 +
 tests/qemu-iotests/042.out                     |   15 +
 tests/qemu-iotests/043                         |   95 +
 tests/qemu-iotests/043.out                     |   66 +
 tests/qemu-iotests/044                         |  117 +
 tests/qemu-iotests/044.out                     |    6 +
 tests/qemu-iotests/COPYING                     |  339 +
 tests/qemu-iotests/Makefile                    |    9 +
 tests/qemu-iotests/README                      |   20 +
 tests/qemu-iotests/check                       |  281 +
 tests/qemu-iotests/common                      |  365 +
 tests/qemu-iotests/common.config               |  147 +
 tests/qemu-iotests/common.filter               |  156 +
 tests/qemu-iotests/common.pattern              |  140 +
 tests/qemu-iotests/common.rc                   |  399 +
 tests/qemu-iotests/group                       |   53 +
 tests/qemu-iotests/iotests.py                  |  189 +
 tests/qemu-iotests/qcow2.py                    |  241 +
 tests/qemu-iotests/qed.py                      |  235 +
 tests/qruncom.c                                |  284 -
 tests/rtc-test.c                               |  353 +
 tests/runcom.c                                 |  192 -
 tests/sha1.c                                   |  240 -
 tests/tcg/Makefile                             |  158 +
 tests/tcg/alpha/Makefile                       |   35 +
 tests/tcg/alpha/crt.s                          |   26 +
 tests/tcg/alpha/hello-alpha.c                  |    5 +
 tests/tcg/alpha/test-cond.c                    |   87 +
 tests/tcg/alpha/test-ovf.c                     |   29 +
 tests/tcg/cris/.gdbinit                        |   11 +
 tests/tcg/cris/Makefile                        |  155 +
 tests/tcg/cris/README                          |    1 +
 tests/tcg/cris/check_abs.c                     |   40 +
 tests/tcg/cris/check_addc.c                    |   58 +
 tests/tcg/cris/check_addcm.c                   |   85 +
 tests/tcg/cris/check_addi.s                    |   57 +
 tests/tcg/cris/check_addiv32.s                 |   62 +
 tests/tcg/cris/check_addm.s                    |   96 +
 tests/tcg/cris/check_addo.c                    |  125 +
 tests/tcg/cris/check_addoq.c                   |   44 +
 tests/tcg/cris/check_addq.s                    |   47 +
 tests/tcg/cris/check_addr.s                    |   96 +
 tests/tcg/cris/check_addxc.s                   |   91 +
 tests/tcg/cris/check_addxm.s                   |  106 +
 tests/tcg/cris/check_addxr.s                   |   96 +
 tests/tcg/cris/check_andc.s                    |   80 +
 tests/tcg/cris/check_andm.s                    |   90 +
 tests/tcg/cris/check_andq.s                    |   46 +
 tests/tcg/cris/check_andr.s                    |   95 +
 tests/tcg/cris/check_asr.s                     |  230 +
 tests/tcg/cris/check_ba.s                      |   93 +
 tests/tcg/cris/check_bas.s                     |  102 +
 tests/tcg/cris/check_bcc.s                     |  197 +
 tests/tcg/cris/check_bound.c                   |  142 +
 tests/tcg/cris/check_boundc.s                  |  101 +
 tests/tcg/cris/check_boundr.s                  |  125 +
 tests/tcg/cris/check_btst.s                    |   96 +
 tests/tcg/cris/check_clearfv32.s               |   19 +
 tests/tcg/cris/check_clrjmp1.s                 |   36 +
 tests/tcg/cris/check_cmp-2.s                   |   15 +
 tests/tcg/cris/check_cmpc.s                    |   86 +
 tests/tcg/cris/check_cmpm.s                    |   96 +
 tests/tcg/cris/check_cmpq.s                    |   75 +
 tests/tcg/cris/check_cmpr.s                    |  102 +
 tests/tcg/cris/check_cmpxc.s                   |   92 +
 tests/tcg/cris/check_cmpxm.s                   |  106 +
 tests/tcg/cris/check_dstep.s                   |   42 +
 tests/tcg/cris/check_ftag.c                    |   37 +
 tests/tcg/cris/check_gcctorture_pr28634-1.c    |   15 +
 tests/tcg/cris/check_gcctorture_pr28634.c      |   15 +
 tests/tcg/cris/check_glibc_kernelversion.c     |  116 +
 tests/tcg/cris/check_hello.c                   |    7 +
 tests/tcg/cris/check_int64.c                   |   47 +
 tests/tcg/cris/check_jsr.s                     |   85 +
 tests/tcg/cris/check_lapc.s                    |   78 +
 tests/tcg/cris/check_lsl.s                     |  217 +
 tests/tcg/cris/check_lsr.s                     |  218 +
 tests/tcg/cris/check_lz.c                      |   49 +
 tests/tcg/cris/check_mapbrk.c                  |   39 +
 tests/tcg/cris/check_mcp.s                     |   49 +
 tests/tcg/cris/check_mmap1.c                   |   48 +
 tests/tcg/cris/check_mmap2.c                   |   48 +
 tests/tcg/cris/check_mmap3.c                   |   33 +
 tests/tcg/cris/check_movdelsr1.s               |   33 +
 tests/tcg/cris/check_movecr.s                  |   37 +
 tests/tcg/cris/check_movei.s                   |   50 +
 tests/tcg/cris/check_movemr.s                  |   78 +
 tests/tcg/cris/check_movemrv32.s               |   96 +
 tests/tcg/cris/check_moveq.c                   |   51 +
 tests/tcg/cris/check_mover.s                   |   28 +
 tests/tcg/cris/check_moverm.s                  |   45 +
 tests/tcg/cris/check_movmp.s                   |  131 +
 tests/tcg/cris/check_movpmv32.s                |   35 +
 tests/tcg/cris/check_movpr.s                   |   28 +
 tests/tcg/cris/check_movprv32.s                |   21 +
 tests/tcg/cris/check_movscr.s                  |   29 +
 tests/tcg/cris/check_movsm.s                   |   44 +
 tests/tcg/cris/check_movsr.s                   |   46 +
 tests/tcg/cris/check_movucr.s                  |   33 +
 tests/tcg/cris/check_movum.s                   |   40 +
 tests/tcg/cris/check_movur.s                   |   45 +
 tests/tcg/cris/check_mulv32.s                  |   51 +
 tests/tcg/cris/check_mulx.s                    |  246 +
 tests/tcg/cris/check_neg.s                     |  104 +
 tests/tcg/cris/check_not.s                     |   31 +
 tests/tcg/cris/check_openpf1.c                 |   38 +
 tests/tcg/cris/check_openpf2.c                 |   16 +
 tests/tcg/cris/check_openpf3.c                 |   49 +
 tests/tcg/cris/check_openpf4.c                 |    5 +
 tests/tcg/cris/check_openpf5.c                 |   56 +
 tests/tcg/cris/check_orc.s                     |   71 +
 tests/tcg/cris/check_orm.s                     |   75 +
 tests/tcg/cris/check_orq.s                     |   41 +
 tests/tcg/cris/check_orr.s                     |   84 +
 tests/tcg/cris/check_ret.s                     |   25 +
 tests/tcg/cris/check_scc.s                     |   95 +
 tests/tcg/cris/check_settls1.c                 |   45 +
 tests/tcg/cris/check_sigalrm.c                 |   26 +
 tests/tcg/cris/check_stat1.c                   |   16 +
 tests/tcg/cris/check_stat2.c                   |   20 +
 tests/tcg/cris/check_stat3.c                   |   25 +
 tests/tcg/cris/check_stat4.c                   |   27 +
 tests/tcg/cris/check_subc.s                    |   87 +
 tests/tcg/cris/check_subm.s                    |   96 +
 tests/tcg/cris/check_subq.s                    |   52 +
 tests/tcg/cris/check_subr.s                    |  102 +
 tests/tcg/cris/check_swap.c                    |   76 +
 tests/tcg/cris/check_time1.c                   |   46 +
 tests/tcg/cris/check_time2.c                   |   18 +
 tests/tcg/cris/check_xarith.s                  |   72 +
 tests/tcg/cris/crisutils.h                     |   71 +
 tests/tcg/cris/crt.s                           |   13 +
 tests/tcg/cris/sys.c                           |   51 +
 tests/tcg/cris/sys.h                           |   16 +
 tests/tcg/cris/testutils.inc                   |  117 +
 tests/tcg/hello-arm.c                          |  113 +
 tests/tcg/hello-i386.c                         |   27 +
 tests/tcg/hello-mips.c                         |   64 +
 tests/tcg/linux-test.c                         |  539 +
 tests/tcg/lm32/Makefile                        |  105 +
 tests/tcg/lm32/crt.S                           |   84 +
 tests/tcg/lm32/linker.ld                       |   55 +
 tests/tcg/lm32/macros.inc                      |   79 +
 tests/tcg/lm32/test_add.S                      |   75 +
 tests/tcg/lm32/test_addi.S                     |   56 +
 tests/tcg/lm32/test_and.S                      |   45 +
 tests/tcg/lm32/test_andhi.S                    |   35 +
 tests/tcg/lm32/test_andi.S                     |   35 +
 tests/tcg/lm32/test_b.S                        |   13 +
 tests/tcg/lm32/test_be.S                       |   48 +
 tests/tcg/lm32/test_bg.S                       |   78 +
 tests/tcg/lm32/test_bge.S                      |   78 +
 tests/tcg/lm32/test_bgeu.S                     |   78 +
 tests/tcg/lm32/test_bgu.S                      |   78 +
 tests/tcg/lm32/test_bi.S                       |   23 +
 tests/tcg/lm32/test_bne.S                      |   48 +
 tests/tcg/lm32/test_break.S                    |   20 +
 tests/tcg/lm32/test_bret.S                     |   38 +
 tests/tcg/lm32/test_call.S                     |   16 +
 tests/tcg/lm32/test_calli.S                    |   15 +
 tests/tcg/lm32/test_cmpe.S                     |   40 +
 tests/tcg/lm32/test_cmpei.S                    |   35 +
 tests/tcg/lm32/test_cmpg.S                     |   64 +
 tests/tcg/lm32/test_cmpge.S                    |   64 +
 tests/tcg/lm32/test_cmpgei.S                   |   55 +
 tests/tcg/lm32/test_cmpgeu.S                   |   64 +
 tests/tcg/lm32/test_cmpgeui.S                  |   55 +
 tests/tcg/lm32/test_cmpgi.S                    |   55 +
 tests/tcg/lm32/test_cmpgu.S                    |   64 +
 tests/tcg/lm32/test_cmpgui.S                   |   55 +
 tests/tcg/lm32/test_cmpne.S                    |   40 +
 tests/tcg/lm32/test_cmpnei.S                   |   35 +
 tests/tcg/lm32/test_divu.S                     |   29 +
 tests/tcg/lm32/test_eret.S                     |   38 +
 tests/tcg/lm32/test_lb.S                       |   45 +
 tests/tcg/lm32/test_lbu.S                      |   45 +
 tests/tcg/lm32/test_lh.S                       |   45 +
 tests/tcg/lm32/test_lhu.S                      |   45 +
 tests/tcg/lm32/test_lw.S                       |   30 +
 tests/tcg/lm32/test_modu.S                     |   35 +
 tests/tcg/lm32/test_mul.S                      |   70 +
 tests/tcg/lm32/test_muli.S                     |   45 +
 tests/tcg/lm32/test_nor.S                      |   51 +
 tests/tcg/lm32/test_nori.S                     |   35 +
 tests/tcg/lm32/test_or.S                       |   51 +
 tests/tcg/lm32/test_orhi.S                     |   35 +
 tests/tcg/lm32/test_ori.S                      |   35 +
 tests/tcg/lm32/test_ret.S                      |   14 +
 tests/tcg/lm32/test_sb.S                       |   30 +
 tests/tcg/lm32/test_scall.S                    |   20 +
 tests/tcg/lm32/test_sextb.S                    |   20 +
 tests/tcg/lm32/test_sexth.S                    |   20 +
 tests/tcg/lm32/test_sh.S                       |   30 +
 tests/tcg/lm32/test_sl.S                       |   45 +
 tests/tcg/lm32/test_sli.S                      |   30 +
 tests/tcg/lm32/test_sr.S                       |   57 +
 tests/tcg/lm32/test_sri.S                      |   40 +
 tests/tcg/lm32/test_sru.S                      |   57 +
 tests/tcg/lm32/test_srui.S                     |   40 +
 tests/tcg/lm32/test_sub.S                      |   75 +
 tests/tcg/lm32/test_sw.S                       |   35 +
 tests/tcg/lm32/test_xnor.S                     |   51 +
 tests/tcg/lm32/test_xnori.S                    |   35 +
 tests/tcg/lm32/test_xor.S                      |   51 +
 tests/tcg/lm32/test_xori.S                     |   35 +
 tests/tcg/mips/mips32-dsp/Makefile             |  136 +
 tests/tcg/mips/mips32-dsp/absq_s_ph.c          |   31 +
 tests/tcg/mips/mips32-dsp/absq_s_w.c           |   37 +
 tests/tcg/mips/mips32-dsp/addq_ph.c            |   46 +
 tests/tcg/mips/mips32-dsp/addq_s_ph.c          |   69 +
 tests/tcg/mips/mips32-dsp/addq_s_w.c           |   44 +
 tests/tcg/mips/mips32-dsp/addsc.c              |   33 +
 tests/tcg/mips/mips32-dsp/addu_qb.c            |   35 +
 tests/tcg/mips/mips32-dsp/addu_s_qb.c          |   35 +
 tests/tcg/mips/mips32-dsp/addwc.c              |   49 +
 tests/tcg/mips/mips32-dsp/bitrev.c             |   20 +
 tests/tcg/mips/mips32-dsp/bposge32.c           |   44 +
 tests/tcg/mips/mips32-dsp/cmp_eq_ph.c          |   35 +
 tests/tcg/mips/mips32-dsp/cmp_le_ph.c          |   35 +
 tests/tcg/mips/mips32-dsp/cmp_lt_ph.c          |   35 +
 tests/tcg/mips/mips32-dsp/cmpgu_eq_qb.c        |   31 +
 tests/tcg/mips/mips32-dsp/cmpgu_le_qb.c        |   31 +
 tests/tcg/mips/mips32-dsp/cmpgu_lt_qb.c        |   31 +
 tests/tcg/mips/mips32-dsp/cmpu_eq_qb.c         |   35 +
 tests/tcg/mips/mips32-dsp/cmpu_le_qb.c         |   35 +
 tests/tcg/mips/mips32-dsp/cmpu_lt_qb.c         |   35 +
 tests/tcg/mips/mips32-dsp/dpaq_s_w_ph.c        |   31 +
 tests/tcg/mips/mips32-dsp/dpaq_sa_l_w.c        |   77 +
 tests/tcg/mips/mips32-dsp/dpau_h_qbl.c         |   27 +
 tests/tcg/mips/mips32-dsp/dpau_h_qbr.c         |   27 +
 tests/tcg/mips/mips32-dsp/dpsq_s_w_ph.c        |   45 +
 tests/tcg/mips/mips32-dsp/dpsq_sa_l_w.c        |   55 +
 tests/tcg/mips/mips32-dsp/dpsu_h_qbl.c         |   27 +
 tests/tcg/mips/mips32-dsp/dpsu_h_qbr.c         |   27 +
 tests/tcg/mips/mips32-dsp/extp.c               |   44 +
 tests/tcg/mips/mips32-dsp/extpdp.c             |   46 +
 tests/tcg/mips/mips32-dsp/extpdpv.c            |   47 +
 tests/tcg/mips/mips32-dsp/extpv.c              |   45 +
 tests/tcg/mips/mips32-dsp/extr_r_w.c           |   48 +
 tests/tcg/mips/mips32-dsp/extr_rs_w.c          |   48 +
 tests/tcg/mips/mips32-dsp/extr_s_h.c           |   63 +
 tests/tcg/mips/mips32-dsp/extr_w.c             |   48 +
 tests/tcg/mips/mips32-dsp/extrv_r_w.c          |   54 +
 tests/tcg/mips/mips32-dsp/extrv_rs_w.c         |   52 +
 tests/tcg/mips/mips32-dsp/extrv_s_h.c          |   71 +
 tests/tcg/mips/mips32-dsp/extrv_w.c            |   54 +
 tests/tcg/mips/mips32-dsp/insv.c               |   23 +
 tests/tcg/mips/mips32-dsp/lbux.c               |   25 +
 tests/tcg/mips/mips32-dsp/lhx.c                |   25 +
 tests/tcg/mips/mips32-dsp/lwx.c                |   25 +
 tests/tcg/mips/mips32-dsp/madd.c               |   31 +
 tests/tcg/mips/mips32-dsp/maddu.c              |   31 +
 tests/tcg/mips/mips32-dsp/main.c               |    6 +
 tests/tcg/mips/mips32-dsp/maq_s_w_phl.c        |   55 +
 tests/tcg/mips/mips32-dsp/maq_s_w_phr.c        |   55 +
 tests/tcg/mips/mips32-dsp/maq_sa_w_phl.c       |   55 +
 tests/tcg/mips/mips32-dsp/maq_sa_w_phr.c       |   55 +
 tests/tcg/mips/mips32-dsp/mfhi.c               |   21 +
 tests/tcg/mips/mips32-dsp/mflo.c               |   21 +
 tests/tcg/mips/mips32-dsp/modsub.c             |   30 +
 tests/tcg/mips/mips32-dsp/msub.c               |   30 +
 tests/tcg/mips/mips32-dsp/msubu.c              |   30 +
 tests/tcg/mips/mips32-dsp/mthi.c               |   21 +
 tests/tcg/mips/mips32-dsp/mthlip.c             |   58 +
 tests/tcg/mips/mips32-dsp/mtlo.c               |   21 +
 tests/tcg/mips/mips32-dsp/muleq_s_w_phl.c      |   41 +
 tests/tcg/mips/mips32-dsp/muleq_s_w_phr.c      |   40 +
 tests/tcg/mips/mips32-dsp/muleu_s_ph_qbl.c     |   25 +
 tests/tcg/mips/mips32-dsp/muleu_s_ph_qbr.c     |   25 +
 tests/tcg/mips/mips32-dsp/mulq_rs_ph.c         |   25 +
 tests/tcg/mips/mips32-dsp/mult.c               |   24 +
 tests/tcg/mips/mips32-dsp/multu.c              |   24 +
 tests/tcg/mips/mips32-dsp/packrl_ph.c          |   21 +
 tests/tcg/mips/mips32-dsp/pick_ph.c            |   49 +
 tests/tcg/mips/mips32-dsp/pick_qb.c            |   36 +
 tests/tcg/mips/mips32-dsp/preceq_w_phl.c       |   20 +
 tests/tcg/mips/mips32-dsp/preceq_w_phr.c       |   20 +
 tests/tcg/mips/mips32-dsp/precequ_ph_qbl.c     |   20 +
 tests/tcg/mips/mips32-dsp/precequ_ph_qbla.c    |   20 +
 tests/tcg/mips/mips32-dsp/precequ_ph_qbr.c     |   20 +
 tests/tcg/mips/mips32-dsp/precequ_ph_qbra.c    |   20 +
 tests/tcg/mips/mips32-dsp/preceu_ph_qbl.c      |   20 +
 tests/tcg/mips/mips32-dsp/preceu_ph_qbla.c     |   20 +
 tests/tcg/mips/mips32-dsp/preceu_ph_qbr.c      |   20 +
 tests/tcg/mips/mips32-dsp/preceu_ph_qbra.c     |   20 +
 tests/tcg/mips/mips32-dsp/precrq_ph_w.c        |   21 +
 tests/tcg/mips/mips32-dsp/precrq_qb_ph.c       |   21 +
 tests/tcg/mips/mips32-dsp/precrq_rs_ph_w.c     |   35 +
 tests/tcg/mips/mips32-dsp/precrqu_s_qb_ph.c    |   24 +
 tests/tcg/mips/mips32-dsp/raddu_w_qb.c         |   20 +
 tests/tcg/mips/mips32-dsp/rddsp.c              |   54 +
 tests/tcg/mips/mips32-dsp/repl_ph.c            |   23 +
 tests/tcg/mips/mips32-dsp/repl_qb.c            |   16 +
 tests/tcg/mips/mips32-dsp/replv_ph.c           |   19 +
 tests/tcg/mips/mips32-dsp/replv_qb.c           |   19 +
 tests/tcg/mips/mips32-dsp/shilo.c              |   27 +
 tests/tcg/mips/mips32-dsp/shilov.c             |   29 +
 tests/tcg/mips/mips32-dsp/shll_ph.c            |   24 +
 tests/tcg/mips/mips32-dsp/shll_qb.c            |   36 +
 tests/tcg/mips/mips32-dsp/shll_s_ph.c          |   24 +
 tests/tcg/mips/mips32-dsp/shll_s_w.c           |   52 +
 tests/tcg/mips/mips32-dsp/shllv_ph.c           |   40 +
 tests/tcg/mips/mips32-dsp/shllv_qb.c           |   38 +
 tests/tcg/mips/mips32-dsp/shllv_s_ph.c         |   40 +
 tests/tcg/mips/mips32-dsp/shllv_s_w.c          |   40 +
 tests/tcg/mips/mips32-dsp/shra_ph.c            |   30 +
 tests/tcg/mips/mips32-dsp/shra_r_ph.c          |   30 +
 tests/tcg/mips/mips32-dsp/shra_r_w.c           |   30 +
 tests/tcg/mips/mips32-dsp/shrav_ph.c           |   32 +
 tests/tcg/mips/mips32-dsp/shrav_r_ph.c         |   32 +
 tests/tcg/mips/mips32-dsp/shrav_r_w.c          |   32 +
 tests/tcg/mips/mips32-dsp/shrl_qb.c            |   31 +
 tests/tcg/mips/mips32-dsp/shrlv_qb.c           |   32 +
 tests/tcg/mips/mips32-dsp/subq_ph.c            |   40 +
 tests/tcg/mips/mips32-dsp/subq_s_ph.c          |   40 +
 tests/tcg/mips/mips32-dsp/subq_s_w.c           |   58 +
 tests/tcg/mips/mips32-dsp/subu_qb.c            |   25 +
 tests/tcg/mips/mips32-dsp/subu_s_qb.c          |   25 +
 tests/tcg/mips/mips32-dsp/wrdsp.c              |   54 +
 tests/tcg/mips/mips32-dspr2/Makefile           |   71 +
 tests/tcg/mips/mips32-dspr2/absq_s_qb.c        |   35 +
 tests/tcg/mips/mips32-dspr2/addqh_ph.c         |   30 +
 tests/tcg/mips/mips32-dspr2/addqh_r_ph.c       |   30 +
 tests/tcg/mips/mips32-dspr2/addqh_r_w.c        |   34 +
 tests/tcg/mips/mips32-dspr2/addqh_w.c          |   34 +
 tests/tcg/mips/mips32-dspr2/addu_ph.c          |   33 +
 tests/tcg/mips/mips32-dspr2/addu_s_ph.c        |   33 +
 tests/tcg/mips/mips32-dspr2/adduh_qb.c         |   30 +
 tests/tcg/mips/mips32-dspr2/adduh_r_qb.c       |   30 +
 tests/tcg/mips/mips32-dspr2/append.c           |   30 +
 tests/tcg/mips/mips32-dspr2/balign.c           |   30 +
 tests/tcg/mips/mips32-dspr2/cmpgdu_eq_qb.c     |   37 +
 tests/tcg/mips/mips32-dspr2/cmpgdu_le_qb.c     |   37 +
 tests/tcg/mips/mips32-dspr2/cmpgdu_lt_qb.c     |   37 +
 tests/tcg/mips/mips32-dspr2/dpa_w_ph.c         |   44 +
 tests/tcg/mips/mips32-dspr2/dpaqx_s_w_ph.c     |   79 +
 tests/tcg/mips/mips32-dspr2/dpaqx_sa_w_ph.c    |   53 +
 tests/tcg/mips/mips32-dspr2/dpax_w_ph.c        |   27 +
 tests/tcg/mips/mips32-dspr2/dps_w_ph.c         |   27 +
 tests/tcg/mips/mips32-dspr2/dpsqx_s_w_ph.c     |   54 +
 tests/tcg/mips/mips32-dspr2/dpsqx_sa_w_ph.c    |   53 +
 tests/tcg/mips/mips32-dspr2/dpsx_w_ph.c        |   27 +
 tests/tcg/mips/mips32-dspr2/mul_ph.c           |   47 +
 tests/tcg/mips/mips32-dspr2/mul_s_ph.c         |   62 +
 tests/tcg/mips/mips32-dspr2/mulq_rs_w.c        |   36 +
 tests/tcg/mips/mips32-dspr2/mulq_s_ph.c        |   25 +
 tests/tcg/mips/mips32-dspr2/mulq_s_w.c         |   36 +
 tests/tcg/mips/mips32-dspr2/mulsa_w_ph.c       |   29 +
 tests/tcg/mips/mips32-dspr2/mulsaq_s_w_ph.c    |   29 +
 tests/tcg/mips/mips32-dspr2/precr_qb_ph.c      |   21 +
 tests/tcg/mips/mips32-dspr2/precr_sra_ph_w.c   |   32 +
 tests/tcg/mips/mips32-dspr2/precr_sra_r_ph_w.c |   32 +
 tests/tcg/mips/mips32-dspr2/prepend.c          |   30 +
 tests/tcg/mips/mips32-dspr2/shra_qb.c          |   30 +
 tests/tcg/mips/mips32-dspr2/shra_r_qb.c        |   30 +
 tests/tcg/mips/mips32-dspr2/shrav_qb.c         |   32 +
 tests/tcg/mips/mips32-dspr2/shrav_r_qb.c       |   32 +
 tests/tcg/mips/mips32-dspr2/shrl_ph.c          |   20 +
 tests/tcg/mips/mips32-dspr2/shrlv_ph.c         |   21 +
 tests/tcg/mips/mips32-dspr2/subqh_ph.c         |   21 +
 tests/tcg/mips/mips32-dspr2/subqh_r_ph.c       |   21 +
 tests/tcg/mips/mips32-dspr2/subqh_r_w.c        |   21 +
 tests/tcg/mips/mips32-dspr2/subqh_w.c          |   21 +
 tests/tcg/mips/mips32-dspr2/subu_ph.c          |   40 +
 tests/tcg/mips/mips32-dspr2/subu_s_ph.c        |   25 +
 tests/tcg/mips/mips32-dspr2/subuh_qb.c         |   21 +
 tests/tcg/mips/mips32-dspr2/subuh_r_qb.c       |   32 +
 tests/tcg/mips/mips64-dsp/Makefile             |  306 +
 tests/tcg/mips/mips64-dsp/absq_s_ob.c          |   63 +
 tests/tcg/mips/mips64-dsp/absq_s_ph.c          |   37 +
 tests/tcg/mips/mips64-dsp/absq_s_pw.c          |   66 +
 tests/tcg/mips/mips64-dsp/absq_s_qh.c          |   40 +
 tests/tcg/mips/mips64-dsp/absq_s_w.c           |   48 +
 tests/tcg/mips/mips64-dsp/addq_ph.c            |   57 +
 tests/tcg/mips/mips64-dsp/addq_pw.c            |   46 +
 tests/tcg/mips/mips64-dsp/addq_qh.c            |   28 +
 tests/tcg/mips/mips64-dsp/addq_s_ph.c          |   84 +
 tests/tcg/mips/mips64-dsp/addq_s_pw.c          |   45 +
 tests/tcg/mips/mips64-dsp/addq_s_qh.c          |   26 +
 tests/tcg/mips/mips64-dsp/addq_s_w.c           |   48 +
 tests/tcg/mips/mips64-dsp/addsc.c              |   39 +
 tests/tcg/mips/mips64-dsp/addu_ob.c            |   28 +
 tests/tcg/mips/mips64-dsp/addu_qb.c            |   40 +
 tests/tcg/mips/mips64-dsp/addu_s_ob.c          |   27 +
 tests/tcg/mips/mips64-dsp/addu_s_qb.c          |   40 +
 tests/tcg/mips/mips64-dsp/addwc.c              |   59 +
 tests/tcg/mips/mips64-dsp/bitrev.c             |   23 +
 tests/tcg/mips/mips64-dsp/bposge32.c           |   50 +
 tests/tcg/mips/mips64-dsp/bposge64.c           |   50 +
 tests/tcg/mips/mips64-dsp/cmp_eq_ph.c          |   42 +
 tests/tcg/mips/mips64-dsp/cmp_eq_pw.c          |   46 +
 tests/tcg/mips/mips64-dsp/cmp_eq_qh.c          |   46 +
 tests/tcg/mips/mips64-dsp/cmp_le_ph.c          |   40 +
 tests/tcg/mips/mips64-dsp/cmp_le_pw.c          |   46 +
 tests/tcg/mips/mips64-dsp/cmp_le_qh.c          |   46 +
 tests/tcg/mips/mips64-dsp/cmp_lt_ph.c          |   41 +
 tests/tcg/mips/mips64-dsp/cmp_lt_pw.c          |   46 +
 tests/tcg/mips/mips64-dsp/cmp_lt_qh.c          |   46 +
 tests/tcg/mips/mips64-dsp/cmpgu_eq_ob.c        |   40 +
 tests/tcg/mips/mips64-dsp/cmpgu_eq_qb.c        |   38 +
 tests/tcg/mips/mips64-dsp/cmpgu_le_ob.c        |   40 +
 tests/tcg/mips/mips64-dsp/cmpgu_le_qb.c        |   37 +
 tests/tcg/mips/mips64-dsp/cmpgu_lt_ob.c        |   40 +
 tests/tcg/mips/mips64-dsp/cmpgu_lt_qb.c        |   38 +
 tests/tcg/mips/mips64-dsp/cmpu_eq_ob.c         |   46 +
 tests/tcg/mips/mips64-dsp/cmpu_eq_qb.c         |   42 +
 tests/tcg/mips/mips64-dsp/cmpu_le_ob.c         |   44 +
 tests/tcg/mips/mips64-dsp/cmpu_le_qb.c         |   41 +
 tests/tcg/mips/mips64-dsp/cmpu_lt_ob.c         |   44 +
 tests/tcg/mips/mips64-dsp/cmpu_lt_qb.c         |   42 +
 tests/tcg/mips/mips64-dsp/dappend.c            |   37 +
 tests/tcg/mips/mips64-dsp/dextp.c              |   54 +
 tests/tcg/mips/mips64-dsp/dextpdp.c            |   59 +
 tests/tcg/mips/mips64-dsp/dextpdpv.c           |   63 +
 tests/tcg/mips/mips64-dsp/dextpv.c             |   58 +
 tests/tcg/mips/mips64-dsp/dextr_l.c            |   44 +
 tests/tcg/mips/mips64-dsp/dextr_r_l.c          |   54 +
 tests/tcg/mips/mips64-dsp/dextr_r_w.c          |   54 +
 tests/tcg/mips/mips64-dsp/dextr_rs_l.c         |   52 +
 tests/tcg/mips/mips64-dsp/dextr_rs_w.c         |   52 +
 tests/tcg/mips/mips64-dsp/dextr_s_h.c          |   73 +
 tests/tcg/mips/mips64-dsp/dextr_w.c            |   44 +
 tests/tcg/mips/mips64-dsp/dextrv_l.c           |   46 +
 tests/tcg/mips/mips64-dsp/dextrv_r_l.c         |   56 +
 tests/tcg/mips/mips64-dsp/dextrv_r_w.c         |   56 +
 tests/tcg/mips/mips64-dsp/dextrv_rs_l.c        |   54 +
 tests/tcg/mips/mips64-dsp/dextrv_rs_w.c        |   54 +
 tests/tcg/mips/mips64-dsp/dextrv_s_h.c         |   32 +
 tests/tcg/mips/mips64-dsp/dextrv_w.c           |   46 +
 tests/tcg/mips/mips64-dsp/dinsv.c              |   26 +
 tests/tcg/mips/mips64-dsp/dmadd.c              |   57 +
 tests/tcg/mips/mips64-dsp/dmaddu.c             |   56 +
 tests/tcg/mips/mips64-dsp/dmsub.c              |   59 +
 tests/tcg/mips/mips64-dsp/dmsubu.c             |   59 +
 tests/tcg/mips/mips64-dsp/dmthlip.c            |   41 +
 tests/tcg/mips/mips64-dsp/dpaq_s_w_ph.c        |   32 +
 tests/tcg/mips/mips64-dsp/dpaq_s_w_qh.c        |   57 +
 tests/tcg/mips/mips64-dsp/dpaq_sa_l_pw.c       |   88 +
 tests/tcg/mips/mips64-dsp/dpaq_sa_l_w.c        |   82 +
 tests/tcg/mips/mips64-dsp/dpau_h_obl.c         |   59 +
 tests/tcg/mips/mips64-dsp/dpau_h_obr.c         |   59 +
 tests/tcg/mips/mips64-dsp/dpau_h_qbl.c         |   29 +
 tests/tcg/mips/mips64-dsp/dpau_h_qbr.c         |   29 +
 tests/tcg/mips/mips64-dsp/dpsq_s_w_ph.c        |   51 +
 tests/tcg/mips/mips64-dsp/dpsq_s_w_qh.c        |   56 +
 tests/tcg/mips/mips64-dsp/dpsq_sa_l_pw.c       |   76 +
 tests/tcg/mips/mips64-dsp/dpsq_sa_l_w.c        |   59 +
 tests/tcg/mips/mips64-dsp/dpsu_h_obl.c         |   32 +
 tests/tcg/mips/mips64-dsp/dpsu_h_obr.c         |   32 +
 tests/tcg/mips/mips64-dsp/dpsu_h_qbl.c         |   29 +
 tests/tcg/mips/mips64-dsp/dpsu_h_qbr.c         |   29 +
 tests/tcg/mips/mips64-dsp/dshilo.c             |   52 +
 tests/tcg/mips/mips64-dsp/dshilov.c            |   54 +
 tests/tcg/mips/mips64-dsp/extp.c               |   50 +
 tests/tcg/mips/mips64-dsp/extpdp.c             |   51 +
 tests/tcg/mips/mips64-dsp/extpdpv.c            |   52 +
 tests/tcg/mips/mips64-dsp/extpv.c              |   51 +
 tests/tcg/mips/mips64-dsp/extr_r_w.c           |   53 +
 tests/tcg/mips/mips64-dsp/extr_rs_w.c          |   53 +
 tests/tcg/mips/mips64-dsp/extr_s_h.c           |   71 +
 tests/tcg/mips/mips64-dsp/extr_w.c             |   53 +
 tests/tcg/mips/mips64-dsp/extrv_r_w.c          |   59 +
 tests/tcg/mips/mips64-dsp/extrv_rs_w.c         |   59 +
 tests/tcg/mips/mips64-dsp/extrv_s_h.c          |   79 +
 tests/tcg/mips/mips64-dsp/extrv_w.c            |   59 +
 tests/tcg/mips/mips64-dsp/head.S               |   16 +
 tests/tcg/mips/mips64-dsp/insv.c               |   26 +
 tests/tcg/mips/mips64-dsp/io.h                 |   22 +
 tests/tcg/mips/mips64-dsp/lbux.c               |   27 +
 tests/tcg/mips/mips64-dsp/ldx.c                |   27 +
 tests/tcg/mips/mips64-dsp/lhx.c                |   27 +
 tests/tcg/mips/mips64-dsp/lwx.c                |   27 +
 tests/tcg/mips/mips64-dsp/madd.c               |   33 +
 tests/tcg/mips/mips64-dsp/maddu.c              |   33 +
 tests/tcg/mips/mips64-dsp/maq_s_l_pwl.c        |   56 +
 tests/tcg/mips/mips64-dsp/maq_s_l_pwr.c        |   56 +
 tests/tcg/mips/mips64-dsp/maq_s_w_phl.c        |   60 +
 tests/tcg/mips/mips64-dsp/maq_s_w_phr.c        |   60 +
 tests/tcg/mips/mips64-dsp/maq_s_w_qhll.c       |   62 +
 tests/tcg/mips/mips64-dsp/maq_s_w_qhlr.c       |   62 +
 tests/tcg/mips/mips64-dsp/maq_s_w_qhrl.c       |   63 +
 tests/tcg/mips/mips64-dsp/maq_s_w_qhrr.c       |   63 +
 tests/tcg/mips/mips64-dsp/maq_sa_w_phl.c       |   60 +
 tests/tcg/mips/mips64-dsp/maq_sa_w_phr.c       |   60 +
 tests/tcg/mips/mips64-dsp/maq_sa_w_qhll.c      |   62 +
 tests/tcg/mips/mips64-dsp/maq_sa_w_qhlr.c      |   64 +
 tests/tcg/mips/mips64-dsp/maq_sa_w_qhrl.c      |   64 +
 tests/tcg/mips/mips64-dsp/maq_sa_w_qhrr.c      |   64 +
 tests/tcg/mips/mips64-dsp/mfhi.c               |   24 +
 tests/tcg/mips/mips64-dsp/mflo.c               |   24 +
 tests/tcg/mips/mips64-dsp/mips_boot.lds        |   31 +
 tests/tcg/mips/mips64-dsp/modsub.c             |   37 +
 tests/tcg/mips/mips64-dsp/msub.c               |   32 +
 tests/tcg/mips/mips64-dsp/msubu.c              |   32 +
 tests/tcg/mips/mips64-dsp/mthi.c               |   24 +
 tests/tcg/mips/mips64-dsp/mthlip.c             |   61 +
 tests/tcg/mips/mips64-dsp/mtlo.c               |   22 +
 tests/tcg/mips/mips64-dsp/muleq_s_pw_qhl.c     |   56 +
 tests/tcg/mips/mips64-dsp/muleq_s_pw_qhr.c     |   57 +
 tests/tcg/mips/mips64-dsp/muleq_s_w_phl.c      |   46 +
 tests/tcg/mips/mips64-dsp/muleq_s_w_phr.c      |   45 +
 tests/tcg/mips/mips64-dsp/muleu_s_ph_qbl.c     |   27 +
 tests/tcg/mips/mips64-dsp/muleu_s_ph_qbr.c     |   27 +
 tests/tcg/mips/mips64-dsp/muleu_s_qh_obl.c     |   30 +
 tests/tcg/mips/mips64-dsp/muleu_s_qh_obr.c     |   31 +
 tests/tcg/mips/mips64-dsp/mulq_rs_ph.c         |   27 +
 tests/tcg/mips/mips64-dsp/mulq_rs_qh.c         |   33 +
 tests/tcg/mips/mips64-dsp/mulsaq_s_l_pw.c      |   59 +
 tests/tcg/mips/mips64-dsp/mulsaq_s_w_qh.c      |   57 +
 tests/tcg/mips/mips64-dsp/mult.c               |   26 +
 tests/tcg/mips/mips64-dsp/multu.c              |   26 +
 tests/tcg/mips/mips64-dsp/packrl_ph.c          |   24 +
 tests/tcg/mips/mips64-dsp/packrl_pw.c          |   24 +
 tests/tcg/mips/mips64-dsp/pick_ob.c            |   66 +
 tests/tcg/mips/mips64-dsp/pick_ph.c            |   60 +
 tests/tcg/mips/mips64-dsp/pick_pw.c            |   48 +
 tests/tcg/mips/mips64-dsp/pick_qb.c            |   43 +
 tests/tcg/mips/mips64-dsp/pick_qh.c            |   48 +
 tests/tcg/mips/mips64-dsp/preceq_l_pwl.c       |   24 +
 tests/tcg/mips/mips64-dsp/preceq_l_pwr.c       |   24 +
 tests/tcg/mips/mips64-dsp/preceq_pw_qhl.c      |   21 +
 tests/tcg/mips/mips64-dsp/preceq_pw_qhla.c     |   23 +
 tests/tcg/mips/mips64-dsp/preceq_pw_qhr.c      |   21 +
 tests/tcg/mips/mips64-dsp/preceq_pw_qhra.c     |   23 +
 tests/tcg/mips/mips64-dsp/preceq_w_phl.c       |   23 +
 tests/tcg/mips/mips64-dsp/preceq_w_phr.c       |   23 +
 tests/tcg/mips/mips64-dsp/precequ_ph_qbl.c     |   23 +
 tests/tcg/mips/mips64-dsp/precequ_ph_qbla.c    |   23 +
 tests/tcg/mips/mips64-dsp/precequ_ph_qbr.c     |   23 +
 tests/tcg/mips/mips64-dsp/precequ_ph_qbra.c    |   23 +
 tests/tcg/mips/mips64-dsp/precequ_qh_obl.c     |   22 +
 tests/tcg/mips/mips64-dsp/precequ_qh_obla.c    |   22 +
 tests/tcg/mips/mips64-dsp/precequ_qh_obr.c     |   24 +
 tests/tcg/mips/mips64-dsp/precequ_qh_obra.c    |   24 +
 tests/tcg/mips/mips64-dsp/preceu_ph_qbl.c      |   23 +
 tests/tcg/mips/mips64-dsp/preceu_ph_qbla.c     |   23 +
 tests/tcg/mips/mips64-dsp/preceu_ph_qbr.c      |   23 +
 tests/tcg/mips/mips64-dsp/preceu_ph_qbra.c     |   23 +
 tests/tcg/mips/mips64-dsp/preceu_qh_obl.c      |   22 +
 tests/tcg/mips/mips64-dsp/preceu_qh_obla.c     |   22 +
 tests/tcg/mips/mips64-dsp/preceu_qh_obr.c      |   23 +
 tests/tcg/mips/mips64-dsp/preceu_qh_obra.c     |   23 +
 tests/tcg/mips/mips64-dsp/precr_ob_qh.c        |   25 +
 tests/tcg/mips/mips64-dsp/precr_sra_qh_pw.c    |   40 +
 tests/tcg/mips/mips64-dsp/precr_sra_r_qh_pw.c  |   40 +
 tests/tcg/mips/mips64-dsp/precrq_ob_qh.c       |   25 +
 tests/tcg/mips/mips64-dsp/precrq_ph_w.c        |   24 +
 tests/tcg/mips/mips64-dsp/precrq_pw_l.c        |   25 +
 tests/tcg/mips/mips64-dsp/precrq_qb_ph.c       |   24 +
 tests/tcg/mips/mips64-dsp/precrq_qh_pw.c       |   25 +
 tests/tcg/mips/mips64-dsp/precrq_rs_ph_w.c     |   41 +
 tests/tcg/mips/mips64-dsp/precrq_rs_qh_pw.c    |   43 +
 tests/tcg/mips/mips64-dsp/precrqu_s_ob_qh.c    |   27 +
 tests/tcg/mips/mips64-dsp/precrqu_s_qb_ph.c    |   26 +
 tests/tcg/mips/mips64-dsp/prependd.c           |   37 +
 tests/tcg/mips/mips64-dsp/prependw.c           |   37 +
 tests/tcg/mips/mips64-dsp/printf.c             |  266 +
 tests/tcg/mips/mips64-dsp/raddu_l_ob.c         |   22 +
 tests/tcg/mips/mips64-dsp/raddu_w_qb.c         |   23 +
 tests/tcg/mips/mips64-dsp/rddsp.c              |   53 +
 tests/tcg/mips/mips64-dsp/repl_ob.c            |   21 +
 tests/tcg/mips/mips64-dsp/repl_ph.c            |   30 +
 tests/tcg/mips/mips64-dsp/repl_pw.c            |   34 +
 tests/tcg/mips/mips64-dsp/repl_qb.c            |   19 +
 tests/tcg/mips/mips64-dsp/repl_qh.c            |   34 +
 tests/tcg/mips/mips64-dsp/replv_ob.c           |   23 +
 tests/tcg/mips/mips64-dsp/replv_ph.c           |   22 +
 tests/tcg/mips/mips64-dsp/replv_pw.c           |   23 +
 tests/tcg/mips/mips64-dsp/replv_qb.c           |   22 +
 tests/tcg/mips/mips64-dsp/shilo.c              |   29 +
 tests/tcg/mips/mips64-dsp/shilov.c             |   31 +
 tests/tcg/mips/mips64-dsp/shll_ob.c            |   43 +
 tests/tcg/mips/mips64-dsp/shll_ph.c            |   43 +
 tests/tcg/mips/mips64-dsp/shll_pw.c            |   43 +
 tests/tcg/mips/mips64-dsp/shll_qb.c            |   26 +
 tests/tcg/mips/mips64-dsp/shll_qh.c            |   42 +
 tests/tcg/mips/mips64-dsp/shll_s_ph.c          |   43 +
 tests/tcg/mips/mips64-dsp/shll_s_pw.c          |   43 +
 tests/tcg/mips/mips64-dsp/shll_s_qh.c          |   43 +
 tests/tcg/mips/mips64-dsp/shll_s_w.c           |   26 +
 tests/tcg/mips/mips64-dsp/shllv_ob.c           |   45 +
 tests/tcg/mips/mips64-dsp/shllv_ph.c           |   27 +
 tests/tcg/mips/mips64-dsp/shllv_pw.c           |   45 +
 tests/tcg/mips/mips64-dsp/shllv_qb.c           |   27 +
 tests/tcg/mips/mips64-dsp/shllv_qh.c           |   45 +
 tests/tcg/mips/mips64-dsp/shllv_s_ph.c         |   27 +
 tests/tcg/mips/mips64-dsp/shllv_s_pw.c         |   45 +
 tests/tcg/mips/mips64-dsp/shllv_s_qh.c         |   45 +
 tests/tcg/mips/mips64-dsp/shllv_s_w.c          |   27 +
 tests/tcg/mips/mips64-dsp/shra_ob.c            |   23 +
 tests/tcg/mips/mips64-dsp/shra_ph.c            |   23 +
 tests/tcg/mips/mips64-dsp/shra_pw.c            |   36 +
 tests/tcg/mips/mips64-dsp/shra_qh.c            |   37 +
 tests/tcg/mips/mips64-dsp/shra_r_ob.c          |   22 +
 tests/tcg/mips/mips64-dsp/shra_r_ph.c          |   23 +
 tests/tcg/mips/mips64-dsp/shra_r_pw.c          |   36 +
 tests/tcg/mips/mips64-dsp/shra_r_qh.c          |   37 +
 tests/tcg/mips/mips64-dsp/shra_r_w.c           |   23 +
 tests/tcg/mips/mips64-dsp/shrav_ph.c           |   24 +
 tests/tcg/mips/mips64-dsp/shrav_pw.c           |   38 +
 tests/tcg/mips/mips64-dsp/shrav_qh.c           |   39 +
 tests/tcg/mips/mips64-dsp/shrav_r_ph.c         |   24 +
 tests/tcg/mips/mips64-dsp/shrav_r_pw.c         |   37 +
 tests/tcg/mips/mips64-dsp/shrav_r_qh.c         |   39 +
 tests/tcg/mips/mips64-dsp/shrav_r_w.c          |   24 +
 tests/tcg/mips/mips64-dsp/shrl_ob.c            |   38 +
 tests/tcg/mips/mips64-dsp/shrl_qb.c            |   23 +
 tests/tcg/mips/mips64-dsp/shrl_qh.c            |   22 +
 tests/tcg/mips/mips64-dsp/shrlv_ob.c           |   39 +
 tests/tcg/mips/mips64-dsp/shrlv_qb.c           |   24 +
 tests/tcg/mips/mips64-dsp/shrlv_qh.c           |   23 +
 tests/tcg/mips/mips64-dsp/subq_ph.c            |   27 +
 tests/tcg/mips/mips64-dsp/subq_pw.c            |   44 +
 tests/tcg/mips/mips64-dsp/subq_qh.c            |   26 +
 tests/tcg/mips/mips64-dsp/subq_s_ph.c          |   27 +
 tests/tcg/mips/mips64-dsp/subq_s_pw.c          |   63 +
 tests/tcg/mips/mips64-dsp/subq_s_qh.c          |   61 +
 tests/tcg/mips/mips64-dsp/subq_s_w.c           |   27 +
 tests/tcg/mips/mips64-dsp/subu_ob.c            |   26 +
 tests/tcg/mips/mips64-dsp/subu_qb.c            |   27 +
 tests/tcg/mips/mips64-dsp/subu_s_ob.c          |   26 +
 tests/tcg/mips/mips64-dsp/subu_s_qb.c          |   27 +
 tests/tcg/mips/mips64-dsp/wrdsp.c              |   48 +
 tests/tcg/mips/mips64-dspr2/.directory         |    2 +
 tests/tcg/mips/mips64-dspr2/Makefile           |  116 +
 tests/tcg/mips/mips64-dspr2/absq_s_qb.c        |   42 +
 tests/tcg/mips/mips64-dspr2/addqh_ph.c         |   35 +
 tests/tcg/mips/mips64-dspr2/addqh_r_ph.c       |   35 +
 tests/tcg/mips/mips64-dspr2/addqh_r_w.c        |   38 +
 tests/tcg/mips/mips64-dspr2/addqh_w.c          |   39 +
 tests/tcg/mips/mips64-dspr2/addu_ph.c          |   37 +
 tests/tcg/mips/mips64-dspr2/addu_qh.c          |   43 +
 tests/tcg/mips/mips64-dspr2/addu_s_ph.c        |   37 +
 tests/tcg/mips/mips64-dspr2/addu_s_qh.c        |   43 +
 tests/tcg/mips/mips64-dspr2/adduh_ob.c         |   35 +
 tests/tcg/mips/mips64-dspr2/adduh_qb.c         |   35 +
 tests/tcg/mips/mips64-dspr2/adduh_r_ob.c       |   35 +
 tests/tcg/mips/mips64-dspr2/adduh_r_qb.c       |   35 +
 tests/tcg/mips/mips64-dspr2/append.c           |   35 +
 tests/tcg/mips/mips64-dspr2/balign.c           |   35 +
 tests/tcg/mips/mips64-dspr2/cmpgdu_eq_ob.c     |   44 +
 tests/tcg/mips/mips64-dspr2/cmpgdu_eq_qb.c     |   41 +
 tests/tcg/mips/mips64-dspr2/cmpgdu_le_ob.c     |   44 +
 tests/tcg/mips/mips64-dspr2/cmpgdu_le_qb.c     |   48 +
 tests/tcg/mips/mips64-dspr2/cmpgdu_lt_ob.c     |   44 +
 tests/tcg/mips/mips64-dspr2/cmpgdu_lt_qb.c     |   48 +
 tests/tcg/mips/mips64-dspr2/dbalign.c          |   39 +
 tests/tcg/mips/mips64-dspr2/dpa_w_ph.c         |   47 +
 tests/tcg/mips/mips64-dspr2/dpa_w_qh.c         |   56 +
 tests/tcg/mips/mips64-dspr2/dpaqx_s_w_ph.c     |   97 +
 tests/tcg/mips/mips64-dspr2/dpaqx_sa_w_ph.c    |   54 +
 tests/tcg/mips/mips64-dspr2/dpax_w_ph.c        |   32 +
 tests/tcg/mips/mips64-dspr2/dps_w_ph.c         |   28 +
 tests/tcg/mips/mips64-dspr2/dps_w_qh.c         |   55 +
 tests/tcg/mips/mips64-dspr2/dpsqx_s_w_ph.c     |   55 +
 tests/tcg/mips/mips64-dspr2/dpsqx_sa_w_ph.c    |   53 +
 tests/tcg/mips/mips64-dspr2/dpsx_w_ph.c        |   28 +
 tests/tcg/mips/mips64-dspr2/head.S             |   16 +
 tests/tcg/mips/mips64-dspr2/io.h               |   22 +
 tests/tcg/mips/mips64-dspr2/mips_boot.lds      |   31 +
 tests/tcg/mips/mips64-dspr2/mul_ph.c           |   50 +
 tests/tcg/mips/mips64-dspr2/mul_s_ph.c         |   67 +
 tests/tcg/mips/mips64-dspr2/mulq_rs_w.c        |   40 +
 tests/tcg/mips/mips64-dspr2/mulq_s_ph.c        |   26 +
 tests/tcg/mips/mips64-dspr2/mulq_s_w.c         |   40 +
 tests/tcg/mips/mips64-dspr2/mulsa_w_ph.c       |   30 +
 tests/tcg/mips/mips64-dspr2/mulsaq_s_w_ph.c    |   30 +
 tests/tcg/mips/mips64-dspr2/precr_qb_ph.c      |   23 +
 tests/tcg/mips/mips64-dspr2/precr_sra_ph_w.c   |   37 +
 tests/tcg/mips/mips64-dspr2/precr_sra_r_ph_w.c |   37 +
 tests/tcg/mips/mips64-dspr2/prepend.c          |   35 +
 tests/tcg/mips/mips64-dspr2/printf.c           |  266 +
 tests/tcg/mips/mips64-dspr2/shra_qb.c          |   35 +
 tests/tcg/mips/mips64-dspr2/shra_r_qb.c        |   35 +
 tests/tcg/mips/mips64-dspr2/shrav_ob.c         |   22 +
 tests/tcg/mips/mips64-dspr2/shrav_qb.c         |   37 +
 tests/tcg/mips/mips64-dspr2/shrav_r_ob.c       |   22 +
 tests/tcg/mips/mips64-dspr2/shrav_r_qb.c       |   37 +
 tests/tcg/mips/mips64-dspr2/shrl_ph.c          |   22 +
 tests/tcg/mips/mips64-dspr2/shrlv_ph.c         |   23 +
 tests/tcg/mips/mips64-dspr2/subqh_ph.c         |   23 +
 tests/tcg/mips/mips64-dspr2/subqh_r_ph.c       |   23 +
 tests/tcg/mips/mips64-dspr2/subqh_r_w.c        |   23 +
 tests/tcg/mips/mips64-dspr2/subqh_w.c          |   23 +
 tests/tcg/mips/mips64-dspr2/subu_ph.c          |   26 +
 tests/tcg/mips/mips64-dspr2/subu_qh.c          |   24 +
 tests/tcg/mips/mips64-dspr2/subu_s_ph.c        |   25 +
 tests/tcg/mips/mips64-dspr2/subu_s_qh.c        |   42 +
 tests/tcg/mips/mips64-dspr2/subuh_ob.c         |   36 +
 tests/tcg/mips/mips64-dspr2/subuh_qb.c         |   23 +
 tests/tcg/mips/mips64-dspr2/subuh_r_ob.c       |   23 +
 tests/tcg/mips/mips64-dspr2/subuh_r_qb.c       |   37 +
 tests/tcg/openrisc/Makefile                    |   71 +
 tests/tcg/openrisc/test_add.c                  |   43 +
 tests/tcg/openrisc/test_addc.c                 |   38 +
 tests/tcg/openrisc/test_addi.c                 |   33 +
 tests/tcg/openrisc/test_addic.c                |   33 +
 tests/tcg/openrisc/test_and_or.c               |   65 +
 tests/tcg/openrisc/test_bf.c                   |   47 +
 tests/tcg/openrisc/test_bnf.c                  |   51 +
 tests/tcg/openrisc/test_div.c                  |   54 +
 tests/tcg/openrisc/test_divu.c                 |   34 +
 tests/tcg/openrisc/test_extx.c                 |   78 +
 tests/tcg/openrisc/test_fx.c                   |   57 +
 tests/tcg/openrisc/test_j.c                    |   26 +
 tests/tcg/openrisc/test_jal.c                  |   26 +
 tests/tcg/openrisc/test_lf_add.c               |   39 +
 tests/tcg/openrisc/test_lf_div.c               |   37 +
 tests/tcg/openrisc/test_lf_eqs.c               |   88 +
 tests/tcg/openrisc/test_lf_ges.c               |   88 +
 tests/tcg/openrisc/test_lf_gts.c               |   86 +
 tests/tcg/openrisc/test_lf_les.c               |   88 +
 tests/tcg/openrisc/test_lf_lts.c               |   92 +
 tests/tcg/openrisc/test_lf_mul.c               |   22 +
 tests/tcg/openrisc/test_lf_nes.c               |   89 +
 tests/tcg/openrisc/test_lf_rem.c               |   32 +
 tests/tcg/openrisc/test_lf_sub.c               |   35 +
 tests/tcg/openrisc/test_logic.c                |  105 +
 tests/tcg/openrisc/test_lx.c                   |   84 +
 tests/tcg/openrisc/test_movhi.c                |   31 +
 tests/tcg/openrisc/test_mul.c                  |   61 +
 tests/tcg/openrisc/test_muli.c                 |   48 +
 tests/tcg/openrisc/test_mulu.c                 |   48 +
 tests/tcg/openrisc/test_sfeq.c                 |   43 +
 tests/tcg/openrisc/test_sfeqi.c                |   39 +
 tests/tcg/openrisc/test_sfges.c                |   44 +
 tests/tcg/openrisc/test_sfgesi.c               |   40 +
 tests/tcg/openrisc/test_sfgeu.c                |   44 +
 tests/tcg/openrisc/test_sfgeui.c               |   41 +
 tests/tcg/openrisc/test_sfgts.c                |   45 +
 tests/tcg/openrisc/test_sfgtsi.c               |   41 +
 tests/tcg/openrisc/test_sfgtu.c                |   43 +
 tests/tcg/openrisc/test_sfgtui.c               |   42 +
 tests/tcg/openrisc/test_sfles.c                |   26 +
 tests/tcg/openrisc/test_sflesi.c               |   39 +
 tests/tcg/openrisc/test_sfleu.c                |   43 +
 tests/tcg/openrisc/test_sfleui.c               |   39 +
 tests/tcg/openrisc/test_sflts.c                |   43 +
 tests/tcg/openrisc/test_sfltsi.c               |   39 +
 tests/tcg/openrisc/test_sfltu.c                |   43 +
 tests/tcg/openrisc/test_sfltui.c               |   39 +
 tests/tcg/openrisc/test_sfne.c                 |   43 +
 tests/tcg/openrisc/test_sfnei.c                |   39 +
 tests/tcg/openrisc/test_sub.c                  |   35 +
 tests/tcg/pi_10.com                            |  Bin 0 -> 54 bytes
 tests/tcg/runcom.c                             |  192 +
 tests/tcg/sha1.c                               |  240 +
 tests/tcg/test-arm-iwmmxt.s                    |   49 +
 tests/tcg/test-i386-code16.S                   |   79 +
 tests/tcg/test-i386-fprem.c                    |  353 +
 tests/tcg/test-i386-muldiv.h                   |   76 +
 tests/tcg/test-i386-shift.h                    |  185 +
 tests/tcg/test-i386-ssse3.c                    |   57 +
 tests/tcg/test-i386-vm86.S                     |  103 +
 tests/tcg/test-i386.c                          | 2765 +
 tests/tcg/test-i386.h                          |  152 +
 tests/tcg/test-mmap.c                          |  484 +
 tests/tcg/test_path.c                          |  161 +
 tests/tcg/testthread.c                         |   58 +
 tests/tcg/xtensa/Makefile                      |   79 +
 tests/tcg/xtensa/crt.S                         |   24 +
 tests/tcg/xtensa/linker.ld                     |  112 +
 tests/tcg/xtensa/macros.inc                    |   85 +
 tests/tcg/xtensa/test_b.S                      |  221 +
 tests/tcg/xtensa/test_bi.S                     |  103 +
 tests/tcg/xtensa/test_boolean.S                |   23 +
 tests/tcg/xtensa/test_break.S                  |  257 +
 tests/tcg/xtensa/test_bz.S                     |   57 +
 tests/tcg/xtensa/test_clamps.S                 |   42 +
 tests/tcg/xtensa/test_fail.S                   |    9 +
 tests/tcg/xtensa/test_interrupt.S              |  194 +
 tests/tcg/xtensa/test_loop.S                   |  163 +
 tests/tcg/xtensa/test_mac16.S                  |  243 +
 tests/tcg/xtensa/test_max.S                    |   81 +
 tests/tcg/xtensa/test_min.S                    |   81 +
 tests/tcg/xtensa/test_mmu.S                    |  511 +
 tests/tcg/xtensa/test_mul16.S                  |   83 +
 tests/tcg/xtensa/test_mul32.S                  |   20 +
 tests/tcg/xtensa/test_nsa.S                    |   59 +
 tests/tcg/xtensa/test_pipeline.S               |  157 +
 tests/tcg/xtensa/test_quo.S                    |  147 +
 tests/tcg/xtensa/test_rem.S                    |  147 +
 tests/tcg/xtensa/test_rst0.S                   |  148 +
 tests/tcg/xtensa/test_sar.S                    |  111 +
 tests/tcg/xtensa/test_sext.S                   |   69 +
 tests/tcg/xtensa/test_shift.S                  |  206 +
 tests/tcg/xtensa/test_timer.S                  |  178 +
 tests/tcg/xtensa/test_windowed.S               |  302 +
 tests/tcg/xtensa/vectors.S                     |   39 +
 tests/test-arm-iwmmxt.s                        |   49 -
 tests/test-coroutine.c                         |  219 +
 tests/test-i386-code16.S                       |   79 -
 tests/test-i386-muldiv.h                       |   76 -
 tests/test-i386-shift.h                        |  185 -
 tests/test-i386-ssse3.c                        |   57 -
 tests/test-i386-vm86.S                         |  103 -
 tests/test-i386.c                              | 2764 -
 tests/test-i386.h                              |  152 -
 tests/test-iov.c                               |  260 +
 tests/test-mmap.c                              |  476 -
 tests/test-qmp-commands.c                      |  181 +
 tests/test-qmp-input-strict.c                  |  234 +
 tests/test-qmp-input-visitor.c                 |  316 +
 tests/test-qmp-output-visitor.c                |  477 +
 tests/test-string-input-visitor.c              |  195 +
 tests/test-string-output-visitor.c             |  188 +
 tests/test-visitor-serialization.c             |  784 +
 tests/test_path.c                              |  160 -
 tests/testthread.c                             |   51 -
 tests/xtensa/Makefile                          |   75 -
 tests/xtensa/crt.S                             |   24 -
 tests/xtensa/linker.ld                         |  112 -
 tests/xtensa/macros.inc                        |   68 -
 tests/xtensa/test_b.S                          |  221 -
 tests/xtensa/test_bi.S                         |  103 -
 tests/xtensa/test_boolean.S                    |   23 -
 tests/xtensa/test_bz.S                         |   57 -
 tests/xtensa/test_clamps.S                     |   42 -
 tests/xtensa/test_fail.S                       |    9 -
 tests/xtensa/test_interrupt.S                  |  194 -
 tests/xtensa/test_loop.S                       |   77 -
 tests/xtensa/test_mac16.S                      |  243 -
 tests/xtensa/test_max.S                        |   81 -
 tests/xtensa/test_min.S                        |   81 -
 tests/xtensa/test_mmu.S                        |  318 -
 tests/xtensa/test_mul16.S                      |   83 -
 tests/xtensa/test_mul32.S                      |   20 -
 tests/xtensa/test_nsa.S                        |   59 -
 tests/xtensa/test_pipeline.S                   |  157 -
 tests/xtensa/test_quo.S                        |  147 -
 tests/xtensa/test_rem.S                        |  147 -
 tests/xtensa/test_rst0.S                       |  148 -
 tests/xtensa/test_sar.S                        |  111 -
 tests/xtensa/test_sext.S                       |   69 -
 tests/xtensa/test_shift.S                      |  206 -
 tests/xtensa/test_timer.S                      |  178 -
 tests/xtensa/test_windowed.S                   |  302 -
 tests/xtensa/vectors.S                         |   39 -
 thread-pool.c                                  |  289 +
 thread-pool.h                                  |   34 +
 thunk.c                                        |   28 +
 thunk.h                                        |   32 +-
 trace-events                                   |  437 +-
 trace/control.c                                |   12 +-
 trace/simple.c                                 |  286 +-
 trace/simple.h                                 |   39 +-
 translate-all.c                                |   11 +-
 ui/Makefile.objs                               |   14 +
 ui/cocoa.m                                     |    9 +-
 ui/curses.c                                    |   21 +-
 ui/qemu-spice.h                                |    9 +-
 ui/sdl.c                                       |  204 +-
 ui/spice-core.c                                |  148 +-
 ui/spice-display.c                             |  265 +-
 ui/spice-display.h                             |   40 +-
 ui/vnc-auth-sasl.c                             |    9 +-
 ui/vnc-auth-sasl.h                             |    4 +-
 ui/vnc-auth-vencrypt.c                         |    3 +-
 ui/vnc-enc-hextile-template.h                  |   24 +-
 ui/vnc-enc-hextile.c                           |   53 +-
 ui/vnc-enc-tight.c                             |  280 +-
 ui/vnc-enc-zrle.c                              |   18 +-
 ui/vnc-enc-zywrle-template.c                   |    2 +-
 ui/vnc-enc-zywrle.h                            |    2 +-
 ui/vnc-jobs-async.c                            |  341 -
 ui/vnc-jobs-sync.c                             |   73 -
 ui/vnc-jobs.c                                  |  352 +
 ui/vnc-jobs.h                                  |   18 +-
 ui/vnc-palette.h                               |    1 +
 ui/vnc-tls.c                                   |    2 +-
 ui/vnc.c                                       |  551 +-
 ui/vnc.h                                       |   59 +-
 uri.c                                          | 2249 +
 uri.h                                          |  113 +
 usb-bsd.c                                      |  639 -
 usb-linux.c                                    | 2152 -
 usb-redir.c                                    | 1252 -
 usb-stub.c                                     |   52 -
 user-exec.c                                    |   32 +-
 vl.c                                           |  984 +-
 vmstate.h                                      |  639 +
 xen-all.c                                      |  314 +-
 xen-mapcache.c                                 |   36 +-
 xen-mapcache.h                                 |    8 +-
 xen-stub.c                                     |   22 +-
 xtensa-semi.c                                  |  224 -
 2676 files changed, 436970 insertions(+), 133260 deletions(-)

diff --git a/.exrc b/.exrc
new file mode 100644
index 0000000..37755ed
--- /dev/null
+++ b/.exrc
@@ -0,0 +1,7 @@
+"VIM settings to match QEMU coding style.  They are activated by adding the
+"following settings (without the " symbol) as last two lines in $HOME/.vimrc:
+"set secure
+"set exrc
+set expandtab
+set shiftwidth=4
+set smarttab
diff --git a/.gitignore b/.gitignore
index 406f75f..bd6ba1c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,8 +12,6 @@ trace-dtrace.dtrace
 *-linux-user
 *-bsd-user
 libdis*
-libhw32
-libhw64
 libuser
 linux-headers/asm
 qapi-generated
@@ -39,9 +37,18 @@ qemu-img-cmds.texi
 qemu-img-cmds.h
 qemu-io
 qemu-ga
+qemu-bridge-helper
 qemu-monitor.texi
+vscclient
 QMP/qmp-commands.txt
 test-coroutine
+test-qmp-input-visitor
+test-qmp-output-visitor
+test-string-input-visitor
+test-string-output-visitor
+test-visitor-serialization
+fsdev/virtfs-proxy-helper.1
+fsdev/virtfs-proxy-helper.pod
 .gdbinit
 *.a
 *.aux
@@ -62,6 +69,10 @@ test-coroutine
 *.vr
 *.d
 *.o
+*.lo
+*.la
+*.pc
+.libs
 *.swp
 *.orig
 .pc
@@ -69,8 +80,14 @@ patches
 pc-bios/bios-pq/status
 pc-bios/vgabios-pq/status
 pc-bios/optionrom/linuxboot.bin
+pc-bios/optionrom/linuxboot.raw
+pc-bios/optionrom/linuxboot.img
 pc-bios/optionrom/multiboot.bin
 pc-bios/optionrom/multiboot.raw
+pc-bios/optionrom/multiboot.img
+pc-bios/optionrom/kvmvapic.bin
+pc-bios/optionrom/kvmvapic.raw
+pc-bios/optionrom/kvmvapic.img
 .stgit-*
 cscope.*
 tags
diff --git a/.gitmodules b/.gitmodules
index eca876f..cfa2af9 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -19,3 +19,6 @@
 [submodule "roms/sgabios"]
 	path = roms/sgabios
 	url = git://git.qemu.org/sgabios.git
+[submodule "pixman"]
+	path = pixman
+	url = git://anongit.freedesktop.org/pixman
diff --git a/.mailmap b/.mailmap
new file mode 100644
index 0000000..9797802
--- /dev/null
+++ b/.mailmap
@@ -0,0 +1,16 @@
+# This mailmap just translates the weird addresses from the original import into git
+# into proper addresses so that they are counted properly in git shortlog output.
+#
+Andrzej Zaborowski <balrogg@gmail.com> balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>
+Anthony Liguori <aliguori@us.ibm.com> aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
+Aurelien Jarno <aurelien@aurel32.net> aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>
+Blue Swirl <blauwirbel@gmail.com> blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>
+Edgar E. Iglesias <edgar.iglesias@gmail.com> edgar_igl <edgar_igl@c046a42c-6fe2-441c-8c8c-71466251a162>
+Fabrice Bellard <fabrice@bellard.org> bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
+Jocelyn Mayer <l_indien@magic.fr> j_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162>
+Paul Brook <paul@codesourcery.com> pbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>
+Thiemo Seufer <ths@networkno.de> ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>
+malc <av1474@comtv.ru> malc <malc@c046a42c-6fe2-441c-8c8c-71466251a162>
+# There is also a:
+#    (no author) <(no author)@c046a42c-6fe2-441c-8c8c-71466251a162>
+# for the cvs2svn initialization commit e63c3dc74bf.
diff --git a/CODING_STYLE b/CODING_STYLE
index 6e61c49..dcbce28 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -1,4 +1,4 @@
-Qemu Coding Style
+QEMU Coding Style
 =================
 
 Please use the script checkpatch.pl in the scripts directory to check
@@ -44,7 +44,8 @@ Rationale:
 3. Naming
 
 Variables are lower_case_with_underscores; easy to type and read.  Structured
-type names are in CamelCase; harder to type but standing out.  Scalar type
+type names are in CamelCase; harder to type but standing out.  Enum type
+names and function type names should also be in CamelCase.  Scalar type
 names are lower_case_with_underscores_ending_with_a_t, like the POSIX
 uint64_t and family.  Note that this last convention contradicts POSIX
 and is therefore likely to be changed.
diff --git a/Changelog b/Changelog
index 28a69af..13eebef 100644
--- a/Changelog
+++ b/Changelog
@@ -78,7 +78,7 @@ version 0.10.2:
 
   - fix savevm/loadvm (Anthony Liguori)
   - live migration: fix dirty tracking windows (Glauber Costa)
-  - live migration: improve error propogation (Glauber Costa)
+  - live migration: improve error propagation (Glauber Costa)
   - qcow2: fix image creation for > ~2TB images (Chris Wright)
   - hotplug: fix error handling for if= parameter (Eduardo Habkost)
   - qcow2: fix data corruption (Nolan Leake)
@@ -386,7 +386,7 @@ version 0.5.3:
   - support of CD-ROM change
   - multiple network interface support
   - initial x86-64 host support (Gwenole Beauchesne)
-  - lret to outer priviledge fix (OS/2 install fix)
+  - lret to outer privilege fix (OS/2 install fix)
   - task switch fixes (SkyOS boot)
   - VM save/restore commands
   - new timer API
@@ -447,7 +447,7 @@ version 0.5.0:
   - multi-target build
   - fixed: no error code in hardware interrupts
   - fixed: pop ss, mov ss, x and sti disable hardware irqs for the next insn
-  - correct single stepping thru string operations
+  - correct single stepping through string operations
   - preliminary SPARC target support (Thomas M. Ogrisegg)
   - tun-fd option (Rusty Russell)
   - automatic IDE geometry detection
diff --git a/HACKING b/HACKING
index 733eab2..89a6b3a 100644
--- a/HACKING
+++ b/HACKING
@@ -32,7 +32,7 @@ mandatory for VMState fields.
 
 Don't use Linux kernel internal types like u32, __u32 or __le32.
 
-Use target_phys_addr_t for guest physical addresses except pcibus_t
+Use hwaddr for guest physical addresses except pcibus_t
 for PCI addresses.  In addition, ram_addr_t is a QEMU internal address
 space that maps guest RAM physical addresses into an intermediate
 address space that can map to host virtual address spaces.  Generally
@@ -77,11 +77,13 @@ avoided.
 
 Use of the malloc/free/realloc/calloc/valloc/memalign/posix_memalign
 APIs is not allowed in the QEMU codebase. Instead of these routines,
-use the replacement g_malloc/g_malloc0/g_realloc/g_free or
-qemu_vmalloc/qemu_memalign/qemu_vfree APIs.
+use the GLib memory allocation routines g_malloc/g_malloc0/g_new/
+g_new0/g_realloc/g_free or QEMU's qemu_vmalloc/qemu_memalign/qemu_vfree
+APIs.
 
-Please note that NULL check for the g_malloc result is redundant and
-that g_malloc() call with zero size is not allowed.
+Please note that g_malloc will exit on allocation failure, so there
+is no need to test for failure (as you would have to with malloc).
+Calling g_malloc with a zero size is valid and will return NULL.
 
 Memory allocated by qemu_vmalloc or qemu_memalign must be freed with
 qemu_vfree, since breaking this will cause problems on Win32 and user
@@ -89,10 +91,11 @@ emulators.
 
 4. String manipulation
 
-Do not use the strncpy function.  According to the man page, it does
-*not* guarantee a NULL-terminated buffer, which makes it extremely dangerous
-to use.  Instead, use functionally equivalent function:
-void pstrcpy(char *buf, int buf_size, const char *str)
+Do not use the strncpy function.  As mentioned in the man page, it does *not*
+guarantee a NULL-terminated buffer, which makes it extremely dangerous to use.
+It also zeros trailing destination bytes out to the specified length.  Instead,
+use this similar function when possible, but note its different signature:
+void pstrcpy(char *dest, int dest_buf_size, const char *src)
 
 Don't use strcat because it can't check for buffer overflows, but:
 char *pstrcat(char *buf, int buf_size, const char *s)
diff --git a/LICENSE b/LICENSE
index cbd92c0..acae9a3 100644
--- a/LICENSE
+++ b/LICENSE
@@ -6,9 +6,7 @@ The following points clarify the QEMU license:
 GNU General Public License. Hence each source file contains its own
 licensing information.
 
-In particular, the QEMU virtual CPU core library (libqemu.a) is
-released under the GNU Lesser General Public License. Many hardware
-device emulation sources are released under the BSD license.
+Many hardware device emulation sources are released under the BSD license.
 
 3) The Tiny Code Generator (TCG) is released under the BSD license
    (see license headers in files).
diff --git a/MAINTAINERS b/MAINTAINERS
index 06df70c..2ede20d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -20,7 +20,7 @@ Descriptions of section entries:
 	   Supported:	Someone is actually paid to look after this.
 	   Maintained:	Someone actually looks after it.
 	   Odd Fixes:	It has a maintainer but they don't have time to do
-			much other than throw the odd patch in. See below..
+			much other than throw the odd patch in. See below.
 	   Orphan:	No current maintainer [but maybe you could take the
 			role as you write your new code].
 	   Obsolete:	Old code. Something tagged obsolete generally means
@@ -78,7 +78,7 @@ F: target-lm32/
 
 M68K
 M: Paul Brook <paul@codesourcery.com>
-S: Maintained
+S: Odd Fixes
 F: target-m68k/
 
 MicroBlaze
@@ -88,11 +88,12 @@ F: target-microblaze/
 
 MIPS
 M: Aurelien Jarno <aurelien@aurel32.net>
-S: Maintained
+S: Odd Fixes
 F: target-mips/
 
 PowerPC
 M: Alexander Graf <agraf@suse.de>
+L: qemu-ppc@nongnu.org
 S: Maintained
 F: target-ppc/
 
@@ -103,7 +104,7 @@ F: target-s390x/
 
 SH4
 M: Aurelien Jarno <aurelien@aurel32.net>
-S: Maintained
+S: Odd Fixes
 F: target-sh4/
 
 SPARC
@@ -111,6 +112,11 @@ M: Blue Swirl <blauwirbel@gmail.com>
 S: Maintained
 F: target-sparc/
 
+UniCore32
+M: Guan Xuetao <gxt@mprc.pku.edu.cn>
+S: Maintained
+F: target-unicore32/
+
 X86
 M: qemu-devel@nongnu.org
 S: Odd Fixes
@@ -160,13 +166,53 @@ S: Supported
 F: xen-*
 F: */xen*
 
+Hosts:
+------
+
+LINUX
+L: qemu-devel@nongnu.org
+S: Maintained
+F: linux-*
+F: linux-headers/
+
+POSIX
+L: qemu-devel@nongnu.org
+S: Maintained
+F: *posix*
+
+W32, W64
+L: qemu-devel@nongnu.org
+M: Stefan Weil <sw@weilnetz.de>
+S: Maintained
+F: *win32*
+
 ARM Machines
 ------------
+Exynos
+M: Evgeny Voevodin <e.voevodin@samsung.com>
+M: Maksim Kozlov <m.kozlov@samsung.com>
+M: Igor Mitsyanko <i.mitsyanko@samsung.com>
+M: Dmitry Solodkiy <d.solodkiy@samsung.com>
+S: Maintained
+F: hw/exynos*

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

From xen-changelog-bounces@lists.xen.org Mon Nov 26 08:33:15 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Nov 2012 08:33: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.xen.org>)
	id 1Tcu7o-00012y-Ue; Mon, 26 Nov 2012 08:33: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 1Tcu7n-00012i-KV
	for xen-changelog@lists.xensource.com; Mon, 26 Nov 2012 08:33:07 +0000
Received: from [85.158.139.83:46967] by server-16.bemta-5.messagelabs.com id
	C5/15-04786-24923B05; Mon, 26 Nov 2012 08:33:06 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-182.messagelabs.com!1353918785!31896013!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24483 invoked from network); 26 Nov 2012 08:33:06 -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;
	26 Nov 2012 08:33: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 1Tcu7k-0000YI-RP
	for xen-changelog@lists.xensource.com; Mon, 26 Nov 2012 08:33:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tcu7k-0006TK-FP
	for xen-changelog@lists.xensource.com; Mon, 26 Nov 2012 08:33:04 +0000
Message-Id: <E1Tcu7k-0006TK-FP@xenbits.xen.org>
Date: Mon, 26 Nov 2012 08:33:04 +0000
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] x86: adjust unwind info for
	special HYPERVISOR_iret stack layout
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353918649 -3600
# Node ID b9b0a1e9130eb933a34b548508f9ee43fd6e4871
# Parent  b357fab4566ac8daf168e49fee383b1b0a4b9ffb
x86: adjust unwind info for special HYPERVISOR_iret stack layout

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


diff -r b357fab4566a -r b9b0a1e9130e arch/i386/kernel/head-xen.S
--- a/arch/i386/kernel/head-xen.S	Mon Nov 26 09:29:19 2012 +0100
+++ b/arch/i386/kernel/head-xen.S	Mon Nov 26 09:30:49 2012 +0100
@@ -70,7 +70,13 @@ ENTRY(startup_32)
 .org HYPERCALL_PAGE_OFFSET
 ENTRY(hypercall_page)
 	CFI_STARTPROC
-.skip 0x1000
+	.skip __HYPERVISOR_iret * 32
+	CFI_REMEMBER_STATE
+	.skip 1 /* push %eax */
+	CFI_ADJUST_CFA_OFFSET	8
+	CFI_REL_OFFSET	eax,0
+	CFI_RESTORE_STATE
+	.balign 0x1000,0
 	CFI_ENDPROC
 
 /*
diff -r b357fab4566a -r b9b0a1e9130e arch/x86_64/kernel/head-xen.S
--- a/arch/x86_64/kernel/head-xen.S	Mon Nov 26 09:29:19 2012 +0100
+++ b/arch/x86_64/kernel/head-xen.S	Mon Nov 26 09:30:49 2012 +0100
@@ -23,6 +23,7 @@
 #include <asm/msr.h>
 #include <asm/cache.h>
 #include <asm/dwarf2.h>
+#include <xen/interface/xen.h>
 #include <xen/interface/elfnote.h>
 #include <xen/interface/features.h>
 
@@ -80,6 +81,7 @@ NEXT_PAGE(level3_user_pgt)
 
 NEXT_PAGE(hypercall_page)
 	CFI_STARTPROC
+	i = 0
 	.rept 0x1000 / 0x20
 	.skip 1 /* push %rcx */
 	CFI_ADJUST_CFA_OFFSET	8
@@ -87,15 +89,25 @@ NEXT_PAGE(hypercall_page)
 	.skip 2 /* push %r11 */
 	CFI_ADJUST_CFA_OFFSET	8
 	CFI_REL_OFFSET	r11,0
+	.if i == __HYPERVISOR_iret
+	.skip 1 /* push %rax */
+	CFI_ADJUST_CFA_OFFSET	8
+	CFI_REL_OFFSET	rax,0
+	.endif
 	.skip 5 /* mov $#,%eax */
 	.skip 2 /* syscall */
+	.if i == __HYPERVISOR_iret
+	CFI_ADJUST_CFA_OFFSET	-3*8
+	.else
 	.skip 2 /* pop %r11 */
 	CFI_ADJUST_CFA_OFFSET -8
 	CFI_RESTORE r11
 	.skip 1 /* pop %rcx */
 	CFI_ADJUST_CFA_OFFSET -8
 	CFI_RESTORE rcx
-	.align 0x20,0 /* ret */
+	.endif
+	.balign 0x20,0 /* ret */
+	i = i + 1
 	.endr
 	CFI_ENDPROC
 

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

From xen-changelog-bounces@lists.xen.org Mon Nov 26 08:33:15 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Nov 2012 08:33: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.xen.org>)
	id 1Tcu7o-00012y-Ue; Mon, 26 Nov 2012 08:33: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 1Tcu7n-00012i-KV
	for xen-changelog@lists.xensource.com; Mon, 26 Nov 2012 08:33:07 +0000
Received: from [85.158.139.83:46967] by server-16.bemta-5.messagelabs.com id
	C5/15-04786-24923B05; Mon, 26 Nov 2012 08:33:06 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-182.messagelabs.com!1353918785!31896013!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24483 invoked from network); 26 Nov 2012 08:33:06 -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;
	26 Nov 2012 08:33: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 1Tcu7k-0000YI-RP
	for xen-changelog@lists.xensource.com; Mon, 26 Nov 2012 08:33:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tcu7k-0006TK-FP
	for xen-changelog@lists.xensource.com; Mon, 26 Nov 2012 08:33:04 +0000
Message-Id: <E1Tcu7k-0006TK-FP@xenbits.xen.org>
Date: Mon, 26 Nov 2012 08:33:04 +0000
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] x86: adjust unwind info for
	special HYPERVISOR_iret stack layout
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353918649 -3600
# Node ID b9b0a1e9130eb933a34b548508f9ee43fd6e4871
# Parent  b357fab4566ac8daf168e49fee383b1b0a4b9ffb
x86: adjust unwind info for special HYPERVISOR_iret stack layout

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


diff -r b357fab4566a -r b9b0a1e9130e arch/i386/kernel/head-xen.S
--- a/arch/i386/kernel/head-xen.S	Mon Nov 26 09:29:19 2012 +0100
+++ b/arch/i386/kernel/head-xen.S	Mon Nov 26 09:30:49 2012 +0100
@@ -70,7 +70,13 @@ ENTRY(startup_32)
 .org HYPERCALL_PAGE_OFFSET
 ENTRY(hypercall_page)
 	CFI_STARTPROC
-.skip 0x1000
+	.skip __HYPERVISOR_iret * 32
+	CFI_REMEMBER_STATE
+	.skip 1 /* push %eax */
+	CFI_ADJUST_CFA_OFFSET	8
+	CFI_REL_OFFSET	eax,0
+	CFI_RESTORE_STATE
+	.balign 0x1000,0
 	CFI_ENDPROC
 
 /*
diff -r b357fab4566a -r b9b0a1e9130e arch/x86_64/kernel/head-xen.S
--- a/arch/x86_64/kernel/head-xen.S	Mon Nov 26 09:29:19 2012 +0100
+++ b/arch/x86_64/kernel/head-xen.S	Mon Nov 26 09:30:49 2012 +0100
@@ -23,6 +23,7 @@
 #include <asm/msr.h>
 #include <asm/cache.h>
 #include <asm/dwarf2.h>
+#include <xen/interface/xen.h>
 #include <xen/interface/elfnote.h>
 #include <xen/interface/features.h>
 
@@ -80,6 +81,7 @@ NEXT_PAGE(level3_user_pgt)
 
 NEXT_PAGE(hypercall_page)
 	CFI_STARTPROC
+	i = 0
 	.rept 0x1000 / 0x20
 	.skip 1 /* push %rcx */
 	CFI_ADJUST_CFA_OFFSET	8
@@ -87,15 +89,25 @@ NEXT_PAGE(hypercall_page)
 	.skip 2 /* push %r11 */
 	CFI_ADJUST_CFA_OFFSET	8
 	CFI_REL_OFFSET	r11,0
+	.if i == __HYPERVISOR_iret
+	.skip 1 /* push %rax */
+	CFI_ADJUST_CFA_OFFSET	8
+	CFI_REL_OFFSET	rax,0
+	.endif
 	.skip 5 /* mov $#,%eax */
 	.skip 2 /* syscall */
+	.if i == __HYPERVISOR_iret
+	CFI_ADJUST_CFA_OFFSET	-3*8
+	.else
 	.skip 2 /* pop %r11 */
 	CFI_ADJUST_CFA_OFFSET -8
 	CFI_RESTORE r11
 	.skip 1 /* pop %rcx */
 	CFI_ADJUST_CFA_OFFSET -8
 	CFI_RESTORE rcx
-	.align 0x20,0 /* ret */
+	.endif
+	.balign 0x20,0 /* ret */
+	i = i + 1
 	.endr
 	CFI_ENDPROC
 

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

From xen-changelog-bounces@lists.xen.org Mon Nov 26 08:33:16 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Nov 2012 08:33: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.xen.org>)
	id 1Tcu7o-00012t-Rg; Mon, 26 Nov 2012 08:33: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 1Tcu7n-00012h-2j
	for xen-changelog@lists.xensource.com; Mon, 26 Nov 2012 08:33:07 +0000
Received: from [85.158.139.83:46921] by server-1.bemta-5.messagelabs.com id
	CF/49-05877-24923B05; Mon, 26 Nov 2012 08:33:06 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-182.messagelabs.com!1353918784!31342926!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8244 invoked from network); 26 Nov 2012 08:33: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;
	26 Nov 2012 08:33: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 1Tcu7k-0000YC-3S
	for xen-changelog@lists.xensource.com; Mon, 26 Nov 2012 08:33:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tcu7j-0006Sq-Kd
	for xen-changelog@lists.xensource.com; Mon, 26 Nov 2012 08:33:03 +0000
Message-Id: <E1Tcu7j-0006Sq-Kd@xenbits.xen.org>
Date: Mon, 26 Nov 2012 08:33: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] scsifront: respect full ring on
	reset processing
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353918342 -3600
# Node ID 4d1471ca031e65eca5e508eab8330bef9799f5fb
# Parent  39a26cb5fb0eb16bbfca425084b345c7130b6ad1
scsifront: respect full ring on reset processing

Additionally, the error return case of the wait_event_interruptible()
at the end of scsifront_dev_reset_handler() wasn't handled, potentially
causing shadow slot corruption.

Doing this also revealed that io_lock was pointless - it was only used
inside the worker thread, i.e. protected nothing.

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


diff -r 39a26cb5fb0e -r 4d1471ca031e drivers/xen/scsifront/common.h
--- a/drivers/xen/scsifront/common.h	Fri Nov 23 11:53:50 2012 +0100
+++ b/drivers/xen/scsifront/common.h	Mon Nov 26 09:25:42 2012 +0100
@@ -99,7 +99,6 @@ struct vscsifrnt_info {
 
 	struct Scsi_Host *host;
 
-	spinlock_t io_lock;
 	spinlock_t shadow_lock;
 	unsigned int evtchn;
 	unsigned int irq;
@@ -113,8 +112,9 @@ struct vscsifrnt_info {
 
 	struct task_struct *kthread;
 	wait_queue_head_t wq;
-	unsigned int waiting_resp;
-
+	wait_queue_head_t wq_sync;
+	unsigned int waiting_resp:1;
+	unsigned int waiting_sync:1;
 };
 
 #define DPRINTK(_f, _a...)				\
diff -r 39a26cb5fb0e -r 4d1471ca031e drivers/xen/scsifront/scsifront.c
--- a/drivers/xen/scsifront/scsifront.c	Fri Nov 23 11:53:50 2012 +0100
+++ b/drivers/xen/scsifront/scsifront.c	Mon Nov 26 09:25:42 2012 +0100
@@ -49,16 +49,19 @@ static int get_id_from_freelist(struct v
 	return free;
 }
 
+static void _add_id_to_freelist(struct vscsifrnt_info *info, uint32_t id)
+{
+	info->shadow[id].next_free = info->shadow_free;
+	info->shadow[id].sc = NULL;
+	info->shadow_free = id;
+}
+
 static void add_id_to_freelist(struct vscsifrnt_info *info, uint32_t id)
 {
 	unsigned long flags;
 
 	spin_lock_irqsave(&info->shadow_lock, flags);
-
-	info->shadow[id].next_free = info->shadow_free;
-	info->shadow[id].sc = NULL;
-	info->shadow_free = id;
-
+	_add_id_to_freelist(info, id);
 	spin_unlock_irqrestore(&info->shadow_lock, flags);
 }
 
@@ -169,7 +172,19 @@ static void scsifront_sync_cmd_done(stru
 	
 	spin_lock_irqsave(&info->shadow_lock, flags);
 	info->shadow[id].wait_reset = 1;
-	info->shadow[id].rslt_reset = ring_res->rslt;
+	switch (info->shadow[id].rslt_reset) {
+	case 0:
+		info->shadow[id].rslt_reset = ring_res->rslt;
+		break;
+	case -1:
+		_add_id_to_freelist(info, id);
+		break;
+	default:
+		shost_printk(KERN_ERR "scsifront: ", info->host,
+			     "bad reset state %d, possibly leaking %u\n",
+			     info->shadow[id].rslt_reset, id);
+		break;
+	}
 	spin_unlock_irqrestore(&info->shadow_lock, flags);
 
 	wake_up(&(info->shadow[id].wq_reset));
@@ -184,7 +199,7 @@ static int scsifront_cmd_done(struct vsc
 	int more_to_do = 0;
 	unsigned long flags;
 
-	spin_lock_irqsave(&info->io_lock, flags);
+	spin_lock_irqsave(info->host->host_lock, flags);
 
 	rp = info->ring.sring->rsp_prod;
 	rmb();
@@ -206,8 +221,11 @@ static int scsifront_cmd_done(struct vsc
 		info->ring.sring->rsp_event = i + 1;
 	}
 
-	spin_unlock_irqrestore(&info->io_lock, flags);
+	info->waiting_sync = 0;
 
+	spin_unlock_irqrestore(info->host->host_lock, flags);
+
+	wake_up(&info->wq_sync);
 
 	/* Yield point for this unbounded loop. */
 	cond_resched();
@@ -425,17 +443,33 @@ static int scsifront_dev_reset_handler(s
 
 	vscsiif_request_t *ring_req;
 	uint16_t rqid;
-	int err;
+	int err = 0;
 
+	for (;;) {
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
-	spin_lock_irq(host->host_lock);
+		spin_lock_irq(host->host_lock);
 #endif
+		if (!RING_FULL(&info->ring))
+			break;
+		if (err) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
+			spin_unlock_irq(host->host_lock);
+#endif
+			return FAILED;
+		}
+		info->waiting_sync = 1;
+		spin_unlock_irq(host->host_lock);
+		err = wait_event_interruptible(info->wq_sync,
+					       !info->waiting_sync);
+		spin_lock_irq(host->host_lock);
+	}
 
 	ring_req      = scsifront_pre_request(info);
 	ring_req->act = VSCSIIF_ACT_SCSI_RESET;
 
 	rqid          = ring_req->rqid;
 	info->shadow[rqid].act = VSCSIIF_ACT_SCSI_RESET;
+	info->shadow[rqid].rslt_reset = 0;
 
 	ring_req->channel = sc->device->channel;
 	ring_req->id      = sc->device->id;
@@ -454,13 +488,19 @@ static int scsifront_dev_reset_handler(s
 	scsifront_do_request(info);	
 
 	spin_unlock_irq(host->host_lock);
-	wait_event_interruptible(info->shadow[rqid].wq_reset,
-			 info->shadow[rqid].wait_reset);
+	err = wait_event_interruptible(info->shadow[rqid].wq_reset,
+				       info->shadow[rqid].wait_reset);
 	spin_lock_irq(host->host_lock);
 
-	err = info->shadow[rqid].rslt_reset;
-
-	add_id_to_freelist(info, rqid);
+	if (!err) {
+		err = info->shadow[rqid].rslt_reset;
+		add_id_to_freelist(info, rqid);
+	} else {
+		spin_lock(&info->shadow_lock);
+		info->shadow[rqid].rslt_reset = -1;
+		spin_unlock(&info->shadow_lock);
+		err = FAILED;
+	}
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
 	spin_unlock_irq(host->host_lock);
diff -r 39a26cb5fb0e -r 4d1471ca031e drivers/xen/scsifront/xenbus.c
--- a/drivers/xen/scsifront/xenbus.c	Fri Nov 23 11:53:50 2012 +0100
+++ b/drivers/xen/scsifront/xenbus.c	Mon Nov 26 09:25:42 2012 +0100
@@ -205,7 +205,7 @@ static int scsifront_probe(struct xenbus
 	}
 
 	init_waitqueue_head(&info->wq);
-	spin_lock_init(&info->io_lock);
+	init_waitqueue_head(&info->wq_sync);
 	spin_lock_init(&info->shadow_lock);
 
 	snprintf(name, DEFAULT_TASK_COMM_LEN, "vscsiif.%d", info->host->host_no);

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

From xen-changelog-bounces@lists.xen.org Mon Nov 26 08:33:16 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Nov 2012 08:33: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.xen.org>)
	id 1Tcu7o-00012t-Rg; Mon, 26 Nov 2012 08:33: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 1Tcu7n-00012h-2j
	for xen-changelog@lists.xensource.com; Mon, 26 Nov 2012 08:33:07 +0000
Received: from [85.158.139.83:46921] by server-1.bemta-5.messagelabs.com id
	CF/49-05877-24923B05; Mon, 26 Nov 2012 08:33:06 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-182.messagelabs.com!1353918784!31342926!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8244 invoked from network); 26 Nov 2012 08:33: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;
	26 Nov 2012 08:33: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 1Tcu7k-0000YC-3S
	for xen-changelog@lists.xensource.com; Mon, 26 Nov 2012 08:33:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tcu7j-0006Sq-Kd
	for xen-changelog@lists.xensource.com; Mon, 26 Nov 2012 08:33:03 +0000
Message-Id: <E1Tcu7j-0006Sq-Kd@xenbits.xen.org>
Date: Mon, 26 Nov 2012 08:33: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] scsifront: respect full ring on
	reset processing
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353918342 -3600
# Node ID 4d1471ca031e65eca5e508eab8330bef9799f5fb
# Parent  39a26cb5fb0eb16bbfca425084b345c7130b6ad1
scsifront: respect full ring on reset processing

Additionally, the error return case of the wait_event_interruptible()
at the end of scsifront_dev_reset_handler() wasn't handled, potentially
causing shadow slot corruption.

Doing this also revealed that io_lock was pointless - it was only used
inside the worker thread, i.e. protected nothing.

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


diff -r 39a26cb5fb0e -r 4d1471ca031e drivers/xen/scsifront/common.h
--- a/drivers/xen/scsifront/common.h	Fri Nov 23 11:53:50 2012 +0100
+++ b/drivers/xen/scsifront/common.h	Mon Nov 26 09:25:42 2012 +0100
@@ -99,7 +99,6 @@ struct vscsifrnt_info {
 
 	struct Scsi_Host *host;
 
-	spinlock_t io_lock;
 	spinlock_t shadow_lock;
 	unsigned int evtchn;
 	unsigned int irq;
@@ -113,8 +112,9 @@ struct vscsifrnt_info {
 
 	struct task_struct *kthread;
 	wait_queue_head_t wq;
-	unsigned int waiting_resp;
-
+	wait_queue_head_t wq_sync;
+	unsigned int waiting_resp:1;
+	unsigned int waiting_sync:1;
 };
 
 #define DPRINTK(_f, _a...)				\
diff -r 39a26cb5fb0e -r 4d1471ca031e drivers/xen/scsifront/scsifront.c
--- a/drivers/xen/scsifront/scsifront.c	Fri Nov 23 11:53:50 2012 +0100
+++ b/drivers/xen/scsifront/scsifront.c	Mon Nov 26 09:25:42 2012 +0100
@@ -49,16 +49,19 @@ static int get_id_from_freelist(struct v
 	return free;
 }
 
+static void _add_id_to_freelist(struct vscsifrnt_info *info, uint32_t id)
+{
+	info->shadow[id].next_free = info->shadow_free;
+	info->shadow[id].sc = NULL;
+	info->shadow_free = id;
+}
+
 static void add_id_to_freelist(struct vscsifrnt_info *info, uint32_t id)
 {
 	unsigned long flags;
 
 	spin_lock_irqsave(&info->shadow_lock, flags);
-
-	info->shadow[id].next_free = info->shadow_free;
-	info->shadow[id].sc = NULL;
-	info->shadow_free = id;
-
+	_add_id_to_freelist(info, id);
 	spin_unlock_irqrestore(&info->shadow_lock, flags);
 }
 
@@ -169,7 +172,19 @@ static void scsifront_sync_cmd_done(stru
 	
 	spin_lock_irqsave(&info->shadow_lock, flags);
 	info->shadow[id].wait_reset = 1;
-	info->shadow[id].rslt_reset = ring_res->rslt;
+	switch (info->shadow[id].rslt_reset) {
+	case 0:
+		info->shadow[id].rslt_reset = ring_res->rslt;
+		break;
+	case -1:
+		_add_id_to_freelist(info, id);
+		break;
+	default:
+		shost_printk(KERN_ERR "scsifront: ", info->host,
+			     "bad reset state %d, possibly leaking %u\n",
+			     info->shadow[id].rslt_reset, id);
+		break;
+	}
 	spin_unlock_irqrestore(&info->shadow_lock, flags);
 
 	wake_up(&(info->shadow[id].wq_reset));
@@ -184,7 +199,7 @@ static int scsifront_cmd_done(struct vsc
 	int more_to_do = 0;
 	unsigned long flags;
 
-	spin_lock_irqsave(&info->io_lock, flags);
+	spin_lock_irqsave(info->host->host_lock, flags);
 
 	rp = info->ring.sring->rsp_prod;
 	rmb();
@@ -206,8 +221,11 @@ static int scsifront_cmd_done(struct vsc
 		info->ring.sring->rsp_event = i + 1;
 	}
 
-	spin_unlock_irqrestore(&info->io_lock, flags);
+	info->waiting_sync = 0;
 
+	spin_unlock_irqrestore(info->host->host_lock, flags);
+
+	wake_up(&info->wq_sync);
 
 	/* Yield point for this unbounded loop. */
 	cond_resched();
@@ -425,17 +443,33 @@ static int scsifront_dev_reset_handler(s
 
 	vscsiif_request_t *ring_req;
 	uint16_t rqid;
-	int err;
+	int err = 0;
 
+	for (;;) {
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
-	spin_lock_irq(host->host_lock);
+		spin_lock_irq(host->host_lock);
 #endif
+		if (!RING_FULL(&info->ring))
+			break;
+		if (err) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
+			spin_unlock_irq(host->host_lock);
+#endif
+			return FAILED;
+		}
+		info->waiting_sync = 1;
+		spin_unlock_irq(host->host_lock);
+		err = wait_event_interruptible(info->wq_sync,
+					       !info->waiting_sync);
+		spin_lock_irq(host->host_lock);
+	}
 
 	ring_req      = scsifront_pre_request(info);
 	ring_req->act = VSCSIIF_ACT_SCSI_RESET;
 
 	rqid          = ring_req->rqid;
 	info->shadow[rqid].act = VSCSIIF_ACT_SCSI_RESET;
+	info->shadow[rqid].rslt_reset = 0;
 
 	ring_req->channel = sc->device->channel;
 	ring_req->id      = sc->device->id;
@@ -454,13 +488,19 @@ static int scsifront_dev_reset_handler(s
 	scsifront_do_request(info);	
 
 	spin_unlock_irq(host->host_lock);
-	wait_event_interruptible(info->shadow[rqid].wq_reset,
-			 info->shadow[rqid].wait_reset);
+	err = wait_event_interruptible(info->shadow[rqid].wq_reset,
+				       info->shadow[rqid].wait_reset);
 	spin_lock_irq(host->host_lock);
 
-	err = info->shadow[rqid].rslt_reset;
-
-	add_id_to_freelist(info, rqid);
+	if (!err) {
+		err = info->shadow[rqid].rslt_reset;
+		add_id_to_freelist(info, rqid);
+	} else {
+		spin_lock(&info->shadow_lock);
+		info->shadow[rqid].rslt_reset = -1;
+		spin_unlock(&info->shadow_lock);
+		err = FAILED;
+	}
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
 	spin_unlock_irq(host->host_lock);
diff -r 39a26cb5fb0e -r 4d1471ca031e drivers/xen/scsifront/xenbus.c
--- a/drivers/xen/scsifront/xenbus.c	Fri Nov 23 11:53:50 2012 +0100
+++ b/drivers/xen/scsifront/xenbus.c	Mon Nov 26 09:25:42 2012 +0100
@@ -205,7 +205,7 @@ static int scsifront_probe(struct xenbus
 	}
 
 	init_waitqueue_head(&info->wq);
-	spin_lock_init(&info->io_lock);
+	init_waitqueue_head(&info->wq_sync);
 	spin_lock_init(&info->shadow_lock);
 
 	snprintf(name, DEFAULT_TASK_COMM_LEN, "vscsiif.%d", info->host->host_no);

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

From xen-changelog-bounces@lists.xen.org Mon Nov 26 08:33:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Nov 2012 08: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 1Tcu7t-00013F-1V; Mon, 26 Nov 2012 08:33:13 +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 1Tcu7r-00013A-Sm
	for xen-changelog@lists.xensource.com; Mon, 26 Nov 2012 08:33:12 +0000
Received: from [85.158.137.99:22779] by server-4.bemta-3.messagelabs.com id
	46/EE-30023-24923B05; Mon, 26 Nov 2012 08:33:06 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-217.messagelabs.com!1353918784!20458914!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27922 invoked from network); 26 Nov 2012 08:33:05 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	26 Nov 2012 08:33: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 1Tcu7k-0000YF-7c
	for xen-changelog@lists.xensource.com; Mon, 26 Nov 2012 08:33:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tcu7k-0006T5-2E
	for xen-changelog@lists.xensource.com; Mon, 26 Nov 2012 08:33:04 +0000
Message-Id: <E1Tcu7k-0006T5-2E@xenbits.xen.org>
Date: Mon, 26 Nov 2012 08:33: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] scsifront: consolidate printing
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353918559 -3600
# Node ID b357fab4566ac8daf168e49fee383b1b0a4b9ffb
# Parent  4d1471ca031e65eca5e508eab8330bef9799f5fb
scsifront: consolidate printing

Use shost_printk() or dev_err() instead of plain printk().

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


diff -r 4d1471ca031e -r b357fab4566a drivers/xen/scsifront/scsifront.c
--- a/drivers/xen/scsifront/scsifront.c	Mon Nov 26 09:25:42 2012 +0100
+++ b/drivers/xen/scsifront/scsifront.c	Mon Nov 26 09:29:19 2012 +0100
@@ -30,6 +30,8 @@
  
 #include "common.h"
 
+#define PREFIX(lvl) KERN_##lvl "scsifront: "
+
 static int get_id_from_freelist(struct vscsifrnt_info *info)
 {
 	unsigned long flags;
@@ -108,26 +110,22 @@ irqreturn_t scsifront_intr(int irq, void
 }
 
 
-static void scsifront_gnttab_done(struct vscsifrnt_shadow *s, uint32_t id)
+static void scsifront_gnttab_done(struct vscsifrnt_info *info, uint32_t id)
 {
+	struct vscsifrnt_shadow *s = &info->shadow[id];
 	int i;
 
 	if (s->sc->sc_data_direction == DMA_NONE)
 		return;
 
-	if (s->nr_segments) {
-		for (i = 0; i < s->nr_segments; i++) {
-			if (unlikely(gnttab_query_foreign_access(
-				s->gref[i]) != 0)) {
-				printk(KERN_ALERT "scsifront: "
-					"grant still in use by backend.\n");
-				BUG();
-			}
-			gnttab_end_foreign_access(s->gref[i], 0UL);
+	for (i = 0; i < s->nr_segments; i++) {
+		if (unlikely(gnttab_query_foreign_access(s->gref[i]) != 0)) {
+			shost_printk(PREFIX(ALERT), info->host,
+				     "grant still in use by backend\n");
+			BUG();
 		}
+		gnttab_end_foreign_access(s->gref[i], 0UL);
 	}
-
-	return;
 }
 
 
@@ -144,7 +142,7 @@ static void scsifront_cdb_cmd_done(struc
 	if (sc == NULL)
 		BUG();
 
-	scsifront_gnttab_done(&info->shadow[id], id);
+	scsifront_gnttab_done(info, id);
 	add_id_to_freelist(info, id);
 
 	sc->result = ring_res->rslt;
@@ -180,7 +178,7 @@ static void scsifront_sync_cmd_done(stru
 		_add_id_to_freelist(info, id);
 		break;
 	default:
-		shost_printk(KERN_ERR "scsifront: ", info->host,
+		shost_printk(PREFIX(ERR), info->host,
 			     "bad reset state %d, possibly leaking %u\n",
 			     info->shadow[id].rslt_reset, id);
 		break;
@@ -272,7 +270,8 @@ static int map_data_for_request(struct v
 
 	err = gnttab_alloc_grant_references(VSCSIIF_SG_TABLESIZE, &gref_head);
 	if (err) {
-		printk(KERN_ERR "scsifront: gnttab_alloc_grant_references() error\n");
+		shost_printk(PREFIX(ERR), info->host,
+			     "gnttab_alloc_grant_references() error\n");
 		return -ENOMEM;
 	}
 
@@ -282,7 +281,8 @@ static int map_data_for_request(struct v
 		nr_pages = (sc->request_bufflen + sg[0].offset + PAGE_SIZE - 1) >> PAGE_SHIFT;
 
 		if (nr_pages > VSCSIIF_SG_TABLESIZE) {
-			printk(KERN_ERR "scsifront: Unable to map request_buffer for command!\n");
+			shost_printk(PREFIX(ERR), info->host,
+				     "Unable to map request_buffer for command!\n");
 			ref_cnt = (-E2BIG);
 			goto big_to_sg;
 		}
@@ -369,9 +369,11 @@ static int scsifront_queuecommand(struct
 	uint16_t rqid;
 
 /* debug printk to identify more missing scsi commands
-	printk(KERN_INFO "scsicmd: len=%i, 0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x",sc->cmd_len,
-		sc->cmnd[0],sc->cmnd[1],sc->cmnd[2],sc->cmnd[3],sc->cmnd[4],
-		sc->cmnd[5],sc->cmnd[6],sc->cmnd[7],sc->cmnd[8],sc->cmnd[9]);
+	shost_printk(KERN_INFO "scsicmd: ", sc->device->host,
+		     "len=%u %#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x\n",
+		     sc->cmd_len, sc->cmnd[0], sc->cmnd[1],
+		     sc->cmnd[2], sc->cmnd[3], sc->cmnd[4], sc->cmnd[5],
+		     sc->cmnd[6], sc->cmnd[7], sc->cmnd[8], sc->cmnd[9]);
 */
 	if (RING_FULL(&info->ring)) {
 		goto out_host_busy;
diff -r 4d1471ca031e -r b357fab4566a drivers/xen/scsifront/xenbus.c
--- a/drivers/xen/scsifront/xenbus.c	Mon Nov 26 09:25:42 2012 +0100
+++ b/drivers/xen/scsifront/xenbus.c	Mon Nov 26 09:29:19 2012 +0100
@@ -214,7 +214,7 @@ static int scsifront_probe(struct xenbus
 	if (IS_ERR(info->kthread)) {
 		err = PTR_ERR(info->kthread);
 		info->kthread = NULL;
-		printk(KERN_ERR "scsifront: kthread start err %d\n", err);
+		dev_err(&dev->dev, "kthread start err %d\n", err);
 		goto free_sring;
 	}
 
@@ -226,7 +226,7 @@ static int scsifront_probe(struct xenbus
 
 	err = scsi_add_host(host, &dev->dev);
 	if (err) {
-		printk(KERN_ERR "scsifront: fail to add scsi host %d\n", err);
+		dev_err(&dev->dev, "fail to add scsi host %d\n", err);
 		goto free_sring;
 	}
 
@@ -317,7 +317,7 @@ static void scsifront_do_lun_hotplug(str
 			if (device_state == XenbusStateInitialised) {
 				sdev = scsi_device_lookup(info->host, chn, tgt, lun);
 				if (sdev) {
-					printk(KERN_ERR "scsifront: Device already in use.\n");
+					dev_err(&dev->dev, "Device already in use.\n");
 					scsi_device_put(sdev);
 					xenbus_printf(XBT_NIL, dev->nodename,
 						state_str, "%d", XenbusStateClosed);

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

From xen-changelog-bounces@lists.xen.org Mon Nov 26 08:33:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Nov 2012 08: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 1Tcu7t-00013F-1V; Mon, 26 Nov 2012 08:33:13 +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 1Tcu7r-00013A-Sm
	for xen-changelog@lists.xensource.com; Mon, 26 Nov 2012 08:33:12 +0000
Received: from [85.158.137.99:22779] by server-4.bemta-3.messagelabs.com id
	46/EE-30023-24923B05; Mon, 26 Nov 2012 08:33:06 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-217.messagelabs.com!1353918784!20458914!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27922 invoked from network); 26 Nov 2012 08:33:05 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	26 Nov 2012 08:33: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 1Tcu7k-0000YF-7c
	for xen-changelog@lists.xensource.com; Mon, 26 Nov 2012 08:33:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Tcu7k-0006T5-2E
	for xen-changelog@lists.xensource.com; Mon, 26 Nov 2012 08:33:04 +0000
Message-Id: <E1Tcu7k-0006T5-2E@xenbits.xen.org>
Date: Mon, 26 Nov 2012 08:33: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] scsifront: consolidate printing
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353918559 -3600
# Node ID b357fab4566ac8daf168e49fee383b1b0a4b9ffb
# Parent  4d1471ca031e65eca5e508eab8330bef9799f5fb
scsifront: consolidate printing

Use shost_printk() or dev_err() instead of plain printk().

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


diff -r 4d1471ca031e -r b357fab4566a drivers/xen/scsifront/scsifront.c
--- a/drivers/xen/scsifront/scsifront.c	Mon Nov 26 09:25:42 2012 +0100
+++ b/drivers/xen/scsifront/scsifront.c	Mon Nov 26 09:29:19 2012 +0100
@@ -30,6 +30,8 @@
  
 #include "common.h"
 
+#define PREFIX(lvl) KERN_##lvl "scsifront: "
+
 static int get_id_from_freelist(struct vscsifrnt_info *info)
 {
 	unsigned long flags;
@@ -108,26 +110,22 @@ irqreturn_t scsifront_intr(int irq, void
 }
 
 
-static void scsifront_gnttab_done(struct vscsifrnt_shadow *s, uint32_t id)
+static void scsifront_gnttab_done(struct vscsifrnt_info *info, uint32_t id)
 {
+	struct vscsifrnt_shadow *s = &info->shadow[id];
 	int i;
 
 	if (s->sc->sc_data_direction == DMA_NONE)
 		return;
 
-	if (s->nr_segments) {
-		for (i = 0; i < s->nr_segments; i++) {
-			if (unlikely(gnttab_query_foreign_access(
-				s->gref[i]) != 0)) {
-				printk(KERN_ALERT "scsifront: "
-					"grant still in use by backend.\n");
-				BUG();
-			}
-			gnttab_end_foreign_access(s->gref[i], 0UL);
+	for (i = 0; i < s->nr_segments; i++) {
+		if (unlikely(gnttab_query_foreign_access(s->gref[i]) != 0)) {
+			shost_printk(PREFIX(ALERT), info->host,
+				     "grant still in use by backend\n");
+			BUG();
 		}
+		gnttab_end_foreign_access(s->gref[i], 0UL);
 	}
-
-	return;
 }
 
 
@@ -144,7 +142,7 @@ static void scsifront_cdb_cmd_done(struc
 	if (sc == NULL)
 		BUG();
 
-	scsifront_gnttab_done(&info->shadow[id], id);
+	scsifront_gnttab_done(info, id);
 	add_id_to_freelist(info, id);
 
 	sc->result = ring_res->rslt;
@@ -180,7 +178,7 @@ static void scsifront_sync_cmd_done(stru
 		_add_id_to_freelist(info, id);
 		break;
 	default:
-		shost_printk(KERN_ERR "scsifront: ", info->host,
+		shost_printk(PREFIX(ERR), info->host,
 			     "bad reset state %d, possibly leaking %u\n",
 			     info->shadow[id].rslt_reset, id);
 		break;
@@ -272,7 +270,8 @@ static int map_data_for_request(struct v
 
 	err = gnttab_alloc_grant_references(VSCSIIF_SG_TABLESIZE, &gref_head);
 	if (err) {
-		printk(KERN_ERR "scsifront: gnttab_alloc_grant_references() error\n");
+		shost_printk(PREFIX(ERR), info->host,
+			     "gnttab_alloc_grant_references() error\n");
 		return -ENOMEM;
 	}
 
@@ -282,7 +281,8 @@ static int map_data_for_request(struct v
 		nr_pages = (sc->request_bufflen + sg[0].offset + PAGE_SIZE - 1) >> PAGE_SHIFT;
 
 		if (nr_pages > VSCSIIF_SG_TABLESIZE) {
-			printk(KERN_ERR "scsifront: Unable to map request_buffer for command!\n");
+			shost_printk(PREFIX(ERR), info->host,
+				     "Unable to map request_buffer for command!\n");
 			ref_cnt = (-E2BIG);
 			goto big_to_sg;
 		}
@@ -369,9 +369,11 @@ static int scsifront_queuecommand(struct
 	uint16_t rqid;
 
 /* debug printk to identify more missing scsi commands
-	printk(KERN_INFO "scsicmd: len=%i, 0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x",sc->cmd_len,
-		sc->cmnd[0],sc->cmnd[1],sc->cmnd[2],sc->cmnd[3],sc->cmnd[4],
-		sc->cmnd[5],sc->cmnd[6],sc->cmnd[7],sc->cmnd[8],sc->cmnd[9]);
+	shost_printk(KERN_INFO "scsicmd: ", sc->device->host,
+		     "len=%u %#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x\n",
+		     sc->cmd_len, sc->cmnd[0], sc->cmnd[1],
+		     sc->cmnd[2], sc->cmnd[3], sc->cmnd[4], sc->cmnd[5],
+		     sc->cmnd[6], sc->cmnd[7], sc->cmnd[8], sc->cmnd[9]);
 */
 	if (RING_FULL(&info->ring)) {
 		goto out_host_busy;
diff -r 4d1471ca031e -r b357fab4566a drivers/xen/scsifront/xenbus.c
--- a/drivers/xen/scsifront/xenbus.c	Mon Nov 26 09:25:42 2012 +0100
+++ b/drivers/xen/scsifront/xenbus.c	Mon Nov 26 09:29:19 2012 +0100
@@ -214,7 +214,7 @@ static int scsifront_probe(struct xenbus
 	if (IS_ERR(info->kthread)) {
 		err = PTR_ERR(info->kthread);
 		info->kthread = NULL;
-		printk(KERN_ERR "scsifront: kthread start err %d\n", err);
+		dev_err(&dev->dev, "kthread start err %d\n", err);
 		goto free_sring;
 	}
 
@@ -226,7 +226,7 @@ static int scsifront_probe(struct xenbus
 
 	err = scsi_add_host(host, &dev->dev);
 	if (err) {
-		printk(KERN_ERR "scsifront: fail to add scsi host %d\n", err);
+		dev_err(&dev->dev, "fail to add scsi host %d\n", err);
 		goto free_sring;
 	}
 
@@ -317,7 +317,7 @@ static void scsifront_do_lun_hotplug(str
 			if (device_state == XenbusStateInitialised) {
 				sdev = scsi_device_lookup(info->host, chn, tgt, lun);
 				if (sdev) {
-					printk(KERN_ERR "scsifront: Device already in use.\n");
+					dev_err(&dev->dev, "Device already in use.\n");
 					scsi_device_put(sdev);
 					xenbus_printf(XBT_NIL, dev->nodename,
 						state_str, "%d", XenbusStateClosed);

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

From xen-changelog-bounces@lists.xen.org Tue Nov 27 05:11:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Nov 2012 05:11: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.xen.org>)
	id 1TdDRw-00045w-8K; Tue, 27 Nov 2012 05: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 1TdDRv-00045o-7U
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 05:11:11 +0000
Received: from [85.158.143.99:64013] by server-1.bemta-4.messagelabs.com id
	9F/A2-27934-E6B44B05; Tue, 27 Nov 2012 05:11:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-216.messagelabs.com!1353993068!31459543!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26538 invoked from network); 27 Nov 2012 05:11:09 -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;
	27 Nov 2012 05: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 1TdDRs-0004R4-MG
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 05:11:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TdDRs-00060e-9D
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 05:11:08 +0000
Message-Id: <E1TdDRs-00060e-9D@xenbits.xen.org>
Date: Tue, 27 Nov 2012 05:11:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/time: fix scale_delta() inline
	assembly
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353946839 -3600
# Node ID 16bf7f3069a77c8a15b785cfdb5f2f634661d7fc
# Parent  0049de3827bcfe3488dc6c7b7a60327a562aee5c
x86/time: fix scale_delta() inline assembly

The way it was coded, it clobbered %rdx without telling the compiler.
This generally didn't cause any problems except when there are two back
to back invocations (as in plt_overflow()), as in that case the
compiler may validly assume that it can re-use for the second instance
the value loaded into %rdx before the first one.

Once at it, also properly relax the second operand of "mul" (there's no
need for it to be in %rdx, or a register at all), and switch away from
using explicit register names in the instruction operands.

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


diff -r 0049de3827bc -r 16bf7f3069a7 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c	Fri Nov 23 11:06:15 2012 +0000
+++ b/xen/arch/x86/time.c	Mon Nov 26 17:20:39 2012 +0100
@@ -127,8 +127,9 @@ static inline u64 scale_delta(u64 delta,
         delta <<= scale->shift;
 
     asm (
-        "mul %%rdx ; shrd $32,%%rdx,%%rax"
-        : "=a" (product) : "0" (delta), "d" ((u64)scale->mul_frac) );
+        "mul %2 ; shrd $32,%1,%0"
+        : "=a" (product), "=d" (delta)
+        : "rm" (delta), "0" ((u64)scale->mul_frac) );
 
     return product;
 }

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

From xen-changelog-bounces@lists.xen.org Tue Nov 27 05:11:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Nov 2012 05:11: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.xen.org>)
	id 1TdDRw-00045w-8K; Tue, 27 Nov 2012 05: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 1TdDRv-00045o-7U
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 05:11:11 +0000
Received: from [85.158.143.99:64013] by server-1.bemta-4.messagelabs.com id
	9F/A2-27934-E6B44B05; Tue, 27 Nov 2012 05:11:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-216.messagelabs.com!1353993068!31459543!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26538 invoked from network); 27 Nov 2012 05:11:09 -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;
	27 Nov 2012 05: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 1TdDRs-0004R4-MG
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 05:11:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TdDRs-00060e-9D
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 05:11:08 +0000
Message-Id: <E1TdDRs-00060e-9D@xenbits.xen.org>
Date: Tue, 27 Nov 2012 05:11:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/time: fix scale_delta() inline
	assembly
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1353946839 -3600
# Node ID 16bf7f3069a77c8a15b785cfdb5f2f634661d7fc
# Parent  0049de3827bcfe3488dc6c7b7a60327a562aee5c
x86/time: fix scale_delta() inline assembly

The way it was coded, it clobbered %rdx without telling the compiler.
This generally didn't cause any problems except when there are two back
to back invocations (as in plt_overflow()), as in that case the
compiler may validly assume that it can re-use for the second instance
the value loaded into %rdx before the first one.

Once at it, also properly relax the second operand of "mul" (there's no
need for it to be in %rdx, or a register at all), and switch away from
using explicit register names in the instruction operands.

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


diff -r 0049de3827bc -r 16bf7f3069a7 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c	Fri Nov 23 11:06:15 2012 +0000
+++ b/xen/arch/x86/time.c	Mon Nov 26 17:20:39 2012 +0100
@@ -127,8 +127,9 @@ static inline u64 scale_delta(u64 delta,
         delta <<= scale->shift;
 
     asm (
-        "mul %%rdx ; shrd $32,%%rdx,%%rax"
-        : "=a" (product) : "0" (delta), "d" ((u64)scale->mul_frac) );
+        "mul %2 ; shrd $32,%1,%0"
+        : "=a" (product), "=d" (delta)
+        : "rm" (delta), "0" ((u64)scale->mul_frac) );
 
     return product;
 }

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

From xen-changelog-bounces@lists.xen.org Tue Nov 27 21:55:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Nov 2012 21: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.xen.org>)
	id 1TdT7b-0004i7-NS; Tue, 27 Nov 2012 21:55:15 +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 1TdT7a-0004hg-Bu
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:14 +0000
Received: from [85.158.137.99:18641] by server-1.bemta-3.messagelabs.com id
	2B/9B-12169-1C635B05; Tue, 27 Nov 2012 21:55:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-217.messagelabs.com!1354053310!20856660!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28248 invoked from network); 27 Nov 2012 21:55:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	27 Nov 2012 21: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 1TdT7W-0000go-BB
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TdT7W-0007Ou-3r
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:10 +0000
Message-Id: <E1TdT7W-0007Ou-3r@xenbits.xen.org>
Date: Tue, 27 Nov 2012 21:55:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: fix a variable underflow in
	libxl_wait_for_free_memory
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Ronny Hegewald <ronny.hegewald@online.de>
# Date 1354025619 0
# Node ID 678718a2e565ee0e45fcfd7606d99d30ab038cbe
# Parent  48a02f60bf1e4be1f376a848fb6800e4caf333b6
libxl: fix a variable underflow in libxl_wait_for_free_memory

When xl is called to create a domU and there is not enough memory available,
then the autoballooning is called to extract memory from dom0. During the
ballooning a loop in libxl_wait_for_free_memory() waits unless enough memory
is available to create the domU.

But because of a variable-underflow the loop can finish too soon and xl
finally aborts with the message:

xc: error: panic: xc_dom_boot.c:161: xc_dom_boot_mem_init: can't allocate low memory for domain: Out of memory
libxl: error: libxl_dom.c:430:libxl__build_pv: xc_dom_boot_mem_init failed: Device or resource busy
libxl: error: libxl_create.c:901:domcreate_rebuild_done: cannot (re-)build domain: -3

The variable-underflow happens when freemem_slack is larger then
info.free_pages*4, because the solution of this operation is converted
implicit to a unsigned int to match the type of memory_kb.

Add a extra check for this condition to solve the problem.

Signed-off-by: Ronny Hegewald <Ronny.Hegewald@online.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 48a02f60bf1e -r 678718a2e565 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Nov 27 14:13:38 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Nov 27 14:13:39 2012 +0000
@@ -3764,7 +3764,8 @@ int libxl_wait_for_free_memory(libxl_ctx
         rc = libxl_get_physinfo(ctx, &info);
         if (rc < 0)
             goto out;
-        if (info.free_pages * 4 - freemem_slack >= memory_kb) {
+        if (info.free_pages * 4 >= freemem_slack &&
+            info.free_pages * 4 - freemem_slack >= memory_kb) {
             rc = 0;
             goto out;
         }

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

From xen-changelog-bounces@lists.xen.org Tue Nov 27 21:55:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Nov 2012 21: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.xen.org>)
	id 1TdT7b-0004i7-NS; Tue, 27 Nov 2012 21:55:15 +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 1TdT7a-0004hg-Bu
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:14 +0000
Received: from [85.158.137.99:18641] by server-1.bemta-3.messagelabs.com id
	2B/9B-12169-1C635B05; Tue, 27 Nov 2012 21:55:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-217.messagelabs.com!1354053310!20856660!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28248 invoked from network); 27 Nov 2012 21:55:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-217.messagelabs.com with AES256-SHA encrypted SMTP;
	27 Nov 2012 21: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 1TdT7W-0000go-BB
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TdT7W-0007Ou-3r
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:10 +0000
Message-Id: <E1TdT7W-0007Ou-3r@xenbits.xen.org>
Date: Tue, 27 Nov 2012 21:55:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: fix a variable underflow in
	libxl_wait_for_free_memory
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Ronny Hegewald <ronny.hegewald@online.de>
# Date 1354025619 0
# Node ID 678718a2e565ee0e45fcfd7606d99d30ab038cbe
# Parent  48a02f60bf1e4be1f376a848fb6800e4caf333b6
libxl: fix a variable underflow in libxl_wait_for_free_memory

When xl is called to create a domU and there is not enough memory available,
then the autoballooning is called to extract memory from dom0. During the
ballooning a loop in libxl_wait_for_free_memory() waits unless enough memory
is available to create the domU.

But because of a variable-underflow the loop can finish too soon and xl
finally aborts with the message:

xc: error: panic: xc_dom_boot.c:161: xc_dom_boot_mem_init: can't allocate low memory for domain: Out of memory
libxl: error: libxl_dom.c:430:libxl__build_pv: xc_dom_boot_mem_init failed: Device or resource busy
libxl: error: libxl_create.c:901:domcreate_rebuild_done: cannot (re-)build domain: -3

The variable-underflow happens when freemem_slack is larger then
info.free_pages*4, because the solution of this operation is converted
implicit to a unsigned int to match the type of memory_kb.

Add a extra check for this condition to solve the problem.

Signed-off-by: Ronny Hegewald <Ronny.Hegewald@online.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 48a02f60bf1e -r 678718a2e565 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Nov 27 14:13:38 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Nov 27 14:13:39 2012 +0000
@@ -3764,7 +3764,8 @@ int libxl_wait_for_free_memory(libxl_ctx
         rc = libxl_get_physinfo(ctx, &info);
         if (rc < 0)
             goto out;
-        if (info.free_pages * 4 - freemem_slack >= memory_kb) {
+        if (info.free_pages * 4 >= freemem_slack &&
+            info.free_pages * 4 - freemem_slack >= memory_kb) {
             rc = 0;
             goto out;
         }

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

From xen-changelog-bounces@lists.xen.org Tue Nov 27 21:55:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Nov 2012 21: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.xen.org>)
	id 1TdT7c-0004iR-Tb; Tue, 27 Nov 2012 21: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 1TdT7b-0004hy-Ma
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:15 +0000
Received: from [85.158.139.211:49785] by server-15.bemta-5.messagelabs.com id
	FE/D7-26920-2C635B05; Tue, 27 Nov 2012 21:55:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-206.messagelabs.com!1354053313!17669516!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13202 invoked from network); 27 Nov 2012 21:55:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	27 Nov 2012 21: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 1TdT7Y-0000gy-Sc
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TdT7Y-0007Pf-DT
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:12 +0000
Message-Id: <E1TdT7Y-0007Pf-DT@xenbits.xen.org>
Date: Tue, 27 Nov 2012 21:55:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Fix bug in libxl_cdrom_insert,
	make more robust against bad xenstore data
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1354025621 0
# Node ID 1c69c938f641a643e6ebfbdfc412e2c601e7032d
# Parent  17ffbe7cf645029a9c9e0c875ccd9424ec56ac62
libxl: Fix bug in libxl_cdrom_insert, make more robust against bad xenstore data

libxl_cdrom_insert was failing to initialize the backend type,
resulting in the wrong default backend.  The result was not only that
the CD was not inserted properly, but also that some improper xenstore
entries were created, causing further block commands to fail.

This patch fixes the bug by setting the disk backend type based on the
type of the existing device.

It also makes the system more robust by checking to see that it has
got a valid path before proceeding to write a partial xenstore entry.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 17ffbe7cf645 -r 1c69c938f641 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Nov 27 14:13:40 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Nov 27 14:13:41 2012 +0000
@@ -2354,6 +2354,7 @@ int libxl_cdrom_insert(libxl_ctx *ctx, u
 
     libxl__device device;
     const char * path;
+    char * tmp;
 
     flexarray_t *insert = NULL;
 
@@ -2384,8 +2385,11 @@ int libxl_cdrom_insert(libxl_ctx *ctx, u
     disks = libxl_device_disk_list(ctx, domid, &num);
     for (i = 0; i < num; i++) {
         if (disks[i].is_cdrom && !strcmp(disk->vdev, disks[i].vdev))
-            /* found */
+        {
+            /* Found.  Set backend type appropriately. */
+            disk->backend=disks[i].backend;
             break;
+        }
     }
     if (i == num) {
         LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Virtual device not found");
@@ -2411,6 +2415,17 @@ int libxl_cdrom_insert(libxl_ctx *ctx, u
 
     path = libxl__device_backend_path(gc, &device);
 
+    /* Sanity check: make sure the backend exists before writing here */
+    tmp = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/frontend", path));
+    if (!tmp)
+    {
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Internal error: %s does not exist",
+            libxl__sprintf(gc, "%s/frontend", path));
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
+
     insert = flexarray_make(gc, 4, 1);
 
     flexarray_append_pair(insert, "type",

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

From xen-changelog-bounces@lists.xen.org Tue Nov 27 21:55:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Nov 2012 21: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.xen.org>)
	id 1TdT7c-0004iR-Tb; Tue, 27 Nov 2012 21: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 1TdT7b-0004hy-Ma
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:15 +0000
Received: from [85.158.139.211:49785] by server-15.bemta-5.messagelabs.com id
	FE/D7-26920-2C635B05; Tue, 27 Nov 2012 21:55:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-206.messagelabs.com!1354053313!17669516!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13202 invoked from network); 27 Nov 2012 21:55:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	27 Nov 2012 21: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 1TdT7Y-0000gy-Sc
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TdT7Y-0007Pf-DT
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:12 +0000
Message-Id: <E1TdT7Y-0007Pf-DT@xenbits.xen.org>
Date: Tue, 27 Nov 2012 21:55:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Fix bug in libxl_cdrom_insert,
	make more robust against bad xenstore data
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1354025621 0
# Node ID 1c69c938f641a643e6ebfbdfc412e2c601e7032d
# Parent  17ffbe7cf645029a9c9e0c875ccd9424ec56ac62
libxl: Fix bug in libxl_cdrom_insert, make more robust against bad xenstore data

libxl_cdrom_insert was failing to initialize the backend type,
resulting in the wrong default backend.  The result was not only that
the CD was not inserted properly, but also that some improper xenstore
entries were created, causing further block commands to fail.

This patch fixes the bug by setting the disk backend type based on the
type of the existing device.

It also makes the system more robust by checking to see that it has
got a valid path before proceeding to write a partial xenstore entry.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 17ffbe7cf645 -r 1c69c938f641 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Nov 27 14:13:40 2012 +0000
+++ b/tools/libxl/libxl.c	Tue Nov 27 14:13:41 2012 +0000
@@ -2354,6 +2354,7 @@ int libxl_cdrom_insert(libxl_ctx *ctx, u
 
     libxl__device device;
     const char * path;
+    char * tmp;
 
     flexarray_t *insert = NULL;
 
@@ -2384,8 +2385,11 @@ int libxl_cdrom_insert(libxl_ctx *ctx, u
     disks = libxl_device_disk_list(ctx, domid, &num);
     for (i = 0; i < num; i++) {
         if (disks[i].is_cdrom && !strcmp(disk->vdev, disks[i].vdev))
-            /* found */
+        {
+            /* Found.  Set backend type appropriately. */
+            disk->backend=disks[i].backend;
             break;
+        }
     }
     if (i == num) {
         LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Virtual device not found");
@@ -2411,6 +2415,17 @@ int libxl_cdrom_insert(libxl_ctx *ctx, u
 
     path = libxl__device_backend_path(gc, &device);
 
+    /* Sanity check: make sure the backend exists before writing here */
+    tmp = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/frontend", path));
+    if (!tmp)
+    {
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Internal error: %s does not exist",
+            libxl__sprintf(gc, "%s/frontend", path));
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
+
     insert = flexarray_make(gc, 4, 1);
 
     flexarray_append_pair(insert, "type",

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

From xen-changelog-bounces@lists.xen.org Tue Nov 27 21:55:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Nov 2012 21: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.xen.org>)
	id 1TdT7b-0004iC-QN; Tue, 27 Nov 2012 21:55: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 1TdT7a-0004hj-UO
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:15 +0000
Received: from [85.158.139.83:32767] by server-9.bemta-5.messagelabs.com id
	CC/34-29295-2C635B05; Tue, 27 Nov 2012 21:55:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-182.messagelabs.com!1354053312!31910545!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9261 invoked from network); 27 Nov 2012 21:55:13 -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;
	27 Nov 2012 21: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 1TdT7Y-0000gv-1a
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TdT7X-0007PO-Kp
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:11 +0000
Message-Id: <E1TdT7X-0007PO-Kp@xenbits.xen.org>
Date: Tue, 27 Nov 2012 21:55:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: xl.conf(5): correct advice re
	autoballooning vs. dom0_mem.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1354025620 0
# Node ID 17ffbe7cf645029a9c9e0c875ccd9424ec56ac62
# Parent  24779046247dceaeeef194b77b00d3ed0ef1563a
xl: xl.conf(5): correct advice re autoballooning vs. dom0_mem.

The advice was backwards, you should really disable autoballoon if you
use dom0_mem. Also add a reference to the command-line docs.

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 24779046247d -r 17ffbe7cf645 docs/man/xl.conf.pod.5
--- a/docs/man/xl.conf.pod.5	Tue Nov 27 14:13:39 2012 +0000
+++ b/docs/man/xl.conf.pod.5	Tue Nov 27 14:13:40 2012 +0000
@@ -49,9 +49,9 @@ The semantics of each C<KEY> defines whi
 
 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.
+new domain. You are strongly recommended to set this to C<0>
+(C<False>) if you use the C<dom0_mem> hypervisor command line to
+reduce the amount of memory given to domain 0 by default.
 
 Default: C<1>
 
diff -r 24779046247d -r 17ffbe7cf645 docs/misc/xen-command-line.markdown
--- a/docs/misc/xen-command-line.markdown	Tue Nov 27 14:13:39 2012 +0000
+++ b/docs/misc/xen-command-line.markdown	Tue Nov 27 14:13:40 2012 +0000
@@ -440,6 +440,11 @@ reservation is unlimited.
 For example, to set dom0's initial memory allocation to 512MB but
 allow it to balloon up as far as 1GB use `dom0_mem=512M,max:1G`
 
+If you use this option then it is highly recommended that you disable
+any dom0 autoballooning feature present in your toolstack. See the
+_xl.conf(5)_ man page or [Xen Best
+Practices](http://wiki.xen.org/wiki/Xen_Best_Practices#Xen_dom0_dedicated_memory_and_preventing_dom0_memory_ballooning).
+
 ### dom0\_shadow
 > `= <boolean>`
 

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

From xen-changelog-bounces@lists.xen.org Tue Nov 27 21:55:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Nov 2012 21: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.xen.org>)
	id 1TdT7a-0004hh-9b; Tue, 27 Nov 2012 21:55:14 +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 1TdT7Z-0004ha-2J
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:13 +0000
Received: from [193.109.254.147:53471] by server-10.bemta-14.messagelabs.com
	id 49/B4-31741-0C635B05; Tue, 27 Nov 2012 21:55:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1354053310!6131898!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28846 invoked from network); 27 Nov 2012 21:55: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;
	27 Nov 2012 21: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 1TdT7W-0000gm-4d
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TdT7V-0007Of-4d
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:09 +0000
Message-Id: <E1TdT7V-0007Of-4d@xenbits.xen.org>
Date: Tue, 27 Nov 2012 21:55:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstore-chmod: handle arbitrary
	number of perms rather than MAX_PERMS constant
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Chunyan Liu <cyliu@suse.com>
# Date 1354025618 0
# Node ID 48a02f60bf1e4be1f376a848fb6800e4caf333b6
# Parent  16bf7f3069a77c8a15b785cfdb5f2f634661d7fc
xenstore-chmod: handle arbitrary number of perms rather than MAX_PERMS constant

Constant MAX_PERMS 16 is too small to use in some occasions, e.g. if
there are more than 16 domU(s) on one hypervisor (it's easy to
achieve) and one wants to do xenstore-chmod PATH to all domU(s). So,
remove MAX_PERMS limitation and make it as arbitrary number of perms.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 16bf7f3069a7 -r 48a02f60bf1e tools/xenstore/xenstore_client.c
--- a/tools/xenstore/xenstore_client.c	Mon Nov 26 17:20:39 2012 +0100
+++ b/tools/xenstore/xenstore_client.c	Tue Nov 27 14:13:38 2012 +0000
@@ -25,7 +25,6 @@
 #define PATH_SEP '/'
 #define MAX_PATH_LEN 256
 
-#define MAX_PERMS 16
 
 enum mode {
     MODE_unknown,
@@ -407,44 +406,41 @@ perform(enum mode mode, int optind, int 
                 output("%s\n", list[i]);
             }
             free(list);
-	    optind++;
-	    break;
-	}
-	case MODE_ls: {
-	    do_ls(xsh, argv[optind], 0, prefix);
- 	    optind++;
- 	    break;
+            optind++;
+            break;
+        }
+        case MODE_ls: {
+            do_ls(xsh, argv[optind], 0, prefix);
+            optind++;
+            break;
         }
         case MODE_chmod: {
-            struct xs_permissions perms[MAX_PERMS];
-            int nperms = 0;
             /* save path pointer: */
             char *path = argv[optind++];
-            for (; argv[optind]; optind++, nperms++)
+            int nperms = argc - optind;
+            struct xs_permissions perms[nperms];
+            int i;
+            for (i = 0; argv[optind]; optind++, i++)
             {
-                if (MAX_PERMS <= nperms)
-                    errx(1, "Too many permissions specified.  "
-			 "Maximum per invocation is %d.", MAX_PERMS);
-
-                perms[nperms].id = atoi(argv[optind]+1);
+                perms[i].id = atoi(argv[optind]+1);
 
                 switch (argv[optind][0])
                 {
                 case 'n':
-                    perms[nperms].perms = XS_PERM_NONE;
+                    perms[i].perms = XS_PERM_NONE;
                     break;
                 case 'r':
-                    perms[nperms].perms = XS_PERM_READ;
+                    perms[i].perms = XS_PERM_READ;
                     break;
                 case 'w':
-                    perms[nperms].perms = XS_PERM_WRITE;
+                    perms[i].perms = XS_PERM_WRITE;
                     break;
                 case 'b':
-                    perms[nperms].perms = XS_PERM_READ | XS_PERM_WRITE;
+                    perms[i].perms = XS_PERM_READ | XS_PERM_WRITE;
                     break;
                 default:
                     errx(1, "Invalid permission specification: '%c'",
-			 argv[optind][0]);
+                         argv[optind][0]);
                 }
             }
 

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

From xen-changelog-bounces@lists.xen.org Tue Nov 27 21:55:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Nov 2012 21: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.xen.org>)
	id 1TdT7b-0004iC-QN; Tue, 27 Nov 2012 21:55: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 1TdT7a-0004hj-UO
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:15 +0000
Received: from [85.158.139.83:32767] by server-9.bemta-5.messagelabs.com id
	CC/34-29295-2C635B05; Tue, 27 Nov 2012 21:55:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-182.messagelabs.com!1354053312!31910545!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9261 invoked from network); 27 Nov 2012 21:55:13 -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;
	27 Nov 2012 21: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 1TdT7Y-0000gv-1a
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TdT7X-0007PO-Kp
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:11 +0000
Message-Id: <E1TdT7X-0007PO-Kp@xenbits.xen.org>
Date: Tue, 27 Nov 2012 21:55:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: xl.conf(5): correct advice re
	autoballooning vs. dom0_mem.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1354025620 0
# Node ID 17ffbe7cf645029a9c9e0c875ccd9424ec56ac62
# Parent  24779046247dceaeeef194b77b00d3ed0ef1563a
xl: xl.conf(5): correct advice re autoballooning vs. dom0_mem.

The advice was backwards, you should really disable autoballoon if you
use dom0_mem. Also add a reference to the command-line docs.

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 24779046247d -r 17ffbe7cf645 docs/man/xl.conf.pod.5
--- a/docs/man/xl.conf.pod.5	Tue Nov 27 14:13:39 2012 +0000
+++ b/docs/man/xl.conf.pod.5	Tue Nov 27 14:13:40 2012 +0000
@@ -49,9 +49,9 @@ The semantics of each C<KEY> defines whi
 
 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.
+new domain. You are strongly recommended to set this to C<0>
+(C<False>) if you use the C<dom0_mem> hypervisor command line to
+reduce the amount of memory given to domain 0 by default.
 
 Default: C<1>
 
diff -r 24779046247d -r 17ffbe7cf645 docs/misc/xen-command-line.markdown
--- a/docs/misc/xen-command-line.markdown	Tue Nov 27 14:13:39 2012 +0000
+++ b/docs/misc/xen-command-line.markdown	Tue Nov 27 14:13:40 2012 +0000
@@ -440,6 +440,11 @@ reservation is unlimited.
 For example, to set dom0's initial memory allocation to 512MB but
 allow it to balloon up as far as 1GB use `dom0_mem=512M,max:1G`
 
+If you use this option then it is highly recommended that you disable
+any dom0 autoballooning feature present in your toolstack. See the
+_xl.conf(5)_ man page or [Xen Best
+Practices](http://wiki.xen.org/wiki/Xen_Best_Practices#Xen_dom0_dedicated_memory_and_preventing_dom0_memory_ballooning).
+
 ### dom0\_shadow
 > `= <boolean>`
 

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

From xen-changelog-bounces@lists.xen.org Tue Nov 27 21:55:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Nov 2012 21: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.xen.org>)
	id 1TdT7a-0004hh-9b; Tue, 27 Nov 2012 21:55:14 +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 1TdT7Z-0004ha-2J
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:13 +0000
Received: from [193.109.254.147:53471] by server-10.bemta-14.messagelabs.com
	id 49/B4-31741-0C635B05; Tue, 27 Nov 2012 21:55:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1354053310!6131898!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28846 invoked from network); 27 Nov 2012 21:55: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;
	27 Nov 2012 21: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 1TdT7W-0000gm-4d
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TdT7V-0007Of-4d
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:09 +0000
Message-Id: <E1TdT7V-0007Of-4d@xenbits.xen.org>
Date: Tue, 27 Nov 2012 21:55:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstore-chmod: handle arbitrary
	number of perms rather than MAX_PERMS constant
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Chunyan Liu <cyliu@suse.com>
# Date 1354025618 0
# Node ID 48a02f60bf1e4be1f376a848fb6800e4caf333b6
# Parent  16bf7f3069a77c8a15b785cfdb5f2f634661d7fc
xenstore-chmod: handle arbitrary number of perms rather than MAX_PERMS constant

Constant MAX_PERMS 16 is too small to use in some occasions, e.g. if
there are more than 16 domU(s) on one hypervisor (it's easy to
achieve) and one wants to do xenstore-chmod PATH to all domU(s). So,
remove MAX_PERMS limitation and make it as arbitrary number of perms.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 16bf7f3069a7 -r 48a02f60bf1e tools/xenstore/xenstore_client.c
--- a/tools/xenstore/xenstore_client.c	Mon Nov 26 17:20:39 2012 +0100
+++ b/tools/xenstore/xenstore_client.c	Tue Nov 27 14:13:38 2012 +0000
@@ -25,7 +25,6 @@
 #define PATH_SEP '/'
 #define MAX_PATH_LEN 256
 
-#define MAX_PERMS 16
 
 enum mode {
     MODE_unknown,
@@ -407,44 +406,41 @@ perform(enum mode mode, int optind, int 
                 output("%s\n", list[i]);
             }
             free(list);
-	    optind++;
-	    break;
-	}
-	case MODE_ls: {
-	    do_ls(xsh, argv[optind], 0, prefix);
- 	    optind++;
- 	    break;
+            optind++;
+            break;
+        }
+        case MODE_ls: {
+            do_ls(xsh, argv[optind], 0, prefix);
+            optind++;
+            break;
         }
         case MODE_chmod: {
-            struct xs_permissions perms[MAX_PERMS];
-            int nperms = 0;
             /* save path pointer: */
             char *path = argv[optind++];
-            for (; argv[optind]; optind++, nperms++)
+            int nperms = argc - optind;
+            struct xs_permissions perms[nperms];
+            int i;
+            for (i = 0; argv[optind]; optind++, i++)
             {
-                if (MAX_PERMS <= nperms)
-                    errx(1, "Too many permissions specified.  "
-			 "Maximum per invocation is %d.", MAX_PERMS);
-
-                perms[nperms].id = atoi(argv[optind]+1);
+                perms[i].id = atoi(argv[optind]+1);
 
                 switch (argv[optind][0])
                 {
                 case 'n':
-                    perms[nperms].perms = XS_PERM_NONE;
+                    perms[i].perms = XS_PERM_NONE;
                     break;
                 case 'r':
-                    perms[nperms].perms = XS_PERM_READ;
+                    perms[i].perms = XS_PERM_READ;
                     break;
                 case 'w':
-                    perms[nperms].perms = XS_PERM_WRITE;
+                    perms[i].perms = XS_PERM_WRITE;
                     break;
                 case 'b':
-                    perms[nperms].perms = XS_PERM_READ | XS_PERM_WRITE;
+                    perms[i].perms = XS_PERM_READ | XS_PERM_WRITE;
                     break;
                 default:
                     errx(1, "Invalid permission specification: '%c'",
-			 argv[optind][0]);
+                         argv[optind][0]);
                 }
             }
 

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

From xen-changelog-bounces@lists.xen.org Tue Nov 27 21:55:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Nov 2012 21: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.xen.org>)
	id 1TdT7b-0004i2-Ko; Tue, 27 Nov 2012 21:55:15 +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 1TdT7a-0004hf-8n
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:14 +0000
Received: from [85.158.138.51:25322] by server-13.bemta-3.messagelabs.com id
	D6/B4-24887-1C635B05; Tue, 27 Nov 2012 21:55:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-174.messagelabs.com!1354053311!31643422!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23236 invoked from network); 27 Nov 2012 21:55:12 -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;
	27 Nov 2012 21: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 1TdT7X-0000gs-55
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TdT7W-0007P9-Ss
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:10 +0000
Message-Id: <E1TdT7W-0007P9-Ss@xenbits.xen.org>
Date: Tue, 27 Nov 2012 21:55:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] README: add Pixman as build
	dependency
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1354025619 0
# Node ID 24779046247dceaeeef194b77b00d3ed0ef1563a
# Parent  678718a2e565ee0e45fcfd7606d99d30ab038cbe
README: add Pixman as build dependency

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 678718a2e565 -r 24779046247d README
--- a/README	Tue Nov 27 14:13:39 2012 +0000
+++ b/README	Tue Nov 27 14:13:39 2012 +0000
@@ -51,6 +51,7 @@ provided by your OS distributor:
     * Development install of libaio (e.g. libaio-dev) version 0.3.107 or
       greater. Set CONFIG_SYSTEM_LIBAIO in .config if this is not available.
     * Development install of GLib v2.0 (e.g. libglib2.0-dev)
+    * Development install of Pixman (e.g. libpixman-1-dev)
     * pkg-config
     * bridge-utils package (/sbin/brctl)
     * iproute package (/sbin/ip)

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

From xen-changelog-bounces@lists.xen.org Tue Nov 27 21:55:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Nov 2012 21: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.xen.org>)
	id 1TdT7b-0004i2-Ko; Tue, 27 Nov 2012 21:55:15 +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 1TdT7a-0004hf-8n
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:14 +0000
Received: from [85.158.138.51:25322] by server-13.bemta-3.messagelabs.com id
	D6/B4-24887-1C635B05; Tue, 27 Nov 2012 21:55:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-174.messagelabs.com!1354053311!31643422!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23236 invoked from network); 27 Nov 2012 21:55:12 -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;
	27 Nov 2012 21: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 1TdT7X-0000gs-55
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TdT7W-0007P9-Ss
	for xen-changelog@lists.xensource.com; Tue, 27 Nov 2012 21:55:10 +0000
Message-Id: <E1TdT7W-0007P9-Ss@xenbits.xen.org>
Date: Tue, 27 Nov 2012 21:55:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] README: add Pixman as build
	dependency
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1354025619 0
# Node ID 24779046247dceaeeef194b77b00d3ed0ef1563a
# Parent  678718a2e565ee0e45fcfd7606d99d30ab038cbe
README: add Pixman as build dependency

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 678718a2e565 -r 24779046247d README
--- a/README	Tue Nov 27 14:13:39 2012 +0000
+++ b/README	Tue Nov 27 14:13:39 2012 +0000
@@ -51,6 +51,7 @@ provided by your OS distributor:
     * Development install of libaio (e.g. libaio-dev) version 0.3.107 or
       greater. Set CONFIG_SYSTEM_LIBAIO in .config if this is not available.
     * Development install of GLib v2.0 (e.g. libglib2.0-dev)
+    * Development install of Pixman (e.g. libpixman-1-dev)
     * pkg-config
     * bridge-utils package (/sbin/brctl)
     * iproute package (/sbin/ip)

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

From xen-changelog-bounces@lists.xen.org Wed Nov 28 04:22:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 28 Nov 2012 04:22: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.xen.org>)
	id 1TdZA4-0002rT-7L; Wed, 28 Nov 2012 04:22:12 +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 1TdZA3-0002rN-IC
	for xen-changelog@lists.xensource.com; Wed, 28 Nov 2012 04:22:11 +0000
Received: from [85.158.139.83:39226] by server-4.bemta-5.messagelabs.com id
	2D/02-15011-27195B05; Wed, 28 Nov 2012 04:22:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-182.messagelabs.com!1354076529!32272555!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 681 invoked from network); 28 Nov 2012 04:22:10 -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;
	28 Nov 2012 04: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 1TdZA0-0003hJ-Pu
	for xen-changelog@lists.xensource.com; Wed, 28 Nov 2012 04:22:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TdZA0-0000bP-Al
	for xen-changelog@lists.xensource.com; Wed, 28 Nov 2012 04:22:08 +0000
Message-Id: <E1TdZA0-0000bP-Al@xenbits.xen.org>
Date: Wed, 28 Nov 2012 04: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] x86/time: fix scale_delta()
	inline assembly
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1354019316 -3600
# Node ID d89986111f0c40467072556c1cd1813924ff8dc1
# Parent  5639047d6c9fafa3b2d455cb60cf1d17be4035e0
x86/time: fix scale_delta() inline assembly

The way it was coded, it clobbered %rdx without telling the compiler.
This generally didn't cause any problems except when there are two back
to back invocations (as in plt_overflow()), as in that case the
compiler may validly assume that it can re-use for the second instance
the value loaded into %rdx before the first one.

Once at it, also properly relax the second operand of "mul" (there's no
need for it to be in %rdx, or a register at all), and switch away from
using explicit register names in the instruction operands.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen-unstable changeset: 26188:16bf7f3069a7
xen-unstable date: Mon Nov 26 16:20:39 UTC 2012
---


diff -r 5639047d6c9f -r d89986111f0c xen/arch/x86/time.c
--- a/xen/arch/x86/time.c	Mon Nov 19 09:43:48 2012 +0100
+++ b/xen/arch/x86/time.c	Tue Nov 27 13:28:36 2012 +0100
@@ -140,8 +140,9 @@ static inline u64 scale_delta(u64 delta,
         : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (scale->mul_frac) );
 #else
     asm (
-        "mul %%rdx ; shrd $32,%%rdx,%%rax"
-        : "=a" (product) : "0" (delta), "d" ((u64)scale->mul_frac) );
+        "mul %2 ; shrd $32,%1,%0"
+        : "=a" (product), "=d" (delta)
+        : "rm" (delta), "0" ((u64)scale->mul_frac) );
 #endif
 
     return product;

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

From xen-changelog-bounces@lists.xen.org Wed Nov 28 04:22:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 28 Nov 2012 04:22: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.xen.org>)
	id 1TdZA4-0002rT-7L; Wed, 28 Nov 2012 04:22:12 +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 1TdZA3-0002rN-IC
	for xen-changelog@lists.xensource.com; Wed, 28 Nov 2012 04:22:11 +0000
Received: from [85.158.139.83:39226] by server-4.bemta-5.messagelabs.com id
	2D/02-15011-27195B05; Wed, 28 Nov 2012 04:22:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-182.messagelabs.com!1354076529!32272555!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 681 invoked from network); 28 Nov 2012 04:22:10 -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;
	28 Nov 2012 04: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 1TdZA0-0003hJ-Pu
	for xen-changelog@lists.xensource.com; Wed, 28 Nov 2012 04:22:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TdZA0-0000bP-Al
	for xen-changelog@lists.xensource.com; Wed, 28 Nov 2012 04:22:08 +0000
Message-Id: <E1TdZA0-0000bP-Al@xenbits.xen.org>
Date: Wed, 28 Nov 2012 04: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] x86/time: fix scale_delta()
	inline assembly
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1354019316 -3600
# Node ID d89986111f0c40467072556c1cd1813924ff8dc1
# Parent  5639047d6c9fafa3b2d455cb60cf1d17be4035e0
x86/time: fix scale_delta() inline assembly

The way it was coded, it clobbered %rdx without telling the compiler.
This generally didn't cause any problems except when there are two back
to back invocations (as in plt_overflow()), as in that case the
compiler may validly assume that it can re-use for the second instance
the value loaded into %rdx before the first one.

Once at it, also properly relax the second operand of "mul" (there's no
need for it to be in %rdx, or a register at all), and switch away from
using explicit register names in the instruction operands.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen-unstable changeset: 26188:16bf7f3069a7
xen-unstable date: Mon Nov 26 16:20:39 UTC 2012
---


diff -r 5639047d6c9f -r d89986111f0c xen/arch/x86/time.c
--- a/xen/arch/x86/time.c	Mon Nov 19 09:43:48 2012 +0100
+++ b/xen/arch/x86/time.c	Tue Nov 27 13:28:36 2012 +0100
@@ -140,8 +140,9 @@ static inline u64 scale_delta(u64 delta,
         : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (scale->mul_frac) );
 #else
     asm (
-        "mul %%rdx ; shrd $32,%%rdx,%%rax"
-        : "=a" (product) : "0" (delta), "d" ((u64)scale->mul_frac) );
+        "mul %2 ; shrd $32,%1,%0"
+        : "=a" (product), "=d" (delta)
+        : "rm" (delta), "0" ((u64)scale->mul_frac) );
 #endif
 
     return product;

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

From xen-changelog-bounces@lists.xen.org Wed Nov 28 05:11:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 28 Nov 2012 05:11: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.xen.org>)
	id 1TdZvV-0003WO-SW; Wed, 28 Nov 2012 05:11:13 +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 1TdZvU-0003WA-FC
	for xen-changelog@lists.xensource.com; Wed, 28 Nov 2012 05:11:12 +0000
Received: from [85.158.138.51:10257] by server-5.bemta-3.messagelabs.com id
	13/D3-26311-FEC95B05; Wed, 28 Nov 2012 05:11:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1354079469!25407683!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20602 invoked from network); 28 Nov 2012 05:11:10 -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;
	28 Nov 2012 05: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 1TdZvR-0004OG-F9
	for xen-changelog@lists.xensource.com; Wed, 28 Nov 2012 05:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TdZvR-0001w0-6i
	for xen-changelog@lists.xensource.com; Wed, 28 Nov 2012 05:11:09 +0000
Message-Id: <E1TdZvR-0001w0-6i@xenbits.xen.org>
Date: Wed, 28 Nov 2012 05:11:08 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] x86/time: fix scale_delta()
	inline assembly
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1354019117 -3600
# Node ID 5c5c695863f73bd6a9eccaaa96cf28800e50e840
# Parent  b22e665133facc1005a2f4ebe45ee18cc453557d
x86/time: fix scale_delta() inline assembly

The way it was coded, it clobbered %rdx without telling the compiler.
This generally didn't cause any problems except when there are two back
to back invocations (as in plt_overflow()), as in that case the
compiler may validly assume that it can re-use for the second instance
the value loaded into %rdx before the first one.

Once at it, also properly relax the second operand of "mul" (there's no
need for it to be in %rdx, or a register at all), and switch away from
using explicit register names in the instruction operands.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen-unstable changeset: 26188:16bf7f3069a7
xen-unstable date: Mon Nov 26 16:20:39 UTC 2012
---


diff -r b22e665133fa -r 5c5c695863f7 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c	Tue Nov 27 13:23:04 2012 +0100
+++ b/xen/arch/x86/time.c	Tue Nov 27 13:25:17 2012 +0100
@@ -142,8 +142,9 @@ static inline u64 scale_delta(u64 delta,
         : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (scale->mul_frac) );
 #else
     asm (
-        "mul %%rdx ; shrd $32,%%rdx,%%rax"
-        : "=a" (product) : "0" (delta), "d" ((u64)scale->mul_frac) );
+        "mul %2 ; shrd $32,%1,%0"
+        : "=a" (product), "=d" (delta)
+        : "rm" (delta), "0" ((u64)scale->mul_frac) );
 #endif
 
     return product;

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

From xen-changelog-bounces@lists.xen.org Wed Nov 28 05:11:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 28 Nov 2012 05:11: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.xen.org>)
	id 1TdZvV-0003WO-SW; Wed, 28 Nov 2012 05:11:13 +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 1TdZvU-0003WA-FC
	for xen-changelog@lists.xensource.com; Wed, 28 Nov 2012 05:11:12 +0000
Received: from [85.158.138.51:10257] by server-5.bemta-3.messagelabs.com id
	13/D3-26311-FEC95B05; Wed, 28 Nov 2012 05:11:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1354079469!25407683!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20602 invoked from network); 28 Nov 2012 05:11:10 -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;
	28 Nov 2012 05: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 1TdZvR-0004OG-F9
	for xen-changelog@lists.xensource.com; Wed, 28 Nov 2012 05:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TdZvR-0001w0-6i
	for xen-changelog@lists.xensource.com; Wed, 28 Nov 2012 05:11:09 +0000
Message-Id: <E1TdZvR-0001w0-6i@xenbits.xen.org>
Date: Wed, 28 Nov 2012 05:11:08 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] x86/time: fix scale_delta()
	inline assembly
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1354019117 -3600
# Node ID 5c5c695863f73bd6a9eccaaa96cf28800e50e840
# Parent  b22e665133facc1005a2f4ebe45ee18cc453557d
x86/time: fix scale_delta() inline assembly

The way it was coded, it clobbered %rdx without telling the compiler.
This generally didn't cause any problems except when there are two back
to back invocations (as in plt_overflow()), as in that case the
compiler may validly assume that it can re-use for the second instance
the value loaded into %rdx before the first one.

Once at it, also properly relax the second operand of "mul" (there's no
need for it to be in %rdx, or a register at all), and switch away from
using explicit register names in the instruction operands.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen-unstable changeset: 26188:16bf7f3069a7
xen-unstable date: Mon Nov 26 16:20:39 UTC 2012
---


diff -r b22e665133fa -r 5c5c695863f7 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c	Tue Nov 27 13:23:04 2012 +0100
+++ b/xen/arch/x86/time.c	Tue Nov 27 13:25:17 2012 +0100
@@ -142,8 +142,9 @@ static inline u64 scale_delta(u64 delta,
         : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (scale->mul_frac) );
 #else
     asm (
-        "mul %%rdx ; shrd $32,%%rdx,%%rax"
-        : "=a" (product) : "0" (delta), "d" ((u64)scale->mul_frac) );
+        "mul %2 ; shrd $32,%1,%0"
+        : "=a" (product), "=d" (delta)
+        : "rm" (delta), "0" ((u64)scale->mul_frac) );
 #endif
 
     return product;

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

From xen-changelog-bounces@lists.xen.org Wed Nov 28 05:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 28 Nov 2012 05: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.xen.org>)
	id 1TdZvV-0003WJ-Pi; Wed, 28 Nov 2012 05:11:13 +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 1TdZvT-0003W9-Vb
	for xen-changelog@lists.xensource.com; Wed, 28 Nov 2012 05:11:12 +0000
Received: from [85.158.139.83:63423] by server-13.bemta-5.messagelabs.com id
	5E/86-27809-FEC95B05; Wed, 28 Nov 2012 05:11:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-182.messagelabs.com!1354079469!16526455!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23388 invoked from network); 28 Nov 2012 05:11: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;
	28 Nov 2012 05: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 1TdZvR-0004OD-6U
	for xen-changelog@lists.xensource.com; Wed, 28 Nov 2012 05:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TdZvQ-0001vl-Jv
	for xen-changelog@lists.xensource.com; Wed, 28 Nov 2012 05:11:08 +0000
Message-Id: <E1TdZvQ-0001vl-Jv@xenbits.xen.org>
Date: Wed, 28 Nov 2012 05:11:08 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] passthrough/PCI: replace improper
	uses of pci_find_next_cap()
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1354018984 -3600
# Node ID b22e665133facc1005a2f4ebe45ee18cc453557d
# Parent  7c4d806b3753ccf9ca70989bb8e92717007405b7
passthrough/PCI: replace improper uses of pci_find_next_cap()

Using pci_find_next_cap() without prior pci_find_cap_offset() is bogus
(and possibly wrong, given that the latter doesn't check the
PCI_STATUS_CAP_LIST flag, which so far was checked in an open-coded way
only for the non-bridge case).

Once at it, fold the two calls into one, as we need its result in any
case.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Xiantao Zhang <xiantao.zhang@intel.com>
xen-unstable changeset: 26179:ae6fb202b233
xen-unstable date: Tue Nov 20 07:58:31 UTC 2012
---


diff -r 7c4d806b3753 -r b22e665133fa xen/drivers/passthrough/pci.c
--- a/xen/drivers/passthrough/pci.c	Fri Nov 16 15:56:14 2012 +0000
+++ b/xen/drivers/passthrough/pci.c	Tue Nov 27 13:23:04 2012 +0100
@@ -565,16 +565,13 @@ void pci_release_devices(struct domain *
 
 int pdev_type(u16 seg, u8 bus, u8 devfn)
 {
-    u16 class_device;
-    u16 status, creg;
-    int pos;
+    u16 class_device, creg;
     u8 d = PCI_SLOT(devfn), f = PCI_FUNC(devfn);
+    int pos = pci_find_cap_offset(seg, bus, d, f, PCI_CAP_ID_EXP);
 
     class_device = pci_conf_read16(seg, bus, d, f, PCI_CLASS_DEVICE);
     if ( class_device == PCI_CLASS_BRIDGE_PCI )
     {
-        pos = pci_find_next_cap(seg, bus, devfn,
-                                PCI_CAPABILITY_LIST, PCI_CAP_ID_EXP);
         if ( !pos )
             return DEV_TYPE_LEGACY_PCI_BRIDGE;
         creg = pci_conf_read16(seg, bus, d, f, pos + PCI_EXP_FLAGS);
@@ -582,15 +579,7 @@ int pdev_type(u16 seg, u8 bus, u8 devfn)
             DEV_TYPE_PCIe2PCI_BRIDGE : DEV_TYPE_PCIe_BRIDGE;
     }
 
-    status = pci_conf_read16(seg, bus, d, f, PCI_STATUS);
-    if ( !(status & PCI_STATUS_CAP_LIST) )
-        return DEV_TYPE_PCI;
-
-    if ( pci_find_next_cap(seg, bus, devfn, PCI_CAPABILITY_LIST,
-                           PCI_CAP_ID_EXP) )
-        return DEV_TYPE_PCIe_ENDPOINT;
-
-    return DEV_TYPE_PCI;
+    return pos ? DEV_TYPE_PCIe_ENDPOINT : DEV_TYPE_PCI;
 }
 
 /*

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

From xen-changelog-bounces@lists.xen.org Wed Nov 28 05:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 28 Nov 2012 05: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.xen.org>)
	id 1TdZvV-0003WJ-Pi; Wed, 28 Nov 2012 05:11:13 +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 1TdZvT-0003W9-Vb
	for xen-changelog@lists.xensource.com; Wed, 28 Nov 2012 05:11:12 +0000
Received: from [85.158.139.83:63423] by server-13.bemta-5.messagelabs.com id
	5E/86-27809-FEC95B05; Wed, 28 Nov 2012 05:11:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-182.messagelabs.com!1354079469!16526455!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23388 invoked from network); 28 Nov 2012 05:11: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;
	28 Nov 2012 05: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 1TdZvR-0004OD-6U
	for xen-changelog@lists.xensource.com; Wed, 28 Nov 2012 05:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TdZvQ-0001vl-Jv
	for xen-changelog@lists.xensource.com; Wed, 28 Nov 2012 05:11:08 +0000
Message-Id: <E1TdZvQ-0001vl-Jv@xenbits.xen.org>
Date: Wed, 28 Nov 2012 05:11:08 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] passthrough/PCI: replace improper
	uses of pci_find_next_cap()
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1354018984 -3600
# Node ID b22e665133facc1005a2f4ebe45ee18cc453557d
# Parent  7c4d806b3753ccf9ca70989bb8e92717007405b7
passthrough/PCI: replace improper uses of pci_find_next_cap()

Using pci_find_next_cap() without prior pci_find_cap_offset() is bogus
(and possibly wrong, given that the latter doesn't check the
PCI_STATUS_CAP_LIST flag, which so far was checked in an open-coded way
only for the non-bridge case).

Once at it, fold the two calls into one, as we need its result in any
case.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Xiantao Zhang <xiantao.zhang@intel.com>
xen-unstable changeset: 26179:ae6fb202b233
xen-unstable date: Tue Nov 20 07:58:31 UTC 2012
---


diff -r 7c4d806b3753 -r b22e665133fa xen/drivers/passthrough/pci.c
--- a/xen/drivers/passthrough/pci.c	Fri Nov 16 15:56:14 2012 +0000
+++ b/xen/drivers/passthrough/pci.c	Tue Nov 27 13:23:04 2012 +0100
@@ -565,16 +565,13 @@ void pci_release_devices(struct domain *
 
 int pdev_type(u16 seg, u8 bus, u8 devfn)
 {
-    u16 class_device;
-    u16 status, creg;
-    int pos;
+    u16 class_device, creg;
     u8 d = PCI_SLOT(devfn), f = PCI_FUNC(devfn);
+    int pos = pci_find_cap_offset(seg, bus, d, f, PCI_CAP_ID_EXP);
 
     class_device = pci_conf_read16(seg, bus, d, f, PCI_CLASS_DEVICE);
     if ( class_device == PCI_CLASS_BRIDGE_PCI )
     {
-        pos = pci_find_next_cap(seg, bus, devfn,
-                                PCI_CAPABILITY_LIST, PCI_CAP_ID_EXP);
         if ( !pos )
             return DEV_TYPE_LEGACY_PCI_BRIDGE;
         creg = pci_conf_read16(seg, bus, d, f, pos + PCI_EXP_FLAGS);
@@ -582,15 +579,7 @@ int pdev_type(u16 seg, u8 bus, u8 devfn)
             DEV_TYPE_PCIe2PCI_BRIDGE : DEV_TYPE_PCIe_BRIDGE;
     }
 
-    status = pci_conf_read16(seg, bus, d, f, PCI_STATUS);
-    if ( !(status & PCI_STATUS_CAP_LIST) )
-        return DEV_TYPE_PCI;
-
-    if ( pci_find_next_cap(seg, bus, devfn, PCI_CAPABILITY_LIST,
-                           PCI_CAP_ID_EXP) )
-        return DEV_TYPE_PCIe_ENDPOINT;
-
-    return DEV_TYPE_PCI;
+    return pos ? DEV_TYPE_PCIe_ENDPOINT : DEV_TYPE_PCI;
 }
 
 /*

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

From xen-changelog-bounces@lists.xen.org Fri Nov 30 14:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 30 Nov 2012 14: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.xen.org>)
	id 1TeRJG-0006FY-Bi; Fri, 30 Nov 2012 14:11: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 1TeRJE-0006FH-TX
	for xen-changelog@lists.xensource.com; Fri, 30 Nov 2012 14:11:17 +0000
Received: from [85.158.139.211:30931] by server-8.bemta-5.messagelabs.com id
	40/0B-06050-38EB8B05; Fri, 30 Nov 2012 14:11:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-206.messagelabs.com!1354284670!18519316!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31292 invoked from network); 30 Nov 2012 14:11:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	30 Nov 2012 14: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 1TeRJ7-000116-S1
	for xen-changelog@lists.xensource.com; Fri, 30 Nov 2012 14:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TeRJ7-0007QZ-Ih
	for xen-changelog@lists.xensource.com; Fri, 30 Nov 2012 14:11:09 +0000
Message-Id: <E1TeRJ7-0007QZ-Ih@xenbits.xen.org>
Date: Fri, 30 Nov 2012 14:11:09 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xl: xl.conf(5): correct advice re
	autoballooning vs. dom0_mem.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1354205275 0
# Node ID b3dafd42268af1ea9558b536702841625dd52500
# Parent  ac8a9f014744a2bf9fbcd25ef5a26de7086ad958
xl: xl.conf(5): correct advice re autoballooning vs. dom0_mem.

The advice was backwards, you should really disable autoballoon if you
use dom0_mem. Also add a reference to the command-line docs.

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>

xen-unstable changeset: 26192:17ffbe7cf645
Backport-requested-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r ac8a9f014744 -r b3dafd42268a docs/man/xl.conf.pod.5
--- a/docs/man/xl.conf.pod.5	Thu Nov 29 14:58:36 2012 +0000
+++ b/docs/man/xl.conf.pod.5	Thu Nov 29 16:07:55 2012 +0000
@@ -49,9 +49,9 @@ The semantics of each C<KEY> defines whi
 
 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.
+new domain. You are strongly recommended to set this to C<0>
+(C<False>) if you use the C<dom0_mem> hypervisor command line to
+reduce the amount of memory given to domain 0 by default.
 
 Default: C<1>
 
diff -r ac8a9f014744 -r b3dafd42268a docs/misc/xen-command-line.markdown
--- a/docs/misc/xen-command-line.markdown	Thu Nov 29 14:58:36 2012 +0000
+++ b/docs/misc/xen-command-line.markdown	Thu Nov 29 16:07:55 2012 +0000
@@ -409,6 +409,11 @@ reservation is unlimited.
 For example, to set dom0's initial memory allocation to 512MB but
 allow it to balloon up as far as 1GB use `dom0_mem=512M,max:1G`
 
+If you use this option then it is highly recommended that you disable
+any dom0 autoballooning feature present in your toolstack. See the
+_xl.conf(5)_ man page or [Xen Best
+Practices](http://wiki.xen.org/wiki/Xen_Best_Practices#Xen_dom0_dedicated_memory_and_preventing_dom0_memory_ballooning).
+
 ### dom0\_shadow
 > `= <boolean>`
 

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

From xen-changelog-bounces@lists.xen.org Fri Nov 30 14:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 30 Nov 2012 14: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.xen.org>)
	id 1TeRJG-0006FY-Bi; Fri, 30 Nov 2012 14:11: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 1TeRJE-0006FH-TX
	for xen-changelog@lists.xensource.com; Fri, 30 Nov 2012 14:11:17 +0000
Received: from [85.158.139.211:30931] by server-8.bemta-5.messagelabs.com id
	40/0B-06050-38EB8B05; Fri, 30 Nov 2012 14:11:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-206.messagelabs.com!1354284670!18519316!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31292 invoked from network); 30 Nov 2012 14:11:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-206.messagelabs.com with AES256-SHA encrypted SMTP;
	30 Nov 2012 14: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 1TeRJ7-000116-S1
	for xen-changelog@lists.xensource.com; Fri, 30 Nov 2012 14:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TeRJ7-0007QZ-Ih
	for xen-changelog@lists.xensource.com; Fri, 30 Nov 2012 14:11:09 +0000
Message-Id: <E1TeRJ7-0007QZ-Ih@xenbits.xen.org>
Date: Fri, 30 Nov 2012 14:11:09 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xl: xl.conf(5): correct advice re
	autoballooning vs. dom0_mem.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1354205275 0
# Node ID b3dafd42268af1ea9558b536702841625dd52500
# Parent  ac8a9f014744a2bf9fbcd25ef5a26de7086ad958
xl: xl.conf(5): correct advice re autoballooning vs. dom0_mem.

The advice was backwards, you should really disable autoballoon if you
use dom0_mem. Also add a reference to the command-line docs.

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>

xen-unstable changeset: 26192:17ffbe7cf645
Backport-requested-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r ac8a9f014744 -r b3dafd42268a docs/man/xl.conf.pod.5
--- a/docs/man/xl.conf.pod.5	Thu Nov 29 14:58:36 2012 +0000
+++ b/docs/man/xl.conf.pod.5	Thu Nov 29 16:07:55 2012 +0000
@@ -49,9 +49,9 @@ The semantics of each C<KEY> defines whi
 
 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.
+new domain. You are strongly recommended to set this to C<0>
+(C<False>) if you use the C<dom0_mem> hypervisor command line to
+reduce the amount of memory given to domain 0 by default.
 
 Default: C<1>
 
diff -r ac8a9f014744 -r b3dafd42268a docs/misc/xen-command-line.markdown
--- a/docs/misc/xen-command-line.markdown	Thu Nov 29 14:58:36 2012 +0000
+++ b/docs/misc/xen-command-line.markdown	Thu Nov 29 16:07:55 2012 +0000
@@ -409,6 +409,11 @@ reservation is unlimited.
 For example, to set dom0's initial memory allocation to 512MB but
 allow it to balloon up as far as 1GB use `dom0_mem=512M,max:1G`
 
+If you use this option then it is highly recommended that you disable
+any dom0 autoballooning feature present in your toolstack. See the
+_xl.conf(5)_ man page or [Xen Best
+Practices](http://wiki.xen.org/wiki/Xen_Best_Practices#Xen_dom0_dedicated_memory_and_preventing_dom0_memory_ballooning).
+
 ### dom0\_shadow
 > `= <boolean>`
 

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

From xen-changelog-bounces@lists.xen.org Fri Nov 30 14:11:36 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 30 Nov 2012 14:11: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.xen.org>)
	id 1TeRJU-0006Hz-Ev; Fri, 30 Nov 2012 14:11:32 +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 1TeRJS-0006Hn-K5
	for xen-changelog@lists.xensource.com; Fri, 30 Nov 2012 14:11:30 +0000
Received: from [85.158.143.35:48307] by server-2.bemta-4.messagelabs.com id
	4D/3B-28922-19EB8B05; Fri, 30 Nov 2012 14:11:29 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1354284669!11676264!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30963 invoked from network); 30 Nov 2012 14:11:10 -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;
	30 Nov 2012 14: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 1TeRJ7-000113-2K
	for xen-changelog@lists.xensource.com; Fri, 30 Nov 2012 14:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TeRJ6-0007QK-Rh
	for xen-changelog@lists.xensource.com; Fri, 30 Nov 2012 14:11:08 +0000
Message-Id: <E1TeRJ6-0007QK-Rh@xenbits.xen.org>
Date: Fri, 30 Nov 2012 14:11:08 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xl: Suppress spurious warning
	message for cpupool-list
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1354201116 0
# Node ID ac8a9f014744a2bf9fbcd25ef5a26de7086ad958
# Parent  5c5c695863f73bd6a9eccaaa96cf28800e50e840
xl: Suppress spurious warning message for cpupool-list

libxl_cpupool_list() enumerates the cpupools by "probing": calling
cpupool_info, starting at 0 and stopping when it gets an error. However,
cpupool_info will print an error when the call to xc_cpupool_getinfo() fails,
resulting in every xl command that uses libxl_list_cpupool (such as
cpupool-list) printing that error message spuriously.

Since at the moment the times we want to print the message correspond
with the use of the existing "exact" parameter, use it to decide
whether to print the message or not.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 26185:d66987697fe3
Backport-requested-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 5c5c695863f7 -r ac8a9f014744 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Nov 27 13:25:17 2012 +0100
+++ b/tools/libxl/libxl.c	Thu Nov 29 14:58:36 2012 +0000
@@ -593,7 +593,8 @@ static int cpupool_info(libxl__gc *gc,
     xcinfo = xc_cpupool_getinfo(CTX->xch, poolid);
     if (xcinfo == NULL)
     {
-        LOGE(ERROR, "failed to get info for cpupool%d\n", poolid);
+        if (exact || errno != ENOENT)
+            LOGE(ERROR, "failed to get info for cpupool%d\n", poolid);
         return ERROR_FAIL;
     }
 

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

From xen-changelog-bounces@lists.xen.org Fri Nov 30 14:11:36 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 30 Nov 2012 14:11: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.xen.org>)
	id 1TeRJU-0006Hz-Ev; Fri, 30 Nov 2012 14:11:32 +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 1TeRJS-0006Hn-K5
	for xen-changelog@lists.xensource.com; Fri, 30 Nov 2012 14:11:30 +0000
Received: from [85.158.143.35:48307] by server-2.bemta-4.messagelabs.com id
	4D/3B-28922-19EB8B05; Fri, 30 Nov 2012 14:11:29 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1354284669!11676264!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Received: 
X-StarScan-Version: 6.6.1.8; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30963 invoked from network); 30 Nov 2012 14:11:10 -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;
	30 Nov 2012 14: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 1TeRJ7-000113-2K
	for xen-changelog@lists.xensource.com; Fri, 30 Nov 2012 14:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1TeRJ6-0007QK-Rh
	for xen-changelog@lists.xensource.com; Fri, 30 Nov 2012 14:11:08 +0000
Message-Id: <E1TeRJ6-0007QK-Rh@xenbits.xen.org>
Date: Fri, 30 Nov 2012 14:11:08 +0000
From: Xen patchbot-4.2-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.2-testing] xl: Suppress spurious warning
	message for cpupool-list
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: "Change log for Mercurial \(receive only\)"
	<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 1354201116 0
# Node ID ac8a9f014744a2bf9fbcd25ef5a26de7086ad958
# Parent  5c5c695863f73bd6a9eccaaa96cf28800e50e840
xl: Suppress spurious warning message for cpupool-list

libxl_cpupool_list() enumerates the cpupools by "probing": calling
cpupool_info, starting at 0 and stopping when it gets an error. However,
cpupool_info will print an error when the call to xc_cpupool_getinfo() fails,
resulting in every xl command that uses libxl_list_cpupool (such as
cpupool-list) printing that error message spuriously.

Since at the moment the times we want to print the message correspond
with the use of the existing "exact" parameter, use it to decide
whether to print the message or not.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>

xen-unstable changeset: 26185:d66987697fe3
Backport-requested-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 5c5c695863f7 -r ac8a9f014744 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Nov 27 13:25:17 2012 +0100
+++ b/tools/libxl/libxl.c	Thu Nov 29 14:58:36 2012 +0000
@@ -593,7 +593,8 @@ static int cpupool_info(libxl__gc *gc,
     xcinfo = xc_cpupool_getinfo(CTX->xch, poolid);
     if (xcinfo == NULL)
     {
-        LOGE(ERROR, "failed to get info for cpupool%d\n", poolid);
+        if (exact || errno != ENOENT)
+            LOGE(ERROR, "failed to get info for cpupool%d\n", poolid);
         return ERROR_FAIL;
     }
 

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

